@dazhicheng/ui 1.5.216 → 1.5.218
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.
|
@@ -160,7 +160,7 @@ export interface GroupSectionProps {
|
|
|
160
160
|
depth?: number;
|
|
161
161
|
/** 是否启用表单项级别的虚拟化(IntersectionObserver 懒渲染) */
|
|
162
162
|
virtual?: boolean;
|
|
163
|
-
/** 渐进式挂载:分批后台挂载全部字段,挂载后常驻
|
|
163
|
+
/** 渐进式挂载:分批后台挂载全部字段,挂载后常驻DOM常驻(供操作全量 DOM 场景使用) */
|
|
164
164
|
progressive?: boolean;
|
|
165
165
|
/** 虚拟化时滚动容器引用 */
|
|
166
166
|
scrollElement?: Element | null;
|
|
@@ -39,8 +39,10 @@ export interface FieldOnChangeContext {
|
|
|
39
39
|
* 组件 props、校验规则、依赖关系和追加 onChange 行为。
|
|
40
40
|
*/
|
|
41
41
|
export interface UseFormSchemasLinkFieldConfig {
|
|
42
|
+
/** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 */
|
|
43
|
+
component?: TtFormSchema["component"];
|
|
42
44
|
multiple?: boolean;
|
|
43
|
-
/**
|
|
45
|
+
/** 透传给字段组件的 props;传函数时会在渲染时接收表单值、操作对象和当前选项 */
|
|
44
46
|
componentProps?: FieldComponentProps;
|
|
45
47
|
/** 追加或覆盖 TtFormSchema.dependencies */
|
|
46
48
|
dependencies?: TtFormSchema["dependencies"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useDataPermissionOptions as
|
|
1
|
+
import { useDataPermissionOptions as z } from "./useDataPermissionOptions.js";
|
|
2
2
|
import "axios";
|
|
3
|
-
import { ElSelectV2 as
|
|
4
|
-
import { isFunction as
|
|
3
|
+
import { ElSelectV2 as G } from "element-plus";
|
|
4
|
+
import { isFunction as x } from "../packages/utils/src/is.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "xe-utils";
|
|
7
7
|
import "dayjs";
|
|
@@ -12,261 +12,278 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
12
12
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
13
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
14
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
-
import { omit as
|
|
16
|
-
const
|
|
15
|
+
import { omit as J } from "lodash-es";
|
|
16
|
+
const u = "all", K = { label: "全部", value: u }, R = [
|
|
17
17
|
"platformId",
|
|
18
18
|
"shopId",
|
|
19
19
|
"purchasePlaceId",
|
|
20
20
|
"businessType",
|
|
21
21
|
"lockUserId",
|
|
22
22
|
"userId"
|
|
23
|
-
],
|
|
23
|
+
], Q = {
|
|
24
24
|
platformId: "platformIds",
|
|
25
25
|
shopId: "shopIds",
|
|
26
26
|
purchasePlaceId: "purchasePlaceId",
|
|
27
27
|
businessType: "businessType",
|
|
28
28
|
lockUserId: "lockUserId"
|
|
29
|
-
},
|
|
29
|
+
}, W = {
|
|
30
30
|
platformId: "平台",
|
|
31
31
|
shopId: "店铺",
|
|
32
32
|
purchasePlaceId: "采购地",
|
|
33
33
|
businessType: "业务线",
|
|
34
34
|
lockUserId: "锁单人"
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
return typeof
|
|
36
|
+
function M(t) {
|
|
37
|
+
return typeof t == "string" && t.toLowerCase() === u.toLowerCase();
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return Array.isArray(
|
|
39
|
+
function _(t) {
|
|
40
|
+
return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return [
|
|
42
|
+
function X(t = []) {
|
|
43
|
+
return [K].concat(t);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function Y(t, c, i, b) {
|
|
46
|
+
return t ? x(t) ? t(c, i, b) : t : {};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
var
|
|
50
|
-
c == null || c(
|
|
51
|
-
const
|
|
52
|
-
i == null || i(
|
|
48
|
+
function B(t, c, i, b) {
|
|
49
|
+
var A;
|
|
50
|
+
c == null || c(t);
|
|
51
|
+
const I = b(), f = (A = I.values) == null ? void 0 : A[I.fieldName];
|
|
52
|
+
i == null || i(f, I);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const i =
|
|
56
|
-
(o,
|
|
54
|
+
function Z(t = {}, c = R) {
|
|
55
|
+
const i = t.scene || "list", b = c.reduce(
|
|
56
|
+
(o, n) => (n === "userId" || (o[n] = a(n).showAll ?? !1), o),
|
|
57
57
|
{}
|
|
58
|
-
), { dataSource:
|
|
58
|
+
), { dataSource: I } = z({
|
|
59
59
|
codes: c,
|
|
60
|
-
dataSource:
|
|
60
|
+
dataSource: t.dataSource,
|
|
61
61
|
showAll: b
|
|
62
62
|
});
|
|
63
|
-
function
|
|
64
|
-
return
|
|
63
|
+
function f(o) {
|
|
64
|
+
return a(o).fieldName || Q[o];
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function A(o) {
|
|
67
|
+
return a(o).rules;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function F(o) {
|
|
70
|
+
return a(o).label || W[o];
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
var
|
|
74
|
-
return ((
|
|
72
|
+
function a(o) {
|
|
73
|
+
var n;
|
|
74
|
+
return ((n = t.fieldConfigs) == null ? void 0 : n[o]) || {};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const e =
|
|
78
|
-
if (!
|
|
79
|
-
if (!e) return
|
|
76
|
+
function U(o, n) {
|
|
77
|
+
const e = a(o).dependencies;
|
|
78
|
+
if (!n) return e;
|
|
79
|
+
if (!e) return n;
|
|
80
80
|
const s = {
|
|
81
|
-
...
|
|
81
|
+
...n,
|
|
82
82
|
...e
|
|
83
83
|
};
|
|
84
|
-
if (
|
|
85
|
-
const l =
|
|
84
|
+
if (n && e) {
|
|
85
|
+
const l = n.triggerFields, r = e.triggerFields;
|
|
86
86
|
s.triggerFields = r ?? l;
|
|
87
87
|
}
|
|
88
88
|
return s;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
90
|
+
function O(o) {
|
|
91
|
+
return a(o).component || "TtApiComponent";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return a.
|
|
93
|
+
function C(o) {
|
|
94
|
+
return a(o).multiple ?? !0;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
96
|
+
function N(o) {
|
|
97
|
+
return I.value[o] || [];
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
return i === "action" && (t || e);
|
|
99
|
+
function V(o) {
|
|
100
|
+
return _(o).some((n) => M(n));
|
|
102
101
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
102
|
+
function L(o) {
|
|
103
|
+
const n = V(o), e = Array.isArray(o) ? o.length > 1 : !1;
|
|
104
|
+
return i === "action" && (n || e);
|
|
105
|
+
}
|
|
106
|
+
function j(o) {
|
|
107
|
+
const n = N("shopId"), e = _(o);
|
|
105
108
|
if (!e.length)
|
|
106
|
-
return i === "action" ? [] :
|
|
107
|
-
if (
|
|
108
|
-
const s =
|
|
109
|
-
return !s.some((r) =>
|
|
109
|
+
return i === "action" ? [] : n;
|
|
110
|
+
if (L(o)) return [];
|
|
111
|
+
const s = n.filter((r) => e.includes(r.platformId));
|
|
112
|
+
return !s.some((r) => M(r.value)) || s.length <= 1 ? s : X(s.filter((r) => !M(r.value)));
|
|
110
113
|
}
|
|
111
|
-
function
|
|
112
|
-
const r =
|
|
114
|
+
function E(o, n, e, s, l) {
|
|
115
|
+
const r = f(o), g = l ? s.filter((m) => {
|
|
113
116
|
var h;
|
|
114
|
-
return (h =
|
|
115
|
-
}) || [] : s.find((
|
|
117
|
+
return (h = n[r]) == null ? void 0 : h.includes(m.value);
|
|
118
|
+
}) || [] : s.find((m) => m.value === n[r]);
|
|
116
119
|
return {
|
|
117
|
-
values:
|
|
120
|
+
values: n,
|
|
118
121
|
actions: e,
|
|
119
122
|
fieldName: r,
|
|
120
123
|
dataType: o,
|
|
121
124
|
options: s,
|
|
122
|
-
currentOption:
|
|
125
|
+
currentOption: g
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
|
-
function
|
|
126
|
-
const r =
|
|
127
|
-
return {
|
|
128
|
-
multiple:
|
|
129
|
-
|
|
128
|
+
function k(o, n, e, s, l) {
|
|
129
|
+
const r = a(o), g = Y(r.componentProps, n, e, s), m = C(o), { onChange: h, ...d } = g, p = x(r.customOptions) ? r.customOptions(n, s) : s;
|
|
130
|
+
return r.component === "TtPanelSelect" ? {
|
|
131
|
+
multiple: m,
|
|
132
|
+
showAll: r.showAll ?? !1,
|
|
133
|
+
...d,
|
|
134
|
+
options: p,
|
|
135
|
+
onChange(S) {
|
|
136
|
+
B(
|
|
137
|
+
S,
|
|
138
|
+
l,
|
|
139
|
+
r.onChange,
|
|
140
|
+
() => E(o, n, e, p, m)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
} : {
|
|
144
|
+
multiple: m,
|
|
145
|
+
component: G,
|
|
130
146
|
...d,
|
|
131
|
-
options:
|
|
132
|
-
onChange(
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
options: p,
|
|
148
|
+
onChange(S) {
|
|
149
|
+
B(
|
|
150
|
+
S,
|
|
135
151
|
l,
|
|
136
152
|
r.onChange,
|
|
137
|
-
() =>
|
|
153
|
+
() => E(o, n, e, p, m)
|
|
138
154
|
);
|
|
139
155
|
}
|
|
140
156
|
};
|
|
141
157
|
}
|
|
142
|
-
function
|
|
158
|
+
function w(o) {
|
|
159
|
+
const n = f(o);
|
|
143
160
|
return {
|
|
144
|
-
component:
|
|
145
|
-
fieldName:
|
|
146
|
-
label:
|
|
147
|
-
rules:
|
|
148
|
-
dependencies:
|
|
161
|
+
component: O(o),
|
|
162
|
+
fieldName: n,
|
|
163
|
+
label: F(o),
|
|
164
|
+
rules: A(o),
|
|
165
|
+
dependencies: U(o),
|
|
149
166
|
componentProps: (e, s) => {
|
|
150
167
|
var h;
|
|
151
|
-
const l =
|
|
152
|
-
return
|
|
153
|
-
const
|
|
154
|
-
|
|
168
|
+
const l = N(o), r = f(o), g = C(o), m = ((h = e[r]) == null ? void 0 : h.at(-1)) !== u;
|
|
169
|
+
return k(o, e, s, l, (d) => {
|
|
170
|
+
const p = e[r];
|
|
171
|
+
g && (m && (d == null ? void 0 : d.at(-1)) === u ? e[r] = [u] : e[r] = p == null ? void 0 : p.filter((P) => P !== u));
|
|
155
172
|
});
|
|
156
173
|
}
|
|
157
174
|
};
|
|
158
175
|
}
|
|
159
|
-
const
|
|
176
|
+
const D = {
|
|
160
177
|
// 平台
|
|
161
178
|
platformId: {
|
|
162
|
-
component: "
|
|
163
|
-
fieldName:
|
|
164
|
-
label:
|
|
165
|
-
rules:
|
|
166
|
-
componentProps: (o,
|
|
179
|
+
component: O("platformId"),
|
|
180
|
+
fieldName: f("platformId"),
|
|
181
|
+
label: F("platformId"),
|
|
182
|
+
rules: A("platformId"),
|
|
183
|
+
componentProps: (o, n) => {
|
|
167
184
|
var d;
|
|
168
|
-
const e = "platformId", s =
|
|
169
|
-
return
|
|
170
|
-
const
|
|
171
|
-
r && (h && (
|
|
185
|
+
const e = "platformId", s = f(e), l = f("shopId"), r = C(e), g = C("shopId"), m = N(e), h = ((d = o[s]) == null ? void 0 : d.at(-1)) !== u;
|
|
186
|
+
return k(e, o, n, m, (p) => {
|
|
187
|
+
const P = o[s];
|
|
188
|
+
r && (h && (p == null ? void 0 : p.at(-1)) === u ? o[s] = [u] : o[s] = P == null ? void 0 : P.filter((S) => S !== u)), o[l] = g ? [] : void 0;
|
|
172
189
|
});
|
|
173
190
|
}
|
|
174
191
|
},
|
|
175
192
|
// 店铺
|
|
176
193
|
shopId: {
|
|
177
|
-
component: "
|
|
178
|
-
fieldName:
|
|
179
|
-
label:
|
|
180
|
-
componentProps: (o,
|
|
194
|
+
component: O("shopId"),
|
|
195
|
+
fieldName: f("shopId"),
|
|
196
|
+
label: F("shopId"),
|
|
197
|
+
componentProps: (o, n) => {
|
|
181
198
|
var h;
|
|
182
|
-
const e = "shopId", s =
|
|
183
|
-
return
|
|
184
|
-
const
|
|
185
|
-
|
|
199
|
+
const e = "shopId", s = f(e), l = o[f("platformId")], r = j(l), g = C(e), m = ((h = o[s]) == null ? void 0 : h.at(-1)) !== u;
|
|
200
|
+
return k(e, o, n, r, (d) => {
|
|
201
|
+
const p = o[s];
|
|
202
|
+
g && (m && (d == null ? void 0 : d.at(-1)) === u ? o[s] = [u] : o[s] = p == null ? void 0 : p.filter((P) => P !== u));
|
|
186
203
|
});
|
|
187
204
|
},
|
|
188
|
-
dependencies:
|
|
189
|
-
triggerFields: [
|
|
205
|
+
dependencies: U("shopId", {
|
|
206
|
+
triggerFields: [f("platformId")],
|
|
190
207
|
disabled(o) {
|
|
191
|
-
return
|
|
208
|
+
return L(o[f("platformId")]);
|
|
192
209
|
},
|
|
193
210
|
rules(o) {
|
|
194
|
-
return
|
|
211
|
+
return L(o[f("platformId")]) ? null : A("shopId") || null;
|
|
195
212
|
}
|
|
196
213
|
})
|
|
197
214
|
},
|
|
198
|
-
purchasePlaceId:
|
|
199
|
-
businessType:
|
|
200
|
-
lockUserId:
|
|
215
|
+
purchasePlaceId: w("purchasePlaceId"),
|
|
216
|
+
businessType: w("businessType"),
|
|
217
|
+
lockUserId: w("lockUserId")
|
|
201
218
|
};
|
|
202
|
-
function
|
|
203
|
-
return Object.keys(
|
|
204
|
-
(o,
|
|
219
|
+
function q() {
|
|
220
|
+
return Object.keys(D).reduce(
|
|
221
|
+
(o, n) => {
|
|
205
222
|
var l;
|
|
206
|
-
const e =
|
|
207
|
-
return o[
|
|
223
|
+
const e = D[n], s = (l = t.fieldConfigs) == null ? void 0 : l[n];
|
|
224
|
+
return o[n] = {
|
|
208
225
|
...e,
|
|
209
|
-
...
|
|
226
|
+
...J(s, ["componentProps", "rules"])
|
|
210
227
|
}, o;
|
|
211
228
|
},
|
|
212
229
|
{}
|
|
213
230
|
);
|
|
214
231
|
}
|
|
215
232
|
return {
|
|
216
|
-
...
|
|
217
|
-
dataSource:
|
|
233
|
+
...q(),
|
|
234
|
+
dataSource: I
|
|
218
235
|
};
|
|
219
236
|
}
|
|
220
|
-
function
|
|
221
|
-
const
|
|
237
|
+
function fo() {
|
|
238
|
+
const t = {
|
|
222
239
|
options: {},
|
|
223
|
-
codes: [...
|
|
240
|
+
codes: [...R]
|
|
224
241
|
}, c = {
|
|
225
242
|
/**
|
|
226
243
|
* @description 渲染查询场景
|
|
227
244
|
*/
|
|
228
245
|
list() {
|
|
229
|
-
return
|
|
246
|
+
return t.options.scene = "list", c;
|
|
230
247
|
},
|
|
231
248
|
/**
|
|
232
249
|
* @description 渲染新增编辑场景
|
|
233
250
|
*/
|
|
234
251
|
action() {
|
|
235
|
-
return
|
|
252
|
+
return t.options.scene = "action", c;
|
|
236
253
|
},
|
|
237
254
|
/**
|
|
238
255
|
* @param scene 场景值 list为查询 action为新增编辑等操作
|
|
239
256
|
* @returns FormSchemasLinkBuilder
|
|
240
257
|
*/
|
|
241
258
|
scene(i) {
|
|
242
|
-
return
|
|
259
|
+
return t.options.scene = i, c;
|
|
243
260
|
},
|
|
244
261
|
/**
|
|
245
262
|
* @param codes 接口请求所需要的入参,需要什么数据源就传什么入参
|
|
246
263
|
* @returns FormSchemasLinkBuilder
|
|
247
264
|
*/
|
|
248
265
|
codes(i) {
|
|
249
|
-
return
|
|
266
|
+
return t.codes = [...i], c;
|
|
250
267
|
},
|
|
251
268
|
dataSource(i) {
|
|
252
|
-
return
|
|
269
|
+
return t.options.dataSource = i, c;
|
|
253
270
|
},
|
|
254
271
|
field(i, b) {
|
|
255
|
-
var
|
|
256
|
-
return
|
|
257
|
-
...
|
|
272
|
+
var I;
|
|
273
|
+
return t.options.fieldConfigs = {
|
|
274
|
+
...t.options.fieldConfigs,
|
|
258
275
|
[i]: {
|
|
259
|
-
...((
|
|
276
|
+
...((I = t.options.fieldConfigs) == null ? void 0 : I[i]) || {},
|
|
260
277
|
...b
|
|
261
278
|
}
|
|
262
279
|
}, c;
|
|
263
280
|
},
|
|
264
281
|
build() {
|
|
265
|
-
return
|
|
282
|
+
return Z(t.options, t.codes);
|
|
266
283
|
}
|
|
267
284
|
};
|
|
268
285
|
return c;
|
|
269
286
|
}
|
|
270
287
|
export {
|
|
271
|
-
|
|
288
|
+
fo as useFormSchemasLink
|
|
272
289
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazhicheng/ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.218",
|
|
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/
|
|
71
|
-
"@dazhicheng/
|
|
70
|
+
"@dazhicheng/hooks": "1.4.44",
|
|
71
|
+
"@dazhicheng/utils": "1.3.41"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"dist"
|