vxe-table 4.22.3 → 4.23.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 (71) hide show
  1. package/dist/all.esm.js +219 -154
  2. package/dist/style.css +1 -1
  3. package/es/grid/src/grid.js +24 -7
  4. package/es/style.css +1 -1
  5. package/es/table/module/custom/panel.js +4 -3
  6. package/es/table/module/edit/hook.js +5 -4
  7. package/es/table/module/export/hook.js +6 -4
  8. package/es/table/module/filter/hook.js +2 -2
  9. package/es/table/module/keyboard/hook.js +4 -3
  10. package/es/table/module/menu/hook.js +3 -3
  11. package/es/table/render/index.js +7 -4
  12. package/es/table/src/body.js +4 -4
  13. package/es/table/src/header.js +4 -3
  14. package/es/table/src/table.js +91 -64
  15. package/es/table/src/util.js +7 -3
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/log.js +1 -1
  18. package/es/ui/src/utils.js +9 -0
  19. package/lib/grid/src/grid.js +26 -6
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/index.umd.js +214 -156
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/style.css +1 -1
  24. package/lib/table/module/custom/panel.js +3 -1
  25. package/lib/table/module/custom/panel.min.js +1 -1
  26. package/lib/table/module/edit/hook.js +4 -3
  27. package/lib/table/module/edit/hook.min.js +1 -1
  28. package/lib/table/module/export/hook.js +9 -3
  29. package/lib/table/module/export/hook.min.js +1 -1
  30. package/lib/table/module/filter/hook.js +1 -1
  31. package/lib/table/module/filter/hook.min.js +1 -1
  32. package/lib/table/module/keyboard/hook.js +4 -3
  33. package/lib/table/module/keyboard/hook.min.js +1 -1
  34. package/lib/table/module/menu/hook.js +2 -2
  35. package/lib/table/module/menu/hook.min.js +1 -1
  36. package/lib/table/render/index.js +11 -5
  37. package/lib/table/render/index.min.js +1 -1
  38. package/lib/table/src/body.js +3 -3
  39. package/lib/table/src/body.min.js +1 -1
  40. package/lib/table/src/header.js +3 -2
  41. package/lib/table/src/header.min.js +1 -1
  42. package/lib/table/src/table.js +39 -37
  43. package/lib/table/src/table.min.js +1 -1
  44. package/lib/table/src/util.js +12 -2
  45. package/lib/table/src/util.min.js +1 -1
  46. package/lib/ui/index.js +1 -1
  47. package/lib/ui/index.min.js +1 -1
  48. package/lib/ui/src/log.js +1 -1
  49. package/lib/ui/src/log.min.js +1 -1
  50. package/lib/ui/src/utils.js +10 -0
  51. package/lib/ui/src/utils.min.js +1 -1
  52. package/package.json +2 -2
  53. package/packages/grid/src/grid.ts +25 -7
  54. package/packages/table/module/custom/panel.ts +4 -3
  55. package/packages/table/module/edit/hook.ts +5 -4
  56. package/packages/table/module/export/hook.ts +6 -4
  57. package/packages/table/module/filter/hook.ts +2 -2
  58. package/packages/table/module/keyboard/hook.ts +4 -3
  59. package/packages/table/module/menu/hook.ts +3 -3
  60. package/packages/table/render/index.ts +7 -4
  61. package/packages/table/src/body.ts +4 -4
  62. package/packages/table/src/header.ts +4 -3
  63. package/packages/table/src/table.ts +88 -62
  64. package/packages/table/src/util.ts +7 -3
  65. package/packages/ui/src/utils.ts +10 -0
  66. /package/es/{iconfont.1790757600308.ttf → iconfont.1791880428511.ttf} +0 -0
  67. /package/es/{iconfont.1790757600308.woff → iconfont.1791880428511.woff} +0 -0
  68. /package/es/{iconfont.1790757600308.woff2 → iconfont.1791880428511.woff2} +0 -0
  69. /package/lib/{iconfont.1790757600308.ttf → iconfont.1791880428511.ttf} +0 -0
  70. /package/lib/{iconfont.1790757600308.woff → iconfont.1791880428511.woff} +0 -0
  71. /package/lib/{iconfont.1790757600308.woff2 → iconfont.1791880428511.woff2} +0 -0
@@ -2,7 +2,7 @@ import { h, ref, Ref, PropType, inject, nextTick, watch, onMounted, onUnmounted
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils from 'xe-utils'
4
4
  import { VxeUI } from '../../ui'
5
- import { getDefaultConfig, isEnableConf } from '../../ui/src/utils'
5
+ import { getDefaultConfig, hasEnableConf, isEnableConf } from '../../ui/src/utils'
6
6
  import { getCalcHeight, convertHeaderColumnToRows, convertHeaderToGridRows } from './util'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
@@ -74,6 +74,7 @@ export default defineVxeComponent({
74
74
  const defaultRowHeight = computeDefaultRowHeight.value
75
75
  const headerCellOpts = computeHeaderCellOpts.value
76
76
  const rendererOpts = computeRendererOpts.value
77
+ const mouseOpts = computeMouseOpts.value
77
78
  const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight
78
79
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts
79
80
  const isLastRow = _rowIndex === headerGroups.length - 1
@@ -165,7 +166,7 @@ export default defineVxeComponent({
165
166
  isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams))
166
167
  }
167
168
  // 按下事件处理
168
- if (mouseConfig || isColDragCell) {
169
+ if (hasEnableConf(mouseConfig, mouseOpts) || isColDragCell) {
169
170
  thOns.onMousedown = (evnt: MouseEvent) => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams)
170
171
  }
171
172
  // 拖拽列事件
@@ -513,7 +514,7 @@ export default defineVxeComponent({
513
514
  ref: refHeaderTHead
514
515
  }, renderHeads(isGroup, isOptimizeMode, renderHeaderList, renderColumnList))
515
516
  ]),
516
- mouseConfig && mouseOpts.area
517
+ hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
517
518
  ? h('div', {
518
519
  class: 'vxe-table--cell-area',
519
520
  xid: xID
@@ -2,7 +2,7 @@ import { h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTi
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils from 'xe-utils'
4
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom'
5
- import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
5
+ import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf } from '../../ui/src/utils'
6
6
  import { VxeUI } from '../../ui'
7
7
  import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util'
8
8
  import { getSlotVNs } from '../../ui/src/vn'
@@ -2873,7 +2873,7 @@ export default defineVxeComponent({
2873
2873
  if (currentRow) {
2874
2874
  $xeTable.setCurrentRow(currentRow)
2875
2875
  }
2876
- if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
2876
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
2877
2877
  $xeTable.addCellSelectedClass()
2878
2878
  }
2879
2879
  if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
@@ -3904,12 +3904,13 @@ export default defineVxeComponent({
3904
3904
  * @param {Array} datas 数据
3905
3905
  */
3906
3906
  const loadTableData = (datas: any[], isReload: boolean, isReset: boolean) => {
3907
- const { keepSource, treeConfig, rowGroupConfig, aggregateConfig } = props
3907
+ const { keepSource, treeConfig, rowGroupConfig, aggregateConfig, mouseConfig } = props
3908
3908
  const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData
3909
3909
  const { initStatus, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
3910
3910
  const rowOpts = computeRowOpts.value
3911
3911
  const treeOpts = computeTreeOpts.value
3912
3912
  const expandOpts = computeExpandOpts.value
3913
+ const mouseOpts = computeMouseOpts.value
3913
3914
  const { transform } = treeOpts
3914
3915
  const childrenField = treeOpts.children || treeOpts.childrenField
3915
3916
  let treeData = []
@@ -3997,7 +3998,7 @@ export default defineVxeComponent({
3997
3998
  if (keepSource) {
3998
3999
  $xeTable.cacheSourceMap(fullData)
3999
4000
  }
4000
- if ($xeTable.clearCellAreas && props.mouseConfig) {
4001
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
4001
4002
  $xeTable.clearCellAreas()
4002
4003
  $xeTable.clearCopyCellArea()
4003
4004
  }
@@ -6956,7 +6957,7 @@ export default defineVxeComponent({
6956
6957
  setCurrentColumn (fieldOrColumn) {
6957
6958
  const { mouseConfig } = props
6958
6959
  const mouseOpts = computeMouseOpts.value
6959
- const isMouseSelected = mouseConfig && mouseOpts.selected
6960
+ const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected
6960
6961
  const column = handleFieldOrColumn($xeTable, fieldOrColumn)
6961
6962
  if (column) {
6962
6963
  $xeTable.clearCurrentColumn()
@@ -8205,7 +8206,7 @@ export default defineVxeComponent({
8205
8206
  updateCellAreas () {
8206
8207
  const { mouseConfig } = props
8207
8208
  const mouseOpts = computeMouseOpts.value
8208
- if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
8209
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleRecalculateCellAreaEvent) {
8209
8210
  return $xeTable.handleRecalculateCellAreaEvent()
8210
8211
  }
8211
8212
  return nextTick()
@@ -8465,6 +8466,7 @@ export default defineVxeComponent({
8465
8466
  const editOpts = computeEditOpts.value
8466
8467
  const validOpts = computeValidOpts.value
8467
8468
  const areaOpts = computeAreaOpts.value
8469
+ const mouseOpts = computeMouseOpts.value
8468
8470
  const { actived } = editStore
8469
8471
  const $validTooltip = refValidTooltip.value
8470
8472
  const tableFilter = refTableFilter.value
@@ -8557,7 +8559,7 @@ export default defineVxeComponent({
8557
8559
  }
8558
8560
  }
8559
8561
  }
8560
- } else if (mouseConfig) {
8562
+ } else if (hasEnableConf(mouseConfig, mouseOpts)) {
8561
8563
  if (!getEventTargetNode(evnt, el).flag && !($xeGGWrapper && getEventTargetNode(evnt, $xeGGWrapper.getRefMaps().refElem.value).flag) && !(tableMenu && getEventTargetNode(evnt, tableMenu.getRefMaps().refElem.value).flag) && !($xeToolbar && getEventTargetNode(evnt, $xeToolbar.getRefMaps().refElem.value).flag)) {
8562
8564
  if ($xeTable.clearSelected) {
8563
8565
  $xeTable.clearSelected()
@@ -8649,7 +8651,7 @@ export default defineVxeComponent({
8649
8651
  if (isEsc) {
8650
8652
  $xeTable.preventEvent(evnt, 'event.keydown', null, () => {
8651
8653
  dispatchEvent('keydown-start', {}, evnt)
8652
- if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8654
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8653
8655
  $xeTable.handleKdClAreaEvent(evnt)
8654
8656
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
8655
8657
  evnt.stopPropagation()
@@ -8658,7 +8660,7 @@ export default defineVxeComponent({
8658
8660
  $xeTable.closeMenu()
8659
8661
  }
8660
8662
  $xeTable.closeFilter()
8661
- if (keyboardConfig && keyboardOpts.isEsc) {
8663
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
8662
8664
  // 如果是激活编辑状态,则取消编辑
8663
8665
  if (actived.row) {
8664
8666
  const params = actived.args
@@ -8735,7 +8737,7 @@ export default defineVxeComponent({
8735
8737
  } else {
8736
8738
  $xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList)
8737
8739
  }
8738
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8740
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleKdClAreaEvent) {
8739
8741
  $xeTable.handleKdClAreaEvent(evnt)
8740
8742
  } else if (isEsc) {
8741
8743
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
@@ -8743,7 +8745,7 @@ export default defineVxeComponent({
8743
8745
  $xeTable.closeMenu()
8744
8746
  }
8745
8747
  $xeTable.closeFilter()
8746
- if (keyboardConfig && keyboardOpts.isEsc) {
8748
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEsc) {
8747
8749
  // 如果是激活编辑状态,则取消编辑
8748
8750
  if (actived.row) {
8749
8751
  const params = actived.args
@@ -8754,7 +8756,7 @@ export default defineVxeComponent({
8754
8756
  }
8755
8757
  }
8756
8758
  }
8757
- } else if (isSpacebar && keyboardConfig && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
8759
+ } else if (isSpacebar && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isChecked && selectRow && selectColumn && (selectColumn.type === 'checkbox' || selectColumn.type === 'radio')) {
8758
8760
  // 空格键支持选中复选框
8759
8761
  evnt.preventDefault()
8760
8762
  if (selectColumn.type === 'checkbox') {
@@ -8777,7 +8779,7 @@ export default defineVxeComponent({
8777
8779
  internalData.keyCtxTimeout = setTimeout(() => {
8778
8780
  internalData._keyCtx = false
8779
8781
  }, 1000)
8780
- } else if (isEnter && !isAltKey && keyboardConfig && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
8782
+ } else if (isEnter && !isAltKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isEnter && (selectRow || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
8781
8783
  // 退出选中
8782
8784
  if (isControlKey) {
8783
8785
  // 如果是激活编辑状态,则取消编辑
@@ -8897,7 +8899,7 @@ export default defineVxeComponent({
8897
8899
  }
8898
8900
  }
8899
8901
  }
8900
- } else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
8902
+ } else if (operArrow && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow) {
8901
8903
  if (!isEditStatus) {
8902
8904
  // 如果按下了方向键
8903
8905
  if (mouseOpts.selected && selectRow && selectColumn) {
@@ -8913,7 +8915,7 @@ export default defineVxeComponent({
8913
8915
  }
8914
8916
  }
8915
8917
  }
8916
- } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
8918
+ } else if (isTab && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isTab) {
8917
8919
  // 如果按下了 Tab 键切换
8918
8920
  if (selectRow || actived.row) {
8919
8921
  const activeRow = selectRow || actived.row
@@ -8961,7 +8963,7 @@ export default defineVxeComponent({
8961
8963
  }
8962
8964
  }
8963
8965
  }
8964
- } else if (keyboardConfig && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8966
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isDel && hasDeleteKey && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8965
8967
  // 如果是删除键
8966
8968
  if (!isEditStatus) {
8967
8969
  const { delMethod } = keyboardOpts
@@ -8990,7 +8992,7 @@ export default defineVxeComponent({
8990
8992
  dispatchEvent('cell-delete-value', params, evnt)
8991
8993
  }
8992
8994
  }
8993
- } else if (hasBackspaceKey && keyboardConfig && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8995
+ } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isBack && isEnableConf(editConfig) && (selectRow || selectColumn)) {
8994
8996
  if (!isEditStatus) {
8995
8997
  const { backMethod } = keyboardOpts
8996
8998
  // 如果是删除键
@@ -9021,7 +9023,7 @@ export default defineVxeComponent({
9021
9023
  }
9022
9024
  }
9023
9025
  }
9024
- } else if (hasBackspaceKey && keyboardConfig && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
9026
+ } else if (hasBackspaceKey && hasEnableConf(keyboardConfig, keyboardOpts) && treeConfig && keyboardOpts.isBack && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
9025
9027
  // 如果树形表格回退键关闭当前行返回父节点
9026
9028
  const { parent: parentRow } = XEUtils.findTree(internalData.afterTreeFullData, item => item === currentRow, { children: childrenField })
9027
9029
  if (parentRow) {
@@ -9038,7 +9040,7 @@ export default defineVxeComponent({
9038
9040
  .then(() => $xeTable.scrollToRow(parentRow))
9039
9041
  .then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
9040
9042
  }
9041
- } else if (keyboardConfig && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
9043
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isUndoRedo && isControlKey && (isZ || isY) && !hasAxternalInputTarget(evnt.target)) {
9042
9044
  if (evnt.target) {
9043
9045
  if (isY || (hasShiftKey && isZ)) {
9044
9046
  // 恢复被撤销的操作:Ctrl + Y 或 Ctrl + Shift + Z
@@ -9050,7 +9052,7 @@ export default defineVxeComponent({
9050
9052
  $xeTable.handleUndoStackEvent(evnt)
9051
9053
  }
9052
9054
  }
9053
- } else if (keyboardConfig && isEnableConf(editConfig) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || evnt.key === 'Process' || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
9055
+ } else if (hasEnableConf(keyboardConfig, keyboardOpts) && isEnableConf(editConfig) && keyboardOpts.isEdit && !isControlKey && (isSpacebar || isProcess || evnt.key === 'Process' || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
9054
9056
  const { editMode, editMethod } = keyboardOpts
9055
9057
  // 启用编辑后,空格键功能将失效
9056
9058
  // if (isSpacebar) {
@@ -9102,7 +9104,7 @@ export default defineVxeComponent({
9102
9104
  const { actived } = editStore
9103
9105
  if (isActivated && !filterStore.visible) {
9104
9106
  if (!(actived.row || actived.column)) {
9105
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
9107
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handlePeClAreaEvent) {
9106
9108
  $xeTable.handlePeClAreaEvent(evnt)
9107
9109
  }
9108
9110
  }
@@ -9119,7 +9121,7 @@ export default defineVxeComponent({
9119
9121
  const { actived } = editStore
9120
9122
  if (isActivated && !filterStore.visible) {
9121
9123
  if (!(actived.row || actived.column)) {
9122
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
9124
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCyClAreaEvent) {
9123
9125
  $xeTable.handleCyClAreaEvent(evnt)
9124
9126
  }
9125
9127
  }
@@ -9136,7 +9138,7 @@ export default defineVxeComponent({
9136
9138
  const { actived } = editStore
9137
9139
  if (isActivated && !filterStore.visible) {
9138
9140
  if (!(actived.row || actived.column)) {
9139
- if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
9141
+ if (hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isClip && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleCutCellAreaEvent) {
9140
9142
  $xeTable.handleCutCellAreaEvent(evnt)
9141
9143
  }
9142
9144
  }
@@ -9658,11 +9660,23 @@ export default defineVxeComponent({
9658
9660
  */
9659
9661
  getParentElem () {
9660
9662
  const el = refElem.value
9661
- if ($xeGGWrapper) {
9662
- const gridEl = $xeGGWrapper.getRefMaps().refElem.value
9663
- return gridEl ? gridEl.parentNode as HTMLElement : null
9663
+ if (!el) {
9664
+ return null
9665
+ }
9666
+ const parentEl = el.parentElement
9667
+ if (!parentEl) {
9668
+ return null
9669
+ }
9670
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
9671
+ return $xeGantt.getParentElem()
9672
+ } else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
9673
+ return $xeGrid.getParentElem()
9674
+ }
9675
+ // 如果是虚拟滚动条
9676
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
9677
+ return parentEl.parentElement
9664
9678
  }
9665
- return el ? el.parentNode as HTMLElement : null
9679
+ return parentEl
9666
9680
  },
9667
9681
  /**
9668
9682
  * 获取父容器的高度
@@ -9670,23 +9684,30 @@ export default defineVxeComponent({
9670
9684
  getParentHeight () {
9671
9685
  const { height } = props
9672
9686
  const el = refElem.value
9673
- if (el) {
9674
- const parentElem = el.parentNode as HTMLElement
9675
- let parentPaddingSize = 0
9676
- let parentWrapperHeight = 0
9677
- if (parentElem) {
9678
- if ($xeGantt && hasClass(parentElem, 'vxe-gantt--table-wrapper')) {
9679
- parentWrapperHeight = $xeGantt.getParentHeight()
9680
- } else if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
9681
- parentWrapperHeight = $xeGrid.getParentHeight()
9682
- } else {
9683
- parentWrapperHeight = parentElem.clientHeight
9684
- parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
9685
- }
9687
+ if (!el) {
9688
+ return 0
9689
+ }
9690
+ let parentEl = el.parentElement
9691
+ let parentPaddingSize = 0
9692
+ let parentWrapperHeight = 0
9693
+ if (!parentEl) {
9694
+ return 0
9695
+ }
9696
+ if ($xeGantt && hasClass(parentEl, 'vxe-gantt--table-wrapper')) {
9697
+ parentWrapperHeight = $xeGantt.getParentHeight()
9698
+ } else if ($xeGrid && hasClass(parentEl, 'vxe-grid--table-wrapper')) {
9699
+ parentWrapperHeight = $xeGrid.getParentHeight()
9700
+ } else {
9701
+ // 如果是虚拟滚动条
9702
+ if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
9703
+ parentEl = parentEl.parentElement
9704
+ }
9705
+ if (parentEl) {
9706
+ parentWrapperHeight = parentEl.clientHeight
9707
+ parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentEl) : 0
9686
9708
  }
9687
- return Math.floor(parentWrapperHeight - parentPaddingSize)
9688
9709
  }
9689
- return 0
9710
+ return Math.floor(parentWrapperHeight - parentPaddingSize)
9690
9711
  },
9691
9712
  /**
9692
9713
  * 获取需要排除的高度
@@ -10357,7 +10378,8 @@ export default defineVxeComponent({
10357
10378
  */
10358
10379
  handleCustom () {
10359
10380
  const { mouseConfig } = props
10360
- if (mouseConfig) {
10381
+ const mouseOpts = computeMouseOpts.value
10382
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
10361
10383
  if ($xeTable.clearSelected) {
10362
10384
  $xeTable.clearSelected()
10363
10385
  }
@@ -11490,7 +11512,7 @@ export default defineVxeComponent({
11490
11512
  const { field, sortable, order } = column
11491
11513
  if (sortable) {
11492
11514
  const params = { $table: $xeTable, $event: evnt, column, field, property: field, order, sortList: $xeTable.getSortColumns(), sortTime: column.sortTime }
11493
- if (mouseConfig && mouseOpts.area && $xeTable.handleSortEvent) {
11515
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleSortEvent) {
11494
11516
  $xeTable.handleSortEvent(evnt, params)
11495
11517
  }
11496
11518
  if (!order) {
@@ -11566,7 +11588,7 @@ export default defineVxeComponent({
11566
11588
  $xeTable.handleHeaderCellDragMousedownEvent(evnt, params)
11567
11589
  }
11568
11590
  }
11569
- if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
11591
+ if (!triggerDrag && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleHeaderCellAreaMouseDnEvent) {
11570
11592
  $xeTable.handleHeaderCellAreaMouseDnEvent(evnt, Object.assign({ cell, triggerSort, triggerFilter }, params))
11571
11593
  }
11572
11594
  $xeTable.focus()
@@ -12315,6 +12337,7 @@ export default defineVxeComponent({
12315
12337
  handleColDragSwapEvent (evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
12316
12338
  const { mouseConfig } = props
12317
12339
  const columnDragOpts = computeColumnDragOpts.value
12340
+ const mouseOpts = computeMouseOpts.value
12318
12341
  const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
12319
12342
  const { collectColumn, fullColumnIdData } = internalData
12320
12343
  const el = refElem.value
@@ -12487,7 +12510,7 @@ export default defineVxeComponent({
12487
12510
  })
12488
12511
 
12489
12512
  $xeTable.handleClearStack()
12490
- if (mouseConfig) {
12513
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
12491
12514
  if ($xeTable.clearSelected) {
12492
12515
  $xeTable.clearSelected()
12493
12516
  }
@@ -14032,7 +14055,7 @@ export default defineVxeComponent({
14032
14055
  }
14033
14056
 
14034
14057
  const renderVN = () => {
14035
- const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
14058
+ const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props
14036
14059
  const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
14037
14060
  const { teleportToWrapperElem, popupToWrapperElem, customPopupToElem } = internalData
14038
14061
  const { leftList, rightList } = columnStore
@@ -14060,10 +14083,13 @@ export default defineVxeComponent({
14060
14083
  const isContentMenu = computeIsContentMenu.value
14061
14084
  const currLoading = reactData.isColLoading || reactData.isRowLoading || loading
14062
14085
  const resizableOpts = computeResizableOpts.value
14063
- const isArea = mouseConfig && mouseOpts.area
14086
+ const isArea = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
14064
14087
  const columnDragOpts = computeColumnDragOpts.value
14065
14088
  const scrollbarXToTop = computeScrollbarXToTop.value
14066
14089
  const scrollbarYToLeft = computeScrollbarYToLeft.value
14090
+ const exportOpts = computeExportOpts.value
14091
+ const importOpts = computeImportOpts.value
14092
+ const printOpts = computePrintOpts.value
14067
14093
  const { isCrossTableDrag } = rowDragOpts
14068
14094
  const tbOns: {
14069
14095
  onContextmenu: (...args: any[]) => void
@@ -14084,7 +14110,7 @@ export default defineVxeComponent({
14084
14110
  'vxe-editable': !!editConfig,
14085
14111
  'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
14086
14112
  'cell--highlight': highlightCell,
14087
- 'cell--selected': mouseConfig && mouseOpts.selected,
14113
+ 'cell--selected': hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected,
14088
14114
  'cell--area': isArea,
14089
14115
  'header-cell--area': isArea && areaOpts.selectCellByHeader,
14090
14116
  'body-cell--area': isArea && areaOpts.selectCellByBody,
@@ -14298,7 +14324,7 @@ export default defineVxeComponent({
14298
14324
  /**
14299
14325
  * 导入
14300
14326
  */
14301
- initStore.import && props.importConfig
14327
+ initStore.import && hasEnableConf(importConfig, importOpts)
14302
14328
  ? h(TableImportPanelComponent, {
14303
14329
  key: 'it',
14304
14330
  defaultOptions: reactData.importParams,
@@ -14308,7 +14334,7 @@ export default defineVxeComponent({
14308
14334
  /**
14309
14335
  * 导出
14310
14336
  */
14311
- initStore.export && (props.exportConfig || props.printConfig)
14337
+ initStore.export && (hasEnableConf(exportConfig, exportOpts) || hasEnableConf(printConfig, printOpts))
14312
14338
  ? h(TableExportPanelComponent, {
14313
14339
  key: 'et',
14314
14340
  defaultOptions: reactData.exportParams,
@@ -14673,7 +14699,7 @@ export default defineVxeComponent({
14673
14699
  })
14674
14700
 
14675
14701
  onMounted(() => {
14676
- const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource } = props
14702
+ const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource, areaConfig } = props
14677
14703
  const { scrollXStore, scrollYStore } = internalData
14678
14704
  const columnOpts = computeColumnOpts.value
14679
14705
  const columnDragOpts = computeColumnDragOpts.value
@@ -14791,13 +14817,13 @@ export default defineVxeComponent({
14791
14817
  // warnLog('vxe.error.delProp', ['scroll-x', 'virtual-x-config'])
14792
14818
  // }
14793
14819
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
14794
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
14820
+ if (hasEnableConf(importConfig, importOpts) && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
14795
14821
  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(',')])
14796
14822
  }
14797
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
14823
+ if (hasEnableConf(exportConfig, exportOpts) && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
14798
14824
  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(',')])
14799
14825
  }
14800
- if (exportConfig && XEUtils.isBoolean((exportOpts as any).isAllExpand)) {
14826
+ if (hasEnableConf(exportConfig, exportOpts) && XEUtils.isBoolean((exportOpts as any).isAllExpand)) {
14801
14827
  warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
14802
14828
  }
14803
14829
 
@@ -14812,8 +14838,8 @@ export default defineVxeComponent({
14812
14838
  if (rowOpts.height && !props.showOverflow) {
14813
14839
  warnLog('vxe.error.notProp', ['table.show-overflow'])
14814
14840
  }
14815
- if (!$xeTable.triggerClAreaMnEvent) {
14816
- if (props.areaConfig) {
14841
+ if (!$xeTable.triggerClAaMnEvent) {
14842
+ if (hasEnableConf(areaConfig, areaOpts)) {
14817
14843
  warnLog('vxe.error.notProp', ['area-config'])
14818
14844
  }
14819
14845
  if (props.clipConfig) {
@@ -14901,10 +14927,10 @@ export default defineVxeComponent({
14901
14927
  if (columnOpts.currentMethod) {
14902
14928
  warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod'])
14903
14929
  }
14904
- // if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
14930
+ // if ((rowOpts.isCurrent || highlightCurrentRow) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
14905
14931
  // warnLog('vxe.error.notConflictProp', ['row-config.isCurrent & keyboard-config.isArrow', 'current-row-config.isFollowSelected'])
14906
14932
  // }
14907
- // if ((columnOpts.isCurrent || highlightCurrentColumn) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
14933
+ // if ((columnOpts.isCurrent || highlightCurrentColumn) && hasEnableConf(keyboardConfig, keyboardOpts) && keyboardOpts.isArrow && !XEUtils.isBoolean(currentColumnOpts.isFollowSelected)) {
14908
14934
  // warnLog('vxe.error.notConflictProp', ['column-config.isCurrent & keyboard-config.isArrow', 'current-column-config.isFollowSelected'])
14909
14935
  // }
14910
14936
 
@@ -14930,10 +14956,10 @@ export default defineVxeComponent({
14930
14956
  // if (props.editRules && !$xeTable.validate) {
14931
14957
  // errLog('vxe.error.reqModule', ['Validator'])
14932
14958
  // }
14933
- // if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
14959
+ // if ((checkboxOpts.range || hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts)) && !$xeTable.handleCellMousedownEvent) {
14934
14960
  // errLog('vxe.error.reqModule', ['Keyboard'])
14935
14961
  // }
14936
- // if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
14962
+ // if (hasEnableConf(printConfig, printOpts) || hasEnableConf(importConfig, importOpts) || hasEnableConf(exportConfig, exportOpts)) && !$xeTable.exportData) {
14937
14963
  // errLog('vxe.error.reqModule', ['Export'])
14938
14964
  // }
14939
14965
 
@@ -14958,7 +14984,7 @@ export default defineVxeComponent({
14958
14984
  const parentEl = $xeTable.getParentElem()
14959
14985
  resizeObserver = globalResize.create(() => {
14960
14986
  if (props.autoResize) {
14961
- handleResizeEvent()
14987
+ layoutReFlag.value++
14962
14988
  }
14963
14989
  })
14964
14990
  if (el) {
@@ -2,7 +2,7 @@ import { watch, reactive } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { ColumnInfo } from './columnInfo'
4
4
  import { isPx, isScale, queryElement } from '../../ui/src/dom'
5
- import { eqEmptyValue } from '../../ui/src/utils'
5
+ import { eqEmptyValue, hasEnableConf } from '../../ui/src/utils'
6
6
 
7
7
  import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeTablePropTypes, TableReactData, TableInternalData } from '../../../types'
8
8
 
@@ -976,6 +976,10 @@ export function getLastChildColumn (column: VxeTableDefines.ColumnInfo): VxeTabl
976
976
  export function clearTableDefaultStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
977
977
  const { props, internalData } = $xeTable
978
978
 
979
+ const { keyboardConfig, mouseConfig } = props
980
+ const { computeMouseOpts, computeKeyboardOpts } = $xeTable.getComputeMaps()
981
+ const mouseOpts = computeMouseOpts.value
982
+ const keyboardOpts = computeKeyboardOpts.value
979
983
  internalData.initStatus = false
980
984
  const actionList = [
981
985
  $xeTable.clearSort(),
@@ -995,12 +999,12 @@ export function clearTableDefaultStatus ($xeTable: VxeTableConstructor & VxeTabl
995
999
  $xeTable.clearFilter()
996
1000
  )
997
1001
  }
998
- if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
1002
+ if ($xeTable.clearSelected && (hasEnableConf(keyboardConfig, keyboardOpts) || hasEnableConf(mouseConfig, mouseOpts))) {
999
1003
  actionList.push(
1000
1004
  $xeTable.clearSelected()
1001
1005
  )
1002
1006
  }
1003
- if ($xeTable.clearCellAreas && props.mouseConfig) {
1007
+ if ($xeTable.clearCellAreas && hasEnableConf(mouseConfig, mouseOpts)) {
1004
1008
  actionList.push(
1005
1009
  $xeTable.clearCellAreas(),
1006
1010
  $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
  }