@lemon-fe/components 1.4.28-alpha.1 → 1.4.28-alpha.2
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.js +10 -3
- 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.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
|
});
|
|
@@ -1297,8 +1298,14 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1297
1298
|
if (params.value !== undefined && params.value !== null) {
|
|
1298
1299
|
var val = params.value;
|
|
1299
1300
|
if (typeof val === 'number' || BigNumber.isBigNumber(val)) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1301
|
+
if (field.dataFormatType === 'percentage' && expressionSuffix !== '%') {
|
|
1302
|
+
var _field$decimalPlaces;
|
|
1303
|
+
val = new BigNumber(val).multipliedBy(100).toFixed((_field$decimalPlaces = field.decimalPlaces) !== null && _field$decimalPlaces !== void 0 ? _field$decimalPlaces : 2);
|
|
1304
|
+
return "".concat(val, "%").concat(expressionSuffix);
|
|
1305
|
+
} else {
|
|
1306
|
+
var _field$decimalPlaces2;
|
|
1307
|
+
val = new BigNumber(val).toFixed((_field$decimalPlaces2 = field.decimalPlaces) !== null && _field$decimalPlaces2 !== void 0 ? _field$decimalPlaces2 : 2);
|
|
1308
|
+
}
|
|
1302
1309
|
}
|
|
1303
1310
|
return "".concat(val).concat(expressionSuffix);
|
|
1304
1311
|
}
|
|
@@ -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.2",
|
|
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": "ab72bcf9c66072be25cadc0a50ab44c17cc78ec5"
|
|
62
62
|
}
|