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'
@@ -1320,7 +1320,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1320
1320
  if (currentRow) {
1321
1321
  $xeTable.setCurrentRow(currentRow)
1322
1322
  }
1323
- if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
1323
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
1324
1324
  $xeTable.addCellSelectedClass()
1325
1325
  }
1326
1326
  if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
@@ -3601,12 +3601,13 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
3601
3601
  const reactData = $xeTable as unknown as TableReactData
3602
3602
  const internalData = $xeTable as unknown as TableInternalData
3603
3603
 
3604
- const { keepSource, treeConfig, aggregateConfig, rowGroupConfig } = props
3604
+ const { keepSource, treeConfig, rowGroupConfig, aggregateConfig, mouseConfig } = props
3605
3605
  const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData
3606
3606
  const { initStatus, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
3607
3607
  const rowOpts = $xeTable.computeRowOpts
3608
3608
  const treeOpts = $xeTable.computeTreeOpts
3609
3609
  const expandOpts = $xeTable.computeExpandOpts
3610
+ const mouseOpts = $xeTable.computeMouseOpts
3610
3611
  const { transform } = treeOpts
3611
3612
  const childrenField = treeOpts.children || treeOpts.childrenField
3612
3613
  let treeData = []
@@ -3694,7 +3695,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
3694
3695
  if (keepSource) {
3695
3696
  $xeTable.cacheSourceMap(fullData)
3696
3697
  }
3697
- if ($xeTable.clearCellAreas && props.mouseConfig) {
3698
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
3698
3699
  $xeTable.clearCellAreas()
3699
3700
  $xeTable.clearCopyCellArea()
3700
3701
  }
@@ -4885,10 +4886,25 @@ const tableMethods: any = {
4885
4886
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
4886
4887
  const $xeGrid = $xeTable.$xeGrid
4887
4888
  const $xeGantt = $xeTable.$xeGantt
4888
- const $xeGGWrapper = $xeGrid || $xeGantt
4889
4889
 
4890
- const { $el } = this
4891
- return $xeGGWrapper ? $xeGGWrapper.$el.parentNode : $el.parentNode
4890
+ const el = $xeTable.$refs.refElem as HTMLDivElement
4891
+ if (!el) {
4892
+ return null
4893
+ }
4894
+ const parentEl = el.parentElement
4895
+ if (!parentEl) {
4896
+ return null
4897
+ }
4898
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
4899
+ return $xeGantt.getParentElem()
4900
+ } else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
4901
+ return $xeGrid.getParentElem()
4902
+ }
4903
+ // 如果是虚拟滚动条
4904
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
4905
+ return parentEl.parentElement
4906
+ }
4907
+ return parentEl
4892
4908
  },
4893
4909
  /**
4894
4910
  * 获取父容器的高度
@@ -4901,22 +4917,30 @@ const tableMethods: any = {
4901
4917
 
4902
4918
  const { height } = props
4903
4919
  const el = $xeTable.$refs.refElem as HTMLDivElement
4904
- if (el) {
4905
- const parentElem = el.parentNode as HTMLElement
4906
- const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
4907
- let parentWrapperHeight = 0
4908
- if (parentElem) {
4909
- if ($xeGantt && hasClass(parentElem, 'vxe-gantt--table-wrapper')) {
4910
- parentWrapperHeight = $xeGantt.getParentHeight()
4911
- } else if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
4912
- parentWrapperHeight = $xeGrid.getParentHeight()
4913
- } else {
4914
- parentWrapperHeight = parentElem.clientHeight
4915
- }
4920
+ if (!el) {
4921
+ return 0
4922
+ }
4923
+ let parentEl = el.parentElement
4924
+ let parentPaddingSize = 0
4925
+ let parentWrapperHeight = 0
4926
+ if (!parentEl) {
4927
+ return 0
4928
+ }
4929
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
4930
+ parentWrapperHeight = $xeGantt.getParentHeight()
4931
+ } else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
4932
+ parentWrapperHeight = $xeGrid.getParentHeight()
4933
+ } else {
4934
+ // 如果是虚拟滚动条
4935
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
4936
+ parentEl = parentEl.parentElement
4937
+ }
4938
+ if (parentEl) {
4939
+ parentWrapperHeight = parentEl.clientHeight
4940
+ parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentEl) : 0
4916
4941
  }
4917
- return Math.floor(parentWrapperHeight - parentPaddingSize)
4918
4942
  }
4919
- return 0
4943
+ return Math.floor(parentWrapperHeight - parentPaddingSize)
4920
4944
  },
4921
4945
  /**
4922
4946
  * 获取需要排除的高度
@@ -6716,7 +6740,8 @@ const tableMethods: any = {
6716
6740
  const props = $xeTable
6717
6741
 
6718
6742
  const { mouseConfig } = props
6719
- if (mouseConfig) {
6743
+ const mouseOpts = $xeTable.computeMouseOpts
6744
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
6720
6745
  if ($xeTable.clearSelected) {
6721
6746
  $xeTable.clearSelected()
6722
6747
  }
@@ -7812,6 +7837,7 @@ const tableMethods: any = {
7812
7837
  const editOpts = $xeTable.computeEditOpts
7813
7838
  const validOpts = $xeTable.computeValidOpts
7814
7839
  const areaOpts = $xeTable.computeAreaOpts
7840
+ const mouseOpts = $xeTable.computeMouseOpts
7815
7841
  const { actived } = editStore
7816
7842
  const tableFilter = $xeTable.$refs.refTableFilter as Vue
7817
7843
  const tableMenu = $xeTable.$refs.refTableMenu as Vue
@@ -7903,7 +7929,7 @@ const tableMethods: any = {
7903
7929
  }
7904
7930
  }
7905
7931
  }
7906
- } else if (mouseConfig) {
7932
+ } else if (hasEnableConf(mouseConfig, mouseOpts)) {
7907
7933
  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)) {
7908
7934
  if ($xeTable.clearSelected) {
7909
7935
  $xeTable.clearSelected()
@@ -7984,20 +8010,20 @@ const tableMethods: any = {
7984
8010
  if (isEsc) {
7985
8011
  $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
7986
8012
  $xeTable.dispatchEvent('keydown-start', {}, evnt)
7987
- if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8013
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
7988
8014
  $xeTable.handleKdClAreaEvent(evnt)
7989
8015
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
7990
8016
  evnt.stopPropagation()
7991
8017
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
7992
8018
  $xeTable.closeFilter()
7993
8019
  $xeTable.closeMenu()
7994
- if (keyboardConfig && keyboardOpts.isEsc) {
8020
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
7995
8021
  // 如果是激活编辑状态,则取消编辑
7996
8022
  if (actived.row) {
7997
8023
  const params = actived.args
7998
8024
  $xeTable.handleClearEdit(evnt)
7999
8025
  // 如果配置了选中功能,则为选中状态
8000
- if (mouseConfig && mouseOpts.selected) {
8026
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
8001
8027
  $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt))
8002
8028
  }
8003
8029
  }
@@ -8075,7 +8101,7 @@ const tableMethods: any = {
8075
8101
  } else {
8076
8102
  $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList)
8077
8103
  }
8078
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8104
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8079
8105
  $xeTable.handleKdClAreaEvent(evnt)
8080
8106
  } else if (isEsc) {
8081
8107
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
@@ -8083,7 +8109,7 @@ const tableMethods: any = {
8083
8109
  $xeTable.closeMenu()
8084
8110
  }
8085
8111
  $xeTable.closeFilter()
8086
- if (keyboardConfig && keyboardOpts.isEsc) {
8112
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
8087
8113
  // 如果是激活编辑状态,则取消编辑
8088
8114
  if (actived.row) {
8089
8115
  const params = actived.args
@@ -8094,7 +8120,7 @@ const tableMethods: any = {
8094
8120
  }
8095
8121
  }
8096
8122
  }
8097
- } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
8123
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && isSpacebar && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
8098
8124
  // 空格键支持选中复选框
8099
8125
  evnt.preventDefault()
8100
8126
  if (selectColumn.type === 'checkbox') {
@@ -8117,7 +8143,7 @@ const tableMethods: any = {
8117
8143
  internalData.keyCtxTimeout = setTimeout(() => {
8118
8144
  internalData._keyCtx = false
8119
8145
  }, 1000)
8120
- } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
8146
+ } else if (isEnter && !hasAltKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
8121
8147
  // 退出选中
8122
8148
  if (isControlKey) {
8123
8149
  // 如果是激活编辑状态,则取消编辑
@@ -8125,7 +8151,7 @@ const tableMethods: any = {
8125
8151
  const params = actived.args
8126
8152
  $xeTable.handleClearEdit(evnt)
8127
8153
  // 如果配置了选中功能,则为选中状态
8128
- if (mouseConfig && mouseOpts.selected) {
8154
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
8129
8155
  $xeTable.$nextTick(() => $xeTable.handleSelected(params, evnt))
8130
8156
  }
8131
8157
  }
@@ -8235,7 +8261,7 @@ const tableMethods: any = {
8235
8261
  }
8236
8262
  }
8237
8263
  }
8238
- } else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
8264
+ } else if (operArrow && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow) {
8239
8265
  if (!isEditStatus) {
8240
8266
  // 如果按下了方向键
8241
8267
  if (mouseOpts.selected && selectRow && selectColumn) {
@@ -8251,7 +8277,7 @@ const tableMethods: any = {
8251
8277
  }
8252
8278
  }
8253
8279
  }
8254
- } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
8280
+ } else if (isTab && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isTab) {
8255
8281
  // 如果按下了 Tab 键切换
8256
8282
  if (selectRow || actived.row) {
8257
8283
  const activeRow = selectRow || actived.row
@@ -8299,7 +8325,7 @@ const tableMethods: any = {
8299
8325
  }
8300
8326
  }
8301
8327
  }
8302
- } else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8328
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8303
8329
  // 如果是删除键
8304
8330
  if (!isEditStatus) {
8305
8331
  const { delMethod } = keyboardOpts
@@ -8328,7 +8354,7 @@ const tableMethods: any = {
8328
8354
  $xeTable.dispatchEvent('cell-delete-value', params, evnt)
8329
8355
  }
8330
8356
  }
8331
- } else if (hasBackspaceKey && keyboardConfig && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8357
+ } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8332
8358
  if (!isEditStatus) {
8333
8359
  const { backMethod } = keyboardOpts
8334
8360
  // 如果是删除键
@@ -8359,7 +8385,7 @@ const tableMethods: any = {
8359
8385
  }
8360
8386
  }
8361
8387
  }
8362
- } else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
8388
+ } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
8363
8389
  // 如果树形表格回退键关闭当前行返回父节点
8364
8390
  const { parent: parentRow } = XEUtils.findTree(internalData.afterTreeFullData, item => item === currentRow, { children: childrenField })
8365
8391
  if (parentRow) {
@@ -8376,7 +8402,7 @@ const tableMethods: any = {
8376
8402
  .then(() => $xeTable.scrollToRow(parentRow))
8377
8403
  .then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
8378
8404
  }
8379
- } else if (keyboardConfig && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
8405
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
8380
8406
  if (isY || (hasShiftKey && isZ)) {
8381
8407
  // 恢复被撤销的操作:Ctrl + Y 或 Ctrl + Shift + Z
8382
8408
  evnt.preventDefault()
@@ -8386,7 +8412,7 @@ const tableMethods: any = {
8386
8412
  evnt.preventDefault()
8387
8413
  $xeTable.handleUndoStackEvent(evnt)
8388
8414
  }
8389
- } 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))) {
8415
+ } 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))) {
8390
8416
  const { editMode, editMethod } = keyboardOpts
8391
8417
  // 启用编辑后,空格键功能将失效
8392
8418
  // if (isSpacebar) {
@@ -8442,7 +8468,7 @@ const tableMethods: any = {
8442
8468
  const { actived } = editStore
8443
8469
  if (isActivated && !filterStore.visible) {
8444
8470
  if (!(actived.row || actived.column)) {
8445
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
8471
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
8446
8472
  $xeTable.handlePeClAreaEvent(evnt)
8447
8473
  }
8448
8474
  }
@@ -8463,7 +8489,7 @@ const tableMethods: any = {
8463
8489
  const { actived } = editStore
8464
8490
  if (isActivated && !filterStore.visible) {
8465
8491
  if (!(actived.row || actived.column)) {
8466
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
8492
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
8467
8493
  $xeTable.handleCyClAreaEvent(evnt)
8468
8494
  }
8469
8495
  }
@@ -8484,7 +8510,7 @@ const tableMethods: any = {
8484
8510
  const { actived } = editStore
8485
8511
  if (isActivated && !filterStore.visible) {
8486
8512
  if (!(actived.row || actived.column)) {
8487
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
8513
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
8488
8514
  $xeTable.handleCutCellAreaEvent(evnt)
8489
8515
  }
8490
8516
  }
@@ -9963,7 +9989,7 @@ const tableMethods: any = {
9963
9989
 
9964
9990
  const { mouseConfig } = props
9965
9991
  const mouseOpts = $xeTable.computeMouseOpts
9966
- const isMouseSelected = mouseConfig && mouseOpts.selected
9992
+ const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected
9967
9993
  const column = handleFieldOrColumn($xeTable, fieldOrColumn)
9968
9994
  if (column) {
9969
9995
  $xeTable.clearCurrentColumn()
@@ -10178,7 +10204,7 @@ const tableMethods: any = {
10178
10204
  const { field, sortable, order } = column
10179
10205
  if (sortable) {
10180
10206
  const params = { $table: $xeTable, $event: evnt, column, field, property: field, order, sortList: $xeTable.getSortColumns(), sortTime: column.sortTime }
10181
- if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
10207
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleSortEvent) {
10182
10208
  $xeTable.handleSortEvent(evnt, params)
10183
10209
  }
10184
10210
  if (!order) {
@@ -10265,7 +10291,7 @@ const tableMethods: any = {
10265
10291
  $xeTable.handleHeaderCellDragMousedownEvent(evnt, params)
10266
10292
  }
10267
10293
  }
10268
- if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
10294
+ if (!triggerDrag && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
10269
10295
  $xeTable.handleHeaderCellAreaMouseDnEvent(evnt, Object.assign({ cell, triggerSort, triggerFilter }, params))
10270
10296
  }
10271
10297
  $xeTable.focus()
@@ -11073,6 +11099,7 @@ const tableMethods: any = {
11073
11099
 
11074
11100
  const { mouseConfig } = props
11075
11101
  const columnDragOpts = $xeTable.computeColumnDragOpts
11102
+ const mouseOpts = $xeTable.computeMouseOpts
11076
11103
  const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
11077
11104
  const { collectColumn, fullColumnIdData } = internalData
11078
11105
  const el = $xeTable.$refs.refElem as HTMLDivElement
@@ -11246,7 +11273,7 @@ const tableMethods: any = {
11246
11273
  })
11247
11274
 
11248
11275
  $xeTable.handleClearStack()
11249
- if (mouseConfig) {
11276
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
11250
11277
  if ($xeTable.clearSelected) {
11251
11278
  $xeTable.clearSelected()
11252
11279
  }
@@ -13565,7 +13592,7 @@ const tableMethods: any = {
13565
13592
  scrollToColumn (fieldOrColumn: any, options?: VxeTableDefines.ScrollToColumnConfig) {
13566
13593
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
13567
13594
 
13568
- return handleScrollToRowColumn($xeTable, null, fieldOrColumn, options)
13595
+ return handleScrollToRowColumn($xeTable, fieldOrColumn, null, options)
13569
13596
  },
13570
13597
  /**
13571
13598
  * 如果有滚动条,则滚动到第一列
@@ -13987,7 +14014,7 @@ const tableMethods: any = {
13987
14014
 
13988
14015
  const { mouseConfig } = props
13989
14016
  const mouseOpts = $xeTable.computeMouseOpts
13990
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
14017
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
13991
14018
  return $xeTable.handleRecalculateCellAreaEvent()
13992
14019
  }
13993
14020
  return $xeTable.$nextTick()
@@ -1,6 +1,6 @@
1
1
  import { CreateElement } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
- import { getFuncText, isEnableConf } from '../../ui/src/utils'
3
+ import { getFuncText, hasEnableConf, isEnableConf } from '../../ui/src/utils'
4
4
  import { initTpImg, toCssUnit } from '../../ui/src/dom'
5
5
  import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
6
6
  import { VxeUI } from '../../ui'
@@ -1742,7 +1742,7 @@ export default {
1742
1742
 
1743
1743
  handleKeyField($xeTable)
1744
1744
 
1745
- const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource } = props
1745
+ const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource, areaConfig } = props
1746
1746
  const { scrollXStore, scrollYStore } = internalData
1747
1747
  const columnOpts = $xeTable.computeColumnOpts
1748
1748
  const columnDragOpts = $xeTable.computeColumnDragOpts
@@ -1842,13 +1842,13 @@ export default {
1842
1842
  // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
1843
1843
  // }
1844
1844
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
1845
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1845
+ if (hasEnableConf(importConfig, importOpts) && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
1846
1846
  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(',')])
1847
1847
  }
1848
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1848
+ if (hasEnableConf(exportConfig, exportOpts) && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
1849
1849
  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(',')])
1850
1850
  }
1851
- if (exportConfig && XEUtils.isBoolean((exportOpts as any).isAllExpand)) {
1851
+ if (hasEnableConf(exportConfig, exportOpts) && XEUtils.isBoolean((exportOpts as any).isAllExpand)) {
1852
1852
  warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1853
1853
  }
1854
1854
 
@@ -1863,8 +1863,8 @@ export default {
1863
1863
  if (rowOpts.height && !this.showOverflow) {
1864
1864
  warnLog('vxe.error.notProp', ['table.show-overflow'])
1865
1865
  }
1866
- if (!$xeTable.triggerClAreaMnEvent) {
1867
- if (props.areaConfig) {
1866
+ if (!$xeTable.triggerClAaMnEvent) {
1867
+ if (hasEnableConf(areaConfig, areaOpts)) {
1868
1868
  warnLog('vxe.error.notProp', ['area-config'])
1869
1869
  }
1870
1870
  if (props.clipConfig) {
@@ -1984,10 +1984,10 @@ export default {
1984
1984
  if (columnOpts.currentMethod) {
1985
1985
  warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod'])
1986
1986
  }
1987
- // if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1987
+ // if ((rowOpts.isCurrent || highlightCurrentRow) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
1988
1988
  // warnLog('vxe.error.notConflictProp', ['row-config.isCurrent & keyboard-config.isArrow', 'current-row-config.isFollowSelected'])
1989
1989
  // }
1990
- // if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1990
+ // if ((columnOpts.isCurrent || highlightCurrentColumn) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
1991
1991
  // warnLog('vxe.error.notConflictProp', ['column-config.isCurrent & keyboard-config.isArrow', 'current-column-config.isFollowSelected'])
1992
1992
  // }
1993
1993
 
@@ -2007,18 +2007,18 @@ export default {
2007
2007
  // }
2008
2008
 
2009
2009
  // 检查是否有安装需要的模块
2010
- if (props.editConfig && !$xeTable.insert) {
2011
- errLog('vxe.error.reqModule', ['Edit'])
2012
- }
2013
- if (props.editRules && !$xeTable.validate) {
2014
- errLog('vxe.error.reqModule', ['Validator'])
2015
- }
2016
- if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
2017
- errLog('vxe.error.reqModule', ['Keyboard'])
2018
- }
2019
- if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
2020
- errLog('vxe.error.reqModule', ['Export'])
2021
- }
2010
+ // if (props.editConfig && !$xeTable.insert) {
2011
+ // errLog('vxe.error.reqModule', ['Edit'])
2012
+ // }
2013
+ // if (props.editRules && !$xeTable.validate) {
2014
+ // errLog('vxe.error.reqModule', ['Validator'])
2015
+ // }
2016
+ // if ((checkboxOpts.range || hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts)) && !$xeTable.handleCellMousedownEvent) {
2017
+ // errLog('vxe.error.reqModule', ['Keyboard'])
2018
+ // }
2019
+ // if ((hasEnableConf(printConfig, printOpts) || hasEnableConf(importConfig, importOpts) || hasEnableConf(exportConfig, exportOpts)) && !$xeTable.exportData) {
2020
+ // errLog('vxe.error.reqModule', ['Export'])
2021
+ // }
2022
2022
 
2023
2023
  Object.assign(scrollYStore, {
2024
2024
  startIndex: 0,
@@ -2142,7 +2142,7 @@ export default {
2142
2142
  if (this.autoResize) {
2143
2143
  const resizeObserver = globalResize.create(() => {
2144
2144
  if (this.autoResize) {
2145
- this.handleResizeEvent()
2145
+ this.layoutReFlag++
2146
2146
  }
2147
2147
  })
2148
2148
  resizeObserver.observe(this.$el)
@@ -2248,7 +2248,7 @@ export default {
2248
2248
 
2249
2249
  const { xID } = $xeTable
2250
2250
 
2251
- const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
2251
+ const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props
2252
2252
  const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
2253
2253
  const { leftList, rightList } = columnStore
2254
2254
  const loadingSlot = slots.loading
@@ -2275,10 +2275,13 @@ export default {
2275
2275
  const isContentMenu = $xeTable.computeIsContentMenu
2276
2276
  const currLoading = reactData.isColLoading || reactData.isRowLoading || loading
2277
2277
  const resizableOpts = $xeTable.computeResizableOpts
2278
- const isArea = mouseConfig && mouseOpts.area
2278
+ const isArea = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
2279
2279
  const columnDragOpts = $xeTable.computeColumnDragOpts
2280
2280
  const scrollbarXToTop = $xeTable.computeScrollbarXToTop
2281
2281
  const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
2282
+ const exportOpts = $xeTable.computeExportOpts
2283
+ const importOpts = $xeTable.computeImportOpts
2284
+ const printOpts = $xeTable.computePrintOpts
2282
2285
  const { isCrossTableDrag } = rowDragOpts
2283
2286
  const tbOns: {
2284
2287
  contextmenu: (...args: any[]) => void
@@ -2299,7 +2302,7 @@ export default {
2299
2302
  'vxe-editable': !!editConfig,
2300
2303
  'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
2301
2304
  'cell--highlight': highlightCell,
2302
- 'cell--selected': mouseConfig && mouseOpts.selected,
2305
+ 'cell--selected': hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected,
2303
2306
  'cell--area': isArea,
2304
2307
  'header-cell--area': isArea && areaOpts.selectCellByHeader,
2305
2308
  'body-cell--area': isArea && areaOpts.selectCellByBody,
@@ -2515,7 +2518,7 @@ export default {
2515
2518
  /**
2516
2519
  * 导入
2517
2520
  */
2518
- initStore.import && this.importConfig
2521
+ initStore.import && hasEnableConf(importConfig, importOpts)
2519
2522
  ? h(TableImportPanelComponent, {
2520
2523
  key: 'it',
2521
2524
  props: {
@@ -2527,7 +2530,7 @@ export default {
2527
2530
  /**
2528
2531
  * 导出
2529
2532
  */
2530
- initStore.export && (this.exportConfig || this.printConfig)
2533
+ initStore.export && (hasEnableConf(exportConfig, exportOpts) || hasEnableConf(printConfig, printOpts))
2531
2534
  ? h(TableExportPanelComponent, {
2532
2535
  key: 'et',
2533
2536
  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
 
7
7
  import type { VxeTableDefines, VxeTableConstructor, TableReactData, TableInternalData, VxeTablePrivateMethods, VxeTablePropTypes } from '../../../types'
8
8
 
@@ -949,6 +949,9 @@ export function clearTableDefaultStatus ($xeTable: VxeTableConstructor & VxeTabl
949
949
  const props = $xeTable
950
950
  const internalData = $xeTable as unknown as TableInternalData
951
951
 
952
+ const { keyboardConfig, mouseConfig } = props
953
+ const mouseOpts = $xeTable.computeMouseOpts
954
+ const keyboardOpts = $xeTable.computeKeyboardOpts
952
955
  internalData.initStatus = false
953
956
  const actionList = [
954
957
  $xeTable.clearSort(),
@@ -968,12 +971,12 @@ export function clearTableDefaultStatus ($xeTable: VxeTableConstructor & VxeTabl
968
971
  $xeTable.clearFilter()
969
972
  )
970
973
  }
971
- if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
974
+ if ($xeTable.clearSelected && (hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts))) {
972
975
  actionList.push(
973
976
  $xeTable.clearSelected()
974
977
  )
975
978
  }
976
- if ($xeTable.clearCellAreas && props.mouseConfig) {
979
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
977
980
  actionList.push(
978
981
  $xeTable.clearCellAreas(),
979
982
  $xeTable.clearCopyCellArea()
@@ -8,6 +8,16 @@ export function isEnableConf (conf: any): boolean {
8
8
  return conf && conf.enabled !== false
9
9
  }
10
10
 
11
+ /**
12
+ * 用于开关类型的配置项
13
+ * 局部启用规则:conf={}
14
+ * 局部禁用规则:conf={enabled:false}
15
+ * 全局默认启用规则:conf.enabled=true
16
+ */
17
+ export function hasEnableConf (conf: any, opts: any): boolean {
18
+ return opts && (conf ? opts.enabled !== false : opts.enabled)
19
+ }
20
+
11
21
  export function isEmptyValue (cellValue: any) {
12
22
  return cellValue === null || cellValue === undefined || cellValue === ''
13
23
  }