vxe-table 3.9.0 → 3.9.2

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 (88) hide show
  1. package/README.md +80 -9
  2. package/es/grid/src/grid.js +4 -4
  3. package/es/locale/lang/en-US.js +4 -1
  4. package/es/locale/lang/es-ES.js +3 -0
  5. package/es/locale/lang/hu-HU.js +3 -0
  6. package/es/locale/lang/ja-JP.js +3 -0
  7. package/es/locale/lang/ko-KR.js +3 -0
  8. package/es/locale/lang/pt-BR.js +3 -0
  9. package/es/locale/lang/ru-RU.js +3 -0
  10. package/es/locale/lang/uk-UA.js +3 -0
  11. package/es/locale/lang/vi-VN.js +3 -0
  12. package/es/locale/lang/zh-CHT.js +3 -0
  13. package/es/locale/lang/zh-CN.js +3 -0
  14. package/es/style.css +1 -1
  15. package/es/table/module/edit/mixin.js +2 -16
  16. package/es/table/src/methods.js +71 -22
  17. package/es/table/src/table.js +28 -28
  18. package/es/ui/index.js +2 -2
  19. package/es/ui/src/log.js +1 -1
  20. package/lib/grid/src/grid.js +4 -4
  21. package/lib/grid/src/grid.min.js +1 -1
  22. package/lib/index.umd.js +133 -86
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/en-US.js +4 -1
  25. package/lib/locale/lang/en-US.min.js +1 -1
  26. package/lib/locale/lang/en-US.umd.js +4 -1
  27. package/lib/locale/lang/es-ES.js +3 -0
  28. package/lib/locale/lang/es-ES.min.js +1 -1
  29. package/lib/locale/lang/es-ES.umd.js +3 -0
  30. package/lib/locale/lang/hu-HU.js +3 -0
  31. package/lib/locale/lang/hu-HU.min.js +1 -1
  32. package/lib/locale/lang/hu-HU.umd.js +3 -0
  33. package/lib/locale/lang/ja-JP.js +3 -0
  34. package/lib/locale/lang/ja-JP.min.js +1 -1
  35. package/lib/locale/lang/ja-JP.umd.js +3 -0
  36. package/lib/locale/lang/ko-KR.js +3 -0
  37. package/lib/locale/lang/ko-KR.min.js +1 -1
  38. package/lib/locale/lang/ko-KR.umd.js +3 -0
  39. package/lib/locale/lang/pt-BR.js +3 -0
  40. package/lib/locale/lang/pt-BR.min.js +1 -1
  41. package/lib/locale/lang/pt-BR.umd.js +3 -0
  42. package/lib/locale/lang/ru-RU.js +3 -0
  43. package/lib/locale/lang/ru-RU.min.js +1 -1
  44. package/lib/locale/lang/ru-RU.umd.js +3 -0
  45. package/lib/locale/lang/uk-UA.js +3 -0
  46. package/lib/locale/lang/uk-UA.min.js +1 -1
  47. package/lib/locale/lang/uk-UA.umd.js +3 -0
  48. package/lib/locale/lang/vi-VN.js +3 -0
  49. package/lib/locale/lang/vi-VN.min.js +1 -1
  50. package/lib/locale/lang/zh-CHT.js +3 -0
  51. package/lib/locale/lang/zh-CHT.min.js +1 -1
  52. package/lib/locale/lang/zh-CHT.umd.js +3 -0
  53. package/lib/locale/lang/zh-CN.js +3 -0
  54. package/lib/locale/lang/zh-CN.min.js +1 -1
  55. package/lib/locale/lang/zh-CN.umd.js +3 -0
  56. package/lib/style.css +1 -1
  57. package/lib/table/module/edit/mixin.js +2 -16
  58. package/lib/table/module/edit/mixin.min.js +1 -1
  59. package/lib/table/src/methods.js +93 -35
  60. package/lib/table/src/methods.min.js +1 -1
  61. package/lib/table/src/table.js +28 -28
  62. package/lib/table/src/table.min.js +1 -1
  63. package/lib/ui/index.js +2 -2
  64. package/lib/ui/index.min.js +1 -1
  65. package/lib/ui/src/log.js +1 -1
  66. package/lib/ui/src/log.min.js +1 -1
  67. package/package.json +2 -2
  68. package/packages/grid/src/grid.ts +4 -4
  69. package/packages/locale/lang/en-US.ts +4 -1
  70. package/packages/locale/lang/es-ES.ts +3 -0
  71. package/packages/locale/lang/hu-HU.ts +3 -0
  72. package/packages/locale/lang/ja-JP.ts +3 -0
  73. package/packages/locale/lang/ko-KR.ts +3 -0
  74. package/packages/locale/lang/pt-BR.ts +3 -0
  75. package/packages/locale/lang/ru-RU.ts +3 -0
  76. package/packages/locale/lang/uk-UA.ts +3 -0
  77. package/packages/locale/lang/vi-VN.ts +3 -0
  78. package/packages/locale/lang/zh-CHT.ts +3 -0
  79. package/packages/locale/lang/zh-CN.ts +3 -0
  80. package/packages/table/module/edit/mixin.ts +2 -16
  81. package/packages/table/src/methods.ts +73 -22
  82. package/packages/table/src/table.ts +28 -28
  83. /package/es/{iconfont.1728348263835.ttf → iconfont.1728637870047.ttf} +0 -0
  84. /package/es/{iconfont.1728348263835.woff → iconfont.1728637870047.woff} +0 -0
  85. /package/es/{iconfont.1728348263835.woff2 → iconfont.1728637870047.woff2} +0 -0
  86. /package/lib/{iconfont.1728348263835.ttf → iconfont.1728637870047.ttf} +0 -0
  87. /package/lib/{iconfont.1728348263835.woff → iconfont.1728637870047.woff} +0 -0
  88. /package/lib/{iconfont.1728348263835.woff2 → iconfont.1728637870047.woff2} +0 -0
@@ -749,23 +749,21 @@ const Methods = {
749
749
  * 更新数据行的 Map
750
750
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
751
751
  */
752
- cacheRowMap(source) {
752
+ cacheRowMap(isSource) {
753
753
  const {
754
754
  treeConfig,
755
755
  treeOpts,
756
756
  tableFullData,
757
- fullDataRowMap,
757
+ fullAllDataRowIdData,
758
758
  fullAllDataRowMap,
759
759
  tableFullTreeData
760
760
  } = this;
761
- let {
762
- fullDataRowIdData,
763
- fullAllDataRowIdData
764
- } = this;
765
761
  const childrenField = treeOpts.children || treeOpts.childrenField;
766
762
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
767
763
  const rowkey = (0, _util.getRowkey)(this);
768
764
  const isLazy = treeConfig && treeOpts.lazy;
765
+ const fullAllDataRowIdMaps = {};
766
+ const fullDataRowIdMaps = {};
769
767
  const handleCache = (row, index, items, path, parent, nodes) => {
770
768
  let rowid = (0, _util.getRowid)(this, row);
771
769
  const seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
@@ -777,29 +775,30 @@ const Methods = {
777
775
  if (isLazy && row[hasChildField] && _xeUtils.default.isUndefined(row[childrenField])) {
778
776
  row[childrenField] = null;
779
777
  }
780
- const rest = {
781
- row,
782
- rowid,
783
- seq,
784
- index: treeConfig && parent ? -1 : index,
785
- _index: -1,
786
- $index: -1,
787
- items,
788
- parent,
789
- level
790
- };
791
- if (source) {
792
- fullDataRowIdData[rowid] = rest;
793
- fullDataRowMap.set(row, rest);
778
+ let cacheItem = fullAllDataRowIdData[rowid];
779
+ if (!cacheItem) {
780
+ cacheItem = {
781
+ row,
782
+ rowid,
783
+ seq,
784
+ index: -1,
785
+ _index: -1,
786
+ $index: -1,
787
+ items,
788
+ parent,
789
+ level
790
+ };
794
791
  }
795
- fullAllDataRowIdData[rowid] = rest;
796
- fullAllDataRowMap.set(row, rest);
792
+ if (isSource) {
793
+ cacheItem.index = treeConfig && parent ? -1 : index;
794
+ fullDataRowIdMaps[rowid] = cacheItem;
795
+ }
796
+ fullAllDataRowIdMaps[rowid] = cacheItem;
797
797
  };
798
- if (source) {
799
- fullDataRowIdData = this.fullDataRowIdData = {};
800
- fullDataRowMap.clear();
798
+ if (isSource) {
799
+ this.fullDataRowIdData = fullDataRowIdMaps;
801
800
  }
802
- fullAllDataRowIdData = this.fullAllDataRowIdData = {};
801
+ this.fullAllDataRowIdData = fullAllDataRowIdMaps;
803
802
  fullAllDataRowMap.clear();
804
803
  if (treeConfig) {
805
804
  _xeUtils.default.eachTree(tableFullTreeData, handleCache, {
@@ -1093,11 +1092,11 @@ const Methods = {
1093
1092
  */
1094
1093
  getRowSeq(row) {
1095
1094
  const {
1096
- fullDataRowIdData
1095
+ fullAllDataRowIdData
1097
1096
  } = this;
1098
1097
  if (row) {
1099
1098
  const rowid = (0, _util.getRowid)(this, row);
1100
- const rest = fullDataRowIdData[rowid];
1099
+ const rest = fullAllDataRowIdData[rowid];
1101
1100
  if (rest) {
1102
1101
  return rest.seq;
1103
1102
  }
@@ -1109,14 +1108,34 @@ const Methods = {
1109
1108
  * @param {Row} row 行对象
1110
1109
  */
1111
1110
  getRowIndex(row) {
1112
- return this.fullDataRowMap.has(row) ? this.fullDataRowMap.get(row).index : -1;
1111
+ const {
1112
+ fullAllDataRowIdData
1113
+ } = this;
1114
+ if (row) {
1115
+ const rowid = (0, _util.getRowid)(this, row);
1116
+ const rest = fullAllDataRowIdData[rowid];
1117
+ if (rest) {
1118
+ return rest.index;
1119
+ }
1120
+ }
1121
+ return -1;
1113
1122
  },
1114
1123
  /**
1115
1124
  * 根据 row 获取相对于当前数据中的索引
1116
1125
  * @param {Row} row 行对象
1117
1126
  */
1118
1127
  getVTRowIndex(row) {
1119
- return this.afterFullData.indexOf(row);
1128
+ const {
1129
+ fullAllDataRowIdData
1130
+ } = this;
1131
+ if (row) {
1132
+ const rowid = (0, _util.getRowid)(this, row);
1133
+ const rest = fullAllDataRowIdData[rowid];
1134
+ if (rest) {
1135
+ return rest._index;
1136
+ }
1137
+ }
1138
+ return -1;
1120
1139
  },
1121
1140
  // 在 v3 中废弃
1122
1141
  _getRowIndex(row) {
@@ -1130,7 +1149,17 @@ const Methods = {
1130
1149
  * @param {Row} row 行对象
1131
1150
  */
1132
1151
  getVMRowIndex(row) {
1133
- return this.tableData.indexOf(row);
1152
+ const {
1153
+ fullAllDataRowIdData
1154
+ } = this;
1155
+ if (row) {
1156
+ const rowid = (0, _util.getRowid)(this, row);
1157
+ const rest = fullAllDataRowIdData[rowid];
1158
+ if (rest) {
1159
+ return rest.$index;
1160
+ }
1161
+ }
1162
+ return -1;
1134
1163
  },
1135
1164
  // 在 v3 中废弃
1136
1165
  $getRowIndex(row) {
@@ -1144,14 +1173,32 @@ const Methods = {
1144
1173
  * @param {ColumnInfo} column 列配置
1145
1174
  */
1146
1175
  getColumnIndex(column) {
1147
- return this.fullColumnMap.has(column) ? this.fullColumnMap.get(column).index : -1;
1176
+ const {
1177
+ fullColumnIdData
1178
+ } = this;
1179
+ if (column) {
1180
+ const rest = fullColumnIdData[column.id];
1181
+ if (rest) {
1182
+ return rest.index;
1183
+ }
1184
+ }
1185
+ return -1;
1148
1186
  },
1149
1187
  /**
1150
1188
  * 根据 column 获取相对于当前表格列中的索引
1151
1189
  * @param {ColumnInfo} column 列配置
1152
1190
  */
1153
1191
  getVTColumnIndex(column) {
1154
- return this.visibleColumn.indexOf(column);
1192
+ const {
1193
+ fullColumnIdData
1194
+ } = this;
1195
+ if (column) {
1196
+ const rest = fullColumnIdData[column.id];
1197
+ if (rest) {
1198
+ return rest._index;
1199
+ }
1200
+ }
1201
+ return -1;
1155
1202
  },
1156
1203
  // 在 v3 中废弃
1157
1204
  _getColumnIndex(column) {
@@ -1165,7 +1212,16 @@ const Methods = {
1165
1212
  * @param {ColumnInfo} column 列配置
1166
1213
  */
1167
1214
  getVMColumnIndex(column) {
1168
- return this.tableColumn.indexOf(column);
1215
+ const {
1216
+ fullColumnIdData
1217
+ } = this;
1218
+ if (column) {
1219
+ const rest = fullColumnIdData[column.id];
1220
+ if (rest) {
1221
+ return rest.$index;
1222
+ }
1223
+ }
1224
+ return -1;
1169
1225
  },
1170
1226
  // 在 v3 中废弃
1171
1227
  $getColumnIndex(column) {
@@ -2620,7 +2676,9 @@ const Methods = {
2620
2676
  });
2621
2677
  } else {
2622
2678
  const labelEl = cellEl.firstChild;
2623
- titleWidth = labelEl.offsetWidth;
2679
+ if (labelEl) {
2680
+ titleWidth = labelEl.offsetWidth;
2681
+ }
2624
2682
  }
2625
2683
  if (titleWidth) {
2626
2684
  colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);