vxe-table 4.12.0-beta.2 → 4.12.0-beta.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.
Files changed (160) hide show
  1. package/es/grid/src/grid.js +61 -44
  2. package/es/locale/lang/ar-EG.js +7 -1
  3. package/es/locale/lang/de-DE.js +7 -1
  4. package/es/locale/lang/en-US.js +7 -1
  5. package/es/locale/lang/es-ES.js +7 -1
  6. package/es/locale/lang/fr-FR.js +7 -1
  7. package/es/locale/lang/hu-HU.js +7 -1
  8. package/es/locale/lang/hy-AM.js +7 -1
  9. package/es/locale/lang/id-ID.js +7 -1
  10. package/es/locale/lang/it-IT.js +7 -1
  11. package/es/locale/lang/ja-JP.js +7 -1
  12. package/es/locale/lang/ko-KR.js +7 -1
  13. package/es/locale/lang/nb-NO.js +7 -1
  14. package/es/locale/lang/pt-BR.js +7 -1
  15. package/es/locale/lang/ru-RU.js +7 -1
  16. package/es/locale/lang/th-TH.js +7 -1
  17. package/es/locale/lang/ug-CN.js +7 -1
  18. package/es/locale/lang/uk-UA.js +7 -1
  19. package/es/locale/lang/vi-VN.js +7 -1
  20. package/es/locale/lang/zh-CHT.js +7 -1
  21. package/es/locale/lang/zh-CN.js +7 -1
  22. package/es/style.css +1 -1
  23. package/es/table/module/edit/hook.js +8 -10
  24. package/es/table/module/filter/panel.js +12 -2
  25. package/es/table/module/keyboard/hook.js +47 -4
  26. package/es/table/module/validator/hook.js +2 -2
  27. package/es/table/render/index.js +91 -60
  28. package/es/table/src/body.js +22 -17
  29. package/es/table/src/cell.js +25 -20
  30. package/es/table/src/footer.js +9 -4
  31. package/es/table/src/header.js +2 -2
  32. package/es/table/src/props.js +4 -0
  33. package/es/table/src/table.js +616 -411
  34. package/es/table/src/util.js +58 -3
  35. package/es/ui/index.js +1 -1
  36. package/es/ui/src/log.js +1 -1
  37. package/helper/vetur/attributes.json +1 -1
  38. package/helper/vetur/tags.json +1 -1
  39. package/lib/grid/src/grid.js +58 -48
  40. package/lib/grid/src/grid.min.js +1 -1
  41. package/lib/index.umd.js +1281 -12149
  42. package/lib/index.umd.min.js +1 -1
  43. package/lib/locale/lang/ar-EG.js +7 -1
  44. package/lib/locale/lang/ar-EG.min.js +1 -1
  45. package/lib/locale/lang/de-DE.js +7 -1
  46. package/lib/locale/lang/de-DE.min.js +1 -1
  47. package/lib/locale/lang/en-US.js +7 -1
  48. package/lib/locale/lang/en-US.min.js +1 -1
  49. package/lib/locale/lang/en-US.umd.js +7 -1
  50. package/lib/locale/lang/es-ES.js +7 -1
  51. package/lib/locale/lang/es-ES.min.js +1 -1
  52. package/lib/locale/lang/es-ES.umd.js +7 -1
  53. package/lib/locale/lang/fr-FR.js +7 -1
  54. package/lib/locale/lang/fr-FR.min.js +1 -1
  55. package/lib/locale/lang/hu-HU.js +7 -1
  56. package/lib/locale/lang/hu-HU.min.js +1 -1
  57. package/lib/locale/lang/hu-HU.umd.js +7 -1
  58. package/lib/locale/lang/hy-AM.js +7 -1
  59. package/lib/locale/lang/hy-AM.min.js +1 -1
  60. package/lib/locale/lang/id-ID.js +7 -1
  61. package/lib/locale/lang/id-ID.min.js +1 -1
  62. package/lib/locale/lang/it-IT.js +7 -1
  63. package/lib/locale/lang/it-IT.min.js +1 -1
  64. package/lib/locale/lang/ja-JP.js +7 -1
  65. package/lib/locale/lang/ja-JP.min.js +1 -1
  66. package/lib/locale/lang/ja-JP.umd.js +7 -1
  67. package/lib/locale/lang/ko-KR.js +7 -1
  68. package/lib/locale/lang/ko-KR.min.js +1 -1
  69. package/lib/locale/lang/ko-KR.umd.js +7 -1
  70. package/lib/locale/lang/nb-NO.js +7 -1
  71. package/lib/locale/lang/nb-NO.min.js +1 -1
  72. package/lib/locale/lang/pt-BR.js +7 -1
  73. package/lib/locale/lang/pt-BR.min.js +1 -1
  74. package/lib/locale/lang/pt-BR.umd.js +7 -1
  75. package/lib/locale/lang/ru-RU.js +7 -1
  76. package/lib/locale/lang/ru-RU.min.js +1 -1
  77. package/lib/locale/lang/ru-RU.umd.js +7 -1
  78. package/lib/locale/lang/th-TH.js +7 -1
  79. package/lib/locale/lang/th-TH.min.js +1 -1
  80. package/lib/locale/lang/ug-CN.js +7 -1
  81. package/lib/locale/lang/ug-CN.min.js +1 -1
  82. package/lib/locale/lang/uk-UA.js +7 -1
  83. package/lib/locale/lang/uk-UA.min.js +1 -1
  84. package/lib/locale/lang/uk-UA.umd.js +7 -1
  85. package/lib/locale/lang/vi-VN.js +7 -1
  86. package/lib/locale/lang/vi-VN.min.js +1 -1
  87. package/lib/locale/lang/zh-CHT.js +7 -1
  88. package/lib/locale/lang/zh-CHT.min.js +1 -1
  89. package/lib/locale/lang/zh-CN.js +7 -1
  90. package/lib/locale/lang/zh-CN.min.js +1 -1
  91. package/lib/locale/lang/zh-CN.umd.js +7 -1
  92. package/lib/style.css +1 -1
  93. package/lib/table/module/edit/hook.js +10 -11
  94. package/lib/table/module/edit/hook.min.js +1 -1
  95. package/lib/table/module/filter/panel.js +8 -2
  96. package/lib/table/module/filter/panel.min.js +1 -1
  97. package/lib/table/module/keyboard/hook.js +51 -4
  98. package/lib/table/module/keyboard/hook.min.js +1 -1
  99. package/lib/table/module/validator/hook.js +3 -3
  100. package/lib/table/module/validator/hook.min.js +1 -1
  101. package/lib/table/render/index.js +100 -65
  102. package/lib/table/render/index.min.js +1 -1
  103. package/lib/table/src/body.js +27 -17
  104. package/lib/table/src/body.min.js +1 -1
  105. package/lib/table/src/cell.js +37 -21
  106. package/lib/table/src/cell.min.js +1 -1
  107. package/lib/table/src/footer.js +9 -3
  108. package/lib/table/src/footer.min.js +1 -1
  109. package/lib/table/src/header.js +2 -1
  110. package/lib/table/src/header.min.js +1 -1
  111. package/lib/table/src/props.js +4 -0
  112. package/lib/table/src/props.min.js +1 -1
  113. package/lib/table/src/table.js +727 -445
  114. package/lib/table/src/table.min.js +1 -1
  115. package/lib/table/src/util.js +65 -6
  116. package/lib/table/src/util.min.js +1 -1
  117. package/lib/ui/index.js +1 -1
  118. package/lib/ui/index.min.js +1 -1
  119. package/lib/ui/src/log.js +1 -1
  120. package/lib/ui/src/log.min.js +1 -1
  121. package/package.json +2 -2
  122. package/packages/grid/src/grid.ts +65 -50
  123. package/packages/locale/lang/ar-EG.ts +7 -1
  124. package/packages/locale/lang/de-DE.ts +7 -1
  125. package/packages/locale/lang/en-US.ts +7 -1
  126. package/packages/locale/lang/es-ES.ts +7 -1
  127. package/packages/locale/lang/fr-FR.ts +7 -1
  128. package/packages/locale/lang/hu-HU.ts +7 -1
  129. package/packages/locale/lang/hy-AM.ts +7 -1
  130. package/packages/locale/lang/id-ID.ts +7 -1
  131. package/packages/locale/lang/it-IT.ts +7 -1
  132. package/packages/locale/lang/ja-JP.ts +7 -1
  133. package/packages/locale/lang/ko-KR.ts +7 -1
  134. package/packages/locale/lang/nb-NO.ts +7 -1
  135. package/packages/locale/lang/pt-BR.ts +7 -1
  136. package/packages/locale/lang/ru-RU.ts +7 -1
  137. package/packages/locale/lang/th-TH.ts +7 -1
  138. package/packages/locale/lang/ug-CN.ts +7 -1
  139. package/packages/locale/lang/uk-UA.ts +7 -1
  140. package/packages/locale/lang/vi-VN.ts +7 -1
  141. package/packages/locale/lang/zh-CHT.ts +7 -1
  142. package/packages/locale/lang/zh-CN.ts +7 -1
  143. package/packages/table/module/edit/hook.ts +8 -10
  144. package/packages/table/module/filter/panel.ts +12 -2
  145. package/packages/table/module/keyboard/hook.ts +47 -6
  146. package/packages/table/module/validator/hook.ts +2 -2
  147. package/packages/table/render/index.ts +90 -59
  148. package/packages/table/src/body.ts +21 -16
  149. package/packages/table/src/cell.ts +25 -20
  150. package/packages/table/src/footer.ts +9 -4
  151. package/packages/table/src/header.ts +2 -2
  152. package/packages/table/src/props.ts +4 -0
  153. package/packages/table/src/table.ts +625 -411
  154. package/packages/table/src/util.ts +66 -3
  155. /package/es/{iconfont.1741080000843.ttf → iconfont.1742437957812.ttf} +0 -0
  156. /package/es/{iconfont.1741080000843.woff → iconfont.1742437957812.woff} +0 -0
  157. /package/es/{iconfont.1741080000843.woff2 → iconfont.1742437957812.woff2} +0 -0
  158. /package/lib/{iconfont.1741080000843.ttf → iconfont.1742437957812.ttf} +0 -0
  159. /package/lib/{iconfont.1741080000843.woff → iconfont.1742437957812.woff} +0 -0
  160. /package/lib/{iconfont.1741080000843.woff2 → iconfont.1742437957812.woff2} +0 -0
@@ -84,14 +84,24 @@ export default defineComponent({
84
84
  if (filterSlot) {
85
85
  return [
86
86
  h('div', {
87
- class: 'vxe-table--filter-template'
87
+ class: 'vxe-table--filter-template',
88
+ style: maxHeight
89
+ ? {
90
+ maxHeight: `${maxHeight}px`
91
+ }
92
+ : {}
88
93
  }, $xeTable.callSlot(filterSlot, params))
89
94
  ];
90
95
  }
91
96
  else if (rtFilter) {
92
97
  return [
93
98
  h('div', {
94
- class: 'vxe-table--filter-template'
99
+ class: 'vxe-table--filter-template',
100
+ style: maxHeight
101
+ ? {
102
+ maxHeight: `${maxHeight}px`
103
+ }
104
+ : {}
95
105
  }, getSlotVNs(rtFilter(filterRender, params)))
96
106
  ];
97
107
  }
@@ -28,7 +28,7 @@ hooks.add('tableKeyboardModule', {
28
28
  setupTable($xeTable) {
29
29
  const { props, reactData, internalData } = $xeTable;
30
30
  const { refElem } = $xeTable.getRefMaps();
31
- const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
31
+ const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeColumnOpts, computeCellOpts, computeDefaultRowHeight, computeCurrentRowOpts, computeCurrentColumnOpts } = $xeTable.getComputeMaps();
32
32
  function getCheckboxRangeRows(evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
33
33
  const { showOverflow } = props;
34
34
  const { fullAllDataRowIdData, isResizeCellHeight } = internalData;
@@ -287,6 +287,10 @@ hooks.add('tableKeyboardModule', {
287
287
  const { editConfig } = props;
288
288
  const { afterFullData, visibleColumn } = internalData;
289
289
  const editOpts = computeEditOpts.value;
290
+ const rowOpts = computeRowOpts.value;
291
+ const currentRowOpts = computeCurrentRowOpts.value;
292
+ const columnOpts = computeColumnOpts.value;
293
+ const currentColumnOpts = computeCurrentColumnOpts.value;
290
294
  let targetRow;
291
295
  let targetRowIndex;
292
296
  let targetColumnIndex;
@@ -333,6 +337,12 @@ hooks.add('tableKeyboardModule', {
333
337
  params.columnIndex = targetColumnIndex;
334
338
  params.column = targetColumn;
335
339
  params.cell = $xeTable.getCellElement(params.row, params.column);
340
+ if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
341
+ $xeTable.triggerCurrentRowEvent(evnt, params);
342
+ }
343
+ if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
344
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
345
+ }
336
346
  if (editConfig) {
337
347
  if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
338
348
  if (editOpts.mode === 'row') {
@@ -340,13 +350,17 @@ hooks.add('tableKeyboardModule', {
340
350
  }
341
351
  else {
342
352
  $xeTable.scrollToRow(params.row, params.column)
343
- .then(() => $xeTable.handleSelected(params, evnt));
353
+ .then(() => {
354
+ $xeTable.handleSelected(params, evnt);
355
+ });
344
356
  }
345
357
  }
346
358
  }
347
359
  else {
348
360
  $xeTable.scrollToRow(params.row, params.column)
349
- .then(() => $xeTable.handleSelected(params, evnt));
361
+ .then(() => {
362
+ $xeTable.handleSelected(params, evnt);
363
+ });
350
364
  }
351
365
  }
352
366
  },
@@ -358,7 +372,6 @@ hooks.add('tableKeyboardModule', {
358
372
  const treeOpts = computeTreeOpts.value;
359
373
  const childrenField = treeOpts.children || treeOpts.childrenField;
360
374
  let targetRow;
361
- evnt.preventDefault();
362
375
  if (currentRow) {
363
376
  if (treeConfig) {
364
377
  const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
@@ -383,6 +396,7 @@ hooks.add('tableKeyboardModule', {
383
396
  targetRow = afterFullData[0];
384
397
  }
385
398
  if (targetRow) {
399
+ evnt.preventDefault();
386
400
  const params = {
387
401
  $table: $xeTable,
388
402
  row: targetRow,
@@ -393,6 +407,35 @@ hooks.add('tableKeyboardModule', {
393
407
  .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
394
408
  }
395
409
  },
410
+ // 处理当前列方向键移动
411
+ moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
412
+ const { currentColumn } = reactData;
413
+ const { visibleColumn } = internalData;
414
+ let targetCol = null;
415
+ if (currentColumn) {
416
+ const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
417
+ if (isLeftArrow && _columnIndex > 0) {
418
+ targetCol = visibleColumn[_columnIndex - 1];
419
+ }
420
+ else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
421
+ targetCol = visibleColumn[_columnIndex + 1];
422
+ }
423
+ }
424
+ else {
425
+ targetCol = visibleColumn[0];
426
+ }
427
+ if (targetCol) {
428
+ evnt.preventDefault();
429
+ const params = {
430
+ $table: $xeTable,
431
+ column: targetCol,
432
+ columnIndex: $xeTable.getColumnIndex(targetCol),
433
+ $columnIndex: $xeTable.getVMColumnIndex(targetCol)
434
+ };
435
+ $xeTable.scrollToColumn(targetCol)
436
+ .then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
437
+ }
438
+ },
396
439
  // 处理可编辑方向键移动
397
440
  moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
398
441
  const { afterFullData, visibleColumn } = internalData;
@@ -85,8 +85,8 @@ hooks.add('tableValidatorModule', {
85
85
  const beginValidate = (rows, cols, cb, isFull) => {
86
86
  const validRest = {};
87
87
  const { editRules, treeConfig } = props;
88
- const { editStore, pendingRowMaps } = reactData;
89
- const { afterFullData } = internalData;
88
+ const { editStore } = reactData;
89
+ const { afterFullData, pendingRowMaps } = internalData;
90
90
  const { removeMaps } = editStore;
91
91
  const treeOpts = computeTreeOpts.value;
92
92
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -5,7 +5,7 @@ import { getCellValue, setCellValue } from '../../table/src/util';
5
5
  import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
6
6
  import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
7
7
  import { errLog } from '../../ui/src/log';
8
- const { getConfig, renderer, getI18n } = VxeUI;
8
+ const { getConfig, renderer, getI18n, getComponent } = VxeUI;
9
9
  const componentDefaultModelProp = 'modelValue';
10
10
  const defaultCompProps = {};
11
11
  function handleDefaultValue(value, defaultVal, initVal) {
@@ -29,7 +29,7 @@ function getOldComponentName(name) {
29
29
  return `vxe-${name.replace('$', '')}`;
30
30
  }
31
31
  function getDefaultComponent({ name }) {
32
- return resolveComponent(name);
32
+ return getComponent(name);
33
33
  }
34
34
  /**
35
35
  * 已废弃
@@ -335,7 +335,7 @@ function oldEditRender(renderOpts, params) {
335
335
  */
336
336
  function oldButtonEditRender(renderOpts, params) {
337
337
  return [
338
- h(resolveComponent('vxe-button'), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, null)), getComponentOns(renderOpts, params)))
338
+ h(getComponent('vxe-button'), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, null)), getComponentOns(renderOpts, params)))
339
339
  ];
340
340
  }
341
341
  /**
@@ -500,6 +500,63 @@ function handleExportTreeSelectMethod(params) {
500
500
  const { row, column, options } = params;
501
501
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
502
502
  }
503
+ function handleNumberCell(renderOpts, params) {
504
+ const { props = {}, showNegativeStatus } = renderOpts;
505
+ const { row, column } = params;
506
+ const { type } = props;
507
+ let cellValue = XEUtils.get(row, column.field);
508
+ let isNegative = false;
509
+ if (!isEmptyValue(cellValue)) {
510
+ const numberInputConfig = getConfig().numberInput || {};
511
+ if (type === 'float') {
512
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
513
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
514
+ cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
515
+ if (!autoFill) {
516
+ cellValue = XEUtils.toNumber(cellValue);
517
+ }
518
+ if (showNegativeStatus) {
519
+ if (cellValue < 0) {
520
+ isNegative = true;
521
+ }
522
+ }
523
+ }
524
+ else if (type === 'amount') {
525
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
526
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
527
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
528
+ cellValue = XEUtils.toNumber(cellValue);
529
+ if (showNegativeStatus) {
530
+ if (cellValue < 0) {
531
+ isNegative = true;
532
+ }
533
+ }
534
+ cellValue = XEUtils.commafy(cellValue, { digits });
535
+ if (!autoFill) {
536
+ const [iStr, dStr] = cellValue.split('.');
537
+ if (dStr) {
538
+ const dRest = dStr.replace(/0+$/, '');
539
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
540
+ }
541
+ }
542
+ if (showCurrency) {
543
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
544
+ }
545
+ }
546
+ else {
547
+ if (showNegativeStatus) {
548
+ if (XEUtils.toNumber(cellValue) < 0) {
549
+ isNegative = true;
550
+ }
551
+ }
552
+ }
553
+ }
554
+ return getCellLabelVNs(renderOpts, params, cellValue, isNegative
555
+ ? {
556
+ class: 'is--negative'
557
+ }
558
+ : {});
559
+ }
503
560
  /**
504
561
  * 表格 - 渲染器
505
562
  */
@@ -559,66 +616,19 @@ renderer.mixin({
559
616
  renderTableFilter: defaultFilterRender,
560
617
  tableFilterDefaultMethod: handleInputFilterMethod
561
618
  },
619
+ FormatNumberInput: {
620
+ renderTableDefault: handleNumberCell,
621
+ tableFilterDefaultMethod: handleInputFilterMethod,
622
+ tableExportMethod(params) {
623
+ const { row, column } = params;
624
+ const cellValue = XEUtils.get(row, column.field);
625
+ return cellValue;
626
+ }
627
+ },
562
628
  VxeNumberInput: {
563
629
  tableAutoFocus: 'input',
564
630
  renderTableEdit: defaultEditRender,
565
- renderTableCell(renderOpts, params) {
566
- const { props = {}, showNegativeStatus } = renderOpts;
567
- const { row, column } = params;
568
- const { type } = props;
569
- let cellValue = XEUtils.get(row, column.field);
570
- let isNegative = false;
571
- if (!isEmptyValue(cellValue)) {
572
- const numberInputConfig = getConfig().numberInput || {};
573
- if (type === 'float') {
574
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
575
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
576
- cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
577
- if (!autoFill) {
578
- cellValue = XEUtils.toNumber(cellValue);
579
- }
580
- if (showNegativeStatus) {
581
- if (cellValue < 0) {
582
- isNegative = true;
583
- }
584
- }
585
- }
586
- else if (type === 'amount') {
587
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
588
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
589
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
590
- cellValue = XEUtils.toNumber(cellValue);
591
- if (showNegativeStatus) {
592
- if (cellValue < 0) {
593
- isNegative = true;
594
- }
595
- }
596
- cellValue = XEUtils.commafy(cellValue, { digits });
597
- if (!autoFill) {
598
- const [iStr, dStr] = cellValue.split('.');
599
- if (dStr) {
600
- const dRest = dStr.replace(/0+$/, '');
601
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
602
- }
603
- }
604
- if (showCurrency) {
605
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
606
- }
607
- }
608
- else {
609
- if (showNegativeStatus) {
610
- if (XEUtils.toNumber(cellValue) < 0) {
611
- isNegative = true;
612
- }
613
- }
614
- }
615
- }
616
- return getCellLabelVNs(renderOpts, params, cellValue, isNegative
617
- ? {
618
- class: 'is--negative'
619
- }
620
- : {});
621
- },
631
+ renderTableCell: handleNumberCell,
622
632
  renderTableFooter(renderOpts, params) {
623
633
  const { props = {} } = renderOpts;
624
634
  const { row, column, _columnIndex } = params;
@@ -721,11 +731,22 @@ renderer.mixin({
721
731
  tableFilterDefaultMethod: handleFilterMethod,
722
732
  tableExportMethod: handleExportSelectMethod
723
733
  },
734
+ /**
735
+ * 已废弃,被 FormatSelect 替换
736
+ * @deprecated
737
+ */
724
738
  formatOption: {
725
739
  renderTableDefault(renderOpts, params) {
726
740
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
727
741
  }
728
742
  },
743
+ FormatSelect: {
744
+ renderTableDefault(renderOpts, params) {
745
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
746
+ },
747
+ tableFilterDefaultMethod: handleFilterMethod,
748
+ tableExportMethod: handleExportSelectMethod
749
+ },
729
750
  VxeTreeSelect: {
730
751
  tableAutoFocus: 'input',
731
752
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -734,11 +755,21 @@ renderer.mixin({
734
755
  },
735
756
  tableExportMethod: handleExportTreeSelectMethod
736
757
  },
758
+ /**
759
+ * 已废弃,被 FormatTreeSelect 替换
760
+ * @deprecated
761
+ */
737
762
  formatTree: {
738
763
  renderTableDefault(renderOpts, params) {
739
764
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
740
765
  }
741
766
  },
767
+ FormatTreeSelect: {
768
+ renderTableDefault(renderOpts, params) {
769
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
770
+ },
771
+ tableExportMethod: handleExportTreeSelectMethod
772
+ },
742
773
  VxeTableSelect: {
743
774
  tableAutoFocus: 'input',
744
775
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, inject, nextTick, onMounted, onUnmounted } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../ui';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
4
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
5
5
  import { updateCellTitle, getPropClass } from '../../ui/src/dom';
6
6
  import { isEnableConf } from '../../ui/src/utils';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
@@ -36,7 +36,7 @@ export default defineComponent({
36
36
  const { lastScrollTime, isDragResize } = tableReactData;
37
37
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover));
38
38
  };
39
- const renderLine = (params, cellHeight) => {
39
+ const renderLine = (rowid, params, cellHeight) => {
40
40
  const { row, column } = params;
41
41
  const { afterFullData } = tableInternalData;
42
42
  const { treeConfig } = tableProps;
@@ -46,7 +46,6 @@ export default defineComponent({
46
46
  if (slots && slots.line) {
47
47
  return $xeTable.callSlot(slots.line, params);
48
48
  }
49
- const rowid = getRowid($xeTable, row);
50
49
  const rest = fullAllDataRowIdData[rowid];
51
50
  let rLevel = 0;
52
51
  let prevRow = null;
@@ -205,6 +204,7 @@ export default defineComponent({
205
204
  tdOns.onDblclick = (evnt) => {
206
205
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
207
206
  };
207
+ let isMergeCell = false;
208
208
  // 合并行或列
209
209
  if (mergeList.length) {
210
210
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -214,9 +214,11 @@ export default defineComponent({
214
214
  return null;
215
215
  }
216
216
  if (rowspan > 1) {
217
+ isMergeCell = true;
217
218
  tdAttrs.rowspan = rowspan;
218
219
  }
219
220
  if (colspan > 1) {
221
+ isMergeCell = true;
220
222
  tdAttrs.colspan = colspan;
221
223
  }
222
224
  }
@@ -249,12 +251,14 @@ export default defineComponent({
249
251
  const isLastColumn = $columnIndex === columns.length - 1;
250
252
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
251
253
  let isVNPreEmptyStatus = false;
252
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
253
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
254
- isVNPreEmptyStatus = true;
255
- }
256
- else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
257
- isVNPreEmptyStatus = true;
254
+ if (!isMergeCell) {
255
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
256
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
257
+ isVNPreEmptyStatus = true;
258
+ }
259
+ else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
260
+ isVNPreEmptyStatus = true;
261
+ }
258
262
  }
259
263
  }
260
264
  const tcStyle = {};
@@ -278,7 +282,7 @@ export default defineComponent({
278
282
  }
279
283
  else {
280
284
  // 渲染单元格
281
- tdVNs.push(...renderLine(cellParams, cellHeight), h('div', {
285
+ tdVNs.push(...renderLine(rowid, cellParams, cellHeight), h('div', {
282
286
  key: 'tc',
283
287
  class: ['vxe-cell', {
284
288
  'c--title': showTitle,
@@ -381,8 +385,8 @@ export default defineComponent({
381
385
  };
382
386
  const renderRows = (fixedType, isOptimizeMode, tableData, tableColumn) => {
383
387
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
384
- const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData;
385
- const { fullAllDataRowIdData } = tableInternalData;
388
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData;
389
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData;
386
390
  const checkboxOpts = computeCheckboxOpts.value;
387
391
  const radioOpts = computeRadioOpts.value;
388
392
  const treeOpts = computeTreeOpts.value;
@@ -393,6 +397,7 @@ export default defineComponent({
393
397
  const { transform, seqMode } = treeOpts;
394
398
  const childrenField = treeOpts.children || treeOpts.childrenField;
395
399
  const rows = [];
400
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
396
401
  tableData.forEach((row, $rowIndex) => {
397
402
  const trOn = {};
398
403
  let rowIndex = $rowIndex;
@@ -413,7 +418,7 @@ export default defineComponent({
413
418
  $xeTable.clearHoverRow();
414
419
  };
415
420
  }
416
- const rowid = getRowid($xeTable, row);
421
+ const rowid = handleGetRowId(row);
417
422
  const rowRest = fullAllDataRowIdData[rowid];
418
423
  let rowLevel = 0;
419
424
  let seq = -1;
@@ -430,7 +435,7 @@ export default defineComponent({
430
435
  }
431
436
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
432
437
  // 行是否被展开
433
- const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
438
+ const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
434
439
  // 树节点是否被展开
435
440
  let isExpandTree = false;
436
441
  let rowChildren = [];
@@ -440,7 +445,7 @@ export default defineComponent({
440
445
  }
441
446
  if (treeConfig && !scrollYLoad && !transform) {
442
447
  rowChildren = row[childrenField];
443
- isExpandTree = rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
448
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
444
449
  }
445
450
  // 拖拽行事件
446
451
  if (rowOpts.drag && (!treeConfig || transform)) {
@@ -459,7 +464,7 @@ export default defineComponent({
459
464
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
460
465
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
461
466
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
462
- 'row--pending': !!pendingRowMaps[rowid]
467
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
463
468
  },
464
469
  getPropClass(rowClassName, params)
465
470
  ];
@@ -584,7 +589,7 @@ export default defineComponent({
584
589
  isOptimizeMode = true;
585
590
  }
586
591
  }
587
- if (fixedType || !overflowX) {
592
+ if (!isColLoading && (fixedType || !overflowX)) {
588
593
  renderColumnList = visibleColumn;
589
594
  }
590
595
  if (fixedType) {
@@ -380,8 +380,8 @@ export const Cell = {
380
380
  const tableReactData = $table.reactData;
381
381
  const tableInternalData = $table.internalData;
382
382
  const { computeTreeOpts } = $table.getComputeMaps();
383
- const { treeExpandedMaps, treeExpandLazyLoadedMaps } = tableReactData;
384
- const { fullAllDataRowIdData } = tableInternalData;
383
+ const { treeExpandedFlag } = tableReactData;
384
+ const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData;
385
385
  const treeOpts = computeTreeOpts.value;
386
386
  const { row, column, level } = params;
387
387
  const { slots } = column;
@@ -401,7 +401,7 @@ export const Cell = {
401
401
  }
402
402
  if (!isHidden) {
403
403
  const rowid = getRowid($table, row);
404
- isActive = !!treeExpandedMaps[rowid];
404
+ isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
405
405
  if (lazy) {
406
406
  const rest = fullAllDataRowIdData[rowid];
407
407
  isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
@@ -548,7 +548,8 @@ export const Cell = {
548
548
  const headerSlot = slots ? slots.header : null;
549
549
  const titleSlot = slots ? slots.title : null;
550
550
  const checkboxOpts = computeCheckboxOpts.value;
551
- const headerTitle = column.getTitle();
551
+ const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
552
+ const colTitle = column.getTitle();
552
553
  const ons = {};
553
554
  if (!isHidden) {
554
555
  ons.onClick = (evnt) => {
@@ -561,11 +562,11 @@ export const Cell = {
561
562
  if (headerSlot) {
562
563
  return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)));
563
564
  }
564
- if (checkboxOpts.checkStrictly ? !checkboxOpts.showHeader : checkboxOpts.showHeader === false) {
565
+ if (checkStrictly ? !showHeader : showHeader === false) {
565
566
  return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
566
567
  h('span', {
567
568
  class: 'vxe-checkbox--label'
568
- }, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : headerTitle)
569
+ }, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
569
570
  ]));
570
571
  }
571
572
  return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
@@ -573,15 +574,15 @@ export const Cell = {
573
574
  'is--checked': isAllCheckboxSelected,
574
575
  'is--disabled': isAllCheckboxDisabled,
575
576
  'is--indeterminate': isAllCheckboxIndeterminate
576
- }], title: getI18n('vxe.table.allTitle') }, ons), [
577
+ }], title: XEUtils.eqNull(headerTitle) ? getI18n('vxe.table.allTitle') : `${headerTitle || ''}` }, ons), [
577
578
  h('span', {
578
579
  class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
579
580
  })
580
- ].concat(titleSlot || headerTitle
581
+ ].concat(titleSlot || colTitle
581
582
  ? [
582
583
  h('span', {
583
584
  class: 'vxe-checkbox--label'
584
- }, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : headerTitle)
585
+ }, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
585
586
  ]
586
587
  : []))
587
588
  ]));
@@ -590,8 +591,10 @@ export const Cell = {
590
591
  const { $table, row, column, isHidden } = params;
591
592
  const tableProps = $table.props;
592
593
  const tableReactData = $table.reactData;
594
+ const tableInternalData = $table.internalData;
593
595
  const { treeConfig } = tableProps;
594
- const { selectCheckboxMaps, treeIndeterminateMaps } = tableReactData;
596
+ const { updateCheckboxFlag } = tableReactData;
597
+ const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData;
595
598
  const { computeCheckboxOpts } = $table.getComputeMaps();
596
599
  const checkboxOpts = computeCheckboxOpts.value;
597
600
  const { labelField, checkMethod, visibleMethod } = checkboxOpts;
@@ -605,7 +608,7 @@ export const Cell = {
605
608
  const ons = {};
606
609
  if (!isHidden) {
607
610
  const rowid = getRowid($table, row);
608
- isChecked = !!selectCheckboxMaps[rowid];
611
+ isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
609
612
  ons.onClick = (evnt) => {
610
613
  if (!isDisabled && isVisible) {
611
614
  $table.triggerCheckRowEvent(evnt, params, !isChecked);
@@ -615,7 +618,7 @@ export const Cell = {
615
618
  isDisabled = !checkMethod({ row });
616
619
  }
617
620
  if (treeConfig) {
618
- indeterminate = !!treeIndeterminateMaps[rowid];
621
+ indeterminate = !!treeIndeterminateRowMaps[rowid];
619
622
  }
620
623
  }
621
624
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
@@ -649,8 +652,10 @@ export const Cell = {
649
652
  const { $table, row, column, isHidden } = params;
650
653
  const tableProps = $table.props;
651
654
  const tableReactData = $table.reactData;
655
+ const tableInternalData = $table.internalData;
652
656
  const { treeConfig } = tableProps;
653
- const { treeIndeterminateMaps } = tableReactData;
657
+ const { updateCheckboxFlag } = tableReactData;
658
+ const { treeIndeterminateRowMaps } = tableInternalData;
654
659
  const { computeCheckboxOpts } = $table.getComputeMaps();
655
660
  const checkboxOpts = computeCheckboxOpts.value;
656
661
  const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts;
@@ -665,7 +670,7 @@ export const Cell = {
665
670
  const ons = {};
666
671
  if (!isHidden) {
667
672
  const rowid = getRowid($table, row);
668
- isChecked = XEUtils.get(row, checkField);
673
+ isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField);
669
674
  ons.onClick = (evnt) => {
670
675
  if (!isDisabled && isVisible) {
671
676
  $table.triggerCheckRowEvent(evnt, params, !isChecked);
@@ -675,7 +680,7 @@ export const Cell = {
675
680
  isDisabled = !checkMethod({ row });
676
681
  }
677
682
  if (treeConfig) {
678
- isIndeterminate = !!treeIndeterminateMaps[rowid];
683
+ isIndeterminate = !!treeIndeterminateRowMaps[rowid];
679
684
  }
680
685
  }
681
686
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
@@ -710,8 +715,8 @@ export const Cell = {
710
715
  */
711
716
  renderExpandCell(params) {
712
717
  const { $table, isHidden, row, column } = params;
713
- const tableReactData = $table.reactData;
714
- const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableReactData;
718
+ const tableInternalData = $table.internalData;
719
+ const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData;
715
720
  const { computeExpandOpts } = $table.getComputeMaps();
716
721
  const expandOpts = computeExpandOpts.value;
717
722
  const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts;
@@ -809,7 +814,7 @@ export const Cell = {
809
814
  const { $table, column } = params;
810
815
  const { computeSortOpts } = $table.getComputeMaps();
811
816
  const sortOpts = computeSortOpts.value;
812
- const { showIcon, allowBtn, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts;
817
+ const { showIcon, allowBtn, ascTitle, descTitle, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts;
813
818
  const { order } = column;
814
819
  if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
815
820
  return [
@@ -820,7 +825,7 @@ export const Cell = {
820
825
  class: ['vxe-sort--asc-btn', iconAsc || getIcon().TABLE_SORT_ASC, {
821
826
  'sort--active': order === 'asc'
822
827
  }],
823
- title: getI18n('vxe.table.sortAsc'),
828
+ title: XEUtils.eqNull(ascTitle) ? getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`,
824
829
  onClick: allowBtn
825
830
  ? (evnt) => {
826
831
  evnt.stopPropagation();
@@ -832,7 +837,7 @@ export const Cell = {
832
837
  class: ['vxe-sort--desc-btn', iconDesc || getIcon().TABLE_SORT_DESC, {
833
838
  'sort--active': order === 'desc'
834
839
  }],
835
- title: getI18n('vxe.table.sortDesc'),
840
+ title: XEUtils.eqNull(descTitle) ? getI18n('vxe.table.sortDesc') : `${descTitle || ''}`,
836
841
  onClick: allowBtn
837
842
  ? (evnt) => {
838
843
  evnt.stopPropagation();