@gopowerteam/form-render 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/form-items/cascader/index.d.ts +16 -0
- package/dist/cjs/form-items/index.d.ts +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/form-items/cascader/index.d.ts +16 -0
- package/dist/es/form-items/index.d.ts +1 -0
- package/dist/es/index.mjs +270 -204
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/es/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { DatePicker as J, YearPicker as Z, QuarterPicker as
|
|
3
|
-
import
|
|
4
|
-
import { FormRenderResolver as
|
|
5
|
-
const
|
|
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 =
|
|
8
|
-
return e ? `${
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
return
|
|
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
|
|
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
|
|
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 =
|
|
47
|
+
const r = W("icon"), t = b(() => [r, `${r}-down`, {
|
|
48
48
|
[`${r}-spin`]: e.spin
|
|
49
49
|
}]), a = b(() => {
|
|
50
|
-
const
|
|
51
|
-
return e.size && (
|
|
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: (
|
|
57
|
-
l("click",
|
|
56
|
+
onClick: (c) => {
|
|
57
|
+
l("click", c);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
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),
|
|
64
|
-
function
|
|
65
|
-
return
|
|
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:
|
|
70
|
+
class: p(e.cls),
|
|
71
71
|
style: z(e.innerStyle),
|
|
72
72
|
"stroke-width": e.strokeWidth,
|
|
73
73
|
"stroke-linecap": e.strokeLinecap,
|
|
74
74
|
"stroke-linejoin": e.strokeLinejoin,
|
|
75
|
-
onClick: l[0] || (l[0] = (...
|
|
76
|
-
},
|
|
75
|
+
onClick: l[0] || (l[0] = (...c) => e.onClick && e.onClick(...c))
|
|
76
|
+
}, Ce, 14, ge);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
const
|
|
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 +
|
|
83
|
+
e.component(t + F.name, F);
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
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 =
|
|
114
|
+
const r = W("icon"), t = b(() => [r, `${r}-up`, {
|
|
115
115
|
[`${r}-spin`]: e.spin
|
|
116
116
|
}]), a = b(() => {
|
|
117
|
-
const
|
|
118
|
-
return e.size && (
|
|
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: (
|
|
124
|
-
l("click",
|
|
123
|
+
onClick: (c) => {
|
|
124
|
+
l("click", c);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
}),
|
|
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),
|
|
131
|
-
function
|
|
132
|
-
return
|
|
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:
|
|
137
|
+
class: p(e.cls),
|
|
138
138
|
style: z(e.innerStyle),
|
|
139
139
|
"stroke-width": e.strokeWidth,
|
|
140
140
|
"stroke-linecap": e.strokeLinecap,
|
|
141
141
|
"stroke-linejoin": e.strokeLinejoin,
|
|
142
|
-
onClick: l[0] || (l[0] = (...
|
|
143
|
-
},
|
|
142
|
+
onClick: l[0] || (l[0] = (...c) => e.onClick && e.onClick(...c))
|
|
143
|
+
}, Ie, 14, Oe);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
const
|
|
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 +
|
|
150
|
+
e.component(t + x.name, x);
|
|
151
151
|
}
|
|
152
|
-
}),
|
|
152
|
+
}), N = {
|
|
153
153
|
id: Symbol("ID"),
|
|
154
154
|
source: Symbol("Source")
|
|
155
155
|
};
|
|
156
|
-
function
|
|
156
|
+
function _e(e, l) {
|
|
157
157
|
const r = k({});
|
|
158
158
|
return e == null || e.forEach((a) => {
|
|
159
|
-
let
|
|
160
|
-
a.default && (
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
216
|
+
function Pe(e) {
|
|
217
217
|
return (l, r) => {
|
|
218
218
|
switch (e == null ? void 0 : e.type) {
|
|
219
219
|
case "number":
|
|
220
|
-
return
|
|
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
|
|
230
|
+
return i(re, {
|
|
231
231
|
modelValue: l[r.key],
|
|
232
232
|
"onUpdate:modelValue": (t) => l[r.key] = t,
|
|
233
233
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
@@ -238,56 +238,56 @@ function _e(e) {
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
241
|
-
function
|
|
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
|
|
246
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
245
|
+
function Me(e) {
|
|
246
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
function
|
|
248
|
+
const v = /* @__PURE__ */ new WeakMap();
|
|
249
|
+
function Te() {
|
|
250
250
|
const e = k(/* @__PURE__ */ new Map());
|
|
251
251
|
return [e, (r) => e.value = r];
|
|
252
252
|
}
|
|
253
253
|
function Le(e) {
|
|
254
254
|
let l, r = !1;
|
|
255
|
-
const [t, a] =
|
|
255
|
+
const [t, a] = Te(), s = () => {
|
|
256
256
|
if (!e.autoSumbit || !l)
|
|
257
257
|
return;
|
|
258
|
-
let
|
|
259
|
-
for (;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
},
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
const
|
|
267
|
-
switch (typeof
|
|
258
|
+
let u = l;
|
|
259
|
+
for (; u && u.$el.tagName !== "FORM"; )
|
|
260
|
+
u = u.$parent;
|
|
261
|
+
u && u.$el && u.$el.dispatchEvent(new Event("submit"));
|
|
262
|
+
}, c = (u, n) => {
|
|
263
|
+
const d = u();
|
|
264
|
+
d instanceof Promise ? d.then(n) : n(d);
|
|
265
|
+
}, f = async () => {
|
|
266
|
+
const u = v.get(e.options);
|
|
267
|
+
switch (typeof u) {
|
|
268
268
|
case "function":
|
|
269
|
-
|
|
269
|
+
v.set(e.options, a);
|
|
270
270
|
return;
|
|
271
271
|
case "object":
|
|
272
|
-
a(
|
|
272
|
+
a(u);
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
|
|
275
|
+
v.set(e.options, a), c(e.options, (n) => {
|
|
276
|
+
const d = v.get(e.options);
|
|
277
|
+
v.set(e.options, n), d(n);
|
|
278
278
|
});
|
|
279
279
|
}, y = () => {
|
|
280
|
-
|
|
281
|
-
a(
|
|
280
|
+
c(e.options, (u) => {
|
|
281
|
+
a(u);
|
|
282
282
|
});
|
|
283
283
|
};
|
|
284
284
|
switch (!0) {
|
|
285
285
|
case e.options instanceof Function: {
|
|
286
|
-
e.cache !== !1 ?
|
|
286
|
+
e.cache !== !1 ? f() : y();
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
|
-
case
|
|
290
|
-
|
|
289
|
+
case V(e.options): {
|
|
290
|
+
I(e.options, () => {
|
|
291
291
|
a(e.options.value);
|
|
292
292
|
}, {
|
|
293
293
|
immediate: !0
|
|
@@ -297,32 +297,32 @@ function Le(e) {
|
|
|
297
297
|
default:
|
|
298
298
|
t.value = e.options;
|
|
299
299
|
}
|
|
300
|
-
return (
|
|
301
|
-
let
|
|
302
|
-
return e.default && !r && (
|
|
303
|
-
ref: (
|
|
300
|
+
return (u, n) => {
|
|
301
|
+
let d;
|
|
302
|
+
return e.default && !r && (u[n.key] = e.default, r = !0), i(ne, {
|
|
303
|
+
ref: (o) => l = o,
|
|
304
304
|
multiple: e.multiple,
|
|
305
|
-
modelValue:
|
|
306
|
-
"onUpdate:modelValue": (
|
|
305
|
+
modelValue: u[n.key],
|
|
306
|
+
"onUpdate:modelValue": (o) => u[n.key] = o,
|
|
307
307
|
placeholder: e.placeholder,
|
|
308
308
|
allowClear: e.clearable,
|
|
309
309
|
allowSearch: e.searchable,
|
|
310
310
|
maxTagCount: e.maxTagCount ?? 2,
|
|
311
|
-
onChange:
|
|
312
|
-
},
|
|
313
|
-
key:
|
|
314
|
-
value:
|
|
315
|
-
label:
|
|
316
|
-
}, null))) ?
|
|
317
|
-
default: () => [
|
|
311
|
+
onChange: s
|
|
312
|
+
}, Me(d = Array.from(t.value.entries()).map(([o, m]) => i(ue, {
|
|
313
|
+
key: o,
|
|
314
|
+
value: o,
|
|
315
|
+
label: m
|
|
316
|
+
}, null))) ? d : {
|
|
317
|
+
default: () => [d]
|
|
318
318
|
});
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function pe(e) {
|
|
322
322
|
function l() {
|
|
323
323
|
e != null && e.autoSumbit;
|
|
324
324
|
}
|
|
325
|
-
return (r, t) => (e != null && e.default && (r[t.key] = e.default),
|
|
325
|
+
return (r, t) => (e != null && e.default && (r[t.key] = e.default), i(ce, {
|
|
326
326
|
modelValue: r[t.key],
|
|
327
327
|
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
328
328
|
checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
|
|
@@ -332,40 +332,40 @@ function ze(e) {
|
|
|
332
332
|
onChange: l
|
|
333
333
|
}, null));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function ze(e) {
|
|
336
336
|
return (l, r) => {
|
|
337
337
|
let t = [];
|
|
338
|
-
function a(
|
|
339
|
-
t =
|
|
338
|
+
function a(f) {
|
|
339
|
+
t = f;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
if (
|
|
343
|
-
const [y,
|
|
344
|
-
l[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"),
|
|
341
|
+
function s(f) {
|
|
342
|
+
if (f && f.length === 2) {
|
|
343
|
+
const [y, u] = f.sort(), n = _(y).startOf("days"), d = _(u).endOf("days");
|
|
344
|
+
l[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), d.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
return e != null && e.disabledDate ? e.disabledDate(t,
|
|
347
|
+
function c(f) {
|
|
348
|
+
return e != null && e.disabledDate ? e.disabledDate(t, f) : !1;
|
|
349
349
|
}
|
|
350
|
-
return
|
|
350
|
+
return i("div", null, [i(de, {
|
|
351
351
|
"disabled-input": !0,
|
|
352
352
|
style: {
|
|
353
353
|
width: "300px"
|
|
354
354
|
},
|
|
355
355
|
modelValue: l[r.key],
|
|
356
|
-
"onUpdate:modelValue": (
|
|
356
|
+
"onUpdate:modelValue": (f) => l[r.key] = f,
|
|
357
357
|
onSelect: a,
|
|
358
|
-
onChange:
|
|
358
|
+
onChange: s,
|
|
359
359
|
mode: e == null ? void 0 : e.type,
|
|
360
360
|
allowClear: e == null ? void 0 : e.clearable,
|
|
361
|
-
"disabled-date":
|
|
361
|
+
"disabled-date": c,
|
|
362
362
|
format: e == null ? void 0 : e.labelFormat,
|
|
363
363
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
364
364
|
}, null)]);
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
return (l, r) =>
|
|
367
|
+
function Re(e) {
|
|
368
|
+
return (l, r) => i(se, {
|
|
369
369
|
modelValue: l[r.key],
|
|
370
370
|
"onUpdate:modelValue": (t) => l[r.key] = t,
|
|
371
371
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
@@ -374,23 +374,23 @@ function Te(e) {
|
|
|
374
374
|
}, null);
|
|
375
375
|
}
|
|
376
376
|
const g = /* @__PURE__ */ new WeakMap();
|
|
377
|
-
function
|
|
377
|
+
function Ue() {
|
|
378
378
|
const e = k([]);
|
|
379
379
|
return [e, (r) => e.value = r];
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Ee(e) {
|
|
382
382
|
let l, r = !1;
|
|
383
|
-
const [t, a] =
|
|
383
|
+
const [t, a] = Ue(), s = () => {
|
|
384
384
|
if (!e.autoSumbit || !l)
|
|
385
385
|
return;
|
|
386
386
|
let n = l;
|
|
387
387
|
for (; n && n.$el.tagName !== "FORM"; )
|
|
388
388
|
n = n.$parent;
|
|
389
389
|
n && n.$el && n.$el.dispatchEvent(new Event("submit"));
|
|
390
|
-
},
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
},
|
|
390
|
+
}, c = (n, d) => {
|
|
391
|
+
const o = n();
|
|
392
|
+
o instanceof Promise ? o.then(d) : d(o);
|
|
393
|
+
}, f = async () => {
|
|
394
394
|
const n = g.get(e.options);
|
|
395
395
|
switch (typeof n) {
|
|
396
396
|
case "function":
|
|
@@ -400,22 +400,22 @@ function Ue(e) {
|
|
|
400
400
|
a(n);
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
g.set(e.options, a),
|
|
404
|
-
const
|
|
405
|
-
g.set(e.options,
|
|
403
|
+
g.set(e.options, a), c(e.options, (d) => {
|
|
404
|
+
const o = g.get(e.options);
|
|
405
|
+
g.set(e.options, d), o(d);
|
|
406
406
|
});
|
|
407
407
|
}, y = () => {
|
|
408
|
-
|
|
408
|
+
c(e.options, (n) => {
|
|
409
409
|
a(n);
|
|
410
410
|
});
|
|
411
411
|
};
|
|
412
412
|
switch (!0) {
|
|
413
413
|
case e.options instanceof Function: {
|
|
414
|
-
e.cache !== !1 ?
|
|
414
|
+
e.cache !== !1 ? f() : y();
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
|
-
case
|
|
418
|
-
|
|
417
|
+
case V(e.options): {
|
|
418
|
+
I(e.options, () => {
|
|
419
419
|
a(e.options.value);
|
|
420
420
|
}, {
|
|
421
421
|
immediate: !0
|
|
@@ -425,60 +425,126 @@ function Ue(e) {
|
|
|
425
425
|
default:
|
|
426
426
|
t.value = e.options;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function u(n, d) {
|
|
429
429
|
var h;
|
|
430
|
-
const
|
|
431
|
-
return
|
|
430
|
+
const o = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", m = d[o];
|
|
431
|
+
return m ? m.toLowerCase().includes(n.toLowerCase()) : !1;
|
|
432
432
|
}
|
|
433
|
-
return (n,
|
|
434
|
-
ref: (
|
|
433
|
+
return (n, d) => (e.default && !r && (n[d.key] = e.default, r = !0), i(ie, {
|
|
434
|
+
ref: (o) => l = o,
|
|
435
435
|
multiple: e.multiple,
|
|
436
|
-
modelValue: n[
|
|
437
|
-
"onUpdate:modelValue": (
|
|
436
|
+
modelValue: n[d.key],
|
|
437
|
+
"onUpdate:modelValue": (o) => n[d.key] = o,
|
|
438
438
|
placeholder: e.placeholder,
|
|
439
439
|
allowClear: e.clearable,
|
|
440
440
|
allowSearch: e.searchable,
|
|
441
441
|
maxTagCount: e.maxTagCount ?? 2,
|
|
442
|
-
onChange:
|
|
443
|
-
filterTreeNode:
|
|
442
|
+
onChange: s,
|
|
443
|
+
filterTreeNode: u,
|
|
444
444
|
data: t.value,
|
|
445
445
|
fieldNames: e.fieldNames
|
|
446
446
|
}, null));
|
|
447
447
|
}
|
|
448
|
-
|
|
448
|
+
const $ = /* @__PURE__ */ new WeakMap();
|
|
449
|
+
function qe() {
|
|
450
|
+
const e = k([]);
|
|
451
|
+
return [e, (r) => e.value = r];
|
|
452
|
+
}
|
|
453
|
+
function We(e) {
|
|
454
|
+
let l, r = !1;
|
|
455
|
+
const [t, a] = qe(), s = () => {
|
|
456
|
+
if (!e.autoSumbit || !l)
|
|
457
|
+
return;
|
|
458
|
+
let u = l;
|
|
459
|
+
for (; u && u.$el.tagName !== "FORM"; )
|
|
460
|
+
u = u.$parent;
|
|
461
|
+
u && u.$el && u.$el.dispatchEvent(new Event("submit"));
|
|
462
|
+
}, c = (u, n) => {
|
|
463
|
+
const d = u();
|
|
464
|
+
d instanceof Promise ? d.then(n) : n(d);
|
|
465
|
+
}, f = async () => {
|
|
466
|
+
const u = $.get(e.options);
|
|
467
|
+
switch (typeof u) {
|
|
468
|
+
case "function":
|
|
469
|
+
$.set(e.options, a);
|
|
470
|
+
return;
|
|
471
|
+
case "object":
|
|
472
|
+
a(u);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
$.set(e.options, a), c(e.options, (n) => {
|
|
476
|
+
const d = $.get(e.options);
|
|
477
|
+
$.set(e.options, n), d(n);
|
|
478
|
+
});
|
|
479
|
+
}, y = () => {
|
|
480
|
+
c(e.options, (u) => {
|
|
481
|
+
a(u);
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
switch (!0) {
|
|
485
|
+
case e.options instanceof Function: {
|
|
486
|
+
e.cache !== !1 ? f() : y();
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
case V(e.options): {
|
|
490
|
+
I(e.options, () => {
|
|
491
|
+
a(e.options.value);
|
|
492
|
+
}, {
|
|
493
|
+
immediate: !0
|
|
494
|
+
});
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
default:
|
|
498
|
+
t.value = e.options;
|
|
499
|
+
}
|
|
500
|
+
return (u, n) => (e.default && !r && (u[n.key] = e.default, r = !0), i(oe, {
|
|
501
|
+
ref: (d) => l = d,
|
|
502
|
+
multiple: e.multiple,
|
|
503
|
+
modelValue: u[n.key],
|
|
504
|
+
"onUpdate:modelValue": (d) => u[n.key] = d,
|
|
505
|
+
placeholder: e.placeholder,
|
|
506
|
+
allowClear: e.clearable,
|
|
507
|
+
allowSearch: e.searchable,
|
|
508
|
+
maxTagCount: e.maxTagCount ?? 2,
|
|
509
|
+
onChange: s,
|
|
510
|
+
options: t.value
|
|
511
|
+
}, null));
|
|
512
|
+
}
|
|
513
|
+
function Be(e) {
|
|
449
514
|
return (l) => e(l);
|
|
450
515
|
}
|
|
451
|
-
function
|
|
516
|
+
function Ae() {
|
|
452
517
|
return {
|
|
453
|
-
input:
|
|
454
|
-
textarea:
|
|
518
|
+
input: Pe,
|
|
519
|
+
textarea: Re,
|
|
455
520
|
select: Le,
|
|
456
|
-
treeSelect:
|
|
457
|
-
date:
|
|
458
|
-
switch:
|
|
459
|
-
dateRange:
|
|
460
|
-
render:
|
|
521
|
+
treeSelect: Ee,
|
|
522
|
+
date: Ne,
|
|
523
|
+
switch: pe,
|
|
524
|
+
dateRange: ze,
|
|
525
|
+
render: Be,
|
|
526
|
+
cascader: We
|
|
461
527
|
};
|
|
462
528
|
}
|
|
463
|
-
function
|
|
529
|
+
function Ye(e, l) {
|
|
464
530
|
l.render || (l.render = (t) => t.input());
|
|
465
531
|
const r = l.render({
|
|
466
|
-
...
|
|
532
|
+
...Ae()
|
|
467
533
|
});
|
|
468
534
|
return {
|
|
469
535
|
default: () => r(e, l)
|
|
470
536
|
};
|
|
471
537
|
}
|
|
472
|
-
function
|
|
538
|
+
function Ge(e, l) {
|
|
473
539
|
return Q(q, {
|
|
474
540
|
field: l.key,
|
|
475
541
|
label: l.title
|
|
476
|
-
},
|
|
542
|
+
}, Ye(e, l));
|
|
477
543
|
}
|
|
478
|
-
function
|
|
479
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
544
|
+
function P(e) {
|
|
545
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
480
546
|
}
|
|
481
|
-
const
|
|
547
|
+
const Ke = /* @__PURE__ */ O({
|
|
482
548
|
props: {
|
|
483
549
|
form: {
|
|
484
550
|
type: Object,
|
|
@@ -530,45 +596,45 @@ const Ae = /* @__PURE__ */ x({
|
|
|
530
596
|
emits: ["submit", "cancel", "update:model-value"],
|
|
531
597
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
532
598
|
setup(e) {
|
|
533
|
-
const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] =
|
|
534
|
-
|
|
599
|
+
const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] = _e(e.form, e.modelValue || e.value), s = k(e.columns || 0), c = k(!0), f = () => c.value = !c.value;
|
|
600
|
+
D(N.id, l), D(N.source, t);
|
|
535
601
|
const y = b(() => {
|
|
536
|
-
if (!
|
|
602
|
+
if (!s.value)
|
|
537
603
|
return 1;
|
|
538
|
-
const
|
|
539
|
-
return
|
|
540
|
-
}),
|
|
604
|
+
const m = e.form.reduce((h, w) => h + ((w == null ? void 0 : w.span) || 1), 0);
|
|
605
|
+
return s.value - m % s.value;
|
|
606
|
+
}), u = b(() => e.form.reduce((m, h) => (h.rule && (m[h.key] = h.rule), m), {}));
|
|
541
607
|
function n() {
|
|
542
608
|
var h;
|
|
543
609
|
if (e.columns)
|
|
544
610
|
return;
|
|
545
|
-
const
|
|
546
|
-
|
|
611
|
+
const m = (h = r.value) == null ? void 0 : h.$el;
|
|
612
|
+
m && (s.value = Math.floor(m.offsetWidth / e.minWidth));
|
|
547
613
|
}
|
|
548
|
-
|
|
614
|
+
E(() => {
|
|
549
615
|
n();
|
|
550
616
|
});
|
|
551
|
-
function
|
|
552
|
-
t.value[
|
|
617
|
+
function d(m, h) {
|
|
618
|
+
t.value[m] = h, a({
|
|
553
619
|
...t
|
|
554
620
|
});
|
|
555
621
|
}
|
|
556
|
-
function
|
|
557
|
-
var
|
|
558
|
-
(
|
|
622
|
+
function o() {
|
|
623
|
+
var m;
|
|
624
|
+
(m = r.value) == null || m.resetFields();
|
|
559
625
|
}
|
|
560
626
|
return window.addEventListener("resize", n), {
|
|
561
627
|
formId: l,
|
|
562
628
|
formSource: t,
|
|
563
629
|
formInstance: r,
|
|
564
|
-
formColumns:
|
|
565
|
-
formRules:
|
|
566
|
-
formCollspased:
|
|
630
|
+
formColumns: s,
|
|
631
|
+
formRules: u,
|
|
632
|
+
formCollspased: c,
|
|
567
633
|
formActiosSpan: y,
|
|
568
|
-
toggleFormCollapsed:
|
|
569
|
-
updateFormField:
|
|
634
|
+
toggleFormCollapsed: f,
|
|
635
|
+
updateFormField: d,
|
|
570
636
|
updateFormSource: a,
|
|
571
|
-
reset:
|
|
637
|
+
reset: o
|
|
572
638
|
};
|
|
573
639
|
},
|
|
574
640
|
render() {
|
|
@@ -580,41 +646,41 @@ const Ae = /* @__PURE__ */ x({
|
|
|
580
646
|
} : {
|
|
581
647
|
span: this.formActiosSpan
|
|
582
648
|
};
|
|
583
|
-
if (this.searchable && (t.push(
|
|
649
|
+
if (this.searchable && (t.push(i(S, {
|
|
584
650
|
type: "primary",
|
|
585
651
|
htmlType: "submit"
|
|
586
652
|
}, {
|
|
587
|
-
default: () => [
|
|
588
|
-
})), t.push(
|
|
653
|
+
default: () => [C("搜索")]
|
|
654
|
+
})), t.push(i(S, {
|
|
589
655
|
type: "secondary",
|
|
590
656
|
onClick: () => {
|
|
591
|
-
var
|
|
592
|
-
return (
|
|
657
|
+
var s;
|
|
658
|
+
return (s = this.formInstance) == null ? void 0 : s.resetFields();
|
|
593
659
|
}
|
|
594
660
|
}, {
|
|
595
|
-
default: () => [
|
|
596
|
-
}))), this.submitable && (t.push(
|
|
661
|
+
default: () => [C("重置")]
|
|
662
|
+
}))), this.submitable && (t.push(i(S, {
|
|
597
663
|
type: "primary",
|
|
598
664
|
htmlType: "submit"
|
|
599
665
|
}, {
|
|
600
|
-
default: () => [
|
|
601
|
-
})), t.push(
|
|
666
|
+
default: () => [C("提交")]
|
|
667
|
+
})), t.push(i(S, {
|
|
602
668
|
type: "secondary",
|
|
603
669
|
onClick: () => this.$emit("cancel")
|
|
604
670
|
}, {
|
|
605
|
-
default: () => [
|
|
606
|
-
}))), this.form.some((
|
|
671
|
+
default: () => [C("取消")]
|
|
672
|
+
}))), this.form.some((s) => !!s.collapsed) && t.push(i(S, {
|
|
607
673
|
onClick: this.toggleFormCollapsed
|
|
608
674
|
}, {
|
|
609
675
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
610
|
-
icon: () => this.formCollspased ?
|
|
676
|
+
icon: () => this.formCollspased ? i(Fe, null, null) : i(je, null, null)
|
|
611
677
|
})), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
|
|
612
|
-
return
|
|
613
|
-
default: () => [
|
|
678
|
+
return i(j, a, {
|
|
679
|
+
default: () => [i(q, {
|
|
614
680
|
hideLabel: !0,
|
|
615
681
|
contentClass: this.footer ? "form-footer" : ""
|
|
616
682
|
}, {
|
|
617
|
-
default: () => [
|
|
683
|
+
default: () => [i(he, null, P(t) ? t : {
|
|
618
684
|
default: () => [t]
|
|
619
685
|
})]
|
|
620
686
|
})]
|
|
@@ -629,9 +695,9 @@ const Ae = /* @__PURE__ */ x({
|
|
|
629
695
|
return !0;
|
|
630
696
|
}
|
|
631
697
|
});
|
|
632
|
-
return
|
|
698
|
+
return i("div", {
|
|
633
699
|
class: "form-render"
|
|
634
|
-
}, [
|
|
700
|
+
}, [i(fe, X({
|
|
635
701
|
name: this.name
|
|
636
702
|
}, {
|
|
637
703
|
labelAlign: "left",
|
|
@@ -642,16 +708,16 @@ const Ae = /* @__PURE__ */ x({
|
|
|
642
708
|
ref: (t) => this.formInstance = t,
|
|
643
709
|
model: this.formSource
|
|
644
710
|
}), {
|
|
645
|
-
default: () => [
|
|
711
|
+
default: () => [i(me, {
|
|
646
712
|
cols: this.formColumns,
|
|
647
713
|
"col-gap": 24,
|
|
648
714
|
"rol-gap": 10
|
|
649
715
|
}, {
|
|
650
716
|
default: () => [r.filter(() => this.formColumns !== 0).map((t) => {
|
|
651
717
|
let a;
|
|
652
|
-
return
|
|
718
|
+
return i(j, {
|
|
653
719
|
span: t.span
|
|
654
|
-
},
|
|
720
|
+
}, P(a = Ge(this.formSource, t)) ? a : {
|
|
655
721
|
default: () => [a]
|
|
656
722
|
});
|
|
657
723
|
}), l()]
|
|
@@ -659,27 +725,27 @@ const Ae = /* @__PURE__ */ x({
|
|
|
659
725
|
})]);
|
|
660
726
|
}
|
|
661
727
|
});
|
|
662
|
-
function
|
|
728
|
+
function Je(e) {
|
|
663
729
|
return e;
|
|
664
730
|
}
|
|
665
|
-
function
|
|
666
|
-
const l =
|
|
731
|
+
function Ze(e) {
|
|
732
|
+
const l = M(), r = k();
|
|
667
733
|
function t() {
|
|
668
|
-
var
|
|
669
|
-
const a = (
|
|
734
|
+
var s, c;
|
|
735
|
+
const a = (c = (s = l == null ? void 0 : l.proxy) == null ? void 0 : s.$refs) == null ? void 0 : c[e];
|
|
670
736
|
a && (r.value = a);
|
|
671
737
|
}
|
|
672
|
-
return
|
|
738
|
+
return E(t), H(t), r;
|
|
673
739
|
}
|
|
674
|
-
const
|
|
740
|
+
const et = {
|
|
675
741
|
install(e, l) {
|
|
676
|
-
e.component("FormRender",
|
|
742
|
+
e.component("FormRender", Ke);
|
|
677
743
|
}
|
|
678
744
|
};
|
|
679
745
|
export {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
746
|
+
Ke as FormRender,
|
|
747
|
+
rt as FormRenderResolver,
|
|
748
|
+
et as default,
|
|
749
|
+
Je as defineForm,
|
|
750
|
+
Ze as useForm
|
|
685
751
|
};
|