vxe-table 4.8.0 → 4.8.1

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.
Files changed (118) hide show
  1. package/es/locale/lang/en-US.js +4 -2
  2. package/es/locale/lang/es-ES.js +4 -2
  3. package/es/locale/lang/hu-HU.js +4 -2
  4. package/es/locale/lang/ja-JP.js +4 -2
  5. package/es/locale/lang/ko-KR.js +4 -2
  6. package/es/locale/lang/pt-BR.js +4 -2
  7. package/es/locale/lang/ru-RU.js +4 -2
  8. package/es/locale/lang/uk-UA.js +4 -2
  9. package/es/locale/lang/vi-VN.js +4 -2
  10. package/es/locale/lang/zh-CHT.js +4 -2
  11. package/es/locale/lang/zh-CN.js +4 -2
  12. package/es/style.css +1 -1
  13. package/es/style.min.css +1 -1
  14. package/es/table/module/edit/hook.js +7 -4
  15. package/es/table/src/body.js +22 -8
  16. package/es/table/src/cell.js +53 -24
  17. package/es/table/src/column.js +3 -1
  18. package/es/table/src/columnInfo.js +1 -0
  19. package/es/table/src/emits.js +3 -0
  20. package/es/table/src/props.js +2 -0
  21. package/es/table/src/table.js +241 -40
  22. package/es/table/style.css +74 -2
  23. package/es/table/style.min.css +1 -1
  24. package/es/ui/index.js +4 -1
  25. package/es/ui/src/log.js +1 -1
  26. package/es/vxe-table/style.css +74 -2
  27. package/es/vxe-table/style.min.css +1 -1
  28. package/helper/vetur/attributes.json +1 -1
  29. package/helper/vetur/tags.json +1 -1
  30. package/lib/index.umd.js +359 -82
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/locale/lang/en-US.js +4 -2
  33. package/lib/locale/lang/en-US.min.js +1 -1
  34. package/lib/locale/lang/en-US.umd.js +4 -2
  35. package/lib/locale/lang/es-ES.js +4 -2
  36. package/lib/locale/lang/es-ES.min.js +1 -1
  37. package/lib/locale/lang/es-ES.umd.js +4 -2
  38. package/lib/locale/lang/hu-HU.js +4 -2
  39. package/lib/locale/lang/hu-HU.min.js +1 -1
  40. package/lib/locale/lang/hu-HU.umd.js +4 -2
  41. package/lib/locale/lang/ja-JP.js +4 -2
  42. package/lib/locale/lang/ja-JP.min.js +1 -1
  43. package/lib/locale/lang/ja-JP.umd.js +4 -2
  44. package/lib/locale/lang/ko-KR.js +4 -2
  45. package/lib/locale/lang/ko-KR.min.js +1 -1
  46. package/lib/locale/lang/ko-KR.umd.js +4 -2
  47. package/lib/locale/lang/pt-BR.js +4 -2
  48. package/lib/locale/lang/pt-BR.min.js +1 -1
  49. package/lib/locale/lang/pt-BR.umd.js +4 -2
  50. package/lib/locale/lang/ru-RU.js +4 -2
  51. package/lib/locale/lang/ru-RU.min.js +1 -1
  52. package/lib/locale/lang/ru-RU.umd.js +4 -2
  53. package/lib/locale/lang/uk-UA.js +4 -2
  54. package/lib/locale/lang/uk-UA.min.js +1 -1
  55. package/lib/locale/lang/uk-UA.umd.js +4 -2
  56. package/lib/locale/lang/vi-VN.js +4 -2
  57. package/lib/locale/lang/vi-VN.min.js +1 -1
  58. package/lib/locale/lang/zh-CHT.js +4 -2
  59. package/lib/locale/lang/zh-CHT.min.js +1 -1
  60. package/lib/locale/lang/zh-CN.js +4 -2
  61. package/lib/locale/lang/zh-CN.min.js +1 -1
  62. package/lib/locale/lang/zh-CN.umd.js +4 -2
  63. package/lib/style.css +1 -1
  64. package/lib/style.min.css +1 -1
  65. package/lib/table/module/edit/hook.js +8 -4
  66. package/lib/table/module/edit/hook.min.js +1 -1
  67. package/lib/table/src/body.js +18 -5
  68. package/lib/table/src/body.min.js +1 -1
  69. package/lib/table/src/cell.js +60 -24
  70. package/lib/table/src/cell.min.js +1 -1
  71. package/lib/table/src/column.js +3 -1
  72. package/lib/table/src/column.min.js +1 -1
  73. package/lib/table/src/columnInfo.js +1 -0
  74. package/lib/table/src/columnInfo.min.js +1 -1
  75. package/lib/table/src/emits.js +1 -1
  76. package/lib/table/src/emits.min.js +1 -1
  77. package/lib/table/src/props.js +2 -0
  78. package/lib/table/src/props.min.js +1 -1
  79. package/lib/table/src/table.js +258 -43
  80. package/lib/table/src/table.min.js +1 -1
  81. package/lib/table/style/style.css +74 -2
  82. package/lib/table/style/style.min.css +1 -1
  83. package/lib/ui/index.js +4 -1
  84. package/lib/ui/index.min.js +1 -1
  85. package/lib/ui/src/log.js +1 -1
  86. package/lib/ui/src/log.min.js +1 -1
  87. package/lib/vxe-table/style/style.css +74 -2
  88. package/lib/vxe-table/style/style.min.css +1 -1
  89. package/package.json +2 -2
  90. package/packages/locale/lang/en-US.ts +4 -2
  91. package/packages/locale/lang/es-ES.ts +4 -2
  92. package/packages/locale/lang/hu-HU.ts +4 -2
  93. package/packages/locale/lang/ja-JP.ts +4 -2
  94. package/packages/locale/lang/ko-KR.ts +4 -2
  95. package/packages/locale/lang/pt-BR.ts +4 -2
  96. package/packages/locale/lang/ru-RU.ts +4 -2
  97. package/packages/locale/lang/uk-UA.ts +4 -2
  98. package/packages/locale/lang/vi-VN.ts +4 -2
  99. package/packages/locale/lang/zh-CHT.ts +4 -2
  100. package/packages/locale/lang/zh-CN.ts +4 -2
  101. package/packages/table/module/custom/panel.ts +1 -1
  102. package/packages/table/module/edit/hook.ts +7 -4
  103. package/packages/table/src/body.ts +22 -8
  104. package/packages/table/src/cell.ts +57 -24
  105. package/packages/table/src/column.ts +3 -1
  106. package/packages/table/src/columnInfo.ts +1 -0
  107. package/packages/table/src/emits.ts +4 -0
  108. package/packages/table/src/props.ts +2 -0
  109. package/packages/table/src/table.ts +258 -42
  110. package/packages/ui/index.ts +3 -0
  111. package/styles/components/table-module/custom.scss +9 -3
  112. package/styles/components/table.scss +80 -0
  113. /package/es/{iconfont.1730681238555.ttf → iconfont.1730873064176.ttf} +0 -0
  114. /package/es/{iconfont.1730681238555.woff → iconfont.1730873064176.woff} +0 -0
  115. /package/es/{iconfont.1730681238555.woff2 → iconfont.1730873064176.woff2} +0 -0
  116. /package/lib/{iconfont.1730681238555.ttf → iconfont.1730873064176.ttf} +0 -0
  117. /package/lib/{iconfont.1730681238555.woff → iconfont.1730873064176.woff} +0 -0
  118. /package/lib/{iconfont.1730681238555.woff2 → iconfont.1730873064176.woff2} +0 -0
@@ -5,7 +5,7 @@ import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/sr
5
5
  import { updateCellTitle } from '../../ui/src/dom';
6
6
  import { createColumn, getRowid } from './util';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
8
- const { getI18n, getIcon, renderer, formats } = VxeUI;
8
+ const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI;
9
9
  function renderTitlePrefixIcon(params) {
10
10
  const { $table, column } = params;
11
11
  const titlePrefix = column.titlePrefix || column.titleHelp;
@@ -40,6 +40,33 @@ function renderTitleSuffixIcon(params) {
40
40
  ]
41
41
  : [];
42
42
  }
43
+ function renderCellDragIcon(params) {
44
+ const { $table } = params;
45
+ return h('span', {
46
+ key: 'dg',
47
+ class: 'vxe-cell--drag-handle',
48
+ onMousedown(evnt) {
49
+ $table.handleCellDragMousedownEvent(evnt, params);
50
+ },
51
+ onMouseup: $table.handleCellDragMouseupEvent
52
+ }, [
53
+ h('i', {
54
+ class: 'vxe-table-icon-drag-handle'
55
+ })
56
+ ]);
57
+ }
58
+ function renderCellBaseVNs(params, content) {
59
+ const { $table, column } = params;
60
+ const { dragSort } = column;
61
+ const vns = XEUtils.isArray(content) ? content : [content];
62
+ const { computeRowOpts, computeDragOpts } = $table.getComputeMaps();
63
+ const rowOpts = computeRowOpts.value;
64
+ const dragOpts = computeDragOpts.value;
65
+ if (dragSort && rowOpts.drag && dragOpts.showIcon) {
66
+ vns.unshift(renderCellDragIcon(params));
67
+ }
68
+ return vns;
69
+ }
43
70
  function renderTitleContent(params, content) {
44
71
  const { $table, column } = params;
45
72
  const { props, reactData } = $table;
@@ -233,7 +260,7 @@ export const Cell = {
233
260
  const renderOpts = editRender || cellRender;
234
261
  const defaultSlot = slots ? slots.default : null;
235
262
  if (defaultSlot) {
236
- return $table.callSlot(defaultSlot, params);
263
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
237
264
  }
238
265
  if (renderOpts) {
239
266
  const compConf = renderer.get(renderOpts.name);
@@ -242,13 +269,13 @@ export const Cell = {
242
269
  const rtDefault = compConf.renderTableDefault || compConf.renderDefault;
243
270
  const renderFn = editRender ? rtCell : rtDefault;
244
271
  if (renderFn) {
245
- return getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)));
272
+ return renderCellBaseVNs(params, getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))));
246
273
  }
247
274
  }
248
275
  }
249
276
  const cellValue = $table.getCellLabel(row, column);
250
277
  const cellPlaceholder = editRender ? editRender.placeholder : '';
251
- return [
278
+ return renderCellBaseVNs(params, [
252
279
  h('span', {
253
280
  class: 'vxe-cell--label'
254
281
  }, [
@@ -259,7 +286,7 @@ export const Cell = {
259
286
  }, formatText(getFuncText(cellPlaceholder), 1))
260
287
  : h('span', formatText(cellValue, 1))
261
288
  ])
262
- ];
289
+ ]);
263
290
  },
264
291
  renderTreeCell(params) {
265
292
  return Cell.renderTreeIcon(params, Cell.renderDefaultCell(params));
@@ -354,11 +381,13 @@ export const Cell = {
354
381
  const { slots } = column;
355
382
  const defaultSlot = slots ? slots.default : null;
356
383
  if (defaultSlot) {
357
- return $table.callSlot(defaultSlot, params);
384
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
358
385
  }
359
386
  const { seq } = params;
360
387
  const seqMethod = seqOpts.seqMethod;
361
- return [formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)];
388
+ return renderCellBaseVNs(params, [
389
+ h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)
390
+ ]);
362
391
  },
363
392
  renderTreeIndexCell(params) {
364
393
  return Cell.renderTreeIcon(params, Cell.renderSeqCell(params));
@@ -408,7 +437,7 @@ export const Cell = {
408
437
  }
409
438
  const radioParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible });
410
439
  if (radioSlot) {
411
- return $table.callSlot(radioSlot, radioParams);
440
+ return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams));
412
441
  }
413
442
  const radioVNs = [];
414
443
  if (isVisible) {
@@ -421,12 +450,12 @@ export const Cell = {
421
450
  class: 'vxe-radio--label'
422
451
  }, defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField)));
423
452
  }
424
- return [
453
+ return renderCellBaseVNs(params, [
425
454
  h('span', Object.assign({ class: ['vxe-cell--radio', {
426
455
  'is--checked': isChecked,
427
456
  'is--disabled': isDisabled
428
457
  }] }, ons), radioVNs)
429
- ];
458
+ ]);
430
459
  },
431
460
  renderTreeRadioCell(params) {
432
461
  return Cell.renderTreeIcon(params, Cell.renderRadioCell(params));
@@ -519,7 +548,7 @@ export const Cell = {
519
548
  }
520
549
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
521
550
  if (checkboxSlot) {
522
- return $table.callSlot(checkboxSlot, checkboxParams);
551
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
523
552
  }
524
553
  const checkVNs = [];
525
554
  if (isVisible) {
@@ -532,14 +561,14 @@ export const Cell = {
532
561
  class: 'vxe-checkbox--label'
533
562
  }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
534
563
  }
535
- return [
564
+ return renderCellBaseVNs(params, [
536
565
  h('span', Object.assign({ class: ['vxe-cell--checkbox', {
537
566
  'is--checked': isChecked,
538
567
  'is--disabled': isDisabled,
539
568
  'is--indeterminate': indeterminate,
540
569
  'is--hidden': !isVisible
541
570
  }] }, ons), checkVNs)
542
- ];
571
+ ]);
543
572
  },
544
573
  renderTreeSelectionCell(params) {
545
574
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCell(params));
@@ -580,7 +609,7 @@ export const Cell = {
580
609
  }
581
610
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
582
611
  if (checkboxSlot) {
583
- return $table.callSlot(checkboxSlot, checkboxParams);
612
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
584
613
  }
585
614
  const checkVNs = [];
586
615
  if (isVisible) {
@@ -593,14 +622,14 @@ export const Cell = {
593
622
  }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
594
623
  }
595
624
  }
596
- return [
625
+ return renderCellBaseVNs(params, [
597
626
  h('span', Object.assign({ class: ['vxe-cell--checkbox', {
598
627
  'is--checked': isChecked,
599
628
  'is--disabled': isDisabled,
600
629
  'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : isIndeterminate,
601
630
  'is--hidden': !isVisible
602
631
  }] }, ons), checkVNs)
603
- ];
632
+ ]);
604
633
  },
605
634
  renderTreeSelectionCellByProp(params) {
606
635
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCellByProp(params));
@@ -621,7 +650,7 @@ export const Cell = {
621
650
  let isAceived = false;
622
651
  let isLazyLoading = false;
623
652
  if (iconSlot) {
624
- return $table.callSlot(iconSlot, params);
653
+ return renderCellBaseVNs(params, $table.callSlot(iconSlot, params));
625
654
  }
626
655
  if (!isHidden) {
627
656
  const rowid = getRowid($table, row);
@@ -630,7 +659,7 @@ export const Cell = {
630
659
  isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
631
660
  }
632
661
  }
633
- return [
662
+ return renderCellBaseVNs(params, [
634
663
  showIcon && (!visibleMethod || visibleMethod(params))
635
664
  ? h('span', {
636
665
  class: ['vxe-table--expanded', {
@@ -644,13 +673,13 @@ export const Cell = {
644
673
  class: ['vxe-table--expand-btn', isLazyLoading ? (iconLoaded || getIcon().TABLE_EXPAND_LOADED) : (isAceived ? (iconOpen || getIcon().TABLE_EXPAND_OPEN) : (iconClose || getIcon().TABLE_EXPAND_CLOSE))]
645
674
  })
646
675
  ])
647
- : null,
676
+ : renderEmptyElement($table),
648
677
  defaultSlot || labelField
649
678
  ? h('span', {
650
679
  class: 'vxe-table--expand-label'
651
680
  }, defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField))
652
- : null
653
- ];
681
+ : renderEmptyElement($table)
682
+ ]);
654
683
  },
655
684
  renderExpandData(params) {
656
685
  const { $table, column } = params;
@@ -678,14 +707,14 @@ export const Cell = {
678
707
  const { slots } = column;
679
708
  const defaultSlot = slots ? slots.default : null;
680
709
  if (defaultSlot) {
681
- return $table.callSlot(defaultSlot, params);
710
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
682
711
  }
683
- return [
712
+ return renderCellBaseVNs(params, [
684
713
  h('span', {
685
714
  class: 'vxe-cell--html',
686
715
  innerHTML: getDefaultCellLabel(params)
687
716
  })
688
- ];
717
+ ]);
689
718
  },
690
719
  renderTreeHTMLCell(params) {
691
720
  return Cell.renderTreeIcon(params, Cell.renderHTMLCell(params));
@@ -78,8 +78,10 @@ export const columnProps = {
78
78
  filterRecoverMethod: Function,
79
79
  // 筛选模板配置项
80
80
  filterRender: Object,
81
- // 指定为树节点
81
+ // 设置为树节点
82
82
  treeNode: Boolean,
83
+ // 指定为树节点
84
+ dragSort: Boolean,
83
85
  // 是否可视
84
86
  visible: {
85
87
  type: Boolean,
@@ -80,6 +80,7 @@ export class ColumnInfo {
80
80
  filterRecoverMethod: _vm.filterRecoverMethod,
81
81
  filterRender: _vm.filterRender,
82
82
  treeNode: _vm.treeNode,
83
+ dragSort: _vm.dragSort,
83
84
  cellType: _vm.cellType,
84
85
  cellRender: _vm.cellRender,
85
86
  editRender: _vm.editRender,
@@ -39,6 +39,9 @@ export default [
39
39
  'toggle-tree-expand',
40
40
  'menu-click',
41
41
  'edit-closed',
42
+ 'row-dragstart',
43
+ 'row-dragover',
44
+ 'row-dragend',
42
45
  'edit-actived',
43
46
  'edit-activated',
44
47
  'edit-disabled',
@@ -180,6 +180,8 @@ export default {
180
180
  cellConfig: Object,
181
181
  // 行配置信息
182
182
  rowConfig: Object,
183
+ // 可拖拽配置项
184
+ dragConfig: Object,
183
185
  // 列调整配置项
184
186
  resizableConfig: Object,
185
187
  // 序号配置项