dynamicformdjx 0.4.1 → 0.4.3
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 +1 -6
- package/dist/elementPlus/EleDynamicCascadeInput.d.ts +3 -3
- package/dist/elementPlus/EleDynamicInput.d.ts +3 -3
- package/dist/elementPlus/hooks/renderForm.d.ts +42 -13
- package/dist/elementPlus/index.cjs +1 -1
- package/dist/elementPlus/index.mjs +563 -469
- package/dist/hooks/useDyForm.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.mjs +306 -252
- package/dist/naiveUi/NaiDynamicCascadeInput.d.ts +3 -3
- package/dist/naiveUi/NaiDynamicInput.d.ts +3 -3
- package/dist/naiveUi/hooks/renderForm.d.ts +19 -4
- package/dist/naiveUi/index.cjs +1 -1
- package/dist/naiveUi/index.mjs +542 -446
- package/dist/origin/DynamicCascadeInput.d.ts +3 -3
- package/dist/origin/DynamicInput.d.ts +3 -3
- package/dist/types/form.d.ts +2 -2
- package/dist/types/index.d.ts +38 -0
- package/dist/utils/tools.d.ts +3 -1
- package/package.json +2 -2
package/dist/naiveUi/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { NInput as
|
|
3
|
-
import { t as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as D, ref as j, watch as $, toRaw as A, createVNode as s, createTextVNode as S, Fragment as x, nextTick as H, isVNode as _, computed as B, h, mergeProps as q, shallowReactive as E } from "vue";
|
|
2
|
+
import { NInput as w, NButton as C, NForm as K, NGrid as J, NFormItemGridItem as Q, NFormItem as W, NSelect as X, NPopselect as Y, NTreeSelect as Z, NRadioGroup as L, NRadio as ee, NRadioButton as ne, NCheckboxGroup as te, NSpace as re, NCheckbox as U, NSwitch as le, NDatePicker as ae, NTimePicker as ue, NDynamicTags as oe, NSlider as se, NInputNumber as ie } from "naive-ui";
|
|
3
|
+
import { t as P, r as z, f as G, p as de, s as ce, e as ve } from "../index-MF72-iEr.js";
|
|
4
|
+
const je = /* @__PURE__ */ D({
|
|
5
5
|
name: "NaiDynamicInput",
|
|
6
6
|
props: {
|
|
7
7
|
size: {
|
|
@@ -15,7 +15,7 @@ const ke = /* @__PURE__ */ j({
|
|
|
15
15
|
},
|
|
16
16
|
randomFun: {
|
|
17
17
|
type: Function,
|
|
18
|
-
default: (
|
|
18
|
+
default: (e) => `${Date.now()}_${e ?? 0}`
|
|
19
19
|
},
|
|
20
20
|
btnConfigs: {
|
|
21
21
|
type: Object
|
|
@@ -32,153 +32,170 @@ const ke = /* @__PURE__ */ j({
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
emits: {
|
|
35
|
-
"update:modelValue": (
|
|
35
|
+
"update:modelValue": (e) => !0,
|
|
36
36
|
onReset: () => !0,
|
|
37
|
-
onMerge: (
|
|
37
|
+
onMerge: (e, a) => !0
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
slots: Object,
|
|
40
|
+
setup(e, {
|
|
41
|
+
emit: a,
|
|
42
|
+
expose: l,
|
|
43
|
+
slots: t
|
|
42
44
|
}) {
|
|
43
45
|
const u = {
|
|
44
46
|
resetTxt: "重置",
|
|
45
47
|
newTxt: "添加项",
|
|
46
48
|
mergeTxt: "合并",
|
|
47
|
-
...
|
|
49
|
+
...e.btnConfigs
|
|
48
50
|
}, r = {
|
|
49
51
|
hideReset: !1,
|
|
50
52
|
maxHeight: "300px",
|
|
51
53
|
autoScroll: !0,
|
|
52
54
|
allowFilter: !0,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
hideArrayBtn: !1,
|
|
56
|
+
hideNumberBtn: !1,
|
|
57
|
+
...e.configs
|
|
58
|
+
}, v = {
|
|
55
59
|
arraySplitSymbol: ",",
|
|
56
|
-
...
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
...e.dyListConfigs
|
|
61
|
+
}, n = e.size, i = j(P(e.modelValue, e.randomFun, v.arraySplitSymbol)), b = j(null);
|
|
62
|
+
$(i, (c) => {
|
|
63
|
+
if (!e.isController) return;
|
|
64
|
+
const k = z(c, v.arraySplitSymbol);
|
|
65
|
+
a("update:modelValue", k), a("onMerge", k, A(i.value));
|
|
62
66
|
}, {
|
|
63
67
|
deep: !0
|
|
64
|
-
}),
|
|
65
|
-
onSet: (
|
|
66
|
-
|
|
68
|
+
}), l({
|
|
69
|
+
onSet: (c) => {
|
|
70
|
+
i.value = P(c ?? e.modelValue, e.randomFun, v.arraySplitSymbol);
|
|
67
71
|
},
|
|
68
|
-
getResult: (
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
getResult: (c = "res") => c === "ori" ? A(i.value) : z(i.value, v.arraySplitSymbol)
|
|
73
|
+
});
|
|
74
|
+
const o = () => i.value.push({
|
|
75
|
+
rId: e.randomFun(),
|
|
76
|
+
key: "",
|
|
77
|
+
value: ""
|
|
78
|
+
}), y = () => {
|
|
79
|
+
i.value = P(e.modelValue, e.randomFun, v.arraySplitSymbol), a("onReset");
|
|
80
|
+
}, g = () => {
|
|
81
|
+
i.value.sort((k, f) => +k.rId - +f.rId);
|
|
82
|
+
const c = z(i.value, v.arraySplitSymbol);
|
|
83
|
+
a("update:modelValue", c), a("onMerge", c, A(i.value)), i.value = P(c, e.randomFun, v.arraySplitSymbol);
|
|
84
|
+
};
|
|
85
|
+
return () => s("div", {
|
|
86
|
+
class: `dynamicForm ${n} ${e.dyCls}`
|
|
87
|
+
}, [s("div", {
|
|
88
|
+
class: `dyFormList ${i.value.length ? "" : "noList"}`,
|
|
89
|
+
ref: b,
|
|
74
90
|
style: {
|
|
75
91
|
maxHeight: r.maxHeight
|
|
76
92
|
}
|
|
77
|
-
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
}, [i.value.map((c, k, f) => {
|
|
94
|
+
const m = {
|
|
95
|
+
row: c,
|
|
96
|
+
index: k,
|
|
97
|
+
isLast: k === f.length - 1,
|
|
98
|
+
addItem: () => {
|
|
99
|
+
i.value.push({
|
|
100
|
+
rId: e.randomFun(),
|
|
101
|
+
key: "",
|
|
102
|
+
value: ""
|
|
103
|
+
}), r.autoScroll && H(() => {
|
|
104
|
+
const p = b.value;
|
|
105
|
+
p?.scrollTo({
|
|
106
|
+
top: p.scrollHeight,
|
|
107
|
+
behavior: "smooth"
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
removeItem: () => {
|
|
112
|
+
i.value = i.value.filter((p) => p.rId !== c.rId);
|
|
113
|
+
},
|
|
114
|
+
toggleArray: () => c.isArray = !c.isArray,
|
|
115
|
+
toggleNumber: () => c.isNumber = !c.isNumber
|
|
116
|
+
};
|
|
117
|
+
return s("div", {
|
|
118
|
+
class: "dItem",
|
|
119
|
+
key: c.rId
|
|
120
|
+
}, [s("div", {
|
|
121
|
+
class: "input"
|
|
122
|
+
}, [s(w, {
|
|
123
|
+
size: n,
|
|
124
|
+
value: c.key,
|
|
125
|
+
class: "key",
|
|
126
|
+
onInput: (p) => {
|
|
127
|
+
c.key = p;
|
|
102
128
|
}
|
|
103
|
-
}, {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
n.isNumber = !n.isNumber;
|
|
129
|
+
}, null), S(":"), s(w, {
|
|
130
|
+
size: n,
|
|
131
|
+
value: c.value,
|
|
132
|
+
class: "value",
|
|
133
|
+
onInput: (p) => {
|
|
134
|
+
r.allowFilter && c.isNumber ? c.value = G(p, c.isArray, v.arraySplitSymbol) : c.value = p;
|
|
110
135
|
}
|
|
111
136
|
}, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
size:
|
|
137
|
+
prefix: () => t.typeTools ? t.typeTools(m) : s(x, null, [!r.hideArrayBtn && s(C, {
|
|
138
|
+
type: c.isArray ? "success" : "default",
|
|
139
|
+
size: "tiny",
|
|
140
|
+
onClick: m.toggleArray
|
|
141
|
+
}, {
|
|
142
|
+
default: () => [S("Array")]
|
|
143
|
+
}), S(" "), !r.hideNumberBtn && s(C, {
|
|
144
|
+
type: c.isNumber ? "success" : "default",
|
|
145
|
+
size: "tiny",
|
|
146
|
+
onClick: m.toggleNumber
|
|
147
|
+
}, {
|
|
148
|
+
default: () => [S("Number")]
|
|
149
|
+
})])
|
|
150
|
+
})]), s("div", {
|
|
151
|
+
class: "btn"
|
|
152
|
+
}, [t.rowActions ? t.rowActions(m) : s(x, null, [s(C, {
|
|
153
|
+
type: "success",
|
|
154
|
+
size: n,
|
|
155
|
+
disabled: !m.isLast,
|
|
156
|
+
onClick: m.addItem
|
|
157
|
+
}, {
|
|
158
|
+
default: () => [S("+")]
|
|
159
|
+
}), s(C, {
|
|
160
|
+
size: n,
|
|
161
|
+
type: "error",
|
|
162
|
+
onClick: m.removeItem
|
|
163
|
+
}, {
|
|
164
|
+
default: () => [S("-")]
|
|
165
|
+
})])])]);
|
|
166
|
+
})]), s("div", {
|
|
167
|
+
class: `control ${i.value.length ? "" : "noList"}`
|
|
168
|
+
}, [!i.value.length && (t.newBtn ? t.newBtn({
|
|
169
|
+
newItem: o
|
|
170
|
+
}) : s(C, {
|
|
171
|
+
size: n,
|
|
147
172
|
type: "success",
|
|
148
|
-
onClick:
|
|
149
|
-
e.value.push({
|
|
150
|
-
rId: t.randomFun(),
|
|
151
|
-
key: "",
|
|
152
|
-
value: ""
|
|
153
|
-
});
|
|
154
|
-
}
|
|
173
|
+
onClick: o
|
|
155
174
|
}, {
|
|
156
175
|
default: () => [u.newTxt]
|
|
157
|
-
}), !
|
|
158
|
-
|
|
176
|
+
})), !e.isController && s(x, null, [!r.hideReset && (t.resetBtn ? t.resetBtn({
|
|
177
|
+
reset: y
|
|
178
|
+
}) : s(C, {
|
|
179
|
+
size: n,
|
|
159
180
|
type: "default",
|
|
160
|
-
onClick:
|
|
161
|
-
e.value = I(t.modelValue, t.randomFun, d.arraySplitSymbol), i("onReset");
|
|
162
|
-
}
|
|
181
|
+
onClick: y
|
|
163
182
|
}, {
|
|
164
183
|
default: () => [u.resetTxt]
|
|
165
|
-
}),
|
|
166
|
-
|
|
184
|
+
})), t.mergeBtn ? t.mergeBtn({
|
|
185
|
+
merge: g
|
|
186
|
+
}) : s(C, {
|
|
187
|
+
size: n,
|
|
167
188
|
type: "info",
|
|
168
|
-
onClick:
|
|
169
|
-
e.value.sort((v, l) => +v.rId - +l.rId);
|
|
170
|
-
const n = A(e.value, d.arraySplitSymbol);
|
|
171
|
-
i("update:modelValue", n), i("onMerge", n, S(e.value)), e.value = I(n, t.randomFun, d.arraySplitSymbol);
|
|
172
|
-
}
|
|
189
|
+
onClick: g
|
|
173
190
|
}, {
|
|
174
191
|
default: () => [u.mergeTxt]
|
|
175
192
|
})])])]);
|
|
176
193
|
}
|
|
177
194
|
});
|
|
178
|
-
function
|
|
179
|
-
return typeof
|
|
195
|
+
function ye(e) {
|
|
196
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !_(e);
|
|
180
197
|
}
|
|
181
|
-
const
|
|
198
|
+
const Oe = /* @__PURE__ */ D({
|
|
182
199
|
name: "NaiveUiDynamicCascadeInput",
|
|
183
200
|
props: {
|
|
184
201
|
modelValue: {
|
|
@@ -193,7 +210,7 @@ const Se = /* @__PURE__ */ j({
|
|
|
193
210
|
},
|
|
194
211
|
randomFun: {
|
|
195
212
|
type: Function,
|
|
196
|
-
default: (
|
|
213
|
+
default: (e) => `${Date.now()}_${e ?? 0}`
|
|
197
214
|
},
|
|
198
215
|
// 子层深度 (超过则不再出现添加选项)
|
|
199
216
|
depth: {
|
|
@@ -211,191 +228,212 @@ const Se = /* @__PURE__ */ j({
|
|
|
211
228
|
},
|
|
212
229
|
newChildTxt: {
|
|
213
230
|
type: Function,
|
|
214
|
-
default: (
|
|
231
|
+
default: (e) => `添加 '${e.key}' 子项`
|
|
215
232
|
}
|
|
216
233
|
},
|
|
217
234
|
emits: {
|
|
218
|
-
"update:modelValue": (
|
|
235
|
+
"update:modelValue": (e) => !0,
|
|
219
236
|
onReset: () => !0,
|
|
220
|
-
onMerge: (
|
|
237
|
+
onMerge: (e, a) => !0
|
|
221
238
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
239
|
+
slots: Object,
|
|
240
|
+
setup(e, {
|
|
241
|
+
emit: a,
|
|
242
|
+
expose: l,
|
|
243
|
+
slots: t
|
|
225
244
|
}) {
|
|
226
245
|
const u = {
|
|
227
246
|
resetTxt: "重置",
|
|
228
247
|
newTxt: "添加项",
|
|
229
248
|
mergeTxt: "合并",
|
|
230
|
-
...
|
|
249
|
+
...e.btnConfigs
|
|
231
250
|
}, r = {
|
|
232
251
|
hideReset: !1,
|
|
233
252
|
maxHeight: "600px",
|
|
234
253
|
allowFilter: !0,
|
|
235
254
|
showBorder: !0,
|
|
255
|
+
hideArrayBtn: !1,
|
|
256
|
+
hideNumberBtn: !1,
|
|
236
257
|
showPad: !0,
|
|
237
258
|
retractLen: 0,
|
|
238
259
|
borderColors: [],
|
|
239
|
-
...
|
|
240
|
-
},
|
|
260
|
+
...e.configs
|
|
261
|
+
}, v = {
|
|
241
262
|
arraySplitSymbol: ",",
|
|
242
|
-
...
|
|
243
|
-
},
|
|
244
|
-
let
|
|
245
|
-
const
|
|
246
|
-
return
|
|
247
|
-
rId:
|
|
248
|
-
key:
|
|
249
|
-
value: Object.prototype.toString.call(
|
|
250
|
-
isArray:
|
|
251
|
-
isNumber:
|
|
263
|
+
...e.dyListConfigs
|
|
264
|
+
}, n = (f) => ["string", "number"].includes(f), i = (f) => Object.keys(f).map((m, p) => {
|
|
265
|
+
let d = f[m];
|
|
266
|
+
const F = Array.isArray(d), O = F ? d.every((T) => typeof T == "number") : typeof d == "number", R = d === null;
|
|
267
|
+
return n(typeof d) && (d = f[m]), R && (d = ""), {
|
|
268
|
+
rId: e.randomFun(p),
|
|
269
|
+
key: m,
|
|
270
|
+
value: Object.prototype.toString.call(d) === "[object Object]" ? i(f[m]) : F ? d.join(v.arraySplitSymbol) : d,
|
|
271
|
+
isArray: F || void 0,
|
|
272
|
+
isNumber: O || void 0
|
|
252
273
|
};
|
|
253
|
-
}),
|
|
254
|
-
const
|
|
255
|
-
return
|
|
256
|
-
}, {}),
|
|
257
|
-
class: [`depth-${
|
|
274
|
+
}), b = (f) => f.reduce((m, p) => {
|
|
275
|
+
const d = p.value;
|
|
276
|
+
return p.key.trim().length && (m[p.key] = Array.isArray(d) ? b(d) : de(p.value, p.isArray, p.isNumber, v.arraySplitSymbol)), m;
|
|
277
|
+
}, {}), o = j(i(e.modelValue)), y = (f, m = 1, p) => s("div", {
|
|
278
|
+
class: [`depth-${m}`, r.showBorder ? "" : "no-border", r.showPad ? "" : "no-pad"],
|
|
258
279
|
style: {
|
|
259
|
-
"--depth":
|
|
260
|
-
["--c" + [
|
|
280
|
+
"--depth": m,
|
|
281
|
+
["--c" + [m]]: ce(r.borderColors, m)
|
|
261
282
|
}
|
|
262
|
-
}, [
|
|
263
|
-
const
|
|
264
|
-
|
|
283
|
+
}, [f.map((d, F, O) => {
|
|
284
|
+
const R = Array.isArray(d.value), T = n(typeof d.value), I = {
|
|
285
|
+
row: d,
|
|
286
|
+
index: F,
|
|
287
|
+
isLast: F === O.length - 1,
|
|
288
|
+
addItem: () => {
|
|
289
|
+
f.push({
|
|
290
|
+
rId: e.randomFun(),
|
|
291
|
+
key: "",
|
|
292
|
+
value: ""
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
addChild: () => {
|
|
296
|
+
T && (d.value = [], d.isArray = void 0), d.value.push({
|
|
297
|
+
rId: e.randomFun(),
|
|
298
|
+
key: "",
|
|
299
|
+
value: ""
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
removeItem: () => {
|
|
303
|
+
if (f.splice(F, 1), f.length < 1) {
|
|
304
|
+
if (p === void 0) return b([]);
|
|
305
|
+
const N = o.value.findIndex((M) => M.rId === p?.rId);
|
|
306
|
+
m < 1 ? o.value.splice(N, 1, {
|
|
307
|
+
...p,
|
|
308
|
+
value: ""
|
|
309
|
+
}) : p.value = "";
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
toggleArray: () => d.isArray = !d.isArray,
|
|
313
|
+
toggleNumber: () => d.isNumber = !d.isNumber
|
|
314
|
+
};
|
|
315
|
+
return s("div", {
|
|
265
316
|
class: "dItem",
|
|
266
|
-
key:
|
|
317
|
+
key: d.rId,
|
|
267
318
|
style: {
|
|
268
|
-
marginLeft:
|
|
319
|
+
marginLeft: m > 1 ? `${m * r.retractLen}px` : "0"
|
|
269
320
|
}
|
|
270
|
-
}, [
|
|
321
|
+
}, [s("div", {
|
|
271
322
|
class: "input"
|
|
272
|
-
}, [!
|
|
273
|
-
value:
|
|
323
|
+
}, [!R && s(x, null, [s(w, {
|
|
324
|
+
value: d.key,
|
|
274
325
|
class: "key",
|
|
275
|
-
onInput: (
|
|
276
|
-
}, null),
|
|
277
|
-
class: `value ${
|
|
278
|
-
value:
|
|
279
|
-
onInput: (
|
|
280
|
-
if (
|
|
281
|
-
|
|
326
|
+
onInput: (N) => d.key = N
|
|
327
|
+
}, null), S(":")]), s(w, {
|
|
328
|
+
class: `value ${R ? "isKey" : ""}`,
|
|
329
|
+
value: T ? d.value : d.key,
|
|
330
|
+
onInput: (N) => {
|
|
331
|
+
if (R) {
|
|
332
|
+
d.key = N;
|
|
282
333
|
return;
|
|
283
334
|
}
|
|
284
|
-
r.allowFilter &&
|
|
335
|
+
r.allowFilter && d.isNumber ? d.value = G(N, d.isArray, v.arraySplitSymbol) : d.value = N;
|
|
285
336
|
}
|
|
286
337
|
}, {
|
|
287
|
-
prefix: Array.isArray(
|
|
288
|
-
type:
|
|
338
|
+
prefix: Array.isArray(d.value) ? void 0 : () => t.typeTools ? t.typeTools(I) : s(x, null, [!r.hideArrayBtn && s(C, {
|
|
339
|
+
type: d.isArray ? "success" : "default",
|
|
289
340
|
size: "tiny",
|
|
290
|
-
onClick:
|
|
291
|
-
s.isArray = !s.isArray;
|
|
292
|
-
}
|
|
341
|
+
onClick: I.toggleArray
|
|
293
342
|
}, {
|
|
294
|
-
default: () => [
|
|
295
|
-
}),
|
|
296
|
-
type:
|
|
343
|
+
default: () => [S("Array")]
|
|
344
|
+
}), S(" "), !r.hideNumberBtn && s(C, {
|
|
345
|
+
type: d.isNumber ? "success" : "default",
|
|
297
346
|
size: "tiny",
|
|
298
|
-
onClick:
|
|
299
|
-
s.isNumber = !s.isNumber;
|
|
300
|
-
}
|
|
347
|
+
onClick: I.toggleNumber
|
|
301
348
|
}, {
|
|
302
|
-
default: () => [
|
|
349
|
+
default: () => [S("Number")]
|
|
303
350
|
})]),
|
|
304
351
|
suffix: () => {
|
|
305
|
-
let
|
|
306
|
-
return
|
|
352
|
+
let N;
|
|
353
|
+
return m < e.depth ? !R && (t.newChild ? t.newChild(I) : s(C, {
|
|
307
354
|
type: "success",
|
|
308
355
|
size: "tiny",
|
|
309
356
|
onClick: () => {
|
|
310
|
-
|
|
311
|
-
rId:
|
|
357
|
+
T && (d.value = [], d.isArray = void 0), d.value.push({
|
|
358
|
+
rId: e.randomFun(),
|
|
312
359
|
key: "",
|
|
313
360
|
value: ""
|
|
314
361
|
});
|
|
315
362
|
}
|
|
316
|
-
},
|
|
317
|
-
default: () => [
|
|
318
|
-
}) : null;
|
|
363
|
+
}, ye(N = e.newChildTxt(d)) ? N : {
|
|
364
|
+
default: () => [N]
|
|
365
|
+
})) : null;
|
|
319
366
|
}
|
|
320
|
-
})]),
|
|
367
|
+
})]), s("div", {
|
|
321
368
|
class: "btn"
|
|
322
|
-
}, [
|
|
369
|
+
}, [t.rowActions ? t.rowActions(I) : s(x, null, [s(C, {
|
|
323
370
|
type: "success",
|
|
324
|
-
disabled:
|
|
325
|
-
onClick:
|
|
326
|
-
l.push({
|
|
327
|
-
rId: t.randomFun(),
|
|
328
|
-
key: "",
|
|
329
|
-
value: ""
|
|
330
|
-
});
|
|
331
|
-
}
|
|
371
|
+
disabled: !I.isLast,
|
|
372
|
+
onClick: I.addItem
|
|
332
373
|
}, {
|
|
333
|
-
default: () => [
|
|
334
|
-
}),
|
|
374
|
+
default: () => [S("+")]
|
|
375
|
+
}), s(C, {
|
|
335
376
|
type: "error",
|
|
336
|
-
onClick:
|
|
337
|
-
if (l.splice(C, 1), l.length < 1) {
|
|
338
|
-
if (f === void 0) return m([]);
|
|
339
|
-
const g = n.value.findIndex((D) => D.rId === f?.rId);
|
|
340
|
-
a < 1 ? n.value.splice(g, 1, {
|
|
341
|
-
...f,
|
|
342
|
-
value: ""
|
|
343
|
-
}) : f.value = "";
|
|
344
|
-
}
|
|
345
|
-
}
|
|
377
|
+
onClick: I.removeItem
|
|
346
378
|
}, {
|
|
347
|
-
default: () => [
|
|
348
|
-
})]), Array.isArray(
|
|
379
|
+
default: () => [S("-")]
|
|
380
|
+
})])]), Array.isArray(d.value) && y(d.value, m + 1, d)]);
|
|
349
381
|
})]);
|
|
350
|
-
|
|
351
|
-
if (!
|
|
352
|
-
const
|
|
353
|
-
|
|
382
|
+
$(o, (f) => {
|
|
383
|
+
if (!e.isController) return;
|
|
384
|
+
const m = b(f);
|
|
385
|
+
a("update:modelValue", m), a("onMerge", m, A(o.value));
|
|
354
386
|
}, {
|
|
355
387
|
deep: !0
|
|
356
|
-
}),
|
|
357
|
-
onSet: (
|
|
358
|
-
|
|
388
|
+
}), l({
|
|
389
|
+
onSet: (f) => {
|
|
390
|
+
o.value = i(f ?? e.modelValue);
|
|
359
391
|
},
|
|
360
|
-
getResult: (
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
392
|
+
getResult: (f = "res") => f === "ori" ? A(o.value) : b(o.value)
|
|
393
|
+
});
|
|
394
|
+
const g = () => o.value.push({
|
|
395
|
+
rId: e.randomFun(),
|
|
396
|
+
key: "",
|
|
397
|
+
value: ""
|
|
398
|
+
}), c = () => {
|
|
399
|
+
o.value = i(e.modelValue), a("onReset");
|
|
400
|
+
}, k = () => {
|
|
401
|
+
const f = b(o.value);
|
|
402
|
+
a("update:modelValue", f), a("onMerge", f, A(o.value)), o.value = i(f);
|
|
403
|
+
};
|
|
404
|
+
return () => s("div", {
|
|
405
|
+
class: `dynamicCascadeForm ${e.dyCls}`
|
|
406
|
+
}, [s("div", {
|
|
407
|
+
class: `dyFormList ${o.value.length ? "" : "noObj"}`,
|
|
365
408
|
style: {
|
|
366
409
|
maxHeight: r.maxHeight
|
|
367
410
|
}
|
|
368
|
-
}, [
|
|
369
|
-
class:
|
|
370
|
-
}, [!
|
|
411
|
+
}, [y(o.value)]), s("div", {
|
|
412
|
+
class: `control ${o.value.length ? "" : "noObj"}`
|
|
413
|
+
}, [!o.value.length && (t.newBtn ? t.newBtn({
|
|
414
|
+
newItem: g
|
|
415
|
+
}) : s(C, {
|
|
371
416
|
type: "success",
|
|
372
|
-
onClick:
|
|
373
|
-
n.value.push({
|
|
374
|
-
rId: t.randomFun(),
|
|
375
|
-
key: "",
|
|
376
|
-
value: ""
|
|
377
|
-
});
|
|
378
|
-
}
|
|
417
|
+
onClick: g
|
|
379
418
|
}, {
|
|
380
419
|
default: () => [u.newTxt]
|
|
381
|
-
}), !
|
|
420
|
+
})), !e.isController && s(x, null, [!r.hideReset && (t.resetBtn ? t.resetBtn({
|
|
421
|
+
reset: c
|
|
422
|
+
}) : s(C, {
|
|
382
423
|
type: "default",
|
|
383
|
-
onClick:
|
|
384
|
-
n.value = e(t.modelValue), i("onReset");
|
|
385
|
-
}
|
|
424
|
+
onClick: c
|
|
386
425
|
}, {
|
|
387
426
|
default: () => [u.resetTxt]
|
|
388
|
-
}),
|
|
427
|
+
})), t.mergeBtn ? t.mergeBtn({
|
|
428
|
+
merge: k
|
|
429
|
+
}) : s(C, {
|
|
389
430
|
type: "info",
|
|
390
|
-
onClick:
|
|
391
|
-
const l = m(n.value);
|
|
392
|
-
i("update:modelValue", l), i("onMerge", l, S(n.value)), n.value = e(l);
|
|
393
|
-
}
|
|
431
|
+
onClick: k
|
|
394
432
|
}, {
|
|
395
433
|
default: () => [u.mergeTxt]
|
|
396
434
|
})])])]);
|
|
397
435
|
}
|
|
398
|
-
}),
|
|
436
|
+
}), ze = /* @__PURE__ */ D({
|
|
399
437
|
name: "NaiDynamicForm",
|
|
400
438
|
props: {
|
|
401
439
|
formConfig: {
|
|
@@ -419,7 +457,7 @@ const Se = /* @__PURE__ */ j({
|
|
|
419
457
|
preset: {
|
|
420
458
|
type: String,
|
|
421
459
|
default: "fullRow",
|
|
422
|
-
validator: (
|
|
460
|
+
validator: (e) => ["fullRow", "grid"].includes(e) ? !0 : (console.error("preset value must be `fullRow` or `grid`, the default value is `fullRow`"), !1)
|
|
423
461
|
},
|
|
424
462
|
items: {
|
|
425
463
|
type: Array,
|
|
@@ -427,221 +465,221 @@ const Se = /* @__PURE__ */ j({
|
|
|
427
465
|
}
|
|
428
466
|
},
|
|
429
467
|
slots: Object,
|
|
430
|
-
setup(
|
|
431
|
-
expose:
|
|
432
|
-
slots:
|
|
468
|
+
setup(e, {
|
|
469
|
+
expose: a,
|
|
470
|
+
slots: l
|
|
433
471
|
}) {
|
|
434
|
-
const
|
|
435
|
-
...
|
|
436
|
-
let
|
|
437
|
-
return
|
|
472
|
+
const t = j(null), u = B(() => (e.items ?? []).filter((o) => !o.hidden)), r = B(() => u.value ? u.value.reduce((o, y) => (o[y.key] = y.value.value, o), {}) : {}), v = B(() => ({
|
|
473
|
+
...u.value?.reduce((y, g) => {
|
|
474
|
+
let c = g.rule;
|
|
475
|
+
return g.required && !g.rule && (c = {
|
|
438
476
|
required: !0,
|
|
439
|
-
message:
|
|
477
|
+
message: g.requiredHint?.(g?.label ?? "") ?? `${g.label}不能为空`,
|
|
440
478
|
trigger: ["blur"]
|
|
441
|
-
}),
|
|
479
|
+
}), y[g.key] = c, y;
|
|
442
480
|
}, {}),
|
|
443
|
-
...
|
|
444
|
-
})),
|
|
445
|
-
const
|
|
446
|
-
return Number(
|
|
481
|
+
...e.rules
|
|
482
|
+
})), n = B(() => [...u.value].sort((y, g) => {
|
|
483
|
+
const c = y.sort ?? 1 / 0, k = g.sort ?? 1 / 0;
|
|
484
|
+
return Number(c) - Number(k);
|
|
447
485
|
}));
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
486
|
+
function i(o = null) {
|
|
487
|
+
u.value && u.value.forEach((y) => {
|
|
488
|
+
y.value.value = o;
|
|
451
489
|
});
|
|
452
490
|
}
|
|
453
|
-
function
|
|
454
|
-
return new Promise((
|
|
455
|
-
|
|
456
|
-
|
|
491
|
+
function b() {
|
|
492
|
+
return new Promise((o, y) => {
|
|
493
|
+
t.value?.validate((g) => {
|
|
494
|
+
g ? y(g) : o(r.value);
|
|
457
495
|
});
|
|
458
496
|
});
|
|
459
497
|
}
|
|
460
|
-
if (
|
|
461
|
-
reset:
|
|
462
|
-
validator:
|
|
463
|
-
getResult: (
|
|
464
|
-
}), !
|
|
465
|
-
return () =>
|
|
498
|
+
if (a({
|
|
499
|
+
reset: i,
|
|
500
|
+
validator: b,
|
|
501
|
+
getResult: (o = "res") => o === "ori" ? u.value : r.value
|
|
502
|
+
}), !e.items) throw new Error("prop items must be not null");
|
|
503
|
+
return () => s("div", {
|
|
466
504
|
class: "naiDynamicForm"
|
|
467
|
-
}, [
|
|
505
|
+
}, [l.header && s("div", {
|
|
468
506
|
class: "header"
|
|
469
|
-
}, [
|
|
470
|
-
ref:
|
|
471
|
-
},
|
|
472
|
-
model:
|
|
473
|
-
rules:
|
|
507
|
+
}, [l.header?.()]), s(K, q({
|
|
508
|
+
ref: t
|
|
509
|
+
}, e.formConfig, {
|
|
510
|
+
model: r.value,
|
|
511
|
+
rules: v.value
|
|
474
512
|
}), {
|
|
475
513
|
default() {
|
|
476
|
-
const
|
|
477
|
-
return
|
|
478
|
-
...
|
|
514
|
+
const o = n.value;
|
|
515
|
+
return e.preset === "grid" ? h(J, {
|
|
516
|
+
...e.gridConfig
|
|
479
517
|
}, {
|
|
480
|
-
default: () =>
|
|
481
|
-
label:
|
|
482
|
-
path:
|
|
483
|
-
span:
|
|
484
|
-
offset:
|
|
518
|
+
default: () => o?.map((y) => h(Q, {
|
|
519
|
+
label: y.label,
|
|
520
|
+
path: y.path || y.key,
|
|
521
|
+
span: y.span ?? 24,
|
|
522
|
+
offset: y.offset ?? 0
|
|
485
523
|
}, {
|
|
486
|
-
default:
|
|
524
|
+
default: V(y)
|
|
487
525
|
}))
|
|
488
|
-
}) :
|
|
489
|
-
label:
|
|
490
|
-
path:
|
|
526
|
+
}) : o?.map((y) => h(W, {
|
|
527
|
+
label: y.label,
|
|
528
|
+
path: y.path || y.key
|
|
491
529
|
}, {
|
|
492
|
-
default:
|
|
530
|
+
default: V(y)
|
|
493
531
|
}));
|
|
494
532
|
}
|
|
495
|
-
}),
|
|
533
|
+
}), l.footer && h("div", {
|
|
496
534
|
class: "footer"
|
|
497
|
-
},
|
|
535
|
+
}, l.footer?.())]);
|
|
498
536
|
}
|
|
499
537
|
});
|
|
500
|
-
function
|
|
538
|
+
function V(e) {
|
|
501
539
|
return function() {
|
|
502
|
-
return
|
|
540
|
+
return e.render2 ? e.render2(e) : null;
|
|
503
541
|
};
|
|
504
542
|
}
|
|
505
|
-
function
|
|
506
|
-
const { onChange:
|
|
507
|
-
return
|
|
508
|
-
...
|
|
509
|
-
value:
|
|
510
|
-
onUpdateValue: (
|
|
511
|
-
|
|
543
|
+
function me(e, a = {}, l) {
|
|
544
|
+
const { onChange: t, ...u } = l ?? {};
|
|
545
|
+
return h(w, {
|
|
546
|
+
...u,
|
|
547
|
+
value: e.value,
|
|
548
|
+
onUpdateValue: (r) => {
|
|
549
|
+
e.value = r, l?.onChange?.(r, l);
|
|
512
550
|
},
|
|
513
|
-
...
|
|
551
|
+
...a
|
|
514
552
|
});
|
|
515
553
|
}
|
|
516
|
-
function
|
|
517
|
-
const { onChange:
|
|
518
|
-
return
|
|
519
|
-
...
|
|
520
|
-
value:
|
|
521
|
-
options:
|
|
522
|
-
onUpdateValue: (
|
|
523
|
-
|
|
524
|
-
},
|
|
525
|
-
...
|
|
554
|
+
function fe(e, a, l = {}, t) {
|
|
555
|
+
const { onChange: u, ...r } = t ?? {};
|
|
556
|
+
return h(X, {
|
|
557
|
+
...r,
|
|
558
|
+
value: e.value,
|
|
559
|
+
options: a,
|
|
560
|
+
onUpdateValue: (v) => {
|
|
561
|
+
e.value = v, t?.onChange?.(v, t, a);
|
|
562
|
+
},
|
|
563
|
+
...l
|
|
526
564
|
});
|
|
527
565
|
}
|
|
528
|
-
function
|
|
529
|
-
const { value:
|
|
530
|
-
return
|
|
531
|
-
|
|
566
|
+
function pe(e, a, l = {}, t, u) {
|
|
567
|
+
const { value: r, labelField: v, valueField: n, onChange: i, ...b } = t ?? {}, o = v ?? "label", y = n ?? "value", g = b.options ?? a;
|
|
568
|
+
return s(
|
|
569
|
+
Y,
|
|
532
570
|
{
|
|
533
|
-
...
|
|
534
|
-
value:
|
|
535
|
-
onUpdateValue: (
|
|
536
|
-
|
|
571
|
+
...b,
|
|
572
|
+
value: e.value,
|
|
573
|
+
onUpdateValue: (c) => {
|
|
574
|
+
e.value = c, t?.onChange?.(c, t, g);
|
|
537
575
|
},
|
|
538
|
-
options:
|
|
539
|
-
...
|
|
576
|
+
options: g.map((c) => ({ ...c, label: c[o], value: c[y] })),
|
|
577
|
+
...l
|
|
540
578
|
},
|
|
541
579
|
{
|
|
542
|
-
default: () =>
|
|
543
|
-
default: () =>
|
|
580
|
+
default: () => u ?? s(C, null, {
|
|
581
|
+
default: () => e.value || "请选择"
|
|
544
582
|
})
|
|
545
583
|
}
|
|
546
584
|
);
|
|
547
585
|
}
|
|
548
|
-
function
|
|
549
|
-
const { valueField:
|
|
550
|
-
return
|
|
551
|
-
...
|
|
552
|
-
value:
|
|
553
|
-
options:
|
|
554
|
-
onUpdateValue: (
|
|
555
|
-
|
|
556
|
-
},
|
|
557
|
-
keyField:
|
|
558
|
-
...
|
|
586
|
+
function be(e, a, l = {}, t) {
|
|
587
|
+
const { valueField: u = "value", onChange: r, ...v } = t ?? {};
|
|
588
|
+
return h(Z, {
|
|
589
|
+
...v,
|
|
590
|
+
value: e.value,
|
|
591
|
+
options: a,
|
|
592
|
+
onUpdateValue: (n) => {
|
|
593
|
+
e.value = n, t?.onChange?.(n, t, a);
|
|
594
|
+
},
|
|
595
|
+
keyField: u,
|
|
596
|
+
...l
|
|
559
597
|
});
|
|
560
598
|
}
|
|
561
|
-
function
|
|
562
|
-
const { onChange:
|
|
563
|
-
return
|
|
564
|
-
|
|
599
|
+
function ge(e, a, l = {}, t) {
|
|
600
|
+
const { onChange: u, ...r } = t ?? {};
|
|
601
|
+
return h(
|
|
602
|
+
L,
|
|
565
603
|
{
|
|
566
|
-
...
|
|
567
|
-
value:
|
|
568
|
-
onUpdateValue: (
|
|
569
|
-
|
|
604
|
+
...r,
|
|
605
|
+
value: e.value,
|
|
606
|
+
onUpdateValue: (v) => {
|
|
607
|
+
e.value = v, t?.onChange?.(v, t, a);
|
|
570
608
|
},
|
|
571
|
-
...
|
|
609
|
+
...l
|
|
572
610
|
},
|
|
573
611
|
{
|
|
574
|
-
default: () => (
|
|
575
|
-
const
|
|
576
|
-
return
|
|
577
|
-
|
|
612
|
+
default: () => (t?.options ?? a).map((n) => {
|
|
613
|
+
const i = t, b = n[i?.labelField ?? "label"], o = n[i?.valueField ?? "value"];
|
|
614
|
+
return h(
|
|
615
|
+
ee,
|
|
578
616
|
{
|
|
579
|
-
...
|
|
580
|
-
label:
|
|
581
|
-
value:
|
|
617
|
+
...n,
|
|
618
|
+
label: b,
|
|
619
|
+
value: o
|
|
582
620
|
},
|
|
583
621
|
{
|
|
584
|
-
default: () =>
|
|
622
|
+
default: () => n.label
|
|
585
623
|
}
|
|
586
624
|
);
|
|
587
625
|
})
|
|
588
626
|
}
|
|
589
627
|
);
|
|
590
628
|
}
|
|
591
|
-
function
|
|
592
|
-
const { onChange:
|
|
593
|
-
return
|
|
594
|
-
|
|
629
|
+
function he(e, a, l = {}, t) {
|
|
630
|
+
const { onChange: u, ...r } = t ?? {};
|
|
631
|
+
return s(
|
|
632
|
+
L,
|
|
595
633
|
{
|
|
596
|
-
...
|
|
597
|
-
value:
|
|
598
|
-
onUpdateValue: (
|
|
599
|
-
|
|
634
|
+
...r,
|
|
635
|
+
value: e.value,
|
|
636
|
+
onUpdateValue: (v) => {
|
|
637
|
+
e.value = v, t?.onChange?.(v, t, a);
|
|
600
638
|
},
|
|
601
|
-
...
|
|
639
|
+
...l
|
|
602
640
|
},
|
|
603
641
|
{
|
|
604
|
-
default: () => (
|
|
605
|
-
const
|
|
606
|
-
return
|
|
607
|
-
|
|
642
|
+
default: () => (t?.options ?? a).map((n) => {
|
|
643
|
+
const i = t, b = n[i?.labelField ?? "label"], o = n[i?.valueField ?? "value"];
|
|
644
|
+
return s(
|
|
645
|
+
ne,
|
|
608
646
|
{
|
|
609
|
-
...
|
|
610
|
-
label:
|
|
611
|
-
value:
|
|
647
|
+
...n,
|
|
648
|
+
label: b,
|
|
649
|
+
value: o
|
|
612
650
|
},
|
|
613
651
|
{
|
|
614
|
-
default: () =>
|
|
652
|
+
default: () => n.label
|
|
615
653
|
}
|
|
616
654
|
);
|
|
617
655
|
})
|
|
618
656
|
}
|
|
619
657
|
);
|
|
620
658
|
}
|
|
621
|
-
function
|
|
622
|
-
const { onChange:
|
|
623
|
-
return
|
|
624
|
-
|
|
659
|
+
function Ce(e, a, l = {}, t) {
|
|
660
|
+
const { onChange: u, ...r } = t ?? {};
|
|
661
|
+
return h(
|
|
662
|
+
te,
|
|
625
663
|
{
|
|
626
|
-
...
|
|
627
|
-
value:
|
|
628
|
-
onUpdateValue: (
|
|
629
|
-
|
|
664
|
+
...r,
|
|
665
|
+
value: e.value,
|
|
666
|
+
onUpdateValue: (v) => {
|
|
667
|
+
e.value = v, t?.onChange?.(v, t, a);
|
|
630
668
|
},
|
|
631
|
-
...
|
|
669
|
+
...l
|
|
632
670
|
},
|
|
633
671
|
{
|
|
634
|
-
default: () =>
|
|
635
|
-
|
|
672
|
+
default: () => h(
|
|
673
|
+
re,
|
|
636
674
|
{
|
|
637
675
|
itemStyle: "display: flex"
|
|
638
676
|
},
|
|
639
677
|
{
|
|
640
|
-
default: () => (
|
|
641
|
-
const
|
|
642
|
-
return
|
|
643
|
-
value:
|
|
644
|
-
label:
|
|
678
|
+
default: () => (t?.options ?? a).map((n) => {
|
|
679
|
+
const i = t, b = n[i?.labelField ?? "label"], o = n[i?.valueField ?? "value"];
|
|
680
|
+
return h(U, {
|
|
681
|
+
value: o,
|
|
682
|
+
label: b
|
|
645
683
|
});
|
|
646
684
|
})
|
|
647
685
|
}
|
|
@@ -649,92 +687,150 @@ function ve(t, i, c = {}, u) {
|
|
|
649
687
|
}
|
|
650
688
|
);
|
|
651
689
|
}
|
|
652
|
-
function
|
|
653
|
-
const { onChange:
|
|
654
|
-
return
|
|
655
|
-
...
|
|
656
|
-
value:
|
|
657
|
-
onUpdateValue: (
|
|
658
|
-
|
|
690
|
+
function ke(e, a = {}, l) {
|
|
691
|
+
const { onChange: t, ...u } = l ?? {};
|
|
692
|
+
return h(le, {
|
|
693
|
+
...u,
|
|
694
|
+
value: e.value,
|
|
695
|
+
onUpdateValue: (r) => {
|
|
696
|
+
e.value = r, l?.onChange?.(r, l);
|
|
659
697
|
},
|
|
660
|
-
...
|
|
698
|
+
...a
|
|
661
699
|
});
|
|
662
700
|
}
|
|
663
|
-
function
|
|
664
|
-
const { onChange:
|
|
665
|
-
return
|
|
666
|
-
...
|
|
667
|
-
value:
|
|
668
|
-
onUpdateValue: (
|
|
669
|
-
|
|
701
|
+
function Ne(e, a = {}, l) {
|
|
702
|
+
const { onChange: t, ...u } = l ?? {};
|
|
703
|
+
return h(ae, {
|
|
704
|
+
...u,
|
|
705
|
+
value: e.value,
|
|
706
|
+
onUpdateValue: (r) => {
|
|
707
|
+
e.value = r, l?.onChange?.(r, l);
|
|
670
708
|
},
|
|
671
|
-
...
|
|
709
|
+
...a
|
|
672
710
|
});
|
|
673
711
|
}
|
|
674
|
-
function
|
|
675
|
-
const { onChange:
|
|
676
|
-
return
|
|
677
|
-
...
|
|
678
|
-
value:
|
|
679
|
-
onUpdateValue: (
|
|
680
|
-
|
|
712
|
+
function Se(e, a = {}, l) {
|
|
713
|
+
const { onChange: t, ...u } = l ?? {};
|
|
714
|
+
return h(ue, {
|
|
715
|
+
...u,
|
|
716
|
+
value: e.value,
|
|
717
|
+
onUpdateValue: (r) => {
|
|
718
|
+
e.value = r, l?.onChange?.(r, l);
|
|
719
|
+
},
|
|
720
|
+
...a
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
function Ie(e, a = {}, l) {
|
|
724
|
+
const { onChange: t, ...u } = l ?? {};
|
|
725
|
+
return h(
|
|
726
|
+
U,
|
|
727
|
+
{
|
|
728
|
+
...u,
|
|
729
|
+
checked: e.value,
|
|
730
|
+
onUpdateChecked: (r) => {
|
|
731
|
+
e.value = r, l?.onChange?.(r, l);
|
|
732
|
+
},
|
|
733
|
+
...a
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
default: () => a?.label ?? l?.label
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
function Fe(e, a = {}, l) {
|
|
741
|
+
const { onChange: t, ...u } = l ?? {};
|
|
742
|
+
return h(oe, {
|
|
743
|
+
...u,
|
|
744
|
+
value: e.value,
|
|
745
|
+
onUpdateValue: (r) => {
|
|
746
|
+
e.value = r, l?.onChange?.(r, l);
|
|
747
|
+
},
|
|
748
|
+
...a
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
function xe(e, a = {}, l) {
|
|
752
|
+
const { onChange: t, ...u } = l ?? {};
|
|
753
|
+
return h(se, {
|
|
754
|
+
...u,
|
|
755
|
+
value: e.value,
|
|
756
|
+
onUpdateValue: (r) => {
|
|
757
|
+
e.value = r, l?.onChange?.(r, l);
|
|
758
|
+
},
|
|
759
|
+
...a
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
function Re(e, a = {}, l) {
|
|
763
|
+
const { onChange: t, ...u } = l ?? {};
|
|
764
|
+
return h(ie, {
|
|
765
|
+
...u,
|
|
766
|
+
value: e.value,
|
|
767
|
+
onUpdateValue: (r) => {
|
|
768
|
+
e.value = r, l?.onChange?.(r, l);
|
|
681
769
|
},
|
|
682
|
-
...
|
|
770
|
+
...a
|
|
683
771
|
});
|
|
684
772
|
}
|
|
685
|
-
const
|
|
773
|
+
const Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
686
774
|
__proto__: null,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
775
|
+
renderCheckbox: Ie,
|
|
776
|
+
renderCheckboxGroup: Ce,
|
|
777
|
+
renderDatePicker: Ne,
|
|
778
|
+
renderDynamicTags: Fe,
|
|
779
|
+
renderInput: me,
|
|
780
|
+
renderInputNumber: Re,
|
|
781
|
+
renderPopSelect: pe,
|
|
782
|
+
renderRadioButtonGroup: he,
|
|
783
|
+
renderRadioGroup: ge,
|
|
784
|
+
renderSelect: fe,
|
|
785
|
+
renderSlider: xe,
|
|
786
|
+
renderSwitch: ke,
|
|
787
|
+
renderTimePicker: Se,
|
|
788
|
+
renderTreeSelect: be
|
|
697
789
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
698
|
-
function
|
|
699
|
-
return function(
|
|
700
|
-
const
|
|
701
|
-
renderInput: (
|
|
702
|
-
renderSelect: (
|
|
703
|
-
renderPopSelect: (
|
|
704
|
-
renderTreeSelect: (
|
|
705
|
-
renderRadioGroup: (
|
|
706
|
-
renderRadioButtonGroup: (
|
|
707
|
-
renderCheckboxGroup: (
|
|
708
|
-
renderSwitch: (
|
|
709
|
-
renderDatePicker: (
|
|
710
|
-
renderTimePicker: (
|
|
790
|
+
function Te(e) {
|
|
791
|
+
return function(l, t = !0) {
|
|
792
|
+
const u = e, r = {
|
|
793
|
+
renderInput: (n) => u.renderInput(n.value, n.renderProps ?? {}, n),
|
|
794
|
+
renderSelect: (n) => u.renderSelect(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
795
|
+
renderPopSelect: (n) => u.renderPopSelect(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
796
|
+
renderTreeSelect: (n) => u.renderTreeSelect(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
797
|
+
renderRadioGroup: (n) => u.renderRadioGroup(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
798
|
+
renderRadioButtonGroup: (n) => u.renderRadioButtonGroup(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
799
|
+
renderCheckboxGroup: (n) => u.renderCheckboxGroup(n.value, n.options ?? [], n.renderProps ?? {}, n),
|
|
800
|
+
renderSwitch: (n) => u.renderSwitch(n.value, n.renderProps ?? {}, n),
|
|
801
|
+
renderDatePicker: (n) => u.renderDatePicker(n.value, n.renderProps ?? {}, n),
|
|
802
|
+
renderTimePicker: (n) => u.renderTimePicker(n.value, n.renderProps ?? {}, n)
|
|
711
803
|
};
|
|
712
|
-
return
|
|
713
|
-
const
|
|
714
|
-
if (
|
|
715
|
-
|
|
804
|
+
return l.map((n) => {
|
|
805
|
+
const i = n;
|
|
806
|
+
if (i.value = ve(n.value), typeof n.render2 == "function")
|
|
807
|
+
i.render2 = n.render2;
|
|
716
808
|
else {
|
|
717
|
-
const
|
|
718
|
-
|
|
809
|
+
const b = n.renderType ?? "renderInput", o = r[b];
|
|
810
|
+
o ? i.render2 = () => o(i) : (console.warn(`[useDecorateForm] unknown renderType: ${n.renderType}`), i.render2 = () => r.renderInput(i));
|
|
719
811
|
}
|
|
720
|
-
return
|
|
812
|
+
return t ? E(i) : i;
|
|
721
813
|
});
|
|
722
814
|
};
|
|
723
815
|
}
|
|
724
|
-
const
|
|
816
|
+
const De = Te(Ae);
|
|
725
817
|
export {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
818
|
+
Oe as NaiDynamicCascadeInput,
|
|
819
|
+
ze as NaiDynamicForm,
|
|
820
|
+
je as NaiDynamicInput,
|
|
821
|
+
Ie as renderCheckbox,
|
|
822
|
+
Ce as renderCheckboxGroup,
|
|
823
|
+
Ne as renderDatePicker,
|
|
824
|
+
Fe as renderDynamicTags,
|
|
825
|
+
me as renderInput,
|
|
826
|
+
Re as renderInputNumber,
|
|
827
|
+
pe as renderPopSelect,
|
|
828
|
+
he as renderRadioButtonGroup,
|
|
829
|
+
ge as renderRadioGroup,
|
|
830
|
+
fe as renderSelect,
|
|
831
|
+
xe as renderSlider,
|
|
832
|
+
ke as renderSwitch,
|
|
833
|
+
Se as renderTimePicker,
|
|
834
|
+
be as renderTreeSelect,
|
|
835
|
+
De as useDecorateForm
|
|
740
836
|
};
|