@aspire-ui/element-component-pro 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -7
- package/dist/ProTable/ProTable.vue.d.ts +421 -0
- package/dist/ProTable/TableAction.vue.d.ts +43 -0
- package/dist/ProTable/index.d.ts +8 -0
- package/dist/ProTable/types/index.d.ts +252 -0
- package/dist/ProTable/useProTable.d.ts +12 -0
- package/dist/element-component-pro.es.js +741 -296
- package/dist/element-component-pro.es.js.map +1 -1
- package/dist/element-component-pro.umd.js +2 -2
- package/dist/element-component-pro.umd.js.map +1 -1
- package/dist/index.d.ts +1325 -0
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +0 -49
- package/dist/useComponentSetting.d.ts +12 -0
- package/package.json +7 -5
- package/src/ProForm/ProForm.vue +3 -1
- package/src/ProForm/useForm.ts +0 -1
- package/src/ProTable/ProTable.vue +773 -0
- package/src/ProTable/TableAction.vue +193 -0
- package/src/ProTable/index.ts +20 -0
- package/src/ProTable/types/index.ts +236 -0
- package/src/ProTable/useProTable.ts +79 -0
- package/src/index.ts +13 -10
- package/src/types/index.ts +0 -44
- package/src/useComponentSetting.ts +35 -0
|
@@ -1,5 +1,477 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { reactive as De, defineComponent as Z, h as ne, useSlots as ye, ref as M, computed as B, onMounted as xe, nextTick as $e, onUnmounted as Re, watch as ae, unref as we } from "vue";
|
|
2
|
+
import { MessageBox as ze } from "element-ui";
|
|
3
|
+
const be = De({});
|
|
4
|
+
function Fe() {
|
|
5
|
+
return {
|
|
6
|
+
getSetting: (l) => l === void 0 ? { ...be } : { ...be[l] ?? {} },
|
|
7
|
+
setSetting: (l, t) => {
|
|
8
|
+
const n = be[l];
|
|
9
|
+
be[l] = n ? { ...n, ...t } : { ...t };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const Ee = /* @__PURE__ */ Z({
|
|
14
|
+
__name: "ProTable",
|
|
15
|
+
props: {
|
|
16
|
+
columns: null,
|
|
17
|
+
dataSource: null,
|
|
18
|
+
api: null,
|
|
19
|
+
rowKey: { default: "id" },
|
|
20
|
+
title: null,
|
|
21
|
+
titleHelpMessage: null,
|
|
22
|
+
bordered: { type: Boolean, default: !1 },
|
|
23
|
+
striped: { type: Boolean, default: !0 },
|
|
24
|
+
size: { default: "medium" },
|
|
25
|
+
loading: { type: Boolean, default: !1 },
|
|
26
|
+
maxHeight: null,
|
|
27
|
+
height: null,
|
|
28
|
+
ellipsis: { type: Boolean, default: !0 },
|
|
29
|
+
showIndexColumn: { type: Boolean, default: !0 },
|
|
30
|
+
indexColumnProps: null,
|
|
31
|
+
actionColumn: null,
|
|
32
|
+
rowSelection: null,
|
|
33
|
+
clearSelectOnPageChange: { type: Boolean, default: !1 },
|
|
34
|
+
pagination: { type: [Boolean, Object], default: () => ({ pageSize: 10, pageSizes: [10, 20, 50, 100] }) },
|
|
35
|
+
tableSetting: { default: () => ({ redo: !0 }) },
|
|
36
|
+
fetchSetting: { default: () => ({
|
|
37
|
+
pageField: "page",
|
|
38
|
+
sizeField: "pageSize",
|
|
39
|
+
listField: "list",
|
|
40
|
+
totalField: "total"
|
|
41
|
+
}) },
|
|
42
|
+
beforeFetch: null,
|
|
43
|
+
afterFetch: null,
|
|
44
|
+
immediate: { type: Boolean, default: !0 },
|
|
45
|
+
searchInfo: null,
|
|
46
|
+
defaultSort: null,
|
|
47
|
+
tableProps: null,
|
|
48
|
+
rowClassName: null,
|
|
49
|
+
spanMethod: null,
|
|
50
|
+
treeProps: null,
|
|
51
|
+
defaultExpandAll: { type: Boolean },
|
|
52
|
+
expandRowKeys: null,
|
|
53
|
+
lazy: { type: Boolean },
|
|
54
|
+
load: null
|
|
55
|
+
},
|
|
56
|
+
emits: ["register", "fetch-success", "fetch-error", "selection-change", "row-click", "row-dblclick", "sort-change", "expand-change"],
|
|
57
|
+
setup(A, { expose: e, emit: l }) {
|
|
58
|
+
const t = A, n = Z({
|
|
59
|
+
name: "EcpProTableDefaultCellRenderer",
|
|
60
|
+
props: {
|
|
61
|
+
column: { type: Object, required: !0 },
|
|
62
|
+
record: { type: Object, required: !0 },
|
|
63
|
+
index: { type: Number, required: !0 },
|
|
64
|
+
value: { required: !1 }
|
|
65
|
+
},
|
|
66
|
+
setup(o) {
|
|
67
|
+
return () => {
|
|
68
|
+
var u, m;
|
|
69
|
+
const a = o.column;
|
|
70
|
+
if (a != null && a.customRender) {
|
|
71
|
+
const F = a.customRender({ text: o.value, record: o.record, index: o.index });
|
|
72
|
+
return typeof F == "string" || typeof F == "number" ? ne("span", String(F)) : F;
|
|
73
|
+
}
|
|
74
|
+
if (a != null && a.valueEnum) {
|
|
75
|
+
const F = ((m = (u = a.valueEnum) == null ? void 0 : u[o.value]) == null ? void 0 : m.text) ?? o.value;
|
|
76
|
+
return ne("span", F == null ? "" : String(F));
|
|
77
|
+
}
|
|
78
|
+
return ne("span", o.value == null ? "" : String(o.value));
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}), i = Z({
|
|
82
|
+
name: "EcpProTableBodyCellRenderer",
|
|
83
|
+
props: {
|
|
84
|
+
slotRender: { type: Function, required: !0 },
|
|
85
|
+
column: { type: Object, required: !0 },
|
|
86
|
+
record: { type: Object, required: !0 },
|
|
87
|
+
index: { type: Number, required: !0 },
|
|
88
|
+
value: { required: !1 },
|
|
89
|
+
customRender: { type: Function, required: !1 },
|
|
90
|
+
valueEnum: { type: Object, required: !1 }
|
|
91
|
+
},
|
|
92
|
+
setup(o) {
|
|
93
|
+
return () => {
|
|
94
|
+
const a = o.slotRender, u = a == null ? void 0 : a({ column: o.column, record: o.record, index: o.index, value: o.value });
|
|
95
|
+
if ((($) => $ == null ? [] : Array.isArray($) ? $.filter((I) => I != null && I !== !1 && !I.isComment) : [$])(u).length > 0)
|
|
96
|
+
return u;
|
|
97
|
+
const S = { ...o.column };
|
|
98
|
+
return o.customRender && (S.customRender = o.customRender), o.valueEnum && (S.valueEnum = o.valueEnum), ne(n, { props: { column: S, record: o.record, index: o.index, value: o.value } });
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}), P = ye(), z = M(), s = M(), v = M(0), h = M(t.loading ?? !1), c = M([]), b = M({}), k = M([]), p = M({}), y = M([]), R = M(null), x = M({
|
|
102
|
+
page: 1,
|
|
103
|
+
pageSize: t.pagination && typeof t.pagination == "object" ? t.pagination.pageSize ?? 10 : 10,
|
|
104
|
+
pageSizes: t.pagination && typeof t.pagination == "object" ? t.pagination.pageSizes ?? [10, 20, 50, 100] : [10, 20, 50, 100],
|
|
105
|
+
total: 0
|
|
106
|
+
}), { getSetting: f } = Fe(), d = B(() => ({ ...f("ProTable"), ...t, ...p.value })), O = B(() => !!d.value.title || !!P.tableTitle || !!P.toolbar), j = B(() => R.value !== null ? R.value : !!t.pagination && typeof t.pagination == "object"), D = B(() => d.value.rowKey || "id"), H = B(() => new Set(y.value.map((o) => o[D.value]))), ee = B(
|
|
107
|
+
() => k.value.filter((o) => !o.hideInTable && !o.defaultHidden)
|
|
108
|
+
), re = B(() => {
|
|
109
|
+
var a, u;
|
|
110
|
+
let o = 0;
|
|
111
|
+
return d.value.rowSelection && (o += Number(d.value.rowSelection.width) || 48), d.value.showIndexColumn && (o += Number((a = d.value.indexColumnProps) == null ? void 0 : a.width) || 60), d.value.actionColumn && (o += Number((u = d.value.actionColumn) == null ? void 0 : u.width) || 150), o;
|
|
112
|
+
}), L = (o) => typeof o == "number" && o > 0, J = B(() => ee.value.filter((a) => Y(a) && L(a.width)).reduce((a, u) => a + (typeof u.width == "number" ? u.width : 0), 0)), Q = B(() => ee.value.filter((a) => Y(a) && typeof a.width == "string").reduce((a, u) => a + (Number(ie(u)) || 80), 0)), W = (o) => o == null ? null : typeof o == "number" ? o : parseInt(String(o).replace(/px$/i, ""), 10) || null, ie = (o) => {
|
|
113
|
+
const a = o.width;
|
|
114
|
+
if (L(a) && J.value > 0 && v.value > 0 && typeof a == "number") {
|
|
115
|
+
const u = v.value - re.value - Q.value;
|
|
116
|
+
let m = Math.floor(u * a / J.value);
|
|
117
|
+
const F = W(o.minWidth) ?? 60, S = W(o.maxWidth);
|
|
118
|
+
return m = Math.max(F, m), S != null && (m = Math.min(S, m)), m;
|
|
119
|
+
}
|
|
120
|
+
if (typeof a == "string") {
|
|
121
|
+
const u = W(a) ?? 80, m = W(o.minWidth), F = W(o.maxWidth);
|
|
122
|
+
let S = u;
|
|
123
|
+
return m != null && (S = Math.max(m, S)), F != null && (S = Math.min(F, S)), S;
|
|
124
|
+
}
|
|
125
|
+
return o.width;
|
|
126
|
+
}, Y = (o) => o.ifShow === !1 ? !1 : typeof o.ifShow == "function" ? o.ifShow({ column: o }) : !0, V = B(() => {
|
|
127
|
+
var a;
|
|
128
|
+
const o = (a = d.value.rowSelection) == null ? void 0 : a.getCheckboxProps;
|
|
129
|
+
return o ? c.value.filter((u) => {
|
|
130
|
+
var m;
|
|
131
|
+
return !((m = o(u)) != null && m.disabled);
|
|
132
|
+
}) : c.value;
|
|
133
|
+
}), ce = B(() => V.value.length > 0), ue = B(() => V.value.length === 0 ? !1 : V.value.every((o) => H.value.has(o[D.value]))), de = B(() => {
|
|
134
|
+
const o = V.value.filter((a) => H.value.has(a[D.value])).length;
|
|
135
|
+
return o > 0 && o < V.value.length;
|
|
136
|
+
}), fe = (o) => H.value.has(o[D.value]), pe = (o) => {
|
|
137
|
+
var a, u, m;
|
|
138
|
+
return ((m = (u = (a = d.value.rowSelection) == null ? void 0 : a.getCheckboxProps) == null ? void 0 : u.call(a, o)) == null ? void 0 : m.disabled) ?? !1;
|
|
139
|
+
}, me = (o) => {
|
|
140
|
+
var a, u, m;
|
|
141
|
+
return ((m = (u = (a = d.value.rowSelection) == null ? void 0 : a.getRadioProps) == null ? void 0 : u.call(a, o)) == null ? void 0 : m.disabled) ?? !1;
|
|
142
|
+
}, K = () => {
|
|
143
|
+
const o = y.value.map((a) => a[D.value]);
|
|
144
|
+
l("selection-change", { keys: o, rows: y.value });
|
|
145
|
+
}, ve = (o, a) => {
|
|
146
|
+
const u = o[D.value];
|
|
147
|
+
a ? y.value = [...y.value.filter((m) => m[D.value] !== u), o] : y.value = y.value.filter((m) => m[D.value] !== u), K();
|
|
148
|
+
}, he = (o) => {
|
|
149
|
+
y.value = [o], K();
|
|
150
|
+
}, te = (o) => {
|
|
151
|
+
if (o) {
|
|
152
|
+
const a = new Set(y.value.map((m) => m[D.value])), u = V.value.filter((m) => !a.has(m[D.value]));
|
|
153
|
+
y.value = [...y.value, ...u];
|
|
154
|
+
} else {
|
|
155
|
+
const a = new Set(c.value.map((u) => u[D.value]));
|
|
156
|
+
y.value = y.value.filter((u) => !a.has(u[D.value]));
|
|
157
|
+
}
|
|
158
|
+
K();
|
|
159
|
+
}, q = async (o) => {
|
|
160
|
+
if (!t.api) {
|
|
161
|
+
if (t.dataSource)
|
|
162
|
+
return;
|
|
163
|
+
c.value = [];
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
h.value = !0;
|
|
167
|
+
try {
|
|
168
|
+
const a = d.value.fetchSetting ?? {}, u = a.pageField ?? "page", m = a.sizeField ?? "pageSize", F = a.listField ?? "list", S = a.totalField ?? "total", $ = {
|
|
169
|
+
[u]: (o == null ? void 0 : o.page) ?? x.value.page,
|
|
170
|
+
[m]: (o == null ? void 0 : o.pageSize) ?? x.value.pageSize,
|
|
171
|
+
...t.searchInfo,
|
|
172
|
+
...o == null ? void 0 : o.searchInfo
|
|
173
|
+
};
|
|
174
|
+
(o == null ? void 0 : o.page) != null && (x.value.page = o.page), (o == null ? void 0 : o.pageSize) != null && (x.value.pageSize = o.pageSize);
|
|
175
|
+
const I = t.beforeFetch ? t.beforeFetch($) : $, _e = await t.api(I);
|
|
176
|
+
b.value = _e || {};
|
|
177
|
+
const ge = t.afterFetch ? t.afterFetch(_e) : _e, Ce = ge[F] ?? ge.items ?? ge.list ?? [], Se = ge[S] ?? 0;
|
|
178
|
+
c.value = Ce, x.value.total = Se, l("fetch-success", { items: Ce, total: Se });
|
|
179
|
+
} catch (a) {
|
|
180
|
+
l("fetch-error", a);
|
|
181
|
+
} finally {
|
|
182
|
+
h.value = !1;
|
|
183
|
+
}
|
|
184
|
+
}, oe = () => q(void 0), r = (o) => {
|
|
185
|
+
d.value.clearSelectOnPageChange && (y.value = []), x.value.pageSize = o, x.value.page = 1, q(void 0);
|
|
186
|
+
}, g = (o) => {
|
|
187
|
+
d.value.clearSelectOnPageChange && (y.value = []), x.value.page = o, q(void 0);
|
|
188
|
+
}, C = (o, a, u) => l("row-click", o, u), w = (o, a, u) => l("row-dblclick", o, u), _ = ({ prop: o, order: a }) => l("sort-change", { prop: o, order: a }), T = (o, a) => l("expand-change", o, a), E = (o) => c.value.findIndex((a) => a[D.value] === o), N = {
|
|
189
|
+
setProps: (o) => {
|
|
190
|
+
p.value = { ...p.value, ...o };
|
|
191
|
+
},
|
|
192
|
+
reload: (o) => q(o),
|
|
193
|
+
redoHeight: () => {
|
|
194
|
+
var o, a;
|
|
195
|
+
(a = (o = z.value) == null ? void 0 : o.doLayout) == null || a.call(o);
|
|
196
|
+
},
|
|
197
|
+
setLoading: (o) => {
|
|
198
|
+
h.value = o;
|
|
199
|
+
},
|
|
200
|
+
getDataSource: () => c.value,
|
|
201
|
+
getRawDataSource: () => b.value,
|
|
202
|
+
setTableData: (o) => {
|
|
203
|
+
c.value = o ?? [];
|
|
204
|
+
},
|
|
205
|
+
getColumns: () => k.value,
|
|
206
|
+
setColumns: (o) => {
|
|
207
|
+
if (Array.isArray(o) && o.length > 0 && typeof o[0] == "string") {
|
|
208
|
+
const a = o, u = (t.columns ?? []).filter((F) => a.includes(F.key ?? F.dataIndex)), m = a.map((F) => u.find((S) => (S.key ?? S.dataIndex) === F)).filter(Boolean);
|
|
209
|
+
m.length && (k.value = m);
|
|
210
|
+
} else
|
|
211
|
+
k.value = o ?? [];
|
|
212
|
+
},
|
|
213
|
+
setPagination: (o) => {
|
|
214
|
+
o != null && o.page && (x.value.page = o.page), o != null && o.pageSize && (x.value.pageSize = o.pageSize), (o == null ? void 0 : o.total) !== void 0 && (x.value.total = o.total);
|
|
215
|
+
},
|
|
216
|
+
getSelectRowKeys: () => y.value.map((o) => o[D.value]),
|
|
217
|
+
getSelectRows: () => y.value,
|
|
218
|
+
clearSelectedRowKeys: () => {
|
|
219
|
+
y.value = [], K();
|
|
220
|
+
},
|
|
221
|
+
setSelectedRowKeys: (o) => {
|
|
222
|
+
const a = new Set(o), u = c.value.filter((m) => a.has(m[D.value]));
|
|
223
|
+
o.forEach((m) => {
|
|
224
|
+
u.some((F) => F[D.value] === m) || u.push({ [D.value]: m });
|
|
225
|
+
}), y.value = u, K();
|
|
226
|
+
},
|
|
227
|
+
deleteSelectRowByKey: (o) => {
|
|
228
|
+
y.value = y.value.filter((a) => a[D.value] !== o), K();
|
|
229
|
+
},
|
|
230
|
+
updateTableData: (o, a, u) => {
|
|
231
|
+
o < 0 || o >= c.value.length || (c.value = [...c.value], c.value[o] = { ...c.value[o], [a]: u });
|
|
232
|
+
},
|
|
233
|
+
updateTableDataRecord: (o, a) => {
|
|
234
|
+
const u = E(o);
|
|
235
|
+
if (!(u < 0))
|
|
236
|
+
return c.value = [...c.value], c.value[u] = { ...c.value[u], ...a }, c.value[u];
|
|
237
|
+
},
|
|
238
|
+
deleteTableDataRecord: (o) => {
|
|
239
|
+
const a = Array.isArray(o) ? o : [o], u = new Set(a);
|
|
240
|
+
c.value = c.value.filter((m) => !u.has(m[D.value]));
|
|
241
|
+
},
|
|
242
|
+
insertTableDataRecord: (o, a) => {
|
|
243
|
+
const u = [...c.value];
|
|
244
|
+
return a == null || a >= u.length ? u.push(o) : u.splice(a, 0, o), c.value = u, o;
|
|
245
|
+
},
|
|
246
|
+
getPaginationRef: () => j.value ? { page: x.value.page, pageSize: Number(x.value.pageSize) || 10, total: x.value.total } : !1,
|
|
247
|
+
getShowPagination: () => j.value,
|
|
248
|
+
setShowPagination: (o) => {
|
|
249
|
+
R.value = o;
|
|
250
|
+
},
|
|
251
|
+
getRowSelection: () => d.value.rowSelection,
|
|
252
|
+
expandAll: () => {
|
|
253
|
+
var m;
|
|
254
|
+
const o = ((m = d.value.treeProps) == null ? void 0 : m.children) ?? "children", a = (F) => {
|
|
255
|
+
const S = [];
|
|
256
|
+
return F.forEach(($) => {
|
|
257
|
+
S.push($);
|
|
258
|
+
const I = $[o];
|
|
259
|
+
Array.isArray(I) && I.length > 0 && S.push(...a(I));
|
|
260
|
+
}), S;
|
|
261
|
+
};
|
|
262
|
+
a(c.value).forEach((F) => {
|
|
263
|
+
var S, $;
|
|
264
|
+
return ($ = (S = z.value) == null ? void 0 : S.toggleRowExpansion) == null ? void 0 : $.call(S, F, !0);
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
collapseAll: () => {
|
|
268
|
+
var m;
|
|
269
|
+
const o = ((m = d.value.treeProps) == null ? void 0 : m.children) ?? "children", a = (F) => {
|
|
270
|
+
const S = [];
|
|
271
|
+
return F.forEach(($) => {
|
|
272
|
+
S.push($);
|
|
273
|
+
const I = $[o];
|
|
274
|
+
Array.isArray(I) && I.length > 0 && S.push(...a(I));
|
|
275
|
+
}), S;
|
|
276
|
+
};
|
|
277
|
+
a(c.value).forEach((F) => {
|
|
278
|
+
var S, $;
|
|
279
|
+
return ($ = (S = z.value) == null ? void 0 : S.toggleRowExpansion) == null ? void 0 : $.call(S, F, !1);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
e(N);
|
|
284
|
+
const G = () => {
|
|
285
|
+
k.value = [...t.columns ?? []];
|
|
286
|
+
}, Pe = () => {
|
|
287
|
+
t.api && d.value.immediate !== !1 ? q(void 0) : t.dataSource && (c.value = [...t.dataSource], !t.api && t.pagination !== !1 && (x.value.total = t.dataSource.length));
|
|
288
|
+
}, le = () => {
|
|
289
|
+
s.value && (v.value = s.value.offsetWidth || 0);
|
|
290
|
+
};
|
|
291
|
+
let U = null, X = null;
|
|
292
|
+
return xe(() => {
|
|
293
|
+
G(), l("register", N), Pe(), typeof window < "u" && (window.addEventListener("resize", le), U = new ResizeObserver(le), $e(() => {
|
|
294
|
+
le(), X = s.value, X && (U == null || U.observe(X));
|
|
295
|
+
}));
|
|
296
|
+
}), Re(() => {
|
|
297
|
+
typeof window < "u" && (window.removeEventListener("resize", le), U && X && (U.unobserve(X), X = null));
|
|
298
|
+
}), ae(() => t.columns, G, { deep: !0 }), ae(() => t.dataSource, () => {
|
|
299
|
+
!t.api && t.dataSource && (c.value = [...t.dataSource]);
|
|
300
|
+
}, { deep: !0 }), ae(() => t.loading, (o) => {
|
|
301
|
+
h.value = o ?? !1;
|
|
302
|
+
}), { __sfc: !0, DefaultCellRenderer: n, BodyCellRenderer: i, props: t, emit: l, slots: P, tableRef: z, tableWrapRef: s, containerWidth: v, loading: h, innerData: c, rawDataSource: b, innerColumns: k, innerProps: p, selectedRows: y, showPaginationRef: R, pagination: x, getComponentSetting: f, effectiveProps: d, showTitleBar: O, showPagination: j, rowKeyField: D, selectedKeysSet: H, displayColumns: ee, fixedColumnsWidth: re, isRatioWidth: L, totalRatio: J, fixedDataColumnsWidth: Q, parseWidthPx: W, getColumnWidth: ie, shouldShowColumn: Y, selectableRows: V, hasSelectableRows: ce, isAllCurrentPageSelected: ue, isIndeterminate: de, isRowSelected: fe, getCheckboxDisabled: pe, getRadioDisabled: me, emitSelectionChange: K, handleCheckboxChange: ve, handleRadioSelect: he, handleSelectAll: te, fetchData: q, handleReload: oe, handleSizeChange: r, handleCurrentChange: g, handleRowClick: C, handleRowDblclick: w, handleSortChange: _, handleExpandChange: T, findRowIndex: E, tableAction: N, syncColumns: G, loadData: Pe, updateContainerWidth: le, resizeObserver: U, observedEl: X };
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
function se(A, e, l, t, n, i, P, z) {
|
|
306
|
+
var s = typeof A == "function" ? A.options : A;
|
|
307
|
+
e && (s.render = e, s.staticRenderFns = l, s._compiled = !0), t && (s.functional = !0), i && (s._scopeId = "data-v-" + i);
|
|
308
|
+
var v;
|
|
309
|
+
if (P ? (v = function(b) {
|
|
310
|
+
b = b || // cached call
|
|
311
|
+
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
312
|
+
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !b && typeof __VUE_SSR_CONTEXT__ < "u" && (b = __VUE_SSR_CONTEXT__), n && n.call(this, b), b && b._registeredComponents && b._registeredComponents.add(P);
|
|
313
|
+
}, s._ssrRegister = v) : n && (v = z ? function() {
|
|
314
|
+
n.call(
|
|
315
|
+
this,
|
|
316
|
+
(s.functional ? this.parent : this).$root.$options.shadowRoot
|
|
317
|
+
);
|
|
318
|
+
} : n), v)
|
|
319
|
+
if (s.functional) {
|
|
320
|
+
s._injectStyles = v;
|
|
321
|
+
var h = s.render;
|
|
322
|
+
s.render = function(k, p) {
|
|
323
|
+
return v.call(p), h(k, p);
|
|
324
|
+
};
|
|
325
|
+
} else {
|
|
326
|
+
var c = s.beforeCreate;
|
|
327
|
+
s.beforeCreate = c ? [].concat(c, v) : [v];
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
exports: A,
|
|
331
|
+
options: s
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
var Ie = function() {
|
|
335
|
+
var n, i, P, z;
|
|
336
|
+
var e = this, l = e._self._c, t = e._self._setupProxy;
|
|
337
|
+
return l("div", { staticClass: "ecp-pro-table" }, [t.showTitleBar ? l("div", { staticClass: "ecp-pro-table__header" }, [l("div", { staticClass: "ecp-pro-table__title-wrapper" }, [l("span", { staticClass: "ecp-pro-table__title" }, [e._v(e._s(t.effectiveProps.title))]), t.effectiveProps.titleHelpMessage ? l("el-tooltip", { staticClass: "ecp-pro-table__help", attrs: { placement: "top" } }, [l("template", { slot: "content" }, [Array.isArray(t.effectiveProps.titleHelpMessage) ? l("span", e._l(t.effectiveProps.titleHelpMessage, function(s, v) {
|
|
338
|
+
return l("div", { key: v }, [e._v(e._s(s))]);
|
|
339
|
+
}), 0) : l("span", [e._v(e._s(t.effectiveProps.titleHelpMessage))])]), l("i", { staticClass: "el-icon-question" })], 2) : e._e()], 1), l("div", { staticClass: "ecp-pro-table__toolbar" }, [e._t("tableTitle"), e._t("toolbar"), e._t("toolbar-right", function() {
|
|
340
|
+
var s;
|
|
341
|
+
return [((s = t.effectiveProps.tableSetting) == null ? void 0 : s.redo) !== !1 ? l("el-button", { attrs: { type: "text", icon: "el-icon-refresh", size: "small" }, on: { click: t.handleReload } }, [e._v(" 刷新 ")]) : e._e()];
|
|
342
|
+
})], 2)]) : e._e(), l("div", { directives: [{ name: "loading", rawName: "v-loading", value: t.loading, expression: "loading" }], ref: "tableWrapRef", staticClass: "ecp-pro-table__body" }, [l("el-table", e._b({ ref: "tableRef", attrs: { data: t.innerData, "row-key": t.effectiveProps.rowKey, border: t.effectiveProps.bordered, stripe: t.effectiveProps.striped, size: t.effectiveProps.size, "max-height": t.effectiveProps.maxHeight, height: t.effectiveProps.height, "default-sort": t.effectiveProps.defaultSort, "span-method": t.effectiveProps.spanMethod, "tree-props": t.effectiveProps.treeProps, "default-expand-all": t.effectiveProps.defaultExpandAll, "expand-row-keys": t.effectiveProps.expandRowKeys || [], lazy: t.effectiveProps.lazy, load: t.effectiveProps.load, "row-class-name": t.effectiveProps.rowClassName }, on: { "row-click": t.handleRowClick, "row-dblclick": t.handleRowDblclick, "sort-change": t.handleSortChange, "expand-change": t.handleExpandChange } }, "el-table", t.effectiveProps.tableProps, !1), [t.effectiveProps.rowSelection ? l("el-table-column", { attrs: { width: t.effectiveProps.rowSelection.width || 48, fixed: t.effectiveProps.rowSelection.fixed, align: "center" }, scopedSlots: e._u([{ key: "header", fn: function(s) {
|
|
343
|
+
return [t.effectiveProps.rowSelection.type !== "radio" ? l("el-checkbox", { attrs: { value: t.isAllCurrentPageSelected, indeterminate: t.isIndeterminate, disabled: !t.hasSelectableRows }, on: { change: t.handleSelectAll } }) : l("span")];
|
|
344
|
+
} }, { key: "default", fn: function(s) {
|
|
345
|
+
var v;
|
|
346
|
+
return [t.effectiveProps.rowSelection.type !== "radio" ? l("el-checkbox", { attrs: { value: t.isRowSelected(s.row), disabled: t.getCheckboxDisabled(s.row) }, on: { change: (h) => t.handleCheckboxChange(s.row, h) }, nativeOn: { click: function(h) {
|
|
347
|
+
h.stopPropagation();
|
|
348
|
+
} } }) : l("el-radio", { attrs: { value: (v = t.selectedRows[0]) == null ? void 0 : v[t.rowKeyField], label: s.row[t.rowKeyField], disabled: t.getRadioDisabled(s.row) }, on: { change: function(h) {
|
|
349
|
+
return t.handleRadioSelect(s.row);
|
|
350
|
+
} }, nativeOn: { click: function(h) {
|
|
351
|
+
h.stopPropagation();
|
|
352
|
+
} } }, [l("span")])];
|
|
353
|
+
} }], null, !1, 983730649) }) : e._e(), t.effectiveProps.showIndexColumn ? l("el-table-column", { attrs: { type: "index", label: ((n = t.effectiveProps.indexColumnProps) == null ? void 0 : n.title) || "序号", width: ((i = t.effectiveProps.indexColumnProps) == null ? void 0 : i.width) || 60, fixed: (P = t.effectiveProps.indexColumnProps) == null ? void 0 : P.fixed, align: ((z = t.effectiveProps.indexColumnProps) == null ? void 0 : z.align) || "center" } }) : e._e(), e._l(t.displayColumns, function(s) {
|
|
354
|
+
return [t.shouldShowColumn(s) ? l("el-table-column", { key: s.dataIndex || s.key || s.title, attrs: { prop: s.dataIndex, label: s.title, width: t.getColumnWidth(s), "min-width": t.isRatioWidth(s.width) ? void 0 : s.minWidth, fixed: s.fixed, align: s.align || "left", sortable: s.sortable, formatter: s.formatter, "show-overflow-tooltip": s.ellipsis !== !1 && t.effectiveProps.ellipsis !== !1 }, scopedSlots: e._u([{ key: "header", fn: function(v) {
|
|
355
|
+
return [s.dataIndex && e.$scopedSlots[`header-${s.dataIndex}`] ? e._t(`header-${s.dataIndex}`, null, { column: s }) : e.$scopedSlots.headerCell ? e._t("headerCell", null, { column: s }) : [l("span", [e._v(e._s(s.title))]), s.helpMessage ? l("el-tooltip", { staticClass: "ecp-pro-table__col-help", attrs: { placement: "top", effect: "dark" } }, [l("template", { slot: "content" }, [Array.isArray(s.helpMessage) ? l("span", e._l(s.helpMessage, function(h, c) {
|
|
356
|
+
return l("div", { key: c }, [e._v(e._s(h))]);
|
|
357
|
+
}), 0) : l("span", [e._v(e._s(s.helpMessage))])]), l("i", { staticClass: "el-icon-question" })], 2) : e._e()]];
|
|
358
|
+
} }, { key: "default", fn: function(v) {
|
|
359
|
+
return [s.dataIndex && e.$scopedSlots[s.dataIndex] ? e._t(s.dataIndex, null, { row: v.row, column: s, index: v.$index, value: v.row[s.dataIndex] }) : e.$scopedSlots.bodyCell ? l(t.BodyCellRenderer, { attrs: { "slot-render": e.$scopedSlots.bodyCell, column: s, record: v.row, index: v.$index, value: v.row[s.dataIndex], "custom-render": s.customRender, "value-enum": s.valueEnum } }) : l(t.DefaultCellRenderer, { attrs: { column: s, record: v.row, index: v.$index, value: v.row[s.dataIndex] } })];
|
|
360
|
+
} }], null, !0) }) : e._e()];
|
|
361
|
+
}), t.effectiveProps.actionColumn ? l("el-table-column", { attrs: { label: t.effectiveProps.actionColumn.title || "操作", width: t.effectiveProps.actionColumn.width || 150, fixed: t.effectiveProps.actionColumn.fixed || "right", align: t.effectiveProps.actionColumn.align || "center" }, scopedSlots: e._u([{ key: "default", fn: function(s) {
|
|
362
|
+
return [e.$scopedSlots.action ? e._t("action", null, { record: s.row, column: t.effectiveProps.actionColumn, index: s.$index }) : e.$scopedSlots.bodyCell ? l(t.BodyCellRenderer, { attrs: { "slot-render": e.$scopedSlots.bodyCell, column: t.effectiveProps.actionColumn, record: s.row, index: s.$index, value: void 0, "custom-render": t.effectiveProps.actionColumn.customRender, "value-enum": t.effectiveProps.actionColumn.valueEnum } }) : e._e()];
|
|
363
|
+
} }], null, !0) }) : e._e()], 2)], 1), t.showPagination ? l("div", { staticClass: "ecp-pro-table__pagination" }, [l("el-pagination", e._b({ attrs: { "current-page": t.pagination.page, "page-sizes": t.pagination.pageSizes, "page-size": t.pagination.pageSize, total: t.pagination.total, layout: (t.effectiveProps.pagination && typeof t.effectiveProps.pagination == "object" ? t.effectiveProps.pagination.layout : null) || "total, sizes, prev, pager, next, jumper" }, on: { "size-change": t.handleSizeChange, "current-change": t.handleCurrentChange } }, "el-pagination", t.effectiveProps.pagination && typeof t.effectiveProps.pagination == "object" && t.effectiveProps.pagination.props || {}, !1))], 1) : e._e()]);
|
|
364
|
+
}, Oe = [], Le = /* @__PURE__ */ se(
|
|
365
|
+
Ee,
|
|
366
|
+
Ie,
|
|
367
|
+
Oe,
|
|
368
|
+
!1,
|
|
369
|
+
null,
|
|
370
|
+
"c5638c20",
|
|
371
|
+
null,
|
|
372
|
+
null
|
|
373
|
+
);
|
|
374
|
+
const Be = Le.exports, We = /* @__PURE__ */ Z({
|
|
375
|
+
__name: "TableAction",
|
|
376
|
+
props: {
|
|
377
|
+
actions: { default: () => [] },
|
|
378
|
+
dropDownActions: { default: () => [] },
|
|
379
|
+
stopButtonPropagation: { type: Boolean, default: !1 }
|
|
380
|
+
},
|
|
381
|
+
setup(A) {
|
|
382
|
+
const e = A, l = (h) => h ? typeof h == "string" ? { content: h } : h : {}, t = (h) => h.type ? h.type : h.color === "error" ? "danger" : h.color === "success" ? "success" : h.color === "warning" ? "warning" : "text", n = (h) => h.filter((c) => {
|
|
383
|
+
const { ifShow: b } = c;
|
|
384
|
+
return typeof b == "boolean" ? b : typeof b == "function" ? b(c) : !0;
|
|
385
|
+
}), i = B(() => n(e.actions || [])), P = B(() => n(e.dropDownActions || []));
|
|
386
|
+
return { __sfc: !0, props: e, normalizeTooltip: l, getButtonType: t, filterVisible: n, visibleActions: i, visibleDropDownActions: P, handleClick: (h, c) => {
|
|
387
|
+
var b;
|
|
388
|
+
e.stopButtonPropagation && c.stopPropagation(), (b = h.onClick) == null || b.call(h, c);
|
|
389
|
+
}, handlePopConfirm: (h, c, b) => {
|
|
390
|
+
var k, p, y, R;
|
|
391
|
+
e.stopButtonPropagation && b.stopPropagation(), h.popConfirm && (c === "confirm" ? (p = (k = h.popConfirm).confirm) == null || p.call(k) : (R = (y = h.popConfirm).cancel) == null || R.call(y));
|
|
392
|
+
}, handleDropdownCommand: (h) => {
|
|
393
|
+
var k;
|
|
394
|
+
const c = Number(h), b = P.value[c];
|
|
395
|
+
if (!(!b || b.disabled)) {
|
|
396
|
+
if (b.popConfirm) {
|
|
397
|
+
const p = b.popConfirm.title, y = b.popConfirm.okText || "确定", R = b.popConfirm.cancelText || "取消";
|
|
398
|
+
ze.confirm(p, "提示", {
|
|
399
|
+
confirmButtonText: y,
|
|
400
|
+
cancelButtonText: R,
|
|
401
|
+
type: "warning"
|
|
402
|
+
}).then(() => {
|
|
403
|
+
var x, f;
|
|
404
|
+
return (f = (x = b.popConfirm) == null ? void 0 : x.confirm) == null ? void 0 : f.call(x);
|
|
405
|
+
}).catch(() => {
|
|
406
|
+
var x, f;
|
|
407
|
+
return (f = (x = b.popConfirm) == null ? void 0 : x.cancel) == null ? void 0 : f.call(x);
|
|
408
|
+
});
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
(k = b.onClick) == null || k.call(b, {});
|
|
412
|
+
}
|
|
413
|
+
} };
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
var Ve = function() {
|
|
417
|
+
var e = this, l = e._self._c, t = e._self._setupProxy;
|
|
418
|
+
return l("div", { staticClass: "ecp-table-action" }, [e._l(t.visibleActions, function(n, i) {
|
|
419
|
+
return l("span", { key: `action-${i}`, staticClass: "ecp-table-action__item" }, [n.popConfirm ? l("el-popconfirm", { attrs: { title: n.popConfirm.title, "confirm-button-text": n.popConfirm.okText || "确定", "cancel-button-text": n.popConfirm.cancelText || "取消" }, on: { confirm: (P) => t.handlePopConfirm(n, "confirm", P), cancel: (P) => t.handlePopConfirm(n, "cancel", P) } }, [l("span", { attrs: { slot: "reference" }, slot: "reference" }, [l(n.tooltip ? "el-tooltip" : "span", e._b({ tag: "component" }, "component", n.tooltip ? t.normalizeTooltip(n.tooltip) : {}, !1), [l("el-button", e._b({ attrs: { type: t.getButtonType(n), size: "small", disabled: n.disabled }, on: { click: (P) => t.handleClick(n, P) } }, "el-button", n.props, !1), [n.icon ? l("i", { class: ["ecp-table-action__icon", n.icon] }) : e._e(), l("span", [e._v(e._s(n.label))])])], 1)], 1)]) : l(n.tooltip ? "el-tooltip" : "span", e._b({ tag: "component" }, "component", n.tooltip ? t.normalizeTooltip(n.tooltip) : {}, !1), [l("el-button", e._b({ attrs: { type: t.getButtonType(n), size: "small", disabled: n.disabled }, on: { click: (P) => t.handleClick(n, P) } }, "el-button", n.props, !1), [n.icon ? l("i", { class: ["ecp-table-action__icon", n.icon] }) : e._e(), l("span", [e._v(e._s(n.label))])])], 1), n.divider ? l("el-divider", { attrs: { direction: "vertical" } }) : e._e()], 1);
|
|
420
|
+
}), t.visibleDropDownActions.length ? l("el-dropdown", { attrs: { trigger: "click" }, on: { command: t.handleDropdownCommand } }, [l("span", { staticClass: "ecp-table-action__more" }, [l("el-button", { attrs: { type: "text", size: "small" } }, [e._v(" 更多"), l("i", { staticClass: "el-icon-arrow-down el-icon--right" })])], 1), l("el-dropdown-menu", { attrs: { slot: "dropdown" }, slot: "dropdown" }, e._l(t.visibleDropDownActions, function(n, i) {
|
|
421
|
+
return l("el-dropdown-item", { key: `dropdown-${i}`, attrs: { command: i, disabled: n.disabled, divided: !!n.divider } }, [l("span", { staticClass: "ecp-table-action__dropdown-item" }, [n.icon ? l("i", { class: ["ecp-table-action__icon", n.icon] }) : e._e(), l("span", [e._v(e._s(n.label))])])]);
|
|
422
|
+
}), 1)], 1) : e._e()], 2);
|
|
423
|
+
}, Ke = [], qe = /* @__PURE__ */ se(
|
|
424
|
+
We,
|
|
425
|
+
Ve,
|
|
426
|
+
Ke,
|
|
427
|
+
!1,
|
|
428
|
+
null,
|
|
429
|
+
"1b2d6c42",
|
|
430
|
+
null,
|
|
431
|
+
null
|
|
432
|
+
);
|
|
433
|
+
const Ae = qe.exports;
|
|
434
|
+
function st(A) {
|
|
435
|
+
const e = M(null), l = () => {
|
|
436
|
+
const i = we(e);
|
|
437
|
+
if (!i)
|
|
438
|
+
throw new Error("ProTable instance has not been registered");
|
|
439
|
+
return i;
|
|
440
|
+
};
|
|
441
|
+
return [(i) => {
|
|
442
|
+
e.value = i;
|
|
443
|
+
}, {
|
|
444
|
+
setProps: (i) => l().setProps(i),
|
|
445
|
+
reload: (i) => l().reload(i),
|
|
446
|
+
setLoading: (i) => l().setLoading(i),
|
|
447
|
+
getDataSource: () => l().getDataSource(),
|
|
448
|
+
getRawDataSource: () => l().getRawDataSource(),
|
|
449
|
+
setTableData: (i) => l().setTableData(i),
|
|
450
|
+
getColumns: () => l().getColumns(),
|
|
451
|
+
setColumns: (i) => l().setColumns(i),
|
|
452
|
+
setPagination: (i) => l().setPagination(i),
|
|
453
|
+
getSelectRowKeys: () => l().getSelectRowKeys(),
|
|
454
|
+
getSelectRows: () => l().getSelectRows(),
|
|
455
|
+
clearSelectedRowKeys: () => l().clearSelectedRowKeys(),
|
|
456
|
+
setSelectedRowKeys: (i) => l().setSelectedRowKeys(i),
|
|
457
|
+
deleteSelectRowByKey: (i) => l().deleteSelectRowByKey(i),
|
|
458
|
+
updateTableDataRecord: (i, P) => l().updateTableDataRecord(i, P),
|
|
459
|
+
deleteTableDataRecord: (i) => l().deleteTableDataRecord(i),
|
|
460
|
+
insertTableDataRecord: (i, P) => l().insertTableDataRecord(i, P),
|
|
461
|
+
getPaginationRef: () => l().getPaginationRef(),
|
|
462
|
+
getShowPagination: () => l().getShowPagination(),
|
|
463
|
+
setShowPagination: (i) => l().setShowPagination(i),
|
|
464
|
+
expandAll: () => {
|
|
465
|
+
var i, P;
|
|
466
|
+
return (P = (i = l()).expandAll) == null ? void 0 : P.call(i);
|
|
467
|
+
},
|
|
468
|
+
collapseAll: () => {
|
|
469
|
+
var i, P;
|
|
470
|
+
return (P = (i = l()).collapseAll) == null ? void 0 : P.call(i);
|
|
471
|
+
}
|
|
472
|
+
}];
|
|
473
|
+
}
|
|
474
|
+
const Ne = /* @__PURE__ */ Z({
|
|
3
475
|
__name: "ProFormItem",
|
|
4
476
|
props: {
|
|
5
477
|
schema: null,
|
|
@@ -8,125 +480,96 @@ const de = /* @__PURE__ */ W({
|
|
|
8
480
|
autoPlaceholder: { type: Boolean },
|
|
9
481
|
formActionType: null
|
|
10
482
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const e =
|
|
483
|
+
setup(A) {
|
|
484
|
+
const e = A, l = ye(), t = B(() => ({
|
|
13
485
|
schema: e.schema,
|
|
14
486
|
values: e.formModel,
|
|
15
487
|
model: e.formModel,
|
|
16
488
|
field: e.schema.field
|
|
17
|
-
})),
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
}),
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
}), P =
|
|
489
|
+
})), n = B(() => {
|
|
490
|
+
const p = e.schema.ifShow;
|
|
491
|
+
return p === void 0 ? !0 : typeof p == "boolean" ? p : p(t.value);
|
|
492
|
+
}), i = B(() => {
|
|
493
|
+
const p = e.schema.show;
|
|
494
|
+
return p === void 0 ? !0 : typeof p == "boolean" ? p : p(t.value);
|
|
495
|
+
}), P = B(() => {
|
|
24
496
|
if (e.formDisabled)
|
|
25
497
|
return !0;
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
}),
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
}),
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
498
|
+
const p = e.schema.dynamicDisabled;
|
|
499
|
+
return p === void 0 ? !1 : typeof p == "boolean" ? p : p(t.value);
|
|
500
|
+
}), z = B(() => {
|
|
501
|
+
const p = e.schema.dynamicRules;
|
|
502
|
+
return p ? Array.isArray(p) ? p : p(t.value) : e.schema.rules;
|
|
503
|
+
}), s = B(() => {
|
|
504
|
+
const p = e.schema.componentProps;
|
|
505
|
+
if (!p)
|
|
34
506
|
return { props: {}, listeners: {} };
|
|
35
|
-
const
|
|
507
|
+
const y = typeof p == "function" ? p({
|
|
36
508
|
...t.value,
|
|
37
509
|
formActionType: e.formActionType
|
|
38
|
-
}) : { ...
|
|
39
|
-
for (const [
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
510
|
+
}) : { ...p }, R = {}, x = {};
|
|
511
|
+
for (const [f, d] of Object.entries(y))
|
|
512
|
+
if (f.length > 2 && /^on[A-Za-z]/.test(f) && typeof d == "function") {
|
|
513
|
+
const O = f.slice(2).charAt(0).toLowerCase() + f.slice(3);
|
|
514
|
+
x[O] = d;
|
|
43
515
|
} else
|
|
44
|
-
R[
|
|
45
|
-
return { props: R, listeners:
|
|
46
|
-
}),
|
|
47
|
-
const
|
|
48
|
-
return Array.isArray(
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
return
|
|
516
|
+
R[f] = d;
|
|
517
|
+
return { props: R, listeners: x };
|
|
518
|
+
}), v = B(() => s.value.props), h = B(() => s.value.listeners), c = B(() => !!l.default), b = (p) => {
|
|
519
|
+
const y = p == null ? void 0 : p.options;
|
|
520
|
+
return Array.isArray(y) ? y : void 0;
|
|
521
|
+
}, k = B(() => {
|
|
522
|
+
const p = e.schema.render;
|
|
523
|
+
return p ? {
|
|
52
524
|
render() {
|
|
53
|
-
const
|
|
54
|
-
return Array.isArray(
|
|
525
|
+
const y = p(t.value);
|
|
526
|
+
return Array.isArray(y) ? ne("span", y) : y;
|
|
55
527
|
}
|
|
56
528
|
} : null;
|
|
57
529
|
});
|
|
58
|
-
return { __sfc: !0, props: e, slots: l, renderParams: t, shouldRender:
|
|
530
|
+
return { __sfc: !0, props: e, slots: l, renderParams: t, shouldRender: n, shouldShow: i, effectiveDisabled: P, effectiveRules: z, effectiveComponentPropsAndListeners: s, effectiveComponentProps: v, effectiveComponentListeners: h, hasSlot: c, getOptions: b, renderComponent: k };
|
|
59
531
|
}
|
|
60
532
|
});
|
|
61
|
-
|
|
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
|
-
var m;
|
|
65
|
-
if (P ? (m = function(y) {
|
|
66
|
-
y = y || // cached call
|
|
67
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
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
|
-
}, p._ssrRegister = m) : s && (m = C ? function() {
|
|
70
|
-
s.call(
|
|
71
|
-
this,
|
|
72
|
-
(p.functional ? this.parent : this).$root.$options.shadowRoot
|
|
73
|
-
);
|
|
74
|
-
} : s), 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
|
-
};
|
|
81
|
-
} else {
|
|
82
|
-
var v = p.beforeCreate;
|
|
83
|
-
p.beforeCreate = v ? [].concat(v, m) : [m];
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
exports: _,
|
|
87
|
-
options: p
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
var me = function() {
|
|
533
|
+
var je = function() {
|
|
91
534
|
var e = this, l = e._self._c, t = e._self._setupProxy;
|
|
92
|
-
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(
|
|
93
|
-
return l("div", { key:
|
|
94
|
-
}) : 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(
|
|
95
|
-
e.$set(e.formModel, e.schema.field,
|
|
96
|
-
}, 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(
|
|
97
|
-
e.$set(e.formModel, e.schema.field,
|
|
98
|
-
}, 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(
|
|
99
|
-
e.$set(e.formModel, e.schema.field,
|
|
100
|
-
}, expression: "formModel[schema.field]" } }, "el-select", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(
|
|
101
|
-
return l("el-option", { key: String(
|
|
102
|
-
}), 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(
|
|
103
|
-
e.$set(e.formModel, e.schema.field,
|
|
104
|
-
}, 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(
|
|
105
|
-
e.$set(e.formModel, e.schema.field,
|
|
106
|
-
}, 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(
|
|
107
|
-
e.$set(e.formModel, e.schema.field,
|
|
108
|
-
}, 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(
|
|
109
|
-
e.$set(e.formModel, e.schema.field,
|
|
110
|
-
}, 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(
|
|
111
|
-
e.$set(e.formModel, e.schema.field,
|
|
112
|
-
}, expression: "formModel[schema.field]" } }, "el-checkbox-group", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(
|
|
113
|
-
return l("el-checkbox", { key: String(
|
|
114
|
-
}), 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(
|
|
115
|
-
e.$set(e.formModel, e.schema.field,
|
|
116
|
-
}, expression: "formModel[schema.field]" } }, "el-radio-group", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(
|
|
117
|
-
return l("el-radio", { key: String(
|
|
535
|
+
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(n, i) {
|
|
536
|
+
return l("div", { key: i, staticClass: "ecp-pro-form-item__help-item" }, [e._v(" " + e._s(n) + " ")]);
|
|
537
|
+
}) : 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(n) {
|
|
538
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
539
|
+
}, 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(n) {
|
|
540
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
541
|
+
}, 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(n) {
|
|
542
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
543
|
+
}, expression: "formModel[schema.field]" } }, "el-select", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(n) {
|
|
544
|
+
return l("el-option", { key: String(n.value), attrs: { label: n.label, value: n.value } });
|
|
545
|
+
}), 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(n) {
|
|
546
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
547
|
+
}, 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(n) {
|
|
548
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
549
|
+
}, 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(n) {
|
|
550
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
551
|
+
}, 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(n) {
|
|
552
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
553
|
+
}, 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(n) {
|
|
554
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
555
|
+
}, expression: "formModel[schema.field]" } }, "el-checkbox-group", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(n) {
|
|
556
|
+
return l("el-checkbox", { key: String(n.value), attrs: { label: n.value } }, [e._v(" " + e._s(n.label) + " ")]);
|
|
557
|
+
}), 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(n) {
|
|
558
|
+
e.$set(e.formModel, e.schema.field, n);
|
|
559
|
+
}, expression: "formModel[schema.field]" } }, "el-radio-group", t.effectiveComponentProps, !1), t.effectiveComponentListeners), e._l(t.getOptions(t.effectiveComponentProps) || [], function(n) {
|
|
560
|
+
return l("el-radio", { key: String(n.value), attrs: { label: n.value } }, [e._v(" " + e._s(n.label) + " ")]);
|
|
118
561
|
}), 1) : e._e()]], 2) : e._e();
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
562
|
+
}, He = [], Ge = /* @__PURE__ */ se(
|
|
563
|
+
Ne,
|
|
564
|
+
je,
|
|
565
|
+
He,
|
|
123
566
|
!1,
|
|
124
567
|
null,
|
|
125
568
|
"cfc968c5",
|
|
126
569
|
null,
|
|
127
570
|
null
|
|
128
571
|
);
|
|
129
|
-
const
|
|
572
|
+
const ke = Ge.exports, Ue = /* @__PURE__ */ Z({
|
|
130
573
|
__name: "FormActions",
|
|
131
574
|
props: {
|
|
132
575
|
showActionButtonGroup: { type: Boolean, default: !0 },
|
|
@@ -143,28 +586,28 @@ const se = ve.exports, he = /* @__PURE__ */ W({
|
|
|
143
586
|
actionColOptions: null
|
|
144
587
|
},
|
|
145
588
|
emits: ["submit", "reset", "toggle"],
|
|
146
|
-
setup(
|
|
589
|
+
setup(A) {
|
|
147
590
|
return { __sfc: !0 };
|
|
148
591
|
}
|
|
149
592
|
});
|
|
150
|
-
var
|
|
593
|
+
var Xe = function() {
|
|
151
594
|
var e = this, l = e._self._c;
|
|
152
595
|
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) {
|
|
153
596
|
return e.$emit("submit");
|
|
154
597
|
} } }, [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
598
|
return e.$emit("reset");
|
|
156
599
|
} } }, [e._v(" " + e._s(e.resetButtonText) + " ")]) : e._e(), e._t("actions")], 2);
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
600
|
+
}, Ze = [], Je = /* @__PURE__ */ se(
|
|
601
|
+
Ue,
|
|
602
|
+
Xe,
|
|
603
|
+
Ze,
|
|
161
604
|
!1,
|
|
162
605
|
null,
|
|
163
606
|
"489c88d2",
|
|
164
607
|
null,
|
|
165
608
|
null
|
|
166
609
|
);
|
|
167
|
-
const
|
|
610
|
+
const Te = Je.exports, Qe = /* @__PURE__ */ Z({
|
|
168
611
|
__name: "ProForm",
|
|
169
612
|
props: {
|
|
170
613
|
schemas: null,
|
|
@@ -194,251 +637,253 @@ const le = ye.exports, we = /* @__PURE__ */ W({
|
|
|
194
637
|
formListeners: null
|
|
195
638
|
},
|
|
196
639
|
emits: ["submit", "reset", "register"],
|
|
197
|
-
setup(
|
|
198
|
-
const t =
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
},
|
|
202
|
-
let
|
|
203
|
-
for (const
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
640
|
+
setup(A, { expose: e, emit: l }) {
|
|
641
|
+
const t = A, n = ye(), i = M(), P = M(), z = M(!1), s = M(!0), v = M({}), h = M({}), c = M([]), b = M({}), k = { xl: 1920, lg: 1200, md: 992, sm: 768 }, p = (r, g, C) => {
|
|
642
|
+
const w = C ?? (typeof window < "u" ? window.innerWidth : 1920), _ = r ?? {}, T = g ?? {}, E = T.span ?? 8;
|
|
643
|
+
return w >= k.xl ? _.xl ?? T.xl ?? _.lg ?? T.lg ?? _.md ?? T.md ?? _.sm ?? T.sm ?? _.xs ?? T.xs ?? _.span ?? E : w >= k.lg ? _.lg ?? T.lg ?? _.md ?? T.md ?? _.sm ?? T.sm ?? _.xs ?? T.xs ?? _.span ?? E : w >= k.md ? _.md ?? T.md ?? _.sm ?? T.sm ?? _.xs ?? T.xs ?? _.span ?? E : w >= k.sm ? _.sm ?? T.sm ?? _.xs ?? T.xs ?? _.span ?? E : _.xs ?? T.xs ?? _.span ?? E;
|
|
644
|
+
}, { getSetting: y } = Fe(), R = B(() => ({ ...y("ProForm"), ...t, ...b.value })), x = B(() => R.value.actionColOptions ?? { span: 24 }), f = M(typeof window < "u" ? window.innerWidth : 1920), d = (r, g, C, w) => {
|
|
645
|
+
let _ = 24, T = 1, E = 0;
|
|
646
|
+
for (const N of r) {
|
|
647
|
+
const G = p(N.colProps, g, w);
|
|
648
|
+
if (G > _) {
|
|
649
|
+
if (T++, T > C)
|
|
207
650
|
break;
|
|
208
|
-
|
|
651
|
+
_ = 24 - G;
|
|
209
652
|
} else
|
|
210
|
-
|
|
211
|
-
|
|
653
|
+
_ -= G;
|
|
654
|
+
E++;
|
|
212
655
|
}
|
|
213
|
-
return
|
|
214
|
-
},
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
656
|
+
return E;
|
|
657
|
+
}, O = B(() => {
|
|
658
|
+
const r = c.value.filter((_) => H(_));
|
|
659
|
+
if (!R.value.showAdvancedButton)
|
|
217
660
|
return !1;
|
|
218
|
-
const
|
|
219
|
-
return console.log(
|
|
220
|
-
}),
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
223
|
-
return
|
|
224
|
-
const
|
|
225
|
-
return
|
|
226
|
-
}),
|
|
227
|
-
let
|
|
228
|
-
return typeof
|
|
229
|
-
},
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
}),
|
|
235
|
-
},
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
661
|
+
const g = R.value.alwaysShowLines ?? 1, C = R.value.baseColProps, w = d(r, C, g, f.value);
|
|
662
|
+
return console.log(r.length, w), r.length > w;
|
|
663
|
+
}), j = B(() => R.value.formListeners ?? {}), D = B(() => {
|
|
664
|
+
const r = c.value.filter((_) => H(_));
|
|
665
|
+
if (!R.value.showAdvancedButton || !s.value)
|
|
666
|
+
return r;
|
|
667
|
+
const g = R.value.alwaysShowLines ?? 1, C = R.value.baseColProps, w = d(r, C, g, f.value);
|
|
668
|
+
return r.slice(0, w);
|
|
669
|
+
}), H = (r) => {
|
|
670
|
+
let g = !0, C = !0;
|
|
671
|
+
return typeof r.ifShow == "function" && (g = r.ifShow({ schema: r, values: v.value, model: v.value, field: r.field })), typeof r.ifShow == "boolean" && (g = r.ifShow), typeof r.show == "function" && (C = r.show({ schema: r, values: v.value, model: v.value, field: r.field })), typeof r.show == "boolean" && (C = r.show), g && C;
|
|
672
|
+
}, ee = (r) => r.colProps ?? R.value.baseColProps ?? {}, re = (r) => r.slot || r.field, L = () => {
|
|
673
|
+
const r = {}, g = {}, C = R.value.initialValues ?? t.initialValues;
|
|
674
|
+
c.value.forEach((w) => {
|
|
675
|
+
var _;
|
|
676
|
+
r[w.field] = w.defaultValue ?? (C == null ? void 0 : C[w.field]), (_ = w.rules) != null && _.length && (g[w.field] = w.rules);
|
|
677
|
+
}), v.value = { ...v.value, ...r }, h.value = g;
|
|
678
|
+
}, J = (r) => {
|
|
679
|
+
const g = { ...r };
|
|
680
|
+
return c.value.forEach((C) => {
|
|
681
|
+
const w = C.ifShow;
|
|
682
|
+
if (w === void 0)
|
|
240
683
|
return;
|
|
241
|
-
(typeof
|
|
242
|
-
}),
|
|
243
|
-
},
|
|
244
|
-
const
|
|
245
|
-
if (!(
|
|
246
|
-
return
|
|
247
|
-
const
|
|
248
|
-
return
|
|
249
|
-
const
|
|
250
|
-
Array.isArray(
|
|
251
|
-
}),
|
|
252
|
-
},
|
|
253
|
-
var
|
|
684
|
+
(typeof w == "boolean" ? w : w({ schema: C, values: r, model: r, field: C.field })) || delete g[C.field];
|
|
685
|
+
}), g;
|
|
686
|
+
}, Q = (r) => {
|
|
687
|
+
const g = J(r), C = b.value.fieldMapToTime;
|
|
688
|
+
if (!(C != null && C.length))
|
|
689
|
+
return g;
|
|
690
|
+
const w = { ...g };
|
|
691
|
+
return C.forEach(([_, [T, E]]) => {
|
|
692
|
+
const N = w[_];
|
|
693
|
+
Array.isArray(N) && N.length === 2 && (delete w[_], w[T] = N[0], w[E] = N[1]);
|
|
694
|
+
}), w;
|
|
695
|
+
}, W = async () => {
|
|
696
|
+
var r;
|
|
254
697
|
try {
|
|
255
|
-
await ((
|
|
256
|
-
} catch (
|
|
257
|
-
console.error("Form validation failed:",
|
|
698
|
+
await ((r = i.value) == null ? void 0 : r.validate()), R.value.submitFunc ? await R.value.submitFunc() : (z.value = !0, l("submit", Q({ ...v.value })));
|
|
699
|
+
} catch (g) {
|
|
700
|
+
console.error("Form validation failed:", g);
|
|
258
701
|
} finally {
|
|
259
|
-
|
|
702
|
+
z.value = !1;
|
|
260
703
|
}
|
|
261
704
|
}, ie = async () => {
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
},
|
|
265
|
-
var
|
|
266
|
-
(
|
|
267
|
-
},
|
|
268
|
-
var
|
|
269
|
-
return ((
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
}))) :
|
|
273
|
-
var
|
|
274
|
-
const
|
|
275
|
-
return
|
|
276
|
-
},
|
|
277
|
-
var
|
|
278
|
-
(
|
|
279
|
-
},
|
|
280
|
-
(Array.isArray(
|
|
281
|
-
const
|
|
282
|
-
|
|
705
|
+
var r;
|
|
706
|
+
R.value.resetFunc ? await R.value.resetFunc() : ((r = i.value) == null || r.resetFields(), L(), l("reset"), R.value.submitOnReset && await W());
|
|
707
|
+
}, Y = (r) => (v.value = { ...v.value, ...r }, Promise.resolve()), V = () => Q({ ...v.value }), ce = async () => {
|
|
708
|
+
var r;
|
|
709
|
+
(r = i.value) == null || r.resetFields(), L();
|
|
710
|
+
}, ue = (r) => {
|
|
711
|
+
var g;
|
|
712
|
+
return ((g = i.value) == null ? void 0 : g.validate(r)) ?? Promise.resolve();
|
|
713
|
+
}, de = (r) => i.value ? r != null && r.length ? Promise.all(r.map((g) => new Promise((C, w) => {
|
|
714
|
+
i.value.validateField(g, (_) => _ ? C(void 0) : w(new Error("Validation failed")));
|
|
715
|
+
}))) : i.value.validate() : Promise.resolve(), fe = async (r, g) => {
|
|
716
|
+
var w;
|
|
717
|
+
const C = (w = P.value) == null ? void 0 : w.querySelector(`[data-field="${r}"]`);
|
|
718
|
+
return C && C.scrollIntoView({ behavior: (g == null ? void 0 : g.behavior) ?? "smooth", block: (g == null ? void 0 : g.block) ?? "nearest" }), Promise.resolve();
|
|
719
|
+
}, pe = (r) => {
|
|
720
|
+
var g;
|
|
721
|
+
(g = i.value) == null || g.clearValidate(r);
|
|
722
|
+
}, me = async (r) => {
|
|
723
|
+
(Array.isArray(r) ? r : [r]).forEach((C) => {
|
|
724
|
+
const w = c.value.findIndex((_) => _.field === C.field);
|
|
725
|
+
w >= 0 && (c.value[w] = { ...c.value[w], ...C });
|
|
283
726
|
});
|
|
284
|
-
},
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
else if (
|
|
288
|
-
const
|
|
289
|
-
|
|
727
|
+
}, K = async (r, g, C) => {
|
|
728
|
+
if (C)
|
|
729
|
+
c.value.unshift(r);
|
|
730
|
+
else if (g) {
|
|
731
|
+
const w = c.value.findIndex((_) => _.field === g);
|
|
732
|
+
c.value.splice(w + 1, 0, r);
|
|
290
733
|
} else
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
if (
|
|
298
|
-
|
|
734
|
+
c.value.push(r);
|
|
735
|
+
L();
|
|
736
|
+
}, ve = async (r) => {
|
|
737
|
+
const g = Array.isArray(r) ? r : [r];
|
|
738
|
+
c.value = c.value.filter((C) => !g.includes(C.field));
|
|
739
|
+
}, he = async (r) => {
|
|
740
|
+
if (b.value = { ...b.value, ...r }, r.schemas) {
|
|
741
|
+
c.value = [...r.schemas];
|
|
299
742
|
debugger;
|
|
300
|
-
|
|
743
|
+
L();
|
|
301
744
|
}
|
|
302
|
-
},
|
|
303
|
-
getFieldsValue:
|
|
304
|
-
setFieldsValue:
|
|
305
|
-
resetFields:
|
|
306
|
-
validate:
|
|
307
|
-
validateFields:
|
|
308
|
-
submit:
|
|
309
|
-
scrollToField:
|
|
310
|
-
clearValidate:
|
|
311
|
-
updateSchema:
|
|
312
|
-
appendSchemaByField:
|
|
313
|
-
removeSchemaByField:
|
|
314
|
-
setProps:
|
|
745
|
+
}, te = {
|
|
746
|
+
getFieldsValue: V,
|
|
747
|
+
setFieldsValue: Y,
|
|
748
|
+
resetFields: ce,
|
|
749
|
+
validate: ue,
|
|
750
|
+
validateFields: de,
|
|
751
|
+
submit: W,
|
|
752
|
+
scrollToField: fe,
|
|
753
|
+
clearValidate: pe,
|
|
754
|
+
updateSchema: me,
|
|
755
|
+
appendSchemaByField: K,
|
|
756
|
+
removeSchemaByField: ve,
|
|
757
|
+
setProps: he
|
|
315
758
|
};
|
|
316
|
-
e(
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
typeof window < "u" && (
|
|
759
|
+
e(te);
|
|
760
|
+
const q = () => {
|
|
761
|
+
c.value = [...t.schemas ?? []], L();
|
|
762
|
+
}, oe = () => {
|
|
763
|
+
typeof window < "u" && (f.value = window.innerWidth);
|
|
321
764
|
};
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
}),
|
|
325
|
-
typeof window < "u" && window.removeEventListener("resize",
|
|
326
|
-
}),
|
|
765
|
+
return xe(() => {
|
|
766
|
+
q(), l("register", te), typeof window < "u" && window.addEventListener("resize", oe);
|
|
767
|
+
}), Re(() => {
|
|
768
|
+
typeof window < "u" && window.removeEventListener("resize", oe);
|
|
769
|
+
}), ae(() => [t.schemas, t.initialValues], q, { deep: !0 }), { __sfc: !0, props: t, emit: l, slots: n, formRef: i, formWrapRef: P, submitLoading: z, collapsed: s, formModel: v, formRules: h, innerSchemas: c, innerProps: b, BREAKPOINTS: k, getEffectiveSpan: p, getComponentSetting: y, effectiveProps: R, effectiveActionColOptions: x, windowWidth: f, getVisibleSchemaCount: d, hasMoreFields: O, formListeners: j, displaySchemas: D, shouldShow: H, getColProps: ee, getSlotName: re, initForm: L, filterByIfShow: J, processFieldMapToTime: Q, handleSubmit: W, handleReset: ie, setFieldsValue: Y, getFieldsValue: V, resetFields: ce, validate: ue, validateFields: de, scrollToField: fe, clearValidate: pe, updateSchema: me, appendSchemaByField: K, removeSchemaByField: ve, setProps: he, formActionRef: te, syncSchemas: q, handleResize: oe, ProFormItem: ke, FormActions: Te };
|
|
327
770
|
}
|
|
328
771
|
});
|
|
329
|
-
var
|
|
772
|
+
var Ye = function() {
|
|
330
773
|
var e = this, l = e._self._c, t = e._self._setupProxy;
|
|
331
|
-
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(
|
|
332
|
-
var
|
|
333
|
-
return [t.shouldShow(
|
|
334
|
-
}), 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(
|
|
774
|
+
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(n) {
|
|
775
|
+
var i, P;
|
|
776
|
+
return [t.shouldShow(n) ? l("el-col", e._b({ key: n.field, attrs: { offset: ((i = n.colProps) == null ? void 0 : i.offset) ?? ((P = t.effectiveProps.baseColProps) == null ? void 0 : P.offset) ?? 0, "data-field": n.field } }, "el-col", t.getColProps(n), !1), [l(t.ProFormItem, { attrs: { schema: n, "form-model": t.formModel, "form-disabled": t.effectiveProps.disabled, "auto-placeholder": t.effectiveProps.autoSetPlaceholder, "form-action-type": t.formActionRef } }, [t.slots[t.getSlotName(n)] ? [e._t(t.getSlotName(n), null, { model: t.formModel, schema: n, field: n.field, values: t.formModel })] : e._e()], 2)], 1) : e._e()];
|
|
777
|
+
}), 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(n) {
|
|
335
778
|
t.collapsed = !t.collapsed;
|
|
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(
|
|
779
|
+
} } }, [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(n) {
|
|
337
780
|
t.collapsed = !t.collapsed;
|
|
338
781
|
} } }, [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
|
-
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
782
|
+
}, et = [], tt = /* @__PURE__ */ se(
|
|
783
|
+
Qe,
|
|
784
|
+
Ye,
|
|
785
|
+
et,
|
|
343
786
|
!1,
|
|
344
787
|
null,
|
|
345
|
-
"
|
|
788
|
+
"140fc052",
|
|
346
789
|
null,
|
|
347
790
|
null
|
|
348
791
|
);
|
|
349
|
-
const
|
|
350
|
-
function
|
|
351
|
-
const e =
|
|
352
|
-
e.value =
|
|
353
|
-
const
|
|
792
|
+
const Me = tt.exports;
|
|
793
|
+
function rt(A) {
|
|
794
|
+
const e = M(null), l = M(A ? we(A) : void 0), t = () => A ? we(A) : void 0, n = (f) => {
|
|
795
|
+
e.value = f;
|
|
796
|
+
const d = t();
|
|
354
797
|
debugger;
|
|
355
|
-
|
|
798
|
+
d && Object.keys(d).length > 0 && f.setProps(d);
|
|
356
799
|
};
|
|
357
|
-
return
|
|
800
|
+
return A && ae(
|
|
358
801
|
() => t(),
|
|
359
|
-
(
|
|
360
|
-
l.value =
|
|
802
|
+
(f) => {
|
|
803
|
+
l.value = f, f && e.value && e.value.setProps(f);
|
|
361
804
|
},
|
|
362
805
|
{ deep: !0 }
|
|
363
|
-
), [
|
|
364
|
-
register:
|
|
806
|
+
), [n, {
|
|
807
|
+
register: n,
|
|
365
808
|
formAction: e,
|
|
366
809
|
getFieldsValue: () => {
|
|
367
|
-
var
|
|
368
|
-
return ((
|
|
810
|
+
var f;
|
|
811
|
+
return ((f = e.value) == null ? void 0 : f.getFieldsValue()) ?? {};
|
|
369
812
|
},
|
|
370
|
-
setFieldsValue: async (
|
|
371
|
-
var
|
|
372
|
-
await ((
|
|
813
|
+
setFieldsValue: async (f) => {
|
|
814
|
+
var d;
|
|
815
|
+
await ((d = e.value) == null ? void 0 : d.setFieldsValue(f));
|
|
373
816
|
},
|
|
374
817
|
resetFields: async () => {
|
|
375
|
-
var
|
|
376
|
-
await ((
|
|
818
|
+
var f;
|
|
819
|
+
await ((f = e.value) == null ? void 0 : f.resetFields());
|
|
377
820
|
},
|
|
378
|
-
validate: (
|
|
379
|
-
var
|
|
380
|
-
return ((
|
|
821
|
+
validate: (f) => {
|
|
822
|
+
var d;
|
|
823
|
+
return ((d = e.value) == null ? void 0 : d.validate(f)) ?? Promise.resolve();
|
|
381
824
|
},
|
|
382
|
-
validateFields: (
|
|
383
|
-
var
|
|
384
|
-
return ((
|
|
825
|
+
validateFields: (f) => {
|
|
826
|
+
var d;
|
|
827
|
+
return ((d = e.value) == null ? void 0 : d.validateFields(f)) ?? Promise.resolve();
|
|
385
828
|
},
|
|
386
829
|
submit: () => {
|
|
387
|
-
var
|
|
388
|
-
return ((
|
|
830
|
+
var f;
|
|
831
|
+
return ((f = e.value) == null ? void 0 : f.submit()) ?? Promise.resolve();
|
|
389
832
|
},
|
|
390
|
-
scrollToField: (
|
|
391
|
-
var
|
|
392
|
-
return ((
|
|
833
|
+
scrollToField: (f, d) => {
|
|
834
|
+
var O;
|
|
835
|
+
return ((O = e.value) == null ? void 0 : O.scrollToField(f, d)) ?? Promise.resolve();
|
|
393
836
|
},
|
|
394
|
-
clearValidate: (
|
|
395
|
-
var
|
|
396
|
-
(
|
|
837
|
+
clearValidate: (f) => {
|
|
838
|
+
var d;
|
|
839
|
+
(d = e.value) == null || d.clearValidate(f);
|
|
397
840
|
},
|
|
398
|
-
updateSchema: (
|
|
399
|
-
var
|
|
400
|
-
return ((
|
|
841
|
+
updateSchema: (f) => {
|
|
842
|
+
var d;
|
|
843
|
+
return ((d = e.value) == null ? void 0 : d.updateSchema(f)) ?? Promise.resolve();
|
|
401
844
|
},
|
|
402
|
-
appendSchemaByField: (
|
|
403
|
-
var
|
|
404
|
-
return ((
|
|
845
|
+
appendSchemaByField: (f, d, O) => {
|
|
846
|
+
var j;
|
|
847
|
+
return ((j = e.value) == null ? void 0 : j.appendSchemaByField(f, d, O)) ?? Promise.resolve();
|
|
405
848
|
},
|
|
406
|
-
removeSchemaByField: (
|
|
407
|
-
var
|
|
408
|
-
return ((
|
|
849
|
+
removeSchemaByField: (f) => {
|
|
850
|
+
var d;
|
|
851
|
+
return ((d = e.value) == null ? void 0 : d.removeSchemaByField(f)) ?? Promise.resolve();
|
|
409
852
|
},
|
|
410
|
-
setProps: async (
|
|
411
|
-
var
|
|
412
|
-
l.value = { ...l.value, ...
|
|
853
|
+
setProps: async (f) => {
|
|
854
|
+
var d;
|
|
855
|
+
l.value = { ...l.value, ...f }, await ((d = e.value) == null ? void 0 : d.setProps(f));
|
|
413
856
|
}
|
|
414
857
|
}];
|
|
415
858
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
{ name: "
|
|
419
|
-
{ name: "
|
|
420
|
-
{ name: "
|
|
421
|
-
|
|
422
|
-
// { name: 'ProDescriptions', component: ProDescriptions },
|
|
859
|
+
const ot = [
|
|
860
|
+
{ name: "ProTable", component: Be },
|
|
861
|
+
{ name: "TableAction", component: Ae },
|
|
862
|
+
{ name: "ProForm", component: Me },
|
|
863
|
+
{ name: "ProFormItem", component: ke },
|
|
864
|
+
{ name: "FormActions", component: Te }
|
|
423
865
|
];
|
|
424
|
-
function
|
|
425
|
-
|
|
426
|
-
|
|
866
|
+
function lt(A) {
|
|
867
|
+
ot.forEach(({ name: e, component: l }) => {
|
|
868
|
+
A.component(e, l);
|
|
427
869
|
});
|
|
428
870
|
}
|
|
429
|
-
const
|
|
430
|
-
install:
|
|
431
|
-
|
|
432
|
-
ProForm:
|
|
433
|
-
|
|
434
|
-
// ProDescriptions,
|
|
871
|
+
const it = {
|
|
872
|
+
install: lt,
|
|
873
|
+
ProTable: Be,
|
|
874
|
+
ProForm: Me,
|
|
875
|
+
TableAction: Ae
|
|
435
876
|
};
|
|
436
877
|
export {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
878
|
+
Te as FormActions,
|
|
879
|
+
Me as ProForm,
|
|
880
|
+
ke as ProFormItem,
|
|
881
|
+
Be as ProTable,
|
|
882
|
+
Ae as TableAction,
|
|
883
|
+
it as default,
|
|
884
|
+
lt as install,
|
|
885
|
+
Fe as useComponentSetting,
|
|
886
|
+
rt as useForm,
|
|
887
|
+
st as useProTable
|
|
443
888
|
};
|
|
444
889
|
//# sourceMappingURL=element-component-pro.es.js.map
|