@pisell/private-materials 6.8.86 → 6.8.87
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 +9 -9
- 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/components/customiseItemModal/index.js +4 -7
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/deposit/index.d.ts +0 -1
- package/es/components/booking/info/index.d.ts +0 -1
- package/es/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.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 +4 -4
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/es/plus/saasLogin/utils.d.ts +5 -5
- package/es/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/utils/transformBundleGroup.js +5 -0
- package/es/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +1 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/pro/NumericStepper/index.d.ts +21 -1
- package/es/pro/NumericStepper/index.js +74 -66
- package/es/pro/NumericStepper/index.less +289 -136
- package/es/pro/Selector/demo.d.ts +0 -1
- package/es/pro/Selector/hooks/usePresetProps.js +2 -1
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +24 -0
- package/es/pro/keyboards/locales.js +35 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +524 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +2 -1
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +2 -1
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +0 -1
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +6 -3
- package/es/pro/skuDetailModal/index.js +6 -8
- package/es/pro/skuDetailModal/index.less +4 -4
- package/lib/components/booking/components/customiseItemModal/index.js +4 -5
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/deposit/index.d.ts +0 -1
- package/lib/components/booking/info/index.d.ts +0 -1
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.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 +4 -4
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/lib/plus/saasLogin/utils.d.ts +5 -5
- package/lib/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/utils/transformBundleGroup.js +5 -0
- package/lib/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +1 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/pro/NumericStepper/index.d.ts +21 -1
- package/lib/pro/NumericStepper/index.js +67 -69
- package/lib/pro/NumericStepper/index.less +289 -136
- package/lib/pro/Selector/demo.d.ts +0 -1
- package/lib/pro/Selector/hooks/usePresetProps.js +2 -1
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +24 -0
- package/lib/pro/keyboards/locales.js +47 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +2 -1
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +2 -1
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +0 -1
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +6 -3
- package/lib/pro/skuDetailModal/index.js +94 -41
- package/lib/pro/skuDetailModal/index.less +4 -4
- package/package.json +1 -1
- package/es/pro/pisellNumberSelector/example.d.ts +0 -3
- package/es/pro/pisellNumberSelector/example.js +0 -68
- package/lib/pro/pisellNumberSelector/example.d.ts +0 -3
- package/lib/pro/pisellNumberSelector/example.js +0 -93
|
@@ -6,11 +6,9 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React, { useState, useEffect, useRef } from 'react';
|
|
8
8
|
import { Modal, Input, Checkbox, Button } from 'antd';
|
|
9
|
-
// import { X } from '@pisell/icon';
|
|
10
9
|
import { locales } from '@pisell/utils';
|
|
11
10
|
import { useToast } from '@pisell/materials';
|
|
12
|
-
|
|
13
|
-
import PisellNumberSelector from "../../../../pro/pisellNumberSelector";
|
|
11
|
+
import NumericStepper from "../../../../pro/NumericStepper";
|
|
14
12
|
import PisellPriceKeyboardModal from "../../../../pro/pisellPriceKeyboardModal";
|
|
15
13
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
16
14
|
import "./index.less";
|
|
@@ -262,7 +260,8 @@ var CustomiseItemModal = function CustomiseItemModal(_ref) {
|
|
|
262
260
|
className: "customise-item-save-btn"
|
|
263
261
|
}, locales.getText('pisell2.customise-item.save'))))), /*#__PURE__*/React.createElement("div", {
|
|
264
262
|
className: "customise-item-quantity-selector-fixed"
|
|
265
|
-
}, /*#__PURE__*/React.createElement(
|
|
263
|
+
}, /*#__PURE__*/React.createElement(NumericStepper, {
|
|
264
|
+
variant: "capsule",
|
|
266
265
|
value: quantity,
|
|
267
266
|
min: 1,
|
|
268
267
|
max: 999,
|
|
@@ -274,9 +273,7 @@ var CustomiseItemModal = function CustomiseItemModal(_ref) {
|
|
|
274
273
|
} else {
|
|
275
274
|
setQuantity(value);
|
|
276
275
|
}
|
|
277
|
-
}
|
|
278
|
-
size: "middle",
|
|
279
|
-
enablePriceAdjust: true
|
|
276
|
+
}
|
|
280
277
|
}))), /*#__PURE__*/React.createElement(PisellPriceKeyboardModal, {
|
|
281
278
|
visible: showPriceKeyboard,
|
|
282
279
|
value: priceType === 'sell' ? sellPrice : deductionPrice,
|
|
@@ -173,10 +173,10 @@ export declare const getProductTotalPrice: (item: any) => number;
|
|
|
173
173
|
export declare const getDuration: (duration: number | {
|
|
174
174
|
type: string;
|
|
175
175
|
value: number;
|
|
176
|
-
}) => number | {
|
|
176
|
+
}) => number | "flexible" | {
|
|
177
177
|
type: string;
|
|
178
178
|
value: number;
|
|
179
|
-
}
|
|
179
|
+
};
|
|
180
180
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
|
181
181
|
export declare const getIsEdit: (state: any) => boolean;
|
|
182
182
|
export {};
|
|
@@ -9,7 +9,7 @@ import { PosProps } from './const';
|
|
|
9
9
|
*/
|
|
10
10
|
declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
|
|
11
11
|
className?: string | undefined;
|
|
12
|
-
onChange?: ((status: "
|
|
12
|
+
onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
|
|
13
13
|
[keys: string]: unknown;
|
|
14
14
|
} | undefined, other?: any) => void) | undefined;
|
|
15
15
|
onClose: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PosProps, RouteType } from './const';
|
|
3
|
-
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "
|
|
3
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
4
4
|
action: RouteType;
|
|
5
5
|
device_number: string | number;
|
|
6
6
|
api: ReturnType<PosProps['getApi']>;
|
|
@@ -11,7 +11,7 @@ import './device.less';
|
|
|
11
11
|
declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, containerStyle, }: {
|
|
12
12
|
api: PayProps['api'];
|
|
13
13
|
className?: string | undefined;
|
|
14
|
-
onChange?: ((status: "
|
|
14
|
+
onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
|
|
15
15
|
[keys: string]: unknown;
|
|
16
16
|
} | undefined, other?: any) => void) | undefined;
|
|
17
17
|
onClose: () => void;
|
|
@@ -15,7 +15,7 @@ export declare const useStoreRef: <T extends {
|
|
|
15
15
|
readonly numRef: React.MutableRefObject<string | number | undefined>;
|
|
16
16
|
readonly orderIdRef: React.MutableRefObject<string | number>;
|
|
17
17
|
readonly modeRef: React.MutableRefObject<ModeEnum>;
|
|
18
|
-
readonly statusRef: React.MutableRefObject<"loading" | "success" | "
|
|
18
|
+
readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "init" | "fail" | "pedding" | "resove" | "reject" | "question">;
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
@@ -178,7 +178,7 @@ export declare const updateCustom: (payload: {
|
|
|
178
178
|
export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
|
|
179
179
|
type: EActionTypes;
|
|
180
180
|
payload: {
|
|
181
|
-
status: "loading" | "success" | "
|
|
181
|
+
status: "loading" | "success" | "warn" | "fail" | "question";
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
@@ -299,10 +299,10 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
299
299
|
name?: string | undefined;
|
|
300
300
|
symbol?: string | undefined;
|
|
301
301
|
amount?: string | number | undefined;
|
|
302
|
-
mode?: "refund" | "
|
|
302
|
+
mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
|
|
303
303
|
order_id?: string | number | undefined;
|
|
304
304
|
eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | "huifu" | undefined;
|
|
305
|
-
action?: "
|
|
305
|
+
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
306
306
|
key?: number | undefined;
|
|
307
307
|
step?: number | undefined;
|
|
308
308
|
title?: string | undefined;
|
|
@@ -312,7 +312,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
312
312
|
net?: boolean | undefined;
|
|
313
313
|
component?: string | undefined;
|
|
314
314
|
form?: string | undefined;
|
|
315
|
-
status?: "loading" | "success" | "
|
|
315
|
+
status?: "loading" | "success" | "warn" | "init" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
|
|
316
316
|
warn?: string | undefined;
|
|
317
317
|
steps?: {
|
|
318
318
|
/** 用于重置当前步骤 */
|
|
@@ -1015,7 +1015,7 @@ var AddSerivce = function AddSerivce(props) {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
// 如果是完全的普通商品
|
|
1017
1017
|
// 或者非 sessions 商品但有 sku 规格商品
|
|
1018
|
-
if (isNormalProductByDurationSchedule(item)
|
|
1018
|
+
if (isNormalProductByDurationSchedule(item)) {
|
|
1019
1019
|
const openNormalService = getOpenNormalServiceHandler();
|
|
1020
1020
|
if (openNormalService) {
|
|
1021
1021
|
openNormalService({
|
|
@@ -47,7 +47,7 @@ declare type ScanData = {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export declare const formatScanCustomer: (data: ScanData) => {
|
|
50
|
-
searchType: "
|
|
50
|
+
searchType: "customer" | "product" | "wallet" | "walletPass" | "local_product";
|
|
51
51
|
data: any;
|
|
52
52
|
scanCode: string;
|
|
53
53
|
} | null;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Capacity: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
6
6
|
export default Capacity;
|
|
@@ -3,5 +3,5 @@ import { SkuStatusOverlayConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const CardMask: ({ props }: {
|
|
5
5
|
props: SkuStatusOverlayConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
7
7
|
export default CardMask;
|
|
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const Countdown: ({ props }: {
|
|
5
5
|
props: ProductCardConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
7
7
|
export default Countdown;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Duration: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
6
6
|
export default Duration;
|
|
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const MemberPrice: ({ props }: {
|
|
5
5
|
props: ProductCardConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
7
7
|
export default MemberPrice;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Resource: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
6
6
|
export default Resource;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Stock: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
6
6
|
export default Stock;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Time: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | React.ReactFragment | JSX.Element | null;
|
|
6
6
|
export default Time;
|
|
@@ -5,13 +5,13 @@ export declare const mergeData: (locales: any, props: SaasLoginProps) => {
|
|
|
5
5
|
width?: number | undefined;
|
|
6
6
|
height?: number | undefined;
|
|
7
7
|
};
|
|
8
|
-
logoPosition: "
|
|
8
|
+
logoPosition: "left" | "right" | "center";
|
|
9
9
|
welcomeMessage: any;
|
|
10
|
-
welcomeMessageAlign: "
|
|
10
|
+
welcomeMessageAlign: "left" | "right" | "center";
|
|
11
11
|
title: any;
|
|
12
|
-
titleAlign: "
|
|
12
|
+
titleAlign: "left" | "right" | "center";
|
|
13
13
|
subtitle: any;
|
|
14
|
-
subtitleAlign: "
|
|
14
|
+
subtitleAlign: "left" | "right" | "center";
|
|
15
15
|
emailLabel: any;
|
|
16
16
|
emailPlaceholder: any;
|
|
17
17
|
passwordLabel: any;
|
|
@@ -19,7 +19,7 @@ export declare const mergeData: (locales: any, props: SaasLoginProps) => {
|
|
|
19
19
|
buttonText: any;
|
|
20
20
|
registerText: any;
|
|
21
21
|
registerLinkText: any;
|
|
22
|
-
registerAlign: "
|
|
22
|
+
registerAlign: "left" | "right" | "center";
|
|
23
23
|
showLogo?: boolean | undefined;
|
|
24
24
|
showWelcomeMessage?: boolean | undefined;
|
|
25
25
|
showTitle?: boolean | undefined;
|
|
@@ -184,6 +184,7 @@ var createBundleValue = function createBundleValue(v, dataSource) {
|
|
|
184
184
|
});
|
|
185
185
|
_createdValue.data._data = _data;
|
|
186
186
|
}
|
|
187
|
+
_createdValue.data.num = (v1 === null || v1 === void 0 ? void 0 : v1.num) || 1;
|
|
187
188
|
_createdValue.quantity = (_createdValue.quantity || 0) + ((v1 === null || v1 === void 0 ? void 0 : v1.quantity) || 0);
|
|
188
189
|
var _pricePrefix = ((_findedBundleItem2 = findedBundleItem) === null || _findedBundleItem2 === void 0 ? void 0 : _findedBundleItem2.price_type) === 'markdown' ? -1 : 1;
|
|
189
190
|
_createdValue.totalPrice = new Decimal(_createdValue.totalPrice || 0).plus(new Decimal((v1 === null || v1 === void 0 ? void 0 : v1.price) || 0).times((v1 === null || v1 === void 0 ? void 0 : v1.quantity) || 1).times(_pricePrefix)).toNumber();
|
|
@@ -3,6 +3,6 @@ export interface ImageUploadProps {
|
|
|
3
3
|
value?: string;
|
|
4
4
|
onChange?: (val: string) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const getBaseTime: (size: number) =>
|
|
6
|
+
export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
|
|
7
7
|
declare const ImageUpload: React.FC<ImageUploadProps>;
|
|
8
8
|
export default ImageUpload;
|
|
@@ -7,6 +7,12 @@ declare global {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* 样式变体类型
|
|
12
|
+
* - separated: 分离式,按钮独立显示(默认)
|
|
13
|
+
* - capsule: 胶囊式,按钮和数字在一个圆角容器内
|
|
14
|
+
*/
|
|
15
|
+
export declare type NumericStepperVariant = 'separated' | 'capsule';
|
|
10
16
|
export interface NumericStepperProps {
|
|
11
17
|
/** 当前值 */
|
|
12
18
|
value?: number;
|
|
@@ -31,12 +37,26 @@ export interface NumericStepperProps {
|
|
|
31
37
|
horizontalPadding?: number | string;
|
|
32
38
|
/** 尺寸 */
|
|
33
39
|
size?: 'small' | 'middle' | 'large';
|
|
34
|
-
/**
|
|
40
|
+
/** 按钮形状(仅在 variant='separated' 时生效) */
|
|
35
41
|
shape?: 'round' | 'square';
|
|
36
42
|
/** 减号按钮的自定义内容 */
|
|
37
43
|
minusIcon?: React.ReactNode;
|
|
38
44
|
/** 加号按钮的自定义内容 */
|
|
39
45
|
plusIcon?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* 样式变体
|
|
48
|
+
* - separated: 分离式,按钮独立显示(默认)
|
|
49
|
+
* - capsule: 胶囊式,按钮和数字在一个圆角容器内
|
|
50
|
+
* @default 'separated'
|
|
51
|
+
*/
|
|
52
|
+
variant?: NumericStepperVariant;
|
|
53
|
+
/**
|
|
54
|
+
* 是否启用输入功能(点击数字弹出键盘)
|
|
55
|
+
* - 开启时:展示区域 cursor 为 pointer,点击弹出键盘
|
|
56
|
+
* - 关闭后:展示区域无边框,点击不会弹出键盘
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
enableInput?: boolean;
|
|
40
60
|
}
|
|
41
61
|
declare const NumericStepper: React.FC<NumericStepperProps>;
|
|
42
62
|
export default NumericStepper;
|
|
@@ -1,3 +1,7 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
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
7
|
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); }
|
|
@@ -7,10 +11,16 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
11
|
import * as React from 'react';
|
|
8
12
|
import { useMemo, useState, useCallback, useEffect } from 'react';
|
|
9
13
|
import classNames from 'classnames';
|
|
10
|
-
import { Popover, PisellModal } from '@pisell/materials';
|
|
11
14
|
import { isMobile } from '@pisell/utils';
|
|
12
|
-
import NumberKeyboard from "../
|
|
15
|
+
import { NumberKeyboard } from "../keyboards";
|
|
13
16
|
import "./index.less";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 样式变体类型
|
|
20
|
+
* - separated: 分离式,按钮独立显示(默认)
|
|
21
|
+
* - capsule: 胶囊式,按钮和数字在一个圆角容器内
|
|
22
|
+
*/
|
|
23
|
+
|
|
14
24
|
var NumericStepper = function NumericStepper(_ref) {
|
|
15
25
|
var value = _ref.value,
|
|
16
26
|
_ref$defaultValue = _ref.defaultValue,
|
|
@@ -33,7 +43,11 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
33
43
|
minusIcon = _ref.minusIcon,
|
|
34
44
|
plusIcon = _ref.plusIcon,
|
|
35
45
|
_ref$horizontalPaddin = _ref.horizontalPadding,
|
|
36
|
-
horizontalPadding = _ref$horizontalPaddin === void 0 ? 0 : _ref$horizontalPaddin
|
|
46
|
+
horizontalPadding = _ref$horizontalPaddin === void 0 ? 0 : _ref$horizontalPaddin,
|
|
47
|
+
_ref$variant = _ref.variant,
|
|
48
|
+
variant = _ref$variant === void 0 ? 'separated' : _ref$variant,
|
|
49
|
+
_ref$enableInput = _ref.enableInput,
|
|
50
|
+
enableInput = _ref$enableInput === void 0 ? true : _ref$enableInput;
|
|
37
51
|
var _useState = useState(false),
|
|
38
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
53
|
open = _useState2[0],
|
|
@@ -116,7 +130,8 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
116
130
|
|
|
117
131
|
// 点击数字的处理
|
|
118
132
|
var handleNumberClick = function handleNumberClick() {
|
|
119
|
-
|
|
133
|
+
// 禁用或关闭输入功能时不响应点击
|
|
134
|
+
if (disabled || !enableInput) return;
|
|
120
135
|
// Popover 会自动处理打开,我们只需要设置初始值
|
|
121
136
|
setTempValue(currentValue.toString()); // 设置临时值为当前值
|
|
122
137
|
if (_isMobile) {
|
|
@@ -147,12 +162,7 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
147
162
|
var isIncreaseDisabled = disabled || currentValue >= max;
|
|
148
163
|
var isPlusOnly = currentValue === 0 || currentValue === undefined;
|
|
149
164
|
var outOfRange = currentValue < min || currentValue > max;
|
|
150
|
-
var stepperClasses = classNames('numeric-stepper', "numeric-stepper-".concat(size), "numeric-stepper-".concat(shape),
|
|
151
|
-
'numeric-stepper-disabled': disabled,
|
|
152
|
-
'numeric-stepper-simple': currentValue === 0 || currentValue === undefined,
|
|
153
|
-
'numeric-stepper-out-of-range': outOfRange,
|
|
154
|
-
'numeric-stepper-plus-only': isPlusOnly
|
|
155
|
-
}, className);
|
|
165
|
+
var stepperClasses = classNames('numeric-stepper', "numeric-stepper-".concat(size), "numeric-stepper-".concat(variant), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "numeric-stepper-".concat(shape), variant === 'separated'), 'numeric-stepper-disabled', disabled), 'numeric-stepper-simple', currentValue === 0 || currentValue === undefined), 'numeric-stepper-out-of-range', outOfRange), 'numeric-stepper-plus-only', isPlusOnly), 'numeric-stepper-input-disabled', !enableInput), className);
|
|
156
166
|
var _minus = !isPlusOnly && /*#__PURE__*/React.createElement("div", {
|
|
157
167
|
className: "numeric-stepper-button-wrapper numeric-stepper-minus-button-wrapper",
|
|
158
168
|
onClick: handleDecrease,
|
|
@@ -180,46 +190,49 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
180
190
|
if (isPlusOnly) {
|
|
181
191
|
return null;
|
|
182
192
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
onClick: handleNumberClick
|
|
187
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
188
|
-
className: classNames('numeric-stepper-display')
|
|
189
|
-
}, currentValue));
|
|
190
|
-
}
|
|
191
|
-
return /*#__PURE__*/React.createElement(Popover, {
|
|
192
|
-
open: open,
|
|
193
|
-
trigger: ['click'] // 恢复点击触发
|
|
194
|
-
,
|
|
195
|
-
overlayInnerStyle: {
|
|
196
|
-
padding: 0
|
|
197
|
-
},
|
|
198
|
-
destroyTooltipOnHide: true,
|
|
199
|
-
arrow: false,
|
|
200
|
-
align: {
|
|
201
|
-
offset: [0, 0]
|
|
202
|
-
},
|
|
203
|
-
overlayClassName: "pisell-number-selector-popover",
|
|
204
|
-
onOpenChange: handleOpenChange,
|
|
205
|
-
content: /*#__PURE__*/React.createElement(NumberKeyboard, {
|
|
206
|
-
max: max,
|
|
207
|
-
value: tempValue,
|
|
208
|
-
onChange: handleChange,
|
|
209
|
-
onOk: function onOk() {
|
|
210
|
-
var newValue = parseInt(tempValue) || 0;
|
|
211
|
-
var clampedValue = Math.max(min, Math.min(max, newValue));
|
|
212
|
-
onChange === null || onChange === void 0 || onChange(clampedValue);
|
|
213
|
-
setOpen(false);
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
|
|
194
|
+
// 纯展示模式(enableInput 为 false)
|
|
195
|
+
var displayElement = /*#__PURE__*/React.createElement("span", {
|
|
217
196
|
className: "numeric-stepper-display-wrapper",
|
|
218
197
|
onClick: handleNumberClick
|
|
219
198
|
}, /*#__PURE__*/React.createElement("span", {
|
|
220
199
|
className: classNames('numeric-stepper-display')
|
|
221
|
-
}, currentValue))
|
|
222
|
-
|
|
200
|
+
}, currentValue));
|
|
201
|
+
|
|
202
|
+
// 关闭输入功能时,只展示数字,不包装键盘
|
|
203
|
+
if (!enableInput) {
|
|
204
|
+
return displayElement;
|
|
205
|
+
}
|
|
206
|
+
if (_isMobile) {
|
|
207
|
+
return displayElement;
|
|
208
|
+
}
|
|
209
|
+
return /*#__PURE__*/React.createElement(NumberKeyboard, {
|
|
210
|
+
max: max,
|
|
211
|
+
min: min,
|
|
212
|
+
originalValue: currentValue.toString(),
|
|
213
|
+
defaultValue: currentValue.toString(),
|
|
214
|
+
onEnter: function onEnter(newValue) {
|
|
215
|
+
handleValueChange === null || handleValueChange === void 0 || handleValueChange(Number(newValue));
|
|
216
|
+
setOpen(false);
|
|
217
|
+
},
|
|
218
|
+
containerProps: {
|
|
219
|
+
className: 'numeric-stepper-keyboard-popover',
|
|
220
|
+
renderType: 'popover',
|
|
221
|
+
open: open,
|
|
222
|
+
onOpenChange: handleOpenChange,
|
|
223
|
+
content: /*#__PURE__*/React.createElement(NumberKeyboard, {
|
|
224
|
+
max: max,
|
|
225
|
+
min: min,
|
|
226
|
+
originalValue: currentValue.toString(),
|
|
227
|
+
defaultValue: currentValue.toString(),
|
|
228
|
+
onEnter: function onEnter(newValue) {
|
|
229
|
+
handleValueChange === null || handleValueChange === void 0 || handleValueChange(Number(newValue));
|
|
230
|
+
setOpen(false);
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
}, displayElement);
|
|
235
|
+
}, [_isMobile, open, isPlusOnly, currentValue, handleNumberClick, handleOpenChange, handleChange, max, min, onChange, tempValue, enableInput]);
|
|
223
236
|
var _plus = /*#__PURE__*/React.createElement("div", {
|
|
224
237
|
className: "numeric-stepper-button-wrapper numeric-stepper-plus-button-wrapper",
|
|
225
238
|
onClick: handleIncrease,
|
|
@@ -250,28 +263,23 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
250
263
|
onClick: function onClick(e) {
|
|
251
264
|
return e.stopPropagation();
|
|
252
265
|
}
|
|
253
|
-
}, _minus, _display, _plus, _isMobile &&
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
onCancel: function onCancel() {
|
|
263
|
-
return setOpen(false);
|
|
264
|
-
}
|
|
265
|
-
}, /*#__PURE__*/React.createElement(NumberKeyboard, {
|
|
266
|
+
}, _minus, _display, _plus, _isMobile && /*#__PURE__*/React.createElement(NumberKeyboard, {
|
|
267
|
+
containerProps: {
|
|
268
|
+
className: 'numeric-stepper-keyboard-modal',
|
|
269
|
+
renderType: 'modal',
|
|
270
|
+
open: open,
|
|
271
|
+
onCancel: function onCancel() {
|
|
272
|
+
setOpen(false);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
266
275
|
max: max,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
onChange === null || onChange === void 0 || onChange(clampedValue);
|
|
276
|
+
min: min,
|
|
277
|
+
defaultValue: currentValue.toString(),
|
|
278
|
+
originalValue: currentValue.toString(),
|
|
279
|
+
onEnter: function onEnter(newValue) {
|
|
280
|
+
handleValueChange === null || handleValueChange === void 0 || handleValueChange(Number(newValue));
|
|
273
281
|
setOpen(false);
|
|
274
282
|
}
|
|
275
|
-
}))
|
|
283
|
+
}));
|
|
276
284
|
};
|
|
277
285
|
export default NumericStepper;
|