@iobroker/gui-components 8.0.1
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/LICENSE +22 -0
- package/README.md +1450 -0
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/build/Components/404.d.ts +4 -0
- package/build/Components/404.js +97 -0
- package/build/Components/404.js.map +1 -0
- package/build/Components/ColorPicker.d.ts +86 -0
- package/build/Components/ColorPicker.js +222 -0
- package/build/Components/ColorPicker.js.map +1 -0
- package/build/Components/ComplexCron.d.ts +40 -0
- package/build/Components/ComplexCron.js +401 -0
- package/build/Components/ComplexCron.js.map +1 -0
- package/build/Components/CopyToClipboard.d.ts +14 -0
- package/build/Components/CopyToClipboard.js +160 -0
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/build/Components/CustomModal.d.ts +26 -0
- package/build/Components/CustomModal.js +62 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/build/Components/DeviceType/DeviceTypeIcon.d.ts +29 -0
- package/build/Components/DeviceType/DeviceTypeIcon.js +108 -0
- package/build/Components/DeviceType/DeviceTypeIcon.js.map +1 -0
- package/build/Components/DeviceType/DeviceTypeOptions.d.ts +2 -0
- package/build/Components/DeviceType/DeviceTypeOptions.js +69 -0
- package/build/Components/DeviceType/DeviceTypeOptions.js.map +1 -0
- package/build/Components/DeviceType/DeviceTypeSelector.d.ts +20 -0
- package/build/Components/DeviceType/DeviceTypeSelector.js +83 -0
- package/build/Components/DeviceType/DeviceTypeSelector.js.map +1 -0
- package/build/Components/DeviceType/deviceTypeTranslations.d.ts +1 -0
- package/build/Components/DeviceType/deviceTypeTranslations.js +30 -0
- package/build/Components/DeviceType/deviceTypeTranslations.js.map +1 -0
- package/build/Components/DeviceType/i18n/de.json +46 -0
- package/build/Components/DeviceType/i18n/en.json +46 -0
- package/build/Components/DeviceType/i18n/fr.json +46 -0
- package/build/Components/DeviceType/i18n/it.json +46 -0
- package/build/Components/DeviceType/i18n/nl.json +46 -0
- package/build/Components/DeviceType/i18n/pl.json +46 -0
- package/build/Components/DeviceType/i18n/pt.json +46 -0
- package/build/Components/DeviceType/i18n/ru.json +46 -0
- package/build/Components/DeviceType/i18n/uk.json +46 -0
- package/build/Components/DeviceType/i18n/zh-cn.json +46 -0
- package/build/Components/DeviceType/icons/Cleaner.d.ts +3 -0
- package/build/Components/DeviceType/icons/Cleaner.js +14 -0
- package/build/Components/DeviceType/icons/Cleaner.js.map +1 -0
- package/build/Components/DeviceType/icons/DoorClosed.d.ts +3 -0
- package/build/Components/DeviceType/icons/DoorClosed.js +7 -0
- package/build/Components/DeviceType/icons/DoorClosed.js.map +1 -0
- package/build/Components/DeviceType/icons/DoorOpened.d.ts +3 -0
- package/build/Components/DeviceType/icons/DoorOpened.js +7 -0
- package/build/Components/DeviceType/icons/DoorOpened.js.map +1 -0
- package/build/Components/DeviceType/icons/FireOff.d.ts +3 -0
- package/build/Components/DeviceType/icons/FireOff.js +8 -0
- package/build/Components/DeviceType/icons/FireOff.js.map +1 -0
- package/build/Components/DeviceType/icons/FireOn.d.ts +3 -0
- package/build/Components/DeviceType/icons/FireOn.js +14 -0
- package/build/Components/DeviceType/icons/FireOn.js.map +1 -0
- package/build/Components/DeviceType/icons/FloodOff.d.ts +3 -0
- package/build/Components/DeviceType/icons/FloodOff.js +11 -0
- package/build/Components/DeviceType/icons/FloodOff.js.map +1 -0
- package/build/Components/DeviceType/icons/FloodOn.d.ts +3 -0
- package/build/Components/DeviceType/icons/FloodOn.js +18 -0
- package/build/Components/DeviceType/icons/FloodOn.js.map +1 -0
- package/build/Components/DeviceType/icons/Gate.d.ts +3 -0
- package/build/Components/DeviceType/icons/Gate.js +8 -0
- package/build/Components/DeviceType/icons/Gate.js.map +1 -0
- package/build/Components/DeviceType/icons/HeatValve.d.ts +3 -0
- package/build/Components/DeviceType/icons/HeatValve.js +6 -0
- package/build/Components/DeviceType/icons/HeatValve.js.map +1 -0
- package/build/Components/DeviceType/icons/Home.d.ts +3 -0
- package/build/Components/DeviceType/icons/Home.js +6 -0
- package/build/Components/DeviceType/icons/Home.js.map +1 -0
- package/build/Components/DeviceType/icons/Humidity.d.ts +3 -0
- package/build/Components/DeviceType/icons/Humidity.js +8 -0
- package/build/Components/DeviceType/icons/Humidity.js.map +1 -0
- package/build/Components/DeviceType/icons/IconHome.d.ts +5 -0
- package/build/Components/DeviceType/icons/IconHome.js +21 -0
- package/build/Components/DeviceType/icons/IconHome.js.map +1 -0
- package/build/Components/DeviceType/icons/Jalousie.d.ts +3 -0
- package/build/Components/DeviceType/icons/Jalousie.js +7 -0
- package/build/Components/DeviceType/icons/Jalousie.js.map +1 -0
- package/build/Components/DeviceType/icons/Material.d.ts +3 -0
- package/build/Components/DeviceType/icons/Material.js +8 -0
- package/build/Components/DeviceType/icons/Material.js.map +1 -0
- package/build/Components/DeviceType/icons/MotionOff.d.ts +3 -0
- package/build/Components/DeviceType/icons/MotionOff.js +11 -0
- package/build/Components/DeviceType/icons/MotionOff.js.map +1 -0
- package/build/Components/DeviceType/icons/MotionOn.d.ts +3 -0
- package/build/Components/DeviceType/icons/MotionOn.js +7 -0
- package/build/Components/DeviceType/icons/MotionOn.js.map +1 -0
- package/build/Components/DeviceType/icons/PushButton.d.ts +3 -0
- package/build/Components/DeviceType/icons/PushButton.js +9 -0
- package/build/Components/DeviceType/icons/PushButton.js.map +1 -0
- package/build/Components/DeviceType/icons/RGB.d.ts +3 -0
- package/build/Components/DeviceType/icons/RGB.js +43 -0
- package/build/Components/DeviceType/icons/RGB.js.map +1 -0
- package/build/Components/DeviceType/icons/RepairExpert.d.ts +3 -0
- package/build/Components/DeviceType/icons/RepairExpert.js +6 -0
- package/build/Components/DeviceType/icons/RepairExpert.js.map +1 -0
- package/build/Components/DeviceType/icons/Socket.d.ts +3 -0
- package/build/Components/DeviceType/icons/Socket.js +8 -0
- package/build/Components/DeviceType/icons/Socket.js.map +1 -0
- package/build/Components/DeviceType/icons/Thermometer.d.ts +3 -0
- package/build/Components/DeviceType/icons/Thermometer.js +7 -0
- package/build/Components/DeviceType/icons/Thermometer.js.map +1 -0
- package/build/Components/DeviceType/icons/ThermometerSimple.d.ts +3 -0
- package/build/Components/DeviceType/icons/ThermometerSimple.js +8 -0
- package/build/Components/DeviceType/icons/ThermometerSimple.js.map +1 -0
- package/build/Components/DeviceType/icons/Thermostat.d.ts +3 -0
- package/build/Components/DeviceType/icons/Thermostat.js +9 -0
- package/build/Components/DeviceType/icons/Thermostat.js.map +1 -0
- package/build/Components/DeviceType/icons/Valve.d.ts +3 -0
- package/build/Components/DeviceType/icons/Valve.js +7 -0
- package/build/Components/DeviceType/icons/Valve.js.map +1 -0
- package/build/Components/DeviceType/icons/WindowClosed.d.ts +3 -0
- package/build/Components/DeviceType/icons/WindowClosed.js +8 -0
- package/build/Components/DeviceType/icons/WindowClosed.js.map +1 -0
- package/build/Components/DeviceType/icons/WindowOpened.d.ts +3 -0
- package/build/Components/DeviceType/icons/WindowOpened.js +9 -0
- package/build/Components/DeviceType/icons/WindowOpened.js.map +1 -0
- package/build/Components/DeviceType/icons/WindowTilted.d.ts +3 -0
- package/build/Components/DeviceType/icons/WindowTilted.js +8 -0
- package/build/Components/DeviceType/icons/WindowTilted.js.map +1 -0
- package/build/Components/DeviceType/icons/index.d.ts +28 -0
- package/build/Components/DeviceType/icons/index.js +28 -0
- package/build/Components/DeviceType/icons/index.js.map +1 -0
- package/build/Components/FileBrowser.d.ts +187 -0
- package/build/Components/FileBrowser.js +1711 -0
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +49 -0
- package/build/Components/FileViewer.js +247 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/build/Components/Icon.d.ts +35 -0
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/build/Components/IconPicker.d.ts +25 -0
- package/build/Components/IconPicker.js +72 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/build/Components/IconSelector.d.ts +33 -0
- package/build/Components/IconSelector.js +2086 -0
- package/build/Components/IconSelector.js.map +1 -0
- package/build/Components/Image.d.ts +31 -0
- package/build/Components/Image.js +126 -0
- package/build/Components/Image.js.map +1 -0
- package/build/Components/InfoBox.d.ts +37 -0
- package/build/Components/InfoBox.js +115 -0
- package/build/Components/InfoBox.js.map +1 -0
- package/build/Components/IobUri.d.ts +14 -0
- package/build/Components/IobUri.js +168 -0
- package/build/Components/IobUri.js.map +1 -0
- package/build/Components/Loader.d.ts +31 -0
- package/build/Components/Loader.js +265 -0
- package/build/Components/Loader.js.map +1 -0
- package/build/Components/Loaders/MV.d.ts +17 -0
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/build/Components/Loaders/PT.d.ts +27 -0
- package/build/Components/Loaders/PT.js +150 -0
- package/build/Components/Loaders/PT.js.map +1 -0
- package/build/Components/Loaders/Vendor.d.ts +22 -0
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/build/Components/Logo.d.ts +18 -0
- package/build/Components/Logo.js +109 -0
- package/build/Components/Logo.js.map +1 -0
- package/build/Components/MDUtils.d.ts +11 -0
- package/build/Components/MDUtils.js +99 -0
- package/build/Components/MDUtils.js.map +1 -0
- package/build/Components/ObjectBrowser.d.ts +665 -0
- package/build/Components/ObjectBrowser.js +6245 -0
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/build/Components/Router.d.ts +21 -0
- package/build/Components/Router.js +77 -0
- package/build/Components/Router.js.map +1 -0
- package/build/Components/SaveCloseButtons.d.ts +20 -0
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/build/Components/Schedule.d.ts +62 -0
- package/build/Components/Schedule.js +1266 -0
- package/build/Components/Schedule.js.map +1 -0
- package/build/Components/SelectWithIcon.d.ts +37 -0
- package/build/Components/SelectWithIcon.js +139 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.d.ts +10 -0
- package/build/Components/SimpleCron/cronText.js +14 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/build/Components/SimpleCron/index.d.ts +55 -0
- package/build/Components/SimpleCron/index.js +698 -0
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/build/Components/TabContainer.d.ts +15 -0
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/build/Components/TabContent.d.ts +11 -0
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/build/Components/TableResize.d.ts +45 -0
- package/build/Components/TableResize.js +204 -0
- package/build/Components/TableResize.js.map +1 -0
- package/build/Components/TextWithIcon.d.ts +21 -0
- package/build/Components/TextWithIcon.js +113 -0
- package/build/Components/TextWithIcon.js.map +1 -0
- package/build/Components/ToggleThemeMenu.d.ts +12 -0
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/build/Components/TreeTable.d.ts +79 -0
- package/build/Components/TreeTable.js +538 -0
- package/build/Components/TreeTable.js.map +1 -0
- package/build/Components/UploadImage.d.ts +23 -0
- package/build/Components/UploadImage.js +516 -0
- package/build/Components/UploadImage.js.map +1 -0
- package/build/Components/Utils.d.ts +331 -0
- package/build/Components/Utils.js +1605 -0
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/build/Dialogs/ComplexCron.d.ts +24 -0
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/build/Dialogs/Confirm.d.ts +39 -0
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/build/Dialogs/Cron.d.ts +29 -0
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/build/Dialogs/Error.d.ts +18 -0
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/build/Dialogs/Message.d.ts +20 -0
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/build/Dialogs/SelectFile.d.ts +85 -0
- package/build/Dialogs/SelectFile.js +115 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/build/Dialogs/SelectID.d.ts +102 -0
- package/build/Dialogs/SelectID.js +151 -0
- package/build/Dialogs/SelectID.js.map +1 -0
- package/build/Dialogs/SimpleCron.d.ts +19 -0
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/build/GenericApp.d.ts +209 -0
- package/build/GenericApp.js +842 -0
- package/build/GenericApp.js.map +1 -0
- package/build/LegacyConnection.d.ts +938 -0
- package/build/LegacyConnection.js +2849 -0
- package/build/LegacyConnection.js.map +1 -0
- package/build/Prompt.d.ts +5 -0
- package/build/Prompt.js +19 -0
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/build/Theme.js +344 -0
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/devices.json +1 -0
- package/build/assets/lamp_ceiling.svg +9 -0
- package/build/assets/lamp_table.svg +8 -0
- package/build/assets/no_icon.svg +9 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/assets/rooms.json +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/globals.d.ts +19 -0
- package/build/i18n/de.json +480 -0
- package/build/i18n/en.json +480 -0
- package/build/i18n/es.json +480 -0
- package/build/i18n/fr.json +480 -0
- package/build/i18n/it.json +475 -0
- package/build/i18n/nl.json +475 -0
- package/build/i18n/pl.json +475 -0
- package/build/i18n/pt.json +475 -0
- package/build/i18n/ru.json +475 -0
- package/build/i18n/uk.json +475 -0
- package/build/i18n/zh-cn.json +475 -0
- package/build/i18n.d.ts +84 -0
- package/build/i18n.js +224 -0
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +7 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +7 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconButtonImage.d.ts +3 -0
- package/build/icons/IconButtonImage.js +9 -0
- package/build/icons/IconButtonImage.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +10 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +8 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +7 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +6 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +16 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +7 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +8 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +7 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +6 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +7 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +7 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +6 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +7 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +7 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/icons/IconVacuum.d.ts +3 -0
- package/build/icons/IconVacuum.js +12 -0
- package/build/icons/IconVacuum.js.map +1 -0
- package/build/index.css +56 -0
- package/build/index.d.ts +87 -0
- package/build/index.js +85 -0
- package/build/index.js.map +1 -0
- package/build/modulefederation.admin.config.d.ts +13 -0
- package/build/modulefederation.admin.config.js +45 -0
- package/build/modulefederation.admin.config.js.map +1 -0
- package/build/types.d.ts +236 -0
- package/i18n/de.json +480 -0
- package/i18n/en.json +480 -0
- package/i18n/es.json +480 -0
- package/i18n/fr.json +480 -0
- package/i18n/it.json +475 -0
- package/i18n/nl.json +475 -0
- package/i18n/pl.json +475 -0
- package/i18n/pt.json +475 -0
- package/i18n/ru.json +475 -0
- package/i18n/uk.json +475 -0
- package/i18n/zh-cn.json +475 -0
- package/index.css +56 -0
- package/modulefederation.admin.config.d.ts +20 -0
- package/modulefederation.admin.config.js +54 -0
- package/package.json +86 -0
- package/tasksExample.js +91 -0
|
@@ -0,0 +1 @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,YAAY;4BACvB,IAAI,CAAC,CAAC,CACF,0CAA0C,EAC1C,CAAC,IAAI,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CACvD,GAEP,CACL,CAAC,CAAC,CAAC,IAAI,CACQ,CACR;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAE,wBAAwB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EACzD,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,EAAE,EAAE,4BAA4B,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EAC7D,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\r\n * Copyright 2019-2024 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport {\r\n Button,\r\n Dialog,\r\n DialogActions,\r\n DialogContent,\r\n DialogContentText,\r\n DialogTitle,\r\n FormControlLabel,\r\n Checkbox,\r\n} from '@mui/material';\r\n\r\nimport { Check as IconCheck, Close as IconClose } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n suppress: {\r\n fontSize: 12,\r\n },\r\n suppressRoot: {\r\n // it is sx\r\n marginTop: '16px',\r\n },\r\n};\r\n\r\ninterface DialogConfirmProps {\r\n /** The dialog title; default: Are you sure? (translated) */\r\n title?: string;\r\n /** The dialog text */\r\n text?: string | React.JSX.Element | React.JSX.Element[];\r\n /** Close handler. */\r\n onClose?: (ok: boolean) => void;\r\n /** if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n /** optional icon */\r\n icon?: React.JSX.Element;\r\n /** optional ok button text */\r\n ok?: string;\r\n /** optional cancel button text */\r\n cancel?: string;\r\n /** optional interval in minutes for which the confirmation dialog will be suppressed if activated. */\r\n suppressQuestionMinutes?: number;\r\n /** optional text for the suppression checkbox */\r\n suppressText?: string;\r\n /** optional name of the dialog. Used only with suppressQuestionMinutes to store the user choice */\r\n dialogName?: string;\r\n}\r\n\r\ninterface DialogConfirmState {\r\n suppress: number | boolean;\r\n}\r\n\r\nexport class DialogConfirm extends Component<DialogConfirmProps, DialogConfirmState> {\r\n constructor(props: DialogConfirmProps) {\r\n super(props);\r\n\r\n if (!this.props.dialogName && this.props.suppressQuestionMinutes) {\r\n throw new Error('dialogName required if suppressQuestionMinutes used');\r\n }\r\n let suppress: number | boolean = false;\r\n\r\n if (this.props.suppressQuestionMinutes) {\r\n suppress =\r\n parseInt(((window as any)._localStorage || window.localStorage).getItem(this.props.dialogName), 10) ||\r\n 0;\r\n\r\n if (!suppress) {\r\n suppress = false;\r\n } else if (Date.now() > suppress) {\r\n ((window as any)._localStorage || window.localStorage).removeItem(this.props.dialogName);\r\n suppress = false;\r\n }\r\n }\r\n\r\n this.state = {\r\n suppress,\r\n };\r\n }\r\n\r\n handleOk(): void {\r\n if (this.state.suppress) {\r\n ((window as any)._localStorage || window.localStorage).setItem(\r\n this.props.dialogName,\r\n Date.now() + (this.props.suppressQuestionMinutes || 2) * 60000,\r\n );\r\n }\r\n if (this.props.onClose) {\r\n this.props.onClose(true);\r\n }\r\n }\r\n\r\n handleCancel(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose(false);\r\n }\r\n }\r\n\r\n render(): JSX.Element | null {\r\n if (typeof this.state.suppress === 'number') {\r\n setTimeout(() => this.props.onClose && this.props.onClose(true), 100);\r\n return null;\r\n }\r\n\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"md\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={(event, reason) => {\r\n if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {\r\n this.handleCancel();\r\n }\r\n }}\r\n aria-labelledby=\"ar_confirmation_dialog_title\"\r\n aria-describedby=\"ar_confirmation_dialog_description\"\r\n >\r\n <DialogTitle id=\"ar_confirmation_dialog_title\">\r\n {this.props.title || I18n.t('ra_Are you sure?')}\r\n </DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_confirmation_dialog_description\">\r\n {this.props.icon || null}\r\n {this.props.text}\r\n {this.props.suppressQuestionMinutes ? <br /> : null}\r\n {this.props.suppressQuestionMinutes ? (\r\n <FormControlLabel\r\n sx={{\r\n '& .FormControlLabel-label': styles.suppress,\r\n '&.FormControlLabel-root': styles.suppressRoot,\r\n }}\r\n control={\r\n <Checkbox\r\n id={`ar_dialog_confirm_suppress_${this.props.dialogName || ''}`}\r\n checked={!!this.state.suppress}\r\n onChange={() => this.setState({ suppress: !this.state.suppress })}\r\n />\r\n }\r\n label={\r\n this.props.suppressText ||\r\n I18n.t(\r\n 'ra_Suppress question for next %s minutes',\r\n (this.props.suppressQuestionMinutes || 2).toString(),\r\n )\r\n }\r\n />\r\n ) : null}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id={`ar_dialog_confirm_ok_${this.props.dialogName || ''}`}\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconCheck />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n id={`ar_dialog_confirm_cancel_${this.props.dialogName || ''}`}\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n color=\"grey\"\r\n startIcon={<IconClose />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { IobTheme } from '../types';
|
|
3
|
+
interface DialogCronProps {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onOk: (cron: string) => void;
|
|
6
|
+
title?: string;
|
|
7
|
+
cron?: string;
|
|
8
|
+
cancel?: string;
|
|
9
|
+
ok?: string;
|
|
10
|
+
/** show only simple configuration */
|
|
11
|
+
simple?: boolean;
|
|
12
|
+
/** show only complex configuration */
|
|
13
|
+
complex?: boolean;
|
|
14
|
+
/** do not show wizard */
|
|
15
|
+
noWizard?: boolean;
|
|
16
|
+
theme: IobTheme;
|
|
17
|
+
}
|
|
18
|
+
interface DialogCronState {
|
|
19
|
+
cron: string;
|
|
20
|
+
mode: 'simple' | 'complex' | 'wizard';
|
|
21
|
+
}
|
|
22
|
+
export declare class DialogCron extends React.Component<DialogCronProps, DialogCronState> {
|
|
23
|
+
constructor(props: DialogCronProps);
|
|
24
|
+
handleCancel(): void;
|
|
25
|
+
handleOk(): void;
|
|
26
|
+
setMode(mode: 'simple' | 'complex' | 'wizard'): void;
|
|
27
|
+
render(): JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, DialogTitle, DialogContent, DialogActions, Dialog, Radio } from '@mui/material';
|
|
3
|
+
import { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';
|
|
4
|
+
import { ComplexCron } from '../Components/ComplexCron';
|
|
5
|
+
import { SimpleCron, cron2state } from '../Components/SimpleCron';
|
|
6
|
+
import { Schedule } from '../Components/Schedule';
|
|
7
|
+
import { I18n } from '../i18n';
|
|
8
|
+
// Generate cron expression
|
|
9
|
+
const styles = {
|
|
10
|
+
dialogPaper: {
|
|
11
|
+
height: 'calc(100% - 96px)',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export class DialogCron extends React.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
let cron;
|
|
18
|
+
if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^["']/, '')[0] !== '{') {
|
|
19
|
+
cron = this.props.cron.replace(/['"]/g, '').trim();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
cron = this.props.cron || '{}';
|
|
23
|
+
if (typeof cron === 'string') {
|
|
24
|
+
cron = cron.replace(/^["']/, '').replace(/["']\n?$/, '');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
this.state = {
|
|
28
|
+
cron,
|
|
29
|
+
mode: this.props.simple
|
|
30
|
+
? 'simple'
|
|
31
|
+
: this.props.complex
|
|
32
|
+
? 'complex'
|
|
33
|
+
: (typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard
|
|
34
|
+
? 'wizard'
|
|
35
|
+
: cron2state(this.props.cron || '* * * * *')
|
|
36
|
+
? 'simple'
|
|
37
|
+
: 'complex',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
handleCancel() {
|
|
41
|
+
this.props.onClose();
|
|
42
|
+
}
|
|
43
|
+
handleOk() {
|
|
44
|
+
this.props.onOk(this.state.cron);
|
|
45
|
+
this.props.onClose();
|
|
46
|
+
}
|
|
47
|
+
setMode(mode) {
|
|
48
|
+
this.setState({ mode });
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return (React.createElement(Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
52
|
+
React.createElement(DialogTitle, { id: "cron-dialog-title" }, this.props.title || I18n.t('ra_Define schedule...')),
|
|
53
|
+
React.createElement(DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
54
|
+
(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? (React.createElement("div", null,
|
|
55
|
+
!this.props.simple && !this.props.complex && !this.props.noWizard && (React.createElement(React.Fragment, null,
|
|
56
|
+
React.createElement(Radio, { key: "wizard", checked: this.state.mode === 'wizard', onChange: () => this.setMode('wizard') }),
|
|
57
|
+
React.createElement("label", { onClick: () => this.setMode('wizard'), style: this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {} }, I18n.t('sc_wizard')))),
|
|
58
|
+
((!this.props.simple && !this.props.complex) || this.props.simple) && (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement(Radio, { key: "simple", checked: this.state.mode === 'simple', onChange: () => this.setMode('simple') }),
|
|
60
|
+
React.createElement("label", { onClick: () => this.setMode('simple'), style: this.state.mode !== 'simple' ? { color: 'lightgrey' } : {} }, I18n.t('sc_simple')))),
|
|
61
|
+
((!this.props.simple && !this.props.complex) || this.props.complex) && (React.createElement(React.Fragment, null,
|
|
62
|
+
React.createElement(Radio, { key: "complex", checked: this.state.mode === 'complex', onChange: () => this.setMode('complex') }),
|
|
63
|
+
React.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, I18n.t('sc_cron')))))) : null,
|
|
64
|
+
this.state.mode === 'simple' && (React.createElement(SimpleCron, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: I18n.getLanguage() })),
|
|
65
|
+
this.state.mode === 'wizard' && (React.createElement(Schedule, { theme: this.props.theme, schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) })),
|
|
66
|
+
this.state.mode === 'complex' && (React.createElement(ComplexCron, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: I18n.getLanguage() }))),
|
|
67
|
+
React.createElement(DialogActions, null,
|
|
68
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: React.createElement(IconOk, null) }, this.props.ok || I18n.t('ra_Ok')),
|
|
69
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: React.createElement(IconCancel, null) }, this.props.cancel || I18n.t('ra_Cancel')))));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=Cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cron.js","sourceRoot":"./src/","sources":["Dialogs/Cron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjG,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,2BAA2B;AAE3B,MAAM,MAAM,GAAwC;IAChD,WAAW,EAAE;QACT,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAuBF,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA2C;IAC7E,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ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C,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\r\n\r\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog, Radio } from '@mui/material';\r\n\r\nimport { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';\r\n\r\nimport { ComplexCron } from '../Components/ComplexCron';\r\nimport { SimpleCron, cron2state } from '../Components/SimpleCron';\r\nimport { Schedule } from '../Components/Schedule';\r\n\r\nimport { I18n } from '../i18n';\r\nimport type { IobTheme } from '../types';\r\n\r\n// Generate cron expression\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n dialogPaper: {\r\n height: 'calc(100% - 96px)',\r\n },\r\n};\r\n\r\ninterface DialogCronProps {\r\n onClose: () => void;\r\n onOk: (cron: string) => void;\r\n title?: string;\r\n cron?: string;\r\n cancel?: string;\r\n ok?: string;\r\n /** show only simple configuration */\r\n simple?: boolean;\r\n /** show only complex configuration */\r\n complex?: boolean;\r\n /** do not show wizard */\r\n noWizard?: boolean;\r\n theme: IobTheme;\r\n}\r\n\r\ninterface DialogCronState {\r\n cron: string;\r\n mode: 'simple' | 'complex' | 'wizard';\r\n}\r\n\r\nexport class DialogCron extends React.Component<DialogCronProps, DialogCronState> {\r\n constructor(props: DialogCronProps) {\r\n super(props);\r\n let cron;\r\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\r\n cron = this.props.cron.replace(/['\"]/g, '').trim();\r\n } else {\r\n cron = this.props.cron || '{}';\r\n if (typeof cron === 'string') {\r\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\r\n }\r\n }\r\n\r\n this.state = {\r\n cron,\r\n mode: this.props.simple\r\n ? 'simple'\r\n : this.props.complex\r\n ? 'complex'\r\n : (typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard\r\n ? 'wizard'\r\n : cron2state(this.props.cron || '* * * * *')\r\n ? 'simple'\r\n : 'complex',\r\n };\r\n }\r\n\r\n handleCancel(): void {\r\n this.props.onClose();\r\n }\r\n\r\n handleOk(): void {\r\n this.props.onOk(this.state.cron);\r\n this.props.onClose();\r\n }\r\n\r\n setMode(mode: 'simple' | 'complex' | 'wizard'): void {\r\n this.setState({ mode });\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n onClose={() => {}}\r\n maxWidth=\"md\"\r\n fullWidth\r\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\r\n open={!0}\r\n aria-labelledby=\"cron-dialog-title\"\r\n >\r\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\r\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\r\n {(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? (\r\n <div>\r\n {!this.props.simple && !this.props.complex && !this.props.noWizard && (\r\n <>\r\n <Radio\r\n key=\"wizard\"\r\n checked={this.state.mode === 'wizard'}\r\n onChange={() => this.setMode('wizard')}\r\n />\r\n <label\r\n onClick={() => this.setMode('wizard')}\r\n style={this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_wizard')}\r\n </label>\r\n </>\r\n )}\r\n\r\n {((!this.props.simple && !this.props.complex) || this.props.simple) && (\r\n <>\r\n <Radio\r\n key=\"simple\"\r\n checked={this.state.mode === 'simple'}\r\n onChange={() => this.setMode('simple')}\r\n />\r\n <label\r\n onClick={() => this.setMode('simple')}\r\n style={this.state.mode !== 'simple' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_simple')}\r\n </label>\r\n </>\r\n )}\r\n\r\n {((!this.props.simple && !this.props.complex) || this.props.complex) && (\r\n <>\r\n <Radio\r\n key=\"complex\"\r\n checked={this.state.mode === 'complex'}\r\n onChange={() => this.setMode('complex')}\r\n />\r\n <label\r\n onClick={() => this.setMode('complex')}\r\n style={this.state.mode !== 'complex' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_cron')}\r\n </label>\r\n </>\r\n )}\r\n </div>\r\n ) : null}\r\n\r\n {this.state.mode === 'simple' && (\r\n <SimpleCron\r\n cronExpression={this.state.cron}\r\n onChange={cron => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n )}\r\n {this.state.mode === 'wizard' && (\r\n <Schedule\r\n theme={this.props.theme}\r\n schedule={this.state.cron}\r\n onChange={(cron: string) => this.setState({ cron })}\r\n />\r\n )}\r\n {this.state.mode === 'complex' && (\r\n <ComplexCron\r\n cronExpression={this.state.cron}\r\n onChange={cron => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n )}\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n startIcon={<IconOk />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n color=\"grey\"\r\n startIcon={<IconCancel />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import React, { Component, type JSX } from 'react';
|
|
8
|
+
interface DialogErrorProps {
|
|
9
|
+
title?: string;
|
|
10
|
+
text: string | React.JSX.Element | React.JSX.Element[];
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class DialogError extends Component<DialogErrorProps> {
|
|
15
|
+
handleOk(): void;
|
|
16
|
+
render(): JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';
|
|
10
|
+
import { Check as IconCheck } from '@mui/icons-material';
|
|
11
|
+
import { I18n } from '../i18n';
|
|
12
|
+
export class DialogError extends Component {
|
|
13
|
+
handleOk() {
|
|
14
|
+
if (this.props.onClose) {
|
|
15
|
+
this.props.onClose();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (React.createElement(Dialog, { open: !0, maxWidth: "sm", fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true, onClose: () => this.handleOk(), "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" },
|
|
20
|
+
React.createElement(DialogTitle, { id: "ar_alert_dialog_title" }, this.props.title || I18n.t('ra_Error')),
|
|
21
|
+
React.createElement(DialogContent, null,
|
|
22
|
+
React.createElement(DialogContentText, { id: "ar_alert_dialog_description" }, this.props.text || I18n.t('ra_Unknown error!'))),
|
|
23
|
+
React.createElement(DialogActions, null,
|
|
24
|
+
React.createElement(Button, { id: "ar_dialog_error_ok", variant: "contained", onClick: () => this.handleOk(), color: "primary", autoFocus: true, startIcon: React.createElement(IconCheck, null) }, I18n.t('ra_Ok')))));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.js","sourceRoot":"./src/","sources":["Dialogs/Error.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAa/B,MAAM,OAAO,WAAY,SAAQ,SAA2B;IACxD,QAAQ;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,oBAAC,MAAM,IACH,IAAI,EAAE,CAAC,CAAC,EACR,QAAQ,EAAC,IAAI,EACb,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAC3E,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,qBACd,oBAAoB,sBACnB,0BAA0B;YAE3C,oBAAC,WAAW,IAAC,EAAE,EAAC,uBAAuB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAe;YAC9F,oBAAC,aAAa;gBACV,oBAAC,iBAAiB,IAAC,EAAE,EAAC,6BAA6B,IAC9C,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAC/B,CACR;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAC,oBAAoB,EACvB,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CACX,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\r\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\r\n\r\nimport { Check as IconCheck } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\ninterface DialogErrorProps {\r\n /* The dialog title; default: Error (translated) */\r\n title?: string;\r\n /* The dialog text */\r\n text: string | React.JSX.Element | React.JSX.Element[];\r\n /* Close handler. */\r\n onClose?: () => void;\r\n /* if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n}\r\n\r\nexport class DialogError extends Component<DialogErrorProps> {\r\n handleOk(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose();\r\n }\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"sm\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={() => this.handleOk()}\r\n aria-labelledby=\"alert-dialog-title\"\r\n aria-describedby=\"alert-dialog-description\"\r\n >\r\n <DialogTitle id=\"ar_alert_dialog_title\">{this.props.title || I18n.t('ra_Error')}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_alert_dialog_description\">\r\n {this.props.text || I18n.t('ra_Unknown error!')}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id=\"ar_dialog_error_ok\"\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconCheck />}\r\n >\r\n {I18n.t('ra_Ok')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import React, { Component, type JSX } from 'react';
|
|
8
|
+
interface DialogMessageProps {
|
|
9
|
+
title?: string;
|
|
10
|
+
text: string | React.JSX.Element | React.JSX.Element[];
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
icon?: React.JSX.Element;
|
|
14
|
+
ok?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class DialogMessage extends Component<DialogMessageProps> {
|
|
17
|
+
handleOk(): void;
|
|
18
|
+
render(): JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';
|
|
10
|
+
import { Close as IconClose } from '@mui/icons-material';
|
|
11
|
+
import { I18n } from '../i18n';
|
|
12
|
+
export class DialogMessage extends Component {
|
|
13
|
+
handleOk() {
|
|
14
|
+
if (this.props.onClose) {
|
|
15
|
+
this.props.onClose();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (React.createElement(Dialog, { open: !0, maxWidth: "sm", fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true, onClose: () => this.handleOk(), "aria-labelledby": "ar_dialog_message_title", "aria-describedby": "ar_dialog_message_description" },
|
|
20
|
+
React.createElement(DialogTitle, { id: "ar_dialog_message_title" }, this.props.title || I18n.t('ra_Message')),
|
|
21
|
+
React.createElement(DialogContent, null,
|
|
22
|
+
React.createElement(DialogContentText, { id: "ar_dialog_message_description" },
|
|
23
|
+
React.createElement("span", { style: { marginRight: this.props.icon ? 8 : 0 } }, this.props.icon || null),
|
|
24
|
+
this.props.text)),
|
|
25
|
+
React.createElement(DialogActions, null,
|
|
26
|
+
React.createElement(Button, { id: "ar_dialog_message_ok", variant: "contained", onClick: () => this.handleOk(), color: "primary", autoFocus: true, startIcon: React.createElement(IconClose, null) }, this.props.ok || I18n.t('ra_Close')))));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"./src/","sources":["Dialogs/Message.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiB/B,MAAM,OAAO,aAAc,SAAQ,SAA6B;IAC5D,QAAQ;QACJ,IAA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2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\r\n\r\nimport { Close as IconClose } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\ninterface DialogMessageProps {\r\n /* The dialog title; default: Message (translated) */\r\n title?: string;\r\n /* The dialog text */\r\n text: string | React.JSX.Element | React.JSX.Element[];\r\n /* Close handler. */\r\n onClose?: () => void;\r\n /* if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n /* optional icon */\r\n icon?: React.JSX.Element;\r\n /* optional ok button text */\r\n ok?: string;\r\n}\r\n\r\nexport class DialogMessage extends Component<DialogMessageProps> {\r\n handleOk(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose();\r\n }\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"sm\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={() => this.handleOk()}\r\n aria-labelledby=\"ar_dialog_message_title\"\r\n aria-describedby=\"ar_dialog_message_description\"\r\n >\r\n <DialogTitle id=\"ar_dialog_message_title\">{this.props.title || I18n.t('ra_Message')}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_dialog_message_description\">\r\n <span style={{ marginRight: this.props.icon ? 8 : 0 }}>{this.props.icon || null}</span>\r\n {this.props.text}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id=\"ar_dialog_message_ok\"\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconClose />}\r\n >\r\n {this.props.ok || I18n.t('ra_Close')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { Connection } from '@iobroker/socket-client';
|
|
3
|
+
import type { IobTheme } from '../types';
|
|
4
|
+
interface DialogSelectFileProps {
|
|
5
|
+
/** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */
|
|
6
|
+
dialogName?: string;
|
|
7
|
+
/** The dialog title; default: Please select object ID... (translated) */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Set to true to allow the selection of multiple IDs. */
|
|
10
|
+
multiSelect?: boolean;
|
|
11
|
+
/** Image prefix. Normally, admin has '../..' and the web has '../' */
|
|
12
|
+
imagePrefix?: string;
|
|
13
|
+
/** @deprecated Image prefix */
|
|
14
|
+
prefix?: string;
|
|
15
|
+
/** Show the expert button? */
|
|
16
|
+
showExpertButton?: boolean;
|
|
17
|
+
/** Language */
|
|
18
|
+
lang?: ioBroker.Languages;
|
|
19
|
+
/** Socket class */
|
|
20
|
+
socket: Connection;
|
|
21
|
+
/** Theme name. */
|
|
22
|
+
themeName?: string;
|
|
23
|
+
/** Theme type. */
|
|
24
|
+
themeType?: 'dark' | 'light';
|
|
25
|
+
/** Theme object. */
|
|
26
|
+
theme: IobTheme;
|
|
27
|
+
/** The selected IDs. */
|
|
28
|
+
selected?: string | string[];
|
|
29
|
+
/** The ok button text; default: OK (translated) */
|
|
30
|
+
ok?: string;
|
|
31
|
+
/** The cancel button text; default: Cancel (translated) */
|
|
32
|
+
cancel?: string;
|
|
33
|
+
/** If download of files enabled */
|
|
34
|
+
allowUpload?: boolean;
|
|
35
|
+
/** If download of files enabled */
|
|
36
|
+
allowDownload?: boolean;
|
|
37
|
+
/** If creation of folders enabled */
|
|
38
|
+
allowCreateFolder?: boolean;
|
|
39
|
+
/** If creation of folders enabled */
|
|
40
|
+
allowDelete?: boolean;
|
|
41
|
+
/** if tile view enabled (default true) */
|
|
42
|
+
allowView?: boolean;
|
|
43
|
+
/** Show toolbar (default true) */
|
|
44
|
+
showToolbar?: boolean;
|
|
45
|
+
/** Limit file browser to one specific objectID of type meta and the following path (like vis.0/main) */
|
|
46
|
+
limitPath?: string;
|
|
47
|
+
/** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */
|
|
48
|
+
filterFiles?: string[];
|
|
49
|
+
/** images, code, txt, audio, video */
|
|
50
|
+
filterByType?: 'images' | 'code' | 'txt';
|
|
51
|
+
/** allow only folder's selection */
|
|
52
|
+
selectOnlyFolders?: boolean;
|
|
53
|
+
/** Close handler that is always called when the dialog is closed. */
|
|
54
|
+
onClose: () => void;
|
|
55
|
+
/** Handler that is called when the user presses OK or by double click. */
|
|
56
|
+
onOk: (selected: string | string[] | undefined) => void;
|
|
57
|
+
/** The styling class names. */
|
|
58
|
+
filters?: Record<string, string>;
|
|
59
|
+
/** Allow switch views Table<=>Rows */
|
|
60
|
+
showViewTypeButton?: boolean;
|
|
61
|
+
/** If type selector should be shown */
|
|
62
|
+
showTypeSelector?: boolean;
|
|
63
|
+
/** If defined, allow selecting only files from this folder */
|
|
64
|
+
restrictToFolder?: string;
|
|
65
|
+
/** If restrictToFolder defined, allow selecting files outside of this folder */
|
|
66
|
+
allowNonRestricted?: boolean;
|
|
67
|
+
/** force expert mode */
|
|
68
|
+
expertMode?: boolean;
|
|
69
|
+
/** Translate function - optional */
|
|
70
|
+
t?: (text: string, ...args: any[]) => string;
|
|
71
|
+
/** The z-index of the dialog; default: 1300 */
|
|
72
|
+
zIndex?: number;
|
|
73
|
+
}
|
|
74
|
+
interface DialogSelectFileState {
|
|
75
|
+
selected: string[];
|
|
76
|
+
}
|
|
77
|
+
export declare class DialogSelectFile extends React.Component<DialogSelectFileProps, DialogSelectFileState> {
|
|
78
|
+
private readonly dialogName;
|
|
79
|
+
private readonly filters;
|
|
80
|
+
constructor(props: DialogSelectFileProps);
|
|
81
|
+
handleCancel(): void;
|
|
82
|
+
handleOk(): void;
|
|
83
|
+
render(): JSX.Element;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022-2025 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';
|
|
9
|
+
import { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';
|
|
10
|
+
import { I18n } from '../i18n';
|
|
11
|
+
import { FileBrowser } from '../Components/FileBrowser';
|
|
12
|
+
const styles = {
|
|
13
|
+
headerID: {
|
|
14
|
+
fontWeight: 'bold',
|
|
15
|
+
fontStyle: 'italic',
|
|
16
|
+
},
|
|
17
|
+
dialog: {
|
|
18
|
+
height: '95%',
|
|
19
|
+
},
|
|
20
|
+
dialogMobile: {
|
|
21
|
+
// it is sx
|
|
22
|
+
padding: '4px',
|
|
23
|
+
width: '100%',
|
|
24
|
+
maxWidth: '100%',
|
|
25
|
+
maxHeight: 'calc(100% - 16px)',
|
|
26
|
+
height: '100%',
|
|
27
|
+
},
|
|
28
|
+
content: {
|
|
29
|
+
height: '100%',
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
},
|
|
32
|
+
contentMobile: {
|
|
33
|
+
padding: '8px 4px',
|
|
34
|
+
},
|
|
35
|
+
titleRoot: {
|
|
36
|
+
whiteSpace: 'nowrap',
|
|
37
|
+
width: 'calc(100% - 72px)',
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
display: 'inline-block',
|
|
40
|
+
textOverflow: 'ellipsis',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export class DialogSelectFile extends React.Component {
|
|
44
|
+
dialogName;
|
|
45
|
+
filters;
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
48
|
+
this.dialogName = this.props.dialogName || 'default';
|
|
49
|
+
this.dialogName = `SelectFile.${this.dialogName}`;
|
|
50
|
+
const filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';
|
|
51
|
+
try {
|
|
52
|
+
this.filters = JSON.parse(filters);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
this.filters = {};
|
|
56
|
+
}
|
|
57
|
+
if (props.filters) {
|
|
58
|
+
this.filters = { ...this.filters, ...props.filters };
|
|
59
|
+
}
|
|
60
|
+
let selected = this.props.selected || [];
|
|
61
|
+
if (typeof selected !== 'object') {
|
|
62
|
+
selected = [selected];
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
selected = [...selected];
|
|
66
|
+
}
|
|
67
|
+
selected = selected.filter(id => id);
|
|
68
|
+
this.state = {
|
|
69
|
+
selected,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
handleCancel() {
|
|
73
|
+
this.props.onClose();
|
|
74
|
+
}
|
|
75
|
+
handleOk() {
|
|
76
|
+
this.props.onOk(this.props.multiSelect || !Array.isArray(this.state.selected)
|
|
77
|
+
? this.state.selected
|
|
78
|
+
: this.state.selected[0] || '');
|
|
79
|
+
this.props.onClose();
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
let title;
|
|
83
|
+
if (this.state.selected.length) {
|
|
84
|
+
if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {
|
|
85
|
+
title = [
|
|
86
|
+
React.createElement("span", { key: "selected" },
|
|
87
|
+
I18n.t('ra_Selected'),
|
|
88
|
+
"\u00A0"),
|
|
89
|
+
React.createElement("span", { key: "id", style: styles.headerID }, this.state.selected),
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
title = [
|
|
94
|
+
React.createElement("span", { key: "selected" },
|
|
95
|
+
I18n.t('ra_Selected'),
|
|
96
|
+
"\u00A0"),
|
|
97
|
+
React.createElement("span", { key: "id", style: styles.headerID }, I18n.t('%s items', this.state.selected.length)),
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
title = this.props.title || I18n.t('ra_Please select file...');
|
|
103
|
+
}
|
|
104
|
+
return (React.createElement(Dialog, { onClose: () => { }, maxWidth: false, style: { zIndex: this.props.zIndex || undefined }, sx: { '& .MuiDialog-paper': { ...styles.dialog, ...styles.dialogMobile } }, fullWidth: true, open: !0, "aria-labelledby": "ar_dialog_selectfile_title" },
|
|
105
|
+
React.createElement(DialogTitle, { id: "ar_dialog_selectfile_title", sx: { '&.MuiDialogTitle-root': styles.titleRoot } }, title),
|
|
106
|
+
React.createElement(DialogContent, { style: { ...styles.content, ...styles.contentMobile } },
|
|
107
|
+
React.createElement(FileBrowser, { ready: true, imagePrefix: this.props.imagePrefix || this.props.prefix || '../', allowUpload: !!this.props.allowUpload, allowDownload: this.props.allowDownload !== false, allowCreateFolder: !!this.props.allowCreateFolder, allowDelete: !!this.props.allowDelete, allowView: this.props.allowView !== false, showViewTypeButton: this.props.showViewTypeButton !== false, showToolbar: this.props.showToolbar !== false, limitPath: this.props.limitPath, filterFiles: this.props.filterFiles, filterByType: this.props.filterByType, selected: this.props.selected, restrictToFolder: this.props.restrictToFolder, allowNonRestricted: this.props.allowNonRestricted, onSelect: (selected, isDoubleClick, isFolder) => {
|
|
108
|
+
this.setState({ selected: Array.isArray(selected) ? selected : [selected] }, () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk());
|
|
109
|
+
}, t: this.props.t || I18n.t, lang: this.props.lang || I18n.getLanguage(), socket: this.props.socket, themeType: this.props.themeType, themeName: this.props.themeName, theme: this.props.theme, showExpertButton: this.props.showExpertButton, expertMode: this.props.expertMode, showTypeSelector: this.props.showTypeSelector })),
|
|
110
|
+
React.createElement(DialogActions, null,
|
|
111
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.handleOk(), startIcon: React.createElement(IconOk, null), disabled: !this.state.selected.length, color: "primary" }, this.props.ok || I18n.t('ra_Ok')),
|
|
112
|
+
React.createElement(Button, { color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: React.createElement(IconCancel, null) }, this.props.cancel || I18n.t('ra_Cancel')))));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=SelectFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectFile.js","sourceRoot":"./src/","sources":["Dialogs/SelectFile.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,MAAM,MAAM,GAAwC;IAChD,QAAQ,EAAE;QACN,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,QAAQ;KACtB;IACD,MAAM,EAAE;QACJ,MAAM,EAAE,KAAK;KAChB;IACD,YAAY,EAAE;QACV,WAAW;QACX,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,mBAAmB;QAC9B,MAAM,EAAE,MAAM;KACjB;IACD,OAAO,EAAE;QACL,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;KACrB;IACD,aAAa,EAAE;QACX,OAAO,EAAE,SAAS;KACrB;IACD,SAAS,EAAE;QACP,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,cAAc;QACvB,YAAY,EAAE,UAAU;KAC3B;CACJ,CAAC;AA6EF,MAAM,OAAO,gBAAiB,SAAQ,KAAK,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AQ,EAAE,EAC9B,SAAS,EAAE,oBAAC,MAAM,OAAG,EACrB,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EACrC,KAAK,EAAC,SAAS,IAEd,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/*\n * Copyright 2022-2025 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\nimport React, { type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';\n\nimport type { Connection } from '@iobroker/socket-client';\n\nimport { I18n } from '../i18n';\nimport { FileBrowser } from '../Components/FileBrowser';\nimport type { IobTheme } from '../types';\n\nconst styles: Record<string, React.CSSProperties> = {\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic',\n },\n dialog: {\n height: '95%',\n },\n dialogMobile: {\n // it is sx\n padding: '4px',\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n height: '100%',\n },\n content: {\n height: '100%',\n overflow: 'hidden',\n },\n contentMobile: {\n padding: '8px 4px',\n },\n titleRoot: {\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n },\n};\n\ninterface DialogSelectFileProps {\n /** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */\n dialogName?: string;\n /** The dialog title; default: Please select object ID... (translated) */\n title?: string;\n /** Set to true to allow the selection of multiple IDs. */\n multiSelect?: boolean;\n /** Image prefix. Normally, admin has '../..' and the web has '../' */\n imagePrefix?: string; // Prefix (default: '.')\n /** @deprecated Image prefix */\n prefix?: string;\n /** Show the expert button? */\n showExpertButton?: boolean;\n /** Language */\n lang?: ioBroker.Languages;\n /** Socket class */\n socket: Connection;\n /** Theme name. */\n themeName?: string;\n /** Theme type. */\n themeType?: 'dark' | 'light';\n /** Theme object. */\n theme: IobTheme;\n /** The selected IDs. */\n selected?: string | string[];\n /** The ok button text; default: OK (translated) */\n ok?: string;\n /** The cancel button text; default: Cancel (translated) */\n cancel?: string;\n /** If download of files enabled */\n allowUpload?: boolean;\n /** If download of files enabled */\n allowDownload?: boolean;\n /** If creation of folders enabled */\n allowCreateFolder?: boolean;\n /** If creation of folders enabled */\n allowDelete?: boolean;\n /** if tile view enabled (default true) */\n allowView?: boolean;\n /** Show toolbar (default true) */\n showToolbar?: boolean;\n /** Limit file browser to one specific objectID of type meta and the following path (like vis.0/main) */\n limitPath?: string;\n /** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */\n filterFiles?: string[];\n /** images, code, txt, audio, video */\n filterByType?: 'images' | 'code' | 'txt';\n /** allow only folder's selection */\n selectOnlyFolders?: boolean;\n /** Close handler that is always called when the dialog is closed. */\n onClose: () => void;\n /** Handler that is called when the user presses OK or by double click. */\n onOk: (selected: string | string[] | undefined) => void;\n /** The styling class names. */\n filters?: Record<string, string>;\n /** Allow switch views Table<=>Rows */\n showViewTypeButton?: boolean;\n /** If type selector should be shown */\n showTypeSelector?: boolean;\n /** If defined, allow selecting only files from this folder */\n restrictToFolder?: string;\n /** If restrictToFolder defined, allow selecting files outside of this folder */\n allowNonRestricted?: boolean;\n /** force expert mode */\n expertMode?: boolean;\n /** Translate function - optional */\n t?: (text: string, ...args: any[]) => string;\n /** The z-index of the dialog; default: 1300 */\n zIndex?: number;\n}\n\ninterface DialogSelectFileState {\n selected: string[];\n}\n\nexport class DialogSelectFile extends React.Component<DialogSelectFileProps, DialogSelectFileState> {\n private readonly dialogName: string;\n\n private readonly filters: Record<string, string>;\n\n constructor(props: DialogSelectFileProps) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectFile.${this.dialogName}`;\n\n const filters: string = ((window as any)._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(filters);\n } catch {\n this.filters = {};\n }\n\n if (props.filters) {\n this.filters = { ...this.filters, ...props.filters };\n }\n\n let selected = this.props.selected || [];\n if (typeof selected !== 'object') {\n selected = [selected];\n } else {\n selected = [...selected];\n }\n selected = selected.filter(id => id);\n\n this.state = {\n selected,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(\n this.props.multiSelect || !Array.isArray(this.state.selected)\n ? this.state.selected\n : this.state.selected[0] || '',\n );\n this.props.onClose();\n }\n\n render(): JSX.Element {\n let title;\n if (this.state.selected.length) {\n if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n \n </span>,\n <span\n key=\"id\"\n style={styles.headerID}\n >\n {this.state.selected}\n </span>,\n ];\n } else {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n \n </span>,\n <span\n key=\"id\"\n style={styles.headerID}\n >\n {I18n.t('%s items', this.state.selected.length)}\n </span>,\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select file...');\n }\n\n return (\n <Dialog\n onClose={() => {}}\n maxWidth={false}\n style={{ zIndex: this.props.zIndex || undefined }}\n sx={{ '& .MuiDialog-paper': { ...styles.dialog, ...styles.dialogMobile } }}\n fullWidth\n open={!0}\n aria-labelledby=\"ar_dialog_selectfile_title\"\n >\n <DialogTitle\n id=\"ar_dialog_selectfile_title\"\n sx={{ '&.MuiDialogTitle-root': styles.titleRoot }}\n >\n {title}\n </DialogTitle>\n <DialogContent style={{ ...styles.content, ...styles.contentMobile }}>\n <FileBrowser\n ready\n imagePrefix={this.props.imagePrefix || this.props.prefix || '../'} // prefix is for back compatibility\n allowUpload={!!this.props.allowUpload}\n allowDownload={this.props.allowDownload !== false}\n allowCreateFolder={!!this.props.allowCreateFolder}\n allowDelete={!!this.props.allowDelete}\n allowView={this.props.allowView !== false}\n showViewTypeButton={this.props.showViewTypeButton !== false}\n showToolbar={this.props.showToolbar !== false}\n limitPath={this.props.limitPath}\n filterFiles={this.props.filterFiles}\n filterByType={this.props.filterByType}\n selected={this.props.selected}\n restrictToFolder={this.props.restrictToFolder}\n allowNonRestricted={this.props.allowNonRestricted}\n onSelect={(selected: string | string[], isDoubleClick?: boolean, isFolder?: boolean) => {\n this.setState(\n { selected: Array.isArray(selected) ? selected : [selected] },\n () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk(),\n );\n }}\n t={this.props.t || I18n.t}\n lang={this.props.lang || I18n.getLanguage()}\n socket={this.props.socket}\n themeType={this.props.themeType}\n themeName={this.props.themeName}\n theme={this.props.theme}\n showExpertButton={this.props.showExpertButton}\n expertMode={this.props.expertMode}\n showTypeSelector={this.props.showTypeSelector}\n />\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n onClick={() => this.handleOk()}\n startIcon={<IconOk />}\n disabled={!this.state.selected.length}\n color=\"primary\"\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2025 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
import { Component, type JSX } from 'react';
|
|
8
|
+
import type { Connection } from '../Connection';
|
|
9
|
+
import { type ObjectBrowserColumn, type ObjectBrowserCustomFilter } from '../Components/ObjectBrowser';
|
|
10
|
+
import type { IobTheme } from '../types';
|
|
11
|
+
export interface SelectIDFilters {
|
|
12
|
+
id?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
room?: string[];
|
|
15
|
+
func?: string[];
|
|
16
|
+
role?: string[];
|
|
17
|
+
type?: string[];
|
|
18
|
+
custom?: string[];
|
|
19
|
+
}
|
|
20
|
+
interface DialogSelectIDProps {
|
|
21
|
+
/** The internal name of the dialog; default: "default". Used to store settings in local storage */
|
|
22
|
+
dialogName?: string;
|
|
23
|
+
/** The dialog title; default: Please select object ID... (translated) */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Set to true to allow the selection of multiple IDs. */
|
|
26
|
+
multiSelect?: boolean;
|
|
27
|
+
/** Show folders before any leaves. */
|
|
28
|
+
foldersFirst?: boolean;
|
|
29
|
+
/** Path prefix for images (default: '.') */
|
|
30
|
+
imagePrefix?: string;
|
|
31
|
+
/** @deprecated same as imagePrefix */
|
|
32
|
+
prefix?: string;
|
|
33
|
+
/** Show the expert button */
|
|
34
|
+
showExpertButton?: boolean;
|
|
35
|
+
/** Force expert mode */
|
|
36
|
+
expertMode?: boolean;
|
|
37
|
+
/** optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
|
|
38
|
+
columns?: ObjectBrowserColumn[];
|
|
39
|
+
/** Object types to show; default: 'state' only */
|
|
40
|
+
types?: ioBroker.ObjectType | ioBroker.ObjectType[];
|
|
41
|
+
/** The language. */
|
|
42
|
+
lang?: ioBroker.Languages;
|
|
43
|
+
/** The socket connection. */
|
|
44
|
+
socket: Connection;
|
|
45
|
+
/** Can't objects be edited? (default: true) */
|
|
46
|
+
notEditable?: boolean;
|
|
47
|
+
/** Theme name. */
|
|
48
|
+
themeName?: string;
|
|
49
|
+
/** Theme type: dark or light */
|
|
50
|
+
themeType?: string;
|
|
51
|
+
/** The theme object */
|
|
52
|
+
theme: IobTheme;
|
|
53
|
+
/** The date format for the date columns */
|
|
54
|
+
dateFormat?: string;
|
|
55
|
+
/** Is use comma or point for displaying of float numbers */
|
|
56
|
+
isFloatComma?: boolean;
|
|
57
|
+
/** Custom filter. */
|
|
58
|
+
customFilter?: ObjectBrowserCustomFilter;
|
|
59
|
+
/** The selected IDs. */
|
|
60
|
+
selected?: string | string[];
|
|
61
|
+
/** The ok button text; default: OK (translated) */
|
|
62
|
+
ok?: string;
|
|
63
|
+
/** The cancel button text; default: Cancel (translated) */
|
|
64
|
+
cancel?: string;
|
|
65
|
+
/** Close handler that is always called when the dialog is closed. */
|
|
66
|
+
onClose: () => void;
|
|
67
|
+
/** Handler that is called when the user presses OK. */
|
|
68
|
+
onOk: (selected: string | string[] | undefined, name: string | null) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Function to filter out all unnecessary objects. Can be string or function.
|
|
71
|
+
* It cannot be used together with "types".
|
|
72
|
+
* Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states
|
|
73
|
+
* In case of string, it must look like `obj.common && obj.common.type === 'boolean'`
|
|
74
|
+
*/
|
|
75
|
+
filterFunc?: string | ((obj: ioBroker.Object) => boolean);
|
|
76
|
+
/** predefined filter fields, like {"id":"","name":"","room":"","func":"","role":"level","type":"","custom":""} */
|
|
77
|
+
filters?: SelectIDFilters;
|
|
78
|
+
/** Show elements only of this root ID */
|
|
79
|
+
root?: string;
|
|
80
|
+
/** Allow selection of non-objects (virtual branches) */
|
|
81
|
+
allowNonObjects?: boolean;
|
|
82
|
+
/** Will be called by selection, so the decision could be done if the OK button is available or not */
|
|
83
|
+
onSelectConfirm?: (selected: string | string[], objects: Record<string, ioBroker.Object | null | undefined>) => Promise<boolean>;
|
|
84
|
+
/** The z-index of the dialog; default: 1300 */
|
|
85
|
+
zIndex?: number;
|
|
86
|
+
}
|
|
87
|
+
interface DialogSelectIDState {
|
|
88
|
+
selected: string[];
|
|
89
|
+
name: string | null;
|
|
90
|
+
selectionBlocked: boolean;
|
|
91
|
+
allLoaded?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export declare class DialogSelectID extends Component<DialogSelectIDProps, DialogSelectIDState> {
|
|
94
|
+
private readonly dialogName;
|
|
95
|
+
private filters;
|
|
96
|
+
private readonly filterFunc?;
|
|
97
|
+
constructor(props: DialogSelectIDProps);
|
|
98
|
+
handleCancel(): void;
|
|
99
|
+
handleOk(): void;
|
|
100
|
+
render(): JSX.Element;
|
|
101
|
+
}
|
|
102
|
+
export {};
|