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/es/table/render/index.js
CHANGED
|
@@ -594,9 +594,8 @@ function oldSelectEditRender(h, renderOpts, params) {
|
|
|
594
594
|
})
|
|
595
595
|
];
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function handleSelectCellValue(cellValue, renderOpts) {
|
|
598
598
|
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props = {} } = renderOpts;
|
|
599
|
-
const cellValue = XEUtils.get(row, column.field);
|
|
600
599
|
let selectItem;
|
|
601
600
|
const labelProp = optionProps.label || 'label';
|
|
602
601
|
const valueProp = optionProps.value || 'value';
|
|
@@ -633,13 +632,16 @@ function getSelectCellValue(renderOpts, { row, column }) {
|
|
|
633
632
|
}
|
|
634
633
|
return '';
|
|
635
634
|
}
|
|
635
|
+
function getSelectCellValue(renderOpts, { row, column }) {
|
|
636
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
637
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
638
|
+
}
|
|
636
639
|
function handleExportSelectMethod(params) {
|
|
637
640
|
const { row, column, options } = params;
|
|
638
641
|
return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params);
|
|
639
642
|
}
|
|
640
|
-
function
|
|
643
|
+
function handleTreeSelectCellValue(cellValue, renderOpts) {
|
|
641
644
|
const { options, optionProps = {} } = renderOpts;
|
|
642
|
-
const cellValue = XEUtils.get(row, column.field);
|
|
643
645
|
const labelProp = optionProps.label || 'label';
|
|
644
646
|
const valueProp = optionProps.value || 'value';
|
|
645
647
|
const childrenProp = optionProps.children || 'children';
|
|
@@ -655,6 +657,10 @@ function getTreeSelectCellValue(renderOpts, { row, column }) {
|
|
|
655
657
|
}
|
|
656
658
|
return '';
|
|
657
659
|
}
|
|
660
|
+
function getTreeSelectCellValue(renderOpts, { row, column }) {
|
|
661
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
662
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
663
|
+
}
|
|
658
664
|
function handleExportTreeSelectMethod(params) {
|
|
659
665
|
const { row, column, options } = params;
|
|
660
666
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
|
|
@@ -716,6 +722,91 @@ function handleNumberCell(h, renderOpts, params) {
|
|
|
716
722
|
}
|
|
717
723
|
: {});
|
|
718
724
|
}
|
|
725
|
+
function handleFormatSelect(renderOpts, params) {
|
|
726
|
+
const { cellValue } = params;
|
|
727
|
+
return handleSelectCellValue(cellValue, renderOpts);
|
|
728
|
+
}
|
|
729
|
+
function handleSetSelectValue(renderOpts, params) {
|
|
730
|
+
const { row, column, cellValue } = params;
|
|
731
|
+
const { field } = column;
|
|
732
|
+
if (field) {
|
|
733
|
+
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props } = renderOpts;
|
|
734
|
+
if (isEmptyValue(cellValue)) {
|
|
735
|
+
XEUtils.set(row, field, props && props.multiple ? [] : null);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
const isMultiVal = XEUtils.indexOf(`${cellValue}`, ',') > -1;
|
|
739
|
+
const labelProp = optionProps.label || 'label';
|
|
740
|
+
const valueProp = optionProps.value || 'value';
|
|
741
|
+
const labelMpas = {};
|
|
742
|
+
if (optionGroups && optionGroups.length) {
|
|
743
|
+
const groupOptions = optionGroupProps.options || 'options';
|
|
744
|
+
for (let i = 0; i < optionGroups.length; i++) {
|
|
745
|
+
const opts = optionGroups[i][groupOptions] || {};
|
|
746
|
+
for (let j = 0; j < opts.length; j++) {
|
|
747
|
+
const item = opts[j];
|
|
748
|
+
if (isMultiVal) {
|
|
749
|
+
labelMpas[item[labelProp]] = item;
|
|
750
|
+
/* eslint-disable eqeqeq */
|
|
751
|
+
}
|
|
752
|
+
else if (item[labelProp] == cellValue) {
|
|
753
|
+
XEUtils.set(row, field, item[valueProp]);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
if (options) {
|
|
761
|
+
for (let i = 0; i < options.length; i++) {
|
|
762
|
+
const item = options[i];
|
|
763
|
+
if (isMultiVal) {
|
|
764
|
+
labelMpas[item[labelProp]] = item;
|
|
765
|
+
/* eslint-disable eqeqeq */
|
|
766
|
+
}
|
|
767
|
+
else if (item[labelProp] == cellValue) {
|
|
768
|
+
XEUtils.set(row, field, item[valueProp]);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (isMultiVal) {
|
|
775
|
+
XEUtils.set(row, field, (isMultiVal
|
|
776
|
+
? cellValue.split(',')
|
|
777
|
+
: [cellValue]).map((label) => {
|
|
778
|
+
const item = labelMpas[label];
|
|
779
|
+
return item ? item[valueProp] : label;
|
|
780
|
+
}));
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
XEUtils.set(row, field, cellValue);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
function handleFormatTreeSelect(renderOpts, params) {
|
|
788
|
+
const { cellValue } = params;
|
|
789
|
+
return handleTreeSelectCellValue(cellValue, renderOpts);
|
|
790
|
+
}
|
|
791
|
+
function handleSetTreeSelectValue(renderOpts, params) {
|
|
792
|
+
const { row, column, cellValue } = params;
|
|
793
|
+
const { field } = column;
|
|
794
|
+
if (field) {
|
|
795
|
+
const { options, optionProps = {} } = renderOpts;
|
|
796
|
+
const labelProp = optionProps.label || 'label';
|
|
797
|
+
const valueProp = optionProps.value || 'value';
|
|
798
|
+
const childrenProp = optionProps.children || 'children';
|
|
799
|
+
const matchRest = XEUtils.findTree(options || [], item => XEUtils.get(item, labelProp) === cellValue, { children: childrenProp });
|
|
800
|
+
if (matchRest) {
|
|
801
|
+
const selectItem = matchRest.item;
|
|
802
|
+
if (selectItem) {
|
|
803
|
+
XEUtils.set(row, field, selectItem[valueProp]);
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
XEUtils.set(row, field, cellValue);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
719
810
|
/**
|
|
720
811
|
* 表格 - 渲染器
|
|
721
812
|
*/
|
|
@@ -748,6 +839,9 @@ renderer.mixin({
|
|
|
748
839
|
}, renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params));
|
|
749
840
|
});
|
|
750
841
|
},
|
|
842
|
+
tableCellFormatter: handleFormatSelect,
|
|
843
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
844
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
751
845
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
752
846
|
tableExportMethod: handleExportSelectMethod
|
|
753
847
|
},
|
|
@@ -982,6 +1076,9 @@ renderer.mixin({
|
|
|
982
1076
|
on: getFloatingFilterOns(renderOpts, params, option)
|
|
983
1077
|
});
|
|
984
1078
|
},
|
|
1079
|
+
tableCellFormatter: handleFormatSelect,
|
|
1080
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1081
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
985
1082
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
986
1083
|
tableExportMethod: handleExportSelectMethod
|
|
987
1084
|
},
|
|
@@ -1025,6 +1122,9 @@ renderer.mixin({
|
|
|
1025
1122
|
renderTableDefault(h, renderOpts, params) {
|
|
1026
1123
|
return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
1027
1124
|
},
|
|
1125
|
+
tableCellFormatter: handleFormatSelect,
|
|
1126
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1127
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
1028
1128
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
1029
1129
|
tableExportMethod: handleExportSelectMethod
|
|
1030
1130
|
},
|
|
@@ -1034,6 +1134,9 @@ renderer.mixin({
|
|
|
1034
1134
|
renderTableCell(h, renderOpts, params) {
|
|
1035
1135
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
1036
1136
|
},
|
|
1137
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1138
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1139
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1037
1140
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1038
1141
|
},
|
|
1039
1142
|
VxeTableSelect: {
|
|
@@ -1042,6 +1145,9 @@ renderer.mixin({
|
|
|
1042
1145
|
renderTableCell(h, renderOpts, params) {
|
|
1043
1146
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
1044
1147
|
},
|
|
1148
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1149
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1150
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1045
1151
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1046
1152
|
},
|
|
1047
1153
|
/**
|
|
@@ -1057,6 +1163,9 @@ renderer.mixin({
|
|
|
1057
1163
|
renderTableDefault(h, renderOpts, params) {
|
|
1058
1164
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
1059
1165
|
},
|
|
1166
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1167
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1168
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1060
1169
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1061
1170
|
},
|
|
1062
1171
|
VxeColorPicker: {
|
package/es/table/src/cell.js
CHANGED
|
@@ -364,8 +364,9 @@ export const Cell = {
|
|
|
364
364
|
const aggRow = row;
|
|
365
365
|
const { fullColumnFieldData } = tableInternalData;
|
|
366
366
|
const aggregateOpts = $table.computeAggregateOpts;
|
|
367
|
-
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts;
|
|
368
|
-
const
|
|
367
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
368
|
+
const aggData = aggRow.aggData;
|
|
369
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
369
370
|
const groupField = aggRow.groupField;
|
|
370
371
|
const groupContent = aggRow.groupContent;
|
|
371
372
|
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
@@ -407,9 +408,10 @@ export const Cell = {
|
|
|
407
408
|
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
408
409
|
}
|
|
409
410
|
else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
412
|
+
ctParams.aggValue = cellValue;
|
|
413
|
+
if (formatValuesMethod) {
|
|
414
|
+
cellValue = formatValuesMethod(ctParams);
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
417
|
}
|
|
@@ -460,7 +462,7 @@ export const Cell = {
|
|
|
460
462
|
const { rowGroupExpandedFlag } = tableReactData;
|
|
461
463
|
const { rowGroupExpandedMaps } = tableInternalData;
|
|
462
464
|
const aggregateOpts = $table.computeAggregateOpts;
|
|
463
|
-
const { mode, padding, indent } = aggregateOpts;
|
|
465
|
+
const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts;
|
|
464
466
|
const rowid = getRowid($table, row);
|
|
465
467
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
|
|
466
468
|
return h('div', {
|
|
@@ -473,7 +475,7 @@ export const Cell = {
|
|
|
473
475
|
}
|
|
474
476
|
: undefined
|
|
475
477
|
}, [
|
|
476
|
-
row.isAggregate
|
|
478
|
+
showIcon && row.isAggregate
|
|
477
479
|
? h('span', {
|
|
478
480
|
class: 'vxe-row-group--node-btn',
|
|
479
481
|
on: {
|
|
@@ -483,7 +485,7 @@ export const Cell = {
|
|
|
483
485
|
}
|
|
484
486
|
}, [
|
|
485
487
|
h('i', {
|
|
486
|
-
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
488
|
+
class: isExpand ? (iconOpen || getIcon().TABLE_ROW_GROUP_OPEN) : (iconClose || getIcon().TABLE_ROW_GROUP_CLOSE)
|
|
487
489
|
})
|
|
488
490
|
])
|
|
489
491
|
: renderEmptyElement($table),
|
package/es/table/src/methods.js
CHANGED
|
@@ -14,6 +14,7 @@ const supportMaxRow = 5e6;
|
|
|
14
14
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
15
15
|
const maxYHeight = 5e6;
|
|
16
16
|
const maxXWidth = 5e6;
|
|
17
|
+
const sourceType = 'table';
|
|
17
18
|
let crossTableDragRowObj = null;
|
|
18
19
|
function eqCellValue(row1, row2, field) {
|
|
19
20
|
const val1 = XEUtils.get(row1, field);
|
|
@@ -2461,26 +2462,53 @@ const calcCellHeight = ($xeTable) => {
|
|
|
2461
2462
|
}
|
|
2462
2463
|
};
|
|
2463
2464
|
function getOrderField($xeTable, column) {
|
|
2464
|
-
const
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2465
|
+
const reactData = $xeTable;
|
|
2466
|
+
const { isRowGroupStatus } = reactData;
|
|
2467
|
+
const { sortBy, sortType, aggFunc } = column;
|
|
2468
|
+
return isRowGroupStatus && aggFunc
|
|
2469
|
+
? (row) => {
|
|
2470
|
+
if (row.isAggregate) {
|
|
2471
|
+
const aggData = row.aggData;
|
|
2472
|
+
const currAggData = aggData ? aggData[column.field] : null;
|
|
2473
|
+
return currAggData ? currAggData.value : null;
|
|
2474
|
+
}
|
|
2475
|
+
let cellValue;
|
|
2476
|
+
if (sortBy) {
|
|
2477
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2478
|
+
}
|
|
2479
|
+
else {
|
|
2480
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
2481
|
+
}
|
|
2482
|
+
if (!sortType || sortType === 'auto') {
|
|
2483
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2484
|
+
}
|
|
2485
|
+
else if (sortType === 'number') {
|
|
2486
|
+
return XEUtils.toNumber(cellValue);
|
|
2487
|
+
}
|
|
2488
|
+
else if (sortType === 'string') {
|
|
2489
|
+
return XEUtils.toValueString(cellValue);
|
|
2490
|
+
}
|
|
2491
|
+
return cellValue;
|
|
2481
2492
|
}
|
|
2482
|
-
|
|
2483
|
-
|
|
2493
|
+
: (row) => {
|
|
2494
|
+
let cellValue;
|
|
2495
|
+
if (sortBy) {
|
|
2496
|
+
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
2497
|
+
}
|
|
2498
|
+
else {
|
|
2499
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
2500
|
+
}
|
|
2501
|
+
if (!sortType || sortType === 'auto') {
|
|
2502
|
+
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
2503
|
+
}
|
|
2504
|
+
else if (sortType === 'number') {
|
|
2505
|
+
return XEUtils.toNumber(cellValue);
|
|
2506
|
+
}
|
|
2507
|
+
else if (sortType === 'string') {
|
|
2508
|
+
return XEUtils.toValueString(cellValue);
|
|
2509
|
+
}
|
|
2510
|
+
return cellValue;
|
|
2511
|
+
};
|
|
2484
2512
|
}
|
|
2485
2513
|
function handleTargetEnterEvent($xeTable, isClear) {
|
|
2486
2514
|
const internalData = $xeTable;
|
|
@@ -3018,8 +3046,12 @@ function handleUpdateRowGroup($xeTable, groupFields) {
|
|
|
3018
3046
|
handleUpdateAggValues($xeTable);
|
|
3019
3047
|
}
|
|
3020
3048
|
function handleeGroupSummary($xeTable, aggList) {
|
|
3049
|
+
const internalData = $xeTable;
|
|
3050
|
+
const { fullColumnFieldData } = internalData;
|
|
3021
3051
|
const aggregateOpts = $xeTable.computeAggregateOpts;
|
|
3052
|
+
const aggFuncColumns = $xeTable.computeAggFuncColumns;
|
|
3022
3053
|
const { mapChildrenField } = aggregateOpts;
|
|
3054
|
+
const aggCalcMethod = aggregateOpts.calcValuesMethod || aggregateOpts.countMethod || aggregateOpts.aggregateMethod;
|
|
3023
3055
|
if (mapChildrenField) {
|
|
3024
3056
|
XEUtils.lastEach(aggList, aggRow => {
|
|
3025
3057
|
let count = 0;
|
|
@@ -3036,6 +3068,62 @@ function handleeGroupSummary($xeTable, aggList) {
|
|
|
3036
3068
|
if ($xeTable.handlePivotTableAggregateData) {
|
|
3037
3069
|
$xeTable.handlePivotTableAggregateData(aggList);
|
|
3038
3070
|
}
|
|
3071
|
+
else {
|
|
3072
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
3073
|
+
const aggDtObj = {};
|
|
3074
|
+
const aggData = aggRow.aggData;
|
|
3075
|
+
const groupField = aggRow.groupField;
|
|
3076
|
+
const groupContent = aggRow.groupContent;
|
|
3077
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
3078
|
+
const childCount = aggRow.childCount;
|
|
3079
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
3080
|
+
aggFuncColumns.forEach(column => {
|
|
3081
|
+
const { field } = column;
|
|
3082
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
3083
|
+
const ctParams = {
|
|
3084
|
+
$table: $xeTable,
|
|
3085
|
+
groupField,
|
|
3086
|
+
groupColumn: (colRest ? colRest.column : null),
|
|
3087
|
+
column,
|
|
3088
|
+
groupValue: groupContent,
|
|
3089
|
+
childList,
|
|
3090
|
+
childCount,
|
|
3091
|
+
aggValue: currAggData ? currAggData.value : 0,
|
|
3092
|
+
/**
|
|
3093
|
+
* 已废弃
|
|
3094
|
+
* @deprecated
|
|
3095
|
+
*/
|
|
3096
|
+
children: childList,
|
|
3097
|
+
/**
|
|
3098
|
+
* 已废弃
|
|
3099
|
+
* @deprecated
|
|
3100
|
+
*/
|
|
3101
|
+
totalValue: childCount
|
|
3102
|
+
};
|
|
3103
|
+
let aggVal = 0;
|
|
3104
|
+
// 如果下层同时也是分组
|
|
3105
|
+
if (childList.length && childList[0].isAggregate) {
|
|
3106
|
+
XEUtils.each(childList, (row) => {
|
|
3107
|
+
if (row.isAggregate) {
|
|
3108
|
+
const currAggData = row.aggData[field];
|
|
3109
|
+
if (currAggData) {
|
|
3110
|
+
aggVal += currAggData.value;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
});
|
|
3114
|
+
}
|
|
3115
|
+
else {
|
|
3116
|
+
aggVal = aggCalcMethod ? aggCalcMethod(ctParams) : aggRow.childCount;
|
|
3117
|
+
}
|
|
3118
|
+
aggDtObj[field] = {
|
|
3119
|
+
type: 'count',
|
|
3120
|
+
value: aggVal,
|
|
3121
|
+
label: aggVal
|
|
3122
|
+
};
|
|
3123
|
+
});
|
|
3124
|
+
aggRow.aggData = aggDtObj;
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3039
3127
|
}
|
|
3040
3128
|
}
|
|
3041
3129
|
function updateGroupData($xeTable) {
|
|
@@ -4097,7 +4185,36 @@ function handleRowExpandScroll($xeTable) {
|
|
|
4097
4185
|
rowExpandEl.scrollTop = bodyScrollElem.scrollTop;
|
|
4098
4186
|
}
|
|
4099
4187
|
}
|
|
4100
|
-
|
|
4188
|
+
function handleColumnVisible(visible) {
|
|
4189
|
+
const $xeTable = this;
|
|
4190
|
+
return function (fieldOrColumn) {
|
|
4191
|
+
let status = false;
|
|
4192
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4193
|
+
cols.forEach(item => {
|
|
4194
|
+
const column = handleFieldOrColumn($xeTable, item);
|
|
4195
|
+
if (column) {
|
|
4196
|
+
if (column.children && column.children.length) {
|
|
4197
|
+
XEUtils.eachTree([column], (item) => {
|
|
4198
|
+
item.visible = visible;
|
|
4199
|
+
item.renderVisible = visible;
|
|
4200
|
+
});
|
|
4201
|
+
}
|
|
4202
|
+
else {
|
|
4203
|
+
column.visible = visible;
|
|
4204
|
+
column.renderVisible = visible;
|
|
4205
|
+
}
|
|
4206
|
+
if (!status) {
|
|
4207
|
+
status = true;
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4211
|
+
if (status) {
|
|
4212
|
+
return $xeTable.handleCustom();
|
|
4213
|
+
}
|
|
4214
|
+
return $xeTable.$nextTick();
|
|
4215
|
+
};
|
|
4216
|
+
}
|
|
4217
|
+
const tableMethods = {
|
|
4101
4218
|
callSlot(slotFunc, params, h, vNodes) {
|
|
4102
4219
|
const $xeTable = this;
|
|
4103
4220
|
// const slots = $xeTable.$scopedSlots
|
|
@@ -4894,15 +5011,21 @@ const Methods = {
|
|
|
4894
5011
|
},
|
|
4895
5012
|
getCellLabel(row, fieldOrColumn) {
|
|
4896
5013
|
const $xeTable = this;
|
|
5014
|
+
const props = $xeTable;
|
|
4897
5015
|
const internalData = $xeTable;
|
|
4898
|
-
const column = handleFieldOrColumn(
|
|
5016
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
4899
5017
|
if (!column) {
|
|
4900
5018
|
return null;
|
|
4901
5019
|
}
|
|
4902
|
-
const
|
|
5020
|
+
const { editConfig } = props;
|
|
5021
|
+
const { formatter, editRender, cellRender } = column;
|
|
5022
|
+
// formatter > tableCellFormatter
|
|
5023
|
+
const renderOpts = formatter ? null : (editConfig && isEnableConf(editRender) ? editRender : (isEnableConf(cellRender) ? cellRender : null));
|
|
5024
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
5025
|
+
const tcFormatter = compConf ? compConf.tableCellFormatter : null;
|
|
4903
5026
|
const cellValue = getCellValue(row, column);
|
|
4904
5027
|
let cellLabel = cellValue;
|
|
4905
|
-
if (formatter) {
|
|
5028
|
+
if (formatter || tcFormatter) {
|
|
4906
5029
|
let formatData;
|
|
4907
5030
|
const { fullAllDataRowIdData } = internalData;
|
|
4908
5031
|
const rowid = getRowid($xeTable, row);
|
|
@@ -4919,19 +5042,31 @@ const Methods = {
|
|
|
4919
5042
|
}
|
|
4920
5043
|
}
|
|
4921
5044
|
}
|
|
4922
|
-
const formatParams = {
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
5045
|
+
const formatParams = {
|
|
5046
|
+
$table: $xeTable,
|
|
5047
|
+
cellValue,
|
|
5048
|
+
row,
|
|
5049
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
5050
|
+
column,
|
|
5051
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5052
|
+
};
|
|
5053
|
+
if (formatter) {
|
|
5054
|
+
if (XEUtils.isString(formatter)) {
|
|
5055
|
+
const gFormatOpts = formats.get(formatter);
|
|
5056
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
5057
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
5058
|
+
}
|
|
5059
|
+
else if (XEUtils.isArray(formatter)) {
|
|
5060
|
+
const gFormatOpts = formats.get(formatter[0]);
|
|
5061
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
5062
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
5063
|
+
}
|
|
5064
|
+
else {
|
|
5065
|
+
cellLabel = formatter(formatParams);
|
|
5066
|
+
}
|
|
4932
5067
|
}
|
|
4933
|
-
else {
|
|
4934
|
-
cellLabel =
|
|
5068
|
+
else if (renderOpts && tcFormatter) {
|
|
5069
|
+
cellLabel = `${tcFormatter(renderOpts, formatParams)}`;
|
|
4935
5070
|
}
|
|
4936
5071
|
if (formatData) {
|
|
4937
5072
|
formatData[colid] = { value: cellValue, label: cellLabel };
|
|
@@ -4981,6 +5116,7 @@ const Methods = {
|
|
|
4981
5116
|
}
|
|
4982
5117
|
}
|
|
4983
5118
|
const footerFormatParams = {
|
|
5119
|
+
$table: $xeTable,
|
|
4984
5120
|
cellValue: itemValue,
|
|
4985
5121
|
itemValue,
|
|
4986
5122
|
row,
|
|
@@ -5518,45 +5654,11 @@ const Methods = {
|
|
|
5518
5654
|
/**
|
|
5519
5655
|
* 隐藏指定列
|
|
5520
5656
|
*/
|
|
5521
|
-
hideColumn(
|
|
5522
|
-
const $xeTable = this;
|
|
5523
|
-
let status = false;
|
|
5524
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5525
|
-
cols.forEach(item => {
|
|
5526
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5527
|
-
if (column && column.visible) {
|
|
5528
|
-
column.visible = false;
|
|
5529
|
-
if (!status) {
|
|
5530
|
-
status = true;
|
|
5531
|
-
}
|
|
5532
|
-
}
|
|
5533
|
-
});
|
|
5534
|
-
if (status) {
|
|
5535
|
-
return $xeTable.handleCustom();
|
|
5536
|
-
}
|
|
5537
|
-
return $xeTable.$nextTick();
|
|
5538
|
-
},
|
|
5657
|
+
hideColumn: handleColumnVisible(false),
|
|
5539
5658
|
/**
|
|
5540
5659
|
* 显示指定列
|
|
5541
5660
|
*/
|
|
5542
|
-
showColumn(
|
|
5543
|
-
const $xeTable = this;
|
|
5544
|
-
let status = false;
|
|
5545
|
-
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
5546
|
-
cols.forEach(item => {
|
|
5547
|
-
const column = handleFieldOrColumn($xeTable, item);
|
|
5548
|
-
if (column && !column.visible) {
|
|
5549
|
-
column.visible = true;
|
|
5550
|
-
if (!status) {
|
|
5551
|
-
status = true;
|
|
5552
|
-
}
|
|
5553
|
-
}
|
|
5554
|
-
});
|
|
5555
|
-
if (status) {
|
|
5556
|
-
return $xeTable.handleCustom();
|
|
5557
|
-
}
|
|
5558
|
-
return $xeTable.$nextTick();
|
|
5559
|
-
},
|
|
5661
|
+
showColumn: handleColumnVisible(true),
|
|
5560
5662
|
setColumnWidth(fieldOrColumn, width) {
|
|
5561
5663
|
const $xeTable = this;
|
|
5562
5664
|
const internalData = $xeTable;
|
|
@@ -10845,7 +10947,7 @@ const Methods = {
|
|
|
10845
10947
|
internalData.lastScrollTop = scrollTop;
|
|
10846
10948
|
}
|
|
10847
10949
|
reactData.lastScrollTime = Date.now();
|
|
10848
|
-
const evntParams = Object.assign({ scrollTop,
|
|
10950
|
+
const evntParams = Object.assign({ source: sourceType, scrollTop,
|
|
10849
10951
|
scrollLeft,
|
|
10850
10952
|
bodyHeight,
|
|
10851
10953
|
bodyWidth,
|
|
@@ -12035,7 +12137,7 @@ const Methods = {
|
|
|
12035
12137
|
// Module methods
|
|
12036
12138
|
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(',');
|
|
12037
12139
|
funcs.forEach(name => {
|
|
12038
|
-
|
|
12140
|
+
tableMethods[name] = function (...args) {
|
|
12039
12141
|
// if (!this[`_${name}`]) {
|
|
12040
12142
|
// if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
12041
12143
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
@@ -12052,4 +12154,4 @@ funcs.forEach(name => {
|
|
|
12052
12154
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|
|
12053
12155
|
};
|
|
12054
12156
|
});
|
|
12055
|
-
export default
|
|
12157
|
+
export default tableMethods;
|
package/es/table/src/table.js
CHANGED
|
@@ -1444,6 +1444,15 @@ export default {
|
|
|
1444
1444
|
});
|
|
1445
1445
|
return rgColumns;
|
|
1446
1446
|
},
|
|
1447
|
+
computeAggFuncColumns() {
|
|
1448
|
+
const $xeTable = this;
|
|
1449
|
+
const reactData = $xeTable;
|
|
1450
|
+
const { rowGroupList, tableColumn } = reactData;
|
|
1451
|
+
if (rowGroupList.length) {
|
|
1452
|
+
return tableColumn.filter(column => column.field && column.aggFunc);
|
|
1453
|
+
}
|
|
1454
|
+
return [];
|
|
1455
|
+
},
|
|
1447
1456
|
tabsResizeFlag() {
|
|
1448
1457
|
const $xeTable = this;
|
|
1449
1458
|
const $xeTabs = $xeTable.$xeTabs;
|
|
@@ -1994,8 +2003,9 @@ export default {
|
|
|
1994
2003
|
if (this.$resize) {
|
|
1995
2004
|
this.$resize.disconnect();
|
|
1996
2005
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
2006
|
+
$xeTable.closeTooltip();
|
|
2007
|
+
$xeTable.closeFilter();
|
|
2008
|
+
$xeTable.closeMenu();
|
|
1999
2009
|
globalEvents.off($xeTable, 'paste');
|
|
2000
2010
|
globalEvents.off($xeTable, 'copy');
|
|
2001
2011
|
globalEvents.off($xeTable, 'cut');
|
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.19.
|
|
3
|
+
export const version = "3.19.22";
|
|
4
4
|
VxeUI.version = version;
|
|
5
5
|
VxeUI.tableVersion = version;
|
|
6
6
|
VxeUI.setConfig({
|
|
@@ -280,9 +280,10 @@ VxeUI.setConfig({
|
|
|
280
280
|
showResponseMsg: true,
|
|
281
281
|
showActionMsg: true,
|
|
282
282
|
response: {
|
|
283
|
-
list:
|
|
283
|
+
list: 'list',
|
|
284
284
|
result: 'result',
|
|
285
285
|
total: 'page.total',
|
|
286
|
+
footerData: 'footerData',
|
|
286
287
|
message: 'message'
|
|
287
288
|
}
|
|
288
289
|
// beforeItem: null,
|
package/es/ui/src/log.js
CHANGED