vue3-smart-table 1.0.5 → 3.0.0
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 +34 -0
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/types/components/SmartTable/config.d.ts +50 -0
- package/dist/types/components/SmartTable/hooks/useOperationColumn.d.ts +19 -0
- package/dist/types/components/SmartTable/hooks/useTableColumns.d.ts +28 -0
- package/dist/types/components/SmartTable/index.vue.d.ts +89 -0
- package/dist/types/components/SmartTable/renderer.d.ts +57 -0
- package/dist/types/components/SmartTable/renderers/index.d.ts +46 -0
- package/dist/types/components/SmartTable/renderers/input.vue.d.ts +11 -0
- package/dist/types/components/SmartTable/renderers/inputNumber.vue.d.ts +12 -0
- package/dist/types/components/SmartTable/renderers/select.vue.d.ts +12 -0
- package/dist/types/components/SmartTable/types.d.ts +193 -0
- package/dist/types/components/SmartTable/utils/path.d.ts +9 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/types/enhanced.d.ts +58 -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 +130 -126
- package/dist/vue3-smart-table.es.js.map +1 -1
- package/dist/vue3-smart-table.umd.js +2 -2
- package/dist/vue3-smart-table.umd.js.map +1 -1
- package/package.json +45 -10
- package/src/components/SmartTable/index.vue +1 -0
- package/src/components/SmartTable/renderer.ts +3 -2
- package/src/components/SmartTable/renderers/index.ts +3 -2
- package/src/components/SmartTable/renderers/input.vue +1 -0
- package/src/components/SmartTable/renderers/inputNumber.vue +1 -0
- package/src/components/SmartTable/renderers/select.vue +1 -0
- package/src/components/SmartTable/types.ts +11 -1
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
var ce = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var W = (t, e, n) =>
|
|
4
|
-
import { ref as L, watch as
|
|
2
|
+
var de = (t, e, n) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var W = (t, e, n) => de(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { ref as L, watch as F, computed as S, defineComponent as R, h as m, resolveComponent as O, createBlock as w, openBlock as y, mergeProps as x, withKeys as J, withCtx as V, createElementBlock as A, Fragment as $, renderList as M, resolveDirective as fe, withDirectives as me, createSlots as ye, createTextVNode as X, toDisplayString as P, renderSlot as Z, resolveDynamicComponent as pe, unref as ee, normalizeClass as ge, normalizeStyle as he, normalizeProps as be, guardReactiveProps as ve } from "vue";
|
|
5
5
|
import { ElImage as q, ElTag as Ce, ElMessage as K, ElButton as we } from "element-plus";
|
|
6
6
|
import { CopyDocument as ke, DocumentCopy as _e } from "@element-plus/icons-vue";
|
|
7
7
|
function te(t, e) {
|
|
8
8
|
if (!(e != null && e.length)) return t;
|
|
9
9
|
const n = new Map(
|
|
10
|
-
e.map((
|
|
10
|
+
e.map((l) => [l.key, l])
|
|
11
11
|
);
|
|
12
|
-
return t.map((
|
|
13
|
-
const i = n.get(
|
|
12
|
+
return t.map((l) => {
|
|
13
|
+
const i = n.get(l.key);
|
|
14
14
|
return i ? {
|
|
15
|
-
...
|
|
16
|
-
visible: typeof i.visible == "boolean" ? i.visible :
|
|
17
|
-
} :
|
|
15
|
+
...l,
|
|
16
|
+
visible: typeof i.visible == "boolean" ? i.visible : l.visible
|
|
17
|
+
} : l;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function xe(t, e) {
|
|
21
|
-
const { cacheKey: n, storage:
|
|
21
|
+
const { cacheKey: n, storage: l = localStorage } = e || {}, i = n ? l.getItem(n) : null, r = L(
|
|
22
22
|
te(
|
|
23
23
|
t,
|
|
24
24
|
i ? JSON.parse(i) : []
|
|
25
25
|
)
|
|
26
26
|
);
|
|
27
|
-
return
|
|
28
|
-
|
|
27
|
+
return F(
|
|
28
|
+
r,
|
|
29
29
|
(s) => {
|
|
30
30
|
if (!n) return;
|
|
31
|
-
const
|
|
32
|
-
key:
|
|
33
|
-
visible:
|
|
34
|
-
columnOpts:
|
|
31
|
+
const d = s.map((f) => ({
|
|
32
|
+
key: f.key,
|
|
33
|
+
visible: f.visible,
|
|
34
|
+
columnOpts: f.columnOpts
|
|
35
35
|
}));
|
|
36
|
-
|
|
36
|
+
l.setItem(
|
|
37
37
|
n,
|
|
38
|
-
JSON.stringify(
|
|
38
|
+
JSON.stringify(d)
|
|
39
39
|
);
|
|
40
40
|
},
|
|
41
41
|
{ deep: !0 }
|
|
42
42
|
), {
|
|
43
43
|
/** 当前列配置(响应式) */
|
|
44
|
-
columns:
|
|
44
|
+
columns: r,
|
|
45
45
|
/**
|
|
46
46
|
* 主动设置列配置
|
|
47
47
|
* 常用于:列设置弹窗 / 拖拽排序完成
|
|
48
48
|
*/
|
|
49
49
|
setColumns(s) {
|
|
50
|
-
|
|
50
|
+
r.value = te(
|
|
51
51
|
t,
|
|
52
52
|
s
|
|
53
|
-
), n &&
|
|
53
|
+
), n && l.setItem(
|
|
54
54
|
n,
|
|
55
55
|
JSON.stringify(s)
|
|
56
56
|
);
|
|
@@ -59,35 +59,35 @@ function xe(t, e) {
|
|
|
59
59
|
* 重置为默认列配置
|
|
60
60
|
*/
|
|
61
61
|
resetColumns() {
|
|
62
|
-
|
|
62
|
+
r.value = t, n && l.removeItem(n);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function Be(t, e = 10, n = []) {
|
|
67
|
-
const i = "*:*:*",
|
|
67
|
+
const i = "*:*:*", r = (c) => {
|
|
68
68
|
if (!c) return !0;
|
|
69
69
|
const g = Array.isArray(c) ? c : [c];
|
|
70
70
|
return n.some(
|
|
71
71
|
(b) => b === i || g.includes(b)
|
|
72
72
|
);
|
|
73
|
-
}, s = S(() => t.some((c) =>
|
|
73
|
+
}, s = S(() => t.some((c) => r(c.permission))), d = S(() => t.filter((g) => r(g.permission)).slice(0, e).reduce(
|
|
74
74
|
(g, b) => g + (b.width ?? 55),
|
|
75
75
|
0
|
|
76
|
-
)),
|
|
76
|
+
)), f = (c, g) => r(c.permission) && (c.visible ? c.visible(g) : !0), h = (c) => t.filter((b) => f(b, c)).slice(0, e).reduce(
|
|
77
77
|
(b, I) => b + (I.width ?? 55),
|
|
78
78
|
0
|
|
79
79
|
);
|
|
80
80
|
return {
|
|
81
81
|
hasAnyButton: s,
|
|
82
|
-
optWidth:
|
|
82
|
+
optWidth: d,
|
|
83
83
|
hasAnyVisibleButton: (c) => c != null && c.length ? c.some(
|
|
84
|
-
(g) => t.some((b) =>
|
|
84
|
+
(g) => t.some((b) => f(b, g))
|
|
85
85
|
) : !1,
|
|
86
86
|
getMaxOptWidth: (c) => c != null && c.length ? c.reduce(
|
|
87
87
|
(g, b) => Math.max(g, h(b)),
|
|
88
88
|
0
|
|
89
|
-
) :
|
|
90
|
-
getVisibleButtons: (c) => t.filter((g) =>
|
|
89
|
+
) : d.value,
|
|
90
|
+
getVisibleButtons: (c) => t.filter((g) => f(g, c)).slice(0, e)
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
class Se {
|
|
@@ -98,8 +98,8 @@ class Se {
|
|
|
98
98
|
this.renderers.has(e) && process.env.NODE_ENV === "development" && console.debug(`[SmartTable] Renderer "${e}" already registered, skipping.`), this.renderers.set(e, n);
|
|
99
99
|
}
|
|
100
100
|
registerMultiple(e) {
|
|
101
|
-
Object.entries(e).forEach(([n,
|
|
102
|
-
this.renderers.has(n) || this.renderers.set(n,
|
|
101
|
+
Object.entries(e).forEach(([n, l]) => {
|
|
102
|
+
this.renderers.has(n) || this.renderers.set(n, l);
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
get(e) {
|
|
@@ -123,16 +123,16 @@ function H() {
|
|
|
123
123
|
return D || (D = new Se()), D;
|
|
124
124
|
}
|
|
125
125
|
function U(t) {
|
|
126
|
-
return
|
|
127
|
-
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
126
|
+
return R({
|
|
127
|
+
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
128
128
|
setup(e) {
|
|
129
129
|
return () => m(t, e);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
function B(t) {
|
|
134
|
-
return
|
|
135
|
-
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
134
|
+
return R({
|
|
135
|
+
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
136
136
|
setup(e) {
|
|
137
137
|
return () => t(e);
|
|
138
138
|
}
|
|
@@ -174,115 +174,118 @@ function Ge(t, e) {
|
|
|
174
174
|
}
|
|
175
175
|
function v(t, e) {
|
|
176
176
|
if (!(!t || !e))
|
|
177
|
-
return e.split(".").reduce((n,
|
|
177
|
+
return e.split(".").reduce((n, l) => n == null ? void 0 : n[l], t);
|
|
178
178
|
}
|
|
179
179
|
function Y(t, e, n) {
|
|
180
180
|
if (!t || !e) return;
|
|
181
|
-
const
|
|
182
|
-
|
|
181
|
+
const l = e.split("."), i = l.pop(), r = l.reduce((s, d) => (s[d] || (s[d] = {}), s[d]), t);
|
|
182
|
+
r[i] = n;
|
|
183
183
|
}
|
|
184
|
-
const Ee = /* @__PURE__ */
|
|
184
|
+
const Ee = /* @__PURE__ */ R({
|
|
185
185
|
__name: "input",
|
|
186
186
|
props: {
|
|
187
187
|
row: {},
|
|
188
188
|
col: {},
|
|
189
|
+
index: {},
|
|
189
190
|
onCellBlur: { type: Function },
|
|
190
191
|
onCellEnter: { type: Function }
|
|
191
192
|
},
|
|
192
193
|
setup(t) {
|
|
193
194
|
const e = t, n = L(v(e.row, e.col.key));
|
|
194
|
-
|
|
195
|
-
Y(e.row, e.col.key,
|
|
195
|
+
F(n, (r) => {
|
|
196
|
+
Y(e.row, e.col.key, r);
|
|
196
197
|
});
|
|
197
|
-
const
|
|
198
|
-
var
|
|
199
|
-
return (
|
|
198
|
+
const l = () => {
|
|
199
|
+
var r;
|
|
200
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
200
201
|
}, i = () => {
|
|
201
|
-
var
|
|
202
|
-
return (
|
|
202
|
+
var r;
|
|
203
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
203
204
|
};
|
|
204
|
-
return (
|
|
205
|
-
const
|
|
206
|
-
return y(), w(
|
|
205
|
+
return (r, s) => {
|
|
206
|
+
const d = O("el-input");
|
|
207
|
+
return y(), w(d, x({
|
|
207
208
|
modelValue: n.value,
|
|
208
|
-
"onUpdate:modelValue": s[0] || (s[0] = (
|
|
209
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => n.value = f)
|
|
209
210
|
}, { placeholder: "", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
210
|
-
onBlur:
|
|
211
|
+
onBlur: l,
|
|
211
212
|
onKeyup: J(i, ["enter"])
|
|
212
213
|
}), null, 16, ["modelValue"]);
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
|
-
}), Te = /* @__PURE__ */
|
|
216
|
+
}), Te = /* @__PURE__ */ R({
|
|
216
217
|
__name: "inputNumber",
|
|
217
218
|
props: {
|
|
218
219
|
row: {},
|
|
219
220
|
col: {},
|
|
221
|
+
index: {},
|
|
220
222
|
onCellChange: { type: Function },
|
|
221
223
|
onCellBlur: { type: Function },
|
|
222
224
|
onCellEnter: { type: Function }
|
|
223
225
|
},
|
|
224
226
|
setup(t) {
|
|
225
227
|
const e = t, n = L(v(e.row, e.col.key));
|
|
226
|
-
|
|
228
|
+
F(n, (r) => {
|
|
227
229
|
var s;
|
|
228
|
-
Y(e.row, e.col.key,
|
|
230
|
+
Y(e.row, e.col.key, r), (s = e.onCellChange) == null || s.call(e, e.row, e.col);
|
|
229
231
|
});
|
|
230
|
-
const
|
|
231
|
-
var
|
|
232
|
-
return (
|
|
232
|
+
const l = () => {
|
|
233
|
+
var r;
|
|
234
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
233
235
|
}, i = () => {
|
|
234
|
-
var
|
|
235
|
-
return (
|
|
236
|
+
var r;
|
|
237
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
236
238
|
};
|
|
237
|
-
return (
|
|
238
|
-
const
|
|
239
|
-
return y(), w(
|
|
239
|
+
return (r, s) => {
|
|
240
|
+
const d = O("el-input-number");
|
|
241
|
+
return y(), w(d, x({
|
|
240
242
|
modelValue: n.value,
|
|
241
|
-
"onUpdate:modelValue": s[0] || (s[0] = (
|
|
243
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => n.value = f)
|
|
242
244
|
}, { min: 0, max: 99999, controls: !1, size: "small", ...t.col.renderProps }, {
|
|
243
|
-
onBlur:
|
|
245
|
+
onBlur: l,
|
|
244
246
|
onKeyup: J(i, ["enter"])
|
|
245
247
|
}), null, 16, ["modelValue"]);
|
|
246
248
|
};
|
|
247
249
|
}
|
|
248
|
-
}), Ve = /* @__PURE__ */
|
|
250
|
+
}), Ve = /* @__PURE__ */ R({
|
|
249
251
|
__name: "select",
|
|
250
252
|
props: {
|
|
251
253
|
row: {},
|
|
252
254
|
col: {},
|
|
255
|
+
index: {},
|
|
253
256
|
onCellChange: { type: Function },
|
|
254
257
|
onCellBlur: { type: Function },
|
|
255
258
|
onCellEnter: { type: Function }
|
|
256
259
|
},
|
|
257
260
|
setup(t) {
|
|
258
261
|
const e = t, n = L(v(e.row, e.col.key));
|
|
259
|
-
|
|
262
|
+
F(n, (s) => {
|
|
260
263
|
Y(e.row, e.col.key, s);
|
|
261
264
|
});
|
|
262
|
-
const
|
|
265
|
+
const l = () => {
|
|
263
266
|
var s;
|
|
264
267
|
return (s = e.onCellChange) == null ? void 0 : s.call(e, e.row, e.col);
|
|
265
268
|
}, i = () => {
|
|
266
269
|
var s;
|
|
267
270
|
return (s = e.onCellBlur) == null ? void 0 : s.call(e, e.row, e.col);
|
|
268
|
-
},
|
|
271
|
+
}, r = () => {
|
|
269
272
|
var s;
|
|
270
273
|
return (s = e.onCellEnter) == null ? void 0 : s.call(e, e.row, e.col);
|
|
271
274
|
};
|
|
272
|
-
return (s,
|
|
273
|
-
const
|
|
275
|
+
return (s, d) => {
|
|
276
|
+
const f = O("el-option"), h = O("el-select");
|
|
274
277
|
return y(), w(h, x({
|
|
275
278
|
modelValue: n.value,
|
|
276
|
-
"onUpdate:modelValue":
|
|
279
|
+
"onUpdate:modelValue": d[0] || (d[0] = (k) => n.value = k)
|
|
277
280
|
}, { placeholder: "请选择", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
278
|
-
onChange:
|
|
281
|
+
onChange: l,
|
|
279
282
|
onBlur: i,
|
|
280
|
-
onKeyup: J(
|
|
283
|
+
onKeyup: J(r, ["enter"])
|
|
281
284
|
}), {
|
|
282
285
|
default: V(() => {
|
|
283
286
|
var k;
|
|
284
287
|
return [
|
|
285
|
-
(y(!0), A(
|
|
288
|
+
(y(!0), A($, null, M(((k = t.col.renderProps) == null ? void 0 : k.options) || [], (E) => (y(), w(f, {
|
|
286
289
|
key: E.value,
|
|
287
290
|
label: E.label,
|
|
288
291
|
value: E.value
|
|
@@ -293,24 +296,24 @@ const Ee = /* @__PURE__ */ $({
|
|
|
293
296
|
}, 16, ["modelValue"]);
|
|
294
297
|
};
|
|
295
298
|
}
|
|
296
|
-
}), Ae = U(Ee), Me = U(Te), Oe = U(Ve),
|
|
299
|
+
}), Ae = U(Ee), Me = U(Te), Oe = U(Ve), $e = B((t) => {
|
|
297
300
|
const e = t.col.renderProps || {}, n = v(t.row, t.col.key);
|
|
298
301
|
return m(we, {
|
|
299
302
|
type: e.type || "primary",
|
|
300
303
|
...e,
|
|
301
304
|
onClick: () => {
|
|
302
|
-
var
|
|
303
|
-
return (
|
|
305
|
+
var l;
|
|
306
|
+
return (l = t.onClick) == null ? void 0 : l.call(t, t.row, t.col);
|
|
304
307
|
}
|
|
305
308
|
}, () => e.label || n);
|
|
306
|
-
}),
|
|
309
|
+
}), Fe = B((t) => {
|
|
307
310
|
const e = t.col.renderProps || {}, n = v(t.row, t.col.key);
|
|
308
311
|
return m("a", {
|
|
309
312
|
href: e.href || "#",
|
|
310
313
|
target: e.blank ? "_blank" : "_self",
|
|
311
314
|
style: e.style || "color:#409EFF;cursor:pointer;"
|
|
312
315
|
}, e.label || n);
|
|
313
|
-
}),
|
|
316
|
+
}), Re = B((t) => {
|
|
314
317
|
var n;
|
|
315
318
|
const e = v(t.row, t.col.key);
|
|
316
319
|
return m("div", {
|
|
@@ -319,7 +322,7 @@ const Ee = /* @__PURE__ */ $({
|
|
|
319
322
|
...((n = t.col) == null ? void 0 : n.renderProps) || {}
|
|
320
323
|
});
|
|
321
324
|
}), ze = B((t) => {
|
|
322
|
-
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps ?? {},
|
|
325
|
+
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps ?? {}, l = {
|
|
323
326
|
position: "absolute",
|
|
324
327
|
right: "-5px",
|
|
325
328
|
top: "50%",
|
|
@@ -351,7 +354,7 @@ const Ee = /* @__PURE__ */ $({
|
|
|
351
354
|
}, e),
|
|
352
355
|
e && m("span", {
|
|
353
356
|
class: "st_copy_btn",
|
|
354
|
-
style:
|
|
357
|
+
style: l,
|
|
355
358
|
title: n.copyTitle || "复制",
|
|
356
359
|
onClick: () => {
|
|
357
360
|
if (e)
|
|
@@ -363,10 +366,10 @@ const Ee = /* @__PURE__ */ $({
|
|
|
363
366
|
K.error(n.errorText ?? "复制失败");
|
|
364
367
|
});
|
|
365
368
|
else {
|
|
366
|
-
const
|
|
367
|
-
|
|
369
|
+
const r = document.createElement("textarea");
|
|
370
|
+
r.value = e, r.style.position = "fixed", r.style.opacity = "0", document.body.appendChild(r), r.select();
|
|
368
371
|
const s = document.execCommand("copy");
|
|
369
|
-
document.body.removeChild(
|
|
372
|
+
document.body.removeChild(r), s ? K.success(n.successText ?? "复制成功") : K.error(n.errorText ?? "复制失败");
|
|
370
373
|
}
|
|
371
374
|
} catch {
|
|
372
375
|
K.error(n.errorText ?? "复制失败");
|
|
@@ -379,10 +382,10 @@ const Ee = /* @__PURE__ */ $({
|
|
|
379
382
|
);
|
|
380
383
|
}), Ke = B((t) => {
|
|
381
384
|
var s;
|
|
382
|
-
const e = v(t.row, t.col.key) ?? "", n = ((s = t.col) == null ? void 0 : s.renderProps) || {}, i = e ? Array.isArray(e) ? e.filter((
|
|
385
|
+
const e = v(t.row, t.col.key) ?? "", n = ((s = t.col) == null ? void 0 : s.renderProps) || {}, i = e ? Array.isArray(e) ? e.filter((d) => d && typeof d == "string") : [e] : [];
|
|
383
386
|
if (i.length === 0)
|
|
384
387
|
return n.placeholder || "";
|
|
385
|
-
const
|
|
388
|
+
const r = {
|
|
386
389
|
width: n.width || "80px",
|
|
387
390
|
height: n.height || "80px",
|
|
388
391
|
marginRight: i.length > 1 ? "4px" : "0",
|
|
@@ -393,7 +396,7 @@ const Ee = /* @__PURE__ */ $({
|
|
|
393
396
|
previewSrcList: n.previewSrcList || i,
|
|
394
397
|
previewTeleported: !0,
|
|
395
398
|
fit: n.fit || "contain",
|
|
396
|
-
style:
|
|
399
|
+
style: r,
|
|
397
400
|
...n
|
|
398
401
|
}) : m(
|
|
399
402
|
"div",
|
|
@@ -407,7 +410,7 @@ const Ee = /* @__PURE__ */ $({
|
|
|
407
410
|
previewSrcList: n.previewSrcList || i,
|
|
408
411
|
previewTeleported: !0,
|
|
409
412
|
fit: n.fit || "contain",
|
|
410
|
-
style:
|
|
413
|
+
style: r,
|
|
411
414
|
...n
|
|
412
415
|
}),
|
|
413
416
|
i.length > 1 && m("span", {
|
|
@@ -418,26 +421,26 @@ const Ee = /* @__PURE__ */ $({
|
|
|
418
421
|
]
|
|
419
422
|
);
|
|
420
423
|
}), Le = B((t) => {
|
|
421
|
-
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {},
|
|
424
|
+
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {}, l = n.options ?? [], i = n.showValue ?? !1;
|
|
422
425
|
if (e == null || e === "") return "";
|
|
423
|
-
const
|
|
426
|
+
const r = Array.isArray(e) ? e.map(String) : [String(e)], s = l.filter((h) => r.includes(String(h.value))), d = r.filter((h) => !l.some((k) => String(k.value) === h)), f = s.map((h, k) => m(
|
|
424
427
|
Ce,
|
|
425
428
|
{ key: h.value, type: h.listClass, class: h.cssClass, disableTransitions: !0 },
|
|
426
429
|
{ default: () => h.label + " " }
|
|
427
430
|
));
|
|
428
|
-
return i &&
|
|
431
|
+
return i && d.length > 0 && f.push(m("span", {}, d.join(" "))), m("div", {}, f);
|
|
429
432
|
}), Ie = B((t) => {
|
|
430
|
-
var
|
|
431
|
-
const e = v(t.row, t.col.key) ?? "", n = ((
|
|
433
|
+
var l;
|
|
434
|
+
const e = v(t.row, t.col.key) ?? "", n = ((l = t.col.renderProps) == null ? void 0 : l.options) ?? {};
|
|
432
435
|
return e != null ? n[e] ?? "" : "";
|
|
433
436
|
});
|
|
434
437
|
function Ne(t) {
|
|
435
438
|
return typeof t.formatter == "function";
|
|
436
439
|
}
|
|
437
440
|
const We = B((t) => {
|
|
438
|
-
var
|
|
439
|
-
const { col: e, row: n } = t,
|
|
440
|
-
return Ne(e) ? (
|
|
441
|
+
var r;
|
|
442
|
+
const { col: e, row: n, index: l } = t, i = v(t.row, t.col.key) ?? "";
|
|
443
|
+
return Ne(e) ? (r = e.formatter) == null ? void 0 : r.call(e, i, n, l) : i ?? "";
|
|
441
444
|
}), Pe = B((t) => {
|
|
442
445
|
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {};
|
|
443
446
|
return e ? /^https?:\/\//.test(e) ? m(q, {
|
|
@@ -460,9 +463,9 @@ const We = B((t) => {
|
|
|
460
463
|
input: Ae,
|
|
461
464
|
"input-number": Me,
|
|
462
465
|
select: Oe,
|
|
463
|
-
button:
|
|
464
|
-
link:
|
|
465
|
-
html:
|
|
466
|
+
button: $e,
|
|
467
|
+
link: Fe,
|
|
468
|
+
html: Re,
|
|
466
469
|
copy: ze,
|
|
467
470
|
img: Ke,
|
|
468
471
|
dict: Le,
|
|
@@ -476,7 +479,7 @@ function De(t) {
|
|
|
476
479
|
function Qe() {
|
|
477
480
|
return re;
|
|
478
481
|
}
|
|
479
|
-
const je = ["title"], Xe = /* @__PURE__ */
|
|
482
|
+
const je = ["title"], Xe = /* @__PURE__ */ R({
|
|
480
483
|
__name: "index",
|
|
481
484
|
props: {
|
|
482
485
|
data: { type: Array, default: () => [] },
|
|
@@ -498,33 +501,33 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
498
501
|
"cell-click"
|
|
499
502
|
],
|
|
500
503
|
setup(t, { expose: e, emit: n }) {
|
|
501
|
-
const
|
|
502
|
-
cacheKey:
|
|
504
|
+
const l = t, i = n, { columns: r } = xe(l.columns, {
|
|
505
|
+
cacheKey: l.cacheKey ?? ""
|
|
503
506
|
});
|
|
504
|
-
|
|
505
|
-
|
|
507
|
+
F(
|
|
508
|
+
r,
|
|
506
509
|
(o) => i("update:columns", o),
|
|
507
510
|
{ deep: !0, immediate: !0 }
|
|
508
|
-
),
|
|
509
|
-
() =>
|
|
511
|
+
), F(
|
|
512
|
+
() => l.data,
|
|
510
513
|
(o) => {
|
|
511
|
-
o &&
|
|
514
|
+
o && r.value.forEach((a) => {
|
|
512
515
|
a.type === "operation" && (a.__rows = o);
|
|
513
516
|
});
|
|
514
517
|
},
|
|
515
518
|
{ deep: !0, immediate: !0 }
|
|
516
519
|
);
|
|
517
520
|
const s = S(
|
|
518
|
-
() =>
|
|
519
|
-
), f = S(
|
|
520
|
-
() => l.value.filter((o) => o.type === "index")
|
|
521
|
+
() => r.value.filter((o) => o.type === "selection")
|
|
521
522
|
), d = S(
|
|
522
|
-
() =>
|
|
523
|
+
() => r.value.filter((o) => o.type === "index")
|
|
524
|
+
), f = S(
|
|
525
|
+
() => r.value.filter((o) => o.type === "operation")
|
|
523
526
|
), h = S(
|
|
524
|
-
() =>
|
|
527
|
+
() => r.value.filter((o) => !(o.type === "selection" || o.type === "index" || o.type === "operation" || o.visible === !1))
|
|
525
528
|
), k = (o) => {
|
|
526
529
|
var _, z;
|
|
527
|
-
const a = (_ =
|
|
530
|
+
const a = (_ = l.pagination) == null ? void 0 : _.page, p = (z = l.pagination) == null ? void 0 : z.size;
|
|
528
531
|
return a && p ? (a - 1) * p + o + 1 : o + 1;
|
|
529
532
|
};
|
|
530
533
|
De(H());
|
|
@@ -536,11 +539,11 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
536
539
|
}), a;
|
|
537
540
|
}), G = S(() => {
|
|
538
541
|
const o = /* @__PURE__ */ new Map();
|
|
539
|
-
return
|
|
542
|
+
return f.value.forEach((a) => {
|
|
540
543
|
const p = Be(
|
|
541
544
|
a.buttons || [],
|
|
542
545
|
a.maxbtn ?? 10,
|
|
543
|
-
|
|
546
|
+
l.permissions || []
|
|
544
547
|
);
|
|
545
548
|
o.set(a.key, p);
|
|
546
549
|
}), o;
|
|
@@ -550,7 +553,7 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
550
553
|
}, b = (o, a) => {
|
|
551
554
|
const p = c(o);
|
|
552
555
|
return p ? (o.buttons || []).length ? ((o.__rows || []).length, p.getVisibleButtons(a)) : [] : [];
|
|
553
|
-
}, I = () =>
|
|
556
|
+
}, I = () => f.value.filter((o) => {
|
|
554
557
|
const a = c(o);
|
|
555
558
|
return !a || !(o.buttons || []).length ? !1 : (o.__rows || []).length ? a.hasAnyVisibleButton(o.__rows || []) : a.hasAnyButton.value;
|
|
556
559
|
}), oe = (o, a) => {
|
|
@@ -565,7 +568,7 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
565
568
|
return e({
|
|
566
569
|
tableRef: Q
|
|
567
570
|
}), (o, a) => {
|
|
568
|
-
const p = O("el-table-column"), _ = O("el-button"), z = O("el-table"), ue =
|
|
571
|
+
const p = O("el-table-column"), _ = O("el-button"), z = O("el-table"), ue = fe("loading");
|
|
569
572
|
return me((y(), w(z, x({
|
|
570
573
|
ref_key: "tableRef",
|
|
571
574
|
ref: Q
|
|
@@ -575,11 +578,11 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
575
578
|
class: "smart_table"
|
|
576
579
|
}), ye({
|
|
577
580
|
default: V(() => [
|
|
578
|
-
(y(!0), A(
|
|
581
|
+
(y(!0), A($, null, M(s.value, (u) => (y(), w(p, x({
|
|
579
582
|
key: "selection",
|
|
580
583
|
type: "selection"
|
|
581
584
|
}, { ref_for: !0 }, u.columnProps), null, 16))), 128)),
|
|
582
|
-
(y(!0), A(
|
|
585
|
+
(y(!0), A($, null, M(d.value, (u) => (y(), w(p, x({
|
|
583
586
|
key: "index",
|
|
584
587
|
type: "index",
|
|
585
588
|
label: u.label || "#",
|
|
@@ -590,7 +593,7 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
590
593
|
]),
|
|
591
594
|
_: 1
|
|
592
595
|
}, 16, ["label"]))), 128)),
|
|
593
|
-
(y(!0), A(
|
|
596
|
+
(y(!0), A($, null, M(I(), (u) => (y(), w(p, x({
|
|
594
597
|
key: u.key,
|
|
595
598
|
label: u.label || "操作",
|
|
596
599
|
align: "center"
|
|
@@ -599,7 +602,7 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
599
602
|
width: g(u)
|
|
600
603
|
}), {
|
|
601
604
|
default: V(({ row: C }) => [
|
|
602
|
-
(y(!0), A(
|
|
605
|
+
(y(!0), A($, null, M(b(u, C), (T) => (y(), w(_, {
|
|
603
606
|
key: T.label,
|
|
604
607
|
type: T.type || "primary",
|
|
605
608
|
link: "",
|
|
@@ -613,7 +616,7 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
613
616
|
]),
|
|
614
617
|
_: 2
|
|
615
618
|
}, 1040, ["label"]))), 128)),
|
|
616
|
-
(y(!0), A(
|
|
619
|
+
(y(!0), A($, null, M(h.value, (u) => (y(), w(p, x({
|
|
617
620
|
key: u.key,
|
|
618
621
|
label: u.label,
|
|
619
622
|
align: "center"
|
|
@@ -628,11 +631,12 @@ const je = ["title"], Xe = /* @__PURE__ */ $({
|
|
|
628
631
|
key: 1,
|
|
629
632
|
row: C.row,
|
|
630
633
|
col: u,
|
|
634
|
+
index: C.$index,
|
|
631
635
|
onCellChange: oe,
|
|
632
636
|
onCellBlur: ie,
|
|
633
637
|
onCellEnter: se,
|
|
634
638
|
onClick: ae
|
|
635
|
-
}, null, 40, ["row", "col"])) : (y(), A("span", {
|
|
639
|
+
}, null, 40, ["row", "col", "index"])) : (y(), A("span", {
|
|
636
640
|
key: 2,
|
|
637
641
|
style: he(((T = u.renderProps) == null ? void 0 : T.style) || ""),
|
|
638
642
|
class: ge(((N = u.renderProps) == null ? void 0 : N.class) || ""),
|
|
@@ -697,10 +701,10 @@ class qe {
|
|
|
697
701
|
* 深度合并配置
|
|
698
702
|
*/
|
|
699
703
|
mergeConfig(e, n) {
|
|
700
|
-
const
|
|
704
|
+
const l = { ...e };
|
|
701
705
|
for (const i in n)
|
|
702
|
-
n[i] && typeof n[i] == "object" && !Array.isArray(n[i]) ?
|
|
703
|
-
return
|
|
706
|
+
n[i] && typeof n[i] == "object" && !Array.isArray(n[i]) ? l[i] = this.mergeConfig(e[i] || {}, n[i]) : l[i] = n[i];
|
|
707
|
+
return l;
|
|
704
708
|
}
|
|
705
709
|
}
|
|
706
710
|
let j = null;
|