@tmagic/table 1.3.0-alpha.2 → 1.3.0-alpha.21
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/dist/tmagic-table.js +163 -120
- package/dist/tmagic-table.js.map +1 -1
- package/dist/tmagic-table.umd.cjs +161 -118
- package/dist/tmagic-table.umd.cjs.map +1 -1
- package/package.json +12 -13
- package/src/ActionsColumn.vue +22 -12
- package/src/ComponentColumn.vue +40 -0
- package/src/ExpandColumn.vue +5 -1
- package/src/PopoverColumn.vue +5 -1
- package/src/Table.vue +12 -3
- package/src/TextColumn.vue +6 -2
- package/src/schema.ts +6 -2
- package/types/ActionsColumn.vue.d.ts +6 -3
- package/types/ComponentColumn.vue.d.ts +30 -0
- package/types/ExpandColumn.vue.d.ts +7 -4
- package/types/PopoverColumn.vue.d.ts +7 -4
- package/types/Table.vue.d.ts +6 -3
- package/types/TextColumn.vue.d.ts +7 -4
- package/types/schema.d.ts +6 -2
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
})(this, (function (exports, vue, lodashEs, design, form, utils) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _hoisted_1$2 = ["innerHTML"];
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
14
|
-
...__default__$4,
|
|
8
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
9
|
+
...{
|
|
10
|
+
name: "MTableActionsColumn"
|
|
11
|
+
},
|
|
12
|
+
__name: "ActionsColumn",
|
|
15
13
|
props: {
|
|
16
14
|
columns: { default: () => [] },
|
|
17
15
|
config: { default: () => ({}) },
|
|
@@ -69,58 +67,67 @@
|
|
|
69
67
|
};
|
|
70
68
|
return (_ctx, _cache) => {
|
|
71
69
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
|
|
72
|
-
label:
|
|
73
|
-
width:
|
|
74
|
-
fixed:
|
|
70
|
+
label: _ctx.config.label,
|
|
71
|
+
width: _ctx.config.width,
|
|
72
|
+
fixed: _ctx.config.fixed
|
|
75
73
|
}, {
|
|
76
74
|
default: vue.withCtx((scope) => [
|
|
77
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
78
|
-
return vue.
|
|
79
|
-
|
|
80
|
-
text: "",
|
|
81
|
-
type: action.buttonType || "primary",
|
|
82
|
-
size: "small",
|
|
83
|
-
icon: action.icon,
|
|
75
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.actions, (action, actionIndex) => {
|
|
76
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
77
|
+
placement: action.tooltipPlacement || "top",
|
|
84
78
|
key: actionIndex,
|
|
85
|
-
|
|
79
|
+
disabled: !Boolean(action.tooltip),
|
|
80
|
+
content: action.tooltip
|
|
86
81
|
}, {
|
|
87
82
|
default: vue.withCtx(() => [
|
|
88
|
-
vue.
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
|
|
84
|
+
class: "action-btn",
|
|
85
|
+
text: "",
|
|
86
|
+
size: "small",
|
|
87
|
+
type: action.buttonType || "primary",
|
|
88
|
+
icon: action.icon,
|
|
89
|
+
onClick: ($event) => actionHandler(action, scope.row, scope.$index)
|
|
90
|
+
}, {
|
|
91
|
+
default: vue.withCtx(() => [
|
|
92
|
+
vue.createElementVNode("span", {
|
|
93
|
+
innerHTML: formatter(action.text, scope.row)
|
|
94
|
+
}, null, 8, _hoisted_1$2)
|
|
95
|
+
]),
|
|
96
|
+
_: 2
|
|
97
|
+
}, 1032, ["type", "icon", "onClick"]), [
|
|
98
|
+
[vue.vShow, display(action.display, scope.row) && !_ctx.editState[scope.$index]]
|
|
99
|
+
])
|
|
91
100
|
]),
|
|
92
101
|
_: 2
|
|
93
|
-
}, 1032, ["
|
|
94
|
-
[vue.vShow, display(action.display, scope.row) && !__props.editState[scope.$index]]
|
|
95
|
-
]);
|
|
102
|
+
}, 1032, ["placement", "disabled", "content"]);
|
|
96
103
|
}), 128)),
|
|
97
104
|
vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
|
|
98
105
|
class: "action-btn",
|
|
99
106
|
text: "",
|
|
100
107
|
type: "primary",
|
|
101
108
|
size: "small",
|
|
102
|
-
onClick: ($event) => save(scope.$index,
|
|
109
|
+
onClick: ($event) => save(scope.$index, _ctx.config)
|
|
103
110
|
}, {
|
|
104
111
|
default: vue.withCtx(() => [
|
|
105
|
-
|
|
112
|
+
vue.createTextVNode("保存")
|
|
106
113
|
]),
|
|
107
114
|
_: 2
|
|
108
115
|
}, 1032, ["onClick"]), [
|
|
109
|
-
[vue.vShow,
|
|
116
|
+
[vue.vShow, _ctx.editState[scope.$index]]
|
|
110
117
|
]),
|
|
111
118
|
vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
|
|
112
119
|
class: "action-btn",
|
|
113
120
|
text: "",
|
|
114
121
|
type: "primary",
|
|
115
122
|
size: "small",
|
|
116
|
-
onClick: ($event) =>
|
|
123
|
+
onClick: ($event) => _ctx.editState[scope.$index] = void 0
|
|
117
124
|
}, {
|
|
118
125
|
default: vue.withCtx(() => [
|
|
119
|
-
|
|
126
|
+
vue.createTextVNode("取消")
|
|
120
127
|
]),
|
|
121
128
|
_: 2
|
|
122
129
|
}, 1032, ["onClick"]), [
|
|
123
|
-
[vue.vShow,
|
|
130
|
+
[vue.vShow, _ctx.editState[scope.$index]]
|
|
124
131
|
])
|
|
125
132
|
]),
|
|
126
133
|
_: 1
|
|
@@ -129,12 +136,46 @@
|
|
|
129
136
|
}
|
|
130
137
|
});
|
|
131
138
|
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
140
|
+
...{
|
|
141
|
+
name: "MTableColumn"
|
|
142
|
+
},
|
|
143
|
+
__name: "ComponentColumn",
|
|
144
|
+
props: {
|
|
145
|
+
config: { default: () => ({}) }
|
|
146
|
+
},
|
|
147
|
+
setup(__props) {
|
|
148
|
+
const props = __props;
|
|
149
|
+
const componentProps = (row) => {
|
|
150
|
+
if (typeof props.config.props === "function") {
|
|
151
|
+
return props.config.props(row) || {};
|
|
152
|
+
}
|
|
153
|
+
return props.config.props || {};
|
|
154
|
+
};
|
|
155
|
+
return (_ctx, _cache) => {
|
|
156
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
|
|
157
|
+
"show-overflow-tooltip": "",
|
|
158
|
+
label: _ctx.config.label,
|
|
159
|
+
width: _ctx.config.width,
|
|
160
|
+
fixed: _ctx.config.fixed,
|
|
161
|
+
sortable: _ctx.config.sortable,
|
|
162
|
+
prop: _ctx.config.prop
|
|
163
|
+
}, {
|
|
164
|
+
default: vue.withCtx((scope) => [
|
|
165
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.component), vue.normalizeProps(vue.guardReactiveProps(componentProps(scope.row))), null, 16))
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["label", "width", "fixed", "sortable", "prop"]);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
135
171
|
});
|
|
172
|
+
|
|
173
|
+
const _hoisted_1$1 = ["innerHTML"];
|
|
136
174
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
137
|
-
...
|
|
175
|
+
...{
|
|
176
|
+
name: "MTableExpandColumn"
|
|
177
|
+
},
|
|
178
|
+
__name: "ExpandColumn",
|
|
138
179
|
props: {
|
|
139
180
|
config: { default: () => ({}) }
|
|
140
181
|
},
|
|
@@ -149,22 +190,22 @@
|
|
|
149
190
|
return (_ctx, _cache) => {
|
|
150
191
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), { type: "expand" }, {
|
|
151
192
|
default: vue.withCtx((scope) => [
|
|
152
|
-
|
|
193
|
+
_ctx.config.table ? (vue.openBlock(), vue.createBlock(_sfc_main, {
|
|
153
194
|
key: 0,
|
|
154
195
|
"show-header": false,
|
|
155
|
-
columns:
|
|
156
|
-
data:
|
|
196
|
+
columns: _ctx.config.table,
|
|
197
|
+
data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
|
|
157
198
|
}, null, 8, ["columns", "data"])) : vue.createCommentVNode("", true),
|
|
158
|
-
|
|
199
|
+
_ctx.config.form ? (vue.openBlock(), vue.createBlock(vue.unref(form.MForm), {
|
|
159
200
|
key: 1,
|
|
160
|
-
config:
|
|
161
|
-
"init-values":
|
|
201
|
+
config: _ctx.config.form,
|
|
202
|
+
"init-values": _ctx.config.values || _ctx.config.prop && scope.row[_ctx.config.prop] || {}
|
|
162
203
|
}, null, 8, ["config", "init-values"])) : vue.createCommentVNode("", true),
|
|
163
|
-
|
|
204
|
+
_ctx.config.expandContent ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
164
205
|
key: 2,
|
|
165
|
-
innerHTML:
|
|
206
|
+
innerHTML: _ctx.config.expandContent(scope.row, _ctx.config.prop)
|
|
166
207
|
}, null, 8, _hoisted_1$1)) : vue.createCommentVNode("", true),
|
|
167
|
-
|
|
208
|
+
_ctx.config.component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.component), vue.normalizeProps(vue.mergeProps({ key: 3 }, componentProps(scope.row))), null, 16)) : vue.createCommentVNode("", true)
|
|
168
209
|
]),
|
|
169
210
|
_: 1
|
|
170
211
|
});
|
|
@@ -189,27 +230,27 @@
|
|
|
189
230
|
}
|
|
190
231
|
};
|
|
191
232
|
|
|
192
|
-
const __default__$2 = vue.defineComponent({
|
|
193
|
-
name: "MTablePopoverColumn"
|
|
194
|
-
});
|
|
195
233
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
196
|
-
...
|
|
234
|
+
...{
|
|
235
|
+
name: "MTablePopoverColumn"
|
|
236
|
+
},
|
|
237
|
+
__name: "PopoverColumn",
|
|
197
238
|
props: {
|
|
198
239
|
config: { default: () => ({}) }
|
|
199
240
|
},
|
|
200
241
|
setup(__props) {
|
|
201
242
|
return (_ctx, _cache) => {
|
|
202
243
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
|
|
203
|
-
label:
|
|
204
|
-
width:
|
|
205
|
-
fixed:
|
|
244
|
+
label: _ctx.config.label,
|
|
245
|
+
width: _ctx.config.width,
|
|
246
|
+
fixed: _ctx.config.fixed
|
|
206
247
|
}, {
|
|
207
248
|
default: vue.withCtx((scope) => [
|
|
208
|
-
|
|
249
|
+
_ctx.config.popover ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
|
|
209
250
|
key: 0,
|
|
210
|
-
placement:
|
|
211
|
-
width:
|
|
212
|
-
trigger:
|
|
251
|
+
placement: _ctx.config.popover.placement,
|
|
252
|
+
width: _ctx.config.popover.width,
|
|
253
|
+
trigger: _ctx.config.popover.trigger
|
|
213
254
|
}, {
|
|
214
255
|
reference: vue.withCtx(() => [
|
|
215
256
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -217,17 +258,17 @@
|
|
|
217
258
|
type: "primary"
|
|
218
259
|
}, {
|
|
219
260
|
default: vue.withCtx(() => [
|
|
220
|
-
vue.createTextVNode(vue.toDisplayString(
|
|
261
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.config.text || vue.unref(formatter)(_ctx.config, scope.row)), 1)
|
|
221
262
|
]),
|
|
222
263
|
_: 2
|
|
223
264
|
}, 1024)
|
|
224
265
|
]),
|
|
225
266
|
default: vue.withCtx(() => [
|
|
226
|
-
|
|
267
|
+
_ctx.config.popover.tableEmbed ? (vue.openBlock(), vue.createBlock(_sfc_main, {
|
|
227
268
|
key: 0,
|
|
228
|
-
"show-header":
|
|
229
|
-
columns:
|
|
230
|
-
data:
|
|
269
|
+
"show-header": _ctx.config.showHeader,
|
|
270
|
+
columns: _ctx.config.table,
|
|
271
|
+
data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
|
|
231
272
|
}, null, 8, ["show-header", "columns", "data"])) : vue.createCommentVNode("", true)
|
|
232
273
|
]),
|
|
233
274
|
_: 2
|
|
@@ -243,13 +284,12 @@
|
|
|
243
284
|
const _hoisted_2 = ["href"];
|
|
244
285
|
const _hoisted_3 = ["src"];
|
|
245
286
|
const _hoisted_4 = ["href"];
|
|
246
|
-
const _hoisted_5 =
|
|
247
|
-
const _hoisted_6 = ["innerHTML"];
|
|
248
|
-
const __default__$1 = vue.defineComponent({
|
|
249
|
-
name: "MTableColumn"
|
|
250
|
-
});
|
|
287
|
+
const _hoisted_5 = ["innerHTML"];
|
|
251
288
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
252
|
-
...
|
|
289
|
+
...{
|
|
290
|
+
name: "MTableColumn"
|
|
291
|
+
},
|
|
292
|
+
__name: "TextColumn",
|
|
253
293
|
props: {
|
|
254
294
|
config: { default: () => ({}) },
|
|
255
295
|
editState: { default: () => ({}) }
|
|
@@ -260,60 +300,60 @@
|
|
|
260
300
|
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
261
301
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
|
|
262
302
|
"show-overflow-tooltip": "",
|
|
263
|
-
label:
|
|
264
|
-
width:
|
|
265
|
-
fixed:
|
|
266
|
-
sortable:
|
|
267
|
-
prop:
|
|
303
|
+
label: _ctx.config.label,
|
|
304
|
+
width: _ctx.config.width,
|
|
305
|
+
fixed: _ctx.config.fixed,
|
|
306
|
+
sortable: _ctx.config.sortable,
|
|
307
|
+
prop: _ctx.config.prop
|
|
268
308
|
}, {
|
|
269
309
|
default: vue.withCtx((scope) => [
|
|
270
|
-
|
|
310
|
+
_ctx.config.type && _ctx.editState[scope.$index] ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicForm), {
|
|
271
311
|
key: 0,
|
|
272
312
|
"label-width": "0",
|
|
273
|
-
model:
|
|
313
|
+
model: _ctx.editState[scope.$index]
|
|
274
314
|
}, {
|
|
275
315
|
default: vue.withCtx(() => [
|
|
276
316
|
vue.createVNode(_component_m_form_container, {
|
|
277
|
-
prop:
|
|
278
|
-
rules:
|
|
279
|
-
config:
|
|
280
|
-
name:
|
|
281
|
-
model:
|
|
317
|
+
prop: _ctx.config.prop,
|
|
318
|
+
rules: _ctx.config.rules,
|
|
319
|
+
config: _ctx.config,
|
|
320
|
+
name: _ctx.config.prop,
|
|
321
|
+
model: _ctx.editState[scope.$index]
|
|
282
322
|
}, null, 8, ["prop", "rules", "config", "name", "model"])
|
|
283
323
|
]),
|
|
284
324
|
_: 2
|
|
285
|
-
}, 1032, ["model"])) :
|
|
325
|
+
}, 1032, ["model"])) : _ctx.config.action === "actionLink" && _ctx.config.prop ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
286
326
|
key: 1,
|
|
287
327
|
text: "",
|
|
288
328
|
type: "primary",
|
|
289
|
-
onClick: ($event) =>
|
|
329
|
+
onClick: ($event) => _ctx.config.handler?.(scope.row)
|
|
290
330
|
}, {
|
|
291
331
|
default: vue.withCtx(() => [
|
|
292
332
|
vue.createElementVNode("span", {
|
|
293
|
-
innerHTML: vue.unref(formatter)(
|
|
333
|
+
innerHTML: vue.unref(formatter)(_ctx.config, scope.row)
|
|
294
334
|
}, null, 8, _hoisted_1)
|
|
295
335
|
]),
|
|
296
336
|
_: 2
|
|
297
|
-
}, 1032, ["onClick"])) :
|
|
337
|
+
}, 1032, ["onClick"])) : _ctx.config.action === "img" && _ctx.config.prop ? (vue.openBlock(), vue.createElementBlock("a", {
|
|
298
338
|
key: 2,
|
|
299
339
|
target: "_blank",
|
|
300
|
-
href: scope.row[
|
|
340
|
+
href: scope.row[_ctx.config.prop]
|
|
301
341
|
}, [
|
|
302
342
|
vue.createElementVNode("img", {
|
|
303
|
-
src: scope.row[
|
|
343
|
+
src: scope.row[_ctx.config.prop],
|
|
304
344
|
height: "50"
|
|
305
345
|
}, null, 8, _hoisted_3)
|
|
306
|
-
], 8, _hoisted_2)) :
|
|
346
|
+
], 8, _hoisted_2)) : _ctx.config.action === "link" && _ctx.config.prop ? (vue.openBlock(), vue.createElementBlock("a", {
|
|
307
347
|
key: 3,
|
|
308
348
|
target: "_blank",
|
|
309
|
-
href: scope.row[
|
|
349
|
+
href: scope.row[_ctx.config.prop],
|
|
310
350
|
class: "keep-all"
|
|
311
|
-
}, vue.toDisplayString(scope.row[
|
|
351
|
+
}, vue.toDisplayString(scope.row[_ctx.config.prop]), 9, _hoisted_4)) : _ctx.config.action === "tip" ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
312
352
|
key: 4,
|
|
313
353
|
placement: "left"
|
|
314
354
|
}, {
|
|
315
355
|
content: vue.withCtx(() => [
|
|
316
|
-
vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(formatter)(
|
|
356
|
+
vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(formatter)(_ctx.config, scope.row)), 1)
|
|
317
357
|
]),
|
|
318
358
|
default: vue.withCtx(() => [
|
|
319
359
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -321,25 +361,25 @@
|
|
|
321
361
|
type: "primary"
|
|
322
362
|
}, {
|
|
323
363
|
default: vue.withCtx(() => [
|
|
324
|
-
|
|
364
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.config.buttonText || "扩展配置"), 1)
|
|
325
365
|
]),
|
|
326
366
|
_: 1
|
|
327
367
|
})
|
|
328
368
|
]),
|
|
329
369
|
_: 2
|
|
330
|
-
}, 1024)) :
|
|
370
|
+
}, 1024)) : _ctx.config.action === "tag" && _ctx.config.prop ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
|
|
331
371
|
key: 5,
|
|
332
|
-
type: typeof
|
|
372
|
+
type: typeof _ctx.config.type === "function" ? _ctx.config.type(scope.row[_ctx.config.prop], scope.row) : _ctx.config.type,
|
|
333
373
|
"close-transition": ""
|
|
334
374
|
}, {
|
|
335
375
|
default: vue.withCtx(() => [
|
|
336
|
-
vue.createTextVNode(vue.toDisplayString(vue.unref(formatter)(
|
|
376
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(formatter)(_ctx.config, scope.row)), 1)
|
|
337
377
|
]),
|
|
338
378
|
_: 2
|
|
339
379
|
}, 1032, ["type"])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
340
380
|
key: 6,
|
|
341
|
-
innerHTML: vue.unref(formatter)(
|
|
342
|
-
}, null, 8,
|
|
381
|
+
innerHTML: vue.unref(formatter)(_ctx.config, scope.row)
|
|
382
|
+
}, null, 8, _hoisted_5))
|
|
343
383
|
]),
|
|
344
384
|
_: 1
|
|
345
385
|
}, 8, ["label", "width", "fixed", "sortable", "prop"]);
|
|
@@ -347,21 +387,21 @@
|
|
|
347
387
|
}
|
|
348
388
|
});
|
|
349
389
|
|
|
350
|
-
const __default__ = vue.defineComponent({
|
|
351
|
-
name: "MTable"
|
|
352
|
-
});
|
|
353
390
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
354
|
-
...
|
|
391
|
+
...{
|
|
392
|
+
name: "MTable"
|
|
393
|
+
},
|
|
394
|
+
__name: "Table",
|
|
355
395
|
props: {
|
|
356
|
-
data:
|
|
396
|
+
data: {},
|
|
357
397
|
columns: { default: () => [] },
|
|
358
|
-
spanMethod:
|
|
398
|
+
spanMethod: {},
|
|
359
399
|
loading: { type: Boolean, default: false },
|
|
360
|
-
bodyHeight:
|
|
400
|
+
bodyHeight: {},
|
|
361
401
|
showHeader: { type: Boolean, default: true },
|
|
362
|
-
emptyText:
|
|
402
|
+
emptyText: {},
|
|
363
403
|
defaultExpandAll: { type: Boolean, default: false },
|
|
364
|
-
rowkeyName:
|
|
404
|
+
rowkeyName: {},
|
|
365
405
|
border: { type: Boolean, default: false }
|
|
366
406
|
},
|
|
367
407
|
emits: [
|
|
@@ -373,11 +413,11 @@
|
|
|
373
413
|
"expand-change",
|
|
374
414
|
"cell-click"
|
|
375
415
|
],
|
|
376
|
-
setup(__props, { expose, emit }) {
|
|
416
|
+
setup(__props, { expose: __expose, emit }) {
|
|
377
417
|
const props = __props;
|
|
378
418
|
const tMagicTable = vue.ref();
|
|
379
419
|
const editState = vue.ref([]);
|
|
380
|
-
const tableColumnComponent = design.getConfig("components")
|
|
420
|
+
const tableColumnComponent = design.getConfig("components")?.tableColumn;
|
|
381
421
|
const selectionColumn = vue.computed(() => {
|
|
382
422
|
const column = props.columns.filter((item) => item.selection);
|
|
383
423
|
return column.length ? column[0] : null;
|
|
@@ -430,7 +470,7 @@
|
|
|
430
470
|
colspan: 0
|
|
431
471
|
});
|
|
432
472
|
};
|
|
433
|
-
|
|
473
|
+
__expose({
|
|
434
474
|
toggleRowSelection,
|
|
435
475
|
toggleRowExpansion,
|
|
436
476
|
clearSelection
|
|
@@ -442,14 +482,14 @@
|
|
|
442
482
|
class: "m-table",
|
|
443
483
|
ref_key: "tMagicTable",
|
|
444
484
|
ref: tMagicTable,
|
|
445
|
-
data:
|
|
446
|
-
"show-header":
|
|
447
|
-
"max-height":
|
|
448
|
-
"default-expand-all":
|
|
449
|
-
border:
|
|
450
|
-
"row-key":
|
|
485
|
+
data: tableData.value,
|
|
486
|
+
"show-header": _ctx.showHeader,
|
|
487
|
+
"max-height": _ctx.bodyHeight,
|
|
488
|
+
"default-expand-all": _ctx.defaultExpandAll,
|
|
489
|
+
border: hasBorder.value,
|
|
490
|
+
"row-key": _ctx.rowkeyName || "id",
|
|
451
491
|
"tree-props": { children: "children" },
|
|
452
|
-
"empty-text":
|
|
492
|
+
"empty-text": _ctx.emptyText || "暂无数据",
|
|
453
493
|
"span-method": objectSpanMethod,
|
|
454
494
|
onSortChange: sortChange,
|
|
455
495
|
onSelect: selectHandler,
|
|
@@ -459,20 +499,23 @@
|
|
|
459
499
|
onExpandChange: expandChange
|
|
460
500
|
}, {
|
|
461
501
|
default: vue.withCtx(() => [
|
|
462
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
502
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.columns, (item, columnIndex) => {
|
|
463
503
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
464
504
|
item.type === "expand" ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
|
|
465
505
|
config: item,
|
|
466
506
|
key: columnIndex
|
|
467
|
-
}, null, 8, ["config"])) : item.
|
|
507
|
+
}, null, 8, ["config"])) : item.type === "component" ? (vue.openBlock(), vue.createBlock(_sfc_main$4, {
|
|
508
|
+
config: item,
|
|
509
|
+
key: columnIndex
|
|
510
|
+
}, null, 8, ["config"])) : item.selection ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tableColumnComponent)?.component || "el-table-column"), {
|
|
468
511
|
width: "40",
|
|
469
512
|
type: "selection",
|
|
470
513
|
key: columnIndex,
|
|
471
514
|
selectable: item.selectable
|
|
472
|
-
}, null, 8, ["selectable"])) : item.actions ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
473
|
-
columns:
|
|
515
|
+
}, null, 8, ["selectable"])) : item.actions ? (vue.openBlock(), vue.createBlock(_sfc_main$5, {
|
|
516
|
+
columns: _ctx.columns,
|
|
474
517
|
config: item,
|
|
475
|
-
"rowkey-name":
|
|
518
|
+
"rowkey-name": _ctx.rowkeyName,
|
|
476
519
|
"edit-state": editState.value,
|
|
477
520
|
key: columnIndex,
|
|
478
521
|
onAfterAction: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("after-action"))
|
|
@@ -489,7 +532,7 @@
|
|
|
489
532
|
]),
|
|
490
533
|
_: 1
|
|
491
534
|
}, 8, ["data", "show-header", "max-height", "default-expand-all", "border", "row-key", "empty-text"])), [
|
|
492
|
-
[_directive_loading,
|
|
535
|
+
[_directive_loading, _ctx.loading]
|
|
493
536
|
]);
|
|
494
537
|
};
|
|
495
538
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tmagic-table.umd.cjs","sources":["../src/ActionsColumn.vue","../src/ExpandColumn.vue","../src/utils.ts","../src/PopoverColumn.vue","../src/TextColumn.vue","../src/Table.vue","../src/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nexport default defineComponent({\n name: 'MTableActionsColumn',\n})\n</script>\n<template>\n <TMagicTableColumn :label=\"config.label\" :width=\"config.width\" :fixed=\"config.fixed\">\n <template v-slot=\"scope\">\n <TMagicButton\n v-for=\"(action, actionIndex) in config.actions\"\n v-show=\"display(action.display, scope.row) && !editState[scope.$index]\"\n class=\"action-btn\"\n text\n :type=\"action.buttonType || 'primary'\"\n size=\"small\"\n :icon=\"action.icon\"\n :key=\"actionIndex\"\n @click=\"actionHandler(action, scope.row, scope.$index)\"\n ><span v-html=\"formatter(action.text, scope.row)\"></span\n ></TMagicButton>\n <TMagicButton\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n text\n type=\"primary\"\n size=\"small\"\n @click=\"save(scope.$index, config)\"\n >保存</TMagicButton\n >\n <TMagicButton\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n text\n type=\"primary\"\n size=\"small\"\n @click=\"editState[scope.$index] = undefined\"\n >取消</TMagicButton\n >\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup name=\"MTableActionsColumn\">\nimport { TMagicButton, tMagicMessage, TMagicTableColumn } from '@tmagic/design';\n\nimport { ColumnActionConfig, ColumnConfig } from './schema';\n\nconst props = withDefaults(\n defineProps<{\n columns: any[];\n config: ColumnConfig;\n rowkeyName?: string;\n editState?: any;\n }>(),\n {\n columns: () => [],\n config: () => ({}),\n rowkeyName: 'c_id',\n editState: () => [],\n },\n);\n\nconst emit = defineEmits(['after-action']);\n\nconst display = (fuc: boolean | Function | undefined, row: any) => {\n if (typeof fuc === 'function') {\n return fuc(row);\n }\n return true;\n};\n\nconst formatter = (fuc: string | Function | undefined, row: any) => {\n if (typeof fuc === 'function') {\n return fuc(row);\n }\n return fuc;\n};\n\nconst actionHandler = async (action: ColumnActionConfig, row: any, index: number) => {\n await action.before?.(row, index);\n if (action.type === 'edit') {\n props.editState[index] = row;\n } else {\n await action.handler?.(row, index);\n }\n action.after?.(row, index);\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 tMagicMessage.success('保存成功');\n props.editState[index] = undefined;\n emit('after-action');\n } else {\n tMagicMessage.error(res.msg || '保存失败');\n }\n } else {\n props.editState[index] = undefined;\n emit('after-action');\n }\n};\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nexport default defineComponent({\n name: 'MTableExpandColumn',\n})\n</script>\n<template>\n <TMagicTableColumn type=\"expand\">\n <template #default=\"scope\">\n <MTable\n v-if=\"config.table\"\n :show-header=\"false\"\n :columns=\"config.table\"\n :data=\"(config.prop && scope.row[config.prop]) || []\"\n ></MTable>\n <MForm\n v-if=\"config.form\"\n :config=\"config.form\"\n :init-values=\"config.values || (config.prop && scope.row[config.prop]) || {}\"\n ></MForm>\n <div v-if=\"config.expandContent\" v-html=\"config.expandContent(scope.row, config.prop)\"></div>\n <component v-if=\"config.component\" :is=\"config.component\" v-bind=\"componentProps(scope.row)\"></component>\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup name=\"MTableExpandColumn\">\nimport { TMagicTableColumn } from '@tmagic/design';\nimport { MForm } from '@tmagic/form';\n\nimport { ColumnConfig } from './schema';\nimport MTable from './Table.vue';\n\nconst props = withDefaults(\n defineProps<{\n config: ColumnConfig;\n }>(),\n {\n config: () => ({}),\n },\n);\n\nconst componentProps = (row: any) => {\n if (typeof props.config.props === 'function') {\n return props.config.props(row) || {};\n }\n return props.config.props || {};\n};\n</script>\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2023 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.prop) return '';\n\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","<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nexport default defineComponent({\n name: 'MTablePopoverColumn',\n})\n</script>\n<template>\n <TMagicTableColumn :label=\"config.label\" :width=\"config.width\" :fixed=\"config.fixed\">\n <template v-slot=\"scope\">\n <TMagicPopover\n v-if=\"config.popover\"\n :placement=\"config.popover.placement\"\n :width=\"config.popover.width\"\n :trigger=\"config.popover.trigger\"\n >\n <MTable\n v-if=\"config.popover.tableEmbed\"\n :show-header=\"config.showHeader\"\n :columns=\"config.table\"\n :data=\"(config.prop && scope.row[config.prop]) || []\"\n ></MTable>\n <template #reference>\n <TMagicButton text type=\"primary\"> {{ config.text || formatter(config, scope.row) }}</TMagicButton>\n </template>\n </TMagicPopover>\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup name=\"MTablePopoverColumn\">\nimport { TMagicButton, TMagicPopover, TMagicTableColumn } from '@tmagic/design';\n\nimport { ColumnConfig } from './schema';\nimport MTable from './Table.vue';\nimport { formatter } from './utils';\n\nwithDefaults(\n defineProps<{\n config: ColumnConfig;\n }>(),\n {\n config: () => ({}),\n },\n);\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nexport default defineComponent({\n name: 'MTableColumn',\n})\n</script>\n<template>\n <TMagicTableColumn\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 <TMagicForm 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 </TMagicForm>\n\n <TMagicButton\n v-else-if=\"config.action === 'actionLink' && config.prop\"\n text\n type=\"primary\"\n @click=\"config.handler?.(scope.row)\"\n >\n <span v-html=\"formatter(config, scope.row)\"></span>\n </TMagicButton>\n\n <a v-else-if=\"config.action === 'img' && config.prop\" target=\"_blank\" :href=\"scope.row[config.prop]\"\n ><img :src=\"scope.row[config.prop]\" height=\"50\"\n /></a>\n\n <a\n v-else-if=\"config.action === 'link' && config.prop\"\n target=\"_blank\"\n :href=\"scope.row[config.prop]\"\n class=\"keep-all\"\n >{{ scope.row[config.prop] }}</a\n >\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 <TMagicButton text type=\"primary\">扩展配置</TMagicButton>\n </el-tooltip>\n\n <TMagicTag\n v-else-if=\"config.action === 'tag' && config.prop\"\n :type=\"typeof config.type === 'function' ? config.type(scope.row[config.prop], scope.row) : config.type\"\n close-transition\n >{{ formatter(config, scope.row) }}</TMagicTag\n >\n <div v-else v-html=\"formatter(config, scope.row)\"></div>\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup name=\"MTableColumn\">\nimport { TMagicButton, TMagicForm, TMagicTableColumn, TMagicTag } from '@tmagic/design';\n\nimport { ColumnConfig } from './schema';\nimport { formatter } from './utils';\n\nwithDefaults(\n defineProps<{\n config: ColumnConfig;\n editState?: any;\n }>(),\n {\n config: () => ({}),\n editState: () => ({}),\n },\n);\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nexport default defineComponent({\n name: 'MTable',\n})\n</script>\n<template>\n <TMagicTable\n tooltip-effect=\"dark\"\n class=\"m-table\"\n ref=\"tMagicTable\"\n v-loading=\"loading\"\n :data=\"tableData\"\n :show-header=\"showHeader\"\n :max-height=\"bodyHeight\"\n :default-expand-all=\"defaultExpandAll\"\n :border=\"hasBorder\"\n :row-key=\"rowkeyName || '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 @cell-click=\"cellClickHandler\"\n @expand-change=\"expandChange\"\n >\n <template v-for=\"(item, columnIndex) in columns\">\n <template v-if=\"item.type === 'expand'\">\n <ExpandColumn :config=\"item\" :key=\"columnIndex\"></ExpandColumn>\n </template>\n\n <template v-else-if=\"item.selection\">\n <component\n width=\"40\"\n type=\"selection\"\n :is=\"tableColumnComponent.component\"\n :key=\"columnIndex\"\n :selectable=\"item.selectable\"\n ></component>\n </template>\n\n <template v-else-if=\"item.actions\">\n <ActionsColumn\n :columns=\"columns\"\n :config=\"item\"\n :rowkey-name=\"rowkeyName\"\n :edit-state=\"editState\"\n :key=\"columnIndex\"\n @after-action=\"$emit('after-action')\"\n ></ActionsColumn>\n </template>\n\n <template v-else-if=\"item.type === 'popover'\">\n <PopoverColumn :key=\"columnIndex\" :config=\"item\"></PopoverColumn>\n </template>\n\n <template v-else>\n <TextColumn :key=\"columnIndex\" :config=\"item\" :edit-state=\"editState\"></TextColumn>\n </template>\n </template>\n </TMagicTable>\n</template>\n\n<script lang=\"ts\" setup name=\"MTable\">\nimport { computed, ref } from 'vue';\nimport { cloneDeep } from 'lodash-es';\n\nimport { getConfig, TMagicTable } from '@tmagic/design';\n\nimport ActionsColumn from './ActionsColumn.vue';\nimport ExpandColumn from './ExpandColumn.vue';\nimport PopoverColumn from './PopoverColumn.vue';\nimport TextColumn from './TextColumn.vue';\n\nconst props = withDefaults(\n defineProps<{\n data: any[];\n columns?: any[];\n /** 合并行或列的计算方法 */\n spanMethod?: (data: { row: any; column: any; rowIndex: number; columnIndex: number }) => [number, number];\n loading?: boolean;\n /** Table 的最大高度。合法的值为数字或者单位为 px 的高度 */\n bodyHeight?: string | number;\n /** 是否显示表头 */\n showHeader?: boolean;\n /** 空数据时显示的文本内容 */\n emptyText?: string;\n /** 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */\n defaultExpandAll?: boolean;\n rowkeyName?: string;\n /** 是否带有纵向边框 */\n border?: boolean;\n }>(),\n {\n columns: () => [],\n loading: false,\n showHeader: true,\n defaultExpandAll: false,\n border: false,\n },\n);\n\nconst emit = defineEmits([\n 'sort-change',\n 'after-action',\n 'select',\n 'select-all',\n 'selection-change',\n 'expand-change',\n 'cell-click',\n]);\n\nconst tMagicTable = ref<InstanceType<typeof TMagicTable>>();\n\nconst editState = ref([]);\n\nconst tableColumnComponent = getConfig('components').tableColumn;\nconst selectionColumn = computed(() => {\n const column = props.columns.filter((item) => item.selection);\n return column.length ? column[0] : null;\n});\n\nconst tableData = computed(() => {\n if (selectionColumn.value) {\n return props.data || [];\n }\n\n return cloneDeep(props.data) || [];\n});\n\nconst hasBorder = computed(() => (typeof props.border !== 'undefined' ? props.border : true));\n\nconst sortChange = (data: any) => {\n emit('sort-change', data);\n};\n\nconst selectHandler = (selection: any, row: any) => {\n const column = selectionColumn.value;\n if (!column) {\n return;\n }\n\n if (column.selection === 'single') {\n // this.clearSelection()\n // this.toggleRowSelection(row, true)\n }\n emit('select', selection, row);\n};\n\nconst selectAllHandler = (selection: any) => {\n emit('select-all', selection);\n};\n\nconst selectionChangeHandler = (selection: any) => {\n emit('selection-change', selection);\n};\n\nconst cellClickHandler = (...args: any[]) => {\n emit('cell-click', ...args);\n};\n\nconst expandChange = (...args: any[]) => {\n emit('expand-change', ...args);\n};\n\nconst toggleRowSelection = (row: any, selected: boolean) => {\n tMagicTable.value?.toggleRowSelection(row, selected);\n};\n\nconst toggleRowExpansion = (row: any, expanded: boolean) => {\n tMagicTable.value?.toggleRowExpansion(row, expanded);\n};\n\nconst clearSelection = () => {\n tMagicTable.value?.clearSelection();\n};\n\nconst objectSpanMethod = (data: any) => {\n if (typeof props.spanMethod === 'function') {\n return props.spanMethod(data);\n }\n return () => ({\n rowspan: 0,\n colspan: 0,\n });\n};\n\ndefineExpose({\n toggleRowSelection,\n toggleRowExpansion,\n clearSelection,\n});\n</script>\n\n<style lang=\"scss\">\n.m-table {\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) 2023 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\nexport default {\n install(app: App) {\n app.component('m-table', Table);\n },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A,OAC9B;EACA,MAAA,OAAO,OAAO;EAAA,QACZ,OAAS,EAAA,CAAA;EAAA,QACT,OAAS,EAAA,CAAA;EAAA,OACX,CAAA,CAAA;EAAA,KACF,CAAA;EAEA,IAAa,MAAA,CAAA;EAAA,MACX,kBAAA;EAAA,MACA,kBAAA;EAAA,MACA,cAAA;EAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzKD,gBAAe;EAAA,EACb,QAAQ,GAAU,EAAA;EAChB,IAAI,GAAA,CAAA,SAAA,CAAU,WAAWE,SAAK,CAAA,CAAA;EAAA,GAChC;EACF,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tmagic-table.umd.cjs","sources":["../src/ActionsColumn.vue","../src/ComponentColumn.vue","../src/ExpandColumn.vue","../src/utils.ts","../src/Table.vue","../src/index.ts"],"sourcesContent":["<template>\n <TMagicTableColumn :label=\"config.label\" :width=\"config.width\" :fixed=\"config.fixed\">\n <template v-slot=\"scope\">\n <TMagicTooltip\n v-for=\"(action, actionIndex) in config.actions\"\n :placement=\"action.tooltipPlacement || 'top'\"\n :key=\"actionIndex\"\n :disabled=\"!Boolean(action.tooltip)\"\n :content=\"action.tooltip\"\n >\n <TMagicButton\n v-show=\"display(action.display, scope.row) && !editState[scope.$index]\"\n class=\"action-btn\"\n text\n size=\"small\"\n :type=\"action.buttonType || 'primary'\"\n :icon=\"action.icon\"\n @click=\"actionHandler(action, scope.row, scope.$index)\"\n ><span v-html=\"formatter(action.text, scope.row)\"></span\n ></TMagicButton>\n </TMagicTooltip>\n <TMagicButton\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n text\n type=\"primary\"\n size=\"small\"\n @click=\"save(scope.$index, config)\"\n >保存</TMagicButton\n >\n <TMagicButton\n class=\"action-btn\"\n v-show=\"editState[scope.$index]\"\n text\n type=\"primary\"\n size=\"small\"\n @click=\"editState[scope.$index] = undefined\"\n >取消</TMagicButton\n >\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup>\nimport { TMagicButton, tMagicMessage, TMagicTableColumn, TMagicTooltip } from '@tmagic/design';\n\nimport { ColumnActionConfig, ColumnConfig } from './schema';\n\ndefineOptions({\n name: 'MTableActionsColumn',\n});\n\nconst props = withDefaults(\n defineProps<{\n columns: any[];\n config: ColumnConfig;\n rowkeyName?: string;\n editState?: any;\n }>(),\n {\n columns: () => [],\n config: () => ({}),\n rowkeyName: 'c_id',\n editState: () => [],\n },\n);\n\nconst emit = defineEmits(['after-action']);\n\nconst display = (fuc: boolean | Function | undefined, row: any) => {\n if (typeof fuc === 'function') {\n return fuc(row);\n }\n return true;\n};\n\nconst formatter = (fuc: string | Function | undefined, row: any) => {\n if (typeof fuc === 'function') {\n return fuc(row);\n }\n return fuc;\n};\n\nconst actionHandler = async (action: ColumnActionConfig, row: any, index: number) => {\n await action.before?.(row, index);\n if (action.type === 'edit') {\n props.editState[index] = row;\n } else {\n await action.handler?.(row, index);\n }\n action.after?.(row, index);\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 tMagicMessage.success('保存成功');\n props.editState[index] = undefined;\n emit('after-action');\n } else {\n tMagicMessage.error(res.msg || '保存失败');\n }\n } else {\n props.editState[index] = undefined;\n emit('after-action');\n }\n};\n</script>\n","<template>\n <TMagicTableColumn\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 <component :is=\"config.component\" v-bind=\"componentProps(scope.row)\"></component>\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup>\nimport { TMagicTableColumn } from '@tmagic/design';\n\nimport { ColumnConfig } from './schema';\n\ndefineOptions({\n name: 'MTableColumn',\n});\n\nconst props = withDefaults(\n defineProps<{\n config: ColumnConfig;\n }>(),\n {\n config: () => ({}),\n },\n);\n\nconst componentProps = (row: any) => {\n if (typeof props.config.props === 'function') {\n return props.config.props(row) || {};\n }\n return props.config.props || {};\n};\n</script>\n","<template>\n <TMagicTableColumn type=\"expand\">\n <template #default=\"scope\">\n <MTable\n v-if=\"config.table\"\n :show-header=\"false\"\n :columns=\"config.table\"\n :data=\"(config.prop && scope.row[config.prop]) || []\"\n ></MTable>\n <MForm\n v-if=\"config.form\"\n :config=\"config.form\"\n :init-values=\"config.values || (config.prop && scope.row[config.prop]) || {}\"\n ></MForm>\n <div v-if=\"config.expandContent\" v-html=\"config.expandContent(scope.row, config.prop)\"></div>\n <component v-if=\"config.component\" :is=\"config.component\" v-bind=\"componentProps(scope.row)\"></component>\n </template>\n </TMagicTableColumn>\n</template>\n\n<script lang=\"ts\" setup>\nimport { TMagicTableColumn } from '@tmagic/design';\nimport { MForm } from '@tmagic/form';\n\nimport { ColumnConfig } from './schema';\nimport MTable from './Table.vue';\n\ndefineOptions({\n name: 'MTableExpandColumn',\n});\n\nconst props = withDefaults(\n defineProps<{\n config: ColumnConfig;\n }>(),\n {\n config: () => ({}),\n },\n);\n\nconst componentProps = (row: any) => {\n if (typeof props.config.props === 'function') {\n return props.config.props(row) || {};\n }\n return props.config.props || {};\n};\n</script>\n","/*\n * Tencent is pleased to support the open source community by making TMagicEditor available.\n *\n * Copyright (C) 2023 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.prop) return '';\n\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 <TMagicTable\n tooltip-effect=\"dark\"\n class=\"m-table\"\n ref=\"tMagicTable\"\n v-loading=\"loading\"\n :data=\"tableData\"\n :show-header=\"showHeader\"\n :max-height=\"bodyHeight\"\n :default-expand-all=\"defaultExpandAll\"\n :border=\"hasBorder\"\n :row-key=\"rowkeyName || '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 @cell-click=\"cellClickHandler\"\n @expand-change=\"expandChange\"\n >\n <template v-for=\"(item, columnIndex) in columns\">\n <template v-if=\"item.type === 'expand'\">\n <ExpandColumn :config=\"item\" :key=\"columnIndex\"></ExpandColumn>\n </template>\n\n <template v-else-if=\"item.type === 'component'\">\n <ComponentColumn :config=\"item\" :key=\"columnIndex\"></ComponentColumn>\n </template>\n\n <template v-else-if=\"item.selection\">\n <component\n width=\"40\"\n type=\"selection\"\n :is=\"tableColumnComponent?.component || 'el-table-column'\"\n :key=\"columnIndex\"\n :selectable=\"item.selectable\"\n ></component>\n </template>\n\n <template v-else-if=\"item.actions\">\n <ActionsColumn\n :columns=\"columns\"\n :config=\"item\"\n :rowkey-name=\"rowkeyName\"\n :edit-state=\"editState\"\n :key=\"columnIndex\"\n @after-action=\"$emit('after-action')\"\n ></ActionsColumn>\n </template>\n\n <template v-else-if=\"item.type === 'popover'\">\n <PopoverColumn :key=\"columnIndex\" :config=\"item\"></PopoverColumn>\n </template>\n\n <template v-else>\n <TextColumn :key=\"columnIndex\" :config=\"item\" :edit-state=\"editState\"></TextColumn>\n </template>\n </template>\n </TMagicTable>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue';\nimport { cloneDeep } from 'lodash-es';\n\nimport { getConfig, TMagicTable } from '@tmagic/design';\n\nimport ActionsColumn from './ActionsColumn.vue';\nimport ComponentColumn from './ComponentColumn.vue';\nimport ExpandColumn from './ExpandColumn.vue';\nimport PopoverColumn from './PopoverColumn.vue';\nimport TextColumn from './TextColumn.vue';\n\ndefineOptions({\n name: 'MTable',\n});\n\nconst props = withDefaults(\n defineProps<{\n data: any[];\n columns?: any[];\n /** 合并行或列的计算方法 */\n spanMethod?: (data: { row: any; column: any; rowIndex: number; columnIndex: number }) => [number, number];\n loading?: boolean;\n /** Table 的最大高度。合法的值为数字或者单位为 px 的高度 */\n bodyHeight?: string | number;\n /** 是否显示表头 */\n showHeader?: boolean;\n /** 空数据时显示的文本内容 */\n emptyText?: string;\n /** 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */\n defaultExpandAll?: boolean;\n rowkeyName?: string;\n /** 是否带有纵向边框 */\n border?: boolean;\n }>(),\n {\n columns: () => [],\n loading: false,\n showHeader: true,\n defaultExpandAll: false,\n border: false,\n },\n);\n\nconst emit = defineEmits([\n 'sort-change',\n 'after-action',\n 'select',\n 'select-all',\n 'selection-change',\n 'expand-change',\n 'cell-click',\n]);\n\nconst tMagicTable = ref<InstanceType<typeof TMagicTable>>();\n\nconst editState = ref([]);\n\nconst tableColumnComponent = getConfig('components')?.tableColumn;\nconst selectionColumn = computed(() => {\n const column = props.columns.filter((item) => item.selection);\n return column.length ? column[0] : null;\n});\n\nconst tableData = computed(() => {\n if (selectionColumn.value) {\n return props.data || [];\n }\n\n return cloneDeep(props.data) || [];\n});\n\nconst hasBorder = computed(() => (typeof props.border !== 'undefined' ? props.border : true));\n\nconst sortChange = (data: any) => {\n emit('sort-change', data);\n};\n\nconst selectHandler = (selection: any, row: any) => {\n const column = selectionColumn.value;\n if (!column) {\n return;\n }\n\n if (column.selection === 'single') {\n // this.clearSelection()\n // this.toggleRowSelection(row, true)\n }\n emit('select', selection, row);\n};\n\nconst selectAllHandler = (selection: any) => {\n emit('select-all', selection);\n};\n\nconst selectionChangeHandler = (selection: any) => {\n emit('selection-change', selection);\n};\n\nconst cellClickHandler = (...args: any[]) => {\n emit('cell-click', ...args);\n};\n\nconst expandChange = (...args: any[]) => {\n emit('expand-change', ...args);\n};\n\nconst toggleRowSelection = (row: any, selected: boolean) => {\n tMagicTable.value?.toggleRowSelection(row, selected);\n};\n\nconst toggleRowExpansion = (row: any, expanded: boolean) => {\n tMagicTable.value?.toggleRowExpansion(row, expanded);\n};\n\nconst clearSelection = () => {\n tMagicTable.value?.clearSelection();\n};\n\nconst objectSpanMethod = (data: any) => {\n if (typeof props.spanMethod === 'function') {\n return props.spanMethod(data);\n }\n return () => ({\n rowspan: 0,\n colspan: 0,\n });\n};\n\ndefineExpose({\n toggleRowSelection,\n toggleRowExpansion,\n clearSelection,\n});\n</script>\n\n<style lang=\"scss\">\n.m-table {\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) 2023 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\nexport default {\n install(app: App) {\n app.component('m-table', Table);\n },\n};\n"],"names":["tMagicMessage","datetimeFormatter","ref","getConfig","computed","cloneDeep","Table"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAqEA,IAAM,MAAA,OAAA,GAAU,CAAC,GAAA,EAAqC,GAAa,KAAA;EACjE,MAAI,IAAA,OAAO,QAAQ,UAAY,EAAA;EAC7B,QAAA,OAAO,IAAI,GAAG,CAAA,CAAA;EAAA,OAChB;EACA,MAAO,OAAA,IAAA,CAAA;EAAA,KACT,CAAA;EAEA,IAAM,MAAA,SAAA,GAAY,CAAC,GAAA,EAAoC,GAAa,KAAA;EAClE,MAAI,IAAA,OAAO,QAAQ,UAAY,EAAA;EAC7B,QAAA,OAAO,IAAI,GAAG,CAAA,CAAA;EAAA,OAChB;EACA,MAAO,OAAA,GAAA,CAAA;EAAA,KACT,CAAA;EAEA,IAAA,MAAM,aAAgB,GAAA,OAAO,MAA4B,EAAA,GAAA,EAAU,KAAkB,KAAA;EACnF,MAAM,MAAA,MAAA,CAAO,MAAS,GAAA,GAAA,EAAK,KAAK,CAAA,CAAA;EAChC,MAAI,IAAA,MAAA,CAAO,SAAS,MAAQ,EAAA;EAC1B,QAAM,KAAA,CAAA,SAAA,CAAU,KAAK,CAAI,GAAA,GAAA,CAAA;EAAA,OACpB,MAAA;EACL,QAAM,MAAA,MAAA,CAAO,OAAU,GAAA,GAAA,EAAK,KAAK,CAAA,CAAA;EAAA,OACnC;EACA,MAAO,MAAA,CAAA,KAAA,GAAQ,KAAK,KAAK,CAAA,CAAA;EAAA,KAC3B,CAAA;EAEA,IAAM,MAAA,IAAA,GAAO,OAAO,KAAA,EAAe,MAAyB,KAAA;EAC1D,MAAM,MAAA,MAAA,GAAS,OAAO,OAAS,EAAA,IAAA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