vxe-table 3.14.0-beta.3 → 3.14.0-beta.30

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 (209) hide show
  1. package/es/grid/src/grid.js +79 -50
  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/mixin.js +4 -2
  24. package/es/table/module/custom/panel.js +24 -23
  25. package/es/table/module/edit/mixin.js +17 -11
  26. package/es/table/module/export/export-panel.js +5 -4
  27. package/es/table/module/export/import-panel.js +8 -7
  28. package/es/table/module/export/mixin.js +30 -27
  29. package/es/table/module/filter/panel.js +21 -10
  30. package/es/table/module/keyboard/mixin.js +141 -41
  31. package/es/table/module/menu/mixin.js +6 -3
  32. package/es/table/module/menu/panel.js +7 -7
  33. package/es/table/module/validator/mixin.js +2 -2
  34. package/es/table/render/index.js +14 -5
  35. package/es/table/src/body.js +50 -26
  36. package/es/table/src/cell.js +27 -22
  37. package/es/table/src/column.js +11 -9
  38. package/es/table/src/columnInfo.js +6 -6
  39. package/es/table/src/footer.js +19 -9
  40. package/es/table/src/group.js +6 -5
  41. package/es/table/src/header.js +15 -9
  42. package/es/table/src/methods.js +1008 -789
  43. package/es/table/src/props.js +4 -0
  44. package/es/table/src/table.js +85 -49
  45. package/es/table/src/util.js +84 -19
  46. package/es/toolbar/src/toolbar.js +3 -3
  47. package/es/ui/index.js +2 -1
  48. package/es/ui/src/log.js +1 -1
  49. package/helper/vetur/attributes.json +1 -1
  50. package/helper/vetur/tags.json +1 -1
  51. package/lib/grid/src/grid.js +86 -67
  52. package/lib/grid/src/grid.min.js +1 -1
  53. package/lib/index.umd.js +1907 -1344
  54. package/lib/index.umd.min.js +1 -1
  55. package/lib/locale/lang/ar-EG.js +7 -1
  56. package/lib/locale/lang/ar-EG.min.js +1 -1
  57. package/lib/locale/lang/de-DE.js +7 -1
  58. package/lib/locale/lang/de-DE.min.js +1 -1
  59. package/lib/locale/lang/en-US.js +7 -1
  60. package/lib/locale/lang/en-US.min.js +1 -1
  61. package/lib/locale/lang/en-US.umd.js +7 -1
  62. package/lib/locale/lang/es-ES.js +7 -1
  63. package/lib/locale/lang/es-ES.min.js +1 -1
  64. package/lib/locale/lang/es-ES.umd.js +7 -1
  65. package/lib/locale/lang/fr-FR.js +7 -1
  66. package/lib/locale/lang/fr-FR.min.js +1 -1
  67. package/lib/locale/lang/hu-HU.js +7 -1
  68. package/lib/locale/lang/hu-HU.min.js +1 -1
  69. package/lib/locale/lang/hu-HU.umd.js +7 -1
  70. package/lib/locale/lang/hy-AM.js +7 -1
  71. package/lib/locale/lang/hy-AM.min.js +1 -1
  72. package/lib/locale/lang/id-ID.js +7 -1
  73. package/lib/locale/lang/id-ID.min.js +1 -1
  74. package/lib/locale/lang/it-IT.js +7 -1
  75. package/lib/locale/lang/it-IT.min.js +1 -1
  76. package/lib/locale/lang/ja-JP.js +7 -1
  77. package/lib/locale/lang/ja-JP.min.js +1 -1
  78. package/lib/locale/lang/ja-JP.umd.js +7 -1
  79. package/lib/locale/lang/ko-KR.js +7 -1
  80. package/lib/locale/lang/ko-KR.min.js +1 -1
  81. package/lib/locale/lang/ko-KR.umd.js +7 -1
  82. package/lib/locale/lang/nb-NO.js +7 -1
  83. package/lib/locale/lang/nb-NO.min.js +1 -1
  84. package/lib/locale/lang/pt-BR.js +7 -1
  85. package/lib/locale/lang/pt-BR.min.js +1 -1
  86. package/lib/locale/lang/pt-BR.umd.js +7 -1
  87. package/lib/locale/lang/ru-RU.js +7 -1
  88. package/lib/locale/lang/ru-RU.min.js +1 -1
  89. package/lib/locale/lang/ru-RU.umd.js +7 -1
  90. package/lib/locale/lang/th-TH.js +7 -1
  91. package/lib/locale/lang/th-TH.min.js +1 -1
  92. package/lib/locale/lang/ug-CN.js +7 -1
  93. package/lib/locale/lang/ug-CN.min.js +1 -1
  94. package/lib/locale/lang/uk-UA.js +7 -1
  95. package/lib/locale/lang/uk-UA.min.js +1 -1
  96. package/lib/locale/lang/uk-UA.umd.js +7 -1
  97. package/lib/locale/lang/vi-VN.js +7 -1
  98. package/lib/locale/lang/vi-VN.min.js +1 -1
  99. package/lib/locale/lang/zh-CHT.js +7 -1
  100. package/lib/locale/lang/zh-CHT.min.js +1 -1
  101. package/lib/locale/lang/zh-CHT.umd.js +7 -1
  102. package/lib/locale/lang/zh-CN.js +7 -1
  103. package/lib/locale/lang/zh-CN.min.js +1 -1
  104. package/lib/locale/lang/zh-CN.umd.js +7 -1
  105. package/lib/style.css +1 -1
  106. package/lib/table/module/custom/mixin.js +5 -3
  107. package/lib/table/module/custom/mixin.min.js +1 -1
  108. package/lib/table/module/custom/panel.js +22 -29
  109. package/lib/table/module/custom/panel.min.js +1 -1
  110. package/lib/table/module/edit/mixin.js +19 -13
  111. package/lib/table/module/edit/mixin.min.js +1 -1
  112. package/lib/table/module/export/export-panel.js +5 -4
  113. package/lib/table/module/export/export-panel.min.js +1 -1
  114. package/lib/table/module/export/import-panel.js +8 -7
  115. package/lib/table/module/export/import-panel.min.js +1 -1
  116. package/lib/table/module/export/mixin.js +35 -34
  117. package/lib/table/module/export/mixin.min.js +1 -1
  118. package/lib/table/module/filter/panel.js +16 -16
  119. package/lib/table/module/filter/panel.min.js +1 -1
  120. package/lib/table/module/keyboard/mixin.js +149 -47
  121. package/lib/table/module/keyboard/mixin.min.js +1 -1
  122. package/lib/table/module/menu/mixin.js +6 -3
  123. package/lib/table/module/menu/mixin.min.js +1 -1
  124. package/lib/table/module/menu/panel.js +7 -7
  125. package/lib/table/module/menu/panel.min.js +1 -1
  126. package/lib/table/module/validator/mixin.js +3 -3
  127. package/lib/table/module/validator/mixin.min.js +1 -1
  128. package/lib/table/render/index.js +18 -5
  129. package/lib/table/render/index.min.js +1 -1
  130. package/lib/table/src/body.js +57 -25
  131. package/lib/table/src/body.min.js +1 -1
  132. package/lib/table/src/cell.js +39 -23
  133. package/lib/table/src/cell.min.js +1 -1
  134. package/lib/table/src/column.js +11 -9
  135. package/lib/table/src/column.min.js +1 -1
  136. package/lib/table/src/columnInfo.js +6 -6
  137. package/lib/table/src/columnInfo.min.js +1 -1
  138. package/lib/table/src/footer.js +19 -7
  139. package/lib/table/src/footer.min.js +1 -1
  140. package/lib/table/src/group.js +6 -5
  141. package/lib/table/src/group.min.js +1 -1
  142. package/lib/table/src/header.js +16 -8
  143. package/lib/table/src/header.min.js +1 -1
  144. package/lib/table/src/methods.js +1166 -919
  145. package/lib/table/src/methods.min.js +1 -1
  146. package/lib/table/src/props.js +4 -0
  147. package/lib/table/src/props.min.js +1 -1
  148. package/lib/table/src/table.js +93 -52
  149. package/lib/table/src/table.min.js +1 -1
  150. package/lib/table/src/util.js +96 -20
  151. package/lib/table/src/util.min.js +1 -1
  152. package/lib/toolbar/src/toolbar.js +3 -3
  153. package/lib/ui/index.js +2 -1
  154. package/lib/ui/index.min.js +1 -1
  155. package/lib/ui/src/log.js +1 -1
  156. package/lib/ui/src/log.min.js +1 -1
  157. package/package.json +2 -2
  158. package/packages/grid/src/grid.ts +93 -59
  159. package/packages/locale/lang/ar-EG.ts +7 -1
  160. package/packages/locale/lang/de-DE.ts +7 -1
  161. package/packages/locale/lang/en-US.ts +7 -1
  162. package/packages/locale/lang/es-ES.ts +7 -1
  163. package/packages/locale/lang/fr-FR.ts +7 -1
  164. package/packages/locale/lang/hu-HU.ts +7 -1
  165. package/packages/locale/lang/hy-AM.ts +7 -1
  166. package/packages/locale/lang/id-ID.ts +7 -1
  167. package/packages/locale/lang/it-IT.ts +7 -1
  168. package/packages/locale/lang/ja-JP.ts +7 -1
  169. package/packages/locale/lang/ko-KR.ts +7 -1
  170. package/packages/locale/lang/nb-NO.ts +7 -1
  171. package/packages/locale/lang/pt-BR.ts +7 -1
  172. package/packages/locale/lang/ru-RU.ts +7 -1
  173. package/packages/locale/lang/th-TH.ts +7 -1
  174. package/packages/locale/lang/ug-CN.ts +7 -1
  175. package/packages/locale/lang/uk-UA.ts +7 -1
  176. package/packages/locale/lang/vi-VN.ts +7 -1
  177. package/packages/locale/lang/zh-CHT.ts +7 -1
  178. package/packages/locale/lang/zh-CN.ts +7 -1
  179. package/packages/table/module/custom/mixin.ts +6 -3
  180. package/packages/table/module/custom/panel.ts +42 -37
  181. package/packages/table/module/edit/mixin.ts +20 -14
  182. package/packages/table/module/export/export-panel.ts +8 -5
  183. package/packages/table/module/export/import-panel.ts +11 -7
  184. package/packages/table/module/export/mixin.ts +37 -32
  185. package/packages/table/module/filter/panel.ts +25 -10
  186. package/packages/table/module/keyboard/mixin.ts +155 -49
  187. package/packages/table/module/menu/mixin.ts +12 -6
  188. package/packages/table/module/menu/panel.ts +10 -7
  189. package/packages/table/module/validator/mixin.ts +2 -2
  190. package/packages/table/render/index.ts +14 -5
  191. package/packages/table/src/body.ts +49 -25
  192. package/packages/table/src/cell.ts +27 -22
  193. package/packages/table/src/column.ts +14 -10
  194. package/packages/table/src/columnInfo.ts +9 -6
  195. package/packages/table/src/footer.ts +19 -9
  196. package/packages/table/src/group.ts +9 -5
  197. package/packages/table/src/header.ts +16 -9
  198. package/packages/table/src/methods.ts +1110 -830
  199. package/packages/table/src/props.ts +16 -12
  200. package/packages/table/src/table.ts +99 -52
  201. package/packages/table/src/util.ts +95 -19
  202. package/packages/toolbar/src/toolbar.ts +3 -3
  203. package/packages/ui/index.ts +1 -0
  204. /package/es/{iconfont.1741160631070.ttf → iconfont.1742890796110.ttf} +0 -0
  205. /package/es/{iconfont.1741160631070.woff → iconfont.1742890796110.woff} +0 -0
  206. /package/es/{iconfont.1741160631070.woff2 → iconfont.1742890796110.woff2} +0 -0
  207. /package/lib/{iconfont.1741160631070.ttf → iconfont.1742890796110.ttf} +0 -0
  208. /package/lib/{iconfont.1741160631070.woff → iconfont.1742890796110.woff} +0 -0
  209. /package/lib/{iconfont.1741160631070.woff2 → iconfont.1742890796110.woff2} +0 -0
@@ -95,17 +95,59 @@ function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offs
95
95
  }
96
96
  return rangeRows;
97
97
  }
98
+ function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) {
99
+ const internalData = $xeTable;
100
+ const { afterFullData, visibleColumn } = internalData;
101
+ const params = Object.assign({}, args);
102
+ const _rowIndex = $xeTable.getVTRowIndex(params.row);
103
+ const _columnIndex = $xeTable.getVTColumnIndex(params.column);
104
+ evnt.preventDefault();
105
+ if (isUpArrow && _rowIndex > 0) {
106
+ // 移动到上一行
107
+ params.rowIndex = _rowIndex - 1;
108
+ params.row = afterFullData[params.rowIndex];
109
+ }
110
+ else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
111
+ // 移动到下一行
112
+ params.rowIndex = _rowIndex + 1;
113
+ params.row = afterFullData[params.rowIndex];
114
+ }
115
+ else if (isLeftArrow && _columnIndex) {
116
+ // 移动到左侧单元格
117
+ params.columnIndex = _columnIndex - 1;
118
+ params.column = visibleColumn[params.columnIndex];
119
+ }
120
+ else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
121
+ // 移动到右侧单元格
122
+ params.columnIndex = _columnIndex + 1;
123
+ params.column = visibleColumn[params.columnIndex];
124
+ }
125
+ $xeTable.scrollToRow(params.row, params.column).then(() => {
126
+ params.cell = $xeTable.getCellElement(params.row, params.column);
127
+ $xeTable.handleSelected(params, evnt);
128
+ });
129
+ return params;
130
+ }
98
131
  export default {
99
132
  methods: {
100
133
  // 处理 Tab 键移动
101
134
  moveTabSelected(args, isLeft, evnt) {
102
- const { afterFullData, visibleColumn, editConfig, editOpts } = this;
135
+ const $xeTable = this;
136
+ const props = $xeTable;
137
+ const internalData = $xeTable;
138
+ const { editConfig } = props;
139
+ const { afterFullData, visibleColumn } = internalData;
140
+ const editOpts = $xeTable.computeEditOpts;
141
+ const rowOpts = $xeTable.computeRowOpts;
142
+ const currentRowOpts = $xeTable.computeCurrentRowOpts;
143
+ const columnOpts = $xeTable.computeColumnOpts;
144
+ const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
103
145
  let targetRow;
104
146
  let targetRowIndex;
105
147
  let targetColumnIndex;
106
148
  const params = Object.assign({}, args);
107
- const _rowIndex = this.getVTRowIndex(params.row);
108
- const _columnIndex = this.getVTColumnIndex(params.column);
149
+ const _rowIndex = $xeTable.getVTRowIndex(params.row);
150
+ const _columnIndex = $xeTable.getVTColumnIndex(params.column);
109
151
  evnt.preventDefault();
110
152
  if (isLeft) {
111
153
  // 向左
@@ -145,30 +187,46 @@ export default {
145
187
  }
146
188
  params.columnIndex = targetColumnIndex;
147
189
  params.column = targetColumn;
148
- params.cell = this.getCellElement(params.row, params.column);
190
+ params.cell = $xeTable.getCellElement(params.row, params.column);
191
+ if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
192
+ $xeTable.triggerCurrentRowEvent(evnt, params);
193
+ }
194
+ if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
195
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
196
+ }
149
197
  if (editConfig) {
150
198
  if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
151
199
  if (editOpts.mode === 'row') {
152
- this.handleEdit(params, evnt);
200
+ $xeTable.handleEdit(params, evnt);
153
201
  }
154
202
  else {
155
- this.scrollToRow(params.row, params.column)
156
- .then(() => this.handleSelected(params, evnt));
203
+ $xeTable.scrollToRow(params.row, params.column)
204
+ .then(() => {
205
+ $xeTable.handleSelected(params, evnt);
206
+ });
157
207
  }
158
208
  }
159
209
  }
160
210
  else {
161
- this.scrollToRow(params.row, params.column)
162
- .then(() => this.handleSelected(params, evnt));
211
+ $xeTable.scrollToRow(params.row, params.column)
212
+ .then(() => {
213
+ $xeTable.handleSelected(params, evnt);
214
+ });
163
215
  }
164
216
  }
165
217
  },
166
218
  // 处理当前行方向键移动
167
219
  moveCurrentRow(isUpArrow, isDwArrow, evnt) {
168
- const { currentRow, treeConfig, treeOpts, afterFullData } = this;
220
+ const $xeTable = this;
221
+ const props = $xeTable;
222
+ const reactData = $xeTable;
223
+ const internalData = $xeTable;
224
+ const { treeConfig } = props;
225
+ const { currentRow } = reactData;
226
+ const { afterFullData } = internalData;
227
+ const treeOpts = $xeTable.computeTreeOpts;
169
228
  const childrenField = treeOpts.children || treeOpts.childrenField;
170
229
  let targetRow;
171
- evnt.preventDefault();
172
230
  if (currentRow) {
173
231
  if (treeConfig) {
174
232
  const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
@@ -180,7 +238,7 @@ export default {
180
238
  }
181
239
  }
182
240
  else {
183
- const _rowIndex = this.getVTRowIndex(currentRow);
241
+ const _rowIndex = $xeTable.getVTRowIndex(currentRow);
184
242
  if (isUpArrow && _rowIndex > 0) {
185
243
  targetRow = afterFullData[_rowIndex - 1];
186
244
  }
@@ -193,42 +251,84 @@ export default {
193
251
  targetRow = afterFullData[0];
194
252
  }
195
253
  if (targetRow) {
196
- const params = { $table: this, row: targetRow };
197
- this.scrollToRow(targetRow)
198
- .then(() => this.triggerCurrentRowEvent(evnt, params));
254
+ evnt.preventDefault();
255
+ const params = {
256
+ $table: $xeTable,
257
+ row: targetRow,
258
+ rowIndex: $xeTable.getRowIndex(targetRow),
259
+ $rowIndex: $xeTable.getVMRowIndex(targetRow)
260
+ };
261
+ $xeTable.scrollToRow(targetRow)
262
+ .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
263
+ }
264
+ },
265
+ // 处理当前列方向键移动
266
+ moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
267
+ const $xeTable = this;
268
+ const reactData = $xeTable;
269
+ const internalData = $xeTable;
270
+ const { currentColumn } = reactData;
271
+ const { visibleColumn } = internalData;
272
+ let targetCol = null;
273
+ if (currentColumn) {
274
+ const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
275
+ if (isLeftArrow && _columnIndex > 0) {
276
+ targetCol = visibleColumn[_columnIndex - 1];
277
+ }
278
+ else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
279
+ targetCol = visibleColumn[_columnIndex + 1];
280
+ }
281
+ }
282
+ else {
283
+ targetCol = visibleColumn[0];
284
+ }
285
+ if (targetCol) {
286
+ evnt.preventDefault();
287
+ const params = {
288
+ $table: $xeTable,
289
+ column: targetCol,
290
+ columnIndex: $xeTable.getColumnIndex(targetCol),
291
+ $columnIndex: $xeTable.getVMColumnIndex(targetCol)
292
+ };
293
+ $xeTable.scrollToColumn(targetCol)
294
+ .then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
199
295
  }
200
296
  },
201
297
  // 处理可编辑方向键移动
202
- moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
203
- const { afterFullData, visibleColumn } = this;
204
- const params = Object.assign({}, args);
205
- const _rowIndex = this.getVTRowIndex(params.row);
206
- const _columnIndex = this.getVTColumnIndex(params.column);
207
- evnt.preventDefault();
208
- if (isUpArrow && _rowIndex > 0) {
209
- // 移动到上一行
210
- params.rowIndex = _rowIndex - 1;
211
- params.row = afterFullData[params.rowIndex];
298
+ moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
299
+ const $xeTable = this;
300
+ const props = $xeTable;
301
+ const { highlightCurrentRow, highlightCurrentColumn } = props;
302
+ const rowOpts = $xeTable.computeRowOpts;
303
+ const columnOpts = $xeTable.computeColumnOpts;
304
+ handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
305
+ // 当前行按键上下移动
306
+ if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
307
+ $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
212
308
  }
213
- else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
214
- // 移动到下一行
215
- params.rowIndex = _rowIndex + 1;
216
- params.row = afterFullData[params.rowIndex];
309
+ // 当前行按键左右移动
310
+ if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
311
+ $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
217
312
  }
218
- else if (isLeftArrow && _columnIndex) {
219
- // 移动到左侧单元格
220
- params.columnIndex = _columnIndex - 1;
221
- params.column = visibleColumn[params.columnIndex];
313
+ },
314
+ moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
315
+ const $xeTable = this;
316
+ const rowOpts = $xeTable.computeRowOpts;
317
+ const currentRowOpts = $xeTable.computeCurrentRowOpts;
318
+ const columnOpts = $xeTable.computeColumnOpts;
319
+ const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
320
+ const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
321
+ if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
322
+ $xeTable.triggerCurrentRowEvent(evnt, params);
222
323
  }
223
- else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
224
- // 移动到右侧单元格
225
- params.columnIndex = _columnIndex + 1;
226
- params.column = visibleColumn[params.columnIndex];
324
+ if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
325
+ $xeTable.triggerCurrentColumnEvent(evnt, params);
227
326
  }
228
- this.scrollToRow(params.row, params.column).then(() => {
229
- params.cell = this.getCellElement(params.row, params.column);
230
- this.handleSelected(params, evnt);
231
- });
327
+ },
328
+ // 处理可编辑方向键移动
329
+ moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
330
+ const $xeTable = this;
331
+ handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
232
332
  },
233
333
  handleCellMousedownEvent(evnt, params) {
234
334
  const $xeTable = this;
@@ -58,6 +58,7 @@ export default {
58
58
  */
59
59
  handleGlobalContextmenuEvent(evnt) {
60
60
  const $xeTable = this;
61
+ const $xeGrid = $xeTable.$xeGrid;
61
62
  const internalData = $xeTable;
62
63
  const { $refs, tId, editStore, menuConfig, contextMenu, ctxMenuStore, ctxMenuOpts, mouseConfig, mouseOpts } = this;
63
64
  const { selected } = editStore;
@@ -70,7 +71,7 @@ export default {
70
71
  }
71
72
  if (internalData._keyCtx) {
72
73
  const type = 'body';
73
- const params = { type, $grid: this.$xegrid, $table: this, keyboard: true, columns: this.visibleColumn.slice(0), $event: evnt };
74
+ const params = { type, $grid: $xeGrid, $table: this, keyboard: true, columns: this.visibleColumn.slice(0), $event: evnt };
74
75
  // 如果开启单元格区域
75
76
  if (mouseConfig && mouseOpts.area) {
76
77
  const activeArea = this.getActiveCellArea();
@@ -98,7 +99,7 @@ export default {
98
99
  // target=td|th,直接向上找 table 去匹配即可
99
100
  return target.parentNode.parentNode.parentNode.getAttribute('xid') === tId;
100
101
  });
101
- const params = { type: layout, $grid: this.$xegrid, $table: this, columns: this.visibleColumn.slice(0), $event: evnt };
102
+ const params = { type: layout, $grid: $xeGrid, $table: this, columns: this.visibleColumn.slice(0), $event: evnt };
102
103
  if (columnTargetNode.flag) {
103
104
  const cell = columnTargetNode.targetElem;
104
105
  const column = this.getColumnNode(cell).item;
@@ -261,10 +262,12 @@ export default {
261
262
  * 快捷菜单点击事件
262
263
  */
263
264
  ctxMenuLinkEvent(evnt, menu) {
265
+ const $xeTable = this;
266
+ const $xeGrid = $xeTable.$xeGrid;
264
267
  // 如果一级菜单有配置 code 则允许点击,否则不能点击
265
268
  if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
266
269
  const gMenuOpts = menus.get(menu.code);
267
- const params = Object.assign({ menu, $grid: this.$xegrid, $table: this, $event: evnt }, this.ctxMenuStore.args);
270
+ const params = Object.assign({ menu, $grid: $xeGrid, $table: this, $event: evnt }, this.ctxMenuStore.args);
268
271
  if (gMenuOpts && gMenuOpts.menuMethod) {
269
272
  gMenuOpts.menuMethod(params, evnt);
270
273
  }
@@ -17,7 +17,7 @@ export default {
17
17
  }
18
18
  },
19
19
  render(h) {
20
- const $xetable = this.$parent;
20
+ const $xeTable = this.$parent;
21
21
  const { _e, ctxMenuOpts, ctxMenuStore } = this;
22
22
  return h('div', {
23
23
  class: ['vxe-table--context-menu-wrapper', ctxMenuOpts.className, {
@@ -47,13 +47,13 @@ export default {
47
47
  class: 'vxe-context-menu--link',
48
48
  on: {
49
49
  click(evnt) {
50
- $xetable.ctxMenuLinkEvent(evnt, item);
50
+ $xeTable.ctxMenuLinkEvent(evnt, item);
51
51
  },
52
52
  mouseover(evnt) {
53
- $xetable.ctxMenuMouseoverEvent(evnt, item);
53
+ $xeTable.ctxMenuMouseoverEvent(evnt, item);
54
54
  },
55
55
  mouseout(evnt) {
56
- $xetable.ctxMenuMouseoutEvent(evnt, item);
56
+ $xeTable.ctxMenuMouseoutEvent(evnt, item);
57
57
  }
58
58
  }
59
59
  }, [
@@ -98,13 +98,13 @@ export default {
98
98
  class: 'vxe-context-menu--link',
99
99
  on: {
100
100
  click(evnt) {
101
- $xetable.ctxMenuLinkEvent(evnt, child);
101
+ $xeTable.ctxMenuLinkEvent(evnt, child);
102
102
  },
103
103
  mouseover(evnt) {
104
- $xetable.ctxMenuMouseoverEvent(evnt, item, child);
104
+ $xeTable.ctxMenuMouseoverEvent(evnt, item, child);
105
105
  },
106
106
  mouseout(evnt) {
107
- $xetable.ctxMenuMouseoutEvent(evnt, item, child);
107
+ $xeTable.ctxMenuMouseoutEvent(evnt, item);
108
108
  }
109
109
  }
110
110
  }, [
@@ -153,8 +153,8 @@ export default {
153
153
  const internalData = $xeTable;
154
154
  const validRest = {};
155
155
  const { editRules, treeConfig } = props;
156
- const { editStore, pendingRowMaps } = reactData;
157
- const { afterFullData } = internalData;
156
+ const { editStore } = reactData;
157
+ const { afterFullData, pendingRowMaps } = internalData;
158
158
  const { removeMaps } = editStore;
159
159
  const treeOpts = $xeTable.computeTreeOpts;
160
160
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -4,7 +4,7 @@ import { getCellValue, setCellValue } from '../src/util';
4
4
  import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
5
5
  import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
6
6
  import { errLog } from '../../ui/src/log';
7
- const { getConfig, renderer, getI18n } = VxeUI;
7
+ const { getConfig, renderer, getI18n, getComponent } = VxeUI;
8
8
  const componentDefaultModelProp = 'value';
9
9
  const defaultCompProps = {};
10
10
  function handleDefaultValue(value, defaultVal, initVal) {
@@ -35,7 +35,7 @@ function getOldComponent({ name }) {
35
35
  return getOldComponentName(name);
36
36
  }
37
37
  function getDefaultComponent({ name }) {
38
- return name;
38
+ return getComponent(name) || name;
39
39
  }
40
40
  function handleConfirmFilter(params, checked, option) {
41
41
  const { $panel } = params;
@@ -678,7 +678,13 @@ renderer.mixin({
678
678
  tableFilterDefaultMethod: handleInputFilterMethod
679
679
  },
680
680
  FormatNumberInput: {
681
- renderTableDefault: handleNumberCell
681
+ renderTableDefault: handleNumberCell,
682
+ tableFilterDefaultMethod: handleInputFilterMethod,
683
+ tableExportMethod(params) {
684
+ const { row, column } = params;
685
+ const cellValue = XEUtils.get(row, column.field);
686
+ return cellValue;
687
+ }
682
688
  },
683
689
  VxeNumberInput: {
684
690
  tableAutoFocus: 'input',
@@ -800,7 +806,9 @@ renderer.mixin({
800
806
  FormatSelect: {
801
807
  renderTableDefault(h, renderOpts, params) {
802
808
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
803
- }
809
+ },
810
+ tableFilterDefaultMethod: handleFilterMethod,
811
+ tableExportMethod: handleExportSelectMethod
804
812
  },
805
813
  VxeTreeSelect: {
806
814
  tableAutoFocus: 'input',
@@ -830,7 +838,8 @@ renderer.mixin({
830
838
  FormatTreeSelect: {
831
839
  renderTableDefault(h, renderOpts, params) {
832
840
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
833
- }
841
+ },
842
+ tableExportMethod: handleExportTreeSelectMethod
834
843
  },
835
844
  VxeColorPicker: {
836
845
  tableAutoFocus: 'input',
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../ui';
3
3
  import { isEnableConf, getClass } from '../../ui/src/utils';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
4
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
5
5
  import { updateCellTitle } from '../../ui/src/dom';
6
6
  import { getSlotVNs } from '../../ui/src/vn';
7
7
  const { getI18n, renderer, renderEmptyElement } = VxeUI;
@@ -14,7 +14,7 @@ const isVMScrollProcess = ($xeTable) => {
14
14
  const { lastScrollTime, isDragResize } = tableReactData;
15
15
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover));
16
16
  };
17
- function renderLine(h, _vm, params, cellHeight) {
17
+ function renderLine(h, _vm, rowid, params, cellHeight) {
18
18
  const $xeTable = _vm.$parent;
19
19
  const tableProps = $xeTable;
20
20
  const tableInternalData = $xeTable;
@@ -27,7 +27,6 @@ function renderLine(h, _vm, params, cellHeight) {
27
27
  if (slots && slots.line) {
28
28
  return $xeTable.callSlot(slots.line, params, h);
29
29
  }
30
- const rowid = getRowid($xeTable, row);
31
30
  const rest = fullAllDataRowIdData[rowid];
32
31
  let rLevel = 0;
33
32
  let prevRow = null;
@@ -63,9 +62,10 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
63
62
  const tableProps = $xeTable;
64
63
  const tableReactData = $xeTable;
65
64
  const tableInternalData = $xeTable;
66
- const { fullAllDataRowIdData } = tableInternalData;
65
+ const $xeGrid = $xeTable.$xeGrid;
66
+ const { fullAllDataRowIdData, fullColumnIdData, visibleColumn } = tableInternalData;
67
67
  const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
68
- const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
68
+ const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
69
69
  const { afterFullData, scrollXStore, scrollYStore } = tableInternalData;
70
70
  const cellOpts = $xeTable.computeCellOpts;
71
71
  const validOpts = $xeTable.computeValidOpts;
@@ -81,19 +81,21 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
81
81
  const columnOpts = $xeTable.computeColumnOpts;
82
82
  const mouseOpts = $xeTable.computeMouseOpts;
83
83
  const areaOpts = $xeTable.computeAreaOpts;
84
+ const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
84
85
  const { selectCellToRow } = areaOpts;
85
86
  const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column;
86
87
  const { verticalAlign: allVerticalAlign } = cellOpts;
87
88
  const { actived } = editStore;
88
- const rowRest = fullAllDataRowIdData[rowid];
89
+ const rowRest = fullAllDataRowIdData[rowid] || {};
89
90
  const colid = column.id;
91
+ const colRest = fullColumnIdData[colid] || {};
90
92
  const renderOpts = editRender || cellRender;
91
93
  const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
92
94
  const compCellClassName = compConf ? (compConf.tableCellClassName || compConf.cellClassName) : null;
93
95
  const compCellStyle = compConf ? (compConf.tableCellStyle || compConf.cellStyle) : '';
94
96
  const showAllTip = tooltipOpts.showAll;
95
- const columnIndex = $xeTable.getColumnIndex(column);
96
- const _columnIndex = $xeTable.getVTColumnIndex(column);
97
+ const columnIndex = colRest.index;
98
+ const _columnIndex = colRest._index;
97
99
  const isEdit = isEnableConf(editRender);
98
100
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
99
101
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
@@ -115,7 +117,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
115
117
  const tdAttrs = { colid };
116
118
  const cellParams = {
117
119
  $table: $xeTable,
118
- $grid: $xeTable.xegrid,
120
+ $grid: $xeGrid,
119
121
  isEdit: false,
120
122
  seq,
121
123
  rowid,
@@ -189,6 +191,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
189
191
  tdOns.dblclick = (evnt) => {
190
192
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
191
193
  };
194
+ let isMergeCell = false;
192
195
  // 合并行或列
193
196
  if (mergeList.length) {
194
197
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -198,9 +201,11 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
198
201
  return null;
199
202
  }
200
203
  if (rowspan > 1) {
204
+ isMergeCell = true;
201
205
  tdAttrs.rowspan = rowspan;
202
206
  }
203
207
  if (colspan > 1) {
208
+ isMergeCell = true;
204
209
  tdAttrs.colspan = colspan;
205
210
  }
206
211
  }
@@ -233,15 +238,29 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
233
238
  const isLastColumn = $columnIndex === columns.length - 1;
234
239
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
235
240
  let isVNPreEmptyStatus = false;
236
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
237
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
238
- isVNPreEmptyStatus = true;
239
- }
240
- else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
241
- isVNPreEmptyStatus = true;
241
+ if (!isMergeCell) {
242
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
243
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
244
+ isVNPreEmptyStatus = true;
245
+ }
246
+ else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
247
+ isVNPreEmptyStatus = true;
248
+ }
242
249
  }
243
250
  }
244
251
  const tcStyle = {};
252
+ if (hasEllipsis && resizeWidthFlag) {
253
+ let tsColspan = tdAttrs.colspan || 0;
254
+ if (tsColspan > 1) {
255
+ for (let index = 1; index < tsColspan; index++) {
256
+ const nextColumn = visibleColumn[columnIndex + index];
257
+ if (nextColumn) {
258
+ tsColspan += nextColumn.renderWidth;
259
+ }
260
+ }
261
+ }
262
+ tcStyle.width = `${column.renderWidth - (cellOffsetWidth * tsColspan)}px`;
263
+ }
245
264
  if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
246
265
  tcStyle.height = `${cellHeight}px`;
247
266
  }
@@ -262,7 +281,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
262
281
  }
263
282
  else {
264
283
  // 渲染单元格
265
- tdVNs.push(...renderLine(h, _vm, cellParams, cellHeight), h('div', {
284
+ tdVNs.push(...renderLine(h, _vm, rowid, cellParams, cellHeight), h('div', {
266
285
  key: 'tc',
267
286
  class: ['vxe-cell', {
268
287
  'c--title': showTitle,
@@ -383,8 +402,8 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
383
402
  const tableReactData = $xeTable;
384
403
  const tableInternalData = $xeTable;
385
404
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
386
- const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData;
387
- const { fullAllDataRowIdData } = tableInternalData;
405
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData;
406
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData;
388
407
  const checkboxOpts = $xeTable.computeCheckboxOpts;
389
408
  const radioOpts = $xeTable.computeRadioOpts;
390
409
  const treeOpts = $xeTable.computeTreeOpts;
@@ -395,6 +414,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
395
414
  const { transform, seqMode } = treeOpts;
396
415
  const childrenField = treeOpts.children || treeOpts.childrenField;
397
416
  const rows = [];
417
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
398
418
  tableData.forEach((row, $rowIndex) => {
399
419
  const trOn = {};
400
420
  let rowIndex = $rowIndex;
@@ -415,8 +435,8 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
415
435
  $xeTable.clearHoverRow();
416
436
  };
417
437
  }
418
- const rowid = getRowid($xeTable, row);
419
- const rowRest = fullAllDataRowIdData[rowid];
438
+ const rowid = handleGetRowId(row);
439
+ const rowRest = fullAllDataRowIdData[rowid] || {};
420
440
  let rowLevel = 0;
421
441
  let seq = -1;
422
442
  let _rowIndex = 0;
@@ -432,7 +452,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
432
452
  }
433
453
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
434
454
  // 行是否被展开
435
- const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
455
+ const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
436
456
  // 树节点是否被展开
437
457
  let isExpandTree = false;
438
458
  let rowChildren = [];
@@ -443,7 +463,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
443
463
  }
444
464
  if (treeConfig && !scrollYLoad && !transform) {
445
465
  rowChildren = row[childrenField];
446
- isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid];
466
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
447
467
  }
448
468
  // 拖拽行事件
449
469
  if (rowOpts.drag && (!treeConfig || transform)) {
@@ -462,7 +482,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
462
482
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
463
483
  'row--radio': radioOpts.highlight && selectRadioRow === row,
464
484
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
465
- 'row--pending': !!pendingRowMaps[rowid]
485
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
466
486
  },
467
487
  rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
468
488
  ];
@@ -610,6 +630,7 @@ export default {
610
630
  const tableProps = $xeTable;
611
631
  const tableReactData = $xeTable;
612
632
  const tableInternalData = $xeTable;
633
+ const $xeGrid = $xeTable.$xeGrid;
613
634
  const { xID, $scopedSlots } = $xeTable;
614
635
  const { fixedColumn, fixedType, tableColumn } = props;
615
636
  const { spanMethod, footerSpanMethod, mouseConfig } = tableProps;
@@ -632,7 +653,7 @@ export default {
632
653
  isOptimizeMode = true;
633
654
  }
634
655
  }
635
- if (fixedType || !overflowX) {
656
+ if (!isColLoading && (fixedType || !overflowX)) {
636
657
  renderColumnList = visibleColumn;
637
658
  }
638
659
  if (fixedType) {
@@ -690,7 +711,7 @@ export default {
690
711
  }
691
712
  let emptyContent;
692
713
  if ($scopedSlots.empty) {
693
- emptyContent = $scopedSlots.empty.call(this, { $table: $xeTable, $grid: $xeTable.xegrid });
714
+ emptyContent = $scopedSlots.empty.call(this, { $table: $xeTable, $grid: $xeGrid });
694
715
  }
695
716
  else {
696
717
  const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null;
@@ -749,7 +770,10 @@ export default {
749
770
  attrs: {
750
771
  name: column.id
751
772
  },
752
- key: $columnIndex
773
+ key: $columnIndex,
774
+ style: {
775
+ width: `${column.renderWidth}px`
776
+ }
753
777
  });
754
778
  })),
755
779
  /**