vxe-table 4.12.0-beta.1 → 4.12.0-beta.10

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 (166) hide show
  1. package/es/grid/src/grid.js +70 -75
  2. package/es/locale/lang/ar-EG.js +3 -0
  3. package/es/locale/lang/de-DE.js +3 -0
  4. package/es/locale/lang/en-US.js +3 -0
  5. package/es/locale/lang/es-ES.js +3 -0
  6. package/es/locale/lang/fr-FR.js +3 -0
  7. package/es/locale/lang/hu-HU.js +3 -0
  8. package/es/locale/lang/hy-AM.js +3 -0
  9. package/es/locale/lang/id-ID.js +3 -0
  10. package/es/locale/lang/it-IT.js +3 -0
  11. package/es/locale/lang/ja-JP.js +3 -0
  12. package/es/locale/lang/ko-KR.js +3 -0
  13. package/es/locale/lang/nb-NO.js +3 -0
  14. package/es/locale/lang/pt-BR.js +3 -0
  15. package/es/locale/lang/ru-RU.js +3 -0
  16. package/es/locale/lang/th-TH.js +3 -0
  17. package/es/locale/lang/ug-CN.js +3 -0
  18. package/es/locale/lang/uk-UA.js +3 -0
  19. package/es/locale/lang/vi-VN.js +3 -0
  20. package/es/locale/lang/zh-CHT.js +3 -0
  21. package/es/locale/lang/zh-CN.js +3 -0
  22. package/es/style.css +1 -1
  23. package/es/table/module/custom/panel.js +19 -21
  24. package/es/table/module/export/export-panel.js +17 -19
  25. package/es/table/module/export/hook.js +5 -11
  26. package/es/table/module/export/import-panel.js +11 -13
  27. package/es/table/module/keyboard/hook.js +47 -4
  28. package/es/table/module/validator/hook.js +1 -3
  29. package/es/table/render/index.js +90 -61
  30. package/es/table/src/body.js +11 -6
  31. package/es/table/src/columnInfo.js +26 -28
  32. package/es/table/src/footer.js +7 -2
  33. package/es/table/src/props.js +4 -0
  34. package/es/table/src/table.js +366 -187
  35. package/es/table/src/util.js +30 -3
  36. package/es/toolbar/src/toolbar.js +16 -24
  37. package/es/ui/index.js +1 -1
  38. package/es/ui/src/log.js +1 -1
  39. package/lib/grid/src/grid.js +67 -79
  40. package/lib/grid/src/grid.min.js +1 -1
  41. package/lib/index.umd.js +1274 -12216
  42. package/lib/index.umd.min.js +1 -1
  43. package/lib/locale/lang/ar-EG.js +3 -0
  44. package/lib/locale/lang/ar-EG.min.js +1 -1
  45. package/lib/locale/lang/de-DE.js +3 -0
  46. package/lib/locale/lang/de-DE.min.js +1 -1
  47. package/lib/locale/lang/en-US.js +3 -0
  48. package/lib/locale/lang/en-US.min.js +1 -1
  49. package/lib/locale/lang/en-US.umd.js +3 -0
  50. package/lib/locale/lang/es-ES.js +3 -0
  51. package/lib/locale/lang/es-ES.min.js +1 -1
  52. package/lib/locale/lang/es-ES.umd.js +3 -0
  53. package/lib/locale/lang/fr-FR.js +3 -0
  54. package/lib/locale/lang/fr-FR.min.js +1 -1
  55. package/lib/locale/lang/hu-HU.js +3 -0
  56. package/lib/locale/lang/hu-HU.min.js +1 -1
  57. package/lib/locale/lang/hu-HU.umd.js +3 -0
  58. package/lib/locale/lang/hy-AM.js +3 -0
  59. package/lib/locale/lang/hy-AM.min.js +1 -1
  60. package/lib/locale/lang/id-ID.js +3 -0
  61. package/lib/locale/lang/id-ID.min.js +1 -1
  62. package/lib/locale/lang/it-IT.js +3 -0
  63. package/lib/locale/lang/it-IT.min.js +1 -1
  64. package/lib/locale/lang/ja-JP.js +3 -0
  65. package/lib/locale/lang/ja-JP.min.js +1 -1
  66. package/lib/locale/lang/ja-JP.umd.js +3 -0
  67. package/lib/locale/lang/ko-KR.js +3 -0
  68. package/lib/locale/lang/ko-KR.min.js +1 -1
  69. package/lib/locale/lang/ko-KR.umd.js +3 -0
  70. package/lib/locale/lang/nb-NO.js +3 -0
  71. package/lib/locale/lang/nb-NO.min.js +1 -1
  72. package/lib/locale/lang/pt-BR.js +3 -0
  73. package/lib/locale/lang/pt-BR.min.js +1 -1
  74. package/lib/locale/lang/pt-BR.umd.js +3 -0
  75. package/lib/locale/lang/ru-RU.js +3 -0
  76. package/lib/locale/lang/ru-RU.min.js +1 -1
  77. package/lib/locale/lang/ru-RU.umd.js +3 -0
  78. package/lib/locale/lang/th-TH.js +3 -0
  79. package/lib/locale/lang/th-TH.min.js +1 -1
  80. package/lib/locale/lang/ug-CN.js +3 -0
  81. package/lib/locale/lang/ug-CN.min.js +1 -1
  82. package/lib/locale/lang/uk-UA.js +3 -0
  83. package/lib/locale/lang/uk-UA.min.js +1 -1
  84. package/lib/locale/lang/uk-UA.umd.js +3 -0
  85. package/lib/locale/lang/vi-VN.js +3 -0
  86. package/lib/locale/lang/vi-VN.min.js +1 -1
  87. package/lib/locale/lang/zh-CHT.js +3 -0
  88. package/lib/locale/lang/zh-CHT.min.js +1 -1
  89. package/lib/locale/lang/zh-CN.js +3 -0
  90. package/lib/locale/lang/zh-CN.min.js +1 -1
  91. package/lib/locale/lang/zh-CN.umd.js +3 -0
  92. package/lib/style.css +1 -1
  93. package/lib/table/module/custom/panel.js +21 -23
  94. package/lib/table/module/custom/panel.min.js +1 -1
  95. package/lib/table/module/export/export-panel.js +17 -19
  96. package/lib/table/module/export/export-panel.min.js +1 -1
  97. package/lib/table/module/export/hook.js +5 -11
  98. package/lib/table/module/export/hook.min.js +1 -1
  99. package/lib/table/module/export/import-panel.js +11 -13
  100. package/lib/table/module/export/import-panel.min.js +1 -1
  101. package/lib/table/module/keyboard/hook.js +51 -4
  102. package/lib/table/module/keyboard/hook.min.js +1 -1
  103. package/lib/table/module/validator/hook.js +1 -3
  104. package/lib/table/module/validator/hook.min.js +1 -1
  105. package/lib/table/render/index.js +98 -66
  106. package/lib/table/render/index.min.js +1 -1
  107. package/lib/table/src/body.js +10 -5
  108. package/lib/table/src/body.min.js +1 -1
  109. package/lib/table/src/columnInfo.js +30 -32
  110. package/lib/table/src/columnInfo.min.js +1 -1
  111. package/lib/table/src/footer.js +7 -2
  112. package/lib/table/src/footer.min.js +1 -1
  113. package/lib/table/src/props.js +4 -0
  114. package/lib/table/src/props.min.js +1 -1
  115. package/lib/table/src/table.js +399 -185
  116. package/lib/table/src/table.min.js +1 -1
  117. package/lib/table/src/util.js +35 -6
  118. package/lib/table/src/util.min.js +1 -1
  119. package/lib/toolbar/src/toolbar.js +16 -24
  120. package/lib/toolbar/src/toolbar.min.js +1 -1
  121. package/lib/ui/index.js +1 -1
  122. package/lib/ui/index.min.js +1 -1
  123. package/lib/ui/src/log.js +1 -1
  124. package/lib/ui/src/log.min.js +1 -1
  125. package/package.json +2 -2
  126. package/packages/grid/src/grid.ts +75 -81
  127. package/packages/locale/lang/ar-EG.ts +3 -0
  128. package/packages/locale/lang/de-DE.ts +3 -0
  129. package/packages/locale/lang/en-US.ts +3 -0
  130. package/packages/locale/lang/es-ES.ts +3 -0
  131. package/packages/locale/lang/fr-FR.ts +3 -0
  132. package/packages/locale/lang/hu-HU.ts +3 -0
  133. package/packages/locale/lang/hy-AM.ts +3 -0
  134. package/packages/locale/lang/id-ID.ts +3 -0
  135. package/packages/locale/lang/it-IT.ts +3 -0
  136. package/packages/locale/lang/ja-JP.ts +3 -0
  137. package/packages/locale/lang/ko-KR.ts +3 -0
  138. package/packages/locale/lang/nb-NO.ts +3 -0
  139. package/packages/locale/lang/pt-BR.ts +3 -0
  140. package/packages/locale/lang/ru-RU.ts +3 -0
  141. package/packages/locale/lang/th-TH.ts +3 -0
  142. package/packages/locale/lang/ug-CN.ts +3 -0
  143. package/packages/locale/lang/uk-UA.ts +3 -0
  144. package/packages/locale/lang/vi-VN.ts +3 -0
  145. package/packages/locale/lang/zh-CHT.ts +3 -0
  146. package/packages/locale/lang/zh-CN.ts +3 -0
  147. package/packages/table/module/custom/panel.ts +19 -21
  148. package/packages/table/module/export/export-panel.ts +17 -19
  149. package/packages/table/module/export/hook.ts +5 -11
  150. package/packages/table/module/export/import-panel.ts +11 -13
  151. package/packages/table/module/keyboard/hook.ts +47 -6
  152. package/packages/table/module/validator/hook.ts +1 -3
  153. package/packages/table/render/index.ts +89 -59
  154. package/packages/table/src/body.ts +10 -5
  155. package/packages/table/src/columnInfo.ts +26 -28
  156. package/packages/table/src/footer.ts +7 -2
  157. package/packages/table/src/props.ts +4 -0
  158. package/packages/table/src/table.ts +371 -185
  159. package/packages/table/src/util.ts +34 -3
  160. package/packages/toolbar/src/toolbar.ts +16 -24
  161. /package/es/{iconfont.1741051902838.ttf → iconfont.1741664494856.ttf} +0 -0
  162. /package/es/{iconfont.1741051902838.woff → iconfont.1741664494856.woff} +0 -0
  163. /package/es/{iconfont.1741051902838.woff2 → iconfont.1741664494856.woff2} +0 -0
  164. /package/lib/{iconfont.1741051902838.ttf → iconfont.1741664494856.ttf} +0 -0
  165. /package/lib/{iconfont.1741051902838.woff → iconfont.1741664494856.woff} +0 -0
  166. /package/lib/{iconfont.1741051902838.woff2 → iconfont.1741664494856.woff2} +0 -0
@@ -493,25 +493,23 @@ export default defineComponent({
493
493
  })
494
494
  : createCommentVNode();
495
495
  };
496
- if (process.env.NODE_ENV === 'development') {
497
- nextTick(() => {
498
- if (!VxeUIModalComponent) {
499
- errLog('vxe.error.reqComp', ['vxe-modal']);
500
- }
501
- if (!VxeUIButtonComponent) {
502
- errLog('vxe.error.reqComp', ['vxe-button']);
503
- }
504
- if (!VxeUISelectComponent) {
505
- errLog('vxe.error.reqComp', ['vxe-select']);
506
- }
507
- if (!VxeUIInputComponent) {
508
- errLog('vxe.error.reqComp', ['vxe-input']);
509
- }
510
- if (!VxeUICheckboxComponent) {
511
- errLog('vxe.error.reqComp', ['vxe-checkbox']);
512
- }
513
- });
514
- }
496
+ nextTick(() => {
497
+ if (!VxeUIModalComponent) {
498
+ errLog('vxe.error.reqComp', ['vxe-modal']);
499
+ }
500
+ if (!VxeUIButtonComponent) {
501
+ errLog('vxe.error.reqComp', ['vxe-button']);
502
+ }
503
+ if (!VxeUISelectComponent) {
504
+ errLog('vxe.error.reqComp', ['vxe-select']);
505
+ }
506
+ if (!VxeUIInputComponent) {
507
+ errLog('vxe.error.reqComp', ['vxe-input']);
508
+ }
509
+ if (!VxeUICheckboxComponent) {
510
+ errLog('vxe.error.reqComp', ['vxe-checkbox']);
511
+ }
512
+ });
515
513
  return renderVN;
516
514
  }
517
515
  });
@@ -893,9 +893,7 @@ hooks.add('tableExportModule', {
893
893
  }
894
894
  else {
895
895
  // 不支持的浏览器
896
- if (process.env.NODE_ENV === 'development') {
897
- errLog('vxe.error.notExp');
898
- }
896
+ errLog('vxe.error.notExp');
899
897
  _importResolve({ status: true });
900
898
  }
901
899
  });
@@ -1512,10 +1510,8 @@ hooks.add('tableExportModule', {
1512
1510
  message: true,
1513
1511
  types: XEUtils.keys(exportOpts._typeMaps)
1514
1512
  }, exportOpts, options);
1515
- if (process.env.NODE_ENV === 'development') {
1516
- if (!props.exportConfig) {
1517
- errLog('vxe.error.reqProp', ['export-config']);
1518
- }
1513
+ if (!props.exportConfig) {
1514
+ errLog('vxe.error.reqProp', ['export-config']);
1519
1515
  }
1520
1516
  handleExportAndPrint(defOpts);
1521
1517
  },
@@ -1525,10 +1521,8 @@ hooks.add('tableExportModule', {
1525
1521
  const defOpts = Object.assign({
1526
1522
  message: true
1527
1523
  }, printOpts, options);
1528
- if (process.env.NODE_ENV === 'development') {
1529
- if (!props.printConfig) {
1530
- errLog('vxe.error.reqProp', ['print-config']);
1531
- }
1524
+ if (!props.printConfig) {
1525
+ errLog('vxe.error.reqProp', ['print-config']);
1532
1526
  }
1533
1527
  handleExportAndPrint(defOpts, true);
1534
1528
  }
@@ -218,19 +218,17 @@ export default defineComponent({
218
218
  })
219
219
  : createCommentVNode();
220
220
  };
221
- if (process.env.NODE_ENV === 'development') {
222
- nextTick(() => {
223
- if (!VxeUIModalComponent) {
224
- errLog('vxe.error.reqComp', ['vxe-modal']);
225
- }
226
- if (!VxeUIButtonComponent) {
227
- errLog('vxe.error.reqComp', ['vxe-button']);
228
- }
229
- if (!VxeUISelectComponent) {
230
- errLog('vxe.error.reqComp', ['vxe-select']);
231
- }
232
- });
233
- }
221
+ nextTick(() => {
222
+ if (!VxeUIModalComponent) {
223
+ errLog('vxe.error.reqComp', ['vxe-modal']);
224
+ }
225
+ if (!VxeUIButtonComponent) {
226
+ errLog('vxe.error.reqComp', ['vxe-button']);
227
+ }
228
+ if (!VxeUISelectComponent) {
229
+ errLog('vxe.error.reqComp', ['vxe-select']);
230
+ }
231
+ });
234
232
  return renderVN;
235
233
  }
236
234
  });
@@ -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;
@@ -392,9 +392,7 @@ hooks.add('tableValidatorModule', {
392
392
  }
393
393
  }
394
394
  else {
395
- if (process.env.NODE_ENV === 'development') {
396
- errLog('vxe.error.notValidators', [validator]);
397
- }
395
+ errLog('vxe.error.notValidators', [validator]);
398
396
  }
399
397
  }
400
398
  else {
@@ -152,10 +152,8 @@ function getComponentOns(renderOpts, params, eFns) {
152
152
  const ons = {};
153
153
  XEUtils.objectEach(events, (func, key) => {
154
154
  ons[getOnName(key)] = function (...args) {
155
- if (process.env.NODE_ENV === 'development') {
156
- if (!XEUtils.isFunction(func)) {
157
- errLog('vxe.error.errFunc', [func]);
158
- }
155
+ if (!XEUtils.isFunction(func)) {
156
+ errLog('vxe.error.errFunc', [func]);
159
157
  }
160
158
  func(params, ...args);
161
159
  };
@@ -502,6 +500,63 @@ function handleExportTreeSelectMethod(params) {
502
500
  const { row, column, options } = params;
503
501
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
504
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
+ }
505
560
  /**
506
561
  * 表格 - 渲染器
507
562
  */
@@ -561,66 +616,19 @@ renderer.mixin({
561
616
  renderTableFilter: defaultFilterRender,
562
617
  tableFilterDefaultMethod: handleInputFilterMethod
563
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
+ },
564
628
  VxeNumberInput: {
565
629
  tableAutoFocus: 'input',
566
630
  renderTableEdit: defaultEditRender,
567
- renderTableCell(renderOpts, params) {
568
- const { props = {}, showNegativeStatus } = renderOpts;
569
- const { row, column } = params;
570
- const { type } = props;
571
- let cellValue = XEUtils.get(row, column.field);
572
- let isNegative = false;
573
- if (!isEmptyValue(cellValue)) {
574
- const numberInputConfig = getConfig().numberInput || {};
575
- if (type === 'float') {
576
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
577
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
578
- cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
579
- if (!autoFill) {
580
- cellValue = XEUtils.toNumber(cellValue);
581
- }
582
- if (showNegativeStatus) {
583
- if (cellValue < 0) {
584
- isNegative = true;
585
- }
586
- }
587
- }
588
- else if (type === 'amount') {
589
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
590
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
591
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
592
- cellValue = XEUtils.toNumber(cellValue);
593
- if (showNegativeStatus) {
594
- if (cellValue < 0) {
595
- isNegative = true;
596
- }
597
- }
598
- cellValue = XEUtils.commafy(cellValue, { digits });
599
- if (!autoFill) {
600
- const [iStr, dStr] = cellValue.split('.');
601
- if (dStr) {
602
- const dRest = dStr.replace(/0+$/, '');
603
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
604
- }
605
- }
606
- if (showCurrency) {
607
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
608
- }
609
- }
610
- else {
611
- if (showNegativeStatus) {
612
- if (XEUtils.toNumber(cellValue) < 0) {
613
- isNegative = true;
614
- }
615
- }
616
- }
617
- }
618
- return getCellLabelVNs(renderOpts, params, cellValue, isNegative
619
- ? {
620
- class: 'is--negative'
621
- }
622
- : {});
623
- },
631
+ renderTableCell: handleNumberCell,
624
632
  renderTableFooter(renderOpts, params) {
625
633
  const { props = {} } = renderOpts;
626
634
  const { row, column, _columnIndex } = params;
@@ -723,11 +731,22 @@ renderer.mixin({
723
731
  tableFilterDefaultMethod: handleFilterMethod,
724
732
  tableExportMethod: handleExportSelectMethod
725
733
  },
734
+ /**
735
+ * 已废弃,被 FormatSelect 替换
736
+ * @deprecated
737
+ */
726
738
  formatOption: {
727
739
  renderTableDefault(renderOpts, params) {
728
740
  return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
729
741
  }
730
742
  },
743
+ FormatSelect: {
744
+ renderTableDefault(renderOpts, params) {
745
+ return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
746
+ },
747
+ tableFilterDefaultMethod: handleFilterMethod,
748
+ tableExportMethod: handleExportSelectMethod
749
+ },
731
750
  VxeTreeSelect: {
732
751
  tableAutoFocus: 'input',
733
752
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -736,11 +755,21 @@ renderer.mixin({
736
755
  },
737
756
  tableExportMethod: handleExportTreeSelectMethod
738
757
  },
758
+ /**
759
+ * 已废弃,被 FormatTreeSelect 替换
760
+ * @deprecated
761
+ */
739
762
  formatTree: {
740
763
  renderTableDefault(renderOpts, params) {
741
764
  return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
742
765
  }
743
766
  },
767
+ FormatTreeSelect: {
768
+ renderTableDefault(renderOpts, params) {
769
+ return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
770
+ },
771
+ tableExportMethod: handleExportTreeSelectMethod
772
+ },
744
773
  VxeTableSelect: {
745
774
  tableAutoFocus: 'input',
746
775
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -205,6 +205,7 @@ export default defineComponent({
205
205
  tdOns.onDblclick = (evnt) => {
206
206
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
207
207
  };
208
+ let isMergeCell = false;
208
209
  // 合并行或列
209
210
  if (mergeList.length) {
210
211
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -214,9 +215,11 @@ export default defineComponent({
214
215
  return null;
215
216
  }
216
217
  if (rowspan > 1) {
218
+ isMergeCell = true;
217
219
  tdAttrs.rowspan = rowspan;
218
220
  }
219
221
  if (colspan > 1) {
222
+ isMergeCell = true;
220
223
  tdAttrs.colspan = colspan;
221
224
  }
222
225
  }
@@ -249,12 +252,14 @@ export default defineComponent({
249
252
  const isLastColumn = $columnIndex === columns.length - 1;
250
253
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
251
254
  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;
255
+ if (!isMergeCell) {
256
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
257
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
258
+ isVNPreEmptyStatus = true;
259
+ }
260
+ else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
261
+ isVNPreEmptyStatus = true;
262
+ }
258
263
  }
259
264
  }
260
265
  const tcStyle = {};
@@ -11,37 +11,35 @@ export class ColumnInfo {
11
11
  const formatter = _vm.formatter;
12
12
  const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
13
13
  const { props: tableProps } = $xeTable;
14
- if (process.env.NODE_ENV === 'development') {
15
- const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
16
- if (_vm.type && types.indexOf(_vm.type) === -1) {
17
- warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
18
- }
19
- if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
20
- warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
21
- }
22
- if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
23
- warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
14
+ const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
15
+ if (_vm.type && types.indexOf(_vm.type) === -1) {
16
+ warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
17
+ }
18
+ if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
19
+ warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
20
+ }
21
+ if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
22
+ warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
23
+ }
24
+ if (_vm.type === 'expand') {
25
+ const { treeConfig } = tableProps;
26
+ const { computeTreeOpts } = $xeTable.getComputeMaps();
27
+ const treeOpts = computeTreeOpts.value;
28
+ if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
29
+ errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand']);
24
30
  }
25
- if (_vm.type === 'expand') {
26
- const { treeConfig } = tableProps;
27
- const { computeTreeOpts } = $xeTable.getComputeMaps();
28
- const treeOpts = computeTreeOpts.value;
29
- if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
30
- errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand']);
31
+ }
32
+ if (formatter) {
33
+ if (XEUtils.isString(formatter)) {
34
+ const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
35
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
36
+ errLog('vxe.error.notFormats', [formatter]);
31
37
  }
32
38
  }
33
- if (formatter) {
34
- if (XEUtils.isString(formatter)) {
35
- const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
36
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
37
- errLog('vxe.error.notFormats', [formatter]);
38
- }
39
- }
40
- else if (XEUtils.isArray(formatter)) {
41
- const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
42
- if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
43
- errLog('vxe.error.notFormats', [formatter[0]]);
44
- }
39
+ else if (XEUtils.isArray(formatter)) {
40
+ const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
41
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
42
+ errLog('vxe.error.notFormats', [formatter[0]]);
45
43
  }
46
44
  }
47
45
  }
@@ -126,6 +126,7 @@ export default defineComponent({
126
126
  tfOns.onDblclick = (evnt) => {
127
127
  $xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
128
128
  };
129
+ let isMergeCell = false;
129
130
  // 合并行或列
130
131
  if (mergeFooterList.length) {
131
132
  const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
@@ -135,9 +136,11 @@ export default defineComponent({
135
136
  return null;
136
137
  }
137
138
  if (rowspan > 1) {
139
+ isMergeCell = true;
138
140
  attrs.rowspan = rowspan;
139
141
  }
140
142
  if (colspan > 1) {
143
+ isMergeCell = true;
141
144
  attrs.colspan = colspan;
142
145
  }
143
146
  }
@@ -158,8 +161,10 @@ export default defineComponent({
158
161
  const isLastColumn = $columnIndex === tableColumn.length - 1;
159
162
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
160
163
  let isVNPreEmptyStatus = false;
161
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
162
- isVNPreEmptyStatus = true;
164
+ if (!isMergeCell) {
165
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
166
+ isVNPreEmptyStatus = true;
167
+ }
163
168
  }
164
169
  const tcStyle = {};
165
170
  if (hasEllipsis) {
@@ -182,6 +182,8 @@ export default {
182
182
  resizeConfig: Object,
183
183
  // 列配置信息
184
184
  columnConfig: Object,
185
+ // 当前列配置信息
186
+ currentColumnConfig: Object,
185
187
  // 单元格配置信息
186
188
  cellConfig: Object,
187
189
  // 表头单元格配置信息
@@ -190,6 +192,8 @@ export default {
190
192
  footerCellConfig: Object,
191
193
  // 行配置信息
192
194
  rowConfig: Object,
195
+ // 当前行配置信息
196
+ currentRowConfig: Object,
193
197
  // 已废弃,被 rowDragConfig 替换
194
198
  dragConfig: Object,
195
199
  // 行拖拽排序配置项