iobroker.mywebui 1.37.30 → 1.37.32
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/io-package.json
CHANGED
package/package.json
CHANGED
|
@@ -3,15 +3,11 @@ import { iobrokerHandler } from "../common/IobrokerHandler.js";
|
|
|
3
3
|
|
|
4
4
|
export class IobrokerWebuiPropertyGrid extends VisualizationPropertyGrid {
|
|
5
5
|
saveCallback;
|
|
6
|
-
_visibilityPanel;
|
|
7
|
-
_visibilityPanelCreated = false;
|
|
8
6
|
_screenVisibilityPanel;
|
|
9
7
|
_screenVisibilityPanelCreated = false;
|
|
10
|
-
|
|
8
|
+
|
|
11
9
|
constructor() {
|
|
12
10
|
super();
|
|
13
|
-
|
|
14
|
-
// Watch for property grid changes without breaking parent
|
|
15
11
|
this._setupScreenVisibilityObserver();
|
|
16
12
|
}
|
|
17
13
|
|
|
@@ -47,166 +43,6 @@ export class IobrokerWebuiPropertyGrid extends VisualizationPropertyGrid {
|
|
|
47
43
|
}, 200); // Check every 200ms
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
_ensureVisibilityPanel() {
|
|
51
|
-
if (!this._visibilityPanelCreated) {
|
|
52
|
-
this._visibilityPanel = document.createElement('div');
|
|
53
|
-
this._visibilityPanel.id = 'visibility-panel';
|
|
54
|
-
this._visibilityPanel.style.cssText = 'padding:10px;border-top:2px solid #ccc;background:#fff;';
|
|
55
|
-
this._visibilityPanel.innerHTML = `
|
|
56
|
-
<h3 style="margin:5px 0 10px 0;font-size:13px;font-weight:bold;">🔒 Visibility</h3>
|
|
57
|
-
<div id="visibility-content"></div>
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
// Find property grid container and append
|
|
61
|
-
const container = this.shadowRoot || this;
|
|
62
|
-
if (container.querySelector) {
|
|
63
|
-
const target = container.querySelector('.property-grid-container') || container;
|
|
64
|
-
target.appendChild(this._visibilityPanel);
|
|
65
|
-
} else {
|
|
66
|
-
this.appendChild(this._visibilityPanel);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
this._visibilityPanelCreated = true;
|
|
70
|
-
console.log('✅ [Visibility] Panel created and appended');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
set selectedElements(value) {
|
|
75
|
-
super.selectedElements = value;
|
|
76
|
-
|
|
77
|
-
// Ensure panel exists
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
this._ensureVisibilityPanel();
|
|
80
|
-
this._updateVisibilityPanel(value);
|
|
81
|
-
}, 50);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async _updateVisibilityPanel(elements) {
|
|
85
|
-
if (!this._visibilityPanel) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (!elements || elements.length !== 1) {
|
|
90
|
-
this._visibilityPanel.style.display = 'none';
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const element = elements[0].element;
|
|
95
|
-
this._visibilityPanel.style.display = 'block';
|
|
96
|
-
|
|
97
|
-
const content = this._visibilityPanel.querySelector('#visibility-content');
|
|
98
|
-
content.innerHTML = '';
|
|
99
|
-
|
|
100
|
-
// Get current config
|
|
101
|
-
const visibilityAttr = element.getAttribute('data-visibility');
|
|
102
|
-
let config = {};
|
|
103
|
-
if (visibilityAttr) {
|
|
104
|
-
try {
|
|
105
|
-
config = JSON.parse(visibilityAttr);
|
|
106
|
-
} catch (err) {}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Create UI
|
|
110
|
-
const updateConfig = (key, value) => {
|
|
111
|
-
config[key] = value;
|
|
112
|
-
element.setAttribute('data-visibility', JSON.stringify(config));
|
|
113
|
-
console.log('🔒 [Visibility] Updated:', config);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Enable checkbox
|
|
117
|
-
const enableContainer = document.createElement('label');
|
|
118
|
-
enableContainer.style.cssText = 'display:flex;align-items:center;gap:5px;margin-bottom:10px;cursor:pointer;';
|
|
119
|
-
const enableCheck = document.createElement('input');
|
|
120
|
-
enableCheck.type = 'checkbox';
|
|
121
|
-
enableCheck.checked = config.enabled || false;
|
|
122
|
-
enableCheck.onchange = () => updateConfig('enabled', enableCheck.checked);
|
|
123
|
-
enableContainer.appendChild(enableCheck);
|
|
124
|
-
enableContainer.appendChild(document.createTextNode('Enable Visibility Control'));
|
|
125
|
-
content.appendChild(enableContainer);
|
|
126
|
-
|
|
127
|
-
// Object ID
|
|
128
|
-
const objContainer = document.createElement('div');
|
|
129
|
-
objContainer.style.cssText = 'margin-bottom:10px;';
|
|
130
|
-
objContainer.innerHTML = '<label style="font-size:11px;font-weight:bold;display:block;margin-bottom:3px;">Object ID:</label>';
|
|
131
|
-
const objInput = document.createElement('input');
|
|
132
|
-
objInput.type = 'text';
|
|
133
|
-
objInput.value = config.objectId || '';
|
|
134
|
-
objInput.placeholder = '0_userdata.0.test';
|
|
135
|
-
objInput.style.cssText = 'width:100%;padding:5px;font-size:11px;';
|
|
136
|
-
objInput.oninput = () => updateConfig('objectId', objInput.value);
|
|
137
|
-
objContainer.appendChild(objInput);
|
|
138
|
-
content.appendChild(objContainer);
|
|
139
|
-
|
|
140
|
-
// Condition
|
|
141
|
-
const condContainer = document.createElement('div');
|
|
142
|
-
condContainer.style.cssText = 'margin-bottom:10px;';
|
|
143
|
-
condContainer.innerHTML = '<label style="font-size:11px;font-weight:bold;display:block;margin-bottom:3px;">Condition:</label>';
|
|
144
|
-
const condSelect = document.createElement('select');
|
|
145
|
-
condSelect.style.cssText = 'width:100%;padding:5px;font-size:11px;';
|
|
146
|
-
condSelect.innerHTML = '<option>==</option><option>!=</option><option>></option><option><</option><option>>=</option><option><=</option>';
|
|
147
|
-
condSelect.value = config.condition || '==';
|
|
148
|
-
condSelect.onchange = () => updateConfig('condition', condSelect.value);
|
|
149
|
-
condContainer.appendChild(condSelect);
|
|
150
|
-
content.appendChild(condContainer);
|
|
151
|
-
|
|
152
|
-
// Value
|
|
153
|
-
const valContainer = document.createElement('div');
|
|
154
|
-
valContainer.style.cssText = 'margin-bottom:10px;';
|
|
155
|
-
valContainer.innerHTML = '<label style="font-size:11px;font-weight:bold;display:block;margin-bottom:3px;">Value:</label>';
|
|
156
|
-
const valInput = document.createElement('input');
|
|
157
|
-
valInput.type = 'text';
|
|
158
|
-
valInput.value = config.conditionValue || '';
|
|
159
|
-
valInput.placeholder = '1';
|
|
160
|
-
valInput.style.cssText = 'width:100%;padding:5px;font-size:11px;';
|
|
161
|
-
valInput.oninput = () => updateConfig('conditionValue', valInput.value);
|
|
162
|
-
valContainer.appendChild(valInput);
|
|
163
|
-
content.appendChild(valContainer);
|
|
164
|
-
|
|
165
|
-
// User Groups
|
|
166
|
-
const groupsContainer = document.createElement('div');
|
|
167
|
-
groupsContainer.style.cssText = 'margin-bottom:10px;';
|
|
168
|
-
groupsContainer.innerHTML = '<label style="font-size:11px;font-weight:bold;display:block;margin-bottom:3px;">Only for groups:</label>';
|
|
169
|
-
const groupsList = document.createElement('div');
|
|
170
|
-
groupsList.style.cssText = 'max-height:100px;overflow-y:auto;border:1px solid #ccc;padding:5px;background:#f9f9f9;';
|
|
171
|
-
|
|
172
|
-
const userGroups = await iobrokerHandler.getUserGroups();
|
|
173
|
-
const selectedGroups = config.groups || [];
|
|
174
|
-
|
|
175
|
-
userGroups.forEach(group => {
|
|
176
|
-
const label = document.createElement('label');
|
|
177
|
-
label.style.cssText = 'display:flex;align-items:center;gap:5px;font-size:11px;padding:2px;cursor:pointer;';
|
|
178
|
-
const checkbox = document.createElement('input');
|
|
179
|
-
checkbox.type = 'checkbox';
|
|
180
|
-
checkbox.checked = selectedGroups.includes(group.id);
|
|
181
|
-
checkbox.onchange = () => {
|
|
182
|
-
let groups = config.groups || [];
|
|
183
|
-
if (checkbox.checked) {
|
|
184
|
-
if (!groups.includes(group.id)) groups.push(group.id);
|
|
185
|
-
} else {
|
|
186
|
-
groups = groups.filter(g => g !== group.id);
|
|
187
|
-
}
|
|
188
|
-
updateConfig('groups', groups);
|
|
189
|
-
};
|
|
190
|
-
label.appendChild(checkbox);
|
|
191
|
-
label.appendChild(document.createTextNode(group.name));
|
|
192
|
-
groupsList.appendChild(label);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
groupsContainer.appendChild(groupsList);
|
|
196
|
-
content.appendChild(groupsContainer);
|
|
197
|
-
|
|
198
|
-
// Action
|
|
199
|
-
const actionContainer = document.createElement('div');
|
|
200
|
-
actionContainer.innerHTML = '<label style="font-size:11px;font-weight:bold;display:block;margin-bottom:3px;">If not in group:</label>';
|
|
201
|
-
const actionSelect = document.createElement('select');
|
|
202
|
-
actionSelect.style.cssText = 'width:100%;padding:5px;font-size:11px;';
|
|
203
|
-
actionSelect.innerHTML = '<option value="hide">Hide</option><option value="disable">Disable</option>';
|
|
204
|
-
actionSelect.value = config.action || 'hide';
|
|
205
|
-
actionSelect.onchange = () => updateConfig('action', actionSelect.value);
|
|
206
|
-
actionContainer.appendChild(actionSelect);
|
|
207
|
-
content.appendChild(actionContainer);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
46
|
_ensureScreenVisibilityPanel() {
|
|
211
47
|
if (!this._screenVisibilityPanelCreated) {
|
|
212
48
|
this._screenVisibilityPanel = document.createElement('div');
|
|
@@ -31,16 +31,15 @@ export class IobrokerWebuiVisibilityPropertiesService {
|
|
|
31
31
|
// Load user groups
|
|
32
32
|
const userGroups = await iobrokerHandler.getUserGroups();
|
|
33
33
|
|
|
34
|
-
// Simple test property first
|
|
35
34
|
const properties = [
|
|
36
35
|
{
|
|
37
|
-
name: '
|
|
38
|
-
type: '
|
|
36
|
+
name: 'hidden',
|
|
37
|
+
type: 'boolean',
|
|
39
38
|
service: this,
|
|
40
39
|
propertyType: PropertyType.propertyAndAttribute
|
|
41
40
|
}
|
|
42
41
|
];
|
|
43
|
-
|
|
42
|
+
|
|
44
43
|
return properties;
|
|
45
44
|
|
|
46
45
|
/* DISABLED FOR NOW - TESTING
|