@gopowerteam/form-render 0.0.15 → 0.0.17

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 te, Option as le, 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 ie = Symbol("ArcoConfigProvider"), se = "arco", me = "$arco", q = (e) => {
6
+ var l, t, r;
7
+ const n = j(), c = A(ie, void 0), a = (r = (t = c == null ? void 0 : c.prefixCls) != null ? t : (l = n == null ? void 0 : n.appContext.config.globalProperties[me]) == null ? void 0 : l.classPrefix) != null ? r : se;
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
- var E = (e, t) => {
14
- for (const [r, l] of t)
15
- e[r] = l;
13
+ var E = (e, l) => {
14
+ for (const [t, r] of l)
15
+ e[t] = 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: {
@@ -42,47 +42,47 @@ const me = x({
42
42
  click: (e) => !0
43
43
  },
44
44
  setup(e, {
45
- emit: t
45
+ emit: l
46
46
  }) {
47
- const r = q("icon"), l = y(() => [r, `${r}-down`, {
48
- [`${r}-spin`]: e.spin
47
+ const t = q("icon"), r = y(() => [t, `${t}-down`, {
48
+ [`${t}-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
- t("click", a);
57
+ l("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, l, t, 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
- onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
76
- }, ye, 14, oe);
75
+ onClick: l[0] || (l[0] = (...a) => e.onClick && e.onClick(...a))
76
+ }, be, 14, ye);
77
77
  }
78
- var $ = /* @__PURE__ */ E(me, [["render", ke]]);
79
- const be = Object.assign($, {
80
- install: (e, t) => {
81
- var r;
82
- const l = (r = t == null ? void 0 : t.iconPrefix) != null ? r : "";
83
- e.component(l + $.name, $);
78
+ var g = /* @__PURE__ */ E(he, [["render", ve]]);
79
+ const Se = Object.assign(g, {
80
+ install: (e, l) => {
81
+ var t;
82
+ const r = (t = l == null ? void 0 : l.iconPrefix) != null ? t : "";
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: {
@@ -109,116 +109,116 @@ const be = Object.assign($, {
109
109
  click: (e) => !0
110
110
  },
111
111
  setup(e, {
112
- emit: t
112
+ emit: l
113
113
  }) {
114
- const r = q("icon"), l = y(() => [r, `${r}-up`, {
115
- [`${r}-spin`]: e.spin
114
+ const t = q("icon"), r = y(() => [t, `${t}-up`, {
115
+ [`${t}-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
- t("click", a);
124
+ l("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, l, t, 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
- onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
143
- }, ge, 14, Se);
142
+ onClick: l[0] || (l[0] = (...a) => e.onClick && e.onClick(...a))
143
+ }, xe, 14, ge);
144
144
  }
145
- var g = /* @__PURE__ */ E(ve, [["render", Ce]]);
146
- const xe = Object.assign(g, {
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);
145
+ var C = /* @__PURE__ */ E($e, [["render", Fe]]);
146
+ const we = Object.assign(C, {
147
+ install: (e, l) => {
148
+ var t;
149
+ const r = (t = l == null ? void 0 : l.iconPrefix) != null ? t : "";
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, l) {
157
+ const t = 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), l && l[n.key] !== void 0 && (c = l[n.key]), t.value[n.key] = c;
161
+ }), [t, (n) => {
162
+ t.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 l(t, r) {
167
+ return e != null && e.disabledDate ? e.disabledDate(t, r) : !1;
168
168
  }
169
- return (r, l) => {
169
+ return (t, 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,
175
- "disabled-date": t,
172
+ return u(Z, {
173
+ modelValue: t[r.key],
174
+ "onUpdate:modelValue": (n) => t[r.key] = n,
175
+ "disabled-date": l,
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,
183
- "disabled-date": t,
180
+ return u(J, {
181
+ modelValue: t[r.key],
182
+ "onUpdate:modelValue": (n) => t[r.key] = n,
183
+ "disabled-date": l,
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,
191
- "disabled-date": t,
188
+ return u(H, {
189
+ modelValue: t[r.key],
190
+ "onUpdate:modelValue": (n) => t[r.key] = n,
191
+ "disabled-date": l,
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,
199
- "disabled-date": t,
196
+ return u(X, {
197
+ modelValue: t[r.key],
198
+ "onUpdate:modelValue": (n) => t[r.key] = n,
199
+ "disabled-date": l,
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,
208
- "disabled-date": t,
205
+ return u(Q, {
206
+ modelValue: t[r.key],
207
+ "onUpdate:modelValue": (n) => t[r.key] = n,
208
+ "disabled-date": l,
209
209
  format: e == null ? void 0 : e.labelFormat,
210
210
  "value-format": e == null ? void 0 : e.valueFormat
211
211
  }, null);
212
212
  }
213
213
  };
214
214
  }
215
- function Ve(e) {
216
- return (t, r) => {
215
+ function _e(e) {
216
+ return (l, t) => {
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: l[t.key],
221
+ "onUpdate:modelValue": (r) => l[t.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: l[t.key],
231
+ "onUpdate:modelValue": (r) => l[t.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,98 +236,98 @@ 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 l, t = !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
- if (!e.autoSumbit || !t)
269
+ if (!e.autoSumbit || !l)
270
270
  return;
271
- let a = t;
271
+ let a = l;
272
272
  for (; a && a.$el.tagName !== "FORM"; )
273
273
  a = a.$parent;
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, {
279
- ref: (i) => t = i,
277
+ let i;
278
+ return e.default && !t && (a[d.key] = e.default, t = !0), u(te, {
279
+ ref: (s) => l = s,
280
280
  multiple: e.multiple,
281
281
  modelValue: a[d.key],
282
- "onUpdate:modelValue": (i) => a[d.key] = i,
282
+ "onUpdate:modelValue": (s) => a[d.key] = s,
283
283
  placeholder: e.placeholder,
284
284
  allowClear: e.clearable,
285
- maxTagCount: e.maxTagCount ?? 5,
285
+ maxTagCount: e.maxTagCount ?? 2,
286
286
  onChange: c
287
- }, Ie(m = Array.from(l.value.entries()).map(([i, o]) => u(re, {
288
- key: i,
289
- value: i,
290
- label: o
291
- }, null))) ? m : {
292
- default: () => [m]
287
+ }, De(i = Array.from(r.value.entries()).map(([s, h]) => u(le, {
288
+ key: s,
289
+ value: s,
290
+ label: h
291
+ }, null))) ? i : {
292
+ default: () => [i]
293
293
  });
294
294
  };
295
295
  }
296
- function De(e) {
297
- function t() {
296
+ function je(e) {
297
+ function l() {
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 (t, r) => (e != null && e.default && (t[r.key] = e.default), u(re, {
301
+ modelValue: t[r.key],
302
+ "onUpdate:modelValue": (n) => t[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,
306
306
  uncheckedValue: (e == null ? void 0 : e.closeValue) ?? !1,
307
- onChange: t
307
+ onChange: l
308
308
  }, null));
309
309
  }
310
- function je(e) {
311
- return (t, r) => {
312
- let l = [];
310
+ function Ne(e) {
311
+ return (l, t) => {
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 [i, s] = d.sort(), h = _(i).startOf("days"), S = _(s).endOf("days");
319
+ l[t.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: l[t.key],
330
+ "onUpdate:modelValue": (d) => l[t.key] = d,
331
331
  onSelect: n,
332
332
  onChange: c,
333
333
  mode: e == null ? void 0 : e.type,
@@ -338,48 +338,93 @@ 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 (l, t) => u(ne, {
343
+ modelValue: l[t.key],
344
+ "onUpdate:modelValue": (r) => l[t.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) {
351
- return (t) => e(t);
350
+ const F = /* @__PURE__ */ new WeakMap();
351
+ function ze(e) {
352
+ let l, t = !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 || !l)
375
+ return;
376
+ let a = l;
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 && !t && (a[d.key] = e.default, t = !0), u(ue, {
382
+ ref: (i) => l = i,
383
+ multiple: e.multiple,
384
+ modelValue: a[d.key],
385
+ "onUpdate:modelValue": (i) => a[d.key] = i,
386
+ placeholder: e.placeholder,
387
+ allowClear: e.clearable,
388
+ maxTagCount: e.maxTagCount ?? 2,
389
+ onChange: c,
390
+ data: r.value,
391
+ fieldNames: e.fieldNames
392
+ }, null));
393
+ }
394
+ function Me(e) {
395
+ return (l) => e(l);
352
396
  }
353
- function ze() {
397
+ function Le() {
354
398
  return {
355
- input: Ve,
356
- textarea: Oe,
357
- select: _e,
358
- date: we,
359
- switch: De,
360
- dateRange: je,
361
- render: Pe
399
+ input: _e,
400
+ textarea: Pe,
401
+ select: Oe,
402
+ treeSelect: ze,
403
+ date: Ie,
404
+ switch: je,
405
+ dateRange: Ne,
406
+ render: Me
362
407
  };
363
408
  }
364
- function Le(e, t) {
365
- t.render || (t.render = (l) => l.input());
366
- const r = t.render({
367
- ...ze()
409
+ function Ue(e, l) {
410
+ l.render || (l.render = (r) => r.input());
411
+ const t = l.render({
412
+ ...Le()
368
413
  });
369
414
  return {
370
- default: () => r(e, t)
415
+ default: () => t(e, l)
371
416
  };
372
417
  }
373
- function Ne(e, t) {
374
- return W(R, {
375
- field: t.key,
376
- label: t.title
377
- }, Le(e, t));
418
+ function Re(e, l) {
419
+ return Y(T, {
420
+ field: l.key,
421
+ label: l.title
422
+ }, Ue(e, l));
378
423
  }
379
- function D(e) {
380
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !M(e);
424
+ function O(e) {
425
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
381
426
  }
382
- const Me = /* @__PURE__ */ x({
427
+ const Te = /* @__PURE__ */ w({
383
428
  props: {
384
429
  form: {
385
430
  type: Object,
@@ -431,60 +476,60 @@ const Me = /* @__PURE__ */ x({
431
476
  emits: ["submit", "cancel", "update:model-value"],
432
477
  expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
433
478
  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(() => {
479
+ const l = Math.random().toString(32).slice(2).toUpperCase(), t = o(), [r, n] = Ve(e.form, e.modelValue || e.value), c = o(e.columns || 0), a = o(!0), d = () => a.value = !a.value;
480
+ V(D.id, l), V(D.source, r);
481
+ const i = y(() => {
437
482
  if (!c.value)
438
483
  return 1;
439
- const f = e.form.reduce((s, S) => s + ((S == null ? void 0 : S.span) || 1), 0);
484
+ const f = e.form.reduce((m, $) => m + (($ == null ? void 0 : $.span) || 1), 0);
440
485
  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;
486
+ }), s = y(() => e.form.reduce((f, m) => (m.rule && (f[m.key] = m.rule), f), {}));
487
+ function h() {
488
+ var m;
489
+ const f = (m = t.value) == null ? void 0 : m.$el;
445
490
  f && (c.value = Math.floor(f.offsetWidth / e.minWidth));
446
491
  }
447
- U(() => {
448
- o();
492
+ R(() => {
493
+ h();
449
494
  });
450
- function v(f, s) {
451
- l.value[f] = s, n({
452
- ...l
495
+ function S(f, m) {
496
+ r.value[f] = m, n({
497
+ ...r
453
498
  });
454
499
  }
455
- function T() {
500
+ function W() {
456
501
  var f;
457
- (f = r.value) == null || f.resetFields();
502
+ (f = t.value) == null || f.resetFields();
458
503
  }
459
- return window.addEventListener("resize", o), {
460
- formId: t,
461
- formSource: l,
462
- formInstance: r,
504
+ return window.addEventListener("resize", h), {
505
+ formId: l,
506
+ formSource: r,
507
+ formInstance: t,
463
508
  formColumns: c,
464
- formRules: i,
509
+ formRules: s,
465
510
  formCollspased: a,
466
- formActiosSpan: m,
511
+ formActiosSpan: i,
467
512
  toggleFormCollapsed: d,
468
- updateFormField: v,
513
+ updateFormField: S,
469
514
  updateFormSource: n,
470
- reset: T
515
+ reset: W
471
516
  };
472
517
  },
473
518
  render() {
474
519
  const e = () => {
475
520
  this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
476
- }, t = () => {
477
- const r = [], l = this.footer ? {
521
+ }, l = () => {
522
+ const t = [], r = this.footer ? {
478
523
  span: this.formColumns
479
524
  } : {
480
525
  span: this.formActiosSpan
481
526
  };
482
- if (this.searchable && (r.push(u(k, {
527
+ if (this.searchable && (t.push(u(k, {
483
528
  type: "primary",
484
529
  htmlType: "submit"
485
530
  }, {
486
531
  default: () => [b("搜索")]
487
- })), r.push(u(k, {
532
+ })), t.push(u(k, {
488
533
  type: "secondary",
489
534
  onClick: () => {
490
535
  var n;
@@ -492,36 +537,36 @@ const Me = /* @__PURE__ */ x({
492
537
  }
493
538
  }, {
494
539
  default: () => [b("重置")]
495
- }))), this.submitable && (r.push(u(k, {
540
+ }))), this.submitable && (t.push(u(k, {
496
541
  type: "primary",
497
542
  htmlType: "submit"
498
543
  }, {
499
544
  default: () => [b("提交")]
500
- })), r.push(u(k, {
545
+ })), t.push(u(k, {
501
546
  type: "secondary",
502
547
  onClick: () => this.$emit("cancel")
503
548
  }, {
504
549
  default: () => [b("取消")]
505
- }))), this.form.some((n) => !!n.collapsed) && r.push(u(k, {
550
+ }))), this.form.some((n) => !!n.collapsed) && t.push(u(k, {
506
551
  onClick: this.toggleFormCollapsed
507
552
  }, {
508
553
  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, {
554
+ icon: () => this.formCollspased ? u(Se, null, null) : u(we, null, null)
555
+ })), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
556
+ return u(I, r, {
557
+ default: () => [u(T, {
513
558
  hideLabel: !0,
514
559
  contentClass: this.footer ? "form-footer" : ""
515
560
  }, {
516
- default: () => [u(ce, null, D(r) ? r : {
517
- default: () => [r]
561
+ default: () => [u(fe, null, O(t) ? t : {
562
+ default: () => [t]
518
563
  })]
519
564
  })]
520
565
  });
521
566
  };
522
567
  return u("div", {
523
568
  class: "form-render"
524
- }, [u(ne, Y({
569
+ }, [u(ce, G({
525
570
  layout: this.$props.layout,
526
571
  rules: this.formRules,
527
572
  onSubmitSuccess: e
@@ -529,47 +574,47 @@ const Me = /* @__PURE__ */ x({
529
574
  name: this.name
530
575
  }, {
531
576
  "auto-label-width": !0,
532
- ref: (r) => this.formInstance = r,
577
+ ref: (t) => this.formInstance = t,
533
578
  model: this.formSource
534
579
  }), {
535
- default: () => [u(ue, {
580
+ default: () => [u(de, {
536
581
  cols: this.formColumns,
537
582
  "col-gap": 10,
538
583
  "rol-gap": 10
539
584
  }, {
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]
585
+ default: () => [this.form.filter((t) => this.formCollspased ? !t.collapsed : !0).map((t) => {
586
+ let r;
587
+ return u(I, {
588
+ span: t.span
589
+ }, O(r = Re(this.formSource, t)) ? r : {
590
+ default: () => [r]
546
591
  });
547
- }), t()]
592
+ }), l()]
548
593
  })]
549
594
  })]);
550
595
  }
551
596
  });
552
- function Be(e) {
597
+ function We(e) {
553
598
  return e;
554
599
  }
555
- function Ee(e) {
556
- const t = j(), r = h();
557
- function l() {
600
+ function Ae(e) {
601
+ const l = j(), t = o();
602
+ function r() {
558
603
  var c, a;
559
- 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);
604
+ const n = (a = (c = l == null ? void 0 : l.proxy) == null ? void 0 : c.$refs) == null ? void 0 : a[e];
605
+ n && (t.value = n);
561
606
  }
562
- return U(l), G(l), r;
607
+ return R(r), K(r), t;
563
608
  }
564
- const Te = {
565
- install(e, t) {
566
- e.component("FormRender", Me);
609
+ const Ye = {
610
+ install(e, l) {
611
+ e.component("FormRender", Te);
567
612
  }
568
613
  };
569
614
  export {
570
- Me as FormRender,
571
- Ye as FormRenderResolver,
572
- Te as default,
573
- Be as defineForm,
574
- Ee as useForm
615
+ Te as FormRender,
616
+ Qe as FormRenderResolver,
617
+ Ye as default,
618
+ We as defineForm,
619
+ Ae as useForm
575
620
  };