Commit 00fca0fe6c912141ba8b06576b6c53c5b4c3cd9e
1 parent
34a80542
chore: prettier code
Showing
36 changed files
with
381 additions
and
432 deletions
src/components/ContextMenu/index.ts
src/components/ContextMenu/src/ContextMenu.tsx renamed to src/components/ContextMenu/src/ContextMenu.vue
1 | -import './index.less'; | ||
2 | - | ||
3 | -import type { ContextMenuItem, ItemContentProps } from './types'; | ||
4 | -import type { FunctionalComponent, CSSProperties } from 'vue'; | ||
5 | - | ||
6 | -import { defineComponent, nextTick, onMounted, computed, ref, unref, onUnmounted } from 'vue'; | ||
7 | - | ||
8 | -import Icon from '/@/components/Icon'; | ||
9 | -import { Menu, Divider } from 'ant-design-vue'; | ||
10 | - | ||
11 | -import { contextMenuProps } from './props'; | ||
12 | - | ||
13 | -const prefixCls = 'context-menu'; | ||
14 | - | ||
15 | -const ItemContent: FunctionalComponent<ItemContentProps> = (props) => { | ||
16 | - const { item } = props; | ||
17 | - return ( | ||
18 | - <span | ||
19 | - style="display: inline-block; width: 100%; " | ||
20 | - class="px-4" | ||
21 | - onClick={props.handler.bind(null, item)} | ||
22 | - > | ||
23 | - {props.showIcon && item.icon && <Icon class="mr-2" icon={item.icon} />} | ||
24 | - <span>{item.label}</span> | ||
25 | - </span> | ||
26 | - ); | ||
27 | -}; | ||
28 | - | ||
29 | -export default defineComponent({ | ||
30 | - name: 'ContextMenu', | ||
31 | - props: contextMenuProps, | ||
32 | - setup(props) { | ||
33 | - const wrapRef = ref<ElRef>(null); | ||
34 | - const showRef = ref(false); | ||
35 | - | ||
36 | - const getStyle = computed((): CSSProperties => { | ||
37 | - const { axis, items, styles, width } = props; | ||
38 | - const { x, y } = axis || { x: 0, y: 0 }; | ||
39 | - const menuHeight = (items || []).length * 40; | ||
40 | - const menuWidth = width; | ||
41 | - const body = document.body; | ||
42 | - | ||
43 | - const left = body.clientWidth < x + menuWidth ? x - menuWidth : x; | ||
44 | - const top = body.clientHeight < y + menuHeight ? y - menuHeight : y; | ||
45 | - return { | ||
46 | - ...styles, | ||
47 | - width: `${width}px`, | ||
48 | - left: `${left + 1}px`, | ||
49 | - top: `${top + 1}px`, | ||
50 | - }; | ||
51 | - }); | ||
52 | - | ||
53 | - onMounted(() => { | ||
54 | - nextTick(() => (showRef.value = true)); | ||
55 | - }); | ||
56 | - | ||
57 | - onUnmounted(() => { | ||
58 | - const el = unref(wrapRef); | ||
59 | - el && document.body.removeChild(el); | ||
60 | - }); | 1 | +<script lang="tsx"> |
2 | + import type { ContextMenuItem, ItemContentProps, Axis } from './typing'; | ||
3 | + import type { FunctionalComponent, CSSProperties } from 'vue'; | ||
4 | + import { defineComponent, nextTick, onMounted, computed, ref, unref, onUnmounted } from 'vue'; | ||
5 | + import Icon from '/@/components/Icon'; | ||
6 | + import { Menu, Divider } from 'ant-design-vue'; | ||
7 | + | ||
8 | + const prefixCls = 'context-menu'; | ||
9 | + | ||
10 | + const props = { | ||
11 | + width: { type: Number, default: 156 }, | ||
12 | + customEvent: { type: Object as PropType<Event>, default: null }, | ||
13 | + styles: { type: Object as PropType<CSSProperties> }, | ||
14 | + showIcon: { type: Boolean, default: true }, | ||
15 | + axis: { | ||
16 | + // The position of the right mouse button click | ||
17 | + type: Object as PropType<Axis>, | ||
18 | + default() { | ||
19 | + return { x: 0, y: 0 }; | ||
20 | + }, | ||
21 | + }, | ||
22 | + items: { | ||
23 | + // The most important list, if not, will not be displayed | ||
24 | + type: Array as PropType<ContextMenuItem[]>, | ||
25 | + default() { | ||
26 | + return []; | ||
27 | + }, | ||
28 | + }, | ||
29 | + }; | ||
30 | + | ||
31 | + const ItemContent: FunctionalComponent<ItemContentProps> = (props) => { | ||
32 | + const { item } = props; | ||
33 | + return ( | ||
34 | + <span | ||
35 | + style="display: inline-block; width: 100%; " | ||
36 | + class="px-4" | ||
37 | + onClick={props.handler.bind(null, item)} | ||
38 | + > | ||
39 | + {props.showIcon && item.icon && <Icon class="mr-2" icon={item.icon} />} | ||
40 | + <span>{item.label}</span> | ||
41 | + </span> | ||
42 | + ); | ||
43 | + }; | ||
44 | + | ||
45 | + export default defineComponent({ | ||
46 | + name: 'ContextMenu', | ||
47 | + props, | ||
48 | + setup(props) { | ||
49 | + const wrapRef = ref<ElRef>(null); | ||
50 | + const showRef = ref(false); | ||
51 | + | ||
52 | + const getStyle = computed((): CSSProperties => { | ||
53 | + const { axis, items, styles, width } = props; | ||
54 | + const { x, y } = axis || { x: 0, y: 0 }; | ||
55 | + const menuHeight = (items || []).length * 40; | ||
56 | + const menuWidth = width; | ||
57 | + const body = document.body; | ||
58 | + | ||
59 | + const left = body.clientWidth < x + menuWidth ? x - menuWidth : x; | ||
60 | + const top = body.clientHeight < y + menuHeight ? y - menuHeight : y; | ||
61 | + return { | ||
62 | + ...styles, | ||
63 | + width: `${width}px`, | ||
64 | + left: `${left + 1}px`, | ||
65 | + top: `${top + 1}px`, | ||
66 | + }; | ||
67 | + }); | ||
61 | 68 | ||
62 | - function handleAction(item: ContextMenuItem, e: MouseEvent) { | ||
63 | - const { handler, disabled } = item; | ||
64 | - if (disabled) return; | ||
65 | - showRef.value = false; | 69 | + onMounted(() => { |
70 | + nextTick(() => (showRef.value = true)); | ||
71 | + }); | ||
66 | 72 | ||
67 | - e?.stopPropagation(); | ||
68 | - e?.preventDefault(); | ||
69 | - handler?.(); | ||
70 | - } | 73 | + onUnmounted(() => { |
74 | + unref(wrapRef) && document.body.removeChild(el); | ||
75 | + }); | ||
71 | 76 | ||
72 | - function renderMenuItem(items: ContextMenuItem[]) { | ||
73 | - return items.map((item) => { | ||
74 | - const { disabled, label, children, divider = false } = item; | 77 | + function handleAction(item: ContextMenuItem, e: MouseEvent) { |
78 | + const { handler, disabled } = item; | ||
79 | + if (disabled) { | ||
80 | + return; | ||
81 | + } | ||
82 | + showRef.value = false; | ||
83 | + e?.stopPropagation(); | ||
84 | + e?.preventDefault(); | ||
85 | + handler?.(); | ||
86 | + } | ||
87 | + | ||
88 | + function renderMenuItem(items: ContextMenuItem[]) { | ||
89 | + return items.map((item) => { | ||
90 | + const { disabled, label, children, divider = false } = item; | ||
91 | + | ||
92 | + const contentProps = { | ||
93 | + item, | ||
94 | + handler: handleAction, | ||
95 | + showIcon: props.showIcon, | ||
96 | + }; | ||
97 | + | ||
98 | + if (!children || children.length === 0) { | ||
99 | + return ( | ||
100 | + <> | ||
101 | + <Menu.Item disabled={disabled} class={`${prefixCls}__item`} key={label}> | ||
102 | + <ItemContent {...contentProps} /> | ||
103 | + </Menu.Item> | ||
104 | + {divider ? <Divider key={`d-${label}`} /> : null} | ||
105 | + </> | ||
106 | + ); | ||
107 | + } | ||
108 | + if (!unref(showRef)) return null; | ||
75 | 109 | ||
76 | - const DividerComp = divider ? <Divider key={`d-${label}`} /> : null; | ||
77 | - if (!children || children.length === 0) { | ||
78 | return ( | 110 | return ( |
79 | - <> | ||
80 | - <Menu.Item disabled={disabled} class={`${prefixCls}__item`} key={label}> | ||
81 | - <ItemContent showIcon={props.showIcon} item={item} handler={handleAction} /> | ||
82 | - </Menu.Item> | ||
83 | - {DividerComp} | ||
84 | - </> | 111 | + <Menu.SubMenu key={label} disabled={disabled} popupClassName={`${prefixCls}__popup`}> |
112 | + {{ | ||
113 | + title: () => <ItemContent {...contentProps} />, | ||
114 | + default: () => renderMenuItem(children), | ||
115 | + }} | ||
116 | + </Menu.SubMenu> | ||
85 | ); | 117 | ); |
86 | - } | 118 | + }); |
119 | + } | ||
120 | + return () => { | ||
121 | + const { items } = props; | ||
87 | if (!unref(showRef)) return null; | 122 | if (!unref(showRef)) return null; |
88 | - | ||
89 | return ( | 123 | return ( |
90 | - <Menu.SubMenu key={label} disabled={disabled} popupClassName={`${prefixCls}__popup`}> | ||
91 | - {{ | ||
92 | - title: () => ( | ||
93 | - <ItemContent showIcon={props.showIcon} item={item} handler={handleAction} /> | ||
94 | - ), | ||
95 | - default: () => renderMenuItem(children), | ||
96 | - }} | ||
97 | - </Menu.SubMenu> | 124 | + <Menu |
125 | + inlineIndent={12} | ||
126 | + mode="vertical" | ||
127 | + class={prefixCls} | ||
128 | + ref={wrapRef} | ||
129 | + style={unref(getStyle)} | ||
130 | + > | ||
131 | + {renderMenuItem(items)} | ||
132 | + </Menu> | ||
98 | ); | 133 | ); |
99 | - }); | 134 | + }; |
135 | + }, | ||
136 | + }); | ||
137 | +</script> | ||
138 | +<style lang="less"> | ||
139 | + @default-height: 42px !important; | ||
140 | + | ||
141 | + @small-height: 36px !important; | ||
142 | + | ||
143 | + @large-height: 36px !important; | ||
144 | + | ||
145 | + .item-style() { | ||
146 | + li { | ||
147 | + display: inline-block; | ||
148 | + width: 100%; | ||
149 | + height: @default-height; | ||
150 | + margin: 0 !important; | ||
151 | + line-height: @default-height; | ||
152 | + | ||
153 | + span { | ||
154 | + line-height: @default-height; | ||
155 | + } | ||
156 | + | ||
157 | + > div { | ||
158 | + margin: 0 !important; | ||
159 | + } | ||
160 | + | ||
161 | + &:not(.ant-menu-item-disabled):hover { | ||
162 | + color: @text-color-base; | ||
163 | + background-color: @item-hover-bg; | ||
164 | + } | ||
165 | + } | ||
166 | + } | ||
167 | + | ||
168 | + .context-menu { | ||
169 | + position: fixed; | ||
170 | + top: 0; | ||
171 | + left: 0; | ||
172 | + z-index: 200; | ||
173 | + display: block; | ||
174 | + width: 156px; | ||
175 | + margin: 0; | ||
176 | + list-style: none; | ||
177 | + background-color: @component-background; | ||
178 | + border: 1px solid rgba(0, 0, 0, 0.08); | ||
179 | + border-radius: 0.25rem; | ||
180 | + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1), | ||
181 | + 0 1px 5px 0 rgba(0, 0, 0, 0.06); | ||
182 | + background-clip: padding-box; | ||
183 | + user-select: none; | ||
184 | + | ||
185 | + .item-style(); | ||
186 | + | ||
187 | + .ant-divider { | ||
188 | + margin: 0 0; | ||
189 | + } | ||
190 | + | ||
191 | + &__popup { | ||
192 | + .ant-divider { | ||
193 | + margin: 0 0; | ||
194 | + } | ||
195 | + | ||
196 | + .item-style(); | ||
197 | + } | ||
198 | + | ||
199 | + .ant-menu-submenu-title, | ||
200 | + .ant-menu-item { | ||
201 | + padding: 0 !important; | ||
100 | } | 202 | } |
101 | - return () => { | ||
102 | - const { items } = props; | ||
103 | - if (!unref(showRef)) return null; | ||
104 | - return ( | ||
105 | - <Menu | ||
106 | - inlineIndent={12} | ||
107 | - mode="vertical" | ||
108 | - class={prefixCls} | ||
109 | - ref={wrapRef} | ||
110 | - style={unref(getStyle)} | ||
111 | - > | ||
112 | - {renderMenuItem(items)} | ||
113 | - </Menu> | ||
114 | - ); | ||
115 | - }; | ||
116 | - }, | ||
117 | -}); | 203 | + } |
204 | +</style> |
src/components/ContextMenu/src/createContextMenu.ts
1 | -import contextMenuVue from './ContextMenu'; | 1 | +import contextMenuVue from './ContextMenu.vue'; |
2 | import { isClient } from '/@/utils/is'; | 2 | import { isClient } from '/@/utils/is'; |
3 | -import { CreateContextOptions, ContextMenuProps } from './types'; | 3 | +import { CreateContextOptions, ContextMenuProps } from './typing'; |
4 | import { createVNode, render } from 'vue'; | 4 | import { createVNode, render } from 'vue'; |
5 | 5 | ||
6 | const menuManager: { | 6 | const menuManager: { |
@@ -16,7 +16,9 @@ export const createContextMenu = function (options: CreateContextOptions) { | @@ -16,7 +16,9 @@ export const createContextMenu = function (options: CreateContextOptions) { | ||
16 | 16 | ||
17 | event && event?.preventDefault(); | 17 | event && event?.preventDefault(); |
18 | 18 | ||
19 | - if (!isClient) return; | 19 | + if (!isClient) { |
20 | + return; | ||
21 | + } | ||
20 | return new Promise((resolve) => { | 22 | return new Promise((resolve) => { |
21 | const body = document.body; | 23 | const body = document.body; |
22 | 24 | ||
@@ -54,9 +56,9 @@ export const createContextMenu = function (options: CreateContextOptions) { | @@ -54,9 +56,9 @@ export const createContextMenu = function (options: CreateContextOptions) { | ||
54 | body.removeEventListener('scroll', handleClick); | 56 | body.removeEventListener('scroll', handleClick); |
55 | }; | 57 | }; |
56 | 58 | ||
57 | - menuManager.resolve = function (...arg: any) { | 59 | + menuManager.resolve = function (arg) { |
58 | remove(); | 60 | remove(); |
59 | - resolve(arg[0]); | 61 | + resolve(arg); |
60 | }; | 62 | }; |
61 | remove(); | 63 | remove(); |
62 | body.appendChild(container); | 64 | body.appendChild(container); |
src/components/ContextMenu/src/index.less deleted
100644 → 0
1 | -@default-height: 42px !important; | ||
2 | - | ||
3 | -@small-height: 36px !important; | ||
4 | - | ||
5 | -@large-height: 36px !important; | ||
6 | - | ||
7 | -.item-style() { | ||
8 | - li { | ||
9 | - display: inline-block; | ||
10 | - width: 100%; | ||
11 | - height: @default-height; | ||
12 | - margin: 0 !important; | ||
13 | - line-height: @default-height; | ||
14 | - | ||
15 | - span { | ||
16 | - line-height: @default-height; | ||
17 | - } | ||
18 | - | ||
19 | - > div { | ||
20 | - margin: 0 !important; | ||
21 | - } | ||
22 | - | ||
23 | - &:not(.ant-menu-item-disabled):hover { | ||
24 | - color: @text-color-base; | ||
25 | - background-color: @item-hover-bg; | ||
26 | - } | ||
27 | - } | ||
28 | -} | ||
29 | - | ||
30 | -.context-menu { | ||
31 | - position: fixed; | ||
32 | - top: 0; | ||
33 | - left: 0; | ||
34 | - z-index: 200; | ||
35 | - display: block; | ||
36 | - width: 156px; | ||
37 | - margin: 0; | ||
38 | - list-style: none; | ||
39 | - background-color: @component-background; | ||
40 | - border: 1px solid rgba(0, 0, 0, 0.08); | ||
41 | - border-radius: 0.25rem; | ||
42 | - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1), | ||
43 | - 0 1px 5px 0 rgba(0, 0, 0, 0.06); | ||
44 | - background-clip: padding-box; | ||
45 | - user-select: none; | ||
46 | - | ||
47 | - .item-style(); | ||
48 | - | ||
49 | - .ant-divider { | ||
50 | - margin: 0 0; | ||
51 | - } | ||
52 | - | ||
53 | - &__popup { | ||
54 | - .ant-divider { | ||
55 | - margin: 0 0; | ||
56 | - } | ||
57 | - | ||
58 | - .item-style(); | ||
59 | - } | ||
60 | - | ||
61 | - .ant-menu-submenu-title, | ||
62 | - .ant-menu-item { | ||
63 | - padding: 0 !important; | ||
64 | - } | ||
65 | -} |
src/components/ContextMenu/src/props.ts deleted
100644 → 0
1 | -import type { PropType } from 'vue'; | ||
2 | -import type { Axis, ContextMenuItem } from './types'; | ||
3 | -import { propTypes } from '/@/utils/propTypes'; | ||
4 | -export const contextMenuProps = { | ||
5 | - width: propTypes.number.def(156), | ||
6 | - customEvent: { | ||
7 | - type: Object as PropType<Event>, | ||
8 | - default: null, | ||
9 | - }, | ||
10 | - styles: propTypes.style, | ||
11 | - showIcon: propTypes.bool.def(true), | ||
12 | - axis: { | ||
13 | - // The position of the right mouse button click | ||
14 | - type: Object as PropType<Axis>, | ||
15 | - default() { | ||
16 | - return { x: 0, y: 0 }; | ||
17 | - }, | ||
18 | - }, | ||
19 | - items: { | ||
20 | - // The most important list, if not, will not be displayed | ||
21 | - type: Array as PropType<ContextMenuItem[]>, | ||
22 | - default() { | ||
23 | - return []; | ||
24 | - }, | ||
25 | - }, | ||
26 | -}; |
src/components/ContextMenu/src/types.ts renamed to src/components/ContextMenu/src/typing.ts
src/components/Drawer/src/BasicDrawer.vue
@@ -81,46 +81,40 @@ | @@ -81,46 +81,40 @@ | ||
81 | 81 | ||
82 | instance && emit('register', drawerInstance, instance.uid); | 82 | instance && emit('register', drawerInstance, instance.uid); |
83 | 83 | ||
84 | - const getMergeProps = computed( | ||
85 | - (): DrawerProps => { | ||
86 | - return deepMerge(toRaw(props), unref(propsRef)); | ||
87 | - } | ||
88 | - ); | 84 | + const getMergeProps = computed((): DrawerProps => { |
85 | + return deepMerge(toRaw(props), unref(propsRef)); | ||
86 | + }); | ||
89 | 87 | ||
90 | - const getProps = computed( | ||
91 | - (): DrawerProps => { | ||
92 | - const opt = { | ||
93 | - placement: 'right', | ||
94 | - ...unref(attrs), | ||
95 | - ...unref(getMergeProps), | ||
96 | - visible: unref(visibleRef), | ||
97 | - }; | ||
98 | - opt.title = undefined; | ||
99 | - const { isDetail, width, wrapClassName, getContainer } = opt; | ||
100 | - if (isDetail) { | ||
101 | - if (!width) { | ||
102 | - opt.width = '100%'; | ||
103 | - } | ||
104 | - const detailCls = `${prefixCls}__detail`; | ||
105 | - opt.wrapClassName = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls; | ||
106 | - | ||
107 | - if (!getContainer) { | ||
108 | - // TODO type error? | ||
109 | - opt.getContainer = `.${prefixVar}-layout-content` as any; | ||
110 | - } | 88 | + const getProps = computed((): DrawerProps => { |
89 | + const opt = { | ||
90 | + placement: 'right', | ||
91 | + ...unref(attrs), | ||
92 | + ...unref(getMergeProps), | ||
93 | + visible: unref(visibleRef), | ||
94 | + }; | ||
95 | + opt.title = undefined; | ||
96 | + const { isDetail, width, wrapClassName, getContainer } = opt; | ||
97 | + if (isDetail) { | ||
98 | + if (!width) { | ||
99 | + opt.width = '100%'; | ||
111 | } | 100 | } |
112 | - return opt as DrawerProps; | ||
113 | - } | ||
114 | - ); | 101 | + const detailCls = `${prefixCls}__detail`; |
102 | + opt.wrapClassName = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls; | ||
115 | 103 | ||
116 | - const getBindValues = computed( | ||
117 | - (): DrawerProps => { | ||
118 | - return { | ||
119 | - ...attrs, | ||
120 | - ...unref(getProps), | ||
121 | - }; | 104 | + if (!getContainer) { |
105 | + // TODO type error? | ||
106 | + opt.getContainer = `.${prefixVar}-layout-content` as any; | ||
107 | + } | ||
122 | } | 108 | } |
123 | - ); | 109 | + return opt as DrawerProps; |
110 | + }); | ||
111 | + | ||
112 | + const getBindValues = computed((): DrawerProps => { | ||
113 | + return { | ||
114 | + ...attrs, | ||
115 | + ...unref(getProps), | ||
116 | + }; | ||
117 | + }); | ||
124 | 118 | ||
125 | // Custom implementation of the bottom button, | 119 | // Custom implementation of the bottom button, |
126 | const getFooterHeight = computed(() => { | 120 | const getFooterHeight = computed(() => { |
@@ -133,15 +127,13 @@ | @@ -133,15 +127,13 @@ | ||
133 | return `0px`; | 127 | return `0px`; |
134 | }); | 128 | }); |
135 | 129 | ||
136 | - const getScrollContentStyle = computed( | ||
137 | - (): CSSProperties => { | ||
138 | - const footerHeight = unref(getFooterHeight); | ||
139 | - return { | ||
140 | - position: 'relative', | ||
141 | - height: `calc(100% - ${footerHeight})`, | ||
142 | - }; | ||
143 | - } | ||
144 | - ); | 130 | + const getScrollContentStyle = computed((): CSSProperties => { |
131 | + const footerHeight = unref(getFooterHeight); | ||
132 | + return { | ||
133 | + position: 'relative', | ||
134 | + height: `calc(100% - ${footerHeight})`, | ||
135 | + }; | ||
136 | + }); | ||
145 | 137 | ||
146 | const getLoading = computed(() => { | 138 | const getLoading = computed(() => { |
147 | return !!unref(getProps)?.loading; | 139 | return !!unref(getProps)?.loading; |
src/components/Drawer/src/components/DrawerFooter.vue
@@ -43,15 +43,13 @@ | @@ -43,15 +43,13 @@ | ||
43 | setup(props, { emit }) { | 43 | setup(props, { emit }) { |
44 | const { prefixCls } = useDesign('basic-drawer-footer'); | 44 | const { prefixCls } = useDesign('basic-drawer-footer'); |
45 | 45 | ||
46 | - const getStyle = computed( | ||
47 | - (): CSSProperties => { | ||
48 | - const heightStr = `${props.height}`; | ||
49 | - return { | ||
50 | - height: heightStr, | ||
51 | - lineHeight: heightStr, | ||
52 | - }; | ||
53 | - } | ||
54 | - ); | 46 | + const getStyle = computed((): CSSProperties => { |
47 | + const heightStr = `${props.height}`; | ||
48 | + return { | ||
49 | + height: heightStr, | ||
50 | + lineHeight: heightStr, | ||
51 | + }; | ||
52 | + }); | ||
55 | 53 | ||
56 | function handleOk() { | 54 | function handleOk() { |
57 | emit('ok'); | 55 | emit('ok'); |
src/components/Form/src/components/FormItem.vue
@@ -174,9 +174,7 @@ | @@ -174,9 +174,7 @@ | ||
174 | return Promise.resolve(); | 174 | return Promise.resolve(); |
175 | } | 175 | } |
176 | 176 | ||
177 | - const getRequired = isFunction(required) | ||
178 | - ? required(unref(getValues)) | ||
179 | - : required; | 177 | + const getRequired = isFunction(required) ? required(unref(getValues)) : required; |
180 | 178 | ||
181 | if ((!rules || rules.length === 0) && getRequired) { | 179 | if ((!rules || rules.length === 0) && getRequired) { |
182 | rules = [{ required: getRequired, validator }]; | 180 | rules = [{ required: getRequired, validator }]; |
src/components/Icon/src/SvgIcon.vue
@@ -36,17 +36,15 @@ | @@ -36,17 +36,15 @@ | ||
36 | const { prefixCls } = useDesign('svg-icon'); | 36 | const { prefixCls } = useDesign('svg-icon'); |
37 | const symbolId = computed(() => `#${props.prefix}-${props.name}`); | 37 | const symbolId = computed(() => `#${props.prefix}-${props.name}`); |
38 | 38 | ||
39 | - const getStyle = computed( | ||
40 | - (): CSSProperties => { | ||
41 | - const { size } = props; | ||
42 | - let s = `${size}`; | ||
43 | - s = `${s.replace('px', '')}px`; | ||
44 | - return { | ||
45 | - width: s, | ||
46 | - height: s, | ||
47 | - }; | ||
48 | - } | ||
49 | - ); | 39 | + const getStyle = computed((): CSSProperties => { |
40 | + const { size } = props; | ||
41 | + let s = `${size}`; | ||
42 | + s = `${s.replace('px', '')}px`; | ||
43 | + return { | ||
44 | + width: s, | ||
45 | + height: s, | ||
46 | + }; | ||
47 | + }); | ||
50 | return { symbolId, prefixCls, getStyle }; | 48 | return { symbolId, prefixCls, getStyle }; |
51 | }, | 49 | }, |
52 | }); | 50 | }); |
src/components/Modal/src/BasicModal.vue
@@ -107,14 +107,12 @@ | @@ -107,14 +107,12 @@ | ||
107 | } | 107 | } |
108 | 108 | ||
109 | // Custom title component: get title | 109 | // Custom title component: get title |
110 | - const getMergeProps = computed( | ||
111 | - (): ModalProps => { | ||
112 | - return { | ||
113 | - ...props, | ||
114 | - ...(unref(propsRef) as any), | ||
115 | - }; | ||
116 | - } | ||
117 | - ); | 110 | + const getMergeProps = computed((): ModalProps => { |
111 | + return { | ||
112 | + ...props, | ||
113 | + ...(unref(propsRef) as any), | ||
114 | + }; | ||
115 | + }); | ||
118 | 116 | ||
119 | const { handleFullScreen, getWrapClassName, fullScreenRef } = useFullScreen({ | 117 | const { handleFullScreen, getWrapClassName, fullScreenRef } = useFullScreen({ |
120 | modalWrapperRef, | 118 | modalWrapperRef, |
@@ -123,31 +121,27 @@ | @@ -123,31 +121,27 @@ | ||
123 | }); | 121 | }); |
124 | 122 | ||
125 | // modal component does not need title and origin buttons | 123 | // modal component does not need title and origin buttons |
126 | - const getProps = computed( | ||
127 | - (): ModalProps => { | ||
128 | - const opt = { | ||
129 | - ...unref(getMergeProps), | ||
130 | - visible: unref(visibleRef), | ||
131 | - okButtonProps: undefined, | ||
132 | - cancelButtonProps: undefined, | ||
133 | - title: undefined, | ||
134 | - }; | ||
135 | - return { | ||
136 | - ...opt, | ||
137 | - wrapClassName: unref(getWrapClassName), | ||
138 | - }; | ||
139 | - } | ||
140 | - ); | 124 | + const getProps = computed((): ModalProps => { |
125 | + const opt = { | ||
126 | + ...unref(getMergeProps), | ||
127 | + visible: unref(visibleRef), | ||
128 | + okButtonProps: undefined, | ||
129 | + cancelButtonProps: undefined, | ||
130 | + title: undefined, | ||
131 | + }; | ||
132 | + return { | ||
133 | + ...opt, | ||
134 | + wrapClassName: unref(getWrapClassName), | ||
135 | + }; | ||
136 | + }); | ||
141 | 137 | ||
142 | - const getBindValue = computed( | ||
143 | - (): Recordable => { | ||
144 | - const attr = { ...attrs, ...unref(getProps) }; | ||
145 | - if (unref(fullScreenRef)) { | ||
146 | - return omit(attr, 'height'); | ||
147 | - } | ||
148 | - return attr; | 138 | + const getBindValue = computed((): Recordable => { |
139 | + const attr = { ...attrs, ...unref(getProps) }; | ||
140 | + if (unref(fullScreenRef)) { | ||
141 | + return omit(attr, 'height'); | ||
149 | } | 142 | } |
150 | - ); | 143 | + return attr; |
144 | + }); | ||
151 | 145 | ||
152 | const getWrapperHeight = computed(() => { | 146 | const getWrapperHeight = computed(() => { |
153 | if (unref(fullScreenRef)) return undefined; | 147 | if (unref(fullScreenRef)) return undefined; |
src/components/SimpleMenu/src/components/MenuItem.vue
@@ -39,9 +39,8 @@ | @@ -39,9 +39,8 @@ | ||
39 | 39 | ||
40 | const active = ref(false); | 40 | const active = ref(false); |
41 | 41 | ||
42 | - const { getItemStyle, getParentList, getParentMenu, getParentRootMenu } = useMenuItem( | ||
43 | - instance | ||
44 | - ); | 42 | + const { getItemStyle, getParentList, getParentMenu, getParentRootMenu } = |
43 | + useMenuItem(instance); | ||
45 | 44 | ||
46 | const { prefixCls } = useDesign('menu'); | 45 | const { prefixCls } = useDesign('menu'); |
47 | 46 |
src/components/SimpleMenu/src/components/SubMenuItem.vue
@@ -109,9 +109,8 @@ | @@ -109,9 +109,8 @@ | ||
109 | isChild: false, | 109 | isChild: false, |
110 | }); | 110 | }); |
111 | 111 | ||
112 | - const { getParentSubMenu, getItemStyle, getParentMenu, getParentList } = useMenuItem( | ||
113 | - instance | ||
114 | - ); | 112 | + const { getParentSubMenu, getItemStyle, getParentMenu, getParentList } = |
113 | + useMenuItem(instance); | ||
115 | 114 | ||
116 | const { prefixCls } = useDesign('menu'); | 115 | const { prefixCls } = useDesign('menu'); |
117 | 116 | ||
@@ -148,13 +147,11 @@ | @@ -148,13 +147,11 @@ | ||
148 | const getCollapse = computed(() => rootProps.collapse); | 147 | const getCollapse = computed(() => rootProps.collapse); |
149 | const getTheme = computed(() => rootProps.theme); | 148 | const getTheme = computed(() => rootProps.theme); |
150 | 149 | ||
151 | - const getOverlayStyle = computed( | ||
152 | - (): CSSProperties => { | ||
153 | - return { | ||
154 | - minWidth: '200px', | ||
155 | - }; | ||
156 | - } | ||
157 | - ); | 150 | + const getOverlayStyle = computed((): CSSProperties => { |
151 | + return { | ||
152 | + minWidth: '200px', | ||
153 | + }; | ||
154 | + }); | ||
158 | 155 | ||
159 | const getIsOpend = computed(() => { | 156 | const getIsOpend = computed(() => { |
160 | const name = props.name; | 157 | const name = props.name; |
src/components/SimpleMenu/src/components/useMenu.ts
@@ -14,26 +14,24 @@ export function useMenuItem(instance: ComponentInternalInstance | null) { | @@ -14,26 +14,24 @@ export function useMenuItem(instance: ComponentInternalInstance | null) { | ||
14 | return findParentMenu(['SubMenu']); | 14 | return findParentMenu(['SubMenu']); |
15 | }); | 15 | }); |
16 | 16 | ||
17 | - const getItemStyle = computed( | ||
18 | - (): CSSProperties => { | ||
19 | - let parent = instance?.parent; | ||
20 | - if (!parent) return {}; | ||
21 | - const indentSize = (unref(getParentRootMenu)?.props.indentSize as number) ?? 20; | ||
22 | - let padding = indentSize; | 17 | + const getItemStyle = computed((): CSSProperties => { |
18 | + let parent = instance?.parent; | ||
19 | + if (!parent) return {}; | ||
20 | + const indentSize = (unref(getParentRootMenu)?.props.indentSize as number) ?? 20; | ||
21 | + let padding = indentSize; | ||
23 | 22 | ||
24 | - if (unref(getParentRootMenu)?.props.collapse) { | ||
25 | - padding = indentSize; | ||
26 | - } else { | ||
27 | - while (parent && parent.type.name !== 'Menu') { | ||
28 | - if (parent.type.name === 'SubMenu') { | ||
29 | - padding += indentSize; | ||
30 | - } | ||
31 | - parent = parent.parent; | 23 | + if (unref(getParentRootMenu)?.props.collapse) { |
24 | + padding = indentSize; | ||
25 | + } else { | ||
26 | + while (parent && parent.type.name !== 'Menu') { | ||
27 | + if (parent.type.name === 'SubMenu') { | ||
28 | + padding += indentSize; | ||
32 | } | 29 | } |
30 | + parent = parent.parent; | ||
33 | } | 31 | } |
34 | - return { paddingLeft: padding + 'px' }; | ||
35 | } | 32 | } |
36 | - ); | 33 | + return { paddingLeft: padding + 'px' }; |
34 | + }); | ||
37 | 35 | ||
38 | function findParentMenu(name: string[]) { | 36 | function findParentMenu(name: string[]) { |
39 | let parent = instance?.parent; | 37 | let parent = instance?.parent; |
src/directives/clickOutside.ts
@@ -31,12 +31,14 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu | @@ -31,12 +31,14 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu | ||
31 | excludes = binding.arg; | 31 | excludes = binding.arg; |
32 | } else { | 32 | } else { |
33 | // due to current implementation on binding type is wrong the type casting is necessary here | 33 | // due to current implementation on binding type is wrong the type casting is necessary here |
34 | - excludes.push((binding.arg as unknown) as HTMLElement); | 34 | + excludes.push(binding.arg as unknown as HTMLElement); |
35 | } | 35 | } |
36 | return function (mouseup, mousedown) { | 36 | return function (mouseup, mousedown) { |
37 | - const popperRef = (binding.instance as ComponentPublicInstance<{ | ||
38 | - popperRef: Nullable<HTMLElement>; | ||
39 | - }>).popperRef; | 37 | + const popperRef = ( |
38 | + binding.instance as ComponentPublicInstance<{ | ||
39 | + popperRef: Nullable<HTMLElement>; | ||
40 | + }> | ||
41 | + ).popperRef; | ||
40 | const mouseUpTarget = mouseup.target as Node; | 42 | const mouseUpTarget = mouseup.target as Node; |
41 | const mouseDownTarget = mousedown.target as Node; | 43 | const mouseDownTarget = mousedown.target as Node; |
42 | const isBound = !binding || !binding.instance; | 44 | const isBound = !binding || !binding.instance; |
src/hooks/web/useI18n.ts
@@ -21,9 +21,7 @@ function getKey(namespace: string | undefined, key: string) { | @@ -21,9 +21,7 @@ function getKey(namespace: string | undefined, key: string) { | ||
21 | return `${namespace}.${key}`; | 21 | return `${namespace}.${key}`; |
22 | } | 22 | } |
23 | 23 | ||
24 | -export function useI18n( | ||
25 | - namespace?: string | ||
26 | -): { | 24 | +export function useI18n(namespace?: string): { |
27 | t: I18nGlobalTranslation; | 25 | t: I18nGlobalTranslation; |
28 | } { | 26 | } { |
29 | const normalFn = { | 27 | const normalFn = { |
src/hooks/web/useMessage.tsx
@@ -60,7 +60,7 @@ function createConfirm(options: ModalOptionsEx): ConfirmOptions { | @@ -60,7 +60,7 @@ function createConfirm(options: ModalOptionsEx): ConfirmOptions { | ||
60 | icon: getIcon(iconType), | 60 | icon: getIcon(iconType), |
61 | ...options, | 61 | ...options, |
62 | }; | 62 | }; |
63 | - return (Modal.confirm(opt) as unknown) as ConfirmOptions; | 63 | + return Modal.confirm(opt) as unknown as ConfirmOptions; |
64 | } | 64 | } |
65 | 65 | ||
66 | const getBaseOptions = () => { | 66 | const getBaseOptions = () => { |
src/layouts/default/header/components/Breadcrumb.vue
@@ -71,10 +71,10 @@ | @@ -71,10 +71,10 @@ | ||
71 | const breadcrumbList = filterItem(matched); | 71 | const breadcrumbList = filterItem(matched); |
72 | 72 | ||
73 | if (currentRoute.value.meta?.currentActiveMenu) { | 73 | if (currentRoute.value.meta?.currentActiveMenu) { |
74 | - breadcrumbList.push(({ | 74 | + breadcrumbList.push({ |
75 | ...currentRoute.value, | 75 | ...currentRoute.value, |
76 | name: currentRoute.value.meta?.title || currentRoute.value.name, | 76 | name: currentRoute.value.meta?.title || currentRoute.value.name, |
77 | - } as unknown) as RouteLocationMatched); | 77 | + } as unknown as RouteLocationMatched); |
78 | } | 78 | } |
79 | routes.value = breadcrumbList; | 79 | routes.value = breadcrumbList; |
80 | }); | 80 | }); |
src/layouts/default/menu/index.vue
@@ -76,13 +76,11 @@ | @@ -76,13 +76,11 @@ | ||
76 | ); | 76 | ); |
77 | }); | 77 | }); |
78 | 78 | ||
79 | - const getWrapperStyle = computed( | ||
80 | - (): CSSProperties => { | ||
81 | - return { | ||
82 | - height: `calc(100% - ${unref(getIsShowLogo) ? '48px' : '0px'})`, | ||
83 | - }; | ||
84 | - } | ||
85 | - ); | 79 | + const getWrapperStyle = computed((): CSSProperties => { |
80 | + return { | ||
81 | + height: `calc(100% - ${unref(getIsShowLogo) ? '48px' : '0px'})`, | ||
82 | + }; | ||
83 | + }); | ||
86 | 84 | ||
87 | const getLogoClass = computed(() => { | 85 | const getLogoClass = computed(() => { |
88 | return [ | 86 | return [ |
src/layouts/default/setting/SettingDrawer.tsx
@@ -58,12 +58,8 @@ export default defineComponent({ | @@ -58,12 +58,8 @@ export default defineComponent({ | ||
58 | getThemeColor, | 58 | getThemeColor, |
59 | } = useRootSetting(); | 59 | } = useRootSetting(); |
60 | 60 | ||
61 | - const { | ||
62 | - getOpenPageLoading, | ||
63 | - getBasicTransition, | ||
64 | - getEnableTransition, | ||
65 | - getOpenNProgress, | ||
66 | - } = useTransitionSetting(); | 61 | + const { getOpenPageLoading, getBasicTransition, getEnableTransition, getOpenNProgress } = |
62 | + useTransitionSetting(); | ||
67 | 63 | ||
68 | const { | 64 | const { |
69 | getIsHorizontal, | 65 | getIsHorizontal, |
src/layouts/default/sider/LayoutSider.vue
@@ -89,19 +89,17 @@ | @@ -89,19 +89,17 @@ | ||
89 | ]; | 89 | ]; |
90 | }); | 90 | }); |
91 | 91 | ||
92 | - const getHiddenDomStyle = computed( | ||
93 | - (): CSSProperties => { | ||
94 | - const width = `${unref(getRealWidth)}px`; | ||
95 | - return { | ||
96 | - width: width, | ||
97 | - overflow: 'hidden', | ||
98 | - flex: `0 0 ${width}`, | ||
99 | - maxWidth: width, | ||
100 | - minWidth: width, | ||
101 | - transition: 'all 0.2s', | ||
102 | - }; | ||
103 | - } | ||
104 | - ); | 92 | + const getHiddenDomStyle = computed((): CSSProperties => { |
93 | + const width = `${unref(getRealWidth)}px`; | ||
94 | + return { | ||
95 | + width: width, | ||
96 | + overflow: 'hidden', | ||
97 | + flex: `0 0 ${width}`, | ||
98 | + maxWidth: width, | ||
99 | + minWidth: width, | ||
100 | + transition: 'all 0.2s', | ||
101 | + }; | ||
102 | + }); | ||
105 | 103 | ||
106 | return { | 104 | return { |
107 | prefixCls, | 105 | prefixCls, |
src/layouts/default/sider/MixSider.vue
@@ -147,14 +147,12 @@ | @@ -147,14 +147,12 @@ | ||
147 | 147 | ||
148 | useDragLine(sideRef, dragBarRef, true); | 148 | useDragLine(sideRef, dragBarRef, true); |
149 | 149 | ||
150 | - const getMenuStyle = computed( | ||
151 | - (): CSSProperties => { | ||
152 | - return { | ||
153 | - width: unref(openMenu) ? `${unref(getMenuWidth)}px` : 0, | ||
154 | - left: `${unref(getMixSideWidth)}px`, | ||
155 | - }; | ||
156 | - } | ||
157 | - ); | 150 | + const getMenuStyle = computed((): CSSProperties => { |
151 | + return { | ||
152 | + width: unref(openMenu) ? `${unref(getMenuWidth)}px` : 0, | ||
153 | + left: `${unref(getMixSideWidth)}px`, | ||
154 | + }; | ||
155 | + }); | ||
158 | 156 | ||
159 | const getIsFixed = computed(() => { | 157 | const getIsFixed = computed(() => { |
160 | /* eslint-disable-next-line */ | 158 | /* eslint-disable-next-line */ |
@@ -171,20 +169,16 @@ | @@ -171,20 +169,16 @@ | ||
171 | return unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH; | 169 | return unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH; |
172 | }); | 170 | }); |
173 | 171 | ||
174 | - const getDomStyle = computed( | ||
175 | - (): CSSProperties => { | ||
176 | - const fixedWidth = unref(getIsFixed) ? unref(getRealWidth) : 0; | ||
177 | - const width = `${unref(getMixSideWidth) + fixedWidth}px`; | ||
178 | - return getWrapCommonStyle(width); | ||
179 | - } | ||
180 | - ); | 172 | + const getDomStyle = computed((): CSSProperties => { |
173 | + const fixedWidth = unref(getIsFixed) ? unref(getRealWidth) : 0; | ||
174 | + const width = `${unref(getMixSideWidth) + fixedWidth}px`; | ||
175 | + return getWrapCommonStyle(width); | ||
176 | + }); | ||
181 | 177 | ||
182 | - const getWrapStyle = computed( | ||
183 | - (): CSSProperties => { | ||
184 | - const width = `${unref(getMixSideWidth)}px`; | ||
185 | - return getWrapCommonStyle(width); | ||
186 | - } | ||
187 | - ); | 178 | + const getWrapStyle = computed((): CSSProperties => { |
179 | + const width = `${unref(getMixSideWidth)}px`; | ||
180 | + return getWrapCommonStyle(width); | ||
181 | + }); | ||
188 | 182 | ||
189 | const getMenuEvents = computed(() => { | 183 | const getMenuEvents = computed(() => { |
190 | return !unref(getMixSideFixed) | 184 | return !unref(getMixSideFixed) |
src/layouts/default/tabs/index.vue
@@ -106,8 +106,7 @@ | @@ -106,8 +106,7 @@ | ||
106 | .getRoutes() | 106 | .getRoutes() |
107 | .find((item) => item.path === currentActiveMenu); | 107 | .find((item) => item.path === currentActiveMenu); |
108 | 108 | ||
109 | - findParentRoute && | ||
110 | - tabStore.addTab((findParentRoute as unknown) as RouteLocationNormalized); | 109 | + findParentRoute && tabStore.addTab(findParentRoute as unknown as RouteLocationNormalized); |
111 | } else { | 110 | } else { |
112 | tabStore.addTab(unref(route)); | 111 | tabStore.addTab(unref(route)); |
113 | } | 112 | } |
src/layouts/default/tabs/useMultipleTabs.ts
@@ -30,14 +30,14 @@ export function initAffixTabs(): string[] { | @@ -30,14 +30,14 @@ export function initAffixTabs(): string[] { | ||
30 | * @description: Set fixed tabs | 30 | * @description: Set fixed tabs |
31 | */ | 31 | */ |
32 | function addAffixTabs(): void { | 32 | function addAffixTabs(): void { |
33 | - const affixTabs = filterAffixTabs((router.getRoutes() as unknown) as RouteLocationNormalized[]); | 33 | + const affixTabs = filterAffixTabs(router.getRoutes() as unknown as RouteLocationNormalized[]); |
34 | affixList.value = affixTabs; | 34 | affixList.value = affixTabs; |
35 | for (const tab of affixTabs) { | 35 | for (const tab of affixTabs) { |
36 | - tabStore.addTab(({ | 36 | + tabStore.addTab({ |
37 | meta: tab.meta, | 37 | meta: tab.meta, |
38 | name: tab.name, | 38 | name: tab.name, |
39 | path: tab.path, | 39 | path: tab.path, |
40 | - } as unknown) as RouteLocationNormalized); | 40 | + } as unknown as RouteLocationNormalized); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 |
src/layouts/default/tabs/useTabDropdown.ts
@@ -20,11 +20,9 @@ export function useTabDropdown(tabContentProps: TabContentProps, getIsTabs: Comp | @@ -20,11 +20,9 @@ export function useTabDropdown(tabContentProps: TabContentProps, getIsTabs: Comp | ||
20 | const { currentRoute } = useRouter(); | 20 | const { currentRoute } = useRouter(); |
21 | const { refreshPage, closeAll, close, closeLeft, closeOther, closeRight } = useTabs(); | 21 | const { refreshPage, closeAll, close, closeLeft, closeOther, closeRight } = useTabs(); |
22 | 22 | ||
23 | - const getTargetTab = computed( | ||
24 | - (): RouteLocationNormalized => { | ||
25 | - return unref(getIsTabs) ? tabContentProps.tabItem : unref(currentRoute); | ||
26 | - } | ||
27 | - ); | 23 | + const getTargetTab = computed((): RouteLocationNormalized => { |
24 | + return unref(getIsTabs) ? tabContentProps.tabItem : unref(currentRoute); | ||
25 | + }); | ||
28 | 26 | ||
29 | /** | 27 | /** |
30 | * @description: drop-down list | 28 | * @description: drop-down list |
src/layouts/iframe/useFrameKeepAlive.ts
@@ -16,8 +16,7 @@ export function useFrameKeepAlive() { | @@ -16,8 +16,7 @@ export function useFrameKeepAlive() { | ||
16 | const { getShowMultipleTab } = useMultipleTabSetting(); | 16 | const { getShowMultipleTab } = useMultipleTabSetting(); |
17 | const tabStore = useMultipleTabStore(); | 17 | const tabStore = useMultipleTabStore(); |
18 | const getFramePages = computed(() => { | 18 | const getFramePages = computed(() => { |
19 | - const ret = | ||
20 | - getAllFramePages((toRaw(router.getRoutes()) as unknown) as AppRouteRecordRaw[]) || []; | 19 | + const ret = getAllFramePages(toRaw(router.getRoutes()) as unknown as AppRouteRecordRaw[]) || []; |
21 | return ret; | 20 | return ret; |
22 | }); | 21 | }); |
23 | 22 |
src/router/guard/permissionGuard.ts
@@ -60,7 +60,7 @@ export function createPermissionGuard(router: Router) { | @@ -60,7 +60,7 @@ export function createPermissionGuard(router: Router) { | ||
60 | const routes = await permissionStore.buildRoutesAction(); | 60 | const routes = await permissionStore.buildRoutesAction(); |
61 | 61 | ||
62 | routes.forEach((route) => { | 62 | routes.forEach((route) => { |
63 | - router.addRoute((route as unknown) as RouteRecordRaw); | 63 | + router.addRoute(route as unknown as RouteRecordRaw); |
64 | }); | 64 | }); |
65 | 65 | ||
66 | const redirectPath = (from.query.redirect || to.path) as string; | 66 | const redirectPath = (from.query.redirect || to.path) as string; |
src/utils/cache/memory.ts
@@ -80,7 +80,7 @@ export class Memory<T = any, V = any> { | @@ -80,7 +80,7 @@ export class Memory<T = any, V = any> { | ||
80 | 80 | ||
81 | resetCache(cache: { [K in keyof T]: Cache }) { | 81 | resetCache(cache: { [K in keyof T]: Cache }) { |
82 | Object.keys(cache).forEach((key) => { | 82 | Object.keys(cache).forEach((key) => { |
83 | - const k = (key as any) as keyof T; | 83 | + const k = key as any as keyof T; |
84 | const item = cache[k]; | 84 | const item = cache[k]; |
85 | if (item && item.time) { | 85 | if (item && item.time) { |
86 | const now = new Date().getTime(); | 86 | const now = new Date().getTime(); |
src/utils/env.ts
@@ -17,10 +17,10 @@ export function getStorageShortName() { | @@ -17,10 +17,10 @@ export function getStorageShortName() { | ||
17 | export function getAppEnvConfig() { | 17 | export function getAppEnvConfig() { |
18 | const ENV_NAME = getConfigFileName(import.meta.env); | 18 | const ENV_NAME = getConfigFileName(import.meta.env); |
19 | 19 | ||
20 | - const ENV = ((import.meta.env.DEV | 20 | + const ENV = (import.meta.env.DEV |
21 | ? // Get the global configuration (the configuration will be extracted independently when packaging) | 21 | ? // Get the global configuration (the configuration will be extracted independently when packaging) |
22 | - ((import.meta.env as unknown) as GlobEnvConfig) | ||
23 | - : window[ENV_NAME as any]) as unknown) as GlobEnvConfig; | 22 | + (import.meta.env as unknown as GlobEnvConfig) |
23 | + : window[ENV_NAME as any]) as unknown as GlobEnvConfig; | ||
24 | 24 | ||
25 | const { | 25 | const { |
26 | VITE_GLOB_APP_TITLE, | 26 | VITE_GLOB_APP_TITLE, |
src/utils/is.ts
@@ -89,6 +89,7 @@ export const isServer = typeof window === 'undefined'; | @@ -89,6 +89,7 @@ export const isServer = typeof window === 'undefined'; | ||
89 | export const isClient = !isServer; | 89 | export const isClient = !isServer; |
90 | 90 | ||
91 | export function isUrl(path: string): boolean { | 91 | export function isUrl(path: string): boolean { |
92 | - const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; | 92 | + const reg = |
93 | + /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; | ||
93 | return reg.test(path); | 94 | return reg.test(path); |
94 | } | 95 | } |
src/views/demo/form/DynamicForm.vue
@@ -181,16 +181,14 @@ | @@ -181,16 +181,14 @@ | ||
181 | export default defineComponent({ | 181 | export default defineComponent({ |
182 | components: { BasicForm, CollapseContainer, PageWrapper }, | 182 | components: { BasicForm, CollapseContainer, PageWrapper }, |
183 | setup() { | 183 | setup() { |
184 | - const [ | ||
185 | - register, | ||
186 | - { setProps, updateSchema, appendSchemaByField, removeSchemaByFiled }, | ||
187 | - ] = useForm({ | ||
188 | - labelWidth: 120, | ||
189 | - schemas, | ||
190 | - actionColOptions: { | ||
191 | - span: 24, | ||
192 | - }, | ||
193 | - }); | 184 | + const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFiled }] = |
185 | + useForm({ | ||
186 | + labelWidth: 120, | ||
187 | + schemas, | ||
188 | + actionColOptions: { | ||
189 | + span: 24, | ||
190 | + }, | ||
191 | + }); | ||
194 | const [register1] = useForm({ | 192 | const [register1] = useForm({ |
195 | labelWidth: 120, | 193 | labelWidth: 120, |
196 | schemas: schemas1, | 194 | schemas: schemas1, |
src/views/demo/system/account/DeptTree.vue
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | const treeData = ref<TreeItem[]>([]); | 26 | const treeData = ref<TreeItem[]>([]); |
27 | 27 | ||
28 | async function fetch() { | 28 | async function fetch() { |
29 | - treeData.value = ((await getDeptList()) as unknown) as TreeItem[]; | 29 | + treeData.value = (await getDeptList()) as unknown as TreeItem[]; |
30 | } | 30 | } |
31 | 31 | ||
32 | function handleSelect(keys: string, e) { | 32 | function handleSelect(keys: string, e) { |
src/views/demo/system/role/RoleDrawer.vue
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | ...data.record, | 54 | ...data.record, |
55 | }); | 55 | }); |
56 | } | 56 | } |
57 | - treeData.value = ((await getMenuList()) as any) as TreeItem[]; | 57 | + treeData.value = (await getMenuList()) as any as TreeItem[]; |
58 | }); | 58 | }); |
59 | 59 | ||
60 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); | 60 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
src/views/sys/exception/Exception.vue
@@ -64,11 +64,9 @@ | @@ -64,11 +64,9 @@ | ||
64 | return Number(routeStatus) || status; | 64 | return Number(routeStatus) || status; |
65 | }); | 65 | }); |
66 | 66 | ||
67 | - const getMapValue = computed( | ||
68 | - (): MapValue => { | ||
69 | - return unref(statusMapRef).get(unref(getStatus)) as MapValue; | ||
70 | - } | ||
71 | - ); | 67 | + const getMapValue = computed((): MapValue => { |
68 | + return unref(statusMapRef).get(unref(getStatus)) as MapValue; | ||
69 | + }); | ||
72 | 70 | ||
73 | const backLoginI18n = t('sys.exception.backLogin'); | 71 | const backLoginI18n = t('sys.exception.backLogin'); |
74 | const backHomeI18n = t('sys.exception.backHome'); | 72 | const backHomeI18n = t('sys.exception.backHome'); |
src/views/sys/iframe/index.vue
@@ -32,13 +32,11 @@ | @@ -32,13 +32,11 @@ | ||
32 | const { prefixCls } = useDesign('iframe-page'); | 32 | const { prefixCls } = useDesign('iframe-page'); |
33 | useWindowSizeFn(calcHeight, 150, { immediate: true }); | 33 | useWindowSizeFn(calcHeight, 150, { immediate: true }); |
34 | 34 | ||
35 | - const getWrapStyle = computed( | ||
36 | - (): CSSProperties => { | ||
37 | - return { | ||
38 | - height: `${unref(heightRef)}px`, | ||
39 | - }; | ||
40 | - } | ||
41 | - ); | 35 | + const getWrapStyle = computed((): CSSProperties => { |
36 | + return { | ||
37 | + height: `${unref(heightRef)}px`, | ||
38 | + }; | ||
39 | + }); | ||
42 | 40 | ||
43 | function calcHeight() { | 41 | function calcHeight() { |
44 | const iframe = unref(frameRef); | 42 | const iframe = unref(frameRef); |
stylelint.config.js
@@ -28,7 +28,7 @@ module.exports = { | @@ -28,7 +28,7 @@ module.exports = { | ||
28 | 'font-family-no-missing-generic-family-keyword': null, | 28 | 'font-family-no-missing-generic-family-keyword': null, |
29 | 'declaration-colon-space-after': 'always-single-line', | 29 | 'declaration-colon-space-after': 'always-single-line', |
30 | 'declaration-colon-space-before': 'never', | 30 | 'declaration-colon-space-before': 'never', |
31 | - 'declaration-block-trailing-semicolon': 'always', | 31 | + // 'declaration-block-trailing-semicolon': 'always', |
32 | 'rule-empty-line-before': [ | 32 | 'rule-empty-line-before': [ |
33 | 'always', | 33 | 'always', |
34 | { | 34 | { |