vxe-table 3.14.0-beta.7 → 3.14.0-beta.9
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.
- package/es/grid/src/grid.js +17 -8
- package/es/style.css +1 -1
- package/es/table/src/methods.js +202 -64
- package/es/table/src/util.js +9 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +17 -8
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +263 -89
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +233 -77
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +11 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +18 -8
- package/packages/table/src/methods.ts +224 -71
- package/packages/table/src/util.ts +10 -2
- /package/es/{iconfont.1741265532675.ttf → iconfont.1741336976538.ttf} +0 -0
- /package/es/{iconfont.1741265532675.woff → iconfont.1741336976538.woff} +0 -0
- /package/es/{iconfont.1741265532675.woff2 → iconfont.1741336976538.woff2} +0 -0
- /package/lib/{iconfont.1741265532675.ttf → iconfont.1741336976538.ttf} +0 -0
- /package/lib/{iconfont.1741265532675.woff → iconfont.1741336976538.woff} +0 -0
- /package/lib/{iconfont.1741265532675.woff2 → iconfont.1741336976538.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -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, updateDeepRowKey, updateFastRowKey, getRefElem } from './util';
|
|
6
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, updateDeepRowKey, updateFastRowKey, 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;
|
|
@@ -800,6 +800,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
800
800
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
801
801
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
802
802
|
const { checkField, reserve, checkMethod } = checkboxOpts;
|
|
803
|
+
// indeterminateField 仅支持读取
|
|
803
804
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
804
805
|
const selectRowMaps = {};
|
|
805
806
|
/**
|
|
@@ -2263,6 +2264,10 @@ const Methods = {
|
|
|
2263
2264
|
}
|
|
2264
2265
|
return [];
|
|
2265
2266
|
},
|
|
2267
|
+
getEl() {
|
|
2268
|
+
const $xeTable = this;
|
|
2269
|
+
return $xeTable.$refs.refElem;
|
|
2270
|
+
},
|
|
2266
2271
|
/**
|
|
2267
2272
|
* 获取父容器元素
|
|
2268
2273
|
*/
|
|
@@ -2639,8 +2644,6 @@ const Methods = {
|
|
|
2639
2644
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
2640
2645
|
if (!rowRest) {
|
|
2641
2646
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
2642
|
-
fullDataRowIdMaps[rowid] = rowRest;
|
|
2643
|
-
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2644
2647
|
}
|
|
2645
2648
|
rowRest.treeLoaded = false;
|
|
2646
2649
|
rowRest.expandLoaded = false;
|
|
@@ -2650,6 +2653,8 @@ const Methods = {
|
|
|
2650
2653
|
rowRest.level = level;
|
|
2651
2654
|
rowRest.index = currIndex;
|
|
2652
2655
|
rowRest.treeIndex = index;
|
|
2656
|
+
fullDataRowIdMaps[rowid] = rowRest;
|
|
2657
|
+
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2653
2658
|
};
|
|
2654
2659
|
if (treeConfig) {
|
|
2655
2660
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
@@ -2678,20 +2683,22 @@ const Methods = {
|
|
|
2678
2683
|
reactData.treeExpandedMaps = treeTempExpandedMaps;
|
|
2679
2684
|
},
|
|
2680
2685
|
cacheSourceMap(fullData) {
|
|
2681
|
-
|
|
2686
|
+
const $xeTable = this;
|
|
2687
|
+
const props = $xeTable;
|
|
2688
|
+
const internalData = $xeTable;
|
|
2689
|
+
const { treeConfig } = props;
|
|
2690
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2691
|
+
let { sourceDataRowIdData } = internalData;
|
|
2682
2692
|
const sourceData = XEUtils.clone(fullData, true);
|
|
2683
|
-
const rowkey = getRowkey(
|
|
2684
|
-
sourceDataRowIdData =
|
|
2693
|
+
const rowkey = getRowkey($xeTable);
|
|
2694
|
+
sourceDataRowIdData = internalData.sourceDataRowIdData = {};
|
|
2685
2695
|
const handleSourceRow = (row) => {
|
|
2686
|
-
let rowid = getRowid(
|
|
2696
|
+
let rowid = getRowid($xeTable, row);
|
|
2687
2697
|
if (eqEmptyValue(rowid)) {
|
|
2688
2698
|
rowid = getRowUniqueId();
|
|
2689
2699
|
XEUtils.set(row, rowkey, rowid);
|
|
2690
2700
|
}
|
|
2691
|
-
sourceDataRowIdData[rowid] =
|
|
2692
|
-
row,
|
|
2693
|
-
rowid
|
|
2694
|
-
};
|
|
2701
|
+
sourceDataRowIdData[rowid] = row;
|
|
2695
2702
|
};
|
|
2696
2703
|
// 源数据缓存
|
|
2697
2704
|
if (treeConfig) {
|
|
@@ -2701,7 +2708,7 @@ const Methods = {
|
|
|
2701
2708
|
else {
|
|
2702
2709
|
sourceData.forEach(handleSourceRow);
|
|
2703
2710
|
}
|
|
2704
|
-
|
|
2711
|
+
internalData.tableSourceData = sourceData;
|
|
2705
2712
|
},
|
|
2706
2713
|
getParams() {
|
|
2707
2714
|
return this.params;
|
|
@@ -3000,7 +3007,9 @@ const Methods = {
|
|
|
3000
3007
|
const reactData = $xeTable;
|
|
3001
3008
|
const internalData = $xeTable;
|
|
3002
3009
|
const { keepSource, treeConfig } = props;
|
|
3010
|
+
const { editStore } = reactData;
|
|
3003
3011
|
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
3012
|
+
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3004
3013
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3005
3014
|
const { transform } = treeOpts;
|
|
3006
3015
|
if (!keepSource) {
|
|
@@ -3035,6 +3044,7 @@ const Methods = {
|
|
|
3035
3044
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
3036
3045
|
}
|
|
3037
3046
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3047
|
+
delete removeTempMaps[rowid];
|
|
3038
3048
|
tableFullData.unshift(row);
|
|
3039
3049
|
afterFullData.unshift(row);
|
|
3040
3050
|
reDelFlag = true;
|
|
@@ -3046,6 +3056,7 @@ const Methods = {
|
|
|
3046
3056
|
}
|
|
3047
3057
|
if (rows) {
|
|
3048
3058
|
if (reDelFlag) {
|
|
3059
|
+
editStore.removeMaps = removeTempMaps;
|
|
3049
3060
|
$xeTable.updateFooter();
|
|
3050
3061
|
$xeTable.cacheRowMap(false);
|
|
3051
3062
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3208,20 +3219,25 @@ const Methods = {
|
|
|
3208
3219
|
},
|
|
3209
3220
|
/**
|
|
3210
3221
|
* 检查行或列数据是否发生改变
|
|
3211
|
-
* @param {Row}
|
|
3222
|
+
* @param {Row} rowOrId 行对象
|
|
3212
3223
|
* @param {String} field 字段名
|
|
3213
3224
|
*/
|
|
3214
|
-
isUpdateByRow(
|
|
3215
|
-
const
|
|
3225
|
+
isUpdateByRow(rowOrId, field) {
|
|
3226
|
+
const $xeTable = this;
|
|
3227
|
+
const props = $xeTable;
|
|
3228
|
+
const internalData = $xeTable;
|
|
3229
|
+
const { keepSource } = props;
|
|
3230
|
+
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData;
|
|
3216
3231
|
if (keepSource) {
|
|
3217
|
-
const rowid = getRowid(
|
|
3232
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
|
|
3233
|
+
const rowRest = fullDataRowIdData[rowid];
|
|
3218
3234
|
// 新增的数据不需要检测
|
|
3219
|
-
if (!
|
|
3235
|
+
if (!rowRest) {
|
|
3220
3236
|
return false;
|
|
3221
3237
|
}
|
|
3222
|
-
const
|
|
3223
|
-
|
|
3224
|
-
|
|
3238
|
+
const row = rowRest.row;
|
|
3239
|
+
const oRow = sourceDataRowIdData[rowid];
|
|
3240
|
+
if (oRow) {
|
|
3225
3241
|
if (arguments.length > 1) {
|
|
3226
3242
|
return !eqCellValue(oRow, row, field);
|
|
3227
3243
|
}
|
|
@@ -3283,6 +3299,99 @@ const Methods = {
|
|
|
3283
3299
|
tableColumn: this.tableColumn.slice(0)
|
|
3284
3300
|
};
|
|
3285
3301
|
},
|
|
3302
|
+
/**
|
|
3303
|
+
* 移动列到指定列的位置
|
|
3304
|
+
* @param fieldOrColumn
|
|
3305
|
+
* @param targetFieldOrColumn
|
|
3306
|
+
* @param options
|
|
3307
|
+
*/
|
|
3308
|
+
moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
|
|
3309
|
+
const $xeTable = this;
|
|
3310
|
+
const internalData = $xeTable;
|
|
3311
|
+
const { fullColumnIdData, visibleColumn } = internalData;
|
|
3312
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
3313
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3314
|
+
let prevDragCol = null;
|
|
3315
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
|
|
3316
|
+
let defPos = 'left';
|
|
3317
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
3318
|
+
if (colRest && targetFieldOrColumn) {
|
|
3319
|
+
let currList = colRest.items;
|
|
3320
|
+
let offsetIndex = colRest._index + targetFieldOrColumn;
|
|
3321
|
+
if (isCrossDrag) {
|
|
3322
|
+
currList = visibleColumn;
|
|
3323
|
+
offsetIndex = colRest._index + targetFieldOrColumn;
|
|
3324
|
+
}
|
|
3325
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
3326
|
+
prevDragCol = currList[offsetIndex];
|
|
3327
|
+
}
|
|
3328
|
+
if (targetFieldOrColumn > 0) {
|
|
3329
|
+
defPos = 'right';
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
else {
|
|
3334
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
|
|
3335
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
|
|
3336
|
+
if (colRest && targetColRest) {
|
|
3337
|
+
if (targetColRest._index > colRest._index) {
|
|
3338
|
+
defPos = 'right';
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
|
|
3343
|
+
},
|
|
3344
|
+
/**
|
|
3345
|
+
* 移动行到指定行的位置
|
|
3346
|
+
* @param rowidOrRow
|
|
3347
|
+
* @param targetRowidOrRow
|
|
3348
|
+
* @param options
|
|
3349
|
+
*/
|
|
3350
|
+
moveRowTo(rowidOrRow, targetRowidOrRow, options) {
|
|
3351
|
+
const $xeTable = this;
|
|
3352
|
+
const props = $xeTable;
|
|
3353
|
+
const internalData = $xeTable;
|
|
3354
|
+
const { treeConfig } = props;
|
|
3355
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
3356
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
3357
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3358
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
|
|
3359
|
+
let prevDragRow = null;
|
|
3360
|
+
let defPos = 'top';
|
|
3361
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
|
|
3362
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
3363
|
+
if (rowRest && targetRowidOrRow) {
|
|
3364
|
+
let currList = afterFullData;
|
|
3365
|
+
let offsetIndex = rowRest._index + targetRowidOrRow;
|
|
3366
|
+
if (treeConfig) {
|
|
3367
|
+
currList = rowRest.items;
|
|
3368
|
+
if (treeOpts.transform) {
|
|
3369
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow;
|
|
3370
|
+
if (isCrossDrag) {
|
|
3371
|
+
currList = afterFullData;
|
|
3372
|
+
offsetIndex = rowRest._index + targetRowidOrRow;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
3377
|
+
prevDragRow = currList[offsetIndex];
|
|
3378
|
+
}
|
|
3379
|
+
if (targetRowidOrRow > 0) {
|
|
3380
|
+
defPos = 'bottom';
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
else {
|
|
3385
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
|
|
3386
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
|
|
3387
|
+
if (rowRest && targetRowRest) {
|
|
3388
|
+
if (targetRowRest._index > rowRest._index) {
|
|
3389
|
+
defPos = 'bottom';
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
|
|
3394
|
+
},
|
|
3286
3395
|
/**
|
|
3287
3396
|
* 获取表格的全量列
|
|
3288
3397
|
*/
|
|
@@ -3303,22 +3412,30 @@ const Methods = {
|
|
|
3303
3412
|
* 用于多选行,获取已选中的数据
|
|
3304
3413
|
*/
|
|
3305
3414
|
getCheckboxRecords(isFull) {
|
|
3306
|
-
const
|
|
3415
|
+
const $xeTable = this;
|
|
3416
|
+
const props = $xeTable;
|
|
3417
|
+
const reactData = $xeTable;
|
|
3418
|
+
const internalData = $xeTable;
|
|
3419
|
+
const { treeConfig } = props;
|
|
3420
|
+
const { selectCheckboxMaps } = reactData;
|
|
3421
|
+
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData;
|
|
3422
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3423
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
3307
3424
|
const { transform, mapChildrenField } = treeOpts;
|
|
3308
3425
|
const { checkField } = checkboxOpts;
|
|
3309
3426
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
3310
|
-
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
3311
3427
|
let rowList = [];
|
|
3312
3428
|
if (checkField) {
|
|
3313
3429
|
if (treeConfig) {
|
|
3430
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
3314
3431
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField });
|
|
3315
3432
|
}
|
|
3316
3433
|
else {
|
|
3434
|
+
const currTableData = isFull ? tableFullData : afterFullData;
|
|
3317
3435
|
rowList = currTableData.filter((row) => XEUtils.get(row, checkField));
|
|
3318
3436
|
}
|
|
3319
3437
|
}
|
|
3320
3438
|
else {
|
|
3321
|
-
const { selectCheckboxMaps, fullDataRowIdData } = this;
|
|
3322
3439
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
3323
3440
|
if (isFull) {
|
|
3324
3441
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -5447,6 +5564,7 @@ const Methods = {
|
|
|
5447
5564
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
5448
5565
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
5449
5566
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts;
|
|
5567
|
+
// indeterminateField 仅支持读取
|
|
5450
5568
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
5451
5569
|
if (checkField) {
|
|
5452
5570
|
// 树结构
|
|
@@ -5892,6 +6010,7 @@ const Methods = {
|
|
|
5892
6010
|
const { tableFullData, treeConfig, treeOpts, checkboxOpts } = this;
|
|
5893
6011
|
const { checkField, reserve } = checkboxOpts;
|
|
5894
6012
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6013
|
+
// indeterminateField 仅支持读取
|
|
5895
6014
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
5896
6015
|
if (checkField) {
|
|
5897
6016
|
const handleClearChecked = (item) => {
|
|
@@ -6499,6 +6618,9 @@ const Methods = {
|
|
|
6499
6618
|
const { afterFullData, tableFullData } = internalData;
|
|
6500
6619
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
6501
6620
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
6621
|
+
const errRest = {
|
|
6622
|
+
status: false
|
|
6623
|
+
};
|
|
6502
6624
|
if (prevDragRow && dragRow) {
|
|
6503
6625
|
// 判断是否有拖动
|
|
6504
6626
|
if (prevDragRow !== dragRow) {
|
|
@@ -6513,7 +6635,7 @@ const Methods = {
|
|
|
6513
6635
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
6514
6636
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
6515
6637
|
if (!status) {
|
|
6516
|
-
return;
|
|
6638
|
+
return errRest;
|
|
6517
6639
|
}
|
|
6518
6640
|
let oafIndex = -1;
|
|
6519
6641
|
let nafIndex = -1;
|
|
@@ -6538,12 +6660,12 @@ const Methods = {
|
|
|
6538
6660
|
if (isPeerDrag && !isCrossDrag) {
|
|
6539
6661
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
6540
6662
|
// 非同级
|
|
6541
|
-
return;
|
|
6663
|
+
return errRest;
|
|
6542
6664
|
}
|
|
6543
6665
|
}
|
|
6544
6666
|
else {
|
|
6545
6667
|
if (!isCrossDrag) {
|
|
6546
|
-
return;
|
|
6668
|
+
return errRest;
|
|
6547
6669
|
}
|
|
6548
6670
|
if (oldAllMaps[newRowid]) {
|
|
6549
6671
|
isSelfToChildStatus = true;
|
|
@@ -6554,7 +6676,7 @@ const Methods = {
|
|
|
6554
6676
|
content: getI18n('vxe.error.treeDragChild')
|
|
6555
6677
|
});
|
|
6556
6678
|
}
|
|
6557
|
-
return;
|
|
6679
|
+
return errRest;
|
|
6558
6680
|
}
|
|
6559
6681
|
}
|
|
6560
6682
|
}
|
|
@@ -6562,13 +6684,13 @@ const Methods = {
|
|
|
6562
6684
|
else if (oldLevel) {
|
|
6563
6685
|
// 子到根
|
|
6564
6686
|
if (!isCrossDrag) {
|
|
6565
|
-
return;
|
|
6687
|
+
return errRest;
|
|
6566
6688
|
}
|
|
6567
6689
|
}
|
|
6568
6690
|
else if (newLevel) {
|
|
6569
6691
|
// 根到子
|
|
6570
6692
|
if (!isCrossDrag) {
|
|
6571
|
-
return;
|
|
6693
|
+
return errRest;
|
|
6572
6694
|
}
|
|
6573
6695
|
if (oldAllMaps[newRowid]) {
|
|
6574
6696
|
isSelfToChildStatus = true;
|
|
@@ -6579,7 +6701,7 @@ const Methods = {
|
|
|
6579
6701
|
content: getI18n('vxe.error.treeDragChild')
|
|
6580
6702
|
});
|
|
6581
6703
|
}
|
|
6582
|
-
return;
|
|
6704
|
+
return errRest;
|
|
6583
6705
|
}
|
|
6584
6706
|
}
|
|
6585
6707
|
}
|
|
@@ -6639,27 +6761,34 @@ const Methods = {
|
|
|
6639
6761
|
if (reactData.scrollYLoad) {
|
|
6640
6762
|
$xeTable.updateScrollYSpace();
|
|
6641
6763
|
}
|
|
6642
|
-
|
|
6764
|
+
if (evnt) {
|
|
6765
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
6766
|
+
oldRow: dragRow,
|
|
6767
|
+
newRow: prevDragRow,
|
|
6768
|
+
dragRow,
|
|
6769
|
+
dragPos: prevDragPos,
|
|
6770
|
+
dragToChild: isDragToChildFlag,
|
|
6771
|
+
offsetIndex: dragOffsetIndex,
|
|
6772
|
+
_index: {
|
|
6773
|
+
newIndex: nafIndex,
|
|
6774
|
+
oldIndex: oafIndex
|
|
6775
|
+
}
|
|
6776
|
+
}, evnt);
|
|
6777
|
+
}
|
|
6778
|
+
return $xeTable.$nextTick().then(() => {
|
|
6643
6779
|
$xeTable.updateCellAreas();
|
|
6644
6780
|
$xeTable.recalculate();
|
|
6781
|
+
}).then(() => {
|
|
6782
|
+
return {
|
|
6783
|
+
status: true
|
|
6784
|
+
};
|
|
6645
6785
|
});
|
|
6646
|
-
$xeTable.dispatchEvent('row-dragend', {
|
|
6647
|
-
oldRow: dragRow,
|
|
6648
|
-
newRow: prevDragRow,
|
|
6649
|
-
dragRow,
|
|
6650
|
-
dragPos: prevDragPos,
|
|
6651
|
-
dragToChild: isDragToChildFlag,
|
|
6652
|
-
offsetIndex: dragOffsetIndex,
|
|
6653
|
-
_index: {
|
|
6654
|
-
newIndex: nafIndex,
|
|
6655
|
-
oldIndex: oafIndex
|
|
6656
|
-
}
|
|
6657
|
-
}, evnt);
|
|
6658
6786
|
}).catch(() => {
|
|
6787
|
+
return errRest;
|
|
6659
6788
|
});
|
|
6660
6789
|
}
|
|
6661
6790
|
}
|
|
6662
|
-
return Promise.resolve();
|
|
6791
|
+
return Promise.resolve(errRest);
|
|
6663
6792
|
},
|
|
6664
6793
|
handleRowDragDragendEvent(evnt) {
|
|
6665
6794
|
const $xeTable = this;
|
|
@@ -6804,6 +6933,9 @@ const Methods = {
|
|
|
6804
6933
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
6805
6934
|
const { collectColumn } = internalData;
|
|
6806
6935
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
6936
|
+
const errRest = {
|
|
6937
|
+
status: false
|
|
6938
|
+
};
|
|
6807
6939
|
if (prevDragCol && dragCol) {
|
|
6808
6940
|
// 判断是否有拖动
|
|
6809
6941
|
if (prevDragCol !== dragCol) {
|
|
@@ -6820,7 +6952,7 @@ const Methods = {
|
|
|
6820
6952
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
6821
6953
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
6822
6954
|
if (!status) {
|
|
6823
|
-
return;
|
|
6955
|
+
return errRest;
|
|
6824
6956
|
}
|
|
6825
6957
|
let oafIndex = -1;
|
|
6826
6958
|
let nafIndex = -1;
|
|
@@ -6834,12 +6966,12 @@ const Methods = {
|
|
|
6834
6966
|
if (isPeerDrag && !isCrossDrag) {
|
|
6835
6967
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
6836
6968
|
// 非同级
|
|
6837
|
-
return;
|
|
6969
|
+
return errRest;
|
|
6838
6970
|
}
|
|
6839
6971
|
}
|
|
6840
6972
|
else {
|
|
6841
6973
|
if (!isCrossDrag) {
|
|
6842
|
-
return;
|
|
6974
|
+
return errRest;
|
|
6843
6975
|
}
|
|
6844
6976
|
if (oldAllMaps[newColumn.id]) {
|
|
6845
6977
|
isSelfToChildStatus = true;
|
|
@@ -6850,7 +6982,7 @@ const Methods = {
|
|
|
6850
6982
|
content: getI18n('vxe.error.treeDragChild')
|
|
6851
6983
|
});
|
|
6852
6984
|
}
|
|
6853
|
-
return;
|
|
6985
|
+
return errRest;
|
|
6854
6986
|
}
|
|
6855
6987
|
}
|
|
6856
6988
|
}
|
|
@@ -6858,13 +6990,13 @@ const Methods = {
|
|
|
6858
6990
|
else if (dragColumn.parentId) {
|
|
6859
6991
|
// 子到根
|
|
6860
6992
|
if (!isCrossDrag) {
|
|
6861
|
-
return;
|
|
6993
|
+
return errRest;
|
|
6862
6994
|
}
|
|
6863
6995
|
}
|
|
6864
6996
|
else if (newColumn.parentId) {
|
|
6865
6997
|
// 根到子
|
|
6866
6998
|
if (!isCrossDrag) {
|
|
6867
|
-
return;
|
|
6999
|
+
return errRest;
|
|
6868
7000
|
}
|
|
6869
7001
|
if (oldAllMaps[newColumn.id]) {
|
|
6870
7002
|
isSelfToChildStatus = true;
|
|
@@ -6875,7 +7007,7 @@ const Methods = {
|
|
|
6875
7007
|
content: getI18n('vxe.error.treeDragChild')
|
|
6876
7008
|
});
|
|
6877
7009
|
}
|
|
6878
|
-
return;
|
|
7010
|
+
return errRest;
|
|
6879
7011
|
}
|
|
6880
7012
|
}
|
|
6881
7013
|
}
|
|
@@ -6936,26 +7068,32 @@ const Methods = {
|
|
|
6936
7068
|
$xeTable.clearCopyCellArea();
|
|
6937
7069
|
}
|
|
6938
7070
|
}
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
7071
|
+
if (evnt) {
|
|
7072
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
7073
|
+
oldColumn: dragColumn,
|
|
7074
|
+
newColumn,
|
|
7075
|
+
dragColumn,
|
|
7076
|
+
dragPos: prevDragPos,
|
|
7077
|
+
dragToChild: isDragToChildFlag,
|
|
7078
|
+
offsetIndex: dragOffsetIndex,
|
|
7079
|
+
_index: {
|
|
7080
|
+
newIndex: nafIndex,
|
|
7081
|
+
oldIndex: oafIndex
|
|
7082
|
+
}
|
|
7083
|
+
}, evnt);
|
|
7084
|
+
}
|
|
6951
7085
|
if (isSyncColumn) {
|
|
6952
7086
|
$xeTable.handleColDragSwapColumn();
|
|
6953
7087
|
}
|
|
7088
|
+
return {
|
|
7089
|
+
status: true
|
|
7090
|
+
};
|
|
6954
7091
|
}).catch(() => {
|
|
7092
|
+
return errRest;
|
|
6955
7093
|
});
|
|
6956
7094
|
}
|
|
6957
7095
|
}
|
|
6958
|
-
return Promise.resolve();
|
|
7096
|
+
return Promise.resolve(errRest);
|
|
6959
7097
|
},
|
|
6960
7098
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
6961
7099
|
const $xeTable = this;
|
package/es/table/src/util.js
CHANGED
|
@@ -145,12 +145,19 @@ export function getCellHeight(height) {
|
|
|
145
145
|
}
|
|
146
146
|
return height || 0;
|
|
147
147
|
}
|
|
148
|
-
export function handleFieldOrColumn(
|
|
148
|
+
export function handleFieldOrColumn($xeTable, fieldOrColumn) {
|
|
149
149
|
if (fieldOrColumn) {
|
|
150
|
-
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ?
|
|
150
|
+
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
+
export const handleRowidOrRow = ($xeTable, rowidOrRow) => {
|
|
155
|
+
if (rowidOrRow) {
|
|
156
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
157
|
+
return $xeTable.getRowById(rowid);
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
};
|
|
154
161
|
// 组装列配置
|
|
155
162
|
export function assembleColumn(_vm) {
|
|
156
163
|
const { $el, $xetable, $xecolumn, columnConfig } = _vm;
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/grid/src/grid.js
CHANGED
|
@@ -674,6 +674,10 @@ var _default = exports.default = {
|
|
|
674
674
|
}
|
|
675
675
|
return [];
|
|
676
676
|
},
|
|
677
|
+
getEl() {
|
|
678
|
+
const $xeGrid = this;
|
|
679
|
+
return $xeGrid.$refs.refElem;
|
|
680
|
+
},
|
|
677
681
|
/**
|
|
678
682
|
* 获取需要排除的高度
|
|
679
683
|
*/
|
|
@@ -684,20 +688,25 @@ var _default = exports.default = {
|
|
|
684
688
|
isZMax
|
|
685
689
|
} = reactData;
|
|
686
690
|
const el = $xeGrid.$refs.refElem;
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
if (el) {
|
|
692
|
+
const formWrapper = $xeGrid.$refs.refFormWrapper;
|
|
693
|
+
const toolbarWrapper = $xeGrid.$refs.refToolbarWrapper;
|
|
694
|
+
const topWrapper = $xeGrid.$refs.refTopWrapper;
|
|
695
|
+
const bottomWrapper = $xeGrid.$refs.refBottomWrapper;
|
|
696
|
+
const pagerWrapper = $xeGrid.$refs.refPagerWrapper;
|
|
697
|
+
const parentEl = el.parentElement;
|
|
698
|
+
const parentPaddingSize = isZMax ? 0 : parentEl ? (0, _dom.getPaddingTopBottomSize)(parentEl) : 0;
|
|
699
|
+
return parentPaddingSize + (0, _dom.getPaddingTopBottomSize)(el) + (0, _dom.getOffsetHeight)(formWrapper) + (0, _dom.getOffsetHeight)(toolbarWrapper) + (0, _dom.getOffsetHeight)(topWrapper) + (0, _dom.getOffsetHeight)(bottomWrapper) + (0, _dom.getOffsetHeight)(pagerWrapper);
|
|
700
|
+
}
|
|
701
|
+
return 0;
|
|
694
702
|
},
|
|
695
703
|
getParentHeight() {
|
|
696
704
|
const $xeGrid = this;
|
|
697
705
|
const reactData = $xeGrid;
|
|
698
706
|
const el = $xeGrid.$refs.refElem;
|
|
699
707
|
if (el) {
|
|
700
|
-
|
|
708
|
+
const parentEl = el.parentElement;
|
|
709
|
+
return (reactData.isZMax ? (0, _dom.getDomNode)().visibleHeight : parentEl ? _xeUtils.default.toNumber(getComputedStyle(parentEl).height) : 0) - $xeGrid.getExcludeHeight();
|
|
701
710
|
}
|
|
702
711
|
return 0;
|
|
703
712
|
},
|