vxe-table 3.14.2 → 3.14.3

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.
@@ -468,11 +468,11 @@ function updateStyle($xeTable) {
468
468
  }
469
469
  if (xLeftCornerEl) {
470
470
  xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
471
- xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : '';
471
+ xLeftCornerEl.style.display = scrollbarXToTop ? (overflowX && osbHeight ? 'block' : '') : '';
472
472
  }
473
473
  if (xRightCornerEl) {
474
474
  xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
475
- xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '');
475
+ xRightCornerEl.style.display = scrollbarXToTop ? '' : (overflowX && osbHeight ? 'block' : '');
476
476
  }
477
477
  const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
478
478
  if (scrollYVirtualEl) {
@@ -483,7 +483,7 @@ function updateStyle($xeTable) {
483
483
  const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
484
484
  if (yTopCornerEl) {
485
485
  yTopCornerEl.style.height = `${headerHeight}px`;
486
- yTopCornerEl.style.display = headerHeight ? 'block' : '';
486
+ yTopCornerEl.style.display = overflowY && headerHeight ? 'block' : '';
487
487
  }
488
488
  const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
489
489
  if (yWrapperEl) {
@@ -494,7 +494,7 @@ function updateStyle($xeTable) {
494
494
  if (yBottomCornerEl) {
495
495
  yBottomCornerEl.style.height = `${footerHeight}px`;
496
496
  yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`;
497
- yBottomCornerEl.style.display = footerHeight ? 'block' : '';
497
+ yBottomCornerEl.style.display = overflowY && footerHeight ? 'block' : '';
498
498
  }
499
499
  const rowExpandEl = $xeTable.$refs.refRowExpandElem;
500
500
  if (rowExpandEl) {
@@ -5160,13 +5160,25 @@ const Methods = {
5160
5160
  */
5161
5161
  handleGlobalKeydownEvent(evnt) {
5162
5162
  const $xeTable = this;
5163
+ const props = $xeTable;
5163
5164
  const internalData = $xeTable;
5165
+ const reactData = $xeTable;
5164
5166
  const $xeGrid = $xeTable.$xeGrid;
5165
5167
  // 该行为只对当前激活的表格有效
5166
- if (this.isActivated) {
5167
- this.preventEvent(evnt, 'event.keydown', null, () => {
5168
+ if (internalData.isActivated) {
5169
+ $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
5170
+ const { mouseConfig, keyboardConfig, treeConfig, editConfig, highlightCurrentRow, highlightCurrentColumn } = props;
5171
+ const { ctxMenuStore, editStore, currentRow } = reactData;
5168
5172
  const { afterFullData } = internalData;
5169
- const { filterStore, isCtxMenu, ctxMenuStore, editStore, editOpts, editConfig, mouseConfig, mouseOpts, keyboardConfig, keyboardOpts, treeConfig, treeOpts, highlightCurrentRow, currentRow, bodyCtxMenu, rowOpts } = this;
5173
+ const isMenu = $xeTable.computeIsMenu;
5174
+ const bodyMenu = $xeTable.computeBodyMenu;
5175
+ const keyboardOpts = $xeTable.computeKeyboardOpts;
5176
+ const mouseOpts = $xeTable.computeMouseOpts;
5177
+ const editOpts = $xeTable.computeEditOpts;
5178
+ const treeOpts = $xeTable.computeTreeOpts;
5179
+ const menuList = $xeTable.computeMenuList;
5180
+ const rowOpts = $xeTable.computeRowOpts;
5181
+ const columnOpts = $xeTable.computeColumnOpts;
5170
5182
  const { selected, actived } = editStore;
5171
5183
  const { keyCode } = evnt;
5172
5184
  const hasBackspaceKey = keyCode === 8;
@@ -5186,37 +5198,49 @@ const Methods = {
5186
5198
  const hasShiftKey = evnt.shiftKey;
5187
5199
  const hasAltKey = evnt.altKey;
5188
5200
  const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
5189
- const operCtxMenu = isCtxMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
5201
+ const operCtxMenu = isMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
5190
5202
  const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row;
5191
5203
  const childrenField = treeOpts.children || treeOpts.childrenField;
5192
5204
  const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
5193
- if (filterStore.visible) {
5194
- if (isEsc) {
5195
- this.closeFilter();
5196
- }
5197
- return;
5198
- }
5199
5205
  if (operCtxMenu) {
5200
5206
  // 如果配置了右键菜单; 支持方向键操作、回车
5201
5207
  evnt.preventDefault();
5202
5208
  if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
5203
- this.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
5209
+ $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selectChild', isLeftArrow, false, ctxMenuStore.selected.children);
5204
5210
  }
5205
5211
  else {
5206
- this.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, this.ctxMenuList);
5212
+ $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
5207
5213
  }
5208
5214
  }
5209
- else if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
5210
- this.handleKeyboardCellAreaEvent(evnt);
5215
+ else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
5216
+ $xeTable.handleKeyboardCellAreaEvent(evnt);
5217
+ }
5218
+ else if (isEsc) {
5219
+ // 如果按下了 Esc 键,关闭快捷菜单、筛选
5220
+ if ($xeTable.closeMenu) {
5221
+ $xeTable.closeMenu();
5222
+ }
5223
+ $xeTable.closeFilter();
5224
+ if (keyboardConfig && keyboardOpts.isEsc) {
5225
+ // 如果是激活编辑状态,则取消编辑
5226
+ if (actived.row) {
5227
+ const params = actived.args;
5228
+ $xeTable.handleClearEdit(evnt);
5229
+ // 如果配置了选中功能,则为选中状态
5230
+ if (mouseOpts.selected) {
5231
+ $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
5232
+ }
5233
+ }
5234
+ }
5211
5235
  }
5212
5236
  else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
5213
5237
  // 空格键支持选中复选框
5214
5238
  evnt.preventDefault();
5215
5239
  if (selected.column.type === 'checkbox') {
5216
- this.handleToggleCheckRowEvent(evnt, selected.args);
5240
+ $xeTable.handleToggleCheckRowEvent(evnt, selected.args);
5217
5241
  }
5218
5242
  else {
5219
- this.triggerRadioRowEvent(evnt, selected.args);
5243
+ $xeTable.triggerRadioRowEvent(evnt, selected.args);
5220
5244
  }
5221
5245
  }
5222
5246
  else if (isF2 && isEnableConf(editConfig)) {
@@ -5225,13 +5249,13 @@ const Methods = {
5225
5249
  if (selected.row && selected.column) {
5226
5250
  evnt.stopPropagation();
5227
5251
  evnt.preventDefault();
5228
- this.handleEdit(selected.args, evnt);
5252
+ $xeTable.handleEdit(selected.args, evnt);
5229
5253
  }
5230
5254
  }
5231
5255
  }
5232
5256
  else if (isContextMenu) {
5233
5257
  // 如果按下上下文键
5234
- internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
5258
+ internalData._keyCtx = selected.row && selected.column && bodyMenu.length;
5235
5259
  clearTimeout(internalData.keyCtxTimeout);
5236
5260
  internalData.keyCtxTimeout = setTimeout(() => {
5237
5261
  internalData._keyCtx = false;
@@ -5244,10 +5268,10 @@ const Methods = {
5244
5268
  // 如果是激活编辑状态,则取消编辑
5245
5269
  if (actived.row) {
5246
5270
  const params = actived.args;
5247
- this.handleClearEdit(evnt);
5271
+ $xeTable.handleClearEdit(evnt);
5248
5272
  // 如果配置了选中功能,则为选中状态
5249
5273
  if (mouseConfig && mouseOpts.selected) {
5250
- this.$nextTick(() => this.handleSelected(params, evnt));
5274
+ $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
5251
5275
  }
5252
5276
  }
5253
5277
  }
@@ -5257,15 +5281,15 @@ const Methods = {
5257
5281
  const activeParams = selected.row ? selected.args : actived.args;
5258
5282
  if (hasShiftKey) {
5259
5283
  if (keyboardOpts.enterToTab) {
5260
- this.moveTabSelected(activeParams, hasShiftKey, evnt);
5284
+ $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
5261
5285
  }
5262
5286
  else {
5263
- this.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
5287
+ $xeTable.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
5264
5288
  }
5265
5289
  }
5266
5290
  else {
5267
5291
  if (keyboardOpts.enterToTab) {
5268
- this.moveTabSelected(activeParams, hasShiftKey, evnt);
5292
+ $xeTable.moveTabSelected(activeParams, hasShiftKey, evnt);
5269
5293
  }
5270
5294
  else {
5271
5295
  const activeRow = selected.row || actived.row;
@@ -5294,7 +5318,7 @@ const Methods = {
5294
5318
  return;
5295
5319
  }
5296
5320
  }
5297
- this.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
5321
+ $xeTable.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
5298
5322
  if (enterMethod) {
5299
5323
  enterMethod(etrParams);
5300
5324
  }
@@ -5308,10 +5332,15 @@ const Methods = {
5308
5332
  if (childrens && childrens.length) {
5309
5333
  evnt.preventDefault();
5310
5334
  const targetRow = childrens[0];
5311
- const params = { $table: this, row: targetRow };
5312
- this.setTreeExpand(currentRow, true)
5313
- .then(() => this.scrollToRow(targetRow))
5314
- .then(() => this.triggerCurrentRowEvent(evnt, params));
5335
+ const params = {
5336
+ $table: $xeTable,
5337
+ row: targetRow,
5338
+ rowIndex: $xeTable.getRowIndex(targetRow),
5339
+ $rowIndex: $xeTable.getVMRowIndex(targetRow)
5340
+ };
5341
+ $xeTable.setTreeExpand(currentRow, true)
5342
+ .then(() => $xeTable.scrollToRow(targetRow))
5343
+ .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
5315
5344
  }
5316
5345
  }
5317
5346
  }
@@ -5319,18 +5348,28 @@ const Methods = {
5319
5348
  else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
5320
5349
  if (!isEditStatus) {
5321
5350
  // 如果按下了方向键
5322
- if (selected.row && selected.column) {
5351
+ if (mouseOpts.selected && selected.row && selected.column) {
5323
5352
  $xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
5324
5353
  }
5354
+ else {
5355
+ // 当前行按键上下移动
5356
+ if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
5357
+ $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
5358
+ }
5359
+ // 当前行按键左右移动
5360
+ if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
5361
+ $xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
5362
+ }
5363
+ }
5325
5364
  }
5326
5365
  }
5327
5366
  else if (isTab && keyboardConfig && keyboardOpts.isTab) {
5328
5367
  // 如果按下了 Tab 键切换
5329
5368
  if (selected.row || selected.column) {
5330
- this.moveTabSelected(selected.args, hasShiftKey, evnt);
5369
+ $xeTable.moveTabSelected(selected.args, hasShiftKey, evnt);
5331
5370
  }
5332
5371
  else if (actived.row || actived.column) {
5333
- this.moveTabSelected(actived.args, hasShiftKey, evnt);
5372
+ $xeTable.moveTabSelected(actived.args, hasShiftKey, evnt);
5334
5373
  }
5335
5374
  }
5336
5375
  else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selected.row || selected.column)) {
@@ -5339,10 +5378,10 @@ const Methods = {
5339
5378
  const { delMethod } = keyboardOpts;
5340
5379
  const params = {
5341
5380
  row: selected.row,
5342
- rowIndex: this.getRowIndex(selected.row),
5381
+ rowIndex: $xeTable.getRowIndex(selected.row),
5343
5382
  column: selected.column,
5344
- columnIndex: this.getColumnIndex(selected.column),
5345
- $table: this,
5383
+ columnIndex: $xeTable.getColumnIndex(selected.column),
5384
+ $table: $xeTable,
5346
5385
  $grid: $xeGrid
5347
5386
  };
5348
5387
  // 是否被禁用
@@ -5354,8 +5393,8 @@ const Methods = {
5354
5393
  setCellValue(selected.row, selected.column, null);
5355
5394
  }
5356
5395
  // 如果按下 del 键,更新表尾数据
5357
- this.updateFooter();
5358
- this.emitEvent('cell-delete-value', params, evnt);
5396
+ $xeTable.updateFooter();
5397
+ $xeTable.dispatchEvent('cell-delete-value', params, evnt);
5359
5398
  }
5360
5399
  }
5361
5400
  }
@@ -5366,10 +5405,10 @@ const Methods = {
5366
5405
  if (keyboardOpts.isDel && isEnableConf(editConfig) && (selected.row || selected.column)) {
5367
5406
  const params = {
5368
5407
  row: selected.row,
5369
- rowIndex: this.getRowIndex(selected.row),
5408
+ rowIndex: $xeTable.getRowIndex(selected.row),
5370
5409
  column: selected.column,
5371
- columnIndex: this.getColumnIndex(selected.column),
5372
- $table: this,
5410
+ columnIndex: $xeTable.getColumnIndex(selected.column),
5411
+ $table: $xeTable,
5373
5412
  $grid: $xeGrid
5374
5413
  };
5375
5414
  // 是否被禁用
@@ -5382,28 +5421,28 @@ const Methods = {
5382
5421
  if (editMode !== 'insert') {
5383
5422
  setCellValue(selected.row, selected.column, null);
5384
5423
  }
5385
- this.handleEdit(selected.args, evnt);
5424
+ $xeTable.handleEdit(selected.args, evnt);
5386
5425
  }
5387
- this.emitEvent('cell-backspace-value', params, evnt);
5426
+ $xeTable.dispatchEvent('cell-backspace-value', params, evnt);
5388
5427
  }
5389
5428
  }
5390
5429
  }
5391
5430
  }
5392
5431
  else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
5393
5432
  // 如果树形表格回退键关闭当前行返回父节点
5394
- const { parent: parentRow } = XEUtils.findTree(this.afterTreeFullData, item => item === currentRow, { children: childrenField });
5433
+ const { parent: parentRow } = XEUtils.findTree(internalData.afterTreeFullData, item => item === currentRow, { children: childrenField });
5395
5434
  if (parentRow) {
5396
5435
  evnt.preventDefault();
5397
5436
  const params = {
5398
5437
  row: parentRow,
5399
- rowIndex: this.getRowIndex(parentRow),
5400
- $rowIndex: this.getVMRowIndex(parentRow),
5401
- $table: this,
5438
+ rowIndex: $xeTable.getRowIndex(parentRow),
5439
+ $rowIndex: $xeTable.getVMRowIndex(parentRow),
5440
+ $table: $xeTable,
5402
5441
  $grid: $xeGrid
5403
5442
  };
5404
- this.setTreeExpand(parentRow, false)
5405
- .then(() => this.scrollToRow(parentRow))
5406
- .then(() => this.triggerCurrentRowEvent(evnt, params));
5443
+ $xeTable.setTreeExpand(parentRow, false)
5444
+ .then(() => $xeTable.scrollToRow(parentRow))
5445
+ .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
5407
5446
  }
5408
5447
  }
5409
5448
  else if (keyboardConfig && keyboardOpts.isEdit && !hasCtrlKey && !hasMetaKey && (isSpacebar || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
@@ -5417,10 +5456,10 @@ const Methods = {
5417
5456
  const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
5418
5457
  const params = {
5419
5458
  row: selected.row,
5420
- rowIndex: this.getRowIndex(selected.row),
5459
+ rowIndex: $xeTable.getRowIndex(selected.row),
5421
5460
  column: selected.column,
5422
- columnIndex: this.getColumnIndex(selected.column),
5423
- $table: this,
5461
+ columnIndex: $xeTable.getColumnIndex(selected.column),
5462
+ $table: $xeTable,
5424
5463
  $grid: $xeGrid
5425
5464
  };
5426
5465
  if (!beforeEditMethod || beforeEditMethod(params)) {
@@ -5429,12 +5468,12 @@ const Methods = {
5429
5468
  }
5430
5469
  else {
5431
5470
  setCellValue(selected.row, selected.column, null);
5432
- this.handleEdit(selected.args, evnt);
5471
+ $xeTable.handleEdit(selected.args, evnt);
5433
5472
  }
5434
5473
  }
5435
5474
  }
5436
5475
  }
5437
- this.emitEvent('keydown', {}, evnt);
5476
+ $xeTable.dispatchEvent('keydown', {}, evnt);
5438
5477
  });
5439
5478
  }
5440
5479
  },
@@ -8694,6 +8733,7 @@ const Methods = {
8694
8733
  const internalData = $xeTable;
8695
8734
  const { isGroup, scrollXLoad, overflowX, scrollXWidth } = reactData;
8696
8735
  const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData;
8736
+ const mouseOpts = $xeTable.computeMouseOpts;
8697
8737
  const tableBody = $xeTable.$refs.refTableBody;
8698
8738
  const tableBodyElem = tableBody ? tableBody.$el : null;
8699
8739
  if (tableBodyElem) {
@@ -8753,6 +8793,9 @@ const Methods = {
8753
8793
  if (scrollXSpaceEl) {
8754
8794
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
8755
8795
  }
8796
+ if (isScrollXBig && mouseOpts.area) {
8797
+ errLog('vxe.error.notProp', ['mouse-config.area']);
8798
+ }
8756
8799
  $xeTable.$nextTick(() => {
8757
8800
  updateStyle($xeTable);
8758
8801
  });
@@ -8775,6 +8818,7 @@ const Methods = {
8775
8818
  const { isAllOverflow, scrollYLoad, expandColumn } = reactData;
8776
8819
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData;
8777
8820
  const { startIndex } = scrollYStore;
8821
+ const mouseOpts = $xeTable.computeMouseOpts;
8778
8822
  const expandOpts = $xeTable.computeExpandOpts;
8779
8823
  const rowOpts = $xeTable.computeRowOpts;
8780
8824
  const cellOpts = $xeTable.computeCellOpts;
@@ -8858,6 +8902,9 @@ const Methods = {
8858
8902
  reactData.scrollYTop = scrollYTop;
8859
8903
  reactData.scrollYHeight = scrollYHeight;
8860
8904
  reactData.isScrollYBig = isScrollYBig;
8905
+ if (isScrollYBig && mouseOpts.area) {
8906
+ errLog('vxe.error.notProp', ['mouse-config.area']);
8907
+ }
8861
8908
  return $xeTable.$nextTick().then(() => {
8862
8909
  updateStyle($xeTable);
8863
8910
  });
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.14.2";
3
+ export const version = "3.14.3";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
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.14.2"}`;
3
+ const version = `table v${"3.14.3"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);