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
@@ -639,7 +639,7 @@ const Methods = {
639
639
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
640
640
  */
641
641
  cacheRowMap(isSource) {
642
- const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, fullAllDataRowMap, tableFullTreeData } = this;
642
+ const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this;
643
643
  const childrenField = treeOpts.children || treeOpts.childrenField;
644
644
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
645
645
  const rowkey = getRowkey(this);
@@ -671,7 +671,6 @@ const Methods = {
671
671
  this.fullDataRowIdData = fullDataRowIdMaps;
672
672
  }
673
673
  this.fullAllDataRowIdData = fullAllDataRowIdMaps;
674
- fullAllDataRowMap.clear();
675
674
  if (treeConfig) {
676
675
  XEUtils.eachTree(tableFullTreeData, handleCache, { children: childrenField });
677
676
  }
@@ -709,11 +708,12 @@ const Methods = {
709
708
  return this.params;
710
709
  },
711
710
  loadTreeChildren(row, childRecords) {
712
- const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData, sourceDataRowIdData } = this;
711
+ const $xeTable = this;
712
+ const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullAllDataRowIdData, sourceDataRowIdData } = this;
713
713
  const { transform, mapChildrenField } = treeOpts;
714
714
  const childrenField = treeOpts.children || treeOpts.childrenField;
715
- const rest = fullAllDataRowIdData[getRowid(this, row)];
716
- const parentLevel = rest ? rest.level : 0;
715
+ const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)];
716
+ const parentLevel = parentRest ? parentRest.level : 0;
717
717
  return this.createData(childRecords).then((rows) => {
718
718
  if (keepSource) {
719
719
  const rowid = getRowid(this, row);
@@ -727,13 +727,11 @@ const Methods = {
727
727
  });
728
728
  }
729
729
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
730
- const rowid = getRowid(this, childRow);
731
- const parentRow = parent || row;
730
+ const rowid = getRowid($xeTable, childRow);
731
+ const parentRow = parent || parentRest.row;
732
732
  const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length };
733
733
  fullDataRowIdData[rowid] = rest;
734
- fullDataRowMap.set(childRow, rest);
735
734
  fullAllDataRowIdData[rowid] = rest;
736
- fullAllDataRowMap.set(childRow, rest);
737
735
  }, { children: childrenField });
738
736
  row[childrenField] = rows;
739
737
  if (transform) {
@@ -1193,6 +1191,7 @@ const Methods = {
1193
1191
  return null;
1194
1192
  },
1195
1193
  getCellLabel(row, fieldOrColumn) {
1194
+ const $xeTable = this;
1196
1195
  const column = handleFieldOrColumn(this, fieldOrColumn);
1197
1196
  if (!column) {
1198
1197
  return null;
@@ -1201,15 +1200,15 @@ const Methods = {
1201
1200
  const cellValue = getCellValue(row, column);
1202
1201
  let cellLabel = cellValue;
1203
1202
  if (formatter) {
1204
- let rest, formatData;
1205
- const { fullAllDataRowMap } = this;
1203
+ let formatData;
1204
+ const { fullAllDataRowIdData } = $xeTable;
1205
+ const rowid = getRowid($xeTable, row);
1206
1206
  const colid = column.id;
1207
- const cacheFormat = fullAllDataRowMap.has(row);
1208
- if (cacheFormat) {
1209
- rest = fullAllDataRowMap.get(row);
1207
+ const rest = fullAllDataRowIdData[rowid];
1208
+ if (rest) {
1210
1209
  formatData = rest.formatData;
1211
1210
  if (!formatData) {
1212
- formatData = fullAllDataRowMap.get(row).formatData = {};
1211
+ formatData = fullAllDataRowIdData[rowid].formatData = {};
1213
1212
  }
1214
1213
  if (rest && formatData[colid]) {
1215
1214
  if (formatData[colid].value === cellValue) {
@@ -1606,8 +1605,9 @@ const Methods = {
1606
1605
  * @param {Row} row 行对象
1607
1606
  */
1608
1607
  getRowid(row) {
1609
- const fullAllDataRowMap = this.fullAllDataRowMap;
1610
- return fullAllDataRowMap.has(row) ? fullAllDataRowMap.get(row).rowid : null;
1608
+ const $xeTable = this;
1609
+ const rowid = XEUtils.get(row, getRowkey($xeTable));
1610
+ return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid);
1611
1611
  },
1612
1612
  /**
1613
1613
  * 获取处理后的表格数据
@@ -3909,9 +3909,10 @@ const Methods = {
3909
3909
  },
3910
3910
  // 还原展开、选中等相关状态
3911
3911
  handleReserveStatus() {
3912
- const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRadioRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxMaps, rowExpandedMaps, treeExpandedMaps, expandOpts } = this;
3912
+ const $xeTable = this;
3913
+ const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowIdData, currentRow, selectRadioRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxMaps, rowExpandedMaps, treeExpandedMaps, expandOpts } = this;
3913
3914
  // 单选框
3914
- if (selectRadioRow && !fullAllDataRowMap.has(selectRadioRow)) {
3915
+ if (selectRadioRow && !fullAllDataRowIdData[getRowid($xeTable, selectRadioRow)]) {
3915
3916
  this.selectRadioRow = null; // 刷新单选行状态
3916
3917
  }
3917
3918
  // 还原保留选中状态
@@ -3927,7 +3928,7 @@ const Methods = {
3927
3928
  if (checkboxOpts.reserve) {
3928
3929
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
3929
3930
  }
3930
- if (currentRow && !fullAllDataRowMap.has(currentRow)) {
3931
+ if (currentRow && !this.fullAllDataRowIdData[getRowid($xeTable, currentRow)]) {
3931
3932
  this.currentRow = null; // 刷新当前行状态
3932
3933
  }
3933
3934
  // 行展开
@@ -4659,14 +4660,17 @@ const Methods = {
4659
4660
  * @param {Row} row 行对象
4660
4661
  */
4661
4662
  isRowExpandLoaded(row) {
4662
- const rest = this.fullAllDataRowMap.get(row);
4663
- return rest && rest.expandLoaded;
4663
+ const $xeTable = this;
4664
+ const { fullAllDataRowIdData } = this;
4665
+ const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
4666
+ return rest && !!rest.expandLoaded;
4664
4667
  },
4665
4668
  clearRowExpandLoaded(row) {
4666
- const { expandOpts, rowExpandLazyLoadedMaps, fullAllDataRowMap } = this;
4669
+ const $xeTable = this;
4670
+ const { expandOpts, rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
4667
4671
  const { lazy } = expandOpts;
4668
- const rowid = getRowid(this, row);
4669
- const rest = fullAllDataRowMap.get(row);
4672
+ const rowid = getRowid($xeTable, row);
4673
+ const rest = fullAllDataRowIdData[rowid];
4670
4674
  if (lazy && rest) {
4671
4675
  rest.expandLoaded = false;
4672
4676
  const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
@@ -4762,32 +4766,27 @@ const Methods = {
4762
4766
  return this.setRowExpand(expandedRows, expanded);
4763
4767
  },
4764
4768
  handleAsyncRowExpand(row) {
4765
- const { fullAllDataRowMap, expandOpts } = this;
4766
- const rest = fullAllDataRowMap.get(row);
4769
+ const $xeTable = this;
4767
4770
  return new Promise(resolve => {
4771
+ const { expandOpts } = this;
4768
4772
  const { loadMethod } = expandOpts;
4769
4773
  if (loadMethod) {
4770
- const { rowExpandLazyLoadedMaps } = this;
4771
- const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
4772
- const rowid = getRowid(this, row);
4773
- rowTempExpandLazyLoadedMaps[rowid] = row;
4774
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4775
- loadMethod({ $table: this, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
4776
- rest.expandLoaded = true;
4774
+ const { rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
4775
+ const rowid = getRowid($xeTable, row);
4776
+ const rest = fullAllDataRowIdData[rowid];
4777
+ rowExpandLazyLoadedMaps[rowid] = row;
4778
+ loadMethod({ $table: $xeTable, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
4777
4779
  const { rowExpandedMaps } = this;
4778
- const rowTempExpandedMaps = Object.assign({}, rowExpandedMaps);
4779
- rowTempExpandedMaps[rowid] = row;
4780
- this.rowExpandedMaps = rowTempExpandedMaps;
4780
+ rest.expandLoaded = true;
4781
+ rowExpandedMaps[rowid] = row;
4781
4782
  }).catch(() => {
4782
4783
  rest.expandLoaded = false;
4783
4784
  }).finally(() => {
4784
4785
  const { rowExpandLazyLoadedMaps } = this;
4785
- const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
4786
- if (rowTempExpandLazyLoadedMaps[rowid]) {
4787
- delete rowTempExpandLazyLoadedMaps[rowid];
4786
+ if (rowExpandLazyLoadedMaps[rowid]) {
4787
+ delete rowExpandLazyLoadedMaps[rowid];
4788
4788
  }
4789
- this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4790
- resolve(this.$nextTick().then(this.recalculate));
4789
+ this.$nextTick().then(() => this.recalculate()).then(() => resolve());
4791
4790
  });
4792
4791
  }
4793
4792
  else {
@@ -4933,14 +4932,17 @@ const Methods = {
4933
4932
  * @param {Row} row 行对象
4934
4933
  */
4935
4934
  isTreeExpandLoaded(row) {
4936
- const rest = this.fullAllDataRowMap.get(row);
4937
- return rest && rest.treeLoaded;
4935
+ const $xeTable = this;
4936
+ const { fullAllDataRowIdData } = this;
4937
+ const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
4938
+ return rest && !!rest.treeLoaded;
4938
4939
  },
4939
4940
  clearTreeExpandLoaded(row) {
4940
- const { treeOpts, treeExpandedMaps, fullAllDataRowMap } = this;
4941
+ const $xeTable = this;
4942
+ const { treeOpts, treeExpandedMaps, fullAllDataRowIdData } = this;
4941
4943
  const { transform, lazy } = treeOpts;
4942
- const rowid = getRowid(this, row);
4943
- const rest = fullAllDataRowMap.get(row);
4944
+ const rowid = getRowid($xeTable, row);
4945
+ const rest = fullAllDataRowIdData[rowid];
4944
4946
  if (lazy && rest) {
4945
4947
  rest.treeLoaded = false;
4946
4948
  if (treeExpandedMaps[rowid]) {
@@ -5034,20 +5036,20 @@ const Methods = {
5034
5036
  }
5035
5037
  },
5036
5038
  handleAsyncTreeExpandChilds(row) {
5039
+ const $xeTable = this;
5037
5040
  const { treeOpts, checkboxOpts } = this;
5038
5041
  const { transform, loadMethod } = treeOpts;
5039
5042
  const { checkStrictly } = checkboxOpts;
5040
5043
  return new Promise(resolve => {
5041
5044
  if (loadMethod) {
5042
- const { fullAllDataRowMap, treeExpandLazyLoadedMaps } = this;
5043
- const rowid = getRowid(this, row);
5044
- const rest = fullAllDataRowMap.get(row);
5045
+ const { treeExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
5046
+ const rowid = getRowid($xeTable, row);
5047
+ const rest = fullAllDataRowIdData[rowid];
5045
5048
  treeExpandLazyLoadedMaps[rowid] = row;
5046
- loadMethod({ $table: this, row }).then((childRecords) => {
5047
- // 响应成功后则展开行,并将子节点挂载到该节点下
5049
+ Promise.resolve(loadMethod({ $table: $xeTable, row })).then((childRecords) => {
5048
5050
  rest.treeLoaded = true;
5049
5051
  if (treeExpandLazyLoadedMaps[rowid]) {
5050
- treeExpandLazyLoadedMaps[rowid] = null;
5052
+ delete treeExpandLazyLoadedMaps[rowid];
5051
5053
  }
5052
5054
  if (!XEUtils.isArray(childRecords)) {
5053
5055
  childRecords = [];
@@ -5055,14 +5057,12 @@ const Methods = {
5055
5057
  if (childRecords) {
5056
5058
  return this.loadTreeChildren(row, childRecords).then((childRows) => {
5057
5059
  const { treeExpandedMaps } = this;
5058
- const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
5059
- if (childRows.length && !treeTempExpandedMaps[rowid]) {
5060
- treeTempExpandedMaps[rowid] = row;
5061
- this.treeExpandedMaps = treeTempExpandedMaps;
5060
+ if (childRows.length && !treeExpandedMaps[rowid]) {
5061
+ treeExpandedMaps[rowid] = row;
5062
5062
  }
5063
5063
  // 如果当前节点已选中,则展开后子节点也被选中
5064
5064
  if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
5065
- this.handleCheckedCheckboxRow(childRows, true, true);
5065
+ this.handleCheckedCheckboxRow(childRows, true);
5066
5066
  }
5067
5067
  return this.$nextTick().then(() => {
5068
5068
  if (transform) {
@@ -5072,11 +5072,10 @@ const Methods = {
5072
5072
  });
5073
5073
  }
5074
5074
  }).catch(() => {
5075
- // 如果响应异常,则不展开,再次点击后将重新触发懒加载
5076
- rest.treeLoaded = false;
5077
5075
  const { treeExpandLazyLoadedMaps } = this;
5076
+ rest.treeLoaded = false;
5078
5077
  if (treeExpandLazyLoadedMaps[rowid]) {
5079
- treeExpandLazyLoadedMaps[rowid] = null;
5078
+ delete treeExpandLazyLoadedMaps[rowid];
5080
5079
  }
5081
5080
  }).finally(() => {
5082
5081
  this.$nextTick().then(() => this.recalculate()).then(() => resolve());
@@ -5111,7 +5110,7 @@ const Methods = {
5111
5110
  * @returns
5112
5111
  */
5113
5112
  handleBaseTreeExpand(rows, expanded) {
5114
- const { fullAllDataRowMap, tableFullData, treeExpandedMaps, treeOpts, treeExpandLazyLoadedMaps, treeNodeColumn } = this;
5113
+ const { fullAllDataRowIdData, tableFullData, treeExpandedMaps, treeOpts, treeExpandLazyLoadedMaps, treeNodeColumn } = this;
5115
5114
  const { reserve, lazy, accordion, toggleMethod } = treeOpts;
5116
5115
  const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
5117
5116
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -5137,7 +5136,7 @@ const Methods = {
5137
5136
  validRows.forEach((row) => {
5138
5137
  const rowid = getRowid(this, row);
5139
5138
  if (!treeTempExpandedMaps[rowid]) {
5140
- const rest = fullAllDataRowMap.get(row);
5139
+ const rest = fullAllDataRowIdData[rowid];
5141
5140
  const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
5142
5141
  // 是否使用懒加载
5143
5142
  if (isLoad) {
@@ -736,7 +736,6 @@ export default {
736
736
  // 渲染所有列
737
737
  visibleColumn: [],
738
738
  // 缓存数据集
739
- fullAllDataRowMap: new Map(),
740
739
  fullAllDataRowIdData: {},
741
740
  fullDataRowMap: new Map(),
742
741
  fullDataRowIdData: {},
package/es/ui/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.9.10";
3
+ export const version = "3.9.12";
4
4
  VxeUI.version = version;
5
- VxeUI.tableVersion = "3.9.10";
5
+ VxeUI.tableVersion = "3.9.12";
6
6
  VxeUI.setConfig({
7
7
  emptyCell: ' ',
8
8
  table: {
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.9.10"}`;
3
+ const version = `table v${"3.9.12"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);