@pisell/private-materials 6.4.41 → 6.4.43

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 (230) 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 +1 -1
  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 +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/Sales/Summary/utils.d.ts +1 -1
  12. package/es/components/booking/addons/model.d.ts +10 -1
  13. package/es/components/booking/components/actionButtons/index.js +37 -42
  14. package/es/components/booking/components/actionButtons/index.less +0 -28
  15. package/es/components/booking/components/footer/amount.d.ts +3 -3
  16. package/es/components/booking/components/footer/amount.js +13 -2
  17. package/es/components/booking/components/footer/index.js +168 -68
  18. package/es/components/booking/components/footer/utils.js +62 -33
  19. package/es/components/booking/forms/model.d.ts +10 -1
  20. package/es/components/booking/info/model.d.ts +10 -1
  21. package/es/components/booking/info/model.js +5 -0
  22. package/es/components/booking/info/service/addService/index.js +2 -1
  23. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/info/service2/utils.d.ts +1 -1
  25. package/es/components/booking/info2/index.js +42 -2
  26. package/es/components/booking/info2/service/addService/index.js +2 -1
  27. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  28. package/es/components/booking/info2/service/editService/index.js +12 -4
  29. package/es/components/booking/model.d.ts +9 -1
  30. package/es/components/booking/notes/model.d.ts +10 -1
  31. package/es/components/booking/payments/model.d.ts +10 -1
  32. package/es/components/booking/utils.d.ts +2 -2
  33. package/es/components/checkout/PaymentModal.d.ts +2 -0
  34. package/es/components/checkout/PaymentModal.js +395 -240
  35. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  36. package/es/components/checkout/components/AmountSummary/index.js +161 -54
  37. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  38. package/es/components/checkout/components/CashPaymentModule/index.js +114 -137
  39. package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
  40. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  41. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  42. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +210 -0
  43. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  44. package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
  45. package/es/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  46. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  47. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  48. package/es/components/checkout/components/WalletPassModule/index.js +3 -2
  49. package/es/components/checkout/components/WalletPassModule/utils.js +6 -1
  50. package/es/components/checkout/hooks/useWalletPass.js +2 -0
  51. package/es/components/checkout/index.less +1 -1
  52. package/es/components/checkout/locales.d.ts +33 -0
  53. package/es/components/checkout/locales.js +39 -3
  54. package/es/components/checkout/types.d.ts +1 -0
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/device.d.ts +1 -1
  57. package/es/components/eftposPay/hooks.d.ts +2 -2
  58. package/es/components/eftposPay/store/index.d.ts +5 -5
  59. package/es/components/pay/toC/model.d.ts +9 -1
  60. package/es/components/schedules/model.d.ts +9 -1
  61. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  62. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  63. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  64. package/es/components/shoppingCart/locales.d.ts +3 -0
  65. package/es/components/shoppingCart/locales.js +12 -3
  66. package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  67. package/es/components/ticketBooking/utils/index.js +2 -1
  68. package/es/components/wallet/Detail/model.d.ts +13 -1
  69. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  70. package/es/components/wallet/PointCard/model.d.ts +13 -1
  71. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  72. package/es/components/wallet/Voucher/model.d.ts +13 -1
  73. package/es/components/wallet/model.d.ts +9 -1
  74. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  75. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  76. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  77. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  78. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  79. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  80. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  81. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  82. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  83. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +310 -0
  84. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  85. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  86. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  87. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  88. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  89. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  90. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  91. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  92. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  93. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  94. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +442 -0
  95. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  96. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  97. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  98. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  99. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  100. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  101. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  102. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  103. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  104. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  105. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  106. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  107. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  108. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  109. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  110. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  111. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  112. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  113. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  114. package/es/pro/priceKeyboard/index.d.ts +3 -0
  115. package/es/pro/priceKeyboard/index.js +3 -0
  116. package/es/pro/priceKeyboard/index.less +215 -0
  117. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  118. package/es/pro/priceKeyboard/utils.js +51 -0
  119. package/es/pro/skuDetailModal/index.js +19 -16
  120. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  121. package/lib/components/booking/addons/model.d.ts +10 -1
  122. package/lib/components/booking/components/actionButtons/index.js +31 -28
  123. package/lib/components/booking/components/actionButtons/index.less +0 -28
  124. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  125. package/lib/components/booking/components/footer/amount.js +10 -4
  126. package/lib/components/booking/components/footer/index.js +107 -40
  127. package/lib/components/booking/components/footer/utils.js +35 -7
  128. package/lib/components/booking/forms/model.d.ts +10 -1
  129. package/lib/components/booking/info/model.d.ts +10 -1
  130. package/lib/components/booking/info/model.js +3 -0
  131. package/lib/components/booking/info/service/addService/index.js +2 -1
  132. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  133. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  134. package/lib/components/booking/info2/index.js +18 -1
  135. package/lib/components/booking/info2/service/addService/index.js +2 -1
  136. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  137. package/lib/components/booking/info2/service/editService/index.js +12 -4
  138. package/lib/components/booking/model.d.ts +9 -1
  139. package/lib/components/booking/notes/model.d.ts +10 -1
  140. package/lib/components/booking/payments/model.d.ts +10 -1
  141. package/lib/components/booking/utils.d.ts +2 -2
  142. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  143. package/lib/components/checkout/PaymentModal.js +152 -73
  144. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  145. package/lib/components/checkout/components/AmountSummary/index.js +114 -40
  146. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  147. package/lib/components/checkout/components/CashPaymentModule/index.js +103 -140
  148. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  149. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  150. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  151. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +172 -0
  152. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  153. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  154. package/lib/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  155. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  156. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  157. package/lib/components/checkout/components/WalletPassModule/index.js +3 -2
  158. package/lib/components/checkout/components/WalletPassModule/utils.js +4 -1
  159. package/lib/components/checkout/hooks/useWalletPass.js +2 -0
  160. package/lib/components/checkout/index.less +1 -1
  161. package/lib/components/checkout/locales.d.ts +33 -0
  162. package/lib/components/checkout/locales.js +39 -3
  163. package/lib/components/checkout/types.d.ts +1 -0
  164. package/lib/components/eftposPay/amount.d.ts +1 -1
  165. package/lib/components/eftposPay/device.d.ts +1 -1
  166. package/lib/components/eftposPay/hooks.d.ts +2 -2
  167. package/lib/components/eftposPay/store/index.d.ts +5 -5
  168. package/lib/components/pay/toC/model.d.ts +9 -1
  169. package/lib/components/schedules/model.d.ts +9 -1
  170. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  171. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  172. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  173. package/lib/components/shoppingCart/locales.d.ts +3 -0
  174. package/lib/components/shoppingCart/locales.js +6 -3
  175. package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  176. package/lib/components/ticketBooking/index.js +5 -1
  177. package/lib/components/ticketBooking/utils/index.js +2 -1
  178. package/lib/components/wallet/Detail/model.d.ts +13 -1
  179. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  180. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  181. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  182. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  183. package/lib/components/wallet/model.d.ts +9 -1
  184. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  185. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  186. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  187. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  188. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  189. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  190. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  191. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  192. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  193. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +332 -0
  194. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  195. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  196. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  197. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  198. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  199. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  200. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  201. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  202. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  203. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  204. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +485 -0
  205. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  206. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  207. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  208. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  209. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  210. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  211. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  212. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  213. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  214. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  215. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  216. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  217. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  218. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  219. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  220. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  221. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  222. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  223. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  224. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  225. package/lib/pro/priceKeyboard/index.js +45 -0
  226. package/lib/pro/priceKeyboard/index.less +215 -0
  227. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  228. package/lib/pro/priceKeyboard/utils.js +75 -0
  229. package/lib/pro/skuDetailModal/index.js +18 -22
  230. package/package.json +3 -3
@@ -0,0 +1,47 @@
1
+ import React, { useMemo, forwardRef, memo } from 'react';
2
+ import classNames from 'classnames';
3
+ import "./index.less";
4
+ var Shortcuts = /*#__PURE__*/forwardRef(function (props, ref) {
5
+ var presets = props.presets,
6
+ onChange = props.onChange,
7
+ disabled = props.disabled;
8
+ var handleItemClick = function handleItemClick(item) {
9
+ if (disabled || item.disabled) {
10
+ return;
11
+ }
12
+ if (item.onClick) {
13
+ var _next2 = function _next2() {
14
+ return onChange === null || onChange === void 0 ? void 0 : onChange("".concat(item.value));
15
+ };
16
+ item.onClick(item, _next2);
17
+ } else {
18
+ onChange === null || onChange === void 0 || onChange("".concat(item.value));
19
+ }
20
+ };
21
+ return useMemo(function () {
22
+ if (!(presets !== null && presets !== void 0 && presets.length)) {
23
+ return null;
24
+ }
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ ref: ref,
27
+ className: classNames('pisell-virtual-keyboard-shortcuts', {
28
+ disabled: props.disabled
29
+ })
30
+ }, presets.map(function (item, index) {
31
+ var _item$render;
32
+ var itemProps = {
33
+ key: index,
34
+ className: classNames('pisell-virtual-keyboard-shortcut', {
35
+ disabled: item.disabled
36
+ }),
37
+ style: item.style,
38
+ onClick: function onClick() {
39
+ return handleItemClick(item);
40
+ }
41
+ };
42
+ return /*#__PURE__*/React.createElement("div", itemProps, ((_item$render = item.render) === null || _item$render === void 0 ? void 0 : _item$render.call(item, item)) || item.label);
43
+ }));
44
+ }, [presets, onChange, ref]);
45
+ });
46
+ Shortcuts.displayName = 'Shortcuts';
47
+ export default /*#__PURE__*/memo(Shortcuts);
@@ -0,0 +1,39 @@
1
+ .pisell-virtual-keyboard-shortcuts {
2
+ display: grid;
3
+ grid-template-columns: repeat(4, 1fr);
4
+ gap: 4px 8px;
5
+ overflow: hidden;
6
+
7
+ &.disabled {
8
+ .pisell-virtual-keyboard-shortcut {
9
+ cursor: not-allowed;
10
+ pointer-events: none;
11
+ color: #98a2b3 !important;
12
+ background: #f2f4f7 !important;
13
+ border-color: #d0d5dd !important;
14
+ }
15
+ }
16
+
17
+ .pisell-virtual-keyboard-shortcut {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ height: 40px;
22
+ border-radius: 8px;
23
+ border: 1px solid var(--Gray-300, #e9d7fe);
24
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
25
+ background: var(--Primary-25, #fcfaff);
26
+ font-weight: 600;
27
+ color: #6941c6;
28
+ cursor: pointer;
29
+ position: relative;
30
+
31
+ &.disabled {
32
+ cursor: not-allowed;
33
+ pointer-events: none;
34
+ color: #98a2b3 !important;
35
+ background: #f2f4f7 !important;
36
+ border-color: #d0d5dd !important;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 键盘输入处理 Hook
3
+ * @param params 配置参数
4
+ * @param params.onChange 值变化回调
5
+ * @param params.onEnter 确认回调
6
+ * @param params.onReset 重置回调
7
+ * @param params.value 当前值
8
+ * @param params.min 最小值限制
9
+ * @param params.max 最大值限制
10
+ * @param params.scale 小数位数限制
11
+ * @param params.mode 输入模式:'append' 追加模式(默认)| 'replace' 替换模式
12
+ */
13
+ declare const useKeyActions: (params: {
14
+ onChange?: ((val: string) => void) | undefined;
15
+ onEnter?: ((val: string) => void) | undefined;
16
+ onReset?: (() => void) | undefined;
17
+ value?: string | undefined;
18
+ min?: number | undefined;
19
+ max?: number | undefined;
20
+ mode?: "replace" | "append" | undefined;
21
+ scale?: number | undefined;
22
+ }) => {
23
+ handleChange: (val?: string | number) => void;
24
+ error: {
25
+ msg: string;
26
+ } | null;
27
+ };
28
+ export default useKeyActions;
@@ -0,0 +1,252 @@
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(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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState, useCallback } from 'react';
8
+ import { isNumber } from '@pisell/utils';
9
+
10
+ /**
11
+ * 键盘输入处理 Hook
12
+ * @param params 配置参数
13
+ * @param params.onChange 值变化回调
14
+ * @param params.onEnter 确认回调
15
+ * @param params.onReset 重置回调
16
+ * @param params.value 当前值
17
+ * @param params.min 最小值限制
18
+ * @param params.max 最大值限制
19
+ * @param params.scale 小数位数限制
20
+ * @param params.mode 输入模式:'append' 追加模式(默认)| 'replace' 替换模式
21
+ */
22
+ var useKeyActions = function useKeyActions(params) {
23
+ var _useState = useState(null),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ error = _useState2[0],
26
+ setError = _useState2[1];
27
+ var onChange = params.onChange,
28
+ onEnter = params.onEnter,
29
+ onReset = params.onReset,
30
+ _params$value = params.value,
31
+ value = _params$value === void 0 ? '' : _params$value,
32
+ min = params.min,
33
+ max = params.max,
34
+ _params$mode = params.mode,
35
+ mode = _params$mode === void 0 ? 'append' : _params$mode,
36
+ scale = params.scale;
37
+
38
+ /**
39
+ * 检查小数位数是否超出限制
40
+ */
41
+ var checkScale = useCallback(function (val) {
42
+ if (scale === undefined) return true;
43
+ var decimalIndex = val.indexOf('.');
44
+ if (decimalIndex === -1) return true;
45
+ var decimalPart = val.substring(decimalIndex + 1);
46
+ return decimalPart.length <= scale;
47
+ }, [scale]);
48
+
49
+ /**
50
+ * 数值范围校验
51
+ */
52
+ var validateRange = useCallback(function (val) {
53
+ var trimmedVal = val.trim();
54
+ var numVal = Number(trimmedVal);
55
+ if (isNaN(numVal)) {
56
+ var errorMsg = 'invalid';
57
+ setError({
58
+ msg: errorMsg
59
+ });
60
+ return {
61
+ isValid: false,
62
+ errorMsg: errorMsg
63
+ };
64
+ }
65
+ if (min !== undefined && numVal < min) {
66
+ var _errorMsg = 'invalid';
67
+ setError({
68
+ msg: _errorMsg
69
+ });
70
+ return {
71
+ isValid: false,
72
+ errorMsg: _errorMsg
73
+ };
74
+ }
75
+ if (max !== undefined && numVal > max) {
76
+ var _errorMsg2 = 'invalid';
77
+ setError({
78
+ msg: _errorMsg2
79
+ });
80
+ return {
81
+ isValid: false,
82
+ errorMsg: _errorMsg2
83
+ };
84
+ }
85
+ setError(null);
86
+ return {
87
+ isValid: true
88
+ };
89
+ }, [min, max]);
90
+
91
+ /**
92
+ * 处理值变化
93
+ */
94
+ var handleChangeValue = useCallback(function (val) {
95
+ // 检查小数位数限制
96
+ if (!checkScale(val)) {
97
+ return {
98
+ isValid: false,
99
+ errorMsg: 'decimal_places_exceeded'
100
+ };
101
+ }
102
+ var validation = validateRange(val);
103
+ if (validation.isValid) {
104
+ onChange === null || onChange === void 0 || onChange(val);
105
+ }
106
+ return validation;
107
+ }, [onChange, validateRange, checkScale]);
108
+
109
+ /**
110
+ * 处理数字输入(0-9)
111
+ */
112
+ var handleNumberInput = useCallback(function (inputVal) {
113
+ var numStr = String(inputVal);
114
+
115
+ // 替换模式:直接替换当前值
116
+ if (mode === 'replace') {
117
+ return handleChangeValue(numStr);
118
+ }
119
+
120
+ // 追加模式
121
+ if (!value) {
122
+ return handleChangeValue(numStr);
123
+ }
124
+
125
+ // 处理前导零的情况
126
+ if (/^0+$/.test(value)) {
127
+ // 当前值全是0,输入非0数字时替换,输入0时追加
128
+ if (numStr === '0') {
129
+ return handleChangeValue(value + '0');
130
+ } else {
131
+ return handleChangeValue(numStr);
132
+ }
133
+ }
134
+
135
+ // 处理以0开头但包含小数点的情况(如 "0.123")
136
+ if (/^0\.\d*$/.test(value)) {
137
+ return handleChangeValue(value + numStr);
138
+ }
139
+
140
+ // 处理以0开头的整数(如 "001", "0123")
141
+ if (/^0+\d+$/.test(value)) {
142
+ // 去除前导零后拼接
143
+ var withoutLeadingZeros = value.replace(/^0+/, '');
144
+ return handleChangeValue(withoutLeadingZeros + numStr);
145
+ }
146
+
147
+ // 正常拼接
148
+ return handleChangeValue(value + numStr);
149
+ }, [mode, value, handleChangeValue]);
150
+
151
+ /**
152
+ * 处理小数点输入
153
+ */
154
+ var handleDecimalInput = useCallback(function () {
155
+ // 替换模式:直接设置为 "0."
156
+ if (mode === 'replace') {
157
+ return handleChangeValue('0.');
158
+ }
159
+
160
+ // 追加模式下,已经包含小数点则忽略
161
+ if (value.includes('.')) {
162
+ return;
163
+ }
164
+
165
+ // 空值:设置为 "0."
166
+ if (!value) {
167
+ return handleChangeValue('0.');
168
+ }
169
+
170
+ // 全是0的情况:设置为 "0."
171
+ if (/^0+$/.test(value)) {
172
+ return handleChangeValue('0.');
173
+ }
174
+
175
+ // 以0开头的整数(如 "001", "0123"):去除前导零后加小数点
176
+ if (/^0+\d+$/.test(value)) {
177
+ var withoutLeadingZeros = value.replace(/^0+/, '');
178
+ return handleChangeValue(withoutLeadingZeros + '.');
179
+ }
180
+
181
+ // 正常情况,追加小数点
182
+ return handleChangeValue(value + '.');
183
+ }, [mode, value, handleChangeValue]);
184
+
185
+ /**
186
+ * 处理其他字符输入
187
+ */
188
+ var handleOtherInput = useCallback(function (inputVal) {
189
+ var inputStr = String(inputVal);
190
+ if (mode === 'replace') {
191
+ return handleChangeValue(inputStr);
192
+ }
193
+ return handleChangeValue(value + inputStr);
194
+ }, [mode, value, handleChangeValue]);
195
+
196
+ /**
197
+ * 主要的键盘输入处理函数
198
+ */
199
+ var handleKeyInput = useCallback(function (val) {
200
+ switch (val) {
201
+ case undefined:
202
+ break;
203
+
204
+ // 确认操作
205
+ case 'ok':
206
+ case 'enter':
207
+ case 'done':
208
+ var validation = validateRange(value);
209
+ if (validation.isValid) {
210
+ onEnter === null || onEnter === void 0 || onEnter(value);
211
+ }
212
+ break;
213
+
214
+ // 重置操作
215
+ case 'reset':
216
+ setError(null);
217
+ onReset === null || onReset === void 0 || onReset();
218
+ break;
219
+
220
+ // 清空操作
221
+ case 'clear':
222
+ setError(null);
223
+ handleChangeValue('');
224
+ break;
225
+
226
+ // 删除操作
227
+ case 'delete':
228
+ handleChangeValue(value.slice(0, -1));
229
+ break;
230
+
231
+ // 小数点
232
+ case '.':
233
+ handleDecimalInput();
234
+ break;
235
+
236
+ // 数字输入
237
+ default:
238
+ if (isNumber(val) || String(val) === '0') {
239
+ handleNumberInput(val);
240
+ } else {
241
+ // 其他字符
242
+ handleOtherInput(val);
243
+ }
244
+ break;
245
+ }
246
+ }, [value, validateRange, onEnter, onReset, handleChangeValue, handleDecimalInput, handleNumberInput, handleOtherInput]);
247
+ return {
248
+ handleChange: handleKeyInput,
249
+ error: error
250
+ };
251
+ };
252
+ export default useKeyActions;
@@ -0,0 +1,27 @@
1
+ declare const useRightItems: (props: {
2
+ rightItemsStyle?: any;
3
+ doneText?: string;
4
+ resetText?: string;
5
+ }) => ({
6
+ value: string;
7
+ label: JSX.Element;
8
+ disabled: boolean;
9
+ type: string;
10
+ style: any;
11
+ size?: undefined;
12
+ } | {
13
+ value: string;
14
+ label: string;
15
+ disabled: boolean;
16
+ type: string;
17
+ style: any;
18
+ size?: undefined;
19
+ } | {
20
+ value: string;
21
+ label: string;
22
+ disabled: boolean;
23
+ type: string;
24
+ size: number;
25
+ style: any;
26
+ })[];
27
+ export default useRightItems;
@@ -0,0 +1,50 @@
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
+ 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; }
3
+ 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; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import React, { useMemo } from 'react';
8
+ import { Icon } from '@pisell/materials';
9
+ var useRightItems = function useRightItems(props) {
10
+ var rightItemsStyle = props.rightItemsStyle,
11
+ doneText = props.doneText,
12
+ resetText = props.resetText;
13
+ var rightItems = useMemo(function () {
14
+ return [{
15
+ value: 'delete',
16
+ label: /*#__PURE__*/React.createElement(Icon, {
17
+ type: "pisell2-delete"
18
+ }),
19
+ disabled: false,
20
+ type: 'text',
21
+ style: _objectSpread({
22
+ color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.textColor) || '#000000',
23
+ backgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.buttonBackgroundColor) || '#ffffff'
24
+ }, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.deleteButtonStyle) || {})
25
+ }, {
26
+ value: 'reset',
27
+ label: resetText || 'Reset',
28
+ disabled: false,
29
+ type: 'text',
30
+ style: _objectSpread({
31
+ fontSize: '18px',
32
+ color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonTextColor) || '#D92D20',
33
+ backgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonBackgroundColor) || '#ffffff'
34
+ }, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonStyle) || {})
35
+ }, {
36
+ value: 'done',
37
+ label: doneText || 'Done',
38
+ disabled: false,
39
+ type: 'primary',
40
+ size: 2,
41
+ style: _objectSpread({
42
+ fontSize: '18px',
43
+ background: rightItemsStyle !== null && rightItemsStyle !== void 0 && rightItemsStyle.isDoneButtonFollowTheme ? 'var(--theme-color)' : (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonBackgroundColor) || '#5d3f9f',
44
+ color: rightItemsStyle !== null && rightItemsStyle !== void 0 && rightItemsStyle.isDoneButtonFollowTheme ? '#ffffff' : (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonTextColor) || '#ffffff'
45
+ }, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonStyle) || {})
46
+ }];
47
+ }, [doneText, resetText, rightItemsStyle]);
48
+ return rightItems;
49
+ };
50
+ export default useRightItems;
@@ -0,0 +1,3 @@
1
+ export { default as CashKeyboard } from './components/cashKeyboard';
2
+ export { default as PaymentKeyboard } from './components/paymentKeyboard';
3
+ export { default as DiscountKeyboard } from './components/discountKeyboard';
@@ -0,0 +1,3 @@
1
+ export { default as CashKeyboard } from "./components/cashKeyboard";
2
+ export { default as PaymentKeyboard } from "./components/paymentKeyboard";
3
+ export { default as DiscountKeyboard } from "./components/discountKeyboard";
@@ -0,0 +1,215 @@
1
+ .price-keyboard {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 20px;
5
+ background-color: #ffffff;
6
+ border-radius: 12px;
7
+ padding: 20px;
8
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
9
+ }
10
+
11
+ .price-keyboard-inputs {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: 16px;
15
+ }
16
+
17
+ .price-keyboard-inputs-default {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 16px;
21
+ }
22
+
23
+ .price-keyboard-input-wrapper {
24
+ display: flex;
25
+ align-items: center;
26
+ padding: 12px 16px;
27
+ background-color: #f9fafb;
28
+ border: 1px solid #d0d5dd;
29
+ border-radius: 8px;
30
+ transition: all 0.2s ease;
31
+
32
+ &:hover {
33
+ border-color: #98a2b3;
34
+ }
35
+
36
+ &:focus-within {
37
+ border-color: #1570ef;
38
+ box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1);
39
+ }
40
+ }
41
+
42
+ .price-keyboard-input {
43
+ flex: 1;
44
+ }
45
+
46
+ .price-keyboard-keyboard {
47
+ display: flex;
48
+ gap: 12px;
49
+ }
50
+
51
+ .price-keyboard-keyboard-numbers {
52
+ flex: 1;
53
+ display: grid;
54
+ grid-template-columns: repeat(3, 1fr);
55
+ gap: 8px;
56
+ }
57
+
58
+ .price-keyboard-keyboard-actions {
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: 8px;
62
+ width: 80px;
63
+ }
64
+
65
+ .price-keyboard-key {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ height: 48px;
70
+ border: 1px solid #d0d5dd;
71
+ border-radius: 8px;
72
+ background-color: #ffffff;
73
+ color: #344054;
74
+ font-size: 16px;
75
+ font-weight: 500;
76
+ cursor: pointer;
77
+ transition: all 0.2s ease;
78
+ outline: none;
79
+
80
+ &:hover {
81
+ background-color: #f9fafb;
82
+ border-color: #98a2b3;
83
+ }
84
+
85
+ &:active {
86
+ background-color: #f2f4f7;
87
+ transform: translateY(1px);
88
+ }
89
+
90
+ &:disabled {
91
+ opacity: 0.5;
92
+ cursor: not-allowed;
93
+
94
+ &:hover {
95
+ background-color: #ffffff;
96
+ border-color: #d0d5dd;
97
+ transform: none;
98
+ }
99
+ }
100
+
101
+ &.price-keyboard-key-primary {
102
+ background-color: #1570ef;
103
+ color: #ffffff;
104
+ border-color: #1570ef;
105
+
106
+ &:hover {
107
+ background-color: #1366d9;
108
+ border-color: #1366d9;
109
+ }
110
+
111
+ &:active {
112
+ background-color: #0f5bc4;
113
+ border-color: #0f5bc4;
114
+ }
115
+ }
116
+
117
+ &.price-keyboard-key-size-2 {
118
+ height: 104px; /* 48px * 2 + 8px gap */
119
+ }
120
+
121
+ &.price-keyboard-key-size-3 {
122
+ height: 160px; /* 48px * 3 + 16px gap */
123
+ }
124
+ }
125
+
126
+ .price-keyboard-delete-icon {
127
+ width: 20px;
128
+ height: 20px;
129
+ }
130
+
131
+ /* 响应式设计 */
132
+ @media (max-width: 768px) {
133
+ .price-keyboard {
134
+ padding: 16px;
135
+ gap: 16px;
136
+ }
137
+
138
+ .price-keyboard-keyboard {
139
+ flex-direction: column;
140
+ gap: 16px;
141
+ }
142
+
143
+ .price-keyboard-keyboard-actions {
144
+ flex-direction: row;
145
+ width: auto;
146
+ height: auto;
147
+ }
148
+
149
+ .price-keyboard-key {
150
+ height: 44px;
151
+ font-size: 14px;
152
+ }
153
+
154
+ .price-keyboard-key.price-keyboard-key-size-2 {
155
+ height: 44px;
156
+ flex: 2;
157
+ }
158
+
159
+ .price-keyboard-key.price-keyboard-key-size-3 {
160
+ height: 44px;
161
+ flex: 3;
162
+ }
163
+ }
164
+
165
+ /* 深色主题支持 */
166
+ @media (prefers-color-scheme: dark) {
167
+ .price-keyboard {
168
+ background-color: #1f2937;
169
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
170
+ }
171
+
172
+ .price-keyboard-input-wrapper {
173
+ background-color: #374151;
174
+ border-color: #4b5563;
175
+
176
+ &:hover {
177
+ border-color: #6b7280;
178
+ }
179
+
180
+ &:focus-within {
181
+ border-color: #3b82f6;
182
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
183
+ }
184
+ }
185
+
186
+ .price-keyboard-key {
187
+ background-color: #374151;
188
+ border-color: #4b5563;
189
+ color: #f9fafb;
190
+
191
+ &:hover {
192
+ background-color: #4b5563;
193
+ border-color: #6b7280;
194
+ }
195
+
196
+ &:active {
197
+ background-color: #6b7280;
198
+ }
199
+
200
+ &.price-keyboard-key-primary {
201
+ background-color: #3b82f6;
202
+ border-color: #3b82f6;
203
+
204
+ &:hover {
205
+ background-color: #2563eb;
206
+ border-color: #2563eb;
207
+ }
208
+
209
+ &:active {
210
+ background-color: #1d4ed8;
211
+ border-color: #1d4ed8;
212
+ }
213
+ }
214
+ }
215
+ }
@@ -0,0 +1,31 @@
1
+ export declare const DEFAULT_THEME_CONFIG: {
2
+ dark: {
3
+ titleColor: string;
4
+ subtitleColor: string;
5
+ keyboardBgColor: string;
6
+ keyboardWrapperBgColor: string;
7
+ bgColor: string;
8
+ bgColorGray200: string;
9
+ bgColorGray300: string;
10
+ textGray500: string;
11
+ textGray600: string;
12
+ textGray900: string;
13
+ };
14
+ light: {
15
+ titleColor: string;
16
+ subtitleColor: string;
17
+ keyboardBgColor: string;
18
+ keyboardWrapperBgColor: string;
19
+ bgColor: string;
20
+ bgColorGray200: string;
21
+ bgColorGray300: string;
22
+ textGray500: string;
23
+ textGray600: string;
24
+ textGray900: string;
25
+ };
26
+ };
27
+ /**
28
+ * 设置键盘主题
29
+ * @param theme 主题
30
+ */
31
+ export declare const setKeyboardTheme: (theme?: 'dark' | 'light') => void;