vxe-table 3.14.5 → 3.15.0-beta.0

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 (46) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +10 -9
  3. package/es/table/module/export/mixin.js +14 -11
  4. package/es/table/src/body.js +11 -13
  5. package/es/table/src/footer.js +3 -16
  6. package/es/table/src/methods.js +202 -67
  7. package/es/table/src/table.js +40 -23
  8. package/es/table/src/util.js +0 -13
  9. package/es/ui/index.js +2 -2
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +318 -183
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/edit/mixin.js +9 -9
  15. package/lib/table/module/edit/mixin.min.js +1 -1
  16. package/lib/table/module/export/mixin.js +15 -11
  17. package/lib/table/module/export/mixin.min.js +1 -1
  18. package/lib/table/src/body.js +14 -15
  19. package/lib/table/src/body.min.js +1 -1
  20. package/lib/table/src/footer.js +4 -27
  21. package/lib/table/src/footer.min.js +1 -1
  22. package/lib/table/src/methods.js +231 -71
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +42 -23
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/src/util.js +0 -25
  27. package/lib/table/src/util.min.js +1 -1
  28. package/lib/ui/index.js +2 -2
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +2 -2
  33. package/packages/table/module/edit/mixin.ts +10 -9
  34. package/packages/table/module/export/mixin.ts +14 -11
  35. package/packages/table/src/body.ts +11 -13
  36. package/packages/table/src/footer.ts +3 -17
  37. package/packages/table/src/methods.ts +218 -78
  38. package/packages/table/src/table.ts +40 -23
  39. package/packages/table/src/util.ts +0 -14
  40. package/packages/ui/index.ts +1 -1
  41. /package/es/{iconfont.1743479120369.ttf → iconfont.1743578536739.ttf} +0 -0
  42. /package/es/{iconfont.1743479120369.woff → iconfont.1743578536739.woff} +0 -0
  43. /package/es/{iconfont.1743479120369.woff2 → iconfont.1743578536739.woff2} +0 -0
  44. /package/lib/{iconfont.1743479120369.ttf → iconfont.1743578536739.ttf} +0 -0
  45. /package/lib/{iconfont.1743479120369.woff → iconfont.1743578536739.woff} +0 -0
  46. /package/lib/{iconfont.1743479120369.woff2 → iconfont.1743578536739.woff2} +0 -0
@@ -93,8 +93,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
93
93
  const reactData = $xeTable;
94
94
  const internalData = $xeTable;
95
95
  const { treeConfig } = props;
96
- const { mergeList } = reactData;
97
- const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData;
96
+ const { tableFullTreeData, afterFullData, mergeBodyList, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData;
98
97
  const treeOpts = $xeTable.computeTreeOpts;
99
98
  const { transform, rowField, mapChildrenField } = treeOpts;
100
99
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -117,7 +116,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
117
116
  tableFullData.unshift(item);
118
117
  });
119
118
  // 刷新单元格合并
120
- mergeList.forEach((mergeItem) => {
119
+ mergeBodyList.forEach((mergeItem) => {
121
120
  const { row: mergeRowIndex } = mergeItem;
122
121
  if (mergeRowIndex > 0) {
123
122
  mergeItem.row = mergeRowIndex + newRecords.length;
@@ -141,7 +140,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
141
140
  tableFullData.push(item);
142
141
  });
143
142
  // 刷新单元格合并
144
- mergeList.forEach((mergeItem) => {
143
+ mergeBodyList.forEach((mergeItem) => {
145
144
  const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
146
145
  if (mergeRowIndex + mergeRowspan > afterFullData.length) {
147
146
  mergeItem.rowspan = mergeRowspan + newRecords.length;
@@ -229,7 +228,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
229
228
  tableFullData.push(...newRecords);
230
229
  }
231
230
  // 刷新单元格合并
232
- mergeList.forEach((mergeItem) => {
231
+ mergeBodyList.forEach((mergeItem) => {
233
232
  const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
234
233
  if (mergeRowIndex > afIndex) {
235
234
  mergeItem.row = mergeRowIndex + newRecords.length;
@@ -253,6 +252,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
253
252
  $xeTable.updateAfterDataIndex();
254
253
  }
255
254
  $xeTable.updateFooter();
255
+ $xeTable.handleUpdateBodyMerge();
256
256
  $xeTable.checkSelectionStatus();
257
257
  if (reactData.scrollYLoad) {
258
258
  $xeTable.updateScrollYSpace();
@@ -495,8 +495,8 @@ export default {
495
495
  const reactData = $xeTable;
496
496
  const internalData = $xeTable;
497
497
  const { treeConfig } = props;
498
- const { mergeList, editStore } = reactData;
499
- const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData;
498
+ const { editStore } = reactData;
499
+ const { tableFullTreeData, selectCheckboxMaps, afterFullData, mergeBodyList, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData;
500
500
  const checkboxOpts = $xeTable.computeCheckboxOpts;
501
501
  const treeOpts = $xeTable.computeTreeOpts;
502
502
  const { transform, mapChildrenField } = treeOpts;
@@ -564,7 +564,7 @@ export default {
564
564
  const afIndex = this.findRowIndexOf(afterFullData, row);
565
565
  if (afIndex > -1) {
566
566
  // 刷新单元格合并
567
- mergeList.forEach((mergeItem) => {
567
+ mergeBodyList.forEach((mergeItem) => {
568
568
  const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
569
569
  if (mergeRowIndex > afIndex) {
570
570
  mergeItem.row = mergeRowIndex - 1;
@@ -595,9 +595,10 @@ export default {
595
595
  reactData.removeRowFlag++;
596
596
  reactData.insertRowFlag++;
597
597
  reactData.pendingRowFlag++;
598
- $xeTable.updateFooter();
599
598
  $xeTable.cacheRowMap(false);
600
599
  $xeTable.handleTableData(treeConfig && transform);
600
+ $xeTable.updateFooter();
601
+ $xeTable.handleUpdateBodyMerge();
601
602
  if (!(treeConfig && transform)) {
602
603
  $xeTable.updateAfterDataIndex();
603
604
  }
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../../ui';
3
- import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../src/util';
3
+ import { isColumnInfo, getCellValue } from '../../src/util';
4
4
  import { parseFile, formatText, eqEmptyValue } from '../../../ui/src/utils';
5
5
  import { hasClass } from '../../../ui/src/dom';
6
6
  import { createHtmlPage, getExportBlobByContent } from './util';
@@ -320,8 +320,10 @@ function hasEllipsis($xeTable, column, property, allColumnOverflow) {
320
320
  function toHtml($xeTable, opts, columns, datas) {
321
321
  const props = $xeTable;
322
322
  const reactData = $xeTable;
323
+ const internalData = $xeTable;
323
324
  const { id, border, treeConfig, headerAlign: allHeaderAlign, align: allAlign, footerAlign: allFooterAlign, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow } = props;
324
- const { isAllSelected, isIndeterminate, mergeList } = reactData;
325
+ const { isAllSelected, isIndeterminate } = reactData;
326
+ const { mergeBodyCellMaps } = internalData;
325
327
  const treeOpts = $xeTable.computeTreeOpts;
326
328
  const { print: isPrint, isHeader, isFooter, isColgroup, isMerge, colgroups, original } = opts;
327
329
  const allCls = 'check-all';
@@ -416,15 +418,16 @@ function toHtml($xeTable, opts, columns, datas) {
416
418
  else {
417
419
  datas.forEach(item => {
418
420
  tables.push('<tr>' + columns.map(column => {
421
+ const colid = column.id;
419
422
  const cellAlign = column.align || allAlign;
420
423
  const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : [];
421
- const cellValue = item[column.id];
424
+ const cellValue = item[colid];
422
425
  let rowSpan = 1;
423
426
  let colSpan = 1;
424
- if (isMerge && mergeList.length) {
427
+ if (isMerge) {
425
428
  const _rowIndex = $xeTable.getVTRowIndex(item._row);
426
429
  const _columnIndex = $xeTable.getVTColumnIndex(column);
427
- const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
430
+ const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
428
431
  if (spanRest) {
429
432
  const { rowspan, colspan } = spanRest;
430
433
  if (!rowspan || !colspan) {
@@ -1004,15 +1007,15 @@ function handleExportAndPrint($xeTable, options, isPrint) {
1004
1007
  const internalData = $xeTable;
1005
1008
  const $xeGrid = $xeTable.$xeGrid;
1006
1009
  const { treeConfig, showHeader, showFooter } = props;
1007
- const { initStore, mergeList, mergeFooterList, isGroup, footerTableData, exportStore, exportParams } = reactData;
1008
- const { collectColumn } = internalData;
1010
+ const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData;
1011
+ const { collectColumn, mergeBodyList, mergeFooterList } = internalData;
1009
1012
  const exportOpts = $xeTable.computeExportOpts;
1010
1013
  const hasTree = treeConfig;
1011
1014
  const customOpts = $xeTable.computeCustomOpts;
1012
1015
  const selectRecords = $xeTable.getCheckboxRecords();
1013
1016
  const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : {};
1014
1017
  const hasFooter = !!footerTableData.length;
1015
- const hasMerge = !!(mergeList.length || mergeFooterList.length);
1018
+ const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
1016
1019
  const defOpts = Object.assign({
1017
1020
  message: true,
1018
1021
  isHeader: showHeader,
@@ -1184,12 +1187,12 @@ export default {
1184
1187
  const internalData = $xeTable;
1185
1188
  const $xeGrid = $xeTable.$xeGrid;
1186
1189
  const { treeConfig, showHeader, showFooter } = props;
1187
- const { mergeList, mergeFooterList, isGroup } = reactData;
1188
- const { tableFullColumn, afterFullData, collectColumn } = internalData;
1190
+ const { mergeFooterList, isGroup } = reactData;
1191
+ const { tableFullColumn, afterFullData, mergeBodyList, collectColumn } = internalData;
1189
1192
  const exportOpts = $xeTable.computeExportOpts;
1190
1193
  const treeOpts = $xeTable.computeTreeOpts;
1191
1194
  const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : {};
1192
- const hasMerge = !!(mergeList.length || mergeFooterList.length);
1195
+ const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
1193
1196
  const opts = Object.assign({
1194
1197
  message: true,
1195
1198
  isHeader: showHeader,
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { isEnableConf, getClass } from '../../ui/src/utils';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
4
+ import { getOffsetSize, calcTreeLine, getRowid, createHandleGetRowId } from './util';
5
5
  import { updateCellTitle } from '../../ui/src/dom';
6
6
  import { getSlotVNs } from '../../ui/src/vn';
7
7
  const { getI18n, renderer, renderEmptyElement } = VxeUI;
@@ -27,14 +27,13 @@ function renderLine(h, _vm, rowid, params, cellHeight) {
27
27
  if (slots && slots.line) {
28
28
  return $xeTable.callSlot(slots.line, params, h);
29
29
  }
30
- const rest = fullAllDataRowIdData[rowid];
30
+ const rowRest = fullAllDataRowIdData[rowid];
31
31
  let rLevel = 0;
32
32
  let prevRow = null;
33
- if (rest) {
34
- rLevel = rest.level;
35
- prevRow = rest.items[rest.treeIndex - 1];
33
+ if (rowRest) {
34
+ rLevel = rowRest.level;
35
+ prevRow = rowRest.items[rowRest.treeIndex - 1];
36
36
  }
37
- const isFirstRow = $xeTable.eqRow(afterFullData[0], row);
38
37
  if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
39
38
  return [
40
39
  h('div', {
@@ -44,7 +43,7 @@ function renderLine(h, _vm, rowid, params, cellHeight) {
44
43
  h('div', {
45
44
  class: 'vxe-tree--line',
46
45
  style: {
47
- height: `${isFirstRow ? 1 : calcTreeLine(params, prevRow)}px`,
46
+ height: `${$xeTable.eqRow(afterFullData[0], row) ? 1 : calcTreeLine(params, prevRow)}px`,
48
47
  bottom: `-${Math.floor(cellHeight / 2)}px`,
49
48
  left: `${(rLevel * treeOpts.indent) + (rLevel ? 2 - getOffsetSize($xeTable) : 0) + 16}px`
50
49
  }
@@ -63,10 +62,9 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
63
62
  const tableReactData = $xeTable;
64
63
  const tableInternalData = $xeTable;
65
64
  const $xeGrid = $xeTable.$xeGrid;
66
- const { fullAllDataRowIdData, fullColumnIdData, visibleColumn } = tableInternalData;
67
65
  const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
68
- const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
69
- const { afterFullData, scrollXStore, scrollYStore } = tableInternalData;
66
+ const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, mergeBodyFlag, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, editStore, isAllOverflow, validErrorMaps } = tableReactData;
67
+ const { fullAllDataRowIdData, fullColumnIdData, mergeBodyCellMaps, visibleColumn, afterFullData, mergeBodyList, scrollXStore, scrollYStore } = tableInternalData;
70
68
  const cellOpts = $xeTable.computeCellOpts;
71
69
  const validOpts = $xeTable.computeValidOpts;
72
70
  const checkboxOpts = $xeTable.computeCheckboxOpts;
@@ -193,8 +191,8 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
193
191
  };
194
192
  let isMergeCell = false;
195
193
  // 合并行或列
196
- if (mergeList.length) {
197
- const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
194
+ if (mergeBodyFlag && mergeBodyList.length) {
195
+ const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
198
196
  if (spanRest) {
199
197
  const { rowspan, colspan } = spanRest;
200
198
  if (!rowspan || !colspan) {
@@ -224,7 +222,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
224
222
  }
225
223
  }
226
224
  // 如果被合并不可隐藏
227
- if (fixedHiddenColumn && mergeList) {
225
+ if (fixedHiddenColumn && isMergeCell) {
228
226
  if (tdAttrs.colspan > 1 || tdAttrs.rowspan > 1) {
229
227
  fixedHiddenColumn = false;
230
228
  }
@@ -5,19 +5,6 @@ import { updateCellTitle } from '../../ui/src/dom';
5
5
  import { getCellHeight } from './util';
6
6
  const renderType = 'footer';
7
7
  const { renderer, renderEmptyElement } = VxeUI;
8
- function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
9
- for (let mIndex = 0; mIndex < mergeFooterList.length; mIndex++) {
10
- const { row: mergeRowIndex, col: mergeColIndex, rowspan: mergeRowspan, colspan: mergeColspan } = mergeFooterList[mIndex];
11
- if (mergeColIndex > -1 && mergeRowIndex > -1 && mergeRowspan && mergeColspan) {
12
- if (mergeRowIndex === _rowIndex && mergeColIndex === _columnIndex) {
13
- return { rowspan: mergeRowspan, colspan: mergeColspan };
14
- }
15
- if (_rowIndex >= mergeRowIndex && _rowIndex < mergeRowIndex + mergeRowspan && _columnIndex >= mergeColIndex && _columnIndex < mergeColIndex + mergeColspan) {
16
- return { rowspan: 0, colspan: 0 };
17
- }
18
- }
19
- }
20
- }
21
8
  function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex) {
22
9
  const props = _vm;
23
10
  const $xeTable = _vm.$parent;
@@ -27,8 +14,8 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
27
14
  const $xeGrid = $xeTable.$xeGrid;
28
15
  const { fixedType } = props;
29
16
  const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps;
30
- const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFooterList } = tableReactData;
31
- const { fullColumnIdData, scrollXStore } = tableInternalData;
17
+ const { scrollXLoad, scrollYLoad, overflowX, currentColumn } = tableReactData;
18
+ const { fullColumnIdData, mergeFooterList, mergeFooterCellMaps, scrollXStore } = tableInternalData;
32
19
  const tooltipOpts = $xeTable.computeTooltipOpts;
33
20
  const { isAllColumnDrag } = $xeTable.resizableOpts;
34
21
  const columnOpts = $xeTable.computeColumnOpts;
@@ -105,7 +92,7 @@ function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIn
105
92
  let isMergeCell = false;
106
93
  // 合并行或列
107
94
  if (mergeFooterList.length) {
108
- const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
95
+ const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`];
109
96
  if (spanRest) {
110
97
  const { rowspan, colspan } = spanRest;
111
98
  if (!rowspan || !colspan) {