@pisell/private-materials 6.5.27 → 6.6.2
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 +2 -2
- package/build/lowcode/preview.js +146 -165
- 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/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +273 -76
- package/es/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
- package/es/components/appointmentBooking/hooks.d.ts +1 -0
- package/es/components/appointmentBooking/hooks.js +30 -30
- package/es/components/appointmentBooking/locales.d.ts +3 -0
- package/es/components/appointmentBooking/locales.js +9 -6
- package/es/components/booking/components/actionButtons/index.js +34 -20
- package/es/components/booking/components/customSelect/index.js +1 -1
- package/es/components/booking/components/footer/amount.js +25 -8
- package/es/components/booking/components/footer/index.js +66 -33
- package/es/components/booking/components/footer/utils.d.ts +7 -0
- package/es/components/booking/components/footer/utils.js +126 -99
- package/es/components/booking/components/voucher/index.js +25 -9
- package/es/components/booking/dashboard/serve.js +1 -6
- package/es/components/booking/forms/footer.js +24 -10
- package/es/components/booking/forms/serve.js +2 -12
- package/es/components/booking/hooks/useQuotation.js +69 -21
- package/es/components/booking/info/client/index.js +28 -13
- package/es/components/booking/info/client/serve.js +2 -11
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +16 -10
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +10 -2
- package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/es/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
- package/es/components/booking/info/hooks/useHolderConfig.js +9 -2
- package/es/components/booking/info/main.js +3 -2
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/pet/serve.js +1 -6
- package/es/components/booking/info/service/Lists.d.ts +1 -1
- package/es/components/booking/info/service/Lists.js +10 -4
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service/addTimeModal/serve.js +1 -11
- package/es/components/booking/info/service/serve.d.ts +14 -0
- package/es/components/booking/info/service/serve.js +25 -18
- package/es/components/booking/info/service2/Group/utils.js +2 -0
- package/es/components/booking/info/service2/utils.d.ts +1 -33
- package/es/components/booking/info/service2/utils.js +92 -56
- package/es/components/booking/info/utils.js +5 -0
- package/es/components/booking/info2/cartClientCard/index.js +49 -9
- package/es/components/booking/info2/index.js +3 -2
- package/es/components/booking/info2/serve.js +1 -6
- package/es/components/booking/info2/service/addService/index.js +146 -89
- package/es/components/booking/info2/service/addService/utils.d.ts +9 -1
- package/es/components/booking/info2/service/addService/utils.js +83 -14
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
- package/es/components/booking/info2/service/contactInfoMode/index.js +94 -0
- package/es/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
- package/es/components/booking/info2/service/editService/Holder/index.js +193 -0
- package/es/components/booking/info2/service/editService/Holder/index.less +63 -0
- package/es/components/booking/info2/service/editService/index.js +313 -57
- package/es/components/booking/info2/utilsByBooking.js +19 -14
- package/es/components/booking/locales.d.ts +36 -0
- package/es/components/booking/locales.js +48 -3
- package/es/components/booking/model.d.ts +4 -0
- package/es/components/booking/model.js +3 -0
- package/es/components/booking/utils/confirmHolderModal.d.ts +13 -0
- package/es/components/booking/utils/confirmHolderModal.js +318 -0
- package/es/components/booking/utils/confirmHolderModal.less +40 -0
- package/es/components/booking/utils/selectHolderModal.d.ts +24 -0
- package/es/components/booking/utils/selectHolderModal.js +407 -0
- package/es/components/booking/utils.d.ts +16 -7
- package/es/components/booking/utils.js +26 -37
- package/es/components/checkout/PaymentModal.js +61 -30
- package/es/components/checkout/components/CashPaymentModule/index.js +1 -7
- package/es/components/checkout/components/ScrollableList/index.js +0 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/locales.d.ts +3 -0
- package/es/components/checkout/locales.js +3 -0
- package/es/components/eftposPay/linkly/index.js +64 -2
- package/es/components/eftposPay/tyro/index.js +12 -0
- package/es/components/list/List.js +3 -0
- package/es/components/pay/toB/components/MX51/index.js +14 -44
- package/es/components/pay/toB/types/index.d.ts +0 -12
- package/es/components/pay/toB/types/index.js +0 -4
- package/es/components/pisellSelectCustomerModal/RightPanel/serve.js +1 -5
- package/es/components/shoppingCart/components/Cart/Product.js +6 -3
- package/es/components/shoppingCart/type.d.ts +1 -0
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +421 -794
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/index.js +4 -4
- package/es/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
- package/es/components/ticketBooking/components/menuBar/index.js +109 -12
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
- package/es/components/ticketBooking/components/ticketBooking/index.js +32 -61
- package/es/components/ticketBooking/components/ticketBooking/index.less +2 -1
- package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/es/components/ticketBooking/components/timeBar/index.js +1 -4
- package/es/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
- package/es/components/ticketBooking/hooks/pisellos/useProducts.js +122 -170
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/index.js +0 -2
- package/es/components/ticketBooking/serve.js +17 -119
- package/es/components/ticketBooking/utils/index.d.ts +7 -1
- package/es/components/ticketBooking/utils/index.js +44 -28
- package/es/hooks/useEngineContext.d.ts +0 -1
- package/es/hooks/useEngineContext.js +0 -7
- package/es/index.d.ts +4 -0
- package/es/index.js +5 -1
- package/es/plus/clientCard/locales.js +3 -3
- package/es/plus/clinetSearch/index.js +28 -30
- package/es/plus/clinetSearch/locales.d.ts +3 -0
- package/es/plus/clinetSearch/locales.js +7 -4
- package/es/plus/clinetSearch/types.d.ts +12 -0
- package/es/plus/contactInfo/components/Avatar/index.d.ts +10 -0
- package/es/plus/contactInfo/components/Avatar/index.js +30 -0
- package/es/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
- package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
- package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
- package/es/plus/contactInfo/index.d.ts +6 -0
- package/es/plus/contactInfo/index.js +198 -0
- package/es/plus/contactInfo/index.less +621 -0
- package/es/plus/contactInfo/locales.d.ts +15 -0
- package/es/plus/contactInfo/locales.js +14 -0
- package/es/plus/contactInfo/types.d.ts +91 -0
- package/es/plus/contactInfo/types.js +1 -0
- package/es/plus/contactInfo/utils.d.ts +7 -0
- package/es/plus/contactInfo/utils.js +50 -0
- package/es/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
- package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
- package/es/plus/contactInfoModal/index.d.ts +41 -0
- package/es/plus/contactInfoModal/index.js +155 -0
- package/es/plus/contactInfoModal/index.less +19 -0
- package/es/plus/contactInfoModal/locales.d.ts +66 -0
- package/es/plus/contactInfoModal/locales.js +65 -0
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
- package/es/plus/productSelect/ProductCard/index.js +1 -1
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
- package/es/plus/selectHolder/components/ErrorTip/index.js +14 -0
- package/es/plus/selectHolder/components/ErrorTip/index.less +51 -0
- package/es/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
- package/es/plus/selectHolder/components/HolderItem/index.js +77 -0
- package/es/plus/selectHolder/components/HolderItem/index.less +105 -0
- package/es/plus/selectHolder/components/HolderList/index.d.ts +30 -0
- package/es/plus/selectHolder/components/HolderList/index.js +43 -0
- package/es/plus/selectHolder/index.d.ts +7 -0
- package/es/plus/selectHolder/index.js +273 -0
- package/es/plus/selectHolder/index.less +137 -0
- package/es/plus/selectHolder/locales.d.ts +24 -0
- package/es/plus/selectHolder/locales.js +29 -0
- package/es/plus/selectHolder/types.d.ts +104 -0
- package/es/plus/selectHolder/types.js +1 -0
- package/es/plus/selectHolder/utils.d.ts +9 -0
- package/es/plus/selectHolder/utils.js +16 -0
- package/es/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
- package/es/pro/comprehensiveSearch/locales.js +1 -1
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +357 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/es/pro/multiDayTimeSelect/index.js +1 -0
- package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/es/pro/multiDayTimeSelect/types.js +1 -0
- package/es/pro/skuDetailModal/types.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +6 -3
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +156 -13
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
- package/lib/components/appointmentBooking/hooks.d.ts +1 -0
- package/lib/components/appointmentBooking/hooks.js +73 -35
- package/lib/components/appointmentBooking/locales.d.ts +3 -0
- package/lib/components/appointmentBooking/locales.js +6 -3
- package/lib/components/booking/components/actionButtons/index.js +11 -2
- package/lib/components/booking/components/customSelect/index.js +1 -1
- package/lib/components/booking/components/footer/amount.js +23 -6
- package/lib/components/booking/components/footer/index.js +26 -5
- package/lib/components/booking/components/footer/utils.d.ts +7 -0
- package/lib/components/booking/components/footer/utils.js +120 -82
- package/lib/components/booking/components/voucher/index.js +10 -1
- package/lib/components/booking/dashboard/serve.js +1 -6
- package/lib/components/booking/forms/footer.js +29 -11
- package/lib/components/booking/forms/serve.js +2 -12
- package/lib/components/booking/hooks/useQuotation.js +45 -13
- package/lib/components/booking/info/client/index.js +14 -1
- package/lib/components/booking/info/client/serve.js +2 -13
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +7 -2
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -4
- package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
- package/lib/components/booking/info/hooks/useHolderConfig.d.ts +1 -0
- package/lib/components/booking/info/hooks/useHolderConfig.js +8 -3
- package/lib/components/booking/info/main.js +5 -4
- package/lib/components/booking/info/model.js +5 -0
- package/lib/components/booking/info/pet/serve.js +1 -6
- package/lib/components/booking/info/service/Lists.d.ts +1 -1
- package/lib/components/booking/info/service/Lists.js +5 -3
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service/addTimeModal/serve.js +1 -7
- package/lib/components/booking/info/service/serve.d.ts +14 -0
- package/lib/components/booking/info/service/serve.js +8 -17
- package/lib/components/booking/info/service2/Group/utils.js +2 -0
- package/lib/components/booking/info/service2/utils.d.ts +1 -33
- package/lib/components/booking/info/service2/utils.js +38 -29
- package/lib/components/booking/info/utils.js +4 -0
- package/lib/components/booking/info2/cartClientCard/index.js +34 -5
- package/lib/components/booking/info2/index.js +11 -5
- package/lib/components/booking/info2/serve.js +1 -6
- package/lib/components/booking/info2/service/addService/index.js +22 -3
- package/lib/components/booking/info2/service/addService/utils.d.ts +9 -1
- package/lib/components/booking/info2/service/addService/utils.js +48 -11
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
- package/lib/components/booking/info2/service/contactInfoMode/index.js +111 -0
- package/lib/components/booking/info2/service/editService/Holder/index.d.ts +12 -0
- package/lib/components/booking/info2/service/editService/Holder/index.js +199 -0
- package/lib/components/booking/info2/service/editService/Holder/index.less +63 -0
- package/lib/components/booking/info2/service/editService/index.js +254 -32
- package/lib/components/booking/info2/utilsByBooking.js +26 -19
- package/lib/components/booking/locales.d.ts +36 -0
- package/lib/components/booking/locales.js +42 -3
- package/lib/components/booking/model.d.ts +4 -0
- package/lib/components/booking/model.js +3 -0
- package/lib/components/booking/utils/confirmHolderModal.d.ts +13 -0
- package/lib/components/booking/utils/confirmHolderModal.js +253 -0
- package/lib/components/booking/utils/confirmHolderModal.less +40 -0
- package/lib/components/booking/utils/selectHolderModal.d.ts +24 -0
- package/lib/components/booking/utils/selectHolderModal.js +319 -0
- package/lib/components/booking/utils.d.ts +16 -7
- package/lib/components/booking/utils.js +18 -21
- package/lib/components/checkout/PaymentModal.js +41 -18
- package/lib/components/checkout/components/CashPaymentModule/index.js +1 -7
- package/lib/components/checkout/components/ScrollableList/index.js +0 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/locales.d.ts +3 -0
- package/lib/components/checkout/locales.js +3 -0
- package/lib/components/eftposPay/linkly/index.js +31 -1
- package/lib/components/eftposPay/tyro/index.js +12 -0
- package/lib/components/list/List.js +3 -0
- package/lib/components/pay/toB/components/MX51/index.js +12 -37
- package/lib/components/pay/toB/types/index.d.ts +0 -12
- package/lib/components/pisellSelectCustomerModal/RightPanel/serve.js +1 -8
- package/lib/components/shoppingCart/components/Cart/Product.js +7 -3
- package/lib/components/shoppingCart/type.d.ts +1 -0
- package/lib/components/ticketBooking/components/ProductDisplayAdapter/index.less +0 -12
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -2
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +281 -313
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -2
- package/lib/components/ticketBooking/components/addServiceVariant/index.js +5 -3
- package/lib/components/ticketBooking/components/addServiceVariant/utils.js +1 -2
- package/lib/components/ticketBooking/components/menuBar/index.js +42 -6
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +2 -4
- package/lib/components/ticketBooking/components/ticketBooking/index.js +12 -49
- package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -1
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/timeBar/index.js +1 -3
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.d.ts +0 -4
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +69 -98
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/index.js +0 -2
- package/lib/components/ticketBooking/serve.js +15 -117
- package/lib/components/ticketBooking/utils/index.d.ts +7 -1
- package/lib/components/ticketBooking/utils/index.js +29 -23
- package/lib/hooks/useEngineContext.d.ts +0 -1
- package/lib/hooks/useEngineContext.js +2 -10
- package/lib/index.d.ts +4 -0
- package/lib/index.js +12 -0
- package/lib/plus/clientCard/locales.js +3 -3
- package/lib/plus/clinetSearch/index.js +17 -8
- package/lib/plus/clinetSearch/locales.d.ts +3 -0
- package/lib/plus/clinetSearch/locales.js +7 -4
- package/lib/plus/clinetSearch/types.d.ts +12 -0
- package/lib/plus/contactInfo/components/Avatar/index.d.ts +10 -0
- package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
- package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
- package/lib/plus/contactInfo/index.d.ts +6 -0
- package/lib/plus/contactInfo/index.js +226 -0
- package/lib/plus/contactInfo/index.less +621 -0
- package/lib/plus/contactInfo/locales.d.ts +15 -0
- package/lib/plus/contactInfo/locales.js +38 -0
- package/lib/plus/contactInfo/types.d.ts +91 -0
- package/lib/plus/contactInfo/types.js +17 -0
- package/lib/plus/contactInfo/utils.d.ts +7 -0
- package/lib/plus/contactInfo/utils.js +64 -0
- package/lib/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
- package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
- package/lib/plus/contactInfoModal/index.d.ts +41 -0
- package/lib/plus/contactInfoModal/index.js +139 -0
- package/lib/plus/contactInfoModal/index.less +19 -0
- package/lib/plus/contactInfoModal/locales.d.ts +66 -0
- package/lib/plus/contactInfoModal/locales.js +89 -0
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +1 -1
- package/lib/plus/productSelect/ProductCard/index.js +1 -1
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +3 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.js +30 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.less +51 -0
- package/lib/plus/selectHolder/components/HolderItem/index.d.ts +6 -0
- package/lib/plus/selectHolder/components/HolderItem/index.js +101 -0
- package/lib/plus/selectHolder/components/HolderItem/index.less +105 -0
- package/lib/plus/selectHolder/components/HolderList/index.d.ts +30 -0
- package/lib/plus/selectHolder/components/HolderList/index.js +63 -0
- package/lib/plus/selectHolder/index.d.ts +7 -0
- package/lib/plus/selectHolder/index.js +223 -0
- package/lib/plus/selectHolder/index.less +137 -0
- package/lib/plus/selectHolder/locales.d.ts +24 -0
- package/lib/plus/selectHolder/locales.js +47 -0
- package/lib/plus/selectHolder/types.d.ts +104 -0
- package/lib/plus/selectHolder/types.js +17 -0
- package/lib/plus/selectHolder/utils.d.ts +9 -0
- package/lib/plus/selectHolder/utils.js +34 -0
- package/lib/pro/comprehensiveSearch/components/searchSection/locales.js +3 -3
- package/lib/pro/comprehensiveSearch/locales.js +1 -1
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/lib/{hooks/printer.js → pro/multiDayTimeSelect/index.js} +6 -31
- package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/lib/pro/multiDayTimeSelect/types.js +17 -0
- package/lib/pro/skuDetailModal/types.d.ts +1 -0
- package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
- package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
- package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
- package/lowcode/contact-info/fragments/textStyle.ts +33 -0
- package/lowcode/contact-info/meta.ts +199 -0
- package/lowcode/contact-info-modal/meta.ts +98 -0
- package/lowcode/event-select-holder/meta.ts +2 -2
- package/lowcode/select-holder/meta.ts +220 -0
- package/lowcode/select-holder/snippets.ts +41 -0
- package/package.json +13 -11
- package/es/hooks/printer.d.ts +0 -4
- package/es/hooks/printer.js +0 -35
- package/lib/hooks/printer.d.ts +0 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.event-booking-error-tip {
|
|
2
|
+
margin-bottom: 16px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 6px 16px 6px 6px;
|
|
6
|
+
gap: 16px;
|
|
7
|
+
align-self: stretch;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
border: 1px solid var(--Error-300, #fda29b);
|
|
10
|
+
background: var(--Error-25, #fffbfa);
|
|
11
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
12
|
+
color: var(--Error-700, #b42318);
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
|
|
16
|
+
.error-icon-wrapper {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 38px;
|
|
19
|
+
height: 38px;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
|
|
24
|
+
&::before {
|
|
25
|
+
content: '';
|
|
26
|
+
position: absolute;
|
|
27
|
+
width: 38px;
|
|
28
|
+
height: 38px;
|
|
29
|
+
border-radius: 50%;
|
|
30
|
+
border: 2px solid var(--Error-600, #d92d20);
|
|
31
|
+
opacity: 0.1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&::after {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
width: 28px;
|
|
38
|
+
height: 28px;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
border: 2px solid var(--Error-600, #d92d20);
|
|
41
|
+
opacity: 0.3;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.icon-warning {
|
|
45
|
+
position: relative;
|
|
46
|
+
z-index: 1;
|
|
47
|
+
font-size: 20px;
|
|
48
|
+
color: #ff4d4f;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { PisellCard, PisellAvatar, Icon } from '@pisell/materials';
|
|
3
|
+
import { getAvatarText } from "../../utils";
|
|
4
|
+
import "./index.less";
|
|
5
|
+
|
|
6
|
+
// 类名前缀
|
|
7
|
+
export var PREFIX = 'pisell-lowcode-holder-item';
|
|
8
|
+
var HolderItem = function HolderItem(_ref) {
|
|
9
|
+
var item = _ref.item,
|
|
10
|
+
displayConfig = _ref.displayConfig,
|
|
11
|
+
value = _ref.value,
|
|
12
|
+
isAddItem = _ref.isAddItem;
|
|
13
|
+
var _ref2 = displayConfig || {},
|
|
14
|
+
_ref2$showAvatar = _ref2.showAvatar,
|
|
15
|
+
showAvatar = _ref2$showAvatar === void 0 ? true : _ref2$showAvatar,
|
|
16
|
+
_ref2$showTitle = _ref2.showTitle,
|
|
17
|
+
showTitle = _ref2$showTitle === void 0 ? true : _ref2$showTitle,
|
|
18
|
+
_ref2$showSubtitle = _ref2.showSubtitle,
|
|
19
|
+
showSubtitle = _ref2$showSubtitle === void 0 ? false : _ref2$showSubtitle,
|
|
20
|
+
_ref2$selectType = _ref2.selectType,
|
|
21
|
+
selectType = _ref2$selectType === void 0 ? 'single' : _ref2$selectType,
|
|
22
|
+
_ref2$direction = _ref2.direction,
|
|
23
|
+
direction = _ref2$direction === void 0 ? 'vertical' : _ref2$direction,
|
|
24
|
+
_ref2$showExtraFields = _ref2.showExtraFields,
|
|
25
|
+
showExtraFields = _ref2$showExtraFields === void 0 ? false : _ref2$showExtraFields,
|
|
26
|
+
_ref2$extraFields = _ref2.extraFields,
|
|
27
|
+
extraFields = _ref2$extraFields === void 0 ? [] : _ref2$extraFields;
|
|
28
|
+
var isSelected = useMemo(function () {
|
|
29
|
+
if (!(value !== null && value !== void 0 && value.length) || !(item !== null && item !== void 0 && item.value)) return false;
|
|
30
|
+
return value.includes(item.value);
|
|
31
|
+
}, [value, item === null || item === void 0 ? void 0 : item.value]);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @title: 渲染额外字段
|
|
35
|
+
* @description:
|
|
36
|
+
* @param {*} useMemo
|
|
37
|
+
* @return {*}
|
|
38
|
+
* @Author: WangHan
|
|
39
|
+
* @Date: 2025-10-11 14:24
|
|
40
|
+
*/
|
|
41
|
+
var extraFieldsCom = useMemo(function () {
|
|
42
|
+
if (!showExtraFields || !(extraFields !== null && extraFields !== void 0 && extraFields.length)) return null;
|
|
43
|
+
return extraFields.map(function (field) {
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: "".concat(PREFIX, "-extra-field")
|
|
46
|
+
}, (field === null || field === void 0 ? void 0 : field.isShowLabel) && /*#__PURE__*/React.createElement("span", {
|
|
47
|
+
className: "".concat(PREFIX, "-extra-field-label")
|
|
48
|
+
}, field.label, ":"), (field === null || field === void 0 ? void 0 : field.isShowValue) && (field === null || field === void 0 ? void 0 : field.value) && /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: "".concat(PREFIX, "-extra-field-value")
|
|
50
|
+
}, item === null || item === void 0 ? void 0 : item[field.value]));
|
|
51
|
+
});
|
|
52
|
+
}, [showExtraFields, extraFields, item]);
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "".concat(PREFIX, "-wrap ").concat(isSelected ? "".concat(PREFIX, "-wrap-selected") : '')
|
|
55
|
+
}, /*#__PURE__*/React.createElement(PisellCard, {
|
|
56
|
+
padding: 20,
|
|
57
|
+
selected: isSelected
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "".concat(PREFIX, "-card ").concat(direction === 'horizontal' ? "".concat(PREFIX, "-card-horizontal") : '')
|
|
60
|
+
}, showAvatar ? /*#__PURE__*/React.createElement(PisellAvatar, {
|
|
61
|
+
src: item === null || item === void 0 ? void 0 : item.avatar,
|
|
62
|
+
useTextAvatar: !(item !== null && item !== void 0 && item.avatar) && !isAddItem,
|
|
63
|
+
className: "".concat(isAddItem ? "".concat(PREFIX, "-add-avatar") : ''),
|
|
64
|
+
size: 'xxl'
|
|
65
|
+
}, getAvatarText(item.label)) : null, (showTitle || showSubtitle) && /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "".concat(PREFIX, "-info")
|
|
67
|
+
}, showTitle && /*#__PURE__*/React.createElement("span", {
|
|
68
|
+
className: "".concat(PREFIX, "-name")
|
|
69
|
+
}, item.label), showSubtitle && item.subtitle && /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
className: "".concat(PREFIX, "-subtitle")
|
|
71
|
+
}, item.subtitle), extraFieldsCom), selectType === 'multiple' && /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "".concat(PREFIX, "-check-icon ").concat(isSelected ? "".concat(PREFIX, "-check-icon-selected") : '')
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
74
|
+
type: "CheckCircleFilled"
|
|
75
|
+
})))));
|
|
76
|
+
};
|
|
77
|
+
export default HolderItem;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.pisell-lowcode-holder-item {
|
|
2
|
+
&-wrap {
|
|
3
|
+
height: 100%;
|
|
4
|
+
border: 1px solid transparent;
|
|
5
|
+
|
|
6
|
+
.pisell-lowcode-card-body {
|
|
7
|
+
height: 100%;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-wrap-selected {
|
|
13
|
+
border: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-card {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 10px;
|
|
22
|
+
height: 100%;
|
|
23
|
+
color: var(--Text-Text_1, #1b1b1b);
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
line-height: 20px;
|
|
28
|
+
width: 100%;
|
|
29
|
+
text-align: center;
|
|
30
|
+
|
|
31
|
+
// 确保头像不变形
|
|
32
|
+
.pisell-lowcode-avatar {
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-add-avatar {
|
|
38
|
+
background: #f4ebff !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-card-horizontal {
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
gap: 20px;
|
|
44
|
+
|
|
45
|
+
.pisell-lowcode-holder-item-info {
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
text-align: left;
|
|
48
|
+
flex: 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&-check-icon {
|
|
53
|
+
position: absolute;
|
|
54
|
+
right: 6px;
|
|
55
|
+
bottom: 6px;
|
|
56
|
+
color: #d0d5dd;
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&-check-icon-selected {
|
|
61
|
+
color: #7f56d9;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-info {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: 10px;
|
|
70
|
+
width: 100%;
|
|
71
|
+
color: #1b1b1b;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
word-wrap: break-word;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&-name {
|
|
78
|
+
width: 100%;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
text-overflow: ellipsis;
|
|
82
|
+
display: -webkit-box;
|
|
83
|
+
-webkit-line-clamp: 1;
|
|
84
|
+
line-clamp: 1;
|
|
85
|
+
-webkit-box-orient: vertical;
|
|
86
|
+
word-break: break-word;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&-subtitle {
|
|
90
|
+
width: 100%;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
display: -webkit-box;
|
|
94
|
+
-webkit-line-clamp: 2;
|
|
95
|
+
line-clamp: 2;
|
|
96
|
+
-webkit-box-orient: vertical;
|
|
97
|
+
word-break: break-word;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&-extra-field {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 10px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HolderOption, HolderDisplayProps } from '../../types';
|
|
3
|
+
export interface HolderListProps {
|
|
4
|
+
/** 选项数据源 */
|
|
5
|
+
dataSource?: HolderOption[];
|
|
6
|
+
/** 当前选中的值数组 */
|
|
7
|
+
selectedValues?: any[];
|
|
8
|
+
/** 显示配置 */
|
|
9
|
+
displayConfig?: HolderDisplayProps;
|
|
10
|
+
/** 渲染添加项的函数 */
|
|
11
|
+
renderAddItem?: () => React.ReactNode;
|
|
12
|
+
/** 列数 */
|
|
13
|
+
columns?: number;
|
|
14
|
+
/** 水平间距 */
|
|
15
|
+
horizontalGap?: number;
|
|
16
|
+
/** 垂直间距 */
|
|
17
|
+
verticalGap?: number;
|
|
18
|
+
/** 是否允许添加 */
|
|
19
|
+
allowAdd?: boolean;
|
|
20
|
+
/** 点击事件处理函数 */
|
|
21
|
+
onClick?: (item: HolderOption) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @title: HolderList 选项列表组件
|
|
25
|
+
* @description: 抽离的选项列表组件,可以在 Modal 外部独立使用
|
|
26
|
+
* @Author: WangHan
|
|
27
|
+
* @Date: 2025-01-XX
|
|
28
|
+
*/
|
|
29
|
+
declare const HolderList: React.FC<HolderListProps>;
|
|
30
|
+
export default HolderList;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellCustomCheckboxGroup } from '@pisell/materials';
|
|
3
|
+
import HolderItem from "../HolderItem";
|
|
4
|
+
/**
|
|
5
|
+
* @title: HolderList 选项列表组件
|
|
6
|
+
* @description: 抽离的选项列表组件,可以在 Modal 外部独立使用
|
|
7
|
+
* @Author: WangHan
|
|
8
|
+
* @Date: 2025-01-XX
|
|
9
|
+
*/
|
|
10
|
+
var HolderList = function HolderList(_ref) {
|
|
11
|
+
var _ref$dataSource = _ref.dataSource,
|
|
12
|
+
dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
|
|
13
|
+
_ref$selectedValues = _ref.selectedValues,
|
|
14
|
+
selectedValues = _ref$selectedValues === void 0 ? [] : _ref$selectedValues,
|
|
15
|
+
displayConfig = _ref.displayConfig,
|
|
16
|
+
renderAddItem = _ref.renderAddItem,
|
|
17
|
+
_ref$columns = _ref.columns,
|
|
18
|
+
columns = _ref$columns === void 0 ? 3 : _ref$columns,
|
|
19
|
+
_ref$horizontalGap = _ref.horizontalGap,
|
|
20
|
+
horizontalGap = _ref$horizontalGap === void 0 ? 16 : _ref$horizontalGap,
|
|
21
|
+
_ref$verticalGap = _ref.verticalGap,
|
|
22
|
+
verticalGap = _ref$verticalGap === void 0 ? 16 : _ref$verticalGap,
|
|
23
|
+
_ref$allowAdd = _ref.allowAdd,
|
|
24
|
+
allowAdd = _ref$allowAdd === void 0 ? true : _ref$allowAdd,
|
|
25
|
+
onClick = _ref.onClick;
|
|
26
|
+
return /*#__PURE__*/React.createElement(PisellCustomCheckboxGroup, {
|
|
27
|
+
dataSource: dataSource,
|
|
28
|
+
renderItem: function renderItem(item) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(HolderItem, {
|
|
30
|
+
item: item,
|
|
31
|
+
displayConfig: displayConfig,
|
|
32
|
+
value: selectedValues
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
renderAddItem: renderAddItem,
|
|
36
|
+
columns: columns,
|
|
37
|
+
horizontalGap: horizontalGap,
|
|
38
|
+
verticalGap: verticalGap,
|
|
39
|
+
allowAdd: allowAdd,
|
|
40
|
+
onClick: onClick
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export default HolderList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellSelectHolderProps } from './types';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare const PREFIX = "pisell-lowcode-select-holder";
|
|
5
|
+
declare const PisellSelectHolder: React.FC<PisellSelectHolderProps>;
|
|
6
|
+
export default PisellSelectHolder;
|
|
7
|
+
export { default as HolderList } from './components/HolderList';
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
|
13
|
+
import { PisellModal, Button } from '@pisell/materials';
|
|
14
|
+
import { isMobile, locales } from '@pisell/utils';
|
|
15
|
+
import ErrorTip from "./components/ErrorTip";
|
|
16
|
+
import HolderItem from "./components/HolderItem";
|
|
17
|
+
import HolderList from "./components/HolderList";
|
|
18
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
19
|
+
import localeTexts from "./locales";
|
|
20
|
+
import "./index.less";
|
|
21
|
+
|
|
22
|
+
// 类名前缀
|
|
23
|
+
export var PREFIX = 'pisell-lowcode-select-holder';
|
|
24
|
+
var PisellSelectHolder = function PisellSelectHolder(_ref) {
|
|
25
|
+
var _context$engine;
|
|
26
|
+
var dataSource = _ref.dataSource,
|
|
27
|
+
_ref$open = _ref.open,
|
|
28
|
+
open = _ref$open === void 0 ? true : _ref$open,
|
|
29
|
+
onClose = _ref.onClose,
|
|
30
|
+
onConfirm = _ref.onConfirm,
|
|
31
|
+
onSkip = _ref.onSkip,
|
|
32
|
+
onAdd = _ref.onAdd,
|
|
33
|
+
value = _ref.value,
|
|
34
|
+
modalConfig = _ref.modalConfig,
|
|
35
|
+
displayConfig = _ref.displayConfig,
|
|
36
|
+
_ref$allowAdd = _ref.allowAdd,
|
|
37
|
+
allowAdd = _ref$allowAdd === void 0 ? true : _ref$allowAdd,
|
|
38
|
+
_ref$horizontalGap = _ref.horizontalGap,
|
|
39
|
+
horizontalGap = _ref$horizontalGap === void 0 ? 16 : _ref$horizontalGap,
|
|
40
|
+
_ref$verticalGap = _ref.verticalGap,
|
|
41
|
+
verticalGap = _ref$verticalGap === void 0 ? 16 : _ref$verticalGap,
|
|
42
|
+
_ref$maxSelectedCount = _ref.maxSelectedCount,
|
|
43
|
+
maxSelectedCount = _ref$maxSelectedCount === void 0 ? 2 : _ref$maxSelectedCount,
|
|
44
|
+
_ref$isInline = _ref.isInline,
|
|
45
|
+
isInline = _ref$isInline === void 0 ? false : _ref$isInline,
|
|
46
|
+
className = _ref.className,
|
|
47
|
+
style = _ref.style;
|
|
48
|
+
var _useState = useState(''),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
errorTip = _useState2[0],
|
|
51
|
+
setErrorTip = _useState2[1];
|
|
52
|
+
var _useState3 = useState([]),
|
|
53
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
|
+
selectedValues = _useState4[0],
|
|
55
|
+
setSelectedValues = _useState4[1];
|
|
56
|
+
var mobile = useMemo(function () {
|
|
57
|
+
return isMobile();
|
|
58
|
+
}, []);
|
|
59
|
+
var context = useEngineContext();
|
|
60
|
+
locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
var _value = [];
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
_value = value;
|
|
65
|
+
} else {
|
|
66
|
+
_value = value ? [value] : [];
|
|
67
|
+
}
|
|
68
|
+
setSelectedValues(_value);
|
|
69
|
+
}, [value]);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @title: 单选模式默认选中第一个有效选项
|
|
73
|
+
* @description: 当单选模式且没有选中值时,自动选中第一个带value的选项
|
|
74
|
+
* @Author: Auto
|
|
75
|
+
* @Date: 2025-01-XX
|
|
76
|
+
*/
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
// 只在单选模式下生效
|
|
79
|
+
if ((displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType) !== 'single') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 如果已经有选中值,不执行默认选中
|
|
84
|
+
if (selectedValues.length > 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 如果 value prop 有值,说明是外部传入的,不执行默认选中
|
|
89
|
+
// 只有当 value 为空(undefined/null)时,才执行默认选中
|
|
90
|
+
if (value !== undefined && value !== null && (value === null || value === void 0 ? void 0 : value.length) > 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 查找第一个有效的选项(value不为null且不为undefined)
|
|
95
|
+
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
96
|
+
var firstValidOption = dataSource.find(function (item) {
|
|
97
|
+
return (item === null || item === void 0 ? void 0 : item.value) !== null && (item === null || item === void 0 ? void 0 : item.value) !== undefined;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// 如果找到有效选项,自动选中
|
|
101
|
+
if (firstValidOption) {
|
|
102
|
+
handleClick(firstValidOption);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [dataSource, displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType, selectedValues.length, value]);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @title: 处理确认按钮点击
|
|
109
|
+
* @description:
|
|
110
|
+
* @param {*} useCallback
|
|
111
|
+
* @return {*}
|
|
112
|
+
* @Author: WangHan
|
|
113
|
+
* @Date: 2025-10-10 21:32
|
|
114
|
+
*/
|
|
115
|
+
var handleOk = useCallback(function () {
|
|
116
|
+
onConfirm === null || onConfirm === void 0 || onConfirm(selectedValues);
|
|
117
|
+
}, [selectedValues]);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @title: 处理选项点击
|
|
121
|
+
* @description:
|
|
122
|
+
* @return {*}
|
|
123
|
+
* @Author: WangHan
|
|
124
|
+
* @Date: 2025-10-10 21:28
|
|
125
|
+
*/
|
|
126
|
+
var handleClick = useCallback(function (item) {
|
|
127
|
+
if (!(item !== null && item !== void 0 && item.value)) {
|
|
128
|
+
return onAdd === null || onAdd === void 0 ? void 0 : onAdd();
|
|
129
|
+
}
|
|
130
|
+
var selectType = (displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType) || 'single';
|
|
131
|
+
|
|
132
|
+
// 单选模式:直接设置选中的值
|
|
133
|
+
if (selectType === 'single') {
|
|
134
|
+
setSelectedValues(function (prev) {
|
|
135
|
+
// 如果点击的是已选中的项,则取消选择(可选行为)
|
|
136
|
+
// 如果需要保持选中状态,可以改为:return [item.value];
|
|
137
|
+
return prev.includes(item.value) ? [] : [item.value];
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
// 多选模式:如果已选中,则移除,否则添加
|
|
141
|
+
setSelectedValues(function (prev) {
|
|
142
|
+
var newValues = prev.includes(item.value) ? prev.filter(function (v) {
|
|
143
|
+
return v !== item.value;
|
|
144
|
+
}) : [].concat(_toConsumableArray(prev), [item.value]);
|
|
145
|
+
return newValues;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}, [displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType]);
|
|
149
|
+
var handleSkip = useCallback(function () {
|
|
150
|
+
onSkip === null || onSkip === void 0 || onSkip();
|
|
151
|
+
}, [onSkip]);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @title: 渲染添加项
|
|
155
|
+
* @description:
|
|
156
|
+
* @param {*} useCallback
|
|
157
|
+
* @return {*}
|
|
158
|
+
* @Author: WangHan
|
|
159
|
+
* @Date: 2025-10-11 14:20
|
|
160
|
+
*/
|
|
161
|
+
var addHolderLabel = locales.getText('pisell-select-holder-create');
|
|
162
|
+
var renderAddItem = useCallback(function () {
|
|
163
|
+
if (!allowAdd) return undefined;
|
|
164
|
+
return /*#__PURE__*/React.createElement(HolderItem, {
|
|
165
|
+
item: {
|
|
166
|
+
label: addHolderLabel,
|
|
167
|
+
value: null
|
|
168
|
+
},
|
|
169
|
+
isAddItem: true
|
|
170
|
+
});
|
|
171
|
+
}, [allowAdd]);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @title: 模态框样式类名
|
|
175
|
+
* @description:
|
|
176
|
+
* @param {*} useMemo
|
|
177
|
+
* @return {*}
|
|
178
|
+
* @Author: WangHan
|
|
179
|
+
* @Date: 2025-10-11 14:20
|
|
180
|
+
*/
|
|
181
|
+
var modalClassName = useMemo(function () {
|
|
182
|
+
var classes = ["".concat(PREFIX, "-modal")];
|
|
183
|
+
if (mobile) {
|
|
184
|
+
classes.push("".concat(PREFIX, "-modal-mobile"));
|
|
185
|
+
}
|
|
186
|
+
return classes.join(' ');
|
|
187
|
+
}, [mobile]);
|
|
188
|
+
var okButtonProps = useMemo(function () {
|
|
189
|
+
// 多选模式,禁用按钮当已选数量大于最大可选数量
|
|
190
|
+
if ((displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType) === 'multiple') {
|
|
191
|
+
return {
|
|
192
|
+
disabled: (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length) > maxSelectedCount
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
disabled: !(selectedValues !== null && selectedValues !== void 0 && selectedValues.length)
|
|
197
|
+
};
|
|
198
|
+
}, [selectedValues, maxSelectedCount, displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType]);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @title: 渲染底部按钮
|
|
202
|
+
* @description:
|
|
203
|
+
* @param {*} useMemo
|
|
204
|
+
* @return {*}
|
|
205
|
+
* @Author: WangHan
|
|
206
|
+
* @Date: 2025-10-10 21:51
|
|
207
|
+
*/
|
|
208
|
+
var footerCom = useMemo(function () {
|
|
209
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
210
|
+
className: "".concat(PREFIX, "-footer")
|
|
211
|
+
}, displayConfig !== null && displayConfig !== void 0 && displayConfig.isSkipable ? /*#__PURE__*/React.createElement(Button, {
|
|
212
|
+
onClick: handleSkip
|
|
213
|
+
}, locales.getText('pisell-select-holder-skip')) : null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
214
|
+
onClick: handleOk
|
|
215
|
+
}, okButtonProps, {
|
|
216
|
+
type: "primary"
|
|
217
|
+
}), modalConfig === null || modalConfig === void 0 ? void 0 : modalConfig.confirmText));
|
|
218
|
+
}, [displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.isSkipable, modalConfig === null || modalConfig === void 0 ? void 0 : modalConfig.confirmText, okButtonProps]);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @description: 渲染内容
|
|
222
|
+
* @param {*} useMemo
|
|
223
|
+
* @return {*}
|
|
224
|
+
*/
|
|
225
|
+
var renderContent = useMemo(function () {
|
|
226
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, mobile && modalConfig !== null && modalConfig !== void 0 && modalConfig.title ? /*#__PURE__*/React.createElement("div", {
|
|
227
|
+
className: "".concat(PREFIX, "-modal-title")
|
|
228
|
+
}, modalConfig === null || modalConfig === void 0 ? void 0 : modalConfig.title) : null, errorTip && /*#__PURE__*/React.createElement(ErrorTip, {
|
|
229
|
+
text: errorTip
|
|
230
|
+
}), (displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.selectType) === 'multiple' && maxSelectedCount ? /*#__PURE__*/React.createElement("div", {
|
|
231
|
+
className: "".concat(PREFIX, "-selected-info ").concat(selectedValues.length === maxSelectedCount ? "".concat(PREFIX, "-selected-info-max") : '')
|
|
232
|
+
}, locales.getText('pisell-select-holder-selected'), selectedValues.length, "/", maxSelectedCount, selectedValues.length > maxSelectedCount ? /*#__PURE__*/React.createElement("span", null, " ", locales.getText('pisell-select-holder-please-remove')(selectedValues.length - maxSelectedCount)) : null) : null, /*#__PURE__*/React.createElement(HolderList, {
|
|
233
|
+
dataSource: dataSource,
|
|
234
|
+
selectedValues: selectedValues,
|
|
235
|
+
displayConfig: displayConfig,
|
|
236
|
+
renderAddItem: renderAddItem,
|
|
237
|
+
columns: mobile ? 2 : 3,
|
|
238
|
+
horizontalGap: horizontalGap,
|
|
239
|
+
verticalGap: verticalGap,
|
|
240
|
+
allowAdd: allowAdd,
|
|
241
|
+
onClick: handleClick
|
|
242
|
+
}));
|
|
243
|
+
}, [isInline, modalConfig, dataSource, errorTip, maxSelectedCount, selectedValues, displayConfig, renderAddItem, mobile, horizontalGap, verticalGap, allowAdd, handleClick]);
|
|
244
|
+
|
|
245
|
+
// 直接页面上显示
|
|
246
|
+
if (isInline) {
|
|
247
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
className: "".concat(PREFIX, "-inline-wrap ").concat(className),
|
|
249
|
+
style: style
|
|
250
|
+
}, renderContent);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// 弹窗打开
|
|
254
|
+
return /*#__PURE__*/React.createElement(PisellModal, {
|
|
255
|
+
open: open,
|
|
256
|
+
title: mobile ? '' : modalConfig === null || modalConfig === void 0 ? void 0 : modalConfig.title,
|
|
257
|
+
platform: mobile ? 'h5' : 'pc',
|
|
258
|
+
closable: modalConfig === null || modalConfig === void 0 ? void 0 : modalConfig.showClose,
|
|
259
|
+
bodyStyle: {
|
|
260
|
+
padding: mobile ? '0 16px 16px' : 20
|
|
261
|
+
},
|
|
262
|
+
mobileModalHeight: "auto",
|
|
263
|
+
destroyOnClose: true,
|
|
264
|
+
className: modalClassName,
|
|
265
|
+
headerDivider: false,
|
|
266
|
+
width: mobile ? '100%' : '640px',
|
|
267
|
+
footer: footerCom,
|
|
268
|
+
onCancel: onClose
|
|
269
|
+
}, renderContent);
|
|
270
|
+
};
|
|
271
|
+
export default PisellSelectHolder;
|
|
272
|
+
// 导出 HolderList 组件供外部使用
|
|
273
|
+
export { default as HolderList } from "./components/HolderList";
|