@iobroker/adapter-react-v5 4.8.1 → 4.9.0
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/Components/Logo.d.ts +9 -50
- package/Components/Logo.js +106 -173
- package/Components/ObjectBrowser.d.ts +9 -0
- package/Components/ObjectBrowser.js +370 -165
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/SaveCloseButtons.d.ts +17 -61
- package/Components/SaveCloseButtons.js +64 -124
- package/Components/Schedule.d.ts +31 -6
- package/Components/Schedule.js +1144 -1562
- package/Components/TabContainer.d.ts +9 -37
- package/Components/TabContainer.js +49 -74
- package/Components/TabContent.d.ts +6 -27
- package/Components/TabContent.js +24 -67
- package/Components/TabHeader.d.ts +6 -11
- package/Components/TabHeader.js +11 -40
- package/Components/ToggleThemeMenu.d.ts +10 -8
- package/Components/ToggleThemeMenu.js +16 -36
- package/Components/types.d.ts +10 -2
- package/Dialogs/SelectID.d.ts +39 -114
- package/Dialogs/SelectID.js +141 -246
- package/LegacyConnection.d.ts +1 -1
- package/README.md +6 -2
- package/i18n.d.ts +2 -2
- package/index.d.ts +127 -126
- package/index.js +213 -192
- package/package.json +6 -7
- package/Components/JsonConfigComponent/ChipInput.d.ts +0 -12
- package/Components/JsonConfigComponent/ChipInput.js +0 -763
- package/Components/JsonConfigComponent/ChipInput.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAccordion.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigAccordion.js +0 -348
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAlive.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -105
- package/Components/JsonConfigComponent/ConfigAlive.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +0 -37
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +0 -73
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +0 -131
- package/Components/JsonConfigComponent/ConfigCRON.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCRON.js +0 -157
- package/Components/JsonConfigComponent/ConfigCRON.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertCollection.js +0 -128
- package/Components/JsonConfigComponent/ConfigCertCollection.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +0 -149
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificates.js +0 -284
- package/Components/JsonConfigComponent/ConfigCertificates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +0 -821
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -40
- package/Components/JsonConfigComponent/ConfigChip.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigChip.js +0 -120
- package/Components/JsonConfigComponent/ConfigChip.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigColor.d.ts +0 -22
- package/Components/JsonConfigComponent/ConfigColor.js +0 -120
- package/Components/JsonConfigComponent/ConfigColor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -265
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCustom.d.ts +0 -26
- package/Components/JsonConfigComponent/ConfigCustom.js +0 -316
- package/Components/JsonConfigComponent/ConfigCustom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -91
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +0 -6
- package/Components/JsonConfigComponent/ConfigDeviceManager.js +0 -18
- package/Components/JsonConfigComponent/ConfigFile.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigFile.js +0 -228
- package/Components/JsonConfigComponent/ConfigFile.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigFileSelector.js +0 -625
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFunc.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -124
- package/Components/JsonConfigComponent/ConfigFunc.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +0 -95
- package/Components/JsonConfigComponent/ConfigGeneric.js +0 -646
- package/Components/JsonConfigComponent/ConfigIP.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigIP.js +0 -130
- package/Components/JsonConfigComponent/ConfigIP.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigImageSendTo.js +0 -114
- package/Components/JsonConfigComponent/ConfigImageSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigImageUpload.js +0 -166
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +0 -264
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInterface.js +0 -146
- package/Components/JsonConfigComponent/ConfigInterface.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +0 -13
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -145
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigLanguage.d.ts +0 -7
- package/Components/JsonConfigComponent/ConfigLanguage.js +0 -110
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigLicense.js +0 -183
- package/Components/JsonConfigComponent/ConfigLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigNumber.js +0 -117
- package/Components/JsonConfigComponent/ConfigObjectId.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigObjectId.js +0 -167
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPanel.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPanel.js +0 -396
- package/Components/JsonConfigComponent/ConfigPanel.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPassword.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -193
- package/Components/JsonConfigComponent/ConfigPassword.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +0 -21
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -65
- package/Components/JsonConfigComponent/ConfigPattern.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPort.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPort.js +0 -176
- package/Components/JsonConfigComponent/ConfigRoom.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -124
- package/Components/JsonConfigComponent/ConfigRoom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSelect.js +0 -159
- package/Components/JsonConfigComponent/ConfigSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +0 -272
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSendto.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigSendto.js +0 -294
- package/Components/JsonConfigComponent/ConfigSetState.d.ts +0 -18
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -185
- package/Components/JsonConfigComponent/ConfigSetState.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSlider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -119
- package/Components/JsonConfigComponent/ConfigSlider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -68
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -81
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -71
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -88
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTable.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigTable.js +0 -1064
- package/Components/JsonConfigComponent/ConfigTable.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTabs.d.ts +0 -34
- package/Components/JsonConfigComponent/ConfigTabs.js +0 -162
- package/Components/JsonConfigComponent/ConfigTabs.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigText.js +0 -226
- package/Components/JsonConfigComponent/ConfigText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -129
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -85
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTopic.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -110
- package/Components/JsonConfigComponent/ConfigTopic.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigUUID.js +0 -95
- package/Components/JsonConfigComponent/ConfigUUID.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUser.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigUser.js +0 -142
- package/Components/JsonConfigComponent/ConfigUser.js.map +0 -1
- package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +0 -63
- package/Components/JsonConfigComponent/DeviceManager/Communication.js +0 -268
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +0 -15
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +0 -53
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +0 -340
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +0 -45
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +0 -146
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +0 -69
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +0 -51
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +0 -226
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +0 -13
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +0 -111
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +0 -7
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +0 -16
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +0 -94
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +0 -10
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +0 -22
- package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/Utils.js +0 -158
- package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +0 -26
- package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/index.d.ts +0 -2
- package/Components/JsonConfigComponent/DeviceManager/index.js +0 -10
- package/Components/JsonConfigComponent/DeviceManager/index.js.map +0 -1
- package/Components/JsonConfigComponent/index.d.ts +0 -26
- package/Components/JsonConfigComponent/index.js +0 -520
- package/Components/JsonConfigComponent/index.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/AdminConnection.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/AdminConnection.js +0 -7
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Icon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Utils.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/i18n.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/i18n.js +0 -10
- package/Components/JsonConfigComponent/wrapper/i18n.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js +0 -10
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js.map +0 -1
- package/Components/Logo.js.map +0 -1
- package/Components/SaveCloseButtons.js.map +0 -1
- package/Components/Schedule.js.map +0 -1
- package/Components/TabContainer.js.map +0 -1
- package/Components/TabContent.js.map +0 -1
- package/Components/TabHeader.js.map +0 -1
- package/Components/ToggleThemeMenu.js.map +0 -1
- package/Dialogs/SelectID.js.map +0 -1
package/Components/Schedule.js
CHANGED
|
@@ -1,1662 +1,1244 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_excluded2 = ["inputRef"];
|
|
24
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
27
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
28
|
-
var styles = function styles(theme) {
|
|
29
|
-
return {
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const styles_1 = require("@mui/styles");
|
|
31
|
+
const material_1 = require("@mui/material");
|
|
32
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
33
|
+
const styles = (theme) => ({
|
|
30
34
|
hr: {
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
border: 0,
|
|
36
|
+
borderTop: '1px solid gray',
|
|
33
37
|
},
|
|
34
38
|
scrollWindow: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
width: '100%',
|
|
40
|
+
overflow: 'auto',
|
|
41
|
+
height: 'calc(100% - 22px)',
|
|
38
42
|
},
|
|
39
43
|
rowDiv: {
|
|
40
|
-
|
|
44
|
+
width: '100%',
|
|
41
45
|
},
|
|
42
46
|
modeDiv: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
width: 200,
|
|
48
|
+
display: 'inline-block',
|
|
49
|
+
verticalAlign: 'top',
|
|
46
50
|
},
|
|
47
51
|
settingsDiv: {
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
display: 'inline-block',
|
|
53
|
+
verticalAlign: 'top',
|
|
50
54
|
},
|
|
51
55
|
inputTime: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
width: 90,
|
|
57
|
+
marginTop: 0,
|
|
58
|
+
marginLeft: 5,
|
|
55
59
|
},
|
|
56
60
|
inputDate: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
width: 140,
|
|
62
|
+
marginTop: 0,
|
|
63
|
+
marginLeft: 5,
|
|
60
64
|
},
|
|
61
65
|
inputEvery: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
width: 40,
|
|
67
|
+
marginLeft: 5,
|
|
68
|
+
marginRight: 5,
|
|
65
69
|
},
|
|
66
70
|
inputRadio: {
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
padding: '4px 12px',
|
|
72
|
+
verticalAlign: 'top',
|
|
69
73
|
},
|
|
70
74
|
inputGroup: {
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
maxWidth: 400,
|
|
76
|
+
display: 'inline-block',
|
|
73
77
|
},
|
|
74
78
|
inputGroupElement: {
|
|
75
|
-
|
|
79
|
+
width: 120,
|
|
76
80
|
},
|
|
77
81
|
inputDateDay: {
|
|
78
|
-
|
|
82
|
+
width: 60,
|
|
79
83
|
},
|
|
80
84
|
inputDateDayCheck: {
|
|
81
|
-
|
|
85
|
+
padding: 4,
|
|
82
86
|
},
|
|
83
87
|
inputSmallCheck: {
|
|
84
|
-
|
|
88
|
+
padding: 0,
|
|
85
89
|
},
|
|
86
90
|
rowOnce: {},
|
|
87
91
|
rowDays: {
|
|
88
|
-
|
|
92
|
+
background: theme.palette.mode !== 'dark' ? '#ddeaff' : '#4b5057',
|
|
89
93
|
},
|
|
90
94
|
rowDows: {
|
|
91
|
-
|
|
95
|
+
background: theme.palette.mode !== 'dark' ? '#DDFFDD' : '#52646c',
|
|
92
96
|
},
|
|
93
97
|
rowDates: {
|
|
94
|
-
|
|
98
|
+
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#747a86',
|
|
95
99
|
},
|
|
96
100
|
rowWeeks: {
|
|
97
|
-
|
|
101
|
+
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#717680',
|
|
98
102
|
},
|
|
99
103
|
rowMonths: {
|
|
100
|
-
|
|
104
|
+
background: theme.palette.mode !== 'dark' ? '#DDFFFF' : '#1f5557',
|
|
101
105
|
},
|
|
102
106
|
rowMonthsDates: {
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
background: theme.palette.mode !== 'dark' ? '#EEFFFF' : '#3c5737',
|
|
108
|
+
maxWidth: 600,
|
|
105
109
|
},
|
|
106
110
|
rowYears: {
|
|
107
|
-
|
|
111
|
+
background: theme.palette.mode !== 'dark' ? '#fbffdd' : '#574b33',
|
|
108
112
|
},
|
|
109
113
|
rowDaysDows: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
background: theme.palette.mode !== 'dark' ? '#EEEAFF' : '#573544',
|
|
115
|
+
paddingLeft: 10,
|
|
116
|
+
paddingBottom: 10,
|
|
113
117
|
},
|
|
114
118
|
rowDowsDows: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
background: theme.palette.mode !== 'dark' ? '#EEFFEE' : '#3d4c54',
|
|
120
|
+
paddingLeft: 10,
|
|
121
|
+
paddingBottom: 10,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
const WEEKDAYS = [
|
|
125
|
+
'Sunday',
|
|
126
|
+
'Monday',
|
|
127
|
+
'Tuesday',
|
|
128
|
+
'Wednesday',
|
|
129
|
+
'Thursday',
|
|
130
|
+
'Friday',
|
|
131
|
+
'Saturday',
|
|
132
|
+
'Sunday',
|
|
133
|
+
];
|
|
134
|
+
const MONTHS = [
|
|
135
|
+
'January',
|
|
136
|
+
'February',
|
|
137
|
+
'March',
|
|
138
|
+
'April',
|
|
139
|
+
'May',
|
|
140
|
+
'June',
|
|
141
|
+
'July',
|
|
142
|
+
'August',
|
|
143
|
+
'September',
|
|
144
|
+
'October',
|
|
145
|
+
'November',
|
|
146
|
+
'December',
|
|
147
|
+
];
|
|
148
|
+
const PERIODS = {
|
|
149
|
+
minutes: 'minutes',
|
|
150
|
+
hours: 'hours',
|
|
126
151
|
};
|
|
127
|
-
|
|
152
|
+
const ASTRO = [
|
|
153
|
+
'sunrise',
|
|
154
|
+
'sunriseEnd',
|
|
155
|
+
'goldenHourEnd',
|
|
156
|
+
'solarNoon',
|
|
157
|
+
'goldenHour',
|
|
158
|
+
'sunsetStart',
|
|
159
|
+
'sunset',
|
|
160
|
+
'dusk',
|
|
161
|
+
'nauticalDusk',
|
|
162
|
+
'night',
|
|
163
|
+
'nightEnd',
|
|
164
|
+
'nauticalDawn',
|
|
165
|
+
'dawn',
|
|
166
|
+
'nadir',
|
|
167
|
+
];
|
|
128
168
|
function padding(num) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
function TextTime(props) {
|
|
135
|
-
var inputRef = props.inputRef,
|
|
136
|
-
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
137
|
-
return /*#__PURE__*/_react["default"].createElement(_reactTextMask["default"], (0, _extends2["default"])({}, other, {
|
|
138
|
-
ref: inputRef,
|
|
139
|
-
mask: [/[0-2]/, /[0-9]/, ':', /[0-5]/, /[0-9]/],
|
|
140
|
-
placeholderChar: props.placeholder || '00:00',
|
|
141
|
-
showMask: true
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
TextTime.propTypes = {
|
|
145
|
-
inputRef: _propTypes["default"].func.isRequired
|
|
146
|
-
};
|
|
147
|
-
function TextDate(props) {
|
|
148
|
-
var inputRef = props.inputRef,
|
|
149
|
-
other = (0, _objectWithoutProperties2["default"])(props, _excluded2);
|
|
150
|
-
return /*#__PURE__*/_react["default"].createElement(_reactTextMask["default"], (0, _extends2["default"])({}, other, {
|
|
151
|
-
ref: inputRef,
|
|
152
|
-
mask: [/[0-3]/, /[0-9]/, '.', /[0-1]/, /[0-9]/, '.', '2', '0', /[0-9]/, /[0-9]/],
|
|
153
|
-
placeholderChar: props.placeholder || '01.01.2020',
|
|
154
|
-
showMask: true
|
|
155
|
-
}));
|
|
169
|
+
if (num < 10) {
|
|
170
|
+
return `0${num}`;
|
|
171
|
+
}
|
|
172
|
+
return `${num}`;
|
|
156
173
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
// interface TextTimeProps {
|
|
175
|
+
// inputRef: React.RefObject<HTMLInputElement>;
|
|
176
|
+
// placeholder?: string;
|
|
177
|
+
// }
|
|
178
|
+
// function TextTime(props: TextTimeProps) {
|
|
179
|
+
// const { inputRef, ...other } = props;
|
|
180
|
+
//
|
|
181
|
+
// return <MaskedInput
|
|
182
|
+
// {...other}
|
|
183
|
+
// ref={inputRef}
|
|
184
|
+
// mask={[/[0-2]/, /[0-9]/, ':', /[0-5]/, /[0-9]/]}
|
|
185
|
+
// placeholderChar={props.placeholder || '00:00'}
|
|
186
|
+
// showMask
|
|
187
|
+
// />;
|
|
188
|
+
// }
|
|
189
|
+
// function TextDate(props: TextTimeProps) {
|
|
190
|
+
// const { inputRef, ...other } = props;
|
|
191
|
+
//
|
|
192
|
+
// return <MaskedInput
|
|
193
|
+
// {...other}
|
|
194
|
+
// ref={inputRef}
|
|
195
|
+
// mask={[/[0-3]/, /[0-9]/, '.', /[0-1]/, /[0-9]/, '.', '2', '0', /[0-9]/, /[0-9]/]}
|
|
196
|
+
// placeholderChar={props.placeholder || '01.01.2020'}
|
|
197
|
+
// showMask
|
|
198
|
+
// />;
|
|
199
|
+
// }
|
|
200
|
+
const DEFAULT = {
|
|
201
|
+
time: {
|
|
202
|
+
exactTime: false,
|
|
203
|
+
start: '00:00',
|
|
204
|
+
end: '23:59',
|
|
205
|
+
mode: 'hours',
|
|
206
|
+
interval: 1,
|
|
207
|
+
},
|
|
208
|
+
period: {
|
|
209
|
+
once: '',
|
|
210
|
+
days: 1,
|
|
211
|
+
dows: '',
|
|
212
|
+
dates: '',
|
|
213
|
+
weeks: 0,
|
|
214
|
+
months: '',
|
|
215
|
+
years: 0,
|
|
216
|
+
yearMonth: 0,
|
|
217
|
+
yearDate: 0,
|
|
218
|
+
},
|
|
219
|
+
valid: {
|
|
220
|
+
from: '',
|
|
221
|
+
to: '',
|
|
222
|
+
},
|
|
183
223
|
};
|
|
184
224
|
function string2USdate(date) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
return '';
|
|
190
|
-
}
|
|
191
|
-
var Schedule = /*#__PURE__*/function (_React$Component) {
|
|
192
|
-
(0, _inherits2["default"])(Schedule, _React$Component);
|
|
193
|
-
var _super = _createSuper(Schedule);
|
|
194
|
-
function Schedule(props) {
|
|
195
|
-
var _this;
|
|
196
|
-
(0, _classCallCheck2["default"])(this, Schedule);
|
|
197
|
-
_this = _super.call(this, props);
|
|
198
|
-
var schedule;
|
|
199
|
-
if (_this.props.schedule && typeof _this.props.schedule === 'string' && _this.props.schedule[0] === '{') {
|
|
200
|
-
try {
|
|
201
|
-
schedule = JSON.parse(_this.props.schedule);
|
|
202
|
-
} catch (e) {
|
|
203
|
-
// ignore
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if ((!schedule || !Object.keys(schedule).length) && _this.props.onChange) {
|
|
207
|
-
setTimeout(function () {
|
|
208
|
-
return _this.onChange(_this.state.schedule, true);
|
|
209
|
-
}, 200);
|
|
210
|
-
}
|
|
211
|
-
schedule = schedule || {};
|
|
212
|
-
schedule = _objectSpread(_objectSpread({}, DEFAULT), schedule);
|
|
213
|
-
schedule.valid.from = schedule.valid.from || Schedule.now2string();
|
|
214
|
-
_this.refFrom = /*#__PURE__*/_react["default"].createRef();
|
|
215
|
-
_this.refTo = /*#__PURE__*/_react["default"].createRef();
|
|
216
|
-
_this.refOnce = /*#__PURE__*/_react["default"].createRef();
|
|
217
|
-
_this.state = {
|
|
218
|
-
schedule: schedule,
|
|
219
|
-
desc: Schedule.state2text(schedule)
|
|
220
|
-
};
|
|
221
|
-
if (JSON.stringify(schedule) !== _this.props.schedule) {
|
|
222
|
-
setTimeout(function () {
|
|
223
|
-
return _this.props.onChange && _this.props.onChange(JSON.stringify(schedule));
|
|
224
|
-
}, 100);
|
|
225
|
+
const parts = date.split('.');
|
|
226
|
+
if (parts.length === 3) {
|
|
227
|
+
return `${parts[2]}-${parts[1]}-${parts[0]}`;
|
|
225
228
|
}
|
|
226
|
-
return
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (copy.period.once) {
|
|
239
|
-
var once = copy.period.once;
|
|
240
|
-
delete copy.period;
|
|
241
|
-
copy.period = {
|
|
242
|
-
once: once
|
|
243
|
-
};
|
|
244
|
-
delete copy.valid;
|
|
245
|
-
} else if (copy.period.days) {
|
|
246
|
-
var days = copy.period.days;
|
|
247
|
-
var dows = copy.period.dows;
|
|
248
|
-
delete copy.period;
|
|
249
|
-
copy.period = {
|
|
250
|
-
days: days
|
|
251
|
-
};
|
|
252
|
-
if (dows && dows !== '[]') {
|
|
253
|
-
copy.period.dows = dows;
|
|
254
|
-
}
|
|
255
|
-
} else if (copy.period.weeks) {
|
|
256
|
-
var weeks = copy.period.weeks;
|
|
257
|
-
var _dows = copy.period.dows;
|
|
258
|
-
delete copy.period;
|
|
259
|
-
copy.period = {
|
|
260
|
-
weeks: weeks
|
|
261
|
-
};
|
|
262
|
-
if (_dows && _dows !== '[]') {
|
|
263
|
-
copy.period.dows = _dows;
|
|
264
|
-
}
|
|
265
|
-
} else if (copy.period.months) {
|
|
266
|
-
var months = copy.period.months;
|
|
267
|
-
var dates = copy.period.dates;
|
|
268
|
-
delete copy.period;
|
|
269
|
-
copy.period = {
|
|
270
|
-
months: months
|
|
271
|
-
};
|
|
272
|
-
if (dates && dates !== '[]') {
|
|
273
|
-
copy.period.dates = dates;
|
|
274
|
-
}
|
|
275
|
-
} else if (copy.period.years) {
|
|
276
|
-
var years = copy.period.years;
|
|
277
|
-
var yearMonth = copy.period.yearMonth;
|
|
278
|
-
var yearDate = copy.period.yearDate;
|
|
279
|
-
delete copy.period;
|
|
280
|
-
copy.period = {
|
|
281
|
-
years: years,
|
|
282
|
-
yearDate: yearDate
|
|
283
|
-
};
|
|
284
|
-
if (yearMonth) {
|
|
285
|
-
copy.period.yearMonth = yearMonth;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (copy.time.exactTime) {
|
|
289
|
-
delete copy.time.end;
|
|
290
|
-
delete copy.time.mode;
|
|
291
|
-
delete copy.time.interval;
|
|
292
|
-
} else {
|
|
293
|
-
delete copy.time.exactTime;
|
|
294
|
-
}
|
|
295
|
-
if (copy.valid) {
|
|
296
|
-
if (!copy.valid.to) {
|
|
297
|
-
delete copy.valid.to;
|
|
298
|
-
}
|
|
299
|
-
if (copy.period.days === 1 || copy.period.weeks === 1 || copy.period.months === 1 || copy.period.years === 1) {
|
|
300
|
-
var from = Schedule.string2date(copy.valid.from);
|
|
301
|
-
var today = new Date();
|
|
302
|
-
today.setHours(0);
|
|
303
|
-
today.setMinutes(0);
|
|
304
|
-
today.setSeconds(0);
|
|
305
|
-
today.setMilliseconds(0);
|
|
306
|
-
if (from <= today) {
|
|
307
|
-
delete copy.valid.from;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if (!copy.valid.from && !copy.valid.to) {
|
|
311
|
-
delete copy.valid;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
this.props.onChange && this.props.onChange(JSON.stringify(copy), Schedule.state2text(schedule));
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}, {
|
|
318
|
-
key: "getTimePeriodElements",
|
|
319
|
-
value: function getTimePeriodElements() {
|
|
320
|
-
var _this2 = this;
|
|
321
|
-
var schedule = this.state.schedule;
|
|
322
|
-
var wholeDay = false;
|
|
323
|
-
var day = false;
|
|
324
|
-
var night = false;
|
|
325
|
-
var fromTo = true;
|
|
326
|
-
if (schedule.time.start === '00:00' && schedule.time.end === '24:00') {
|
|
327
|
-
wholeDay = true;
|
|
328
|
-
fromTo = false;
|
|
329
|
-
} else if (schedule.time.start === 'sunrise') {
|
|
330
|
-
day = true;
|
|
331
|
-
fromTo = false;
|
|
332
|
-
} else if (schedule.time.start === 'sunset') {
|
|
333
|
-
night = true;
|
|
334
|
-
fromTo = false;
|
|
335
|
-
}
|
|
336
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
337
|
-
key: "timePeriod",
|
|
338
|
-
className: this.props.classes.rowDiv
|
|
339
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
340
|
-
className: this.props.classes.modeDiv
|
|
341
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
342
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
343
|
-
className: this.props.classes.inputRadio,
|
|
344
|
-
checked: !schedule.time.exactTime,
|
|
345
|
-
onClick: function onClick() {
|
|
346
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
347
|
-
_schedule.time.exactTime = false;
|
|
348
|
-
_this2.onChange(_schedule);
|
|
349
|
-
}
|
|
350
|
-
}),
|
|
351
|
-
label: _i18n["default"].t('sch_intervalTime')
|
|
352
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
353
|
-
className: this.props.classes.settingsDiv
|
|
354
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
355
|
-
className: this.props.classes.settingsDiv
|
|
356
|
-
}, !schedule.time.exactTime && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
357
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
358
|
-
className: this.props.classes.inputRadio,
|
|
359
|
-
checked: !!fromTo,
|
|
360
|
-
onClick: function onClick() {
|
|
361
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
362
|
-
_schedule.time.start = '00:00';
|
|
363
|
-
_schedule.time.end = '23:59';
|
|
364
|
-
_this2.onChange(_schedule);
|
|
365
|
-
}
|
|
366
|
-
}),
|
|
367
|
-
label: !fromTo ? _i18n["default"].t('sch_fromTo') : ''
|
|
368
|
-
}), fromTo && [/*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
369
|
-
variant: "standard",
|
|
370
|
-
className: this.props.classes.inputTime,
|
|
371
|
-
style: {
|
|
372
|
-
marginRight: 10
|
|
373
|
-
},
|
|
374
|
-
key: "exactTimeFrom",
|
|
375
|
-
type: "time",
|
|
376
|
-
value: this.state.schedule.time.start
|
|
377
|
-
// InputProps={{inputComponent: TextTime}}
|
|
378
|
-
,
|
|
379
|
-
onChange: function onChange(e) {
|
|
380
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
381
|
-
_schedule.time.start = e.target.value;
|
|
382
|
-
_this2.onChange(_schedule);
|
|
383
|
-
},
|
|
384
|
-
InputLabelProps: {
|
|
385
|
-
shrink: true
|
|
386
|
-
},
|
|
387
|
-
label: _i18n["default"].t('sch_from'),
|
|
388
|
-
margin: "normal"
|
|
389
|
-
}), /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
390
|
-
variant: "standard",
|
|
391
|
-
className: this.props.classes.inputTime,
|
|
392
|
-
key: "exactTimeTo",
|
|
393
|
-
type: "time",
|
|
394
|
-
value: this.state.schedule.time.end
|
|
395
|
-
// InputProps={{inputComponent: TextTime}}
|
|
396
|
-
,
|
|
397
|
-
onChange: function onChange(e) {
|
|
398
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
399
|
-
_schedule.time.end = e.target.value;
|
|
400
|
-
_this2.onChange(_schedule);
|
|
401
|
-
},
|
|
402
|
-
InputLabelProps: {
|
|
403
|
-
shrink: true
|
|
404
|
-
},
|
|
405
|
-
label: _i18n["default"].t('sch_to'),
|
|
406
|
-
margin: "normal"
|
|
407
|
-
})])), !schedule.time.exactTime && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
408
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
409
|
-
className: this.props.classes.inputRadio,
|
|
410
|
-
checked: !!wholeDay,
|
|
411
|
-
onClick: function onClick() {
|
|
412
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
413
|
-
_schedule.time.start = '00:00';
|
|
414
|
-
_schedule.time.end = '24:00';
|
|
415
|
-
_this2.onChange(_schedule);
|
|
416
|
-
}
|
|
417
|
-
}),
|
|
418
|
-
label: _i18n["default"].t('sch_wholeDay')
|
|
419
|
-
})), !schedule.time.exactTime && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
420
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
421
|
-
className: this.props.classes.inputRadio,
|
|
422
|
-
checked: !!day,
|
|
423
|
-
onClick: function onClick() {
|
|
424
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
425
|
-
_schedule.time.start = 'sunrise';
|
|
426
|
-
_schedule.time.end = 'sunset';
|
|
427
|
-
_this2.onChange(_schedule);
|
|
428
|
-
}
|
|
429
|
-
}),
|
|
430
|
-
label: _i18n["default"].t('sch_astroDay')
|
|
431
|
-
})), !schedule.time.exactTime && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
432
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
433
|
-
className: this.props.classes.inputRadio,
|
|
434
|
-
checked: !!night,
|
|
435
|
-
onClick: function onClick() {
|
|
436
|
-
var _schedule = JSON.parse(JSON.stringify(_this2.state.schedule));
|
|
437
|
-
_schedule.time.start = 'sunset';
|
|
438
|
-
_schedule.time.end = 'sunrise';
|
|
439
|
-
_this2.onChange(_schedule);
|
|
440
|
-
}
|
|
441
|
-
}),
|
|
442
|
-
label: _i18n["default"].t('sch_astroNight')
|
|
443
|
-
}))), !schedule.time.exactTime && this.getPeriodSettingsMinutes()));
|
|
444
|
-
}
|
|
445
|
-
}, {
|
|
446
|
-
key: "getTimeExactElements",
|
|
447
|
-
value: function getTimeExactElements() {
|
|
448
|
-
var _this3 = this;
|
|
449
|
-
var isAstro = ASTRO.includes(this.state.schedule.time.start);
|
|
450
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
451
|
-
key: "timeExact",
|
|
452
|
-
className: this.props.classes.rowDiv
|
|
453
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
454
|
-
className: this.props.classes.modeDiv
|
|
455
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
456
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
457
|
-
className: this.props.classes.inputRadio,
|
|
458
|
-
checked: !!this.state.schedule.time.exactTime,
|
|
459
|
-
onClick: function onClick() {
|
|
460
|
-
var schedule = JSON.parse(JSON.stringify(_this3.state.schedule));
|
|
461
|
-
schedule.time.exactTime = true;
|
|
462
|
-
_this3.onChange(schedule);
|
|
463
|
-
}
|
|
464
|
-
}),
|
|
465
|
-
label: _i18n["default"].t('sch_exactTime')
|
|
466
|
-
})), this.state.schedule.time.exactTime && /*#__PURE__*/_react["default"].createElement(_material.Select, {
|
|
467
|
-
variant: "standard",
|
|
468
|
-
value: isAstro ? this.state.schedule.time.start : '00:00',
|
|
469
|
-
onChange: function onChange(e) {
|
|
470
|
-
var _schedule = JSON.parse(JSON.stringify(_this3.state.schedule));
|
|
471
|
-
_schedule.time.start = e.target.value;
|
|
472
|
-
_this3.onChange(_schedule);
|
|
473
|
-
}
|
|
474
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
475
|
-
key: "specific",
|
|
476
|
-
value: "00:00"
|
|
477
|
-
}, _i18n["default"].t('sch_specificTime')), ASTRO.map(function (event) {
|
|
478
|
-
return /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
479
|
-
key: event,
|
|
480
|
-
value: event
|
|
481
|
-
}, _i18n["default"].t("sch_astro_".concat(event)));
|
|
482
|
-
})), this.state.schedule.time.exactTime && !isAstro && /*#__PURE__*/_react["default"].createElement("div", {
|
|
483
|
-
className: this.props.classes.settingsDiv
|
|
484
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
485
|
-
variant: "standard",
|
|
486
|
-
className: this.props.classes.inputTime,
|
|
487
|
-
key: "exactTimeValue",
|
|
488
|
-
value: this.state.schedule.time.start,
|
|
489
|
-
type: "time"
|
|
490
|
-
// inputComponent={TextTime}
|
|
491
|
-
,
|
|
492
|
-
onChange: function onChange(e) {
|
|
493
|
-
var _schedule = JSON.parse(JSON.stringify(_this3.state.schedule));
|
|
494
|
-
_schedule.time.start = e.target.value;
|
|
495
|
-
_this3.onChange(_schedule);
|
|
496
|
-
},
|
|
497
|
-
InputLabelProps: {
|
|
498
|
-
shrink: true
|
|
499
|
-
},
|
|
500
|
-
margin: "normal"
|
|
501
|
-
})));
|
|
502
|
-
}
|
|
503
|
-
}, {
|
|
504
|
-
key: "getDivider",
|
|
505
|
-
value: function getDivider() {
|
|
506
|
-
return /*#__PURE__*/_react["default"].createElement("hr", {
|
|
507
|
-
className: this.props.classes.hr
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}, {
|
|
511
|
-
key: "getPeriodModes",
|
|
512
|
-
value: function getPeriodModes() {
|
|
513
|
-
var _this4 = this;
|
|
514
|
-
var schedule = this.state.schedule;
|
|
515
|
-
var isOnce = !schedule.period.dows && !schedule.period.months && !schedule.period.dates && !schedule.period.years && !schedule.period.days && !schedule.period.weeks;
|
|
516
|
-
if (isOnce && !schedule.period.once) {
|
|
517
|
-
schedule.period.once = Schedule.now2string(true);
|
|
518
|
-
}
|
|
519
|
-
return [
|
|
520
|
-
/*#__PURE__*/
|
|
521
|
-
// ----- once ---
|
|
522
|
-
_react["default"].createElement("div", {
|
|
523
|
-
key: "once",
|
|
524
|
-
className: "".concat(this.props.classes.rowDiv, " ").concat(this.props.classes.rowOnce)
|
|
525
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
526
|
-
className: this.props.classes.modeDiv
|
|
527
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
528
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
529
|
-
className: this.props.classes.inputRadio,
|
|
530
|
-
checked: !!isOnce,
|
|
531
|
-
onClick: function onClick() {
|
|
532
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
533
|
-
_schedule.period.once = _schedule.period.once || Schedule.now2string(true);
|
|
534
|
-
_schedule.period.dows = '';
|
|
535
|
-
_schedule.period.months = '';
|
|
536
|
-
_schedule.period.dates = '';
|
|
537
|
-
_schedule.period.years = 0;
|
|
538
|
-
_schedule.period.yearDate = 0;
|
|
539
|
-
_schedule.period.yearMonth = 0;
|
|
540
|
-
_schedule.period.weeks = 0;
|
|
541
|
-
_schedule.period.days = 0;
|
|
542
|
-
_this4.onChange(_schedule);
|
|
543
|
-
}
|
|
544
|
-
}),
|
|
545
|
-
label: _i18n["default"].t('sch_periodOnce')
|
|
546
|
-
})), isOnce && /*#__PURE__*/_react["default"].createElement("div", {
|
|
547
|
-
className: this.props.classes.settingsDiv
|
|
548
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
549
|
-
variant: "standard",
|
|
550
|
-
className: this.props.classes.inputDate,
|
|
551
|
-
type: "date",
|
|
552
|
-
ref: this.refOnce,
|
|
553
|
-
key: "exactDateAt",
|
|
554
|
-
defaultValue: string2USdate(schedule.period.once)
|
|
555
|
-
// InputProps={{inputComponent: TextTime}}
|
|
556
|
-
,
|
|
557
|
-
onChange: function onChange(e) {
|
|
558
|
-
_this4.timerOnce && clearTimeout(_this4.timerOnce);
|
|
559
|
-
_this4.refOnce.current.style.background = '#ff000030';
|
|
560
|
-
_this4.timerOnce = setTimeout(function (value) {
|
|
561
|
-
_this4.timerOnce = null;
|
|
562
|
-
_this4.refOnce.current.style.background = '';
|
|
563
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
564
|
-
var date = Schedule.string2date(value);
|
|
565
|
-
if (date.toString() !== 'Invalid Date') {
|
|
566
|
-
_schedule.period.once = "".concat(padding(date.getDate()), ".").concat(padding(date.getMonth() + 1), ".").concat(date.getFullYear());
|
|
567
|
-
_this4.onChange(_schedule);
|
|
229
|
+
return '';
|
|
230
|
+
}
|
|
231
|
+
class Schedule extends react_1.Component {
|
|
232
|
+
constructor(props) {
|
|
233
|
+
super(props);
|
|
234
|
+
this.timerOnce = null;
|
|
235
|
+
this.timerFrom = null;
|
|
236
|
+
this.timerTo = null;
|
|
237
|
+
let schedule = undefined;
|
|
238
|
+
if (this.props.schedule && typeof this.props.schedule === 'string' && this.props.schedule[0] === '{') {
|
|
239
|
+
try {
|
|
240
|
+
schedule = JSON.parse(this.props.schedule);
|
|
568
241
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
InputLabelProps: {
|
|
572
|
-
shrink: true
|
|
573
|
-
},
|
|
574
|
-
label: _i18n["default"].t('sch_at'),
|
|
575
|
-
margin: "normal"
|
|
576
|
-
}))),
|
|
577
|
-
/*#__PURE__*/
|
|
578
|
-
// ----- days ---
|
|
579
|
-
_react["default"].createElement("div", {
|
|
580
|
-
key: "days",
|
|
581
|
-
className: "".concat(this.props.classes.rowDiv, " ").concat(this.props.classes.rowDays)
|
|
582
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
583
|
-
className: this.props.classes.modeDiv
|
|
584
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
585
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
586
|
-
className: this.props.classes.inputRadio,
|
|
587
|
-
checked: !!schedule.period.days,
|
|
588
|
-
onClick: function onClick() {
|
|
589
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
590
|
-
_schedule.period.days = 1;
|
|
591
|
-
_schedule.period.dows = '';
|
|
592
|
-
_schedule.period.months = '';
|
|
593
|
-
_schedule.period.dates = '';
|
|
594
|
-
_schedule.period.years = 0;
|
|
595
|
-
_schedule.period.yearDate = 0;
|
|
596
|
-
_schedule.period.yearMonth = 0;
|
|
597
|
-
_schedule.period.weeks = 0;
|
|
598
|
-
_schedule.period.once = '';
|
|
599
|
-
_this4.onChange(_schedule);
|
|
600
|
-
}
|
|
601
|
-
}),
|
|
602
|
-
label: _i18n["default"].t('sch_periodDaily')
|
|
603
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
604
|
-
className: this.props.classes.settingsDiv
|
|
605
|
-
}, this.getPeriodSettingsDaily(), schedule.period.days ? this.getPeriodSettingsWeekdays() : null)),
|
|
606
|
-
/*#__PURE__*/
|
|
607
|
-
// ----- days of weeks ---
|
|
608
|
-
/*
|
|
609
|
-
!schedule.period.days && (
|
|
610
|
-
<div key="dows" className={this.props.classes.rowDiv + ' ' + this.props.classes.rowDows}>
|
|
611
|
-
<div className={this.props.classes.modeDiv}>
|
|
612
|
-
<FormControlLabel control={<Radio className={this.props.classes.inputRadio} checked={!!schedule.period.dows} onClick={() => {
|
|
613
|
-
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
614
|
-
schedule.period.dows = schedule.period.dows ? '' : '[0,1,2,3,4,5,6]';
|
|
615
|
-
this.onChange(schedule);
|
|
616
|
-
}}/>}
|
|
617
|
-
label={I18n.t('sch_periodWeekdays')} />
|
|
618
|
-
</div>
|
|
619
|
-
<div className={this.props.classes.settingsDiv}>
|
|
620
|
-
{this.getPeriodSettingsWeekdays()}
|
|
621
|
-
</div>
|
|
622
|
-
</div>,
|
|
623
|
-
*/
|
|
624
|
-
// ----- weeks ---
|
|
625
|
-
_react["default"].createElement("div", {
|
|
626
|
-
key: "weeks",
|
|
627
|
-
className: "".concat(this.props.classes.rowDiv, " ").concat(this.props.classes.rowDows)
|
|
628
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
629
|
-
className: this.props.classes.modeDiv
|
|
630
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
631
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
632
|
-
className: this.props.classes.inputRadio,
|
|
633
|
-
checked: !!schedule.period.weeks,
|
|
634
|
-
onClick: function onClick() {
|
|
635
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
636
|
-
_schedule.period.weeks = schedule.period.weeks ? 0 : 1;
|
|
637
|
-
_schedule.period.dows = schedule.period.dows || '[0]';
|
|
638
|
-
_schedule.period.months = '';
|
|
639
|
-
_schedule.period.dates = '';
|
|
640
|
-
_schedule.period.years = 0;
|
|
641
|
-
_schedule.period.yearDate = 0;
|
|
642
|
-
_schedule.period.yearMonth = 0;
|
|
643
|
-
_schedule.period.days = 0;
|
|
644
|
-
_schedule.period.once = '';
|
|
645
|
-
_this4.onChange(_schedule);
|
|
646
|
-
}
|
|
647
|
-
}),
|
|
648
|
-
label: _i18n["default"].t('sch_periodWeekly')
|
|
649
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
650
|
-
className: this.props.classes.settingsDiv
|
|
651
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
652
|
-
className: this.props.classes.settingsDiv
|
|
653
|
-
}, this.getPeriodSettingsWeekly()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
654
|
-
className: "".concat(this.props.classes.settingsDiv, " ").concat(this.props.classes.rowDowsDows)
|
|
655
|
-
}, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
|
|
656
|
-
/*#__PURE__*/
|
|
657
|
-
// ----- months ---
|
|
658
|
-
_react["default"].createElement("div", {
|
|
659
|
-
key: "months",
|
|
660
|
-
className: "".concat(this.props.classes.rowDiv, " ").concat(this.props.classes.rowMonths)
|
|
661
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
662
|
-
className: this.props.classes.modeDiv
|
|
663
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
664
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
665
|
-
className: this.props.classes.inputRadio,
|
|
666
|
-
checked: !!schedule.period.months,
|
|
667
|
-
onClick: function onClick() {
|
|
668
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
669
|
-
_schedule.period.months = 1;
|
|
670
|
-
_schedule.period.dows = '';
|
|
671
|
-
_schedule.period.dates = '';
|
|
672
|
-
_schedule.period.years = 0;
|
|
673
|
-
_schedule.period.yearDate = 0;
|
|
674
|
-
_schedule.period.yearMonth = 0;
|
|
675
|
-
_schedule.period.weeks = 0;
|
|
676
|
-
_schedule.period.days = 0;
|
|
677
|
-
_schedule.period.once = '';
|
|
678
|
-
_this4.onChange(_schedule);
|
|
679
|
-
}
|
|
680
|
-
}),
|
|
681
|
-
label: _i18n["default"].t('sch_periodMonthly')
|
|
682
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
683
|
-
className: this.props.classes.settingsDiv
|
|
684
|
-
}, this.getPeriodSettingsMonthly(), schedule.period.months ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
685
|
-
className: "".concat(this.props.classes.settingsDiv, " ").concat(this.props.classes.rowMonthsDates)
|
|
686
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
687
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
688
|
-
className: this.props.classes.inputRadio,
|
|
689
|
-
checked: !!schedule.period.dates,
|
|
690
|
-
onClick: function onClick() {
|
|
691
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
692
|
-
_schedule.period.months = _schedule.period.months || 1;
|
|
693
|
-
var dates = [];
|
|
694
|
-
for (var i = 1; i <= 31; i++) {
|
|
695
|
-
dates.push(i);
|
|
242
|
+
catch (e) {
|
|
243
|
+
// ignore
|
|
696
244
|
}
|
|
697
|
-
_schedule.period.dates = _schedule.period.dates || JSON.stringify(dates);
|
|
698
|
-
_schedule.period.dows = '';
|
|
699
|
-
_schedule.period.years = 0;
|
|
700
|
-
_schedule.period.yearDate = 0;
|
|
701
|
-
_schedule.period.yearMonth = 0;
|
|
702
|
-
_schedule.period.weeks = 0;
|
|
703
|
-
_schedule.period.days = 0;
|
|
704
|
-
_schedule.period.once = '';
|
|
705
|
-
_this4.onChange(_schedule);
|
|
706
|
-
}
|
|
707
|
-
}),
|
|
708
|
-
label: _i18n["default"].t('sch_periodDates')
|
|
709
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
710
|
-
className: "".concat(this.props.classes.settingsDiv, " ").concat(this.props.classes.rowMonthsDates)
|
|
711
|
-
}, this.getPeriodSettingsDates())) : null)),
|
|
712
|
-
/*#__PURE__*/
|
|
713
|
-
// ----- years ---
|
|
714
|
-
_react["default"].createElement("div", {
|
|
715
|
-
key: "years",
|
|
716
|
-
className: "".concat(this.props.classes.rowDiv, " ").concat(this.props.classes.rowYears)
|
|
717
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
718
|
-
className: this.props.classes.modeDiv
|
|
719
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
720
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
721
|
-
className: this.props.classes.inputRadio,
|
|
722
|
-
checked: !!schedule.period.years,
|
|
723
|
-
onClick: function onClick() {
|
|
724
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
725
|
-
_schedule.period.years = 1;
|
|
726
|
-
_schedule.period.yearDate = 1;
|
|
727
|
-
_schedule.period.yearMonth = 1;
|
|
728
|
-
_schedule.period.dows = '';
|
|
729
|
-
_schedule.period.months = 0;
|
|
730
|
-
_schedule.period.dates = '';
|
|
731
|
-
_schedule.period.weeks = 0;
|
|
732
|
-
_schedule.period.days = 0;
|
|
733
|
-
_schedule.period.once = '';
|
|
734
|
-
_this4.onChange(_schedule);
|
|
735
|
-
}
|
|
736
|
-
}),
|
|
737
|
-
label: _i18n["default"].t('sch_periodYearly')
|
|
738
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
739
|
-
className: this.props.classes.settingsDiv
|
|
740
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
741
|
-
className: this.props.classes.settingsDiv
|
|
742
|
-
}, this.getPeriodSettingsYearly()), !!schedule.period.years && /*#__PURE__*/_react["default"].createElement("div", {
|
|
743
|
-
className: this.props.classes.settingsDiv
|
|
744
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, _i18n["default"].t('sch_on')), /*#__PURE__*/_react["default"].createElement(_material.Input, {
|
|
745
|
-
key: "input",
|
|
746
|
-
value: this.state.schedule.period.yearDate,
|
|
747
|
-
className: this.props.classes.inputEvery,
|
|
748
|
-
type: "number",
|
|
749
|
-
min: 1,
|
|
750
|
-
max: 31,
|
|
751
|
-
onChange: function onChange(e) {
|
|
752
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
753
|
-
_schedule.period.yearDate = parseInt(e.target.value, 10);
|
|
754
|
-
if (_schedule.period.yearDate < 1) _schedule.period.yearDate = 31;
|
|
755
|
-
if (_schedule.period.yearDate > 31) _schedule.period.yearDate = 1;
|
|
756
|
-
_this4.onChange(_schedule);
|
|
757
245
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
value: schedule.period.yearMonth,
|
|
761
|
-
onChange: function onChange(e) {
|
|
762
|
-
var _schedule = JSON.parse(JSON.stringify(_this4.state.schedule));
|
|
763
|
-
_schedule.period.yearMonth = e.target.value;
|
|
764
|
-
_this4.onChange(_schedule);
|
|
765
|
-
}
|
|
766
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
767
|
-
key: "every",
|
|
768
|
-
value: 0
|
|
769
|
-
}, _i18n["default"].t('sch_yearEveryMonth')), MONTHS.map(function (month, i) {
|
|
770
|
-
return /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
771
|
-
key: month,
|
|
772
|
-
value: i + 1
|
|
773
|
-
}, _i18n["default"].t(month));
|
|
774
|
-
})))))];
|
|
775
|
-
}
|
|
776
|
-
}, {
|
|
777
|
-
key: "getPeriodSettingsMinutes",
|
|
778
|
-
value: function getPeriodSettingsMinutes() {
|
|
779
|
-
var _this5 = this;
|
|
780
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
781
|
-
style: {
|
|
782
|
-
display: 'inline-block'
|
|
246
|
+
else if (typeof this.props.schedule === 'object') {
|
|
247
|
+
schedule = this.props.schedule;
|
|
783
248
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
verticalAlign: 'bottom'
|
|
788
|
-
},
|
|
789
|
-
className: this.props.classes.inputEvery,
|
|
790
|
-
type: "number",
|
|
791
|
-
min: 1,
|
|
792
|
-
onChange: function onChange(e) {
|
|
793
|
-
var _schedule = JSON.parse(JSON.stringify(_this5.state.schedule));
|
|
794
|
-
_schedule.time.interval = parseInt(e.target.value, 10);
|
|
795
|
-
_this5.onChange(_schedule);
|
|
249
|
+
if ((!schedule || !Object.keys(schedule).length)) {
|
|
250
|
+
setTimeout(() => this.onChange(this.state.schedule, true), 200);
|
|
251
|
+
schedule = DEFAULT;
|
|
796
252
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
253
|
+
schedule = Object.assign(Object.assign({}, DEFAULT), schedule);
|
|
254
|
+
schedule.valid.from = schedule.valid.from || Schedule.now2string();
|
|
255
|
+
this.refFrom = react_1.default.createRef();
|
|
256
|
+
this.refTo = react_1.default.createRef();
|
|
257
|
+
this.refOnce = react_1.default.createRef();
|
|
258
|
+
this.state = {
|
|
259
|
+
schedule,
|
|
260
|
+
desc: Schedule.state2text(schedule),
|
|
261
|
+
};
|
|
262
|
+
if (JSON.stringify(schedule) !== this.props.schedule) {
|
|
263
|
+
setTimeout(() => this.props.onChange && this.props.onChange(JSON.stringify(schedule)), 100);
|
|
804
264
|
}
|
|
805
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
806
|
-
value: PERIODS.minutes
|
|
807
|
-
}, _i18n["default"].t('sch_periodMinutes')), /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
808
|
-
value: PERIODS.hours
|
|
809
|
-
}, _i18n["default"].t('sch_periodHours'))));
|
|
810
265
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
822
|
-
className: this.props.classes.inputRadio,
|
|
823
|
-
checked: schedule.period.dows === '[1, 2, 3, 4, 5]',
|
|
824
|
-
onClick: function onClick() {
|
|
825
|
-
var _schedule = JSON.parse(JSON.stringify(_this6.state.schedule));
|
|
826
|
-
_schedule.period.dows = '[1, 2, 3, 4, 5]';
|
|
827
|
-
if (_schedule.period.days) {
|
|
828
|
-
_schedule.period.days = 1;
|
|
266
|
+
onChange(schedule, force) {
|
|
267
|
+
const isDiff = JSON.stringify(schedule) !== JSON.stringify(this.state.schedule);
|
|
268
|
+
if (force || isDiff) {
|
|
269
|
+
isDiff && this.setState({ schedule, desc: Schedule.state2text(schedule) });
|
|
270
|
+
const copy = JSON.parse(JSON.stringify(schedule));
|
|
271
|
+
if (copy.period.once) {
|
|
272
|
+
const once = copy.period.once;
|
|
273
|
+
delete copy.period;
|
|
274
|
+
copy.period = { once };
|
|
275
|
+
delete copy.valid;
|
|
829
276
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
className: this.props.classes.inputRadio,
|
|
839
|
-
checked: schedule.period.dows === '[0, 6]',
|
|
840
|
-
onClick: function onClick() {
|
|
841
|
-
var _schedule = JSON.parse(JSON.stringify(_this6.state.schedule));
|
|
842
|
-
_schedule.period.dows = '[0, 6]';
|
|
843
|
-
if (_schedule.period.days) {
|
|
844
|
-
_schedule.period.days = 1;
|
|
277
|
+
else if (copy.period.days) {
|
|
278
|
+
const days = copy.period.days;
|
|
279
|
+
const daysOfWeek = copy.period.dows;
|
|
280
|
+
delete copy.period;
|
|
281
|
+
copy.period = { days };
|
|
282
|
+
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
283
|
+
copy.period.dows = daysOfWeek;
|
|
284
|
+
}
|
|
845
285
|
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
856
|
-
style: {
|
|
857
|
-
verticalAlign: 'top'
|
|
858
|
-
},
|
|
859
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
860
|
-
className: this.props.classes.inputRadio,
|
|
861
|
-
checked: !!isSpecific,
|
|
862
|
-
onClick: function onClick() {
|
|
863
|
-
var _schedule = JSON.parse(JSON.stringify(_this6.state.schedule));
|
|
864
|
-
_schedule.period.dows = '[0,1,2,3,4,5,6]';
|
|
865
|
-
if (_schedule.period.days) {
|
|
866
|
-
_schedule.period.days = 1;
|
|
286
|
+
else if (copy.period.weeks) {
|
|
287
|
+
const weeks = copy.period.weeks;
|
|
288
|
+
const daysOfWeek = copy.period.dows;
|
|
289
|
+
delete copy.period;
|
|
290
|
+
copy.period = { weeks };
|
|
291
|
+
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
292
|
+
copy.period.dows = daysOfWeek;
|
|
293
|
+
}
|
|
867
294
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
width: 150
|
|
877
|
-
}
|
|
878
|
-
}, [1, 2, 3, 4, 5, 6, 0].map(function (i) {
|
|
879
|
-
return /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
880
|
-
key: "specific_".concat(i),
|
|
881
|
-
className: _this6.props.classes.inputGroupElement,
|
|
882
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
883
|
-
className: _this6.props.classes.inputSmallCheck,
|
|
884
|
-
checked: schedule.period.dows.includes(i.toString()),
|
|
885
|
-
onChange: function onChange(e) {
|
|
886
|
-
var _schedule = JSON.parse(JSON.stringify(_this6.state.schedule));
|
|
887
|
-
var dows;
|
|
888
|
-
try {
|
|
889
|
-
dows = JSON.parse(_schedule.period.dows);
|
|
890
|
-
} catch (err) {
|
|
891
|
-
dows = [];
|
|
892
|
-
}
|
|
893
|
-
if (e.target.checked && !dows.includes(i)) {
|
|
894
|
-
dows.push(i);
|
|
895
|
-
} else if (!e.target.checked && dows.includes(i)) {
|
|
896
|
-
dows.splice(dows.indexOf(i), 1);
|
|
897
|
-
}
|
|
898
|
-
dows.sort(function (a, b) {
|
|
899
|
-
return a - b;
|
|
900
|
-
});
|
|
901
|
-
_schedule.period.dows = JSON.stringify(dows);
|
|
902
|
-
if (_schedule.period.days) {
|
|
903
|
-
_schedule.period.days = 1;
|
|
904
|
-
}
|
|
905
|
-
_this6.onChange(_schedule);
|
|
295
|
+
else if (copy.period.months) {
|
|
296
|
+
const months = copy.period.months;
|
|
297
|
+
const dates = copy.period.dates;
|
|
298
|
+
delete copy.period;
|
|
299
|
+
copy.period = { months };
|
|
300
|
+
if (dates && dates !== '[]') {
|
|
301
|
+
copy.period.dates = dates;
|
|
302
|
+
}
|
|
906
303
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
}
|
|
946
|
-
}),
|
|
947
|
-
label: _i18n["default"].t('sch_periodEvery')
|
|
948
|
-
}), schedule.period.days > 1 && [/*#__PURE__*/_react["default"].createElement(_material.Input, {
|
|
949
|
-
key: "input",
|
|
950
|
-
value: this.state.schedule.period.days,
|
|
951
|
-
className: this.props.classes.inputEvery,
|
|
952
|
-
type: "number",
|
|
953
|
-
min: 2,
|
|
954
|
-
onChange: function onChange(e) {
|
|
955
|
-
var _schedule = JSON.parse(JSON.stringify(_this7.state.schedule));
|
|
956
|
-
_schedule.period.days = parseInt(e.target.value, 10);
|
|
957
|
-
_schedule.period.dows = '';
|
|
958
|
-
_this7.onChange(_schedule);
|
|
959
|
-
}
|
|
960
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
961
|
-
key: "span",
|
|
962
|
-
style: {
|
|
963
|
-
paddingRight: 10
|
|
304
|
+
else if (copy.period.years) {
|
|
305
|
+
const years = copy.period.years;
|
|
306
|
+
const yearMonth = copy.period.yearMonth;
|
|
307
|
+
const yearDate = copy.period.yearDate;
|
|
308
|
+
delete copy.period;
|
|
309
|
+
copy.period = { years, yearDate };
|
|
310
|
+
if (yearMonth) {
|
|
311
|
+
copy.period.yearMonth = yearMonth;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (copy.time.exactTime) {
|
|
315
|
+
delete copy.time.end;
|
|
316
|
+
delete copy.time.mode;
|
|
317
|
+
delete copy.time.interval;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
delete copy.time.exactTime;
|
|
321
|
+
}
|
|
322
|
+
if (copy.valid) {
|
|
323
|
+
if (!copy.valid.to) {
|
|
324
|
+
delete copy.valid.to;
|
|
325
|
+
}
|
|
326
|
+
if (copy.period.days === 1 || copy.period.weeks === 1 || copy.period.months === 1 || copy.period.years === 1) {
|
|
327
|
+
const from = Schedule.string2date(copy.valid.from);
|
|
328
|
+
const today = new Date();
|
|
329
|
+
today.setHours(0);
|
|
330
|
+
today.setMinutes(0);
|
|
331
|
+
today.setSeconds(0);
|
|
332
|
+
today.setMilliseconds(0);
|
|
333
|
+
if (from <= today) {
|
|
334
|
+
delete copy.valid.from;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (!copy.valid.from && !copy.valid.to) {
|
|
338
|
+
delete copy.valid;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
this.props.onChange && this.props.onChange(JSON.stringify(copy), Schedule.state2text(schedule));
|
|
964
342
|
}
|
|
965
|
-
}, _i18n["default"].t('sch_periodDay'))])];
|
|
966
343
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
976
|
-
key: "radios",
|
|
977
|
-
style: {
|
|
978
|
-
display: 'inline-block',
|
|
979
|
-
verticalAlign: 'top'
|
|
344
|
+
static state2text(schedule) {
|
|
345
|
+
if (typeof schedule === 'string') {
|
|
346
|
+
try {
|
|
347
|
+
schedule = JSON.parse(schedule);
|
|
348
|
+
}
|
|
349
|
+
catch (e) {
|
|
350
|
+
return '';
|
|
351
|
+
}
|
|
980
352
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
_schedule.period.weeks = 2;
|
|
999
|
-
_this8.onChange(_schedule);
|
|
1000
|
-
}
|
|
1001
|
-
}),
|
|
1002
|
-
label: _i18n["default"].t('sch_periodEvery')
|
|
1003
|
-
}), schedule.period.weeks > 1 && [/*#__PURE__*/_react["default"].createElement(_material.Input, {
|
|
1004
|
-
key: "input",
|
|
1005
|
-
value: this.state.schedule.period.weeks,
|
|
1006
|
-
className: this.props.classes.inputEvery,
|
|
1007
|
-
type: "number",
|
|
1008
|
-
min: 2,
|
|
1009
|
-
onChange: function onChange(e) {
|
|
1010
|
-
var _schedule = JSON.parse(JSON.stringify(_this8.state.schedule));
|
|
1011
|
-
_schedule.period.weeks = parseInt(e.target.value, 10);
|
|
1012
|
-
_this8.onChange(_schedule);
|
|
353
|
+
const desc = [];
|
|
354
|
+
const validFrom = Schedule.string2date(schedule.valid.from);
|
|
355
|
+
if (schedule.period.once) {
|
|
356
|
+
// once
|
|
357
|
+
const once = Schedule.string2date(schedule.period.once);
|
|
358
|
+
const now = new Date();
|
|
359
|
+
now.setMilliseconds(0);
|
|
360
|
+
now.setSeconds(0);
|
|
361
|
+
now.setMinutes(0);
|
|
362
|
+
now.setHours(0);
|
|
363
|
+
//
|
|
364
|
+
if (once < now) {
|
|
365
|
+
// will be not executed anymore, because start is in the past
|
|
366
|
+
return i18n_1.default.t('sch_desc_onceInPast');
|
|
367
|
+
}
|
|
368
|
+
// only once
|
|
369
|
+
desc.push(i18n_1.default.t('sch_desc_once_on', schedule.period.once));
|
|
1013
370
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
371
|
+
else if (schedule.period.days) {
|
|
372
|
+
if (schedule.period.days === 1) {
|
|
373
|
+
if (schedule.period.dows) {
|
|
374
|
+
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
375
|
+
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
376
|
+
// on weekends
|
|
377
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekends'));
|
|
378
|
+
}
|
|
379
|
+
else if (daysOfWeek.length === 5 && daysOfWeek[0] === 1 && daysOfWeek[1] === 2 && daysOfWeek[2] === 3 && daysOfWeek[3] === 4 && daysOfWeek[4] === 5) {
|
|
380
|
+
// on workdays
|
|
381
|
+
desc.push(i18n_1.default.t('sch_desc_onWorkdays'));
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const tDows = daysOfWeek.map((day) => i18n_1.default.t(WEEKDAYS[day]));
|
|
385
|
+
if (tDows.length === 1) {
|
|
386
|
+
// on Monday
|
|
387
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekday', tDows[0]));
|
|
388
|
+
}
|
|
389
|
+
else if (tDows.length === 7) {
|
|
390
|
+
// on every day
|
|
391
|
+
desc.push(i18n_1.default.t('sch_desc_everyDay'));
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
const last = tDows.pop();
|
|
395
|
+
// on Monday and Sunday
|
|
396
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
desc.push(i18n_1.default.t('sch_desc_everyDay'));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
desc.push(i18n_1.default.t('sch_desc_everyNDay', schedule.period.days.toString()));
|
|
406
|
+
}
|
|
1036
407
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1041
|
-
checked: parsedDates.length === 31,
|
|
1042
|
-
onChange: function onChange() {
|
|
1043
|
-
var _schedule = JSON.parse(JSON.stringify(_this9.state.schedule));
|
|
1044
|
-
var _dates = [];
|
|
1045
|
-
for (var _i = 1; _i <= 31; _i++) {
|
|
1046
|
-
_dates.push(_i);
|
|
408
|
+
else if (schedule.period.weeks) {
|
|
409
|
+
if (schedule.period.weeks === 1) {
|
|
410
|
+
desc.push(i18n_1.default.t('sch_desc_everyWeek'));
|
|
1047
411
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
}),
|
|
1052
|
-
label: _i18n["default"].t('sch_all')
|
|
1053
|
-
}), /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1054
|
-
className: this.props.classes.inputDateDay,
|
|
1055
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
1056
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1057
|
-
checked: !parsedDates.length,
|
|
1058
|
-
onChange: function onChange() {
|
|
1059
|
-
var _schedule = JSON.parse(JSON.stringify(_this9.state.schedule));
|
|
1060
|
-
_schedule.period.dates = '[]';
|
|
1061
|
-
_this9.onChange(_schedule);
|
|
1062
|
-
}
|
|
1063
|
-
}),
|
|
1064
|
-
label: _i18n["default"].t('sch_no_one')
|
|
1065
|
-
}), parsedDates.length !== 31 && !!parsedDates.length && /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1066
|
-
className: this.props.classes.inputDateDay,
|
|
1067
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
1068
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1069
|
-
checked: false,
|
|
1070
|
-
onChange: function onChange() {
|
|
1071
|
-
var _schedule = JSON.parse(JSON.stringify(_this9.state.schedule));
|
|
1072
|
-
var result = [];
|
|
1073
|
-
var _parsedDates = JSON.parse(_schedule.period.dates);
|
|
1074
|
-
for (var _i2 = 1; _i2 <= 31; _i2++) {
|
|
1075
|
-
if (!_parsedDates.includes(_i2)) {
|
|
1076
|
-
result.push(_i2);
|
|
1077
|
-
}
|
|
412
|
+
else {
|
|
413
|
+
desc.push(i18n_1.default.t('sch_desc_everyNWeeks', schedule.period.weeks.toString()));
|
|
1078
414
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
} catch (err) {
|
|
1106
|
-
_dates = [];
|
|
1107
|
-
}
|
|
1108
|
-
if (e.target.checked && !_dates.includes(i)) {
|
|
1109
|
-
_dates.push(i);
|
|
1110
|
-
} else if (!e.target.checked && _dates.includes(i)) {
|
|
1111
|
-
_dates.splice(_dates.indexOf(i), 1);
|
|
1112
|
-
}
|
|
1113
|
-
_dates.sort(function (a, b) {
|
|
1114
|
-
return a - b;
|
|
1115
|
-
});
|
|
1116
|
-
_schedule.period.dates = JSON.stringify(_dates);
|
|
1117
|
-
_this9.onChange(_schedule);
|
|
415
|
+
if (schedule.period.dows) {
|
|
416
|
+
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
417
|
+
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
418
|
+
// on weekends
|
|
419
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekends'));
|
|
420
|
+
}
|
|
421
|
+
else if (daysOfWeek.length === 5 && daysOfWeek[0] === 1 && daysOfWeek[1] === 2 && daysOfWeek[2] === 3 && daysOfWeek[3] === 4 && daysOfWeek[4] === 5) {
|
|
422
|
+
// on workdays
|
|
423
|
+
desc.push(i18n_1.default.t('sch_desc_onWorkdays'));
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
const tDows = daysOfWeek.map((day) => i18n_1.default.t(WEEKDAYS[day]));
|
|
427
|
+
if (tDows.length === 1) {
|
|
428
|
+
// on Monday
|
|
429
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekday', tDows[0]));
|
|
430
|
+
}
|
|
431
|
+
else if (tDows.length === 7) {
|
|
432
|
+
// on every day
|
|
433
|
+
desc.push(i18n_1.default.t('sch_desc_everyDay'));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
const last = tDows.pop();
|
|
437
|
+
// on Monday and Sunday
|
|
438
|
+
desc.push(i18n_1.default.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
1118
441
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
key: "0",
|
|
1122
|
-
style: {
|
|
1123
|
-
opacity: 0
|
|
442
|
+
else {
|
|
443
|
+
return i18n_1.default.t('sch_desc_never');
|
|
1124
444
|
}
|
|
1125
|
-
}, "0"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1126
|
-
key: "num"
|
|
1127
|
-
}, i)] : i
|
|
1128
|
-
});
|
|
1129
|
-
}));
|
|
1130
|
-
}
|
|
1131
|
-
}, {
|
|
1132
|
-
key: "getPeriodSettingsMonthly",
|
|
1133
|
-
value: function getPeriodSettingsMonthly() {
|
|
1134
|
-
var _this10 = this;
|
|
1135
|
-
if (!this.state.schedule.period.months) {
|
|
1136
|
-
return null;
|
|
1137
|
-
}
|
|
1138
|
-
var schedule = this.state.schedule;
|
|
1139
|
-
var parsedMonths = typeof schedule.period.months === 'string' ? JSON.parse(schedule.period.months) : [];
|
|
1140
|
-
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
1141
|
-
key: "every"
|
|
1142
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1143
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
1144
|
-
className: this.props.classes.inputRadio,
|
|
1145
|
-
checked: typeof schedule.period.months === 'number' && schedule.period.months === 1,
|
|
1146
|
-
onClick: function onClick() {
|
|
1147
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1148
|
-
_schedule.period.months = 1;
|
|
1149
|
-
_this10.onChange(schedule);
|
|
1150
|
-
}
|
|
1151
|
-
}),
|
|
1152
|
-
label: _i18n["default"].t('sch_periodEveryMonth')
|
|
1153
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1154
|
-
key: "everyN"
|
|
1155
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1156
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
1157
|
-
className: this.props.classes.inputRadio,
|
|
1158
|
-
checked: typeof schedule.period.months === 'number' && schedule.period.months > 1,
|
|
1159
|
-
onClick: function onClick() {
|
|
1160
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1161
|
-
_schedule.period.months = 2;
|
|
1162
|
-
_this10.onChange(_schedule);
|
|
1163
|
-
}
|
|
1164
|
-
}),
|
|
1165
|
-
label: _i18n["default"].t('sch_periodEvery')
|
|
1166
|
-
}), typeof schedule.period.months === 'number' && schedule.period.months > 1 && [/*#__PURE__*/_react["default"].createElement(_material.Input, {
|
|
1167
|
-
key: "input",
|
|
1168
|
-
value: schedule.period.months,
|
|
1169
|
-
className: this.props.classes.inputEvery,
|
|
1170
|
-
type: "number",
|
|
1171
|
-
min: 2,
|
|
1172
|
-
onChange: function onChange(e) {
|
|
1173
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1174
|
-
_schedule.period.months = parseInt(e.target.value, 10);
|
|
1175
|
-
if (_schedule.period.months < 1) _schedule.period.months = 1;
|
|
1176
|
-
_this10.onChange(_schedule);
|
|
1177
|
-
}
|
|
1178
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1179
|
-
key: "text"
|
|
1180
|
-
}, _i18n["default"].t('sch_periodMonth'))]), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1181
|
-
key: "specific",
|
|
1182
|
-
style: {
|
|
1183
|
-
verticalAlign: 'top'
|
|
1184
445
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
className: this.props.classes.inputDateDay,
|
|
1204
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
1205
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1206
|
-
checked: parsedMonths.length === 12,
|
|
1207
|
-
onChange: function onChange() {
|
|
1208
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1209
|
-
var months = [];
|
|
1210
|
-
for (var i = 1; i <= 12; i++) {
|
|
1211
|
-
months.push(i);
|
|
446
|
+
else if (schedule.period.months) {
|
|
447
|
+
if (schedule.period.dates) {
|
|
448
|
+
const dates = JSON.parse(schedule.period.dates);
|
|
449
|
+
if (dates.length === 1) {
|
|
450
|
+
// in 1 of month
|
|
451
|
+
desc.push(i18n_1.default.t('sch_desc_onDate', dates[0]));
|
|
452
|
+
}
|
|
453
|
+
else if (dates.length === 31) {
|
|
454
|
+
desc.push(i18n_1.default.t('sch_desc_onEveryDate'));
|
|
455
|
+
}
|
|
456
|
+
else if (!dates.length) {
|
|
457
|
+
return i18n_1.default.t('sch_desc_never');
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
const last = dates.pop();
|
|
461
|
+
// in 1 and 4 of month
|
|
462
|
+
desc.push(i18n_1.default.t('sch_desc_onDates', dates.join(', '), last));
|
|
463
|
+
}
|
|
1212
464
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
}
|
|
1216
|
-
}),
|
|
1217
|
-
label: _i18n["default"].t('sch_all')
|
|
1218
|
-
}), /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1219
|
-
className: this.props.classes.inputDateDay,
|
|
1220
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
1221
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1222
|
-
checked: !parsedMonths.length,
|
|
1223
|
-
onChange: function onChange() {
|
|
1224
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1225
|
-
_schedule.period.months = '[]';
|
|
1226
|
-
_this10.onChange(_schedule);
|
|
1227
|
-
}
|
|
1228
|
-
}),
|
|
1229
|
-
label: _i18n["default"].t('sch_no_one')
|
|
1230
|
-
}), parsedMonths.length !== 12 && !!parsedMonths.length && /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1231
|
-
className: this.props.classes.inputDateDay,
|
|
1232
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
1233
|
-
className: this.props.classes.inputDateDayCheck,
|
|
1234
|
-
checked: false,
|
|
1235
|
-
onChange: function onChange() {
|
|
1236
|
-
var _schedule = JSON.parse(JSON.stringify(_this10.state.schedule));
|
|
1237
|
-
var result = [];
|
|
1238
|
-
var _parsedMonths = JSON.parse(_schedule.period.months);
|
|
1239
|
-
for (var i = 1; i <= 12; i++) {
|
|
1240
|
-
if (!_parsedMonths.includes(i)) {
|
|
1241
|
-
result.push(i);
|
|
1242
|
-
}
|
|
465
|
+
else {
|
|
466
|
+
desc.push(i18n_1.default.t('sch_desc_onEveryDate'));
|
|
1243
467
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1271
|
-
months.sort(function (a, b) {
|
|
1272
|
-
return a - b;
|
|
1273
|
-
});
|
|
1274
|
-
_schedule.period.months = JSON.stringify(months);
|
|
1275
|
-
_this10.onChange(_schedule);
|
|
468
|
+
if (schedule.period.months === 1) {
|
|
469
|
+
desc.push(i18n_1.default.t('sch_desc_everyMonth'));
|
|
470
|
+
}
|
|
471
|
+
else if (typeof schedule.period.months === 'number') {
|
|
472
|
+
desc.push(i18n_1.default.t('sch_desc_everyNMonths', schedule.period.months.toString()));
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
const months = JSON.parse(schedule.period.months);
|
|
476
|
+
const tMonths = months.map((month) => i18n_1.default.t(MONTHS[month - 1]));
|
|
477
|
+
if (!tMonths.length) {
|
|
478
|
+
// in January
|
|
479
|
+
return i18n_1.default.t('sch_desc_never');
|
|
480
|
+
}
|
|
481
|
+
if (tMonths.length === 1) {
|
|
482
|
+
// in January
|
|
483
|
+
desc.push(i18n_1.default.t('sch_desc_onMonth', tMonths[0]));
|
|
484
|
+
}
|
|
485
|
+
else if (tMonths.length === 12) {
|
|
486
|
+
// every month
|
|
487
|
+
desc.push(i18n_1.default.t('sch_desc_everyMonth'));
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
const last = tMonths.pop();
|
|
491
|
+
// in January and May
|
|
492
|
+
desc.push(i18n_1.default.t('sch_desc_onMonths', tMonths.join(', '), last));
|
|
493
|
+
}
|
|
1276
494
|
}
|
|
1277
|
-
}),
|
|
1278
|
-
label: _i18n["default"].t(month)
|
|
1279
|
-
});
|
|
1280
|
-
})))];
|
|
1281
|
-
}
|
|
1282
|
-
}, {
|
|
1283
|
-
key: "getPeriodSettingsYearly",
|
|
1284
|
-
value: function getPeriodSettingsYearly() {
|
|
1285
|
-
var _this11 = this;
|
|
1286
|
-
if (!this.state.schedule.period.years) {
|
|
1287
|
-
return null;
|
|
1288
|
-
}
|
|
1289
|
-
var schedule = this.state.schedule;
|
|
1290
|
-
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
1291
|
-
key: "year"
|
|
1292
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1293
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
1294
|
-
className: this.props.classes.inputRadio,
|
|
1295
|
-
checked: schedule.period.years === 1,
|
|
1296
|
-
onClick: function onClick() {
|
|
1297
|
-
var _schedule = JSON.parse(JSON.stringify(_this11.state.schedule));
|
|
1298
|
-
_schedule.period.years = 1;
|
|
1299
|
-
_this11.onChange(_schedule);
|
|
1300
|
-
}
|
|
1301
|
-
}),
|
|
1302
|
-
label: _i18n["default"].t('sch_periodEveryYear')
|
|
1303
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1304
|
-
key: "every"
|
|
1305
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
1306
|
-
control: /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
1307
|
-
className: this.props.classes.inputRadio,
|
|
1308
|
-
checked: schedule.period.years > 1,
|
|
1309
|
-
onClick: function onClick() {
|
|
1310
|
-
var _schedule = JSON.parse(JSON.stringify(_this11.state.schedule));
|
|
1311
|
-
_schedule.period.years = 2;
|
|
1312
|
-
_this11.onChange(_schedule);
|
|
1313
|
-
}
|
|
1314
|
-
}),
|
|
1315
|
-
label: _i18n["default"].t('sch_periodEvery')
|
|
1316
|
-
}), schedule.period.years > 1 && [/*#__PURE__*/_react["default"].createElement(_material.Input, {
|
|
1317
|
-
key: "input",
|
|
1318
|
-
value: this.state.schedule.period.years,
|
|
1319
|
-
className: this.props.classes.inputEvery,
|
|
1320
|
-
type: "number",
|
|
1321
|
-
min: 2,
|
|
1322
|
-
onChange: function onChange(e) {
|
|
1323
|
-
var _schedule = JSON.parse(JSON.stringify(_this11.state.schedule));
|
|
1324
|
-
_schedule.period.years = parseInt(e.target.value, 10);
|
|
1325
|
-
if (_schedule.period.years < 1) _schedule.period.years = 1;
|
|
1326
|
-
_this11.onChange(_schedule);
|
|
1327
495
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
var schedule = this.state.schedule;
|
|
1337
|
-
// ----- from ---
|
|
1338
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1339
|
-
className: this.props.classes.rowDiv
|
|
1340
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1341
|
-
className: this.props.classes.modeDiv,
|
|
1342
|
-
style: {
|
|
1343
|
-
verticalAlign: 'middle'
|
|
496
|
+
else if (schedule.period.years) {
|
|
497
|
+
if (schedule.period.years === 1) {
|
|
498
|
+
desc.push(i18n_1.default.t('sch_desc_everyYear'));
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
desc.push(i18n_1.default.t('sch_desc_everyNYears', schedule.period.years.toString()));
|
|
502
|
+
}
|
|
503
|
+
desc.push(i18n_1.default.t('sch_desc_onDate', schedule.period.yearDate.toString(), schedule.period.yearMonth ? i18n_1.default.t(MONTHS[schedule.period.yearMonth - 1]) : i18n_1.default.t('sch_desc_everyMonth')));
|
|
1344
504
|
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
505
|
+
// time
|
|
506
|
+
if (schedule.time.exactTime) {
|
|
507
|
+
if (ASTRO.indexOf(schedule.time.start) !== -1) {
|
|
508
|
+
// at sunset
|
|
509
|
+
desc.push(i18n_1.default.t('sch_desc_atTime', i18n_1.default.t(`sch_astro_${schedule.time.start}`)));
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
// at HH:MM
|
|
513
|
+
desc.push(i18n_1.default.t('sch_desc_atTime', schedule.time.start));
|
|
514
|
+
}
|
|
1349
515
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
defaultValue: string2USdate(schedule.valid.from),
|
|
1361
|
-
type: "date"
|
|
1362
|
-
// inputComponent={TextDate}
|
|
1363
|
-
,
|
|
1364
|
-
onChange: function onChange(e) {
|
|
1365
|
-
_this12.timerFrom && clearTimeout(_this12.timerFrom);
|
|
1366
|
-
_this12.refFrom.current.style.background = '#ff000030';
|
|
1367
|
-
_this12.timerFrom = setTimeout(function (value) {
|
|
1368
|
-
_this12.timerFrom = null;
|
|
1369
|
-
_this12.refFrom.current.style.background = '';
|
|
1370
|
-
var _schedule = JSON.parse(JSON.stringify(_this12.state.schedule));
|
|
1371
|
-
var date = Schedule.string2date(value);
|
|
1372
|
-
if (date.toString() !== 'Invalid Date') {
|
|
1373
|
-
_schedule.valid.from = "".concat(padding(date.getDate()), ".").concat(padding(date.getMonth() + 1), ".").concat(date.getFullYear());
|
|
1374
|
-
_this12.onChange(_schedule);
|
|
516
|
+
else {
|
|
517
|
+
if (schedule.time.mode === PERIODS.minutes) {
|
|
518
|
+
if (schedule.time.interval === 1) {
|
|
519
|
+
// every minute
|
|
520
|
+
desc.push(i18n_1.default.t('sch_desc_everyMinute'));
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
// every N minutes
|
|
524
|
+
desc.push(i18n_1.default.t('sch_desc_everyNMinutes', schedule.time.interval.toString()));
|
|
525
|
+
}
|
|
1375
526
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
,
|
|
1405
|
-
onChange: function onChange(e) {
|
|
1406
|
-
_this12.timerTo && clearTimeout(_this12.timerTo);
|
|
1407
|
-
_this12.refTo.current.style.background = '#ff000030';
|
|
1408
|
-
_this12.timerTo = setTimeout(function (value) {
|
|
1409
|
-
_this12.timerTo = null;
|
|
1410
|
-
_this12.refTo.current.style.background = '';
|
|
1411
|
-
var _schedule = JSON.parse(JSON.stringify(_this12.state.schedule));
|
|
1412
|
-
var date = Schedule.string2date(value);
|
|
1413
|
-
if (date.toString() !== 'Invalid Date') {
|
|
1414
|
-
_schedule.valid.to = "".concat(padding(date.getDate()), ".").concat(padding(date.getMonth() + 1), ".").concat(date.getFullYear());
|
|
1415
|
-
_this12.onChange(_schedule);
|
|
527
|
+
else if (schedule.time.interval === 1) {
|
|
528
|
+
// every minute
|
|
529
|
+
desc.push(i18n_1.default.t('sch_desc_everyHour'));
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
// every N minutes
|
|
533
|
+
desc.push(i18n_1.default.t('sch_desc_everyNHours', schedule.time.interval.toString()));
|
|
534
|
+
}
|
|
535
|
+
const start = ASTRO.indexOf(schedule.time.start) !== -1 ? i18n_1.default.t(`sch_astro_${schedule.time.start}`) : schedule.time.start;
|
|
536
|
+
const end = ASTRO.indexOf(schedule.time.end) !== -1 ? i18n_1.default.t(`sch_astro_${schedule.time.end}`) : schedule.time.end;
|
|
537
|
+
if (start !== '00:00' || (end !== '24:00' && end !== '23:59')) {
|
|
538
|
+
// from HH:mm to HH:mm
|
|
539
|
+
desc.push(i18n_1.default.t('sch_desc_intervalFromTo', start, end));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (!schedule.period.once) {
|
|
543
|
+
// valid
|
|
544
|
+
if (validFrom.getTime() > Date.now() && schedule.valid.to) {
|
|
545
|
+
// from XXX to XXXX
|
|
546
|
+
desc.push(i18n_1.default.t('sch_desc_validFromTo', schedule.valid.from, schedule.valid.to));
|
|
547
|
+
}
|
|
548
|
+
else if (validFrom.getTime() > Date.now()) {
|
|
549
|
+
// from XXXX
|
|
550
|
+
desc.push(i18n_1.default.t('sch_desc_validFrom', schedule.valid.from));
|
|
551
|
+
}
|
|
552
|
+
else if (schedule.valid.to) {
|
|
553
|
+
// till XXXX
|
|
554
|
+
desc.push(i18n_1.default.t('sch_desc_validTo', schedule.valid.to));
|
|
1416
555
|
}
|
|
1417
|
-
}, 1500, e.target.value);
|
|
1418
|
-
},
|
|
1419
|
-
InputLabelProps: {
|
|
1420
|
-
shrink: true
|
|
1421
|
-
},
|
|
1422
|
-
margin: "normal"
|
|
1423
|
-
})));
|
|
1424
|
-
}
|
|
1425
|
-
}, {
|
|
1426
|
-
key: "render",
|
|
1427
|
-
value: function render() {
|
|
1428
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1429
|
-
style: {
|
|
1430
|
-
height: 'calc(100% - 48px)',
|
|
1431
|
-
width: '100%',
|
|
1432
|
-
overflow: 'hidden'
|
|
1433
556
|
}
|
|
1434
|
-
|
|
1435
|
-
className: this.props.classes.scrollWindow
|
|
1436
|
-
}, /*#__PURE__*/_react["default"].createElement("h5", null, _i18n["default"].t('sch_time')), this.getTimePeriodElements(), this.getTimeExactElements(), this.getDivider(), /*#__PURE__*/_react["default"].createElement("h5", null, _i18n["default"].t('sch_period')), this.getPeriodModes(), !this.state.schedule.period.once && this.getDivider(), !this.state.schedule.period.once && this.getValidSettings()));
|
|
557
|
+
return desc.join(' ');
|
|
1437
558
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
559
|
+
getTimePeriodElements() {
|
|
560
|
+
const schedule = this.state.schedule;
|
|
561
|
+
let wholeDay = false;
|
|
562
|
+
let day = false;
|
|
563
|
+
let night = false;
|
|
564
|
+
let fromTo = true;
|
|
565
|
+
if (schedule.time.start === '00:00' && schedule.time.end === '24:00') {
|
|
566
|
+
wholeDay = true;
|
|
567
|
+
fromTo = false;
|
|
1446
568
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
if (schedule.period.once) {
|
|
1451
|
-
// once
|
|
1452
|
-
var once = Schedule.string2date(schedule.period.once);
|
|
1453
|
-
var now = new Date();
|
|
1454
|
-
now.setMilliseconds(0);
|
|
1455
|
-
now.setSeconds(0);
|
|
1456
|
-
now.setMinutes(0);
|
|
1457
|
-
now.setHours(0);
|
|
1458
|
-
|
|
1459
|
-
//
|
|
1460
|
-
if (once < now) {
|
|
1461
|
-
// will be not executed anymore, because start is in the past
|
|
1462
|
-
return _i18n["default"].t('sch_desc_onceInPast');
|
|
569
|
+
else if (schedule.time.start === 'sunrise') {
|
|
570
|
+
day = true;
|
|
571
|
+
fromTo = false;
|
|
1463
572
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
if (schedule.period.days === 1) {
|
|
1468
|
-
if (schedule.period.dows) {
|
|
1469
|
-
var dows = JSON.parse(schedule.period.dows);
|
|
1470
|
-
if (dows.length === 2 && dows[0] === 0 && dows[1] === 6) {
|
|
1471
|
-
// on weekends
|
|
1472
|
-
desc.push(_i18n["default"].t('sch_desc_onWeekends'));
|
|
1473
|
-
} else if (dows.length === 5 && dows[0] === 1 && dows[1] === 2 && dows[2] === 3 && dows[3] === 4 && dows[4] === 5) {
|
|
1474
|
-
// on workdays
|
|
1475
|
-
desc.push(_i18n["default"].t('sch_desc_onWorkdays'));
|
|
1476
|
-
} else {
|
|
1477
|
-
var tDows = dows.map(function (day) {
|
|
1478
|
-
return _i18n["default"].t(WEEKDAYS[day]);
|
|
1479
|
-
});
|
|
1480
|
-
if (tDows.length === 1) {
|
|
1481
|
-
// on Monday
|
|
1482
|
-
desc.push(_i18n["default"].t('sch_desc_onWeekday', tDows[0]));
|
|
1483
|
-
} else if (tDows.length === 7) {
|
|
1484
|
-
// on every day
|
|
1485
|
-
desc.push(_i18n["default"].t('sch_desc_everyDay'));
|
|
1486
|
-
} else {
|
|
1487
|
-
var last = tDows.pop();
|
|
1488
|
-
// on Monday and Sunday
|
|
1489
|
-
desc.push(_i18n["default"].t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
} else {
|
|
1493
|
-
desc.push(_i18n["default"].t('sch_desc_everyDay'));
|
|
1494
|
-
}
|
|
1495
|
-
} else {
|
|
1496
|
-
desc.push(_i18n["default"].t('sch_desc_everyNDay', schedule.period.days));
|
|
573
|
+
else if (schedule.time.start === 'sunset') {
|
|
574
|
+
night = true;
|
|
575
|
+
fromTo = false;
|
|
1497
576
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
577
|
+
return react_1.default.createElement("div", { key: "timePeriod", className: this.props.classes.rowDiv },
|
|
578
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
579
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !schedule.time.exactTime, onClick: () => {
|
|
580
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
581
|
+
_schedule.time.exactTime = false;
|
|
582
|
+
this.onChange(_schedule);
|
|
583
|
+
} }), label: i18n_1.default.t('sch_intervalTime') })),
|
|
584
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
585
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
586
|
+
!schedule.time.exactTime && react_1.default.createElement("div", null,
|
|
587
|
+
react_1.default.createElement("div", null,
|
|
588
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!fromTo, onClick: () => {
|
|
589
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
590
|
+
_schedule.time.start = '00:00';
|
|
591
|
+
_schedule.time.end = '23:59';
|
|
592
|
+
this.onChange(_schedule);
|
|
593
|
+
} }), label: !fromTo ? i18n_1.default.t('sch_fromTo') : '' }),
|
|
594
|
+
fromTo && [
|
|
595
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.inputTime, style: { marginRight: 10 }, key: "exactTimeFrom", type: "time", value: this.state.schedule.time.start,
|
|
596
|
+
// InputProps={{inputComponent: TextTime}}
|
|
597
|
+
onChange: e => {
|
|
598
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
599
|
+
_schedule.time.start = e.target.value;
|
|
600
|
+
this.onChange(_schedule);
|
|
601
|
+
}, InputLabelProps: { shrink: true }, label: i18n_1.default.t('sch_from'), margin: "normal" }),
|
|
602
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.inputTime, key: "exactTimeTo", type: "time", value: this.state.schedule.time.end,
|
|
603
|
+
// InputProps={{inputComponent: TextTime}}
|
|
604
|
+
onChange: e => {
|
|
605
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
606
|
+
_schedule.time.end = e.target.value;
|
|
607
|
+
this.onChange(_schedule);
|
|
608
|
+
}, InputLabelProps: { shrink: true }, label: i18n_1.default.t('sch_to'), margin: "normal" }),
|
|
609
|
+
])),
|
|
610
|
+
!schedule.time.exactTime && react_1.default.createElement("div", null,
|
|
611
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!wholeDay, onClick: () => {
|
|
612
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
613
|
+
_schedule.time.start = '00:00';
|
|
614
|
+
_schedule.time.end = '24:00';
|
|
615
|
+
this.onChange(_schedule);
|
|
616
|
+
} }), label: i18n_1.default.t('sch_wholeDay') })),
|
|
617
|
+
!schedule.time.exactTime && react_1.default.createElement("div", null,
|
|
618
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!day, onClick: () => {
|
|
619
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
620
|
+
_schedule.time.start = 'sunrise';
|
|
621
|
+
_schedule.time.end = 'sunset';
|
|
622
|
+
this.onChange(_schedule);
|
|
623
|
+
} }), label: i18n_1.default.t('sch_astroDay') })),
|
|
624
|
+
!schedule.time.exactTime && react_1.default.createElement("div", null,
|
|
625
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!night, onClick: () => {
|
|
626
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
627
|
+
_schedule.time.start = 'sunset';
|
|
628
|
+
_schedule.time.end = 'sunrise';
|
|
629
|
+
this.onChange(_schedule);
|
|
630
|
+
} }), label: i18n_1.default.t('sch_astroNight') }))),
|
|
631
|
+
!schedule.time.exactTime && this.getPeriodSettingsMinutes()));
|
|
632
|
+
}
|
|
633
|
+
getTimeExactElements() {
|
|
634
|
+
const isAstro = ASTRO.includes(this.state.schedule.time.start);
|
|
635
|
+
return react_1.default.createElement("div", { key: "timeExact", className: this.props.classes.rowDiv },
|
|
636
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
637
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!this.state.schedule.time.exactTime, onClick: () => {
|
|
638
|
+
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
639
|
+
schedule.time.exactTime = true;
|
|
640
|
+
this.onChange(schedule);
|
|
641
|
+
} }), label: i18n_1.default.t('sch_exactTime') })),
|
|
642
|
+
this.state.schedule.time.exactTime && react_1.default.createElement(material_1.Select, { variant: "standard", value: isAstro ? this.state.schedule.time.start : '00:00', onChange: e => {
|
|
643
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
644
|
+
_schedule.time.start = e.target.value;
|
|
645
|
+
this.onChange(_schedule);
|
|
646
|
+
} },
|
|
647
|
+
react_1.default.createElement(material_1.MenuItem, { key: "specific", value: "00:00" }, i18n_1.default.t('sch_specificTime')),
|
|
648
|
+
ASTRO.map(event => react_1.default.createElement(material_1.MenuItem, { key: event, value: event }, i18n_1.default.t(`sch_astro_${event}`)))),
|
|
649
|
+
this.state.schedule.time.exactTime && !isAstro &&
|
|
650
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
651
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.inputTime, key: "exactTimeValue", value: this.state.schedule.time.start, type: "time",
|
|
652
|
+
// inputComponent={TextTime}
|
|
653
|
+
onChange: e => {
|
|
654
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
655
|
+
_schedule.time.start = e.target.value;
|
|
656
|
+
this.onChange(_schedule);
|
|
657
|
+
}, InputLabelProps: { shrink: true }, margin: "normal" })));
|
|
658
|
+
}
|
|
659
|
+
getDivider() {
|
|
660
|
+
return react_1.default.createElement("hr", { className: this.props.classes.hr });
|
|
661
|
+
}
|
|
662
|
+
getPeriodModes() {
|
|
663
|
+
const schedule = this.state.schedule;
|
|
664
|
+
const isOnce = !schedule.period.dows && !schedule.period.months && !schedule.period.dates && !schedule.period.years && !schedule.period.days && !schedule.period.weeks;
|
|
665
|
+
if (isOnce && !schedule.period.once) {
|
|
666
|
+
schedule.period.once = Schedule.now2string(true);
|
|
1503
667
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
668
|
+
return [
|
|
669
|
+
// ----- once ---
|
|
670
|
+
react_1.default.createElement("div", { key: "once", className: `${this.props.classes.rowDiv} ${this.props.classes.rowOnce}` },
|
|
671
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
672
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!isOnce, onClick: () => {
|
|
673
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
674
|
+
_schedule.period.once = _schedule.period.once || Schedule.now2string(true);
|
|
675
|
+
_schedule.period.dows = '';
|
|
676
|
+
_schedule.period.months = '';
|
|
677
|
+
_schedule.period.dates = '';
|
|
678
|
+
_schedule.period.years = 0;
|
|
679
|
+
_schedule.period.yearDate = 0;
|
|
680
|
+
_schedule.period.yearMonth = 0;
|
|
681
|
+
_schedule.period.weeks = 0;
|
|
682
|
+
_schedule.period.days = 0;
|
|
683
|
+
this.onChange(_schedule);
|
|
684
|
+
} }), label: i18n_1.default.t('sch_periodOnce') })),
|
|
685
|
+
isOnce && react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
686
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.inputDate, type: "date", ref: this.refOnce, key: "exactDateAt", defaultValue: string2USdate(schedule.period.once),
|
|
687
|
+
// InputProps={{inputComponent: TextTime}}
|
|
688
|
+
onChange: e => {
|
|
689
|
+
this.timerOnce && clearTimeout(this.timerOnce);
|
|
690
|
+
this.timerOnce = null;
|
|
691
|
+
if (this.refOnce.current) {
|
|
692
|
+
this.refOnce.current.style.background = '#ff000030';
|
|
693
|
+
}
|
|
694
|
+
this.timerOnce = setTimeout(value => {
|
|
695
|
+
this.timerOnce = null;
|
|
696
|
+
if (this.refOnce.current) {
|
|
697
|
+
this.refOnce.current.style.background = '';
|
|
698
|
+
}
|
|
699
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
700
|
+
const date = Schedule.string2date(value);
|
|
701
|
+
if (date.toString() !== 'Invalid Date') {
|
|
702
|
+
_schedule.period.once = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
703
|
+
this.onChange(_schedule);
|
|
704
|
+
}
|
|
705
|
+
}, 1500, e.target.value);
|
|
706
|
+
}, InputLabelProps: { shrink: true }, label: i18n_1.default.t('sch_at'), margin: "normal" }))),
|
|
707
|
+
// ----- days ---
|
|
708
|
+
react_1.default.createElement("div", { key: "days", className: `${this.props.classes.rowDiv} ${this.props.classes.rowDays}` },
|
|
709
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
710
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!schedule.period.days, onClick: () => {
|
|
711
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
712
|
+
_schedule.period.days = 1;
|
|
713
|
+
_schedule.period.dows = '';
|
|
714
|
+
_schedule.period.months = '';
|
|
715
|
+
_schedule.period.dates = '';
|
|
716
|
+
_schedule.period.years = 0;
|
|
717
|
+
_schedule.period.yearDate = 0;
|
|
718
|
+
_schedule.period.yearMonth = 0;
|
|
719
|
+
_schedule.period.weeks = 0;
|
|
720
|
+
_schedule.period.once = '';
|
|
721
|
+
this.onChange(_schedule);
|
|
722
|
+
} }), label: i18n_1.default.t('sch_periodDaily') })),
|
|
723
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
724
|
+
this.getPeriodSettingsDaily(),
|
|
725
|
+
schedule.period.days ? this.getPeriodSettingsWeekdays() : null)),
|
|
726
|
+
// ----- days of weeks ---
|
|
727
|
+
/*
|
|
728
|
+
!schedule.period.days && (
|
|
729
|
+
<div key="dows" className={this.props.classes.rowDiv + ' ' + this.props.classes.rowDows}>
|
|
730
|
+
<div className={this.props.classes.modeDiv}>
|
|
731
|
+
<FormControlLabel control={<Radio className={this.props.classes.inputRadio} checked={!!schedule.period.dows} onClick={() => {
|
|
732
|
+
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
733
|
+
schedule.period.dows = schedule.period.dows ? '' : '[0,1,2,3,4,5,6]';
|
|
734
|
+
this.onChange(schedule);
|
|
735
|
+
}}/>}
|
|
736
|
+
label={I18n.t('sch_periodWeekdays')} />
|
|
737
|
+
</div>
|
|
738
|
+
<div className={this.props.classes.settingsDiv}>
|
|
739
|
+
{this.getPeriodSettingsWeekdays()}
|
|
740
|
+
</div>
|
|
741
|
+
</div>,
|
|
742
|
+
*/
|
|
743
|
+
// ----- weeks ---
|
|
744
|
+
react_1.default.createElement("div", { key: "weeks", className: `${this.props.classes.rowDiv} ${this.props.classes.rowDows}` },
|
|
745
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
746
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!schedule.period.weeks, onClick: () => {
|
|
747
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
748
|
+
_schedule.period.weeks = schedule.period.weeks ? 0 : 1;
|
|
749
|
+
_schedule.period.dows = schedule.period.dows || '[0]';
|
|
750
|
+
_schedule.period.months = '';
|
|
751
|
+
_schedule.period.dates = '';
|
|
752
|
+
_schedule.period.years = 0;
|
|
753
|
+
_schedule.period.yearDate = 0;
|
|
754
|
+
_schedule.period.yearMonth = 0;
|
|
755
|
+
_schedule.period.days = 0;
|
|
756
|
+
_schedule.period.once = '';
|
|
757
|
+
this.onChange(_schedule);
|
|
758
|
+
} }), label: i18n_1.default.t('sch_periodWeekly') })),
|
|
759
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
760
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv }, this.getPeriodSettingsWeekly()),
|
|
761
|
+
react_1.default.createElement("div", { className: `${this.props.classes.settingsDiv} ${this.props.classes.rowDowsDows}` }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
|
|
762
|
+
// ----- months ---
|
|
763
|
+
react_1.default.createElement("div", { key: "months", className: `${this.props.classes.rowDiv} ${this.props.classes.rowMonths}` },
|
|
764
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
765
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!schedule.period.months, onClick: () => {
|
|
766
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
767
|
+
_schedule.period.months = 1;
|
|
768
|
+
_schedule.period.dows = '';
|
|
769
|
+
_schedule.period.dates = '';
|
|
770
|
+
_schedule.period.years = 0;
|
|
771
|
+
_schedule.period.yearDate = 0;
|
|
772
|
+
_schedule.period.yearMonth = 0;
|
|
773
|
+
_schedule.period.weeks = 0;
|
|
774
|
+
_schedule.period.days = 0;
|
|
775
|
+
_schedule.period.once = '';
|
|
776
|
+
this.onChange(_schedule);
|
|
777
|
+
} }), label: i18n_1.default.t('sch_periodMonthly') })),
|
|
778
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
779
|
+
this.getPeriodSettingsMonthly(),
|
|
780
|
+
schedule.period.months ? react_1.default.createElement("div", null,
|
|
781
|
+
react_1.default.createElement("div", { className: `${this.props.classes.settingsDiv} ${this.props.classes.rowMonthsDates}` },
|
|
782
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputRadio, checked: !!schedule.period.dates, onClick: () => {
|
|
783
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
784
|
+
_schedule.period.months = _schedule.period.months || 1;
|
|
785
|
+
const dates = [];
|
|
786
|
+
for (let i = 1; i <= 31; i++) {
|
|
787
|
+
dates.push(i);
|
|
788
|
+
}
|
|
789
|
+
_schedule.period.dates = _schedule.period.dates || JSON.stringify(dates);
|
|
790
|
+
_schedule.period.dows = '';
|
|
791
|
+
_schedule.period.years = 0;
|
|
792
|
+
_schedule.period.yearDate = 0;
|
|
793
|
+
_schedule.period.yearMonth = 0;
|
|
794
|
+
_schedule.period.weeks = 0;
|
|
795
|
+
_schedule.period.days = 0;
|
|
796
|
+
_schedule.period.once = '';
|
|
797
|
+
this.onChange(_schedule);
|
|
798
|
+
} }), label: i18n_1.default.t('sch_periodDates') })),
|
|
799
|
+
react_1.default.createElement("div", { className: `${this.props.classes.settingsDiv} ${this.props.classes.rowMonthsDates}` }, this.getPeriodSettingsDates())) : null)),
|
|
800
|
+
// ----- years ---
|
|
801
|
+
react_1.default.createElement("div", { key: "years", className: `${this.props.classes.rowDiv} ${this.props.classes.rowYears}` },
|
|
802
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv },
|
|
803
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!schedule.period.years, onClick: () => {
|
|
804
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
805
|
+
_schedule.period.years = 1;
|
|
806
|
+
_schedule.period.yearDate = 1;
|
|
807
|
+
_schedule.period.yearMonth = 1;
|
|
808
|
+
_schedule.period.dows = '';
|
|
809
|
+
_schedule.period.months = 0;
|
|
810
|
+
_schedule.period.dates = '';
|
|
811
|
+
_schedule.period.weeks = 0;
|
|
812
|
+
_schedule.period.days = 0;
|
|
813
|
+
_schedule.period.once = '';
|
|
814
|
+
this.onChange(_schedule);
|
|
815
|
+
} }), label: i18n_1.default.t('sch_periodYearly') })),
|
|
816
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
817
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv }, this.getPeriodSettingsYearly()),
|
|
818
|
+
!!schedule.period.years && react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
819
|
+
react_1.default.createElement("span", null, i18n_1.default.t('sch_on')),
|
|
820
|
+
react_1.default.createElement(material_1.Input, { key: "input", value: this.state.schedule.period.yearDate, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 1, max: 31 }, onChange: e => {
|
|
821
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
822
|
+
_schedule.period.yearDate = parseInt(e.target.value, 10);
|
|
823
|
+
if (_schedule.period.yearDate < 1)
|
|
824
|
+
_schedule.period.yearDate = 31;
|
|
825
|
+
if (_schedule.period.yearDate > 31)
|
|
826
|
+
_schedule.period.yearDate = 1;
|
|
827
|
+
this.onChange(_schedule);
|
|
828
|
+
} }),
|
|
829
|
+
react_1.default.createElement(material_1.Select, { variant: "standard", value: schedule.period.yearMonth, onChange: e => {
|
|
830
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
831
|
+
_schedule.period.yearMonth = e.target.value;
|
|
832
|
+
this.onChange(_schedule);
|
|
833
|
+
} },
|
|
834
|
+
react_1.default.createElement(material_1.MenuItem, { key: "every", value: 0 }, i18n_1.default.t('sch_yearEveryMonth')),
|
|
835
|
+
MONTHS.map((month, i) => react_1.default.createElement(material_1.MenuItem, { key: month, value: i + 1 }, i18n_1.default.t(month))))))),
|
|
836
|
+
];
|
|
837
|
+
}
|
|
838
|
+
getPeriodSettingsMinutes() {
|
|
839
|
+
return react_1.default.createElement("div", { style: { display: 'inline-block' } },
|
|
840
|
+
react_1.default.createElement("label", null, i18n_1.default.t('sch_every')),
|
|
841
|
+
react_1.default.createElement(material_1.Input, { value: this.state.schedule.time.interval, style: { verticalAlign: 'bottom' }, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 1 }, onChange: e => {
|
|
842
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
843
|
+
_schedule.time.interval = parseInt(e.target.value, 10);
|
|
844
|
+
this.onChange(_schedule);
|
|
845
|
+
} }),
|
|
846
|
+
react_1.default.createElement(material_1.Select, { variant: "standard", value: this.state.schedule.time.mode, onChange: e => {
|
|
847
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
848
|
+
_schedule.time.mode = e.target.value;
|
|
849
|
+
this.onChange(_schedule);
|
|
850
|
+
} },
|
|
851
|
+
react_1.default.createElement(material_1.MenuItem, { value: PERIODS.minutes }, i18n_1.default.t('sch_periodMinutes')),
|
|
852
|
+
react_1.default.createElement(material_1.MenuItem, { value: PERIODS.hours }, i18n_1.default.t('sch_periodHours'))));
|
|
853
|
+
}
|
|
854
|
+
getPeriodSettingsWeekdays() {
|
|
855
|
+
// || this.state.schedule.period.dows === '[1, 2, 3, 4, 5]' || this.state.schedule.period.dows === '[0, 6]'
|
|
856
|
+
const schedule = this.state.schedule;
|
|
857
|
+
const isSpecific = schedule.period.dows && schedule.period.dows !== '[1, 2, 3, 4, 5]' && schedule.period.dows !== '[0, 6]';
|
|
858
|
+
return [
|
|
859
|
+
react_1.default.createElement("div", { key: "workdays" },
|
|
860
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.dows === '[1, 2, 3, 4, 5]', onClick: () => {
|
|
861
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
862
|
+
_schedule.period.dows = '[1, 2, 3, 4, 5]';
|
|
863
|
+
if (_schedule.period.days) {
|
|
864
|
+
_schedule.period.days = 1;
|
|
865
|
+
}
|
|
866
|
+
this.onChange(_schedule);
|
|
867
|
+
} }), label: i18n_1.default.t('sch_periodWorkdays') })),
|
|
868
|
+
react_1.default.createElement("div", { key: "weekend" },
|
|
869
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.dows === '[0, 6]', onClick: () => {
|
|
870
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
871
|
+
_schedule.period.dows = '[0, 6]';
|
|
872
|
+
if (_schedule.period.days) {
|
|
873
|
+
_schedule.period.days = 1;
|
|
874
|
+
}
|
|
875
|
+
this.onChange(_schedule);
|
|
876
|
+
} }), label: i18n_1.default.t('sch_periodWeekend') })),
|
|
877
|
+
react_1.default.createElement("div", { key: "specific", style: { verticalAlign: 'top' } },
|
|
878
|
+
react_1.default.createElement(material_1.FormControlLabel, { style: { verticalAlign: 'top' }, control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: !!isSpecific, onClick: () => {
|
|
879
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
880
|
+
_schedule.period.dows = '[0, 1, 2, 3, 4, 5, 6]';
|
|
881
|
+
if (_schedule.period.days) {
|
|
882
|
+
_schedule.period.days = 1;
|
|
883
|
+
}
|
|
884
|
+
this.onChange(_schedule);
|
|
885
|
+
} }), label: i18n_1.default.t('sch_periodWeekdays') }),
|
|
886
|
+
isSpecific && (schedule.period.days === 1 || schedule.period.weeks) &&
|
|
887
|
+
react_1.default.createElement(material_1.FormGroup, { row: true, className: this.props.classes.inputGroup, style: { width: 150 } }, [1, 2, 3, 4, 5, 6, 0].map(i => react_1.default.createElement(material_1.FormControlLabel, { key: `specific_${i}`, className: this.props.classes.inputGroupElement, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputSmallCheck, checked: schedule.period.dows.includes(i.toString()), onChange: e => {
|
|
888
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
889
|
+
let daysOfWeek;
|
|
890
|
+
try {
|
|
891
|
+
daysOfWeek = JSON.parse(_schedule.period.dows);
|
|
892
|
+
}
|
|
893
|
+
catch (err) {
|
|
894
|
+
daysOfWeek = [];
|
|
895
|
+
}
|
|
896
|
+
if (e.target.checked && !daysOfWeek.includes(i)) {
|
|
897
|
+
daysOfWeek.push(i);
|
|
898
|
+
}
|
|
899
|
+
else if (!e.target.checked && daysOfWeek.includes(i)) {
|
|
900
|
+
daysOfWeek.splice(daysOfWeek.indexOf(i), 1);
|
|
901
|
+
}
|
|
902
|
+
daysOfWeek.sort((a, b) => a - b);
|
|
903
|
+
_schedule.period.dows = JSON.stringify(daysOfWeek);
|
|
904
|
+
if (_schedule.period.days) {
|
|
905
|
+
_schedule.period.days = 1;
|
|
906
|
+
}
|
|
907
|
+
this.onChange(_schedule);
|
|
908
|
+
} }), label: i18n_1.default.t(WEEKDAYS[i]) })))),
|
|
909
|
+
];
|
|
910
|
+
}
|
|
911
|
+
getPeriodSettingsDaily() {
|
|
912
|
+
if (!this.state.schedule.period.days) {
|
|
913
|
+
return null;
|
|
1530
914
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
915
|
+
const schedule = this.state.schedule;
|
|
916
|
+
return [
|
|
917
|
+
react_1.default.createElement("div", { key: "every_day" },
|
|
918
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.days === 1 && !schedule.period.dows, onClick: () => {
|
|
919
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
920
|
+
_schedule.period.days = 1;
|
|
921
|
+
_schedule.period.dows = '';
|
|
922
|
+
this.onChange(_schedule);
|
|
923
|
+
} }), label: i18n_1.default.t('sch_periodEveryDay') })),
|
|
924
|
+
react_1.default.createElement("div", { key: "everyN_day" },
|
|
925
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.days > 1, onClick: () => {
|
|
926
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
927
|
+
_schedule.period.days = 2;
|
|
928
|
+
_schedule.period.dows = '';
|
|
929
|
+
this.onChange(_schedule);
|
|
930
|
+
} }), label: i18n_1.default.t('sch_periodEvery') }),
|
|
931
|
+
schedule.period.days > 1 && [
|
|
932
|
+
react_1.default.createElement(material_1.Input, { key: "input", value: this.state.schedule.period.days, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
933
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
934
|
+
_schedule.period.days = parseInt(e.target.value, 10);
|
|
935
|
+
_schedule.period.dows = '';
|
|
936
|
+
this.onChange(_schedule);
|
|
937
|
+
} }),
|
|
938
|
+
react_1.default.createElement("span", { key: "span", style: { paddingRight: 10 } }, i18n_1.default.t('sch_periodDay')),
|
|
939
|
+
]),
|
|
940
|
+
];
|
|
941
|
+
}
|
|
942
|
+
getPeriodSettingsWeekly() {
|
|
943
|
+
if (!this.state.schedule.period.weeks) {
|
|
944
|
+
return null;
|
|
1548
945
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
946
|
+
const schedule = this.state.schedule;
|
|
947
|
+
return [
|
|
948
|
+
react_1.default.createElement("div", { key: "radios", style: { display: 'inline-block', verticalAlign: 'top' } },
|
|
949
|
+
react_1.default.createElement("div", null,
|
|
950
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.weeks === 1, onClick: () => {
|
|
951
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
952
|
+
_schedule.period.weeks = 1;
|
|
953
|
+
this.onChange(_schedule);
|
|
954
|
+
} }), label: i18n_1.default.t('sch_periodEveryWeek') })),
|
|
955
|
+
react_1.default.createElement("div", null,
|
|
956
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.weeks > 1, onClick: () => {
|
|
957
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
958
|
+
_schedule.period.weeks = 2;
|
|
959
|
+
this.onChange(_schedule);
|
|
960
|
+
} }), label: i18n_1.default.t('sch_periodEvery') }),
|
|
961
|
+
schedule.period.weeks > 1 && [
|
|
962
|
+
react_1.default.createElement(material_1.Input, { key: "input", value: this.state.schedule.period.weeks, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
963
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
964
|
+
_schedule.period.weeks = parseInt(e.target.value, 10);
|
|
965
|
+
this.onChange(_schedule);
|
|
966
|
+
} }),
|
|
967
|
+
react_1.default.createElement("span", { key: "text" }, i18n_1.default.t('sch_periodWeek')),
|
|
968
|
+
])),
|
|
969
|
+
];
|
|
970
|
+
}
|
|
971
|
+
getPeriodSettingsDates() {
|
|
972
|
+
if (!this.state.schedule.period.dates) {
|
|
973
|
+
return null;
|
|
1573
974
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
desc.push(_i18n["default"].t('sch_desc_everyNYears', schedule.period.years));
|
|
975
|
+
const schedule = this.state.schedule;
|
|
976
|
+
const dates = [];
|
|
977
|
+
for (let i = 1; i <= 31; i++) {
|
|
978
|
+
dates.push(i);
|
|
1579
979
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
980
|
+
const parsedDates = JSON.parse(schedule.period.dates);
|
|
981
|
+
return react_1.default.createElement(material_1.FormGroup, { row: true, className: this.props.classes.inputGroup, style: { maxWidth: 620 } },
|
|
982
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: parsedDates.length === 31, onChange: () => {
|
|
983
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
984
|
+
const _dates = [];
|
|
985
|
+
for (let i = 1; i <= 31; i++) {
|
|
986
|
+
_dates.push(i);
|
|
987
|
+
}
|
|
988
|
+
_schedule.period.dates = JSON.stringify(_dates);
|
|
989
|
+
this.onChange(_schedule);
|
|
990
|
+
} }), label: i18n_1.default.t('sch_all') }),
|
|
991
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: !parsedDates.length, onChange: () => {
|
|
992
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
993
|
+
_schedule.period.dates = '[]';
|
|
994
|
+
this.onChange(_schedule);
|
|
995
|
+
} }), label: i18n_1.default.t('sch_no_one') }),
|
|
996
|
+
parsedDates.length !== 31 && !!parsedDates.length &&
|
|
997
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: false, onChange: () => {
|
|
998
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
999
|
+
const result = [];
|
|
1000
|
+
const _parsedDates = JSON.parse(_schedule.period.dates);
|
|
1001
|
+
for (let i = 1; i <= 31; i++) {
|
|
1002
|
+
if (!_parsedDates.includes(i)) {
|
|
1003
|
+
result.push(i);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
result.sort((a, b) => a - b);
|
|
1007
|
+
_schedule.period.dates = JSON.stringify(result);
|
|
1008
|
+
this.onChange(_schedule);
|
|
1009
|
+
} }), label: i18n_1.default.t('sch_invert') }),
|
|
1010
|
+
react_1.default.createElement("div", null),
|
|
1011
|
+
dates.map(i => react_1.default.createElement(material_1.FormControlLabel, { key: `date_${i}`, className: this.props.classes.inputDateDay, style: !i ? {
|
|
1012
|
+
opacity: 0,
|
|
1013
|
+
cursor: 'default',
|
|
1014
|
+
userSelect: 'none',
|
|
1015
|
+
pointerEvents: 'none',
|
|
1016
|
+
} : {}, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: JSON.parse(schedule.period.dates).includes(i), onChange: e => {
|
|
1017
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1018
|
+
let _dates;
|
|
1019
|
+
try {
|
|
1020
|
+
_dates = JSON.parse(_schedule.period.dates);
|
|
1021
|
+
}
|
|
1022
|
+
catch (err) {
|
|
1023
|
+
_dates = [];
|
|
1024
|
+
}
|
|
1025
|
+
if (e.target.checked && !_dates.includes(i)) {
|
|
1026
|
+
_dates.push(i);
|
|
1027
|
+
}
|
|
1028
|
+
else if (!e.target.checked && _dates.includes(i)) {
|
|
1029
|
+
_dates.splice(_dates.indexOf(i), 1);
|
|
1030
|
+
}
|
|
1031
|
+
_dates.sort((a, b) => a - b);
|
|
1032
|
+
_schedule.period.dates = JSON.stringify(_dates);
|
|
1033
|
+
this.onChange(_schedule);
|
|
1034
|
+
} }), label: i < 10 ? [
|
|
1035
|
+
react_1.default.createElement("span", { key: "0", style: { opacity: 0 } }, "0"),
|
|
1036
|
+
react_1.default.createElement("span", { key: "num" }, i),
|
|
1037
|
+
] : i })));
|
|
1038
|
+
}
|
|
1039
|
+
getPeriodSettingsMonthly() {
|
|
1040
|
+
if (!this.state.schedule.period.months) {
|
|
1041
|
+
return null;
|
|
1591
1042
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1043
|
+
const schedule = this.state.schedule;
|
|
1044
|
+
const parsedMonths = typeof schedule.period.months === 'string' ? JSON.parse(schedule.period.months) : [];
|
|
1045
|
+
return [
|
|
1046
|
+
react_1.default.createElement("div", { key: "every" },
|
|
1047
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: typeof schedule.period.months === 'number' && schedule.period.months === 1, onClick: () => {
|
|
1048
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1049
|
+
_schedule.period.months = 1;
|
|
1050
|
+
this.onChange(schedule);
|
|
1051
|
+
} }), label: i18n_1.default.t('sch_periodEveryMonth') })),
|
|
1052
|
+
react_1.default.createElement("div", { key: "everyN" },
|
|
1053
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: typeof schedule.period.months === 'number' && schedule.period.months > 1, onClick: () => {
|
|
1054
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1055
|
+
_schedule.period.months = 2;
|
|
1056
|
+
this.onChange(_schedule);
|
|
1057
|
+
} }), label: i18n_1.default.t('sch_periodEvery') }),
|
|
1058
|
+
typeof schedule.period.months === 'number' && schedule.period.months > 1 && [
|
|
1059
|
+
react_1.default.createElement(material_1.Input, { key: "input", value: schedule.period.months, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
1060
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1061
|
+
_schedule.period.months = parseInt(e.target.value, 10);
|
|
1062
|
+
if (_schedule.period.months < 1)
|
|
1063
|
+
_schedule.period.months = 1;
|
|
1064
|
+
this.onChange(_schedule);
|
|
1065
|
+
} }),
|
|
1066
|
+
react_1.default.createElement("span", { key: "text" }, i18n_1.default.t('sch_periodMonth')),
|
|
1067
|
+
]),
|
|
1068
|
+
react_1.default.createElement("div", { key: "specific", style: { verticalAlign: 'top' } },
|
|
1069
|
+
react_1.default.createElement(material_1.FormControlLabel, { style: { verticalAlign: 'top' }, control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: typeof schedule.period.months === 'string', onClick: () => {
|
|
1070
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1071
|
+
_schedule.period.months = '[1,2,3,4,5,6,7,8,9,10,11,12]';
|
|
1072
|
+
this.onChange(_schedule);
|
|
1073
|
+
} }), label: i18n_1.default.t('sch_periodSpecificMonths') }),
|
|
1074
|
+
typeof schedule.period.months === 'string' &&
|
|
1075
|
+
react_1.default.createElement(material_1.FormGroup, { row: true, className: this.props.classes.inputGroup },
|
|
1076
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: parsedMonths.length === 12, onChange: () => {
|
|
1077
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1078
|
+
const months = [];
|
|
1079
|
+
for (let i = 1; i <= 12; i++) {
|
|
1080
|
+
months.push(i);
|
|
1081
|
+
}
|
|
1082
|
+
_schedule.period.months = JSON.stringify(months);
|
|
1083
|
+
this.onChange(_schedule);
|
|
1084
|
+
} }), label: i18n_1.default.t('sch_all') }),
|
|
1085
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: !parsedMonths.length, onChange: () => {
|
|
1086
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1087
|
+
_schedule.period.months = '[]';
|
|
1088
|
+
this.onChange(_schedule);
|
|
1089
|
+
} }), label: i18n_1.default.t('sch_no_one') }),
|
|
1090
|
+
parsedMonths.length !== 12 && !!parsedMonths.length &&
|
|
1091
|
+
react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputDateDay, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputDateDayCheck, checked: false, onChange: () => {
|
|
1092
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1093
|
+
const result = [];
|
|
1094
|
+
const _parsedMonths = JSON.parse(_schedule.period.months);
|
|
1095
|
+
for (let i = 1; i <= 12; i++) {
|
|
1096
|
+
if (!_parsedMonths.includes(i)) {
|
|
1097
|
+
result.push(i);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
result.sort((a, b) => a - b);
|
|
1101
|
+
_schedule.period.months = JSON.stringify(result);
|
|
1102
|
+
this.onChange(_schedule);
|
|
1103
|
+
} }), label: i18n_1.default.t('sch_invert') }),
|
|
1104
|
+
react_1.default.createElement("div", null),
|
|
1105
|
+
MONTHS.map((month, i) => react_1.default.createElement(material_1.FormControlLabel, { className: this.props.classes.inputGroupElement, control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputSmallCheck, checked: typeof schedule.period.months === 'string' ? JSON.parse(schedule.period.months).includes(i + 1) : schedule.period.months === i, onChange: e => {
|
|
1106
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1107
|
+
let months;
|
|
1108
|
+
try {
|
|
1109
|
+
months = JSON.parse(_schedule.period.months);
|
|
1110
|
+
}
|
|
1111
|
+
catch (err) {
|
|
1112
|
+
months = [];
|
|
1113
|
+
}
|
|
1114
|
+
if (e.target.checked && !months.includes(i + 1)) {
|
|
1115
|
+
months.push(i + 1);
|
|
1116
|
+
}
|
|
1117
|
+
else if (!e.target.checked && months.includes(i + 1)) {
|
|
1118
|
+
months.splice(months.indexOf(i + 1), 1);
|
|
1119
|
+
}
|
|
1120
|
+
months.sort((a, b) => a - b);
|
|
1121
|
+
_schedule.period.months = JSON.stringify(months);
|
|
1122
|
+
this.onChange(_schedule);
|
|
1123
|
+
} }), label: i18n_1.default.t(month) })))),
|
|
1124
|
+
];
|
|
1125
|
+
}
|
|
1126
|
+
getPeriodSettingsYearly() {
|
|
1127
|
+
if (!this.state.schedule.period.years) {
|
|
1128
|
+
return null;
|
|
1607
1129
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1130
|
+
const schedule = this.state.schedule;
|
|
1131
|
+
return [
|
|
1132
|
+
react_1.default.createElement("div", { key: "year" },
|
|
1133
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.years === 1, onClick: () => {
|
|
1134
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1135
|
+
_schedule.period.years = 1;
|
|
1136
|
+
this.onChange(_schedule);
|
|
1137
|
+
} }), label: i18n_1.default.t('sch_periodEveryYear') })),
|
|
1138
|
+
react_1.default.createElement("div", { key: "every" },
|
|
1139
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { className: this.props.classes.inputRadio, checked: schedule.period.years > 1, onClick: () => {
|
|
1140
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1141
|
+
_schedule.period.years = 2;
|
|
1142
|
+
this.onChange(_schedule);
|
|
1143
|
+
} }), label: i18n_1.default.t('sch_periodEvery') }),
|
|
1144
|
+
schedule.period.years > 1 && [
|
|
1145
|
+
react_1.default.createElement(material_1.Input, { key: "input", value: this.state.schedule.period.years, className: this.props.classes.inputEvery, type: "number", inputProps: { min: 2 }, onChange: e => {
|
|
1146
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1147
|
+
_schedule.period.years = parseInt(e.target.value, 10);
|
|
1148
|
+
if (_schedule.period.years < 1)
|
|
1149
|
+
_schedule.period.years = 1;
|
|
1150
|
+
this.onChange(_schedule);
|
|
1151
|
+
} }),
|
|
1152
|
+
react_1.default.createElement("span", { key: "text" }, i18n_1.default.t('sch_periodYear')),
|
|
1153
|
+
]),
|
|
1154
|
+
];
|
|
1155
|
+
}
|
|
1156
|
+
static now2string(isEnd) {
|
|
1157
|
+
const d = new Date();
|
|
1158
|
+
d.setHours(0);
|
|
1159
|
+
d.setMinutes(0);
|
|
1160
|
+
d.setSeconds(0);
|
|
1161
|
+
d.setMilliseconds(0);
|
|
1162
|
+
if (isEnd) {
|
|
1163
|
+
d.setDate(d.getDate() + 2);
|
|
1164
|
+
d.setMilliseconds(d.getMilliseconds() - 1);
|
|
1613
1165
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
// from XXXX
|
|
1622
|
-
desc.push(_i18n["default"].t('sch_desc_validFrom', schedule.valid.from));
|
|
1623
|
-
} else if (schedule.valid.to) {
|
|
1624
|
-
// till XXXX
|
|
1625
|
-
desc.push(_i18n["default"].t('sch_desc_validTo', schedule.valid.to));
|
|
1166
|
+
return `${padding(d.getDate())}.${padding(d.getMonth() + 1)}.${padding(d.getFullYear())}`;
|
|
1167
|
+
}
|
|
1168
|
+
static string2date(str) {
|
|
1169
|
+
let parts = str.split('.'); // 31.12.2019
|
|
1170
|
+
if (parts.length === 1) {
|
|
1171
|
+
parts = str.split('-'); // 2018-12-31
|
|
1172
|
+
return new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) - 1, parseInt(parts[2], 10));
|
|
1626
1173
|
}
|
|
1627
|
-
|
|
1628
|
-
return desc.join(' ');
|
|
1174
|
+
return new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10));
|
|
1629
1175
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1176
|
+
getValidSettings() {
|
|
1177
|
+
const schedule = this.state.schedule;
|
|
1178
|
+
// ----- from ---
|
|
1179
|
+
return react_1.default.createElement("div", { className: this.props.classes.rowDiv },
|
|
1180
|
+
react_1.default.createElement("div", { className: this.props.classes.modeDiv, style: { verticalAlign: 'middle' } },
|
|
1181
|
+
react_1.default.createElement("span", { style: { fontWeight: 'bold', paddingRight: 10 } }, i18n_1.default.t('sch_valid')),
|
|
1182
|
+
react_1.default.createElement("span", null, i18n_1.default.t('sch_validFrom'))),
|
|
1183
|
+
react_1.default.createElement("div", { className: this.props.classes.settingsDiv },
|
|
1184
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", className: this.props.classes.inputDate, style: { marginRight: 10 }, key: "exactTimeFrom", inputRef: this.refFrom, defaultValue: string2USdate(schedule.valid.from), type: "date",
|
|
1185
|
+
// inputComponent={TextDate}
|
|
1186
|
+
onChange: e => {
|
|
1187
|
+
this.timerFrom && clearTimeout(this.timerFrom);
|
|
1188
|
+
if (this.refFrom.current) {
|
|
1189
|
+
this.refFrom.current.style.background = '#ff000030';
|
|
1190
|
+
}
|
|
1191
|
+
this.timerFrom = setTimeout(value => {
|
|
1192
|
+
this.timerFrom = null;
|
|
1193
|
+
if (this.refFrom.current) {
|
|
1194
|
+
this.refFrom.current.style.background = '';
|
|
1195
|
+
}
|
|
1196
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1197
|
+
const date = Schedule.string2date(value);
|
|
1198
|
+
if (date.toString() !== 'Invalid Date') {
|
|
1199
|
+
_schedule.valid.from = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1200
|
+
this.onChange(_schedule);
|
|
1201
|
+
}
|
|
1202
|
+
}, 1500, e.target.value);
|
|
1203
|
+
}, InputLabelProps: { shrink: true }, margin: "normal" }),
|
|
1204
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { className: this.props.classes.inputRadio, checked: !!schedule.valid.to, onClick: () => {
|
|
1205
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1206
|
+
_schedule.valid.to = _schedule.valid.to ? '' : Schedule.now2string(true);
|
|
1207
|
+
this.onChange(_schedule);
|
|
1208
|
+
} }), label: i18n_1.default.t('sch_validTo') }),
|
|
1209
|
+
!!schedule.valid.to && react_1.default.createElement(material_1.TextField, { variant: "standard", inputRef: this.refTo, className: this.props.classes.inputDate, style: { marginRight: 10 }, key: "exactTimeFrom", type: "date", defaultValue: string2USdate(schedule.valid.to),
|
|
1210
|
+
// inputComponent={TextDate}
|
|
1211
|
+
onChange: e => {
|
|
1212
|
+
this.timerTo && clearTimeout(this.timerTo);
|
|
1213
|
+
if (this.refTo.current) {
|
|
1214
|
+
this.refTo.current.style.background = '#ff000030';
|
|
1215
|
+
}
|
|
1216
|
+
this.timerTo = setTimeout(value => {
|
|
1217
|
+
this.timerTo = null;
|
|
1218
|
+
if (this.refTo.current) {
|
|
1219
|
+
this.refTo.current.style.background = '';
|
|
1220
|
+
}
|
|
1221
|
+
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1222
|
+
const date = Schedule.string2date(value);
|
|
1223
|
+
if (date.toString() !== 'Invalid Date') {
|
|
1224
|
+
_schedule.valid.to = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1225
|
+
this.onChange(_schedule);
|
|
1226
|
+
}
|
|
1227
|
+
}, 1500, e.target.value);
|
|
1228
|
+
}, InputLabelProps: { shrink: true }, margin: "normal" })));
|
|
1643
1229
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1230
|
+
render() {
|
|
1231
|
+
return react_1.default.createElement("div", { style: { height: 'calc(100% - 48px)', width: '100%', overflow: 'hidden' } },
|
|
1232
|
+
react_1.default.createElement("div", null, this.state.desc),
|
|
1233
|
+
react_1.default.createElement("div", { className: this.props.classes.scrollWindow },
|
|
1234
|
+
react_1.default.createElement("h5", null, i18n_1.default.t('sch_time')),
|
|
1235
|
+
this.getTimePeriodElements(),
|
|
1236
|
+
this.getTimeExactElements(),
|
|
1237
|
+
this.getDivider(),
|
|
1238
|
+
react_1.default.createElement("h5", null, i18n_1.default.t('sch_period')),
|
|
1239
|
+
this.getPeriodModes(),
|
|
1240
|
+
!this.state.schedule.period.once && this.getDivider(),
|
|
1241
|
+
!this.state.schedule.period.once && this.getValidSettings()));
|
|
1653
1242
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}(_react["default"].Component);
|
|
1657
|
-
Schedule.propTypes = {
|
|
1658
|
-
schedule: _propTypes["default"].string,
|
|
1659
|
-
onChange: _propTypes["default"].func.isRequired
|
|
1660
|
-
};
|
|
1661
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles)(Schedule);
|
|
1662
|
-
//# sourceMappingURL=Schedule.js.map
|
|
1243
|
+
}
|
|
1244
|
+
exports.default = (0, styles_1.withStyles)(styles)(Schedule);
|