Commit 14ba72dd1ce9f741801141a991887b442dd9ec34

Authored by vben
1 parent be0d3539

fix: 主题样式设置无效,close #2685

package.json
@@ -125,6 +125,7 @@ @@ -125,6 +125,7 @@
125 "@vben/eslint-config": "workspace:*", 125 "@vben/eslint-config": "workspace:*",
126 "@vben/stylelint-config": "workspace:*", 126 "@vben/stylelint-config": "workspace:*",
127 "@vben/ts-config": "workspace:*", 127 "@vben/ts-config": "workspace:*",
  128 + "@vben/types": "workspace:*",
128 "@vben/vite-config": "workspace:*", 129 "@vben/vite-config": "workspace:*",
129 "@vue/compiler-sfc": "^3.2.47", 130 "@vue/compiler-sfc": "^3.2.47",
130 "@vue/test-utils": "^2.3.2", 131 "@vue/test-utils": "^2.3.2",
packages/types/src/utils.ts
1 /** 1 /**
2 - * 任意类型的函数  
3 - */  
4 -type AnyFunction = AnyNormalFunction | AnyPromiseFunction;  
5 -  
6 -/**  
7 * 任意类型的异步函数 2 * 任意类型的异步函数
8 */ 3 */
9 type AnyPromiseFunction = (...arg: any) => PromiseLike<any>; 4 type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
@@ -14,6 +9,11 @@ type AnyPromiseFunction = (...arg: any) =&gt; PromiseLike&lt;any&gt;; @@ -14,6 +9,11 @@ type AnyPromiseFunction = (...arg: any) =&gt; PromiseLike&lt;any&gt;;
14 type AnyNormalFunction = (...arg: any) => any; 9 type AnyNormalFunction = (...arg: any) => any;
15 10
16 /** 11 /**
  12 + * 任意类型的函数
  13 + */
  14 +type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
  15 +
  16 +/**
17 * T | null 包装 17 * T | null 包装
18 */ 18 */
19 type Nullable<T> = T | null; 19 type Nullable<T> = T | null;
@@ -35,6 +35,16 @@ type ReadonlyRecordable&lt;T = any&gt; = { @@ -35,6 +35,16 @@ type ReadonlyRecordable&lt;T = any&gt; = {
35 readonly [key: string]: T; 35 readonly [key: string]: T;
36 }; 36 };
37 37
  38 +/**
  39 + * setTimeout 返回值类型
  40 + */
  41 +type TimeoutHandle = ReturnType<typeof setTimeout>;
  42 +
  43 +/**
  44 + * setInterval 返回值类型
  45 + */
  46 +type IntervalHandle = ReturnType<typeof setInterval>;
  47 +
38 export { 48 export {
39 type AnyFunction, 49 type AnyFunction,
40 type AnyPromiseFunction, 50 type AnyPromiseFunction,
@@ -43,4 +53,6 @@ export { @@ -43,4 +53,6 @@ export {
43 type NonNullable, 53 type NonNullable,
44 type Recordable, 54 type Recordable,
45 type ReadonlyRecordable, 55 type ReadonlyRecordable,
  56 + type TimeoutHandle,
  57 + type IntervalHandle,
46 }; 58 };
pnpm-lock.yaml
@@ -176,6 +176,9 @@ importers: @@ -176,6 +176,9 @@ importers:
176 '@vben/ts-config': 176 '@vben/ts-config':
177 specifier: workspace:* 177 specifier: workspace:*
178 version: link:internal/ts-config 178 version: link:internal/ts-config
  179 + '@vben/types':
  180 + specifier: workspace:*
  181 + version: link:packages/types
179 '@vben/vite-config': 182 '@vben/vite-config':
180 specifier: workspace:* 183 specifier: workspace:*
181 version: link:internal/vite-config 184 version: link:internal/vite-config
src/components/SimpleMenu/src/components/Menu.vue
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 import { useDesign } from '/@/hooks/web/useDesign'; 22 import { useDesign } from '/@/hooks/web/useDesign';
23 import { propTypes } from '/@/utils/propTypes'; 23 import { propTypes } from '/@/utils/propTypes';
24 import { createSimpleRootMenuContext } from './useSimpleMenuContext'; 24 import { createSimpleRootMenuContext } from './useSimpleMenuContext';
25 - import mitt from '/@/utils/mitt'; 25 + import { mitt } from '/@/utils/mitt';
26 26
27 export default defineComponent({ 27 export default defineComponent({
28 name: 'Menu', 28 name: 'Menu',
src/components/SimpleMenu/src/components/SubMenuItem.vue
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
56 </template> 56 </template>
57 57
58 <script lang="ts"> 58 <script lang="ts">
  59 + import { type TimeoutHandle, type Recordable } from '@vben/types';
59 import type { CSSProperties, PropType } from 'vue'; 60 import type { CSSProperties, PropType } from 'vue';
60 import type { SubMenuProvider } from './types'; 61 import type { SubMenuProvider } from './types';
61 import { 62 import {
@@ -77,7 +78,7 @@ @@ -77,7 +78,7 @@
77 import { Icon } from '/@/components/Icon'; 78 import { Icon } from '/@/components/Icon';
78 import { Popover } from 'ant-design-vue'; 79 import { Popover } from 'ant-design-vue';
79 import { isBoolean, isObject } from '/@/utils/is'; 80 import { isBoolean, isObject } from '/@/utils/is';
80 - import mitt from '/@/utils/mitt'; 81 + import { mitt } from '/@/utils/mitt';
81 82
82 const DELAY = 200; 83 const DELAY = 200;
83 export default defineComponent({ 84 export default defineComponent({
@@ -267,14 +268,14 @@ @@ -267,14 +268,14 @@
267 268
268 rootMenuEmitter.on( 269 rootMenuEmitter.on(
269 'on-update-opened', 270 'on-update-opened',
270 - (data: boolean | (string | number)[] | Recordable) => { 271 + (data: boolean | (string | number)[] | Recordable<any>) => {
271 if (unref(getCollapse)) return; 272 if (unref(getCollapse)) return;
272 if (isBoolean(data)) { 273 if (isBoolean(data)) {
273 state.opened = data; 274 state.opened = data;
274 return; 275 return;
275 } 276 }
276 if (isObject(data) && rootProps.accordion) { 277 if (isObject(data) && rootProps.accordion) {
277 - const { opend, parent, uidList } = data as Recordable; 278 + const { opend, parent, uidList } = data as Recordable<any>;
278 if (parent === instance?.parent) { 279 if (parent === instance?.parent) {
279 state.opened = opend; 280 state.opened = opend;
280 } else if (!uidList.includes(instance?.uid)) { 281 } else if (!uidList.includes(instance?.uid)) {
src/logics/mitt/routeChange.ts
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * Used to monitor routing changes to change the status of menus and tabs. There is no need to monitor the route, because the route status change is affected by the page rendering time, which will be slow 2 * Used to monitor routing changes to change the status of menus and tabs. There is no need to monitor the route, because the route status change is affected by the page rendering time, which will be slow
3 */ 3 */
4 4
5 -import mitt from '/@/utils/mitt'; 5 +import { mitt } from '/@/utils/mitt';
6 import type { RouteLocationNormalized } from 'vue-router'; 6 import type { RouteLocationNormalized } from 'vue-router';
7 import { getRawRoute } from '/@/utils'; 7 import { getRawRoute } from '/@/utils';
8 8
src/main.ts
1 import 'uno.css'; 1 import 'uno.css';
2 import '@/design/index.less'; 2 import '@/design/index.less';
3 import '@/components/VxeTable/src/css/index.scss'; 3 import '@/components/VxeTable/src/css/index.scss';
4 -import 'ant-design-vue/dist/antd.css'; 4 +import 'ant-design-vue/dist/antd.less';
5 // Register icon sprite 5 // Register icon sprite
6 import 'virtual:svg-icons-register'; 6 import 'virtual:svg-icons-register';
7 7