@lemon-fe/components 1.2.14 → 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, precision]);
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 @@ 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" | "mode" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
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;
@@ -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'
@@ -16,7 +16,9 @@ var locale = {
16
16
  noPin: '不固定',
17
17
  expandAll: '展开所有',
18
18
  collapseAll: '折叠所有',
19
- columns: '列'
19
+ columns: '列',
20
+ sortAscending: '正序',
21
+ sortDescending: '逆序'
20
22
  },
21
23
  pagination: {
22
24
  totalText: '共${total}条'
@@ -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.14",
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": "3ed306d1094065aa0788bb39e4db7d617eddea5b"
70
+ "gitHead": "8007cb827f9cc7ddbe3d8f29b1e76461027dcc73"
71
71
  }