@pisell/materials 2.2.28 → 2.2.30
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +19 -19
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +62 -0
- package/es/components/pisellAdjustPrice/index.d.ts +10 -0
- package/es/components/pisellAdjustPrice/index.js +148 -0
- package/es/components/pisellAdjustPrice/index.less +30 -0
- package/es/components/pisellFloatingPanel/index.d.ts +17 -0
- package/es/components/pisellFloatingPanel/index.js +89 -0
- package/es/components/pisellFloatingPanel/index.less +30 -0
- package/es/components/pisellStatisticList/index.d.ts +18 -0
- package/es/components/pisellStatisticList/index.js +67 -0
- package/es/components/pisellStatisticList/index.less +47 -0
- package/es/components/segmented/index.d.ts +1 -0
- package/es/components/segmented/index.js +1 -0
- package/es/components/segmented/index.less +3 -0
- package/es/components/virtual-keyboard/Amount/index.d.ts +22 -0
- package/es/components/virtual-keyboard/Amount/index.js +65 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +22 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +213 -0
- package/es/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
- package/es/components/virtual-keyboard/Keyboard/index.js +59 -15
- package/es/components/virtual-keyboard/Keyboard/index.less +35 -24
- package/es/components/virtual-keyboard/Number/index.d.ts +14 -0
- package/es/components/virtual-keyboard/Number/index.js +35 -0
- package/es/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
- package/es/components/virtual-keyboard/VirtualInput/index.js +41 -0
- package/es/components/virtual-keyboard/VirtualInput/index.less +46 -0
- package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
- package/es/components/virtual-keyboard/VirtualKeyInput/index.js +27 -20
- package/es/index.d.ts +6 -0
- package/es/index.js +7 -1
- package/es/locales/en-US.d.ts +6 -0
- package/es/locales/en-US.js +8 -1
- package/es/locales/zh-CN.d.ts +6 -0
- package/es/locales/zh-CN.js +8 -1
- package/es/locales/zh-TW.d.ts +6 -0
- package/es/locales/zh-TW.js +8 -1
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +84 -0
- package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
- package/lib/components/pisellAdjustPrice/index.js +156 -0
- package/lib/components/pisellAdjustPrice/index.less +30 -0
- package/lib/components/pisellFloatingPanel/index.d.ts +17 -0
- package/lib/components/pisellFloatingPanel/index.js +113 -0
- package/lib/components/pisellFloatingPanel/index.less +30 -0
- package/lib/components/pisellStatisticList/index.d.ts +18 -0
- package/lib/components/pisellStatisticList/index.js +109 -0
- package/lib/components/pisellStatisticList/index.less +47 -0
- package/lib/components/segmented/index.d.ts +1 -0
- package/lib/components/segmented/index.js +1 -0
- package/lib/components/segmented/index.less +3 -0
- package/lib/components/virtual-keyboard/Amount/index.d.ts +22 -0
- package/lib/components/virtual-keyboard/Amount/index.js +96 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +46 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +245 -0
- package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
- package/lib/components/virtual-keyboard/Keyboard/index.js +51 -4
- package/lib/components/virtual-keyboard/Keyboard/index.less +35 -24
- package/lib/components/virtual-keyboard/Number/index.d.ts +14 -0
- package/lib/components/virtual-keyboard/Number/index.js +65 -0
- package/lib/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
- package/lib/components/virtual-keyboard/VirtualInput/index.js +63 -0
- package/lib/components/virtual-keyboard/VirtualInput/index.less +46 -0
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +20 -11
- package/lib/index.d.ts +6 -0
- package/lib/index.js +18 -0
- package/lib/locales/en-US.d.ts +6 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +6 -0
- package/lib/locales/zh-CN.js +8 -1
- package/lib/locales/zh-TW.d.ts +6 -0
- package/lib/locales/zh-TW.js +8 -1
- package/lowcode/input/meta.ts +25 -0
- package/lowcode/pisell-adjust-price/meta.ts +58 -0
- package/lowcode/pisell-adjust-price/snippets.ts +10 -0
- package/lowcode/pisell-adjust-price-input-number/meta.ts +245 -0
- package/lowcode/pisell-floating-panel/meta.ts +232 -0
- package/lowcode/pisell-modal.information/meta.ts +5 -0
- package/lowcode/pisell-number-keyboard/meta.ts +98 -0
- package/lowcode/pisell-price-keyboard/meta.ts +174 -0
- package/lowcode/pisell-statistic-list/meta.ts +264 -0
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputNumberProps } from 'antd/es/input-number';
|
|
3
|
+
export interface PisellAdjustPriceInputNumberProps extends Omit<InputNumberProps, 'onChange'> {
|
|
4
|
+
value?: number;
|
|
5
|
+
originValue: number;
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
onChange?: (val: number) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const PisellAdjustPriceInputNumber: (props: PisellAdjustPriceInputNumberProps) => React.JSX.Element;
|
|
10
|
+
export default PisellAdjustPriceInputNumber;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var _excluded = ["value", "onChange", "originValue", "size", "prefix", "disabled"];
|
|
2
|
+
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); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import React, { useMemo, useState } from 'react';
|
|
12
|
+
import { InputNumber, Popover } from 'antd';
|
|
13
|
+
import PisellAdjustPricePanel from "./index";
|
|
14
|
+
var PisellAdjustPriceInputNumber = function PisellAdjustPriceInputNumber(props) {
|
|
15
|
+
var value = props.value,
|
|
16
|
+
onChange = props.onChange,
|
|
17
|
+
originValue = props.originValue,
|
|
18
|
+
size = props.size,
|
|
19
|
+
prefix = props.prefix,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
open = _useState2[0],
|
|
25
|
+
setOpen = _useState2[1];
|
|
26
|
+
var handleChange = function handleChange(val) {
|
|
27
|
+
setOpen(false);
|
|
28
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(val.toFixed(2)));
|
|
29
|
+
};
|
|
30
|
+
var content = useMemo(function () {
|
|
31
|
+
return /*#__PURE__*/React.createElement(PisellAdjustPricePanel, {
|
|
32
|
+
key: "".concat(open),
|
|
33
|
+
originValue: originValue,
|
|
34
|
+
defaultValue: value,
|
|
35
|
+
value: value,
|
|
36
|
+
onChange: handleChange
|
|
37
|
+
});
|
|
38
|
+
}, [originValue, value, open]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
40
|
+
open: open,
|
|
41
|
+
content: content,
|
|
42
|
+
trigger: ['click'],
|
|
43
|
+
overlayInnerStyle: {
|
|
44
|
+
padding: 0
|
|
45
|
+
},
|
|
46
|
+
onOpenChange: function onOpenChange(val) {
|
|
47
|
+
return setOpen(val);
|
|
48
|
+
},
|
|
49
|
+
destroyTooltipOnHide: true,
|
|
50
|
+
arrow: false,
|
|
51
|
+
align: {
|
|
52
|
+
offset: [0, 20]
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(InputNumber, _extends({}, others, {
|
|
55
|
+
disabled: disabled,
|
|
56
|
+
prefix: prefix,
|
|
57
|
+
size: size || 'large',
|
|
58
|
+
value: value,
|
|
59
|
+
readOnly: true
|
|
60
|
+
}))));
|
|
61
|
+
};
|
|
62
|
+
export default PisellAdjustPriceInputNumber;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface PisellAdjustPriceProps {
|
|
4
|
+
value?: number;
|
|
5
|
+
originValue: number;
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
onChange?: (val: number) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const PisellAdjustPrice: (props: PisellAdjustPriceProps) => React.JSX.Element;
|
|
10
|
+
export default PisellAdjustPrice;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["value", "onChange", "defaultValue", "originValue"];
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import { Segmented } from 'antd';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import PisellText from "../pisellText";
|
|
19
|
+
import Amount from "../virtual-keyboard/Amount";
|
|
20
|
+
import { getText } from "../../locales";
|
|
21
|
+
import "./index.less";
|
|
22
|
+
import usePisellConfig from "../pisell-config-provider/hooks/usePisellConfig";
|
|
23
|
+
var PisellAdjustPrice = function PisellAdjustPrice(props) {
|
|
24
|
+
var value = props.value,
|
|
25
|
+
onChange = props.onChange,
|
|
26
|
+
defaultValue = props.defaultValue,
|
|
27
|
+
originValue = props.originValue,
|
|
28
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
29
|
+
var config = usePisellConfig();
|
|
30
|
+
var _useState = useState(value || 0),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
newValue = _useState2[0],
|
|
33
|
+
setNewValue = _useState2[1];
|
|
34
|
+
|
|
35
|
+
// 一口价或者折扣
|
|
36
|
+
var _useState3 = useState('priceOverride'),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
updateMode = _useState4[0],
|
|
39
|
+
setUpdateMode = _useState4[1];
|
|
40
|
+
|
|
41
|
+
// 折扣模式
|
|
42
|
+
// 折扣模式分为 金额 和 百分比
|
|
43
|
+
var _useState5 = useState('amount'),
|
|
44
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
+
discountMode = _useState6[0],
|
|
46
|
+
setDiscountMode = _useState6[1];
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
document.body.id = 'body';
|
|
49
|
+
}, []);
|
|
50
|
+
var handleEnter = function handleEnter() {
|
|
51
|
+
if (isDiscountError) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 一口价直接取newValue
|
|
56
|
+
if (updateMode === 'priceOverride') {
|
|
57
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(newValue));
|
|
58
|
+
} else {
|
|
59
|
+
// 折扣模式取折扣价格
|
|
60
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(totalAfterDiscount));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var handleChange = function handleChange(val) {
|
|
64
|
+
setNewValue(val);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// 计算折扣后的价格
|
|
68
|
+
var totalAfterDiscount = useMemo(function () {
|
|
69
|
+
if (discountMode === 'amount') {
|
|
70
|
+
return originValue - Number(newValue || 0);
|
|
71
|
+
}
|
|
72
|
+
return originValue - originValue * (Number(newValue || 0) / 100);
|
|
73
|
+
}, [originValue, newValue, discountMode]);
|
|
74
|
+
var isDiscountError = useMemo(function () {
|
|
75
|
+
// 一口价时不展示折扣值
|
|
76
|
+
if (updateMode === 'priceOverride') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
// 折扣模式为金额时 输入金额不能大于原始值
|
|
80
|
+
return totalAfterDiscount < 0;
|
|
81
|
+
}, [updateMode, totalAfterDiscount]);
|
|
82
|
+
var handleUpdateMode = function handleUpdateMode(val) {
|
|
83
|
+
setUpdateMode(val);
|
|
84
|
+
setNewValue(val === 'priceOverride' ? value || 0 : '');
|
|
85
|
+
};
|
|
86
|
+
var inputFormat = function inputFormat(v) {
|
|
87
|
+
if (updateMode === 'priceOverride') {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (discountMode === 'amount') {
|
|
91
|
+
return null;
|
|
92
|
+
} else {
|
|
93
|
+
return "".concat(v, "%");
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "pisell-lowcode-adjust-price-wrap"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Segmented, {
|
|
99
|
+
size: "large",
|
|
100
|
+
options: [{
|
|
101
|
+
label: getText('pisell-adjust-price-price-override'),
|
|
102
|
+
value: 'priceOverride'
|
|
103
|
+
}, {
|
|
104
|
+
label: getText('pisell-adjust-price-discount'),
|
|
105
|
+
value: 'discount'
|
|
106
|
+
}],
|
|
107
|
+
value: updateMode,
|
|
108
|
+
onChange: handleUpdateMode,
|
|
109
|
+
block: true
|
|
110
|
+
}), updateMode === 'discount' && /*#__PURE__*/React.createElement(Segmented, {
|
|
111
|
+
size: "large",
|
|
112
|
+
options: [{
|
|
113
|
+
label: "".concat(getText('pisell-adjust-price-discount-amount'), "(").concat((config === null || config === void 0 ? void 0 : config.symbol) || '$', ")"),
|
|
114
|
+
value: 'amount'
|
|
115
|
+
}, {
|
|
116
|
+
label: "".concat(getText('pisell-adjust-price-discount-percentage'), "(%)"),
|
|
117
|
+
value: 'percentage'
|
|
118
|
+
}],
|
|
119
|
+
value: discountMode,
|
|
120
|
+
onChange: function onChange(val) {
|
|
121
|
+
setNewValue('');
|
|
122
|
+
setDiscountMode(val);
|
|
123
|
+
},
|
|
124
|
+
block: true
|
|
125
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: "pisell-lowcode-adjust-price-amount-wrap"
|
|
127
|
+
}, /*#__PURE__*/React.createElement(Amount, _extends({}, others, {
|
|
128
|
+
inputFormat: inputFormat,
|
|
129
|
+
defaultValue: updateMode === 'priceOverride' ? defaultValue : '',
|
|
130
|
+
key: updateMode,
|
|
131
|
+
value: newValue,
|
|
132
|
+
defaultSelect: updateMode === 'priceOverride',
|
|
133
|
+
onChange: handleChange,
|
|
134
|
+
onEnter: handleEnter,
|
|
135
|
+
placeholder: discountMode === 'amount' ? '0' : '%'
|
|
136
|
+
}))), updateMode === 'discount' && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "pisell-low-code-adjust-price-total"
|
|
138
|
+
}, isDiscountError ? /*#__PURE__*/React.createElement(PisellText.Amount, {
|
|
139
|
+
value: originValue
|
|
140
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, newValue && getText('pisell-adjust-price-total-after-discount'), /*#__PURE__*/React.createElement(PisellText.Amount, {
|
|
141
|
+
value: totalAfterDiscount
|
|
142
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: classNames('pisell-low-code-adjust-price-amount-desc', _defineProperty({}, 'pisell-low-code-adjust-price-amount-desc-error', isDiscountError))
|
|
144
|
+
}, getText('pisell-adjust-price-discount-can-be-maximum'), ' ', discountMode === 'amount' ? /*#__PURE__*/React.createElement(PisellText.Amount, {
|
|
145
|
+
value: originValue
|
|
146
|
+
}) : '100%')));
|
|
147
|
+
};
|
|
148
|
+
export default PisellAdjustPrice;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.pisell-lowcode-adjust-price-wrap {
|
|
2
|
+
width: 380px;
|
|
3
|
+
border-radius: 10px;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
padding: 10px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 10px;
|
|
9
|
+
.pisell-lowcode-adjust-price-amount-wrap {
|
|
10
|
+
padding: 10px;
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
background: var(--Gray-300, #D0D5DD);
|
|
13
|
+
}
|
|
14
|
+
.pisell-low-code-adjust-price-total {
|
|
15
|
+
color: var(--Gray-900, #101828);
|
|
16
|
+
font-size: 20px;
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
line-height: 30px; /* 150% */
|
|
19
|
+
}
|
|
20
|
+
.pisell-low-code-adjust-price-amount-desc {
|
|
21
|
+
color: var(--Gray-500, #667085);
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
line-height: 24px; /* 150% */
|
|
26
|
+
}
|
|
27
|
+
.pisell-low-code-adjust-price-amount-desc-error {
|
|
28
|
+
color: var(--Error-600, #D92D20);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface PisellFloatingPanelProps {
|
|
4
|
+
fullHeight?: string | number;
|
|
5
|
+
retractHeight?: string | number;
|
|
6
|
+
width?: string | number;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
isFloat?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
retractSlot?: React.ReactNode;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
retractIconStyle?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
declare const PisellFloatingPanel: (props: PisellFloatingPanelProps) => React.JSX.Element;
|
|
17
|
+
export default PisellFloatingPanel;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { useUpdateEffect } from "ahooks";
|
|
16
|
+
import Iconfont from "../iconfont";
|
|
17
|
+
import "./index.less";
|
|
18
|
+
var PisellFloatingPanel = function PisellFloatingPanel(props) {
|
|
19
|
+
var _props$defaultOpen = props.defaultOpen,
|
|
20
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
21
|
+
onOpenChange = props.onOpenChange,
|
|
22
|
+
isFloat = props.isFloat,
|
|
23
|
+
open = props.open,
|
|
24
|
+
width = props.width,
|
|
25
|
+
children = props.children,
|
|
26
|
+
retractHeight = props.retractHeight,
|
|
27
|
+
fullHeight = props.fullHeight,
|
|
28
|
+
retractSlot = props.retractSlot,
|
|
29
|
+
propsStyle = props.style,
|
|
30
|
+
retractIconStyle = props.retractIconStyle;
|
|
31
|
+
var _useState = useState(defaultOpen),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isOpen = _useState2[0],
|
|
34
|
+
setIsOpen = _useState2[1];
|
|
35
|
+
useUpdateEffect(function () {
|
|
36
|
+
if (open !== undefined) {
|
|
37
|
+
setIsOpen(open);
|
|
38
|
+
}
|
|
39
|
+
}, [open]);
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
document.body.id = 'body';
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
// 切换面板状态
|
|
45
|
+
var togglePanel = function togglePanel() {
|
|
46
|
+
var newOpenState = !isOpen;
|
|
47
|
+
setIsOpen(newOpenState);
|
|
48
|
+
if (onOpenChange) {
|
|
49
|
+
onOpenChange(newOpenState);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var style = useMemo(function () {
|
|
53
|
+
var height = fullHeight;
|
|
54
|
+
var transform = isOpen ? 'translateY(0)' : "translateY(calc(100% - ".concat(retractHeight, "))");
|
|
55
|
+
if (!isFloat) {
|
|
56
|
+
height = isOpen ? fullHeight : retractHeight;
|
|
57
|
+
transform = 'none';
|
|
58
|
+
}
|
|
59
|
+
return _objectSpread(_objectSpread({}, propsStyle), {}, {
|
|
60
|
+
height: height,
|
|
61
|
+
width: width,
|
|
62
|
+
position: isFloat ? 'fixed' : 'relative',
|
|
63
|
+
bottom: 0,
|
|
64
|
+
transition: '0.3s',
|
|
65
|
+
transform: transform
|
|
66
|
+
});
|
|
67
|
+
}, [fullHeight, isFloat, retractHeight, isOpen, width, propsStyle]);
|
|
68
|
+
var iconType = useMemo(function () {
|
|
69
|
+
if (isOpen) {
|
|
70
|
+
return isFloat ? 'pisell2-chevron-down-double' : 'pisell2-chevron-up-double';
|
|
71
|
+
}
|
|
72
|
+
return isFloat ? 'pisell2-chevron-up-double' : 'pisell2-chevron-down-double';
|
|
73
|
+
}, [isOpen, isFloat]);
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: classNames('pisell-lowcode-floating-panel-wrap', _defineProperty({}, 'pisell-lowcode-floating-panel-wrap-floating', isFloat)),
|
|
76
|
+
style: style
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "pisell-lowcode-floating-panel-header",
|
|
79
|
+
onClick: togglePanel
|
|
80
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "pisell-lowcode-floating-panel-handle"
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
83
|
+
type: iconType,
|
|
84
|
+
style: retractIconStyle
|
|
85
|
+
}))), !isOpen && retractSlot, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "pisell-lowcode-floating-panel-content"
|
|
87
|
+
}, children));
|
|
88
|
+
};
|
|
89
|
+
export default PisellFloatingPanel;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.pisell-lowcode-floating-panel-wrap {
|
|
2
|
+
background-color: #fff;
|
|
3
|
+
border-top-left-radius: 16px;
|
|
4
|
+
border-top-right-radius: 16px;
|
|
5
|
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pisell-lowcode-floating-panel-wrap.pisell-lowcode-floating-panel-wrap-floating {
|
|
12
|
+
position: fixed;
|
|
13
|
+
bottom: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pisell-lowcode-floating-panel-content {
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pisell-lowcode-floating-panel-header {
|
|
23
|
+
padding: 10px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 32px;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface PisellStatisticListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
backgroundColors?: string[];
|
|
5
|
+
labelColor?: string;
|
|
6
|
+
valueColor?: string;
|
|
7
|
+
data: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
tip?: string;
|
|
11
|
+
children?: {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
declare const PisellStatisticList: (props: PisellStatisticListProps) => React.JSX.Element;
|
|
18
|
+
export default PisellStatisticList;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var _excluded = ["backgroundColors", "labelColor", "valueColor", "data"];
|
|
2
|
+
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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Col, Row } from 'antd';
|
|
7
|
+
import PisellTooltip from "../pisellTooltip";
|
|
8
|
+
import Iconfont from "../iconfont";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
var defaultColors = ['rgba(224, 79, 22, 0.20)', 'rgba(202, 133, 4, 0.20)', 'rgba(127, 86, 217, 0.22)', 'rgba(7, 148, 85, 0.20)', 'rgba(21, 112, 239, 0.23)'];
|
|
11
|
+
var PisellStatisticList = function PisellStatisticList(props) {
|
|
12
|
+
var _props$backgroundColo = props.backgroundColors,
|
|
13
|
+
backgroundColors = _props$backgroundColo === void 0 ? defaultColors : _props$backgroundColo,
|
|
14
|
+
_props$labelColor = props.labelColor,
|
|
15
|
+
labelColor = _props$labelColor === void 0 ? '#fff' : _props$labelColor,
|
|
16
|
+
_props$valueColor = props.valueColor,
|
|
17
|
+
valueColor = _props$valueColor === void 0 ? '#fff' : _props$valueColor,
|
|
18
|
+
data = props.data,
|
|
19
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
21
|
+
className: "pisell-lowcode-statistic-list-wrap"
|
|
22
|
+
}, others), data.map(function (item, index) {
|
|
23
|
+
var _item$children;
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "pisell-lowcode-statistic-list-item",
|
|
26
|
+
style: {
|
|
27
|
+
background: backgroundColors[index % backgroundColors.length]
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "pisell-lowcode-statistic-list-item-label",
|
|
31
|
+
style: {
|
|
32
|
+
color: labelColor
|
|
33
|
+
}
|
|
34
|
+
}, item.label, item.tip && /*#__PURE__*/React.createElement(PisellTooltip, {
|
|
35
|
+
title: item.tip
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
37
|
+
style: {
|
|
38
|
+
color: labelColor
|
|
39
|
+
},
|
|
40
|
+
type: "pisell2-help-circle",
|
|
41
|
+
className: "pisell-lowcode-statistic-list-item-label-tip-icon"
|
|
42
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "pisell-lowcode-statistic-list-item-value",
|
|
44
|
+
style: {
|
|
45
|
+
color: valueColor
|
|
46
|
+
}
|
|
47
|
+
}, item.value), !!((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) && /*#__PURE__*/React.createElement(Row, {
|
|
48
|
+
className: "pisell-lowcode-statistic-list-item-children-wrap"
|
|
49
|
+
}, item.children.map(function (child) {
|
|
50
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
51
|
+
span: 12,
|
|
52
|
+
className: "pisell-lowcode-statistic-list-item-children-item"
|
|
53
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
54
|
+
className: "pisell-lowcode-statistic-list-item-children-label",
|
|
55
|
+
style: {
|
|
56
|
+
color: labelColor
|
|
57
|
+
}
|
|
58
|
+
}, child.label), /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "pisell-lowcode-statistic-list-item-children-value",
|
|
60
|
+
style: {
|
|
61
|
+
color: valueColor
|
|
62
|
+
}
|
|
63
|
+
}, child.value));
|
|
64
|
+
})));
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
export default PisellStatisticList;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.pisell-lowcode-statistic-list-wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 16px;
|
|
5
|
+
.pisell-lowcode-statistic-list-item {
|
|
6
|
+
padding: 16px;
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
border: 1px solid var(--Gray-600, #475467);
|
|
9
|
+
.pisell-lowcode-statistic-list-item-label {
|
|
10
|
+
color: var(--Base-White, #fff);
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
line-height: 20px; /* 142.857% */
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: 10px;
|
|
16
|
+
align-items: center;
|
|
17
|
+
.pisell-lowcode-statistic-list-item-label-tip-icon {
|
|
18
|
+
font-size: 20px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.pisell-lowcode-statistic-list-item-value {
|
|
22
|
+
color: var(--Base-White, #fff);
|
|
23
|
+
font-size: 18px;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
line-height: 28px; /* 155.556% */
|
|
26
|
+
}
|
|
27
|
+
.pisell-lowcode-statistic-list-item-children-wrap {
|
|
28
|
+
.pisell-lowcode-statistic-list-item-children-item {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: baseline;
|
|
31
|
+
}
|
|
32
|
+
.pisell-lowcode-statistic-list-item-children-label {
|
|
33
|
+
color: var(--Base-White, #fff);
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
line-height: 18px; /* 150% */
|
|
37
|
+
margin-right: 4px;
|
|
38
|
+
}
|
|
39
|
+
.pisell-lowcode-statistic-list-item-children-value {
|
|
40
|
+
color: var(--Base-White, #fff);
|
|
41
|
+
font-size: 18px;
|
|
42
|
+
font-weight: 700;
|
|
43
|
+
line-height: 28px; /* 155.556% */
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseNumberKeyboardProps } from '../BaseNumberKeyboard';
|
|
3
|
+
export interface AmountProps {
|
|
4
|
+
max?: number;
|
|
5
|
+
min?: number;
|
|
6
|
+
doneText?: string;
|
|
7
|
+
resetText?: string;
|
|
8
|
+
defaultValue?: string | number;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
amountProps?: {
|
|
11
|
+
showCurrencySymbol: boolean;
|
|
12
|
+
useThousandsSeparator: boolean;
|
|
13
|
+
};
|
|
14
|
+
presets?: BaseNumberKeyboardProps['presets'];
|
|
15
|
+
value?: string | number;
|
|
16
|
+
onChange?: (val: string | number) => void;
|
|
17
|
+
onEnter?: (val: string | number) => void;
|
|
18
|
+
defaultSelect?: boolean;
|
|
19
|
+
inputFormat?: (_v: string) => React.ReactNode | null;
|
|
20
|
+
}
|
|
21
|
+
declare const Amount: (props: AmountProps) => React.JSX.Element;
|
|
22
|
+
export default Amount;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect } from 'react';
|
|
8
|
+
import { useControllableValue } from 'ahooks';
|
|
9
|
+
import BaseNumberKeyboard from "../BaseNumberKeyboard";
|
|
10
|
+
import PisellText from "../../pisellText";
|
|
11
|
+
var Amount = function Amount(props) {
|
|
12
|
+
var min = props.min,
|
|
13
|
+
max = props.max,
|
|
14
|
+
amountProps = props.amountProps,
|
|
15
|
+
doneText = props.doneText,
|
|
16
|
+
resetText = props.resetText,
|
|
17
|
+
defaultValue = props.defaultValue,
|
|
18
|
+
placeholder = props.placeholder,
|
|
19
|
+
onEnter = props.onEnter,
|
|
20
|
+
presets = props.presets,
|
|
21
|
+
defaultSelect = props.defaultSelect,
|
|
22
|
+
inputFormat = props.inputFormat;
|
|
23
|
+
var _useControllableValue = useControllableValue(props, {
|
|
24
|
+
defaultValue: defaultValue || ""
|
|
25
|
+
}),
|
|
26
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
27
|
+
value = _useControllableValue2[0],
|
|
28
|
+
setValue = _useControllableValue2[1];
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
document.body.id = 'body';
|
|
31
|
+
}, []);
|
|
32
|
+
var format = function format(_v) {
|
|
33
|
+
var v = "".concat(_v);
|
|
34
|
+
if (inputFormat !== null && inputFormat !== void 0 && inputFormat(v)) {
|
|
35
|
+
return inputFormat === null || inputFormat === void 0 ? void 0 : inputFormat(v);
|
|
36
|
+
}
|
|
37
|
+
// 取value小数位数
|
|
38
|
+
var precision = v.includes('.') ? v.split('.')[1].length : 0;
|
|
39
|
+
var endWith = v.endsWith('.');
|
|
40
|
+
// 最后一位是小数点时去除
|
|
41
|
+
var value = endWith ? v.slice(0, -1) : v;
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellText.Amount, {
|
|
43
|
+
value: value,
|
|
44
|
+
precision: precision,
|
|
45
|
+
hideDecimalForWholeNumbers: false,
|
|
46
|
+
showCurrencySymbol: amountProps === null || amountProps === void 0 ? void 0 : amountProps.showCurrencySymbol,
|
|
47
|
+
useThousandsSeparator: amountProps === null || amountProps === void 0 ? void 0 : amountProps.useThousandsSeparator
|
|
48
|
+
}), endWith && '.');
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
|
|
51
|
+
defaultSelect: defaultSelect,
|
|
52
|
+
max: max,
|
|
53
|
+
min: min,
|
|
54
|
+
value: value,
|
|
55
|
+
onChange: setValue,
|
|
56
|
+
placeholder: placeholder,
|
|
57
|
+
defaultValue: defaultValue,
|
|
58
|
+
format: format,
|
|
59
|
+
doneText: doneText,
|
|
60
|
+
resetText: resetText,
|
|
61
|
+
onEnter: onEnter,
|
|
62
|
+
presets: presets
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
export default Amount;
|