@pisell/private-materials 6.3.3 → 6.3.4
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/businessModel/SalesModel/index.d.ts +1 -0
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Content/index.js +1 -1
- package/es/components/appointmentBooking/components/Content/index.less +3 -3
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Services/index.js +2 -2
- package/es/components/appointmentBooking/index.js +8 -2
- package/es/components/booking/components/TabProduct/index.d.ts +1 -0
- package/es/components/booking/components/formItemChildrenWrap/index.d.ts +1 -0
- package/es/components/booking/forms/table/index.d.ts +1 -0
- package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/booking/info/service/Lists.d.ts +1 -0
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/es/components/booking/info/service/like/index.d.ts +1 -0
- package/es/components/booking/info/service2/Lists.d.ts +1 -0
- package/es/components/booking/info2/service/addTimeModal/index.js +0 -1
- package/es/components/booking/materiels/holder/index.d.ts +1 -0
- package/es/components/booking/materiels/startTime/index.d.ts +1 -0
- package/es/components/eftpos/deviceList/index.d.ts +1 -0
- package/es/components/eftpos/form/index.d.ts +1 -0
- package/es/components/eftpos/group/index.d.ts +1 -0
- package/es/components/eftpos/hooks.d.ts +1 -0
- package/es/components/eftpos/icon/apiKey.d.ts +1 -0
- package/es/components/eftpos/icon/device.d.ts +1 -0
- package/es/components/eftpos/receipt/index.d.ts +1 -0
- package/es/components/eftpos/surcharge/index.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/component/alert/warn.d.ts +1 -0
- package/es/components/eftposPay/component/header/titlebar.d.ts +1 -0
- package/es/components/eftposPay/component/step/index.d.ts +1 -0
- package/es/components/eftposPay/component/step/step.d.ts +1 -0
- 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 +2 -2
- package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/eventBooking/index.js +8 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/es/components/schedules/calendar/calendarItem.d.ts +1 -0
- package/es/components/schedules/components/CurrentDay/index.d.ts +1 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
- package/es/components/schedules/products/index.d.ts +1 -0
- package/es/components/schedules/resources/relationProduct/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +2 -2
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/es/hooks/useWindowSize.js +8 -1
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.js +29 -0
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
- package/es/plus/productSelect/CategoryTabs/index.d.ts +18 -0
- package/es/plus/productSelect/CategoryTabs/index.js +171 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.js +37 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
- package/es/plus/productSelect/ProductCard/index.d.ts +45 -0
- package/es/plus/productSelect/ProductCard/index.js +170 -0
- package/es/plus/productSelect/ProductCard/index.less +270 -0
- package/es/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
- package/es/plus/productSelect/ProductList/gridComponents.js +149 -0
- package/es/plus/productSelect/ProductList/index.d.ts +22 -0
- package/es/plus/productSelect/ProductList/index.js +72 -0
- package/es/plus/productSelect/ProductList/index.less +0 -0
- package/es/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
- package/es/plus/productSelect/components/IntersectionObserver.js +276 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.js +357 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
- package/es/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
- package/es/plus/productSelect/components/TabsStructure/hooks.js +243 -0
- package/es/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
- package/es/plus/productSelect/components/TabsStructure/index.js +13 -0
- package/es/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
- package/es/plus/productSelect/components/TabsStructure/styles.js +87 -0
- package/es/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
- package/es/plus/productSelect/components/TabsStructure/types.js +1 -0
- package/es/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
- package/es/plus/productSelect/components/TabsStructure/utils.js +56 -0
- package/es/plus/productSelect/components/pisellPriceText/index.d.ts +11 -0
- package/es/plus/productSelect/components/pisellPriceText/index.js +43 -0
- package/es/plus/productSelect/hooks/useToken.d.ts +18 -0
- package/es/plus/productSelect/hooks/useToken.js +34 -0
- package/es/plus/productSelect/index.d.ts +31 -0
- package/es/plus/productSelect/index.js +270 -0
- package/es/plus/productSelect/index.less +56 -0
- package/es/plus/productSelect/locales.d.ts +18 -0
- package/es/plus/productSelect/locales.js +17 -0
- package/es/plus/productSelect/theme/token.d.ts +17 -0
- package/es/plus/productSelect/theme/token.js +19 -0
- package/es/plus/productSelect/utils.d.ts +39 -0
- package/es/plus/productSelect/utils.js +162 -0
- package/lib/businessModel/SalesModel/index.d.ts +1 -0
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Content/index.js +1 -1
- package/lib/components/appointmentBooking/components/Content/index.less +3 -3
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Services/index.js +2 -2
- package/lib/components/appointmentBooking/index.js +6 -1
- package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
- package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +1 -0
- package/lib/components/booking/forms/table/index.d.ts +1 -0
- package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/booking/info/service/Lists.d.ts +1 -0
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/lib/components/booking/info/service/like/index.d.ts +1 -0
- package/lib/components/booking/info/service2/Lists.d.ts +1 -0
- package/lib/components/booking/info2/service/addTimeModal/index.js +0 -1
- package/lib/components/booking/materiels/holder/index.d.ts +1 -0
- package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
- package/lib/components/eftpos/deviceList/index.d.ts +1 -0
- package/lib/components/eftpos/form/index.d.ts +1 -0
- package/lib/components/eftpos/group/index.d.ts +1 -0
- package/lib/components/eftpos/hooks.d.ts +1 -0
- package/lib/components/eftpos/icon/apiKey.d.ts +1 -0
- package/lib/components/eftpos/icon/device.d.ts +1 -0
- package/lib/components/eftpos/receipt/index.d.ts +1 -0
- package/lib/components/eftpos/surcharge/index.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/component/alert/warn.d.ts +1 -0
- package/lib/components/eftposPay/component/header/titlebar.d.ts +1 -0
- package/lib/components/eftposPay/component/step/index.d.ts +1 -0
- package/lib/components/eftposPay/component/step/step.d.ts +1 -0
- 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 +2 -2
- package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/eventBooking/index.js +6 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/lib/components/schedules/calendar/calendarItem.d.ts +1 -0
- package/lib/components/schedules/components/CurrentDay/index.d.ts +1 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
- package/lib/components/schedules/products/index.d.ts +1 -0
- package/lib/components/schedules/resources/relationProduct/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +2 -2
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lib/hooks/useWindowSize.js +6 -1
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.js +62 -0
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
- package/lib/plus/productSelect/CategoryTabs/index.d.ts +18 -0
- package/lib/plus/productSelect/CategoryTabs/index.js +183 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.js +58 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
- package/lib/plus/productSelect/ProductCard/index.d.ts +45 -0
- package/lib/plus/productSelect/ProductCard/index.js +184 -0
- package/lib/plus/productSelect/ProductCard/index.less +270 -0
- package/lib/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
- package/lib/plus/productSelect/ProductList/gridComponents.js +148 -0
- package/lib/plus/productSelect/ProductList/index.d.ts +22 -0
- package/lib/plus/productSelect/ProductList/index.js +86 -0
- package/lib/plus/productSelect/ProductList/index.less +0 -0
- package/lib/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
- package/lib/plus/productSelect/components/IntersectionObserver.js +269 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.js +393 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
- package/lib/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
- package/lib/plus/productSelect/components/TabsStructure/hooks.js +209 -0
- package/lib/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
- package/lib/plus/productSelect/components/TabsStructure/index.js +92 -0
- package/lib/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
- package/lib/plus/productSelect/components/TabsStructure/styles.js +122 -0
- package/lib/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
- package/lib/plus/productSelect/components/TabsStructure/types.js +17 -0
- package/lib/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
- package/lib/plus/productSelect/components/TabsStructure/utils.js +72 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.d.ts +11 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.js +72 -0
- package/lib/plus/productSelect/hooks/useToken.d.ts +18 -0
- package/lib/plus/productSelect/hooks/useToken.js +50 -0
- package/lib/plus/productSelect/index.d.ts +31 -0
- package/lib/plus/productSelect/index.js +299 -0
- package/lib/plus/productSelect/index.less +56 -0
- package/lib/plus/productSelect/locales.d.ts +18 -0
- package/lib/plus/productSelect/locales.js +41 -0
- package/lib/plus/productSelect/theme/token.d.ts +17 -0
- package/lib/plus/productSelect/theme/token.js +47 -0
- package/lib/plus/productSelect/utils.d.ts +39 -0
- package/lib/plus/productSelect/utils.js +138 -0
- package/package.json +2 -2
@@ -0,0 +1,105 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export declare type ScrollLocation = 'start' | 'end';
|
3
|
+
export interface TabContextValue {
|
4
|
+
selectedTab?: string;
|
5
|
+
onTabChange?: (tabId: string) => void;
|
6
|
+
registerTab?: (tabId: string, element: HTMLElement) => void;
|
7
|
+
unregisterTab?: (tabId: string) => void;
|
8
|
+
railRef?: React.RefObject<HTMLDivElement>;
|
9
|
+
}
|
10
|
+
export interface TabsStructureProps {
|
11
|
+
children?: React.ReactNode;
|
12
|
+
className?: string;
|
13
|
+
/** 当前选中的tab */
|
14
|
+
selectedTab?: string;
|
15
|
+
/** tab变更回调 */
|
16
|
+
onTabChange?: (tabId: string) => void;
|
17
|
+
/** 是否启用自动滚动到选中tab */
|
18
|
+
autoScrollToSelected?: boolean;
|
19
|
+
/** Rail组件的ref,用于手动控制滚动等操作 */
|
20
|
+
railRef?: React.RefObject<HTMLDivElement>;
|
21
|
+
[key: string]: any;
|
22
|
+
}
|
23
|
+
export interface TabListContainerProps {
|
24
|
+
children?: React.ReactNode;
|
25
|
+
className?: string;
|
26
|
+
[key: string]: any;
|
27
|
+
}
|
28
|
+
export interface TabItemProps {
|
29
|
+
children?: React.ReactNode;
|
30
|
+
isSelected?: boolean;
|
31
|
+
isDisabled?: boolean;
|
32
|
+
className?: string;
|
33
|
+
onClick?: (key?: string) => void;
|
34
|
+
/** Tab的唯一标识符 */
|
35
|
+
tabId?: string;
|
36
|
+
/** 是否自动注册到上下文 */
|
37
|
+
autoRegister?: boolean;
|
38
|
+
[key: string]: any;
|
39
|
+
}
|
40
|
+
export interface RailProps {
|
41
|
+
children?: React.ReactNode;
|
42
|
+
className?: string;
|
43
|
+
[key: string]: any;
|
44
|
+
}
|
45
|
+
export interface SelectionIndicatorProps {
|
46
|
+
focusRingClasses?: string;
|
47
|
+
isFocusVisible?: boolean;
|
48
|
+
style?: React.CSSProperties;
|
49
|
+
className?: string;
|
50
|
+
[key: string]: any;
|
51
|
+
}
|
52
|
+
export interface ScrollShadowProps {
|
53
|
+
location: ScrollLocation;
|
54
|
+
visible: boolean;
|
55
|
+
className?: string;
|
56
|
+
[key: string]: any;
|
57
|
+
}
|
58
|
+
export interface ChevronButtonProps {
|
59
|
+
direction: 'prev' | 'next';
|
60
|
+
disabled?: boolean;
|
61
|
+
onClick?: () => void;
|
62
|
+
className?: string;
|
63
|
+
'aria-label'?: string;
|
64
|
+
[key: string]: any;
|
65
|
+
}
|
66
|
+
export interface ChevronControlsProps {
|
67
|
+
isPrevDisabled?: boolean;
|
68
|
+
isNextDisabled?: boolean;
|
69
|
+
onPrevClick?: () => void;
|
70
|
+
onNextClick?: () => void;
|
71
|
+
className?: string;
|
72
|
+
prevAction?: () => void;
|
73
|
+
nextAction?: () => void;
|
74
|
+
[key: string]: any;
|
75
|
+
}
|
76
|
+
export interface TabWrapperClasses {
|
77
|
+
wrapper: string;
|
78
|
+
}
|
79
|
+
export interface TabListClasses {
|
80
|
+
list: string;
|
81
|
+
}
|
82
|
+
export interface TabItemClasses {
|
83
|
+
item: string;
|
84
|
+
selected: string;
|
85
|
+
disabled: string;
|
86
|
+
}
|
87
|
+
export interface RailClasses {
|
88
|
+
rail: string;
|
89
|
+
}
|
90
|
+
export interface SelectionClasses {
|
91
|
+
selection: string;
|
92
|
+
position: string;
|
93
|
+
focused: string;
|
94
|
+
}
|
95
|
+
export interface ShadowClasses {
|
96
|
+
shadow: string;
|
97
|
+
isVisible: string;
|
98
|
+
locationStart: string;
|
99
|
+
locationEnd: string;
|
100
|
+
}
|
101
|
+
export interface ChevronClasses {
|
102
|
+
controls: string;
|
103
|
+
button: string;
|
104
|
+
disabled: string;
|
105
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
3
|
+
export declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T>;
|
4
|
+
/**
|
5
|
+
* 安全的滚动函数,包含错误处理和边界检查
|
6
|
+
* @param element - 要滚动的元素
|
7
|
+
* @param options - 滚动选项
|
8
|
+
*/
|
9
|
+
export declare function safeScrollTo(element: HTMLElement | null, options: {
|
10
|
+
left?: number;
|
11
|
+
behavior?: ScrollBehavior;
|
12
|
+
}): boolean;
|
@@ -0,0 +1,56 @@
|
|
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
|
+
export function debounce(func, wait) {
|
3
|
+
var timeout = null;
|
4
|
+
return function () {
|
5
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
6
|
+
args[_key] = arguments[_key];
|
7
|
+
}
|
8
|
+
if (timeout) {
|
9
|
+
clearTimeout(timeout);
|
10
|
+
}
|
11
|
+
timeout = setTimeout(function () {
|
12
|
+
func.apply(void 0, args);
|
13
|
+
}, wait);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
export function mergeRefs() {
|
17
|
+
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
18
|
+
refs[_key2] = arguments[_key2];
|
19
|
+
}
|
20
|
+
return function (value) {
|
21
|
+
refs.forEach(function (ref) {
|
22
|
+
if (typeof ref === 'function') {
|
23
|
+
ref(value);
|
24
|
+
} else if (ref && _typeof(ref) === 'object') {
|
25
|
+
ref.current = value;
|
26
|
+
}
|
27
|
+
});
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* 安全的滚动函数,包含错误处理和边界检查
|
33
|
+
* @param element - 要滚动的元素
|
34
|
+
* @param options - 滚动选项
|
35
|
+
*/
|
36
|
+
export function safeScrollTo(element, options) {
|
37
|
+
try {
|
38
|
+
if (!element || !element.scrollTo) {
|
39
|
+
return false;
|
40
|
+
}
|
41
|
+
var _options$left = options.left,
|
42
|
+
left = _options$left === void 0 ? 0 : _options$left,
|
43
|
+
_options$behavior = options.behavior,
|
44
|
+
behavior = _options$behavior === void 0 ? 'smooth' : _options$behavior;
|
45
|
+
var maxScrollLeft = Math.max(0, element.scrollWidth - element.clientWidth);
|
46
|
+
var safeLeft = Math.max(0, Math.min(left, maxScrollLeft));
|
47
|
+
element.scrollTo({
|
48
|
+
left: safeLeft,
|
49
|
+
behavior: behavior
|
50
|
+
});
|
51
|
+
return true;
|
52
|
+
} catch (error) {
|
53
|
+
console.warn('Failed to scroll element:', error);
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
value: string | number;
|
4
|
+
isMini?: boolean;
|
5
|
+
className?: string;
|
6
|
+
style?: React.CSSProperties;
|
7
|
+
prefix?: React.ReactElement;
|
8
|
+
suffix?: React.ReactElement;
|
9
|
+
}
|
10
|
+
declare const index: (props: IProps) => JSX.Element;
|
11
|
+
export default index;
|
@@ -0,0 +1,43 @@
|
|
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, { useMemo } from 'react';
|
8
|
+
import { PisellText } from '@pisell/materials';
|
9
|
+
import classNames from 'classnames';
|
10
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
11
|
+
var index = function index(props) {
|
12
|
+
var _context$appHelper$ut;
|
13
|
+
var context = useEngineContext();
|
14
|
+
var value = props.value;
|
15
|
+
var locale = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get('umi_locale')) || 'en';
|
16
|
+
var _useMemo = useMemo(function () {
|
17
|
+
if (!props.isMini) return ['', ''];
|
18
|
+
if (!locale) return ['From', ''];
|
19
|
+
if (locale.toLowerCase().includes('zh')) return ['', '起'];
|
20
|
+
return ['From', ''];
|
21
|
+
}, [locale, props.isMini]),
|
22
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
23
|
+
_prefix = _useMemo2[0],
|
24
|
+
_suffix = _useMemo2[1];
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
26
|
+
className: classNames('pisell-price-text', props.className)
|
27
|
+
}, props.prefix, _prefix ? /*#__PURE__*/React.createElement("span", {
|
28
|
+
className: "pisell-price-text-prefix-text",
|
29
|
+
style: {
|
30
|
+
fontSize: '0.65em',
|
31
|
+
marginRight: 4
|
32
|
+
}
|
33
|
+
}, _prefix) : null, /*#__PURE__*/React.createElement(PisellText.Amount, {
|
34
|
+
value: value
|
35
|
+
}), _suffix ? /*#__PURE__*/React.createElement("span", {
|
36
|
+
style: {
|
37
|
+
fontSize: '0.65em',
|
38
|
+
marginLeft: 4
|
39
|
+
},
|
40
|
+
className: "pisell-price-text-suffix-text"
|
41
|
+
}, _suffix) : null, props.suffix);
|
42
|
+
};
|
43
|
+
export default index;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ProductSelectToken } from '../theme/token';
|
2
|
+
export declare function useToken(customToken?: Partial<ProductSelectToken>): {
|
3
|
+
colorPrimary: string;
|
4
|
+
colorText: string;
|
5
|
+
colorTextSecondary: string;
|
6
|
+
searchInputColor: string;
|
7
|
+
containerBg: string;
|
8
|
+
tabItemBg: string;
|
9
|
+
tabItemHoverBg: string;
|
10
|
+
tabItemActiveBg: string;
|
11
|
+
categoryTextColor: string;
|
12
|
+
cardBg: string;
|
13
|
+
cardHoverBg: string;
|
14
|
+
cardSelectedBg: string;
|
15
|
+
cardSelectedTextColor: string;
|
16
|
+
cardSelectedSecondaryTextColor: string;
|
17
|
+
};
|
18
|
+
export declare function genCSSVars(token: ProductSelectToken): Record<string, string>;
|
@@ -0,0 +1,34 @@
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
+
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."); }
|
4
|
+
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); }
|
5
|
+
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; }
|
6
|
+
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; } }
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
+
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; }
|
9
|
+
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; }
|
10
|
+
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; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
|
+
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); }
|
13
|
+
import { useMemo } from 'react';
|
14
|
+
import { defaultToken } from "../theme/token";
|
15
|
+
export function useToken(customToken) {
|
16
|
+
return useMemo(function () {
|
17
|
+
// 预留 context 获取逻辑的位置
|
18
|
+
var contextToken = null;
|
19
|
+
return _objectSpread(_objectSpread(_objectSpread({}, defaultToken), contextToken || {}), customToken || {});
|
20
|
+
}, [customToken]);
|
21
|
+
}
|
22
|
+
export function genCSSVars(token) {
|
23
|
+
var cssVars = {};
|
24
|
+
Object.entries(token).forEach(function (_ref) {
|
25
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
26
|
+
key = _ref2[0],
|
27
|
+
value = _ref2[1];
|
28
|
+
var cssKey = "--ps-".concat(key.replace(/[A-Z]/g, function (m) {
|
29
|
+
return "-".concat(m.toLowerCase());
|
30
|
+
}));
|
31
|
+
cssVars[cssKey] = value;
|
32
|
+
});
|
33
|
+
return cssVars;
|
34
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './index.less';
|
3
|
+
interface ProductSelectProps {
|
4
|
+
dataSource: any[];
|
5
|
+
showSearch?: boolean;
|
6
|
+
showTab?: boolean;
|
7
|
+
layout?: {
|
8
|
+
grid: boolean;
|
9
|
+
config: string;
|
10
|
+
};
|
11
|
+
onChange: (value: any) => void;
|
12
|
+
value?: number;
|
13
|
+
loading?: boolean;
|
14
|
+
style?: React.CSSProperties;
|
15
|
+
emptyDescription?: string;
|
16
|
+
/** 当前滚动元素 */
|
17
|
+
scrollDom?: string;
|
18
|
+
/** 商品列表上方的其它组件 */
|
19
|
+
offsetDom?: any;
|
20
|
+
/** 样式变量 */
|
21
|
+
token?: Partial<any>;
|
22
|
+
/** 后台装修单选模式下的已选中项 */
|
23
|
+
selectedItems?: Array<any>;
|
24
|
+
/** 后台装修配置 */
|
25
|
+
productListSetting?: Partial<any>;
|
26
|
+
/** 兼容scrollDom */
|
27
|
+
customScrollParent?: HTMLElement | string;
|
28
|
+
}
|
29
|
+
export declare const PREFIX = "pisell-product-select";
|
30
|
+
declare const index: ({ dataSource, emptyDescription, showSearch, scrollDom, offsetDom, style, token: customToken, onChange, value, selectedItems, productListSetting, customScrollParent, loading, layout, ...rest }: ProductSelectProps) => JSX.Element;
|
31
|
+
export default index;
|
@@ -0,0 +1,270 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
var _excluded = ["dataSource", "emptyDescription", "showSearch", "scrollDom", "offsetDom", "style", "token", "onChange", "value", "selectedItems", "productListSetting", "customScrollParent", "loading", "layout"];
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
9
|
+
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."); }
|
10
|
+
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); }
|
11
|
+
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; }
|
12
|
+
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; } }
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
16
|
+
import React, { useEffect, useCallback, useMemo, useRef, useState, useLayoutEffect } from 'react';
|
17
|
+
import classNames from 'classnames';
|
18
|
+
import { Input } from '@pisell/materials';
|
19
|
+
import { locales } from '@pisell/utils';
|
20
|
+
import SearchLg from '@pisell/icon/es/SearchLg';
|
21
|
+
import CategoryTabs, { CategorySkeleton } from "./CategoryTabs";
|
22
|
+
import ProductList, { createGridComponents } from "./ProductList";
|
23
|
+
import { useToken, genCSSVars } from "./hooks/useToken";
|
24
|
+
import { groupProductsByCategory, getElementByIdentifier, getOffsetTopRelativeToScrollContainer } from "./utils";
|
25
|
+
import IntersectionObserverProvider from "./components/IntersectionObserver";
|
26
|
+
import ProductCard, { ProductCardSkeleton } from "./ProductCard";
|
27
|
+
import localeTexts from "./locales";
|
28
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
29
|
+
import { PisellEmpty } from '@pisell/materials';
|
30
|
+
import "./index.less";
|
31
|
+
// 虚假数据常量,用于loading状态
|
32
|
+
var MOCK_DATA = function () {
|
33
|
+
var mockData = [];
|
34
|
+
// 添加分类项
|
35
|
+
mockData.push({
|
36
|
+
__typename: 'category',
|
37
|
+
id: '_c1_1'
|
38
|
+
});
|
39
|
+
// 添加该分类下的商品
|
40
|
+
for (var productIndex = 0; productIndex < 4; productIndex++) {
|
41
|
+
mockData.push({
|
42
|
+
__typename: 'product',
|
43
|
+
id: '_pi' + productIndex
|
44
|
+
});
|
45
|
+
}
|
46
|
+
return mockData;
|
47
|
+
}();
|
48
|
+
export var PREFIX = 'pisell-product-select';
|
49
|
+
var CONTAINER_CLASS = "".concat(PREFIX, "-wrapper");
|
50
|
+
var index = function index(_ref) {
|
51
|
+
var _ref$dataSource = _ref.dataSource,
|
52
|
+
dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
|
53
|
+
emptyDescription = _ref.emptyDescription,
|
54
|
+
_ref$showSearch = _ref.showSearch,
|
55
|
+
showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
|
56
|
+
scrollDom = _ref.scrollDom,
|
57
|
+
offsetDom = _ref.offsetDom,
|
58
|
+
_ref$style = _ref.style,
|
59
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
60
|
+
customToken = _ref.token,
|
61
|
+
onChange = _ref.onChange,
|
62
|
+
value = _ref.value,
|
63
|
+
selectedItems = _ref.selectedItems,
|
64
|
+
_ref$productListSetti = _ref.productListSetting,
|
65
|
+
productListSetting = _ref$productListSetti === void 0 ? {} : _ref$productListSetti,
|
66
|
+
customScrollParent = _ref.customScrollParent,
|
67
|
+
_ref$loading = _ref.loading,
|
68
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
69
|
+
layout = _ref.layout,
|
70
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
71
|
+
var searchRef = useRef(null);
|
72
|
+
var _useState = useState(''),
|
73
|
+
_useState2 = _slicedToArray(_useState, 2),
|
74
|
+
keyword = _useState2[0],
|
75
|
+
setKeyword = _useState2[1];
|
76
|
+
var _useState3 = useState(''),
|
77
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
78
|
+
activeKey = _useState4[0],
|
79
|
+
setActiveKey = _useState4[1];
|
80
|
+
var _useState5 = useState(null),
|
81
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
82
|
+
scrollParent = _useState6[0],
|
83
|
+
setScrollParent = _useState6[1];
|
84
|
+
var isIndicatorVisibleRef = useRef(false);
|
85
|
+
var containerRef = useRef(null);
|
86
|
+
var _customScrollParent = customScrollParent || scrollDom;
|
87
|
+
var gridComponents = useMemo(function () {
|
88
|
+
return createGridComponents(layout);
|
89
|
+
}, [layout]);
|
90
|
+
var context = useEngineContext();
|
91
|
+
useEffect(function () {
|
92
|
+
var _context$appHelper$ut;
|
93
|
+
locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get('umi_locale')) || 'en');
|
94
|
+
}, []);
|
95
|
+
var _filteredList = useMemo(function () {
|
96
|
+
if (!keyword) return dataSource;
|
97
|
+
return dataSource.filter(function (product) {
|
98
|
+
if (typeof (product === null || product === void 0 ? void 0 : product.title) !== 'string') return false;
|
99
|
+
return product.title.toLowerCase().indexOf(keyword.toLowerCase()) !== -1;
|
100
|
+
});
|
101
|
+
}, [keyword, dataSource]);
|
102
|
+
var _groupedList = useMemo(function () {
|
103
|
+
var _list = _filteredList || [];
|
104
|
+
return groupProductsByCategory(_list);
|
105
|
+
}, [_filteredList]);
|
106
|
+
var _categories = useMemo(function () {
|
107
|
+
return _groupedList.filter(function (item) {
|
108
|
+
return item.__typename === 'category';
|
109
|
+
}).map(function (item) {
|
110
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
111
|
+
key: String(item.id),
|
112
|
+
label: item.name
|
113
|
+
});
|
114
|
+
});
|
115
|
+
}, [_groupedList]);
|
116
|
+
useEffect(function () {
|
117
|
+
if (!(_categories !== null && _categories !== void 0 && _categories.length)) {
|
118
|
+
setActiveKey('');
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
if (!activeKey) {
|
122
|
+
switchCategory(_categories[0].key);
|
123
|
+
} else {
|
124
|
+
var found = _categories.find(function (category) {
|
125
|
+
return category.key === activeKey;
|
126
|
+
});
|
127
|
+
if (!found) switchCategory(_categories[0].key);
|
128
|
+
}
|
129
|
+
}, [_categories]);
|
130
|
+
useLayoutEffect(function () {
|
131
|
+
if (_customScrollParent) {
|
132
|
+
var sp = getElementByIdentifier(_customScrollParent);
|
133
|
+
setScrollParent(sp);
|
134
|
+
}
|
135
|
+
}, [_customScrollParent]);
|
136
|
+
var token = useToken(customToken);
|
137
|
+
var cssVars = useMemo(function () {
|
138
|
+
return genCSSVars(token);
|
139
|
+
}, [token]);
|
140
|
+
var mergedStyle = useMemo(function () {
|
141
|
+
var baseStyle = _objectSpread(_objectSpread({}, cssVars), style);
|
142
|
+
if (!scrollParent) return baseStyle;
|
143
|
+
if (scrollParent !== containerRef.current) {
|
144
|
+
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
145
|
+
overflow: 'unset',
|
146
|
+
height: 'unset'
|
147
|
+
});
|
148
|
+
}
|
149
|
+
return baseStyle;
|
150
|
+
}, [cssVars, style, scrollParent]);
|
151
|
+
var disabled = useMemo(function () {
|
152
|
+
return !!(productListSetting !== null && productListSetting !== void 0 && productListSetting.list_max_length) && Array.isArray(selectedItems) && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0;
|
153
|
+
}, [productListSetting, selectedItems]);
|
154
|
+
var _onChange = useCallback(function (value) {
|
155
|
+
if (disabled) return;
|
156
|
+
onChange === null || onChange === void 0 || onChange(value);
|
157
|
+
}, [disabled, onChange]);
|
158
|
+
var debounceIndicator = useCallback(function (delay) {
|
159
|
+
isIndicatorVisibleRef.current = true;
|
160
|
+
var timeoutId = setTimeout(function () {
|
161
|
+
isIndicatorVisibleRef.current = false;
|
162
|
+
}, delay);
|
163
|
+
return function () {
|
164
|
+
return clearTimeout(timeoutId);
|
165
|
+
};
|
166
|
+
}, []);
|
167
|
+
var lastActiveKeyRef = useRef('');
|
168
|
+
|
169
|
+
// 项目进入视口时的回调
|
170
|
+
var handleItemIntersectionIn = useCallback(function (item) {
|
171
|
+
var _key = String(item.__categoryId);
|
172
|
+
if (!isIndicatorVisibleRef.current && _key && _key !== lastActiveKeyRef.current) {
|
173
|
+
setActiveKey(_key);
|
174
|
+
lastActiveKeyRef.current = _key;
|
175
|
+
}
|
176
|
+
}, []);
|
177
|
+
var switchCategory = function switchCategory(key) {
|
178
|
+
setActiveKey(key);
|
179
|
+
lastActiveKeyRef.current = key; // 同步ref值
|
180
|
+
debounceIndicator(300);
|
181
|
+
var categoryIndex = _groupedList.findIndex(function (item) {
|
182
|
+
return item.__typename === 'category' && String(item.id) === key;
|
183
|
+
});
|
184
|
+
// 获取可滚动祖先元素
|
185
|
+
var _scrollParent = scrollParent || containerRef.current;
|
186
|
+
if (!_scrollParent || !containerRef.current) return;
|
187
|
+
var target = document.getElementById("ps_category_".concat(key));
|
188
|
+
if (!target) return;
|
189
|
+
// 获取产品选择器包装容器
|
190
|
+
var productSelectWrapper = document.querySelector(".".concat(PREFIX, "-wrapper"));
|
191
|
+
// 获取标签页包装容器
|
192
|
+
var tabsWrapper = document.querySelector(".".concat(PREFIX, "__tabs-wrapper"));
|
193
|
+
var tabsHeight = (tabsWrapper === null || tabsWrapper === void 0 ? void 0 : tabsWrapper.offsetHeight) || 0;
|
194
|
+
// 获取额外偏移元素(如固定头部等)
|
195
|
+
var offsetElement = getElementByIdentifier(offsetDom);
|
196
|
+
var extraOffset = offsetElement ? offsetElement.clientHeight : 0;
|
197
|
+
if (categoryIndex === 0) {
|
198
|
+
// 如果是第一个tab,滚动到产品选择器包装容器的位置
|
199
|
+
if (productSelectWrapper) {
|
200
|
+
var wrapperOffsetTop = getOffsetTopRelativeToScrollContainer(productSelectWrapper, _scrollParent);
|
201
|
+
_scrollParent.scrollTop = wrapperOffsetTop - extraOffset;
|
202
|
+
}
|
203
|
+
return;
|
204
|
+
} else {
|
205
|
+
// 其他tab,滚动到对应列表元素位置,需要减去标签页高度
|
206
|
+
var listOffsetTop = getOffsetTopRelativeToScrollContainer(target, _scrollParent);
|
207
|
+
_scrollParent.scrollTop = listOffsetTop - tabsHeight - extraOffset;
|
208
|
+
}
|
209
|
+
};
|
210
|
+
return /*#__PURE__*/React.createElement("div", {
|
211
|
+
ref: containerRef,
|
212
|
+
className: classNames(PREFIX, CONTAINER_CLASS, {
|
213
|
+
disabled: disabled
|
214
|
+
}),
|
215
|
+
style: mergedStyle
|
216
|
+
}, showSearch ? /*#__PURE__*/React.createElement("div", {
|
217
|
+
className: "".concat(PREFIX, "__search-wrapper")
|
218
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
219
|
+
ref: searchRef,
|
220
|
+
prefix: /*#__PURE__*/React.createElement(SearchLg, null),
|
221
|
+
style: {
|
222
|
+
height: 44
|
223
|
+
},
|
224
|
+
placeholder: locales.getText('pisell2.product-select.search'),
|
225
|
+
allowClear: true,
|
226
|
+
value: keyword,
|
227
|
+
onChange: function onChange(e) {
|
228
|
+
// switchCategory('');
|
229
|
+
setKeyword(e.target.value);
|
230
|
+
}
|
231
|
+
})) : null, /*#__PURE__*/React.createElement(CategoryTabs, {
|
232
|
+
activeKey: activeKey,
|
233
|
+
items: _categories,
|
234
|
+
onChange: switchCategory,
|
235
|
+
loading: loading,
|
236
|
+
skeleton: /*#__PURE__*/React.createElement(CategorySkeleton, null)
|
237
|
+
}), !loading && !(_groupedList !== null && _groupedList !== void 0 && _groupedList.length) ? /*#__PURE__*/React.createElement(PisellEmpty, {
|
238
|
+
description: emptyDescription || locales.getText('pisell2.product-select.empty')
|
239
|
+
}) : /*#__PURE__*/React.createElement(IntersectionObserverProvider, {
|
240
|
+
rootMargin: "-270px 0px -270px 0px",
|
241
|
+
priorityMode: "top"
|
242
|
+
}, /*#__PURE__*/React.createElement(ProductList, {
|
243
|
+
className: "".concat(PREFIX, "__product-list"),
|
244
|
+
loading: loading,
|
245
|
+
data: loading ? MOCK_DATA : _groupedList,
|
246
|
+
context: {
|
247
|
+
onItemIntersectionIn: handleItemIntersectionIn,
|
248
|
+
onItemIntersectionOut: function onItemIntersectionOut() {}
|
249
|
+
},
|
250
|
+
_customScrollParent: scrollParent,
|
251
|
+
components: gridComponents,
|
252
|
+
itemContent: function itemContent(index, item, context) {
|
253
|
+
if (loading) {
|
254
|
+
return /*#__PURE__*/React.createElement(ProductCardSkeleton, {
|
255
|
+
index: index,
|
256
|
+
item: item
|
257
|
+
});
|
258
|
+
}
|
259
|
+
return /*#__PURE__*/React.createElement(ProductCard, {
|
260
|
+
index: index,
|
261
|
+
item: item,
|
262
|
+
context: context,
|
263
|
+
onSelect: _onChange,
|
264
|
+
isSelected: item.id === value,
|
265
|
+
decorateConfig: productListSetting
|
266
|
+
});
|
267
|
+
}
|
268
|
+
})));
|
269
|
+
};
|
270
|
+
export default index;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
.pisell-product-select {
|
2
|
+
&-wrapper {
|
3
|
+
height: 100%;
|
4
|
+
background: var(--ps-container-bg, #ffffff);
|
5
|
+
overflow-y: auto;
|
6
|
+
|
7
|
+
&::-webkit-scrollbar {
|
8
|
+
display: none !important;
|
9
|
+
}
|
10
|
+
|
11
|
+
&.disabled {
|
12
|
+
.pisell-product-select__product-card {
|
13
|
+
background: var(--ps-card-hover-bg, #eaecf0);
|
14
|
+
cursor: not-allowed;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
&__search-wrapper {
|
20
|
+
padding: 12px 12px 0px;
|
21
|
+
line-height: 0;
|
22
|
+
margin-top: 0 !important;
|
23
|
+
|
24
|
+
.pisell-lowcode-input-affix-wrapper {
|
25
|
+
&:hover,
|
26
|
+
&:focus,
|
27
|
+
&:focus-within {
|
28
|
+
border-color: var(--ps-color-primary, #8157d5) !important;
|
29
|
+
box-shadow: none !important;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
> span {
|
34
|
+
background: var(--ps-container-bg, #ffffff);
|
35
|
+
color: var(--ps-search-input-color, #98a2b3);
|
36
|
+
}
|
37
|
+
|
38
|
+
input {
|
39
|
+
background: transparent;
|
40
|
+
color: var(--ps-search-input-color, #98a2b3);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
&__product-list {
|
45
|
+
padding: 0px 12px 12px;
|
46
|
+
}
|
47
|
+
|
48
|
+
&__tabs-wrapper {
|
49
|
+
position: sticky;
|
50
|
+
top: 0;
|
51
|
+
z-index: 10;
|
52
|
+
// 基础样式采用原pill样式
|
53
|
+
padding: 16px 12px;
|
54
|
+
background: var(--ps-container-bg, #fff);
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
en: {
|
3
|
+
'pisell2.product-select.search': string;
|
4
|
+
'pisell2.product-select.stock': string;
|
5
|
+
'pisell2.product-select.empty': string;
|
6
|
+
};
|
7
|
+
'zh-CN': {
|
8
|
+
'pisell2.product-select.search': string;
|
9
|
+
'pisell2.product-select.stock': string;
|
10
|
+
'pisell2.product-select.empty': string;
|
11
|
+
};
|
12
|
+
'zh-HK': {
|
13
|
+
'pisell2.product-select.search': string;
|
14
|
+
'pisell2.product-select.stock': string;
|
15
|
+
'pisell2.product-select.empty': string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default _default;
|