vxe-table 4.12.0-beta.9 → 4.12.0

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 (185) hide show
  1. package/es/grid/src/grid.js +45 -36
  2. package/es/locale/lang/ar-EG.js +7 -1
  3. package/es/locale/lang/de-DE.js +7 -1
  4. package/es/locale/lang/en-US.js +7 -1
  5. package/es/locale/lang/es-ES.js +7 -1
  6. package/es/locale/lang/fr-FR.js +7 -1
  7. package/es/locale/lang/hu-HU.js +7 -1
  8. package/es/locale/lang/hy-AM.js +7 -1
  9. package/es/locale/lang/id-ID.js +7 -1
  10. package/es/locale/lang/it-IT.js +7 -1
  11. package/es/locale/lang/ja-JP.js +7 -1
  12. package/es/locale/lang/ko-KR.js +7 -1
  13. package/es/locale/lang/nb-NO.js +7 -1
  14. package/es/locale/lang/pt-BR.js +7 -1
  15. package/es/locale/lang/ru-RU.js +7 -1
  16. package/es/locale/lang/th-TH.js +7 -1
  17. package/es/locale/lang/ug-CN.js +7 -1
  18. package/es/locale/lang/uk-UA.js +7 -1
  19. package/es/locale/lang/vi-VN.js +7 -1
  20. package/es/locale/lang/zh-CHT.js +7 -1
  21. package/es/locale/lang/zh-CN.js +7 -1
  22. package/es/style.css +1 -1
  23. package/es/table/module/custom/hook.js +1 -1
  24. package/es/table/module/custom/panel.js +4 -2
  25. package/es/table/module/edit/hook.js +11 -12
  26. package/es/table/module/export/export-panel.js +3 -2
  27. package/es/table/module/export/import-panel.js +3 -2
  28. package/es/table/module/filter/panel.js +12 -2
  29. package/es/table/module/keyboard/hook.js +105 -30
  30. package/es/table/module/menu/hook.js +2 -1
  31. package/es/table/module/validator/hook.js +4 -3
  32. package/es/table/render/index.js +3 -3
  33. package/es/table/src/body.js +40 -21
  34. package/es/table/src/cell.js +43 -24
  35. package/es/table/src/columnInfo.js +2 -2
  36. package/es/table/src/footer.js +12 -7
  37. package/es/table/src/header.js +12 -7
  38. package/es/table/src/props.js +4 -0
  39. package/es/table/src/table.js +435 -420
  40. package/es/table/src/util.js +34 -6
  41. package/es/ui/index.js +2 -1
  42. package/es/ui/src/log.js +1 -1
  43. package/helper/vetur/attributes.json +1 -1
  44. package/helper/vetur/tags.json +1 -1
  45. package/lib/grid/src/grid.js +42 -40
  46. package/lib/grid/src/grid.min.js +1 -1
  47. package/lib/index.umd.js +500 -292
  48. package/lib/index.umd.min.js +1 -1
  49. package/lib/locale/lang/ar-EG.js +7 -1
  50. package/lib/locale/lang/ar-EG.min.js +1 -1
  51. package/lib/locale/lang/de-DE.js +7 -1
  52. package/lib/locale/lang/de-DE.min.js +1 -1
  53. package/lib/locale/lang/en-US.js +7 -1
  54. package/lib/locale/lang/en-US.min.js +1 -1
  55. package/lib/locale/lang/en-US.umd.js +7 -1
  56. package/lib/locale/lang/es-ES.js +7 -1
  57. package/lib/locale/lang/es-ES.min.js +1 -1
  58. package/lib/locale/lang/es-ES.umd.js +7 -1
  59. package/lib/locale/lang/fr-FR.js +7 -1
  60. package/lib/locale/lang/fr-FR.min.js +1 -1
  61. package/lib/locale/lang/hu-HU.js +7 -1
  62. package/lib/locale/lang/hu-HU.min.js +1 -1
  63. package/lib/locale/lang/hu-HU.umd.js +7 -1
  64. package/lib/locale/lang/hy-AM.js +7 -1
  65. package/lib/locale/lang/hy-AM.min.js +1 -1
  66. package/lib/locale/lang/id-ID.js +7 -1
  67. package/lib/locale/lang/id-ID.min.js +1 -1
  68. package/lib/locale/lang/it-IT.js +7 -1
  69. package/lib/locale/lang/it-IT.min.js +1 -1
  70. package/lib/locale/lang/ja-JP.js +7 -1
  71. package/lib/locale/lang/ja-JP.min.js +1 -1
  72. package/lib/locale/lang/ja-JP.umd.js +7 -1
  73. package/lib/locale/lang/ko-KR.js +7 -1
  74. package/lib/locale/lang/ko-KR.min.js +1 -1
  75. package/lib/locale/lang/ko-KR.umd.js +7 -1
  76. package/lib/locale/lang/nb-NO.js +7 -1
  77. package/lib/locale/lang/nb-NO.min.js +1 -1
  78. package/lib/locale/lang/pt-BR.js +7 -1
  79. package/lib/locale/lang/pt-BR.min.js +1 -1
  80. package/lib/locale/lang/pt-BR.umd.js +7 -1
  81. package/lib/locale/lang/ru-RU.js +7 -1
  82. package/lib/locale/lang/ru-RU.min.js +1 -1
  83. package/lib/locale/lang/ru-RU.umd.js +7 -1
  84. package/lib/locale/lang/th-TH.js +7 -1
  85. package/lib/locale/lang/th-TH.min.js +1 -1
  86. package/lib/locale/lang/ug-CN.js +7 -1
  87. package/lib/locale/lang/ug-CN.min.js +1 -1
  88. package/lib/locale/lang/uk-UA.js +7 -1
  89. package/lib/locale/lang/uk-UA.min.js +1 -1
  90. package/lib/locale/lang/uk-UA.umd.js +7 -1
  91. package/lib/locale/lang/vi-VN.js +7 -1
  92. package/lib/locale/lang/vi-VN.min.js +1 -1
  93. package/lib/locale/lang/zh-CHT.js +7 -1
  94. package/lib/locale/lang/zh-CHT.min.js +1 -1
  95. package/lib/locale/lang/zh-CN.js +7 -1
  96. package/lib/locale/lang/zh-CN.min.js +1 -1
  97. package/lib/locale/lang/zh-CN.umd.js +7 -1
  98. package/lib/style.css +1 -1
  99. package/lib/table/module/custom/hook.js +1 -1
  100. package/lib/table/module/custom/hook.min.js +1 -1
  101. package/lib/table/module/custom/panel.js +4 -2
  102. package/lib/table/module/custom/panel.min.js +1 -1
  103. package/lib/table/module/edit/hook.js +13 -13
  104. package/lib/table/module/edit/hook.min.js +1 -1
  105. package/lib/table/module/export/export-panel.js +3 -2
  106. package/lib/table/module/export/export-panel.min.js +1 -1
  107. package/lib/table/module/export/import-panel.js +3 -2
  108. package/lib/table/module/export/import-panel.min.js +1 -1
  109. package/lib/table/module/filter/panel.js +8 -2
  110. package/lib/table/module/filter/panel.min.js +1 -1
  111. package/lib/table/module/keyboard/hook.js +113 -31
  112. package/lib/table/module/keyboard/hook.min.js +1 -1
  113. package/lib/table/module/menu/hook.js +2 -1
  114. package/lib/table/module/menu/hook.min.js +1 -1
  115. package/lib/table/module/validator/hook.js +5 -4
  116. package/lib/table/module/validator/hook.min.js +1 -1
  117. package/lib/table/render/index.js +4 -3
  118. package/lib/table/render/index.min.js +1 -1
  119. package/lib/table/src/body.js +48 -20
  120. package/lib/table/src/body.min.js +1 -1
  121. package/lib/table/src/cell.js +49 -25
  122. package/lib/table/src/cell.min.js +1 -1
  123. package/lib/table/src/columnInfo.js +2 -4
  124. package/lib/table/src/columnInfo.min.js +1 -1
  125. package/lib/table/src/footer.js +12 -5
  126. package/lib/table/src/footer.min.js +1 -1
  127. package/lib/table/src/header.js +12 -5
  128. package/lib/table/src/header.min.js +1 -1
  129. package/lib/table/src/props.js +4 -0
  130. package/lib/table/src/props.min.js +1 -1
  131. package/lib/table/src/table.js +523 -456
  132. package/lib/table/src/table.min.js +1 -1
  133. package/lib/table/src/util.js +36 -6
  134. package/lib/table/src/util.min.js +1 -1
  135. package/lib/ui/index.js +2 -1
  136. package/lib/ui/index.min.js +1 -1
  137. package/lib/ui/src/log.js +1 -1
  138. package/lib/ui/src/log.min.js +1 -1
  139. package/package.json +2 -2
  140. package/packages/grid/src/grid.ts +49 -42
  141. package/packages/locale/lang/ar-EG.ts +7 -1
  142. package/packages/locale/lang/de-DE.ts +7 -1
  143. package/packages/locale/lang/en-US.ts +7 -1
  144. package/packages/locale/lang/es-ES.ts +7 -1
  145. package/packages/locale/lang/fr-FR.ts +7 -1
  146. package/packages/locale/lang/hu-HU.ts +7 -1
  147. package/packages/locale/lang/hy-AM.ts +7 -1
  148. package/packages/locale/lang/id-ID.ts +7 -1
  149. package/packages/locale/lang/it-IT.ts +7 -1
  150. package/packages/locale/lang/ja-JP.ts +7 -1
  151. package/packages/locale/lang/ko-KR.ts +7 -1
  152. package/packages/locale/lang/nb-NO.ts +7 -1
  153. package/packages/locale/lang/pt-BR.ts +7 -1
  154. package/packages/locale/lang/ru-RU.ts +7 -1
  155. package/packages/locale/lang/th-TH.ts +7 -1
  156. package/packages/locale/lang/ug-CN.ts +7 -1
  157. package/packages/locale/lang/uk-UA.ts +7 -1
  158. package/packages/locale/lang/vi-VN.ts +7 -1
  159. package/packages/locale/lang/zh-CHT.ts +7 -1
  160. package/packages/locale/lang/zh-CN.ts +7 -1
  161. package/packages/table/module/custom/hook.ts +1 -1
  162. package/packages/table/module/custom/panel.ts +6 -2
  163. package/packages/table/module/edit/hook.ts +12 -12
  164. package/packages/table/module/export/export-panel.ts +4 -2
  165. package/packages/table/module/export/import-panel.ts +4 -2
  166. package/packages/table/module/filter/panel.ts +12 -2
  167. package/packages/table/module/keyboard/hook.ts +106 -32
  168. package/packages/table/module/menu/hook.ts +3 -1
  169. package/packages/table/module/validator/hook.ts +5 -3
  170. package/packages/table/render/index.ts +3 -4
  171. package/packages/table/src/body.ts +41 -21
  172. package/packages/table/src/cell.ts +43 -24
  173. package/packages/table/src/columnInfo.ts +3 -2
  174. package/packages/table/src/footer.ts +13 -7
  175. package/packages/table/src/header.ts +13 -7
  176. package/packages/table/src/props.ts +4 -0
  177. package/packages/table/src/table.ts +441 -418
  178. package/packages/table/src/util.ts +39 -6
  179. package/packages/ui/index.ts +1 -0
  180. /package/es/{iconfont.1741337003908.ttf → iconfont.1742955995631.ttf} +0 -0
  181. /package/es/{iconfont.1741337003908.woff → iconfont.1742955995631.woff} +0 -0
  182. /package/es/{iconfont.1741337003908.woff2 → iconfont.1742955995631.woff2} +0 -0
  183. /package/lib/{iconfont.1741337003908.ttf → iconfont.1742955995631.ttf} +0 -0
  184. /package/lib/{iconfont.1741337003908.woff → iconfont.1742955995631.woff} +0 -0
  185. /package/lib/{iconfont.1741337003908.woff2 → iconfont.1742955995631.woff2} +0 -0
@@ -320,6 +320,7 @@ hooks.add('tableEditModule', {
320
320
  return nextTick().then(() => $xeTable.updateCellAreas());
321
321
  };
322
322
  const handleEditActive = (params, evnt, isFocus, isPos) => {
323
+ const $xeGrid = $xeTable.xeGrid;
323
324
  const { editConfig, mouseConfig } = props;
324
325
  const { editStore, tableColumn } = reactData;
325
326
  const editOpts = computeEditOpts.value;
@@ -336,7 +337,7 @@ hooks.add('tableEditModule', {
336
337
  if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
337
338
  // 判断是否禁用编辑
338
339
  let type = 'edit-disabled';
339
- if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeTable.xegrid }))) {
340
+ if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }))) {
340
341
  if (mouseConfig) {
341
342
  $xeTable.clearSelected();
342
343
  if ($xeTable.clearCellAreas) {
@@ -365,7 +366,7 @@ hooks.add('tableEditModule', {
365
366
  $xeTable.handleFocus(params, evnt);
366
367
  }
367
368
  if (afterEditMethod) {
368
- afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeTable.xegrid }));
369
+ afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }));
369
370
  }
370
371
  });
371
372
  }
@@ -485,15 +486,14 @@ hooks.add('tableEditModule', {
485
486
  */
486
487
  remove(rows) {
487
488
  const { treeConfig } = props;
488
- const { mergeList, editStore, selectCheckboxMaps } = reactData;
489
- const { tableFullTreeData, afterFullData, tableFullData } = internalData;
489
+ const { mergeList, editStore } = reactData;
490
+ const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps } = internalData;
490
491
  const checkboxOpts = computeCheckboxOpts.value;
491
492
  const treeOpts = computeTreeOpts.value;
492
493
  const { transform, mapChildrenField } = treeOpts;
493
494
  const childrenField = treeOpts.children || treeOpts.childrenField;
494
495
  const { actived, removeMaps } = editStore;
495
496
  const insertDataRowMaps = Object.assign({}, editStore.insertMaps);
496
- const pendingDataRowMaps = Object.assign({}, reactData.pendingRowMaps);
497
497
  const { checkField } = checkboxOpts;
498
498
  let delList = [];
499
499
  if (!rows) {
@@ -511,14 +511,13 @@ hooks.add('tableEditModule', {
511
511
  });
512
512
  // 如果绑定了多选属性,则更新状态
513
513
  if (!checkField) {
514
- const selectRowMaps = Object.assign({}, selectCheckboxMaps);
515
514
  rows.forEach((row) => {
516
515
  const rowid = getRowid($xeTable, row);
517
- if (selectRowMaps[rowid]) {
518
- delete selectRowMaps[rowid];
516
+ if (selectCheckboxMaps[rowid]) {
517
+ delete selectCheckboxMaps[rowid];
519
518
  }
520
519
  });
521
- reactData.selectCheckboxMaps = selectRowMaps;
520
+ reactData.updateCheckboxFlag++;
522
521
  }
523
522
  // 从数据源中移除
524
523
  if (tableFullData === rows) {
@@ -581,12 +580,12 @@ hooks.add('tableEditModule', {
581
580
  if (insertDataRowMaps[rowid]) {
582
581
  delete insertDataRowMaps[rowid];
583
582
  }
584
- if (pendingDataRowMaps[rowid]) {
585
- delete pendingDataRowMaps[rowid];
583
+ if (pendingRowMaps[rowid]) {
584
+ delete pendingRowMaps[rowid];
586
585
  }
587
586
  });
588
587
  editStore.insertMaps = insertDataRowMaps;
589
- reactData.pendingRowMaps = pendingDataRowMaps;
588
+ reactData.pendingRowFlag++;
590
589
  $xeTable.updateFooter();
591
590
  $xeTable.cacheRowMap(false);
592
591
  $xeTable.handleTableData(treeConfig && transform);
@@ -139,6 +139,7 @@ export default defineComponent({
139
139
  }
140
140
  };
141
141
  const renderVN = () => {
142
+ const $xeGrid = $xeTable.xeGrid;
142
143
  const { defaultOptions, storeData } = props;
143
144
  const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData;
144
145
  const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
@@ -216,7 +217,7 @@ export default defineComponent({
216
217
  default: () => {
217
218
  const params = {
218
219
  $table: $xeTable,
219
- $grid: $xeTable.xegrid,
220
+ $grid: $xeGrid,
220
221
  options: defaultOptions,
221
222
  columns,
222
223
  params: defaultOptions.params
@@ -460,7 +461,7 @@ export default defineComponent({
460
461
  footer() {
461
462
  const params = {
462
463
  $table: $xeTable,
463
- $grid: $xeTable.xegrid,
464
+ $grid: $xeGrid,
464
465
  options: defaultOptions,
465
466
  columns,
466
467
  params: defaultOptions.params
@@ -76,6 +76,7 @@ export default defineComponent({
76
76
  });
77
77
  };
78
78
  const renderVN = () => {
79
+ const $xeGrid = $xeTable.xeGrid;
79
80
  const { defaultOptions, storeData } = props;
80
81
  const selectName = computeSelectName.value;
81
82
  const hasFile = computeHasFile.value;
@@ -110,7 +111,7 @@ export default defineComponent({
110
111
  default: () => {
111
112
  const params = {
112
113
  $table: $xeTable,
113
- $grid: $xeTable.xegrid,
114
+ $grid: $xeGrid,
114
115
  options: defaultOptions,
115
116
  params: defaultOptions.params
116
117
  };
@@ -186,7 +187,7 @@ export default defineComponent({
186
187
  footer() {
187
188
  const params = {
188
189
  $table: $xeTable,
189
- $grid: $xeTable.xegrid,
190
+ $grid: $xeGrid,
190
191
  options: defaultOptions,
191
192
  params: defaultOptions.params
192
193
  };
@@ -84,14 +84,24 @@ export default defineComponent({
84
84
  if (filterSlot) {
85
85
  return [
86
86
  h('div', {
87
- class: 'vxe-table--filter-template'
87
+ class: 'vxe-table--filter-template',
88
+ style: maxHeight
89
+ ? {
90
+ maxHeight: `${maxHeight}px`
91
+ }
92
+ : {}
88
93
  }, $xeTable.callSlot(filterSlot, params))
89
94
  ];
90
95
  }
91
96
  else if (rtFilter) {
92
97
  return [
93
98
  h('div', {
94
- class: 'vxe-table--filter-template'
99
+ class: 'vxe-table--filter-template',
100
+ style: maxHeight
101
+ ? {
102
+ maxHeight: `${maxHeight}px`
103
+ }
104
+ : {}
95
105
  }, getSlotVNs(rtFilter(filterRender, params)))
96
106
  ];
97
107
  }
@@ -28,7 +28,7 @@ hooks.add('tableKeyboardModule', {
28
28
  setupTable($xeTable) {
29
29
  const { props, reactData, internalData } = $xeTable;
30
30
  const { refElem } = $xeTable.getRefMaps();
31
- const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
31
+ const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeColumnOpts, computeCellOpts, computeDefaultRowHeight, computeCurrentRowOpts, computeCurrentColumnOpts } = $xeTable.getComputeMaps();
32
32
  function getCheckboxRangeRows(evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
33
33
  const { showOverflow } = props;
34
34
  const { fullAllDataRowIdData, isResizeCellHeight } = internalData;
@@ -281,12 +281,48 @@ hooks.add('tableKeyboardModule', {
281
281
  }
282
282
  }
283
283
  };
284
+ const handleMoveSelected = (evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) => {
285
+ const { afterFullData, visibleColumn } = internalData;
286
+ const params = Object.assign({}, args);
287
+ const _rowIndex = $xeTable.getVTRowIndex(params.row);
288
+ const _columnIndex = $xeTable.getVTColumnIndex(params.column);
289
+ evnt.preventDefault();
290
+ if (isUpArrow && _rowIndex > 0) {
291
+ // 移动到上一行
292
+ params.rowIndex = _rowIndex - 1;
293
+ params.row = afterFullData[params.rowIndex];
294
+ }
295
+ else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
296
+ // 移动到下一行
297
+ params.rowIndex = _rowIndex + 1;
298
+ params.row = afterFullData[params.rowIndex];
299
+ }
300
+ else if (isLeftArrow && _columnIndex) {
301
+ // 移动到左侧单元格
302
+ params.columnIndex = _columnIndex - 1;
303
+ params.column = visibleColumn[params.columnIndex];
304
+ }
305
+ else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
306
+ // 移动到右侧单元格
307
+ params.columnIndex = _columnIndex + 1;
308
+ params.column = visibleColumn[params.columnIndex];
309
+ }
310
+ $xeTable.scrollToRow(params.row, params.column).then(() => {
311
+ params.cell = $xeTable.getCellElement(params.row, params.column);
312
+ $xeTable.handleSelected(params, evnt);
313
+ });
314
+ return params;
315
+ };
284
316
  const keyboardMethods = {
285
317
  // 处理 Tab 键移动
286
318
  moveTabSelected(args, isLeft, evnt) {
287
319
  const { editConfig } = props;
288
320
  const { afterFullData, visibleColumn } = internalData;
289
321
  const editOpts = computeEditOpts.value;
322
+ const rowOpts = computeRowOpts.value;
323
+ const currentRowOpts = computeCurrentRowOpts.value;
324
+ const columnOpts = computeColumnOpts.value;
325
+ const currentColumnOpts = computeCurrentColumnOpts.value;
290
326
  let targetRow;
291
327
  let targetRowIndex;
292
328
  let targetColumnIndex;
@@ -333,6 +369,12 @@ hooks.add('tableKeyboardModule', {
333
369
  params.columnIndex = targetColumnIndex;
334
370
  params.column = targetColumn;
335
371
  params.cell = $xeTable.getCellElement(params.row, params.column);
372
+ if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
373
+ $xeTable.triggerCurrentRowEvent(evnt, params);
374
+ }
375
+ if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
376
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
377
+ }
336
378
  if (editConfig) {
337
379
  if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
338
380
  if (editOpts.mode === 'row') {
@@ -340,13 +382,17 @@ hooks.add('tableKeyboardModule', {
340
382
  }
341
383
  else {
342
384
  $xeTable.scrollToRow(params.row, params.column)
343
- .then(() => $xeTable.handleSelected(params, evnt));
385
+ .then(() => {
386
+ $xeTable.handleSelected(params, evnt);
387
+ });
344
388
  }
345
389
  }
346
390
  }
347
391
  else {
348
392
  $xeTable.scrollToRow(params.row, params.column)
349
- .then(() => $xeTable.handleSelected(params, evnt));
393
+ .then(() => {
394
+ $xeTable.handleSelected(params, evnt);
395
+ });
350
396
  }
351
397
  }
352
398
  },
@@ -358,7 +404,6 @@ hooks.add('tableKeyboardModule', {
358
404
  const treeOpts = computeTreeOpts.value;
359
405
  const childrenField = treeOpts.children || treeOpts.childrenField;
360
406
  let targetRow;
361
- evnt.preventDefault();
362
407
  if (currentRow) {
363
408
  if (treeConfig) {
364
409
  const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
@@ -383,6 +428,7 @@ hooks.add('tableKeyboardModule', {
383
428
  targetRow = afterFullData[0];
384
429
  }
385
430
  if (targetRow) {
431
+ evnt.preventDefault();
386
432
  const params = {
387
433
  $table: $xeTable,
388
434
  row: targetRow,
@@ -393,37 +439,66 @@ hooks.add('tableKeyboardModule', {
393
439
  .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
394
440
  }
395
441
  },
442
+ // 处理当前列方向键移动
443
+ moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
444
+ const { currentColumn } = reactData;
445
+ const { visibleColumn } = internalData;
446
+ let targetCol = null;
447
+ if (currentColumn) {
448
+ const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
449
+ if (isLeftArrow && _columnIndex > 0) {
450
+ targetCol = visibleColumn[_columnIndex - 1];
451
+ }
452
+ else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
453
+ targetCol = visibleColumn[_columnIndex + 1];
454
+ }
455
+ }
456
+ else {
457
+ targetCol = visibleColumn[0];
458
+ }
459
+ if (targetCol) {
460
+ evnt.preventDefault();
461
+ const params = {
462
+ $table: $xeTable,
463
+ column: targetCol,
464
+ columnIndex: $xeTable.getColumnIndex(targetCol),
465
+ $columnIndex: $xeTable.getVMColumnIndex(targetCol)
466
+ };
467
+ $xeTable.scrollToColumn(targetCol)
468
+ .then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
469
+ }
470
+ },
396
471
  // 处理可编辑方向键移动
397
- moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
398
- const { afterFullData, visibleColumn } = internalData;
399
- const params = Object.assign({}, args);
400
- const _rowIndex = $xeTable.getVTRowIndex(params.row);
401
- const _columnIndex = $xeTable.getVTColumnIndex(params.column);
402
- evnt.preventDefault();
403
- if (isUpArrow && _rowIndex > 0) {
404
- // 移动到上一行
405
- params.rowIndex = _rowIndex - 1;
406
- params.row = afterFullData[params.rowIndex];
472
+ moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
473
+ const { highlightCurrentRow, highlightCurrentColumn } = props;
474
+ const rowOpts = computeRowOpts.value;
475
+ const columnOpts = computeColumnOpts.value;
476
+ handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
477
+ // 当前行按键上下移动
478
+ if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
479
+ $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
407
480
  }
408
- else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
409
- // 移动到下一行
410
- params.rowIndex = _rowIndex + 1;
411
- params.row = afterFullData[params.rowIndex];
481
+ // 当前行按键左右移动
482
+ if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
483
+ $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
412
484
  }
413
- else if (isLeftArrow && _columnIndex) {
414
- // 移动到左侧单元格
415
- params.columnIndex = _columnIndex - 1;
416
- params.column = visibleColumn[params.columnIndex];
485
+ },
486
+ moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
487
+ const rowOpts = computeRowOpts.value;
488
+ const currentRowOpts = computeCurrentRowOpts.value;
489
+ const columnOpts = computeColumnOpts.value;
490
+ const currentColumnOpts = computeCurrentColumnOpts.value;
491
+ const params = handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
492
+ if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
493
+ $xeTable.triggerCurrentRowEvent(evnt, params);
417
494
  }
418
- else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
419
- // 移动到右侧单元格
420
- params.columnIndex = _columnIndex + 1;
421
- params.column = visibleColumn[params.columnIndex];
495
+ if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
496
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
422
497
  }
423
- $xeTable.scrollToRow(params.row, params.column).then(() => {
424
- params.cell = $xeTable.getCellElement(params.row, params.column);
425
- $xeTable.handleSelected(params, evnt);
426
- });
498
+ },
499
+ // 已废弃,待删除
500
+ moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
501
+ handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
427
502
  },
428
503
  handleCellMousedownEvent
429
504
  };
@@ -280,10 +280,11 @@ hooks.add('tableMenuModule', {
280
280
  * 快捷菜单点击事件
281
281
  */
282
282
  ctxMenuLinkEvent(evnt, menu) {
283
+ const $xeGrid = $xeTable.xeGrid;
283
284
  // 如果一级菜单有配置 code 则允许点击,否则不能点击
284
285
  if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
285
286
  const gMenuOpts = menus.get(menu.code);
286
- const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeTable.xegrid, $event: evnt });
287
+ const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeGrid, $event: evnt });
287
288
  const tmMethod = gMenuOpts ? (gMenuOpts.tableMenuMethod || gMenuOpts.menuMethod) : null;
288
289
  if (tmMethod) {
289
290
  tmMethod(params, evnt);
@@ -85,8 +85,8 @@ hooks.add('tableValidatorModule', {
85
85
  const beginValidate = (rows, cols, cb, isFull) => {
86
86
  const validRest = {};
87
87
  const { editRules, treeConfig } = props;
88
- const { editStore, pendingRowMaps } = reactData;
89
- const { afterFullData } = internalData;
88
+ const { editStore } = reactData;
89
+ const { afterFullData, pendingRowMaps } = internalData;
90
90
  const { removeMaps } = editStore;
91
91
  const treeOpts = computeTreeOpts.value;
92
92
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -353,6 +353,7 @@ hooks.add('tableValidatorModule', {
353
353
  * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
354
354
  */
355
355
  validCellRules(validType, row, column, val) {
356
+ const $xeGrid = $xeTable.xeGrid;
356
357
  const { editRules } = props;
357
358
  const { field } = column;
358
359
  const errorRules = [];
@@ -375,7 +376,7 @@ hooks.add('tableValidatorModule', {
375
376
  columnIndex: $xeTable.getColumnIndex(column),
376
377
  field: column.field,
377
378
  $table: $xeTable,
378
- $grid: $xeTable.xegrid
379
+ $grid: $xeGrid
379
380
  };
380
381
  let customValid;
381
382
  if (XEUtils.isString(validator)) {
@@ -5,7 +5,7 @@ import { getCellValue, setCellValue } from '../../table/src/util';
5
5
  import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
6
6
  import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
7
7
  import { errLog } from '../../ui/src/log';
8
- const { getConfig, renderer, getI18n } = VxeUI;
8
+ const { getConfig, renderer, getI18n, getComponent } = VxeUI;
9
9
  const componentDefaultModelProp = 'modelValue';
10
10
  const defaultCompProps = {};
11
11
  function handleDefaultValue(value, defaultVal, initVal) {
@@ -29,7 +29,7 @@ function getOldComponentName(name) {
29
29
  return `vxe-${name.replace('$', '')}`;
30
30
  }
31
31
  function getDefaultComponent({ name }) {
32
- return resolveComponent(name);
32
+ return getComponent(name);
33
33
  }
34
34
  /**
35
35
  * 已废弃
@@ -335,7 +335,7 @@ function oldEditRender(renderOpts, params) {
335
335
  */
336
336
  function oldButtonEditRender(renderOpts, params) {
337
337
  return [
338
- h(resolveComponent('vxe-button'), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, null)), getComponentOns(renderOpts, params)))
338
+ h(getComponent('vxe-button'), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, null)), getComponentOns(renderOpts, params)))
339
339
  ];
340
340
  }
341
341
  /**
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, inject, nextTick, onMounted, onUnmounted } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../ui';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
4
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
5
5
  import { updateCellTitle, getPropClass } from '../../ui/src/dom';
6
6
  import { isEnableConf } from '../../ui/src/utils';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
@@ -21,7 +21,7 @@ export default defineComponent({
21
21
  setup(props) {
22
22
  const $xeTable = inject('$xeTable', {});
23
23
  const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
24
- const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps();
24
+ const { computeEditOpts, computeMouseOpts, computeCellOffsetWidth, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps();
25
25
  const refElem = ref();
26
26
  const refBodyScroll = ref();
27
27
  const refBodyTable = ref();
@@ -36,7 +36,7 @@ export default defineComponent({
36
36
  const { lastScrollTime, isDragResize } = tableReactData;
37
37
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover));
38
38
  };
39
- const renderLine = (params, cellHeight) => {
39
+ const renderLine = (rowid, params, cellHeight) => {
40
40
  const { row, column } = params;
41
41
  const { afterFullData } = tableInternalData;
42
42
  const { treeConfig } = tableProps;
@@ -46,7 +46,6 @@ export default defineComponent({
46
46
  if (slots && slots.line) {
47
47
  return $xeTable.callSlot(slots.line, params);
48
48
  }
49
- const rowid = getRowid($xeTable, row);
50
49
  const rest = fullAllDataRowIdData[rowid];
51
50
  let rLevel = 0;
52
51
  let prevRow = null;
@@ -78,9 +77,10 @@ export default defineComponent({
78
77
  * 渲染列
79
78
  */
80
79
  const renderTdColumn = (seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) => {
81
- const { fullAllDataRowIdData } = tableInternalData;
80
+ const $xeGrid = $xeTable.xeGrid;
81
+ const { fullAllDataRowIdData, fullColumnIdData, visibleColumn } = tableInternalData;
82
82
  const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
83
- const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
83
+ const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
84
84
  const { afterFullData, scrollXStore, scrollYStore } = tableInternalData;
85
85
  const cellOpts = computeCellOpts.value;
86
86
  const validOpts = computeValidOpts.value;
@@ -97,19 +97,21 @@ export default defineComponent({
97
97
  const columnOpts = computeColumnOpts.value;
98
98
  const mouseOpts = computeMouseOpts.value;
99
99
  const areaOpts = computeAreaOpts.value;
100
+ const cellOffsetWidth = computeCellOffsetWidth.value;
100
101
  const { selectCellToRow } = areaOpts;
101
102
  const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column;
102
103
  const { verticalAlign: allVerticalAlign } = cellOpts;
103
104
  const { actived } = editStore;
104
- const rowRest = fullAllDataRowIdData[rowid];
105
+ const rowRest = fullAllDataRowIdData[rowid] || {};
105
106
  const colid = column.id;
107
+ const colRest = fullColumnIdData[colid] || {};
106
108
  const renderOpts = editRender || cellRender;
107
109
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
108
110
  const compCellClassName = compConf ? (compConf.tableCellClassName || compConf.cellClassName) : null;
109
111
  const compCellStyle = compConf ? (compConf.tableCellStyle || compConf.cellStyle) : '';
110
112
  const showAllTip = tooltipOpts.showAll;
111
- const columnIndex = $xeTable.getColumnIndex(column);
112
- const _columnIndex = $xeTable.getVTColumnIndex(column);
113
+ const columnIndex = colRest.index;
114
+ const _columnIndex = colRest._index;
113
115
  const isEdit = isEnableConf(editRender);
114
116
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
115
117
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
@@ -131,7 +133,7 @@ export default defineComponent({
131
133
  const tdAttrs = { colid };
132
134
  const cellParams = {
133
135
  $table: $xeTable,
134
- $grid: $xeTable.xegrid,
136
+ $grid: $xeGrid,
135
137
  isEdit: false,
136
138
  seq,
137
139
  rowid,
@@ -263,6 +265,18 @@ export default defineComponent({
263
265
  }
264
266
  }
265
267
  const tcStyle = {};
268
+ if (hasEllipsis && resizeWidthFlag) {
269
+ let tsColspan = tdAttrs.colspan || 0;
270
+ if (tsColspan > 1) {
271
+ for (let index = 1; index < tsColspan; index++) {
272
+ const nextColumn = visibleColumn[columnIndex + index];
273
+ if (nextColumn) {
274
+ tsColspan += nextColumn.renderWidth;
275
+ }
276
+ }
277
+ }
278
+ tcStyle.width = `${column.renderWidth - (cellOffsetWidth * tsColspan)}px`;
279
+ }
266
280
  if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
267
281
  tcStyle.height = `${cellHeight}px`;
268
282
  }
@@ -283,7 +297,7 @@ export default defineComponent({
283
297
  }
284
298
  else {
285
299
  // 渲染单元格
286
- tdVNs.push(...renderLine(cellParams, cellHeight), h('div', {
300
+ tdVNs.push(...renderLine(rowid, cellParams, cellHeight), h('div', {
287
301
  key: 'tc',
288
302
  class: ['vxe-cell', {
289
303
  'c--title': showTitle,
@@ -386,8 +400,8 @@ export default defineComponent({
386
400
  };
387
401
  const renderRows = (fixedType, isOptimizeMode, tableData, tableColumn) => {
388
402
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
389
- const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData;
390
- const { fullAllDataRowIdData } = tableInternalData;
403
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData;
404
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData;
391
405
  const checkboxOpts = computeCheckboxOpts.value;
392
406
  const radioOpts = computeRadioOpts.value;
393
407
  const treeOpts = computeTreeOpts.value;
@@ -398,6 +412,7 @@ export default defineComponent({
398
412
  const { transform, seqMode } = treeOpts;
399
413
  const childrenField = treeOpts.children || treeOpts.childrenField;
400
414
  const rows = [];
415
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
401
416
  tableData.forEach((row, $rowIndex) => {
402
417
  const trOn = {};
403
418
  let rowIndex = $rowIndex;
@@ -418,8 +433,8 @@ export default defineComponent({
418
433
  $xeTable.clearHoverRow();
419
434
  };
420
435
  }
421
- const rowid = getRowid($xeTable, row);
422
- const rowRest = fullAllDataRowIdData[rowid];
436
+ const rowid = handleGetRowId(row);
437
+ const rowRest = fullAllDataRowIdData[rowid] || {};
423
438
  let rowLevel = 0;
424
439
  let seq = -1;
425
440
  let _rowIndex = 0;
@@ -435,7 +450,7 @@ export default defineComponent({
435
450
  }
436
451
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
437
452
  // 行是否被展开
438
- const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
453
+ const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
439
454
  // 树节点是否被展开
440
455
  let isExpandTree = false;
441
456
  let rowChildren = [];
@@ -445,7 +460,7 @@ export default defineComponent({
445
460
  }
446
461
  if (treeConfig && !scrollYLoad && !transform) {
447
462
  rowChildren = row[childrenField];
448
- isExpandTree = rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
463
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
449
464
  }
450
465
  // 拖拽行事件
451
466
  if (rowOpts.drag && (!treeConfig || transform)) {
@@ -464,7 +479,7 @@ export default defineComponent({
464
479
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
465
480
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
466
481
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
467
- 'row--pending': !!pendingRowMaps[rowid]
482
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
468
483
  },
469
484
  getPropClass(rowClassName, params)
470
485
  ];
@@ -568,6 +583,7 @@ export default defineComponent({
568
583
  });
569
584
  const renderVN = () => {
570
585
  const { slots } = tableContext;
586
+ const $xeGrid = $xeTable.xeGrid;
571
587
  const { fixedColumn, fixedType, tableColumn } = props;
572
588
  const { spanMethod, footerSpanMethod, mouseConfig } = tableProps;
573
589
  const { isGroup, tableData, isRowLoading, isColLoading, overflowX, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData;
@@ -589,7 +605,7 @@ export default defineComponent({
589
605
  isOptimizeMode = true;
590
606
  }
591
607
  }
592
- if (fixedType || !overflowX) {
608
+ if (!isColLoading && (fixedType || !overflowX)) {
593
609
  renderColumnList = visibleColumn;
594
610
  }
595
611
  if (fixedType) {
@@ -648,7 +664,7 @@ export default defineComponent({
648
664
  let emptyContent;
649
665
  const emptySlot = slots ? slots.empty : null;
650
666
  if (emptySlot) {
651
- emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $xeTable.xegrid });
667
+ emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $xeGrid });
652
668
  }
653
669
  else {
654
670
  const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null;
@@ -697,7 +713,10 @@ export default defineComponent({
697
713
  }, renderColumnList.map((column, $columnIndex) => {
698
714
  return h('col', {
699
715
  name: column.id,
700
- key: $columnIndex
716
+ key: $columnIndex,
717
+ style: {
718
+ width: `${column.renderWidth}px`
719
+ }
701
720
  });
702
721
  })),
703
722
  /**