@tmagic/table 1.0.0-beta.2 → 1.0.0-beta.3
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/package.json +3 -2
- package/dist/style.css +0 -16
- package/dist/tmagic-table.es.js +0 -570
- package/dist/tmagic-table.es.js.map +0 -1
- package/dist/tmagic-table.umd.js +0 -576
- package/dist/tmagic-table.umd.js.map +0 -1
- package/dist/types/src/ExpandColumn.vue.d.ts +0 -18
- package/dist/types/src/PopoverColumn.vue.d.ts +0 -20
- package/dist/types/src/Table.vue.d.ts +0 -129
- package/dist/types/src/TextColumn.vue.d.ts +0 -29
- package/dist/types/src/index.d.ts +0 -6
- package/dist/types/src/schema.d.ts +0 -38
- package/dist/types/src/shims-vue.d.ts +0 -6
- package/dist/types/src/utils.d.ts +0 -2
- package/dist/types/src/vite-env.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-beta.
|
|
2
|
+
"version": "1.0.0-beta.3",
|
|
3
3
|
"name": "@tmagic/table",
|
|
4
|
+
"sideEffects": false,
|
|
4
5
|
"main": "dist/tmagic-table.umd.js",
|
|
5
6
|
"module": "dist/tmagic-table.es.js",
|
|
6
7
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"url": "https://github.com/Tencent/tmagic-editor.git"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@tmagic/form": "^1.0.0-beta.
|
|
29
|
+
"@tmagic/form": "^1.0.0-beta.3",
|
|
29
30
|
"element-plus": "^2.0.2",
|
|
30
31
|
"lodash-es": "^4.17.21",
|
|
31
32
|
"vue": "^3.2.0"
|
package/dist/style.css
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.m-table .el-button.action-btn {
|
|
2
|
-
margin-right: 10px;
|
|
3
|
-
}
|
|
4
|
-
.m-table .el-button.action-btn + .el-button.action-btn {
|
|
5
|
-
margin-left: 0;
|
|
6
|
-
}
|
|
7
|
-
.m-table .keep-all {
|
|
8
|
-
word-break: keep-all;
|
|
9
|
-
}
|
|
10
|
-
.m-table .el-table .cell > div {
|
|
11
|
-
display: inline-block;
|
|
12
|
-
vertical-align: middle;
|
|
13
|
-
}
|
|
14
|
-
.m-table .el-table__row.el-table__row--level-1 {
|
|
15
|
-
color: #999;
|
|
16
|
-
}
|
package/dist/tmagic-table.es.js
DELETED
|
@@ -1,570 +0,0 @@
|
|
|
1
|
-
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, withDirectives, vShow, createVNode, createTextVNode, createCommentVNode, toDisplayString, createElementVNode } from 'vue';
|
|
2
|
-
import { cloneDeep } from 'lodash-es';
|
|
3
|
-
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
4
|
-
import { MForm } from '@tmagic/form';
|
|
5
|
-
import { datetimeFormatter } from '@tmagic/utils';
|
|
6
|
-
|
|
7
|
-
const _hoisted_1$1 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
8
|
-
const _hoisted_2$1 = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
9
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
10
|
-
props: {
|
|
11
|
-
columns: {
|
|
12
|
-
type: Array,
|
|
13
|
-
require: true,
|
|
14
|
-
default: () => []
|
|
15
|
-
},
|
|
16
|
-
config: {
|
|
17
|
-
type: Object,
|
|
18
|
-
require: true,
|
|
19
|
-
default: () => {
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
rowkeyName: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "c_id"
|
|
25
|
-
},
|
|
26
|
-
editState: {
|
|
27
|
-
type: Object,
|
|
28
|
-
default: () => {
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
emits: ["afterAction"],
|
|
33
|
-
setup(__props, { emit }) {
|
|
34
|
-
const props = __props;
|
|
35
|
-
const display = (fuc, row) => {
|
|
36
|
-
if (typeof fuc === "function") {
|
|
37
|
-
return fuc.call(this, this, row);
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
};
|
|
41
|
-
const success = (msg, action) => {
|
|
42
|
-
ElMessage.success(msg);
|
|
43
|
-
action.after?.();
|
|
44
|
-
};
|
|
45
|
-
const error = (msg) => ElMessage.error(msg);
|
|
46
|
-
const deleteAction = async (action, row) => {
|
|
47
|
-
await ElMessageBox.confirm(`\u786E\u8BA4\u5220\u9664${row[action.name || "c_name"]}(${row[props.rowkeyName]})?`, "\u63D0\u793A", {
|
|
48
|
-
confirmButtonText: "\u786E\u5B9A",
|
|
49
|
-
cancelButtonText: "\u53D6\u6D88",
|
|
50
|
-
type: "warning"
|
|
51
|
-
});
|
|
52
|
-
const res = await action.handler?.(row);
|
|
53
|
-
if (res.ret === 0) {
|
|
54
|
-
success("\u5220\u9664\u6210\u529F!", action);
|
|
55
|
-
} else {
|
|
56
|
-
error(res.msg || "\u5220\u9664\u5931\u8D25");
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const copyHandler = async (action, row) => {
|
|
60
|
-
await ElMessageBox.confirm(`\u786E\u5B9A\u590D\u5236${row[action.name || "c_name"]}(${row.c_id})?`, "\u63D0\u793A", {
|
|
61
|
-
confirmButtonText: "\u786E\u5B9A",
|
|
62
|
-
cancelButtonText: "\u53D6\u6D88",
|
|
63
|
-
type: "warning"
|
|
64
|
-
});
|
|
65
|
-
try {
|
|
66
|
-
const res = await action.handler?.(row);
|
|
67
|
-
if (res.ret === 0) {
|
|
68
|
-
success("\u590D\u5236\u6210\u529F!", action);
|
|
69
|
-
} else {
|
|
70
|
-
error(`\u590D\u5236\u5931\u8D25!${res.msg}`);
|
|
71
|
-
}
|
|
72
|
-
} catch (e) {
|
|
73
|
-
error("\u590D\u5236\u5931\u8D25!");
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const actionHandler = async (action, row, index) => {
|
|
77
|
-
if (action.type === "delete") {
|
|
78
|
-
await deleteAction(action, row);
|
|
79
|
-
} else if (action.type === "copy") {
|
|
80
|
-
await copyHandler(action, row);
|
|
81
|
-
} else if (action.type === "edit") {
|
|
82
|
-
props.editState[index] = row;
|
|
83
|
-
} else {
|
|
84
|
-
await action.handler?.(row);
|
|
85
|
-
action.after?.();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const save = async (index, config) => {
|
|
89
|
-
const action = config.actions?.find((item) => item.type === "edit")?.action;
|
|
90
|
-
if (!action)
|
|
91
|
-
return;
|
|
92
|
-
const data = {};
|
|
93
|
-
const row = props.editState[index];
|
|
94
|
-
props.columns.filter((item) => item.type).forEach((column) => {
|
|
95
|
-
data[column.prop] = row[column.prop];
|
|
96
|
-
});
|
|
97
|
-
const res = await action({
|
|
98
|
-
data
|
|
99
|
-
});
|
|
100
|
-
if (res) {
|
|
101
|
-
if (res.ret === 0) {
|
|
102
|
-
ElMessage.success("\u4FDD\u5B58\u6210\u529F");
|
|
103
|
-
props.editState[index] = void 0;
|
|
104
|
-
emit("afterAction");
|
|
105
|
-
} else {
|
|
106
|
-
ElMessage.error({
|
|
107
|
-
duration: 1e4,
|
|
108
|
-
showClose: true,
|
|
109
|
-
dangerouslyUseHTMLString: true,
|
|
110
|
-
message: res.msg || "\u4FDD\u5B58\u5931\u8D25"
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
props.editState[index] = void 0;
|
|
115
|
-
emit("afterAction");
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
return (_ctx, _cache) => {
|
|
119
|
-
const _component_el_button = resolveComponent("el-button");
|
|
120
|
-
const _component_el_table_column = resolveComponent("el-table-column");
|
|
121
|
-
return openBlock(), createBlock(_component_el_table_column, {
|
|
122
|
-
label: __props.config.label,
|
|
123
|
-
width: __props.config.width,
|
|
124
|
-
fixed: __props.config.fixed
|
|
125
|
-
}, {
|
|
126
|
-
default: withCtx((scope) => [
|
|
127
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.actions, (action, actionIndex) => {
|
|
128
|
-
return withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
129
|
-
innerHTML: action.text,
|
|
130
|
-
class: "action-btn",
|
|
131
|
-
type: "text",
|
|
132
|
-
size: "small",
|
|
133
|
-
key: actionIndex,
|
|
134
|
-
onClick: ($event) => actionHandler(action, scope.row, scope.$index)
|
|
135
|
-
}, null, 8, ["innerHTML", "onClick"])), [
|
|
136
|
-
[vShow, display(action.display, scope.row) && !__props.editState[scope.$index]]
|
|
137
|
-
]);
|
|
138
|
-
}), 128)),
|
|
139
|
-
withDirectives(createVNode(_component_el_button, {
|
|
140
|
-
class: "action-btn",
|
|
141
|
-
type: "text",
|
|
142
|
-
size: "small",
|
|
143
|
-
onClick: ($event) => save(scope.$index, __props.config)
|
|
144
|
-
}, {
|
|
145
|
-
default: withCtx(() => [
|
|
146
|
-
_hoisted_1$1
|
|
147
|
-
]),
|
|
148
|
-
_: 2
|
|
149
|
-
}, 1032, ["onClick"]), [
|
|
150
|
-
[vShow, __props.editState[scope.$index]]
|
|
151
|
-
]),
|
|
152
|
-
withDirectives(createVNode(_component_el_button, {
|
|
153
|
-
class: "action-btn",
|
|
154
|
-
type: "text",
|
|
155
|
-
size: "small",
|
|
156
|
-
onClick: ($event) => __props.editState[scope.$index] = void 0
|
|
157
|
-
}, {
|
|
158
|
-
default: withCtx(() => [
|
|
159
|
-
_hoisted_2$1
|
|
160
|
-
]),
|
|
161
|
-
_: 2
|
|
162
|
-
}, 1032, ["onClick"]), [
|
|
163
|
-
[vShow, __props.editState[scope.$index]]
|
|
164
|
-
])
|
|
165
|
-
]),
|
|
166
|
-
_: 1
|
|
167
|
-
}, 8, ["label", "width", "fixed"]);
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
var _export_sfc = (sfc, props) => {
|
|
173
|
-
const target = sfc.__vccOpts || sfc;
|
|
174
|
-
for (const [key, val] of props) {
|
|
175
|
-
target[key] = val;
|
|
176
|
-
}
|
|
177
|
-
return target;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const _sfc_main$3 = defineComponent({
|
|
181
|
-
components: { MForm },
|
|
182
|
-
props: {
|
|
183
|
-
config: {
|
|
184
|
-
type: Object,
|
|
185
|
-
default: () => ({}),
|
|
186
|
-
required: true
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
191
|
-
const _component_m_table = resolveComponent("m-table");
|
|
192
|
-
const _component_m_form = resolveComponent("m-form");
|
|
193
|
-
const _component_el_table_column = resolveComponent("el-table-column");
|
|
194
|
-
return openBlock(), createBlock(_component_el_table_column, { type: "expand" }, {
|
|
195
|
-
default: withCtx((scope) => [
|
|
196
|
-
_ctx.config.table ? (openBlock(), createBlock(_component_m_table, {
|
|
197
|
-
key: 0,
|
|
198
|
-
"show-header": false,
|
|
199
|
-
columns: _ctx.config.table,
|
|
200
|
-
data: scope.row[_ctx.config.prop]
|
|
201
|
-
}, null, 8, ["columns", "data"])) : createCommentVNode("", true),
|
|
202
|
-
_ctx.config.form ? (openBlock(), createBlock(_component_m_form, {
|
|
203
|
-
key: 1,
|
|
204
|
-
config: _ctx.config.form,
|
|
205
|
-
"init-values": _ctx.config.values || scope.row[_ctx.config.prop] || {}
|
|
206
|
-
}, null, 8, ["config", "init-values"])) : createCommentVNode("", true)
|
|
207
|
-
]),
|
|
208
|
-
_: 1
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
var ExpandColumn = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
212
|
-
|
|
213
|
-
const formatter = (item, row) => {
|
|
214
|
-
if (item.formatter) {
|
|
215
|
-
if (item.formatter === "datetime") {
|
|
216
|
-
item.formatter = (value) => datetimeFormatter(value);
|
|
217
|
-
}
|
|
218
|
-
try {
|
|
219
|
-
return item.formatter(row[item.prop], row);
|
|
220
|
-
} catch (e) {
|
|
221
|
-
return row[item.prop];
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
return row[item.prop];
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const _sfc_main$2 = defineComponent({
|
|
229
|
-
props: {
|
|
230
|
-
config: {
|
|
231
|
-
type: Object,
|
|
232
|
-
default: () => ({}),
|
|
233
|
-
required: true
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
setup() {
|
|
237
|
-
return {
|
|
238
|
-
formatter
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
243
|
-
const _component_m_table = resolveComponent("m-table");
|
|
244
|
-
const _component_el_button = resolveComponent("el-button");
|
|
245
|
-
const _component_el_popover = resolveComponent("el-popover");
|
|
246
|
-
const _component_el_table_column = resolveComponent("el-table-column");
|
|
247
|
-
return openBlock(), createBlock(_component_el_table_column, {
|
|
248
|
-
label: _ctx.config.label,
|
|
249
|
-
width: _ctx.config.width,
|
|
250
|
-
fixed: _ctx.config.fixed
|
|
251
|
-
}, {
|
|
252
|
-
default: withCtx((scope) => [
|
|
253
|
-
createVNode(_component_el_popover, {
|
|
254
|
-
placement: _ctx.config.popover.placement,
|
|
255
|
-
width: _ctx.config.popover.width,
|
|
256
|
-
trigger: _ctx.config.popover.trigger
|
|
257
|
-
}, {
|
|
258
|
-
reference: withCtx(() => [
|
|
259
|
-
createVNode(_component_el_button, { type: "text" }, {
|
|
260
|
-
default: withCtx(() => [
|
|
261
|
-
createTextVNode(toDisplayString(_ctx.config.text || _ctx.formatter(_ctx.config, scope.row)), 1)
|
|
262
|
-
]),
|
|
263
|
-
_: 2
|
|
264
|
-
}, 1024)
|
|
265
|
-
]),
|
|
266
|
-
default: withCtx(() => [
|
|
267
|
-
_ctx.config.popover.tableEmbed ? (openBlock(), createBlock(_component_m_table, {
|
|
268
|
-
key: 0,
|
|
269
|
-
"show-header": _ctx.config.showHeader,
|
|
270
|
-
columns: _ctx.config.table,
|
|
271
|
-
data: scope.row[_ctx.config.prop]
|
|
272
|
-
}, null, 8, ["show-header", "columns", "data"])) : createCommentVNode("", true)
|
|
273
|
-
]),
|
|
274
|
-
_: 2
|
|
275
|
-
}, 1032, ["placement", "width", "trigger"])
|
|
276
|
-
]),
|
|
277
|
-
_: 1
|
|
278
|
-
}, 8, ["label", "width", "fixed"]);
|
|
279
|
-
}
|
|
280
|
-
var PopoverColumn = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
281
|
-
|
|
282
|
-
const _sfc_main$1 = defineComponent({
|
|
283
|
-
props: {
|
|
284
|
-
config: {
|
|
285
|
-
type: Object,
|
|
286
|
-
default: () => ({}),
|
|
287
|
-
required: true
|
|
288
|
-
},
|
|
289
|
-
editState: {
|
|
290
|
-
type: Object,
|
|
291
|
-
default: () => {
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
setup() {
|
|
296
|
-
return {
|
|
297
|
-
formatter
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
const _hoisted_1 = ["href"];
|
|
302
|
-
const _hoisted_2 = ["src"];
|
|
303
|
-
const _hoisted_3 = ["href"];
|
|
304
|
-
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u6269\u5C55\u914D\u7F6E");
|
|
305
|
-
const _hoisted_5 = ["innerHTML"];
|
|
306
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
307
|
-
const _component_m_form_container = resolveComponent("m-form-container");
|
|
308
|
-
const _component_el_form = resolveComponent("el-form");
|
|
309
|
-
const _component_el_button = resolveComponent("el-button");
|
|
310
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
311
|
-
const _component_el_tag = resolveComponent("el-tag");
|
|
312
|
-
const _component_el_table_column = resolveComponent("el-table-column");
|
|
313
|
-
return openBlock(), createBlock(_component_el_table_column, {
|
|
314
|
-
"show-overflow-tooltip": "",
|
|
315
|
-
label: _ctx.config.label,
|
|
316
|
-
width: _ctx.config.width,
|
|
317
|
-
fixed: _ctx.config.fixed,
|
|
318
|
-
sortable: _ctx.config.sortable,
|
|
319
|
-
prop: _ctx.config.prop
|
|
320
|
-
}, {
|
|
321
|
-
default: withCtx((scope) => [
|
|
322
|
-
_ctx.config.type && _ctx.editState[scope.$index] ? (openBlock(), createBlock(_component_el_form, {
|
|
323
|
-
key: 0,
|
|
324
|
-
"label-width": "0",
|
|
325
|
-
model: _ctx.editState[scope.$index]
|
|
326
|
-
}, {
|
|
327
|
-
default: withCtx(() => [
|
|
328
|
-
createVNode(_component_m_form_container, {
|
|
329
|
-
prop: _ctx.config.prop,
|
|
330
|
-
rules: _ctx.config.rules,
|
|
331
|
-
config: _ctx.config,
|
|
332
|
-
name: _ctx.config.prop,
|
|
333
|
-
model: _ctx.editState[scope.$index]
|
|
334
|
-
}, null, 8, ["prop", "rules", "config", "name", "model"])
|
|
335
|
-
]),
|
|
336
|
-
_: 2
|
|
337
|
-
}, 1032, ["model"])) : _ctx.config.action === "actionLink" ? (openBlock(), createBlock(_component_el_button, {
|
|
338
|
-
key: 1,
|
|
339
|
-
type: "text",
|
|
340
|
-
onClick: ($event) => _ctx.config.handler(scope.row)
|
|
341
|
-
}, {
|
|
342
|
-
default: withCtx(() => [
|
|
343
|
-
createTextVNode(toDisplayString(_ctx.formatter(_ctx.config, scope.row)), 1)
|
|
344
|
-
]),
|
|
345
|
-
_: 2
|
|
346
|
-
}, 1032, ["onClick"])) : _ctx.config.action === "img" ? (openBlock(), createElementBlock("a", {
|
|
347
|
-
key: 2,
|
|
348
|
-
target: "_blank",
|
|
349
|
-
href: scope.row[_ctx.config.prop]
|
|
350
|
-
}, [
|
|
351
|
-
createElementVNode("img", {
|
|
352
|
-
src: scope.row[_ctx.config.prop],
|
|
353
|
-
height: "50"
|
|
354
|
-
}, null, 8, _hoisted_2)
|
|
355
|
-
], 8, _hoisted_1)) : _ctx.config.action === "link" ? (openBlock(), createElementBlock("a", {
|
|
356
|
-
key: 3,
|
|
357
|
-
target: "_blank",
|
|
358
|
-
href: scope.row[_ctx.config.prop],
|
|
359
|
-
class: "keep-all"
|
|
360
|
-
}, toDisplayString(scope.row[_ctx.config.prop]), 9, _hoisted_3)) : _ctx.config.action === "tip" ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
361
|
-
key: 4,
|
|
362
|
-
placement: "left"
|
|
363
|
-
}, {
|
|
364
|
-
content: withCtx(() => [
|
|
365
|
-
createElementVNode("div", null, toDisplayString(_ctx.formatter(_ctx.config, scope.row)), 1)
|
|
366
|
-
]),
|
|
367
|
-
default: withCtx(() => [
|
|
368
|
-
createVNode(_component_el_button, { type: "text" }, {
|
|
369
|
-
default: withCtx(() => [
|
|
370
|
-
_hoisted_4
|
|
371
|
-
]),
|
|
372
|
-
_: 1
|
|
373
|
-
})
|
|
374
|
-
]),
|
|
375
|
-
_: 2
|
|
376
|
-
}, 1024)) : _ctx.config.action === "tag" ? (openBlock(), createBlock(_component_el_tag, {
|
|
377
|
-
key: 5,
|
|
378
|
-
type: typeof _ctx.config.type === "function" ? _ctx.config.type(scope.row[_ctx.config.prop], scope.row) : _ctx.config.type,
|
|
379
|
-
"close-transition": ""
|
|
380
|
-
}, {
|
|
381
|
-
default: withCtx(() => [
|
|
382
|
-
createTextVNode(toDisplayString(_ctx.formatter(_ctx.config, scope.row)), 1)
|
|
383
|
-
]),
|
|
384
|
-
_: 2
|
|
385
|
-
}, 1032, ["type"])) : (openBlock(), createElementBlock("div", {
|
|
386
|
-
key: 6,
|
|
387
|
-
innerHTML: _ctx.formatter(_ctx.config, scope.row)
|
|
388
|
-
}, null, 8, _hoisted_5))
|
|
389
|
-
]),
|
|
390
|
-
_: 1
|
|
391
|
-
}, 8, ["label", "width", "fixed", "sortable", "prop"]);
|
|
392
|
-
}
|
|
393
|
-
var TextColumn = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
394
|
-
|
|
395
|
-
var Table_vue_vue_type_style_index_0_lang = '';
|
|
396
|
-
|
|
397
|
-
const _sfc_main = defineComponent({
|
|
398
|
-
name: "m-table",
|
|
399
|
-
components: { ExpandColumn, ActionsColumn: _sfc_main$4, PopoverColumn, TextColumn },
|
|
400
|
-
props: {
|
|
401
|
-
data: {
|
|
402
|
-
type: Array,
|
|
403
|
-
require: true
|
|
404
|
-
},
|
|
405
|
-
columns: {
|
|
406
|
-
type: Array,
|
|
407
|
-
require: true,
|
|
408
|
-
default: () => []
|
|
409
|
-
},
|
|
410
|
-
spanMethod: {
|
|
411
|
-
type: Function
|
|
412
|
-
},
|
|
413
|
-
fetch: {
|
|
414
|
-
type: Boolean,
|
|
415
|
-
default: false
|
|
416
|
-
},
|
|
417
|
-
bodyHeight: {
|
|
418
|
-
type: [String, Number]
|
|
419
|
-
},
|
|
420
|
-
showHeader: {
|
|
421
|
-
type: Boolean
|
|
422
|
-
},
|
|
423
|
-
emptyText: {
|
|
424
|
-
type: String
|
|
425
|
-
},
|
|
426
|
-
defaultExpandAll: {
|
|
427
|
-
type: Boolean,
|
|
428
|
-
default: false
|
|
429
|
-
},
|
|
430
|
-
rowkeyName: {
|
|
431
|
-
type: String
|
|
432
|
-
},
|
|
433
|
-
border: {
|
|
434
|
-
type: Boolean,
|
|
435
|
-
default: false
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
emits: ["sort-change", "afterAction", "select", "select-all", "selection-change"],
|
|
439
|
-
data() {
|
|
440
|
-
return {
|
|
441
|
-
editState: []
|
|
442
|
-
};
|
|
443
|
-
},
|
|
444
|
-
computed: {
|
|
445
|
-
tableData() {
|
|
446
|
-
if (this.selectionColumn) {
|
|
447
|
-
return this.data || [];
|
|
448
|
-
}
|
|
449
|
-
return cloneDeep(this.data) || [];
|
|
450
|
-
},
|
|
451
|
-
selectionColumn() {
|
|
452
|
-
const column = this.columns.filter((item) => item.selection);
|
|
453
|
-
return column.length ? column[0] : null;
|
|
454
|
-
},
|
|
455
|
-
hasBorder() {
|
|
456
|
-
return typeof this.border !== "undefined" ? this.border : true;
|
|
457
|
-
}
|
|
458
|
-
},
|
|
459
|
-
methods: {
|
|
460
|
-
sortChange(data) {
|
|
461
|
-
this.$emit("sort-change", data);
|
|
462
|
-
},
|
|
463
|
-
selectHandler(selection, row) {
|
|
464
|
-
const column = this.selectionColumn;
|
|
465
|
-
if (!column) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (column.selection === "single") ;
|
|
469
|
-
this.$emit("select", selection, row);
|
|
470
|
-
},
|
|
471
|
-
selectAllHandler(selection) {
|
|
472
|
-
this.$emit("select-all", selection);
|
|
473
|
-
},
|
|
474
|
-
selectionChangeHandler(selection) {
|
|
475
|
-
this.$emit("selection-change", selection);
|
|
476
|
-
},
|
|
477
|
-
toggleRowSelection(row, selected) {
|
|
478
|
-
const table = this.$refs.table;
|
|
479
|
-
table.toggleRowSelection.bind(table)(row, selected);
|
|
480
|
-
},
|
|
481
|
-
toggleRowExpansion(row, expanded) {
|
|
482
|
-
const table = this.$refs.table;
|
|
483
|
-
table.toggleRowExpansion.bind(table)(row, expanded);
|
|
484
|
-
},
|
|
485
|
-
clearSelection() {
|
|
486
|
-
const table = this.$refs.table;
|
|
487
|
-
table.clearSelection.bind(table)();
|
|
488
|
-
},
|
|
489
|
-
objectSpanMethod(data) {
|
|
490
|
-
if (typeof this.spanMethod === "function") {
|
|
491
|
-
return this.spanMethod(data);
|
|
492
|
-
}
|
|
493
|
-
return () => ({
|
|
494
|
-
rowspan: 0,
|
|
495
|
-
colspan: 0
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
501
|
-
const _component_expand_column = resolveComponent("expand-column");
|
|
502
|
-
const _component_el_table_column = resolveComponent("el-table-column");
|
|
503
|
-
const _component_actions_column = resolveComponent("actions-column");
|
|
504
|
-
const _component_popover_column = resolveComponent("popover-column");
|
|
505
|
-
const _component_text_column = resolveComponent("text-column");
|
|
506
|
-
const _component_el_table = resolveComponent("el-table");
|
|
507
|
-
return openBlock(), createBlock(_component_el_table, {
|
|
508
|
-
data: _ctx.tableData,
|
|
509
|
-
"show-header": _ctx.showHeader,
|
|
510
|
-
"max-height": _ctx.bodyHeight,
|
|
511
|
-
"tooltip-effect": "dark",
|
|
512
|
-
class: "m-table",
|
|
513
|
-
ref: "table",
|
|
514
|
-
"default-expand-all": _ctx.defaultExpandAll,
|
|
515
|
-
border: _ctx.hasBorder,
|
|
516
|
-
"row-key": _ctx.rowkeyName || "c_id",
|
|
517
|
-
"tree-props": { children: "children" },
|
|
518
|
-
"empty-text": _ctx.emptyText || "\u6682\u65E0\u6570\u636E",
|
|
519
|
-
"span-method": _ctx.objectSpanMethod,
|
|
520
|
-
onSortChange: _ctx.sortChange,
|
|
521
|
-
onSelect: _ctx.selectHandler,
|
|
522
|
-
onSelectAll: _ctx.selectAllHandler,
|
|
523
|
-
onSelectionChange: _ctx.selectionChangeHandler
|
|
524
|
-
}, {
|
|
525
|
-
default: withCtx(() => [
|
|
526
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (item, columnIndex) => {
|
|
527
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
528
|
-
item.type === "expand" ? (openBlock(), createBlock(_component_expand_column, {
|
|
529
|
-
config: item,
|
|
530
|
-
key: columnIndex
|
|
531
|
-
}, null, 8, ["config"])) : createCommentVNode("", true),
|
|
532
|
-
item.selection ? (openBlock(), createBlock(_component_el_table_column, {
|
|
533
|
-
type: "selection",
|
|
534
|
-
key: columnIndex,
|
|
535
|
-
width: "40",
|
|
536
|
-
selectable: item.selectable
|
|
537
|
-
}, null, 8, ["selectable"])) : item.actions ? (openBlock(), createBlock(_component_actions_column, {
|
|
538
|
-
columns: _ctx.columns,
|
|
539
|
-
config: item,
|
|
540
|
-
"rowkey-name": _ctx.rowkeyName,
|
|
541
|
-
"edit-state": _ctx.editState,
|
|
542
|
-
key: columnIndex,
|
|
543
|
-
onAfterAction: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("afterAction"))
|
|
544
|
-
}, null, 8, ["columns", "config", "rowkey-name", "edit-state"])) : item.type === "popover" ? (openBlock(), createBlock(_component_popover_column, {
|
|
545
|
-
key: columnIndex,
|
|
546
|
-
config: item
|
|
547
|
-
}, null, 8, ["config"])) : (openBlock(), createBlock(_component_text_column, {
|
|
548
|
-
key: columnIndex,
|
|
549
|
-
config: item,
|
|
550
|
-
"edit-state": _ctx.editState
|
|
551
|
-
}, null, 8, ["config", "edit-state"]))
|
|
552
|
-
], 64);
|
|
553
|
-
}), 256))
|
|
554
|
-
]),
|
|
555
|
-
_: 1
|
|
556
|
-
}, 8, ["data", "show-header", "max-height", "default-expand-all", "border", "row-key", "empty-text", "span-method", "onSortChange", "onSelect", "onSelectAll", "onSelectionChange"]);
|
|
557
|
-
}
|
|
558
|
-
var Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
559
|
-
|
|
560
|
-
const components = [Table];
|
|
561
|
-
var index = {
|
|
562
|
-
install(app) {
|
|
563
|
-
components.forEach((component) => {
|
|
564
|
-
app.component(component.name, component);
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
export { Table as MagicTable, index as default };
|
|
570
|
-
//# sourceMappingURL=tmagic-table.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tmagic-table.es.js","sources":["../src/ActionsColumn.vue","../plugin-vue:export-helper","../src/ExpandColumn.vue","../src/utils.ts","../src/PopoverColumn.vue","../src/TextColumn.vue","../src/Table.vue","../src/index.ts"],"sourcesContent":["<template>\n <el-table-column :label=\"config.label\" :width=\"config.width\" :fixed=\"config.fixed\">\n <template v-slot=\"scope\">\n <el-button\n v-for=\"(action, actionIndex) in config.actions\"\n v-show=\"display(action.display, scope.row) && !editState[scope.$index]\"\n v-html=\"action.text\"\n class=\"action-btn\"\n type=\"text\"\n size=\"small\"\n :key=\"actionIndex\"\n @click=\"actionHandler(action, scope.row, scope.$index)\"\n ></el-button>\n <el-button\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n type=\"text\"\n size=\"small\"\n @click=\"save(scope.$index, config)\"\n >保存</el-button\n >\n <el-button\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n type=\"text\"\n size=\"small\"\n @click=\"editState[scope.$index] = undefined\"\n >取消</el-button\n >\n </template>\n </el-table-column>\n</template>\n\n<script lang=\"ts\">\nimport { PropType } from 'vue';\nimport { ElMessage, ElMessageBox } from 'element-plus';\n\nimport { ColumnActionConfig, ColumnConfig } from './schema';\n</script>\n\n<script lang=\"ts\" setup>\nconst props = defineProps({\n columns: {\n type: Array as PropType<any[]>,\n require: true,\n default: () => [],\n },\n\n config: {\n type: Object as PropType<ColumnConfig>,\n require: true,\n default: () => {},\n },\n\n rowkeyName: {\n type: String,\n default: 'c_id',\n },\n\n editState: {\n type: Object,\n default: () => {},\n },\n});\n\nconst emit = defineEmits(['afterAction']);\n\nconst display = (fuc: boolean | Function | undefined, row: any) => {\n if (typeof fuc === 'function') {\n return fuc.call(this, this, row);\n }\n return true;\n};\n\nconst success = (msg: string, action: ColumnActionConfig) => {\n ElMessage.success(msg);\n action.after?.();\n};\n\nconst error = (msg: string) => ElMessage.error(msg);\n\nconst deleteAction = async (action: ColumnActionConfig, row: any) => {\n await ElMessageBox.confirm(`确认删除${row[action.name || 'c_name']}(${row[props.rowkeyName]})?`, '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning',\n });\n\n const res = await action.handler?.(row);\n\n if (res.ret === 0) {\n success('删除成功!', action);\n } else {\n error(res.msg || '删除失败');\n }\n};\n\nconst copyHandler = async (action: ColumnActionConfig, row: any) => {\n await ElMessageBox.confirm(`确定复制${row[action.name || 'c_name']}(${row.c_id})?`, '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning',\n });\n\n try {\n const res = await action.handler?.(row);\n\n if (res.ret === 0) {\n success('复制成功!', action);\n } else {\n error(`复制失败!${res.msg}`);\n }\n } catch (e) {\n error('复制失败!');\n }\n};\n\nconst actionHandler = async (action: ColumnActionConfig, row: any, index: number) => {\n if (action.type === 'delete') {\n await deleteAction(action, row);\n } else if (action.type === 'copy') {\n await copyHandler(action, row);\n } else if (action.type === 'edit') {\n props.editState[index] = row;\n } else {\n await action.handler?.(row);\n action.after?.();\n }\n};\n\nconst save = async (index: number, config: ColumnConfig) => {\n const action = config.actions?.find((item) => item.type === 'edit')?.action;\n if (!action) return;\n\n const data: any = {};\n const row = props.editState[index];\n props.columns\n .filter((item) => item.type)\n .forEach((column) => {\n data[column.prop] = row[column.prop];\n });\n\n const res: any = await action({\n data,\n });\n\n if (res) {\n if (res.ret === 0) {\n ElMessage.success('保存成功');\n props.editState[index] = undefined;\n emit('afterAction');\n } else {\n ElMessage.error({\n duration: 10000,\n showClose: true,\n dangerouslyUseHTMLString: true,\n message: res.msg || '保存失败',\n });\n }\n } else {\n props.editState[index] = undefined;\n emit('afterAction');\n }\n};\n</script>\n","\nexport default (sfc, props) => {\n const target = sfc.__vccOpts || sfc;\n for (const [key, val] of props) {\n target[key] = val;\n }\n return target;\n}\n","<template>\n <el-table-column type=\"expand\">\n <template #default=\"scope\">\n <m-table\n v-if=\"config.table\"\n :show-header=\"false\"\n :columns=\"config.table\"\n :data=\"scope.row[config.prop]\"\n ></m-table>\n <m-form\n v-if=\"config.form\"\n :config=\"config.form\"\n :init-values=\"config.values || scope.row[config.prop] || {}\"\n ></m-form>\n </template>\n </el-table-column>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\n\nimport { MForm } from '@tmagic/form';\n\nimport { ColumnConfig } from './schema';\n\nexport default defineComponent({\n components: { MForm },\n\n props: {\n config: {\n type: Object as PropType<ColumnConfig>,\n default: () => ({}),\n required: true,\n },\n },\n});\n</script>\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { datetimeFormatter } from '@tmagic/utils';\n\nimport { ColumnConfig } from './schema';\n\nexport const formatter = (item: ColumnConfig, row: any) => {\n if (item.formatter) {\n if (item.formatter === 'datetime') {\n // eslint-disable-next-line no-param-reassign\n item.formatter = (value: string) => datetimeFormatter(value);\n }\n try {\n return item.formatter(row[item.prop], row);\n } catch (e) {\n return row[item.prop];\n }\n } else {\n return row[item.prop];\n }\n};\n","<template>\n <el-table-column :label=\"config.label\" :width=\"config.width\" :fixed=\"config.fixed\">\n <template v-slot=\"scope\">\n <el-popover :placement=\"config.popover.placement\" :width=\"config.popover.width\" :trigger=\"config.popover.trigger\">\n <m-table\n v-if=\"config.popover.tableEmbed\"\n :show-header=\"config.showHeader\"\n :columns=\"config.table\"\n :data=\"scope.row[config.prop]\"\n ></m-table>\n <template #reference>\n <el-button type=\"text\"> {{ config.text || formatter(config, scope.row) }}</el-button>\n </template>\n </el-popover>\n </template>\n </el-table-column>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\n\nimport { ColumnConfig } from './schema';\nimport { formatter } from './utils';\n\nexport default defineComponent({\n props: {\n config: {\n type: Object as PropType<ColumnConfig>,\n default: () => ({}),\n required: true,\n },\n },\n\n setup() {\n return {\n formatter,\n };\n },\n});\n</script>\n","<template>\n <el-table-column\n show-overflow-tooltip\n :label=\"config.label\"\n :width=\"config.width\"\n :fixed=\"config.fixed\"\n :sortable=\"config.sortable\"\n :prop=\"config.prop\"\n >\n <template v-slot=\"scope\">\n <el-form v-if=\"config.type && editState[scope.$index]\" label-width=\"0\" :model=\"editState[scope.$index]\">\n <m-form-container\n :prop=\"config.prop\"\n :rules=\"config.rules\"\n :config=\"config\"\n :name=\"config.prop\"\n :model=\"editState[scope.$index]\"\n ></m-form-container>\n </el-form>\n\n <el-button v-else-if=\"config.action === 'actionLink'\" type=\"text\" @click=\"config.handler(scope.row)\">\n {{ formatter(config, scope.row) }}\n </el-button>\n\n <a v-else-if=\"config.action === 'img'\" target=\"_blank\" :href=\"scope.row[config.prop]\"\n ><img :src=\"scope.row[config.prop]\" height=\"50\"\n /></a>\n\n <a v-else-if=\"config.action === 'link'\" target=\"_blank\" :href=\"scope.row[config.prop]\" class=\"keep-all\">{{\n scope.row[config.prop]\n }}</a>\n\n <el-tooltip v-else-if=\"config.action === 'tip'\" placement=\"left\">\n <template #content>\n <div>{{ formatter(config, scope.row) }}</div>\n </template>\n <el-button type=\"text\">扩展配置</el-button>\n </el-tooltip>\n\n <el-tag\n v-else-if=\"config.action === 'tag'\"\n :type=\"typeof config.type === 'function' ? config.type(scope.row[config.prop], scope.row) : config.type\"\n close-transition\n >{{ formatter(config, scope.row) }}</el-tag\n >\n <div v-else v-html=\"formatter(config, scope.row)\"></div>\n </template>\n </el-table-column>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\n\nimport { ColumnConfig } from './schema';\nimport { formatter } from './utils';\n\nexport default defineComponent({\n props: {\n config: {\n type: Object as PropType<ColumnConfig>,\n default: () => ({}),\n required: true,\n },\n\n editState: {\n type: Object,\n default: () => {},\n },\n },\n\n setup() {\n return {\n formatter,\n };\n },\n});\n</script>\n","<template>\n <el-table\n :data=\"tableData\"\n :show-header=\"showHeader\"\n :max-height=\"bodyHeight\"\n tooltip-effect=\"dark\"\n class=\"m-table\"\n ref=\"table\"\n :default-expand-all=\"defaultExpandAll\"\n :border=\"hasBorder\"\n :row-key=\"rowkeyName || 'c_id'\"\n :tree-props=\"{ children: 'children' }\"\n :empty-text=\"emptyText || '暂无数据'\"\n :span-method=\"objectSpanMethod\"\n @sort-change=\"sortChange\"\n @select=\"selectHandler\"\n @select-all=\"selectAllHandler\"\n @selection-change=\"selectionChangeHandler\"\n >\n <template v-for=\"(item, columnIndex) in columns\">\n <template v-if=\"item.type === 'expand'\">\n <expand-column :config=\"item\" :key=\"columnIndex\"></expand-column>\n </template>\n\n <template v-if=\"item.selection\">\n <el-table-column type=\"selection\" :key=\"columnIndex\" width=\"40\" :selectable=\"item.selectable\"></el-table-column>\n </template>\n\n <template v-else-if=\"item.actions\">\n <actions-column\n :columns=\"columns\"\n :config=\"item\"\n :rowkey-name=\"rowkeyName\"\n :edit-state=\"editState\"\n :key=\"columnIndex\"\n @afterAction=\"$emit('afterAction')\"\n ></actions-column>\n </template>\n\n <template v-else-if=\"item.type === 'popover'\">\n <popover-column :key=\"columnIndex\" :config=\"item\"></popover-column>\n </template>\n\n <template v-else>\n <text-column :key=\"columnIndex\" :config=\"item\" :edit-state=\"editState\"></text-column>\n </template>\n </template>\n </el-table>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\nimport { ElTable } from 'element-plus';\nimport { cloneDeep } from 'lodash-es';\n\nimport ActionsColumn from './ActionsColumn.vue';\nimport ExpandColumn from './ExpandColumn.vue';\nimport PopoverColumn from './PopoverColumn.vue';\nimport TextColumn from './TextColumn.vue';\n\nexport default defineComponent({\n name: 'm-table',\n\n components: { ExpandColumn, ActionsColumn, PopoverColumn, TextColumn },\n\n props: {\n data: {\n type: Array,\n require: true,\n },\n\n columns: {\n type: Array as PropType<any[]>,\n require: true,\n default: () => [],\n },\n\n /** 合并行或列的计算方法 */\n spanMethod: {\n type: Function as PropType<\n (data: { row: any; column: any; rowIndex: number; columnIndex: number }) => [number, number]\n >,\n },\n\n fetch: {\n type: Boolean,\n default: false,\n },\n\n /** Table 的最大高度。合法的值为数字或者单位为 px 的高度 */\n bodyHeight: {\n type: [String, Number],\n },\n\n /** 是否显示表头 */\n showHeader: {\n type: Boolean,\n },\n\n /** 空数据时显示的文本内容 */\n emptyText: {\n type: String,\n },\n\n /** 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */\n defaultExpandAll: {\n type: Boolean,\n default: false,\n },\n\n rowkeyName: {\n type: String,\n },\n\n /** 是否带有纵向边框 */\n border: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: ['sort-change', 'afterAction', 'select', 'select-all', 'selection-change'],\n\n data(): {\n editState: any[];\n } {\n return {\n editState: [],\n };\n },\n\n computed: {\n tableData() {\n if (this.selectionColumn) {\n return this.data || [];\n }\n\n return cloneDeep(this.data) || [];\n },\n\n selectionColumn() {\n const column = this.columns.filter((item) => item.selection);\n return column.length ? column[0] : null;\n },\n\n hasBorder() {\n return typeof this.border !== 'undefined' ? this.border : true;\n },\n },\n\n methods: {\n sortChange(data: any) {\n this.$emit('sort-change', data);\n },\n\n selectHandler(selection: any, row: any) {\n const column = this.selectionColumn;\n if (!column) {\n return;\n }\n\n if (column.selection === 'single') {\n // this.clearSelection()\n // this.toggleRowSelection(row, true)\n }\n this.$emit('select', selection, row);\n },\n\n selectAllHandler(selection: any) {\n this.$emit('select-all', selection);\n },\n\n selectionChangeHandler(selection: any) {\n this.$emit('selection-change', selection);\n },\n\n toggleRowSelection(row: any, selected: boolean) {\n const table = this.$refs.table as InstanceType<typeof ElTable>;\n table.toggleRowSelection.bind(table)(row, selected);\n },\n\n toggleRowExpansion(row: any, expanded: boolean) {\n const table = this.$refs.table as InstanceType<typeof ElTable>;\n table.toggleRowExpansion.bind(table)(row, expanded);\n },\n\n clearSelection() {\n const table = this.$refs.table as InstanceType<typeof ElTable>;\n table.clearSelection.bind(table)();\n },\n\n objectSpanMethod(data: any) {\n if (typeof this.spanMethod === 'function') {\n return this.spanMethod(data);\n }\n return () => ({\n rowspan: 0,\n colspan: 0,\n });\n },\n },\n});\n</script>\n\n<style lang=\"scss\">\n.m-table {\n .el-button.action-btn {\n margin-right: 10px;\n }\n .el-button.action-btn + .el-button.action-btn {\n margin-left: 0;\n }\n .keep-all {\n word-break: keep-all;\n }\n .el-table .cell > div {\n display: inline-block;\n vertical-align: middle;\n }\n .el-table__row.el-table__row--level-1 {\n color: #999;\n }\n}\n</style>\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { App } from 'vue';\n\nimport Table from './Table.vue';\n\nexport { default as MagicTable } from './Table.vue';\n\nconst components = [Table];\n\nexport default {\n install(app: App) {\n components.forEach((component) => {\n app.component(component.name, component);\n });\n },\n};\n"],"names":["_sfc_main","_openBlock","_createBlock","_withCtx","_createCommentVNode","_toDisplayString","ActionsColumn","_createElementBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,UAAM,UAAU,CAAC,KAAqC,QAAa;AACjE,UAAI,OAAO,QAAQ,YAAY;AAC7B,eAAO,IAAI,KAAK,MAAM,MAAM;AAAA;AAE9B,aAAO;AAAA;AAGT,UAAM,UAAU,CAAC,KAAa,WAA+B;AAC3D,gBAAU,QAAQ;AAClB,aAAO;AAAA;AAGT,UAAM,QAAQ,CAAC,QAAgB,UAAU,MAAM;AAE/C,UAAM,eAAe,OAAO,QAA4B,QAAa;AACnE,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