vxe-table 3.9.10 → 3.9.12

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 (83) hide show
  1. package/es/locale/lang/en-US.js +3 -1
  2. package/es/locale/lang/es-ES.js +3 -1
  3. package/es/locale/lang/hu-HU.js +3 -1
  4. package/es/locale/lang/ja-JP.js +3 -1
  5. package/es/locale/lang/ko-KR.js +3 -1
  6. package/es/locale/lang/pt-BR.js +3 -1
  7. package/es/locale/lang/ru-RU.js +3 -1
  8. package/es/locale/lang/uk-UA.js +3 -1
  9. package/es/locale/lang/vi-VN.js +3 -1
  10. package/es/locale/lang/zh-CHT.js +3 -1
  11. package/es/locale/lang/zh-CN.js +3 -1
  12. package/es/style.css +1 -1
  13. package/es/table/render/index.js +6 -0
  14. package/es/table/src/methods.js +62 -63
  15. package/es/table/src/table.js +0 -1
  16. package/es/ui/index.js +2 -2
  17. package/es/ui/src/log.js +1 -1
  18. package/lib/index.umd.js +83 -84
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/locale/lang/en-US.js +3 -1
  21. package/lib/locale/lang/en-US.min.js +1 -1
  22. package/lib/locale/lang/en-US.umd.js +3 -1
  23. package/lib/locale/lang/es-ES.js +3 -1
  24. package/lib/locale/lang/es-ES.min.js +1 -1
  25. package/lib/locale/lang/es-ES.umd.js +3 -1
  26. package/lib/locale/lang/hu-HU.js +3 -1
  27. package/lib/locale/lang/hu-HU.min.js +1 -1
  28. package/lib/locale/lang/hu-HU.umd.js +3 -1
  29. package/lib/locale/lang/ja-JP.js +3 -1
  30. package/lib/locale/lang/ja-JP.min.js +1 -1
  31. package/lib/locale/lang/ja-JP.umd.js +3 -1
  32. package/lib/locale/lang/ko-KR.js +3 -1
  33. package/lib/locale/lang/ko-KR.min.js +1 -1
  34. package/lib/locale/lang/ko-KR.umd.js +3 -1
  35. package/lib/locale/lang/pt-BR.js +3 -1
  36. package/lib/locale/lang/pt-BR.min.js +1 -1
  37. package/lib/locale/lang/pt-BR.umd.js +3 -1
  38. package/lib/locale/lang/ru-RU.js +3 -1
  39. package/lib/locale/lang/ru-RU.min.js +1 -1
  40. package/lib/locale/lang/ru-RU.umd.js +3 -1
  41. package/lib/locale/lang/uk-UA.js +3 -1
  42. package/lib/locale/lang/uk-UA.min.js +1 -1
  43. package/lib/locale/lang/uk-UA.umd.js +3 -1
  44. package/lib/locale/lang/vi-VN.js +3 -1
  45. package/lib/locale/lang/vi-VN.min.js +1 -1
  46. package/lib/locale/lang/zh-CHT.js +3 -1
  47. package/lib/locale/lang/zh-CHT.min.js +1 -1
  48. package/lib/locale/lang/zh-CHT.umd.js +3 -1
  49. package/lib/locale/lang/zh-CN.js +3 -1
  50. package/lib/locale/lang/zh-CN.min.js +1 -1
  51. package/lib/locale/lang/zh-CN.umd.js +3 -1
  52. package/lib/style.css +1 -1
  53. package/lib/table/render/index.js +6 -0
  54. package/lib/table/render/index.min.js +1 -1
  55. package/lib/table/src/methods.js +71 -71
  56. package/lib/table/src/methods.min.js +1 -1
  57. package/lib/table/src/table.js +0 -1
  58. package/lib/table/src/table.min.js +1 -1
  59. package/lib/ui/index.js +2 -2
  60. package/lib/ui/index.min.js +1 -1
  61. package/lib/ui/src/log.js +1 -1
  62. package/lib/ui/src/log.min.js +1 -1
  63. package/package.json +3 -3
  64. package/packages/locale/lang/en-US.ts +3 -1
  65. package/packages/locale/lang/es-ES.ts +3 -1
  66. package/packages/locale/lang/hu-HU.ts +3 -1
  67. package/packages/locale/lang/ja-JP.ts +3 -1
  68. package/packages/locale/lang/ko-KR.ts +3 -1
  69. package/packages/locale/lang/pt-BR.ts +3 -1
  70. package/packages/locale/lang/ru-RU.ts +3 -1
  71. package/packages/locale/lang/uk-UA.ts +3 -1
  72. package/packages/locale/lang/vi-VN.ts +3 -1
  73. package/packages/locale/lang/zh-CHT.ts +3 -1
  74. package/packages/locale/lang/zh-CN.ts +3 -1
  75. package/packages/table/render/index.ts +6 -0
  76. package/packages/table/src/methods.ts +75 -64
  77. package/packages/table/src/table.ts +0 -1
  78. /package/es/{iconfont.1729062501514.ttf → iconfont.1729311815181.ttf} +0 -0
  79. /package/es/{iconfont.1729062501514.woff → iconfont.1729311815181.woff} +0 -0
  80. /package/es/{iconfont.1729062501514.woff2 → iconfont.1729311815181.woff2} +0 -0
  81. /package/lib/{iconfont.1729062501514.ttf → iconfont.1729311815181.ttf} +0 -0
  82. /package/lib/{iconfont.1729062501514.woff → iconfont.1729311815181.woff} +0 -0
  83. /package/lib/{iconfont.1729062501514.woff2 → iconfont.1729311815181.woff2} +0 -0
@@ -754,7 +754,6 @@ const Methods = {
754
754
  treeOpts,
755
755
  tableFullData,
756
756
  fullAllDataRowIdData,
757
- fullAllDataRowMap,
758
757
  tableFullTreeData
759
758
  } = this;
760
759
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -798,7 +797,6 @@ const Methods = {
798
797
  this.fullDataRowIdData = fullDataRowIdMaps;
799
798
  }
800
799
  this.fullAllDataRowIdData = fullAllDataRowIdMaps;
801
- fullAllDataRowMap.clear();
802
800
  if (treeConfig) {
803
801
  _xeUtils.default.eachTree(tableFullTreeData, handleCache, {
804
802
  children: childrenField
@@ -842,13 +840,12 @@ const Methods = {
842
840
  return this.params;
843
841
  },
844
842
  loadTreeChildren(row, childRecords) {
843
+ const $xeTable = this;
845
844
  const {
846
845
  keepSource,
847
846
  tableSourceData,
848
847
  treeOpts,
849
848
  fullDataRowIdData,
850
- fullDataRowMap,
851
- fullAllDataRowMap,
852
849
  fullAllDataRowIdData,
853
850
  sourceDataRowIdData
854
851
  } = this;
@@ -857,8 +854,8 @@ const Methods = {
857
854
  mapChildrenField
858
855
  } = treeOpts;
859
856
  const childrenField = treeOpts.children || treeOpts.childrenField;
860
- const rest = fullAllDataRowIdData[(0, _util.getRowid)(this, row)];
861
- const parentLevel = rest ? rest.level : 0;
857
+ const parentRest = fullAllDataRowIdData[(0, _util.getRowid)($xeTable, row)];
858
+ const parentLevel = parentRest ? parentRest.level : 0;
862
859
  return this.createData(childRecords).then(rows => {
863
860
  if (keepSource) {
864
861
  const rowid = (0, _util.getRowid)(this, row);
@@ -874,8 +871,8 @@ const Methods = {
874
871
  });
875
872
  }
876
873
  _xeUtils.default.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
877
- const rowid = (0, _util.getRowid)(this, childRow);
878
- const parentRow = parent || row;
874
+ const rowid = (0, _util.getRowid)($xeTable, childRow);
875
+ const parentRow = parent || parentRest.row;
879
876
  const rest = {
880
877
  row: childRow,
881
878
  rowid,
@@ -888,9 +885,7 @@ const Methods = {
888
885
  level: parentLevel + nodes.length
889
886
  };
890
887
  fullDataRowIdData[rowid] = rest;
891
- fullDataRowMap.set(childRow, rest);
892
888
  fullAllDataRowIdData[rowid] = rest;
893
- fullAllDataRowMap.set(childRow, rest);
894
889
  }, {
895
890
  children: childrenField
896
891
  });
@@ -1415,6 +1410,7 @@ const Methods = {
1415
1410
  return null;
1416
1411
  },
1417
1412
  getCellLabel(row, fieldOrColumn) {
1413
+ const $xeTable = this;
1418
1414
  const column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
1419
1415
  if (!column) {
1420
1416
  return null;
@@ -1423,17 +1419,17 @@ const Methods = {
1423
1419
  const cellValue = (0, _util.getCellValue)(row, column);
1424
1420
  let cellLabel = cellValue;
1425
1421
  if (formatter) {
1426
- let rest, formatData;
1422
+ let formatData;
1427
1423
  const {
1428
- fullAllDataRowMap
1429
- } = this;
1424
+ fullAllDataRowIdData
1425
+ } = $xeTable;
1426
+ const rowid = (0, _util.getRowid)($xeTable, row);
1430
1427
  const colid = column.id;
1431
- const cacheFormat = fullAllDataRowMap.has(row);
1432
- if (cacheFormat) {
1433
- rest = fullAllDataRowMap.get(row);
1428
+ const rest = fullAllDataRowIdData[rowid];
1429
+ if (rest) {
1434
1430
  formatData = rest.formatData;
1435
1431
  if (!formatData) {
1436
- formatData = fullAllDataRowMap.get(row).formatData = {};
1432
+ formatData = fullAllDataRowIdData[rowid].formatData = {};
1437
1433
  }
1438
1434
  if (rest && formatData[colid]) {
1439
1435
  if (formatData[colid].value === cellValue) {
@@ -1975,8 +1971,9 @@ const Methods = {
1975
1971
  * @param {Row} row 行对象
1976
1972
  */
1977
1973
  getRowid(row) {
1978
- const fullAllDataRowMap = this.fullAllDataRowMap;
1979
- return fullAllDataRowMap.has(row) ? fullAllDataRowMap.get(row).rowid : null;
1974
+ const $xeTable = this;
1975
+ const rowid = _xeUtils.default.get(row, (0, _util.getRowkey)($xeTable));
1976
+ return _xeUtils.default.eqNull(rowid) ? '' : encodeURIComponent(rowid);
1980
1977
  },
1981
1978
  /**
1982
1979
  * 获取处理后的表格数据
@@ -4611,12 +4608,13 @@ const Methods = {
4611
4608
  },
4612
4609
  // 还原展开、选中等相关状态
4613
4610
  handleReserveStatus() {
4611
+ const $xeTable = this;
4614
4612
  const {
4615
4613
  expandColumn,
4616
4614
  treeOpts,
4617
4615
  treeConfig,
4618
4616
  fullDataRowIdData,
4619
- fullAllDataRowMap,
4617
+ fullAllDataRowIdData,
4620
4618
  currentRow,
4621
4619
  selectRadioRow,
4622
4620
  radioReserveRow,
@@ -4628,7 +4626,7 @@ const Methods = {
4628
4626
  expandOpts
4629
4627
  } = this;
4630
4628
  // 单选框
4631
- if (selectRadioRow && !fullAllDataRowMap.has(selectRadioRow)) {
4629
+ if (selectRadioRow && !fullAllDataRowIdData[(0, _util.getRowid)($xeTable, selectRadioRow)]) {
4632
4630
  this.selectRadioRow = null; // 刷新单选行状态
4633
4631
  }
4634
4632
  // 还原保留选中状态
@@ -4644,7 +4642,7 @@ const Methods = {
4644
4642
  if (checkboxOpts.reserve) {
4645
4643
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
4646
4644
  }
4647
- if (currentRow && !fullAllDataRowMap.has(currentRow)) {
4645
+ if (currentRow && !this.fullAllDataRowIdData[(0, _util.getRowid)($xeTable, currentRow)]) {
4648
4646
  this.currentRow = null; // 刷新当前行状态
4649
4647
  }
4650
4648
  // 行展开
@@ -5546,20 +5544,25 @@ const Methods = {
5546
5544
  * @param {Row} row 行对象
5547
5545
  */
5548
5546
  isRowExpandLoaded(row) {
5549
- const rest = this.fullAllDataRowMap.get(row);
5550
- return rest && rest.expandLoaded;
5547
+ const $xeTable = this;
5548
+ const {
5549
+ fullAllDataRowIdData
5550
+ } = this;
5551
+ const rest = fullAllDataRowIdData[(0, _util.getRowid)($xeTable, row)];
5552
+ return rest && !!rest.expandLoaded;
5551
5553
  },
5552
5554
  clearRowExpandLoaded(row) {
5555
+ const $xeTable = this;
5553
5556
  const {
5554
5557
  expandOpts,
5555
5558
  rowExpandLazyLoadedMaps,
5556
- fullAllDataRowMap
5559
+ fullAllDataRowIdData
5557
5560
  } = this;
5558
5561
  const {
5559
5562
  lazy
5560
5563
  } = expandOpts;
5561
- const rowid = (0, _util.getRowid)(this, row);
5562
- const rest = fullAllDataRowMap.get(row);
5564
+ const rowid = (0, _util.getRowid)($xeTable, row);
5565
+ const rest = fullAllDataRowIdData[rowid];
5563
5566
  if (lazy && rest) {
5564
5567
  rest.expandLoaded = false;
5565
5568
  const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
@@ -5687,48 +5690,43 @@ const Methods = {
5687
5690
  return this.setRowExpand(expandedRows, expanded);
5688
5691
  },
5689
5692
  handleAsyncRowExpand(row) {
5690
- const {
5691
- fullAllDataRowMap,
5692
- expandOpts
5693
- } = this;
5694
- const rest = fullAllDataRowMap.get(row);
5693
+ const $xeTable = this;
5695
5694
  return new Promise(resolve => {
5695
+ const {
5696
+ expandOpts
5697
+ } = this;
5696
5698
  const {
5697
5699
  loadMethod
5698
5700
  } = expandOpts;
5699
5701
  if (loadMethod) {
5700
5702
  const {
5701
- rowExpandLazyLoadedMaps
5703
+ rowExpandLazyLoadedMaps,
5704
+ fullAllDataRowIdData
5702
5705
  } = this;
5703
- const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
5704
- const rowid = (0, _util.getRowid)(this, row);
5705
- rowTempExpandLazyLoadedMaps[rowid] = row;
5706
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
5706
+ const rowid = (0, _util.getRowid)($xeTable, row);
5707
+ const rest = fullAllDataRowIdData[rowid];
5708
+ rowExpandLazyLoadedMaps[rowid] = row;
5707
5709
  loadMethod({
5708
- $table: this,
5710
+ $table: $xeTable,
5709
5711
  row,
5710
5712
  rowIndex: this.getRowIndex(row),
5711
5713
  $rowIndex: this.getVMRowIndex(row)
5712
5714
  }).then(() => {
5713
- rest.expandLoaded = true;
5714
5715
  const {
5715
5716
  rowExpandedMaps
5716
5717
  } = this;
5717
- const rowTempExpandedMaps = Object.assign({}, rowExpandedMaps);
5718
- rowTempExpandedMaps[rowid] = row;
5719
- this.rowExpandedMaps = rowTempExpandedMaps;
5718
+ rest.expandLoaded = true;
5719
+ rowExpandedMaps[rowid] = row;
5720
5720
  }).catch(() => {
5721
5721
  rest.expandLoaded = false;
5722
5722
  }).finally(() => {
5723
5723
  const {
5724
5724
  rowExpandLazyLoadedMaps
5725
5725
  } = this;
5726
- const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
5727
- if (rowTempExpandLazyLoadedMaps[rowid]) {
5728
- delete rowTempExpandLazyLoadedMaps[rowid];
5726
+ if (rowExpandLazyLoadedMaps[rowid]) {
5727
+ delete rowExpandLazyLoadedMaps[rowid];
5729
5728
  }
5730
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
5731
- resolve(this.$nextTick().then(this.recalculate));
5729
+ this.$nextTick().then(() => this.recalculate()).then(() => resolve());
5732
5730
  });
5733
5731
  } else {
5734
5732
  resolve();
@@ -5899,21 +5897,26 @@ const Methods = {
5899
5897
  * @param {Row} row 行对象
5900
5898
  */
5901
5899
  isTreeExpandLoaded(row) {
5902
- const rest = this.fullAllDataRowMap.get(row);
5903
- return rest && rest.treeLoaded;
5900
+ const $xeTable = this;
5901
+ const {
5902
+ fullAllDataRowIdData
5903
+ } = this;
5904
+ const rest = fullAllDataRowIdData[(0, _util.getRowid)($xeTable, row)];
5905
+ return rest && !!rest.treeLoaded;
5904
5906
  },
5905
5907
  clearTreeExpandLoaded(row) {
5908
+ const $xeTable = this;
5906
5909
  const {
5907
5910
  treeOpts,
5908
5911
  treeExpandedMaps,
5909
- fullAllDataRowMap
5912
+ fullAllDataRowIdData
5910
5913
  } = this;
5911
5914
  const {
5912
5915
  transform,
5913
5916
  lazy
5914
5917
  } = treeOpts;
5915
- const rowid = (0, _util.getRowid)(this, row);
5916
- const rest = fullAllDataRowMap.get(row);
5918
+ const rowid = (0, _util.getRowid)($xeTable, row);
5919
+ const rest = fullAllDataRowIdData[rowid];
5917
5920
  if (lazy && rest) {
5918
5921
  rest.treeLoaded = false;
5919
5922
  if (treeExpandedMaps[rowid]) {
@@ -6036,6 +6039,7 @@ const Methods = {
6036
6039
  }
6037
6040
  },
6038
6041
  handleAsyncTreeExpandChilds(row) {
6042
+ const $xeTable = this;
6039
6043
  const {
6040
6044
  treeOpts,
6041
6045
  checkboxOpts
@@ -6050,20 +6054,19 @@ const Methods = {
6050
6054
  return new Promise(resolve => {
6051
6055
  if (loadMethod) {
6052
6056
  const {
6053
- fullAllDataRowMap,
6054
- treeExpandLazyLoadedMaps
6057
+ treeExpandLazyLoadedMaps,
6058
+ fullAllDataRowIdData
6055
6059
  } = this;
6056
- const rowid = (0, _util.getRowid)(this, row);
6057
- const rest = fullAllDataRowMap.get(row);
6060
+ const rowid = (0, _util.getRowid)($xeTable, row);
6061
+ const rest = fullAllDataRowIdData[rowid];
6058
6062
  treeExpandLazyLoadedMaps[rowid] = row;
6059
- loadMethod({
6060
- $table: this,
6063
+ Promise.resolve(loadMethod({
6064
+ $table: $xeTable,
6061
6065
  row
6062
- }).then(childRecords => {
6063
- // 响应成功后则展开行,并将子节点挂载到该节点下
6066
+ })).then(childRecords => {
6064
6067
  rest.treeLoaded = true;
6065
6068
  if (treeExpandLazyLoadedMaps[rowid]) {
6066
- treeExpandLazyLoadedMaps[rowid] = null;
6069
+ delete treeExpandLazyLoadedMaps[rowid];
6067
6070
  }
6068
6071
  if (!_xeUtils.default.isArray(childRecords)) {
6069
6072
  childRecords = [];
@@ -6073,14 +6076,12 @@ const Methods = {
6073
6076
  const {
6074
6077
  treeExpandedMaps
6075
6078
  } = this;
6076
- const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
6077
- if (childRows.length && !treeTempExpandedMaps[rowid]) {
6078
- treeTempExpandedMaps[rowid] = row;
6079
- this.treeExpandedMaps = treeTempExpandedMaps;
6079
+ if (childRows.length && !treeExpandedMaps[rowid]) {
6080
+ treeExpandedMaps[rowid] = row;
6080
6081
  }
6081
6082
  // 如果当前节点已选中,则展开后子节点也被选中
6082
6083
  if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
6083
- this.handleCheckedCheckboxRow(childRows, true, true);
6084
+ this.handleCheckedCheckboxRow(childRows, true);
6084
6085
  }
6085
6086
  return this.$nextTick().then(() => {
6086
6087
  if (transform) {
@@ -6090,13 +6091,12 @@ const Methods = {
6090
6091
  });
6091
6092
  }
6092
6093
  }).catch(() => {
6093
- // 如果响应异常,则不展开,再次点击后将重新触发懒加载
6094
- rest.treeLoaded = false;
6095
6094
  const {
6096
6095
  treeExpandLazyLoadedMaps
6097
6096
  } = this;
6097
+ rest.treeLoaded = false;
6098
6098
  if (treeExpandLazyLoadedMaps[rowid]) {
6099
- treeExpandLazyLoadedMaps[rowid] = null;
6099
+ delete treeExpandLazyLoadedMaps[rowid];
6100
6100
  }
6101
6101
  }).finally(() => {
6102
6102
  this.$nextTick().then(() => this.recalculate()).then(() => resolve());
@@ -6138,7 +6138,7 @@ const Methods = {
6138
6138
  */
6139
6139
  handleBaseTreeExpand(rows, expanded) {
6140
6140
  const {
6141
- fullAllDataRowMap,
6141
+ fullAllDataRowIdData,
6142
6142
  tableFullData,
6143
6143
  treeExpandedMaps,
6144
6144
  treeOpts,
@@ -6183,7 +6183,7 @@ const Methods = {
6183
6183
  validRows.forEach(row => {
6184
6184
  const rowid = (0, _util.getRowid)(this, row);
6185
6185
  if (!treeTempExpandedMaps[rowid]) {
6186
- const rest = fullAllDataRowMap.get(row);
6186
+ const rest = fullAllDataRowIdData[rowid];
6187
6187
  const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
6188
6188
  // 是否使用懒加载
6189
6189
  if (isLoad) {