@iobroker/adapter-react-v5 4.11.3 → 4.11.5
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/IconPicker.d.ts +9 -3
- package/Components/IconSelector.d.ts +1 -1
- package/Components/Loaders/MV.js +1 -1
- package/Components/SimpleCron/cron2text.d.ts +4 -6
- package/Components/SimpleCron/cron2text.js +463 -481
- package/Components/SimpleCron/cronText.d.ts +1 -1
- package/Components/SimpleCron/cronText.js +46 -48
- package/Components/SimpleCron/index.d.ts +38 -7
- package/Components/SimpleCron/index.js +579 -729
- package/Components/SimpleCron/jquery.cron.locale.d.ts +28 -1
- package/Components/SimpleCron/jquery.cron.locale.js +530 -336
- package/Dialogs/ComplexCron.d.ts +13 -12
- package/Dialogs/ComplexCron.js +59 -130
- package/Dialogs/Cron.d.ts +17 -14
- package/Dialogs/Cron.js +92 -183
- package/Dialogs/SimpleCron.d.ts +11 -11
- package/Dialogs/SimpleCron.js +49 -119
- package/GenericApp.d.ts +7 -2
- package/GenericApp.js +3 -25
- package/README.md +6 -0
- package/i18n/de.json +2 -1
- package/i18n/en.json +2 -1
- package/i18n/es.json +2 -1
- package/i18n/fr.json +2 -1
- package/i18n/it.json +2 -1
- package/i18n/nl.json +2 -1
- package/i18n/pl.json +2 -1
- package/i18n/pt.json +2 -1
- package/i18n/ru.json +2 -1
- package/i18n/uk.json +2 -1
- package/i18n/zh-cn.json +2 -1
- package/package.json +1 -1
- package/Components/SimpleCron/cron2text.js.map +0 -1
- package/Components/SimpleCron/cronText.js.map +0 -1
- package/Components/SimpleCron/index.js.map +0 -1
- package/Components/SimpleCron/jquery.cron.locale.js.map +0 -1
- package/Dialogs/ComplexCron.js.map +0 -1
- package/Dialogs/Cron.js.map +0 -1
- package/Dialogs/SimpleCron.js.map +0 -1
package/Dialogs/ComplexCron.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
|
-
classes: PropTypes.Requireable<object>;
|
|
3
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
4
|
-
onOk: PropTypes.Validator<(...args: any[]) => any>;
|
|
5
|
-
title: PropTypes.Requireable<string>;
|
|
6
|
-
cron: PropTypes.Requireable<string>;
|
|
7
|
-
cancel: PropTypes.Requireable<string>;
|
|
8
|
-
ok: PropTypes.Requireable<string>;
|
|
9
|
-
clearButton: PropTypes.Requireable<boolean>;
|
|
10
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"radio" | "headerID" | "dialogPaper"> & object>;
|
|
11
|
-
export default _default;
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
1
|
import React from 'react';
|
|
2
|
+
interface DialogCronProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onOk: (cron: string | false) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
cron?: string;
|
|
7
|
+
cancel?: string;
|
|
8
|
+
ok?: string;
|
|
9
|
+
clear?: string;
|
|
10
|
+
classes: Record<string, string>;
|
|
11
|
+
clearButton?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.JSXElementConstructor<Omit<DialogCronProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
14
|
+
export default _default;
|
package/Dialogs/ComplexCron.js
CHANGED
|
@@ -1,143 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _styles = require("@mui/styles");
|
|
16
|
-
var _material = require("@mui/material");
|
|
17
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
18
|
-
var _ComplexCron = _interopRequireDefault(require("../Components/ComplexCron"));
|
|
19
|
-
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
20
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const styles_1 = require("@mui/styles");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
10
|
+
const ComplexCron_1 = __importDefault(require("../Components/ComplexCron"));
|
|
11
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
22
12
|
// Generate cron expression
|
|
23
|
-
|
|
24
|
-
return {
|
|
13
|
+
const styles = {
|
|
25
14
|
headerID: {
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
fontWeight: 'bold',
|
|
16
|
+
fontStyle: 'italic',
|
|
28
17
|
},
|
|
29
18
|
radio: {
|
|
30
|
-
|
|
19
|
+
display: 'inline-block',
|
|
31
20
|
},
|
|
32
21
|
dialogPaper: {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
};
|
|
22
|
+
height: 'calc(100% - 96px)',
|
|
23
|
+
},
|
|
36
24
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
25
|
+
class DialogComplexCron extends react_1.default.Component {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
let cron;
|
|
29
|
+
if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^["']/, '')[0] !== '{') {
|
|
30
|
+
cron = this.props.cron.replace(/['"]/g, '').trim();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
cron = this.props.cron || '{}';
|
|
34
|
+
if (typeof cron === 'string') {
|
|
35
|
+
cron = cron.replace(/^["']/, '').replace(/["']\n?$/, '');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
this.state = {
|
|
39
|
+
cron,
|
|
40
|
+
};
|
|
51
41
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
return _this;
|
|
56
|
-
}
|
|
57
|
-
(0, _createClass2["default"])(DialogComplexCron, [{
|
|
58
|
-
key: "handleCancel",
|
|
59
|
-
value: function handleCancel() {
|
|
60
|
-
this.props.onClose();
|
|
42
|
+
handleCancel() {
|
|
43
|
+
this.props.onClose();
|
|
61
44
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.props.onOk(this.state.cron);
|
|
66
|
-
this.props.onClose();
|
|
45
|
+
handleOk() {
|
|
46
|
+
this.props.onOk(this.state.cron);
|
|
47
|
+
this.props.onClose();
|
|
67
48
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.props.onOk(false);
|
|
72
|
-
this.props.onClose();
|
|
49
|
+
handleClear() {
|
|
50
|
+
this.props.onOk(false);
|
|
51
|
+
this.props.onClose();
|
|
73
52
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
height: '100%',
|
|
92
|
-
overflow: 'hidden'
|
|
93
|
-
}
|
|
94
|
-
}, /*#__PURE__*/_react["default"].createElement(_ComplexCron["default"], {
|
|
95
|
-
cronExpression: this.state.cron,
|
|
96
|
-
onChange: function onChange(cron) {
|
|
97
|
-
return _this2.setState({
|
|
98
|
-
cron: cron
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
language: _i18n["default"].getLanguage()
|
|
102
|
-
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, !!this.props.clearButton && /*#__PURE__*/_react["default"].createElement(_material.Button
|
|
103
|
-
// @ts-expect-error
|
|
104
|
-
, {
|
|
105
|
-
color: "grey",
|
|
106
|
-
variant: "contained",
|
|
107
|
-
onClick: function onClick() {
|
|
108
|
-
return _this2.handleClear();
|
|
109
|
-
},
|
|
110
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null)
|
|
111
|
-
}, this.props.clear || _i18n["default"].t('ra_Clear')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
112
|
-
variant: "contained",
|
|
113
|
-
onClick: function onClick() {
|
|
114
|
-
return _this2.handleOk();
|
|
115
|
-
},
|
|
116
|
-
color: "primary",
|
|
117
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null)
|
|
118
|
-
}, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_material.Button
|
|
119
|
-
// @ts-expect-error
|
|
120
|
-
, {
|
|
121
|
-
color: "grey",
|
|
122
|
-
variant: "contained",
|
|
123
|
-
onClick: function onClick() {
|
|
124
|
-
return _this2.handleCancel();
|
|
125
|
-
},
|
|
126
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Cancel, null)
|
|
127
|
-
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
53
|
+
render() {
|
|
54
|
+
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, classes: { paper: this.props.classes.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
55
|
+
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define schedule...')),
|
|
56
|
+
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
57
|
+
react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
58
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
59
|
+
!!this.props.clearButton && react_1.default.createElement(material_1.Button
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
, {
|
|
62
|
+
// @ts-expect-error
|
|
63
|
+
color: "grey", variant: "contained", onClick: () => this.handleClear(), startIcon: react_1.default.createElement(icons_material_1.Delete, null) }, this.props.clear || i18n_1.default.t('ra_Clear')),
|
|
64
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
65
|
+
react_1.default.createElement(material_1.Button
|
|
66
|
+
// @ts-expect-error
|
|
67
|
+
, {
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
128
70
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}(_react["default"].Component);
|
|
132
|
-
DialogComplexCron.propTypes = {
|
|
133
|
-
classes: _propTypes["default"].object,
|
|
134
|
-
onClose: _propTypes["default"].func.isRequired,
|
|
135
|
-
onOk: _propTypes["default"].func.isRequired,
|
|
136
|
-
title: _propTypes["default"].string,
|
|
137
|
-
cron: _propTypes["default"].string,
|
|
138
|
-
cancel: _propTypes["default"].string,
|
|
139
|
-
ok: _propTypes["default"].string,
|
|
140
|
-
clearButton: _propTypes["default"].bool
|
|
141
|
-
};
|
|
142
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles)(DialogComplexCron);
|
|
143
|
-
//# sourceMappingURL=ComplexCron.js.map
|
|
71
|
+
}
|
|
72
|
+
exports.default = (0, styles_1.withStyles)(styles)(DialogComplexCron);
|
package/Dialogs/Cron.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
|
-
classes: PropTypes.Requireable<object>;
|
|
3
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
4
|
-
onOk: PropTypes.Validator<(...args: any[]) => any>;
|
|
5
|
-
title: PropTypes.Requireable<string>;
|
|
6
|
-
cron: PropTypes.Requireable<string>;
|
|
7
|
-
cancel: PropTypes.Requireable<string>;
|
|
8
|
-
ok: PropTypes.Requireable<string>;
|
|
9
|
-
simple: PropTypes.Requireable<boolean>;
|
|
10
|
-
complex: PropTypes.Requireable<boolean>;
|
|
11
|
-
noWizard: PropTypes.Requireable<boolean>;
|
|
12
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"radio" | "headerID" | "dialogPaper"> & object>;
|
|
13
|
-
export default _default;
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
1
|
import React from 'react';
|
|
2
|
+
interface DialogCronProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onOk: (cron: string) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
cron?: string;
|
|
7
|
+
cancel?: string;
|
|
8
|
+
ok?: string;
|
|
9
|
+
/** show only simple configuration */
|
|
10
|
+
simple?: boolean;
|
|
11
|
+
/** show only complex configuration */
|
|
12
|
+
complex?: boolean;
|
|
13
|
+
/** do not show wizard */
|
|
14
|
+
noWizard?: boolean;
|
|
15
|
+
classes: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: React.JSXElementConstructor<Omit<DialogCronProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
18
|
+
export default _default;
|
package/Dialogs/Cron.js
CHANGED
|
@@ -1,197 +1,106 @@
|
|
|
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
|
-
|
|
24
|
-
|
|
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 = __importDefault(require("react"));
|
|
30
|
+
const styles_1 = require("@mui/styles");
|
|
31
|
+
const material_1 = require("@mui/material");
|
|
32
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
33
|
+
const ComplexCron_1 = __importDefault(require("../Components/ComplexCron"));
|
|
34
|
+
const SimpleCron_1 = __importStar(require("../Components/SimpleCron"));
|
|
35
|
+
const Schedule_1 = __importDefault(require("../Components/Schedule"));
|
|
36
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
25
37
|
// Generate cron expression
|
|
26
|
-
|
|
27
|
-
var styles = function styles() {
|
|
28
|
-
return {
|
|
38
|
+
const styles = {
|
|
29
39
|
headerID: {
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
fontWeight: 'bold',
|
|
41
|
+
fontStyle: 'italic',
|
|
32
42
|
},
|
|
33
43
|
radio: {
|
|
34
|
-
|
|
44
|
+
display: 'inline-block',
|
|
35
45
|
},
|
|
36
46
|
dialogPaper: {
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
};
|
|
47
|
+
height: 'calc(100% - 96px)',
|
|
48
|
+
},
|
|
40
49
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
class DialogCron extends react_1.default.Component {
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super(props);
|
|
53
|
+
let cron;
|
|
54
|
+
if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^["']/, '')[0] !== '{') {
|
|
55
|
+
cron = this.props.cron.replace(/['"]/g, '').trim();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
cron = this.props.cron || '{}';
|
|
59
|
+
if (typeof cron === 'string') {
|
|
60
|
+
cron = cron.replace(/^["']/, '').replace(/["']\n?$/, '');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
this.state = {
|
|
64
|
+
cron,
|
|
65
|
+
mode: this.props.simple ? 'simple' :
|
|
66
|
+
(this.props.complex ? 'complex' :
|
|
67
|
+
((typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard ?
|
|
68
|
+
'wizard' :
|
|
69
|
+
((0, SimpleCron_1.cron2state)(this.props.cron || '* * * * *') ? 'simple' : 'complex'))),
|
|
70
|
+
};
|
|
55
71
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
mode: _this.props.simple ? 'simple' : _this.props.complex ? 'complex' : ((0, _typeof2["default"])(cron) === 'object' || cron[0] === '{') && !_this.props.noWizard ? 'wizard' : _SimpleCron["default"].cron2state(_this.props.cron || '* * * * *') ? 'simple' : 'complex'
|
|
59
|
-
};
|
|
60
|
-
return _this;
|
|
61
|
-
}
|
|
62
|
-
(0, _createClass2["default"])(DialogCron, [{
|
|
63
|
-
key: "handleCancel",
|
|
64
|
-
value: function handleCancel() {
|
|
65
|
-
this.props.onClose();
|
|
72
|
+
handleCancel() {
|
|
73
|
+
this.props.onClose();
|
|
66
74
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.props.onOk(this.state.cron);
|
|
71
|
-
this.props.onClose();
|
|
75
|
+
handleOk() {
|
|
76
|
+
this.props.onOk(this.state.cron);
|
|
77
|
+
this.props.onClose();
|
|
72
78
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
value: function setMode(mode) {
|
|
76
|
-
this.setState({
|
|
77
|
-
mode: mode
|
|
78
|
-
});
|
|
79
|
+
setMode(mode) {
|
|
80
|
+
this.setState({ mode });
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
checked: this.state.mode === 'wizard',
|
|
103
|
-
onChange: function onChange() {
|
|
104
|
-
return _this2.setMode('wizard');
|
|
105
|
-
}
|
|
106
|
-
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
107
|
-
onClick: function onClick() {
|
|
108
|
-
return _this2.setMode('wizard');
|
|
109
|
-
},
|
|
110
|
-
style: this.state.mode !== 'wizard' ? {
|
|
111
|
-
color: 'lightgrey'
|
|
112
|
-
} : {}
|
|
113
|
-
}, _i18n["default"].t('sc_wizard'))), (!this.props.simple && !this.props.complex || this.props.simple) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
114
|
-
key: "simple",
|
|
115
|
-
checked: this.state.mode === 'simple',
|
|
116
|
-
onChange: function onChange() {
|
|
117
|
-
return _this2.setMode('simple');
|
|
118
|
-
}
|
|
119
|
-
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
120
|
-
onClick: function onClick() {
|
|
121
|
-
return _this2.setMode('simple');
|
|
122
|
-
},
|
|
123
|
-
style: this.state.mode !== 'simple' ? {
|
|
124
|
-
color: 'lightgrey'
|
|
125
|
-
} : {}
|
|
126
|
-
}, _i18n["default"].t('sc_simple'))), (!this.props.simple && !this.props.complex || this.props.complex) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Radio, {
|
|
127
|
-
key: "complex",
|
|
128
|
-
checked: this.state.mode === 'complex',
|
|
129
|
-
onChange: function onChange() {
|
|
130
|
-
return _this2.setMode('complex');
|
|
131
|
-
}
|
|
132
|
-
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
133
|
-
onClick: function onClick() {
|
|
134
|
-
return _this2.setMode('complex');
|
|
135
|
-
},
|
|
136
|
-
style: this.state.mode !== 'complex' ? {
|
|
137
|
-
color: 'lightgrey'
|
|
138
|
-
} : {}
|
|
139
|
-
}, _i18n["default"].t('sc_cron')))) : null, this.state.mode === 'simple' && /*#__PURE__*/_react["default"].createElement(_SimpleCron["default"], {
|
|
140
|
-
cronExpression: this.state.cron,
|
|
141
|
-
onChange: function onChange(cron) {
|
|
142
|
-
return _this2.setState({
|
|
143
|
-
cron: cron
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
language: _i18n["default"].getLanguage()
|
|
147
|
-
}), this.state.mode === 'wizard' && /*#__PURE__*/_react["default"].createElement(_Schedule["default"], {
|
|
148
|
-
schedule: this.state.cron,
|
|
149
|
-
onChange: function onChange(cron) {
|
|
150
|
-
return _this2.setState({
|
|
151
|
-
cron: cron
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
language: _i18n["default"].getLanguage()
|
|
155
|
-
}), this.state.mode === 'complex' && /*#__PURE__*/_react["default"].createElement(_ComplexCron["default"], {
|
|
156
|
-
cronExpression: this.state.cron,
|
|
157
|
-
onChange: function onChange(cron) {
|
|
158
|
-
return _this2.setState({
|
|
159
|
-
cron: cron
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
language: _i18n["default"].getLanguage()
|
|
163
|
-
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
164
|
-
variant: "contained",
|
|
165
|
-
onClick: function onClick() {
|
|
166
|
-
return _this2.handleOk();
|
|
167
|
-
},
|
|
168
|
-
color: "primary",
|
|
169
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null)
|
|
170
|
-
}, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
171
|
-
variant: "contained",
|
|
172
|
-
onClick: function onClick() {
|
|
173
|
-
return _this2.handleCancel();
|
|
174
|
-
},
|
|
175
|
-
color: "grey",
|
|
176
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Cancel, null)
|
|
177
|
-
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
82
|
+
render() {
|
|
83
|
+
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, classes: { paper: this.props.classes.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
84
|
+
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define schedule...')),
|
|
85
|
+
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
86
|
+
(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? react_1.default.createElement("div", null,
|
|
87
|
+
!this.props.simple && !this.props.complex && !this.props.noWizard && react_1.default.createElement(react_1.default.Fragment, null,
|
|
88
|
+
react_1.default.createElement(material_1.Radio, { key: "wizard", checked: this.state.mode === 'wizard', onChange: () => this.setMode('wizard') }),
|
|
89
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('wizard'), style: this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_wizard'))),
|
|
90
|
+
((!this.props.simple && !this.props.complex) || this.props.simple) && react_1.default.createElement(react_1.default.Fragment, null,
|
|
91
|
+
react_1.default.createElement(material_1.Radio, { key: "simple", checked: this.state.mode === 'simple', onChange: () => this.setMode('simple') }),
|
|
92
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('simple'), style: this.state.mode !== 'simple' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_simple'))),
|
|
93
|
+
((!this.props.simple && !this.props.complex) || this.props.complex) && react_1.default.createElement(react_1.default.Fragment, null,
|
|
94
|
+
react_1.default.createElement(material_1.Radio, { key: "complex", checked: this.state.mode === 'complex', onChange: () => this.setMode('complex') }),
|
|
95
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_cron')))) : null,
|
|
96
|
+
this.state.mode === 'simple' && react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() }),
|
|
97
|
+
this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { schedule: this.state.cron, onChange: cron => this.setState({ cron }) }),
|
|
98
|
+
this.state.mode === 'complex' && react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
99
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
100
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
101
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(),
|
|
102
|
+
// @ts-expect-error grey is allowed color
|
|
103
|
+
color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
178
104
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}(_react["default"].Component);
|
|
182
|
-
DialogCron.propTypes = {
|
|
183
|
-
classes: _propTypes["default"].object,
|
|
184
|
-
onClose: _propTypes["default"].func.isRequired,
|
|
185
|
-
onOk: _propTypes["default"].func.isRequired,
|
|
186
|
-
title: _propTypes["default"].string,
|
|
187
|
-
cron: _propTypes["default"].string,
|
|
188
|
-
cancel: _propTypes["default"].string,
|
|
189
|
-
ok: _propTypes["default"].string,
|
|
190
|
-
simple: _propTypes["default"].bool,
|
|
191
|
-
// show only simple configuration
|
|
192
|
-
complex: _propTypes["default"].bool,
|
|
193
|
-
// show only complex configuration
|
|
194
|
-
noWizard: _propTypes["default"].bool // do not show wizard
|
|
195
|
-
};
|
|
196
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles)(DialogCron);
|
|
197
|
-
//# sourceMappingURL=Cron.js.map
|
|
105
|
+
}
|
|
106
|
+
exports.default = (0, styles_1.withStyles)(styles)(DialogCron);
|
package/Dialogs/SimpleCron.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
|
-
classes: PropTypes.Requireable<object>;
|
|
3
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
4
|
-
onOk: PropTypes.Validator<(...args: any[]) => any>;
|
|
5
|
-
title: PropTypes.Requireable<string>;
|
|
6
|
-
cron: PropTypes.Requireable<string>;
|
|
7
|
-
cancel: PropTypes.Requireable<string>;
|
|
8
|
-
ok: PropTypes.Requireable<string>;
|
|
9
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"radio" | "headerID" | "dialogPaper"> & object>;
|
|
10
|
-
export default _default;
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
1
|
import React from 'react';
|
|
2
|
+
interface DialogCronProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onOk: (cron: string) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
cron?: string;
|
|
7
|
+
cancel?: string;
|
|
8
|
+
ok?: string;
|
|
9
|
+
classes: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.JSXElementConstructor<Omit<DialogCronProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
12
|
+
export default _default;
|