dynamicformdjx 0.3.3 → 0.3.4
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/README.md +2 -2
- package/dist/elementPlus/index.cjs +1 -1
- package/dist/elementPlus/index.mjs +1 -1
- package/dist/hooks/useDyForm.d.ts +4 -1
- package/dist/index-CA3F2Lxo.cjs +1 -0
- package/dist/index-MF72-iEr.js +34 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +63 -60
- package/dist/naiveUi/index.cjs +1 -1
- package/dist/naiveUi/index.mjs +152 -155
- package/dist/utils/tools.d.ts +3 -1
- package/package.json +1 -1
- package/dist/index-BWQjnQQF.cjs +0 -1
- package/dist/index-BqKRE4oH.js +0 -29
package/dist/naiveUi/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as j, ref as
|
|
2
|
-
import { NInput as
|
|
3
|
-
import { t as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as j, ref as A, watch as z, toRaw as S, createVNode as o, createTextVNode as C, Fragment as F, nextTick as $, isVNode as L, computed as I, mergeProps as G, h as b, shallowReactive as M } from "vue";
|
|
2
|
+
import { NInput as N, NButton as p, NForm as U, NGrid as B, NFormItemGridItem as H, NFormItem as q, NSelect as _, NPopselect as E, NTreeSelect as K, NRadioGroup as w, NRadio as J, NRadioButton as Q, NCheckboxGroup as W, NSpace as X, NCheckbox as Y, NSwitch as Z, NDatePicker as ee, NTimePicker as le } from "naive-ui";
|
|
3
|
+
import { t as R, r as P, f as O, p as te, s as ne, e as re } from "../index-MF72-iEr.js";
|
|
4
|
+
const Ce = /* @__PURE__ */ j({
|
|
5
5
|
name: "NaiDynamicInput",
|
|
6
6
|
props: {
|
|
7
7
|
size: {
|
|
@@ -15,7 +15,7 @@ const he = /* @__PURE__ */ j({
|
|
|
15
15
|
},
|
|
16
16
|
randomFun: {
|
|
17
17
|
type: Function,
|
|
18
|
-
default: (
|
|
18
|
+
default: (l) => `${Date.now()}_${l ?? 0}`
|
|
19
19
|
},
|
|
20
20
|
btnConfigs: {
|
|
21
21
|
type: Object
|
|
@@ -32,11 +32,11 @@ const he = /* @__PURE__ */ j({
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
emits: {
|
|
35
|
-
"update:modelValue": (
|
|
35
|
+
"update:modelValue": (l) => !0,
|
|
36
36
|
onReset: () => !0,
|
|
37
|
-
onMerge: (
|
|
37
|
+
onMerge: (l, s) => !0
|
|
38
38
|
},
|
|
39
|
-
setup(
|
|
39
|
+
setup(l, {
|
|
40
40
|
emit: s,
|
|
41
41
|
expose: d
|
|
42
42
|
}) {
|
|
@@ -44,54 +44,54 @@ const he = /* @__PURE__ */ j({
|
|
|
44
44
|
resetTxt: "重置",
|
|
45
45
|
newTxt: "添加项",
|
|
46
46
|
mergeTxt: "合并",
|
|
47
|
-
...
|
|
48
|
-
},
|
|
47
|
+
...l.btnConfigs
|
|
48
|
+
}, e = {
|
|
49
49
|
hideReset: !1,
|
|
50
50
|
maxHeight: "300px",
|
|
51
51
|
autoScroll: !0,
|
|
52
52
|
allowFilter: !0,
|
|
53
|
-
...
|
|
53
|
+
...l.configs
|
|
54
54
|
}, i = {
|
|
55
55
|
arraySplitSymbol: ",",
|
|
56
|
-
...
|
|
57
|
-
}, y =
|
|
56
|
+
...l.dyListConfigs
|
|
57
|
+
}, y = l.size, c = A(R(l.modelValue, l.randomFun, i.arraySplitSymbol)), m = A(null);
|
|
58
58
|
return z(c, (a) => {
|
|
59
|
-
if (!
|
|
59
|
+
if (!l.isController) return;
|
|
60
60
|
const v = P(a, i.arraySplitSymbol);
|
|
61
61
|
s("update:modelValue", v), s("onMerge", v, S(c.value));
|
|
62
62
|
}, {
|
|
63
63
|
deep: !0
|
|
64
64
|
}), d({
|
|
65
65
|
onSet: (a) => {
|
|
66
|
-
c.value =
|
|
66
|
+
c.value = R(a ?? l.modelValue, l.randomFun, i.arraySplitSymbol);
|
|
67
67
|
},
|
|
68
68
|
getResult: (a = "res") => a === "ori" ? S(c.value) : P(c.value, i.arraySplitSymbol)
|
|
69
69
|
}), () => o("div", {
|
|
70
|
-
class:
|
|
70
|
+
class: l.dyCls ?? `dynamicForm ${y}`
|
|
71
71
|
}, [o("div", {
|
|
72
72
|
class: `dyFormList ${c.value.length ? "" : "noList"}`,
|
|
73
73
|
ref: m,
|
|
74
74
|
style: {
|
|
75
|
-
maxHeight:
|
|
75
|
+
maxHeight: e.maxHeight
|
|
76
76
|
}
|
|
77
77
|
}, [c.value.map((a, v, t) => o("div", {
|
|
78
78
|
class: "dItem",
|
|
79
79
|
key: a.rId
|
|
80
80
|
}, [o("div", {
|
|
81
81
|
class: "input"
|
|
82
|
-
}, [o(
|
|
82
|
+
}, [o(N, {
|
|
83
83
|
size: y,
|
|
84
84
|
value: a.key,
|
|
85
85
|
class: "key",
|
|
86
86
|
onInput: (r) => {
|
|
87
87
|
a.key = r;
|
|
88
88
|
}
|
|
89
|
-
}, null), C(":"), o(
|
|
89
|
+
}, null), C(":"), o(N, {
|
|
90
90
|
size: y,
|
|
91
91
|
value: a.value,
|
|
92
92
|
class: "value",
|
|
93
93
|
onInput: (r) => {
|
|
94
|
-
|
|
94
|
+
e.allowFilter && a.isNumber ? a.value = O(r, a.isArray, i.arraySplitSymbol) : a.value = r;
|
|
95
95
|
}
|
|
96
96
|
}, {
|
|
97
97
|
prefix: () => o(F, null, [o(p, {
|
|
@@ -119,10 +119,10 @@ const he = /* @__PURE__ */ j({
|
|
|
119
119
|
disabled: v !== t.length - 1,
|
|
120
120
|
onClick: () => {
|
|
121
121
|
c.value.push({
|
|
122
|
-
rId:
|
|
122
|
+
rId: l.randomFun(),
|
|
123
123
|
key: "",
|
|
124
124
|
value: ""
|
|
125
|
-
}),
|
|
125
|
+
}), e.autoScroll && $(() => {
|
|
126
126
|
const r = m.value;
|
|
127
127
|
r?.scrollTo({
|
|
128
128
|
top: r.scrollHeight,
|
|
@@ -147,18 +147,18 @@ const he = /* @__PURE__ */ j({
|
|
|
147
147
|
type: "success",
|
|
148
148
|
onClick: () => {
|
|
149
149
|
c.value.push({
|
|
150
|
-
rId:
|
|
150
|
+
rId: l.randomFun(),
|
|
151
151
|
key: "",
|
|
152
152
|
value: ""
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
}, {
|
|
156
156
|
default: () => [n.newTxt]
|
|
157
|
-
}), !
|
|
157
|
+
}), !l.isController && o(F, null, [!e.hideReset && o(p, {
|
|
158
158
|
size: y,
|
|
159
159
|
type: "default",
|
|
160
160
|
onClick: () => {
|
|
161
|
-
c.value =
|
|
161
|
+
c.value = R(l.modelValue, l.randomFun, i.arraySplitSymbol), s("onReset");
|
|
162
162
|
}
|
|
163
163
|
}, {
|
|
164
164
|
default: () => [n.resetTxt]
|
|
@@ -168,17 +168,17 @@ const he = /* @__PURE__ */ j({
|
|
|
168
168
|
onClick: () => {
|
|
169
169
|
c.value.sort((v, t) => +v.rId - +t.rId);
|
|
170
170
|
const a = P(c.value, i.arraySplitSymbol);
|
|
171
|
-
s("update:modelValue", a), s("onMerge", a, S(c.value)), c.value =
|
|
171
|
+
s("update:modelValue", a), s("onMerge", a, S(c.value)), c.value = R(a, l.randomFun, i.arraySplitSymbol);
|
|
172
172
|
}
|
|
173
173
|
}, {
|
|
174
174
|
default: () => [n.mergeTxt]
|
|
175
175
|
})])])]);
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
function ae(
|
|
179
|
-
return typeof
|
|
178
|
+
function ae(l) {
|
|
179
|
+
return typeof l == "function" || Object.prototype.toString.call(l) === "[object Object]" && !L(l);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const he = /* @__PURE__ */ j({
|
|
182
182
|
name: "NaiveUiDynamicCascadeInput",
|
|
183
183
|
props: {
|
|
184
184
|
modelValue: {
|
|
@@ -193,7 +193,7 @@ const ke = /* @__PURE__ */ j({
|
|
|
193
193
|
},
|
|
194
194
|
randomFun: {
|
|
195
195
|
type: Function,
|
|
196
|
-
default: (
|
|
196
|
+
default: (l) => `${Date.now()}_${l ?? 0}`
|
|
197
197
|
},
|
|
198
198
|
// 子层深度 (超过则不再出现添加选项)
|
|
199
199
|
depth: {
|
|
@@ -211,15 +211,15 @@ const ke = /* @__PURE__ */ j({
|
|
|
211
211
|
},
|
|
212
212
|
newChildTxt: {
|
|
213
213
|
type: Function,
|
|
214
|
-
default: (
|
|
214
|
+
default: (l) => `添加 '${l.key}' 子项`
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
emits: {
|
|
218
|
-
"update:modelValue": (
|
|
218
|
+
"update:modelValue": (l) => !0,
|
|
219
219
|
onReset: () => !0,
|
|
220
|
-
onMerge: (
|
|
220
|
+
onMerge: (l, s) => !0
|
|
221
221
|
},
|
|
222
|
-
setup(
|
|
222
|
+
setup(l, {
|
|
223
223
|
emit: s,
|
|
224
224
|
expose: d
|
|
225
225
|
}) {
|
|
@@ -227,8 +227,8 @@ const ke = /* @__PURE__ */ j({
|
|
|
227
227
|
resetTxt: "重置",
|
|
228
228
|
newTxt: "添加项",
|
|
229
229
|
mergeTxt: "合并",
|
|
230
|
-
...
|
|
231
|
-
},
|
|
230
|
+
...l.btnConfigs
|
|
231
|
+
}, e = {
|
|
232
232
|
hideReset: !1,
|
|
233
233
|
maxHeight: "600px",
|
|
234
234
|
allowFilter: !0,
|
|
@@ -236,15 +236,15 @@ const ke = /* @__PURE__ */ j({
|
|
|
236
236
|
showPad: !0,
|
|
237
237
|
retractLen: 0,
|
|
238
238
|
borderColors: [],
|
|
239
|
-
...
|
|
239
|
+
...l.configs
|
|
240
240
|
}, i = {
|
|
241
241
|
arraySplitSymbol: ",",
|
|
242
|
-
...
|
|
242
|
+
...l.dyListConfigs
|
|
243
243
|
}, y = (t) => ["string", "number"].includes(t), c = (t) => Object.keys(t).map((r, f) => {
|
|
244
244
|
let u = t[r];
|
|
245
|
-
const h = Array.isArray(u), T = h ? u.every((
|
|
245
|
+
const h = Array.isArray(u), T = h ? u.every((x) => typeof x == "number") : typeof u == "number", k = u === null;
|
|
246
246
|
return y(typeof u) && (u = t[r]), k && (u = ""), {
|
|
247
|
-
rId:
|
|
247
|
+
rId: l.randomFun(f),
|
|
248
248
|
key: r,
|
|
249
249
|
value: Object.prototype.toString.call(u) === "[object Object]" ? c(t[r]) : h ? u.join(i.arraySplitSymbol) : u,
|
|
250
250
|
isArray: h || void 0,
|
|
@@ -252,36 +252,36 @@ const ke = /* @__PURE__ */ j({
|
|
|
252
252
|
};
|
|
253
253
|
}), m = (t) => t.reduce((r, f) => {
|
|
254
254
|
const u = f.value;
|
|
255
|
-
return f.key.trim().length && (r[f.key] = Array.isArray(u) ? m(u) :
|
|
256
|
-
}, {}), a =
|
|
257
|
-
class: [`depth-${r}`,
|
|
255
|
+
return f.key.trim().length && (r[f.key] = Array.isArray(u) ? m(u) : te(f.value, f.isArray, f.isNumber, i.arraySplitSymbol)), r;
|
|
256
|
+
}, {}), a = A(c(l.modelValue)), v = (t, r = 1, f) => o("div", {
|
|
257
|
+
class: [`depth-${r}`, e.showBorder ? "" : "no-border", e.showPad ? "" : "no-pad"],
|
|
258
258
|
style: {
|
|
259
259
|
"--depth": r,
|
|
260
|
-
["--c" + [r]]:
|
|
260
|
+
["--c" + [r]]: ne(e.borderColors, r)
|
|
261
261
|
}
|
|
262
262
|
}, [t.map((u, h, T) => {
|
|
263
|
-
const k = Array.isArray(u.value),
|
|
263
|
+
const k = Array.isArray(u.value), x = y(typeof u.value);
|
|
264
264
|
return o("div", {
|
|
265
265
|
class: "dItem",
|
|
266
266
|
key: u.rId,
|
|
267
267
|
style: {
|
|
268
|
-
marginLeft: r > 1 ? `${r *
|
|
268
|
+
marginLeft: r > 1 ? `${r * e.retractLen}px` : "0"
|
|
269
269
|
}
|
|
270
270
|
}, [o("div", {
|
|
271
271
|
class: "input"
|
|
272
|
-
}, [!k && o(F, null, [o(
|
|
272
|
+
}, [!k && o(F, null, [o(N, {
|
|
273
273
|
value: u.key,
|
|
274
274
|
class: "key",
|
|
275
275
|
onInput: (g) => u.key = g
|
|
276
|
-
}, null), C(":")]), o(
|
|
276
|
+
}, null), C(":")]), o(N, {
|
|
277
277
|
class: `value ${k ? "isKey" : ""}`,
|
|
278
|
-
value:
|
|
278
|
+
value: x ? u.value : u.key,
|
|
279
279
|
onInput: (g) => {
|
|
280
280
|
if (k) {
|
|
281
281
|
u.key = g;
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
e.allowFilter && u.isNumber ? u.value = O(g, u.isArray, i.arraySplitSymbol) : u.value = g;
|
|
285
285
|
}
|
|
286
286
|
}, {
|
|
287
287
|
prefix: Array.isArray(u.value) ? void 0 : () => o(F, null, [o(p, {
|
|
@@ -303,17 +303,17 @@ const ke = /* @__PURE__ */ j({
|
|
|
303
303
|
})]),
|
|
304
304
|
suffix: () => {
|
|
305
305
|
let g;
|
|
306
|
-
return r <
|
|
306
|
+
return r < l.depth ? !k && o(p, {
|
|
307
307
|
type: "success",
|
|
308
308
|
size: "tiny",
|
|
309
309
|
onClick: () => {
|
|
310
|
-
|
|
311
|
-
rId:
|
|
310
|
+
x && (u.value = [], u.isArray = void 0), u.value.push({
|
|
311
|
+
rId: l.randomFun(),
|
|
312
312
|
key: "",
|
|
313
313
|
value: ""
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
|
-
}, ae(g =
|
|
316
|
+
}, ae(g = l.newChildTxt(u)) ? g : {
|
|
317
317
|
default: () => [g]
|
|
318
318
|
}) : null;
|
|
319
319
|
}
|
|
@@ -324,7 +324,7 @@ const ke = /* @__PURE__ */ j({
|
|
|
324
324
|
disabled: h !== T.length - 1,
|
|
325
325
|
onClick: () => {
|
|
326
326
|
t.push({
|
|
327
|
-
rId:
|
|
327
|
+
rId: l.randomFun(),
|
|
328
328
|
key: "",
|
|
329
329
|
value: ""
|
|
330
330
|
});
|
|
@@ -348,22 +348,22 @@ const ke = /* @__PURE__ */ j({
|
|
|
348
348
|
})]), Array.isArray(u.value) && v(u.value, r + 1, u)]);
|
|
349
349
|
})]);
|
|
350
350
|
return z(a, (t) => {
|
|
351
|
-
if (!
|
|
351
|
+
if (!l.isController) return;
|
|
352
352
|
const r = m(t);
|
|
353
353
|
s("update:modelValue", r), s("onMerge", r, S(a.value));
|
|
354
354
|
}, {
|
|
355
355
|
deep: !0
|
|
356
356
|
}), d({
|
|
357
357
|
onSet: (t) => {
|
|
358
|
-
a.value = c(t ??
|
|
358
|
+
a.value = c(t ?? l.modelValue);
|
|
359
359
|
},
|
|
360
360
|
getResult: (t = "res") => t === "ori" ? S(a.value) : m(a.value)
|
|
361
361
|
}), () => o("div", {
|
|
362
|
-
class:
|
|
362
|
+
class: l.dyCls ?? "dynamicCascadeForm"
|
|
363
363
|
}, [o("div", {
|
|
364
364
|
class: "dyFormList",
|
|
365
365
|
style: {
|
|
366
|
-
maxHeight:
|
|
366
|
+
maxHeight: e.maxHeight
|
|
367
367
|
}
|
|
368
368
|
}, [v(a.value)]), o("div", {
|
|
369
369
|
class: "control"
|
|
@@ -371,17 +371,17 @@ const ke = /* @__PURE__ */ j({
|
|
|
371
371
|
type: "success",
|
|
372
372
|
onClick: () => {
|
|
373
373
|
a.value.push({
|
|
374
|
-
rId:
|
|
374
|
+
rId: l.randomFun(),
|
|
375
375
|
key: "",
|
|
376
376
|
value: ""
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
}, {
|
|
380
380
|
default: () => [n.newTxt]
|
|
381
|
-
}), !
|
|
381
|
+
}), !l.isController && o(F, null, [!e.hideReset && o(p, {
|
|
382
382
|
type: "default",
|
|
383
383
|
onClick: () => {
|
|
384
|
-
a.value = c(
|
|
384
|
+
a.value = c(l.modelValue), s("onReset");
|
|
385
385
|
}
|
|
386
386
|
}, {
|
|
387
387
|
default: () => [n.resetTxt]
|
|
@@ -395,7 +395,7 @@ const ke = /* @__PURE__ */ j({
|
|
|
395
395
|
default: () => [n.mergeTxt]
|
|
396
396
|
})])])]);
|
|
397
397
|
}
|
|
398
|
-
}),
|
|
398
|
+
}), ke = /* @__PURE__ */ j({
|
|
399
399
|
name: "NaiDynamicForm",
|
|
400
400
|
props: {
|
|
401
401
|
formConfig: {
|
|
@@ -419,19 +419,19 @@ const ke = /* @__PURE__ */ j({
|
|
|
419
419
|
preset: {
|
|
420
420
|
type: String,
|
|
421
421
|
default: "fullRow",
|
|
422
|
-
validator: (
|
|
422
|
+
validator: (l) => ["fullRow", "grid"].includes(l) ? !0 : (console.error("preset value must be `fullRow` or `grid`, the default value is `fullRow`"), !1)
|
|
423
423
|
},
|
|
424
424
|
items: {
|
|
425
425
|
type: Array,
|
|
426
426
|
require: !0
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
|
-
setup(
|
|
429
|
+
setup(l, {
|
|
430
430
|
emit: s,
|
|
431
431
|
expose: d
|
|
432
432
|
}) {
|
|
433
|
-
const n =
|
|
434
|
-
...
|
|
433
|
+
const n = A(null), e = I(() => (l.items ?? []).filter((v) => !v.hidden)), i = I(() => e.value ? e.value.reduce((v, t) => (v[t.key] = t.value.value, v), {}) : {}), y = I(() => ({
|
|
434
|
+
...e.value?.reduce((t, r) => {
|
|
435
435
|
let f = r.rule;
|
|
436
436
|
return r.required && !r.rule && (f = {
|
|
437
437
|
required: !0,
|
|
@@ -439,13 +439,13 @@ const ke = /* @__PURE__ */ j({
|
|
|
439
439
|
trigger: ["blur"]
|
|
440
440
|
}), t[r.key] = f, t;
|
|
441
441
|
}, {}),
|
|
442
|
-
...
|
|
443
|
-
})), c =
|
|
442
|
+
...l.rules
|
|
443
|
+
})), c = I(() => [...e.value].sort((t, r) => {
|
|
444
444
|
const f = t.sort ?? 1 / 0, u = r.sort ?? 1 / 0;
|
|
445
445
|
return Number(f) - Number(u);
|
|
446
446
|
}));
|
|
447
447
|
function m(v = null) {
|
|
448
|
-
|
|
448
|
+
e.value && e.value.forEach((t) => {
|
|
449
449
|
t.reset ? t.reset(t) : t.value.value = v;
|
|
450
450
|
});
|
|
451
451
|
}
|
|
@@ -459,28 +459,28 @@ const ke = /* @__PURE__ */ j({
|
|
|
459
459
|
if (d({
|
|
460
460
|
reset: m,
|
|
461
461
|
validator: a,
|
|
462
|
-
getResult: (v = "res") => v === "ori" ?
|
|
463
|
-
}), !
|
|
462
|
+
getResult: (v = "res") => v === "ori" ? e.value : i.value
|
|
463
|
+
}), !l.items) throw new Error("prop items must be not null");
|
|
464
464
|
return () => o("div", {
|
|
465
465
|
class: "naiDynamicForm"
|
|
466
|
-
}, [o(
|
|
466
|
+
}, [o(U, G({
|
|
467
467
|
ref: n
|
|
468
|
-
},
|
|
468
|
+
}, l.formConfig, {
|
|
469
469
|
model: i.value,
|
|
470
470
|
rules: y.value
|
|
471
471
|
}), {
|
|
472
472
|
default() {
|
|
473
473
|
const v = c.value;
|
|
474
|
-
return
|
|
475
|
-
...
|
|
474
|
+
return l.preset === "grid" ? b(B, {
|
|
475
|
+
...l.gridConfig
|
|
476
476
|
}, {
|
|
477
|
-
default: () => v?.map((t) => b(
|
|
477
|
+
default: () => v?.map((t) => b(H, {
|
|
478
478
|
label: t.label,
|
|
479
479
|
path: t.path || t.key
|
|
480
480
|
}, {
|
|
481
481
|
default: V(t)
|
|
482
482
|
}))
|
|
483
|
-
}) : v?.map((t) => b(
|
|
483
|
+
}) : v?.map((t) => b(q, {
|
|
484
484
|
label: t.label,
|
|
485
485
|
path: t.path || t.key
|
|
486
486
|
}, {
|
|
@@ -490,73 +490,73 @@ const ke = /* @__PURE__ */ j({
|
|
|
490
490
|
})]);
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
|
-
function V(
|
|
493
|
+
function V(l) {
|
|
494
494
|
return function() {
|
|
495
|
-
return
|
|
495
|
+
return l.render2 ? l.render2(l) : null;
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
|
-
function ue(
|
|
499
|
-
return b(
|
|
498
|
+
function ue(l, s = {}, d) {
|
|
499
|
+
return b(N, {
|
|
500
500
|
...d,
|
|
501
|
-
value:
|
|
501
|
+
value: l.value,
|
|
502
502
|
onUpdateValue: (n) => {
|
|
503
|
-
|
|
503
|
+
l.value = n, d?.onChange?.(n, d);
|
|
504
504
|
},
|
|
505
505
|
...s
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
|
-
function oe(
|
|
509
|
-
return b(
|
|
508
|
+
function oe(l, s, d = {}, n) {
|
|
509
|
+
return b(_, {
|
|
510
510
|
...n,
|
|
511
|
-
value:
|
|
511
|
+
value: l.value,
|
|
512
512
|
options: s,
|
|
513
|
-
onUpdateValue: (
|
|
514
|
-
|
|
513
|
+
onUpdateValue: (e) => {
|
|
514
|
+
l.value = e, n?.onChange?.(e, n, s);
|
|
515
515
|
},
|
|
516
516
|
...d
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
|
-
function se(
|
|
519
|
+
function se(l, s, d = {}, n, e) {
|
|
520
520
|
const { value: i, labelField: y, valueField: c, ...m } = n, a = y ?? "label", v = c ?? "value", t = m.options ?? s;
|
|
521
521
|
return o(
|
|
522
|
-
|
|
522
|
+
E,
|
|
523
523
|
{
|
|
524
524
|
...m,
|
|
525
|
-
value:
|
|
525
|
+
value: l.value,
|
|
526
526
|
onUpdateValue: (r) => {
|
|
527
|
-
|
|
527
|
+
l.value = r, n?.onChange?.(r, n, t);
|
|
528
528
|
},
|
|
529
529
|
options: t.map((r) => ({ ...r, label: r[a], value: r[v] })),
|
|
530
530
|
...d
|
|
531
531
|
},
|
|
532
532
|
{
|
|
533
|
-
default: () =>
|
|
534
|
-
default: () =>
|
|
533
|
+
default: () => e ?? o(p, null, {
|
|
534
|
+
default: () => l.value || "请选择"
|
|
535
535
|
})
|
|
536
536
|
}
|
|
537
537
|
);
|
|
538
538
|
}
|
|
539
|
-
function ie(
|
|
540
|
-
const { valueField:
|
|
541
|
-
return b(
|
|
539
|
+
function ie(l, s, d = {}, n) {
|
|
540
|
+
const { valueField: e = "value", ...i } = n;
|
|
541
|
+
return b(K, {
|
|
542
542
|
...i,
|
|
543
|
-
value:
|
|
543
|
+
value: l.value,
|
|
544
544
|
options: s,
|
|
545
545
|
onUpdateValue: (y) => {
|
|
546
|
-
|
|
546
|
+
l.value = y, n?.onChange?.(y, n, s);
|
|
547
547
|
},
|
|
548
|
-
keyField:
|
|
548
|
+
keyField: e,
|
|
549
549
|
...d
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
|
-
function de(
|
|
552
|
+
function de(l, s, d = {}, n) {
|
|
553
553
|
return b(
|
|
554
554
|
w,
|
|
555
555
|
{
|
|
556
556
|
...n,
|
|
557
|
-
value:
|
|
558
|
-
onUpdateValue: (
|
|
559
|
-
|
|
557
|
+
value: l.value,
|
|
558
|
+
onUpdateValue: (e) => {
|
|
559
|
+
l.value = e, n?.onChange?.(e, n, s);
|
|
560
560
|
},
|
|
561
561
|
...d
|
|
562
562
|
},
|
|
@@ -564,7 +564,7 @@ function de(e, s, d = {}, n) {
|
|
|
564
564
|
default: () => (n?.options ?? s).map((i) => {
|
|
565
565
|
const y = n, c = i[y?.labelField ?? "label"], m = i[y?.valueField ?? "value"];
|
|
566
566
|
return b(
|
|
567
|
-
|
|
567
|
+
J,
|
|
568
568
|
{
|
|
569
569
|
...i,
|
|
570
570
|
label: c,
|
|
@@ -578,14 +578,14 @@ function de(e, s, d = {}, n) {
|
|
|
578
578
|
}
|
|
579
579
|
);
|
|
580
580
|
}
|
|
581
|
-
function ce(
|
|
581
|
+
function ce(l, s, d = {}, n) {
|
|
582
582
|
return o(
|
|
583
583
|
w,
|
|
584
584
|
{
|
|
585
585
|
...n,
|
|
586
|
-
value:
|
|
587
|
-
onUpdateValue: (
|
|
588
|
-
|
|
586
|
+
value: l.value,
|
|
587
|
+
onUpdateValue: (e) => {
|
|
588
|
+
l.value = e, n?.onChange?.(e, n, s);
|
|
589
589
|
},
|
|
590
590
|
...d
|
|
591
591
|
},
|
|
@@ -593,7 +593,7 @@ function ce(e, s, d = {}, n) {
|
|
|
593
593
|
default: () => (n?.options ?? s).map((i) => {
|
|
594
594
|
const y = n, c = i[y?.labelField ?? "label"], m = i[y?.valueField ?? "value"];
|
|
595
595
|
return o(
|
|
596
|
-
|
|
596
|
+
Q,
|
|
597
597
|
{
|
|
598
598
|
...i,
|
|
599
599
|
label: c,
|
|
@@ -607,27 +607,27 @@ function ce(e, s, d = {}, n) {
|
|
|
607
607
|
}
|
|
608
608
|
);
|
|
609
609
|
}
|
|
610
|
-
function ye(
|
|
610
|
+
function ye(l, s, d = {}, n) {
|
|
611
611
|
return b(
|
|
612
|
-
|
|
612
|
+
W,
|
|
613
613
|
{
|
|
614
614
|
...n,
|
|
615
|
-
value:
|
|
616
|
-
onUpdateValue: (
|
|
617
|
-
|
|
615
|
+
value: l.value,
|
|
616
|
+
onUpdateValue: (e) => {
|
|
617
|
+
l.value = e, n?.onChange?.(e, n, s);
|
|
618
618
|
},
|
|
619
619
|
...d
|
|
620
620
|
},
|
|
621
621
|
{
|
|
622
622
|
default: () => b(
|
|
623
|
-
|
|
623
|
+
X,
|
|
624
624
|
{
|
|
625
625
|
itemStyle: "display: flex"
|
|
626
626
|
},
|
|
627
627
|
{
|
|
628
628
|
default: () => (n?.options ?? s).map((i) => {
|
|
629
629
|
const y = n, c = i[y?.labelField ?? "label"], m = i[y?.valueField ?? "value"];
|
|
630
|
-
return b(
|
|
630
|
+
return b(Y, {
|
|
631
631
|
value: m,
|
|
632
632
|
label: c
|
|
633
633
|
});
|
|
@@ -637,68 +637,65 @@ function ye(e, s, d = {}, n) {
|
|
|
637
637
|
}
|
|
638
638
|
);
|
|
639
639
|
}
|
|
640
|
-
function ve(
|
|
641
|
-
return b(
|
|
640
|
+
function ve(l, s = {}, d) {
|
|
641
|
+
return b(Z, {
|
|
642
642
|
...d,
|
|
643
|
-
value:
|
|
643
|
+
value: l.value,
|
|
644
644
|
onUpdateValue: (n) => {
|
|
645
|
-
|
|
645
|
+
l.value = n, d?.onChange?.(n, d);
|
|
646
646
|
},
|
|
647
647
|
...s
|
|
648
648
|
});
|
|
649
649
|
}
|
|
650
|
-
function me(
|
|
651
|
-
return b(
|
|
650
|
+
function me(l, s = {}, d) {
|
|
651
|
+
return b(ee, {
|
|
652
652
|
...d,
|
|
653
|
-
value:
|
|
653
|
+
value: l.value,
|
|
654
654
|
onUpdateValue: (n) => {
|
|
655
|
-
|
|
655
|
+
l.value = n, d?.onChange?.(n, d);
|
|
656
656
|
},
|
|
657
657
|
...s
|
|
658
658
|
});
|
|
659
659
|
}
|
|
660
|
-
function fe(
|
|
661
|
-
return b(
|
|
660
|
+
function fe(l, s = {}, d) {
|
|
661
|
+
return b(le, {
|
|
662
662
|
...d,
|
|
663
|
-
value:
|
|
663
|
+
value: l.value,
|
|
664
664
|
onUpdateValue: (n) => {
|
|
665
|
-
|
|
665
|
+
l.value = n, d?.onChange?.(n, d);
|
|
666
666
|
},
|
|
667
667
|
...s
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
|
-
function
|
|
671
|
-
return U(e) ? e : N(e ?? null);
|
|
672
|
-
}
|
|
673
|
-
function Fe(e, s = !0) {
|
|
670
|
+
function Se(l, s = !0) {
|
|
674
671
|
const d = {
|
|
675
|
-
renderInput: (
|
|
676
|
-
renderSelect: (
|
|
677
|
-
renderPopSelect: (
|
|
678
|
-
renderTreeSelect: (
|
|
679
|
-
renderRadioGroup: (
|
|
680
|
-
renderRadioButtonGroup: (
|
|
681
|
-
renderCheckboxGroup: (
|
|
682
|
-
renderSwitch: (
|
|
683
|
-
renderDatePicker: (
|
|
684
|
-
renderTimePicker: (
|
|
672
|
+
renderInput: (e) => ue(e.value, e.renderProps ?? {}, e),
|
|
673
|
+
renderSelect: (e) => oe(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
674
|
+
renderPopSelect: (e) => se(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
675
|
+
renderTreeSelect: (e) => ie(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
676
|
+
renderRadioGroup: (e) => de(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
677
|
+
renderRadioButtonGroup: (e) => ce(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
678
|
+
renderCheckboxGroup: (e) => ye(e.value, e.options ?? [], e.renderProps ?? {}, e),
|
|
679
|
+
renderSwitch: (e) => ve(e.value, e.renderProps ?? {}, e),
|
|
680
|
+
renderDatePicker: (e) => me(e.value, e.renderProps ?? {}, e),
|
|
681
|
+
renderTimePicker: (e) => fe(e.value, e.renderProps ?? {}, e)
|
|
685
682
|
};
|
|
686
|
-
return
|
|
687
|
-
const i =
|
|
688
|
-
if (i.value =
|
|
689
|
-
i.render2 =
|
|
690
|
-
else if (
|
|
691
|
-
const y = d[
|
|
692
|
-
y ? i.render2 = () => y(i) : console.warn(`[useDecorateForm] unknown renderType: ${
|
|
683
|
+
return l.map((e) => {
|
|
684
|
+
const i = e;
|
|
685
|
+
if (i.value = re(e.value), typeof e.render2 == "function")
|
|
686
|
+
i.render2 = e.render2;
|
|
687
|
+
else if (e.renderType) {
|
|
688
|
+
const y = d[e.renderType];
|
|
689
|
+
y ? i.render2 = () => y(i) : console.warn(`[useDecorateForm] unknown renderType: ${e.renderType}`);
|
|
693
690
|
} else
|
|
694
691
|
i.render2 = () => d.renderInput(i);
|
|
695
692
|
return s ? M(i) : i;
|
|
696
693
|
});
|
|
697
694
|
}
|
|
698
695
|
export {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
696
|
+
he as NaiDynamicCascadeInput,
|
|
697
|
+
ke as NaiDynamicForm,
|
|
698
|
+
Ce as NaiDynamicInput,
|
|
702
699
|
ye as renderCheckboxGroup,
|
|
703
700
|
me as renderDatePicker,
|
|
704
701
|
ue as renderInput,
|
|
@@ -709,5 +706,5 @@ export {
|
|
|
709
706
|
ve as renderSwitch,
|
|
710
707
|
fe as renderTimePicker,
|
|
711
708
|
ie as renderTreeSelect,
|
|
712
|
-
|
|
709
|
+
Se as useDecorateForm
|
|
713
710
|
};
|