vxe-table 4.17.20 → 4.17.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 +136 -30
- 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/table.js +172 -67
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +152 -43
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +331 -75
- 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/table.js +19 -11
- 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 +132 -29
- package/packages/table/render/index.ts +115 -4
- package/packages/table/src/cell.ts +10 -8
- package/packages/table/src/table.ts +170 -63
- package/packages/ui/index.ts +2 -1
- /package/es/{iconfont.1764045862093.ttf → iconfont.1764380640866.ttf} +0 -0
- /package/es/{iconfont.1764045862093.woff → iconfont.1764380640866.woff} +0 -0
- /package/es/{iconfont.1764045862093.woff2 → iconfont.1764380640866.woff2} +0 -0
- /package/lib/{iconfont.1764045862093.ttf → iconfont.1764380640866.ttf} +0 -0
- /package/lib/{iconfont.1764045862093.woff → iconfont.1764380640866.woff} +0 -0
- /package/lib/{iconfont.1764045862093.woff2 → iconfont.1764380640866.woff2} +0 -0
package/es/table/render/index.js
CHANGED
|
@@ -532,9 +532,8 @@ function oldSelectEditRender(renderOpts, params) {
|
|
|
532
532
|
h(getOldComponent(renderOpts), Object.assign(Object.assign({}, getCellEditProps(renderOpts, params, cellValue, { options, optionProps, optionGroups, optionGroupProps })), getEditOns(renderOpts, params)))
|
|
533
533
|
];
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function handleSelectCellValue(cellValue, renderOpts) {
|
|
536
536
|
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props = {} } = renderOpts;
|
|
537
|
-
const cellValue = XEUtils.get(row, column.field);
|
|
538
537
|
let selectItem;
|
|
539
538
|
const labelProp = optionProps.label || 'label';
|
|
540
539
|
const valueProp = optionProps.value || 'value';
|
|
@@ -571,13 +570,16 @@ function getSelectCellValue(renderOpts, { row, column }) {
|
|
|
571
570
|
}
|
|
572
571
|
return '';
|
|
573
572
|
}
|
|
573
|
+
function getSelectCellValue(renderOpts, { row, column }) {
|
|
574
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
575
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
576
|
+
}
|
|
574
577
|
function handleExportSelectMethod(params) {
|
|
575
578
|
const { row, column, options } = params;
|
|
576
579
|
return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params);
|
|
577
580
|
}
|
|
578
|
-
function
|
|
581
|
+
function handleTreeSelectCellValue(cellValue, renderOpts) {
|
|
579
582
|
const { options, optionProps = {} } = renderOpts;
|
|
580
|
-
const cellValue = XEUtils.get(row, column.field);
|
|
581
583
|
const labelProp = optionProps.label || 'label';
|
|
582
584
|
const valueProp = optionProps.value || 'value';
|
|
583
585
|
const childrenProp = optionProps.children || 'children';
|
|
@@ -593,6 +595,10 @@ function getTreeSelectCellValue(renderOpts, { row, column }) {
|
|
|
593
595
|
}
|
|
594
596
|
return '';
|
|
595
597
|
}
|
|
598
|
+
function getTreeSelectCellValue(renderOpts, { row, column }) {
|
|
599
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
600
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
601
|
+
}
|
|
596
602
|
function handleExportTreeSelectMethod(params) {
|
|
597
603
|
const { row, column, options } = params;
|
|
598
604
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
|
|
@@ -654,6 +660,91 @@ function handleNumberCell(renderOpts, params) {
|
|
|
654
660
|
}
|
|
655
661
|
: {});
|
|
656
662
|
}
|
|
663
|
+
function handleFormatSelect(renderOpts, params) {
|
|
664
|
+
const { cellValue } = params;
|
|
665
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
666
|
+
}
|
|
667
|
+
function handleSetSelectValue(renderOpts, params) {
|
|
668
|
+
const { row, column, cellValue } = params;
|
|
669
|
+
const { field } = column;
|
|
670
|
+
if (field) {
|
|
671
|
+
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props } = renderOpts;
|
|
672
|
+
if (isEmptyValue(cellValue)) {
|
|
673
|
+
XEUtils.set(row, field, props && props.multiple ? [] : null);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const isMultiVal = XEUtils.indexOf(`${cellValue}`, ',') > -1;
|
|
677
|
+
const labelProp = optionProps.label || 'label';
|
|
678
|
+
const valueProp = optionProps.value || 'value';
|
|
679
|
+
const labelMpas = {};
|
|
680
|
+
if (optionGroups && optionGroups.length) {
|
|
681
|
+
const groupOptions = optionGroupProps.options || 'options';
|
|
682
|
+
for (let i = 0; i < optionGroups.length; i++) {
|
|
683
|
+
const opts = optionGroups[i][groupOptions] || {};
|
|
684
|
+
for (let j = 0; j < opts.length; j++) {
|
|
685
|
+
const item = opts[j];
|
|
686
|
+
if (isMultiVal) {
|
|
687
|
+
labelMpas[item[labelProp]] = item;
|
|
688
|
+
/* eslint-disable eqeqeq */
|
|
689
|
+
}
|
|
690
|
+
else if (item[labelProp] == cellValue) {
|
|
691
|
+
XEUtils.set(row, field, item[valueProp]);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
if (options) {
|
|
699
|
+
for (let i = 0; i < options.length; i++) {
|
|
700
|
+
const item = options[i];
|
|
701
|
+
if (isMultiVal) {
|
|
702
|
+
labelMpas[item[labelProp]] = item;
|
|
703
|
+
/* eslint-disable eqeqeq */
|
|
704
|
+
}
|
|
705
|
+
else if (item[labelProp] == cellValue) {
|
|
706
|
+
XEUtils.set(row, field, item[valueProp]);
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (isMultiVal) {
|
|
713
|
+
XEUtils.set(row, field, (isMultiVal
|
|
714
|
+
? cellValue.split(',')
|
|
715
|
+
: [cellValue]).map((label) => {
|
|
716
|
+
const item = labelMpas[label];
|
|
717
|
+
return item ? item[valueProp] : label;
|
|
718
|
+
}));
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
XEUtils.set(row, field, cellValue);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function handleFormatTreeSelect(renderOpts, params) {
|
|
726
|
+
const { cellValue } = params;
|
|
727
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
728
|
+
}
|
|
729
|
+
function handleSetTreeSelectValue(renderOpts, params) {
|
|
730
|
+
const { row, column, cellValue } = params;
|
|
731
|
+
const { field } = column;
|
|
732
|
+
if (field) {
|
|
733
|
+
const { options, optionProps = {} } = renderOpts;
|
|
734
|
+
const labelProp = optionProps.label || 'label';
|
|
735
|
+
const valueProp = optionProps.value || 'value';
|
|
736
|
+
const childrenProp = optionProps.children || 'children';
|
|
737
|
+
const matchRest = XEUtils.findTree(options || [], item => XEUtils.get(item, labelProp) === cellValue, { children: childrenProp });
|
|
738
|
+
if (matchRest) {
|
|
739
|
+
const selectItem = matchRest.item;
|
|
740
|
+
if (selectItem) {
|
|
741
|
+
XEUtils.set(row, field, selectItem[valueProp]);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
XEUtils.set(row, field, cellValue);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
657
748
|
/**
|
|
658
749
|
* 表格 - 渲染器
|
|
659
750
|
*/
|
|
@@ -681,6 +772,9 @@ renderer.mixin({
|
|
|
681
772
|
return h('select', Object.assign(Object.assign({ key: oIndex, class: 'vxe-default-select' }, getNativeAttrs(renderOpts)), getNativeFilterOns(renderOpts, params, option)), renderOpts.optionGroups ? renderNativeOptgroups(renderOpts, params, renderNativeOptions) : renderNativeOptions(renderOpts.options, renderOpts, params));
|
|
682
773
|
});
|
|
683
774
|
},
|
|
775
|
+
tableCellFormatter: handleFormatSelect,
|
|
776
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
777
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
684
778
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
685
779
|
tableExportMethod: handleExportSelectMethod
|
|
686
780
|
},
|
|
@@ -907,6 +1001,9 @@ renderer.mixin({
|
|
|
907
1001
|
const optionValue = option.data;
|
|
908
1002
|
return h(getDefaultComponent(renderOpts), Object.assign(Object.assign({}, getCellEditFilterProps(renderOpts, params, optionValue, { options, optionProps, optionGroups, optionGroupProps })), getFloatingFilterOns(renderOpts, params, option)));
|
|
909
1003
|
},
|
|
1004
|
+
tableCellFormatter: handleFormatSelect,
|
|
1005
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1006
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
910
1007
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
911
1008
|
tableExportMethod: handleExportSelectMethod
|
|
912
1009
|
},
|
|
@@ -944,6 +1041,9 @@ renderer.mixin({
|
|
|
944
1041
|
renderTableDefault(renderOpts, params) {
|
|
945
1042
|
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
946
1043
|
},
|
|
1044
|
+
tableCellFormatter: handleFormatSelect,
|
|
1045
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1046
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
947
1047
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
948
1048
|
tableExportMethod: handleExportSelectMethod
|
|
949
1049
|
},
|
|
@@ -953,6 +1053,9 @@ renderer.mixin({
|
|
|
953
1053
|
renderTableCell(renderOpts, params) {
|
|
954
1054
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
955
1055
|
},
|
|
1056
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1057
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1058
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
956
1059
|
tableExportMethod: handleExportTreeSelectMethod
|
|
957
1060
|
},
|
|
958
1061
|
/**
|
|
@@ -968,6 +1071,9 @@ renderer.mixin({
|
|
|
968
1071
|
renderTableDefault(renderOpts, params) {
|
|
969
1072
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
970
1073
|
},
|
|
1074
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1075
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1076
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
971
1077
|
tableExportMethod: handleExportTreeSelectMethod
|
|
972
1078
|
},
|
|
973
1079
|
VxeTableSelect: {
|
|
@@ -976,6 +1082,9 @@ renderer.mixin({
|
|
|
976
1082
|
renderTableCell(renderOpts, params) {
|
|
977
1083
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
978
1084
|
},
|
|
1085
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1086
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1087
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
979
1088
|
tableExportMethod: handleExportTreeSelectMethod
|
|
980
1089
|
},
|
|
981
1090
|
VxeColorPicker: {
|
package/es/table/src/cell.js
CHANGED
|
@@ -366,8 +366,9 @@ export const Cell = {
|
|
|
366
366
|
const { fullColumnFieldData } = tableInternalData;
|
|
367
367
|
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
368
368
|
const aggregateOpts = computeAggregateOpts.value;
|
|
369
|
-
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts;
|
|
370
|
-
const
|
|
369
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
370
|
+
const aggData = aggRow.aggData;
|
|
371
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
371
372
|
const groupField = aggRow.groupField;
|
|
372
373
|
const groupContent = aggRow.groupContent;
|
|
373
374
|
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
@@ -409,9 +410,10 @@ export const Cell = {
|
|
|
409
410
|
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
410
411
|
}
|
|
411
412
|
else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
414
|
+
ctParams.aggValue = cellValue;
|
|
415
|
+
if (formatValuesMethod) {
|
|
416
|
+
cellValue = formatValuesMethod(ctParams);
|
|
415
417
|
}
|
|
416
418
|
}
|
|
417
419
|
}
|
|
@@ -465,7 +467,7 @@ export const Cell = {
|
|
|
465
467
|
const { rowGroupExpandedFlag } = tableReactData;
|
|
466
468
|
const { rowGroupExpandedMaps } = tableInternalData;
|
|
467
469
|
const aggregateOpts = computeAggregateOpts.value;
|
|
468
|
-
const { mode, padding, indent } = aggregateOpts;
|
|
470
|
+
const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts;
|
|
469
471
|
const rowid = getRowid($table, row);
|
|
470
472
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
|
|
471
473
|
return h('div', {
|
|
@@ -478,7 +480,7 @@ export const Cell = {
|
|
|
478
480
|
}
|
|
479
481
|
: undefined
|
|
480
482
|
}, [
|
|
481
|
-
row.isAggregate
|
|
483
|
+
showIcon && row.isAggregate
|
|
482
484
|
? h('span', {
|
|
483
485
|
class: 'vxe-row-group--node-btn',
|
|
484
486
|
onClick(evnt) {
|
|
@@ -486,7 +488,7 @@ export const Cell = {
|
|
|
486
488
|
}
|
|
487
489
|
}, [
|
|
488
490
|
h('i', {
|
|
489
|
-
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
491
|
+
class: isExpand ? (iconOpen || getIcon().TABLE_ROW_GROUP_OPEN) : (iconClose || getIcon().TABLE_ROW_GROUP_CLOSE)
|
|
490
492
|
})
|
|
491
493
|
])
|
|
492
494
|
: renderEmptyElement($table),
|
package/es/table/src/table.js
CHANGED
|
@@ -33,6 +33,7 @@ const supportMaxRow = 5e6;
|
|
|
33
33
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
34
34
|
const maxYHeight = 5e6;
|
|
35
35
|
const maxXWidth = 5e6;
|
|
36
|
+
const sourceType = 'table';
|
|
36
37
|
let crossTableDragRowObj = null;
|
|
37
38
|
export default defineVxeComponent({
|
|
38
39
|
name: 'VxeTable',
|
|
@@ -817,6 +818,13 @@ export default defineVxeComponent({
|
|
|
817
818
|
});
|
|
818
819
|
return rgColumns;
|
|
819
820
|
});
|
|
821
|
+
const computeAggFuncColumns = computed(() => {
|
|
822
|
+
const { rowGroupList, tableColumn } = reactData;
|
|
823
|
+
if (rowGroupList.length) {
|
|
824
|
+
return tableColumn.filter(column => column.aggFunc);
|
|
825
|
+
}
|
|
826
|
+
return [];
|
|
827
|
+
});
|
|
820
828
|
const refMaps = {
|
|
821
829
|
refElem,
|
|
822
830
|
refTooltip,
|
|
@@ -916,6 +924,7 @@ export default defineVxeComponent({
|
|
|
916
924
|
computeVirtualScrollBars,
|
|
917
925
|
computeRowGroupFields,
|
|
918
926
|
computeRowGroupColumns,
|
|
927
|
+
computeAggFuncColumns,
|
|
919
928
|
computeFNROpts,
|
|
920
929
|
computeSXOpts,
|
|
921
930
|
computeSYOpts
|
|
@@ -2071,26 +2080,52 @@ export default defineVxeComponent({
|
|
|
2071
2080
|
}
|
|
2072
2081
|
};
|
|
2073
2082
|
const getOrderField = (column) => {
|
|
2074
|
-
const {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2083
|
+
const { isRowGroupStatus } = reactData;
|
|
2084
|
+
const { sortBy, sortType, aggFunc } = column;
|
|
2085
|
+
return isRowGroupStatus && aggFunc
|
|
2086
|
+
? (row) => {
|
|
2087
|
+
if (row.isAggregate) {
|
|
2088
|
+
const aggData = row.aggData;
|
|
2089
|
+
const currAggData = aggData ? aggData[column.field] : null;
|
|
2090
|
+
return currAggData ? currAggData.value : null;
|
|
2091
|
+
}
|
|
2092
|
+
let cellValue;
|
|
2093
|
+
if (sortBy) {
|
|
2094
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2095
|
+
}
|
|
2096
|
+
else {
|
|
2097
|
+
cellValue = tableMethods.getCellLabel(row, column);
|
|
2098
|
+
}
|
|
2099
|
+
if (!sortType || sortType === 'auto') {
|
|
2100
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2101
|
+
}
|
|
2102
|
+
else if (sortType === 'number') {
|
|
2103
|
+
return XEUtils.toNumber(cellValue);
|
|
2104
|
+
}
|
|
2105
|
+
else if (sortType === 'string') {
|
|
2106
|
+
return XEUtils.toValueString(cellValue);
|
|
2107
|
+
}
|
|
2108
|
+
return cellValue;
|
|
2091
2109
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2110
|
+
: (row) => {
|
|
2111
|
+
let cellValue;
|
|
2112
|
+
if (sortBy) {
|
|
2113
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2114
|
+
}
|
|
2115
|
+
else {
|
|
2116
|
+
cellValue = tableMethods.getCellLabel(row, column);
|
|
2117
|
+
}
|
|
2118
|
+
if (!sortType || sortType === 'auto') {
|
|
2119
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2120
|
+
}
|
|
2121
|
+
else if (sortType === 'number') {
|
|
2122
|
+
return XEUtils.toNumber(cellValue);
|
|
2123
|
+
}
|
|
2124
|
+
else if (sortType === 'string') {
|
|
2125
|
+
return XEUtils.toValueString(cellValue);
|
|
2126
|
+
}
|
|
2127
|
+
return cellValue;
|
|
2128
|
+
};
|
|
2094
2129
|
};
|
|
2095
2130
|
const updateAfterListIndex = () => {
|
|
2096
2131
|
const { treeConfig } = props;
|
|
@@ -3414,8 +3449,11 @@ export default defineVxeComponent({
|
|
|
3414
3449
|
handleUpdateAggValues();
|
|
3415
3450
|
};
|
|
3416
3451
|
const handleeGroupSummary = (aggList) => {
|
|
3452
|
+
const { fullColumnFieldData } = internalData;
|
|
3417
3453
|
const aggregateOpts = computeAggregateOpts.value;
|
|
3454
|
+
const aggFuncColumns = computeAggFuncColumns.value;
|
|
3418
3455
|
const { mapChildrenField } = aggregateOpts;
|
|
3456
|
+
const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
|
|
3419
3457
|
if (mapChildrenField) {
|
|
3420
3458
|
XEUtils.lastEach(aggList, aggRow => {
|
|
3421
3459
|
let count = 0;
|
|
@@ -3432,6 +3470,64 @@ export default defineVxeComponent({
|
|
|
3432
3470
|
if ($xeTable.handlePivotTableAggregateData) {
|
|
3433
3471
|
$xeTable.handlePivotTableAggregateData(aggList);
|
|
3434
3472
|
}
|
|
3473
|
+
else {
|
|
3474
|
+
if (aggFuncColumns.length) {
|
|
3475
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
3476
|
+
const aggDtObj = {};
|
|
3477
|
+
const aggData = aggRow.aggData;
|
|
3478
|
+
const groupField = aggRow.groupField;
|
|
3479
|
+
const groupContent = aggRow.groupContent;
|
|
3480
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
3481
|
+
const childCount = aggRow.childCount;
|
|
3482
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
3483
|
+
aggFuncColumns.forEach(column => {
|
|
3484
|
+
const { field } = column;
|
|
3485
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
3486
|
+
const ctParams = {
|
|
3487
|
+
$table: $xeTable,
|
|
3488
|
+
groupField,
|
|
3489
|
+
groupColumn: (colRest ? colRest.column : null),
|
|
3490
|
+
column,
|
|
3491
|
+
groupValue: groupContent,
|
|
3492
|
+
childList,
|
|
3493
|
+
childCount,
|
|
3494
|
+
aggValue: currAggData ? currAggData.value : 0,
|
|
3495
|
+
/**
|
|
3496
|
+
* 已废弃
|
|
3497
|
+
* @deprecated
|
|
3498
|
+
*/
|
|
3499
|
+
children: childList,
|
|
3500
|
+
/**
|
|
3501
|
+
* 已废弃
|
|
3502
|
+
* @deprecated
|
|
3503
|
+
*/
|
|
3504
|
+
totalValue: childCount
|
|
3505
|
+
};
|
|
3506
|
+
let aggVal = 0;
|
|
3507
|
+
// 如果下层同时也是分组
|
|
3508
|
+
if (childList.length && childList[0].isAggregate) {
|
|
3509
|
+
XEUtils.each(childList, (row) => {
|
|
3510
|
+
if (row.isAggregate) {
|
|
3511
|
+
const currAggData = row.aggData[field];
|
|
3512
|
+
if (currAggData) {
|
|
3513
|
+
aggVal += currAggData.value;
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
else {
|
|
3519
|
+
aggVal = aggCalcMethod ? aggCalcMethod(ctParams) : aggRow.childCount;
|
|
3520
|
+
}
|
|
3521
|
+
aggDtObj[field] = {
|
|
3522
|
+
type: 'count',
|
|
3523
|
+
value: aggVal,
|
|
3524
|
+
label: aggVal
|
|
3525
|
+
};
|
|
3526
|
+
});
|
|
3527
|
+
aggRow.aggData = aggDtObj;
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3435
3531
|
}
|
|
3436
3532
|
};
|
|
3437
3533
|
const updateGroupData = () => {
|
|
@@ -4634,6 +4730,34 @@ export default defineVxeComponent({
|
|
|
4634
4730
|
rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
|
|
4635
4731
|
}
|
|
4636
4732
|
};
|
|
4733
|
+
const handleColumnVisible = (visible) => {
|
|
4734
|
+
return function (fieldOrColumn) {
|
|
4735
|
+
let status = false;
|
|
4736
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4737
|
+
cols.forEach(item => {
|
|
4738
|
+
const column = handleFieldOrColumn($xeTable, item);
|
|
4739
|
+
if (column) {
|
|
4740
|
+
if (column.children && column.children.length) {
|
|
4741
|
+
XEUtils.eachTree([column], (item) => {
|
|
4742
|
+
item.visible = visible;
|
|
4743
|
+
item.renderVisible = visible;
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
else {
|
|
4747
|
+
column.visible = visible;
|
|
4748
|
+
column.renderVisible = visible;
|
|
4749
|
+
}
|
|
4750
|
+
if (!status) {
|
|
4751
|
+
status = true;
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
});
|
|
4755
|
+
if (status) {
|
|
4756
|
+
return $xeTable.handleCustom();
|
|
4757
|
+
}
|
|
4758
|
+
return nextTick();
|
|
4759
|
+
};
|
|
4760
|
+
};
|
|
4637
4761
|
tableMethods = {
|
|
4638
4762
|
dispatchEvent,
|
|
4639
4763
|
getEl() {
|
|
@@ -5091,10 +5215,15 @@ export default defineVxeComponent({
|
|
|
5091
5215
|
if (!column) {
|
|
5092
5216
|
return null;
|
|
5093
5217
|
}
|
|
5094
|
-
const {
|
|
5218
|
+
const { editConfig } = props;
|
|
5219
|
+
const { formatter, editRender, cellRender } = column;
|
|
5220
|
+
// formatter > tableCellFormatter
|
|
5221
|
+
const renderOpts = formatter ? null : (editConfig && isEnableConf(editRender) ? editRender : (isEnableConf(cellRender) ? cellRender : null));
|
|
5222
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
5223
|
+
const tcFormatter = compConf ? compConf.tableCellFormatter : null;
|
|
5095
5224
|
const cellValue = getCellValue(row, column);
|
|
5096
5225
|
let cellLabel = cellValue;
|
|
5097
|
-
if (formatter) {
|
|
5226
|
+
if (formatter || tcFormatter) {
|
|
5098
5227
|
let formatData;
|
|
5099
5228
|
const { fullAllDataRowIdData } = internalData;
|
|
5100
5229
|
const rowid = getRowid($xeTable, row);
|
|
@@ -5112,24 +5241,30 @@ export default defineVxeComponent({
|
|
|
5112
5241
|
}
|
|
5113
5242
|
}
|
|
5114
5243
|
const formatParams = {
|
|
5244
|
+
$table: $xeTable,
|
|
5115
5245
|
cellValue,
|
|
5116
5246
|
row,
|
|
5117
5247
|
rowIndex: $xeTable.getRowIndex(row),
|
|
5118
5248
|
column,
|
|
5119
5249
|
columnIndex: $xeTable.getColumnIndex(column)
|
|
5120
5250
|
};
|
|
5121
|
-
if (
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5251
|
+
if (formatter) {
|
|
5252
|
+
if (XEUtils.isString(formatter)) {
|
|
5253
|
+
const gFormatOpts = formats.get(formatter);
|
|
5254
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
5255
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
5256
|
+
}
|
|
5257
|
+
else if (XEUtils.isArray(formatter)) {
|
|
5258
|
+
const gFormatOpts = formats.get(formatter[0]);
|
|
5259
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
5260
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
5261
|
+
}
|
|
5262
|
+
else {
|
|
5263
|
+
cellLabel = `${formatter(formatParams)}`;
|
|
5264
|
+
}
|
|
5130
5265
|
}
|
|
5131
|
-
else {
|
|
5132
|
-
cellLabel =
|
|
5266
|
+
else if (renderOpts && tcFormatter) {
|
|
5267
|
+
cellLabel = `${tcFormatter(renderOpts, formatParams)}`;
|
|
5133
5268
|
}
|
|
5134
5269
|
if (formatData) {
|
|
5135
5270
|
formatData[colid] = { value: cellValue, label: cellLabel };
|
|
@@ -5176,6 +5311,7 @@ export default defineVxeComponent({
|
|
|
5176
5311
|
}
|
|
5177
5312
|
}
|
|
5178
5313
|
const footerFormatParams = {
|
|
5314
|
+
$table: $xeTable,
|
|
5179
5315
|
cellValue: itemValue,
|
|
5180
5316
|
itemValue,
|
|
5181
5317
|
row,
|
|
@@ -5636,43 +5772,11 @@ export default defineVxeComponent({
|
|
|
5636
5772
|
/**
|
|
5637
5773
|
* 隐藏指定列
|
|
5638
5774
|
*/
|
|
5639
|
-
hideColumn(
|
|
5640
|
-
let status = false;
|
|
5641
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5642
|
-
cols.forEach(item => {
|
|
5643
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5644
|
-
if (column && column.visible) {
|
|
5645
|
-
column.visible = false;
|
|
5646
|
-
if (!status) {
|
|
5647
|
-
status = true;
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
});
|
|
5651
|
-
if (status) {
|
|
5652
|
-
return tablePrivateMethods.handleCustom();
|
|
5653
|
-
}
|
|
5654
|
-
return nextTick();
|
|
5655
|
-
},
|
|
5775
|
+
hideColumn: handleColumnVisible(false),
|
|
5656
5776
|
/**
|
|
5657
5777
|
* 显示指定列
|
|
5658
5778
|
*/
|
|
5659
|
-
showColumn(
|
|
5660
|
-
let status = false;
|
|
5661
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5662
|
-
cols.forEach(item => {
|
|
5663
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5664
|
-
if (column && !column.visible) {
|
|
5665
|
-
column.visible = true;
|
|
5666
|
-
if (!status) {
|
|
5667
|
-
status = true;
|
|
5668
|
-
}
|
|
5669
|
-
}
|
|
5670
|
-
});
|
|
5671
|
-
if (status) {
|
|
5672
|
-
return tablePrivateMethods.handleCustom();
|
|
5673
|
-
}
|
|
5674
|
-
return nextTick();
|
|
5675
|
-
},
|
|
5779
|
+
showColumn: handleColumnVisible(true),
|
|
5676
5780
|
setColumnWidth(fieldOrColumn, width) {
|
|
5677
5781
|
const { elemStore } = internalData;
|
|
5678
5782
|
let status = false;
|
|
@@ -11355,7 +11459,7 @@ export default defineVxeComponent({
|
|
|
11355
11459
|
internalData.lastScrollTop = scrollTop;
|
|
11356
11460
|
}
|
|
11357
11461
|
reactData.lastScrollTime = Date.now();
|
|
11358
|
-
const evntParams = Object.assign({ scrollTop,
|
|
11462
|
+
const evntParams = Object.assign({ source: sourceType, scrollTop,
|
|
11359
11463
|
scrollLeft,
|
|
11360
11464
|
bodyHeight,
|
|
11361
11465
|
bodyWidth,
|
|
@@ -13383,6 +13487,7 @@ export default defineVxeComponent({
|
|
|
13383
13487
|
if (resizeObserver) {
|
|
13384
13488
|
resizeObserver.disconnect();
|
|
13385
13489
|
}
|
|
13490
|
+
$xeTable.closeTooltip();
|
|
13386
13491
|
tableMethods.closeFilter();
|
|
13387
13492
|
if ($xeTable.closeMenu) {
|
|
13388
13493
|
$xeTable.closeMenu();
|
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 = "4.17.
|
|
3
|
+
export const version = "4.17.22";
|
|
4
4
|
VxeUI.version = version;
|
|
5
5
|
VxeUI.tableVersion = version;
|
|
6
6
|
VxeUI.setConfig({
|
|
@@ -279,9 +279,10 @@ VxeUI.setConfig({
|
|
|
279
279
|
showResponseMsg: true,
|
|
280
280
|
showActionMsg: true,
|
|
281
281
|
response: {
|
|
282
|
-
list:
|
|
282
|
+
list: 'list',
|
|
283
283
|
result: 'result',
|
|
284
284
|
total: 'page.total',
|
|
285
|
+
footerData: 'footerData',
|
|
285
286
|
message: 'message'
|
|
286
287
|
}
|
|
287
288
|
// beforeItem: null,
|
package/es/ui/src/log.js
CHANGED