vxe-table 3.19.20 → 3.19.22
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 +148 -33
- package/es/style.css +1 -1
- package/es/table/render/index.js +113 -4
- package/es/table/src/cell.js +10 -8
- package/es/table/src/methods.js +176 -74
- package/es/table/src/table.js +12 -2
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +166 -48
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +367 -89
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +140 -10
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/cell.js +13 -7
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +160 -56
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +15 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +3 -2
- 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 +148 -35
- package/packages/table/render/index.ts +115 -4
- package/packages/table/src/cell.ts +10 -8
- package/packages/table/src/methods.ts +176 -72
- package/packages/table/src/table.ts +13 -2
- package/packages/ui/index.ts +2 -1
- /package/es/{iconfont.1764045838630.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/es/{iconfont.1764045838630.woff → iconfont.1764380622607.woff} +0 -0
- /package/es/{iconfont.1764045838630.woff2 → iconfont.1764380622607.woff2} +0 -0
- /package/lib/{iconfont.1764045838630.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/lib/{iconfont.1764045838630.woff → iconfont.1764380622607.woff} +0 -0
- /package/lib/{iconfont.1764045838630.woff2 → iconfont.1764380622607.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -28,6 +28,7 @@ const supportMaxRow = 5e6;
|
|
|
28
28
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
29
29
|
const maxYHeight = 5e6;
|
|
30
30
|
const maxXWidth = 5e6;
|
|
31
|
+
const sourceType = 'table';
|
|
31
32
|
let crossTableDragRowObj = null;
|
|
32
33
|
function eqCellValue(row1, row2, field) {
|
|
33
34
|
const val1 = _xeUtils.default.get(row1, field);
|
|
@@ -2993,11 +2994,39 @@ const calcCellHeight = $xeTable => {
|
|
|
2993
2994
|
}
|
|
2994
2995
|
};
|
|
2995
2996
|
function getOrderField($xeTable, column) {
|
|
2997
|
+
const reactData = $xeTable;
|
|
2998
|
+
const {
|
|
2999
|
+
isRowGroupStatus
|
|
3000
|
+
} = reactData;
|
|
2996
3001
|
const {
|
|
2997
3002
|
sortBy,
|
|
2998
|
-
sortType
|
|
3003
|
+
sortType,
|
|
3004
|
+
aggFunc
|
|
2999
3005
|
} = column;
|
|
3000
|
-
return row => {
|
|
3006
|
+
return isRowGroupStatus && aggFunc ? row => {
|
|
3007
|
+
if (row.isAggregate) {
|
|
3008
|
+
const aggData = row.aggData;
|
|
3009
|
+
const currAggData = aggData ? aggData[column.field] : null;
|
|
3010
|
+
return currAggData ? currAggData.value : null;
|
|
3011
|
+
}
|
|
3012
|
+
let cellValue;
|
|
3013
|
+
if (sortBy) {
|
|
3014
|
+
cellValue = _xeUtils.default.isFunction(sortBy) ? sortBy({
|
|
3015
|
+
row,
|
|
3016
|
+
column
|
|
3017
|
+
}) : _xeUtils.default.get(row, sortBy);
|
|
3018
|
+
} else {
|
|
3019
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
3020
|
+
}
|
|
3021
|
+
if (!sortType || sortType === 'auto') {
|
|
3022
|
+
return isNaN(cellValue) ? cellValue : _xeUtils.default.toNumber(cellValue);
|
|
3023
|
+
} else if (sortType === 'number') {
|
|
3024
|
+
return _xeUtils.default.toNumber(cellValue);
|
|
3025
|
+
} else if (sortType === 'string') {
|
|
3026
|
+
return _xeUtils.default.toValueString(cellValue);
|
|
3027
|
+
}
|
|
3028
|
+
return cellValue;
|
|
3029
|
+
} : row => {
|
|
3001
3030
|
let cellValue;
|
|
3002
3031
|
if (sortBy) {
|
|
3003
3032
|
cellValue = _xeUtils.default.isFunction(sortBy) ? sortBy({
|
|
@@ -3602,10 +3631,16 @@ function handleUpdateRowGroup($xeTable, groupFields) {
|
|
|
3602
3631
|
handleUpdateAggValues($xeTable);
|
|
3603
3632
|
}
|
|
3604
3633
|
function handleeGroupSummary($xeTable, aggList) {
|
|
3634
|
+
const internalData = $xeTable;
|
|
3635
|
+
const {
|
|
3636
|
+
fullColumnFieldData
|
|
3637
|
+
} = internalData;
|
|
3605
3638
|
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
3639
|
+
const aggFuncColumns = $xeTable.computeAggFuncColumns;
|
|
3606
3640
|
const {
|
|
3607
3641
|
mapChildrenField
|
|
3608
3642
|
} = aggregateOpts;
|
|
3643
|
+
const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
|
|
3609
3644
|
if (mapChildrenField) {
|
|
3610
3645
|
_xeUtils.default.lastEach(aggList, aggRow => {
|
|
3611
3646
|
let count = 0;
|
|
@@ -3620,6 +3655,62 @@ function handleeGroupSummary($xeTable, aggList) {
|
|
|
3620
3655
|
});
|
|
3621
3656
|
if ($xeTable.handlePivotTableAggregateData) {
|
|
3622
3657
|
$xeTable.handlePivotTableAggregateData(aggList);
|
|
3658
|
+
} else {
|
|
3659
|
+
_xeUtils.default.lastEach(aggList, aggRow => {
|
|
3660
|
+
const aggDtObj = {};
|
|
3661
|
+
const aggData = aggRow.aggData;
|
|
3662
|
+
const groupField = aggRow.groupField;
|
|
3663
|
+
const groupContent = aggRow.groupContent;
|
|
3664
|
+
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
3665
|
+
const childCount = aggRow.childCount;
|
|
3666
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
3667
|
+
aggFuncColumns.forEach(column => {
|
|
3668
|
+
const {
|
|
3669
|
+
field
|
|
3670
|
+
} = column;
|
|
3671
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
3672
|
+
const ctParams = {
|
|
3673
|
+
$table: $xeTable,
|
|
3674
|
+
groupField,
|
|
3675
|
+
groupColumn: colRest ? colRest.column : null,
|
|
3676
|
+
column,
|
|
3677
|
+
groupValue: groupContent,
|
|
3678
|
+
childList,
|
|
3679
|
+
childCount,
|
|
3680
|
+
aggValue: currAggData ? currAggData.value : 0,
|
|
3681
|
+
/**
|
|
3682
|
+
* 已废弃
|
|
3683
|
+
* @deprecated
|
|
3684
|
+
*/
|
|
3685
|
+
children: childList,
|
|
3686
|
+
/**
|
|
3687
|
+
* 已废弃
|
|
3688
|
+
* @deprecated
|
|
3689
|
+
*/
|
|
3690
|
+
totalValue: childCount
|
|
3691
|
+
};
|
|
3692
|
+
let aggVal = 0;
|
|
3693
|
+
// 如果下层同时也是分组
|
|
3694
|
+
if (childList.length && childList[0].isAggregate) {
|
|
3695
|
+
_xeUtils.default.each(childList, row => {
|
|
3696
|
+
if (row.isAggregate) {
|
|
3697
|
+
const currAggData = row.aggData[field];
|
|
3698
|
+
if (currAggData) {
|
|
3699
|
+
aggVal += currAggData.value;
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3702
|
+
});
|
|
3703
|
+
} else {
|
|
3704
|
+
aggVal = aggCalcMethod ? aggCalcMethod(ctParams) : aggRow.childCount;
|
|
3705
|
+
}
|
|
3706
|
+
aggDtObj[field] = {
|
|
3707
|
+
type: 'count',
|
|
3708
|
+
value: aggVal,
|
|
3709
|
+
label: aggVal
|
|
3710
|
+
};
|
|
3711
|
+
});
|
|
3712
|
+
aggRow.aggData = aggDtObj;
|
|
3713
|
+
});
|
|
3623
3714
|
}
|
|
3624
3715
|
}
|
|
3625
3716
|
}
|
|
@@ -4834,7 +4925,35 @@ function handleRowExpandScroll($xeTable) {
|
|
|
4834
4925
|
rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
|
|
4835
4926
|
}
|
|
4836
4927
|
}
|
|
4837
|
-
|
|
4928
|
+
function handleColumnVisible(visible) {
|
|
4929
|
+
const $xeTable = this;
|
|
4930
|
+
return function (fieldOrColumn) {
|
|
4931
|
+
let status = false;
|
|
4932
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4933
|
+
cols.forEach(item => {
|
|
4934
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4935
|
+
if (column) {
|
|
4936
|
+
if (column.children && column.children.length) {
|
|
4937
|
+
_xeUtils.default.eachTree([column], item => {
|
|
4938
|
+
item.visible = visible;
|
|
4939
|
+
item.renderVisible = visible;
|
|
4940
|
+
});
|
|
4941
|
+
} else {
|
|
4942
|
+
column.visible = visible;
|
|
4943
|
+
column.renderVisible = visible;
|
|
4944
|
+
}
|
|
4945
|
+
if (!status) {
|
|
4946
|
+
status = true;
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
});
|
|
4950
|
+
if (status) {
|
|
4951
|
+
return $xeTable.handleCustom();
|
|
4952
|
+
}
|
|
4953
|
+
return $xeTable.$nextTick();
|
|
4954
|
+
};
|
|
4955
|
+
}
|
|
4956
|
+
const tableMethods = {
|
|
4838
4957
|
callSlot(slotFunc, params, h, vNodes) {
|
|
4839
4958
|
const $xeTable = this;
|
|
4840
4959
|
// const slots = $xeTable.$scopedSlots
|
|
@@ -5751,15 +5870,27 @@ const Methods = {
|
|
|
5751
5870
|
},
|
|
5752
5871
|
getCellLabel(row, fieldOrColumn) {
|
|
5753
5872
|
const $xeTable = this;
|
|
5873
|
+
const props = $xeTable;
|
|
5754
5874
|
const internalData = $xeTable;
|
|
5755
|
-
const column = (0, _util.handleFieldOrColumn)(
|
|
5875
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
5756
5876
|
if (!column) {
|
|
5757
5877
|
return null;
|
|
5758
5878
|
}
|
|
5759
|
-
const
|
|
5879
|
+
const {
|
|
5880
|
+
editConfig
|
|
5881
|
+
} = props;
|
|
5882
|
+
const {
|
|
5883
|
+
formatter,
|
|
5884
|
+
editRender,
|
|
5885
|
+
cellRender
|
|
5886
|
+
} = column;
|
|
5887
|
+
// formatter > tableCellFormatter
|
|
5888
|
+
const renderOpts = formatter ? null : editConfig && (0, _utils.isEnableConf)(editRender) ? editRender : (0, _utils.isEnableConf)(cellRender) ? cellRender : null;
|
|
5889
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
5890
|
+
const tcFormatter = compConf ? compConf.tableCellFormatter : null;
|
|
5760
5891
|
const cellValue = (0, _util.getCellValue)(row, column);
|
|
5761
5892
|
let cellLabel = cellValue;
|
|
5762
|
-
if (formatter) {
|
|
5893
|
+
if (formatter || tcFormatter) {
|
|
5763
5894
|
let formatData;
|
|
5764
5895
|
const {
|
|
5765
5896
|
fullAllDataRowIdData
|
|
@@ -5779,22 +5910,27 @@ const Methods = {
|
|
|
5779
5910
|
}
|
|
5780
5911
|
}
|
|
5781
5912
|
const formatParams = {
|
|
5913
|
+
$table: $xeTable,
|
|
5782
5914
|
cellValue,
|
|
5783
5915
|
row,
|
|
5784
|
-
rowIndex:
|
|
5916
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
5785
5917
|
column,
|
|
5786
|
-
columnIndex:
|
|
5918
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5787
5919
|
};
|
|
5788
|
-
if (
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5920
|
+
if (formatter) {
|
|
5921
|
+
if (_xeUtils.default.isString(formatter)) {
|
|
5922
|
+
const gFormatOpts = formats.get(formatter);
|
|
5923
|
+
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
5924
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
5925
|
+
} else if (_xeUtils.default.isArray(formatter)) {
|
|
5926
|
+
const gFormatOpts = formats.get(formatter[0]);
|
|
5927
|
+
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
5928
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
5929
|
+
} else {
|
|
5930
|
+
cellLabel = formatter(formatParams);
|
|
5931
|
+
}
|
|
5932
|
+
} else if (renderOpts && tcFormatter) {
|
|
5933
|
+
cellLabel = `${tcFormatter(renderOpts, formatParams)}`;
|
|
5798
5934
|
}
|
|
5799
5935
|
if (formatData) {
|
|
5800
5936
|
formatData[colid] = {
|
|
@@ -5852,6 +5988,7 @@ const Methods = {
|
|
|
5852
5988
|
}
|
|
5853
5989
|
}
|
|
5854
5990
|
const footerFormatParams = {
|
|
5991
|
+
$table: $xeTable,
|
|
5855
5992
|
cellValue: itemValue,
|
|
5856
5993
|
itemValue,
|
|
5857
5994
|
row,
|
|
@@ -6467,45 +6604,11 @@ const Methods = {
|
|
|
6467
6604
|
/**
|
|
6468
6605
|
* 隐藏指定列
|
|
6469
6606
|
*/
|
|
6470
|
-
hideColumn(
|
|
6471
|
-
const $xeTable = this;
|
|
6472
|
-
let status = false;
|
|
6473
|
-
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
6474
|
-
cols.forEach(item => {
|
|
6475
|
-
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
6476
|
-
if (column && column.visible) {
|
|
6477
|
-
column.visible = false;
|
|
6478
|
-
if (!status) {
|
|
6479
|
-
status = true;
|
|
6480
|
-
}
|
|
6481
|
-
}
|
|
6482
|
-
});
|
|
6483
|
-
if (status) {
|
|
6484
|
-
return $xeTable.handleCustom();
|
|
6485
|
-
}
|
|
6486
|
-
return $xeTable.$nextTick();
|
|
6487
|
-
},
|
|
6607
|
+
hideColumn: handleColumnVisible(false),
|
|
6488
6608
|
/**
|
|
6489
6609
|
* 显示指定列
|
|
6490
6610
|
*/
|
|
6491
|
-
showColumn(
|
|
6492
|
-
const $xeTable = this;
|
|
6493
|
-
let status = false;
|
|
6494
|
-
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
6495
|
-
cols.forEach(item => {
|
|
6496
|
-
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
6497
|
-
if (column && !column.visible) {
|
|
6498
|
-
column.visible = true;
|
|
6499
|
-
if (!status) {
|
|
6500
|
-
status = true;
|
|
6501
|
-
}
|
|
6502
|
-
}
|
|
6503
|
-
});
|
|
6504
|
-
if (status) {
|
|
6505
|
-
return $xeTable.handleCustom();
|
|
6506
|
-
}
|
|
6507
|
-
return $xeTable.$nextTick();
|
|
6508
|
-
},
|
|
6611
|
+
showColumn: handleColumnVisible(true),
|
|
6509
6612
|
setColumnWidth(fieldOrColumn, width) {
|
|
6510
6613
|
const $xeTable = this;
|
|
6511
6614
|
const internalData = $xeTable;
|
|
@@ -12658,6 +12761,7 @@ const Methods = {
|
|
|
12658
12761
|
}
|
|
12659
12762
|
reactData.lastScrollTime = Date.now();
|
|
12660
12763
|
const evntParams = Object.assign({
|
|
12764
|
+
source: sourceType,
|
|
12661
12765
|
scrollTop,
|
|
12662
12766
|
scrollLeft,
|
|
12663
12767
|
bodyHeight,
|
|
@@ -13976,7 +14080,7 @@ const Methods = {
|
|
|
13976
14080
|
// Module methods
|
|
13977
14081
|
const funcs = 'setFilter,openFilter,clearFilter,saveFilter,saveFilterByEvent,resetFilter,resetFilterByEvent,saveFilterPanel,saveFilterPanelByEvent,resetFilterPanel,resetFilterPanelByEvent,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,getEditCell,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,getCustomVisible,openCustom,closeCustom,toggleCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
13978
14082
|
funcs.forEach(name => {
|
|
13979
|
-
|
|
14083
|
+
tableMethods[name] = function (...args) {
|
|
13980
14084
|
// if (!this[`_${name}`]) {
|
|
13981
14085
|
// if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
13982
14086
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
@@ -13993,4 +14097,4 @@ funcs.forEach(name => {
|
|
|
13993
14097
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|
|
13994
14098
|
};
|
|
13995
14099
|
});
|
|
13996
|
-
var _default = exports.default =
|
|
14100
|
+
var _default = exports.default = tableMethods;
|