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