vxe-table 3.13.18 → 3.13.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 +4 -0
  2. package/es/style.css +1 -1
  3. package/es/table/render/index.js +88 -57
  4. package/es/table/src/body.js +11 -6
  5. package/es/table/src/footer.js +7 -2
  6. package/es/table/src/methods.js +222 -77
  7. package/es/table/src/util.js +18 -5
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/grid/src/grid.js +4 -0
  11. package/lib/grid/src/grid.min.js +1 -1
  12. package/lib/index.umd.js +384 -164
  13. package/lib/index.umd.min.js +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/table/render/index.js +96 -62
  16. package/lib/table/render/index.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/methods.js +247 -88
  22. package/lib/table/src/methods.min.js +1 -1
  23. package/lib/table/src/util.js +21 -5
  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 +5 -0
  31. package/packages/table/render/index.ts +87 -55
  32. package/packages/table/src/body.ts +10 -5
  33. package/packages/table/src/footer.ts +7 -2
  34. package/packages/table/src/methods.ts +242 -84
  35. package/packages/table/src/util.ts +20 -5
  36. /package/es/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
  37. /package/es/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
  38. /package/es/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
  39. /package/lib/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
  40. /package/lib/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
  41. /package/lib/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -3201,7 +3201,7 @@ function getClass(property, params) {
3201
3201
  ;// ./packages/ui/index.ts
3202
3202
 
3203
3203
 
3204
- const version = "3.13.18";
3204
+ const version = "3.13.20";
3205
3205
  core_.VxeUI.version = version;
3206
3206
  core_.VxeUI.tableVersion = version;
3207
3207
  core_.VxeUI.setConfig({
@@ -3828,7 +3828,7 @@ var es_iterator_map = __webpack_require__(1701);
3828
3828
  const {
3829
3829
  log: log_log
3830
3830
  } = core_.VxeUI;
3831
- const log_version = `table v${"3.13.18"}`;
3831
+ const log_version = `table v${"3.13.20"}`;
3832
3832
  const warnLog = log_log.create('warn', log_version);
3833
3833
  const errLog = log_log.create('error', log_version);
3834
3834
  ;// ./packages/table/src/columnInfo.ts
@@ -4100,13 +4100,19 @@ function getRowUniqueId() {
4100
4100
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('row_');
4101
4101
  }
4102
4102
  // 行主键 key
4103
- function getRowkey($xetable) {
4104
- return $xetable.rowOpts.keyField || $xetable.rowId || '_X_ROW_KEY';
4103
+ function getRowkey($xeTable) {
4104
+ const props = $xeTable;
4105
+ const rowOpts = $xeTable.computeRowOpts;
4106
+ return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
4105
4107
  }
4106
4108
  // 行主键 value
4107
4109
  function getRowid($xetable, row) {
4108
4110
  const rowid = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, getRowkey($xetable));
4109
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowid) ? '' : encodeURIComponent(rowid);
4111
+ return encodeRowid(rowid);
4112
+ }
4113
+ // 编码行主键
4114
+ function encodeRowid(rowVal) {
4115
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
4110
4116
  }
4111
4117
  function getPaddingLeftRightSize(elem) {
4112
4118
  if (elem) {
@@ -4132,12 +4138,19 @@ function getCellHeight(height) {
4132
4138
  }
4133
4139
  return height || 0;
4134
4140
  }
4135
- function handleFieldOrColumn(_vm, fieldOrColumn) {
4141
+ function handleFieldOrColumn($xeTable, fieldOrColumn) {
4136
4142
  if (fieldOrColumn) {
4137
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(fieldOrColumn) ? _vm.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
4143
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
4138
4144
  }
4139
4145
  return null;
4140
4146
  }
4147
+ const handleRowidOrRow = ($xeTable, rowidOrRow) => {
4148
+ if (rowidOrRow) {
4149
+ 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);
4150
+ return $xeTable.getRowById(rowid);
4151
+ }
4152
+ return null;
4153
+ };
4141
4154
  // 组装列配置
4142
4155
  function assembleColumn(_vm) {
4143
4156
  const {
@@ -8613,6 +8626,10 @@ const Methods = {
8613
8626
  }
8614
8627
  return [];
8615
8628
  },
8629
+ getEl() {
8630
+ const $xeTable = this;
8631
+ return $xeTable.$refs.refElem;
8632
+ },
8616
8633
  /**
8617
8634
  * 获取父容器元素
8618
8635
  */
@@ -8627,14 +8644,27 @@ const Methods = {
8627
8644
  * 获取父容器的高度
8628
8645
  */
8629
8646
  getParentHeight() {
8647
+ const $xeTable = this;
8648
+ const $xeGrid = $xeTable.$xeGrid;
8649
+ const props = $xeTable;
8630
8650
  const {
8631
- $el,
8632
- $xegrid,
8633
8651
  height
8634
- } = this;
8635
- const parentElem = $el.parentNode;
8636
- const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
8637
- return Math.floor($xegrid ? $xegrid.getParentHeight() : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(parentElem).height) - parentPaddingSize);
8652
+ } = props;
8653
+ const el = $xeTable.$refs.refElem;
8654
+ if (el) {
8655
+ const parentElem = el.parentNode;
8656
+ const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
8657
+ let parentWrapperHeight = 0;
8658
+ if (parentElem) {
8659
+ if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
8660
+ parentWrapperHeight = $xeGrid.getParentHeight();
8661
+ } else {
8662
+ parentWrapperHeight = parentElem.clientHeight;
8663
+ }
8664
+ }
8665
+ return Math.floor(parentWrapperHeight - parentPaddingSize);
8666
+ }
8667
+ return 0;
8638
8668
  },
8639
8669
  /**
8640
8670
  * 获取需要排除的高度
@@ -8837,7 +8867,7 @@ const Methods = {
8837
8867
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
8838
8868
  // }
8839
8869
  if (this.spanMethod) {
8840
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
8870
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
8841
8871
  }
8842
8872
  }
8843
8873
  handleReserveStatus($xeTable);
@@ -9475,6 +9505,7 @@ const Methods = {
9475
9505
  } = props;
9476
9506
  const {
9477
9507
  fullAllDataRowIdData,
9508
+ fullDataRowIdData,
9478
9509
  tableSourceData,
9479
9510
  sourceDataRowIdData,
9480
9511
  tableFullData,
@@ -9486,7 +9517,7 @@ const Methods = {
9486
9517
  } = treeOpts;
9487
9518
  if (!keepSource) {
9488
9519
  if (true) {
9489
- warnLog('vxe.error.reqProp', ['keep-source']);
9520
+ errLog('vxe.error.reqProp', ['keep-source']);
9490
9521
  }
9491
9522
  return $xeTable.$nextTick();
9492
9523
  }
@@ -9500,22 +9531,22 @@ const Methods = {
9500
9531
  }
9501
9532
  let reDelFlag = false;
9502
9533
  if (targetRows.length) {
9503
- targetRows.forEach(row => {
9504
- if (!$xeTable.isInsertByRow(row)) {
9505
- const rowid = getRowid($xeTable, row);
9506
- const oRow = sourceDataRowIdData[rowid];
9507
- if (oRow && row) {
9508
- if (field) {
9509
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(oRow, field), true));
9510
- } else {
9511
- 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));
9512
- }
9513
- if ($xeTable.isRemoveByRow(row)) {
9514
- const rowRest = fullAllDataRowIdData[rowid];
9515
- if (rowRest) {
9516
- const reRow = rowRest.row;
9517
- tableFullData.unshift(reRow);
9518
- afterFullData.unshift(reRow);
9534
+ targetRows.forEach(item => {
9535
+ const rowid = getRowid($xeTable, item);
9536
+ const rowRest = fullAllDataRowIdData[rowid];
9537
+ if (rowRest) {
9538
+ const row = rowRest.row;
9539
+ if (!$xeTable.isInsertByRow(row)) {
9540
+ const oRow = sourceDataRowIdData[rowid];
9541
+ if (oRow && row) {
9542
+ if (field) {
9543
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, field, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(oRow, field), true));
9544
+ } else {
9545
+ 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));
9546
+ }
9547
+ if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
9548
+ tableFullData.unshift(row);
9549
+ afterFullData.unshift(row);
9519
9550
  reDelFlag = true;
9520
9551
  }
9521
9552
  }
@@ -9703,25 +9734,31 @@ const Methods = {
9703
9734
  },
9704
9735
  /**
9705
9736
  * 检查行或列数据是否发生改变
9706
- * @param {Row} row 行对象
9737
+ * @param {Row} rowOrId 行对象
9707
9738
  * @param {String} field 字段名
9708
9739
  */
9709
- isUpdateByRow(row, field) {
9740
+ isUpdateByRow(rowOrId, field) {
9741
+ const $xeTable = this;
9742
+ const props = $xeTable;
9743
+ const internalData = $xeTable;
9744
+ const {
9745
+ keepSource
9746
+ } = props;
9710
9747
  const {
9711
9748
  tableFullColumn,
9712
- keepSource,
9713
- sourceDataRowIdData,
9714
- fullDataRowIdData
9715
- } = this;
9749
+ fullDataRowIdData,
9750
+ sourceDataRowIdData
9751
+ } = internalData;
9716
9752
  if (keepSource) {
9717
- const rowid = getRowid(this, row);
9753
+ 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);
9754
+ const rowRest = fullDataRowIdData[rowid];
9718
9755
  // 新增的数据不需要检测
9719
- if (!fullDataRowIdData[rowid]) {
9756
+ if (!rowRest) {
9720
9757
  return false;
9721
9758
  }
9722
- const oldRest = sourceDataRowIdData[rowid];
9723
- if (oldRest) {
9724
- const oRow = oldRest.row;
9759
+ const row = rowRest.row;
9760
+ const oRow = sourceDataRowIdData[rowid];
9761
+ if (oRow) {
9725
9762
  if (arguments.length > 1) {
9726
9763
  return !eqCellValue(oRow, row, field);
9727
9764
  }
@@ -9783,6 +9820,113 @@ const Methods = {
9783
9820
  tableColumn: this.tableColumn.slice(0)
9784
9821
  };
9785
9822
  },
9823
+ /**
9824
+ * 移动列到指定列的位置
9825
+ * @param fieldOrColumn
9826
+ * @param targetFieldOrColumn
9827
+ * @param options
9828
+ */
9829
+ moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
9830
+ const $xeTable = this;
9831
+ const internalData = $xeTable;
9832
+ const {
9833
+ fullColumnIdData,
9834
+ visibleColumn
9835
+ } = internalData;
9836
+ const {
9837
+ dragToChild,
9838
+ dragPos,
9839
+ isCrossDrag
9840
+ } = Object.assign({}, options);
9841
+ const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
9842
+ let prevDragCol = null;
9843
+ const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
9844
+ let defPos = 'left';
9845
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetFieldOrColumn)) {
9846
+ if (colRest && targetFieldOrColumn) {
9847
+ let currList = colRest.items;
9848
+ let offsetIndex = colRest._index + targetFieldOrColumn;
9849
+ if (isCrossDrag) {
9850
+ currList = visibleColumn;
9851
+ offsetIndex = colRest._index + targetFieldOrColumn;
9852
+ }
9853
+ if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
9854
+ prevDragCol = currList[offsetIndex];
9855
+ }
9856
+ if (targetFieldOrColumn > 0) {
9857
+ defPos = 'right';
9858
+ }
9859
+ }
9860
+ } else {
9861
+ prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
9862
+ const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
9863
+ if (colRest && targetColRest) {
9864
+ if (targetColRest._index > colRest._index) {
9865
+ defPos = 'right';
9866
+ }
9867
+ }
9868
+ }
9869
+ return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
9870
+ },
9871
+ /**
9872
+ * 移动行到指定行的位置
9873
+ * @param rowidOrRow
9874
+ * @param targetRowidOrRow
9875
+ * @param options
9876
+ */
9877
+ moveRowTo(rowidOrRow, targetRowidOrRow, options) {
9878
+ const $xeTable = this;
9879
+ const props = $xeTable;
9880
+ const internalData = $xeTable;
9881
+ const {
9882
+ treeConfig
9883
+ } = props;
9884
+ const {
9885
+ fullAllDataRowIdData,
9886
+ afterFullData
9887
+ } = internalData;
9888
+ const {
9889
+ dragToChild,
9890
+ dragPos,
9891
+ isCrossDrag
9892
+ } = Object.assign({}, options);
9893
+ const treeOpts = $xeTable.computeTreeOpts;
9894
+ const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
9895
+ let prevDragRow = null;
9896
+ let defPos = 'top';
9897
+ const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
9898
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRowidOrRow)) {
9899
+ if (rowRest && targetRowidOrRow) {
9900
+ let currList = afterFullData;
9901
+ let offsetIndex = rowRest._index + targetRowidOrRow;
9902
+ if (treeConfig) {
9903
+ currList = rowRest.items;
9904
+ if (treeOpts.transform) {
9905
+ offsetIndex = rowRest.treeIndex + targetRowidOrRow;
9906
+ if (isCrossDrag) {
9907
+ currList = afterFullData;
9908
+ offsetIndex = rowRest._index + targetRowidOrRow;
9909
+ }
9910
+ }
9911
+ }
9912
+ if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
9913
+ prevDragRow = currList[offsetIndex];
9914
+ }
9915
+ if (targetRowidOrRow > 0) {
9916
+ defPos = 'bottom';
9917
+ }
9918
+ }
9919
+ } else {
9920
+ prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
9921
+ const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
9922
+ if (rowRest && targetRowRest) {
9923
+ if (targetRowRest._index > rowRest._index) {
9924
+ defPos = 'bottom';
9925
+ }
9926
+ }
9927
+ }
9928
+ return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
9929
+ },
9786
9930
  /**
9787
9931
  * 获取表格的全量列
9788
9932
  */
@@ -9805,16 +9949,26 @@ const Methods = {
9805
9949
  * 用于多选行,获取已选中的数据
9806
9950
  */
9807
9951
  getCheckboxRecords(isFull) {
9952
+ const $xeTable = this;
9953
+ const props = $xeTable;
9954
+ const reactData = $xeTable;
9955
+ const internalData = $xeTable;
9956
+ const {
9957
+ treeConfig
9958
+ } = props;
9959
+ const {
9960
+ selectCheckboxMaps
9961
+ } = reactData;
9808
9962
  const {
9809
9963
  tableFullData,
9810
9964
  afterFullData,
9811
- treeConfig,
9812
- treeOpts,
9813
- checkboxOpts,
9814
- tableFullTreeData,
9815
9965
  afterTreeFullData,
9966
+ tableFullTreeData,
9967
+ fullDataRowIdData,
9816
9968
  afterFullRowMaps
9817
- } = this;
9969
+ } = internalData;
9970
+ const treeOpts = $xeTable.computeTreeOpts;
9971
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
9818
9972
  const {
9819
9973
  transform,
9820
9974
  mapChildrenField
@@ -9823,21 +9977,18 @@ const Methods = {
9823
9977
  checkField
9824
9978
  } = checkboxOpts;
9825
9979
  const childrenField = treeOpts.children || treeOpts.childrenField;
9826
- const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
9827
9980
  let rowList = [];
9828
9981
  if (checkField) {
9829
9982
  if (treeConfig) {
9983
+ const currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
9830
9984
  rowList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().filterTree(currTableData, row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField), {
9831
9985
  children: transform ? mapChildrenField : childrenField
9832
9986
  });
9833
9987
  } else {
9988
+ const currTableData = isFull ? tableFullData : afterFullData;
9834
9989
  rowList = currTableData.filter(row => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField));
9835
9990
  }
9836
9991
  } else {
9837
- const {
9838
- selectCheckboxMaps,
9839
- fullDataRowIdData
9840
- } = this;
9841
9992
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(selectCheckboxMaps, (row, rowid) => {
9842
9993
  if (isFull) {
9843
9994
  if (fullDataRowIdData[rowid]) {
@@ -13609,6 +13760,9 @@ const Methods = {
13609
13760
  } = internalData;
13610
13761
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
13611
13762
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
13763
+ const errRest = {
13764
+ status: false
13765
+ };
13612
13766
  if (prevDragRow && dragRow) {
13613
13767
  // 判断是否有拖动
13614
13768
  if (prevDragRow !== dragRow) {
@@ -13623,7 +13777,7 @@ const Methods = {
13623
13777
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
13624
13778
  return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
13625
13779
  if (!status) {
13626
- return;
13780
+ return errRest;
13627
13781
  }
13628
13782
  let oafIndex = -1;
13629
13783
  let nafIndex = -1;
@@ -13654,11 +13808,11 @@ const Methods = {
13654
13808
  if (isPeerDrag && !isCrossDrag) {
13655
13809
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
13656
13810
  // 非同级
13657
- return;
13811
+ return errRest;
13658
13812
  }
13659
13813
  } else {
13660
13814
  if (!isCrossDrag) {
13661
- return;
13815
+ return errRest;
13662
13816
  }
13663
13817
  if (oldAllMaps[newRowid]) {
13664
13818
  isSelfToChildStatus = true;
@@ -13669,19 +13823,19 @@ const Methods = {
13669
13823
  content: methods_getI18n('vxe.error.treeDragChild')
13670
13824
  });
13671
13825
  }
13672
- return;
13826
+ return errRest;
13673
13827
  }
13674
13828
  }
13675
13829
  }
13676
13830
  } else if (oldLevel) {
13677
13831
  // 子到根
13678
13832
  if (!isCrossDrag) {
13679
- return;
13833
+ return errRest;
13680
13834
  }
13681
13835
  } else if (newLevel) {
13682
13836
  // 根到子
13683
13837
  if (!isCrossDrag) {
13684
- return;
13838
+ return errRest;
13685
13839
  }
13686
13840
  if (oldAllMaps[newRowid]) {
13687
13841
  isSelfToChildStatus = true;
@@ -13692,7 +13846,7 @@ const Methods = {
13692
13846
  content: methods_getI18n('vxe.error.treeDragChild')
13693
13847
  });
13694
13848
  }
13695
- return;
13849
+ return errRest;
13696
13850
  }
13697
13851
  }
13698
13852
  } else {
@@ -13750,26 +13904,34 @@ const Methods = {
13750
13904
  if (reactData.scrollYLoad) {
13751
13905
  $xeTable.updateScrollYSpace();
13752
13906
  }
13753
- $xeTable.$nextTick().then(() => {
13907
+ if (evnt) {
13908
+ $xeTable.dispatchEvent('row-dragend', {
13909
+ oldRow: dragRow,
13910
+ newRow: prevDragRow,
13911
+ dragRow,
13912
+ dragPos: prevDragPos,
13913
+ dragToChild: isDragToChildFlag,
13914
+ offsetIndex: dragOffsetIndex,
13915
+ _index: {
13916
+ newIndex: nafIndex,
13917
+ oldIndex: oafIndex
13918
+ }
13919
+ }, evnt);
13920
+ }
13921
+ return $xeTable.$nextTick().then(() => {
13754
13922
  $xeTable.updateCellAreas();
13755
13923
  $xeTable.recalculate();
13924
+ }).then(() => {
13925
+ return {
13926
+ status: true
13927
+ };
13756
13928
  });
13757
- $xeTable.dispatchEvent('row-dragend', {
13758
- oldRow: dragRow,
13759
- newRow: prevDragRow,
13760
- dragRow,
13761
- dragPos: prevDragPos,
13762
- dragToChild: isDragToChildFlag,
13763
- offsetIndex: dragOffsetIndex,
13764
- _index: {
13765
- newIndex: nafIndex,
13766
- oldIndex: oafIndex
13767
- }
13768
- }, evnt);
13769
- }).catch(() => {});
13929
+ }).catch(() => {
13930
+ return errRest;
13931
+ });
13770
13932
  }
13771
13933
  }
13772
- return Promise.resolve();
13934
+ return Promise.resolve(errRest);
13773
13935
  },
13774
13936
  handleRowDragDragendEvent(evnt) {
13775
13937
  const $xeTable = this;
@@ -13955,6 +14117,9 @@ const Methods = {
13955
14117
  collectColumn
13956
14118
  } = internalData;
13957
14119
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
14120
+ const errRest = {
14121
+ status: false
14122
+ };
13958
14123
  if (prevDragCol && dragCol) {
13959
14124
  // 判断是否有拖动
13960
14125
  if (prevDragCol !== dragCol) {
@@ -13971,7 +14136,7 @@ const Methods = {
13971
14136
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
13972
14137
  return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
13973
14138
  if (!status) {
13974
- return;
14139
+ return errRest;
13975
14140
  }
13976
14141
  let oafIndex = -1;
13977
14142
  let nafIndex = -1;
@@ -13985,11 +14150,11 @@ const Methods = {
13985
14150
  if (isPeerDrag && !isCrossDrag) {
13986
14151
  if (dragColumn.parentId !== newColumn.parentId) {
13987
14152
  // 非同级
13988
- return;
14153
+ return errRest;
13989
14154
  }
13990
14155
  } else {
13991
14156
  if (!isCrossDrag) {
13992
- return;
14157
+ return errRest;
13993
14158
  }
13994
14159
  if (oldAllMaps[newColumn.id]) {
13995
14160
  isSelfToChildStatus = true;
@@ -14000,19 +14165,19 @@ const Methods = {
14000
14165
  content: methods_getI18n('vxe.error.treeDragChild')
14001
14166
  });
14002
14167
  }
14003
- return;
14168
+ return errRest;
14004
14169
  }
14005
14170
  }
14006
14171
  }
14007
14172
  } else if (dragColumn.parentId) {
14008
14173
  // 子到根
14009
14174
  if (!isCrossDrag) {
14010
- return;
14175
+ return errRest;
14011
14176
  }
14012
14177
  } else if (newColumn.parentId) {
14013
14178
  // 根到子
14014
14179
  if (!isCrossDrag) {
14015
- return;
14180
+ return errRest;
14016
14181
  }
14017
14182
  if (oldAllMaps[newColumn.id]) {
14018
14183
  isSelfToChildStatus = true;
@@ -14023,7 +14188,7 @@ const Methods = {
14023
14188
  content: methods_getI18n('vxe.error.treeDragChild')
14024
14189
  });
14025
14190
  }
14026
- return;
14191
+ return errRest;
14027
14192
  }
14028
14193
  }
14029
14194
  } else {
@@ -14092,25 +14257,32 @@ const Methods = {
14092
14257
  $xeTable.clearCopyCellArea();
14093
14258
  }
14094
14259
  }
14095
- $xeTable.dispatchEvent('column-dragend', {
14096
- oldColumn: dragColumn,
14097
- newColumn,
14098
- dragColumn,
14099
- dragPos: prevDragPos,
14100
- dragToChild: isDragToChildFlag,
14101
- offsetIndex: dragOffsetIndex,
14102
- _index: {
14103
- newIndex: nafIndex,
14104
- oldIndex: oafIndex
14105
- }
14106
- }, evnt);
14260
+ if (evnt) {
14261
+ $xeTable.dispatchEvent('column-dragend', {
14262
+ oldColumn: dragColumn,
14263
+ newColumn,
14264
+ dragColumn,
14265
+ dragPos: prevDragPos,
14266
+ dragToChild: isDragToChildFlag,
14267
+ offsetIndex: dragOffsetIndex,
14268
+ _index: {
14269
+ newIndex: nafIndex,
14270
+ oldIndex: oafIndex
14271
+ }
14272
+ }, evnt);
14273
+ }
14107
14274
  if (isSyncColumn) {
14108
14275
  $xeTable.handleColDragSwapColumn();
14109
14276
  }
14110
- }).catch(() => {});
14277
+ return {
14278
+ status: true
14279
+ };
14280
+ }).catch(() => {
14281
+ return errRest;
14282
+ });
14111
14283
  }
14112
14284
  }
14113
- return Promise.resolve();
14285
+ return Promise.resolve(errRest);
14114
14286
  },
14115
14287
  handleHeaderCellDragDragendEvent(evnt) {
14116
14288
  const $xeTable = this;
@@ -16776,6 +16948,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
16776
16948
  tdOns.dblclick = evnt => {
16777
16949
  $xeTable.triggerCellDblclickEvent(evnt, cellParams);
16778
16950
  };
16951
+ let isMergeCell = false;
16779
16952
  // 合并行或列
16780
16953
  if (mergeList.length) {
16781
16954
  const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
@@ -16788,9 +16961,11 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
16788
16961
  return null;
16789
16962
  }
16790
16963
  if (rowspan > 1) {
16964
+ isMergeCell = true;
16791
16965
  tdAttrs.rowspan = rowspan;
16792
16966
  }
16793
16967
  if (colspan > 1) {
16968
+ isMergeCell = true;
16794
16969
  tdAttrs.colspan = colspan;
16795
16970
  }
16796
16971
  }
@@ -16825,11 +17000,13 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
16825
17000
  const isLastColumn = $columnIndex === columns.length - 1;
16826
17001
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
16827
17002
  let isVNPreEmptyStatus = false;
16828
- if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
16829
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
16830
- isVNPreEmptyStatus = true;
16831
- } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
16832
- isVNPreEmptyStatus = true;
17003
+ if (!isMergeCell) {
17004
+ if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
17005
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
17006
+ isVNPreEmptyStatus = true;
17007
+ } else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
17008
+ isVNPreEmptyStatus = true;
17009
+ }
16833
17010
  }
16834
17011
  }
16835
17012
  const tcStyle = {};
@@ -18050,6 +18227,7 @@ function footer_renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex,
18050
18227
  cell: evnt.currentTarget
18051
18228
  }, cellParams), evnt);
18052
18229
  };
18230
+ let isMergeCell = false;
18053
18231
  // 合并行或列
18054
18232
  if (mergeFooterList.length) {
18055
18233
  const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
@@ -18062,9 +18240,11 @@ function footer_renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex,
18062
18240
  return null;
18063
18241
  }
18064
18242
  if (rowspan > 1) {
18243
+ isMergeCell = true;
18065
18244
  attrs.rowspan = rowspan;
18066
18245
  }
18067
18246
  if (colspan > 1) {
18247
+ isMergeCell = true;
18068
18248
  attrs.colspan = colspan;
18069
18249
  }
18070
18250
  }
@@ -18087,8 +18267,10 @@ function footer_renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex,
18087
18267
  const isLastColumn = $columnIndex === tableColumn.length - 1;
18088
18268
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
18089
18269
  let isVNPreEmptyStatus = false;
18090
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
18091
- isVNPreEmptyStatus = true;
18270
+ if (!isMergeCell) {
18271
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
18272
+ isVNPreEmptyStatus = true;
18273
+ }
18092
18274
  }
18093
18275
  const tcStyle = {};
18094
18276
  if (hasEllipsis) {
@@ -29659,6 +29841,10 @@ Object.keys(table.methods).forEach(name => {
29659
29841
  }
29660
29842
  return [];
29661
29843
  },
29844
+ getEl() {
29845
+ const $xeGrid = this;
29846
+ return $xeGrid.$refs.refElem;
29847
+ },
29662
29848
  /**
29663
29849
  * 获取需要排除的高度
29664
29850
  */
@@ -31240,6 +31426,69 @@ function handleExportTreeSelectMethod(params) {
31240
31426
  } = params;
31241
31427
  return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
31242
31428
  }
31429
+ function handleNumberCell(h, renderOpts, params) {
31430
+ const {
31431
+ props = {},
31432
+ showNegativeStatus
31433
+ } = renderOpts;
31434
+ const {
31435
+ row,
31436
+ column
31437
+ } = params;
31438
+ const {
31439
+ type
31440
+ } = props;
31441
+ let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
31442
+ let isNegative = false;
31443
+ if (!isEmptyValue(cellValue)) {
31444
+ const numberInputConfig = render_getConfig().numberInput || {};
31445
+ if (type === 'float') {
31446
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
31447
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
31448
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
31449
+ if (!autoFill) {
31450
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
31451
+ }
31452
+ if (showNegativeStatus) {
31453
+ if (cellValue < 0) {
31454
+ isNegative = true;
31455
+ }
31456
+ }
31457
+ } else if (type === 'amount') {
31458
+ const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
31459
+ const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
31460
+ const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
31461
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
31462
+ if (showNegativeStatus) {
31463
+ if (cellValue < 0) {
31464
+ isNegative = true;
31465
+ }
31466
+ }
31467
+ cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
31468
+ digits
31469
+ });
31470
+ if (!autoFill) {
31471
+ const [iStr, dStr] = cellValue.split('.');
31472
+ if (dStr) {
31473
+ const dRest = dStr.replace(/0+$/, '');
31474
+ cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
31475
+ }
31476
+ }
31477
+ if (showCurrency) {
31478
+ cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
31479
+ }
31480
+ } else {
31481
+ if (showNegativeStatus) {
31482
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
31483
+ isNegative = true;
31484
+ }
31485
+ }
31486
+ }
31487
+ }
31488
+ return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
31489
+ class: 'is--negative'
31490
+ } : {});
31491
+ }
31243
31492
  /**
31244
31493
  * 表格 - 渲染器
31245
31494
  */
@@ -31311,72 +31560,22 @@ render_renderer.mixin({
31311
31560
  renderTableFilter: defaultFilterRender,
31312
31561
  tableFilterDefaultMethod: handleInputFilterMethod
31313
31562
  },
31314
- VxeNumberInput: {
31315
- tableAutoFocus: 'input',
31316
- renderTableEdit: defaultEditRender,
31317
- renderTableCell(h, renderOpts, params) {
31318
- const {
31319
- props = {},
31320
- showNegativeStatus
31321
- } = renderOpts;
31563
+ FormatNumberInput: {
31564
+ renderTableDefault: handleNumberCell,
31565
+ tableFilterDefaultMethod: handleInputFilterMethod,
31566
+ tableExportMethod(params) {
31322
31567
  const {
31323
31568
  row,
31324
31569
  column
31325
31570
  } = params;
31326
- const {
31327
- type
31328
- } = props;
31329
- let cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
31330
- let isNegative = false;
31331
- if (!isEmptyValue(cellValue)) {
31332
- const numberInputConfig = render_getConfig().numberInput || {};
31333
- if (type === 'float') {
31334
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
31335
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
31336
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(cellValue, digits), digits);
31337
- if (!autoFill) {
31338
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
31339
- }
31340
- if (showNegativeStatus) {
31341
- if (cellValue < 0) {
31342
- isNegative = true;
31343
- }
31344
- }
31345
- } else if (type === 'amount') {
31346
- const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
31347
- const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
31348
- const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
31349
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
31350
- if (showNegativeStatus) {
31351
- if (cellValue < 0) {
31352
- isNegative = true;
31353
- }
31354
- }
31355
- cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(cellValue, {
31356
- digits
31357
- });
31358
- if (!autoFill) {
31359
- const [iStr, dStr] = cellValue.split('.');
31360
- if (dStr) {
31361
- const dRest = dStr.replace(/0+$/, '');
31362
- cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
31363
- }
31364
- }
31365
- if (showCurrency) {
31366
- cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || render_getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
31367
- }
31368
- } else {
31369
- if (showNegativeStatus) {
31370
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue) < 0) {
31371
- isNegative = true;
31372
- }
31373
- }
31374
- }
31375
- }
31376
- return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative ? {
31377
- class: 'is--negative'
31378
- } : {});
31379
- },
31571
+ const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, column.field);
31572
+ return cellValue;
31573
+ }
31574
+ },
31575
+ VxeNumberInput: {
31576
+ tableAutoFocus: 'input',
31577
+ renderTableEdit: defaultEditRender,
31578
+ renderTableCell: handleNumberCell,
31380
31579
  renderTableFooter(h, renderOpts, params) {
31381
31580
  const {
31382
31581
  props = {}
@@ -31513,11 +31712,22 @@ render_renderer.mixin({
31513
31712
  tableFilterDefaultMethod: handleFilterMethod,
31514
31713
  tableExportMethod: handleExportSelectMethod
31515
31714
  },
31715
+ /**
31716
+ * 已废弃,被 FormatSelect 替换
31717
+ * @deprecated
31718
+ */
31516
31719
  formatOption: {
31517
31720
  renderTableDefault(h, renderOpts, params) {
31518
31721
  return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
31519
31722
  }
31520
31723
  },
31724
+ FormatSelect: {
31725
+ renderTableDefault(h, renderOpts, params) {
31726
+ return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
31727
+ },
31728
+ tableFilterDefaultMethod: handleFilterMethod,
31729
+ tableExportMethod: handleExportSelectMethod
31730
+ },
31521
31731
  VxeTreeSelect: {
31522
31732
  tableAutoFocus: 'input',
31523
31733
  renderTableEdit: defaultTableOrTreeSelectEditRender,
@@ -31534,11 +31744,21 @@ render_renderer.mixin({
31534
31744
  },
31535
31745
  tableExportMethod: handleExportTreeSelectMethod
31536
31746
  },
31747
+ /**
31748
+ * 已废弃,被 FormatTreeSelect 替换
31749
+ * @deprecated
31750
+ */
31537
31751
  formatTree: {
31538
31752
  renderTableDefault(h, renderOpts, params) {
31539
31753
  return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
31540
31754
  }
31541
31755
  },
31756
+ FormatTreeSelect: {
31757
+ renderTableDefault(h, renderOpts, params) {
31758
+ return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
31759
+ },
31760
+ tableExportMethod: handleExportTreeSelectMethod
31761
+ },
31542
31762
  VxeColorPicker: {
31543
31763
  tableAutoFocus: 'input',
31544
31764
  renderTableEdit(h, renderOpts, params) {