@nokecy/qc-ui 1.0.22 → 1.0.24
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 +13 -3
- package/dist/cjs/ag-grid-plus/interface.d.ts +4 -0
- package/dist/cjs/ag-grid-plus/setting/index.js +15 -2
- package/dist/cjs/dialogSelect/index.js +2 -1
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +13 -3
- package/dist/esm/ag-grid-plus/interface.d.ts +4 -0
- package/dist/esm/ag-grid-plus/setting/index.js +15 -2
- package/dist/esm/dialogSelect/index.js +2 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ var _icons = require("@ant-design/icons");
|
|
|
20
20
|
var _utils = require("./utils");
|
|
21
21
|
var _setting = _interopRequireDefault(require("./setting"));
|
|
22
22
|
var _ = require(".");
|
|
23
|
-
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand"];
|
|
23
|
+
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText"];
|
|
24
24
|
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); }
|
|
25
25
|
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; }
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -61,6 +61,7 @@ function AgGridPlus(props) {
|
|
|
61
61
|
gridKey = props.gridKey,
|
|
62
62
|
children = props.children,
|
|
63
63
|
defaultSearchExpand = props.defaultSearchExpand,
|
|
64
|
+
overlayNoRowsTemplateText = props.overlayNoRowsTemplateText,
|
|
64
65
|
rest = _objectWithoutProperties(props, _excluded);
|
|
65
66
|
var _useGridPlusColumnSta = (0, _.useGridPlusColumnState)(),
|
|
66
67
|
onSaveColumnState = _useGridPlusColumnSta.onSaveColumnState,
|
|
@@ -177,6 +178,7 @@ function AgGridPlus(props) {
|
|
|
177
178
|
state: gridPlusColumnState[gridKey],
|
|
178
179
|
applyOrder: true
|
|
179
180
|
});
|
|
181
|
+
apiRef.current.setGridOption("columnDefs", gridPlusColumnState[gridKey]);
|
|
180
182
|
}
|
|
181
183
|
}, [gridPlusColumnState, apiRef.current]);
|
|
182
184
|
(0, _react.useEffect)(function () {
|
|
@@ -297,6 +299,12 @@ function AgGridPlus(props) {
|
|
|
297
299
|
}) / count;
|
|
298
300
|
return Math.sqrt(variance);
|
|
299
301
|
};
|
|
302
|
+
var handelNumber = function handelNumber(value) {
|
|
303
|
+
return (value / 1).toLocaleString(undefined, {
|
|
304
|
+
minimumFractionDigits: 2,
|
|
305
|
+
maximumFractionDigits: 2
|
|
306
|
+
});
|
|
307
|
+
};
|
|
300
308
|
|
|
301
309
|
// sum 求和 avg 平均值 standardDeviation 标准差
|
|
302
310
|
var calculatefun = function calculatefun(calcColFields, displayedData) {
|
|
@@ -308,7 +316,7 @@ function AgGridPlus(props) {
|
|
|
308
316
|
if (!i.cellRenderer) {
|
|
309
317
|
switch (i.calculateType) {
|
|
310
318
|
case "sum":
|
|
311
|
-
calculateData[i.field] = sumFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
319
|
+
calculateData[i.field] = i.formatWithCommas ? handelNumber(sumFun(i.field, displayedData).toFixed(i.transactionAmount)) : sumFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
312
320
|
break;
|
|
313
321
|
case "avg":
|
|
314
322
|
calculateData[i.field] = avgFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
@@ -414,7 +422,8 @@ function AgGridPlus(props) {
|
|
|
414
422
|
return {
|
|
415
423
|
field: col.field,
|
|
416
424
|
calculateType: col.calculateType,
|
|
417
|
-
transactionAmount: col.transactionAmount || 2
|
|
425
|
+
transactionAmount: col.transactionAmount || 2,
|
|
426
|
+
formatWithCommas: col.formatWithCommas
|
|
418
427
|
};
|
|
419
428
|
});
|
|
420
429
|
if (calcColFields.length > 0) {
|
|
@@ -516,6 +525,7 @@ function AgGridPlus(props) {
|
|
|
516
525
|
enableCellTextSelection: true,
|
|
517
526
|
ensureDomOrder: true
|
|
518
527
|
},
|
|
528
|
+
overlayNoRowsTemplate: "<span style=\"\n display: flex; \n justify-content: center; \n align-items: center; \n height: 100%; \n font-size: 14px; \n color: #aaa; \n line-height: 1.5;\n text-align: center;\">\n ".concat(overlayNoRowsTemplateText || '没有找到数据,试试调整筛选条件吧!', "\n </span>"),
|
|
519
529
|
enableRangeSelection: true,
|
|
520
530
|
suppressCopyRowsToClipboard: true
|
|
521
531
|
//指定客户端模式
|
|
@@ -27,6 +27,10 @@ interface GridProps extends AgGridReactProps {
|
|
|
27
27
|
* 列方案
|
|
28
28
|
*/
|
|
29
29
|
gridColumnState?: any[];
|
|
30
|
+
/**
|
|
31
|
+
* 列表空数据文字提示
|
|
32
|
+
*/
|
|
33
|
+
overlayNoRowsTemplateText?: string;
|
|
30
34
|
gridRef?: React.Ref<GridRef | undefined>;
|
|
31
35
|
}
|
|
32
36
|
interface AgGridColumnPropsClone extends ColDef {
|
|
@@ -63,7 +63,9 @@ var Setting = function Setting(props) {
|
|
|
63
63
|
headerName: colDef.headerName,
|
|
64
64
|
width: columnState.width,
|
|
65
65
|
hide: columnState.hide,
|
|
66
|
-
cellClass: colDef.cellClass
|
|
66
|
+
cellClass: colDef.cellClass,
|
|
67
|
+
// 添加 cellClass
|
|
68
|
+
suppressHeaderFilterButton: colDef.suppressHeaderFilterButton
|
|
67
69
|
}, columnState));
|
|
68
70
|
});
|
|
69
71
|
return columnRowData;
|
|
@@ -124,7 +126,7 @@ var Setting = function Setting(props) {
|
|
|
124
126
|
})), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
|
|
125
127
|
"x-component": "ArrayTable.Column",
|
|
126
128
|
"x-component-props": {
|
|
127
|
-
width:
|
|
129
|
+
width: 280,
|
|
128
130
|
title: "列名"
|
|
129
131
|
}
|
|
130
132
|
}, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
|
|
@@ -132,6 +134,16 @@ var Setting = function Setting(props) {
|
|
|
132
134
|
"x-decorator": "FormItem",
|
|
133
135
|
"x-component": "Input",
|
|
134
136
|
"x-read-pretty": true
|
|
137
|
+
})), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
|
|
138
|
+
"x-component": "ArrayTable.Column",
|
|
139
|
+
"x-component-props": {
|
|
140
|
+
width: 80,
|
|
141
|
+
title: "列过滤"
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
|
|
144
|
+
name: "suppressHeaderFilterButton",
|
|
145
|
+
"x-decorator": "FormItem",
|
|
146
|
+
"x-component": "Switch"
|
|
135
147
|
})), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
|
|
136
148
|
"x-component": "ArrayTable.Column",
|
|
137
149
|
"x-component-props": {
|
|
@@ -219,6 +231,7 @@ var Setting = function Setting(props) {
|
|
|
219
231
|
state: values.items,
|
|
220
232
|
applyOrder: true
|
|
221
233
|
});
|
|
234
|
+
gridApi.setGridOption("columnDefs", values.items);
|
|
222
235
|
}, 100);
|
|
223
236
|
next(payload);
|
|
224
237
|
}).open(formProps);
|
|
@@ -110,7 +110,8 @@ var DialogSelect = function DialogSelect(props) {
|
|
|
110
110
|
marginRight: !props.hideBtn ? 5 : 0
|
|
111
111
|
})
|
|
112
112
|
})) : /*#__PURE__*/_react.default.createElement(_antdV.Select, _extends({
|
|
113
|
-
maxTagCount: 'responsive'
|
|
113
|
+
maxTagCount: 'responsive',
|
|
114
|
+
filterOption: false
|
|
114
115
|
}, rest, {
|
|
115
116
|
value: state,
|
|
116
117
|
style: _objectSpread({
|
|
@@ -2,7 +2,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
import _sumBy from "lodash/sumBy";
|
|
3
3
|
import _uniqueId from "lodash/uniqueId";
|
|
4
4
|
import _isArray from "lodash/isArray";
|
|
5
|
-
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand"];
|
|
5
|
+
var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText"];
|
|
6
6
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -52,6 +52,7 @@ function AgGridPlus(props) {
|
|
|
52
52
|
gridKey = props.gridKey,
|
|
53
53
|
children = props.children,
|
|
54
54
|
defaultSearchExpand = props.defaultSearchExpand,
|
|
55
|
+
overlayNoRowsTemplateText = props.overlayNoRowsTemplateText,
|
|
55
56
|
rest = _objectWithoutProperties(props, _excluded);
|
|
56
57
|
var _useGridPlusColumnSta = useGridPlusColumnState(),
|
|
57
58
|
onSaveColumnState = _useGridPlusColumnSta.onSaveColumnState,
|
|
@@ -168,6 +169,7 @@ function AgGridPlus(props) {
|
|
|
168
169
|
state: gridPlusColumnState[gridKey],
|
|
169
170
|
applyOrder: true
|
|
170
171
|
});
|
|
172
|
+
apiRef.current.setGridOption("columnDefs", gridPlusColumnState[gridKey]);
|
|
171
173
|
}
|
|
172
174
|
}, [gridPlusColumnState, apiRef.current]);
|
|
173
175
|
useEffect(function () {
|
|
@@ -288,6 +290,12 @@ function AgGridPlus(props) {
|
|
|
288
290
|
}) / count;
|
|
289
291
|
return Math.sqrt(variance);
|
|
290
292
|
};
|
|
293
|
+
var handelNumber = function handelNumber(value) {
|
|
294
|
+
return (value / 1).toLocaleString(undefined, {
|
|
295
|
+
minimumFractionDigits: 2,
|
|
296
|
+
maximumFractionDigits: 2
|
|
297
|
+
});
|
|
298
|
+
};
|
|
291
299
|
|
|
292
300
|
// sum 求和 avg 平均值 standardDeviation 标准差
|
|
293
301
|
var calculatefun = function calculatefun(calcColFields, displayedData) {
|
|
@@ -299,7 +307,7 @@ function AgGridPlus(props) {
|
|
|
299
307
|
if (!i.cellRenderer) {
|
|
300
308
|
switch (i.calculateType) {
|
|
301
309
|
case "sum":
|
|
302
|
-
calculateData[i.field] = sumFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
310
|
+
calculateData[i.field] = i.formatWithCommas ? handelNumber(sumFun(i.field, displayedData).toFixed(i.transactionAmount)) : sumFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
303
311
|
break;
|
|
304
312
|
case "avg":
|
|
305
313
|
calculateData[i.field] = avgFun(i.field, displayedData).toFixed(i.transactionAmount);
|
|
@@ -405,7 +413,8 @@ function AgGridPlus(props) {
|
|
|
405
413
|
return {
|
|
406
414
|
field: col.field,
|
|
407
415
|
calculateType: col.calculateType,
|
|
408
|
-
transactionAmount: col.transactionAmount || 2
|
|
416
|
+
transactionAmount: col.transactionAmount || 2,
|
|
417
|
+
formatWithCommas: col.formatWithCommas
|
|
409
418
|
};
|
|
410
419
|
});
|
|
411
420
|
if (calcColFields.length > 0) {
|
|
@@ -507,6 +516,7 @@ function AgGridPlus(props) {
|
|
|
507
516
|
enableCellTextSelection: true,
|
|
508
517
|
ensureDomOrder: true
|
|
509
518
|
},
|
|
519
|
+
overlayNoRowsTemplate: "<span style=\"\n display: flex; \n justify-content: center; \n align-items: center; \n height: 100%; \n font-size: 14px; \n color: #aaa; \n line-height: 1.5;\n text-align: center;\">\n ".concat(overlayNoRowsTemplateText || '没有找到数据,试试调整筛选条件吧!', "\n </span>"),
|
|
510
520
|
enableRangeSelection: true,
|
|
511
521
|
suppressCopyRowsToClipboard: true
|
|
512
522
|
//指定客户端模式
|
|
@@ -27,6 +27,10 @@ interface GridProps extends AgGridReactProps {
|
|
|
27
27
|
* 列方案
|
|
28
28
|
*/
|
|
29
29
|
gridColumnState?: any[];
|
|
30
|
+
/**
|
|
31
|
+
* 列表空数据文字提示
|
|
32
|
+
*/
|
|
33
|
+
overlayNoRowsTemplateText?: string;
|
|
30
34
|
gridRef?: React.Ref<GridRef | undefined>;
|
|
31
35
|
}
|
|
32
36
|
interface AgGridColumnPropsClone extends ColDef {
|
|
@@ -54,7 +54,9 @@ var Setting = function Setting(props) {
|
|
|
54
54
|
headerName: colDef.headerName,
|
|
55
55
|
width: columnState.width,
|
|
56
56
|
hide: columnState.hide,
|
|
57
|
-
cellClass: colDef.cellClass
|
|
57
|
+
cellClass: colDef.cellClass,
|
|
58
|
+
// 添加 cellClass
|
|
59
|
+
suppressHeaderFilterButton: colDef.suppressHeaderFilterButton
|
|
58
60
|
}, columnState));
|
|
59
61
|
});
|
|
60
62
|
return columnRowData;
|
|
@@ -115,7 +117,7 @@ var Setting = function Setting(props) {
|
|
|
115
117
|
})), /*#__PURE__*/React.createElement(SchemaField.Void, {
|
|
116
118
|
"x-component": "ArrayTable.Column",
|
|
117
119
|
"x-component-props": {
|
|
118
|
-
width:
|
|
120
|
+
width: 280,
|
|
119
121
|
title: "列名"
|
|
120
122
|
}
|
|
121
123
|
}, /*#__PURE__*/React.createElement(SchemaField.String, {
|
|
@@ -123,6 +125,16 @@ var Setting = function Setting(props) {
|
|
|
123
125
|
"x-decorator": "FormItem",
|
|
124
126
|
"x-component": "Input",
|
|
125
127
|
"x-read-pretty": true
|
|
128
|
+
})), /*#__PURE__*/React.createElement(SchemaField.Void, {
|
|
129
|
+
"x-component": "ArrayTable.Column",
|
|
130
|
+
"x-component-props": {
|
|
131
|
+
width: 80,
|
|
132
|
+
title: "列过滤"
|
|
133
|
+
}
|
|
134
|
+
}, /*#__PURE__*/React.createElement(SchemaField.String, {
|
|
135
|
+
name: "suppressHeaderFilterButton",
|
|
136
|
+
"x-decorator": "FormItem",
|
|
137
|
+
"x-component": "Switch"
|
|
126
138
|
})), /*#__PURE__*/React.createElement(SchemaField.Void, {
|
|
127
139
|
"x-component": "ArrayTable.Column",
|
|
128
140
|
"x-component-props": {
|
|
@@ -210,6 +222,7 @@ var Setting = function Setting(props) {
|
|
|
210
222
|
state: values.items,
|
|
211
223
|
applyOrder: true
|
|
212
224
|
});
|
|
225
|
+
gridApi.setGridOption("columnDefs", values.items);
|
|
213
226
|
}, 100);
|
|
214
227
|
next(payload);
|
|
215
228
|
}).open(formProps);
|
|
@@ -101,7 +101,8 @@ var DialogSelect = function DialogSelect(props) {
|
|
|
101
101
|
marginRight: !props.hideBtn ? 5 : 0
|
|
102
102
|
})
|
|
103
103
|
})) : /*#__PURE__*/React.createElement(Select, _extends({
|
|
104
|
-
maxTagCount: 'responsive'
|
|
104
|
+
maxTagCount: 'responsive',
|
|
105
|
+
filterOption: false
|
|
105
106
|
}, rest, {
|
|
106
107
|
value: state,
|
|
107
108
|
style: _objectSpread({
|