@tmagic/table 1.5.5 → 1.5.6

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.
@@ -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] = void 0;
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] = void 0;
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(Fragment, null, renderList(_ctx.config.actions, (action, actionIndex) => {
75
- return openBlock(), createBlock(unref(TMagicTooltip), {
76
- placement: action.tooltipPlacement || "top",
77
- key: actionIndex,
78
- disabled: !Boolean(action.tooltip),
79
- content: action.tooltip
80
- }, {
81
- default: withCtx(() => [
82
- withDirectives(createVNode(unref(TMagicButton), {
83
- class: "action-btn",
84
- link: "",
85
- size: "small",
86
- type: action.buttonType || "primary",
87
- icon: action.icon,
88
- onClick: ($event) => actionHandler(action, scope.row, scope.$index)
89
- }, {
90
- default: withCtx(() => [
91
- createElementVNode("span", {
92
- innerHTML: formatter(action.text, scope.row)
93
- }, null, 8, _hoisted_1$2)
94
- ]),
95
- _: 2
96
- }, 1032, ["type", "icon", "onClick"]), [
97
- [vShow, display(action.display, scope.row) && !_ctx.editState[scope.$index]]
98
- ])
99
- ]),
100
- _: 2
101
- }, 1032, ["placement", "disabled", "content"]);
102
- }), 128)),
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] = void 0
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(resolveDynamicComponent(_ctx.config.component), mergeProps(componentProps(scope.row, scope.$index), toHandlers(componentListeners(scope.row, scope.$index))), null, 16))
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(), createBlock(unref(TMagicTableColumn), {
197
- type: "expand",
198
- width: _ctx.config.width,
199
- fixed: _ctx.config.fixed
200
- }, {
201
- default: withCtx((scope) => [
202
- _ctx.config.table ? (openBlock(), createBlock(_sfc_main, {
203
- key: 0,
204
- "show-header": false,
205
- columns: _ctx.config.table,
206
- data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
207
- }, null, 8, ["columns", "data"])) : createCommentVNode("", true),
208
- _ctx.config.form ? (openBlock(), createBlock(unref(MForm), {
209
- key: 1,
210
- config: _ctx.config.form,
211
- "init-values": _ctx.config.values || _ctx.config.prop && scope.row[_ctx.config.prop] || {}
212
- }, null, 8, ["config", "init-values"])) : createCommentVNode("", true),
213
- _ctx.config.expandContent ? (openBlock(), createElementBlock("div", {
214
- key: 2,
215
- innerHTML: _ctx.config.expandContent(scope.row, _ctx.config.prop)
216
- }, null, 8, _hoisted_1$1)) : createCommentVNode("", true),
217
- _ctx.config.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.component), normalizeProps(mergeProps({ key: 3 }, componentProps(scope.row))), null, 16)) : createCommentVNode("", true)
218
- ]),
219
- _: 1
220
- }, 8, ["width", "fixed"]);
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(), createBlock(unref(TMagicTableColumn), {
253
- label: _ctx.config.label,
254
- width: _ctx.config.width,
255
- fixed: _ctx.config.fixed
256
- }, {
257
- default: withCtx((scope) => [
258
- _ctx.config.popover ? (openBlock(), createBlock(unref(TMagicPopover), {
259
- key: 0,
260
- placement: _ctx.config.popover.placement,
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
- reference: withCtx(() => [
266
- createVNode(unref(TMagicButton), {
267
- link: "",
268
- type: "primary"
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
- createTextVNode(toDisplayString(_ctx.config.text || unref(formatter)(_ctx.config, scope.row)), 1)
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
- }, 1024)
335
+ /* DYNAMIC */
336
+ }, 1032, ["placement", "width", "trigger", "destroy-on-close"])) : createCommentVNode("v-if", true)
275
337
  ]),
276
- default: withCtx(() => [
277
- _ctx.config.popover.tableEmbed ? (openBlock(), createBlock(_sfc_main, {
278
- key: 0,
279
- "show-header": _ctx.config.showHeader,
280
- columns: _ctx.config.table,
281
- data: _ctx.config.prop && scope.row[_ctx.config.prop] || []
282
- }, null, 8, ["show-header", "columns", "data"])) : createCommentVNode("", true)
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(_component_el_tooltip, {
362
- key: 4,
363
- placement: "left"
364
- }, {
365
- content: withCtx(() => [
366
- createElementVNode("div", null, toDisplayString(unref(formatter)(_ctx.config, scope.row)), 1)
367
- ]),
368
- default: withCtx(() => [
369
- createVNode(unref(TMagicButton), {
370
- link: "",
371
- type: "primary"
372
- }, {
373
- default: withCtx(() => [
374
- createTextVNode(toDisplayString(_ctx.config.buttonText || "扩展配置"), 1)
375
- ]),
376
- _: 1
377
- })
378
- ]),
379
- _: 2
380
- }, 1024)) : _ctx.config.action === "tag" && _ctx.config.prop ? (openBlock(), createBlock(unref(TMagicTag), {
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(toDisplayString(unref(formatter)(_ctx.config, scope.row)), 1)
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(Fragment, null, renderList(_ctx.columns, (item, columnIndex) => {
515
- return openBlock(), createElementBlock(Fragment, null, [
516
- item.type === "expand" ? (openBlock(), createBlock(_sfc_main$3, {
517
- config: item,
518
- key: columnIndex
519
- }, null, 8, ["config"])) : item.type === "component" ? (openBlock(), createBlock(_sfc_main$4, {
520
- config: item,
521
- key: columnIndex
522
- }, null, 8, ["config"])) : item.selection ? (openBlock(), createBlock(resolveDynamicComponent(unref(tableColumnComponent)?.component || "el-table-column"), {
523
- width: "40",
524
- type: "selection",
525
- key: columnIndex,
526
- selectable: item.selectable
527
- }, null, 8, ["selectable"])) : item.actions ? (openBlock(), createBlock(_sfc_main$5, {
528
- columns: _ctx.columns,
529
- config: item,
530
- "rowkey-name": _ctx.rowkeyName,
531
- "edit-state": editState.value,
532
- key: columnIndex,
533
- onAfterAction: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("after-action"))
534
- }, null, 8, ["columns", "config", "rowkey-name", "edit-state"])) : item.type === "popover" ? (openBlock(), createBlock(_sfc_main$2, {
535
- key: columnIndex,
536
- config: item
537
- }, null, 8, ["config"])) : (openBlock(), createBlock(_sfc_main$1, {
538
- key: columnIndex,
539
- config: item,
540
- "edit-state": editState.value
541
- }, null, 8, ["config", "edit-state"]))
542
- ], 64);
543
- }), 256))
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
  ]);