@pisell/private-materials 6.4.42 → 6.4.44

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 (226) 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/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/components/actionButtons/index.js +37 -42
  13. package/es/components/booking/components/actionButtons/index.less +0 -28
  14. package/es/components/booking/components/footer/amount.d.ts +3 -3
  15. package/es/components/booking/components/footer/amount.js +13 -2
  16. package/es/components/booking/components/footer/index.js +168 -68
  17. package/es/components/booking/components/footer/utils.js +62 -33
  18. package/es/components/booking/forms/model.d.ts +1 -10
  19. package/es/components/booking/info/model.d.ts +1 -10
  20. package/es/components/booking/info/model.js +5 -0
  21. package/es/components/booking/info/service/addService/index.js +2 -1
  22. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  23. package/es/components/booking/info/service2/utils.d.ts +1 -1
  24. package/es/components/booking/info2/index.js +42 -2
  25. package/es/components/booking/info2/service/addService/index.js +2 -1
  26. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  27. package/es/components/booking/info2/service/editService/index.js +12 -4
  28. package/es/components/booking/model.d.ts +1 -9
  29. package/es/components/booking/notes/model.d.ts +1 -10
  30. package/es/components/booking/payments/model.d.ts +1 -10
  31. package/es/components/booking/utils.d.ts +2 -2
  32. package/es/components/checkout/PaymentModal.d.ts +2 -0
  33. package/es/components/checkout/PaymentModal.js +395 -240
  34. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  35. package/es/components/checkout/components/AmountSummary/index.js +161 -54
  36. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  37. package/es/components/checkout/components/CashPaymentModule/index.js +114 -137
  38. package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
  39. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  40. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  41. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +210 -0
  42. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  43. package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
  44. package/es/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  45. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  46. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  47. package/es/components/checkout/components/WalletPassModule/index.js +4 -3
  48. package/es/components/checkout/components/WalletPassModule/utils.js +6 -1
  49. package/es/components/checkout/hooks/useWalletPass.js +2 -0
  50. package/es/components/checkout/index.less +1 -1
  51. package/es/components/checkout/locales.d.ts +33 -0
  52. package/es/components/checkout/locales.js +39 -3
  53. package/es/components/checkout/types.d.ts +1 -0
  54. package/es/components/eftposPay/amount.d.ts +1 -1
  55. package/es/components/eftposPay/device.d.ts +1 -1
  56. package/es/components/eftposPay/hooks.d.ts +2 -2
  57. package/es/components/eftposPay/store/index.d.ts +6 -6
  58. package/es/components/pay/toC/model.d.ts +1 -9
  59. package/es/components/schedules/model.d.ts +1 -9
  60. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  61. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  62. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  63. package/es/components/shoppingCart/locales.d.ts +3 -0
  64. package/es/components/shoppingCart/locales.js +12 -3
  65. package/es/components/ticketBooking/utils/index.js +2 -1
  66. package/es/components/wallet/Detail/model.d.ts +1 -13
  67. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  68. package/es/components/wallet/PointCard/model.d.ts +1 -13
  69. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  70. package/es/components/wallet/Voucher/model.d.ts +1 -13
  71. package/es/components/wallet/model.d.ts +1 -9
  72. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  73. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  74. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  75. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  76. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  77. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  78. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  79. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  80. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  81. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +310 -0
  82. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  83. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  84. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  85. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  86. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  87. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  88. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  89. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  90. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  91. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  92. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +442 -0
  93. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  94. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  95. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  96. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  97. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  98. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  99. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  100. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  101. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  102. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  103. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  104. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  105. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  106. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  107. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  108. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  109. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  110. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  111. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  112. package/es/pro/priceKeyboard/index.d.ts +3 -0
  113. package/es/pro/priceKeyboard/index.js +3 -0
  114. package/es/pro/priceKeyboard/index.less +215 -0
  115. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  116. package/es/pro/priceKeyboard/utils.js +51 -0
  117. package/es/pro/skuDetailModal/index.js +19 -16
  118. package/lib/components/booking/addons/model.d.ts +1 -10
  119. package/lib/components/booking/components/actionButtons/index.js +31 -28
  120. package/lib/components/booking/components/actionButtons/index.less +0 -28
  121. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  122. package/lib/components/booking/components/footer/amount.js +10 -4
  123. package/lib/components/booking/components/footer/index.js +107 -40
  124. package/lib/components/booking/components/footer/utils.js +35 -7
  125. package/lib/components/booking/forms/model.d.ts +1 -10
  126. package/lib/components/booking/info/model.d.ts +1 -10
  127. package/lib/components/booking/info/model.js +3 -0
  128. package/lib/components/booking/info/service/addService/index.js +2 -1
  129. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  130. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  131. package/lib/components/booking/info2/index.js +18 -1
  132. package/lib/components/booking/info2/service/addService/index.js +2 -1
  133. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  134. package/lib/components/booking/info2/service/editService/index.js +12 -4
  135. package/lib/components/booking/model.d.ts +1 -9
  136. package/lib/components/booking/notes/model.d.ts +1 -10
  137. package/lib/components/booking/payments/model.d.ts +1 -10
  138. package/lib/components/booking/utils.d.ts +2 -2
  139. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  140. package/lib/components/checkout/PaymentModal.js +152 -73
  141. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  142. package/lib/components/checkout/components/AmountSummary/index.js +114 -40
  143. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  144. package/lib/components/checkout/components/CashPaymentModule/index.js +103 -140
  145. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  146. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  147. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  148. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +172 -0
  149. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  150. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  151. package/lib/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  152. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  153. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  154. package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
  155. package/lib/components/checkout/components/WalletPassModule/utils.js +4 -1
  156. package/lib/components/checkout/hooks/useWalletPass.js +2 -0
  157. package/lib/components/checkout/index.less +1 -1
  158. package/lib/components/checkout/locales.d.ts +33 -0
  159. package/lib/components/checkout/locales.js +39 -3
  160. package/lib/components/checkout/types.d.ts +1 -0
  161. package/lib/components/eftposPay/amount.d.ts +1 -1
  162. package/lib/components/eftposPay/device.d.ts +1 -1
  163. package/lib/components/eftposPay/hooks.d.ts +2 -2
  164. package/lib/components/eftposPay/store/index.d.ts +6 -6
  165. package/lib/components/pay/toC/model.d.ts +1 -9
  166. package/lib/components/schedules/model.d.ts +1 -9
  167. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  168. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  169. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  170. package/lib/components/shoppingCart/locales.d.ts +3 -0
  171. package/lib/components/shoppingCart/locales.js +6 -3
  172. package/lib/components/ticketBooking/index.js +5 -1
  173. package/lib/components/ticketBooking/utils/index.js +2 -1
  174. package/lib/components/wallet/Detail/model.d.ts +1 -13
  175. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  176. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  177. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  178. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  179. package/lib/components/wallet/model.d.ts +1 -9
  180. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  181. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  182. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  183. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  184. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  185. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  186. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  187. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  188. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  189. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +332 -0
  190. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  191. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  192. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  193. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  194. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  195. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  196. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  197. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  198. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  199. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  200. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +485 -0
  201. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  202. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  203. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  204. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  205. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  206. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  207. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  208. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  209. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  210. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  211. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  212. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  213. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  214. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  215. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  216. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  217. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  218. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  219. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  220. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  221. package/lib/pro/priceKeyboard/index.js +45 -0
  222. package/lib/pro/priceKeyboard/index.less +215 -0
  223. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  224. package/lib/pro/priceKeyboard/utils.js +75 -0
  225. package/lib/pro/skuDetailModal/index.js +18 -22
  226. package/package.json +2 -2
@@ -0,0 +1,310 @@
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 _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 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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, { useEffect, useMemo, useState } from 'react';
19
+ import { useControllableValue } from 'ahooks';
20
+ //@ts-ignore
21
+ import { merge, omit } from 'lodash';
22
+ //@ts-ignore
23
+ import { locales } from '@pisell/utils';
24
+ import { PisellText, VirtualInput } from '@pisell/materials';
25
+ import Shortcuts from "../shortcuts";
26
+ import CashKeyboardSimple from "./CashKeyboardSimple";
27
+ import { setKeyboardTheme } from "../../utils";
28
+ import "./index.less";
29
+ import Decimal from 'decimal.js';
30
+ var CashKeyboardIntact = function CashKeyboardIntact(props) {
31
+ var _mergedDisplayField$b, _mergedDisplayField$c, _mergedDisplayField$c2;
32
+ var amountSymbol = props.amountSymbol,
33
+ _props$titleArea = props.titleArea,
34
+ titleArea = _props$titleArea === void 0 ? {} : _props$titleArea,
35
+ _props$displayField = props.displayField,
36
+ displayField = _props$displayField === void 0 ? {} : _props$displayField,
37
+ originalValue = props.originalValue,
38
+ presets = props.presets,
39
+ style = props.style,
40
+ _props$selectType = props.selectType,
41
+ selectType = _props$selectType === void 0 ? 'light' : _props$selectType,
42
+ placeholder = props.placeholder,
43
+ doneText = props.doneText,
44
+ resetText = props.resetText,
45
+ disabled = props.disabled,
46
+ hiddenChangeDue = props.hiddenChangeDue;
47
+ var _useControllableValue = useControllableValue(props),
48
+ _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
49
+ internalValue = _useControllableValue2[0],
50
+ setInternalValue = _useControllableValue2[1];
51
+ var _useState = useState(false),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ isShowModal = _useState2[0],
54
+ setIsShowModal = _useState2[1];
55
+
56
+ // 找零
57
+ var changeDue = useMemo(function () {
58
+ return Math.max(0, new Decimal(internalValue || 0).minus(new Decimal(originalValue || 0)).toNumber());
59
+ }, [internalValue, originalValue]);
60
+ var _restProps = useMemo(function () {
61
+ return omit(props, ['defaultValue', 'value', 'onChange', 'onEnter', 'onReset', 'style']);
62
+ }, [props]);
63
+
64
+ // 设置主题
65
+ useEffect(function () {
66
+ setKeyboardTheme(selectType);
67
+ }, [selectType]);
68
+
69
+ // 变体2:末尾有三个默认预设项,总数不大于8个
70
+ var getDefaultPresets = function getDefaultPresets() {
71
+ var defaultEndPresets = [{
72
+ label: locales.getText('cash-keyboard-other'),
73
+ value: 'other',
74
+ style: {
75
+ color: '#344054',
76
+ backgroundColor: 'white'
77
+ },
78
+ onClick: function onClick() {
79
+ setIsShowModal(true);
80
+ },
81
+ render: function render() {
82
+ return /*#__PURE__*/React.createElement("div", {
83
+ style: {
84
+ position: 'absolute',
85
+ left: 0,
86
+ top: 0,
87
+ bottom: 0,
88
+ right: 0,
89
+ display: 'flex',
90
+ alignItems: 'center',
91
+ justifyContent: 'center'
92
+ }
93
+ }, locales.getText('cash-keyboard-other'));
94
+ }
95
+ }, {
96
+ label: resetText || locales.getText('cash-keyboard-reset'),
97
+ value: 'reset',
98
+ style: {
99
+ color: '#D92D20',
100
+ backgroundColor: 'white'
101
+ },
102
+ onClick: function onClick() {
103
+ var _props$onReset;
104
+ // 重置为待支付金额
105
+ setInternalValue(String(originalValue) || '');
106
+ props === null || props === void 0 || (_props$onReset = props.onReset) === null || _props$onReset === void 0 || _props$onReset.call(props);
107
+ }
108
+ }, {
109
+ label: doneText || locales.getText('cash-keyboard-pay'),
110
+ value: 'pay',
111
+ style: {
112
+ color: 'white',
113
+ backgroundColor: '#7F56DA'
114
+ },
115
+ onClick: function onClick() {
116
+ var _props$onEnter;
117
+ (_props$onEnter = props.onEnter) === null || _props$onEnter === void 0 || _props$onEnter.call(props, internalValue);
118
+ }
119
+ }];
120
+ var userPresets = presets || [];
121
+
122
+ // 计算可用的用户预设数量(总数8 - 默认3个 = 5个)
123
+ var maxUserPresets = 8 - defaultEndPresets.length;
124
+ var limitedUserPresets = userPresets.slice(0, maxUserPresets);
125
+ return [].concat(_toConsumableArray(limitedUserPresets), defaultEndPresets);
126
+ };
127
+
128
+ // 变体2:左中右布局,中间为Input区域
129
+ var getDefaultDisplayField = function getDefaultDisplayField() {
130
+ return {
131
+ cashReceived: {
132
+ visible: true,
133
+ label: locales.getText('cash-keyboard-cash-received')
134
+ },
135
+ balanceDue: {
136
+ visible: true,
137
+ label: locales.getText('cash-keyboard-balance-due')
138
+ },
139
+ changeDue: {
140
+ visible: true,
141
+ label: locales.getText('cash-keyboard-change-due')
142
+ },
143
+ gridRatio: [1, 2, 1] // 左中右布局,中间占 2 份
144
+ };
145
+ };
146
+
147
+ // 默认配置
148
+ var defaultTitleArea = {
149
+ visible: true,
150
+ title: {
151
+ visible: true
152
+ },
153
+ subtitle: {
154
+ visible: true
155
+ },
156
+ alignment: 'space-between',
157
+ padding: '0px'
158
+ };
159
+
160
+ // 合并配置
161
+ var mergedTitleArea = merge({}, defaultTitleArea, titleArea);
162
+ var mergedDisplayField = merge({}, getDefaultDisplayField(), displayField);
163
+
164
+ // 渲染标题区域
165
+ var renderTitleArea = function renderTitleArea() {
166
+ var _mergedTitleArea$titl, _mergedTitleArea$subt;
167
+ var _ref = mergedTitleArea || {},
168
+ title = _ref.title,
169
+ subtitle = _ref.subtitle;
170
+ if (!(title !== null && title !== void 0 && title.visible) && !(subtitle !== null && subtitle !== void 0 && subtitle.visible)) {
171
+ return null;
172
+ }
173
+ if (!(title !== null && title !== void 0 && title.text) && !(subtitle !== null && subtitle !== void 0 && subtitle.text)) {
174
+ return null;
175
+ }
176
+ var titleStyle = {
177
+ display: 'flex',
178
+ justifyContent: mergedTitleArea.alignment,
179
+ alignItems: 'center',
180
+ padding: mergedTitleArea.padding,
181
+ marginBottom: '8'
182
+ };
183
+ return /*#__PURE__*/React.createElement("div", {
184
+ style: titleStyle
185
+ }, ((_mergedTitleArea$titl = mergedTitleArea.title) === null || _mergedTitleArea$titl === void 0 ? void 0 : _mergedTitleArea$titl.visible) && /*#__PURE__*/React.createElement("div", {
186
+ className: "pisell-cash-keyboard-title",
187
+ style: {
188
+ fontSize: mergedTitleArea.title.fontSize,
189
+ color: mergedTitleArea.title.color,
190
+ fontWeight: mergedTitleArea.title.fontWeight
191
+ }
192
+ }, mergedTitleArea.title.text), ((_mergedTitleArea$subt = mergedTitleArea.subtitle) === null || _mergedTitleArea$subt === void 0 ? void 0 : _mergedTitleArea$subt.visible) && /*#__PURE__*/React.createElement("div", {
193
+ className: "pisell-cash-keyboard-subtitle",
194
+ style: {
195
+ fontSize: mergedTitleArea.subtitle.fontSize,
196
+ color: mergedTitleArea.subtitle.color,
197
+ fontWeight: mergedTitleArea.subtitle.fontWeight
198
+ }
199
+ }, mergedTitleArea.subtitle.text));
200
+ };
201
+
202
+ // 计算栅格样式
203
+ var getGridStyle = function getGridStyle(index) {
204
+ if (!mergedDisplayField.gridRatio) {
205
+ return {
206
+ flex: 1
207
+ };
208
+ }
209
+ var ratio = mergedDisplayField.gridRatio[index] || 1;
210
+ return {
211
+ flex: ratio
212
+ };
213
+ };
214
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
215
+ className: "pisell-cash-keyboard pisell-cash-keyboard-intact ".concat(disabled ? 'disabled' : ''),
216
+ style: _objectSpread({}, style || {})
217
+ }, renderTitleArea(), /*#__PURE__*/React.createElement("div", {
218
+ className: "pisell-cash-keyboard-intact-container"
219
+ }, /*#__PURE__*/React.createElement("div", {
220
+ style: {
221
+ display: 'flex',
222
+ gap: '16px'
223
+ }
224
+ }, ((_mergedDisplayField$b = mergedDisplayField.balanceDue) === null || _mergedDisplayField$b === void 0 ? void 0 : _mergedDisplayField$b.visible) && /*#__PURE__*/React.createElement("div", {
225
+ className: "pisell-cash-keyboard-intact-container-top",
226
+ style: _objectSpread(_objectSpread({}, getGridStyle(0)), {}, {
227
+ overflow: 'hidden'
228
+ })
229
+ }, /*#__PURE__*/React.createElement("div", {
230
+ className: "pisell-cash-keyboard-intact-container-top-label"
231
+ }, mergedDisplayField.balanceDue.label), /*#__PURE__*/React.createElement("div", {
232
+ className: "pisell-cash-keyboard-intact-container-top-value"
233
+ }, /*#__PURE__*/React.createElement(PisellText.Amount, {
234
+ value: originalValue || '',
235
+ hideDecimalForWholeNumbers: false,
236
+ precision: 2
237
+ }))), ((_mergedDisplayField$c = mergedDisplayField.cashReceived) === null || _mergedDisplayField$c === void 0 ? void 0 : _mergedDisplayField$c.visible) && /*#__PURE__*/React.createElement(VirtualInput, {
238
+ showCursor: false,
239
+ focused: true,
240
+ wrapperStyle: _objectSpread(_objectSpread({}, getGridStyle(1)), {}, {
241
+ padding: '6px 16px',
242
+ borderRadius: '8px',
243
+ backgroundColor: 'white',
244
+ boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.06)',
245
+ overflow: 'hidden',
246
+ maxWidth: 188
247
+ }),
248
+ topContent: /*#__PURE__*/React.createElement("div", {
249
+ style: {
250
+ fontSize: '14px',
251
+ color: '#667085'
252
+ }
253
+ }, mergedDisplayField.cashReceived.label),
254
+ value: internalValue ? /*#__PURE__*/React.createElement(PisellText.Amount, {
255
+ value: internalValue,
256
+ hideDecimalForWholeNumbers: false,
257
+ precision: 2
258
+ }) : '',
259
+ height: 30,
260
+ fontSize: 20,
261
+ placeholder: placeholder,
262
+ style: {
263
+ fontSize: '24px',
264
+ fontWeight: 'bold',
265
+ border: 'none',
266
+ background: 'transparent',
267
+ width: '100%'
268
+ }
269
+ }), ((_mergedDisplayField$c2 = mergedDisplayField.changeDue) === null || _mergedDisplayField$c2 === void 0 ? void 0 : _mergedDisplayField$c2.visible) && /*#__PURE__*/React.createElement("div", {
270
+ className: "pisell-cash-keyboard-intact-container-top",
271
+ style: _objectSpread(_objectSpread({}, getGridStyle(2)), {}, {
272
+ overflow: 'hidden'
273
+ })
274
+ }, /*#__PURE__*/React.createElement("div", {
275
+ className: "pisell-cash-keyboard-intact-container-top-label"
276
+ }, mergedDisplayField.changeDue.label), /*#__PURE__*/React.createElement("div", {
277
+ className: "pisell-cash-keyboard-intact-container-top-value"
278
+ }, /*#__PURE__*/React.createElement(PisellText.Amount, {
279
+ value: hiddenChangeDue ? 0 : changeDue,
280
+ hideDecimalForWholeNumbers: false,
281
+ precision: 2
282
+ })))), /*#__PURE__*/React.createElement(Shortcuts, {
283
+ presets: getDefaultPresets(),
284
+ onChange: setInternalValue,
285
+ disabled: disabled
286
+ }))), /*#__PURE__*/React.createElement(CashKeyboardSimple, _extends({
287
+ containerProps: {
288
+ renderType: 'modal',
289
+ open: isShowModal,
290
+ onCancel: function onCancel() {
291
+ return setIsShowModal(false);
292
+ }
293
+ }
294
+ }, _restProps, {
295
+ titleArea: _objectSpread(_objectSpread({}, mergedTitleArea), {}, {
296
+ subtitle: {
297
+ visible: false
298
+ }
299
+ }),
300
+ selectType: "dark",
301
+ value: internalValue,
302
+ onChange: setInternalValue,
303
+ onEnter: function onEnter() {
304
+ var _props$onEnter2;
305
+ (_props$onEnter2 = props.onEnter) === null || _props$onEnter2 === void 0 || _props$onEnter2.call(props, internalValue);
306
+ setIsShowModal(false);
307
+ }
308
+ })));
309
+ };
310
+ export default CashKeyboardIntact;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { CashKeyboardBaseProps } from './types';
3
+ import './index.less';
4
+ export interface CashKeyboardSimpleProps extends CashKeyboardBaseProps {
5
+ containerProps?: {
6
+ renderType: 'modal' | 'popover';
7
+ open: boolean;
8
+ [key: string]: any;
9
+ };
10
+ children?: React.ReactNode;
11
+ }
12
+ declare const CashKeyboardSimple: (props: CashKeyboardSimpleProps) => JSX.Element | null;
13
+ export default CashKeyboardSimple;
@@ -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;