@pisell/private-materials 6.6.59 → 6.6.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/components/footer/utils.js +79 -75
  12. package/es/components/eftposPay/hooks.d.ts +1 -1
  13. package/es/components/eftposPay/store/index.d.ts +2 -2
  14. package/es/components/index.d.ts +2 -1
  15. package/es/components/index.js +2 -1
  16. package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
  17. package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
  18. package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
  19. package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
  20. package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
  21. package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
  22. package/es/components/pisellCashCounting/hooks.d.ts +21 -0
  23. package/es/components/pisellCashCounting/hooks.js +193 -0
  24. package/es/components/pisellCashCounting/index.d.ts +2 -0
  25. package/es/components/pisellCashCounting/index.js +1 -0
  26. package/es/components/pisellCashCounting/locales.d.ts +118 -0
  27. package/es/components/pisellCashCounting/locales.js +117 -0
  28. package/es/components/pisellCashCounting/types.d.ts +85 -0
  29. package/es/components/pisellCashCounting/types.js +1 -0
  30. package/es/components/pisellCashCounting/utils.d.ts +10 -0
  31. package/es/components/pisellCashCounting/utils.js +40 -0
  32. package/es/hooks/useResponsive.d.ts +8 -0
  33. package/es/hooks/useResponsive.js +43 -0
  34. package/es/hooks/useThemeTokens.d.ts +7 -0
  35. package/es/hooks/useThemeTokens.js +20 -0
  36. package/es/index.d.ts +1 -0
  37. package/es/index.js +2 -1
  38. package/es/pro/NumericStepper/index.d.ts +75 -0
  39. package/es/pro/NumericStepper/index.js +301 -0
  40. package/es/pro/NumericStepper/index.less +364 -0
  41. package/es/pro/keyboards/index.d.ts +2 -0
  42. package/es/pro/keyboards/index.js +1 -0
  43. package/es/pro/keyboards/locales.d.ts +38 -0
  44. package/es/pro/keyboards/locales.js +57 -0
  45. package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
  46. package/es/pro/keyboards/numberKeyboard/index.js +523 -0
  47. package/es/pro/keyboards/numberKeyboard/index.less +59 -0
  48. package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
  49. package/es/pro/keyboards/numberKeyboard/types.js +1 -0
  50. package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
  51. package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
  52. package/lib/components/booking/components/footer/utils.js +6 -3
  53. package/lib/components/eftposPay/hooks.d.ts +1 -1
  54. package/lib/components/eftposPay/store/index.d.ts +2 -2
  55. package/lib/components/index.d.ts +2 -1
  56. package/lib/components/index.js +3 -0
  57. package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
  58. package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
  59. package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
  60. package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
  61. package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
  62. package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
  63. package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
  64. package/lib/components/pisellCashCounting/hooks.js +189 -0
  65. package/lib/components/pisellCashCounting/index.d.ts +2 -0
  66. package/lib/components/pisellCashCounting/index.js +35 -0
  67. package/lib/components/pisellCashCounting/locales.d.ts +118 -0
  68. package/lib/components/pisellCashCounting/locales.js +141 -0
  69. package/lib/components/pisellCashCounting/types.d.ts +85 -0
  70. package/lib/components/pisellCashCounting/types.js +17 -0
  71. package/lib/components/pisellCashCounting/utils.d.ts +10 -0
  72. package/lib/components/pisellCashCounting/utils.js +59 -0
  73. package/lib/hooks/useResponsive.d.ts +8 -0
  74. package/lib/hooks/useResponsive.js +48 -0
  75. package/lib/hooks/useThemeTokens.d.ts +7 -0
  76. package/lib/hooks/useThemeTokens.js +40 -0
  77. package/lib/index.d.ts +1 -0
  78. package/lib/index.js +3 -0
  79. package/lib/pro/NumericStepper/index.d.ts +75 -0
  80. package/lib/pro/NumericStepper/index.js +338 -0
  81. package/lib/pro/NumericStepper/index.less +364 -0
  82. package/lib/pro/keyboards/index.d.ts +2 -0
  83. package/lib/pro/keyboards/index.js +39 -0
  84. package/lib/pro/keyboards/locales.d.ts +38 -0
  85. package/lib/pro/keyboards/locales.js +61 -0
  86. package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
  87. package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
  88. package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
  89. package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
  90. package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
  91. package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
  92. package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
  93. package/lowcode/pisell-cash-counting/meta.ts +167 -0
  94. package/lowcode/pisell-cash-counting/snippets.ts +13 -0
  95. package/package.json +4 -4
@@ -0,0 +1,38 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell2.keyboard.number-keybard.max': (max: number | string) => string;
4
+ 'pisell2.keyboard.number-keybard.min': (min: number | string) => string;
5
+ 'pisell2.keyboard.number-keybard.ok': string;
6
+ 'pisell2.keyboard.number-keybard.reset': string;
7
+ 'pisell2.keyboard.number-keybard.clear': string;
8
+ };
9
+ 'zh-CN': {
10
+ 'pisell2.keyboard.number-keybard.max': (max: number | string) => string;
11
+ 'pisell2.keyboard.number-keybard.min': (min: number | string) => string;
12
+ 'pisell2.keyboard.number-keybard.ok': string;
13
+ 'pisell2.keyboard.number-keybard.reset': string;
14
+ 'pisell2.keyboard.number-keybard.clear': string;
15
+ };
16
+ 'zh-HK': {
17
+ 'pisell2.keyboard.number-keybard.max': (max: number | string) => string;
18
+ 'pisell2.keyboard.number-keybard.min': (min: number | string) => string;
19
+ 'pisell2.keyboard.number-keybard.ok': string;
20
+ 'pisell2.keyboard.number-keybard.reset': string;
21
+ 'pisell2.keyboard.number-keybard.clear': string;
22
+ };
23
+ ja: {
24
+ 'pisell2.keyboard.number-keybard.max': (max: number | string) => string;
25
+ 'pisell2.keyboard.number-keybard.min': (min: number | string) => string;
26
+ 'pisell2.keyboard.number-keybard.ok': string;
27
+ 'pisell2.keyboard.number-keybard.reset': string;
28
+ 'pisell2.keyboard.number-keybard.clear': string;
29
+ };
30
+ pt: {
31
+ 'pisell2.keyboard.number-keybard.max': (max: number | string) => string;
32
+ 'pisell2.keyboard.number-keybard.min': (min: number | string) => string;
33
+ 'pisell2.keyboard.number-keybard.ok': string;
34
+ 'pisell2.keyboard.number-keybard.reset': string;
35
+ 'pisell2.keyboard.number-keybard.clear': string;
36
+ };
37
+ };
38
+ export default _default;
@@ -0,0 +1,57 @@
1
+ export default {
2
+ en: {
3
+ 'pisell2.keyboard.number-keybard.max': function pisell2KeyboardNumberKeybardMax(max) {
4
+ return "Maximum value is ".concat(max);
5
+ },
6
+ 'pisell2.keyboard.number-keybard.min': function pisell2KeyboardNumberKeybardMin(min) {
7
+ return "Minimum value is ".concat(min);
8
+ },
9
+ 'pisell2.keyboard.number-keybard.ok': 'OK',
10
+ 'pisell2.keyboard.number-keybard.reset': 'Reset',
11
+ 'pisell2.keyboard.number-keybard.clear': 'Clear'
12
+ },
13
+ 'zh-CN': {
14
+ 'pisell2.keyboard.number-keybard.max': function pisell2KeyboardNumberKeybardMax(max) {
15
+ return "\u6700\u5927\u503C\u4E3A".concat(max);
16
+ },
17
+ 'pisell2.keyboard.number-keybard.min': function pisell2KeyboardNumberKeybardMin(min) {
18
+ return "\u6700\u5C0F\u503C\u4E3A".concat(min);
19
+ },
20
+ 'pisell2.keyboard.number-keybard.ok': '确认',
21
+ 'pisell2.keyboard.number-keybard.reset': '重置',
22
+ 'pisell2.keyboard.number-keybard.clear': '清空'
23
+ },
24
+ 'zh-HK': {
25
+ 'pisell2.keyboard.number-keybard.max': function pisell2KeyboardNumberKeybardMax(max) {
26
+ return "\u6700\u5927\u503C\u4E3A".concat(max);
27
+ },
28
+ 'pisell2.keyboard.number-keybard.min': function pisell2KeyboardNumberKeybardMin(min) {
29
+ return "\u6700\u5C0F\u503C\u4E3A".concat(min);
30
+ },
31
+ 'pisell2.keyboard.number-keybard.ok': '確認',
32
+ 'pisell2.keyboard.number-keybard.reset': '重置',
33
+ 'pisell2.keyboard.number-keybard.clear': '清空'
34
+ },
35
+ ja: {
36
+ 'pisell2.keyboard.number-keybard.max': function pisell2KeyboardNumberKeybardMax(max) {
37
+ return "\u6700\u5927\u5024\u306F".concat(max, "\u3067\u3059");
38
+ },
39
+ 'pisell2.keyboard.number-keybard.min': function pisell2KeyboardNumberKeybardMin(min) {
40
+ return "\u6700\u5C0F\u5024\u306F".concat(min, "\u3067\u3059");
41
+ },
42
+ 'pisell2.keyboard.number-keybard.ok': 'OK',
43
+ 'pisell2.keyboard.number-keybard.reset': 'リセット',
44
+ 'pisell2.keyboard.number-keybard.clear': 'クリア'
45
+ },
46
+ pt: {
47
+ 'pisell2.keyboard.number-keybard.max': function pisell2KeyboardNumberKeybardMax(max) {
48
+ return "Valor m\xE1ximo \xE9 ".concat(max);
49
+ },
50
+ 'pisell2.keyboard.number-keybard.min': function pisell2KeyboardNumberKeybardMin(min) {
51
+ return "Valor m\xEDnimo \xE9 ".concat(min);
52
+ },
53
+ 'pisell2.keyboard.number-keybard.ok': 'OK',
54
+ 'pisell2.keyboard.number-keybard.reset': 'Redefinir',
55
+ 'pisell2.keyboard.number-keybard.clear': 'Limpar'
56
+ }
57
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { NumberKeyboardBaseProps, NumberKeyboardProps } from './types';
3
+ import './index.less';
4
+ /**
5
+ * NumberKeyboardBase - 数字输入键盘基础组件
6
+ * 支持整数模式和小数模式
7
+ */
8
+ declare const NumberKeyboardBase: React.FC<NumberKeyboardBaseProps>;
9
+ /**
10
+ * NumberKeyboard - 数字输入键盘
11
+ * 支持基础形式展示、popover 形态或 modal 形态
12
+ */
13
+ declare const NumberKeyboard: (props: NumberKeyboardProps) => JSX.Element | null;
14
+ export default NumberKeyboard;
15
+ export { NumberKeyboardBase };
16
+ export type { NumberKeyboardProps, NumberKeyboardBaseProps, NumberKeyboardMode, } from './types';
@@ -0,0 +1,523 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["containerProps", "children"],
3
+ _excluded2 = ["renderType", "open", "className"];
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ 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; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
11
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+ 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."); }
14
+ 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); }
15
+ 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; }
16
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ import React, { useMemo, useCallback, useState, useEffect } from 'react';
19
+ import classNames from 'classnames';
20
+ import { Popover } from 'antd';
21
+ import { useControllableValue } from 'ahooks';
22
+ import { Icon, Keyboard, PisellModal } from '@pisell/materials';
23
+ import { locales } from '@pisell/utils';
24
+ import VirtualInput from "../../../../../materials/src/components/virtualInput";
25
+ import useEngineContext from "../../../hooks/useEngineContext";
26
+ import localeTexts from "../locales";
27
+ import "./index.less";
28
+
29
+ // 生成简单的唯一 ID
30
+ var generateSimpleUUID = function generateSimpleUUID() {
31
+ return Math.random().toString(36).substring(2) + Date.now().toString(36);
32
+ };
33
+
34
+ /**
35
+ * NumberKeyboardBase - 数字输入键盘基础组件
36
+ * 支持整数模式和小数模式
37
+ */
38
+ var NumberKeyboardBase = function NumberKeyboardBase(props) {
39
+ var _context$engine;
40
+ var _props$mode = props.mode,
41
+ mode = _props$mode === void 0 ? 'integer' : _props$mode,
42
+ _props$originalValue = props.originalValue,
43
+ originalValue = _props$originalValue === void 0 ? '' : _props$originalValue,
44
+ _props$placeholder = props.placeholder,
45
+ placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
46
+ max = props.max,
47
+ min = props.min,
48
+ maxLength = props.maxLength,
49
+ _props$precision = props.precision,
50
+ precision = _props$precision === void 0 ? 2 : _props$precision,
51
+ _props$disabled = props.disabled,
52
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
53
+ doneText = props.doneText,
54
+ resetText = props.resetText,
55
+ clearText = props.clearText,
56
+ label = props.label,
57
+ errorText = props.errorText,
58
+ style = props.style,
59
+ className = props.className,
60
+ _props$keydown = props.keydown,
61
+ keydown = _props$keydown === void 0 ? true : _props$keydown,
62
+ inputStyle = props.inputStyle,
63
+ inputWrapperStyle = props.inputWrapperStyle,
64
+ onEnter = props.onEnter,
65
+ onReset = props.onReset;
66
+ var context = useEngineContext();
67
+ locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
68
+
69
+ // 受控/非受控值
70
+ var _useControllableValue = useControllableValue(props, {
71
+ defaultValue: ''
72
+ }),
73
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
74
+ internalValue = _useControllableValue2[0],
75
+ setInternalValue = _useControllableValue2[1];
76
+ var uniqueKeyboardId = useMemo(function () {
77
+ return "number-keyboard-".concat(generateSimpleUUID());
78
+ }, []);
79
+
80
+ // 是否是首次输入(用于选中状态)
81
+ var _useState = useState(!!internalValue),
82
+ _useState2 = _slicedToArray(_useState, 2),
83
+ isSelected = _useState2[0],
84
+ setIsSelected = _useState2[1];
85
+
86
+ // 当从外部传入新的 value 时,重新标记为选中状态
87
+ useEffect(function () {
88
+ if (internalValue) {
89
+ setIsSelected(true);
90
+ }
91
+ }, []);
92
+
93
+ // 检查是否超出范围
94
+ var isOutOfRange = useMemo(function () {
95
+ if (!internalValue) return false;
96
+ var numValue = parseFloat(internalValue);
97
+ if (isNaN(numValue)) return false;
98
+ if (max !== undefined && numValue > max) return true;
99
+ if (min !== undefined && numValue < min) return true;
100
+ return false;
101
+ }, [internalValue, max, min]);
102
+
103
+ // 获取错误提示文本
104
+ var errorMessage = useMemo(function () {
105
+ if (!isOutOfRange) return '';
106
+ if (errorText) return errorText;
107
+ var numValue = parseFloat(internalValue);
108
+ if (max !== undefined && numValue > max) {
109
+ return locales.getText('pisell2.keyboard.number-keybard.max')(max);
110
+ }
111
+ if (min !== undefined && numValue < min) {
112
+ return locales.getText('pisell2.keyboard.number-keybard.min')(min);
113
+ }
114
+ return '';
115
+ }, [isOutOfRange, errorText, internalValue, max, min]);
116
+
117
+ // 处理数值变化
118
+ var handleValueChange = useCallback(function (newValue) {
119
+ // 如果当前是选中状态,替换整个值
120
+ if (isSelected && newValue !== '') {
121
+ setIsSelected(false);
122
+ }
123
+ setInternalValue(newValue);
124
+ }, [isSelected, setInternalValue]);
125
+
126
+ // 单个删除
127
+ var handleDelete = useCallback(function () {
128
+ if (isSelected) {
129
+ setIsSelected(false);
130
+ }
131
+ if (internalValue.length > 0) {
132
+ handleValueChange(internalValue.slice(0, -1));
133
+ }
134
+ }, [internalValue, isSelected, handleValueChange]);
135
+
136
+ // 清空
137
+ var handleClear = useCallback(function () {
138
+ handleValueChange('');
139
+ setIsSelected(false);
140
+ }, [handleValueChange]);
141
+
142
+ // 重置到原始值
143
+ var handleReset = useCallback(function () {
144
+ setInternalValue(String(originalValue));
145
+ setIsSelected(true);
146
+ onReset === null || onReset === void 0 || onReset();
147
+ }, [originalValue, setInternalValue, onReset]);
148
+
149
+ // 确认
150
+ var handleDone = useCallback(function () {
151
+ if (isOutOfRange) return;
152
+ onEnter === null || onEnter === void 0 || onEnter(internalValue);
153
+ }, [internalValue, isOutOfRange, onEnter]);
154
+
155
+ // 处理数字输入
156
+ var handleNumberInput = useCallback(function (num) {
157
+ var newValue;
158
+ if (isSelected) {
159
+ // 选中状态,替换整个值
160
+ newValue = num;
161
+ setIsSelected(false);
162
+ } else {
163
+ newValue = internalValue + num;
164
+ }
165
+
166
+ // 检查最大长度
167
+ if (maxLength && newValue.replace('.', '').length > maxLength) {
168
+ return;
169
+ }
170
+
171
+ // 整数模式不允许小数点
172
+ if (mode === 'integer' && newValue.includes('.')) {
173
+ return;
174
+ }
175
+
176
+ // 小数模式检查小数位数
177
+ if (mode === 'decimal' && newValue.includes('.')) {
178
+ var parts = newValue.split('.');
179
+ if (parts[1] && parts[1].length > precision) {
180
+ return;
181
+ }
182
+ }
183
+
184
+ // 防止多个小数点
185
+ if (num === '.' && internalValue.includes('.')) {
186
+ return;
187
+ }
188
+
189
+ // 防止以多个0开头
190
+ if (newValue.length > 1 && newValue.startsWith('0') && !newValue.startsWith('0.')) {
191
+ newValue = newValue.replace(/^0+/, '') || '0';
192
+ }
193
+
194
+ // 处理 "00" 输入
195
+ if (num === '00') {
196
+ if (internalValue === '' || internalValue === '0') {
197
+ newValue = '0';
198
+ }
199
+ }
200
+ handleValueChange(newValue);
201
+ }, [internalValue, isSelected, maxLength, mode, precision, handleValueChange]);
202
+
203
+ // 键盘按键处理
204
+ var handleKeyboardChange = useCallback(function (key) {
205
+ if (key === undefined) return;
206
+ var keyStr = String(key);
207
+ switch (keyStr) {
208
+ case 'delete':
209
+ case 'backspace':
210
+ handleDelete();
211
+ break;
212
+ case 'clear':
213
+ handleClear();
214
+ break;
215
+ case 'reset':
216
+ handleReset();
217
+ break;
218
+ case 'done':
219
+ case 'ok':
220
+ handleDone();
221
+ break;
222
+ default:
223
+ // 数字或小数点
224
+ if (/^[0-9.]$/.test(keyStr) || keyStr === '00') {
225
+ handleNumberInput(keyStr);
226
+ }
227
+ break;
228
+ }
229
+ }, [handleDelete, handleClear, handleReset, handleDone, handleNumberInput]);
230
+
231
+ // 整数模式键盘配置 (3列布局)
232
+ var integerKeyboardItems = useMemo(function () {
233
+ return [{
234
+ value: 1,
235
+ label: '1',
236
+ disabled: false,
237
+ type: 'text'
238
+ }, {
239
+ value: 2,
240
+ label: '2',
241
+ disabled: false,
242
+ type: 'text'
243
+ }, {
244
+ value: 3,
245
+ label: '3',
246
+ disabled: false,
247
+ type: 'text'
248
+ }, {
249
+ value: 4,
250
+ label: '4',
251
+ disabled: false,
252
+ type: 'text'
253
+ }, {
254
+ value: 5,
255
+ label: '5',
256
+ disabled: false,
257
+ type: 'text'
258
+ }, {
259
+ value: 6,
260
+ label: '6',
261
+ disabled: false,
262
+ type: 'text'
263
+ }, {
264
+ value: 7,
265
+ label: '7',
266
+ disabled: false,
267
+ type: 'text'
268
+ }, {
269
+ value: 8,
270
+ label: '8',
271
+ disabled: false,
272
+ type: 'text'
273
+ }, {
274
+ value: 9,
275
+ label: '9',
276
+ disabled: false,
277
+ type: 'text'
278
+ }, {
279
+ value: 'reset',
280
+ label: resetText || locales.getText('pisell2.keyboard.number-keybard.reset'),
281
+ disabled: false,
282
+ type: 'text',
283
+ style: {
284
+ color: '#F04438',
285
+ fontSize: 18
286
+ }
287
+ }, {
288
+ value: 0,
289
+ label: '0',
290
+ disabled: false,
291
+ type: 'text'
292
+ }, {
293
+ value: 'done',
294
+ label: doneText || locales.getText('pisell2.keyboard.number-keybard.ok'),
295
+ disabled: isOutOfRange,
296
+ type: 'primary',
297
+ style: {
298
+ fontSize: 18
299
+ }
300
+ }];
301
+ }, [resetText, doneText, isOutOfRange]);
302
+
303
+ // 小数模式键盘配置 (4列布局,带右侧按钮)
304
+ var decimalKeyboardItems = useMemo(function () {
305
+ return [{
306
+ value: 1,
307
+ label: '1',
308
+ disabled: false,
309
+ type: 'text'
310
+ }, {
311
+ value: 2,
312
+ label: '2',
313
+ disabled: false,
314
+ type: 'text'
315
+ }, {
316
+ value: 3,
317
+ label: '3',
318
+ disabled: false,
319
+ type: 'text'
320
+ }, {
321
+ value: 4,
322
+ label: '4',
323
+ disabled: false,
324
+ type: 'text'
325
+ }, {
326
+ value: 5,
327
+ label: '5',
328
+ disabled: false,
329
+ type: 'text'
330
+ }, {
331
+ value: 6,
332
+ label: '6',
333
+ disabled: false,
334
+ type: 'text'
335
+ }, {
336
+ value: 7,
337
+ label: '7',
338
+ disabled: false,
339
+ type: 'text'
340
+ }, {
341
+ value: 8,
342
+ label: '8',
343
+ disabled: false,
344
+ type: 'text'
345
+ }, {
346
+ value: 9,
347
+ label: '9',
348
+ disabled: false,
349
+ type: 'text'
350
+ }, {
351
+ value: 0,
352
+ label: '0',
353
+ disabled: false,
354
+ type: 'text'
355
+ }, {
356
+ value: '00',
357
+ label: '00',
358
+ disabled: false,
359
+ type: 'text'
360
+ }, {
361
+ value: '.',
362
+ label: '.',
363
+ disabled: false,
364
+ type: 'text'
365
+ }];
366
+ }, []);
367
+
368
+ // 小数模式右侧按钮
369
+ var decimalRightItems = useMemo(function () {
370
+ return [{
371
+ value: 'clear',
372
+ label: clearText || locales.getText('pisell2.keyboard.number-keybard.clear'),
373
+ disabled: false,
374
+ type: 'text',
375
+ size: 1,
376
+ style: {
377
+ fontSize: 18
378
+ }
379
+ }, {
380
+ value: 'reset',
381
+ label: resetText || locales.getText('pisell2.keyboard.number-keybard.reset'),
382
+ disabled: false,
383
+ type: 'text',
384
+ size: 1,
385
+ style: {
386
+ color: '#F04438',
387
+ fontSize: 18
388
+ }
389
+ }, {
390
+ value: 'done',
391
+ label: doneText || locales.getText('pisell2.keyboard.number-keybard.ok'),
392
+ disabled: isOutOfRange,
393
+ type: 'primary',
394
+ size: 2,
395
+ style: {
396
+ fontSize: 18
397
+ }
398
+ }];
399
+ }, [clearText, resetText, doneText, isOutOfRange]);
400
+
401
+ // 渲染输入框显示值
402
+ var displayValue = useMemo(function () {
403
+ return internalValue || '';
404
+ }, [internalValue]);
405
+ var renderBottomContent = useCallback(function () {
406
+ if (isOutOfRange && errorMessage) {
407
+ return /*#__PURE__*/React.createElement("div", {
408
+ className: "pisell-number-keyboard-error-message"
409
+ }, /*#__PURE__*/React.createElement(Icon, {
410
+ type: "pisell2-alert-circle",
411
+ size: 16
412
+ }), errorMessage);
413
+ }
414
+ return null;
415
+ }, [errorMessage]);
416
+ return /*#__PURE__*/React.createElement("div", {
417
+ className: classNames('pisell-number-keyboard', "pisell-number-keyboard--".concat(mode), {
418
+ 'pisell-number-keyboard--disabled': disabled
419
+ }, className),
420
+ style: style
421
+ }, label && /*#__PURE__*/React.createElement("div", {
422
+ className: "pisell-number-keyboard-label"
423
+ }, label), /*#__PURE__*/React.createElement("div", {
424
+ className: classNames('pisell-number-keyboard-input-wrapper')
425
+ }, /*#__PURE__*/React.createElement(VirtualInput, {
426
+ focused: !disabled,
427
+ selected: isSelected && !!internalValue,
428
+ value: displayValue,
429
+ placeholder: placeholder,
430
+ wrapperStyle: _objectSpread({
431
+ flex: 1,
432
+ padding: '19px 16px',
433
+ borderRadius: '8px',
434
+ backgroundColor: 'white',
435
+ boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.06)',
436
+ overflow: 'hidden'
437
+ }, inputWrapperStyle),
438
+ style: _objectSpread({
439
+ fontSize: '48px',
440
+ fontWeight: 'bold',
441
+ border: 'none',
442
+ background: 'transparent',
443
+ width: '100%',
444
+ color: isOutOfRange ? '#D92D20' : undefined
445
+ }, inputStyle),
446
+ preventBlurElements: ["#".concat(uniqueKeyboardId)],
447
+ allowClear: true,
448
+ onClear: handleDelete,
449
+ textAlign: "center"
450
+ }), renderBottomContent()), /*#__PURE__*/React.createElement(Keyboard, {
451
+ id: uniqueKeyboardId,
452
+ className: classNames('pisell-number-keyboard-keys', {
453
+ 'pisell-number-keyboard-keys--integer': mode === 'integer',
454
+ 'pisell-number-keyboard-keys--decimal': mode === 'decimal'
455
+ }),
456
+ items: mode === 'integer' ? integerKeyboardItems : decimalKeyboardItems,
457
+ rightItems: mode === 'decimal' ? decimalRightItems : undefined,
458
+ keydown: keydown,
459
+ onChange: handleKeyboardChange
460
+ }));
461
+ };
462
+
463
+ /**
464
+ * NumberKeyboard - 数字输入键盘
465
+ * 支持基础形式展示、popover 形态或 modal 形态
466
+ */
467
+ var NumberKeyboard = function NumberKeyboard(props) {
468
+ var containerProps = props.containerProps,
469
+ children = props.children,
470
+ keyboardProps = _objectWithoutProperties(props, _excluded);
471
+
472
+ // 无 containerProps,直接渲染基础组件
473
+ if (!containerProps) {
474
+ return /*#__PURE__*/React.createElement(NumberKeyboardBase, keyboardProps);
475
+ }
476
+ var _ref = containerProps || {},
477
+ renderType = _ref.renderType,
478
+ open = _ref.open,
479
+ className = _ref.className,
480
+ restProps = _objectWithoutProperties(_ref, _excluded2);
481
+
482
+ // Popover 模式(受控)
483
+ if (renderType === 'popover') {
484
+ return /*#__PURE__*/React.createElement(Popover, _extends({
485
+ key: "".concat(open),
486
+ open: open,
487
+ trigger: ['click'],
488
+ overlayClassName: classNames('pisell-number-keyboard-popover', className),
489
+ destroyTooltipOnHide: true,
490
+ overlayInnerStyle: {
491
+ padding: 0
492
+ },
493
+ arrow: false
494
+ }, restProps, {
495
+ content: /*#__PURE__*/React.createElement(NumberKeyboardBase, keyboardProps)
496
+ }), children);
497
+ }
498
+
499
+ // Modal 模式(受控)
500
+ if (renderType === 'modal') {
501
+ return open ? /*#__PURE__*/React.createElement(PisellModal, _extends({
502
+ platform: 'pc',
503
+ open: true,
504
+ width: "unset",
505
+ header: null,
506
+ footer: false,
507
+ mask: false,
508
+ maskClosable: true,
509
+ bodyStyle: {
510
+ padding: '0px',
511
+ backgroundColor: 'transparent'
512
+ },
513
+ closeIcon: null,
514
+ className: classNames('pisell-number-keyboard-modal', className),
515
+ destroyOnHidden: true
516
+ }, restProps), /*#__PURE__*/React.createElement(NumberKeyboardBase, keyboardProps)) : null;
517
+ }
518
+
519
+ // 默认渲染基础组件
520
+ return /*#__PURE__*/React.createElement(NumberKeyboardBase, keyboardProps);
521
+ };
522
+ export default NumberKeyboard;
523
+ export { NumberKeyboardBase };
@@ -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
+ }