@pisell/private-materials 3.4.104 → 3.4.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +11 -11
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.d.ts +0 -1
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/es/components/booking/forms/single/index.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +0 -1
- package/es/components/booking/materiels/contacts/index.d.ts +0 -1
- package/es/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/es/components/eftpos/form/index.d.ts +0 -1
- package/es/components/eftpos/hooks.d.ts +0 -1
- package/es/components/eftpos/index.d.ts +0 -1
- package/es/components/eftpos/pos.d.ts +0 -1
- package/es/components/eftposPay/amount.d.ts +0 -1
- package/es/components/eftposPay/component/fail/network.d.ts +0 -1
- package/es/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/es/components/eftposPay/component/manual/index.d.ts +0 -1
- package/es/components/eftposPay/component/signature/index.d.ts +0 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.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/scheduleCalendar/ProductItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- 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 +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/schedules/components/ScheduleList/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
- package/es/components/schedules/products/ProductDetailDrawer/index.d.ts +0 -1
- package/es/components/schedules/products/index.d.ts +0 -1
- package/es/components/schedules/resources/index.d.ts +0 -1
- package/es/components/schedules/resources/relationProduct/index.d.ts +0 -1
- package/es/components/schedules/schedules/AllSchedules/index.d.ts +0 -1
- package/es/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +0 -1
- package/es/components/schedules/schedules/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +0 -1
- package/es/plus/orderList/components/HandleActions.d.ts +1 -0
- package/es/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/es/plus/orderList/components/Reset.d.ts +1 -0
- package/es/plus/orderList/components/Toolbar.d.ts +1 -0
- package/es/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.d.ts +2 -1
- package/es/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.js +54 -154
- package/es/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.less +62 -9
- package/es/plus/saasDevice/devicePlanning/components/DeleteDeviceModal/index.js +7 -6
- package/es/plus/saasDevice/devicePlanning/components/DeleteWorkAreaModal/index.js +8 -6
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.d.ts +21 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.js +244 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.less +323 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.d.ts +18 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.js +272 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.less +111 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.d.ts +10 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.js +211 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.less +211 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DrawerSidebar.d.ts +11 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DrawerSidebar.js +39 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectDeviceModalHeader.d.ts +14 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectDeviceModalHeader.js +22 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectionConfigFields.d.ts +14 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectionConfigFields.js +122 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/DeviceConnectionSummary.d.ts +12 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/DeviceConnectionSummary.js +41 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/NewPeripheralInfoFields.d.ts +11 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/NewPeripheralInfoFields.js +51 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickExistingDeviceStep.d.ts +22 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickExistingDeviceStep.js +98 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickNewPeripheralStep.d.ts +12 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickNewPeripheralStep.js +24 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useConnectDeviceModal.d.ts +56 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useConnectDeviceModal.js +278 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceConnections.d.ts +20 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceConnections.js +125 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceDetail.d.ts +16 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceDetail.js +58 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.d.ts +3 -0
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.js +62 -210
- package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.less +103 -209
- package/es/plus/saasDevice/devicePlanning/components/DeviceTable/index.js +29 -19
- package/es/plus/saasDevice/devicePlanning/components/DeviceTable/index.less +22 -1
- package/es/plus/saasDevice/devicePlanning/components/EditDeviceModal/index.js +17 -21
- package/es/plus/saasDevice/devicePlanning/components/WorkAreaModal/index.js +14 -15
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceBasicInfoForm.d.ts +25 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceBasicInfoForm.js +82 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceIcon.d.ts +10 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceIcon.js +18 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceModelPicker.d.ts +12 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/DeviceModelPicker.js +147 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/I18nNameFormItem.d.ts +9 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/I18nNameFormItem.js +22 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/LinkStatusTag.d.ts +9 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/LinkStatusTag.js +12 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/ModelPickerGrid.d.ts +15 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/ModelPickerGrid.js +61 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/OnlineStatus.d.ts +10 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/OnlineStatus.js +16 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/OnlineWarningAlert.d.ts +8 -0
- package/es/plus/saasDevice/devicePlanning/components/shared/OnlineWarningAlert.js +17 -0
- package/es/plus/saasDevice/devicePlanning/hooks/index.d.ts +2 -0
- package/es/plus/saasDevice/devicePlanning/hooks/index.js +12 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDeviceList.d.ts +33 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDeviceList.js +183 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDeviceModels.d.ts +20 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDeviceModels.js +92 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDevicePlanningDialogs.d.ts +27 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useDevicePlanningDialogs.js +95 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useWorkAreas.d.ts +35 -0
- package/es/plus/saasDevice/devicePlanning/hooks/useWorkAreas.js +292 -0
- package/es/plus/saasDevice/devicePlanning/index.js +168 -637
- package/es/plus/saasDevice/devicePlanning/locales.d.ts +215 -0
- package/es/plus/saasDevice/devicePlanning/locales.js +215 -0
- package/es/plus/saasDevice/devicePlanning/serve.d.ts +14 -2
- package/es/plus/saasDevice/devicePlanning/serve.js +175 -20
- package/es/plus/saasDevice/devicePlanning/types.d.ts +85 -0
- package/es/plus/saasDevice/devicePlanning/types.js +46 -3
- package/es/plus/saasDevice/devicePlanning/utils.d.ts +27 -0
- package/es/plus/saasDevice/devicePlanning/utils.js +125 -0
- package/es/plus/saasDevice/index.d.ts +3 -0
- package/es/plus/saasDevice/index.js +3 -0
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
- package/es/plus/walletEditor/components/relationProduct/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/passList/index.js +1 -2
- package/es/pro/Selector/demo.d.ts +0 -1
- package/es/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/TimeSlicing/components/SelectDateOS.d.ts +0 -1
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/lib/components/booking/forms/single/index.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +0 -1
- package/lib/components/booking/materiels/contacts/index.d.ts +0 -1
- package/lib/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/lib/components/eftpos/form/index.d.ts +0 -1
- package/lib/components/eftpos/hooks.d.ts +0 -1
- package/lib/components/eftpos/index.d.ts +0 -1
- package/lib/components/eftpos/pos.d.ts +0 -1
- package/lib/components/eftposPay/amount.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/network.d.ts +0 -1
- package/lib/components/eftposPay/component/fail/unknow.d.ts +0 -1
- package/lib/components/eftposPay/component/manual/index.d.ts +0 -1
- package/lib/components/eftposPay/component/signature/index.d.ts +0 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.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/scheduleCalendar/ProductItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
- 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 +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/schedules/components/ScheduleList/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +0 -1
- package/lib/components/schedules/products/ProductDetailDrawer/index.d.ts +0 -1
- package/lib/components/schedules/products/index.d.ts +0 -1
- package/lib/components/schedules/resources/index.d.ts +0 -1
- package/lib/components/schedules/resources/relationProduct/index.d.ts +0 -1
- package/lib/components/schedules/schedules/AllSchedules/index.d.ts +0 -1
- package/lib/components/schedules/schedules/ScheduleDetailDrawer/index.d.ts +0 -1
- package/lib/components/schedules/schedules/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +0 -1
- package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
- package/lib/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/lib/plus/orderList/components/Reset.d.ts +1 -0
- package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
- package/lib/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.d.ts +2 -1
- package/lib/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.js +50 -120
- package/lib/plus/saasDevice/devicePlanning/components/AddDeviceModal/index.less +62 -9
- package/lib/plus/saasDevice/devicePlanning/components/DeleteDeviceModal/index.js +15 -8
- package/lib/plus/saasDevice/devicePlanning/components/DeleteWorkAreaModal/index.js +10 -6
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.d.ts +21 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.js +270 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/ConnectExistingDeviceModal.less +323 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.d.ts +18 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.js +235 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceConnectionsPanel.less +111 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.d.ts +10 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.js +218 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DeviceInfoPanel.less +211 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DrawerSidebar.d.ts +11 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/DrawerSidebar.js +73 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectDeviceModalHeader.d.ts +14 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectDeviceModalHeader.js +61 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectionConfigFields.d.ts +14 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/ConnectionConfigFields.js +171 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/DeviceConnectionSummary.d.ts +12 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/DeviceConnectionSummary.js +78 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/NewPeripheralInfoFields.d.ts +11 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/NewPeripheralInfoFields.js +87 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickExistingDeviceStep.d.ts +22 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickExistingDeviceStep.js +129 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickNewPeripheralStep.d.ts +12 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/components/connectDeviceModal/PickNewPeripheralStep.js +56 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useConnectDeviceModal.d.ts +56 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useConnectDeviceModal.js +229 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceConnections.d.ts +20 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceConnections.js +90 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceDetail.d.ts +16 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceDetail.js +74 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.d.ts +3 -0
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.js +62 -173
- package/lib/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/index.less +103 -209
- package/lib/plus/saasDevice/devicePlanning/components/DeviceTable/index.js +54 -39
- package/lib/plus/saasDevice/devicePlanning/components/DeviceTable/index.less +22 -1
- package/lib/plus/saasDevice/devicePlanning/components/EditDeviceModal/index.js +25 -25
- package/lib/plus/saasDevice/devicePlanning/components/WorkAreaModal/index.js +22 -17
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceBasicInfoForm.d.ts +25 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceBasicInfoForm.js +126 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceIcon.d.ts +10 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceIcon.js +45 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceModelPicker.d.ts +12 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/DeviceModelPicker.js +165 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/I18nNameFormItem.d.ts +9 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/I18nNameFormItem.js +54 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/LinkStatusTag.d.ts +9 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/LinkStatusTag.js +42 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/ModelPickerGrid.d.ts +15 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/ModelPickerGrid.js +89 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/OnlineStatus.d.ts +10 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/OnlineStatus.js +50 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/OnlineWarningAlert.d.ts +8 -0
- package/lib/plus/saasDevice/devicePlanning/components/shared/OnlineWarningAlert.js +53 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/index.d.ts +2 -0
- package/lib/plus/saasDevice/devicePlanning/{hooks.js → hooks/index.js} +9 -6
- package/lib/plus/saasDevice/devicePlanning/hooks/useDeviceList.d.ts +33 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useDeviceList.js +131 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useDeviceModels.d.ts +20 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useDeviceModels.js +109 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useDevicePlanningDialogs.d.ts +27 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useDevicePlanningDialogs.js +90 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useWorkAreas.d.ts +35 -0
- package/lib/plus/saasDevice/devicePlanning/hooks/useWorkAreas.js +169 -0
- package/lib/plus/saasDevice/devicePlanning/index.js +120 -375
- package/lib/plus/saasDevice/devicePlanning/locales.d.ts +215 -0
- package/lib/plus/saasDevice/devicePlanning/locales.js +215 -0
- package/lib/plus/saasDevice/devicePlanning/serve.d.ts +14 -2
- package/lib/plus/saasDevice/devicePlanning/serve.js +88 -1
- package/lib/plus/saasDevice/devicePlanning/types.d.ts +85 -0
- package/lib/plus/saasDevice/devicePlanning/types.js +1 -1
- package/lib/plus/saasDevice/devicePlanning/utils.d.ts +27 -0
- package/lib/plus/saasDevice/devicePlanning/utils.js +130 -0
- package/lib/plus/saasDevice/index.d.ts +3 -0
- package/lib/plus/saasDevice/index.js +42 -0
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
- package/lib/plus/walletEditor/components/relationProduct/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/passList/index.js +0 -1
- package/lib/pro/Selector/demo.d.ts +0 -1
- package/lib/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/package.json +2 -2
- package/build/lowcode.zip +0 -0
- package/es/plus/saasDevice/devicePlanning/hooks.d.ts +0 -1
- package/es/plus/saasDevice/devicePlanning/hooks.js +0 -9
- package/lib/plus/saasDevice/devicePlanning/hooks.d.ts +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Empty, Spin } from 'antd';
|
|
3
|
+
import { Icon, Input } from '@pisell/materials';
|
|
4
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { DEVICE_ICON_COLOR } from "../../../../utils";
|
|
7
|
+
var PickExistingDeviceStep = function PickExistingDeviceStep(_ref) {
|
|
8
|
+
var _workAreas$find;
|
|
9
|
+
var workAreas = _ref.workAreas,
|
|
10
|
+
selectedWorkAreaId = _ref.selectedWorkAreaId,
|
|
11
|
+
currentWorkAreaId = _ref.currentWorkAreaId,
|
|
12
|
+
filteredDevices = _ref.filteredDevices,
|
|
13
|
+
connectedDeviceIds = _ref.connectedDeviceIds,
|
|
14
|
+
loading = _ref.loading,
|
|
15
|
+
pickingDeviceId = _ref.pickingDeviceId,
|
|
16
|
+
keyword = _ref.keyword,
|
|
17
|
+
targetKind = _ref.targetKind,
|
|
18
|
+
getText = _ref.getText,
|
|
19
|
+
translation = _ref.translation,
|
|
20
|
+
getWorkAreaDeviceCount = _ref.getWorkAreaDeviceCount,
|
|
21
|
+
getDeviceCountText = _ref.getDeviceCountText,
|
|
22
|
+
onWorkAreaChange = _ref.onWorkAreaChange,
|
|
23
|
+
onKeywordChange = _ref.onKeywordChange,
|
|
24
|
+
onPickDevice = _ref.onPickDevice;
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: "device-detail-drawer__connect-areas"
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "device-detail-drawer__connect-section-title"
|
|
29
|
+
}, getText('pisell2.saas.device-planning.connect.work-areas')), /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "device-detail-drawer__connect-section-desc"
|
|
31
|
+
}, getText('pisell2.saas.device-planning.connect.select-area')), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "device-detail-drawer__connect-area-list"
|
|
33
|
+
}, workAreas.map(function (area) {
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
key: area.id,
|
|
36
|
+
role: "button",
|
|
37
|
+
tabIndex: 0,
|
|
38
|
+
className: "device-detail-drawer__connect-area".concat(selectedWorkAreaId === area.id ? ' is-active' : ''),
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return onWorkAreaChange(area.id);
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "device-detail-drawer__connect-area-header"
|
|
44
|
+
}, /*#__PURE__*/React.createElement("strong", null, translation(area.name) || area.id), area.id === currentWorkAreaId ? /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: "device-detail-drawer__connect-current"
|
|
46
|
+
}, getText('pisell2.saas.device-planning.connect.current')) : null), /*#__PURE__*/React.createElement("span", null, getDeviceCountText(getWorkAreaDeviceCount(area))));
|
|
47
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "device-detail-drawer__connect-targets"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "device-detail-drawer__connect-workarea-name"
|
|
51
|
+
}, translation((_workAreas$find = workAreas.find(function (area) {
|
|
52
|
+
return area.id === selectedWorkAreaId;
|
|
53
|
+
})) === null || _workAreas$find === void 0 ? void 0 : _workAreas$find.name)), /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "device-detail-drawer__connect-filters"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
56
|
+
allowClear: true,
|
|
57
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
58
|
+
value: keyword,
|
|
59
|
+
placeholder: getText('pisell2.saas.device-planning.connect.search'),
|
|
60
|
+
onChange: function onChange(event) {
|
|
61
|
+
return onKeywordChange(event.target.value);
|
|
62
|
+
}
|
|
63
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "device-detail-drawer__connect-device-list"
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
66
|
+
spinning: loading || Boolean(pickingDeviceId)
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "device-detail-drawer__connect-device-grid"
|
|
69
|
+
}, filteredDevices.map(function (device) {
|
|
70
|
+
var _device$type, _device$type2;
|
|
71
|
+
var disabled = connectedDeviceIds.includes(device.id);
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
key: device.id,
|
|
74
|
+
role: "button",
|
|
75
|
+
tabIndex: disabled || pickingDeviceId ? -1 : 0,
|
|
76
|
+
"aria-disabled": disabled || Boolean(pickingDeviceId),
|
|
77
|
+
className: classNames('device-detail-drawer__connect-device-card', {
|
|
78
|
+
'is-disabled': disabled || Boolean(pickingDeviceId)
|
|
79
|
+
}),
|
|
80
|
+
onClick: function onClick() {
|
|
81
|
+
if (!disabled && !pickingDeviceId) {
|
|
82
|
+
onPickDevice(device);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
className: "device-detail-drawer__connect-device-icon is-".concat(device.type_kind)
|
|
87
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
88
|
+
type: ((_device$type = device.type) === null || _device$type === void 0 ? void 0 : _device$type.icon) || 'DesktopOutlined',
|
|
89
|
+
color: DEVICE_ICON_COLOR[device.type_kind]
|
|
90
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, translation(device.name) || device.id), /*#__PURE__*/React.createElement("span", null, translation((_device$type2 = device.type) === null || _device$type2 === void 0 ? void 0 : _device$type2.name) || device.type_code)));
|
|
91
|
+
})), !filteredDevices.length ? /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "device-detail-drawer__connect-empty"
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Empty, {
|
|
94
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
95
|
+
description: getText(targetKind === 'smart' ? 'pisell2.saas.device-planning.connect.no-smart' : 'pisell2.saas.device-planning.connect.no-peripherals')
|
|
96
|
+
})) : null))));
|
|
97
|
+
};
|
|
98
|
+
export default PickExistingDeviceStep;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DeviceBrandItem, DeviceModelItem, I18nText } from '../../../../types';
|
|
3
|
+
interface PickNewPeripheralStepProps {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
models: DeviceModelItem[];
|
|
6
|
+
brands: DeviceBrandItem[];
|
|
7
|
+
getText: (key: string) => string;
|
|
8
|
+
translation: (val?: I18nText) => string;
|
|
9
|
+
onSelect: (model: DeviceModelItem) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const PickNewPeripheralStep: React.FC<PickNewPeripheralStepProps>;
|
|
12
|
+
export default PickNewPeripheralStep;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Spin } from 'antd';
|
|
3
|
+
import DeviceModelPicker from "../../../shared/DeviceModelPicker";
|
|
4
|
+
var PickNewPeripheralStep = function PickNewPeripheralStep(_ref) {
|
|
5
|
+
var loading = _ref.loading,
|
|
6
|
+
models = _ref.models,
|
|
7
|
+
brands = _ref.brands,
|
|
8
|
+
getText = _ref.getText,
|
|
9
|
+
translation = _ref.translation,
|
|
10
|
+
onSelect = _ref.onSelect;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "device-detail-drawer__connect-targets"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
14
|
+
spinning: loading
|
|
15
|
+
}, /*#__PURE__*/React.createElement(DeviceModelPicker, {
|
|
16
|
+
activeKind: "dumb",
|
|
17
|
+
models: models,
|
|
18
|
+
brands: brands,
|
|
19
|
+
getText: getText,
|
|
20
|
+
translation: translation,
|
|
21
|
+
onSelect: onSelect
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
export default PickNewPeripheralStep;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CreateDeviceConnectionPayload, DeviceBrandItem, DeviceConnectionItem, DeviceItem, DeviceModelItem, I18nText, LangDict, UpdateDeviceConnectionPayload, WorkAreaItem } from '../../../types';
|
|
2
|
+
export declare type ConnectMode = 'existing' | 'new' | 'edit';
|
|
3
|
+
export declare type ConnectStep = 'pick' | 'config';
|
|
4
|
+
export declare type NetworkMethod = 'auto' | 'manual';
|
|
5
|
+
export interface ConnectFormValues {
|
|
6
|
+
name?: LangDict;
|
|
7
|
+
workarea_id?: number;
|
|
8
|
+
connection_type?: string;
|
|
9
|
+
connection_method?: NetworkMethod;
|
|
10
|
+
connection_ip?: string;
|
|
11
|
+
profile_ids?: number[];
|
|
12
|
+
}
|
|
13
|
+
export interface UseConnectDeviceModalParams {
|
|
14
|
+
open: boolean;
|
|
15
|
+
mode: ConnectMode;
|
|
16
|
+
currentDevice: DeviceItem;
|
|
17
|
+
editConnection?: DeviceConnectionItem;
|
|
18
|
+
connectedDeviceIds: number[];
|
|
19
|
+
currentWorkAreaId?: number;
|
|
20
|
+
getText: (key: string) => string;
|
|
21
|
+
translation: (val?: I18nText) => string;
|
|
22
|
+
onSubmit?: (payload: CreateDeviceConnectionPayload) => void;
|
|
23
|
+
onUpdate?: (id: number, payload: UpdateDeviceConnectionPayload) => void;
|
|
24
|
+
}
|
|
25
|
+
/** 管理连接弹窗的 existing/new/edit 三种模式状态和最终连接 payload 组装。 */
|
|
26
|
+
export declare const useConnectDeviceModal: ({ open, mode, currentDevice, editConnection, connectedDeviceIds, currentWorkAreaId, getText, translation, onSubmit, onUpdate, }: UseConnectDeviceModalParams) => {
|
|
27
|
+
step: ConnectStep;
|
|
28
|
+
workAreas: WorkAreaItem[];
|
|
29
|
+
brands: DeviceBrandItem[];
|
|
30
|
+
models: DeviceModelItem[];
|
|
31
|
+
selectedWorkAreaId: number | undefined;
|
|
32
|
+
selectedModel: DeviceModelItem | undefined;
|
|
33
|
+
keyword: string;
|
|
34
|
+
editFormValues: ConnectFormValues | undefined;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
detailLoading: boolean;
|
|
37
|
+
pickingDeviceId: number | undefined;
|
|
38
|
+
currentIsSmart: boolean;
|
|
39
|
+
targetKind: "smart" | "dumb";
|
|
40
|
+
peripheral: DeviceItem | undefined;
|
|
41
|
+
smartDevice: DeviceItem | undefined;
|
|
42
|
+
profileOptions: {
|
|
43
|
+
label: string;
|
|
44
|
+
value: number;
|
|
45
|
+
}[];
|
|
46
|
+
profileRequired: boolean;
|
|
47
|
+
filteredDevices: DeviceItem[];
|
|
48
|
+
getWorkAreaDeviceCount: (area: WorkAreaItem) => number;
|
|
49
|
+
getDeviceCountText: (count: number) => string;
|
|
50
|
+
setSelectedWorkAreaId: import("react").Dispatch<import("react").SetStateAction<number | undefined>>;
|
|
51
|
+
setKeyword: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
52
|
+
handlePickDevice: (device: DeviceItem) => void;
|
|
53
|
+
handlePickModel: (model: DeviceModelItem) => void;
|
|
54
|
+
handleBackToPick: () => void;
|
|
55
|
+
handleSubmit: (values: ConnectFormValues) => void;
|
|
56
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
14
|
+
import { getDeviceConnectionDetail, getDeviceBrands, getDeviceDetail, getDevices, getDeviceTypes, getWorkAreas } from "../../../serve";
|
|
15
|
+
import { EMPTY_I18N } from "../../../types";
|
|
16
|
+
import { normalizeText } from "../../../constants";
|
|
17
|
+
import { flattenDeviceModels, isProfileRequired } from "../../../utils";
|
|
18
|
+
var needsNetworkConfig = function needsNetworkConfig(connectionType) {
|
|
19
|
+
return connectionType === 'ethernet' || connectionType === 'wifi';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** 管理连接弹窗的 existing/new/edit 三种模式状态和最终连接 payload 组装。 */
|
|
23
|
+
export var useConnectDeviceModal = function useConnectDeviceModal(_ref) {
|
|
24
|
+
var open = _ref.open,
|
|
25
|
+
mode = _ref.mode,
|
|
26
|
+
currentDevice = _ref.currentDevice,
|
|
27
|
+
editConnection = _ref.editConnection,
|
|
28
|
+
connectedDeviceIds = _ref.connectedDeviceIds,
|
|
29
|
+
currentWorkAreaId = _ref.currentWorkAreaId,
|
|
30
|
+
getText = _ref.getText,
|
|
31
|
+
translation = _ref.translation,
|
|
32
|
+
onSubmit = _ref.onSubmit,
|
|
33
|
+
onUpdate = _ref.onUpdate;
|
|
34
|
+
var _useState = useState('pick'),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
step = _useState2[0],
|
|
37
|
+
setStep = _useState2[1];
|
|
38
|
+
var _useState3 = useState([]),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
workAreas = _useState4[0],
|
|
41
|
+
setWorkAreas = _useState4[1];
|
|
42
|
+
var _useState5 = useState(),
|
|
43
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
44
|
+
selectedWorkAreaId = _useState6[0],
|
|
45
|
+
setSelectedWorkAreaId = _useState6[1];
|
|
46
|
+
var _useState7 = useState([]),
|
|
47
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
48
|
+
devices = _useState8[0],
|
|
49
|
+
setDevices = _useState8[1];
|
|
50
|
+
var _useState9 = useState([]),
|
|
51
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
52
|
+
models = _useState10[0],
|
|
53
|
+
setModels = _useState10[1];
|
|
54
|
+
var _useState11 = useState([]),
|
|
55
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
56
|
+
brands = _useState12[0],
|
|
57
|
+
setBrands = _useState12[1];
|
|
58
|
+
var _useState13 = useState(),
|
|
59
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
60
|
+
selectedDevice = _useState14[0],
|
|
61
|
+
setSelectedDevice = _useState14[1];
|
|
62
|
+
var _useState15 = useState(),
|
|
63
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
64
|
+
selectedModel = _useState16[0],
|
|
65
|
+
setSelectedModel = _useState16[1];
|
|
66
|
+
var _useState17 = useState(''),
|
|
67
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
68
|
+
keyword = _useState18[0],
|
|
69
|
+
setKeyword = _useState18[1];
|
|
70
|
+
var _useState19 = useState(),
|
|
71
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
72
|
+
editFormValues = _useState20[0],
|
|
73
|
+
setEditFormValues = _useState20[1];
|
|
74
|
+
var _useState21 = useState(false),
|
|
75
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
76
|
+
loading = _useState22[0],
|
|
77
|
+
setLoading = _useState22[1];
|
|
78
|
+
var _useState23 = useState(false),
|
|
79
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
80
|
+
detailLoading = _useState24[0],
|
|
81
|
+
setDetailLoading = _useState24[1];
|
|
82
|
+
var _useState25 = useState(),
|
|
83
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
84
|
+
pickingDeviceId = _useState26[0],
|
|
85
|
+
setPickingDeviceId = _useState26[1];
|
|
86
|
+
var currentIsSmart = currentDevice.type_kind === 'smart';
|
|
87
|
+
var targetKind = currentIsSmart ? 'dumb' : 'smart';
|
|
88
|
+
var peripheral = currentIsSmart && mode === 'new' ? undefined : currentIsSmart ? selectedDevice : currentDevice;
|
|
89
|
+
var smartDevice = currentIsSmart ? currentDevice : selectedDevice;
|
|
90
|
+
var fallbackProfileModel = peripheral !== null && peripheral !== void 0 && peripheral.model_code ? models.find(function (model) {
|
|
91
|
+
return model.code === peripheral.model_code;
|
|
92
|
+
}) : undefined;
|
|
93
|
+
var profileSource = mode === 'new' ? selectedModel : (peripheral === null || peripheral === void 0 ? void 0 : peripheral.model) || fallbackProfileModel;
|
|
94
|
+
var profileOptions = ((profileSource === null || profileSource === void 0 ? void 0 : profileSource.active_profiles) || []).map(function (profile) {
|
|
95
|
+
return {
|
|
96
|
+
label: translation(profile.name) || String(profile.id),
|
|
97
|
+
value: profile.id
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
var profileRequired = isProfileRequired(profileSource);
|
|
101
|
+
var getWorkAreaDeviceCount = function getWorkAreaDeviceCount(area) {
|
|
102
|
+
return targetKind === 'smart' ? area.smart_devices_count || 0 : area.dumb_devices_count || 0;
|
|
103
|
+
};
|
|
104
|
+
var getDeviceCountText = function getDeviceCountText(count) {
|
|
105
|
+
var key = targetKind === 'smart' ? count === 1 ? 'pisell2.saas.device-planning.connect.smart-count-one' : 'pisell2.saas.device-planning.connect.smart-count-many' : count === 1 ? 'pisell2.saas.device-planning.connect.peripheral-count-one' : 'pisell2.saas.device-planning.connect.peripheral-count-many';
|
|
106
|
+
return getText(key).replace('{N}', String(count));
|
|
107
|
+
};
|
|
108
|
+
useEffect(function () {
|
|
109
|
+
if (!open) return;
|
|
110
|
+
setStep(mode === 'edit' ? 'config' : 'pick');
|
|
111
|
+
setSelectedDevice(undefined);
|
|
112
|
+
setSelectedModel(undefined);
|
|
113
|
+
setKeyword('');
|
|
114
|
+
setEditFormValues(undefined);
|
|
115
|
+
setPickingDeviceId(undefined);
|
|
116
|
+
setLoading(true);
|
|
117
|
+
setDetailLoading(mode === 'edit');
|
|
118
|
+
Promise.all([getWorkAreas(), mode === 'new' ? getDeviceBrands() : Promise.resolve([]), getDeviceTypes({
|
|
119
|
+
kind: 'dumb',
|
|
120
|
+
with: ['activeModels', 'activeModels.activeProfiles', 'activeModels.brand']
|
|
121
|
+
}), mode === 'edit' && editConnection !== null && editConnection !== void 0 && editConnection.id ? getDeviceConnectionDetail(editConnection.id) : Promise.resolve(null)]).then(function (_ref2) {
|
|
122
|
+
var _areas$;
|
|
123
|
+
var _ref3 = _slicedToArray(_ref2, 4),
|
|
124
|
+
areas = _ref3[0],
|
|
125
|
+
brandList = _ref3[1],
|
|
126
|
+
types = _ref3[2],
|
|
127
|
+
detail = _ref3[3];
|
|
128
|
+
setWorkAreas(areas);
|
|
129
|
+
setBrands(brandList);
|
|
130
|
+
setModels(flattenDeviceModels(types));
|
|
131
|
+
var defaultWorkAreaId = currentWorkAreaId || ((_areas$ = areas[0]) === null || _areas$ === void 0 ? void 0 : _areas$.id);
|
|
132
|
+
setSelectedWorkAreaId(defaultWorkAreaId);
|
|
133
|
+
if (detail) {
|
|
134
|
+
var _detail$config, _detail$config2, _detail$config3;
|
|
135
|
+
setSelectedDevice(currentIsSmart ? detail.target_device || undefined : detail.source_device || undefined);
|
|
136
|
+
setEditFormValues({
|
|
137
|
+
connection_type: (_detail$config = detail.config) === null || _detail$config === void 0 ? void 0 : _detail$config.connection_type,
|
|
138
|
+
connection_method: ((_detail$config2 = detail.config) === null || _detail$config2 === void 0 ? void 0 : _detail$config2.connection_method) === 'manual' ? 'manual' : 'auto',
|
|
139
|
+
connection_ip: String(((_detail$config3 = detail.config) === null || _detail$config3 === void 0 ? void 0 : _detail$config3.connection_ip) || ''),
|
|
140
|
+
profile_ids: detail.profile_ids || (detail.profiles || []).map(function (profile) {
|
|
141
|
+
return profile.id;
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}).finally(function () {
|
|
146
|
+
setLoading(false);
|
|
147
|
+
setDetailLoading(false);
|
|
148
|
+
});
|
|
149
|
+
}, [currentIsSmart, currentWorkAreaId, editConnection === null || editConnection === void 0 ? void 0 : editConnection.id, mode, open]);
|
|
150
|
+
useEffect(function () {
|
|
151
|
+
if (!open || !selectedWorkAreaId) return;
|
|
152
|
+
setLoading(true);
|
|
153
|
+
if (mode === 'new') {
|
|
154
|
+
setLoading(false);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
getDevices({
|
|
158
|
+
workarea_id: selectedWorkAreaId,
|
|
159
|
+
type_kind: targetKind,
|
|
160
|
+
with: ['type', 'model', 'model.activeProfiles', 'workarea']
|
|
161
|
+
}).then(function (list) {
|
|
162
|
+
return setDevices(list);
|
|
163
|
+
}).finally(function () {
|
|
164
|
+
return setLoading(false);
|
|
165
|
+
});
|
|
166
|
+
}, [mode, open, selectedWorkAreaId, targetKind]);
|
|
167
|
+
var filteredDevices = useMemo(function () {
|
|
168
|
+
var value = normalizeText(keyword);
|
|
169
|
+
return devices.filter(function (device) {
|
|
170
|
+
return value ? normalizeText(translation(device.name)).includes(value) : true;
|
|
171
|
+
});
|
|
172
|
+
}, [devices, keyword, translation]);
|
|
173
|
+
var resetConnectionConfig = function resetConnectionConfig() {
|
|
174
|
+
setEditFormValues(undefined);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/** 选择已有设备后拉取详情,确保配置页能拿到型号和 profiles。 */
|
|
178
|
+
var handlePickDevice = function handlePickDevice(device) {
|
|
179
|
+
if (connectedDeviceIds.includes(device.id)) return;
|
|
180
|
+
if (pickingDeviceId) return;
|
|
181
|
+
resetConnectionConfig();
|
|
182
|
+
setPickingDeviceId(device.id);
|
|
183
|
+
getDeviceDetail(device.id).then(function (detail) {
|
|
184
|
+
return setSelectedDevice(detail || device);
|
|
185
|
+
}).catch(function () {
|
|
186
|
+
return setSelectedDevice(device);
|
|
187
|
+
}).finally(function () {
|
|
188
|
+
setPickingDeviceId(undefined);
|
|
189
|
+
setStep('config');
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/** 新增外设模式下选择型号,并为名称填入仅 original 的默认值。 */
|
|
194
|
+
var handlePickModel = function handlePickModel(model) {
|
|
195
|
+
resetConnectionConfig();
|
|
196
|
+
setSelectedModel(model);
|
|
197
|
+
setStep('config');
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/** 从配置页返回选择页时清理连接配置和已选目标。 */
|
|
201
|
+
var handleBackToPick = function handleBackToPick() {
|
|
202
|
+
resetConnectionConfig();
|
|
203
|
+
setSelectedDevice(undefined);
|
|
204
|
+
setSelectedModel(undefined);
|
|
205
|
+
setStep('pick');
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/** 根据当前模式组装 create/update connection payload 并交给父组件提交。 */
|
|
209
|
+
var handleSubmit = function handleSubmit(values) {
|
|
210
|
+
if (!smartDevice || !values.connection_type) return;
|
|
211
|
+
var config = {
|
|
212
|
+
connection_type: values.connection_type
|
|
213
|
+
};
|
|
214
|
+
if (needsNetworkConfig(values.connection_type)) {
|
|
215
|
+
config.connection_method = values.connection_method || 'auto';
|
|
216
|
+
if (values.connection_method === 'manual') {
|
|
217
|
+
config.connection_ip = String(values.connection_ip || '').trim();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
var profileIds = values.profile_ids || [];
|
|
221
|
+
if (mode === 'edit') {
|
|
222
|
+
if (!editConnection || !onUpdate) return;
|
|
223
|
+
onUpdate(editConnection.id, {
|
|
224
|
+
config: config,
|
|
225
|
+
profile_ids: profileIds
|
|
226
|
+
});
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
var payload = mode === 'new' ? {
|
|
230
|
+
type: 'dumb',
|
|
231
|
+
source_device_id: smartDevice.id,
|
|
232
|
+
target_device_action: 'new',
|
|
233
|
+
target_device: {
|
|
234
|
+
workarea_id: values.workarea_id || currentWorkAreaId || 0,
|
|
235
|
+
model_code: (selectedModel === null || selectedModel === void 0 ? void 0 : selectedModel.code) || '',
|
|
236
|
+
name: values.name || _objectSpread({}, EMPTY_I18N)
|
|
237
|
+
},
|
|
238
|
+
config: config,
|
|
239
|
+
profile_ids: profileIds
|
|
240
|
+
} : {
|
|
241
|
+
type: 'dumb',
|
|
242
|
+
source_device_id: smartDevice.id,
|
|
243
|
+
target_device_id: peripheral === null || peripheral === void 0 ? void 0 : peripheral.id,
|
|
244
|
+
target_device_action: 'existing',
|
|
245
|
+
config: config,
|
|
246
|
+
profile_ids: profileIds
|
|
247
|
+
};
|
|
248
|
+
onSubmit === null || onSubmit === void 0 || onSubmit(payload);
|
|
249
|
+
};
|
|
250
|
+
return {
|
|
251
|
+
step: step,
|
|
252
|
+
workAreas: workAreas,
|
|
253
|
+
brands: brands,
|
|
254
|
+
models: models,
|
|
255
|
+
selectedWorkAreaId: selectedWorkAreaId,
|
|
256
|
+
selectedModel: selectedModel,
|
|
257
|
+
keyword: keyword,
|
|
258
|
+
editFormValues: editFormValues,
|
|
259
|
+
loading: loading,
|
|
260
|
+
detailLoading: detailLoading,
|
|
261
|
+
pickingDeviceId: pickingDeviceId,
|
|
262
|
+
currentIsSmart: currentIsSmart,
|
|
263
|
+
targetKind: targetKind,
|
|
264
|
+
peripheral: peripheral,
|
|
265
|
+
smartDevice: smartDevice,
|
|
266
|
+
profileOptions: profileOptions,
|
|
267
|
+
profileRequired: profileRequired,
|
|
268
|
+
filteredDevices: filteredDevices,
|
|
269
|
+
getWorkAreaDeviceCount: getWorkAreaDeviceCount,
|
|
270
|
+
getDeviceCountText: getDeviceCountText,
|
|
271
|
+
setSelectedWorkAreaId: setSelectedWorkAreaId,
|
|
272
|
+
setKeyword: setKeyword,
|
|
273
|
+
handlePickDevice: handlePickDevice,
|
|
274
|
+
handlePickModel: handlePickModel,
|
|
275
|
+
handleBackToPick: handleBackToPick,
|
|
276
|
+
handleSubmit: handleSubmit
|
|
277
|
+
};
|
|
278
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CreateDeviceConnectionPayload, DeviceKind, DeviceRow, UpdateDeviceConnectionPayload } from '../../../types';
|
|
2
|
+
import type { DrawerTabKey } from '../components/DrawerSidebar';
|
|
3
|
+
interface UseDeviceConnectionsParams {
|
|
4
|
+
open: boolean;
|
|
5
|
+
activeTab: DrawerTabKey;
|
|
6
|
+
activeKind: DeviceKind;
|
|
7
|
+
displayRecord?: DeviceRow;
|
|
8
|
+
onConnectionsChanged?: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** 管理详情抽屉连接页的连接列表加载和连接增删改请求。 */
|
|
11
|
+
export declare const useDeviceConnections: ({ open, activeTab, activeKind, displayRecord, onConnectionsChanged, }: UseDeviceConnectionsParams) => {
|
|
12
|
+
connections: import("../../../types").DeviceConnectionItem[];
|
|
13
|
+
loading: boolean;
|
|
14
|
+
submitting: boolean;
|
|
15
|
+
deleting: boolean;
|
|
16
|
+
handleCreateConnection: (payload: CreateDeviceConnectionPayload) => Promise<void>;
|
|
17
|
+
handleUpdateConnection: (id: number, payload: UpdateDeviceConnectionPayload) => Promise<void>;
|
|
18
|
+
handleDeleteConnection: (id: number) => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { useRequest } from 'ahooks';
|
|
7
|
+
import { createDeviceConnection, deleteDeviceConnection, getDeviceConnections, updateDeviceConnection } from "../../../serve";
|
|
8
|
+
/** 管理详情抽屉连接页的连接列表加载和连接增删改请求。 */
|
|
9
|
+
export var useDeviceConnections = function useDeviceConnections(_ref) {
|
|
10
|
+
var open = _ref.open,
|
|
11
|
+
activeTab = _ref.activeTab,
|
|
12
|
+
activeKind = _ref.activeKind,
|
|
13
|
+
displayRecord = _ref.displayRecord,
|
|
14
|
+
onConnectionsChanged = _ref.onConnectionsChanged;
|
|
15
|
+
var connectionRequest = useRequest(getDeviceConnections, {
|
|
16
|
+
manual: true
|
|
17
|
+
});
|
|
18
|
+
var createConnectionRequest = useRequest(createDeviceConnection, {
|
|
19
|
+
manual: true
|
|
20
|
+
});
|
|
21
|
+
var updateConnectionRequest = useRequest(function (params) {
|
|
22
|
+
return updateDeviceConnection(params.id, params.payload);
|
|
23
|
+
}, {
|
|
24
|
+
manual: true
|
|
25
|
+
});
|
|
26
|
+
var deleteConnectionRequest = useRequest(deleteDeviceConnection, {
|
|
27
|
+
manual: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** 根据当前设备种类生成正确的 smart/dumb 过滤参数并刷新连接列表。 */
|
|
31
|
+
var reloadConnections = function reloadConnections() {
|
|
32
|
+
if (!displayRecord || activeKind === 'integrated') return;
|
|
33
|
+
var relationWith = activeKind === 'smart' ? ['targetDevice.type', 'targetDevice.model.brand', 'targetDevice.workarea', 'profiles'] : ['sourceDevice.type', 'profiles'];
|
|
34
|
+
connectionRequest.run({
|
|
35
|
+
type: 'dumb',
|
|
36
|
+
source_device_id: activeKind === 'smart' ? displayRecord.id : undefined,
|
|
37
|
+
target_device_id: activeKind === 'dumb' ? displayRecord.id : undefined,
|
|
38
|
+
with: relationWith
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (!open || !displayRecord) return;
|
|
43
|
+
if (activeTab !== 'connections') return;
|
|
44
|
+
if (activeKind === 'integrated') return;
|
|
45
|
+
reloadConnections();
|
|
46
|
+
}, [activeKind, activeTab, displayRecord === null || displayRecord === void 0 ? void 0 : displayRecord.id, open]);
|
|
47
|
+
|
|
48
|
+
/** 创建连接后刷新连接列表,并通知父级刷新设备 link/status。 */
|
|
49
|
+
var handleCreateConnection = /*#__PURE__*/function () {
|
|
50
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
|
|
51
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
52
|
+
while (1) switch (_context.prev = _context.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
_context.next = 2;
|
|
55
|
+
return createConnectionRequest.runAsync(payload);
|
|
56
|
+
case 2:
|
|
57
|
+
reloadConnections();
|
|
58
|
+
onConnectionsChanged === null || onConnectionsChanged === void 0 || onConnectionsChanged();
|
|
59
|
+
case 4:
|
|
60
|
+
case "end":
|
|
61
|
+
return _context.stop();
|
|
62
|
+
}
|
|
63
|
+
}, _callee);
|
|
64
|
+
}));
|
|
65
|
+
return function handleCreateConnection(_x) {
|
|
66
|
+
return _ref2.apply(this, arguments);
|
|
67
|
+
};
|
|
68
|
+
}();
|
|
69
|
+
|
|
70
|
+
/** 更新连接配置后刷新连接列表,并通知父级同步设备状态。 */
|
|
71
|
+
var handleUpdateConnection = /*#__PURE__*/function () {
|
|
72
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, payload) {
|
|
73
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
74
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
_context2.next = 2;
|
|
77
|
+
return updateConnectionRequest.runAsync({
|
|
78
|
+
id: id,
|
|
79
|
+
payload: payload
|
|
80
|
+
});
|
|
81
|
+
case 2:
|
|
82
|
+
reloadConnections();
|
|
83
|
+
onConnectionsChanged === null || onConnectionsChanged === void 0 || onConnectionsChanged();
|
|
84
|
+
case 4:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context2.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
}));
|
|
90
|
+
return function handleUpdateConnection(_x2, _x3) {
|
|
91
|
+
return _ref3.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}();
|
|
94
|
+
|
|
95
|
+
/** 删除连接后刷新连接列表,并通知父级同步设备状态。 */
|
|
96
|
+
var handleDeleteConnection = /*#__PURE__*/function () {
|
|
97
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(id) {
|
|
98
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
99
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
_context3.next = 2;
|
|
102
|
+
return deleteConnectionRequest.runAsync(id);
|
|
103
|
+
case 2:
|
|
104
|
+
reloadConnections();
|
|
105
|
+
onConnectionsChanged === null || onConnectionsChanged === void 0 || onConnectionsChanged();
|
|
106
|
+
case 4:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context3.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee3);
|
|
111
|
+
}));
|
|
112
|
+
return function handleDeleteConnection(_x4) {
|
|
113
|
+
return _ref4.apply(this, arguments);
|
|
114
|
+
};
|
|
115
|
+
}();
|
|
116
|
+
return {
|
|
117
|
+
connections: connectionRequest.data || [],
|
|
118
|
+
loading: connectionRequest.loading,
|
|
119
|
+
submitting: createConnectionRequest.loading || updateConnectionRequest.loading,
|
|
120
|
+
deleting: deleteConnectionRequest.loading,
|
|
121
|
+
handleCreateConnection: handleCreateConnection,
|
|
122
|
+
handleUpdateConnection: handleUpdateConnection,
|
|
123
|
+
handleDeleteConnection: handleDeleteConnection
|
|
124
|
+
};
|
|
125
|
+
};
|
package/es/plus/saasDevice/devicePlanning/components/DeviceDetailDrawer/hooks/useDeviceDetail.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DeviceRow, I18nText } from '../../../types';
|
|
2
|
+
import type { DrawerTabKey } from '../components/DrawerSidebar';
|
|
3
|
+
interface UseDeviceDetailParams {
|
|
4
|
+
open: boolean;
|
|
5
|
+
record?: DeviceRow;
|
|
6
|
+
initialTab: DrawerTabKey;
|
|
7
|
+
translation: (val?: I18nText) => string;
|
|
8
|
+
}
|
|
9
|
+
/** 管理详情抽屉的当前 tab、设备详情补拉取和 integrated 设备 tab 保护。 */
|
|
10
|
+
export declare const useDeviceDetail: ({ open, record, initialTab, translation, }: UseDeviceDetailParams) => {
|
|
11
|
+
activeTab: DrawerTabKey;
|
|
12
|
+
activeKind: import("../../../types").DeviceKind;
|
|
13
|
+
displayRecord: DeviceRow | undefined;
|
|
14
|
+
setActiveTab: import("react").Dispatch<import("react").SetStateAction<DrawerTabKey>>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|