@pisell/private-materials 6.4.42 → 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 (188) 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 +146 -146
  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/booking/components/actionButtons/index.js +37 -42
  12. package/es/components/booking/components/actionButtons/index.less +0 -28
  13. package/es/components/booking/components/footer/amount.d.ts +3 -3
  14. package/es/components/booking/components/footer/amount.js +13 -2
  15. package/es/components/booking/components/footer/index.js +168 -68
  16. package/es/components/booking/components/footer/utils.js +62 -33
  17. package/es/components/booking/info/model.js +5 -0
  18. package/es/components/booking/info/service/addService/index.js +2 -1
  19. package/es/components/booking/info2/index.js +42 -2
  20. package/es/components/booking/info2/service/addService/index.js +2 -1
  21. package/es/components/booking/info2/service/editService/index.js +12 -4
  22. package/es/components/checkout/PaymentModal.d.ts +2 -0
  23. package/es/components/checkout/PaymentModal.js +395 -240
  24. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  25. package/es/components/checkout/components/AmountSummary/index.js +161 -54
  26. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  27. package/es/components/checkout/components/CashPaymentModule/index.js +114 -137
  28. package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
  29. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  30. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  31. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +210 -0
  32. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  33. package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
  34. package/es/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  35. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  36. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  37. package/es/components/checkout/components/WalletPassModule/index.js +3 -2
  38. package/es/components/checkout/components/WalletPassModule/utils.js +6 -1
  39. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  40. package/es/components/checkout/hooks/useWalletPass.js +2 -0
  41. package/es/components/checkout/index.less +1 -1
  42. package/es/components/checkout/locales.d.ts +33 -0
  43. package/es/components/checkout/locales.js +39 -3
  44. package/es/components/checkout/types.d.ts +1 -0
  45. package/es/components/eftposPay/hooks.d.ts +1 -1
  46. package/es/components/eftposPay/store/index.d.ts +2 -2
  47. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  48. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  49. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  50. package/es/components/shoppingCart/locales.d.ts +3 -0
  51. package/es/components/shoppingCart/locales.js +12 -3
  52. package/es/components/ticketBooking/utils/index.js +2 -1
  53. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  54. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  55. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  56. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  57. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  58. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  59. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  60. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  61. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  62. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +310 -0
  63. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  64. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  65. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  66. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  67. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  68. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  69. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  70. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  71. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  72. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  73. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +442 -0
  74. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  75. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  76. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  77. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  78. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  79. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  80. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  81. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  82. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  83. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  84. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  85. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  86. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  87. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  88. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  89. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  90. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  91. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  92. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  93. package/es/pro/priceKeyboard/index.d.ts +3 -0
  94. package/es/pro/priceKeyboard/index.js +3 -0
  95. package/es/pro/priceKeyboard/index.less +215 -0
  96. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  97. package/es/pro/priceKeyboard/utils.js +51 -0
  98. package/es/pro/skuDetailModal/index.js +19 -16
  99. package/lib/components/booking/components/actionButtons/index.js +31 -28
  100. package/lib/components/booking/components/actionButtons/index.less +0 -28
  101. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  102. package/lib/components/booking/components/footer/amount.js +10 -4
  103. package/lib/components/booking/components/footer/index.js +107 -40
  104. package/lib/components/booking/components/footer/utils.js +35 -7
  105. package/lib/components/booking/info/model.js +3 -0
  106. package/lib/components/booking/info/service/addService/index.js +2 -1
  107. package/lib/components/booking/info2/index.js +18 -1
  108. package/lib/components/booking/info2/service/addService/index.js +2 -1
  109. package/lib/components/booking/info2/service/editService/index.js +12 -4
  110. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  111. package/lib/components/checkout/PaymentModal.js +152 -73
  112. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  113. package/lib/components/checkout/components/AmountSummary/index.js +114 -40
  114. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  115. package/lib/components/checkout/components/CashPaymentModule/index.js +103 -140
  116. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  117. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  118. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  119. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +172 -0
  120. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  121. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  122. package/lib/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  123. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  124. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  125. package/lib/components/checkout/components/WalletPassModule/index.js +3 -2
  126. package/lib/components/checkout/components/WalletPassModule/utils.js +4 -1
  127. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  128. package/lib/components/checkout/hooks/useWalletPass.js +2 -0
  129. package/lib/components/checkout/index.less +1 -1
  130. package/lib/components/checkout/locales.d.ts +33 -0
  131. package/lib/components/checkout/locales.js +39 -3
  132. package/lib/components/checkout/types.d.ts +1 -0
  133. package/lib/components/eftposPay/hooks.d.ts +1 -1
  134. package/lib/components/eftposPay/store/index.d.ts +2 -2
  135. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  136. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  137. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  138. package/lib/components/shoppingCart/locales.d.ts +3 -0
  139. package/lib/components/shoppingCart/locales.js +6 -3
  140. package/lib/components/ticketBooking/index.js +5 -1
  141. package/lib/components/ticketBooking/utils/index.js +2 -1
  142. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  143. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  144. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  145. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  146. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  147. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  148. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  149. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  150. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  151. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +332 -0
  152. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  153. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  154. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  155. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  156. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  157. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  158. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  159. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  160. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  161. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  162. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +485 -0
  163. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  164. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  165. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  166. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  167. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  168. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  169. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  170. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  171. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  172. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  173. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  174. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  175. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  176. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  177. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  178. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  179. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  180. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  181. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  182. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  183. package/lib/pro/priceKeyboard/index.js +45 -0
  184. package/lib/pro/priceKeyboard/index.less +215 -0
  185. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  186. package/lib/pro/priceKeyboard/utils.js +75 -0
  187. package/lib/pro/skuDetailModal/index.js +18 -22
  188. package/package.json +4 -4
@@ -0,0 +1,349 @@
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"];
4
+ 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; }
5
+ 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; }
6
+ 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); }
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, useId, useCallback, useRef, useEffect, useState } from 'react';
19
+ import { useControllableValue } from 'ahooks';
20
+ import Decimal from 'decimal.js';
21
+ //@ts-ignore
22
+ import { merge } from 'lodash';
23
+ //@ts-ignore
24
+ import { locales } from '@pisell/utils';
25
+ import { Popover } from 'antd';
26
+ import { Keyboard, PisellText, VirtualInput, PisellModal } from '@pisell/materials';
27
+ import Shortcuts from "../shortcuts";
28
+ import useRightItems from "../../hooks/rightItems";
29
+ import useKeyActions from "../../hooks/keyActions";
30
+ import { setKeyboardTheme } from "../../utils";
31
+ import "./index.less";
32
+ var CashKeyboardBase = function CashKeyboardBase(props) {
33
+ var _mergedDisplayField$c, _mergedDisplayField$b, _mergedDisplayField$c2;
34
+ var amountSymbol = props.amountSymbol,
35
+ titleArea = props.titleArea,
36
+ _props$originalValue = props.originalValue,
37
+ originalValue = _props$originalValue === void 0 ? '' : _props$originalValue,
38
+ displayField = props.displayField,
39
+ presets = props.presets,
40
+ keyboardProps = props.keyboardProps,
41
+ style = props.style,
42
+ min = props.min,
43
+ max = props.max,
44
+ _props$selectType = props.selectType,
45
+ selectType = _props$selectType === void 0 ? 'light' : _props$selectType,
46
+ _props$placeholder = props.placeholder,
47
+ placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
48
+ doneText = props.doneText,
49
+ resetText = props.resetText;
50
+ var _useControllableValue = useControllableValue(props),
51
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
52
+ internalValue = _useControllableValue2[0],
53
+ setInternalValue = _useControllableValue2[1];
54
+ // 生成唯一的类名
55
+ var uniqueId = useId();
56
+ var uniqueKeyboardId = "virtual-keyboard-".concat(uniqueId.replace(/:/g, '-'));
57
+ // shortcuts ref
58
+ var shortcutsRef = useRef(null);
59
+ // 首次收入标识
60
+ var _useState = useState(true),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ isFirstInput = _useState2[0],
63
+ setIsFirstInput = _useState2[1];
64
+ // 找零
65
+ var changeDue = useMemo(function () {
66
+ return Math.max(0, new Decimal(internalValue || 0).minus(new Decimal(originalValue || 0)).toNumber());
67
+ }, [internalValue, originalValue]);
68
+ // 设置主题
69
+ useEffect(function () {
70
+ setKeyboardTheme(selectType);
71
+ }, [selectType]);
72
+ var onReset = useCallback(function () {
73
+ var _props$onReset;
74
+ setInternalValue(String(originalValue));
75
+ setIsFirstInput(true);
76
+ props === null || props === void 0 || (_props$onReset = props.onReset) === null || _props$onReset === void 0 || _props$onReset.call(props);
77
+ }, [props === null || props === void 0 ? void 0 : props.onReset, setInternalValue, originalValue]);
78
+ var _handleValChange = useCallback(function (val) {
79
+ setInternalValue(val);
80
+ setIsFirstInput(false);
81
+ }, []);
82
+ var _useKeyActions = useKeyActions({
83
+ onEnter: props.onEnter,
84
+ onReset: onReset,
85
+ onChange: _handleValChange,
86
+ value: internalValue,
87
+ min: min,
88
+ max: max,
89
+ scale: 2,
90
+ mode: isFirstInput ? 'replace' : 'append'
91
+ }),
92
+ handleChange = _useKeyActions.handleChange;
93
+ var rightItems = useRightItems({
94
+ rightItemsStyle: {},
95
+ doneText: doneText || locales.getText('cash-keyboard-pay'),
96
+ resetText: resetText || locales.getText('cash-keyboard-reset')
97
+ });
98
+
99
+ // 变体1:最多展示4个,不足4个时用空白块补齐
100
+ var getDefaultPresets = useCallback(function () {
101
+ var userPresets = presets || [];
102
+
103
+ // 取前4个预设
104
+ var limitedPresets = userPresets.slice(0, 4);
105
+
106
+ // 如果不足4个,用空白块补齐
107
+ while (limitedPresets.length < 4) {
108
+ limitedPresets.push({
109
+ label: '',
110
+ value: '',
111
+ style: {
112
+ visibility: 'hidden',
113
+ pointerEvents: 'none'
114
+ }
115
+ });
116
+ }
117
+ return limitedPresets;
118
+ }, [presets]);
119
+
120
+ // 变体1:左右布局,左侧为Input区域
121
+ var getDefaultDisplayField = useCallback(function () {
122
+ return {
123
+ cashReceived: {
124
+ visible: true,
125
+ label: locales.getText('cash-keyboard-cash-received')
126
+ },
127
+ balanceDue: {
128
+ visible: true,
129
+ label: locales.getText('cash-keyboard-balance-due')
130
+ },
131
+ changeDue: {
132
+ visible: true,
133
+ label: locales.getText('cash-keyboard-change-due')
134
+ },
135
+ gridRatio: [2, 1, 1] // Cash Received 占 2 份,其他各占 1 份
136
+ };
137
+ }, []);
138
+
139
+ // 默认配置
140
+ var defaultTitleArea = {
141
+ title: {
142
+ visible: true
143
+ },
144
+ subtitle: {
145
+ visible: true
146
+ },
147
+ alignment: 'space-between',
148
+ padding: '0px'
149
+ };
150
+
151
+ // 合并配置
152
+ var mergedTitleArea = useMemo(function () {
153
+ return merge({}, defaultTitleArea, titleArea);
154
+ }, [titleArea]);
155
+ var mergedDisplayField = useMemo(function () {
156
+ return merge({}, getDefaultDisplayField(), displayField);
157
+ }, [getDefaultDisplayField, displayField]);
158
+
159
+ // 渲染标题区域
160
+ var renderTitleArea = useCallback(function () {
161
+ var _ref = mergedTitleArea || {},
162
+ title = _ref.title,
163
+ subtitle = _ref.subtitle;
164
+ if (!(title !== null && title !== void 0 && title.visible) && !(subtitle !== null && subtitle !== void 0 && subtitle.visible)) {
165
+ return null;
166
+ }
167
+ if (!(title !== null && title !== void 0 && title.text) && !(subtitle !== null && subtitle !== void 0 && subtitle.text)) {
168
+ return null;
169
+ }
170
+ var titleStyle = {
171
+ display: 'flex',
172
+ justifyContent: mergedTitleArea.alignment,
173
+ alignItems: 'center',
174
+ padding: mergedTitleArea.padding
175
+ };
176
+ return /*#__PURE__*/React.createElement("div", {
177
+ style: titleStyle,
178
+ className: "pisell-cash-keyboard-title"
179
+ }, (title === null || title === void 0 ? void 0 : title.visible) && /*#__PURE__*/React.createElement("div", {
180
+ style: {
181
+ fontSize: title.fontSize,
182
+ color: title.color,
183
+ fontWeight: title.fontWeight
184
+ }
185
+ }, title.text), (subtitle === null || subtitle === void 0 ? void 0 : subtitle.visible) && /*#__PURE__*/React.createElement("div", {
186
+ className: "pisell-cash-keyboard-subtitle",
187
+ style: {
188
+ fontSize: subtitle.fontSize,
189
+ color: subtitle.color,
190
+ fontWeight: subtitle.fontWeight
191
+ }
192
+ }, mergedTitleArea.subtitle.text));
193
+ }, [mergedTitleArea]);
194
+
195
+ // 计算栅格样式
196
+ var getGridStyle = useCallback(function (index) {
197
+ if (!mergedDisplayField.gridRatio) {
198
+ return {
199
+ flex: 1
200
+ };
201
+ }
202
+ var ratio = mergedDisplayField.gridRatio[index] || 1;
203
+ return {
204
+ flex: ratio
205
+ };
206
+ }, [mergedDisplayField]);
207
+ return /*#__PURE__*/React.createElement("div", {
208
+ className: "pisell-cash-keyboard pisell-cash-keyboard-simple",
209
+ style: _objectSpread({}, style || {})
210
+ }, renderTitleArea(), /*#__PURE__*/React.createElement("div", {
211
+ style: {
212
+ display: 'flex',
213
+ gap: '8px'
214
+ }
215
+ }, ((_mergedDisplayField$c = mergedDisplayField.cashReceived) === null || _mergedDisplayField$c === void 0 ? void 0 : _mergedDisplayField$c.visible) && /*#__PURE__*/React.createElement(VirtualInput, {
216
+ focused: true,
217
+ wrapperStyle: _objectSpread(_objectSpread({
218
+ padding: '12px 20px',
219
+ borderRadius: '8px',
220
+ backgroundColor: 'white',
221
+ boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.06)'
222
+ }, getGridStyle(0)), {}, {
223
+ overflow: 'hidden'
224
+ }),
225
+ topContent: /*#__PURE__*/React.createElement("div", {
226
+ style: {
227
+ color: '#667085',
228
+ fontSize: '12px',
229
+ fontWeight: 500,
230
+ lineHeight: '18px'
231
+ }
232
+ }, mergedDisplayField.cashReceived.label),
233
+ value: internalValue ? "".concat(amountSymbol || '').concat(internalValue) : '',
234
+ placeholder: placeholder,
235
+ style: {
236
+ fontSize: '24px',
237
+ fontWeight: 'bold',
238
+ border: 'none',
239
+ background: 'transparent',
240
+ width: '100%'
241
+ },
242
+ preventBlurElements: ["#".concat(uniqueKeyboardId), shortcutsRef]
243
+ }), /*#__PURE__*/React.createElement("div", {
244
+ style: {
245
+ display: 'flex',
246
+ flexDirection: 'column',
247
+ flex: 1,
248
+ borderRadius: '8px',
249
+ backgroundColor: '#ffffff',
250
+ padding: 8,
251
+ boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.06)',
252
+ overflow: 'hidden'
253
+ }
254
+ }, ((_mergedDisplayField$b = mergedDisplayField.balanceDue) === null || _mergedDisplayField$b === void 0 ? void 0 : _mergedDisplayField$b.visible) && /*#__PURE__*/React.createElement("div", {
255
+ style: _objectSpread({}, getGridStyle(1))
256
+ }, /*#__PURE__*/React.createElement("div", {
257
+ style: {
258
+ color: '#667085',
259
+ fontSize: '12px',
260
+ fontWeight: 500,
261
+ lineHeight: '18px'
262
+ }
263
+ }, mergedDisplayField.balanceDue.label), /*#__PURE__*/React.createElement("div", {
264
+ style: {
265
+ color: '#475467',
266
+ fontSize: '14px',
267
+ fontWeight: 700,
268
+ lineHeight: '20px'
269
+ }
270
+ }, /*#__PURE__*/React.createElement(PisellText.Amount, {
271
+ value: originalValue,
272
+ hideDecimalForWholeNumbers: false,
273
+ precision: 2
274
+ }))), ((_mergedDisplayField$c2 = mergedDisplayField.changeDue) === null || _mergedDisplayField$c2 === void 0 ? void 0 : _mergedDisplayField$c2.visible) && /*#__PURE__*/React.createElement("div", {
275
+ style: _objectSpread({}, getGridStyle(2))
276
+ }, /*#__PURE__*/React.createElement("div", {
277
+ style: {
278
+ color: '#667085',
279
+ fontSize: '12px',
280
+ fontWeight: 500,
281
+ lineHeight: '18px'
282
+ }
283
+ }, mergedDisplayField.changeDue.label), /*#__PURE__*/React.createElement("div", {
284
+ style: {
285
+ color: '#475467',
286
+ fontSize: '14px',
287
+ fontWeight: 700,
288
+ lineHeight: '20px'
289
+ }
290
+ }, /*#__PURE__*/React.createElement(PisellText.Amount, {
291
+ value: changeDue,
292
+ hideDecimalForWholeNumbers: false,
293
+ precision: 2
294
+ }))))), /*#__PURE__*/React.createElement(Shortcuts, {
295
+ ref: shortcutsRef,
296
+ presets: getDefaultPresets(),
297
+ onChange: function onChange(v) {
298
+ setInternalValue(v);
299
+ }
300
+ }), /*#__PURE__*/React.createElement(Keyboard, _extends({}, keyboardProps, {
301
+ rightItems: rightItems,
302
+ onChange: handleChange,
303
+ id: uniqueKeyboardId
304
+ })));
305
+ };
306
+ var CashKeyboardSimple = function CashKeyboardSimple(props) {
307
+ var containerProps = props.containerProps,
308
+ children = props.children,
309
+ keyboardProps = _objectWithoutProperties(props, _excluded);
310
+ var _ref2 = containerProps || {},
311
+ renderType = _ref2.renderType,
312
+ open = _ref2.open,
313
+ restProps = _objectWithoutProperties(_ref2, _excluded2);
314
+ if (!containerProps) {
315
+ return /*#__PURE__*/React.createElement(CashKeyboardBase, keyboardProps);
316
+ }
317
+
318
+ // 暂时只支持受控模式
319
+ if (renderType === 'popover') {
320
+ return /*#__PURE__*/React.createElement(Popover, _extends({
321
+ key: "".concat(open),
322
+ open: open,
323
+ trigger: "click",
324
+ className: "pisell-cash-keyboard-container pisell-cash-keyboard-popover"
325
+ }, restProps, {
326
+ content: /*#__PURE__*/React.createElement(CashKeyboardBase, keyboardProps)
327
+ }), children);
328
+ }
329
+ if (renderType === 'modal') {
330
+ return open ? /*#__PURE__*/React.createElement(PisellModal, _extends({
331
+ platform: 'pc',
332
+ open: true,
333
+ width: "unset",
334
+ header: null,
335
+ footer: false,
336
+ mask: false,
337
+ maskClosable: true,
338
+ bodyStyle: {
339
+ padding: '0px',
340
+ backgroundColor: 'transparent'
341
+ },
342
+ closeIcon: null,
343
+ className: "pisell-payment-keyboard-container pisell-payment-keyboard-modal",
344
+ destroyOnHidden: true
345
+ }, restProps), /*#__PURE__*/React.createElement(CashKeyboardBase, keyboardProps)) : null;
346
+ }
347
+ return /*#__PURE__*/React.createElement(CashKeyboardBase, keyboardProps);
348
+ };
349
+ export default CashKeyboardSimple;
@@ -0,0 +1,11 @@
1
+ import { CashKeyboardBaseProps } from './types';
2
+ export interface CashKeyboardProps extends CashKeyboardBaseProps {
3
+ containerProps?: {
4
+ renderType: 'modal' | 'popover';
5
+ open: boolean;
6
+ [key: string]: any;
7
+ };
8
+ variant?: 'intact' | 'simple';
9
+ }
10
+ declare const CashKeyboard: (props: CashKeyboardProps) => JSX.Element;
11
+ export default CashKeyboard;
@@ -0,0 +1,49 @@
1
+ var _excluded = ["variant", "value", "onChange"];
2
+ 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); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ 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; }
10
+ 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; }
11
+ import React from 'react';
12
+ import { useControllableValue } from 'ahooks';
13
+ //@ts-ignore
14
+ import { locales } from '@pisell/utils';
15
+ import CashKeyboardSimple from "./CashKeyboardSimple";
16
+ import CashKeyboardIntact from "./CashKeyboardIntact";
17
+ import localeTexts from "./locales";
18
+ import useEngineContext from "../../../../hooks/useEngineContext";
19
+ var CashKeyboard = function CashKeyboard(props) {
20
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4;
21
+ var context = useEngineContext();
22
+ locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en');
23
+ var getData = context.appHelper.utils.getData;
24
+ var amountSymbol = props.amountSymbol || (getData === null || getData === void 0 ? void 0 : getData('shop_symbol')) || '$';
25
+ var _props$variant = props.variant,
26
+ variant = _props$variant === void 0 ? 'intact' : _props$variant,
27
+ value = props.value,
28
+ onChange = props.onChange,
29
+ otherProps = _objectWithoutProperties(props, _excluded);
30
+ var _useControllableValue = useControllableValue(props),
31
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
32
+ internalValue = _useControllableValue2[0],
33
+ setInternalValue = _useControllableValue2[1];
34
+ if (variant === 'intact') {
35
+ return /*#__PURE__*/React.createElement(CashKeyboardIntact, _extends({}, otherProps, {
36
+ amountSymbol: amountSymbol,
37
+ value: internalValue,
38
+ placeholder: "".concat(amountSymbol, "0"),
39
+ onChange: setInternalValue
40
+ }));
41
+ }
42
+ return /*#__PURE__*/React.createElement(CashKeyboardSimple, _extends({}, otherProps, {
43
+ amountSymbol: amountSymbol,
44
+ placeholder: "".concat(amountSymbol, "0"),
45
+ value: internalValue,
46
+ onChange: setInternalValue
47
+ }));
48
+ };
49
+ export default CashKeyboard;
@@ -0,0 +1,103 @@
1
+ .pisell-cash-keyboard {
2
+ &-title {
3
+ font-size: 16px;
4
+ font-weight: 600;
5
+ line-height: 24px;
6
+ }
7
+ &-subtitle {
8
+ font-size: 14px;
9
+ font-weight: 400;
10
+ line-height: 20px;
11
+ }
12
+
13
+ &-intact {
14
+ width: 402px;
15
+ background-color: #fcfcfd;
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 8px;
19
+
20
+ .pisell-cash-keyboard-title {
21
+ color: '#101828';
22
+ }
23
+
24
+ .pisell-cash-keyboard-subtitle {
25
+ color: '#101828';
26
+ }
27
+
28
+ &.disabled {
29
+ .pisell-cash-keyboard-intact-container {
30
+ border: 1px solid #d0d5dd !important;
31
+ }
32
+ .pisell-virtual-input-wrapper {
33
+ background-color: #eaecf0 !important;
34
+ border: 0 !important;
35
+ box-shadow: none !important;
36
+ }
37
+ }
38
+
39
+ .pisell-cash-keyboard-intact-container {
40
+ width: unset;
41
+ border: 1px solid #7f56da;
42
+ border-radius: 8px;
43
+ padding: 8px;
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: 4px;
47
+
48
+ .pisell-cash-keyboard-intact-container-top {
49
+ display: flex;
50
+ flex-direction: column;
51
+ justify-content: center;
52
+ gap: 4px;
53
+ padding-top: 4px;
54
+
55
+ .pisell-cash-keyboard-intact-container-top-label {
56
+ font-size: 14px;
57
+ color: #667085;
58
+ }
59
+
60
+ .pisell-cash-keyboard-intact-container-top-value {
61
+ font-size: 18px;
62
+ font-weight: bold;
63
+ color: #475467;
64
+ flex: 1;
65
+ overflow: hidden;
66
+ display: -webkit-box;
67
+ -webkit-line-clamp: 2;
68
+ -webkit-box-orient: vertical;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ &-simple {
75
+ padding: 10px;
76
+ width: 360px;
77
+ border-radius: 10px;
78
+ display: flex;
79
+ flex-direction: column;
80
+ gap: 8px;
81
+ background-color: var(
82
+ --pisell-pro-price-keyboard-wrapper-bg-color,
83
+ #eaecf0
84
+ );
85
+
86
+ .pisell-cash-keyboard-title {
87
+ color: var(--pisell-pro-price-keyboard-title-color, #101828);
88
+ }
89
+ .pisell-cash-keyboard-subtitle {
90
+ color: var(--pisell-pro-price-keyboard-subtitle-color, #667085);
91
+ }
92
+ }
93
+ }
94
+
95
+ .pisell-case-keyboard-simple-modal {
96
+ .pisell-lowcode-modal-content {
97
+ background-color: transparent;
98
+ }
99
+
100
+ .pisell-lowcode-modal-close {
101
+ display: none;
102
+ }
103
+ }
@@ -0,0 +1,39 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'cash-keyboard-title': string;
4
+ 'cash-keyboard-balance-due': string;
5
+ 'cash-keyboard-cash-received': string;
6
+ 'cash-keyboard-change-due': string;
7
+ 'cash-keyboard-rounding': string;
8
+ 'cash-keyboard-other': string;
9
+ 'cash-keyboard-reset': string;
10
+ 'cash-keyboard-done': string;
11
+ 'cash-keyboard-pay': string;
12
+ 'cash-keyboard-amount-cannot-be-zero': string;
13
+ };
14
+ 'zh-CN': {
15
+ 'cash-keyboard-title': string;
16
+ 'cash-keyboard-balance-due': string;
17
+ 'cash-keyboard-cash-received': string;
18
+ 'cash-keyboard-change-due': string;
19
+ 'cash-keyboard-rounding': string;
20
+ 'cash-keyboard-other': string;
21
+ 'cash-keyboard-reset': string;
22
+ 'cash-keyboard-done': string;
23
+ 'cash-keyboard-pay': string;
24
+ 'cash-keyboard-amount-cannot-be-zero': string;
25
+ };
26
+ 'zh-HK': {
27
+ 'cash-keyboard-title': string;
28
+ 'cash-keyboard-balance-due': string;
29
+ 'cash-keyboard-cash-received': string;
30
+ 'cash-keyboard-change-due': string;
31
+ 'cash-keyboard-rounding': string;
32
+ 'cash-keyboard-other': string;
33
+ 'cash-keyboard-reset': string;
34
+ 'cash-keyboard-done': string;
35
+ 'cash-keyboard-pay': string;
36
+ 'cash-keyboard-amount-cannot-be-zero': string;
37
+ };
38
+ };
39
+ export default _default;
@@ -0,0 +1,41 @@
1
+ export default {
2
+ en: {
3
+ // Cash Payment Module
4
+ 'cash-keyboard-title': 'Cash Payment',
5
+ 'cash-keyboard-balance-due': 'Balance Due',
6
+ 'cash-keyboard-cash-received': 'Cash Received',
7
+ 'cash-keyboard-change-due': 'Change Due',
8
+ 'cash-keyboard-rounding': 'Rounding',
9
+ 'cash-keyboard-other': 'Other',
10
+ 'cash-keyboard-reset': 'Reset',
11
+ 'cash-keyboard-done': 'Done',
12
+ 'cash-keyboard-pay': 'Pay',
13
+ 'cash-keyboard-amount-cannot-be-zero': 'The amount cannot be 0'
14
+ },
15
+ 'zh-CN': {
16
+ // 现金支付模块
17
+ 'cash-keyboard-title': '现金支付',
18
+ 'cash-keyboard-balance-due': '待支付金额',
19
+ 'cash-keyboard-cash-received': '实收金额',
20
+ 'cash-keyboard-change-due': '找零',
21
+ 'cash-keyboard-rounding': '抹零',
22
+ 'cash-keyboard-other': '其他金额',
23
+ 'cash-keyboard-reset': '重置',
24
+ 'cash-keyboard-done': '确认',
25
+ 'cash-keyboard-pay': '支付',
26
+ 'cash-keyboard-amount-cannot-be-zero': '金额不能为0'
27
+ },
28
+ 'zh-HK': {
29
+ // 現金支付模組
30
+ 'cash-keyboard-title': '現金支付',
31
+ 'cash-keyboard-balance-due': '待支付金額',
32
+ 'cash-keyboard-cash-received': '實收金額',
33
+ 'cash-keyboard-change-due': '找零',
34
+ 'cash-keyboard-rounding': '抹零',
35
+ 'cash-keyboard-other': '其他金額',
36
+ 'cash-keyboard-reset': '重置',
37
+ 'cash-keyboard-done': '確認',
38
+ 'cash-keyboard-pay': '支付',
39
+ 'cash-keyboard-amount-cannot-be-zero': '金額不能為0'
40
+ }
41
+ };