vxe-table 4.3.9 → 4.3.10

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 (53) hide show
  1. package/README.en.md +3 -3
  2. package/README.md +3 -3
  3. package/README.zh-TW.md +3 -3
  4. package/es/grid/src/grid.js +51 -21
  5. package/es/icon/style/{iconfont.1673363035817.ttf → iconfont.1676040467680.ttf} +0 -0
  6. package/es/icon/style/{iconfont.1673363035817.woff → iconfont.1676040467680.woff} +0 -0
  7. package/es/icon/style/{iconfont.1673363035817.woff2 → iconfont.1676040467680.woff2} +0 -0
  8. package/es/icon/style.css +1 -1
  9. package/es/{iconfont.1673363035817.ttf → iconfont.1676040467680.ttf} +0 -0
  10. package/es/{iconfont.1673363035817.woff → iconfont.1676040467680.woff} +0 -0
  11. package/es/{iconfont.1673363035817.woff2 → iconfont.1676040467680.woff2} +0 -0
  12. package/es/list/src/list.js +4 -1
  13. package/es/pager/src/pager.js +1 -1
  14. package/es/style.css +1 -1
  15. package/es/style.min.css +1 -1
  16. package/es/table/src/table.js +151 -138
  17. package/es/toolbar/src/toolbar.js +2 -2
  18. package/es/tools/log.js +1 -1
  19. package/es/v-x-e-table/index.js +1 -1
  20. package/lib/grid/src/grid.js +72 -26
  21. package/lib/grid/src/grid.min.js +1 -1
  22. package/lib/icon/style/{iconfont.1673363035817.ttf → iconfont.1676040467680.ttf} +0 -0
  23. package/lib/icon/style/{iconfont.1673363035817.woff → iconfont.1676040467680.woff} +0 -0
  24. package/lib/icon/style/{iconfont.1673363035817.woff2 → iconfont.1676040467680.woff2} +0 -0
  25. package/lib/icon/style/style.css +1 -1
  26. package/lib/icon/style/style.min.css +1 -1
  27. package/lib/{iconfont.1673363035817.ttf → iconfont.1676040467680.ttf} +0 -0
  28. package/lib/{iconfont.1673363035817.woff → iconfont.1676040467680.woff} +0 -0
  29. package/lib/{iconfont.1673363035817.woff2 → iconfont.1676040467680.woff2} +0 -0
  30. package/lib/index.umd.js +264 -188
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/list/src/list.js +5 -0
  33. package/lib/list/src/list.min.js +1 -1
  34. package/lib/pager/src/pager.js +1 -1
  35. package/lib/pager/src/pager.min.js +1 -1
  36. package/lib/style.css +1 -1
  37. package/lib/style.min.css +1 -1
  38. package/lib/table/src/table.js +172 -159
  39. package/lib/table/src/table.min.js +1 -1
  40. package/lib/toolbar/src/toolbar.js +4 -2
  41. package/lib/toolbar/src/toolbar.min.js +1 -1
  42. package/lib/tools/log.js +1 -1
  43. package/lib/tools/log.min.js +1 -1
  44. package/lib/v-x-e-table/index.js +1 -1
  45. package/lib/v-x-e-table/index.min.js +1 -1
  46. package/package.json +1 -1
  47. package/packages/grid/src/grid.ts +50 -20
  48. package/packages/list/src/list.ts +5 -1
  49. package/packages/pager/src/pager.ts +1 -1
  50. package/packages/table/src/table.ts +146 -130
  51. package/packages/toolbar/src/toolbar.ts +2 -2
  52. package/types/grid.d.ts +4 -0
  53. package/types/table.d.ts +1 -1
package/lib/index.umd.js CHANGED
@@ -2260,7 +2260,7 @@ const GlobalConfig = {
2260
2260
  ;// CONCATENATED MODULE: ./packages/tools/log.ts
2261
2261
 
2262
2262
  function getLog(message, params) {
2263
- return `[vxe-table v${"4.3.9"}] ${conf.i18n(message, params)}`;
2263
+ return `[vxe-table v${"4.3.10"}] ${conf.i18n(message, params)}`;
2264
2264
  }
2265
2265
  function outLog(type) {
2266
2266
  return function (message, params) {
@@ -4057,7 +4057,7 @@ const config = new VXETableConfig();
4057
4057
  const v = 'v4';
4058
4058
  const VXETable = {
4059
4059
  v,
4060
- version: "4.3.9",
4060
+ version: "4.3.10",
4061
4061
  setup: setup,
4062
4062
  interceptor: interceptor,
4063
4063
  renderer: renderer,
@@ -16553,7 +16553,7 @@ dynamicApp.component('VxeTableColgroup', src_group);
16553
16553
 
16554
16554
  const tableComponentPropKeys = Object.keys(props);
16555
16555
  const tableComponentMethodKeys = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'createData', 'createRow', 'revertData', 'clearData', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getData', 'getCheckboxRecords', 'getParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'isCheckedByCheckboxRow', 'isIndeterminateByCheckboxRow', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'setRadioRow', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'sort', 'clearSort', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'openTooltip', 'focus', 'blur', 'connect'];
16556
- const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
16556
+ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'proxy-query', 'proxy-delete', 'proxy-save', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
16557
16557
  /* harmony default export */ var grid = ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
16558
16558
  name: 'VxeGrid',
16559
16559
  props: {
@@ -16842,7 +16842,7 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16842
16842
  escClosable: true
16843
16843
  }).then(type => {
16844
16844
  if (type === 'confirm') {
16845
- callback();
16845
+ return callback();
16846
16846
  }
16847
16847
  });
16848
16848
  } else {
@@ -16880,7 +16880,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16880
16880
  tablePage.pageSize = pageSize;
16881
16881
  gridMethods.dispatchEvent('page-change', params);
16882
16882
  if (proxyConfig) {
16883
- gridMethods.commitProxy('query');
16883
+ gridMethods.commitProxy('query').then(rest => {
16884
+ gridMethods.dispatchEvent('proxy-query', rest, params.$event);
16885
+ });
16884
16886
  }
16885
16887
  };
16886
16888
  const sortChangeEvent = params => {
@@ -16897,7 +16899,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16897
16899
  reactData.sortData = params.sortList;
16898
16900
  if (proxyConfig) {
16899
16901
  reactData.tablePage.currentPage = 1;
16900
- gridMethods.commitProxy('query');
16902
+ gridMethods.commitProxy('query').then(rest => {
16903
+ gridMethods.dispatchEvent('proxy-query', rest, params.$event);
16904
+ });
16901
16905
  }
16902
16906
  }
16903
16907
  gridMethods.dispatchEvent('sort-change', params);
@@ -16916,7 +16920,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16916
16920
  reactData.filterData = params.filterList;
16917
16921
  if (proxyConfig) {
16918
16922
  reactData.tablePage.currentPage = 1;
16919
- gridMethods.commitProxy('query');
16923
+ gridMethods.commitProxy('query').then(rest => {
16924
+ gridMethods.dispatchEvent('proxy-query', rest, params.$event);
16925
+ });
16920
16926
  }
16921
16927
  }
16922
16928
  gridMethods.dispatchEvent('filter-change', params);
@@ -16926,7 +16932,12 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16926
16932
  proxyConfig
16927
16933
  } = props;
16928
16934
  if (proxyConfig) {
16929
- gridMethods.commitProxy('reload');
16935
+ gridMethods.commitProxy('reload').then(rest => {
16936
+ gridMethods.dispatchEvent('proxy-query', {
16937
+ ...rest,
16938
+ isReload: true
16939
+ }, params.$event);
16940
+ });
16930
16941
  }
16931
16942
  gridMethods.dispatchEvent('form-submit', params);
16932
16943
  };
@@ -16935,7 +16946,12 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
16935
16946
  proxyConfig
16936
16947
  } = props;
16937
16948
  if (proxyConfig) {
16938
- gridMethods.commitProxy('reload');
16949
+ gridMethods.commitProxy('reload').then(rest => {
16950
+ gridMethods.dispatchEvent('proxy-query', {
16951
+ ...rest,
16952
+ isReload: true
16953
+ }, params.$event);
16954
+ });
16939
16955
  }
16940
16956
  gridMethods.dispatchEvent('form-reset', params);
16941
16957
  };
@@ -17232,7 +17248,12 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17232
17248
  if (!proxyInited) {
17233
17249
  reactData.proxyInited = true;
17234
17250
  if (proxyOpts.autoLoad !== false) {
17235
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => gridMethods.commitProxy('_init'));
17251
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => gridMethods.commitProxy('_init')).then(rest => {
17252
+ gridMethods.dispatchEvent('proxy-query', {
17253
+ ...rest,
17254
+ isInited: true
17255
+ }, new Event('init'));
17256
+ });
17236
17257
  }
17237
17258
  }
17238
17259
  }
@@ -17290,13 +17311,11 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17290
17311
  const btnParams = button ? button.params : null;
17291
17312
  switch (code) {
17292
17313
  case 'insert':
17293
- $xetable.insert({});
17294
- break;
17314
+ return $xetable.insert({});
17295
17315
  case 'insert_actived':
17296
- $xetable.insert({}).then(({
17316
+ return $xetable.insert({}).then(({
17297
17317
  row
17298
- }) => $xetable.setActiveRow(row));
17299
- break;
17318
+ }) => $xetable.setEditRow(row));
17300
17319
  case 'mark_cancel':
17301
17320
  triggerPendingEvent(code);
17302
17321
  break;
@@ -17315,8 +17334,7 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17315
17334
  $xetable.openExport(btnParams);
17316
17335
  break;
17317
17336
  case 'reset_custom':
17318
- $xetable.resetColumn(true);
17319
- break;
17337
+ return $xetable.resetColumn(true);
17320
17338
  case '_init':
17321
17339
  case 'reload':
17322
17340
  case 'query':
@@ -17367,9 +17385,11 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17367
17385
  filterList = $xetable.getCheckedFilters();
17368
17386
  }
17369
17387
  }
17370
- const params = {
17388
+ const commitParams = {
17371
17389
  code,
17372
17390
  button,
17391
+ isInited,
17392
+ isReload,
17373
17393
  $grid: $xegrid,
17374
17394
  page: pageParams,
17375
17395
  sort: sortList.length ? sortList[0] : {},
@@ -17381,8 +17401,8 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17381
17401
  reactData.sortData = sortList;
17382
17402
  reactData.filterData = filterList;
17383
17403
  reactData.tableLoading = true;
17384
- const applyArgs = [params].concat(args);
17385
- return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs)).catch(e => e).then(rest => {
17404
+ const applyArgs = [commitParams].concat(args);
17405
+ return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs)).then(rest => {
17386
17406
  reactData.tableLoading = false;
17387
17407
  if (rest) {
17388
17408
  if (isEnableConf(pagerConfig)) {
@@ -17403,6 +17423,13 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17403
17423
  if (afterQuery) {
17404
17424
  afterQuery(...applyArgs);
17405
17425
  }
17426
+ return {
17427
+ status: true
17428
+ };
17429
+ }).catch(() => {
17430
+ return {
17431
+ status: false
17432
+ };
17406
17433
  });
17407
17434
  } else {
17408
17435
  if (true) {
@@ -17420,13 +17447,14 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17420
17447
  const body = {
17421
17448
  removeRecords
17422
17449
  };
17423
- const applyArgs = [{
17450
+ const commitParams = {
17424
17451
  $grid: $xegrid,
17425
17452
  code,
17426
17453
  button,
17427
17454
  body,
17428
17455
  options: ajaxMethods
17429
- }].concat(args);
17456
+ };
17457
+ const applyArgs = [commitParams].concat(args);
17430
17458
  if (selectRecords.length) {
17431
17459
  return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
17432
17460
  if (!removeRecords.length) {
@@ -17453,6 +17481,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17453
17481
  } else {
17454
17482
  gridMethods.commitProxy('query');
17455
17483
  }
17484
+ return {
17485
+ status: true
17486
+ };
17456
17487
  }).catch(rest => {
17457
17488
  reactData.tableLoading = false;
17458
17489
  if (isMsg) {
@@ -17467,6 +17498,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17467
17498
  status: 'error'
17468
17499
  });
17469
17500
  }
17501
+ return {
17502
+ status: false
17503
+ };
17470
17504
  });
17471
17505
  });
17472
17506
  } else {
@@ -17504,13 +17538,14 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17504
17538
  updateRecords,
17505
17539
  pendingRecords
17506
17540
  } = body;
17507
- const applyArgs = [{
17541
+ const commitParams = {
17508
17542
  $grid: $xegrid,
17509
17543
  code,
17510
17544
  button,
17511
17545
  body,
17512
17546
  options: ajaxMethods
17513
- }].concat(args);
17547
+ };
17548
+ const applyArgs = [commitParams].concat(args);
17514
17549
  // 排除掉新增且标记为删除的数据
17515
17550
  if (insertRecords.length) {
17516
17551
  body.pendingRecords = pendingRecords.filter(row => $xetable.findRowIndexOf(insertRecords, row) === -1);
@@ -17551,6 +17586,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17551
17586
  } else {
17552
17587
  gridMethods.commitProxy('query');
17553
17588
  }
17589
+ return {
17590
+ status: true
17591
+ };
17554
17592
  }).catch(rest => {
17555
17593
  reactData.tableLoading = false;
17556
17594
  if (isMsg) {
@@ -17566,6 +17604,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17566
17604
  status: 'error'
17567
17605
  });
17568
17606
  }
17607
+ return {
17608
+ status: false
17609
+ };
17569
17610
  });
17570
17611
  } else {
17571
17612
  if (isMsg) {
@@ -17718,15 +17759,28 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
17718
17759
  }
17719
17760
  return 0;
17720
17761
  },
17762
+ triggerToolbarCommitEvent(params, evnt) {
17763
+ const {
17764
+ code
17765
+ } = params;
17766
+ return gridMethods.commitProxy(params, evnt).then(rest => {
17767
+ if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
17768
+ gridMethods.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', {
17769
+ ...rest,
17770
+ isReload: code === 'reload'
17771
+ }, evnt);
17772
+ }
17773
+ });
17774
+ },
17721
17775
  triggerToolbarBtnEvent(button, evnt) {
17722
- gridMethods.commitProxy(button, evnt);
17776
+ gridPrivateMethods.triggerToolbarCommitEvent(button, evnt);
17723
17777
  gridMethods.dispatchEvent('toolbar-button-click', {
17724
17778
  code: button.code,
17725
17779
  button
17726
17780
  }, evnt);
17727
17781
  },
17728
17782
  triggerToolbarTolEvent(tool, evnt) {
17729
- gridMethods.commitProxy(tool, evnt);
17783
+ gridPrivateMethods.triggerToolbarCommitEvent(tool, evnt);
17730
17784
  gridMethods.dispatchEvent('toolbar-tool-click', {
17731
17785
  code: tool.code,
17732
17786
  tool,
@@ -18108,7 +18162,7 @@ dynamicApp.component(grid.name, grid);
18108
18162
  }
18109
18163
  }, 300);
18110
18164
  };
18111
- const refreshEvent = () => {
18165
+ const refreshEvent = evnt => {
18112
18166
  const {
18113
18167
  isRefresh
18114
18168
  } = reactData;
@@ -18126,7 +18180,9 @@ dynamicApp.component(grid.name, grid);
18126
18180
  }
18127
18181
  } else if ($xegrid) {
18128
18182
  reactData.isRefresh = true;
18129
- $xegrid.commitProxy(refreshOpts.code || 'reload').catch(e => e).then(() => {
18183
+ $xegrid.triggerToolbarCommitEvent({
18184
+ code: refreshOpts.code || 'reload'
18185
+ }, evnt).catch(e => e).then(() => {
18130
18186
  reactData.isRefresh = false;
18131
18187
  });
18132
18188
  }
@@ -18672,7 +18728,7 @@ dynamicApp.component(toolbar.name, toolbar);
18672
18728
  };
18673
18729
  const triggerJumpEvent = evnt => {
18674
18730
  const inputElem = evnt.target;
18675
- const inpValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(inputElem.value);
18731
+ const inpValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(inputElem.value);
18676
18732
  const pageCount = computePageCount.value;
18677
18733
  const current = inpValue <= 0 ? 1 : inpValue >= pageCount ? pageCount : inpValue;
18678
18734
  inputElem.value = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(current);
@@ -22295,6 +22351,9 @@ function createResizeEvent(callback) {
22295
22351
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => setTimeout(() => recalculate()));
22296
22352
  }
22297
22353
  });
22354
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onActivated)(() => {
22355
+ recalculate().then(() => refreshScroll());
22356
+ });
22298
22357
  let resizeObserver;
22299
22358
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
22300
22359
  GlobalEvent.on($xelist, 'resize', () => {
@@ -26364,7 +26423,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26364
26423
  checkRowKeys
26365
26424
  } = checkboxOpts;
26366
26425
  if (checkAll) {
26367
- tableMethods.setAllCheckboxRow(true);
26426
+ handleCheckedAllCheckboxRow(true, true);
26368
26427
  } else if (checkRowKeys) {
26369
26428
  const defSelection = [];
26370
26429
  checkRowKeys.forEach(rowid => {
@@ -26372,7 +26431,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26372
26431
  defSelection.push(fullDataRowIdData[rowid].row);
26373
26432
  }
26374
26433
  });
26375
- tableMethods.setCheckboxRow(defSelection, true);
26434
+ handleCheckedCheckboxRow(defSelection, true, true);
26376
26435
  }
26377
26436
  }
26378
26437
  };
@@ -26394,7 +26453,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26394
26453
  } = radioOpts;
26395
26454
  if (rowid) {
26396
26455
  if (fullDataRowIdData[rowid]) {
26397
- tableMethods.setRadioRow(fullDataRowIdData[rowid].row);
26456
+ handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
26398
26457
  }
26399
26458
  if (reserve) {
26400
26459
  const rowkey = getRowkey($xetable);
@@ -26454,6 +26513,150 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26454
26513
  }
26455
26514
  }
26456
26515
  };
26516
+ const handleCheckedRadioRow = (row, isForce) => {
26517
+ const radioOpts = computeRadioOpts.value;
26518
+ const {
26519
+ checkMethod
26520
+ } = radioOpts;
26521
+ if (row && (isForce || !checkMethod || checkMethod({
26522
+ row
26523
+ }))) {
26524
+ reactData.selectRow = row;
26525
+ handleRadioReserveRow(row);
26526
+ }
26527
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
26528
+ };
26529
+ const handleCheckedCheckboxRow = (rows, value, isForce) => {
26530
+ if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
26531
+ rows = [rows];
26532
+ }
26533
+ rows.forEach(row => tablePrivateMethods.handleSelectRow({
26534
+ row
26535
+ }, !!value, isForce));
26536
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
26537
+ };
26538
+ const handleCheckedAllCheckboxRow = (value, isForce) => {
26539
+ const {
26540
+ treeConfig
26541
+ } = props;
26542
+ const {
26543
+ selection
26544
+ } = reactData;
26545
+ const {
26546
+ afterFullData,
26547
+ checkboxReserveRowMap
26548
+ } = internalData;
26549
+ const treeOpts = computeTreeOpts.value;
26550
+ const checkboxOpts = computeCheckboxOpts.value;
26551
+ const {
26552
+ checkField,
26553
+ reserve,
26554
+ checkStrictly,
26555
+ checkMethod
26556
+ } = checkboxOpts;
26557
+ let selectRows = [];
26558
+ const beforeSelection = treeConfig ? [] : selection.filter(row => $xetable.findRowIndexOf(afterFullData, row) === -1);
26559
+ if (checkStrictly) {
26560
+ reactData.isAllSelected = value;
26561
+ } else {
26562
+ /**
26563
+ * 绑定属性方式(高性能,有污染)
26564
+ * 必须在行数据存在对应的属性,否则将不响应
26565
+ */
26566
+ if (checkField) {
26567
+ const checkValFn = row => {
26568
+ if (isForce || !checkMethod || checkMethod({
26569
+ row
26570
+ })) {
26571
+ if (value) {
26572
+ selectRows.push(row);
26573
+ }
26574
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
26575
+ }
26576
+ };
26577
+ // 如果存在选中方法
26578
+ // 如果方法成立,则更新值,否则忽略该数据
26579
+ if (treeConfig) {
26580
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, checkValFn, treeOpts);
26581
+ } else {
26582
+ afterFullData.forEach(checkValFn);
26583
+ }
26584
+ } else {
26585
+ /**
26586
+ * 默认方式(低性能,无污染)
26587
+ * 无需任何属性,直接绑定
26588
+ */
26589
+ if (treeConfig) {
26590
+ if (value) {
26591
+ /**
26592
+ * 如果是树勾选
26593
+ * 如果方法成立,则添加到临时集合中
26594
+ */
26595
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
26596
+ if (isForce || !checkMethod || checkMethod({
26597
+ row
26598
+ })) {
26599
+ selectRows.push(row);
26600
+ }
26601
+ }, treeOpts);
26602
+ } else {
26603
+ /**
26604
+ * 如果是树取消
26605
+ * 如果方法成立,则不添加到临时集合中
26606
+ */
26607
+ if (!isForce && checkMethod) {
26608
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
26609
+ if (checkMethod({
26610
+ row
26611
+ }) ? 0 : $xetable.findRowIndexOf(selection, row) > -1) {
26612
+ selectRows.push(row);
26613
+ }
26614
+ }, treeOpts);
26615
+ }
26616
+ }
26617
+ } else {
26618
+ if (value) {
26619
+ /**
26620
+ * 如果是行勾选
26621
+ * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
26622
+ * 如果不存在选中方法,则添加所有数据到临时集合中
26623
+ */
26624
+ if (!isForce && checkMethod) {
26625
+ selectRows = afterFullData.filter(row => $xetable.findRowIndexOf(selection, row) > -1 || checkMethod({
26626
+ row
26627
+ }));
26628
+ } else {
26629
+ selectRows = afterFullData.slice(0);
26630
+ }
26631
+ } else {
26632
+ /**
26633
+ * 如果是行取消
26634
+ * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
26635
+ * 如果不存在选中方法,无需处理,临时集合默认为空
26636
+ */
26637
+ if (!isForce && checkMethod) {
26638
+ selectRows = afterFullData.filter(row => checkMethod({
26639
+ row
26640
+ }) ? 0 : $xetable.findRowIndexOf(selection, row) > -1);
26641
+ }
26642
+ }
26643
+ }
26644
+ }
26645
+ if (reserve) {
26646
+ if (value) {
26647
+ selectRows.forEach(row => {
26648
+ checkboxReserveRowMap[getRowid($xetable, row)] = row;
26649
+ });
26650
+ } else {
26651
+ afterFullData.forEach(row => handleCheckboxReserveRow(row, false));
26652
+ }
26653
+ }
26654
+ reactData.selection = checkField ? [] : beforeSelection.concat(selectRows);
26655
+ }
26656
+ reactData.treeIndeterminates = [];
26657
+ tablePrivateMethods.checkSelectionStatus();
26658
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
26659
+ };
26457
26660
  // 还原展开、选中等相关状态
26458
26661
  const handleReserveStatus = () => {
26459
26662
  const {
@@ -26484,14 +26687,14 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26484
26687
  if (radioOpts.reserve && radioReserveRow) {
26485
26688
  const rowid = getRowid($xetable, radioReserveRow);
26486
26689
  if (fullDataRowIdData[rowid]) {
26487
- tableMethods.setRadioRow(fullDataRowIdData[rowid].row);
26690
+ handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
26488
26691
  }
26489
26692
  }
26490
26693
  // 复选框
26491
26694
  reactData.selection = getRecoverRow(selection); // 刷新多选行状态
26492
26695
  // 还原保留选中状态
26493
26696
  if (checkboxOpts.reserve) {
26494
- tableMethods.setCheckboxRow(handleReserveRow(internalData.checkboxReserveRowMap), true);
26697
+ handleCheckedCheckboxRow(handleReserveRow(internalData.checkboxReserveRowMap), true, true);
26495
26698
  }
26496
26699
  if (currentRow && !fullAllDataRowIdData[getRowid($xetable, currentRow)]) {
26497
26700
  reactData.currentRow = null; // 刷新当前行状态
@@ -26576,7 +26779,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
26576
26779
  }
26577
26780
  // 如果当前节点已选中,则展开后子节点也被选中
26578
26781
  if (!checkStrictly && tableMethods.isCheckedByCheckboxRow(row)) {
26579
- tableMethods.setCheckboxRow(childRows, true);
26782
+ handleCheckedCheckboxRow(childRows, true);
26580
26783
  }
26581
26784
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
26582
26785
  if (transform) {
@@ -28052,13 +28255,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28052
28255
  * @param {Boolean} value 是否选中
28053
28256
  */
28054
28257
  setCheckboxRow(rows, value) {
28055
- if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
28056
- rows = [rows];
28057
- }
28058
- rows.forEach(row => tablePrivateMethods.handleSelectRow({
28059
- row
28060
- }, !!value));
28061
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
28258
+ return handleCheckedCheckboxRow(rows, value, true);
28062
28259
  },
28063
28260
  isCheckedByCheckboxRow(row) {
28064
28261
  const {
@@ -28083,9 +28280,17 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28083
28280
  * 多选,切换某一行的选中状态
28084
28281
  */
28085
28282
  toggleCheckboxRow(row) {
28086
- tablePrivateMethods.handleToggleCheckRowEvent(null, {
28283
+ const {
28284
+ selection
28285
+ } = reactData;
28286
+ const checkboxOpts = computeCheckboxOpts.value;
28287
+ const {
28288
+ checkField
28289
+ } = checkboxOpts;
28290
+ const value = checkField ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : $xetable.findRowIndexOf(selection, row) === -1;
28291
+ tablePrivateMethods.handleSelectRow({
28087
28292
  row
28088
- });
28293
+ }, value, true);
28089
28294
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
28090
28295
  },
28091
28296
  /**
@@ -28093,126 +28298,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28093
28298
  * @param {Boolean} value 是否选中
28094
28299
  */
28095
28300
  setAllCheckboxRow(value) {
28096
- const {
28097
- treeConfig
28098
- } = props;
28099
- const {
28100
- selection
28101
- } = reactData;
28102
- const {
28103
- afterFullData,
28104
- checkboxReserveRowMap
28105
- } = internalData;
28106
- const treeOpts = computeTreeOpts.value;
28107
- const checkboxOpts = computeCheckboxOpts.value;
28108
- const {
28109
- checkField,
28110
- reserve,
28111
- checkStrictly,
28112
- checkMethod
28113
- } = checkboxOpts;
28114
- let selectRows = [];
28115
- const beforeSelection = treeConfig ? [] : selection.filter(row => $xetable.findRowIndexOf(afterFullData, row) === -1);
28116
- if (checkStrictly) {
28117
- reactData.isAllSelected = value;
28118
- } else {
28119
- /**
28120
- * 绑定属性方式(高性能,有污染)
28121
- * 必须在行数据存在对应的属性,否则将不响应
28122
- */
28123
- if (checkField) {
28124
- const checkValFn = row => {
28125
- if (!checkMethod || checkMethod({
28126
- row
28127
- })) {
28128
- if (value) {
28129
- selectRows.push(row);
28130
- }
28131
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
28132
- }
28133
- };
28134
- // 如果存在选中方法
28135
- // 如果方法成立,则更新值,否则忽略该数据
28136
- if (treeConfig) {
28137
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, checkValFn, treeOpts);
28138
- } else {
28139
- afterFullData.forEach(checkValFn);
28140
- }
28141
- } else {
28142
- /**
28143
- * 默认方式(低性能,无污染)
28144
- * 无需任何属性,直接绑定
28145
- */
28146
- if (treeConfig) {
28147
- if (value) {
28148
- /**
28149
- * 如果是树勾选
28150
- * 如果方法成立,则添加到临时集合中
28151
- */
28152
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
28153
- if (!checkMethod || checkMethod({
28154
- row
28155
- })) {
28156
- selectRows.push(row);
28157
- }
28158
- }, treeOpts);
28159
- } else {
28160
- /**
28161
- * 如果是树取消
28162
- * 如果方法成立,则不添加到临时集合中
28163
- */
28164
- if (checkMethod) {
28165
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterFullData, row => {
28166
- if (checkMethod({
28167
- row
28168
- }) ? 0 : $xetable.findRowIndexOf(selection, row) > -1) {
28169
- selectRows.push(row);
28170
- }
28171
- }, treeOpts);
28172
- }
28173
- }
28174
- } else {
28175
- if (value) {
28176
- /**
28177
- * 如果是行勾选
28178
- * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
28179
- * 如果不存在选中方法,则添加所有数据到临时集合中
28180
- */
28181
- if (checkMethod) {
28182
- selectRows = afterFullData.filter(row => $xetable.findRowIndexOf(selection, row) > -1 || checkMethod({
28183
- row
28184
- }));
28185
- } else {
28186
- selectRows = afterFullData.slice(0);
28187
- }
28188
- } else {
28189
- /**
28190
- * 如果是行取消
28191
- * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
28192
- * 如果不存在选中方法,无需处理,临时集合默认为空
28193
- */
28194
- if (checkMethod) {
28195
- selectRows = afterFullData.filter(row => checkMethod({
28196
- row
28197
- }) ? 0 : $xetable.findRowIndexOf(selection, row) > -1);
28198
- }
28199
- }
28200
- }
28201
- }
28202
- if (reserve) {
28203
- if (value) {
28204
- selectRows.forEach(row => {
28205
- checkboxReserveRowMap[getRowid($xetable, row)] = row;
28206
- });
28207
- } else {
28208
- afterFullData.forEach(row => handleCheckboxReserveRow(row, false));
28209
- }
28210
- }
28211
- reactData.selection = checkField ? [] : beforeSelection.concat(selectRows);
28212
- }
28213
- reactData.treeIndeterminates = [];
28214
- tablePrivateMethods.checkSelectionStatus();
28215
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
28301
+ return handleCheckedAllCheckboxRow(value, true);
28216
28302
  },
28217
28303
  /**
28218
28304
  * 获取单选框保留选中的行
@@ -28348,7 +28434,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28348
28434
  const rowOpts = computeRowOpts.value;
28349
28435
  const el = refElem.value;
28350
28436
  tableMethods.clearCurrentRow();
28351
- tableMethods.clearCurrentColumn();
28437
+ // tableMethods.clearCurrentColumn()
28352
28438
  reactData.currentRow = row;
28353
28439
  if (rowOpts.isCurrent || props.highlightCurrentRow) {
28354
28440
  if (el) {
@@ -28365,17 +28451,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28365
28451
  * @param {Row} row 行对象
28366
28452
  */
28367
28453
  setRadioRow(row) {
28368
- const radioOpts = computeRadioOpts.value;
28369
- const {
28370
- checkMethod
28371
- } = radioOpts;
28372
- if (row && (!checkMethod || checkMethod({
28373
- row
28374
- }))) {
28375
- reactData.selectRow = row;
28376
- handleRadioReserveRow(row);
28377
- }
28378
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
28454
+ return handleCheckedRadioRow(row, true);
28379
28455
  },
28380
28456
  /**
28381
28457
  * 用于当前行,手动清空当前高亮的状态
@@ -28450,7 +28526,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
28450
28526
  setCurrentColumn(fieldOrColumn) {
28451
28527
  const column = handleFieldOrColumn($xetable, fieldOrColumn);
28452
28528
  if (column) {
28453
- tableMethods.clearCurrentRow();
28529
+ // tableMethods.clearCurrentRow()
28454
28530
  tableMethods.clearCurrentColumn();
28455
28531
  reactData.currentColumn = column;
28456
28532
  }
@@ -30206,7 +30282,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30206
30282
  */
30207
30283
  handleSelectRow({
30208
30284
  row
30209
- }, value) {
30285
+ }, value, isForce) {
30210
30286
  const {
30211
30287
  treeConfig
30212
30288
  } = props;
@@ -30234,7 +30310,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30234
30310
  } else {
30235
30311
  // 更新子节点状态
30236
30312
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([row], item => {
30237
- if ($xetable.eqRow(item, row) || !checkMethod || checkMethod({
30313
+ if ($xetable.eqRow(item, row) || isForce || !checkMethod || checkMethod({
30238
30314
  row: item
30239
30315
  })) {
30240
30316
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, checkField, value);
@@ -30247,7 +30323,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30247
30323
  const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => $xetable.eqRow(item, row), treeOpts);
30248
30324
  if (matchObj && matchObj.parent) {
30249
30325
  let parentStatus;
30250
- const vItems = checkMethod ? matchObj.items.filter(item => checkMethod({
30326
+ const vItems = !isForce && checkMethod ? matchObj.items.filter(item => checkMethod({
30251
30327
  row: item
30252
30328
  })) : matchObj.items;
30253
30329
  const indeterminatesItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(matchObj.items, item => $xetable.findRowIndexOf(treeIndeterminates, item) > -1);
@@ -30259,10 +30335,10 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30259
30335
  }
30260
30336
  return tablePrivateMethods.handleSelectRow({
30261
30337
  row: matchObj.parent
30262
- }, parentStatus);
30338
+ }, parentStatus, isForce);
30263
30339
  }
30264
30340
  } else {
30265
- if (!checkMethod || checkMethod({
30341
+ if (isForce || !checkMethod || checkMethod({
30266
30342
  row
30267
30343
  })) {
30268
30344
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
@@ -30279,7 +30355,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30279
30355
  } else {
30280
30356
  // 更新子节点状态
30281
30357
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([row], item => {
30282
- if ($xetable.eqRow(item, row) || !checkMethod || checkMethod({
30358
+ if ($xetable.eqRow(item, row) || isForce || !checkMethod || checkMethod({
30283
30359
  row: item
30284
30360
  })) {
30285
30361
  if (value) {
@@ -30296,7 +30372,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30296
30372
  const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => $xetable.eqRow(item, row), treeOpts);
30297
30373
  if (matchObj && matchObj.parent) {
30298
30374
  let parentStatus;
30299
- const vItems = checkMethod ? matchObj.items.filter(item => checkMethod({
30375
+ const vItems = !isForce && checkMethod ? matchObj.items.filter(item => checkMethod({
30300
30376
  row: item
30301
30377
  })) : matchObj.items;
30302
30378
  const indeterminatesItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(matchObj.items, item => $xetable.findRowIndexOf(treeIndeterminates, item) > -1);
@@ -30308,10 +30384,10 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30308
30384
  }
30309
30385
  return tablePrivateMethods.handleSelectRow({
30310
30386
  row: matchObj.parent
30311
- }, parentStatus);
30387
+ }, parentStatus, isForce);
30312
30388
  }
30313
30389
  } else {
30314
- if (!checkMethod || checkMethod({
30390
+ if (isForce || !checkMethod || checkMethod({
30315
30391
  row
30316
30392
  })) {
30317
30393
  if (value) {
@@ -30642,7 +30718,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30642
30718
  * 多选,选中所有事件
30643
30719
  */
30644
30720
  triggerCheckAllEvent(evnt, value) {
30645
- tableMethods.setAllCheckboxRow(value);
30721
+ handleCheckedAllCheckboxRow(value);
30646
30722
  if (evnt) {
30647
30723
  tableMethods.dispatchEvent('checkbox-all', {
30648
30724
  records: tableMethods.getCheckboxRecords(),
@@ -30666,7 +30742,7 @@ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE';
30666
30742
  let newValue = row;
30667
30743
  let isChange = oldValue !== newValue;
30668
30744
  if (isChange) {
30669
- tableMethods.setRadioRow(newValue);
30745
+ handleCheckedRadioRow(newValue);
30670
30746
  } else if (!radioOpts.strict) {
30671
30747
  isChange = oldValue === newValue;
30672
30748
  if (isChange) {