@pisell/private-materials 6.8.86 → 6.8.87
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 +1 -1
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/components/customiseItemModal/index.js +4 -7
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/deposit/index.d.ts +0 -1
- package/es/components/booking/info/index.d.ts +0 -1
- package/es/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +4 -4
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/es/plus/saasLogin/utils.d.ts +5 -5
- package/es/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/utils/transformBundleGroup.js +5 -0
- package/es/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +1 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/pro/NumericStepper/index.d.ts +21 -1
- package/es/pro/NumericStepper/index.js +74 -66
- package/es/pro/NumericStepper/index.less +289 -136
- package/es/pro/Selector/demo.d.ts +0 -1
- package/es/pro/Selector/hooks/usePresetProps.js +2 -1
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +24 -0
- package/es/pro/keyboards/locales.js +35 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +524 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +2 -1
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +2 -1
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +0 -1
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +6 -3
- package/es/pro/skuDetailModal/index.js +6 -8
- package/es/pro/skuDetailModal/index.less +4 -4
- package/lib/components/booking/components/customiseItemModal/index.js +4 -5
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/deposit/index.d.ts +0 -1
- package/lib/components/booking/info/index.d.ts +0 -1
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +4 -4
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/lib/plus/saasLogin/utils.d.ts +5 -5
- package/lib/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/utils/transformBundleGroup.js +5 -0
- package/lib/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +1 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/pro/NumericStepper/index.d.ts +21 -1
- package/lib/pro/NumericStepper/index.js +67 -69
- package/lib/pro/NumericStepper/index.less +289 -136
- package/lib/pro/Selector/demo.d.ts +0 -1
- package/lib/pro/Selector/hooks/usePresetProps.js +2 -1
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +24 -0
- package/lib/pro/keyboards/locales.js +47 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +2 -1
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +2 -1
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +0 -1
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +6 -3
- package/lib/pro/skuDetailModal/index.js +94 -41
- package/lib/pro/skuDetailModal/index.less +4 -4
- package/package.json +1 -1
- package/es/pro/pisellNumberSelector/example.d.ts +0 -3
- package/es/pro/pisellNumberSelector/example.js +0 -68
- package/lib/pro/pisellNumberSelector/example.d.ts +0 -3
- package/lib/pro/pisellNumberSelector/example.js +0 -93
|
@@ -0,0 +1,400 @@
|
|
|
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/pro/keyboards/numberKeyboard/index.tsx
|
|
30
|
+
var numberKeyboard_exports = {};
|
|
31
|
+
__export(numberKeyboard_exports, {
|
|
32
|
+
NumberKeyboardBase: () => NumberKeyboardBase,
|
|
33
|
+
default: () => numberKeyboard_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(numberKeyboard_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_ahooks = require("ahooks");
|
|
40
|
+
var import_materials = require("@pisell/materials");
|
|
41
|
+
var import_utils = require("@pisell/utils");
|
|
42
|
+
var import_virtualInput = __toESM(require("../../../../../materials/src/components/virtualInput"));
|
|
43
|
+
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
44
|
+
var import_locales = __toESM(require("../locales"));
|
|
45
|
+
var import_index = require("./index.less");
|
|
46
|
+
var generateSimpleUUID = () => {
|
|
47
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
48
|
+
};
|
|
49
|
+
var NumberKeyboardBase = (props) => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const {
|
|
52
|
+
mode = "integer",
|
|
53
|
+
originalValue = "",
|
|
54
|
+
placeholder = "",
|
|
55
|
+
max,
|
|
56
|
+
min,
|
|
57
|
+
maxLength,
|
|
58
|
+
precision = 2,
|
|
59
|
+
disabled = false,
|
|
60
|
+
doneText,
|
|
61
|
+
resetText,
|
|
62
|
+
clearText,
|
|
63
|
+
label,
|
|
64
|
+
errorText,
|
|
65
|
+
style,
|
|
66
|
+
className,
|
|
67
|
+
keydown = true,
|
|
68
|
+
inputStyle,
|
|
69
|
+
inputWrapperStyle,
|
|
70
|
+
onEnter,
|
|
71
|
+
onReset
|
|
72
|
+
} = props;
|
|
73
|
+
const context = (0, import_useEngineContext.default)();
|
|
74
|
+
import_utils.locales.init(import_locales.default, ((_b = (_a = context == null ? void 0 : context.engine) == null ? void 0 : _a.props) == null ? void 0 : _b.locale) || "en");
|
|
75
|
+
const [internalValue, setInternalValue] = (0, import_ahooks.useControllableValue)(
|
|
76
|
+
props,
|
|
77
|
+
{
|
|
78
|
+
defaultValue: ""
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
const uniqueKeyboardId = (0, import_react.useMemo)(() => {
|
|
82
|
+
return `number-keyboard-${generateSimpleUUID()}`;
|
|
83
|
+
}, []);
|
|
84
|
+
const [isSelected, setIsSelected] = (0, import_react.useState)(!!internalValue);
|
|
85
|
+
(0, import_react.useEffect)(() => {
|
|
86
|
+
if (internalValue) {
|
|
87
|
+
setIsSelected(true);
|
|
88
|
+
}
|
|
89
|
+
}, []);
|
|
90
|
+
const isOutOfRange = (0, import_react.useMemo)(() => {
|
|
91
|
+
if (!internalValue) return false;
|
|
92
|
+
const numValue = parseFloat(internalValue);
|
|
93
|
+
if (isNaN(numValue)) return false;
|
|
94
|
+
if (max !== void 0 && numValue > max) return true;
|
|
95
|
+
if (min !== void 0 && numValue < min) return true;
|
|
96
|
+
return false;
|
|
97
|
+
}, [internalValue, max, min]);
|
|
98
|
+
const errorMessage = (0, import_react.useMemo)(() => {
|
|
99
|
+
if (!isOutOfRange) return "";
|
|
100
|
+
if (errorText) return errorText;
|
|
101
|
+
const numValue = parseFloat(internalValue);
|
|
102
|
+
if (max !== void 0 && numValue > max) {
|
|
103
|
+
return import_utils.locales.getText("pisell2.keyboard.number-keybard.max")(max);
|
|
104
|
+
}
|
|
105
|
+
if (min !== void 0 && numValue < min) {
|
|
106
|
+
return import_utils.locales.getText("pisell2.keyboard.number-keybard.min")(min);
|
|
107
|
+
}
|
|
108
|
+
return "";
|
|
109
|
+
}, [isOutOfRange, errorText, internalValue, max, min]);
|
|
110
|
+
const handleValueChange = (0, import_react.useCallback)(
|
|
111
|
+
(newValue) => {
|
|
112
|
+
if (isSelected && newValue !== "") {
|
|
113
|
+
setIsSelected(false);
|
|
114
|
+
}
|
|
115
|
+
setInternalValue(newValue);
|
|
116
|
+
},
|
|
117
|
+
[isSelected, setInternalValue]
|
|
118
|
+
);
|
|
119
|
+
const handleDelete = (0, import_react.useCallback)(() => {
|
|
120
|
+
if (isSelected) {
|
|
121
|
+
handleValueChange("");
|
|
122
|
+
setIsSelected(false);
|
|
123
|
+
} else if (internalValue.length > 0) {
|
|
124
|
+
handleValueChange(internalValue.slice(0, -1));
|
|
125
|
+
}
|
|
126
|
+
}, [internalValue, isSelected, handleValueChange]);
|
|
127
|
+
const handleClear = (0, import_react.useCallback)(() => {
|
|
128
|
+
handleValueChange("");
|
|
129
|
+
setIsSelected(false);
|
|
130
|
+
}, [handleValueChange]);
|
|
131
|
+
const handleReset = (0, import_react.useCallback)(() => {
|
|
132
|
+
setInternalValue(String(originalValue));
|
|
133
|
+
setIsSelected(true);
|
|
134
|
+
onReset == null ? void 0 : onReset();
|
|
135
|
+
}, [originalValue, setInternalValue, onReset]);
|
|
136
|
+
const handleDone = (0, import_react.useCallback)(() => {
|
|
137
|
+
if (isOutOfRange) return;
|
|
138
|
+
onEnter == null ? void 0 : onEnter(internalValue);
|
|
139
|
+
}, [internalValue, isOutOfRange, onEnter]);
|
|
140
|
+
const handleNumberInput = (0, import_react.useCallback)(
|
|
141
|
+
(num) => {
|
|
142
|
+
let newValue;
|
|
143
|
+
if (isSelected) {
|
|
144
|
+
newValue = num;
|
|
145
|
+
setIsSelected(false);
|
|
146
|
+
} else {
|
|
147
|
+
newValue = internalValue + num;
|
|
148
|
+
}
|
|
149
|
+
if (maxLength && newValue.replace(".", "").length > maxLength) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (mode === "integer" && newValue.includes(".")) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (mode === "decimal" && newValue.includes(".")) {
|
|
156
|
+
const parts = newValue.split(".");
|
|
157
|
+
if (parts[1] && parts[1].length > precision) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (num === "." && internalValue.includes(".")) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (newValue.length > 1 && newValue.startsWith("0") && !newValue.startsWith("0.")) {
|
|
165
|
+
newValue = newValue.replace(/^0+/, "") || "0";
|
|
166
|
+
}
|
|
167
|
+
if (num === "00") {
|
|
168
|
+
if (internalValue === "" || internalValue === "0") {
|
|
169
|
+
newValue = "0";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
handleValueChange(newValue);
|
|
173
|
+
},
|
|
174
|
+
[internalValue, isSelected, maxLength, mode, precision, handleValueChange]
|
|
175
|
+
);
|
|
176
|
+
const handleKeyboardChange = (0, import_react.useCallback)(
|
|
177
|
+
(key) => {
|
|
178
|
+
if (key === void 0) return;
|
|
179
|
+
const keyStr = String(key);
|
|
180
|
+
switch (keyStr) {
|
|
181
|
+
case "delete":
|
|
182
|
+
case "backspace":
|
|
183
|
+
handleDelete();
|
|
184
|
+
break;
|
|
185
|
+
case "clear":
|
|
186
|
+
handleClear();
|
|
187
|
+
break;
|
|
188
|
+
case "reset":
|
|
189
|
+
handleReset();
|
|
190
|
+
break;
|
|
191
|
+
case "done":
|
|
192
|
+
case "ok":
|
|
193
|
+
handleDone();
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
if (/^[0-9.]$/.test(keyStr) || keyStr === "00") {
|
|
197
|
+
handleNumberInput(keyStr);
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
[handleDelete, handleClear, handleReset, handleDone, handleNumberInput]
|
|
203
|
+
);
|
|
204
|
+
const integerKeyboardItems = (0, import_react.useMemo)(() => {
|
|
205
|
+
return [
|
|
206
|
+
{ value: 1, label: "1", disabled: false, type: "text" },
|
|
207
|
+
{ value: 2, label: "2", disabled: false, type: "text" },
|
|
208
|
+
{ value: 3, label: "3", disabled: false, type: "text" },
|
|
209
|
+
{ value: 4, label: "4", disabled: false, type: "text" },
|
|
210
|
+
{ value: 5, label: "5", disabled: false, type: "text" },
|
|
211
|
+
{ value: 6, label: "6", disabled: false, type: "text" },
|
|
212
|
+
{ value: 7, label: "7", disabled: false, type: "text" },
|
|
213
|
+
{ value: 8, label: "8", disabled: false, type: "text" },
|
|
214
|
+
{ value: 9, label: "9", disabled: false, type: "text" },
|
|
215
|
+
{
|
|
216
|
+
value: "reset",
|
|
217
|
+
label: resetText || import_utils.locales.getText("pisell2.keyboard.number-keybard.reset"),
|
|
218
|
+
disabled: false,
|
|
219
|
+
type: "text",
|
|
220
|
+
style: { color: "#F04438", fontSize: 18 }
|
|
221
|
+
},
|
|
222
|
+
{ value: 0, label: "0", disabled: false, type: "text" },
|
|
223
|
+
{
|
|
224
|
+
value: "done",
|
|
225
|
+
label: doneText || import_utils.locales.getText("pisell2.keyboard.number-keybard.ok"),
|
|
226
|
+
disabled: isOutOfRange,
|
|
227
|
+
type: "primary",
|
|
228
|
+
style: { fontSize: 18 }
|
|
229
|
+
}
|
|
230
|
+
];
|
|
231
|
+
}, [resetText, doneText, isOutOfRange]);
|
|
232
|
+
const decimalKeyboardItems = (0, import_react.useMemo)(() => {
|
|
233
|
+
return [
|
|
234
|
+
{ value: 1, label: "1", disabled: false, type: "text" },
|
|
235
|
+
{ value: 2, label: "2", disabled: false, type: "text" },
|
|
236
|
+
{ value: 3, label: "3", disabled: false, type: "text" },
|
|
237
|
+
{ value: 4, label: "4", disabled: false, type: "text" },
|
|
238
|
+
{ value: 5, label: "5", disabled: false, type: "text" },
|
|
239
|
+
{ value: 6, label: "6", disabled: false, type: "text" },
|
|
240
|
+
{ value: 7, label: "7", disabled: false, type: "text" },
|
|
241
|
+
{ value: 8, label: "8", disabled: false, type: "text" },
|
|
242
|
+
{ value: 9, label: "9", disabled: false, type: "text" },
|
|
243
|
+
{ value: 0, label: "0", disabled: false, type: "text" },
|
|
244
|
+
{ value: "00", label: "00", disabled: false, type: "text" },
|
|
245
|
+
{ value: ".", label: ".", disabled: false, type: "text" }
|
|
246
|
+
];
|
|
247
|
+
}, []);
|
|
248
|
+
const decimalRightItems = (0, import_react.useMemo)(() => {
|
|
249
|
+
return [
|
|
250
|
+
{
|
|
251
|
+
value: "clear",
|
|
252
|
+
label: clearText || import_utils.locales.getText("pisell2.keyboard.number-keybard.clear"),
|
|
253
|
+
disabled: false,
|
|
254
|
+
type: "text",
|
|
255
|
+
size: 1,
|
|
256
|
+
style: { fontSize: 18 }
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
value: "reset",
|
|
260
|
+
label: resetText || import_utils.locales.getText("pisell2.keyboard.number-keybard.reset"),
|
|
261
|
+
disabled: false,
|
|
262
|
+
type: "text",
|
|
263
|
+
size: 1,
|
|
264
|
+
style: { color: "#F04438", fontSize: 18 }
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
value: "done",
|
|
268
|
+
label: doneText || import_utils.locales.getText("pisell2.keyboard.number-keybard.ok"),
|
|
269
|
+
disabled: isOutOfRange,
|
|
270
|
+
type: "primary",
|
|
271
|
+
size: 2,
|
|
272
|
+
style: { fontSize: 18 }
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
}, [clearText, resetText, doneText, isOutOfRange]);
|
|
276
|
+
const displayValue = (0, import_react.useMemo)(() => {
|
|
277
|
+
return internalValue || "";
|
|
278
|
+
}, [internalValue]);
|
|
279
|
+
const renderBottomContent = (0, import_react.useCallback)(() => {
|
|
280
|
+
if (isOutOfRange && errorMessage) {
|
|
281
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-number-keyboard-error-message" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-alert-circle", size: 16 }), errorMessage);
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
}, [errorMessage]);
|
|
285
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
className: (0, import_classnames.default)(
|
|
289
|
+
"pisell-number-keyboard",
|
|
290
|
+
`pisell-number-keyboard--${mode}`,
|
|
291
|
+
{
|
|
292
|
+
"pisell-number-keyboard--disabled": disabled
|
|
293
|
+
},
|
|
294
|
+
className
|
|
295
|
+
),
|
|
296
|
+
style
|
|
297
|
+
},
|
|
298
|
+
label && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-number-keyboard-label" }, label),
|
|
299
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-number-keyboard-input-wrapper") }, /* @__PURE__ */ import_react.default.createElement(
|
|
300
|
+
import_virtualInput.default,
|
|
301
|
+
{
|
|
302
|
+
focused: !disabled,
|
|
303
|
+
selected: isSelected && !!internalValue,
|
|
304
|
+
value: displayValue,
|
|
305
|
+
placeholder,
|
|
306
|
+
wrapperStyle: {
|
|
307
|
+
flex: 1,
|
|
308
|
+
padding: "19px 16px",
|
|
309
|
+
borderRadius: "8px",
|
|
310
|
+
backgroundColor: "white",
|
|
311
|
+
boxShadow: "0px 1px 2px rgba(16, 24, 40, 0.06)",
|
|
312
|
+
overflow: "hidden",
|
|
313
|
+
...inputWrapperStyle
|
|
314
|
+
},
|
|
315
|
+
style: {
|
|
316
|
+
fontSize: "48px",
|
|
317
|
+
fontWeight: "bold",
|
|
318
|
+
border: "none",
|
|
319
|
+
background: "transparent",
|
|
320
|
+
width: "100%",
|
|
321
|
+
color: isOutOfRange ? "#D92D20" : void 0,
|
|
322
|
+
...inputStyle
|
|
323
|
+
},
|
|
324
|
+
preventBlurElements: [`#${uniqueKeyboardId}`],
|
|
325
|
+
allowClear: true,
|
|
326
|
+
onClear: handleDelete,
|
|
327
|
+
textAlign: "center"
|
|
328
|
+
}
|
|
329
|
+
), renderBottomContent()),
|
|
330
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
331
|
+
import_materials.Keyboard,
|
|
332
|
+
{
|
|
333
|
+
id: uniqueKeyboardId,
|
|
334
|
+
className: (0, import_classnames.default)("pisell-number-keyboard-keys", {
|
|
335
|
+
"pisell-number-keyboard-keys--integer": mode === "integer",
|
|
336
|
+
"pisell-number-keyboard-keys--decimal": mode === "decimal"
|
|
337
|
+
}),
|
|
338
|
+
items: mode === "integer" ? integerKeyboardItems : decimalKeyboardItems,
|
|
339
|
+
rightItems: mode === "decimal" ? decimalRightItems : void 0,
|
|
340
|
+
keydown,
|
|
341
|
+
onChange: handleKeyboardChange
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
);
|
|
345
|
+
};
|
|
346
|
+
var NumberKeyboard = (props) => {
|
|
347
|
+
const { containerProps, children, ...keyboardProps } = props;
|
|
348
|
+
if (!containerProps) {
|
|
349
|
+
return /* @__PURE__ */ import_react.default.createElement(NumberKeyboardBase, { ...keyboardProps });
|
|
350
|
+
}
|
|
351
|
+
const { renderType, open, className, ...restProps } = containerProps || {};
|
|
352
|
+
if (renderType === "popover") {
|
|
353
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
354
|
+
import_antd.Popover,
|
|
355
|
+
{
|
|
356
|
+
key: `${open}`,
|
|
357
|
+
open,
|
|
358
|
+
trigger: ["click"],
|
|
359
|
+
overlayClassName: (0, import_classnames.default)(
|
|
360
|
+
"pisell-number-keyboard-popover",
|
|
361
|
+
className
|
|
362
|
+
),
|
|
363
|
+
destroyTooltipOnHide: true,
|
|
364
|
+
overlayInnerStyle: {
|
|
365
|
+
padding: 0
|
|
366
|
+
},
|
|
367
|
+
arrow: false,
|
|
368
|
+
...restProps,
|
|
369
|
+
content: /* @__PURE__ */ import_react.default.createElement(NumberKeyboardBase, { ...keyboardProps })
|
|
370
|
+
},
|
|
371
|
+
children
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
if (renderType === "modal") {
|
|
375
|
+
return open ? /* @__PURE__ */ import_react.default.createElement(
|
|
376
|
+
import_materials.PisellModal,
|
|
377
|
+
{
|
|
378
|
+
platform: "pc",
|
|
379
|
+
open: true,
|
|
380
|
+
width: "unset",
|
|
381
|
+
header: null,
|
|
382
|
+
footer: false,
|
|
383
|
+
mask: false,
|
|
384
|
+
maskClosable: true,
|
|
385
|
+
bodyStyle: { padding: "0px", backgroundColor: "transparent" },
|
|
386
|
+
closeIcon: null,
|
|
387
|
+
className: (0, import_classnames.default)("pisell-number-keyboard-modal", className),
|
|
388
|
+
destroyOnHidden: true,
|
|
389
|
+
...restProps
|
|
390
|
+
},
|
|
391
|
+
/* @__PURE__ */ import_react.default.createElement(NumberKeyboardBase, { ...keyboardProps })
|
|
392
|
+
) : null;
|
|
393
|
+
}
|
|
394
|
+
return /* @__PURE__ */ import_react.default.createElement(NumberKeyboardBase, { ...keyboardProps });
|
|
395
|
+
};
|
|
396
|
+
var numberKeyboard_default = NumberKeyboard;
|
|
397
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
398
|
+
0 && (module.exports = {
|
|
399
|
+
NumberKeyboardBase
|
|
400
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.pisell-number-keyboard-modal {
|
|
2
|
+
.ant-moda-content,
|
|
3
|
+
.pisell-lowcode-modal-content {
|
|
4
|
+
background-color: transparent;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.pisell-number-keyboard-popover {
|
|
9
|
+
.ant-popover-inner,
|
|
10
|
+
.pisell-lowcode-popover-inner {
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pisell-number-keyboard {
|
|
16
|
+
padding: 10px;
|
|
17
|
+
border-radius: 10px;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
22
|
+
width: 344px;
|
|
23
|
+
|
|
24
|
+
&--disabled {
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
opacity: 0.6;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-label {
|
|
30
|
+
font-size: 20px;
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
color: #fff;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-error-message {
|
|
36
|
+
user-select: none;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
color: #d92d20;
|
|
39
|
+
line-height: 18px;
|
|
40
|
+
padding: 0 4px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.pisell-number-keyboard-input-wrapper {
|
|
45
|
+
position: relative;
|
|
46
|
+
|
|
47
|
+
.pisell-number-keyboard-error-message {
|
|
48
|
+
position: absolute;
|
|
49
|
+
bottom: 0;
|
|
50
|
+
left: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
color: #f04438;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
gap: 4px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type NumberKeyboardMode = 'integer' | 'decimal';
|
|
3
|
+
export interface NumberKeyboardBaseProps {
|
|
4
|
+
/** 模式:整数 or 小数 */
|
|
5
|
+
mode?: NumberKeyboardMode;
|
|
6
|
+
/** 当前值(受控) */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** 默认值(非受控) */
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/** 原始值,用于重置 */
|
|
11
|
+
originalValue?: string;
|
|
12
|
+
/** 占位符 */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** 最大值 */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** 最小值 */
|
|
17
|
+
min?: number;
|
|
18
|
+
/** 最大长度 */
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
/** 小数位数,默认 2 */
|
|
21
|
+
precision?: number;
|
|
22
|
+
/** 是否禁用 */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** 确认按钮文本 */
|
|
25
|
+
doneText?: string;
|
|
26
|
+
/** 重置按钮文本 */
|
|
27
|
+
resetText?: string;
|
|
28
|
+
/** 清空按钮文本 */
|
|
29
|
+
clearText?: string;
|
|
30
|
+
/** 标签文本(显示在输入框上方) */
|
|
31
|
+
label?: string;
|
|
32
|
+
/** 超出范围时的提示文本 */
|
|
33
|
+
errorText?: string;
|
|
34
|
+
/** 值变化回调 */
|
|
35
|
+
onChange?: (value: string) => void;
|
|
36
|
+
/** 确认按钮点击回调 */
|
|
37
|
+
onEnter?: (value: string) => void;
|
|
38
|
+
/** 重置按钮点击回调 */
|
|
39
|
+
onReset?: () => void;
|
|
40
|
+
/** 外层样式 */
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
/** 自定义类名 */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** 键盘是否监听物理键盘 */
|
|
45
|
+
keydown?: boolean;
|
|
46
|
+
/** 输入框样式 */
|
|
47
|
+
inputStyle?: React.CSSProperties;
|
|
48
|
+
/** 输入框包裹样式 */
|
|
49
|
+
inputWrapperStyle?: React.CSSProperties;
|
|
50
|
+
}
|
|
51
|
+
export interface NumberKeyboardProps extends NumberKeyboardBaseProps {
|
|
52
|
+
/** 容器配置,用于控制键盘以 popover 或 modal 形态展示 */
|
|
53
|
+
containerProps?: {
|
|
54
|
+
/** 渲染类型:popover 或 modal */
|
|
55
|
+
renderType: 'modal' | 'popover';
|
|
56
|
+
/** 是否打开(受控模式) */
|
|
57
|
+
open?: boolean;
|
|
58
|
+
/** 其他传递给 Popover 或 Modal 的属性 */
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
/** 子元素,用于 popover 模式的触发器 */
|
|
62
|
+
children?: React.ReactNode;
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/pro/keyboards/numberKeyboard/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -238,7 +238,8 @@ var CashKeyboardBase = (props) => {
|
|
|
238
238
|
background: "transparent",
|
|
239
239
|
width: "100%"
|
|
240
240
|
},
|
|
241
|
-
preventBlurElements: [`#${uniqueKeyboardId}`, shortcutsRef]
|
|
241
|
+
preventBlurElements: [`#${uniqueKeyboardId}`, shortcutsRef],
|
|
242
|
+
selected: isFirstInput && !!internalValue
|
|
242
243
|
}
|
|
243
244
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
244
245
|
"div",
|
|
@@ -261,7 +261,8 @@ var DiscountKeyboardBase = (props) => {
|
|
|
261
261
|
color: _color
|
|
262
262
|
},
|
|
263
263
|
placeholder,
|
|
264
|
-
bottomContent: renderBottomContent()
|
|
264
|
+
bottomContent: renderBottomContent(),
|
|
265
|
+
selected: isFirstInput && updateMode === "priceOverride" && !!internalValue
|
|
265
266
|
}
|
|
266
267
|
),
|
|
267
268
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -324,7 +324,8 @@ var PaymentKeyboardBase = (props) => {
|
|
|
324
324
|
padding: 16
|
|
325
325
|
},
|
|
326
326
|
bottomContent: renderBottomContent(),
|
|
327
|
-
preventBlurElements: [uniqueKeyboardId]
|
|
327
|
+
preventBlurElements: [uniqueKeyboardId],
|
|
328
|
+
selected: firstInputStatus.payment && !!internalPaymentValue
|
|
328
329
|
}
|
|
329
330
|
);
|
|
330
331
|
};
|
|
@@ -354,7 +355,8 @@ var PaymentKeyboardBase = (props) => {
|
|
|
354
355
|
justifyContent: "center"
|
|
355
356
|
},
|
|
356
357
|
onFocus: () => setFocusedInput(KEYS.PERCENT),
|
|
357
|
-
preventBlurElements: [uniqueKeyboardId]
|
|
358
|
+
preventBlurElements: [uniqueKeyboardId],
|
|
359
|
+
selected: firstInputStatus.percent && !!(internalSurchargeValue == null ? void 0 : internalSurchargeValue.percent) && focusedInput !== KEYS.FIXED
|
|
358
360
|
}
|
|
359
361
|
),
|
|
360
362
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -383,7 +385,8 @@ var PaymentKeyboardBase = (props) => {
|
|
|
383
385
|
justifyContent: "center"
|
|
384
386
|
},
|
|
385
387
|
onFocus: () => setFocusedInput(KEYS.FIXED),
|
|
386
|
-
preventBlurElements: [uniqueKeyboardId]
|
|
388
|
+
preventBlurElements: [uniqueKeyboardId],
|
|
389
|
+
selected: firstInputStatus.fixed && !!(internalSurchargeValue == null ? void 0 : internalSurchargeValue.fixed) && focusedInput === KEYS.FIXED
|
|
387
390
|
}
|
|
388
391
|
)
|
|
389
392
|
);
|