@dazhicheng/ui 1.6.17 → 1.6.19
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.
- package/dist/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +165 -159
- package/dist/components/tt-form/src/form-render/dependencies.d.ts +1 -1
- package/dist/components/tt-form/src/form-render/dependencies.js +53 -53
- package/dist/components/tt-form/src/form-render/form.vue2.js +68 -67
- package/dist/components/tt-form/src/form-render/helper.js +20 -16
- package/dist/components/tt-form/src/group-form/groupFormApi.js +46 -45
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-table/src/TableForm.vue.d.ts +9 -0
- package/dist/components/tt-table/src/TableForm.vue.js +190 -179
- package/dist/components/tt-table/src/props.d.ts +6 -1
- package/dist/components/tt-table/src/props.js +9 -4
- package/dist/components/tt-table/src/types/tableForm.d.ts +19 -0
- package/dist/hooks/useBasicDataOptions.js +27 -26
- package/dist/hooks/useDataPermissionOptions.js +75 -92
- package/dist/hooks/userListCache.d.ts +12 -0
- package/dist/hooks/userListCache.js +17 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ref as b, watchEffect as j, unref as q, computed as B } from "vue";
|
|
2
2
|
import { useRoute as H } from "vue-router";
|
|
3
3
|
import { useOwnerRoutePath as I } from "./useOwnerRoutePath.js";
|
|
4
|
+
import { clearUserListCache as U } from "./userListCache.js";
|
|
4
5
|
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(),
|
|
6
|
+
const u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
6
7
|
function C(r) {
|
|
7
8
|
return Array.isArray(r) ? r : [];
|
|
8
9
|
}
|
|
@@ -20,27 +21,27 @@ function S(r) {
|
|
|
20
21
|
if (!c) return r;
|
|
21
22
|
const a = r[c];
|
|
22
23
|
if (!Array.isArray(a)) return r;
|
|
23
|
-
const
|
|
24
|
+
const d = { ...r };
|
|
24
25
|
let o = !1;
|
|
25
26
|
return M.forEach((f) => {
|
|
26
|
-
x(c, f) && (D(
|
|
27
|
-
}), o ?
|
|
27
|
+
x(c, f) && (D(d, f) || (d[f] = Y(a, f), o = !0));
|
|
28
|
+
}), o ? d : r;
|
|
28
29
|
}
|
|
29
30
|
function N(r, c) {
|
|
30
|
-
const a = F(c),
|
|
31
|
+
const a = F(c), d = r.filter(L), o = a || A(d) || void 0;
|
|
31
32
|
return o ? r.filter((f) => L(f) ? !(x(o, f) || f === o && D(c, o)) : !0) : r;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
const c = H(), a = I(),
|
|
34
|
+
function ee(r) {
|
|
35
|
+
const c = H(), a = I(), d = b({});
|
|
35
36
|
function o(t = {}) {
|
|
36
|
-
|
|
37
|
+
d.value = r.codes.reduce(
|
|
37
38
|
(e, n) => (e[n] = C(t[n]), e),
|
|
38
39
|
{}
|
|
39
40
|
);
|
|
40
41
|
}
|
|
41
42
|
o();
|
|
42
43
|
function f(t) {
|
|
43
|
-
u.delete(t),
|
|
44
|
+
u.delete(t), m.delete(t);
|
|
44
45
|
}
|
|
45
46
|
function _(t) {
|
|
46
47
|
const e = g.get(t) || /* @__PURE__ */ new Set(), n = e.size;
|
|
@@ -50,11 +51,11 @@ function $(r) {
|
|
|
50
51
|
o(u.get(t));
|
|
51
52
|
}
|
|
52
53
|
function P(t) {
|
|
53
|
-
const e =
|
|
54
|
+
const e = m.get(t);
|
|
54
55
|
if (e) return e;
|
|
55
56
|
const n = Promise.resolve().then(() => E());
|
|
56
|
-
return
|
|
57
|
-
|
|
57
|
+
return m.set(t, n), n.finally(() => {
|
|
58
|
+
m.get(t) === n && m.delete(t);
|
|
58
59
|
}), n;
|
|
59
60
|
}
|
|
60
61
|
async function T(t) {
|
|
@@ -69,9 +70,9 @@ function $(r) {
|
|
|
69
70
|
return [i, []];
|
|
70
71
|
}
|
|
71
72
|
})
|
|
72
|
-
)).reduce((i,
|
|
73
|
+
)).reduce((i, l, h) => {
|
|
73
74
|
const w = t[h];
|
|
74
|
-
return
|
|
75
|
+
return l.status === "fulfilled" ? i[l.value[0]] = C(l.value[1]) : i[w] = [], i;
|
|
75
76
|
}, {});
|
|
76
77
|
}
|
|
77
78
|
async function E(t = !1) {
|
|
@@ -86,8 +87,8 @@ function $(r) {
|
|
|
86
87
|
for (; ; ) {
|
|
87
88
|
const s = S(u.get(e) || {});
|
|
88
89
|
s !== (u.get(e) || {}) && u.set(e, s);
|
|
89
|
-
const i = [...g.get(e) || r.codes],
|
|
90
|
-
if (t = !1, !
|
|
90
|
+
const i = [...g.get(e) || r.codes], l = t ? i : i.filter((p) => !D(s, p));
|
|
91
|
+
if (t = !1, !l.length) {
|
|
91
92
|
o(s);
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
@@ -98,17 +99,17 @@ function $(r) {
|
|
|
98
99
|
continue;
|
|
99
100
|
} catch {
|
|
100
101
|
}
|
|
101
|
-
const w = N(
|
|
102
|
+
const w = N(l, s);
|
|
102
103
|
if (!w.length) {
|
|
103
104
|
const p = S(s);
|
|
104
105
|
u.set(e, p), o(p);
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
|
-
const G = T(w), R = (
|
|
108
|
-
|
|
108
|
+
const G = T(w), R = (y.get(e) || 0) + 1;
|
|
109
|
+
y.set(e, R), O.set(e, G);
|
|
109
110
|
try {
|
|
110
111
|
const p = await G;
|
|
111
|
-
if (
|
|
112
|
+
if (y.get(e) !== R)
|
|
112
113
|
continue;
|
|
113
114
|
let v = {
|
|
114
115
|
...u.get(e) || {},
|
|
@@ -116,17 +117,17 @@ function $(r) {
|
|
|
116
117
|
};
|
|
117
118
|
v = S(v), u.set(e, v), o(v);
|
|
118
119
|
} finally {
|
|
119
|
-
|
|
120
|
+
y.get(e) === R && O.delete(e);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
} catch {
|
|
123
|
-
const n = [...g.get(e) || r.codes], s = J(n),
|
|
124
|
-
u.set(e,
|
|
124
|
+
const n = [...g.get(e) || r.codes], s = J(n), l = { ...u.get(e) || {}, ...s };
|
|
125
|
+
u.set(e, l), o(l);
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
async function V() {
|
|
128
129
|
const t = a, e = new Set(g.get(t) || r.codes);
|
|
129
|
-
O.clear(),
|
|
130
|
+
O.clear(), m.clear(), u.clear(), g.clear(), y.clear(), U(), g.set(t, e), f(t), await E(!0);
|
|
130
131
|
}
|
|
131
132
|
return j(() => {
|
|
132
133
|
const t = q(r.dataSource);
|
|
@@ -137,7 +138,7 @@ function $(r) {
|
|
|
137
138
|
}), _(a), P(a).then(() => z(a)), {
|
|
138
139
|
dataSource: B(() => {
|
|
139
140
|
const t = r.codes.reduce(
|
|
140
|
-
(e, n) => (e[n] = C(
|
|
141
|
+
(e, n) => (e[n] = C(d.value[n]), e),
|
|
141
142
|
{}
|
|
142
143
|
);
|
|
143
144
|
return new Proxy(t, {
|
|
@@ -153,5 +154,5 @@ function $(r) {
|
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
156
|
export {
|
|
156
|
-
|
|
157
|
+
ee as useBasicDataOptions
|
|
157
158
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { queryDataPermissionDetailDataTypeContext as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const G = "all", H = { label: "全部", value: G }, U = /* @__PURE__ */ new WeakMap(), J = {
|
|
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 = {
|
|
7
6
|
platformId: ["platformName", "platformId"],
|
|
8
7
|
shopId: ["shopName", "shopId"],
|
|
9
8
|
purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
|
|
@@ -11,130 +10,114 @@ const G = "all", H = { label: "全部", value: G }, U = /* @__PURE__ */ new Weak
|
|
|
11
10
|
lockUserId: ["userName", "userId"],
|
|
12
11
|
userId: ["fullName", "id"]
|
|
13
12
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
return v = s, s;
|
|
20
|
-
});
|
|
21
|
-
try {
|
|
22
|
-
return await p;
|
|
23
|
-
} finally {
|
|
24
|
-
p = void 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
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;
|
|
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;
|
|
32
18
|
return {
|
|
33
|
-
...
|
|
34
|
-
label:
|
|
35
|
-
value:
|
|
19
|
+
...p,
|
|
20
|
+
label: u == null ? void 0 : u[D],
|
|
21
|
+
value: u == null ? void 0 : u[v]
|
|
36
22
|
};
|
|
37
23
|
});
|
|
38
|
-
return
|
|
24
|
+
return h.set(n, C), T.set(a, h), C.slice();
|
|
39
25
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
(e, r) => (e[r] =
|
|
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),
|
|
45
31
|
{}
|
|
46
32
|
);
|
|
47
33
|
}
|
|
48
|
-
function
|
|
34
|
+
function D(t) {
|
|
49
35
|
var e;
|
|
50
36
|
return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
|
|
51
37
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
38
|
+
function v() {
|
|
39
|
+
y.clear(), f.clear(), o.clear(), i.clear(), w.clear(), _();
|
|
54
40
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
41
|
+
function C(t) {
|
|
42
|
+
o.delete(t), i.delete(t), f.delete(t);
|
|
57
43
|
}
|
|
58
|
-
function
|
|
59
|
-
const e =
|
|
60
|
-
n.codes.forEach((
|
|
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));
|
|
61
47
|
}
|
|
62
|
-
async function
|
|
63
|
-
const e =
|
|
48
|
+
async function u(t = !1) {
|
|
49
|
+
const e = a, r = R(n.dataSource);
|
|
64
50
|
if (r) {
|
|
65
|
-
|
|
66
|
-
c.set(e, i), u(i);
|
|
51
|
+
c({ ...o.get(e) || {}, ...r });
|
|
67
52
|
return;
|
|
68
53
|
}
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
if (!
|
|
72
|
-
|
|
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);
|
|
73
58
|
return;
|
|
74
59
|
}
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
|
|
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);
|
|
80
65
|
return;
|
|
81
66
|
}
|
|
82
67
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
(
|
|
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
|
|
86
71
|
) : Promise.resolve([]),
|
|
87
|
-
|
|
88
|
-
]).then(([
|
|
89
|
-
const
|
|
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;
|
|
90
75
|
return {
|
|
91
|
-
...
|
|
92
|
-
...
|
|
93
|
-
const
|
|
94
|
-
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;
|
|
95
80
|
}, {})
|
|
96
81
|
};
|
|
97
|
-
}),
|
|
98
|
-
w.set(e,
|
|
82
|
+
}), O = (w.get(e) || 0) + 1;
|
|
83
|
+
w.set(e, O), y.set(e, N);
|
|
99
84
|
try {
|
|
100
|
-
const
|
|
101
|
-
if (w.get(e) !==
|
|
102
|
-
const
|
|
103
|
-
|
|
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);
|
|
104
89
|
} finally {
|
|
105
|
-
w.get(e) ===
|
|
90
|
+
w.get(e) === O && y.delete(e);
|
|
106
91
|
}
|
|
107
92
|
}
|
|
108
|
-
async function
|
|
109
|
-
const t =
|
|
110
|
-
|
|
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);
|
|
111
96
|
}
|
|
112
|
-
function
|
|
113
|
-
const e =
|
|
97
|
+
function A(t) {
|
|
98
|
+
const e = f.get(t);
|
|
114
99
|
if (e) return e;
|
|
115
|
-
const r = Promise.resolve().then(() =>
|
|
116
|
-
return
|
|
117
|
-
|
|
100
|
+
const r = Promise.resolve().then(() => u());
|
|
101
|
+
return f.set(t, r), r.finally(() => {
|
|
102
|
+
f.get(t) === r && f.delete(t);
|
|
118
103
|
}), r;
|
|
119
104
|
}
|
|
120
|
-
|
|
121
|
-
const t =
|
|
122
|
-
|
|
123
|
-
const e = s, o = { ...c.get(e) || {}, ...t };
|
|
124
|
-
c.set(e, o), u(o);
|
|
105
|
+
k(() => {
|
|
106
|
+
const t = R(n.dataSource);
|
|
107
|
+
t && c({ ...o.get(a) || {}, ...t });
|
|
125
108
|
});
|
|
126
|
-
function
|
|
127
|
-
|
|
109
|
+
function U(t) {
|
|
110
|
+
c(o.get(t));
|
|
128
111
|
}
|
|
129
|
-
return
|
|
112
|
+
return p(a), A(a).then(() => U(a)), {
|
|
130
113
|
/**
|
|
131
114
|
* 数据源
|
|
132
115
|
*/
|
|
133
|
-
dataSource:
|
|
116
|
+
dataSource: B(() => {
|
|
134
117
|
const t = n.codes.reduce(
|
|
135
118
|
(e, r) => {
|
|
136
|
-
const
|
|
137
|
-
return e[r] =
|
|
119
|
+
const d = h.value[r] || [];
|
|
120
|
+
return e[r] = D(r) ? [G, ...d] : d, e;
|
|
138
121
|
},
|
|
139
122
|
{}
|
|
140
123
|
);
|
|
@@ -150,9 +133,9 @@ function ee(n) {
|
|
|
150
133
|
/**
|
|
151
134
|
* @description 清空所有缓存,重新请求
|
|
152
135
|
*/
|
|
153
|
-
reload:
|
|
136
|
+
reload: b
|
|
154
137
|
};
|
|
155
138
|
}
|
|
156
139
|
export {
|
|
157
|
-
|
|
140
|
+
K as useDataPermissionOptions
|
|
158
141
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 取全量用户列表,整个应用只请求一次
|
|
3
|
+
*
|
|
4
|
+
* `useDataPermissionOptions` 的 `userId` 和 `useBasicDataOptions` 的 `USER` 都要这份数据。
|
|
5
|
+
* 两边各自缓存会把 `/iam/user/page` 打两遍,所以请求收敛到这里,label value 的映射仍由各自负责。
|
|
6
|
+
*
|
|
7
|
+
* 空结果和请求失败都不写缓存、不留在途引用,下次调用可以重新请求
|
|
8
|
+
* @returns 用户原始记录列表
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchUserListOnce(): Promise<IamAPI.UserDTO[]>;
|
|
11
|
+
/** 清空用户列表缓存,供各 hook 的 reload 使用 */
|
|
12
|
+
export declare function clearUserListCache(): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { pageUser as t } from "../api/dataTypeContext.js";
|
|
2
|
+
let r, e;
|
|
3
|
+
function c() {
|
|
4
|
+
return r != null && r.length ? Promise.resolve(r) : e || (e = t({ pageNo: 1, pageSize: 9999 }).then((i) => {
|
|
5
|
+
const n = (i == null ? void 0 : i.records) || [];
|
|
6
|
+
return n.length ? r = n : e = void 0, n;
|
|
7
|
+
}), e.catch(() => {
|
|
8
|
+
e = void 0;
|
|
9
|
+
}), e);
|
|
10
|
+
}
|
|
11
|
+
function s() {
|
|
12
|
+
r = void 0, e = void 0;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
s as clearUserListCache,
|
|
16
|
+
c as fetchUserListOnce
|
|
17
|
+
};
|