@gopowerteam/form-render 0.0.20 → 0.0.22

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