vxe-table 3.13.9 → 3.13.11

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.
@@ -259,8 +259,7 @@ function cacheColumnMap($xeTable) {
259
259
  index,
260
260
  items,
261
261
  parent: parentColumn || null,
262
- width: 0,
263
- oLeft: 0
262
+ width: 0
264
263
  };
265
264
  if (field) {
266
265
  if (fullColumnFieldData[field]) {
@@ -653,16 +652,10 @@ function updateStyle($xeTable) {
653
652
  if (layout === 'header') {
654
653
  // 表头体样式处理
655
654
  // 横向滚动渲染
656
- let tWidth = tableWidth;
657
655
  let renderColumnList = tableColumn;
658
656
  let isOptimizeMode = false;
659
657
  if (isGroup) {
660
658
  renderColumnList = visibleColumn;
661
- if (fixedType) {
662
- if (wrapperElem) {
663
- wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
664
- }
665
- }
666
659
  } else {
667
660
  // 如果是使用优化模式
668
661
  if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
@@ -678,14 +671,26 @@ function updateStyle($xeTable) {
678
671
  if (isOptimizeMode) {
679
672
  renderColumnList = fixedColumn || [];
680
673
  }
681
- if (!isOptimizeMode) {
674
+ }
675
+ }
676
+ const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
677
+ if (fixedType) {
678
+ if (isGroup) {
679
+ if (wrapperElem) {
680
+ wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
681
+ }
682
+ } else {
683
+ if (isOptimizeMode) {
682
684
  if (wrapperElem) {
683
685
  wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
684
686
  }
687
+ } else {
688
+ if (wrapperElem) {
689
+ wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
690
+ }
685
691
  }
686
692
  }
687
693
  }
688
- tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
689
694
  if (currScrollElem) {
690
695
  currScrollElem.style.height = `${headerHeight}px`;
691
696
  }
@@ -740,7 +745,6 @@ function updateStyle($xeTable) {
740
745
  fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + osbHeight}px`;
741
746
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
742
747
  }
743
- let tWidth = tableWidth;
744
748
  let renderColumnList = tableColumn;
745
749
  let isOptimizeMode = false;
746
750
  // 如果是使用优化模式
@@ -756,13 +760,19 @@ function updateStyle($xeTable) {
756
760
  if (isOptimizeMode) {
757
761
  renderColumnList = fixedColumn || [];
758
762
  }
759
- if (!isOptimizeMode) {
763
+ }
764
+ const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
765
+ if (fixedType) {
766
+ if (isOptimizeMode) {
760
767
  if (wrapperElem) {
761
768
  wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
762
769
  }
770
+ } else {
771
+ if (wrapperElem) {
772
+ wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
773
+ }
763
774
  }
764
775
  }
765
- tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
766
776
  if (tableElem) {
767
777
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
768
778
  // 兼容性处理
@@ -773,7 +783,6 @@ function updateStyle($xeTable) {
773
783
  emptyBlockElem.style.width = tWidth ? `${tWidth}px` : '';
774
784
  }
775
785
  } else if (layout === 'footer') {
776
- let tWidth = tableWidth;
777
786
  let renderColumnList = tableColumn;
778
787
  let isOptimizeMode = false;
779
788
  // 如果是使用优化模式
@@ -789,13 +798,19 @@ function updateStyle($xeTable) {
789
798
  if (isOptimizeMode) {
790
799
  renderColumnList = fixedColumn || [];
791
800
  }
792
- if (!isOptimizeMode) {
801
+ }
802
+ const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
803
+ if (fixedType) {
804
+ if (isOptimizeMode) {
793
805
  if (wrapperElem) {
794
806
  wrapperElem.style.width = tWidth ? `${tWidth}px` : '';
795
807
  }
808
+ } else {
809
+ if (wrapperElem) {
810
+ wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
811
+ }
796
812
  }
797
813
  }
798
- tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
799
814
  if (currScrollElem) {
800
815
  currScrollElem.style.height = `${footerHeight}px`;
801
816
  // 如果是固定列
@@ -1838,21 +1853,6 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
1838
1853
  }
1839
1854
  return $xeTable.$nextTick();
1840
1855
  }
1841
- const handleRowExpandReserve = ($xeTable, row, expanded) => {
1842
- const internalData = $xeTable;
1843
- const {
1844
- rowExpandedReserveRowMap
1845
- } = internalData;
1846
- const expandOpts = $xeTable.computeExpandOpts;
1847
- if (expandOpts.reserve) {
1848
- const rowid = (0, _util.getRowid)($xeTable, row);
1849
- if (expanded) {
1850
- rowExpandedReserveRowMap[rowid] = row;
1851
- } else if (rowExpandedReserveRowMap[rowid]) {
1852
- delete rowExpandedReserveRowMap[rowid];
1853
- }
1854
- }
1855
- };
1856
1856
  // 计算可视渲染相关数据
1857
1857
  function computeScrollLoad($xeTable) {
1858
1858
  const reactData = $xeTable;
@@ -8669,7 +8669,7 @@ const Methods = {
8669
8669
  });
8670
8670
  }
8671
8671
  if (reserve) {
8672
- validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
8672
+ validRows.forEach(row => this.handleRowExpandReserve(row, expanded));
8673
8673
  }
8674
8674
  }
8675
8675
  this.rowExpandedMaps = rExpandedMaps;
@@ -8704,32 +8704,42 @@ const Methods = {
8704
8704
  */
8705
8705
  clearRowExpand() {
8706
8706
  const $xeTable = this;
8707
- const reactData = $xeTable;
8708
- const internalData = $xeTable;
8709
8707
  const {
8708
+ expandOpts,
8710
8709
  tableFullData
8711
- } = internalData;
8712
- const expandOpts = $xeTable.computeExpandOpts;
8710
+ } = this;
8713
8711
  const {
8714
8712
  reserve
8715
8713
  } = expandOpts;
8716
- const expList = $xeTable.getRowExpandRecords();
8717
- reactData.rowExpandedMaps = {};
8714
+ const expList = this.getRowExpandRecords();
8715
+ this.rowExpandedMaps = {};
8718
8716
  if (reserve) {
8719
- tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
8717
+ tableFullData.forEach(row => this.handleRowExpandReserve(row, false));
8720
8718
  }
8721
- return $xeTable.$nextTick().then(() => {
8719
+ return this.$nextTick().then(() => {
8722
8720
  if (expList.length) {
8723
- return $xeTable.recalculate();
8721
+ this.recalculate();
8724
8722
  }
8725
- }).then(() => {
8726
- return $xeTable.updateCellAreas();
8727
- });
8723
+ }).then(() => $xeTable.updateCellAreas());
8728
8724
  },
8729
8725
  clearRowExpandReserve() {
8730
8726
  this.rowExpandedReserveRowMap = {};
8731
8727
  return this.$nextTick();
8732
8728
  },
8729
+ handleRowExpandReserve(row, expanded) {
8730
+ const {
8731
+ rowExpandedReserveRowMap,
8732
+ expandOpts
8733
+ } = this;
8734
+ if (expandOpts.reserve) {
8735
+ const rowid = (0, _util.getRowid)(this, row);
8736
+ if (expanded) {
8737
+ rowExpandedReserveRowMap[rowid] = row;
8738
+ } else if (rowExpandedReserveRowMap[rowid]) {
8739
+ delete rowExpandedReserveRowMap[rowid];
8740
+ }
8741
+ }
8742
+ },
8733
8743
  getRowExpandRecords() {
8734
8744
  const rest = [];
8735
8745
  _xeUtils.default.each(this.rowExpandedMaps, item => {