vxe-table 3.14.0 → 3.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +95 -65
  3. package/es/table/module/keyboard/mixin.js +3 -2
  4. package/es/table/module/validator/mixin.js +2 -5
  5. package/es/table/src/body.js +6 -7
  6. package/es/table/src/methods.js +301 -286
  7. package/es/table/src/table.js +21 -15
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/dom.js +0 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +501 -498
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/edit/mixin.js +108 -99
  15. package/lib/table/module/edit/mixin.min.js +1 -1
  16. package/lib/table/module/keyboard/mixin.js +2 -1
  17. package/lib/table/module/keyboard/mixin.min.js +1 -1
  18. package/lib/table/module/validator/mixin.js +3 -9
  19. package/lib/table/module/validator/mixin.min.js +1 -1
  20. package/lib/table/src/body.js +6 -7
  21. package/lib/table/src/body.min.js +1 -1
  22. package/lib/table/src/methods.js +352 -355
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +21 -15
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/ui/index.js +1 -1
  27. package/lib/ui/index.min.js +1 -1
  28. package/lib/ui/src/dom.js +0 -2
  29. package/lib/ui/src/dom.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 +129 -89
  34. package/packages/table/module/keyboard/mixin.ts +4 -2
  35. package/packages/table/module/validator/mixin.ts +3 -6
  36. package/packages/table/src/body.ts +6 -7
  37. package/packages/table/src/methods.ts +345 -301
  38. package/packages/table/src/table.ts +24 -18
  39. package/packages/table/src/util.ts +2 -2
  40. package/packages/ui/src/dom.ts +0 -2
  41. /package/es/{iconfont.1742955973002.ttf → iconfont.1743125678150.ttf} +0 -0
  42. /package/es/{iconfont.1742955973002.woff → iconfont.1743125678150.woff} +0 -0
  43. /package/es/{iconfont.1742955973002.woff2 → iconfont.1743125678150.woff2} +0 -0
  44. /package/lib/{iconfont.1742955973002.ttf → iconfont.1743125678150.ttf} +0 -0
  45. /package/lib/{iconfont.1742955973002.woff → iconfont.1743125678150.woff} +0 -0
  46. /package/lib/{iconfont.1742955973002.woff2 → iconfont.1743125678150.woff2} +0 -0
@@ -21,6 +21,7 @@ const {
21
21
  interceptor,
22
22
  createEvent
23
23
  } = _ui.VxeUI;
24
+ const browseObj = _xeUtils.default.browse();
24
25
  const supportMaxRow = 5e6;
25
26
  const customStorageKey = 'VXE_CUSTOM_STORE';
26
27
  const maxYHeight = 5e6;
@@ -372,14 +373,14 @@ const updateScrollYStatus = ($xeTable, fullData) => {
372
373
  const {
373
374
  treeConfig
374
375
  } = props;
375
- const sYOpts = $xeTable.computeSYOpts;
376
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
376
377
  const treeOpts = $xeTable.computeTreeOpts;
377
378
  const {
378
379
  transform
379
380
  } = treeOpts;
380
381
  const allList = fullData || internalData.tableFullData;
381
382
  // 如果gt为0,则总是启用
382
- const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt < allList.length);
383
+ const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
383
384
  reactData.scrollYLoad = scrollYLoad;
384
385
  return scrollYLoad;
385
386
  };
@@ -540,7 +541,6 @@ function updateStyle($xeTable) {
540
541
  const reactData = $xeTable;
541
542
  const internalData = $xeTable;
542
543
  const {
543
- border,
544
544
  showHeaderOverflow: allColumnHeaderOverflow,
545
545
  showFooterOverflow: allColumnFooterOverflow,
546
546
  mouseConfig,
@@ -719,36 +719,6 @@ function updateStyle($xeTable) {
719
719
  if (tableElem) {
720
720
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
721
721
  }
722
- const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
723
- if (isGroup && listElem) {
724
- _xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
725
- const colNode = $xeTable.getColumnNode(thElem);
726
- if (colNode) {
727
- const column = colNode.item;
728
- const {
729
- showHeaderOverflow
730
- } = column;
731
- const cellOverflow = _xeUtils.default.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
732
- const showEllipsis = cellOverflow === 'ellipsis';
733
- const showTitle = cellOverflow === 'title';
734
- const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
735
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
736
- let childWidth = 0;
737
- let countChild = 0;
738
- if (hasEllipsis) {
739
- _xeUtils.default.eachTree(column.children, item => {
740
- if (!item.children || !column.children.length) {
741
- countChild++;
742
- }
743
- childWidth += item.renderWidth;
744
- }, {
745
- children: 'children'
746
- });
747
- }
748
- thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
749
- }
750
- });
751
- }
752
722
  } else if (layout === 'body') {
753
723
  if (currScrollElem) {
754
724
  currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
@@ -794,7 +764,7 @@ function updateStyle($xeTable) {
794
764
  if (tableElem) {
795
765
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
796
766
  // 兼容性处理
797
- tableElem.style.paddingRight = osbWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${osbWidth}px` : '';
767
+ tableElem.style.paddingRight = osbWidth && fixedType && (browseObj['-moz'] || browseObj.safari) ? `${osbWidth}px` : '';
798
768
  }
799
769
  const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
800
770
  if (emptyBlockElem) {
@@ -867,6 +837,134 @@ function handleChangeCell($xeTable, evnt, params) {
867
837
  $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
868
838
  });
869
839
  }
840
+ function handleDefaultSort($xeTable) {
841
+ const props = $xeTable;
842
+ const {
843
+ sortConfig
844
+ } = props;
845
+ if (sortConfig) {
846
+ const sortOpts = $xeTable.computeSortOpts;
847
+ let {
848
+ defaultSort
849
+ } = sortOpts;
850
+ if (defaultSort) {
851
+ if (!_xeUtils.default.isArray(defaultSort)) {
852
+ defaultSort = [defaultSort];
853
+ }
854
+ if (defaultSort.length) {
855
+ (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
856
+ const {
857
+ field,
858
+ order
859
+ } = item;
860
+ if (field && order) {
861
+ const column = $xeTable.getColumnByField(field);
862
+ if (column && column.sortable) {
863
+ column.order = order;
864
+ column.sortTime = Date.now() + index;
865
+ }
866
+ }
867
+ });
868
+ if (!sortOpts.remote) {
869
+ $xeTable.handleTableData(true).then(updateStyle);
870
+ }
871
+ }
872
+ }
873
+ }
874
+ }
875
+ /**
876
+ * 处理默认勾选
877
+ */
878
+ function handleDefaultSelectionChecked($xeTable) {
879
+ const props = $xeTable;
880
+ const internalData = $xeTable;
881
+ const {
882
+ checkboxConfig
883
+ } = props;
884
+ if (checkboxConfig) {
885
+ const {
886
+ fullDataRowIdData
887
+ } = internalData;
888
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
889
+ const {
890
+ checkAll,
891
+ checkRowKeys
892
+ } = checkboxOpts;
893
+ if (checkAll) {
894
+ handleCheckedAllCheckboxRow($xeTable, true, true);
895
+ } else if (checkRowKeys) {
896
+ const defSelection = [];
897
+ checkRowKeys.forEach(rowid => {
898
+ if (fullDataRowIdData[rowid]) {
899
+ defSelection.push(fullDataRowIdData[rowid].row);
900
+ }
901
+ });
902
+ handleCheckedCheckboxRow($xeTable, defSelection, true, true);
903
+ }
904
+ }
905
+ }
906
+ /**
907
+ * 处理单选框默认勾选
908
+ */
909
+ function handleDefaultRadioChecked($xeTable) {
910
+ const props = $xeTable;
911
+ const internalData = $xeTable;
912
+ const {
913
+ radioConfig
914
+ } = props;
915
+ if (radioConfig) {
916
+ const {
917
+ fullDataRowIdData
918
+ } = internalData;
919
+ const radioOpts = $xeTable.computeRadioOpts;
920
+ const {
921
+ checkRowKey: rowid,
922
+ reserve
923
+ } = radioOpts;
924
+ if (rowid) {
925
+ if (fullDataRowIdData[rowid]) {
926
+ handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
927
+ }
928
+ if (reserve) {
929
+ const rowkey = (0, _util.getRowkey)($xeTable);
930
+ internalData.radioReserveRow = {
931
+ [rowkey]: rowid
932
+ };
933
+ }
934
+ }
935
+ }
936
+ }
937
+ /**
938
+ * 处理默认展开行
939
+ */
940
+ function handleDefaultRowExpand($xeTable) {
941
+ const props = $xeTable;
942
+ const internalData = $xeTable;
943
+ const {
944
+ expandConfig
945
+ } = props;
946
+ if (expandConfig) {
947
+ const {
948
+ fullDataRowIdData
949
+ } = internalData;
950
+ const expandOpts = $xeTable.computeExpandOpts;
951
+ const {
952
+ expandAll,
953
+ expandRowKeys
954
+ } = expandOpts;
955
+ if (expandAll) {
956
+ $xeTable.setAllRowExpand(true);
957
+ } else if (expandRowKeys) {
958
+ const defExpandeds = [];
959
+ expandRowKeys.forEach(rowid => {
960
+ if (fullDataRowIdData[rowid]) {
961
+ defExpandeds.push(fullDataRowIdData[rowid].row);
962
+ }
963
+ });
964
+ $xeTable.setRowExpand(defExpandeds, true);
965
+ }
966
+ }
967
+ }
870
968
  function handleRadioReserveRow($xeTable, row) {
871
969
  const internalData = $xeTable;
872
970
  const radioOpts = $xeTable.computeRadioOpts;
@@ -1429,21 +1527,19 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
1429
1527
  }
1430
1528
  }
1431
1529
  function setMerges($xeTable, merges, mList, rowList) {
1432
- const props = $xeTable;
1530
+ // const props = $xeTable
1433
1531
  const internalData = $xeTable;
1434
1532
  if (merges) {
1435
- const {
1436
- treeConfig
1437
- } = props;
1533
+ // const { treeConfig } = props
1438
1534
  const {
1439
1535
  visibleColumn
1440
1536
  } = internalData;
1441
1537
  if (!_xeUtils.default.isArray(merges)) {
1442
1538
  merges = [merges];
1443
1539
  }
1444
- if (treeConfig && merges.length) {
1445
- (0, _log.errLog)('vxe.error.noTree', ['merge-cells | merge-footer-items']);
1446
- }
1540
+ // if (treeConfig && merges.length) {
1541
+ // errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
1542
+ // }
1447
1543
  merges.forEach(item => {
1448
1544
  let {
1449
1545
  row,
@@ -1488,22 +1584,20 @@ function setMerges($xeTable, merges, mList, rowList) {
1488
1584
  }
1489
1585
  }
1490
1586
  function removeMerges($xeTable, merges, mList, rowList) {
1491
- const props = $xeTable;
1587
+ // const props = $xeTable
1492
1588
  const internalData = $xeTable;
1493
1589
  const rest = [];
1494
1590
  if (merges) {
1495
- const {
1496
- treeConfig
1497
- } = props;
1591
+ // const { treeConfig } = props
1498
1592
  const {
1499
1593
  visibleColumn
1500
1594
  } = internalData;
1501
1595
  if (!_xeUtils.default.isArray(merges)) {
1502
1596
  merges = [merges];
1503
1597
  }
1504
- if (treeConfig && merges.length) {
1505
- (0, _log.errLog)('vxe.error.noTree', ['merge-cells | merge-footer-items']);
1506
- }
1598
+ // if (treeConfig && merges.length) {
1599
+ // errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
1600
+ // }
1507
1601
  merges.forEach(item => {
1508
1602
  let {
1509
1603
  row,
@@ -1990,7 +2084,7 @@ function hideDropTip($xeTable) {
1990
2084
  * @param {Event} evnt 事件
1991
2085
  * @param {Row} row 行对象
1992
2086
  */
1993
- function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
2087
+ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1994
2088
  const reactData = $xeTable;
1995
2089
  const tipOverEl = overflowElem || tdEl;
1996
2090
  if (!tipOverEl) {
@@ -2012,7 +2106,8 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
2012
2106
  const customContent = contentMethod ? contentMethod(params) : null;
2013
2107
  const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
2014
2108
  const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
2015
- if (content && (showAll || useCustom || tipOverEl.scrollWidth > tipOverEl.clientWidth)) {
2109
+ const isOver = tipOverEl.scrollWidth > tipOverEl.clientWidth;
2110
+ if (content && (showAll || useCustom || isOver)) {
2016
2111
  Object.assign(tooltipStore, {
2017
2112
  row,
2018
2113
  column,
@@ -2022,7 +2117,7 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
2022
2117
  $xeTable.$nextTick(() => {
2023
2118
  const $tooltip = $xeTable.$refs.refTooltip;
2024
2119
  if ($tooltip && $tooltip.open) {
2025
- $tooltip.open(tipOverEl, (0, _utils.formatText)(content));
2120
+ $tooltip.open(isOver ? tipOverEl : tipElem, (0, _utils.formatText)(content));
2026
2121
  }
2027
2122
  });
2028
2123
  }
@@ -2039,7 +2134,7 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
2039
2134
  }
2040
2135
  return $xeTable.$nextTick();
2041
2136
  }
2042
- const handleRowExpandReserve = ($xeTable, row, expanded) => {
2137
+ function handleRowExpandReserve($xeTable, row, expanded) {
2043
2138
  const internalData = $xeTable;
2044
2139
  const {
2045
2140
  rowExpandedReserveRowMap
@@ -2053,7 +2148,25 @@ const handleRowExpandReserve = ($xeTable, row, expanded) => {
2053
2148
  delete rowExpandedReserveRowMap[rowid];
2054
2149
  }
2055
2150
  }
2056
- };
2151
+ }
2152
+ function handleDefaultMergeCells($xeTable) {
2153
+ const props = $xeTable;
2154
+ const {
2155
+ mergeCells
2156
+ } = props;
2157
+ if (mergeCells) {
2158
+ $xeTable.setMergeCells(mergeCells);
2159
+ }
2160
+ }
2161
+ function handleDefaultMergeFooterItems($xeTable) {
2162
+ const props = $xeTable;
2163
+ const {
2164
+ mergeFooterItems
2165
+ } = props;
2166
+ if (mergeFooterItems) {
2167
+ $xeTable.setMergeFooterItems(mergeFooterItems);
2168
+ }
2169
+ }
2057
2170
  // 计算可视渲染相关数据
2058
2171
  function computeScrollLoad($xeTable) {
2059
2172
  const reactData = $xeTable;
@@ -2151,6 +2264,26 @@ function handleRecalculateLayout($xeTable, reFull) {
2151
2264
  }
2152
2265
  });
2153
2266
  }
2267
+ /**
2268
+ * 处理数据加载默认行为
2269
+ * 默认执行一次,除非被重置
2270
+ */
2271
+ function handleLoadDefaults($xeTable) {
2272
+ handleDefaultSelectionChecked($xeTable);
2273
+ handleDefaultRadioChecked($xeTable);
2274
+ handleDefaultRowExpand($xeTable);
2275
+ handleDefaultTreeExpand($xeTable);
2276
+ handleDefaultMergeCells($xeTable);
2277
+ handleDefaultMergeFooterItems($xeTable);
2278
+ $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
2279
+ }
2280
+ /**
2281
+ * 处理初始化的默认行为
2282
+ * 只会执行一次
2283
+ */
2284
+ function handleInitDefaults($xeTable) {
2285
+ handleDefaultSort($xeTable);
2286
+ }
2154
2287
  function handleTableColumn($xeTable) {
2155
2288
  const reactData = $xeTable;
2156
2289
  const internalData = $xeTable;
@@ -2242,7 +2375,7 @@ function parseColumns($xeTable, isReset) {
2242
2375
  isGroup,
2243
2376
  columnStore
2244
2377
  } = reactData;
2245
- const sXOpts = $xeTable.computeSXOpts;
2378
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
2246
2379
  const {
2247
2380
  collectColumn,
2248
2381
  tableFullColumn,
@@ -2303,7 +2436,7 @@ function parseColumns($xeTable, isReset) {
2303
2436
  }
2304
2437
  const visibleColumn = leftList.concat(centerList).concat(rightList);
2305
2438
  // 如果gt为0,则总是启用
2306
- const scrollXLoad = !!sXOpts.enabled && sXOpts.gt > -1 && (sXOpts.gt === 0 || sXOpts.gt < tableFullColumn.length);
2439
+ const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
2307
2440
  reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
2308
2441
  Object.assign(columnStore, {
2309
2442
  leftList,
@@ -2957,21 +3090,26 @@ const Methods = {
2957
3090
  */
2958
3091
  loadTableData(datas, isReset) {
2959
3092
  const $xeTable = this;
3093
+ const props = $xeTable;
2960
3094
  const reactData = $xeTable;
2961
3095
  const internalData = $xeTable;
2962
3096
  const {
2963
3097
  keepSource,
2964
- treeConfig,
2965
- treeOpts,
2966
- editStore,
3098
+ treeConfig
3099
+ } = props;
3100
+ const {
3101
+ scrollYLoad: oldScrollYLoad
3102
+ } = reactData;
3103
+ const {
2967
3104
  scrollYStore,
2968
3105
  scrollXStore,
2969
3106
  lastScrollLeft,
2970
- lastScrollTop,
2971
- scrollYLoad: oldScrollYLoad,
2972
- sXOpts,
2973
- sYOpts
2974
- } = this;
3107
+ lastScrollTop
3108
+ } = internalData;
3109
+ const treeOpts = $xeTable.computeTreeOpts;
3110
+ const {
3111
+ transform
3112
+ } = treeOpts;
2975
3113
  const childrenField = treeOpts.children || treeOpts.childrenField;
2976
3114
  let treeData = [];
2977
3115
  let fullData = datas ? datas.slice(0) : [];
@@ -2980,7 +3118,7 @@ const Methods = {
2980
3118
  }
2981
3119
  if (treeConfig) {
2982
3120
  // 树结构自动转换
2983
- if (treeOpts.transform) {
3121
+ if (transform) {
2984
3122
  if (!treeOpts.rowField) {
2985
3123
  (0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.rowField']);
2986
3124
  }
@@ -3018,8 +3156,8 @@ const Methods = {
3018
3156
  scrollXStore.endIndex = 1;
3019
3157
  reactData.isRowLoading = true;
3020
3158
  reactData.scrollVMLoading = false;
3021
- editStore.insertMaps = {};
3022
- editStore.removeMaps = {};
3159
+ internalData.insertRowMaps = {};
3160
+ internalData.removeRowMaps = {};
3023
3161
  const sYLoad = updateScrollYStatus($xeTable, fullData);
3024
3162
  reactData.isDragColMove = false;
3025
3163
  reactData.isDragRowMove = false;
@@ -3037,15 +3175,15 @@ const Methods = {
3037
3175
  if (keepSource) {
3038
3176
  $xeTable.cacheSourceMap(fullData);
3039
3177
  }
3040
- if (this.clearCellAreas && this.mouseConfig) {
3041
- this.clearCellAreas();
3042
- this.clearCopyCellArea();
3178
+ if ($xeTable.clearCellAreas && props.mouseConfig) {
3179
+ $xeTable.clearCellAreas();
3180
+ $xeTable.clearCopyCellArea();
3043
3181
  }
3044
- this.clearMergeCells();
3045
- this.clearMergeFooterItems();
3046
- this.handleTableData(true);
3047
- this.updateFooter();
3048
- return this.$nextTick().then(() => {
3182
+ $xeTable.clearMergeCells();
3183
+ $xeTable.clearMergeFooterItems();
3184
+ $xeTable.handleTableData(true);
3185
+ $xeTable.updateFooter();
3186
+ return $xeTable.$nextTick().then(() => {
3049
3187
  updateHeight($xeTable);
3050
3188
  updateStyle($xeTable);
3051
3189
  }).then(() => {
@@ -3058,45 +3196,47 @@ const Methods = {
3058
3196
  if (sYLoad) {
3059
3197
  // if (showOverflow) {
3060
3198
  // if (!rowOpts.height) {
3061
- // const errColumn = this.tableFullColumn.find((column: any) => column.showOverflow === false)
3199
+ // const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
3062
3200
  // if (errColumn) {
3063
3201
  // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
3064
3202
  // }
3065
3203
  // }
3066
3204
  // }
3067
- if (!(this.height || this.maxHeight)) {
3205
+ if (!(props.height || props.maxHeight)) {
3068
3206
  (0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
3069
3207
  }
3070
- // if (!this.showOverflow) {
3208
+ // if (!props.showOverflow) {
3071
3209
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
3072
3210
  // }
3073
- if (this.spanMethod) {
3211
+ if (props.spanMethod) {
3074
3212
  (0, _log.errLog)('vxe.error.scrollErrProp', ['table.span-method']);
3075
3213
  }
3076
3214
  }
3077
3215
  handleReserveStatus($xeTable);
3078
- this.checkSelectionStatus();
3216
+ $xeTable.checkSelectionStatus();
3079
3217
  return new Promise(resolve => {
3080
- this.$nextTick().then(() => this.recalculate()).then(() => {
3218
+ this.$nextTick().then(() => $xeTable.recalculate()).then(() => {
3081
3219
  let targetScrollLeft = lastScrollLeft;
3082
3220
  let targetScrollTop = lastScrollTop;
3221
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
3222
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
3083
3223
  // 是否在更新数据之后自动滚动重置滚动条
3084
- if (sXOpts.scrollToLeftOnChange) {
3224
+ if (virtualXOpts.scrollToLeftOnChange) {
3085
3225
  targetScrollLeft = 0;
3086
3226
  }
3087
- if (sYOpts.scrollToTopOnChange) {
3227
+ if (virtualYOpts.scrollToTopOnChange) {
3088
3228
  targetScrollTop = 0;
3089
3229
  }
3090
3230
  reactData.isRowLoading = false;
3091
3231
  calcCellHeight($xeTable);
3092
3232
  // 是否变更虚拟滚动
3093
3233
  if (oldScrollYLoad === sYLoad) {
3094
- (0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(() => {
3234
+ (0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
3095
3235
  resolve();
3096
3236
  });
3097
3237
  } else {
3098
3238
  setTimeout(() => {
3099
- (0, _util.restoreScrollLocation)(this, targetScrollLeft, targetScrollTop).then(() => {
3239
+ (0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
3100
3240
  resolve();
3101
3241
  });
3102
3242
  });
@@ -3110,6 +3250,7 @@ const Methods = {
3110
3250
  * @param {Array} datas 数据
3111
3251
  */
3112
3252
  loadData(datas) {
3253
+ const $xeTable = this;
3113
3254
  const {
3114
3255
  initStatus
3115
3256
  } = this;
@@ -3117,7 +3258,7 @@ const Methods = {
3117
3258
  this.inited = true;
3118
3259
  this.initStatus = true;
3119
3260
  if (!initStatus) {
3120
- this.handleLoadDefaults();
3261
+ handleLoadDefaults($xeTable);
3121
3262
  }
3122
3263
  return this.recalculate();
3123
3264
  });
@@ -3127,12 +3268,13 @@ const Methods = {
3127
3268
  * @param {Array} datas 数据
3128
3269
  */
3129
3270
  reloadData(datas) {
3271
+ const $xeTable = this;
3130
3272
  return this.clearAll().then(() => {
3131
3273
  this.inited = true;
3132
3274
  this.initStatus = true;
3133
3275
  return this.loadTableData(datas, true);
3134
3276
  }).then(() => {
3135
- this.handleLoadDefaults();
3277
+ handleLoadDefaults($xeTable);
3136
3278
  return this.recalculate();
3137
3279
  });
3138
3280
  },
@@ -3324,18 +3466,24 @@ const Methods = {
3324
3466
  internalData.tableSourceData = sourceData;
3325
3467
  },
3326
3468
  getParams() {
3327
- return this.params;
3469
+ const $xeTable = this;
3470
+ const props = $xeTable;
3471
+ return props.params;
3328
3472
  },
3329
3473
  loadTreeChildren(row, childRecords) {
3330
3474
  const $xeTable = this;
3475
+ const props = $xeTable;
3476
+ const internalData = $xeTable;
3477
+ const {
3478
+ keepSource
3479
+ } = props;
3331
3480
  const {
3332
- keepSource,
3333
3481
  tableSourceData,
3334
- treeOpts,
3335
3482
  fullDataRowIdData,
3336
3483
  fullAllDataRowIdData,
3337
3484
  sourceDataRowIdData
3338
- } = this;
3485
+ } = internalData;
3486
+ const treeOpts = $xeTable.computeTreeOpts;
3339
3487
  const {
3340
3488
  transform,
3341
3489
  mapChildrenField
@@ -3394,20 +3542,24 @@ const Methods = {
3394
3542
  * @param {Element} tr 元素
3395
3543
  */
3396
3544
  getRowNode(tr) {
3545
+ const $xeTable = this;
3546
+ const internalData = $xeTable;
3397
3547
  if (tr) {
3398
3548
  const {
3399
3549
  fullAllDataRowIdData
3400
- } = this;
3550
+ } = internalData;
3401
3551
  const rowid = tr.getAttribute('rowid');
3402
- const rowRest = fullAllDataRowIdData[rowid];
3403
- if (rowRest) {
3404
- return {
3405
- rowid: rowRest.rowid,
3406
- item: rowRest.row,
3407
- index: rowRest.index,
3408
- items: rowRest.items,
3409
- parent: rowRest.parent
3410
- };
3552
+ if (rowid) {
3553
+ const rowRest = fullAllDataRowIdData[rowid];
3554
+ if (rowRest) {
3555
+ return {
3556
+ rowid: rowRest.rowid,
3557
+ item: rowRest.row,
3558
+ index: rowRest.index,
3559
+ items: rowRest.items,
3560
+ parent: rowRest.parent
3561
+ };
3562
+ }
3411
3563
  }
3412
3564
  }
3413
3565
  return null;
@@ -3417,10 +3569,12 @@ const Methods = {
3417
3569
  * @param {Element} cell 元素
3418
3570
  */
3419
3571
  getColumnNode(cell) {
3572
+ const $xeTable = this;
3573
+ const internalData = $xeTable;
3420
3574
  if (cell) {
3421
3575
  const {
3422
3576
  fullColumnIdData
3423
- } = this;
3577
+ } = internalData;
3424
3578
  const colid = cell.getAttribute('colid');
3425
3579
  if (colid) {
3426
3580
  const colRest = fullColumnIdData[colid];
@@ -3512,20 +3666,23 @@ const Methods = {
3512
3666
  * @param {Row} records 行数据
3513
3667
  */
3514
3668
  defineField(records) {
3669
+ const $xeTable = this;
3670
+ const props = $xeTable;
3671
+ const internalData = $xeTable;
3515
3672
  const {
3516
- radioOpts,
3517
- checkboxOpts,
3518
- treeConfig,
3519
- treeOpts,
3520
- expandOpts
3521
- } = this;
3673
+ treeConfig
3674
+ } = props;
3675
+ const expandOpts = $xeTable.computeExpandOpts;
3676
+ const treeOpts = $xeTable.computeTreeOpts;
3677
+ const radioOpts = $xeTable.computeRadioOpts;
3678
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
3522
3679
  const childrenField = treeOpts.children || treeOpts.childrenField;
3523
- const rowkey = (0, _util.getRowkey)(this);
3680
+ const rowkey = (0, _util.getRowkey)($xeTable);
3524
3681
  if (!_xeUtils.default.isArray(records)) {
3525
3682
  records = [records || {}];
3526
3683
  }
3527
3684
  return records.map(record => {
3528
- this.tableFullColumn.forEach(column => {
3685
+ internalData.tableFullColumn.forEach(column => {
3529
3686
  const {
3530
3687
  field,
3531
3688
  editRender
@@ -3569,8 +3726,9 @@ const Methods = {
3569
3726
  * @param {Array} records 新数据
3570
3727
  */
3571
3728
  createData(records) {
3572
- return this.$nextTick().then(() => {
3573
- return this.defineField(records);
3729
+ const $xeTable = this;
3730
+ return $xeTable.$nextTick().then(() => {
3731
+ return $xeTable.defineField(records);
3574
3732
  });
3575
3733
  },
3576
3734
  /**
@@ -3579,11 +3737,12 @@ const Methods = {
3579
3737
  * @param {Array/Object} records 新数据
3580
3738
  */
3581
3739
  createRow(records) {
3740
+ const $xeTable = this;
3582
3741
  const isArr = _xeUtils.default.isArray(records);
3583
3742
  if (!isArr) {
3584
3743
  records = [records];
3585
3744
  }
3586
- return this.createData(records).then(rows => isArr ? rows : rows[0]);
3745
+ return $xeTable.createData(records).then(rows => isArr ? rows : rows[0]);
3587
3746
  },
3588
3747
  /**
3589
3748
  * 还原数据
@@ -3601,18 +3760,15 @@ const Methods = {
3601
3760
  keepSource,
3602
3761
  treeConfig
3603
3762
  } = props;
3604
- const {
3605
- editStore
3606
- } = reactData;
3607
3763
  const {
3608
3764
  fullAllDataRowIdData,
3609
3765
  fullDataRowIdData,
3610
3766
  tableSourceData,
3611
3767
  sourceDataRowIdData,
3612
3768
  tableFullData,
3613
- afterFullData
3769
+ afterFullData,
3770
+ removeRowMaps
3614
3771
  } = internalData;
3615
- const removeTempMaps = Object.assign({}, editStore.removeMaps);
3616
3772
  const treeOpts = $xeTable.computeTreeOpts;
3617
3773
  const {
3618
3774
  transform
@@ -3650,7 +3806,9 @@ const Methods = {
3650
3806
  _xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
3651
3807
  }
3652
3808
  if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
3653
- delete removeTempMaps[rowid];
3809
+ if (removeRowMaps[rowid]) {
3810
+ delete removeRowMaps[rowid];
3811
+ }
3654
3812
  tableFullData.unshift(row);
3655
3813
  afterFullData.unshift(row);
3656
3814
  reDelFlag = true;
@@ -3662,7 +3820,7 @@ const Methods = {
3662
3820
  }
3663
3821
  if (rows) {
3664
3822
  if (reDelFlag) {
3665
- editStore.removeMaps = removeTempMaps;
3823
+ reactData.removeRowFlag++;
3666
3824
  $xeTable.updateFooter();
3667
3825
  $xeTable.cacheRowMap(false);
3668
3826
  $xeTable.handleTableData(treeConfig && transform);
@@ -3691,10 +3849,12 @@ const Methods = {
3691
3849
  * @param {String} field 字段名
3692
3850
  */
3693
3851
  clearData(rows, field) {
3852
+ const $xeTable = this;
3853
+ const internalData = $xeTable;
3694
3854
  const {
3695
3855
  tableFullData,
3696
3856
  visibleColumn
3697
- } = this;
3857
+ } = internalData;
3698
3858
  if (!arguments.length) {
3699
3859
  rows = tableFullData;
3700
3860
  } else if (rows && !_xeUtils.default.isArray(rows)) {
@@ -3711,7 +3871,7 @@ const Methods = {
3711
3871
  });
3712
3872
  });
3713
3873
  }
3714
- return this.$nextTick();
3874
+ return $xeTable.$nextTick();
3715
3875
  },
3716
3876
  getCellElement(row, fieldOrColumn) {
3717
3877
  const $xeTable = this;
@@ -3812,20 +3972,16 @@ const Methods = {
3812
3972
  isInsertByRow(row) {
3813
3973
  const $xeTable = this;
3814
3974
  const reactData = $xeTable;
3815
- const {
3816
- editStore
3817
- } = reactData;
3975
+ const internalData = $xeTable;
3818
3976
  const rowid = (0, _util.getRowid)($xeTable, row);
3819
- return !!editStore.insertMaps[rowid];
3977
+ return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
3820
3978
  },
3821
3979
  isRemoveByRow(row) {
3822
3980
  const $xeTable = this;
3823
3981
  const reactData = $xeTable;
3824
- const {
3825
- editStore
3826
- } = reactData;
3982
+ const internalData = $xeTable;
3827
3983
  const rowid = (0, _util.getRowid)($xeTable, row);
3828
- return !!editStore.removeMaps[rowid];
3984
+ return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
3829
3985
  },
3830
3986
  /**
3831
3987
  * 删除所有新增的临时数据
@@ -3833,11 +3989,8 @@ const Methods = {
3833
3989
  */
3834
3990
  removeInsertRow() {
3835
3991
  const $xeTable = this;
3836
- const reactData = $xeTable;
3837
- const {
3838
- editStore
3839
- } = reactData;
3840
- editStore.insertMaps = {};
3992
+ const internalData = $xeTable;
3993
+ internalData.insertRowMaps = {};
3841
3994
  return $xeTable.remove($xeTable.getInsertRecords());
3842
3995
  },
3843
3996
  /**
@@ -3885,14 +4038,19 @@ const Methods = {
3885
4038
  * @param {Number} columnIndex 索引
3886
4039
  */
3887
4040
  getColumns(columnIndex) {
3888
- const columns = this.visibleColumn;
3889
- return _xeUtils.default.isUndefined(columnIndex) ? columns.slice(0) : columns[columnIndex];
4041
+ const $xeTable = this;
4042
+ const internalData = $xeTable;
4043
+ const {
4044
+ visibleColumn
4045
+ } = internalData;
4046
+ return _xeUtils.default.isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
3890
4047
  },
3891
4048
  /**
3892
4049
  * 根据列获取列的唯一主键
3893
4050
  */
3894
4051
  getColid(fieldOrColumn) {
3895
- const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
4052
+ const $xeTable = this;
4053
+ const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
3896
4054
  return column ? column.id : null;
3897
4055
  },
3898
4056
  /**
@@ -3900,7 +4058,11 @@ const Methods = {
3900
4058
  * @param {String} colid 列主键
3901
4059
  */
3902
4060
  getColumnById(colid) {
3903
- const fullColumnIdData = this.fullColumnIdData;
4061
+ const $xeTable = this;
4062
+ const internalData = $xeTable;
4063
+ const {
4064
+ fullColumnIdData
4065
+ } = internalData;
3904
4066
  return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
3905
4067
  },
3906
4068
  /**
@@ -3908,7 +4070,11 @@ const Methods = {
3908
4070
  * @param {String} field 字段名
3909
4071
  */
3910
4072
  getColumnByField(field) {
3911
- const fullColumnFieldData = this.fullColumnFieldData;
4073
+ const $xeTable = this;
4074
+ const internalData = $xeTable;
4075
+ const {
4076
+ fullColumnFieldData
4077
+ } = internalData;
3912
4078
  return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
3913
4079
  },
3914
4080
  getParentColumn(fieldOrColumn) {
@@ -3921,11 +4087,14 @@ const Methods = {
3921
4087
  * 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
3922
4088
  */
3923
4089
  getTableColumn() {
4090
+ const $xeTable = this;
4091
+ const reactData = $xeTable;
4092
+ const internalData = $xeTable;
3924
4093
  return {
3925
- collectColumn: this.collectColumn.slice(0),
3926
- fullColumn: this.tableFullColumn.slice(0),
3927
- visibleColumn: this.visibleColumn.slice(0),
3928
- tableColumn: this.tableColumn.slice(0)
4094
+ collectColumn: internalData.collectColumn.slice(0),
4095
+ fullColumn: internalData.tableFullColumn.slice(0),
4096
+ visibleColumn: internalData.visibleColumn.slice(0),
4097
+ tableColumn: reactData.tableColumn.slice(0)
3929
4098
  };
3930
4099
  },
3931
4100
  /**
@@ -4456,16 +4625,21 @@ const Methods = {
4456
4625
  * 如果存在排序,继续处理
4457
4626
  */
4458
4627
  getTableData() {
4628
+ const $xeTable = this;
4629
+ const props = $xeTable;
4630
+ const reactData = $xeTable;
4631
+ const internalData = $xeTable;
4632
+ const {
4633
+ tableData,
4634
+ footerTableData
4635
+ } = reactData;
4459
4636
  const {
4460
- treeConfig,
4461
4637
  tableFullData,
4462
4638
  afterFullData,
4463
- tableData,
4464
- footerTableData,
4465
4639
  tableFullTreeData
4466
- } = this;
4640
+ } = internalData;
4467
4641
  return {
4468
- fullData: treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
4642
+ fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
4469
4643
  visibleData: afterFullData.slice(0),
4470
4644
  tableData: tableData.slice(0),
4471
4645
  footerData: footerTableData.slice(0)
@@ -4514,37 +4688,15 @@ const Methods = {
4514
4688
  */
4515
4689
  handleLoadDefaults() {
4516
4690
  const $xeTable = this;
4517
- if (this.checkboxConfig) {
4518
- this.handleDefaultSelectionChecked();
4519
- }
4520
- if (this.radioConfig) {
4521
- this.handleDefaultRadioChecked();
4522
- }
4523
- if (this.expandConfig) {
4524
- this.handleDefaultRowExpand();
4525
- }
4526
- if (this.treeConfig) {
4527
- handleDefaultTreeExpand($xeTable);
4528
- }
4529
- if (this.mergeCells) {
4530
- this.handleDefaultMergeCells();
4531
- }
4532
- if (this.mergeFooterItems) {
4533
- this.handleDefaultMergeFooterItems();
4534
- }
4535
- this.$nextTick(() => setTimeout(this.recalculate));
4691
+ handleLoadDefaults($xeTable);
4536
4692
  },
4537
4693
  /**
4538
4694
  * 处理初始化的默认行为
4539
4695
  * 只会执行一次
4540
4696
  */
4541
4697
  handleInitDefaults() {
4542
- const {
4543
- sortConfig
4544
- } = this;
4545
- if (sortConfig) {
4546
- this.handleDefaultSort();
4547
- }
4698
+ const $xeTable = this;
4699
+ handleInitDefaults($xeTable);
4548
4700
  },
4549
4701
  /**
4550
4702
  * 设置为固定列
@@ -4706,76 +4858,34 @@ const Methods = {
4706
4858
  return this.resetCustom(options);
4707
4859
  },
4708
4860
  handleCustom() {
4861
+ const $xeTable = this;
4862
+ const props = $xeTable;
4709
4863
  const {
4710
4864
  mouseConfig
4711
- } = this;
4865
+ } = props;
4712
4866
  if (mouseConfig) {
4713
- if (this.clearSelected) {
4714
- this.clearSelected();
4867
+ if ($xeTable.clearSelected) {
4868
+ $xeTable.clearSelected();
4715
4869
  }
4716
- if (this.clearCellAreas) {
4717
- this.clearCellAreas();
4718
- this.clearCopyCellArea();
4870
+ if ($xeTable.clearCellAreas) {
4871
+ $xeTable.clearCellAreas();
4872
+ $xeTable.clearCopyCellArea();
4719
4873
  }
4720
4874
  }
4721
- this.analyColumnWidth();
4722
- return this.refreshColumn(true);
4723
- },
4724
- handleCustomRestore(storeData) {
4725
- const $xeTable = this;
4726
- const reactData = $xeTable;
4727
- const internalData = $xeTable;
4728
- let {
4729
- collectColumn
4730
- } = internalData;
4731
- const {
4732
- resizableData,
4733
- sortData,
4734
- visibleData,
4735
- fixedData
4736
- } = storeData;
4737
- let hasCustomSort = false;
4738
- // 处理还原
4739
- if (resizableData || sortData || visibleData || fixedData) {
4740
- _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentRow) => {
4741
- const colKey = column.getKey();
4742
- // 支持一级
4743
- if (!parentRow) {
4744
- if (fixedData && fixedData[colKey] !== undefined) {
4745
- column.fixed = fixedData[colKey];
4746
- }
4747
- if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
4748
- hasCustomSort = true;
4749
- column.renderSortNumber = sortData[colKey];
4750
- }
4751
- }
4752
- if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
4753
- column.resizeWidth = resizableData[colKey];
4754
- }
4755
- if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
4756
- column.visible = visibleData[colKey];
4757
- }
4758
- });
4759
- // 如果自定义了顺序
4760
- if (hasCustomSort) {
4761
- collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
4762
- internalData.collectColumn = collectColumn;
4763
- internalData.tableFullColumn = getColumnList(collectColumn);
4764
- }
4765
- reactData.isCustomStatus = true;
4766
- } else {
4767
- reactData.isCustomStatus = false;
4768
- }
4875
+ $xeTable.analyColumnWidth();
4876
+ return $xeTable.refreshColumn(true);
4769
4877
  },
4770
4878
  /**
4771
4879
  * 还原自定义列操作状态
4772
4880
  */
4773
4881
  restoreCustomStorage() {
4882
+ const $xeTable = this;
4883
+ const props = $xeTable;
4774
4884
  const {
4775
- tableId,
4776
- customConfig,
4777
- customOpts
4778
- } = this;
4885
+ customConfig
4886
+ } = props;
4887
+ const tableId = $xeTable.computeTableId;
4888
+ const customOpts = $xeTable.computeCustomOpts;
4779
4889
  const {
4780
4890
  storage,
4781
4891
  restoreStore
@@ -4801,10 +4911,10 @@ const Methods = {
4801
4911
  if (!storeData) {
4802
4912
  return;
4803
4913
  }
4804
- return this.handleCustomRestore(storeData);
4914
+ return handleCustomRestore($xeTable, storeData);
4805
4915
  }).catch(e => e);
4806
4916
  } else {
4807
- return this.handleCustomRestore(storeData);
4917
+ return handleCustomRestore($xeTable, storeData);
4808
4918
  }
4809
4919
  }
4810
4920
  },
@@ -6309,7 +6419,7 @@ const Methods = {
6309
6419
  return;
6310
6420
  }
6311
6421
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6312
- handleTooltip($xeTable, evnt, thEl, thEl.querySelector('.vxe-cell--title') || cellEl, params);
6422
+ handleTooltip($xeTable, evnt, thEl, thEl.querySelector('.vxe-cell--wrapper'), thEl.querySelector('.vxe-cell--title') || cellEl, params);
6313
6423
  }
6314
6424
  },
6315
6425
  /**
@@ -6350,7 +6460,7 @@ const Methods = {
6350
6460
  }
6351
6461
  }
6352
6462
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
6353
- handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6463
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6354
6464
  }
6355
6465
  },
6356
6466
  /**
@@ -6368,7 +6478,7 @@ const Methods = {
6368
6478
  const tdEl = evnt.currentTarget;
6369
6479
  handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
6370
6480
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6371
- handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6481
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6372
6482
  }
6373
6483
  },
6374
6484
  openTooltip(target, content) {
@@ -6457,31 +6567,6 @@ const Methods = {
6457
6567
  }
6458
6568
  return [];
6459
6569
  },
6460
- /**
6461
- * 处理默认勾选
6462
- */
6463
- handleDefaultSelectionChecked() {
6464
- const $xeTable = this;
6465
- const {
6466
- fullDataRowIdData,
6467
- checkboxOpts
6468
- } = this;
6469
- const {
6470
- checkAll,
6471
- checkRowKeys
6472
- } = checkboxOpts;
6473
- if (checkAll) {
6474
- handleCheckedAllCheckboxRow($xeTable, true, true);
6475
- } else if (checkRowKeys) {
6476
- const defSelection = [];
6477
- checkRowKeys.forEach(rowid => {
6478
- if (fullDataRowIdData[rowid]) {
6479
- defSelection.push(fullDataRowIdData[rowid].row);
6480
- }
6481
- });
6482
- handleCheckedCheckboxRow($xeTable, defSelection, true, true);
6483
- }
6484
- },
6485
6570
  handleCheckedCheckboxRow(rows, value, isForce) {
6486
6571
  const $xeTable = this;
6487
6572
  return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
@@ -7180,31 +7265,6 @@ const Methods = {
7180
7265
  reactData.updateCheckboxFlag++;
7181
7266
  return this.$nextTick();
7182
7267
  },
7183
- /**
7184
- * 处理单选框默认勾选
7185
- */
7186
- handleDefaultRadioChecked() {
7187
- const $xeTable = this;
7188
- const {
7189
- radioOpts,
7190
- fullDataRowIdData
7191
- } = this;
7192
- const {
7193
- checkRowKey: rowid,
7194
- reserve
7195
- } = radioOpts;
7196
- if (rowid) {
7197
- if (fullDataRowIdData[rowid]) {
7198
- handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
7199
- }
7200
- if (reserve) {
7201
- const rowkey = (0, _util.getRowkey)(this);
7202
- this.radioReserveRow = {
7203
- [rowkey]: rowid
7204
- };
7205
- }
7206
- }
7207
- },
7208
7268
  /**
7209
7269
  * 单选,行选中事件
7210
7270
  */
@@ -7665,39 +7725,6 @@ const Methods = {
7665
7725
  }
7666
7726
  this.emitEvent('cell-dblclick', params, evnt);
7667
7727
  },
7668
- handleDefaultSort() {
7669
- const $xeTable = this;
7670
- const {
7671
- sortConfig,
7672
- sortOpts
7673
- } = this;
7674
- let {
7675
- defaultSort
7676
- } = sortOpts;
7677
- if (defaultSort) {
7678
- if (!_xeUtils.default.isArray(defaultSort)) {
7679
- defaultSort = [defaultSort];
7680
- }
7681
- if (defaultSort.length) {
7682
- (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
7683
- const {
7684
- field,
7685
- order
7686
- } = item;
7687
- if (field && order) {
7688
- const column = this.getColumnByField(field);
7689
- if (column && column.sortable) {
7690
- column.order = order;
7691
- column.sortTime = Date.now() + index;
7692
- }
7693
- }
7694
- });
7695
- if (!sortOpts.remote) {
7696
- this.handleTableData(true).then(() => updateStyle($xeTable));
7697
- }
7698
- }
7699
- }
7700
- },
7701
7728
  handleColumnSortEvent(evnt, column) {
7702
7729
  const $xeTable = this;
7703
7730
  const props = $xeTable;
@@ -9015,30 +9042,6 @@ const Methods = {
9015
9042
  toggleRowExpand(row) {
9016
9043
  return this.setRowExpand(row, !this.isRowExpandByRow(row));
9017
9044
  },
9018
- /**
9019
- * 处理默认展开行
9020
- */
9021
- handleDefaultRowExpand() {
9022
- const {
9023
- expandOpts,
9024
- fullDataRowIdData
9025
- } = this;
9026
- const {
9027
- expandAll,
9028
- expandRowKeys
9029
- } = expandOpts;
9030
- if (expandAll) {
9031
- this.setAllRowExpand(true);
9032
- } else if (expandRowKeys) {
9033
- const defExpandeds = [];
9034
- expandRowKeys.forEach(rowid => {
9035
- if (fullDataRowIdData[rowid]) {
9036
- defExpandeds.push(fullDataRowIdData[rowid].row);
9037
- }
9038
- });
9039
- this.setRowExpand(defExpandeds, true);
9040
- }
9041
- },
9042
9045
  /**
9043
9046
  * 设置所有行的展开与否
9044
9047
  * @param {Boolean} expanded 是否展开
@@ -9726,8 +9729,8 @@ const Methods = {
9726
9729
  */
9727
9730
  triggerScrollXEvent() {
9728
9731
  const $xeTable = this;
9729
- const sXOpts = $xeTable.computeSXOpts;
9730
- if (sXOpts.immediate) {
9732
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
9733
+ if (virtualXOpts.immediate) {
9731
9734
  loadScrollXData($xeTable);
9732
9735
  } else {
9733
9736
  lazyScrollXData($xeTable);
@@ -9738,8 +9741,8 @@ const Methods = {
9738
9741
  */
9739
9742
  triggerScrollYEvent() {
9740
9743
  const $xeTable = this;
9741
- const sYOpts = $xeTable.computeSYOpts;
9742
- if (sYOpts.immediate) {
9744
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
9745
+ if (virtualYOpts.immediate) {
9743
9746
  loadScrollYData($xeTable);
9744
9747
  } else {
9745
9748
  lazyScrollYData($xeTable);
@@ -9990,8 +9993,8 @@ const Methods = {
9990
9993
  return;
9991
9994
  }
9992
9995
  const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
9993
- const deltaTop = Math.ceil((shiftKey ? deltaX : deltaY) * wheelSpeed);
9994
- const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
9996
+ const deltaTop = shiftKey ? 0 : Math.ceil(deltaY * wheelSpeed);
9997
+ const deltaLeft = Math.ceil((shiftKey ? deltaY || deltaX : deltaX) * wheelSpeed);
9995
9998
  const isTopWheel = deltaTop < 0;
9996
9999
  const currScrollTop = bodyScrollElem.scrollTop;
9997
10000
  // 如果滚动位置已经是顶部或底部,则不需要触发
@@ -10564,9 +10567,6 @@ const Methods = {
10564
10567
  }
10565
10568
  });
10566
10569
  },
10567
- handleDefaultMergeCells() {
10568
- this.setMergeCells(this.mergeCells);
10569
- },
10570
10570
  /**
10571
10571
  * 设置合并单元格
10572
10572
  * @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
@@ -10614,9 +10614,6 @@ const Methods = {
10614
10614
  return updateStyle($xeTable);
10615
10615
  });
10616
10616
  },
10617
- handleDefaultMergeFooterItems() {
10618
- this.setMergeFooterItems(this.mergeFooterItems);
10619
- },
10620
10617
  setMergeFooterItems(merges) {
10621
10618
  const $xeTable = this;
10622
10619
  if (this.footerSpanMethod) {