@duxweb/dvha-core 1.0.23 → 1.0.24

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 (85) hide show
  1. package/dist/cjs/components/auth/can.cjs +1 -1
  2. package/dist/cjs/components/loader/iframe.cjs +1 -1
  3. package/dist/cjs/components/loader/remote/loader.cjs +1 -1
  4. package/dist/cjs/components/loader/remote/render.cjs +1 -1
  5. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  6. package/dist/cjs/components/status/exception.cjs +1 -1
  7. package/dist/cjs/directive/permission.cjs +1 -1
  8. package/dist/cjs/hooks/auth.cjs +1 -1
  9. package/dist/cjs/hooks/data.cjs +1 -1
  10. package/dist/cjs/hooks/export.cjs +1 -1
  11. package/dist/cjs/hooks/exportCsv.cjs +2 -2
  12. package/dist/cjs/hooks/form.cjs +1 -1
  13. package/dist/cjs/hooks/formExtend.cjs +1 -1
  14. package/dist/cjs/hooks/i18n.cjs +1 -1
  15. package/dist/cjs/hooks/import.cjs +1 -1
  16. package/dist/cjs/hooks/importCsv.cjs +2 -2
  17. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  18. package/dist/cjs/hooks/json/vFor.cjs +1 -1
  19. package/dist/cjs/hooks/json/vOn.cjs +1 -1
  20. package/dist/cjs/hooks/json/vShow.cjs +1 -1
  21. package/dist/cjs/hooks/json.cjs +1 -1
  22. package/dist/cjs/hooks/list.cjs +1 -1
  23. package/dist/cjs/hooks/manage.cjs +1 -1
  24. package/dist/cjs/hooks/menu.cjs +1 -1
  25. package/dist/cjs/hooks/select.cjs +1 -1
  26. package/dist/cjs/hooks/theme.cjs +3 -3
  27. package/dist/cjs/hooks/tree.cjs +1 -1
  28. package/dist/cjs/hooks/upload/s3.cjs +1 -1
  29. package/dist/cjs/hooks/upload.cjs +1 -1
  30. package/dist/cjs/preset/authProvider.cjs +1 -1
  31. package/dist/cjs/preset/dataProvider.cjs +1 -1
  32. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  33. package/dist/cjs/provider/app.cjs +1 -1
  34. package/dist/cjs/router/route.cjs +1 -1
  35. package/dist/cjs/stores/auth.cjs +1 -1
  36. package/dist/cjs/stores/i18n.cjs +1 -1
  37. package/dist/cjs/stores/jsonSchema.cjs +1 -1
  38. package/dist/cjs/stores/manage.cjs +1 -1
  39. package/dist/cjs/stores/route.cjs +1 -1
  40. package/dist/cjs/stores/tab.cjs +1 -1
  41. package/dist/cjs/stores/theme.cjs +1 -1
  42. package/dist/cjs/utils/tree.cjs +1 -1
  43. package/dist/esm/components/auth/can.js +8 -11
  44. package/dist/esm/components/loader/iframe.js +14 -17
  45. package/dist/esm/components/loader/remote/loader.js +103 -105
  46. package/dist/esm/components/loader/remote/render.js +10 -11
  47. package/dist/esm/components/overlay/overlay.js +7 -7
  48. package/dist/esm/components/status/exception.js +10 -13
  49. package/dist/esm/directive/permission.js +6 -7
  50. package/dist/esm/hooks/auth.js +73 -83
  51. package/dist/esm/hooks/data.js +290 -345
  52. package/dist/esm/hooks/export.js +16 -17
  53. package/dist/esm/hooks/exportCsv.js +26 -27
  54. package/dist/esm/hooks/form.js +49 -54
  55. package/dist/esm/hooks/formExtend.js +24 -25
  56. package/dist/esm/hooks/i18n.js +11 -29
  57. package/dist/esm/hooks/import.js +31 -32
  58. package/dist/esm/hooks/importCsv.js +24 -25
  59. package/dist/esm/hooks/json/utils/expressionParser.js +36 -42
  60. package/dist/esm/hooks/json/vFor.js +15 -16
  61. package/dist/esm/hooks/json/vOn.js +17 -18
  62. package/dist/esm/hooks/json/vShow.js +9 -10
  63. package/dist/esm/hooks/json.js +88 -94
  64. package/dist/esm/hooks/list.js +100 -127
  65. package/dist/esm/hooks/manage.js +13 -17
  66. package/dist/esm/hooks/menu.js +39 -52
  67. package/dist/esm/hooks/select.js +35 -40
  68. package/dist/esm/hooks/theme.js +127 -141
  69. package/dist/esm/hooks/tree.js +22 -28
  70. package/dist/esm/hooks/upload/s3.js +22 -23
  71. package/dist/esm/hooks/upload.js +152 -159
  72. package/dist/esm/preset/authProvider.js +63 -117
  73. package/dist/esm/preset/dataProvider.js +69 -76
  74. package/dist/esm/preset/i18nProvider.js +18 -18
  75. package/dist/esm/provider/app.js +74 -81
  76. package/dist/esm/router/route.js +16 -24
  77. package/dist/esm/stores/auth.js +17 -20
  78. package/dist/esm/stores/i18n.js +10 -10
  79. package/dist/esm/stores/jsonSchema.js +20 -23
  80. package/dist/esm/stores/manage.js +33 -33
  81. package/dist/esm/stores/route.js +38 -50
  82. package/dist/esm/stores/tab.js +38 -54
  83. package/dist/esm/stores/theme.js +28 -29
  84. package/dist/esm/utils/tree.js +23 -24
  85. package/package.json +1 -1
@@ -1,177 +1,150 @@
1
- import { reactiveComputed as V, useCountdown as W } from "@vueuse/core";
2
- import { toRef as f, ref as v, watch as P, computed as o } from "vue";
3
- import { useList as X } from "./data.js";
4
- import { useExportCsv as I } from "./exportCsv.js";
5
- import { useImportCsv as Y } from "./importCsv.js";
1
+ import { reactiveComputed as T, useCountdown as V } from "@vueuse/core";
2
+ import { toRef as m, ref as u, watch as C, computed as n } from "vue";
3
+ import { useList as W } from "./data.js";
4
+ import { useExportCsv as z } from "./exportCsv.js";
5
+ import { useImportCsv as X } from "./importCsv.js";
6
6
  function ae(t) {
7
- const c = f(t, "filters", {}), g = f(t, "sorters", {}), l = f(typeof t.pagination == "object" ? t.pagination : {
7
+ const r = m(t, "filters", {}), s = m(t, "sorters", {}), o = m(typeof t.pagination == "object" ? t.pagination : {
8
8
  page: 1,
9
9
  pageSize: 20
10
- }), h = [10, 20, 30, 40, 50, 100], x = (e) => h.includes(e) ? h : Array.from({
10
+ }), f = [10, 20, 30, 40, 50, 100], p = (e) => f.includes(e) ? f : Array.from({
11
11
  length: 5
12
- }, (a, u) => e * (u + 1)), s = v(x(l.value.pageSize));
13
- P(() => l.value.pageSize, (e) => {
14
- s.value.includes(e) || (s.value = x(e));
12
+ }, (d, Q) => e * (Q + 1)), c = u(p(o.value.pageSize));
13
+ C(() => o.value.pageSize, (e) => {
14
+ c.value.includes(e) || (c.value = p(e));
15
15
  });
16
- const k = (e) => {
17
- l.value.pageSize = e, l.value.page = 1;
18
- }, L = (e) => {
19
- l.value.page = e;
16
+ const P = (e) => {
17
+ o.value.pageSize = e, o.value.page = 1;
18
+ }, I = (e) => {
19
+ o.value.page = e;
20
20
  }, {
21
- data: i,
22
- isLoading: R,
23
- refetch: w
24
- } = X({
21
+ data: l,
22
+ isLoading: k,
23
+ refetch: L
24
+ } = W({
25
25
  path: t.path,
26
- pagination: t.pagination ? l.value : !1,
27
- filters: c.value,
28
- sorters: g.value
29
- }), F = o(() => {
30
- var e;
31
- return ((e = i.value) == null ? void 0 : e.data) || [];
32
- }), S = o(() => {
33
- var e;
34
- return ((e = i.value) == null ? void 0 : e.meta) || {};
35
- }), E = o(() => {
36
- var e, a;
37
- return ((e = t.total) == null ? void 0 : e.call(t, i.value)) || ((a = S.value) == null ? void 0 : a[t.totalField || "total"]) || 0;
38
- }), U = o(() => Math.ceil(E.value / l.value.pageSize) || 0), A = (e) => {
39
- c.value = e;
40
- }, y = (e) => {
41
- g.value = e;
42
- }, n = v([]), C = o(() => {
43
- var e, a;
44
- return n.value.length > 0 && n.value.length === ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length);
45
- }), M = o(() => {
46
- var e, a;
47
- return n.value.length > 0 && n.value.length < (((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length) || 0);
48
- }), b = (e) => {
49
- const a = n.value.indexOf(e);
50
- a > -1 ? n.value.splice(a, 1) : n.value.push(e);
51
- }, j = (e) => {
52
- n.value = e;
53
- }, O = (e) => n.value.includes(e), _ = () => {
54
- var e, a;
55
- C.value ? n.value = [] : n.value = ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.map((u) => u[t.key || "id"]).filter((u) => u != null)) || [];
26
+ pagination: t.pagination ? o.value : !1,
27
+ filters: r.value,
28
+ sorters: s.value
29
+ }), R = n(() => l.value?.data || []), h = n(() => l.value?.meta || {}), x = n(() => t.total?.(l.value) || h.value?.[t.totalField || "total"] || 0), w = n(() => Math.ceil(x.value / o.value.pageSize) || 0), F = (e) => {
30
+ r.value = e;
31
+ }, U = (e) => {
32
+ s.value = e;
33
+ }, a = u([]), S = n(() => a.value.length > 0 && a.value.length === l.value?.data?.length), A = n(() => a.value.length > 0 && a.value.length < (l.value?.data?.length || 0)), y = (e) => {
34
+ const d = a.value.indexOf(e);
35
+ d > -1 ? a.value.splice(d, 1) : a.value.push(e);
36
+ }, M = (e) => {
37
+ a.value = e;
38
+ }, b = (e) => a.value.includes(e), j = () => {
39
+ S.value ? a.value = [] : a.value = l.value?.data?.map((e) => e[t.key || "id"]).filter((e) => e != null) || [];
56
40
  };
57
- P(() => {
58
- var e;
59
- return (e = i.value) == null ? void 0 : e.data;
60
- }, () => {
61
- n.value = [];
41
+ C(() => l.value?.data, () => {
42
+ a.value = [];
62
43
  });
63
- const d = () => {
64
- n.value = [], w();
65
- }, m = v({
44
+ const g = () => {
45
+ a.value = [], L();
46
+ }, v = u({
66
47
  page: 1,
67
48
  pageSize: 100
68
49
  }), {
69
- trigger: q,
70
- isLoading: B
71
- } = I({
50
+ trigger: O,
51
+ isLoading: _
52
+ } = z({
72
53
  path: t.path,
73
- filters: c.value || {},
74
- sorters: g.value || {},
54
+ filters: r.value || {},
55
+ sorters: s.value || {},
75
56
  maxPage: () => t.exportMaxPage || 0,
76
- pagination: m.value,
57
+ pagination: v.value,
77
58
  filename: t.exportFilename || "data.csv",
78
59
  onSuccess: (e) => {
79
- var a;
80
- (a = t.onExportSuccess) == null || a.call(t, e), m.value.page = 1;
60
+ t.onExportSuccess?.(e), v.value.page = 1;
81
61
  },
82
62
  onProgress: (e) => {
83
- var a;
84
- (a = t.onExportProgress) == null || a.call(t, e);
63
+ t.onExportProgress?.(e);
85
64
  },
86
65
  onError: (e) => {
87
- var a;
88
- (a = t.onExportError) == null || a.call(t, e), m.value.page = 1;
66
+ t.onExportError?.(e), v.value.page = 1;
89
67
  }
90
- }), D = V(() => ({
91
- ids: n.value
68
+ }), q = T(() => ({
69
+ ids: a.value
92
70
  })), {
93
- trigger: G,
94
- isLoading: H
95
- } = I({
71
+ trigger: B,
72
+ isLoading: D
73
+ } = z({
96
74
  path: t.path,
97
- filters: D,
75
+ filters: q,
98
76
  maxPage: 1,
99
77
  filename: t.exportFilename || "rows.csv",
100
78
  onSuccess: (e) => {
101
- var a;
102
- (a = t.onExportSuccess) == null || a.call(t, e);
79
+ t.onExportSuccess?.(e);
103
80
  },
104
81
  onError: (e) => {
105
- var a;
106
- (a = t.onExportError) == null || a.call(t, e);
82
+ t.onExportError?.(e);
107
83
  }
108
84
  }), {
109
- open: J,
110
- isLoading: K
111
- } = Y({
85
+ open: G,
86
+ isLoading: H
87
+ } = X({
112
88
  path: t.path,
113
89
  onComplete: (e) => {
114
- var a;
115
- (a = t.onImportSuccess) == null || a.call(t, e);
90
+ t.onImportSuccess?.(e);
116
91
  },
117
92
  onProgress: (e) => {
118
- var a;
119
- (a = t.onImportProgress) == null || a.call(t, e);
93
+ t.onImportProgress?.(e);
120
94
  },
121
95
  onError: (e) => {
122
- var a;
123
- (a = t.onImportError) == null || a.call(t, e);
96
+ t.onImportError?.(e);
124
97
  }
125
- }), r = v(!1), {
126
- remaining: N,
127
- start: z,
128
- stop: Q
129
- } = W(10, {
98
+ }), i = u(!1), {
99
+ remaining: J,
100
+ start: E,
101
+ stop: K
102
+ } = V(10, {
130
103
  onComplete: () => {
131
- d(), z();
104
+ g(), E();
132
105
  }
133
- }), T = () => {
134
- r.value = !r.value, r.value ? (d(), z()) : Q();
106
+ }), N = () => {
107
+ i.value = !i.value, i.value ? (g(), E()) : K();
135
108
  };
136
109
  return {
137
110
  // 数据
138
- list: F,
139
- meta: S,
140
- isLoading: R,
141
- pagination: l,
142
- filters: c,
143
- sorters: g,
144
- onRefresh: d,
145
- onUpdateFilters: A,
146
- onUpdateSorters: y,
111
+ list: R,
112
+ meta: h,
113
+ isLoading: k,
114
+ pagination: o,
115
+ filters: r,
116
+ sorters: s,
117
+ onRefresh: g,
118
+ onUpdateFilters: F,
119
+ onUpdateSorters: U,
147
120
  // 选中
148
- checkeds: n,
149
- isAllChecked: C,
150
- isIndeterminate: M,
151
- toggleChecked: b,
152
- isChecked: O,
153
- toggleSelectAll: _,
154
- onUpdateChecked: j,
121
+ checkeds: a,
122
+ isAllChecked: S,
123
+ isIndeterminate: A,
124
+ toggleChecked: y,
125
+ isChecked: b,
126
+ toggleSelectAll: j,
127
+ onUpdateChecked: M,
155
128
  // 分页
156
- total: E,
157
- page: o(() => l.value.page),
158
- pageSize: o(() => l.value.pageSize),
159
- pageSizes: s.value,
160
- pageCount: U,
161
- onUpdatePage: L,
162
- onUpdatePageSize: k,
129
+ total: x,
130
+ page: n(() => o.value.page),
131
+ pageSize: n(() => o.value.pageSize),
132
+ pageSizes: c.value,
133
+ pageCount: w,
134
+ onUpdatePage: I,
135
+ onUpdatePageSize: P,
163
136
  // 导出
164
- onExport: q,
165
- isExporting: B,
166
- onExportRows: G,
167
- isExportingRows: H,
137
+ onExport: O,
138
+ isExporting: _,
139
+ onExportRows: B,
140
+ isExportingRows: D,
168
141
  // 导入
169
- onImport: J,
170
- isImporting: K,
142
+ onImport: G,
143
+ isImporting: H,
171
144
  // 自动刷新
172
- autoRefetch: r,
173
- onAutoRefetch: T,
174
- autoCountdown: N
145
+ autoRefetch: i,
146
+ onAutoRefetch: N,
147
+ autoCountdown: J
175
148
  };
176
149
  }
177
150
  export {
@@ -1,27 +1,23 @@
1
- import { trimStart as f } from "lodash-es";
2
- import { inject as l } from "vue";
3
- import { useRoute as x } from "vue-router";
1
+ import { trimStart as a } from "lodash-es";
2
+ import { inject as c } from "vue";
3
+ import { useRoute as s } from "vue-router";
4
4
  import "pinia";
5
- import { useManageStore as P } from "../stores/manage.js";
6
- function $(e) {
7
- const i = l("dux.manage");
8
- if (e || (e = i == null ? void 0 : i.value), !e)
5
+ import { useManageStore as g } from "../stores/manage.js";
6
+ function v(e) {
7
+ const n = c("dux.manage");
8
+ if (e || (e = n?.value), !e)
9
9
  throw new Error("manage name is not defined");
10
- const { config: t } = P(e), s = (r) => `${t == null ? void 0 : t.routePrefix}/${f(r || "", "/")}`, p = (r, u) => {
11
- var n, c;
12
- const o = (n = t == null ? void 0 : t.dataProvider) == null ? void 0 : n[u || "default"];
13
- return ((c = o == null ? void 0 : o.apiUrl) == null ? void 0 : c.call(o, r, t == null ? void 0 : t.apiBasePath)) || "";
14
- }, h = x();
10
+ const { config: t } = g(e), i = (r) => `${t?.routePrefix}/${a(r || "", "/")}`, u = (r, o) => t?.dataProvider?.[o || "default"]?.apiUrl?.(r, t?.apiBasePath) || "", f = s();
15
11
  return {
16
12
  config: t,
17
- getRoutePath: s,
18
- getApiUrl: p,
13
+ getRoutePath: i,
14
+ getApiUrl: u,
19
15
  getPath: () => {
20
- const r = h.path, u = (t == null ? void 0 : t.routePrefix) || "";
21
- return f(r.replace(u, ""), "/");
16
+ const r = f.path, o = t?.routePrefix || "";
17
+ return a(r.replace(o, ""), "/");
22
18
  }
23
19
  };
24
20
  }
25
21
  export {
26
- $ as useManage
22
+ v as useManage
27
23
  };
@@ -1,75 +1,62 @@
1
- import { cloneDeep as S } from "lodash-es";
2
- import { storeToRefs as q } from "pinia";
3
- import { computed as v, ref as K, watch as h } from "vue";
4
- import { useRoute as z } from "vue-router";
5
- import { useRouteStore as B } from "../stores/route.js";
1
+ import { cloneDeep as p } from "lodash-es";
2
+ import { storeToRefs as R } from "pinia";
3
+ import { computed as l, ref as f, watch as y } from "vue";
4
+ import { useRoute as S } from "vue-router";
5
+ import { useRouteStore as A } from "../stores/route.js";
6
6
  import "../utils/bus.js";
7
- import { arrayToTree as A, searchTree as M } from "../utils/tree.js";
8
- function O(n) {
9
- const D = B(), { routes: L } = q(D), y = (e = !0) => {
10
- var t;
11
- return (t = S(L.value)) == null ? void 0 : t.filter((a) => !!(a != null && a.name)).filter((a) => !e || a.hidden === void 0 || a.hidden === !1);
12
- }, b = v(() => {
13
- const e = y(!1);
14
- return A(e, {
7
+ import { arrayToTree as K, searchTree as c } from "../utils/tree.js";
8
+ function C(t) {
9
+ const g = A(), { routes: x } = R(g), v = (e = !0) => p(x.value)?.filter((n) => !!n?.name).filter((n) => !e || n.hidden === void 0 || n.hidden === !1), d = l(() => {
10
+ const e = v(!1);
11
+ return K(e, {
15
12
  idKey: "name",
16
13
  parentKey: "parent",
17
14
  childrenKey: "children",
18
15
  sortKey: "sort"
19
16
  }, void 0);
20
- }), c = v(() => {
21
- const e = y();
22
- return A(e, {
17
+ }), a = l(() => {
18
+ const e = v();
19
+ return K(e, {
23
20
  idKey: "name",
24
21
  parentKey: "parent",
25
22
  childrenKey: "children",
26
23
  sortKey: "sort"
27
24
  }, void 0);
28
- }), i = z(), g = K(i.name), r = K(i.name), o = K(i.name), k = v(() => {
29
- if (n != null && n.doubleMenu)
30
- return c.value;
31
- const e = S(c.value);
32
- return e == null ? void 0 : e.map((t) => (delete t.children, t));
33
- }), x = v(() => {
34
- var t, a;
35
- return n != null && n.doubleMenu ? [] : ((a = (t = c.value) == null ? void 0 : t.find((d) => d.name === r.value)) == null ? void 0 : a.children) || [];
36
- }), w = v(() => M(b.value, (t) => (t == null ? void 0 : t.name) === i.name));
37
- h(() => n == null ? void 0 : n.doubleMenu, () => {
38
- var e, t, a, d;
39
- if (n != null && n.doubleMenu) {
40
- const u = M(c.value, (l) => (l == null ? void 0 : l.name) === r.value);
41
- r.value = (a = u == null ? void 0 : u[0]) == null ? void 0 : a.name, o.value = (d = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : d.name;
25
+ }), r = S(), h = f(r.name), u = f(r.name), o = f(r.name), L = l(() => t?.doubleMenu ? a.value : p(a.value)?.map((n) => (delete n.children, n))), b = l(() => t?.doubleMenu ? [] : a.value?.find((n) => n.name === u.value)?.children || []), T = l(() => c(d.value, (n) => n?.name === r.name));
26
+ y(() => t?.doubleMenu, () => {
27
+ if (t?.doubleMenu) {
28
+ const e = c(a.value, (n) => n?.name === u.value);
29
+ u.value = e?.[0]?.name, o.value = e?.[e.length - 1]?.name;
42
30
  } else {
43
- const u = M(c.value, (l) => (l == null ? void 0 : l.name) === o.value);
44
- r.value = (e = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : e.name, o.value = (t = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : t.name;
31
+ const e = c(a.value, (n) => n?.name === o.value);
32
+ u.value = e?.[e.length - 1]?.name, o.value = e?.[e.length - 1]?.name;
45
33
  }
46
34
  }, { immediate: !0 });
47
- const j = v(() => n != null && n.doubleMenu ? (n == null ? void 0 : n.doubleMenu) || x.value.length > 0 : !0);
48
- return h([i, b, () => n == null ? void 0 : n.doubleMenu], () => {
49
- var d, u, l, T, I;
50
- const e = M(b.value, (m) => m.name === i.name), a = ((m) => {
51
- let R = -1;
52
- for (let f = m.length - 1; f >= 0; f--)
53
- if (m[f].hidden === !1 || m[f].hidden === void 0) {
54
- R = f;
35
+ const I = l(() => t?.doubleMenu ? t?.doubleMenu || b.value.length > 0 : !0);
36
+ return y([r, d, () => t?.doubleMenu], () => {
37
+ const e = c(d.value, (i) => i.name === r.name), m = ((i) => {
38
+ let M = -1;
39
+ for (let s = i.length - 1; s >= 0; s--)
40
+ if (i[s].hidden === !1 || i[s].hidden === void 0) {
41
+ M = s;
55
42
  break;
56
43
  }
57
- return R;
44
+ return M;
58
45
  })(e);
59
- g.value = (d = e == null ? void 0 : e[a]) == null ? void 0 : d.name, n != null && n.doubleMenu ? (r.value = (u = e == null ? void 0 : e[a]) == null ? void 0 : u.name, o.value = (l = e == null ? void 0 : e[a]) == null ? void 0 : l.name) : (r.value = (T = e == null ? void 0 : e[0]) == null ? void 0 : T.name, o.value = (I = e == null ? void 0 : e[a]) == null ? void 0 : I.name);
46
+ h.value = e?.[m]?.name, t?.doubleMenu ? (u.value = e?.[m]?.name, o.value = e?.[m]?.name) : (u.value = e?.[0]?.name, o.value = e?.[m]?.name);
60
47
  }, { immediate: !0 }), {
61
- data: c,
62
- originalData: b,
63
- getMenu: y,
64
- mainMenu: k,
65
- subMenu: x,
66
- isSubMenu: j,
67
- crumbs: w,
68
- active: g,
69
- appActive: r,
48
+ data: a,
49
+ originalData: d,
50
+ getMenu: v,
51
+ mainMenu: L,
52
+ subMenu: b,
53
+ isSubMenu: I,
54
+ crumbs: T,
55
+ active: h,
56
+ appActive: u,
70
57
  subActive: o
71
58
  };
72
59
  }
73
60
  export {
74
- O as useMenu
61
+ C as useMenu
75
62
  };
@@ -1,15 +1,15 @@
1
- import { debounce as k, isArray as A } from "lodash-es";
2
- import { ref as u, computed as c, watch as E } from "vue";
3
- import { useList as L, useMany as O } from "./data.js";
4
- function D(t) {
1
+ import { debounce as N, isArray as k } from "lodash-es";
2
+ import { ref as u, computed as i, watch as A } from "vue";
3
+ import { useList as E, useMany as L } from "./data.js";
4
+ function z(t) {
5
5
  const r = u(), s = u({
6
6
  page: 1,
7
7
  pageSize: typeof t.pagination == "number" ? t.pagination : t.pagination ? 20 : 0
8
- }), d = u(!1), h = k((e) => {
8
+ }), c = u(!1), y = N((e) => {
9
9
  r.value = e;
10
- }, t.debounce || 300), V = (e) => {
11
- h(e);
12
- }, { data: f, isLoading: b, total: w, pageCount: S } = L({
10
+ }, t.debounce || 300), h = (e) => {
11
+ y(e);
12
+ }, { data: d, isLoading: V, total: b, pageCount: w } = E({
13
13
  get path() {
14
14
  return t.path || "";
15
15
  },
@@ -23,65 +23,60 @@ function D(t) {
23
23
  get providerName() {
24
24
  return t.providerName;
25
25
  }
26
- }), g = u([]), v = (e) => {
26
+ }), f = u([]), g = (e) => {
27
27
  const a = t.optionField || t.optionValue;
28
28
  return typeof a == "string" ? e[a] || e.value || e.id : typeof a == "function" ? a(e) : e.value || e.id;
29
- }, x = (e) => {
30
- const { optionLabel: a = "label", optionValue: o = "value" } = t;
31
- let l;
32
- typeof a == "function" ? l = a(e) : typeof a == "string" ? l = e[a] || e.label || e.name || e.title || String(e.value || e.id || "") : l = e.label || e.name || e.title || String(e.value || e.id || "");
29
+ }, S = (e) => {
30
+ const { optionLabel: a = "label", optionValue: l = "value" } = t;
33
31
  let n;
34
- return typeof o == "function" ? n = o(e) : typeof o == "string" ? n = e[o] || e.value || e.id : n = e.value || e.id, {
35
- label: l,
36
- value: n,
32
+ typeof a == "function" ? n = a(e) : typeof a == "string" ? n = e[a] || e.label || e.name || e.title || String(e.value || e.id || "") : n = e.label || e.name || e.title || String(e.value || e.id || "");
33
+ let o;
34
+ return typeof l == "function" ? o = l(e) : typeof l == "string" ? o = e[l] || e.value || e.id : o = e.value || e.id, {
35
+ label: n,
36
+ value: o,
37
37
  raw: e
38
38
  };
39
- }, y = c(() => {
40
- var o;
41
- const e = ((o = f.value) == null ? void 0 : o.data) || [], a = [...g.value];
39
+ }, v = i(() => {
40
+ const e = d.value?.data || [], a = [...f.value];
42
41
  return e.forEach((l) => {
43
42
  a.some(
44
- (i) => v(i) === v(l)
43
+ (o) => g(o) === g(l)
45
44
  ) || a.push(l);
46
- }), a.map((l) => x(l));
47
- }), p = c(() => {
48
- var e;
49
- return ((e = f.value) == null ? void 0 : e.meta) || {};
50
- }), { refetch: F } = O({
45
+ }), a.map((l) => S(l));
46
+ }), x = i(() => d.value?.meta || {}), { refetch: p } = L({
51
47
  get path() {
52
48
  return t.path || "";
53
49
  },
54
50
  get ids() {
55
- return t.defaultValue ? A(t.defaultValue) ? t.defaultValue : [t.defaultValue] : [];
51
+ return t.defaultValue ? k(t.defaultValue) ? t.defaultValue : [t.defaultValue] : [];
56
52
  },
57
53
  options: {
58
54
  enabled: !1
59
55
  },
60
56
  providerName: t.providerName
61
57
  });
62
- E(() => t.defaultValue, async (e) => {
63
- var l;
64
- if (!(d.value || !e || (d.value = !0, (Array.isArray(e) ? e : [e]).every(
65
- (n) => y.value.some((i) => i.value === n)
58
+ A(() => t.defaultValue, async (e) => {
59
+ if (!(c.value || !e || (c.value = !0, (Array.isArray(e) ? e : [e]).every(
60
+ (n) => v.value.some((o) => o.value === n)
66
61
  ))))
67
62
  try {
68
- const n = await F();
69
- g.value = ((l = n == null ? void 0 : n.data) == null ? void 0 : l.data) || [];
63
+ const n = await p();
64
+ f.value = n?.data?.data || [];
70
65
  } catch (n) {
71
66
  console.warn("Failed to fetch selected items:", n);
72
67
  }
73
68
  }, { immediate: !0 });
74
- const N = c(() => b.value);
69
+ const F = i(() => V.value);
75
70
  return {
76
- onSearch: V,
77
- options: y,
78
- meta: p,
79
- loading: N,
71
+ onSearch: h,
72
+ options: v,
73
+ meta: x,
74
+ loading: F,
80
75
  pagination: s,
81
- total: w,
82
- pageCount: S
76
+ total: b,
77
+ pageCount: w
83
78
  };
84
79
  }
85
80
  export {
86
- D as useSelect
81
+ z as useSelect
87
82
  };