@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/Dialogs/SelectFile.js
CHANGED
|
@@ -11,10 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
*/
|
|
12
12
|
// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
|
|
13
13
|
const react_1 = __importDefault(require("react"));
|
|
14
|
-
const styles_1 = require("@mui/styles");
|
|
15
14
|
const material_1 = require("@mui/material");
|
|
16
15
|
const icons_material_1 = require("@mui/icons-material");
|
|
17
|
-
const Utils_1 = __importDefault(require("../Components/Utils"));
|
|
18
16
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
19
17
|
const FileBrowser_1 = __importDefault(require("../Components/FileBrowser"));
|
|
20
18
|
const styles = {
|
|
@@ -26,7 +24,8 @@ const styles = {
|
|
|
26
24
|
height: '95%',
|
|
27
25
|
},
|
|
28
26
|
dialogMobile: {
|
|
29
|
-
|
|
27
|
+
// it is sx
|
|
28
|
+
padding: '4px',
|
|
30
29
|
width: '100%',
|
|
31
30
|
maxWidth: '100%',
|
|
32
31
|
maxHeight: 'calc(100% - 16px)',
|
|
@@ -89,7 +88,7 @@ class DialogSelectFile extends react_1.default.Component {
|
|
|
89
88
|
react_1.default.createElement("span", { key: "selected" },
|
|
90
89
|
i18n_1.default.t('ra_Selected'),
|
|
91
90
|
"\u00A0"),
|
|
92
|
-
react_1.default.createElement("span", { key: "id",
|
|
91
|
+
react_1.default.createElement("span", { key: "id", style: styles.headerID }, this.state.selected),
|
|
93
92
|
];
|
|
94
93
|
}
|
|
95
94
|
else {
|
|
@@ -97,16 +96,16 @@ class DialogSelectFile extends react_1.default.Component {
|
|
|
97
96
|
react_1.default.createElement("span", { key: "selected" },
|
|
98
97
|
i18n_1.default.t('ra_Selected'),
|
|
99
98
|
"\u00A0"),
|
|
100
|
-
react_1.default.createElement("span", { key: "id",
|
|
99
|
+
react_1.default.createElement("span", { key: "id", style: styles.headerID }, i18n_1.default.t('%s items', this.state.selected.length)),
|
|
101
100
|
];
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
else {
|
|
105
104
|
title = this.props.title || i18n_1.default.t('ra_Please select file...');
|
|
106
105
|
}
|
|
107
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: false,
|
|
108
|
-
react_1.default.createElement(material_1.DialogTitle, { id: "ar_dialog_selectfile_title",
|
|
109
|
-
react_1.default.createElement(material_1.DialogContent, {
|
|
106
|
+
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: false, sx: { '& .MuiDialog-paper': Object.assign(Object.assign({}, styles.dialog), styles.dialogMobile) }, fullWidth: true, open: !0, "aria-labelledby": "ar_dialog_selectfile_title" },
|
|
107
|
+
react_1.default.createElement(material_1.DialogTitle, { id: "ar_dialog_selectfile_title", sx: { '&.MuiDialogTitle-root': styles.titleRoot } }, title),
|
|
108
|
+
react_1.default.createElement(material_1.DialogContent, { style: Object.assign(Object.assign({}, styles.content), styles.contentMobile) },
|
|
110
109
|
react_1.default.createElement(FileBrowser_1.default, { ready: true, imagePrefix: this.props.imagePrefix || this.props.prefix || '../', allowUpload: !!this.props.allowUpload, allowDownload: this.props.allowDownload !== false, allowCreateFolder: !!this.props.allowCreateFolder, allowDelete: !!this.props.allowDelete, allowView: this.props.allowView !== false, showViewTypeButton: this.props.showViewTypeButton !== false, showToolbar: this.props.showToolbar !== false, limitPath: this.props.limitPath, filterFiles: this.props.filterFiles, filterByType: this.props.filterByType, selected: this.props.selected, restrictToFolder: this.props.restrictToFolder, allowNonRestricted: this.props.allowNonRestricted, onSelect: (selected, isDoubleClick, isFolder) => {
|
|
111
110
|
this.setState({ selected: Array.isArray(selected) ? selected : [selected] }, () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk());
|
|
112
111
|
}, t: this.props.t || i18n_1.default.t, lang: this.props.lang || i18n_1.default.getLanguage(), socket: this.props.socket, themeType: this.props.themeType, themeName: this.props.themeName, showExpertButton: this.props.showExpertButton, expertMode: this.props.expertMode, showTypeSelector: this.props.showTypeSelector })),
|
|
@@ -115,4 +114,4 @@ class DialogSelectFile extends react_1.default.Component {
|
|
|
115
114
|
react_1.default.createElement(material_1.Button, { 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'))));
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
|
-
exports.default =
|
|
117
|
+
exports.default = DialogSelectFile;
|
package/Dialogs/SelectID.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React, { Component } from 'react';
|
|
8
8
|
import type Connection from '../Connection';
|
|
9
9
|
import { ObjectBrowserColumn, ObjectBrowserCustomFilter, ObjectBrowserType } from '../Components/types';
|
|
10
|
-
interface SelectIDFilters {
|
|
10
|
+
export interface SelectIDFilters {
|
|
11
11
|
id?: string;
|
|
12
12
|
name?: string;
|
|
13
13
|
room?: string;
|
package/Dialogs/SelectID.js
CHANGED
|
@@ -111,7 +111,7 @@ class DialogSelectID extends react_1.Component {
|
|
|
111
111
|
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: false, sx: {
|
|
112
112
|
'& .MuiDialog-paper': {
|
|
113
113
|
height: '95%',
|
|
114
|
-
|
|
114
|
+
p: '4px',
|
|
115
115
|
width: '100%',
|
|
116
116
|
maxWidth: '100%',
|
|
117
117
|
maxHeight: 'calc(100% - 16px)',
|
package/Dialogs/SimpleCron.d.ts
CHANGED
|
@@ -6,7 +6,14 @@ interface DialogCronProps {
|
|
|
6
6
|
cron?: string;
|
|
7
7
|
cancel?: string;
|
|
8
8
|
ok?: string;
|
|
9
|
-
classes: Record<string, string>;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
interface DialogCronState {
|
|
11
|
+
cron: string;
|
|
12
|
+
}
|
|
13
|
+
declare class DialogSimpleCron extends React.Component<DialogCronProps, DialogCronState> {
|
|
14
|
+
constructor(props: DialogCronProps);
|
|
15
|
+
handleCancel(): void;
|
|
16
|
+
handleOk(): void;
|
|
17
|
+
render(): React.JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default DialogSimpleCron;
|
package/Dialogs/SimpleCron.js
CHANGED
|
@@ -4,20 +4,12 @@ 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 styles_1 = require("@mui/styles");
|
|
8
7
|
const material_1 = require("@mui/material");
|
|
9
8
|
const icons_material_1 = require("@mui/icons-material");
|
|
10
9
|
const SimpleCron_1 = __importDefault(require("../Components/SimpleCron"));
|
|
11
10
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
12
11
|
// Generates cron expression
|
|
13
12
|
const styles = {
|
|
14
|
-
headerID: {
|
|
15
|
-
fontWeight: 'bold',
|
|
16
|
-
fontStyle: 'italic',
|
|
17
|
-
},
|
|
18
|
-
radio: {
|
|
19
|
-
display: 'inline-block',
|
|
20
|
-
},
|
|
21
13
|
dialogPaper: {
|
|
22
14
|
height: 'calc(100% - 96px)',
|
|
23
15
|
},
|
|
@@ -47,7 +39,7 @@ class DialogSimpleCron extends react_1.default.Component {
|
|
|
47
39
|
this.props.onClose();
|
|
48
40
|
}
|
|
49
41
|
render() {
|
|
50
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true,
|
|
42
|
+
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
51
43
|
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define CRON...')),
|
|
52
44
|
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
53
45
|
react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
@@ -56,4 +48,4 @@ class DialogSimpleCron extends react_1.default.Component {
|
|
|
56
48
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
|
-
exports.default =
|
|
51
|
+
exports.default = DialogSimpleCron;
|
package/README.md
CHANGED
|
@@ -686,6 +686,75 @@ class JsonComponent extends ConfigGeneric {
|
|
|
686
686
|
...
|
|
687
687
|
}
|
|
688
688
|
```
|
|
689
|
+
## Migration from v5 to v6
|
|
690
|
+
The main change is that the `withStyles` was removed. So you have to replace all `withStyles` with `sx` or `style` properties.
|
|
691
|
+
|
|
692
|
+
You can read more about sx [here](https://mui.com/system/getting-started/the-sx-prop/).
|
|
693
|
+
|
|
694
|
+
- Modify `const styles`:
|
|
695
|
+
Before:
|
|
696
|
+
```
|
|
697
|
+
const styles: Record<string, any> = (theme: IobTheme) => ({
|
|
698
|
+
dialog: {
|
|
699
|
+
height: `calc(100% - ${theme.mixins.toolbar.minHeight}px)`,
|
|
700
|
+
padding: theme.spacing(1),
|
|
701
|
+
},
|
|
702
|
+
...
|
|
703
|
+
});
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
After:
|
|
707
|
+
```
|
|
708
|
+
const styles: Record<string, any> = {
|
|
709
|
+
dialog: (theme: IobTheme) => ({
|
|
710
|
+
height: `calc(100% - ${theme => theme.mixins.toolbar.minHeight}px)`,
|
|
711
|
+
p: 1,
|
|
712
|
+
}),
|
|
713
|
+
};
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
- Modify `className`:
|
|
717
|
+
Before: `<div className={this.props.classes.box}>`
|
|
718
|
+
|
|
719
|
+
After: `<Box component="div" sx={styles.box}>`
|
|
720
|
+
|
|
721
|
+
Before: `<div className={Utils.clsx(this.props.classes.box1, condition && this.props.classes.box2)}>`
|
|
722
|
+
|
|
723
|
+
After: `<Box component="div" sx={Utils.getStyle(this.props.theme, this.props.classes.box1, condition && this.props.classes.box2)}>`
|
|
724
|
+
Or if no one style is a function: `<Box component="div" sx={{ ...this.props.classes.box1, ...(condition ? this.props.classes.box2 : undefined) }}>`
|
|
725
|
+
|
|
726
|
+
Do not use `sx` if the style is not dynamic (not a function). Use `style` instead.
|
|
727
|
+
|
|
728
|
+
Be aware, that all paddings and margins are now in `theme.spacing(1)` format.
|
|
729
|
+
So you have to replace all `padding: 8` with `padding: 1` or with `padding: '8px'`.
|
|
730
|
+
|
|
731
|
+
The best practice is to replace `padding` with `p` and `margin` with `m`, so you will see immediately that it is a padding or margin for `sx` property.
|
|
732
|
+
|
|
733
|
+
- Modify `classes`:
|
|
734
|
+
Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
|
|
735
|
+
|
|
736
|
+
After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
737
|
+
|
|
738
|
+
Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
|
|
739
|
+
|
|
740
|
+
After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
741
|
+
|
|
742
|
+
Before: `<ListItem classes={{ root: styles.listItem }} >`
|
|
743
|
+
|
|
744
|
+
After: `<ListItem sx={{ '&.MuiListItem-root': styles.listItem }} >`
|
|
745
|
+
|
|
746
|
+
Before: `<Typography component="h2" variant="h6" classes={{ root: styles.typography }}>`
|
|
747
|
+
|
|
748
|
+
After: `<Typography component="h2" variant="h6" sx={{ '&.MuiTypography-root': styles.typography }}>`
|
|
749
|
+
|
|
750
|
+
Before: `<Badge classes={{ 'badge': styles.expertBadge }}>`
|
|
751
|
+
|
|
752
|
+
After: `<Badge sx={{ '& .MuiBadge-badge': styles.expertBadge }}>`
|
|
753
|
+
|
|
754
|
+
Before: `<Tooltip title={this.props.t('ra_Refresh tree')} classes={{ popper: styles.tooltip }}>`
|
|
755
|
+
|
|
756
|
+
After: `<Tooltip title={this.props.t('ra_Refresh tree')} componentsProps={{ popper: { sx: { pointerEvents: 'none' } } }}>`
|
|
757
|
+
Or: `<Tooltip title={this.props.t('ra_Refresh tree')} componentsProps={{ popper: { sx: styles.tooltip } }}>`
|
|
689
758
|
|
|
690
759
|
## Warning
|
|
691
760
|
`react-inlinesvg@4.0.5` cannot be used. Use `react-inlinesvg@4.0.3` instead.
|
|
@@ -695,7 +764,11 @@ class JsonComponent extends ConfigGeneric {
|
|
|
695
764
|
-->
|
|
696
765
|
|
|
697
766
|
## Changelog
|
|
698
|
-
###
|
|
767
|
+
### 6.0.0 (2024-06-19)
|
|
768
|
+
* (bluefox) Removed the usage of `withStyles` in favor of `sx` and `style` properties (see [Migration from v5 to v6](#migration-from-v5-to-v6)
|
|
769
|
+
* (bluefox) (BREAKING) Higher version of `@mui/material` (5.15.20) is used
|
|
770
|
+
|
|
771
|
+
### 5.0.8 (2024-06-15)
|
|
699
772
|
* (bluefox) Added `modulefederation.admin.config.js` for module federation
|
|
700
773
|
|
|
701
774
|
### 5.0.5 (2024-06-10)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/adapter-react-v5",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "React classes to develop admin interfaces for ioBroker with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Denis Haev (bluefox)",
|
|
@@ -30,12 +30,11 @@
|
|
|
30
30
|
"@emotion/react": "^11.11.4",
|
|
31
31
|
"@emotion/styled": "^11.11.5",
|
|
32
32
|
"@iobroker/socket-client": "^2.4.18",
|
|
33
|
-
"@iobroker/types": "^6.0.
|
|
34
|
-
"@iobroker/js-controller-common": "^6.0.
|
|
35
|
-
"@iobroker/js-controller-common-db": "^6.0.
|
|
33
|
+
"@iobroker/types": "^6.0.5",
|
|
34
|
+
"@iobroker/js-controller-common": "^6.0.5",
|
|
35
|
+
"@iobroker/js-controller-common-db": "^6.0.5",
|
|
36
36
|
"@mui/icons-material": "^5.15.20",
|
|
37
|
-
"@mui/material": "5.
|
|
38
|
-
"@mui/styles": "5.14.14",
|
|
37
|
+
"@mui/material": "^5.15.20",
|
|
39
38
|
"@mui/x-date-pickers": "^7.7.0",
|
|
40
39
|
"@sentry/browser": "^8.9.2",
|
|
41
40
|
"react-color": "^2.19.3",
|
|
@@ -43,6 +42,6 @@
|
|
|
43
42
|
"react-cropper": "^2.3.3",
|
|
44
43
|
"react-dropzone": "^14.2.3",
|
|
45
44
|
"react-icons": "^5.2.1",
|
|
46
|
-
"react-inlinesvg": "4.
|
|
45
|
+
"react-inlinesvg": "4.1.3"
|
|
47
46
|
}
|
|
48
47
|
}
|