vxe-table 3.11.29 → 3.11.30-beta.1

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 (33) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/custom/mixin.js +31 -19
  3. package/es/table/module/keyboard/mixin.js +2 -1
  4. package/es/table/src/methods.js +237 -272
  5. package/es/table/src/table.js +23 -9
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/index.umd.js +329 -345
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/style.css +1 -1
  11. package/lib/table/module/custom/mixin.js +36 -23
  12. package/lib/table/module/custom/mixin.min.js +1 -1
  13. package/lib/table/module/keyboard/mixin.js +2 -3
  14. package/lib/table/module/keyboard/mixin.min.js +1 -1
  15. package/lib/table/src/methods.js +264 -306
  16. package/lib/table/src/methods.min.js +1 -1
  17. package/lib/table/src/table.js +25 -9
  18. package/lib/table/src/table.min.js +1 -1
  19. package/lib/ui/index.js +1 -1
  20. package/lib/ui/index.min.js +1 -1
  21. package/lib/ui/src/log.js +1 -1
  22. package/lib/ui/src/log.min.js +1 -1
  23. package/package.json +2 -2
  24. package/packages/table/module/custom/mixin.ts +35 -19
  25. package/packages/table/module/keyboard/mixin.ts +3 -1
  26. package/packages/table/src/methods.ts +247 -262
  27. package/packages/table/src/table.ts +26 -9
  28. /package/es/{iconfont.1734067799153.ttf → iconfont.1734093222885.ttf} +0 -0
  29. /package/es/{iconfont.1734067799153.woff → iconfont.1734093222885.woff} +0 -0
  30. /package/es/{iconfont.1734067799153.woff2 → iconfont.1734093222885.woff2} +0 -0
  31. /package/lib/{iconfont.1734067799153.ttf → iconfont.1734093222885.ttf} +0 -0
  32. /package/lib/{iconfont.1734067799153.woff → iconfont.1734093222885.woff} +0 -0
  33. /package/lib/{iconfont.1734067799153.woff2 → iconfont.1734093222885.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.11.29";
2223
+ const version = "3.11.30-beta.1";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2790,7 +2790,7 @@ function isNodeElement(elem) {
2790
2790
  const {
2791
2791
  log: log_log
2792
2792
  } = core_.VxeUI;
2793
- const log_version = `table v${"3.11.29"}`;
2793
+ const log_version = `table v${"3.11.30-beta.1"}`;
2794
2794
  const warnLog = log_log.create('warn', log_version);
2795
2795
  const errLog = log_log.create('error', log_version);
2796
2796
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5918,6 +5918,7 @@ const Methods = {
5918
5918
  });
5919
5919
  },
5920
5920
  handleColumn(collectColumn) {
5921
+ const $xeTable = this;
5921
5922
  this.collectColumn = collectColumn;
5922
5923
  const tableFullColumn = getColumnList(collectColumn);
5923
5924
  this.tableFullColumn = tableFullColumn;
@@ -5947,6 +5948,9 @@ const Methods = {
5947
5948
  $table: this
5948
5949
  });
5949
5950
  }
5951
+ if ($xeTable.handleUpdateCustomColumn) {
5952
+ $xeTable.handleUpdateCustomColumn();
5953
+ }
5950
5954
  return this.recalculate();
5951
5955
  });
5952
5956
  });
@@ -9543,11 +9547,12 @@ const Methods = {
9543
9547
  }
9544
9548
  },
9545
9549
  handleCheckedCheckboxRow(rows, value, isForce) {
9550
+ const $xeTable = this;
9546
9551
  if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
9547
9552
  rows = [rows];
9548
9553
  }
9549
- this.handleBatchSelectRows(rows, !!value, isForce);
9550
- this.checkSelectionStatus();
9554
+ $xeTable.handleBatchSelectRows(rows, !!value, isForce);
9555
+ $xeTable.checkSelectionStatus();
9551
9556
  return this.$nextTick();
9552
9557
  },
9553
9558
  /**
@@ -9580,271 +9585,118 @@ const Methods = {
9580
9585
  return !!treeIndeterminateMaps[getRowid(this, row)] && !this.isCheckedByCheckboxRow(row);
9581
9586
  },
9582
9587
  /**
9583
- * 多行
9588
+ * 切换选中
9584
9589
  * 多选,行选中事件
9585
- * value 选中true 不选false 半选-1
9586
9590
  */
9587
- handleBatchSelectRows(rows, value, isForce) {
9591
+ handleBatchSelectRows(rows, checked, isForce) {
9588
9592
  const $xeTable = this;
9593
+ const props = $xeTable;
9594
+ const reactData = $xeTable;
9589
9595
  const {
9590
9596
  treeConfig
9591
- } = $xeTable;
9597
+ } = props;
9592
9598
  const {
9593
- selectCheckboxMaps,
9594
- checkboxOpts
9595
- } = this;
9599
+ selectCheckboxMaps
9600
+ } = reactData;
9601
+ const selectRowMaps = Object.assign({}, selectCheckboxMaps);
9602
+ const treeOpts = $xeTable.computeTreeOpts;
9603
+ const {
9604
+ transform,
9605
+ mapChildrenField
9606
+ } = treeOpts;
9607
+ const childrenField = treeOpts.children || treeOpts.childrenField;
9608
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
9596
9609
  const {
9597
9610
  checkField,
9598
9611
  checkStrictly,
9599
9612
  checkMethod
9600
9613
  } = checkboxOpts;
9614
+ const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
9601
9615
  if (checkField) {
9616
+ // 树结构
9602
9617
  if (treeConfig && !checkStrictly) {
9603
- rows.forEach(row => {
9604
- this.handleSelectRow({
9605
- row
9606
- }, value, isForce);
9607
- });
9608
- } else {
9609
- rows.forEach(row => {
9618
+ // 更新子节点状态
9619
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
9610
9620
  if (isForce || !checkMethod || checkMethod({
9611
9621
  row
9612
9622
  })) {
9613
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
9614
- this.handleCheckboxReserveRow(row, value);
9623
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
9624
+ if (indeterminateField) {
9625
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
9626
+ }
9627
+ $xeTable.handleCheckboxReserveRow(row, checked);
9615
9628
  }
9629
+ }, {
9630
+ children: transform ? mapChildrenField : childrenField
9616
9631
  });
9617
- }
9618
- } else {
9619
- if (treeConfig && !checkStrictly) {
9620
- rows.forEach(row => {
9621
- this.handleSelectRow({
9622
- row
9623
- }, value, isForce);
9624
- });
9632
+ reactData.selectCheckboxMaps = selectRowMaps;
9633
+ return;
9625
9634
  } else {
9626
- const selectRowMaps = Object.assign({}, selectCheckboxMaps);
9635
+ // 列表
9627
9636
  rows.forEach(row => {
9628
- const rowid = getRowid($xeTable, row);
9629
9637
  if (isForce || !checkMethod || checkMethod({
9630
9638
  row
9631
9639
  })) {
9632
- if (value) {
9633
- if (!selectRowMaps[rowid]) {
9634
- selectRowMaps[rowid] = row;
9635
- }
9636
- } else {
9637
- if (selectRowMaps[rowid]) {
9638
- delete selectRowMaps[rowid];
9639
- }
9640
- }
9641
- this.handleCheckboxReserveRow(row, value);
9640
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
9641
+ $xeTable.handleCheckboxReserveRow(row, checked);
9642
9642
  }
9643
9643
  });
9644
- this.selectCheckboxMaps = selectRowMaps;
9645
9644
  }
9645
+ reactData.selectCheckboxMaps = selectRowMaps;
9646
+ return;
9646
9647
  }
9647
- },
9648
- /**
9649
- * 多选,行选中事件
9650
- * value 选中true 不选false 半选-1
9651
- */
9652
- handleSelectRow({
9653
- row
9654
- }, value, isForce) {
9655
- const {
9656
- selectCheckboxMaps,
9657
- afterFullData,
9658
- treeConfig,
9659
- treeOpts,
9660
- treeIndeterminateMaps,
9661
- checkboxOpts
9662
- } = this;
9663
- const {
9664
- checkField,
9665
- checkStrictly,
9666
- checkMethod
9667
- } = checkboxOpts;
9668
- const selectRowMaps = {
9669
- ...selectCheckboxMaps
9670
- };
9671
- const childrenField = treeOpts.children || treeOpts.childrenField;
9672
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
9673
- const rowid = getRowid(this, row);
9674
- if (checkField) {
9675
- if (treeConfig && !checkStrictly) {
9676
- if (value === -1) {
9677
- if (!treeIndeterminateMaps[rowid]) {
9678
- if (indeterminateField) {
9679
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, true);
9680
- }
9681
- treeIndeterminateMaps[rowid] = row;
9682
- }
9683
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, false);
9684
- } else {
9685
- // 更新子节点状态
9686
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([row], item => {
9687
- if (this.eqRow(item, row) || isForce || !checkMethod || checkMethod({
9688
- row: item
9689
- })) {
9690
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(item, checkField, value);
9691
- if (indeterminateField) {
9692
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
9693
- }
9694
- delete treeIndeterminateMaps[getRowid(this, item)];
9695
- this.handleCheckboxReserveRow(row, value);
9696
- }
9697
- }, {
9698
- children: childrenField
9699
- });
9700
- }
9701
- // 如果存在父节点,更新父节点状态
9702
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => this.eqRow(item, row), {
9703
- children: childrenField
9704
- });
9705
- if (matchObj && matchObj.parent) {
9706
- let parentStatus;
9707
- const vItems = [];
9708
- const vItemMaps = {};
9709
- if (!isForce && checkMethod) {
9710
- matchObj.items.forEach(item => {
9711
- if (checkMethod({
9712
- row: item
9713
- })) {
9714
- const itemRid = getRowid(this, item);
9715
- vItemMaps[itemRid] = item;
9716
- vItems.push(item);
9717
- }
9718
- });
9719
- } else {
9720
- matchObj.items.forEach(item => {
9721
- const itemRid = getRowid(this, item);
9722
- vItemMaps[itemRid] = item;
9723
- vItems.push(item);
9724
- });
9725
- }
9726
- const indeterminatesItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(matchObj.items, item => !!treeIndeterminateMaps[getRowid(this, item)]);
9727
- if (indeterminatesItem) {
9728
- parentStatus = -1;
9729
- } else {
9730
- const selectItems = [];
9731
- matchObj.items.forEach(item => {
9732
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField)) {
9733
- selectItems.push(item);
9734
- }
9735
- });
9736
- parentStatus = selectItems.filter(item => vItemMaps[getRowid(this, item)]).length === vItems.length ? true : selectItems.length || value === -1 ? -1 : false;
9737
- }
9738
- this.selectCheckboxMaps = selectRowMaps;
9739
- return this.handleSelectRow({
9740
- row: matchObj.parent
9741
- }, parentStatus, isForce);
9742
- }
9743
- } else {
9744
- if (isForce || !checkMethod || checkMethod({
9745
- row
9746
- })) {
9747
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
9748
- this.handleCheckboxReserveRow(row, value);
9749
- }
9750
- }
9751
- } else {
9752
- if (treeConfig && !checkStrictly) {
9753
- if (value === -1) {
9754
- if (!treeIndeterminateMaps[rowid]) {
9755
- if (indeterminateField) {
9756
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, true);
9757
- }
9758
- treeIndeterminateMaps[rowid] = row;
9759
- }
9760
- if (selectRowMaps[rowid]) {
9761
- delete selectRowMaps[rowid];
9762
- }
9763
- } else {
9764
- // 更新子节点状态
9765
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree([row], item => {
9766
- const itemRid = getRowid(this, item);
9767
- if (this.eqRow(item, row) || isForce || !checkMethod || checkMethod({
9768
- row: item
9769
- })) {
9770
- if (value) {
9771
- selectRowMaps[itemRid] = item;
9772
- } else {
9773
- if (selectRowMaps[itemRid]) {
9774
- delete selectRowMaps[itemRid];
9775
- }
9776
- }
9777
- if (indeterminateField) {
9778
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
9779
- }
9780
- delete treeIndeterminateMaps[getRowid(this, item)];
9781
- this.handleCheckboxReserveRow(row, value);
9782
- }
9783
- }, {
9784
- children: childrenField
9785
- });
9786
- }
9787
- // 如果存在父节点,更新父节点状态
9788
- const matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(afterFullData, item => this.eqRow(item, row), {
9789
- children: childrenField
9790
- });
9791
- if (matchObj && matchObj.parent) {
9792
- let parentStatus;
9793
- const vItems = [];
9794
- const vItemMaps = {};
9795
- if (!isForce && checkMethod) {
9796
- matchObj.items.forEach(item => {
9797
- if (checkMethod({
9798
- row: item
9799
- })) {
9800
- const itemRid = getRowid(this, item);
9801
- vItemMaps[itemRid] = item;
9802
- vItems.push(item);
9803
- }
9804
- });
9805
- } else {
9806
- matchObj.items.forEach(item => {
9807
- const itemRid = getRowid(this, item);
9808
- vItemMaps[itemRid] = item;
9809
- vItems.push(item);
9810
- });
9811
- }
9812
- const indeterminatesItem = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().find(matchObj.items, item => !!treeIndeterminateMaps[getRowid(this, item)]);
9813
- if (indeterminatesItem) {
9814
- parentStatus = -1;
9815
- } else {
9816
- const selectItems = [];
9817
- matchObj.items.forEach(item => {
9818
- const itemRid = getRowid(this, item);
9819
- if (selectRowMaps[itemRid]) {
9820
- selectItems.push(item);
9821
- }
9822
- });
9823
- parentStatus = selectItems.filter(item => vItemMaps[getRowid(this, item)]).length === vItems.length ? true : selectItems.length || value === -1 ? -1 : false;
9824
- }
9825
- this.selectCheckboxMaps = selectRowMaps;
9826
- return this.handleSelectRow({
9827
- row: matchObj.parent
9828
- }, parentStatus, isForce);
9829
- }
9830
- } else {
9648
+ // 树结构
9649
+ if (treeConfig && !checkStrictly) {
9650
+ // 更新子节点状态
9651
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, row => {
9652
+ const rowid = getRowid($xeTable, row);
9831
9653
  if (isForce || !checkMethod || checkMethod({
9832
9654
  row
9833
9655
  })) {
9834
- if (value) {
9835
- if (!selectRowMaps[rowid]) {
9836
- selectRowMaps[rowid] = row;
9837
- }
9656
+ if (checked) {
9657
+ selectRowMaps[rowid] = row;
9838
9658
  } else {
9839
9659
  if (selectRowMaps[rowid]) {
9840
9660
  delete selectRowMaps[rowid];
9841
9661
  }
9842
9662
  }
9843
- this.handleCheckboxReserveRow(row, value);
9663
+ $xeTable.handleCheckboxReserveRow(row, checked);
9844
9664
  }
9845
- }
9665
+ }, {
9666
+ children: transform ? mapChildrenField : childrenField
9667
+ });
9668
+ reactData.selectCheckboxMaps = selectRowMaps;
9669
+ return;
9846
9670
  }
9847
- this.selectCheckboxMaps = selectRowMaps;
9671
+ // 列表
9672
+ rows.forEach(row => {
9673
+ const rowid = getRowid($xeTable, row);
9674
+ if (isForce || !checkMethod || checkMethod({
9675
+ row
9676
+ })) {
9677
+ if (checked) {
9678
+ if (!selectRowMaps[rowid]) {
9679
+ selectRowMaps[rowid] = row;
9680
+ }
9681
+ } else {
9682
+ if (selectRowMaps[rowid]) {
9683
+ delete selectRowMaps[rowid];
9684
+ }
9685
+ }
9686
+ $xeTable.handleCheckboxReserveRow(row, checked);
9687
+ }
9688
+ });
9689
+ reactData.selectCheckboxMaps = selectRowMaps;
9690
+ },
9691
+ /**
9692
+ * 即将移除
9693
+ * @deprecated
9694
+ */
9695
+ handleSelectRow({
9696
+ row
9697
+ }, checked, isForce) {
9698
+ const $xeTable = this;
9699
+ $xeTable.handleBatchSelectRows([row], checked, isForce);
9848
9700
  },
9849
9701
  handleToggleCheckRowEvent(evnt, params) {
9850
9702
  const {
@@ -9861,20 +9713,20 @@ const Methods = {
9861
9713
  if (trigger === 'manual') {
9862
9714
  return;
9863
9715
  }
9864
- let value = false;
9716
+ let checked = false;
9865
9717
  if (checkField) {
9866
- value = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
9718
+ checked = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
9867
9719
  } else {
9868
- value = !selectCheckboxMaps[getRowid(this, row)];
9720
+ checked = !selectCheckboxMaps[getRowid(this, row)];
9869
9721
  }
9870
9722
  if (evnt) {
9871
- this.triggerCheckRowEvent(evnt, params, value);
9723
+ this.triggerCheckRowEvent(evnt, params, checked);
9872
9724
  } else {
9873
- this.handleSelectRow(params, value);
9725
+ this.handleSelectRow(params, checked);
9874
9726
  this.checkSelectionStatus();
9875
9727
  }
9876
9728
  },
9877
- triggerCheckRowEvent(evnt, params, value) {
9729
+ triggerCheckRowEvent(evnt, params, checked) {
9878
9730
  const {
9879
9731
  checkboxOpts,
9880
9732
  afterFullData
@@ -9910,13 +9762,13 @@ const Methods = {
9910
9762
  if (!checkMethod || checkMethod({
9911
9763
  row
9912
9764
  })) {
9913
- this.handleSelectRow(params, value);
9765
+ this.handleSelectRow(params, checked);
9914
9766
  this.checkSelectionStatus();
9915
9767
  this.emitEvent('checkbox-change', Object.assign({
9916
9768
  records: this.getCheckboxRecords(),
9917
9769
  reserves: this.getCheckboxReserveRecords(),
9918
9770
  indeterminates: this.getCheckboxIndeterminateRecords(),
9919
- checked: value
9771
+ checked
9920
9772
  }, params), evnt);
9921
9773
  }
9922
9774
  },
@@ -9924,6 +9776,7 @@ const Methods = {
9924
9776
  * 多选,切换某一行的选中状态
9925
9777
  */
9926
9778
  toggleCheckboxRow(row) {
9779
+ const $xeTable = this;
9927
9780
  const {
9928
9781
  selectCheckboxMaps,
9929
9782
  checkboxOpts
@@ -9931,14 +9784,14 @@ const Methods = {
9931
9784
  const {
9932
9785
  checkField
9933
9786
  } = checkboxOpts;
9934
- const value = checkField ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : !selectCheckboxMaps[getRowid(this, row)];
9935
- this.handleSelectRow({
9936
- row
9937
- }, value, true);
9938
- this.checkSelectionStatus();
9939
- return this.$nextTick();
9787
+ const checked = checkField ? !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : !selectCheckboxMaps[getRowid($xeTable, row)];
9788
+ $xeTable.handleBatchSelectRows([row], checked, true);
9789
+ $xeTable.checkSelectionStatus();
9790
+ return $xeTable.$nextTick();
9940
9791
  },
9941
- handleCheckedAllCheckboxRow(value, isForce) {
9792
+ handleCheckedAllCheckboxRow(checked, isForce) {
9793
+ const $xeTable = this;
9794
+ const reactData = $xeTable;
9942
9795
  const {
9943
9796
  afterFullData,
9944
9797
  treeConfig,
@@ -9967,7 +9820,7 @@ const Methods = {
9967
9820
  }
9968
9821
  // 疑惑!
9969
9822
  if (checkStrictly) {
9970
- this.isAllSelected = value;
9823
+ this.isAllSelected = checked;
9971
9824
  } else {
9972
9825
  /**
9973
9826
  * 绑定属性方式(高性能,有污染)
@@ -9978,10 +9831,10 @@ const Methods = {
9978
9831
  if (isForce || !checkMethod || checkMethod({
9979
9832
  row
9980
9833
  })) {
9981
- if (value) {
9834
+ if (checked) {
9982
9835
  selectRowMaps[getRowid(this, row)] = row;
9983
9836
  }
9984
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
9837
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, checked);
9985
9838
  }
9986
9839
  if (treeConfig && indeterminateField) {
9987
9840
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, indeterminateField, false);
@@ -10002,7 +9855,7 @@ const Methods = {
10002
9855
  * 无需任何属性,直接绑定
10003
9856
  */
10004
9857
  if (treeConfig) {
10005
- if (value) {
9858
+ if (checked) {
10006
9859
  /**
10007
9860
  * 如果是树勾选
10008
9861
  * 如果方法成立,则添加到临时集合中
@@ -10035,7 +9888,7 @@ const Methods = {
10035
9888
  }
10036
9889
  }
10037
9890
  } else {
10038
- if (value) {
9891
+ if (checked) {
10039
9892
  /**
10040
9893
  * 如果是行勾选
10041
9894
  * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
@@ -10075,7 +9928,7 @@ const Methods = {
10075
9928
  }
10076
9929
  }
10077
9930
  if (reserve) {
10078
- if (value) {
9931
+ if (checked) {
10079
9932
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectRowMaps, (row, rowid) => {
10080
9933
  checkboxReserveRowMap[rowid] = row;
10081
9934
  });
@@ -10085,6 +9938,8 @@ const Methods = {
10085
9938
  }
10086
9939
  this.selectCheckboxMaps = checkField ? {} : selectRowMaps;
10087
9940
  }
9941
+ reactData.isAllSelected = checked;
9942
+ reactData.isIndeterminate = false;
10088
9943
  this.treeIndeterminateMaps = {};
10089
9944
  this.treeIndeterminateRowMaps = {};
10090
9945
  this.checkSelectionStatus();
@@ -10097,81 +9952,182 @@ const Methods = {
10097
9952
  setAllCheckboxRow(value) {
10098
9953
  return this.handleCheckedAllCheckboxRow(value, true);
10099
9954
  },
10100
- checkSelectionStatus() {
9955
+ updateCheckboxStatus() {
9956
+ const $xeTable = this;
9957
+ const props = $xeTable;
9958
+ const reactData = $xeTable;
9959
+ const internalData = $xeTable;
10101
9960
  const {
10102
- afterFullData,
10103
- selectCheckboxMaps,
10104
- treeIndeterminateMaps,
10105
- checkboxOpts,
10106
9961
  treeConfig
10107
- } = this;
9962
+ } = props;
9963
+ const {
9964
+ selectCheckboxMaps,
9965
+ treeIndeterminateMaps
9966
+ } = reactData;
9967
+ const selectRowMaps = Object.assign({}, selectCheckboxMaps);
9968
+ const halfRowMaps = Object.assign({}, treeIndeterminateMaps);
9969
+ const treeOpts = $xeTable.computeTreeOpts;
9970
+ const {
9971
+ transform,
9972
+ mapChildrenField
9973
+ } = treeOpts;
9974
+ const childrenField = treeOpts.children || treeOpts.childrenField;
9975
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
10108
9976
  const {
10109
9977
  checkField,
10110
9978
  checkStrictly,
10111
9979
  checkMethod
10112
9980
  } = checkboxOpts;
10113
- const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
10114
- if (!checkStrictly) {
10115
- const disableRows = [];
10116
- const checkRows = [];
10117
- let isAllResolve = false;
10118
- let isAllSelected = false;
10119
- let isIndeterminate = false;
10120
- if (checkField) {
10121
- isAllResolve = afterFullData.every(checkMethod ? row => {
10122
- if (!checkMethod({
10123
- row
9981
+ const {
9982
+ afterTreeFullData
9983
+ } = internalData;
9984
+ if (checkStrictly) {
9985
+ return;
9986
+ }
9987
+ // 树结构
9988
+ if (treeConfig) {
9989
+ const childRowMaps = {};
9990
+ const childRowList = [];
9991
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, row => {
9992
+ const rowid = getRowid($xeTable, row);
9993
+ const childList = row[transform ? mapChildrenField : childrenField];
9994
+ if (childList && childList.length && !childRowMaps[rowid]) {
9995
+ childRowMaps[rowid] = 1;
9996
+ childRowList.unshift([row, rowid, childList]);
9997
+ }
9998
+ }, {
9999
+ children: transform ? mapChildrenField : childrenField
10000
+ });
10001
+ childRowList.forEach(vals => {
10002
+ const row = vals[0];
10003
+ const rowid = vals[1];
10004
+ const childList = vals[2];
10005
+ let sLen = 0; // 已选
10006
+ let hLen = 0; // 半选
10007
+ let vLen = 0; // 有效行
10008
+ childList.forEach(checkMethod ? item => {
10009
+ const childRowid = getRowid($xeTable, item);
10010
+ const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectRowMaps[childRowid];
10011
+ if (checkMethod({
10012
+ row: item
10124
10013
  })) {
10125
- disableRows.push(row);
10126
- return true;
10014
+ if (isSelect) {
10015
+ sLen++;
10016
+ } else if (halfRowMaps[childRowid]) {
10017
+ hLen++;
10018
+ }
10019
+ vLen++;
10020
+ } else {
10021
+ if (isSelect) {
10022
+ sLen++;
10023
+ } else if (halfRowMaps[childRowid]) {
10024
+ hLen++;
10025
+ }
10127
10026
  }
10128
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField)) {
10129
- checkRows.push(row);
10130
- return true;
10027
+ } : item => {
10028
+ const childRowid = getRowid($xeTable, item);
10029
+ const isSelect = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(item, checkField) : selectRowMaps[childRowid];
10030
+ if (isSelect) {
10031
+ sLen++;
10032
+ } else if (halfRowMaps[childRowid]) {
10033
+ hLen++;
10131
10034
  }
10132
- return false;
10133
- } : row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
10134
- isAllSelected = isAllResolve && afterFullData.length !== disableRows.length;
10135
- if (treeConfig) {
10136
- if (indeterminateField) {
10137
- isIndeterminate = !isAllSelected && afterFullData.some(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, indeterminateField) || !!treeIndeterminateMaps[getRowid(this, row)]);
10138
- } else {
10139
- isIndeterminate = !isAllSelected && afterFullData.some(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) || !!treeIndeterminateMaps[getRowid(this, row)]);
10035
+ vLen++;
10036
+ });
10037
+ const isSelected = sLen >= vLen;
10038
+ const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
10039
+ if (checkField) {
10040
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField, isSelected);
10041
+ }
10042
+ if (isSelected) {
10043
+ if (!checkField) {
10044
+ selectRowMaps[rowid] = row;
10045
+ }
10046
+ if (halfRowMaps[rowid]) {
10047
+ delete halfRowMaps[rowid];
10140
10048
  }
10141
10049
  } else {
10142
- if (indeterminateField) {
10143
- isIndeterminate = !isAllSelected && afterFullData.some(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, indeterminateField));
10050
+ if (!checkField) {
10051
+ if (selectRowMaps[rowid]) {
10052
+ delete selectRowMaps[rowid];
10053
+ }
10054
+ }
10055
+ if (halfSelect) {
10056
+ halfRowMaps[rowid] = row;
10144
10057
  } else {
10145
- isIndeterminate = !isAllSelected && afterFullData.some(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
10058
+ if (halfRowMaps[rowid]) {
10059
+ delete halfRowMaps[rowid];
10060
+ }
10146
10061
  }
10147
10062
  }
10063
+ });
10064
+ }
10065
+ reactData.selectCheckboxMaps = selectRowMaps;
10066
+ reactData.treeIndeterminateMaps = halfRowMaps;
10067
+ },
10068
+ updateAllCheckboxStatus() {
10069
+ const $xeTable = this;
10070
+ const props = $xeTable;
10071
+ const reactData = $xeTable;
10072
+ const internalData = $xeTable;
10073
+ const {
10074
+ treeConfig
10075
+ } = props;
10076
+ const {
10077
+ selectCheckboxMaps,
10078
+ treeIndeterminateMaps
10079
+ } = reactData;
10080
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
10081
+ const {
10082
+ checkField,
10083
+ checkMethod
10084
+ } = checkboxOpts;
10085
+ const {
10086
+ afterFullData,
10087
+ afterTreeFullData
10088
+ } = internalData;
10089
+ let sLen = 0; // 已选
10090
+ let hLen = 0; // 半选
10091
+ let vLen = 0; // 有效行
10092
+ const rootList = treeConfig ? afterTreeFullData : afterFullData;
10093
+ rootList.forEach(checkMethod ? row => {
10094
+ const childRowid = getRowid($xeTable, row);
10095
+ const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
10096
+ if (checkMethod({
10097
+ row
10098
+ })) {
10099
+ if (selected) {
10100
+ sLen++;
10101
+ } else if (treeIndeterminateMaps[childRowid]) {
10102
+ hLen++;
10103
+ }
10104
+ vLen++;
10148
10105
  } else {
10149
- isAllResolve = afterFullData.every(checkMethod ? row => {
10150
- if (!checkMethod({
10151
- row
10152
- })) {
10153
- disableRows.push(row);
10154
- return true;
10155
- }
10156
- if (selectCheckboxMaps[getRowid(this, row)]) {
10157
- checkRows.push(row);
10158
- return true;
10159
- }
10160
- return false;
10161
- } : row => selectCheckboxMaps[getRowid(this, row)]);
10162
- isAllSelected = isAllResolve && afterFullData.length !== disableRows.length;
10163
- if (treeConfig) {
10164
- isIndeterminate = !isAllSelected && afterFullData.some(row => {
10165
- const itemRid = getRowid(this, row);
10166
- return treeIndeterminateMaps[itemRid] || selectCheckboxMaps[itemRid];
10167
- });
10168
- } else {
10169
- isIndeterminate = !isAllSelected && afterFullData.some(row => selectCheckboxMaps[getRowid(this, row)]);
10106
+ if (selected) {
10107
+ sLen++;
10108
+ } else if (treeIndeterminateMaps[childRowid]) {
10109
+ hLen++;
10170
10110
  }
10171
10111
  }
10172
- this.isAllSelected = isAllSelected;
10173
- this.isIndeterminate = isIndeterminate;
10174
- }
10112
+ } : row => {
10113
+ const childRowid = getRowid($xeTable, row);
10114
+ const selected = checkField ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField) : selectCheckboxMaps[childRowid];
10115
+ if (selected) {
10116
+ sLen++;
10117
+ } else if (treeIndeterminateMaps[childRowid]) {
10118
+ hLen++;
10119
+ }
10120
+ vLen++;
10121
+ });
10122
+ const isSelected = sLen >= vLen;
10123
+ const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
10124
+ reactData.isAllSelected = isSelected;
10125
+ reactData.isIndeterminate = halfSelect;
10126
+ },
10127
+ checkSelectionStatus() {
10128
+ const $xeTable = this;
10129
+ $xeTable.updateCheckboxStatus();
10130
+ $xeTable.updateAllCheckboxStatus();
10175
10131
  },
10176
10132
  // 还原展开、选中等相关状态
10177
10133
  handleReserveStatus() {
@@ -21765,6 +21721,7 @@ function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offs
21765
21721
  }
21766
21722
  },
21767
21723
  handleCheckboxRangeEvent(evnt, params) {
21724
+ const $xeTable = this;
21768
21725
  const {
21769
21726
  column,
21770
21727
  cell
@@ -21844,9 +21801,7 @@ function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offs
21844
21801
  lastRangeRows = rangeRows;
21845
21802
  if (evnt.ctrlKey) {
21846
21803
  rangeRows.forEach(row => {
21847
- this.handleSelectRow({
21848
- row
21849
- }, selectRecords.indexOf(row) === -1);
21804
+ $xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
21850
21805
  });
21851
21806
  } else {
21852
21807
  this.setAllCheckboxRow(false);
@@ -22555,33 +22510,17 @@ function validErrorRuleValue(rule, val) {
22555
22510
  /* harmony default export */ var custom_mixin = ({
22556
22511
  methods: {
22557
22512
  _openCustom() {
22513
+ const $xeTable = this;
22514
+ const reactData = $xeTable;
22558
22515
  const {
22559
22516
  initStore,
22560
- customStore,
22561
- collectColumn
22562
- } = this;
22563
- const sortMaps = {};
22564
- const fixedMaps = {};
22565
- const visibleMaps = {};
22566
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
22567
- const colid = column.getKey();
22568
- column.renderFixed = column.fixed;
22569
- column.renderVisible = column.visible;
22570
- column.renderResizeWidth = column.renderWidth;
22571
- sortMaps[colid] = column.renderSortNumber;
22572
- fixedMaps[colid] = column.fixed;
22573
- visibleMaps[colid] = column.visible;
22574
- }, {
22575
- children: 'children'
22576
- });
22577
- customStore.oldSortMaps = sortMaps;
22578
- customStore.oldFixedMaps = fixedMaps;
22579
- customStore.oldVisibleMaps = visibleMaps;
22580
- this.customColumnList = collectColumn.slice(0);
22517
+ customStore
22518
+ } = reactData;
22581
22519
  customStore.visible = true;
22582
22520
  initStore.custom = true;
22583
- this.checkCustomStatus();
22584
- this.calcMaxHeight();
22521
+ $xeTable.handleUpdateCustomColumn();
22522
+ $xeTable.checkCustomStatus();
22523
+ $xeTable.calcMaxHeight();
22585
22524
  return this.$nextTick().then(() => this.calcMaxHeight());
22586
22525
  },
22587
22526
  _closeCustom() {
@@ -22852,6 +22791,35 @@ function validErrorRuleValue(rule, val) {
22852
22791
  this.closeCustom();
22853
22792
  this.emitCustomEvent('close', evnt);
22854
22793
  }
22794
+ },
22795
+ handleUpdateCustomColumn() {
22796
+ const $xeTable = this;
22797
+ const reactData = $xeTable;
22798
+ const internalData = $xeTable;
22799
+ const {
22800
+ customStore
22801
+ } = reactData;
22802
+ const {
22803
+ collectColumn
22804
+ } = internalData;
22805
+ if (customStore.visible) {
22806
+ const sortMaps = {};
22807
+ const fixedMaps = {};
22808
+ const visibleMaps = {};
22809
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn, column => {
22810
+ const colid = column.getKey();
22811
+ column.renderFixed = column.fixed;
22812
+ column.renderVisible = column.visible;
22813
+ column.renderResizeWidth = column.renderWidth;
22814
+ sortMaps[colid] = column.renderSortNumber;
22815
+ fixedMaps[colid] = column.fixed;
22816
+ visibleMaps[colid] = column.visible;
22817
+ });
22818
+ customStore.oldSortMaps = sortMaps;
22819
+ customStore.oldFixedMaps = fixedMaps;
22820
+ customStore.oldVisibleMaps = visibleMaps;
22821
+ reactData.customColumnList = collectColumn.slice(0);
22822
+ }
22855
22823
  }
22856
22824
  }
22857
22825
  });
@@ -23567,24 +23535,40 @@ function handleUupdateResize(_vm) {
23567
23535
  } = this;
23568
23536
  return tableColumn.length || visibleColumn.length ? visibleColumn.filter(column => column.width === 'auto' || column.minWidth === 'auto') : [];
23569
23537
  },
23570
- fixedColumnSize() {
23538
+ computeFixedColumnSize() {
23539
+ const $xeTable = this;
23540
+ const reactData = $xeTable;
23541
+ const internalData = $xeTable;
23542
+ const {
23543
+ tableColumn
23544
+ } = reactData;
23571
23545
  const {
23572
23546
  collectColumn
23573
- } = this;
23547
+ } = internalData;
23574
23548
  let fixedSize = 0;
23575
- collectColumn.forEach(column => {
23576
- if (column.renderFixed) {
23577
- fixedSize++;
23578
- }
23579
- });
23549
+ // 只判断第一层
23550
+ if (tableColumn.length && collectColumn.length) {
23551
+ collectColumn.forEach(column => {
23552
+ if (column.renderFixed) {
23553
+ fixedSize++;
23554
+ }
23555
+ });
23556
+ }
23580
23557
  return fixedSize;
23581
23558
  },
23559
+ fixedColumnSize() {
23560
+ const $xeTable = this;
23561
+ return $xeTable.computeFixedColumnSize;
23562
+ },
23582
23563
  computeIsMaxFixedColumn() {
23564
+ const $xeTable = this;
23565
+ const fixedColumnSize = $xeTable.computeFixedColumnSize;
23566
+ const columnOpts = $xeTable.columnOpts;
23583
23567
  const {
23584
23568
  maxFixedSize
23585
- } = this.columnOpts;
23569
+ } = columnOpts;
23586
23570
  if (maxFixedSize) {
23587
- return this.fixedColumnSize >= maxFixedSize;
23571
+ return fixedColumnSize >= maxFixedSize;
23588
23572
  }
23589
23573
  return false;
23590
23574
  },