@gopowerteam/form-render 0.0.29 → 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 T, createElementVNode as z, ref as k, createVNode as d, watch as G, nextTick as K, isRef as M, 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 oe, Grid as ie, GridItem as V, Button as S, Space as fe } 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
- }), Se = ["stroke-width", "stroke-linecap", "stroke-linejoin"], ge = /* @__PURE__ */ z("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), ve = [ge];
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),
71
- style: T(e.innerStyle),
70
+ class: p(e.cls),
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
- }, ve, 14, Se);
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__ */ z("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),
138
- style: T(e.innerStyle),
137
+ class: p(e.cls),
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,57 +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 g = /* @__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
- console.log("开始渲染Select:");
255
254
  let l, r = !1;
256
- const [t, a] = Pe(), c = () => {
255
+ const [t, a] = Te(), s = () => {
257
256
  if (!e.autoSumbit || !l)
258
257
  return;
259
- let o = l;
260
- for (; o && o.$el.tagName !== "FORM"; )
261
- o = o.$parent;
262
- o && o.$el && o.$el.dispatchEvent(new Event("submit"));
263
- }, u = (o, n) => {
264
- const s = o();
265
- s instanceof Promise ? s.then(n) : n(s);
266
- }, m = async () => {
267
- const o = g.get(e.options);
268
- switch (console.log("当前缓存值:", o), typeof o) {
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) {
269
268
  case "function":
270
- console.log("检测到缓存正在请求中"), console.log("更新缓存"), g.set(e.options, a);
269
+ v.set(e.options, a);
271
270
  return;
272
271
  case "object":
273
- console.log("检测到缓存数据完成"), a(o);
272
+ a(u);
274
273
  return;
275
274
  }
276
- console.log("未检测到缓存开始进行请求"), g.set(e.options, a), u(e.options, (n) => {
277
- const s = g.get(e.options);
278
- g.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);
279
278
  });
280
279
  }, y = () => {
281
- u(e.options, (o) => {
282
- a(o);
280
+ c(e.options, (u) => {
281
+ a(u);
283
282
  });
284
283
  };
285
284
  switch (!0) {
286
285
  case e.options instanceof Function: {
287
- e.cache !== !1 ? (console.log("缓存开启"), m()) : (console.log("缓存关闭"), y());
286
+ e.cache !== !1 ? f() : y();
288
287
  break;
289
288
  }
290
- case M(e.options): {
291
- A(e.options, () => {
289
+ case V(e.options): {
290
+ I(e.options, () => {
292
291
  a(e.options.value);
293
292
  }, {
294
293
  immediate: !0
@@ -298,32 +297,32 @@ function Le(e) {
298
297
  default:
299
298
  t.value = e.options;
300
299
  }
301
- return (o, n) => {
302
- let s;
303
- return e.default && !r && (o[n.key] = e.default, r = !0), d(ae, {
304
- ref: (i) => l = i,
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,
305
304
  multiple: e.multiple,
306
- modelValue: o[n.key],
307
- "onUpdate:modelValue": (i) => o[n.key] = i,
305
+ modelValue: u[n.key],
306
+ "onUpdate:modelValue": (o) => u[n.key] = o,
308
307
  placeholder: e.placeholder,
309
308
  allowClear: e.clearable,
310
309
  allowSearch: e.searchable,
311
310
  maxTagCount: e.maxTagCount ?? 2,
312
- onChange: c
313
- }, Ne(s = Array.from(t.value.entries()).map(([i, f]) => d(ne, {
314
- key: i,
315
- value: i,
316
- label: f
317
- }, null))) ? s : {
318
- 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]
319
318
  });
320
319
  };
321
320
  }
322
- function Te(e) {
321
+ function pe(e) {
323
322
  function l() {
324
323
  e != null && e.autoSumbit;
325
324
  }
326
- 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, {
327
326
  modelValue: r[t.key],
328
327
  "onUpdate:modelValue": (a) => r[t.key] = a,
329
328
  checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
@@ -336,37 +335,37 @@ function Te(e) {
336
335
  function ze(e) {
337
336
  return (l, r) => {
338
337
  let t = [];
339
- function a(m) {
340
- t = m;
338
+ function a(f) {
339
+ t = f;
341
340
  }
342
- function c(m) {
343
- if (m && m.length === 2) {
344
- const [y, o] = m.sort(), n = I(y).startOf("days"), s = I(o).endOf("days");
345
- 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")];
346
345
  }
347
346
  }
348
- function u(m) {
349
- 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;
350
349
  }
351
- return d("div", null, [d(ce, {
350
+ return i("div", null, [i(de, {
352
351
  "disabled-input": !0,
353
352
  style: {
354
353
  width: "300px"
355
354
  },
356
355
  modelValue: l[r.key],
357
- "onUpdate:modelValue": (m) => l[r.key] = m,
356
+ "onUpdate:modelValue": (f) => l[r.key] = f,
358
357
  onSelect: a,
359
- onChange: c,
358
+ onChange: s,
360
359
  mode: e == null ? void 0 : e.type,
361
360
  allowClear: e == null ? void 0 : e.clearable,
362
- "disabled-date": u,
361
+ "disabled-date": c,
363
362
  format: e == null ? void 0 : e.labelFormat,
364
363
  "value-format": e == null ? void 0 : e.valueFormat
365
364
  }, null)]);
366
365
  };
367
366
  }
368
- function Me(e) {
369
- return (l, r) => d(de, {
367
+ function Re(e) {
368
+ return (l, r) => i(se, {
370
369
  modelValue: l[r.key],
371
370
  "onUpdate:modelValue": (t) => l[r.key] = t,
372
371
  placeholder: e == null ? void 0 : e.placeholder,
@@ -374,50 +373,49 @@ function Me(e) {
374
373
  maxLength: e == null ? void 0 : e.maxLength
375
374
  }, null);
376
375
  }
377
- const v = /* @__PURE__ */ new WeakMap();
378
- function Re() {
376
+ const g = /* @__PURE__ */ new WeakMap();
377
+ function Ue() {
379
378
  const e = k([]);
380
379
  return [e, (r) => e.value = r];
381
380
  }
382
- function Ue(e) {
383
- console.log("开始渲染SelectTree:");
381
+ function Ee(e) {
384
382
  let l, r = !1;
385
- const [t, a] = Re(), c = () => {
383
+ const [t, a] = Ue(), s = () => {
386
384
  if (!e.autoSumbit || !l)
387
385
  return;
388
386
  let n = l;
389
387
  for (; n && n.$el.tagName !== "FORM"; )
390
388
  n = n.$parent;
391
389
  n && n.$el && n.$el.dispatchEvent(new Event("submit"));
392
- }, u = (n, s) => {
393
- const i = n();
394
- i instanceof Promise ? i.then(s) : s(i);
395
- }, m = async () => {
396
- const n = v.get(e.options);
397
- switch (console.log("当前缓存值:", n), typeof n) {
390
+ }, c = (n, d) => {
391
+ const o = n();
392
+ o instanceof Promise ? o.then(d) : d(o);
393
+ }, f = async () => {
394
+ const n = g.get(e.options);
395
+ switch (typeof n) {
398
396
  case "function":
399
- console.log("检测到缓存正在请求中"), console.log("更新缓存"), v.set(e.options, a);
397
+ g.set(e.options, a);
400
398
  return;
401
399
  case "object":
402
- console.log("检测到缓存数据完成"), a(n);
400
+ a(n);
403
401
  return;
404
402
  }
405
- console.log("未检测到缓存开始进行请求"), v.set(e.options, a), u(e.options, (s) => {
406
- const i = v.get(e.options);
407
- v.set(e.options, s), i(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);
408
406
  });
409
407
  }, y = () => {
410
- u(e.options, (n) => {
408
+ c(e.options, (n) => {
411
409
  a(n);
412
410
  });
413
411
  };
414
412
  switch (!0) {
415
413
  case e.options instanceof Function: {
416
- e.cache !== !1 ? (console.log("缓存开启"), m()) : (console.log("缓存关闭"), y());
414
+ e.cache !== !1 ? f() : y();
417
415
  break;
418
416
  }
419
- case M(e.options): {
420
- A(e.options, () => {
417
+ case V(e.options): {
418
+ I(e.options, () => {
421
419
  a(e.options.value);
422
420
  }, {
423
421
  immediate: !0
@@ -427,60 +425,126 @@ function Ue(e) {
427
425
  default:
428
426
  t.value = e.options;
429
427
  }
430
- function o(n, s) {
428
+ function u(n, d) {
431
429
  var h;
432
- const i = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", f = s[i];
433
- return f ? f.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;
434
432
  }
435
- return (n, s) => (e.default && !r && (n[s.key] = e.default, r = !0), d(se, {
436
- ref: (i) => l = i,
433
+ return (n, d) => (e.default && !r && (n[d.key] = e.default, r = !0), i(ie, {
434
+ ref: (o) => l = o,
437
435
  multiple: e.multiple,
438
- modelValue: n[s.key],
439
- "onUpdate:modelValue": (i) => n[s.key] = i,
436
+ modelValue: n[d.key],
437
+ "onUpdate:modelValue": (o) => n[d.key] = o,
440
438
  placeholder: e.placeholder,
441
439
  allowClear: e.clearable,
442
440
  allowSearch: e.searchable,
443
441
  maxTagCount: e.maxTagCount ?? 2,
444
- onChange: c,
445
- filterTreeNode: o,
442
+ onChange: s,
443
+ filterTreeNode: u,
446
444
  data: t.value,
447
445
  fieldNames: e.fieldNames
448
446
  }, null));
449
447
  }
450
- 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) {
451
514
  return (l) => e(l);
452
515
  }
453
- function Be() {
516
+ function Ae() {
454
517
  return {
455
- input: _e,
456
- textarea: Me,
518
+ input: Pe,
519
+ textarea: Re,
457
520
  select: Le,
458
- treeSelect: Ue,
459
- date: je,
460
- switch: Te,
521
+ treeSelect: Ee,
522
+ date: Ne,
523
+ switch: pe,
461
524
  dateRange: ze,
462
- render: qe
525
+ render: Be,
526
+ cascader: We
463
527
  };
464
528
  }
465
- function Ee(e, l) {
529
+ function Ye(e, l) {
466
530
  l.render || (l.render = (t) => t.input());
467
531
  const r = l.render({
468
- ...Be()
532
+ ...Ae()
469
533
  });
470
534
  return {
471
535
  default: () => r(e, l)
472
536
  };
473
537
  }
474
- function We(e, l) {
538
+ function Ge(e, l) {
475
539
  return Q(q, {
476
540
  field: l.key,
477
541
  label: l.title
478
- }, Ee(e, l));
542
+ }, Ye(e, l));
479
543
  }
480
- function j(e) {
481
- 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);
482
546
  }
483
- const Ae = /* @__PURE__ */ x({
547
+ const Ke = /* @__PURE__ */ O({
484
548
  props: {
485
549
  form: {
486
550
  type: Object,
@@ -532,45 +596,45 @@ const Ae = /* @__PURE__ */ x({
532
596
  emits: ["submit", "cancel", "update:model-value"],
533
597
  expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
534
598
  setup(e) {
535
- 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;
536
- 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);
537
601
  const y = b(() => {
538
- if (!c.value)
602
+ if (!s.value)
539
603
  return 1;
540
- const f = e.form.reduce((h, C) => h + ((C == null ? void 0 : C.span) || 1), 0);
541
- return c.value - f % c.value;
542
- }), o = b(() => e.form.reduce((f, h) => (h.rule && (f[h.key] = h.rule), f), {}));
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), {}));
543
607
  function n() {
544
608
  var h;
545
609
  if (e.columns)
546
610
  return;
547
- const f = (h = r.value) == null ? void 0 : h.$el;
548
- f && (c.value = Math.floor(f.offsetWidth / e.minWidth));
611
+ const m = (h = r.value) == null ? void 0 : h.$el;
612
+ m && (s.value = Math.floor(m.offsetWidth / e.minWidth));
549
613
  }
550
- U(() => {
614
+ E(() => {
551
615
  n();
552
616
  });
553
- function s(f, h) {
554
- t.value[f] = h, a({
617
+ function d(m, h) {
618
+ t.value[m] = h, a({
555
619
  ...t
556
620
  });
557
621
  }
558
- function i() {
559
- var f;
560
- (f = r.value) == null || f.resetFields();
622
+ function o() {
623
+ var m;
624
+ (m = r.value) == null || m.resetFields();
561
625
  }
562
626
  return window.addEventListener("resize", n), {
563
627
  formId: l,
564
628
  formSource: t,
565
629
  formInstance: r,
566
- formColumns: c,
567
- formRules: o,
568
- formCollspased: u,
630
+ formColumns: s,
631
+ formRules: u,
632
+ formCollspased: c,
569
633
  formActiosSpan: y,
570
- toggleFormCollapsed: m,
571
- updateFormField: s,
634
+ toggleFormCollapsed: f,
635
+ updateFormField: d,
572
636
  updateFormSource: a,
573
- reset: i
637
+ reset: o
574
638
  };
575
639
  },
576
640
  render() {
@@ -582,41 +646,41 @@ const Ae = /* @__PURE__ */ x({
582
646
  } : {
583
647
  span: this.formActiosSpan
584
648
  };
585
- if (this.searchable && (t.push(d(S, {
649
+ if (this.searchable && (t.push(i(S, {
586
650
  type: "primary",
587
651
  htmlType: "submit"
588
652
  }, {
589
- default: () => [$("搜索")]
590
- })), t.push(d(S, {
653
+ default: () => [C("搜索")]
654
+ })), t.push(i(S, {
591
655
  type: "secondary",
592
656
  onClick: () => {
593
- var c;
594
- return (c = this.formInstance) == null ? void 0 : c.resetFields();
657
+ var s;
658
+ return (s = this.formInstance) == null ? void 0 : s.resetFields();
595
659
  }
596
660
  }, {
597
- default: () => [$("重置")]
598
- }))), this.submitable && (t.push(d(S, {
661
+ default: () => [C("重置")]
662
+ }))), this.submitable && (t.push(i(S, {
599
663
  type: "primary",
600
664
  htmlType: "submit"
601
665
  }, {
602
- default: () => [$("提交")]
603
- })), t.push(d(S, {
666
+ default: () => [C("提交")]
667
+ })), t.push(i(S, {
604
668
  type: "secondary",
605
669
  onClick: () => this.$emit("cancel")
606
670
  }, {
607
- default: () => [$("取消")]
608
- }))), this.form.some((c) => !!c.collapsed) && t.push(d(S, {
671
+ default: () => [C("取消")]
672
+ }))), this.form.some((s) => !!s.collapsed) && t.push(i(S, {
609
673
  onClick: this.toggleFormCollapsed
610
674
  }, {
611
675
  default: () => this.formCollspased ? "展开" : "收起",
612
- icon: () => this.formCollspased ? d(Ce, null, null) : d(Ie, null, null)
676
+ icon: () => this.formCollspased ? i(Fe, null, null) : i(je, null, null)
613
677
  })), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
614
- return d(V, a, {
615
- default: () => [d(q, {
678
+ return i(j, a, {
679
+ default: () => [i(q, {
616
680
  hideLabel: !0,
617
681
  contentClass: this.footer ? "form-footer" : ""
618
682
  }, {
619
- default: () => [d(fe, null, j(t) ? t : {
683
+ default: () => [i(he, null, P(t) ? t : {
620
684
  default: () => [t]
621
685
  })]
622
686
  })]
@@ -631,29 +695,29 @@ const Ae = /* @__PURE__ */ x({
631
695
  return !0;
632
696
  }
633
697
  });
634
- return d("div", {
698
+ return i("div", {
635
699
  class: "form-render"
636
- }, [d(oe, X({
637
- layout: this.$props.layout,
638
- rules: this.formRules,
639
- onSubmitSuccess: e
640
- }, {
700
+ }, [i(fe, X({
641
701
  name: this.name
642
702
  }, {
703
+ labelAlign: "left",
704
+ layout: this.$props.layout,
705
+ rules: this.formRules,
706
+ onSubmitSuccess: e,
643
707
  "auto-label-width": !0,
644
708
  ref: (t) => this.formInstance = t,
645
709
  model: this.formSource
646
710
  }), {
647
- default: () => [d(ie, {
711
+ default: () => [i(me, {
648
712
  cols: this.formColumns,
649
- "col-gap": 10,
713
+ "col-gap": 24,
650
714
  "rol-gap": 10
651
715
  }, {
652
716
  default: () => [r.filter(() => this.formColumns !== 0).map((t) => {
653
717
  let a;
654
- return d(V, {
718
+ return i(j, {
655
719
  span: t.span
656
- }, j(a = We(this.formSource, t)) ? a : {
720
+ }, P(a = Ge(this.formSource, t)) ? a : {
657
721
  default: () => [a]
658
722
  });
659
723
  }), l()]
@@ -661,27 +725,27 @@ const Ae = /* @__PURE__ */ x({
661
725
  })]);
662
726
  }
663
727
  });
664
- function Qe(e) {
728
+ function Je(e) {
665
729
  return e;
666
730
  }
667
- function Xe(e) {
668
- const l = _(), r = k();
731
+ function Ze(e) {
732
+ const l = M(), r = k();
669
733
  function t() {
670
- var c, u;
671
- 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];
672
736
  a && (r.value = a);
673
737
  }
674
- return U(t), H(t), r;
738
+ return E(t), H(t), r;
675
739
  }
676
- const He = {
740
+ const et = {
677
741
  install(e, l) {
678
- e.component("FormRender", Ae);
742
+ e.component("FormRender", Ke);
679
743
  }
680
744
  };
681
745
  export {
682
- Ae as FormRender,
683
- pe as FormRenderResolver,
684
- He as default,
685
- Qe as defineForm,
686
- Xe as useForm
746
+ Ke as FormRender,
747
+ rt as FormRenderResolver,
748
+ et as default,
749
+ Je as defineForm,
750
+ Ze as useForm
687
751
  };