@pisell/materials 1.0.420 → 1.0.421
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 +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +19 -19
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +20 -20
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +58 -0
- package/es/components/pisellAdjustPrice/index.d.ts +10 -0
- package/es/components/pisellAdjustPrice/index.js +136 -0
- package/es/components/pisellAdjustPrice/index.less +30 -0
- package/es/components/virtual-keyboard/Amount/index.d.ts +21 -0
- package/es/components/virtual-keyboard/Amount/index.js +61 -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 +210 -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 +40 -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 +4 -0
- package/es/index.js +5 -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 +80 -0
- package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
- package/lib/components/pisellAdjustPrice/index.js +142 -0
- package/lib/components/pisellAdjustPrice/index.less +30 -0
- package/lib/components/virtual-keyboard/Amount/index.d.ts +21 -0
- package/lib/components/virtual-keyboard/Amount/index.js +92 -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 +242 -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 +62 -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 +4 -0
- package/lib/index.js +12 -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/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-number-keyboard/meta.ts +98 -0
- package/lowcode/pisell-price-keyboard/meta.ts +174 -0
- package/package.json +1 -1
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
5
|
-
import { useEventListener } from
|
|
6
|
-
var list = [
|
|
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 ?
|
|
16
|
+
items = _props$items === void 0 ? defaultArr : _props$items,
|
|
10
17
|
className = props.className,
|
|
11
18
|
style = props.style,
|
|
12
|
-
onChange = props.onChange
|
|
13
|
-
|
|
14
|
-
|
|
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 ===
|
|
17
|
-
key =
|
|
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(
|
|
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 ===
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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,40 @@
|
|
|
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 "./index.less";
|
|
10
|
+
var VirtualInput = function VirtualInput(props) {
|
|
11
|
+
var value = props.value,
|
|
12
|
+
autoFocus = props.autoFocus,
|
|
13
|
+
_props$placeholder = props.placeholder,
|
|
14
|
+
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder;
|
|
15
|
+
var _useState = useState(autoFocus),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isFocus = _useState2[0],
|
|
18
|
+
setIsFocus = _useState2[1];
|
|
19
|
+
var onFocus = function onFocus() {
|
|
20
|
+
setIsFocus(true);
|
|
21
|
+
};
|
|
22
|
+
var onBlur = function onBlur() {
|
|
23
|
+
setIsFocus(false);
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
onFocus: onFocus,
|
|
27
|
+
onBlur: onBlur,
|
|
28
|
+
tabIndex: 0,
|
|
29
|
+
className: classNames('pisell-virtual-input-value', {
|
|
30
|
+
'pisell-virtual-input-value-focus': isFocus
|
|
31
|
+
})
|
|
32
|
+
}, value, !value && /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "pisell-virtual-input-placeholder"
|
|
34
|
+
}, placeholder), /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "pisell-virtual-input-caret-container"
|
|
36
|
+
}, isFocus && /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "pisell-virtual-input-caret"
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
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
|
|
2
|
-
import { InputProps } from
|
|
3
|
-
import
|
|
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, {
|
|
9
|
-
import { Input } from
|
|
10
|
-
import Delete from
|
|
11
|
-
import { useEventListener } from
|
|
12
|
-
import classNames from
|
|
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 = [
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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(
|
|
56
|
-
|
|
62
|
+
className: classNames('virtual-keyboard-input', {
|
|
63
|
+
'virtual-keyboard-input-select': select
|
|
57
64
|
}),
|
|
58
65
|
onClick: function onClick() {
|
|
59
66
|
if (value) {
|
|
60
|
-
|
|
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 &&
|
|
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
|
@@ -106,3 +106,7 @@ export { globalConfig, default as PisellContext, } from './components/pisell-con
|
|
|
106
106
|
export { default as PisellTags } from './components/pisellTags';
|
|
107
107
|
export { default as PisellStatisticList } from './components/pisellStatisticList';
|
|
108
108
|
export { default as PisellFloatingPanel } from './components/pisellFloatingPanel';
|
|
109
|
+
export { default as PisellPriceKeyboard } from './components/virtual-keyboard/Amount';
|
|
110
|
+
export { default as PisellNumberKeyboard } from './components/virtual-keyboard/Number';
|
|
111
|
+
export { default as PisellAdjustPrice } from './components/pisellAdjustPrice';
|
|
112
|
+
export { default as PisellAdjustPriceInputNumber } from './components/pisellAdjustPrice/PisellAdjustPriceInputNumber';
|
package/es/index.js
CHANGED
|
@@ -127,4 +127,8 @@ export { default as usePisellConfig } from "./components/pisell-config-provider/
|
|
|
127
127
|
export { globalConfig, default as PisellContext } from "./components/pisell-config-provider/context";
|
|
128
128
|
export { default as PisellTags } from "./components/pisellTags";
|
|
129
129
|
export { default as PisellStatisticList } from "./components/pisellStatisticList";
|
|
130
|
-
export { default as PisellFloatingPanel } from "./components/pisellFloatingPanel";
|
|
130
|
+
export { default as PisellFloatingPanel } from "./components/pisellFloatingPanel";
|
|
131
|
+
export { default as PisellPriceKeyboard } from "./components/virtual-keyboard/Amount";
|
|
132
|
+
export { default as PisellNumberKeyboard } from "./components/virtual-keyboard/Number";
|
|
133
|
+
export { default as PisellAdjustPrice } from "./components/pisellAdjustPrice";
|
|
134
|
+
export { default as PisellAdjustPriceInputNumber } from "./components/pisellAdjustPrice/PisellAdjustPriceInputNumber";
|
package/es/locales/en-US.d.ts
CHANGED
|
@@ -118,5 +118,11 @@ declare const _default: {
|
|
|
118
118
|
'pisell-wallet-pass-card-redeem': string;
|
|
119
119
|
'pisell-wallet-pass-card-balance': string;
|
|
120
120
|
'pisell-wallet-pass-card-valid-to': string;
|
|
121
|
+
'pisell-adjust-price-price-override': string;
|
|
122
|
+
'pisell-adjust-price-discount': string;
|
|
123
|
+
'pisell-adjust-price-discount-amount': string;
|
|
124
|
+
'pisell-adjust-price-discount-percentage': string;
|
|
125
|
+
'pisell-adjust-price-total-after-discount': string;
|
|
126
|
+
'pisell-adjust-price-discount-can-be-maximum': string;
|
|
121
127
|
};
|
|
122
128
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -143,5 +143,12 @@ export default {
|
|
|
143
143
|
'pisell-wallet-pass-card-detail': 'Detail',
|
|
144
144
|
'pisell-wallet-pass-card-redeem': 'Redeem',
|
|
145
145
|
'pisell-wallet-pass-card-balance': 'Balance',
|
|
146
|
-
'pisell-wallet-pass-card-valid-to': 'Valid to'
|
|
146
|
+
'pisell-wallet-pass-card-valid-to': 'Valid to',
|
|
147
|
+
// 金额修改组件
|
|
148
|
+
'pisell-adjust-price-price-override': "Price override",
|
|
149
|
+
'pisell-adjust-price-discount': "Discount",
|
|
150
|
+
'pisell-adjust-price-discount-amount': "Amount",
|
|
151
|
+
'pisell-adjust-price-discount-percentage': "Percentage",
|
|
152
|
+
'pisell-adjust-price-total-after-discount': "Total after discount: ",
|
|
153
|
+
'pisell-adjust-price-discount-can-be-maximum': "Discount can be maximum"
|
|
147
154
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -118,5 +118,11 @@ declare const _default: {
|
|
|
118
118
|
'pisell-wallet-pass-card-redeem': string;
|
|
119
119
|
'pisell-wallet-pass-card-balance': string;
|
|
120
120
|
'pisell-wallet-pass-card-valid-to': string;
|
|
121
|
+
'pisell-adjust-price-price-override': string;
|
|
122
|
+
'pisell-adjust-price-discount': string;
|
|
123
|
+
'pisell-adjust-price-discount-amount': string;
|
|
124
|
+
'pisell-adjust-price-discount-percentage': string;
|
|
125
|
+
'pisell-adjust-price-total-after-discount': string;
|
|
126
|
+
'pisell-adjust-price-discount-can-be-maximum': string;
|
|
121
127
|
};
|
|
122
128
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -143,5 +143,12 @@ export default {
|
|
|
143
143
|
'pisell-wallet-pass-card-detail': '详情',
|
|
144
144
|
'pisell-wallet-pass-card-redeem': '兑换',
|
|
145
145
|
'pisell-wallet-pass-card-balance': '余额',
|
|
146
|
-
'pisell-wallet-pass-card-valid-to': '有效期至'
|
|
146
|
+
'pisell-wallet-pass-card-valid-to': '有效期至',
|
|
147
|
+
// 金额修改组件
|
|
148
|
+
'pisell-adjust-price-price-override': "一口价",
|
|
149
|
+
'pisell-adjust-price-discount': "折扣",
|
|
150
|
+
'pisell-adjust-price-discount-amount': "金额",
|
|
151
|
+
'pisell-adjust-price-discount-percentage': "百分比",
|
|
152
|
+
'pisell-adjust-price-total-after-discount': "打折后总价",
|
|
153
|
+
'pisell-adjust-price-discount-can-be-maximum': "折扣最高可达"
|
|
147
154
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -118,5 +118,11 @@ declare const _default: {
|
|
|
118
118
|
'pisell-wallet-pass-card-redeem': string;
|
|
119
119
|
'pisell-wallet-pass-card-balance': string;
|
|
120
120
|
'pisell-wallet-pass-card-valid-to': string;
|
|
121
|
+
'pisell-adjust-price-price-override': string;
|
|
122
|
+
'pisell-adjust-price-discount': string;
|
|
123
|
+
'pisell-adjust-price-discount-amount': string;
|
|
124
|
+
'pisell-adjust-price-discount-percentage': string;
|
|
125
|
+
'pisell-adjust-price-total-after-discount': string;
|
|
126
|
+
'pisell-adjust-price-discount-can-be-maximum': string;
|
|
121
127
|
};
|
|
122
128
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -143,5 +143,12 @@ export default {
|
|
|
143
143
|
'pisell-wallet-pass-card-detail': '詳情',
|
|
144
144
|
'pisell-wallet-pass-card-redeem': '兌換',
|
|
145
145
|
'pisell-wallet-pass-card-balance': '餘額',
|
|
146
|
-
'pisell-wallet-pass-card-valid-to': '有效期至'
|
|
146
|
+
'pisell-wallet-pass-card-valid-to': '有效期至',
|
|
147
|
+
// 金额修改组件
|
|
148
|
+
'pisell-adjust-price-price-override': "一口價",
|
|
149
|
+
'pisell-adjust-price-discount': "折扣",
|
|
150
|
+
'pisell-adjust-price-discount-amount': "金額",
|
|
151
|
+
'pisell-adjust-price-discount-percentage': "百分比",
|
|
152
|
+
'pisell-adjust-price-total-after-discount': "打折后總價",
|
|
153
|
+
'pisell-adjust-price-discount-can-be-maximum': "折扣最高可達"
|
|
147
154
|
};
|
|
@@ -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,80 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.tsx
|
|
30
|
+
var PisellAdjustPriceInputNumber_exports = {};
|
|
31
|
+
__export(PisellAdjustPriceInputNumber_exports, {
|
|
32
|
+
default: () => PisellAdjustPriceInputNumber_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(PisellAdjustPriceInputNumber_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_index = __toESM(require("./index"));
|
|
38
|
+
var PisellAdjustPriceInputNumber = (props) => {
|
|
39
|
+
const { value, onChange, originValue, size, prefix, disabled, ...others } = props;
|
|
40
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
41
|
+
const handleChange = (val) => {
|
|
42
|
+
setOpen(false);
|
|
43
|
+
onChange == null ? void 0 : onChange(val);
|
|
44
|
+
};
|
|
45
|
+
const content = (0, import_react.useMemo)(() => {
|
|
46
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
47
|
+
import_index.default,
|
|
48
|
+
{
|
|
49
|
+
key: `${open}`,
|
|
50
|
+
originValue,
|
|
51
|
+
defaultValue: value,
|
|
52
|
+
value,
|
|
53
|
+
onChange: handleChange
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}, [originValue, value, open]);
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
58
|
+
import_antd.Popover,
|
|
59
|
+
{
|
|
60
|
+
open,
|
|
61
|
+
content,
|
|
62
|
+
trigger: ["click"],
|
|
63
|
+
overlayInnerStyle: { padding: 0 },
|
|
64
|
+
onOpenChange: (val) => setOpen(val),
|
|
65
|
+
destroyTooltipOnHide: true
|
|
66
|
+
},
|
|
67
|
+
/* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
import_antd.InputNumber,
|
|
69
|
+
{
|
|
70
|
+
...others,
|
|
71
|
+
disabled,
|
|
72
|
+
prefix,
|
|
73
|
+
size: size || "large",
|
|
74
|
+
value,
|
|
75
|
+
readOnly: true
|
|
76
|
+
}
|
|
77
|
+
))
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
var PisellAdjustPriceInputNumber_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;
|