@dazhicheng/ui 1.5.246 → 1.5.247
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.
|
@@ -44,6 +44,8 @@ export interface PanelSelectFieldConfig {
|
|
|
44
44
|
dependencies?: TtFormSchema["dependencies"];
|
|
45
45
|
onChange?: (value: unknown, context: PanelSelectFieldOnChangeContext) => void;
|
|
46
46
|
rules?: TtFormSchema["rules"];
|
|
47
|
+
/** 表单项描述,透传到 TtFormSchema.description */
|
|
48
|
+
description?: TtFormSchema["description"];
|
|
47
49
|
/** 与另一字段互斥:填对方的 fieldName */
|
|
48
50
|
mutexWith?: string;
|
|
49
51
|
/** 同 code 数据源的排除字段联动 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "axios";
|
|
2
2
|
import "element-plus";
|
|
3
|
-
import { isFunction as
|
|
3
|
+
import { isFunction as Q } from "../packages/utils/src/is.js";
|
|
4
4
|
import "vue";
|
|
5
5
|
import "xe-utils";
|
|
6
6
|
import "dayjs";
|
|
@@ -11,120 +11,125 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
11
11
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
12
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
13
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
|
-
import { omit as
|
|
15
|
-
import { CODE_REGISTRY as
|
|
16
|
-
import { useBasicDataOptions as
|
|
17
|
-
const
|
|
14
|
+
import { omit as _ } from "lodash-es";
|
|
15
|
+
import { CODE_REGISTRY as oe, resolveDefaultGroupBy as re, GROUP_BY as se, groupBasicDataOptions as z } from "./basicDataCodes.js";
|
|
16
|
+
import { useBasicDataOptions as ce } from "./useBasicDataOptions.js";
|
|
17
|
+
const N = "all";
|
|
18
18
|
function d(t) {
|
|
19
19
|
return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function le(t, n = N) {
|
|
22
22
|
return t === n ? !0 : typeof t == "string" && typeof n == "string" && t.toLowerCase() === String(n).toLowerCase();
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return d(t).some((r) =>
|
|
24
|
+
function pe(t, n = N) {
|
|
25
|
+
return d(t).some((r) => le(r, n));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function ue(t) {
|
|
28
28
|
return t.replace(/[-_]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
30
|
+
function K(t, n) {
|
|
31
|
+
const r = "支持多选和全选", s = typeof t == "string" && t.trim() ? t.trim().replace(/[,,]\s*$/, "") : "请选择";
|
|
32
|
+
return s.includes(r) ? s : `${s},${r}`;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function V(t, n, r, s) {
|
|
35
|
+
return t ? Q(t) ? t(n, r, s) : t : {};
|
|
36
|
+
}
|
|
37
|
+
function j(t, n, r, s) {
|
|
34
38
|
const p = new Set(r.map((e) => e.value)), l = t[n];
|
|
35
|
-
if (
|
|
36
|
-
const e = d(l).filter((u) => p.has(u)),
|
|
37
|
-
(e.length !==
|
|
39
|
+
if (s) {
|
|
40
|
+
const e = d(l).filter((u) => p.has(u)), c = d(l);
|
|
41
|
+
(e.length !== c.length || e.some((u, F) => u !== c[F])) && (t[n] = e);
|
|
38
42
|
return;
|
|
39
43
|
}
|
|
40
44
|
l == null || l === "" || p.has(l) || (t[n] = void 0);
|
|
41
45
|
}
|
|
42
|
-
function
|
|
43
|
-
const e = l ? p.filter((
|
|
46
|
+
function q(t, n, r, s, p, l) {
|
|
47
|
+
const e = l ? p.filter((c) => d(r[n]).includes(c.value)) : p.find((c) => c.value === r[n]);
|
|
44
48
|
return {
|
|
45
49
|
values: r,
|
|
46
|
-
actions:
|
|
50
|
+
actions: s,
|
|
47
51
|
fieldName: n,
|
|
48
52
|
code: t,
|
|
49
53
|
options: p,
|
|
50
54
|
currentOption: e
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
if (
|
|
57
|
-
const p = new Set(
|
|
57
|
+
function Z(t, n, r) {
|
|
58
|
+
const s = d(t);
|
|
59
|
+
if (!s.length) return [];
|
|
60
|
+
if (pe(t, r)) return n;
|
|
61
|
+
const p = new Set(s);
|
|
58
62
|
return n.filter((l) => p.has(l.value));
|
|
59
63
|
}
|
|
60
|
-
function
|
|
64
|
+
function H(t, n) {
|
|
61
65
|
const r = new Set(d(t));
|
|
62
|
-
return r.size ? n.filter((
|
|
66
|
+
return r.size ? n.filter((s) => !r.has(s.value)) : n;
|
|
63
67
|
}
|
|
64
|
-
function
|
|
65
|
-
var
|
|
66
|
-
const r = (
|
|
68
|
+
function J(t, n) {
|
|
69
|
+
var s;
|
|
70
|
+
const r = (s = t.value) == null ? void 0 : s[n];
|
|
67
71
|
return Array.isArray(r) ? r : [];
|
|
68
72
|
}
|
|
69
|
-
function
|
|
70
|
-
const r = [...new Set(t.map((e) => e.code))],
|
|
71
|
-
(e,
|
|
73
|
+
function Me(t, n = {}) {
|
|
74
|
+
const r = [...new Set(t.map((e) => e.code))], s = t.reduce(
|
|
75
|
+
(e, c) => (e[c.code] = (e[c.code] || 0) + 1, e),
|
|
72
76
|
{}
|
|
73
|
-
), { dataSource: p } =
|
|
77
|
+
), { dataSource: p } = ce({
|
|
74
78
|
codes: r,
|
|
75
79
|
dataSource: n.dataSource
|
|
76
80
|
}), l = {};
|
|
77
81
|
return t.forEach((e) => {
|
|
78
|
-
var
|
|
79
|
-
const
|
|
82
|
+
var R;
|
|
83
|
+
const c = oe[e.code], u = e.fieldName || c.defaultFieldName, F = e.key || ((s[e.code] || 0) > 1 ? u : e.code), $ = e.label || c.defaultLabel, E = e.multiple ?? c.defaultMultiple, X = e.showAll ?? c.defaultShowAll, M = e.showAllField ?? N, m = e.mutexWith, T = re(e.code, e.groupBy), O = T !== se.PINYIN, S = c.defaultTreeConfig, k = !!S, G = c.defaultShowNav ?? !1, f = [
|
|
80
84
|
...m ? [m] : [],
|
|
81
|
-
...((
|
|
82
|
-
],
|
|
83
|
-
...
|
|
84
|
-
triggerFields:
|
|
85
|
-
} : e.dependencies,
|
|
85
|
+
...((R = e.dependencies) == null ? void 0 : R.triggerFields) || []
|
|
86
|
+
], I = [...new Set(f)], v = _(e.dependencies || {}, ["triggerFields"]), C = I.length ? {
|
|
87
|
+
...v,
|
|
88
|
+
triggerFields: I
|
|
89
|
+
} : e.dependencies, B = {
|
|
86
90
|
component: "TtPanelSelect",
|
|
87
91
|
fieldName: u,
|
|
88
|
-
label:
|
|
92
|
+
label: $,
|
|
89
93
|
rules: e.rules,
|
|
90
|
-
dependencies:
|
|
94
|
+
dependencies: C,
|
|
91
95
|
componentProps: (o, x) => {
|
|
92
|
-
const A =
|
|
93
|
-
let a = m ?
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
+
const A = J(p, e.code);
|
|
97
|
+
let a = m ? H(o[m], A) : A;
|
|
98
|
+
Q(e.customOptions) && (a = e.customOptions(o, a) || []);
|
|
99
|
+
const g = O ? z(a, T) : a, D = V(e.componentProps, o, x, a), { onChange: U, ...w } = D;
|
|
96
100
|
return {
|
|
97
|
-
multiple:
|
|
98
|
-
showAll:
|
|
99
|
-
showAllField:
|
|
100
|
-
showNav:
|
|
101
|
+
multiple: E,
|
|
102
|
+
showAll: X,
|
|
103
|
+
showAllField: M,
|
|
104
|
+
showNav: G,
|
|
101
105
|
showOriginMode: !1,
|
|
102
|
-
showPinyinMode:
|
|
103
|
-
...
|
|
104
|
-
...
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
showPinyinMode: k ? !1 : !O,
|
|
107
|
+
...S ? { treeConfig: S } : {},
|
|
108
|
+
...w,
|
|
109
|
+
...E ? { placeholder: K(w.placeholder) } : {},
|
|
110
|
+
options: g,
|
|
111
|
+
onChange(y) {
|
|
112
|
+
var P;
|
|
108
113
|
if (m) {
|
|
109
|
-
const i = Array.isArray(o[m]), h =
|
|
110
|
-
|
|
114
|
+
const i = Array.isArray(o[m]), h = H(y, A);
|
|
115
|
+
j(o, m, h, i);
|
|
111
116
|
}
|
|
112
117
|
if (e.exclude) {
|
|
113
|
-
const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0,
|
|
114
|
-
d(
|
|
118
|
+
const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, L = Z(y, A, M);
|
|
119
|
+
d(y).length ? j(o, i, L, h) : o[i] = h ? [] : void 0;
|
|
115
120
|
}
|
|
116
|
-
(
|
|
121
|
+
(P = e.onChange) == null || P.call(
|
|
117
122
|
e,
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
y,
|
|
124
|
+
q(e.code, u, o, x, a, E)
|
|
120
125
|
);
|
|
121
126
|
}
|
|
122
127
|
};
|
|
123
128
|
}
|
|
124
129
|
};
|
|
125
|
-
if (l[
|
|
126
|
-
...
|
|
127
|
-
...
|
|
130
|
+
if (l[F] = {
|
|
131
|
+
...B,
|
|
132
|
+
..._(e, [
|
|
128
133
|
"code",
|
|
129
134
|
"key",
|
|
130
135
|
"fieldName",
|
|
@@ -142,48 +147,50 @@ function Ee(t, n = {}) {
|
|
|
142
147
|
"customOptions"
|
|
143
148
|
]),
|
|
144
149
|
fieldName: u,
|
|
145
|
-
label:
|
|
150
|
+
label: $,
|
|
146
151
|
rules: e.rules,
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
description: e.description,
|
|
153
|
+
dependencies: B.dependencies,
|
|
154
|
+
componentProps: B.componentProps,
|
|
149
155
|
component: "TtPanelSelect"
|
|
150
156
|
}, e.exclude) {
|
|
151
|
-
const o = e.exclude, x = o.fieldName, A = o.key || `exclude${
|
|
152
|
-
...
|
|
153
|
-
triggerFields:
|
|
154
|
-
if:
|
|
155
|
-
},
|
|
157
|
+
const o = e.exclude, x = o.fieldName, A = o.key || `exclude${ue(F)}`, a = o.label || c.defaultExcludeLabel, g = o.multiple ?? !0, D = o.showAll ?? !1, U = o.showAllField ?? N, w = o.dependencies || {}, y = {
|
|
158
|
+
...w,
|
|
159
|
+
triggerFields: w.triggerFields ?? [u],
|
|
160
|
+
if: w.if ?? ((i) => d(i[u]).length > 0)
|
|
161
|
+
}, P = {
|
|
156
162
|
component: "TtPanelSelect",
|
|
157
163
|
fieldName: x,
|
|
158
164
|
label: a,
|
|
159
165
|
rules: o.rules,
|
|
160
|
-
dependencies:
|
|
166
|
+
dependencies: y,
|
|
161
167
|
componentProps: (i, h) => {
|
|
162
|
-
const
|
|
168
|
+
const L = J(p, e.code), b = Z(i[u], L, M), ee = O ? z(b, T) : b, te = V(o.componentProps, i, h, b), { onChange: ie, ...W } = te;
|
|
163
169
|
return {
|
|
164
|
-
multiple:
|
|
165
|
-
showAll:
|
|
166
|
-
showAllField:
|
|
167
|
-
showNav:
|
|
170
|
+
multiple: g,
|
|
171
|
+
showAll: D,
|
|
172
|
+
showAllField: U,
|
|
173
|
+
showNav: G,
|
|
168
174
|
showOriginMode: !1,
|
|
169
|
-
showPinyinMode:
|
|
170
|
-
...
|
|
171
|
-
...
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
showPinyinMode: k ? !1 : !O,
|
|
176
|
+
...S ? { treeConfig: S } : {},
|
|
177
|
+
...W,
|
|
178
|
+
...g ? { placeholder: K(W.placeholder) } : {},
|
|
179
|
+
options: ee,
|
|
180
|
+
onChange(ne) {
|
|
174
181
|
var Y;
|
|
175
182
|
(Y = o.onChange) == null || Y.call(
|
|
176
183
|
o,
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
ne,
|
|
185
|
+
q(e.code, x, i, h, b, g)
|
|
179
186
|
);
|
|
180
187
|
}
|
|
181
188
|
};
|
|
182
189
|
}
|
|
183
190
|
};
|
|
184
191
|
l[A] = {
|
|
185
|
-
...
|
|
186
|
-
...
|
|
192
|
+
...P,
|
|
193
|
+
..._(o, [
|
|
187
194
|
"fieldName",
|
|
188
195
|
"label",
|
|
189
196
|
"key",
|
|
@@ -198,8 +205,8 @@ function Ee(t, n = {}) {
|
|
|
198
205
|
fieldName: x,
|
|
199
206
|
label: a,
|
|
200
207
|
rules: o.rules,
|
|
201
|
-
dependencies:
|
|
202
|
-
componentProps:
|
|
208
|
+
dependencies: P.dependencies,
|
|
209
|
+
componentProps: P.componentProps,
|
|
203
210
|
component: "TtPanelSelect"
|
|
204
211
|
};
|
|
205
212
|
}
|
|
@@ -209,5 +216,5 @@ function Ee(t, n = {}) {
|
|
|
209
216
|
};
|
|
210
217
|
}
|
|
211
218
|
export {
|
|
212
|
-
|
|
219
|
+
Me as usePanelSelectSchemas
|
|
213
220
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazhicheng/ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.247",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"vue-router": "^5.0.2",
|
|
68
68
|
"vxe-pc-ui": "^4.12.36",
|
|
69
69
|
"vxe-table": "^4.17.48",
|
|
70
|
-
"@dazhicheng/utils": "1.3.
|
|
71
|
-
"@dazhicheng/hooks": "1.4.
|
|
70
|
+
"@dazhicheng/utils": "1.3.44",
|
|
71
|
+
"@dazhicheng/hooks": "1.4.47"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"dist"
|