@hz_yujin/vue-smart-table 0.1.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/CHANGELOG.md +39 -0
- package/LICENSE +21 -0
- package/README.md +668 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1540 -0
- package/dist/src/components/ProColumnEditor/ProColumnEditor.vue.d.ts +20 -0
- package/dist/src/components/ProColumnEditor/index.d.ts +2 -0
- package/dist/src/components/ProColumnEditor/types.d.ts +14 -0
- package/dist/src/components/ProSmartTable/ProSmartTable.vue.d.ts +114 -0
- package/dist/src/components/ProSmartTable/ProSmartTableSkeleton.vue.d.ts +26 -0
- package/dist/src/components/ProSmartTable/SmartFieldControl.vue.d.ts +12 -0
- package/dist/src/components/ProSmartTable/SmartSearchForm.vue.d.ts +35 -0
- package/dist/src/components/ProSmartTable/column-schema.d.ts +56 -0
- package/dist/src/components/ProSmartTable/index.d.ts +3 -0
- package/dist/src/components/ProSmartTable/types.d.ts +112 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/plugin.d.ts +8 -0
- package/package.json +69 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1540 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, createVNode as c, defineComponent as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as m, onMounted as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveComponent as x, resolveDirective as S, toDisplayString as C, unref as w, useAttrs as T, vShow as E, watch as D, withCtx as O, withDirectives as k, withModifiers as A } from "vue";
|
|
2
|
+
import { ElMessage as j, ElMessageBox as M } from "element-plus";
|
|
3
|
+
import { ArrowDown as ee, ArrowUp as N, Delete as P, Plus as F, Rank as I, RefreshLeft as L, RefreshRight as R, Search as z, Setting as te } from "@element-plus/icons-vue";
|
|
4
|
+
//#region src/components/ProSmartTable/column-schema.ts
|
|
5
|
+
var B = [
|
|
6
|
+
{
|
|
7
|
+
label: "输入框",
|
|
8
|
+
value: "input"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "密码",
|
|
12
|
+
value: "password"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "多行文本",
|
|
16
|
+
value: "textarea"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "数字",
|
|
20
|
+
value: "number"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "下拉选择",
|
|
24
|
+
value: "select"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "下拉多选",
|
|
28
|
+
value: "select-multiple"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "单选",
|
|
32
|
+
value: "radio"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "复选框",
|
|
36
|
+
value: "checkbox"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "复选组",
|
|
40
|
+
value: "checkbox-group"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "开关",
|
|
44
|
+
value: "switch"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "日期",
|
|
48
|
+
value: "date"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "日期时间",
|
|
52
|
+
value: "datetime"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "日期范围",
|
|
56
|
+
value: "daterange"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "日期时间范围",
|
|
60
|
+
value: "datetimerange"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "时间",
|
|
64
|
+
value: "time"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: "时间范围",
|
|
68
|
+
value: "timerange"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "月份",
|
|
72
|
+
value: "month"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "年份",
|
|
76
|
+
value: "year"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: "周",
|
|
80
|
+
value: "week"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: "级联选择",
|
|
84
|
+
value: "cascader"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: "树选择",
|
|
88
|
+
value: "tree-select"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: "自动完成",
|
|
92
|
+
value: "autocomplete"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: "评分",
|
|
96
|
+
value: "rate"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: "滑块",
|
|
100
|
+
value: "slider"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: "颜色",
|
|
104
|
+
value: "color"
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
function V(e = "col") {
|
|
108
|
+
return `${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
109
|
+
}
|
|
110
|
+
function H(e) {
|
|
111
|
+
let t = e.source ?? "fixed";
|
|
112
|
+
return {
|
|
113
|
+
visible: !0,
|
|
114
|
+
sortable: !1,
|
|
115
|
+
searchable: !1,
|
|
116
|
+
formable: !1,
|
|
117
|
+
required: !1,
|
|
118
|
+
formType: "input",
|
|
119
|
+
fixed: !1,
|
|
120
|
+
source: t,
|
|
121
|
+
deletable: t === "custom",
|
|
122
|
+
...e,
|
|
123
|
+
id: e.id || V()
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function U(e) {
|
|
127
|
+
return e.map((e) => ({
|
|
128
|
+
...H(e),
|
|
129
|
+
formOptions: e.formOptions?.map((e) => W(e)),
|
|
130
|
+
columnProps: e.columnProps ? { ...e.columnProps } : void 0,
|
|
131
|
+
formProps: e.formProps ? { ...e.formProps } : void 0
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
function W(e) {
|
|
135
|
+
return {
|
|
136
|
+
...e,
|
|
137
|
+
children: e.children?.map((e) => W(e))
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function G(e = {}) {
|
|
141
|
+
return H({
|
|
142
|
+
id: V("custom"),
|
|
143
|
+
prop: "",
|
|
144
|
+
label: "新列",
|
|
145
|
+
source: "custom",
|
|
146
|
+
deletable: !0,
|
|
147
|
+
visible: !0,
|
|
148
|
+
searchable: !1,
|
|
149
|
+
formable: !1,
|
|
150
|
+
required: !1,
|
|
151
|
+
formType: "input",
|
|
152
|
+
minWidth: 120,
|
|
153
|
+
...e
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function K(e) {
|
|
157
|
+
switch (e) {
|
|
158
|
+
case "date-range": return "daterange";
|
|
159
|
+
case "datetime-range": return "datetimerange";
|
|
160
|
+
case "time-range": return "timerange";
|
|
161
|
+
default: return e || "input";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/components/ProColumnEditor/ProColumnEditor.vue?vue&type=script&setup=true&lang.ts
|
|
166
|
+
var q = { class: "pro-column-editor__table-wrap" }, J = {
|
|
167
|
+
class: "pro-column-editor__row is-head",
|
|
168
|
+
role: "row"
|
|
169
|
+
}, ne = {
|
|
170
|
+
class: "is-check",
|
|
171
|
+
role: "columnheader"
|
|
172
|
+
}, re = ["data-row-index"], ie = {
|
|
173
|
+
class: "is-check",
|
|
174
|
+
role: "cell"
|
|
175
|
+
}, ae = {
|
|
176
|
+
class: "is-drag",
|
|
177
|
+
role: "cell"
|
|
178
|
+
}, oe = ["onPointerdown"], se = { role: "cell" }, ce = { role: "cell" }, le = { role: "cell" }, ue = { role: "cell" }, de = { role: "cell" }, fe = { role: "cell" }, pe = { role: "cell" }, me = { role: "cell" }, Y = { role: "cell" }, he = { role: "cell" }, ge = {
|
|
179
|
+
class: "is-action",
|
|
180
|
+
role: "cell"
|
|
181
|
+
}, _e = { class: "pro-column-editor__footer" }, ve = { class: "pro-column-editor__footer-left" }, ye = { class: "pro-column-editor__footer-right" }, be = /* @__PURE__ */ l({
|
|
182
|
+
name: "ProColumnEditor",
|
|
183
|
+
__name: "ProColumnEditor",
|
|
184
|
+
props: {
|
|
185
|
+
modelValue: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: !1
|
|
188
|
+
},
|
|
189
|
+
columns: { default: () => [] },
|
|
190
|
+
defaultColumns: { default: () => [] }
|
|
191
|
+
},
|
|
192
|
+
emits: [
|
|
193
|
+
"update:modelValue",
|
|
194
|
+
"save",
|
|
195
|
+
"restore",
|
|
196
|
+
"cancel"
|
|
197
|
+
],
|
|
198
|
+
setup(r, { emit: o }) {
|
|
199
|
+
let l = r, u = o, d = _({ rows: [] }), p = v(null), h = v(null), b = t({
|
|
200
|
+
get: () => l.modelValue,
|
|
201
|
+
set: (e) => u("update:modelValue", e)
|
|
202
|
+
}), S = t({
|
|
203
|
+
get: () => d.rows.length > 0 && d.rows.every((e) => e.visible !== !1),
|
|
204
|
+
set: (e) => {
|
|
205
|
+
d.rows.forEach((t) => {
|
|
206
|
+
t.visible = e;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
D(() => l.modelValue, (e) => {
|
|
211
|
+
e && (d.rows = U(l.columns), R());
|
|
212
|
+
});
|
|
213
|
+
function T() {
|
|
214
|
+
d.rows.push(G({ label: `新列${d.rows.length + 1}` }));
|
|
215
|
+
}
|
|
216
|
+
async function E() {
|
|
217
|
+
try {
|
|
218
|
+
await M.confirm("确定恢复默认列配置?将清除已保存的自定义列配置。", "恢复默认", {
|
|
219
|
+
type: "warning",
|
|
220
|
+
confirmButtonText: "确定",
|
|
221
|
+
cancelButtonText: "取消"
|
|
222
|
+
});
|
|
223
|
+
} catch {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
let e = l.defaultColumns.length > 0 ? l.defaultColumns : l.columns;
|
|
227
|
+
d.rows = U(e), u("restore");
|
|
228
|
+
}
|
|
229
|
+
function k(e) {
|
|
230
|
+
let t = d.rows[e];
|
|
231
|
+
!t || !W(t) || d.rows.splice(e, 1);
|
|
232
|
+
}
|
|
233
|
+
function A(e, t) {
|
|
234
|
+
e.fixed = e.fixed !== t && t;
|
|
235
|
+
}
|
|
236
|
+
function ee(e, t) {
|
|
237
|
+
e.formable = t, t || (e.required = !1);
|
|
238
|
+
}
|
|
239
|
+
function N(e, t) {
|
|
240
|
+
if (e === t || e < 0 || t < 0 || e >= d.rows.length || t >= d.rows.length) return;
|
|
241
|
+
let [n] = d.rows.splice(e, 1);
|
|
242
|
+
n && (d.rows.splice(t, 0, n), h.value = t);
|
|
243
|
+
}
|
|
244
|
+
function F(e) {
|
|
245
|
+
let t = p.value;
|
|
246
|
+
if (!t) return null;
|
|
247
|
+
let n = t.querySelectorAll(".pro-column-editor__row[data-row-index]");
|
|
248
|
+
if (!n.length) return null;
|
|
249
|
+
for (let t = 0; t < n.length; t++) {
|
|
250
|
+
let r = n[t].getBoundingClientRect();
|
|
251
|
+
if (e >= r.top && e <= r.bottom) return t;
|
|
252
|
+
}
|
|
253
|
+
return e < n[0].getBoundingClientRect().top ? 0 : n.length - 1;
|
|
254
|
+
}
|
|
255
|
+
function L(e) {
|
|
256
|
+
if (h.value == null) return;
|
|
257
|
+
let t = F(e.clientY);
|
|
258
|
+
t != null && t !== h.value && N(h.value, t);
|
|
259
|
+
}
|
|
260
|
+
function R() {
|
|
261
|
+
h.value = null, window.removeEventListener("pointermove", L), window.removeEventListener("pointerup", R), window.removeEventListener("pointercancel", R), document.body.classList.remove("pro-column-editor--dragging");
|
|
262
|
+
}
|
|
263
|
+
function z(e, t) {
|
|
264
|
+
if (e.button !== 0) return;
|
|
265
|
+
let n = d.rows[t];
|
|
266
|
+
!n || !K(n) || (e.preventDefault(), e.stopPropagation(), h.value = t, document.body.classList.add("pro-column-editor--dragging"), window.addEventListener("pointermove", L), window.addEventListener("pointerup", R), window.addEventListener("pointercancel", R));
|
|
267
|
+
}
|
|
268
|
+
m(() => {
|
|
269
|
+
R();
|
|
270
|
+
});
|
|
271
|
+
function te() {
|
|
272
|
+
b.value = !1, u("cancel");
|
|
273
|
+
}
|
|
274
|
+
function V() {
|
|
275
|
+
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
276
|
+
for (let n of d.rows) {
|
|
277
|
+
let r = (n.prop ?? "").trim(), i = (n.label ?? "").trim();
|
|
278
|
+
if (!r) return "请填写 field";
|
|
279
|
+
if (!i) return "请填写标题";
|
|
280
|
+
if (e.has(r)) return `field「${r}」重复,请修改`;
|
|
281
|
+
if (t.has(i)) return `标题「${i}」重复,请修改`;
|
|
282
|
+
e.add(r), t.add(i);
|
|
283
|
+
}
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
function H() {
|
|
287
|
+
let e = V();
|
|
288
|
+
if (e) {
|
|
289
|
+
j.warning(e);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
u("save", U(d.rows)), b.value = !1;
|
|
293
|
+
}
|
|
294
|
+
function W(e) {
|
|
295
|
+
return e.deletable !== !1;
|
|
296
|
+
}
|
|
297
|
+
function K(e) {
|
|
298
|
+
return e.visible !== !1;
|
|
299
|
+
}
|
|
300
|
+
return (t, r) => {
|
|
301
|
+
let o = x("el-checkbox"), l = x("el-icon"), u = x("el-tag"), m = x("el-input"), _ = x("el-input-number"), v = x("el-switch"), D = x("el-option"), j = x("el-select"), M = x("el-button"), N = x("el-button-group"), F = x("el-drawer");
|
|
302
|
+
return g(), n(F, {
|
|
303
|
+
modelValue: b.value,
|
|
304
|
+
"onUpdate:modelValue": r[1] ||= (e) => b.value = e,
|
|
305
|
+
title: "列管理",
|
|
306
|
+
size: "980px",
|
|
307
|
+
"destroy-on-close": "",
|
|
308
|
+
class: "pro-column-editor"
|
|
309
|
+
}, {
|
|
310
|
+
footer: O(() => [a("div", _e, [a("div", ve, [c(M, {
|
|
311
|
+
type: "primary",
|
|
312
|
+
onClick: T
|
|
313
|
+
}, {
|
|
314
|
+
default: O(() => [...r[16] ||= [s("新增列", -1)]]),
|
|
315
|
+
_: 1
|
|
316
|
+
}), c(M, { onClick: E }, {
|
|
317
|
+
default: O(() => [...r[17] ||= [s("恢复默认", -1)]]),
|
|
318
|
+
_: 1
|
|
319
|
+
})]), a("div", ye, [c(M, { onClick: te }, {
|
|
320
|
+
default: O(() => [...r[18] ||= [s("取消", -1)]]),
|
|
321
|
+
_: 1
|
|
322
|
+
}), c(M, {
|
|
323
|
+
type: "primary",
|
|
324
|
+
onClick: H
|
|
325
|
+
}, {
|
|
326
|
+
default: O(() => [...r[19] ||= [s("保存", -1)]]),
|
|
327
|
+
_: 1
|
|
328
|
+
})])])]),
|
|
329
|
+
default: O(() => [a("div", q, [a("div", {
|
|
330
|
+
ref_key: "listRef",
|
|
331
|
+
ref: p,
|
|
332
|
+
class: "pro-column-editor__table",
|
|
333
|
+
role: "table"
|
|
334
|
+
}, [a("div", J, [
|
|
335
|
+
a("div", ne, [c(o, {
|
|
336
|
+
modelValue: S.value,
|
|
337
|
+
"onUpdate:modelValue": r[0] ||= (e) => S.value = e,
|
|
338
|
+
title: "全部显示"
|
|
339
|
+
}, null, 8, ["modelValue"])]),
|
|
340
|
+
r[2] ||= a("div", {
|
|
341
|
+
class: "is-drag",
|
|
342
|
+
role: "columnheader"
|
|
343
|
+
}, null, -1),
|
|
344
|
+
r[3] ||= a("div", { role: "columnheader" }, "类型", -1),
|
|
345
|
+
r[4] ||= a("div", { role: "columnheader" }, "field", -1),
|
|
346
|
+
r[5] ||= a("div", { role: "columnheader" }, "标题", -1),
|
|
347
|
+
r[6] ||= a("div", { role: "columnheader" }, "最小宽", -1),
|
|
348
|
+
r[7] ||= a("div", { role: "columnheader" }, "排序", -1),
|
|
349
|
+
r[8] ||= a("div", { role: "columnheader" }, "查询", -1),
|
|
350
|
+
r[9] ||= a("div", { role: "columnheader" }, "表单", -1),
|
|
351
|
+
r[10] ||= a("div", { role: "columnheader" }, "必填", -1),
|
|
352
|
+
r[11] ||= a("div", { role: "columnheader" }, "表单类型", -1),
|
|
353
|
+
r[12] ||= a("div", { role: "columnheader" }, "固定", -1),
|
|
354
|
+
r[13] ||= a("div", {
|
|
355
|
+
class: "is-action",
|
|
356
|
+
role: "columnheader"
|
|
357
|
+
}, null, -1)
|
|
358
|
+
]), (g(!0), i(e, null, y(d.rows, (t, d) => (g(), i("div", {
|
|
359
|
+
key: t.id,
|
|
360
|
+
class: f(["pro-column-editor__row", {
|
|
361
|
+
"is-dragging": h.value === d,
|
|
362
|
+
"is-inactive": !K(t)
|
|
363
|
+
}]),
|
|
364
|
+
"data-row-index": d,
|
|
365
|
+
role: "row"
|
|
366
|
+
}, [
|
|
367
|
+
a("div", ie, [c(o, {
|
|
368
|
+
"model-value": t.visible !== !1,
|
|
369
|
+
"onUpdate:modelValue": (e) => t.visible = e
|
|
370
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])]),
|
|
371
|
+
a("div", ae, [a("span", {
|
|
372
|
+
class: f(["pro-column-editor__rank", { "is-disabled": !K(t) }]),
|
|
373
|
+
title: "按住拖动排序",
|
|
374
|
+
onPointerdown: (e) => z(e, d)
|
|
375
|
+
}, [c(l, { size: 16 }, {
|
|
376
|
+
default: O(() => [c(w(I))]),
|
|
377
|
+
_: 1
|
|
378
|
+
})], 42, oe)]),
|
|
379
|
+
a("div", se, [c(u, {
|
|
380
|
+
size: "small",
|
|
381
|
+
type: t.source === "custom" ? "success" : "info"
|
|
382
|
+
}, {
|
|
383
|
+
default: O(() => [s(C(t.source === "custom" ? "自定义" : "固定"), 1)]),
|
|
384
|
+
_: 2
|
|
385
|
+
}, 1032, ["type"])]),
|
|
386
|
+
a("div", ce, [c(m, {
|
|
387
|
+
modelValue: t.prop,
|
|
388
|
+
"onUpdate:modelValue": (e) => t.prop = e,
|
|
389
|
+
size: "small",
|
|
390
|
+
placeholder: "field",
|
|
391
|
+
disabled: !K(t)
|
|
392
|
+
}, null, 8, [
|
|
393
|
+
"modelValue",
|
|
394
|
+
"onUpdate:modelValue",
|
|
395
|
+
"disabled"
|
|
396
|
+
])]),
|
|
397
|
+
a("div", le, [c(m, {
|
|
398
|
+
modelValue: t.label,
|
|
399
|
+
"onUpdate:modelValue": (e) => t.label = e,
|
|
400
|
+
size: "small",
|
|
401
|
+
placeholder: "标题",
|
|
402
|
+
disabled: !K(t)
|
|
403
|
+
}, null, 8, [
|
|
404
|
+
"modelValue",
|
|
405
|
+
"onUpdate:modelValue",
|
|
406
|
+
"disabled"
|
|
407
|
+
])]),
|
|
408
|
+
a("div", ue, [c(_, {
|
|
409
|
+
modelValue: t.minWidth,
|
|
410
|
+
"onUpdate:modelValue": (e) => t.minWidth = e,
|
|
411
|
+
size: "small",
|
|
412
|
+
min: 40,
|
|
413
|
+
controls: !1,
|
|
414
|
+
class: "pro-column-editor__num",
|
|
415
|
+
disabled: !K(t)
|
|
416
|
+
}, null, 8, [
|
|
417
|
+
"modelValue",
|
|
418
|
+
"onUpdate:modelValue",
|
|
419
|
+
"disabled"
|
|
420
|
+
])]),
|
|
421
|
+
a("div", de, [c(v, {
|
|
422
|
+
size: "small",
|
|
423
|
+
"model-value": !!t.sortable,
|
|
424
|
+
disabled: !K(t),
|
|
425
|
+
"onUpdate:modelValue": (e) => t.sortable = e
|
|
426
|
+
}, null, 8, [
|
|
427
|
+
"model-value",
|
|
428
|
+
"disabled",
|
|
429
|
+
"onUpdate:modelValue"
|
|
430
|
+
])]),
|
|
431
|
+
a("div", fe, [c(v, {
|
|
432
|
+
modelValue: t.searchable,
|
|
433
|
+
"onUpdate:modelValue": (e) => t.searchable = e,
|
|
434
|
+
size: "small",
|
|
435
|
+
disabled: !K(t)
|
|
436
|
+
}, null, 8, [
|
|
437
|
+
"modelValue",
|
|
438
|
+
"onUpdate:modelValue",
|
|
439
|
+
"disabled"
|
|
440
|
+
])]),
|
|
441
|
+
a("div", pe, [c(v, {
|
|
442
|
+
size: "small",
|
|
443
|
+
"model-value": !!t.formable,
|
|
444
|
+
disabled: !K(t),
|
|
445
|
+
"onUpdate:modelValue": (e) => ee(t, e)
|
|
446
|
+
}, null, 8, [
|
|
447
|
+
"model-value",
|
|
448
|
+
"disabled",
|
|
449
|
+
"onUpdate:modelValue"
|
|
450
|
+
])]),
|
|
451
|
+
a("div", me, [c(v, {
|
|
452
|
+
modelValue: t.required,
|
|
453
|
+
"onUpdate:modelValue": (e) => t.required = e,
|
|
454
|
+
size: "small",
|
|
455
|
+
disabled: !K(t) || !t.formable
|
|
456
|
+
}, null, 8, [
|
|
457
|
+
"modelValue",
|
|
458
|
+
"onUpdate:modelValue",
|
|
459
|
+
"disabled"
|
|
460
|
+
])]),
|
|
461
|
+
a("div", Y, [c(j, {
|
|
462
|
+
modelValue: t.formType,
|
|
463
|
+
"onUpdate:modelValue": (e) => t.formType = e,
|
|
464
|
+
size: "small",
|
|
465
|
+
filterable: "",
|
|
466
|
+
disabled: !K(t) || !t.formable && !t.searchable,
|
|
467
|
+
style: { width: "100%" }
|
|
468
|
+
}, {
|
|
469
|
+
default: O(() => [(g(!0), i(e, null, y(w(B), (e) => (g(), n(D, {
|
|
470
|
+
key: e.value,
|
|
471
|
+
label: e.label,
|
|
472
|
+
value: e.value
|
|
473
|
+
}, null, 8, ["label", "value"]))), 128))]),
|
|
474
|
+
_: 1
|
|
475
|
+
}, 8, [
|
|
476
|
+
"modelValue",
|
|
477
|
+
"onUpdate:modelValue",
|
|
478
|
+
"disabled"
|
|
479
|
+
])]),
|
|
480
|
+
a("div", he, [c(N, null, {
|
|
481
|
+
default: O(() => [c(M, {
|
|
482
|
+
size: "small",
|
|
483
|
+
type: t.fixed === "left" ? "primary" : "default",
|
|
484
|
+
disabled: !K(t),
|
|
485
|
+
onClick: (e) => A(t, "left")
|
|
486
|
+
}, {
|
|
487
|
+
default: O(() => [...r[14] ||= [s(" 左 ", -1)]]),
|
|
488
|
+
_: 1
|
|
489
|
+
}, 8, [
|
|
490
|
+
"type",
|
|
491
|
+
"disabled",
|
|
492
|
+
"onClick"
|
|
493
|
+
]), c(M, {
|
|
494
|
+
size: "small",
|
|
495
|
+
type: t.fixed === "right" ? "primary" : "default",
|
|
496
|
+
disabled: !K(t),
|
|
497
|
+
onClick: (e) => A(t, "right")
|
|
498
|
+
}, {
|
|
499
|
+
default: O(() => [...r[15] ||= [s(" 右 ", -1)]]),
|
|
500
|
+
_: 1
|
|
501
|
+
}, 8, [
|
|
502
|
+
"type",
|
|
503
|
+
"disabled",
|
|
504
|
+
"onClick"
|
|
505
|
+
])]),
|
|
506
|
+
_: 2
|
|
507
|
+
}, 1024)]),
|
|
508
|
+
a("div", ge, [c(M, {
|
|
509
|
+
text: "",
|
|
510
|
+
type: "danger",
|
|
511
|
+
disabled: !K(t) || !W(t),
|
|
512
|
+
icon: w(P),
|
|
513
|
+
onClick: (e) => k(d)
|
|
514
|
+
}, null, 8, [
|
|
515
|
+
"disabled",
|
|
516
|
+
"icon",
|
|
517
|
+
"onClick"
|
|
518
|
+
])])
|
|
519
|
+
], 10, re))), 128))], 512)])]),
|
|
520
|
+
_: 1
|
|
521
|
+
}, 8, ["modelValue"]);
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
}), xe = /* @__PURE__ */ l({
|
|
525
|
+
name: "SmartFieldControl",
|
|
526
|
+
__name: "SmartFieldControl",
|
|
527
|
+
props: {
|
|
528
|
+
modelValue: {},
|
|
529
|
+
column: {},
|
|
530
|
+
mode: {}
|
|
531
|
+
},
|
|
532
|
+
emits: ["update:modelValue"],
|
|
533
|
+
setup(r, { emit: a }) {
|
|
534
|
+
let o = r, c = a, l = t(() => {
|
|
535
|
+
let e = K(o.column.formType);
|
|
536
|
+
if (o.mode === "search") {
|
|
537
|
+
if (e === "datetime") return "datetimerange";
|
|
538
|
+
if (e === "date") return "daterange";
|
|
539
|
+
if (e === "time") return "timerange";
|
|
540
|
+
if (e === "textarea" || e === "password") return "input";
|
|
541
|
+
}
|
|
542
|
+
return e;
|
|
543
|
+
}), d = t(() => o.column.searchPlaceholder || `请输入${o.column.label}`), f = t(() => o.column.searchPlaceholder || `请选择${o.column.label}`), p = t(() => h(o.column.formOptions || []));
|
|
544
|
+
function m(e) {
|
|
545
|
+
c("update:modelValue", e);
|
|
546
|
+
}
|
|
547
|
+
function h(e) {
|
|
548
|
+
return e.map((e) => ({
|
|
549
|
+
label: e.label,
|
|
550
|
+
value: e.value,
|
|
551
|
+
disabled: e.disabled,
|
|
552
|
+
children: e.children?.length ? h(e.children) : void 0
|
|
553
|
+
}));
|
|
554
|
+
}
|
|
555
|
+
function _(e, t) {
|
|
556
|
+
t((o.column.formOptions || []).map((e) => ({ value: String(e.label ?? e.value) })).filter((t) => !e || t.value.toLowerCase().includes(e.toLowerCase())));
|
|
557
|
+
}
|
|
558
|
+
return (t, a) => {
|
|
559
|
+
let o = x("el-input"), c = x("el-input-number"), h = x("el-option"), v = x("el-select"), b = x("el-radio"), S = x("el-radio-group"), w = x("el-checkbox"), T = x("el-checkbox-group"), E = x("el-switch"), D = x("el-date-picker"), k = x("el-time-picker"), A = x("el-cascader"), j = x("el-tree-select"), M = x("el-autocomplete"), ee = x("el-rate"), N = x("el-slider"), P = x("el-color-picker");
|
|
560
|
+
return l.value === "input" ? (g(), n(o, u({
|
|
561
|
+
key: 0,
|
|
562
|
+
"model-value": r.modelValue ?? "",
|
|
563
|
+
clearable: "",
|
|
564
|
+
placeholder: d.value
|
|
565
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "password" ? (g(), n(o, u({
|
|
566
|
+
key: 1,
|
|
567
|
+
"model-value": r.modelValue ?? "",
|
|
568
|
+
type: "password",
|
|
569
|
+
"show-password": "",
|
|
570
|
+
clearable: "",
|
|
571
|
+
placeholder: d.value
|
|
572
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "textarea" ? (g(), n(o, u({
|
|
573
|
+
key: 2,
|
|
574
|
+
"model-value": r.modelValue ?? "",
|
|
575
|
+
type: "textarea",
|
|
576
|
+
rows: 3,
|
|
577
|
+
placeholder: d.value
|
|
578
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "number" ? (g(), n(c, u({
|
|
579
|
+
key: 3,
|
|
580
|
+
"model-value": r.modelValue ?? void 0,
|
|
581
|
+
"controls-position": "right",
|
|
582
|
+
style: { width: "100%" }
|
|
583
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "select" ? (g(), n(v, u({
|
|
584
|
+
key: 4,
|
|
585
|
+
"model-value": r.modelValue,
|
|
586
|
+
clearable: "",
|
|
587
|
+
filterable: "",
|
|
588
|
+
style: { width: "100%" },
|
|
589
|
+
placeholder: f.value
|
|
590
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), {
|
|
591
|
+
default: O(() => [(g(!0), i(e, null, y(r.column.formOptions || [], (e) => (g(), n(h, {
|
|
592
|
+
key: String(e.value),
|
|
593
|
+
label: e.label,
|
|
594
|
+
value: e.value,
|
|
595
|
+
disabled: e.disabled
|
|
596
|
+
}, null, 8, [
|
|
597
|
+
"label",
|
|
598
|
+
"value",
|
|
599
|
+
"disabled"
|
|
600
|
+
]))), 128))]),
|
|
601
|
+
_: 1
|
|
602
|
+
}, 16, ["model-value", "placeholder"])) : l.value === "select-multiple" ? (g(), n(v, u({
|
|
603
|
+
key: 5,
|
|
604
|
+
"model-value": r.modelValue ?? [],
|
|
605
|
+
multiple: "",
|
|
606
|
+
clearable: "",
|
|
607
|
+
filterable: "",
|
|
608
|
+
"collapse-tags": "",
|
|
609
|
+
"collapse-tags-tooltip": "",
|
|
610
|
+
style: { width: "100%" },
|
|
611
|
+
placeholder: f.value
|
|
612
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), {
|
|
613
|
+
default: O(() => [(g(!0), i(e, null, y(r.column.formOptions || [], (e) => (g(), n(h, {
|
|
614
|
+
key: String(e.value),
|
|
615
|
+
label: e.label,
|
|
616
|
+
value: e.value,
|
|
617
|
+
disabled: e.disabled
|
|
618
|
+
}, null, 8, [
|
|
619
|
+
"label",
|
|
620
|
+
"value",
|
|
621
|
+
"disabled"
|
|
622
|
+
]))), 128))]),
|
|
623
|
+
_: 1
|
|
624
|
+
}, 16, ["model-value", "placeholder"])) : l.value === "radio" ? (g(), n(S, u({
|
|
625
|
+
key: 6,
|
|
626
|
+
"model-value": r.modelValue
|
|
627
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), {
|
|
628
|
+
default: O(() => [(g(!0), i(e, null, y(r.column.formOptions || [], (e) => (g(), n(b, {
|
|
629
|
+
key: String(e.value),
|
|
630
|
+
value: e.value,
|
|
631
|
+
disabled: e.disabled
|
|
632
|
+
}, {
|
|
633
|
+
default: O(() => [s(C(e.label), 1)]),
|
|
634
|
+
_: 2
|
|
635
|
+
}, 1032, ["value", "disabled"]))), 128))]),
|
|
636
|
+
_: 1
|
|
637
|
+
}, 16, ["model-value"])) : l.value === "checkbox" ? (g(), n(w, u({
|
|
638
|
+
key: 7,
|
|
639
|
+
"model-value": !!r.modelValue
|
|
640
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), {
|
|
641
|
+
default: O(() => [s(C(r.column.label), 1)]),
|
|
642
|
+
_: 1
|
|
643
|
+
}, 16, ["model-value"])) : l.value === "checkbox-group" ? (g(), n(T, u({
|
|
644
|
+
key: 8,
|
|
645
|
+
"model-value": r.modelValue ?? []
|
|
646
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), {
|
|
647
|
+
default: O(() => [(g(!0), i(e, null, y(r.column.formOptions || [], (e) => (g(), n(w, {
|
|
648
|
+
key: String(e.value),
|
|
649
|
+
value: e.value,
|
|
650
|
+
disabled: e.disabled
|
|
651
|
+
}, {
|
|
652
|
+
default: O(() => [s(C(e.label), 1)]),
|
|
653
|
+
_: 2
|
|
654
|
+
}, 1032, ["value", "disabled"]))), 128))]),
|
|
655
|
+
_: 1
|
|
656
|
+
}, 16, ["model-value"])) : l.value === "switch" ? (g(), n(E, u({
|
|
657
|
+
key: 9,
|
|
658
|
+
"model-value": !!r.modelValue
|
|
659
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "date" ? (g(), n(D, u({
|
|
660
|
+
key: 10,
|
|
661
|
+
"model-value": r.modelValue,
|
|
662
|
+
type: "date",
|
|
663
|
+
"value-format": "YYYY-MM-DD",
|
|
664
|
+
style: { width: "100%" },
|
|
665
|
+
placeholder: f.value
|
|
666
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "datetime" ? (g(), n(D, u({
|
|
667
|
+
key: 11,
|
|
668
|
+
"model-value": r.modelValue,
|
|
669
|
+
type: "datetime",
|
|
670
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
671
|
+
style: { width: "100%" },
|
|
672
|
+
placeholder: f.value
|
|
673
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "daterange" ? (g(), n(D, u({
|
|
674
|
+
key: 12,
|
|
675
|
+
"model-value": r.modelValue,
|
|
676
|
+
type: "daterange",
|
|
677
|
+
"value-format": "YYYY-MM-DD",
|
|
678
|
+
style: { width: "100%" },
|
|
679
|
+
"start-placeholder": "开始日期",
|
|
680
|
+
"end-placeholder": "结束日期"
|
|
681
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "datetimerange" ? (g(), n(D, u({
|
|
682
|
+
key: 13,
|
|
683
|
+
"model-value": r.modelValue,
|
|
684
|
+
type: "datetimerange",
|
|
685
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
686
|
+
style: { width: "100%" },
|
|
687
|
+
"start-placeholder": "开始时间",
|
|
688
|
+
"end-placeholder": "结束时间"
|
|
689
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "time" ? (g(), n(k, u({
|
|
690
|
+
key: 14,
|
|
691
|
+
"model-value": r.modelValue,
|
|
692
|
+
"value-format": "HH:mm:ss",
|
|
693
|
+
style: { width: "100%" },
|
|
694
|
+
placeholder: f.value
|
|
695
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "timerange" ? (g(), n(k, u({
|
|
696
|
+
key: 15,
|
|
697
|
+
"model-value": r.modelValue,
|
|
698
|
+
"is-range": "",
|
|
699
|
+
"value-format": "HH:mm:ss",
|
|
700
|
+
style: { width: "100%" },
|
|
701
|
+
"start-placeholder": "开始时间",
|
|
702
|
+
"end-placeholder": "结束时间"
|
|
703
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "month" ? (g(), n(D, u({
|
|
704
|
+
key: 16,
|
|
705
|
+
"model-value": r.modelValue,
|
|
706
|
+
type: "month",
|
|
707
|
+
"value-format": "YYYY-MM",
|
|
708
|
+
style: { width: "100%" },
|
|
709
|
+
placeholder: f.value
|
|
710
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "year" ? (g(), n(D, u({
|
|
711
|
+
key: 17,
|
|
712
|
+
"model-value": r.modelValue,
|
|
713
|
+
type: "year",
|
|
714
|
+
"value-format": "YYYY",
|
|
715
|
+
style: { width: "100%" },
|
|
716
|
+
placeholder: f.value
|
|
717
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "week" ? (g(), n(D, u({
|
|
718
|
+
key: 18,
|
|
719
|
+
"model-value": r.modelValue,
|
|
720
|
+
type: "week",
|
|
721
|
+
format: "YYYY 第 ww 周",
|
|
722
|
+
"value-format": "YYYY-MM-DD",
|
|
723
|
+
style: { width: "100%" },
|
|
724
|
+
placeholder: f.value
|
|
725
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "cascader" ? (g(), n(A, u({
|
|
726
|
+
key: 19,
|
|
727
|
+
"model-value": r.modelValue,
|
|
728
|
+
options: r.column.formOptions || [],
|
|
729
|
+
clearable: "",
|
|
730
|
+
filterable: "",
|
|
731
|
+
style: { width: "100%" },
|
|
732
|
+
placeholder: f.value
|
|
733
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, [
|
|
734
|
+
"model-value",
|
|
735
|
+
"options",
|
|
736
|
+
"placeholder"
|
|
737
|
+
])) : l.value === "tree-select" ? (g(), n(j, u({
|
|
738
|
+
key: 20,
|
|
739
|
+
"model-value": r.modelValue,
|
|
740
|
+
data: p.value,
|
|
741
|
+
"check-strictly": "",
|
|
742
|
+
clearable: "",
|
|
743
|
+
filterable: "",
|
|
744
|
+
style: { width: "100%" },
|
|
745
|
+
placeholder: f.value
|
|
746
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, [
|
|
747
|
+
"model-value",
|
|
748
|
+
"data",
|
|
749
|
+
"placeholder"
|
|
750
|
+
])) : l.value === "autocomplete" ? (g(), n(M, u({
|
|
751
|
+
key: 21,
|
|
752
|
+
"model-value": r.modelValue ?? "",
|
|
753
|
+
"fetch-suggestions": _,
|
|
754
|
+
clearable: "",
|
|
755
|
+
style: { width: "100%" },
|
|
756
|
+
placeholder: d.value
|
|
757
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value", "placeholder"])) : l.value === "rate" ? (g(), n(ee, u({
|
|
758
|
+
key: 22,
|
|
759
|
+
"model-value": Number(r.modelValue) || 0
|
|
760
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "slider" ? (g(), n(N, u({
|
|
761
|
+
key: 23,
|
|
762
|
+
"model-value": Number(r.modelValue) || 0,
|
|
763
|
+
style: {
|
|
764
|
+
width: "100%",
|
|
765
|
+
padding: "0 8px"
|
|
766
|
+
}
|
|
767
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : l.value === "color" ? (g(), n(P, u({
|
|
768
|
+
key: 24,
|
|
769
|
+
"model-value": r.modelValue || void 0
|
|
770
|
+
}, r.column.formProps, { "onUpdate:modelValue": m }), null, 16, ["model-value"])) : (g(), n(o, {
|
|
771
|
+
key: 25,
|
|
772
|
+
"model-value": r.modelValue ?? "",
|
|
773
|
+
clearable: "",
|
|
774
|
+
placeholder: d.value,
|
|
775
|
+
"onUpdate:modelValue": m
|
|
776
|
+
}, null, 8, ["model-value", "placeholder"]));
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
}), Se = { class: "pro-smart-search" }, X = { class: "pro-smart-search__actions" }, Ce = /* @__PURE__ */ l({
|
|
780
|
+
name: "SmartSearchForm",
|
|
781
|
+
__name: "SmartSearchForm",
|
|
782
|
+
props: {
|
|
783
|
+
columns: {},
|
|
784
|
+
modelValue: {},
|
|
785
|
+
collapsible: {
|
|
786
|
+
type: Boolean,
|
|
787
|
+
default: !0
|
|
788
|
+
},
|
|
789
|
+
collapseVisibleCount: { default: 3 },
|
|
790
|
+
defaultExpanded: {
|
|
791
|
+
type: Boolean,
|
|
792
|
+
default: !1
|
|
793
|
+
},
|
|
794
|
+
searchText: { default: "查询" },
|
|
795
|
+
resetText: { default: "重置" },
|
|
796
|
+
expandText: { default: "展开" },
|
|
797
|
+
collapseText: { default: "收起" },
|
|
798
|
+
persistKey: {}
|
|
799
|
+
},
|
|
800
|
+
emits: [
|
|
801
|
+
"update:modelValue",
|
|
802
|
+
"search",
|
|
803
|
+
"reset"
|
|
804
|
+
],
|
|
805
|
+
setup(o, { emit: l }) {
|
|
806
|
+
let u = o, f = l, p = v(), _ = v(R()), b = v(!0), S = v(!1), T = null, j = !1, M = -1, P = t(() => Math.max(1, u.collapseVisibleCount)), F = t(() => u.collapsible && !b.value && u.columns.length > P.value);
|
|
807
|
+
function I() {
|
|
808
|
+
return u.persistKey ? `${u.persistKey}__searchExpanded` : null;
|
|
809
|
+
}
|
|
810
|
+
function R() {
|
|
811
|
+
let e = I();
|
|
812
|
+
if (e) try {
|
|
813
|
+
let t = localStorage.getItem(e);
|
|
814
|
+
if (t === "1") return !0;
|
|
815
|
+
if (t === "0") return !1;
|
|
816
|
+
} catch {}
|
|
817
|
+
return u.defaultExpanded;
|
|
818
|
+
}
|
|
819
|
+
function te(e) {
|
|
820
|
+
let t = I();
|
|
821
|
+
if (t) try {
|
|
822
|
+
localStorage.setItem(t, e ? "1" : "0");
|
|
823
|
+
} catch {}
|
|
824
|
+
}
|
|
825
|
+
function B(e) {
|
|
826
|
+
return S.value || !F.value ? !0 : _.value || e < P.value;
|
|
827
|
+
}
|
|
828
|
+
function V() {
|
|
829
|
+
let e = p.value;
|
|
830
|
+
if (!e || !u.collapsible) {
|
|
831
|
+
b.value = !0;
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
let t = Array.from(e.children);
|
|
835
|
+
if (t.length <= 1) {
|
|
836
|
+
b.value = !0;
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
let n = t[0].offsetTop;
|
|
840
|
+
b.value = t.every((e) => e.offsetTop === n);
|
|
841
|
+
}
|
|
842
|
+
async function H() {
|
|
843
|
+
if (!u.collapsible) {
|
|
844
|
+
b.value = !0;
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (!j) {
|
|
848
|
+
j = !0, S.value = !0;
|
|
849
|
+
try {
|
|
850
|
+
await d(), V();
|
|
851
|
+
} finally {
|
|
852
|
+
S.value = !1, j = !1;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
function U(e, t) {
|
|
857
|
+
f("update:modelValue", {
|
|
858
|
+
...u.modelValue,
|
|
859
|
+
[e]: t
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
function W() {
|
|
863
|
+
f("search", { ...u.modelValue });
|
|
864
|
+
}
|
|
865
|
+
function G() {
|
|
866
|
+
let e = {};
|
|
867
|
+
u.columns.forEach((t) => {
|
|
868
|
+
e[t.prop] = void 0;
|
|
869
|
+
}), f("update:modelValue", e), f("reset", e);
|
|
870
|
+
}
|
|
871
|
+
function K() {
|
|
872
|
+
_.value = !_.value, te(_.value);
|
|
873
|
+
}
|
|
874
|
+
return D(() => u.defaultExpanded, (e) => {
|
|
875
|
+
_.value = e;
|
|
876
|
+
}), D(() => [
|
|
877
|
+
u.columns.length,
|
|
878
|
+
u.collapsible,
|
|
879
|
+
u.collapseVisibleCount
|
|
880
|
+
], () => {
|
|
881
|
+
H();
|
|
882
|
+
}), h(() => {
|
|
883
|
+
H(), typeof ResizeObserver < "u" && p.value && (T = new ResizeObserver((e) => {
|
|
884
|
+
let t = e[0]?.contentRect.width ?? 0;
|
|
885
|
+
Math.abs(t - M) < 1 || (M = t, H());
|
|
886
|
+
}), T.observe(p.value));
|
|
887
|
+
}), m(() => {
|
|
888
|
+
T?.disconnect(), T = null;
|
|
889
|
+
}), (t, l) => {
|
|
890
|
+
let u = x("el-form-item"), d = x("el-button"), f = x("el-icon"), m = x("el-form");
|
|
891
|
+
return g(), i("section", Se, [c(m, {
|
|
892
|
+
"label-width": "auto",
|
|
893
|
+
inline: "",
|
|
894
|
+
class: "pro-smart-search__form",
|
|
895
|
+
onSubmit: A(W, ["prevent"])
|
|
896
|
+
}, {
|
|
897
|
+
default: O(() => [a("div", {
|
|
898
|
+
ref_key: "fieldsRef",
|
|
899
|
+
ref: p,
|
|
900
|
+
class: "pro-smart-search__fields"
|
|
901
|
+
}, [(g(!0), i(e, null, y(o.columns, (e, t) => k((g(), n(u, {
|
|
902
|
+
key: e.id,
|
|
903
|
+
label: e.label,
|
|
904
|
+
class: "pro-smart-search__item"
|
|
905
|
+
}, {
|
|
906
|
+
default: O(() => [c(xe, {
|
|
907
|
+
"model-value": o.modelValue[e.prop],
|
|
908
|
+
column: e,
|
|
909
|
+
mode: "search",
|
|
910
|
+
"onUpdate:modelValue": (t) => U(e.prop, t)
|
|
911
|
+
}, null, 8, [
|
|
912
|
+
"model-value",
|
|
913
|
+
"column",
|
|
914
|
+
"onUpdate:modelValue"
|
|
915
|
+
])]),
|
|
916
|
+
_: 2
|
|
917
|
+
}, 1032, ["label"])), [[E, B(t)]])), 128)), a("div", X, [
|
|
918
|
+
c(d, {
|
|
919
|
+
type: "primary",
|
|
920
|
+
icon: w(z),
|
|
921
|
+
onClick: W
|
|
922
|
+
}, {
|
|
923
|
+
default: O(() => [s(C(o.searchText), 1)]),
|
|
924
|
+
_: 1
|
|
925
|
+
}, 8, ["icon"]),
|
|
926
|
+
c(d, {
|
|
927
|
+
icon: w(L),
|
|
928
|
+
onClick: G
|
|
929
|
+
}, {
|
|
930
|
+
default: O(() => [s(C(o.resetText), 1)]),
|
|
931
|
+
_: 1
|
|
932
|
+
}, 8, ["icon"]),
|
|
933
|
+
F.value ? (g(), n(d, {
|
|
934
|
+
key: 0,
|
|
935
|
+
link: "",
|
|
936
|
+
type: "primary",
|
|
937
|
+
onClick: K
|
|
938
|
+
}, {
|
|
939
|
+
default: O(() => [s(C(_.value ? o.collapseText : o.expandText) + " ", 1), c(f, { class: "pro-smart-search__toggle-icon" }, {
|
|
940
|
+
default: O(() => [_.value ? (g(), n(w(N), { key: 0 })) : (g(), n(w(ee), { key: 1 }))]),
|
|
941
|
+
_: 1
|
|
942
|
+
})]),
|
|
943
|
+
_: 1
|
|
944
|
+
})) : r("", !0)
|
|
945
|
+
])], 512)]),
|
|
946
|
+
_: 1
|
|
947
|
+
})]);
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
}), we = { class: "pro-smart-table-skeleton" }, Te = { class: "pro-smart-table-skeleton__header" }, Ee = /* @__PURE__ */ l({
|
|
951
|
+
name: "ProSmartTableSkeleton",
|
|
952
|
+
__name: "ProSmartTableSkeleton",
|
|
953
|
+
props: {
|
|
954
|
+
rows: { default: 5 },
|
|
955
|
+
animated: {
|
|
956
|
+
type: Boolean,
|
|
957
|
+
default: !0
|
|
958
|
+
},
|
|
959
|
+
columns: { default: 4 }
|
|
960
|
+
},
|
|
961
|
+
setup(r) {
|
|
962
|
+
let o = r, s = t(() => Math.max(2, Math.min(o.columns, 8))), l = t(() => Math.max(1, o.rows));
|
|
963
|
+
return (t, o) => {
|
|
964
|
+
let u = x("el-skeleton-item"), d = x("el-skeleton");
|
|
965
|
+
return g(), i("div", we, [b(t.$slots, "default", {}, () => [c(d, {
|
|
966
|
+
animated: r.animated,
|
|
967
|
+
rows: 0
|
|
968
|
+
}, {
|
|
969
|
+
template: O(() => [a("div", Te, [(g(!0), i(e, null, y(s.value, (e) => (g(), n(u, {
|
|
970
|
+
key: `h-${e}`,
|
|
971
|
+
variant: "text",
|
|
972
|
+
class: "pro-smart-table-skeleton__cell",
|
|
973
|
+
style: p({ width: `${Math.max(40, 90 / s.value)}%` })
|
|
974
|
+
}, null, 8, ["style"]))), 128))]), (g(!0), i(e, null, y(l.value, (t) => (g(), i("div", {
|
|
975
|
+
key: `r-${t}`,
|
|
976
|
+
class: "pro-smart-table-skeleton__row"
|
|
977
|
+
}, [(g(!0), i(e, null, y(s.value, (e) => (g(), n(u, {
|
|
978
|
+
key: `c-${t}-${e}`,
|
|
979
|
+
variant: "text",
|
|
980
|
+
class: "pro-smart-table-skeleton__cell",
|
|
981
|
+
style: p({ width: `${Math.max(36, 80 / s.value + e % 2 * 6)}%` })
|
|
982
|
+
}, null, 8, ["style"]))), 128))]))), 128))]),
|
|
983
|
+
_: 1
|
|
984
|
+
}, 8, ["animated"])])]);
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
}), De = { class: "pro-smart-table" }, Oe = { class: "pro-smart-table__body" }, ke = {
|
|
988
|
+
key: 0,
|
|
989
|
+
class: "pro-smart-table__toolbar"
|
|
990
|
+
}, Ae = { class: "pro-smart-table__toolbar-left" }, je = { class: "pro-smart-table__toolbar-right" }, Me = {
|
|
991
|
+
key: 1,
|
|
992
|
+
class: "pro-smart-table__skeleton"
|
|
993
|
+
}, Ne = {
|
|
994
|
+
class: "pro-smart-table__table-wrap",
|
|
995
|
+
"element-loading-text": "加载中..."
|
|
996
|
+
}, Pe = {
|
|
997
|
+
key: 2,
|
|
998
|
+
class: "pro-smart-table__pagination"
|
|
999
|
+
}, Fe = "total, sizes, prev, pager, next, jumper", Z = /* @__PURE__ */ l({
|
|
1000
|
+
name: "ProSmartTable",
|
|
1001
|
+
inheritAttrs: !1,
|
|
1002
|
+
__name: "ProSmartTable",
|
|
1003
|
+
props: {
|
|
1004
|
+
data: { default: () => [] },
|
|
1005
|
+
columns: { default: () => [] },
|
|
1006
|
+
showToolbar: {
|
|
1007
|
+
type: Boolean,
|
|
1008
|
+
default: !0
|
|
1009
|
+
},
|
|
1010
|
+
showColumnEditor: {
|
|
1011
|
+
type: Boolean,
|
|
1012
|
+
default: !0
|
|
1013
|
+
},
|
|
1014
|
+
showRefresh: {
|
|
1015
|
+
type: Boolean,
|
|
1016
|
+
default: !0
|
|
1017
|
+
},
|
|
1018
|
+
showCreate: {
|
|
1019
|
+
type: Boolean,
|
|
1020
|
+
default: !0
|
|
1021
|
+
},
|
|
1022
|
+
showSeq: {
|
|
1023
|
+
type: Boolean,
|
|
1024
|
+
default: !0
|
|
1025
|
+
},
|
|
1026
|
+
seqWidth: { default: 60 },
|
|
1027
|
+
showSelection: {
|
|
1028
|
+
type: Boolean,
|
|
1029
|
+
default: !1
|
|
1030
|
+
},
|
|
1031
|
+
showSearch: {
|
|
1032
|
+
type: Boolean,
|
|
1033
|
+
default: !0
|
|
1034
|
+
},
|
|
1035
|
+
searchCollapsible: {
|
|
1036
|
+
type: Boolean,
|
|
1037
|
+
default: !0
|
|
1038
|
+
},
|
|
1039
|
+
searchCollapseVisibleCount: { default: 3 },
|
|
1040
|
+
searchDefaultExpanded: {
|
|
1041
|
+
type: Boolean,
|
|
1042
|
+
default: !1
|
|
1043
|
+
},
|
|
1044
|
+
persistKey: {},
|
|
1045
|
+
formTitle: { default: "" },
|
|
1046
|
+
formWidth: { default: "45%" },
|
|
1047
|
+
loading: {
|
|
1048
|
+
type: Boolean,
|
|
1049
|
+
default: !1
|
|
1050
|
+
},
|
|
1051
|
+
skeleton: {
|
|
1052
|
+
type: [Boolean, Object],
|
|
1053
|
+
default: !0
|
|
1054
|
+
},
|
|
1055
|
+
pagination: {
|
|
1056
|
+
type: [Boolean, Object],
|
|
1057
|
+
default: () => ({})
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
emits: [
|
|
1061
|
+
"update:columns",
|
|
1062
|
+
"search",
|
|
1063
|
+
"reset",
|
|
1064
|
+
"create",
|
|
1065
|
+
"update",
|
|
1066
|
+
"columns-change",
|
|
1067
|
+
"columns-reset",
|
|
1068
|
+
"page-change",
|
|
1069
|
+
"update:pagination",
|
|
1070
|
+
"refresh",
|
|
1071
|
+
"sort-change"
|
|
1072
|
+
],
|
|
1073
|
+
setup(l, { expose: p, emit: m }) {
|
|
1074
|
+
let h = [
|
|
1075
|
+
10,
|
|
1076
|
+
20,
|
|
1077
|
+
50,
|
|
1078
|
+
100
|
|
1079
|
+
], C = l, A = m, M = T(), ee = t(() => {
|
|
1080
|
+
let e = { showOverflowTooltip: !0 };
|
|
1081
|
+
for (let [t, n] of Object.entries(M)) t !== "onSortChange" && (e[t] = n);
|
|
1082
|
+
return e;
|
|
1083
|
+
}), N = v(), P = v(), I = v(!1), L = v(!1), z = v("create"), B = v([]), V = v([]), W = _({}), G = _({}), K = _({
|
|
1084
|
+
currentPage: C.pagination === !1 ? 1 : C.pagination?.currentPage ?? 1,
|
|
1085
|
+
pageSize: C.pagination === !1 ? 10 : C.pagination?.pageSize ?? 10
|
|
1086
|
+
}), q = t(() => C.pagination !== !1), J = t(() => C.pagination === !1 ? {} : C.pagination ?? {}), ne = t(() => J.value.mode ? J.value.mode : typeof J.value.total == "number" ? "remote" : "local"), re = t(() => J.value.pageSizes ?? h), ie = t(() => J.value.layout ?? Fe), ae = t(() => J.value.size ? J.value.size : J.value.small === !1 ? "default" : "small"), oe = t(() => typeof J.value.total == "number" ? J.value.total : C.data.length);
|
|
1087
|
+
function se(e) {
|
|
1088
|
+
return e.sortable ? e.sortable === "custom" || ne.value === "remote" ? "custom" : e.sortable : !1;
|
|
1089
|
+
}
|
|
1090
|
+
let ce = t(() => {
|
|
1091
|
+
if (!q.value || ne.value !== "local") return C.data;
|
|
1092
|
+
let e = (K.currentPage - 1) * K.pageSize;
|
|
1093
|
+
return C.data.slice(e, e + K.pageSize);
|
|
1094
|
+
});
|
|
1095
|
+
function le(e, t) {
|
|
1096
|
+
if (C.pagination === !1) return;
|
|
1097
|
+
e.pageSize == null ? e.currentPage != null && (K.currentPage = e.currentPage) : (K.pageSize = e.pageSize, K.currentPage = e.currentPage ?? 1);
|
|
1098
|
+
let n = {
|
|
1099
|
+
...J.value,
|
|
1100
|
+
currentPage: K.currentPage,
|
|
1101
|
+
pageSize: K.pageSize
|
|
1102
|
+
};
|
|
1103
|
+
A("update:pagination", n), t?.silent || A("page-change", {
|
|
1104
|
+
currentPage: n.currentPage ?? 1,
|
|
1105
|
+
pageSize: n.pageSize ?? 10
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
function ue(e) {
|
|
1109
|
+
e !== K.currentPage && le({ currentPage: e });
|
|
1110
|
+
}
|
|
1111
|
+
function de(e) {
|
|
1112
|
+
le({
|
|
1113
|
+
pageSize: e,
|
|
1114
|
+
currentPage: 1
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
function fe(e) {
|
|
1118
|
+
return q.value ? (K.currentPage - 1) * K.pageSize + e + 1 : e + 1;
|
|
1119
|
+
}
|
|
1120
|
+
function pe(e) {
|
|
1121
|
+
try {
|
|
1122
|
+
let t = localStorage.getItem(e);
|
|
1123
|
+
if (!t) return null;
|
|
1124
|
+
let n = JSON.parse(t);
|
|
1125
|
+
return Array.isArray(n) ? n.map(H) : null;
|
|
1126
|
+
} catch {
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function me(e, t) {
|
|
1131
|
+
try {
|
|
1132
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
1133
|
+
} catch {}
|
|
1134
|
+
}
|
|
1135
|
+
function Y(e, t = !1) {
|
|
1136
|
+
let n = U(e);
|
|
1137
|
+
B.value = n, (t || V.value.length === 0) && (V.value = U(n)), he();
|
|
1138
|
+
}
|
|
1139
|
+
function he() {
|
|
1140
|
+
let e = new Set(B.value.filter((e) => e.searchable && e.prop).map((e) => e.prop));
|
|
1141
|
+
Object.keys(W).forEach((t) => {
|
|
1142
|
+
e.has(t) || delete W[t];
|
|
1143
|
+
}), e.forEach((e) => {
|
|
1144
|
+
e in W || (W[e] = void 0);
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
D(() => C.columns, (e) => {
|
|
1148
|
+
if (e) {
|
|
1149
|
+
if (C.persistKey) {
|
|
1150
|
+
let t = pe(C.persistKey);
|
|
1151
|
+
if (t?.length) {
|
|
1152
|
+
Y(t, V.value.length === 0), V.value = U(e);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
Y(e, V.value.length === 0);
|
|
1157
|
+
}
|
|
1158
|
+
}, {
|
|
1159
|
+
immediate: !0,
|
|
1160
|
+
deep: !0
|
|
1161
|
+
}), D(() => J.value.currentPage, (e) => {
|
|
1162
|
+
typeof e == "number" && (K.currentPage = e);
|
|
1163
|
+
}), D(() => J.value.pageSize, (e) => {
|
|
1164
|
+
typeof e == "number" && (K.pageSize = e);
|
|
1165
|
+
});
|
|
1166
|
+
let ge = t(() => B.value.filter((e) => e.visible !== !1 && e.prop)), _e = t(() => B.value.filter((e) => e.searchable && e.prop)), ve = t(() => B.value.filter((e) => e.formable && e.prop)), ye = t(() => {
|
|
1167
|
+
let e = {};
|
|
1168
|
+
for (let t of ve.value) {
|
|
1169
|
+
if (!t.required || !t.prop) continue;
|
|
1170
|
+
let n = `请填写${t.label || t.prop}`;
|
|
1171
|
+
e[t.prop] = [{
|
|
1172
|
+
required: !0,
|
|
1173
|
+
whitespace: !0,
|
|
1174
|
+
message: n,
|
|
1175
|
+
trigger: ["blur", "change"]
|
|
1176
|
+
}, {
|
|
1177
|
+
validator: (e, t, r) => {
|
|
1178
|
+
if (Se(t)) {
|
|
1179
|
+
r(Error(n));
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
r();
|
|
1183
|
+
},
|
|
1184
|
+
trigger: ["blur", "change"]
|
|
1185
|
+
}];
|
|
1186
|
+
}
|
|
1187
|
+
return e;
|
|
1188
|
+
});
|
|
1189
|
+
function Se(e) {
|
|
1190
|
+
return !!(e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0);
|
|
1191
|
+
}
|
|
1192
|
+
let X = t(() => C.skeleton === !1 ? !1 : C.skeleton === !0 || C.skeleton === void 0 ? {
|
|
1193
|
+
animated: !0,
|
|
1194
|
+
onlyEmpty: !0
|
|
1195
|
+
} : {
|
|
1196
|
+
animated: C.skeleton.animated !== !1,
|
|
1197
|
+
onlyEmpty: C.skeleton.onlyEmpty !== !1,
|
|
1198
|
+
rows: C.skeleton.rows
|
|
1199
|
+
}), we = t(() => X.value && X.value.rows ? X.value.rows : C.pagination !== !1 && J.value.pageSize ? Math.min(J.value.pageSize, 10) : Math.min(K.pageSize || 5, 10)), Te = t(() => {
|
|
1200
|
+
let e = ge.value.length + +!!C.showSeq;
|
|
1201
|
+
return Math.max(2, Math.min(e || 4, 8));
|
|
1202
|
+
}), Z = v(!1), Q = t(() => C.loading || Z.value), $ = t(() => !X.value || !Q.value ? !1 : X.value.onlyEmpty === !1 || !(C.data && C.data.length)), Ie = t(() => Q.value && !$.value);
|
|
1203
|
+
function Le() {
|
|
1204
|
+
return new Promise((e) => {
|
|
1205
|
+
let t = () => {
|
|
1206
|
+
let t = D(() => C.loading, (n) => {
|
|
1207
|
+
n || (t(), e());
|
|
1208
|
+
});
|
|
1209
|
+
};
|
|
1210
|
+
d(() => {
|
|
1211
|
+
if (C.loading) {
|
|
1212
|
+
t();
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
d(() => {
|
|
1216
|
+
C.loading ? t() : e();
|
|
1217
|
+
});
|
|
1218
|
+
});
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
let Re = t(() => {
|
|
1222
|
+
let e = C.formTitle || "记录";
|
|
1223
|
+
return z.value === "create" ? `新增${e}` : `编辑${e}`;
|
|
1224
|
+
});
|
|
1225
|
+
function ze() {
|
|
1226
|
+
I.value = !0;
|
|
1227
|
+
}
|
|
1228
|
+
async function Be() {
|
|
1229
|
+
if (!Q.value) {
|
|
1230
|
+
Z.value = !0, A("refresh");
|
|
1231
|
+
try {
|
|
1232
|
+
await Le();
|
|
1233
|
+
} finally {
|
|
1234
|
+
Z.value = !1;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function Ve(e) {
|
|
1239
|
+
Y(e, !1), A("update:columns", U(e)), A("columns-change", U(e)), C.persistKey && me(C.persistKey, e);
|
|
1240
|
+
}
|
|
1241
|
+
function He() {
|
|
1242
|
+
let e = U(V.value);
|
|
1243
|
+
if (Y(e, !1), A("update:columns", e), A("columns-reset"), I.value = !1, C.persistKey) try {
|
|
1244
|
+
localStorage.removeItem(C.persistKey);
|
|
1245
|
+
} catch {}
|
|
1246
|
+
}
|
|
1247
|
+
function Ue(e) {
|
|
1248
|
+
Object.keys(G).forEach((e) => delete G[e]), ve.value.forEach((t) => {
|
|
1249
|
+
G[t.prop] = e && t.prop in e ? e[t.prop] : t.formType !== "switch" && void 0;
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function We() {
|
|
1253
|
+
z.value = "create", Ue(), L.value = !0;
|
|
1254
|
+
}
|
|
1255
|
+
function Ge(e) {
|
|
1256
|
+
z.value = "edit", Ue(e), L.value = !0;
|
|
1257
|
+
}
|
|
1258
|
+
function Ke() {
|
|
1259
|
+
let e = () => {
|
|
1260
|
+
let e = { ...G };
|
|
1261
|
+
z.value === "create" ? A("create", e) : A("update", e), L.value = !1;
|
|
1262
|
+
};
|
|
1263
|
+
if (!P.value) {
|
|
1264
|
+
e();
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
P.value.validate((t) => {
|
|
1268
|
+
if (!t) {
|
|
1269
|
+
j.warning("请完善必填项");
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
e();
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
function qe(e = !1) {
|
|
1276
|
+
q.value && K.currentPage !== 1 && le({ currentPage: 1 }, { silent: e });
|
|
1277
|
+
}
|
|
1278
|
+
function Je(e) {
|
|
1279
|
+
Object.keys(W).forEach((t) => {
|
|
1280
|
+
t in e || delete W[t];
|
|
1281
|
+
}), Object.assign(W, e);
|
|
1282
|
+
}
|
|
1283
|
+
function Ye(e) {
|
|
1284
|
+
Je(e), qe(!0), A("search", { ...e });
|
|
1285
|
+
}
|
|
1286
|
+
function Xe(e) {
|
|
1287
|
+
Je(e), qe(!0), A("reset"), A("search", { ...e });
|
|
1288
|
+
}
|
|
1289
|
+
function Ze(e) {
|
|
1290
|
+
A("sort-change", e);
|
|
1291
|
+
}
|
|
1292
|
+
return p({
|
|
1293
|
+
get tableRef() {
|
|
1294
|
+
return N.value ?? null;
|
|
1295
|
+
},
|
|
1296
|
+
openColumnEditor: ze,
|
|
1297
|
+
openCreate: We,
|
|
1298
|
+
openEdit: Ge,
|
|
1299
|
+
getSearchModel: () => ({ ...W }),
|
|
1300
|
+
getColumns: () => U(B.value)
|
|
1301
|
+
}), (t, d) => {
|
|
1302
|
+
let p = x("el-button"), m = x("el-icon"), h = x("el-table-column"), _ = x("el-table"), v = x("el-pagination"), C = x("el-form-item"), T = x("el-form"), D = x("el-dialog"), A = S("loading");
|
|
1303
|
+
return g(), i("div", De, [
|
|
1304
|
+
l.showSearch && _e.value.length ? (g(), n(Ce, {
|
|
1305
|
+
key: 0,
|
|
1306
|
+
columns: _e.value,
|
|
1307
|
+
"model-value": W,
|
|
1308
|
+
collapsible: l.searchCollapsible,
|
|
1309
|
+
"collapse-visible-count": l.searchCollapseVisibleCount,
|
|
1310
|
+
"default-expanded": l.searchDefaultExpanded,
|
|
1311
|
+
"persist-key": l.persistKey,
|
|
1312
|
+
"onUpdate:modelValue": Je,
|
|
1313
|
+
onSearch: Ye,
|
|
1314
|
+
onReset: Xe
|
|
1315
|
+
}, null, 8, [
|
|
1316
|
+
"columns",
|
|
1317
|
+
"model-value",
|
|
1318
|
+
"collapsible",
|
|
1319
|
+
"collapse-visible-count",
|
|
1320
|
+
"default-expanded",
|
|
1321
|
+
"persist-key"
|
|
1322
|
+
])) : r("", !0),
|
|
1323
|
+
a("div", Oe, [
|
|
1324
|
+
l.showToolbar ? (g(), i("div", ke, [a("div", Ae, [b(t.$slots, "toolbar-left", {}, () => [l.showCreate ? (g(), n(p, {
|
|
1325
|
+
key: 0,
|
|
1326
|
+
type: "primary",
|
|
1327
|
+
icon: w(F),
|
|
1328
|
+
onClick: We
|
|
1329
|
+
}, {
|
|
1330
|
+
default: O(() => [...d[3] ||= [s(" 新增 ", -1)]]),
|
|
1331
|
+
_: 1
|
|
1332
|
+
}, 8, ["icon"])) : r("", !0)])]), a("div", je, [
|
|
1333
|
+
b(t.$slots, "toolbar-right"),
|
|
1334
|
+
l.showRefresh ? (g(), n(p, {
|
|
1335
|
+
key: 0,
|
|
1336
|
+
class: "pro-smart-table__icon-btn",
|
|
1337
|
+
circle: "",
|
|
1338
|
+
size: "small",
|
|
1339
|
+
title: "刷新",
|
|
1340
|
+
"aria-label": "刷新",
|
|
1341
|
+
disabled: Q.value,
|
|
1342
|
+
onClick: Be
|
|
1343
|
+
}, {
|
|
1344
|
+
default: O(() => [c(m, {
|
|
1345
|
+
size: 14,
|
|
1346
|
+
class: f({ "pro-smart-table__refresh-spin": Q.value })
|
|
1347
|
+
}, {
|
|
1348
|
+
default: O(() => [c(w(R))]),
|
|
1349
|
+
_: 1
|
|
1350
|
+
}, 8, ["class"])]),
|
|
1351
|
+
_: 1
|
|
1352
|
+
}, 8, ["disabled"])) : r("", !0),
|
|
1353
|
+
l.showColumnEditor ? (g(), n(p, {
|
|
1354
|
+
key: 1,
|
|
1355
|
+
class: "pro-smart-table__icon-btn",
|
|
1356
|
+
circle: "",
|
|
1357
|
+
size: "small",
|
|
1358
|
+
title: "编辑列",
|
|
1359
|
+
"aria-label": "编辑列",
|
|
1360
|
+
onClick: ze
|
|
1361
|
+
}, {
|
|
1362
|
+
default: O(() => [c(m, { size: 14 }, {
|
|
1363
|
+
default: O(() => [c(w(te))]),
|
|
1364
|
+
_: 1
|
|
1365
|
+
})]),
|
|
1366
|
+
_: 1
|
|
1367
|
+
})) : r("", !0)
|
|
1368
|
+
])])) : r("", !0),
|
|
1369
|
+
$.value ? (g(), i("div", Me, [b(t.$slots, "skeleton", {}, () => [c(Ee, {
|
|
1370
|
+
rows: we.value,
|
|
1371
|
+
columns: Te.value,
|
|
1372
|
+
animated: X.value !== !1 && X.value.animated !== !1
|
|
1373
|
+
}, null, 8, [
|
|
1374
|
+
"rows",
|
|
1375
|
+
"columns",
|
|
1376
|
+
"animated"
|
|
1377
|
+
])])])) : r("", !0),
|
|
1378
|
+
k((g(), i("div", Ne, [c(_, u({
|
|
1379
|
+
ref_key: "tableRef",
|
|
1380
|
+
ref: N,
|
|
1381
|
+
class: "pro-smart-table__table"
|
|
1382
|
+
}, ee.value, {
|
|
1383
|
+
data: ce.value,
|
|
1384
|
+
onSortChange: Ze
|
|
1385
|
+
}), {
|
|
1386
|
+
default: O(() => [
|
|
1387
|
+
l.showSeq ? (g(), n(h, {
|
|
1388
|
+
key: 0,
|
|
1389
|
+
type: "index",
|
|
1390
|
+
label: "序号",
|
|
1391
|
+
width: l.seqWidth,
|
|
1392
|
+
index: fe,
|
|
1393
|
+
fixed: "left",
|
|
1394
|
+
align: "center"
|
|
1395
|
+
}, null, 8, ["width"])) : r("", !0),
|
|
1396
|
+
l.showSelection ? (g(), n(h, {
|
|
1397
|
+
key: 1,
|
|
1398
|
+
type: "selection",
|
|
1399
|
+
width: "48",
|
|
1400
|
+
fixed: "left",
|
|
1401
|
+
align: "center"
|
|
1402
|
+
})) : r("", !0),
|
|
1403
|
+
(g(!0), i(e, null, y(ge.value, (e) => (g(), n(h, u({
|
|
1404
|
+
key: e.id,
|
|
1405
|
+
prop: e.prop,
|
|
1406
|
+
label: e.label,
|
|
1407
|
+
"min-width": e.minWidth,
|
|
1408
|
+
width: e.width,
|
|
1409
|
+
sortable: se(e),
|
|
1410
|
+
fixed: e.fixed || !1
|
|
1411
|
+
}, { ref_for: !0 }, e.columnProps), o({ _: 2 }, [t.$slots[`col-${e.prop}`] ? {
|
|
1412
|
+
name: "default",
|
|
1413
|
+
fn: O((n) => [b(t.$slots, `col-${e.prop}`, u({ ref_for: !0 }, n))]),
|
|
1414
|
+
key: "0"
|
|
1415
|
+
} : void 0]), 1040, [
|
|
1416
|
+
"prop",
|
|
1417
|
+
"label",
|
|
1418
|
+
"min-width",
|
|
1419
|
+
"width",
|
|
1420
|
+
"sortable",
|
|
1421
|
+
"fixed"
|
|
1422
|
+
]))), 128)),
|
|
1423
|
+
b(t.$slots, "default")
|
|
1424
|
+
]),
|
|
1425
|
+
_: 3
|
|
1426
|
+
}, 16, ["data"])])), [[E, !$.value], [A, Ie.value]]),
|
|
1427
|
+
q.value && !$.value ? (g(), i("div", Pe, [b(t.$slots, "pagination", {}, () => [c(v, {
|
|
1428
|
+
background: J.value.background !== !1,
|
|
1429
|
+
size: ae.value,
|
|
1430
|
+
"current-page": K.currentPage,
|
|
1431
|
+
"page-size": K.pageSize,
|
|
1432
|
+
total: oe.value,
|
|
1433
|
+
"page-sizes": re.value,
|
|
1434
|
+
layout: ie.value,
|
|
1435
|
+
"pager-count": J.value.pagerCount ?? 7,
|
|
1436
|
+
"onUpdate:currentPage": ue,
|
|
1437
|
+
"onUpdate:pageSize": de
|
|
1438
|
+
}, null, 8, [
|
|
1439
|
+
"background",
|
|
1440
|
+
"size",
|
|
1441
|
+
"current-page",
|
|
1442
|
+
"page-size",
|
|
1443
|
+
"total",
|
|
1444
|
+
"page-sizes",
|
|
1445
|
+
"layout",
|
|
1446
|
+
"pager-count"
|
|
1447
|
+
])])])) : r("", !0)
|
|
1448
|
+
]),
|
|
1449
|
+
c(w(be), {
|
|
1450
|
+
modelValue: I.value,
|
|
1451
|
+
"onUpdate:modelValue": d[0] ||= (e) => I.value = e,
|
|
1452
|
+
columns: B.value,
|
|
1453
|
+
"default-columns": V.value,
|
|
1454
|
+
onSave: Ve,
|
|
1455
|
+
onRestore: He
|
|
1456
|
+
}, null, 8, [
|
|
1457
|
+
"modelValue",
|
|
1458
|
+
"columns",
|
|
1459
|
+
"default-columns"
|
|
1460
|
+
]),
|
|
1461
|
+
c(D, {
|
|
1462
|
+
modelValue: L.value,
|
|
1463
|
+
"onUpdate:modelValue": d[2] ||= (e) => L.value = e,
|
|
1464
|
+
title: Re.value,
|
|
1465
|
+
width: l.formWidth,
|
|
1466
|
+
"destroy-on-close": "",
|
|
1467
|
+
class: "pro-smart-table__form-dialog"
|
|
1468
|
+
}, {
|
|
1469
|
+
footer: O(() => [c(p, { onClick: d[1] ||= (e) => L.value = !1 }, {
|
|
1470
|
+
default: O(() => [...d[4] ||= [s("取消", -1)]]),
|
|
1471
|
+
_: 1
|
|
1472
|
+
}), c(p, {
|
|
1473
|
+
type: "primary",
|
|
1474
|
+
onClick: Ke
|
|
1475
|
+
}, {
|
|
1476
|
+
default: O(() => [...d[5] ||= [s("确定", -1)]]),
|
|
1477
|
+
_: 1
|
|
1478
|
+
})]),
|
|
1479
|
+
default: O(() => [c(T, {
|
|
1480
|
+
ref_key: "formRef",
|
|
1481
|
+
ref: P,
|
|
1482
|
+
model: G,
|
|
1483
|
+
rules: ye.value,
|
|
1484
|
+
"label-width": "96px"
|
|
1485
|
+
}, {
|
|
1486
|
+
default: O(() => [(g(!0), i(e, null, y(ve.value, (e) => (g(), n(C, {
|
|
1487
|
+
key: e.id,
|
|
1488
|
+
label: e.label,
|
|
1489
|
+
prop: e.prop,
|
|
1490
|
+
required: !!e.required
|
|
1491
|
+
}, {
|
|
1492
|
+
default: O(() => [t.$slots[`form-${e.prop}`] ? b(t.$slots, `form-${e.prop}`, {
|
|
1493
|
+
model: G,
|
|
1494
|
+
column: e,
|
|
1495
|
+
value: G[e.prop],
|
|
1496
|
+
mode: z.value
|
|
1497
|
+
}, void 0, void 0, 0) : (g(), n(xe, {
|
|
1498
|
+
key: 1,
|
|
1499
|
+
modelValue: G[e.prop],
|
|
1500
|
+
"onUpdate:modelValue": (t) => G[e.prop] = t,
|
|
1501
|
+
column: e,
|
|
1502
|
+
mode: "form"
|
|
1503
|
+
}, null, 8, [
|
|
1504
|
+
"modelValue",
|
|
1505
|
+
"onUpdate:modelValue",
|
|
1506
|
+
"column"
|
|
1507
|
+
]))]),
|
|
1508
|
+
_: 2
|
|
1509
|
+
}, 1032, [
|
|
1510
|
+
"label",
|
|
1511
|
+
"prop",
|
|
1512
|
+
"required"
|
|
1513
|
+
]))), 128))]),
|
|
1514
|
+
_: 3
|
|
1515
|
+
}, 8, ["model", "rules"]), b(t.$slots, "form-extra", {
|
|
1516
|
+
model: G,
|
|
1517
|
+
mode: z.value,
|
|
1518
|
+
visible: L.value
|
|
1519
|
+
})]),
|
|
1520
|
+
_: 3
|
|
1521
|
+
}, 8, [
|
|
1522
|
+
"modelValue",
|
|
1523
|
+
"title",
|
|
1524
|
+
"width"
|
|
1525
|
+
])
|
|
1526
|
+
]);
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
//#endregion
|
|
1531
|
+
//#region src/plugin.ts
|
|
1532
|
+
function Q(e, t) {
|
|
1533
|
+
return e ? `${e}${t}` : t;
|
|
1534
|
+
}
|
|
1535
|
+
var $ = { install(e, t = {}) {
|
|
1536
|
+
let { prefix: n } = t;
|
|
1537
|
+
e.component(Q(n, "ProSmartTable"), Z), e.component(Q(n, "ProColumnEditor"), be);
|
|
1538
|
+
} };
|
|
1539
|
+
//#endregion
|
|
1540
|
+
export { be as ProColumnEditor, Z as ProSmartTable, B as SMART_FORM_CONTROL_OPTIONS, $ as VueSmartTable, $ as default, U as cloneColumns, V as createColumnId, G as createEmptyColumn, H as normalizeColumn, K as resolveFormControlType };
|