vxe-table 3.9.8 → 3.9.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.
package/lib/index.umd.js CHANGED
@@ -2220,9 +2220,9 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.9.8";
2223
+ const version = "3.9.10";
2224
2224
  core_.VxeUI.version = version;
2225
- core_.VxeUI.tableVersion = "3.9.8";
2225
+ core_.VxeUI.tableVersion = "3.9.10";
2226
2226
  core_.VxeUI.setConfig({
2227
2227
  emptyCell: ' ',
2228
2228
  table: {
@@ -2764,7 +2764,7 @@ function isNodeElement(elem) {
2764
2764
  const {
2765
2765
  log: log_log
2766
2766
  } = core_.VxeUI;
2767
- const log_version = `table v${"3.9.8"}`;
2767
+ const log_version = `table v${"3.9.10"}`;
2768
2768
  const warnLog = log_log.create('warn', log_version);
2769
2769
  const errLog = log_log.create('error', log_version);
2770
2770
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3362,17 +3362,18 @@ function colToVisible($xeTable, column) {
3362
3362
  const tdElem = bodyElem.querySelector(`.${column.id}`);
3363
3363
  if (tdElem) {
3364
3364
  const tdOffsetLeft = tdElem.offsetLeft + (tdElem.offsetParent ? tdElem.offsetParent.offsetLeft : 0);
3365
- const tdWidth = tdElem.clientWidth;
3366
- // 检测行是否在可视区中
3365
+ const cellWidth = tdElem.clientWidth;
3366
+ // 检测是否在可视区中
3367
3367
  if (tdOffsetLeft < bodySrcollLeft + offsetFixedLeft) {
3368
3368
  return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1);
3369
- } else if (tdOffsetLeft + tdWidth >= bodyWidth + bodySrcollLeft - offsetFixedRight) {
3370
- return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - offsetFixedRight + 1);
3369
+ } else if (tdOffsetLeft + cellWidth - bodySrcollLeft > bodyWidth - offsetFixedRight) {
3370
+ return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
3371
3371
  }
3372
3372
  } else {
3373
3373
  // 检测是否在虚拟渲染可视区中
3374
3374
  if (scrollXLoad) {
3375
3375
  let scrollLeft = 0;
3376
+ const cellWidth = column.renderWidth;
3376
3377
  for (let index = 0; index < visibleColumn.length; index++) {
3377
3378
  if (visibleColumn[index] === column) {
3378
3379
  break;
@@ -3382,7 +3383,7 @@ function colToVisible($xeTable, column) {
3382
3383
  if (scrollLeft < bodySrcollLeft) {
3383
3384
  return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1);
3384
3385
  }
3385
- return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - offsetFixedRight + 1);
3386
+ return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
3386
3387
  }
3387
3388
  }
3388
3389
  }
@@ -5057,7 +5058,6 @@ const Methods = {
5057
5058
  } = this;
5058
5059
  return this.handleTableData(true).then(() => {
5059
5060
  this.updateFooter();
5060
- this.checkSelectionStatus();
5061
5061
  if (scrollXLoad || scrollYLoad) {
5062
5062
  if (scrollXLoad) {
5063
5063
  this.updateScrollXSpace();
@@ -8642,9 +8642,8 @@ const Methods = {
8642
8642
  if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
8643
8643
  rows = [rows];
8644
8644
  }
8645
- rows.forEach(row => this.handleSelectRow({
8646
- row
8647
- }, !!value, isForce));
8645
+ this.handleBatchSelectRows(rows, !!value, isForce);
8646
+ this.checkSelectionStatus();
8648
8647
  return this.$nextTick();
8649
8648
  },
8650
8649
  /**
@@ -8653,6 +8652,9 @@ const Methods = {
8653
8652
  * @param {Boolean} value 是否选中
8654
8653
  */
8655
8654
  setCheckboxRow(rows, value) {
8655
+ if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
8656
+ rows = [rows];
8657
+ }
8656
8658
  return this.handleCheckedCheckboxRow(rows, value, true);
8657
8659
  },
8658
8660
  isCheckedByCheckboxRow(row) {
@@ -8673,6 +8675,72 @@ const Methods = {
8673
8675
  } = this;
8674
8676
  return !!treeIndeterminateMaps[getRowid(this, row)] && !this.isCheckedByCheckboxRow(row);
8675
8677
  },
8678
+ /**
8679
+ * 多行
8680
+ * 多选,行选中事件
8681
+ * value 选中true 不选false 半选-1
8682
+ */
8683
+ handleBatchSelectRows(rows, value, isForce) {
8684
+ const $xeTable = this;
8685
+ const {
8686
+ treeConfig
8687
+ } = $xeTable;
8688
+ const {
8689
+ selectCheckboxMaps,
8690
+ checkboxOpts
8691
+ } = this;
8692
+ const {
8693
+ checkField,
8694
+ checkStrictly,
8695
+ checkMethod
8696
+ } = checkboxOpts;
8697
+ if (checkField) {
8698
+ if (treeConfig && !checkStrictly) {
8699
+ rows.forEach(row => {
8700
+ this.handleSelectRow({
8701
+ row
8702
+ }, value, isForce);
8703
+ });
8704
+ } else {
8705
+ rows.forEach(row => {
8706
+ if (isForce || !checkMethod || checkMethod({
8707
+ row
8708
+ })) {
8709
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, checkField, value);
8710
+ this.handleCheckboxReserveRow(row, value);
8711
+ }
8712
+ });
8713
+ }
8714
+ } else {
8715
+ if (treeConfig && !checkStrictly) {
8716
+ rows.forEach(row => {
8717
+ this.handleSelectRow({
8718
+ row
8719
+ }, value, isForce);
8720
+ });
8721
+ } else {
8722
+ const selectRowMaps = Object.assign({}, selectCheckboxMaps);
8723
+ rows.forEach(row => {
8724
+ const rowid = getRowid($xeTable, row);
8725
+ if (isForce || !checkMethod || checkMethod({
8726
+ row
8727
+ })) {
8728
+ if (value) {
8729
+ if (!selectRowMaps[rowid]) {
8730
+ selectRowMaps[rowid] = row;
8731
+ }
8732
+ } else {
8733
+ if (selectRowMaps[rowid]) {
8734
+ delete selectRowMaps[rowid];
8735
+ }
8736
+ }
8737
+ this.handleCheckboxReserveRow(row, value);
8738
+ }
8739
+ });
8740
+ this.selectCheckboxMaps = selectRowMaps;
8741
+ }
8742
+ }
8743
+ },
8676
8744
  /**
8677
8745
  * 多选,行选中事件
8678
8746
  * value 选中true 不选false 半选-1
@@ -8873,7 +8941,6 @@ const Methods = {
8873
8941
  }
8874
8942
  }
8875
8943
  this.selectCheckboxMaps = selectRowMaps;
8876
- this.checkSelectionStatus();
8877
8944
  },
8878
8945
  handleToggleCheckRowEvent(evnt, params) {
8879
8946
  const {
@@ -8900,6 +8967,7 @@ const Methods = {
8900
8967
  this.triggerCheckRowEvent(evnt, params, value);
8901
8968
  } else {
8902
8969
  this.handleSelectRow(params, value);
8970
+ this.checkSelectionStatus();
8903
8971
  }
8904
8972
  },
8905
8973
  triggerCheckRowEvent(evnt, params, value) {
@@ -8939,6 +9007,7 @@ const Methods = {
8939
9007
  row
8940
9008
  })) {
8941
9009
  this.handleSelectRow(params, value);
9010
+ this.checkSelectionStatus();
8942
9011
  this.emitEvent('checkbox-change', Object.assign({
8943
9012
  records: this.getCheckboxRecords(),
8944
9013
  reserves: this.getCheckboxReserveRecords(),
@@ -8962,6 +9031,7 @@ const Methods = {
8962
9031
  this.handleSelectRow({
8963
9032
  row
8964
9033
  }, value, true);
9034
+ this.checkSelectionStatus();
8965
9035
  return this.$nextTick();
8966
9036
  },
8967
9037
  handleCheckedAllCheckboxRow(value, isForce) {