vxe-table 3.13.18 → 3.13.20

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 (41) hide show
  1. package/es/grid/src/grid.js +4 -0
  2. package/es/style.css +1 -1
  3. package/es/table/render/index.js +88 -57
  4. package/es/table/src/body.js +11 -6
  5. package/es/table/src/footer.js +7 -2
  6. package/es/table/src/methods.js +222 -77
  7. package/es/table/src/util.js +18 -5
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/grid/src/grid.js +4 -0
  11. package/lib/grid/src/grid.min.js +1 -1
  12. package/lib/index.umd.js +384 -164
  13. package/lib/index.umd.min.js +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/table/render/index.js +96 -62
  16. package/lib/table/render/index.min.js +1 -1
  17. package/lib/table/src/body.js +10 -5
  18. package/lib/table/src/body.min.js +1 -1
  19. package/lib/table/src/footer.js +7 -2
  20. package/lib/table/src/footer.min.js +1 -1
  21. package/lib/table/src/methods.js +247 -88
  22. package/lib/table/src/methods.min.js +1 -1
  23. package/lib/table/src/util.js +21 -5
  24. package/lib/table/src/util.min.js +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/package.json +2 -2
  30. package/packages/grid/src/grid.ts +5 -0
  31. package/packages/table/render/index.ts +87 -55
  32. package/packages/table/src/body.ts +10 -5
  33. package/packages/table/src/footer.ts +7 -2
  34. package/packages/table/src/methods.ts +242 -84
  35. package/packages/table/src/util.ts +20 -5
  36. /package/es/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
  37. /package/es/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
  38. /package/es/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
  39. /package/lib/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
  40. /package/lib/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
  41. /package/lib/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
@@ -556,6 +556,63 @@ function handleExportTreeSelectMethod(params) {
556
556
  const { row, column, options } = params;
557
557
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
558
558
  }
559
+ function handleNumberCell(h, renderOpts, params) {
560
+ const { props = {}, showNegativeStatus } = renderOpts;
561
+ const { row, column } = params;
562
+ const { type } = props;
563
+ let cellValue = XEUtils.get(row, column.field);
564
+ let isNegative = false;
565
+ if (!isEmptyValue(cellValue)) {
566
+ const numberInputConfig = getConfig().numberInput || {};
567
+ if (type === 'float') {
568
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
569
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
570
+ cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
571
+ if (!autoFill) {
572
+ cellValue = XEUtils.toNumber(cellValue);
573
+ }
574
+ if (showNegativeStatus) {
575
+ if (cellValue < 0) {
576
+ isNegative = true;
577
+ }
578
+ }
579
+ }
580
+ else if (type === 'amount') {
581
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
582
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
583
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
584
+ cellValue = XEUtils.toNumber(cellValue);
585
+ if (showNegativeStatus) {
586
+ if (cellValue < 0) {
587
+ isNegative = true;
588
+ }
589
+ }
590
+ cellValue = XEUtils.commafy(cellValue, { digits });
591
+ if (!autoFill) {
592
+ const [iStr, dStr] = cellValue.split('.');
593
+ if (dStr) {
594
+ const dRest = dStr.replace(/0+$/, '');
595
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
596
+ }
597
+ }
598
+ if (showCurrency) {
599
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
600
+ }
601
+ }
602
+ else {
603
+ if (showNegativeStatus) {
604
+ if (XEUtils.toNumber(cellValue) < 0) {
605
+ isNegative = true;
606
+ }
607
+ }
608
+ }
609
+ }
610
+ return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
611
+ ? {
612
+ class: 'is--negative'
613
+ }
614
+ : {});
615
+ }
559
616
  /**
560
617
  * 表格 - 渲染器
561
618
  */
@@ -620,66 +677,19 @@ renderer.mixin({
620
677
  renderTableFilter: defaultFilterRender,
621
678
  tableFilterDefaultMethod: handleInputFilterMethod
622
679
  },
680
+ FormatNumberInput: {
681
+ renderTableDefault: handleNumberCell,
682
+ tableFilterDefaultMethod: handleInputFilterMethod,
683
+ tableExportMethod(params) {
684
+ const { row, column } = params;
685
+ const cellValue = XEUtils.get(row, column.field);
686
+ return cellValue;
687
+ }
688
+ },
623
689
  VxeNumberInput: {
624
690
  tableAutoFocus: 'input',
625
691
  renderTableEdit: defaultEditRender,
626
- renderTableCell(h, renderOpts, params) {
627
- const { props = {}, showNegativeStatus } = renderOpts;
628
- const { row, column } = params;
629
- const { type } = props;
630
- let cellValue = XEUtils.get(row, column.field);
631
- let isNegative = false;
632
- if (!isEmptyValue(cellValue)) {
633
- const numberInputConfig = getConfig().numberInput || {};
634
- if (type === 'float') {
635
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
636
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
637
- cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
638
- if (!autoFill) {
639
- cellValue = XEUtils.toNumber(cellValue);
640
- }
641
- if (showNegativeStatus) {
642
- if (cellValue < 0) {
643
- isNegative = true;
644
- }
645
- }
646
- }
647
- else if (type === 'amount') {
648
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
649
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
650
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
651
- cellValue = XEUtils.toNumber(cellValue);
652
- if (showNegativeStatus) {
653
- if (cellValue < 0) {
654
- isNegative = true;
655
- }
656
- }
657
- cellValue = XEUtils.commafy(cellValue, { digits });
658
- if (!autoFill) {
659
- const [iStr, dStr] = cellValue.split('.');
660
- if (dStr) {
661
- const dRest = dStr.replace(/0+$/, '');
662
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
663
- }
664
- }
665
- if (showCurrency) {
666
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
667
- }
668
- }
669
- else {
670
- if (showNegativeStatus) {
671
- if (XEUtils.toNumber(cellValue) < 0) {
672
- isNegative = true;
673
- }
674
- }
675
- }
676
- }
677
- return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
678
- ? {
679
- class: 'is--negative'
680
- }
681
- : {});
682
- },
692
+ renderTableCell: handleNumberCell,
683
693
  renderTableFooter(h, renderOpts, params) {
684
694
  const { props = {} } = renderOpts;
685
695
  const { row, column, _columnIndex } = params;
@@ -784,11 +794,22 @@ renderer.mixin({
784
794
  tableFilterDefaultMethod: handleFilterMethod,
785
795
  tableExportMethod: handleExportSelectMethod
786
796
  },
797
+ /**
798
+ * 已废弃,被 FormatSelect 替换
799
+ * @deprecated
800
+ */
787
801
  formatOption: {
788
802
  renderTableDefault(h, renderOpts, params) {
789
803
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
790
804
  }
791
805
  },
806
+ FormatSelect: {
807
+ renderTableDefault(h, renderOpts, params) {
808
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
809
+ },
810
+ tableFilterDefaultMethod: handleFilterMethod,
811
+ tableExportMethod: handleExportSelectMethod
812
+ },
792
813
  VxeTreeSelect: {
793
814
  tableAutoFocus: 'input',
794
815
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -805,11 +826,21 @@ renderer.mixin({
805
826
  },
806
827
  tableExportMethod: handleExportTreeSelectMethod
807
828
  },
829
+ /**
830
+ * 已废弃,被 FormatTreeSelect 替换
831
+ * @deprecated
832
+ */
808
833
  formatTree: {
809
834
  renderTableDefault(h, renderOpts, params) {
810
835
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
811
836
  }
812
837
  },
838
+ FormatTreeSelect: {
839
+ renderTableDefault(h, renderOpts, params) {
840
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
841
+ },
842
+ tableExportMethod: handleExportTreeSelectMethod
843
+ },
813
844
  VxeColorPicker: {
814
845
  tableAutoFocus: 'input',
815
846
  renderTableEdit(h, renderOpts, params) {
@@ -189,6 +189,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
189
189
  tdOns.dblclick = (evnt) => {
190
190
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
191
191
  };
192
+ let isMergeCell = false;
192
193
  // 合并行或列
193
194
  if (mergeList.length) {
194
195
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -198,9 +199,11 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
198
199
  return null;
199
200
  }
200
201
  if (rowspan > 1) {
202
+ isMergeCell = true;
201
203
  tdAttrs.rowspan = rowspan;
202
204
  }
203
205
  if (colspan > 1) {
206
+ isMergeCell = true;
204
207
  tdAttrs.colspan = colspan;
205
208
  }
206
209
  }
@@ -233,12 +236,14 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
233
236
  const isLastColumn = $columnIndex === columns.length - 1;
234
237
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
235
238
  let isVNPreEmptyStatus = false;
236
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
237
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
238
- isVNPreEmptyStatus = true;
239
- }
240
- else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
241
- isVNPreEmptyStatus = true;
239
+ if (!isMergeCell) {
240
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
241
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
242
+ isVNPreEmptyStatus = true;
243
+ }
244
+ else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
245
+ isVNPreEmptyStatus = true;
246
+ }
242
247
  }
243
248
  }
244
249
  const tcStyle = {};
@@ -100,6 +100,7 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
100
100
  tfOns.dblclick = (evnt) => {
101
101
  $xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
102
102
  };
103
+ let isMergeCell = false;
103
104
  // 合并行或列
104
105
  if (mergeFooterList.length) {
105
106
  const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
@@ -109,9 +110,11 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
109
110
  return null;
110
111
  }
111
112
  if (rowspan > 1) {
113
+ isMergeCell = true;
112
114
  attrs.rowspan = rowspan;
113
115
  }
114
116
  if (colspan > 1) {
117
+ isMergeCell = true;
115
118
  attrs.colspan = colspan;
116
119
  }
117
120
  }
@@ -132,8 +135,10 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
132
135
  const isLastColumn = $columnIndex === tableColumn.length - 1;
133
136
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
134
137
  let isVNPreEmptyStatus = false;
135
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
136
- isVNPreEmptyStatus = true;
138
+ if (!isMergeCell) {
139
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
140
+ isVNPreEmptyStatus = true;
141
+ }
137
142
  }
138
143
  const tcStyle = {};
139
144
  if (hasEllipsis) {