@gopowerteam/form-render 0.0.30 → 0.0.31

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/es/index.mjs CHANGED
@@ -1,21 +1,21 @@
1
- import { getCurrentInstance as _, inject as Y, defineComponent as x, computed as b, openBlock as N, createElementBlock as P, normalizeClass as L, normalizeStyle as z, createElementVNode as M, ref as k, createVNode as d, watch as G, nextTick as K, isRef as T, isVNode as R, h as Q, provide as O, onMounted as U, mergeProps as X, createTextVNode as $, onUpdated as H } from "vue";
2
- import { DatePicker as J, YearPicker as Z, QuarterPicker as p, MonthPicker as ee, WeekPicker as te, Input as le, InputNumber as re, Select as ae, Option as ne, Switch as ue, RangePicker as ce, Textarea as de, TreeSelect as se, FormItem as q, Form as ie, Grid as fe, GridItem as V, Button as v, Space as oe } from "@arco-design/web-vue";
3
- import I from "dayjs";
4
- import { FormRenderResolver as pe } from "./resolver.mjs";
5
- const me = Symbol("ArcoConfigProvider"), he = "arco", ye = "$arco", B = (e) => {
1
+ import { getCurrentInstance as M, inject as Y, defineComponent as O, computed as b, openBlock as T, createElementBlock as L, normalizeClass as p, normalizeStyle as z, createElementVNode as R, ref as k, createVNode as i, watch as G, nextTick as K, isRef as V, isVNode as U, h as Q, provide as D, onMounted as E, mergeProps as X, createTextVNode as C, onUpdated as H } from "vue";
2
+ import { DatePicker as J, YearPicker as Z, QuarterPicker as ee, MonthPicker as te, WeekPicker as le, Input as re, InputNumber as ae, Select as ne, Option as ue, Switch as ce, RangePicker as de, Textarea as se, TreeSelect as ie, Cascader as oe, FormItem as q, Form as fe, Grid as me, GridItem as j, Button as S, Space as he } from "@arco-design/web-vue";
3
+ import _ from "dayjs";
4
+ import { FormRenderResolver as rt } from "./resolver.mjs";
5
+ const ye = Symbol("ArcoConfigProvider"), ke = "arco", be = "$arco", W = (e) => {
6
6
  var l, r, t;
7
- const a = _(), c = Y(me, void 0), u = (t = (r = c == null ? void 0 : c.prefixCls) != null ? r : (l = a == null ? void 0 : a.appContext.config.globalProperties[ye]) == null ? void 0 : l.classPrefix) != null ? t : he;
8
- return e ? `${u}-${e}` : u;
9
- }, ke = Object.prototype.toString;
10
- function E(e) {
11
- return ke.call(e) === "[object Number]" && e === e;
7
+ const a = M(), s = Y(ye, void 0), c = (t = (r = s == null ? void 0 : s.prefixCls) != null ? r : (l = a == null ? void 0 : a.appContext.config.globalProperties[be]) == null ? void 0 : l.classPrefix) != null ? t : ke;
8
+ return e ? `${c}-${e}` : c;
9
+ }, Se = Object.prototype.toString;
10
+ function B(e) {
11
+ return Se.call(e) === "[object Number]" && e === e;
12
12
  }
13
- var W = (e, l) => {
13
+ var A = (e, l) => {
14
14
  for (const [r, t] of l)
15
15
  e[r] = t;
16
16
  return e;
17
17
  };
18
- const be = x({
18
+ const ve = O({
19
19
  name: "IconDown",
20
20
  props: {
21
21
  size: {
@@ -44,45 +44,45 @@ const be = x({
44
44
  setup(e, {
45
45
  emit: l
46
46
  }) {
47
- const r = B("icon"), t = b(() => [r, `${r}-down`, {
47
+ const r = W("icon"), t = b(() => [r, `${r}-down`, {
48
48
  [`${r}-spin`]: e.spin
49
49
  }]), a = b(() => {
50
- const u = {};
51
- return e.size && (u.fontSize = E(e.size) ? `${e.size}px` : e.size), e.rotate && (u.transform = `rotate(${e.rotate}deg)`), u;
50
+ const c = {};
51
+ return e.size && (c.fontSize = B(e.size) ? `${e.size}px` : e.size), e.rotate && (c.transform = `rotate(${e.rotate}deg)`), c;
52
52
  });
53
53
  return {
54
54
  cls: t,
55
55
  innerStyle: a,
56
- onClick: (u) => {
57
- l("click", u);
56
+ onClick: (c) => {
57
+ l("click", c);
58
58
  }
59
59
  };
60
60
  }
61
- }), ve = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Se = /* @__PURE__ */ M("path", {
61
+ }), ge = ["stroke-width", "stroke-linecap", "stroke-linejoin"], $e = /* @__PURE__ */ R("path", {
62
62
  d: "M39.6 17.443 24.043 33 8.487 17.443"
63
- }, null, -1), ge = [Se];
64
- function $e(e, l, r, t, a, c) {
65
- return N(), P("svg", {
63
+ }, null, -1), Ce = [$e];
64
+ function we(e, l, r, t, a, s) {
65
+ return T(), L("svg", {
66
66
  viewBox: "0 0 48 48",
67
67
  fill: "none",
68
68
  xmlns: "http://www.w3.org/2000/svg",
69
69
  stroke: "currentColor",
70
- class: L(e.cls),
70
+ class: p(e.cls),
71
71
  style: z(e.innerStyle),
72
72
  "stroke-width": e.strokeWidth,
73
73
  "stroke-linecap": e.strokeLinecap,
74
74
  "stroke-linejoin": e.strokeLinejoin,
75
- onClick: l[0] || (l[0] = (...u) => e.onClick && e.onClick(...u))
76
- }, ge, 14, ve);
75
+ onClick: l[0] || (l[0] = (...c) => e.onClick && e.onClick(...c))
76
+ }, Ce, 14, ge);
77
77
  }
78
- var w = /* @__PURE__ */ W(be, [["render", $e]]);
79
- const Ce = Object.assign(w, {
78
+ var F = /* @__PURE__ */ A(ve, [["render", we]]);
79
+ const Fe = Object.assign(F, {
80
80
  install: (e, l) => {
81
81
  var r;
82
82
  const t = (r = l == null ? void 0 : l.iconPrefix) != null ? r : "";
83
- e.component(t + w.name, w);
83
+ e.component(t + F.name, F);
84
84
  }
85
- }), we = x({
85
+ }), xe = O({
86
86
  name: "IconUp",
87
87
  props: {
88
88
  size: {
@@ -111,65 +111,65 @@ const Ce = Object.assign(w, {
111
111
  setup(e, {
112
112
  emit: l
113
113
  }) {
114
- const r = B("icon"), t = b(() => [r, `${r}-up`, {
114
+ const r = W("icon"), t = b(() => [r, `${r}-up`, {
115
115
  [`${r}-spin`]: e.spin
116
116
  }]), a = b(() => {
117
- const u = {};
118
- return e.size && (u.fontSize = E(e.size) ? `${e.size}px` : e.size), e.rotate && (u.transform = `rotate(${e.rotate}deg)`), u;
117
+ const c = {};
118
+ return e.size && (c.fontSize = B(e.size) ? `${e.size}px` : e.size), e.rotate && (c.transform = `rotate(${e.rotate}deg)`), c;
119
119
  });
120
120
  return {
121
121
  cls: t,
122
122
  innerStyle: a,
123
- onClick: (u) => {
124
- l("click", u);
123
+ onClick: (c) => {
124
+ l("click", c);
125
125
  }
126
126
  };
127
127
  }
128
- }), Fe = ["stroke-width", "stroke-linecap", "stroke-linejoin"], xe = /* @__PURE__ */ M("path", {
128
+ }), Oe = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ve = /* @__PURE__ */ R("path", {
129
129
  d: "M39.6 30.557 24.043 15 8.487 30.557"
130
- }, null, -1), Oe = [xe];
131
- function Ve(e, l, r, t, a, c) {
132
- return N(), P("svg", {
130
+ }, null, -1), Ie = [Ve];
131
+ function De(e, l, r, t, a, s) {
132
+ return T(), L("svg", {
133
133
  viewBox: "0 0 48 48",
134
134
  fill: "none",
135
135
  xmlns: "http://www.w3.org/2000/svg",
136
136
  stroke: "currentColor",
137
- class: L(e.cls),
137
+ class: p(e.cls),
138
138
  style: z(e.innerStyle),
139
139
  "stroke-width": e.strokeWidth,
140
140
  "stroke-linecap": e.strokeLinecap,
141
141
  "stroke-linejoin": e.strokeLinejoin,
142
- onClick: l[0] || (l[0] = (...u) => e.onClick && e.onClick(...u))
143
- }, Oe, 14, Fe);
142
+ onClick: l[0] || (l[0] = (...c) => e.onClick && e.onClick(...c))
143
+ }, Ie, 14, Oe);
144
144
  }
145
- var F = /* @__PURE__ */ W(we, [["render", Ve]]);
146
- const Ie = Object.assign(F, {
145
+ var x = /* @__PURE__ */ A(xe, [["render", De]]);
146
+ const je = Object.assign(x, {
147
147
  install: (e, l) => {
148
148
  var r;
149
149
  const t = (r = l == null ? void 0 : l.iconPrefix) != null ? r : "";
150
- e.component(t + F.name, F);
150
+ e.component(t + x.name, x);
151
151
  }
152
- }), D = {
152
+ }), N = {
153
153
  id: Symbol("ID"),
154
154
  source: Symbol("Source")
155
155
  };
156
- function De(e, l) {
156
+ function _e(e, l) {
157
157
  const r = k({});
158
158
  return e == null || e.forEach((a) => {
159
- let c = null;
160
- a.default && (c = (typeof a.default == "function" ? a.default() : a.default) || null), l && l[a.key] !== void 0 && (c = l[a.key]), r.value[a.key] = c;
159
+ let s = null;
160
+ a.default && (s = (typeof a.default == "function" ? a.default() : a.default) || null), l && l[a.key] !== void 0 && (s = l[a.key]), r.value[a.key] = s;
161
161
  }), [r, (a) => {
162
162
  r.value = a;
163
163
  }];
164
164
  }
165
- function je(e) {
165
+ function Ne(e) {
166
166
  function l(r, t) {
167
167
  return e != null && e.disabledDate ? e.disabledDate(r, t) : !1;
168
168
  }
169
169
  return (r, t) => {
170
170
  switch (e == null ? void 0 : e.type) {
171
171
  case "week":
172
- return d(te, {
172
+ return i(le, {
173
173
  modelValue: r[t.key],
174
174
  "onUpdate:modelValue": (a) => r[t.key] = a,
175
175
  "disabled-date": l,
@@ -177,7 +177,7 @@ function je(e) {
177
177
  "value-format": e == null ? void 0 : e.valueFormat
178
178
  }, null);
179
179
  case "month":
180
- return d(ee, {
180
+ return i(te, {
181
181
  modelValue: r[t.key],
182
182
  "onUpdate:modelValue": (a) => r[t.key] = a,
183
183
  "disabled-date": l,
@@ -185,7 +185,7 @@ function je(e) {
185
185
  "value-format": e == null ? void 0 : e.valueFormat
186
186
  }, null);
187
187
  case "quarter":
188
- return d(p, {
188
+ return i(ee, {
189
189
  modelValue: r[t.key],
190
190
  "onUpdate:modelValue": (a) => r[t.key] = a,
191
191
  "disabled-date": l,
@@ -193,7 +193,7 @@ function je(e) {
193
193
  "value-format": e == null ? void 0 : e.valueFormat
194
194
  }, null);
195
195
  case "year":
196
- return d(Z, {
196
+ return i(Z, {
197
197
  modelValue: r[t.key],
198
198
  "onUpdate:modelValue": (a) => r[t.key] = a,
199
199
  "disabled-date": l,
@@ -202,7 +202,7 @@ function je(e) {
202
202
  }, null);
203
203
  case "date":
204
204
  default:
205
- return d(J, {
205
+ return i(J, {
206
206
  "disabled-input": !0,
207
207
  modelValue: r[t.key],
208
208
  "onUpdate:modelValue": (a) => r[t.key] = a,
@@ -213,11 +213,11 @@ function je(e) {
213
213
  }
214
214
  };
215
215
  }
216
- function _e(e) {
216
+ function Pe(e) {
217
217
  return (l, r) => {
218
218
  switch (e == null ? void 0 : e.type) {
219
219
  case "number":
220
- return d(re, {
220
+ return i(ae, {
221
221
  modelValue: l[r.key],
222
222
  "onUpdate:modelValue": (t) => l[r.key] = t,
223
223
  hideButton: !0,
@@ -227,7 +227,7 @@ function _e(e) {
227
227
  }, null);
228
228
  case "string":
229
229
  default:
230
- return d(le, {
230
+ return i(re, {
231
231
  modelValue: l[r.key],
232
232
  "onUpdate:modelValue": (t) => l[r.key] = t,
233
233
  placeholder: e == null ? void 0 : e.placeholder,
@@ -238,56 +238,56 @@ function _e(e) {
238
238
  };
239
239
  }
240
240
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
241
- function A(e, l, r) {
241
+ function I(e, l, r) {
242
242
  const t = G(e, (...a) => (K(() => t()), l(...a)), r);
243
243
  return t;
244
244
  }
245
- function Ne(e) {
246
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
245
+ function Me(e) {
246
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
247
247
  }
248
- const S = /* @__PURE__ */ new WeakMap();
249
- function Pe() {
248
+ const v = /* @__PURE__ */ new WeakMap();
249
+ function Te() {
250
250
  const e = k(/* @__PURE__ */ new Map());
251
251
  return [e, (r) => e.value = r];
252
252
  }
253
253
  function Le(e) {
254
254
  let l, r = !1;
255
- const [t, a] = Pe(), c = () => {
255
+ const [t, a] = Te(), s = () => {
256
256
  if (!e.autoSumbit || !l)
257
257
  return;
258
- let i = l;
259
- for (; i && i.$el.tagName !== "FORM"; )
260
- i = i.$parent;
261
- i && i.$el && i.$el.dispatchEvent(new Event("submit"));
262
- }, u = (i, n) => {
263
- const s = i();
264
- s instanceof Promise ? s.then(n) : n(s);
265
- }, m = async () => {
266
- const i = S.get(e.options);
267
- switch (typeof i) {
258
+ let u = l;
259
+ for (; u && u.$el.tagName !== "FORM"; )
260
+ u = u.$parent;
261
+ u && u.$el && u.$el.dispatchEvent(new Event("submit"));
262
+ }, c = (u, n) => {
263
+ const d = u();
264
+ d instanceof Promise ? d.then(n) : n(d);
265
+ }, f = async () => {
266
+ const u = v.get(e.options);
267
+ switch (typeof u) {
268
268
  case "function":
269
- S.set(e.options, a);
269
+ v.set(e.options, a);
270
270
  return;
271
271
  case "object":
272
- a(i);
272
+ a(u);
273
273
  return;
274
274
  }
275
- S.set(e.options, a), u(e.options, (n) => {
276
- const s = S.get(e.options);
277
- S.set(e.options, n), s(n);
275
+ v.set(e.options, a), c(e.options, (n) => {
276
+ const d = v.get(e.options);
277
+ v.set(e.options, n), d(n);
278
278
  });
279
279
  }, y = () => {
280
- u(e.options, (i) => {
281
- a(i);
280
+ c(e.options, (u) => {
281
+ a(u);
282
282
  });
283
283
  };
284
284
  switch (!0) {
285
285
  case e.options instanceof Function: {
286
- e.cache !== !1 ? m() : y();
286
+ e.cache !== !1 ? f() : y();
287
287
  break;
288
288
  }
289
- case T(e.options): {
290
- A(e.options, () => {
289
+ case V(e.options): {
290
+ I(e.options, () => {
291
291
  a(e.options.value);
292
292
  }, {
293
293
  immediate: !0
@@ -297,32 +297,32 @@ function Le(e) {
297
297
  default:
298
298
  t.value = e.options;
299
299
  }
300
- return (i, n) => {
301
- let s;
302
- return e.default && !r && (i[n.key] = e.default, r = !0), d(ae, {
303
- ref: (f) => l = f,
300
+ return (u, n) => {
301
+ let d;
302
+ return e.default && !r && (u[n.key] = e.default, r = !0), i(ne, {
303
+ ref: (o) => l = o,
304
304
  multiple: e.multiple,
305
- modelValue: i[n.key],
306
- "onUpdate:modelValue": (f) => i[n.key] = f,
305
+ modelValue: u[n.key],
306
+ "onUpdate:modelValue": (o) => u[n.key] = o,
307
307
  placeholder: e.placeholder,
308
308
  allowClear: e.clearable,
309
309
  allowSearch: e.searchable,
310
310
  maxTagCount: e.maxTagCount ?? 2,
311
- onChange: c
312
- }, Ne(s = Array.from(t.value.entries()).map(([f, o]) => d(ne, {
313
- key: f,
314
- value: f,
315
- label: o
316
- }, null))) ? s : {
317
- default: () => [s]
311
+ onChange: s
312
+ }, Me(d = Array.from(t.value.entries()).map(([o, m]) => i(ue, {
313
+ key: o,
314
+ value: o,
315
+ label: m
316
+ }, null))) ? d : {
317
+ default: () => [d]
318
318
  });
319
319
  };
320
320
  }
321
- function ze(e) {
321
+ function pe(e) {
322
322
  function l() {
323
323
  e != null && e.autoSumbit;
324
324
  }
325
- return (r, t) => (e != null && e.default && (r[t.key] = e.default), d(ue, {
325
+ return (r, t) => (e != null && e.default && (r[t.key] = e.default), i(ce, {
326
326
  modelValue: r[t.key],
327
327
  "onUpdate:modelValue": (a) => r[t.key] = a,
328
328
  checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
@@ -332,40 +332,40 @@ function ze(e) {
332
332
  onChange: l
333
333
  }, null));
334
334
  }
335
- function Me(e) {
335
+ function ze(e) {
336
336
  return (l, r) => {
337
337
  let t = [];
338
- function a(m) {
339
- t = m;
338
+ function a(f) {
339
+ t = f;
340
340
  }
341
- function c(m) {
342
- if (m && m.length === 2) {
343
- const [y, i] = m.sort(), n = I(y).startOf("days"), s = I(i).endOf("days");
344
- l[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), s.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
341
+ function s(f) {
342
+ if (f && f.length === 2) {
343
+ const [y, u] = f.sort(), n = _(y).startOf("days"), d = _(u).endOf("days");
344
+ l[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), d.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
345
345
  }
346
346
  }
347
- function u(m) {
348
- return e != null && e.disabledDate ? e.disabledDate(t, m) : !1;
347
+ function c(f) {
348
+ return e != null && e.disabledDate ? e.disabledDate(t, f) : !1;
349
349
  }
350
- return d("div", null, [d(ce, {
350
+ return i("div", null, [i(de, {
351
351
  "disabled-input": !0,
352
352
  style: {
353
353
  width: "300px"
354
354
  },
355
355
  modelValue: l[r.key],
356
- "onUpdate:modelValue": (m) => l[r.key] = m,
356
+ "onUpdate:modelValue": (f) => l[r.key] = f,
357
357
  onSelect: a,
358
- onChange: c,
358
+ onChange: s,
359
359
  mode: e == null ? void 0 : e.type,
360
360
  allowClear: e == null ? void 0 : e.clearable,
361
- "disabled-date": u,
361
+ "disabled-date": c,
362
362
  format: e == null ? void 0 : e.labelFormat,
363
363
  "value-format": e == null ? void 0 : e.valueFormat
364
364
  }, null)]);
365
365
  };
366
366
  }
367
- function Te(e) {
368
- return (l, r) => d(de, {
367
+ function Re(e) {
368
+ return (l, r) => i(se, {
369
369
  modelValue: l[r.key],
370
370
  "onUpdate:modelValue": (t) => l[r.key] = t,
371
371
  placeholder: e == null ? void 0 : e.placeholder,
@@ -374,23 +374,23 @@ function Te(e) {
374
374
  }, null);
375
375
  }
376
376
  const g = /* @__PURE__ */ new WeakMap();
377
- function Re() {
377
+ function Ue() {
378
378
  const e = k([]);
379
379
  return [e, (r) => e.value = r];
380
380
  }
381
- function Ue(e) {
381
+ function Ee(e) {
382
382
  let l, r = !1;
383
- const [t, a] = Re(), c = () => {
383
+ const [t, a] = Ue(), s = () => {
384
384
  if (!e.autoSumbit || !l)
385
385
  return;
386
386
  let n = l;
387
387
  for (; n && n.$el.tagName !== "FORM"; )
388
388
  n = n.$parent;
389
389
  n && n.$el && n.$el.dispatchEvent(new Event("submit"));
390
- }, u = (n, s) => {
391
- const f = n();
392
- f instanceof Promise ? f.then(s) : s(f);
393
- }, m = async () => {
390
+ }, c = (n, d) => {
391
+ const o = n();
392
+ o instanceof Promise ? o.then(d) : d(o);
393
+ }, f = async () => {
394
394
  const n = g.get(e.options);
395
395
  switch (typeof n) {
396
396
  case "function":
@@ -400,22 +400,22 @@ function Ue(e) {
400
400
  a(n);
401
401
  return;
402
402
  }
403
- g.set(e.options, a), u(e.options, (s) => {
404
- const f = g.get(e.options);
405
- g.set(e.options, s), f(s);
403
+ g.set(e.options, a), c(e.options, (d) => {
404
+ const o = g.get(e.options);
405
+ g.set(e.options, d), o(d);
406
406
  });
407
407
  }, y = () => {
408
- u(e.options, (n) => {
408
+ c(e.options, (n) => {
409
409
  a(n);
410
410
  });
411
411
  };
412
412
  switch (!0) {
413
413
  case e.options instanceof Function: {
414
- e.cache !== !1 ? m() : y();
414
+ e.cache !== !1 ? f() : y();
415
415
  break;
416
416
  }
417
- case T(e.options): {
418
- A(e.options, () => {
417
+ case V(e.options): {
418
+ I(e.options, () => {
419
419
  a(e.options.value);
420
420
  }, {
421
421
  immediate: !0
@@ -425,60 +425,126 @@ function Ue(e) {
425
425
  default:
426
426
  t.value = e.options;
427
427
  }
428
- function i(n, s) {
428
+ function u(n, d) {
429
429
  var h;
430
- const f = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", o = s[f];
431
- return o ? o.toLowerCase().includes(n.toLowerCase()) : !1;
430
+ const o = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", m = d[o];
431
+ return m ? m.toLowerCase().includes(n.toLowerCase()) : !1;
432
432
  }
433
- return (n, s) => (e.default && !r && (n[s.key] = e.default, r = !0), d(se, {
434
- ref: (f) => l = f,
433
+ return (n, d) => (e.default && !r && (n[d.key] = e.default, r = !0), i(ie, {
434
+ ref: (o) => l = o,
435
435
  multiple: e.multiple,
436
- modelValue: n[s.key],
437
- "onUpdate:modelValue": (f) => n[s.key] = f,
436
+ modelValue: n[d.key],
437
+ "onUpdate:modelValue": (o) => n[d.key] = o,
438
438
  placeholder: e.placeholder,
439
439
  allowClear: e.clearable,
440
440
  allowSearch: e.searchable,
441
441
  maxTagCount: e.maxTagCount ?? 2,
442
- onChange: c,
443
- filterTreeNode: i,
442
+ onChange: s,
443
+ filterTreeNode: u,
444
444
  data: t.value,
445
445
  fieldNames: e.fieldNames
446
446
  }, null));
447
447
  }
448
- function qe(e) {
448
+ const $ = /* @__PURE__ */ new WeakMap();
449
+ function qe() {
450
+ const e = k([]);
451
+ return [e, (r) => e.value = r];
452
+ }
453
+ function We(e) {
454
+ let l, r = !1;
455
+ const [t, a] = qe(), s = () => {
456
+ if (!e.autoSumbit || !l)
457
+ return;
458
+ let u = l;
459
+ for (; u && u.$el.tagName !== "FORM"; )
460
+ u = u.$parent;
461
+ u && u.$el && u.$el.dispatchEvent(new Event("submit"));
462
+ }, c = (u, n) => {
463
+ const d = u();
464
+ d instanceof Promise ? d.then(n) : n(d);
465
+ }, f = async () => {
466
+ const u = $.get(e.options);
467
+ switch (typeof u) {
468
+ case "function":
469
+ $.set(e.options, a);
470
+ return;
471
+ case "object":
472
+ a(u);
473
+ return;
474
+ }
475
+ $.set(e.options, a), c(e.options, (n) => {
476
+ const d = $.get(e.options);
477
+ $.set(e.options, n), d(n);
478
+ });
479
+ }, y = () => {
480
+ c(e.options, (u) => {
481
+ a(u);
482
+ });
483
+ };
484
+ switch (!0) {
485
+ case e.options instanceof Function: {
486
+ e.cache !== !1 ? f() : y();
487
+ break;
488
+ }
489
+ case V(e.options): {
490
+ I(e.options, () => {
491
+ a(e.options.value);
492
+ }, {
493
+ immediate: !0
494
+ });
495
+ break;
496
+ }
497
+ default:
498
+ t.value = e.options;
499
+ }
500
+ return (u, n) => (e.default && !r && (u[n.key] = e.default, r = !0), i(oe, {
501
+ ref: (d) => l = d,
502
+ multiple: e.multiple,
503
+ modelValue: u[n.key],
504
+ "onUpdate:modelValue": (d) => u[n.key] = d,
505
+ placeholder: e.placeholder,
506
+ allowClear: e.clearable,
507
+ allowSearch: e.searchable,
508
+ maxTagCount: e.maxTagCount ?? 2,
509
+ onChange: s,
510
+ options: t.value
511
+ }, null));
512
+ }
513
+ function Be(e) {
449
514
  return (l) => e(l);
450
515
  }
451
- function Be() {
516
+ function Ae() {
452
517
  return {
453
- input: _e,
454
- textarea: Te,
518
+ input: Pe,
519
+ textarea: Re,
455
520
  select: Le,
456
- treeSelect: Ue,
457
- date: je,
458
- switch: ze,
459
- dateRange: Me,
460
- render: qe
521
+ treeSelect: Ee,
522
+ date: Ne,
523
+ switch: pe,
524
+ dateRange: ze,
525
+ render: Be,
526
+ cascader: We
461
527
  };
462
528
  }
463
- function Ee(e, l) {
529
+ function Ye(e, l) {
464
530
  l.render || (l.render = (t) => t.input());
465
531
  const r = l.render({
466
- ...Be()
532
+ ...Ae()
467
533
  });
468
534
  return {
469
535
  default: () => r(e, l)
470
536
  };
471
537
  }
472
- function We(e, l) {
538
+ function Ge(e, l) {
473
539
  return Q(q, {
474
540
  field: l.key,
475
541
  label: l.title
476
- }, Ee(e, l));
542
+ }, Ye(e, l));
477
543
  }
478
- function j(e) {
479
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
544
+ function P(e) {
545
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
480
546
  }
481
- const Ae = /* @__PURE__ */ x({
547
+ const Ke = /* @__PURE__ */ O({
482
548
  props: {
483
549
  form: {
484
550
  type: Object,
@@ -530,45 +596,45 @@ const Ae = /* @__PURE__ */ x({
530
596
  emits: ["submit", "cancel", "update:model-value"],
531
597
  expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
532
598
  setup(e) {
533
- const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] = De(e.form, e.modelValue || e.value), c = k(e.columns || 0), u = k(!0), m = () => u.value = !u.value;
534
- O(D.id, l), O(D.source, t);
599
+ const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] = _e(e.form, e.modelValue || e.value), s = k(e.columns || 0), c = k(!0), f = () => c.value = !c.value;
600
+ D(N.id, l), D(N.source, t);
535
601
  const y = b(() => {
536
- if (!c.value)
602
+ if (!s.value)
537
603
  return 1;
538
- const o = e.form.reduce((h, C) => h + ((C == null ? void 0 : C.span) || 1), 0);
539
- return c.value - o % c.value;
540
- }), i = b(() => e.form.reduce((o, h) => (h.rule && (o[h.key] = h.rule), o), {}));
604
+ const m = e.form.reduce((h, w) => h + ((w == null ? void 0 : w.span) || 1), 0);
605
+ return s.value - m % s.value;
606
+ }), u = b(() => e.form.reduce((m, h) => (h.rule && (m[h.key] = h.rule), m), {}));
541
607
  function n() {
542
608
  var h;
543
609
  if (e.columns)
544
610
  return;
545
- const o = (h = r.value) == null ? void 0 : h.$el;
546
- o && (c.value = Math.floor(o.offsetWidth / e.minWidth));
611
+ const m = (h = r.value) == null ? void 0 : h.$el;
612
+ m && (s.value = Math.floor(m.offsetWidth / e.minWidth));
547
613
  }
548
- U(() => {
614
+ E(() => {
549
615
  n();
550
616
  });
551
- function s(o, h) {
552
- t.value[o] = h, a({
617
+ function d(m, h) {
618
+ t.value[m] = h, a({
553
619
  ...t
554
620
  });
555
621
  }
556
- function f() {
557
- var o;
558
- (o = r.value) == null || o.resetFields();
622
+ function o() {
623
+ var m;
624
+ (m = r.value) == null || m.resetFields();
559
625
  }
560
626
  return window.addEventListener("resize", n), {
561
627
  formId: l,
562
628
  formSource: t,
563
629
  formInstance: r,
564
- formColumns: c,
565
- formRules: i,
566
- formCollspased: u,
630
+ formColumns: s,
631
+ formRules: u,
632
+ formCollspased: c,
567
633
  formActiosSpan: y,
568
- toggleFormCollapsed: m,
569
- updateFormField: s,
634
+ toggleFormCollapsed: f,
635
+ updateFormField: d,
570
636
  updateFormSource: a,
571
- reset: f
637
+ reset: o
572
638
  };
573
639
  },
574
640
  render() {
@@ -580,41 +646,41 @@ const Ae = /* @__PURE__ */ x({
580
646
  } : {
581
647
  span: this.formActiosSpan
582
648
  };
583
- if (this.searchable && (t.push(d(v, {
649
+ if (this.searchable && (t.push(i(S, {
584
650
  type: "primary",
585
651
  htmlType: "submit"
586
652
  }, {
587
- default: () => [$("搜索")]
588
- })), t.push(d(v, {
653
+ default: () => [C("搜索")]
654
+ })), t.push(i(S, {
589
655
  type: "secondary",
590
656
  onClick: () => {
591
- var c;
592
- return (c = this.formInstance) == null ? void 0 : c.resetFields();
657
+ var s;
658
+ return (s = this.formInstance) == null ? void 0 : s.resetFields();
593
659
  }
594
660
  }, {
595
- default: () => [$("重置")]
596
- }))), this.submitable && (t.push(d(v, {
661
+ default: () => [C("重置")]
662
+ }))), this.submitable && (t.push(i(S, {
597
663
  type: "primary",
598
664
  htmlType: "submit"
599
665
  }, {
600
- default: () => [$("提交")]
601
- })), t.push(d(v, {
666
+ default: () => [C("提交")]
667
+ })), t.push(i(S, {
602
668
  type: "secondary",
603
669
  onClick: () => this.$emit("cancel")
604
670
  }, {
605
- default: () => [$("取消")]
606
- }))), this.form.some((c) => !!c.collapsed) && t.push(d(v, {
671
+ default: () => [C("取消")]
672
+ }))), this.form.some((s) => !!s.collapsed) && t.push(i(S, {
607
673
  onClick: this.toggleFormCollapsed
608
674
  }, {
609
675
  default: () => this.formCollspased ? "展开" : "收起",
610
- icon: () => this.formCollspased ? d(Ce, null, null) : d(Ie, null, null)
676
+ icon: () => this.formCollspased ? i(Fe, null, null) : i(je, null, null)
611
677
  })), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
612
- return d(V, a, {
613
- default: () => [d(q, {
678
+ return i(j, a, {
679
+ default: () => [i(q, {
614
680
  hideLabel: !0,
615
681
  contentClass: this.footer ? "form-footer" : ""
616
682
  }, {
617
- default: () => [d(oe, null, j(t) ? t : {
683
+ default: () => [i(he, null, P(t) ? t : {
618
684
  default: () => [t]
619
685
  })]
620
686
  })]
@@ -629,9 +695,9 @@ const Ae = /* @__PURE__ */ x({
629
695
  return !0;
630
696
  }
631
697
  });
632
- return d("div", {
698
+ return i("div", {
633
699
  class: "form-render"
634
- }, [d(ie, X({
700
+ }, [i(fe, X({
635
701
  name: this.name
636
702
  }, {
637
703
  labelAlign: "left",
@@ -642,16 +708,16 @@ const Ae = /* @__PURE__ */ x({
642
708
  ref: (t) => this.formInstance = t,
643
709
  model: this.formSource
644
710
  }), {
645
- default: () => [d(fe, {
711
+ default: () => [i(me, {
646
712
  cols: this.formColumns,
647
713
  "col-gap": 24,
648
714
  "rol-gap": 10
649
715
  }, {
650
716
  default: () => [r.filter(() => this.formColumns !== 0).map((t) => {
651
717
  let a;
652
- return d(V, {
718
+ return i(j, {
653
719
  span: t.span
654
- }, j(a = We(this.formSource, t)) ? a : {
720
+ }, P(a = Ge(this.formSource, t)) ? a : {
655
721
  default: () => [a]
656
722
  });
657
723
  }), l()]
@@ -659,27 +725,27 @@ const Ae = /* @__PURE__ */ x({
659
725
  })]);
660
726
  }
661
727
  });
662
- function Qe(e) {
728
+ function Je(e) {
663
729
  return e;
664
730
  }
665
- function Xe(e) {
666
- const l = _(), r = k();
731
+ function Ze(e) {
732
+ const l = M(), r = k();
667
733
  function t() {
668
- var c, u;
669
- const a = (u = (c = l == null ? void 0 : l.proxy) == null ? void 0 : c.$refs) == null ? void 0 : u[e];
734
+ var s, c;
735
+ const a = (c = (s = l == null ? void 0 : l.proxy) == null ? void 0 : s.$refs) == null ? void 0 : c[e];
670
736
  a && (r.value = a);
671
737
  }
672
- return U(t), H(t), r;
738
+ return E(t), H(t), r;
673
739
  }
674
- const He = {
740
+ const et = {
675
741
  install(e, l) {
676
- e.component("FormRender", Ae);
742
+ e.component("FormRender", Ke);
677
743
  }
678
744
  };
679
745
  export {
680
- Ae as FormRender,
681
- pe as FormRenderResolver,
682
- He as default,
683
- Qe as defineForm,
684
- Xe as useForm
746
+ Ke as FormRender,
747
+ rt as FormRenderResolver,
748
+ et as default,
749
+ Je as defineForm,
750
+ Ze as useForm
685
751
  };