vxe-table 4.8.0 → 4.8.2

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 +65 -27
  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 +77 -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 +77 -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 +378 -85
  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 +79 -27
  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 +77 -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 +77 -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 +69 -27
  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 +14 -3
  112. package/styles/components/table.scss +80 -0
  113. /package/es/{iconfont.1730681238555.ttf → iconfont.1730898232530.ttf} +0 -0
  114. /package/es/{iconfont.1730681238555.woff → iconfont.1730898232530.woff} +0 -0
  115. /package/es/{iconfont.1730681238555.woff2 → iconfont.1730898232530.woff2} +0 -0
  116. /package/lib/{iconfont.1730681238555.ttf → iconfont.1730898232530.ttf} +0 -0
  117. /package/lib/{iconfont.1730681238555.woff → iconfont.1730898232530.woff} +0 -0
  118. /package/lib/{iconfont.1730681238555.woff2 → iconfont.1730898232530.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,42 @@ function renderTitleSuffixIcon(params) {
40
40
  ]
41
41
  : [];
42
42
  }
43
+ function renderCellDragIcon(params) {
44
+ const { $table } = params;
45
+ const { computeDragOpts } = $table.getComputeMaps();
46
+ const dragOpts = computeDragOpts.value;
47
+ const { rowDisabledMethod } = dragOpts;
48
+ const isDisabled = rowDisabledMethod && rowDisabledMethod(params);
49
+ return h('span', {
50
+ key: 'dg',
51
+ class: ['vxe-cell--drag-handle', {
52
+ 'is--disabled': isDisabled
53
+ }],
54
+ onMousedown(evnt) {
55
+ if (!isDisabled) {
56
+ $table.handleCellDragMousedownEvent(evnt, params);
57
+ }
58
+ },
59
+ onMouseup: $table.handleCellDragMouseupEvent
60
+ }, [
61
+ h('i', {
62
+ class: 'vxe-table-icon-drag-handle'
63
+ })
64
+ ]);
65
+ }
66
+ function renderCellBaseVNs(params, content) {
67
+ const { $table, column } = params;
68
+ const { dragSort } = column;
69
+ const vns = XEUtils.isArray(content) ? content : [content];
70
+ const { computeRowOpts, computeDragOpts } = $table.getComputeMaps();
71
+ const rowOpts = computeRowOpts.value;
72
+ const dragOpts = computeDragOpts.value;
73
+ const { showRowIcon, rowVisibleMethod } = dragOpts;
74
+ if (dragSort && rowOpts.drag && (showRowIcon && (!rowVisibleMethod || rowVisibleMethod(params)))) {
75
+ vns.unshift(renderCellDragIcon(params));
76
+ }
77
+ return vns;
78
+ }
43
79
  function renderTitleContent(params, content) {
44
80
  const { $table, column } = params;
45
81
  const { props, reactData } = $table;
@@ -233,7 +269,7 @@ export const Cell = {
233
269
  const renderOpts = editRender || cellRender;
234
270
  const defaultSlot = slots ? slots.default : null;
235
271
  if (defaultSlot) {
236
- return $table.callSlot(defaultSlot, params);
272
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
237
273
  }
238
274
  if (renderOpts) {
239
275
  const compConf = renderer.get(renderOpts.name);
@@ -242,13 +278,13 @@ export const Cell = {
242
278
  const rtDefault = compConf.renderTableDefault || compConf.renderDefault;
243
279
  const renderFn = editRender ? rtCell : rtDefault;
244
280
  if (renderFn) {
245
- return getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)));
281
+ return renderCellBaseVNs(params, getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))));
246
282
  }
247
283
  }
248
284
  }
249
285
  const cellValue = $table.getCellLabel(row, column);
250
286
  const cellPlaceholder = editRender ? editRender.placeholder : '';
251
- return [
287
+ return renderCellBaseVNs(params, [
252
288
  h('span', {
253
289
  class: 'vxe-cell--label'
254
290
  }, [
@@ -259,7 +295,7 @@ export const Cell = {
259
295
  }, formatText(getFuncText(cellPlaceholder), 1))
260
296
  : h('span', formatText(cellValue, 1))
261
297
  ])
262
- ];
298
+ ]);
263
299
  },
264
300
  renderTreeCell(params) {
265
301
  return Cell.renderTreeIcon(params, Cell.renderDefaultCell(params));
@@ -354,11 +390,13 @@ export const Cell = {
354
390
  const { slots } = column;
355
391
  const defaultSlot = slots ? slots.default : null;
356
392
  if (defaultSlot) {
357
- return $table.callSlot(defaultSlot, params);
393
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
358
394
  }
359
395
  const { seq } = params;
360
396
  const seqMethod = seqOpts.seqMethod;
361
- return [formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)];
397
+ return renderCellBaseVNs(params, [
398
+ h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)
399
+ ]);
362
400
  },
363
401
  renderTreeIndexCell(params) {
364
402
  return Cell.renderTreeIcon(params, Cell.renderSeqCell(params));
@@ -408,7 +446,7 @@ export const Cell = {
408
446
  }
409
447
  const radioParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible });
410
448
  if (radioSlot) {
411
- return $table.callSlot(radioSlot, radioParams);
449
+ return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams));
412
450
  }
413
451
  const radioVNs = [];
414
452
  if (isVisible) {
@@ -421,12 +459,12 @@ export const Cell = {
421
459
  class: 'vxe-radio--label'
422
460
  }, defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField)));
423
461
  }
424
- return [
462
+ return renderCellBaseVNs(params, [
425
463
  h('span', Object.assign({ class: ['vxe-cell--radio', {
426
464
  'is--checked': isChecked,
427
465
  'is--disabled': isDisabled
428
466
  }] }, ons), radioVNs)
429
- ];
467
+ ]);
430
468
  },
431
469
  renderTreeRadioCell(params) {
432
470
  return Cell.renderTreeIcon(params, Cell.renderRadioCell(params));
@@ -519,7 +557,7 @@ export const Cell = {
519
557
  }
520
558
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
521
559
  if (checkboxSlot) {
522
- return $table.callSlot(checkboxSlot, checkboxParams);
560
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
523
561
  }
524
562
  const checkVNs = [];
525
563
  if (isVisible) {
@@ -532,14 +570,14 @@ export const Cell = {
532
570
  class: 'vxe-checkbox--label'
533
571
  }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
534
572
  }
535
- return [
573
+ return renderCellBaseVNs(params, [
536
574
  h('span', Object.assign({ class: ['vxe-cell--checkbox', {
537
575
  'is--checked': isChecked,
538
576
  'is--disabled': isDisabled,
539
577
  'is--indeterminate': indeterminate,
540
578
  'is--hidden': !isVisible
541
579
  }] }, ons), checkVNs)
542
- ];
580
+ ]);
543
581
  },
544
582
  renderTreeSelectionCell(params) {
545
583
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCell(params));
@@ -580,7 +618,7 @@ export const Cell = {
580
618
  }
581
619
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
582
620
  if (checkboxSlot) {
583
- return $table.callSlot(checkboxSlot, checkboxParams);
621
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
584
622
  }
585
623
  const checkVNs = [];
586
624
  if (isVisible) {
@@ -593,14 +631,14 @@ export const Cell = {
593
631
  }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
594
632
  }
595
633
  }
596
- return [
634
+ return renderCellBaseVNs(params, [
597
635
  h('span', Object.assign({ class: ['vxe-cell--checkbox', {
598
636
  'is--checked': isChecked,
599
637
  'is--disabled': isDisabled,
600
638
  'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : isIndeterminate,
601
639
  'is--hidden': !isVisible
602
640
  }] }, ons), checkVNs)
603
- ];
641
+ ]);
604
642
  },
605
643
  renderTreeSelectionCellByProp(params) {
606
644
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCellByProp(params));
@@ -621,7 +659,7 @@ export const Cell = {
621
659
  let isAceived = false;
622
660
  let isLazyLoading = false;
623
661
  if (iconSlot) {
624
- return $table.callSlot(iconSlot, params);
662
+ return renderCellBaseVNs(params, $table.callSlot(iconSlot, params));
625
663
  }
626
664
  if (!isHidden) {
627
665
  const rowid = getRowid($table, row);
@@ -630,7 +668,7 @@ export const Cell = {
630
668
  isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
631
669
  }
632
670
  }
633
- return [
671
+ return renderCellBaseVNs(params, [
634
672
  showIcon && (!visibleMethod || visibleMethod(params))
635
673
  ? h('span', {
636
674
  class: ['vxe-table--expanded', {
@@ -644,13 +682,13 @@ export const Cell = {
644
682
  class: ['vxe-table--expand-btn', isLazyLoading ? (iconLoaded || getIcon().TABLE_EXPAND_LOADED) : (isAceived ? (iconOpen || getIcon().TABLE_EXPAND_OPEN) : (iconClose || getIcon().TABLE_EXPAND_CLOSE))]
645
683
  })
646
684
  ])
647
- : null,
685
+ : renderEmptyElement($table),
648
686
  defaultSlot || labelField
649
687
  ? h('span', {
650
688
  class: 'vxe-table--expand-label'
651
689
  }, defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField))
652
- : null
653
- ];
690
+ : renderEmptyElement($table)
691
+ ]);
654
692
  },
655
693
  renderExpandData(params) {
656
694
  const { $table, column } = params;
@@ -678,14 +716,14 @@ export const Cell = {
678
716
  const { slots } = column;
679
717
  const defaultSlot = slots ? slots.default : null;
680
718
  if (defaultSlot) {
681
- return $table.callSlot(defaultSlot, params);
719
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
682
720
  }
683
- return [
721
+ return renderCellBaseVNs(params, [
684
722
  h('span', {
685
723
  class: 'vxe-cell--html',
686
724
  innerHTML: getDefaultCellLabel(params)
687
725
  })
688
- ];
726
+ ]);
689
727
  },
690
728
  renderTreeHTMLCell(params) {
691
729
  return Cell.renderTreeIcon(params, Cell.renderHTMLCell(params));
@@ -850,14 +888,14 @@ export const Cell = {
850
888
  return [];
851
889
  }
852
890
  if (defaultSlot) {
853
- return $table.callSlot(defaultSlot, cellParams);
891
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, cellParams));
854
892
  }
855
893
  if (formatter) {
856
- return [
894
+ return renderCellBaseVNs(params, [
857
895
  h('span', {
858
896
  class: 'vxe-cell--label'
859
897
  }, getDefaultCellLabel(cellParams))
860
- ];
898
+ ]);
861
899
  }
862
900
  return Cell.renderDefaultCell(cellParams);
863
901
  }
@@ -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
  // 序号配置项