vxe-table 3.14.0-beta.3 → 3.14.0-beta.30

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 (209) hide show
  1. package/es/grid/src/grid.js +79 -50
  2. package/es/locale/lang/ar-EG.js +7 -1
  3. package/es/locale/lang/de-DE.js +7 -1
  4. package/es/locale/lang/en-US.js +7 -1
  5. package/es/locale/lang/es-ES.js +7 -1
  6. package/es/locale/lang/fr-FR.js +7 -1
  7. package/es/locale/lang/hu-HU.js +7 -1
  8. package/es/locale/lang/hy-AM.js +7 -1
  9. package/es/locale/lang/id-ID.js +7 -1
  10. package/es/locale/lang/it-IT.js +7 -1
  11. package/es/locale/lang/ja-JP.js +7 -1
  12. package/es/locale/lang/ko-KR.js +7 -1
  13. package/es/locale/lang/nb-NO.js +7 -1
  14. package/es/locale/lang/pt-BR.js +7 -1
  15. package/es/locale/lang/ru-RU.js +7 -1
  16. package/es/locale/lang/th-TH.js +7 -1
  17. package/es/locale/lang/ug-CN.js +7 -1
  18. package/es/locale/lang/uk-UA.js +7 -1
  19. package/es/locale/lang/vi-VN.js +7 -1
  20. package/es/locale/lang/zh-CHT.js +7 -1
  21. package/es/locale/lang/zh-CN.js +7 -1
  22. package/es/style.css +1 -1
  23. package/es/table/module/custom/mixin.js +4 -2
  24. package/es/table/module/custom/panel.js +24 -23
  25. package/es/table/module/edit/mixin.js +17 -11
  26. package/es/table/module/export/export-panel.js +5 -4
  27. package/es/table/module/export/import-panel.js +8 -7
  28. package/es/table/module/export/mixin.js +30 -27
  29. package/es/table/module/filter/panel.js +21 -10
  30. package/es/table/module/keyboard/mixin.js +141 -41
  31. package/es/table/module/menu/mixin.js +6 -3
  32. package/es/table/module/menu/panel.js +7 -7
  33. package/es/table/module/validator/mixin.js +2 -2
  34. package/es/table/render/index.js +14 -5
  35. package/es/table/src/body.js +50 -26
  36. package/es/table/src/cell.js +27 -22
  37. package/es/table/src/column.js +11 -9
  38. package/es/table/src/columnInfo.js +6 -6
  39. package/es/table/src/footer.js +19 -9
  40. package/es/table/src/group.js +6 -5
  41. package/es/table/src/header.js +15 -9
  42. package/es/table/src/methods.js +1008 -789
  43. package/es/table/src/props.js +4 -0
  44. package/es/table/src/table.js +85 -49
  45. package/es/table/src/util.js +84 -19
  46. package/es/toolbar/src/toolbar.js +3 -3
  47. package/es/ui/index.js +2 -1
  48. package/es/ui/src/log.js +1 -1
  49. package/helper/vetur/attributes.json +1 -1
  50. package/helper/vetur/tags.json +1 -1
  51. package/lib/grid/src/grid.js +86 -67
  52. package/lib/grid/src/grid.min.js +1 -1
  53. package/lib/index.umd.js +1907 -1344
  54. package/lib/index.umd.min.js +1 -1
  55. package/lib/locale/lang/ar-EG.js +7 -1
  56. package/lib/locale/lang/ar-EG.min.js +1 -1
  57. package/lib/locale/lang/de-DE.js +7 -1
  58. package/lib/locale/lang/de-DE.min.js +1 -1
  59. package/lib/locale/lang/en-US.js +7 -1
  60. package/lib/locale/lang/en-US.min.js +1 -1
  61. package/lib/locale/lang/en-US.umd.js +7 -1
  62. package/lib/locale/lang/es-ES.js +7 -1
  63. package/lib/locale/lang/es-ES.min.js +1 -1
  64. package/lib/locale/lang/es-ES.umd.js +7 -1
  65. package/lib/locale/lang/fr-FR.js +7 -1
  66. package/lib/locale/lang/fr-FR.min.js +1 -1
  67. package/lib/locale/lang/hu-HU.js +7 -1
  68. package/lib/locale/lang/hu-HU.min.js +1 -1
  69. package/lib/locale/lang/hu-HU.umd.js +7 -1
  70. package/lib/locale/lang/hy-AM.js +7 -1
  71. package/lib/locale/lang/hy-AM.min.js +1 -1
  72. package/lib/locale/lang/id-ID.js +7 -1
  73. package/lib/locale/lang/id-ID.min.js +1 -1
  74. package/lib/locale/lang/it-IT.js +7 -1
  75. package/lib/locale/lang/it-IT.min.js +1 -1
  76. package/lib/locale/lang/ja-JP.js +7 -1
  77. package/lib/locale/lang/ja-JP.min.js +1 -1
  78. package/lib/locale/lang/ja-JP.umd.js +7 -1
  79. package/lib/locale/lang/ko-KR.js +7 -1
  80. package/lib/locale/lang/ko-KR.min.js +1 -1
  81. package/lib/locale/lang/ko-KR.umd.js +7 -1
  82. package/lib/locale/lang/nb-NO.js +7 -1
  83. package/lib/locale/lang/nb-NO.min.js +1 -1
  84. package/lib/locale/lang/pt-BR.js +7 -1
  85. package/lib/locale/lang/pt-BR.min.js +1 -1
  86. package/lib/locale/lang/pt-BR.umd.js +7 -1
  87. package/lib/locale/lang/ru-RU.js +7 -1
  88. package/lib/locale/lang/ru-RU.min.js +1 -1
  89. package/lib/locale/lang/ru-RU.umd.js +7 -1
  90. package/lib/locale/lang/th-TH.js +7 -1
  91. package/lib/locale/lang/th-TH.min.js +1 -1
  92. package/lib/locale/lang/ug-CN.js +7 -1
  93. package/lib/locale/lang/ug-CN.min.js +1 -1
  94. package/lib/locale/lang/uk-UA.js +7 -1
  95. package/lib/locale/lang/uk-UA.min.js +1 -1
  96. package/lib/locale/lang/uk-UA.umd.js +7 -1
  97. package/lib/locale/lang/vi-VN.js +7 -1
  98. package/lib/locale/lang/vi-VN.min.js +1 -1
  99. package/lib/locale/lang/zh-CHT.js +7 -1
  100. package/lib/locale/lang/zh-CHT.min.js +1 -1
  101. package/lib/locale/lang/zh-CHT.umd.js +7 -1
  102. package/lib/locale/lang/zh-CN.js +7 -1
  103. package/lib/locale/lang/zh-CN.min.js +1 -1
  104. package/lib/locale/lang/zh-CN.umd.js +7 -1
  105. package/lib/style.css +1 -1
  106. package/lib/table/module/custom/mixin.js +5 -3
  107. package/lib/table/module/custom/mixin.min.js +1 -1
  108. package/lib/table/module/custom/panel.js +22 -29
  109. package/lib/table/module/custom/panel.min.js +1 -1
  110. package/lib/table/module/edit/mixin.js +19 -13
  111. package/lib/table/module/edit/mixin.min.js +1 -1
  112. package/lib/table/module/export/export-panel.js +5 -4
  113. package/lib/table/module/export/export-panel.min.js +1 -1
  114. package/lib/table/module/export/import-panel.js +8 -7
  115. package/lib/table/module/export/import-panel.min.js +1 -1
  116. package/lib/table/module/export/mixin.js +35 -34
  117. package/lib/table/module/export/mixin.min.js +1 -1
  118. package/lib/table/module/filter/panel.js +16 -16
  119. package/lib/table/module/filter/panel.min.js +1 -1
  120. package/lib/table/module/keyboard/mixin.js +149 -47
  121. package/lib/table/module/keyboard/mixin.min.js +1 -1
  122. package/lib/table/module/menu/mixin.js +6 -3
  123. package/lib/table/module/menu/mixin.min.js +1 -1
  124. package/lib/table/module/menu/panel.js +7 -7
  125. package/lib/table/module/menu/panel.min.js +1 -1
  126. package/lib/table/module/validator/mixin.js +3 -3
  127. package/lib/table/module/validator/mixin.min.js +1 -1
  128. package/lib/table/render/index.js +18 -5
  129. package/lib/table/render/index.min.js +1 -1
  130. package/lib/table/src/body.js +57 -25
  131. package/lib/table/src/body.min.js +1 -1
  132. package/lib/table/src/cell.js +39 -23
  133. package/lib/table/src/cell.min.js +1 -1
  134. package/lib/table/src/column.js +11 -9
  135. package/lib/table/src/column.min.js +1 -1
  136. package/lib/table/src/columnInfo.js +6 -6
  137. package/lib/table/src/columnInfo.min.js +1 -1
  138. package/lib/table/src/footer.js +19 -7
  139. package/lib/table/src/footer.min.js +1 -1
  140. package/lib/table/src/group.js +6 -5
  141. package/lib/table/src/group.min.js +1 -1
  142. package/lib/table/src/header.js +16 -8
  143. package/lib/table/src/header.min.js +1 -1
  144. package/lib/table/src/methods.js +1166 -919
  145. package/lib/table/src/methods.min.js +1 -1
  146. package/lib/table/src/props.js +4 -0
  147. package/lib/table/src/props.min.js +1 -1
  148. package/lib/table/src/table.js +93 -52
  149. package/lib/table/src/table.min.js +1 -1
  150. package/lib/table/src/util.js +96 -20
  151. package/lib/table/src/util.min.js +1 -1
  152. package/lib/toolbar/src/toolbar.js +3 -3
  153. package/lib/ui/index.js +2 -1
  154. package/lib/ui/index.min.js +1 -1
  155. package/lib/ui/src/log.js +1 -1
  156. package/lib/ui/src/log.min.js +1 -1
  157. package/package.json +2 -2
  158. package/packages/grid/src/grid.ts +93 -59
  159. package/packages/locale/lang/ar-EG.ts +7 -1
  160. package/packages/locale/lang/de-DE.ts +7 -1
  161. package/packages/locale/lang/en-US.ts +7 -1
  162. package/packages/locale/lang/es-ES.ts +7 -1
  163. package/packages/locale/lang/fr-FR.ts +7 -1
  164. package/packages/locale/lang/hu-HU.ts +7 -1
  165. package/packages/locale/lang/hy-AM.ts +7 -1
  166. package/packages/locale/lang/id-ID.ts +7 -1
  167. package/packages/locale/lang/it-IT.ts +7 -1
  168. package/packages/locale/lang/ja-JP.ts +7 -1
  169. package/packages/locale/lang/ko-KR.ts +7 -1
  170. package/packages/locale/lang/nb-NO.ts +7 -1
  171. package/packages/locale/lang/pt-BR.ts +7 -1
  172. package/packages/locale/lang/ru-RU.ts +7 -1
  173. package/packages/locale/lang/th-TH.ts +7 -1
  174. package/packages/locale/lang/ug-CN.ts +7 -1
  175. package/packages/locale/lang/uk-UA.ts +7 -1
  176. package/packages/locale/lang/vi-VN.ts +7 -1
  177. package/packages/locale/lang/zh-CHT.ts +7 -1
  178. package/packages/locale/lang/zh-CN.ts +7 -1
  179. package/packages/table/module/custom/mixin.ts +6 -3
  180. package/packages/table/module/custom/panel.ts +42 -37
  181. package/packages/table/module/edit/mixin.ts +20 -14
  182. package/packages/table/module/export/export-panel.ts +8 -5
  183. package/packages/table/module/export/import-panel.ts +11 -7
  184. package/packages/table/module/export/mixin.ts +37 -32
  185. package/packages/table/module/filter/panel.ts +25 -10
  186. package/packages/table/module/keyboard/mixin.ts +155 -49
  187. package/packages/table/module/menu/mixin.ts +12 -6
  188. package/packages/table/module/menu/panel.ts +10 -7
  189. package/packages/table/module/validator/mixin.ts +2 -2
  190. package/packages/table/render/index.ts +14 -5
  191. package/packages/table/src/body.ts +49 -25
  192. package/packages/table/src/cell.ts +27 -22
  193. package/packages/table/src/column.ts +14 -10
  194. package/packages/table/src/columnInfo.ts +9 -6
  195. package/packages/table/src/footer.ts +19 -9
  196. package/packages/table/src/group.ts +9 -5
  197. package/packages/table/src/header.ts +16 -9
  198. package/packages/table/src/methods.ts +1110 -830
  199. package/packages/table/src/props.ts +16 -12
  200. package/packages/table/src/table.ts +99 -52
  201. package/packages/table/src/util.ts +95 -19
  202. package/packages/toolbar/src/toolbar.ts +3 -3
  203. package/packages/ui/index.ts +1 -0
  204. /package/es/{iconfont.1741160631070.ttf → iconfont.1742890796110.ttf} +0 -0
  205. /package/es/{iconfont.1741160631070.woff → iconfont.1742890796110.woff} +0 -0
  206. /package/es/{iconfont.1741160631070.woff2 → iconfont.1742890796110.woff2} +0 -0
  207. /package/lib/{iconfont.1741160631070.ttf → iconfont.1742890796110.ttf} +0 -0
  208. /package/lib/{iconfont.1741160631070.woff → iconfont.1742890796110.woff} +0 -0
  209. /package/lib/{iconfont.1741160631070.woff2 → iconfont.1742890796110.woff2} +0 -0
@@ -21,6 +21,7 @@ const {
21
21
  interceptor,
22
22
  createEvent
23
23
  } = _ui.VxeUI;
24
+ const supportMaxRow = 5e6;
24
25
  const customStorageKey = 'VXE_CUSTOM_STORE';
25
26
  const maxYHeight = 5e6;
26
27
  const maxXWidth = 5e6;
@@ -287,7 +288,7 @@ function cacheColumnMap($xeTable) {
287
288
  fullColumnFieldData[field] = rest;
288
289
  } else {
289
290
  if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
290
- (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
291
+ (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field=?`]);
291
292
  }
292
293
  }
293
294
  if (!hasFixed && fixed) {
@@ -393,9 +394,12 @@ function updateAfterListIndex($xeTable) {
393
394
  fullDataRowIdData,
394
395
  fullAllDataRowIdData
395
396
  } = internalData;
397
+ const {
398
+ handleGetRowId
399
+ } = (0, _util.createHandleGetRowId)($xeTable);
396
400
  const fullMaps = {};
397
401
  afterFullData.forEach((row, index) => {
398
- const rowid = (0, _util.getRowid)($xeTable, row);
402
+ const rowid = handleGetRowId(row);
399
403
  const rowRest = fullAllDataRowIdData[rowid];
400
404
  const seq = index + 1;
401
405
  if (rowRest) {
@@ -449,8 +453,11 @@ function updateAfterDataIndex($xeTable) {
449
453
  const childrenField = treeOpts.children || treeOpts.childrenField;
450
454
  const fullMaps = {};
451
455
  if (treeConfig) {
456
+ const {
457
+ handleGetRowId
458
+ } = (0, _util.createHandleGetRowId)($xeTable);
452
459
  _xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
453
- const rowid = (0, _util.getRowid)($xeTable, row);
460
+ const rowid = handleGetRowId(row);
454
461
  const rowRest = fullAllDataRowIdData[rowid];
455
462
  const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
456
463
  if (rowRest) {
@@ -492,25 +499,25 @@ function updateAfterDataIndex($xeTable) {
492
499
  */
493
500
  function handleVirtualTreeToList($xeTable) {
494
501
  const props = $xeTable;
495
- const reactData = $xeTable;
496
502
  const internalData = $xeTable;
497
503
  const {
498
504
  treeConfig
499
505
  } = props;
500
506
  const {
507
+ fullAllDataRowIdData,
501
508
  treeExpandedMaps
502
- } = reactData;
503
- const {
504
- fullAllDataRowIdData
505
509
  } = internalData;
506
510
  const treeOpts = $xeTable.computeTreeOpts;
507
511
  const childrenField = treeOpts.children || treeOpts.childrenField;
508
512
  if (treeConfig && treeOpts.transform) {
513
+ const {
514
+ handleGetRowId
515
+ } = (0, _util.createHandleGetRowId)($xeTable);
509
516
  const fullData = [];
510
517
  const expandMaps = {};
511
518
  _xeUtils.default.eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
512
- const rowid = (0, _util.getRowid)($xeTable, row);
513
- const parentRowid = (0, _util.getRowid)($xeTable, parentRow);
519
+ const rowid = handleGetRowId(row);
520
+ const parentRowid = handleGetRowId(parentRow);
514
521
  if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
515
522
  const rowRest = fullAllDataRowIdData[rowid];
516
523
  if (rowRest) {
@@ -558,7 +565,6 @@ function updateStyle($xeTable) {
558
565
  } = reactData;
559
566
  const {
560
567
  visibleColumn,
561
- fullColumnIdData,
562
568
  tableHeight,
563
569
  headerHeight,
564
570
  footerHeight,
@@ -575,7 +581,6 @@ function updateStyle($xeTable) {
575
581
  const osbWidth = overflowY ? scrollbarWidth : 0;
576
582
  const osbHeight = overflowX ? scrollbarHeight : 0;
577
583
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
578
- const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
579
584
  const mouseOpts = $xeTable.computeMouseOpts;
580
585
  const expandOpts = $xeTable.computeExpandOpts;
581
586
  const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
@@ -837,58 +842,6 @@ function updateStyle($xeTable) {
837
842
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
838
843
  }
839
844
  }
840
- const colgroupElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-colgroup`]);
841
- if (colgroupElem) {
842
- _xeUtils.default.arrayEach(colgroupElem.children, colElem => {
843
- const colid = colElem.getAttribute('name');
844
- if (fullColumnIdData[colid]) {
845
- const colRest = fullColumnIdData[colid];
846
- const column = colRest.column;
847
- const {
848
- showHeaderOverflow,
849
- showFooterOverflow,
850
- showOverflow
851
- } = column;
852
- let cellOverflow;
853
- colElem.style.width = `${column.renderWidth}px`;
854
- if (layout === 'header') {
855
- cellOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
856
- } else if (layout === 'footer') {
857
- cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
858
- } else {
859
- cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? isAllOverflow : showOverflow;
860
- }
861
- const showEllipsis = cellOverflow === 'ellipsis';
862
- const showTitle = cellOverflow === 'title';
863
- const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
864
- let hasEllipsis = showTitle || showTooltip || showEllipsis;
865
- const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
866
- // 纵向虚拟滚动不支持动态行高
867
- if (scrollYLoad && !hasEllipsis) {
868
- hasEllipsis = true;
869
- }
870
- if (listElem) {
871
- _xeUtils.default.arrayEach(listElem.querySelectorAll(`.${column.id}`), elem => {
872
- const colspan = parseInt(elem.getAttribute('colspan') || 1);
873
- const cellElem = elem.querySelector('.vxe-cell');
874
- let colWidth = column.renderWidth;
875
- if (cellElem) {
876
- if (colspan > 1) {
877
- const columnIndex = $xeTable.getColumnIndex(column);
878
- for (let index = 1; index < colspan; index++) {
879
- const nextColumn = $xeTable.getColumns(columnIndex + index);
880
- if (nextColumn) {
881
- colWidth += nextColumn.renderWidth;
882
- }
883
- }
884
- }
885
- cellElem.style.width = hasEllipsis ? `${colWidth - cellOffsetWidth * colspan}px` : '';
886
- }
887
- });
888
- }
889
- }
890
- });
891
- }
892
845
  });
893
846
  });
894
847
  if (currentRow) {
@@ -899,6 +852,21 @@ function updateStyle($xeTable) {
899
852
  }
900
853
  return $xeTable.$nextTick();
901
854
  }
855
+ function checkValidate($xeTable, type) {
856
+ if ($xeTable.triggerValidate) {
857
+ return $xeTable.triggerValidate(type);
858
+ }
859
+ return $xeTable.$nextTick();
860
+ }
861
+ /**
862
+ * 当单元格发生改变时
863
+ * 如果存在规则,则校验
864
+ */
865
+ function handleChangeCell($xeTable, evnt, params) {
866
+ checkValidate($xeTable, 'blur').catch(e => e).then(() => {
867
+ $xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
868
+ });
869
+ }
902
870
  function handleRadioReserveRow($xeTable, row) {
903
871
  const internalData = $xeTable;
904
872
  const radioOpts = $xeTable.computeRadioOpts;
@@ -950,12 +918,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
950
918
  const {
951
919
  treeConfig
952
920
  } = props;
953
- const {
954
- selectCheckboxMaps
955
- } = reactData;
956
921
  const {
957
922
  afterFullData,
958
- checkboxReserveRowMap
923
+ checkboxReserveRowMap,
924
+ selectCheckboxMaps
959
925
  } = internalData;
960
926
  const treeOpts = $xeTable.computeTreeOpts;
961
927
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -965,6 +931,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
965
931
  reserve,
966
932
  checkMethod
967
933
  } = checkboxOpts;
934
+ const {
935
+ handleGetRowId
936
+ } = (0, _util.createHandleGetRowId)($xeTable);
937
+ // indeterminateField 仅支持读取
968
938
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
969
939
  const selectRowMaps = {};
970
940
  /**
@@ -977,7 +947,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
977
947
  row
978
948
  })) {
979
949
  if (checked) {
980
- selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
950
+ selectRowMaps[handleGetRowId(row)] = row;
981
951
  }
982
952
  _xeUtils.default.set(row, checkField, checked);
983
953
  }
@@ -1009,7 +979,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1009
979
  if (isForce || !checkMethod || checkMethod({
1010
980
  row
1011
981
  })) {
1012
- selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
982
+ const rowid = handleGetRowId(row);
983
+ selectRowMaps[rowid] = row;
1013
984
  }
1014
985
  }, {
1015
986
  children: childrenField
@@ -1021,7 +992,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1021
992
  */
1022
993
  if (!isForce && checkMethod) {
1023
994
  _xeUtils.default.eachTree(afterFullData, row => {
1024
- const rowid = (0, _util.getRowid)($xeTable, row);
995
+ const rowid = handleGetRowId(row);
1025
996
  if (checkMethod({
1026
997
  row
1027
998
  }) ? 0 : selectCheckboxMaps[rowid]) {
@@ -1041,7 +1012,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1041
1012
  */
1042
1013
  if (!isForce && checkMethod) {
1043
1014
  afterFullData.forEach(row => {
1044
- const rowid = (0, _util.getRowid)($xeTable, row);
1015
+ const rowid = handleGetRowId(row);
1045
1016
  if (selectCheckboxMaps[rowid] || checkMethod({
1046
1017
  row
1047
1018
  })) {
@@ -1050,7 +1021,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1050
1021
  });
1051
1022
  } else {
1052
1023
  afterFullData.forEach(row => {
1053
- selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
1024
+ const rowid = handleGetRowId(row);
1025
+ selectRowMaps[rowid] = row;
1054
1026
  });
1055
1027
  }
1056
1028
  } else {
@@ -1061,7 +1033,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1061
1033
  */
1062
1034
  if (!isForce && checkMethod) {
1063
1035
  afterFullData.forEach(row => {
1064
- const rowid = (0, _util.getRowid)($xeTable, row);
1036
+ const rowid = handleGetRowId(row);
1065
1037
  if (checkMethod({
1066
1038
  row
1067
1039
  }) ? 0 : selectCheckboxMaps[rowid]) {
@@ -1081,10 +1053,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
1081
1053
  afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
1082
1054
  }
1083
1055
  }
1084
- reactData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
1056
+ reactData.updateCheckboxFlag++;
1057
+ internalData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
1085
1058
  reactData.isAllSelected = checked;
1086
1059
  reactData.isIndeterminate = false;
1087
- reactData.treeIndeterminateMaps = {};
1088
1060
  internalData.treeIndeterminateRowMaps = {};
1089
1061
  $xeTable.checkSelectionStatus();
1090
1062
  return $xeTable.$nextTick();
@@ -1100,15 +1072,15 @@ function handleReserveStatus($xeTable) {
1100
1072
  const {
1101
1073
  expandColumn,
1102
1074
  currentRow,
1103
- selectCheckboxMaps,
1104
- selectRadioRow,
1105
- rowExpandedMaps,
1106
- treeExpandedMaps
1075
+ selectRadioRow
1107
1076
  } = reactData;
1108
1077
  const {
1109
1078
  fullDataRowIdData,
1110
1079
  fullAllDataRowIdData,
1111
- radioReserveRow
1080
+ radioReserveRow,
1081
+ selectCheckboxMaps,
1082
+ treeExpandedMaps,
1083
+ rowExpandedMaps
1112
1084
  } = internalData;
1113
1085
  const expandOpts = $xeTable.computeExpandOpts;
1114
1086
  const treeOpts = $xeTable.computeTreeOpts;
@@ -1126,7 +1098,8 @@ function handleReserveStatus($xeTable) {
1126
1098
  }
1127
1099
  }
1128
1100
  // 复选框
1129
- reactData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
1101
+ internalData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
1102
+ reactData.updateCheckboxFlag++;
1130
1103
  // 还原保留选中状态
1131
1104
  if (checkboxOpts.reserve) {
1132
1105
  handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
@@ -1135,17 +1108,194 @@ function handleReserveStatus($xeTable) {
1135
1108
  reactData.currentRow = null; // 刷新当前行状态
1136
1109
  }
1137
1110
  // 行展开
1138
- reactData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
1111
+ internalData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
1112
+ reactData.rowExpandedFlag++;
1139
1113
  // 还原保留状态
1140
1114
  if (expandColumn && expandOpts.reserve) {
1141
1115
  $xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
1142
1116
  }
1143
1117
  // 树展开
1144
- reactData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
1118
+ internalData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
1119
+ reactData.treeExpandedFlag++;
1145
1120
  if (treeConfig && treeOpts.reserve) {
1146
1121
  $xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
1147
1122
  }
1148
1123
  }
1124
+ /**
1125
+ * 处理默认展开树节点
1126
+ */
1127
+ const handleDefaultTreeExpand = $xeTable => {
1128
+ const props = $xeTable;
1129
+ const internalData = $xeTable;
1130
+ const {
1131
+ treeConfig
1132
+ } = props;
1133
+ if (treeConfig) {
1134
+ const {
1135
+ tableFullData
1136
+ } = internalData;
1137
+ const treeOpts = $xeTable.computeTreeOpts;
1138
+ const {
1139
+ expandAll,
1140
+ expandRowKeys
1141
+ } = treeOpts;
1142
+ const childrenField = treeOpts.children || treeOpts.childrenField;
1143
+ if (expandAll) {
1144
+ $xeTable.setAllTreeExpand(true);
1145
+ } else if (expandRowKeys) {
1146
+ const defExpandeds = [];
1147
+ const rowkey = (0, _util.getRowkey)($xeTable);
1148
+ expandRowKeys.forEach(rowid => {
1149
+ const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
1150
+ children: childrenField
1151
+ });
1152
+ if (matchObj) {
1153
+ defExpandeds.push(matchObj.item);
1154
+ }
1155
+ });
1156
+ $xeTable.setTreeExpand(defExpandeds, true);
1157
+ }
1158
+ }
1159
+ };
1160
+ const handleAsyncTreeExpandChilds = ($xeTable, row) => {
1161
+ const reactData = $xeTable;
1162
+ const internalData = $xeTable;
1163
+ const treeOpts = $xeTable.computeTreeOpts;
1164
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
1165
+ const {
1166
+ transform,
1167
+ loadMethod
1168
+ } = treeOpts;
1169
+ const {
1170
+ checkStrictly
1171
+ } = checkboxOpts;
1172
+ return new Promise(resolve => {
1173
+ if (loadMethod) {
1174
+ const {
1175
+ fullAllDataRowIdData,
1176
+ treeExpandLazyLoadedMaps
1177
+ } = internalData;
1178
+ const rowid = (0, _util.getRowid)($xeTable, row);
1179
+ const rowRest = fullAllDataRowIdData[rowid];
1180
+ treeExpandLazyLoadedMaps[rowid] = row;
1181
+ Promise.resolve(loadMethod({
1182
+ $table: $xeTable,
1183
+ row
1184
+ })).then(childRecords => {
1185
+ if (rowRest) {
1186
+ rowRest.treeLoaded = true;
1187
+ }
1188
+ if (treeExpandLazyLoadedMaps[rowid]) {
1189
+ delete treeExpandLazyLoadedMaps[rowid];
1190
+ }
1191
+ if (!_xeUtils.default.isArray(childRecords)) {
1192
+ childRecords = [];
1193
+ }
1194
+ if (childRecords) {
1195
+ return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
1196
+ const {
1197
+ treeExpandedMaps
1198
+ } = internalData;
1199
+ if (childRows.length && !treeExpandedMaps[rowid]) {
1200
+ treeExpandedMaps[rowid] = row;
1201
+ }
1202
+ reactData.treeExpandedFlag++;
1203
+ // 如果当前节点已选中,则展开后子节点也被选中
1204
+ if (!checkStrictly && $xeTable.isCheckedByCheckboxRow(row)) {
1205
+ handleCheckedCheckboxRow($xeTable, childRows, true);
1206
+ }
1207
+ return $xeTable.$nextTick().then(() => {
1208
+ if (transform) {
1209
+ $xeTable.handleTableData();
1210
+ updateAfterDataIndex($xeTable);
1211
+ return $xeTable.$nextTick();
1212
+ }
1213
+ });
1214
+ });
1215
+ }
1216
+ }).catch(() => {
1217
+ const {
1218
+ treeExpandLazyLoadedMaps
1219
+ } = internalData;
1220
+ if (rowRest) {
1221
+ rowRest.treeLoaded = false;
1222
+ }
1223
+ if (treeExpandLazyLoadedMaps[rowid]) {
1224
+ delete treeExpandLazyLoadedMaps[rowid];
1225
+ }
1226
+ }).finally(() => {
1227
+ reactData.treeExpandedFlag++;
1228
+ $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
1229
+ });
1230
+ } else {
1231
+ resolve();
1232
+ }
1233
+ });
1234
+ };
1235
+ const handleTreeExpandReserve = ($xeTable, row, expanded) => {
1236
+ const internalData = $xeTable;
1237
+ const {
1238
+ treeExpandedReserveRowMap
1239
+ } = internalData;
1240
+ const treeOpts = $xeTable.computeTreeOpts;
1241
+ if (treeOpts.reserve) {
1242
+ const rowid = (0, _util.getRowid)($xeTable, row);
1243
+ if (expanded) {
1244
+ treeExpandedReserveRowMap[rowid] = row;
1245
+ } else if (treeExpandedReserveRowMap[rowid]) {
1246
+ delete treeExpandedReserveRowMap[rowid];
1247
+ }
1248
+ }
1249
+ };
1250
+ const handleAsyncRowExpand = ($xeTable, row) => {
1251
+ const reactData = $xeTable;
1252
+ const internalData = $xeTable;
1253
+ return new Promise(resolve => {
1254
+ const expandOpts = $xeTable.computeExpandOpts;
1255
+ const {
1256
+ loadMethod
1257
+ } = expandOpts;
1258
+ if (loadMethod) {
1259
+ const {
1260
+ fullAllDataRowIdData,
1261
+ rowExpandLazyLoadedMaps
1262
+ } = internalData;
1263
+ const rowid = (0, _util.getRowid)($xeTable, row);
1264
+ const rowRest = fullAllDataRowIdData[rowid];
1265
+ rowExpandLazyLoadedMaps[rowid] = row;
1266
+ loadMethod({
1267
+ $table: $xeTable,
1268
+ row,
1269
+ rowIndex: $xeTable.getRowIndex(row),
1270
+ $rowIndex: $xeTable.getVMRowIndex(row)
1271
+ }).then(() => {
1272
+ const {
1273
+ rowExpandedMaps
1274
+ } = internalData;
1275
+ if (rowRest) {
1276
+ rowRest.expandLoaded = true;
1277
+ }
1278
+ rowExpandedMaps[rowid] = row;
1279
+ reactData.rowExpandedFlag++;
1280
+ }).catch(() => {
1281
+ if (rowRest) {
1282
+ rowRest.expandLoaded = false;
1283
+ }
1284
+ }).finally(() => {
1285
+ const {
1286
+ rowExpandLazyLoadedMaps
1287
+ } = internalData;
1288
+ if (rowExpandLazyLoadedMaps[rowid]) {
1289
+ delete rowExpandLazyLoadedMaps[rowid];
1290
+ }
1291
+ reactData.rowExpandedFlag++;
1292
+ $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
1293
+ });
1294
+ } else {
1295
+ resolve();
1296
+ }
1297
+ });
1298
+ };
1149
1299
  function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
1150
1300
  const reactData = $xeTable;
1151
1301
  const {
@@ -1220,12 +1370,15 @@ function handleVirtualYVisible($xeTable) {
1220
1370
  toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
1221
1371
  visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
1222
1372
  } else {
1373
+ const {
1374
+ handleGetRowId
1375
+ } = (0, _util.createHandleGetRowId)($xeTable);
1223
1376
  let leftIndex = 0;
1224
1377
  let rightIndex = afterFullData.length;
1225
1378
  while (leftIndex < rightIndex) {
1226
1379
  const rIndex = Math.floor((leftIndex + rightIndex) / 2);
1227
1380
  const row = afterFullData[rIndex];
1228
- const rowid = (0, _util.getRowid)($xeTable, row);
1381
+ const rowid = handleGetRowId(row);
1229
1382
  const rowRest = fullAllDataRowIdData[rowid] || {};
1230
1383
  if (rowRest.oTop <= startTop) {
1231
1384
  leftIndex = rIndex + 1;
@@ -1236,7 +1389,7 @@ function handleVirtualYVisible($xeTable) {
1236
1389
  toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1237
1390
  for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1238
1391
  const row = afterFullData[rIndex];
1239
- const rowid = (0, _util.getRowid)($xeTable, row);
1392
+ const rowid = handleGetRowId(row);
1240
1393
  const rowRest = fullAllDataRowIdData[rowid] || {};
1241
1394
  visibleSize++;
1242
1395
  if (rowRest.oTop > endTop || visibleSize >= 100) {
@@ -1275,12 +1428,16 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
1275
1428
  }
1276
1429
  }
1277
1430
  }
1278
- function setMerges(_vm, merges, mList, rowList) {
1431
+ function setMerges($xeTable, merges, mList, rowList) {
1432
+ const props = $xeTable;
1433
+ const internalData = $xeTable;
1279
1434
  if (merges) {
1280
1435
  const {
1281
- treeConfig,
1436
+ treeConfig
1437
+ } = props;
1438
+ const {
1282
1439
  visibleColumn
1283
- } = _vm;
1440
+ } = internalData;
1284
1441
  if (!_xeUtils.default.isArray(merges)) {
1285
1442
  merges = [merges];
1286
1443
  }
@@ -1330,13 +1487,17 @@ function setMerges(_vm, merges, mList, rowList) {
1330
1487
  });
1331
1488
  }
1332
1489
  }
1333
- function removeMerges(_vm, merges, mList, rowList) {
1490
+ function removeMerges($xeTable, merges, mList, rowList) {
1491
+ const props = $xeTable;
1492
+ const internalData = $xeTable;
1334
1493
  const rest = [];
1335
1494
  if (merges) {
1336
1495
  const {
1337
- treeConfig,
1496
+ treeConfig
1497
+ } = props;
1498
+ const {
1338
1499
  visibleColumn
1339
- } = _vm;
1500
+ } = internalData;
1340
1501
  if (!_xeUtils.default.isArray(merges)) {
1341
1502
  merges = [merges];
1342
1503
  }
@@ -1533,6 +1694,7 @@ function autoCellWidth($xeTable) {
1533
1694
  internalData.headerHeight = headerHeight;
1534
1695
  internalData.footerHeight = footerHeight;
1535
1696
  reactData.overflowX = overflowX;
1697
+ reactData.resizeWidthFlag++;
1536
1698
  updateColumnOffsetLeft($xeTable);
1537
1699
  updateHeight($xeTable);
1538
1700
  reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
@@ -1567,8 +1729,11 @@ const calcCellHeight = $xeTable => {
1567
1729
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
1568
1730
  const el = $xeTable.$refs.refElem;
1569
1731
  if (!isAllOverflow && scrollYLoad && el) {
1732
+ const {
1733
+ handleGetRowId
1734
+ } = (0, _util.createHandleGetRowId)($xeTable);
1570
1735
  tableData.forEach(row => {
1571
- const rowid = (0, _util.getRowid)($xeTable, row);
1736
+ const rowid = handleGetRowId(row);
1572
1737
  const rowRest = fullAllDataRowIdData[rowid];
1573
1738
  if (rowRest) {
1574
1739
  const height = calcCellAutoHeight(rowRest, el);
@@ -1825,9 +1990,10 @@ function hideDropTip($xeTable) {
1825
1990
  * @param {Event} evnt 事件
1826
1991
  * @param {Row} row 行对象
1827
1992
  */
1828
- function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1993
+ function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
1829
1994
  const reactData = $xeTable;
1830
- if (!overflowElem) {
1995
+ const tipOverEl = overflowElem || tdEl;
1996
+ if (!tipOverEl) {
1831
1997
  return $xeTable.$nextTick();
1832
1998
  }
1833
1999
  params.cell = tdEl;
@@ -1845,9 +2011,8 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1845
2011
  } = tooltipOpts;
1846
2012
  const customContent = contentMethod ? contentMethod(params) : null;
1847
2013
  const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
1848
- const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
1849
- const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
1850
- if (content && (showAll || useCustom || isCellOverflow)) {
2014
+ const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
2015
+ if (content && (showAll || useCustom || tipOverEl.scrollWidth > tipOverEl.clientWidth)) {
1851
2016
  Object.assign(tooltipStore, {
1852
2017
  row,
1853
2018
  column,
@@ -1857,7 +2022,7 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1857
2022
  $xeTable.$nextTick(() => {
1858
2023
  const $tooltip = $xeTable.$refs.refTooltip;
1859
2024
  if ($tooltip && $tooltip.open) {
1860
- $tooltip.open(isCellOverflow ? overflowElem : tipElem || overflowElem, (0, _utils.formatText)(content));
2025
+ $tooltip.open(tipOverEl, (0, _utils.formatText)(content));
1861
2026
  }
1862
2027
  });
1863
2028
  }
@@ -2068,10 +2233,8 @@ function parseColumns($xeTable, isReset) {
2068
2233
  const props = $xeTable;
2069
2234
  const reactData = $xeTable;
2070
2235
  const internalData = $xeTable;
2071
- const {
2072
- showOverflow
2073
- } = props;
2074
- const rowOpts = $xeTable.computeRowOpts;
2236
+ // const { showOverflow } = props
2237
+ // const rowOpts = $xeTable.computeRowOpts
2075
2238
  const leftList = [];
2076
2239
  const centerList = [];
2077
2240
  const rightList = [];
@@ -2148,28 +2311,28 @@ function parseColumns($xeTable, isReset) {
2148
2311
  rightList
2149
2312
  });
2150
2313
  if (scrollXLoad) {
2151
- if (showOverflow) {
2152
- if (!rowOpts.height) {
2153
- const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false);
2154
- if (errColumn) {
2155
- (0, _log.errLog)('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
2156
- }
2157
- }
2158
- }
2159
- if (process.env.NODE_ENV === 'development') {
2160
- // if (props.showHeader && !props.showHeaderOverflow) {
2161
- // warnLog('vxe.error.reqProp', ['show-header-overflow'])
2162
- // }
2163
- // if (props.showFooter && !props.showFooterOverflow) {
2164
- // warnLog('vxe.error.reqProp', ['show-footer-overflow'])
2165
- // }
2166
- if (props.spanMethod) {
2167
- (0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
2168
- }
2169
- if (props.footerSpanMethod) {
2170
- (0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
2171
- }
2172
- }
2314
+ // if (showOverflow) {
2315
+ // if (!rowOpts.height) {
2316
+ // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
2317
+ // if (errColumn) {
2318
+ // errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
2319
+ // }
2320
+ // }
2321
+ // }
2322
+ // if (process.env.NODE_ENV === 'development') {
2323
+ // if (props.showHeader && !props.showHeaderOverflow) {
2324
+ // warnLog('vxe.error.reqProp', ['show-header-overflow'])
2325
+ // }
2326
+ // if (props.showFooter && !props.showFooterOverflow) {
2327
+ // warnLog('vxe.error.reqProp', ['show-footer-overflow'])
2328
+ // }
2329
+ if (props.spanMethod) {
2330
+ (0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
2331
+ }
2332
+ if (props.footerSpanMethod) {
2333
+ (0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
2334
+ }
2335
+ // }
2173
2336
  if (isReset) {
2174
2337
  const {
2175
2338
  visibleSize
@@ -2306,6 +2469,39 @@ function loadScrollYData($xeTable) {
2306
2469
  }
2307
2470
  }
2308
2471
  }
2472
+ const createGetRowCacheProp = prop => {
2473
+ return function (row) {
2474
+ const $xeTable = this;
2475
+ const internalData = $xeTable;
2476
+ const {
2477
+ fullAllDataRowIdData
2478
+ } = internalData;
2479
+ if (row) {
2480
+ const rowid = (0, _util.getRowid)($xeTable, row);
2481
+ const rowRest = fullAllDataRowIdData[rowid];
2482
+ if (rowRest) {
2483
+ return rowRest[prop];
2484
+ }
2485
+ }
2486
+ return -1;
2487
+ };
2488
+ };
2489
+ const createGetColumnCacheProp = prop => {
2490
+ return function (column) {
2491
+ const $xeTable = this;
2492
+ const internalData = $xeTable;
2493
+ const {
2494
+ fullColumnIdData
2495
+ } = internalData;
2496
+ if (column) {
2497
+ const colRest = fullColumnIdData[column.id];
2498
+ if (colRest) {
2499
+ return colRest[prop];
2500
+ }
2501
+ }
2502
+ return -1;
2503
+ };
2504
+ };
2309
2505
  function lazyScrollXData($xeTable) {
2310
2506
  const internalData = $xeTable;
2311
2507
  const {
@@ -2477,7 +2673,7 @@ function calcCellWidth($xeTable) {
2477
2673
  }
2478
2674
  function handleUpdateColResize($xeTable, evnt, params) {
2479
2675
  $xeTable.analyColumnWidth();
2480
- $xeTable.recalculate(true).then(() => {
2676
+ $xeTable.recalculate().then(() => {
2481
2677
  $xeTable.saveCustomStore('update:width');
2482
2678
  $xeTable.updateCellAreas();
2483
2679
  $xeTable.dispatchEvent('column-resizable-change', params, evnt);
@@ -2489,7 +2685,7 @@ function handleUpdateColResize($xeTable, evnt, params) {
2489
2685
  function handleUpdateRowResize($xeTable, evnt, params) {
2490
2686
  const reactData = $xeTable;
2491
2687
  reactData.resizeHeightFlag++;
2492
- $xeTable.recalculate(true).then(() => {
2688
+ $xeTable.recalculate().then(() => {
2493
2689
  $xeTable.updateCellAreas();
2494
2690
  $xeTable.dispatchEvent('row-resizable-change', params, evnt);
2495
2691
  setTimeout(() => $xeTable.recalculate(true), 300);
@@ -2514,21 +2710,24 @@ function updateRowOffsetTop($xeTable) {
2514
2710
  const reactData = $xeTable;
2515
2711
  const internalData = $xeTable;
2516
2712
  const {
2517
- expandColumn,
2518
- rowExpandedMaps
2713
+ expandColumn
2519
2714
  } = reactData;
2520
2715
  const {
2521
2716
  afterFullData,
2522
- fullAllDataRowIdData
2717
+ fullAllDataRowIdData,
2718
+ rowExpandedMaps
2523
2719
  } = internalData;
2524
2720
  const expandOpts = $xeTable.computeExpandOpts;
2525
2721
  const rowOpts = $xeTable.computeRowOpts;
2526
2722
  const cellOpts = $xeTable.computeCellOpts;
2527
2723
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
2724
+ const {
2725
+ handleGetRowId
2726
+ } = (0, _util.createHandleGetRowId)($xeTable);
2528
2727
  let offsetTop = 0;
2529
2728
  for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
2530
2729
  const row = afterFullData[rIndex];
2531
- const rowid = (0, _util.getRowid)($xeTable, row);
2730
+ const rowid = handleGetRowId(row);
2532
2731
  const rowRest = fullAllDataRowIdData[rowid] || {};
2533
2732
  rowRest.oTop = offsetTop;
2534
2733
  offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
@@ -2544,7 +2743,8 @@ function updateRowExpandStyle($xeTable) {
2544
2743
  const {
2545
2744
  expandColumn,
2546
2745
  scrollYLoad,
2547
- rowExpandedMaps
2746
+ scrollYTop,
2747
+ isScrollYBig
2548
2748
  } = reactData;
2549
2749
  const expandOpts = $xeTable.computeExpandOpts;
2550
2750
  const rowOpts = $xeTable.computeRowOpts;
@@ -2556,41 +2756,35 @@ function updateRowExpandStyle($xeTable) {
2556
2756
  if (expandColumn && mode === 'fixed') {
2557
2757
  const {
2558
2758
  elemStore,
2559
- afterFullData,
2560
2759
  fullAllDataRowIdData
2561
2760
  } = internalData;
2562
2761
  const rowExpandEl = $xeTable.$refs.refRowExpandElem;
2563
2762
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
2564
2763
  if (rowExpandEl && bodyScrollElem) {
2565
2764
  let isUpdateHeight = false;
2566
- if (scrollYLoad) {
2567
- let offsetTop = 0;
2568
- for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
2569
- const row = afterFullData[rIndex];
2570
- const rowid = (0, _util.getRowid)($xeTable, row);
2571
- const rowRest = fullAllDataRowIdData[rowid] || {};
2572
- rowRest.oTop = offsetTop;
2573
- offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
2574
- // 是否展开行
2575
- if (expandColumn && rowExpandedMaps[rowid]) {
2576
- offsetTop += rowRest.expandHeight || expandOpts.height || 0;
2577
- }
2578
- }
2579
- }
2580
2765
  _xeUtils.default.arrayEach(rowExpandEl.children, reEl => {
2581
2766
  const expandEl = reEl;
2582
2767
  const rowid = expandEl.getAttribute('rowid') || '';
2583
2768
  const rowRest = fullAllDataRowIdData[rowid];
2584
2769
  if (rowRest) {
2585
2770
  const expandHeight = expandEl.offsetHeight + 1;
2771
+ const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
2772
+ let offsetTop = 0;
2586
2773
  if (scrollYLoad) {
2587
- expandEl.style.top = (0, _dom.toCssUnit)(rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight));
2774
+ if (isScrollYBig && trEl) {
2775
+ offsetTop = trEl.offsetTop + trEl.offsetHeight;
2776
+ } else {
2777
+ offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
2778
+ }
2588
2779
  } else {
2589
- const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
2590
2780
  if (trEl) {
2591
- expandEl.style.top = (0, _dom.toCssUnit)(trEl.offsetTop + trEl.offsetHeight);
2781
+ offsetTop = trEl.offsetTop + trEl.offsetHeight;
2592
2782
  }
2593
2783
  }
2784
+ if (isScrollYBig) {
2785
+ offsetTop += scrollYTop;
2786
+ }
2787
+ expandEl.style.top = (0, _dom.toCssUnit)(offsetTop);
2594
2788
  if (!isUpdateHeight) {
2595
2789
  if (rowRest.expandHeight !== expandHeight) {
2596
2790
  isUpdateHeight = true;
@@ -2601,6 +2795,9 @@ function updateRowExpandStyle($xeTable) {
2601
2795
  });
2602
2796
  if (isUpdateHeight) {
2603
2797
  reactData.rowExpandHeightFlag++;
2798
+ $xeTable.$nextTick(() => {
2799
+ updateRowOffsetTop($xeTable);
2800
+ });
2604
2801
  }
2605
2802
  }
2606
2803
  }
@@ -2618,12 +2815,11 @@ function handleRowExpandScroll($xeTable) {
2618
2815
  }
2619
2816
  const Methods = {
2620
2817
  callSlot(slotFunc, params, h, vNodes) {
2818
+ const $xeTable = this;
2819
+ const $xeGrid = $xeTable.$xeGrid;
2621
2820
  if (slotFunc) {
2622
- const {
2623
- $xegrid
2624
- } = this;
2625
- if ($xegrid) {
2626
- return $xegrid.callSlot(slotFunc, params, h, vNodes);
2821
+ if ($xeGrid) {
2822
+ return $xeGrid.callSlot(slotFunc, params, h, vNodes);
2627
2823
  }
2628
2824
  if (_xeUtils.default.isFunction(slotFunc)) {
2629
2825
  return (0, _vn.getSlotVNs)(slotFunc.call(this, params, h, vNodes));
@@ -2631,28 +2827,46 @@ const Methods = {
2631
2827
  }
2632
2828
  return [];
2633
2829
  },
2830
+ getEl() {
2831
+ const $xeTable = this;
2832
+ return $xeTable.$refs.refElem;
2833
+ },
2634
2834
  /**
2635
2835
  * 获取父容器元素
2636
2836
  */
2637
2837
  getParentElem() {
2838
+ const $xeTable = this;
2839
+ const $xeGrid = $xeTable.$xeGrid;
2638
2840
  const {
2639
- $el,
2640
- $xegrid
2841
+ $el
2641
2842
  } = this;
2642
- return $xegrid ? $xegrid.$el.parentNode : $el.parentNode;
2843
+ return $xeGrid ? $xeGrid.$el.parentNode : $el.parentNode;
2643
2844
  },
2644
2845
  /**
2645
2846
  * 获取父容器的高度
2646
2847
  */
2647
2848
  getParentHeight() {
2849
+ const $xeTable = this;
2850
+ const $xeGrid = $xeTable.$xeGrid;
2851
+ const props = $xeTable;
2648
2852
  const {
2649
- $el,
2650
- $xegrid,
2651
2853
  height
2652
- } = this;
2653
- const parentElem = $el.parentNode;
2654
- const parentPaddingSize = height === '100%' || height === 'auto' ? (0, _dom.getPaddingTopBottomSize)(parentElem) : 0;
2655
- return Math.floor($xegrid ? $xegrid.getParentHeight() : _xeUtils.default.toNumber(getComputedStyle(parentElem).height) - parentPaddingSize);
2854
+ } = props;
2855
+ const el = $xeTable.$refs.refElem;
2856
+ if (el) {
2857
+ const parentElem = el.parentNode;
2858
+ const parentPaddingSize = height === '100%' || height === 'auto' ? (0, _dom.getPaddingTopBottomSize)(parentElem) : 0;
2859
+ let parentWrapperHeight = 0;
2860
+ if (parentElem) {
2861
+ if ($xeGrid && (0, _dom.hasClass)(parentElem, 'vxe-grid--table-wrapper')) {
2862
+ parentWrapperHeight = $xeGrid.getParentHeight();
2863
+ } else {
2864
+ parentWrapperHeight = parentElem.clientHeight;
2865
+ }
2866
+ }
2867
+ return Math.floor(parentWrapperHeight - parentPaddingSize);
2868
+ }
2869
+ return 0;
2656
2870
  },
2657
2871
  /**
2658
2872
  * 获取需要排除的高度
@@ -2660,10 +2874,9 @@ const Methods = {
2660
2874
  * 如果存在表尾合计滚动条,则需要排除滚动条高度
2661
2875
  */
2662
2876
  getExcludeHeight() {
2663
- const {
2664
- $xegrid
2665
- } = this;
2666
- return $xegrid ? $xegrid.getExcludeHeight() : 0;
2877
+ const $xeTable = this;
2878
+ const $xeGrid = $xeTable.$xeGrid;
2879
+ return $xeGrid ? $xeGrid.getExcludeHeight() : 0;
2667
2880
  },
2668
2881
  /**
2669
2882
  * 重置表格的一切数据状态
@@ -2762,6 +2975,9 @@ const Methods = {
2762
2975
  const childrenField = treeOpts.children || treeOpts.childrenField;
2763
2976
  let treeData = [];
2764
2977
  let fullData = datas ? datas.slice(0) : [];
2978
+ if (fullData.length > supportMaxRow) {
2979
+ (0, _log.errLog)('vxe.error.errMaxRow', [supportMaxRow]);
2980
+ }
2765
2981
  if (treeConfig) {
2766
2982
  // 树结构自动转换
2767
2983
  if (treeOpts.transform) {
@@ -3004,41 +3220,25 @@ const Methods = {
3004
3220
  const {
3005
3221
  treeConfig
3006
3222
  } = props;
3007
- const {
3008
- treeExpandedMaps
3009
- } = reactData;
3010
3223
  const {
3011
3224
  fullAllDataRowIdData,
3012
3225
  tableFullData,
3013
- tableFullTreeData
3226
+ tableFullTreeData,
3227
+ treeExpandedMaps
3014
3228
  } = internalData;
3015
3229
  const treeOpts = $xeTable.computeTreeOpts;
3016
3230
  const childrenField = treeOpts.children || treeOpts.childrenField;
3017
3231
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
3018
- const rowkey = (0, _util.getRowkey)($xeTable);
3232
+ const {
3233
+ lazy
3234
+ } = treeOpts;
3019
3235
  const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
3020
3236
  const fullDataRowIdMaps = {};
3021
- const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
3022
- const handleRow = (row, index, items, path, parentRow, nodes) => {
3023
- let rowid = (0, _util.getRowid)($xeTable, row);
3024
- const seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
3025
- const level = nodes ? nodes.length - 1 : 0;
3026
- if ((0, _utils.eqEmptyValue)(rowid)) {
3027
- rowid = (0, _util.getRowUniqueId)();
3028
- _xeUtils.default.set(row, rowkey, rowid);
3029
- }
3030
- if (treeConfig && treeOpts.lazy) {
3031
- const treeExpRest = treeExpandedMaps[rowid];
3032
- if (row[hasChildField] && _xeUtils.default.isUndefined(row[childrenField])) {
3033
- row[childrenField] = null;
3034
- }
3035
- if (treeExpRest) {
3036
- if (!row[childrenField] || !row[childrenField].length) {
3037
- delete treeTempExpandedMaps[rowid];
3038
- }
3039
- }
3040
- }
3041
- let rowRest = fullAllDataRowIdData[rowid];
3237
+ const {
3238
+ handleUpdateRowId
3239
+ } = (0, _util.createHandleUpdateRowId)($xeTable);
3240
+ const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
3241
+ let rowRest = fullAllDataRowIdMaps[rowid];
3042
3242
  if (!rowRest) {
3043
3243
  rowRest = {
3044
3244
  row,
@@ -3063,40 +3263,53 @@ const Methods = {
3063
3263
  rowRest.items = items;
3064
3264
  rowRest.parent = parentRow;
3065
3265
  rowRest.level = level;
3066
- rowRest.index = treeConfig && parentRow ? -1 : index;
3266
+ rowRest.index = currIndex;
3267
+ rowRest.treeIndex = index;
3067
3268
  fullDataRowIdMaps[rowid] = rowRest;
3068
3269
  fullAllDataRowIdMaps[rowid] = rowRest;
3069
3270
  };
3070
3271
  if (treeConfig) {
3071
- _xeUtils.default.eachTree(tableFullTreeData, handleRow, {
3272
+ _xeUtils.default.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
3273
+ const rowid = handleUpdateRowId(row);
3274
+ if (treeConfig && lazy) {
3275
+ if (row[hasChildField] && row[childrenField] === undefined) {
3276
+ row[childrenField] = null;
3277
+ }
3278
+ if (treeExpandedMaps[rowid]) {
3279
+ if (!row[childrenField] || !row[childrenField].length) {
3280
+ delete treeExpandedMaps[rowid];
3281
+ }
3282
+ }
3283
+ }
3284
+ handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, (0, _util.toTreePathSeq)(path));
3285
+ }, {
3072
3286
  children: childrenField
3073
3287
  });
3074
3288
  } else {
3075
- tableFullData.forEach(handleRow);
3289
+ tableFullData.forEach((row, index, items) => {
3290
+ handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
3291
+ });
3076
3292
  }
3077
3293
  internalData.fullDataRowIdData = fullDataRowIdMaps;
3078
3294
  internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
3079
- reactData.treeExpandedMaps = treeTempExpandedMaps;
3295
+ reactData.treeExpandedFlag++;
3080
3296
  },
3081
3297
  cacheSourceMap(fullData) {
3082
- let {
3083
- treeConfig,
3084
- treeOpts,
3085
- sourceDataRowIdData
3086
- } = this;
3298
+ const $xeTable = this;
3299
+ const props = $xeTable;
3300
+ const internalData = $xeTable;
3301
+ const {
3302
+ treeConfig
3303
+ } = props;
3304
+ const treeOpts = $xeTable.computeTreeOpts;
3087
3305
  const sourceData = _xeUtils.default.clone(fullData, true);
3088
- const rowkey = (0, _util.getRowkey)(this);
3089
- sourceDataRowIdData = this.sourceDataRowIdData = {};
3306
+ const {
3307
+ handleUpdateRowId
3308
+ } = (0, _util.createHandleUpdateRowId)($xeTable);
3309
+ const sourceRowIdData = {};
3090
3310
  const handleSourceRow = row => {
3091
- let rowid = (0, _util.getRowid)(this, row);
3092
- if ((0, _utils.eqEmptyValue)(rowid)) {
3093
- rowid = (0, _util.getRowUniqueId)();
3094
- _xeUtils.default.set(row, rowkey, rowid);
3095
- }
3096
- sourceDataRowIdData[rowid] = {
3097
- row,
3098
- rowid
3099
- };
3311
+ const rowid = handleUpdateRowId(row);
3312
+ sourceRowIdData[rowid] = row;
3100
3313
  };
3101
3314
  // 源数据缓存
3102
3315
  if (treeConfig) {
@@ -3107,7 +3320,8 @@ const Methods = {
3107
3320
  } else {
3108
3321
  sourceData.forEach(handleSourceRow);
3109
3322
  }
3110
- this.tableSourceData = sourceData;
3323
+ internalData.sourceDataRowIdData = sourceRowIdData;
3324
+ internalData.tableSourceData = sourceData;
3111
3325
  },
3112
3326
  getParams() {
3113
3327
  return this.params;
@@ -3227,53 +3441,22 @@ const Methods = {
3227
3441
  * 根据 row 获取序号
3228
3442
  * @param {Row} row 行对象
3229
3443
  */
3230
- getRowSeq(row) {
3231
- const {
3232
- fullAllDataRowIdData
3233
- } = this;
3234
- if (row) {
3235
- const rowid = (0, _util.getRowid)(this, row);
3236
- const rest = fullAllDataRowIdData[rowid];
3237
- if (rest) {
3238
- return rest.seq;
3239
- }
3240
- }
3241
- return -1;
3242
- },
3444
+ getRowSeq: createGetRowCacheProp('seq'),
3243
3445
  /**
3244
3446
  * 根据 row 获取相对于 data 中的索引
3245
3447
  * @param {Row} row 行对象
3246
3448
  */
3247
- getRowIndex(row) {
3248
- const {
3249
- fullAllDataRowIdData
3250
- } = this;
3251
- if (row) {
3252
- const rowid = (0, _util.getRowid)(this, row);
3253
- const rest = fullAllDataRowIdData[rowid];
3254
- if (rest) {
3255
- return rest.index;
3256
- }
3257
- }
3258
- return -1;
3259
- },
3449
+ getRowIndex: createGetRowCacheProp('index'),
3260
3450
  /**
3261
3451
  * 根据 row 获取相对于当前数据中的索引
3262
3452
  * @param {Row} row 行对象
3263
3453
  */
3264
- getVTRowIndex(row) {
3265
- const {
3266
- fullAllDataRowIdData
3267
- } = this;
3268
- if (row) {
3269
- const rowid = (0, _util.getRowid)(this, row);
3270
- const rest = fullAllDataRowIdData[rowid];
3271
- if (rest) {
3272
- return rest._index;
3273
- }
3274
- }
3275
- return -1;
3276
- },
3454
+ getVTRowIndex: createGetRowCacheProp('_index'),
3455
+ /**
3456
+ * 根据 row 获取渲染中的虚拟索引
3457
+ * @param {Row} row 行对象
3458
+ */
3459
+ getVMRowIndex: createGetRowCacheProp('$index'),
3277
3460
  // 在 v3 中废弃
3278
3461
  _getRowIndex(row) {
3279
3462
  if (process.env.NODE_ENV === 'development') {
@@ -3281,23 +3464,6 @@ const Methods = {
3281
3464
  }
3282
3465
  return this.getVTRowIndex(row);
3283
3466
  },
3284
- /**
3285
- * 根据 row 获取渲染中的虚拟索引
3286
- * @param {Row} row 行对象
3287
- */
3288
- getVMRowIndex(row) {
3289
- const {
3290
- fullAllDataRowIdData
3291
- } = this;
3292
- if (row) {
3293
- const rowid = (0, _util.getRowid)(this, row);
3294
- const rest = fullAllDataRowIdData[rowid];
3295
- if (rest) {
3296
- return rest.$index;
3297
- }
3298
- }
3299
- return -1;
3300
- },
3301
3467
  // 在 v3 中废弃
3302
3468
  $getRowIndex(row) {
3303
3469
  if (process.env.NODE_ENV === 'development') {
@@ -3309,34 +3475,17 @@ const Methods = {
3309
3475
  * 根据 column 获取相对于 columns 中的索引
3310
3476
  * @param {ColumnInfo} column 列配置
3311
3477
  */
3312
- getColumnIndex(column) {
3313
- const {
3314
- fullColumnIdData
3315
- } = this;
3316
- if (column) {
3317
- const rest = fullColumnIdData[column.id];
3318
- if (rest) {
3319
- return rest.index;
3320
- }
3321
- }
3322
- return -1;
3323
- },
3478
+ getColumnIndex: createGetColumnCacheProp('index'),
3324
3479
  /**
3325
3480
  * 根据 column 获取相对于当前表格列中的索引
3326
3481
  * @param {ColumnInfo} column 列配置
3327
3482
  */
3328
- getVTColumnIndex(column) {
3329
- const {
3330
- fullColumnIdData
3331
- } = this;
3332
- if (column) {
3333
- const rest = fullColumnIdData[column.id];
3334
- if (rest) {
3335
- return rest._index;
3336
- }
3337
- }
3338
- return -1;
3339
- },
3483
+ getVTColumnIndex: createGetColumnCacheProp('_index'),
3484
+ /**
3485
+ * 根据 column 获取渲染中的虚拟索引
3486
+ * @param {ColumnInfo} column 列配置
3487
+ */
3488
+ getVMColumnIndex: createGetColumnCacheProp('$index'),
3340
3489
  // 在 v3 中废弃
3341
3490
  _getColumnIndex(column) {
3342
3491
  if (process.env.NODE_ENV === 'development') {
@@ -3344,22 +3493,6 @@ const Methods = {
3344
3493
  }
3345
3494
  return this.getVTColumnIndex(column);
3346
3495
  },
3347
- /**
3348
- * 根据 column 获取渲染中的虚拟索引
3349
- * @param {ColumnInfo} column 列配置
3350
- */
3351
- getVMColumnIndex(column) {
3352
- const {
3353
- fullColumnIdData
3354
- } = this;
3355
- if (column) {
3356
- const rest = fullColumnIdData[column.id];
3357
- if (rest) {
3358
- return rest.$index;
3359
- }
3360
- }
3361
- return -1;
3362
- },
3363
3496
  // 在 v3 中废弃
3364
3497
  $getColumnIndex(column) {
3365
3498
  if (process.env.NODE_ENV === 'development') {
@@ -3468,20 +3601,28 @@ const Methods = {
3468
3601
  keepSource,
3469
3602
  treeConfig
3470
3603
  } = props;
3604
+ const {
3605
+ editStore
3606
+ } = reactData;
3471
3607
  const {
3472
3608
  fullAllDataRowIdData,
3609
+ fullDataRowIdData,
3473
3610
  tableSourceData,
3474
3611
  sourceDataRowIdData,
3475
3612
  tableFullData,
3476
3613
  afterFullData
3477
3614
  } = internalData;
3615
+ const removeTempMaps = Object.assign({}, editStore.removeMaps);
3478
3616
  const treeOpts = $xeTable.computeTreeOpts;
3479
3617
  const {
3480
3618
  transform
3481
3619
  } = treeOpts;
3620
+ const {
3621
+ handleGetRowId
3622
+ } = (0, _util.createHandleGetRowId)($xeTable);
3482
3623
  if (!keepSource) {
3483
3624
  if (process.env.NODE_ENV === 'development') {
3484
- (0, _log.warnLog)('vxe.error.reqProp', ['keep-source']);
3625
+ (0, _log.errLog)('vxe.error.reqProp', ['keep-source']);
3485
3626
  }
3486
3627
  return $xeTable.$nextTick();
3487
3628
  }
@@ -3495,22 +3636,23 @@ const Methods = {
3495
3636
  }
3496
3637
  let reDelFlag = false;
3497
3638
  if (targetRows.length) {
3498
- targetRows.forEach(row => {
3499
- if (!$xeTable.isInsertByRow(row)) {
3500
- const rowid = (0, _util.getRowid)($xeTable, row);
3501
- const oRow = sourceDataRowIdData[rowid];
3502
- if (oRow && row) {
3503
- if (field) {
3504
- _xeUtils.default.set(row, field, _xeUtils.default.clone(_xeUtils.default.get(oRow, field), true));
3505
- } else {
3506
- _xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
3507
- }
3508
- if ($xeTable.isRemoveByRow(row)) {
3509
- const rowRest = fullAllDataRowIdData[rowid];
3510
- if (rowRest) {
3511
- const reRow = rowRest.row;
3512
- tableFullData.unshift(reRow);
3513
- afterFullData.unshift(reRow);
3639
+ targetRows.forEach(item => {
3640
+ const rowid = handleGetRowId(item);
3641
+ const rowRest = fullAllDataRowIdData[rowid];
3642
+ if (rowRest) {
3643
+ const row = rowRest.row;
3644
+ if (!$xeTable.isInsertByRow(row)) {
3645
+ const oRow = sourceDataRowIdData[rowid];
3646
+ if (oRow && row) {
3647
+ if (field) {
3648
+ _xeUtils.default.set(row, field, _xeUtils.default.clone(_xeUtils.default.get(oRow, field), true));
3649
+ } else {
3650
+ _xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
3651
+ }
3652
+ if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
3653
+ delete removeTempMaps[rowid];
3654
+ tableFullData.unshift(row);
3655
+ afterFullData.unshift(row);
3514
3656
  reDelFlag = true;
3515
3657
  }
3516
3658
  }
@@ -3520,6 +3662,7 @@ const Methods = {
3520
3662
  }
3521
3663
  if (rows) {
3522
3664
  if (reDelFlag) {
3665
+ editStore.removeMaps = removeTempMaps;
3523
3666
  $xeTable.updateFooter();
3524
3667
  $xeTable.cacheRowMap(false);
3525
3668
  $xeTable.handleTableData(treeConfig && transform);
@@ -3699,25 +3842,31 @@ const Methods = {
3699
3842
  },
3700
3843
  /**
3701
3844
  * 检查行或列数据是否发生改变
3702
- * @param {Row} row 行对象
3845
+ * @param {Row} rowOrId 行对象
3703
3846
  * @param {String} field 字段名
3704
3847
  */
3705
- isUpdateByRow(row, field) {
3848
+ isUpdateByRow(rowOrId, field) {
3849
+ const $xeTable = this;
3850
+ const props = $xeTable;
3851
+ const internalData = $xeTable;
3852
+ const {
3853
+ keepSource
3854
+ } = props;
3706
3855
  const {
3707
3856
  tableFullColumn,
3708
- keepSource,
3709
- sourceDataRowIdData,
3710
- fullDataRowIdData
3711
- } = this;
3857
+ fullDataRowIdData,
3858
+ sourceDataRowIdData
3859
+ } = internalData;
3712
3860
  if (keepSource) {
3713
- const rowid = (0, _util.getRowid)(this, row);
3861
+ const rowid = _xeUtils.default.isString(rowOrId) || _xeUtils.default.isNumber(rowOrId) ? rowOrId : (0, _util.getRowid)($xeTable, rowOrId);
3862
+ const rowRest = fullDataRowIdData[rowid];
3714
3863
  // 新增的数据不需要检测
3715
- if (!fullDataRowIdData[rowid]) {
3864
+ if (!rowRest) {
3716
3865
  return false;
3717
3866
  }
3718
- const oldRest = sourceDataRowIdData[rowid];
3719
- if (oldRest) {
3720
- const oRow = oldRest.row;
3867
+ const row = rowRest.row;
3868
+ const oRow = sourceDataRowIdData[rowid];
3869
+ if (oRow) {
3721
3870
  if (arguments.length > 1) {
3722
3871
  return !eqCellValue(oRow, row, field);
3723
3872
  }
@@ -3779,6 +3928,113 @@ const Methods = {
3779
3928
  tableColumn: this.tableColumn.slice(0)
3780
3929
  };
3781
3930
  },
3931
+ /**
3932
+ * 移动列到指定列的位置
3933
+ * @param fieldOrColumn
3934
+ * @param targetFieldOrColumn
3935
+ * @param options
3936
+ */
3937
+ moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
3938
+ const $xeTable = this;
3939
+ const internalData = $xeTable;
3940
+ const {
3941
+ fullColumnIdData,
3942
+ visibleColumn
3943
+ } = internalData;
3944
+ const {
3945
+ dragToChild,
3946
+ dragPos,
3947
+ isCrossDrag
3948
+ } = Object.assign({}, options);
3949
+ const dragCol = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
3950
+ let prevDragCol = null;
3951
+ const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
3952
+ let defPos = 'left';
3953
+ if (_xeUtils.default.isNumber(targetFieldOrColumn)) {
3954
+ if (colRest && targetFieldOrColumn) {
3955
+ let currList = colRest.items;
3956
+ let offsetIndex = colRest._index + targetFieldOrColumn;
3957
+ if (isCrossDrag) {
3958
+ currList = visibleColumn;
3959
+ offsetIndex = colRest._index + targetFieldOrColumn;
3960
+ }
3961
+ if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
3962
+ prevDragCol = currList[offsetIndex];
3963
+ }
3964
+ if (targetFieldOrColumn > 0) {
3965
+ defPos = 'right';
3966
+ }
3967
+ }
3968
+ } else {
3969
+ prevDragCol = (0, _util.handleFieldOrColumn)($xeTable, targetFieldOrColumn);
3970
+ const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
3971
+ if (colRest && targetColRest) {
3972
+ if (targetColRest._index > colRest._index) {
3973
+ defPos = 'right';
3974
+ }
3975
+ }
3976
+ }
3977
+ return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
3978
+ },
3979
+ /**
3980
+ * 移动行到指定行的位置
3981
+ * @param rowidOrRow
3982
+ * @param targetRowidOrRow
3983
+ * @param options
3984
+ */
3985
+ moveRowTo(rowidOrRow, targetRowidOrRow, options) {
3986
+ const $xeTable = this;
3987
+ const props = $xeTable;
3988
+ const internalData = $xeTable;
3989
+ const {
3990
+ treeConfig
3991
+ } = props;
3992
+ const {
3993
+ fullAllDataRowIdData,
3994
+ afterFullData
3995
+ } = internalData;
3996
+ const {
3997
+ dragToChild,
3998
+ dragPos,
3999
+ isCrossDrag
4000
+ } = Object.assign({}, options);
4001
+ const treeOpts = $xeTable.computeTreeOpts;
4002
+ const dragRow = (0, _util.handleRowidOrRow)($xeTable, rowidOrRow);
4003
+ let prevDragRow = null;
4004
+ let defPos = 'top';
4005
+ const rowRest = dragRow ? fullAllDataRowIdData[(0, _util.getRowid)($xeTable, dragRow)] : null;
4006
+ if (_xeUtils.default.isNumber(targetRowidOrRow)) {
4007
+ if (rowRest && targetRowidOrRow) {
4008
+ let currList = afterFullData;
4009
+ let offsetIndex = rowRest._index + targetRowidOrRow;
4010
+ if (treeConfig) {
4011
+ currList = rowRest.items;
4012
+ if (treeOpts.transform) {
4013
+ offsetIndex = rowRest.treeIndex + targetRowidOrRow;
4014
+ if (isCrossDrag) {
4015
+ currList = afterFullData;
4016
+ offsetIndex = rowRest._index + targetRowidOrRow;
4017
+ }
4018
+ }
4019
+ }
4020
+ if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
4021
+ prevDragRow = currList[offsetIndex];
4022
+ }
4023
+ if (targetRowidOrRow > 0) {
4024
+ defPos = 'bottom';
4025
+ }
4026
+ }
4027
+ } else {
4028
+ prevDragRow = (0, _util.handleRowidOrRow)($xeTable, targetRowidOrRow);
4029
+ const targetRowRest = prevDragRow ? fullAllDataRowIdData[(0, _util.getRowid)($xeTable, prevDragRow)] : null;
4030
+ if (rowRest && targetRowRest) {
4031
+ if (targetRowRest._index > rowRest._index) {
4032
+ defPos = 'bottom';
4033
+ }
4034
+ }
4035
+ }
4036
+ return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
4037
+ },
3782
4038
  /**
3783
4039
  * 获取表格的全量列
3784
4040
  */
@@ -3801,16 +4057,23 @@ const Methods = {
3801
4057
  * 用于多选行,获取已选中的数据
3802
4058
  */
3803
4059
  getCheckboxRecords(isFull) {
4060
+ const $xeTable = this;
4061
+ const props = $xeTable;
4062
+ const internalData = $xeTable;
4063
+ const {
4064
+ treeConfig
4065
+ } = props;
3804
4066
  const {
3805
4067
  tableFullData,
3806
4068
  afterFullData,
3807
- treeConfig,
3808
- treeOpts,
3809
- checkboxOpts,
3810
- tableFullTreeData,
3811
4069
  afterTreeFullData,
3812
- afterFullRowMaps
3813
- } = this;
4070
+ tableFullTreeData,
4071
+ fullDataRowIdData,
4072
+ afterFullRowMaps,
4073
+ selectCheckboxMaps
4074
+ } = internalData;
4075
+ const treeOpts = $xeTable.computeTreeOpts;
4076
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
3814
4077
  const {
3815
4078
  transform,
3816
4079
  mapChildrenField
@@ -3819,21 +4082,18 @@ const Methods = {
3819
4082
  checkField
3820
4083
  } = checkboxOpts;
3821
4084
  const childrenField = treeOpts.children || treeOpts.childrenField;
3822
- const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
3823
4085
  let rowList = [];
3824
4086
  if (checkField) {
3825
4087
  if (treeConfig) {
4088
+ const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
3826
4089
  rowList = _xeUtils.default.filterTree(currTableData, row => _xeUtils.default.get(row, checkField), {
3827
4090
  children: transform ? mapChildrenField : childrenField
3828
4091
  });
3829
4092
  } else {
4093
+ const currTableData = isFull ? tableFullData : afterFullData;
3830
4094
  rowList = currTableData.filter(row => _xeUtils.default.get(row, checkField));
3831
4095
  }
3832
4096
  } else {
3833
- const {
3834
- selectCheckboxMaps,
3835
- fullDataRowIdData
3836
- } = this;
3837
4097
  _xeUtils.default.each(selectCheckboxMaps, (row, rowid) => {
3838
4098
  if (isFull) {
3839
4099
  if (fullDataRowIdData[rowid]) {
@@ -3875,6 +4135,7 @@ const Methods = {
3875
4135
  mapChildrenField
3876
4136
  } = treeOpts;
3877
4137
  const {
4138
+ isEvery,
3878
4139
  remote: allRemoteFilter,
3879
4140
  filterMethod: allFilterMethod
3880
4141
  } = filterOpts;
@@ -3987,7 +4248,7 @@ const Methods = {
3987
4248
  // 筛选虚拟树
3988
4249
  tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, {
3989
4250
  original: true,
3990
- isEvery: true,
4251
+ isEvery,
3991
4252
  children: mapChildrenField,
3992
4253
  mapChildren: childrenField
3993
4254
  });
@@ -4001,7 +4262,7 @@ const Methods = {
4001
4262
  // 还原虚拟树
4002
4263
  tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
4003
4264
  original: true,
4004
- isEvery: true,
4265
+ isEvery,
4005
4266
  children: mapChildrenField,
4006
4267
  mapChildren: childrenField
4007
4268
  });
@@ -4078,7 +4339,7 @@ const Methods = {
4078
4339
  // 还原虚拟树
4079
4340
  tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
4080
4341
  original: true,
4081
- isEvery: true,
4342
+ isEvery,
4082
4343
  children: treeOpts.mapChildrenField,
4083
4344
  mapChildren: childrenField
4084
4345
  });
@@ -4252,6 +4513,7 @@ const Methods = {
4252
4513
  * 默认执行一次,除非被重置
4253
4514
  */
4254
4515
  handleLoadDefaults() {
4516
+ const $xeTable = this;
4255
4517
  if (this.checkboxConfig) {
4256
4518
  this.handleDefaultSelectionChecked();
4257
4519
  }
@@ -4262,7 +4524,7 @@ const Methods = {
4262
4524
  this.handleDefaultRowExpand();
4263
4525
  }
4264
4526
  if (this.treeConfig) {
4265
- this.handleDefaultTreeExpand();
4527
+ handleDefaultTreeExpand($xeTable);
4266
4528
  }
4267
4529
  if (this.mergeCells) {
4268
4530
  this.handleDefaultMergeCells();
@@ -4460,9 +4722,9 @@ const Methods = {
4460
4722
  return this.refreshColumn(true);
4461
4723
  },
4462
4724
  handleCustomRestore(storeData) {
4463
- const $xetable = this;
4464
- const reactData = $xetable;
4465
- const internalData = $xetable;
4725
+ const $xeTable = this;
4726
+ const reactData = $xeTable;
4727
+ const internalData = $xeTable;
4466
4728
  let {
4467
4729
  collectColumn
4468
4730
  } = internalData;
@@ -4547,14 +4809,26 @@ const Methods = {
4547
4809
  }
4548
4810
  },
4549
4811
  getCustomStoreData() {
4812
+ const $xeTable = this;
4813
+ const props = $xeTable;
4814
+ const internalData = $xeTable;
4815
+ const {
4816
+ id
4817
+ } = props;
4818
+ const customOpts = $xeTable.computeCustomOpts;
4550
4819
  const {
4551
- id,
4552
- customOpts,
4553
4820
  collectColumn
4554
- } = this;
4821
+ } = internalData;
4555
4822
  const {
4823
+ storage,
4556
4824
  checkMethod
4557
4825
  } = customOpts;
4826
+ const isAllCustom = storage === true;
4827
+ const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
4828
+ const isCustomResizable = isAllCustom || storageOpts.resizable;
4829
+ const isCustomVisible = isAllCustom || storageOpts.visible;
4830
+ const isCustomFixed = isAllCustom || storageOpts.fixed;
4831
+ const isCustomSort = isAllCustom || storageOpts.sort;
4558
4832
  const resizableData = {};
4559
4833
  const sortData = {};
4560
4834
  const visibleData = {};
@@ -4571,48 +4845,38 @@ const Methods = {
4571
4845
  }
4572
4846
  let hasResizable = 0;
4573
4847
  let hasSort = 0;
4574
- let hasFixedt = 0;
4848
+ let hasFixed = 0;
4575
4849
  let hasVisible = 0;
4576
4850
  _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
4851
+ const colKey = column.getKey();
4852
+ if (!colKey) {
4853
+ (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
4854
+ return;
4855
+ }
4577
4856
  // 只支持一级
4578
4857
  if (!parentColumn) {
4579
- collectColumn.forEach(column => {
4580
- const colKey = column.getKey();
4581
- if (colKey) {
4582
- hasSort = 1;
4583
- sortData[colKey] = column.renderSortNumber;
4584
- }
4585
- });
4586
- if (column.fixed !== column.defaultFixed) {
4587
- const colKey = column.getKey();
4588
- if (colKey) {
4589
- hasFixedt = 1;
4590
- fixedData[colKey] = column.fixed;
4591
- }
4858
+ if (isCustomSort) {
4859
+ hasSort = 1;
4860
+ sortData[colKey] = column.renderSortNumber;
4592
4861
  }
4593
- }
4594
- if (column.resizeWidth) {
4595
- const colKey = column.getKey();
4596
- if (colKey) {
4597
- hasResizable = 1;
4598
- resizableData[colKey] = column.renderWidth;
4862
+ if (isCustomFixed && column.fixed !== column.defaultFixed) {
4863
+ hasFixed = 1;
4864
+ fixedData[colKey] = column.fixed;
4599
4865
  }
4600
4866
  }
4601
- if (!checkMethod || checkMethod({
4867
+ if (isCustomResizable && column.resizeWidth) {
4868
+ hasResizable = 1;
4869
+ resizableData[colKey] = column.renderWidth;
4870
+ }
4871
+ if (isCustomVisible && (!checkMethod || checkMethod({
4602
4872
  column
4603
- })) {
4873
+ }))) {
4604
4874
  if (!column.visible && column.defaultVisible) {
4605
- const colKey = column.getKey();
4606
- if (colKey) {
4607
- hasVisible = 1;
4608
- visibleData[colKey] = false;
4609
- }
4875
+ hasVisible = 1;
4876
+ visibleData[colKey] = false;
4610
4877
  } else if (column.visible && !column.defaultVisible) {
4611
- const colKey = column.getKey();
4612
- if (colKey) {
4613
- hasVisible = 1;
4614
- visibleData[colKey] = true;
4615
- }
4878
+ hasVisible = 1;
4879
+ visibleData[colKey] = true;
4616
4880
  }
4617
4881
  }
4618
4882
  });
@@ -4622,7 +4886,7 @@ const Methods = {
4622
4886
  if (hasSort) {
4623
4887
  storeData.sortData = sortData;
4624
4888
  }
4625
- if (hasFixedt) {
4889
+ if (hasFixed) {
4626
4890
  storeData.fixedData = fixedData;
4627
4891
  }
4628
4892
  if (hasVisible) {
@@ -5170,12 +5434,15 @@ const Methods = {
5170
5434
  fullAllDataRowIdData,
5171
5435
  afterFullData
5172
5436
  } = internalData;
5437
+ const {
5438
+ handleGetRowId
5439
+ } = (0, _util.createHandleGetRowId)($xeTable);
5173
5440
  const rowOpts = $xeTable.computeRowOpts;
5174
5441
  const cellOpts = $xeTable.computeCellOpts;
5175
5442
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
5176
5443
  const rest = {};
5177
5444
  afterFullData.forEach(row => {
5178
- const rowid = (0, _util.getRowid)($xeTable, row);
5445
+ const rowid = handleGetRowId(row);
5179
5446
  const rowRest = fullAllDataRowIdData[rowid];
5180
5447
  if (rowRest) {
5181
5448
  const resizeHeight = rowRest.resizeHeight;
@@ -5204,8 +5471,11 @@ const Methods = {
5204
5471
  rHeight = Math.floor(rHeight * bodyHeight);
5205
5472
  }
5206
5473
  if (rHeight) {
5474
+ const {
5475
+ handleGetRowId
5476
+ } = (0, _util.createHandleGetRowId)($xeTable);
5207
5477
  rows.forEach(row => {
5208
- const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (0, _util.getRowid)($xeTable, row);
5478
+ const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : handleGetRowId(row);
5209
5479
  const rowRest = fullAllDataRowIdData[rowid];
5210
5480
  if (rowRest) {
5211
5481
  rowRest.resizeHeight = rHeight;
@@ -5353,6 +5623,8 @@ const Methods = {
5353
5623
  }
5354
5624
  },
5355
5625
  preventEvent(evnt, type, args, next, end) {
5626
+ const $xeTable = this;
5627
+ const $xeGrid = $xeTable.$xeGrid;
5356
5628
  let evntList = interceptor.get(type);
5357
5629
  // 兼容老版本
5358
5630
  if (!evntList.length && type === 'event.clearEdit') {
@@ -5364,12 +5636,25 @@ const Methods = {
5364
5636
  }
5365
5637
  }
5366
5638
  // 兼容老版本
5367
- let rest;
5368
- if (!evntList.some(func => func(Object.assign({
5369
- $grid: this.$xegrid,
5370
- $table: this,
5371
- $event: evnt
5372
- }, args)) === false)) {
5639
+ let rest = null;
5640
+ let isStop = false;
5641
+ for (let i = 0; i < evntList.length; i++) {
5642
+ const func = evntList[i];
5643
+ const fnRest = func(Object.assign({
5644
+ $grid: $xeGrid,
5645
+ $table: $xeTable,
5646
+ $event: evnt
5647
+ }, args));
5648
+ if (fnRest === false) {
5649
+ isStop = true;
5650
+ break;
5651
+ } else if (fnRest && fnRest.status === false) {
5652
+ rest = fnRest.result;
5653
+ isStop = true;
5654
+ break;
5655
+ }
5656
+ }
5657
+ if (!isStop) {
5373
5658
  if (next) {
5374
5659
  rest = next();
5375
5660
  }
@@ -5383,10 +5668,11 @@ const Methods = {
5383
5668
  * 全局按下事件处理
5384
5669
  */
5385
5670
  handleGlobalMousedownEvent(evnt) {
5671
+ const $xeTable = this;
5672
+ const $xeGrid = $xeTable.$xeGrid;
5386
5673
  const {
5387
5674
  $el,
5388
5675
  $refs,
5389
- $xegrid,
5390
5676
  $toolbar,
5391
5677
  mouseConfig,
5392
5678
  editStore,
@@ -5486,7 +5772,7 @@ const Methods = {
5486
5772
  }
5487
5773
  }
5488
5774
  } else if (mouseConfig) {
5489
- if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($xegrid && (0, _dom.getEventTargetNode)(evnt, $xegrid.$el).flag) && !(tableMenu && (0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) && !($toolbar && (0, _dom.getEventTargetNode)(evnt, $toolbar.$el).flag)) {
5775
+ if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($xeGrid && (0, _dom.getEventTargetNode)(evnt, $xeGrid.$el).flag) && !(tableMenu && (0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) && !($toolbar && (0, _dom.getEventTargetNode)(evnt, $toolbar.$el).flag)) {
5490
5776
  if (this.clearSelected) {
5491
5777
  this.clearSelected();
5492
5778
  }
@@ -5510,7 +5796,7 @@ const Methods = {
5510
5796
  if (ctxMenuStore.visible && tableMenu && !(0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) {
5511
5797
  this.closeMenu();
5512
5798
  }
5513
- const isActivated = (0, _dom.getEventTargetNode)(evnt, ($xegrid || this).$el).flag;
5799
+ const isActivated = (0, _dom.getEventTargetNode)(evnt, ($xeGrid || this).$el).flag;
5514
5800
  // 如果存在校验,点击了表格之外则清除
5515
5801
  if (!isActivated && editRules && validOpts.autoClear) {
5516
5802
  this.validErrorMaps = {};
@@ -5585,6 +5871,7 @@ const Methods = {
5585
5871
  handleGlobalKeydownEvent(evnt) {
5586
5872
  const $xeTable = this;
5587
5873
  const internalData = $xeTable;
5874
+ const $xeGrid = $xeTable.$xeGrid;
5588
5875
  // 该行为只对当前激活的表格有效
5589
5876
  if (this.isActivated) {
5590
5877
  this.preventEvent(evnt, 'event.keydown', null, () => {
@@ -5702,7 +5989,7 @@ const Methods = {
5702
5989
  if (keyboardOpts.enterToTab) {
5703
5990
  this.moveTabSelected(activeParams, hasShiftKey, evnt);
5704
5991
  } else {
5705
- this.moveSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
5992
+ this.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
5706
5993
  }
5707
5994
  } else {
5708
5995
  if (keyboardOpts.enterToTab) {
@@ -5738,7 +6025,7 @@ const Methods = {
5738
6025
  return;
5739
6026
  }
5740
6027
  }
5741
- this.moveSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
6028
+ this.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
5742
6029
  if (enterMethod) {
5743
6030
  enterMethod(etrParams);
5744
6031
  }
@@ -5763,10 +6050,7 @@ const Methods = {
5763
6050
  if (!isEditStatus) {
5764
6051
  // 如果按下了方向键
5765
6052
  if (selected.row && selected.column) {
5766
- this.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
5767
- } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
5768
- // 当前行按键上下移动
5769
- this.moveCurrentRow(isUpArrow, isDwArrow, evnt);
6053
+ $xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
5770
6054
  }
5771
6055
  }
5772
6056
  } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
@@ -5788,7 +6072,7 @@ const Methods = {
5788
6072
  column: selected.column,
5789
6073
  columnIndex: this.getColumnIndex(selected.column),
5790
6074
  $table: this,
5791
- $grid: this.$xegrid
6075
+ $grid: $xeGrid
5792
6076
  };
5793
6077
  // 是否被禁用
5794
6078
  if (!beforeEditMethod || beforeEditMethod(params)) {
@@ -5816,7 +6100,7 @@ const Methods = {
5816
6100
  column: selected.column,
5817
6101
  columnIndex: this.getColumnIndex(selected.column),
5818
6102
  $table: this,
5819
- $grid: this.$xegrid
6103
+ $grid: $xeGrid
5820
6104
  };
5821
6105
  // 是否被禁用
5822
6106
  if (!beforeEditMethod || beforeEditMethod(params)) {
@@ -5847,7 +6131,7 @@ const Methods = {
5847
6131
  rowIndex: this.getRowIndex(parentRow),
5848
6132
  $rowIndex: this.getVMRowIndex(parentRow),
5849
6133
  $table: this,
5850
- $grid: this.$xegrid
6134
+ $grid: $xeGrid
5851
6135
  };
5852
6136
  this.setTreeExpand(parentRow, false).then(() => this.scrollToRow(parentRow)).then(() => this.triggerCurrentRowEvent(evnt, params));
5853
6137
  }
@@ -5868,7 +6152,7 @@ const Methods = {
5868
6152
  column: selected.column,
5869
6153
  columnIndex: this.getColumnIndex(selected.column),
5870
6154
  $table: this,
5871
- $grid: this.$xegrid
6155
+ $grid: $xeGrid
5872
6156
  };
5873
6157
  if (!beforeEditMethod || beforeEditMethod(params)) {
5874
6158
  if (editMethod) {
@@ -6025,7 +6309,7 @@ const Methods = {
6025
6309
  return;
6026
6310
  }
6027
6311
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6028
- handleTooltip($xeTable, evnt, thEl, cellEl, null, params);
6312
+ handleTooltip($xeTable, evnt, thEl, thEl.querySelector('.vxe-cell--title') || cellEl, params);
6029
6313
  }
6030
6314
  },
6031
6315
  /**
@@ -6066,7 +6350,7 @@ const Methods = {
6066
6350
  }
6067
6351
  }
6068
6352
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
6069
- handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
6353
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6070
6354
  }
6071
6355
  },
6072
6356
  /**
@@ -6081,10 +6365,10 @@ const Methods = {
6081
6365
  const {
6082
6366
  tooltipStore
6083
6367
  } = reactData;
6084
- const cell = evnt.currentTarget;
6368
+ const tdEl = evnt.currentTarget;
6085
6369
  handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
6086
6370
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6087
- handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
6371
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
6088
6372
  }
6089
6373
  },
6090
6374
  openTooltip(target, content) {
@@ -6145,15 +6429,20 @@ const Methods = {
6145
6429
  * 获取复选框半选状态的行数据
6146
6430
  */
6147
6431
  getCheckboxIndeterminateRecords(isFull) {
6432
+ const $xeTable = this;
6433
+ const props = $xeTable;
6434
+ const internalData = $xeTable;
6148
6435
  const {
6149
- treeConfig,
6150
- treeIndeterminateMaps,
6151
- fullDataRowIdData
6152
- } = this;
6436
+ treeConfig
6437
+ } = props;
6438
+ const {
6439
+ fullDataRowIdData,
6440
+ treeIndeterminateRowMaps
6441
+ } = internalData;
6153
6442
  if (treeConfig) {
6154
6443
  const fullRest = [];
6155
6444
  const defRest = [];
6156
- _xeUtils.default.each(treeIndeterminateMaps, (item, rowid) => {
6445
+ _xeUtils.default.each(treeIndeterminateRowMaps, (item, rowid) => {
6157
6446
  if (item) {
6158
6447
  fullRest.push(item);
6159
6448
  if (fullDataRowIdData[rowid]) {
@@ -6230,9 +6519,13 @@ const Methods = {
6230
6519
  isCheckedByCheckboxRow(row) {
6231
6520
  const $xeTable = this;
6232
6521
  const reactData = $xeTable;
6522
+ const internalData = $xeTable;
6233
6523
  const {
6234
- selectCheckboxMaps
6524
+ updateCheckboxFlag
6235
6525
  } = reactData;
6526
+ const {
6527
+ selectCheckboxMaps
6528
+ } = internalData;
6236
6529
  const checkboxOpts = $xeTable.computeCheckboxOpts;
6237
6530
  const {
6238
6531
  checkField
@@ -6240,17 +6533,18 @@ const Methods = {
6240
6533
  if (checkField) {
6241
6534
  return _xeUtils.default.get(row, checkField);
6242
6535
  }
6243
- return !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
6536
+ return !!updateCheckboxFlag && !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
6244
6537
  },
6245
6538
  isCheckedByCheckboxRowKey(rowid) {
6246
6539
  const $xeTable = this;
6247
6540
  const reactData = $xeTable;
6248
6541
  const internalData = $xeTable;
6249
6542
  const {
6250
- selectCheckboxMaps
6543
+ updateCheckboxFlag
6251
6544
  } = reactData;
6252
6545
  const {
6253
- fullAllDataRowIdData
6546
+ fullAllDataRowIdData,
6547
+ selectCheckboxMaps
6254
6548
  } = internalData;
6255
6549
  const checkboxOpts = $xeTable.computeCheckboxOpts;
6256
6550
  const {
@@ -6263,23 +6557,23 @@ const Methods = {
6263
6557
  }
6264
6558
  return false;
6265
6559
  }
6266
- return !!selectCheckboxMaps[rowid];
6560
+ return !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
6267
6561
  },
6268
6562
  isIndeterminateByCheckboxRow(row) {
6269
6563
  const $xeTable = this;
6270
- const reactData = $xeTable;
6564
+ const internalData = $xeTable;
6271
6565
  const {
6272
- treeIndeterminateMaps
6273
- } = reactData;
6274
- return !!treeIndeterminateMaps[(0, _util.getRowid)($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
6566
+ treeIndeterminateRowMaps
6567
+ } = internalData;
6568
+ return !!treeIndeterminateRowMaps[(0, _util.getRowid)($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
6275
6569
  },
6276
6570
  isIndeterminateByCheckboxRowKey(rowid) {
6277
6571
  const $xeTable = this;
6278
- const reactData = $xeTable;
6572
+ const internalData = $xeTable;
6279
6573
  const {
6280
- treeIndeterminateMaps
6281
- } = reactData;
6282
- return !!treeIndeterminateMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
6574
+ treeIndeterminateRowMaps
6575
+ } = internalData;
6576
+ return !!treeIndeterminateRowMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
6283
6577
  },
6284
6578
  /**
6285
6579
  * 切换选中
@@ -6289,13 +6583,13 @@ const Methods = {
6289
6583
  const $xeTable = this;
6290
6584
  const props = $xeTable;
6291
6585
  const reactData = $xeTable;
6586
+ const internalData = $xeTable;
6292
6587
  const {
6293
6588
  treeConfig
6294
6589
  } = props;
6295
6590
  const {
6296
6591
  selectCheckboxMaps
6297
- } = reactData;
6298
- const selectRowMaps = Object.assign({}, selectCheckboxMaps);
6592
+ } = internalData;
6299
6593
  const treeOpts = $xeTable.computeTreeOpts;
6300
6594
  const {
6301
6595
  transform,
@@ -6308,6 +6602,10 @@ const Methods = {
6308
6602
  checkStrictly,
6309
6603
  checkMethod
6310
6604
  } = checkboxOpts;
6605
+ const {
6606
+ handleGetRowId
6607
+ } = (0, _util.createHandleGetRowId)($xeTable);
6608
+ // indeterminateField 仅支持读取
6311
6609
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
6312
6610
  if (checkField) {
6313
6611
  // 树结构
@@ -6326,35 +6624,34 @@ const Methods = {
6326
6624
  }, {
6327
6625
  children: transform ? mapChildrenField : childrenField
6328
6626
  });
6329
- reactData.selectCheckboxMaps = selectRowMaps;
6627
+ reactData.updateCheckboxFlag++;
6330
6628
  return;
6331
- } else {
6332
- // 列表
6333
- rows.forEach(row => {
6334
- if (isForce || !checkMethod || checkMethod({
6335
- row
6336
- })) {
6337
- _xeUtils.default.set(row, checkField, checked);
6338
- handleCheckboxReserveRow($xeTable, row, checked);
6339
- }
6340
- });
6341
6629
  }
6342
- reactData.selectCheckboxMaps = selectRowMaps;
6630
+ // 列表
6631
+ rows.forEach(row => {
6632
+ if (isForce || !checkMethod || checkMethod({
6633
+ row
6634
+ })) {
6635
+ _xeUtils.default.set(row, checkField, checked);
6636
+ handleCheckboxReserveRow($xeTable, row, checked);
6637
+ }
6638
+ });
6639
+ reactData.updateCheckboxFlag++;
6343
6640
  return;
6344
6641
  }
6345
6642
  // 树结构
6346
6643
  if (treeConfig && !checkStrictly) {
6347
6644
  // 更新子节点状态
6348
6645
  _xeUtils.default.eachTree(rows, row => {
6349
- const rowid = (0, _util.getRowid)($xeTable, row);
6646
+ const rowid = handleGetRowId(row);
6350
6647
  if (isForce || !checkMethod || checkMethod({
6351
6648
  row
6352
6649
  })) {
6353
6650
  if (checked) {
6354
- selectRowMaps[rowid] = row;
6651
+ selectCheckboxMaps[rowid] = row;
6355
6652
  } else {
6356
- if (selectRowMaps[rowid]) {
6357
- delete selectRowMaps[rowid];
6653
+ if (selectCheckboxMaps[rowid]) {
6654
+ delete selectCheckboxMaps[rowid];
6358
6655
  }
6359
6656
  }
6360
6657
  handleCheckboxReserveRow($xeTable, row, checked);
@@ -6362,28 +6659,28 @@ const Methods = {
6362
6659
  }, {
6363
6660
  children: transform ? mapChildrenField : childrenField
6364
6661
  });
6365
- reactData.selectCheckboxMaps = selectRowMaps;
6662
+ reactData.updateCheckboxFlag++;
6366
6663
  return;
6367
6664
  }
6368
6665
  // 列表
6369
6666
  rows.forEach(row => {
6370
- const rowid = (0, _util.getRowid)($xeTable, row);
6667
+ const rowid = handleGetRowId(row);
6371
6668
  if (isForce || !checkMethod || checkMethod({
6372
6669
  row
6373
6670
  })) {
6374
6671
  if (checked) {
6375
- if (!selectRowMaps[rowid]) {
6376
- selectRowMaps[rowid] = row;
6672
+ if (!selectCheckboxMaps[rowid]) {
6673
+ selectCheckboxMaps[rowid] = row;
6377
6674
  }
6378
6675
  } else {
6379
- if (selectRowMaps[rowid]) {
6380
- delete selectRowMaps[rowid];
6676
+ if (selectCheckboxMaps[rowid]) {
6677
+ delete selectCheckboxMaps[rowid];
6381
6678
  }
6382
6679
  }
6383
6680
  handleCheckboxReserveRow($xeTable, row, checked);
6681
+ reactData.updateCheckboxFlag++;
6384
6682
  }
6385
6683
  });
6386
- reactData.selectCheckboxMaps = selectRowMaps;
6387
6684
  },
6388
6685
  /**
6389
6686
  * 即将移除
@@ -6396,10 +6693,12 @@ const Methods = {
6396
6693
  $xeTable.handleBatchSelectRows([row], checked, isForce);
6397
6694
  },
6398
6695
  handleToggleCheckRowEvent(evnt, params) {
6696
+ const $xeTable = this;
6697
+ const internalData = $xeTable;
6399
6698
  const {
6400
- selectCheckboxMaps,
6401
- checkboxOpts
6402
- } = this;
6699
+ selectCheckboxMaps
6700
+ } = internalData;
6701
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
6403
6702
  const {
6404
6703
  checkField,
6405
6704
  trigger
@@ -6414,43 +6713,47 @@ const Methods = {
6414
6713
  if (checkField) {
6415
6714
  checked = !_xeUtils.default.get(row, checkField);
6416
6715
  } else {
6417
- checked = !selectCheckboxMaps[(0, _util.getRowid)(this, row)];
6716
+ checked = !selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
6418
6717
  }
6419
6718
  if (evnt) {
6420
- this.triggerCheckRowEvent(evnt, params, checked);
6719
+ $xeTable.triggerCheckRowEvent(evnt, params, checked);
6421
6720
  } else {
6422
- this.handleSelectRow(params, checked);
6423
- this.checkSelectionStatus();
6721
+ $xeTable.handleBatchSelectRows([row], checked);
6722
+ $xeTable.checkSelectionStatus();
6424
6723
  }
6425
6724
  },
6426
6725
  triggerCheckRowEvent(evnt, params, checked) {
6427
6726
  const $xeTable = this;
6727
+ const props = $xeTable;
6728
+ const internalData = $xeTable;
6729
+ const {
6730
+ row
6731
+ } = params;
6428
6732
  const {
6429
- checkboxOpts,
6430
6733
  afterFullData
6431
- } = this;
6734
+ } = internalData;
6735
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
6432
6736
  const {
6433
6737
  checkMethod,
6434
6738
  trigger
6435
6739
  } = checkboxOpts;
6436
- const {
6437
- row
6438
- } = params;
6439
6740
  if (trigger === 'manual') {
6440
6741
  return;
6441
6742
  }
6442
6743
  evnt.stopPropagation();
6443
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !this.treeConfig) {
6444
- const checkboxRecords = this.getCheckboxRecords();
6744
+ if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
6745
+ const checkboxRecords = $xeTable.getCheckboxRecords();
6445
6746
  if (checkboxRecords.length) {
6446
6747
  const firstRow = checkboxRecords[0];
6447
- const _rowIndex = this.getVTRowIndex(row);
6448
- const _firstRowIndex = this.getVTRowIndex(firstRow);
6748
+ const _rowIndex = $xeTable.getVTRowIndex(row);
6749
+ const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
6449
6750
  if (_rowIndex !== _firstRowIndex) {
6450
- this.setAllCheckboxRow(false);
6751
+ $xeTable.setAllCheckboxRow(false);
6451
6752
  const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
6452
- handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
6453
- this.emitEvent('checkbox-range-select', Object.assign({
6753
+ $xeTable.$nextTick(() => {
6754
+ handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
6755
+ });
6756
+ $xeTable.dispatchEvent('checkbox-range-select', Object.assign({
6454
6757
  rangeRecords: rangeRows
6455
6758
  }, params), evnt);
6456
6759
  return;
@@ -6460,12 +6763,12 @@ const Methods = {
6460
6763
  if (!checkMethod || checkMethod({
6461
6764
  row
6462
6765
  })) {
6463
- this.handleSelectRow(params, checked);
6464
- this.checkSelectionStatus();
6465
- this.emitEvent('checkbox-change', Object.assign({
6466
- records: this.getCheckboxRecords(),
6467
- reserves: this.getCheckboxReserveRecords(),
6468
- indeterminates: this.getCheckboxIndeterminateRecords(),
6766
+ $xeTable.handleBatchSelectRows([row], checked);
6767
+ $xeTable.checkSelectionStatus();
6768
+ $xeTable.dispatchEvent('checkbox-change', Object.assign({
6769
+ records: () => $xeTable.getCheckboxRecords(),
6770
+ reserves: () => $xeTable.getCheckboxReserveRecords(),
6771
+ indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
6469
6772
  checked
6470
6773
  }, params), evnt);
6471
6774
  }
@@ -6475,10 +6778,11 @@ const Methods = {
6475
6778
  */
6476
6779
  toggleCheckboxRow(row) {
6477
6780
  const $xeTable = this;
6781
+ const internalData = $xeTable;
6478
6782
  const {
6479
- selectCheckboxMaps,
6480
- checkboxOpts
6481
- } = this;
6783
+ selectCheckboxMaps
6784
+ } = internalData;
6785
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
6482
6786
  const {
6483
6787
  checkField
6484
6788
  } = checkboxOpts;
@@ -6505,10 +6809,8 @@ const Methods = {
6505
6809
  } = props;
6506
6810
  const {
6507
6811
  selectCheckboxMaps,
6508
- treeIndeterminateMaps
6509
- } = reactData;
6510
- const selectRowMaps = Object.assign({}, selectCheckboxMaps);
6511
- const halfRowMaps = Object.assign({}, treeIndeterminateMaps);
6812
+ treeIndeterminateRowMaps
6813
+ } = internalData;
6512
6814
  const treeOpts = $xeTable.computeTreeOpts;
6513
6815
  const {
6514
6816
  transform,
@@ -6529,10 +6831,13 @@ const Methods = {
6529
6831
  }
6530
6832
  // 树结构
6531
6833
  if (treeConfig) {
6834
+ const {
6835
+ handleGetRowId
6836
+ } = (0, _util.createHandleGetRowId)($xeTable);
6532
6837
  const childRowMaps = {};
6533
6838
  const childRowList = [];
6534
6839
  _xeUtils.default.eachTree(afterTreeFullData, row => {
6535
- const rowid = (0, _util.getRowid)($xeTable, row);
6840
+ const rowid = handleGetRowId(row);
6536
6841
  const childList = row[transform ? mapChildrenField : childrenField];
6537
6842
  if (childList && childList.length && !childRowMaps[rowid]) {
6538
6843
  childRowMaps[rowid] = 1;
@@ -6549,30 +6854,30 @@ const Methods = {
6549
6854
  let hLen = 0; // 半选
6550
6855
  let vLen = 0; // 有效行
6551
6856
  childList.forEach(checkMethod ? item => {
6552
- const childRowid = (0, _util.getRowid)($xeTable, item);
6553
- const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectRowMaps[childRowid];
6857
+ const childRowid = handleGetRowId(item);
6858
+ const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
6554
6859
  if (checkMethod({
6555
6860
  row: item
6556
6861
  })) {
6557
6862
  if (isSelect) {
6558
6863
  sLen++;
6559
- } else if (halfRowMaps[childRowid]) {
6864
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6560
6865
  hLen++;
6561
6866
  }
6562
6867
  vLen++;
6563
6868
  } else {
6564
6869
  if (isSelect) {
6565
6870
  sLen++;
6566
- } else if (halfRowMaps[childRowid]) {
6871
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6567
6872
  hLen++;
6568
6873
  }
6569
6874
  }
6570
6875
  } : item => {
6571
- const childRowid = (0, _util.getRowid)($xeTable, item);
6572
- const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectRowMaps[childRowid];
6876
+ const childRowid = handleGetRowId(item);
6877
+ const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
6573
6878
  if (isSelect) {
6574
6879
  sLen++;
6575
- } else if (halfRowMaps[childRowid]) {
6880
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6576
6881
  hLen++;
6577
6882
  }
6578
6883
  vLen++;
@@ -6584,29 +6889,28 @@ const Methods = {
6584
6889
  }
6585
6890
  if (isSelected) {
6586
6891
  if (!checkField) {
6587
- selectRowMaps[rowid] = row;
6892
+ selectCheckboxMaps[rowid] = row;
6588
6893
  }
6589
- if (halfRowMaps[rowid]) {
6590
- delete halfRowMaps[rowid];
6894
+ if (treeIndeterminateRowMaps[rowid]) {
6895
+ delete treeIndeterminateRowMaps[rowid];
6591
6896
  }
6592
6897
  } else {
6593
6898
  if (!checkField) {
6594
- if (selectRowMaps[rowid]) {
6595
- delete selectRowMaps[rowid];
6899
+ if (selectCheckboxMaps[rowid]) {
6900
+ delete selectCheckboxMaps[rowid];
6596
6901
  }
6597
6902
  }
6598
6903
  if (halfSelect) {
6599
- halfRowMaps[rowid] = row;
6904
+ treeIndeterminateRowMaps[rowid] = row;
6600
6905
  } else {
6601
- if (halfRowMaps[rowid]) {
6602
- delete halfRowMaps[rowid];
6906
+ if (treeIndeterminateRowMaps[rowid]) {
6907
+ delete treeIndeterminateRowMaps[rowid];
6603
6908
  }
6604
6909
  }
6605
6910
  }
6606
6911
  });
6607
6912
  }
6608
- reactData.selectCheckboxMaps = selectRowMaps;
6609
- reactData.treeIndeterminateMaps = halfRowMaps;
6913
+ reactData.updateCheckboxFlag++;
6610
6914
  },
6611
6915
  updateAllCheckboxStatus() {
6612
6916
  const $xeTable = this;
@@ -6617,9 +6921,12 @@ const Methods = {
6617
6921
  treeConfig
6618
6922
  } = props;
6619
6923
  const {
6924
+ afterFullData,
6925
+ afterTreeFullData,
6926
+ checkboxReserveRowMap,
6620
6927
  selectCheckboxMaps,
6621
- treeIndeterminateMaps
6622
- } = reactData;
6928
+ treeIndeterminateRowMaps
6929
+ } = internalData;
6623
6930
  const checkboxOpts = $xeTable.computeCheckboxOpts;
6624
6931
  const {
6625
6932
  checkField,
@@ -6627,39 +6934,37 @@ const Methods = {
6627
6934
  showReserveStatus
6628
6935
  } = checkboxOpts;
6629
6936
  const {
6630
- afterFullData,
6631
- afterTreeFullData,
6632
- checkboxReserveRowMap
6633
- } = internalData;
6937
+ handleGetRowId
6938
+ } = (0, _util.createHandleGetRowId)($xeTable);
6634
6939
  let sLen = 0; // 已选
6635
6940
  let hLen = 0; // 半选
6636
6941
  let vLen = 0; // 有效行
6637
6942
  const rootList = treeConfig ? afterTreeFullData : afterFullData;
6638
6943
  rootList.forEach(checkMethod ? row => {
6639
- const childRowid = (0, _util.getRowid)($xeTable, row);
6944
+ const childRowid = handleGetRowId(row);
6640
6945
  const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
6641
6946
  if (checkMethod({
6642
6947
  row
6643
6948
  })) {
6644
6949
  if (selected) {
6645
6950
  sLen++;
6646
- } else if (treeIndeterminateMaps[childRowid]) {
6951
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6647
6952
  hLen++;
6648
6953
  }
6649
6954
  vLen++;
6650
6955
  } else {
6651
6956
  if (selected) {
6652
6957
  sLen++;
6653
- } else if (treeIndeterminateMaps[childRowid]) {
6958
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6654
6959
  hLen++;
6655
6960
  }
6656
6961
  }
6657
6962
  } : row => {
6658
- const childRowid = (0, _util.getRowid)($xeTable, row);
6963
+ const childRowid = handleGetRowId(row);
6659
6964
  const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
6660
6965
  if (selected) {
6661
6966
  sLen++;
6662
- } else if (treeIndeterminateMaps[childRowid]) {
6967
+ } else if (treeIndeterminateRowMaps[childRowid]) {
6663
6968
  hLen++;
6664
6969
  }
6665
6970
  vLen++;
@@ -6723,27 +7028,35 @@ const Methods = {
6723
7028
  * 获取复选框保留选中的行
6724
7029
  */
6725
7030
  getCheckboxReserveRecords(isFull) {
7031
+ const $xeTable = this;
7032
+ const props = $xeTable;
7033
+ const internalData = $xeTable;
7034
+ const {
7035
+ treeConfig
7036
+ } = props;
6726
7037
  const {
6727
- fullDataRowIdData,
6728
7038
  afterFullData,
6729
- checkboxReserveRowMap,
6730
- checkboxOpts,
6731
- treeConfig,
6732
- treeOpts
6733
- } = this;
7039
+ fullDataRowIdData,
7040
+ checkboxReserveRowMap
7041
+ } = internalData;
7042
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
7043
+ const treeOpts = $xeTable.computeTreeOpts;
6734
7044
  const childrenField = treeOpts.children || treeOpts.childrenField;
6735
7045
  const reserveSelection = [];
6736
7046
  if (checkboxOpts.reserve) {
7047
+ const {
7048
+ handleGetRowId
7049
+ } = (0, _util.createHandleGetRowId)($xeTable);
6737
7050
  const afterFullIdMaps = {};
6738
7051
  if (treeConfig) {
6739
7052
  _xeUtils.default.eachTree(afterFullData, row => {
6740
- afterFullIdMaps[(0, _util.getRowid)(this, row)] = 1;
7053
+ afterFullIdMaps[handleGetRowId(row)] = 1;
6741
7054
  }, {
6742
7055
  children: childrenField
6743
7056
  });
6744
7057
  } else {
6745
7058
  afterFullData.forEach(row => {
6746
- afterFullIdMaps[(0, _util.getRowid)(this, row)] = 1;
7059
+ afterFullIdMaps[handleGetRowId(row)] = 1;
6747
7060
  });
6748
7061
  }
6749
7062
  _xeUtils.default.each(checkboxReserveRowMap, (oldRow, oldRowid) => {
@@ -6785,9 +7098,9 @@ const Methods = {
6785
7098
  handleCheckedAllCheckboxRow($xeTable, value);
6786
7099
  if (evnt) {
6787
7100
  $xeTable.dispatchEvent('checkbox-all', {
6788
- records: $xeTable.getCheckboxRecords(),
6789
- reserves: $xeTable.getCheckboxReserveRecords(),
6790
- indeterminates: $xeTable.getCheckboxIndeterminateRecords(),
7101
+ records: () => $xeTable.getCheckboxRecords(),
7102
+ reserves: () => $xeTable.getCheckboxReserveRecords(),
7103
+ indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
6791
7104
  checked: value
6792
7105
  }, evnt);
6793
7106
  }
@@ -6823,17 +7136,24 @@ const Methods = {
6823
7136
  * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
6824
7137
  */
6825
7138
  clearCheckboxRow() {
7139
+ const $xeTable = this;
7140
+ const props = $xeTable;
7141
+ const reactData = $xeTable;
7142
+ const internalData = $xeTable;
6826
7143
  const {
6827
- tableFullData,
6828
- treeConfig,
6829
- treeOpts,
6830
- checkboxOpts
6831
- } = this;
7144
+ treeConfig
7145
+ } = props;
7146
+ const {
7147
+ tableFullData
7148
+ } = internalData;
7149
+ const treeOpts = $xeTable.computeTreeOpts;
7150
+ const childrenField = treeOpts.children || treeOpts.childrenField;
7151
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
6832
7152
  const {
6833
7153
  checkField,
6834
7154
  reserve
6835
7155
  } = checkboxOpts;
6836
- const childrenField = treeOpts.children || treeOpts.childrenField;
7156
+ // indeterminateField 仅支持读取
6837
7157
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
6838
7158
  if (checkField) {
6839
7159
  const handleClearChecked = item => {
@@ -6853,10 +7173,11 @@ const Methods = {
6853
7173
  if (reserve) {
6854
7174
  tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
6855
7175
  }
6856
- this.isAllSelected = false;
6857
- this.isIndeterminate = false;
6858
- this.selectCheckboxMaps = {};
6859
- this.treeIndeterminateMaps = {};
7176
+ reactData.isAllSelected = false;
7177
+ reactData.isIndeterminate = false;
7178
+ internalData.selectCheckboxMaps = {};
7179
+ internalData.treeIndeterminateRowMaps = {};
7180
+ reactData.updateCheckboxFlag++;
6860
7181
  return this.$nextTick();
6861
7182
  },
6862
7183
  /**
@@ -7107,12 +7428,14 @@ const Methods = {
7107
7428
  },
7108
7429
  triggerHeaderCellClickEvent(evnt, params) {
7109
7430
  const $xeTable = this;
7431
+ const props = $xeTable;
7110
7432
  const internalData = $xeTable;
7111
7433
  const {
7112
7434
  _lastResizeTime
7113
7435
  } = internalData;
7114
7436
  const sortOpts = $xeTable.computeSortOpts;
7115
7437
  const columnOpts = $xeTable.computeColumnOpts;
7438
+ const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
7116
7439
  const {
7117
7440
  column
7118
7441
  } = params;
@@ -7129,7 +7452,7 @@ const Methods = {
7129
7452
  triggerFilter,
7130
7453
  cell
7131
7454
  }, params), evnt);
7132
- if (columnOpts.isCurrent || $xeTable.highlightCurrentColumn) {
7455
+ if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
7133
7456
  $xeTable.triggerCurrentColumnEvent(evnt, params);
7134
7457
  }
7135
7458
  return $xeTable.$nextTick();
@@ -7147,13 +7470,25 @@ const Methods = {
7147
7470
  * @param {ColumnInfo} fieldOrColumn 列配置
7148
7471
  */
7149
7472
  setCurrentColumn(fieldOrColumn) {
7150
- const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
7473
+ const $xeTable = this;
7474
+ const props = $xeTable;
7475
+ const reactData = $xeTable;
7476
+ const {
7477
+ mouseConfig
7478
+ } = props;
7479
+ const mouseOpts = $xeTable.computeMouseOpts;
7480
+ const isMouseSelected = mouseConfig && mouseOpts.selected;
7481
+ const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
7151
7482
  if (column) {
7152
- // this.clearCurrentRow()
7153
- this.clearCurrentColumn();
7154
- this.currentColumn = column;
7483
+ $xeTable.clearCurrentColumn();
7484
+ reactData.currentColumn = column;
7155
7485
  }
7156
- return this.$nextTick();
7486
+ return $xeTable.$nextTick().then(() => {
7487
+ // 更新状选中态
7488
+ if (isMouseSelected) {
7489
+ $xeTable.addCellSelectedClass();
7490
+ }
7491
+ });
7157
7492
  },
7158
7493
  /**
7159
7494
  * 用于当前列,手动清空当前高亮的状态
@@ -7162,21 +7497,6 @@ const Methods = {
7162
7497
  this.currentColumn = null;
7163
7498
  return this.$nextTick();
7164
7499
  },
7165
- checkValidate(type) {
7166
- if (this.triggerValidate) {
7167
- return this.triggerValidate(type);
7168
- }
7169
- return this.$nextTick();
7170
- },
7171
- /**
7172
- * 当单元格发生改变时
7173
- * 如果存在规则,则校验
7174
- */
7175
- handleChangeCell(evnt, params) {
7176
- this.checkValidate('blur').catch(e => e).then(() => {
7177
- this.handleEdit(params, evnt).then(() => this.checkValidate('change')).catch(e => e);
7178
- });
7179
- },
7180
7500
  /**
7181
7501
  * 列点击事件
7182
7502
  * 如果是单击模式,则激活为编辑状态
@@ -7188,6 +7508,7 @@ const Methods = {
7188
7508
  const reactData = $xeTable;
7189
7509
  const {
7190
7510
  highlightCurrentRow,
7511
+ highlightCurrentColumn,
7191
7512
  editConfig
7192
7513
  } = props;
7193
7514
  const {
@@ -7204,6 +7525,8 @@ const Methods = {
7204
7525
  const checkboxOpts = $xeTable.computeCheckboxOpts;
7205
7526
  const keyboardOpts = $xeTable.computeKeyboardOpts;
7206
7527
  const rowOpts = $xeTable.computeRowOpts;
7528
+ const columnOpts = $xeTable.computeColumnOpts;
7529
+ const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
7207
7530
  const {
7208
7531
  actived,
7209
7532
  focused
@@ -7234,11 +7557,11 @@ const Methods = {
7234
7557
  if (!triggerCheckbox && !triggerRadio) {
7235
7558
  // 如果是展开行
7236
7559
  if (!triggerExpandNode && (expandOpts.trigger === 'row' || isExpandType && expandOpts.trigger === 'cell')) {
7237
- this.triggerRowExpandEvent(evnt, params);
7560
+ $xeTable.triggerRowExpandEvent(evnt, params);
7238
7561
  }
7239
7562
  // 如果是树形表格
7240
7563
  if (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell') {
7241
- this.triggerTreeExpandEvent(evnt, params);
7564
+ $xeTable.triggerTreeExpandEvent(evnt, params);
7242
7565
  }
7243
7566
  }
7244
7567
  // 如果点击了树节点
@@ -7247,16 +7570,22 @@ const Methods = {
7247
7570
  // 如果是高亮行
7248
7571
  if (rowOpts.isCurrent || highlightCurrentRow) {
7249
7572
  if (!triggerCheckbox && !triggerRadio) {
7250
- this.triggerCurrentRowEvent(evnt, params);
7573
+ $xeTable.triggerCurrentRowEvent(evnt, params);
7574
+ }
7575
+ }
7576
+ // 如果是当前列
7577
+ if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
7578
+ if (!triggerCheckbox && !triggerRadio) {
7579
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
7251
7580
  }
7252
7581
  }
7253
7582
  // 如果是单选框
7254
7583
  if (!triggerRadio && (radioOpts.trigger === 'row' || isRadioType && radioOpts.trigger === 'cell')) {
7255
- this.triggerRadioRowEvent(evnt, params);
7584
+ $xeTable.triggerRadioRowEvent(evnt, params);
7256
7585
  }
7257
7586
  // 如果是复选框
7258
7587
  if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || isCheckboxType && checkboxOpts.trigger === 'cell')) {
7259
- this.handleToggleCheckRowEvent(evnt, params);
7588
+ $xeTable.handleToggleCheckRowEvent(evnt, params);
7260
7589
  }
7261
7590
  }
7262
7591
  // 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
@@ -7268,14 +7597,14 @@ const Methods = {
7268
7597
  }
7269
7598
  if (editOpts.trigger === 'manual') {
7270
7599
  if (actived.args && actived.row === row && column !== actived.column) {
7271
- this.handleChangeCell(evnt, params);
7600
+ handleChangeCell($xeTable, evnt, params);
7272
7601
  }
7273
7602
  } else if (!actived.args || row !== actived.row || column !== actived.column) {
7274
7603
  if (editOpts.trigger === 'click') {
7275
- this.handleChangeCell(evnt, params);
7604
+ handleChangeCell($xeTable, evnt, params);
7276
7605
  } else if (editOpts.trigger === 'dblclick') {
7277
7606
  if (editOpts.mode === 'row' && actived.row === row) {
7278
- this.handleChangeCell(evnt, params);
7607
+ handleChangeCell($xeTable, evnt, params);
7279
7608
  }
7280
7609
  }
7281
7610
  }
@@ -7295,7 +7624,7 @@ const Methods = {
7295
7624
  }
7296
7625
  }
7297
7626
  }
7298
- this.emitEvent('cell-click', params, evnt);
7627
+ $xeTable.dispatchEvent('cell-click', params, evnt);
7299
7628
  },
7300
7629
  /**
7301
7630
  * 列双击点击事件
@@ -7326,11 +7655,11 @@ const Methods = {
7326
7655
  if ((0, _utils.isEnableConf)(editConfig) && editOpts.trigger === 'dblclick') {
7327
7656
  if (!actived.args || evnt.currentTarget !== actived.args.cell) {
7328
7657
  if (editOpts.mode === 'row') {
7329
- this.checkValidate('blur').catch(e => e).then(() => {
7330
- this.handleEdit(params, evnt).then(() => this.checkValidate('change')).catch(e => e);
7658
+ checkValidate($xeTable, 'blur').catch(e => e).then(() => {
7659
+ this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
7331
7660
  });
7332
7661
  } else if (editOpts.mode === 'cell') {
7333
- this.handleEdit(params, evnt).then(() => this.checkValidate('change')).catch(e => e);
7662
+ this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
7334
7663
  }
7335
7664
  }
7336
7665
  }
@@ -7582,6 +7911,8 @@ const Methods = {
7582
7911
  } = props;
7583
7912
  const rowDragOpts = $xeTable.computeRowDragOpts;
7584
7913
  const {
7914
+ afterFullData,
7915
+ tableFullData,
7585
7916
  fullAllDataRowIdData
7586
7917
  } = internalData;
7587
7918
  const {
@@ -7599,12 +7930,11 @@ const Methods = {
7599
7930
  parentField
7600
7931
  } = treeOpts;
7601
7932
  const childrenField = treeOpts.children || treeOpts.childrenField;
7602
- const {
7603
- afterFullData,
7604
- tableFullData
7605
- } = internalData;
7606
7933
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
7607
7934
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
7935
+ const errRest = {
7936
+ status: false
7937
+ };
7608
7938
  if (prevDragRow && dragRow) {
7609
7939
  // 判断是否有拖动
7610
7940
  if (prevDragRow !== dragRow) {
@@ -7619,7 +7949,7 @@ const Methods = {
7619
7949
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
7620
7950
  return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
7621
7951
  if (!status) {
7622
- return;
7952
+ return errRest;
7623
7953
  }
7624
7954
  let oafIndex = -1;
7625
7955
  let nafIndex = -1;
@@ -7650,11 +7980,11 @@ const Methods = {
7650
7980
  if (isPeerDrag && !isCrossDrag) {
7651
7981
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
7652
7982
  // 非同级
7653
- return;
7983
+ return errRest;
7654
7984
  }
7655
7985
  } else {
7656
7986
  if (!isCrossDrag) {
7657
- return;
7987
+ return errRest;
7658
7988
  }
7659
7989
  if (oldAllMaps[newRowid]) {
7660
7990
  isSelfToChildStatus = true;
@@ -7665,19 +7995,19 @@ const Methods = {
7665
7995
  content: getI18n('vxe.error.treeDragChild')
7666
7996
  });
7667
7997
  }
7668
- return;
7998
+ return errRest;
7669
7999
  }
7670
8000
  }
7671
8001
  }
7672
8002
  } else if (oldLevel) {
7673
8003
  // 子到根
7674
8004
  if (!isCrossDrag) {
7675
- return;
8005
+ return errRest;
7676
8006
  }
7677
8007
  } else if (newLevel) {
7678
8008
  // 根到子
7679
8009
  if (!isCrossDrag) {
7680
- return;
8010
+ return errRest;
7681
8011
  }
7682
8012
  if (oldAllMaps[newRowid]) {
7683
8013
  isSelfToChildStatus = true;
@@ -7688,7 +8018,7 @@ const Methods = {
7688
8018
  content: getI18n('vxe.error.treeDragChild')
7689
8019
  });
7690
8020
  }
7691
- return;
8021
+ return errRest;
7692
8022
  }
7693
8023
  }
7694
8024
  } else {
@@ -7746,26 +8076,34 @@ const Methods = {
7746
8076
  if (reactData.scrollYLoad) {
7747
8077
  $xeTable.updateScrollYSpace();
7748
8078
  }
7749
- $xeTable.$nextTick().then(() => {
8079
+ if (evnt) {
8080
+ $xeTable.dispatchEvent('row-dragend', {
8081
+ oldRow: dragRow,
8082
+ newRow: prevDragRow,
8083
+ dragRow,
8084
+ dragPos: prevDragPos,
8085
+ dragToChild: isDragToChildFlag,
8086
+ offsetIndex: dragOffsetIndex,
8087
+ _index: {
8088
+ newIndex: nafIndex,
8089
+ oldIndex: oafIndex
8090
+ }
8091
+ }, evnt);
8092
+ }
8093
+ return $xeTable.$nextTick().then(() => {
7750
8094
  $xeTable.updateCellAreas();
7751
8095
  $xeTable.recalculate();
8096
+ }).then(() => {
8097
+ return {
8098
+ status: true
8099
+ };
7752
8100
  });
7753
- $xeTable.dispatchEvent('row-dragend', {
7754
- oldRow: dragRow,
7755
- newRow: prevDragRow,
7756
- dragRow,
7757
- dragPos: prevDragPos,
7758
- dragToChild: isDragToChildFlag,
7759
- offsetIndex: dragOffsetIndex,
7760
- _index: {
7761
- newIndex: nafIndex,
7762
- oldIndex: oafIndex
7763
- }
7764
- }, evnt);
7765
- }).catch(() => {});
8101
+ }).catch(() => {
8102
+ return errRest;
8103
+ });
7766
8104
  }
7767
8105
  }
7768
- return Promise.resolve();
8106
+ return Promise.resolve(errRest);
7769
8107
  },
7770
8108
  handleRowDragDragendEvent(evnt) {
7771
8109
  const $xeTable = this;
@@ -7952,6 +8290,9 @@ const Methods = {
7952
8290
  collectColumn
7953
8291
  } = internalData;
7954
8292
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
8293
+ const errRest = {
8294
+ status: false
8295
+ };
7955
8296
  if (prevDragCol && dragCol) {
7956
8297
  // 判断是否有拖动
7957
8298
  if (prevDragCol !== dragCol) {
@@ -7968,7 +8309,7 @@ const Methods = {
7968
8309
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
7969
8310
  return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
7970
8311
  if (!status) {
7971
- return;
8312
+ return errRest;
7972
8313
  }
7973
8314
  let oafIndex = -1;
7974
8315
  let nafIndex = -1;
@@ -7982,11 +8323,11 @@ const Methods = {
7982
8323
  if (isPeerDrag && !isCrossDrag) {
7983
8324
  if (dragColumn.parentId !== newColumn.parentId) {
7984
8325
  // 非同级
7985
- return;
8326
+ return errRest;
7986
8327
  }
7987
8328
  } else {
7988
8329
  if (!isCrossDrag) {
7989
- return;
8330
+ return errRest;
7990
8331
  }
7991
8332
  if (oldAllMaps[newColumn.id]) {
7992
8333
  isSelfToChildStatus = true;
@@ -7997,19 +8338,19 @@ const Methods = {
7997
8338
  content: getI18n('vxe.error.treeDragChild')
7998
8339
  });
7999
8340
  }
8000
- return;
8341
+ return errRest;
8001
8342
  }
8002
8343
  }
8003
8344
  }
8004
8345
  } else if (dragColumn.parentId) {
8005
8346
  // 子到根
8006
8347
  if (!isCrossDrag) {
8007
- return;
8348
+ return errRest;
8008
8349
  }
8009
8350
  } else if (newColumn.parentId) {
8010
8351
  // 根到子
8011
8352
  if (!isCrossDrag) {
8012
- return;
8353
+ return errRest;
8013
8354
  }
8014
8355
  if (oldAllMaps[newColumn.id]) {
8015
8356
  isSelfToChildStatus = true;
@@ -8020,7 +8361,7 @@ const Methods = {
8020
8361
  content: getI18n('vxe.error.treeDragChild')
8021
8362
  });
8022
8363
  }
8023
- return;
8364
+ return errRest;
8024
8365
  }
8025
8366
  }
8026
8367
  } else {
@@ -8089,25 +8430,32 @@ const Methods = {
8089
8430
  $xeTable.clearCopyCellArea();
8090
8431
  }
8091
8432
  }
8092
- $xeTable.dispatchEvent('column-dragend', {
8093
- oldColumn: dragColumn,
8094
- newColumn,
8095
- dragColumn,
8096
- dragPos: prevDragPos,
8097
- dragToChild: isDragToChildFlag,
8098
- offsetIndex: dragOffsetIndex,
8099
- _index: {
8100
- newIndex: nafIndex,
8101
- oldIndex: oafIndex
8102
- }
8103
- }, evnt);
8433
+ if (evnt) {
8434
+ $xeTable.dispatchEvent('column-dragend', {
8435
+ oldColumn: dragColumn,
8436
+ newColumn,
8437
+ dragColumn,
8438
+ dragPos: prevDragPos,
8439
+ dragToChild: isDragToChildFlag,
8440
+ offsetIndex: dragOffsetIndex,
8441
+ _index: {
8442
+ newIndex: nafIndex,
8443
+ oldIndex: oafIndex
8444
+ }
8445
+ }, evnt);
8446
+ }
8104
8447
  if (isSyncColumn) {
8105
8448
  $xeTable.handleColDragSwapColumn();
8106
8449
  }
8107
- }).catch(() => {});
8450
+ return {
8451
+ status: true
8452
+ };
8453
+ }).catch(() => {
8454
+ return errRest;
8455
+ });
8108
8456
  }
8109
8457
  }
8110
- return Promise.resolve();
8458
+ return Promise.resolve(errRest);
8111
8459
  },
8112
8460
  handleHeaderCellDragDragendEvent(evnt) {
8113
8461
  const $xeTable = this;
@@ -8249,46 +8597,58 @@ const Methods = {
8249
8597
  setPendingRow(rows, status) {
8250
8598
  const $xeTable = this;
8251
8599
  const reactData = $xeTable;
8252
- const pendingMaps = Object.assign({}, reactData.pendingRowMaps);
8600
+ const internalData = $xeTable;
8601
+ const {
8602
+ handleGetRowId
8603
+ } = (0, _util.createHandleGetRowId)($xeTable);
8604
+ const {
8605
+ pendingRowMaps
8606
+ } = internalData;
8253
8607
  if (rows && !_xeUtils.default.isArray(rows)) {
8254
8608
  rows = [rows];
8255
8609
  }
8256
8610
  if (status) {
8257
8611
  rows.forEach(row => {
8258
- const rowid = (0, _util.getRowid)($xeTable, row);
8259
- if (rowid && !pendingMaps[rowid]) {
8260
- pendingMaps[rowid] = row;
8612
+ const rowid = handleGetRowId(row);
8613
+ if (rowid && !pendingRowMaps[rowid]) {
8614
+ pendingRowMaps[rowid] = row;
8261
8615
  }
8262
8616
  });
8263
8617
  } else {
8264
8618
  rows.forEach(row => {
8265
- const rowid = (0, _util.getRowid)($xeTable, row);
8266
- if (rowid && pendingMaps[rowid]) {
8267
- delete pendingMaps[rowid];
8619
+ const rowid = handleGetRowId(row);
8620
+ if (rowid && pendingRowMaps[rowid]) {
8621
+ delete pendingRowMaps[rowid];
8268
8622
  }
8269
8623
  });
8270
8624
  }
8271
- reactData.pendingRowMaps = pendingMaps;
8625
+ reactData.pendingRowFlag++;
8272
8626
  return $xeTable.$nextTick();
8273
8627
  },
8274
8628
  togglePendingRow(rows) {
8275
8629
  const $xeTable = this;
8276
8630
  const reactData = $xeTable;
8277
- const pendingMaps = Object.assign({}, reactData.pendingRowMaps);
8631
+ const internalData = $xeTable;
8632
+ const {
8633
+ handleGetRowId
8634
+ } = (0, _util.createHandleGetRowId)($xeTable);
8635
+ const {
8636
+ pendingRowMaps
8637
+ } = internalData;
8278
8638
  if (rows && !_xeUtils.default.isArray(rows)) {
8279
8639
  rows = [rows];
8280
8640
  }
8281
8641
  rows.forEach(row => {
8282
- const rowid = (0, _util.getRowid)($xeTable, row);
8642
+ const rowid = handleGetRowId(row);
8283
8643
  if (rowid) {
8284
- if (pendingMaps[rowid]) {
8285
- delete pendingMaps[rowid];
8644
+ if (pendingRowMaps[rowid]) {
8645
+ delete pendingRowMaps[rowid];
8286
8646
  } else {
8287
- pendingMaps[rowid] = row;
8647
+ pendingRowMaps[rowid] = row;
8288
8648
  }
8289
8649
  }
8290
8650
  });
8291
- reactData.pendingRowMaps = pendingMaps;
8651
+ reactData.pendingRowFlag++;
8292
8652
  return $xeTable.$nextTick();
8293
8653
  },
8294
8654
  hasPendingByRow(row) {
@@ -8306,13 +8666,10 @@ const Methods = {
8306
8666
  },
8307
8667
  getPendingRecords() {
8308
8668
  const $xeTable = this;
8309
- const reactData = $xeTable;
8310
8669
  const internalData = $xeTable;
8311
8670
  const {
8671
+ fullAllDataRowIdData,
8312
8672
  pendingRowMaps
8313
- } = reactData;
8314
- const {
8315
- fullAllDataRowIdData
8316
8673
  } = internalData;
8317
8674
  const insertRecords = [];
8318
8675
  _xeUtils.default.each(pendingRowMaps, (row, rowid) => {
@@ -8323,8 +8680,12 @@ const Methods = {
8323
8680
  return insertRecords;
8324
8681
  },
8325
8682
  clearPendingRow() {
8326
- this.pendingRowMaps = {};
8327
- return this.$nextTick();
8683
+ const $xeTable = this;
8684
+ const reactData = $xeTable;
8685
+ const internalData = $xeTable;
8686
+ internalData.pendingRowMaps = {};
8687
+ reactData.pendingRowFlag++;
8688
+ return $xeTable.$nextTick();
8328
8689
  },
8329
8690
  sort(sortConfs, sortOrder) {
8330
8691
  const $xeTable = this;
@@ -8505,9 +8866,11 @@ const Methods = {
8505
8866
  * @param {Event} evnt 事件
8506
8867
  */
8507
8868
  closeFilter() {
8869
+ const $xeTable = this;
8870
+ const reactData = $xeTable;
8508
8871
  const {
8509
8872
  filterStore
8510
- } = this;
8873
+ } = reactData;
8511
8874
  const {
8512
8875
  column,
8513
8876
  visible
@@ -8519,15 +8882,15 @@ const Methods = {
8519
8882
  visible: false
8520
8883
  });
8521
8884
  if (visible) {
8522
- this.emitEvent('filter-visible', {
8885
+ $xeTable.dispatchEvent('filter-visible', {
8523
8886
  column,
8524
8887
  field: column.field,
8525
8888
  property: column.field,
8526
- filterList: this.getCheckedFilters(),
8889
+ filterList: () => $xeTable.getCheckedFilters(),
8527
8890
  visible: false
8528
8891
  }, null);
8529
8892
  }
8530
- return this.$nextTick();
8893
+ return $xeTable.$nextTick();
8531
8894
  },
8532
8895
  /**
8533
8896
  * 判断指定列是否为筛选状态,如果为空则判断所有列
@@ -8560,9 +8923,9 @@ const Methods = {
8560
8923
  const $xeTable = this;
8561
8924
  const reactData = $xeTable;
8562
8925
  const internalData = $xeTable;
8563
- const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
8564
8926
  const {
8565
- fullAllDataRowIdData
8927
+ fullAllDataRowIdData,
8928
+ rowExpandLazyLoadedMaps
8566
8929
  } = internalData;
8567
8930
  const expandOpts = $xeTable.computeExpandOpts;
8568
8931
  const {
@@ -8572,9 +8935,9 @@ const Methods = {
8572
8935
  const rowRest = fullAllDataRowIdData[rowid];
8573
8936
  if (lazy && rowRest) {
8574
8937
  rowRest.expandLoaded = false;
8575
- delete rExpandLazyLoadedMaps[rowid];
8938
+ delete rowExpandLazyLoadedMaps[rowid];
8576
8939
  }
8577
- reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
8940
+ reactData.rowExpandedFlag++;
8578
8941
  return $xeTable.$nextTick();
8579
8942
  },
8580
8943
  /**
@@ -8582,18 +8945,20 @@ const Methods = {
8582
8945
  * @param {Row} row 行对象
8583
8946
  */
8584
8947
  reloadRowExpand(row) {
8948
+ const $xeTable = this;
8949
+ const internalData = $xeTable;
8585
8950
  const {
8586
- expandOpts,
8587
8951
  rowExpandLazyLoadedMaps
8588
- } = this;
8952
+ } = internalData;
8953
+ const expandOpts = $xeTable.computeExpandOpts;
8589
8954
  const {
8590
8955
  lazy
8591
8956
  } = expandOpts;
8592
8957
  const rowid = (0, _util.getRowid)(this, row);
8593
8958
  if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
8594
- this.clearRowExpandLoaded(row).then(() => this.handleAsyncRowExpand(row));
8959
+ $xeTable.clearRowExpandLoaded(row).then(() => handleAsyncRowExpand($xeTable, row));
8595
8960
  }
8596
- return this.$nextTick();
8961
+ return $xeTable.$nextTick();
8597
8962
  },
8598
8963
  reloadExpandContent(row) {
8599
8964
  if (process.env.NODE_ENV === 'development') {
@@ -8606,11 +8971,16 @@ const Methods = {
8606
8971
  * 展开行事件
8607
8972
  */
8608
8973
  triggerRowExpandEvent(evnt, params) {
8974
+ const $xeTable = this;
8975
+ const reactData = $xeTable;
8976
+ const internalData = $xeTable;
8609
8977
  const {
8610
- expandOpts,
8611
- rowExpandLazyLoadedMaps,
8612
8978
  expandColumn: column
8613
- } = this;
8979
+ } = reactData;
8980
+ const {
8981
+ rowExpandLazyLoadedMaps
8982
+ } = internalData;
8983
+ const expandOpts = $xeTable.computeExpandOpts;
8614
8984
  const {
8615
8985
  row
8616
8986
  } = params;
@@ -8622,20 +8992,20 @@ const Methods = {
8622
8992
  return;
8623
8993
  }
8624
8994
  evnt.stopPropagation();
8625
- const rowid = (0, _util.getRowid)(this, row);
8995
+ const rowid = (0, _util.getRowid)($xeTable, row);
8626
8996
  if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
8627
- const expanded = !this.isRowExpandByRow(row);
8628
- const columnIndex = this.getColumnIndex(column);
8629
- const $columnIndex = this.getVMColumnIndex(column);
8630
- this.setRowExpand(row, expanded);
8631
- this.emitEvent('toggle-row-expand', {
8997
+ const expanded = !$xeTable.isRowExpandByRow(row);
8998
+ const columnIndex = $xeTable.getColumnIndex(column);
8999
+ const $columnIndex = $xeTable.getVMColumnIndex(column);
9000
+ $xeTable.setRowExpand(row, expanded);
9001
+ $xeTable.dispatchEvent('toggle-row-expand', {
8632
9002
  expanded,
8633
9003
  column,
8634
9004
  columnIndex,
8635
9005
  $columnIndex,
8636
9006
  row,
8637
- rowIndex: this.getRowIndex(row),
8638
- $rowIndex: this.getVMRowIndex(row)
9007
+ rowIndex: $xeTable.getRowIndex(row),
9008
+ $rowIndex: $xeTable.getVMRowIndex(row)
8639
9009
  }, evnt);
8640
9010
  }
8641
9011
  },
@@ -8693,55 +9063,6 @@ const Methods = {
8693
9063
  }
8694
9064
  return this.setRowExpand(expandedRows, expanded);
8695
9065
  },
8696
- handleAsyncRowExpand(row) {
8697
- const $xeTable = this;
8698
- const reactData = $xeTable;
8699
- const internalData = $xeTable;
8700
- return new Promise(resolve => {
8701
- const {
8702
- expandOpts
8703
- } = this;
8704
- const {
8705
- loadMethod
8706
- } = expandOpts;
8707
- if (loadMethod) {
8708
- const {
8709
- fullAllDataRowIdData
8710
- } = internalData;
8711
- const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
8712
- const rowid = (0, _util.getRowid)($xeTable, row);
8713
- const rowRest = fullAllDataRowIdData[rowid];
8714
- rExpandLazyLoadedMaps[rowid] = row;
8715
- reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
8716
- loadMethod({
8717
- $table: $xeTable,
8718
- row,
8719
- rowIndex: $xeTable.getRowIndex(row),
8720
- $rowIndex: $xeTable.getVMRowIndex(row)
8721
- }).then(() => {
8722
- const rExpandedMaps = Object.assign({}, reactData.rowExpandedMaps);
8723
- if (rowRest) {
8724
- rowRest.expandLoaded = true;
8725
- }
8726
- rExpandedMaps[rowid] = row;
8727
- reactData.rowExpandedMaps = rExpandedMaps;
8728
- }).catch(() => {
8729
- if (rowRest) {
8730
- rowRest.expandLoaded = false;
8731
- }
8732
- }).finally(() => {
8733
- const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
8734
- if (rExpandLazyLoadedMaps[rowid]) {
8735
- delete rExpandLazyLoadedMaps[rowid];
8736
- }
8737
- reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
8738
- $xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
8739
- });
8740
- } else {
8741
- resolve();
8742
- }
8743
- });
8744
- },
8745
9066
  /**
8746
9067
  * 设置展开行,二个参数设置这一行展开与否
8747
9068
  * 支持单行
@@ -8751,14 +9072,20 @@ const Methods = {
8751
9072
  */
8752
9073
  setRowExpand(rows, expanded) {
8753
9074
  const $xeTable = this;
9075
+ const reactData = $xeTable;
9076
+ const internalData = $xeTable;
8754
9077
  const {
8755
- rowExpandedMaps,
8756
- fullAllDataRowIdData,
8757
- rowExpandLazyLoadedMaps,
8758
- expandOpts,
8759
9078
  expandColumn
8760
- } = this;
8761
- let rExpandedMaps = Object.assign({}, rowExpandedMaps);
9079
+ } = reactData;
9080
+ let {
9081
+ fullAllDataRowIdData,
9082
+ rowExpandedMaps,
9083
+ rowExpandLazyLoadedMaps
9084
+ } = internalData;
9085
+ const {
9086
+ handleGetRowId
9087
+ } = (0, _util.createHandleGetRowId)($xeTable);
9088
+ const expandOpts = $xeTable.computeExpandOpts;
8762
9089
  const {
8763
9090
  reserve,
8764
9091
  lazy,
@@ -8774,10 +9101,12 @@ const Methods = {
8774
9101
  }
8775
9102
  if (accordion) {
8776
9103
  // 只能同时展开一个
8777
- rExpandedMaps = {};
9104
+ rowExpandedMaps = {};
9105
+ internalData.rowExpandedMaps = rowExpandedMaps;
8778
9106
  rows = rows.slice(rows.length - 1, rows.length);
8779
9107
  }
8780
9108
  const validRows = toggleMethod ? rows.filter(row => toggleMethod({
9109
+ $table: $xeTable,
8781
9110
  expanded,
8782
9111
  column: expandColumn,
8783
9112
  columnIndex,
@@ -8788,22 +9117,22 @@ const Methods = {
8788
9117
  })) : rows;
8789
9118
  if (expanded) {
8790
9119
  validRows.forEach(row => {
8791
- const rowid = (0, _util.getRowid)(this, row);
8792
- if (!rExpandedMaps[rowid]) {
9120
+ const rowid = handleGetRowId(row);
9121
+ if (!rowExpandedMaps[rowid]) {
8793
9122
  const rowRest = fullAllDataRowIdData[rowid];
8794
9123
  const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
8795
9124
  if (isLoad) {
8796
- lazyRests.push(this.handleAsyncRowExpand(row));
9125
+ lazyRests.push(handleAsyncRowExpand($xeTable, row));
8797
9126
  } else {
8798
- rExpandedMaps[rowid] = row;
9127
+ rowExpandedMaps[rowid] = row;
8799
9128
  }
8800
9129
  }
8801
9130
  });
8802
9131
  } else {
8803
9132
  validRows.forEach(item => {
8804
- const rowid = (0, _util.getRowid)(this, item);
8805
- if (rExpandedMaps[rowid]) {
8806
- delete rExpandedMaps[rowid];
9133
+ const rowid = handleGetRowId(item);
9134
+ if (rowExpandedMaps[rowid]) {
9135
+ delete rowExpandedMaps[rowid];
8807
9136
  }
8808
9137
  });
8809
9138
  }
@@ -8811,7 +9140,7 @@ const Methods = {
8811
9140
  validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
8812
9141
  }
8813
9142
  }
8814
- this.rowExpandedMaps = rExpandedMaps;
9143
+ reactData.rowExpandedFlag++;
8815
9144
  return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => $xeTable.recalculate(true)).then(() => {
8816
9145
  updateRowOffsetTop($xeTable);
8817
9146
  updateRowExpandStyle($xeTable);
@@ -8824,11 +9153,17 @@ const Methods = {
8824
9153
  * @param {Row} row 行对象
8825
9154
  */
8826
9155
  isRowExpandByRow(row) {
9156
+ const $xeTable = this;
9157
+ const reactData = $xeTable;
9158
+ const internalData = $xeTable;
9159
+ const {
9160
+ rowExpandedFlag
9161
+ } = reactData;
8827
9162
  const {
8828
9163
  rowExpandedMaps
8829
- } = this;
9164
+ } = internalData;
8830
9165
  const rowid = (0, _util.getRowid)(this, row);
8831
- return !!rowExpandedMaps[rowid];
9166
+ return !!rowExpandedFlag && !!rowExpandedMaps[rowid];
8832
9167
  },
8833
9168
  isExpandByRow(row) {
8834
9169
  if (process.env.NODE_ENV === 'development') {
@@ -8852,7 +9187,8 @@ const Methods = {
8852
9187
  reserve
8853
9188
  } = expandOpts;
8854
9189
  const expList = $xeTable.getRowExpandRecords();
8855
- reactData.rowExpandedMaps = {};
9190
+ internalData.rowExpandedMaps = {};
9191
+ reactData.rowExpandedFlag++;
8856
9192
  if (reserve) {
8857
9193
  tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
8858
9194
  }
@@ -8872,8 +9208,10 @@ const Methods = {
8872
9208
  return this.$nextTick();
8873
9209
  },
8874
9210
  getRowExpandRecords() {
9211
+ const $xeTable = this;
9212
+ const internalData = $xeTable;
8875
9213
  const rest = [];
8876
- _xeUtils.default.each(this.rowExpandedMaps, item => {
9214
+ _xeUtils.default.each(internalData.rowExpandedMaps, item => {
8877
9215
  if (item) {
8878
9216
  rest.push(item);
8879
9217
  }
@@ -8881,8 +9219,10 @@ const Methods = {
8881
9219
  return rest;
8882
9220
  },
8883
9221
  getTreeExpandRecords() {
9222
+ const $xeTable = this;
9223
+ const internalData = $xeTable;
8884
9224
  const rest = [];
8885
- _xeUtils.default.each(this.treeExpandedMaps, item => {
9225
+ _xeUtils.default.each(internalData.treeExpandedMaps, item => {
8886
9226
  if (item) {
8887
9227
  rest.push(item);
8888
9228
  }
@@ -8918,15 +9258,14 @@ const Methods = {
8918
9258
  const reactData = $xeTable;
8919
9259
  const internalData = $xeTable;
8920
9260
  const {
8921
- fullAllDataRowIdData
9261
+ fullAllDataRowIdData,
9262
+ treeExpandedMaps
8922
9263
  } = internalData;
8923
9264
  const treeOpts = $xeTable.computeTreeOpts;
8924
9265
  const {
8925
9266
  transform
8926
9267
  } = treeOpts;
8927
- let tExpandedMaps = {};
8928
9268
  if (rows) {
8929
- tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
8930
9269
  if (!_xeUtils.default.isArray(rows)) {
8931
9270
  rows = [rows];
8932
9271
  }
@@ -8935,8 +9274,8 @@ const Methods = {
8935
9274
  const rowRest = fullAllDataRowIdData[rowid];
8936
9275
  if (rowRest) {
8937
9276
  rowRest.treeLoaded = false;
8938
- if (tExpandedMaps[rowid]) {
8939
- delete tExpandedMaps[rowid];
9277
+ if (treeExpandedMaps[rowid]) {
9278
+ delete treeExpandedMaps[rowid];
8940
9279
  }
8941
9280
  }
8942
9281
  });
@@ -8945,7 +9284,8 @@ const Methods = {
8945
9284
  rowRest.treeLoaded = false;
8946
9285
  });
8947
9286
  }
8948
- reactData.treeExpandedMaps = {};
9287
+ internalData.treeExpandedMaps = {};
9288
+ reactData.treeExpandedFlag++;
8949
9289
  if (transform) {
8950
9290
  handleVirtualTreeToList($xeTable);
8951
9291
  return $xeTable.handleTableData();
@@ -8958,45 +9298,49 @@ const Methods = {
8958
9298
  */
8959
9299
  reloadTreeExpand(row) {
8960
9300
  const $xeTable = this;
9301
+ const internalData = $xeTable;
8961
9302
  const {
8962
- treeOpts,
8963
9303
  treeExpandLazyLoadedMaps
8964
- } = this;
9304
+ } = internalData;
9305
+ const treeOpts = $xeTable.computeTreeOpts;
8965
9306
  const {
8966
9307
  transform,
8967
9308
  lazy
8968
9309
  } = treeOpts;
8969
9310
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
8970
- const rowid = (0, _util.getRowid)(this, row);
9311
+ const rowid = (0, _util.getRowid)($xeTable, row);
8971
9312
  if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
8972
- return this.clearTreeExpandLoaded(row).then(() => {
8973
- return this.handleAsyncTreeExpandChilds(row);
9313
+ return $xeTable.clearTreeExpandLoaded(row).then(() => {
9314
+ return handleAsyncTreeExpandChilds($xeTable, row);
8974
9315
  }).then(() => {
8975
9316
  if (transform) {
8976
9317
  handleVirtualTreeToList($xeTable);
8977
- return this.handleTableData();
9318
+ return $xeTable.handleTableData();
8978
9319
  }
8979
9320
  }).then(() => {
8980
- return this.recalculate();
9321
+ return $xeTable.recalculate();
8981
9322
  });
8982
9323
  }
8983
- return this.$nextTick();
9324
+ return $xeTable.$nextTick();
8984
9325
  },
8985
9326
  reloadTreeChilds(row) {
9327
+ const $xeTable = this;
8986
9328
  if (process.env.NODE_ENV === 'development') {
8987
9329
  (0, _log.warnLog)('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
8988
9330
  }
8989
9331
  // 即将废弃
8990
- return this.reloadTreeExpand(row);
9332
+ return $xeTable.reloadTreeExpand(row);
8991
9333
  },
8992
9334
  /**
8993
9335
  * 展开树节点事件
8994
9336
  */
8995
9337
  triggerTreeExpandEvent(evnt, params) {
9338
+ const $xeTable = this;
9339
+ const internalData = $xeTable;
8996
9340
  const {
8997
- treeOpts,
8998
9341
  treeExpandLazyLoadedMaps
8999
- } = this;
9342
+ } = internalData;
9343
+ const treeOpts = $xeTable.computeTreeOpts;
9000
9344
  const {
9001
9345
  row,
9002
9346
  column
@@ -9011,11 +9355,11 @@ const Methods = {
9011
9355
  evnt.stopPropagation();
9012
9356
  const rowid = (0, _util.getRowid)(this, row);
9013
9357
  if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
9014
- const expanded = !this.isTreeExpandByRow(row);
9015
- const columnIndex = this.getColumnIndex(column);
9016
- const $columnIndex = this.getVMColumnIndex(column);
9017
- this.setTreeExpand(row, expanded);
9018
- this.emitEvent('toggle-tree-expand', {
9358
+ const expanded = !$xeTable.isTreeExpandByRow(row);
9359
+ const columnIndex = $xeTable.getColumnIndex(column);
9360
+ const $columnIndex = $xeTable.getVMColumnIndex(column);
9361
+ $xeTable.setTreeExpand(row, expanded);
9362
+ $xeTable.dispatchEvent('toggle-tree-expand', {
9019
9363
  expanded,
9020
9364
  column,
9021
9365
  columnIndex,
@@ -9030,112 +9374,6 @@ const Methods = {
9030
9374
  toggleTreeExpand(row) {
9031
9375
  return this.setTreeExpand(row, !this.isTreeExpandByRow(row));
9032
9376
  },
9033
- /**
9034
- * 处理默认展开树节点
9035
- */
9036
- handleDefaultTreeExpand() {
9037
- const {
9038
- treeConfig,
9039
- treeOpts,
9040
- tableFullData
9041
- } = this;
9042
- if (treeConfig) {
9043
- const {
9044
- expandAll,
9045
- expandRowKeys
9046
- } = treeOpts;
9047
- const childrenField = treeOpts.children || treeOpts.childrenField;
9048
- if (expandAll) {
9049
- this.setAllTreeExpand(true);
9050
- } else if (expandRowKeys) {
9051
- const defExpandeds = [];
9052
- const rowkey = (0, _util.getRowkey)(this);
9053
- expandRowKeys.forEach(rowid => {
9054
- const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
9055
- children: childrenField
9056
- });
9057
- if (matchObj) {
9058
- defExpandeds.push(matchObj.item);
9059
- }
9060
- });
9061
- this.setTreeExpand(defExpandeds, true);
9062
- }
9063
- }
9064
- },
9065
- handleAsyncTreeExpandChilds(row) {
9066
- const $xeTable = this;
9067
- const {
9068
- treeOpts,
9069
- checkboxOpts
9070
- } = this;
9071
- const {
9072
- transform,
9073
- loadMethod
9074
- } = treeOpts;
9075
- const {
9076
- checkStrictly
9077
- } = checkboxOpts;
9078
- return new Promise(resolve => {
9079
- if (loadMethod) {
9080
- const {
9081
- treeExpandLazyLoadedMaps,
9082
- fullAllDataRowIdData
9083
- } = this;
9084
- const rowid = (0, _util.getRowid)($xeTable, row);
9085
- const rowRest = fullAllDataRowIdData[rowid];
9086
- treeExpandLazyLoadedMaps[rowid] = row;
9087
- Promise.resolve(loadMethod({
9088
- $table: $xeTable,
9089
- row
9090
- })).then(childRecords => {
9091
- if (rowRest) {
9092
- rowRest.treeLoaded = true;
9093
- }
9094
- if (treeExpandLazyLoadedMaps[rowid]) {
9095
- delete treeExpandLazyLoadedMaps[rowid];
9096
- }
9097
- if (!_xeUtils.default.isArray(childRecords)) {
9098
- childRecords = [];
9099
- }
9100
- if (childRecords) {
9101
- return this.loadTreeChildren(row, childRecords).then(childRows => {
9102
- const {
9103
- treeExpandedMaps
9104
- } = this;
9105
- if (childRows.length && !treeExpandedMaps[rowid]) {
9106
- treeExpandedMaps[rowid] = row;
9107
- }
9108
- // 如果当前节点已选中,则展开后子节点也被选中
9109
- if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
9110
- handleCheckedCheckboxRow($xeTable, childRows, true);
9111
- }
9112
- return this.$nextTick().then(() => {
9113
- if (transform) {
9114
- this.handleTableData();
9115
- updateAfterDataIndex($xeTable);
9116
- return this.$nextTick();
9117
- }
9118
- });
9119
- });
9120
- }
9121
- }).catch(() => {
9122
- const {
9123
- treeExpandLazyLoadedMaps
9124
- } = this;
9125
- if (rowRest) {
9126
- rowRest.treeLoaded = false;
9127
- }
9128
- if (treeExpandLazyLoadedMaps[rowid]) {
9129
- delete treeExpandLazyLoadedMaps[rowid];
9130
- }
9131
- }).finally(() => {
9132
- this.$nextTick().then(() => this.recalculate()).then(() => resolve());
9133
- });
9134
- } else {
9135
- resolve();
9136
- }
9137
- });
9138
- },
9139
9377
  /**
9140
9378
  * 设置所有树节点的展开与否
9141
9379
  * @param {Boolean} expanded 是否展开
@@ -9167,27 +9405,35 @@ const Methods = {
9167
9405
  * @returns
9168
9406
  */
9169
9407
  handleBaseTreeExpand(rows, expanded) {
9408
+ const $xeTable = this;
9409
+ const reactData = $xeTable;
9410
+ const internalData = $xeTable;
9411
+ const {
9412
+ treeNodeColumn
9413
+ } = reactData;
9170
9414
  const {
9171
9415
  fullAllDataRowIdData,
9172
9416
  tableFullData,
9173
9417
  treeExpandedMaps,
9174
- treeOpts,
9175
- treeExpandLazyLoadedMaps,
9176
- treeNodeColumn
9177
- } = this;
9418
+ treeExpandLazyLoadedMaps
9419
+ } = internalData;
9420
+ const treeOpts = $xeTable.computeTreeOpts;
9178
9421
  const {
9179
9422
  reserve,
9180
9423
  lazy,
9181
9424
  accordion,
9182
9425
  toggleMethod
9183
9426
  } = treeOpts;
9184
- const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
9185
9427
  const childrenField = treeOpts.children || treeOpts.childrenField;
9186
9428
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
9187
9429
  const result = [];
9188
- const columnIndex = this.getColumnIndex(treeNodeColumn);
9189
- const $columnIndex = this.getVMColumnIndex(treeNodeColumn);
9430
+ const columnIndex = $xeTable.getColumnIndex(treeNodeColumn);
9431
+ const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn);
9432
+ const {
9433
+ handleGetRowId
9434
+ } = (0, _util.createHandleGetRowId)($xeTable);
9190
9435
  let validRows = toggleMethod ? rows.filter(row => toggleMethod({
9436
+ $table: $xeTable,
9191
9437
  expanded,
9192
9438
  column: treeNodeColumn,
9193
9439
  columnIndex,
@@ -9202,26 +9448,26 @@ const Methods = {
9202
9448
  });
9203
9449
  if (matchObj) {
9204
9450
  matchObj.items.forEach(item => {
9205
- const rowid = (0, _util.getRowid)(this, item);
9206
- if (treeTempExpandedMaps[rowid]) {
9207
- delete treeTempExpandedMaps[rowid];
9451
+ const rowid = handleGetRowId(item);
9452
+ if (treeExpandedMaps[rowid]) {
9453
+ delete treeExpandedMaps[rowid];
9208
9454
  }
9209
9455
  });
9210
9456
  }
9211
9457
  }
9212
9458
  if (expanded) {
9213
9459
  validRows.forEach(row => {
9214
- const rowid = (0, _util.getRowid)(this, row);
9215
- if (!treeTempExpandedMaps[rowid]) {
9460
+ const rowid = handleGetRowId(row);
9461
+ if (!treeExpandedMaps[rowid]) {
9216
9462
  const rowRest = fullAllDataRowIdData[rowid];
9217
9463
  if (rowRest) {
9218
9464
  const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
9219
9465
  // 是否使用懒加载
9220
9466
  if (isLoad) {
9221
- result.push(this.handleAsyncTreeExpandChilds(row));
9467
+ result.push(handleAsyncTreeExpandChilds($xeTable, row));
9222
9468
  } else {
9223
9469
  if (row[childrenField] && row[childrenField].length) {
9224
- treeTempExpandedMaps[rowid] = row;
9470
+ treeExpandedMaps[rowid] = row;
9225
9471
  }
9226
9472
  }
9227
9473
  }
@@ -9229,18 +9475,18 @@ const Methods = {
9229
9475
  });
9230
9476
  } else {
9231
9477
  validRows.forEach(item => {
9232
- const rowid = (0, _util.getRowid)(this, item);
9233
- if (treeTempExpandedMaps[rowid]) {
9234
- delete treeTempExpandedMaps[rowid];
9478
+ const rowid = handleGetRowId(item);
9479
+ if (treeExpandedMaps[rowid]) {
9480
+ delete treeExpandedMaps[rowid];
9235
9481
  }
9236
9482
  });
9237
9483
  }
9238
9484
  if (reserve) {
9239
- validRows.forEach(row => this.handleTreeExpandReserve(row, expanded));
9485
+ validRows.forEach(row => handleTreeExpandReserve($xeTable, row, expanded));
9240
9486
  }
9241
- this.treeExpandedMaps = treeTempExpandedMaps;
9487
+ reactData.treeExpandedFlag++;
9242
9488
  return Promise.all(result).then(() => {
9243
- return this.recalculate();
9489
+ return $xeTable.recalculate();
9244
9490
  });
9245
9491
  },
9246
9492
  /**
@@ -9297,40 +9543,49 @@ const Methods = {
9297
9543
  * @param {Row} row 行对象
9298
9544
  */
9299
9545
  isTreeExpandByRow(row) {
9546
+ const $xeTable = this;
9547
+ const reactData = $xeTable;
9548
+ const internalData = $xeTable;
9549
+ const {
9550
+ treeExpandedFlag
9551
+ } = reactData;
9300
9552
  const {
9301
9553
  treeExpandedMaps
9302
- } = this;
9303
- return !!treeExpandedMaps[(0, _util.getRowid)(this, row)];
9554
+ } = internalData;
9555
+ return !!treeExpandedFlag && !!treeExpandedMaps[(0, _util.getRowid)($xeTable, row)];
9304
9556
  },
9305
9557
  /**
9306
9558
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
9307
9559
  */
9308
9560
  clearTreeExpand() {
9309
9561
  const $xeTable = this;
9562
+ const reactData = $xeTable;
9563
+ const internalData = $xeTable;
9310
9564
  const {
9311
- treeOpts,
9312
- tableFullData
9313
- } = this;
9565
+ tableFullTreeData
9566
+ } = internalData;
9567
+ const treeOpts = $xeTable.computeTreeOpts;
9568
+ const childrenField = treeOpts.children || treeOpts.childrenField;
9314
9569
  const {
9315
9570
  transform,
9316
9571
  reserve
9317
9572
  } = treeOpts;
9318
- const childrenField = treeOpts.children || treeOpts.childrenField;
9319
- const expList = this.getTreeExpandRecords();
9320
- this.treeExpandedMaps = {};
9573
+ const expList = $xeTable.getTreeExpandRecords();
9574
+ internalData.treeExpandedMaps = {};
9575
+ reactData.treeExpandedFlag++;
9321
9576
  if (reserve) {
9322
- _xeUtils.default.eachTree(tableFullData, row => this.handleTreeExpandReserve(row, false), {
9577
+ _xeUtils.default.eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
9323
9578
  children: childrenField
9324
9579
  });
9325
9580
  }
9326
- return this.handleTableData().then(() => {
9581
+ return $xeTable.handleTableData().then(() => {
9327
9582
  if (transform) {
9328
9583
  handleVirtualTreeToList($xeTable);
9329
- return this.handleTableData();
9584
+ return $xeTable.handleTableData();
9330
9585
  }
9331
9586
  }).then(() => {
9332
9587
  if (expList.length) {
9333
- this.recalculate();
9588
+ $xeTable.recalculate();
9334
9589
  }
9335
9590
  });
9336
9591
  },
@@ -9338,20 +9593,6 @@ const Methods = {
9338
9593
  this.treeExpandedReserveRowMap = {};
9339
9594
  return this.$nextTick();
9340
9595
  },
9341
- handleTreeExpandReserve(row, expanded) {
9342
- const {
9343
- treeExpandedReserveRowMap,
9344
- treeOpts
9345
- } = this;
9346
- if (treeOpts.reserve) {
9347
- const rowid = (0, _util.getRowid)(this, row);
9348
- if (expanded) {
9349
- treeExpandedReserveRowMap[rowid] = row;
9350
- } else if (treeExpandedReserveRowMap[rowid]) {
9351
- delete treeExpandedReserveRowMap[rowid];
9352
- }
9353
- }
9354
- },
9355
9596
  /**
9356
9597
  * 获取表格的滚动状态
9357
9598
  */
@@ -9717,11 +9958,12 @@ const Methods = {
9717
9958
  } = tableProps;
9718
9959
  const {
9719
9960
  scrollXLoad,
9720
- scrollYLoad
9961
+ scrollYLoad,
9962
+ expandColumn
9721
9963
  } = reactData;
9722
9964
  const leftFixedWidth = $xeTable.computeLeftFixedWidth;
9723
9965
  const rightFixedWidth = $xeTable.computeRightFixedWidth;
9724
- if (!(scrollYLoad || leftFixedWidth || rightFixedWidth)) {
9966
+ if (!(leftFixedWidth || rightFixedWidth || expandColumn)) {
9725
9967
  return;
9726
9968
  }
9727
9969
  const {
@@ -10013,15 +10255,15 @@ const Methods = {
10013
10255
  const {
10014
10256
  isAllOverflow,
10015
10257
  scrollYLoad,
10016
- expandColumn,
10017
- rowExpandedMaps
10258
+ expandColumn
10018
10259
  } = reactData;
10019
10260
  const {
10020
10261
  scrollYStore,
10021
10262
  elemStore,
10022
10263
  isResizeCellHeight,
10023
10264
  afterFullData,
10024
- fullAllDataRowIdData
10265
+ fullAllDataRowIdData,
10266
+ rowExpandedMaps
10025
10267
  } = internalData;
10026
10268
  const {
10027
10269
  startIndex
@@ -10283,6 +10525,8 @@ const Methods = {
10283
10525
  * 更新表尾合计
10284
10526
  */
10285
10527
  updateFooter() {
10528
+ const $xeTable = this;
10529
+ const $xeGrid = $xeTable.$xeGrid;
10286
10530
  const {
10287
10531
  showFooter,
10288
10532
  visibleColumn,
@@ -10296,8 +10540,8 @@ const Methods = {
10296
10540
  footData = visibleColumn.length ? footerMethod({
10297
10541
  columns: visibleColumn,
10298
10542
  data: this.afterFullData,
10299
- $table: this,
10300
- $grid: this.$xegrid
10543
+ $table: $xeTable,
10544
+ $grid: $xeGrid
10301
10545
  }) : [];
10302
10546
  }
10303
10547
  this.footerTableData = footData;
@@ -10378,7 +10622,7 @@ const Methods = {
10378
10622
  if (this.footerSpanMethod) {
10379
10623
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
10380
10624
  }
10381
- setMerges(this, merges, this.mergeFooterList, null);
10625
+ setMerges(this, merges, this.mergeFooterList);
10382
10626
  return this.$nextTick().then(() => {
10383
10627
  this.updateCellAreas();
10384
10628
  return updateStyle($xeTable);
@@ -10433,16 +10677,19 @@ const Methods = {
10433
10677
  },
10434
10678
  dispatchEvent(type, params, evnt) {
10435
10679
  const $xeTable = this;
10680
+ const $xeGrid = $xeTable.$xeGrid;
10436
10681
  $xeTable.$emit(type, createEvent(evnt, {
10437
10682
  $table: $xeTable,
10438
- $grid: $xeTable.$xegrid
10683
+ $grid: $xeGrid
10439
10684
  }, params));
10440
10685
  },
10441
10686
  // 已废弃,使用 dispatchEvent
10442
10687
  emitEvent(type, params, evnt) {
10688
+ const $xeTable = this;
10689
+ const $xeGrid = $xeTable.$xeGrid;
10443
10690
  this.$emit(type, Object.assign({
10444
- $table: this,
10445
- $grid: this.$xegrid,
10691
+ $table: $xeTable,
10692
+ $grid: $xeGrid,
10446
10693
  $event: evnt
10447
10694
  }, params));
10448
10695
  },