@gopowerteam/form-render 0.0.16 → 0.0.18

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