vxe-table 4.22.4 → 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 +149 -89
  2. package/dist/style.css +1 -1
  3. package/es/grid/src/grid.js +14 -2
  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 +90 -63
  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 +13 -1
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/index.umd.js +114 -64
  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 +38 -36
  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 +14 -2
  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 +87 -61
  64. package/packages/table/src/util.ts +7 -3
  65. package/packages/ui/src/utils.ts +10 -0
  66. /package/es/{iconfont.1791617063720.ttf → iconfont.1791880428511.ttf} +0 -0
  67. /package/es/{iconfont.1791617063720.woff → iconfont.1791880428511.woff} +0 -0
  68. /package/es/{iconfont.1791617063720.woff2 → iconfont.1791880428511.woff2} +0 -0
  69. /package/lib/{iconfont.1791617063720.ttf → iconfont.1791880428511.ttf} +0 -0
  70. /package/lib/{iconfont.1791617063720.woff → iconfont.1791880428511.woff} +0 -0
  71. /package/lib/{iconfont.1791617063720.woff2 → iconfont.1791880428511.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { h, inject, ref, provide, 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';
@@ -35,7 +35,7 @@ export default defineVxeComponent({
35
35
  const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
36
36
  const $xeTable = inject('$xeTable', {});
37
37
  const { props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
38
- const { computeSize, computeCustomOpts, computeColumnDragOpts, computeColumnOpts, computeIsMaxFixedColumn, computeResizableOpts, computeAggregateOpts } = $xeTable.getComputeMaps();
38
+ const { computeSize, computeCustomOpts, computeMouseOpts, computeColumnDragOpts, computeColumnOpts, computeIsMaxFixedColumn, computeResizableOpts, computeAggregateOpts } = $xeTable.getComputeMaps();
39
39
  const refElem = ref();
40
40
  const refBodyWrapperElem = ref();
41
41
  const refCustomBodyElem = ref();
@@ -341,6 +341,7 @@ export default defineVxeComponent({
341
341
  const { customColumnList } = tableReactData;
342
342
  const { collectColumn } = tableInternalData;
343
343
  const customOpts = computeCustomOpts.value;
344
+ const mouseOpts = computeMouseOpts.value;
344
345
  const { immediate } = customOpts;
345
346
  const trEl = evnt.currentTarget;
346
347
  const columnDragOpts = computeColumnDragOpts.value;
@@ -484,7 +485,7 @@ export default defineVxeComponent({
484
485
  nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id);
485
486
  customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn);
486
487
  }
487
- if (mouseConfig) {
488
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
488
489
  if ($xeTable.clearSelected) {
489
490
  $xeTable.clearSelected();
490
491
  }
@@ -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';
@@ -391,6 +391,7 @@ hooks.add('tableEditModule', {
391
391
  const { editConfig, mouseConfig } = props;
392
392
  const { editStore, tableColumn } = reactData;
393
393
  const editOpts = computeEditOpts.value;
394
+ const mouseOpts = computeMouseOpts.value;
394
395
  const { mode } = editOpts;
395
396
  const { actived, focused } = editStore;
396
397
  const { row, column } = params;
@@ -406,7 +407,7 @@ hooks.add('tableEditModule', {
406
407
  // 判断是否禁用编辑
407
408
  let type = 'edit-disabled';
408
409
  if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, editParams), { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))) {
409
- if (mouseConfig) {
410
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
410
411
  $xeTable.clearSelected();
411
412
  if ($xeTable.clearCellAreas) {
412
413
  $xeTable.clearCellAreas();
@@ -464,7 +465,7 @@ hooks.add('tableEditModule', {
464
465
  }
465
466
  else {
466
467
  const { column: oldColumn } = actived;
467
- if (mouseConfig) {
468
+ if (hasEnableConf(mouseConfig, mouseOpts)) {
468
469
  $xeTable.clearSelected();
469
470
  if ($xeTable.clearCellAreas) {
470
471
  $xeTable.clearCellAreas();
@@ -1047,7 +1048,7 @@ hooks.add('tableEditModule', {
1047
1048
  const editOpts = computeEditOpts.value;
1048
1049
  const { actived, selected } = editStore;
1049
1050
  const { row, column } = params;
1050
- const isMouseSelected = mouseConfig && mouseOpts.selected;
1051
+ const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected;
1051
1052
  const selectMethod = () => {
1052
1053
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
1053
1054
  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';
@@ -1921,7 +1921,7 @@ hooks.add('tableExportModule', {
1921
1921
  }
1922
1922
  return;
1923
1923
  }
1924
- if (!importConfig) {
1924
+ if (!hasEnableConf(importConfig, importOpts)) {
1925
1925
  errLog('vxe.error.reqProp', ['import-config']);
1926
1926
  }
1927
1927
  // 处理类型
@@ -1959,23 +1959,25 @@ hooks.add('tableExportModule', {
1959
1959
  },
1960
1960
  closeExport: handleCloseExport,
1961
1961
  openExport(options) {
1962
+ const { exportConfig } = props;
1962
1963
  const exportOpts = computeExportOpts.value;
1963
1964
  const defOpts = Object.assign({
1964
1965
  message: true,
1965
1966
  types: XEUtils.keys(exportOpts._typeMaps)
1966
1967
  }, exportOpts, options);
1967
- if (!props.exportConfig) {
1968
+ if (!hasEnableConf(exportConfig, exportOpts)) {
1968
1969
  errLog('vxe.error.reqProp', ['export-config']);
1969
1970
  }
1970
1971
  return handleExportAndPrint(defOpts);
1971
1972
  },
1972
1973
  closePrint: handleCloseExport,
1973
1974
  openPrint(options) {
1975
+ const { printConfig } = props;
1974
1976
  const printOpts = computePrintOpts.value;
1975
1977
  const defOpts = Object.assign({
1976
1978
  message: true
1977
1979
  }, printOpts, options);
1978
- if (!props.printConfig) {
1980
+ if (!hasEnableConf(printConfig, printOpts)) {
1979
1981
  errLog('vxe.error.reqProp', ['print-config']);
1980
1982
  }
1981
1983
  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
  const { renderer, hooks } = VxeUI;
8
8
  const tableFilterMethodKeys = ['openFilter', 'setFilter', 'clearFilter', 'saveFilter', 'saveFilterByEvent', 'saveFilterPanel', 'saveFilterPanelByEvent', 'resetFilter', 'resetFilterByEvent', 'resetFilterPanel', 'resetFilterPanelByEvent', 'getCheckedFilters', 'updateFilterOptionStatus'];
9
9
  const sourceType = 'table';
@@ -201,7 +201,7 @@ hooks.add('tableFilterModule', {
201
201
  $xeTable.handleTableData(true);
202
202
  $xeTable.checkSelectionStatus();
203
203
  }
204
- if (mouseConfig && mouseOpts.area && $xeTable.handleFilterEvent) {
204
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.handleFilterEvent) {
205
205
  $xeTable.handleFilterEvent(evnt, params);
206
206
  }
207
207
  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
  const { hooks } = VxeUI;
6
7
  hooks.add('tableKeyboardModule', {
7
8
  setupTable($xeTable) {
@@ -250,14 +251,14 @@ hooks.add('tableKeyboardModule', {
250
251
  const checkboxOpts = computeCheckboxOpts.value;
251
252
  const mouseOpts = computeMouseOpts.value;
252
253
  const editOpts = computeEditOpts.value;
253
- if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaMnEvent) {
254
- return $xeTable.triggerClAreaMnEvent(evnt, params);
254
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && $xeTable.triggerClAaMnEvent) {
255
+ return $xeTable.triggerClAaMnEvent(evnt, params);
255
256
  }
256
257
  else {
257
258
  if (checkboxConfig && checkboxOpts.range) {
258
259
  handleCheckboxRangeEvent(evnt, params);
259
260
  }
260
- if (mouseConfig && mouseOpts.selected) {
261
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
261
262
  if (!editConfig || editOpts.mode === 'cell') {
262
263
  $xeTable.handleSelected(params, evnt);
263
264
  }
@@ -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
  const { menus, hooks, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI;
7
7
  const tableMenuMethodKeys = ['closeMenu'];
8
8
  hooks.add('tableMenuModule', {
@@ -183,7 +183,7 @@ hooks.add('tableMenuModule', {
183
183
  const type = 'body';
184
184
  const params = { source: 'table', type, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, keyboard: true, columns: visibleColumn.slice(0), $event: evnt };
185
185
  // 如果开启单元格区域
186
- if (mouseConfig && mouseOpts.area) {
186
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
187
187
  const activeArea = $xeTable.getActiveCellArea();
188
188
  if (activeArea && activeArea.row && activeArea.column) {
189
189
  params.row = activeArea.row;
@@ -192,7 +192,7 @@ hooks.add('tableMenuModule', {
192
192
  return;
193
193
  }
194
194
  }
195
- else if (mouseConfig && mouseOpts.selected) {
195
+ else if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected) {
196
196
  // 如果启用键盘导航且已选中单元格
197
197
  if (selected.row && selected.column) {
198
198
  params.row = selected.row;
@@ -2,7 +2,7 @@ import { h, resolveComponent } 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
  const { errLog } = createComponentLog('table');
@@ -780,9 +780,11 @@ function getNativeInputRenderCellVNs(cellValue, labelVNs, renderOpts, renderPara
780
780
  const { name } = renderOpts;
781
781
  const tableProps = $table.props;
782
782
  const { editConfig, mouseConfig } = tableProps;
783
+ const { computeMouseOpts } = $table.getComputeMaps();
784
+ const mouseOpts = computeMouseOpts.value;
783
785
  let isColSelected = false;
784
786
  let isActiveCellArea = false;
785
- if (editConfig && mouseConfig) {
787
+ if (editConfig && hasEnableConf(mouseConfig, mouseOpts)) {
786
788
  const tableReactData = $table.reactData;
787
789
  const { editStore } = tableReactData;
788
790
  const { selected } = editStore;
@@ -804,12 +806,13 @@ function getInputRenderCellVNs(cellValue, labelVNs, renderOpts, renderParams) {
804
806
  const { $table, row, column } = renderParams;
805
807
  const tableProps = $table.props;
806
808
  const { editConfig, mouseConfig } = tableProps;
809
+ const { computeEditOpts, computeMouseOpts } = $table.getComputeMaps();
810
+ const mouseOpts = computeMouseOpts.value;
807
811
  let isColSelected = false;
808
812
  let isActiveCellArea = false;
809
- if (editConfig && mouseConfig) {
813
+ if (editConfig && hasEnableConf(mouseConfig, mouseOpts)) {
810
814
  const tableReactData = $table.reactData;
811
815
  const { editStore } = tableReactData;
812
- const { computeEditOpts } = $table.getComputeMaps();
813
816
  const editOpts = computeEditOpts.value;
814
817
  if (editOpts.isReuseKeep) {
815
818
  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
  const { getI18n, renderer, renderEmptyElement } = VxeUI;
10
10
  const sourceType = 'table';
@@ -216,7 +216,7 @@ export default defineVxeComponent({
216
216
  };
217
217
  }
218
218
  // 按下事件处理
219
- if (isRowDragCell || checkboxOpts.range || mouseConfig) {
219
+ if (isRowDragCell || checkboxOpts.range || hasEnableConf(mouseConfig, mouseOpts)) {
220
220
  tdOns.onMousedown = (evnt) => {
221
221
  $xeTable.triggerCellMousedownEvent(evnt, cellParams);
222
222
  };
@@ -395,7 +395,7 @@ export default defineVxeComponent({
395
395
  }
396
396
  }
397
397
  let showAreaRowStatus = false;
398
- if (mouseConfig && mouseOpts.area && !_columnIndex && selectCellToRow) {
398
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area && !_columnIndex && selectCellToRow) {
399
399
  showAreaRowStatus = true;
400
400
  }
401
401
  if (!fixedHiddenColumn && showResizable && isAllColumnDrag) {
@@ -829,7 +829,7 @@ export default defineVxeComponent({
829
829
  h('div', {
830
830
  class: 'vxe-table--checkbox-range'
831
831
  }),
832
- mouseConfig && mouseOpts.area
832
+ hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
833
833
  ? h('div', {
834
834
  class: 'vxe-table--cell-area',
835
835
  xid: xID
@@ -2,7 +2,7 @@ import { h, ref, inject, nextTick, watch, onMounted, onUnmounted } from 'vue';
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
  const { renderer, renderEmptyElement } = VxeUI;
@@ -63,6 +63,7 @@ export default defineVxeComponent({
63
63
  const defaultRowHeight = computeDefaultRowHeight.value;
64
64
  const headerCellOpts = computeHeaderCellOpts.value;
65
65
  const rendererOpts = computeRendererOpts.value;
66
+ const mouseOpts = computeMouseOpts.value;
66
67
  const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight;
67
68
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts;
68
69
  const isLastRow = _rowIndex === headerGroups.length - 1;
@@ -148,7 +149,7 @@ export default defineVxeComponent({
148
149
  isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
149
150
  }
150
151
  // 按下事件处理
151
- if (mouseConfig || isColDragCell) {
152
+ if (hasEnableConf(mouseConfig, mouseOpts) || isColDragCell) {
152
153
  thOns.onMousedown = (evnt) => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams);
153
154
  }
154
155
  // 拖拽列事件
@@ -467,7 +468,7 @@ export default defineVxeComponent({
467
468
  ref: refHeaderTHead
468
469
  }, renderHeads(isGroup, isOptimizeMode, renderHeaderList, renderColumnList))
469
470
  ]),
470
- mouseConfig && mouseOpts.area
471
+ hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area
471
472
  ? h('div', {
472
473
  class: 'vxe-table--cell-area',
473
474
  xid: xID