@iobroker/adapter-react-v5 7.4.9 → 7.4.12
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/README.md +2 -2
- package/build/Components/FileBrowser.d.ts +3 -1
- package/build/Components/FileBrowser.js +44 -14
- package/build/Components/FileBrowser.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +20 -2
- package/build/Components/ObjectBrowser.js +42 -9
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Utils.js +1 -1
- package/build/Components/Utils.js.map +1 -1
- package/build/GenericApp.js +3 -3
- package/build/GenericApp.js.map +1 -1
- package/build/LegacyConnection.d.ts +13 -1
- package/build/LegacyConnection.js.map +1 -1
- package/build/types.d.ts +14 -1
- package/index.css +56 -0
- package/package.json +3 -2
|
@@ -97,6 +97,13 @@ export interface TreeItem {
|
|
|
97
97
|
data: TreeItemData;
|
|
98
98
|
children?: TreeItem[];
|
|
99
99
|
}
|
|
100
|
+
export declare function filterRoles(roleArray: {
|
|
101
|
+
role: string;
|
|
102
|
+
type: ioBroker.CommonType;
|
|
103
|
+
}[], type: ioBroker.CommonType, defaultRoles?: {
|
|
104
|
+
role: string;
|
|
105
|
+
type: ioBroker.CommonType;
|
|
106
|
+
}[]): string[];
|
|
100
107
|
export declare function getSelectIdIconFromObjects(objects: Record<string, ioBroker.Object>, id: string, lang: ioBroker.Languages, imagePrefix?: string): string | JSX.Element | null;
|
|
101
108
|
export declare const ITEM_IMAGES: Record<string, JSX.Element>;
|
|
102
109
|
export interface ObjectBrowserFilter {
|
|
@@ -121,11 +128,15 @@ interface AdapterColumn {
|
|
|
121
128
|
align?: 'center' | 'left' | 'right';
|
|
122
129
|
}
|
|
123
130
|
interface ObjectBrowserEditRoleProps {
|
|
124
|
-
|
|
131
|
+
roleArray: {
|
|
132
|
+
role: string;
|
|
133
|
+
type: ioBroker.CommonType;
|
|
134
|
+
}[];
|
|
125
135
|
id: string;
|
|
126
136
|
socket: Connection;
|
|
127
137
|
onClose: (obj?: ioBroker.Object | null) => void;
|
|
128
138
|
t: Translate;
|
|
139
|
+
commonType: ioBroker.CommonType;
|
|
129
140
|
}
|
|
130
141
|
interface ObjectViewFileDialogProps {
|
|
131
142
|
t: Translate;
|
|
@@ -188,7 +199,10 @@ interface ObjectBrowserValueProps {
|
|
|
188
199
|
interface ObjectBrowserEditObjectProps {
|
|
189
200
|
socket: Connection;
|
|
190
201
|
obj: ioBroker.AnyObject;
|
|
191
|
-
roleArray:
|
|
202
|
+
roleArray: {
|
|
203
|
+
role: string;
|
|
204
|
+
type: ioBroker.CommonType;
|
|
205
|
+
}[];
|
|
192
206
|
expertMode: boolean;
|
|
193
207
|
themeType: ThemeType;
|
|
194
208
|
theme: IobTheme;
|
|
@@ -204,6 +218,10 @@ interface ObjectBrowserEditObjectProps {
|
|
|
204
218
|
}
|
|
205
219
|
export interface ObjectAliasEditorProps {
|
|
206
220
|
t: Translate;
|
|
221
|
+
roleArray: {
|
|
222
|
+
role: string;
|
|
223
|
+
type: ioBroker.CommonType;
|
|
224
|
+
}[];
|
|
207
225
|
socket: Connection;
|
|
208
226
|
objects: Record<string, ioBroker.AnyObject>;
|
|
209
227
|
onRedirect: (id: string, delay?: number) => void;
|
|
@@ -784,6 +784,17 @@ excludeTranslations) {
|
|
|
784
784
|
result[key] = isObject ? filterObject(value, filterKeys, excludeTranslations) : value;
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
+
export function filterRoles(roleArray, type, defaultRoles) {
|
|
788
|
+
const bigRoleArray = [];
|
|
789
|
+
roleArray.forEach(role => (role.type === 'mixed' || role.type) === type &&
|
|
790
|
+
!bigRoleArray.includes(role.role) &&
|
|
791
|
+
bigRoleArray.push(role.role));
|
|
792
|
+
defaultRoles.forEach(role => (role.type === 'mixed' || role.type) === type &&
|
|
793
|
+
!bigRoleArray.includes(role.role) &&
|
|
794
|
+
bigRoleArray.push(role.role));
|
|
795
|
+
bigRoleArray.sort();
|
|
796
|
+
return bigRoleArray;
|
|
797
|
+
}
|
|
787
798
|
/**
|
|
788
799
|
* Function to generate a json-file for an object and trigger download it
|
|
789
800
|
*/
|
|
@@ -1233,9 +1244,9 @@ function buildTree(objects, options) {
|
|
|
1233
1244
|
}
|
|
1234
1245
|
if (obj) {
|
|
1235
1246
|
const common = obj.common;
|
|
1236
|
-
const role = common
|
|
1237
|
-
if (role && !info.roles.
|
|
1238
|
-
info.roles.push(role);
|
|
1247
|
+
const role = common?.role;
|
|
1248
|
+
if (role && !info.roles.find(it => it.role === role)) {
|
|
1249
|
+
info.roles.push({ role, type: common.type });
|
|
1239
1250
|
}
|
|
1240
1251
|
else if (id.startsWith('enum.rooms.')) {
|
|
1241
1252
|
info.roomEnums.push(id);
|
|
@@ -1403,7 +1414,7 @@ function buildTree(objects, options) {
|
|
|
1403
1414
|
}
|
|
1404
1415
|
return 0;
|
|
1405
1416
|
});
|
|
1406
|
-
info.roles.sort();
|
|
1417
|
+
info.roles.sort((a, b) => a.role.localeCompare(b.role));
|
|
1407
1418
|
info.types.sort();
|
|
1408
1419
|
return { info, root };
|
|
1409
1420
|
}
|
|
@@ -2287,10 +2298,32 @@ export class ObjectBrowserClass extends Component {
|
|
|
2287
2298
|
else {
|
|
2288
2299
|
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.objectSelected`);
|
|
2289
2300
|
if (this.state.selected.length) {
|
|
2290
|
-
this.setState({ selected: [] }, () =>
|
|
2301
|
+
this.setState({ selected: [] }, () => {
|
|
2302
|
+
if (this.props.onSelect) {
|
|
2303
|
+
if (this.state.focused && this.props.allowNonObjects) {
|
|
2304
|
+
// remove a task to select the pre-selected item if now we want to see another object
|
|
2305
|
+
if (this.selectFirst && this.selectFirst !== this.state.selected[0]) {
|
|
2306
|
+
this.selectFirst = '';
|
|
2307
|
+
}
|
|
2308
|
+
this.props.onSelect([this.state.focused], null, isDouble);
|
|
2309
|
+
}
|
|
2310
|
+
else {
|
|
2311
|
+
this.props.onSelect([], '');
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2291
2315
|
}
|
|
2292
2316
|
else if (this.props.onSelect) {
|
|
2293
|
-
this.props.
|
|
2317
|
+
if (this.state.focused && this.props.allowNonObjects) {
|
|
2318
|
+
// remove a task to select the pre-selected item if now we want to see another object
|
|
2319
|
+
if (this.selectFirst && this.selectFirst !== this.state.selected[0]) {
|
|
2320
|
+
this.selectFirst = '';
|
|
2321
|
+
}
|
|
2322
|
+
this.props.onSelect([this.state.focused], null, isDouble);
|
|
2323
|
+
}
|
|
2324
|
+
else {
|
|
2325
|
+
this.props.onSelect([], '');
|
|
2326
|
+
}
|
|
2294
2327
|
}
|
|
2295
2328
|
}
|
|
2296
2329
|
}
|
|
@@ -2992,7 +3025,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2992
3025
|
React.createElement(IconClose, null)))) : null));
|
|
2993
3026
|
}
|
|
2994
3027
|
getFilterSelectRole() {
|
|
2995
|
-
return this.getFilterSelect('role', this.info.roles);
|
|
3028
|
+
return this.getFilterSelect('role', this.info.roles.map(it => it.role));
|
|
2996
3029
|
}
|
|
2997
3030
|
getFilterSelectRoom() {
|
|
2998
3031
|
const rooms = this.info.roomEnums.map(id => ({
|
|
@@ -4071,7 +4104,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
4071
4104
|
}
|
|
4072
4105
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4073
4106
|
const ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4074
|
-
return (React.createElement(ObjectBrowserEditRole, { key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t,
|
|
4107
|
+
return (React.createElement(ObjectBrowserEditRole, { key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t, roleArray: this.info.roles, commonType: this.info.objects[this.state.roleDialog]?.common?.type, onClose: (obj) => {
|
|
4075
4108
|
if (obj) {
|
|
4076
4109
|
this.info.objects[this.state.roleDialog] = obj;
|
|
4077
4110
|
}
|
|
@@ -5522,7 +5555,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
5522
5555
|
return null;
|
|
5523
5556
|
}
|
|
5524
5557
|
const ObjectBrowserAliasEditor = this.props.objectBrowserAliasEditor;
|
|
5525
|
-
return (React.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
5558
|
+
return (React.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], roleArray: this.info.roles, objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
5526
5559
|
this.scrollToItem(id);
|
|
5527
5560
|
setTimeout(() => this.setState({
|
|
5528
5561
|
editObjectDialog: id,
|