@aspire-ui/element-component-pro 1.0.0 → 1.0.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const de = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as W, useSlots as te, computed as w, h as ce, ref as g, onMounted as fe, onUnmounted as ue, watch as oe, unref as ee } from "vue";
|
|
2
|
+
const de = /* @__PURE__ */ W({
|
|
3
3
|
__name: "ProFormItem",
|
|
4
4
|
props: {
|
|
5
5
|
schema: null,
|
|
@@ -28,7 +28,7 @@ const de = /* @__PURE__ */ D({
|
|
|
28
28
|
}), C = w(() => {
|
|
29
29
|
const c = e.schema.dynamicRules;
|
|
30
30
|
return c ? Array.isArray(c) ? c : c(t.value) : e.schema.rules;
|
|
31
|
-
}),
|
|
31
|
+
}), p = w(() => {
|
|
32
32
|
const c = e.schema.componentProps;
|
|
33
33
|
if (!c)
|
|
34
34
|
return { props: {}, listeners: {} };
|
|
@@ -36,17 +36,17 @@ const de = /* @__PURE__ */ D({
|
|
|
36
36
|
...t.value,
|
|
37
37
|
formActionType: e.formActionType
|
|
38
38
|
}) : { ...c }, R = {}, S = {};
|
|
39
|
-
for (const [n,
|
|
40
|
-
if (n.length > 2 && /^on[A-Za-z]/.test(n) && typeof
|
|
39
|
+
for (const [n, u] of Object.entries(d))
|
|
40
|
+
if (n.length > 2 && /^on[A-Za-z]/.test(n) && typeof u == "function") {
|
|
41
41
|
const x = n.slice(2).charAt(0).toLowerCase() + n.slice(3);
|
|
42
|
-
S[x] =
|
|
42
|
+
S[x] = u;
|
|
43
43
|
} else
|
|
44
|
-
R[n] =
|
|
44
|
+
R[n] = u;
|
|
45
45
|
return { props: R, listeners: S };
|
|
46
|
-
}), m = w(() =>
|
|
46
|
+
}), m = w(() => p.value.props), M = w(() => p.value.listeners), v = w(() => !!l.default), y = (c) => {
|
|
47
47
|
const d = c == null ? void 0 : c.options;
|
|
48
48
|
return Array.isArray(d) ? d : void 0;
|
|
49
|
-
},
|
|
49
|
+
}, F = w(() => {
|
|
50
50
|
const c = e.schema.render;
|
|
51
51
|
return c ? {
|
|
52
52
|
render() {
|
|
@@ -55,36 +55,36 @@ const de = /* @__PURE__ */ D({
|
|
|
55
55
|
}
|
|
56
56
|
} : null;
|
|
57
57
|
});
|
|
58
|
-
return { __sfc: !0, props: e, slots: l, renderParams: t, shouldRender: s, shouldShow: b, effectiveDisabled: P, effectiveRules: C, effectiveComponentPropsAndListeners:
|
|
58
|
+
return { __sfc: !0, props: e, slots: l, renderParams: t, shouldRender: s, shouldShow: b, effectiveDisabled: P, effectiveRules: C, effectiveComponentPropsAndListeners: p, effectiveComponentProps: m, effectiveComponentListeners: M, hasSlot: v, getOptions: y, renderComponent: F };
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
function
|
|
62
|
-
var
|
|
63
|
-
e && (
|
|
61
|
+
function z(_, e, l, t, s, b, P, C) {
|
|
62
|
+
var p = typeof _ == "function" ? _.options : _;
|
|
63
|
+
e && (p.render = e, p.staticRenderFns = l, p._compiled = !0), t && (p.functional = !0), b && (p._scopeId = "data-v-" + b);
|
|
64
64
|
var m;
|
|
65
65
|
if (P ? (m = function(y) {
|
|
66
66
|
y = y || // cached call
|
|
67
67
|
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
68
68
|
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !y && typeof __VUE_SSR_CONTEXT__ < "u" && (y = __VUE_SSR_CONTEXT__), s && s.call(this, y), y && y._registeredComponents && y._registeredComponents.add(P);
|
|
69
|
-
},
|
|
69
|
+
}, p._ssrRegister = m) : s && (m = C ? function() {
|
|
70
70
|
s.call(
|
|
71
71
|
this,
|
|
72
|
-
(
|
|
72
|
+
(p.functional ? this.parent : this).$root.$options.shadowRoot
|
|
73
73
|
);
|
|
74
74
|
} : s), m)
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
var M =
|
|
78
|
-
|
|
79
|
-
return m.call(c), M(
|
|
75
|
+
if (p.functional) {
|
|
76
|
+
p._injectStyles = m;
|
|
77
|
+
var M = p.render;
|
|
78
|
+
p.render = function(F, c) {
|
|
79
|
+
return m.call(c), M(F, c);
|
|
80
80
|
};
|
|
81
81
|
} else {
|
|
82
|
-
var
|
|
83
|
-
|
|
82
|
+
var v = p.beforeCreate;
|
|
83
|
+
p.beforeCreate = v ? [].concat(v, m) : [m];
|
|
84
84
|
}
|
|
85
85
|
return {
|
|
86
86
|
exports: _,
|
|
87
|
-
options:
|
|
87
|
+
options: p
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
var me = function() {
|
|
@@ -116,17 +116,17 @@ var me = function() {
|
|
|
116
116
|
}, expression: "formModel[schema.field]" } }, "el-radio-group", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(s) {
|
|
117
117
|
return l("el-radio", { key: String(s.value), attrs: { label: s.value } }, [e._v(" " + e._s(s.label) + " ")]);
|
|
118
118
|
}), 1) : e._e()]], 2) : e._e();
|
|
119
|
-
}, pe = [], ve = /* @__PURE__ */
|
|
119
|
+
}, pe = [], ve = /* @__PURE__ */ z(
|
|
120
120
|
de,
|
|
121
121
|
me,
|
|
122
122
|
pe,
|
|
123
123
|
!1,
|
|
124
124
|
null,
|
|
125
|
-
"
|
|
125
|
+
"cfc968c5",
|
|
126
126
|
null,
|
|
127
127
|
null
|
|
128
128
|
);
|
|
129
|
-
const se = ve.exports, he = /* @__PURE__ */
|
|
129
|
+
const se = ve.exports, he = /* @__PURE__ */ W({
|
|
130
130
|
__name: "FormActions",
|
|
131
131
|
props: {
|
|
132
132
|
showActionButtonGroup: { type: Boolean, default: !0 },
|
|
@@ -154,7 +154,7 @@ var _e = function() {
|
|
|
154
154
|
} } }, [e._v(" " + e._s(e.submitButtonText) + " ")]) : e._e(), e._t("resetBefore"), e.showResetButton ? l("el-button", { attrs: { icon: e.resetButtonIcon }, on: { click: function(t) {
|
|
155
155
|
return e.$emit("reset");
|
|
156
156
|
} } }, [e._v(" " + e._s(e.resetButtonText) + " ")]) : e._e(), e._t("actions")], 2);
|
|
157
|
-
}, be = [], ye = /* @__PURE__ */
|
|
157
|
+
}, be = [], ye = /* @__PURE__ */ z(
|
|
158
158
|
he,
|
|
159
159
|
_e,
|
|
160
160
|
be,
|
|
@@ -164,7 +164,7 @@ var _e = function() {
|
|
|
164
164
|
null,
|
|
165
165
|
null
|
|
166
166
|
);
|
|
167
|
-
const le = ye.exports, we = /* @__PURE__ */
|
|
167
|
+
const le = ye.exports, we = /* @__PURE__ */ W({
|
|
168
168
|
__name: "ProForm",
|
|
169
169
|
props: {
|
|
170
170
|
schemas: null,
|
|
@@ -195,117 +195,117 @@ const le = ye.exports, we = /* @__PURE__ */ D({
|
|
|
195
195
|
},
|
|
196
196
|
emits: ["submit", "reset", "register"],
|
|
197
197
|
setup(_, { expose: e, emit: l }) {
|
|
198
|
-
const t = _, s = te(), b =
|
|
199
|
-
const i =
|
|
200
|
-
return i >=
|
|
201
|
-
}, d = w(() => ({ ...t, ...y.value })), R = w(() => d.value.actionColOptions ?? { span: 24 }), S =
|
|
202
|
-
let
|
|
198
|
+
const t = _, s = te(), b = g(), P = g(), C = g(!1), p = g(!0), m = g({}), M = g({}), v = g([]), y = g({}), F = { xl: 1920, lg: 1200, md: 992, sm: 768 }, c = (o, a, f) => {
|
|
199
|
+
const i = f ?? (typeof window < "u" ? window.innerWidth : 1920), r = o ?? {}, h = a ?? {}, B = h.span ?? 8;
|
|
200
|
+
return i >= F.xl ? r.xl ?? h.xl ?? r.lg ?? h.lg ?? r.md ?? h.md ?? r.sm ?? h.sm ?? r.xs ?? h.xs ?? r.span ?? B : i >= F.lg ? r.lg ?? h.lg ?? r.md ?? h.md ?? r.sm ?? h.sm ?? r.xs ?? h.xs ?? r.span ?? B : i >= F.md ? r.md ?? h.md ?? r.sm ?? h.sm ?? r.xs ?? h.xs ?? r.span ?? B : i >= F.sm ? r.sm ?? h.sm ?? r.xs ?? h.xs ?? r.span ?? B : r.xs ?? h.xs ?? r.span ?? B;
|
|
201
|
+
}, d = w(() => ({ ...t, ...y.value })), R = w(() => d.value.actionColOptions ?? { span: 24 }), S = g(typeof window < "u" ? window.innerWidth : 1920), n = (o, a, f, i) => {
|
|
202
|
+
let r = 24, h = 1, B = 0;
|
|
203
203
|
for (const $ of o) {
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
204
|
+
const D = c($.colProps, a, i);
|
|
205
|
+
if (D > r) {
|
|
206
|
+
if (h++, h > f)
|
|
207
207
|
break;
|
|
208
|
-
|
|
208
|
+
r = 24 - D;
|
|
209
209
|
} else
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
r -= D;
|
|
211
|
+
B++;
|
|
212
212
|
}
|
|
213
|
-
return
|
|
214
|
-
},
|
|
215
|
-
const o =
|
|
213
|
+
return B;
|
|
214
|
+
}, u = w(() => {
|
|
215
|
+
const o = v.value.filter((r) => T(r));
|
|
216
216
|
if (!d.value.showAdvancedButton)
|
|
217
217
|
return !1;
|
|
218
|
-
const
|
|
218
|
+
const a = d.value.alwaysShowLines ?? 1, f = d.value.baseColProps, i = n(o, f, a, S.value);
|
|
219
219
|
return console.log(o.length, i), o.length > i;
|
|
220
220
|
}), x = w(() => d.value.formListeners ?? {}), k = w(() => {
|
|
221
|
-
const o =
|
|
222
|
-
if (!d.value.showAdvancedButton || !
|
|
221
|
+
const o = v.value.filter((r) => T(r));
|
|
222
|
+
if (!d.value.showAdvancedButton || !p.value)
|
|
223
223
|
return o;
|
|
224
|
-
const
|
|
224
|
+
const a = d.value.alwaysShowLines ?? 1, f = d.value.baseColProps, i = n(o, f, a, S.value);
|
|
225
225
|
return o.slice(0, i);
|
|
226
|
-
}),
|
|
227
|
-
let
|
|
228
|
-
return typeof o.ifShow == "function" && (
|
|
226
|
+
}), T = (o) => {
|
|
227
|
+
let a = !0, f = !0;
|
|
228
|
+
return typeof o.ifShow == "function" && (a = o.ifShow({ schema: o, values: m.value, model: m.value, field: o.field })), typeof o.ifShow == "boolean" && (a = o.ifShow), typeof o.show == "function" && (f = o.show({ schema: o, values: m.value, model: m.value, field: o.field })), typeof o.show == "boolean" && (f = o.show), a && f;
|
|
229
229
|
}, ae = (o) => o.colProps ?? d.value.baseColProps ?? {}, re = (o) => o.slot || o.field, A = () => {
|
|
230
|
-
const o = {},
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
o[i.field] = i.defaultValue ?? (
|
|
234
|
-
}), m.value = { ...m.value, ...o }, M.value =
|
|
230
|
+
const o = {}, a = {}, f = d.value.initialValues ?? t.initialValues;
|
|
231
|
+
v.value.forEach((i) => {
|
|
232
|
+
var r;
|
|
233
|
+
o[i.field] = i.defaultValue ?? (f == null ? void 0 : f[i.field]), (r = i.rules) != null && r.length && (a[i.field] = i.rules);
|
|
234
|
+
}), m.value = { ...m.value, ...o }, M.value = a;
|
|
235
235
|
}, N = (o) => {
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
const i =
|
|
236
|
+
const a = { ...o };
|
|
237
|
+
return v.value.forEach((f) => {
|
|
238
|
+
const i = f.ifShow;
|
|
239
239
|
if (i === void 0)
|
|
240
240
|
return;
|
|
241
|
-
(typeof i == "boolean" ? i : i({ schema:
|
|
242
|
-
}),
|
|
243
|
-
},
|
|
244
|
-
const
|
|
245
|
-
if (!(
|
|
246
|
-
return
|
|
247
|
-
const i = { ...
|
|
248
|
-
return
|
|
249
|
-
const $ = i[
|
|
250
|
-
Array.isArray($) && $.length === 2 && (delete i[
|
|
241
|
+
(typeof i == "boolean" ? i : i({ schema: f, values: o, model: o, field: f.field })) || delete a[f.field];
|
|
242
|
+
}), a;
|
|
243
|
+
}, V = (o) => {
|
|
244
|
+
const a = N(o), f = y.value.fieldMapToTime;
|
|
245
|
+
if (!(f != null && f.length))
|
|
246
|
+
return a;
|
|
247
|
+
const i = { ...a };
|
|
248
|
+
return f.forEach(([r, [h, B]]) => {
|
|
249
|
+
const $ = i[r];
|
|
250
|
+
Array.isArray($) && $.length === 2 && (delete i[r], i[h] = $[0], i[B] = $[1]);
|
|
251
251
|
}), i;
|
|
252
|
-
},
|
|
252
|
+
}, L = async () => {
|
|
253
253
|
var o;
|
|
254
254
|
try {
|
|
255
|
-
await ((o = b.value) == null ? void 0 : o.validate()), d.value.submitFunc ? await d.value.submitFunc() : (C.value = !0, l("submit",
|
|
256
|
-
} catch (
|
|
257
|
-
console.error("Form validation failed:",
|
|
255
|
+
await ((o = b.value) == null ? void 0 : o.validate()), d.value.submitFunc ? await d.value.submitFunc() : (C.value = !0, l("submit", V({ ...m.value })));
|
|
256
|
+
} catch (a) {
|
|
257
|
+
console.error("Form validation failed:", a);
|
|
258
258
|
} finally {
|
|
259
259
|
C.value = !1;
|
|
260
260
|
}
|
|
261
261
|
}, ie = async () => {
|
|
262
262
|
var o;
|
|
263
|
-
d.value.resetFunc ? await d.value.resetFunc() : ((o = b.value) == null || o.resetFields(), A(), l("reset"), d.value.submitOnReset && await
|
|
264
|
-
}, q = (o) => (m.value = { ...m.value, ...o }, Promise.resolve()), G = () =>
|
|
263
|
+
d.value.resetFunc ? await d.value.resetFunc() : ((o = b.value) == null || o.resetFields(), A(), l("reset"), d.value.submitOnReset && await L());
|
|
264
|
+
}, q = (o) => (m.value = { ...m.value, ...o }, Promise.resolve()), G = () => V({ ...m.value }), U = async () => {
|
|
265
265
|
var o;
|
|
266
266
|
(o = b.value) == null || o.resetFields(), A();
|
|
267
267
|
}, X = (o) => {
|
|
268
|
-
var
|
|
269
|
-
return ((
|
|
270
|
-
}, H = (o) => b.value ? o != null && o.length ? Promise.all(o.map((
|
|
271
|
-
b.value.validateField(
|
|
272
|
-
}))) : b.value.validate() : Promise.resolve(), K = async (o,
|
|
268
|
+
var a;
|
|
269
|
+
return ((a = b.value) == null ? void 0 : a.validate(o)) ?? Promise.resolve();
|
|
270
|
+
}, H = (o) => b.value ? o != null && o.length ? Promise.all(o.map((a) => new Promise((f, i) => {
|
|
271
|
+
b.value.validateField(a, (r) => r ? f(void 0) : i(new Error("Validation failed")));
|
|
272
|
+
}))) : b.value.validate() : Promise.resolve(), K = async (o, a) => {
|
|
273
273
|
var i;
|
|
274
|
-
const
|
|
275
|
-
return
|
|
274
|
+
const f = (i = P.value) == null ? void 0 : i.querySelector(`[data-field="${o}"]`);
|
|
275
|
+
return f && f.scrollIntoView({ behavior: (a == null ? void 0 : a.behavior) ?? "smooth", block: (a == null ? void 0 : a.block) ?? "nearest" }), Promise.resolve();
|
|
276
276
|
}, Z = (o) => {
|
|
277
|
-
var
|
|
278
|
-
(
|
|
277
|
+
var a;
|
|
278
|
+
(a = b.value) == null || a.clearValidate(o);
|
|
279
279
|
}, j = async (o) => {
|
|
280
|
-
(Array.isArray(o) ? o : [o]).forEach((
|
|
281
|
-
const i =
|
|
282
|
-
i >= 0 && (
|
|
280
|
+
(Array.isArray(o) ? o : [o]).forEach((f) => {
|
|
281
|
+
const i = v.value.findIndex((r) => r.field === f.field);
|
|
282
|
+
i >= 0 && (v.value[i] = { ...v.value[i], ...f });
|
|
283
283
|
});
|
|
284
|
-
}, J = async (o,
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
else if (
|
|
288
|
-
const i =
|
|
289
|
-
|
|
284
|
+
}, J = async (o, a, f) => {
|
|
285
|
+
if (f)
|
|
286
|
+
v.value.unshift(o);
|
|
287
|
+
else if (a) {
|
|
288
|
+
const i = v.value.findIndex((r) => r.field === a);
|
|
289
|
+
v.value.splice(i + 1, 0, o);
|
|
290
290
|
} else
|
|
291
|
-
|
|
291
|
+
v.value.push(o);
|
|
292
292
|
A();
|
|
293
293
|
}, Q = async (o) => {
|
|
294
|
-
const
|
|
295
|
-
|
|
294
|
+
const a = Array.isArray(o) ? o : [o];
|
|
295
|
+
v.value = v.value.filter((f) => !a.includes(f.field));
|
|
296
296
|
}, Y = async (o) => {
|
|
297
297
|
if (y.value = { ...y.value, ...o }, o.schemas) {
|
|
298
|
-
|
|
298
|
+
v.value = [...o.schemas];
|
|
299
299
|
debugger;
|
|
300
300
|
A();
|
|
301
301
|
}
|
|
302
|
-
},
|
|
302
|
+
}, I = {
|
|
303
303
|
getFieldsValue: G,
|
|
304
304
|
setFieldsValue: q,
|
|
305
305
|
resetFields: U,
|
|
306
306
|
validate: X,
|
|
307
307
|
validateFields: H,
|
|
308
|
-
submit:
|
|
308
|
+
submit: L,
|
|
309
309
|
scrollToField: K,
|
|
310
310
|
clearValidate: Z,
|
|
311
311
|
updateSchema: j,
|
|
@@ -313,17 +313,17 @@ const le = ye.exports, we = /* @__PURE__ */ D({
|
|
|
313
313
|
removeSchemaByField: Q,
|
|
314
314
|
setProps: Y
|
|
315
315
|
};
|
|
316
|
-
e(
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
},
|
|
316
|
+
e(I);
|
|
317
|
+
const O = () => {
|
|
318
|
+
v.value = [...t.schemas ?? []], A();
|
|
319
|
+
}, E = () => {
|
|
320
320
|
typeof window < "u" && (S.value = window.innerWidth);
|
|
321
321
|
};
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
}),
|
|
325
|
-
typeof window < "u" && window.removeEventListener("resize",
|
|
326
|
-
}), oe(() => [t.schemas, t.initialValues],
|
|
322
|
+
return fe(() => {
|
|
323
|
+
O(), l("register", I), typeof window < "u" && window.addEventListener("resize", E);
|
|
324
|
+
}), ue(() => {
|
|
325
|
+
typeof window < "u" && window.removeEventListener("resize", E);
|
|
326
|
+
}), oe(() => [t.schemas, t.initialValues], O, { deep: !0 }), { __sfc: !0, props: t, emit: l, slots: s, formRef: b, formWrapRef: P, submitLoading: C, collapsed: p, formModel: m, formRules: M, innerSchemas: v, innerProps: y, BREAKPOINTS: F, getEffectiveSpan: c, effectiveProps: d, effectiveActionColOptions: R, windowWidth: S, getVisibleSchemaCount: n, hasMoreFields: u, formListeners: x, displaySchemas: k, shouldShow: T, getColProps: ae, getSlotName: re, initForm: A, filterByIfShow: N, processFieldMapToTime: V, handleSubmit: L, handleReset: ie, setFieldsValue: q, getFieldsValue: G, resetFields: U, validate: X, validateFields: H, scrollToField: K, clearValidate: Z, updateSchema: j, appendSchemaByField: J, removeSchemaByField: Q, setProps: Y, formActionRef: I, syncSchemas: O, handleResize: E, ProFormItem: se, FormActions: le };
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
329
|
var Pe = function() {
|
|
@@ -336,23 +336,23 @@ var Pe = function() {
|
|
|
336
336
|
} } }, [l("template", { slot: "submitBefore" }, [e._t("submitBefore")], 2), l("template", { slot: "resetBefore" }, [e._t("resetBefore")], 2), l("template", { slot: "advanceBefore" }, [e._t("advanceBefore")], 2), l("template", { slot: "advanceAfter" }, [e._t("advanceAfter")], 2), l("template", { slot: "actions" }, [e._t("actions")], 2)], 2)], 1) : e._e()], 2), t.effectiveProps.showAdvancedButton && t.hasMoreFields ? l("el-button", { staticClass: "ecp-form-actions__advance", attrs: { type: "text" }, on: { click: function(s) {
|
|
337
337
|
t.collapsed = !t.collapsed;
|
|
338
338
|
} } }, [l("i", { staticClass: "el-icon-d-arrow-left", class: t.collapsed ? "down" : "up" }), e._v(" " + e._s(t.collapsed ? "展开" : "收起") + " ")]) : e._e(), e._t("formFooter")], 2)], 1);
|
|
339
|
-
}, ge = [], Fe = /* @__PURE__ */
|
|
339
|
+
}, ge = [], Fe = /* @__PURE__ */ z(
|
|
340
340
|
we,
|
|
341
341
|
Pe,
|
|
342
342
|
ge,
|
|
343
343
|
!1,
|
|
344
344
|
null,
|
|
345
|
-
"
|
|
345
|
+
"af9453ad",
|
|
346
346
|
null,
|
|
347
347
|
null
|
|
348
348
|
);
|
|
349
349
|
const ne = Fe.exports;
|
|
350
350
|
function xe(_) {
|
|
351
|
-
const e =
|
|
351
|
+
const e = g(null), l = g(_ ? ee(_) : void 0), t = () => _ ? ee(_) : void 0, s = (n) => {
|
|
352
352
|
e.value = n;
|
|
353
|
-
const
|
|
353
|
+
const u = t();
|
|
354
354
|
debugger;
|
|
355
|
-
|
|
355
|
+
u && Object.keys(u).length > 0 && n.setProps(u);
|
|
356
356
|
};
|
|
357
357
|
return _ && oe(
|
|
358
358
|
() => t(),
|
|
@@ -368,48 +368,48 @@ function xe(_) {
|
|
|
368
368
|
return ((n = e.value) == null ? void 0 : n.getFieldsValue()) ?? {};
|
|
369
369
|
},
|
|
370
370
|
setFieldsValue: async (n) => {
|
|
371
|
-
var
|
|
372
|
-
await ((
|
|
371
|
+
var u;
|
|
372
|
+
await ((u = e.value) == null ? void 0 : u.setFieldsValue(n));
|
|
373
373
|
},
|
|
374
374
|
resetFields: async () => {
|
|
375
375
|
var n;
|
|
376
376
|
await ((n = e.value) == null ? void 0 : n.resetFields());
|
|
377
377
|
},
|
|
378
378
|
validate: (n) => {
|
|
379
|
-
var
|
|
380
|
-
return ((
|
|
379
|
+
var u;
|
|
380
|
+
return ((u = e.value) == null ? void 0 : u.validate(n)) ?? Promise.resolve();
|
|
381
381
|
},
|
|
382
382
|
validateFields: (n) => {
|
|
383
|
-
var
|
|
384
|
-
return ((
|
|
383
|
+
var u;
|
|
384
|
+
return ((u = e.value) == null ? void 0 : u.validateFields(n)) ?? Promise.resolve();
|
|
385
385
|
},
|
|
386
386
|
submit: () => {
|
|
387
387
|
var n;
|
|
388
388
|
return ((n = e.value) == null ? void 0 : n.submit()) ?? Promise.resolve();
|
|
389
389
|
},
|
|
390
|
-
scrollToField: (n,
|
|
390
|
+
scrollToField: (n, u) => {
|
|
391
391
|
var x;
|
|
392
|
-
return ((x = e.value) == null ? void 0 : x.scrollToField(n,
|
|
392
|
+
return ((x = e.value) == null ? void 0 : x.scrollToField(n, u)) ?? Promise.resolve();
|
|
393
393
|
},
|
|
394
394
|
clearValidate: (n) => {
|
|
395
|
-
var
|
|
396
|
-
(
|
|
395
|
+
var u;
|
|
396
|
+
(u = e.value) == null || u.clearValidate(n);
|
|
397
397
|
},
|
|
398
398
|
updateSchema: (n) => {
|
|
399
|
-
var
|
|
400
|
-
return ((
|
|
399
|
+
var u;
|
|
400
|
+
return ((u = e.value) == null ? void 0 : u.updateSchema(n)) ?? Promise.resolve();
|
|
401
401
|
},
|
|
402
|
-
appendSchemaByField: (n,
|
|
402
|
+
appendSchemaByField: (n, u, x) => {
|
|
403
403
|
var k;
|
|
404
|
-
return ((k = e.value) == null ? void 0 : k.appendSchemaByField(n,
|
|
404
|
+
return ((k = e.value) == null ? void 0 : k.appendSchemaByField(n, u, x)) ?? Promise.resolve();
|
|
405
405
|
},
|
|
406
406
|
removeSchemaByField: (n) => {
|
|
407
|
-
var
|
|
408
|
-
return ((
|
|
407
|
+
var u;
|
|
408
|
+
return ((u = e.value) == null ? void 0 : u.removeSchemaByField(n)) ?? Promise.resolve();
|
|
409
409
|
},
|
|
410
410
|
setProps: async (n) => {
|
|
411
|
-
var
|
|
412
|
-
l.value = { ...l.value, ...n }, await ((
|
|
411
|
+
var u;
|
|
412
|
+
l.value = { ...l.value, ...n }, await ((u = e.value) == null ? void 0 : u.setProps(n));
|
|
413
413
|
}
|
|
414
414
|
}];
|
|
415
415
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-component-pro.es.js","sources":["../src/ProForm/ProFormItem.vue","../src/ProForm/ProForm.vue","../src/ProForm/useForm.ts","../src/index.ts"],"sourcesContent":["<template>\n <el-form-item\n v-if=\"shouldRender\"\n v-show=\"shouldShow\"\n :prop=\"schema.field\"\n :required=\"schema.required\"\n :rules=\"effectiveRules\"\n >\n <template slot=\"label\">\n <span>{{ schema.label }}</span>\n <el-tooltip\n v-if=\"schema.helpMessage\"\n placement=\"top\"\n effect=\"light\"\n v-bind=\"schema.helpComponentProps || {}\"\n >\n <template slot=\"content\">\n <template v-if=\"Array.isArray(schema.helpMessage)\">\n <div v-for=\"(msg, i) in schema.helpMessage\" :key=\"i\" class=\"ecp-pro-form-item__help-item\">\n {{ msg }}\n </div>\n </template>\n <span v-else>{{ schema.helpMessage }}</span>\n </template>\n <i class=\"el-icon-question ecp-pro-form-item__help-icon\" />\n </el-tooltip>\n </template>\n <!-- render 自定义渲染 -->\n <template v-if=\"schema.render\">\n <component :is=\"renderComponent\" />\n </template>\n <!-- slot 自定义插槽(由 ProForm 传入 default slot) -->\n <slot v-else-if=\"hasSlot\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\" :values=\"formModel\" />\n <!-- 默认组件渲染 -->\n <template v-else>\n <el-input\n v-if=\"schema.component === 'input' || !schema.component\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请输入${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-input-number\n v-else-if=\"schema.component === 'input-number'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-select\n class=\"ecp-pro-form-item__select\"\n v-else-if=\"schema.component === 'select'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-option\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.label\"\n :value=\"opt.value\"\n />\n </el-select>\n <el-date-picker\n v-else-if=\"schema.component === 'date-picker'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-date-picker\n v-else-if=\"schema.component === 'date-range'\"\n v-model=\"formModel[schema.field]\"\n type=\"daterange\"\n range-separator=\"至\"\n start-placeholder=\"开始日期\"\n end-placeholder=\"结束日期\"\n value-format=\"yyyy-MM-dd\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-switch\n v-else-if=\"schema.component === 'switch'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-cascader\n v-else-if=\"schema.component === 'cascader'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-checkbox-group\n v-else-if=\"schema.component === 'checkbox'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-checkbox\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-checkbox>\n </el-checkbox-group>\n <el-radio-group\n v-else-if=\"schema.component === 'radio'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-radio\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-radio>\n </el-radio-group>\n </template>\n </el-form-item>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots, h } from 'vue'\nimport type { ProFormSchema, RenderCallbackParams } from '../types'\n\nconst props = defineProps<{\n schema: ProFormSchema\n formModel: Record<string, unknown>\n formDisabled?: boolean\n autoPlaceholder?: boolean\n formActionType?: import('../types').FormActionType\n}>()\n\nconst slots = useSlots()\n\nconst renderParams = computed<RenderCallbackParams>(() => ({\n schema: props.schema,\n values: props.formModel,\n model: props.formModel,\n field: props.schema.field,\n}))\n\nconst shouldRender = computed(() => {\n const ifShow = props.schema.ifShow\n if (ifShow === undefined) return true\n if (typeof ifShow === 'boolean') return ifShow\n return ifShow(renderParams.value)\n})\n\nconst shouldShow = computed(() => {\n const show = props.schema.show\n if (show === undefined) return true\n if (typeof show === 'boolean') return show\n return show(renderParams.value)\n})\n\nconst effectiveDisabled = computed(() => {\n if (props.formDisabled) return true\n const dyn = props.schema.dynamicDisabled\n if (dyn === undefined) return false\n if (typeof dyn === 'boolean') return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveRules = computed(() => {\n const dyn = props.schema.dynamicRules\n if (!dyn) return props.schema.rules\n if (Array.isArray(dyn)) return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveComponentPropsAndListeners = computed(() => {\n const cp = props.schema.componentProps\n if (!cp) return { props: {}, listeners: {} }\n const raw = typeof cp === 'function'\n ? cp({\n ...renderParams.value,\n formActionType: props.formActionType,\n })\n : { ...cp }\n const propsOnly: Record<string, unknown> = {}\n const listeners: Record<string, (...args: unknown[]) => unknown> = {}\n for (const [key, value] of Object.entries(raw)) {\n if (key.length > 2 && /^on[A-Za-z]/.test(key) && typeof value === 'function') {\n const eventName = key.slice(2).charAt(0).toLowerCase() + key.slice(3)\n listeners[eventName] = value as (...args: unknown[]) => unknown\n } else {\n propsOnly[key] = value\n }\n }\n return { props: propsOnly, listeners }\n})\n\nconst effectiveComponentProps = computed(() => effectiveComponentPropsAndListeners.value.props)\nconst effectiveComponentListeners = computed(() => effectiveComponentPropsAndListeners.value.listeners)\n\nconst hasSlot = computed(() => !!slots.default)\n\nconst getOptions = (props: Record<string, unknown>): Array<{ label: string; value: unknown }> | undefined => {\n const opts = props?.options\n return Array.isArray(opts) ? opts : undefined\n}\n\nconst renderComponent = computed(() => {\n const renderFn = props.schema.render\n if (!renderFn) return null\n return {\n render() {\n const result = renderFn(renderParams.value)\n if (Array.isArray(result)) {\n return h('span', result)\n }\n return result\n },\n }\n})\n</script>\n\n<style scoped>\n.ecp-pro-form-item__help-icon {\n margin-left: 4px;\n color: #909399;\n cursor: help;\n font-size: 14px;\n}\n.ecp-pro-form-item__help-icon:hover {\n color: #409eff;\n}\n.ecp-pro-form-item__help-item {\n margin-bottom: 4px;\n}\n.ecp-pro-form-item__help-item:last-child {\n margin-bottom: 0;\n}\n.ecp-pro-form-item__select {\n display: block;\n}\n</style>\n","<template>\n <div ref=\"formWrapRef\" class=\"ecp-pro-form\">\n <el-form class=\"ecp-pro-form\" ref=\"formRef\" :model=\"formModel\" :rules=\"formRules\" :label-width=\"effectiveProps.labelWidth\"\n :label-position=\"effectiveProps.labelPosition\" :size=\"effectiveProps.size\" :disabled=\"effectiveProps.disabled\"\n v-bind=\"$attrs\" v-on=\"formListeners\">\n <slot name=\"formHeader\" />\n <el-row :gutter=\"effectiveProps.gutter\" :style=\"effectiveProps.baseRowStyle\">\n <template v-for=\"schema in displaySchemas\">\n <el-col v-if=\"shouldShow(schema)\" :key=\"schema.field\" v-bind=\"getColProps(schema)\"\n :offset=\"schema.colProps?.offset ?? effectiveProps.baseColProps?.offset ?? 0\" :data-field=\"schema.field\">\n <ProFormItem :schema=\"schema\" :form-model=\"formModel\" :form-disabled=\"effectiveProps.disabled\"\n :auto-placeholder=\"effectiveProps.autoSetPlaceholder\" :form-action-type=\"formActionRef\">\n <template v-if=\"slots[getSlotName(schema)]\">\n <slot :name=\"getSlotName(schema)\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\"\n :values=\"formModel\" />\n </template>\n </ProFormItem>\n </el-col>\n </template>\n <el-col class=\"ecp-pro-form_col\" v-if=\"effectiveProps.showActionButtonGroup\"\n v-bind=\"hasMoreFields ? { span: 24 } : effectiveProps.actionColOptions || { span: 6 }\">\n <FormActions :show-action-button-group=\"effectiveProps.showActionButtonGroup\"\n :show-submit-button=\"effectiveProps.showSubmitButton\" :show-reset-button=\"effectiveProps.showResetButton\"\n :submit-button-text=\"effectiveProps.submitButtonText\" :reset-button-text=\"effectiveProps.resetButtonText\"\n :submit-button-icon=\"effectiveProps.submitButtonIcon\" :reset-button-icon=\"effectiveProps.resetButtonIcon\"\n :submit-loading=\"submitLoading\" :show-advanced-button=\"effectiveProps.showAdvancedButton\"\n :has-more-fields=\"hasMoreFields\" :collapsed=\"collapsed\" :action-col-options=\"effectiveActionColOptions\"\n @submit=\"handleSubmit\" @reset=\"handleReset\" @toggle=\"collapsed = !collapsed\">\n <template slot=\"submitBefore\">\n <slot name=\"submitBefore\" />\n </template>\n <template slot=\"resetBefore\">\n <slot name=\"resetBefore\" />\n </template>\n <template slot=\"advanceBefore\">\n <slot name=\"advanceBefore\" />\n </template>\n <template slot=\"advanceAfter\">\n <slot name=\"advanceAfter\" />\n </template>\n <template slot=\"actions\">\n <slot name=\"actions\" />\n </template>\n </FormActions>\n </el-col>\n </el-row>\n <el-button v-if=\"effectiveProps.showAdvancedButton && hasMoreFields\" type=\"text\" class=\"ecp-form-actions__advance\"\n @click=\"collapsed = !collapsed\">\n <i class=\"el-icon-d-arrow-left\" :class=\"collapsed ? 'down' : 'up'\" />\n {{ collapsed ? '展开' : '收起' }}\n </el-button>\n <slot name=\"formFooter\" />\n </el-form>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, useSlots, onMounted, onUnmounted } from 'vue'\nimport ProFormItem from './ProFormItem.vue'\nimport FormActions from './FormActions.vue'\nimport type { ProFormSchema, ProFormProps, FormActionType, ColEx, ScrollToFieldOptions, FormListeners } from '../types'\n\nconst props = withDefaults(\n defineProps<{\n schemas?: ProFormSchema[]\n initialValues?: Record<string, unknown>\n labelWidth?: string\n labelPosition?: 'left' | 'right' | 'top'\n gutter?: number\n size?: 'medium' | 'small' | 'large'\n disabled?: boolean\n baseColProps?: ColEx\n baseRowStyle?: Record<string, string | number>\n autoSetPlaceholder?: boolean\n showSubmitButton?: boolean\n showResetButton?: boolean\n submitButtonText?: string\n resetButtonText?: string\n submitButtonIcon?: string\n resetButtonIcon?: string\n showActionButtonGroup?: boolean\n actionColOptions?: ColEx\n showAdvancedButton?: boolean\n autoAdvancedLine?: number\n alwaysShowLines?: number\n submitFunc?: () => Promise<void>\n resetFunc?: () => Promise<void>\n submitOnReset?: boolean\n formListeners?: FormListeners\n }>(),\n {\n labelWidth: '120px',\n labelPosition: 'right',\n gutter: 24,\n size: 'medium',\n autoSetPlaceholder: true,\n showSubmitButton: true,\n showResetButton: true,\n submitButtonText: '提交',\n resetButtonText: '重置',\n submitButtonIcon: 'el-icon-search',\n resetButtonIcon: 'el-icon-refresh-left',\n showActionButtonGroup: true,\n showAdvancedButton: false,\n autoAdvancedLine: 3,\n alwaysShowLines: 1,\n baseColProps: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n actionColOptions: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n submitOnReset: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'submit', values: Record<string, unknown>): void\n (e: 'reset'): void\n (e: 'register', formAction: FormActionType): void\n}>()\nconst slots = useSlots()\nconst formRef = ref()\nconst formWrapRef = ref()\nconst submitLoading = ref(false)\nconst collapsed = ref(true)\nconst formModel = ref<Record<string, unknown>>({})\nconst formRules = ref<Record<string, unknown[]>>({})\nconst innerSchemas = ref<ProFormSchema[]>([])\nconst innerProps = ref<Partial<ProFormProps>>({})\n\n/** Element UI 栅格断点 (px) */\nconst BREAKPOINTS = { xl: 1920, lg: 1200, md: 992, sm: 768 }\n\n/** 根据当前视口宽度获取 ColEx 的有效 span(与 el-col 断点逻辑一致) */\nconst getEffectiveSpan = (colProps?: ColEx | null, baseColProps?: ColEx | null, width?: number): number => {\n const w = width ?? (typeof window !== 'undefined' ? window.innerWidth : 1920)\n const col = colProps ?? {}\n const base = baseColProps ?? {}\n const fallback = base.span ?? 8\n if (w >= BREAKPOINTS.xl) return col.xl ?? base.xl ?? col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.lg) return col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.md) return col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w < BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n return col.xs ?? base.xs ?? col.span ?? fallback\n}\n\nconst effectiveProps = computed(() => ({ ...props, ...innerProps.value }))\nconst effectiveActionColOptions = computed(() => effectiveProps.value.actionColOptions ?? { span: 24 })\n\n/** 当前视口宽度,用于响应式计算 span */\nconst windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1920)\n\n/** 计算前 maxLines 行能容纳的 schema 数量(考虑栅格断点,每个 field 可有自己的 span) */\nconst getVisibleSchemaCount = (\n schemas: ProFormSchema[],\n baseColProps: ColEx | undefined,\n maxLines: number,\n width: number\n) => {\n let remaining = 24\n let rows = 1\n let count = 0\n for (const schema of schemas) {\n const span = getEffectiveSpan(schema.colProps, baseColProps, width)\n if (span > remaining) {\n rows++\n if (rows > maxLines) break\n remaining = 24 - span\n } else {\n remaining -= span\n }\n count++\n }\n return count\n}\n\nconst hasMoreFields = computed(() => {\n const schemas = innerSchemas.value.filter((s) => !s.hidden)\n\n if (!effectiveProps.value.showAdvancedButton) return false\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n console.log(schemas.length, maxVisible)\n return schemas.length > maxVisible\n})\n\nconst formListeners = computed((): FormListeners => {\n return effectiveProps.value.formListeners ?? {}\n})\n\nconst displaySchemas = computed(() => {\n const schemas = innerSchemas.value.filter((s) => {\n return shouldShow(s)\n })\n if (!effectiveProps.value.showAdvancedButton || !collapsed.value) return schemas\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n return schemas.slice(0, maxVisible)\n})\n\nconst shouldShow = (schema: ProFormSchema) => {\n let ifShow = true\n let show = true\n if (typeof schema.ifShow === 'function') {\n ifShow = schema.ifShow({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.ifShow === 'boolean') {\n ifShow = schema.ifShow\n }\n if (typeof schema.show === 'function') {\n show = schema.show({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.show === 'boolean') {\n show = schema.show\n }\n return ifShow && show\n}\nconst getColProps = (schema: ProFormSchema) => {\n return schema.colProps ?? effectiveProps.value.baseColProps ?? {}\n}\nconst getSlotName = (schema: ProFormSchema) => schema.slot || schema.field\n\nconst initForm = () => {\n const model: Record<string, unknown> = {}\n const rules: Record<string, unknown[]> = {}\n const initialValues = effectiveProps.value.initialValues ?? props.initialValues\n innerSchemas.value.forEach((schema) => {\n model[schema.field] = schema.defaultValue ?? initialValues?.[schema.field]\n if (schema.rules?.length) rules[schema.field] = schema.rules\n })\n formModel.value = { ...formModel.value, ...model }\n formRules.value = rules\n}\n\nconst filterByIfShow = (values: Record<string, unknown>) => {\n const result = { ...values }\n innerSchemas.value.forEach((schema) => {\n const ifShow = schema.ifShow\n if (ifShow === undefined) return\n const visible = typeof ifShow === 'boolean' ? ifShow : ifShow({ schema, values, model: values, field: schema.field })\n if (!visible) delete result[schema.field]\n })\n return result\n}\n\nconst processFieldMapToTime = (values: Record<string, unknown>) => {\n const filtered = filterByIfShow(values)\n const fieldMap = innerProps.value.fieldMapToTime\n if (!fieldMap?.length) return filtered\n const result = { ...filtered }\n fieldMap.forEach(([field, [startKey, endKey]]) => {\n const val = result[field]\n if (Array.isArray(val) && val.length === 2) {\n delete result[field]\n ; (result as Record<string, unknown>)[startKey] = val[0]\n ; (result as Record<string, unknown>)[endKey] = val[1]\n }\n })\n return result\n}\n\nconst handleSubmit = async () => {\n try {\n await formRef.value?.validate()\n if (effectiveProps.value.submitFunc) {\n await effectiveProps.value.submitFunc()\n } else {\n submitLoading.value = true\n emit('submit', processFieldMapToTime({ ...formModel.value }))\n }\n } catch (e) {\n console.error('Form validation failed:', e)\n } finally {\n submitLoading.value = false\n }\n}\n\nconst handleReset = async () => {\n if (effectiveProps.value.resetFunc) {\n await effectiveProps.value.resetFunc()\n } else {\n formRef.value?.resetFields()\n initForm()\n emit('reset')\n if (effectiveProps.value.submitOnReset) await handleSubmit()\n }\n}\n\nconst setFieldsValue = (values: Record<string, unknown>) => {\n formModel.value = { ...formModel.value, ...values }\n return Promise.resolve()\n}\n\nconst getFieldsValue = () => processFieldMapToTime({ ...formModel.value })\n\nconst resetFields = async () => {\n formRef.value?.resetFields()\n initForm()\n}\n\nconst validate = (nameList?: string[]) =>\n formRef.value?.validate(nameList) ?? Promise.resolve()\n\nconst validateFields = (nameList?: string[]) => {\n if (!formRef.value) return Promise.resolve()\n if (!nameList?.length) return formRef.value.validate()\n return Promise.all(nameList.map((prop) => new Promise((resolve, reject) => {\n formRef.value.validateField(prop, (valid: boolean) => (valid ? resolve(undefined) : reject(new Error('Validation failed'))))\n })))\n}\n\nconst scrollToField = async (name: string, options?: ScrollToFieldOptions) => {\n const el = formWrapRef.value?.querySelector(`[data-field=\"${name}\"]`)\n if (el) {\n el.scrollIntoView({ behavior: options?.behavior ?? 'smooth', block: options?.block ?? 'nearest' })\n }\n return Promise.resolve()\n}\n\nconst clearValidate = (name?: string | string[]) => {\n formRef.value?.clearValidate(name)\n}\n\nconst updateSchema = async (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => {\n const list = Array.isArray(data) ? data : [data]\n list.forEach((item) => {\n const idx = innerSchemas.value.findIndex((s) => s.field === item.field)\n if (idx >= 0) innerSchemas.value[idx] = { ...innerSchemas.value[idx], ...item }\n })\n}\n\nconst appendSchemaByField = async (schema: ProFormSchema, prefixField?: string, first?: boolean) => {\n if (first) innerSchemas.value.unshift(schema)\n else if (prefixField) {\n const idx = innerSchemas.value.findIndex((s) => s.field === prefixField)\n innerSchemas.value.splice(idx + 1, 0, schema)\n } else innerSchemas.value.push(schema)\n initForm()\n}\n\nconst removeSchemaByField = async (field: string | string[]) => {\n const fields = Array.isArray(field) ? field : [field]\n innerSchemas.value = innerSchemas.value.filter((s) => !fields.includes(s.field))\n}\n\nconst setProps = async (formProps: Partial<ProFormProps>) => {\n innerProps.value = { ...innerProps.value, ...formProps }\n if (formProps.schemas) {\n innerSchemas.value = [...formProps.schemas]\n debugger\n initForm()\n }\n}\n\nconst formActionRef: FormActionType = {\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit: handleSubmit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n}\n\ndefineExpose(formActionRef)\n\nconst syncSchemas = () => {\n innerSchemas.value = [...(props.schemas ?? [])]\n initForm()\n}\n\nconst handleResize = () => {\n if (typeof window !== 'undefined') windowWidth.value = window.innerWidth\n}\n\nonMounted(() => {\n syncSchemas()\n emit('register', formActionRef)\n if (typeof window !== 'undefined') window.addEventListener('resize', handleResize)\n})\n\nonUnmounted(() => {\n if (typeof window !== 'undefined') window.removeEventListener('resize', handleResize)\n})\n\nwatch(() => [props.schemas, props.initialValues], syncSchemas, { deep: true })\n</script>\n\n<style scoped>\n.ecp-pro-form {\n padding: 16px;\n position: relative;\n}\n\n.ecp-pro-form__advance {\n margin-bottom: 16px;\n}\n\n.ecp-pro-form_col {\n position: relative;\n float: right;\n}\n\n.el-icon-d-arrow-left.up {\n transform: rotate(90deg);\n}\n\n.el-icon-d-arrow-left.down {\n transform: rotate(-90deg);\n}\n\n.ecp-form-actions__advance {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n</style>\n","import { ref, watch, unref, type Ref } from 'vue'\nimport type { ProFormSchema, ProFormProps, FormActionType } from '../types'\n\nexport interface UseFormProps extends ProFormProps {\n schemas?: ProFormSchema[]\n}\n\n/** 支持 ref/computed 的 props(参考 Vben Admin:参数 props 内的值可以是 computed 或者 ref 类型) */\nexport type UseFormPropsReactive = UseFormProps | Ref<UseFormProps | undefined>\n\nexport interface UseFormReturn {\n /** 用于 @register,接收表单实例的 formAction */\n register: (formAction: FormActionType) => void\n formAction: { value: FormActionType | null }\n getFieldsValue: () => Record<string, unknown>\n setFieldsValue: (values: Record<string, unknown>) => Promise<void>\n resetFields: () => Promise<void>\n validate: (nameList?: string[]) => Promise<unknown>\n validateFields: (nameList?: string[]) => Promise<unknown>\n submit: () => Promise<void>\n scrollToField: (name: string, options?: import('../types').ScrollToFieldOptions) => Promise<void>\n clearValidate: (name?: string | string[]) => void\n updateSchema: (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => Promise<void>\n appendSchemaByField: (schema: ProFormSchema, prefixField?: string, first?: boolean) => Promise<void>\n removeSchemaByField: (field: string | string[]) => Promise<void>\n setProps: (props: Partial<ProFormProps>) => Promise<void>\n}\n\nexport function useForm(props?: UseFormPropsReactive): [UseFormReturn['register'], Omit<UseFormReturn, 'register'>] {\n const formAction = ref<FormActionType | null>(null)\n const formPropsRef = ref<UseFormProps | undefined>(props ? unref(props as Ref<UseFormProps | undefined>) : undefined)\n\n const getFormProps = () => (props ? unref(props as Ref<UseFormProps | undefined>) : undefined) as UseFormProps | undefined\n\n const register = (action: FormActionType) => {\n formAction.value = action\n const formProps = getFormProps()\n debugger\n if (formProps && Object.keys(formProps).length > 0) {\n action.setProps(formProps)\n }\n }\n\n if (props) {\n watch(\n () => getFormProps(),\n (formProps) => {\n formPropsRef.value = formProps\n if (formProps && formAction.value) {\n formAction.value.setProps(formProps)\n }\n },\n { deep: true }\n )\n }\n\n const getFieldsValue = () => formAction.value?.getFieldsValue() ?? {}\n\n const setFieldsValue = async (values: Record<string, unknown>) => {\n await formAction.value?.setFieldsValue(values)\n }\n\n const resetFields = async () => {\n await formAction.value?.resetFields()\n }\n\n const validate = (nameList?: string[]) =>\n formAction.value?.validate(nameList) ?? Promise.resolve()\n\n const validateFields = (nameList?: string[]) =>\n formAction.value?.validateFields(nameList) ?? Promise.resolve()\n\n const submit = () => formAction.value?.submit() ?? Promise.resolve()\n\n const scrollToField = (name: string, options?: import('../types').ScrollToFieldOptions) =>\n formAction.value?.scrollToField(name, options) ?? Promise.resolve()\n\n const clearValidate = (name?: string | string[]) => {\n formAction.value?.clearValidate(name)\n }\n\n const updateSchema = (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) =>\n formAction.value?.updateSchema(data) ?? Promise.resolve()\n\n const appendSchemaByField = (schema: ProFormSchema, prefixField?: string, first?: boolean) =>\n formAction.value?.appendSchemaByField(schema, prefixField, first) ?? Promise.resolve()\n\n const removeSchemaByField = (field: string | string[]) =>\n formAction.value?.removeSchemaByField(field) ?? Promise.resolve()\n\n const setProps = async (formProps: Partial<ProFormProps>) => {\n formPropsRef.value = { ...formPropsRef.value, ...formProps }\n await formAction.value?.setProps(formProps)\n }\n\n const result: UseFormReturn = {\n register,\n formAction,\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n }\n\n return [register, result]\n}\n","import type { VueConstructor } from 'vue'\n// import ProTable from './ProTable'\nimport ProForm, { ProFormItem, FormActions } from './ProForm'\n// import ProCard from './ProCard'\n// import ProDescriptions from './ProDescriptions'\nimport { useForm } from './ProForm/useForm'\n\nexport { ProForm, ProFormItem, FormActions, useForm }\nexport * from './types'\n\nconst components = [\n // { name: 'ProTable', component: ProTable },\n { name: 'ProForm', component: ProForm },\n { name: 'ProFormItem', component: ProFormItem },\n { name: 'FormActions', component: FormActions }\n // { name: 'ProCard', component: ProCard },\n // { name: 'ProDescriptions', component: ProDescriptions },\n]\n\nexport function install(Vue: VueConstructor) {\n components.forEach(({ name, component }) => {\n Vue.component(name, component)\n })\n}\n\nexport default {\n install,\n // ProTable,\n ProForm,\n // ProCard,\n // ProDescriptions,\n}\n"],"names":["slots","useSlots","renderParams","computed","props","shouldRender","ifShow","shouldShow","show","effectiveDisabled","dyn","effectiveRules","effectiveComponentPropsAndListeners","cp","raw","propsOnly","listeners","key","value","eventName","effectiveComponentProps","effectiveComponentListeners","hasSlot","getOptions","opts","renderComponent","renderFn","result","h","formRef","ref","formWrapRef","submitLoading","collapsed","formModel","formRules","innerSchemas","innerProps","BREAKPOINTS","getEffectiveSpan","colProps","baseColProps","width","w","col","base","fallback","effectiveProps","effectiveActionColOptions","windowWidth","getVisibleSchemaCount","schemas","maxLines","remaining","rows","count","schema","span","hasMoreFields","s","lines","maxVisible","formListeners","displaySchemas","getColProps","getSlotName","initForm","model","rules","initialValues","_a","filterByIfShow","values","processFieldMapToTime","filtered","fieldMap","field","startKey","endKey","val","handleSubmit","emit","e","handleReset","setFieldsValue","getFieldsValue","resetFields","validate","nameList","validateFields","prop","resolve","reject","valid","scrollToField","name","options","el","clearValidate","updateSchema","data","item","idx","appendSchemaByField","prefixField","first","removeSchemaByField","fields","setProps","formProps","formActionRef","expose","syncSchemas","handleResize","onMounted","onUnmounted","watch","useForm","formAction","formPropsRef","unref","getFormProps","register","action","components","ProForm","ProFormItem","FormActions","install","Vue","component","index"],"mappings":";;;;;;;;;;;iBAoJMA,IAAQC,MAERC,IAAeC,EAA+B,OAAO;AAAA,MACzD,QAAQC,EAAM;AAAA,MACd,QAAQA,EAAM;AAAA,MACd,OAAOA,EAAM;AAAA,MACb,OAAOA,EAAM,OAAO;AAAA,IACpB,EAAA,GAEIC,IAAeF,EAAS,MAAM;AAC5B,YAAAG,IAASF,EAAM,OAAO;AAC5B,aAAIE,MAAW,SAAkB,KAC7B,OAAOA,KAAW,YAAkBA,IACjCA,EAAOJ,EAAa,KAAK;AAAA,IAAA,CACjC,GAEKK,IAA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AAAhD,EAAO,cAAcyB;AAAA,IAAI;AAAA,IA4BpC,cAzBmB,CAACK,MACpB;;AAAA,eAAA9B,IAAAgD,EAAW,UAAX,gBAAAhD,EAAkB,aAAa8B,OAAS,QAAQ;;IAyBhD,qBAvB0B,CAAC5C,GAAuBgD,GAAsBC,MACxE;;AAAA,eAAAnC,IAAAgD,EAAW,UAAX,gBAAAhD,EAAkB,oBAAoBd,GAAQgD,GAAaC,OAAU,QAAQ,QAAQ;AAAA;AAAA,IAuBrF,qBArB0B,CAAC7B,MAC3B;;AAAA,eAAAN,IAAAgD,EAAW,UAAX,gBAAAhD,EAAkB,oBAAoBM,OAAU,QAAQ;;IAqBxD,UAnBe,OAAOiC,MAAqC;;AAC3D,MAAAU,EAAa,QAAQ,EAAE,GAAGA,EAAa,OAAO,GAAGV,KAC3C,QAAAvC,IAAAgD,EAAW,UAAX,gBAAAhD,EAAkB,SAASuC;AAAA,IAAS;AAAA,EAiB1C,CAGsB;AAC1B;ACvGA,MAAMe,KAAa;AAAA;AAAA,EAEjB,EAAE,MAAM,WAAW,WAAWC,GAAQ;AAAA,EACtC,EAAE,MAAM,eAAe,WAAWC,GAAY;AAAA,EAC9C,EAAE,MAAM,eAAe,WAAWC,GAAY;AAAA;AAAA;AAGhD;AAEO,SAASC,GAAQC,GAAqB;AAC3C,EAAAL,GAAW,QAAQ,CAAC,EAAE,MAAA7B,GAAM,WAAAmC,QAAgB;AACtC,IAAAD,EAAA,UAAUlC,GAAMmC,CAAS;AAAA,EAAA,CAC9B;AACH;AAEA,MAAeC,KAAA;AAAA,EACb,SAAAH;AAAA;AAAA,EAEA,SAAAH;AAAA;AAAA;AAGF;"}
|
|
1
|
+
{"version":3,"file":"element-component-pro.es.js","sources":["../src/ProForm/ProFormItem.vue","../src/ProForm/ProForm.vue","../src/ProForm/useForm.ts","../src/index.ts"],"sourcesContent":["<template>\n <el-form-item\n v-if=\"shouldRender\"\n v-show=\"shouldShow\"\n :prop=\"schema.field\"\n :required=\"schema.required\"\n :rules=\"effectiveRules\"\n >\n <template slot=\"label\">\n <span>{{ schema.label }}</span>\n <el-tooltip\n v-if=\"schema.helpMessage\"\n placement=\"top\"\n effect=\"light\"\n v-bind=\"schema.helpComponentProps || {}\"\n >\n <template slot=\"content\">\n <template v-if=\"Array.isArray(schema.helpMessage)\">\n <div v-for=\"(msg, i) in schema.helpMessage\" :key=\"i\" class=\"ecp-pro-form-item__help-item\">\n {{ msg }}\n </div>\n </template>\n <span v-else>{{ schema.helpMessage }}</span>\n </template>\n <i class=\"el-icon-question ecp-pro-form-item__help-icon\" />\n </el-tooltip>\n </template>\n <!-- render 自定义渲染 -->\n <template v-if=\"schema.render\">\n <component :is=\"renderComponent\" />\n </template>\n <!-- slot 自定义插槽(由 ProForm 传入 default slot) -->\n <slot v-else-if=\"hasSlot\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\" :values=\"formModel\" />\n <!-- 默认组件渲染 -->\n <template v-else>\n <el-input\n v-if=\"schema.component === 'input' || !schema.component\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请输入${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-input-number\n v-else-if=\"schema.component === 'input-number'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-select\n class=\"ecp-pro-form-item__select\"\n v-else-if=\"schema.component === 'select'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-option\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.label\"\n :value=\"opt.value\"\n />\n </el-select>\n <el-date-picker\n v-else-if=\"schema.component === 'date-picker'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-date-picker\n v-else-if=\"schema.component === 'date-range'\"\n v-model=\"formModel[schema.field]\"\n type=\"daterange\"\n range-separator=\"至\"\n start-placeholder=\"开始日期\"\n end-placeholder=\"结束日期\"\n value-format=\"yyyy-MM-dd\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-switch\n v-else-if=\"schema.component === 'switch'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-cascader\n v-else-if=\"schema.component === 'cascader'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-checkbox-group\n v-else-if=\"schema.component === 'checkbox'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-checkbox\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-checkbox>\n </el-checkbox-group>\n <el-radio-group\n v-else-if=\"schema.component === 'radio'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-radio\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-radio>\n </el-radio-group>\n </template>\n </el-form-item>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots, h } from 'vue'\nimport type { ProFormSchema, RenderCallbackParams } from '../types'\n\nconst props = defineProps<{\n schema: ProFormSchema\n formModel: Record<string, unknown>\n formDisabled?: boolean\n autoPlaceholder?: boolean\n formActionType?: import('../types').FormActionType\n}>()\n\nconst slots = useSlots()\n\nconst renderParams = computed<RenderCallbackParams>(() => ({\n schema: props.schema,\n values: props.formModel,\n model: props.formModel,\n field: props.schema.field,\n}))\n\nconst shouldRender = computed(() => {\n const ifShow = props.schema.ifShow\n if (ifShow === undefined) return true\n if (typeof ifShow === 'boolean') return ifShow\n return ifShow(renderParams.value)\n})\n\nconst shouldShow = computed(() => {\n const show = props.schema.show\n if (show === undefined) return true\n if (typeof show === 'boolean') return show\n return show(renderParams.value)\n})\n\nconst effectiveDisabled = computed(() => {\n if (props.formDisabled) return true\n const dyn = props.schema.dynamicDisabled\n if (dyn === undefined) return false\n if (typeof dyn === 'boolean') return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveRules = computed(() => {\n const dyn = props.schema.dynamicRules\n if (!dyn) return props.schema.rules\n if (Array.isArray(dyn)) return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveComponentPropsAndListeners = computed(() => {\n const cp = props.schema.componentProps\n if (!cp) return { props: {}, listeners: {} }\n const raw = typeof cp === 'function'\n ? cp({\n ...renderParams.value,\n formActionType: props.formActionType,\n })\n : { ...cp }\n const propsOnly: Record<string, unknown> = {}\n const listeners: Record<string, (...args: unknown[]) => unknown> = {}\n for (const [key, value] of Object.entries(raw)) {\n if (key.length > 2 && /^on[A-Za-z]/.test(key) && typeof value === 'function') {\n const eventName = key.slice(2).charAt(0).toLowerCase() + key.slice(3)\n listeners[eventName] = value as (...args: unknown[]) => unknown\n } else {\n propsOnly[key] = value\n }\n }\n return { props: propsOnly, listeners }\n})\n\nconst effectiveComponentProps = computed(() => effectiveComponentPropsAndListeners.value.props)\nconst effectiveComponentListeners = computed(() => effectiveComponentPropsAndListeners.value.listeners)\n\nconst hasSlot = computed(() => !!slots.default)\n\nconst getOptions = (props: Record<string, unknown>): Array<{ label: string; value: unknown }> | undefined => {\n const opts = props?.options\n return Array.isArray(opts) ? opts : undefined\n}\n\nconst renderComponent = computed(() => {\n const renderFn = props.schema.render\n if (!renderFn) return null\n return {\n render() {\n const result = renderFn(renderParams.value)\n if (Array.isArray(result)) {\n return h('span', result)\n }\n return result\n },\n }\n})\n</script>\n\n<style scoped>\n.ecp-pro-form-item__help-icon {\n margin-left: 4px;\n color: #909399;\n cursor: help;\n font-size: 14px;\n}\n.ecp-pro-form-item__help-icon:hover {\n color: #409eff;\n}\n.ecp-pro-form-item__help-item {\n margin-bottom: 4px;\n}\n.ecp-pro-form-item__help-item:last-child {\n margin-bottom: 0;\n}\n</style>\n","<template>\n <div ref=\"formWrapRef\" class=\"ecp-pro-form\">\n <el-form class=\"ecp-pro-form\" ref=\"formRef\" :model=\"formModel\" :rules=\"formRules\" :label-width=\"effectiveProps.labelWidth\"\n :label-position=\"effectiveProps.labelPosition\" :size=\"effectiveProps.size\" :disabled=\"effectiveProps.disabled\"\n v-bind=\"$attrs\" v-on=\"formListeners\">\n <slot name=\"formHeader\" />\n <el-row :gutter=\"effectiveProps.gutter\" :style=\"effectiveProps.baseRowStyle\">\n <template v-for=\"schema in displaySchemas\">\n <el-col v-if=\"shouldShow(schema)\" :key=\"schema.field\" v-bind=\"getColProps(schema)\"\n :offset=\"schema.colProps?.offset ?? effectiveProps.baseColProps?.offset ?? 0\" :data-field=\"schema.field\">\n <ProFormItem :schema=\"schema\" :form-model=\"formModel\" :form-disabled=\"effectiveProps.disabled\"\n :auto-placeholder=\"effectiveProps.autoSetPlaceholder\" :form-action-type=\"formActionRef\">\n <template v-if=\"slots[getSlotName(schema)]\">\n <slot :name=\"getSlotName(schema)\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\"\n :values=\"formModel\" />\n </template>\n </ProFormItem>\n </el-col>\n </template>\n <el-col class=\"ecp-pro-form_col\" v-if=\"effectiveProps.showActionButtonGroup\"\n v-bind=\"hasMoreFields ? { span: 24 } : effectiveProps.actionColOptions || { span: 6 }\">\n <FormActions :show-action-button-group=\"effectiveProps.showActionButtonGroup\"\n :show-submit-button=\"effectiveProps.showSubmitButton\" :show-reset-button=\"effectiveProps.showResetButton\"\n :submit-button-text=\"effectiveProps.submitButtonText\" :reset-button-text=\"effectiveProps.resetButtonText\"\n :submit-button-icon=\"effectiveProps.submitButtonIcon\" :reset-button-icon=\"effectiveProps.resetButtonIcon\"\n :submit-loading=\"submitLoading\" :show-advanced-button=\"effectiveProps.showAdvancedButton\"\n :has-more-fields=\"hasMoreFields\" :collapsed=\"collapsed\" :action-col-options=\"effectiveActionColOptions\"\n @submit=\"handleSubmit\" @reset=\"handleReset\" @toggle=\"collapsed = !collapsed\">\n <template slot=\"submitBefore\">\n <slot name=\"submitBefore\" />\n </template>\n <template slot=\"resetBefore\">\n <slot name=\"resetBefore\" />\n </template>\n <template slot=\"advanceBefore\">\n <slot name=\"advanceBefore\" />\n </template>\n <template slot=\"advanceAfter\">\n <slot name=\"advanceAfter\" />\n </template>\n <template slot=\"actions\">\n <slot name=\"actions\" />\n </template>\n </FormActions>\n </el-col>\n </el-row>\n <el-button v-if=\"effectiveProps.showAdvancedButton && hasMoreFields\" type=\"text\" class=\"ecp-form-actions__advance\"\n @click=\"collapsed = !collapsed\">\n <i class=\"el-icon-d-arrow-left\" :class=\"collapsed ? 'down' : 'up'\" />\n {{ collapsed ? '展开' : '收起' }}\n </el-button>\n <slot name=\"formFooter\" />\n </el-form>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, useSlots, onMounted, onUnmounted } from 'vue'\nimport ProFormItem from './ProFormItem.vue'\nimport FormActions from './FormActions.vue'\nimport type { ProFormSchema, ProFormProps, FormActionType, ColEx, ScrollToFieldOptions, FormListeners } from '../types'\n\nconst props = withDefaults(\n defineProps<{\n schemas?: ProFormSchema[]\n initialValues?: Record<string, unknown>\n labelWidth?: string\n labelPosition?: 'left' | 'right' | 'top'\n gutter?: number\n size?: 'medium' | 'small' | 'large'\n disabled?: boolean\n baseColProps?: ColEx\n baseRowStyle?: Record<string, string | number>\n autoSetPlaceholder?: boolean\n showSubmitButton?: boolean\n showResetButton?: boolean\n submitButtonText?: string\n resetButtonText?: string\n submitButtonIcon?: string\n resetButtonIcon?: string\n showActionButtonGroup?: boolean\n actionColOptions?: ColEx\n showAdvancedButton?: boolean\n autoAdvancedLine?: number\n alwaysShowLines?: number\n submitFunc?: () => Promise<void>\n resetFunc?: () => Promise<void>\n submitOnReset?: boolean\n formListeners?: FormListeners\n }>(),\n {\n labelWidth: '120px',\n labelPosition: 'right',\n gutter: 24,\n size: 'medium',\n autoSetPlaceholder: true,\n showSubmitButton: true,\n showResetButton: true,\n submitButtonText: '提交',\n resetButtonText: '重置',\n submitButtonIcon: 'el-icon-search',\n resetButtonIcon: 'el-icon-refresh-left',\n showActionButtonGroup: true,\n showAdvancedButton: false,\n autoAdvancedLine: 3,\n alwaysShowLines: 1,\n baseColProps: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n actionColOptions: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n submitOnReset: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'submit', values: Record<string, unknown>): void\n (e: 'reset'): void\n (e: 'register', formAction: FormActionType): void\n}>()\nconst slots = useSlots()\nconst formRef = ref()\nconst formWrapRef = ref()\nconst submitLoading = ref(false)\nconst collapsed = ref(true)\nconst formModel = ref<Record<string, unknown>>({})\nconst formRules = ref<Record<string, unknown[]>>({})\nconst innerSchemas = ref<ProFormSchema[]>([])\nconst innerProps = ref<Partial<ProFormProps>>({})\n\n/** Element UI 栅格断点 (px) */\nconst BREAKPOINTS = { xl: 1920, lg: 1200, md: 992, sm: 768 }\n\n/** 根据当前视口宽度获取 ColEx 的有效 span(与 el-col 断点逻辑一致) */\nconst getEffectiveSpan = (colProps?: ColEx | null, baseColProps?: ColEx | null, width?: number): number => {\n const w = width ?? (typeof window !== 'undefined' ? window.innerWidth : 1920)\n const col = colProps ?? {}\n const base = baseColProps ?? {}\n const fallback = base.span ?? 8\n if (w >= BREAKPOINTS.xl) return col.xl ?? base.xl ?? col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.lg) return col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.md) return col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n // if (w < BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n return col.xs ?? base.xs ?? col.span ?? fallback\n}\n\nconst effectiveProps = computed(() => ({ ...props, ...innerProps.value }))\nconst effectiveActionColOptions = computed(() => effectiveProps.value.actionColOptions ?? { span: 24 })\n\n/** 当前视口宽度,用于响应式计算 span */\nconst windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1920)\n\n/** 计算前 maxLines 行能容纳的 schema 数量(考虑栅格断点,每个 field 可有自己的 span) */\nconst getVisibleSchemaCount = (\n schemas: ProFormSchema[],\n baseColProps: ColEx | undefined,\n maxLines: number,\n width: number\n) => {\n let remaining = 24\n let rows = 1\n let count = 0\n for (const schema of schemas) {\n const span = getEffectiveSpan(schema.colProps, baseColProps, width)\n if (span > remaining) {\n rows++\n if (rows > maxLines) break\n remaining = 24 - span\n } else {\n remaining -= span\n }\n count++\n }\n return count\n}\n\nconst hasMoreFields = computed(() => {\n const schemas = innerSchemas.value.filter((s) => shouldShow(s))\n\n if (!effectiveProps.value.showAdvancedButton) return false\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n console.log(schemas.length, maxVisible)\n return schemas.length > maxVisible\n})\n\nconst formListeners = computed((): FormListeners => {\n return effectiveProps.value.formListeners ?? {}\n})\n\nconst displaySchemas = computed(() => {\n const schemas = innerSchemas.value.filter((s) => {\n return shouldShow(s)\n })\n if (!effectiveProps.value.showAdvancedButton || !collapsed.value) return schemas\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n return schemas.slice(0, maxVisible)\n})\n\nconst shouldShow = (schema: ProFormSchema) => {\n let ifShow = true\n let show = true\n if (typeof schema.ifShow === 'function') {\n ifShow = schema.ifShow({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.ifShow === 'boolean') {\n ifShow = schema.ifShow\n }\n if (typeof schema.show === 'function') {\n show = schema.show({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.show === 'boolean') {\n show = schema.show\n }\n return ifShow && show\n}\nconst getColProps = (schema: ProFormSchema) => {\n return schema.colProps ?? effectiveProps.value.baseColProps ?? {}\n}\nconst getSlotName = (schema: ProFormSchema) => schema.slot || schema.field\n\nconst initForm = () => {\n const model: Record<string, unknown> = {}\n const rules: Record<string, unknown[]> = {}\n const initialValues = effectiveProps.value.initialValues ?? props.initialValues\n innerSchemas.value.forEach((schema) => {\n model[schema.field] = schema.defaultValue ?? initialValues?.[schema.field]\n if (schema.rules?.length) rules[schema.field] = schema.rules\n })\n formModel.value = { ...formModel.value, ...model }\n formRules.value = rules\n}\n\nconst filterByIfShow = (values: Record<string, unknown>) => {\n const result = { ...values }\n innerSchemas.value.forEach((schema) => {\n const ifShow = schema.ifShow\n if (ifShow === undefined) return\n const visible = typeof ifShow === 'boolean' ? ifShow : ifShow({ schema, values, model: values, field: schema.field })\n if (!visible) delete result[schema.field]\n })\n return result\n}\n\nconst processFieldMapToTime = (values: Record<string, unknown>) => {\n const filtered = filterByIfShow(values)\n const fieldMap = innerProps.value.fieldMapToTime\n if (!fieldMap?.length) return filtered\n const result = { ...filtered }\n fieldMap.forEach(([field, [startKey, endKey]]) => {\n const val = result[field]\n if (Array.isArray(val) && val.length === 2) {\n delete result[field]\n ; (result as Record<string, unknown>)[startKey] = val[0]\n ; (result as Record<string, unknown>)[endKey] = val[1]\n }\n })\n return result\n}\n\nconst handleSubmit = async () => {\n try {\n await formRef.value?.validate()\n if (effectiveProps.value.submitFunc) {\n await effectiveProps.value.submitFunc()\n } else {\n submitLoading.value = true\n emit('submit', processFieldMapToTime({ ...formModel.value }))\n }\n } catch (e) {\n console.error('Form validation failed:', e)\n } finally {\n submitLoading.value = false\n }\n}\n\nconst handleReset = async () => {\n if (effectiveProps.value.resetFunc) {\n await effectiveProps.value.resetFunc()\n } else {\n formRef.value?.resetFields()\n initForm()\n emit('reset')\n if (effectiveProps.value.submitOnReset) await handleSubmit()\n }\n}\n\nconst setFieldsValue = (values: Record<string, unknown>) => {\n formModel.value = { ...formModel.value, ...values }\n return Promise.resolve()\n}\n\nconst getFieldsValue = () => processFieldMapToTime({ ...formModel.value })\n\nconst resetFields = async () => {\n formRef.value?.resetFields()\n initForm()\n}\n\nconst validate = (nameList?: string[]) =>\n formRef.value?.validate(nameList) ?? Promise.resolve()\n\nconst validateFields = (nameList?: string[]) => {\n if (!formRef.value) return Promise.resolve()\n if (!nameList?.length) return formRef.value.validate()\n return Promise.all(nameList.map((prop) => new Promise((resolve, reject) => {\n formRef.value.validateField(prop, (valid: boolean) => (valid ? resolve(undefined) : reject(new Error('Validation failed'))))\n })))\n}\n\nconst scrollToField = async (name: string, options?: ScrollToFieldOptions) => {\n const el = formWrapRef.value?.querySelector(`[data-field=\"${name}\"]`)\n if (el) {\n el.scrollIntoView({ behavior: options?.behavior ?? 'smooth', block: options?.block ?? 'nearest' })\n }\n return Promise.resolve()\n}\n\nconst clearValidate = (name?: string | string[]) => {\n formRef.value?.clearValidate(name)\n}\n\nconst updateSchema = async (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => {\n const list = Array.isArray(data) ? data : [data]\n list.forEach((item) => {\n const idx = innerSchemas.value.findIndex((s) => s.field === item.field)\n if (idx >= 0) innerSchemas.value[idx] = { ...innerSchemas.value[idx], ...item }\n })\n}\n\nconst appendSchemaByField = async (schema: ProFormSchema, prefixField?: string, first?: boolean) => {\n if (first) innerSchemas.value.unshift(schema)\n else if (prefixField) {\n const idx = innerSchemas.value.findIndex((s) => s.field === prefixField)\n innerSchemas.value.splice(idx + 1, 0, schema)\n } else innerSchemas.value.push(schema)\n initForm()\n}\n\nconst removeSchemaByField = async (field: string | string[]) => {\n const fields = Array.isArray(field) ? field : [field]\n innerSchemas.value = innerSchemas.value.filter((s) => !fields.includes(s.field))\n}\n\nconst setProps = async (formProps: Partial<ProFormProps>) => {\n innerProps.value = { ...innerProps.value, ...formProps }\n if (formProps.schemas) {\n innerSchemas.value = [...formProps.schemas]\n debugger\n initForm()\n }\n}\n\nconst formActionRef: FormActionType = {\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit: handleSubmit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n}\n\ndefineExpose(formActionRef)\n\nconst syncSchemas = () => {\n innerSchemas.value = [...(props.schemas ?? [])]\n initForm()\n}\n\nconst handleResize = () => {\n if (typeof window !== 'undefined') windowWidth.value = window.innerWidth\n}\n\nonMounted(() => {\n syncSchemas()\n emit('register', formActionRef)\n if (typeof window !== 'undefined') window.addEventListener('resize', handleResize)\n})\n\nonUnmounted(() => {\n if (typeof window !== 'undefined') window.removeEventListener('resize', handleResize)\n})\n\nwatch(() => [props.schemas, props.initialValues], syncSchemas, { deep: true })\n</script>\n\n<style scoped>\n.ecp-pro-form {\n padding: 16px;\n position: relative;\n}\n\n.ecp-pro-form__advance {\n margin-bottom: 16px;\n}\n\n.ecp-pro-form_col {\n position: relative;\n float: right;\n}\n\n.el-icon-d-arrow-left.up {\n transform: rotate(90deg);\n}\n\n.el-icon-d-arrow-left.down {\n transform: rotate(-90deg);\n}\n\n.ecp-form-actions__advance {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n</style>\n","import { ref, watch, unref, type Ref } from 'vue'\nimport type { ProFormSchema, ProFormProps, FormActionType } from '../types'\n\nexport interface UseFormProps extends ProFormProps {\n schemas?: ProFormSchema[]\n}\n\n/** 支持 ref/computed 的 props(参考 Vben Admin:参数 props 内的值可以是 computed 或者 ref 类型) */\nexport type UseFormPropsReactive = UseFormProps | Ref<UseFormProps | undefined>\n\nexport interface UseFormReturn {\n /** 用于 @register,接收表单实例的 formAction */\n register: (formAction: FormActionType) => void\n formAction: { value: FormActionType | null }\n getFieldsValue: () => Record<string, unknown>\n setFieldsValue: (values: Record<string, unknown>) => Promise<void>\n resetFields: () => Promise<void>\n validate: (nameList?: string[]) => Promise<unknown>\n validateFields: (nameList?: string[]) => Promise<unknown>\n submit: () => Promise<void>\n scrollToField: (name: string, options?: import('../types').ScrollToFieldOptions) => Promise<void>\n clearValidate: (name?: string | string[]) => void\n updateSchema: (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => Promise<void>\n appendSchemaByField: (schema: ProFormSchema, prefixField?: string, first?: boolean) => Promise<void>\n removeSchemaByField: (field: string | string[]) => Promise<void>\n setProps: (props: Partial<ProFormProps>) => Promise<void>\n}\n\nexport function useForm(props?: UseFormPropsReactive): [UseFormReturn['register'], Omit<UseFormReturn, 'register'>] {\n const formAction = ref<FormActionType | null>(null)\n const formPropsRef = ref<UseFormProps | undefined>(props ? unref(props as Ref<UseFormProps | undefined>) : undefined)\n\n const getFormProps = () => (props ? unref(props as Ref<UseFormProps | undefined>) : undefined) as UseFormProps | undefined\n\n const register = (action: FormActionType) => {\n formAction.value = action\n const formProps = getFormProps()\n debugger\n if (formProps && Object.keys(formProps).length > 0) {\n action.setProps(formProps)\n }\n }\n\n if (props) {\n watch(\n () => getFormProps(),\n (formProps) => {\n formPropsRef.value = formProps\n if (formProps && formAction.value) {\n formAction.value.setProps(formProps)\n }\n },\n { deep: true }\n )\n }\n\n const getFieldsValue = () => formAction.value?.getFieldsValue() ?? {}\n\n const setFieldsValue = async (values: Record<string, unknown>) => {\n await formAction.value?.setFieldsValue(values)\n }\n\n const resetFields = async () => {\n await formAction.value?.resetFields()\n }\n\n const validate = (nameList?: string[]) =>\n formAction.value?.validate(nameList) ?? Promise.resolve()\n\n const validateFields = (nameList?: string[]) =>\n formAction.value?.validateFields(nameList) ?? Promise.resolve()\n\n const submit = () => formAction.value?.submit() ?? Promise.resolve()\n\n const scrollToField = (name: string, options?: import('../types').ScrollToFieldOptions) =>\n formAction.value?.scrollToField(name, options) ?? Promise.resolve()\n\n const clearValidate = (name?: string | string[]) => {\n formAction.value?.clearValidate(name)\n }\n\n const updateSchema = (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) =>\n formAction.value?.updateSchema(data) ?? Promise.resolve()\n\n const appendSchemaByField = (schema: ProFormSchema, prefixField?: string, first?: boolean) =>\n formAction.value?.appendSchemaByField(schema, prefixField, first) ?? Promise.resolve()\n\n const removeSchemaByField = (field: string | string[]) =>\n formAction.value?.removeSchemaByField(field) ?? Promise.resolve()\n\n const setProps = async (formProps: Partial<ProFormProps>) => {\n formPropsRef.value = { ...formPropsRef.value, ...formProps }\n await formAction.value?.setProps(formProps)\n }\n\n const result: UseFormReturn = {\n register,\n formAction,\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n }\n\n return [register, result]\n}\n","import type { VueConstructor } from 'vue'\n// import ProTable from './ProTable'\nimport ProForm, { ProFormItem, FormActions } from './ProForm'\n// import ProCard from './ProCard'\n// import ProDescriptions from './ProDescriptions'\nimport { useForm } from './ProForm/useForm'\n\nexport { ProForm, ProFormItem, FormActions, useForm }\nexport * from './types'\n\nconst components = [\n // { name: 'ProTable', component: ProTable },\n { name: 'ProForm', component: ProForm },\n { name: 'ProFormItem', component: ProFormItem },\n { name: 'FormActions', component: FormActions }\n // { name: 'ProCard', component: ProCard },\n // { name: 'ProDescriptions', component: ProDescriptions },\n]\n\nexport function install(Vue: VueConstructor) {\n components.forEach(({ name, component }) => {\n Vue.component(name, component)\n })\n}\n\nexport default {\n install,\n // ProTable,\n ProForm,\n // ProCard,\n // ProDescriptions,\n}\n"],"names":["slots","useSlots","renderParams","computed","props","shouldRender","ifShow","shouldShow","show","effectiveDisabled","dyn","effectiveRules","effectiveComponentPropsAndListeners","cp","raw","propsOnly","listeners","key","value","eventName","effectiveComponentProps","effectiveComponentListeners","hasSlot","getOptions","opts","renderComponent","renderFn","result","h","formRef","ref","formWrapRef","submitLoading","collapsed","formModel","formRules","innerSchemas","innerProps","BREAKPOINTS","getEffectiveSpan","colProps","baseColProps","width","w","col","base","fallback","effectiveProps","effectiveActionColOptions","windowWidth","getVisibleSchemaCount","schemas","maxLines","remaining","rows","count","schema","span","hasMoreFields","s","lines","maxVisible","formListeners","displaySchemas","getColProps","getSlotName","initForm","model","rules","initialValues","_a","filterByIfShow","values","processFieldMapToTime","filtered","fieldMap","field","startKey","endKey","val","handleSubmit","emit","e","handleReset","setFieldsValue","getFieldsValue","resetFields","validate","nameList","validateFields","prop","resolve","reject","valid","scrollToField","name","options","el","clearValidate","updateSchema","data","item","idx","appendSchemaByField","prefixField","first","removeSchemaByField","fields","setProps","formProps","formActionRef","expose","syncSchemas","handleResize","onMounted","onUnmounted","watch","useForm","formAction","formPropsRef","unref","getFormProps","register","action","components","ProForm","ProFormItem","FormActions","install","Vue","component","index"],"mappings":";;;;;;;;;;;iBAoJMA,IAAQC,MAERC,IAAeC,EAA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AACH;AAEA,MAAeC,KAAA;AAAA,EACb,SAAAH;AAAA;AAAA,EAEA,SAAAH;AAAA;AAAA;AAGF;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(g,
|
|
2
|
-
`,document.head.appendChild(q);const le=i.defineComponent({__name:"ProFormItem",props:{schema:null,formModel:null,formDisabled:{type:Boolean},autoPlaceholder:{type:Boolean},formActionType:null},setup(b){const e=b,l=i.useSlots(),t=i.computed(()=>({schema:e.schema,values:e.formModel,model:e.formModel,field:e.schema.field})),s=i.computed(()=>{const f=e.schema.ifShow;return f===void 0?!0:typeof f=="boolean"?f:f(t.value)}),y=i.computed(()=>{const f=e.schema.show;return f===void 0?!0:typeof f=="boolean"?f:f(t.value)}),P=i.computed(()=>{if(e.formDisabled)return!0;const f=e.schema.dynamicDisabled;return f===void 0?!1:typeof f=="boolean"?f:f(t.value)}),C=i.computed(()=>{const f=e.schema.dynamicRules;return f?Array.isArray(f)?f:f(t.value):e.schema.rules}),h=i.computed(()=>{const f=e.schema.componentProps;if(!f)return{props:{},listeners:{}};const m=typeof f=="function"?f({...t.value,formActionType:e.formActionType}):{...f},k={},S={};for(const[n,u]of Object.entries(m))if(n.length>2&&/^on[A-Za-z]/.test(n)&&typeof u=="function"){const x=n.slice(2).charAt(0).toLowerCase()+n.slice(3);S[x]=u}else k[n]=u;return{props:k,listeners:S}}),p=i.computed(()=>h.value.props),M=i.computed(()=>h.value.listeners),_=i.computed(()=>!!l.default),w=f=>{const m=f==null?void 0:f.options;return Array.isArray(m)?m:void 0},F=i.computed(()=>{const f=e.schema.render;return f?{render(){const m=f(t.value);return Array.isArray(m)?i.h("span",m):m}}:null});return{__sfc:!0,props:e,slots:l,renderParams:t,shouldRender:s,shouldShow:y,effectiveDisabled:P,effectiveRules:C,effectiveComponentPropsAndListeners:h,effectiveComponentProps:p,effectiveComponentListeners:M,hasSlot:_,getOptions:w,renderComponent:F}}}),Pe="";function T(b,e,l,t,s,y,P,C){var h=typeof b=="function"?b.options:b;e&&(h.render=e,h.staticRenderFns=l,h._compiled=!0),t&&(h.functional=!0),y&&(h._scopeId="data-v-"+y);var p;if(P?(p=function(w){w=w||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!w&&typeof __VUE_SSR_CONTEXT__<"u"&&(w=__VUE_SSR_CONTEXT__),s&&s.call(this,w),w&&w._registeredComponents&&w._registeredComponents.add(P)},h._ssrRegister=p):s&&(p=C?function(){s.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:s),p)if(h.functional){h._injectStyles=p;var M=h.render;h.render=function(F,f){return p.call(f),M(F,f)}}else{var _=h.beforeCreate;h.beforeCreate=_?[].concat(_,p):[p]}return{exports:b,options:h}}var ne=function(){var e=this,l=e._self._c,t=e._self._setupProxy;return t.shouldRender?l("el-form-item",{directives:[{name:"show",rawName:"v-show",value:t.shouldShow,expression:"shouldShow"}],attrs:{prop:e.schema.field,required:e.schema.required,rules:t.effectiveRules}},[l("template",{slot:"label"},[l("span",[e._v(e._s(e.schema.label))]),e.schema.helpMessage?l("el-tooltip",e._b({attrs:{placement:"top",effect:"light"}},"el-tooltip",e.schema.helpComponentProps||{},!1),[l("template",{slot:"content"},[Array.isArray(e.schema.helpMessage)?e._l(e.schema.helpMessage,function(s,y){return l("div",{key:y,staticClass:"ecp-pro-form-item__help-item"},[e._v(" "+e._s(s)+" ")])}):l("span",[e._v(e._s(e.schema.helpMessage))])],2),l("i",{staticClass:"el-icon-question ecp-pro-form-item__help-icon"})],2):e._e()],1),e.schema.render?[l(t.renderComponent,{tag:"component"})]:t.hasSlot?e._t("default",null,{model:e.formModel,schema:e.schema,field:e.schema.field,values:e.formModel}):[e.schema.component==="input"||!e.schema.component?l("el-input",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请输入${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-input",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="input-number"?l("el-input-number",e._g(e._b({attrs:{placeholder:e.schema.placeholder,disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-input-number",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="select"?l("el-select",e._g(e._b({staticClass:"ecp-pro-form-item__select",attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-select",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-option",{key:String(s.value),attrs:{label:s.label,value:s.value}})}),1):e.schema.component==="date-picker"?l("el-date-picker",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-date-picker",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="date-range"?l("el-date-picker",e._g(e._b({attrs:{type:"daterange","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期","value-format":"yyyy-MM-dd",disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-date-picker",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="switch"?l("el-switch",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-switch",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="cascader"?l("el-cascader",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-cascader",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="checkbox"?l("el-checkbox-group",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-checkbox-group",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-checkbox",{key:String(s.value),attrs:{label:s.value}},[e._v(" "+e._s(s.label)+" ")])}),1):e.schema.component==="radio"?l("el-radio-group",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-radio-group",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-radio",{key:String(s.value),attrs:{label:s.value}},[e._v(" "+e._s(s.label)+" ")])}),1):e._e()]],2):e._e()},ae=[],re=T(le,ne,ae,!1,null,"0e0e5ebb",null,null);const V=re.exports,ie=i.defineComponent({__name:"FormActions",props:{showActionButtonGroup:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},submitButtonText:{default:"提交"},resetButtonText:{default:"重置"},submitButtonIcon:{default:"el-icon-search"},resetButtonIcon:{default:"el-icon-refresh-left"},submitLoading:{type:Boolean,default:!1},showAdvancedButton:{type:Boolean,default:!1},hasMoreFields:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!0},actionColOptions:null},emits:["submit","reset","toggle"],setup(b){return{__sfc:!0}}}),Fe="";var ce=function(){var e=this,l=e._self._c;return e._self._setupProxy,l("div",{staticClass:"ecp-form-actions"},[e._t("submitBefore"),e.showSubmitButton?l("el-button",{attrs:{type:"primary",icon:e.submitButtonIcon,loading:e.submitLoading},on:{click:function(t){return e.$emit("submit")}}},[e._v(" "+e._s(e.submitButtonText)+" ")]):e._e(),e._t("resetBefore"),e.showResetButton?l("el-button",{attrs:{icon:e.resetButtonIcon},on:{click:function(t){return e.$emit("reset")}}},[e._v(" "+e._s(e.resetButtonText)+" ")]):e._e(),e._t("actions")],2)},fe=[],de=T(ie,ce,fe,!1,null,"489c88d2",null,null);const L=de.exports,ue=i.defineComponent({__name:"ProForm",props:{schemas:null,initialValues:null,labelWidth:{default:"120px"},labelPosition:{default:"right"},gutter:{default:24},size:{default:"medium"},disabled:{type:Boolean},baseColProps:{default:()=>({xs:24,sm:12,md:12,lg:8,xl:6})},baseRowStyle:null,autoSetPlaceholder:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},submitButtonText:{default:"提交"},resetButtonText:{default:"重置"},submitButtonIcon:{default:"el-icon-search"},resetButtonIcon:{default:"el-icon-refresh-left"},showActionButtonGroup:{type:Boolean,default:!0},actionColOptions:{default:()=>({xs:24,sm:12,md:12,lg:8,xl:6})},showAdvancedButton:{type:Boolean,default:!1},autoAdvancedLine:{default:3},alwaysShowLines:{default:1},submitFunc:null,resetFunc:null,submitOnReset:{type:Boolean,default:!1},formListeners:null},emits:["submit","reset","register"],setup(b,{expose:e,emit:l}){const t=b,s=i.useSlots(),y=i.ref(),P=i.ref(),C=i.ref(!1),h=i.ref(!0),p=i.ref({}),M=i.ref({}),_=i.ref([]),w=i.ref({}),F={xl:1920,lg:1200,md:992,sm:768},f=(o,r,d)=>{const c=d??(typeof window<"u"?window.innerWidth:1920),a=o??{},v=r??{},B=v.span??8;return c>=F.xl?a.xl??v.xl??a.lg??v.lg??a.md??v.md??a.sm??v.sm??a.xs??v.xs??a.span??B:c>=F.lg?a.lg??v.lg??a.md??v.md??a.sm??v.sm??a.xs??v.xs??a.span??B:c>=F.md?a.md??v.md??a.sm??v.sm??a.xs??v.xs??a.span??B:c>=F.sm||c<F.sm?a.sm??v.sm??a.xs??v.xs??a.span??B:a.xs??v.xs??a.span??B},m=i.computed(()=>({...t,...w.value})),k=i.computed(()=>m.value.actionColOptions??{span:24}),S=i.ref(typeof window<"u"?window.innerWidth:1920),n=(o,r,d,c)=>{let a=24,v=1,B=0;for(const $ of o){const N=f($.colProps,r,c);if(N>a){if(v++,v>d)break;a=24-N}else a-=N;B++}return B},u=i.computed(()=>{const o=_.value.filter(a=>!a.hidden);if(!m.value.showAdvancedButton)return!1;const r=m.value.alwaysShowLines??1,d=m.value.baseColProps,c=n(o,d,r,S.value);return console.log(o.length,c),o.length>c}),x=i.computed(()=>m.value.formListeners??{}),R=i.computed(()=>{const o=_.value.filter(a=>U(a));if(!m.value.showAdvancedButton||!h.value)return o;const r=m.value.alwaysShowLines??1,d=m.value.baseColProps,c=n(o,d,r,S.value);return o.slice(0,c)}),U=o=>{let r=!0,d=!0;return typeof o.ifShow=="function"&&(r=o.ifShow({schema:o,values:p.value,model:p.value,field:o.field})),typeof o.ifShow=="boolean"&&(r=o.ifShow),typeof o.show=="function"&&(d=o.show({schema:o,values:p.value,model:p.value,field:o.field})),typeof o.show=="boolean"&&(d=o.show),r&&d},ye=o=>o.colProps??m.value.baseColProps??{},we=o=>o.slot||o.field,A=()=>{const o={},r={},d=m.value.initialValues??t.initialValues;_.value.forEach(c=>{var a;o[c.field]=c.defaultValue??(d==null?void 0:d[c.field]),(a=c.rules)!=null&&a.length&&(r[c.field]=c.rules)}),p.value={...p.value,...o},M.value=r},j=o=>{const r={...o};return _.value.forEach(d=>{const c=d.ifShow;if(c===void 0)return;(typeof c=="boolean"?c:c({schema:d,values:o,model:o,field:d.field}))||delete r[d.field]}),r},I=o=>{const r=j(o),d=w.value.fieldMapToTime;if(!(d!=null&&d.length))return r;const c={...r};return d.forEach(([a,[v,B]])=>{const $=c[a];Array.isArray($)&&$.length===2&&(delete c[a],c[v]=$[0],c[B]=$[1])}),c},O=async()=>{var o;try{await((o=y.value)==null?void 0:o.validate()),m.value.submitFunc?await m.value.submitFunc():(C.value=!0,l("submit",I({...p.value})))}catch(r){console.error("Form validation failed:",r)}finally{C.value=!1}},ge=async()=>{var o;m.value.resetFunc?await m.value.resetFunc():((o=y.value)==null||o.resetFields(),A(),l("reset"),m.value.submitOnReset&&await O())},X=o=>(p.value={...p.value,...o},Promise.resolve()),H=()=>I({...p.value}),K=async()=>{var o;(o=y.value)==null||o.resetFields(),A()},Z=o=>{var r;return((r=y.value)==null?void 0:r.validate(o))??Promise.resolve()},J=o=>y.value?o!=null&&o.length?Promise.all(o.map(r=>new Promise((d,c)=>{y.value.validateField(r,a=>a?d(void 0):c(new Error("Validation failed")))}))):y.value.validate():Promise.resolve(),Q=async(o,r)=>{var c;const d=(c=P.value)==null?void 0:c.querySelector(`[data-field="${o}"]`);return d&&d.scrollIntoView({behavior:(r==null?void 0:r.behavior)??"smooth",block:(r==null?void 0:r.block)??"nearest"}),Promise.resolve()},Y=o=>{var r;(r=y.value)==null||r.clearValidate(o)},ee=async o=>{(Array.isArray(o)?o:[o]).forEach(d=>{const c=_.value.findIndex(a=>a.field===d.field);c>=0&&(_.value[c]={..._.value[c],...d})})},te=async(o,r,d)=>{if(d)_.value.unshift(o);else if(r){const c=_.value.findIndex(a=>a.field===r);_.value.splice(c+1,0,o)}else _.value.push(o);A()},oe=async o=>{const r=Array.isArray(o)?o:[o];_.value=_.value.filter(d=>!r.includes(d.field))},se=async o=>{if(w.value={...w.value,...o},o.schemas){_.value=[...o.schemas];debugger;A()}},D={getFieldsValue:H,setFieldsValue:X,resetFields:K,validate:Z,validateFields:J,submit:O,scrollToField:Q,clearValidate:Y,updateSchema:ee,appendSchemaByField:te,removeSchemaByField:oe,setProps:se};e(D);const z=()=>{_.value=[...t.schemas??[]],A()},W=()=>{typeof window<"u"&&(S.value=window.innerWidth)};return i.onMounted(()=>{z(),l("register",D),typeof window<"u"&&window.addEventListener("resize",W)}),i.onUnmounted(()=>{typeof window<"u"&&window.removeEventListener("resize",W)}),i.watch(()=>[t.schemas,t.initialValues],z,{deep:!0}),{__sfc:!0,props:t,emit:l,slots:s,formRef:y,formWrapRef:P,submitLoading:C,collapsed:h,formModel:p,formRules:M,innerSchemas:_,innerProps:w,BREAKPOINTS:F,getEffectiveSpan:f,effectiveProps:m,effectiveActionColOptions:k,windowWidth:S,getVisibleSchemaCount:n,hasMoreFields:u,formListeners:x,displaySchemas:R,shouldShow:U,getColProps:ye,getSlotName:we,initForm:A,filterByIfShow:j,processFieldMapToTime:I,handleSubmit:O,handleReset:ge,setFieldsValue:X,getFieldsValue:H,resetFields:K,validate:Z,validateFields:J,scrollToField:Q,clearValidate:Y,updateSchema:ee,appendSchemaByField:te,removeSchemaByField:oe,setProps:se,formActionRef:D,syncSchemas:z,handleResize:W,ProFormItem:V,FormActions:L}}}),Be="";var me=function(){var e=this,l=e._self._c,t=e._self._setupProxy;return l("div",{ref:"formWrapRef",staticClass:"ecp-pro-form"},[l("el-form",e._g(e._b({ref:"formRef",staticClass:"ecp-pro-form",attrs:{model:t.formModel,rules:t.formRules,"label-width":t.effectiveProps.labelWidth,"label-position":t.effectiveProps.labelPosition,size:t.effectiveProps.size,disabled:t.effectiveProps.disabled}},"el-form",e.$attrs,!1),t.formListeners),[e._t("formHeader"),l("el-row",{style:t.effectiveProps.baseRowStyle,attrs:{gutter:t.effectiveProps.gutter}},[e._l(t.displaySchemas,function(s){var y,P;return[t.shouldShow(s)?l("el-col",e._b({key:s.field,attrs:{offset:((y=s.colProps)==null?void 0:y.offset)??((P=t.effectiveProps.baseColProps)==null?void 0:P.offset)??0,"data-field":s.field}},"el-col",t.getColProps(s),!1),[l(t.ProFormItem,{attrs:{schema:s,"form-model":t.formModel,"form-disabled":t.effectiveProps.disabled,"auto-placeholder":t.effectiveProps.autoSetPlaceholder,"form-action-type":t.formActionRef}},[t.slots[t.getSlotName(s)]?[e._t(t.getSlotName(s),null,{model:t.formModel,schema:s,field:s.field,values:t.formModel})]:e._e()],2)],1):e._e()]}),t.effectiveProps.showActionButtonGroup?l("el-col",e._b({staticClass:"ecp-pro-form_col"},"el-col",t.hasMoreFields?{span:24}:t.effectiveProps.actionColOptions||{span:6},!1),[l(t.FormActions,{attrs:{"show-action-button-group":t.effectiveProps.showActionButtonGroup,"show-submit-button":t.effectiveProps.showSubmitButton,"show-reset-button":t.effectiveProps.showResetButton,"submit-button-text":t.effectiveProps.submitButtonText,"reset-button-text":t.effectiveProps.resetButtonText,"submit-button-icon":t.effectiveProps.submitButtonIcon,"reset-button-icon":t.effectiveProps.resetButtonIcon,"submit-loading":t.submitLoading,"show-advanced-button":t.effectiveProps.showAdvancedButton,"has-more-fields":t.hasMoreFields,collapsed:t.collapsed,"action-col-options":t.effectiveActionColOptions},on:{submit:t.handleSubmit,reset:t.handleReset,toggle:function(s){t.collapsed=!t.collapsed}}},[l("template",{slot:"submitBefore"},[e._t("submitBefore")],2),l("template",{slot:"resetBefore"},[e._t("resetBefore")],2),l("template",{slot:"advanceBefore"},[e._t("advanceBefore")],2),l("template",{slot:"advanceAfter"},[e._t("advanceAfter")],2),l("template",{slot:"actions"},[e._t("actions")],2)],2)],1):e._e()],2),t.effectiveProps.showAdvancedButton&&t.hasMoreFields?l("el-button",{staticClass:"ecp-form-actions__advance",attrs:{type:"text"},on:{click:function(s){t.collapsed=!t.collapsed}}},[l("i",{staticClass:"el-icon-d-arrow-left",class:t.collapsed?"down":"up"}),e._v(" "+e._s(t.collapsed?"展开":"收起")+" ")]):e._e(),e._t("formFooter")],2)],1)},pe=[],ve=T(ue,me,pe,!1,null,"d75b0fb1",null,null);const E=ve.exports;function he(b){const e=i.ref(null),l=i.ref(b?i.unref(b):void 0),t=()=>b?i.unref(b):void 0,s=n=>{e.value=n;const u=t();debugger;u&&Object.keys(u).length>0&&n.setProps(u)};return b&&i.watch(()=>t(),n=>{l.value=n,n&&e.value&&e.value.setProps(n)},{deep:!0}),[s,{register:s,formAction:e,getFieldsValue:()=>{var n;return((n=e.value)==null?void 0:n.getFieldsValue())??{}},setFieldsValue:async n=>{var u;await((u=e.value)==null?void 0:u.setFieldsValue(n))},resetFields:async()=>{var n;await((n=e.value)==null?void 0:n.resetFields())},validate:n=>{var u;return((u=e.value)==null?void 0:u.validate(n))??Promise.resolve()},validateFields:n=>{var u;return((u=e.value)==null?void 0:u.validateFields(n))??Promise.resolve()},submit:()=>{var n;return((n=e.value)==null?void 0:n.submit())??Promise.resolve()},scrollToField:(n,u)=>{var x;return((x=e.value)==null?void 0:x.scrollToField(n,u))??Promise.resolve()},clearValidate:n=>{var u;(u=e.value)==null||u.clearValidate(n)},updateSchema:n=>{var u;return((u=e.value)==null?void 0:u.updateSchema(n))??Promise.resolve()},appendSchemaByField:(n,u,x)=>{var R;return((R=e.value)==null?void 0:R.appendSchemaByField(n,u,x))??Promise.resolve()},removeSchemaByField:n=>{var u;return((u=e.value)==null?void 0:u.removeSchemaByField(n))??Promise.resolve()},setProps:async n=>{var u;l.value={...l.value,...n},await((u=e.value)==null?void 0:u.setProps(n))}}]}const _e=[{name:"ProForm",component:E},{name:"ProFormItem",component:V},{name:"FormActions",component:L}];function G(b){_e.forEach(({name:e,component:l})=>{b.component(e,l)})}const be={install:G,ProForm:E};g.FormActions=L,g.ProForm=E,g.ProFormItem=V,g.default=be,g.install=G,g.useForm=he,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(g,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(g=typeof globalThis<"u"?globalThis:g||self,r(g.ElementComponentPro={},g.Vue))})(this,function(g,r){"use strict";var G=document.createElement("style");G.textContent=`.ecp-pro-form-item__help-icon[data-v-cfc968c5]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-cfc968c5]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-cfc968c5]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-cfc968c5]:last-child{margin-bottom:0}.ecp-form-actions[data-v-489c88d2]{text-align:right}.ecp-form-actions__advance[data-v-489c88d2]{margin-right:8px}.el-icon-d-arrow-left.up[data-v-489c88d2]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-489c88d2]{transform:rotate(-90deg)}.ecp-pro-form[data-v-af9453ad]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-af9453ad]{margin-bottom:16px}.ecp-pro-form_col[data-v-af9453ad]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-af9453ad]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-af9453ad]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-af9453ad]{position:absolute;bottom:0;left:50%;transform:translate(-50%,-50%)}
|
|
2
|
+
`,document.head.appendChild(G);const le=r.defineComponent({__name:"ProFormItem",props:{schema:null,formModel:null,formDisabled:{type:Boolean},autoPlaceholder:{type:Boolean},formActionType:null},setup(b){const e=b,l=r.useSlots(),t=r.computed(()=>({schema:e.schema,values:e.formModel,model:e.formModel,field:e.schema.field})),s=r.computed(()=>{const f=e.schema.ifShow;return f===void 0?!0:typeof f=="boolean"?f:f(t.value)}),y=r.computed(()=>{const f=e.schema.show;return f===void 0?!0:typeof f=="boolean"?f:f(t.value)}),P=r.computed(()=>{if(e.formDisabled)return!0;const f=e.schema.dynamicDisabled;return f===void 0?!1:typeof f=="boolean"?f:f(t.value)}),C=r.computed(()=>{const f=e.schema.dynamicRules;return f?Array.isArray(f)?f:f(t.value):e.schema.rules}),v=r.computed(()=>{const f=e.schema.componentProps;if(!f)return{props:{},listeners:{}};const m=typeof f=="function"?f({...t.value,formActionType:e.formActionType}):{...f},R={},S={};for(const[n,u]of Object.entries(m))if(n.length>2&&/^on[A-Za-z]/.test(n)&&typeof u=="function"){const x=n.slice(2).charAt(0).toLowerCase()+n.slice(3);S[x]=u}else R[n]=u;return{props:R,listeners:S}}),p=r.computed(()=>v.value.props),M=r.computed(()=>v.value.listeners),h=r.computed(()=>!!l.default),w=f=>{const m=f==null?void 0:f.options;return Array.isArray(m)?m:void 0},F=r.computed(()=>{const f=e.schema.render;return f?{render(){const m=f(t.value);return Array.isArray(m)?r.h("span",m):m}}:null});return{__sfc:!0,props:e,slots:l,renderParams:t,shouldRender:s,shouldShow:y,effectiveDisabled:P,effectiveRules:C,effectiveComponentPropsAndListeners:v,effectiveComponentProps:p,effectiveComponentListeners:M,hasSlot:h,getOptions:w,renderComponent:F}}}),Pe="";function T(b,e,l,t,s,y,P,C){var v=typeof b=="function"?b.options:b;e&&(v.render=e,v.staticRenderFns=l,v._compiled=!0),t&&(v.functional=!0),y&&(v._scopeId="data-v-"+y);var p;if(P?(p=function(w){w=w||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!w&&typeof __VUE_SSR_CONTEXT__<"u"&&(w=__VUE_SSR_CONTEXT__),s&&s.call(this,w),w&&w._registeredComponents&&w._registeredComponents.add(P)},v._ssrRegister=p):s&&(p=C?function(){s.call(this,(v.functional?this.parent:this).$root.$options.shadowRoot)}:s),p)if(v.functional){v._injectStyles=p;var M=v.render;v.render=function(F,f){return p.call(f),M(F,f)}}else{var h=v.beforeCreate;v.beforeCreate=h?[].concat(h,p):[p]}return{exports:b,options:v}}var ne=function(){var e=this,l=e._self._c,t=e._self._setupProxy;return t.shouldRender?l("el-form-item",{directives:[{name:"show",rawName:"v-show",value:t.shouldShow,expression:"shouldShow"}],attrs:{prop:e.schema.field,required:e.schema.required,rules:t.effectiveRules}},[l("template",{slot:"label"},[l("span",[e._v(e._s(e.schema.label))]),e.schema.helpMessage?l("el-tooltip",e._b({attrs:{placement:"top",effect:"light"}},"el-tooltip",e.schema.helpComponentProps||{},!1),[l("template",{slot:"content"},[Array.isArray(e.schema.helpMessage)?e._l(e.schema.helpMessage,function(s,y){return l("div",{key:y,staticClass:"ecp-pro-form-item__help-item"},[e._v(" "+e._s(s)+" ")])}):l("span",[e._v(e._s(e.schema.helpMessage))])],2),l("i",{staticClass:"el-icon-question ecp-pro-form-item__help-icon"})],2):e._e()],1),e.schema.render?[l(t.renderComponent,{tag:"component"})]:t.hasSlot?e._t("default",null,{model:e.formModel,schema:e.schema,field:e.schema.field,values:e.formModel}):[e.schema.component==="input"||!e.schema.component?l("el-input",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请输入${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-input",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="input-number"?l("el-input-number",e._g(e._b({attrs:{placeholder:e.schema.placeholder,disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-input-number",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="select"?l("el-select",e._g(e._b({staticClass:"ecp-pro-form-item__select",attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-select",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-option",{key:String(s.value),attrs:{label:s.label,value:s.value}})}),1):e.schema.component==="date-picker"?l("el-date-picker",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-date-picker",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="date-range"?l("el-date-picker",e._g(e._b({attrs:{type:"daterange","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期","value-format":"yyyy-MM-dd",disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-date-picker",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="switch"?l("el-switch",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-switch",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="cascader"?l("el-cascader",e._g(e._b({attrs:{placeholder:e.schema.placeholder||(e.autoPlaceholder?`请选择${e.schema.label}`:void 0),disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-cascader",t.effectiveComponentProps,!1),t.effectiveComponentListeners)):e.schema.component==="checkbox"?l("el-checkbox-group",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-checkbox-group",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-checkbox",{key:String(s.value),attrs:{label:s.value}},[e._v(" "+e._s(s.label)+" ")])}),1):e.schema.component==="radio"?l("el-radio-group",e._g(e._b({attrs:{disabled:t.effectiveDisabled},model:{value:e.formModel[e.schema.field],callback:function(s){e.$set(e.formModel,e.schema.field,s)},expression:"formModel[schema.field]"}},"el-radio-group",t.effectiveComponentProps,!1),t.effectiveComponentListeners),e._l(t.getOptions(t.effectiveComponentProps)||[],function(s){return l("el-radio",{key:String(s.value),attrs:{label:s.value}},[e._v(" "+e._s(s.label)+" ")])}),1):e._e()]],2):e._e()},ae=[],re=T(le,ne,ae,!1,null,"cfc968c5",null,null);const V=re.exports,ie=r.defineComponent({__name:"FormActions",props:{showActionButtonGroup:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},submitButtonText:{default:"提交"},resetButtonText:{default:"重置"},submitButtonIcon:{default:"el-icon-search"},resetButtonIcon:{default:"el-icon-refresh-left"},submitLoading:{type:Boolean,default:!1},showAdvancedButton:{type:Boolean,default:!1},hasMoreFields:{type:Boolean,default:!1},collapsed:{type:Boolean,default:!0},actionColOptions:null},emits:["submit","reset","toggle"],setup(b){return{__sfc:!0}}}),Fe="";var ce=function(){var e=this,l=e._self._c;return e._self._setupProxy,l("div",{staticClass:"ecp-form-actions"},[e._t("submitBefore"),e.showSubmitButton?l("el-button",{attrs:{type:"primary",icon:e.submitButtonIcon,loading:e.submitLoading},on:{click:function(t){return e.$emit("submit")}}},[e._v(" "+e._s(e.submitButtonText)+" ")]):e._e(),e._t("resetBefore"),e.showResetButton?l("el-button",{attrs:{icon:e.resetButtonIcon},on:{click:function(t){return e.$emit("reset")}}},[e._v(" "+e._s(e.resetButtonText)+" ")]):e._e(),e._t("actions")],2)},fe=[],de=T(ie,ce,fe,!1,null,"489c88d2",null,null);const L=de.exports,ue=r.defineComponent({__name:"ProForm",props:{schemas:null,initialValues:null,labelWidth:{default:"120px"},labelPosition:{default:"right"},gutter:{default:24},size:{default:"medium"},disabled:{type:Boolean},baseColProps:{default:()=>({xs:24,sm:12,md:12,lg:8,xl:6})},baseRowStyle:null,autoSetPlaceholder:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},submitButtonText:{default:"提交"},resetButtonText:{default:"重置"},submitButtonIcon:{default:"el-icon-search"},resetButtonIcon:{default:"el-icon-refresh-left"},showActionButtonGroup:{type:Boolean,default:!0},actionColOptions:{default:()=>({xs:24,sm:12,md:12,lg:8,xl:6})},showAdvancedButton:{type:Boolean,default:!1},autoAdvancedLine:{default:3},alwaysShowLines:{default:1},submitFunc:null,resetFunc:null,submitOnReset:{type:Boolean,default:!1},formListeners:null},emits:["submit","reset","register"],setup(b,{expose:e,emit:l}){const t=b,s=r.useSlots(),y=r.ref(),P=r.ref(),C=r.ref(!1),v=r.ref(!0),p=r.ref({}),M=r.ref({}),h=r.ref([]),w=r.ref({}),F={xl:1920,lg:1200,md:992,sm:768},f=(o,a,d)=>{const c=d??(typeof window<"u"?window.innerWidth:1920),i=o??{},_=a??{},B=_.span??8;return c>=F.xl?i.xl??_.xl??i.lg??_.lg??i.md??_.md??i.sm??_.sm??i.xs??_.xs??i.span??B:c>=F.lg?i.lg??_.lg??i.md??_.md??i.sm??_.sm??i.xs??_.xs??i.span??B:c>=F.md?i.md??_.md??i.sm??_.sm??i.xs??_.xs??i.span??B:c>=F.sm?i.sm??_.sm??i.xs??_.xs??i.span??B:i.xs??_.xs??i.span??B},m=r.computed(()=>({...t,...w.value})),R=r.computed(()=>m.value.actionColOptions??{span:24}),S=r.ref(typeof window<"u"?window.innerWidth:1920),n=(o,a,d,c)=>{let i=24,_=1,B=0;for(const $ of o){const q=f($.colProps,a,c);if(q>i){if(_++,_>d)break;i=24-q}else i-=q;B++}return B},u=r.computed(()=>{const o=h.value.filter(i=>I(i));if(!m.value.showAdvancedButton)return!1;const a=m.value.alwaysShowLines??1,d=m.value.baseColProps,c=n(o,d,a,S.value);return console.log(o.length,c),o.length>c}),x=r.computed(()=>m.value.formListeners??{}),k=r.computed(()=>{const o=h.value.filter(i=>I(i));if(!m.value.showAdvancedButton||!v.value)return o;const a=m.value.alwaysShowLines??1,d=m.value.baseColProps,c=n(o,d,a,S.value);return o.slice(0,c)}),I=o=>{let a=!0,d=!0;return typeof o.ifShow=="function"&&(a=o.ifShow({schema:o,values:p.value,model:p.value,field:o.field})),typeof o.ifShow=="boolean"&&(a=o.ifShow),typeof o.show=="function"&&(d=o.show({schema:o,values:p.value,model:p.value,field:o.field})),typeof o.show=="boolean"&&(d=o.show),a&&d},ye=o=>o.colProps??m.value.baseColProps??{},we=o=>o.slot||o.field,A=()=>{const o={},a={},d=m.value.initialValues??t.initialValues;h.value.forEach(c=>{var i;o[c.field]=c.defaultValue??(d==null?void 0:d[c.field]),(i=c.rules)!=null&&i.length&&(a[c.field]=c.rules)}),p.value={...p.value,...o},M.value=a},j=o=>{const a={...o};return h.value.forEach(d=>{const c=d.ifShow;if(c===void 0)return;(typeof c=="boolean"?c:c({schema:d,values:o,model:o,field:d.field}))||delete a[d.field]}),a},O=o=>{const a=j(o),d=w.value.fieldMapToTime;if(!(d!=null&&d.length))return a;const c={...a};return d.forEach(([i,[_,B]])=>{const $=c[i];Array.isArray($)&&$.length===2&&(delete c[i],c[_]=$[0],c[B]=$[1])}),c},D=async()=>{var o;try{await((o=y.value)==null?void 0:o.validate()),m.value.submitFunc?await m.value.submitFunc():(C.value=!0,l("submit",O({...p.value})))}catch(a){console.error("Form validation failed:",a)}finally{C.value=!1}},ge=async()=>{var o;m.value.resetFunc?await m.value.resetFunc():((o=y.value)==null||o.resetFields(),A(),l("reset"),m.value.submitOnReset&&await D())},X=o=>(p.value={...p.value,...o},Promise.resolve()),H=()=>O({...p.value}),K=async()=>{var o;(o=y.value)==null||o.resetFields(),A()},Z=o=>{var a;return((a=y.value)==null?void 0:a.validate(o))??Promise.resolve()},J=o=>y.value?o!=null&&o.length?Promise.all(o.map(a=>new Promise((d,c)=>{y.value.validateField(a,i=>i?d(void 0):c(new Error("Validation failed")))}))):y.value.validate():Promise.resolve(),Q=async(o,a)=>{var c;const d=(c=P.value)==null?void 0:c.querySelector(`[data-field="${o}"]`);return d&&d.scrollIntoView({behavior:(a==null?void 0:a.behavior)??"smooth",block:(a==null?void 0:a.block)??"nearest"}),Promise.resolve()},Y=o=>{var a;(a=y.value)==null||a.clearValidate(o)},ee=async o=>{(Array.isArray(o)?o:[o]).forEach(d=>{const c=h.value.findIndex(i=>i.field===d.field);c>=0&&(h.value[c]={...h.value[c],...d})})},te=async(o,a,d)=>{if(d)h.value.unshift(o);else if(a){const c=h.value.findIndex(i=>i.field===a);h.value.splice(c+1,0,o)}else h.value.push(o);A()},oe=async o=>{const a=Array.isArray(o)?o:[o];h.value=h.value.filter(d=>!a.includes(d.field))},se=async o=>{if(w.value={...w.value,...o},o.schemas){h.value=[...o.schemas];debugger;A()}},z={getFieldsValue:H,setFieldsValue:X,resetFields:K,validate:Z,validateFields:J,submit:D,scrollToField:Q,clearValidate:Y,updateSchema:ee,appendSchemaByField:te,removeSchemaByField:oe,setProps:se};e(z);const W=()=>{h.value=[...t.schemas??[]],A()},N=()=>{typeof window<"u"&&(S.value=window.innerWidth)};return r.onMounted(()=>{W(),l("register",z),typeof window<"u"&&window.addEventListener("resize",N)}),r.onUnmounted(()=>{typeof window<"u"&&window.removeEventListener("resize",N)}),r.watch(()=>[t.schemas,t.initialValues],W,{deep:!0}),{__sfc:!0,props:t,emit:l,slots:s,formRef:y,formWrapRef:P,submitLoading:C,collapsed:v,formModel:p,formRules:M,innerSchemas:h,innerProps:w,BREAKPOINTS:F,getEffectiveSpan:f,effectiveProps:m,effectiveActionColOptions:R,windowWidth:S,getVisibleSchemaCount:n,hasMoreFields:u,formListeners:x,displaySchemas:k,shouldShow:I,getColProps:ye,getSlotName:we,initForm:A,filterByIfShow:j,processFieldMapToTime:O,handleSubmit:D,handleReset:ge,setFieldsValue:X,getFieldsValue:H,resetFields:K,validate:Z,validateFields:J,scrollToField:Q,clearValidate:Y,updateSchema:ee,appendSchemaByField:te,removeSchemaByField:oe,setProps:se,formActionRef:z,syncSchemas:W,handleResize:N,ProFormItem:V,FormActions:L}}}),Be="";var me=function(){var e=this,l=e._self._c,t=e._self._setupProxy;return l("div",{ref:"formWrapRef",staticClass:"ecp-pro-form"},[l("el-form",e._g(e._b({ref:"formRef",staticClass:"ecp-pro-form",attrs:{model:t.formModel,rules:t.formRules,"label-width":t.effectiveProps.labelWidth,"label-position":t.effectiveProps.labelPosition,size:t.effectiveProps.size,disabled:t.effectiveProps.disabled}},"el-form",e.$attrs,!1),t.formListeners),[e._t("formHeader"),l("el-row",{style:t.effectiveProps.baseRowStyle,attrs:{gutter:t.effectiveProps.gutter}},[e._l(t.displaySchemas,function(s){var y,P;return[t.shouldShow(s)?l("el-col",e._b({key:s.field,attrs:{offset:((y=s.colProps)==null?void 0:y.offset)??((P=t.effectiveProps.baseColProps)==null?void 0:P.offset)??0,"data-field":s.field}},"el-col",t.getColProps(s),!1),[l(t.ProFormItem,{attrs:{schema:s,"form-model":t.formModel,"form-disabled":t.effectiveProps.disabled,"auto-placeholder":t.effectiveProps.autoSetPlaceholder,"form-action-type":t.formActionRef}},[t.slots[t.getSlotName(s)]?[e._t(t.getSlotName(s),null,{model:t.formModel,schema:s,field:s.field,values:t.formModel})]:e._e()],2)],1):e._e()]}),t.effectiveProps.showActionButtonGroup?l("el-col",e._b({staticClass:"ecp-pro-form_col"},"el-col",t.hasMoreFields?{span:24}:t.effectiveProps.actionColOptions||{span:6},!1),[l(t.FormActions,{attrs:{"show-action-button-group":t.effectiveProps.showActionButtonGroup,"show-submit-button":t.effectiveProps.showSubmitButton,"show-reset-button":t.effectiveProps.showResetButton,"submit-button-text":t.effectiveProps.submitButtonText,"reset-button-text":t.effectiveProps.resetButtonText,"submit-button-icon":t.effectiveProps.submitButtonIcon,"reset-button-icon":t.effectiveProps.resetButtonIcon,"submit-loading":t.submitLoading,"show-advanced-button":t.effectiveProps.showAdvancedButton,"has-more-fields":t.hasMoreFields,collapsed:t.collapsed,"action-col-options":t.effectiveActionColOptions},on:{submit:t.handleSubmit,reset:t.handleReset,toggle:function(s){t.collapsed=!t.collapsed}}},[l("template",{slot:"submitBefore"},[e._t("submitBefore")],2),l("template",{slot:"resetBefore"},[e._t("resetBefore")],2),l("template",{slot:"advanceBefore"},[e._t("advanceBefore")],2),l("template",{slot:"advanceAfter"},[e._t("advanceAfter")],2),l("template",{slot:"actions"},[e._t("actions")],2)],2)],1):e._e()],2),t.effectiveProps.showAdvancedButton&&t.hasMoreFields?l("el-button",{staticClass:"ecp-form-actions__advance",attrs:{type:"text"},on:{click:function(s){t.collapsed=!t.collapsed}}},[l("i",{staticClass:"el-icon-d-arrow-left",class:t.collapsed?"down":"up"}),e._v(" "+e._s(t.collapsed?"展开":"收起")+" ")]):e._e(),e._t("formFooter")],2)],1)},pe=[],ve=T(ue,me,pe,!1,null,"af9453ad",null,null);const E=ve.exports;function he(b){const e=r.ref(null),l=r.ref(b?r.unref(b):void 0),t=()=>b?r.unref(b):void 0,s=n=>{e.value=n;const u=t();debugger;u&&Object.keys(u).length>0&&n.setProps(u)};return b&&r.watch(()=>t(),n=>{l.value=n,n&&e.value&&e.value.setProps(n)},{deep:!0}),[s,{register:s,formAction:e,getFieldsValue:()=>{var n;return((n=e.value)==null?void 0:n.getFieldsValue())??{}},setFieldsValue:async n=>{var u;await((u=e.value)==null?void 0:u.setFieldsValue(n))},resetFields:async()=>{var n;await((n=e.value)==null?void 0:n.resetFields())},validate:n=>{var u;return((u=e.value)==null?void 0:u.validate(n))??Promise.resolve()},validateFields:n=>{var u;return((u=e.value)==null?void 0:u.validateFields(n))??Promise.resolve()},submit:()=>{var n;return((n=e.value)==null?void 0:n.submit())??Promise.resolve()},scrollToField:(n,u)=>{var x;return((x=e.value)==null?void 0:x.scrollToField(n,u))??Promise.resolve()},clearValidate:n=>{var u;(u=e.value)==null||u.clearValidate(n)},updateSchema:n=>{var u;return((u=e.value)==null?void 0:u.updateSchema(n))??Promise.resolve()},appendSchemaByField:(n,u,x)=>{var k;return((k=e.value)==null?void 0:k.appendSchemaByField(n,u,x))??Promise.resolve()},removeSchemaByField:n=>{var u;return((u=e.value)==null?void 0:u.removeSchemaByField(n))??Promise.resolve()},setProps:async n=>{var u;l.value={...l.value,...n},await((u=e.value)==null?void 0:u.setProps(n))}}]}const _e=[{name:"ProForm",component:E},{name:"ProFormItem",component:V},{name:"FormActions",component:L}];function U(b){_e.forEach(({name:e,component:l})=>{b.component(e,l)})}const be={install:U,ProForm:E};g.FormActions=L,g.ProForm=E,g.ProFormItem=V,g.default=be,g.install=U,g.useForm=he,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
3
3
|
//# sourceMappingURL=element-component-pro.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-component-pro.umd.js","sources":["../src/ProForm/ProFormItem.vue","../src/ProForm/ProForm.vue","../src/ProForm/useForm.ts","../src/index.ts"],"sourcesContent":["<template>\n <el-form-item\n v-if=\"shouldRender\"\n v-show=\"shouldShow\"\n :prop=\"schema.field\"\n :required=\"schema.required\"\n :rules=\"effectiveRules\"\n >\n <template slot=\"label\">\n <span>{{ schema.label }}</span>\n <el-tooltip\n v-if=\"schema.helpMessage\"\n placement=\"top\"\n effect=\"light\"\n v-bind=\"schema.helpComponentProps || {}\"\n >\n <template slot=\"content\">\n <template v-if=\"Array.isArray(schema.helpMessage)\">\n <div v-for=\"(msg, i) in schema.helpMessage\" :key=\"i\" class=\"ecp-pro-form-item__help-item\">\n {{ msg }}\n </div>\n </template>\n <span v-else>{{ schema.helpMessage }}</span>\n </template>\n <i class=\"el-icon-question ecp-pro-form-item__help-icon\" />\n </el-tooltip>\n </template>\n <!-- render 自定义渲染 -->\n <template v-if=\"schema.render\">\n <component :is=\"renderComponent\" />\n </template>\n <!-- slot 自定义插槽(由 ProForm 传入 default slot) -->\n <slot v-else-if=\"hasSlot\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\" :values=\"formModel\" />\n <!-- 默认组件渲染 -->\n <template v-else>\n <el-input\n v-if=\"schema.component === 'input' || !schema.component\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请输入${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-input-number\n v-else-if=\"schema.component === 'input-number'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-select\n class=\"ecp-pro-form-item__select\"\n v-else-if=\"schema.component === 'select'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-option\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.label\"\n :value=\"opt.value\"\n />\n </el-select>\n <el-date-picker\n v-else-if=\"schema.component === 'date-picker'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-date-picker\n v-else-if=\"schema.component === 'date-range'\"\n v-model=\"formModel[schema.field]\"\n type=\"daterange\"\n range-separator=\"至\"\n start-placeholder=\"开始日期\"\n end-placeholder=\"结束日期\"\n value-format=\"yyyy-MM-dd\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-switch\n v-else-if=\"schema.component === 'switch'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-cascader\n v-else-if=\"schema.component === 'cascader'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-checkbox-group\n v-else-if=\"schema.component === 'checkbox'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-checkbox\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-checkbox>\n </el-checkbox-group>\n <el-radio-group\n v-else-if=\"schema.component === 'radio'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-radio\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-radio>\n </el-radio-group>\n </template>\n </el-form-item>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots, h } from 'vue'\nimport type { ProFormSchema, RenderCallbackParams } from '../types'\n\nconst props = defineProps<{\n schema: ProFormSchema\n formModel: Record<string, unknown>\n formDisabled?: boolean\n autoPlaceholder?: boolean\n formActionType?: import('../types').FormActionType\n}>()\n\nconst slots = useSlots()\n\nconst renderParams = computed<RenderCallbackParams>(() => ({\n schema: props.schema,\n values: props.formModel,\n model: props.formModel,\n field: props.schema.field,\n}))\n\nconst shouldRender = computed(() => {\n const ifShow = props.schema.ifShow\n if (ifShow === undefined) return true\n if (typeof ifShow === 'boolean') return ifShow\n return ifShow(renderParams.value)\n})\n\nconst shouldShow = computed(() => {\n const show = props.schema.show\n if (show === undefined) return true\n if (typeof show === 'boolean') return show\n return show(renderParams.value)\n})\n\nconst effectiveDisabled = computed(() => {\n if (props.formDisabled) return true\n const dyn = props.schema.dynamicDisabled\n if (dyn === undefined) return false\n if (typeof dyn === 'boolean') return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveRules = computed(() => {\n const dyn = props.schema.dynamicRules\n if (!dyn) return props.schema.rules\n if (Array.isArray(dyn)) return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveComponentPropsAndListeners = computed(() => {\n const cp = props.schema.componentProps\n if (!cp) return { props: {}, listeners: {} }\n const raw = typeof cp === 'function'\n ? cp({\n ...renderParams.value,\n formActionType: props.formActionType,\n })\n : { ...cp }\n const propsOnly: Record<string, unknown> = {}\n const listeners: Record<string, (...args: unknown[]) => unknown> = {}\n for (const [key, value] of Object.entries(raw)) {\n if (key.length > 2 && /^on[A-Za-z]/.test(key) && typeof value === 'function') {\n const eventName = key.slice(2).charAt(0).toLowerCase() + key.slice(3)\n listeners[eventName] = value as (...args: unknown[]) => unknown\n } else {\n propsOnly[key] = value\n }\n }\n return { props: propsOnly, listeners }\n})\n\nconst effectiveComponentProps = computed(() => effectiveComponentPropsAndListeners.value.props)\nconst effectiveComponentListeners = computed(() => effectiveComponentPropsAndListeners.value.listeners)\n\nconst hasSlot = computed(() => !!slots.default)\n\nconst getOptions = (props: Record<string, unknown>): Array<{ label: string; value: unknown }> | undefined => {\n const opts = props?.options\n return Array.isArray(opts) ? opts : undefined\n}\n\nconst renderComponent = computed(() => {\n const renderFn = props.schema.render\n if (!renderFn) return null\n return {\n render() {\n const result = renderFn(renderParams.value)\n if (Array.isArray(result)) {\n return h('span', result)\n }\n return result\n },\n }\n})\n</script>\n\n<style scoped>\n.ecp-pro-form-item__help-icon {\n margin-left: 4px;\n color: #909399;\n cursor: help;\n font-size: 14px;\n}\n.ecp-pro-form-item__help-icon:hover {\n color: #409eff;\n}\n.ecp-pro-form-item__help-item {\n margin-bottom: 4px;\n}\n.ecp-pro-form-item__help-item:last-child {\n margin-bottom: 0;\n}\n.ecp-pro-form-item__select {\n display: block;\n}\n</style>\n","<template>\n <div ref=\"formWrapRef\" class=\"ecp-pro-form\">\n <el-form class=\"ecp-pro-form\" ref=\"formRef\" :model=\"formModel\" :rules=\"formRules\" :label-width=\"effectiveProps.labelWidth\"\n :label-position=\"effectiveProps.labelPosition\" :size=\"effectiveProps.size\" :disabled=\"effectiveProps.disabled\"\n v-bind=\"$attrs\" v-on=\"formListeners\">\n <slot name=\"formHeader\" />\n <el-row :gutter=\"effectiveProps.gutter\" :style=\"effectiveProps.baseRowStyle\">\n <template v-for=\"schema in displaySchemas\">\n <el-col v-if=\"shouldShow(schema)\" :key=\"schema.field\" v-bind=\"getColProps(schema)\"\n :offset=\"schema.colProps?.offset ?? effectiveProps.baseColProps?.offset ?? 0\" :data-field=\"schema.field\">\n <ProFormItem :schema=\"schema\" :form-model=\"formModel\" :form-disabled=\"effectiveProps.disabled\"\n :auto-placeholder=\"effectiveProps.autoSetPlaceholder\" :form-action-type=\"formActionRef\">\n <template v-if=\"slots[getSlotName(schema)]\">\n <slot :name=\"getSlotName(schema)\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\"\n :values=\"formModel\" />\n </template>\n </ProFormItem>\n </el-col>\n </template>\n <el-col class=\"ecp-pro-form_col\" v-if=\"effectiveProps.showActionButtonGroup\"\n v-bind=\"hasMoreFields ? { span: 24 } : effectiveProps.actionColOptions || { span: 6 }\">\n <FormActions :show-action-button-group=\"effectiveProps.showActionButtonGroup\"\n :show-submit-button=\"effectiveProps.showSubmitButton\" :show-reset-button=\"effectiveProps.showResetButton\"\n :submit-button-text=\"effectiveProps.submitButtonText\" :reset-button-text=\"effectiveProps.resetButtonText\"\n :submit-button-icon=\"effectiveProps.submitButtonIcon\" :reset-button-icon=\"effectiveProps.resetButtonIcon\"\n :submit-loading=\"submitLoading\" :show-advanced-button=\"effectiveProps.showAdvancedButton\"\n :has-more-fields=\"hasMoreFields\" :collapsed=\"collapsed\" :action-col-options=\"effectiveActionColOptions\"\n @submit=\"handleSubmit\" @reset=\"handleReset\" @toggle=\"collapsed = !collapsed\">\n <template slot=\"submitBefore\">\n <slot name=\"submitBefore\" />\n </template>\n <template slot=\"resetBefore\">\n <slot name=\"resetBefore\" />\n </template>\n <template slot=\"advanceBefore\">\n <slot name=\"advanceBefore\" />\n </template>\n <template slot=\"advanceAfter\">\n <slot name=\"advanceAfter\" />\n </template>\n <template slot=\"actions\">\n <slot name=\"actions\" />\n </template>\n </FormActions>\n </el-col>\n </el-row>\n <el-button v-if=\"effectiveProps.showAdvancedButton && hasMoreFields\" type=\"text\" class=\"ecp-form-actions__advance\"\n @click=\"collapsed = !collapsed\">\n <i class=\"el-icon-d-arrow-left\" :class=\"collapsed ? 'down' : 'up'\" />\n {{ collapsed ? '展开' : '收起' }}\n </el-button>\n <slot name=\"formFooter\" />\n </el-form>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, useSlots, onMounted, onUnmounted } from 'vue'\nimport ProFormItem from './ProFormItem.vue'\nimport FormActions from './FormActions.vue'\nimport type { ProFormSchema, ProFormProps, FormActionType, ColEx, ScrollToFieldOptions, FormListeners } from '../types'\n\nconst props = withDefaults(\n defineProps<{\n schemas?: ProFormSchema[]\n initialValues?: Record<string, unknown>\n labelWidth?: string\n labelPosition?: 'left' | 'right' | 'top'\n gutter?: number\n size?: 'medium' | 'small' | 'large'\n disabled?: boolean\n baseColProps?: ColEx\n baseRowStyle?: Record<string, string | number>\n autoSetPlaceholder?: boolean\n showSubmitButton?: boolean\n showResetButton?: boolean\n submitButtonText?: string\n resetButtonText?: string\n submitButtonIcon?: string\n resetButtonIcon?: string\n showActionButtonGroup?: boolean\n actionColOptions?: ColEx\n showAdvancedButton?: boolean\n autoAdvancedLine?: number\n alwaysShowLines?: number\n submitFunc?: () => Promise<void>\n resetFunc?: () => Promise<void>\n submitOnReset?: boolean\n formListeners?: FormListeners\n }>(),\n {\n labelWidth: '120px',\n labelPosition: 'right',\n gutter: 24,\n size: 'medium',\n autoSetPlaceholder: true,\n showSubmitButton: true,\n showResetButton: true,\n submitButtonText: '提交',\n resetButtonText: '重置',\n submitButtonIcon: 'el-icon-search',\n resetButtonIcon: 'el-icon-refresh-left',\n showActionButtonGroup: true,\n showAdvancedButton: false,\n autoAdvancedLine: 3,\n alwaysShowLines: 1,\n baseColProps: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n actionColOptions: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n submitOnReset: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'submit', values: Record<string, unknown>): void\n (e: 'reset'): void\n (e: 'register', formAction: FormActionType): void\n}>()\nconst slots = useSlots()\nconst formRef = ref()\nconst formWrapRef = ref()\nconst submitLoading = ref(false)\nconst collapsed = ref(true)\nconst formModel = ref<Record<string, unknown>>({})\nconst formRules = ref<Record<string, unknown[]>>({})\nconst innerSchemas = ref<ProFormSchema[]>([])\nconst innerProps = ref<Partial<ProFormProps>>({})\n\n/** Element UI 栅格断点 (px) */\nconst BREAKPOINTS = { xl: 1920, lg: 1200, md: 992, sm: 768 }\n\n/** 根据当前视口宽度获取 ColEx 的有效 span(与 el-col 断点逻辑一致) */\nconst getEffectiveSpan = (colProps?: ColEx | null, baseColProps?: ColEx | null, width?: number): number => {\n const w = width ?? (typeof window !== 'undefined' ? window.innerWidth : 1920)\n const col = colProps ?? {}\n const base = baseColProps ?? {}\n const fallback = base.span ?? 8\n if (w >= BREAKPOINTS.xl) return col.xl ?? base.xl ?? col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.lg) return col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.md) return col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w < BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n return col.xs ?? base.xs ?? col.span ?? fallback\n}\n\nconst effectiveProps = computed(() => ({ ...props, ...innerProps.value }))\nconst effectiveActionColOptions = computed(() => effectiveProps.value.actionColOptions ?? { span: 24 })\n\n/** 当前视口宽度,用于响应式计算 span */\nconst windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1920)\n\n/** 计算前 maxLines 行能容纳的 schema 数量(考虑栅格断点,每个 field 可有自己的 span) */\nconst getVisibleSchemaCount = (\n schemas: ProFormSchema[],\n baseColProps: ColEx | undefined,\n maxLines: number,\n width: number\n) => {\n let remaining = 24\n let rows = 1\n let count = 0\n for (const schema of schemas) {\n const span = getEffectiveSpan(schema.colProps, baseColProps, width)\n if (span > remaining) {\n rows++\n if (rows > maxLines) break\n remaining = 24 - span\n } else {\n remaining -= span\n }\n count++\n }\n return count\n}\n\nconst hasMoreFields = computed(() => {\n const schemas = innerSchemas.value.filter((s) => !s.hidden)\n\n if (!effectiveProps.value.showAdvancedButton) return false\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n console.log(schemas.length, maxVisible)\n return schemas.length > maxVisible\n})\n\nconst formListeners = computed((): FormListeners => {\n return effectiveProps.value.formListeners ?? {}\n})\n\nconst displaySchemas = computed(() => {\n const schemas = innerSchemas.value.filter((s) => {\n return shouldShow(s)\n })\n if (!effectiveProps.value.showAdvancedButton || !collapsed.value) return schemas\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n return schemas.slice(0, maxVisible)\n})\n\nconst shouldShow = (schema: ProFormSchema) => {\n let ifShow = true\n let show = true\n if (typeof schema.ifShow === 'function') {\n ifShow = schema.ifShow({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.ifShow === 'boolean') {\n ifShow = schema.ifShow\n }\n if (typeof schema.show === 'function') {\n show = schema.show({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.show === 'boolean') {\n show = schema.show\n }\n return ifShow && show\n}\nconst getColProps = (schema: ProFormSchema) => {\n return schema.colProps ?? effectiveProps.value.baseColProps ?? {}\n}\nconst getSlotName = (schema: ProFormSchema) => schema.slot || schema.field\n\nconst initForm = () => {\n const model: Record<string, unknown> = {}\n const rules: Record<string, unknown[]> = {}\n const initialValues = effectiveProps.value.initialValues ?? props.initialValues\n innerSchemas.value.forEach((schema) => {\n model[schema.field] = schema.defaultValue ?? initialValues?.[schema.field]\n if (schema.rules?.length) rules[schema.field] = schema.rules\n })\n formModel.value = { ...formModel.value, ...model }\n formRules.value = rules\n}\n\nconst filterByIfShow = (values: Record<string, unknown>) => {\n const result = { ...values }\n innerSchemas.value.forEach((schema) => {\n const ifShow = schema.ifShow\n if (ifShow === undefined) return\n const visible = typeof ifShow === 'boolean' ? ifShow : ifShow({ schema, values, model: values, field: schema.field })\n if (!visible) delete result[schema.field]\n })\n return result\n}\n\nconst processFieldMapToTime = (values: Record<string, unknown>) => {\n const filtered = filterByIfShow(values)\n const fieldMap = innerProps.value.fieldMapToTime\n if (!fieldMap?.length) return filtered\n const result = { ...filtered }\n fieldMap.forEach(([field, [startKey, endKey]]) => {\n const val = result[field]\n if (Array.isArray(val) && val.length === 2) {\n delete result[field]\n ; (result as Record<string, unknown>)[startKey] = val[0]\n ; (result as Record<string, unknown>)[endKey] = val[1]\n }\n })\n return result\n}\n\nconst handleSubmit = async () => {\n try {\n await formRef.value?.validate()\n if (effectiveProps.value.submitFunc) {\n await effectiveProps.value.submitFunc()\n } else {\n submitLoading.value = true\n emit('submit', processFieldMapToTime({ ...formModel.value }))\n }\n } catch (e) {\n console.error('Form validation failed:', e)\n } finally {\n submitLoading.value = false\n }\n}\n\nconst handleReset = async () => {\n if (effectiveProps.value.resetFunc) {\n await effectiveProps.value.resetFunc()\n } else {\n formRef.value?.resetFields()\n initForm()\n emit('reset')\n if (effectiveProps.value.submitOnReset) await handleSubmit()\n }\n}\n\nconst setFieldsValue = (values: Record<string, unknown>) => {\n formModel.value = { ...formModel.value, ...values }\n return Promise.resolve()\n}\n\nconst getFieldsValue = () => processFieldMapToTime({ ...formModel.value })\n\nconst resetFields = async () => {\n formRef.value?.resetFields()\n initForm()\n}\n\nconst validate = (nameList?: string[]) =>\n formRef.value?.validate(nameList) ?? Promise.resolve()\n\nconst validateFields = (nameList?: string[]) => {\n if (!formRef.value) return Promise.resolve()\n if (!nameList?.length) return formRef.value.validate()\n return Promise.all(nameList.map((prop) => new Promise((resolve, reject) => {\n formRef.value.validateField(prop, (valid: boolean) => (valid ? resolve(undefined) : reject(new Error('Validation failed'))))\n })))\n}\n\nconst scrollToField = async (name: string, options?: ScrollToFieldOptions) => {\n const el = formWrapRef.value?.querySelector(`[data-field=\"${name}\"]`)\n if (el) {\n el.scrollIntoView({ behavior: options?.behavior ?? 'smooth', block: options?.block ?? 'nearest' })\n }\n return Promise.resolve()\n}\n\nconst clearValidate = (name?: string | string[]) => {\n formRef.value?.clearValidate(name)\n}\n\nconst updateSchema = async (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => {\n const list = Array.isArray(data) ? data : [data]\n list.forEach((item) => {\n const idx = innerSchemas.value.findIndex((s) => s.field === item.field)\n if (idx >= 0) innerSchemas.value[idx] = { ...innerSchemas.value[idx], ...item }\n })\n}\n\nconst appendSchemaByField = async (schema: ProFormSchema, prefixField?: string, first?: boolean) => {\n if (first) innerSchemas.value.unshift(schema)\n else if (prefixField) {\n const idx = innerSchemas.value.findIndex((s) => s.field === prefixField)\n innerSchemas.value.splice(idx + 1, 0, schema)\n } else innerSchemas.value.push(schema)\n initForm()\n}\n\nconst removeSchemaByField = async (field: string | string[]) => {\n const fields = Array.isArray(field) ? field : [field]\n innerSchemas.value = innerSchemas.value.filter((s) => !fields.includes(s.field))\n}\n\nconst setProps = async (formProps: Partial<ProFormProps>) => {\n innerProps.value = { ...innerProps.value, ...formProps }\n if (formProps.schemas) {\n innerSchemas.value = [...formProps.schemas]\n debugger\n initForm()\n }\n}\n\nconst formActionRef: FormActionType = {\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit: handleSubmit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n}\n\ndefineExpose(formActionRef)\n\nconst syncSchemas = () => {\n innerSchemas.value = [...(props.schemas ?? [])]\n initForm()\n}\n\nconst handleResize = () => {\n if (typeof window !== 'undefined') windowWidth.value = window.innerWidth\n}\n\nonMounted(() => {\n syncSchemas()\n emit('register', formActionRef)\n if (typeof window !== 'undefined') window.addEventListener('resize', handleResize)\n})\n\nonUnmounted(() => {\n if (typeof window !== 'undefined') window.removeEventListener('resize', handleResize)\n})\n\nwatch(() => [props.schemas, props.initialValues], syncSchemas, { deep: true })\n</script>\n\n<style scoped>\n.ecp-pro-form {\n padding: 16px;\n position: relative;\n}\n\n.ecp-pro-form__advance {\n margin-bottom: 16px;\n}\n\n.ecp-pro-form_col {\n position: relative;\n float: right;\n}\n\n.el-icon-d-arrow-left.up {\n transform: rotate(90deg);\n}\n\n.el-icon-d-arrow-left.down {\n transform: rotate(-90deg);\n}\n\n.ecp-form-actions__advance {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n</style>\n","import { ref, watch, unref, type Ref } from 'vue'\nimport type { ProFormSchema, ProFormProps, FormActionType } from '../types'\n\nexport interface UseFormProps extends ProFormProps {\n schemas?: ProFormSchema[]\n}\n\n/** 支持 ref/computed 的 props(参考 Vben Admin:参数 props 内的值可以是 computed 或者 ref 类型) */\nexport type UseFormPropsReactive = UseFormProps | Ref<UseFormProps | undefined>\n\nexport interface UseFormReturn {\n /** 用于 @register,接收表单实例的 formAction */\n register: (formAction: FormActionType) => void\n formAction: { value: FormActionType | null }\n getFieldsValue: () => Record<string, unknown>\n setFieldsValue: (values: Record<string, unknown>) => Promise<void>\n resetFields: () => Promise<void>\n validate: (nameList?: string[]) => Promise<unknown>\n validateFields: (nameList?: string[]) => Promise<unknown>\n submit: () => Promise<void>\n scrollToField: (name: string, options?: import('../types').ScrollToFieldOptions) => Promise<void>\n clearValidate: (name?: string | string[]) => void\n updateSchema: (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => Promise<void>\n appendSchemaByField: (schema: ProFormSchema, prefixField?: string, first?: boolean) => Promise<void>\n removeSchemaByField: (field: string | string[]) => Promise<void>\n setProps: (props: Partial<ProFormProps>) => Promise<void>\n}\n\nexport function useForm(props?: UseFormPropsReactive): [UseFormReturn['register'], Omit<UseFormReturn, 'register'>] {\n const formAction = ref<FormActionType | null>(null)\n const formPropsRef = ref<UseFormProps | undefined>(props ? unref(props as Ref<UseFormProps | undefined>) : undefined)\n\n const getFormProps = () => (props ? unref(props as Ref<UseFormProps | undefined>) : undefined) as UseFormProps | undefined\n\n const register = (action: FormActionType) => {\n formAction.value = action\n const formProps = getFormProps()\n debugger\n if (formProps && Object.keys(formProps).length > 0) {\n action.setProps(formProps)\n }\n }\n\n if (props) {\n watch(\n () => getFormProps(),\n (formProps) => {\n formPropsRef.value = formProps\n if (formProps && formAction.value) {\n formAction.value.setProps(formProps)\n }\n },\n { deep: true }\n )\n }\n\n const getFieldsValue = () => formAction.value?.getFieldsValue() ?? {}\n\n const setFieldsValue = async (values: Record<string, unknown>) => {\n await formAction.value?.setFieldsValue(values)\n }\n\n const resetFields = async () => {\n await formAction.value?.resetFields()\n }\n\n const validate = (nameList?: string[]) =>\n formAction.value?.validate(nameList) ?? Promise.resolve()\n\n const validateFields = (nameList?: string[]) =>\n formAction.value?.validateFields(nameList) ?? Promise.resolve()\n\n const submit = () => formAction.value?.submit() ?? Promise.resolve()\n\n const scrollToField = (name: string, options?: import('../types').ScrollToFieldOptions) =>\n formAction.value?.scrollToField(name, options) ?? Promise.resolve()\n\n const clearValidate = (name?: string | string[]) => {\n formAction.value?.clearValidate(name)\n }\n\n const updateSchema = (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) =>\n formAction.value?.updateSchema(data) ?? Promise.resolve()\n\n const appendSchemaByField = (schema: ProFormSchema, prefixField?: string, first?: boolean) =>\n formAction.value?.appendSchemaByField(schema, prefixField, first) ?? Promise.resolve()\n\n const removeSchemaByField = (field: string | string[]) =>\n formAction.value?.removeSchemaByField(field) ?? Promise.resolve()\n\n const setProps = async (formProps: Partial<ProFormProps>) => {\n formPropsRef.value = { ...formPropsRef.value, ...formProps }\n await formAction.value?.setProps(formProps)\n }\n\n const result: UseFormReturn = {\n register,\n formAction,\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n }\n\n return [register, result]\n}\n","import type { VueConstructor } from 'vue'\n// import ProTable from './ProTable'\nimport ProForm, { ProFormItem, FormActions } from './ProForm'\n// import ProCard from './ProCard'\n// import ProDescriptions from './ProDescriptions'\nimport { useForm } from './ProForm/useForm'\n\nexport { ProForm, ProFormItem, FormActions, useForm }\nexport * from './types'\n\nconst components = [\n // { name: 'ProTable', component: ProTable },\n { name: 'ProForm', component: ProForm },\n { name: 'ProFormItem', component: ProFormItem },\n { name: 'FormActions', component: FormActions }\n // { name: 'ProCard', component: ProCard },\n // { name: 'ProDescriptions', component: ProDescriptions },\n]\n\nexport function install(Vue: VueConstructor) {\n components.forEach(({ name, component }) => {\n Vue.component(name, component)\n })\n}\n\nexport default {\n install,\n // ProTable,\n ProForm,\n // ProCard,\n // ProDescriptions,\n}\n"],"names":["slots","useSlots","renderParams","computed","props","shouldRender","ifShow","shouldShow","show","effectiveDisabled","dyn","effectiveRules","effectiveComponentPropsAndListeners","cp","raw","propsOnly","listeners","key","value","eventName","effectiveComponentProps","effectiveComponentListeners","hasSlot","getOptions","opts","renderComponent","renderFn","result","h","formRef","ref","formWrapRef","submitLoading","collapsed","formModel","formRules","innerSchemas","innerProps","BREAKPOINTS","getEffectiveSpan","colProps","baseColProps","width","w","col","base","fallback","effectiveProps","effectiveActionColOptions","windowWidth","getVisibleSchemaCount","schemas","maxLines","remaining","rows","count","schema","span","hasMoreFields","s","lines","maxVisible","formListeners","displaySchemas","getColProps","getSlotName","initForm","model","rules","initialValues","_a","filterByIfShow","values","processFieldMapToTime","filtered","fieldMap","field","startKey","endKey","val","handleSubmit","emit","e","handleReset","setFieldsValue","getFieldsValue","resetFields","validate","nameList","validateFields","prop","resolve","reject","valid","scrollToField","name","options","el","clearValidate","updateSchema","data","item","idx","appendSchemaByField","prefixField","first","removeSchemaByField","fields","setProps","formProps","formActionRef","expose","syncSchemas","handleResize","onMounted","onUnmounted","watch","useForm","formAction","formPropsRef","unref","getFormProps","register","action","components","ProForm","ProFormItem","FormActions","install","Vue","component","index"],"mappings":";qNAoJMA,EAAQC,EAAAA,WAERC,EAAeC,EAAAA,SAA+B,KAAO,CACzD,OAAQC,EAAM,OACd,OAAQA,EAAM,UACd,MAAOA,EAAM,UACb,MAAOA,EAAM,OAAO,KACpB,EAAA,EAEIC,EAAeF,EAAAA,SAAS,IAAM,CAC5B,MAAAG,EAASF,EAAM,OAAO,OAC5B,OAAIE,IAAW,OAAkB,GAC7B,OAAOA,GAAW,UAAkBA,EACjCA,EAAOJ,EAAa,KAAK,CAAA,CACjC,EAEKK,EAAaJ,EAAAA,SAAS,IAAM,CAC1B,MAAAK,EAAOJ,EAAM,OAAO,KAC1B,OAAII,IAAS,OAAkB,GAC3B,OAAOA,GAAS,UAAkBA,EAC/BA,EAAKN,EAAa,KAAK,CAAA,CAC/B,EAEKO,EAAoBN,EAAAA,SAAS,IAAM,CACvC,GAAIC,EAAM,aAAqB,MAAA,GACzB,MAAAM,EAAMN,EAAM,OAAO,gBACzB,OAAIM,IAAQ,OAAkB,GAC1B,OAAOA,GAAQ,UAAkBA,EAC9BA,EAAIR,EAAa,KAAK,CAAA,CAC9B,EAEKS,EAAiBR,EAAAA,SAAS,IAAM,CAC9B,MAAAO,EAAMN,EAAM,OAAO,aACzB,OAAKM,EACD,MAAM,QAAQA,CAAG,EAAUA,EACxBA,EAAIR,EAAa,KAAK,EAFZE,EAAM,OAAO,KAED,CAC9B,EAE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AvB0B,CAAC5C,EAAuBgD,EAAsBC,IACxE,OAAA,QAAAnC,EAAAgD,EAAW,QAAX,YAAAhD,EAAkB,oBAAoBd,EAAQgD,EAAaC,KAAU,QAAQ,QAAQ,GAuBrF,oBArB2B7B,GAC3B,OAAA,QAAAN,EAAAgD,EAAW,QAAX,YAAAhD,EAAkB,oBAAoBM,KAAU,QAAQ,WAqBxD,SAnBe,MAAOiC,GAAqC,OAC3DU,EAAa,MAAQ,CAAE,GAAGA,EAAa,MAAO,GAAGV,GAC3C,OAAAvC,EAAAgD,EAAW,QAAX,YAAAhD,EAAkB,SAASuC,GAAS,CAiB1C,CAGsB,CAC1B,CCvGA,MAAMe,GAAa,CAEjB,CAAE,KAAM,UAAW,UAAWC,CAAQ,EACtC,CAAE,KAAM,cAAe,UAAWC,CAAY,EAC9C,CAAE,KAAM,cAAe,UAAWC,CAAY,CAGhD,EAEO,SAASC,EAAQC,EAAqB,CAC3CL,GAAW,QAAQ,CAAC,CAAE,KAAA7B,EAAM,UAAAmC,KAAgB,CACtCD,EAAA,UAAUlC,EAAMmC,CAAS,CAAA,CAC9B,CACH,CAEe,MAAAC,GAAA,CACb,QAAAH,EAEA,QAAAH,CAGF"}
|
|
1
|
+
{"version":3,"file":"element-component-pro.umd.js","sources":["../src/ProForm/ProFormItem.vue","../src/ProForm/ProForm.vue","../src/ProForm/useForm.ts","../src/index.ts"],"sourcesContent":["<template>\n <el-form-item\n v-if=\"shouldRender\"\n v-show=\"shouldShow\"\n :prop=\"schema.field\"\n :required=\"schema.required\"\n :rules=\"effectiveRules\"\n >\n <template slot=\"label\">\n <span>{{ schema.label }}</span>\n <el-tooltip\n v-if=\"schema.helpMessage\"\n placement=\"top\"\n effect=\"light\"\n v-bind=\"schema.helpComponentProps || {}\"\n >\n <template slot=\"content\">\n <template v-if=\"Array.isArray(schema.helpMessage)\">\n <div v-for=\"(msg, i) in schema.helpMessage\" :key=\"i\" class=\"ecp-pro-form-item__help-item\">\n {{ msg }}\n </div>\n </template>\n <span v-else>{{ schema.helpMessage }}</span>\n </template>\n <i class=\"el-icon-question ecp-pro-form-item__help-icon\" />\n </el-tooltip>\n </template>\n <!-- render 自定义渲染 -->\n <template v-if=\"schema.render\">\n <component :is=\"renderComponent\" />\n </template>\n <!-- slot 自定义插槽(由 ProForm 传入 default slot) -->\n <slot v-else-if=\"hasSlot\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\" :values=\"formModel\" />\n <!-- 默认组件渲染 -->\n <template v-else>\n <el-input\n v-if=\"schema.component === 'input' || !schema.component\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请输入${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-input-number\n v-else-if=\"schema.component === 'input-number'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-select\n class=\"ecp-pro-form-item__select\"\n v-else-if=\"schema.component === 'select'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-option\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.label\"\n :value=\"opt.value\"\n />\n </el-select>\n <el-date-picker\n v-else-if=\"schema.component === 'date-picker'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-date-picker\n v-else-if=\"schema.component === 'date-range'\"\n v-model=\"formModel[schema.field]\"\n type=\"daterange\"\n range-separator=\"至\"\n start-placeholder=\"开始日期\"\n end-placeholder=\"结束日期\"\n value-format=\"yyyy-MM-dd\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-switch\n v-else-if=\"schema.component === 'switch'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-cascader\n v-else-if=\"schema.component === 'cascader'\"\n v-model=\"formModel[schema.field]\"\n :placeholder=\"schema.placeholder || (autoPlaceholder ? `请选择${schema.label}` : undefined)\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n />\n <el-checkbox-group\n v-else-if=\"schema.component === 'checkbox'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-checkbox\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-checkbox>\n </el-checkbox-group>\n <el-radio-group\n v-else-if=\"schema.component === 'radio'\"\n v-model=\"formModel[schema.field]\"\n :disabled=\"effectiveDisabled\"\n v-bind=\"effectiveComponentProps\"\n v-on=\"effectiveComponentListeners\"\n >\n <el-radio\n v-for=\"opt in (getOptions(effectiveComponentProps) || [])\"\n :key=\"String(opt.value)\"\n :label=\"opt.value\"\n >\n {{ opt.label }}\n </el-radio>\n </el-radio-group>\n </template>\n </el-form-item>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots, h } from 'vue'\nimport type { ProFormSchema, RenderCallbackParams } from '../types'\n\nconst props = defineProps<{\n schema: ProFormSchema\n formModel: Record<string, unknown>\n formDisabled?: boolean\n autoPlaceholder?: boolean\n formActionType?: import('../types').FormActionType\n}>()\n\nconst slots = useSlots()\n\nconst renderParams = computed<RenderCallbackParams>(() => ({\n schema: props.schema,\n values: props.formModel,\n model: props.formModel,\n field: props.schema.field,\n}))\n\nconst shouldRender = computed(() => {\n const ifShow = props.schema.ifShow\n if (ifShow === undefined) return true\n if (typeof ifShow === 'boolean') return ifShow\n return ifShow(renderParams.value)\n})\n\nconst shouldShow = computed(() => {\n const show = props.schema.show\n if (show === undefined) return true\n if (typeof show === 'boolean') return show\n return show(renderParams.value)\n})\n\nconst effectiveDisabled = computed(() => {\n if (props.formDisabled) return true\n const dyn = props.schema.dynamicDisabled\n if (dyn === undefined) return false\n if (typeof dyn === 'boolean') return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveRules = computed(() => {\n const dyn = props.schema.dynamicRules\n if (!dyn) return props.schema.rules\n if (Array.isArray(dyn)) return dyn\n return dyn(renderParams.value)\n})\n\nconst effectiveComponentPropsAndListeners = computed(() => {\n const cp = props.schema.componentProps\n if (!cp) return { props: {}, listeners: {} }\n const raw = typeof cp === 'function'\n ? cp({\n ...renderParams.value,\n formActionType: props.formActionType,\n })\n : { ...cp }\n const propsOnly: Record<string, unknown> = {}\n const listeners: Record<string, (...args: unknown[]) => unknown> = {}\n for (const [key, value] of Object.entries(raw)) {\n if (key.length > 2 && /^on[A-Za-z]/.test(key) && typeof value === 'function') {\n const eventName = key.slice(2).charAt(0).toLowerCase() + key.slice(3)\n listeners[eventName] = value as (...args: unknown[]) => unknown\n } else {\n propsOnly[key] = value\n }\n }\n return { props: propsOnly, listeners }\n})\n\nconst effectiveComponentProps = computed(() => effectiveComponentPropsAndListeners.value.props)\nconst effectiveComponentListeners = computed(() => effectiveComponentPropsAndListeners.value.listeners)\n\nconst hasSlot = computed(() => !!slots.default)\n\nconst getOptions = (props: Record<string, unknown>): Array<{ label: string; value: unknown }> | undefined => {\n const opts = props?.options\n return Array.isArray(opts) ? opts : undefined\n}\n\nconst renderComponent = computed(() => {\n const renderFn = props.schema.render\n if (!renderFn) return null\n return {\n render() {\n const result = renderFn(renderParams.value)\n if (Array.isArray(result)) {\n return h('span', result)\n }\n return result\n },\n }\n})\n</script>\n\n<style scoped>\n.ecp-pro-form-item__help-icon {\n margin-left: 4px;\n color: #909399;\n cursor: help;\n font-size: 14px;\n}\n.ecp-pro-form-item__help-icon:hover {\n color: #409eff;\n}\n.ecp-pro-form-item__help-item {\n margin-bottom: 4px;\n}\n.ecp-pro-form-item__help-item:last-child {\n margin-bottom: 0;\n}\n</style>\n","<template>\n <div ref=\"formWrapRef\" class=\"ecp-pro-form\">\n <el-form class=\"ecp-pro-form\" ref=\"formRef\" :model=\"formModel\" :rules=\"formRules\" :label-width=\"effectiveProps.labelWidth\"\n :label-position=\"effectiveProps.labelPosition\" :size=\"effectiveProps.size\" :disabled=\"effectiveProps.disabled\"\n v-bind=\"$attrs\" v-on=\"formListeners\">\n <slot name=\"formHeader\" />\n <el-row :gutter=\"effectiveProps.gutter\" :style=\"effectiveProps.baseRowStyle\">\n <template v-for=\"schema in displaySchemas\">\n <el-col v-if=\"shouldShow(schema)\" :key=\"schema.field\" v-bind=\"getColProps(schema)\"\n :offset=\"schema.colProps?.offset ?? effectiveProps.baseColProps?.offset ?? 0\" :data-field=\"schema.field\">\n <ProFormItem :schema=\"schema\" :form-model=\"formModel\" :form-disabled=\"effectiveProps.disabled\"\n :auto-placeholder=\"effectiveProps.autoSetPlaceholder\" :form-action-type=\"formActionRef\">\n <template v-if=\"slots[getSlotName(schema)]\">\n <slot :name=\"getSlotName(schema)\" :model=\"formModel\" :schema=\"schema\" :field=\"schema.field\"\n :values=\"formModel\" />\n </template>\n </ProFormItem>\n </el-col>\n </template>\n <el-col class=\"ecp-pro-form_col\" v-if=\"effectiveProps.showActionButtonGroup\"\n v-bind=\"hasMoreFields ? { span: 24 } : effectiveProps.actionColOptions || { span: 6 }\">\n <FormActions :show-action-button-group=\"effectiveProps.showActionButtonGroup\"\n :show-submit-button=\"effectiveProps.showSubmitButton\" :show-reset-button=\"effectiveProps.showResetButton\"\n :submit-button-text=\"effectiveProps.submitButtonText\" :reset-button-text=\"effectiveProps.resetButtonText\"\n :submit-button-icon=\"effectiveProps.submitButtonIcon\" :reset-button-icon=\"effectiveProps.resetButtonIcon\"\n :submit-loading=\"submitLoading\" :show-advanced-button=\"effectiveProps.showAdvancedButton\"\n :has-more-fields=\"hasMoreFields\" :collapsed=\"collapsed\" :action-col-options=\"effectiveActionColOptions\"\n @submit=\"handleSubmit\" @reset=\"handleReset\" @toggle=\"collapsed = !collapsed\">\n <template slot=\"submitBefore\">\n <slot name=\"submitBefore\" />\n </template>\n <template slot=\"resetBefore\">\n <slot name=\"resetBefore\" />\n </template>\n <template slot=\"advanceBefore\">\n <slot name=\"advanceBefore\" />\n </template>\n <template slot=\"advanceAfter\">\n <slot name=\"advanceAfter\" />\n </template>\n <template slot=\"actions\">\n <slot name=\"actions\" />\n </template>\n </FormActions>\n </el-col>\n </el-row>\n <el-button v-if=\"effectiveProps.showAdvancedButton && hasMoreFields\" type=\"text\" class=\"ecp-form-actions__advance\"\n @click=\"collapsed = !collapsed\">\n <i class=\"el-icon-d-arrow-left\" :class=\"collapsed ? 'down' : 'up'\" />\n {{ collapsed ? '展开' : '收起' }}\n </el-button>\n <slot name=\"formFooter\" />\n </el-form>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, useSlots, onMounted, onUnmounted } from 'vue'\nimport ProFormItem from './ProFormItem.vue'\nimport FormActions from './FormActions.vue'\nimport type { ProFormSchema, ProFormProps, FormActionType, ColEx, ScrollToFieldOptions, FormListeners } from '../types'\n\nconst props = withDefaults(\n defineProps<{\n schemas?: ProFormSchema[]\n initialValues?: Record<string, unknown>\n labelWidth?: string\n labelPosition?: 'left' | 'right' | 'top'\n gutter?: number\n size?: 'medium' | 'small' | 'large'\n disabled?: boolean\n baseColProps?: ColEx\n baseRowStyle?: Record<string, string | number>\n autoSetPlaceholder?: boolean\n showSubmitButton?: boolean\n showResetButton?: boolean\n submitButtonText?: string\n resetButtonText?: string\n submitButtonIcon?: string\n resetButtonIcon?: string\n showActionButtonGroup?: boolean\n actionColOptions?: ColEx\n showAdvancedButton?: boolean\n autoAdvancedLine?: number\n alwaysShowLines?: number\n submitFunc?: () => Promise<void>\n resetFunc?: () => Promise<void>\n submitOnReset?: boolean\n formListeners?: FormListeners\n }>(),\n {\n labelWidth: '120px',\n labelPosition: 'right',\n gutter: 24,\n size: 'medium',\n autoSetPlaceholder: true,\n showSubmitButton: true,\n showResetButton: true,\n submitButtonText: '提交',\n resetButtonText: '重置',\n submitButtonIcon: 'el-icon-search',\n resetButtonIcon: 'el-icon-refresh-left',\n showActionButtonGroup: true,\n showAdvancedButton: false,\n autoAdvancedLine: 3,\n alwaysShowLines: 1,\n baseColProps: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n actionColOptions: () => ({ xs: 24, sm: 12, md: 12, lg: 8, xl: 6 }),\n submitOnReset: false,\n }\n)\n\nconst emit = defineEmits<{\n (e: 'submit', values: Record<string, unknown>): void\n (e: 'reset'): void\n (e: 'register', formAction: FormActionType): void\n}>()\nconst slots = useSlots()\nconst formRef = ref()\nconst formWrapRef = ref()\nconst submitLoading = ref(false)\nconst collapsed = ref(true)\nconst formModel = ref<Record<string, unknown>>({})\nconst formRules = ref<Record<string, unknown[]>>({})\nconst innerSchemas = ref<ProFormSchema[]>([])\nconst innerProps = ref<Partial<ProFormProps>>({})\n\n/** Element UI 栅格断点 (px) */\nconst BREAKPOINTS = { xl: 1920, lg: 1200, md: 992, sm: 768 }\n\n/** 根据当前视口宽度获取 ColEx 的有效 span(与 el-col 断点逻辑一致) */\nconst getEffectiveSpan = (colProps?: ColEx | null, baseColProps?: ColEx | null, width?: number): number => {\n const w = width ?? (typeof window !== 'undefined' ? window.innerWidth : 1920)\n const col = colProps ?? {}\n const base = baseColProps ?? {}\n const fallback = base.span ?? 8\n if (w >= BREAKPOINTS.xl) return col.xl ?? base.xl ?? col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.lg) return col.lg ?? base.lg ?? col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.md) return col.md ?? base.md ?? col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n if (w >= BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n // if (w < BREAKPOINTS.sm) return col.sm ?? base.sm ?? col.xs ?? base.xs ?? col.span ?? fallback\n return col.xs ?? base.xs ?? col.span ?? fallback\n}\n\nconst effectiveProps = computed(() => ({ ...props, ...innerProps.value }))\nconst effectiveActionColOptions = computed(() => effectiveProps.value.actionColOptions ?? { span: 24 })\n\n/** 当前视口宽度,用于响应式计算 span */\nconst windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1920)\n\n/** 计算前 maxLines 行能容纳的 schema 数量(考虑栅格断点,每个 field 可有自己的 span) */\nconst getVisibleSchemaCount = (\n schemas: ProFormSchema[],\n baseColProps: ColEx | undefined,\n maxLines: number,\n width: number\n) => {\n let remaining = 24\n let rows = 1\n let count = 0\n for (const schema of schemas) {\n const span = getEffectiveSpan(schema.colProps, baseColProps, width)\n if (span > remaining) {\n rows++\n if (rows > maxLines) break\n remaining = 24 - span\n } else {\n remaining -= span\n }\n count++\n }\n return count\n}\n\nconst hasMoreFields = computed(() => {\n const schemas = innerSchemas.value.filter((s) => shouldShow(s))\n\n if (!effectiveProps.value.showAdvancedButton) return false\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n console.log(schemas.length, maxVisible)\n return schemas.length > maxVisible\n})\n\nconst formListeners = computed((): FormListeners => {\n return effectiveProps.value.formListeners ?? {}\n})\n\nconst displaySchemas = computed(() => {\n const schemas = innerSchemas.value.filter((s) => {\n return shouldShow(s)\n })\n if (!effectiveProps.value.showAdvancedButton || !collapsed.value) return schemas\n const lines = effectiveProps.value.alwaysShowLines ?? 1\n const baseColProps = effectiveProps.value.baseColProps\n const maxVisible = getVisibleSchemaCount(schemas, baseColProps, lines, windowWidth.value)\n return schemas.slice(0, maxVisible)\n})\n\nconst shouldShow = (schema: ProFormSchema) => {\n let ifShow = true\n let show = true\n if (typeof schema.ifShow === 'function') {\n ifShow = schema.ifShow({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.ifShow === 'boolean') {\n ifShow = schema.ifShow\n }\n if (typeof schema.show === 'function') {\n show = schema.show({ schema, values: formModel.value, model: formModel.value, field: schema.field })\n }\n if (typeof schema.show === 'boolean') {\n show = schema.show\n }\n return ifShow && show\n}\nconst getColProps = (schema: ProFormSchema) => {\n return schema.colProps ?? effectiveProps.value.baseColProps ?? {}\n}\nconst getSlotName = (schema: ProFormSchema) => schema.slot || schema.field\n\nconst initForm = () => {\n const model: Record<string, unknown> = {}\n const rules: Record<string, unknown[]> = {}\n const initialValues = effectiveProps.value.initialValues ?? props.initialValues\n innerSchemas.value.forEach((schema) => {\n model[schema.field] = schema.defaultValue ?? initialValues?.[schema.field]\n if (schema.rules?.length) rules[schema.field] = schema.rules\n })\n formModel.value = { ...formModel.value, ...model }\n formRules.value = rules\n}\n\nconst filterByIfShow = (values: Record<string, unknown>) => {\n const result = { ...values }\n innerSchemas.value.forEach((schema) => {\n const ifShow = schema.ifShow\n if (ifShow === undefined) return\n const visible = typeof ifShow === 'boolean' ? ifShow : ifShow({ schema, values, model: values, field: schema.field })\n if (!visible) delete result[schema.field]\n })\n return result\n}\n\nconst processFieldMapToTime = (values: Record<string, unknown>) => {\n const filtered = filterByIfShow(values)\n const fieldMap = innerProps.value.fieldMapToTime\n if (!fieldMap?.length) return filtered\n const result = { ...filtered }\n fieldMap.forEach(([field, [startKey, endKey]]) => {\n const val = result[field]\n if (Array.isArray(val) && val.length === 2) {\n delete result[field]\n ; (result as Record<string, unknown>)[startKey] = val[0]\n ; (result as Record<string, unknown>)[endKey] = val[1]\n }\n })\n return result\n}\n\nconst handleSubmit = async () => {\n try {\n await formRef.value?.validate()\n if (effectiveProps.value.submitFunc) {\n await effectiveProps.value.submitFunc()\n } else {\n submitLoading.value = true\n emit('submit', processFieldMapToTime({ ...formModel.value }))\n }\n } catch (e) {\n console.error('Form validation failed:', e)\n } finally {\n submitLoading.value = false\n }\n}\n\nconst handleReset = async () => {\n if (effectiveProps.value.resetFunc) {\n await effectiveProps.value.resetFunc()\n } else {\n formRef.value?.resetFields()\n initForm()\n emit('reset')\n if (effectiveProps.value.submitOnReset) await handleSubmit()\n }\n}\n\nconst setFieldsValue = (values: Record<string, unknown>) => {\n formModel.value = { ...formModel.value, ...values }\n return Promise.resolve()\n}\n\nconst getFieldsValue = () => processFieldMapToTime({ ...formModel.value })\n\nconst resetFields = async () => {\n formRef.value?.resetFields()\n initForm()\n}\n\nconst validate = (nameList?: string[]) =>\n formRef.value?.validate(nameList) ?? Promise.resolve()\n\nconst validateFields = (nameList?: string[]) => {\n if (!formRef.value) return Promise.resolve()\n if (!nameList?.length) return formRef.value.validate()\n return Promise.all(nameList.map((prop) => new Promise((resolve, reject) => {\n formRef.value.validateField(prop, (valid: boolean) => (valid ? resolve(undefined) : reject(new Error('Validation failed'))))\n })))\n}\n\nconst scrollToField = async (name: string, options?: ScrollToFieldOptions) => {\n const el = formWrapRef.value?.querySelector(`[data-field=\"${name}\"]`)\n if (el) {\n el.scrollIntoView({ behavior: options?.behavior ?? 'smooth', block: options?.block ?? 'nearest' })\n }\n return Promise.resolve()\n}\n\nconst clearValidate = (name?: string | string[]) => {\n formRef.value?.clearValidate(name)\n}\n\nconst updateSchema = async (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => {\n const list = Array.isArray(data) ? data : [data]\n list.forEach((item) => {\n const idx = innerSchemas.value.findIndex((s) => s.field === item.field)\n if (idx >= 0) innerSchemas.value[idx] = { ...innerSchemas.value[idx], ...item }\n })\n}\n\nconst appendSchemaByField = async (schema: ProFormSchema, prefixField?: string, first?: boolean) => {\n if (first) innerSchemas.value.unshift(schema)\n else if (prefixField) {\n const idx = innerSchemas.value.findIndex((s) => s.field === prefixField)\n innerSchemas.value.splice(idx + 1, 0, schema)\n } else innerSchemas.value.push(schema)\n initForm()\n}\n\nconst removeSchemaByField = async (field: string | string[]) => {\n const fields = Array.isArray(field) ? field : [field]\n innerSchemas.value = innerSchemas.value.filter((s) => !fields.includes(s.field))\n}\n\nconst setProps = async (formProps: Partial<ProFormProps>) => {\n innerProps.value = { ...innerProps.value, ...formProps }\n if (formProps.schemas) {\n innerSchemas.value = [...formProps.schemas]\n debugger\n initForm()\n }\n}\n\nconst formActionRef: FormActionType = {\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit: handleSubmit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n}\n\ndefineExpose(formActionRef)\n\nconst syncSchemas = () => {\n innerSchemas.value = [...(props.schemas ?? [])]\n initForm()\n}\n\nconst handleResize = () => {\n if (typeof window !== 'undefined') windowWidth.value = window.innerWidth\n}\n\nonMounted(() => {\n syncSchemas()\n emit('register', formActionRef)\n if (typeof window !== 'undefined') window.addEventListener('resize', handleResize)\n})\n\nonUnmounted(() => {\n if (typeof window !== 'undefined') window.removeEventListener('resize', handleResize)\n})\n\nwatch(() => [props.schemas, props.initialValues], syncSchemas, { deep: true })\n</script>\n\n<style scoped>\n.ecp-pro-form {\n padding: 16px;\n position: relative;\n}\n\n.ecp-pro-form__advance {\n margin-bottom: 16px;\n}\n\n.ecp-pro-form_col {\n position: relative;\n float: right;\n}\n\n.el-icon-d-arrow-left.up {\n transform: rotate(90deg);\n}\n\n.el-icon-d-arrow-left.down {\n transform: rotate(-90deg);\n}\n\n.ecp-form-actions__advance {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n</style>\n","import { ref, watch, unref, type Ref } from 'vue'\nimport type { ProFormSchema, ProFormProps, FormActionType } from '../types'\n\nexport interface UseFormProps extends ProFormProps {\n schemas?: ProFormSchema[]\n}\n\n/** 支持 ref/computed 的 props(参考 Vben Admin:参数 props 内的值可以是 computed 或者 ref 类型) */\nexport type UseFormPropsReactive = UseFormProps | Ref<UseFormProps | undefined>\n\nexport interface UseFormReturn {\n /** 用于 @register,接收表单实例的 formAction */\n register: (formAction: FormActionType) => void\n formAction: { value: FormActionType | null }\n getFieldsValue: () => Record<string, unknown>\n setFieldsValue: (values: Record<string, unknown>) => Promise<void>\n resetFields: () => Promise<void>\n validate: (nameList?: string[]) => Promise<unknown>\n validateFields: (nameList?: string[]) => Promise<unknown>\n submit: () => Promise<void>\n scrollToField: (name: string, options?: import('../types').ScrollToFieldOptions) => Promise<void>\n clearValidate: (name?: string | string[]) => void\n updateSchema: (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) => Promise<void>\n appendSchemaByField: (schema: ProFormSchema, prefixField?: string, first?: boolean) => Promise<void>\n removeSchemaByField: (field: string | string[]) => Promise<void>\n setProps: (props: Partial<ProFormProps>) => Promise<void>\n}\n\nexport function useForm(props?: UseFormPropsReactive): [UseFormReturn['register'], Omit<UseFormReturn, 'register'>] {\n const formAction = ref<FormActionType | null>(null)\n const formPropsRef = ref<UseFormProps | undefined>(props ? unref(props as Ref<UseFormProps | undefined>) : undefined)\n\n const getFormProps = () => (props ? unref(props as Ref<UseFormProps | undefined>) : undefined) as UseFormProps | undefined\n\n const register = (action: FormActionType) => {\n formAction.value = action\n const formProps = getFormProps()\n debugger\n if (formProps && Object.keys(formProps).length > 0) {\n action.setProps(formProps)\n }\n }\n\n if (props) {\n watch(\n () => getFormProps(),\n (formProps) => {\n formPropsRef.value = formProps\n if (formProps && formAction.value) {\n formAction.value.setProps(formProps)\n }\n },\n { deep: true }\n )\n }\n\n const getFieldsValue = () => formAction.value?.getFieldsValue() ?? {}\n\n const setFieldsValue = async (values: Record<string, unknown>) => {\n await formAction.value?.setFieldsValue(values)\n }\n\n const resetFields = async () => {\n await formAction.value?.resetFields()\n }\n\n const validate = (nameList?: string[]) =>\n formAction.value?.validate(nameList) ?? Promise.resolve()\n\n const validateFields = (nameList?: string[]) =>\n formAction.value?.validateFields(nameList) ?? Promise.resolve()\n\n const submit = () => formAction.value?.submit() ?? Promise.resolve()\n\n const scrollToField = (name: string, options?: import('../types').ScrollToFieldOptions) =>\n formAction.value?.scrollToField(name, options) ?? Promise.resolve()\n\n const clearValidate = (name?: string | string[]) => {\n formAction.value?.clearValidate(name)\n }\n\n const updateSchema = (data: Partial<ProFormSchema> | Partial<ProFormSchema>[]) =>\n formAction.value?.updateSchema(data) ?? Promise.resolve()\n\n const appendSchemaByField = (schema: ProFormSchema, prefixField?: string, first?: boolean) =>\n formAction.value?.appendSchemaByField(schema, prefixField, first) ?? Promise.resolve()\n\n const removeSchemaByField = (field: string | string[]) =>\n formAction.value?.removeSchemaByField(field) ?? Promise.resolve()\n\n const setProps = async (formProps: Partial<ProFormProps>) => {\n formPropsRef.value = { ...formPropsRef.value, ...formProps }\n await formAction.value?.setProps(formProps)\n }\n\n const result: UseFormReturn = {\n register,\n formAction,\n getFieldsValue,\n setFieldsValue,\n resetFields,\n validate,\n validateFields,\n submit,\n scrollToField,\n clearValidate,\n updateSchema,\n appendSchemaByField,\n removeSchemaByField,\n setProps,\n }\n\n return [register, result]\n}\n","import type { VueConstructor } from 'vue'\n// import ProTable from './ProTable'\nimport ProForm, { ProFormItem, FormActions } from './ProForm'\n// import ProCard from './ProCard'\n// import ProDescriptions from './ProDescriptions'\nimport { useForm } from './ProForm/useForm'\n\nexport { ProForm, ProFormItem, FormActions, useForm }\nexport * from './types'\n\nconst components = [\n // { name: 'ProTable', component: ProTable },\n { name: 'ProForm', component: ProForm },\n { name: 'ProFormItem', component: ProFormItem },\n { name: 'FormActions', component: FormActions }\n // { name: 'ProCard', component: ProCard },\n // { name: 'ProDescriptions', component: ProDescriptions },\n]\n\nexport function install(Vue: VueConstructor) {\n components.forEach(({ name, component }) => {\n Vue.component(name, component)\n })\n}\n\nexport default {\n install,\n // ProTable,\n ProForm,\n // ProCard,\n // ProDescriptions,\n}\n"],"names":["slots","useSlots","renderParams","computed","props","shouldRender","ifShow","shouldShow","show","effectiveDisabled","dyn","effectiveRules","effectiveComponentPropsAndListeners","cp","raw","propsOnly","listeners","key","value","eventName","effectiveComponentProps","effectiveComponentListeners","hasSlot","getOptions","opts","renderComponent","renderFn","result","h","formRef","ref","formWrapRef","submitLoading","collapsed","formModel","formRules","innerSchemas","innerProps","BREAKPOINTS","getEffectiveSpan","colProps","baseColProps","width","w","col","base","fallback","effectiveProps","effectiveActionColOptions","windowWidth","getVisibleSchemaCount","schemas","maxLines","remaining","rows","count","schema","span","hasMoreFields","s","lines","maxVisible","formListeners","displaySchemas","getColProps","getSlotName","initForm","model","rules","initialValues","_a","filterByIfShow","values","processFieldMapToTime","filtered","fieldMap","field","startKey","endKey","val","handleSubmit","emit","e","handleReset","setFieldsValue","getFieldsValue","resetFields","validate","nameList","validateFields","prop","resolve","reject","valid","scrollToField","name","options","el","clearValidate","updateSchema","data","item","idx","appendSchemaByField","prefixField","first","removeSchemaByField","fields","setProps","formProps","formActionRef","expose","syncSchemas","handleResize","onMounted","onUnmounted","watch","useForm","formAction","formPropsRef","unref","getFormProps","register","action","components","ProForm","ProFormItem","FormActions","install","Vue","component","index"],"mappings":";qNAoJMA,EAAQC,EAAAA,WAERC,EAAeC,EAAAA,SAA+B,KAAO,CACzD,OAAQC,EAAM,OACd,OAAQA,EAAM,UACd,MAAOA,EAAM,UACb,MAAOA,EAAM,OAAO,KACpB,EAAA,EAEIC,EAAeF,EAAAA,SAAS,IAAM,CAC5B,MAAAG,EAASF,EAAM,OAAO,OAC5B,OAAIE,IAAW,OAAkB,GAC7B,OAAOA,GAAW,UAAkBA,EACjCA,EAAOJ,EAAa,KAAK,CAAA,CACjC,EAEKK,EAAaJ,EA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,EAEA,QAAAH,CAGF"}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ecp-pro-form-item__help-icon[data-v-
|
|
1
|
+
.ecp-pro-form-item__help-icon[data-v-cfc968c5]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-cfc968c5]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-cfc968c5]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-cfc968c5]:last-child{margin-bottom:0}.ecp-form-actions[data-v-489c88d2]{text-align:right}.ecp-form-actions__advance[data-v-489c88d2]{margin-right:8px}.el-icon-d-arrow-left.up[data-v-489c88d2]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-489c88d2]{transform:rotate(-90deg)}.ecp-pro-form[data-v-af9453ad]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-af9453ad]{margin-bottom:16px}.ecp-pro-form_col[data-v-af9453ad]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-af9453ad]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-af9453ad]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-af9453ad]{position:absolute;bottom:0;left:50%;transform:translate(-50%,-50%)}
|
package/package.json
CHANGED