@lemon-fe/components 1.4.28-alpha.1 → 1.4.28-alpha.3
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/data-grid/components/custom-panel/field-modal.d.ts +1 -0
- package/es/data-grid/components/custom-panel/field-modal.js +18 -4
- package/es/data-grid/components/custom-panel/index.d.ts +3 -0
- package/es/data-grid/components/custom-panel/index.js +4 -2
- package/es/data-grid/components/custom-panel/typings.d.ts +1 -0
- package/es/data-grid/index.d.ts +1 -1
- package/es/data-grid/index.js +29 -7
- package/es/data-grid/locale/en_US.js +4 -1
- package/es/data-grid/locale/id.js +4 -1
- package/es/data-grid/locale/locale.d.ts +3 -0
- package/es/data-grid/locale/vi.js +4 -1
- package/es/data-grid/locale/zh_CN.js +4 -1
- package/es/data-grid/locale/zh_Hant_HK.js +4 -1
- package/es/data-grid/typings.d.ts +6 -0
- package/package.json +2 -2
|
@@ -28,7 +28,8 @@ export default function FieldModal(props) {
|
|
|
28
28
|
onOk = props.onOk,
|
|
29
29
|
enableSummary = props.enableSummary,
|
|
30
30
|
groups = props.groups,
|
|
31
|
-
locale = props.locale
|
|
31
|
+
locale = props.locale,
|
|
32
|
+
supportSelectDataFormat = props.supportSelectDataFormat;
|
|
32
33
|
var _useState = useState(false),
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
35
|
open = _useState2[0],
|
|
@@ -116,16 +117,18 @@ export default function FieldModal(props) {
|
|
|
116
117
|
summary: false,
|
|
117
118
|
summaryType: 1,
|
|
118
119
|
decimalPlaces: 2,
|
|
119
|
-
groupId: undefined
|
|
120
|
+
groupId: undefined,
|
|
121
|
+
dataFormatType: 'number'
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
124
|
} else {
|
|
123
|
-
var _openProp$decimalPlac;
|
|
125
|
+
var _openProp$decimalPlac, _openProp$dataFormatT;
|
|
124
126
|
setOpen(true);
|
|
125
127
|
form.setFieldsValue(_objectSpread(_objectSpread({}, openProp), {}, {
|
|
126
128
|
expression: formatExpression(openProp.expression),
|
|
127
129
|
decimalPlaces: (_openProp$decimalPlac = openProp.decimalPlaces) !== null && _openProp$decimalPlac !== void 0 ? _openProp$decimalPlac : 2,
|
|
128
|
-
groupId: openProp.groupId
|
|
130
|
+
groupId: openProp.groupId,
|
|
131
|
+
dataFormatType: (_openProp$dataFormatT = openProp.dataFormatType) !== null && _openProp$dataFormatT !== void 0 ? _openProp$dataFormatT : 'number'
|
|
129
132
|
}));
|
|
130
133
|
}
|
|
131
134
|
} else {
|
|
@@ -235,6 +238,17 @@ export default function FieldModal(props) {
|
|
|
235
238
|
height: 120
|
|
236
239
|
},
|
|
237
240
|
placeholder: fieldModal.customColumnExpressionPlaceholder
|
|
241
|
+
})), supportSelectDataFormat && /*#__PURE__*/React.createElement(Form.Item, {
|
|
242
|
+
label: fieldModal.customColumnDataFormatTypeText,
|
|
243
|
+
name: "dataFormatType"
|
|
244
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
245
|
+
options: [{
|
|
246
|
+
label: fieldModal.customColumnDataFormatTypeOptionsNumberText,
|
|
247
|
+
value: 'number'
|
|
248
|
+
}, {
|
|
249
|
+
label: fieldModal.customColumnDataFormatTypeOptionsPercentageText,
|
|
250
|
+
value: 'percentage'
|
|
251
|
+
}]
|
|
238
252
|
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
239
253
|
label: fieldModal.customColumnDecimalPlacesText,
|
|
240
254
|
name: "decimalPlaces"
|
|
@@ -30,7 +30,8 @@ export default function CustomColumnPanel(params) {
|
|
|
30
30
|
api = params.api,
|
|
31
31
|
enableSave = params.enableSave,
|
|
32
32
|
enableSummary = params.enableSummary,
|
|
33
|
-
locale = params.locale
|
|
33
|
+
locale = params.locale,
|
|
34
|
+
customColumnPanelExtra = params.customColumnPanelExtra;
|
|
34
35
|
var _useState = useState(false),
|
|
35
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
37
|
searching = _useState2[0],
|
|
@@ -420,6 +421,7 @@ export default function CustomColumnPanel(params) {
|
|
|
420
421
|
onOk: function onOk(value) {
|
|
421
422
|
grid.setField(value);
|
|
422
423
|
},
|
|
423
|
-
locale: locale
|
|
424
|
+
locale: locale,
|
|
425
|
+
supportSelectDataFormat: customColumnPanelExtra === null || customColumnPanelExtra === void 0 ? void 0 : customColumnPanelExtra.supportSelectDataFormat
|
|
424
426
|
}));
|
|
425
427
|
}
|
package/es/data-grid/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ declare class InternalDataGrid<TData extends Record<string, any>> extends Compon
|
|
|
68
68
|
private getFullColumnDef;
|
|
69
69
|
private getColumnDefs;
|
|
70
70
|
isClientMode(): boolean;
|
|
71
|
-
private
|
|
71
|
+
private flushReadyQueue;
|
|
72
72
|
afterReady(cb: () => void): void;
|
|
73
73
|
private isPreserveSelected;
|
|
74
74
|
private updateRowData;
|
package/es/data-grid/index.js
CHANGED
|
@@ -180,7 +180,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
180
180
|
toolPanelParams: {
|
|
181
181
|
enableSave: !!_this.props.customColumnPanelStorage,
|
|
182
182
|
enableSummary: _this.isClientMode() || _this.props.enableCustomColumnSummary,
|
|
183
|
-
locale: _this.props.locale
|
|
183
|
+
locale: _this.props.locale,
|
|
184
|
+
customColumnPanelExtra: _this.props.customColumnPanelExtra
|
|
184
185
|
}
|
|
185
186
|
}]
|
|
186
187
|
});
|
|
@@ -322,7 +323,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
322
323
|
});
|
|
323
324
|
}
|
|
324
325
|
});
|
|
325
|
-
_this.
|
|
326
|
+
_this.flushReadyQueue();
|
|
326
327
|
case 20:
|
|
327
328
|
case "end":
|
|
328
329
|
return _context.stop();
|
|
@@ -773,6 +774,15 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
773
774
|
}, {
|
|
774
775
|
key: "componentWillUnmount",
|
|
775
776
|
value: function componentWillUnmount() {
|
|
777
|
+
if (this.isReady) {
|
|
778
|
+
// 解决agGrid部分内存泄漏
|
|
779
|
+
|
|
780
|
+
this.dataSource = [];
|
|
781
|
+
this.api.setRowData([]);
|
|
782
|
+
this.api.setColumnDefs([]);
|
|
783
|
+
this.api = new GridApi();
|
|
784
|
+
this.columnApi = new ColumnApi();
|
|
785
|
+
}
|
|
776
786
|
this.mounted = false;
|
|
777
787
|
this.isReady = false;
|
|
778
788
|
window.removeEventListener('blur', this.handleFocus);
|
|
@@ -1297,8 +1307,14 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1297
1307
|
if (params.value !== undefined && params.value !== null) {
|
|
1298
1308
|
var val = params.value;
|
|
1299
1309
|
if (typeof val === 'number' || BigNumber.isBigNumber(val)) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1310
|
+
if (field.dataFormatType === 'percentage' && expressionSuffix !== '%') {
|
|
1311
|
+
var _field$decimalPlaces;
|
|
1312
|
+
val = new BigNumber(val).multipliedBy(100).toFixed((_field$decimalPlaces = field.decimalPlaces) !== null && _field$decimalPlaces !== void 0 ? _field$decimalPlaces : 2);
|
|
1313
|
+
return "".concat(val, "%").concat(expressionSuffix);
|
|
1314
|
+
} else {
|
|
1315
|
+
var _field$decimalPlaces2;
|
|
1316
|
+
val = new BigNumber(val).toFixed((_field$decimalPlaces2 = field.decimalPlaces) !== null && _field$decimalPlaces2 !== void 0 ? _field$decimalPlaces2 : 2);
|
|
1317
|
+
}
|
|
1302
1318
|
}
|
|
1303
1319
|
return "".concat(val).concat(expressionSuffix);
|
|
1304
1320
|
}
|
|
@@ -1389,8 +1405,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1389
1405
|
return this.props.fetch === undefined;
|
|
1390
1406
|
}
|
|
1391
1407
|
}, {
|
|
1392
|
-
key: "
|
|
1393
|
-
value: function
|
|
1408
|
+
key: "flushReadyQueue",
|
|
1409
|
+
value: function flushReadyQueue() {
|
|
1394
1410
|
this.readyQueue.forEach(function (cb) {
|
|
1395
1411
|
cb();
|
|
1396
1412
|
});
|
|
@@ -1399,6 +1415,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1399
1415
|
}, {
|
|
1400
1416
|
key: "afterReady",
|
|
1401
1417
|
value: function afterReady(cb) {
|
|
1418
|
+
if (!this.mounted) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1402
1421
|
if (this.isReady) {
|
|
1403
1422
|
cb();
|
|
1404
1423
|
} else {
|
|
@@ -1510,7 +1529,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1510
1529
|
};
|
|
1511
1530
|
})
|
|
1512
1531
|
})).then(function (res) {
|
|
1513
|
-
if (id !== _this6.requestId) {
|
|
1532
|
+
if (!_this6.mounted || id !== _this6.requestId) {
|
|
1514
1533
|
return;
|
|
1515
1534
|
}
|
|
1516
1535
|
_this6.loadingChange(false);
|
|
@@ -1534,6 +1553,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1534
1553
|
fetchError: undefined
|
|
1535
1554
|
});
|
|
1536
1555
|
}).catch(function (err) {
|
|
1556
|
+
if (!_this6.mounted) {
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1537
1559
|
_this6.store.setState({
|
|
1538
1560
|
fetchError: err
|
|
1539
1561
|
});
|
|
@@ -42,7 +42,10 @@ var locale = {
|
|
|
42
42
|
addFieldText: 'Add Field',
|
|
43
43
|
idTooltip: 'Custom column name is not allowed to be the same as the existing field, if the history has been set with the same name field, it does not support export',
|
|
44
44
|
bottomTooltip: 'Note: Formulas only support calculation on numerical columns',
|
|
45
|
-
customColumnNameTextRequired: 'Please enter the custom column name'
|
|
45
|
+
customColumnNameTextRequired: 'Please enter the custom column name',
|
|
46
|
+
customColumnDataFormatTypeText: 'Data Format',
|
|
47
|
+
customColumnDataFormatTypeOptionsNumberText: 'Number',
|
|
48
|
+
customColumnDataFormatTypeOptionsPercentageText: 'Percentage'
|
|
46
49
|
},
|
|
47
50
|
maxWordText: '${headerName} can not exceed ${maxLength} words',
|
|
48
51
|
operationSuccessText: 'Success',
|
|
@@ -39,7 +39,10 @@ var locale = {
|
|
|
39
39
|
addFieldText: 'Tambah bidang',
|
|
40
40
|
idTooltip: 'Nama kolom kustom tidak boleh sama dengan nama kolom yang ada, jika kolom dengan nama duplikat telah diatur maka tidak mendukung ekspor',
|
|
41
41
|
bottomTooltip: 'Catatan: Rumus hanya mendukung perhitungan untuk kolom data numerik',
|
|
42
|
-
customColumnNameTextRequired: 'Silakan masukkan nama kolom kustom'
|
|
42
|
+
customColumnNameTextRequired: 'Silakan masukkan nama kolom kustom',
|
|
43
|
+
customColumnDataFormatTypeText: 'Format data',
|
|
44
|
+
customColumnDataFormatTypeOptionsNumberText: 'Angka',
|
|
45
|
+
customColumnDataFormatTypeOptionsPercentageText: 'Persentase'
|
|
43
46
|
},
|
|
44
47
|
validate: {
|
|
45
48
|
fieldErrorText: 'Bidang ${field} salah dimasukkan'
|
|
@@ -22,6 +22,9 @@ export interface DataGridLocale {
|
|
|
22
22
|
idTooltip: string;
|
|
23
23
|
bottomTooltip: string;
|
|
24
24
|
customColumnNameTextRequired: string;
|
|
25
|
+
customColumnDataFormatTypeText: string;
|
|
26
|
+
customColumnDataFormatTypeOptionsNumberText: string;
|
|
27
|
+
customColumnDataFormatTypeOptionsPercentageText: string;
|
|
25
28
|
};
|
|
26
29
|
maxWordText: string;
|
|
27
30
|
operationSuccessText: string;
|
|
@@ -39,7 +39,10 @@ var locale = {
|
|
|
39
39
|
addFieldText: 'Thêm trường',
|
|
40
40
|
idTooltip: 'Tên cột tùy chỉnh không được trùng với tên cột đã có, nếu cột đã có tên trùng đã được thiết lập thì không hỗ trợ xuất',
|
|
41
41
|
bottomTooltip: 'Lưu ý: Công thức chỉ hỗ trợ tính toán cho cột số liệu',
|
|
42
|
-
customColumnNameTextRequired: 'Vui lòng nhập tên cột tùy chỉnh'
|
|
42
|
+
customColumnNameTextRequired: 'Vui lòng nhập tên cột tùy chỉnh',
|
|
43
|
+
customColumnDataFormatTypeText: 'Định dạng dữ liệu',
|
|
44
|
+
customColumnDataFormatTypeOptionsNumberText: 'Số',
|
|
45
|
+
customColumnDataFormatTypeOptionsPercentageText: 'Phần trăm'
|
|
43
46
|
},
|
|
44
47
|
validate: {
|
|
45
48
|
fieldErrorText: 'Nhập sai trường ${field}'
|
|
@@ -39,7 +39,10 @@ var locale = {
|
|
|
39
39
|
addFieldText: '添加字段',
|
|
40
40
|
idTooltip: '自定义列名不允许和已有字段重复,如果历史已经设置的重名字段不支持导出',
|
|
41
41
|
bottomTooltip: '注:公式仅支持数值列计算',
|
|
42
|
-
customColumnNameTextRequired: '请输入自定义列名'
|
|
42
|
+
customColumnNameTextRequired: '请输入自定义列名',
|
|
43
|
+
customColumnDataFormatTypeText: '数据格式',
|
|
44
|
+
customColumnDataFormatTypeOptionsNumberText: '数值',
|
|
45
|
+
customColumnDataFormatTypeOptionsPercentageText: '百分比'
|
|
43
46
|
},
|
|
44
47
|
validate: {
|
|
45
48
|
fieldErrorText: '${field}输入错误'
|
|
@@ -39,7 +39,10 @@ var locale = {
|
|
|
39
39
|
addFieldText: '添加字段',
|
|
40
40
|
idTooltip: '自定義列名不允許與已有字段重複,如果歷史已經設置的重名字段不支持導出',
|
|
41
41
|
bottomTooltip: '註:公式僅支持數值列計算',
|
|
42
|
-
customColumnNameTextRequired: '請輸入自定義列名'
|
|
42
|
+
customColumnNameTextRequired: '請輸入自定義列名',
|
|
43
|
+
customColumnDataFormatTypeText: '數據格式',
|
|
44
|
+
customColumnDataFormatTypeOptionsNumberText: '數值',
|
|
45
|
+
customColumnDataFormatTypeOptionsPercentageText: '百分比'
|
|
43
46
|
},
|
|
44
47
|
validate: {
|
|
45
48
|
fieldErrorText: '${field}輸入錯誤'
|
|
@@ -258,6 +258,12 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
|
|
|
258
258
|
set: (data: CustomColumnData) => Promise<void> | void;
|
|
259
259
|
get: () => Promise<CustomColumnData | null | undefined> | CustomColumnData | null | undefined;
|
|
260
260
|
};
|
|
261
|
+
/**
|
|
262
|
+
* @description 自定义列额外参数
|
|
263
|
+
*/
|
|
264
|
+
customColumnPanelExtra?: {
|
|
265
|
+
supportSelectDataFormat?: boolean;
|
|
266
|
+
};
|
|
261
267
|
/**
|
|
262
268
|
* @descriptioin 列定制启用汇总
|
|
263
269
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.4.28-alpha.
|
|
3
|
+
"version": "1.4.28-alpha.3",
|
|
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": "fc120ab90b363e45be5b8b4445b21e84ab2e79b2"
|
|
62
62
|
}
|