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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { defineComponent as R, ref as w, watch as N, toRaw as h, createVNode as n, createTextVNode as m, nextTick as j, Fragment as x, shallowReactive as O, unref as D, isRef as F } from "vue";
2
- import { t as p, r as V, f as T, p as L, s as M, e as $ } from "./index-MF72-iEr.js";
3
- const H = /* @__PURE__ */ R({
1
+ import { defineComponent as O, ref as R, watch as L, toRaw as x, createVNode as a, createTextVNode as g, Fragment as k, nextTick as M, shallowReactive as D, unref as H, isRef as T } from "vue";
2
+ import { t as V, r as j, f as $, p as E, s as z, e as K } from "./index-MF72-iEr.js";
3
+ const P = /* @__PURE__ */ O({
4
4
  name: "DynamicInput",
5
5
  props: {
6
6
  size: {
@@ -33,129 +33,146 @@ const H = /* @__PURE__ */ R({
33
33
  emits: {
34
34
  "update:modelValue": (t) => !0,
35
35
  onReset: () => !0,
36
- onMerge: (t, r) => !0
36
+ onMerge: (t, c) => !0
37
37
  },
38
+ slots: Object,
38
39
  setup(t, {
39
- emit: r,
40
- expose: f
40
+ emit: c,
41
+ expose: p,
42
+ slots: r
41
43
  }) {
42
- const d = {
44
+ const f = {
43
45
  resetTxt: "重置",
44
46
  newTxt: "添加项",
45
47
  mergeTxt: "合并",
46
48
  ...t.btnConfigs
47
- }, c = {
49
+ }, m = {
48
50
  hideReset: !1,
49
51
  maxHeight: "300px",
50
52
  autoScroll: !0,
51
53
  allowFilter: !0,
54
+ hideArrayBtn: !1,
55
+ hideNumberBtn: !1,
52
56
  ...t.configs
53
- }, y = {
57
+ }, v = {
54
58
  arraySplitSymbol: ",",
55
59
  ...t.dyListConfigs
56
- }, v = t.size, o = w(p(t.modelValue, t.randomFun, y.arraySplitSymbol)), b = w(null);
57
- return N(o, (e) => {
60
+ }, b = t.size, d = R(V(t.modelValue, t.randomFun, v.arraySplitSymbol)), h = R(null);
61
+ L(d, (e) => {
58
62
  if (!t.isController) return;
59
- const u = V(e, y.arraySplitSymbol);
60
- r("update:modelValue", u), r("onMerge", u, h(o.value));
63
+ const s = j(e, v.arraySplitSymbol);
64
+ c("update:modelValue", s), c("onMerge", s, x(d.value));
61
65
  }, {
62
66
  deep: !0
63
- }), f({
67
+ }), p({
64
68
  onSet: (e) => {
65
- o.value = p(e ?? t.modelValue, t.randomFun, y.arraySplitSymbol);
69
+ d.value = V(e ?? t.modelValue, t.randomFun, v.arraySplitSymbol);
66
70
  },
67
- getResult: (e = "res") => e === "ori" ? h(o.value) : V(o.value, y.arraySplitSymbol)
68
- }), () => n("div", {
69
- class: t.dyCls ?? `dynamicForm ${v}`
70
- }, [n("div", {
71
- class: "dyFormList",
72
- ref: b,
71
+ getResult: (e = "res") => e === "ori" ? x(d.value) : j(d.value, v.arraySplitSymbol)
72
+ });
73
+ const y = () => d.value.push({
74
+ rId: t.randomFun(),
75
+ key: "",
76
+ value: ""
77
+ }), A = () => {
78
+ d.value = V(t.modelValue, t.randomFun, v.arraySplitSymbol), c("onReset");
79
+ }, o = () => {
80
+ d.value.sort((s, l) => +s.rId - +l.rId);
81
+ const e = j(d.value, v.arraySplitSymbol);
82
+ c("update:modelValue", e), c("onMerge", e, x(d.value)), d.value = V(e, t.randomFun, v.arraySplitSymbol);
83
+ };
84
+ return () => a("div", {
85
+ class: `dynamicForm ${b} ${t.dyCls}`
86
+ }, [a("div", {
87
+ class: `dyFormList ${d.value.length ? "" : "noList"}`,
88
+ ref: h,
73
89
  style: {
74
- maxHeight: c.maxHeight
75
- }
76
- }, [o.value.map((e, u, l) => n("div", {
77
- class: "dItem",
78
- key: e.rId
79
- }, [n("div", {
80
- class: "input"
81
- }, [n("input", {
82
- size: v,
83
- value: e.key,
84
- class: "key nativeInput",
85
- onInput: (s) => {
86
- e.key = s.target.value;
87
- }
88
- }, null), m(":"), n("div", {
89
- class: "vInput"
90
- }, [n("div", {
91
- class: "slot"
92
- }, [n("button", {
93
- class: [e.isArray ? "success" : "default", "small", "bt"],
94
- onClick: () => {
95
- e.isArray = !e.isArray;
96
- }
97
- }, [m("Array")]), m(" "), n("button", {
98
- class: [e.isNumber ? "success" : "default", "small", "bt"],
99
- onClick: () => {
100
- e.isNumber = !e.isNumber;
90
+ maxHeight: m.maxHeight
101
91
  }
102
- }, [m("Number")])]), n("input", {
103
- size: v,
104
- value: e.value,
105
- class: "value nativeV",
106
- onInput: (s) => {
107
- const i = s.target.value;
108
- c.allowFilter && e.isNumber ? e.value = T(i, e.isArray, y.arraySplitSymbol) : e.value = i;
109
- }
110
- }, null)])]), n("div", {
111
- class: "btn"
112
- }, [n("button", {
113
- class: [v, "success", "bt"],
114
- disabled: u !== l.length - 1,
115
- onClick: () => {
116
- o.value.push({
117
- rId: t.randomFun(),
118
- key: "",
119
- value: ""
120
- }), c.autoScroll && j(() => {
121
- const s = b.value;
122
- s?.scrollTo({
123
- top: s.scrollHeight,
124
- behavior: "smooth"
92
+ }, [d.value.map((e, s, l) => {
93
+ const u = {
94
+ row: e,
95
+ index: s,
96
+ isLast: s === l.length - 1,
97
+ addItem: () => {
98
+ d.value.push({
99
+ rId: t.randomFun(),
100
+ key: "",
101
+ value: ""
102
+ }), m.autoScroll && M(() => {
103
+ const i = h.value;
104
+ i?.scrollTo({
105
+ top: i.scrollHeight,
106
+ behavior: "smooth"
107
+ });
125
108
  });
126
- });
127
- }
128
- }, [m("+")]), n("button", {
129
- class: ["danger", v, "bt"],
130
- onClick: () => {
131
- o.value = o.value.filter((s) => s.rId !== e.rId);
132
- }
133
- }, [m("-")])])]))]), n("div", {
134
- class: "control"
135
- }, [!o.value.length && n("button", {
136
- class: ["success", v, "bt"],
137
- onClick: () => {
138
- o.value.push({
139
- rId: t.randomFun(),
140
- key: "",
141
- value: ""
142
- });
143
- }
144
- }, [d.newTxt]), !t.isController && n(x, null, [!c.hideReset && n("button", {
145
- class: ["default", v, "bt"],
146
- onClick: () => {
147
- o.value = p(t.modelValue, t.randomFun, y.arraySplitSymbol), r("onReset");
148
- }
149
- }, [d.resetTxt]), n("button", {
150
- class: ["info", v, "bt"],
151
- onClick: () => {
152
- o.value.sort((u, l) => +u.rId - +l.rId);
153
- const e = V(o.value, y.arraySplitSymbol);
154
- r("update:modelValue", e), r("onMerge", e, h(o.value)), o.value = p(e, t.randomFun, y.arraySplitSymbol);
155
- }
156
- }, [d.mergeTxt])])])]);
109
+ },
110
+ removeItem: () => {
111
+ d.value = d.value.filter((i) => i.rId !== e.rId);
112
+ },
113
+ toggleArray: () => e.isArray = !e.isArray,
114
+ toggleNumber: () => e.isNumber = !e.isNumber
115
+ };
116
+ return a("div", {
117
+ class: "dItem",
118
+ key: e.rId
119
+ }, [a("div", {
120
+ class: "input"
121
+ }, [a("input", {
122
+ size: b,
123
+ value: e.key,
124
+ class: "key nativeInput",
125
+ onInput: (i) => {
126
+ e.key = i.target.value;
127
+ }
128
+ }, null), g(":"), a("div", {
129
+ class: "vInput"
130
+ }, [a("div", {
131
+ class: "slot"
132
+ }, [r.typeTools ? r.typeTools(u) : a(k, null, [!m.hideArrayBtn && a("button", {
133
+ class: [e.isArray ? "success" : "default", "small", "bt"],
134
+ onClick: u.toggleArray
135
+ }, [g("Array")]), !m.hideNumberBtn && a("button", {
136
+ class: [e.isNumber ? "success" : "default", "small", "bt"],
137
+ onClick: u.toggleNumber
138
+ }, [g("Number")])])]), a("input", {
139
+ size: b,
140
+ value: e.value,
141
+ class: "value nativeV",
142
+ onInput: (i) => {
143
+ const n = i.target.value;
144
+ m.allowFilter && e.isNumber ? e.value = $(n, e.isArray, v.arraySplitSymbol) : e.value = n;
145
+ }
146
+ }, null)])]), a("div", {
147
+ class: "btn"
148
+ }, [r.rowActions ? r.rowActions(u) : a(k, null, [a("button", {
149
+ class: [b, "success", "bt"],
150
+ disabled: !u.isLast,
151
+ onClick: u.addItem
152
+ }, [g("+")]), a("button", {
153
+ class: ["danger", b, "bt"],
154
+ onClick: u.removeItem
155
+ }, [g("-")])])])]);
156
+ })]), a("div", {
157
+ class: `control ${d.value.length ? "" : "noList"}`
158
+ }, [!d.value.length && (r.newBtn ? r.newBtn({
159
+ newItem: y
160
+ }) : a("button", {
161
+ class: ["success", b, "bt"],
162
+ onClick: y
163
+ }, [f.newTxt])), !t.isController && a(k, null, [!m.hideReset && (r.resetBtn ? r.resetBtn({
164
+ reset: A
165
+ }) : a("button", {
166
+ class: ["default", b, "bt"],
167
+ onClick: A
168
+ }, [f.resetTxt])), r.mergeBtn ? r.mergeBtn({
169
+ merge: o
170
+ }) : a("button", {
171
+ class: ["info", b, "bt"],
172
+ onClick: o
173
+ }, [f.mergeTxt])])])]);
157
174
  }
158
- }), z = /* @__PURE__ */ R({
175
+ }), q = /* @__PURE__ */ O({
159
176
  name: "DynamicCascadeInput",
160
177
  props: {
161
178
  modelValue: {
@@ -194,217 +211,254 @@ const H = /* @__PURE__ */ R({
194
211
  emits: {
195
212
  "update:modelValue": (t) => !0,
196
213
  onReset: () => !0,
197
- onMerge: (t, r) => !0
214
+ onMerge: (t, c) => !0
198
215
  },
216
+ slots: Object,
199
217
  setup(t, {
200
- emit: r,
201
- expose: f
218
+ emit: c,
219
+ expose: p,
220
+ slots: r
202
221
  }) {
203
- const d = {
222
+ const f = {
204
223
  resetTxt: "重置",
205
224
  newTxt: "添加项",
206
225
  mergeTxt: "合并",
207
226
  ...t.btnConfigs
208
- }, c = {
227
+ }, m = {
209
228
  hideReset: !1,
210
229
  maxHeight: "600px",
211
230
  allowFilter: !0,
212
231
  showBorder: !0,
213
232
  showPad: !0,
233
+ hideArrayBtn: !1,
234
+ hideNumberBtn: !1,
214
235
  retractLen: 0,
215
236
  borderColors: [],
216
237
  ...t.configs
217
- }, y = {
238
+ }, v = {
218
239
  arraySplitSymbol: ",",
219
240
  ...t.dyListConfigs
220
- }, v = (l) => ["string", "number"].includes(l), o = (l) => Object.keys(l).map((s, i) => {
221
- let a = l[s];
222
- const g = Array.isArray(a), A = g ? a.every((S) => typeof S == "number") : typeof a == "number", C = a === null;
223
- return v(typeof a) && (a = l[s]), C && (a = ""), {
241
+ }, b = (l) => ["string", "number"].includes(l), d = (l) => Object.keys(l).map((u, i) => {
242
+ let n = l[u];
243
+ const C = Array.isArray(n), B = C ? n.every((N) => typeof N == "number") : typeof n == "number", w = n === null;
244
+ return b(typeof n) && (n = l[u]), w && (n = ""), {
224
245
  rId: t.randomFun(i),
225
- key: s,
226
- value: Object.prototype.toString.call(a) === "[object Object]" ? o(l[s]) : g ? a.join(y.arraySplitSymbol) : a,
227
- isArray: g || void 0,
228
- isNumber: A || void 0
246
+ key: u,
247
+ value: Object.prototype.toString.call(n) === "[object Object]" ? d(l[u]) : C ? n.join(v.arraySplitSymbol) : n,
248
+ isArray: C || void 0,
249
+ isNumber: B || void 0
229
250
  };
230
- }), b = (l) => l.reduce((s, i) => {
231
- const a = i.value;
232
- return i.key.trim().length && (s[i.key] = Array.isArray(a) ? b(a) : L(i.value, i.isArray, i.isNumber, y.arraySplitSymbol)), s;
233
- }, {}), e = w(o(t.modelValue)), u = (l, s = 1, i) => n("div", {
234
- class: [`depth-${s}`, c.showBorder ? "" : "no-border", c.showPad ? "" : "no-pad"],
251
+ }), h = (l) => l.reduce((u, i) => {
252
+ const n = i.value;
253
+ return i.key.trim().length && (u[i.key] = Array.isArray(n) ? h(n) : E(i.value, i.isArray, i.isNumber, v.arraySplitSymbol)), u;
254
+ }, {}), y = R(d(t.modelValue)), A = (l, u = 1, i) => a("div", {
255
+ class: [`depth-${u}`, m.showBorder ? "" : "no-border", m.showPad ? "" : "no-pad"],
235
256
  style: {
236
- "--depth": s,
237
- ["--c" + [s]]: M(c.borderColors, s)
257
+ "--depth": u,
258
+ ["--c" + [u]]: z(m.borderColors, u)
238
259
  }
239
- }, [l.map((a, g, A) => {
240
- const C = Array.isArray(a.value), S = v(typeof a.value);
241
- return n("div", {
260
+ }, [l.map((n, C, B) => {
261
+ const w = Array.isArray(n.value), N = b(typeof n.value), I = {
262
+ row: n,
263
+ index: C,
264
+ isLast: C === B.length - 1,
265
+ addItem: () => {
266
+ l.push({
267
+ rId: t.randomFun(),
268
+ key: "",
269
+ value: ""
270
+ });
271
+ },
272
+ addChild: () => {
273
+ N && (n.value = [], n.isArray = void 0), n.value.push({
274
+ rId: t.randomFun(),
275
+ key: "",
276
+ value: ""
277
+ });
278
+ },
279
+ removeItem: () => {
280
+ if (l.splice(C, 1), l.length < 1) {
281
+ if (i === void 0) return h([]);
282
+ const F = y.value.findIndex((S) => S.rId === i?.rId);
283
+ u < 1 ? y.value.splice(F, 1, {
284
+ ...i,
285
+ value: ""
286
+ }) : i.value = "";
287
+ }
288
+ },
289
+ toggleArray: () => n.isArray = !n.isArray,
290
+ toggleNumber: () => n.isNumber = !n.isNumber
291
+ };
292
+ return a("div", {
242
293
  class: "dItem",
243
- key: a.rId,
294
+ key: n.rId,
244
295
  style: {
245
- marginLeft: s > 1 ? `${s * c.retractLen}px` : "0"
296
+ marginLeft: u > 1 ? `${u * m.retractLen}px` : "0"
246
297
  }
247
- }, [n("div", {
298
+ }, [a("div", {
248
299
  class: "input"
249
- }, [!C && n(x, null, [n("input", {
250
- value: a.key,
300
+ }, [!w && a(k, null, [a("input", {
301
+ value: n.key,
251
302
  class: "key nativeInput",
252
- onInput: (I) => a.key = I.target.value
253
- }, null), m(":")]), n("div", {
303
+ onInput: (F) => n.key = F.target.value
304
+ }, null), g(":")]), a("div", {
254
305
  class: "vInput"
255
- }, [n("div", {
306
+ }, [a("div", {
256
307
  class: "slot"
257
- }, [Array.isArray(a.value) ? void 0 : n(x, null, [n("button", {
258
- class: [a.isArray ? "success" : "default", "small", "bt"],
259
- onClick: () => {
260
- a.isArray = !a.isArray;
261
- }
262
- }, [m("Array")]), m(" "), n("button", {
263
- class: [a.isNumber ? "success" : "default", "small", "bt"],
264
- onClick: () => {
265
- a.isNumber = !a.isNumber;
266
- }
267
- }, [m("Number")])])]), n("input", {
268
- class: `value nativeV ${C ? "isKey" : ""}`,
269
- value: S ? a.value : a.key,
270
- onInput: (I) => {
271
- const k = I.target.value;
272
- if (C) {
273
- a.key = k;
308
+ }, [Array.isArray(n.value) ? void 0 : r.typeTools ? r.typeTools(I) : a(k, null, [!m.hideArrayBtn && a("button", {
309
+ class: [n.isArray ? "success" : "default", "small", "bt"],
310
+ onClick: I.toggleArray
311
+ }, [g("Array")]), !m.hideNumberBtn && a("button", {
312
+ class: [n.isNumber ? "success" : "default", "small", "bt"],
313
+ onClick: I.toggleNumber
314
+ }, [g("Number")])])]), a("input", {
315
+ class: `value nativeV ${w ? "isKey" : ""}`,
316
+ value: N ? n.value : n.key,
317
+ onInput: (F) => {
318
+ const S = F.target.value;
319
+ if (w) {
320
+ n.key = S;
274
321
  return;
275
322
  }
276
- c.allowFilter && a.isNumber ? a.value = T(k, a.isArray, y.arraySplitSymbol) : a.value = k;
323
+ m.allowFilter && n.isNumber ? n.value = $(S, n.isArray, v.arraySplitSymbol) : n.value = S;
277
324
  }
278
- }, null), n("div", {
325
+ }, null), a("div", {
279
326
  class: "surSlot"
280
- }, [s < t.depth ? !C && n("button", {
327
+ }, [u < t.depth ? !w && (r.newChild ? r.newChild(I) : a("button", {
281
328
  class: ["success", "bt"],
282
- onClick: () => {
283
- S && (a.value = [], a.isArray = void 0), a.value.push({
284
- rId: t.randomFun(),
285
- key: "",
286
- value: ""
287
- });
288
- }
289
- }, [t.newChildTxt(a)]) : null])])]), n("div", {
329
+ onClick: I.addChild
330
+ }, [t.newChildTxt(n)])) : null])])]), a("div", {
290
331
  class: "btn"
291
- }, [n("button", {
332
+ }, [r.rowActions ? r.rowActions(I) : a(k, null, [a("button", {
292
333
  class: ["success", "bt"],
293
- disabled: g !== A.length - 1,
294
- onClick: () => {
295
- l.push({
296
- rId: t.randomFun(),
297
- key: "",
298
- value: ""
299
- });
300
- }
301
- }, [m("+")]), n("button", {
334
+ disabled: !I.isLast,
335
+ onClick: I.addItem
336
+ }, [g("+")]), a("button", {
302
337
  class: ["danger", "bt"],
303
- onClick: () => {
304
- if (l.splice(g, 1), l.length < 1) {
305
- if (i === void 0) return b([]);
306
- const I = e.value.findIndex((k) => k.rId === i?.rId);
307
- s < 1 ? e.value.splice(I, 1, {
308
- ...i,
309
- value: ""
310
- }) : i.value = "";
311
- }
312
- }
313
- }, [m("-")])]), Array.isArray(a.value) && u(a.value, s + 1, a)]);
338
+ onClick: I.removeItem
339
+ }, [g("-")])])]), Array.isArray(n.value) && A(n.value, u + 1, n)]);
314
340
  })]);
315
- return N(e, (l) => {
341
+ L(y, (l) => {
316
342
  if (!t.isController) return;
317
- const s = b(l);
318
- r("update:modelValue", s), r("onMerge", s, h(e.value));
343
+ const u = h(l);
344
+ c("update:modelValue", u), c("onMerge", u, x(y.value));
319
345
  }, {
320
346
  deep: !0
321
- }), f({
347
+ }), p({
322
348
  onSet: (l) => {
323
- e.value = o(l ?? t.modelValue);
349
+ y.value = d(l ?? t.modelValue);
324
350
  },
325
- getResult: (l = "res") => l === "ori" ? h(e.value) : b(e.value)
326
- }), () => n("div", {
327
- class: t.dyCls ?? "dynamicCascadeForm"
328
- }, [n("div", {
329
- class: "dyFormList",
351
+ getResult: (l = "res") => l === "ori" ? x(y.value) : h(y.value)
352
+ });
353
+ const o = () => y.value.push({
354
+ rId: t.randomFun(),
355
+ key: "",
356
+ value: ""
357
+ }), e = () => {
358
+ y.value = d(t.modelValue), c("onReset");
359
+ }, s = () => {
360
+ const l = h(y.value);
361
+ c("update:modelValue", l), c("onMerge", l, x(y.value)), y.value = d(l);
362
+ };
363
+ return () => a("div", {
364
+ class: `dynamicCascadeForm ${t.dyCls}`
365
+ }, [a("div", {
366
+ class: `dyFormList ${y.value.length ? "" : "noObj"}`,
330
367
  style: {
331
- maxHeight: c.maxHeight
368
+ maxHeight: m.maxHeight
332
369
  }
333
- }, [u(e.value)]), n("div", {
334
- class: "control"
335
- }, [!e.value.length && n("button", {
370
+ }, [A(y.value)]), a("div", {
371
+ class: `control ${y.value.length ? "" : "noObj"}`
372
+ }, [!y.value.length && (r.newBtn ? r.newBtn({
373
+ newItem: o
374
+ }) : a("button", {
336
375
  class: ["success", "bt"],
337
- onClick: () => {
338
- e.value.push({
339
- rId: t.randomFun(),
340
- key: "",
341
- value: ""
342
- });
343
- }
344
- }, [d.newTxt]), !t.isController && n(x, null, [!c.hideReset && n("button", {
376
+ onClick: o
377
+ }, [f.newTxt])), !t.isController && a(k, null, [!m.hideReset && (r.resetBtn ? r.resetBtn({
378
+ reset: e
379
+ }) : a("button", {
345
380
  class: ["default", "bt"],
346
- onClick: () => {
347
- e.value = o(t.modelValue), r("onReset");
348
- }
349
- }, [d.resetTxt]), n("button", {
381
+ onClick: e
382
+ }, [f.resetTxt])), r.mergeBtn ? r.mergeBtn({
383
+ merge: s
384
+ }) : a("button", {
350
385
  class: ["info", "bt"],
351
- onClick: () => {
352
- const l = b(e.value);
353
- r("update:modelValue", l), r("onMerge", l, h(e.value)), e.value = o(l);
354
- }
355
- }, [d.mergeTxt])])])]);
386
+ onClick: s
387
+ }, [f.mergeTxt])])])]);
356
388
  }
357
389
  });
358
- function P(t, r = !0) {
359
- return t.map((f) => {
360
- const d = f;
361
- return d.value = $(f.value), r ? O(d) : d;
390
+ function J(t, c = !0) {
391
+ return t.map((p) => {
392
+ const r = p;
393
+ return r.value = K(p.value), c ? D(r) : r;
362
394
  });
363
395
  }
364
- function q(t) {
365
- const r = () => D(t), f = (e, u) => {
366
- r().forEach((l) => {
367
- const s = l.key;
368
- (!u || u.includes(s)) && (l.disabled = e);
396
+ function Q(t) {
397
+ const c = () => H(t), p = (o, e) => {
398
+ c().forEach((s) => {
399
+ const l = s.key;
400
+ (!e || e.includes(l)) && (s.disabled = o);
369
401
  });
370
- }, d = (e, u) => {
371
- r().forEach((l) => {
372
- const s = l.key;
373
- (!u || u.includes(s)) && (l.hidden = e);
402
+ }, r = (o, e) => {
403
+ c().forEach((s) => {
404
+ const l = s.key;
405
+ (!e || e.includes(l)) && (s.hidden = o);
374
406
  });
375
- }, c = (e, u) => {
376
- const l = r().find((s) => s.key === e);
377
- l && (F(l.value) ? l.value.value = u : l.value = u);
407
+ }, f = (o, e) => {
408
+ const s = c().find((l) => l.key === o);
409
+ s && (T(s.value) ? s.value.value = e : s.value = e);
378
410
  };
379
- return { setDisabled: f, setHidden: d, setValue: c, setValues: (e) => {
380
- Object.entries(e).forEach(([u, l]) => {
381
- c(u, l);
411
+ return { setDisabled: p, setHidden: r, setValue: f, setValues: (o) => {
412
+ Object.entries(o).forEach(([e, s]) => {
413
+ f(e, s);
382
414
  });
383
- }, getValue: (e) => r().find((u) => u.key === e), getValues: (e) => {
384
- const u = e && e.length ? new Set(e) : null;
385
- return r().reduce((l, s) => {
386
- const i = s.key;
387
- if (!u || u.has(i)) {
388
- const a = F(s.value) ? s.value.value : s.value;
389
- l[i] = a;
415
+ }, getValue: (o) => c().find((e) => e.key === o), getValues: (o) => {
416
+ const e = o && o.length ? new Set(o) : null;
417
+ return c().reduce((s, l) => {
418
+ const u = l.key;
419
+ if (!e || e.has(u)) {
420
+ const i = T(l.value) ? l.value.value : l.value;
421
+ s[u] = i;
390
422
  }
391
- return l;
423
+ return s;
392
424
  }, {});
393
- }, onReset: (e = null) => {
394
- r().forEach((u) => {
395
- F(u.value) ? u.value.value = e : u.value = e;
425
+ }, onReset: (o = null) => {
426
+ c().forEach((e) => {
427
+ T(e.value) ? e.value.value = o : e.value = o;
428
+ });
429
+ }, setItem: (o, e) => {
430
+ c().forEach((s) => {
431
+ if (s.key === o) {
432
+ const { key: l, ...u } = e;
433
+ Object.assign(s, u);
434
+ }
435
+ });
436
+ }, setItems: (o) => {
437
+ const e = new Map(o);
438
+ c().forEach((s) => {
439
+ const l = e.get(s.key);
440
+ if (l) {
441
+ const { key: u, ...i } = l;
442
+ Object.assign(s, i);
443
+ }
444
+ });
445
+ }, updateKeys: (o) => {
446
+ const e = new Map(o);
447
+ c().forEach((s) => {
448
+ const l = e.get(s.key);
449
+ l && (s.key = l);
396
450
  });
397
451
  } };
398
452
  }
399
- const _ = {
453
+ const U = {
400
454
  install(t) {
401
- t.component("DynamicInput", H), t.component("DynamicCascadeInput", z);
455
+ t.component("DynamicInput", P), t.component("DynamicCascadeInput", q);
402
456
  }
403
457
  };
404
458
  export {
405
- z as DynamicCascadeInput,
406
- H as DynamicInput,
407
- _ as DynamicInputPlugin,
408
- q as useDyForm,
409
- P as useReactiveForm
459
+ q as DynamicCascadeInput,
460
+ P as DynamicInput,
461
+ U as DynamicInputPlugin,
462
+ Q as useDyForm,
463
+ J as useReactiveForm
410
464
  };