@gopowerteam/form-render 0.0.16 → 0.0.18
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 +15 -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 +15 -0
- package/dist/es/index.mjs +233 -187
- 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,
|
|
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 le, Option as te, Switch as re, RangePicker as ae, Textarea as ne, TreeSelect as ue, FormItem as T, Form as ce, Grid as de, GridItem as I, Button as k, Space as fe } from "@arco-design/web-vue";
|
|
3
|
+
import _ from "dayjs";
|
|
4
|
+
import { FormRenderResolver as Qe } from "./resolver.mjs";
|
|
5
|
+
const se = Symbol("ArcoConfigProvider"), ie = "arco", me = "$arco", q = (e) => {
|
|
6
|
+
var t, l, r;
|
|
7
|
+
const n = j(), c = A(se, void 0), a = (r = (l = c == null ? void 0 : c.prefixCls) != null ? l : (t = n == null ? void 0 : n.appContext.config.globalProperties[me]) == null ? void 0 : t.classPrefix) != null ? r : ie;
|
|
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
13
|
var E = (e, t) => {
|
|
14
|
-
for (const [
|
|
15
|
-
e[
|
|
14
|
+
for (const [l, r] of t)
|
|
15
|
+
e[l] = r;
|
|
16
16
|
return e;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const he = w({
|
|
19
19
|
name: "IconDown",
|
|
20
20
|
props: {
|
|
21
21
|
size: {
|
|
@@ -44,45 +44,45 @@ const me = x({
|
|
|
44
44
|
setup(e, {
|
|
45
45
|
emit: t
|
|
46
46
|
}) {
|
|
47
|
-
const
|
|
48
|
-
[`${
|
|
47
|
+
const l = q("icon"), r = y(() => [l, `${l}-down`, {
|
|
48
|
+
[`${l}-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
|
t("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, t, l, 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
75
|
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
76
|
-
},
|
|
76
|
+
}, be, 14, ye);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
const
|
|
78
|
+
var g = /* @__PURE__ */ E(he, [["render", ve]]);
|
|
79
|
+
const Se = Object.assign(g, {
|
|
80
80
|
install: (e, t) => {
|
|
81
|
-
var
|
|
82
|
-
const
|
|
83
|
-
e.component(
|
|
81
|
+
var l;
|
|
82
|
+
const r = (l = t == null ? void 0 : t.iconPrefix) != null ? l : "";
|
|
83
|
+
e.component(r + g.name, g);
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
85
|
+
}), $e = w({
|
|
86
86
|
name: "IconUp",
|
|
87
87
|
props: {
|
|
88
88
|
size: {
|
|
@@ -111,100 +111,100 @@ const be = Object.assign($, {
|
|
|
111
111
|
setup(e, {
|
|
112
112
|
emit: t
|
|
113
113
|
}) {
|
|
114
|
-
const
|
|
115
|
-
[`${
|
|
114
|
+
const l = q("icon"), r = y(() => [l, `${l}-up`, {
|
|
115
|
+
[`${l}-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
|
t("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, t, l, 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
142
|
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
143
|
-
},
|
|
143
|
+
}, xe, 14, ge);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
const
|
|
145
|
+
var C = /* @__PURE__ */ E($e, [["render", Fe]]);
|
|
146
|
+
const we = Object.assign(C, {
|
|
147
147
|
install: (e, t) => {
|
|
148
|
-
var
|
|
149
|
-
const
|
|
150
|
-
e.component(
|
|
148
|
+
var l;
|
|
149
|
+
const r = (l = t == null ? void 0 : t.iconPrefix) != null ? l : "";
|
|
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, t) {
|
|
157
|
+
const l = 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), t && t[n.key] !== void 0 && (c = t[n.key]),
|
|
161
|
-
}), [
|
|
162
|
-
|
|
160
|
+
n.default && (c = (typeof n.default == "function" ? n.default() : n.default) || null), t && t[n.key] !== void 0 && (c = t[n.key]), l.value[n.key] = c;
|
|
161
|
+
}), [l, (n) => {
|
|
162
|
+
l.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 t(l, r) {
|
|
167
|
+
return e != null && e.disabledDate ? e.disabledDate(l, r) : !1;
|
|
168
168
|
}
|
|
169
|
-
return (
|
|
169
|
+
return (l, 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
|
|
172
|
+
return u(Z, {
|
|
173
|
+
modelValue: l[r.key],
|
|
174
|
+
"onUpdate:modelValue": (n) => l[r.key] = n,
|
|
175
175
|
"disabled-date": t,
|
|
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
|
|
180
|
+
return u(J, {
|
|
181
|
+
modelValue: l[r.key],
|
|
182
|
+
"onUpdate:modelValue": (n) => l[r.key] = n,
|
|
183
183
|
"disabled-date": t,
|
|
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
|
|
188
|
+
return u(H, {
|
|
189
|
+
modelValue: l[r.key],
|
|
190
|
+
"onUpdate:modelValue": (n) => l[r.key] = n,
|
|
191
191
|
"disabled-date": t,
|
|
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
|
|
196
|
+
return u(X, {
|
|
197
|
+
modelValue: l[r.key],
|
|
198
|
+
"onUpdate:modelValue": (n) => l[r.key] = n,
|
|
199
199
|
"disabled-date": t,
|
|
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
|
|
205
|
+
return u(Q, {
|
|
206
|
+
modelValue: l[r.key],
|
|
207
|
+
"onUpdate:modelValue": (n) => l[r.key] = n,
|
|
208
208
|
"disabled-date": t,
|
|
209
209
|
format: e == null ? void 0 : e.labelFormat,
|
|
210
210
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
@@ -212,13 +212,13 @@ function we(e) {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return (t,
|
|
215
|
+
function _e(e) {
|
|
216
|
+
return (t, l) => {
|
|
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: t[l.key],
|
|
221
|
+
"onUpdate:modelValue": (r) => t[l.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: t[l.key],
|
|
231
|
+
"onUpdate:modelValue": (r) => t[l.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,34 +236,34 @@ 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 t,
|
|
248
|
-
const
|
|
249
|
-
|
|
245
|
+
const x = /* @__PURE__ */ new WeakMap();
|
|
246
|
+
function Oe(e) {
|
|
247
|
+
let t, l = !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
269
|
if (!e.autoSumbit || !t)
|
|
@@ -274,8 +274,8 @@ function _e(e) {
|
|
|
274
274
|
a && a.$el && a.$el.dispatchEvent(new Event("submit"));
|
|
275
275
|
}
|
|
276
276
|
return (a, d) => {
|
|
277
|
-
let
|
|
278
|
-
return e.default && !
|
|
277
|
+
let s;
|
|
278
|
+
return e.default && !l && (a[d.key] = e.default, l = !0), u(le, {
|
|
279
279
|
ref: (i) => t = i,
|
|
280
280
|
multiple: e.multiple,
|
|
281
281
|
modelValue: a[d.key],
|
|
@@ -284,22 +284,22 @@ function _e(e) {
|
|
|
284
284
|
allowClear: e.clearable,
|
|
285
285
|
maxTagCount: e.maxTagCount ?? 2,
|
|
286
286
|
onChange: c
|
|
287
|
-
},
|
|
287
|
+
}, De(s = Array.from(r.value.entries()).map(([i, h]) => u(te, {
|
|
288
288
|
key: i,
|
|
289
289
|
value: i,
|
|
290
|
-
label:
|
|
291
|
-
}, null))) ?
|
|
292
|
-
default: () => [
|
|
290
|
+
label: h
|
|
291
|
+
}, null))) ? s : {
|
|
292
|
+
default: () => [s]
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function je(e) {
|
|
297
297
|
function t() {
|
|
298
298
|
e != null && e.autoSumbit;
|
|
299
299
|
}
|
|
300
|
-
return (
|
|
301
|
-
modelValue: r
|
|
302
|
-
"onUpdate:modelValue": (n) => r
|
|
300
|
+
return (l, r) => (e != null && e.default && (l[r.key] = e.default), u(re, {
|
|
301
|
+
modelValue: l[r.key],
|
|
302
|
+
"onUpdate:modelValue": (n) => l[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,
|
|
@@ -307,27 +307,27 @@ function De(e) {
|
|
|
307
307
|
onChange: t
|
|
308
308
|
}, null));
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
return (t,
|
|
312
|
-
let
|
|
310
|
+
function Ne(e) {
|
|
311
|
+
return (t, l) => {
|
|
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 [s, i] = d.sort(), h = _(s).startOf("days"), S = _(i).endOf("days");
|
|
319
|
+
t[l.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: t[l.key],
|
|
330
|
+
"onUpdate:modelValue": (d) => t[l.key] = d,
|
|
331
331
|
onSelect: n,
|
|
332
332
|
onChange: c,
|
|
333
333
|
mode: e == null ? void 0 : e.type,
|
|
@@ -338,48 +338,94 @@ function je(e) {
|
|
|
338
338
|
}, null)]);
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
return (t,
|
|
343
|
-
modelValue: t[
|
|
344
|
-
"onUpdate:modelValue": (
|
|
341
|
+
function Pe(e) {
|
|
342
|
+
return (t, l) => u(ne, {
|
|
343
|
+
modelValue: t[l.key],
|
|
344
|
+
"onUpdate:modelValue": (r) => t[l.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
|
-
|
|
350
|
+
const F = /* @__PURE__ */ new WeakMap();
|
|
351
|
+
function ze(e) {
|
|
352
|
+
let t, l = !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 || !t)
|
|
375
|
+
return;
|
|
376
|
+
let a = t;
|
|
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 && !l && (a[d.key] = e.default, l = !0), u(ue, {
|
|
382
|
+
ref: (s) => t = s,
|
|
383
|
+
multiple: e.multiple,
|
|
384
|
+
modelValue: a[d.key],
|
|
385
|
+
"onUpdate:modelValue": (s) => a[d.key] = s,
|
|
386
|
+
placeholder: e.placeholder,
|
|
387
|
+
allowClear: e.clearable,
|
|
388
|
+
allowSearch: e.searchable,
|
|
389
|
+
maxTagCount: e.maxTagCount ?? 2,
|
|
390
|
+
onChange: c,
|
|
391
|
+
data: r.value,
|
|
392
|
+
fieldNames: e.fieldNames
|
|
393
|
+
}, null));
|
|
394
|
+
}
|
|
395
|
+
function Me(e) {
|
|
351
396
|
return (t) => e(t);
|
|
352
397
|
}
|
|
353
|
-
function
|
|
398
|
+
function Le() {
|
|
354
399
|
return {
|
|
355
|
-
input:
|
|
356
|
-
textarea:
|
|
357
|
-
select:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
400
|
+
input: _e,
|
|
401
|
+
textarea: Pe,
|
|
402
|
+
select: Oe,
|
|
403
|
+
treeSelect: ze,
|
|
404
|
+
date: Ie,
|
|
405
|
+
switch: je,
|
|
406
|
+
dateRange: Ne,
|
|
407
|
+
render: Me
|
|
362
408
|
};
|
|
363
409
|
}
|
|
364
|
-
function
|
|
365
|
-
t.render || (t.render = (
|
|
366
|
-
const
|
|
367
|
-
...
|
|
410
|
+
function Ue(e, t) {
|
|
411
|
+
t.render || (t.render = (r) => r.input());
|
|
412
|
+
const l = t.render({
|
|
413
|
+
...Le()
|
|
368
414
|
});
|
|
369
415
|
return {
|
|
370
|
-
default: () =>
|
|
416
|
+
default: () => l(e, t)
|
|
371
417
|
};
|
|
372
418
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
419
|
+
function Re(e, t) {
|
|
420
|
+
return Y(T, {
|
|
375
421
|
field: t.key,
|
|
376
422
|
label: t.title
|
|
377
|
-
},
|
|
423
|
+
}, Ue(e, t));
|
|
378
424
|
}
|
|
379
|
-
function
|
|
380
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
425
|
+
function O(e) {
|
|
426
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
381
427
|
}
|
|
382
|
-
const
|
|
428
|
+
const Te = /* @__PURE__ */ w({
|
|
383
429
|
props: {
|
|
384
430
|
form: {
|
|
385
431
|
type: Object,
|
|
@@ -431,60 +477,60 @@ const Me = /* @__PURE__ */ x({
|
|
|
431
477
|
emits: ["submit", "cancel", "update:model-value"],
|
|
432
478
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
433
479
|
setup(e) {
|
|
434
|
-
const t = Math.random().toString(32).slice(2).toUpperCase(),
|
|
435
|
-
|
|
436
|
-
const
|
|
480
|
+
const t = Math.random().toString(32).slice(2).toUpperCase(), l = o(), [r, n] = Ve(e.form, e.modelValue || e.value), c = o(e.columns || 0), a = o(!0), d = () => a.value = !a.value;
|
|
481
|
+
V(D.id, t), V(D.source, r);
|
|
482
|
+
const s = y(() => {
|
|
437
483
|
if (!c.value)
|
|
438
484
|
return 1;
|
|
439
|
-
const f = e.form.reduce((
|
|
485
|
+
const f = e.form.reduce((m, $) => m + (($ == null ? void 0 : $.span) || 1), 0);
|
|
440
486
|
return c.value - f % c.value;
|
|
441
|
-
}), i = y(() => e.form.reduce((f,
|
|
442
|
-
function
|
|
443
|
-
var
|
|
444
|
-
const f = (
|
|
487
|
+
}), i = y(() => e.form.reduce((f, m) => (m.rule && (f[m.key] = m.rule), f), {}));
|
|
488
|
+
function h() {
|
|
489
|
+
var m;
|
|
490
|
+
const f = (m = l.value) == null ? void 0 : m.$el;
|
|
445
491
|
f && (c.value = Math.floor(f.offsetWidth / e.minWidth));
|
|
446
492
|
}
|
|
447
|
-
|
|
448
|
-
|
|
493
|
+
R(() => {
|
|
494
|
+
h();
|
|
449
495
|
});
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
...
|
|
496
|
+
function S(f, m) {
|
|
497
|
+
r.value[f] = m, n({
|
|
498
|
+
...r
|
|
453
499
|
});
|
|
454
500
|
}
|
|
455
|
-
function
|
|
501
|
+
function W() {
|
|
456
502
|
var f;
|
|
457
|
-
(f =
|
|
503
|
+
(f = l.value) == null || f.resetFields();
|
|
458
504
|
}
|
|
459
|
-
return window.addEventListener("resize",
|
|
505
|
+
return window.addEventListener("resize", h), {
|
|
460
506
|
formId: t,
|
|
461
|
-
formSource:
|
|
462
|
-
formInstance:
|
|
507
|
+
formSource: r,
|
|
508
|
+
formInstance: l,
|
|
463
509
|
formColumns: c,
|
|
464
510
|
formRules: i,
|
|
465
511
|
formCollspased: a,
|
|
466
|
-
formActiosSpan:
|
|
512
|
+
formActiosSpan: s,
|
|
467
513
|
toggleFormCollapsed: d,
|
|
468
|
-
updateFormField:
|
|
514
|
+
updateFormField: S,
|
|
469
515
|
updateFormSource: n,
|
|
470
|
-
reset:
|
|
516
|
+
reset: W
|
|
471
517
|
};
|
|
472
518
|
},
|
|
473
519
|
render() {
|
|
474
520
|
const e = () => {
|
|
475
521
|
this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
|
|
476
522
|
}, t = () => {
|
|
477
|
-
const
|
|
523
|
+
const l = [], r = this.footer ? {
|
|
478
524
|
span: this.formColumns
|
|
479
525
|
} : {
|
|
480
526
|
span: this.formActiosSpan
|
|
481
527
|
};
|
|
482
|
-
if (this.searchable && (
|
|
528
|
+
if (this.searchable && (l.push(u(k, {
|
|
483
529
|
type: "primary",
|
|
484
530
|
htmlType: "submit"
|
|
485
531
|
}, {
|
|
486
532
|
default: () => [b("搜索")]
|
|
487
|
-
})),
|
|
533
|
+
})), l.push(u(k, {
|
|
488
534
|
type: "secondary",
|
|
489
535
|
onClick: () => {
|
|
490
536
|
var n;
|
|
@@ -492,36 +538,36 @@ const Me = /* @__PURE__ */ x({
|
|
|
492
538
|
}
|
|
493
539
|
}, {
|
|
494
540
|
default: () => [b("重置")]
|
|
495
|
-
}))), this.submitable && (
|
|
541
|
+
}))), this.submitable && (l.push(u(k, {
|
|
496
542
|
type: "primary",
|
|
497
543
|
htmlType: "submit"
|
|
498
544
|
}, {
|
|
499
545
|
default: () => [b("提交")]
|
|
500
|
-
})),
|
|
546
|
+
})), l.push(u(k, {
|
|
501
547
|
type: "secondary",
|
|
502
548
|
onClick: () => this.$emit("cancel")
|
|
503
549
|
}, {
|
|
504
550
|
default: () => [b("取消")]
|
|
505
|
-
}))), this.form.some((n) => !!n.collapsed) &&
|
|
551
|
+
}))), this.form.some((n) => !!n.collapsed) && l.push(u(k, {
|
|
506
552
|
onClick: this.toggleFormCollapsed
|
|
507
553
|
}, {
|
|
508
554
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
509
|
-
icon: () => this.formCollspased ? u(
|
|
510
|
-
})), this.$slots.actions &&
|
|
511
|
-
return u(
|
|
512
|
-
default: () => [u(
|
|
555
|
+
icon: () => this.formCollspased ? u(Se, null, null) : u(we, null, null)
|
|
556
|
+
})), this.$slots.actions && l.push(...this.$slots.actions()), l.length)
|
|
557
|
+
return u(I, r, {
|
|
558
|
+
default: () => [u(T, {
|
|
513
559
|
hideLabel: !0,
|
|
514
560
|
contentClass: this.footer ? "form-footer" : ""
|
|
515
561
|
}, {
|
|
516
|
-
default: () => [u(
|
|
517
|
-
default: () => [
|
|
562
|
+
default: () => [u(fe, null, O(l) ? l : {
|
|
563
|
+
default: () => [l]
|
|
518
564
|
})]
|
|
519
565
|
})]
|
|
520
566
|
});
|
|
521
567
|
};
|
|
522
568
|
return u("div", {
|
|
523
569
|
class: "form-render"
|
|
524
|
-
}, [u(
|
|
570
|
+
}, [u(ce, G({
|
|
525
571
|
layout: this.$props.layout,
|
|
526
572
|
rules: this.formRules,
|
|
527
573
|
onSubmitSuccess: e
|
|
@@ -529,47 +575,47 @@ const Me = /* @__PURE__ */ x({
|
|
|
529
575
|
name: this.name
|
|
530
576
|
}, {
|
|
531
577
|
"auto-label-width": !0,
|
|
532
|
-
ref: (
|
|
578
|
+
ref: (l) => this.formInstance = l,
|
|
533
579
|
model: this.formSource
|
|
534
580
|
}), {
|
|
535
|
-
default: () => [u(
|
|
581
|
+
default: () => [u(de, {
|
|
536
582
|
cols: this.formColumns,
|
|
537
583
|
"col-gap": 10,
|
|
538
584
|
"rol-gap": 10
|
|
539
585
|
}, {
|
|
540
|
-
default: () => [this.form.filter((
|
|
541
|
-
let
|
|
542
|
-
return u(
|
|
543
|
-
span:
|
|
544
|
-
},
|
|
545
|
-
default: () => [
|
|
586
|
+
default: () => [this.form.filter((l) => this.formCollspased ? !l.collapsed : !0).map((l) => {
|
|
587
|
+
let r;
|
|
588
|
+
return u(I, {
|
|
589
|
+
span: l.span
|
|
590
|
+
}, O(r = Re(this.formSource, l)) ? r : {
|
|
591
|
+
default: () => [r]
|
|
546
592
|
});
|
|
547
593
|
}), t()]
|
|
548
594
|
})]
|
|
549
595
|
})]);
|
|
550
596
|
}
|
|
551
597
|
});
|
|
552
|
-
function
|
|
598
|
+
function We(e) {
|
|
553
599
|
return e;
|
|
554
600
|
}
|
|
555
|
-
function
|
|
556
|
-
const t = j(),
|
|
557
|
-
function
|
|
601
|
+
function Ae(e) {
|
|
602
|
+
const t = j(), l = o();
|
|
603
|
+
function r() {
|
|
558
604
|
var c, a;
|
|
559
605
|
const n = (a = (c = t == null ? void 0 : t.proxy) == null ? void 0 : c.$refs) == null ? void 0 : a[e];
|
|
560
|
-
n && (
|
|
606
|
+
n && (l.value = n);
|
|
561
607
|
}
|
|
562
|
-
return
|
|
608
|
+
return R(r), K(r), l;
|
|
563
609
|
}
|
|
564
|
-
const
|
|
610
|
+
const Ye = {
|
|
565
611
|
install(e, t) {
|
|
566
|
-
e.component("FormRender",
|
|
612
|
+
e.component("FormRender", Te);
|
|
567
613
|
}
|
|
568
614
|
};
|
|
569
615
|
export {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
616
|
+
Te as FormRender,
|
|
617
|
+
Qe as FormRenderResolver,
|
|
618
|
+
Ye as default,
|
|
619
|
+
We as defineForm,
|
|
620
|
+
Ae as useForm
|
|
575
621
|
};
|