@dazhicheng/ui 1.6.10 → 1.6.12

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 (86) hide show
  1. package/dist/components/tt-form/src/useFormContext.js +1 -1
  2. package/dist/components/tt-table/index.js +4 -5
  3. package/dist/components/tt-table/src/TableForm.vue.js +2 -3
  4. package/dist/hooks/useBasicDataOptions.js +111 -96
  5. package/dist/hooks/useDataPermissionOptions.js +83 -85
  6. package/dist/hooks/useOwnerRoutePath.d.ts +5 -0
  7. package/dist/hooks/useOwnerRoutePath.js +7 -0
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.js +115 -129
  10. package/dist/packages/utils/src/is.js +37 -46
  11. package/dist/style.css +1 -1
  12. package/package.json +1 -1
  13. package/dist/components/tt-vtable/index.js +0 -54
  14. package/dist/components/tt-vtable/src/components/TtVTable.vue.d.ts +0 -188
  15. package/dist/components/tt-vtable/src/components/TtVTable.vue.js +0 -227
  16. package/dist/components/tt-vtable/src/components/TtVTable.vue2.js +0 -4
  17. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.d.ts +0 -32
  18. package/dist/components/tt-vtable/src/components/TtVTableForm.vue.js +0 -121
  19. package/dist/components/tt-vtable/src/components/TtVTableForm.vue2.js +0 -4
  20. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.d.ts +0 -64
  21. package/dist/components/tt-vtable/src/components/VTableEmpty.vue.js +0 -97
  22. package/dist/components/tt-vtable/src/components/VTableEmpty.vue2.js +0 -4
  23. package/dist/components/tt-vtable/src/components/VTablePagination.vue.d.ts +0 -53
  24. package/dist/components/tt-vtable/src/components/VTablePagination.vue.js +0 -52
  25. package/dist/components/tt-vtable/src/components/VTablePagination.vue2.js +0 -4
  26. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.d.ts +0 -35
  27. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.js +0 -50
  28. package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue2.js +0 -4
  29. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.d.ts +0 -63
  30. package/dist/components/tt-vtable/src/components/VTableToolbar.vue.js +0 -126
  31. package/dist/components/tt-vtable/src/components/VTableToolbar.vue2.js +0 -4
  32. package/dist/components/tt-vtable/src/components/VTableViewport.vue.js +0 -133
  33. package/dist/components/tt-vtable/src/components/VTableViewport.vue2.js +0 -4
  34. package/dist/components/tt-vtable/src/composables/useVTable.d.ts +0 -41
  35. package/dist/components/tt-vtable/src/composables/useVTable.js +0 -25
  36. package/dist/components/tt-vtable/src/composables/useVTableFormRender.d.ts +0 -13
  37. package/dist/components/tt-vtable/src/composables/useVTableFormRender.js +0 -92
  38. package/dist/components/tt-vtable/src/composables/useVTableRender.d.ts +0 -13
  39. package/dist/components/tt-vtable/src/composables/useVTableRender.js +0 -13
  40. package/dist/components/tt-vtable/src/engine/visactor/createListTable.d.ts +0 -10
  41. package/dist/components/tt-vtable/src/engine/visactor/createListTable.js +0 -63
  42. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.d.ts +0 -37
  43. package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.js +0 -133
  44. package/dist/components/tt-vtable/src/engine/visactor/index.d.ts +0 -8
  45. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.d.ts +0 -23
  46. package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.js +0 -70
  47. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.d.ts +0 -38
  48. package/dist/components/tt-vtable/src/engine/visactor/record-adapter.js +0 -41
  49. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.d.ts +0 -45
  50. package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.js +0 -73
  51. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.d.ts +0 -25
  52. package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.js +0 -25
  53. package/dist/components/tt-vtable/src/engine/visactor/types.d.ts +0 -29
  54. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts +0 -5
  55. package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js +0 -52
  56. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.d.ts +0 -74
  57. package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.js +0 -232
  58. package/dist/components/tt-vtable/src/features/editing/useCellEditing.d.ts +0 -48
  59. package/dist/components/tt-vtable/src/features/editing/useCellEditing.js +0 -102
  60. package/dist/components/tt-vtable/src/features/form-integration/useVTableForm.d.ts +0 -51
  61. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.d.ts +0 -40
  62. package/dist/components/tt-vtable/src/features/pagination/useTablePagination.js +0 -51
  63. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.d.ts +0 -38
  64. package/dist/components/tt-vtable/src/features/querying/useRecordQuery.js +0 -57
  65. package/dist/components/tt-vtable/src/features/records/index.d.ts +0 -3
  66. package/dist/components/tt-vtable/src/features/records/record-index.d.ts +0 -122
  67. package/dist/components/tt-vtable/src/features/records/record-index.js +0 -209
  68. package/dist/components/tt-vtable/src/features/records/useRecordSource.d.ts +0 -41
  69. package/dist/components/tt-vtable/src/features/records/useRecordSource.js +0 -249
  70. package/dist/components/tt-vtable/src/features/selection/useRowSelection.d.ts +0 -65
  71. package/dist/components/tt-vtable/src/features/selection/useRowSelection.js +0 -129
  72. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.d.ts +0 -60
  73. package/dist/components/tt-vtable/src/features/tree/useTreeRecords.js +0 -125
  74. package/dist/components/tt-vtable/src/public/column-preferences.d.ts +0 -32
  75. package/dist/components/tt-vtable/src/public/index.d.ts +0 -8
  76. package/dist/components/tt-vtable/src/public/table-api.d.ts +0 -215
  77. package/dist/components/tt-vtable/src/public/table-column.d.ts +0 -123
  78. package/dist/components/tt-vtable/src/public/table-errors.d.ts +0 -26
  79. package/dist/components/tt-vtable/src/public/table-errors.js +0 -26
  80. package/dist/components/tt-vtable/src/public/table-events.d.ts +0 -69
  81. package/dist/components/tt-vtable/src/public/table-props.d.ts +0 -216
  82. package/dist/components/tt-vtable/src/public/table-slots.d.ts +0 -37
  83. package/dist/components/tt-vtable/src/runtime/createVTableController.d.ts +0 -12
  84. package/dist/components/tt-vtable/src/runtime/createVTableController.js +0 -238
  85. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.d.ts +0 -79
  86. package/dist/components/tt-vtable/src/runtime/createVTableRuntime.js +0 -380
@@ -13,7 +13,7 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.j
13
13
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
14
14
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
15
  import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
- import { get as R, has as C, cloneDeep as v } from "lodash-es";
16
+ import { get as R, cloneDeep as v, has as C } from "lodash-es";
17
17
  import { childArrayPath as w, normalizeArrayFieldPath as h } from "./utils/array-path.js";
18
18
  import { set as g } from "es-toolkit/compat";
19
19
  import { createContext as x } from "./shared/createContext.js";
@@ -54,7 +54,6 @@ import "../tt-drawer/index.js";
54
54
  import "../tt-modal/index.js";
55
55
  import "../../directives/disabled-tip/index.js";
56
56
  import "../tt-log/index.js";
57
- import "../tt-vtable/index.js";
58
57
  /* empty css */
59
58
  /* empty css */
60
59
  /* empty css */
@@ -69,9 +68,9 @@ import "./src/emits.js";
69
68
  import "./src/props.js";
70
69
  import "./src/table-mutation-events.js";
71
70
  import "./src/utils/context.js";
72
- const At = t(o), Ct = t(r), It = t(m);
71
+ const xt = t(o), At = t(r), Ct = t(m);
73
72
  export {
74
- It as TtTable,
75
- At as TtTableAction,
76
- Ct as TtTableButton
73
+ Ct as TtTable,
74
+ xt as TtTableAction,
75
+ At as TtTableButton
77
76
  };
@@ -52,7 +52,6 @@ import "../../tt-text/index.js";
52
52
  import "../../../directives/disabled-tip/index.js";
53
53
  import { GlobalConfig as Qe } from "../../../hooks/useSetup.js";
54
54
  import "../../tt-log/index.js";
55
- import "../../tt-vtable/index.js";
56
55
  /* empty css */
57
56
  /* empty css */
58
57
  /* empty css */
@@ -77,7 +76,7 @@ import it from "./Table.vue.js";
77
76
  import { forwardedEventEntries as st } from "./table-mutation-events.js";
78
77
  import { TableFormApi as at } from "./utils/table-form-api.js";
79
78
  import { provideFormActionTestIds as nt } from "./utils/context.js";
80
- const lt = ["data-testid"], mt = ["data-testid"], Ko = /* @__PURE__ */ _e({
79
+ const lt = ["data-testid"], mt = ["data-testid"], Vo = /* @__PURE__ */ _e({
81
80
  name: "TtTableForm",
82
81
  __name: "TableForm",
83
82
  props: rt,
@@ -376,5 +375,5 @@ const lt = ["data-testid"], mt = ["data-testid"], Ko = /* @__PURE__ */ _e({
376
375
  }
377
376
  });
378
377
  export {
379
- Ko as default
378
+ Vo as default
380
379
  };
@@ -1,147 +1,162 @@
1
- import { ref as A, watchEffect as M, unref as C, watch as _, computed as F } from "vue";
2
- import { useRoute as K } from "vue-router";
3
- import { GEO_LEVEL_CODES as E, canDeriveGeoLevel as R, deriveRegionLevelOptionsFromGeoSource as T, resolveHighestGeoLevelCode as L, isGeoLevelCode as G, CODE_REGISTRY as V } from "./basicDataCodes.js";
4
- const o = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
5
- function v(t) {
6
- return Array.isArray(t) ? t : [];
1
+ import { ref as j, watchEffect as B, unref as q, computed as H } from "vue";
2
+ import { useRoute as I } from "vue-router";
3
+ import { useOwnerRoutePath as Y } from "./useOwnerRoutePath.js";
4
+ import { GEO_LEVEL_CODES as M, canDeriveGeoLevel as x, deriveRegionLevelOptionsFromGeoSource as k, resolveHighestGeoLevelCode as A, isGeoLevelCode as L, CODE_REGISTRY as J } from "./basicDataCodes.js";
5
+ const c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
6
+ function v(n) {
7
+ return Array.isArray(n) ? n : [];
7
8
  }
8
- function b(t) {
9
- return t.reduce((n, l) => (n[l] = [], n), {});
9
+ function N(n) {
10
+ return n.reduce((u, a) => (u[a] = [], u), {});
10
11
  }
11
- function O(t, n) {
12
- return Object.prototype.hasOwnProperty.call(t, n);
12
+ function w(n, u) {
13
+ return Object.prototype.hasOwnProperty.call(n, u);
13
14
  }
14
- function q(t) {
15
- return L(E.filter((n) => O(t, n)));
15
+ function F(n) {
16
+ return A(M.filter((u) => w(n, u)));
16
17
  }
17
- function y(t) {
18
- const n = q(t);
19
- if (!n) return t;
20
- const l = t[n];
21
- if (!Array.isArray(l)) return t;
22
- const u = { ...t };
23
- let d = !1;
24
- return E.forEach((i) => {
25
- R(n, i) && (O(u, i) || (u[i] = T(l, i), d = !0));
26
- }), d ? u : t;
18
+ function C(n) {
19
+ const u = F(n);
20
+ if (!u) return n;
21
+ const a = n[u];
22
+ if (!Array.isArray(a)) return n;
23
+ const h = { ...n };
24
+ let s = !1;
25
+ return M.forEach((f) => {
26
+ x(u, f) && (w(h, f) || (h[f] = k(a, f), s = !0));
27
+ }), s ? h : n;
27
28
  }
28
- function j(t, n) {
29
- const l = q(n), u = t.filter(G), d = l || L(u) || void 0;
30
- return d ? t.filter((i) => G(i) ? !(R(d, i) || i === d && O(n, d)) : !0) : t;
29
+ function Q(n, u) {
30
+ const a = F(u), h = n.filter(L), s = a || A(h) || void 0;
31
+ return s ? n.filter((f) => L(f) ? !(x(s, f) || f === s && w(u, s)) : !0) : n;
31
32
  }
32
- function k(t) {
33
- const n = K(), l = A({});
34
- function u(s = {}) {
35
- l.value = t.codes.reduce(
36
- (e, r) => (e[r] = v(s[r]), e),
33
+ function K(n) {
34
+ const u = I(), a = Y(), h = j({});
35
+ function s(t = {}) {
36
+ h.value = n.codes.reduce(
37
+ (e, r) => (e[r] = v(t[r]), e),
37
38
  {}
38
39
  );
39
40
  }
40
- u();
41
- async function d(s) {
42
- var h;
43
- const e = (h = n.meta) == null ? void 0 : h.permissionOnlyCode;
41
+ s();
42
+ function f(t) {
43
+ c.delete(t), y.delete(t);
44
+ }
45
+ function _(t) {
46
+ const e = m.get(t) || /* @__PURE__ */ new Set(), r = e.size;
47
+ n.codes.forEach((d) => e.add(d)), m.set(t, e), e.size !== r && (y.delete(t), E(t));
48
+ }
49
+ function z(t) {
50
+ s(c.get(t));
51
+ }
52
+ function E(t) {
53
+ const e = y.get(t);
54
+ if (e) return e;
55
+ const r = Promise.resolve().then(() => R());
56
+ return y.set(t, r), r.finally(() => {
57
+ y.get(t) === r && y.delete(t);
58
+ }), r;
59
+ }
60
+ async function T(t) {
61
+ var d;
62
+ const e = (d = u.meta) == null ? void 0 : d.permissionOnlyCode;
44
63
  return (await Promise.allSettled(
45
- s.map(async (c) => {
64
+ t.map(async (o) => {
46
65
  try {
47
- const p = await V[c].fetchOptions({ permissionOnlyCode: e });
48
- return [c, v(p)];
66
+ const g = await J[o].fetchOptions({ permissionOnlyCode: e });
67
+ return [o, v(g)];
49
68
  } catch {
50
- return [c, []];
69
+ return [o, []];
51
70
  }
52
71
  })
53
- )).reduce((c, f, p) => {
54
- const S = s[p];
55
- return f.status === "fulfilled" ? c[f.value[0]] = v(f.value[1]) : c[S] = [], c;
72
+ )).reduce((o, l, g) => {
73
+ const O = t[g];
74
+ return l.status === "fulfilled" ? o[l.value[0]] = v(l.value[1]) : o[O] = [], o;
56
75
  }, {});
57
76
  }
58
- async function i(s = !1) {
59
- const e = n.path;
77
+ async function R(t = !1) {
78
+ const e = a;
60
79
  let r = [];
61
80
  try {
62
- const h = C(t.dataSource);
63
- if (h) {
64
- let a = { ...o.get(e) || {}, ...h };
65
- a = y(a), o.set(e, a), u(a);
81
+ const d = q(n.dataSource);
82
+ if (d) {
83
+ let i = { ...c.get(e) || {}, ...d };
84
+ i = C(i), c.set(e, i), s(i);
66
85
  return;
67
86
  }
68
- let c = y(o.get(e) || {});
69
- if (c !== (o.get(e) || {}) && o.set(e, c), r = s ? [...t.codes] : t.codes.filter((a) => !O(c, a)), !r.length) {
70
- u(c);
87
+ let o = C(c.get(e) || {});
88
+ o !== (c.get(e) || {}) && c.set(e, o);
89
+ const l = [...m.get(e) || n.codes];
90
+ if (r = t ? l : l.filter((i) => !w(o, i)), !r.length) {
91
+ s(o);
71
92
  return;
72
93
  }
73
- const f = s ? void 0 : D.get(e);
74
- if (f)
94
+ const g = t ? void 0 : D.get(e);
95
+ if (g)
75
96
  try {
76
- const a = await f, g = y({
77
- ...o.get(e) || {},
78
- ...a
97
+ const i = await g, p = C({
98
+ ...c.get(e) || {},
99
+ ...i
79
100
  });
80
- if (o.set(e, g), r = t.codes.filter((P) => !O(g, P)), !r.length) {
81
- u(g);
101
+ if (c.set(e, p), r = l.filter((b) => !w(p, b)), !r.length) {
102
+ s(p);
82
103
  return;
83
104
  }
84
- c = g;
105
+ o = p;
85
106
  } catch {
86
107
  }
87
- const p = j(r, c);
88
- if (!p.length) {
89
- const a = y(c);
90
- o.set(e, a), u(a);
108
+ const O = Q(r, o);
109
+ if (!O.length) {
110
+ const i = C(o);
111
+ c.set(e, i), s(i);
91
112
  return;
92
113
  }
93
- const S = d(p), w = (m.get(e) || 0) + 1;
94
- m.set(e, w), D.set(e, S);
114
+ const G = T(O), P = (S.get(e) || 0) + 1;
115
+ S.set(e, P), D.set(e, G);
95
116
  try {
96
- const a = await S;
97
- if (m.get(e) !== w) return;
98
- let g = {
99
- ...o.get(e) || {},
100
- ...a
117
+ const i = await G;
118
+ if (S.get(e) !== P) return;
119
+ let p = {
120
+ ...c.get(e) || {},
121
+ ...i
101
122
  };
102
- g = y(g), o.set(e, g), u(g);
123
+ p = C(p), c.set(e, p), s(p);
103
124
  } finally {
104
- m.get(e) === w && D.delete(e);
125
+ S.get(e) === P && D.delete(e);
105
126
  }
106
127
  } catch {
107
- const h = b(r.length ? r : t.codes), f = { ...o.get(e) || {}, ...h };
108
- o.set(e, f), u(f);
128
+ const d = [...m.get(e) || n.codes], o = N(r.length ? r : d), g = { ...c.get(e) || {}, ...o };
129
+ c.set(e, g), s(g);
109
130
  }
110
131
  }
111
- async function x() {
112
- const s = n.path;
113
- D.clear(), o.clear(), m.clear(), o.delete(s), await i(!0);
132
+ async function V() {
133
+ const t = a, e = new Set(m.get(t) || n.codes);
134
+ D.clear(), y.clear(), c.clear(), m.clear(), S.clear(), m.set(t, e), f(t), await R(!0);
114
135
  }
115
- return M(() => {
116
- const s = C(t.dataSource);
117
- if (!s) return;
118
- const e = n.path;
119
- let r = { ...o.get(e) || {}, ...s };
120
- r = y(r), o.set(e, r), u(r);
121
- }), _(
122
- () => n.path,
123
- () => {
124
- i();
125
- },
126
- { immediate: !0 }
127
- ), {
128
- dataSource: F(() => {
129
- const s = t.codes.reduce(
130
- (e, r) => (e[r] = v(l.value[r]), e),
136
+ return B(() => {
137
+ const t = q(n.dataSource);
138
+ if (!t) return;
139
+ const e = a;
140
+ let r = { ...c.get(e) || {}, ...t };
141
+ r = C(r), c.set(e, r), s(r);
142
+ }), _(a), E(a).then(() => z(a)), R(), {
143
+ dataSource: H(() => {
144
+ const t = n.codes.reduce(
145
+ (e, r) => (e[r] = v(h.value[r]), e),
131
146
  {}
132
147
  );
133
- return new Proxy(s, {
148
+ return new Proxy(t, {
134
149
  get(e, r) {
135
- return typeof r != "string" ? [] : v(s[r]);
150
+ return typeof r != "string" ? [] : v(t[r]);
136
151
  },
137
152
  set() {
138
153
  return !1;
139
154
  }
140
155
  });
141
156
  }),
142
- reload: x
157
+ reload: V
143
158
  };
144
159
  }
145
160
  export {
146
- k as useBasicDataOptions
161
+ K as useBasicDataOptions
147
162
  };
@@ -1,9 +1,9 @@
1
- import { queryDataPermissionDetailDataTypeContext as V, pageUser as _ } from "../api/dataTypeContext.js";
2
- import { ref as j, watchEffect as F, unref as T, watch as k, computed as B } from "vue";
3
- import { useRoute as G } from "vue-router";
4
- const c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
5
- let v, m;
6
- const H = "all", J = { label: "全部", value: H }, Q = {
1
+ import { queryDataPermissionDetailDataTypeContext as _, pageUser as j } from "../api/dataTypeContext.js";
2
+ import { ref as k, watchEffect as B, unref as b, computed as F } from "vue";
3
+ import { useOwnerRoutePath as W } from "./useOwnerRoutePath.js";
4
+ const c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
5
+ let v, p;
6
+ const G = "all", H = { label: "全部", value: G }, U = /* @__PURE__ */ new WeakMap(), J = {
7
7
  platformId: ["platformName", "platformId"],
8
8
  shopId: ["shopName", "shopId"],
9
9
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
@@ -11,132 +11,130 @@ const H = "all", J = { label: "全部", value: H }, Q = {
11
11
  lockUserId: ["userName", "userId"],
12
12
  userId: ["fullName", "id"]
13
13
  };
14
- async function W() {
14
+ async function Q() {
15
15
  if (v) return v;
16
- if (m) return m;
17
- m = _({ pageNo: 1, pageSize: 9999 }).then((s) => {
18
- const o = s.records || [];
19
- return v = o, o;
16
+ if (p) return p;
17
+ p = j({ pageNo: 1, pageSize: 9999 }).then((n) => {
18
+ const s = n.records || [];
19
+ return v = s, s;
20
20
  });
21
21
  try {
22
- return await m;
22
+ return await p;
23
23
  } finally {
24
- m = void 0;
24
+ p = void 0;
25
25
  }
26
26
  }
27
- function K(s) {
28
- const o = G(), N = j({});
29
- function g(t = {}) {
30
- N.value = s.codes.reduce(
31
- (e, r) => {
32
- const [a, C] = Q[r], d = (t[r] || []).map((p) => {
33
- const u = r === "purchasePlaceId" ? p.purchaseInfo || {} : p;
34
- return {
35
- ...p,
36
- label: u == null ? void 0 : u[a],
37
- value: u == null ? void 0 : u[C]
38
- };
39
- });
40
- return e[r] = d, e;
41
- },
27
+ function X(n, s = []) {
28
+ const g = U.get(s) || /* @__PURE__ */ new Map(), u = g.get(n);
29
+ if (u) return u.slice();
30
+ const [S, q] = J[n], P = s.map((m) => {
31
+ const l = n === "purchasePlaceId" ? m.purchaseInfo || {} : m;
32
+ return {
33
+ ...m,
34
+ label: l == null ? void 0 : l[S],
35
+ value: l == null ? void 0 : l[q]
36
+ };
37
+ });
38
+ return g.set(n, P), U.set(s, g), P.slice();
39
+ }
40
+ function ee(n) {
41
+ const s = W(), g = k({});
42
+ function u(t = {}) {
43
+ g.value = n.codes.reduce(
44
+ (e, r) => (e[r] = X(r, t[r]), e),
42
45
  {}
43
46
  );
44
47
  }
45
- function L(t) {
48
+ function S(t) {
46
49
  var e;
47
- return typeof s.showAll == "boolean" ? s.showAll : ((e = s.showAll) == null ? void 0 : e[t]) ?? !1;
50
+ return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
48
51
  }
49
- function U() {
50
- P.clear(), h.clear(), c.clear(), f.clear(), w.clear(), v = void 0, m = void 0;
52
+ function q() {
53
+ I.clear(), h.clear(), c.clear(), f.clear(), w.clear(), v = void 0, p = void 0;
51
54
  }
52
- function b(t) {
55
+ function P(t) {
53
56
  c.delete(t), f.delete(t), h.delete(t);
54
57
  }
55
- function O(t) {
58
+ function m(t) {
56
59
  const e = f.get(t) || /* @__PURE__ */ new Set(), r = e.size;
57
- s.codes.forEach((a) => e.add(a)), f.set(t, e), e.size !== r && (h.delete(t), y(t));
60
+ n.codes.forEach((o) => e.add(o)), f.set(t, e), e.size !== r && (h.delete(t), M(t));
58
61
  }
59
- async function A(t = !1) {
60
- const e = o.path, r = T(s.dataSource);
62
+ async function l(t = !1) {
63
+ const e = s, r = b(n.dataSource);
61
64
  if (r) {
62
65
  const i = { ...c.get(e) || {}, ...r };
63
- c.set(e, i), g(i);
66
+ c.set(e, i), u(i);
64
67
  return;
65
68
  }
66
- const a = c.get(e) || {}, C = [...f.get(e) || s.codes];
67
- let d = t ? C : C.filter((n) => !Object.prototype.hasOwnProperty.call(a, n));
68
- if (!d.length) {
69
- g(a);
69
+ const o = c.get(e) || {}, O = [...f.get(e) || n.codes];
70
+ let C = t ? O : O.filter((a) => !Object.prototype.hasOwnProperty.call(o, a));
71
+ if (!C.length) {
72
+ u(o);
70
73
  return;
71
74
  }
72
- const p = t ? void 0 : P.get(e);
73
- if (p) {
74
- const n = await p, l = { ...c.get(e) || {}, ...n };
75
- if (c.set(e, l), d = C.filter((D) => !Object.prototype.hasOwnProperty.call(l, D)), !d.length) {
76
- g(l);
75
+ const R = t ? void 0 : I.get(e);
76
+ if (R) {
77
+ const a = await R, d = { ...c.get(e) || {}, ...a };
78
+ if (c.set(e, d), C = O.filter((y) => !Object.prototype.hasOwnProperty.call(d, y)), !C.length) {
79
+ u(d);
77
80
  return;
78
81
  }
79
82
  }
80
- const u = d.filter((n) => n !== "userId"), E = d.includes("userId"), x = Promise.allSettled([
81
- u.length ? V({ dataTypeName: u }).then(
82
- (n) => n
83
+ const x = C.filter((a) => a !== "userId"), V = C.includes("userId"), L = Promise.allSettled([
84
+ x.length ? _({ dataTypeName: x }).then(
85
+ (a) => a
83
86
  ) : Promise.resolve([]),
84
- E ? W() : Promise.resolve(void 0)
85
- ]).then(([n, i]) => {
86
- const l = n.status === "fulfilled" ? n.value : [], D = i.status === "fulfilled" ? i.value : void 0;
87
+ V ? Q() : Promise.resolve(void 0)
88
+ ]).then(([a, i]) => {
89
+ const d = a.status === "fulfilled" ? a.value : [], y = i.status === "fulfilled" ? i.value : void 0;
87
90
  return {
88
- ...D ? { userId: D } : {},
89
- ...l.reduce((q, I) => {
90
- const M = I == null ? void 0 : I.dataTypeCode;
91
- return M && (q[M] = I.originalItems || []), q;
91
+ ...y ? { userId: y } : {},
92
+ ...d.reduce((A, D) => {
93
+ const T = D == null ? void 0 : D.dataTypeCode;
94
+ return T && (A[T] = D.originalItems || []), A;
92
95
  }, {})
93
96
  };
94
- }), S = (w.get(e) || 0) + 1;
95
- w.set(e, S), P.set(e, x);
97
+ }), N = (w.get(e) || 0) + 1;
98
+ w.set(e, N), I.set(e, L);
96
99
  try {
97
- const n = await x;
98
- if (w.get(e) !== S) return;
99
- const l = { ...c.get(e) || {}, ...n };
100
- c.set(e, l), g(l);
100
+ const a = await L;
101
+ if (w.get(e) !== N) return;
102
+ const d = { ...c.get(e) || {}, ...a };
103
+ c.set(e, d), u(d);
101
104
  } finally {
102
- w.get(e) === S && P.delete(e);
105
+ w.get(e) === N && I.delete(e);
103
106
  }
104
107
  }
105
108
  async function z() {
106
- const t = o.path, e = new Set(f.get(t) || s.codes);
107
- U(), f.set(t, e), b(t), await A(!0);
109
+ const t = s, e = new Set(f.get(t) || n.codes);
110
+ q(), f.set(t, e), P(t), await l(!0);
108
111
  }
109
- function y(t) {
112
+ function M(t) {
110
113
  const e = h.get(t);
111
114
  if (e) return e;
112
- const r = Promise.resolve().then(() => A());
115
+ const r = Promise.resolve().then(() => l());
113
116
  return h.set(t, r), r.finally(() => {
114
117
  h.get(t) === r && h.delete(t);
115
118
  }), r;
116
119
  }
117
- F(() => {
118
- const t = T(s.dataSource);
120
+ B(() => {
121
+ const t = b(n.dataSource);
119
122
  if (!t) return;
120
- const e = o.path, a = { ...c.get(e) || {}, ...t };
121
- c.set(e, a), g(a);
123
+ const e = s, o = { ...c.get(e) || {}, ...t };
124
+ c.set(e, o), u(o);
122
125
  });
123
- function R(t) {
124
- g(c.get(t));
126
+ function E(t) {
127
+ u(c.get(t));
125
128
  }
126
- return O(o.path), y(o.path).then(() => R(o.path)), k(
127
- () => o.path,
128
- (t) => {
129
- O(t), y(t).then(() => R(t));
130
- }
131
- ), {
129
+ return m(s), M(s).then(() => E(s)), {
132
130
  /**
133
131
  * 数据源
134
132
  */
135
- dataSource: B(() => {
136
- const t = s.codes.reduce(
133
+ dataSource: F(() => {
134
+ const t = n.codes.reduce(
137
135
  (e, r) => {
138
- const a = N.value[r] || [];
139
- return e[r] = L(r) ? [J, ...a] : a, e;
136
+ const o = g.value[r] || [];
137
+ return e[r] = S(r) ? [H, ...o] : o, e;
140
138
  },
141
139
  {}
142
140
  );
@@ -156,5 +154,5 @@ function K(s) {
156
154
  };
157
155
  }
158
156
  export {
159
- K as useDataPermissionOptions
157
+ ee as useDataPermissionOptions
160
158
  };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 获取实例初始化时的路由路径,作为 KeepAlive 数据缓存键。
3
+ * @returns 实例归属的路由路径
4
+ */
5
+ export declare function useOwnerRoutePath(): string;
@@ -0,0 +1,7 @@
1
+ import { useRoute as t } from "vue-router";
2
+ function o() {
3
+ return t().path;
4
+ }
5
+ export {
6
+ o as useOwnerRoutePath
7
+ };
package/dist/index.d.ts CHANGED
@@ -16,7 +16,6 @@ export * from './components/tt-modal-form';
16
16
  export * from './components/tt-image';
17
17
  export * from './components/tt-loading';
18
18
  export * from './components/tt-table';
19
- export * from './components/tt-vtable';
20
19
  export * from './components/tt-upload';
21
20
  export * from './components/tt-nav-anchor';
22
21
  export * from './components/tt-api-component';