@pisell/materials 2.2.28 → 2.2.29

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.
Files changed (85) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +13 -13
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +14 -14
  11. package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  12. package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +62 -0
  13. package/es/components/pisellAdjustPrice/index.d.ts +10 -0
  14. package/es/components/pisellAdjustPrice/index.js +148 -0
  15. package/es/components/pisellAdjustPrice/index.less +30 -0
  16. package/es/components/segmented/index.d.ts +1 -0
  17. package/es/components/segmented/index.js +1 -0
  18. package/es/components/segmented/index.less +3 -0
  19. package/es/components/virtual-keyboard/Amount/index.d.ts +22 -0
  20. package/es/components/virtual-keyboard/Amount/index.js +65 -0
  21. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  22. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +22 -0
  23. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  24. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  25. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +213 -0
  26. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  27. package/es/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  28. package/es/components/virtual-keyboard/Keyboard/index.js +59 -15
  29. package/es/components/virtual-keyboard/Keyboard/index.less +35 -24
  30. package/es/components/virtual-keyboard/Number/index.d.ts +14 -0
  31. package/es/components/virtual-keyboard/Number/index.js +35 -0
  32. package/es/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  33. package/es/components/virtual-keyboard/VirtualInput/index.js +41 -0
  34. package/es/components/virtual-keyboard/VirtualInput/index.less +46 -0
  35. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  36. package/es/components/virtual-keyboard/VirtualKeyInput/index.js +27 -20
  37. package/es/index.d.ts +4 -0
  38. package/es/index.js +5 -1
  39. package/es/locales/en-US.d.ts +6 -0
  40. package/es/locales/en-US.js +8 -1
  41. package/es/locales/zh-CN.d.ts +6 -0
  42. package/es/locales/zh-CN.js +8 -1
  43. package/es/locales/zh-TW.d.ts +6 -0
  44. package/es/locales/zh-TW.js +8 -1
  45. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  46. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +84 -0
  47. package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
  48. package/lib/components/pisellAdjustPrice/index.js +156 -0
  49. package/lib/components/pisellAdjustPrice/index.less +30 -0
  50. package/lib/components/segmented/index.d.ts +1 -0
  51. package/lib/components/segmented/index.js +1 -0
  52. package/lib/components/segmented/index.less +3 -0
  53. package/lib/components/virtual-keyboard/Amount/index.d.ts +22 -0
  54. package/lib/components/virtual-keyboard/Amount/index.js +96 -0
  55. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  56. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +46 -0
  57. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  58. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  59. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +245 -0
  60. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  61. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  62. package/lib/components/virtual-keyboard/Keyboard/index.js +51 -4
  63. package/lib/components/virtual-keyboard/Keyboard/index.less +35 -24
  64. package/lib/components/virtual-keyboard/Number/index.d.ts +14 -0
  65. package/lib/components/virtual-keyboard/Number/index.js +65 -0
  66. package/lib/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  67. package/lib/components/virtual-keyboard/VirtualInput/index.js +63 -0
  68. package/lib/components/virtual-keyboard/VirtualInput/index.less +46 -0
  69. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  70. package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +20 -11
  71. package/lib/index.d.ts +4 -0
  72. package/lib/index.js +12 -0
  73. package/lib/locales/en-US.d.ts +6 -0
  74. package/lib/locales/en-US.js +8 -1
  75. package/lib/locales/zh-CN.d.ts +6 -0
  76. package/lib/locales/zh-CN.js +8 -1
  77. package/lib/locales/zh-TW.d.ts +6 -0
  78. package/lib/locales/zh-TW.js +8 -1
  79. package/lowcode/input/meta.ts +25 -0
  80. package/lowcode/pisell-adjust-price/meta.ts +58 -0
  81. package/lowcode/pisell-adjust-price/snippets.ts +10 -0
  82. package/lowcode/pisell-adjust-price-input-number/meta.ts +245 -0
  83. package/lowcode/pisell-number-keyboard/meta.ts +98 -0
  84. package/lowcode/pisell-price-keyboard/meta.ts +174 -0
  85. package/package.json +3 -3
@@ -0,0 +1,9 @@
1
+ .pisell-virtual-keyboard-base {
2
+ width: 340px;
3
+ .virtual-keyboard-input-wrap {
4
+ box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
5
+ }
6
+ .virtual-keyboard-wrap .virtual-keyboard-content .virtual-keyboard-item {
7
+ box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
8
+ }
9
+ }
@@ -1,18 +1,20 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  export declare type ItemValue = string | number;
4
4
  export interface Item {
5
5
  value: ItemValue;
6
- label: string;
6
+ label: React.ReactNode;
7
7
  disabled: boolean;
8
- type: "text" | "primary";
8
+ type: 'text' | 'primary';
9
9
  style?: React.CSSProperties;
10
+ size?: number;
10
11
  }
11
12
  export interface KeyboardProps {
12
13
  className?: string;
13
14
  style?: React.CSSProperties;
14
15
  onChange?: (value?: ItemValue) => void;
15
16
  items?: Item[];
17
+ rightItems?: Item[];
16
18
  }
17
- declare const Keyboard: (props: KeyboardProps) => React.JSX.Element;
18
- export default Keyboard;
19
+ declare const _default: React.MemoExoticComponent<(props: KeyboardProps) => React.JSX.Element>;
20
+ export default _default;
@@ -1,20 +1,30 @@
1
- import React from "react";
2
- import { Button } from "antd";
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
+ import React, { useRef } from 'react';
8
+ import { Button } from 'antd';
3
9
  import "./index.less";
4
- import classNames from "classnames";
5
- import { useEventListener } from "ahooks";
6
- var list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ok"];
10
+ import classNames from 'classnames';
11
+ import { useEventListener, useMemoizedFn, useSize } from 'ahooks';
12
+ var list = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ok'];
13
+ var defaultArr = [];
7
14
  var Keyboard = function Keyboard(props) {
8
15
  var _props$items = props.items,
9
- items = _props$items === void 0 ? [] : _props$items,
16
+ items = _props$items === void 0 ? defaultArr : _props$items,
10
17
  className = props.className,
11
18
  style = props.style,
12
- onChange = props.onChange;
13
- useEventListener("keydown", function (ev) {
14
- console.log("ev", ev);
19
+ onChange = props.onChange,
20
+ rightItems = props.rightItems;
21
+ var contentRef = useRef(null);
22
+ var size = useSize(contentRef);
23
+ useEventListener('keydown', function (ev) {
24
+ console.log('ev', ev);
15
25
  var key = ev.key;
16
- if (key === "Enter") {
17
- key = "ok";
26
+ if (key === 'Enter') {
27
+ key = 'ok';
18
28
  }
19
29
  if (list.includes(key)) {
20
30
  // let dom = document.querySelector(`#virtual-keyboard-${ev.key}`);
@@ -25,9 +35,17 @@ var Keyboard = function Keyboard(props) {
25
35
  onChange === null || onChange === void 0 ? void 0 : onChange(key);
26
36
  }
27
37
  });
38
+ var getHeight = useMemoizedFn(function () {
39
+ var itemSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
40
+ // 默认高度为25% 的容器宽度 * size大小 + 间距
41
+ return ((size === null || size === void 0 ? void 0 : size.width) || 0) / 4 * itemSize + (itemSize - 1) * 7;
42
+ });
28
43
  return /*#__PURE__*/React.createElement("div", {
29
- className: classNames("virtual-keyboard-wrap", className),
44
+ className: classNames('virtual-keyboard-wrap', className),
30
45
  style: style
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ className: classNames('virtual-keyboard-content'),
48
+ ref: contentRef
31
49
  }, items.map(function (item) {
32
50
  var _item$style;
33
51
  return /*#__PURE__*/React.createElement("div", {
@@ -39,13 +57,39 @@ var Keyboard = function Keyboard(props) {
39
57
  type: item.type,
40
58
  className: "virtual-keyboard-item-button",
41
59
  style: {
42
- color: item.type === "primary" ? "#fff" : ((_item$style = item.style) === null || _item$style === void 0 ? void 0 : _item$style.color) || undefined
60
+ color: item.type === 'primary' ? '#fff' : ((_item$style = item.style) === null || _item$style === void 0 ? void 0 : _item$style.color) || undefined
61
+ },
62
+ disabled: item.disabled,
63
+ onClick: function onClick(e) {
64
+ onChange === null || onChange === void 0 ? void 0 : onChange(item.value);
65
+ }
66
+ }, item.label));
67
+ })), rightItems && /*#__PURE__*/React.createElement("div", {
68
+ className: classNames('virtual-keyboard-content', 'virtual-keyboard-right'),
69
+ style: {
70
+ flex: "0 0 calc((100% - 21px) / 4 * 1)"
71
+ }
72
+ }, rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(function (item) {
73
+ var _item$style2, _item$style3;
74
+ return /*#__PURE__*/React.createElement("div", {
75
+ className: "virtual-keyboard-item",
76
+ style: _objectSpread(_objectSpread({}, item.style || {}), {}, {
77
+ height: getHeight(item.size)
78
+ })
79
+ }, /*#__PURE__*/React.createElement(Button, {
80
+ id: "virtual-keyboard-".concat(item.value),
81
+ key: item.value,
82
+ type: item.type,
83
+ className: "virtual-keyboard-item-button",
84
+ style: {
85
+ fontSize: ((_item$style2 = item.style) === null || _item$style2 === void 0 ? void 0 : _item$style2.fontSize) || 25,
86
+ color: item.type === 'primary' ? '#fff' : ((_item$style3 = item.style) === null || _item$style3 === void 0 ? void 0 : _item$style3.color) || undefined
43
87
  },
44
88
  disabled: item.disabled,
45
89
  onClick: function onClick(e) {
46
90
  onChange === null || onChange === void 0 ? void 0 : onChange(item.value);
47
91
  }
48
92
  }, item.label));
49
- }));
93
+ })));
50
94
  };
51
- export default Keyboard;
95
+ export default /*#__PURE__*/React.memo(Keyboard);
@@ -1,32 +1,43 @@
1
1
  .virtual-keyboard-wrap {
2
- width: 100%;
3
2
  display: flex;
4
- flex-wrap: wrap;
5
- align-items: center;
6
- justify-content: flex-end;
7
3
  gap: 7px;
4
+ .virtual-keyboard-content {
5
+ width: 100%;
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ align-items: center;
9
+ justify-content: flex-end;
10
+ gap: 7px;
8
11
 
9
- .virtual-keyboard-item {
10
- border-radius: 5px;
11
- background: var(--Base-White, #FFF);
12
- box-shadow: 0px 1px 0px 0px #898A8D;
13
- overflow: hidden;
14
- width: calc((100% - 14px) / 3 * 1);
15
- padding-top: 25%;
16
- position: relative;
12
+ .virtual-keyboard-item {
13
+ border-radius: 5px;
14
+ background: var(--Base-White, #fff);
15
+ box-shadow: 0px 1px 0px 0px #898a8d;
16
+ overflow: hidden;
17
+ width: calc((100% - 14px) / 3 * 1);
18
+ padding-top: 25%;
19
+ position: relative;
17
20
 
18
- .virtual-keyboard-item-button {
19
- position: absolute;
20
- left: 0;
21
- top: 0;
21
+ .virtual-keyboard-item-button {
22
+ position: absolute;
23
+ left: 0;
24
+ top: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ border-radius: 5px;
28
+ color: var(--Base-Black, #000);
29
+ font-size: 25px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ box-shadow: none;
33
+ }
34
+ }
35
+ }
36
+ .virtual-keyboard-right {
37
+ flex-direction: column;
38
+ justify-content: start;
39
+ .virtual-keyboard-item{
22
40
  width: 100%;
23
- height: 100%;
24
- border-radius: 5px;
25
- color: var(--Base-Black, #000);
26
- font-size: 25px;
27
- font-style: normal;
28
- font-weight: 400;
29
- box-shadow: none;
30
41
  }
31
42
  }
32
- }
43
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface NumberProps {
3
+ max?: number;
4
+ min?: number;
5
+ doneText?: string;
6
+ resetText: string;
7
+ defaultValue?: string | number;
8
+ placeholder?: string;
9
+ value?: string | number;
10
+ onChange?: (val: string | number) => void;
11
+ onEnter?: (val: string | number) => void;
12
+ }
13
+ declare const Number: (props: NumberProps) => React.JSX.Element;
14
+ export default Number;
@@ -0,0 +1,35 @@
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 from 'react';
8
+ import { useControllableValue } from 'ahooks';
9
+ import BaseNumberKeyboard from "../BaseNumberKeyboard";
10
+ var Number = function Number(props) {
11
+ var min = props.min,
12
+ max = props.max,
13
+ doneText = props.doneText,
14
+ resetText = props.resetText,
15
+ defaultValue = props.defaultValue,
16
+ placeholder = props.placeholder,
17
+ onEnter = props.onEnter;
18
+ var _useControllableValue = useControllableValue(props, {
19
+ defaultValue: defaultValue || ""
20
+ }),
21
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
22
+ value = _useControllableValue2[0],
23
+ setValue = _useControllableValue2[1];
24
+ return /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
25
+ max: max,
26
+ min: min,
27
+ value: value,
28
+ onChange: setValue,
29
+ placeholder: placeholder,
30
+ doneText: doneText,
31
+ resetText: resetText,
32
+ onEnter: onEnter
33
+ });
34
+ };
35
+ export default Number;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface VirtualInputProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ value?: string;
5
+ autoFocus?: boolean;
6
+ placeholder?: string;
7
+ }
8
+ declare const VirtualInput: (props: VirtualInputProps) => React.JSX.Element;
9
+ export default VirtualInput;
@@ -0,0 +1,41 @@
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, { useState } from 'react';
8
+ import classNames from 'classnames';
9
+ import { isUndefined } from "@pisell/utils";
10
+ import "./index.less";
11
+ var VirtualInput = function VirtualInput(props) {
12
+ var value = props.value,
13
+ autoFocus = props.autoFocus,
14
+ _props$placeholder = props.placeholder,
15
+ placeholder = _props$placeholder === void 0 ? '' : _props$placeholder;
16
+ var _useState = useState(autoFocus),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ isFocus = _useState2[0],
19
+ setIsFocus = _useState2[1];
20
+ var onFocus = function onFocus() {
21
+ setIsFocus(true);
22
+ };
23
+ var onBlur = function onBlur() {
24
+ setIsFocus(false);
25
+ };
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ onFocus: onFocus,
28
+ onBlur: onBlur,
29
+ tabIndex: 0,
30
+ className: classNames('pisell-virtual-input-value', {
31
+ 'pisell-virtual-input-value-focus': isFocus
32
+ })
33
+ }, value, (isUndefined(value) || value === '') && /*#__PURE__*/React.createElement("div", {
34
+ className: "pisell-virtual-input-placeholder"
35
+ }, placeholder), /*#__PURE__*/React.createElement("div", {
36
+ className: "pisell-virtual-input-caret-container"
37
+ }, isFocus && /*#__PURE__*/React.createElement("div", {
38
+ className: "pisell-virtual-input-caret"
39
+ })));
40
+ };
41
+ export default VirtualInput;
@@ -0,0 +1,46 @@
1
+ .pisell-virtual-input-value {
2
+ width: 100%;
3
+ min-width: 80px;
4
+ height: 100%;
5
+ display: flex;
6
+ align-items: center;
7
+ .pisell-virtual-input-caret-container {
8
+ height: 100%;
9
+ display: flex;
10
+ align-items: center;
11
+ .pisell-virtual-input-caret {
12
+ height: 40px;
13
+ width: 4px;
14
+ position: relative;
15
+ background: var(--Blue-600, #1570EF);
16
+ }
17
+ }
18
+ .pisell-virtual-input-placeholder {
19
+ color: var(--Gray-300, #D0D5DD);
20
+ }
21
+ }
22
+
23
+ .pisell-virtual-input-value-focus {
24
+ .pisell-virtual-input-caret {
25
+ display: block;
26
+ animation-name: pisell-caret-blink;
27
+ animation-duration: 1s;
28
+ animation-timing-function: linear;
29
+ animation-iteration-count: infinite;
30
+ }
31
+ }
32
+
33
+ @keyframes pisell-caret-blink {
34
+ from {
35
+ opacity: 1;
36
+ }
37
+ 60% {
38
+ opacity: 1;
39
+ }
40
+ 80% {
41
+ opacity: 0;
42
+ }
43
+ to {
44
+ opacity: 0;
45
+ }
46
+ }
@@ -1,9 +1,12 @@
1
- import React from "react";
2
- import { InputProps } from "antd";
3
- import "./index.less";
1
+ import React from 'react';
2
+ import { InputProps } from 'antd';
3
+ import './index.less';
4
4
  export interface VirtualKeyInputProps extends InputProps {
5
5
  previewValue?: string;
6
6
  renderInput?: (props: any) => any;
7
+ showDelete?: boolean;
8
+ onValueSelect?: (selected: boolean) => void;
9
+ defaultSelect?: boolean;
7
10
  }
8
11
  declare const VirtualKeyInput: (props: VirtualKeyInputProps) => React.JSX.Element;
9
12
  export default VirtualKeyInput;
@@ -5,43 +5,50 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
5
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
6
  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; } }
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- import React, { useEffect, useState } from "react";
9
- import { Input } from "antd";
10
- import Delete from "@pisell/icon/es/Delete";
11
- import { useEventListener } from "ahooks";
12
- import classNames from "classnames";
8
+ import React, { useState } from 'react';
9
+ import { Input } from 'antd';
10
+ import Delete from '@pisell/icon/es/Delete';
11
+ import { useEventListener, useUpdateEffect } from 'ahooks';
12
+ import classNames from 'classnames';
13
13
  import "./index.less";
14
- var list = ["Backspace"];
14
+ var list = ['Backspace'];
15
15
  var VirtualKeyInput = function VirtualKeyInput(props) {
16
+ var _ref;
16
17
  var _props$previewValue = props.previewValue,
17
18
  previewValue = _props$previewValue === void 0 ? props.value : _props$previewValue,
18
- value = props.value;
19
- var _useState = useState(false),
19
+ value = props.value,
20
+ _props$showDelete = props.showDelete,
21
+ showDelete = _props$showDelete === void 0 ? true : _props$showDelete,
22
+ onValueSelect = props.onValueSelect,
23
+ defaultSelect = props.defaultSelect;
24
+ var _useState = useState(defaultSelect !== null && defaultSelect !== void 0 ? defaultSelect : false),
20
25
  _useState2 = _slicedToArray(_useState, 2),
21
26
  select = _useState2[0],
22
27
  setSelect = _useState2[1];
23
- useEventListener("keydown", function (ev) {
28
+ useEventListener('keydown', function (ev) {
24
29
  if (list.includes(ev.key)) {
25
30
  _onDelete === null || _onDelete === void 0 ? void 0 : _onDelete();
26
31
  }
27
32
  });
28
- useEffect(function () {
29
- if (value) {
30
- setSelect(false);
31
- }
33
+ var handleSelectChange = function handleSelectChange(selected) {
34
+ onValueSelect === null || onValueSelect === void 0 ? void 0 : onValueSelect(selected);
35
+ setSelect(selected);
36
+ };
37
+ useUpdateEffect(function () {
38
+ handleSelectChange(false);
32
39
  }, [value]);
33
40
  var _onDelete = function _onDelete() {
34
41
  if (select) {
35
42
  var _props$onChange;
36
43
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
37
44
  target: {
38
- value: ""
45
+ value: ''
39
46
  }
40
47
  });
41
- setSelect(false);
48
+ handleSelectChange(false);
42
49
  return;
43
50
  }
44
- var _val = props.value + "";
51
+ var _val = props.value + '';
45
52
  _val = _val.slice(0, _val.length - 1);
46
53
  props.onChange && props.onChange({
47
54
  target: {
@@ -52,12 +59,12 @@ var VirtualKeyInput = function VirtualKeyInput(props) {
52
59
  return /*#__PURE__*/React.createElement("div", {
53
60
  className: "virtual-keyboard-input-wrap"
54
61
  }, props.renderInput ? /*#__PURE__*/React.createElement("div", {
55
- className: classNames("virtual-keyboard-input", {
56
- "virtual-keyboard-input-select": select
62
+ className: classNames('virtual-keyboard-input', {
63
+ 'virtual-keyboard-input-select': select
57
64
  }),
58
65
  onClick: function onClick() {
59
66
  if (value) {
60
- setSelect(!select);
67
+ handleSelectChange(!select);
61
68
  }
62
69
  }
63
70
  }, props.renderInput(props)) : /*#__PURE__*/React.createElement(Input, _extends({
@@ -66,7 +73,7 @@ var VirtualKeyInput = function VirtualKeyInput(props) {
66
73
  }, props, {
67
74
  readOnly: true,
68
75
  value: previewValue
69
- })), value !== null && value !== void 0 && value.length ? /*#__PURE__*/React.createElement("div", {
76
+ })), (_ref = "".concat(value !== null && value !== void 0 ? value : "")) !== null && _ref !== void 0 && _ref.length && showDelete ? /*#__PURE__*/React.createElement("div", {
70
77
  className: "virtual-keyboard-input-delete",
71
78
  onClick: _onDelete
72
79
  }, /*#__PURE__*/React.createElement(Delete, {
package/es/index.d.ts CHANGED
@@ -102,3 +102,7 @@ export { default as PisellCard } from './components/pisellCard';
102
102
  export { default as PisellInformationEntry } from './components/pisellInformationEntry';
103
103
  export { default as usePisellConfig } from './components/pisell-config-provider/hooks/usePisellConfig';
104
104
  export { globalConfig, default as PisellContext } from './components/pisell-config-provider/context';
105
+ export { default as PisellPriceKeyboard } from './components/virtual-keyboard/Amount';
106
+ export { default as PisellNumberKeyboard } from './components/virtual-keyboard/Number';
107
+ export { default as PisellAdjustPrice } from './components/pisellAdjustPrice';
108
+ export { default as PisellAdjustPriceInputNumber } from './components/pisellAdjustPrice/PisellAdjustPriceInputNumber';
package/es/index.js CHANGED
@@ -123,4 +123,8 @@ export { default as PisellAlert } from "./components/pisellAlert";
123
123
  export { default as PisellCard } from "./components/pisellCard";
124
124
  export { default as PisellInformationEntry } from "./components/pisellInformationEntry";
125
125
  export { default as usePisellConfig } from "./components/pisell-config-provider/hooks/usePisellConfig";
126
- export { globalConfig, default as PisellContext } from "./components/pisell-config-provider/context";
126
+ export { globalConfig, default as PisellContext } from "./components/pisell-config-provider/context";
127
+ export { default as PisellPriceKeyboard } from "./components/virtual-keyboard/Amount";
128
+ export { default as PisellNumberKeyboard } from "./components/virtual-keyboard/Number";
129
+ export { default as PisellAdjustPrice } from "./components/pisellAdjustPrice";
130
+ export { default as PisellAdjustPriceInputNumber } from "./components/pisellAdjustPrice/PisellAdjustPriceInputNumber";
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': 'Detail',
131
131
  'pisell-wallet-pass-card-redeem': 'Redeem',
132
132
  'pisell-wallet-pass-card-balance': 'Balance',
133
- 'pisell-wallet-pass-card-valid-to': 'Valid to'
133
+ 'pisell-wallet-pass-card-valid-to': 'Valid to',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "Price override",
136
+ 'pisell-adjust-price-discount': "Discount",
137
+ 'pisell-adjust-price-discount-amount': "Amount",
138
+ 'pisell-adjust-price-discount-percentage': "Percentage",
139
+ 'pisell-adjust-price-total-after-discount': "Total after discount: ",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "Discount can be maximum"
134
141
  };
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': '详情',
131
131
  'pisell-wallet-pass-card-redeem': '兑换',
132
132
  'pisell-wallet-pass-card-balance': '余额',
133
- 'pisell-wallet-pass-card-valid-to': '有效期至'
133
+ 'pisell-wallet-pass-card-valid-to': '有效期至',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "一口价",
136
+ 'pisell-adjust-price-discount': "折扣",
137
+ 'pisell-adjust-price-discount-amount': "金额",
138
+ 'pisell-adjust-price-discount-percentage': "百分比",
139
+ 'pisell-adjust-price-total-after-discount': "打折后总价",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "折扣最高可达"
134
141
  };
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': '詳情',
131
131
  'pisell-wallet-pass-card-redeem': '兌換',
132
132
  'pisell-wallet-pass-card-balance': '餘額',
133
- 'pisell-wallet-pass-card-valid-to': '有效期至'
133
+ 'pisell-wallet-pass-card-valid-to': '有效期至',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "一口價",
136
+ 'pisell-adjust-price-discount': "折扣",
137
+ 'pisell-adjust-price-discount-amount': "金額",
138
+ 'pisell-adjust-price-discount-percentage': "百分比",
139
+ 'pisell-adjust-price-total-after-discount': "打折后總價",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "折扣最高可達"
134
141
  };
@@ -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;