@iswangh/element-plus-kit-form 0.1.3 → 0.1.4
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/README.md +133 -0
- package/dist/FormAction.vue.d.ts +27 -1
- package/dist/FormAction.vue.d.ts.map +1 -1
- package/dist/FormItem.vue.d.ts.map +1 -1
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/useAutoExpandOnHover.d.ts +15 -0
- package/dist/composables/useAutoExpandOnHover.d.ts.map +1 -0
- package/dist/config/action.d.ts +29 -0
- package/dist/config/action.d.ts.map +1 -0
- package/dist/config/component.d.ts +38 -0
- package/dist/config/component.d.ts.map +1 -0
- package/dist/config/form.d.ts +6 -0
- package/dist/config/form.d.ts.map +1 -0
- package/dist/config/index.d.ts +4 -65
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/scroll.d.ts +7 -0
- package/dist/config/scroll.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +570 -340
- package/dist/style.css +1 -1
- package/dist/types/action.d.ts +52 -6
- package/dist/utils/action.d.ts +10 -0
- package/dist/utils/action.d.ts.map +1 -0
- package/dist/utils/debounce.d.ts +25 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/value.d.ts +14 -0
- package/dist/utils/value.d.ts.map +1 -1
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -1,70 +1,188 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { checkCondition as
|
|
3
|
-
import { ElTreeSelect as
|
|
4
|
-
|
|
1
|
+
import { onBeforeUnmount as ye, nextTick as q, defineComponent as L, createElementBlock as M, openBlock as v, createElementVNode as ae, computed as p, withDirectives as ne, createCommentVNode as Ae, createBlock as y, unref as S, withCtx as w, Fragment as $, renderSlot as ce, renderList as j, mergeProps as _, normalizeClass as we, createVNode as X, createTextVNode as Oe, toDisplayString as Se, resolveDynamicComponent as D, vShow as oe, mergeModels as J, useModel as fe, ref as Y, watch as Q, watchEffect as be, normalizeProps as me, guardReactiveProps as de, createSlots as le, useAttrs as Te, useSlots as ke, onMounted as Fe, withModifiers as Me, TransitionGroup as _e } from "vue";
|
|
2
|
+
import { checkCondition as Z } from "@iswangh/element-plus-kit-core";
|
|
3
|
+
import { ElTreeSelect as De, ElTransfer as Ve, ElTimeSelect as Be, ElTimePicker as Pe, ElSwitch as Re, ElSlider as Le, ElSelectV2 as Ne, ElSelect as Ue, ElRate as $e, ElRadioGroup as je, ElMention as ze, ElInputTag as He, ElInputNumber as Ge, ElInput as We, ElDatePicker as Ke, ElDatePickerPanel as Xe, ElColorPicker as qe, ElColorPickerPanel as Je, ElCheckboxGroup as Ye, ElCascader as Qe, ElAutocomplete as Ze, ElFormItem as pe, ElButton as et, ElIcon as tt, ElCol as nt, ElRow as ot, ElForm as rt } from "element-plus";
|
|
4
|
+
function at(e, s, t) {
|
|
5
|
+
let i = !1, r = null, g = null;
|
|
6
|
+
function x() {
|
|
7
|
+
r && (clearTimeout(r), r = null), g && (clearTimeout(g), g = null);
|
|
8
|
+
}
|
|
9
|
+
function k() {
|
|
10
|
+
!s.value || i || (r && clearTimeout(r), r = setTimeout(() => {
|
|
11
|
+
!e.value && !i && t(!0);
|
|
12
|
+
}, 500));
|
|
13
|
+
}
|
|
14
|
+
function E() {
|
|
15
|
+
r && (clearTimeout(r), r = null), g && clearTimeout(g), q(() => {
|
|
16
|
+
g = setTimeout(() => {
|
|
17
|
+
i = !1, g = null;
|
|
18
|
+
}, 100);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function I() {
|
|
22
|
+
s.value && (i = !0, x());
|
|
23
|
+
}
|
|
24
|
+
return ye(x), {
|
|
25
|
+
onMouseEnter: k,
|
|
26
|
+
onMouseLeave: E,
|
|
27
|
+
recordManualToggle: I
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function lt() {
|
|
31
|
+
let e = !1, s = !1, t = null, i = !1;
|
|
32
|
+
return {
|
|
33
|
+
/** 是否正在清理 */
|
|
34
|
+
get isClearing() {
|
|
35
|
+
return e;
|
|
36
|
+
},
|
|
37
|
+
/** 是否用户交互 */
|
|
38
|
+
get isUserInteraction() {
|
|
39
|
+
return s;
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* 开始清理操作
|
|
43
|
+
* @param value - 清理前的值
|
|
44
|
+
*/
|
|
45
|
+
startClearing(r) {
|
|
46
|
+
e = !0, t = r, i = !0;
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* 结束清理操作(在 nextTick 中调用)
|
|
50
|
+
*/
|
|
51
|
+
endClearing() {
|
|
52
|
+
e = !1, t = null, i = !1;
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* 开始用户交互
|
|
56
|
+
*/
|
|
57
|
+
startUserInteraction() {
|
|
58
|
+
s = !0;
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* 结束用户交互(在 nextTick 中调用)
|
|
62
|
+
*/
|
|
63
|
+
endUserInteraction() {
|
|
64
|
+
s = !1;
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* 判断是否是清理操作
|
|
68
|
+
* @param oldValue - 旧值
|
|
69
|
+
* @param newValue - 新值
|
|
70
|
+
* @param isEmpty - 检查值是否为空的函数
|
|
71
|
+
*/
|
|
72
|
+
isClearingOperation(r, g, x) {
|
|
73
|
+
return !!(e || i || !x(r) && x(g) && r === t);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
var it = /* @__PURE__ */ L({
|
|
78
|
+
name: "ArrowDown",
|
|
79
|
+
__name: "arrow-down",
|
|
80
|
+
setup(e) {
|
|
81
|
+
return (s, t) => (v(), M("svg", {
|
|
82
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
83
|
+
viewBox: "0 0 1024 1024"
|
|
84
|
+
}, [
|
|
85
|
+
ae("path", {
|
|
86
|
+
fill: "currentColor",
|
|
87
|
+
d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"
|
|
88
|
+
})
|
|
89
|
+
]));
|
|
90
|
+
}
|
|
91
|
+
}), st = it, ut = /* @__PURE__ */ L({
|
|
5
92
|
name: "Refresh",
|
|
6
93
|
__name: "refresh",
|
|
7
94
|
setup(e) {
|
|
8
|
-
return (
|
|
95
|
+
return (s, t) => (v(), M("svg", {
|
|
9
96
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
97
|
viewBox: "0 0 1024 1024"
|
|
11
98
|
}, [
|
|
12
|
-
|
|
99
|
+
ae("path", {
|
|
13
100
|
fill: "currentColor",
|
|
14
101
|
d: "M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"
|
|
15
102
|
})
|
|
16
103
|
]));
|
|
17
104
|
}
|
|
18
|
-
}),
|
|
105
|
+
}), ct = ut, ft = /* @__PURE__ */ L({
|
|
19
106
|
name: "Search",
|
|
20
107
|
__name: "search",
|
|
21
108
|
setup(e) {
|
|
22
|
-
return (
|
|
109
|
+
return (s, t) => (v(), M("svg", {
|
|
23
110
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24
111
|
viewBox: "0 0 1024 1024"
|
|
25
112
|
}, [
|
|
26
|
-
|
|
113
|
+
ae("path", {
|
|
27
114
|
fill: "currentColor",
|
|
28
115
|
d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
|
|
29
116
|
})
|
|
30
117
|
]));
|
|
31
118
|
}
|
|
32
|
-
}),
|
|
33
|
-
const
|
|
119
|
+
}), mt = ft;
|
|
120
|
+
const ve = {
|
|
121
|
+
behavior: "smooth",
|
|
122
|
+
// 平滑滚动
|
|
123
|
+
block: "center",
|
|
124
|
+
// 垂直居中,让错误项在视窗中间
|
|
125
|
+
inline: "nearest"
|
|
126
|
+
// 水平方向保持最近位置
|
|
127
|
+
}, dt = {
|
|
128
|
+
search: { label: "搜索", icon: mt, type: "primary" },
|
|
129
|
+
reset: { label: "重置", icon: ct },
|
|
130
|
+
submit: { label: "确认", type: "primary" },
|
|
131
|
+
cancel: { label: "取消" },
|
|
132
|
+
expand: { type: "text" }
|
|
133
|
+
}, pt = ve, vt = {
|
|
134
|
+
getDefaults(e, s) {
|
|
135
|
+
return {
|
|
136
|
+
...this.buildActionAttrs(e),
|
|
137
|
+
...s
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
generateActionButtons(e) {
|
|
141
|
+
return e ? ["search", "reset"] : ["submit", "cancel"];
|
|
142
|
+
},
|
|
143
|
+
buildActionAttrs(e) {
|
|
144
|
+
return {
|
|
145
|
+
buttons: this.generateActionButtons(e),
|
|
146
|
+
vIf: e,
|
|
147
|
+
autoExpandOnError: !0,
|
|
148
|
+
vShow: !0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}, gt = ["comp", "compAttrs", "vIf", "vShow"], ht = {
|
|
34
152
|
custom: "div"
|
|
35
|
-
},
|
|
36
|
-
autocomplete:
|
|
37
|
-
cascader:
|
|
38
|
-
checkbox:
|
|
39
|
-
"color-picker-panel":
|
|
40
|
-
"color-picker":
|
|
41
|
-
"date-picker-panel":
|
|
42
|
-
"date-picker":
|
|
43
|
-
input:
|
|
44
|
-
"input-number":
|
|
45
|
-
"input-tag":
|
|
46
|
-
mention:
|
|
47
|
-
radio:
|
|
48
|
-
rate:
|
|
49
|
-
select:
|
|
50
|
-
"select-v2":
|
|
51
|
-
slider:
|
|
52
|
-
switch:
|
|
53
|
-
"time-picker":
|
|
54
|
-
"time-select":
|
|
55
|
-
transfer:
|
|
56
|
-
"tree-select":
|
|
57
|
-
},
|
|
58
|
-
...
|
|
59
|
-
...
|
|
60
|
-
},
|
|
153
|
+
}, xt = {
|
|
154
|
+
autocomplete: Ze,
|
|
155
|
+
cascader: Qe,
|
|
156
|
+
checkbox: Ye,
|
|
157
|
+
"color-picker-panel": Je,
|
|
158
|
+
"color-picker": qe,
|
|
159
|
+
"date-picker-panel": Xe,
|
|
160
|
+
"date-picker": Ke,
|
|
161
|
+
input: We,
|
|
162
|
+
"input-number": Ge,
|
|
163
|
+
"input-tag": He,
|
|
164
|
+
mention: ze,
|
|
165
|
+
radio: je,
|
|
166
|
+
rate: $e,
|
|
167
|
+
select: Ue,
|
|
168
|
+
"select-v2": Ne,
|
|
169
|
+
slider: Le,
|
|
170
|
+
switch: Re,
|
|
171
|
+
"time-picker": Pe,
|
|
172
|
+
"time-select": Be,
|
|
173
|
+
transfer: Ve,
|
|
174
|
+
"tree-select": De
|
|
175
|
+
}, It = {
|
|
176
|
+
...xt,
|
|
177
|
+
...ht
|
|
178
|
+
}, Et = {
|
|
61
179
|
/**
|
|
62
180
|
* 获取组件默认属性
|
|
63
181
|
*/
|
|
64
182
|
getDefaults(e) {
|
|
65
|
-
const { comp:
|
|
183
|
+
const { comp: s, compAttrs: t = {} } = e, i = this.getComponentType(s);
|
|
66
184
|
return {
|
|
67
|
-
...this.buildComponentAttrs(e,
|
|
185
|
+
...this.buildComponentAttrs(e, i),
|
|
68
186
|
...t
|
|
69
187
|
// 用户配置最后合并,优先级最高
|
|
70
188
|
};
|
|
@@ -73,178 +191,163 @@ const We = ["comp", "compAttrs", "vIf", "vShow"], Ge = {
|
|
|
73
191
|
* 判断组件类型
|
|
74
192
|
*/
|
|
75
193
|
getComponentType(e) {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
194
|
+
const s = ["autocomplete", "input", "input-number", "input-tag", "mention"], t = ["cascader", "select", "select-v2", "tree-select"], i = ["date-picker", "time-select", "time-picker"];
|
|
195
|
+
return s.includes(e) ? "input" : t.includes(e) ? "select" : i.includes(e) ? "picker" : "other";
|
|
78
196
|
},
|
|
79
197
|
/**
|
|
80
198
|
* 动态生成 placeholder
|
|
81
199
|
*/
|
|
82
|
-
generatePlaceholder(e,
|
|
83
|
-
const { label: t, comp:
|
|
84
|
-
return
|
|
200
|
+
generatePlaceholder(e, s) {
|
|
201
|
+
const { label: t, comp: i } = e, r = t ? `${t}` : "";
|
|
202
|
+
return s === "input" ? i === "input-number" ? "请输入" : `请输入${r}` : ["select", "picker"].includes(s) ? `请选择${r}` : "";
|
|
85
203
|
},
|
|
86
204
|
/**
|
|
87
205
|
* 构建组件属性
|
|
88
206
|
*/
|
|
89
|
-
buildComponentAttrs(e,
|
|
207
|
+
buildComponentAttrs(e, s) {
|
|
90
208
|
const t = {};
|
|
91
|
-
return ["input", "select", "picker"].includes(
|
|
209
|
+
return ["input", "select", "picker"].includes(s) && (t.placeholder = this.generatePlaceholder(e, s), t.clearable = !0), ["select"].includes(s) && (t.filterable = !0), t;
|
|
92
210
|
}
|
|
93
|
-
},
|
|
211
|
+
}, Ct = {
|
|
94
212
|
showMessage: !0,
|
|
95
213
|
scrollToError: !0,
|
|
96
|
-
scrollIntoViewOptions:
|
|
97
|
-
|
|
98
|
-
// 平滑滚动
|
|
99
|
-
block: "center",
|
|
100
|
-
// 垂直居中,让错误项在视窗中间
|
|
101
|
-
inline: "nearest"
|
|
102
|
-
// 水平方向保持最近位置
|
|
103
|
-
}
|
|
104
|
-
}, Ye = {
|
|
105
|
-
search: { label: "搜索", icon: ze, type: "primary" },
|
|
106
|
-
reset: { label: "重置", icon: je },
|
|
107
|
-
submit: { label: "确认", type: "primary" },
|
|
108
|
-
cancel: { label: "取消" }
|
|
109
|
-
}, Je = {
|
|
110
|
-
getDefaults(e, n) {
|
|
111
|
-
return {
|
|
112
|
-
...this.buildActionAttrs(e),
|
|
113
|
-
...n
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
generateActionButtons(e) {
|
|
117
|
-
return e ? ["search", "reset"] : ["submit", "cancel"];
|
|
118
|
-
},
|
|
119
|
-
buildActionAttrs(e) {
|
|
120
|
-
return {
|
|
121
|
-
buttons: this.generateActionButtons(e),
|
|
122
|
-
vIf: e,
|
|
123
|
-
vShow: !0
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}, Qe = /* @__PURE__ */ P({
|
|
214
|
+
scrollIntoViewOptions: ve
|
|
215
|
+
}, yt = /* @__PURE__ */ L({
|
|
127
216
|
name: "ElementPlusKitFormItemAction",
|
|
128
217
|
__name: "FormAction",
|
|
129
218
|
props: {
|
|
130
219
|
inline: { type: Boolean, default: !1 },
|
|
131
220
|
actionSlot: {},
|
|
132
|
-
config: { default: () => ({}) }
|
|
221
|
+
config: { default: () => ({}) },
|
|
222
|
+
expanded: { type: Boolean, default: !1 },
|
|
223
|
+
autoExpandOnHover: { type: Boolean },
|
|
224
|
+
onMouseEnter: {},
|
|
225
|
+
onMouseLeave: {}
|
|
133
226
|
},
|
|
134
227
|
emits: ["action"],
|
|
135
|
-
setup(e) {
|
|
136
|
-
const
|
|
137
|
-
...
|
|
138
|
-
config: { ...
|
|
139
|
-
})),
|
|
140
|
-
const { buttons:
|
|
141
|
-
return
|
|
228
|
+
setup(e, { emit: s }) {
|
|
229
|
+
const t = e, i = s, r = p(() => ({
|
|
230
|
+
...t,
|
|
231
|
+
config: { ...vt.getDefaults(t.inline, t.config) }
|
|
232
|
+
})), g = p(() => {
|
|
233
|
+
const { buttons: f } = r.value.config;
|
|
234
|
+
return f.map((m) => {
|
|
142
235
|
if (typeof m != "string")
|
|
143
236
|
return m;
|
|
144
|
-
const
|
|
145
|
-
return
|
|
237
|
+
const h = dt[m];
|
|
238
|
+
return h ? { ...h, eventName: m } : { label: m.toUpperCase(), eventName: m };
|
|
146
239
|
});
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
|
|
240
|
+
});
|
|
241
|
+
function x(f) {
|
|
242
|
+
return f.eventName === "expand";
|
|
243
|
+
}
|
|
244
|
+
function k(f) {
|
|
245
|
+
const { label: m, eventName: h, ...F } = f;
|
|
246
|
+
if (x(f)) {
|
|
247
|
+
const d = t.expanded ? "收起" : "展开";
|
|
248
|
+
return {
|
|
249
|
+
...F,
|
|
250
|
+
title: d,
|
|
251
|
+
"aria-label": d,
|
|
252
|
+
"aria-expanded": t.expanded
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return F;
|
|
256
|
+
}
|
|
257
|
+
function E(f) {
|
|
258
|
+
const m = f.eventName, h = x(f) ? t.expanded : void 0;
|
|
259
|
+
i("action", { eventName: m, data: h });
|
|
260
|
+
}
|
|
261
|
+
function I(f) {
|
|
262
|
+
x(f) && t.autoExpandOnHover && t.onMouseEnter?.();
|
|
263
|
+
}
|
|
264
|
+
function A(f) {
|
|
265
|
+
x(f) && t.autoExpandOnHover && t.onMouseLeave?.();
|
|
266
|
+
}
|
|
267
|
+
return (f, m) => r.value.config.vIf ? ne((v(), y(S(pe), {
|
|
152
268
|
key: 0,
|
|
153
269
|
prop: "action"
|
|
154
270
|
}, {
|
|
155
|
-
default:
|
|
156
|
-
e.actionSlot ? (
|
|
271
|
+
default: w(() => [
|
|
272
|
+
e.actionSlot ? (v(), y(D(e.actionSlot), {
|
|
157
273
|
key: 1,
|
|
158
274
|
prop: "action"
|
|
159
|
-
})) : (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
275
|
+
})) : (v(), M($, { key: 0 }, [
|
|
276
|
+
(v(!0), M($, null, j(g.value, (h, F) => (v(), y(S(et), _({
|
|
277
|
+
key: `${h.eventName}-${F}`
|
|
278
|
+
}, { ref_for: !0 }, k(h), {
|
|
279
|
+
onMouseenter: (d) => I(h),
|
|
280
|
+
onMouseleave: (d) => A(h),
|
|
281
|
+
onClick: (d) => E(h)
|
|
282
|
+
}), {
|
|
283
|
+
default: w(() => [
|
|
284
|
+
x(h) && e.inline ? (v(), y(S(tt), {
|
|
285
|
+
key: 0,
|
|
286
|
+
class: we(["expand-toggle-icon", { "is-expanded": e.expanded }])
|
|
287
|
+
}, {
|
|
288
|
+
default: w(() => [
|
|
289
|
+
X(S(st))
|
|
290
|
+
]),
|
|
291
|
+
_: 1
|
|
292
|
+
}, 8, ["class"])) : (v(), M($, { key: 1 }, [
|
|
293
|
+
Oe(Se(h.label ?? ""), 1)
|
|
294
|
+
], 64))
|
|
295
|
+
]),
|
|
296
|
+
_: 2
|
|
297
|
+
}, 1040, ["onMouseenter", "onMouseleave", "onClick"]))), 128)),
|
|
298
|
+
ce(f.$slots, "default", {}, void 0, !0)
|
|
299
|
+
], 64))
|
|
169
300
|
]),
|
|
170
|
-
_:
|
|
301
|
+
_: 3
|
|
171
302
|
}, 512)), [
|
|
172
|
-
[
|
|
173
|
-
]) :
|
|
303
|
+
[oe, r.value.config.vShow]
|
|
304
|
+
]) : Ae("", !0);
|
|
174
305
|
}
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*/
|
|
191
|
-
startClearing(l) {
|
|
192
|
-
e = !0, t = l, s = !0;
|
|
193
|
-
},
|
|
194
|
-
/**
|
|
195
|
-
* 结束清理操作(在 nextTick 中调用)
|
|
196
|
-
*/
|
|
197
|
-
endClearing() {
|
|
198
|
-
e = !1, t = null, s = !1;
|
|
199
|
-
},
|
|
200
|
-
/**
|
|
201
|
-
* 开始用户交互
|
|
202
|
-
*/
|
|
203
|
-
startUserInteraction() {
|
|
204
|
-
n = !0;
|
|
205
|
-
},
|
|
206
|
-
/**
|
|
207
|
-
* 结束用户交互(在 nextTick 中调用)
|
|
208
|
-
*/
|
|
209
|
-
endUserInteraction() {
|
|
210
|
-
n = !1;
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* 判断是否是清理操作
|
|
214
|
-
* @param oldValue - 旧值
|
|
215
|
-
* @param newValue - 新值
|
|
216
|
-
* @param isEmpty - 检查值是否为空的函数
|
|
217
|
-
*/
|
|
218
|
-
isClearingOperation(l, d, m) {
|
|
219
|
-
return !!(e || s || !m(l) && m(d) && l === t);
|
|
220
|
-
}
|
|
306
|
+
}), ge = (e, s) => {
|
|
307
|
+
const t = e.__vccOpts || e;
|
|
308
|
+
for (const [i, r] of s)
|
|
309
|
+
t[i] = r;
|
|
310
|
+
return t;
|
|
311
|
+
}, At = /* @__PURE__ */ ge(yt, [["__scopeId", "data-v-dd21a872"]]);
|
|
312
|
+
function wt(e, s) {
|
|
313
|
+
return e ? e.some((t) => typeof t == "string" ? t === s : t.eventName === s) : !1;
|
|
314
|
+
}
|
|
315
|
+
function Ot(e, s = 100) {
|
|
316
|
+
let t = null;
|
|
317
|
+
return function(...i) {
|
|
318
|
+
t && clearTimeout(t), t = setTimeout(() => {
|
|
319
|
+
e.apply(this, i), t = null;
|
|
320
|
+
}, s);
|
|
221
321
|
};
|
|
222
322
|
}
|
|
223
|
-
function
|
|
323
|
+
function he(e, s) {
|
|
224
324
|
if (!e || e.length === 0)
|
|
225
325
|
return [];
|
|
226
326
|
const t = Array.from(new Set(e));
|
|
227
|
-
return
|
|
327
|
+
return s ? t.filter((i) => i !== s) : t;
|
|
228
328
|
}
|
|
229
|
-
function
|
|
230
|
-
const
|
|
231
|
-
for (const
|
|
232
|
-
|
|
233
|
-
return
|
|
329
|
+
function ie(e, s, t) {
|
|
330
|
+
const i = he(e, t), r = {};
|
|
331
|
+
for (const g of i)
|
|
332
|
+
r[g] = s[g];
|
|
333
|
+
return r;
|
|
234
334
|
}
|
|
235
|
-
function
|
|
335
|
+
function ee(e) {
|
|
236
336
|
return e && typeof e == "object" && typeof e.loader == "function";
|
|
237
337
|
}
|
|
238
|
-
function
|
|
338
|
+
function re(e) {
|
|
239
339
|
return e == null || e === "";
|
|
240
340
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
341
|
+
function te(e, s) {
|
|
342
|
+
return s.length === 0 ? !1 : re(e) ? !0 : s.some((t) => (typeof t == "object" && t !== null ? t.value : t) === e);
|
|
343
|
+
}
|
|
344
|
+
function se(e) {
|
|
345
|
+
return e == null ? e : typeof e == "object" ? JSON.parse(JSON.stringify(e)) : e;
|
|
243
346
|
}
|
|
244
|
-
const
|
|
347
|
+
const ue = /* @__PURE__ */ L({
|
|
245
348
|
name: "ElementPlusKitFormItem",
|
|
246
349
|
__name: "FormItem",
|
|
247
|
-
props: /* @__PURE__ */
|
|
350
|
+
props: /* @__PURE__ */ J({
|
|
248
351
|
formItem: {},
|
|
249
352
|
index: {},
|
|
250
353
|
formData: { default: () => ({}) },
|
|
@@ -254,171 +357,174 @@ const et = /* @__PURE__ */ P({
|
|
|
254
357
|
modelValue: {},
|
|
255
358
|
modelModifiers: {}
|
|
256
359
|
}),
|
|
257
|
-
emits: /* @__PURE__ */
|
|
258
|
-
setup(e, { emit:
|
|
259
|
-
const t = e,
|
|
260
|
-
const
|
|
360
|
+
emits: /* @__PURE__ */ J(["change"], ["update:modelValue"]),
|
|
361
|
+
setup(e, { emit: s }) {
|
|
362
|
+
const t = e, i = s, r = fe(e, "modelValue"), g = p(() => {
|
|
363
|
+
const a = new Set(gt);
|
|
261
364
|
return Object.fromEntries(
|
|
262
|
-
Object.entries(t.formItem).filter(([
|
|
365
|
+
Object.entries(t.formItem).filter(([u]) => !a.has(u))
|
|
263
366
|
);
|
|
264
|
-
}),
|
|
265
|
-
Object.entries(t.dynamicCompEvents).map(([
|
|
266
|
-
|
|
267
|
-
(...c) =>
|
|
367
|
+
}), x = p(() => t.formSlots.formItemSlots), k = p(() => It[t.formItem.comp] || "div"), E = p(() => ({ prop: t.formItem.prop, formItem: t.formItem, index: t.index })), I = p(() => Object.fromEntries(
|
|
368
|
+
Object.entries(t.dynamicCompEvents).map(([a, u]) => [
|
|
369
|
+
a,
|
|
370
|
+
(...c) => u(E.value, ...c)
|
|
268
371
|
])
|
|
269
|
-
)),
|
|
270
|
-
function
|
|
271
|
-
if (!
|
|
272
|
-
if (
|
|
372
|
+
)), A = Y([]), f = Y(!1), m = lt();
|
|
373
|
+
function h() {
|
|
374
|
+
if (!re(r.value)) {
|
|
375
|
+
if (m.isClearing)
|
|
273
376
|
return;
|
|
274
|
-
|
|
275
|
-
|
|
377
|
+
m.startClearing(r.value), r.value = void 0, i("change", E.value, void 0), q(() => {
|
|
378
|
+
m.endClearing();
|
|
276
379
|
});
|
|
277
380
|
}
|
|
278
381
|
}
|
|
279
|
-
function
|
|
280
|
-
|
|
281
|
-
|
|
382
|
+
function F(a) {
|
|
383
|
+
m.isClearing || (m.startUserInteraction(), i("change", E.value, a), q(() => {
|
|
384
|
+
m.endUserInteraction();
|
|
282
385
|
}));
|
|
283
386
|
}
|
|
284
|
-
const
|
|
285
|
-
const
|
|
387
|
+
const d = p(() => {
|
|
388
|
+
const a = Et.getDefaults(t.formItem), u = t.formItem.compAttrs ?? {}, c = "options" in u;
|
|
286
389
|
return {
|
|
287
|
-
...
|
|
288
|
-
...
|
|
289
|
-
...
|
|
390
|
+
...a,
|
|
391
|
+
...u,
|
|
392
|
+
...I.value,
|
|
290
393
|
...c && {
|
|
291
|
-
options:
|
|
292
|
-
loading:
|
|
394
|
+
options: A.value,
|
|
395
|
+
loading: f.value
|
|
293
396
|
}
|
|
294
397
|
};
|
|
295
|
-
})
|
|
296
|
-
|
|
398
|
+
});
|
|
399
|
+
function z(a) {
|
|
400
|
+
return t.formSlots.dynamicComponentSlots.get(a);
|
|
401
|
+
}
|
|
402
|
+
async function V(a, u) {
|
|
297
403
|
try {
|
|
298
|
-
const c = await
|
|
404
|
+
const c = await a(u);
|
|
299
405
|
return Array.isArray(c) ? c : [];
|
|
300
406
|
} catch (c) {
|
|
301
407
|
return console.error(`[FormItem] 加载字段 "${t.formItem.prop}" 的选项失败:`, c), [];
|
|
302
408
|
}
|
|
303
409
|
}
|
|
304
|
-
function
|
|
305
|
-
const
|
|
306
|
-
return
|
|
410
|
+
function B() {
|
|
411
|
+
const a = t.formItem.compAttrs?.options;
|
|
412
|
+
return ee(a) ? a : null;
|
|
307
413
|
}
|
|
308
|
-
async function
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
|
|
414
|
+
async function P() {
|
|
415
|
+
const a = t.formItem.compAttrs?.options;
|
|
416
|
+
if (a && !Array.isArray(a)) {
|
|
417
|
+
f.value = !0;
|
|
312
418
|
try {
|
|
313
|
-
if (typeof
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
} else if (
|
|
317
|
-
const { loader:
|
|
318
|
-
|
|
419
|
+
if (typeof a == "function") {
|
|
420
|
+
const u = await V(a, t.formData ?? {});
|
|
421
|
+
A.value = u, te(r.value, u) || h();
|
|
422
|
+
} else if (ee(a)) {
|
|
423
|
+
const { loader: u, deps: c = [] } = a, b = t.formData ?? {}, O = ie(c, b, t.formItem.prop), R = await V(u, { ...b, ...O });
|
|
424
|
+
A.value = R, te(r.value, R) || h();
|
|
319
425
|
}
|
|
320
426
|
} finally {
|
|
321
|
-
|
|
427
|
+
f.value = !1;
|
|
322
428
|
}
|
|
323
429
|
}
|
|
324
430
|
}
|
|
325
|
-
function
|
|
326
|
-
|
|
431
|
+
function H(a) {
|
|
432
|
+
A.value = a, te(r.value, a) || h();
|
|
327
433
|
}
|
|
328
|
-
function
|
|
329
|
-
|
|
434
|
+
function G() {
|
|
435
|
+
P();
|
|
330
436
|
}
|
|
331
|
-
function
|
|
332
|
-
const { immediate:
|
|
437
|
+
function W(a) {
|
|
438
|
+
const { immediate: u = !1, deps: c = [], loader: b } = a;
|
|
333
439
|
if (c.length > 0) {
|
|
334
|
-
const
|
|
440
|
+
const O = t.formData ?? {}, R = ie(c, O, t.formItem.prop);
|
|
335
441
|
try {
|
|
336
|
-
|
|
442
|
+
b({ ...O, ...R });
|
|
337
443
|
} catch {
|
|
338
444
|
}
|
|
339
|
-
|
|
445
|
+
u && P();
|
|
340
446
|
return;
|
|
341
447
|
}
|
|
342
|
-
|
|
448
|
+
u && P();
|
|
343
449
|
}
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
}),
|
|
348
|
-
const
|
|
349
|
-
return
|
|
450
|
+
const K = p(() => {
|
|
451
|
+
const a = B();
|
|
452
|
+
return a ? he(a.deps ?? [], t.formItem.prop) : [];
|
|
453
|
+
}), N = p(() => {
|
|
454
|
+
const a = B();
|
|
455
|
+
return a ? a.immediate ?? !1 : !1;
|
|
350
456
|
});
|
|
351
|
-
return
|
|
457
|
+
return Q(
|
|
352
458
|
() => {
|
|
353
|
-
const
|
|
354
|
-
for (const c of
|
|
355
|
-
|
|
356
|
-
return
|
|
459
|
+
const a = K.value, u = {};
|
|
460
|
+
for (const c of a)
|
|
461
|
+
u[c] = t.formData?.[c];
|
|
462
|
+
return u;
|
|
357
463
|
},
|
|
358
464
|
() => {
|
|
359
|
-
|
|
465
|
+
B() && P();
|
|
360
466
|
},
|
|
361
|
-
{ deep: !0, immediate:
|
|
362
|
-
),
|
|
363
|
-
const
|
|
364
|
-
if (
|
|
365
|
-
if (Array.isArray(
|
|
366
|
-
|
|
467
|
+
{ deep: !0, immediate: N.value }
|
|
468
|
+
), be(() => {
|
|
469
|
+
const a = t.formItem.compAttrs?.options;
|
|
470
|
+
if (a) {
|
|
471
|
+
if (Array.isArray(a)) {
|
|
472
|
+
H(a);
|
|
367
473
|
return;
|
|
368
474
|
}
|
|
369
|
-
if (typeof
|
|
370
|
-
|
|
475
|
+
if (typeof a == "function") {
|
|
476
|
+
G();
|
|
371
477
|
return;
|
|
372
478
|
}
|
|
373
|
-
|
|
479
|
+
ee(a) && W(a);
|
|
374
480
|
}
|
|
375
|
-
}),
|
|
376
|
-
() =>
|
|
377
|
-
(
|
|
378
|
-
|
|
481
|
+
}), Q(
|
|
482
|
+
() => r.value,
|
|
483
|
+
(a, u) => {
|
|
484
|
+
m.isClearingOperation(u, a, re) || m.isUserInteraction || a !== u && i("change", E.value, a);
|
|
379
485
|
}
|
|
380
|
-
), (
|
|
381
|
-
default:
|
|
382
|
-
e.formItem.comp !== "custom" ? (
|
|
383
|
-
modelValue:
|
|
384
|
-
"onUpdate:modelValue":
|
|
385
|
-
onChange:
|
|
386
|
-
}),
|
|
387
|
-
|
|
486
|
+
), (a, u) => (v(), y(S(pe), me(de(g.value)), le({
|
|
487
|
+
default: w(() => [
|
|
488
|
+
e.formItem.comp !== "custom" ? (v(), y(D(k.value), _({ key: 0 }, d.value, {
|
|
489
|
+
modelValue: r.value,
|
|
490
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => r.value = c),
|
|
491
|
+
onChange: F
|
|
492
|
+
}), le({ _: 2 }, [
|
|
493
|
+
j(z(e.formItem.prop) ?? [], (c, b) => ({
|
|
388
494
|
name: c.slotName,
|
|
389
|
-
fn:
|
|
390
|
-
(
|
|
391
|
-
value:
|
|
495
|
+
fn: w((O) => [
|
|
496
|
+
(v(), y(D(c.slotFn), _({
|
|
497
|
+
value: r.value,
|
|
392
498
|
form: e.formData,
|
|
393
499
|
"form-item": e.formItem
|
|
394
|
-
},
|
|
500
|
+
}, O), null, 16, ["value", "form", "form-item"]))
|
|
395
501
|
])
|
|
396
502
|
}))
|
|
397
|
-
]), 1040, ["modelValue"])) :
|
|
503
|
+
]), 1040, ["modelValue"])) : ce(a.$slots, e.formItem.prop, {
|
|
398
504
|
key: 1,
|
|
399
|
-
value:
|
|
505
|
+
value: r.value,
|
|
400
506
|
form: e.formData,
|
|
401
507
|
formItem: e.formItem
|
|
402
508
|
})
|
|
403
509
|
]),
|
|
404
510
|
_: 2
|
|
405
511
|
}, [
|
|
406
|
-
|
|
512
|
+
j(x.value, (c, b) => ({
|
|
407
513
|
name: c.slotName,
|
|
408
|
-
fn:
|
|
409
|
-
(
|
|
410
|
-
value:
|
|
514
|
+
fn: w((O) => [
|
|
515
|
+
(v(), y(D(c.slotFn), _({
|
|
516
|
+
value: r.value,
|
|
411
517
|
form: e.formData,
|
|
412
518
|
"form-item": e.formItem
|
|
413
|
-
},
|
|
519
|
+
}, O), null, 16, ["value", "form", "form-item"]))
|
|
414
520
|
])
|
|
415
521
|
}))
|
|
416
522
|
]), 1040));
|
|
417
523
|
}
|
|
418
|
-
}),
|
|
524
|
+
}), St = /* @__PURE__ */ L({
|
|
419
525
|
name: "WForm",
|
|
420
526
|
__name: "Form",
|
|
421
|
-
props: {
|
|
527
|
+
props: /* @__PURE__ */ J({
|
|
422
528
|
formItems: {},
|
|
423
529
|
rowAttrs: { default: () => ({}) },
|
|
424
530
|
actionConfig: { default: () => ({}) },
|
|
@@ -437,99 +543,223 @@ const et = /* @__PURE__ */ P({
|
|
|
437
543
|
validateOnRuleChange: { type: Boolean },
|
|
438
544
|
scrollToError: { type: Boolean },
|
|
439
545
|
scrollIntoViewOptions: {}
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
546
|
+
}, {
|
|
547
|
+
expanded: { type: Boolean, default: !1 },
|
|
548
|
+
expandedModifiers: {}
|
|
549
|
+
}),
|
|
550
|
+
emits: /* @__PURE__ */ J(["validate", "change", "action", "search", "reset", "submit", "cancel", "expand"], ["update:expanded"]),
|
|
551
|
+
setup(e, { expose: s, emit: t }) {
|
|
552
|
+
const i = e, r = t, g = Te();
|
|
553
|
+
function x(n, o) {
|
|
554
|
+
return n.startsWith("on") && typeof o == "function";
|
|
446
555
|
}
|
|
447
|
-
const
|
|
448
|
-
Object.entries(
|
|
449
|
-
)),
|
|
450
|
-
const { formItems:
|
|
451
|
-
Object.entries(
|
|
556
|
+
const k = p(() => Object.fromEntries(
|
|
557
|
+
Object.entries(g).filter(([n, o]) => x(n, o))
|
|
558
|
+
)), E = p(() => {
|
|
559
|
+
const { formItems: n, actionConfig: o, rowAttrs: l, ...C } = i, T = Object.fromEntries(
|
|
560
|
+
Object.entries(g).filter(([U, Ce]) => !x(U, Ce))
|
|
452
561
|
);
|
|
453
|
-
return { ...C, ...
|
|
454
|
-
}),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
562
|
+
return { ...C, ...Ct, ...T };
|
|
563
|
+
}), I = fe(e, "expanded");
|
|
564
|
+
Q(
|
|
565
|
+
I,
|
|
566
|
+
(n) => {
|
|
567
|
+
r("expand", n);
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
const A = p(() => E.value.inline ? wt(i.actionConfig?.buttons, "expand") : !1), f = p(() => {
|
|
571
|
+
if (!A.value)
|
|
572
|
+
return !1;
|
|
573
|
+
const n = i.actionConfig?.expand;
|
|
574
|
+
return n ? n.autoExpandOnHover === !0 : !1;
|
|
575
|
+
}), { onMouseEnter: m, onMouseLeave: h, recordManualToggle: F } = at(
|
|
576
|
+
I,
|
|
577
|
+
f,
|
|
578
|
+
(n) => {
|
|
579
|
+
I.value = n;
|
|
580
|
+
}
|
|
581
|
+
), d = Y();
|
|
582
|
+
function z(n) {
|
|
583
|
+
const o = n ?? !I.value;
|
|
584
|
+
I.value = o, F();
|
|
585
|
+
const l = i.actionConfig?.expand;
|
|
586
|
+
l?.scrollOnToggle && q(() => {
|
|
587
|
+
setTimeout(() => d.value?.$el?.scrollIntoView?.(l.scrollIntoViewOptions ?? pt), 250);
|
|
459
588
|
});
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
589
|
+
}
|
|
590
|
+
const V = p(() => {
|
|
591
|
+
const { span: n } = i.rowAttrs;
|
|
592
|
+
return i.formItems.filter((o) => Z({ condition: o.vIf, data: i.model, defaultValue: !0 })).map((o) => {
|
|
593
|
+
const { colAttrs: l = {} } = o ?? {};
|
|
594
|
+
return { ...o, colAttrs: { ...l, span: l.span ?? n } };
|
|
595
|
+
});
|
|
596
|
+
}), B = p(() => V.value.map((n, o) => ({ ...n, _originalIndex: o })).filter((n) => {
|
|
597
|
+
const o = n._originalIndex;
|
|
598
|
+
return A.value ? !P(n, o) : !0;
|
|
599
|
+
}));
|
|
600
|
+
function P(n, o) {
|
|
601
|
+
if (!A.value || I.value)
|
|
602
|
+
return !1;
|
|
603
|
+
const l = i.actionConfig?.expand;
|
|
604
|
+
return l ? !!("exclude" in l && l.exclude.length > 0 && l.exclude.includes(n.prop) || "include" in l && l.include.length > 0 && !l.include.includes(n.prop) || "count" in l && o >= l.count) : !1;
|
|
605
|
+
}
|
|
606
|
+
const H = ke();
|
|
607
|
+
function G(n) {
|
|
608
|
+
return Object.keys(H).filter((o) => o.startsWith(n)).map((o) => ({
|
|
609
|
+
rawSlotName: o,
|
|
610
|
+
slotName: o.replace(n, ""),
|
|
611
|
+
slotFn: H[o]
|
|
466
612
|
}));
|
|
467
613
|
}
|
|
468
|
-
const
|
|
469
|
-
const
|
|
470
|
-
for (const
|
|
471
|
-
const C =
|
|
472
|
-
C.length > 0 &&
|
|
614
|
+
const W = p(() => {
|
|
615
|
+
const n = G("form-item-"), o = /* @__PURE__ */ new Map();
|
|
616
|
+
for (const l of V.value) {
|
|
617
|
+
const C = G(`${l.prop}-`);
|
|
618
|
+
C.length > 0 && o.set(l.prop, C);
|
|
619
|
+
}
|
|
620
|
+
return { formItemSlots: n, dynamicComponentSlots: o };
|
|
621
|
+
}), K = p(() => Object.keys(i.rowAttrs ?? {}).length > 0), N = p(() => ({
|
|
622
|
+
row: E.value.inline || K.value ? ot : "div",
|
|
623
|
+
col: K.value ? nt : "div"
|
|
624
|
+
})), a = p(() => i.formItems.map((n) => n.prop)), u = p(() => {
|
|
625
|
+
if (!A.value)
|
|
626
|
+
return [];
|
|
627
|
+
const n = i.actionConfig?.expand;
|
|
628
|
+
return n ? V.value.map((o, l) => ({ field: o, index: l })).filter(({ field: o, index: l }) => !!("exclude" in n && n.exclude.includes(o.prop) || "include" in n && !n.include.includes(o.prop) || "count" in n && l >= n.count)).map(({ field: o }) => o.prop) : [];
|
|
629
|
+
}), c = Y({});
|
|
630
|
+
function b() {
|
|
631
|
+
c.value = {};
|
|
632
|
+
for (const n of u.value) {
|
|
633
|
+
const o = i.model[n];
|
|
634
|
+
c.value[n] = se(o);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const O = Ot(b, 100);
|
|
638
|
+
function R() {
|
|
639
|
+
const n = {};
|
|
640
|
+
for (const o of u.value) {
|
|
641
|
+
const l = c.value[o];
|
|
642
|
+
n[o] = l != null ? se(l) : void 0;
|
|
473
643
|
}
|
|
474
|
-
return
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const a = ["submit", "search"], u = ["cancel", "reset"];
|
|
481
|
-
if (![...a, ...u].includes(r))
|
|
482
|
-
return l("action", r);
|
|
483
|
-
a.includes(r) && await h.value?.validate?.(), u.includes(r) && h.value?.resetFields?.(), l(r), l("action", r);
|
|
644
|
+
return n;
|
|
645
|
+
}
|
|
646
|
+
function xe() {
|
|
647
|
+
d.value?.clearValidate?.(u.value);
|
|
648
|
+
const n = a.value.filter((o) => !u.value.includes(o));
|
|
649
|
+
n.length > 0 && d.value?.resetFields?.(n);
|
|
484
650
|
}
|
|
485
|
-
|
|
651
|
+
async function Ie({ eventName: n }) {
|
|
652
|
+
const o = ["submit", "search"], l = ["cancel", "reset"];
|
|
653
|
+
if (n === "expand") {
|
|
654
|
+
z(), r("action", n, I.value);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (o.includes(n) && await d.value?.validate?.(), l.includes(n)) {
|
|
658
|
+
if (n === "reset") {
|
|
659
|
+
const C = R();
|
|
660
|
+
xe(), r("reset", C), r("action", n, C);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
d.value?.resetFields?.();
|
|
664
|
+
}
|
|
665
|
+
r(n), r("action", n);
|
|
666
|
+
}
|
|
667
|
+
function Ee(n, o, l) {
|
|
668
|
+
r("validate", n, o, l);
|
|
669
|
+
}
|
|
670
|
+
return s({
|
|
486
671
|
// element-plus form exposes
|
|
487
672
|
get fields() {
|
|
488
|
-
return
|
|
673
|
+
return d.value?.fields;
|
|
489
674
|
},
|
|
490
|
-
getField: (
|
|
491
|
-
validate: () =>
|
|
492
|
-
validateField: (
|
|
493
|
-
resetFields: (
|
|
494
|
-
clearValidate: (
|
|
495
|
-
scrollToField: (
|
|
496
|
-
|
|
675
|
+
getField: (n) => d.value?.getField?.(n),
|
|
676
|
+
validate: () => d.value?.validate?.(),
|
|
677
|
+
validateField: (n) => d.value?.validateField?.(n),
|
|
678
|
+
resetFields: (n) => d.value?.resetFields?.(n),
|
|
679
|
+
clearValidate: (n) => d.value?.clearValidate?.(n),
|
|
680
|
+
scrollToField: (n) => d.value?.scrollToField?.(n),
|
|
681
|
+
// 展开/折叠控制方法
|
|
682
|
+
get expanded() {
|
|
683
|
+
return I.value;
|
|
684
|
+
},
|
|
685
|
+
toggleExpand: z
|
|
686
|
+
}), Fe(() => {
|
|
687
|
+
b();
|
|
688
|
+
}), Q(
|
|
689
|
+
[() => i.formItems, () => i.actionConfig?.expand],
|
|
690
|
+
() => {
|
|
691
|
+
O();
|
|
692
|
+
},
|
|
693
|
+
{ deep: !0 }
|
|
694
|
+
), (n, o) => (v(), y(S(rt), _({
|
|
497
695
|
ref_key: "formRef",
|
|
498
|
-
ref:
|
|
499
|
-
},
|
|
696
|
+
ref: d
|
|
697
|
+
}, E.value, {
|
|
500
698
|
model: e.model,
|
|
501
|
-
onValidate:
|
|
502
|
-
onSubmit:
|
|
699
|
+
onValidate: Ee,
|
|
700
|
+
onSubmit: o[2] || (o[2] = Me(() => {
|
|
503
701
|
}, ["prevent"]))
|
|
504
702
|
}), {
|
|
505
|
-
default:
|
|
506
|
-
(
|
|
507
|
-
default:
|
|
508
|
-
|
|
509
|
-
key:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
703
|
+
default: w(() => [
|
|
704
|
+
(v(), y(D(N.value.row), me(de(e.rowAttrs)), {
|
|
705
|
+
default: w(() => [
|
|
706
|
+
A.value ? (v(), y(_e, {
|
|
707
|
+
key: 0,
|
|
708
|
+
name: "form-item",
|
|
709
|
+
tag: "div",
|
|
710
|
+
class: "form-items-transition"
|
|
711
|
+
}, {
|
|
712
|
+
default: w(() => [
|
|
713
|
+
(v(!0), M($, null, j(B.value, (l, C) => ne((v(), y(D(N.value.col), _({
|
|
714
|
+
key: `${l.prop}-${l._originalIndex ?? C}`
|
|
715
|
+
}, { ref_for: !0 }, l.colAttrs), {
|
|
716
|
+
default: w(() => [
|
|
717
|
+
X(ue, {
|
|
718
|
+
modelValue: e.model[l.prop],
|
|
719
|
+
"onUpdate:modelValue": (T) => e.model[l.prop] = T,
|
|
720
|
+
"form-item": l,
|
|
721
|
+
"form-data": e.model,
|
|
722
|
+
"dynamic-comp-events": k.value,
|
|
723
|
+
"form-slots": W.value,
|
|
724
|
+
index: l._originalIndex ?? C,
|
|
725
|
+
onChange: o[0] || (o[0] = (T, U) => r("change", T, U))
|
|
726
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "form-item", "form-data", "dynamic-comp-events", "form-slots", "index"])
|
|
727
|
+
]),
|
|
728
|
+
_: 2
|
|
729
|
+
}, 1040)), [
|
|
730
|
+
[oe, S(Z)({ condition: l.vShow, data: i.model, defaultValue: !0 })]
|
|
731
|
+
])), 128))
|
|
732
|
+
]),
|
|
733
|
+
_: 1
|
|
734
|
+
})) : (v(!0), M($, { key: 1 }, j(B.value, (l, C) => ne((v(), y(D(N.value.col), _({
|
|
735
|
+
key: `${l.prop}-${l._originalIndex ?? C}`
|
|
736
|
+
}, { ref_for: !0 }, l.colAttrs), {
|
|
737
|
+
default: w(() => [
|
|
738
|
+
X(ue, {
|
|
739
|
+
modelValue: e.model[l.prop],
|
|
740
|
+
"onUpdate:modelValue": (T) => e.model[l.prop] = T,
|
|
741
|
+
"form-item": l,
|
|
516
742
|
"form-data": e.model,
|
|
517
|
-
"dynamic-comp-events":
|
|
518
|
-
"form-slots":
|
|
519
|
-
index: C,
|
|
520
|
-
onChange:
|
|
743
|
+
"dynamic-comp-events": k.value,
|
|
744
|
+
"form-slots": W.value,
|
|
745
|
+
index: l._originalIndex ?? C,
|
|
746
|
+
onChange: o[1] || (o[1] = (T, U) => r("change", T, U))
|
|
521
747
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "form-item", "form-data", "dynamic-comp-events", "form-slots", "index"])
|
|
522
748
|
]),
|
|
523
749
|
_: 2
|
|
524
750
|
}, 1040)), [
|
|
525
|
-
[
|
|
751
|
+
[oe, S(Z)({ condition: l.vShow, data: i.model, defaultValue: !0 })]
|
|
526
752
|
])), 128)),
|
|
527
|
-
|
|
528
|
-
inline:
|
|
529
|
-
"action-slot":
|
|
753
|
+
X(At, {
|
|
754
|
+
inline: E.value.inline,
|
|
755
|
+
"action-slot": n.$slots.action,
|
|
530
756
|
config: e.actionConfig,
|
|
531
|
-
|
|
532
|
-
|
|
757
|
+
expanded: I.value,
|
|
758
|
+
"auto-expand-on-hover": f.value,
|
|
759
|
+
"on-mouse-enter": S(m),
|
|
760
|
+
"on-mouse-leave": S(h),
|
|
761
|
+
onAction: Ie
|
|
762
|
+
}, null, 8, ["inline", "action-slot", "config", "expanded", "auto-expand-on-hover", "on-mouse-enter", "on-mouse-leave"])
|
|
533
763
|
]),
|
|
534
764
|
_: 1
|
|
535
765
|
}, 16))
|
|
@@ -537,8 +767,8 @@ const et = /* @__PURE__ */ P({
|
|
|
537
767
|
_: 1
|
|
538
768
|
}, 16, ["model"]));
|
|
539
769
|
}
|
|
540
|
-
});
|
|
770
|
+
}), Ft = /* @__PURE__ */ ge(St, [["__scopeId", "data-v-b241f6ca"]]);
|
|
541
771
|
export {
|
|
542
|
-
|
|
543
|
-
|
|
772
|
+
Ft as WForm,
|
|
773
|
+
Ft as default
|
|
544
774
|
};
|