vxe-table 3.13.16 → 3.13.18
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 +68 -85
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +25 -27
- package/es/table/module/edit/mixin.js +3 -5
- package/es/table/module/export/export-panel.js +22 -24
- package/es/table/module/export/import-panel.js +14 -16
- package/es/table/module/export/mixin.js +15 -31
- package/es/table/module/keyboard/mixin.js +3 -2
- package/es/table/module/validator/mixin.js +1 -3
- package/es/table/render/index.js +2 -4
- package/es/table/src/body.js +2 -2
- package/es/table/src/columnInfo.js +30 -32
- package/es/table/src/methods.js +113 -68
- package/es/table/src/table.js +16 -18
- package/es/table/src/util.js +5 -7
- package/es/toolbar/src/toolbar.js +18 -26
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +69 -98
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +356 -365
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +31 -33
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +3 -5
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +22 -24
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +14 -16
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +15 -31
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +3 -2
- package/lib/table/module/validator/mixin.js +1 -3
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +2 -4
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +2 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +32 -34
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +121 -65
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +13 -15
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +4 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +18 -26
- package/lib/toolbar/src/toolbar.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 +70 -85
- package/packages/table/module/custom/panel.ts +25 -27
- package/packages/table/module/edit/mixin.ts +3 -5
- package/packages/table/module/export/export-panel.ts +22 -24
- package/packages/table/module/export/import-panel.ts +14 -16
- package/packages/table/module/export/mixin.ts +15 -31
- package/packages/table/module/keyboard/mixin.ts +6 -2
- package/packages/table/module/validator/mixin.ts +1 -3
- package/packages/table/render/index.ts +2 -4
- package/packages/table/src/body.ts +2 -2
- package/packages/table/src/columnInfo.ts +30 -32
- package/packages/table/src/methods.ts +115 -66
- package/packages/table/src/table.ts +13 -15
- package/packages/table/src/util.ts +4 -6
- package/packages/toolbar/src/toolbar.ts +18 -26
- /package/es/{iconfont.1740799948632.ttf → iconfont.1741140503645.ttf} +0 -0
- /package/es/{iconfont.1740799948632.woff → iconfont.1741140503645.woff} +0 -0
- /package/es/{iconfont.1740799948632.woff2 → iconfont.1741140503645.woff2} +0 -0
- /package/lib/{iconfont.1740799948632.ttf → iconfont.1741140503645.ttf} +0 -0
- /package/lib/{iconfont.1740799948632.woff → iconfont.1741140503645.woff} +0 -0
- /package/lib/{iconfont.1740799948632.woff2 → iconfont.1741140503645.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -2680,28 +2680,26 @@ const Methods = {
|
|
|
2680
2680
|
if (treeConfig) {
|
|
2681
2681
|
// 树结构自动转换
|
|
2682
2682
|
if (treeOpts.transform) {
|
|
2683
|
-
if (
|
|
2684
|
-
|
|
2685
|
-
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2686
|
-
}
|
|
2687
|
-
if (!treeOpts.parentField) {
|
|
2688
|
-
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.parentField']);
|
|
2689
|
-
}
|
|
2690
|
-
if (!childrenField) {
|
|
2691
|
-
(0, _log.errLog)('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2692
|
-
}
|
|
2693
|
-
if (!treeOpts.mapChildrenField) {
|
|
2694
|
-
(0, _log.errLog)('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2695
|
-
}
|
|
2696
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
2697
|
-
(0, _log.errLog)('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2698
|
-
}
|
|
2699
|
-
// fullData.forEach(row => {
|
|
2700
|
-
// if (row[childrenField] && row[childrenField].length) {
|
|
2701
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2702
|
-
// }
|
|
2703
|
-
// })
|
|
2683
|
+
if (!treeOpts.rowField) {
|
|
2684
|
+
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2704
2685
|
}
|
|
2686
|
+
if (!treeOpts.parentField) {
|
|
2687
|
+
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.parentField']);
|
|
2688
|
+
}
|
|
2689
|
+
if (!childrenField) {
|
|
2690
|
+
(0, _log.errLog)('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2691
|
+
}
|
|
2692
|
+
if (!treeOpts.mapChildrenField) {
|
|
2693
|
+
(0, _log.errLog)('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2694
|
+
}
|
|
2695
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2696
|
+
(0, _log.errLog)('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2697
|
+
}
|
|
2698
|
+
// fullData.forEach(row => {
|
|
2699
|
+
// if (row[childrenField] && row[childrenField].length) {
|
|
2700
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2701
|
+
// }
|
|
2702
|
+
// })
|
|
2705
2703
|
treeData = _xeUtils.default.toArrayTree(fullData, {
|
|
2706
2704
|
key: treeOpts.rowField,
|
|
2707
2705
|
parentKey: treeOpts.parentField,
|
|
@@ -2765,16 +2763,14 @@ const Methods = {
|
|
|
2765
2763
|
// }
|
|
2766
2764
|
// }
|
|
2767
2765
|
// }
|
|
2768
|
-
if (
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
(0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2777
|
-
}
|
|
2766
|
+
if (!(this.height || this.maxHeight)) {
|
|
2767
|
+
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2768
|
+
}
|
|
2769
|
+
// if (!this.showOverflow) {
|
|
2770
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2771
|
+
// }
|
|
2772
|
+
if (this.spanMethod) {
|
|
2773
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2778
2774
|
}
|
|
2779
2775
|
}
|
|
2780
2776
|
handleReserveStatus($xeTable);
|
|
@@ -2918,22 +2914,26 @@ const Methods = {
|
|
|
2918
2914
|
cacheRowMap() {
|
|
2919
2915
|
const $xeTable = this;
|
|
2920
2916
|
const props = $xeTable;
|
|
2917
|
+
const reactData = $xeTable;
|
|
2921
2918
|
const internalData = $xeTable;
|
|
2922
2919
|
const {
|
|
2923
2920
|
treeConfig
|
|
2924
2921
|
} = props;
|
|
2925
|
-
const
|
|
2922
|
+
const {
|
|
2923
|
+
treeExpandedMaps
|
|
2924
|
+
} = reactData;
|
|
2926
2925
|
const {
|
|
2927
2926
|
fullAllDataRowIdData,
|
|
2928
2927
|
tableFullData,
|
|
2929
2928
|
tableFullTreeData
|
|
2930
2929
|
} = internalData;
|
|
2930
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2931
2931
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2932
2932
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
2933
2933
|
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
2934
|
-
const
|
|
2935
|
-
const fullAllDataRowIdMaps = {};
|
|
2934
|
+
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
2936
2935
|
const fullDataRowIdMaps = {};
|
|
2936
|
+
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
2937
2937
|
const handleRow = (row, index, items, path, parentRow, nodes) => {
|
|
2938
2938
|
let rowid = (0, _util.getRowid)($xeTable, row);
|
|
2939
2939
|
const seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
|
|
@@ -2942,8 +2942,16 @@ const Methods = {
|
|
|
2942
2942
|
rowid = (0, _util.getRowUniqueId)();
|
|
2943
2943
|
_xeUtils.default.set(row, rowkey, rowid);
|
|
2944
2944
|
}
|
|
2945
|
-
if (
|
|
2946
|
-
|
|
2945
|
+
if (treeConfig && treeOpts.lazy) {
|
|
2946
|
+
const treeExpRest = treeExpandedMaps[rowid];
|
|
2947
|
+
if (row[hasChildField] && _xeUtils.default.isUndefined(row[childrenField])) {
|
|
2948
|
+
row[childrenField] = null;
|
|
2949
|
+
}
|
|
2950
|
+
if (treeExpRest) {
|
|
2951
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
2952
|
+
delete treeTempExpandedMaps[rowid];
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2947
2955
|
}
|
|
2948
2956
|
let rowRest = fullAllDataRowIdData[rowid];
|
|
2949
2957
|
if (!rowRest) {
|
|
@@ -2964,6 +2972,8 @@ const Methods = {
|
|
|
2964
2972
|
expandHeight: 0
|
|
2965
2973
|
};
|
|
2966
2974
|
}
|
|
2975
|
+
rowRest.treeLoaded = false;
|
|
2976
|
+
rowRest.expandLoaded = false;
|
|
2967
2977
|
rowRest.row = row;
|
|
2968
2978
|
rowRest.items = items;
|
|
2969
2979
|
rowRest.parent = parentRow;
|
|
@@ -2972,8 +2982,6 @@ const Methods = {
|
|
|
2972
2982
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
2973
2983
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2974
2984
|
};
|
|
2975
|
-
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2976
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2977
2985
|
if (treeConfig) {
|
|
2978
2986
|
_xeUtils.default.eachTree(tableFullTreeData, handleRow, {
|
|
2979
2987
|
children: childrenField
|
|
@@ -2981,6 +2989,9 @@ const Methods = {
|
|
|
2981
2989
|
} else {
|
|
2982
2990
|
tableFullData.forEach(handleRow);
|
|
2983
2991
|
}
|
|
2992
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2993
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2994
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps;
|
|
2984
2995
|
},
|
|
2985
2996
|
cacheSourceMap(fullData) {
|
|
2986
2997
|
let {
|
|
@@ -3381,16 +3392,30 @@ const Methods = {
|
|
|
3381
3392
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
3382
3393
|
*/
|
|
3383
3394
|
revertData(rows, field) {
|
|
3395
|
+
const $xeTable = this;
|
|
3396
|
+
const props = $xeTable;
|
|
3397
|
+
const reactData = $xeTable;
|
|
3398
|
+
const internalData = $xeTable;
|
|
3384
3399
|
const {
|
|
3385
3400
|
keepSource,
|
|
3386
|
-
tableSourceData,
|
|
3387
3401
|
treeConfig
|
|
3388
|
-
} =
|
|
3402
|
+
} = props;
|
|
3403
|
+
const {
|
|
3404
|
+
fullAllDataRowIdData,
|
|
3405
|
+
tableSourceData,
|
|
3406
|
+
sourceDataRowIdData,
|
|
3407
|
+
tableFullData,
|
|
3408
|
+
afterFullData
|
|
3409
|
+
} = internalData;
|
|
3410
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3411
|
+
const {
|
|
3412
|
+
transform
|
|
3413
|
+
} = treeOpts;
|
|
3389
3414
|
if (!keepSource) {
|
|
3390
3415
|
if (process.env.NODE_ENV === 'development') {
|
|
3391
3416
|
(0, _log.warnLog)('vxe.error.reqProp', ['keep-source']);
|
|
3392
3417
|
}
|
|
3393
|
-
return
|
|
3418
|
+
return $xeTable.$nextTick();
|
|
3394
3419
|
}
|
|
3395
3420
|
let targetRows = rows;
|
|
3396
3421
|
if (rows) {
|
|
@@ -3398,30 +3423,52 @@ const Methods = {
|
|
|
3398
3423
|
targetRows = [rows];
|
|
3399
3424
|
}
|
|
3400
3425
|
} else {
|
|
3401
|
-
targetRows = _xeUtils.default.toArray(
|
|
3426
|
+
targetRows = _xeUtils.default.toArray($xeTable.getUpdateRecords());
|
|
3402
3427
|
}
|
|
3428
|
+
let reDelFlag = false;
|
|
3403
3429
|
if (targetRows.length) {
|
|
3404
3430
|
targetRows.forEach(row => {
|
|
3405
|
-
if (
|
|
3406
|
-
const
|
|
3407
|
-
|
|
3408
|
-
(0, _log.errLog)('vxe.error.noTree', ['revertData']);
|
|
3409
|
-
}
|
|
3410
|
-
const oRow = tableSourceData[rowIndex];
|
|
3431
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3432
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3433
|
+
const oRow = sourceDataRowIdData[rowid];
|
|
3411
3434
|
if (oRow && row) {
|
|
3412
3435
|
if (field) {
|
|
3413
3436
|
_xeUtils.default.set(row, field, _xeUtils.default.clone(_xeUtils.default.get(oRow, field), true));
|
|
3414
3437
|
} else {
|
|
3415
3438
|
_xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
|
|
3416
3439
|
}
|
|
3440
|
+
if ($xeTable.isRemoveByRow(row)) {
|
|
3441
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3442
|
+
if (rowRest) {
|
|
3443
|
+
const reRow = rowRest.row;
|
|
3444
|
+
tableFullData.unshift(reRow);
|
|
3445
|
+
afterFullData.unshift(reRow);
|
|
3446
|
+
reDelFlag = true;
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3417
3449
|
}
|
|
3418
3450
|
}
|
|
3419
3451
|
});
|
|
3420
3452
|
}
|
|
3421
3453
|
if (rows) {
|
|
3422
|
-
|
|
3454
|
+
if (reDelFlag) {
|
|
3455
|
+
$xeTable.updateFooter();
|
|
3456
|
+
$xeTable.cacheRowMap(false);
|
|
3457
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
3458
|
+
if (!(treeConfig && transform)) {
|
|
3459
|
+
$xeTable.updateAfterDataIndex();
|
|
3460
|
+
}
|
|
3461
|
+
$xeTable.checkSelectionStatus();
|
|
3462
|
+
if (reactData.scrollYLoad) {
|
|
3463
|
+
$xeTable.updateScrollYSpace();
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
return $xeTable.$nextTick().then(() => {
|
|
3467
|
+
$xeTable.updateCellAreas();
|
|
3468
|
+
return $xeTable.recalculate();
|
|
3469
|
+
});
|
|
3423
3470
|
}
|
|
3424
|
-
return
|
|
3471
|
+
return $xeTable.reloadData(tableSourceData);
|
|
3425
3472
|
},
|
|
3426
3473
|
/**
|
|
3427
3474
|
* 清空单元格内容
|
|
@@ -3551,12 +3598,23 @@ const Methods = {
|
|
|
3551
3598
|
* @param {Row} row 行对象
|
|
3552
3599
|
*/
|
|
3553
3600
|
isInsertByRow(row) {
|
|
3601
|
+
const $xeTable = this;
|
|
3602
|
+
const reactData = $xeTable;
|
|
3554
3603
|
const {
|
|
3555
3604
|
editStore
|
|
3556
|
-
} =
|
|
3557
|
-
const rowid = (0, _util.getRowid)(
|
|
3605
|
+
} = reactData;
|
|
3606
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3558
3607
|
return !!editStore.insertMaps[rowid];
|
|
3559
3608
|
},
|
|
3609
|
+
isRemoveByRow(row) {
|
|
3610
|
+
const $xeTable = this;
|
|
3611
|
+
const reactData = $xeTable;
|
|
3612
|
+
const {
|
|
3613
|
+
editStore
|
|
3614
|
+
} = reactData;
|
|
3615
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3616
|
+
return !!editStore.removeMaps[rowid];
|
|
3617
|
+
},
|
|
3560
3618
|
/**
|
|
3561
3619
|
* 删除所有新增的临时数据
|
|
3562
3620
|
* @returns
|
|
@@ -10331,19 +10389,17 @@ const Methods = {
|
|
|
10331
10389
|
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,resetFilterPanel,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
10332
10390
|
funcs.forEach(name => {
|
|
10333
10391
|
Methods[name] = function (...args) {
|
|
10334
|
-
if (
|
|
10335
|
-
if (
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
10346
|
-
}
|
|
10392
|
+
if (!this[`_${name}`]) {
|
|
10393
|
+
if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
10394
|
+
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableExportModule']);
|
|
10395
|
+
} else if ('fullValidate,validate'.split(',').includes(name)) {
|
|
10396
|
+
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableValidatorModule']);
|
|
10397
|
+
} else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
|
|
10398
|
+
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableFilterModule']);
|
|
10399
|
+
} else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
|
|
10400
|
+
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableEditModule']);
|
|
10401
|
+
} else if ('openCustom'.split(',').includes(name)) {
|
|
10402
|
+
(0, _log.errLog)('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
10347
10403
|
}
|
|
10348
10404
|
}
|
|
10349
10405
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|