@lemon-fe/components 1.2.14 → 1.2.16
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/cell-editors/number.js +1 -4
- package/es/data-grid/cell-editors/select.d.ts +1 -1
- package/es/data-grid/index.d.ts +1 -1
- package/es/data-grid/index.js +36 -10
- package/es/data-grid/locale/en_US.js +3 -1
- package/es/data-grid/locale/zh_CN.js +3 -1
- package/es/data-grid/renderer/header-renderer.js +0 -1
- package/es/select-view/index.d.ts +8 -0
- package/es/select-view/index.js +9 -6
- package/package.json +2 -2
|
@@ -98,11 +98,8 @@ export default /*#__PURE__*/forwardRef(function NumberEditor(props, ref) {
|
|
|
98
98
|
} else {
|
|
99
99
|
val = value;
|
|
100
100
|
}
|
|
101
|
-
if (precision !== undefined) {
|
|
102
|
-
return Math.round(val * Math.pow(10, precision)) / Math.pow(10, precision);
|
|
103
|
-
}
|
|
104
101
|
return val;
|
|
105
|
-
}, [value
|
|
102
|
+
}, [value]);
|
|
106
103
|
return /*#__PURE__*/React.createElement(EditorWrapper, null, /*#__PURE__*/React.createElement("input", {
|
|
107
104
|
type: "number",
|
|
108
105
|
onKeyDown: function onKeyDown(e) {
|
|
@@ -16,7 +16,7 @@ export declare type SelectEditorParams = Pick<SelectProps<any, BaseOptionType>,
|
|
|
16
16
|
*/
|
|
17
17
|
action?: 'next' | 'stop' | 'none';
|
|
18
18
|
};
|
|
19
|
-
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & Pick<SelectProps<any, BaseOptionType>, "disabled" | "
|
|
19
|
+
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & Pick<SelectProps<any, BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
|
|
20
20
|
fieldNames?: {
|
|
21
21
|
label: string;
|
|
22
22
|
value: string;
|
package/es/data-grid/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const Editors: {
|
|
|
16
16
|
Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
17
17
|
Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
18
18
|
Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
19
|
-
Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "
|
|
19
|
+
Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
|
|
20
20
|
fieldNames?: {
|
|
21
21
|
label: string;
|
|
22
22
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -73,9 +73,10 @@ import { Parser } from 'expr-eval';
|
|
|
73
73
|
import { get, set } from 'lodash';
|
|
74
74
|
import memoizeOne from 'memoize-one';
|
|
75
75
|
import shallowEqual from 'shallowequal';
|
|
76
|
+
var fieldSuffix = /(%)$/;
|
|
76
77
|
function toNumber(a) {
|
|
77
78
|
if (typeof a === 'string') {
|
|
78
|
-
return a.replace(/,/g, '');
|
|
79
|
+
return a.replace(/,/g, '').replace(fieldSuffix, '');
|
|
79
80
|
}
|
|
80
81
|
return a;
|
|
81
82
|
}
|
|
@@ -188,7 +189,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
188
189
|
_defineProperty(_assertThisInitialized(_this), "searchRef", /*#__PURE__*/createRef());
|
|
189
190
|
_defineProperty(_assertThisInitialized(_this), "prevFocusedCell", null);
|
|
190
191
|
_defineProperty(_assertThisInitialized(_this), "fields", []);
|
|
191
|
-
_defineProperty(_assertThisInitialized(_this), "fieldSuffix",
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "fieldSuffix", fieldSuffix);
|
|
192
193
|
_defineProperty(_assertThisInitialized(_this), "customColumnData", null);
|
|
193
194
|
_defineProperty(_assertThisInitialized(_this), "getFieldsSummary", memoizeOne(function (dataSource, fields) {
|
|
194
195
|
var summaryField = fields.filter(function (field) {
|
|
@@ -333,6 +334,39 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
333
334
|
desc: _this.props.emptyText
|
|
334
335
|
});
|
|
335
336
|
});
|
|
337
|
+
_defineProperty(_assertThisInitialized(_this), "getMainMenuItems", function (params) {
|
|
338
|
+
var def = params.column.getColDef();
|
|
339
|
+
if (def.sortable) {
|
|
340
|
+
var sort = params.column.getSort();
|
|
341
|
+
var colId = params.column.getColId();
|
|
342
|
+
return [{
|
|
343
|
+
name: _this.props.locale.localeText.sortAscending,
|
|
344
|
+
disabled: sort === 'asc',
|
|
345
|
+
icon: '<span class="ag-icon ag-icon-asc" unselectable="on" role="presentation"></span>',
|
|
346
|
+
action: function action() {
|
|
347
|
+
params.columnApi.applyColumnState({
|
|
348
|
+
state: [{
|
|
349
|
+
colId: colId,
|
|
350
|
+
sort: 'asc'
|
|
351
|
+
}]
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}, {
|
|
355
|
+
name: _this.props.locale.localeText.sortDescending,
|
|
356
|
+
disabled: sort === 'desc',
|
|
357
|
+
icon: '<span class="ag-icon ag-icon-desc" unselectable="on" role="presentation"></span>',
|
|
358
|
+
action: function action() {
|
|
359
|
+
params.columnApi.applyColumnState({
|
|
360
|
+
state: [{
|
|
361
|
+
colId: colId,
|
|
362
|
+
sort: 'desc'
|
|
363
|
+
}]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}, 'separator'].concat(_toConsumableArray(params.defaultItems));
|
|
367
|
+
}
|
|
368
|
+
return params.defaultItems;
|
|
369
|
+
});
|
|
336
370
|
_defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
|
|
337
371
|
var rowKey = _this.props.rowKey;
|
|
338
372
|
var result = typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
|
|
@@ -1390,14 +1424,6 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1390
1424
|
}
|
|
1391
1425
|
});
|
|
1392
1426
|
}
|
|
1393
|
-
}, {
|
|
1394
|
-
key: "getMainMenuItems",
|
|
1395
|
-
value: function getMainMenuItems(params) {
|
|
1396
|
-
if (params.defaultItems.includes('pinSubMenu')) {
|
|
1397
|
-
return params.defaultItems;
|
|
1398
|
-
}
|
|
1399
|
-
return ['pinSubMenu', 'separator'].concat(_toConsumableArray(params.defaultItems));
|
|
1400
|
-
}
|
|
1401
1427
|
}, {
|
|
1402
1428
|
key: "getFieldErrMessage",
|
|
1403
1429
|
value: function getFieldErrMessage(err, field) {
|
|
@@ -16,7 +16,9 @@ var locale = {
|
|
|
16
16
|
noPin: 'No Pin',
|
|
17
17
|
expandAll: 'Expand All Row Groups',
|
|
18
18
|
collapseAll: 'Close All Row Groups',
|
|
19
|
-
columns: 'Columns'
|
|
19
|
+
columns: 'Columns',
|
|
20
|
+
sortAscending: 'Sort Ascending',
|
|
21
|
+
sortDescending: 'Sort Descending'
|
|
20
22
|
},
|
|
21
23
|
pagination: {
|
|
22
24
|
totalText: 'Total ${total} items'
|
|
@@ -21,7 +21,6 @@ var UpIcon = function UpIcon(props) {
|
|
|
21
21
|
width: 8,
|
|
22
22
|
height: 5
|
|
23
23
|
}), /*#__PURE__*/React.createElement("path", {
|
|
24
|
-
fill: "currentColor",
|
|
25
24
|
fillRule: "nonzero",
|
|
26
25
|
d: "M.641 3.227a.75.75 0 0 0 1.06 1.06L4 1.99l2.298 2.298a.75.75 0 0 0 .984.067l.077-.067a.75.75 0 0 0 0-1.061L4.53.399a.75.75 0 0 0-1.06 0L.64 3.227Z",
|
|
27
26
|
opacity: "1"
|
|
@@ -77,5 +77,13 @@ export interface SelectViewProps<RecordType, ParamsType> extends Pick<DataGridPr
|
|
|
77
77
|
* @default null
|
|
78
78
|
*/
|
|
79
79
|
header?: ReactElement | null;
|
|
80
|
+
/**
|
|
81
|
+
* @description 自定义已选择datagrid
|
|
82
|
+
*/
|
|
83
|
+
customSelectedGridProps?: DataGridProps<RecordType>;
|
|
84
|
+
/**
|
|
85
|
+
* @description 自定义主datagrid
|
|
86
|
+
*/
|
|
87
|
+
customDataGridProps?: DataGridProps<RecordType>;
|
|
80
88
|
}
|
|
81
89
|
export default function SelectView<RecordType extends Record<string | number, any>, ParamsType extends Record<string, any>>(originalProps: SelectViewProps<RecordType, ParamsType>): JSX.Element;
|
package/es/select-view/index.js
CHANGED
|
@@ -59,7 +59,9 @@ export default function SelectView(originalProps) {
|
|
|
59
59
|
_props$suppressRowCli = props.suppressRowClickSelection,
|
|
60
60
|
suppressRowClickSelection = _props$suppressRowCli === void 0 ? false : _props$suppressRowCli,
|
|
61
61
|
_props$rowMultiSelect = props.rowMultiSelectWithClick,
|
|
62
|
-
rowMultiSelectWithClick = _props$rowMultiSelect === void 0 ? true : _props$rowMultiSelect
|
|
62
|
+
rowMultiSelectWithClick = _props$rowMultiSelect === void 0 ? true : _props$rowMultiSelect,
|
|
63
|
+
customSelectedGridProps = props.customSelectedGridProps,
|
|
64
|
+
customDataGridProps = props.customDataGridProps;
|
|
63
65
|
var prefix = prefixClassName("select-view");
|
|
64
66
|
var _useState = useState(value || emptyValue),
|
|
65
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -229,7 +231,7 @@ export default function SelectView(originalProps) {
|
|
|
229
231
|
className: prefix('head')
|
|
230
232
|
}, headerNode), /*#__PURE__*/React.createElement("div", {
|
|
231
233
|
className: prefix('body')
|
|
232
|
-
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
234
|
+
}, /*#__PURE__*/React.createElement(DataGrid, _extends({
|
|
233
235
|
ref: list,
|
|
234
236
|
rowKey: rowKey,
|
|
235
237
|
rowSelection: {
|
|
@@ -257,7 +259,7 @@ export default function SelectView(originalProps) {
|
|
|
257
259
|
fetch: request,
|
|
258
260
|
pagination: pagination,
|
|
259
261
|
customColumnPanelStorage: customColumnPanelStorage
|
|
260
|
-
}))));
|
|
262
|
+
}, customDataGridProps)))));
|
|
261
263
|
};
|
|
262
264
|
var renderSelected = function renderSelected() {
|
|
263
265
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -266,7 +268,7 @@ export default function SelectView(originalProps) {
|
|
|
266
268
|
className: prefix('main')
|
|
267
269
|
}, /*#__PURE__*/React.createElement("div", {
|
|
268
270
|
className: prefix('body')
|
|
269
|
-
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
271
|
+
}, /*#__PURE__*/React.createElement(DataGrid, _extends({
|
|
270
272
|
dataSource: data,
|
|
271
273
|
defaultColDef: defaultColDef,
|
|
272
274
|
rowHeight: rowHeight,
|
|
@@ -282,13 +284,14 @@ export default function SelectView(originalProps) {
|
|
|
282
284
|
data: data,
|
|
283
285
|
dataKeys: dataKeys
|
|
284
286
|
}
|
|
285
|
-
}))));
|
|
287
|
+
}, customSelectedGridProps)))));
|
|
286
288
|
};
|
|
287
289
|
if (readOnly) {
|
|
288
290
|
content = renderSelected();
|
|
289
291
|
} else if (!multiple) {
|
|
290
292
|
content = renderList();
|
|
291
293
|
} else {
|
|
294
|
+
var _customSelectedGridPr, _customSelectedGridPr2;
|
|
292
295
|
content = /*#__PURE__*/React.createElement(Tabs, {
|
|
293
296
|
items: [{
|
|
294
297
|
key: 'list',
|
|
@@ -297,7 +300,7 @@ export default function SelectView(originalProps) {
|
|
|
297
300
|
}, {
|
|
298
301
|
key: 'selected',
|
|
299
302
|
label: parseLocalTemplate(SelectViewLocale.selectedDataText, {
|
|
300
|
-
length: data.length
|
|
303
|
+
length: (_customSelectedGridPr = customSelectedGridProps === null || customSelectedGridProps === void 0 || (_customSelectedGridPr2 = customSelectedGridProps.dataSource) === null || _customSelectedGridPr2 === void 0 ? void 0 : _customSelectedGridPr2.length) !== null && _customSelectedGridPr !== void 0 ? _customSelectedGridPr : data.length
|
|
301
304
|
}),
|
|
302
305
|
children: renderSelected()
|
|
303
306
|
}],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://registry.npmjs.org"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "37caaf402464a0549212f7f485de34103b53694f"
|
|
71
71
|
}
|