@pisell/private-materials 6.5.4 → 6.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +160 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/actionButtons/index.js +37 -42
- package/es/components/booking/components/actionButtons/index.less +0 -28
- package/es/components/booking/components/footer/amount.d.ts +3 -3
- package/es/components/booking/components/footer/amount.js +51 -31
- package/es/components/booking/components/footer/index.js +177 -68
- package/es/components/booking/components/footer/utils.js +62 -33
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/service/addService/index.js +2 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/index.js +42 -2
- package/es/components/booking/info2/service/addService/index.js +2 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +12 -4
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.js +10 -5
- package/es/components/checkout/PaymentModal.d.ts +2 -0
- package/es/components/checkout/PaymentModal.js +462 -263
- package/es/components/checkout/components/AdditionalModule/index.less +1 -1
- package/es/components/checkout/components/AmountSummary/index.js +176 -65
- package/es/components/checkout/components/AmountSummary/index.less +13 -0
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/es/components/checkout/components/CashPaymentModule/index.js +110 -132
- package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +214 -0
- package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
- package/es/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/es/components/checkout/components/PaymentResultToast/index.js +38 -8
- package/es/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
- package/es/components/checkout/components/WalletPassModule/index.js +4 -3
- package/es/components/checkout/components/WalletPassModule/utils.js +10 -4
- package/es/components/checkout/hooks/useWalletPass.js +11 -4
- package/es/components/checkout/index.less +1 -1
- package/es/components/checkout/locales.d.ts +36 -0
- package/es/components/checkout/locales.js +43 -4
- package/es/components/checkout/types.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Cart/Product.js +143 -71
- package/es/components/shoppingCart/components/Cart/index.js +1 -1
- package/es/components/shoppingCart/components/Cart/index.less +31 -0
- package/es/components/shoppingCart/locales.d.ts +3 -0
- package/es/components/shoppingCart/locales.js +12 -3
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +9 -12
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/es/components/ticketBooking/components/menuBar/index.js +3 -1
- package/es/components/ticketBooking/components/menuBar/index.less +7 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +2 -1
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +331 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +465 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
- package/es/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
- package/es/pro/priceKeyboard/index.d.ts +3 -0
- package/es/pro/priceKeyboard/index.js +3 -0
- package/es/pro/priceKeyboard/index.less +215 -0
- package/es/pro/priceKeyboard/utils.d.ts +31 -0
- package/es/pro/priceKeyboard/utils.js +51 -0
- package/es/pro/skuDetailModal/index.js +19 -16
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/actionButtons/index.js +31 -28
- package/lib/components/booking/components/actionButtons/index.less +0 -28
- package/lib/components/booking/components/footer/amount.d.ts +3 -3
- package/lib/components/booking/components/footer/amount.js +49 -34
- package/lib/components/booking/components/footer/index.js +114 -40
- package/lib/components/booking/components/footer/utils.js +35 -7
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/service/addService/index.js +2 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/index.js +18 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +12 -4
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.js +10 -5
- package/lib/components/checkout/PaymentModal.d.ts +2 -0
- package/lib/components/checkout/PaymentModal.js +208 -91
- package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
- package/lib/components/checkout/components/AmountSummary/index.js +120 -50
- package/lib/components/checkout/components/AmountSummary/index.less +13 -0
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/lib/components/checkout/components/CashPaymentModule/index.js +101 -134
- package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +163 -0
- package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
- package/lib/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/lib/components/checkout/components/PaymentResultToast/index.js +26 -1
- package/lib/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
- package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
- package/lib/components/checkout/components/WalletPassModule/utils.js +8 -4
- package/lib/components/checkout/hooks/useWalletPass.js +11 -6
- package/lib/components/checkout/index.less +1 -1
- package/lib/components/checkout/locales.d.ts +36 -0
- package/lib/components/checkout/locales.js +43 -4
- package/lib/components/checkout/types.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
- package/lib/components/shoppingCart/components/Cart/index.js +1 -1
- package/lib/components/shoppingCart/components/Cart/index.less +31 -0
- package/lib/components/shoppingCart/locales.d.ts +3 -0
- package/lib/components/shoppingCart/locales.js +6 -3
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -4
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
- package/lib/components/ticketBooking/components/menuBar/index.less +7 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -1
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +360 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +504 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
- package/lib/pro/priceKeyboard/index.d.ts +3 -0
- package/lib/pro/priceKeyboard/index.js +45 -0
- package/lib/pro/priceKeyboard/index.less +215 -0
- package/lib/pro/priceKeyboard/utils.d.ts +31 -0
- package/lib/pro/priceKeyboard/utils.js +75 -0
- package/lib/pro/skuDetailModal/index.js +18 -22
- package/package.json +12 -12
@@ -0,0 +1,5 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './PisellPriceKeyboardPopover.less';
|
3
|
+
import { PisellPriceKeyboardPopoverProps, PisellPriceKeyboardPopoverRef } from './types';
|
4
|
+
declare const PisellPriceKeyboardPopover: React.ForwardRefExoticComponent<PisellPriceKeyboardPopoverProps & React.RefAttributes<PisellPriceKeyboardPopoverRef>>;
|
5
|
+
export default PisellPriceKeyboardPopover;
|
@@ -0,0 +1,148 @@
|
|
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 React, { useState, useImperativeHandle, forwardRef } from 'react';
|
8
|
+
import { Popover } from 'antd';
|
9
|
+
import { PisellPriceKeyboard } from '@pisell/materials';
|
10
|
+
import { locales } from '@pisell/utils';
|
11
|
+
import "./PisellPriceKeyboardPopover.less";
|
12
|
+
var PisellPriceKeyboardPopover = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
13
|
+
var children = _ref.children,
|
14
|
+
_ref$value = _ref.value,
|
15
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
16
|
+
onChange = _ref.onChange,
|
17
|
+
onConfirm = _ref.onConfirm,
|
18
|
+
onCancel = _ref.onCancel,
|
19
|
+
_ref$showCurrencySymb = _ref.showCurrencySymbol,
|
20
|
+
showCurrencySymbol = _ref$showCurrencySymb === void 0 ? true : _ref$showCurrencySymb,
|
21
|
+
_ref$useThousandsSepa = _ref.useThousandsSeparator,
|
22
|
+
useThousandsSeparator = _ref$useThousandsSepa === void 0 ? false : _ref$useThousandsSepa,
|
23
|
+
_ref$selectType = _ref.selectType,
|
24
|
+
selectType = _ref$selectType === void 0 ? 'dark' : _ref$selectType,
|
25
|
+
_ref$disabled = _ref.disabled,
|
26
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
27
|
+
_ref$overlayClassName = _ref.overlayClassName,
|
28
|
+
overlayClassName = _ref$overlayClassName === void 0 ? '' : _ref$overlayClassName,
|
29
|
+
style = _ref.style;
|
30
|
+
var _useState = useState(false),
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
32
|
+
open = _useState2[0],
|
33
|
+
setOpen = _useState2[1];
|
34
|
+
var _useState3 = useState(''),
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
36
|
+
tempValue = _useState4[0],
|
37
|
+
setTempValue = _useState4[1];
|
38
|
+
var _useState5 = useState(true),
|
39
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
40
|
+
isFirstInput = _useState6[0],
|
41
|
+
setIsFirstInput = _useState6[1]; // 标记是否是首次输入
|
42
|
+
|
43
|
+
// 暴露给父组件的方法
|
44
|
+
useImperativeHandle(ref, function () {
|
45
|
+
return {
|
46
|
+
open: function open() {
|
47
|
+
setOpen(true);
|
48
|
+
setTempValue(value);
|
49
|
+
setIsFirstInput(true);
|
50
|
+
},
|
51
|
+
close: function close() {
|
52
|
+
return setOpen(false);
|
53
|
+
},
|
54
|
+
isOpen: function isOpen() {
|
55
|
+
return open;
|
56
|
+
}
|
57
|
+
};
|
58
|
+
});
|
59
|
+
var handleOpenChange = function handleOpenChange(visible) {
|
60
|
+
if (disabled) return;
|
61
|
+
setOpen(visible);
|
62
|
+
if (visible) {
|
63
|
+
// 打开时初始化临时值,并重置首次输入标记
|
64
|
+
setTempValue(value);
|
65
|
+
setIsFirstInput(true);
|
66
|
+
} else {
|
67
|
+
// 关闭时调用取消回调
|
68
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
// 处理价格变化(合并了 onChange 和 onEnter)
|
73
|
+
var handlePriceChange = function handlePriceChange(val) {
|
74
|
+
// 如果用户点击了清除按钮(值变为空或0),重置首次输入标记
|
75
|
+
if ((val === '' || val === 0 || val === '0') && !isFirstInput) {
|
76
|
+
setIsFirstInput(true);
|
77
|
+
setTempValue(val);
|
78
|
+
onChange === null || onChange === void 0 || onChange(val);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
if (isFirstInput && val !== '' && val !== 0 && val !== '0') {
|
82
|
+
setIsFirstInput(false);
|
83
|
+
var currentValueStr = String(tempValue || '').replace(/[^\d.]/g, ''); // 去除非数字字符
|
84
|
+
var newValueStr = String(val).replace(/[^\d.]/g, '');
|
85
|
+
|
86
|
+
// 如果当前有值且新值是在当前值基础上追加的,说明用户输入了新数字
|
87
|
+
if (currentValueStr && currentValueStr !== '0' && newValueStr.length > currentValueStr.length && newValueStr.startsWith(currentValueStr)) {
|
88
|
+
// 提取用户真正输入的新数字
|
89
|
+
var newInput = newValueStr.slice(currentValueStr.length);
|
90
|
+
if (newInput) {
|
91
|
+
// 直接使用用户输入的新数字,覆盖原值
|
92
|
+
setTempValue(newInput);
|
93
|
+
onChange === null || onChange === void 0 || onChange(newInput);
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// 后续输入或其他情况正常处理
|
100
|
+
setTempValue(val);
|
101
|
+
onChange === null || onChange === void 0 || onChange(val);
|
102
|
+
};
|
103
|
+
|
104
|
+
// 处理确认(点击完成按钮)
|
105
|
+
var handleConfirm = function handleConfirm(val) {
|
106
|
+
onConfirm === null || onConfirm === void 0 || onConfirm(val);
|
107
|
+
setOpen(false);
|
108
|
+
};
|
109
|
+
|
110
|
+
// 处理取消
|
111
|
+
var handleCancel = function handleCancel() {
|
112
|
+
setOpen(false);
|
113
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
114
|
+
};
|
115
|
+
var keyboardContent = /*#__PURE__*/React.createElement("div", {
|
116
|
+
className: "pisell-price-keyboard-popover-content"
|
117
|
+
}, /*#__PURE__*/React.createElement(PisellPriceKeyboard, {
|
118
|
+
value: tempValue,
|
119
|
+
onChange: handlePriceChange,
|
120
|
+
onEnter: handleConfirm,
|
121
|
+
doneText: locales.getText('pisell2.customise-item.save'),
|
122
|
+
resetText: locales.getText('pisell2.booking.info.text.clear'),
|
123
|
+
amountProps: {
|
124
|
+
showCurrencySymbol: showCurrencySymbol,
|
125
|
+
useThousandsSeparator: useThousandsSeparator
|
126
|
+
},
|
127
|
+
selectType: selectType,
|
128
|
+
backgroundColor: "transparent"
|
129
|
+
}));
|
130
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
131
|
+
open: open,
|
132
|
+
content: keyboardContent,
|
133
|
+
trigger: disabled ? [] : ['click'],
|
134
|
+
overlayInnerStyle: {
|
135
|
+
padding: 0
|
136
|
+
},
|
137
|
+
destroyTooltipOnHide: true,
|
138
|
+
arrow: false,
|
139
|
+
align: {
|
140
|
+
offset: [0, 0]
|
141
|
+
},
|
142
|
+
overlayClassName: "pisell-price-keyboard-popover ".concat(overlayClassName),
|
143
|
+
onOpenChange: handleOpenChange,
|
144
|
+
overlayStyle: style
|
145
|
+
}, children);
|
146
|
+
});
|
147
|
+
PisellPriceKeyboardPopover.displayName = 'PisellPriceKeyboardPopover';
|
148
|
+
export default PisellPriceKeyboardPopover;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
.pisell-price-keyboard-popover {
|
2
|
+
&.ant-popover {
|
3
|
+
z-index: 1050;
|
4
|
+
|
5
|
+
.ant-popover-inner {
|
6
|
+
border-radius: 12px;
|
7
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
8
|
+
background: transparent;
|
9
|
+
}
|
10
|
+
|
11
|
+
.ant-popover-inner-content {
|
12
|
+
padding: 0;
|
13
|
+
background: transparent;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.pisell-price-keyboard-popover-content {
|
18
|
+
background: rgba(29, 41, 57, 0.8) !important;
|
19
|
+
border-radius: 10px;
|
20
|
+
overflow: hidden;
|
21
|
+
padding: 10px;
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./PisellPriceKeyboardPopover";
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export interface PisellPriceKeyboardPopoverProps {
|
3
|
+
/** 触发元素 */
|
4
|
+
children: React.ReactNode;
|
5
|
+
/** 当前价格值 */
|
6
|
+
value?: string | number;
|
7
|
+
/** 价格变化回调(合并了 onChange 和 onEnter) */
|
8
|
+
onChange?: (value: string | number) => void;
|
9
|
+
/** 确认回调 */
|
10
|
+
onConfirm?: (value: string | number) => void;
|
11
|
+
/** 取消回调 */
|
12
|
+
onCancel?: () => void;
|
13
|
+
/** 货币符号显示 */
|
14
|
+
showCurrencySymbol?: boolean;
|
15
|
+
/** 是否使用千分位分隔符 */
|
16
|
+
useThousandsSeparator?: boolean;
|
17
|
+
/** 键盘主题 */
|
18
|
+
selectType?: 'light' | 'dark';
|
19
|
+
/** 是否禁用 */
|
20
|
+
disabled?: boolean;
|
21
|
+
/** Popover 额外的类名 */
|
22
|
+
overlayClassName?: string;
|
23
|
+
/** 自定义样式 */
|
24
|
+
style?: React.CSSProperties;
|
25
|
+
}
|
26
|
+
export interface PisellPriceKeyboardPopoverRef {
|
27
|
+
/** 打开键盘 */
|
28
|
+
open: () => void;
|
29
|
+
/** 关闭键盘 */
|
30
|
+
close: () => void;
|
31
|
+
/** 获取当前是否打开 */
|
32
|
+
isOpen: () => boolean;
|
33
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,331 @@
|
|
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 { 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
|
+
import { AutoResizeText } from '@pisell/materials';
|
31
|
+
import { formatAmountWithOptions } from '@pisell/utils';
|
32
|
+
var CashKeyboardIntact = function CashKeyboardIntact(props) {
|
33
|
+
var _mergedDisplayField$b, _mergedDisplayField$c, _mergedDisplayField$c2;
|
34
|
+
var amountSymbol = props.amountSymbol,
|
35
|
+
_props$titleArea = props.titleArea,
|
36
|
+
titleArea = _props$titleArea === void 0 ? {} : _props$titleArea,
|
37
|
+
_props$displayField = props.displayField,
|
38
|
+
displayField = _props$displayField === void 0 ? {} : _props$displayField,
|
39
|
+
originalValue = props.originalValue,
|
40
|
+
presets = props.presets,
|
41
|
+
style = props.style,
|
42
|
+
_props$selectType = props.selectType,
|
43
|
+
selectType = _props$selectType === void 0 ? 'light' : _props$selectType,
|
44
|
+
placeholder = props.placeholder,
|
45
|
+
doneText = props.doneText,
|
46
|
+
resetText = props.resetText,
|
47
|
+
disabled = props.disabled,
|
48
|
+
hiddenChangeDue = props.hiddenChangeDue;
|
49
|
+
var _useControllableValue = useControllableValue(props),
|
50
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
51
|
+
internalValue = _useControllableValue2[0],
|
52
|
+
setInternalValue = _useControllableValue2[1];
|
53
|
+
var _useState = useState(false),
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
55
|
+
isShowModal = _useState2[0],
|
56
|
+
setIsShowModal = _useState2[1];
|
57
|
+
|
58
|
+
// 找零
|
59
|
+
var changeDue = useMemo(function () {
|
60
|
+
return Math.max(0, new Decimal(internalValue || 0).minus(new Decimal(originalValue || 0)).toNumber());
|
61
|
+
}, [internalValue, originalValue]);
|
62
|
+
var _restProps = useMemo(function () {
|
63
|
+
return omit(props, ['defaultValue', 'value', 'onChange', 'onEnter', 'onReset', 'style']);
|
64
|
+
}, [props]);
|
65
|
+
|
66
|
+
// 设置主题
|
67
|
+
useEffect(function () {
|
68
|
+
setKeyboardTheme(selectType);
|
69
|
+
}, [selectType]);
|
70
|
+
|
71
|
+
// 变体2:末尾有三个默认预设项,总数不大于8个
|
72
|
+
var getDefaultPresets = function getDefaultPresets() {
|
73
|
+
var defaultEndPresets = [{
|
74
|
+
label: locales.getText('cash-keyboard-other'),
|
75
|
+
value: 'other',
|
76
|
+
style: {
|
77
|
+
color: '#344054',
|
78
|
+
backgroundColor: 'white'
|
79
|
+
},
|
80
|
+
onClick: function onClick() {
|
81
|
+
setIsShowModal(true);
|
82
|
+
},
|
83
|
+
render: function render() {
|
84
|
+
return /*#__PURE__*/React.createElement("div", {
|
85
|
+
style: {
|
86
|
+
position: 'absolute',
|
87
|
+
left: 0,
|
88
|
+
top: 0,
|
89
|
+
bottom: 0,
|
90
|
+
right: 0,
|
91
|
+
display: 'flex',
|
92
|
+
alignItems: 'center',
|
93
|
+
justifyContent: 'center'
|
94
|
+
}
|
95
|
+
}, locales.getText('cash-keyboard-other'));
|
96
|
+
}
|
97
|
+
}, {
|
98
|
+
label: resetText || locales.getText('cash-keyboard-reset'),
|
99
|
+
value: 'reset',
|
100
|
+
style: {
|
101
|
+
color: '#D92D20',
|
102
|
+
backgroundColor: 'white'
|
103
|
+
},
|
104
|
+
onClick: function onClick() {
|
105
|
+
var _props$onReset;
|
106
|
+
// 重置为待支付金额
|
107
|
+
setInternalValue(String(originalValue) || '');
|
108
|
+
props === null || props === void 0 || (_props$onReset = props.onReset) === null || _props$onReset === void 0 || _props$onReset.call(props);
|
109
|
+
}
|
110
|
+
}, {
|
111
|
+
label: doneText || locales.getText('cash-keyboard-pay'),
|
112
|
+
value: 'pay',
|
113
|
+
style: {
|
114
|
+
color: 'white',
|
115
|
+
backgroundColor: '#7F56DA'
|
116
|
+
},
|
117
|
+
onClick: function onClick() {
|
118
|
+
var _props$onEnter;
|
119
|
+
(_props$onEnter = props.onEnter) === null || _props$onEnter === void 0 || _props$onEnter.call(props, internalValue);
|
120
|
+
}
|
121
|
+
}];
|
122
|
+
var userPresets = presets || [];
|
123
|
+
|
124
|
+
// 计算可用的用户预设数量(总数8 - 默认3个 = 5个)
|
125
|
+
var maxUserPresets = 8 - defaultEndPresets.length;
|
126
|
+
var limitedUserPresets = userPresets.slice(0, maxUserPresets);
|
127
|
+
return [].concat(_toConsumableArray(limitedUserPresets), defaultEndPresets);
|
128
|
+
};
|
129
|
+
|
130
|
+
// 变体2:左中右布局,中间为Input区域
|
131
|
+
var getDefaultDisplayField = function getDefaultDisplayField() {
|
132
|
+
return {
|
133
|
+
cashReceived: {
|
134
|
+
visible: true,
|
135
|
+
label: locales.getText('cash-keyboard-cash-received')
|
136
|
+
},
|
137
|
+
balanceDue: {
|
138
|
+
visible: true,
|
139
|
+
label: locales.getText('cash-keyboard-balance-due')
|
140
|
+
},
|
141
|
+
changeDue: {
|
142
|
+
visible: true,
|
143
|
+
label: locales.getText('cash-keyboard-change-due')
|
144
|
+
},
|
145
|
+
gridRatio: [1, 2, 1] // 左中右布局,中间占 2 份
|
146
|
+
};
|
147
|
+
};
|
148
|
+
|
149
|
+
// 默认配置
|
150
|
+
var defaultTitleArea = {
|
151
|
+
visible: true,
|
152
|
+
title: {
|
153
|
+
visible: true
|
154
|
+
},
|
155
|
+
subtitle: {
|
156
|
+
visible: true
|
157
|
+
},
|
158
|
+
alignment: 'space-between',
|
159
|
+
padding: '0px'
|
160
|
+
};
|
161
|
+
|
162
|
+
// 合并配置
|
163
|
+
var mergedTitleArea = merge({}, defaultTitleArea, titleArea);
|
164
|
+
var mergedDisplayField = merge({}, getDefaultDisplayField(), displayField);
|
165
|
+
|
166
|
+
// 渲染标题区域
|
167
|
+
var renderTitleArea = function renderTitleArea() {
|
168
|
+
var _mergedTitleArea$titl, _mergedTitleArea$subt;
|
169
|
+
var _ref = mergedTitleArea || {},
|
170
|
+
title = _ref.title,
|
171
|
+
subtitle = _ref.subtitle;
|
172
|
+
if (!(title !== null && title !== void 0 && title.visible) && !(subtitle !== null && subtitle !== void 0 && subtitle.visible)) {
|
173
|
+
return null;
|
174
|
+
}
|
175
|
+
if (!(title !== null && title !== void 0 && title.text) && !(subtitle !== null && subtitle !== void 0 && subtitle.text)) {
|
176
|
+
return null;
|
177
|
+
}
|
178
|
+
var titleStyle = {
|
179
|
+
display: 'flex',
|
180
|
+
justifyContent: mergedTitleArea.alignment,
|
181
|
+
alignItems: 'center',
|
182
|
+
padding: mergedTitleArea.padding,
|
183
|
+
marginBottom: '8'
|
184
|
+
};
|
185
|
+
return /*#__PURE__*/React.createElement("div", {
|
186
|
+
style: titleStyle
|
187
|
+
}, ((_mergedTitleArea$titl = mergedTitleArea.title) === null || _mergedTitleArea$titl === void 0 ? void 0 : _mergedTitleArea$titl.visible) && /*#__PURE__*/React.createElement("div", {
|
188
|
+
className: "pisell-cash-keyboard-title",
|
189
|
+
style: {
|
190
|
+
fontSize: mergedTitleArea.title.fontSize,
|
191
|
+
color: mergedTitleArea.title.color,
|
192
|
+
fontWeight: mergedTitleArea.title.fontWeight
|
193
|
+
}
|
194
|
+
}, mergedTitleArea.title.text), ((_mergedTitleArea$subt = mergedTitleArea.subtitle) === null || _mergedTitleArea$subt === void 0 ? void 0 : _mergedTitleArea$subt.visible) && /*#__PURE__*/React.createElement("div", {
|
195
|
+
className: "pisell-cash-keyboard-subtitle",
|
196
|
+
style: {
|
197
|
+
fontSize: mergedTitleArea.subtitle.fontSize,
|
198
|
+
color: mergedTitleArea.subtitle.color,
|
199
|
+
fontWeight: mergedTitleArea.subtitle.fontWeight
|
200
|
+
}
|
201
|
+
}, mergedTitleArea.subtitle.text));
|
202
|
+
};
|
203
|
+
|
204
|
+
// 计算栅格样式
|
205
|
+
var getGridStyle = function getGridStyle(index) {
|
206
|
+
if (!mergedDisplayField.gridRatio) {
|
207
|
+
return {
|
208
|
+
flex: 1
|
209
|
+
};
|
210
|
+
}
|
211
|
+
var ratio = mergedDisplayField.gridRatio[index] || 1;
|
212
|
+
return {
|
213
|
+
flex: ratio
|
214
|
+
};
|
215
|
+
};
|
216
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
217
|
+
className: "pisell-cash-keyboard pisell-cash-keyboard-intact ".concat(disabled ? 'disabled' : ''),
|
218
|
+
style: _objectSpread({}, style || {})
|
219
|
+
}, renderTitleArea(), /*#__PURE__*/React.createElement("div", {
|
220
|
+
className: "pisell-cash-keyboard-intact-container"
|
221
|
+
}, /*#__PURE__*/React.createElement("div", {
|
222
|
+
style: {
|
223
|
+
display: 'flex',
|
224
|
+
gap: '16px'
|
225
|
+
}
|
226
|
+
}, ((_mergedDisplayField$b = mergedDisplayField.balanceDue) === null || _mergedDisplayField$b === void 0 ? void 0 : _mergedDisplayField$b.visible) && /*#__PURE__*/React.createElement("div", {
|
227
|
+
className: "pisell-cash-keyboard-intact-container-top",
|
228
|
+
style: _objectSpread(_objectSpread({}, getGridStyle(0)), {}, {
|
229
|
+
overflow: 'hidden'
|
230
|
+
})
|
231
|
+
}, /*#__PURE__*/React.createElement("div", {
|
232
|
+
className: "pisell-cash-keyboard-intact-container-top-label"
|
233
|
+
}, mergedDisplayField.balanceDue.label), /*#__PURE__*/React.createElement("div", {
|
234
|
+
className: "pisell-cash-keyboard-intact-container-top-value"
|
235
|
+
}, /*#__PURE__*/React.createElement(AutoResizeText, {
|
236
|
+
minFontSizePx: 10,
|
237
|
+
maxFontSizePx: 14,
|
238
|
+
fontSizePrecisionPx: 0.5
|
239
|
+
}, formatAmountWithOptions(originalValue || '', '', {
|
240
|
+
precision: 2,
|
241
|
+
hideDecimalForWholeNumbers: false
|
242
|
+
})))), ((_mergedDisplayField$c = mergedDisplayField.cashReceived) === null || _mergedDisplayField$c === void 0 ? void 0 : _mergedDisplayField$c.visible) && /*#__PURE__*/React.createElement("div", {
|
243
|
+
style: _objectSpread(_objectSpread({}, getGridStyle(1)), {}, {
|
244
|
+
padding: '6px 16px',
|
245
|
+
borderRadius: '8px',
|
246
|
+
backgroundColor: 'white',
|
247
|
+
boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.06)',
|
248
|
+
overflow: 'hidden',
|
249
|
+
maxWidth: 188,
|
250
|
+
cursor: 'pointer'
|
251
|
+
}),
|
252
|
+
onClick: function onClick() {
|
253
|
+
setIsShowModal(true);
|
254
|
+
}
|
255
|
+
}, /*#__PURE__*/React.createElement(VirtualInput, {
|
256
|
+
showCursor: false,
|
257
|
+
focused: true,
|
258
|
+
wrapperStyle: {
|
259
|
+
width: '100%'
|
260
|
+
},
|
261
|
+
topContent: /*#__PURE__*/React.createElement("div", {
|
262
|
+
style: {
|
263
|
+
fontSize: '14px',
|
264
|
+
color: '#667085'
|
265
|
+
}
|
266
|
+
}, mergedDisplayField.cashReceived.label),
|
267
|
+
value: internalValue ? /*#__PURE__*/React.createElement(AutoResizeText, {
|
268
|
+
minFontSizePx: 10,
|
269
|
+
maxFontSizePx: 14,
|
270
|
+
fontSizePrecisionPx: 0.5
|
271
|
+
}, formatAmountWithOptions(internalValue || '', '', {
|
272
|
+
value: internalValue,
|
273
|
+
hideDecimalForWholeNumbers: false,
|
274
|
+
precision: 2
|
275
|
+
})) : '',
|
276
|
+
height: 30,
|
277
|
+
fontSize: 20,
|
278
|
+
placeholder: placeholder,
|
279
|
+
style: {
|
280
|
+
fontSize: '24px',
|
281
|
+
fontWeight: 'bold',
|
282
|
+
border: 'none',
|
283
|
+
background: 'transparent',
|
284
|
+
width: '100%'
|
285
|
+
}
|
286
|
+
})), ((_mergedDisplayField$c2 = mergedDisplayField.changeDue) === null || _mergedDisplayField$c2 === void 0 ? void 0 : _mergedDisplayField$c2.visible) && /*#__PURE__*/React.createElement("div", {
|
287
|
+
className: "pisell-cash-keyboard-intact-container-top",
|
288
|
+
style: _objectSpread(_objectSpread({}, getGridStyle(2)), {}, {
|
289
|
+
overflow: 'hidden'
|
290
|
+
})
|
291
|
+
}, /*#__PURE__*/React.createElement("div", {
|
292
|
+
className: "pisell-cash-keyboard-intact-container-top-label"
|
293
|
+
}, mergedDisplayField.changeDue.label), /*#__PURE__*/React.createElement("div", {
|
294
|
+
className: "pisell-cash-keyboard-intact-container-top-value"
|
295
|
+
}, /*#__PURE__*/React.createElement(AutoResizeText, {
|
296
|
+
minFontSizePx: 10,
|
297
|
+
maxFontSizePx: 14,
|
298
|
+
fontSizePrecisionPx: 0.5
|
299
|
+
}, formatAmountWithOptions(hiddenChangeDue ? 0 : changeDue, '', {
|
300
|
+
value: hiddenChangeDue ? 0 : changeDue,
|
301
|
+
hideDecimalForWholeNumbers: false,
|
302
|
+
precision: 2
|
303
|
+
}))))), /*#__PURE__*/React.createElement(Shortcuts, {
|
304
|
+
presets: getDefaultPresets(),
|
305
|
+
onChange: setInternalValue,
|
306
|
+
disabled: disabled
|
307
|
+
}))), /*#__PURE__*/React.createElement(CashKeyboardSimple, _extends({
|
308
|
+
containerProps: {
|
309
|
+
renderType: 'modal',
|
310
|
+
open: isShowModal,
|
311
|
+
onCancel: function onCancel() {
|
312
|
+
return setIsShowModal(false);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}, _restProps, {
|
316
|
+
titleArea: _objectSpread(_objectSpread({}, mergedTitleArea), {}, {
|
317
|
+
subtitle: {
|
318
|
+
visible: false
|
319
|
+
}
|
320
|
+
}),
|
321
|
+
selectType: "dark",
|
322
|
+
value: internalValue,
|
323
|
+
onChange: setInternalValue,
|
324
|
+
onEnter: function onEnter() {
|
325
|
+
var _props$onEnter2;
|
326
|
+
(_props$onEnter2 = props.onEnter) === null || _props$onEnter2 === void 0 || _props$onEnter2.call(props, internalValue);
|
327
|
+
setIsShowModal(false);
|
328
|
+
}
|
329
|
+
})));
|
330
|
+
};
|
331
|
+
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;
|