@iobroker/adapter-react-v5 5.0.7 → 6.0.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/404.d.ts +2 -5
- package/Components/404.js +10 -10
- package/Components/ColorPicker.d.ts +41 -4
- package/Components/ColorPicker.js +35 -32
- package/Components/ComplexCron.d.ts +35 -4
- package/Components/ComplexCron.js +14 -15
- package/Components/CustomModal.d.ts +2 -3
- package/Components/CustomModal.js +15 -16
- package/Components/FileBrowser.d.ts +116 -4
- package/Components/FileBrowser.js +160 -164
- package/Components/FileViewer.js +10 -8
- package/Components/Icon.d.ts +1 -0
- package/Components/Icon.js +11 -4
- package/Components/IconPicker.d.ts +5 -1
- package/Components/IconPicker.js +47 -49
- package/Components/ObjectBrowser.d.ts +12 -15
- package/Components/ObjectBrowser.js +362 -326
- package/Components/SaveCloseButtons.d.ts +6 -3
- package/Components/SaveCloseButtons.js +4 -5
- package/Components/Schedule.d.ts +60 -3
- package/Components/Schedule.js +112 -117
- package/Components/SelectWithIcon.d.ts +17 -4
- package/Components/SelectWithIcon.js +11 -7
- package/Components/SimpleCron/index.d.ts +19 -3
- package/Components/SimpleCron/index.js +8 -9
- package/Components/TabContainer.d.ts +3 -4
- package/Components/TabContainer.js +3 -7
- package/Components/TabContent.d.ts +2 -3
- package/Components/TabContent.js +2 -4
- package/Components/TableResize.d.ts +26 -3
- package/Components/TableResize.js +1 -39
- package/Components/TextWithIcon.d.ts +4 -4
- package/Components/TextWithIcon.js +6 -7
- package/Components/TreeTable.d.ts +40 -5
- package/Components/TreeTable.js +39 -37
- package/Components/UploadImage.d.ts +13 -4
- package/Components/UploadImage.js +11 -13
- package/Components/Utils.d.ts +2 -1
- package/Components/Utils.js +31 -0
- package/Dialogs/ComplexCron.d.ts +11 -3
- package/Dialogs/ComplexCron.js +2 -3
- package/Dialogs/Confirm.d.ts +20 -7
- package/Dialogs/Confirm.js +4 -15
- package/Dialogs/Cron.d.ts +12 -3
- package/Dialogs/Cron.js +3 -11
- package/Dialogs/SelectFile.d.ts +12 -3
- package/Dialogs/SelectFile.js +8 -9
- package/Dialogs/SelectID.d.ts +1 -1
- package/Dialogs/SelectID.js +1 -1
- package/Dialogs/SimpleCron.d.ts +10 -3
- package/Dialogs/SimpleCron.js +2 -10
- package/README.md +74 -1
- package/modulefederation.admin.config.js +2 -0
- package/package.json +6 -7
package/Components/404.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
declare const _default: React.JSXElementConstructor<Omit<Page404Props, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
6
|
-
export default _default;
|
|
2
|
+
declare function Page404(): React.JSX.Element;
|
|
3
|
+
export default Page404;
|
package/Components/404.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
8
|
/*
|
|
9
9
|
Copyright 2019 Robin Selmer
|
|
10
10
|
https://codepen.io/robinselmer/pen/vJjbOZ
|
|
@@ -86,15 +86,15 @@ const styles = {
|
|
|
86
86
|
color: 'white',
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
|
-
function Page404(
|
|
90
|
-
return react_1.default.createElement("div", {
|
|
91
|
-
react_1.default.createElement("div", {
|
|
92
|
-
react_1.default.createElement("div",
|
|
93
|
-
react_1.default.createElement("div", {
|
|
89
|
+
function Page404() {
|
|
90
|
+
return react_1.default.createElement("div", { style: styles.content },
|
|
91
|
+
react_1.default.createElement("div", { style: styles.root },
|
|
92
|
+
react_1.default.createElement(material_1.Box, { component: "div", sx: styles.overlay },
|
|
93
|
+
react_1.default.createElement("div", { style: styles.terminal },
|
|
94
94
|
react_1.default.createElement("h1", null,
|
|
95
95
|
i18n_1.default.t('ra_Error'),
|
|
96
|
-
react_1.default.createElement("span", {
|
|
97
|
-
react_1.default.createElement("p",
|
|
98
|
-
react_1.default.createElement("p",
|
|
96
|
+
react_1.default.createElement("span", { style: styles.errorCode }, "404")),
|
|
97
|
+
react_1.default.createElement(material_1.Box, { component: "p", sx: styles.output }, i18n_1.default.t('ra_The page you are looking for was not found')),
|
|
98
|
+
react_1.default.createElement(material_1.Box, { component: "p", sx: styles.output }, i18n_1.default.t('ra_Good luck'))))));
|
|
99
99
|
}
|
|
100
|
-
exports.default =
|
|
100
|
+
exports.default = Page404;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import React from 'react';
|
|
16
|
+
import React, { Component } from 'react';
|
|
17
|
+
import { type RGBColor } from 'react-color';
|
|
17
18
|
interface ColorPickerProps {
|
|
18
19
|
/** Set to true to disable the color picker. */
|
|
19
20
|
disabled?: boolean;
|
|
@@ -35,7 +36,43 @@ interface ColorPickerProps {
|
|
|
35
36
|
customPalette?: string[];
|
|
36
37
|
noInputField?: boolean;
|
|
37
38
|
barWidth?: number;
|
|
38
|
-
classes: Record<string, string>;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
interface ColorPickerState {
|
|
41
|
+
displayColorPicker: boolean;
|
|
42
|
+
color: string | RGBColor;
|
|
43
|
+
anchorEl: HTMLDivElement | null;
|
|
44
|
+
}
|
|
45
|
+
declare class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
46
|
+
constructor(props: ColorPickerProps);
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
handleClose: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.
|
|
57
|
+
* @returns the hex or rgba representation of the given color.
|
|
58
|
+
*/
|
|
59
|
+
static getColor(color: string | {
|
|
60
|
+
rgb: RGBColor;
|
|
61
|
+
} | RGBColor,
|
|
62
|
+
/** The returning string should be in hex format */
|
|
63
|
+
isHex?: boolean): string;
|
|
64
|
+
/**
|
|
65
|
+
* Convert rgb() or rgba() format to hex format #rrggbb.
|
|
66
|
+
*/
|
|
67
|
+
static rgb2hex(rgb: string): string;
|
|
68
|
+
private handleChange;
|
|
69
|
+
/**
|
|
70
|
+
* IF the props are updated from outside, they should override the state
|
|
71
|
+
* @param _prevProps
|
|
72
|
+
* @param prevState
|
|
73
|
+
*/
|
|
74
|
+
componentDidUpdate(_prevProps: ColorPickerProps, prevState: ColorPickerState): void;
|
|
75
|
+
renderCustomPalette(): React.JSX.Element;
|
|
76
|
+
render(): React.JSX.Element;
|
|
77
|
+
}
|
|
78
|
+
export default ColorPicker;
|
|
@@ -43,12 +43,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
43
43
|
*/
|
|
44
44
|
const react_1 = __importStar(require("react"));
|
|
45
45
|
const react_color_1 = require("react-color");
|
|
46
|
-
const styles_1 = require("@mui/styles");
|
|
47
46
|
const material_1 = require("@mui/material");
|
|
48
47
|
const icons_material_1 = require("@mui/icons-material");
|
|
49
48
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
50
|
-
const
|
|
51
|
-
const styles = (theme) => ({
|
|
49
|
+
const styles = {
|
|
52
50
|
color: {
|
|
53
51
|
width: 36,
|
|
54
52
|
height: 14,
|
|
@@ -62,7 +60,7 @@ const styles = (theme) => ({
|
|
|
62
60
|
swatch: {
|
|
63
61
|
marginTop: 16,
|
|
64
62
|
padding: 5,
|
|
65
|
-
background:
|
|
63
|
+
background: 'background.paper',
|
|
66
64
|
borderRadius: 1,
|
|
67
65
|
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
|
|
68
66
|
display: 'inline-block',
|
|
@@ -82,13 +80,13 @@ const styles = (theme) => ({
|
|
|
82
80
|
popoverList: {
|
|
83
81
|
padding: 0,
|
|
84
82
|
},
|
|
85
|
-
closeButton: {
|
|
83
|
+
closeButton: (theme) => ({
|
|
86
84
|
backgroundColor: `${theme.palette.background.paper} !important`,
|
|
87
85
|
borderRadius: '0 0 25% 25%',
|
|
88
86
|
'&:hover': {
|
|
89
87
|
backgroundColor: `${theme.palette.secondary.main} !important`,
|
|
90
88
|
},
|
|
91
|
-
},
|
|
89
|
+
}),
|
|
92
90
|
cover: {
|
|
93
91
|
position: 'fixed',
|
|
94
92
|
top: 0,
|
|
@@ -97,12 +95,12 @@ const styles = (theme) => ({
|
|
|
97
95
|
left: 0,
|
|
98
96
|
},
|
|
99
97
|
textDense: {
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
mt: 0,
|
|
99
|
+
mb: 0,
|
|
102
100
|
},
|
|
103
|
-
picker: {
|
|
101
|
+
picker: (theme) => ({
|
|
104
102
|
background: `${theme.palette.background.paper} !important`,
|
|
105
|
-
},
|
|
103
|
+
}),
|
|
106
104
|
iconButton: {
|
|
107
105
|
width: 16,
|
|
108
106
|
height: 16,
|
|
@@ -113,7 +111,7 @@ const styles = (theme) => ({
|
|
|
113
111
|
minWidth: 32,
|
|
114
112
|
minHeight: 32,
|
|
115
113
|
},
|
|
116
|
-
}
|
|
114
|
+
};
|
|
117
115
|
class ColorPicker extends react_1.Component {
|
|
118
116
|
constructor(props) {
|
|
119
117
|
super(props);
|
|
@@ -121,7 +119,10 @@ class ColorPicker extends react_1.Component {
|
|
|
121
119
|
* @private
|
|
122
120
|
*/
|
|
123
121
|
this.handleClick = (e) => {
|
|
124
|
-
this.setState({
|
|
122
|
+
this.setState({
|
|
123
|
+
displayColorPicker: !this.state.displayColorPicker,
|
|
124
|
+
anchorEl: this.state.displayColorPicker ? null : e.currentTarget,
|
|
125
|
+
});
|
|
125
126
|
};
|
|
126
127
|
/**
|
|
127
128
|
* @private
|
|
@@ -189,43 +190,45 @@ class ColorPicker extends react_1.Component {
|
|
|
189
190
|
if (!this.props.customPalette) {
|
|
190
191
|
return null;
|
|
191
192
|
}
|
|
192
|
-
return react_1.default.createElement("div", { style: { width: '100%', display: 'flex', flexWrap: 'wrap' } }, this.props.customPalette.map(color => react_1.default.createElement(material_1.Button, {
|
|
193
|
+
return react_1.default.createElement("div", { style: { width: '100%', display: 'flex', flexWrap: 'wrap' } }, this.props.customPalette.map(color => react_1.default.createElement(material_1.Button, { style: styles.button, key: color, onClick: () => {
|
|
193
194
|
this.handleChange(color);
|
|
194
195
|
setTimeout(() => this.handleClose(), 300);
|
|
195
196
|
} },
|
|
196
|
-
react_1.default.createElement("div", {
|
|
197
|
+
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.iconButton), { background: color }) }))));
|
|
197
198
|
}
|
|
198
199
|
render() {
|
|
199
200
|
const style = Object.assign({}, (this.props.style || {}));
|
|
200
201
|
style.position = 'relative';
|
|
201
202
|
const { color } = this.state;
|
|
202
|
-
return react_1.default.createElement("div",
|
|
203
|
-
this.props.noInputField ? null : react_1.default.createElement(material_1.TextField, { disabled: this.props.disabled, variant: "standard", id: "ar_color_picker_name",
|
|
204
|
-
|
|
203
|
+
return react_1.default.createElement(material_1.Box, { component: "div", style: style, className: this.props.className || '' },
|
|
204
|
+
this.props.noInputField ? null : react_1.default.createElement(material_1.TextField, { disabled: this.props.disabled, variant: "standard", id: "ar_color_picker_name", label: this.props.label || this.props.name || 'color', value: color || '', margin: "dense", sx: {
|
|
205
|
+
'&.MuiFormControl-root': styles.textDense,
|
|
206
|
+
width: color ? 'calc(100% - 80px)' : 'calc(100% - 56px)',
|
|
207
|
+
mr: color ? undefined : 1,
|
|
208
|
+
}, onChange: e => this.handleChange(e.target.value) }),
|
|
209
|
+
!this.props.noInputField && color ? react_1.default.createElement(material_1.IconButton, { disabled: this.props.disabled, onClick: () => this.handleChange(''), size: "small", style: Object.assign(Object.assign({}, styles.delButton), (color ? undefined : { opacity: 0, cursor: 'default' })) },
|
|
205
210
|
react_1.default.createElement(icons_material_1.Delete, null)) : null,
|
|
206
|
-
react_1.default.createElement("div", {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this.state.displayColorPicker && !this.props.disabled ? react_1.default.createElement(material_1.Menu, { classes: { paper: this.props.classes.popover, list: this.props.classes.popoverList }, anchorEl: this.state.anchorEl, open: !0, onClose: () => this.handleClose() },
|
|
217
|
-
react_1.default.createElement(react_color_1.ChromePicker, { className: this.props.classes.picker, color: this.state.color || undefined, onChangeComplete: _color => this.handleChange(_color.rgb), styles: {
|
|
211
|
+
react_1.default.createElement("div", { onClick: e => !this.props.disabled && this.handleClick(e), title: i18n_1.default.t('ra_Select color'), style: Object.assign(Object.assign(Object.assign({}, styles.swatch), (this.props.disabled ? styles.swatchDisabled : undefined)), { background: color ? undefined : 'transparent', border: color ? undefined : '1px dashed #ccc', boxSizing: 'border-box', marginTop: this.props.noInputField ? 0 : undefined }) },
|
|
212
|
+
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.color), { background: ColorPicker.getColor(color), width: this.props.noInputField ? (this.props.barWidth || 16) : (this.props.barWidth || undefined) }) })),
|
|
213
|
+
this.state.displayColorPicker && !this.props.disabled ? react_1.default.createElement(material_1.Menu, { classes: { paper: styles.popover, list: styles.popoverList }, anchorEl: this.state.anchorEl, open: !0, onClose: () => this.handleClose() },
|
|
214
|
+
react_1.default.createElement(react_color_1.ChromePicker
|
|
215
|
+
// todo
|
|
216
|
+
// sx={styles.picker}
|
|
217
|
+
, {
|
|
218
|
+
// todo
|
|
219
|
+
// sx={styles.picker}
|
|
220
|
+
color: this.state.color || undefined, onChangeComplete: _color => this.handleChange(_color.rgb), styles: {
|
|
218
221
|
default: {
|
|
219
222
|
picker: {
|
|
220
223
|
backgroundColor: '#112233',
|
|
221
224
|
},
|
|
222
225
|
},
|
|
223
226
|
} }),
|
|
224
|
-
color && this.props.noInputField ? react_1.default.createElement(material_1.IconButton, {
|
|
227
|
+
color && this.props.noInputField ? react_1.default.createElement(material_1.IconButton, { sx: styles.closeButton, onClick: () => this.handleChange('') },
|
|
225
228
|
react_1.default.createElement(icons_material_1.Delete, null)) : null,
|
|
226
|
-
react_1.default.createElement(material_1.IconButton, {
|
|
229
|
+
react_1.default.createElement(material_1.IconButton, { sx: styles.closeButton, onClick: () => this.handleClose() },
|
|
227
230
|
react_1.default.createElement(icons_material_1.Close, null)),
|
|
228
231
|
this.renderCustomPalette()) : null);
|
|
229
232
|
}
|
|
230
233
|
}
|
|
231
|
-
exports.default =
|
|
234
|
+
exports.default = ColorPicker;
|
|
@@ -1,9 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
type CronNames = 'seconds' | 'minutes' | 'hours' | 'dates' | 'months' | 'dow';
|
|
3
|
+
interface CronProps {
|
|
4
|
+
seconds: string | false | null;
|
|
5
|
+
minutes: string | null;
|
|
6
|
+
hours: string | null;
|
|
7
|
+
dates: string | null;
|
|
8
|
+
months: string | null;
|
|
9
|
+
dow: string | null;
|
|
10
|
+
}
|
|
2
11
|
interface ComplexCronProps {
|
|
3
12
|
cronExpression: string;
|
|
4
13
|
onChange: (cron: string) => void;
|
|
5
14
|
language: ioBroker.Languages;
|
|
6
|
-
classes: Record<string, any>;
|
|
7
15
|
}
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
interface ComplexCronState {
|
|
17
|
+
extended: boolean;
|
|
18
|
+
tab: number;
|
|
19
|
+
cron: string;
|
|
20
|
+
seconds?: string | false;
|
|
21
|
+
minutes?: string;
|
|
22
|
+
hours?: string;
|
|
23
|
+
dates?: string;
|
|
24
|
+
months?: string;
|
|
25
|
+
dow?: string;
|
|
26
|
+
modes: CronProps;
|
|
27
|
+
}
|
|
28
|
+
declare class ComplexCron extends Component<ComplexCronProps, ComplexCronState> {
|
|
29
|
+
constructor(props: ComplexCronProps);
|
|
30
|
+
static cron2state(cron: string): CronProps;
|
|
31
|
+
static state2cron(state: ComplexCronState | CronProps): string;
|
|
32
|
+
recalcCron(): void;
|
|
33
|
+
onToggle(i: boolean | number, type: CronNames, max: number): void;
|
|
34
|
+
getDigitsSelector(type: CronNames, max: number): React.JSX.Element[];
|
|
35
|
+
getPeriodsTab(type: CronNames, max: number): React.JSX.Element | null;
|
|
36
|
+
static convertCronToText(cron: string, lang: ioBroker.Languages): string;
|
|
37
|
+
setCronAttr(attr: CronNames, value: string, modes?: CronProps): void;
|
|
38
|
+
render(): React.JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
export default ComplexCron;
|
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
|
-
const styles_1 = require("@mui/styles");
|
|
31
30
|
const material_1 = require("@mui/material");
|
|
32
31
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
33
32
|
const cronText_1 = __importDefault(require("./SimpleCron/cronText"));
|
|
@@ -278,18 +277,18 @@ class ComplexCron extends react_1.Component {
|
|
|
278
277
|
}
|
|
279
278
|
const parts = convertMinusIntoArray(this.state[type], max);
|
|
280
279
|
return [
|
|
281
|
-
react_1.default.createElement(material_1.Button, { key: "removeall", variant: "outlined",
|
|
280
|
+
react_1.default.createElement(material_1.Button, { key: "removeall", variant: "outlined", style: styles.numberButton,
|
|
282
281
|
// style={{paddingBottom: 20}}
|
|
283
282
|
color: "primary", onClick: () => this.onToggle(false, type, max) }, i18n_1.default.t('ra_Deselect all')),
|
|
284
283
|
react_1.default.createElement(material_1.Button, { key: "addall", variant: "contained",
|
|
285
284
|
// style={{paddingBottom: 20}}
|
|
286
|
-
|
|
285
|
+
style: styles.numberButton, color: "secondary", onClick: () => this.onToggle(true, type, max) }, i18n_1.default.t('ra_Select all')),
|
|
287
286
|
react_1.default.createElement("div", { key: "all" }, values.map(i => [((max === 7 && i === 4) ||
|
|
288
287
|
(max === 12 && i === 7) ||
|
|
289
288
|
(max === 31 && !((i - 1) % 10)) ||
|
|
290
289
|
(max === 60 && i && !(i % 10)) ||
|
|
291
290
|
(max === 24 && i && !(i % 6))) ?
|
|
292
|
-
react_1.default.createElement("div", { key: `allInner${i}`, style: { width: '100%' } }) : null, react_1.default.createElement(material_1.Button, { key: `_${i}`, variant: parts.indexOf(i) !== -1 ? 'contained' : 'outlined',
|
|
291
|
+
react_1.default.createElement("div", { key: `allInner${i}`, style: { width: '100%' } }) : null, react_1.default.createElement(material_1.Button, { key: `_${i}`, variant: parts.indexOf(i) !== -1 ? 'contained' : 'outlined', style: styles.numberButton, color: parts.indexOf(i) !== -1 ? 'secondary' : 'primary', onClick: () => this.onToggle(i, type, max) }, max === 7 ? i18n_1.default.t(WEEKDAYS[i]) : (max === 12 ? MONTHS[i - 1] : i)),
|
|
293
292
|
])),
|
|
294
293
|
];
|
|
295
294
|
}
|
|
@@ -313,7 +312,7 @@ class ComplexCron extends react_1.Component {
|
|
|
313
312
|
valueNumber = parseInt(value.replace('*/', ''), 10) || 1;
|
|
314
313
|
}
|
|
315
314
|
return react_1.default.createElement("div", null,
|
|
316
|
-
react_1.default.createElement(material_1.Select, { variant: "standard",
|
|
315
|
+
react_1.default.createElement(material_1.Select, { variant: "standard", style: Object.assign(Object.assign({}, styles.periodSelect), { verticalAlign: 'bottom' }), value: select, onChange: e => {
|
|
317
316
|
const modes = JSON.parse(JSON.stringify(this.state.modes));
|
|
318
317
|
modes[type] = e.target.value;
|
|
319
318
|
if (e.target.value === 'every') {
|
|
@@ -392,25 +391,25 @@ class ComplexCron extends react_1.Component {
|
|
|
392
391
|
}
|
|
393
392
|
render() {
|
|
394
393
|
const tab = this.state.seconds !== false ? this.state.tab : this.state.tab + 1;
|
|
395
|
-
return react_1.default.createElement("div", {
|
|
394
|
+
return react_1.default.createElement("div", { style: styles.mainDiv },
|
|
396
395
|
react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%' } },
|
|
397
396
|
react_1.default.createElement(material_1.TextField, { variant: "standard", style: { width: '100%' }, value: this.state.cron, disabled: true })),
|
|
398
397
|
react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%', height: 60 } }, ComplexCron.convertCronToText(this.state.cron, this.props.language || 'en')),
|
|
399
398
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: !!this.state.seconds, onChange: e => this.setState({ seconds: e.target.checked ? '*' : false }, () => this.recalcCron()) }), label: i18n_1.default.t('ra_use seconds') }),
|
|
400
|
-
react_1.default.createElement(material_1.AppBar, { position: "static",
|
|
401
|
-
react_1.default.createElement(material_1.Tabs, { value: this.state.tab,
|
|
399
|
+
react_1.default.createElement(material_1.AppBar, { position: "static", sx: { '&.MuiAppBar-root': styles.appBar }, color: "secondary" },
|
|
400
|
+
react_1.default.createElement(material_1.Tabs, { value: this.state.tab, style: styles.appBar, color: "secondary", onChange: (active, _tab) => this.setState({ tab: _tab }) },
|
|
402
401
|
this.state.seconds !== false && react_1.default.createElement(material_1.Tab, { id: "sc_seconds", label: i18n_1.default.t('sc_seconds') }),
|
|
403
402
|
react_1.default.createElement(material_1.Tab, { id: "minutes", label: i18n_1.default.t('sc_minutes') }),
|
|
404
403
|
react_1.default.createElement(material_1.Tab, { id: "hours", label: i18n_1.default.t('sc_hours') }),
|
|
405
404
|
react_1.default.createElement(material_1.Tab, { id: "dates", label: i18n_1.default.t('sc_dates') }),
|
|
406
405
|
react_1.default.createElement(material_1.Tab, { id: "months", label: i18n_1.default.t('sc_months') }),
|
|
407
406
|
react_1.default.createElement(material_1.Tab, { id: "dow", label: i18n_1.default.t('sc_dows') }))),
|
|
408
|
-
tab === 0 && react_1.default.createElement("div", {
|
|
409
|
-
tab === 1 && react_1.default.createElement("div", {
|
|
410
|
-
tab === 2 && react_1.default.createElement("div", {
|
|
411
|
-
tab === 3 && react_1.default.createElement("div", {
|
|
412
|
-
tab === 4 && react_1.default.createElement("div", {
|
|
413
|
-
tab === 5 && react_1.default.createElement("div", {
|
|
407
|
+
tab === 0 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('seconds', 60)),
|
|
408
|
+
tab === 1 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('minutes', 60)),
|
|
409
|
+
tab === 2 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('hours', 24)),
|
|
410
|
+
tab === 3 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('dates', 31)),
|
|
411
|
+
tab === 4 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('months', 12)),
|
|
412
|
+
tab === 5 && react_1.default.createElement("div", { style: styles.tabContent }, this.getPeriodsTab('dow', 7)));
|
|
414
413
|
}
|
|
415
414
|
}
|
|
416
|
-
exports.default =
|
|
415
|
+
exports.default = ComplexCron;
|
|
@@ -17,9 +17,8 @@ interface CustomModalProps {
|
|
|
17
17
|
toggleTranslation?: () => void;
|
|
18
18
|
title?: string;
|
|
19
19
|
progress?: boolean;
|
|
20
|
-
classes: Record<string, string>;
|
|
21
20
|
textInput?: boolean;
|
|
22
21
|
defaultValue?: string;
|
|
23
22
|
}
|
|
24
|
-
declare const
|
|
25
|
-
export default
|
|
23
|
+
declare const CustomModal: (props: CustomModalProps) => React.JSX.Element;
|
|
24
|
+
export default CustomModal;
|
|
@@ -27,12 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
|
-
const styles_1 = require("@mui/styles");
|
|
31
30
|
const material_1 = require("@mui/material");
|
|
32
31
|
const icons_material_1 = require("@mui/icons-material");
|
|
33
|
-
const Utils_1 = __importDefault(require("./Utils"));
|
|
34
32
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
35
|
-
const
|
|
33
|
+
const Utils_1 = __importDefault(require("./Utils"));
|
|
34
|
+
const styles = {
|
|
36
35
|
modalDialog: {
|
|
37
36
|
minWidth: 400,
|
|
38
37
|
maxWidth: 800,
|
|
@@ -47,17 +46,17 @@ const styles = (theme) => ({
|
|
|
47
46
|
content: {
|
|
48
47
|
fontSize: 16,
|
|
49
48
|
},
|
|
50
|
-
languageButton: {
|
|
49
|
+
languageButton: (theme) => ({
|
|
51
50
|
position: 'absolute',
|
|
52
|
-
right:
|
|
53
|
-
top:
|
|
54
|
-
},
|
|
55
|
-
languageButtonActive: {
|
|
51
|
+
right: 8,
|
|
52
|
+
top: 8,
|
|
53
|
+
}),
|
|
54
|
+
languageButtonActive: (theme) => ({
|
|
56
55
|
color: theme.palette.primary.main,
|
|
57
|
-
},
|
|
58
|
-
}
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
59
58
|
const CustomModal = (props) => {
|
|
60
|
-
const { open, toggleTranslation, noTranslation, title, fullWidth, help, maxWidth, progress, icon, applyDisabled, applyButton,
|
|
59
|
+
const { open, toggleTranslation, noTranslation, title, fullWidth, help, maxWidth, progress, icon, applyDisabled, applyButton, onClose, children, titleButtonApply, titleButtonClose, onApply, textInput, defaultValue, overflowHidden, } = props;
|
|
61
60
|
const [value, setValue] = (0, react_1.useState)(defaultValue || '');
|
|
62
61
|
(0, react_1.useEffect)(() => {
|
|
63
62
|
setValue(defaultValue || '');
|
|
@@ -66,13 +65,13 @@ const CustomModal = (props) => {
|
|
|
66
65
|
if (icon) {
|
|
67
66
|
Icon = icon;
|
|
68
67
|
}
|
|
69
|
-
return react_1.default.createElement(material_1.Dialog, { open: open, maxWidth: maxWidth || 'md', fullWidth: !!fullWidth, disableEscapeKeyDown: false, onClose: onClose,
|
|
68
|
+
return react_1.default.createElement(material_1.Dialog, { open: open, maxWidth: maxWidth || 'md', fullWidth: !!fullWidth, disableEscapeKeyDown: false, onClose: onClose, sx: { '& .MuiDialog-paper': styles.modalDialog } },
|
|
70
69
|
title && react_1.default.createElement(material_1.DialogTitle, null,
|
|
71
|
-
icon ? react_1.default.createElement(Icon, {
|
|
70
|
+
icon ? react_1.default.createElement(Icon, { style: styles.titleIcon }) : null,
|
|
72
71
|
title,
|
|
73
|
-
i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large",
|
|
72
|
+
i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", sx: Utils_1.default.getStyle(styles.languageButton, noTranslation && styles.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
|
|
74
73
|
react_1.default.createElement(icons_material_1.Language, null)) : null),
|
|
75
|
-
react_1.default.createElement(material_1.DialogContent, {
|
|
74
|
+
react_1.default.createElement(material_1.DialogContent, { style: Object.assign(Object.assign(Object.assign({}, styles.content), (overflowHidden ? styles.overflowHidden : undefined)), { paddingTop: 8 }) },
|
|
76
75
|
textInput && react_1.default.createElement(material_1.TextField
|
|
77
76
|
// className={className}
|
|
78
77
|
, {
|
|
@@ -86,4 +85,4 @@ const CustomModal = (props) => {
|
|
|
86
85
|
applyButton !== false && react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(icons_material_1.Check, null), disabled: progress || (applyDisabled && defaultValue === value), onClick: () => onApply(textInput ? value : ''), variant: "contained", color: "primary" }, i18n_1.default.t(titleButtonApply || 'ra_Ok')),
|
|
87
86
|
react_1.default.createElement(material_1.Button, { color: "grey", onClick: onClose, disabled: progress, variant: "contained", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, i18n_1.default.t(titleButtonClose || 'ra_Cancel'))));
|
|
88
87
|
};
|
|
89
|
-
exports.default =
|
|
88
|
+
exports.default = CustomModal;
|
|
@@ -4,9 +4,15 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
* */
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { Component } from 'react';
|
|
8
8
|
import type { Connection } from '@iobroker/socket-client';
|
|
9
|
-
import { ThemeName, ThemeType, Translate } from '../types';
|
|
9
|
+
import { ThemeName, ThemeType, Translate, IobTheme } from '../types';
|
|
10
|
+
export interface MetaACL extends ioBroker.ObjectACL {
|
|
11
|
+
file: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MetaObject extends ioBroker.MetaObject {
|
|
14
|
+
acl: MetaACL;
|
|
15
|
+
}
|
|
10
16
|
export interface FileBrowserProps {
|
|
11
17
|
/** The key to identify this component. */
|
|
12
18
|
key?: string;
|
|
@@ -58,13 +64,119 @@ export interface FileBrowserProps {
|
|
|
58
64
|
themeName?: ThemeName;
|
|
59
65
|
/** Theme type. */
|
|
60
66
|
themeType?: ThemeType;
|
|
67
|
+
/** Theme object. */
|
|
68
|
+
theme: IobTheme;
|
|
61
69
|
/** Padding in pixels for folder levels */
|
|
62
70
|
levelPadding?: number;
|
|
63
71
|
restrictToFolder?: string;
|
|
64
|
-
|
|
65
|
-
modalEditOfAccessControl?: (obj: any) => React.JSX.Element | null;
|
|
72
|
+
modalEditOfAccessControl?: (obj: FileBrowserClass) => React.JSX.Element | null;
|
|
66
73
|
allowNonRestricted?: boolean;
|
|
67
74
|
showTypeSelector?: boolean;
|
|
68
75
|
}
|
|
76
|
+
export interface FolderOrFileItem {
|
|
77
|
+
id: string;
|
|
78
|
+
level: number;
|
|
79
|
+
name: string;
|
|
80
|
+
folder: boolean;
|
|
81
|
+
temp?: boolean;
|
|
82
|
+
size?: number | undefined;
|
|
83
|
+
ext?: string | null;
|
|
84
|
+
modified?: number;
|
|
85
|
+
title?: ioBroker.StringOrTranslated;
|
|
86
|
+
meta?: boolean;
|
|
87
|
+
from?: string;
|
|
88
|
+
ts?: number;
|
|
89
|
+
color?: string;
|
|
90
|
+
icon?: string;
|
|
91
|
+
acl?: ioBroker.EvaluatedFileACL | MetaACL;
|
|
92
|
+
}
|
|
93
|
+
export type Folders = Record<string, FolderOrFileItem[]>;
|
|
94
|
+
interface FileBrowserState {
|
|
95
|
+
viewType: string;
|
|
96
|
+
folders: Folders;
|
|
97
|
+
filterEmpty: boolean;
|
|
98
|
+
expanded: string[];
|
|
99
|
+
currentDir: string;
|
|
100
|
+
expertMode: boolean;
|
|
101
|
+
addFolder: boolean;
|
|
102
|
+
uploadFile: boolean | 'dragging';
|
|
103
|
+
deleteItem: string;
|
|
104
|
+
viewer: string;
|
|
105
|
+
formatEditFile: string | null;
|
|
106
|
+
path: string;
|
|
107
|
+
selected: string;
|
|
108
|
+
errorText: string;
|
|
109
|
+
modalEditOfAccess: boolean;
|
|
110
|
+
backgroundImage: string | null;
|
|
111
|
+
queueLength: number;
|
|
112
|
+
loadAllFolders: boolean;
|
|
113
|
+
fileErrors: string[];
|
|
114
|
+
filterByType: string;
|
|
115
|
+
showTypesMenu: HTMLButtonElement | null;
|
|
116
|
+
restrictToFolder: string;
|
|
117
|
+
pathFocus: boolean;
|
|
118
|
+
}
|
|
119
|
+
export declare class FileBrowserClass extends Component<FileBrowserProps, FileBrowserState> {
|
|
120
|
+
private readonly imagePrefix;
|
|
121
|
+
private readonly levelPadding;
|
|
122
|
+
private mounted;
|
|
123
|
+
private suppressDeleteConfirm;
|
|
124
|
+
private browseList;
|
|
125
|
+
private browseListRunning;
|
|
126
|
+
private initialReadFinished;
|
|
127
|
+
private supportSubscribes;
|
|
128
|
+
private _tempTimeout;
|
|
129
|
+
private readonly limitToObjectID;
|
|
130
|
+
private readonly limitToPath;
|
|
131
|
+
private lastSelect;
|
|
132
|
+
private setOpacityTimer;
|
|
133
|
+
private cacheFoldersTimeout;
|
|
134
|
+
private foldersLoading;
|
|
135
|
+
private cacheFolders;
|
|
136
|
+
private readonly localStorage;
|
|
137
|
+
constructor(props: FileBrowserProps);
|
|
138
|
+
static getDerivedStateFromProps(props: FileBrowserProps, state: FileBrowserState): Partial<FileBrowserState> | null;
|
|
139
|
+
loadFolders(): Promise<void>;
|
|
140
|
+
scrollToSelected(): void;
|
|
141
|
+
componentDidMount(): Promise<void>;
|
|
142
|
+
componentWillUnmount(): void;
|
|
143
|
+
browseFoldersCb(foldersList: string[], newFoldersNotNull: Folders, cb: (folders: Folders) => void): void;
|
|
144
|
+
browseFolders(foldersList: string[], _newFolders?: Folders | null): Promise<Folders>;
|
|
145
|
+
readDirSerial(adapter: string, relPath: string): Promise<ioBroker.ReadDirResult[]>;
|
|
146
|
+
processBrowseList(level?: number): void;
|
|
147
|
+
browseFolder(folderId: string, _newFolders?: Folders | null, _checkEmpty?: boolean, force?: boolean): Promise<Folders>;
|
|
148
|
+
toggleFolder(item: FolderOrFileItem, e: React.MouseEvent<Element>): void;
|
|
149
|
+
onFileChange: (id: string, fileName: string, size: number | null) => void;
|
|
150
|
+
changeFolder(e: React.MouseEvent<HTMLDivElement>, folder?: string): void | Promise<void>;
|
|
151
|
+
select(id: string, e?: React.MouseEvent<HTMLDivElement> | null, cb?: () => void): void;
|
|
152
|
+
getText(text?: ioBroker.StringOrTranslated | null): string | undefined;
|
|
153
|
+
renderFolder(item: FolderOrFileItem, expanded?: boolean): React.JSX.Element | null;
|
|
154
|
+
renderBackFolder(): React.JSX.Element;
|
|
155
|
+
formatSize(size: number | null | undefined): React.JSX.Element;
|
|
156
|
+
formatAcl(acl: ioBroker.EvaluatedFileACL | MetaACL | undefined): React.JSX.Element;
|
|
157
|
+
getFileIcon(ext: string | null): React.JSX.Element;
|
|
158
|
+
static getEditFile(ext: string | null): boolean;
|
|
159
|
+
setStateBackgroundImage: () => void;
|
|
160
|
+
getStyleBackgroundImage: () => any;
|
|
161
|
+
renderFile(item: FolderOrFileItem): React.JSX.Element;
|
|
162
|
+
renderItems(folderId: string): React.JSX.Element | (React.JSX.Element | null)[];
|
|
163
|
+
renderToolbar(): React.JSX.Element;
|
|
164
|
+
findItem(id: string, folders?: Folders | null): FolderOrFileItem;
|
|
165
|
+
renderInputDialog(): React.JSX.Element;
|
|
166
|
+
componentDidUpdate(): void;
|
|
167
|
+
findFirstFolder(id: string): string;
|
|
168
|
+
uploadFile(fileName: string, data: string): Promise<void>;
|
|
169
|
+
renderUpload(): React.JSX.Element[];
|
|
170
|
+
deleteRecursive(id: string): Promise<void>;
|
|
171
|
+
deleteItem(deleteItem: string): void;
|
|
172
|
+
renderDeleteDialog(): false | React.JSX.Element;
|
|
173
|
+
renderViewDialog(): React.JSX.Element;
|
|
174
|
+
renderError(): React.JSX.Element;
|
|
175
|
+
updateItemsAcl(info: FolderOrFileItem[]): void;
|
|
176
|
+
changeToPath(): void;
|
|
177
|
+
renderBreadcrumb(): React.JSX.Element;
|
|
178
|
+
renderPath(): React.JSX.Element;
|
|
179
|
+
render(): React.JSX.Element;
|
|
180
|
+
}
|
|
69
181
|
declare const _default: (props: Record<string, any>) => React.JSX.Element;
|
|
70
182
|
export default _default;
|