@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,1266 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Input, Radio, FormControlLabel, FormGroup, Checkbox, MenuItem, Select, TextField, Box, } from '@mui/material';
|
|
3
|
+
import { I18n } from '../i18n';
|
|
4
|
+
import { Utils } from './Utils';
|
|
5
|
+
const styles = {
|
|
6
|
+
hr: {
|
|
7
|
+
border: 0,
|
|
8
|
+
borderTop: '1px solid gray',
|
|
9
|
+
},
|
|
10
|
+
scrollWindow: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
overflow: 'auto',
|
|
13
|
+
height: 'calc(100% - 22px)',
|
|
14
|
+
},
|
|
15
|
+
rowDiv: {
|
|
16
|
+
width: '100%',
|
|
17
|
+
},
|
|
18
|
+
modeDiv: {
|
|
19
|
+
width: 200,
|
|
20
|
+
display: 'inline-block',
|
|
21
|
+
verticalAlign: 'top',
|
|
22
|
+
},
|
|
23
|
+
settingsDiv: {
|
|
24
|
+
display: 'inline-block',
|
|
25
|
+
verticalAlign: 'top',
|
|
26
|
+
},
|
|
27
|
+
inputTime: {
|
|
28
|
+
width: 90,
|
|
29
|
+
marginTop: 0,
|
|
30
|
+
marginLeft: 5,
|
|
31
|
+
},
|
|
32
|
+
inputDate: {
|
|
33
|
+
width: 140,
|
|
34
|
+
marginTop: 0,
|
|
35
|
+
marginLeft: 5,
|
|
36
|
+
},
|
|
37
|
+
inputEvery: {
|
|
38
|
+
width: 40,
|
|
39
|
+
marginLeft: 5,
|
|
40
|
+
marginRight: 5,
|
|
41
|
+
},
|
|
42
|
+
inputRadio: {
|
|
43
|
+
padding: '4px 12px',
|
|
44
|
+
verticalAlign: 'top',
|
|
45
|
+
},
|
|
46
|
+
inputGroup: {
|
|
47
|
+
maxWidth: 400,
|
|
48
|
+
display: 'inline-block',
|
|
49
|
+
},
|
|
50
|
+
inputGroupElement: {
|
|
51
|
+
width: 120,
|
|
52
|
+
},
|
|
53
|
+
inputDateDay: {
|
|
54
|
+
width: 60,
|
|
55
|
+
},
|
|
56
|
+
inputDateDayCheck: {
|
|
57
|
+
padding: 4,
|
|
58
|
+
},
|
|
59
|
+
inputSmallCheck: {
|
|
60
|
+
padding: 0,
|
|
61
|
+
},
|
|
62
|
+
rowOnce: {},
|
|
63
|
+
rowDays: (theme) => ({
|
|
64
|
+
background: theme.palette.mode !== 'dark' ? '#ddeaff' : '#4b5057',
|
|
65
|
+
}),
|
|
66
|
+
rowDows: (theme) => ({
|
|
67
|
+
background: theme.palette.mode !== 'dark' ? '#DDFFDD' : '#52646c',
|
|
68
|
+
}),
|
|
69
|
+
rowDates: (theme) => ({
|
|
70
|
+
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#747a86',
|
|
71
|
+
}),
|
|
72
|
+
rowWeeks: (theme) => ({
|
|
73
|
+
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#717680',
|
|
74
|
+
}),
|
|
75
|
+
rowMonths: (theme) => ({
|
|
76
|
+
background: theme.palette.mode !== 'dark' ? '#DDFFFF' : '#1f5557',
|
|
77
|
+
}),
|
|
78
|
+
rowMonthsDates: (theme) => ({
|
|
79
|
+
background: theme.palette.mode !== 'dark' ? '#EEFFFF' : '#3c5737',
|
|
80
|
+
maxWidth: 600,
|
|
81
|
+
}),
|
|
82
|
+
rowYears: (theme) => ({
|
|
83
|
+
background: theme.palette.mode !== 'dark' ? '#fbffdd' : '#574b33',
|
|
84
|
+
}),
|
|
85
|
+
rowDaysDows: (theme) => ({
|
|
86
|
+
background: theme.palette.mode !== 'dark' ? '#EEEAFF' : '#573544',
|
|
87
|
+
pl: '10px',
|
|
88
|
+
pb: '10px',
|
|
89
|
+
}),
|
|
90
|
+
rowDowsDows: (theme) => ({
|
|
91
|
+
background: theme.palette.mode !== 'dark' ? '#EEFFEE' : '#3d4c54',
|
|
92
|
+
pl: '10px',
|
|
93
|
+
pb: '10px',
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
97
|
+
const MONTHS = [
|
|
98
|
+
'January',
|
|
99
|
+
'February',
|
|
100
|
+
'March',
|
|
101
|
+
'April',
|
|
102
|
+
'May',
|
|
103
|
+
'June',
|
|
104
|
+
'July',
|
|
105
|
+
'August',
|
|
106
|
+
'September',
|
|
107
|
+
'October',
|
|
108
|
+
'November',
|
|
109
|
+
'December',
|
|
110
|
+
];
|
|
111
|
+
const PERIODS = {
|
|
112
|
+
minutes: 'minutes',
|
|
113
|
+
hours: 'hours',
|
|
114
|
+
};
|
|
115
|
+
const ASTRO = [
|
|
116
|
+
'sunrise',
|
|
117
|
+
'sunriseEnd',
|
|
118
|
+
'goldenHourEnd',
|
|
119
|
+
'solarNoon',
|
|
120
|
+
'goldenHour',
|
|
121
|
+
'sunsetStart',
|
|
122
|
+
'sunset',
|
|
123
|
+
'dusk',
|
|
124
|
+
'nauticalDusk',
|
|
125
|
+
'night',
|
|
126
|
+
'nightEnd',
|
|
127
|
+
'nauticalDawn',
|
|
128
|
+
'dawn',
|
|
129
|
+
'nadir',
|
|
130
|
+
];
|
|
131
|
+
function padding(num) {
|
|
132
|
+
if (num < 10) {
|
|
133
|
+
return `0${num}`;
|
|
134
|
+
}
|
|
135
|
+
return `${num}`;
|
|
136
|
+
}
|
|
137
|
+
// interface TextTimeProps {
|
|
138
|
+
// inputRef: React.RefObject<HTMLInputElement>;
|
|
139
|
+
// placeholder?: string;
|
|
140
|
+
// }
|
|
141
|
+
// function TextTime(props: TextTimeProps) {
|
|
142
|
+
// const { inputRef, ...other } = props;
|
|
143
|
+
//
|
|
144
|
+
// return <MaskedInput
|
|
145
|
+
// {...other}
|
|
146
|
+
// ref={inputRef}
|
|
147
|
+
// mask={[/[0-2]/, /[0-9]/, ':', /[0-5]/, /[0-9]/]}
|
|
148
|
+
// placeholderChar={props.placeholder || '00:00'}
|
|
149
|
+
// showMask
|
|
150
|
+
// />;
|
|
151
|
+
// }
|
|
152
|
+
// function TextDate(props: TextTimeProps) {
|
|
153
|
+
// const { inputRef, ...other } = props;
|
|
154
|
+
//
|
|
155
|
+
// return <MaskedInput
|
|
156
|
+
// {...other}
|
|
157
|
+
// ref={inputRef}
|
|
158
|
+
// mask={[/[0-3]/, /[0-9]/, '.', /[0-1]/, /[0-9]/, '.', '2', '0', /[0-9]/, /[0-9]/]}
|
|
159
|
+
// placeholderChar={props.placeholder || '01.01.2020'}
|
|
160
|
+
// showMask
|
|
161
|
+
// />;
|
|
162
|
+
// }
|
|
163
|
+
const DEFAULT = {
|
|
164
|
+
time: {
|
|
165
|
+
exactTime: false,
|
|
166
|
+
start: '00:00',
|
|
167
|
+
end: '23:59',
|
|
168
|
+
mode: 'hours',
|
|
169
|
+
interval: 1,
|
|
170
|
+
},
|
|
171
|
+
period: {
|
|
172
|
+
once: '',
|
|
173
|
+
days: 1,
|
|
174
|
+
dows: '',
|
|
175
|
+
dates: '',
|
|
176
|
+
weeks: 0,
|
|
177
|
+
months: '',
|
|
178
|
+
years: 0,
|
|
179
|
+
yearMonth: 0,
|
|
180
|
+
yearDate: 0,
|
|
181
|
+
},
|
|
182
|
+
valid: {
|
|
183
|
+
from: '',
|
|
184
|
+
to: '',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
function string2USdate(date) {
|
|
188
|
+
const parts = date.split('.');
|
|
189
|
+
if (parts.length === 3) {
|
|
190
|
+
return `${parts[2]}-${parts[1]}-${parts[0]}`;
|
|
191
|
+
}
|
|
192
|
+
return '';
|
|
193
|
+
}
|
|
194
|
+
export class Schedule extends Component {
|
|
195
|
+
refFrom;
|
|
196
|
+
refTo;
|
|
197
|
+
refOnce;
|
|
198
|
+
timerOnce = null;
|
|
199
|
+
timerFrom = null;
|
|
200
|
+
timerTo = null;
|
|
201
|
+
constructor(props) {
|
|
202
|
+
super(props);
|
|
203
|
+
let schedule;
|
|
204
|
+
if (this.props.schedule && typeof this.props.schedule === 'string' && this.props.schedule[0] === '{') {
|
|
205
|
+
try {
|
|
206
|
+
schedule = JSON.parse(this.props.schedule);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// ignore
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else if (typeof this.props.schedule === 'object') {
|
|
213
|
+
schedule = this.props.schedule;
|
|
214
|
+
}
|
|
215
|
+
if (!schedule || !Object.keys(schedule).length) {
|
|
216
|
+
setTimeout(() => this.onChange(this.state.schedule, true), 200);
|
|
217
|
+
schedule = DEFAULT;
|
|
218
|
+
}
|
|
219
|
+
schedule = { ...DEFAULT, ...schedule };
|
|
220
|
+
schedule.valid.from ||= Schedule.now2string();
|
|
221
|
+
this.refFrom = React.createRef();
|
|
222
|
+
this.refTo = React.createRef();
|
|
223
|
+
this.refOnce = React.createRef();
|
|
224
|
+
this.state = {
|
|
225
|
+
schedule,
|
|
226
|
+
desc: Schedule.state2text(schedule),
|
|
227
|
+
};
|
|
228
|
+
if (JSON.stringify(schedule) !== this.props.schedule) {
|
|
229
|
+
setTimeout(() => this.props.onChange?.(JSON.stringify(schedule)), 100);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
onChange(schedule, force) {
|
|
233
|
+
const isDiff = JSON.stringify(schedule) !== JSON.stringify(this.state.schedule);
|
|
234
|
+
if (force || isDiff) {
|
|
235
|
+
if (isDiff) {
|
|
236
|
+
this.setState({ schedule, desc: Schedule.state2text(schedule) });
|
|
237
|
+
}
|
|
238
|
+
const copy = JSON.parse(JSON.stringify(schedule));
|
|
239
|
+
if (copy.period.once) {
|
|
240
|
+
const once = copy.period.once;
|
|
241
|
+
delete copy.period;
|
|
242
|
+
copy.period = { once };
|
|
243
|
+
delete copy.valid;
|
|
244
|
+
}
|
|
245
|
+
else if (copy.period.days) {
|
|
246
|
+
const days = copy.period.days;
|
|
247
|
+
const daysOfWeek = copy.period.dows;
|
|
248
|
+
delete copy.period;
|
|
249
|
+
copy.period = { days };
|
|
250
|
+
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
251
|
+
copy.period.dows = daysOfWeek;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else if (copy.period.weeks) {
|
|
255
|
+
const weeks = copy.period.weeks;
|
|
256
|
+
const daysOfWeek = copy.period.dows;
|
|
257
|
+
delete copy.period;
|
|
258
|
+
copy.period = { weeks };
|
|
259
|
+
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
260
|
+
copy.period.dows = daysOfWeek;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (copy.period.months) {
|
|
264
|
+
const months = copy.period.months;
|
|
265
|
+
const dates = copy.period.dates;
|
|
266
|
+
delete copy.period;
|
|
267
|
+
copy.period = { months };
|
|
268
|
+
if (dates && dates !== '[]') {
|
|
269
|
+
copy.period.dates = dates;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else if (copy.period.years) {
|
|
273
|
+
const years = copy.period.years;
|
|
274
|
+
const yearMonth = copy.period.yearMonth;
|
|
275
|
+
const yearDate = copy.period.yearDate;
|
|
276
|
+
delete copy.period;
|
|
277
|
+
copy.period = { years, yearDate };
|
|
278
|
+
if (yearMonth) {
|
|
279
|
+
copy.period.yearMonth = yearMonth;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (copy.time.exactTime) {
|
|
283
|
+
delete copy.time.end;
|
|
284
|
+
delete copy.time.mode;
|
|
285
|
+
delete copy.time.interval;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
delete copy.time.exactTime;
|
|
289
|
+
}
|
|
290
|
+
if (copy.valid) {
|
|
291
|
+
if (!copy.valid.to) {
|
|
292
|
+
delete copy.valid.to;
|
|
293
|
+
}
|
|
294
|
+
if (copy.period.days === 1 ||
|
|
295
|
+
copy.period.weeks === 1 ||
|
|
296
|
+
copy.period.months === 1 ||
|
|
297
|
+
copy.period.years === 1) {
|
|
298
|
+
const from = Schedule.string2date(copy.valid.from);
|
|
299
|
+
const today = new Date();
|
|
300
|
+
today.setHours(0);
|
|
301
|
+
today.setMinutes(0);
|
|
302
|
+
today.setSeconds(0);
|
|
303
|
+
today.setMilliseconds(0);
|
|
304
|
+
if (from <= today) {
|
|
305
|
+
delete copy.valid.from;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (!copy.valid.from && !copy.valid.to) {
|
|
309
|
+
delete copy.valid;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
this.props.onChange?.(JSON.stringify(copy), Schedule.state2text(schedule));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
static state2text(schedule) {
|
|
316
|
+
if (typeof schedule === 'string') {
|
|
317
|
+
try {
|
|
318
|
+
schedule = JSON.parse(schedule);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return '';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const desc = [];
|
|
325
|
+
const validFrom = Schedule.string2date(schedule.valid.from);
|
|
326
|
+
if (schedule.period.once) {
|
|
327
|
+
// once
|
|
328
|
+
const once = Schedule.string2date(schedule.period.once);
|
|
329
|
+
const now = new Date();
|
|
330
|
+
now.setMilliseconds(0);
|
|
331
|
+
now.setSeconds(0);
|
|
332
|
+
now.setMinutes(0);
|
|
333
|
+
now.setHours(0);
|
|
334
|
+
//
|
|
335
|
+
if (once < now) {
|
|
336
|
+
// will be not executed anymore, because start is in the past
|
|
337
|
+
return I18n.t('sch_desc_onceInPast');
|
|
338
|
+
}
|
|
339
|
+
// only once
|
|
340
|
+
desc.push(I18n.t('sch_desc_once_on', schedule.period.once));
|
|
341
|
+
}
|
|
342
|
+
else if (schedule.period.days) {
|
|
343
|
+
if (schedule.period.days === 1) {
|
|
344
|
+
if (schedule.period.dows) {
|
|
345
|
+
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
346
|
+
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
347
|
+
// on weekends
|
|
348
|
+
desc.push(I18n.t('sch_desc_onWeekends'));
|
|
349
|
+
}
|
|
350
|
+
else if (daysOfWeek.length === 5 &&
|
|
351
|
+
daysOfWeek[0] === 1 &&
|
|
352
|
+
daysOfWeek[1] === 2 &&
|
|
353
|
+
daysOfWeek[2] === 3 &&
|
|
354
|
+
daysOfWeek[3] === 4 &&
|
|
355
|
+
daysOfWeek[4] === 5) {
|
|
356
|
+
// on workdays
|
|
357
|
+
desc.push(I18n.t('sch_desc_onWorkdays'));
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
const tDows = daysOfWeek.map((day) => I18n.t(WEEKDAYS[day]));
|
|
361
|
+
if (tDows.length === 1) {
|
|
362
|
+
// on Monday
|
|
363
|
+
desc.push(I18n.t('sch_desc_onWeekday', tDows[0]));
|
|
364
|
+
}
|
|
365
|
+
else if (tDows.length === 7) {
|
|
366
|
+
// on every day
|
|
367
|
+
desc.push(I18n.t('sch_desc_everyDay'));
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
const last = tDows.pop();
|
|
371
|
+
// on Monday and Sunday
|
|
372
|
+
desc.push(I18n.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
desc.push(I18n.t('sch_desc_everyDay'));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
desc.push(I18n.t('sch_desc_everyNDay', schedule.period.days.toString()));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else if (schedule.period.weeks) {
|
|
385
|
+
if (schedule.period.weeks === 1) {
|
|
386
|
+
desc.push(I18n.t('sch_desc_everyWeek'));
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
desc.push(I18n.t('sch_desc_everyNWeeks', schedule.period.weeks.toString()));
|
|
390
|
+
}
|
|
391
|
+
if (schedule.period.dows) {
|
|
392
|
+
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
393
|
+
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
394
|
+
// on weekends
|
|
395
|
+
desc.push(I18n.t('sch_desc_onWeekends'));
|
|
396
|
+
}
|
|
397
|
+
else if (daysOfWeek.length === 5 &&
|
|
398
|
+
daysOfWeek[0] === 1 &&
|
|
399
|
+
daysOfWeek[1] === 2 &&
|
|
400
|
+
daysOfWeek[2] === 3 &&
|
|
401
|
+
daysOfWeek[3] === 4 &&
|
|
402
|
+
daysOfWeek[4] === 5) {
|
|
403
|
+
// on workdays
|
|
404
|
+
desc.push(I18n.t('sch_desc_onWorkdays'));
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
const tDows = daysOfWeek.map((day) => I18n.t(WEEKDAYS[day]));
|
|
408
|
+
if (tDows.length === 1) {
|
|
409
|
+
// on Monday
|
|
410
|
+
desc.push(I18n.t('sch_desc_onWeekday', tDows[0]));
|
|
411
|
+
}
|
|
412
|
+
else if (tDows.length === 7) {
|
|
413
|
+
// on every day
|
|
414
|
+
desc.push(I18n.t('sch_desc_everyDay'));
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
const last = tDows.pop();
|
|
418
|
+
// on Monday and Sunday
|
|
419
|
+
desc.push(I18n.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
return I18n.t('sch_desc_never');
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else if (schedule.period.months) {
|
|
428
|
+
if (schedule.period.dates) {
|
|
429
|
+
const dates = JSON.parse(schedule.period.dates);
|
|
430
|
+
if (dates.length === 1) {
|
|
431
|
+
// in 1 of month
|
|
432
|
+
desc.push(I18n.t('sch_desc_onDate', dates[0]));
|
|
433
|
+
}
|
|
434
|
+
else if (dates.length === 31) {
|
|
435
|
+
desc.push(I18n.t('sch_desc_onEveryDate'));
|
|
436
|
+
}
|
|
437
|
+
else if (!dates.length) {
|
|
438
|
+
return I18n.t('sch_desc_never');
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
const last = dates.pop();
|
|
442
|
+
// in 1 and 4 of month
|
|
443
|
+
desc.push(I18n.t('sch_desc_onDates', dates.join(', '), last));
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
desc.push(I18n.t('sch_desc_onEveryDate'));
|
|
448
|
+
}
|
|
449
|
+
if (schedule.period.months === 1) {
|
|
450
|
+
desc.push(I18n.t('sch_desc_everyMonth'));
|
|
451
|
+
}
|
|
452
|
+
else if (typeof schedule.period.months === 'number') {
|
|
453
|
+
desc.push(I18n.t('sch_desc_everyNMonths', schedule.period.months.toString()));
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
const months = JSON.parse(schedule.period.months);
|
|
457
|
+
const tMonths = months.map((month) => I18n.t(MONTHS[month - 1]));
|
|
458
|
+
if (!tMonths.length) {
|
|
459
|
+
// in January
|
|
460
|
+
return I18n.t('sch_desc_never');
|
|
461
|
+
}
|
|
462
|
+
if (tMonths.length === 1) {
|
|
463
|
+
// in January
|
|
464
|
+
desc.push(I18n.t('sch_desc_onMonth', tMonths[0]));
|
|
465
|
+
}
|
|
466
|
+
else if (tMonths.length === 12) {
|
|
467
|
+
// every month
|
|
468
|
+
desc.push(I18n.t('sch_desc_everyMonth'));
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
const last = tMonths.pop();
|
|
472
|
+
// in January and May
|
|
473
|
+
desc.push(I18n.t('sch_desc_onMonths', tMonths.join(', '), last));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
else if (schedule.period.years) {
|
|
478
|
+
if (schedule.period.years === 1) {
|
|
479
|
+
desc.push(I18n.t('sch_desc_everyYear'));
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
desc.push(I18n.t('sch_desc_everyNYears', schedule.period.years.toString()));
|
|
483
|
+
}
|
|
484
|
+
desc.push(I18n.t('sch_desc_onDate', schedule.period.yearDate.toString(), schedule.period.yearMonth
|
|
485
|
+
? I18n.t(MONTHS[schedule.period.yearMonth - 1])
|
|
486
|
+
: I18n.t('sch_desc_everyMonth')));
|
|
487
|
+
}
|
|
488
|
+
// time
|
|
489
|
+
if (schedule.time.exactTime) {
|
|
490
|
+
if (ASTRO.includes(schedule.time.start)) {
|
|
491
|
+
// at sunset
|
|
492
|
+
desc.push(I18n.t('sch_desc_atTime', I18n.t(`sch_astro_${schedule.time.start}`)));
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
// at HH:MM
|
|
496
|
+
desc.push(I18n.t('sch_desc_atTime', schedule.time.start));
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
if (schedule.time.mode === PERIODS.minutes) {
|
|
501
|
+
if (schedule.time.interval === 1) {
|
|
502
|
+
// every minute
|
|
503
|
+
desc.push(I18n.t('sch_desc_everyMinute'));
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
// every N minute
|
|
507
|
+
desc.push(I18n.t('sch_desc_everyNMinutes', schedule.time.interval.toString()));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else if (schedule.time.interval === 1) {
|
|
511
|
+
// every minute
|
|
512
|
+
desc.push(I18n.t('sch_desc_everyHour'));
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
// every N minute
|
|
516
|
+
desc.push(I18n.t('sch_desc_everyNHours', schedule.time.interval.toString()));
|
|
517
|
+
}
|
|
518
|
+
const start = ASTRO.indexOf(schedule.time.start) !== -1
|
|
519
|
+
? I18n.t(`sch_astro_${schedule.time.start}`)
|
|
520
|
+
: schedule.time.start;
|
|
521
|
+
const end = ASTRO.indexOf(schedule.time.end) !== -1 ? I18n.t(`sch_astro_${schedule.time.end}`) : schedule.time.end;
|
|
522
|
+
if (start !== '00:00' || (end !== '24:00' && end !== '23:59')) {
|
|
523
|
+
// from HH:mm to HH:mm
|
|
524
|
+
desc.push(I18n.t('sch_desc_intervalFromTo', start, end));
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (!schedule.period.once) {
|
|
528
|
+
// valid
|
|
529
|
+
if (validFrom.getTime() > Date.now() && schedule.valid.to) {
|
|
530
|
+
// from XXX to XXXX
|
|
531
|
+
desc.push(I18n.t('sch_desc_validFromTo', schedule.valid.from, schedule.valid.to));
|
|
532
|
+
}
|
|
533
|
+
else if (validFrom.getTime() > Date.now()) {
|
|
534
|
+
// from XXXX
|
|
535
|
+
desc.push(I18n.t('sch_desc_validFrom', schedule.valid.from));
|
|
536
|
+
}
|
|
537
|
+
else if (schedule.valid.to) {
|
|
538
|
+
// till XXXX
|
|
539
|
+
desc.push(I18n.t('sch_desc_validTo', schedule.valid.to));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return desc.join(' ');
|
|
543
|
+
}
|
|
544
|
+
getTimePeriodElements() {
|
|
545
|
+
const schedule = this.state.schedule;
|
|
546
|
+
let wholeDay = false;
|
|
547
|
+
let day = false;
|
|
548
|
+
let night = false;
|
|
549
|
+
let fromTo = true;
|
|
550
|
+
if (schedule.time.start === '00:00' && schedule.time.end === '24:00') {
|
|
551
|
+
wholeDay = true;
|
|
552
|
+
fromTo = false;
|
|
553
|
+
}
|
|
554
|
+
else if (schedule.time.start === 'sunrise') {
|
|
555
|
+
day = true;
|
|
556
|
+
fromTo = false;
|
|
557
|
+
}
|
|
558
|
+
else if (schedule.time.start === 'sunset') {
|
|
559
|
+
night = true;
|
|
560
|
+
fromTo = false;
|
|
561
|
+
}
|
|
562
|
+
return (React.createElement("div", { key: "timePeriod", style: styles.rowDiv },
|
|
563
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
564
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !schedule.time.exactTime, onClick: () => {
|
|
565
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
566
|
+
_schedule.time.exactTime = false;
|
|
567
|
+
this.onChange(_schedule);
|
|
568
|
+
} }), label: I18n.t('sch_intervalTime') })),
|
|
569
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
570
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
571
|
+
!schedule.time.exactTime && (React.createElement("div", null,
|
|
572
|
+
React.createElement("div", null,
|
|
573
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!fromTo, onClick: () => {
|
|
574
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
575
|
+
_schedule.time.start = '00:00';
|
|
576
|
+
_schedule.time.end = '23:59';
|
|
577
|
+
this.onChange(_schedule);
|
|
578
|
+
} }), label: !fromTo ? I18n.t('sch_fromTo') : '' }),
|
|
579
|
+
fromTo && [
|
|
580
|
+
React.createElement(TextField, { variant: "standard", style: { ...styles.inputTime, marginRight: 10 }, key: "exactTimeFrom", type: "time", sx: (theme) => ({
|
|
581
|
+
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
582
|
+
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
583
|
+
},
|
|
584
|
+
}), value: this.state.schedule.time.start,
|
|
585
|
+
// InputProps={{inputComponent: TextTime}}
|
|
586
|
+
onChange: e => {
|
|
587
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
588
|
+
_schedule.time.start = e.target.value;
|
|
589
|
+
this.onChange(_schedule);
|
|
590
|
+
}, slotProps: {
|
|
591
|
+
inputLabel: { shrink: true },
|
|
592
|
+
}, label: I18n.t('sch_from'), margin: "normal" }),
|
|
593
|
+
React.createElement(TextField, { variant: "standard", style: styles.inputTime, key: "exactTimeTo", type: "time", sx: (theme) => ({
|
|
594
|
+
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
595
|
+
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
596
|
+
},
|
|
597
|
+
}), value: this.state.schedule.time.end,
|
|
598
|
+
// InputProps={{inputComponent: TextTime}}
|
|
599
|
+
onChange: e => {
|
|
600
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
601
|
+
_schedule.time.end = e.target.value;
|
|
602
|
+
this.onChange(_schedule);
|
|
603
|
+
}, slotProps: {
|
|
604
|
+
inputLabel: { shrink: true },
|
|
605
|
+
}, label: I18n.t('sch_to'), margin: "normal" }),
|
|
606
|
+
]))),
|
|
607
|
+
!schedule.time.exactTime && (React.createElement("div", null,
|
|
608
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!wholeDay, onClick: () => {
|
|
609
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
610
|
+
_schedule.time.start = '00:00';
|
|
611
|
+
_schedule.time.end = '24:00';
|
|
612
|
+
this.onChange(_schedule);
|
|
613
|
+
} }), label: I18n.t('sch_wholeDay') }))),
|
|
614
|
+
!schedule.time.exactTime && (React.createElement("div", null,
|
|
615
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!day, onClick: () => {
|
|
616
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
617
|
+
_schedule.time.start = 'sunrise';
|
|
618
|
+
_schedule.time.end = 'sunset';
|
|
619
|
+
this.onChange(_schedule);
|
|
620
|
+
} }), label: I18n.t('sch_astroDay') }))),
|
|
621
|
+
!schedule.time.exactTime && (React.createElement("div", null,
|
|
622
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!night, onClick: () => {
|
|
623
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
624
|
+
_schedule.time.start = 'sunset';
|
|
625
|
+
_schedule.time.end = 'sunrise';
|
|
626
|
+
this.onChange(_schedule);
|
|
627
|
+
} }), label: I18n.t('sch_astroNight') })))),
|
|
628
|
+
!schedule.time.exactTime && this.getPeriodSettingsMinutes(fromTo))));
|
|
629
|
+
}
|
|
630
|
+
getTimeExactElements() {
|
|
631
|
+
const isAstro = ASTRO.includes(this.state.schedule.time.start);
|
|
632
|
+
return (React.createElement("div", { key: "timeExact", style: styles.rowDiv },
|
|
633
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
634
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!this.state.schedule.time.exactTime, onClick: () => {
|
|
635
|
+
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
636
|
+
schedule.time.exactTime = true;
|
|
637
|
+
this.onChange(schedule);
|
|
638
|
+
} }), label: I18n.t('sch_exactTime') })),
|
|
639
|
+
this.state.schedule.time.exactTime && (React.createElement(Select, { variant: "standard", value: isAstro ? this.state.schedule.time.start : '00:00', onChange: e => {
|
|
640
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
641
|
+
_schedule.time.start = e.target.value;
|
|
642
|
+
this.onChange(_schedule);
|
|
643
|
+
} },
|
|
644
|
+
React.createElement(MenuItem, { key: "specific", value: "00:00" }, I18n.t('sch_specificTime')),
|
|
645
|
+
ASTRO.map(event => (React.createElement(MenuItem, { key: event, value: event }, I18n.t(`sch_astro_${event}`)))))),
|
|
646
|
+
this.state.schedule.time.exactTime && !isAstro && (React.createElement("div", { style: styles.settingsDiv },
|
|
647
|
+
React.createElement(TextField, { variant: "standard", style: styles.inputTime, key: "exactTimeValue", value: this.state.schedule.time.start, type: "time", sx: (theme) => ({
|
|
648
|
+
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
649
|
+
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
650
|
+
},
|
|
651
|
+
}), onChange: e => {
|
|
652
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
653
|
+
_schedule.time.start = e.target.value;
|
|
654
|
+
this.onChange(_schedule);
|
|
655
|
+
}, slotProps: {
|
|
656
|
+
inputLabel: { shrink: true },
|
|
657
|
+
}, margin: "normal" })))));
|
|
658
|
+
}
|
|
659
|
+
static getDivider() {
|
|
660
|
+
return React.createElement("hr", { style: styles.hr });
|
|
661
|
+
}
|
|
662
|
+
getPeriodModes() {
|
|
663
|
+
const schedule = this.state.schedule;
|
|
664
|
+
const isOnce = !schedule.period.dows &&
|
|
665
|
+
!schedule.period.months &&
|
|
666
|
+
!schedule.period.dates &&
|
|
667
|
+
!schedule.period.years &&
|
|
668
|
+
!schedule.period.days &&
|
|
669
|
+
!schedule.period.weeks;
|
|
670
|
+
if (isOnce && !schedule.period.once) {
|
|
671
|
+
schedule.period.once = Schedule.now2string(true);
|
|
672
|
+
}
|
|
673
|
+
return [
|
|
674
|
+
// ----- once ---
|
|
675
|
+
React.createElement("div", { key: "once", style: { ...styles.rowDiv, ...styles.rowOnce } },
|
|
676
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
677
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!isOnce, onClick: () => {
|
|
678
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
679
|
+
_schedule.period.once ||= Schedule.now2string(true);
|
|
680
|
+
_schedule.period.dows = '';
|
|
681
|
+
_schedule.period.months = '';
|
|
682
|
+
_schedule.period.dates = '';
|
|
683
|
+
_schedule.period.years = 0;
|
|
684
|
+
_schedule.period.yearDate = 0;
|
|
685
|
+
_schedule.period.yearMonth = 0;
|
|
686
|
+
_schedule.period.weeks = 0;
|
|
687
|
+
_schedule.period.days = 0;
|
|
688
|
+
this.onChange(_schedule);
|
|
689
|
+
} }), label: I18n.t('sch_periodOnce') })),
|
|
690
|
+
isOnce && (React.createElement("div", { style: styles.settingsDiv },
|
|
691
|
+
React.createElement(TextField, { variant: "standard", style: styles.inputDate, type: "date", ref: this.refOnce, key: "exactDateAt", defaultValue: string2USdate(schedule.period.once),
|
|
692
|
+
// InputProps={{inputComponent: TextTime}}
|
|
693
|
+
onChange: e => {
|
|
694
|
+
this.timerOnce && clearTimeout(this.timerOnce);
|
|
695
|
+
this.timerOnce = null;
|
|
696
|
+
if (this.refOnce.current) {
|
|
697
|
+
this.refOnce.current.style.background = '#ff000030';
|
|
698
|
+
}
|
|
699
|
+
this.timerOnce = setTimeout(value => {
|
|
700
|
+
this.timerOnce = null;
|
|
701
|
+
if (this.refOnce.current) {
|
|
702
|
+
this.refOnce.current.style.background = '';
|
|
703
|
+
}
|
|
704
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
705
|
+
const date = Schedule.string2date(value);
|
|
706
|
+
if (date.toString() !== 'Invalid Date') {
|
|
707
|
+
_schedule.period.once = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
708
|
+
this.onChange(_schedule);
|
|
709
|
+
}
|
|
710
|
+
}, 1500, e.target.value);
|
|
711
|
+
}, slotProps: {
|
|
712
|
+
inputLabel: { shrink: true },
|
|
713
|
+
}, label: I18n.t('sch_at'), margin: "normal" })))),
|
|
714
|
+
// ----- days ---
|
|
715
|
+
React.createElement(Box, { component: "div", key: "days", sx: Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowDays) },
|
|
716
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
717
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!schedule.period.days, onClick: () => {
|
|
718
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
719
|
+
_schedule.period.days = 1;
|
|
720
|
+
_schedule.period.dows = '';
|
|
721
|
+
_schedule.period.months = '';
|
|
722
|
+
_schedule.period.dates = '';
|
|
723
|
+
_schedule.period.years = 0;
|
|
724
|
+
_schedule.period.yearDate = 0;
|
|
725
|
+
_schedule.period.yearMonth = 0;
|
|
726
|
+
_schedule.period.weeks = 0;
|
|
727
|
+
_schedule.period.once = '';
|
|
728
|
+
this.onChange(_schedule);
|
|
729
|
+
} }), label: I18n.t('sch_periodDaily') })),
|
|
730
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
731
|
+
this.getPeriodSettingsDaily(),
|
|
732
|
+
schedule.period.days ? this.getPeriodSettingsWeekdays() : null)),
|
|
733
|
+
// ----- days of weeks ---
|
|
734
|
+
/*
|
|
735
|
+
!schedule.period.days && (
|
|
736
|
+
<div key="dows" style={styles.rowDiv + ' ' + styles.rowDows}>
|
|
737
|
+
<div style={styles.modeDiv}>
|
|
738
|
+
<FormControlLabel control={<Radio style={styles.inputRadio} checked={!!schedule.period.dows} onClick={() => {
|
|
739
|
+
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
740
|
+
schedule.period.dows = schedule.period.dows ? '' : '[0,1,2,3,4,5,6]';
|
|
741
|
+
this.onChange(schedule);
|
|
742
|
+
}}/>}
|
|
743
|
+
label={I18n.t('sch_periodWeekdays')} />
|
|
744
|
+
</div>
|
|
745
|
+
<div style={styles.settingsDiv}>
|
|
746
|
+
{this.getPeriodSettingsWeekdays()}
|
|
747
|
+
</div>
|
|
748
|
+
</div>,
|
|
749
|
+
*/
|
|
750
|
+
// ----- weeks ---
|
|
751
|
+
React.createElement(Box, { component: "div", key: "weeks", sx: Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowDows) },
|
|
752
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
753
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!schedule.period.weeks, onClick: () => {
|
|
754
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
755
|
+
_schedule.period.weeks = schedule.period.weeks ? 0 : 1;
|
|
756
|
+
_schedule.period.dows ||= '[0]';
|
|
757
|
+
_schedule.period.months = '';
|
|
758
|
+
_schedule.period.dates = '';
|
|
759
|
+
_schedule.period.years = 0;
|
|
760
|
+
_schedule.period.yearDate = 0;
|
|
761
|
+
_schedule.period.yearMonth = 0;
|
|
762
|
+
_schedule.period.days = 0;
|
|
763
|
+
_schedule.period.once = '';
|
|
764
|
+
this.onChange(_schedule);
|
|
765
|
+
} }), label: I18n.t('sch_periodWeekly') })),
|
|
766
|
+
React.createElement(Box, { component: "div", style: styles.settingsDiv },
|
|
767
|
+
React.createElement("div", { style: styles.settingsDiv }, this.getPeriodSettingsWeekly()),
|
|
768
|
+
React.createElement(Box, { component: "div", sx: Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowDowsDows) }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
|
|
769
|
+
// ----- months ---
|
|
770
|
+
React.createElement(Box, { component: "div", key: "months", sx: Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowMonths) },
|
|
771
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
772
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!schedule.period.months, onClick: () => {
|
|
773
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
774
|
+
_schedule.period.months = 1;
|
|
775
|
+
_schedule.period.dows = '';
|
|
776
|
+
_schedule.period.dates = '';
|
|
777
|
+
_schedule.period.years = 0;
|
|
778
|
+
_schedule.period.yearDate = 0;
|
|
779
|
+
_schedule.period.yearMonth = 0;
|
|
780
|
+
_schedule.period.weeks = 0;
|
|
781
|
+
_schedule.period.days = 0;
|
|
782
|
+
_schedule.period.once = '';
|
|
783
|
+
this.onChange(_schedule);
|
|
784
|
+
} }), label: I18n.t('sch_periodMonthly') })),
|
|
785
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
786
|
+
this.getPeriodSettingsMonthly(),
|
|
787
|
+
schedule.period.months ? (React.createElement(Box, null,
|
|
788
|
+
React.createElement(Box, { component: "div", sx: Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) },
|
|
789
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { style: styles.inputRadio, checked: !!schedule.period.dates, onClick: () => {
|
|
790
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
791
|
+
_schedule.period.months ||= 1;
|
|
792
|
+
const dates = [];
|
|
793
|
+
for (let i = 1; i <= 31; i++) {
|
|
794
|
+
dates.push(i);
|
|
795
|
+
}
|
|
796
|
+
_schedule.period.dates ||= JSON.stringify(dates);
|
|
797
|
+
_schedule.period.dows = '';
|
|
798
|
+
_schedule.period.years = 0;
|
|
799
|
+
_schedule.period.yearDate = 0;
|
|
800
|
+
_schedule.period.yearMonth = 0;
|
|
801
|
+
_schedule.period.weeks = 0;
|
|
802
|
+
_schedule.period.days = 0;
|
|
803
|
+
_schedule.period.once = '';
|
|
804
|
+
this.onChange(_schedule);
|
|
805
|
+
} }), label: I18n.t('sch_periodDates') })),
|
|
806
|
+
React.createElement(Box, { component: "div", sx: Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) }, this.getPeriodSettingsDates()))) : null)),
|
|
807
|
+
// ----- years ---
|
|
808
|
+
React.createElement(Box, { component: "div", key: "years", sx: Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowYears) },
|
|
809
|
+
React.createElement("div", { style: styles.modeDiv },
|
|
810
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: !!schedule.period.years, onClick: () => {
|
|
811
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
812
|
+
_schedule.period.years = 1;
|
|
813
|
+
_schedule.period.yearDate = 1;
|
|
814
|
+
_schedule.period.yearMonth = 1;
|
|
815
|
+
_schedule.period.dows = '';
|
|
816
|
+
_schedule.period.months = 0;
|
|
817
|
+
_schedule.period.dates = '';
|
|
818
|
+
_schedule.period.weeks = 0;
|
|
819
|
+
_schedule.period.days = 0;
|
|
820
|
+
_schedule.period.once = '';
|
|
821
|
+
this.onChange(_schedule);
|
|
822
|
+
} }), label: I18n.t('sch_periodYearly') })),
|
|
823
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
824
|
+
React.createElement("div", { style: styles.settingsDiv }, this.getPeriodSettingsYearly()),
|
|
825
|
+
!!schedule.period.years && (React.createElement("div", { style: styles.settingsDiv },
|
|
826
|
+
React.createElement("span", null, I18n.t('sch_on')),
|
|
827
|
+
React.createElement(Input, { key: "input", value: this.state.schedule.period.yearDate, style: styles.inputEvery, type: "number", inputProps: { min: 1, max: 31 }, onChange: e => {
|
|
828
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
829
|
+
_schedule.period.yearDate = parseInt(e.target.value, 10);
|
|
830
|
+
if (_schedule.period.yearDate < 1) {
|
|
831
|
+
_schedule.period.yearDate = 31;
|
|
832
|
+
}
|
|
833
|
+
if (_schedule.period.yearDate > 31) {
|
|
834
|
+
_schedule.period.yearDate = 1;
|
|
835
|
+
}
|
|
836
|
+
this.onChange(_schedule);
|
|
837
|
+
} }),
|
|
838
|
+
React.createElement(Select, { variant: "standard", value: schedule.period.yearMonth, onChange: e => {
|
|
839
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
840
|
+
_schedule.period.yearMonth = e.target.value;
|
|
841
|
+
this.onChange(_schedule);
|
|
842
|
+
} },
|
|
843
|
+
React.createElement(MenuItem, { key: "every", value: 0 }, I18n.t('sch_yearEveryMonth')),
|
|
844
|
+
MONTHS.map((month, i) => (React.createElement(MenuItem, { key: month, value: i + 1 }, I18n.t(month))))))))),
|
|
845
|
+
];
|
|
846
|
+
}
|
|
847
|
+
getPeriodSettingsMinutes(fromTo) {
|
|
848
|
+
return (React.createElement("div", { style: { display: 'inline-block', marginTop: fromTo ? 15 : 'inherit' } },
|
|
849
|
+
React.createElement("label", { style: { marginLeft: 4, marginRight: 4 } }, I18n.t('sch_every')),
|
|
850
|
+
React.createElement(Input, { value: this.state.schedule.time.interval, style: {
|
|
851
|
+
...styles.inputEvery,
|
|
852
|
+
verticalAlign: 'bottom',
|
|
853
|
+
}, type: "number", inputProps: { min: 1 }, onChange: e => {
|
|
854
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
855
|
+
_schedule.time.interval = parseInt(e.target.value, 10);
|
|
856
|
+
this.onChange(_schedule);
|
|
857
|
+
} }),
|
|
858
|
+
React.createElement(Select, { variant: "standard", value: this.state.schedule.time.mode, onChange: e => {
|
|
859
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
860
|
+
_schedule.time.mode = e.target.value;
|
|
861
|
+
this.onChange(_schedule);
|
|
862
|
+
} },
|
|
863
|
+
React.createElement(MenuItem, { value: PERIODS.minutes }, I18n.t('sch_periodMinutes')),
|
|
864
|
+
React.createElement(MenuItem, { value: PERIODS.hours }, I18n.t('sch_periodHours')))));
|
|
865
|
+
}
|
|
866
|
+
getPeriodSettingsWeekdays() {
|
|
867
|
+
// || this.state.schedule.period.dows === '[1, 2, 3, 4, 5]' || this.state.schedule.period.dows === '[0, 6]'
|
|
868
|
+
const schedule = this.state.schedule;
|
|
869
|
+
const isSpecific = schedule.period.dows && schedule.period.dows !== '[1, 2, 3, 4, 5]' && schedule.period.dows !== '[0, 6]';
|
|
870
|
+
return [
|
|
871
|
+
React.createElement("div", { key: "workdays" },
|
|
872
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.dows === '[1, 2, 3, 4, 5]', onClick: () => {
|
|
873
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
874
|
+
_schedule.period.dows = '[1, 2, 3, 4, 5]';
|
|
875
|
+
if (_schedule.period.days) {
|
|
876
|
+
_schedule.period.days = 1;
|
|
877
|
+
}
|
|
878
|
+
this.onChange(_schedule);
|
|
879
|
+
} }), label: I18n.t('sch_periodWorkdays') })),
|
|
880
|
+
React.createElement("div", { key: "weekend" },
|
|
881
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.dows === '[0, 6]', onClick: () => {
|
|
882
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
883
|
+
_schedule.period.dows = '[0, 6]';
|
|
884
|
+
if (_schedule.period.days) {
|
|
885
|
+
_schedule.period.days = 1;
|
|
886
|
+
}
|
|
887
|
+
this.onChange(_schedule);
|
|
888
|
+
} }), label: I18n.t('sch_periodWeekend') })),
|
|
889
|
+
React.createElement("div", { key: "specific", style: { verticalAlign: 'top' } },
|
|
890
|
+
React.createElement(FormControlLabel, { style: { verticalAlign: 'top' }, control: React.createElement(Radio, { style: styles.inputRadio, checked: !!isSpecific, onClick: () => {
|
|
891
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
892
|
+
_schedule.period.dows = '[0, 1, 2, 3, 4, 5, 6]';
|
|
893
|
+
if (_schedule.period.days) {
|
|
894
|
+
_schedule.period.days = 1;
|
|
895
|
+
}
|
|
896
|
+
this.onChange(_schedule);
|
|
897
|
+
} }), label: I18n.t('sch_periodWeekdays') }),
|
|
898
|
+
isSpecific && (schedule.period.days === 1 || schedule.period.weeks) && (React.createElement(FormGroup, { row: true, style: { ...styles.inputGroup, width: 150 } }, [1, 2, 3, 4, 5, 6, 0].map(i => (React.createElement(FormControlLabel, { key: `specific_${i}`, style: styles.inputGroupElement, control: React.createElement(Checkbox, { style: styles.inputSmallCheck, checked: schedule.period.dows.includes(i.toString()), onChange: e => {
|
|
899
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
900
|
+
let daysOfWeek;
|
|
901
|
+
try {
|
|
902
|
+
daysOfWeek = JSON.parse(_schedule.period.dows);
|
|
903
|
+
}
|
|
904
|
+
catch {
|
|
905
|
+
daysOfWeek = [];
|
|
906
|
+
}
|
|
907
|
+
if (e.target.checked && !daysOfWeek.includes(i)) {
|
|
908
|
+
daysOfWeek.push(i);
|
|
909
|
+
}
|
|
910
|
+
else if (!e.target.checked && daysOfWeek.includes(i)) {
|
|
911
|
+
daysOfWeek.splice(daysOfWeek.indexOf(i), 1);
|
|
912
|
+
}
|
|
913
|
+
daysOfWeek.sort((a, b) => a - b);
|
|
914
|
+
_schedule.period.dows = JSON.stringify(daysOfWeek);
|
|
915
|
+
if (_schedule.period.days) {
|
|
916
|
+
_schedule.period.days = 1;
|
|
917
|
+
}
|
|
918
|
+
this.onChange(_schedule);
|
|
919
|
+
} }), label: I18n.t(WEEKDAYS[i]) })))))),
|
|
920
|
+
];
|
|
921
|
+
}
|
|
922
|
+
getPeriodSettingsDaily() {
|
|
923
|
+
if (!this.state.schedule.period.days) {
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
const schedule = this.state.schedule;
|
|
927
|
+
return [
|
|
928
|
+
React.createElement("div", { key: "every_day" },
|
|
929
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.days === 1 && !schedule.period.dows, onClick: () => {
|
|
930
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
931
|
+
_schedule.period.days = 1;
|
|
932
|
+
_schedule.period.dows = '';
|
|
933
|
+
this.onChange(_schedule);
|
|
934
|
+
} }), label: I18n.t('sch_periodEveryDay') })),
|
|
935
|
+
React.createElement("div", { key: "everyN_day" },
|
|
936
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.days > 1, onClick: () => {
|
|
937
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
938
|
+
_schedule.period.days = 2;
|
|
939
|
+
_schedule.period.dows = '';
|
|
940
|
+
this.onChange(_schedule);
|
|
941
|
+
} }), label: I18n.t('sch_periodEvery') }),
|
|
942
|
+
schedule.period.days > 1 && [
|
|
943
|
+
React.createElement(Input, { key: "input", value: this.state.schedule.period.days, style: styles.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
944
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
945
|
+
_schedule.period.days = parseInt(e.target.value, 10);
|
|
946
|
+
_schedule.period.dows = '';
|
|
947
|
+
this.onChange(_schedule);
|
|
948
|
+
} }),
|
|
949
|
+
React.createElement("span", { key: "span", style: { paddingRight: 10 } }, I18n.t('sch_periodDay')),
|
|
950
|
+
]),
|
|
951
|
+
];
|
|
952
|
+
}
|
|
953
|
+
getPeriodSettingsWeekly() {
|
|
954
|
+
if (!this.state.schedule.period.weeks) {
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
const schedule = this.state.schedule;
|
|
958
|
+
return [
|
|
959
|
+
React.createElement("div", { key: "radios", style: { display: 'inline-block', verticalAlign: 'top' } },
|
|
960
|
+
React.createElement("div", null,
|
|
961
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.weeks === 1, onClick: () => {
|
|
962
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
963
|
+
_schedule.period.weeks = 1;
|
|
964
|
+
this.onChange(_schedule);
|
|
965
|
+
} }), label: I18n.t('sch_periodEveryWeek') })),
|
|
966
|
+
React.createElement("div", null,
|
|
967
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.weeks > 1, onClick: () => {
|
|
968
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
969
|
+
_schedule.period.weeks = 2;
|
|
970
|
+
this.onChange(_schedule);
|
|
971
|
+
} }), label: I18n.t('sch_periodEvery') }),
|
|
972
|
+
schedule.period.weeks > 1 && [
|
|
973
|
+
React.createElement(Input, { key: "input", value: this.state.schedule.period.weeks, style: styles.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
974
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
975
|
+
_schedule.period.weeks = parseInt(e.target.value, 10);
|
|
976
|
+
this.onChange(_schedule);
|
|
977
|
+
} }),
|
|
978
|
+
React.createElement("span", { key: "text" }, I18n.t('sch_periodWeek')),
|
|
979
|
+
])),
|
|
980
|
+
];
|
|
981
|
+
}
|
|
982
|
+
getPeriodSettingsDates() {
|
|
983
|
+
if (!this.state.schedule.period.dates) {
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
const schedule = this.state.schedule;
|
|
987
|
+
const dates = [];
|
|
988
|
+
for (let i = 1; i <= 31; i++) {
|
|
989
|
+
dates.push(i);
|
|
990
|
+
}
|
|
991
|
+
const parsedDates = JSON.parse(schedule.period.dates);
|
|
992
|
+
return (React.createElement(FormGroup, { row: true, style: { ...styles.inputGroup, maxWidth: 620 } },
|
|
993
|
+
React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: parsedDates.length === 31, onChange: () => {
|
|
994
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
995
|
+
const _dates = [];
|
|
996
|
+
for (let i = 1; i <= 31; i++) {
|
|
997
|
+
_dates.push(i);
|
|
998
|
+
}
|
|
999
|
+
_schedule.period.dates = JSON.stringify(_dates);
|
|
1000
|
+
this.onChange(_schedule);
|
|
1001
|
+
} }), label: I18n.t('sch_all') }),
|
|
1002
|
+
React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: !parsedDates.length, onChange: () => {
|
|
1003
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1004
|
+
_schedule.period.dates = '[]';
|
|
1005
|
+
this.onChange(_schedule);
|
|
1006
|
+
} }), label: I18n.t('sch_no_one') }),
|
|
1007
|
+
parsedDates.length !== 31 && !!parsedDates.length && (React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: false, onChange: () => {
|
|
1008
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1009
|
+
const result = [];
|
|
1010
|
+
const _parsedDates = JSON.parse(_schedule.period.dates);
|
|
1011
|
+
for (let i = 1; i <= 31; i++) {
|
|
1012
|
+
if (!_parsedDates.includes(i)) {
|
|
1013
|
+
result.push(i);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
result.sort((a, b) => a - b);
|
|
1017
|
+
_schedule.period.dates = JSON.stringify(result);
|
|
1018
|
+
this.onChange(_schedule);
|
|
1019
|
+
} }), label: I18n.t('sch_invert') })),
|
|
1020
|
+
React.createElement("div", null),
|
|
1021
|
+
dates.map(i => (React.createElement(FormControlLabel, { key: `date_${i}`, style: !i
|
|
1022
|
+
? {
|
|
1023
|
+
...styles.inputDateDay,
|
|
1024
|
+
opacity: 0,
|
|
1025
|
+
cursor: 'default',
|
|
1026
|
+
userSelect: 'none',
|
|
1027
|
+
pointerEvents: 'none',
|
|
1028
|
+
}
|
|
1029
|
+
: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: JSON.parse(schedule.period.dates).includes(i), onChange: e => {
|
|
1030
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1031
|
+
let _dates;
|
|
1032
|
+
try {
|
|
1033
|
+
_dates = JSON.parse(_schedule.period.dates);
|
|
1034
|
+
}
|
|
1035
|
+
catch {
|
|
1036
|
+
_dates = [];
|
|
1037
|
+
}
|
|
1038
|
+
if (e.target.checked && !_dates.includes(i)) {
|
|
1039
|
+
_dates.push(i);
|
|
1040
|
+
}
|
|
1041
|
+
else if (!e.target.checked && _dates.includes(i)) {
|
|
1042
|
+
_dates.splice(_dates.indexOf(i), 1);
|
|
1043
|
+
}
|
|
1044
|
+
_dates.sort((a, b) => a - b);
|
|
1045
|
+
_schedule.period.dates = JSON.stringify(_dates);
|
|
1046
|
+
this.onChange(_schedule);
|
|
1047
|
+
} }), label: i < 10
|
|
1048
|
+
? [
|
|
1049
|
+
React.createElement("span", { key: "0", style: { opacity: 0 } }, "0"),
|
|
1050
|
+
React.createElement("span", { key: "num" }, i),
|
|
1051
|
+
]
|
|
1052
|
+
: i })))));
|
|
1053
|
+
}
|
|
1054
|
+
getPeriodSettingsMonthly() {
|
|
1055
|
+
if (!this.state.schedule.period.months) {
|
|
1056
|
+
return null;
|
|
1057
|
+
}
|
|
1058
|
+
const schedule = this.state.schedule;
|
|
1059
|
+
const parsedMonths = typeof schedule.period.months === 'string' ? JSON.parse(schedule.period.months) : [];
|
|
1060
|
+
return [
|
|
1061
|
+
React.createElement("div", { key: "every" },
|
|
1062
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: typeof schedule.period.months === 'number' && schedule.period.months === 1, onClick: () => {
|
|
1063
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1064
|
+
_schedule.period.months = 1;
|
|
1065
|
+
this.onChange(schedule);
|
|
1066
|
+
} }), label: I18n.t('sch_periodEveryMonth') })),
|
|
1067
|
+
React.createElement("div", { key: "everyN" },
|
|
1068
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: typeof schedule.period.months === 'number' && schedule.period.months > 1, onClick: () => {
|
|
1069
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1070
|
+
_schedule.period.months = 2;
|
|
1071
|
+
this.onChange(_schedule);
|
|
1072
|
+
} }), label: I18n.t('sch_periodEvery') }),
|
|
1073
|
+
typeof schedule.period.months === 'number' &&
|
|
1074
|
+
schedule.period.months > 1 && [
|
|
1075
|
+
React.createElement(Input, { key: "input", value: schedule.period.months, style: styles.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
1076
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1077
|
+
_schedule.period.months = parseInt(e.target.value, 10);
|
|
1078
|
+
if (_schedule.period.months < 1) {
|
|
1079
|
+
_schedule.period.months = 1;
|
|
1080
|
+
}
|
|
1081
|
+
this.onChange(_schedule);
|
|
1082
|
+
} }),
|
|
1083
|
+
React.createElement("span", { key: "text" }, I18n.t('sch_periodMonth')),
|
|
1084
|
+
]),
|
|
1085
|
+
React.createElement("div", { key: "specific", style: { verticalAlign: 'top' } },
|
|
1086
|
+
React.createElement(FormControlLabel, { style: { verticalAlign: 'top' }, control: React.createElement(Radio, { style: styles.inputRadio, checked: typeof schedule.period.months === 'string', onClick: () => {
|
|
1087
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1088
|
+
_schedule.period.months = '[1,2,3,4,5,6,7,8,9,10,11,12]';
|
|
1089
|
+
this.onChange(_schedule);
|
|
1090
|
+
} }), label: I18n.t('sch_periodSpecificMonths') }),
|
|
1091
|
+
typeof schedule.period.months === 'string' && (React.createElement(FormGroup, { row: true, style: styles.inputGroup },
|
|
1092
|
+
React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: parsedMonths.length === 12, onChange: () => {
|
|
1093
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1094
|
+
const months = [];
|
|
1095
|
+
for (let i = 1; i <= 12; i++) {
|
|
1096
|
+
months.push(i);
|
|
1097
|
+
}
|
|
1098
|
+
_schedule.period.months = JSON.stringify(months);
|
|
1099
|
+
this.onChange(_schedule);
|
|
1100
|
+
} }), label: I18n.t('sch_all') }),
|
|
1101
|
+
React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: !parsedMonths.length, onChange: () => {
|
|
1102
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1103
|
+
_schedule.period.months = '[]';
|
|
1104
|
+
this.onChange(_schedule);
|
|
1105
|
+
} }), label: I18n.t('sch_no_one') }),
|
|
1106
|
+
parsedMonths.length !== 12 && !!parsedMonths.length && (React.createElement(FormControlLabel, { style: styles.inputDateDay, control: React.createElement(Checkbox, { style: styles.inputDateDayCheck, checked: false, onChange: () => {
|
|
1107
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1108
|
+
const result = [];
|
|
1109
|
+
const _parsedMonths = JSON.parse(_schedule.period.months);
|
|
1110
|
+
for (let i = 1; i <= 12; i++) {
|
|
1111
|
+
if (!_parsedMonths.includes(i)) {
|
|
1112
|
+
result.push(i);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
result.sort((a, b) => a - b);
|
|
1116
|
+
_schedule.period.months = JSON.stringify(result);
|
|
1117
|
+
this.onChange(_schedule);
|
|
1118
|
+
} }), label: I18n.t('sch_invert') })),
|
|
1119
|
+
React.createElement("div", null),
|
|
1120
|
+
MONTHS.map((month, i) => (React.createElement(FormControlLabel, { key: `month_${i}`, style: styles.inputGroupElement, control: React.createElement(Checkbox, { style: styles.inputSmallCheck, checked: typeof schedule.period.months === 'string'
|
|
1121
|
+
? JSON.parse(schedule.period.months).includes(i + 1)
|
|
1122
|
+
: schedule.period.months === i, onChange: e => {
|
|
1123
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1124
|
+
let months;
|
|
1125
|
+
try {
|
|
1126
|
+
months = JSON.parse(_schedule.period.months);
|
|
1127
|
+
}
|
|
1128
|
+
catch {
|
|
1129
|
+
months = [];
|
|
1130
|
+
}
|
|
1131
|
+
if (e.target.checked && !months.includes(i + 1)) {
|
|
1132
|
+
months.push(i + 1);
|
|
1133
|
+
}
|
|
1134
|
+
else if (!e.target.checked && months.includes(i + 1)) {
|
|
1135
|
+
months.splice(months.indexOf(i + 1), 1);
|
|
1136
|
+
}
|
|
1137
|
+
months.sort((a, b) => a - b);
|
|
1138
|
+
_schedule.period.months = JSON.stringify(months);
|
|
1139
|
+
this.onChange(_schedule);
|
|
1140
|
+
} }), label: I18n.t(month) })))))),
|
|
1141
|
+
];
|
|
1142
|
+
}
|
|
1143
|
+
getPeriodSettingsYearly() {
|
|
1144
|
+
if (!this.state.schedule.period.years) {
|
|
1145
|
+
return null;
|
|
1146
|
+
}
|
|
1147
|
+
const schedule = this.state.schedule;
|
|
1148
|
+
return [
|
|
1149
|
+
React.createElement("div", { key: "year" },
|
|
1150
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.years === 1, onClick: () => {
|
|
1151
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1152
|
+
_schedule.period.years = 1;
|
|
1153
|
+
this.onChange(_schedule);
|
|
1154
|
+
} }), label: I18n.t('sch_periodEveryYear') })),
|
|
1155
|
+
React.createElement("div", { key: "every" },
|
|
1156
|
+
React.createElement(FormControlLabel, { control: React.createElement(Radio, { style: styles.inputRadio, checked: schedule.period.years > 1, onClick: () => {
|
|
1157
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1158
|
+
_schedule.period.years = 2;
|
|
1159
|
+
this.onChange(_schedule);
|
|
1160
|
+
} }), label: I18n.t('sch_periodEvery') }),
|
|
1161
|
+
schedule.period.years > 1 && [
|
|
1162
|
+
React.createElement(Input, { key: "input", value: this.state.schedule.period.years, style: styles.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
1163
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1164
|
+
_schedule.period.years = parseInt(e.target.value, 10);
|
|
1165
|
+
if (_schedule.period.years < 1) {
|
|
1166
|
+
_schedule.period.years = 1;
|
|
1167
|
+
}
|
|
1168
|
+
this.onChange(_schedule);
|
|
1169
|
+
} }),
|
|
1170
|
+
React.createElement("span", { key: "text" }, I18n.t('sch_periodYear')),
|
|
1171
|
+
]),
|
|
1172
|
+
];
|
|
1173
|
+
}
|
|
1174
|
+
static now2string(isEnd) {
|
|
1175
|
+
const d = new Date();
|
|
1176
|
+
d.setHours(0);
|
|
1177
|
+
d.setMinutes(0);
|
|
1178
|
+
d.setSeconds(0);
|
|
1179
|
+
d.setMilliseconds(0);
|
|
1180
|
+
if (isEnd) {
|
|
1181
|
+
d.setDate(d.getDate() + 2);
|
|
1182
|
+
d.setMilliseconds(d.getMilliseconds() - 1);
|
|
1183
|
+
}
|
|
1184
|
+
return `${padding(d.getDate())}.${padding(d.getMonth() + 1)}.${padding(d.getFullYear())}`;
|
|
1185
|
+
}
|
|
1186
|
+
static string2date(str) {
|
|
1187
|
+
let parts = str.split('.'); // 31.12.2019
|
|
1188
|
+
if (parts.length === 1) {
|
|
1189
|
+
parts = str.split('-'); // 2018-12-31
|
|
1190
|
+
return new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) - 1, parseInt(parts[2], 10));
|
|
1191
|
+
}
|
|
1192
|
+
return new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10));
|
|
1193
|
+
}
|
|
1194
|
+
getValidSettings() {
|
|
1195
|
+
const schedule = this.state.schedule;
|
|
1196
|
+
// ----- from ---
|
|
1197
|
+
return (React.createElement("div", { style: styles.rowDiv },
|
|
1198
|
+
React.createElement("div", { style: { ...styles.modeDiv, verticalAlign: 'middle' } },
|
|
1199
|
+
React.createElement("span", { style: { fontWeight: 'bold', paddingRight: 10 } }, I18n.t('sch_valid')),
|
|
1200
|
+
React.createElement("span", null, I18n.t('sch_validFrom'))),
|
|
1201
|
+
React.createElement("div", { style: styles.settingsDiv },
|
|
1202
|
+
React.createElement(TextField, { variant: "standard", style: { ...styles.inputDate, marginRight: 10 }, key: "exactTimeFrom", inputRef: this.refFrom, defaultValue: string2USdate(schedule.valid.from), type: "date",
|
|
1203
|
+
// inputComponent={TextDate}
|
|
1204
|
+
onChange: e => {
|
|
1205
|
+
this.timerFrom && clearTimeout(this.timerFrom);
|
|
1206
|
+
if (this.refFrom.current) {
|
|
1207
|
+
this.refFrom.current.style.background = '#ff000030';
|
|
1208
|
+
}
|
|
1209
|
+
this.timerFrom = setTimeout(value => {
|
|
1210
|
+
this.timerFrom = null;
|
|
1211
|
+
if (this.refFrom.current) {
|
|
1212
|
+
this.refFrom.current.style.background = '';
|
|
1213
|
+
}
|
|
1214
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1215
|
+
const date = Schedule.string2date(value);
|
|
1216
|
+
if (date.toString() !== 'Invalid Date') {
|
|
1217
|
+
_schedule.valid.from = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1218
|
+
this.onChange(_schedule);
|
|
1219
|
+
}
|
|
1220
|
+
}, 1500, e.target.value);
|
|
1221
|
+
}, slotProps: {
|
|
1222
|
+
inputLabel: { shrink: true },
|
|
1223
|
+
}, margin: "normal" }),
|
|
1224
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { style: styles.inputRadio, checked: !!schedule.valid.to, onClick: () => {
|
|
1225
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1226
|
+
_schedule.valid.to = _schedule.valid.to ? '' : Schedule.now2string(true);
|
|
1227
|
+
this.onChange(_schedule);
|
|
1228
|
+
} }), label: I18n.t('sch_validTo') }),
|
|
1229
|
+
!!schedule.valid.to && (React.createElement(TextField, { variant: "standard", inputRef: this.refTo, style: { ...styles.inputDate, marginRight: 10 }, key: "exactTimeFrom", type: "date", defaultValue: string2USdate(schedule.valid.to),
|
|
1230
|
+
// inputComponent={TextDate}
|
|
1231
|
+
onChange: e => {
|
|
1232
|
+
this.timerTo && clearTimeout(this.timerTo);
|
|
1233
|
+
if (this.refTo.current) {
|
|
1234
|
+
this.refTo.current.style.background = '#ff000030';
|
|
1235
|
+
}
|
|
1236
|
+
this.timerTo = setTimeout(value => {
|
|
1237
|
+
this.timerTo = null;
|
|
1238
|
+
if (this.refTo.current) {
|
|
1239
|
+
this.refTo.current.style.background = '';
|
|
1240
|
+
}
|
|
1241
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1242
|
+
const date = Schedule.string2date(value);
|
|
1243
|
+
if (date.toString() !== 'Invalid Date') {
|
|
1244
|
+
_schedule.valid.to = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1245
|
+
this.onChange(_schedule);
|
|
1246
|
+
}
|
|
1247
|
+
}, 1500, e.target.value);
|
|
1248
|
+
}, slotProps: {
|
|
1249
|
+
inputLabel: { shrink: true },
|
|
1250
|
+
}, margin: "normal" })))));
|
|
1251
|
+
}
|
|
1252
|
+
render() {
|
|
1253
|
+
return (React.createElement("div", { style: { height: 'calc(100% - 48px)', width: '100%', overflow: 'hidden' } },
|
|
1254
|
+
React.createElement("div", null, this.state.desc),
|
|
1255
|
+
React.createElement("div", { style: styles.scrollWindow },
|
|
1256
|
+
React.createElement("h5", null, I18n.t('sch_time')),
|
|
1257
|
+
this.getTimePeriodElements(),
|
|
1258
|
+
this.getTimeExactElements(),
|
|
1259
|
+
Schedule.getDivider(),
|
|
1260
|
+
React.createElement("h5", null, I18n.t('sch_period')),
|
|
1261
|
+
this.getPeriodModes(),
|
|
1262
|
+
!this.state.schedule.period.once && Schedule.getDivider(),
|
|
1263
|
+
!this.state.schedule.period.once && this.getValidSettings())));
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
//# sourceMappingURL=Schedule.js.map
|