@gopowerteam/form-render 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/form-items/index.d.ts +1 -0
- package/dist/cjs/form-items/tree-select/index.d.ts +14 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/form-items/index.d.ts +1 -0
- package/dist/es/form-items/tree-select/index.d.ts +14 -0
- package/dist/es/index.mjs +264 -219
- 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 j, inject as A, defineComponent as
|
|
2
|
-
import { DatePicker as
|
|
3
|
-
import
|
|
4
|
-
import { FormRenderResolver as
|
|
5
|
-
const
|
|
6
|
-
var t, r
|
|
7
|
-
const n = j(), c = A(
|
|
1
|
+
import { getCurrentInstance as j, inject as A, defineComponent as w, computed as y, openBlock as N, createElementBlock as P, normalizeClass as z, normalizeStyle as M, createElementVNode as L, ref as o, createVNode as u, isVNode as U, h as Y, provide as V, onMounted as R, mergeProps as G, createTextVNode as b, onUpdated as K } from "vue";
|
|
2
|
+
import { DatePicker as Q, YearPicker as X, QuarterPicker as H, MonthPicker as J, WeekPicker as Z, Input as p, InputNumber as ee, Select as te, Option as le, Switch as re, RangePicker as ae, Textarea as ne, TreeSelect as ue, FormItem as T, Form as ce, Grid as de, GridItem as I, Button as k, Space as fe } from "@arco-design/web-vue";
|
|
3
|
+
import _ from "dayjs";
|
|
4
|
+
import { FormRenderResolver as Qe } from "./resolver.mjs";
|
|
5
|
+
const ie = Symbol("ArcoConfigProvider"), se = "arco", me = "$arco", q = (e) => {
|
|
6
|
+
var l, t, r;
|
|
7
|
+
const n = j(), c = A(ie, void 0), a = (r = (t = c == null ? void 0 : c.prefixCls) != null ? t : (l = n == null ? void 0 : n.appContext.config.globalProperties[me]) == null ? void 0 : l.classPrefix) != null ? r : se;
|
|
8
8
|
return e ? `${a}-${e}` : a;
|
|
9
|
-
},
|
|
9
|
+
}, oe = Object.prototype.toString;
|
|
10
10
|
function B(e) {
|
|
11
|
-
return
|
|
11
|
+
return oe.call(e) === "[object Number]" && e === e;
|
|
12
12
|
}
|
|
13
|
-
var E = (e,
|
|
14
|
-
for (const [
|
|
15
|
-
e[
|
|
13
|
+
var E = (e, l) => {
|
|
14
|
+
for (const [t, r] of l)
|
|
15
|
+
e[t] = r;
|
|
16
16
|
return e;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const he = w({
|
|
19
19
|
name: "IconDown",
|
|
20
20
|
props: {
|
|
21
21
|
size: {
|
|
@@ -42,47 +42,47 @@ const me = x({
|
|
|
42
42
|
click: (e) => !0
|
|
43
43
|
},
|
|
44
44
|
setup(e, {
|
|
45
|
-
emit:
|
|
45
|
+
emit: l
|
|
46
46
|
}) {
|
|
47
|
-
const
|
|
48
|
-
[`${
|
|
47
|
+
const t = q("icon"), r = y(() => [t, `${t}-down`, {
|
|
48
|
+
[`${t}-spin`]: e.spin
|
|
49
49
|
}]), n = y(() => {
|
|
50
50
|
const a = {};
|
|
51
51
|
return e.size && (a.fontSize = B(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
|
-
cls:
|
|
54
|
+
cls: r,
|
|
55
55
|
innerStyle: n,
|
|
56
56
|
onClick: (a) => {
|
|
57
|
-
|
|
57
|
+
l("click", a);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
61
|
+
}), ye = ["stroke-width", "stroke-linecap", "stroke-linejoin"], ke = /* @__PURE__ */ L("path", {
|
|
62
62
|
d: "M39.6 17.443 24.043 33 8.487 17.443"
|
|
63
|
-
}, null, -1),
|
|
64
|
-
function
|
|
65
|
-
return
|
|
63
|
+
}, null, -1), be = [ke];
|
|
64
|
+
function ve(e, l, t, r, n, c) {
|
|
65
|
+
return N(), P("svg", {
|
|
66
66
|
viewBox: "0 0 48 48",
|
|
67
67
|
fill: "none",
|
|
68
68
|
xmlns: "http://www.w3.org/2000/svg",
|
|
69
69
|
stroke: "currentColor",
|
|
70
70
|
class: z(e.cls),
|
|
71
|
-
style:
|
|
71
|
+
style: M(e.innerStyle),
|
|
72
72
|
"stroke-width": e.strokeWidth,
|
|
73
73
|
"stroke-linecap": e.strokeLinecap,
|
|
74
74
|
"stroke-linejoin": e.strokeLinejoin,
|
|
75
|
-
onClick:
|
|
76
|
-
},
|
|
75
|
+
onClick: l[0] || (l[0] = (...a) => e.onClick && e.onClick(...a))
|
|
76
|
+
}, be, 14, ye);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
const
|
|
80
|
-
install: (e,
|
|
81
|
-
var
|
|
82
|
-
const
|
|
83
|
-
e.component(
|
|
78
|
+
var g = /* @__PURE__ */ E(he, [["render", ve]]);
|
|
79
|
+
const Se = Object.assign(g, {
|
|
80
|
+
install: (e, l) => {
|
|
81
|
+
var t;
|
|
82
|
+
const r = (t = l == null ? void 0 : l.iconPrefix) != null ? t : "";
|
|
83
|
+
e.component(r + g.name, g);
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
85
|
+
}), $e = w({
|
|
86
86
|
name: "IconUp",
|
|
87
87
|
props: {
|
|
88
88
|
size: {
|
|
@@ -109,116 +109,116 @@ const be = Object.assign($, {
|
|
|
109
109
|
click: (e) => !0
|
|
110
110
|
},
|
|
111
111
|
setup(e, {
|
|
112
|
-
emit:
|
|
112
|
+
emit: l
|
|
113
113
|
}) {
|
|
114
|
-
const
|
|
115
|
-
[`${
|
|
114
|
+
const t = q("icon"), r = y(() => [t, `${t}-up`, {
|
|
115
|
+
[`${t}-spin`]: e.spin
|
|
116
116
|
}]), n = y(() => {
|
|
117
117
|
const a = {};
|
|
118
118
|
return e.size && (a.fontSize = B(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
119
119
|
});
|
|
120
120
|
return {
|
|
121
|
-
cls:
|
|
121
|
+
cls: r,
|
|
122
122
|
innerStyle: n,
|
|
123
123
|
onClick: (a) => {
|
|
124
|
-
|
|
124
|
+
l("click", a);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
}),
|
|
128
|
+
}), ge = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ce = /* @__PURE__ */ L("path", {
|
|
129
129
|
d: "M39.6 30.557 24.043 15 8.487 30.557"
|
|
130
|
-
}, null, -1),
|
|
131
|
-
function
|
|
132
|
-
return
|
|
130
|
+
}, null, -1), xe = [Ce];
|
|
131
|
+
function Fe(e, l, t, r, n, c) {
|
|
132
|
+
return N(), P("svg", {
|
|
133
133
|
viewBox: "0 0 48 48",
|
|
134
134
|
fill: "none",
|
|
135
135
|
xmlns: "http://www.w3.org/2000/svg",
|
|
136
136
|
stroke: "currentColor",
|
|
137
137
|
class: z(e.cls),
|
|
138
|
-
style:
|
|
138
|
+
style: M(e.innerStyle),
|
|
139
139
|
"stroke-width": e.strokeWidth,
|
|
140
140
|
"stroke-linecap": e.strokeLinecap,
|
|
141
141
|
"stroke-linejoin": e.strokeLinejoin,
|
|
142
|
-
onClick:
|
|
143
|
-
},
|
|
142
|
+
onClick: l[0] || (l[0] = (...a) => e.onClick && e.onClick(...a))
|
|
143
|
+
}, xe, 14, ge);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
const
|
|
147
|
-
install: (e,
|
|
148
|
-
var
|
|
149
|
-
const
|
|
150
|
-
e.component(
|
|
145
|
+
var C = /* @__PURE__ */ E($e, [["render", Fe]]);
|
|
146
|
+
const we = Object.assign(C, {
|
|
147
|
+
install: (e, l) => {
|
|
148
|
+
var t;
|
|
149
|
+
const r = (t = l == null ? void 0 : l.iconPrefix) != null ? t : "";
|
|
150
|
+
e.component(r + C.name, C);
|
|
151
151
|
}
|
|
152
|
-
}),
|
|
152
|
+
}), D = {
|
|
153
153
|
id: Symbol("ID"),
|
|
154
154
|
source: Symbol("Source")
|
|
155
155
|
};
|
|
156
|
-
function
|
|
157
|
-
const
|
|
156
|
+
function Ve(e, l) {
|
|
157
|
+
const t = o({});
|
|
158
158
|
return e == null || e.forEach((n) => {
|
|
159
159
|
let c = null;
|
|
160
|
-
n.default && (c = (typeof n.default == "function" ? n.default() : n.default) || null),
|
|
161
|
-
}), [
|
|
162
|
-
|
|
160
|
+
n.default && (c = (typeof n.default == "function" ? n.default() : n.default) || null), l && l[n.key] !== void 0 && (c = l[n.key]), t.value[n.key] = c;
|
|
161
|
+
}), [t, (n) => {
|
|
162
|
+
t.value = n;
|
|
163
163
|
}];
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
function t
|
|
167
|
-
return e != null && e.disabledDate ? e.disabledDate(
|
|
165
|
+
function Ie(e) {
|
|
166
|
+
function l(t, r) {
|
|
167
|
+
return e != null && e.disabledDate ? e.disabledDate(t, r) : !1;
|
|
168
168
|
}
|
|
169
|
-
return (
|
|
169
|
+
return (t, r) => {
|
|
170
170
|
switch (e == null ? void 0 : e.type) {
|
|
171
171
|
case "week":
|
|
172
|
-
return u(
|
|
173
|
-
modelValue: r
|
|
174
|
-
"onUpdate:modelValue": (n) => r
|
|
175
|
-
"disabled-date":
|
|
172
|
+
return u(Z, {
|
|
173
|
+
modelValue: t[r.key],
|
|
174
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
175
|
+
"disabled-date": l,
|
|
176
176
|
format: e == null ? void 0 : e.labelFormat,
|
|
177
177
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
178
178
|
}, null);
|
|
179
179
|
case "month":
|
|
180
|
-
return u(
|
|
181
|
-
modelValue: r
|
|
182
|
-
"onUpdate:modelValue": (n) => r
|
|
183
|
-
"disabled-date":
|
|
180
|
+
return u(J, {
|
|
181
|
+
modelValue: t[r.key],
|
|
182
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
183
|
+
"disabled-date": l,
|
|
184
184
|
format: e == null ? void 0 : e.labelFormat,
|
|
185
185
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
186
186
|
}, null);
|
|
187
187
|
case "quarter":
|
|
188
|
-
return u(
|
|
189
|
-
modelValue: r
|
|
190
|
-
"onUpdate:modelValue": (n) => r
|
|
191
|
-
"disabled-date":
|
|
188
|
+
return u(H, {
|
|
189
|
+
modelValue: t[r.key],
|
|
190
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
191
|
+
"disabled-date": l,
|
|
192
192
|
format: e == null ? void 0 : e.labelFormat,
|
|
193
193
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
194
194
|
}, null);
|
|
195
195
|
case "year":
|
|
196
|
-
return u(
|
|
197
|
-
modelValue: r
|
|
198
|
-
"onUpdate:modelValue": (n) => r
|
|
199
|
-
"disabled-date":
|
|
196
|
+
return u(X, {
|
|
197
|
+
modelValue: t[r.key],
|
|
198
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
199
|
+
"disabled-date": l,
|
|
200
200
|
format: e == null ? void 0 : e.labelFormat,
|
|
201
201
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
202
202
|
}, null);
|
|
203
203
|
case "date":
|
|
204
204
|
default:
|
|
205
|
-
return u(
|
|
206
|
-
modelValue: r
|
|
207
|
-
"onUpdate:modelValue": (n) => r
|
|
208
|
-
"disabled-date":
|
|
205
|
+
return u(Q, {
|
|
206
|
+
modelValue: t[r.key],
|
|
207
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
208
|
+
"disabled-date": l,
|
|
209
209
|
format: e == null ? void 0 : e.labelFormat,
|
|
210
210
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
211
211
|
}, null);
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return (
|
|
215
|
+
function _e(e) {
|
|
216
|
+
return (l, t) => {
|
|
217
217
|
switch (e == null ? void 0 : e.type) {
|
|
218
218
|
case "number":
|
|
219
|
-
return u(
|
|
220
|
-
modelValue: t
|
|
221
|
-
"onUpdate:modelValue": (
|
|
219
|
+
return u(ee, {
|
|
220
|
+
modelValue: l[t.key],
|
|
221
|
+
"onUpdate:modelValue": (r) => l[t.key] = r,
|
|
222
222
|
hideButton: !0,
|
|
223
223
|
"read-only": e == null ? void 0 : e.readonly,
|
|
224
224
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
@@ -226,9 +226,9 @@ function Ve(e) {
|
|
|
226
226
|
}, null);
|
|
227
227
|
case "string":
|
|
228
228
|
default:
|
|
229
|
-
return u(
|
|
230
|
-
modelValue: t
|
|
231
|
-
"onUpdate:modelValue": (
|
|
229
|
+
return u(p, {
|
|
230
|
+
modelValue: l[t.key],
|
|
231
|
+
"onUpdate:modelValue": (r) => l[t.key] = r,
|
|
232
232
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
233
233
|
readonly: e == null ? void 0 : e.readonly,
|
|
234
234
|
allowClear: e == null ? void 0 : e.clearable
|
|
@@ -236,98 +236,98 @@ function Ve(e) {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function v(e) {
|
|
240
240
|
return !!e && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
242
|
+
function De(e) {
|
|
243
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
244
244
|
}
|
|
245
|
-
const
|
|
246
|
-
function
|
|
247
|
-
let
|
|
248
|
-
const
|
|
249
|
-
|
|
245
|
+
const x = /* @__PURE__ */ new WeakMap();
|
|
246
|
+
function Oe(e) {
|
|
247
|
+
let l, t = !1;
|
|
248
|
+
const r = o(/* @__PURE__ */ new Map()), n = (a) => {
|
|
249
|
+
r.value = a, e.cache !== !1 && x.set(e.options, a);
|
|
250
250
|
};
|
|
251
251
|
switch (!0) {
|
|
252
252
|
case e.options instanceof Function: {
|
|
253
|
-
if (
|
|
254
|
-
|
|
253
|
+
if (x.has(e.options)) {
|
|
254
|
+
r.value = x.get(e.options);
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
257
|
const a = e.options();
|
|
258
|
-
|
|
258
|
+
v(a) ? a.then(n) : n(a);
|
|
259
259
|
break;
|
|
260
260
|
}
|
|
261
|
-
case
|
|
262
|
-
e.options.then((a) =>
|
|
261
|
+
case v(e.options): {
|
|
262
|
+
e.options.then((a) => r.value = a);
|
|
263
263
|
break;
|
|
264
264
|
}
|
|
265
265
|
default:
|
|
266
|
-
|
|
266
|
+
r.value = e.options;
|
|
267
267
|
}
|
|
268
268
|
function c() {
|
|
269
|
-
if (!e.autoSumbit || !
|
|
269
|
+
if (!e.autoSumbit || !l)
|
|
270
270
|
return;
|
|
271
|
-
let a =
|
|
271
|
+
let a = l;
|
|
272
272
|
for (; a && a.$el.tagName !== "FORM"; )
|
|
273
273
|
a = a.$parent;
|
|
274
274
|
a && a.$el && a.$el.dispatchEvent(new Event("submit"));
|
|
275
275
|
}
|
|
276
276
|
return (a, d) => {
|
|
277
|
-
let
|
|
278
|
-
return e.default && !
|
|
279
|
-
ref: (
|
|
277
|
+
let i;
|
|
278
|
+
return e.default && !t && (a[d.key] = e.default, t = !0), u(te, {
|
|
279
|
+
ref: (s) => l = s,
|
|
280
280
|
multiple: e.multiple,
|
|
281
281
|
modelValue: a[d.key],
|
|
282
|
-
"onUpdate:modelValue": (
|
|
282
|
+
"onUpdate:modelValue": (s) => a[d.key] = s,
|
|
283
283
|
placeholder: e.placeholder,
|
|
284
284
|
allowClear: e.clearable,
|
|
285
|
-
maxTagCount: e.maxTagCount ??
|
|
285
|
+
maxTagCount: e.maxTagCount ?? 2,
|
|
286
286
|
onChange: c
|
|
287
|
-
},
|
|
288
|
-
key:
|
|
289
|
-
value:
|
|
290
|
-
label:
|
|
291
|
-
}, null))) ?
|
|
292
|
-
default: () => [
|
|
287
|
+
}, De(i = Array.from(r.value.entries()).map(([s, h]) => u(le, {
|
|
288
|
+
key: s,
|
|
289
|
+
value: s,
|
|
290
|
+
label: h
|
|
291
|
+
}, null))) ? i : {
|
|
292
|
+
default: () => [i]
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
function
|
|
296
|
+
function je(e) {
|
|
297
|
+
function l() {
|
|
298
298
|
e != null && e.autoSumbit;
|
|
299
299
|
}
|
|
300
|
-
return (
|
|
301
|
-
modelValue: r
|
|
302
|
-
"onUpdate:modelValue": (n) => r
|
|
300
|
+
return (t, r) => (e != null && e.default && (t[r.key] = e.default), u(re, {
|
|
301
|
+
modelValue: t[r.key],
|
|
302
|
+
"onUpdate:modelValue": (n) => t[r.key] = n,
|
|
303
303
|
checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
|
|
304
304
|
uncheckedText: (e == null ? void 0 : e.closeLabel) ?? "否",
|
|
305
305
|
checkedValue: (e == null ? void 0 : e.openValue) ?? !0,
|
|
306
306
|
uncheckedValue: (e == null ? void 0 : e.closeValue) ?? !1,
|
|
307
|
-
onChange:
|
|
307
|
+
onChange: l
|
|
308
308
|
}, null));
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
return (
|
|
312
|
-
let
|
|
310
|
+
function Ne(e) {
|
|
311
|
+
return (l, t) => {
|
|
312
|
+
let r = [];
|
|
313
313
|
function n(d) {
|
|
314
|
-
|
|
314
|
+
r = d;
|
|
315
315
|
}
|
|
316
316
|
function c(d) {
|
|
317
317
|
if (d && d.length === 2) {
|
|
318
|
-
const [
|
|
319
|
-
t
|
|
318
|
+
const [i, s] = d.sort(), h = _(i).startOf("days"), S = _(s).endOf("days");
|
|
319
|
+
l[t.key] = [h.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), S.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function a(d) {
|
|
323
|
-
return e != null && e.disabledDate ? e.disabledDate(
|
|
323
|
+
return e != null && e.disabledDate ? e.disabledDate(r, d) : !1;
|
|
324
324
|
}
|
|
325
|
-
return u("div", null, [u(
|
|
325
|
+
return u("div", null, [u(ae, {
|
|
326
326
|
style: {
|
|
327
327
|
width: "300px"
|
|
328
328
|
},
|
|
329
|
-
modelValue: t
|
|
330
|
-
"onUpdate:modelValue": (d) => t
|
|
329
|
+
modelValue: l[t.key],
|
|
330
|
+
"onUpdate:modelValue": (d) => l[t.key] = d,
|
|
331
331
|
onSelect: n,
|
|
332
332
|
onChange: c,
|
|
333
333
|
mode: e == null ? void 0 : e.type,
|
|
@@ -338,48 +338,93 @@ function je(e) {
|
|
|
338
338
|
}, null)]);
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
return (
|
|
343
|
-
modelValue: t
|
|
344
|
-
"onUpdate:modelValue": (
|
|
341
|
+
function Pe(e) {
|
|
342
|
+
return (l, t) => u(ne, {
|
|
343
|
+
modelValue: l[t.key],
|
|
344
|
+
"onUpdate:modelValue": (r) => l[t.key] = r,
|
|
345
345
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
346
346
|
autoSize: e == null ? void 0 : e.autosize,
|
|
347
347
|
maxLength: e == null ? void 0 : e.maxLength
|
|
348
348
|
}, null);
|
|
349
349
|
}
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
const F = /* @__PURE__ */ new WeakMap();
|
|
351
|
+
function ze(e) {
|
|
352
|
+
let l, t = !1;
|
|
353
|
+
const r = o([]), n = (a) => {
|
|
354
|
+
r.value = a, e.cache !== !1 && F.set(e.options, a);
|
|
355
|
+
};
|
|
356
|
+
switch (!0) {
|
|
357
|
+
case e.options instanceof Function: {
|
|
358
|
+
if (F.has(e.options)) {
|
|
359
|
+
r.value = F.get(e.options);
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
const a = e.options();
|
|
363
|
+
v(a) ? a.then(n) : n(a);
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case v(e.options): {
|
|
367
|
+
e.options.then((a) => r.value = a);
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
default:
|
|
371
|
+
r.value = e.options;
|
|
372
|
+
}
|
|
373
|
+
function c() {
|
|
374
|
+
if (!e.autoSumbit || !l)
|
|
375
|
+
return;
|
|
376
|
+
let a = l;
|
|
377
|
+
for (; a && a.$el.tagName !== "FORM"; )
|
|
378
|
+
a = a.$parent;
|
|
379
|
+
a && a.$el && a.$el.dispatchEvent(new Event("submit"));
|
|
380
|
+
}
|
|
381
|
+
return (a, d) => (e.default && !t && (a[d.key] = e.default, t = !0), u(ue, {
|
|
382
|
+
ref: (i) => l = i,
|
|
383
|
+
multiple: e.multiple,
|
|
384
|
+
modelValue: a[d.key],
|
|
385
|
+
"onUpdate:modelValue": (i) => a[d.key] = i,
|
|
386
|
+
placeholder: e.placeholder,
|
|
387
|
+
allowClear: e.clearable,
|
|
388
|
+
maxTagCount: e.maxTagCount ?? 2,
|
|
389
|
+
onChange: c,
|
|
390
|
+
data: r.value,
|
|
391
|
+
fieldNames: e.fieldNames
|
|
392
|
+
}, null));
|
|
393
|
+
}
|
|
394
|
+
function Me(e) {
|
|
395
|
+
return (l) => e(l);
|
|
352
396
|
}
|
|
353
|
-
function
|
|
397
|
+
function Le() {
|
|
354
398
|
return {
|
|
355
|
-
input:
|
|
356
|
-
textarea:
|
|
357
|
-
select:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
399
|
+
input: _e,
|
|
400
|
+
textarea: Pe,
|
|
401
|
+
select: Oe,
|
|
402
|
+
treeSelect: ze,
|
|
403
|
+
date: Ie,
|
|
404
|
+
switch: je,
|
|
405
|
+
dateRange: Ne,
|
|
406
|
+
render: Me
|
|
362
407
|
};
|
|
363
408
|
}
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
...
|
|
409
|
+
function Ue(e, l) {
|
|
410
|
+
l.render || (l.render = (r) => r.input());
|
|
411
|
+
const t = l.render({
|
|
412
|
+
...Le()
|
|
368
413
|
});
|
|
369
414
|
return {
|
|
370
|
-
default: () =>
|
|
415
|
+
default: () => t(e, l)
|
|
371
416
|
};
|
|
372
417
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
375
|
-
field:
|
|
376
|
-
label:
|
|
377
|
-
},
|
|
418
|
+
function Re(e, l) {
|
|
419
|
+
return Y(T, {
|
|
420
|
+
field: l.key,
|
|
421
|
+
label: l.title
|
|
422
|
+
}, Ue(e, l));
|
|
378
423
|
}
|
|
379
|
-
function
|
|
380
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
424
|
+
function O(e) {
|
|
425
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
381
426
|
}
|
|
382
|
-
const
|
|
427
|
+
const Te = /* @__PURE__ */ w({
|
|
383
428
|
props: {
|
|
384
429
|
form: {
|
|
385
430
|
type: Object,
|
|
@@ -431,60 +476,60 @@ const Me = /* @__PURE__ */ x({
|
|
|
431
476
|
emits: ["submit", "cancel", "update:model-value"],
|
|
432
477
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
433
478
|
setup(e) {
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
const
|
|
479
|
+
const l = Math.random().toString(32).slice(2).toUpperCase(), t = o(), [r, n] = Ve(e.form, e.modelValue || e.value), c = o(e.columns || 0), a = o(!0), d = () => a.value = !a.value;
|
|
480
|
+
V(D.id, l), V(D.source, r);
|
|
481
|
+
const i = y(() => {
|
|
437
482
|
if (!c.value)
|
|
438
483
|
return 1;
|
|
439
|
-
const f = e.form.reduce((
|
|
484
|
+
const f = e.form.reduce((m, $) => m + (($ == null ? void 0 : $.span) || 1), 0);
|
|
440
485
|
return c.value - f % c.value;
|
|
441
|
-
}),
|
|
442
|
-
function
|
|
443
|
-
var
|
|
444
|
-
const f = (
|
|
486
|
+
}), s = y(() => e.form.reduce((f, m) => (m.rule && (f[m.key] = m.rule), f), {}));
|
|
487
|
+
function h() {
|
|
488
|
+
var m;
|
|
489
|
+
const f = (m = t.value) == null ? void 0 : m.$el;
|
|
445
490
|
f && (c.value = Math.floor(f.offsetWidth / e.minWidth));
|
|
446
491
|
}
|
|
447
|
-
|
|
448
|
-
|
|
492
|
+
R(() => {
|
|
493
|
+
h();
|
|
449
494
|
});
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
...
|
|
495
|
+
function S(f, m) {
|
|
496
|
+
r.value[f] = m, n({
|
|
497
|
+
...r
|
|
453
498
|
});
|
|
454
499
|
}
|
|
455
|
-
function
|
|
500
|
+
function W() {
|
|
456
501
|
var f;
|
|
457
|
-
(f =
|
|
502
|
+
(f = t.value) == null || f.resetFields();
|
|
458
503
|
}
|
|
459
|
-
return window.addEventListener("resize",
|
|
460
|
-
formId:
|
|
461
|
-
formSource:
|
|
462
|
-
formInstance:
|
|
504
|
+
return window.addEventListener("resize", h), {
|
|
505
|
+
formId: l,
|
|
506
|
+
formSource: r,
|
|
507
|
+
formInstance: t,
|
|
463
508
|
formColumns: c,
|
|
464
|
-
formRules:
|
|
509
|
+
formRules: s,
|
|
465
510
|
formCollspased: a,
|
|
466
|
-
formActiosSpan:
|
|
511
|
+
formActiosSpan: i,
|
|
467
512
|
toggleFormCollapsed: d,
|
|
468
|
-
updateFormField:
|
|
513
|
+
updateFormField: S,
|
|
469
514
|
updateFormSource: n,
|
|
470
|
-
reset:
|
|
515
|
+
reset: W
|
|
471
516
|
};
|
|
472
517
|
},
|
|
473
518
|
render() {
|
|
474
519
|
const e = () => {
|
|
475
520
|
this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
|
|
476
|
-
},
|
|
477
|
-
const
|
|
521
|
+
}, l = () => {
|
|
522
|
+
const t = [], r = this.footer ? {
|
|
478
523
|
span: this.formColumns
|
|
479
524
|
} : {
|
|
480
525
|
span: this.formActiosSpan
|
|
481
526
|
};
|
|
482
|
-
if (this.searchable && (
|
|
527
|
+
if (this.searchable && (t.push(u(k, {
|
|
483
528
|
type: "primary",
|
|
484
529
|
htmlType: "submit"
|
|
485
530
|
}, {
|
|
486
531
|
default: () => [b("搜索")]
|
|
487
|
-
})),
|
|
532
|
+
})), t.push(u(k, {
|
|
488
533
|
type: "secondary",
|
|
489
534
|
onClick: () => {
|
|
490
535
|
var n;
|
|
@@ -492,36 +537,36 @@ const Me = /* @__PURE__ */ x({
|
|
|
492
537
|
}
|
|
493
538
|
}, {
|
|
494
539
|
default: () => [b("重置")]
|
|
495
|
-
}))), this.submitable && (
|
|
540
|
+
}))), this.submitable && (t.push(u(k, {
|
|
496
541
|
type: "primary",
|
|
497
542
|
htmlType: "submit"
|
|
498
543
|
}, {
|
|
499
544
|
default: () => [b("提交")]
|
|
500
|
-
})),
|
|
545
|
+
})), t.push(u(k, {
|
|
501
546
|
type: "secondary",
|
|
502
547
|
onClick: () => this.$emit("cancel")
|
|
503
548
|
}, {
|
|
504
549
|
default: () => [b("取消")]
|
|
505
|
-
}))), this.form.some((n) => !!n.collapsed) &&
|
|
550
|
+
}))), this.form.some((n) => !!n.collapsed) && t.push(u(k, {
|
|
506
551
|
onClick: this.toggleFormCollapsed
|
|
507
552
|
}, {
|
|
508
553
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
509
|
-
icon: () => this.formCollspased ? u(
|
|
510
|
-
})), this.$slots.actions &&
|
|
511
|
-
return u(
|
|
512
|
-
default: () => [u(
|
|
554
|
+
icon: () => this.formCollspased ? u(Se, null, null) : u(we, null, null)
|
|
555
|
+
})), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
|
|
556
|
+
return u(I, r, {
|
|
557
|
+
default: () => [u(T, {
|
|
513
558
|
hideLabel: !0,
|
|
514
559
|
contentClass: this.footer ? "form-footer" : ""
|
|
515
560
|
}, {
|
|
516
|
-
default: () => [u(
|
|
517
|
-
default: () => [
|
|
561
|
+
default: () => [u(fe, null, O(t) ? t : {
|
|
562
|
+
default: () => [t]
|
|
518
563
|
})]
|
|
519
564
|
})]
|
|
520
565
|
});
|
|
521
566
|
};
|
|
522
567
|
return u("div", {
|
|
523
568
|
class: "form-render"
|
|
524
|
-
}, [u(
|
|
569
|
+
}, [u(ce, G({
|
|
525
570
|
layout: this.$props.layout,
|
|
526
571
|
rules: this.formRules,
|
|
527
572
|
onSubmitSuccess: e
|
|
@@ -529,47 +574,47 @@ const Me = /* @__PURE__ */ x({
|
|
|
529
574
|
name: this.name
|
|
530
575
|
}, {
|
|
531
576
|
"auto-label-width": !0,
|
|
532
|
-
ref: (
|
|
577
|
+
ref: (t) => this.formInstance = t,
|
|
533
578
|
model: this.formSource
|
|
534
579
|
}), {
|
|
535
|
-
default: () => [u(
|
|
580
|
+
default: () => [u(de, {
|
|
536
581
|
cols: this.formColumns,
|
|
537
582
|
"col-gap": 10,
|
|
538
583
|
"rol-gap": 10
|
|
539
584
|
}, {
|
|
540
|
-
default: () => [this.form.filter((
|
|
541
|
-
let
|
|
542
|
-
return u(
|
|
543
|
-
span:
|
|
544
|
-
},
|
|
545
|
-
default: () => [
|
|
585
|
+
default: () => [this.form.filter((t) => this.formCollspased ? !t.collapsed : !0).map((t) => {
|
|
586
|
+
let r;
|
|
587
|
+
return u(I, {
|
|
588
|
+
span: t.span
|
|
589
|
+
}, O(r = Re(this.formSource, t)) ? r : {
|
|
590
|
+
default: () => [r]
|
|
546
591
|
});
|
|
547
|
-
}),
|
|
592
|
+
}), l()]
|
|
548
593
|
})]
|
|
549
594
|
})]);
|
|
550
595
|
}
|
|
551
596
|
});
|
|
552
|
-
function
|
|
597
|
+
function We(e) {
|
|
553
598
|
return e;
|
|
554
599
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
function
|
|
600
|
+
function Ae(e) {
|
|
601
|
+
const l = j(), t = o();
|
|
602
|
+
function r() {
|
|
558
603
|
var c, a;
|
|
559
|
-
const n = (a = (c =
|
|
560
|
-
n && (
|
|
604
|
+
const n = (a = (c = l == null ? void 0 : l.proxy) == null ? void 0 : c.$refs) == null ? void 0 : a[e];
|
|
605
|
+
n && (t.value = n);
|
|
561
606
|
}
|
|
562
|
-
return
|
|
607
|
+
return R(r), K(r), t;
|
|
563
608
|
}
|
|
564
|
-
const
|
|
565
|
-
install(e,
|
|
566
|
-
e.component("FormRender",
|
|
609
|
+
const Ye = {
|
|
610
|
+
install(e, l) {
|
|
611
|
+
e.component("FormRender", Te);
|
|
567
612
|
}
|
|
568
613
|
};
|
|
569
614
|
export {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
615
|
+
Te as FormRender,
|
|
616
|
+
Qe as FormRenderResolver,
|
|
617
|
+
Ye as default,
|
|
618
|
+
We as defineForm,
|
|
619
|
+
Ae as useForm
|
|
575
620
|
};
|