@lemon-fe/components 1.4.8 → 1.4.9-alpha.1

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.
@@ -17,6 +17,7 @@ import { Checkbox, Form, Input, Modal, Select } from 'antd';
17
17
  import React, { useEffect, useMemo, useRef, useState } from 'react';
18
18
  import FormLayout from "../../../form-layout";
19
19
  import Icons from "../../../icons";
20
+ import InputNumber from "../../../input-number";
20
21
  import { useLocaleReceiver } from "../../../locale-receiver";
21
22
  import TipMark from "../../../tip-mark";
22
23
  import { isCustomField, prefix } from "../../utils";
@@ -111,13 +112,16 @@ export default function FieldModal(props) {
111
112
  name: '',
112
113
  expression: '',
113
114
  summary: false,
114
- summaryType: 1
115
+ summaryType: 1,
116
+ decimalPlaces: 2
115
117
  });
116
118
  }
117
119
  } else {
120
+ var _openProp$decimalPlac;
118
121
  setOpen(true);
119
122
  form.setFieldsValue(_objectSpread(_objectSpread({}, openProp), {}, {
120
- expression: formatExpression(openProp.expression)
123
+ expression: formatExpression(openProp.expression),
124
+ decimalPlaces: (_openProp$decimalPlac = openProp.decimalPlaces) !== null && _openProp$decimalPlac !== void 0 ? _openProp$decimalPlac : 2
121
125
  }));
122
126
  }
123
127
  } else {
@@ -185,10 +189,17 @@ export default function FieldModal(props) {
185
189
  }, /*#__PURE__*/React.createElement(Input.TextArea, {
186
190
  ref: ref,
187
191
  maxLength: 300,
188
- showCount: true,
189
192
  style: {
190
193
  height: 120
191
- }
194
+ },
195
+ placeholder: fieldModal.customColumnExpressionPlaceholder
196
+ })), /*#__PURE__*/React.createElement(Form.Item, {
197
+ label: fieldModal.customColumnDecimalPlacesText,
198
+ name: "decimalPlaces"
199
+ }, /*#__PURE__*/React.createElement(InputNumber, {
200
+ min: 0,
201
+ max: 10,
202
+ precision: 0
192
203
  })), enableSummary ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
193
204
  label: " ",
194
205
  name: "summary",
@@ -24,4 +24,5 @@ export type FieldCol = {
24
24
  expression: string;
25
25
  id: string;
26
26
  name: string;
27
+ decimalPlaces?: number;
27
28
  };
@@ -1197,7 +1197,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1197
1197
  if (params.value !== undefined && params.value !== null) {
1198
1198
  var val = params.value;
1199
1199
  if (typeof val === 'number' || BigNumber.isBigNumber(val)) {
1200
- val = new BigNumber(val).dp(2);
1200
+ var _field$decimalPlaces;
1201
+ val = new BigNumber(val).toFixed((_field$decimalPlaces = field.decimalPlaces) !== null && _field$decimalPlaces !== void 0 ? _field$decimalPlaces : 2);
1201
1202
  }
1202
1203
  return "".concat(val).concat(expressionSuffix);
1203
1204
  }
@@ -30,6 +30,8 @@ var locale = {
30
30
  addCustomColumnText: 'Add Custom Column',
31
31
  customColumnNameText: 'Name',
32
32
  customColumnExpressionText: 'Expression',
33
+ customColumnExpressionPlaceholder: 'Custom Expression length limit of 300',
34
+ customColumnDecimalPlacesText: 'Decimal places',
33
35
  summaryText: 'Summary or not',
34
36
  summaryTypeText: 'Rule',
35
37
  summaryTypeContentText: "\n <div>\n <p>1. The sum of custom column data values to get the total value</p>\n <p>\n 2. The total value is calculated based on the formula from the data source\n <br />\n Fields added in the formula are summed first, then the total is calculated based on the formula\n </p>\n </div>\n ",
@@ -9,6 +9,8 @@ export interface DataGridLocale {
9
9
  addCustomColumnText: string;
10
10
  customColumnNameText: string;
11
11
  customColumnExpressionText: string;
12
+ customColumnExpressionPlaceholder: string;
13
+ customColumnDecimalPlacesText: string;
12
14
  summaryText: string;
13
15
  summaryTypeText: string;
14
16
  summaryTypeContentText: string;
@@ -27,6 +27,8 @@ var locale = {
27
27
  addCustomColumnText: '添加自定义列',
28
28
  customColumnNameText: '自定义列名',
29
29
  customColumnExpressionText: '自定义公式',
30
+ customColumnExpressionPlaceholder: '自定义公式长度上限300',
31
+ customColumnDecimalPlacesText: '小数位数',
30
32
  summaryText: '是否统计合计',
31
33
  summaryTypeText: '合计规则',
32
34
  summaryTypeContentText: "\n <div>\n <p>1\u3001\u81EA\u5B9A\u4E49\u5217\u6570\u636E\u503C\u6C42\u548C\u5F97\u51FA\u5408\u8BA1\u503C</p>\n <p>\n 2\u3001\u6570\u636E\u6E90\u6839\u636E\u8BA1\u7B97\u516C\u5F0F\u5F97\u51FA\u5408\u8BA1\u503C\n <br />\n \u516C\u5F0F\u4E2D\u6DFB\u52A0\u7684\u5B57\u6BB5\u5148\u6C42\u548C\uFF0C\u518D\u6839\u636E\u8BA1\u7B97\u516C\u5F0F\u8BA1\u7B97\u51FA\u5408\u8BA1\n </p>\n </div>\n ",
@@ -14,6 +14,9 @@ import { default as SelectPanelLocale } from "../select-panel/locale/en_US";
14
14
  import { default as SelectViewLocale } from "../select-view/locale/en_US";
15
15
  import { default as SiderTreeLocale } from "../sider-tree/locale/en_US";
16
16
  var enUS = _objectSpread(_objectSpread({}, antEnUS), {}, {
17
+ Select: _objectSpread(_objectSpread({}, antEnUS.Select), {}, {
18
+ copy: 'Copy'
19
+ }),
17
20
  Filter: Filter,
18
21
  BaseTable: BaseTable,
19
22
  ColorPicker: ColorPickerLocale,
@@ -14,6 +14,9 @@ import { default as SelectPanelLocale } from "../select-panel/locale/zh_CN";
14
14
  import { default as SelectViewLocale } from "../select-view/locale/zh_CN";
15
15
  import { default as SiderTreeLocale } from "../sider-tree/locale/zh_CN";
16
16
  var zhCN = _objectSpread(_objectSpread({}, antZhCN), {}, {
17
+ Select: _objectSpread(_objectSpread({}, antZhCN.Select), {}, {
18
+ copy: '复制'
19
+ }),
17
20
  Filter: Filter,
18
21
  BaseTable: BaseTable,
19
22
  ColorPicker: ColorPickerLocale,
@@ -1,2 +1,3 @@
1
- import { Select } from 'antd';
1
+ import { Select as AntdSelect } from 'antd';
2
+ declare const Select: typeof AntdSelect;
2
3
  export default Select;
@@ -1,19 +1,62 @@
1
- import { Select } from 'antd';
2
- import React from 'react';
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ import { Select as AntdSelect, ConfigProvider } from 'antd';
9
+ import React, { forwardRef, useContext, useRef } from 'react';
10
+ import Dropdown from "../dropdown";
3
11
  import Empty from "../empty";
4
12
  import Icons from "../icons";
5
- import { mergeDefaultProps } from "../utils";
6
- mergeDefaultProps(Select, {
7
- notFoundContent: /*#__PURE__*/React.createElement(Empty, {
8
- imageStyle: {
9
- height: 60
10
- }
11
- }),
12
- suffixIcon: /*#__PURE__*/React.createElement(Icons.Down, {
13
+ import { useLocaleReceiver } from "../locale-receiver";
14
+ function InternalSelect(props, ref) {
15
+ var wrapper = useRef(null);
16
+ var _useContext = useContext(ConfigProvider.ConfigContext),
17
+ getPrefixCls = _useContext.getPrefixCls;
18
+ var _useLocaleReceiver = useLocaleReceiver('Select'),
19
+ _useLocaleReceiver2 = _slicedToArray(_useLocaleReceiver, 1),
20
+ locale = _useLocaleReceiver2[0];
21
+ var selector = /*#__PURE__*/React.createElement(AntdSelect, _extends({
22
+ notFoundContent: /*#__PURE__*/React.createElement(Empty, {
23
+ imageStyle: {
24
+ height: 60
25
+ }
26
+ }),
27
+ suffixIcon: !props.loading ? /*#__PURE__*/React.createElement(Icons.Down, {
28
+ style: {
29
+ pointerEvents: 'none'
30
+ }
31
+ }) : undefined,
32
+ clearIcon: Icons.Clear
33
+ }, props, {
34
+ ref: ref
35
+ }));
36
+ if (props.mode === 'tags' || props.mode === 'multiple') {
37
+ return selector;
38
+ }
39
+ return /*#__PURE__*/React.createElement(Dropdown, {
40
+ menu: {
41
+ items: [{
42
+ label: locale.copy,
43
+ onClick: function onClick() {
44
+ var _wrapper$current;
45
+ navigator.clipboard.writeText(((_wrapper$current = wrapper.current) === null || _wrapper$current === void 0 || (_wrapper$current = _wrapper$current.querySelector(".".concat(getPrefixCls('select-selection-item')))) === null || _wrapper$current === void 0 ? void 0 : _wrapper$current.title) || '');
46
+ },
47
+ key: 'copy'
48
+ }]
49
+ },
50
+ trigger: 'contextMenu'
51
+ }, /*#__PURE__*/React.createElement("div", {
13
52
  style: {
14
- pointerEvents: 'none'
15
- }
16
- }),
17
- clearIcon: /*#__PURE__*/React.createElement(Icons.Clear, null)
18
- });
53
+ display: 'contents'
54
+ },
55
+ ref: wrapper
56
+ }, selector));
57
+ }
58
+ InternalSelect.SECRET_COMBOBOX_MODE_DO_NOT_USE = AntdSelect.SECRET_COMBOBOX_MODE_DO_NOT_USE;
59
+ InternalSelect.Option = AntdSelect.Option;
60
+ InternalSelect.OptGroup = AntdSelect.OptGroup;
61
+ var Select = /*#__PURE__*/forwardRef(InternalSelect);
19
62
  export default Select;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.4.8",
3
+ "version": "1.4.9-alpha.1",
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": "5efd8dc6fe627450229c376bea96040c882ac430"
61
+ "gitHead": "a5843273e71e5caec8fcad445ef7ee5355b14727"
62
62
  }