vue3-smart-table 0.0.4 → 1.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/README.md +1220 -245
- package/dist/index.css +1 -0
- package/dist/vue3-smart-table.cjs.js +2 -21
- package/dist/vue3-smart-table.cjs.js.map +1 -0
- package/dist/vue3-smart-table.es.js +528 -381
- package/dist/vue3-smart-table.es.js.map +1 -0
- package/dist/vue3-smart-table.umd.js +3 -0
- package/dist/vue3-smart-table.umd.js.map +1 -0
- package/package.json +19 -6
- package/src/assets/vue.svg +1 -0
- package/src/components/SmartTable/column/index.vue +175 -0
- package/src/components/SmartTable/config.ts +131 -0
- package/src/components/SmartTable/hooks/useOperationColumn.ts +136 -0
- package/src/components/SmartTable/hooks/useTableColumns.ts +143 -0
- package/src/components/SmartTable/index.vue +91 -0
- package/src/components/SmartTable/renderer.ts +173 -0
- package/src/components/SmartTable/renderers/index.ts +307 -0
- package/src/components/SmartTable/renderers/input.vue +31 -0
- package/src/components/SmartTable/renderers/inputNumber.vue +33 -0
- package/src/components/SmartTable/renderers/select.vue +41 -0
- package/src/components/SmartTable/styles/theme.css +206 -0
- package/src/components/SmartTable/types.ts +237 -0
- package/src/components/SmartTable/utils/path.ts +29 -0
- package/src/index.ts +38 -0
- package/src/types/enhanced.ts +51 -0
- package/dist/vue3-smart-table.css +0 -1
|
@@ -1,15 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var se = (t, e, n) => e in t ? ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var D = (t, e, n) => se(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { defineComponent as M, h as f, ref as R, watch as z, resolveComponent as O, createBlock as _, openBlock as h, mergeProps as B, withKeys as U, withCtx as V, createElementBlock as I, Fragment as H, renderList as K, computed as $, toRefs as ae, createCommentVNode as ce, unref as a, createTextVNode as Z, toDisplayString as W, renderSlot as ne, normalizeProps as ue, resolveDynamicComponent as de, normalizeClass as me, normalizeStyle as fe, resolveDirective as ye, withDirectives as pe, createSlots as ge } from "vue";
|
|
5
|
+
import { ElImage as q, ElTag as he, ElMessage as F, ElButton as Ce } from "element-plus";
|
|
6
|
+
import { CopyDocument as ve, DocumentCopy as be } from "@element-plus/icons-vue";
|
|
7
|
+
class ke {
|
|
8
|
+
constructor() {
|
|
9
|
+
D(this, "renderers", /* @__PURE__ */ new Map());
|
|
10
|
+
}
|
|
11
|
+
register(e, n) {
|
|
12
|
+
this.renderers.has(e) && process.env.NODE_ENV === "development" && console.debug(`[SmartTable] Renderer "${e}" already registered, skipping.`), this.renderers.set(e, n);
|
|
13
|
+
}
|
|
14
|
+
registerMultiple(e) {
|
|
15
|
+
Object.entries(e).forEach(([n, o]) => {
|
|
16
|
+
this.renderers.has(n) || this.renderers.set(n, o);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get(e) {
|
|
20
|
+
return this.renderers.get(e);
|
|
21
|
+
}
|
|
22
|
+
has(e) {
|
|
23
|
+
return this.renderers.has(e);
|
|
24
|
+
}
|
|
25
|
+
unregister(e) {
|
|
26
|
+
return this.renderers.delete(e);
|
|
27
|
+
}
|
|
28
|
+
clear() {
|
|
29
|
+
this.renderers.clear();
|
|
30
|
+
}
|
|
31
|
+
names() {
|
|
32
|
+
return Array.from(this.renderers.keys());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
let P = null;
|
|
36
|
+
function J() {
|
|
37
|
+
return P || (P = new ke()), P;
|
|
38
|
+
}
|
|
39
|
+
function Y(t) {
|
|
40
|
+
return M({
|
|
41
|
+
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
42
|
+
setup(e) {
|
|
43
|
+
return () => f(t, e);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function E(t) {
|
|
48
|
+
return M({
|
|
49
|
+
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
50
|
+
setup(e) {
|
|
51
|
+
return () => t(e);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function Ge(t, e) {
|
|
56
|
+
if (process.env.NODE_ENV !== "production" && e)
|
|
57
|
+
switch (t) {
|
|
58
|
+
case "dict":
|
|
59
|
+
(!e.options || !Array.isArray(e.options)) && console.warn(
|
|
60
|
+
"[SmartTable] 'dict' renderer requires 'options' array, received:",
|
|
61
|
+
e.options
|
|
62
|
+
);
|
|
63
|
+
break;
|
|
64
|
+
case "select":
|
|
65
|
+
!e.options || !Array.isArray(e.options) ? console.warn(
|
|
66
|
+
"[SmartTable] 'select' renderer requires 'options' array, received:",
|
|
67
|
+
e.options
|
|
68
|
+
) : e.options.length === 0 && console.warn("[SmartTable] 'select' renderer 'options' array is empty");
|
|
69
|
+
break;
|
|
70
|
+
case "map":
|
|
71
|
+
(!e.options || typeof e.options != "object") && console.warn(
|
|
72
|
+
"[SmartTable] 'map' renderer requires 'options' object, received:",
|
|
73
|
+
e.options
|
|
74
|
+
);
|
|
75
|
+
break;
|
|
76
|
+
case "link":
|
|
77
|
+
(!e.href || typeof e.href != "string") && console.warn(
|
|
78
|
+
"[SmartTable] 'link' renderer requires 'href' string, received:",
|
|
79
|
+
e.href
|
|
80
|
+
);
|
|
81
|
+
break;
|
|
82
|
+
case "input-number":
|
|
83
|
+
e.min !== void 0 && e.max !== void 0 && e.min > e.max && console.warn(
|
|
84
|
+
`[SmartTable] 'input-number' renderer: min (${e.min}) should not be greater than max (${e.max})`
|
|
85
|
+
);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function b(t, e) {
|
|
4
90
|
if (!(!t || !e))
|
|
5
|
-
return e.split(".").reduce((n,
|
|
91
|
+
return e.split(".").reduce((n, o) => n == null ? void 0 : n[o], t);
|
|
6
92
|
}
|
|
7
|
-
function
|
|
93
|
+
function G(t, e, n) {
|
|
8
94
|
if (!t || !e) return;
|
|
9
|
-
const
|
|
10
|
-
l
|
|
95
|
+
const o = e.split("."), l = o.pop(), r = o.reduce((i, c) => (i[c] || (i[c] = {}), i[c]), t);
|
|
96
|
+
r[l] = n;
|
|
11
97
|
}
|
|
12
|
-
const
|
|
98
|
+
const we = /* @__PURE__ */ M({
|
|
13
99
|
__name: "input",
|
|
14
100
|
props: {
|
|
15
101
|
row: {},
|
|
@@ -18,29 +104,29 @@ const ce = /* @__PURE__ */ O({
|
|
|
18
104
|
onCellEnter: { type: Function }
|
|
19
105
|
},
|
|
20
106
|
setup(t) {
|
|
21
|
-
const e = t, n =
|
|
22
|
-
|
|
23
|
-
|
|
107
|
+
const e = t, n = R(b(e.row, e.col.key));
|
|
108
|
+
z(n, (r) => {
|
|
109
|
+
G(e.row, e.col.key, r);
|
|
24
110
|
});
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
return (
|
|
28
|
-
},
|
|
29
|
-
var
|
|
30
|
-
return (
|
|
111
|
+
const o = () => {
|
|
112
|
+
var r;
|
|
113
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
114
|
+
}, l = () => {
|
|
115
|
+
var r;
|
|
116
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
31
117
|
};
|
|
32
|
-
return (
|
|
33
|
-
const c =
|
|
34
|
-
return
|
|
118
|
+
return (r, i) => {
|
|
119
|
+
const c = O("el-input");
|
|
120
|
+
return h(), _(c, B({
|
|
35
121
|
modelValue: n.value,
|
|
36
122
|
"onUpdate:modelValue": i[0] || (i[0] = (d) => n.value = d)
|
|
37
123
|
}, { placeholder: "", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
38
|
-
onBlur:
|
|
39
|
-
onKeyup:
|
|
124
|
+
onBlur: o,
|
|
125
|
+
onKeyup: U(l, ["enter"])
|
|
40
126
|
}), null, 16, ["modelValue"]);
|
|
41
127
|
};
|
|
42
128
|
}
|
|
43
|
-
}),
|
|
129
|
+
}), _e = /* @__PURE__ */ M({
|
|
44
130
|
__name: "inputNumber",
|
|
45
131
|
props: {
|
|
46
132
|
row: {},
|
|
@@ -50,30 +136,30 @@ const ce = /* @__PURE__ */ O({
|
|
|
50
136
|
onCellEnter: { type: Function }
|
|
51
137
|
},
|
|
52
138
|
setup(t) {
|
|
53
|
-
const e = t, n =
|
|
54
|
-
|
|
139
|
+
const e = t, n = R(b(e.row, e.col.key));
|
|
140
|
+
z(n, (r) => {
|
|
55
141
|
var i;
|
|
56
|
-
|
|
142
|
+
G(e.row, e.col.key, r), (i = e.onCellChange) == null || i.call(e, e.row, e.col);
|
|
57
143
|
});
|
|
58
|
-
const
|
|
59
|
-
var
|
|
60
|
-
return (
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
return (
|
|
144
|
+
const o = () => {
|
|
145
|
+
var r;
|
|
146
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
147
|
+
}, l = () => {
|
|
148
|
+
var r;
|
|
149
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
64
150
|
};
|
|
65
|
-
return (
|
|
66
|
-
const c =
|
|
67
|
-
return
|
|
151
|
+
return (r, i) => {
|
|
152
|
+
const c = O("el-input-number");
|
|
153
|
+
return h(), _(c, B({
|
|
68
154
|
modelValue: n.value,
|
|
69
155
|
"onUpdate:modelValue": i[0] || (i[0] = (d) => n.value = d)
|
|
70
156
|
}, { min: 0, max: 99999, controls: !1, size: "small", ...t.col.renderProps }, {
|
|
71
|
-
onBlur:
|
|
72
|
-
onKeyup:
|
|
157
|
+
onBlur: o,
|
|
158
|
+
onKeyup: U(l, ["enter"])
|
|
73
159
|
}), null, 16, ["modelValue"]);
|
|
74
160
|
};
|
|
75
161
|
}
|
|
76
|
-
}),
|
|
162
|
+
}), xe = /* @__PURE__ */ M({
|
|
77
163
|
__name: "select",
|
|
78
164
|
props: {
|
|
79
165
|
row: {},
|
|
@@ -83,37 +169,37 @@ const ce = /* @__PURE__ */ O({
|
|
|
83
169
|
onCellEnter: { type: Function }
|
|
84
170
|
},
|
|
85
171
|
setup(t) {
|
|
86
|
-
const e = t, n =
|
|
87
|
-
|
|
88
|
-
|
|
172
|
+
const e = t, n = R(b(e.row, e.col.key));
|
|
173
|
+
z(n, (i) => {
|
|
174
|
+
G(e.row, e.col.key, i);
|
|
89
175
|
});
|
|
90
|
-
const
|
|
176
|
+
const o = () => {
|
|
91
177
|
var i;
|
|
92
178
|
return (i = e.onCellChange) == null ? void 0 : i.call(e, e.row, e.col);
|
|
93
|
-
},
|
|
179
|
+
}, l = () => {
|
|
94
180
|
var i;
|
|
95
181
|
return (i = e.onCellBlur) == null ? void 0 : i.call(e, e.row, e.col);
|
|
96
|
-
},
|
|
182
|
+
}, r = () => {
|
|
97
183
|
var i;
|
|
98
184
|
return (i = e.onCellEnter) == null ? void 0 : i.call(e, e.row, e.col);
|
|
99
185
|
};
|
|
100
186
|
return (i, c) => {
|
|
101
|
-
const d =
|
|
102
|
-
return
|
|
187
|
+
const d = O("el-option"), g = O("el-select");
|
|
188
|
+
return h(), _(g, B({
|
|
103
189
|
modelValue: n.value,
|
|
104
|
-
"onUpdate:modelValue": c[0] || (c[0] = (
|
|
190
|
+
"onUpdate:modelValue": c[0] || (c[0] = (v) => n.value = v)
|
|
105
191
|
}, { placeholder: "请选择", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
106
|
-
onChange:
|
|
107
|
-
onBlur:
|
|
108
|
-
onKeyup:
|
|
192
|
+
onChange: o,
|
|
193
|
+
onBlur: l,
|
|
194
|
+
onKeyup: U(r, ["enter"])
|
|
109
195
|
}), {
|
|
110
|
-
default:
|
|
111
|
-
var
|
|
196
|
+
default: V(() => {
|
|
197
|
+
var v;
|
|
112
198
|
return [
|
|
113
|
-
(
|
|
114
|
-
key:
|
|
115
|
-
label:
|
|
116
|
-
value:
|
|
199
|
+
(h(!0), I(H, null, K(((v = t.col.renderProps) == null ? void 0 : v.options) || [], (m) => (h(), _(d, {
|
|
200
|
+
key: m.value,
|
|
201
|
+
label: m.label,
|
|
202
|
+
value: m.value
|
|
117
203
|
}, null, 8, ["label", "value"]))), 128))
|
|
118
204
|
];
|
|
119
205
|
}),
|
|
@@ -121,220 +207,206 @@ const ce = /* @__PURE__ */ O({
|
|
|
121
207
|
}, 16, ["modelValue"]);
|
|
122
208
|
};
|
|
123
209
|
}
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
innerHTML: e ?? "",
|
|
167
|
-
...((n = t.col) == null ? void 0 : n.renderProps) || {}
|
|
168
|
-
});
|
|
210
|
+
}), Be = Y(we), Ee = Y(_e), Se = Y(xe), Ae = E((t) => {
|
|
211
|
+
const e = t.col.renderProps || {}, n = b(t.row, t.col.key);
|
|
212
|
+
return f(Ce, {
|
|
213
|
+
type: e.type || "primary",
|
|
214
|
+
...e,
|
|
215
|
+
onClick: () => {
|
|
216
|
+
var o;
|
|
217
|
+
return (o = t.onClick) == null ? void 0 : o.call(t, t.row, t.col);
|
|
218
|
+
}
|
|
219
|
+
}, () => e.label || n);
|
|
220
|
+
}), Te = E((t) => {
|
|
221
|
+
const e = t.col.renderProps || {}, n = b(t.row, t.col.key);
|
|
222
|
+
return f("a", {
|
|
223
|
+
href: e.href || "#",
|
|
224
|
+
target: e.blank ? "_blank" : "_self",
|
|
225
|
+
style: e.style || "color:#409EFF;cursor:pointer;"
|
|
226
|
+
}, e.label || n);
|
|
227
|
+
}), Ve = E((t) => {
|
|
228
|
+
var n;
|
|
229
|
+
const e = b(t.row, t.col.key);
|
|
230
|
+
return f("div", {
|
|
231
|
+
class: "line-clamp-2",
|
|
232
|
+
innerHTML: e ?? "",
|
|
233
|
+
...((n = t.col) == null ? void 0 : n.renderProps) || {}
|
|
234
|
+
});
|
|
235
|
+
}), Oe = E((t) => {
|
|
236
|
+
const e = b(t.row, t.col.key) ?? "", n = t.col.renderProps ?? {}, o = {
|
|
237
|
+
position: "absolute",
|
|
238
|
+
right: "-5px",
|
|
239
|
+
top: "50%",
|
|
240
|
+
transform: "translateY(-50%)",
|
|
241
|
+
cursor: "pointer",
|
|
242
|
+
display: "none",
|
|
243
|
+
"font-size": "12px",
|
|
244
|
+
color: n.iconColor || "#409EFF",
|
|
245
|
+
"user-select": "none"
|
|
246
|
+
};
|
|
247
|
+
return f(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
class: "st_copy_wrapper",
|
|
251
|
+
style: "width: 100%; position: relative; display: inline-block;"
|
|
169
252
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
display: none;
|
|
194
|
-
font-size: 12px;
|
|
195
|
-
color: #409EFF;
|
|
196
|
-
user-select: none;
|
|
197
|
-
`,
|
|
198
|
-
onClick: () => {
|
|
199
|
-
if (e)
|
|
200
|
-
try {
|
|
201
|
-
if (navigator.clipboard && navigator.clipboard.writeText)
|
|
202
|
-
navigator.clipboard.writeText(e).then(() => {
|
|
203
|
-
$.success("复制成功");
|
|
204
|
-
}).catch(() => {
|
|
205
|
-
$.error("复制失败");
|
|
206
|
-
});
|
|
207
|
-
else {
|
|
208
|
-
const n = document.createElement("textarea");
|
|
209
|
-
n.value = e, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.select();
|
|
210
|
-
const r = document.execCommand("copy");
|
|
211
|
-
document.body.removeChild(n), r ? $.success("复制成功") : $.error("复制失败");
|
|
212
|
-
}
|
|
213
|
-
} catch {
|
|
214
|
-
$.error("复制失败");
|
|
215
|
-
}
|
|
253
|
+
[
|
|
254
|
+
f("span", {
|
|
255
|
+
class: "st_copy_text line-clamp-1",
|
|
256
|
+
style: "padding-right: 10px; display: block;"
|
|
257
|
+
}, e),
|
|
258
|
+
e && f("span", {
|
|
259
|
+
class: "st_copy_btn",
|
|
260
|
+
style: o,
|
|
261
|
+
title: n.copyTitle || "复制",
|
|
262
|
+
onClick: () => {
|
|
263
|
+
if (e)
|
|
264
|
+
try {
|
|
265
|
+
if (navigator.clipboard && navigator.clipboard.writeText)
|
|
266
|
+
navigator.clipboard.writeText(e).then(() => {
|
|
267
|
+
F.success(n.successText ?? "复制成功");
|
|
268
|
+
}).catch(() => {
|
|
269
|
+
F.error(n.errorText ?? "复制失败");
|
|
270
|
+
});
|
|
271
|
+
else {
|
|
272
|
+
const l = document.createElement("textarea");
|
|
273
|
+
l.value = e, l.style.position = "fixed", l.style.opacity = "0", document.body.appendChild(l), l.select();
|
|
274
|
+
const r = document.execCommand("copy");
|
|
275
|
+
document.body.removeChild(l), r ? F.success(n.successText ?? "复制成功") : F.error(n.errorText ?? "复制失败");
|
|
216
276
|
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
277
|
+
} catch {
|
|
278
|
+
F.error(n.errorText ?? "复制失败");
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, [f(be, {
|
|
282
|
+
style: "width: 1em; height: 1em;"
|
|
283
|
+
})])
|
|
284
|
+
].filter(Boolean)
|
|
285
|
+
);
|
|
286
|
+
}), Me = E((t) => {
|
|
287
|
+
var i;
|
|
288
|
+
const e = b(t.row, t.col.key) ?? "", n = ((i = t.col) == null ? void 0 : i.renderProps) || {}, l = e ? Array.isArray(e) ? e.filter((c) => c && typeof c == "string") : [e] : [];
|
|
289
|
+
if (l.length === 0)
|
|
290
|
+
return n.placeholder || "";
|
|
291
|
+
const r = {
|
|
292
|
+
width: n.width || "80px",
|
|
293
|
+
height: n.height || "80px",
|
|
294
|
+
marginRight: l.length > 1 ? "4px" : "0",
|
|
295
|
+
...n.style || {}
|
|
296
|
+
};
|
|
297
|
+
return l.length === 1 ? f(q, {
|
|
298
|
+
src: l[0],
|
|
299
|
+
previewSrcList: n.previewSrcList || l,
|
|
300
|
+
fit: n.fit || "contain",
|
|
301
|
+
style: r,
|
|
302
|
+
...n
|
|
303
|
+
}) : f(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
class: "st_img_wrapper",
|
|
307
|
+
style: "display: flex; align-items: center; position: relative"
|
|
223
308
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return n.placeholder || "";
|
|
229
|
-
const l = {
|
|
230
|
-
width: n.width || "80px",
|
|
231
|
-
height: n.height || "80px",
|
|
232
|
-
marginRight: o.length > 1 ? "4px" : "0",
|
|
233
|
-
...n.style || {}
|
|
234
|
-
};
|
|
235
|
-
return o.length === 1 ? g(D, {
|
|
236
|
-
src: o[0],
|
|
237
|
-
previewSrcList: n.previewSrcList || o,
|
|
309
|
+
[
|
|
310
|
+
f(q, {
|
|
311
|
+
src: l[0],
|
|
312
|
+
previewSrcList: n.previewSrcList || l,
|
|
238
313
|
fit: n.fit || "contain",
|
|
239
|
-
style:
|
|
240
|
-
...n
|
|
241
|
-
}) : (console.log(n.previewSrcList), g("div", {
|
|
242
|
-
style: "display: flex; align-items: center; position: relative"
|
|
243
|
-
}, [
|
|
244
|
-
// 显示第一张图片,点击可预览所有
|
|
245
|
-
g(D, {
|
|
246
|
-
src: o[0],
|
|
247
|
-
previewSrcList: n.previewSrcList || o,
|
|
248
|
-
fit: n.fit || "contain",
|
|
249
|
-
style: l,
|
|
250
|
-
...n
|
|
251
|
-
}),
|
|
252
|
-
// 如果图片数量大于1,显示剩余图片数量
|
|
253
|
-
o.length > 1 && g("span", {
|
|
254
|
-
style: `
|
|
255
|
-
margin-left: 8px;
|
|
256
|
-
font-size: 12px;
|
|
257
|
-
color: #666;
|
|
258
|
-
background: #f0f0f0;
|
|
259
|
-
padding: 2px 6px;
|
|
260
|
-
border-radius: 2px;
|
|
261
|
-
position: absolute;
|
|
262
|
-
top: 0;
|
|
263
|
-
right: 0;
|
|
264
|
-
`,
|
|
265
|
-
title: `共 ${o.length} 张图片`
|
|
266
|
-
}, `+${o.length - 1}`)
|
|
267
|
-
]));
|
|
268
|
-
},
|
|
269
|
-
dict: (t) => {
|
|
270
|
-
const e = C(t.row, t.col.key) ?? "", n = t.col.renderProps || {}, r = n.options ?? [], o = n.showValue ?? !1;
|
|
271
|
-
if (e == null || e === "") return "";
|
|
272
|
-
const l = Array.isArray(e) ? e.map(String) : [String(e)], i = r.filter((y) => l.includes(String(y.value))), c = l.filter((y) => !r.some((h) => String(h.value) === y)), d = i.map((y, h) => g(
|
|
273
|
-
se,
|
|
274
|
-
{ key: y.value, type: y.listClass, class: y.cssClass, disableTransitions: !0 },
|
|
275
|
-
{ default: () => y.label + " " }
|
|
276
|
-
));
|
|
277
|
-
return o && c.length > 0 && d.push(g("span", {}, c.join(" "))), g("div", {}, d);
|
|
278
|
-
},
|
|
279
|
-
map: (t) => {
|
|
280
|
-
var r;
|
|
281
|
-
const e = C(t.row, t.col.key) ?? "", n = ((r = t.col.renderProps) == null ? void 0 : r.options) ?? {};
|
|
282
|
-
return e != null ? n[e] ?? "" : "";
|
|
283
|
-
},
|
|
284
|
-
formatter: (t) => {
|
|
285
|
-
var o;
|
|
286
|
-
const { col: e, row: n } = t, r = C(t.row, t.col.key) ?? "";
|
|
287
|
-
return ye(e) ? (o = e.formatter) == null ? void 0 : o.call(e, r, n) : r ?? "";
|
|
288
|
-
},
|
|
289
|
-
icon: (t) => {
|
|
290
|
-
const e = C(t.row, t.col.key) ?? "", n = t.col.renderProps || {};
|
|
291
|
-
return e ? /^https?:\/\//.test(e) ? g(D, {
|
|
292
|
-
src: e,
|
|
293
|
-
previewSrcList: [e],
|
|
294
|
-
fit: "contain",
|
|
295
|
-
style: "width:40px;height:40px",
|
|
314
|
+
style: r,
|
|
296
315
|
...n
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
316
|
+
}),
|
|
317
|
+
l.length > 1 && f("span", {
|
|
318
|
+
class: "st_img_total",
|
|
319
|
+
style: "position: absolute; top: 0; right: 0; ",
|
|
320
|
+
title: `${l.length}`
|
|
321
|
+
}, [f(ve, { style: "width: 1em; height: 1em; " })])
|
|
322
|
+
]
|
|
323
|
+
);
|
|
324
|
+
}), Fe = E((t) => {
|
|
325
|
+
const e = b(t.row, t.col.key) ?? "", n = t.col.renderProps || {}, o = n.options ?? [], l = n.showValue ?? !1;
|
|
326
|
+
if (e == null || e === "") return "";
|
|
327
|
+
const r = Array.isArray(e) ? e.map(String) : [String(e)], i = o.filter((g) => r.includes(String(g.value))), c = r.filter((g) => !o.some((v) => String(v.value) === g)), d = i.map((g, v) => f(
|
|
328
|
+
he,
|
|
329
|
+
{ key: g.value, type: g.listClass, class: g.cssClass, disableTransitions: !0 },
|
|
330
|
+
{ default: () => g.label + " " }
|
|
331
|
+
));
|
|
332
|
+
return l && c.length > 0 && d.push(f("span", {}, c.join(" "))), f("div", {}, d);
|
|
333
|
+
}), $e = E((t) => {
|
|
334
|
+
var o;
|
|
335
|
+
const e = b(t.row, t.col.key) ?? "", n = ((o = t.col.renderProps) == null ? void 0 : o.options) ?? {};
|
|
336
|
+
return e != null ? n[e] ?? "" : "";
|
|
337
|
+
});
|
|
338
|
+
function Re(t) {
|
|
339
|
+
return typeof t.formatter == "function";
|
|
309
340
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
341
|
+
const ze = E((t) => {
|
|
342
|
+
var l;
|
|
343
|
+
const { col: e, row: n } = t, o = b(t.row, t.col.key) ?? "";
|
|
344
|
+
return Re(e) ? (l = e.formatter) == null ? void 0 : l.call(e, o, n) : o ?? "";
|
|
345
|
+
}), Ie = E((t) => {
|
|
346
|
+
const e = b(t.row, t.col.key) ?? "", n = t.col.renderProps || {};
|
|
347
|
+
return e ? /^https?:\/\//.test(e) ? f(q, {
|
|
348
|
+
src: e,
|
|
349
|
+
previewSrcList: [e],
|
|
350
|
+
fit: "contain",
|
|
351
|
+
style: "width:40px;height:40px",
|
|
352
|
+
...n
|
|
353
|
+
}) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ? f("div", {
|
|
354
|
+
innerHTML: e,
|
|
355
|
+
style: `width:40px;height:40px;display:inline-block;${n.style || ""}`,
|
|
356
|
+
...n
|
|
357
|
+
}) : f("i", {
|
|
358
|
+
class: e,
|
|
359
|
+
style: `font-size:20px;${n.style || ""}`,
|
|
360
|
+
...n
|
|
361
|
+
}) : "";
|
|
362
|
+
}), re = {
|
|
363
|
+
input: Be,
|
|
364
|
+
"input-number": Ee,
|
|
365
|
+
select: Se,
|
|
366
|
+
button: Ae,
|
|
367
|
+
link: Te,
|
|
368
|
+
html: Ve,
|
|
369
|
+
copy: Oe,
|
|
370
|
+
img: Me,
|
|
371
|
+
dict: Fe,
|
|
372
|
+
map: $e,
|
|
373
|
+
formatter: ze,
|
|
374
|
+
icon: Ie
|
|
375
|
+
};
|
|
376
|
+
function Ke(t) {
|
|
377
|
+
t.registerMultiple(re);
|
|
378
|
+
}
|
|
379
|
+
function Qe() {
|
|
380
|
+
return re;
|
|
381
|
+
}
|
|
382
|
+
function Le(t, e = 10, n = []) {
|
|
383
|
+
const l = "*:*:*", r = (s) => {
|
|
384
|
+
if (!s) return !0;
|
|
385
|
+
const y = Array.isArray(s) ? s : [s];
|
|
314
386
|
return n.some(
|
|
315
|
-
(
|
|
387
|
+
(p) => p === l || y.includes(p)
|
|
316
388
|
);
|
|
317
|
-
}, i =
|
|
318
|
-
(
|
|
389
|
+
}, i = $(() => t.some((s) => r(s.permission))), c = $(() => t.filter((y) => r(y.permission)).slice(0, e).reduce(
|
|
390
|
+
(y, p) => y + (p.width ?? 60),
|
|
319
391
|
0
|
|
320
|
-
)), d = (
|
|
321
|
-
(
|
|
392
|
+
)), d = (s, y) => r(s.permission) && (s.visible ? s.visible(y) : !0), g = (s) => t.filter((p) => d(p, s)).slice(0, e).reduce(
|
|
393
|
+
(p, S) => p + (S.width ?? 60),
|
|
322
394
|
0
|
|
323
395
|
);
|
|
324
396
|
return {
|
|
325
397
|
hasAnyButton: i,
|
|
326
398
|
optWidth: c,
|
|
327
|
-
hasAnyVisibleButton: (
|
|
328
|
-
(
|
|
399
|
+
hasAnyVisibleButton: (s) => s != null && s.length ? s.some(
|
|
400
|
+
(y) => t.some((p) => d(p, y))
|
|
329
401
|
) : !1,
|
|
330
|
-
getMaxOptWidth: (
|
|
331
|
-
(
|
|
402
|
+
getMaxOptWidth: (s) => s != null && s.length ? s.reduce(
|
|
403
|
+
(y, p) => Math.max(y, g(p)),
|
|
332
404
|
0
|
|
333
405
|
) : c.value,
|
|
334
|
-
getVisibleButtons: (
|
|
406
|
+
getVisibleButtons: (s) => t.filter((y) => d(y, s)).slice(0, e)
|
|
335
407
|
};
|
|
336
408
|
}
|
|
337
|
-
const
|
|
409
|
+
const Ne = ["title"], De = /* @__PURE__ */ M({
|
|
338
410
|
__name: "index",
|
|
339
411
|
props: {
|
|
340
412
|
col: { type: Object, required: !0 },
|
|
@@ -343,174 +415,169 @@ const fe = ["title"], ge = /* @__PURE__ */ O({
|
|
|
343
415
|
},
|
|
344
416
|
emits: ["cellBlur", "cellEnter", "cellChange", "cellClick"],
|
|
345
417
|
setup(t, { emit: e }) {
|
|
346
|
-
const n = t,
|
|
347
|
-
var
|
|
348
|
-
const
|
|
349
|
-
return
|
|
350
|
-
}, { col:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
418
|
+
const n = t, o = e, l = (u) => {
|
|
419
|
+
var A, w;
|
|
420
|
+
const C = (A = n.pagination) == null ? void 0 : A.page, x = (w = n.pagination) == null ? void 0 : w.size;
|
|
421
|
+
return C && x ? (C - 1) * x + u + 1 : u + 1;
|
|
422
|
+
}, { col: r } = ae(n), i = (u, C) => o("cellChange", u, C), c = (u, C) => o("cellBlur", u, C), d = (u, C) => o("cellEnter", u, C), g = (u, C) => o("cellClick", u, C);
|
|
423
|
+
Ke(J());
|
|
424
|
+
const v = $(() => {
|
|
425
|
+
const u = J(), C = {};
|
|
426
|
+
return u.names().forEach((x) => {
|
|
427
|
+
const A = u.get(x);
|
|
428
|
+
A && (C[x] = A);
|
|
429
|
+
}), C;
|
|
430
|
+
}), {
|
|
431
|
+
hasAnyButton: m,
|
|
432
|
+
hasAnyVisibleButton: k,
|
|
433
|
+
optWidth: s,
|
|
434
|
+
getMaxOptWidth: y,
|
|
435
|
+
getVisibleButtons: p
|
|
436
|
+
} = Le(
|
|
437
|
+
r.value.buttons || [],
|
|
438
|
+
r.value.maxbtn ?? 10,
|
|
359
439
|
n.permissions || []
|
|
360
|
-
),
|
|
361
|
-
function
|
|
362
|
-
return !(
|
|
440
|
+
), S = $(() => (r.value.buttons || []).length ? (r.value.__rows || []).length ? k(r.value.__rows || []) : m.value : !1), L = $(() => r.value.__rows ? y(r.value.__rows) : s.value);
|
|
441
|
+
function oe(u) {
|
|
442
|
+
return !(u.type === "selection" || u.type === "index" || u.type === "operation" && !S.value || u.visible === !1);
|
|
363
443
|
}
|
|
364
|
-
return (
|
|
365
|
-
const
|
|
366
|
-
return
|
|
444
|
+
return (u, C) => {
|
|
445
|
+
const x = O("el-table-column"), A = O("el-button");
|
|
446
|
+
return a(r).type === "selection" ? (h(), _(x, B({
|
|
367
447
|
key: 0,
|
|
368
448
|
type: "selection"
|
|
369
|
-
},
|
|
449
|
+
}, a(r).columnProps), null, 16)) : a(r).type === "index" ? (h(), _(x, B({
|
|
370
450
|
key: 1,
|
|
371
451
|
type: "index",
|
|
372
|
-
label:
|
|
452
|
+
label: a(r).label || "#",
|
|
373
453
|
align: "center"
|
|
374
|
-
},
|
|
375
|
-
default:
|
|
376
|
-
|
|
454
|
+
}, a(r).columnProps), {
|
|
455
|
+
default: V(({ $index: w }) => [
|
|
456
|
+
Z(W(l(w)), 1)
|
|
377
457
|
]),
|
|
378
458
|
_: 1
|
|
379
|
-
}, 16, ["label"])) :
|
|
459
|
+
}, 16, ["label"])) : a(r).type === "operation" && S.value ? (h(), _(x, B({
|
|
380
460
|
key: 2,
|
|
381
|
-
label:
|
|
461
|
+
label: a(r).label || "操作",
|
|
382
462
|
align: "center"
|
|
383
463
|
}, {
|
|
384
|
-
...
|
|
385
|
-
width:
|
|
464
|
+
...a(r).columnProps,
|
|
465
|
+
width: L.value
|
|
386
466
|
}), {
|
|
387
|
-
default:
|
|
388
|
-
(
|
|
389
|
-
key:
|
|
390
|
-
type:
|
|
467
|
+
default: V(({ row: w }) => [
|
|
468
|
+
(h(!0), I(H, null, K(a(p)(w), (T) => (h(), _(A, {
|
|
469
|
+
key: T.label,
|
|
470
|
+
type: T.type || "primary",
|
|
391
471
|
link: "",
|
|
392
|
-
onClick: (
|
|
472
|
+
onClick: (N) => T.action(w)
|
|
393
473
|
}, {
|
|
394
|
-
default:
|
|
395
|
-
|
|
474
|
+
default: V(() => [
|
|
475
|
+
Z(W(T.label), 1)
|
|
396
476
|
]),
|
|
397
477
|
_: 2
|
|
398
478
|
}, 1032, ["type", "onClick"]))), 128))
|
|
399
479
|
]),
|
|
400
480
|
_: 1
|
|
401
|
-
}, 16, ["label"])) :
|
|
481
|
+
}, 16, ["label"])) : oe(a(r)) ? (h(), _(x, B({
|
|
402
482
|
key: 3,
|
|
403
|
-
label:
|
|
483
|
+
label: a(r).label,
|
|
404
484
|
align: "center"
|
|
405
|
-
},
|
|
406
|
-
default:
|
|
407
|
-
var
|
|
485
|
+
}, a(r).columnProps || {}), {
|
|
486
|
+
default: V((w) => {
|
|
487
|
+
var T, N, Q, X;
|
|
408
488
|
return [
|
|
409
|
-
|
|
489
|
+
a(r).render === "slot" && u.$slots[((T = a(r)) == null ? void 0 : T.slot) || a(r).key] ? ne(u.$slots, ((N = a(r)) == null ? void 0 : N.slot) || a(r).key, ue(B({ key: 0 }, w))) : a(r).render && v.value[a(r).render] ? (h(), _(de(v.value[a(r).render]), {
|
|
410
490
|
key: 1,
|
|
411
491
|
row: w.row,
|
|
412
|
-
col:
|
|
492
|
+
col: a(r),
|
|
413
493
|
onCellChange: i,
|
|
414
494
|
onCellBlur: c,
|
|
415
495
|
onCellEnter: d,
|
|
416
|
-
onClick:
|
|
417
|
-
}, null, 40, ["row", "col"])) : (
|
|
496
|
+
onClick: g
|
|
497
|
+
}, null, 40, ["row", "col"])) : (h(), I("span", {
|
|
418
498
|
key: 2,
|
|
419
|
-
style:
|
|
420
|
-
class:
|
|
421
|
-
title:
|
|
422
|
-
},
|
|
499
|
+
style: fe(((Q = a(r).renderProps) == null ? void 0 : Q.style) || ""),
|
|
500
|
+
class: me(((X = a(r).renderProps) == null ? void 0 : X.class) || ""),
|
|
501
|
+
title: a(b)(w.row, a(r).key)
|
|
502
|
+
}, W(a(b)(w.row, a(r).key)), 15, Ne))
|
|
423
503
|
];
|
|
424
504
|
}),
|
|
425
505
|
_: 3
|
|
426
|
-
}, 16, ["label"])) :
|
|
506
|
+
}, 16, ["label"])) : ce("", !0);
|
|
427
507
|
};
|
|
428
508
|
}
|
|
429
|
-
})
|
|
430
|
-
function
|
|
431
|
-
return `${he}${t}_${e}`;
|
|
432
|
-
}
|
|
433
|
-
function X(t, e) {
|
|
509
|
+
});
|
|
510
|
+
function ee(t, e) {
|
|
434
511
|
if (!(e != null && e.length)) return t;
|
|
435
512
|
const n = new Map(
|
|
436
|
-
e.map((
|
|
513
|
+
e.map((o) => [o.key, o])
|
|
437
514
|
);
|
|
438
|
-
return t.map((
|
|
439
|
-
const
|
|
440
|
-
return
|
|
441
|
-
...
|
|
442
|
-
visible: typeof
|
|
443
|
-
} :
|
|
515
|
+
return t.map((o) => {
|
|
516
|
+
const l = n.get(o.key);
|
|
517
|
+
return l ? {
|
|
518
|
+
...o,
|
|
519
|
+
visible: typeof l.visible == "boolean" ? l.visible : o.visible
|
|
520
|
+
} : o;
|
|
444
521
|
});
|
|
445
522
|
}
|
|
446
|
-
function
|
|
447
|
-
const {
|
|
448
|
-
|
|
449
|
-
userId: r,
|
|
450
|
-
storage: o = localStorage
|
|
451
|
-
} = e || {}, i = r ? ve(r, n || "") : null, c = i ? o.getItem(i) : null, d = A(
|
|
452
|
-
X(
|
|
523
|
+
function We(t, e) {
|
|
524
|
+
const { cacheKey: n, storage: o = localStorage } = e || {}, l = n ? o.getItem(n) : null, r = R(
|
|
525
|
+
ee(
|
|
453
526
|
t,
|
|
454
|
-
|
|
527
|
+
l ? JSON.parse(l) : []
|
|
455
528
|
)
|
|
456
529
|
);
|
|
457
|
-
return
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
if (!
|
|
461
|
-
const
|
|
462
|
-
key:
|
|
463
|
-
visible:
|
|
464
|
-
columnOpts:
|
|
530
|
+
return z(
|
|
531
|
+
r,
|
|
532
|
+
(i) => {
|
|
533
|
+
if (!n) return;
|
|
534
|
+
const c = i.map((d) => ({
|
|
535
|
+
key: d.key,
|
|
536
|
+
visible: d.visible,
|
|
537
|
+
columnOpts: d.columnOpts
|
|
465
538
|
}));
|
|
466
539
|
o.setItem(
|
|
467
|
-
|
|
468
|
-
JSON.stringify(
|
|
540
|
+
n,
|
|
541
|
+
JSON.stringify(c)
|
|
469
542
|
);
|
|
470
543
|
},
|
|
471
544
|
{ deep: !0 }
|
|
472
545
|
), {
|
|
473
546
|
/** 当前列配置(响应式) */
|
|
474
|
-
columns:
|
|
547
|
+
columns: r,
|
|
475
548
|
/**
|
|
476
549
|
* 主动设置列配置
|
|
477
550
|
* 常用于:列设置弹窗 / 拖拽排序完成
|
|
478
551
|
*/
|
|
479
|
-
setColumns(
|
|
480
|
-
|
|
552
|
+
setColumns(i) {
|
|
553
|
+
r.value = ee(
|
|
481
554
|
t,
|
|
482
|
-
|
|
483
|
-
),
|
|
484
|
-
|
|
485
|
-
JSON.stringify(
|
|
555
|
+
i
|
|
556
|
+
), n && o.setItem(
|
|
557
|
+
n,
|
|
558
|
+
JSON.stringify(i)
|
|
486
559
|
);
|
|
487
560
|
},
|
|
488
561
|
/**
|
|
489
562
|
* 重置为默认列配置
|
|
490
563
|
*/
|
|
491
564
|
resetColumns() {
|
|
492
|
-
|
|
565
|
+
r.value = t, n && o.removeItem(n);
|
|
493
566
|
}
|
|
494
567
|
};
|
|
495
568
|
}
|
|
496
|
-
const
|
|
569
|
+
const Pe = /* @__PURE__ */ M({
|
|
497
570
|
__name: "index",
|
|
498
571
|
props: {
|
|
499
572
|
data: { type: Array, default: () => [] },
|
|
500
573
|
columns: { type: Array, default: () => [] },
|
|
501
|
-
// v-model:columns
|
|
502
|
-
pageKey: String,
|
|
503
574
|
rowKey: { type: String, default: "id" },
|
|
504
575
|
loading: { type: Boolean, default: !1 },
|
|
505
576
|
permissions: {
|
|
506
577
|
type: Array,
|
|
507
578
|
default: () => []
|
|
508
579
|
},
|
|
509
|
-
|
|
510
|
-
/** 当前用户标识(可选,用于列缓存) */
|
|
511
|
-
type: [String, Number],
|
|
512
|
-
default: ""
|
|
513
|
-
},
|
|
580
|
+
cacheKey: String,
|
|
514
581
|
pagination: { type: Object, default: () => ({}) }
|
|
515
582
|
},
|
|
516
583
|
emits: [
|
|
@@ -521,65 +588,145 @@ const be = /* @__PURE__ */ O({
|
|
|
521
588
|
"cell-click"
|
|
522
589
|
],
|
|
523
590
|
setup(t, { expose: e, emit: n }) {
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
userId: r.userId ?? ""
|
|
591
|
+
const o = t, l = n, { columns: r } = We(o.columns, {
|
|
592
|
+
cacheKey: o.cacheKey ?? ""
|
|
527
593
|
});
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
(
|
|
594
|
+
z(
|
|
595
|
+
r,
|
|
596
|
+
(m) => l("update:columns", m),
|
|
531
597
|
{ deep: !0, immediate: !0 }
|
|
532
598
|
);
|
|
533
|
-
const i = (
|
|
534
|
-
|
|
535
|
-
}, d = (
|
|
536
|
-
console.log("enter"),
|
|
537
|
-
},
|
|
538
|
-
|
|
539
|
-
},
|
|
599
|
+
const i = (m, k) => l("cellChange", m, k), c = (m, k) => {
|
|
600
|
+
l("cellBlur", m, k);
|
|
601
|
+
}, d = (m, k) => {
|
|
602
|
+
console.log("enter"), l("cellEnter", m, k);
|
|
603
|
+
}, g = (m, k) => {
|
|
604
|
+
k && l("cell-click", m, k);
|
|
605
|
+
}, v = R();
|
|
540
606
|
return e({
|
|
541
|
-
tableRef:
|
|
542
|
-
}), (
|
|
543
|
-
const
|
|
544
|
-
return
|
|
607
|
+
tableRef: v
|
|
608
|
+
}), (m, k) => {
|
|
609
|
+
const s = O("el-table"), y = ye("loading");
|
|
610
|
+
return pe((h(), _(s, B({
|
|
545
611
|
ref_key: "tableRef",
|
|
546
|
-
ref:
|
|
547
|
-
},
|
|
612
|
+
ref: v
|
|
613
|
+
}, m.$attrs, {
|
|
548
614
|
data: t.data,
|
|
549
615
|
"row-key": t.rowKey,
|
|
550
616
|
class: "smart-table"
|
|
551
617
|
}), {
|
|
552
|
-
default:
|
|
553
|
-
(
|
|
554
|
-
key:
|
|
555
|
-
col:
|
|
618
|
+
default: V(() => [
|
|
619
|
+
(h(!0), I(H, null, K(a(r), (p) => (h(), _(De, {
|
|
620
|
+
key: p.key,
|
|
621
|
+
col: p,
|
|
556
622
|
permissions: t.permissions,
|
|
557
623
|
pagination: t.pagination,
|
|
558
624
|
onCellChange: i,
|
|
559
625
|
onCellBlur: c,
|
|
560
626
|
onCellEnter: d,
|
|
561
|
-
onCellClick:
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
name:
|
|
565
|
-
fn:
|
|
566
|
-
|
|
627
|
+
onCellClick: g
|
|
628
|
+
}, ge({ _: 2 }, [
|
|
629
|
+
K(a(r), (S) => ({
|
|
630
|
+
name: S.key,
|
|
631
|
+
fn: V((L) => [
|
|
632
|
+
ne(m.$slots, S.key, B({ ref_for: !0 }, L), void 0, !0)
|
|
567
633
|
])
|
|
568
634
|
}))
|
|
569
635
|
]), 1032, ["col", "permissions", "pagination"]))), 128))
|
|
570
636
|
]),
|
|
571
637
|
_: 3
|
|
572
638
|
}, 16, ["data", "row-key"])), [
|
|
573
|
-
[
|
|
639
|
+
[y, t.loading]
|
|
574
640
|
]);
|
|
575
641
|
};
|
|
576
642
|
}
|
|
577
|
-
}),
|
|
643
|
+
}), je = (t, e) => {
|
|
578
644
|
const n = t.__vccOpts || t;
|
|
579
|
-
for (const [
|
|
580
|
-
n[
|
|
645
|
+
for (const [o, l] of e)
|
|
646
|
+
n[o] = l;
|
|
581
647
|
return n;
|
|
582
|
-
},
|
|
648
|
+
}, Xe = /* @__PURE__ */ je(Pe, [["__scopeId", "data-v-f4c8de68"]]), te = {
|
|
649
|
+
defaultPagination: {
|
|
650
|
+
page: 1,
|
|
651
|
+
size: 10,
|
|
652
|
+
total: 0
|
|
653
|
+
},
|
|
654
|
+
defaultTableProps: {},
|
|
655
|
+
defaultColumnProps: {},
|
|
656
|
+
theme: {
|
|
657
|
+
primaryColor: "#409EFF",
|
|
658
|
+
successColor: "#67C23A",
|
|
659
|
+
warningColor: "#E6A23C",
|
|
660
|
+
dangerColor: "#F56C6C",
|
|
661
|
+
infoColor: "#909399"
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
class qe {
|
|
665
|
+
constructor() {
|
|
666
|
+
D(this, "config", { ...te });
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* 获取所有配置
|
|
670
|
+
*/
|
|
671
|
+
getConfig() {
|
|
672
|
+
return { ...this.config };
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* 设置配置
|
|
676
|
+
*/
|
|
677
|
+
setConfig(e) {
|
|
678
|
+
this.config = this.mergeConfig(this.config, e), e.renderers && J().registerMultiple(e.renderers);
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* 获取特定配置项
|
|
682
|
+
*/
|
|
683
|
+
get(e) {
|
|
684
|
+
return this.config[e];
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* 重置为默认配置
|
|
688
|
+
*/
|
|
689
|
+
reset() {
|
|
690
|
+
this.config = { ...te };
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* 深度合并配置
|
|
694
|
+
*/
|
|
695
|
+
mergeConfig(e, n) {
|
|
696
|
+
const o = { ...e };
|
|
697
|
+
for (const l in n)
|
|
698
|
+
n[l] && typeof n[l] == "object" && !Array.isArray(n[l]) ? o[l] = this.mergeConfig(e[l] || {}, n[l]) : o[l] = n[l];
|
|
699
|
+
return o;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
let j = null;
|
|
703
|
+
function le() {
|
|
704
|
+
return j || (j = new qe()), j;
|
|
705
|
+
}
|
|
706
|
+
function Ze(t) {
|
|
707
|
+
le().setConfig(t);
|
|
708
|
+
}
|
|
709
|
+
function et() {
|
|
710
|
+
return le().getConfig();
|
|
711
|
+
}
|
|
712
|
+
function tt(t, e) {
|
|
713
|
+
return {
|
|
714
|
+
key: t,
|
|
715
|
+
...e
|
|
716
|
+
};
|
|
717
|
+
}
|
|
583
718
|
export {
|
|
584
|
-
|
|
719
|
+
Xe as SmartTable,
|
|
720
|
+
re as builtInRenderers,
|
|
721
|
+
E as createFunctionalRenderer,
|
|
722
|
+
Qe as createRenderer,
|
|
723
|
+
Xe as default,
|
|
724
|
+
tt as defineColumn,
|
|
725
|
+
J as getRendererManager,
|
|
726
|
+
et as getSmartTableConfig,
|
|
727
|
+
Ke as registerBuiltInRenderers,
|
|
728
|
+
Ze as setSmartTableConfig,
|
|
729
|
+
Ge as validateRendererProps,
|
|
730
|
+
Y as wrapSFCComponent
|
|
585
731
|
};
|
|
732
|
+
//# sourceMappingURL=vue3-smart-table.es.js.map
|