@dazhicheng/ui 1.6.11 → 1.6.13

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.
@@ -1,166 +1,157 @@
1
- import { ref as b, watchEffect as j, unref as L, watch as B, computed as H } from "vue";
2
- import { useRoute as I } from "vue-router";
3
- import { GEO_LEVEL_CODES as x, canDeriveGeoLevel as A, deriveRegionLevelOptionsFromGeoSource as Y, resolveHighestGeoLevelCode as F, isGeoLevelCode as M, CODE_REGISTRY as k } from "./basicDataCodes.js";
4
- const c = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
5
- function y(n) {
6
- return Array.isArray(n) ? n : [];
1
+ import { ref as b, watchEffect as j, unref as q, computed as B } from "vue";
2
+ import { useRoute as H } from "vue-router";
3
+ import { useOwnerRoutePath as I } from "./useOwnerRoutePath.js";
4
+ import { GEO_LEVEL_CODES as M, canDeriveGeoLevel as x, deriveRegionLevelOptionsFromGeoSource as Y, resolveHighestGeoLevelCode as A, isGeoLevelCode as L, CODE_REGISTRY as k } from "./basicDataCodes.js";
5
+ const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
6
+ function C(r) {
7
+ return Array.isArray(r) ? r : [];
7
8
  }
8
- function J(n) {
9
- return n.reduce((s, f) => (s[f] = [], s), {});
9
+ function J(r) {
10
+ return r.reduce((c, a) => (c[a] = [], c), {});
10
11
  }
11
- function w(n, s) {
12
- return Object.prototype.hasOwnProperty.call(n, s);
12
+ function D(r, c) {
13
+ return Object.prototype.hasOwnProperty.call(r, c);
13
14
  }
14
- function _(n) {
15
- return F(x.filter((s) => w(n, s)));
15
+ function F(r) {
16
+ return A(M.filter((c) => D(r, c)));
16
17
  }
17
- function S(n) {
18
- const s = _(n);
19
- if (!s) return n;
20
- const f = n[s];
21
- if (!Array.isArray(f)) return n;
22
- const u = { ...n };
23
- let d = !1;
24
- return x.forEach((i) => {
25
- A(s, i) && (w(u, i) || (u[i] = Y(f, i), d = !0));
26
- }), d ? u : n;
18
+ function S(r) {
19
+ const c = F(r);
20
+ if (!c) return r;
21
+ const a = r[c];
22
+ if (!Array.isArray(a)) return r;
23
+ const d = { ...r };
24
+ let o = !1;
25
+ return M.forEach((f) => {
26
+ x(c, f) && (D(d, f) || (d[f] = Y(a, f), o = !0));
27
+ }), o ? d : r;
27
28
  }
28
- function N(n, s) {
29
- const f = _(s), u = n.filter(M), d = f || F(u) || void 0;
30
- return d ? n.filter((i) => M(i) ? !(A(d, i) || i === d && w(s, d)) : !0) : n;
29
+ function N(r, c) {
30
+ const a = F(c), d = r.filter(L), o = a || A(d) || void 0;
31
+ return o ? r.filter((f) => L(f) ? !(x(o, f) || f === o && D(c, o)) : !0) : r;
31
32
  }
32
- function Z(n) {
33
- const s = I(), f = b({});
34
- function u(t = {}) {
35
- f.value = n.codes.reduce(
36
- (e, r) => (e[r] = y(t[r]), e),
33
+ function $(r) {
34
+ const c = H(), a = I(), d = b({});
35
+ function o(t = {}) {
36
+ d.value = r.codes.reduce(
37
+ (e, n) => (e[n] = C(t[n]), e),
37
38
  {}
38
39
  );
39
40
  }
40
- u();
41
- function d(t) {
42
- c.delete(t), m.delete(t);
41
+ o();
42
+ function f(t) {
43
+ u.delete(t), y.delete(t);
43
44
  }
44
- function i(t) {
45
- const e = C.get(t) || /* @__PURE__ */ new Set(), r = e.size;
46
- n.codes.forEach((l) => e.add(l)), C.set(t, e), e.size !== r && (m.delete(t), R(t));
45
+ function _(t) {
46
+ const e = g.get(t) || /* @__PURE__ */ new Set(), n = e.size;
47
+ r.codes.forEach((s) => e.add(s)), g.set(t, e), e.size !== n && P(t);
47
48
  }
48
- function G(t) {
49
- u(c.get(t));
49
+ function z(t) {
50
+ o(u.get(t));
50
51
  }
51
- function R(t) {
52
- const e = m.get(t);
52
+ function P(t) {
53
+ const e = y.get(t);
53
54
  if (e) return e;
54
- const r = Promise.resolve().then(() => q());
55
- return m.set(t, r), r.finally(() => {
56
- m.get(t) === r && m.delete(t);
57
- }), r;
55
+ const n = Promise.resolve().then(() => E());
56
+ return y.set(t, n), n.finally(() => {
57
+ y.get(t) === n && y.delete(t);
58
+ }), n;
58
59
  }
59
- async function z(t) {
60
- var l;
61
- const e = (l = s.meta) == null ? void 0 : l.permissionOnlyCode;
60
+ async function T(t) {
61
+ var s;
62
+ const e = (s = c.meta) == null ? void 0 : s.permissionOnlyCode;
62
63
  return (await Promise.allSettled(
63
- t.map(async (o) => {
64
+ t.map(async (i) => {
64
65
  try {
65
- const p = await k[o].fetchOptions({ permissionOnlyCode: e });
66
- return [o, y(p)];
66
+ const h = await k[i].fetchOptions({ permissionOnlyCode: e });
67
+ return [i, C(h)];
67
68
  } catch {
68
- return [o, []];
69
+ return [i, []];
69
70
  }
70
71
  })
71
- )).reduce((o, g, p) => {
72
- const D = t[p];
73
- return g.status === "fulfilled" ? o[g.value[0]] = y(g.value[1]) : o[D] = [], o;
72
+ )).reduce((i, l, h) => {
73
+ const w = t[h];
74
+ return l.status === "fulfilled" ? i[l.value[0]] = C(l.value[1]) : i[w] = [], i;
74
75
  }, {});
75
76
  }
76
- async function q(t = !1) {
77
- const e = s.path;
78
- let r = [];
77
+ async function E(t = !1) {
78
+ const e = a;
79
79
  try {
80
- const l = L(n.dataSource);
81
- if (l) {
82
- let a = { ...c.get(e) || {}, ...l };
83
- a = S(a), c.set(e, a), u(a);
80
+ const n = q(r.dataSource);
81
+ if (n) {
82
+ let s = { ...u.get(e) || {}, ...n };
83
+ s = S(s), u.set(e, s), o(s);
84
84
  return;
85
85
  }
86
- let o = S(c.get(e) || {});
87
- o !== (c.get(e) || {}) && c.set(e, o);
88
- const g = [...C.get(e) || n.codes];
89
- if (r = t ? g : g.filter((a) => !w(o, a)), !r.length) {
90
- u(o);
91
- return;
92
- }
93
- const p = t ? void 0 : O.get(e);
94
- if (p)
95
- try {
96
- const a = await p, h = S({
97
- ...c.get(e) || {},
98
- ...a
99
- });
100
- if (c.set(e, h), r = g.filter((V) => !w(h, V)), !r.length) {
101
- u(h);
102
- return;
86
+ for (; ; ) {
87
+ let s = S(u.get(e) || {});
88
+ s !== (u.get(e) || {}) && u.set(e, s);
89
+ const i = [...g.get(e) || r.codes], l = t ? i : i.filter((p) => !D(s, p));
90
+ if (t = !1, !l.length) {
91
+ o(s);
92
+ return;
93
+ }
94
+ const h = O.get(e);
95
+ if (h)
96
+ try {
97
+ await h;
98
+ continue;
99
+ } catch {
103
100
  }
104
- o = h;
105
- } catch {
101
+ const w = N(l, s);
102
+ if (!w.length) {
103
+ const p = S(s);
104
+ u.set(e, p), o(p);
105
+ return;
106
+ }
107
+ const G = T(w), R = (m.get(e) || 0) + 1;
108
+ m.set(e, R), O.set(e, G);
109
+ try {
110
+ const p = await G;
111
+ if (m.get(e) !== R)
112
+ continue;
113
+ let v = {
114
+ ...u.get(e) || {},
115
+ ...p
116
+ };
117
+ v = S(v), u.set(e, v), o(v);
118
+ } finally {
119
+ m.get(e) === R && O.delete(e);
106
120
  }
107
- const D = N(r, o);
108
- if (!D.length) {
109
- const a = S(o);
110
- c.set(e, a), u(a);
111
- return;
112
- }
113
- const P = z(D), E = (v.get(e) || 0) + 1;
114
- v.set(e, E), O.set(e, P);
115
- try {
116
- const a = await P;
117
- if (v.get(e) !== E) return;
118
- let h = {
119
- ...c.get(e) || {},
120
- ...a
121
- };
122
- h = S(h), c.set(e, h), u(h);
123
- } finally {
124
- v.get(e) === E && O.delete(e);
125
121
  }
126
122
  } catch {
127
- const l = [...C.get(e) || n.codes], o = J(r.length ? r : l), p = { ...c.get(e) || {}, ...o };
128
- c.set(e, p), u(p);
123
+ const n = [...g.get(e) || r.codes], s = J(n), l = { ...u.get(e) || {}, ...s };
124
+ u.set(e, l), o(l);
129
125
  }
130
126
  }
131
- async function T() {
132
- const t = s.path, e = new Set(C.get(t) || n.codes);
133
- O.clear(), m.clear(), c.clear(), C.clear(), v.clear(), C.set(t, e), d(t), await q(!0);
127
+ async function V() {
128
+ const t = a, e = new Set(g.get(t) || r.codes);
129
+ O.clear(), y.clear(), u.clear(), g.clear(), m.clear(), g.set(t, e), f(t), await E(!0);
134
130
  }
135
131
  return j(() => {
136
- const t = L(n.dataSource);
132
+ const t = q(r.dataSource);
137
133
  if (!t) return;
138
- const e = s.path;
139
- let r = { ...c.get(e) || {}, ...t };
140
- r = S(r), c.set(e, r), u(r);
141
- }), i(s.path), R(s.path).then(() => G(s.path)), B(
142
- () => s.path,
143
- (t) => {
144
- i(t), R(t).then(() => G(t));
145
- }
146
- ), {
147
- dataSource: H(() => {
148
- const t = n.codes.reduce(
149
- (e, r) => (e[r] = y(f.value[r]), e),
134
+ const e = a;
135
+ let n = { ...u.get(e) || {}, ...t };
136
+ n = S(n), u.set(e, n), o(n);
137
+ }), _(a), P(a).then(() => z(a)), {
138
+ dataSource: B(() => {
139
+ const t = r.codes.reduce(
140
+ (e, n) => (e[n] = C(d.value[n]), e),
150
141
  {}
151
142
  );
152
143
  return new Proxy(t, {
153
- get(e, r) {
154
- return typeof r != "string" ? [] : y(t[r]);
144
+ get(e, n) {
145
+ return typeof n != "string" ? [] : C(t[n]);
155
146
  },
156
147
  set() {
157
148
  return !1;
158
149
  }
159
150
  });
160
151
  }),
161
- reload: T
152
+ reload: V
162
153
  };
163
154
  }
164
155
  export {
165
- Z as useBasicDataOptions
156
+ $ as useBasicDataOptions
166
157
  };
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -58,6 +58,8 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@element-plus/icons-vue": "^2.3.2",
61
+ "@visactor/vtable": "1.26.6",
62
+ "@visactor/vue-vtable": "1.26.6",
61
63
  "dayjs": "^1.11.19",
62
64
  "@vueuse/core": "^14.2.1",
63
65
  "axios": "^1.13.4",