@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,47 @@
|
|
1
|
+
export default {
|
2
|
+
en: {
|
3
|
+
// Payment Keyboard Module
|
4
|
+
'payment-keyboard-payment': 'Payment',
|
5
|
+
'payment-keyboard-surcharge': 'Surcharge',
|
6
|
+
'payment-keyboard-percent': 'percent',
|
7
|
+
'payment-keyboard-fixed': 'fixed',
|
8
|
+
'payment-keyboard-max': 'Max Amount',
|
9
|
+
'payment-keyboard-remaining': 'Remaining',
|
10
|
+
'payment-keyboard-change-due': 'Change Due',
|
11
|
+
'payment-keyboard-total-amount-due': 'Total Amount Due',
|
12
|
+
'payment-keyboard-inc-surcharge': 'Inc. Surcharge',
|
13
|
+
'payment-keyboard-reset': 'Reset',
|
14
|
+
'payment-keyboard-done': 'Done',
|
15
|
+
'payment-keyboard-pay': 'Pay'
|
16
|
+
},
|
17
|
+
'zh-CN': {
|
18
|
+
// 支付键盘模块
|
19
|
+
'payment-keyboard-payment': '支付',
|
20
|
+
'payment-keyboard-surcharge': '手续费',
|
21
|
+
'payment-keyboard-percent': '百分比',
|
22
|
+
'payment-keyboard-change-due': '找零',
|
23
|
+
'payment-keyboard-fixed': '固定金额',
|
24
|
+
'payment-keyboard-max': '最大支付金额',
|
25
|
+
'payment-keyboard-remaining': '剩余待支付',
|
26
|
+
'payment-keyboard-total-amount-due': '应付总额',
|
27
|
+
'payment-keyboard-inc-surcharge': '包含手续费',
|
28
|
+
'payment-keyboard-reset': '重置',
|
29
|
+
'payment-keyboard-done': '确认',
|
30
|
+
'payment-keyboard-pay': '支付'
|
31
|
+
},
|
32
|
+
'zh-HK': {
|
33
|
+
// 支付鍵盤模組
|
34
|
+
'payment-keyboard-payment': '支付',
|
35
|
+
'payment-keyboard-surcharge': '手續費',
|
36
|
+
'payment-keyboard-percent': '百分比',
|
37
|
+
'payment-keyboard-fixed': '固定金額',
|
38
|
+
'payment-keyboard-max': '最大支付金額',
|
39
|
+
'payment-keyboard-remaining': '剩餘待支付',
|
40
|
+
'payment-keyboard-change-due': '找零',
|
41
|
+
'payment-keyboard-total-amount-due': '應付總額',
|
42
|
+
'payment-keyboard-inc-surcharge': '包含手續費',
|
43
|
+
'payment-keyboard-reset': '重置',
|
44
|
+
'payment-keyboard-done': '確認',
|
45
|
+
'payment-keyboard-pay': '支付'
|
46
|
+
}
|
47
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export declare type SurchargeValue = {
|
2
|
+
percent?: string;
|
3
|
+
fixed?: string;
|
4
|
+
};
|
5
|
+
export interface PaymentKeyboardBaseProps {
|
6
|
+
/** 自定义支付允许超出最大值, EFTPOS不允许 */
|
7
|
+
enableExceedMaxAmount?: boolean;
|
8
|
+
/** payment 原始值 */
|
9
|
+
paymentOriginalValue?: string;
|
10
|
+
/** payment 当前值 */
|
11
|
+
paymentValue?: string;
|
12
|
+
/** payment 默认值, 非受控 */
|
13
|
+
paymentDefaultValue?: string;
|
14
|
+
/** surcharge 原始值 */
|
15
|
+
surchargeOriginalValue?: SurchargeValue;
|
16
|
+
/** surcharge 当前值 */
|
17
|
+
surchargeValue?: SurchargeValue;
|
18
|
+
/** surcharge 默认值, 非受控 */
|
19
|
+
surchargeDefaultValue?: SurchargeValue;
|
20
|
+
onReset?: () => void;
|
21
|
+
onPay?: (args: {
|
22
|
+
surcharge: SurchargeValue;
|
23
|
+
amount: string;
|
24
|
+
}) => void;
|
25
|
+
onChange?: (v: string | SurchargeValue) => void;
|
26
|
+
payment?: {
|
27
|
+
enable?: boolean;
|
28
|
+
};
|
29
|
+
surcharge?: {
|
30
|
+
enable?: boolean;
|
31
|
+
};
|
32
|
+
title?: {
|
33
|
+
text?: string;
|
34
|
+
};
|
35
|
+
subTitle?: {
|
36
|
+
text?: string;
|
37
|
+
};
|
38
|
+
[key: string]: any;
|
39
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './index.less';
|
3
|
+
export declare type ShortcutsItem = {
|
4
|
+
label: string;
|
5
|
+
value: number | string;
|
6
|
+
style?: React.CSSProperties;
|
7
|
+
onClick?: (item: ShortcutsItem, _next: () => void) => void;
|
8
|
+
render?: (item: ShortcutsItem) => React.ReactNode;
|
9
|
+
disabled?: boolean;
|
10
|
+
};
|
11
|
+
export interface ShortcutsProps {
|
12
|
+
presets?: ShortcutsItem[];
|
13
|
+
onChange?: (val: string) => void;
|
14
|
+
disabled?: boolean;
|
15
|
+
}
|
16
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ShortcutsProps & React.RefAttributes<HTMLDivElement>>>;
|
17
|
+
export default _default;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React, { useMemo, forwardRef, memo } from 'react';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import "./index.less";
|
4
|
+
var Shortcuts = /*#__PURE__*/forwardRef(function (props, ref) {
|
5
|
+
var presets = props.presets,
|
6
|
+
onChange = props.onChange,
|
7
|
+
disabled = props.disabled;
|
8
|
+
var handleItemClick = function handleItemClick(item) {
|
9
|
+
if (disabled || item.disabled) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
if (item.onClick) {
|
13
|
+
var _next2 = function _next2() {
|
14
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange("".concat(item.value));
|
15
|
+
};
|
16
|
+
item.onClick(item, _next2);
|
17
|
+
} else {
|
18
|
+
onChange === null || onChange === void 0 || onChange("".concat(item.value));
|
19
|
+
}
|
20
|
+
};
|
21
|
+
return useMemo(function () {
|
22
|
+
if (!(presets !== null && presets !== void 0 && presets.length)) {
|
23
|
+
return null;
|
24
|
+
}
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
26
|
+
ref: ref,
|
27
|
+
className: classNames('pisell-virtual-keyboard-shortcuts', {
|
28
|
+
disabled: props.disabled
|
29
|
+
})
|
30
|
+
}, presets.map(function (item, index) {
|
31
|
+
var _item$render;
|
32
|
+
var itemProps = {
|
33
|
+
key: index,
|
34
|
+
className: classNames('pisell-virtual-keyboard-shortcut', {
|
35
|
+
disabled: item.disabled
|
36
|
+
}),
|
37
|
+
style: item.style,
|
38
|
+
onClick: function onClick() {
|
39
|
+
return handleItemClick(item);
|
40
|
+
}
|
41
|
+
};
|
42
|
+
return /*#__PURE__*/React.createElement("div", itemProps, ((_item$render = item.render) === null || _item$render === void 0 ? void 0 : _item$render.call(item, item)) || item.label);
|
43
|
+
}));
|
44
|
+
}, [presets, onChange, ref]);
|
45
|
+
});
|
46
|
+
Shortcuts.displayName = 'Shortcuts';
|
47
|
+
export default /*#__PURE__*/memo(Shortcuts);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.pisell-virtual-keyboard-shortcuts {
|
2
|
+
display: grid;
|
3
|
+
grid-template-columns: repeat(4, 1fr);
|
4
|
+
gap: 4px 8px;
|
5
|
+
overflow: hidden;
|
6
|
+
|
7
|
+
&.disabled {
|
8
|
+
.pisell-virtual-keyboard-shortcut {
|
9
|
+
cursor: not-allowed;
|
10
|
+
pointer-events: none;
|
11
|
+
color: #98a2b3 !important;
|
12
|
+
background: #f2f4f7 !important;
|
13
|
+
border-color: #d0d5dd !important;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
.pisell-virtual-keyboard-shortcut {
|
18
|
+
display: flex;
|
19
|
+
align-items: center;
|
20
|
+
justify-content: center;
|
21
|
+
height: 40px;
|
22
|
+
border-radius: 8px;
|
23
|
+
border: 1px solid var(--Gray-300, #e9d7fe);
|
24
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
25
|
+
background: var(--Primary-25, #fcfaff);
|
26
|
+
font-weight: 600;
|
27
|
+
color: #6941c6;
|
28
|
+
cursor: pointer;
|
29
|
+
position: relative;
|
30
|
+
|
31
|
+
&.disabled {
|
32
|
+
cursor: not-allowed;
|
33
|
+
pointer-events: none;
|
34
|
+
color: #98a2b3 !important;
|
35
|
+
background: #f2f4f7 !important;
|
36
|
+
border-color: #d0d5dd !important;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
* 键盘输入处理 Hook
|
3
|
+
* @param params 配置参数
|
4
|
+
* @param params.onChange 值变化回调
|
5
|
+
* @param params.onEnter 确认回调
|
6
|
+
* @param params.onReset 重置回调
|
7
|
+
* @param params.value 当前值
|
8
|
+
* @param params.min 最小值限制
|
9
|
+
* @param params.max 最大值限制
|
10
|
+
* @param params.scale 小数位数限制
|
11
|
+
* @param params.mode 输入模式:'append' 追加模式(默认)| 'replace' 替换模式
|
12
|
+
*/
|
13
|
+
declare const useKeyActions: (params: {
|
14
|
+
onChange?: ((val: string) => void) | undefined;
|
15
|
+
onEnter?: ((val: string) => void) | undefined;
|
16
|
+
onReset?: (() => void) | undefined;
|
17
|
+
value?: string | undefined;
|
18
|
+
min?: number | undefined;
|
19
|
+
max?: number | undefined;
|
20
|
+
mode?: "replace" | "append" | undefined;
|
21
|
+
scale?: number | undefined;
|
22
|
+
}) => {
|
23
|
+
handleChange: (val?: string | number) => void;
|
24
|
+
error: {
|
25
|
+
msg: string;
|
26
|
+
} | null;
|
27
|
+
};
|
28
|
+
export default useKeyActions;
|
@@ -0,0 +1,252 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import { useState, useCallback } from 'react';
|
8
|
+
import { isNumber } from '@pisell/utils';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* 键盘输入处理 Hook
|
12
|
+
* @param params 配置参数
|
13
|
+
* @param params.onChange 值变化回调
|
14
|
+
* @param params.onEnter 确认回调
|
15
|
+
* @param params.onReset 重置回调
|
16
|
+
* @param params.value 当前值
|
17
|
+
* @param params.min 最小值限制
|
18
|
+
* @param params.max 最大值限制
|
19
|
+
* @param params.scale 小数位数限制
|
20
|
+
* @param params.mode 输入模式:'append' 追加模式(默认)| 'replace' 替换模式
|
21
|
+
*/
|
22
|
+
var useKeyActions = function useKeyActions(params) {
|
23
|
+
var _useState = useState(null),
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
25
|
+
error = _useState2[0],
|
26
|
+
setError = _useState2[1];
|
27
|
+
var onChange = params.onChange,
|
28
|
+
onEnter = params.onEnter,
|
29
|
+
onReset = params.onReset,
|
30
|
+
_params$value = params.value,
|
31
|
+
value = _params$value === void 0 ? '' : _params$value,
|
32
|
+
min = params.min,
|
33
|
+
max = params.max,
|
34
|
+
_params$mode = params.mode,
|
35
|
+
mode = _params$mode === void 0 ? 'append' : _params$mode,
|
36
|
+
scale = params.scale;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* 检查小数位数是否超出限制
|
40
|
+
*/
|
41
|
+
var checkScale = useCallback(function (val) {
|
42
|
+
if (scale === undefined) return true;
|
43
|
+
var decimalIndex = val.indexOf('.');
|
44
|
+
if (decimalIndex === -1) return true;
|
45
|
+
var decimalPart = val.substring(decimalIndex + 1);
|
46
|
+
return decimalPart.length <= scale;
|
47
|
+
}, [scale]);
|
48
|
+
|
49
|
+
/**
|
50
|
+
* 数值范围校验
|
51
|
+
*/
|
52
|
+
var validateRange = useCallback(function (val) {
|
53
|
+
var trimmedVal = val.trim();
|
54
|
+
var numVal = Number(trimmedVal);
|
55
|
+
if (isNaN(numVal)) {
|
56
|
+
var errorMsg = 'invalid';
|
57
|
+
setError({
|
58
|
+
msg: errorMsg
|
59
|
+
});
|
60
|
+
return {
|
61
|
+
isValid: false,
|
62
|
+
errorMsg: errorMsg
|
63
|
+
};
|
64
|
+
}
|
65
|
+
if (min !== undefined && numVal < min) {
|
66
|
+
var _errorMsg = 'invalid';
|
67
|
+
setError({
|
68
|
+
msg: _errorMsg
|
69
|
+
});
|
70
|
+
return {
|
71
|
+
isValid: false,
|
72
|
+
errorMsg: _errorMsg
|
73
|
+
};
|
74
|
+
}
|
75
|
+
if (max !== undefined && numVal > max) {
|
76
|
+
var _errorMsg2 = 'invalid';
|
77
|
+
setError({
|
78
|
+
msg: _errorMsg2
|
79
|
+
});
|
80
|
+
return {
|
81
|
+
isValid: false,
|
82
|
+
errorMsg: _errorMsg2
|
83
|
+
};
|
84
|
+
}
|
85
|
+
setError(null);
|
86
|
+
return {
|
87
|
+
isValid: true
|
88
|
+
};
|
89
|
+
}, [min, max]);
|
90
|
+
|
91
|
+
/**
|
92
|
+
* 处理值变化
|
93
|
+
*/
|
94
|
+
var handleChangeValue = useCallback(function (val) {
|
95
|
+
// 检查小数位数限制
|
96
|
+
if (!checkScale(val)) {
|
97
|
+
return {
|
98
|
+
isValid: false,
|
99
|
+
errorMsg: 'decimal_places_exceeded'
|
100
|
+
};
|
101
|
+
}
|
102
|
+
var validation = validateRange(val);
|
103
|
+
if (validation.isValid) {
|
104
|
+
onChange === null || onChange === void 0 || onChange(val);
|
105
|
+
}
|
106
|
+
return validation;
|
107
|
+
}, [onChange, validateRange, checkScale]);
|
108
|
+
|
109
|
+
/**
|
110
|
+
* 处理数字输入(0-9)
|
111
|
+
*/
|
112
|
+
var handleNumberInput = useCallback(function (inputVal) {
|
113
|
+
var numStr = String(inputVal);
|
114
|
+
|
115
|
+
// 替换模式:直接替换当前值
|
116
|
+
if (mode === 'replace') {
|
117
|
+
return handleChangeValue(numStr);
|
118
|
+
}
|
119
|
+
|
120
|
+
// 追加模式
|
121
|
+
if (!value) {
|
122
|
+
return handleChangeValue(numStr);
|
123
|
+
}
|
124
|
+
|
125
|
+
// 处理前导零的情况
|
126
|
+
if (/^0+$/.test(value)) {
|
127
|
+
// 当前值全是0,输入非0数字时替换,输入0时追加
|
128
|
+
if (numStr === '0') {
|
129
|
+
return handleChangeValue(value + '0');
|
130
|
+
} else {
|
131
|
+
return handleChangeValue(numStr);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
// 处理以0开头但包含小数点的情况(如 "0.123")
|
136
|
+
if (/^0\.\d*$/.test(value)) {
|
137
|
+
return handleChangeValue(value + numStr);
|
138
|
+
}
|
139
|
+
|
140
|
+
// 处理以0开头的整数(如 "001", "0123")
|
141
|
+
if (/^0+\d+$/.test(value)) {
|
142
|
+
// 去除前导零后拼接
|
143
|
+
var withoutLeadingZeros = value.replace(/^0+/, '');
|
144
|
+
return handleChangeValue(withoutLeadingZeros + numStr);
|
145
|
+
}
|
146
|
+
|
147
|
+
// 正常拼接
|
148
|
+
return handleChangeValue(value + numStr);
|
149
|
+
}, [mode, value, handleChangeValue]);
|
150
|
+
|
151
|
+
/**
|
152
|
+
* 处理小数点输入
|
153
|
+
*/
|
154
|
+
var handleDecimalInput = useCallback(function () {
|
155
|
+
// 替换模式:直接设置为 "0."
|
156
|
+
if (mode === 'replace') {
|
157
|
+
return handleChangeValue('0.');
|
158
|
+
}
|
159
|
+
|
160
|
+
// 追加模式下,已经包含小数点则忽略
|
161
|
+
if (value.includes('.')) {
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
|
165
|
+
// 空值:设置为 "0."
|
166
|
+
if (!value) {
|
167
|
+
return handleChangeValue('0.');
|
168
|
+
}
|
169
|
+
|
170
|
+
// 全是0的情况:设置为 "0."
|
171
|
+
if (/^0+$/.test(value)) {
|
172
|
+
return handleChangeValue('0.');
|
173
|
+
}
|
174
|
+
|
175
|
+
// 以0开头的整数(如 "001", "0123"):去除前导零后加小数点
|
176
|
+
if (/^0+\d+$/.test(value)) {
|
177
|
+
var withoutLeadingZeros = value.replace(/^0+/, '');
|
178
|
+
return handleChangeValue(withoutLeadingZeros + '.');
|
179
|
+
}
|
180
|
+
|
181
|
+
// 正常情况,追加小数点
|
182
|
+
return handleChangeValue(value + '.');
|
183
|
+
}, [mode, value, handleChangeValue]);
|
184
|
+
|
185
|
+
/**
|
186
|
+
* 处理其他字符输入
|
187
|
+
*/
|
188
|
+
var handleOtherInput = useCallback(function (inputVal) {
|
189
|
+
var inputStr = String(inputVal);
|
190
|
+
if (mode === 'replace') {
|
191
|
+
return handleChangeValue(inputStr);
|
192
|
+
}
|
193
|
+
return handleChangeValue(value + inputStr);
|
194
|
+
}, [mode, value, handleChangeValue]);
|
195
|
+
|
196
|
+
/**
|
197
|
+
* 主要的键盘输入处理函数
|
198
|
+
*/
|
199
|
+
var handleKeyInput = useCallback(function (val) {
|
200
|
+
switch (val) {
|
201
|
+
case undefined:
|
202
|
+
break;
|
203
|
+
|
204
|
+
// 确认操作
|
205
|
+
case 'ok':
|
206
|
+
case 'enter':
|
207
|
+
case 'done':
|
208
|
+
var validation = validateRange(value);
|
209
|
+
if (validation.isValid) {
|
210
|
+
onEnter === null || onEnter === void 0 || onEnter(value);
|
211
|
+
}
|
212
|
+
break;
|
213
|
+
|
214
|
+
// 重置操作
|
215
|
+
case 'reset':
|
216
|
+
setError(null);
|
217
|
+
onReset === null || onReset === void 0 || onReset();
|
218
|
+
break;
|
219
|
+
|
220
|
+
// 清空操作
|
221
|
+
case 'clear':
|
222
|
+
setError(null);
|
223
|
+
handleChangeValue('');
|
224
|
+
break;
|
225
|
+
|
226
|
+
// 删除操作
|
227
|
+
case 'delete':
|
228
|
+
handleChangeValue(value.slice(0, -1));
|
229
|
+
break;
|
230
|
+
|
231
|
+
// 小数点
|
232
|
+
case '.':
|
233
|
+
handleDecimalInput();
|
234
|
+
break;
|
235
|
+
|
236
|
+
// 数字输入
|
237
|
+
default:
|
238
|
+
if (isNumber(val) || String(val) === '0') {
|
239
|
+
handleNumberInput(val);
|
240
|
+
} else {
|
241
|
+
// 其他字符
|
242
|
+
handleOtherInput(val);
|
243
|
+
}
|
244
|
+
break;
|
245
|
+
}
|
246
|
+
}, [value, validateRange, onEnter, onReset, handleChangeValue, handleDecimalInput, handleNumberInput, handleOtherInput]);
|
247
|
+
return {
|
248
|
+
handleChange: handleKeyInput,
|
249
|
+
error: error
|
250
|
+
};
|
251
|
+
};
|
252
|
+
export default useKeyActions;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
declare const useRightItems: (props: {
|
3
|
+
rightItemsStyle?: any;
|
4
|
+
doneText?: string;
|
5
|
+
resetText?: string;
|
6
|
+
}) => ({
|
7
|
+
value: string;
|
8
|
+
label: JSX.Element;
|
9
|
+
disabled: boolean;
|
10
|
+
type: string;
|
11
|
+
style: any;
|
12
|
+
size?: undefined;
|
13
|
+
} | {
|
14
|
+
value: string;
|
15
|
+
label: string;
|
16
|
+
disabled: boolean;
|
17
|
+
type: string;
|
18
|
+
style: any;
|
19
|
+
size?: undefined;
|
20
|
+
} | {
|
21
|
+
value: string;
|
22
|
+
label: string;
|
23
|
+
disabled: boolean;
|
24
|
+
type: string;
|
25
|
+
size: number;
|
26
|
+
style: any;
|
27
|
+
})[];
|
28
|
+
export default useRightItems;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
import React, { useMemo } from 'react';
|
8
|
+
import { Icon } from '@pisell/materials';
|
9
|
+
var useRightItems = function useRightItems(props) {
|
10
|
+
var rightItemsStyle = props.rightItemsStyle,
|
11
|
+
doneText = props.doneText,
|
12
|
+
resetText = props.resetText;
|
13
|
+
var rightItems = useMemo(function () {
|
14
|
+
return [{
|
15
|
+
value: 'delete',
|
16
|
+
label: /*#__PURE__*/React.createElement(Icon, {
|
17
|
+
type: "pisell2-delete"
|
18
|
+
}),
|
19
|
+
disabled: false,
|
20
|
+
type: 'text',
|
21
|
+
style: _objectSpread({
|
22
|
+
color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.textColor) || '#000000',
|
23
|
+
backgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.buttonBackgroundColor) || '#ffffff'
|
24
|
+
}, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.deleteButtonStyle) || {})
|
25
|
+
}, {
|
26
|
+
value: 'reset',
|
27
|
+
label: resetText || 'Reset',
|
28
|
+
disabled: false,
|
29
|
+
type: 'text',
|
30
|
+
style: _objectSpread({
|
31
|
+
fontSize: '18px',
|
32
|
+
color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonTextColor) || '#D92D20',
|
33
|
+
backgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonBackgroundColor) || '#ffffff'
|
34
|
+
}, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonStyle) || {})
|
35
|
+
}, {
|
36
|
+
value: 'done',
|
37
|
+
label: doneText || 'Done',
|
38
|
+
disabled: false,
|
39
|
+
type: 'primary',
|
40
|
+
size: 2,
|
41
|
+
style: _objectSpread({
|
42
|
+
fontSize: '18px',
|
43
|
+
background: rightItemsStyle !== null && rightItemsStyle !== void 0 && rightItemsStyle.isDoneButtonFollowTheme ? 'var(--theme-color)' : (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonBackgroundColor) || '#5d3f9f',
|
44
|
+
color: rightItemsStyle !== null && rightItemsStyle !== void 0 && rightItemsStyle.isDoneButtonFollowTheme ? '#ffffff' : (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonTextColor) || '#ffffff'
|
45
|
+
}, (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonStyle) || {})
|
46
|
+
}];
|
47
|
+
}, [doneText, resetText, rightItemsStyle]);
|
48
|
+
return rightItems;
|
49
|
+
};
|
50
|
+
export default useRightItems;
|