vxe-table 4.11.18 → 4.11.20

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 (41) hide show
  1. package/es/grid/src/grid.js +45 -34
  2. package/es/style.css +1 -1
  3. package/es/table/module/keyboard/hook.js +30 -1
  4. package/es/table/src/body.js +11 -6
  5. package/es/table/src/footer.js +7 -2
  6. package/es/table/src/table.js +164 -48
  7. package/es/table/src/util.js +13 -3
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/grid/src/grid.js +43 -39
  11. package/lib/grid/src/grid.min.js +1 -1
  12. package/lib/index.umd.js +293 -104
  13. package/lib/index.umd.min.js +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/table/module/keyboard/hook.js +31 -1
  16. package/lib/table/module/keyboard/hook.min.js +1 -1
  17. package/lib/table/src/body.js +10 -5
  18. package/lib/table/src/body.min.js +1 -1
  19. package/lib/table/src/footer.js +7 -2
  20. package/lib/table/src/footer.min.js +1 -1
  21. package/lib/table/src/table.js +184 -49
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/src/util.js +16 -6
  24. package/lib/table/src/util.min.js +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/package.json +2 -2
  30. package/packages/grid/src/grid.ts +49 -40
  31. package/packages/table/module/keyboard/hook.ts +29 -2
  32. package/packages/table/src/body.ts +10 -5
  33. package/packages/table/src/footer.ts +7 -2
  34. package/packages/table/src/table.ts +167 -50
  35. package/packages/table/src/util.ts +15 -3
  36. /package/es/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
  37. /package/es/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
  38. /package/es/{iconfont.1741224125327.woff2 → iconfont.1741665718304.woff2} +0 -0
  39. /package/lib/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
  40. /package/lib/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
  41. /package/lib/{iconfont.1741224125327.woff2 → iconfont.1741665718304.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -3051,7 +3051,7 @@ function eqEmptyValue(cellValue) {
3051
3051
  ;// ./packages/ui/index.ts
3052
3052
 
3053
3053
 
3054
- const version = "4.11.18";
3054
+ const version = "4.11.20";
3055
3055
  core_.VxeUI.version = version;
3056
3056
  core_.VxeUI.tableVersion = version;
3057
3057
  core_.VxeUI.setConfig({
@@ -3499,7 +3499,7 @@ var es_iterator_some = __webpack_require__(3579);
3499
3499
  const {
3500
3500
  log: log_log
3501
3501
  } = core_.VxeUI;
3502
- const log_version = `table v${"4.11.18"}`;
3502
+ const log_version = `table v${"4.11.20"}`;
3503
3503
  const warnLog = log_log.create('warn', log_version);
3504
3504
  const errLog = log_log.create('error', log_version);
3505
3505
  ;// ./packages/table/src/columnInfo.ts
@@ -3962,16 +3962,17 @@ function getRowkey($xeTable) {
3962
3962
  const {
3963
3963
  computeRowOpts
3964
3964
  } = $xeTable.getComputeMaps();
3965
- const {
3966
- rowId
3967
- } = props;
3968
3965
  const rowOpts = computeRowOpts.value;
3969
- return rowId || rowOpts.keyField || '_X_ROW_KEY';
3966
+ return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
3970
3967
  }
3971
3968
  // 行主键 value
3972
3969
  function getRowid($xeTable, row) {
3973
3970
  const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, getRowkey($xeTable));
3974
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowid) ? '' : encodeURIComponent(rowid);
3971
+ return encodeRowid(rowid);
3972
+ }
3973
+ // 编码行主键
3974
+ function encodeRowid(rowVal) {
3975
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
3975
3976
  }
3976
3977
  const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
3977
3978
  if (fieldOrColumn) {
@@ -3979,6 +3980,13 @@ const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
3979
3980
  }
3980
3981
  return null;
3981
3982
  };
3983
+ const handleRowidOrRow = ($xeTable, rowidOrRow) => {
3984
+ if (rowidOrRow) {
3985
+ const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowidOrRow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
3986
+ return $xeTable.getRowById(rowid);
3987
+ }
3988
+ return null;
3989
+ };
3982
3990
  function getPaddingLeftRightSize(elem) {
3983
3991
  if (elem) {
3984
3992
  const computedStyle = getComputedStyle(elem);
@@ -6375,6 +6383,7 @@ const renderType = 'body';
6375
6383
  tdOns.onDblclick = evnt => {
6376
6384
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
6377
6385
  };
6386
+ let isMergeCell = false;
6378
6387
  // 合并行或列
6379
6388
  if (mergeList.length) {
6380
6389
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -6387,9 +6396,11 @@ const renderType = 'body';
6387
6396
  return null;
6388
6397
  }
6389
6398
  if (rowspan > 1) {
6399
+ isMergeCell = true;
6390
6400
  tdAttrs.rowspan = rowspan;
6391
6401
  }
6392
6402
  if (colspan > 1) {
6403
+ isMergeCell = true;
6393
6404
  tdAttrs.colspan = colspan;
6394
6405
  }
6395
6406
  }
@@ -6424,11 +6435,13 @@ const renderType = 'body';
6424
6435
  const isLastColumn = $columnIndex === columns.length - 1;
6425
6436
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
6426
6437
  let isVNPreEmptyStatus = false;
6427
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
6428
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
6429
- isVNPreEmptyStatus = true;
6430
- } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
6431
- isVNPreEmptyStatus = true;
6438
+ if (!isMergeCell) {
6439
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
6440
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
6441
+ isVNPreEmptyStatus = true;
6442
+ } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
6443
+ isVNPreEmptyStatus = true;
6444
+ }
6432
6445
  }
6433
6446
  }
6434
6447
  const tcStyle = {};
@@ -7618,6 +7631,7 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
7618
7631
  cell: evnt.currentTarget
7619
7632
  }, cellParams), evnt);
7620
7633
  };
7634
+ let isMergeCell = false;
7621
7635
  // 合并行或列
7622
7636
  if (mergeFooterList.length) {
7623
7637
  const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
@@ -7630,9 +7644,11 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
7630
7644
  return null;
7631
7645
  }
7632
7646
  if (rowspan > 1) {
7647
+ isMergeCell = true;
7633
7648
  attrs.rowspan = rowspan;
7634
7649
  }
7635
7650
  if (colspan > 1) {
7651
+ isMergeCell = true;
7636
7652
  attrs.colspan = colspan;
7637
7653
  }
7638
7654
  }
@@ -7655,8 +7671,10 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
7655
7671
  const isLastColumn = $columnIndex === tableColumn.length - 1;
7656
7672
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
7657
7673
  let isVNPreEmptyStatus = false;
7658
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
7659
- isVNPreEmptyStatus = true;
7674
+ if (!isMergeCell) {
7675
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
7676
+ isVNPreEmptyStatus = true;
7677
+ }
7660
7678
  }
7661
7679
  const tcStyle = {};
7662
7680
  if (hasEllipsis) {
@@ -14168,6 +14186,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14168
14186
  };
14169
14187
  tableMethods = {
14170
14188
  dispatchEvent,
14189
+ getEl() {
14190
+ return refElem.value;
14191
+ },
14171
14192
  /**
14172
14193
  * 重置表格的一切数据状态
14173
14194
  */
@@ -14531,6 +14552,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14531
14552
  keepSource,
14532
14553
  treeConfig
14533
14554
  } = props;
14555
+ const {
14556
+ editStore
14557
+ } = reactData;
14534
14558
  const {
14535
14559
  fullAllDataRowIdData,
14536
14560
  fullDataRowIdData,
@@ -14539,6 +14563,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14539
14563
  tableFullData,
14540
14564
  afterFullData
14541
14565
  } = internalData;
14566
+ const removeTempMaps = {
14567
+ ...editStore.removeMaps
14568
+ };
14542
14569
  const treeOpts = computeTreeOpts.value;
14543
14570
  const {
14544
14571
  transform
@@ -14573,6 +14600,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14573
14600
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().destructuring(row, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(oRow, true));
14574
14601
  }
14575
14602
  if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
14603
+ delete removeTempMaps[rowid];
14576
14604
  tableFullData.unshift(row);
14577
14605
  afterFullData.unshift(row);
14578
14606
  reDelFlag = true;
@@ -14584,6 +14612,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14584
14612
  }
14585
14613
  if (rows) {
14586
14614
  if (reDelFlag) {
14615
+ editStore.removeMaps = removeTempMaps;
14587
14616
  $xeTable.updateFooter();
14588
14617
  $xeTable.cacheRowMap(false);
14589
14618
  $xeTable.handleTableData(treeConfig && transform);
@@ -14753,10 +14782,10 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14753
14782
  },
14754
14783
  /**
14755
14784
  * 检查行或列数据是否发生改变
14756
- * @param {Row} row 行对象
14785
+ * @param {Row} rowOrId 行对象
14757
14786
  * @param {String} field 字段名
14758
14787
  */
14759
- isUpdateByRow(row, field) {
14788
+ isUpdateByRow(rowOrId, field) {
14760
14789
  const {
14761
14790
  keepSource
14762
14791
  } = props;
@@ -14766,11 +14795,13 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14766
14795
  sourceDataRowIdData
14767
14796
  } = internalData;
14768
14797
  if (keepSource) {
14769
- const rowid = getRowid($xeTable, row);
14798
+ const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrId) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
14799
+ const rowRest = fullDataRowIdData[rowid];
14770
14800
  // 新增的数据不需要检测
14771
- if (!fullDataRowIdData[rowid]) {
14801
+ if (!rowRest) {
14772
14802
  return false;
14773
14803
  }
14804
+ const row = rowRest.row;
14774
14805
  const oRow = sourceDataRowIdData[rowid];
14775
14806
  if (oRow) {
14776
14807
  if (arguments.length > 1) {
@@ -14834,6 +14865,108 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14834
14865
  tableColumn: reactData.tableColumn.slice(0)
14835
14866
  };
14836
14867
  },
14868
+ /**
14869
+ * 移动列到指定列的位置
14870
+ * @param fieldOrColumn
14871
+ * @param targetFieldOrColumn
14872
+ * @param options
14873
+ */
14874
+ moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
14875
+ const {
14876
+ fullColumnIdData,
14877
+ visibleColumn
14878
+ } = internalData;
14879
+ const {
14880
+ dragToChild,
14881
+ dragPos,
14882
+ isCrossDrag
14883
+ } = Object.assign({}, options);
14884
+ const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
14885
+ let prevDragCol = null;
14886
+ const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
14887
+ let defPos = 'left';
14888
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetFieldOrColumn)) {
14889
+ if (colRest && targetFieldOrColumn) {
14890
+ let currList = colRest.items;
14891
+ let offsetIndex = colRest._index + targetFieldOrColumn;
14892
+ if (isCrossDrag) {
14893
+ currList = visibleColumn;
14894
+ offsetIndex = colRest._index + targetFieldOrColumn;
14895
+ }
14896
+ if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
14897
+ prevDragCol = currList[offsetIndex];
14898
+ }
14899
+ if (targetFieldOrColumn > 0) {
14900
+ defPos = 'right';
14901
+ }
14902
+ }
14903
+ } else {
14904
+ prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
14905
+ const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
14906
+ if (colRest && targetColRest) {
14907
+ if (targetColRest._index > colRest._index) {
14908
+ defPos = 'right';
14909
+ }
14910
+ }
14911
+ }
14912
+ return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
14913
+ },
14914
+ /**
14915
+ * 移动行到指定行的位置
14916
+ * @param rowidOrRow
14917
+ * @param targetRowidOrRow
14918
+ * @param options
14919
+ */
14920
+ moveRowTo(rowidOrRow, targetRowidOrRow, options) {
14921
+ const {
14922
+ treeConfig
14923
+ } = props;
14924
+ const {
14925
+ fullAllDataRowIdData,
14926
+ afterFullData
14927
+ } = internalData;
14928
+ const {
14929
+ dragToChild,
14930
+ dragPos,
14931
+ isCrossDrag
14932
+ } = Object.assign({}, options);
14933
+ const treeOpts = computeTreeOpts.value;
14934
+ const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
14935
+ let prevDragRow = null;
14936
+ let defPos = 'top';
14937
+ const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
14938
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRowidOrRow)) {
14939
+ if (rowRest && targetRowidOrRow) {
14940
+ let currList = afterFullData;
14941
+ let offsetIndex = rowRest._index + targetRowidOrRow;
14942
+ if (treeConfig) {
14943
+ currList = rowRest.items;
14944
+ if (treeOpts.transform) {
14945
+ offsetIndex = rowRest.treeIndex + targetRowidOrRow;
14946
+ if (isCrossDrag) {
14947
+ currList = afterFullData;
14948
+ offsetIndex = rowRest._index + targetRowidOrRow;
14949
+ }
14950
+ }
14951
+ }
14952
+ if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
14953
+ prevDragRow = currList[offsetIndex];
14954
+ }
14955
+ if (targetRowidOrRow > 0) {
14956
+ defPos = 'bottom';
14957
+ }
14958
+ }
14959
+ } else {
14960
+ prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
14961
+ const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
14962
+ if (rowRest && targetRowRest) {
14963
+ if (targetRowRest._index > rowRest._index) {
14964
+ defPos = 'bottom';
14965
+ }
14966
+ }
14967
+ }
14968
+ return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
14969
+ },
14837
14970
  /**
14838
14971
  * 获取表格的全量列
14839
14972
  */
@@ -17312,8 +17445,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
17312
17445
  // 如果按下了方向键
17313
17446
  if (selected.row && selected.column) {
17314
17447
  $xeTable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
17315
- } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
17316
- // 当前行按键上下移动
17448
+ }
17449
+ // 当前行按键上下移动
17450
+ if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
17317
17451
  $xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
17318
17452
  }
17319
17453
  }
@@ -19603,6 +19737,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19603
19737
  } = internalData;
19604
19738
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
19605
19739
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
19740
+ const errRest = {
19741
+ status: false
19742
+ };
19606
19743
  if (prevDragRow && dragRow) {
19607
19744
  // 判断是否有拖动
19608
19745
  if (prevDragRow !== dragRow) {
@@ -19617,7 +19754,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19617
19754
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
19618
19755
  return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
19619
19756
  if (!status) {
19620
- return;
19757
+ return errRest;
19621
19758
  }
19622
19759
  let oafIndex = -1;
19623
19760
  let nafIndex = -1;
@@ -19648,11 +19785,11 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19648
19785
  if (isPeerDrag && !isCrossDrag) {
19649
19786
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
19650
19787
  // 非同级
19651
- return;
19788
+ return errRest;
19652
19789
  }
19653
19790
  } else {
19654
19791
  if (!isCrossDrag) {
19655
- return;
19792
+ return errRest;
19656
19793
  }
19657
19794
  if (oldAllMaps[newRowid]) {
19658
19795
  isSelfToChildStatus = true;
@@ -19663,19 +19800,19 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19663
19800
  content: table_getI18n('vxe.error.treeDragChild')
19664
19801
  });
19665
19802
  }
19666
- return;
19803
+ return errRest;
19667
19804
  }
19668
19805
  }
19669
19806
  }
19670
19807
  } else if (oldLevel) {
19671
19808
  // 子到根
19672
19809
  if (!isCrossDrag) {
19673
- return;
19810
+ return errRest;
19674
19811
  }
19675
19812
  } else if (newLevel) {
19676
19813
  // 根到子
19677
19814
  if (!isCrossDrag) {
19678
- return;
19815
+ return errRest;
19679
19816
  }
19680
19817
  if (oldAllMaps[newRowid]) {
19681
19818
  isSelfToChildStatus = true;
@@ -19686,7 +19823,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19686
19823
  content: table_getI18n('vxe.error.treeDragChild')
19687
19824
  });
19688
19825
  }
19689
- return;
19826
+ return errRest;
19690
19827
  }
19691
19828
  }
19692
19829
  } else {
@@ -19744,26 +19881,34 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19744
19881
  if (reactData.scrollYLoad) {
19745
19882
  $xeTable.updateScrollYSpace();
19746
19883
  }
19747
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
19884
+ if (evnt) {
19885
+ dispatchEvent('row-dragend', {
19886
+ oldRow: dragRow,
19887
+ newRow: prevDragRow,
19888
+ dragRow,
19889
+ dragPos: prevDragPos,
19890
+ dragToChild: isDragToChildFlag,
19891
+ offsetIndex: dragOffsetIndex,
19892
+ _index: {
19893
+ newIndex: nafIndex,
19894
+ oldIndex: oafIndex
19895
+ }
19896
+ }, evnt);
19897
+ }
19898
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
19748
19899
  $xeTable.updateCellAreas();
19749
19900
  $xeTable.recalculate();
19901
+ }).then(() => {
19902
+ return {
19903
+ status: true
19904
+ };
19750
19905
  });
19751
- dispatchEvent('row-dragend', {
19752
- oldRow: dragRow,
19753
- newRow: prevDragRow,
19754
- dragRow,
19755
- dragPos: prevDragPos,
19756
- dragToChild: isDragToChildFlag,
19757
- offsetIndex: dragOffsetIndex,
19758
- _index: {
19759
- newIndex: nafIndex,
19760
- oldIndex: oafIndex
19761
- }
19762
- }, evnt);
19763
- }).catch(() => {});
19906
+ }).catch(() => {
19907
+ return errRest;
19908
+ });
19764
19909
  }
19765
19910
  }
19766
- return Promise.resolve();
19911
+ return Promise.resolve(errRest);
19767
19912
  },
19768
19913
  handleRowDragDragendEvent(evnt) {
19769
19914
  const {
@@ -19931,6 +20076,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19931
20076
  collectColumn
19932
20077
  } = internalData;
19933
20078
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
20079
+ const errRest = {
20080
+ status: false
20081
+ };
19934
20082
  if (prevDragCol && dragCol) {
19935
20083
  // 判断是否有拖动
19936
20084
  if (prevDragCol !== dragCol) {
@@ -19947,7 +20095,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19947
20095
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
19948
20096
  return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
19949
20097
  if (!status) {
19950
- return;
20098
+ return errRest;
19951
20099
  }
19952
20100
  let oafIndex = -1;
19953
20101
  let nafIndex = -1;
@@ -19961,11 +20109,11 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19961
20109
  if (isPeerDrag && !isCrossDrag) {
19962
20110
  if (dragColumn.parentId !== newColumn.parentId) {
19963
20111
  // 非同级
19964
- return;
20112
+ return errRest;
19965
20113
  }
19966
20114
  } else {
19967
20115
  if (!isCrossDrag) {
19968
- return;
20116
+ return errRest;
19969
20117
  }
19970
20118
  if (oldAllMaps[newColumn.id]) {
19971
20119
  isSelfToChildStatus = true;
@@ -19976,19 +20124,19 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19976
20124
  content: table_getI18n('vxe.error.treeDragChild')
19977
20125
  });
19978
20126
  }
19979
- return;
20127
+ return errRest;
19980
20128
  }
19981
20129
  }
19982
20130
  }
19983
20131
  } else if (dragColumn.parentId) {
19984
20132
  // 子到根
19985
20133
  if (!isCrossDrag) {
19986
- return;
20134
+ return errRest;
19987
20135
  }
19988
20136
  } else if (newColumn.parentId) {
19989
20137
  // 根到子
19990
20138
  if (!isCrossDrag) {
19991
- return;
20139
+ return errRest;
19992
20140
  }
19993
20141
  if (oldAllMaps[newColumn.id]) {
19994
20142
  isSelfToChildStatus = true;
@@ -19999,7 +20147,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
19999
20147
  content: table_getI18n('vxe.error.treeDragChild')
20000
20148
  });
20001
20149
  }
20002
- return;
20150
+ return errRest;
20003
20151
  }
20004
20152
  }
20005
20153
  } else {
@@ -20068,25 +20216,32 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
20068
20216
  $xeTable.clearCopyCellArea();
20069
20217
  }
20070
20218
  }
20071
- dispatchEvent('column-dragend', {
20072
- oldColumn: dragColumn,
20073
- newColumn,
20074
- dragColumn,
20075
- dragPos: prevDragPos,
20076
- dragToChild: isDragToChildFlag,
20077
- offsetIndex: dragOffsetIndex,
20078
- _index: {
20079
- newIndex: nafIndex,
20080
- oldIndex: oafIndex
20081
- }
20082
- }, evnt);
20219
+ if (evnt) {
20220
+ dispatchEvent('column-dragend', {
20221
+ oldColumn: dragColumn,
20222
+ newColumn,
20223
+ dragColumn,
20224
+ dragPos: prevDragPos,
20225
+ dragToChild: isDragToChildFlag,
20226
+ offsetIndex: dragOffsetIndex,
20227
+ _index: {
20228
+ newIndex: nafIndex,
20229
+ oldIndex: oafIndex
20230
+ }
20231
+ }, evnt);
20232
+ }
20083
20233
  if (isSyncColumn) {
20084
20234
  $xeTable.handleColDragSwapColumn();
20085
20235
  }
20086
- }).catch(() => {});
20236
+ return {
20237
+ status: true
20238
+ };
20239
+ }).catch(() => {
20240
+ return errRest;
20241
+ });
20087
20242
  }
20088
20243
  }
20089
- return Promise.resolve();
20244
+ return Promise.resolve(errRest);
20090
20245
  },
20091
20246
  handleHeaderCellDragDragendEvent(evnt) {
20092
20247
  const {
@@ -26357,7 +26512,6 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
26357
26512
  const treeOpts = computeTreeOpts.value;
26358
26513
  const childrenField = treeOpts.children || treeOpts.childrenField;
26359
26514
  let targetRow;
26360
- evnt.preventDefault();
26361
26515
  if (currentRow) {
26362
26516
  if (treeConfig) {
26363
26517
  const {
@@ -26383,6 +26537,7 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
26383
26537
  targetRow = afterFullData[0];
26384
26538
  }
26385
26539
  if (targetRow) {
26540
+ evnt.preventDefault();
26386
26541
  const params = {
26387
26542
  $table: $xeTable,
26388
26543
  row: targetRow,
@@ -26392,6 +26547,36 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
26392
26547
  $xeTable.scrollToRow(targetRow).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
26393
26548
  }
26394
26549
  },
26550
+ // 处理当前列方向键移动
26551
+ moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
26552
+ const {
26553
+ currentColumn
26554
+ } = reactData;
26555
+ const {
26556
+ visibleColumn
26557
+ } = internalData;
26558
+ let targetCol = null;
26559
+ if (currentColumn) {
26560
+ const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
26561
+ if (isLeftArrow && _columnIndex > 0) {
26562
+ targetCol = visibleColumn[_columnIndex - 1];
26563
+ } else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
26564
+ targetCol = visibleColumn[_columnIndex + 1];
26565
+ }
26566
+ } else {
26567
+ targetCol = visibleColumn[0];
26568
+ }
26569
+ if (targetCol) {
26570
+ evnt.preventDefault();
26571
+ const params = {
26572
+ $table: $xeTable,
26573
+ column: targetCol,
26574
+ columnIndex: $xeTable.getColumnIndex(targetCol),
26575
+ $columnIndex: $xeTable.getVMColumnIndex(targetCol)
26576
+ };
26577
+ $xeTable.scrollToColumn(targetCol).then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
26578
+ }
26579
+ },
26395
26580
  // 处理可编辑方向键移动
26396
26581
  moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
26397
26582
  const {
@@ -29369,7 +29554,7 @@ const {
29369
29554
  renderEmptyElement: grid_renderEmptyElement
29370
29555
  } = core_.VxeUI;
29371
29556
  const tableComponentPropKeys = Object.keys(src_props);
29372
- const tableComponentMethodKeys = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'getPendingRecords', 'clearPendingRow', 'sort', 'setSort', 'clearSort', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'openTooltip', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect'];
29557
+ const tableComponentMethodKeys = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isRemoveByRow', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'getPendingRecords', 'clearPendingRow', 'sort', 'setSort', 'clearSort', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'openTooltip', 'moveColumnTo', 'moveRowTo', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect'];
29373
29558
  const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'proxy-query', 'proxy-delete', 'proxy-save', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
29374
29559
  /* harmony default export */ var grid = ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
29375
29560
  name: 'VxeGrid',
@@ -29843,6 +30028,23 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
29843
30028
  }
29844
30029
  return null;
29845
30030
  };
30031
+ const getConfigSlot = slotConfigs => {
30032
+ const slotConf = {};
30033
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectMap(slotConfigs, (slotFunc, slotKey) => {
30034
+ if (slotFunc) {
30035
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
30036
+ if (slots[slotFunc]) {
30037
+ slotConf[slotKey] = slots[slotFunc];
30038
+ } else {
30039
+ errLog('vxe.error.notSlot', [slotFunc]);
30040
+ }
30041
+ } else {
30042
+ slotConf[slotKey] = slotFunc;
30043
+ }
30044
+ }
30045
+ });
30046
+ return slotConf;
30047
+ };
29846
30048
  /**
29847
30049
  * 渲染表单
29848
30050
  */
@@ -30056,43 +30258,22 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
30056
30258
  } = props;
30057
30259
  const proxyOpts = computeProxyOpts.value;
30058
30260
  const pagerOpts = computePagerOpts.value;
30261
+ const pagerSlot = slots.pager;
30059
30262
  if (pagerConfig && isEnableConf(pagerOpts) || slots.pager) {
30060
- let slotVNs = [];
30061
- if (slots.pager) {
30062
- slotVNs = slots.pager({
30063
- $grid: $xeGrid
30064
- });
30065
- } else {
30066
- const pagerOptSlots = pagerOpts.slots;
30067
- const pagerSlots = {};
30068
- let leftSlot;
30069
- let rightSlot;
30070
- if (pagerOptSlots) {
30071
- leftSlot = getFuncSlot(pagerOptSlots, 'left');
30072
- rightSlot = getFuncSlot(pagerOptSlots, 'right');
30073
- if (leftSlot) {
30074
- pagerSlots.left = leftSlot;
30075
- }
30076
- if (rightSlot) {
30077
- pagerSlots.right = rightSlot;
30078
- }
30079
- }
30080
- if (VxeUIPagerComponent) {
30081
- slotVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(VxeUIPagerComponent, {
30082
- ref: refPager,
30083
- ...pagerOpts,
30084
- ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {}),
30085
- onPageChange: pageChangeEvent
30086
- }, pagerSlots));
30087
- }
30088
- }
30089
30263
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
30090
30264
  ref: refPagerWrapper,
30091
30265
  key: 'pager',
30092
30266
  class: 'vxe-grid--pager-wrapper'
30093
- }, slotVNs);
30267
+ }, pagerSlot ? pagerSlot({
30268
+ $grid: $xeGrid
30269
+ }) : [VxeUIPagerComponent ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(VxeUIPagerComponent, {
30270
+ ref: refPager,
30271
+ ...pagerOpts,
30272
+ ...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {}),
30273
+ onPageChange: pageChangeEvent
30274
+ }, getConfigSlot(pagerOpts.slots)) : grid_renderEmptyElement($xeGrid)]);
30094
30275
  }
30095
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)();
30276
+ return grid_renderEmptyElement($xeGrid);
30096
30277
  };
30097
30278
  const renderChildLayout = layoutKeys => {
30098
30279
  const childVNs = [];
@@ -30218,6 +30399,9 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
30218
30399
  };
30219
30400
  const gridMethods = {
30220
30401
  dispatchEvent,
30402
+ getEl() {
30403
+ return refElem.value;
30404
+ },
30221
30405
  /**
30222
30406
  * 提交指令,支持 code 或 button
30223
30407
  * @param {String/Object} code 字符串或对象
@@ -30757,18 +30941,23 @@ const gridComponentEmits = [...emits, 'page-change', 'form-submit', 'form-submit
30757
30941
  isZMax
30758
30942
  } = reactData;
30759
30943
  const el = refElem.value;
30760
- const formWrapper = refFormWrapper.value;
30761
- const toolbarWrapper = refToolbarWrapper.value;
30762
- const topWrapper = refTopWrapper.value;
30763
- const bottomWrapper = refBottomWrapper.value;
30764
- const pagerWrapper = refPagerWrapper.value;
30765
- const parentPaddingSize = isZMax ? 0 : getPaddingTopBottomSize(el.parentNode);
30766
- return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
30944
+ if (el) {
30945
+ const formWrapper = refFormWrapper.value;
30946
+ const toolbarWrapper = refToolbarWrapper.value;
30947
+ const topWrapper = refTopWrapper.value;
30948
+ const bottomWrapper = refBottomWrapper.value;
30949
+ const pagerWrapper = refPagerWrapper.value;
30950
+ const parentEl = el.parentElement;
30951
+ const parentPaddingSize = isZMax ? 0 : parentEl ? getPaddingTopBottomSize(parentEl) : 0;
30952
+ return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
30953
+ }
30954
+ return 0;
30767
30955
  },
30768
30956
  getParentHeight() {
30769
30957
  const el = refElem.value;
30770
30958
  if (el) {
30771
- return (reactData.isZMax ? getDomNode().visibleHeight : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(el.parentNode).height)) - gridPrivateMethods.getExcludeHeight();
30959
+ const parentEl = el.parentElement;
30960
+ return (reactData.isZMax ? getDomNode().visibleHeight : parentEl ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(parentEl).height) : 0) - gridPrivateMethods.getExcludeHeight();
30772
30961
  }
30773
30962
  return 0;
30774
30963
  },