@lemon-fe/components 1.4.27-alpha.0 → 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 +3 -0
- package/es/data-grid/components/custom-panel/field-modal.js +20 -5
- package/es/data-grid/components/custom-panel/index.d.ts +5 -0
- package/es/data-grid/components/custom-panel/index.js +10 -3
- 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 +11 -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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { DataGridLocale } from '../../locale/locale';
|
|
2
3
|
import type { FieldCol, Node } from './typings';
|
|
3
4
|
import type { ColGroupDef } from 'ag-grid-community';
|
|
4
5
|
interface Props {
|
|
@@ -8,6 +9,8 @@ interface Props {
|
|
|
8
9
|
onOk: (field: FieldCol) => void;
|
|
9
10
|
nodes: Node[];
|
|
10
11
|
groups: ColGroupDef[];
|
|
12
|
+
locale?: DataGridLocale;
|
|
13
|
+
supportSelectDataFormat?: boolean;
|
|
11
14
|
}
|
|
12
15
|
export default function FieldModal(props: Props): JSX.Element;
|
|
13
16
|
export {};
|
|
@@ -27,7 +27,9 @@ export default function FieldModal(props) {
|
|
|
27
27
|
nodes = props.nodes,
|
|
28
28
|
onOk = props.onOk,
|
|
29
29
|
enableSummary = props.enableSummary,
|
|
30
|
-
groups = props.groups
|
|
30
|
+
groups = props.groups,
|
|
31
|
+
locale = props.locale,
|
|
32
|
+
supportSelectDataFormat = props.supportSelectDataFormat;
|
|
31
33
|
var _useState = useState(false),
|
|
32
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
35
|
open = _useState2[0],
|
|
@@ -115,23 +117,25 @@ export default function FieldModal(props) {
|
|
|
115
117
|
summary: false,
|
|
116
118
|
summaryType: 1,
|
|
117
119
|
decimalPlaces: 2,
|
|
118
|
-
groupId: undefined
|
|
120
|
+
groupId: undefined,
|
|
121
|
+
dataFormatType: 'number'
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
} else {
|
|
122
|
-
var _openProp$decimalPlac;
|
|
125
|
+
var _openProp$decimalPlac, _openProp$dataFormatT;
|
|
123
126
|
setOpen(true);
|
|
124
127
|
form.setFieldsValue(_objectSpread(_objectSpread({}, openProp), {}, {
|
|
125
128
|
expression: formatExpression(openProp.expression),
|
|
126
129
|
decimalPlaces: (_openProp$decimalPlac = openProp.decimalPlaces) !== null && _openProp$decimalPlac !== void 0 ? _openProp$decimalPlac : 2,
|
|
127
|
-
groupId: openProp.groupId
|
|
130
|
+
groupId: openProp.groupId,
|
|
131
|
+
dataFormatType: (_openProp$dataFormatT = openProp.dataFormatType) !== null && _openProp$dataFormatT !== void 0 ? _openProp$dataFormatT : 'number'
|
|
128
132
|
}));
|
|
129
133
|
}
|
|
130
134
|
} else {
|
|
131
135
|
setOpen(false);
|
|
132
136
|
}
|
|
133
137
|
}, [openProp]);
|
|
134
|
-
var _useLocaleReceiver = useLocaleReceiver('DataGrid'),
|
|
138
|
+
var _useLocaleReceiver = useLocaleReceiver('DataGrid', locale),
|
|
135
139
|
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
136
140
|
fieldModal = _useLocaleReceiver2[0].fieldModal;
|
|
137
141
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
@@ -234,6 +238,17 @@ export default function FieldModal(props) {
|
|
|
234
238
|
height: 120
|
|
235
239
|
},
|
|
236
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
|
+
}]
|
|
237
252
|
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
238
253
|
label: fieldModal.customColumnDecimalPlacesText,
|
|
239
254
|
name: "decimalPlaces"
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { DataGridLocale } from '../../locale/locale';
|
|
2
3
|
import type { IToolPanelParams } from 'ag-grid-community';
|
|
3
4
|
export default function CustomColumnPanel(params: IToolPanelParams & {
|
|
4
5
|
enableSave: boolean;
|
|
5
6
|
enableSummary: boolean;
|
|
7
|
+
locale?: DataGridLocale;
|
|
8
|
+
customColumnPanelExtra?: {
|
|
9
|
+
supportSelectDataFormat?: boolean;
|
|
10
|
+
};
|
|
6
11
|
}): JSX.Element;
|
|
@@ -29,7 +29,9 @@ export default function CustomColumnPanel(params) {
|
|
|
29
29
|
var columnApi = params.columnApi,
|
|
30
30
|
api = params.api,
|
|
31
31
|
enableSave = params.enableSave,
|
|
32
|
-
enableSummary = params.enableSummary
|
|
32
|
+
enableSummary = params.enableSummary,
|
|
33
|
+
locale = params.locale,
|
|
34
|
+
customColumnPanelExtra = params.customColumnPanelExtra;
|
|
33
35
|
var _useState = useState(false),
|
|
34
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
37
|
searching = _useState2[0],
|
|
@@ -54,7 +56,10 @@ export default function CustomColumnPanel(params) {
|
|
|
54
56
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
55
57
|
keywords = _useState12[0],
|
|
56
58
|
setKeywords = _useState12[1];
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* TODO: 需要优化上下文传递与获取方式
|
|
61
|
+
*/
|
|
62
|
+
var _useLocaleReceiver = useLocaleReceiver('DataGrid', locale),
|
|
58
63
|
_useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
|
|
59
64
|
dataGridLocale = _useLocaleReceiver2[0];
|
|
60
65
|
var listContainer = useRef(null);
|
|
@@ -415,6 +420,8 @@ export default function CustomColumnPanel(params) {
|
|
|
415
420
|
},
|
|
416
421
|
onOk: function onOk(value) {
|
|
417
422
|
grid.setField(value);
|
|
418
|
-
}
|
|
423
|
+
},
|
|
424
|
+
locale: locale,
|
|
425
|
+
supportSelectDataFormat: customColumnPanelExtra === null || customColumnPanelExtra === void 0 ? void 0 : customColumnPanelExtra.supportSelectDataFormat
|
|
419
426
|
}));
|
|
420
427
|
}
|
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" | "allowClear" | "mode" | "showSearch" | "virtual" | "optionFilterProp" | "options" | "listHeight"> & {
|
|
21
21
|
fieldNames?: {
|
|
22
22
|
label: string;
|
|
23
23
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -179,7 +179,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
179
179
|
toolPanel: CustomColumnPanel,
|
|
180
180
|
toolPanelParams: {
|
|
181
181
|
enableSave: !!_this.props.customColumnPanelStorage,
|
|
182
|
-
enableSummary: _this.isClientMode() || _this.props.enableCustomColumnSummary
|
|
182
|
+
enableSummary: _this.isClientMode() || _this.props.enableCustomColumnSummary,
|
|
183
|
+
locale: _this.props.locale,
|
|
184
|
+
customColumnPanelExtra: _this.props.customColumnPanelExtra
|
|
183
185
|
}
|
|
184
186
|
}]
|
|
185
187
|
});
|
|
@@ -1296,8 +1298,14 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1296
1298
|
if (params.value !== undefined && params.value !== null) {
|
|
1297
1299
|
var val = params.value;
|
|
1298
1300
|
if (typeof val === 'number' || BigNumber.isBigNumber(val)) {
|
|
1299
|
-
|
|
1300
|
-
|
|
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
|
+
}
|
|
1301
1309
|
}
|
|
1302
1310
|
return "".concat(val).concat(expressionSuffix);
|
|
1303
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.
|
|
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
|
}
|