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
@@ -77,7 +77,7 @@ hooks.add('tableEditModule', {
77
77
  }
78
78
  pChilds[funcName](item);
79
79
  pMapChilds[funcName](item);
80
- 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 };
80
+ 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 };
81
81
  fullDataRowIdData[rowid] = rest;
82
82
  fullAllDataRowIdData[rowid] = rest;
83
83
  }
@@ -87,7 +87,7 @@ hooks.add('tableEditModule', {
87
87
  }
88
88
  afterFullData[funcName](item);
89
89
  tableFullTreeData[funcName](item);
90
- 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 };
90
+ 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 };
91
91
  fullDataRowIdData[rowid] = rest;
92
92
  fullAllDataRowIdData[rowid] = rest;
93
93
  }
@@ -137,7 +137,7 @@ hooks.add('tableEditModule', {
137
137
  else {
138
138
  newRecords.forEach(item => {
139
139
  const rowid = getRowid($xeTable, item);
140
- 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 };
140
+ 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 };
141
141
  fullDataRowIdData[rowid] = rest;
142
142
  fullAllDataRowIdData[rowid] = rest;
143
143
  afterFullData.unshift(item);
@@ -169,7 +169,7 @@ hooks.add('tableEditModule', {
169
169
  else {
170
170
  newRecords.forEach(item => {
171
171
  const rowid = getRowid($xeTable, item);
172
- 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 };
172
+ 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 };
173
173
  fullDataRowIdData[rowid] = rest;
174
174
  fullAllDataRowIdData[rowid] = rest;
175
175
  afterFullData.push(item);
@@ -209,7 +209,7 @@ hooks.add('tableEditModule', {
209
209
  });
210
210
  XEUtils.eachTree(treeRecords, (item) => {
211
211
  const rowid = getRowid($xeTable, item);
212
- 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 };
212
+ 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 };
213
213
  if (item[childrenField]) {
214
214
  item[mapChildrenField] = item[childrenField];
215
215
  }
@@ -42,7 +42,7 @@ export default defineVxeComponent({
42
42
  return options.every(item => item.visible === false)
43
43
  ? renderEmptyElement($xeTable)
44
44
  : h('ul', {
45
- class: 'vxe-context-menu--option-wrapper',
45
+ class: 'vxe-table--context-menu-group-wrapper',
46
46
  key: gIndex
47
47
  }, options.map((item, index) => {
48
48
  const { children, loading } = item;
@@ -55,7 +55,7 @@ export default defineVxeComponent({
55
55
  return item.visible === false
56
56
  ? renderEmptyElement($xeTable)
57
57
  : h('li', {
58
- class: [item.className, {
58
+ class: ['vxe-table--context-menu--option', item.className, {
59
59
  'link--loading': loading,
60
60
  'link--disabled': item.disabled,
61
61
  'link--active': item === ctxMenuStore.selected
@@ -105,12 +105,12 @@ export default defineVxeComponent({
105
105
  suffixOpts.content ? h('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)
106
106
  ])
107
107
  ]),
108
- hasChildMenus && item.children
108
+ hasChildMenus && children
109
109
  ? h('ul', {
110
110
  class: ['vxe-table--context-menu-clild-wrapper', {
111
111
  'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
112
112
  }]
113
- }, item.children.map((child, cIndex) => {
113
+ }, children.map((child, cIndex) => {
114
114
  const { loading: childLoading } = child;
115
115
  const childPrefixOpts = Object.assign({}, child.prefixConfig);
116
116
  const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
@@ -120,7 +120,7 @@ export default defineVxeComponent({
120
120
  return child.visible === false
121
121
  ? null
122
122
  : h('li', {
123
- class: [child.className, {
123
+ class: ['vxe-table--context-menu--option', child.className, {
124
124
  'link--loading': childLoading,
125
125
  'link--disabled': child.disabled,
126
126
  'link--active': child === ctxMenuStore.selectChild
@@ -1,6 +1,6 @@
1
1
  import { h, reactive, ref, provide, inject, nextTick, Teleport, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
2
2
  import { defineVxeComponent } from '../../ui/src/comp';
3
- import XEUtils from 'xe-utils';
3
+ import XEUtils, { isNaN } from 'xe-utils';
4
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasEventInputTarget } from '../../ui/src/dom';
5
5
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
6
6
  import { VxeUI } from '../../ui';
@@ -584,22 +584,32 @@ export default defineVxeComponent({
584
584
  const { tableFullColumn } = internalData;
585
585
  const { updateColFlag } = reactData;
586
586
  const editDirtyOpts = computeEditDirtyOpts.value;
587
- const { includeFields, excludeFields } = editDirtyOpts;
587
+ const { extraFields, includeFields, excludeFields } = editDirtyOpts;
588
588
  const kpFields = [];
589
589
  if (updateColFlag) {
590
590
  if (includeFields && includeFields.length) {
591
591
  return includeFields;
592
592
  }
593
- const exfMaps = {};
593
+ const excludeFdMaps = {};
594
594
  if (excludeFields && excludeFields.length) {
595
595
  excludeFields.forEach(field => {
596
- exfMaps[field] = 1;
596
+ excludeFdMaps[field] = 1;
597
+ });
598
+ }
599
+ const addFdMaps = {};
600
+ if (extraFields && extraFields.length) {
601
+ extraFields.forEach(field => {
602
+ if (!addFdMaps[field]) {
603
+ addFdMaps[field] = 1;
604
+ kpFields.push(field);
605
+ }
597
606
  });
598
607
  }
599
608
  for (let i = 0; i < tableFullColumn.length; i++) {
600
609
  const column = tableFullColumn[i];
601
610
  const { field, type, editRender, cellRender } = column;
602
- if (field && !type && (editRender || cellRender) && !exfMaps[field]) {
611
+ if (field && !type && (editRender || cellRender) && !addFdMaps[field] && !excludeFdMaps[field]) {
612
+ addFdMaps[field] = 1;
603
613
  kpFields.push(field);
604
614
  }
605
615
  }
@@ -2071,26 +2081,63 @@ export default defineVxeComponent({
2071
2081
  return cellValue;
2072
2082
  };
2073
2083
  };
2084
+ const updateAfterTreeIndex = () => {
2085
+ const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
2086
+ const treeOpts = computeTreeOpts.value;
2087
+ const { transform, mapChildrenField } = treeOpts;
2088
+ const childrenField = treeOpts.children || treeOpts.childrenField;
2089
+ const fullMaps = {};
2090
+ let rowNum = 0;
2091
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
2092
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
2093
+ const rowid = handleGetRowId(row);
2094
+ const rowRest = fullAllDataRowIdData[rowid];
2095
+ const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
2096
+ if (rowRest) {
2097
+ rowRest.seq = seq;
2098
+ rowRest._seq = rowNum;
2099
+ rowRest.treeIndex = index;
2100
+ rowRest._tIndex = rowNum;
2101
+ }
2102
+ else {
2103
+ 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 };
2104
+ fullAllDataRowIdData[rowid] = rest;
2105
+ fullDataRowIdData[rowid] = rest;
2106
+ }
2107
+ rowNum++;
2108
+ fullMaps[rowid] = row;
2109
+ }, { children: transform ? mapChildrenField : childrenField });
2110
+ if (transform) {
2111
+ afterFullData.forEach((row, index) => {
2112
+ const rowid = handleGetRowId(row);
2113
+ const rowRest = fullAllDataRowIdData[rowid];
2114
+ if (rowRest) {
2115
+ rowRest._index = index;
2116
+ }
2117
+ });
2118
+ }
2119
+ internalData.afterFullRowMaps = fullMaps;
2120
+ };
2074
2121
  const updateAfterListIndex = () => {
2075
- const { treeConfig } = props;
2076
2122
  const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
2077
2123
  const { handleGetRowId } = createHandleGetRowId($xeTable);
2078
2124
  const fullMaps = {};
2125
+ let rowNum = 0;
2079
2126
  afterFullData.forEach((row, index) => {
2080
2127
  const rowid = handleGetRowId(row);
2081
2128
  const rowRest = fullAllDataRowIdData[rowid];
2082
2129
  const seq = index + 1;
2083
2130
  if (rowRest) {
2084
- if (!treeConfig) {
2085
- rowRest.seq = seq;
2086
- }
2131
+ rowRest.seq = seq;
2132
+ rowRest._seq = rowNum;
2087
2133
  rowRest._index = index;
2088
2134
  }
2089
2135
  else {
2090
- 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 };
2136
+ 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 };
2091
2137
  fullAllDataRowIdData[rowid] = rest;
2092
2138
  fullDataRowIdData[rowid] = rest;
2093
2139
  }
2140
+ rowNum++;
2094
2141
  fullMaps[rowid] = row;
2095
2142
  });
2096
2143
  internalData.afterFullRowMaps = fullMaps;
@@ -2101,45 +2148,8 @@ export default defineVxeComponent({
2101
2148
  */
2102
2149
  const updateAfterDataIndex = () => {
2103
2150
  const { treeConfig } = props;
2104
- const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData;
2105
- const treeOpts = computeTreeOpts.value;
2106
- const { transform } = treeOpts;
2107
- const childrenField = treeOpts.children || treeOpts.childrenField;
2108
- const fullMaps = {};
2109
2151
  if (treeConfig) {
2110
- let _treeIndex = 0;
2111
- const { handleGetRowId } = createHandleGetRowId($xeTable);
2112
- XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
2113
- const rowid = handleGetRowId(row);
2114
- const rowRest = fullAllDataRowIdData[rowid];
2115
- const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
2116
- if (rowRest) {
2117
- rowRest.seq = seq;
2118
- rowRest.treeIndex = index;
2119
- rowRest._tIndex = _treeIndex;
2120
- }
2121
- else {
2122
- 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 };
2123
- fullAllDataRowIdData[rowid] = rest;
2124
- fullDataRowIdData[rowid] = rest;
2125
- }
2126
- _treeIndex++;
2127
- fullMaps[rowid] = row;
2128
- }, { children: transform ? treeOpts.mapChildrenField : childrenField });
2129
- if (transform) {
2130
- afterFullData.forEach((row, index) => {
2131
- const rowid = handleGetRowId(row);
2132
- const rowRest = fullAllDataRowIdData[rowid];
2133
- const seq = index + 1;
2134
- if (rowRest) {
2135
- if (!treeConfig) {
2136
- rowRest.seq = seq;
2137
- }
2138
- rowRest._index = index;
2139
- }
2140
- });
2141
- }
2142
- internalData.afterFullRowMaps = fullMaps;
2152
+ updateAfterTreeIndex();
2143
2153
  }
2144
2154
  else {
2145
2155
  updateAfterListIndex();
@@ -3335,8 +3345,9 @@ export default defineVxeComponent({
3335
3345
  }
3336
3346
  });
3337
3347
  };
3338
- const minRunDelay = 50;
3339
- const handleLazyRecalculate = (reFull, reWidth, reHeight) => {
3348
+ const defaultMinRunDelay = 50;
3349
+ const handleLazyRecalculate = (reFull, reWidth, reHeight, options) => {
3350
+ const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay;
3340
3351
  return new Promise(resolve => {
3341
3352
  const $xeGanttView = internalData.xeGanttView;
3342
3353
  const { customStore } = reactData;
@@ -3363,6 +3374,7 @@ export default defineVxeComponent({
3363
3374
  }
3364
3375
  if (rceTimeout) {
3365
3376
  clearTimeout(rceTimeout);
3377
+ // 多少毫秒内至少执行一次
3366
3378
  if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
3367
3379
  resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
3368
3380
  }
@@ -3387,16 +3399,17 @@ export default defineVxeComponent({
3387
3399
  }, reDelay);
3388
3400
  });
3389
3401
  };
3390
- let resizePending = false;
3391
3402
  const handleResizeEvent = () => {
3392
- if (resizePending) {
3403
+ if (internalData.rsePending) {
3393
3404
  return;
3394
3405
  }
3395
- resizePending = true;
3396
- handleLazyRecalculate(true, true, true).then(() => {
3397
- resizePending = false;
3406
+ internalData.rsePending = true;
3407
+ handleLazyRecalculate(true, true, true, {
3408
+ minRunDelay: 200
3409
+ }).then(() => {
3410
+ internalData.rsePending = false;
3398
3411
  }).catch(() => {
3399
- resizePending = false;
3412
+ internalData.rsePending = false;
3400
3413
  });
3401
3414
  };
3402
3415
  const handleUpdateAggValues = () => {
@@ -4170,7 +4183,11 @@ export default defineVxeComponent({
4170
4183
  const { transform } = treeOpts;
4171
4184
  const allList = fullData || internalData.tableFullData;
4172
4185
  // 如果gt为0,则总是启用
4173
- const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
4186
+ let scrollYLoad = !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
4187
+ if (scrollYLoad && (treeConfig && !transform)) {
4188
+ errLog('vxe.error.notSupportProp', ['[table] virtual-y-config.enabled=true', 'tree-config.transform=false', 'tree-config.transform=true']);
4189
+ scrollYLoad = false;
4190
+ }
4174
4191
  reactData.scrollYLoad = scrollYLoad;
4175
4192
  syncGanttScrollYStatus();
4176
4193
  return scrollYLoad;
@@ -4980,7 +4997,7 @@ export default defineVxeComponent({
4980
4997
  XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
4981
4998
  const rowid = getRowid($xeTable, childRow);
4982
4999
  const parentRow = parentItem || parentRest.row;
4983
- 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 };
5000
+ 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 };
4984
5001
  fullDataRowIdData[rowid] = rest;
4985
5002
  fullAllDataRowIdData[rowid] = rest;
4986
5003
  }, { children: childrenField });
@@ -9394,18 +9411,20 @@ export default defineVxeComponent({
9394
9411
  const fullDataRowIdMaps = {};
9395
9412
  const idMaps = {};
9396
9413
  const { handleUpdateRowId } = createHandleUpdateRowId($xeTable);
9414
+ let rowNum = 0;
9397
9415
  const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
9398
9416
  let rowRest = fullAllDataRowIdMaps[rowid];
9399
9417
  if (idMaps[rowid]) {
9400
9418
  errLog('vxe.error.repeatKey', [currKeyField, rowid]);
9401
9419
  }
9402
9420
  if (!rowRest) {
9403
- 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 };
9421
+ 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 };
9404
9422
  fullDataRowIdMaps[rowid] = rowRest;
9405
9423
  fullAllDataRowIdMaps[rowid] = rowRest;
9406
9424
  }
9407
9425
  rowRest.treeLoaded = false;
9408
9426
  rowRest.expandLoaded = false;
9427
+ rowRest._seq = rowNum++;
9409
9428
  rowRest.row = row;
9410
9429
  rowRest.items = items;
9411
9430
  rowRest.parent = parentRow;
@@ -9419,6 +9438,7 @@ export default defineVxeComponent({
9419
9438
  if (rowExpandedMaps[rowid]) {
9420
9439
  rowExpandedMaps[rowid] = row;
9421
9440
  }
9441
+ rowNum++;
9422
9442
  idMaps[rowid] = true;
9423
9443
  fullDataRowIdMaps[rowid] = rowRest;
9424
9444
  fullAllDataRowIdMaps[rowid] = rowRest;
@@ -9430,7 +9450,7 @@ export default defineVxeComponent({
9430
9450
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
9431
9451
  XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
9432
9452
  const rowid = handleUpdateRowId(row);
9433
- if (treeConfig && lazy) {
9453
+ if (lazy) {
9434
9454
  if (row[hasChildField] && row[childrenField] === undefined) {
9435
9455
  row[childrenField] = null;
9436
9456
  }
@@ -10719,31 +10739,162 @@ export default defineVxeComponent({
10719
10739
  const { treeConfig } = props;
10720
10740
  const { row } = params;
10721
10741
  const { isRowGroupStatus } = reactData;
10722
- const { afterFullData } = internalData;
10742
+ const { fullAllDataRowIdData, afterFullData, afterTreeFullData, afterGroupFullData } = internalData;
10723
10743
  const checkboxOpts = computeCheckboxOpts.value;
10724
- const { checkMethod, trigger } = checkboxOpts;
10744
+ const aggregateOpts = computeAggregateOpts.value;
10745
+ const treeOpts = computeTreeOpts.value;
10746
+ const { checkMethod, trigger, checkStrictly } = checkboxOpts;
10725
10747
  if (trigger === 'manual') {
10726
10748
  return;
10727
10749
  }
10728
10750
  evnt.stopPropagation();
10729
- if (checkboxOpts.isShiftKey && evnt.shiftKey && !(treeConfig || isRowGroupStatus)) {
10751
+ if (checkboxOpts.isShiftKey && evnt.shiftKey) {
10752
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
10730
10753
  const checkboxRecords = $xeTable.getCheckboxRecords();
10731
- if (checkboxRecords.length) {
10732
- const firstRow = checkboxRecords[0];
10733
- const _rowIndex = $xeTable.getVTRowIndex(row);
10734
- const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
10735
- if (_rowIndex !== _firstRowIndex) {
10754
+ let currSeq = -1;
10755
+ let currRow = null;
10756
+ const currRowid = handleGetRowId(row);
10757
+ const rowRest = fullAllDataRowIdData[currRowid];
10758
+ if (rowRest) {
10759
+ currRow = rowRest.row;
10760
+ currSeq = rowRest._seq;
10761
+ }
10762
+ if (currRow && checkboxRecords.length) {
10763
+ let rangeRows = [];
10764
+ let firstSeq = -1;
10765
+ let firstRow = null;
10766
+ let firstRowid = '';
10767
+ let lastSeq = -1;
10768
+ let lastRow = null;
10769
+ let lastRowid = '';
10770
+ // 根据序号取出范围最小/最大的行
10771
+ const selectMaps = {};
10772
+ checkboxRecords.forEach(item => {
10773
+ const rowid = handleGetRowId(item);
10774
+ const rowRest = fullAllDataRowIdData[rowid];
10775
+ if (rowRest) {
10776
+ if (!firstRow || firstSeq > rowRest._seq) {
10777
+ firstRowid = rowRest.rowid;
10778
+ firstRow = rowRest.row;
10779
+ firstSeq = rowRest._seq;
10780
+ }
10781
+ if (!lastRow || lastSeq < rowRest._seq) {
10782
+ lastRowid = rowRest.rowid;
10783
+ lastRow = rowRest.row;
10784
+ lastSeq = rowRest._seq;
10785
+ }
10786
+ }
10787
+ selectMaps[rowid] = item;
10788
+ });
10789
+ // 如果已选只有一条并选择当前则跳过
10790
+ if (firstRow && lastRow && (checkboxRecords.length > 1 || currRowid !== firstRowid) && (Math.abs(firstSeq - lastSeq) > 1 || Math.abs(currSeq - firstSeq) > 1 || Math.abs(currSeq - lastSeq) > 1)) {
10791
+ // 树与分组
10792
+ if (treeConfig || isRowGroupStatus) {
10793
+ const { transform } = treeOpts;
10794
+ const childrenField = treeOpts.children || treeOpts.childrenField;
10795
+ const iteratorChildField = treeConfig ? (transform ? treeOpts.mapChildrenField : childrenField) : aggregateOpts.mapChildrenField;
10796
+ let isMatchFirst = false;
10797
+ let matchStartRowid = '';
10798
+ let matchEndRowid = '';
10799
+ const handleGetChildRowid = (rowid, isLast) => {
10800
+ const rowRest = fullAllDataRowIdData[rowid];
10801
+ if (rowRest) {
10802
+ const item = rowRest.row;
10803
+ const childList = item[iteratorChildField];
10804
+ if (childList && childList.length) {
10805
+ const targetRow = isLast ? XEUtils.last(childList) : XEUtils.first(childList);
10806
+ return handleGetChildRowid(handleGetRowId(targetRow), isLast);
10807
+ }
10808
+ }
10809
+ return rowid;
10810
+ };
10811
+ const handleGetSelectParentRowid = (rowid) => {
10812
+ const rowRest = fullAllDataRowIdData[rowid];
10813
+ if (rowRest) {
10814
+ const parentItem = rowRest.parent;
10815
+ if (parentItem) {
10816
+ const parentRowid = handleGetRowId(parentItem);
10817
+ if (selectMaps[parentRowid]) {
10818
+ return handleGetSelectParentRowid(parentRowid);
10819
+ }
10820
+ }
10821
+ }
10822
+ return rowid;
10823
+ };
10824
+ const handleGetRootRow = (row) => {
10825
+ const rowid = handleGetRowId(row);
10826
+ if (rowid) {
10827
+ const rest = fullAllDataRowIdData[rowid];
10828
+ if (rest) {
10829
+ return rest.parent ? handleGetRootRow(rest.parent) : rest;
10830
+ }
10831
+ }
10832
+ return null;
10833
+ };
10834
+ if (currSeq < firstSeq) {
10835
+ matchStartRowid = handleGetChildRowid(currRowid, 0);
10836
+ matchEndRowid = handleGetChildRowid(firstRowid, 1);
10837
+ }
10838
+ else {
10839
+ if (currSeq > lastSeq) {
10840
+ matchStartRowid = handleGetSelectParentRowid(lastRowid);
10841
+ }
10842
+ else {
10843
+ matchStartRowid = handleGetChildRowid(firstRowid, 0);
10844
+ }
10845
+ matchEndRowid = handleGetChildRowid(currRowid, 1);
10846
+ }
10847
+ const handleRangeRow = (item) => {
10848
+ const rowid = handleGetRowId(item);
10849
+ const childList = item[iteratorChildField];
10850
+ if (!isMatchFirst && rowid === matchStartRowid) {
10851
+ isMatchFirst = true;
10852
+ }
10853
+ // 如果是父子关联,则排除父节点
10854
+ if (isMatchFirst && (checkStrictly || !childList || !childList.length)) {
10855
+ rangeRows.push(item);
10856
+ }
10857
+ // break
10858
+ return rowid === matchEndRowid;
10859
+ };
10860
+ if (treeConfig) {
10861
+ const matchStartRowRest = fullAllDataRowIdData[matchStartRowid];
10862
+ const firstRootRowRest = matchStartRowRest ? handleGetRootRow(matchStartRowRest.row) : null;
10863
+ if (firstRootRowRest) {
10864
+ // 优化查找复杂度
10865
+ XEUtils.findTree(afterTreeFullData.slice(firstRootRowRest.treeIndex), handleRangeRow, { children: iteratorChildField });
10866
+ }
10867
+ else {
10868
+ XEUtils.findTree(afterTreeFullData, handleRangeRow, { children: iteratorChildField });
10869
+ }
10870
+ }
10871
+ else {
10872
+ XEUtils.findTree(afterGroupFullData, handleRangeRow, { children: iteratorChildField });
10873
+ }
10874
+ }
10875
+ else {
10876
+ const _currRowIndex = $xeTable.getVTRowIndex(currRow);
10877
+ const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
10878
+ const _lastRowIndex = $xeTable.getVTRowIndex(lastRow);
10879
+ if (_currRowIndex < _firstRowIndex) {
10880
+ rangeRows = afterFullData.slice(_currRowIndex, _firstRowIndex + 1);
10881
+ }
10882
+ else if (_currRowIndex > _lastRowIndex) {
10883
+ rangeRows = afterFullData.slice(_lastRowIndex, _currRowIndex + 1);
10884
+ }
10885
+ else {
10886
+ rangeRows = afterFullData.slice(_firstRowIndex, _currRowIndex + 1);
10887
+ }
10888
+ }
10736
10889
  $xeTable.setAllCheckboxRow(false);
10737
- const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
10738
10890
  nextTick(() => {
10739
10891
  handleCheckedCheckboxRow(rangeRows, true, false);
10740
10892
  });
10741
10893
  dispatchEvent('checkbox-range-select', Object.assign({ rangeRecords: rangeRows }, params), evnt);
10742
- return;
10743
10894
  }
10744
10895
  }
10745
10896
  }
10746
- if (isRowGroupStatus || !checkMethod || checkMethod({ $table: $xeTable, row })) {
10897
+ if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
10747
10898
  $xeTable.handleBatchSelectRows([row], checked);
10748
10899
  $xeTable.checkSelectionStatus();
10749
10900
  dispatchEvent('checkbox-change', Object.assign({
@@ -14236,9 +14387,6 @@ export default defineVxeComponent({
14236
14387
  if (props.editConfig && editOpts.activeMethod) {
14237
14388
  warnLog('vxe.error.delProp', ['edit-config.activeMethod', 'edit-config.beforeEditMethod']);
14238
14389
  }
14239
- if (props.treeConfig && checkboxOpts.isShiftKey) {
14240
- errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey']);
14241
- }
14242
14390
  if (checkboxOpts.halfField) {
14243
14391
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
14244
14392
  }
@@ -1698,13 +1698,17 @@
1698
1698
  background-color: var(--vxe-ui-layout-background-color);
1699
1699
  }
1700
1700
 
1701
+ .vxe-context-menu--option {
1702
+ color: var(--vxe-ui-font-color);
1703
+ }
1704
+
1701
1705
  .vxe-context-menu--link {
1702
1706
  display: flex;
1703
1707
  flex-direction: row;
1704
1708
  width: var(--vxe-ui-table-menu-item-width);
1705
1709
  line-height: 26px;
1706
1710
  padding: 0 0.8em;
1707
- color: var(--vxe-ui-font-color);
1711
+ color: inherit;
1708
1712
  cursor: pointer;
1709
1713
  }
1710
1714
  .vxe-context-menu--link .vxe-context-menu--link-prefix,
@@ -1722,35 +1726,35 @@
1722
1726
  white-space: nowrap;
1723
1727
  }
1724
1728
 
1725
- .vxe-context-menu--option-wrapper,
1729
+ .vxe-table--context-menu-group-wrapper,
1726
1730
  .vxe-table--context-menu-clild-wrapper {
1727
1731
  margin: 0;
1728
1732
  padding: 0;
1729
1733
  list-style-type: none;
1730
1734
  border-bottom: 1px solid var(--vxe-ui-base-popup-border-color);
1731
1735
  }
1732
- .vxe-context-menu--option-wrapper li,
1736
+ .vxe-table--context-menu-group-wrapper li,
1733
1737
  .vxe-table--context-menu-clild-wrapper li {
1734
1738
  position: relative;
1735
1739
  margin: 1px 0;
1736
1740
  border: 1px solid transparent;
1737
1741
  }
1738
- .vxe-context-menu--option-wrapper li:last-child,
1742
+ .vxe-table--context-menu-group-wrapper li:last-child,
1739
1743
  .vxe-table--context-menu-clild-wrapper li:last-child {
1740
1744
  border: 0;
1741
1745
  }
1742
- .vxe-context-menu--option-wrapper li.link--active,
1746
+ .vxe-table--context-menu-group-wrapper li.link--active,
1743
1747
  .vxe-table--context-menu-clild-wrapper li.link--active {
1744
1748
  background-color: var(--vxe-ui-base-hover-background-color);
1745
1749
  border-color: var(--vxe-ui-base-hover-background-color);
1746
1750
  }
1747
- .vxe-context-menu--option-wrapper li.link--loading > .vxe-context-menu--link, .vxe-context-menu--option-wrapper li.link--disabled > .vxe-context-menu--link,
1751
+ .vxe-table--context-menu-group-wrapper li.link--loading > .vxe-context-menu--link, .vxe-table--context-menu-group-wrapper li.link--disabled > .vxe-context-menu--link,
1748
1752
  .vxe-table--context-menu-clild-wrapper li.link--loading > .vxe-context-menu--link,
1749
1753
  .vxe-table--context-menu-clild-wrapper li.link--disabled > .vxe-context-menu--link {
1750
1754
  color: var(--vxe-ui-font-disabled-color);
1751
1755
  cursor: no-drop;
1752
1756
  }
1753
- .vxe-context-menu--option-wrapper li.link--loading.link--active:hover, .vxe-context-menu--option-wrapper li.link--disabled.link--active:hover,
1757
+ .vxe-table--context-menu-group-wrapper li.link--loading.link--active:hover, .vxe-table--context-menu-group-wrapper li.link--disabled.link--active:hover,
1754
1758
  .vxe-table--context-menu-clild-wrapper li.link--loading.link--active:hover,
1755
1759
  .vxe-table--context-menu-clild-wrapper li.link--disabled.link--active:hover {
1756
1760
  background-color: inherit;