vxe-table 3.24.3 → 3.25.0-beta.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 (73) hide show
  1. package/es/grid/src/grid.js +26 -7
  2. package/es/style.css +1 -1
  3. package/es/table/module/custom/panel.js +3 -2
  4. package/es/table/module/edit/mixin.js +5 -4
  5. package/es/table/module/export/mixin.js +6 -4
  6. package/es/table/module/filter/mixin.js +2 -2
  7. package/es/table/module/keyboard/mixin.js +4 -3
  8. package/es/table/module/menu/mixin.js +3 -3
  9. package/es/table/render/index.js +5 -3
  10. package/es/table/src/body.js +4 -4
  11. package/es/table/src/header.js +4 -3
  12. package/es/table/src/methods.js +77 -49
  13. package/es/table/src/table.js +30 -27
  14. package/es/table/src/util.js +6 -3
  15. package/es/ui/index.js +1 -1
  16. package/es/ui/src/log.js +1 -1
  17. package/es/ui/src/utils.js +9 -0
  18. package/lib/grid/src/grid.js +28 -6
  19. package/lib/grid/src/grid.min.js +1 -1
  20. package/lib/index.umd.js +5202 -5144
  21. package/lib/index.umd.min.js +1 -1
  22. package/lib/style.css +1 -1
  23. package/lib/table/module/custom/panel.js +2 -1
  24. package/lib/table/module/custom/panel.min.js +1 -1
  25. package/lib/table/module/edit/mixin.js +4 -3
  26. package/lib/table/module/edit/mixin.min.js +1 -1
  27. package/lib/table/module/export/mixin.js +9 -3
  28. package/lib/table/module/export/mixin.min.js +1 -1
  29. package/lib/table/module/filter/mixin.js +1 -1
  30. package/lib/table/module/filter/mixin.min.js +1 -1
  31. package/lib/table/module/keyboard/mixin.js +4 -3
  32. package/lib/table/module/keyboard/mixin.min.js +1 -1
  33. package/lib/table/module/menu/mixin.js +2 -2
  34. package/lib/table/module/menu/mixin.min.js +1 -1
  35. package/lib/table/render/index.js +4 -2
  36. package/lib/table/render/index.min.js +1 -1
  37. package/lib/table/src/body.js +3 -3
  38. package/lib/table/src/body.min.js +1 -1
  39. package/lib/table/src/header.js +3 -2
  40. package/lib/table/src/header.min.js +1 -1
  41. package/lib/table/src/methods.js +33 -31
  42. package/lib/table/src/methods.min.js +1 -1
  43. package/lib/table/src/table.js +33 -26
  44. package/lib/table/src/table.min.js +1 -1
  45. package/lib/table/src/util.js +8 -2
  46. package/lib/table/src/util.min.js +1 -1
  47. package/lib/ui/index.js +1 -1
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/log.js +1 -1
  50. package/lib/ui/src/log.min.js +1 -1
  51. package/lib/ui/src/utils.js +10 -0
  52. package/lib/ui/src/utils.min.js +1 -1
  53. package/package.json +2 -2
  54. package/packages/grid/src/grid.ts +28 -7
  55. package/packages/table/module/custom/panel.ts +3 -2
  56. package/packages/table/module/edit/mixin.ts +5 -4
  57. package/packages/table/module/export/mixin.ts +6 -4
  58. package/packages/table/module/filter/mixin.ts +2 -2
  59. package/packages/table/module/keyboard/mixin.ts +4 -3
  60. package/packages/table/module/menu/mixin.ts +3 -3
  61. package/packages/table/render/index.ts +5 -3
  62. package/packages/table/src/body.ts +4 -4
  63. package/packages/table/src/header.ts +4 -3
  64. package/packages/table/src/methods.ts +74 -47
  65. package/packages/table/src/table.ts +30 -27
  66. package/packages/table/src/util.ts +6 -3
  67. package/packages/ui/src/utils.ts +10 -0
  68. /package/es/{iconfont.1790757586395.ttf → iconfont.1791880417274.ttf} +0 -0
  69. /package/es/{iconfont.1790757586395.woff → iconfont.1791880417274.woff} +0 -0
  70. /package/es/{iconfont.1790757586395.woff2 → iconfont.1791880417274.woff2} +0 -0
  71. /package/lib/{iconfont.1790757586395.ttf → iconfont.1791880417274.ttf} +0 -0
  72. /package/lib/{iconfont.1790757586395.woff → iconfont.1791880417274.woff} +0 -0
  73. /package/lib/{iconfont.1790757586395.woff2 → iconfont.1791880417274.woff2} +0 -0
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLeftTo, wheelScrollTopTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom';
3
- import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
3
+ import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
6
6
  import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util';
@@ -1255,7 +1255,7 @@ function updateStyle($xeTable) {
1255
1255
  if (currentRow) {
1256
1256
  $xeTable.setCurrentRow(currentRow);
1257
1257
  }
1258
- if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
1258
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
1259
1259
  $xeTable.addCellSelectedClass();
1260
1260
  }
1261
1261
  if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
@@ -3455,12 +3455,13 @@ function loadTableData($xeTable, datas, isReload, isReset) {
3455
3455
  const props = $xeTable;
3456
3456
  const reactData = $xeTable;
3457
3457
  const internalData = $xeTable;
3458
- const { keepSource, treeConfig, aggregateConfig, rowGroupConfig } = props;
3458
+ const { keepSource, treeConfig, rowGroupConfig, aggregateConfig, mouseConfig } = props;
3459
3459
  const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData;
3460
3460
  const { initStatus, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData;
3461
3461
  const rowOpts = $xeTable.computeRowOpts;
3462
3462
  const treeOpts = $xeTable.computeTreeOpts;
3463
3463
  const expandOpts = $xeTable.computeExpandOpts;
3464
+ const mouseOpts = $xeTable.computeMouseOpts;
3464
3465
  const { transform } = treeOpts;
3465
3466
  const childrenField = treeOpts.children || treeOpts.childrenField;
3466
3467
  let treeData = [];
@@ -3550,7 +3551,7 @@ function loadTableData($xeTable, datas, isReload, isReset) {
3550
3551
  if (keepSource) {
3551
3552
  $xeTable.cacheSourceMap(fullData);
3552
3553
  }
3553
- if ($xeTable.clearCellAreas && props.mouseConfig) {
3554
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
3554
3555
  $xeTable.clearCellAreas();
3555
3556
  $xeTable.clearCopyCellArea();
3556
3557
  }
@@ -4678,9 +4679,25 @@ const tableMethods = {
4678
4679
  const $xeTable = this;
4679
4680
  const $xeGrid = $xeTable.$xeGrid;
4680
4681
  const $xeGantt = $xeTable.$xeGantt;
4681
- const $xeGGWrapper = $xeGrid || $xeGantt;
4682
- const { $el } = this;
4683
- return $xeGGWrapper ? $xeGGWrapper.$el.parentNode : $el.parentNode;
4682
+ const el = $xeTable.$refs.refElem;
4683
+ if (!el) {
4684
+ return null;
4685
+ }
4686
+ const parentEl = el.parentElement;
4687
+ if (!parentEl) {
4688
+ return null;
4689
+ }
4690
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
4691
+ return $xeGantt.getParentElem();
4692
+ }
4693
+ else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
4694
+ return $xeGrid.getParentElem();
4695
+ }
4696
+ // 如果是虚拟滚动条
4697
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
4698
+ return parentEl.parentElement;
4699
+ }
4700
+ return parentEl;
4684
4701
  },
4685
4702
  /**
4686
4703
  * 获取父容器的高度
@@ -4692,24 +4709,32 @@ const tableMethods = {
4692
4709
  const props = $xeTable;
4693
4710
  const { height } = props;
4694
4711
  const el = $xeTable.$refs.refElem;
4695
- if (el) {
4696
- const parentElem = el.parentNode;
4697
- const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
4698
- let parentWrapperHeight = 0;
4699
- if (parentElem) {
4700
- if ($xeGantt && hasClass(parentElem, 'vxe-gantt--table-wrapper')) {
4701
- parentWrapperHeight = $xeGantt.getParentHeight();
4702
- }
4703
- else if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
4704
- parentWrapperHeight = $xeGrid.getParentHeight();
4705
- }
4706
- else {
4707
- parentWrapperHeight = parentElem.clientHeight;
4708
- }
4712
+ if (!el) {
4713
+ return 0;
4714
+ }
4715
+ let parentEl = el.parentElement;
4716
+ let parentPaddingSize = 0;
4717
+ let parentWrapperHeight = 0;
4718
+ if (!parentEl) {
4719
+ return 0;
4720
+ }
4721
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
4722
+ parentWrapperHeight = $xeGantt.getParentHeight();
4723
+ }
4724
+ else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
4725
+ parentWrapperHeight = $xeGrid.getParentHeight();
4726
+ }
4727
+ else {
4728
+ // 如果是虚拟滚动条
4729
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
4730
+ parentEl = parentEl.parentElement;
4731
+ }
4732
+ if (parentEl) {
4733
+ parentWrapperHeight = parentEl.clientHeight;
4734
+ parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentEl) : 0;
4709
4735
  }
4710
- return Math.floor(parentWrapperHeight - parentPaddingSize);
4711
4736
  }
4712
- return 0;
4737
+ return Math.floor(parentWrapperHeight - parentPaddingSize);
4713
4738
  },
4714
4739
  /**
4715
4740
  * 获取需要排除的高度
@@ -6443,7 +6468,8 @@ const tableMethods = {
6443
6468
  const $xeTable = this;
6444
6469
  const props = $xeTable;
6445
6470
  const { mouseConfig } = props;
6446
- if (mouseConfig) {
6471
+ const mouseOpts = $xeTable.computeMouseOpts;
6472
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
6447
6473
  if ($xeTable.clearSelected) {
6448
6474
  $xeTable.clearSelected();
6449
6475
  }
@@ -7505,6 +7531,7 @@ const tableMethods = {
7505
7531
  const editOpts = $xeTable.computeEditOpts;
7506
7532
  const validOpts = $xeTable.computeValidOpts;
7507
7533
  const areaOpts = $xeTable.computeAreaOpts;
7534
+ const mouseOpts = $xeTable.computeMouseOpts;
7508
7535
  const { actived } = editStore;
7509
7536
  const tableFilter = $xeTable.$refs.refTableFilter;
7510
7537
  const tableMenu = $xeTable.$refs.refTableMenu;
@@ -7600,7 +7627,7 @@ const tableMethods = {
7600
7627
  }
7601
7628
  }
7602
7629
  }
7603
- else if (mouseConfig) {
7630
+ else if (hasEnableConf(mouseConfig, mouseOpts)) {
7604
7631
  if (!getEventTargetNode(evnt, el).flag && !($xeGGWrapper && getEventTargetNode(evnt, $xeGGWrapper.$el).flag) && !(tableMenu && getEventTargetNode(evnt, tableMenu.$el).flag) && !(this.$toolbar && getEventTargetNode(evnt, this.$toolbar.$el).flag)) {
7605
7632
  if ($xeTable.clearSelected) {
7606
7633
  $xeTable.clearSelected();
@@ -7677,7 +7704,7 @@ const tableMethods = {
7677
7704
  if (isEsc) {
7678
7705
  $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
7679
7706
  $xeTable.dispatchEvent('keydown-start', {}, evnt);
7680
- if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
7707
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
7681
7708
  $xeTable.handleKdClAreaEvent(evnt);
7682
7709
  }
7683
7710
  else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
@@ -7685,13 +7712,13 @@ const tableMethods = {
7685
7712
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
7686
7713
  $xeTable.closeFilter();
7687
7714
  $xeTable.closeMenu();
7688
- if (keyboardConfig && keyboardOpts.isEsc) {
7715
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
7689
7716
  // 如果是激活编辑状态,则取消编辑
7690
7717
  if (actived.row) {
7691
7718
  const params = actived.args;
7692
7719
  $xeTable.handleClearEdit(evnt);
7693
7720
  // 如果配置了选中功能,则为选中状态
7694
- if (mouseConfig && mouseOpts.selected) {
7721
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
7695
7722
  $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
7696
7723
  }
7697
7724
  }
@@ -7769,7 +7796,7 @@ const tableMethods = {
7769
7796
  $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
7770
7797
  }
7771
7798
  }
7772
- else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
7799
+ else if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
7773
7800
  $xeTable.handleKdClAreaEvent(evnt);
7774
7801
  }
7775
7802
  else if (isEsc) {
@@ -7778,7 +7805,7 @@ const tableMethods = {
7778
7805
  $xeTable.closeMenu();
7779
7806
  }
7780
7807
  $xeTable.closeFilter();
7781
- if (keyboardConfig && keyboardOpts.isEsc) {
7808
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
7782
7809
  // 如果是激活编辑状态,则取消编辑
7783
7810
  if (actived.row) {
7784
7811
  const params = actived.args;
@@ -7790,7 +7817,7 @@ const tableMethods = {
7790
7817
  }
7791
7818
  }
7792
7819
  }
7793
- else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
7820
+ else if (hasEnableConf(keyboardConfig, keyboardOpts) && isSpacebar && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
7794
7821
  // 空格键支持选中复选框
7795
7822
  evnt.preventDefault();
7796
7823
  if (selectColumn.type === 'checkbox') {
@@ -7817,7 +7844,7 @@ const tableMethods = {
7817
7844
  internalData._keyCtx = false;
7818
7845
  }, 1000);
7819
7846
  }
7820
- else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
7847
+ else if (isEnter && !hasAltKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
7821
7848
  // 退出选中
7822
7849
  if (isControlKey) {
7823
7850
  // 如果是激活编辑状态,则取消编辑
@@ -7825,7 +7852,7 @@ const tableMethods = {
7825
7852
  const params = actived.args;
7826
7853
  $xeTable.handleClearEdit(evnt);
7827
7854
  // 如果配置了选中功能,则为选中状态
7828
- if (mouseConfig && mouseOpts.selected) {
7855
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
7829
7856
  $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt));
7830
7857
  }
7831
7858
  }
@@ -7943,7 +7970,7 @@ const tableMethods = {
7943
7970
  }
7944
7971
  }
7945
7972
  }
7946
- else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
7973
+ else if (operArrow && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow) {
7947
7974
  if (!isEditStatus) {
7948
7975
  // 如果按下了方向键
7949
7976
  if (mouseOpts.selected && selectRow && selectColumn) {
@@ -7961,7 +7988,7 @@ const tableMethods = {
7961
7988
  }
7962
7989
  }
7963
7990
  }
7964
- else if (isTab && keyboardConfig && keyboardOpts.isTab) {
7991
+ else if (isTab && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isTab) {
7965
7992
  // 如果按下了 Tab 键切换
7966
7993
  if (selectRow || actived.row) {
7967
7994
  const activeRow = selectRow || actived.row;
@@ -8011,7 +8038,7 @@ const tableMethods = {
8011
8038
  }
8012
8039
  }
8013
8040
  }
8014
- else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8041
+ else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8015
8042
  // 如果是删除键
8016
8043
  if (!isEditStatus) {
8017
8044
  const { delMethod } = keyboardOpts;
@@ -8042,7 +8069,7 @@ const tableMethods = {
8042
8069
  }
8043
8070
  }
8044
8071
  }
8045
- else if (hasBackspaceKey && keyboardConfig && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8072
+ else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8046
8073
  if (!isEditStatus) {
8047
8074
  const { backMethod } = keyboardOpts;
8048
8075
  // 如果是删除键
@@ -8075,7 +8102,7 @@ const tableMethods = {
8075
8102
  }
8076
8103
  }
8077
8104
  }
8078
- else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
8105
+ else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
8079
8106
  // 如果树形表格回退键关闭当前行返回父节点
8080
8107
  const { parent: parentRow } = XEUtils.findTree(internalData.afterTreeFullData, item => item === currentRow, { children: childrenField });
8081
8108
  if (parentRow) {
@@ -8093,7 +8120,7 @@ const tableMethods = {
8093
8120
  .then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
8094
8121
  }
8095
8122
  }
8096
- else if (keyboardConfig && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
8123
+ else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
8097
8124
  if (isY || (hasShiftKey && isZ)) {
8098
8125
  // 恢复被撤销的操作:Ctrl + Y 或 Ctrl + Shift + Z
8099
8126
  evnt.preventDefault();
@@ -8105,7 +8132,7 @@ const tableMethods = {
8105
8132
  $xeTable.handleUndoStackEvent(evnt);
8106
8133
  }
8107
8134
  }
8108
- else if (keyboardConfig && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
8135
+ else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
8109
8136
  const { editMode, editMethod } = keyboardOpts;
8110
8137
  // 启用编辑后,空格键功能将失效
8111
8138
  // if (isSpacebar) {
@@ -8161,7 +8188,7 @@ const tableMethods = {
8161
8188
  const { actived } = editStore;
8162
8189
  if (isActivated && !filterStore.visible) {
8163
8190
  if (!(actived.row || actived.column)) {
8164
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
8191
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
8165
8192
  $xeTable.handlePeClAreaEvent(evnt);
8166
8193
  }
8167
8194
  }
@@ -8181,7 +8208,7 @@ const tableMethods = {
8181
8208
  const { actived } = editStore;
8182
8209
  if (isActivated && !filterStore.visible) {
8183
8210
  if (!(actived.row || actived.column)) {
8184
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
8211
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
8185
8212
  $xeTable.handleCyClAreaEvent(evnt);
8186
8213
  }
8187
8214
  }
@@ -8201,7 +8228,7 @@ const tableMethods = {
8201
8228
  const { actived } = editStore;
8202
8229
  if (isActivated && !filterStore.visible) {
8203
8230
  if (!(actived.row || actived.column)) {
8204
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
8231
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
8205
8232
  $xeTable.handleCutCellAreaEvent(evnt);
8206
8233
  }
8207
8234
  }
@@ -9645,7 +9672,7 @@ const tableMethods = {
9645
9672
  const internalData = $xeTable;
9646
9673
  const { mouseConfig } = props;
9647
9674
  const mouseOpts = $xeTable.computeMouseOpts;
9648
- const isMouseSelected = mouseConfig && mouseOpts.selected;
9675
+ const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected;
9649
9676
  const column = handleFieldOrColumn($xeTable, fieldOrColumn);
9650
9677
  if (column) {
9651
9678
  $xeTable.clearCurrentColumn();
@@ -9859,7 +9886,7 @@ const tableMethods = {
9859
9886
  const { field, sortable, order } = column;
9860
9887
  if (sortable) {
9861
9888
  const params = { $table: $xeTable, $event: evnt, column, field, property: field, order, sortList: $xeTable.getSortColumns(), sortTime: column.sortTime };
9862
- if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
9889
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleSortEvent) {
9863
9890
  $xeTable.handleSortEvent(evnt, params);
9864
9891
  }
9865
9892
  if (!order) {
@@ -9941,7 +9968,7 @@ const tableMethods = {
9941
9968
  $xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
9942
9969
  }
9943
9970
  }
9944
- if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
9971
+ if (!triggerDrag && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
9945
9972
  $xeTable.handleHeaderCellAreaMouseDnEvent(evnt, Object.assign({ cell, triggerSort, triggerFilter }, params));
9946
9973
  }
9947
9974
  $xeTable.focus();
@@ -10723,6 +10750,7 @@ const tableMethods = {
10723
10750
  const internalData = $xeTable;
10724
10751
  const { mouseConfig } = props;
10725
10752
  const columnDragOpts = $xeTable.computeColumnDragOpts;
10753
+ const mouseOpts = $xeTable.computeMouseOpts;
10726
10754
  const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
10727
10755
  const { collectColumn, fullColumnIdData } = internalData;
10728
10756
  const el = $xeTable.$refs.refElem;
@@ -10885,7 +10913,7 @@ const tableMethods = {
10885
10913
  }
10886
10914
  });
10887
10915
  $xeTable.handleClearStack();
10888
- if (mouseConfig) {
10916
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
10889
10917
  if ($xeTable.clearSelected) {
10890
10918
  $xeTable.clearSelected();
10891
10919
  }
@@ -13100,7 +13128,7 @@ const tableMethods = {
13100
13128
  */
13101
13129
  scrollToColumn(fieldOrColumn, options) {
13102
13130
  const $xeTable = this;
13103
- return handleScrollToRowColumn($xeTable, null, fieldOrColumn, options);
13131
+ return handleScrollToRowColumn($xeTable, fieldOrColumn, null, options);
13104
13132
  },
13105
13133
  /**
13106
13134
  * 如果有滚动条,则滚动到第一列
@@ -13490,7 +13518,7 @@ const tableMethods = {
13490
13518
  const props = $xeTable;
13491
13519
  const { mouseConfig } = props;
13492
13520
  const mouseOpts = $xeTable.computeMouseOpts;
13493
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
13521
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
13494
13522
  return $xeTable.handleRecalculateCellAreaEvent();
13495
13523
  }
13496
13524
  return $xeTable.$nextTick();
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils';
2
- import { getFuncText, isEnableConf } from '../../ui/src/utils';
2
+ import { getFuncText, hasEnableConf, isEnableConf } from '../../ui/src/utils';
3
3
  import { initTpImg, toCssUnit } from '../../ui/src/dom';
4
4
  import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util';
5
5
  import { VxeUI } from '../../ui';
@@ -1600,7 +1600,7 @@ export default {
1600
1600
  const internalData = $xeTable;
1601
1601
  XEUtils.assign(internalData, createInternalData());
1602
1602
  handleKeyField($xeTable);
1603
- const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource } = props;
1603
+ const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource, areaConfig } = props;
1604
1604
  const { scrollXStore, scrollYStore } = internalData;
1605
1605
  const columnOpts = $xeTable.computeColumnOpts;
1606
1606
  const columnDragOpts = $xeTable.computeColumnDragOpts;
@@ -1699,13 +1699,13 @@ export default {
1699
1699
  // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
1700
1700
  // }
1701
1701
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
1702
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1702
+ if (hasEnableConf(importConfig, importOpts) && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1703
1703
  warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')]);
1704
1704
  }
1705
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1705
+ if (hasEnableConf(exportConfig, exportOpts) && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1706
1706
  warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)).join(',') || XEUtils.keys(exportOpts._typeMaps).join(',')]);
1707
1707
  }
1708
- if (exportConfig && XEUtils.isBoolean(exportOpts.isAllExpand)) {
1708
+ if (hasEnableConf(exportConfig, exportOpts) && XEUtils.isBoolean(exportOpts.isAllExpand)) {
1709
1709
  warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
1710
1710
  }
1711
1711
  if (!props.id) {
@@ -1719,8 +1719,8 @@ export default {
1719
1719
  if (rowOpts.height && !this.showOverflow) {
1720
1720
  warnLog('vxe.error.notProp', ['table.show-overflow']);
1721
1721
  }
1722
- if (!$xeTable.triggerClAreaMnEvent) {
1723
- if (props.areaConfig) {
1722
+ if (!$xeTable.triggerClAaMnEvent) {
1723
+ if (hasEnableConf(areaConfig, areaOpts)) {
1724
1724
  warnLog('vxe.error.notProp', ['area-config']);
1725
1725
  }
1726
1726
  if (props.clipConfig) {
@@ -1837,10 +1837,10 @@ export default {
1837
1837
  if (columnOpts.currentMethod) {
1838
1838
  warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod']);
1839
1839
  }
1840
- // if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1840
+ // if ((rowOpts.isCurrent || highlightCurrentRow) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1841
1841
  // warnLog('vxe.error.notConflictProp', ['row-config.isCurrent & keyboard-config.isArrow', 'current-row-config.isFollowSelected'])
1842
1842
  // }
1843
- // if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1843
+ // if ((columnOpts.isCurrent || highlightCurrentColumn) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1844
1844
  // warnLog('vxe.error.notConflictProp', ['column-config.isCurrent & keyboard-config.isArrow', 'current-column-config.isFollowSelected'])
1845
1845
  // }
1846
1846
  // 如果不支持虚拟滚动
@@ -1858,18 +1858,18 @@ export default {
1858
1858
  // }
1859
1859
  // }
1860
1860
  // 检查是否有安装需要的模块
1861
- if (props.editConfig && !$xeTable.insert) {
1862
- errLog('vxe.error.reqModule', ['Edit']);
1863
- }
1864
- if (props.editRules && !$xeTable.validate) {
1865
- errLog('vxe.error.reqModule', ['Validator']);
1866
- }
1867
- if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
1868
- errLog('vxe.error.reqModule', ['Keyboard']);
1869
- }
1870
- if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
1871
- errLog('vxe.error.reqModule', ['Export']);
1872
- }
1861
+ // if (props.editConfig && !$xeTable.insert) {
1862
+ // errLog('vxe.error.reqModule', ['Edit'])
1863
+ // }
1864
+ // if (props.editRules && !$xeTable.validate) {
1865
+ // errLog('vxe.error.reqModule', ['Validator'])
1866
+ // }
1867
+ // if ((checkboxOpts.range || hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts)) && !$xeTable.handleCellMousedownEvent) {
1868
+ // errLog('vxe.error.reqModule', ['Keyboard'])
1869
+ // }
1870
+ // if ((hasEnableConf(printConfig, printOpts) || hasEnableConf(importConfig, importOpts) || hasEnableConf(exportConfig, exportOpts)) && !$xeTable.exportData) {
1871
+ // errLog('vxe.error.reqModule', ['Export'])
1872
+ // }
1873
1873
  Object.assign(scrollYStore, {
1874
1874
  startIndex: 0,
1875
1875
  endIndex: 1,
@@ -1982,7 +1982,7 @@ export default {
1982
1982
  if (this.autoResize) {
1983
1983
  const resizeObserver = globalResize.create(() => {
1984
1984
  if (this.autoResize) {
1985
- this.handleResizeEvent();
1985
+ this.layoutReFlag++;
1986
1986
  }
1987
1987
  });
1988
1988
  resizeObserver.observe(this.$el);
@@ -2073,7 +2073,7 @@ export default {
2073
2073
  const slots = $xeTable.$scopedSlots;
2074
2074
  const reactData = $xeTable;
2075
2075
  const { xID } = $xeTable;
2076
- const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
2076
+ const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props;
2077
2077
  const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData;
2078
2078
  const { leftList, rightList } = columnStore;
2079
2079
  const loadingSlot = slots.loading;
@@ -2100,10 +2100,13 @@ export default {
2100
2100
  const isContentMenu = $xeTable.computeIsContentMenu;
2101
2101
  const currLoading = reactData.isColLoading || reactData.isRowLoading || loading;
2102
2102
  const resizableOpts = $xeTable.computeResizableOpts;
2103
- const isArea = mouseConfig && mouseOpts.area;
2103
+ const isArea = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area;
2104
2104
  const columnDragOpts = $xeTable.computeColumnDragOpts;
2105
2105
  const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
2106
2106
  const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
2107
+ const exportOpts = $xeTable.computeExportOpts;
2108
+ const importOpts = $xeTable.computeImportOpts;
2109
+ const printOpts = $xeTable.computePrintOpts;
2107
2110
  const { isCrossTableDrag } = rowDragOpts;
2108
2111
  const tbOns = {
2109
2112
  contextmenu: this.contextMenuEvent,
@@ -2120,7 +2123,7 @@ export default {
2120
2123
  'vxe-editable': !!editConfig,
2121
2124
  'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
2122
2125
  'cell--highlight': highlightCell,
2123
- 'cell--selected': mouseConfig && mouseOpts.selected,
2126
+ 'cell--selected': hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected,
2124
2127
  'cell--area': isArea,
2125
2128
  'header-cell--area': isArea && areaOpts.selectCellByHeader,
2126
2129
  'body-cell--area': isArea && areaOpts.selectCellByBody,
@@ -2336,7 +2339,7 @@ export default {
2336
2339
  /**
2337
2340
  * 导入
2338
2341
  */
2339
- initStore.import && this.importConfig
2342
+ initStore.import && hasEnableConf(importConfig, importOpts)
2340
2343
  ? h(TableImportPanelComponent, {
2341
2344
  key: 'it',
2342
2345
  props: {
@@ -2348,7 +2351,7 @@ export default {
2348
2351
  /**
2349
2352
  * 导出
2350
2353
  */
2351
- initStore.export && (this.exportConfig || this.printConfig)
2354
+ initStore.export && (hasEnableConf(exportConfig, exportOpts) || hasEnableConf(printConfig, printOpts))
2352
2355
  ? h(TableExportPanelComponent, {
2353
2356
  key: 'et',
2354
2357
  props: {
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils';
2
2
  import { ColumnInfo } from './columnInfo';
3
3
  import { isScale, isPx, queryElement } from '../../ui/src/dom';
4
4
  import { createComponentLog } from '../../ui/src/log';
5
- import { eqEmptyValue } from '../../ui/src/utils';
5
+ import { eqEmptyValue, hasEnableConf } from '../../ui/src/utils';
6
6
  const { warnLog, errLog } = createComponentLog('table');
7
7
  export function createInternalData() {
8
8
  return {
@@ -872,6 +872,9 @@ export function getRefElem(refEl) {
872
872
  export function clearTableDefaultStatus($xeTable) {
873
873
  const props = $xeTable;
874
874
  const internalData = $xeTable;
875
+ const { keyboardConfig, mouseConfig } = props;
876
+ const mouseOpts = $xeTable.computeMouseOpts;
877
+ const keyboardOpts = $xeTable.computeKeyboardOpts;
875
878
  internalData.initStatus = false;
876
879
  const actionList = [
877
880
  $xeTable.clearSort(),
@@ -889,10 +892,10 @@ export function clearTableDefaultStatus($xeTable) {
889
892
  if ($xeTable.clearFilter) {
890
893
  actionList.push($xeTable.clearFilter());
891
894
  }
892
- if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
895
+ if ($xeTable.clearSelected && (hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts))) {
893
896
  actionList.push($xeTable.clearSelected());
894
897
  }
895
- if ($xeTable.clearCellAreas && props.mouseConfig) {
898
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
896
899
  actionList.push($xeTable.clearCellAreas(), $xeTable.clearCopyCellArea());
897
900
  }
898
901
  return Promise.all(actionList).then(() => {
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.24.3";
3
+ export const version = "3.25.0-beta.0";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const tableVersion = `table v${"3.24.3"}`;
3
+ const tableVersion = `table v${"3.25.0-beta.0"}`;
4
4
  export function createComponentLog(name) {
5
5
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
6
6
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -5,6 +5,15 @@ const { getConfig } = VxeUI;
5
5
  export function isEnableConf(conf) {
6
6
  return conf && conf.enabled !== false;
7
7
  }
8
+ /**
9
+ * 用于开关类型的配置项
10
+ * 局部启用规则:conf={}
11
+ * 局部禁用规则:conf={enabled:false}
12
+ * 全局默认启用规则:conf.enabled=true
13
+ */
14
+ export function hasEnableConf(conf, opts) {
15
+ return opts && (conf ? opts.enabled !== false : opts.enabled);
16
+ }
8
17
  export function isEmptyValue(cellValue) {
9
18
  return cellValue === null || cellValue === undefined || cellValue === '';
10
19
  }