vxe-table 4.19.12 → 4.19.14

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 (47) hide show
  1. package/dist/all.esm.js +236 -88
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/index.css +1 -1
  5. package/es/index.min.css +1 -1
  6. package/es/style.css +1 -1
  7. package/es/style.min.css +1 -1
  8. package/es/table/module/edit/hook.js +5 -5
  9. package/es/table/module/menu/panel.js +5 -5
  10. package/es/table/src/table.js +222 -74
  11. package/es/table/style.css +11 -7
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/es/vxe-table/style.css +11 -7
  16. package/es/vxe-table/style.min.css +1 -1
  17. package/lib/index.css +1 -1
  18. package/lib/index.min.css +1 -1
  19. package/lib/index.umd.js +30 -18
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/style.css +1 -1
  22. package/lib/style.min.css +1 -1
  23. package/lib/table/module/edit/hook.js +5 -0
  24. package/lib/table/module/edit/hook.min.js +1 -1
  25. package/lib/table/module/menu/panel.js +5 -5
  26. package/lib/table/module/menu/panel.min.js +1 -1
  27. package/lib/table/src/table.js +19 -12
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +11 -7
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +11 -7
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +2 -2
  38. package/packages/table/module/edit/hook.ts +5 -5
  39. package/packages/table/module/menu/panel.ts +5 -5
  40. package/packages/table/src/table.ts +224 -74
  41. package/styles/components/table-module/menu.scss +5 -2
  42. /package/es/{iconfont.1781140839085.ttf → iconfont.1781257692019.ttf} +0 -0
  43. /package/es/{iconfont.1781140839085.woff → iconfont.1781257692019.woff} +0 -0
  44. /package/es/{iconfont.1781140839085.woff2 → iconfont.1781257692019.woff2} +0 -0
  45. /package/lib/{iconfont.1781140839085.ttf → iconfont.1781257692019.ttf} +0 -0
  46. /package/lib/{iconfont.1781140839085.woff → iconfont.1781257692019.woff} +0 -0
  47. /package/lib/{iconfont.1781140839085.woff2 → iconfont.1781257692019.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  export { VxeUI } from '@vxe-ui/core';
3
- import XEUtils from 'xe-utils';
3
+ import XEUtils, { isNaN as isNaN$1 } from 'xe-utils';
4
4
  import DomZIndex from 'dom-zindex';
5
5
  import { defineComponent, watch, reactive, h, ref, inject, createCommentVNode, onMounted, onUnmounted, provide, nextTick, TransitionGroup, computed, Teleport, resolveComponent, onActivated, onDeactivated, onBeforeUnmount } from 'vue';
6
6
 
@@ -44,7 +44,7 @@ function eqEmptyValue(cellValue) {
44
44
  return cellValue === '' || XEUtils.eqNull(cellValue);
45
45
  }
46
46
 
47
- const version$1 = "4.19.12";
47
+ const version$1 = "4.19.14";
48
48
  VxeUI.version = version$1;
49
49
  VxeUI.tableVersion = version$1;
50
50
  VxeUI.setConfig({
@@ -743,7 +743,7 @@ function wheelScrollTopTo(diffNum, cb) {
743
743
  }
744
744
 
745
745
  const { log } = VxeUI;
746
- const version = `table v${"4.19.12"}`;
746
+ const version = `table v${"4.19.14"}`;
747
747
  const warnLog = log.create('warn', version);
748
748
  const errLog = log.create('error', version);
749
749
 
@@ -8206,7 +8206,7 @@ var TableMenuPanelComponent = defineVxeComponent({
8206
8206
  return options.every(item => item.visible === false)
8207
8207
  ? renderEmptyElement$2($xeTable)
8208
8208
  : h('ul', {
8209
- class: 'vxe-context-menu--option-wrapper',
8209
+ class: 'vxe-table--context-menu-group-wrapper',
8210
8210
  key: gIndex
8211
8211
  }, options.map((item, index) => {
8212
8212
  const { children, loading } = item;
@@ -8219,7 +8219,7 @@ var TableMenuPanelComponent = defineVxeComponent({
8219
8219
  return item.visible === false
8220
8220
  ? renderEmptyElement$2($xeTable)
8221
8221
  : h('li', {
8222
- class: [item.className, {
8222
+ class: ['vxe-table--context-menu--option', item.className, {
8223
8223
  'link--loading': loading,
8224
8224
  'link--disabled': item.disabled,
8225
8225
  'link--active': item === ctxMenuStore.selected
@@ -8269,12 +8269,12 @@ var TableMenuPanelComponent = defineVxeComponent({
8269
8269
  suffixOpts.content ? h('span', `${suffixOpts.content}`) : renderEmptyElement$2($xeTable)
8270
8270
  ])
8271
8271
  ]),
8272
- hasChildMenus && item.children
8272
+ hasChildMenus && children
8273
8273
  ? h('ul', {
8274
8274
  class: ['vxe-table--context-menu-clild-wrapper', {
8275
8275
  'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
8276
8276
  }]
8277
- }, item.children.map((child, cIndex) => {
8277
+ }, children.map((child, cIndex) => {
8278
8278
  const { loading: childLoading } = child;
8279
8279
  const childPrefixOpts = Object.assign({}, child.prefixConfig);
8280
8280
  const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
@@ -8284,7 +8284,7 @@ var TableMenuPanelComponent = defineVxeComponent({
8284
8284
  return child.visible === false
8285
8285
  ? null
8286
8286
  : h('li', {
8287
- class: [child.className, {
8287
+ class: ['vxe-table--context-menu--option', child.className, {
8288
8288
  'link--loading': childLoading,
8289
8289
  'link--disabled': child.disabled,
8290
8290
  'link--active': child === ctxMenuStore.selectChild
@@ -9201,7 +9201,7 @@ hooks$5.add('tableEditModule', {
9201
9201
  }
9202
9202
  pChilds[funcName](item);
9203
9203
  pMapChilds[funcName](item);
9204
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9204
+ const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9205
9205
  fullDataRowIdData[rowid] = rest;
9206
9206
  fullAllDataRowIdData[rowid] = rest;
9207
9207
  }
@@ -9211,7 +9211,7 @@ hooks$5.add('tableEditModule', {
9211
9211
  }
9212
9212
  afterFullData[funcName](item);
9213
9213
  tableFullTreeData[funcName](item);
9214
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9214
+ const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9215
9215
  fullDataRowIdData[rowid] = rest;
9216
9216
  fullAllDataRowIdData[rowid] = rest;
9217
9217
  }
@@ -9261,7 +9261,7 @@ hooks$5.add('tableEditModule', {
9261
9261
  else {
9262
9262
  newRecords.forEach(item => {
9263
9263
  const rowid = getRowid($xeTable, item);
9264
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9264
+ const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9265
9265
  fullDataRowIdData[rowid] = rest;
9266
9266
  fullAllDataRowIdData[rowid] = rest;
9267
9267
  afterFullData.unshift(item);
@@ -9293,7 +9293,7 @@ hooks$5.add('tableEditModule', {
9293
9293
  else {
9294
9294
  newRecords.forEach(item => {
9295
9295
  const rowid = getRowid($xeTable, item);
9296
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, _tIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9296
+ const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, treeIndex: -1, _tIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9297
9297
  fullDataRowIdData[rowid] = rest;
9298
9298
  fullAllDataRowIdData[rowid] = rest;
9299
9299
  afterFullData.push(item);
@@ -9333,7 +9333,7 @@ hooks$5.add('tableEditModule', {
9333
9333
  });
9334
9334
  XEUtils.eachTree(treeRecords, (item) => {
9335
9335
  const rowid = getRowid($xeTable, item);
9336
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9336
+ const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
9337
9337
  if (item[childrenField]) {
9338
9338
  item[mapChildrenField] = item[childrenField];
9339
9339
  }
@@ -15413,22 +15413,32 @@ var VxeTableComponent = defineVxeComponent({
15413
15413
  const { tableFullColumn } = internalData;
15414
15414
  const { updateColFlag } = reactData;
15415
15415
  const editDirtyOpts = computeEditDirtyOpts.value;
15416
- const { includeFields, excludeFields } = editDirtyOpts;
15416
+ const { extraFields, includeFields, excludeFields } = editDirtyOpts;
15417
15417
  const kpFields = [];
15418
15418
  if (updateColFlag) {
15419
15419
  if (includeFields && includeFields.length) {
15420
15420
  return includeFields;
15421
15421
  }
15422
- const exfMaps = {};
15422
+ const excludeFdMaps = {};
15423
15423
  if (excludeFields && excludeFields.length) {
15424
15424
  excludeFields.forEach(field => {
15425
- exfMaps[field] = 1;
15425
+ excludeFdMaps[field] = 1;
15426
+ });
15427
+ }
15428
+ const addFdMaps = {};
15429
+ if (extraFields && extraFields.length) {
15430
+ extraFields.forEach(field => {
15431
+ if (!addFdMaps[field]) {
15432
+ addFdMaps[field] = 1;
15433
+ kpFields.push(field);
15434
+ }
15426
15435
  });
15427
15436
  }
15428
15437
  for (let i = 0; i < tableFullColumn.length; i++) {
15429
15438
  const column = tableFullColumn[i];
15430
15439
  const { field, type, editRender, cellRender } = column;
15431
- if (field && !type && (editRender || cellRender) && !exfMaps[field]) {
15440
+ if (field && !type && (editRender || cellRender) && !addFdMaps[field] && !excludeFdMaps[field]) {
15441
+ addFdMaps[field] = 1;
15432
15442
  kpFields.push(field);
15433
15443
  }
15434
15444
  }
@@ -16863,7 +16873,7 @@ var VxeTableComponent = defineVxeComponent({
16863
16873
  cellValue = $xeTable.getCellLabel(row, column);
16864
16874
  }
16865
16875
  if (!sortType || sortType === 'auto') {
16866
- return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
16876
+ return isNaN$1(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
16867
16877
  }
16868
16878
  else if (sortType === 'number') {
16869
16879
  return XEUtils.toNumber(cellValue);
@@ -16882,7 +16892,7 @@ var VxeTableComponent = defineVxeComponent({
16882
16892
  cellValue = $xeTable.getCellLabel(row, column);
16883
16893
  }
16884
16894
  if (!sortType || sortType === 'auto') {
16885
- return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
16895
+ return isNaN$1(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
16886
16896
  }
16887
16897
  else if (sortType === 'number') {
16888
16898
  return XEUtils.toNumber(cellValue);
@@ -16893,26 +16903,63 @@ var VxeTableComponent = defineVxeComponent({
16893
16903
  return cellValue;
16894
16904
  };
16895
16905
  };
16906
+ const updateAfterTreeIndex = () => {
16907
+ const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
16908
+ const treeOpts = computeTreeOpts.value;
16909
+ const { transform, mapChildrenField } = treeOpts;
16910
+ const childrenField = treeOpts.children || treeOpts.childrenField;
16911
+ const fullMaps = {};
16912
+ let rowNum = 0;
16913
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
16914
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
16915
+ const rowid = handleGetRowId(row);
16916
+ const rowRest = fullAllDataRowIdData[rowid];
16917
+ const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
16918
+ if (rowRest) {
16919
+ rowRest.seq = seq;
16920
+ rowRest._seq = rowNum;
16921
+ rowRest.treeIndex = index;
16922
+ rowRest._tIndex = rowNum;
16923
+ }
16924
+ else {
16925
+ const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: rowNum, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
16926
+ fullAllDataRowIdData[rowid] = rest;
16927
+ fullDataRowIdData[rowid] = rest;
16928
+ }
16929
+ rowNum++;
16930
+ fullMaps[rowid] = row;
16931
+ }, { children: transform ? mapChildrenField : childrenField });
16932
+ if (transform) {
16933
+ afterFullData.forEach((row, index) => {
16934
+ const rowid = handleGetRowId(row);
16935
+ const rowRest = fullAllDataRowIdData[rowid];
16936
+ if (rowRest) {
16937
+ rowRest._index = index;
16938
+ }
16939
+ });
16940
+ }
16941
+ internalData.afterFullRowMaps = fullMaps;
16942
+ };
16896
16943
  const updateAfterListIndex = () => {
16897
- const { treeConfig } = props;
16898
16944
  const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
16899
16945
  const { handleGetRowId } = createHandleGetRowId($xeTable);
16900
16946
  const fullMaps = {};
16947
+ let rowNum = 0;
16901
16948
  afterFullData.forEach((row, index) => {
16902
16949
  const rowid = handleGetRowId(row);
16903
16950
  const rowRest = fullAllDataRowIdData[rowid];
16904
16951
  const seq = index + 1;
16905
16952
  if (rowRest) {
16906
- if (!treeConfig) {
16907
- rowRest.seq = seq;
16908
- }
16953
+ rowRest.seq = seq;
16954
+ rowRest._seq = rowNum;
16909
16955
  rowRest._index = index;
16910
16956
  }
16911
16957
  else {
16912
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
16958
+ const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
16913
16959
  fullAllDataRowIdData[rowid] = rest;
16914
16960
  fullDataRowIdData[rowid] = rest;
16915
16961
  }
16962
+ rowNum++;
16916
16963
  fullMaps[rowid] = row;
16917
16964
  });
16918
16965
  internalData.afterFullRowMaps = fullMaps;
@@ -16923,45 +16970,8 @@ var VxeTableComponent = defineVxeComponent({
16923
16970
  */
16924
16971
  const updateAfterDataIndex = () => {
16925
16972
  const { treeConfig } = props;
16926
- const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
16927
- const treeOpts = computeTreeOpts.value;
16928
- const { transform } = treeOpts;
16929
- const childrenField = treeOpts.children || treeOpts.childrenField;
16930
- const fullMaps = {};
16931
16973
  if (treeConfig) {
16932
- let _treeIndex = 0;
16933
- const { handleGetRowId } = createHandleGetRowId($xeTable);
16934
- XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
16935
- const rowid = handleGetRowId(row);
16936
- const rowRest = fullAllDataRowIdData[rowid];
16937
- const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
16938
- if (rowRest) {
16939
- rowRest.seq = seq;
16940
- rowRest.treeIndex = index;
16941
- rowRest._tIndex = _treeIndex;
16942
- }
16943
- else {
16944
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: _treeIndex, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
16945
- fullAllDataRowIdData[rowid] = rest;
16946
- fullDataRowIdData[rowid] = rest;
16947
- }
16948
- _treeIndex++;
16949
- fullMaps[rowid] = row;
16950
- }, { children: transform ? treeOpts.mapChildrenField : childrenField });
16951
- if (transform) {
16952
- afterFullData.forEach((row, index) => {
16953
- const rowid = handleGetRowId(row);
16954
- const rowRest = fullAllDataRowIdData[rowid];
16955
- const seq = index + 1;
16956
- if (rowRest) {
16957
- if (!treeConfig) {
16958
- rowRest.seq = seq;
16959
- }
16960
- rowRest._index = index;
16961
- }
16962
- });
16963
- }
16964
- internalData.afterFullRowMaps = fullMaps;
16974
+ updateAfterTreeIndex();
16965
16975
  }
16966
16976
  else {
16967
16977
  updateAfterListIndex();
@@ -18157,8 +18167,9 @@ var VxeTableComponent = defineVxeComponent({
18157
18167
  }
18158
18168
  });
18159
18169
  };
18160
- const minRunDelay = 50;
18161
- const handleLazyRecalculate = (reFull, reWidth, reHeight) => {
18170
+ const defaultMinRunDelay = 50;
18171
+ const handleLazyRecalculate = (reFull, reWidth, reHeight, options) => {
18172
+ const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay;
18162
18173
  return new Promise(resolve => {
18163
18174
  const $xeGanttView = internalData.xeGanttView;
18164
18175
  const { customStore } = reactData;
@@ -18185,6 +18196,7 @@ var VxeTableComponent = defineVxeComponent({
18185
18196
  }
18186
18197
  if (rceTimeout) {
18187
18198
  clearTimeout(rceTimeout);
18199
+ // 多少毫秒内至少执行一次
18188
18200
  if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
18189
18201
  resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
18190
18202
  }
@@ -18209,16 +18221,17 @@ var VxeTableComponent = defineVxeComponent({
18209
18221
  }, reDelay);
18210
18222
  });
18211
18223
  };
18212
- let resizePending = false;
18213
18224
  const handleResizeEvent = () => {
18214
- if (resizePending) {
18225
+ if (internalData.rsePending) {
18215
18226
  return;
18216
18227
  }
18217
- resizePending = true;
18218
- handleLazyRecalculate(true, true, true).then(() => {
18219
- resizePending = false;
18228
+ internalData.rsePending = true;
18229
+ handleLazyRecalculate(true, true, true, {
18230
+ minRunDelay: 200
18231
+ }).then(() => {
18232
+ internalData.rsePending = false;
18220
18233
  }).catch(() => {
18221
- resizePending = false;
18234
+ internalData.rsePending = false;
18222
18235
  });
18223
18236
  };
18224
18237
  const handleUpdateAggValues = () => {
@@ -18992,7 +19005,11 @@ var VxeTableComponent = defineVxeComponent({
18992
19005
  const { transform } = treeOpts;
18993
19006
  const allList = fullData || internalData.tableFullData;
18994
19007
  // 如果gt为0,则总是启用
18995
- const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
19008
+ let scrollYLoad = !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
19009
+ if (scrollYLoad && (treeConfig && !transform)) {
19010
+ errLog('vxe.error.notSupportProp', ['[table] virtual-y-config.enabled=true', 'tree-config.transform=false', 'tree-config.transform=true']);
19011
+ scrollYLoad = false;
19012
+ }
18996
19013
  reactData.scrollYLoad = scrollYLoad;
18997
19014
  syncGanttScrollYStatus();
18998
19015
  return scrollYLoad;
@@ -19802,7 +19819,7 @@ var VxeTableComponent = defineVxeComponent({
19802
19819
  XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
19803
19820
  const rowid = getRowid($xeTable, childRow);
19804
19821
  const parentRow = parentItem || parentRest.row;
19805
- const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
19822
+ const rest = { row: childRow, rowid, _seq: -1, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
19806
19823
  fullDataRowIdData[rowid] = rest;
19807
19824
  fullAllDataRowIdData[rowid] = rest;
19808
19825
  }, { children: childrenField });
@@ -24202,18 +24219,20 @@ var VxeTableComponent = defineVxeComponent({
24202
24219
  const fullDataRowIdMaps = {};
24203
24220
  const idMaps = {};
24204
24221
  const { handleUpdateRowId } = createHandleUpdateRowId($xeTable);
24222
+ let rowNum = 0;
24205
24223
  const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
24206
24224
  let rowRest = fullAllDataRowIdMaps[rowid];
24207
24225
  if (idMaps[rowid]) {
24208
24226
  errLog('vxe.error.repeatKey', [currKeyField, rowid]);
24209
24227
  }
24210
24228
  if (!rowRest) {
24211
- rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
24229
+ rowRest = { row, rowid, _seq: -1, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
24212
24230
  fullDataRowIdMaps[rowid] = rowRest;
24213
24231
  fullAllDataRowIdMaps[rowid] = rowRest;
24214
24232
  }
24215
24233
  rowRest.treeLoaded = false;
24216
24234
  rowRest.expandLoaded = false;
24235
+ rowRest._seq = rowNum++;
24217
24236
  rowRest.row = row;
24218
24237
  rowRest.items = items;
24219
24238
  rowRest.parent = parentRow;
@@ -24227,6 +24246,7 @@ var VxeTableComponent = defineVxeComponent({
24227
24246
  if (rowExpandedMaps[rowid]) {
24228
24247
  rowExpandedMaps[rowid] = row;
24229
24248
  }
24249
+ rowNum++;
24230
24250
  idMaps[rowid] = true;
24231
24251
  fullDataRowIdMaps[rowid] = rowRest;
24232
24252
  fullAllDataRowIdMaps[rowid] = rowRest;
@@ -24238,7 +24258,7 @@ var VxeTableComponent = defineVxeComponent({
24238
24258
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
24239
24259
  XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
24240
24260
  const rowid = handleUpdateRowId(row);
24241
- if (treeConfig && lazy) {
24261
+ if (lazy) {
24242
24262
  if (row[hasChildField] && row[childrenField] === undefined) {
24243
24263
  row[childrenField] = null;
24244
24264
  }
@@ -25527,31 +25547,162 @@ var VxeTableComponent = defineVxeComponent({
25527
25547
  const { treeConfig } = props;
25528
25548
  const { row } = params;
25529
25549
  const { isRowGroupStatus } = reactData;
25530
- const { afterFullData } = internalData;
25550
+ const { fullAllDataRowIdData, afterFullData, afterTreeFullData, afterGroupFullData } = internalData;
25531
25551
  const checkboxOpts = computeCheckboxOpts.value;
25532
- const { checkMethod, trigger } = checkboxOpts;
25552
+ const aggregateOpts = computeAggregateOpts.value;
25553
+ const treeOpts = computeTreeOpts.value;
25554
+ const { checkMethod, trigger, checkStrictly } = checkboxOpts;
25533
25555
  if (trigger === 'manual') {
25534
25556
  return;
25535
25557
  }
25536
25558
  evnt.stopPropagation();
25537
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
25559
+ if (checkboxOpts.isShiftKey && evnt.shiftKey) {
25560
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
25538
25561
  const checkboxRecords = $xeTable.getCheckboxRecords();
25539
- if (checkboxRecords.length) {
25540
- const firstRow = checkboxRecords[0];
25541
- const _rowIndex = $xeTable.getVTRowIndex(row);
25542
- const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
25543
- if (_rowIndex !== _firstRowIndex) {
25562
+ let currSeq = -1;
25563
+ let currRow = null;
25564
+ const currRowid = handleGetRowId(row);
25565
+ const rowRest = fullAllDataRowIdData[currRowid];
25566
+ if (rowRest) {
25567
+ currRow = rowRest.row;
25568
+ currSeq = rowRest._seq;
25569
+ }
25570
+ if (currRow && checkboxRecords.length) {
25571
+ let rangeRows = [];
25572
+ let firstSeq = -1;
25573
+ let firstRow = null;
25574
+ let firstRowid = '';
25575
+ let lastSeq = -1;
25576
+ let lastRow = null;
25577
+ let lastRowid = '';
25578
+ // 根据序号取出范围最小/最大的行
25579
+ const selectMaps = {};
25580
+ checkboxRecords.forEach(item => {
25581
+ const rowid = handleGetRowId(item);
25582
+ const rowRest = fullAllDataRowIdData[rowid];
25583
+ if (rowRest) {
25584
+ if (!firstRow || firstSeq > rowRest._seq) {
25585
+ firstRowid = rowRest.rowid;
25586
+ firstRow = rowRest.row;
25587
+ firstSeq = rowRest._seq;
25588
+ }
25589
+ if (!lastRow || lastSeq < rowRest._seq) {
25590
+ lastRowid = rowRest.rowid;
25591
+ lastRow = rowRest.row;
25592
+ lastSeq = rowRest._seq;
25593
+ }
25594
+ }
25595
+ selectMaps[rowid] = item;
25596
+ });
25597
+ // 如果已选只有一条并选择当前则跳过
25598
+ if (firstRow && lastRow && (checkboxRecords.length > 1 || currRowid !== firstRowid) && (Math.abs(firstSeq - lastSeq) > 1 || Math.abs(currSeq - firstSeq) > 1 || Math.abs(currSeq - lastSeq) > 1)) {
25599
+ // 树与分组
25600
+ if (treeConfig || isRowGroupStatus) {
25601
+ const { transform } = treeOpts;
25602
+ const childrenField = treeOpts.children || treeOpts.childrenField;
25603
+ const iteratorChildField = treeConfig ? (transform ? treeOpts.mapChildrenField : childrenField) : aggregateOpts.mapChildrenField;
25604
+ let isMatchFirst = false;
25605
+ let matchStartRowid = '';
25606
+ let matchEndRowid = '';
25607
+ const handleGetChildRowid = (rowid, isLast) => {
25608
+ const rowRest = fullAllDataRowIdData[rowid];
25609
+ if (rowRest) {
25610
+ const item = rowRest.row;
25611
+ const childList = item[iteratorChildField];
25612
+ if (childList && childList.length) {
25613
+ const targetRow = isLast ? XEUtils.last(childList) : XEUtils.first(childList);
25614
+ return handleGetChildRowid(handleGetRowId(targetRow), isLast);
25615
+ }
25616
+ }
25617
+ return rowid;
25618
+ };
25619
+ const handleGetSelectParentRowid = (rowid) => {
25620
+ const rowRest = fullAllDataRowIdData[rowid];
25621
+ if (rowRest) {
25622
+ const parentItem = rowRest.parent;
25623
+ if (parentItem) {
25624
+ const parentRowid = handleGetRowId(parentItem);
25625
+ if (selectMaps[parentRowid]) {
25626
+ return handleGetSelectParentRowid(parentRowid);
25627
+ }
25628
+ }
25629
+ }
25630
+ return rowid;
25631
+ };
25632
+ const handleGetRootRow = (row) => {
25633
+ const rowid = handleGetRowId(row);
25634
+ if (rowid) {
25635
+ const rest = fullAllDataRowIdData[rowid];
25636
+ if (rest) {
25637
+ return rest.parent ? handleGetRootRow(rest.parent) : rest;
25638
+ }
25639
+ }
25640
+ return null;
25641
+ };
25642
+ if (currSeq < firstSeq) {
25643
+ matchStartRowid = handleGetChildRowid(currRowid, 0);
25644
+ matchEndRowid = handleGetChildRowid(firstRowid, 1);
25645
+ }
25646
+ else {
25647
+ if (currSeq > lastSeq) {
25648
+ matchStartRowid = handleGetSelectParentRowid(lastRowid);
25649
+ }
25650
+ else {
25651
+ matchStartRowid = handleGetChildRowid(firstRowid, 0);
25652
+ }
25653
+ matchEndRowid = handleGetChildRowid(currRowid, 1);
25654
+ }
25655
+ const handleRangeRow = (item) => {
25656
+ const rowid = handleGetRowId(item);
25657
+ const childList = item[iteratorChildField];
25658
+ if (!isMatchFirst && rowid === matchStartRowid) {
25659
+ isMatchFirst = true;
25660
+ }
25661
+ // 如果是父子关联,则排除父节点
25662
+ if (isMatchFirst && (checkStrictly || !childList || !childList.length)) {
25663
+ rangeRows.push(item);
25664
+ }
25665
+ // break
25666
+ return rowid === matchEndRowid;
25667
+ };
25668
+ if (treeConfig) {
25669
+ const matchStartRowRest = fullAllDataRowIdData[matchStartRowid];
25670
+ const firstRootRowRest = matchStartRowRest ? handleGetRootRow(matchStartRowRest.row) : null;
25671
+ if (firstRootRowRest) {
25672
+ // 优化查找复杂度
25673
+ XEUtils.findTree(afterTreeFullData.slice(firstRootRowRest.treeIndex), handleRangeRow, { children: iteratorChildField });
25674
+ }
25675
+ else {
25676
+ XEUtils.findTree(afterTreeFullData, handleRangeRow, { children: iteratorChildField });
25677
+ }
25678
+ }
25679
+ else {
25680
+ XEUtils.findTree(afterGroupFullData, handleRangeRow, { children: iteratorChildField });
25681
+ }
25682
+ }
25683
+ else {
25684
+ const _currRowIndex = $xeTable.getVTRowIndex(currRow);
25685
+ const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
25686
+ const _lastRowIndex = $xeTable.getVTRowIndex(lastRow);
25687
+ if (_currRowIndex < _firstRowIndex) {
25688
+ rangeRows = afterFullData.slice(_currRowIndex, _firstRowIndex + 1);
25689
+ }
25690
+ else if (_currRowIndex > _lastRowIndex) {
25691
+ rangeRows = afterFullData.slice(_lastRowIndex, _currRowIndex + 1);
25692
+ }
25693
+ else {
25694
+ rangeRows = afterFullData.slice(_firstRowIndex, _currRowIndex + 1);
25695
+ }
25696
+ }
25544
25697
  $xeTable.setAllCheckboxRow(false);
25545
- const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
25546
25698
  nextTick(() => {
25547
25699
  handleCheckedCheckboxRow(rangeRows, true, false);
25548
25700
  });
25549
25701
  dispatchEvent('checkbox-range-select', Object.assign({ rangeRecords: rangeRows }, params), evnt);
25550
- return;
25551
25702
  }
25552
25703
  }
25553
25704
  }
25554
- if (isRowGroupStatus || !checkMethod || checkMethod({ $table: $xeTable, row })) {
25705
+ if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
25555
25706
  $xeTable.handleBatchSelectRows([row], checked);
25556
25707
  $xeTable.checkSelectionStatus();
25557
25708
  dispatchEvent('checkbox-change', Object.assign({
@@ -29040,9 +29191,6 @@ var VxeTableComponent = defineVxeComponent({
29040
29191
  if (props.editConfig && editOpts.activeMethod) {
29041
29192
  warnLog('vxe.error.delProp', ['edit-config.activeMethod', 'edit-config.beforeEditMethod']);
29042
29193
  }
29043
- if (props.treeConfig && checkboxOpts.isShiftKey) {
29044
- errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey']);
29045
- }
29046
29194
  if (checkboxOpts.halfField) {
29047
29195
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
29048
29196
  }