@pisell/materials 3.0.48 → 3.0.49
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 +14 -14
- 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/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 +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 +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/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 +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 +2 -2
|
@@ -0,0 +1,84 @@
|
|
|
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(Number(val.toFixed(2)));
|
|
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
|
+
arrow: false,
|
|
67
|
+
align: {
|
|
68
|
+
offset: [0, 20]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
/* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
import_antd.InputNumber,
|
|
73
|
+
{
|
|
74
|
+
...others,
|
|
75
|
+
disabled,
|
|
76
|
+
prefix,
|
|
77
|
+
size: size || "large",
|
|
78
|
+
value,
|
|
79
|
+
readOnly: true
|
|
80
|
+
}
|
|
81
|
+
))
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
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;
|
|
@@ -0,0 +1,156 @@
|
|
|
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/index.tsx
|
|
30
|
+
var pisellAdjustPrice_exports = {};
|
|
31
|
+
__export(pisellAdjustPrice_exports, {
|
|
32
|
+
default: () => pisellAdjustPrice_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(pisellAdjustPrice_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_pisellText = __toESM(require("../pisellText"));
|
|
39
|
+
var import_Amount = __toESM(require("../virtual-keyboard/Amount"));
|
|
40
|
+
var import_locales = require("../../locales");
|
|
41
|
+
var import_index = require("./index.less");
|
|
42
|
+
var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
|
|
43
|
+
var PisellAdjustPrice = (props) => {
|
|
44
|
+
const { value, onChange, defaultValue, originValue, ...others } = props;
|
|
45
|
+
const config = (0, import_usePisellConfig.default)();
|
|
46
|
+
const [newValue, setNewValue] = (0, import_react.useState)(value || 0);
|
|
47
|
+
const [updateMode, setUpdateMode] = (0, import_react.useState)(
|
|
48
|
+
"priceOverride"
|
|
49
|
+
);
|
|
50
|
+
const [discountMode, setDiscountMode] = (0, import_react.useState)(
|
|
51
|
+
"amount"
|
|
52
|
+
);
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
document.body.id = "body";
|
|
55
|
+
}, []);
|
|
56
|
+
const handleEnter = () => {
|
|
57
|
+
if (isDiscountError) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (updateMode === "priceOverride") {
|
|
61
|
+
onChange == null ? void 0 : onChange(Number(newValue));
|
|
62
|
+
} else {
|
|
63
|
+
onChange == null ? void 0 : onChange(Number(totalAfterDiscount));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleChange = (val) => {
|
|
67
|
+
setNewValue(val);
|
|
68
|
+
};
|
|
69
|
+
const totalAfterDiscount = (0, import_react.useMemo)(() => {
|
|
70
|
+
if (discountMode === "amount") {
|
|
71
|
+
return originValue - Number(newValue || 0);
|
|
72
|
+
}
|
|
73
|
+
return originValue - originValue * (Number(newValue || 0) / 100);
|
|
74
|
+
}, [originValue, newValue, discountMode]);
|
|
75
|
+
const isDiscountError = (0, import_react.useMemo)(() => {
|
|
76
|
+
if (updateMode === "priceOverride") {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return totalAfterDiscount < 0;
|
|
80
|
+
}, [updateMode, totalAfterDiscount]);
|
|
81
|
+
const handleUpdateMode = (val) => {
|
|
82
|
+
setUpdateMode(val);
|
|
83
|
+
setNewValue(val === "priceOverride" ? value || 0 : "");
|
|
84
|
+
};
|
|
85
|
+
const inputFormat = (v) => {
|
|
86
|
+
if (updateMode === "priceOverride") {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (discountMode === "amount") {
|
|
90
|
+
return null;
|
|
91
|
+
} else {
|
|
92
|
+
return `${v}%`;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
import_antd.Segmented,
|
|
97
|
+
{
|
|
98
|
+
size: "large",
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
label: (0, import_locales.getText)("pisell-adjust-price-price-override"),
|
|
102
|
+
value: "priceOverride"
|
|
103
|
+
},
|
|
104
|
+
{ label: (0, import_locales.getText)("pisell-adjust-price-discount"), value: "discount" }
|
|
105
|
+
],
|
|
106
|
+
value: updateMode,
|
|
107
|
+
onChange: handleUpdateMode,
|
|
108
|
+
block: true
|
|
109
|
+
}
|
|
110
|
+
), updateMode === "discount" && /* @__PURE__ */ import_react.default.createElement(
|
|
111
|
+
import_antd.Segmented,
|
|
112
|
+
{
|
|
113
|
+
size: "large",
|
|
114
|
+
options: [
|
|
115
|
+
{
|
|
116
|
+
label: `${(0, import_locales.getText)("pisell-adjust-price-discount-amount")}(${(config == null ? void 0 : config.symbol) || "$"})`,
|
|
117
|
+
value: "amount"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: `${(0, import_locales.getText)("pisell-adjust-price-discount-percentage")}(%)`,
|
|
121
|
+
value: "percentage"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
value: discountMode,
|
|
125
|
+
onChange: (val) => {
|
|
126
|
+
setNewValue("");
|
|
127
|
+
setDiscountMode(val);
|
|
128
|
+
},
|
|
129
|
+
block: true
|
|
130
|
+
}
|
|
131
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-amount-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
132
|
+
import_Amount.default,
|
|
133
|
+
{
|
|
134
|
+
...others,
|
|
135
|
+
inputFormat,
|
|
136
|
+
defaultValue: updateMode === "priceOverride" ? defaultValue : "",
|
|
137
|
+
key: updateMode,
|
|
138
|
+
value: newValue,
|
|
139
|
+
defaultSelect: updateMode === "priceOverride",
|
|
140
|
+
onChange: handleChange,
|
|
141
|
+
onEnter: handleEnter,
|
|
142
|
+
placeholder: discountMode === "amount" ? "0" : "%"
|
|
143
|
+
}
|
|
144
|
+
)), updateMode === "discount" && /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-low-code-adjust-price-total" }, isDiscountError ? /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: originValue }) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, newValue && (0, import_locales.getText)("pisell-adjust-price-total-after-discount"), /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: totalAfterDiscount }))), /* @__PURE__ */ import_react.default.createElement(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: (0, import_classnames.default)("pisell-low-code-adjust-price-amount-desc", {
|
|
148
|
+
["pisell-low-code-adjust-price-amount-desc-error"]: isDiscountError
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
(0, import_locales.getText)("pisell-adjust-price-discount-can-be-maximum"),
|
|
152
|
+
" ",
|
|
153
|
+
discountMode === "amount" ? /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: originValue }) : "100%"
|
|
154
|
+
)));
|
|
155
|
+
};
|
|
156
|
+
var pisellAdjustPrice_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
|
+
}
|
|
@@ -34,6 +34,7 @@ __export(segmented_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(segmented_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
|
+
var import_index = require("./index.less");
|
|
37
38
|
var Segmented = (props) => {
|
|
38
39
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Segmented, { ...props });
|
|
39
40
|
};
|
|
@@ -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,96 @@
|
|
|
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/virtual-keyboard/Amount/index.tsx
|
|
30
|
+
var Amount_exports = {};
|
|
31
|
+
__export(Amount_exports, {
|
|
32
|
+
default: () => Amount_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Amount_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
|
+
var import_BaseNumberKeyboard = __toESM(require("../BaseNumberKeyboard"));
|
|
38
|
+
var import_pisellText = __toESM(require("../../pisellText"));
|
|
39
|
+
var Amount = (props) => {
|
|
40
|
+
const {
|
|
41
|
+
min,
|
|
42
|
+
max,
|
|
43
|
+
amountProps,
|
|
44
|
+
doneText,
|
|
45
|
+
resetText,
|
|
46
|
+
defaultValue,
|
|
47
|
+
placeholder,
|
|
48
|
+
onEnter,
|
|
49
|
+
presets,
|
|
50
|
+
defaultSelect,
|
|
51
|
+
inputFormat
|
|
52
|
+
} = props;
|
|
53
|
+
const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
|
|
54
|
+
defaultValue: defaultValue || ""
|
|
55
|
+
});
|
|
56
|
+
(0, import_react.useEffect)(() => {
|
|
57
|
+
document.body.id = "body";
|
|
58
|
+
}, []);
|
|
59
|
+
const format = (_v) => {
|
|
60
|
+
const v = `${_v}`;
|
|
61
|
+
if (inputFormat == null ? void 0 : inputFormat(v)) {
|
|
62
|
+
return inputFormat == null ? void 0 : inputFormat(v);
|
|
63
|
+
}
|
|
64
|
+
const precision = v.includes(".") ? v.split(".")[1].length : 0;
|
|
65
|
+
const endWith = v.endsWith(".");
|
|
66
|
+
const value2 = endWith ? v.slice(0, -1) : v;
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
import_pisellText.default.Amount,
|
|
69
|
+
{
|
|
70
|
+
value: value2,
|
|
71
|
+
precision,
|
|
72
|
+
hideDecimalForWholeNumbers: false,
|
|
73
|
+
showCurrencySymbol: amountProps == null ? void 0 : amountProps.showCurrencySymbol,
|
|
74
|
+
useThousandsSeparator: amountProps == null ? void 0 : amountProps.useThousandsSeparator
|
|
75
|
+
}
|
|
76
|
+
), endWith && ".");
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
79
|
+
import_BaseNumberKeyboard.default,
|
|
80
|
+
{
|
|
81
|
+
defaultSelect,
|
|
82
|
+
max,
|
|
83
|
+
min,
|
|
84
|
+
value,
|
|
85
|
+
onChange: setValue,
|
|
86
|
+
placeholder,
|
|
87
|
+
defaultValue,
|
|
88
|
+
format,
|
|
89
|
+
doneText,
|
|
90
|
+
resetText,
|
|
91
|
+
onEnter,
|
|
92
|
+
presets
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
var Amount_default = Amount;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "./Presets.less";
|
|
3
|
+
export declare type PresetsItem = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number | string;
|
|
6
|
+
};
|
|
7
|
+
export interface PresetsProps {
|
|
8
|
+
presets?: PresetsItem[];
|
|
9
|
+
onChange: (val: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const Presets: (props: PresetsProps) => React.JSX.Element | null;
|
|
12
|
+
export default Presets;
|
|
@@ -0,0 +1,46 @@
|
|
|
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/virtual-keyboard/BaseNumberKeyboard/Presets.tsx
|
|
30
|
+
var Presets_exports = {};
|
|
31
|
+
__export(Presets_exports, {
|
|
32
|
+
default: () => Presets_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Presets_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_Presets = require("./Presets.less");
|
|
37
|
+
var Presets = (props) => {
|
|
38
|
+
const { presets, onChange } = props;
|
|
39
|
+
return (0, import_react.useMemo)(() => {
|
|
40
|
+
if (!(presets == null ? void 0 : presets.length)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-keyboard-preset" }, presets.map((item) => /* @__PURE__ */ import_react.default.createElement("div", { onClick: () => onChange(`${item.value}`), className: "pisell-virtual-keyboard-preset-item" }, item.label)));
|
|
44
|
+
}, [presets]);
|
|
45
|
+
};
|
|
46
|
+
var Presets_default = Presets;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.pisell-virtual-keyboard-preset {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 7px;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
margin-bottom: 8px;
|
|
6
|
+
.pisell-virtual-keyboard-preset-item {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex: 1;
|
|
9
|
+
padding: 12px 20px;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
height: 48px;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
border: 1px solid var(--Gray-300, #D0D5DD);
|
|
15
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
16
|
+
background: var(--Primary-25, #FCFAFF);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PresetsProps } from "./Presets";
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface BaseNumberKeyboardProps {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
format?: (val: string) => React.ReactNode;
|
|
7
|
+
defaultValue?: string | number;
|
|
8
|
+
doneText?: string;
|
|
9
|
+
resetText?: string;
|
|
10
|
+
onChange?: (val: string) => void;
|
|
11
|
+
onEnter?: (val: string) => void;
|
|
12
|
+
value?: string | number;
|
|
13
|
+
max?: number;
|
|
14
|
+
min?: number;
|
|
15
|
+
presets?: PresetsProps['presets'];
|
|
16
|
+
defaultSelect?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const BaseNumberKeyboard: (props: BaseNumberKeyboardProps) => React.JSX.Element;
|
|
19
|
+
export default BaseNumberKeyboard;
|