@gopowerteam/form-render 0.0.30 → 0.0.32
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 +17 -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 +17 -0
- package/dist/es/form-items/index.d.ts +1 -0
- package/dist/es/index.mjs +271 -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 P, inject as Y, defineComponent as O, computed as b, openBlock as T, createElementBlock as p, normalizeClass as L, 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 = P(), 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,25 +44,25 @@ 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(), p("svg", {
|
|
66
66
|
viewBox: "0 0 48 48",
|
|
67
67
|
fill: "none",
|
|
68
68
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -72,17 +72,17 @@ function $e(e, l, r, t, a, c) {
|
|
|
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,25 +111,25 @@ 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(), p("svg", {
|
|
133
133
|
viewBox: "0 0 48 48",
|
|
134
134
|
fill: "none",
|
|
135
135
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -139,37 +139,37 @@ function Ve(e, l, r, t, a, c) {
|
|
|
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 Me(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 Pe(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
|
-
function
|
|
253
|
+
function pe(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
|
+
}, Pe(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 Le(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,127 @@ 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
|
+
pathMode: e.pathMode,
|
|
502
|
+
ref: (d) => l = d,
|
|
503
|
+
multiple: e.multiple,
|
|
504
|
+
modelValue: u[n.key],
|
|
505
|
+
"onUpdate:modelValue": (d) => u[n.key] = d,
|
|
506
|
+
placeholder: e.placeholder,
|
|
507
|
+
allowClear: e.clearable,
|
|
508
|
+
allowSearch: e.searchable,
|
|
509
|
+
maxTagCount: e.maxTagCount ?? 2,
|
|
510
|
+
onChange: s,
|
|
511
|
+
options: t.value
|
|
512
|
+
}, null));
|
|
513
|
+
}
|
|
514
|
+
function Be(e) {
|
|
449
515
|
return (l) => e(l);
|
|
450
516
|
}
|
|
451
|
-
function
|
|
517
|
+
function Ae() {
|
|
452
518
|
return {
|
|
453
|
-
input:
|
|
454
|
-
textarea:
|
|
455
|
-
select:
|
|
456
|
-
treeSelect:
|
|
457
|
-
date:
|
|
458
|
-
switch:
|
|
459
|
-
dateRange:
|
|
460
|
-
render:
|
|
519
|
+
input: Me,
|
|
520
|
+
textarea: Re,
|
|
521
|
+
select: pe,
|
|
522
|
+
treeSelect: Ee,
|
|
523
|
+
date: Ne,
|
|
524
|
+
switch: Le,
|
|
525
|
+
dateRange: ze,
|
|
526
|
+
render: Be,
|
|
527
|
+
cascader: We
|
|
461
528
|
};
|
|
462
529
|
}
|
|
463
|
-
function
|
|
530
|
+
function Ye(e, l) {
|
|
464
531
|
l.render || (l.render = (t) => t.input());
|
|
465
532
|
const r = l.render({
|
|
466
|
-
...
|
|
533
|
+
...Ae()
|
|
467
534
|
});
|
|
468
535
|
return {
|
|
469
536
|
default: () => r(e, l)
|
|
470
537
|
};
|
|
471
538
|
}
|
|
472
|
-
function
|
|
539
|
+
function Ge(e, l) {
|
|
473
540
|
return Q(q, {
|
|
474
541
|
field: l.key,
|
|
475
542
|
label: l.title
|
|
476
|
-
},
|
|
543
|
+
}, Ye(e, l));
|
|
477
544
|
}
|
|
478
|
-
function
|
|
479
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
545
|
+
function M(e) {
|
|
546
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
480
547
|
}
|
|
481
|
-
const
|
|
548
|
+
const Ke = /* @__PURE__ */ O({
|
|
482
549
|
props: {
|
|
483
550
|
form: {
|
|
484
551
|
type: Object,
|
|
@@ -530,45 +597,45 @@ const Ae = /* @__PURE__ */ x({
|
|
|
530
597
|
emits: ["submit", "cancel", "update:model-value"],
|
|
531
598
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
532
599
|
setup(e) {
|
|
533
|
-
const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] =
|
|
534
|
-
|
|
600
|
+
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;
|
|
601
|
+
D(N.id, l), D(N.source, t);
|
|
535
602
|
const y = b(() => {
|
|
536
|
-
if (!
|
|
603
|
+
if (!s.value)
|
|
537
604
|
return 1;
|
|
538
|
-
const
|
|
539
|
-
return
|
|
540
|
-
}),
|
|
605
|
+
const m = e.form.reduce((h, w) => h + ((w == null ? void 0 : w.span) || 1), 0);
|
|
606
|
+
return s.value - m % s.value;
|
|
607
|
+
}), u = b(() => e.form.reduce((m, h) => (h.rule && (m[h.key] = h.rule), m), {}));
|
|
541
608
|
function n() {
|
|
542
609
|
var h;
|
|
543
610
|
if (e.columns)
|
|
544
611
|
return;
|
|
545
|
-
const
|
|
546
|
-
|
|
612
|
+
const m = (h = r.value) == null ? void 0 : h.$el;
|
|
613
|
+
m && (s.value = Math.floor(m.offsetWidth / e.minWidth));
|
|
547
614
|
}
|
|
548
|
-
|
|
615
|
+
E(() => {
|
|
549
616
|
n();
|
|
550
617
|
});
|
|
551
|
-
function
|
|
552
|
-
t.value[
|
|
618
|
+
function d(m, h) {
|
|
619
|
+
t.value[m] = h, a({
|
|
553
620
|
...t
|
|
554
621
|
});
|
|
555
622
|
}
|
|
556
|
-
function
|
|
557
|
-
var
|
|
558
|
-
(
|
|
623
|
+
function o() {
|
|
624
|
+
var m;
|
|
625
|
+
(m = r.value) == null || m.resetFields();
|
|
559
626
|
}
|
|
560
627
|
return window.addEventListener("resize", n), {
|
|
561
628
|
formId: l,
|
|
562
629
|
formSource: t,
|
|
563
630
|
formInstance: r,
|
|
564
|
-
formColumns:
|
|
565
|
-
formRules:
|
|
566
|
-
formCollspased:
|
|
631
|
+
formColumns: s,
|
|
632
|
+
formRules: u,
|
|
633
|
+
formCollspased: c,
|
|
567
634
|
formActiosSpan: y,
|
|
568
|
-
toggleFormCollapsed:
|
|
569
|
-
updateFormField:
|
|
635
|
+
toggleFormCollapsed: f,
|
|
636
|
+
updateFormField: d,
|
|
570
637
|
updateFormSource: a,
|
|
571
|
-
reset:
|
|
638
|
+
reset: o
|
|
572
639
|
};
|
|
573
640
|
},
|
|
574
641
|
render() {
|
|
@@ -580,41 +647,41 @@ const Ae = /* @__PURE__ */ x({
|
|
|
580
647
|
} : {
|
|
581
648
|
span: this.formActiosSpan
|
|
582
649
|
};
|
|
583
|
-
if (this.searchable && (t.push(
|
|
650
|
+
if (this.searchable && (t.push(i(S, {
|
|
584
651
|
type: "primary",
|
|
585
652
|
htmlType: "submit"
|
|
586
653
|
}, {
|
|
587
|
-
default: () => [
|
|
588
|
-
})), t.push(
|
|
654
|
+
default: () => [C("搜索")]
|
|
655
|
+
})), t.push(i(S, {
|
|
589
656
|
type: "secondary",
|
|
590
657
|
onClick: () => {
|
|
591
|
-
var
|
|
592
|
-
return (
|
|
658
|
+
var s;
|
|
659
|
+
return (s = this.formInstance) == null ? void 0 : s.resetFields();
|
|
593
660
|
}
|
|
594
661
|
}, {
|
|
595
|
-
default: () => [
|
|
596
|
-
}))), this.submitable && (t.push(
|
|
662
|
+
default: () => [C("重置")]
|
|
663
|
+
}))), this.submitable && (t.push(i(S, {
|
|
597
664
|
type: "primary",
|
|
598
665
|
htmlType: "submit"
|
|
599
666
|
}, {
|
|
600
|
-
default: () => [
|
|
601
|
-
})), t.push(
|
|
667
|
+
default: () => [C("提交")]
|
|
668
|
+
})), t.push(i(S, {
|
|
602
669
|
type: "secondary",
|
|
603
670
|
onClick: () => this.$emit("cancel")
|
|
604
671
|
}, {
|
|
605
|
-
default: () => [
|
|
606
|
-
}))), this.form.some((
|
|
672
|
+
default: () => [C("取消")]
|
|
673
|
+
}))), this.form.some((s) => !!s.collapsed) && t.push(i(S, {
|
|
607
674
|
onClick: this.toggleFormCollapsed
|
|
608
675
|
}, {
|
|
609
676
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
610
|
-
icon: () => this.formCollspased ?
|
|
677
|
+
icon: () => this.formCollspased ? i(Fe, null, null) : i(je, null, null)
|
|
611
678
|
})), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
|
|
612
|
-
return
|
|
613
|
-
default: () => [
|
|
679
|
+
return i(j, a, {
|
|
680
|
+
default: () => [i(q, {
|
|
614
681
|
hideLabel: !0,
|
|
615
682
|
contentClass: this.footer ? "form-footer" : ""
|
|
616
683
|
}, {
|
|
617
|
-
default: () => [
|
|
684
|
+
default: () => [i(he, null, M(t) ? t : {
|
|
618
685
|
default: () => [t]
|
|
619
686
|
})]
|
|
620
687
|
})]
|
|
@@ -629,9 +696,9 @@ const Ae = /* @__PURE__ */ x({
|
|
|
629
696
|
return !0;
|
|
630
697
|
}
|
|
631
698
|
});
|
|
632
|
-
return
|
|
699
|
+
return i("div", {
|
|
633
700
|
class: "form-render"
|
|
634
|
-
}, [
|
|
701
|
+
}, [i(fe, X({
|
|
635
702
|
name: this.name
|
|
636
703
|
}, {
|
|
637
704
|
labelAlign: "left",
|
|
@@ -642,16 +709,16 @@ const Ae = /* @__PURE__ */ x({
|
|
|
642
709
|
ref: (t) => this.formInstance = t,
|
|
643
710
|
model: this.formSource
|
|
644
711
|
}), {
|
|
645
|
-
default: () => [
|
|
712
|
+
default: () => [i(me, {
|
|
646
713
|
cols: this.formColumns,
|
|
647
714
|
"col-gap": 24,
|
|
648
715
|
"rol-gap": 10
|
|
649
716
|
}, {
|
|
650
717
|
default: () => [r.filter(() => this.formColumns !== 0).map((t) => {
|
|
651
718
|
let a;
|
|
652
|
-
return
|
|
719
|
+
return i(j, {
|
|
653
720
|
span: t.span
|
|
654
|
-
},
|
|
721
|
+
}, M(a = Ge(this.formSource, t)) ? a : {
|
|
655
722
|
default: () => [a]
|
|
656
723
|
});
|
|
657
724
|
}), l()]
|
|
@@ -659,27 +726,27 @@ const Ae = /* @__PURE__ */ x({
|
|
|
659
726
|
})]);
|
|
660
727
|
}
|
|
661
728
|
});
|
|
662
|
-
function
|
|
729
|
+
function Je(e) {
|
|
663
730
|
return e;
|
|
664
731
|
}
|
|
665
|
-
function
|
|
666
|
-
const l =
|
|
732
|
+
function Ze(e) {
|
|
733
|
+
const l = P(), r = k();
|
|
667
734
|
function t() {
|
|
668
|
-
var
|
|
669
|
-
const a = (
|
|
735
|
+
var s, c;
|
|
736
|
+
const a = (c = (s = l == null ? void 0 : l.proxy) == null ? void 0 : s.$refs) == null ? void 0 : c[e];
|
|
670
737
|
a && (r.value = a);
|
|
671
738
|
}
|
|
672
|
-
return
|
|
739
|
+
return E(t), H(t), r;
|
|
673
740
|
}
|
|
674
|
-
const
|
|
741
|
+
const et = {
|
|
675
742
|
install(e, l) {
|
|
676
|
-
e.component("FormRender",
|
|
743
|
+
e.component("FormRender", Ke);
|
|
677
744
|
}
|
|
678
745
|
};
|
|
679
746
|
export {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
747
|
+
Ke as FormRender,
|
|
748
|
+
rt as FormRenderResolver,
|
|
749
|
+
et as default,
|
|
750
|
+
Je as defineForm,
|
|
751
|
+
Ze as useForm
|
|
685
752
|
};
|