@dazhicheng/ui 1.6.22 → 1.6.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.
@@ -1,8 +1,8 @@
1
- import { queryDataPermissionDetailDataTypeContext as E } from "../api/dataTypeContext.js";
2
- import { fetchUserListOnce as V, clearUserListCache as _ } from "./userListCache.js";
3
- import { ref as j, watchEffect as k, unref as R, computed as B } from "vue";
4
- import { useOwnerRoutePath as F } from "./useOwnerRoutePath.js";
5
- const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), W = "all", G = { label: "全部", value: W }, T = /* @__PURE__ */ new WeakMap(), H = {
1
+ import { queryDataPermissionDetailDataTypeContext as j } from "../api/dataTypeContext.js";
2
+ import { fetchUserListOnce as k, clearUserListCache as B } from "./userListCache.js";
3
+ import { ref as F, watchEffect as W, unref as U, computed as G } from "vue";
4
+ import { useOwnerRoutePath as H } from "./useOwnerRoutePath.js";
5
+ const u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), J = "all", Q = { label: "全部", value: J }, b = /* @__PURE__ */ new WeakMap(), X = {
6
6
  platformId: ["platformName", "platformId"],
7
7
  shopId: ["shopName", "shopId"],
8
8
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
@@ -10,114 +10,119 @@ const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), y = /* @__PU
10
10
  lockUserId: ["userName", "userId"],
11
11
  userId: ["fullName", "id"]
12
12
  };
13
- function J(n, a = []) {
14
- const h = T.get(a) || /* @__PURE__ */ new Map(), c = h.get(n);
15
- if (c) return c.slice();
16
- const [D, v] = H[n], C = a.map((p) => {
17
- const u = n === "purchasePlaceId" ? p.purchaseInfo || {} : p;
13
+ function Y(n, a = []) {
14
+ const i = b.get(a) || /* @__PURE__ */ new Map(), o = i.get(n);
15
+ if (o) return o.slice();
16
+ const [y, S] = X[n], m = a.map((h) => {
17
+ const c = n === "purchasePlaceId" ? h.purchaseInfo || {} : h;
18
18
  return {
19
- ...p,
20
- label: u == null ? void 0 : u[D],
21
- value: u == null ? void 0 : u[v]
19
+ ...h,
20
+ label: c == null ? void 0 : c[y],
21
+ value: c == null ? void 0 : c[S]
22
22
  };
23
23
  });
24
- return h.set(n, C), T.set(a, h), C.slice();
24
+ return i.set(n, m), b.set(a, i), m.slice();
25
25
  }
26
- function K(n) {
27
- const a = F(), h = j({});
28
- function c(t = {}) {
29
- h.value = n.codes.reduce(
30
- (e, r) => (e[r] = J(r, t[r]), e),
26
+ function re(n) {
27
+ const a = H(), i = F({});
28
+ function o(t = {}) {
29
+ i.value = n.codes.reduce(
30
+ (e, r) => (e[r] = Y(r, t[r]), e),
31
31
  {}
32
32
  );
33
33
  }
34
- function D(t) {
34
+ function y(t) {
35
35
  var e;
36
36
  return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
37
37
  }
38
- function v() {
39
- y.clear(), f.clear(), o.clear(), i.clear(), w.clear(), _();
38
+ function S() {
39
+ p.clear(), f.clear(), u.clear(), d.clear(), I.clear(), B();
40
40
  }
41
- function C(t) {
42
- o.delete(t), i.delete(t), f.delete(t);
41
+ function m(t) {
42
+ u.delete(t), d.delete(t), f.delete(t);
43
43
  }
44
- function p(t) {
45
- const e = i.get(t) || /* @__PURE__ */ new Set(), r = e.size;
46
- n.codes.forEach((d) => e.add(d)), i.set(t, e), e.size !== r && (f.delete(t), A(t));
44
+ function h(t) {
45
+ const e = d.get(t) || /* @__PURE__ */ new Set(), r = e.size;
46
+ n.codes.forEach((l) => e.add(l)), d.set(t, e), e.size !== r && A(t);
47
47
  }
48
- async function u(t = !1) {
49
- const e = a, r = R(n.dataSource);
48
+ async function c(t = !1) {
49
+ const e = a, r = U(n.dataSource);
50
50
  if (r) {
51
- c({ ...o.get(e) || {}, ...r });
51
+ o({ ...u.get(e) || {}, ...r });
52
52
  return;
53
53
  }
54
- const d = o.get(e) || {}, S = [...i.get(e) || n.codes];
55
- let m = t ? S : S.filter((s) => !Object.prototype.hasOwnProperty.call(d, s));
56
- if (!m.length) {
57
- c(d);
58
- return;
59
- }
60
- const L = t ? void 0 : y.get(e);
61
- if (L) {
62
- const s = await L, l = { ...o.get(e) || {}, ...s };
63
- if (o.set(e, l), m = S.filter((g) => !Object.prototype.hasOwnProperty.call(l, g)), !m.length) {
64
- c(l);
54
+ const l = /* @__PURE__ */ new Set(), V = 32;
55
+ for (let L = 0; L < V; L++) {
56
+ const v = u.get(e) || {}, M = [...d.get(e) || n.codes], g = t ? M : M.filter((s) => !Object.prototype.hasOwnProperty.call(v, s));
57
+ if (t = !1, !g.length) {
58
+ o(v);
65
59
  return;
66
60
  }
61
+ const N = p.get(e);
62
+ if (N) {
63
+ await N;
64
+ continue;
65
+ }
66
+ if (g.every((s) => l.has(s))) {
67
+ o(v);
68
+ return;
69
+ }
70
+ g.forEach((s) => l.add(s));
71
+ const x = g.filter((s) => s !== "userId"), _ = g.includes("userId"), D = Promise.allSettled([
72
+ x.length ? j({ dataTypeName: x }).then(
73
+ (s) => s
74
+ ) : Promise.resolve([]),
75
+ _ ? k() : Promise.resolve(void 0)
76
+ ]).then(([s, q]) => {
77
+ const w = s.status === "fulfilled" ? s.value : [], C = q.status === "fulfilled" ? q.value : void 0;
78
+ return {
79
+ ...C != null && C.length ? { userId: C } : {},
80
+ ...w.reduce((O, P) => {
81
+ const T = P == null ? void 0 : P.dataTypeCode;
82
+ return T && (O[T] = P.originalItems || []), O;
83
+ }, {})
84
+ };
85
+ }), R = (I.get(e) || 0) + 1;
86
+ I.set(e, R), p.set(e, D);
87
+ try {
88
+ const s = await D;
89
+ if (I.get(e) !== R) continue;
90
+ const w = { ...u.get(e) || {}, ...s };
91
+ u.set(e, w), o(w);
92
+ } finally {
93
+ p.get(e) === D && p.delete(e);
94
+ }
67
95
  }
68
- const M = m.filter((s) => s !== "userId"), z = m.includes("userId"), N = Promise.allSettled([
69
- M.length ? E({ dataTypeName: M }).then(
70
- (s) => s
71
- ) : Promise.resolve([]),
72
- z ? V() : Promise.resolve(void 0)
73
- ]).then(([s, P]) => {
74
- const l = s.status === "fulfilled" ? s.value : [], g = P.status === "fulfilled" ? P.value : void 0;
75
- return {
76
- ...g != null && g.length ? { userId: g } : {},
77
- ...l.reduce((q, I) => {
78
- const x = I == null ? void 0 : I.dataTypeCode;
79
- return x && (q[x] = I.originalItems || []), q;
80
- }, {})
81
- };
82
- }), O = (w.get(e) || 0) + 1;
83
- w.set(e, O), y.set(e, N);
84
- try {
85
- const s = await N;
86
- if (w.get(e) !== O) return;
87
- const l = { ...o.get(e) || {}, ...s };
88
- o.set(e, l), c(l);
89
- } finally {
90
- w.get(e) === O && y.delete(e);
91
- }
96
+ o(u.get(e) || {});
92
97
  }
93
- async function b() {
94
- const t = a, e = new Set(i.get(t) || n.codes);
95
- v(), i.set(t, e), C(t), await u(!0);
98
+ async function E() {
99
+ const t = a, e = new Set(d.get(t) || n.codes);
100
+ S(), m(t), d.set(t, e), await c(!0);
96
101
  }
97
102
  function A(t) {
98
103
  const e = f.get(t);
99
104
  if (e) return e;
100
- const r = Promise.resolve().then(() => u());
105
+ const r = Promise.resolve().then(() => c());
101
106
  return f.set(t, r), r.finally(() => {
102
107
  f.get(t) === r && f.delete(t);
103
108
  }), r;
104
109
  }
105
- k(() => {
106
- const t = R(n.dataSource);
107
- t && c({ ...o.get(a) || {}, ...t });
110
+ W(() => {
111
+ const t = U(n.dataSource);
112
+ t && o({ ...u.get(a) || {}, ...t });
108
113
  });
109
- function U(t) {
110
- c(o.get(t));
114
+ function z(t) {
115
+ o(u.get(t));
111
116
  }
112
- return p(a), A(a).then(() => U(a)), {
117
+ return h(a), A(a).then(() => z(a)), {
113
118
  /**
114
119
  * 数据源
115
120
  */
116
- dataSource: B(() => {
121
+ dataSource: G(() => {
117
122
  const t = n.codes.reduce(
118
123
  (e, r) => {
119
- const d = h.value[r] || [];
120
- return e[r] = D(r) ? [G, ...d] : d, e;
124
+ const l = i.value[r] || [];
125
+ return e[r] = y(r) ? [Q, ...l] : l, e;
121
126
  },
122
127
  {}
123
128
  );
@@ -133,9 +138,9 @@ function K(n) {
133
138
  /**
134
139
  * @description 清空所有缓存,重新请求
135
140
  */
136
- reload: b
141
+ reload: E
137
142
  };
138
143
  }
139
144
  export {
140
- K as useDataPermissionOptions
145
+ re as useDataPermissionOptions
141
146
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.6.22",
3
+ "version": "1.6.24",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",