@tmagic/table 1.5.5 → 1.5.7
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 +235 -140
- package/dist/tmagic-table.umd.cjs +2494 -145
- package/package.json +4 -13
- package/types/index.d.ts +89 -1
package/dist/tmagic-table.js
CHANGED
|
@@ -54,13 +54,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
54
54
|
if (res) {
|
|
55
55
|
if (res.ret === 0) {
|
|
56
56
|
tMagicMessage.success("保存成功");
|
|
57
|
-
props.editState[index] =
|
|
57
|
+
props.editState[index] = undefined;
|
|
58
58
|
emit("after-action");
|
|
59
59
|
} else {
|
|
60
60
|
tMagicMessage.error(res.msg || "保存失败");
|
|
61
61
|
}
|
|
62
62
|
} else {
|
|
63
|
-
props.editState[index] =
|
|
63
|
+
props.editState[index] = undefined;
|
|
64
64
|
emit("after-action");
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -71,35 +71,43 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
71
71
|
fixed: _ctx.config.fixed
|
|
72
72
|
}, {
|
|
73
73
|
default: withCtx((scope) => [
|
|
74
|
-
(openBlock(true), createElementBlock(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
74
|
+
(openBlock(true), createElementBlock(
|
|
75
|
+
Fragment,
|
|
76
|
+
null,
|
|
77
|
+
renderList(_ctx.config.actions, (action, actionIndex) => {
|
|
78
|
+
return openBlock(), createBlock(unref(TMagicTooltip), {
|
|
79
|
+
placement: action.tooltipPlacement || "top",
|
|
80
|
+
key: actionIndex,
|
|
81
|
+
disabled: !Boolean(action.tooltip),
|
|
82
|
+
content: action.tooltip
|
|
83
|
+
}, {
|
|
84
|
+
default: withCtx(() => [
|
|
85
|
+
withDirectives(createVNode(unref(TMagicButton), {
|
|
86
|
+
class: "action-btn",
|
|
87
|
+
link: "",
|
|
88
|
+
size: "small",
|
|
89
|
+
type: action.buttonType || "primary",
|
|
90
|
+
icon: action.icon,
|
|
91
|
+
onClick: ($event) => actionHandler(action, scope.row, scope.$index)
|
|
92
|
+
}, {
|
|
93
|
+
default: withCtx(() => [
|
|
94
|
+
createElementVNode("span", {
|
|
95
|
+
innerHTML: formatter(action.text, scope.row)
|
|
96
|
+
}, null, 8, _hoisted_1$2)
|
|
97
|
+
]),
|
|
98
|
+
_: 2
|
|
99
|
+
/* DYNAMIC */
|
|
100
|
+
}, 1032, ["type", "icon", "onClick"]), [
|
|
101
|
+
[vShow, display(action.display, scope.row) && !_ctx.editState[scope.$index]]
|
|
102
|
+
])
|
|
103
|
+
]),
|
|
104
|
+
_: 2
|
|
105
|
+
/* DYNAMIC */
|
|
106
|
+
}, 1032, ["placement", "disabled", "content"]);
|
|
107
|
+
}),
|
|
108
|
+
128
|
|
109
|
+
/* KEYED_FRAGMENT */
|
|
110
|
+
)),
|
|
103
111
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
104
112
|
class: "action-btn",
|
|
105
113
|
link: "",
|
|
@@ -111,6 +119,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
111
119
|
createTextVNode("保存")
|
|
112
120
|
])),
|
|
113
121
|
_: 2
|
|
122
|
+
/* DYNAMIC */
|
|
114
123
|
}, 1032, ["onClick"]), [
|
|
115
124
|
[vShow, _ctx.editState[scope.$index]]
|
|
116
125
|
]),
|
|
@@ -119,17 +128,19 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
119
128
|
link: "",
|
|
120
129
|
type: "primary",
|
|
121
130
|
size: "small",
|
|
122
|
-
onClick: ($event) => _ctx.editState[scope.$index] =
|
|
131
|
+
onClick: ($event) => _ctx.editState[scope.$index] = undefined
|
|
123
132
|
}, {
|
|
124
133
|
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
125
134
|
createTextVNode("取消")
|
|
126
135
|
])),
|
|
127
136
|
_: 2
|
|
137
|
+
/* DYNAMIC */
|
|
128
138
|
}, 1032, ["onClick"]), [
|
|
129
139
|
[vShow, _ctx.editState[scope.$index]]
|
|
130
140
|
])
|
|
131
141
|
]),
|
|
132
142
|
_: 1
|
|
143
|
+
/* STABLE */
|
|
133
144
|
}, 8, ["label", "width", "fixed"]);
|
|
134
145
|
};
|
|
135
146
|
}
|
|
@@ -167,9 +178,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
167
178
|
prop: _ctx.config.prop
|
|
168
179
|
}, {
|
|
169
180
|
default: withCtx((scope) => [
|
|
170
|
-
(openBlock(), createBlock(
|
|
181
|
+
(openBlock(), createBlock(
|
|
182
|
+
resolveDynamicComponent(_ctx.config.component),
|
|
183
|
+
mergeProps(componentProps(scope.row, scope.$index), toHandlers(componentListeners(scope.row, scope.$index))),
|
|
184
|
+
null,
|
|
185
|
+
16
|
|
186
|
+
/* FULL_PROPS */
|
|
187
|
+
))
|
|
171
188
|
]),
|
|
172
189
|
_: 1
|
|
190
|
+
/* STABLE */
|
|
173
191
|
}, 8, ["label", "width", "fixed", "sortable", "prop"]);
|
|
174
192
|
};
|
|
175
193
|
}
|
|
@@ -193,31 +211,47 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
193
211
|
return props.config.props || {};
|
|
194
212
|
};
|
|
195
213
|
return (_ctx, _cache) => {
|
|
196
|
-
return openBlock(),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
return openBlock(), createElementBlock(
|
|
215
|
+
Fragment,
|
|
216
|
+
null,
|
|
217
|
+
[
|
|
218
|
+
createCommentVNode(" @ts-nocheck "),
|
|
219
|
+
createVNode(unref(TMagicTableColumn), {
|
|
220
|
+
type: "expand",
|
|
221
|
+
width: _ctx.config.width,
|
|
222
|
+
fixed: _ctx.config.fixed
|
|
223
|
+
}, {
|
|
224
|
+
default: withCtx((scope) => [
|
|
225
|
+
_ctx.config.table ? (openBlock(), createBlock(_sfc_main, {
|
|
226
|
+
key: 0,
|
|
227
|
+
"show-header": false,
|
|
228
|
+
columns: _ctx.config.table,
|
|
229
|
+
data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
|
|
230
|
+
}, null, 8, ["columns", "data"])) : createCommentVNode("v-if", true),
|
|
231
|
+
_ctx.config.form ? (openBlock(), createBlock(unref(MForm), {
|
|
232
|
+
key: 1,
|
|
233
|
+
config: _ctx.config.form,
|
|
234
|
+
"init-values": _ctx.config.values || _ctx.config.prop && scope.row[_ctx.config.prop] || {}
|
|
235
|
+
}, null, 8, ["config", "init-values"])) : createCommentVNode("v-if", true),
|
|
236
|
+
_ctx.config.expandContent ? (openBlock(), createElementBlock("div", {
|
|
237
|
+
key: 2,
|
|
238
|
+
innerHTML: _ctx.config.expandContent(scope.row, _ctx.config.prop)
|
|
239
|
+
}, null, 8, _hoisted_1$1)) : createCommentVNode("v-if", true),
|
|
240
|
+
_ctx.config.component ? (openBlock(), createBlock(
|
|
241
|
+
resolveDynamicComponent(_ctx.config.component),
|
|
242
|
+
normalizeProps(mergeProps({ key: 3 }, componentProps(scope.row))),
|
|
243
|
+
null,
|
|
244
|
+
16
|
|
245
|
+
/* FULL_PROPS */
|
|
246
|
+
)) : createCommentVNode("v-if", true)
|
|
247
|
+
]),
|
|
248
|
+
_: 1
|
|
249
|
+
/* STABLE */
|
|
250
|
+
}, 8, ["width", "fixed"])
|
|
251
|
+
],
|
|
252
|
+
2112
|
|
253
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
254
|
+
);
|
|
221
255
|
};
|
|
222
256
|
}
|
|
223
257
|
});
|
|
@@ -249,43 +283,65 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
249
283
|
},
|
|
250
284
|
setup(__props) {
|
|
251
285
|
return (_ctx, _cache) => {
|
|
252
|
-
return openBlock(),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
width: _ctx.config.popover.width,
|
|
262
|
-
trigger: _ctx.config.popover.trigger,
|
|
263
|
-
"destroy-on-close": _ctx.config.popover.destroyOnClose ?? true
|
|
286
|
+
return openBlock(), createElementBlock(
|
|
287
|
+
Fragment,
|
|
288
|
+
null,
|
|
289
|
+
[
|
|
290
|
+
createCommentVNode(" @ts-nocheck "),
|
|
291
|
+
createVNode(unref(TMagicTableColumn), {
|
|
292
|
+
label: _ctx.config.label,
|
|
293
|
+
width: _ctx.config.width,
|
|
294
|
+
fixed: _ctx.config.fixed
|
|
264
295
|
}, {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
296
|
+
default: withCtx((scope) => [
|
|
297
|
+
_ctx.config.popover ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
298
|
+
key: 0,
|
|
299
|
+
placement: _ctx.config.popover.placement,
|
|
300
|
+
width: _ctx.config.popover.width,
|
|
301
|
+
trigger: _ctx.config.popover.trigger,
|
|
302
|
+
"destroy-on-close": _ctx.config.popover.destroyOnClose ?? true
|
|
269
303
|
}, {
|
|
304
|
+
reference: withCtx(() => [
|
|
305
|
+
createVNode(
|
|
306
|
+
unref(TMagicButton),
|
|
307
|
+
{
|
|
308
|
+
link: "",
|
|
309
|
+
type: "primary"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
default: withCtx(() => [
|
|
313
|
+
createTextVNode(
|
|
314
|
+
toDisplayString(_ctx.config.text || unref(formatter)(_ctx.config, scope.row)),
|
|
315
|
+
1
|
|
316
|
+
/* TEXT */
|
|
317
|
+
)
|
|
318
|
+
]),
|
|
319
|
+
_: 2
|
|
320
|
+
/* DYNAMIC */
|
|
321
|
+
},
|
|
322
|
+
1024
|
|
323
|
+
/* DYNAMIC_SLOTS */
|
|
324
|
+
)
|
|
325
|
+
]),
|
|
270
326
|
default: withCtx(() => [
|
|
271
|
-
|
|
327
|
+
_ctx.config.popover.tableEmbed ? (openBlock(), createBlock(_sfc_main, {
|
|
328
|
+
key: 0,
|
|
329
|
+
"show-header": _ctx.config.showHeader,
|
|
330
|
+
columns: _ctx.config.table,
|
|
331
|
+
data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
|
|
332
|
+
}, null, 8, ["show-header", "columns", "data"])) : createCommentVNode("v-if", true)
|
|
272
333
|
]),
|
|
273
334
|
_: 2
|
|
274
|
-
|
|
335
|
+
/* DYNAMIC */
|
|
336
|
+
}, 1032, ["placement", "width", "trigger", "destroy-on-close"])) : createCommentVNode("v-if", true)
|
|
275
337
|
]),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
]),
|
|
284
|
-
_: 2
|
|
285
|
-
}, 1032, ["placement", "width", "trigger", "destroy-on-close"])) : createCommentVNode("", true)
|
|
286
|
-
]),
|
|
287
|
-
_: 1
|
|
288
|
-
}, 8, ["label", "width", "fixed"]);
|
|
338
|
+
_: 1
|
|
339
|
+
/* STABLE */
|
|
340
|
+
}, 8, ["label", "width", "fixed"])
|
|
341
|
+
],
|
|
342
|
+
2112
|
|
343
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
344
|
+
);
|
|
289
345
|
};
|
|
290
346
|
}
|
|
291
347
|
});
|
|
@@ -332,6 +388,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
332
388
|
}, null, 8, ["prop", "rules", "config", "name", "model"])
|
|
333
389
|
]),
|
|
334
390
|
_: 2
|
|
391
|
+
/* DYNAMIC */
|
|
335
392
|
}, 1032, ["model"])) : _ctx.config.action === "actionLink" && _ctx.config.prop ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
336
393
|
key: 1,
|
|
337
394
|
link: "",
|
|
@@ -344,6 +401,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
344
401
|
}, null, 8, _hoisted_1)
|
|
345
402
|
]),
|
|
346
403
|
_: 2
|
|
404
|
+
/* DYNAMIC */
|
|
347
405
|
}, 1032, ["onClick"])) : _ctx.config.action === "img" && _ctx.config.prop ? (openBlock(), createElementBlock("a", {
|
|
348
406
|
key: 2,
|
|
349
407
|
target: "_blank",
|
|
@@ -358,40 +416,64 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
358
416
|
target: "_blank",
|
|
359
417
|
href: scope.row[_ctx.config.prop],
|
|
360
418
|
class: "keep-all"
|
|
361
|
-
}, toDisplayString(scope.row[_ctx.config.prop]), 9, _hoisted_4)) : _ctx.config.action === "tip" ? (openBlock(), createBlock(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
419
|
+
}, toDisplayString(scope.row[_ctx.config.prop]), 9, _hoisted_4)) : _ctx.config.action === "tip" ? (openBlock(), createBlock(
|
|
420
|
+
_component_el_tooltip,
|
|
421
|
+
{
|
|
422
|
+
key: 4,
|
|
423
|
+
placement: "left"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
content: withCtx(() => [
|
|
427
|
+
createElementVNode(
|
|
428
|
+
"div",
|
|
429
|
+
null,
|
|
430
|
+
toDisplayString(unref(formatter)(_ctx.config, scope.row)),
|
|
431
|
+
1
|
|
432
|
+
/* TEXT */
|
|
433
|
+
)
|
|
434
|
+
]),
|
|
435
|
+
default: withCtx(() => [
|
|
436
|
+
createVNode(unref(TMagicButton), {
|
|
437
|
+
link: "",
|
|
438
|
+
type: "primary"
|
|
439
|
+
}, {
|
|
440
|
+
default: withCtx(() => [
|
|
441
|
+
createTextVNode(
|
|
442
|
+
toDisplayString(_ctx.config.buttonText || "扩展配置"),
|
|
443
|
+
1
|
|
444
|
+
/* TEXT */
|
|
445
|
+
)
|
|
446
|
+
]),
|
|
447
|
+
_: 1
|
|
448
|
+
/* STABLE */
|
|
449
|
+
})
|
|
450
|
+
]),
|
|
451
|
+
_: 2
|
|
452
|
+
/* DYNAMIC */
|
|
453
|
+
},
|
|
454
|
+
1024
|
|
455
|
+
/* DYNAMIC_SLOTS */
|
|
456
|
+
)) : _ctx.config.action === "tag" && _ctx.config.prop ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
381
457
|
key: 5,
|
|
382
458
|
type: typeof _ctx.config.type === "function" ? _ctx.config.type(scope.row[_ctx.config.prop], scope.row) : _ctx.config.type,
|
|
383
459
|
"close-transition": ""
|
|
384
460
|
}, {
|
|
385
461
|
default: withCtx(() => [
|
|
386
|
-
createTextVNode(
|
|
462
|
+
createTextVNode(
|
|
463
|
+
toDisplayString(unref(formatter)(_ctx.config, scope.row)),
|
|
464
|
+
1
|
|
465
|
+
/* TEXT */
|
|
466
|
+
)
|
|
387
467
|
]),
|
|
388
468
|
_: 2
|
|
469
|
+
/* DYNAMIC */
|
|
389
470
|
}, 1032, ["type"])) : (openBlock(), createElementBlock("div", {
|
|
390
471
|
key: 6,
|
|
391
472
|
innerHTML: unref(formatter)(_ctx.config, scope.row)
|
|
392
473
|
}, null, 8, _hoisted_5))
|
|
393
474
|
]),
|
|
394
475
|
_: 1
|
|
476
|
+
/* STABLE */
|
|
395
477
|
}, 8, ["label", "width", "fixed", "sortable", "prop"]);
|
|
396
478
|
};
|
|
397
479
|
}
|
|
@@ -511,38 +593,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
511
593
|
onExpandChange: expandChange
|
|
512
594
|
}, {
|
|
513
595
|
default: withCtx(() => [
|
|
514
|
-
(openBlock(true), createElementBlock(
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
596
|
+
(openBlock(true), createElementBlock(
|
|
597
|
+
Fragment,
|
|
598
|
+
null,
|
|
599
|
+
renderList(_ctx.columns, (item, columnIndex) => {
|
|
600
|
+
return openBlock(), createElementBlock(
|
|
601
|
+
Fragment,
|
|
602
|
+
null,
|
|
603
|
+
[
|
|
604
|
+
item.type === "expand" ? (openBlock(), createBlock(_sfc_main$3, {
|
|
605
|
+
config: item,
|
|
606
|
+
key: columnIndex
|
|
607
|
+
}, null, 8, ["config"])) : item.type === "component" ? (openBlock(), createBlock(_sfc_main$4, {
|
|
608
|
+
config: item,
|
|
609
|
+
key: columnIndex
|
|
610
|
+
}, null, 8, ["config"])) : item.selection ? (openBlock(), createBlock(resolveDynamicComponent(unref(tableColumnComponent)?.component || "el-table-column"), {
|
|
611
|
+
width: "40",
|
|
612
|
+
type: "selection",
|
|
613
|
+
key: columnIndex,
|
|
614
|
+
selectable: item.selectable
|
|
615
|
+
}, null, 8, ["selectable"])) : item.actions ? (openBlock(), createBlock(_sfc_main$5, {
|
|
616
|
+
columns: _ctx.columns,
|
|
617
|
+
config: item,
|
|
618
|
+
"rowkey-name": _ctx.rowkeyName,
|
|
619
|
+
"edit-state": editState.value,
|
|
620
|
+
key: columnIndex,
|
|
621
|
+
onAfterAction: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("after-action"))
|
|
622
|
+
}, null, 8, ["columns", "config", "rowkey-name", "edit-state"])) : item.type === "popover" ? (openBlock(), createBlock(_sfc_main$2, {
|
|
623
|
+
key: columnIndex,
|
|
624
|
+
config: item
|
|
625
|
+
}, null, 8, ["config"])) : (openBlock(), createBlock(_sfc_main$1, {
|
|
626
|
+
key: columnIndex,
|
|
627
|
+
config: item,
|
|
628
|
+
"edit-state": editState.value
|
|
629
|
+
}, null, 8, ["config", "edit-state"]))
|
|
630
|
+
],
|
|
631
|
+
64
|
|
632
|
+
/* STABLE_FRAGMENT */
|
|
633
|
+
);
|
|
634
|
+
}),
|
|
635
|
+
256
|
|
636
|
+
/* UNKEYED_FRAGMENT */
|
|
637
|
+
))
|
|
544
638
|
]),
|
|
545
639
|
_: 1
|
|
640
|
+
/* STABLE */
|
|
546
641
|
}, 8, ["data", "show-header", "max-height", "default-expand-all", "border", "row-key", "empty-text"])), [
|
|
547
642
|
[_directive_loading, _ctx.loading]
|
|
548
643
|
]);
|