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
@@ -3,7 +3,7 @@ import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEv
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
6
- import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getRefElem } from './util';
6
+ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getRefElem } from './util';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
8
8
  import { warnLog, errLog } from '../../ui/src/log';
9
9
  const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
@@ -2190,6 +2190,10 @@ const Methods = {
2190
2190
  }
2191
2191
  return [];
2192
2192
  },
2193
+ getEl() {
2194
+ const $xeTable = this;
2195
+ return $xeTable.$refs.refElem;
2196
+ },
2193
2197
  /**
2194
2198
  * 获取父容器元素
2195
2199
  */
@@ -2201,10 +2205,26 @@ const Methods = {
2201
2205
  * 获取父容器的高度
2202
2206
  */
2203
2207
  getParentHeight() {
2204
- const { $el, $xegrid, height } = this;
2205
- const parentElem = $el.parentNode;
2206
- const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
2207
- return Math.floor($xegrid ? $xegrid.getParentHeight() : XEUtils.toNumber(getComputedStyle(parentElem).height) - parentPaddingSize);
2208
+ const $xeTable = this;
2209
+ const $xeGrid = $xeTable.$xeGrid;
2210
+ const props = $xeTable;
2211
+ const { height } = props;
2212
+ const el = $xeTable.$refs.refElem;
2213
+ if (el) {
2214
+ const parentElem = el.parentNode;
2215
+ const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0;
2216
+ let parentWrapperHeight = 0;
2217
+ if (parentElem) {
2218
+ if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
2219
+ parentWrapperHeight = $xeGrid.getParentHeight();
2220
+ }
2221
+ else {
2222
+ parentWrapperHeight = parentElem.clientHeight;
2223
+ }
2224
+ }
2225
+ return Math.floor(parentWrapperHeight - parentPaddingSize);
2226
+ }
2227
+ return 0;
2208
2228
  },
2209
2229
  /**
2210
2230
  * 获取需要排除的高度
@@ -2386,7 +2406,7 @@ const Methods = {
2386
2406
  // warnLog('vxe.error.reqProp', ['table.show-overflow'])
2387
2407
  // }
2388
2408
  if (this.spanMethod) {
2389
- warnLog('vxe.error.scrollErrProp', ['table.span-method']);
2409
+ errLog('vxe.error.scrollErrProp', ['table.span-method']);
2390
2410
  }
2391
2411
  }
2392
2412
  handleReserveStatus($xeTable);
@@ -2926,12 +2946,12 @@ const Methods = {
2926
2946
  const reactData = $xeTable;
2927
2947
  const internalData = $xeTable;
2928
2948
  const { keepSource, treeConfig } = props;
2929
- const { fullAllDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
2949
+ const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
2930
2950
  const treeOpts = $xeTable.computeTreeOpts;
2931
2951
  const { transform } = treeOpts;
2932
2952
  if (!keepSource) {
2933
2953
  if (process.env.NODE_ENV === 'development') {
2934
- warnLog('vxe.error.reqProp', ['keep-source']);
2954
+ errLog('vxe.error.reqProp', ['keep-source']);
2935
2955
  }
2936
2956
  return $xeTable.$nextTick();
2937
2957
  }
@@ -2946,23 +2966,23 @@ const Methods = {
2946
2966
  }
2947
2967
  let reDelFlag = false;
2948
2968
  if (targetRows.length) {
2949
- targetRows.forEach((row) => {
2950
- if (!$xeTable.isInsertByRow(row)) {
2951
- const rowid = getRowid($xeTable, row);
2952
- const oRow = sourceDataRowIdData[rowid];
2953
- if (oRow && row) {
2954
- if (field) {
2955
- XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true));
2956
- }
2957
- else {
2958
- XEUtils.destructuring(row, XEUtils.clone(oRow, true));
2959
- }
2960
- if ($xeTable.isRemoveByRow(row)) {
2961
- const rowRest = fullAllDataRowIdData[rowid];
2962
- if (rowRest) {
2963
- const reRow = rowRest.row;
2964
- tableFullData.unshift(reRow);
2965
- afterFullData.unshift(reRow);
2969
+ targetRows.forEach((item) => {
2970
+ const rowid = getRowid($xeTable, item);
2971
+ const rowRest = fullAllDataRowIdData[rowid];
2972
+ if (rowRest) {
2973
+ const row = rowRest.row;
2974
+ if (!$xeTable.isInsertByRow(row)) {
2975
+ const oRow = sourceDataRowIdData[rowid];
2976
+ if (oRow && row) {
2977
+ if (field) {
2978
+ XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true));
2979
+ }
2980
+ else {
2981
+ XEUtils.destructuring(row, XEUtils.clone(oRow, true));
2982
+ }
2983
+ if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
2984
+ tableFullData.unshift(row);
2985
+ afterFullData.unshift(row);
2966
2986
  reDelFlag = true;
2967
2987
  }
2968
2988
  }
@@ -3133,20 +3153,25 @@ const Methods = {
3133
3153
  },
3134
3154
  /**
3135
3155
  * 检查行或列数据是否发生改变
3136
- * @param {Row} row 行对象
3156
+ * @param {Row} rowOrId 行对象
3137
3157
  * @param {String} field 字段名
3138
3158
  */
3139
- isUpdateByRow(row, field) {
3140
- const { tableFullColumn, keepSource, sourceDataRowIdData, fullDataRowIdData } = this;
3159
+ isUpdateByRow(rowOrId, field) {
3160
+ const $xeTable = this;
3161
+ const props = $xeTable;
3162
+ const internalData = $xeTable;
3163
+ const { keepSource } = props;
3164
+ const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData;
3141
3165
  if (keepSource) {
3142
- const rowid = getRowid(this, row);
3166
+ const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
3167
+ const rowRest = fullDataRowIdData[rowid];
3143
3168
  // 新增的数据不需要检测
3144
- if (!fullDataRowIdData[rowid]) {
3169
+ if (!rowRest) {
3145
3170
  return false;
3146
3171
  }
3147
- const oldRest = sourceDataRowIdData[rowid];
3148
- if (oldRest) {
3149
- const oRow = oldRest.row;
3172
+ const row = rowRest.row;
3173
+ const oRow = sourceDataRowIdData[rowid];
3174
+ if (oRow) {
3150
3175
  if (arguments.length > 1) {
3151
3176
  return !eqCellValue(oRow, row, field);
3152
3177
  }
@@ -3208,6 +3233,99 @@ const Methods = {
3208
3233
  tableColumn: this.tableColumn.slice(0)
3209
3234
  };
3210
3235
  },
3236
+ /**
3237
+ * 移动列到指定列的位置
3238
+ * @param fieldOrColumn
3239
+ * @param targetFieldOrColumn
3240
+ * @param options
3241
+ */
3242
+ moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
3243
+ const $xeTable = this;
3244
+ const internalData = $xeTable;
3245
+ const { fullColumnIdData, visibleColumn } = internalData;
3246
+ const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
3247
+ const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
3248
+ let prevDragCol = null;
3249
+ const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
3250
+ let defPos = 'left';
3251
+ if (XEUtils.isNumber(targetFieldOrColumn)) {
3252
+ if (colRest && targetFieldOrColumn) {
3253
+ let currList = colRest.items;
3254
+ let offsetIndex = colRest._index + targetFieldOrColumn;
3255
+ if (isCrossDrag) {
3256
+ currList = visibleColumn;
3257
+ offsetIndex = colRest._index + targetFieldOrColumn;
3258
+ }
3259
+ if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
3260
+ prevDragCol = currList[offsetIndex];
3261
+ }
3262
+ if (targetFieldOrColumn > 0) {
3263
+ defPos = 'right';
3264
+ }
3265
+ }
3266
+ }
3267
+ else {
3268
+ prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
3269
+ const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
3270
+ if (colRest && targetColRest) {
3271
+ if (targetColRest._index > colRest._index) {
3272
+ defPos = 'right';
3273
+ }
3274
+ }
3275
+ }
3276
+ return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
3277
+ },
3278
+ /**
3279
+ * 移动行到指定行的位置
3280
+ * @param rowidOrRow
3281
+ * @param targetRowidOrRow
3282
+ * @param options
3283
+ */
3284
+ moveRowTo(rowidOrRow, targetRowidOrRow, options) {
3285
+ const $xeTable = this;
3286
+ const props = $xeTable;
3287
+ const internalData = $xeTable;
3288
+ const { treeConfig } = props;
3289
+ const { fullAllDataRowIdData, afterFullData } = internalData;
3290
+ const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
3291
+ const treeOpts = $xeTable.computeTreeOpts;
3292
+ const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
3293
+ let prevDragRow = null;
3294
+ let defPos = 'top';
3295
+ const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
3296
+ if (XEUtils.isNumber(targetRowidOrRow)) {
3297
+ if (rowRest && targetRowidOrRow) {
3298
+ let currList = afterFullData;
3299
+ let offsetIndex = rowRest._index + targetRowidOrRow;
3300
+ if (treeConfig) {
3301
+ currList = rowRest.items;
3302
+ if (treeOpts.transform) {
3303
+ offsetIndex = rowRest.treeIndex + targetRowidOrRow;
3304
+ if (isCrossDrag) {
3305
+ currList = afterFullData;
3306
+ offsetIndex = rowRest._index + targetRowidOrRow;
3307
+ }
3308
+ }
3309
+ }
3310
+ if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
3311
+ prevDragRow = currList[offsetIndex];
3312
+ }
3313
+ if (targetRowidOrRow > 0) {
3314
+ defPos = 'bottom';
3315
+ }
3316
+ }
3317
+ }
3318
+ else {
3319
+ prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
3320
+ const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
3321
+ if (rowRest && targetRowRest) {
3322
+ if (targetRowRest._index > rowRest._index) {
3323
+ defPos = 'bottom';
3324
+ }
3325
+ }
3326
+ }
3327
+ return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
3328
+ },
3211
3329
  /**
3212
3330
  * 获取表格的全量列
3213
3331
  */
@@ -3228,22 +3346,30 @@ const Methods = {
3228
3346
  * 用于多选行,获取已选中的数据
3229
3347
  */
3230
3348
  getCheckboxRecords(isFull) {
3231
- const { tableFullData, afterFullData, treeConfig, treeOpts, checkboxOpts, tableFullTreeData, afterTreeFullData, afterFullRowMaps } = this;
3349
+ const $xeTable = this;
3350
+ const props = $xeTable;
3351
+ const reactData = $xeTable;
3352
+ const internalData = $xeTable;
3353
+ const { treeConfig } = props;
3354
+ const { selectCheckboxMaps } = reactData;
3355
+ const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData;
3356
+ const treeOpts = $xeTable.computeTreeOpts;
3357
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
3232
3358
  const { transform, mapChildrenField } = treeOpts;
3233
3359
  const { checkField } = checkboxOpts;
3234
3360
  const childrenField = treeOpts.children || treeOpts.childrenField;
3235
- const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
3236
3361
  let rowList = [];
3237
3362
  if (checkField) {
3238
3363
  if (treeConfig) {
3364
+ const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
3239
3365
  rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField });
3240
3366
  }
3241
3367
  else {
3368
+ const currTableData = isFull ? tableFullData : afterFullData;
3242
3369
  rowList = currTableData.filter((row) => XEUtils.get(row, checkField));
3243
3370
  }
3244
3371
  }
3245
3372
  else {
3246
- const { selectCheckboxMaps, fullDataRowIdData } = this;
3247
3373
  XEUtils.each(selectCheckboxMaps, (row, rowid) => {
3248
3374
  if (isFull) {
3249
3375
  if (fullDataRowIdData[rowid]) {
@@ -6419,6 +6545,9 @@ const Methods = {
6419
6545
  const { afterFullData, tableFullData } = internalData;
6420
6546
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
6421
6547
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
6548
+ const errRest = {
6549
+ status: false
6550
+ };
6422
6551
  if (prevDragRow && dragRow) {
6423
6552
  // 判断是否有拖动
6424
6553
  if (prevDragRow !== dragRow) {
@@ -6433,7 +6562,7 @@ const Methods = {
6433
6562
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
6434
6563
  return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
6435
6564
  if (!status) {
6436
- return;
6565
+ return errRest;
6437
6566
  }
6438
6567
  let oafIndex = -1;
6439
6568
  let nafIndex = -1;
@@ -6458,12 +6587,12 @@ const Methods = {
6458
6587
  if (isPeerDrag && !isCrossDrag) {
6459
6588
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
6460
6589
  // 非同级
6461
- return;
6590
+ return errRest;
6462
6591
  }
6463
6592
  }
6464
6593
  else {
6465
6594
  if (!isCrossDrag) {
6466
- return;
6595
+ return errRest;
6467
6596
  }
6468
6597
  if (oldAllMaps[newRowid]) {
6469
6598
  isSelfToChildStatus = true;
@@ -6474,7 +6603,7 @@ const Methods = {
6474
6603
  content: getI18n('vxe.error.treeDragChild')
6475
6604
  });
6476
6605
  }
6477
- return;
6606
+ return errRest;
6478
6607
  }
6479
6608
  }
6480
6609
  }
@@ -6482,13 +6611,13 @@ const Methods = {
6482
6611
  else if (oldLevel) {
6483
6612
  // 子到根
6484
6613
  if (!isCrossDrag) {
6485
- return;
6614
+ return errRest;
6486
6615
  }
6487
6616
  }
6488
6617
  else if (newLevel) {
6489
6618
  // 根到子
6490
6619
  if (!isCrossDrag) {
6491
- return;
6620
+ return errRest;
6492
6621
  }
6493
6622
  if (oldAllMaps[newRowid]) {
6494
6623
  isSelfToChildStatus = true;
@@ -6499,7 +6628,7 @@ const Methods = {
6499
6628
  content: getI18n('vxe.error.treeDragChild')
6500
6629
  });
6501
6630
  }
6502
- return;
6631
+ return errRest;
6503
6632
  }
6504
6633
  }
6505
6634
  }
@@ -6559,27 +6688,34 @@ const Methods = {
6559
6688
  if (reactData.scrollYLoad) {
6560
6689
  $xeTable.updateScrollYSpace();
6561
6690
  }
6562
- $xeTable.$nextTick().then(() => {
6691
+ if (evnt) {
6692
+ $xeTable.dispatchEvent('row-dragend', {
6693
+ oldRow: dragRow,
6694
+ newRow: prevDragRow,
6695
+ dragRow,
6696
+ dragPos: prevDragPos,
6697
+ dragToChild: isDragToChildFlag,
6698
+ offsetIndex: dragOffsetIndex,
6699
+ _index: {
6700
+ newIndex: nafIndex,
6701
+ oldIndex: oafIndex
6702
+ }
6703
+ }, evnt);
6704
+ }
6705
+ return $xeTable.$nextTick().then(() => {
6563
6706
  $xeTable.updateCellAreas();
6564
6707
  $xeTable.recalculate();
6708
+ }).then(() => {
6709
+ return {
6710
+ status: true
6711
+ };
6565
6712
  });
6566
- $xeTable.dispatchEvent('row-dragend', {
6567
- oldRow: dragRow,
6568
- newRow: prevDragRow,
6569
- dragRow,
6570
- dragPos: prevDragPos,
6571
- dragToChild: isDragToChildFlag,
6572
- offsetIndex: dragOffsetIndex,
6573
- _index: {
6574
- newIndex: nafIndex,
6575
- oldIndex: oafIndex
6576
- }
6577
- }, evnt);
6578
6713
  }).catch(() => {
6714
+ return errRest;
6579
6715
  });
6580
6716
  }
6581
6717
  }
6582
- return Promise.resolve();
6718
+ return Promise.resolve(errRest);
6583
6719
  },
6584
6720
  handleRowDragDragendEvent(evnt) {
6585
6721
  const $xeTable = this;
@@ -6724,6 +6860,9 @@ const Methods = {
6724
6860
  const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
6725
6861
  const { collectColumn } = internalData;
6726
6862
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
6863
+ const errRest = {
6864
+ status: false
6865
+ };
6727
6866
  if (prevDragCol && dragCol) {
6728
6867
  // 判断是否有拖动
6729
6868
  if (prevDragCol !== dragCol) {
@@ -6740,7 +6879,7 @@ const Methods = {
6740
6879
  const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
6741
6880
  return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
6742
6881
  if (!status) {
6743
- return;
6882
+ return errRest;
6744
6883
  }
6745
6884
  let oafIndex = -1;
6746
6885
  let nafIndex = -1;
@@ -6754,12 +6893,12 @@ const Methods = {
6754
6893
  if (isPeerDrag && !isCrossDrag) {
6755
6894
  if (dragColumn.parentId !== newColumn.parentId) {
6756
6895
  // 非同级
6757
- return;
6896
+ return errRest;
6758
6897
  }
6759
6898
  }
6760
6899
  else {
6761
6900
  if (!isCrossDrag) {
6762
- return;
6901
+ return errRest;
6763
6902
  }
6764
6903
  if (oldAllMaps[newColumn.id]) {
6765
6904
  isSelfToChildStatus = true;
@@ -6770,7 +6909,7 @@ const Methods = {
6770
6909
  content: getI18n('vxe.error.treeDragChild')
6771
6910
  });
6772
6911
  }
6773
- return;
6912
+ return errRest;
6774
6913
  }
6775
6914
  }
6776
6915
  }
@@ -6778,13 +6917,13 @@ const Methods = {
6778
6917
  else if (dragColumn.parentId) {
6779
6918
  // 子到根
6780
6919
  if (!isCrossDrag) {
6781
- return;
6920
+ return errRest;
6782
6921
  }
6783
6922
  }
6784
6923
  else if (newColumn.parentId) {
6785
6924
  // 根到子
6786
6925
  if (!isCrossDrag) {
6787
- return;
6926
+ return errRest;
6788
6927
  }
6789
6928
  if (oldAllMaps[newColumn.id]) {
6790
6929
  isSelfToChildStatus = true;
@@ -6795,7 +6934,7 @@ const Methods = {
6795
6934
  content: getI18n('vxe.error.treeDragChild')
6796
6935
  });
6797
6936
  }
6798
- return;
6937
+ return errRest;
6799
6938
  }
6800
6939
  }
6801
6940
  }
@@ -6856,26 +6995,32 @@ const Methods = {
6856
6995
  $xeTable.clearCopyCellArea();
6857
6996
  }
6858
6997
  }
6859
- $xeTable.dispatchEvent('column-dragend', {
6860
- oldColumn: dragColumn,
6861
- newColumn,
6862
- dragColumn,
6863
- dragPos: prevDragPos,
6864
- dragToChild: isDragToChildFlag,
6865
- offsetIndex: dragOffsetIndex,
6866
- _index: {
6867
- newIndex: nafIndex,
6868
- oldIndex: oafIndex
6869
- }
6870
- }, evnt);
6998
+ if (evnt) {
6999
+ $xeTable.dispatchEvent('column-dragend', {
7000
+ oldColumn: dragColumn,
7001
+ newColumn,
7002
+ dragColumn,
7003
+ dragPos: prevDragPos,
7004
+ dragToChild: isDragToChildFlag,
7005
+ offsetIndex: dragOffsetIndex,
7006
+ _index: {
7007
+ newIndex: nafIndex,
7008
+ oldIndex: oafIndex
7009
+ }
7010
+ }, evnt);
7011
+ }
6871
7012
  if (isSyncColumn) {
6872
7013
  $xeTable.handleColDragSwapColumn();
6873
7014
  }
7015
+ return {
7016
+ status: true
7017
+ };
6874
7018
  }).catch(() => {
7019
+ return errRest;
6875
7020
  });
6876
7021
  }
6877
7022
  }
6878
- return Promise.resolve();
7023
+ return Promise.resolve(errRest);
6879
7024
  },
6880
7025
  handleHeaderCellDragDragendEvent(evnt) {
6881
7026
  const $xeTable = this;
@@ -90,13 +90,19 @@ export function getRowUniqueId() {
90
90
  return XEUtils.uniqueId('row_');
91
91
  }
92
92
  // 行主键 key
93
- export function getRowkey($xetable) {
94
- return $xetable.rowOpts.keyField || $xetable.rowId || '_X_ROW_KEY';
93
+ export function getRowkey($xeTable) {
94
+ const props = $xeTable;
95
+ const rowOpts = $xeTable.computeRowOpts;
96
+ return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
95
97
  }
96
98
  // 行主键 value
97
99
  export function getRowid($xetable, row) {
98
100
  const rowid = XEUtils.get(row, getRowkey($xetable));
99
- return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid);
101
+ return encodeRowid(rowid);
102
+ }
103
+ // 编码行主键
104
+ export function encodeRowid(rowVal) {
105
+ return XEUtils.eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
100
106
  }
101
107
  function getPaddingLeftRightSize(elem) {
102
108
  if (elem) {
@@ -122,12 +128,19 @@ export function getCellHeight(height) {
122
128
  }
123
129
  return height || 0;
124
130
  }
125
- export function handleFieldOrColumn(_vm, fieldOrColumn) {
131
+ export function handleFieldOrColumn($xeTable, fieldOrColumn) {
126
132
  if (fieldOrColumn) {
127
- return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? _vm.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
133
+ return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
128
134
  }
129
135
  return null;
130
136
  }
137
+ export const handleRowidOrRow = ($xeTable, rowidOrRow) => {
138
+ if (rowidOrRow) {
139
+ const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
140
+ return $xeTable.getRowById(rowid);
141
+ }
142
+ return null;
143
+ };
131
144
  // 组装列配置
132
145
  export function assembleColumn(_vm) {
133
146
  const { $el, $xetable, $xecolumn, columnConfig } = _vm;
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.13.18";
3
+ export const version = "3.13.20";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.13.18"}`;
3
+ const version = `table v${"3.13.20"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
@@ -671,6 +671,10 @@ var _default = exports.default = {
671
671
  }
672
672
  return [];
673
673
  },
674
+ getEl() {
675
+ const $xeGrid = this;
676
+ return $xeGrid.$refs.refElem;
677
+ },
674
678
  /**
675
679
  * 获取需要排除的高度
676
680
  */