vue3-smart-table 2.1.0 → 2.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 +10 -0
- package/dist/vue3-smart-table.cjs.js +1 -1
- package/dist/vue3-smart-table.cjs.js.map +1 -1
- package/dist/vue3-smart-table.es.js +174 -173
- package/dist/vue3-smart-table.es.js.map +1 -1
- package/dist/vue3-smart-table.umd.js +1 -1
- package/dist/vue3-smart-table.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SmartTable/index.vue +61 -54
- package/src/components/SmartTable/renderers/input.vue +73 -73
- package/src/components/SmartTable/renderers/inputNumber.vue +64 -64
- package/src/components/SmartTable/renderers/select.vue +87 -87
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var pe = Object.defineProperty;
|
|
2
2
|
var fe = (t, e, r) => e in t ? pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var j = (t, e, r) => fe(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { ref as
|
|
4
|
+
import { ref as O, watch as N, computed as E, defineComponent as z, h as b, resolveComponent as T, createBlock as B, openBlock as w, mergeProps as S, withKeys as G, withCtx as $, createElementBlock as A, Fragment as I, renderList as J, resolveDirective as de, withDirectives as me, createTextVNode as ne, toDisplayString as P, renderSlot as ge, createCommentVNode as ye, resolveDynamicComponent as he, unref as oe, normalizeClass as Ce, normalizeStyle as be } from "vue";
|
|
5
5
|
import { ElImage as U, ElTag as ve, ElMessage as R, ElButton as we } from "element-plus";
|
|
6
6
|
import { CopyDocument as ke, DocumentCopy as _e } from "@element-plus/icons-vue";
|
|
7
7
|
function se(t) {
|
|
@@ -27,7 +27,7 @@ function re(t, e) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function Be(t, e) {
|
|
30
|
-
const { cacheKey: r, storage: l = localStorage } = e || {}, a = r ? l.getItem(r) : null, p =
|
|
30
|
+
const { cacheKey: r, storage: l = localStorage } = e || {}, a = r ? l.getItem(r) : null, p = O(
|
|
31
31
|
re(
|
|
32
32
|
t,
|
|
33
33
|
a ? JSON.parse(a) : []
|
|
@@ -35,9 +35,9 @@ function Be(t, e) {
|
|
|
35
35
|
);
|
|
36
36
|
return N(
|
|
37
37
|
p,
|
|
38
|
-
(
|
|
38
|
+
(u) => {
|
|
39
39
|
if (!r) return;
|
|
40
|
-
const y =
|
|
40
|
+
const y = u.map((d) => ({
|
|
41
41
|
key: d.key,
|
|
42
42
|
visible: d.visible,
|
|
43
43
|
columnOpts: d.columnOpts
|
|
@@ -55,13 +55,13 @@ function Be(t, e) {
|
|
|
55
55
|
* 主动设置列配置
|
|
56
56
|
* 常用于:列设置弹窗 / 拖拽排序完成
|
|
57
57
|
*/
|
|
58
|
-
setColumns(
|
|
58
|
+
setColumns(u) {
|
|
59
59
|
p.value = re(
|
|
60
60
|
t,
|
|
61
|
-
|
|
61
|
+
u
|
|
62
62
|
), r && l.setItem(
|
|
63
63
|
r,
|
|
64
|
-
JSON.stringify(
|
|
64
|
+
JSON.stringify(u)
|
|
65
65
|
);
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
@@ -73,30 +73,30 @@ function Be(t, e) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
function Ee(t, e = 10, r = []) {
|
|
76
|
-
const a = "*:*:*", p = (
|
|
77
|
-
if (!
|
|
78
|
-
const f = Array.isArray(
|
|
76
|
+
const a = "*:*:*", p = (o) => {
|
|
77
|
+
if (!o) return !0;
|
|
78
|
+
const f = Array.isArray(o) ? o : [o];
|
|
79
79
|
return r.some(
|
|
80
80
|
(h) => h === a || f.includes(h)
|
|
81
81
|
);
|
|
82
|
-
},
|
|
82
|
+
}, u = E(() => t.some((o) => p(o.permission))), y = E(() => t.filter((f) => p(f.permission)).slice(0, e).reduce(
|
|
83
83
|
(f, h) => f + (h.width ?? 55),
|
|
84
84
|
0
|
|
85
|
-
)), d = (
|
|
86
|
-
(h,
|
|
85
|
+
)), d = (o, f) => p(o.permission) && (o.visible ? o.visible(f) : !0), g = (o) => t.filter((h) => d(h, o)).slice(0, e).reduce(
|
|
86
|
+
(h, M) => h + (M.width ?? 55),
|
|
87
87
|
0
|
|
88
88
|
);
|
|
89
89
|
return {
|
|
90
|
-
hasAnyButton:
|
|
90
|
+
hasAnyButton: u,
|
|
91
91
|
optWidth: y,
|
|
92
|
-
hasAnyVisibleButton: (
|
|
92
|
+
hasAnyVisibleButton: (o) => o != null && o.length ? o.some(
|
|
93
93
|
(f) => t.some((h) => d(h, f))
|
|
94
94
|
) : !1,
|
|
95
|
-
getMaxOptWidth: (
|
|
95
|
+
getMaxOptWidth: (o) => o != null && o.length ? o.reduce(
|
|
96
96
|
(f, h) => Math.max(f, g(h)),
|
|
97
97
|
0
|
|
98
98
|
) : y.value,
|
|
99
|
-
getVisibleButtons: (
|
|
99
|
+
getVisibleButtons: (o) => t.filter((f) => d(f, o)).slice(0, e)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
class Se {
|
|
@@ -132,7 +132,7 @@ function Y() {
|
|
|
132
132
|
return q || (q = new Se()), q;
|
|
133
133
|
}
|
|
134
134
|
function Q(t) {
|
|
135
|
-
return
|
|
135
|
+
return z({
|
|
136
136
|
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
137
137
|
setup(e) {
|
|
138
138
|
return () => b(t, e);
|
|
@@ -140,7 +140,7 @@ function Q(t) {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
function V(t) {
|
|
143
|
-
return
|
|
143
|
+
return z({
|
|
144
144
|
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
145
145
|
setup(e) {
|
|
146
146
|
return () => t(e);
|
|
@@ -187,10 +187,10 @@ function k(t, e) {
|
|
|
187
187
|
}
|
|
188
188
|
function X(t, e, r) {
|
|
189
189
|
if (!t || !e) return;
|
|
190
|
-
const l = e.split("."), a = l.pop(), p = l.reduce((
|
|
190
|
+
const l = e.split("."), a = l.pop(), p = l.reduce((u, y) => (u[y] || (u[y] = {}), u[y]), t);
|
|
191
191
|
p[a] = r;
|
|
192
192
|
}
|
|
193
|
-
const Ve = /* @__PURE__ */
|
|
193
|
+
const Ve = /* @__PURE__ */ z({
|
|
194
194
|
__name: "input",
|
|
195
195
|
props: {
|
|
196
196
|
row: {},
|
|
@@ -201,8 +201,8 @@ const Ve = /* @__PURE__ */ O({
|
|
|
201
201
|
onCellEnter: { type: Function }
|
|
202
202
|
},
|
|
203
203
|
setup(t) {
|
|
204
|
-
const e = t, r =
|
|
205
|
-
const i = e.col.props || {}, { onBlur:
|
|
204
|
+
const e = t, r = O(k(e.row, e.col.key)), l = E(() => {
|
|
205
|
+
const i = e.col.props || {}, { onBlur: n, onFocus: s, onChange: o, onInput: f, onClear: h, onEnter: M, ...K } = i;
|
|
206
206
|
return {
|
|
207
207
|
placeholder: "",
|
|
208
208
|
size: "small",
|
|
@@ -214,32 +214,32 @@ const Ve = /* @__PURE__ */ O({
|
|
|
214
214
|
X(e.row, e.col.key, i);
|
|
215
215
|
});
|
|
216
216
|
const a = (i) => {
|
|
217
|
-
var
|
|
218
|
-
(
|
|
217
|
+
var n, s, o;
|
|
218
|
+
(n = e.onCellChange) == null || n.call(e, e.row, e.col), (o = (s = e.col.props) == null ? void 0 : s.onChange) == null || o.call(s, i, e.row, e.col);
|
|
219
219
|
}, p = (i) => {
|
|
220
|
-
var
|
|
221
|
-
(
|
|
222
|
-
},
|
|
223
|
-
var
|
|
224
|
-
(s = (
|
|
220
|
+
var n, s, o;
|
|
221
|
+
(n = e.onCellBlur) == null || n.call(e, e.row, e.col), (o = (s = e.col.props) == null ? void 0 : s.onBlur) == null || o.call(s, i, e.row, e.col);
|
|
222
|
+
}, u = (i) => {
|
|
223
|
+
var n, s;
|
|
224
|
+
(s = (n = e.col.props) == null ? void 0 : n.onFocus) == null || s.call(n, i, e.row, e.col);
|
|
225
225
|
}, y = (i) => {
|
|
226
|
-
var
|
|
227
|
-
(s = (
|
|
226
|
+
var n, s;
|
|
227
|
+
(s = (n = e.col.props) == null ? void 0 : n.onInput) == null || s.call(n, i, e.row, e.col);
|
|
228
228
|
}, d = (i) => {
|
|
229
|
-
var
|
|
230
|
-
(
|
|
229
|
+
var n, s, o;
|
|
230
|
+
(n = e.onCellEnter) == null || n.call(e, e.row, e.col), (o = (s = e.col.props) == null ? void 0 : s.onEnter) == null || o.call(s, i, e.row, e.col);
|
|
231
231
|
}, g = () => {
|
|
232
|
-
var i,
|
|
233
|
-
(
|
|
232
|
+
var i, n;
|
|
233
|
+
(n = (i = e.col.props) == null ? void 0 : i.onClear) == null || n.call(i, e.row, e.col);
|
|
234
234
|
};
|
|
235
|
-
return (i,
|
|
235
|
+
return (i, n) => {
|
|
236
236
|
const s = T("el-input");
|
|
237
237
|
return w(), B(s, S({
|
|
238
238
|
modelValue: r.value,
|
|
239
|
-
"onUpdate:modelValue":
|
|
239
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => r.value = o)
|
|
240
240
|
}, l.value, {
|
|
241
241
|
onBlur: p,
|
|
242
|
-
onFocus:
|
|
242
|
+
onFocus: u,
|
|
243
243
|
onChange: a,
|
|
244
244
|
onInput: y,
|
|
245
245
|
onKeyup: G(d, ["enter"]),
|
|
@@ -247,7 +247,7 @@ const Ve = /* @__PURE__ */ O({
|
|
|
247
247
|
}), null, 16, ["modelValue"]);
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
}), Fe = /* @__PURE__ */
|
|
250
|
+
}), Fe = /* @__PURE__ */ z({
|
|
251
251
|
__name: "inputNumber",
|
|
252
252
|
props: {
|
|
253
253
|
row: {},
|
|
@@ -258,46 +258,46 @@ const Ve = /* @__PURE__ */ O({
|
|
|
258
258
|
onCellEnter: { type: Function }
|
|
259
259
|
},
|
|
260
260
|
setup(t) {
|
|
261
|
-
const e = t, r =
|
|
262
|
-
const d = e.col.props || {}, { onBlur: g, onFocus: i, onChange:
|
|
261
|
+
const e = t, r = O(k(e.row, e.col.key)), l = E(() => {
|
|
262
|
+
const d = e.col.props || {}, { onBlur: g, onFocus: i, onChange: n, onEnter: s, ...o } = d;
|
|
263
263
|
return {
|
|
264
264
|
min: 0,
|
|
265
265
|
max: 99999,
|
|
266
266
|
controls: !1,
|
|
267
267
|
size: "small",
|
|
268
|
-
...
|
|
268
|
+
...o
|
|
269
269
|
};
|
|
270
270
|
});
|
|
271
271
|
N(r, (d) => {
|
|
272
272
|
X(e.row, e.col.key, d);
|
|
273
273
|
});
|
|
274
274
|
const a = (d, g) => {
|
|
275
|
-
var i,
|
|
276
|
-
(i = e.onCellChange) == null || i.call(e, e.row, e.col), (s = (
|
|
275
|
+
var i, n, s;
|
|
276
|
+
(i = e.onCellChange) == null || i.call(e, e.row, e.col), (s = (n = e.col.props) == null ? void 0 : n.onChange) == null || s.call(n, d, g, e.row, e.col);
|
|
277
277
|
}, p = (d) => {
|
|
278
|
-
var g, i,
|
|
279
|
-
(g = e.onCellBlur) == null || g.call(e, e.row, e.col), (
|
|
280
|
-
},
|
|
278
|
+
var g, i, n;
|
|
279
|
+
(g = e.onCellBlur) == null || g.call(e, e.row, e.col), (n = (i = e.col.props) == null ? void 0 : i.onBlur) == null || n.call(i, d, e.row, e.col);
|
|
280
|
+
}, u = (d) => {
|
|
281
281
|
var g, i;
|
|
282
282
|
(i = (g = e.col.props) == null ? void 0 : g.onFocus) == null || i.call(g, d, e.row, e.col);
|
|
283
283
|
}, y = (d) => {
|
|
284
|
-
var g, i,
|
|
285
|
-
(g = e.onCellEnter) == null || g.call(e, e.row, e.col), (
|
|
284
|
+
var g, i, n;
|
|
285
|
+
(g = e.onCellEnter) == null || g.call(e, e.row, e.col), (n = (i = e.col.props) == null ? void 0 : i.onEnter) == null || n.call(i, d, e.row, e.col);
|
|
286
286
|
};
|
|
287
287
|
return (d, g) => {
|
|
288
288
|
const i = T("el-input-number");
|
|
289
289
|
return w(), B(i, S({
|
|
290
290
|
modelValue: r.value,
|
|
291
|
-
"onUpdate:modelValue": g[0] || (g[0] = (
|
|
291
|
+
"onUpdate:modelValue": g[0] || (g[0] = (n) => r.value = n)
|
|
292
292
|
}, l.value, {
|
|
293
293
|
onBlur: p,
|
|
294
|
-
onFocus:
|
|
294
|
+
onFocus: u,
|
|
295
295
|
onChange: a,
|
|
296
296
|
onKeyup: G(y, ["enter"])
|
|
297
297
|
}), null, 16, ["modelValue"]);
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
}), Te = /* @__PURE__ */
|
|
300
|
+
}), Te = /* @__PURE__ */ z({
|
|
301
301
|
__name: "select",
|
|
302
302
|
props: {
|
|
303
303
|
row: {},
|
|
@@ -308,8 +308,8 @@ const Ve = /* @__PURE__ */ O({
|
|
|
308
308
|
onCellEnter: { type: Function }
|
|
309
309
|
},
|
|
310
310
|
setup(t) {
|
|
311
|
-
const e = t, r =
|
|
312
|
-
const
|
|
311
|
+
const e = t, r = O(k(e.row, e.col.key)), l = E(() => {
|
|
312
|
+
const n = e.col.props || {}, { options: s, onChange: o, onBlur: f, onFocus: h, onVisibleChange: M, onClear: K, onEnter: ee, ...D } = n;
|
|
313
313
|
return {
|
|
314
314
|
placeholder: "请选择",
|
|
315
315
|
size: "small",
|
|
@@ -317,43 +317,43 @@ const Ve = /* @__PURE__ */ O({
|
|
|
317
317
|
...D
|
|
318
318
|
};
|
|
319
319
|
}), a = E(() => (e.col.props || {}).options || []);
|
|
320
|
-
N(r, (
|
|
321
|
-
X(e.row, e.col.key,
|
|
320
|
+
N(r, (n) => {
|
|
321
|
+
X(e.row, e.col.key, n);
|
|
322
322
|
});
|
|
323
|
-
const p = (
|
|
324
|
-
var s,
|
|
325
|
-
(s = e.onCellChange) == null || s.call(e, e.row, e.col), (f = (
|
|
326
|
-
},
|
|
327
|
-
var s,
|
|
328
|
-
(s = e.onCellBlur) == null || s.call(e, e.row, e.col), (f = (
|
|
329
|
-
}, y = (
|
|
330
|
-
var s,
|
|
331
|
-
(
|
|
332
|
-
}, d = (
|
|
333
|
-
var s,
|
|
334
|
-
(
|
|
323
|
+
const p = (n) => {
|
|
324
|
+
var s, o, f;
|
|
325
|
+
(s = e.onCellChange) == null || s.call(e, e.row, e.col), (f = (o = e.col.props) == null ? void 0 : o.onChange) == null || f.call(o, n, e.row, e.col);
|
|
326
|
+
}, u = (n) => {
|
|
327
|
+
var s, o, f;
|
|
328
|
+
(s = e.onCellBlur) == null || s.call(e, e.row, e.col), (f = (o = e.col.props) == null ? void 0 : o.onBlur) == null || f.call(o, n, e.row, e.col);
|
|
329
|
+
}, y = (n) => {
|
|
330
|
+
var s, o;
|
|
331
|
+
(o = (s = e.col.props) == null ? void 0 : s.onFocus) == null || o.call(s, n, e.row, e.col);
|
|
332
|
+
}, d = (n) => {
|
|
333
|
+
var s, o;
|
|
334
|
+
(o = (s = e.col.props) == null ? void 0 : s.onVisibleChange) == null || o.call(s, n, e.row, e.col);
|
|
335
335
|
}, g = () => {
|
|
336
|
-
var
|
|
337
|
-
(s = (
|
|
338
|
-
}, i = (
|
|
339
|
-
var s,
|
|
340
|
-
(s = e.onCellEnter) == null || s.call(e, e.row, e.col), (f = (
|
|
336
|
+
var n, s;
|
|
337
|
+
(s = (n = e.col.props) == null ? void 0 : n.onClear) == null || s.call(n, e.row, e.col);
|
|
338
|
+
}, i = (n) => {
|
|
339
|
+
var s, o, f;
|
|
340
|
+
(s = e.onCellEnter) == null || s.call(e, e.row, e.col), (f = (o = e.col.props) == null ? void 0 : o.onEnter) == null || f.call(o, n, e.row, e.col);
|
|
341
341
|
};
|
|
342
|
-
return (
|
|
343
|
-
const
|
|
342
|
+
return (n, s) => {
|
|
343
|
+
const o = T("el-option"), f = T("el-select");
|
|
344
344
|
return w(), B(f, S({
|
|
345
345
|
modelValue: r.value,
|
|
346
346
|
"onUpdate:modelValue": s[0] || (s[0] = (h) => r.value = h)
|
|
347
347
|
}, l.value, {
|
|
348
348
|
onChange: p,
|
|
349
|
-
onBlur:
|
|
349
|
+
onBlur: u,
|
|
350
350
|
onFocus: y,
|
|
351
351
|
onVisibleChange: d,
|
|
352
352
|
onClear: g,
|
|
353
353
|
onKeyup: G(i, ["enter"])
|
|
354
354
|
}), {
|
|
355
|
-
default:
|
|
356
|
-
(w(!0),
|
|
355
|
+
default: $(() => [
|
|
356
|
+
(w(!0), A(I, null, J(a.value, (h) => (w(), B(o, {
|
|
357
357
|
key: h.value,
|
|
358
358
|
label: h.label,
|
|
359
359
|
value: h.value,
|
|
@@ -376,22 +376,22 @@ const Ve = /* @__PURE__ */ O({
|
|
|
376
376
|
...a,
|
|
377
377
|
...l,
|
|
378
378
|
onClick: (p) => {
|
|
379
|
-
var
|
|
380
|
-
(
|
|
379
|
+
var u, y;
|
|
380
|
+
(u = t.onClick) == null || u.call(t, t.row, t.col), (y = e.onClick) == null || y.call(e, p, t.row, t.col);
|
|
381
381
|
}
|
|
382
382
|
}, () => e.label || r);
|
|
383
383
|
}), Re = V((t) => {
|
|
384
|
-
const e = t.col.props || {}, r = k(t.row, t.col.key), { href: l, blank: a, label: p, ...
|
|
384
|
+
const e = t.col.props || {}, r = k(t.row, t.col.key), { href: l, blank: a, label: p, ...u } = e;
|
|
385
385
|
return b("a", {
|
|
386
386
|
href: l || r || "#",
|
|
387
387
|
target: a ? "_blank" : "_self",
|
|
388
388
|
rel: a ? "noopener noreferrer" : void 0,
|
|
389
389
|
style: "color:#409EFF;cursor:pointer;text-decoration:none;",
|
|
390
|
-
...
|
|
390
|
+
...u
|
|
391
391
|
}, p || r);
|
|
392
392
|
}), Ie = V((t) => {
|
|
393
|
-
var
|
|
394
|
-
const e = k(t.row, t.col.key), r = ((
|
|
393
|
+
var u;
|
|
394
|
+
const e = k(t.row, t.col.key), r = ((u = t.col) == null ? void 0 : u.props) || {}, { style: l, class: a, ...p } = r;
|
|
395
395
|
return b("div", {
|
|
396
396
|
class: a || "line-clamp-2",
|
|
397
397
|
style: l,
|
|
@@ -399,7 +399,7 @@ const Ve = /* @__PURE__ */ O({
|
|
|
399
399
|
...p
|
|
400
400
|
});
|
|
401
401
|
}), Ne = V((t) => {
|
|
402
|
-
const e = k(t.row, t.col.key) ?? "", r = t.col.props ?? {}, { iconColor: l, copyTitle: a, successText: p, errorText:
|
|
402
|
+
const e = k(t.row, t.col.key) ?? "", r = t.col.props ?? {}, { iconColor: l, copyTitle: a, successText: p, errorText: u, lineClamp: y, textStyles: d, textClass: g, ...i } = r, n = {
|
|
403
403
|
position: "absolute",
|
|
404
404
|
right: "-5px",
|
|
405
405
|
top: "50%",
|
|
@@ -432,7 +432,7 @@ const Ve = /* @__PURE__ */ O({
|
|
|
432
432
|
}, e),
|
|
433
433
|
e && b("span", {
|
|
434
434
|
class: "st_copy_btn",
|
|
435
|
-
style:
|
|
435
|
+
style: n,
|
|
436
436
|
title: a || "复制",
|
|
437
437
|
onClick: () => {
|
|
438
438
|
if (e)
|
|
@@ -441,16 +441,16 @@ const Ve = /* @__PURE__ */ O({
|
|
|
441
441
|
navigator.clipboard.writeText(e).then(() => {
|
|
442
442
|
R.success(p ?? "复制成功");
|
|
443
443
|
}).catch(() => {
|
|
444
|
-
R.error(
|
|
444
|
+
R.error(u ?? "复制失败");
|
|
445
445
|
});
|
|
446
446
|
else {
|
|
447
|
-
const
|
|
448
|
-
|
|
447
|
+
const o = document.createElement("textarea");
|
|
448
|
+
o.value = e, o.style.position = "fixed", o.style.opacity = "0", document.body.appendChild(o), o.select();
|
|
449
449
|
const f = document.execCommand("copy");
|
|
450
|
-
document.body.removeChild(
|
|
450
|
+
document.body.removeChild(o), f ? R.success(p ?? "复制成功") : R.error(u ?? "复制失败");
|
|
451
451
|
}
|
|
452
452
|
} catch {
|
|
453
|
-
R.error(
|
|
453
|
+
R.error(u ?? "复制失败");
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
}, [b(_e, {
|
|
@@ -460,24 +460,24 @@ const Ve = /* @__PURE__ */ O({
|
|
|
460
460
|
);
|
|
461
461
|
}), Ke = V((t) => {
|
|
462
462
|
var f;
|
|
463
|
-
const e = k(t.row, t.col.key) ?? "", r = ((f = t.col) == null ? void 0 : f.props) || {}, { width: l, height: a, fit: p, previewSrcList:
|
|
464
|
-
if (
|
|
463
|
+
const e = k(t.row, t.col.key) ?? "", r = ((f = t.col) == null ? void 0 : f.props) || {}, { width: l, height: a, fit: p, previewSrcList: u, placeholder: y, style: d, ...g } = r, n = e ? Array.isArray(e) ? e.filter((h) => h && typeof h == "string") : [e] : [];
|
|
464
|
+
if (n.length === 0)
|
|
465
465
|
return y || "";
|
|
466
466
|
const s = {
|
|
467
467
|
width: l || "80px",
|
|
468
468
|
height: a || "80px",
|
|
469
|
-
marginRight:
|
|
469
|
+
marginRight: n.length > 1 ? "4px" : "0",
|
|
470
470
|
...typeof d == "object" ? d : {}
|
|
471
|
-
},
|
|
472
|
-
previewSrcList:
|
|
471
|
+
}, o = {
|
|
472
|
+
previewSrcList: u || n,
|
|
473
473
|
previewTeleported: !0,
|
|
474
474
|
fit: p || "contain",
|
|
475
475
|
style: s,
|
|
476
476
|
...g
|
|
477
477
|
};
|
|
478
|
-
return
|
|
479
|
-
src:
|
|
480
|
-
...
|
|
478
|
+
return n.length === 1 ? b(U, {
|
|
479
|
+
src: n[0],
|
|
480
|
+
...o
|
|
481
481
|
}) : b(
|
|
482
482
|
"div",
|
|
483
483
|
{
|
|
@@ -486,30 +486,30 @@ const Ve = /* @__PURE__ */ O({
|
|
|
486
486
|
},
|
|
487
487
|
[
|
|
488
488
|
b(U, {
|
|
489
|
-
src:
|
|
490
|
-
...
|
|
489
|
+
src: n[0],
|
|
490
|
+
...o
|
|
491
491
|
}),
|
|
492
|
-
|
|
492
|
+
n.length > 1 && b("span", {
|
|
493
493
|
class: "st_img_total",
|
|
494
494
|
style: "position: absolute; top: 0; right: 0; ",
|
|
495
|
-
title: `${
|
|
495
|
+
title: `${n.length}`
|
|
496
496
|
}, [b(ke, { style: "width: 1em; height: 1em; " })])
|
|
497
497
|
]
|
|
498
498
|
);
|
|
499
499
|
}), We = V((t) => {
|
|
500
500
|
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { options: l = [], showValue: a = !1, ...p } = r;
|
|
501
501
|
if (e == null || e === "") return "";
|
|
502
|
-
const
|
|
503
|
-
const { listClass:
|
|
502
|
+
const u = Array.isArray(e) ? e.map(String) : [String(e)], y = l.filter((i) => u.includes(String(i.value))), d = u.filter((i) => !l.some((n) => String(n.value) === i)), g = y.map((i) => {
|
|
503
|
+
const { listClass: n, cssClass: s, tagProps: o, ...f } = i;
|
|
504
504
|
return b(
|
|
505
505
|
ve,
|
|
506
506
|
{
|
|
507
507
|
key: i.value,
|
|
508
|
-
type:
|
|
508
|
+
type: n,
|
|
509
509
|
class: s,
|
|
510
510
|
disableTransitions: !0,
|
|
511
511
|
...p,
|
|
512
|
-
...
|
|
512
|
+
...o
|
|
513
513
|
},
|
|
514
514
|
{ default: () => i.label + " " }
|
|
515
515
|
);
|
|
@@ -525,10 +525,10 @@ function De(t) {
|
|
|
525
525
|
const Le = V((t) => {
|
|
526
526
|
var y;
|
|
527
527
|
const { col: e, row: r, index: l } = t, a = k(t.row, t.col.key) ?? "", p = t.col.props || {};
|
|
528
|
-
let
|
|
529
|
-
return De(e) && (
|
|
528
|
+
let u = a;
|
|
529
|
+
return De(e) && (u = ((y = e.formatter) == null ? void 0 : y.call(e, a, r, l)) ?? a), b("span", { ...p }, u);
|
|
530
530
|
}), Pe = V((t) => {
|
|
531
|
-
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { style: l, size: a, class: p, ...
|
|
531
|
+
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { style: l, size: a, class: p, ...u } = r;
|
|
532
532
|
if (!e) return "";
|
|
533
533
|
const y = a ? `${a}px` : "20px";
|
|
534
534
|
return /^https?:\/\//.test(e) ? b(U, {
|
|
@@ -537,7 +537,7 @@ const Le = V((t) => {
|
|
|
537
537
|
previewTeleported: !0,
|
|
538
538
|
fit: "contain",
|
|
539
539
|
style: { width: "40px", height: "40px", ...typeof l == "object" ? l : {} },
|
|
540
|
-
...
|
|
540
|
+
...u
|
|
541
541
|
}) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ? b("div", {
|
|
542
542
|
innerHTML: e,
|
|
543
543
|
class: p,
|
|
@@ -547,14 +547,14 @@ const Le = V((t) => {
|
|
|
547
547
|
display: "inline-block",
|
|
548
548
|
...typeof l == "object" ? l : {}
|
|
549
549
|
},
|
|
550
|
-
...
|
|
550
|
+
...u
|
|
551
551
|
}) : b("i", {
|
|
552
552
|
class: [e, p].filter(Boolean).join(" "),
|
|
553
553
|
style: {
|
|
554
554
|
fontSize: y,
|
|
555
555
|
...typeof l == "object" ? l : {}
|
|
556
556
|
},
|
|
557
|
-
...
|
|
557
|
+
...u
|
|
558
558
|
});
|
|
559
559
|
}), ie = {
|
|
560
560
|
input: Me,
|
|
@@ -646,7 +646,7 @@ function tt(t) {
|
|
|
646
646
|
function nt() {
|
|
647
647
|
return Z().getConfig();
|
|
648
648
|
}
|
|
649
|
-
const Je = ["title"], ot = /* @__PURE__ */
|
|
649
|
+
const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
650
650
|
__name: "index",
|
|
651
651
|
props: {
|
|
652
652
|
data: { default: () => [] },
|
|
@@ -663,74 +663,74 @@ const Je = ["title"], ot = /* @__PURE__ */ O({
|
|
|
663
663
|
Z().init();
|
|
664
664
|
const { columns: p } = Be(l.columns, {
|
|
665
665
|
cacheKey: l.cacheKey ?? ""
|
|
666
|
-
}),
|
|
666
|
+
}), u = O(!1);
|
|
667
667
|
N(
|
|
668
668
|
p,
|
|
669
|
-
(
|
|
670
|
-
|
|
669
|
+
(c) => {
|
|
670
|
+
u.value && a("update:columns", c), u.value = !0;
|
|
671
671
|
},
|
|
672
672
|
{ deep: !0, immediate: !0 }
|
|
673
673
|
);
|
|
674
674
|
const y = E(
|
|
675
|
-
() => p.value.filter((
|
|
676
|
-
), d = (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
var _, W;
|
|
680
|
-
const m = (_ = l.pagination) == null ? void 0 : _.page, v = (W = l.pagination) == null ? void 0 : W.size;
|
|
681
|
-
return m && v ? (m - 1) * v + u + 1 : u + 1;
|
|
682
|
-
}, o = E(() => {
|
|
683
|
-
const u = Y(), m = {};
|
|
684
|
-
return u.names().forEach((v) => {
|
|
685
|
-
const _ = u.get(v);
|
|
686
|
-
_ && (m[v] = _);
|
|
687
|
-
}), m;
|
|
688
|
-
}), s = E(() => {
|
|
689
|
-
const u = /* @__PURE__ */ new Map();
|
|
690
|
-
return g.value.forEach((m) => {
|
|
675
|
+
() => p.value.filter((c) => c.type === "operation")
|
|
676
|
+
), d = E(() => {
|
|
677
|
+
const c = /* @__PURE__ */ new Map();
|
|
678
|
+
return y.value.forEach((m) => {
|
|
691
679
|
const v = Ee(
|
|
692
680
|
m.buttons || [],
|
|
693
681
|
m.maxbtn ?? 10,
|
|
694
682
|
l.permissions || []
|
|
695
683
|
);
|
|
696
|
-
|
|
697
|
-
}),
|
|
698
|
-
}),
|
|
684
|
+
c.set(m.key, v);
|
|
685
|
+
}), c;
|
|
686
|
+
}), g = (c) => d.value.get(c.key), i = (c) => {
|
|
687
|
+
var _;
|
|
688
|
+
if (!xe(c)) return !1;
|
|
689
|
+
const m = g(c);
|
|
690
|
+
return !m || !(c.buttons || []).length ? !1 : (_ = l.data) != null && _.length ? m.hasAnyVisibleButton(l.data) : m.hasAnyButton.value;
|
|
691
|
+
}, n = (c) => {
|
|
699
692
|
var v;
|
|
700
|
-
const m =
|
|
693
|
+
const m = g(c);
|
|
701
694
|
return m ? (v = l.data) != null && v.length ? m.getMaxOptWidth(l.data) : m.optWidth.value : 0;
|
|
702
|
-
},
|
|
703
|
-
const v =
|
|
704
|
-
return v ? (
|
|
705
|
-
},
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
695
|
+
}, s = (c, m) => {
|
|
696
|
+
const v = g(c);
|
|
697
|
+
return v ? (c.buttons || []).length ? v.getVisibleButtons(m) : [] : [];
|
|
698
|
+
}, o = E(
|
|
699
|
+
() => p.value.filter((c) => c.type === "operation" ? i(c) : se(c.type) ? !0 : c.visible !== !1)
|
|
700
|
+
), f = (c, m) => c.type === "selection" ? `selection-${m}` : c.type === "index" ? `index-${m}` : c.type === "operation" ? `operation-${c.key}-${m}` : `${c.key}-${m}`, h = (c) => {
|
|
701
|
+
var _, W;
|
|
702
|
+
const m = (_ = l.pagination) == null ? void 0 : _.page, v = (W = l.pagination) == null ? void 0 : W.size;
|
|
703
|
+
return m && v ? (m - 1) * v + c + 1 : c + 1;
|
|
704
|
+
}, M = E(() => {
|
|
705
|
+
const c = Y(), m = {};
|
|
706
|
+
return c.names().forEach((v) => {
|
|
707
|
+
const _ = c.get(v);
|
|
708
|
+
_ && (m[v] = _);
|
|
709
|
+
}), m;
|
|
710
|
+
}), K = (c, m) => {
|
|
711
|
+
a("cellChange", c, m);
|
|
712
|
+
}, ee = (c, m) => {
|
|
713
|
+
a("cellBlur", c, m);
|
|
714
|
+
}, D = (c, m) => {
|
|
715
|
+
a("cellEnter", c, m);
|
|
716
|
+
}, ae = (c, m) => {
|
|
717
|
+
m && a("cellClick", c, m);
|
|
718
|
+
}, te = O();
|
|
719
719
|
return e({
|
|
720
720
|
tableRef: te
|
|
721
|
-
}), (
|
|
721
|
+
}), (c, m) => {
|
|
722
722
|
const v = T("el-table-column"), _ = T("el-button"), W = T("el-table"), ce = de("loading");
|
|
723
723
|
return me((w(), B(W, S({
|
|
724
724
|
ref_key: "tableRef",
|
|
725
725
|
ref: te
|
|
726
|
-
},
|
|
726
|
+
}, c.$attrs, {
|
|
727
727
|
data: t.data,
|
|
728
728
|
"row-key": t.rowKey,
|
|
729
729
|
class: "smart_table"
|
|
730
730
|
}), {
|
|
731
|
-
default:
|
|
732
|
-
(w(!0),
|
|
733
|
-
key:
|
|
731
|
+
default: $(() => [
|
|
732
|
+
(w(!0), A(I, null, J(o.value, (C, ue) => (w(), A(I, {
|
|
733
|
+
key: f(C, ue)
|
|
734
734
|
}, [
|
|
735
735
|
C.type === "selection" ? (w(), B(v, S({
|
|
736
736
|
key: 0,
|
|
@@ -741,26 +741,26 @@ const Je = ["title"], ot = /* @__PURE__ */ O({
|
|
|
741
741
|
label: C.label || "#",
|
|
742
742
|
align: "center"
|
|
743
743
|
}, { ref_for: !0 }, C.columnProps), {
|
|
744
|
-
default:
|
|
745
|
-
ne(P(
|
|
744
|
+
default: $(({ $index: x }) => [
|
|
745
|
+
ne(P(h(x)), 1)
|
|
746
746
|
]),
|
|
747
747
|
_: 1
|
|
748
|
-
}, 16, ["label"])) : C.type === "operation"
|
|
748
|
+
}, 16, ["label"])) : C.type === "operation" ? (w(), B(v, S({
|
|
749
749
|
key: 2,
|
|
750
750
|
label: C.label || "操作",
|
|
751
751
|
align: "center"
|
|
752
752
|
}, { ref_for: !0 }, {
|
|
753
753
|
...C.columnProps,
|
|
754
|
-
width:
|
|
754
|
+
width: n(C)
|
|
755
755
|
}), {
|
|
756
|
-
default:
|
|
757
|
-
(w(!0),
|
|
756
|
+
default: $(({ row: x }) => [
|
|
757
|
+
(w(!0), A(I, null, J(s(C, x), (F) => (w(), B(_, {
|
|
758
758
|
key: F.label,
|
|
759
759
|
type: F.type || "primary",
|
|
760
760
|
link: "",
|
|
761
761
|
onClick: (L) => F.action(x)
|
|
762
762
|
}, {
|
|
763
|
-
default:
|
|
763
|
+
default: $(() => [
|
|
764
764
|
ne(P(F.label), 1)
|
|
765
765
|
]),
|
|
766
766
|
_: 2
|
|
@@ -769,18 +769,19 @@ const Je = ["title"], ot = /* @__PURE__ */ O({
|
|
|
769
769
|
_: 2
|
|
770
770
|
}, 1040, ["label"])) : (w(), B(v, S({
|
|
771
771
|
key: 3,
|
|
772
|
+
prop: C.key,
|
|
772
773
|
label: C.label,
|
|
773
774
|
align: "center"
|
|
774
775
|
}, { ref_for: !0 }, C.columnProps || {}), {
|
|
775
|
-
default:
|
|
776
|
+
default: $((x) => {
|
|
776
777
|
var F, L;
|
|
777
778
|
return [
|
|
778
|
-
C.type === "slot" ? (w(),
|
|
779
|
-
x.$index >= 0 ? ge(
|
|
779
|
+
C.type === "slot" ? (w(), A(I, { key: 0 }, [
|
|
780
|
+
x.$index >= 0 ? ge(c.$slots, C.slot || C.key, S({
|
|
780
781
|
key: 0,
|
|
781
782
|
ref_for: !0
|
|
782
783
|
}, x)) : ye("", !0)
|
|
783
|
-
], 64)) : C.type &&
|
|
784
|
+
], 64)) : C.type && M.value[C.type] ? (w(), B(he(M.value[C.type]), {
|
|
784
785
|
key: 1,
|
|
785
786
|
row: x.row,
|
|
786
787
|
col: C,
|
|
@@ -789,7 +790,7 @@ const Je = ["title"], ot = /* @__PURE__ */ O({
|
|
|
789
790
|
onCellBlur: ee,
|
|
790
791
|
onCellEnter: D,
|
|
791
792
|
onClick: ae
|
|
792
|
-
}, null, 40, ["row", "col", "index"])) : (w(),
|
|
793
|
+
}, null, 40, ["row", "col", "index"])) : (w(), A("span", {
|
|
793
794
|
key: 2,
|
|
794
795
|
style: be(((F = C.props) == null ? void 0 : F.style) || ""),
|
|
795
796
|
class: Ce(((L = C.props) == null ? void 0 : L.class) || ""),
|
|
@@ -798,7 +799,7 @@ const Je = ["title"], ot = /* @__PURE__ */ O({
|
|
|
798
799
|
];
|
|
799
800
|
}),
|
|
800
801
|
_: 2
|
|
801
|
-
}, 1040, ["label"]))
|
|
802
|
+
}, 1040, ["prop", "label"]))
|
|
802
803
|
], 64))), 128))
|
|
803
804
|
]),
|
|
804
805
|
_: 3
|