@duxweb/dvha-core 1.1.30 → 1.2.0

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 (159) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/cjs/components/auth/can.cjs +1 -1
  3. package/dist/cjs/components/auth/index.cjs +1 -0
  4. package/dist/cjs/components/common/icon.cjs +1 -1
  5. package/dist/cjs/components/common/index.cjs +1 -0
  6. package/dist/cjs/components/common/logo.cjs +1 -1
  7. package/dist/cjs/components/index.cjs +1 -0
  8. package/dist/cjs/components/loader/iframe.cjs +1 -1
  9. package/dist/cjs/components/loader/index.cjs +1 -0
  10. package/dist/cjs/components/loader/loader.cjs +1 -1
  11. package/dist/cjs/components/loader/remote/index.cjs +1 -0
  12. package/dist/cjs/components/loader/remote/loader.cjs +1 -1
  13. package/dist/cjs/components/loader/remote/render.cjs +1 -1
  14. package/dist/cjs/components/overlay/index.cjs +1 -0
  15. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  16. package/dist/cjs/components/status/error.cjs +1 -1
  17. package/dist/cjs/components/status/exception.cjs +1 -1
  18. package/dist/cjs/components/status/index.cjs +1 -0
  19. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  20. package/dist/cjs/components/status/notFound.cjs +1 -1
  21. package/dist/cjs/config/color.cjs +1 -1
  22. package/dist/cjs/directive/index.cjs +1 -0
  23. package/dist/cjs/directive/permission.cjs +1 -1
  24. package/dist/cjs/hooks/auth.cjs +1 -1
  25. package/dist/cjs/hooks/config.cjs +1 -1
  26. package/dist/cjs/hooks/data.cjs +1 -1
  27. package/dist/cjs/hooks/export.cjs +1 -1
  28. package/dist/cjs/hooks/exportCsv.cjs +2 -2
  29. package/dist/cjs/hooks/form.cjs +1 -1
  30. package/dist/cjs/hooks/formExtend.cjs +1 -1
  31. package/dist/cjs/hooks/formValidate.cjs +1 -1
  32. package/dist/cjs/hooks/i18n.cjs +1 -1
  33. package/dist/cjs/hooks/import.cjs +1 -1
  34. package/dist/cjs/hooks/importCsv.cjs +2 -2
  35. package/dist/cjs/hooks/index.cjs +1 -0
  36. package/dist/cjs/hooks/json/index.cjs +1 -1
  37. package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -1
  38. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  39. package/dist/cjs/hooks/json/vFor.cjs +1 -1
  40. package/dist/cjs/hooks/json/vIf.cjs +1 -1
  41. package/dist/cjs/hooks/json/vModel.cjs +1 -1
  42. package/dist/cjs/hooks/json/vOn.cjs +1 -1
  43. package/dist/cjs/hooks/json/vShow.cjs +1 -1
  44. package/dist/cjs/hooks/json/vText.cjs +1 -1
  45. package/dist/cjs/hooks/json.cjs +1 -1
  46. package/dist/cjs/hooks/list.cjs +1 -1
  47. package/dist/cjs/hooks/manage.cjs +1 -1
  48. package/dist/cjs/hooks/menu.cjs +1 -1
  49. package/dist/cjs/hooks/overlay.cjs +1 -1
  50. package/dist/cjs/hooks/select.cjs +1 -1
  51. package/dist/cjs/hooks/theme.cjs +4 -8
  52. package/dist/cjs/hooks/tree.cjs +1 -1
  53. package/dist/cjs/hooks/upload/index.cjs +1 -0
  54. package/dist/cjs/hooks/upload/local.cjs +1 -1
  55. package/dist/cjs/hooks/upload/s3.cjs +1 -1
  56. package/dist/cjs/hooks/upload.cjs +1 -1
  57. package/dist/cjs/index.cjs +1 -1
  58. package/dist/cjs/main.cjs +1 -1
  59. package/dist/cjs/preset/authProvider.cjs +1 -1
  60. package/dist/cjs/preset/dataProvider.cjs +1 -1
  61. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  62. package/dist/cjs/preset/index.cjs +1 -0
  63. package/dist/cjs/provider/app.cjs +1 -1
  64. package/dist/cjs/provider/index.cjs +1 -0
  65. package/dist/cjs/provider/tab.cjs +1 -1
  66. package/dist/cjs/router/index.cjs +1 -0
  67. package/dist/cjs/router/route.cjs +1 -1
  68. package/dist/cjs/stores/auth.cjs +1 -1
  69. package/dist/cjs/stores/i18n.cjs +1 -1
  70. package/dist/cjs/stores/index.cjs +1 -0
  71. package/dist/cjs/stores/jsonSchema.cjs +1 -1
  72. package/dist/cjs/stores/manage.cjs +1 -1
  73. package/dist/cjs/stores/route.cjs +1 -1
  74. package/dist/cjs/stores/tab.cjs +1 -1
  75. package/dist/cjs/stores/theme.cjs +1 -1
  76. package/dist/cjs/utils/bus.cjs +1 -1
  77. package/dist/cjs/utils/index.cjs +1 -0
  78. package/dist/cjs/utils/theme.cjs +8 -8
  79. package/dist/cjs/utils/tree.cjs +1 -1
  80. package/dist/esm/_virtual/_rolldown/runtime.js +9 -0
  81. package/dist/esm/components/auth/can.js +17 -36
  82. package/dist/esm/components/auth/index.js +1 -0
  83. package/dist/esm/components/common/icon.js +16 -24
  84. package/dist/esm/components/common/index.js +2 -0
  85. package/dist/esm/components/common/logo.js +50 -49
  86. package/dist/esm/components/index.js +14 -0
  87. package/dist/esm/components/loader/iframe.js +16 -18
  88. package/dist/esm/components/loader/index.js +1 -0
  89. package/dist/esm/components/loader/loader.js +11 -40
  90. package/dist/esm/components/loader/remote/index.js +2 -0
  91. package/dist/esm/components/loader/remote/loader.js +118 -156
  92. package/dist/esm/components/loader/remote/render.js +12 -17
  93. package/dist/esm/components/overlay/index.js +1 -0
  94. package/dist/esm/components/overlay/overlay.js +54 -70
  95. package/dist/esm/components/status/error.js +7 -9
  96. package/dist/esm/components/status/exception.js +21 -37
  97. package/dist/esm/components/status/index.js +4 -0
  98. package/dist/esm/components/status/notAuthorized.js +7 -9
  99. package/dist/esm/components/status/notFound.js +7 -9
  100. package/dist/esm/config/color.js +288 -290
  101. package/dist/esm/directive/index.js +1 -0
  102. package/dist/esm/directive/permission.js +7 -27
  103. package/dist/esm/hooks/auth.js +154 -120
  104. package/dist/esm/hooks/config.js +11 -9
  105. package/dist/esm/hooks/data.js +416 -415
  106. package/dist/esm/hooks/export.js +32 -36
  107. package/dist/esm/hooks/exportCsv.js +42 -46
  108. package/dist/esm/hooks/form.js +86 -95
  109. package/dist/esm/hooks/formExtend.js +36 -40
  110. package/dist/esm/hooks/formValidate.js +22 -25
  111. package/dist/esm/hooks/i18n.js +14 -18
  112. package/dist/esm/hooks/import.js +45 -54
  113. package/dist/esm/hooks/importCsv.js +90 -83
  114. package/dist/esm/hooks/index.js +31 -0
  115. package/dist/esm/hooks/json/index.js +14 -22
  116. package/dist/esm/hooks/json/utils/contextManager.js +35 -26
  117. package/dist/esm/hooks/json/utils/expressionParser.js +100 -123
  118. package/dist/esm/hooks/json/vFor.js +50 -55
  119. package/dist/esm/hooks/json/vIf.js +17 -16
  120. package/dist/esm/hooks/json/vModel.js +96 -106
  121. package/dist/esm/hooks/json/vOn.js +30 -32
  122. package/dist/esm/hooks/json/vShow.js +20 -22
  123. package/dist/esm/hooks/json/vText.js +44 -51
  124. package/dist/esm/hooks/json.js +131 -132
  125. package/dist/esm/hooks/list.js +150 -184
  126. package/dist/esm/hooks/manage.js +25 -22
  127. package/dist/esm/hooks/menu.js +57 -61
  128. package/dist/esm/hooks/overlay.js +6 -23
  129. package/dist/esm/hooks/select.js +84 -94
  130. package/dist/esm/hooks/theme.js +289 -219
  131. package/dist/esm/hooks/tree.js +43 -47
  132. package/dist/esm/hooks/upload/index.js +2 -0
  133. package/dist/esm/hooks/upload/local.js +24 -30
  134. package/dist/esm/hooks/upload/s3.js +70 -80
  135. package/dist/esm/hooks/upload.js +256 -272
  136. package/dist/esm/index.js +150 -141
  137. package/dist/esm/main.js +24 -45
  138. package/dist/esm/preset/authProvider.js +62 -68
  139. package/dist/esm/preset/dataProvider.js +154 -180
  140. package/dist/esm/preset/i18nProvider.js +28 -30
  141. package/dist/esm/preset/index.js +3 -0
  142. package/dist/esm/provider/app.js +124 -151
  143. package/dist/esm/provider/index.js +2 -0
  144. package/dist/esm/provider/tab.js +49 -66
  145. package/dist/esm/router/index.js +1 -0
  146. package/dist/esm/router/route.js +39 -46
  147. package/dist/esm/stores/auth.js +51 -46
  148. package/dist/esm/stores/i18n.js +32 -29
  149. package/dist/esm/stores/index.js +7 -0
  150. package/dist/esm/stores/jsonSchema.js +47 -34
  151. package/dist/esm/stores/manage.js +63 -48
  152. package/dist/esm/stores/route.js +60 -56
  153. package/dist/esm/stores/tab.js +55 -60
  154. package/dist/esm/stores/theme.js +48 -55
  155. package/dist/esm/utils/bus.js +3 -5
  156. package/dist/esm/utils/index.js +3 -0
  157. package/dist/esm/utils/theme.js +110 -93
  158. package/dist/esm/utils/tree.js +28 -37
  159. package/package.json +1 -1
@@ -1,31 +1,34 @@
1
- import { defineStore as i } from "pinia";
2
- import { inject as c, ref as r } from "vue";
3
- function p(t) {
4
- const e = c("dux.manage");
5
- if (t || (t = e?.value || ""), !t)
6
- throw new Error("manage not found");
7
- return u(t)();
1
+ import { inject as e, ref as t } from "vue";
2
+ import { defineStore as n } from "pinia";
3
+ /**
4
+ * use i18n store
5
+ * @param manageName manage name
6
+ * @returns i18n store
7
+ */
8
+ function r(t) {
9
+ let n = e("dux.manage");
10
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
11
+ return i(t)();
8
12
  }
9
- function u(t) {
10
- return i(`i18n-${t}`, () => {
11
- const e = r(""), n = r(!1);
12
- return {
13
- lang: e,
14
- isInit: () => {
15
- const o = n.value;
16
- return n.value = !0, o;
17
- },
18
- setLocale: (o) => {
19
- e.value = o;
20
- },
21
- getLocale: () => e.value
22
- };
23
- }, {
24
- persist: {
25
- pick: ["lang"]
26
- }
27
- });
13
+ /**
14
+ * create manage store
15
+ * @param manageName manage name
16
+ * @returns manage store
17
+ */
18
+ function i(e) {
19
+ return n(`i18n-${e}`, () => {
20
+ let e = t(""), n = t(!1);
21
+ return {
22
+ lang: e,
23
+ isInit: () => {
24
+ let e = n.value;
25
+ return n.value = !0, e;
26
+ },
27
+ setLocale: (t) => {
28
+ e.value = t;
29
+ },
30
+ getLocale: () => e.value
31
+ };
32
+ }, { persist: { pick: ["lang"] } });
28
33
  }
29
- export {
30
- p as useI18nStore
31
- };
34
+ export { r as useI18nStore };
@@ -0,0 +1,7 @@
1
+ import "./auth.js";
2
+ import "./i18n.js";
3
+ import "./jsonSchema.js";
4
+ import "./manage.js";
5
+ import "./route.js";
6
+ import "./tab.js";
7
+ import "./theme.js";
@@ -1,36 +1,49 @@
1
- import { defineStore as u } from "pinia";
2
- import { inject as h, ref as c } from "vue";
3
- function d(t) {
4
- const e = h("dux.manage");
5
- if (t || (t = e?.value || ""), !t)
6
- throw new Error("manage not found");
7
- return m(t)();
1
+ import { inject as e, ref as t } from "vue";
2
+ import { defineStore as n } from "pinia";
3
+ /**
4
+ * 生成组件缓存键
5
+ */
6
+ function r(e) {
7
+ return e;
8
8
  }
9
- function m(t) {
10
- return u(`jsonSchema-${t}`, () => {
11
- const e = c(/* @__PURE__ */ new Map()), o = c(/* @__PURE__ */ new Map());
12
- return {
13
- componentCache: e,
14
- componentsByName: o,
15
- addComponent: (n, r, s) => {
16
- const a = r;
17
- return e.value.has(a) || (e.value.set(a, {
18
- component: n,
19
- name: r,
20
- originalName: s || r,
21
- cacheKey: a
22
- }), o.value.set(r, n)), a;
23
- },
24
- getComponent: (n) => e.value.get(n)?.component,
25
- getComponentByName: (n) => o.value.get(n),
26
- hasComponent: (n) => e.value.has(n),
27
- clearCache: () => {
28
- e.value.clear(), o.value.clear();
29
- },
30
- getCacheSize: () => e.value.size
31
- };
32
- });
9
+ /**
10
+ * use json schema store
11
+ * @param manageName manage name
12
+ * @returns json schema store
13
+ */
14
+ function i(t) {
15
+ let n = e("dux.manage");
16
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
17
+ return a(t)();
33
18
  }
34
- export {
35
- d as useJsonSchemaStore
36
- };
19
+ /**
20
+ * create json schema store
21
+ * @param manageName manage name
22
+ * @returns json schema store
23
+ */
24
+ function a(e) {
25
+ return n(`jsonSchema-${e}`, () => {
26
+ let e = t(/* @__PURE__ */ new Map()), n = t(/* @__PURE__ */ new Map());
27
+ return {
28
+ componentCache: e,
29
+ componentsByName: n,
30
+ addComponent: (t, i, a) => {
31
+ let o = r(i);
32
+ return e.value.has(o) || (e.value.set(o, {
33
+ component: t,
34
+ name: i,
35
+ originalName: a || i,
36
+ cacheKey: o
37
+ }), n.value.set(i, t)), o;
38
+ },
39
+ getComponent: (t) => e.value.get(t)?.component,
40
+ getComponentByName: (e) => n.value.get(e),
41
+ hasComponent: (t) => e.value.has(t),
42
+ clearCache: () => {
43
+ e.value.clear(), n.value.clear();
44
+ },
45
+ getCacheSize: () => e.value.size
46
+ };
47
+ });
48
+ }
49
+ export { i as useJsonSchemaStore };
@@ -1,51 +1,66 @@
1
- import { cloneDeep as m } from "lodash-es";
2
- import { defineStore as v } from "pinia";
3
- import { inject as f, ref as u, markRaw as P } from "vue";
4
- function p(r) {
5
- return r != null && typeof r == "object" && !Array.isArray(r) && typeof r.getList != "function";
1
+ import { inject as e, markRaw as t, ref as n } from "vue";
2
+ import { defineStore as r } from "pinia";
3
+ import { cloneDeep as i } from "lodash-es";
4
+ /**
5
+ * 判断是否为 Record<string, IDataProvider> 类型
6
+ * @param value 要判断的值
7
+ * @returns 是否为记录类型
8
+ */
9
+ function a(e) {
10
+ return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.getList != "function";
6
11
  }
7
- function O(r) {
8
- const n = f("dux.manage");
9
- if (r || (r = n?.value || ""), !r)
10
- throw new Error("manage not found");
11
- return h(r)();
12
+ /**
13
+ * use manage store
14
+ * @param manageName manage name
15
+ * @returns manage store
16
+ */
17
+ function o(t) {
18
+ let n = e("dux.manage");
19
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
20
+ return s(t)();
12
21
  }
13
- function h(r) {
14
- return v(`manages-${r}`, () => {
15
- const n = u(), a = u(!1);
16
- return {
17
- config: n,
18
- isInit: () => {
19
- const c = a.value;
20
- return a.value = !0, c;
21
- },
22
- setConfig: (c, e) => {
23
- const t = m(c), s = [];
24
- t.title && s.push(t.title), e.title && s.push(e.title), t.title = s.join(" - "), t.copyright = t.copyright || e.copyright, t.description = t.description || e.description, t.theme = { ...e?.theme, ...t?.theme };
25
- const d = {};
26
- e?.dataProvider && (p(e.dataProvider) ? Object.keys(e.dataProvider).forEach((o) => {
27
- d[o] = e.dataProvider[o];
28
- }) : d.default = e.dataProvider), t?.dataProvider && (p(t.dataProvider) ? Object.keys(t.dataProvider).forEach((o) => {
29
- d[o] = t.dataProvider[o];
30
- }) : d.default = t.dataProvider), t.authProvider = e?.authProvider || t?.authProvider, t.dataProvider = d, t.i18nProvider = e?.i18nProvider || t?.i18nProvider, t.layoutComponent = {
31
- ...e.layoutComponent,
32
- ...t.layoutComponent
33
- };
34
- const i = {
35
- ...e.components,
36
- ...t.components
37
- };
38
- i && Object.keys(i).forEach((o) => {
39
- i[o] && (i[o] = P(i[o]));
40
- }), t.components = i, t.remote = {
41
- ...e.remote,
42
- ...t.remote
43
- }, n.value = t;
44
- },
45
- getConfig: () => n.value
46
- };
47
- });
22
+ /**
23
+ * create manage store
24
+ * @param manageName manage name
25
+ * @returns manage store
26
+ */
27
+ function s(e) {
28
+ return r(`manages-${e}`, () => {
29
+ let e = n(), r = n(!1);
30
+ return {
31
+ config: e,
32
+ isInit: () => {
33
+ let e = r.value;
34
+ return r.value = !0, e;
35
+ },
36
+ setConfig: (n, r) => {
37
+ let o = i(n), s = [];
38
+ o.title && s.push(o.title), r.title && s.push(r.title), o.title = s.join(" - "), o.copyright = o.copyright || r.copyright, o.description = o.description || r.description, o.theme = {
39
+ ...r?.theme,
40
+ ...o?.theme
41
+ };
42
+ let c = {};
43
+ r?.dataProvider && (a(r.dataProvider) ? Object.keys(r.dataProvider).forEach((e) => {
44
+ c[e] = r.dataProvider[e];
45
+ }) : c.default = r.dataProvider), o?.dataProvider && (a(o.dataProvider) ? Object.keys(o.dataProvider).forEach((e) => {
46
+ c[e] = o.dataProvider[e];
47
+ }) : c.default = o.dataProvider), o.authProvider = r?.authProvider || o?.authProvider, o.dataProvider = c, o.i18nProvider = r?.i18nProvider || o?.i18nProvider, o.layoutComponent = {
48
+ ...r.layoutComponent,
49
+ ...o.layoutComponent
50
+ };
51
+ let l = {
52
+ ...r.components,
53
+ ...o.components
54
+ };
55
+ l && Object.keys(l).forEach((e) => {
56
+ l[e] && (l[e] = t(l[e]));
57
+ }), o.components = l, o.remote = {
58
+ ...r.remote,
59
+ ...o.remote
60
+ }, e.value = o;
61
+ },
62
+ getConfig: () => e.value
63
+ };
64
+ });
48
65
  }
49
- export {
50
- O as useManageStore
51
- };
66
+ export { o as useManageStore };
@@ -1,58 +1,62 @@
1
- import { defineStore as S } from "pinia";
2
- import { inject as g, ref as l } from "vue";
3
- function F(r) {
4
- const t = g("dux.manage");
5
- if (r || (r = t?.value || ""), !r)
6
- throw new Error("manage not found");
7
- return m(r)();
1
+ import { inject as e, ref as t } from "vue";
2
+ import { defineStore as n } from "pinia";
3
+ /**
4
+ * use route store
5
+ * @param manageName manage name
6
+ * @returns route store
7
+ */
8
+ function r(t) {
9
+ let n = e("dux.manage");
10
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
11
+ return i(t)();
8
12
  }
9
- function m(r) {
10
- return S(`routes-${r}`, () => {
11
- const t = l([]), i = (e) => t.value?.find((n) => n.path === e), f = (e) => t.value?.find((n) => n.name === e), d = (e) => {
12
- t.value?.push(e);
13
- }, v = (e) => {
14
- t.value = [...t.value, ...e];
15
- }, R = (e) => {
16
- t.value = e;
17
- }, p = () => t.value, h = () => {
18
- t.value = [];
19
- }, I = () => {
20
- const e = t.value?.filter((o) => !o.parent && !o.name?.includes("404") && !o.name?.includes("403"))?.sort((o, u) => (o.sort || 0) - (u.sort || 0)), n = (o) => {
21
- if (o.path)
22
- return o;
23
- const u = t.value?.filter((s) => s.parent === o.name)?.sort((s, c) => (s.sort || 0) - (c.sort || 0));
24
- for (const s of u || []) {
25
- const c = n(s);
26
- if (c)
27
- return c;
28
- }
29
- };
30
- for (const o of e || []) {
31
- const u = n(o);
32
- if (u)
33
- return u;
34
- }
35
- }, a = l(!1);
36
- return {
37
- routes: t,
38
- searchRoute: i,
39
- searchRouteName: f,
40
- appendRoute: d,
41
- appendRoutes: v,
42
- setRoutes: R,
43
- getRoutes: p,
44
- clearRoutes: h,
45
- getIndexRoute: I,
46
- getRouteInit: () => {
47
- const e = a.value;
48
- return a.value = !0, e;
49
- },
50
- resetRouteInit: () => {
51
- a.value = !1;
52
- }
53
- };
54
- });
13
+ /**
14
+ * create route store
15
+ * @param manageName manage name
16
+ * @returns route store
17
+ */
18
+ function i(e) {
19
+ return n(`routes-${e}`, () => {
20
+ let e = t([]), n = (t) => e.value?.find((e) => e.path === t), r = (t) => e.value?.find((e) => e.name === t), i = (t) => {
21
+ e.value?.push(t);
22
+ }, a = (t) => {
23
+ e.value = [...e.value, ...t];
24
+ }, o = (t) => {
25
+ e.value = t;
26
+ }, s = () => e.value, c = () => {
27
+ e.value = [];
28
+ }, l = () => {
29
+ let t = e.value?.filter((e) => !e.parent && !e.name?.includes("404") && !e.name?.includes("403"))?.sort((e, t) => (e.sort || 0) - (t.sort || 0)), n = (t) => {
30
+ if (t.path) return t;
31
+ let r = e.value?.filter((e) => e.parent === t.name)?.sort((e, t) => (e.sort || 0) - (t.sort || 0));
32
+ for (let e of r || []) {
33
+ let t = n(e);
34
+ if (t) return t;
35
+ }
36
+ };
37
+ for (let e of t || []) {
38
+ let t = n(e);
39
+ if (t) return t;
40
+ }
41
+ }, u = t(!1);
42
+ return {
43
+ routes: e,
44
+ searchRoute: n,
45
+ searchRouteName: r,
46
+ appendRoute: i,
47
+ appendRoutes: a,
48
+ setRoutes: o,
49
+ getRoutes: s,
50
+ clearRoutes: c,
51
+ getIndexRoute: l,
52
+ getRouteInit: () => {
53
+ let e = u.value;
54
+ return u.value = !0, e;
55
+ },
56
+ resetRouteInit: () => {
57
+ u.value = !1;
58
+ }
59
+ };
60
+ });
55
61
  }
56
- export {
57
- F as useRouteStore
58
- };
62
+ export { r as useRouteStore };
@@ -1,62 +1,57 @@
1
- import { defineStore as d } from "pinia";
2
- import { inject as h, ref as c, nextTick as f } from "vue";
3
- function R(o) {
4
- const u = h("dux.manage");
5
- if (o || (o = u?.value || ""), !o)
6
- throw new Error("manage not found");
7
- return b(o)();
1
+ import { inject as e, nextTick as t, ref as n } from "vue";
2
+ import { defineStore as r } from "pinia";
3
+ function i(t) {
4
+ let n = e("dux.manage");
5
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
6
+ return a(t)();
8
7
  }
9
- function b(o) {
10
- return d(`tab-${o}`, () => {
11
- const u = c(), v = c(), e = c([]);
12
- return {
13
- current: u,
14
- tabs: e,
15
- isTab: (t) => e.value.some((l) => l.path === t),
16
- addTab: (t, l) => {
17
- t.path && (e.value.some((a) => a.path === t.path) ? (u.value && u.value !== t.path && (v.value = e.value.find((a) => a.path === u.value)), u.value = t.path) : (u.value && (v.value = e.value.find((a) => a.path === u.value)), e.value.push(t), l?.(t), u.value = t.path));
18
- },
19
- delTab: (t, l) => {
20
- const a = e.value.findIndex((i) => i.path === t);
21
- if (a === -1 || e.value.length <= 1 || e.value[a]?.meta?.lock)
22
- return;
23
- let r;
24
- if (t === u.value && v.value && (r = e.value.find((i) => i.path === v.value?.path && i.path !== t)), !r) {
25
- const i = e.value[a - 1], s = e.value[a + 1];
26
- r = i || s;
27
- }
28
- e.value.splice(a, 1), l?.(r);
29
- },
30
- changeTab: (t, l) => {
31
- const a = e.value.find((n) => n.path === t);
32
- a && (u.value && u.value !== t && (v.value = e.value.find((n) => n.path === u.value)), u.value = t, l?.(a));
33
- },
34
- delOther: (t, l) => {
35
- e.value = e.value.filter((a) => a.path === t || a.meta?.lock), l?.();
36
- },
37
- delLeft: (t, l) => {
38
- const a = e.value.findIndex((n) => n.path === t);
39
- a <= 0 || f(() => {
40
- e.value = [...e.value.slice(0, a).filter((n) => n.meta?.lock), ...e.value.slice(a)], l?.();
41
- });
42
- },
43
- delRight: (t, l) => {
44
- const a = e.value.findIndex((n) => n.path === t);
45
- a === -1 || a === e.value.length - 1 || f(() => {
46
- e.value = [...e.value.slice(0, a + 1), ...e.value.slice(a + 1).filter((n) => n.meta?.lock)], l?.();
47
- });
48
- },
49
- lockTab: (t) => {
50
- const l = e.value.findIndex((a) => a.path === t);
51
- l !== -1 && e.value[l] && (e.value[l].meta || (e.value[l].meta = {}), e.value[l].meta.lock = !e.value[l].meta.lock);
52
- },
53
- clearTab: () => {
54
- u.value = void 0, v.value = void 0, e.value = [];
55
- }
56
- };
57
- });
8
+ function a(e) {
9
+ return r(`tab-${e}`, () => {
10
+ let e = n(), r = n(), i = n([]);
11
+ return {
12
+ current: e,
13
+ tabs: i,
14
+ isTab: (e) => i.value.some((t) => t.path === e),
15
+ addTab: (t, n) => {
16
+ t.path && (i.value.some((e) => e.path === t.path) ? (e.value && e.value !== t.path && (r.value = i.value.find((t) => t.path === e.value)), e.value = t.path) : (e.value && (r.value = i.value.find((t) => t.path === e.value)), i.value.push(t), n?.(t), e.value = t.path));
17
+ },
18
+ delTab: (t, n) => {
19
+ let a = i.value.findIndex((e) => e.path === t);
20
+ if (a === -1 || i.value.length <= 1 || i.value[a]?.meta?.lock) return;
21
+ let o;
22
+ if (t === e.value && r.value && (o = i.value.find((e) => e.path === r.value?.path && e.path !== t)), !o) {
23
+ let e = i.value[a - 1], t = i.value[a + 1];
24
+ o = e || t;
25
+ }
26
+ i.value.splice(a, 1), n?.(o);
27
+ },
28
+ changeTab: (t, n) => {
29
+ let a = i.value.find((e) => e.path === t);
30
+ a && (e.value && e.value !== t && (r.value = i.value.find((t) => t.path === e.value)), e.value = t, n?.(a));
31
+ },
32
+ delOther: (e, t) => {
33
+ i.value = i.value.filter((t) => t.path === e || t.meta?.lock), t?.();
34
+ },
35
+ delLeft: (e, n) => {
36
+ let r = i.value.findIndex((t) => t.path === e);
37
+ r <= 0 || t(() => {
38
+ i.value = [...i.value.slice(0, r).filter((e) => e.meta?.lock), ...i.value.slice(r)], n?.();
39
+ });
40
+ },
41
+ delRight: (e, n) => {
42
+ let r = i.value.findIndex((t) => t.path === e);
43
+ r === -1 || r === i.value.length - 1 || t(() => {
44
+ i.value = [...i.value.slice(0, r + 1), ...i.value.slice(r + 1).filter((e) => e.meta?.lock)], n?.();
45
+ });
46
+ },
47
+ lockTab: (e) => {
48
+ let t = i.value.findIndex((t) => t.path === e);
49
+ t !== -1 && i.value[t] && (i.value[t].meta || (i.value[t].meta = {}), i.value[t].meta.lock = !i.value[t].meta.lock);
50
+ },
51
+ clearTab: () => {
52
+ e.value = void 0, r.value = void 0, i.value = [];
53
+ }
54
+ };
55
+ });
58
56
  }
59
- export {
60
- b as createTabStore,
61
- R as useTabStore
62
- };
57
+ export { a as createTabStore, i as useTabStore };
@@ -1,58 +1,51 @@
1
- import { defineStore as T } from "pinia";
2
- import { inject as g, ref as r } from "vue";
3
- import { useManageStore as p } from "./manage.js";
4
- const c = {
5
- primary: "emerald",
6
- info: "cyan",
7
- success: "green",
8
- warning: "amber",
9
- error: "red",
10
- gray: "zinc"
1
+ import { useManageStore as e } from "./manage.js";
2
+ import { inject as t, ref as n } from "vue";
3
+ import { defineStore as r } from "pinia";
4
+ var i = {
5
+ primary: "emerald",
6
+ info: "cyan",
7
+ success: "green",
8
+ warning: "amber",
9
+ error: "red",
10
+ gray: "zinc"
11
11
  };
12
- function C(e) {
13
- const o = g("dux.manage");
14
- if (e || (e = o?.value || ""), !e)
15
- throw new Error("manage not found");
16
- return v(e)();
12
+ function a(e) {
13
+ let n = t("dux.manage");
14
+ if (e ||= n?.value || "", !e) throw Error("manage not found");
15
+ return o(e)();
17
16
  }
18
- function v(e) {
19
- return T(`theme-${e}`, () => {
20
- const o = p(e), t = r(o.config?.theme?.defaultTheme || c), u = r("auto"), s = r(!1);
21
- function i() {
22
- s.value = !0;
23
- }
24
- function f(n) {
25
- u.value = n;
26
- }
27
- function m(n, d) {
28
- t.value[n] = d;
29
- }
30
- function a(n) {
31
- Object.assign(t.value, n);
32
- }
33
- function h() {
34
- t.value = { ...c };
35
- }
36
- function l() {
37
- return t.value;
38
- }
39
- return {
40
- mode: u,
41
- setMode: f,
42
- theme: t,
43
- cssInit: s,
44
- setCssInit: i,
45
- setThemeColor: m,
46
- setThemeColors: a,
47
- resetTheme: h,
48
- getTheme: l
49
- };
50
- }, {
51
- persist: {
52
- pick: ["theme", "mode"]
53
- }
54
- });
17
+ function o(t) {
18
+ return r(`theme-${t}`, () => {
19
+ let r = n(e(t).config?.theme?.defaultTheme || i), a = n("auto"), o = n(!1);
20
+ function s() {
21
+ o.value = !0;
22
+ }
23
+ function c(e) {
24
+ a.value = e;
25
+ }
26
+ function l(e, t) {
27
+ r.value[e] = t;
28
+ }
29
+ function u(e) {
30
+ Object.assign(r.value, e);
31
+ }
32
+ function d() {
33
+ r.value = { ...i };
34
+ }
35
+ function f() {
36
+ return r.value;
37
+ }
38
+ return {
39
+ mode: a,
40
+ setMode: c,
41
+ theme: r,
42
+ cssInit: o,
43
+ setCssInit: s,
44
+ setThemeColor: l,
45
+ setThemeColors: u,
46
+ resetTheme: d,
47
+ getTheme: f
48
+ };
49
+ }, { persist: { pick: ["theme", "mode"] } });
55
50
  }
56
- export {
57
- C as useThemeStore
58
- };
51
+ export { a as useThemeStore };
@@ -1,5 +1,3 @@
1
- import t from "mitt";
2
- const o = t();
3
- export {
4
- o as emitter
5
- };
1
+ import e from "mitt";
2
+ const t = e();
3
+ export { t as emitter };
@@ -0,0 +1,3 @@
1
+ import "./bus.js";
2
+ import "./theme.js";
3
+ import "./tree.js";