vxe-table 4.22.4 → 4.23.0-beta.1

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 (81) hide show
  1. package/dist/all.esm.js +211 -126
  2. package/dist/style.css +1 -1
  3. package/es/grid/src/grid.js +14 -2
  4. package/es/locale/lang/fr-FR.js +29 -29
  5. package/es/style.css +1 -1
  6. package/es/table/module/custom/panel.js +4 -3
  7. package/es/table/module/edit/hook.js +5 -4
  8. package/es/table/module/export/hook.js +6 -4
  9. package/es/table/module/filter/hook.js +2 -2
  10. package/es/table/module/keyboard/hook.js +4 -3
  11. package/es/table/module/menu/hook.js +3 -3
  12. package/es/table/render/index.js +7 -4
  13. package/es/table/src/body.js +4 -4
  14. package/es/table/src/header.js +4 -3
  15. package/es/table/src/props.js +4 -0
  16. package/es/table/src/table.js +140 -90
  17. package/es/table/src/util.js +7 -3
  18. package/es/ui/index.js +9 -11
  19. package/es/ui/src/log.js +1 -1
  20. package/es/ui/src/utils.js +9 -0
  21. package/lib/grid/src/grid.js +13 -1
  22. package/lib/grid/src/grid.min.js +1 -1
  23. package/lib/index.umd.js +136 -84
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/locale/lang/fr-FR.js +29 -29
  26. package/lib/locale/lang/fr-FR.min.js +1 -1
  27. package/lib/locale/lang/fr-FR.umd.js +29 -29
  28. package/lib/style.css +1 -1
  29. package/lib/table/module/custom/panel.js +3 -1
  30. package/lib/table/module/custom/panel.min.js +1 -1
  31. package/lib/table/module/edit/hook.js +4 -3
  32. package/lib/table/module/edit/hook.min.js +1 -1
  33. package/lib/table/module/export/hook.js +9 -3
  34. package/lib/table/module/export/hook.min.js +1 -1
  35. package/lib/table/module/filter/hook.js +1 -1
  36. package/lib/table/module/filter/hook.min.js +1 -1
  37. package/lib/table/module/keyboard/hook.js +4 -3
  38. package/lib/table/module/keyboard/hook.min.js +1 -1
  39. package/lib/table/module/menu/hook.js +2 -2
  40. package/lib/table/module/menu/hook.min.js +1 -1
  41. package/lib/table/render/index.js +11 -5
  42. package/lib/table/render/index.min.js +1 -1
  43. package/lib/table/src/body.js +3 -3
  44. package/lib/table/src/body.min.js +1 -1
  45. package/lib/table/src/header.js +3 -2
  46. package/lib/table/src/header.min.js +1 -1
  47. package/lib/table/src/props.js +4 -0
  48. package/lib/table/src/props.min.js +1 -1
  49. package/lib/table/src/table.js +48 -46
  50. package/lib/table/src/table.min.js +1 -1
  51. package/lib/table/src/util.js +12 -2
  52. package/lib/table/src/util.min.js +1 -1
  53. package/lib/ui/index.js +9 -11
  54. package/lib/ui/index.min.js +1 -1
  55. package/lib/ui/src/log.js +1 -1
  56. package/lib/ui/src/log.min.js +1 -1
  57. package/lib/ui/src/utils.js +10 -0
  58. package/lib/ui/src/utils.min.js +1 -1
  59. package/package.json +2 -2
  60. package/packages/grid/src/grid.ts +14 -2
  61. package/packages/locale/lang/fr-FR.ts +903 -903
  62. package/packages/table/module/custom/panel.ts +4 -3
  63. package/packages/table/module/edit/hook.ts +5 -4
  64. package/packages/table/module/export/hook.ts +6 -4
  65. package/packages/table/module/filter/hook.ts +2 -2
  66. package/packages/table/module/keyboard/hook.ts +4 -3
  67. package/packages/table/module/menu/hook.ts +3 -3
  68. package/packages/table/render/index.ts +7 -4
  69. package/packages/table/src/body.ts +4 -4
  70. package/packages/table/src/header.ts +4 -3
  71. package/packages/table/src/props.ts +4 -0
  72. package/packages/table/src/table.ts +141 -88
  73. package/packages/table/src/util.ts +7 -3
  74. package/packages/ui/index.ts +8 -10
  75. package/packages/ui/src/utils.ts +10 -0
  76. /package/es/{iconfont.1791617063720.ttf → iconfont.1791954193706.ttf} +0 -0
  77. /package/es/{iconfont.1791617063720.woff → iconfont.1791954193706.woff} +0 -0
  78. /package/es/{iconfont.1791617063720.woff2 → iconfont.1791954193706.woff2} +0 -0
  79. /package/lib/{iconfont.1791617063720.ttf → iconfont.1791954193706.ttf} +0 -0
  80. /package/lib/{iconfont.1791617063720.woff → iconfont.1791954193706.woff} +0 -0
  81. /package/lib/{iconfont.1791617063720.woff2 → iconfont.1791954193706.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { h, inject, ref, Ref, provide, VNode, PropType, nextTick, TransitionGroup, reactive, onUnmounted } from 'vue'
2
2
  import { defineVxeComponent } from '../../../ui/src/comp'
3
3
  import { VxeUI } from '../../../ui'
4
- import { formatText } from '../../../ui/src/utils'
4
+ import { formatText, hasEnableConf } from '../../../ui/src/utils'
5
5
  import { getTpImg, addClass, removeClass, hasControlKey } from '../../../ui/src/dom'
6
6
  import { createComponentLog } from '../../../ui/src/log'
7
7
  import XEUtils from 'xe-utils'
@@ -45,7 +45,7 @@ export default defineVxeComponent({
45
45
  const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
46
46
 
47
47
  const { props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable
48
- const { computeSize, computeCustomOpts, computeColumnDragOpts, computeColumnOpts, computeIsMaxFixedColumn, computeResizableOpts, computeAggregateOpts } = $xeTable.getComputeMaps()
48
+ const { computeSize, computeCustomOpts, computeMouseOpts, computeColumnDragOpts, computeColumnOpts, computeIsMaxFixedColumn, computeResizableOpts, computeAggregateOpts } = $xeTable.getComputeMaps()
49
49
 
50
50
  const refElem = ref() as Ref<HTMLDivElement>
51
51
  const refBodyWrapperElem = ref() as Ref<HTMLDivElement>
@@ -368,6 +368,7 @@ export default defineVxeComponent({
368
368
  const { customColumnList } = tableReactData
369
369
  const { collectColumn } = tableInternalData
370
370
  const customOpts = computeCustomOpts.value
371
+ const mouseOpts = computeMouseOpts.value
371
372
  const { immediate } = customOpts
372
373
  const trEl = evnt.currentTarget as HTMLElement
373
374
  const columnDragOpts = computeColumnDragOpts.value
@@ -520,7 +521,7 @@ export default defineVxeComponent({
520
521
  customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn)
521
522
  }
522
523
 
523
- if (mouseConfig) {
524
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
524
525
  if ($xeTable.clearSelected) {
525
526
  $xeTable.clearSelected()
526
527
  }
@@ -1,7 +1,7 @@
1
1
  import { reactive, nextTick } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../../ui'
4
- import { isEnableConf } from '../../../ui/src/utils'
4
+ import { hasEnableConf, isEnableConf } from '../../../ui/src/utils'
5
5
  import { getCellValue, setCellValue, getRowid } from '../../src/util'
6
6
  import { removeClass, addClass } from '../../../ui/src/dom'
7
7
  import { createComponentLog } from '../../../ui/src/log'
@@ -410,6 +410,7 @@ hooks.add('tableEditModule', {
410
410
  const { editConfig, mouseConfig } = props
411
411
  const { editStore, tableColumn } = reactData
412
412
  const editOpts = computeEditOpts.value
413
+ const mouseOpts = computeMouseOpts.value
413
414
  const { mode } = editOpts
414
415
  const { actived, focused } = editStore
415
416
  const { row, column } = params
@@ -425,7 +426,7 @@ hooks.add('tableEditModule', {
425
426
  // 判断是否禁用编辑
426
427
  let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
427
428
  if (!beforeEditMethod || beforeEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })) {
428
- if (mouseConfig) {
429
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
429
430
  $xeTable.clearSelected()
430
431
  if ($xeTable.clearCellAreas) {
431
432
  $xeTable.clearCellAreas()
@@ -482,7 +483,7 @@ hooks.add('tableEditModule', {
482
483
  }
483
484
  } else {
484
485
  const { column: oldColumn } = actived
485
- if (mouseConfig) {
486
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
486
487
  $xeTable.clearSelected()
487
488
  if ($xeTable.clearCellAreas) {
488
489
  $xeTable.clearCellAreas()
@@ -1067,7 +1068,7 @@ hooks.add('tableEditModule', {
1067
1068
  const editOpts = computeEditOpts.value
1068
1069
  const { actived, selected } = editStore
1069
1070
  const { row, column } = params
1070
- const isMouseSelected = mouseConfig && mouseOpts.selected
1071
+ const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected
1071
1072
  const selectMethod = () => {
1072
1073
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
1073
1074
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
@@ -2,7 +2,7 @@ import { nextTick } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../../ui'
4
4
  import { isColumnInfo, getCellValue, createHandleGetRowId } from '../../src/util'
5
- import { parseFile, formatText, eqEmptyValue } from '../../../ui/src/utils'
5
+ import { parseFile, formatText, eqEmptyValue, hasEnableConf } from '../../../ui/src/utils'
6
6
  import { hasClass, toCssUnit } from '../../../ui/src/dom'
7
7
  import { createHtmlPage, getExportBlobByContent } from './util'
8
8
  import { createComponentLog } from '../../../ui/src/log'
@@ -1985,7 +1985,7 @@ hooks.add('tableExportModule', {
1985
1985
  }
1986
1986
  return
1987
1987
  }
1988
- if (!importConfig) {
1988
+ if (!hasEnableConf(importConfig, importOpts)) {
1989
1989
  errLog('vxe.error.reqProp', ['import-config'])
1990
1990
  }
1991
1991
  // 处理类型
@@ -2023,23 +2023,25 @@ hooks.add('tableExportModule', {
2023
2023
  },
2024
2024
  closeExport: handleCloseExport,
2025
2025
  openExport (options) {
2026
+ const { exportConfig } = props
2026
2027
  const exportOpts = computeExportOpts.value
2027
2028
  const defOpts = Object.assign({
2028
2029
  message: true,
2029
2030
  types: XEUtils.keys(exportOpts._typeMaps)
2030
2031
  }, exportOpts, options)
2031
- if (!props.exportConfig) {
2032
+ if (!hasEnableConf(exportConfig, exportOpts)) {
2032
2033
  errLog('vxe.error.reqProp', ['export-config'])
2033
2034
  }
2034
2035
  return handleExportAndPrint(defOpts)
2035
2036
  },
2036
2037
  closePrint: handleCloseExport,
2037
2038
  openPrint (options) {
2039
+ const { printConfig } = props
2038
2040
  const printOpts = computePrintOpts.value
2039
2041
  const defOpts = Object.assign({
2040
2042
  message: true
2041
2043
  }, printOpts, options)
2042
- if (!props.printConfig) {
2044
+ if (!hasEnableConf(printConfig, printOpts)) {
2043
2045
  errLog('vxe.error.reqProp', ['print-config'])
2044
2046
  }
2045
2047
  return handleExportAndPrint(defOpts, true)
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../../ui'
4
4
  import { toFilters, handleFieldOrColumn, getRefElem } from '../../src/util'
5
5
  import { toCssUnit, triggerEvent, updatePanelPlacement } from '../../../ui/src/dom'
6
- import { isEnableConf } from '../../../ui/src/utils'
6
+ import { hasEnableConf, isEnableConf } from '../../../ui/src/utils'
7
7
 
8
8
  import type { TableFilterMethods, TableFilterPrivateMethods, VxeTableDefines } from '../../../../types'
9
9
 
@@ -208,7 +208,7 @@ hooks.add('tableFilterModule', {
208
208
  $xeTable.handleTableData(true)
209
209
  $xeTable.checkSelectionStatus()
210
210
  }
211
- if (mouseConfig && mouseOpts.area && $xeTable.handleFilterEvent) {
211
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleFilterEvent) {
212
212
  $xeTable.handleFilterEvent(evnt as Event, params)
213
213
  }
214
214
  if (evnt) {
@@ -2,6 +2,7 @@ import XEUtils from 'xe-utils'
2
2
  import { VxeUI } from '../../../ui'
3
3
  import { getRefElem } from '../../src/util'
4
4
  import { getAbsolutePos, addClass, removeClass, hasControlKey } from '../../../ui/src/dom'
5
+ import { hasEnableConf } from '../../../ui/src/utils'
5
6
 
6
7
  import type { TableKeyboardPrivateMethods, VxeTableDefines } from '../../../../types'
7
8
 
@@ -244,13 +245,13 @@ hooks.add('tableKeyboardModule', {
244
245
  const checkboxOpts = computeCheckboxOpts.value
245
246
  const mouseOpts = computeMouseOpts.value
246
247
  const editOpts = computeEditOpts.value
247
- if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaMnEvent) {
248
- return $xeTable.triggerClAreaMnEvent(evnt, params)
248
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.triggerClAaMnEvent) {
249
+ return $xeTable.triggerClAaMnEvent(evnt, params)
249
250
  } else {
250
251
  if (checkboxConfig && checkboxOpts.range) {
251
252
  handleCheckboxRangeEvent(evnt, params)
252
253
  }
253
- if (mouseConfig && mouseOpts.selected) {
254
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
254
255
  if (!editConfig || editOpts.mode === 'cell') {
255
256
  $xeTable.handleSelected(params, evnt)
256
257
  }
@@ -2,7 +2,7 @@ import { nextTick } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../../ui'
4
4
  import { getDomNode, getAbsolutePos, getEventTargetNode, toCssUnit } from '../../../ui/src/dom'
5
- import { isEnableConf, hasChildrenList } from '../../../ui/src/utils'
5
+ import { isEnableConf, hasChildrenList, hasEnableConf } from '../../../ui/src/utils'
6
6
 
7
7
  import type { VxeComponentStyleType } from 'vxe-pc-ui'
8
8
  import type { TableMenuMethods, TableMenuPrivateMethods } from '../../../../types'
@@ -190,7 +190,7 @@ hooks.add('tableMenuModule', {
190
190
  const type = 'body'
191
191
  const params: any = { source: 'table', type, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, keyboard: true, columns: visibleColumn.slice(0), $event: evnt }
192
192
  // 如果开启单元格区域
193
- if (mouseConfig && mouseOpts.area) {
193
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
194
194
  const activeArea = $xeTable.getActiveCellArea()
195
195
  if (activeArea && activeArea.row && activeArea.column) {
196
196
  params.row = activeArea.row
@@ -198,7 +198,7 @@ hooks.add('tableMenuModule', {
198
198
  handleOpenMenuEvent(evnt, type, params)
199
199
  return
200
200
  }
201
- } else if (mouseConfig && mouseOpts.selected) {
201
+ } else if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
202
202
  // 如果启用键盘导航且已选中单元格
203
203
  if (selected.row && selected.column) {
204
204
  params.row = selected.row
@@ -2,7 +2,7 @@ import { h, VNode, resolveComponent, ComponentOptions } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { getCellValue, setCellValue } from '../../table/src/util'
5
- import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
5
+ import { getFuncText, formatText, isEmptyValue, hasEnableConf } from '../../ui/src/utils'
6
6
  import { getOnName, getModelEvent, getChangeEvent, hasInputType } from '../../ui/src/vn'
7
7
  import { createComponentLog } from '../../ui/src/log'
8
8
 
@@ -907,9 +907,11 @@ function getNativeInputRenderCellVNs (cellValue: any, labelVNs: VNode[], renderO
907
907
  const { name } = renderOpts
908
908
  const tableProps = $table.props
909
909
  const { editConfig, mouseConfig } = tableProps
910
+ const { computeMouseOpts } = $table.getComputeMaps()
911
+ const mouseOpts = computeMouseOpts.value
910
912
  let isColSelected = false
911
913
  let isActiveCellArea = false
912
- if (editConfig && mouseConfig) {
914
+ if (editConfig && hasEnableConf(mouseConfig, mouseOpts)) {
913
915
  const tableReactData = $table.reactData
914
916
  const { editStore } = tableReactData
915
917
  const { selected } = editStore
@@ -940,12 +942,13 @@ function getInputRenderCellVNs (cellValue: any, labelVNs: VNode[], renderOpts: V
940
942
  const { $table, row, column } = renderParams
941
943
  const tableProps = $table.props
942
944
  const { editConfig, mouseConfig } = tableProps
945
+ const { computeEditOpts, computeMouseOpts } = $table.getComputeMaps()
946
+ const mouseOpts = computeMouseOpts.value
943
947
  let isColSelected = false
944
948
  let isActiveCellArea = false
945
- if (editConfig && mouseConfig) {
949
+ if (editConfig && hasEnableConf(mouseConfig, mouseOpts)) {
946
950
  const tableReactData = $table.reactData
947
951
  const { editStore } = tableReactData
948
- const { computeEditOpts } = $table.getComputeMaps()
949
952
  const editOpts = computeEditOpts.value
950
953
  if (editOpts.isReuseKeep) {
951
954
  const { selected } = editStore
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils'
4
4
  import { VxeUI } from '../../ui'
5
5
  import { getRowid, createHandleGetRowId, getCellRestHeight } from './util'
6
6
  import { updateCellTitle, getPropClass } from '../../ui/src/dom'
7
- import { isEnableConf, getDefaultConfig } from '../../ui/src/utils'
7
+ import { isEnableConf, getDefaultConfig, hasEnableConf } from '../../ui/src/utils'
8
8
  import { getSlotVNs } from '../../ui/src/vn'
9
9
 
10
10
  import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableDefines, VxeComponentSlotType } from '../../../types'
@@ -243,7 +243,7 @@ export default defineVxeComponent({
243
243
  }
244
244
  }
245
245
  // 按下事件处理
246
- if (isRowDragCell || checkboxOpts.range || mouseConfig) {
246
+ if (isRowDragCell || checkboxOpts.range || hasEnableConf(mouseConfig, mouseOpts)) {
247
247
  tdOns.onMousedown = (evnt: MouseEvent) => {
248
248
  $xeTable.triggerCellMousedownEvent(evnt, cellParams)
249
249
  }
@@ -434,7 +434,7 @@ export default defineVxeComponent({
434
434
  }
435
435
 
436
436
  let showAreaRowStatus = false
437
- if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
437
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && !_columnIndex && selectCellToRow) {
438
438
  showAreaRowStatus = true
439
439
  }
440
440
 
@@ -900,7 +900,7 @@ export default defineVxeComponent({
900
900
  h('div', {
901
901
  class: 'vxe-table--checkbox-range'
902
902
  }),
903
- mouseConfig && mouseOpts.area
903
+ hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
904
904
  ? h('div', {
905
905
  class: 'vxe-table--cell-area',
906
906
  xid: xID
@@ -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
@@ -305,6 +305,10 @@ export const tableProps = {
305
305
  virtualXConfig: Object as PropType<VxeTablePropTypes.VirtualXConfig>,
306
306
  // 纵向虚拟滚动配置项
307
307
  virtualYConfig: Object as PropType<VxeTablePropTypes.VirtualYConfig>,
308
+ useScrollbar: {
309
+ type: Boolean as PropType<VxeTablePropTypes.UseScrollbar>,
310
+ default: () => getConfig().table.useScrollbar
311
+ },
308
312
  // 滚动条配置项
309
313
  scrollbarConfig: Object as PropType<VxeTablePropTypes.ScrollbarConfig>,
310
314
  // 撤销/恢复历史配置项