@lemon-fe/components 1.4.28-alpha.4 → 1.4.28
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.
|
@@ -118,7 +118,7 @@ export default function FieldModal(props) {
|
|
|
118
118
|
summaryType: 1,
|
|
119
119
|
decimalPlaces: 2,
|
|
120
120
|
groupId: undefined,
|
|
121
|
-
dataFormatType: 'number'
|
|
121
|
+
dataFormatType: supportSelectDataFormat ? 'number' : undefined
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
@@ -128,7 +128,7 @@ export default function FieldModal(props) {
|
|
|
128
128
|
expression: formatExpression(openProp.expression),
|
|
129
129
|
decimalPlaces: (_openProp$decimalPlac = openProp.decimalPlaces) !== null && _openProp$decimalPlac !== void 0 ? _openProp$decimalPlac : 2,
|
|
130
130
|
groupId: openProp.groupId,
|
|
131
|
-
dataFormatType: (_openProp$dataFormatT = openProp.dataFormatType) !== null && _openProp$dataFormatT !== void 0 ? _openProp$dataFormatT : 'number'
|
|
131
|
+
dataFormatType: supportSelectDataFormat ? (_openProp$dataFormatT = openProp.dataFormatType) !== null && _openProp$dataFormatT !== void 0 ? _openProp$dataFormatT : 'number' : undefined
|
|
132
132
|
}));
|
|
133
133
|
}
|
|
134
134
|
} else {
|
|
@@ -224,7 +224,12 @@ export default function CustomColumnPanel(params) {
|
|
|
224
224
|
save = _useRequest.run,
|
|
225
225
|
loading = _useRequest.loading;
|
|
226
226
|
useEffect(function () {
|
|
227
|
+
var mounted = true;
|
|
227
228
|
var handler = function handler(e) {
|
|
229
|
+
// 出现了组件卸载后事件还是触发的问题,应该是ag-grid内部时机的问题;
|
|
230
|
+
if (!mounted) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
228
233
|
if ((e.type === 'columnMoved' || e.type === 'columnResized') && !e.finished) {
|
|
229
234
|
return;
|
|
230
235
|
}
|
|
@@ -240,6 +245,7 @@ export default function CustomColumnPanel(params) {
|
|
|
240
245
|
api.addEventListener('columnValueChanged', handler);
|
|
241
246
|
api.addEventListener('newColumnsLoaded', handler);
|
|
242
247
|
return function () {
|
|
248
|
+
mounted = false;
|
|
243
249
|
api.removeEventListener('columnVisible', handler);
|
|
244
250
|
api.removeEventListener('columnMoved', handler);
|
|
245
251
|
api.removeEventListener('columnPinned', handler);
|
package/es/data-grid/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const Editors: {
|
|
|
17
17
|
Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
18
18
|
Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
19
19
|
Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("..").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
|
|
20
|
-
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "
|
|
20
|
+
Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
|
|
21
21
|
fieldNames?: {
|
|
22
22
|
label: string;
|
|
23
23
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -780,6 +780,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
780
780
|
this.dataSource = [];
|
|
781
781
|
this.api.setRowData([]);
|
|
782
782
|
this.api.setColumnDefs([]);
|
|
783
|
+
this.api.destroy();
|
|
783
784
|
var context = this.api.__getContext();
|
|
784
785
|
var gridOptionsService = context.getBean('gridOptionsService');
|
|
785
786
|
for (var field in gridOptionsService.gridOptions) {
|
|
@@ -1316,15 +1317,23 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1316
1317
|
}
|
|
1317
1318
|
if (params.value !== undefined && params.value !== null) {
|
|
1318
1319
|
var val = params.value;
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1320
|
+
if (field.dataFormatType === 'percentage' && expressionSuffix !== '%') {
|
|
1321
|
+
var bn = new BigNumber(toNumber(val));
|
|
1322
|
+
if (!bn.isNaN() && bn.isFinite()) {
|
|
1321
1323
|
var _field$decimalPlaces;
|
|
1322
|
-
val =
|
|
1324
|
+
val = bn.multipliedBy(100).toFixed((_field$decimalPlaces = field.decimalPlaces) !== null && _field$decimalPlaces !== void 0 ? _field$decimalPlaces : 2);
|
|
1323
1325
|
return "".concat(val, "%").concat(expressionSuffix);
|
|
1324
|
-
}
|
|
1326
|
+
}
|
|
1327
|
+
} else if (field.dataFormatType === 'number') {
|
|
1328
|
+
var _bn = new BigNumber(toNumber(val));
|
|
1329
|
+
if (!_bn.isNaN() && _bn.isFinite()) {
|
|
1325
1330
|
var _field$decimalPlaces2;
|
|
1326
|
-
val =
|
|
1331
|
+
val = _bn.toFixed((_field$decimalPlaces2 = field.decimalPlaces) !== null && _field$decimalPlaces2 !== void 0 ? _field$decimalPlaces2 : 2);
|
|
1327
1332
|
}
|
|
1333
|
+
} else if (typeof val === 'number' || BigNumber.isBigNumber(val)) {
|
|
1334
|
+
var _field$decimalPlaces3;
|
|
1335
|
+
//调整未加任何配置时保持原逻辑
|
|
1336
|
+
val = new BigNumber(val).toFixed((_field$decimalPlaces3 = field.decimalPlaces) !== null && _field$decimalPlaces3 !== void 0 ? _field$decimalPlaces3 : 2);
|
|
1328
1337
|
}
|
|
1329
1338
|
return "".concat(val).concat(expressionSuffix);
|
|
1330
1339
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.4.28
|
|
3
|
+
"version": "1.4.28",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://registry.npmjs.org"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "8569d6f611b682d2b0213d7ada70f43b23ad7933"
|
|
62
62
|
}
|