@nokecy/qc-ui 1.0.52 → 1.0.54
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/dist/cjs/ag-grid-plus/ag-gridPlus.js +21 -14
- package/dist/cjs/ag-grid-plus/interface.d.ts +9 -0
- package/dist/cjs/ag-grid-plus/locale.d.ts +162 -0
- package/dist/cjs/ag-grid-plus/locale.js +178 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +21 -14
- package/dist/esm/ag-grid-plus/interface.d.ts +9 -0
- package/dist/esm/ag-grid-plus/locale.d.ts +162 -0
- package/dist/esm/ag-grid-plus/locale.js +172 -0
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ var _customGroupCellRenderer = _interopRequireDefault(require("./_utils/customGr
|
|
|
24
24
|
var _processColumnGroups = _interopRequireDefault(require("./_utils/processColumnGroups"));
|
|
25
25
|
var _processFormColumnState = _interopRequireDefault(require("./_utils/processFormColumnState"));
|
|
26
26
|
var _antdV = require("@formily/antd-v5");
|
|
27
|
+
var _locale = require("./locale");
|
|
27
28
|
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText", "queryDefaultRows", "onSelectedRowsChange"];
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -223,9 +224,14 @@ function AgGridPlus(props) {
|
|
|
223
224
|
sorter: getSort(sortColumn)
|
|
224
225
|
});
|
|
225
226
|
request && request(params, undefined, queryFilter).then(function (response) {
|
|
227
|
+
var _apiRef$current2;
|
|
226
228
|
var rowData = response.data;
|
|
227
229
|
var rowCount = response.total;
|
|
228
230
|
setRowData(rowData);
|
|
231
|
+
// 刷新所有单元格
|
|
232
|
+
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 || _apiRef$current2.refreshCells({
|
|
233
|
+
force: true
|
|
234
|
+
});
|
|
229
235
|
setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
|
|
230
236
|
total: rowCount
|
|
231
237
|
}));
|
|
@@ -393,11 +399,13 @@ function AgGridPlus(props) {
|
|
|
393
399
|
}
|
|
394
400
|
return calculateArrCopy;
|
|
395
401
|
};
|
|
396
|
-
var getDataType = function getDataType(data, colName) {
|
|
402
|
+
var getDataType = function getDataType(data, colName, valueEnum) {
|
|
397
403
|
if (typeof data[colName] === 'number') {
|
|
404
|
+
// 如果有枚举值,说明是分类数据,不进行计算;否则默认求和
|
|
405
|
+
var shouldCalculate = !valueEnum || valueEnum.length === 0;
|
|
398
406
|
return {
|
|
399
407
|
type: "number",
|
|
400
|
-
calculateType: "sum",
|
|
408
|
+
calculateType: shouldCalculate ? "sum" : false,
|
|
401
409
|
cellStyle: {
|
|
402
410
|
'text-align': 'right'
|
|
403
411
|
}
|
|
@@ -423,7 +431,7 @@ function AgGridPlus(props) {
|
|
|
423
431
|
});
|
|
424
432
|
var columnDefs = !columnProps ? props.columnDefs ? props.columnDefs : [] : columnProps;
|
|
425
433
|
columnDefs = columnDefs.map(function (col) {
|
|
426
|
-
var dataType = getDataType(data, col.field);
|
|
434
|
+
var dataType = getDataType(data, col.field, col.valueEnum);
|
|
427
435
|
if (col.valueEnum && Array.isArray(col.valueEnum)) {
|
|
428
436
|
var _defaultItems$0$value, _defaultItems$;
|
|
429
437
|
// 统计默认值
|
|
@@ -520,8 +528,8 @@ function AgGridPlus(props) {
|
|
|
520
528
|
});
|
|
521
529
|
}
|
|
522
530
|
if (!allColDefs || displayedData.length === 0) {
|
|
523
|
-
var _apiRef$
|
|
524
|
-
(_apiRef$
|
|
531
|
+
var _apiRef$current3;
|
|
532
|
+
(_apiRef$current3 = apiRef.current) === null || _apiRef$current3 === void 0 || _apiRef$current3.setGridOption('pinnedBottomRowData', undefined);
|
|
525
533
|
return;
|
|
526
534
|
}
|
|
527
535
|
var calcColFields = allColDefs.filter(function (col) {
|
|
@@ -535,9 +543,9 @@ function AgGridPlus(props) {
|
|
|
535
543
|
};
|
|
536
544
|
});
|
|
537
545
|
if (calcColFields.length > 0) {
|
|
538
|
-
var _apiRef$
|
|
546
|
+
var _apiRef$current4;
|
|
539
547
|
var calculatedValues = calculatefun(calcColFields, displayedData);
|
|
540
|
-
(_apiRef$
|
|
548
|
+
(_apiRef$current4 = apiRef.current) === null || _apiRef$current4 === void 0 || _apiRef$current4.setGridOption('pinnedBottomRowData', calculatedValues);
|
|
541
549
|
}
|
|
542
550
|
};
|
|
543
551
|
var onFilterChanged = function onFilterChanged(event) {
|
|
@@ -654,6 +662,7 @@ function AgGridPlus(props) {
|
|
|
654
662
|
}), /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, _extends({
|
|
655
663
|
className: "ag-theme-custom"
|
|
656
664
|
}, rest, {
|
|
665
|
+
localeText: _locale.localeText,
|
|
657
666
|
gridOptions: {
|
|
658
667
|
enableCellTextSelection: true,
|
|
659
668
|
ensureDomOrder: true
|
|
@@ -668,11 +677,9 @@ function AgGridPlus(props) {
|
|
|
668
677
|
maintainColumnOrder: true,
|
|
669
678
|
rowData: rowDataMemo,
|
|
670
679
|
onGridReady: onGridReady,
|
|
671
|
-
defaultColDef: defaultColDef
|
|
672
|
-
getRowId
|
|
673
|
-
|
|
674
|
-
return ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.id) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4._id);
|
|
675
|
-
},
|
|
680
|
+
defaultColDef: defaultColDef
|
|
681
|
+
// getRowId={props.getRowId || ((params) => params.data?.id || params.data?._id)}
|
|
682
|
+
,
|
|
676
683
|
onSortChanged: function onSortChanged(event) {
|
|
677
684
|
sortChanged(event.api);
|
|
678
685
|
props.onSortChanged && props.onSortChanged(event);
|
|
@@ -682,8 +689,8 @@ function AgGridPlus(props) {
|
|
|
682
689
|
onRowSelected: onRowSelected,
|
|
683
690
|
onDragStopped: function onDragStopped(e) {
|
|
684
691
|
if (apiRef.current) {
|
|
685
|
-
var _apiRef$
|
|
686
|
-
var _columnState = (_apiRef$
|
|
692
|
+
var _apiRef$current5;
|
|
693
|
+
var _columnState = (_apiRef$current5 = apiRef.current) === null || _apiRef$current5 === void 0 ? void 0 : _apiRef$current5.getColumnState();
|
|
687
694
|
setColumnState(_columnState);
|
|
688
695
|
|
|
689
696
|
// onColumnStateChanged && onColumnStateChanged(columnState)
|
|
@@ -84,6 +84,15 @@ interface AgGridColumnPropsClone extends ColDef {
|
|
|
84
84
|
value: any;
|
|
85
85
|
label: any;
|
|
86
86
|
}[];
|
|
87
|
+
/**
|
|
88
|
+
* 列计算类型配置
|
|
89
|
+
* - "sum": 求和计算
|
|
90
|
+
* - "avg": 平均值计算
|
|
91
|
+
* - "standardDeviation": 标准差计算
|
|
92
|
+
* - false: 禁用计算
|
|
93
|
+
* 当设置后,会在表格底部固定行显示计算结果
|
|
94
|
+
*/
|
|
95
|
+
calculateType?: "sum" | "avg" | "standardDeviation" | false;
|
|
87
96
|
}
|
|
88
97
|
declare function AgGridColumn(props: AgGridColumnPropsClone | ColGroupDef): React.JSX.Element;
|
|
89
98
|
export { GridProps, AgGridColumn, GridRef, AgGridColumnPropsClone };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
export declare const localeText: {
|
|
2
|
+
page: string;
|
|
3
|
+
more: string;
|
|
4
|
+
to: string;
|
|
5
|
+
of: string;
|
|
6
|
+
next: string;
|
|
7
|
+
last: string;
|
|
8
|
+
first: string;
|
|
9
|
+
previous: string;
|
|
10
|
+
loadingOoo: string;
|
|
11
|
+
selectAll: string;
|
|
12
|
+
searchOoo: string;
|
|
13
|
+
blanks: string;
|
|
14
|
+
filterOoo: string;
|
|
15
|
+
applyFilter: string;
|
|
16
|
+
equals: string;
|
|
17
|
+
notEqual: string;
|
|
18
|
+
lessThan: string;
|
|
19
|
+
greaterThan: string;
|
|
20
|
+
lessThanOrEqual: string;
|
|
21
|
+
greaterThanOrEqual: string;
|
|
22
|
+
inRange: string;
|
|
23
|
+
contains: string;
|
|
24
|
+
notContains: string;
|
|
25
|
+
startsWith: string;
|
|
26
|
+
endsWith: string;
|
|
27
|
+
dateFormatOoo: string;
|
|
28
|
+
group: string;
|
|
29
|
+
ungroup: string;
|
|
30
|
+
pinColumn: string;
|
|
31
|
+
pinLeft: string;
|
|
32
|
+
pinRight: string;
|
|
33
|
+
noPin: string;
|
|
34
|
+
copy: string;
|
|
35
|
+
cut: string;
|
|
36
|
+
copyWithHeaders: string;
|
|
37
|
+
copyWithGroupHeaders: string;
|
|
38
|
+
ctrlC: string;
|
|
39
|
+
paste: string;
|
|
40
|
+
ctrlV: string;
|
|
41
|
+
export: string;
|
|
42
|
+
csvExport: string;
|
|
43
|
+
excelExport: string;
|
|
44
|
+
excelOldExport: string;
|
|
45
|
+
pivotChart: string;
|
|
46
|
+
chartRange: string;
|
|
47
|
+
columnChart: string;
|
|
48
|
+
groupedColumn: string;
|
|
49
|
+
stackedColumn: string;
|
|
50
|
+
normalizedColumn: string;
|
|
51
|
+
barChart: string;
|
|
52
|
+
groupedBar: string;
|
|
53
|
+
stackedBar: string;
|
|
54
|
+
normalizedBar: string;
|
|
55
|
+
lineChart: string;
|
|
56
|
+
pieChart: string;
|
|
57
|
+
pie: string;
|
|
58
|
+
doughnut: string;
|
|
59
|
+
areaChart: string;
|
|
60
|
+
area: string;
|
|
61
|
+
stackedArea: string;
|
|
62
|
+
normalizedArea: string;
|
|
63
|
+
scatterChart: string;
|
|
64
|
+
xyChart: string;
|
|
65
|
+
bubbleChart: string;
|
|
66
|
+
histogramChart: string;
|
|
67
|
+
combinationChart: string;
|
|
68
|
+
columnLineCombo: string;
|
|
69
|
+
areaColumnCombo: string;
|
|
70
|
+
pivotChartTitle: string;
|
|
71
|
+
rangeChartTitle: string;
|
|
72
|
+
settings: string;
|
|
73
|
+
data: string;
|
|
74
|
+
format: string;
|
|
75
|
+
categories: string;
|
|
76
|
+
series: string;
|
|
77
|
+
axis: string;
|
|
78
|
+
color: string;
|
|
79
|
+
thickness: string;
|
|
80
|
+
xRotation: string;
|
|
81
|
+
yRotation: string;
|
|
82
|
+
ticks: string;
|
|
83
|
+
width: string;
|
|
84
|
+
height: string;
|
|
85
|
+
length: string;
|
|
86
|
+
padding: string;
|
|
87
|
+
chart: string;
|
|
88
|
+
title: string;
|
|
89
|
+
background: string;
|
|
90
|
+
font: string;
|
|
91
|
+
top: string;
|
|
92
|
+
right: string;
|
|
93
|
+
bottom: string;
|
|
94
|
+
left: string;
|
|
95
|
+
labels: string;
|
|
96
|
+
size: string;
|
|
97
|
+
legend: string;
|
|
98
|
+
position: string;
|
|
99
|
+
markerSize: string;
|
|
100
|
+
markerStroke: string;
|
|
101
|
+
markerPadding: string;
|
|
102
|
+
itemPaddingX: string;
|
|
103
|
+
itemPaddingY: string;
|
|
104
|
+
strokeWidth: string;
|
|
105
|
+
offset: string;
|
|
106
|
+
tooltips: string;
|
|
107
|
+
offsets: string;
|
|
108
|
+
callout: string;
|
|
109
|
+
markers: string;
|
|
110
|
+
shadow: string;
|
|
111
|
+
blur: string;
|
|
112
|
+
xOffset: string;
|
|
113
|
+
yOffset: string;
|
|
114
|
+
lineWidth: string;
|
|
115
|
+
normal: string;
|
|
116
|
+
bold: string;
|
|
117
|
+
italic: string;
|
|
118
|
+
boldItalic: string;
|
|
119
|
+
predefined: string;
|
|
120
|
+
fillOpacity: string;
|
|
121
|
+
strokeOpacity: string;
|
|
122
|
+
histogramBinCount: string;
|
|
123
|
+
connectorLine: string;
|
|
124
|
+
seriesGroup: string;
|
|
125
|
+
grouped: string;
|
|
126
|
+
stacked: string;
|
|
127
|
+
normalized: string;
|
|
128
|
+
legendPadding: string;
|
|
129
|
+
groupPadding: string;
|
|
130
|
+
seriesType: string;
|
|
131
|
+
columns: string;
|
|
132
|
+
rowGroupColumns: string;
|
|
133
|
+
rowGroupColumnsEmptyMessage: string;
|
|
134
|
+
valueColumns: string;
|
|
135
|
+
valueColumnsEmptyMessage: string;
|
|
136
|
+
pivotColumns: string;
|
|
137
|
+
pivotColumnsEmptyMessage: string;
|
|
138
|
+
toolPanelButton: string;
|
|
139
|
+
noRowsToShow: string;
|
|
140
|
+
valueAggregation: string;
|
|
141
|
+
autosizeThiscolumn: string;
|
|
142
|
+
autosizeAllColumns: string;
|
|
143
|
+
groupBy: string;
|
|
144
|
+
ungroupBy: string;
|
|
145
|
+
resetColumns: string;
|
|
146
|
+
expandAll: string;
|
|
147
|
+
collapseAll: string;
|
|
148
|
+
toolPanel: string;
|
|
149
|
+
sum: string;
|
|
150
|
+
min: string;
|
|
151
|
+
max: string;
|
|
152
|
+
none: string;
|
|
153
|
+
count: string;
|
|
154
|
+
average: string;
|
|
155
|
+
avg: string;
|
|
156
|
+
filteredRows: string;
|
|
157
|
+
selectedRows: string;
|
|
158
|
+
totalRows: string;
|
|
159
|
+
totalAndFilteredRows: string;
|
|
160
|
+
and: string;
|
|
161
|
+
or: string;
|
|
162
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.localeText = void 0;
|
|
7
|
+
var localeText = exports.localeText = {
|
|
8
|
+
// for filter panel
|
|
9
|
+
page: '页',
|
|
10
|
+
more: '更多',
|
|
11
|
+
to: '到',
|
|
12
|
+
of: '的',
|
|
13
|
+
next: '下一页',
|
|
14
|
+
last: '末页',
|
|
15
|
+
first: '首页',
|
|
16
|
+
previous: '上一页',
|
|
17
|
+
loadingOoo: '加载中...',
|
|
18
|
+
// for set filter
|
|
19
|
+
selectAll: '全选',
|
|
20
|
+
searchOoo: '查询...',
|
|
21
|
+
blanks: '空白',
|
|
22
|
+
// for number filter and text filter
|
|
23
|
+
filterOoo: '筛选...',
|
|
24
|
+
applyFilter: '应用筛选',
|
|
25
|
+
equals: '等于',
|
|
26
|
+
notEqual: '不等于',
|
|
27
|
+
// for number filter
|
|
28
|
+
lessThan: '小于',
|
|
29
|
+
greaterThan: '大于',
|
|
30
|
+
lessThanOrEqual: '小于等于',
|
|
31
|
+
greaterThanOrEqual: '大于等于',
|
|
32
|
+
inRange: '范围',
|
|
33
|
+
// for text filter
|
|
34
|
+
contains: '包含',
|
|
35
|
+
notContains: '不包含',
|
|
36
|
+
startsWith: '开始于',
|
|
37
|
+
endsWith: '结束于',
|
|
38
|
+
// for date filter
|
|
39
|
+
dateFormatOoo: 'yyyy-mm-dd',
|
|
40
|
+
// for grouping
|
|
41
|
+
group: '分组',
|
|
42
|
+
ungroup: '取消分组',
|
|
43
|
+
// for context menu
|
|
44
|
+
pinColumn: '固定列',
|
|
45
|
+
pinLeft: '固定在左侧',
|
|
46
|
+
pinRight: '固定在右侧',
|
|
47
|
+
noPin: '不固定',
|
|
48
|
+
copy: '复制',
|
|
49
|
+
cut: '剪切',
|
|
50
|
+
copyWithHeaders: '带标题复制',
|
|
51
|
+
copyWithGroupHeaders: '带分组标题复制',
|
|
52
|
+
ctrlC: 'Ctrl+C',
|
|
53
|
+
paste: '粘贴',
|
|
54
|
+
ctrlV: 'Ctrl+V',
|
|
55
|
+
export: '导出',
|
|
56
|
+
csvExport: '导出为CSV',
|
|
57
|
+
excelExport: '导出为Excel (.xlsx)',
|
|
58
|
+
excelOldExport: '导出为Excel (.xls)',
|
|
59
|
+
// for chart
|
|
60
|
+
pivotChart: '透视表',
|
|
61
|
+
chartRange: '图表范围',
|
|
62
|
+
columnChart: '柱状图',
|
|
63
|
+
groupedColumn: '分组柱状图',
|
|
64
|
+
stackedColumn: '堆叠柱状图',
|
|
65
|
+
normalizedColumn: '百分比堆叠柱状图',
|
|
66
|
+
barChart: '条形图',
|
|
67
|
+
groupedBar: '分组条形图',
|
|
68
|
+
stackedBar: '堆叠条形图',
|
|
69
|
+
normalizedBar: '百分比堆叠条形图',
|
|
70
|
+
lineChart: '折线图',
|
|
71
|
+
pieChart: '饼图',
|
|
72
|
+
pie: '饼图',
|
|
73
|
+
doughnut: '环形图',
|
|
74
|
+
areaChart: '面积图',
|
|
75
|
+
area: '面积图',
|
|
76
|
+
stackedArea: '堆叠面积图',
|
|
77
|
+
normalizedArea: '百分比堆叠面积图',
|
|
78
|
+
scatterChart: '散点图',
|
|
79
|
+
xyChart: 'XY散点图',
|
|
80
|
+
bubbleChart: '气泡图',
|
|
81
|
+
histogramChart: '直方图',
|
|
82
|
+
combinationChart: '组合图',
|
|
83
|
+
columnLineCombo: '柱状图和折线图',
|
|
84
|
+
areaColumnCombo: '面积图和柱状图',
|
|
85
|
+
// for charts
|
|
86
|
+
pivotChartTitle: '透视表',
|
|
87
|
+
rangeChartTitle: '范围图表',
|
|
88
|
+
settings: '设置',
|
|
89
|
+
data: '数据',
|
|
90
|
+
format: '格式',
|
|
91
|
+
categories: '分类',
|
|
92
|
+
series: '系列',
|
|
93
|
+
axis: '坐标轴',
|
|
94
|
+
color: '颜色',
|
|
95
|
+
thickness: '厚度',
|
|
96
|
+
xRotation: 'X轴旋转',
|
|
97
|
+
yRotation: 'Y轴旋转',
|
|
98
|
+
ticks: '刻度',
|
|
99
|
+
width: '宽度',
|
|
100
|
+
height: '高度',
|
|
101
|
+
length: '长度',
|
|
102
|
+
padding: '内边距',
|
|
103
|
+
chart: '图表',
|
|
104
|
+
title: '标题',
|
|
105
|
+
background: '背景',
|
|
106
|
+
font: '字体',
|
|
107
|
+
top: '顶部',
|
|
108
|
+
right: '右侧',
|
|
109
|
+
bottom: '底部',
|
|
110
|
+
left: '左侧',
|
|
111
|
+
labels: '标签',
|
|
112
|
+
size: '大小',
|
|
113
|
+
legend: '图例',
|
|
114
|
+
position: '位置',
|
|
115
|
+
markerSize: '标记大小',
|
|
116
|
+
markerStroke: '标记描边',
|
|
117
|
+
markerPadding: '标记内边距',
|
|
118
|
+
itemPaddingX: '项目X轴内边距',
|
|
119
|
+
itemPaddingY: '项目Y轴内边距',
|
|
120
|
+
strokeWidth: '描边宽度',
|
|
121
|
+
offset: '偏移',
|
|
122
|
+
tooltips: '工具提示',
|
|
123
|
+
offsets: '偏移量',
|
|
124
|
+
callout: '标注',
|
|
125
|
+
markers: '标记',
|
|
126
|
+
shadow: '阴影',
|
|
127
|
+
blur: '模糊',
|
|
128
|
+
xOffset: 'X轴偏移',
|
|
129
|
+
yOffset: 'Y轴偏移',
|
|
130
|
+
lineWidth: '线宽',
|
|
131
|
+
normal: '正常',
|
|
132
|
+
bold: '粗体',
|
|
133
|
+
italic: '斜体',
|
|
134
|
+
boldItalic: '粗斜体',
|
|
135
|
+
predefined: '预定义',
|
|
136
|
+
fillOpacity: '填充不透明度',
|
|
137
|
+
strokeOpacity: '线条不透明度',
|
|
138
|
+
histogramBinCount: '直方图分组数量',
|
|
139
|
+
connectorLine: '连接线',
|
|
140
|
+
seriesGroup: '系列分组',
|
|
141
|
+
grouped: '分组',
|
|
142
|
+
stacked: '堆叠',
|
|
143
|
+
normalized: '归一化',
|
|
144
|
+
legendPadding: '图例内边距',
|
|
145
|
+
groupPadding: '分组内边距',
|
|
146
|
+
seriesType: '系列类型',
|
|
147
|
+
columns: '列',
|
|
148
|
+
rowGroupColumns: '行分组列',
|
|
149
|
+
rowGroupColumnsEmptyMessage: '将列拖至此处进行行分组',
|
|
150
|
+
valueColumns: '值列',
|
|
151
|
+
valueColumnsEmptyMessage: '将列拖至此处进行聚合',
|
|
152
|
+
pivotColumns: '数据透视列',
|
|
153
|
+
pivotColumnsEmptyMessage: '将列拖至此处设置为数据透视列',
|
|
154
|
+
toolPanelButton: '工具面板按钮',
|
|
155
|
+
noRowsToShow: '暂无数据',
|
|
156
|
+
valueAggregation: '值聚合',
|
|
157
|
+
autosizeThiscolumn: '自动调整此列',
|
|
158
|
+
autosizeAllColumns: '自动调整所有列',
|
|
159
|
+
groupBy: '按此列分组',
|
|
160
|
+
ungroupBy: '取消此列分组',
|
|
161
|
+
resetColumns: '重置列',
|
|
162
|
+
expandAll: '展开所有',
|
|
163
|
+
collapseAll: '折叠所有',
|
|
164
|
+
toolPanel: '工具面板',
|
|
165
|
+
sum: '总和',
|
|
166
|
+
min: '最小值',
|
|
167
|
+
max: '最大值',
|
|
168
|
+
none: '无',
|
|
169
|
+
count: '计数',
|
|
170
|
+
average: '平均值',
|
|
171
|
+
avg: '平均值',
|
|
172
|
+
filteredRows: '筛选行',
|
|
173
|
+
selectedRows: '选中行',
|
|
174
|
+
totalRows: '总行数',
|
|
175
|
+
totalAndFilteredRows: '行',
|
|
176
|
+
and: '和',
|
|
177
|
+
or: '或'
|
|
178
|
+
};
|
|
@@ -33,6 +33,7 @@ import CustomGroupCellRenderer from "./_utils/customGroupCellRenderer";
|
|
|
33
33
|
import processColumnGroups from "./_utils/processColumnGroups";
|
|
34
34
|
import flattenColumnState from "./_utils/processFormColumnState";
|
|
35
35
|
import { Select } from '@formily/antd-v5';
|
|
36
|
+
import { localeText } from "./locale";
|
|
36
37
|
var Paragraph = Typography.Paragraph,
|
|
37
38
|
Text = Typography.Text;
|
|
38
39
|
var getSort = function getSort(columnState) {
|
|
@@ -214,9 +215,14 @@ function AgGridPlus(props) {
|
|
|
214
215
|
sorter: getSort(sortColumn)
|
|
215
216
|
});
|
|
216
217
|
request && request(params, undefined, queryFilter).then(function (response) {
|
|
218
|
+
var _apiRef$current2;
|
|
217
219
|
var rowData = response.data;
|
|
218
220
|
var rowCount = response.total;
|
|
219
221
|
setRowData(rowData);
|
|
222
|
+
// 刷新所有单元格
|
|
223
|
+
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 || _apiRef$current2.refreshCells({
|
|
224
|
+
force: true
|
|
225
|
+
});
|
|
220
226
|
setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
|
|
221
227
|
total: rowCount
|
|
222
228
|
}));
|
|
@@ -384,11 +390,13 @@ function AgGridPlus(props) {
|
|
|
384
390
|
}
|
|
385
391
|
return calculateArrCopy;
|
|
386
392
|
};
|
|
387
|
-
var getDataType = function getDataType(data, colName) {
|
|
393
|
+
var getDataType = function getDataType(data, colName, valueEnum) {
|
|
388
394
|
if (typeof data[colName] === 'number') {
|
|
395
|
+
// 如果有枚举值,说明是分类数据,不进行计算;否则默认求和
|
|
396
|
+
var shouldCalculate = !valueEnum || valueEnum.length === 0;
|
|
389
397
|
return {
|
|
390
398
|
type: "number",
|
|
391
|
-
calculateType: "sum",
|
|
399
|
+
calculateType: shouldCalculate ? "sum" : false,
|
|
392
400
|
cellStyle: {
|
|
393
401
|
'text-align': 'right'
|
|
394
402
|
}
|
|
@@ -414,7 +422,7 @@ function AgGridPlus(props) {
|
|
|
414
422
|
});
|
|
415
423
|
var columnDefs = !columnProps ? props.columnDefs ? props.columnDefs : [] : columnProps;
|
|
416
424
|
columnDefs = columnDefs.map(function (col) {
|
|
417
|
-
var dataType = getDataType(data, col.field);
|
|
425
|
+
var dataType = getDataType(data, col.field, col.valueEnum);
|
|
418
426
|
if (col.valueEnum && Array.isArray(col.valueEnum)) {
|
|
419
427
|
var _defaultItems$0$value, _defaultItems$;
|
|
420
428
|
// 统计默认值
|
|
@@ -511,8 +519,8 @@ function AgGridPlus(props) {
|
|
|
511
519
|
});
|
|
512
520
|
}
|
|
513
521
|
if (!allColDefs || displayedData.length === 0) {
|
|
514
|
-
var _apiRef$
|
|
515
|
-
(_apiRef$
|
|
522
|
+
var _apiRef$current3;
|
|
523
|
+
(_apiRef$current3 = apiRef.current) === null || _apiRef$current3 === void 0 || _apiRef$current3.setGridOption('pinnedBottomRowData', undefined);
|
|
516
524
|
return;
|
|
517
525
|
}
|
|
518
526
|
var calcColFields = allColDefs.filter(function (col) {
|
|
@@ -526,9 +534,9 @@ function AgGridPlus(props) {
|
|
|
526
534
|
};
|
|
527
535
|
});
|
|
528
536
|
if (calcColFields.length > 0) {
|
|
529
|
-
var _apiRef$
|
|
537
|
+
var _apiRef$current4;
|
|
530
538
|
var calculatedValues = calculatefun(calcColFields, displayedData);
|
|
531
|
-
(_apiRef$
|
|
539
|
+
(_apiRef$current4 = apiRef.current) === null || _apiRef$current4 === void 0 || _apiRef$current4.setGridOption('pinnedBottomRowData', calculatedValues);
|
|
532
540
|
}
|
|
533
541
|
};
|
|
534
542
|
var onFilterChanged = function onFilterChanged(event) {
|
|
@@ -645,6 +653,7 @@ function AgGridPlus(props) {
|
|
|
645
653
|
}), /*#__PURE__*/React.createElement(AgGridReact, _extends({
|
|
646
654
|
className: "ag-theme-custom"
|
|
647
655
|
}, rest, {
|
|
656
|
+
localeText: localeText,
|
|
648
657
|
gridOptions: {
|
|
649
658
|
enableCellTextSelection: true,
|
|
650
659
|
ensureDomOrder: true
|
|
@@ -659,11 +668,9 @@ function AgGridPlus(props) {
|
|
|
659
668
|
maintainColumnOrder: true,
|
|
660
669
|
rowData: rowDataMemo,
|
|
661
670
|
onGridReady: onGridReady,
|
|
662
|
-
defaultColDef: defaultColDef
|
|
663
|
-
getRowId
|
|
664
|
-
|
|
665
|
-
return ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.id) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4._id);
|
|
666
|
-
},
|
|
671
|
+
defaultColDef: defaultColDef
|
|
672
|
+
// getRowId={props.getRowId || ((params) => params.data?.id || params.data?._id)}
|
|
673
|
+
,
|
|
667
674
|
onSortChanged: function onSortChanged(event) {
|
|
668
675
|
sortChanged(event.api);
|
|
669
676
|
props.onSortChanged && props.onSortChanged(event);
|
|
@@ -673,8 +680,8 @@ function AgGridPlus(props) {
|
|
|
673
680
|
onRowSelected: onRowSelected,
|
|
674
681
|
onDragStopped: function onDragStopped(e) {
|
|
675
682
|
if (apiRef.current) {
|
|
676
|
-
var _apiRef$
|
|
677
|
-
var _columnState = (_apiRef$
|
|
683
|
+
var _apiRef$current5;
|
|
684
|
+
var _columnState = (_apiRef$current5 = apiRef.current) === null || _apiRef$current5 === void 0 ? void 0 : _apiRef$current5.getColumnState();
|
|
678
685
|
setColumnState(_columnState);
|
|
679
686
|
|
|
680
687
|
// onColumnStateChanged && onColumnStateChanged(columnState)
|
|
@@ -84,6 +84,15 @@ interface AgGridColumnPropsClone extends ColDef {
|
|
|
84
84
|
value: any;
|
|
85
85
|
label: any;
|
|
86
86
|
}[];
|
|
87
|
+
/**
|
|
88
|
+
* 列计算类型配置
|
|
89
|
+
* - "sum": 求和计算
|
|
90
|
+
* - "avg": 平均值计算
|
|
91
|
+
* - "standardDeviation": 标准差计算
|
|
92
|
+
* - false: 禁用计算
|
|
93
|
+
* 当设置后,会在表格底部固定行显示计算结果
|
|
94
|
+
*/
|
|
95
|
+
calculateType?: "sum" | "avg" | "standardDeviation" | false;
|
|
87
96
|
}
|
|
88
97
|
declare function AgGridColumn(props: AgGridColumnPropsClone | ColGroupDef): React.JSX.Element;
|
|
89
98
|
export { GridProps, AgGridColumn, GridRef, AgGridColumnPropsClone };
|