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