cosey 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/components/audio-card/audio-card.vue.js +1 -1
  2. package/components/close/close.vue.js +1 -1
  3. package/components/components.d.ts +98 -44
  4. package/components/config-provider/config-provider.js +1 -3
  5. package/components/config-provider/config-provider.vue.d.ts +2 -7
  6. package/components/config-provider/index.d.ts +1 -1
  7. package/components/context-menu/content.vue.js +1 -1
  8. package/components/context-menu/context-menu.vue.js +2 -2
  9. package/components/copy/copy.vue.js +1 -1
  10. package/components/cssinjs/parser.js +8 -25
  11. package/components/dnd-sort/dnd-sort-item.vue.js +2 -3
  12. package/components/dnd-sort/dnd-sort.vue.js +1 -2
  13. package/components/dnd-sort/index.d.ts +1 -1
  14. package/components/editor/components/button-group.vue.d.ts +2 -7
  15. package/components/editor/components/button.vue.d.ts +2 -7
  16. package/components/editor/components/color-picker/color-picker.vue.d.ts +2 -43
  17. package/components/editor/components/color-picker/color-picker.vue.js +14 -11
  18. package/components/editor/components/picker/picker.vue.d.ts +2 -15
  19. package/components/editor/components/resize/resize.js +4 -4
  20. package/components/editor/components/resize/resize.style.js +9 -32
  21. package/components/editor/components/resize/resize.vue.js +21 -14
  22. package/components/editor/components/select-button.vue.d.ts +2 -9
  23. package/components/editor/components/select-button.vue.js +1 -1
  24. package/components/editor/components/split-button.vue.d.ts +2 -19
  25. package/components/editor/components/split-button.vue.js +1 -1
  26. package/components/editor/components/table-toolbar/table-toolbar.vue.js +9 -9
  27. package/components/editor/components/toolbar/formats/align.vue.js +4 -4
  28. package/components/editor/components/toolbar/formats/blockquote.vue.js +1 -1
  29. package/components/editor/components/toolbar/formats/bold.vue.js +1 -1
  30. package/components/editor/components/toolbar/formats/clean.vue.js +1 -1
  31. package/components/editor/components/toolbar/formats/code-block.vue.js +1 -1
  32. package/components/editor/components/toolbar/formats/code.vue.js +1 -1
  33. package/components/editor/components/toolbar/formats/formula.vue.js +4 -3
  34. package/components/editor/components/toolbar/formats/image.vue.js +1 -1
  35. package/components/editor/components/toolbar/formats/indent.vue.js +2 -2
  36. package/components/editor/components/toolbar/formats/italic.vue.js +1 -1
  37. package/components/editor/components/toolbar/formats/link.vue.js +15 -13
  38. package/components/editor/components/toolbar/formats/list.vue.js +3 -3
  39. package/components/editor/components/toolbar/formats/script.vue.js +2 -2
  40. package/components/editor/components/toolbar/formats/size-delta.vue.js +2 -2
  41. package/components/editor/components/toolbar/formats/strike.vue.js +1 -1
  42. package/components/editor/components/toolbar/formats/table.vue.js +1 -1
  43. package/components/editor/components/toolbar/formats/underline.vue.js +1 -1
  44. package/components/editor/components/toolbar/formats/video.vue.js +1 -1
  45. package/components/editor/components/toolbar/toolbar.d.ts +1 -2
  46. package/components/editor/components/toolbar/toolbar.js +17 -21
  47. package/components/editor/components/toolbar/toolbarContext.js +1 -3
  48. package/components/editor/formats/image.d.ts +13 -0
  49. package/components/editor/formats/image.js +46 -0
  50. package/components/editor/formats/indent.d.ts +2 -0
  51. package/components/editor/formats/indent.js +12 -7
  52. package/components/editor/formats/link.js +1 -5
  53. package/components/editor/formats/list.d.ts +0 -4
  54. package/components/editor/formats/list.js +10 -5
  55. package/components/editor/formats/video.js +6 -9
  56. package/components/editor/modules/custom-list.js +1 -6
  57. package/components/editor/modules/image-uploader/formats/image-loading.style.js +3 -3
  58. package/components/editor/modules/image-uploader/image-uploader.js +1 -3
  59. package/components/editor/quill.js +7 -4
  60. package/components/editor/quillContext.js +1 -3
  61. package/components/editor/style/index.js +1 -5
  62. package/components/field/components/checkbox-group/panel.vue.d.ts +2 -20
  63. package/components/field/components/checkbox-group/panel.vue.js +2 -2
  64. package/components/field/components/tree-select/tree-select.d.ts +1 -2
  65. package/components/field/components/tree-select/tree-select.js +69 -0
  66. package/components/file-card/file-card.vue.js +1 -1
  67. package/components/form/form-item.vue.js +1 -1
  68. package/components/form/useFormItemWidth.js +1 -1
  69. package/components/form/useFormTemplate.js +2 -10
  70. package/components/form-dialog/form-dialog.vue.d.ts +0 -1
  71. package/components/form-dialog/form-dialog.vue.js +1 -1
  72. package/components/form-dialog/index.d.ts +0 -3
  73. package/components/form-group/form-group.vue.js +1 -1
  74. package/components/form-list/form-list.js +1 -6
  75. package/components/form-list/form-list.vue.js +2 -2
  76. package/components/form-query/form-query.vue.js +5 -5
  77. package/components/horizontal-tree/horizontal-tree.vue.js +16 -12
  78. package/components/iconify-icon/iconify-icon.d.ts +3 -0
  79. package/components/iconify-icon/iconify-icon.js +9 -0
  80. package/components/iconify-icon/iconify-icon.vue.js +2 -5
  81. package/components/iconify-icon/index.js +1 -0
  82. package/components/index.js +3 -2
  83. package/components/media-card-group/media-card-group.vue.js +4 -3
  84. package/components/scroll-view/scroll-view.vue.js +1 -2
  85. package/components/snug-menu/snug-menu.vue.js +1 -2
  86. package/components/style/animation.d.ts +5 -0
  87. package/components/style/animation.js +33 -0
  88. package/components/style/index.d.ts +1 -1
  89. package/components/style/index.js +2 -2
  90. package/components/style/mixins.d.ts +2 -0
  91. package/components/style/mixins.js +10 -1
  92. package/components/table/index.d.ts +0 -8
  93. package/components/table/style/index.js +2 -2
  94. package/components/table/table-column/renderer.js +22 -18
  95. package/components/table/table-column-editor/item.vue.js +4 -7
  96. package/components/table/table-column-editor/table-column-editor.vue.d.ts +2 -246
  97. package/components/table/table-column-editor/table-column-editor.vue.js +9 -9
  98. package/components/table/table-export/table-export.vue.js +2 -2
  99. package/components/table/table-query/table-query.d.ts +0 -4
  100. package/components/table/table-query/table-query.js +0 -4
  101. package/components/table/table-query/table-query.vue.d.ts +0 -9
  102. package/components/table/table-query/table-query.vue.js +14 -12
  103. package/components/table/table.js +1 -3
  104. package/components/table/table.vue.js +22 -24
  105. package/components/table/useTable.js +1 -4
  106. package/components/table/utils.js +1 -3
  107. package/components/table-action/item.vue.js +5 -5
  108. package/components/table-action/table-action.vue.js +4 -3
  109. package/components/theme/StyleContext.js +1 -3
  110. package/components/theme/createCacheToken.js +1 -4
  111. package/components/theme/getGlobalStyleHook.js +2 -5
  112. package/components/theme/getSimpleStyleHook.js +1 -4
  113. package/components/theme/getStyleHook.js +1 -4
  114. package/components/theme/interface/index.d.ts +1 -1
  115. package/components/theme/themes/shared/genColorMapToken.js +1 -4
  116. package/components/theme/useStyleRegister.js +1 -3
  117. package/components/theme/util/alias.js +4 -16
  118. package/components/theme/util/getAlphaColor.js +1 -6
  119. package/components/theme/util/normalizeStyle.js +1 -1
  120. package/components/theme/util/statistic.js +4 -1
  121. package/components/theme/util/useToken.js +1 -4
  122. package/components/toggle/toggle.vue.js +1 -1
  123. package/components/transition/transition.vue.js +1 -2
  124. package/components/upload/upload-item.vue.js +8 -8
  125. package/components/upload/upload.vue.js +1 -1
  126. package/components/video-card/video-card.vue.js +1 -1
  127. package/config/index.d.ts +1 -0
  128. package/config/index.js +2 -7
  129. package/config/layout.d.ts +36 -0
  130. package/config/layout.js +37 -1
  131. package/config/nprogress.style.d.ts +2 -0
  132. package/config/nprogress.style.js +51 -0
  133. package/config/root-config-provider.vue.d.ts +2 -20
  134. package/config/root-config-provider.vue.js +2 -0
  135. package/hooks/useColorScheme.js +5 -9
  136. package/hooks/useEcharts.js +2 -4
  137. package/hooks/useFetch.d.ts +1 -1
  138. package/hooks/useFetch.js +1 -7
  139. package/hooks/useFullPage.js +7 -9
  140. package/hooks/useLocale.js +1 -3
  141. package/hooks/useLockscreenObserver.js +1 -1
  142. package/hooks/usePersist.js +1 -3
  143. package/hooks/useTreeCheck.js +13 -26
  144. package/hooks/useUpsert.d.ts +3 -3
  145. package/index.d.ts +1 -0
  146. package/index.js +5 -4
  147. package/layout/index.js +2 -2
  148. package/layout/layout-aside/layout-aside.vue.js +2 -1
  149. package/layout/layout-base/layout-base.vue.js +1 -1
  150. package/layout/layout-change-password/layout-change-password.vue.js +8 -8
  151. package/layout/layout-change-password/style/index.js +1 -1
  152. package/layout/layout-color-scheme/layout-color-scheme.vue.js +8 -14
  153. package/layout/layout-color-scheme/style/index.d.ts +0 -3
  154. package/layout/layout-color-scheme/style/index.js +26 -44
  155. package/layout/layout-content/layout-content.vue.d.ts +2 -13
  156. package/layout/layout-forbidden/layout-forbidden.vue.js +2 -2
  157. package/layout/layout-header/layout-header.vue.d.ts +2 -14
  158. package/layout/layout-internal-server-error/layout-internal-server-error.vue.js +2 -2
  159. package/layout/layout-login/layout-login.vue.js +5 -5
  160. package/layout/layout-login/style/index.js +1 -1
  161. package/layout/layout-mask/style/index.js +1 -1
  162. package/layout/layout-not-found/layout-not-found.vue.js +2 -2
  163. package/layout/layout-search/layout-search.vue.js +37 -34
  164. package/layout/layout-sidebar/layout-sidebar.vue.d.ts +2 -15
  165. package/layout/layout-sidebar/style/index.js +1 -1
  166. package/layout/layout-switch-effect/layout-switch-effect.vue.d.ts +2 -7
  167. package/layout/layout-tabbar/layout-tabbar.vue.js +2 -2
  168. package/layout/layout-tabbar/reload.vue.js +1 -1
  169. package/layout/layout-tabbar/style/index.js +2 -2
  170. package/layout/layout-toggle/layout-toggle.vue.js +1 -1
  171. package/layout/layout-top-snug-menu/layout-top-snug-menu.vue.js +4 -3
  172. package/layout/layout-topbar/layout-topbar.vue.d.ts +2 -1217
  173. package/layout/layout-user-menu/index.d.ts +1 -0
  174. package/layout/layout-user-menu/index.js +1 -0
  175. package/layout/{layout-user/layout-user.vue.js → layout-user-menu/layout-user-menu.vue.js} +18 -13
  176. package/layout/{layout-user → layout-user-menu}/style/index.js +9 -5
  177. package/layout/layout.d.ts +1 -1
  178. package/layout/layout.js +1 -1
  179. package/layout/merged/index.d.ts +1 -1
  180. package/layout/merged/index.js +1 -1
  181. package/layout/merged/{layout-user.js → layout-user-menu.js} +1 -1
  182. package/layout/utils.js +1 -4
  183. package/package.json +16 -6
  184. package/request/useRequest.js +1 -1
  185. package/router/guard/auth.js +2 -5
  186. package/router/guard/index.js +0 -2
  187. package/router/guard/progress.js +11 -1
  188. package/router/index.d.ts +22 -0
  189. package/store/layout.d.ts +2 -8
  190. package/store/layout.js +19 -31
  191. package/store/user.d.ts +1 -1
  192. package/store/user.js +1 -1
  193. package/utils/array.js +3 -0
  194. package/utils/excel/index.js +1 -3
  195. package/utils/excel/utils.js +1 -5
  196. package/utils/file.js +1 -3
  197. package/utils/object.js +1 -3
  198. package/utils/tree.js +2 -11
  199. package/utils/vue.js +1 -1
  200. package/components/global.d.js +0 -1
  201. package/components/style/motion/index.d.ts +0 -1
  202. package/components/style/motion/index.js +0 -1
  203. package/components/style/motion/loading.d.ts +0 -3
  204. package/components/style/motion/loading.js +0 -23
  205. package/layout/layout-user/index.d.ts +0 -1
  206. package/layout/layout-user/index.js +0 -1
  207. package/router/guard/popup.d.ts +0 -2
  208. package/router/guard/popup.js +0 -6
  209. package/types/vue-router.d.js +0 -1
  210. package/types/vue.d.js +0 -1
  211. /package/layout/{layout-user/layout-user.vue.d.ts → layout-user-menu/layout-user-menu.vue.d.ts} +0 -0
  212. /package/layout/{layout-user → layout-user-menu}/style/index.d.ts +0 -0
  213. /package/layout/merged/{layout-user.d.ts → layout-user-menu.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export { default } from './layout-user-menu.vue';
@@ -0,0 +1 @@
1
+ export { default } from './layout-user-menu.vue.js';
@@ -1,26 +1,31 @@
1
- import { defineComponent, resolveComponent, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createVNode, toDisplayString } from 'vue';
1
+ import { defineComponent, resolveComponent, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, resolveDynamicComponent } from 'vue';
2
2
  import { useRouter } from 'vue-router';
3
3
  import { useGlobalConfig } from '../../config/index.js';
4
4
  import { useUserStore } from '../../store/user.js';
5
5
  import stdin_default$1 from './style/index.js';
6
6
  import { useComponentConfig } from '../../components/config-provider/config-provider.js';
7
7
  import { Icon as _Icon } from '../../components/icon/index.js';
8
+ import { defineTemplate } from '../../utils/vue.js';
8
9
 
9
10
  var stdin_default = /* @__PURE__ */defineComponent({
10
11
  ...{
11
- name: "LayoutUser"
12
+ name: "LayoutUserMenu"
12
13
  },
13
- __name: "layout-user",
14
+ __name: "layout-user-menu",
14
15
  setup(__props) {
15
16
  const {
16
17
  prefixCls
17
- } = useComponentConfig("layout-user");
18
+ } = useComponentConfig("layout-user-menu");
18
19
  const {
19
20
  hashId
20
21
  } = stdin_default$1(prefixCls);
21
22
  const router = useRouter();
22
23
  const userStore = useUserStore();
23
- const routerConfig = useGlobalConfig().router;
24
+ const {
25
+ router: routerConfig,
26
+ slots: slotsConfig
27
+ } = useGlobalConfig();
28
+ const UserMenu = defineTemplate(() => slotsConfig.userMenu?.());
24
29
  const toHome = () => {
25
30
  router.push(routerConfig.homePath);
26
31
  };
@@ -45,22 +50,22 @@ var stdin_default = /* @__PURE__ */defineComponent({
45
50
  onClick: toHome
46
51
  }, {
47
52
  default: withCtx(() => [createVNode(unref(_Icon), {
48
- name: "mdi:home-outline",
53
+ name: "co:home",
49
54
  size: "lg"
50
55
  }), createElementVNode("span", {
51
- class: normalizeClass(`${unref(prefixCls)}-dropdown-item-title`)
56
+ class: normalizeClass(`${unref(prefixCls)}-item-title`)
52
57
  }, "\u9996\u9875", 2
53
58
  /* CLASS */)]),
54
59
  _: 1
55
60
  /* STABLE */
56
- }), createVNode(_component_el_dropdown_item, {
61
+ }), (openBlock(), createBlock(resolveDynamicComponent(unref(UserMenu)))), createVNode(_component_el_dropdown_item, {
57
62
  onClick: toChangePassword
58
63
  }, {
59
64
  default: withCtx(() => [createVNode(unref(_Icon), {
60
- name: "mdi:shield-key-outline",
65
+ name: "co:password",
61
66
  size: "lg"
62
67
  }), createElementVNode("span", {
63
- class: normalizeClass(`${unref(prefixCls)}-dropdown-item-title`)
68
+ class: normalizeClass(`${unref(prefixCls)}-item-title`)
64
69
  }, "\u4FEE\u6539\u5BC6\u7801", 2
65
70
  /* CLASS */)]),
66
71
  _: 1
@@ -70,10 +75,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
70
75
  onClick: logout
71
76
  }, {
72
77
  default: withCtx(() => [createVNode(unref(_Icon), {
73
- name: "mdi:location-exit",
78
+ name: "co:logout",
74
79
  size: "lg"
75
80
  }), createElementVNode("span", {
76
- class: normalizeClass(`${unref(prefixCls)}-dropdown-item-title`)
81
+ class: normalizeClass(`${unref(prefixCls)}-item-title`)
77
82
  }, "\u9000\u51FA", 2
78
83
  /* CLASS */)]),
79
84
  _: 1
@@ -89,7 +94,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
89
94
  src: unref(userStore).userInfo?.avatar
90
95
  }, {
91
96
  default: withCtx(() => [createVNode(unref(_Icon), {
92
- name: "mdi:account-outline"
97
+ name: "co:user"
93
98
  })]),
94
99
  _: 1
95
100
  /* STABLE */
@@ -1,13 +1,17 @@
1
1
  import { getTruncateStyle } from '../../../components/style/mixins.js';
2
2
  import { getSimpleStyleHook } from '../../../components/theme/getSimpleStyleHook.js';
3
3
 
4
- var stdin_default = getSimpleStyleHook("LayoutUser", (token) => {
4
+ var stdin_default = getSimpleStyleHook("LayoutUserMenu", (token) => {
5
5
  const { componentCls } = token;
6
6
  return {
7
7
  [componentCls]: {
8
8
  display: "flex",
9
9
  alignItems: "center",
10
+ borderRadius: token.borderRadius,
10
11
  cursor: "pointer",
12
+ "&:focus-visible": {
13
+ outline: "none"
14
+ },
11
15
  [`${componentCls}-name`]: {
12
16
  marginInlineStart: token.marginXS,
13
17
  maxWidth: 160,
@@ -15,10 +19,10 @@ var stdin_default = getSimpleStyleHook("LayoutUser", (token) => {
15
19
  }
16
20
  },
17
21
  [`${componentCls}-dropdown`]: {
18
- width: 140,
19
- [`${componentCls}-dropdown-item-title`]: {
20
- marginInlineStart: token.marginXS
21
- }
22
+ minWidth: 140
23
+ },
24
+ [`${componentCls}-item-title`]: {
25
+ marginInlineStart: token.marginXS
22
26
  }
23
27
  };
24
28
  });
@@ -26,4 +26,4 @@ export { default as LayoutTabbar } from './layout-tabbar';
26
26
  export { default as LayoutToggle } from './layout-toggle';
27
27
  export { default as LayoutTopSnugMenu } from './layout-top-snug-menu';
28
28
  export { default as LayoutTopbar } from './layout-topbar';
29
- export { default as LayoutUser } from './layout-user';
29
+ export { default as LayoutUserMenu } from './layout-user-menu';
package/layout/layout.js CHANGED
@@ -26,4 +26,4 @@ export { default as LayoutTabbar } from './layout-tabbar/layout-tabbar.vue.js';
26
26
  export { default as LayoutToggle } from './layout-toggle/layout-toggle.vue.js';
27
27
  export { default as LayoutTopSnugMenu } from './layout-top-snug-menu/layout-top-snug-menu.vue.js';
28
28
  export { default as LayoutTopbar } from './layout-topbar/layout-topbar.vue.js';
29
- export { default as LayoutUser } from './layout-user/layout-user.vue.js';
29
+ export { default as LayoutUserMenu } from './layout-user-menu/layout-user-menu.vue.js';
@@ -26,4 +26,4 @@ export { default as MergedLayoutTabbar } from './layout-tabbar';
26
26
  export { default as MergedLayoutToggle } from './layout-toggle';
27
27
  export { default as MergedLayoutTopSnugMenu } from './layout-top-snug-menu';
28
28
  export { default as MergedLayoutTopbar } from './layout-topbar';
29
- export { default as MergedLayoutUser } from './layout-user';
29
+ export { default as MergedLayoutUserMenu } from './layout-user-menu';
@@ -26,4 +26,4 @@ export { default as MergedLayoutTabbar } from './layout-tabbar.js';
26
26
  export { default as MergedLayoutToggle } from './layout-toggle.js';
27
27
  export { default as MergedLayoutTopSnugMenu } from './layout-top-snug-menu.js';
28
28
  export { default as MergedLayoutTopbar } from './layout-topbar.js';
29
- export { default as MergedLayoutUser } from './layout-user.js';
29
+ export { default as MergedLayoutUserMenu } from './layout-user-menu.js';
@@ -1,4 +1,4 @@
1
- import stdin_default$1 from '../layout-user/layout-user.vue.js';
1
+ import stdin_default$1 from '../layout-user-menu/layout-user-menu.vue.js';
2
2
  import { mergedLayout } from '../utils.js';
3
3
 
4
4
  var stdin_default = mergedLayout("user", stdin_default$1);
package/layout/utils.js CHANGED
@@ -6,10 +6,7 @@ function mergedLayout(name, defaultComponent) {
6
6
  return defineComponent({
7
7
  setup(props, { slots }) {
8
8
  const { components } = useGlobalConfig();
9
- const component = useOptionalComponent(
10
- components?.[name],
11
- defaultComponent
12
- );
9
+ const component = useOptionalComponent(components?.[name], defaultComponent);
13
10
  return () => h(component.value, props, slots);
14
11
  }
15
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "基于 Vue3 的后台管理框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,17 +8,17 @@
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1"
10
10
  },
11
- "author": "wuzhitao",
12
- "license": "MIT",
13
11
  "devDependencies": {
14
12
  "@casl/ability": "^6.7.3",
13
+ "@cosey/icons": "^0.1.2",
15
14
  "@ctrl/tinycolor": "^4.1.0",
16
15
  "@element-plus/icons-vue": "^2.3.1",
17
16
  "@emotion/hash": "^0.9.2",
18
17
  "@emotion/unitless": "^0.10.0",
19
18
  "@floating-ui/dom": "^1.6.13",
20
19
  "@gunny/persist": "^1.0.1",
21
- "@iconify-json/mdi": "^1.2.3",
20
+ "@iconify/types": "^2.0.0",
21
+ "@types/nprogress": "^0.2.3",
22
22
  "@types/stylis": "^4.2.7",
23
23
  "@vue/shared": "^3.5.13",
24
24
  "@vueuse/core": "^13.2.0",
@@ -32,6 +32,7 @@
32
32
  "jszip": "^3.10.1",
33
33
  "katex": "^0.16.22",
34
34
  "lodash-es": "^4.17.21",
35
+ "nprogress": "^0.2.0",
35
36
  "pinia": "^3.0.2",
36
37
  "quill": "^2.0.3",
37
38
  "stylis": "^4.3.6",
@@ -40,13 +41,15 @@
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@casl/ability": "^6.7.3",
44
+ "@cosey/icons": "^0.1.2",
43
45
  "@ctrl/tinycolor": "^4.1.0",
44
46
  "@element-plus/icons-vue": "^2.3.1",
45
47
  "@emotion/hash": "^0.9.2",
46
48
  "@emotion/unitless": "^0.10.0",
47
49
  "@floating-ui/dom": "^1.6.13",
48
50
  "@gunny/persist": "^1.0.1",
49
- "@iconify-json/mdi": "^1.2.3",
51
+ "@iconify/types": "^2.0.0",
52
+ "@types/nprogress": "^0.2.3",
50
53
  "@vue/shared": "^3.5.13",
51
54
  "@vueuse/core": "^13.2.0",
52
55
  "axios": "^1.7.9",
@@ -59,10 +62,17 @@
59
62
  "jszip": "^3.10.1",
60
63
  "katex": "^0.16.22",
61
64
  "lodash-es": "^4.17.21",
65
+ "nprogress": "^0.2.0",
62
66
  "pinia": "^3.0.2",
63
67
  "quill": "^2.0.3",
64
68
  "stylis": "^4.3.6",
65
69
  "vue": "^3.5.13",
66
70
  "vue-router": "^4.5.0"
67
- }
71
+ },
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "git+https://github.com/sutras/cosey.git"
75
+ },
76
+ "author": "wuzhitao",
77
+ "license": "MIT"
68
78
  }
@@ -80,7 +80,7 @@ function useRequest(config = {}) {
80
80
  };
81
81
  const map = (object) => {
82
82
  const result = {};
83
- for (let [key, handler] of Object.entries(object)) {
83
+ for (const [key, handler] of Object.entries(object)) {
84
84
  result[key] = fn(handler);
85
85
  }
86
86
  return result;
@@ -24,13 +24,10 @@ function registerAuthGuard(router) {
24
24
  await userStore.getUserInfo();
25
25
  await userStore.setAuthorization();
26
26
  await userStore.addDynamicRoutes();
27
- layoutStore.menus = getMenus([
28
- ...getAllStaticRoutes(),
29
- ...userStore.dynamicRoutes
30
- ]);
27
+ layoutStore.menus = getMenus([...getAllStaticRoutes(), ...userStore.dynamicRoutes]);
31
28
  firstTimeAddRoutes = true;
32
29
  userStore.requestedUserInfo = true;
33
- } catch (err) {
30
+ } catch {
34
31
  return false;
35
32
  } finally {
36
33
  persist.remove(ROUTER_TO);
@@ -1,10 +1,8 @@
1
1
  import { registerProgressGuard } from './progress.js';
2
- import { registerPopupGuard } from './popup.js';
3
2
  import { registerAuthGuard } from './auth.js';
4
3
 
5
4
  function registerRouterGuard(router) {
6
5
  registerProgressGuard(router);
7
- registerPopupGuard(router);
8
6
  registerAuthGuard(router);
9
7
  }
10
8
 
@@ -1,5 +1,15 @@
1
+ import NProgress from 'nprogress';
2
+
1
3
  function registerProgressGuard(router) {
2
- router.beforeEach(() => {
4
+ const pathCache = {};
5
+ router.beforeEach((to) => {
6
+ if (!pathCache[to.path]) {
7
+ NProgress.start();
8
+ }
9
+ });
10
+ router.afterEach((to) => {
11
+ pathCache[to.path] = true;
12
+ NProgress.done();
3
13
  });
4
14
  }
5
15
 
package/router/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type RouteRecordRaw, type RouterOptions, type RouterHistory } from 'vue-router';
2
+ import type { AnyAbility } from '@casl/ability';
2
3
  export { type MenuItem, type MenuNode, getMenus, getMenusMap, getMenuPathKeys, getBreadcrumbRoutes, } from './menus';
3
4
  export { defineRoute, defineRoutes, mergeRouteModules } from './utils';
4
5
  export interface CoseyRouterOptions extends Omit<RouterOptions, 'routes' | 'history'> {
@@ -9,3 +10,24 @@ export interface CoseyRouterOptions extends Omit<RouterOptions, 'routes' | 'hist
9
10
  export declare const getAllDynamicRoutes: () => RouteRecordRaw[];
10
11
  export declare const getAllStaticRoutes: () => RouteRecordRaw[];
11
12
  export declare function createCoseyRouter(options?: CoseyRouterOptions): import("vue-router").Router;
13
+ declare module 'vue-router' {
14
+ interface RouteMeta {
15
+ title?: string;
16
+ icon?: string;
17
+ hideInMenu?: boolean;
18
+ hideChildrenInMenu?: boolean;
19
+ flatChildrenInMenu?: boolean;
20
+ type?: 'group';
21
+ closable?: boolean;
22
+ keepAlive?: boolean;
23
+ order?: number;
24
+ iframeSrc?: string;
25
+ authentication?: boolean;
26
+ authority?: (ability: AnyAbility) => boolean;
27
+ }
28
+ }
29
+ declare module 'vue-router' {
30
+ interface RouteMeta {
31
+ _externalLink?: boolean;
32
+ }
33
+ }
package/store/layout.d.ts CHANGED
@@ -5,12 +5,10 @@ export interface LayoutTab {
5
5
  name: string;
6
6
  meta: RouteLocationNormalized['meta'];
7
7
  }
8
- export declare const useLayoutStore: import("pinia").StoreDefinition<"layout", Pick<{
8
+ export declare const useLayoutStore: import("pinia").StoreDefinition<"cosey-layout", Pick<{
9
9
  sidebarVisible: import("vue").Ref<boolean, boolean>;
10
10
  collapse: import("vue").Ref<boolean, boolean>;
11
- settingVisible: import("vue").Ref<boolean, boolean>;
12
11
  isMobile: import("vue").Ref<boolean, boolean>;
13
- fixedHead: import("vue").Ref<boolean, boolean>;
14
12
  menuType: import("vue").Ref<LayoutMenuType, LayoutMenuType>;
15
13
  includeHorizontal: import("vue").ComputedRef<boolean>;
16
14
  isVertical: import("vue").ComputedRef<boolean>;
@@ -407,12 +405,10 @@ export declare const useLayoutStore: import("pinia").StoreDefinition<"layout", P
407
405
  topbarHeight: import("vue").Ref<number, number>;
408
406
  tabbarHeight: import("vue").Ref<number, number>;
409
407
  headerHeight: import("vue").ComputedRef<number>;
410
- }, "collapse" | "menus" | "sidebarVisible" | "settingVisible" | "isMobile" | "fixedHead" | "menuType" | "firstLevelMenus" | "firstLevelActive" | "secondLevelActive" | "topMenus" | "topActive" | "tabbarVisible" | "activeTab" | "refreshing" | "tabList" | "keepAliveInclude" | "asideWidth" | "collapsedAsideWidth" | "snugAsideWidth" | "topbarHeight" | "tabbarHeight">, Pick<{
408
+ }, "collapse" | "menus" | "sidebarVisible" | "menuType" | "tabbarVisible" | "asideWidth" | "collapsedAsideWidth" | "snugAsideWidth" | "topbarHeight" | "tabbarHeight" | "isMobile" | "firstLevelMenus" | "firstLevelActive" | "secondLevelActive" | "topMenus" | "topActive" | "activeTab" | "refreshing" | "tabList" | "keepAliveInclude">, Pick<{
411
409
  sidebarVisible: import("vue").Ref<boolean, boolean>;
412
410
  collapse: import("vue").Ref<boolean, boolean>;
413
- settingVisible: import("vue").Ref<boolean, boolean>;
414
411
  isMobile: import("vue").Ref<boolean, boolean>;
415
- fixedHead: import("vue").Ref<boolean, boolean>;
416
412
  menuType: import("vue").Ref<LayoutMenuType, LayoutMenuType>;
417
413
  includeHorizontal: import("vue").ComputedRef<boolean>;
418
414
  isVertical: import("vue").ComputedRef<boolean>;
@@ -812,9 +808,7 @@ export declare const useLayoutStore: import("pinia").StoreDefinition<"layout", P
812
808
  }, "keepAlive" | "isHorizontal" | "includeHorizontal" | "isVertical" | "isBiserial" | "isHorizontalVertical" | "isHorizontalBiserial" | "menusMap" | "secondLevelMenus" | "thirdLevelMenus" | "snugMenus" | "snugActive" | "defaultMenus" | "iframeTabList" | "keepAliveExclude" | "sidebarWidth" | "headerHeight">, Pick<{
813
809
  sidebarVisible: import("vue").Ref<boolean, boolean>;
814
810
  collapse: import("vue").Ref<boolean, boolean>;
815
- settingVisible: import("vue").Ref<boolean, boolean>;
816
811
  isMobile: import("vue").Ref<boolean, boolean>;
817
- fixedHead: import("vue").Ref<boolean, boolean>;
818
812
  menuType: import("vue").Ref<LayoutMenuType, LayoutMenuType>;
819
813
  includeHorizontal: import("vue").ComputedRef<boolean>;
820
814
  isVertical: import("vue").ComputedRef<boolean>;
package/store/layout.js CHANGED
@@ -5,13 +5,11 @@ import { useGlobalConfig } from '../config/index.js';
5
5
  import { ref, watch, computed, nextTick } from 'vue';
6
6
  import { useWindowResize } from '../hooks/useWindowResize.js';
7
7
 
8
- const useLayoutStore = defineStore("layout", () => {
8
+ const useLayoutStore = defineStore("cosey-layout", () => {
9
9
  const { layout: layoutConfig } = useGlobalConfig();
10
10
  const route = useRoute();
11
- const sidebarVisible = ref(true);
12
- const collapse = ref(false);
13
- const settingVisible = ref(false);
14
- const fixedHead = ref(true);
11
+ const sidebarVisible = ref(layoutConfig.sidebarVisible);
12
+ const collapse = ref(layoutConfig.collapse);
15
13
  const isMobile = ref(false);
16
14
  watch(
17
15
  isMobile,
@@ -27,21 +25,15 @@ const useLayoutStore = defineStore("layout", () => {
27
25
  };
28
26
  onResize();
29
27
  useWindowResize(onResize);
30
- const menuType = ref("vertical");
28
+ const menuType = ref(layoutConfig.menuType);
31
29
  const includeHorizontal = computed(
32
- () => ["horizontal", "horizontal-vertical", "horizontal-biserial"].includes(
33
- menuType.value
34
- )
30
+ () => ["horizontal", "horizontal-vertical", "horizontal-biserial"].includes(menuType.value)
35
31
  );
36
32
  const isVertical = computed(() => menuType.value === "vertical");
37
33
  const isBiserial = computed(() => menuType.value === "biserial");
38
34
  const isHorizontal = computed(() => menuType.value === "horizontal");
39
- const isHorizontalVertical = computed(
40
- () => menuType.value === "horizontal-vertical"
41
- );
42
- const isHorizontalBiserial = computed(
43
- () => menuType.value === "horizontal-biserial"
44
- );
35
+ const isHorizontalVertical = computed(() => menuType.value === "horizontal-vertical");
36
+ const isHorizontalBiserial = computed(() => menuType.value === "horizontal-biserial");
45
37
  const menus = ref([]);
46
38
  const menusMap = computed(() => getMenusMap(menus.value));
47
39
  const firstLevelMenus = menus;
@@ -95,7 +87,7 @@ const useLayoutStore = defineStore("layout", () => {
95
87
  }
96
88
  }
97
89
  });
98
- const tabbarVisible = ref(true);
90
+ const tabbarVisible = ref(layoutConfig.tabbarVisible);
99
91
  const activeTab = ref("");
100
92
  const refreshing = ref(false);
101
93
  const tabList = ref([]);
@@ -127,21 +119,16 @@ const useLayoutStore = defineStore("layout", () => {
127
119
  const reload = () => {
128
120
  refreshing.value = true;
129
121
  if (keepAliveInclude.value.includes(route.name)) {
130
- keepAliveInclude.value = keepAliveInclude.value.filter(
131
- (item) => item !== route.name
132
- );
122
+ keepAliveInclude.value = keepAliveInclude.value.filter((item) => item !== route.name);
133
123
  }
134
124
  nextTick(() => {
135
125
  refreshing.value = false;
136
- keepAliveInclude.value = [
137
- ...keepAliveInclude.value,
138
- route.name
139
- ];
126
+ keepAliveInclude.value = [...keepAliveInclude.value, route.name];
140
127
  });
141
128
  };
142
- const asideWidth = ref(260);
143
- const collapsedAsideWidth = ref(64);
144
- const snugAsideWidth = ref(85);
129
+ const asideWidth = ref(layoutConfig.asideWidth);
130
+ const collapsedAsideWidth = ref(layoutConfig.collapsedAsideWidth);
131
+ const snugAsideWidth = ref(layoutConfig.snugAsideWidth);
145
132
  const sidebarWidth = computed(() => {
146
133
  if (isMobile.value) {
147
134
  return 0;
@@ -162,24 +149,25 @@ const useLayoutStore = defineStore("layout", () => {
162
149
  }
163
150
  return asideWidth.value;
164
151
  case "biserial":
165
- case "horizontal-biserial":
152
+ case "horizontal-biserial": {
166
153
  const snugAsideW = snugMenus.value.length === 0 ? 0 : snugAsideWidth.value;
167
154
  const asideW = defaultMenus.value.length === 0 ? 0 : collapse.value ? collapsedAsideWidth.value : asideWidth.value;
168
155
  return snugAsideW + asideW;
156
+ }
157
+ default:
158
+ return 0;
169
159
  }
170
160
  }
171
161
  });
172
- const topbarHeight = ref(48);
173
- const tabbarHeight = ref(41);
162
+ const topbarHeight = ref(layoutConfig.topbarHeight);
163
+ const tabbarHeight = ref(layoutConfig.tabbarHeight);
174
164
  const headerHeight = computed(() => {
175
165
  return topbarHeight.value + (tabbarVisible.value ? tabbarHeight.value : 0);
176
166
  });
177
167
  return {
178
168
  sidebarVisible,
179
169
  collapse,
180
- settingVisible,
181
170
  isMobile,
182
- fixedHead,
183
171
  menuType,
184
172
  includeHorizontal,
185
173
  isVertical,
package/store/user.d.ts CHANGED
@@ -5,7 +5,7 @@ interface UserInfo {
5
5
  avatar: string;
6
6
  [key: PropertyKey]: any;
7
7
  }
8
- export declare const useUserStore: import("pinia").StoreDefinition<"user", Pick<{
8
+ export declare const useUserStore: import("pinia").StoreDefinition<"cosey-user", Pick<{
9
9
  dynamicRoutes: import("vue").Ref<any[], any[]>;
10
10
  userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
11
11
  requestedUserInfo: import("vue").Ref<boolean, boolean>;
package/store/user.js CHANGED
@@ -8,7 +8,7 @@ import { NOT_FOUND_ROUTE_NAME, NotFoundRoute } from '../router/not-found.js';
8
8
  import { usePersist } from '../hooks/usePersist.js';
9
9
  import { warningOnce } from '../utils/warning.js';
10
10
 
11
- const useUserStore = defineStore("user", () => {
11
+ const useUserStore = defineStore("cosey-user", () => {
12
12
  const route = useRoute();
13
13
  const router = useRouter();
14
14
  const persist = usePersist();
package/utils/array.js CHANGED
@@ -1,4 +1,7 @@
1
1
  function arrayMove(arr, fromIndex, toIndex) {
2
+ if (fromIndex === toIndex) {
3
+ return arr;
4
+ }
2
5
  const fromEl = arr[fromIndex];
3
6
  arr.splice(toIndex + (fromIndex < toIndex ? 1 : 0), 0, fromEl);
4
7
  arr.splice(fromIndex + (fromIndex < toIndex ? 0 : 1), 1);
@@ -59,9 +59,7 @@ async function writeFile(wb, bookType) {
59
59
  }
60
60
  function flatColumns(columns) {
61
61
  return columns.reduce((result, column) => {
62
- return result.concat(
63
- Array.isArray(column.columns) ? flatColumns(column.columns) : column
64
- );
62
+ return result.concat(Array.isArray(column.columns) ? flatColumns(column.columns) : column);
65
63
  }, []);
66
64
  }
67
65
  function columns2aoa(columns) {
@@ -4,11 +4,7 @@ function aoa2sheet(sheetName, aoa) {
4
4
  const sheet = new WorkSheet(sheetName);
5
5
  aoa.forEach((row, rowIndex) => {
6
6
  row.forEach((value, colIndex) => {
7
- sheet.setCell(
8
- colIndex,
9
- rowIndex,
10
- value instanceof Cell ? value : new Cell(value)
11
- );
7
+ sheet.setCell(colIndex, rowIndex, value instanceof Cell ? value : new Cell(value));
12
8
  });
13
9
  });
14
10
  return sheet;
package/utils/file.js CHANGED
@@ -43,9 +43,7 @@ function getFileType(urlOrFile) {
43
43
  if (/^(?:avi|wmv|mpg|mpeg|mov|rm|ram|swf|flv|mp4|webm|ogm)$/i.test(suffix)) {
44
44
  return "video";
45
45
  }
46
- if (/^(?:mp3|wav|mid|aif|aiff|wma|ra|vqf|m4a|aac|midi|ogg|au|voc)$/i.test(
47
- suffix
48
- )) {
46
+ if (/^(?:mp3|wav|mid|aif|aiff|wma|ra|vqf|m4a|aac|midi|ogg|au|voc)$/i.test(suffix)) {
49
47
  return "audio";
50
48
  }
51
49
  return suffix;
package/utils/object.js CHANGED
@@ -2,9 +2,7 @@ import { omit } from 'lodash-es';
2
2
  import { isPlainObject } from './is.js';
3
3
 
4
4
  function omitUndefined(object) {
5
- return Object.fromEntries(
6
- Object.entries(object).filter(([, value]) => value !== void 0)
7
- );
5
+ return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== void 0));
8
6
  }
9
7
  function initObject(keys, initValue) {
10
8
  return keys.reduce(
package/utils/tree.js CHANGED
@@ -46,11 +46,7 @@ function walkAncestor(node, parentKey, callback) {
46
46
  }
47
47
  }
48
48
  function mapTree(tree, callback, options = {}) {
49
- const {
50
- childrenKey = "children",
51
- newChildrenKey = childrenKey,
52
- parent
53
- } = options;
49
+ const { childrenKey = "children", newChildrenKey = childrenKey, parent } = options;
54
50
  return tree.map((node, i) => {
55
51
  const rNode = callback(node, i, parent);
56
52
  const children = node[childrenKey];
@@ -65,12 +61,7 @@ function mapTree(tree, callback, options = {}) {
65
61
  });
66
62
  }
67
63
  function mapTreeExtra(tree, callback, options, _internalLevel = 1) {
68
- const {
69
- mergeLast,
70
- customNode,
71
- childrenKey = "children",
72
- parent
73
- } = options || {};
64
+ const { mergeLast, customNode, childrenKey = "children", parent } = options || {};
74
65
  let prevNode;
75
66
  return tree.map((node, index) => {
76
67
  const mappedNode = callback(node, index, parent);
package/utils/vue.js CHANGED
@@ -20,7 +20,7 @@ function createMergedExpose(keys, ...exposeList) {
20
20
  for (const expose of exposeList) {
21
21
  const obj = typeof expose === "function" ? expose() : expose;
22
22
  if (obj && key in obj) {
23
- let value = obj[key];
23
+ const value = obj[key];
24
24
  if (typeof value === "function") {
25
25
  return obj[key](...args);
26
26
  }
@@ -1 +0,0 @@
1
-
@@ -1 +0,0 @@
1
- export * from './loading';
@@ -1 +0,0 @@
1
- export { loadingDash, loadingRotate } from './loading.js';
@@ -1,3 +0,0 @@
1
- import { Keyframes } from '../../cssinjs';
2
- export declare const loadingRotate: Keyframes;
3
- export declare const loadingDash: Keyframes;
@@ -1,23 +0,0 @@
1
- import stdin_default from '../../cssinjs/Keyframes.js';
2
-
3
- const loadingRotate = new stdin_default("loading-rotate", {
4
- "100%": {
5
- transform: "rotate(1turn)"
6
- }
7
- });
8
- const loadingDash = new stdin_default("loading-dash", {
9
- "0%": {
10
- strokeDasharray: "1,200",
11
- strokeDashoffset: 0
12
- },
13
- "50%": {
14
- strokeDasharray: "90,150",
15
- strokeDashoffset: "-40px"
16
- },
17
- "100%": {
18
- strokeDasharray: "90,150",
19
- strokeDashoffset: "-120px"
20
- }
21
- });
22
-
23
- export { loadingDash, loadingRotate };
@@ -1 +0,0 @@
1
- export { default } from './layout-user.vue';
@@ -1 +0,0 @@
1
- export { default } from './layout-user.vue.js';