@lemon-fe/components 1.2.13 → 1.2.15
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.
|
@@ -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) {
|
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
|
@@ -50,7 +50,6 @@ import Search from "./components/search";
|
|
|
50
50
|
import Selected from "./components/selected";
|
|
51
51
|
import GridStoreContext from "./context/grid-store";
|
|
52
52
|
import { useGridStore } from "./hooks";
|
|
53
|
-
import defaultLocale from "./locale/zh_CN";
|
|
54
53
|
import { ClipboardModule } from "./modules/clipboard/main";
|
|
55
54
|
import { ColumnsToolPanelModule } from "./modules/column-tool-panel/main";
|
|
56
55
|
import { MasterDetailModule } from "./modules/master-detail/main";
|
|
@@ -74,9 +73,10 @@ import { Parser } from 'expr-eval';
|
|
|
74
73
|
import { get, set } from 'lodash';
|
|
75
74
|
import memoizeOne from 'memoize-one';
|
|
76
75
|
import shallowEqual from 'shallowequal';
|
|
76
|
+
var fieldSuffix = /(%)$/;
|
|
77
77
|
function toNumber(a) {
|
|
78
78
|
if (typeof a === 'string') {
|
|
79
|
-
return a.replace(/,/g, '');
|
|
79
|
+
return a.replace(/,/g, '').replace(fieldSuffix, '');
|
|
80
80
|
}
|
|
81
81
|
return a;
|
|
82
82
|
}
|
|
@@ -126,9 +126,7 @@ function EmptyOverlay(props) {
|
|
|
126
126
|
}
|
|
127
127
|
var defaultProps = {
|
|
128
128
|
stopEditingWhenCellsLoseFocus: true,
|
|
129
|
-
autoLoad: false
|
|
130
|
-
localeText: defaultLocale.localeText,
|
|
131
|
-
locale: defaultLocale
|
|
129
|
+
autoLoad: false
|
|
132
130
|
};
|
|
133
131
|
var SummaryFlag = Symbol('summary');
|
|
134
132
|
var IndexColId = '$$index';
|
|
@@ -191,7 +189,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
191
189
|
_defineProperty(_assertThisInitialized(_this), "searchRef", /*#__PURE__*/createRef());
|
|
192
190
|
_defineProperty(_assertThisInitialized(_this), "prevFocusedCell", null);
|
|
193
191
|
_defineProperty(_assertThisInitialized(_this), "fields", []);
|
|
194
|
-
_defineProperty(_assertThisInitialized(_this), "fieldSuffix",
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "fieldSuffix", fieldSuffix);
|
|
195
193
|
_defineProperty(_assertThisInitialized(_this), "customColumnData", null);
|
|
196
194
|
_defineProperty(_assertThisInitialized(_this), "getFieldsSummary", memoizeOne(function (dataSource, fields) {
|
|
197
195
|
var summaryField = fields.filter(function (field) {
|
|
@@ -235,7 +233,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
235
233
|
if (summary[field.id] === undefined) {
|
|
236
234
|
summary[field.id] = new BigNumber(0);
|
|
237
235
|
}
|
|
238
|
-
summary[field.id] = summary[field.id].plus(result);
|
|
236
|
+
summary[field.id] = summary[field.id].plus(+result);
|
|
239
237
|
});
|
|
240
238
|
});
|
|
241
239
|
return summary;
|
|
@@ -336,6 +334,39 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
336
334
|
desc: _this.props.emptyText
|
|
337
335
|
});
|
|
338
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
|
+
});
|
|
339
370
|
_defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
|
|
340
371
|
var rowKey = _this.props.rowKey;
|
|
341
372
|
var result = typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
|
|
@@ -1393,14 +1424,6 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1393
1424
|
}
|
|
1394
1425
|
});
|
|
1395
1426
|
}
|
|
1396
|
-
}, {
|
|
1397
|
-
key: "getMainMenuItems",
|
|
1398
|
-
value: function getMainMenuItems(params) {
|
|
1399
|
-
if (params.defaultItems.includes('pinSubMenu')) {
|
|
1400
|
-
return params.defaultItems;
|
|
1401
|
-
}
|
|
1402
|
-
return ['pinSubMenu', 'separator'].concat(_toConsumableArray(params.defaultItems));
|
|
1403
|
-
}
|
|
1404
1427
|
}, {
|
|
1405
1428
|
key: "getFieldErrMessage",
|
|
1406
1429
|
value: function getFieldErrMessage(err, field) {
|
|
@@ -1721,10 +1744,10 @@ var DataGrid = /*#__PURE__*/forwardRef(function (originalProps, ref) {
|
|
|
1721
1744
|
dataGridLocale = _useLocaleReceiver4[0];
|
|
1722
1745
|
var props = useComponentDefaultProps('DataGrid', originalProps);
|
|
1723
1746
|
return /*#__PURE__*/React.createElement(InternalDataGrid, _extends({
|
|
1724
|
-
ref: ref
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
}));
|
|
1747
|
+
ref: ref,
|
|
1748
|
+
locale: dataGridLocale,
|
|
1749
|
+
localeText: dataGridLocale.localeText
|
|
1750
|
+
}, props));
|
|
1728
1751
|
});
|
|
1729
1752
|
DataGrid.defaultProps = defaultProps;
|
|
1730
1753
|
DataGrid.SummaryFlag = SummaryFlag;
|
|
@@ -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"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.15",
|
|
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": "8007cb827f9cc7ddbe3d8f29b1e76461027dcc73"
|
|
71
71
|
}
|