iobroker.mywebui 1.42.46 → 1.42.47
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/package.json
CHANGED
|
@@ -2151,35 +2151,28 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
2151
2151
|
|
|
2152
2152
|
// ── 3D Screen Properties Mode ──────────────────────────────────────────────
|
|
2153
2153
|
|
|
2154
|
-
_3dPropsActive
|
|
2155
|
-
_3dPropsPanel
|
|
2156
|
-
|
|
2154
|
+
_3dPropsActive = false;
|
|
2155
|
+
_3dPropsPanel = null;
|
|
2156
|
+
_3dSettPanel = null;
|
|
2157
2157
|
|
|
2158
2158
|
_activate3DPropertiesMode(editor3DEl) {
|
|
2159
2159
|
if (this._3dPropsActive) return;
|
|
2160
2160
|
this._3dPropsActive = true;
|
|
2161
2161
|
|
|
2162
|
-
const attrDock
|
|
2163
|
-
const
|
|
2162
|
+
const attrDock = this._getDomElement('attributeDock');
|
|
2163
|
+
const settiDock = this._getDomElement('settingsDock');
|
|
2164
2164
|
|
|
2165
|
-
// Hide existing children of attributeDock
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
if (projDock) {
|
|
2173
|
-
for (const c of projDock.children) {
|
|
2174
|
-
c.__3d_prev_display = c.style.display;
|
|
2175
|
-
c.style.display = 'none';
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2165
|
+
// Hide existing children of attributeDock and settingsDock
|
|
2166
|
+
const hideChildren = el => {
|
|
2167
|
+
if (!el) return;
|
|
2168
|
+
for (const c of el.children) { c.__3d_prev_display = c.style.display; c.style.display = 'none'; }
|
|
2169
|
+
};
|
|
2170
|
+
hideChildren(attrDock);
|
|
2171
|
+
hideChildren(settiDock);
|
|
2178
2172
|
|
|
2179
2173
|
const tryConnect = () => {
|
|
2180
2174
|
if (!editor3DEl._editor) { setTimeout(tryConnect, 200); return; }
|
|
2181
2175
|
const ed = editor3DEl._editor;
|
|
2182
|
-
const base = new URL('../../../3d-editor/js/', import.meta.url).href;
|
|
2183
2176
|
|
|
2184
2177
|
// ── attributeDock: 3D Bindings panel ──────────────────────────
|
|
2185
2178
|
if (attrDock) {
|
|
@@ -2191,24 +2184,106 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
2191
2184
|
this._3dPropsPanel = propPanel;
|
|
2192
2185
|
}
|
|
2193
2186
|
|
|
2194
|
-
// ──
|
|
2195
|
-
if (
|
|
2187
|
+
// ── settingsDock: Screen Visibility Control ────────────────────
|
|
2188
|
+
if (settiDock) {
|
|
2196
2189
|
const wrap = document.createElement('div');
|
|
2197
|
-
wrap.id = '
|
|
2198
|
-
wrap.style.cssText = 'width:100%;height:100%;overflow:auto;
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
wrap.appendChild(p.dom);
|
|
2203
|
-
});
|
|
2204
|
-
projDock.appendChild(wrap);
|
|
2205
|
-
this._3dProjPanel = wrap;
|
|
2190
|
+
wrap.id = '__3d_setti';
|
|
2191
|
+
wrap.style.cssText = 'width:100%;height:100%;overflow-y:auto;box-sizing:border-box;';
|
|
2192
|
+
this._build3DVisibilityPanel(wrap, editor3DEl);
|
|
2193
|
+
settiDock.appendChild(wrap);
|
|
2194
|
+
this._3dSettPanel = wrap;
|
|
2206
2195
|
}
|
|
2207
2196
|
};
|
|
2208
2197
|
|
|
2209
2198
|
tryConnect();
|
|
2210
2199
|
}
|
|
2211
2200
|
|
|
2201
|
+
_build3DVisibilityPanel(container, editor3DEl) {
|
|
2202
|
+
const sceneData = editor3DEl.sceneData ?? {};
|
|
2203
|
+
editor3DEl.sceneData = sceneData;
|
|
2204
|
+
const settings = sceneData.settings ?? {};
|
|
2205
|
+
sceneData.settings = settings;
|
|
2206
|
+
if (!settings.visibilityEnabled) settings.visibilityEnabled = false;
|
|
2207
|
+
if (!settings.visibilityGroups) settings.visibilityGroups = [];
|
|
2208
|
+
if (!settings.visibilityAction) settings.visibilityAction = 'hide';
|
|
2209
|
+
if (!settings.visibilityRedirectScreen) settings.visibilityRedirectScreen = '';
|
|
2210
|
+
|
|
2211
|
+
container.innerHTML = `
|
|
2212
|
+
<div style="padding:15px;border:3px solid #2196F3;background:linear-gradient(135deg,#e3f2fd 0%,#bbdefb 100%);margin:10px;border-radius:8px;box-shadow:0 4px 6px rgba(0,0,0,.1);">
|
|
2213
|
+
<h3 style="margin:0 0 15px;font-size:16px;font-weight:bold;color:#1565C0;">🔒 Screen Visibility Control</h3>
|
|
2214
|
+
<div id="__3dvis_content"></div>
|
|
2215
|
+
</div>`;
|
|
2216
|
+
|
|
2217
|
+
const content = container.querySelector('#__3dvis_content');
|
|
2218
|
+
|
|
2219
|
+
content.innerHTML = `
|
|
2220
|
+
<div style="padding:10px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;margin-bottom:15px;font-size:12px;color:#856404;">
|
|
2221
|
+
💡 <strong>Tip:</strong> Don't forget to save (Ctrl+S) after changing settings!
|
|
2222
|
+
</div>
|
|
2223
|
+
<div style="margin-bottom:15px;">
|
|
2224
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:500;">
|
|
2225
|
+
<input type="checkbox" id="__3dv_en" ${settings.visibilityEnabled ? 'checked' : ''} style="width:16px;height:16px;cursor:pointer;"/>
|
|
2226
|
+
<span>Enable Screen Visibility Control</span>
|
|
2227
|
+
</label>
|
|
2228
|
+
</div>
|
|
2229
|
+
<div style="margin:15px 0;">
|
|
2230
|
+
<label style="font-size:13px;font-weight:600;display:block;margin-bottom:10px;color:#555;">Only for groups:</label>
|
|
2231
|
+
<div id="__3dv_groups" style="border:1px solid #ccc;padding:10px;background:#fff;border-radius:4px;max-height:150px;overflow-y:auto;">
|
|
2232
|
+
<p style="font-size:12px;color:#999;">⏳ Loading groups...</p>
|
|
2233
|
+
</div>
|
|
2234
|
+
</div>
|
|
2235
|
+
<div style="margin:15px 0;">
|
|
2236
|
+
<label style="font-size:13px;font-weight:600;display:block;margin-bottom:8px;color:#555;">If user not in group:</label>
|
|
2237
|
+
<select id="__3dv_act" style="width:100%;padding:8px;font-size:13px;border:1px solid #ccc;border-radius:4px;background:#fff;">
|
|
2238
|
+
<option value="hide" ${settings.visibilityAction === 'hide' ? 'selected' : ''}>Show "Access Denied" message</option>
|
|
2239
|
+
<option value="redirect" ${settings.visibilityAction === 'redirect' ? 'selected' : ''}>Redirect to another screen</option>
|
|
2240
|
+
</select>
|
|
2241
|
+
</div>
|
|
2242
|
+
<div id="__3dv_rdiv" style="margin:15px 0;display:${settings.visibilityAction === 'redirect' ? 'block' : 'none'};">
|
|
2243
|
+
<label style="font-size:13px;font-weight:600;display:block;margin-bottom:8px;color:#555;">Redirect to screen:</label>
|
|
2244
|
+
<input type="text" id="__3dv_redir" placeholder="Enter screen name"
|
|
2245
|
+
value="${settings.visibilityRedirectScreen || ''}"
|
|
2246
|
+
style="width:100%;padding:8px;font-size:13px;border:1px solid #ccc;border-radius:4px;background:#fff;box-sizing:border-box;"/>
|
|
2247
|
+
</div>`;
|
|
2248
|
+
|
|
2249
|
+
content.querySelector('#__3dv_en')?.addEventListener('change', e => { settings.visibilityEnabled = e.target.checked; });
|
|
2250
|
+
const actEl = content.querySelector('#__3dv_act');
|
|
2251
|
+
const rdDiv = content.querySelector('#__3dv_rdiv');
|
|
2252
|
+
actEl?.addEventListener('change', e => {
|
|
2253
|
+
settings.visibilityAction = e.target.value;
|
|
2254
|
+
if (rdDiv) rdDiv.style.display = e.target.value === 'redirect' ? 'block' : 'none';
|
|
2255
|
+
});
|
|
2256
|
+
content.querySelector('#__3dv_redir')?.addEventListener('input', e => { settings.visibilityRedirectScreen = e.target.value; });
|
|
2257
|
+
|
|
2258
|
+
// Load groups async
|
|
2259
|
+
const grpEl = content.querySelector('#__3dv_groups');
|
|
2260
|
+
iobrokerHandler.getUserGroups?.().then(groups => {
|
|
2261
|
+
if (!grpEl) return;
|
|
2262
|
+
if (!groups?.length) { grpEl.innerHTML = '<div style="padding:10px;color:#f44336;">⚠️ No groups found!</div>'; return; }
|
|
2263
|
+
let html = '';
|
|
2264
|
+
groups.forEach(g => {
|
|
2265
|
+
const id = g.id ?? g._id ?? g.name ?? g;
|
|
2266
|
+
const lbl = g.name ?? id;
|
|
2267
|
+
const chk = (settings.visibilityGroups || []).includes(id);
|
|
2268
|
+
html += `<div style="padding:8px;margin:4px 0;background:#f9f9f9;border-radius:3px;">
|
|
2269
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;">
|
|
2270
|
+
<input type="checkbox" ${chk ? 'checked' : ''} data-gid="${id}" style="width:16px;height:16px;cursor:pointer;"/>
|
|
2271
|
+
<span>${lbl}</span>
|
|
2272
|
+
</label></div>`;
|
|
2273
|
+
});
|
|
2274
|
+
grpEl.innerHTML = html;
|
|
2275
|
+
grpEl.querySelectorAll('input[data-gid]').forEach(cb => {
|
|
2276
|
+
cb.addEventListener('change', e => {
|
|
2277
|
+
const gid = cb.dataset.gid;
|
|
2278
|
+
let arr = settings.visibilityGroups || [];
|
|
2279
|
+
if (e.target.checked) { if (!arr.includes(gid)) arr.push(gid); }
|
|
2280
|
+
else arr = arr.filter(x => x !== gid);
|
|
2281
|
+
settings.visibilityGroups = arr;
|
|
2282
|
+
});
|
|
2283
|
+
});
|
|
2284
|
+
}).catch(() => { if (grpEl) grpEl.innerHTML = '<div style="padding:10px;color:#f44336;">⚠️ Error loading groups</div>'; });
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2212
2287
|
_deactivate3DPropertiesMode() {
|
|
2213
2288
|
if (!this._3dPropsActive) return;
|
|
2214
2289
|
this._3dPropsActive = false;
|
|
@@ -2226,10 +2301,10 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
|
|
|
2226
2301
|
};
|
|
2227
2302
|
|
|
2228
2303
|
restore('attributeDock', this._3dPropsPanel);
|
|
2229
|
-
restore('
|
|
2304
|
+
restore('settingsDock', this._3dSettPanel);
|
|
2230
2305
|
|
|
2231
2306
|
this._3dPropsPanel = null;
|
|
2232
|
-
this.
|
|
2307
|
+
this._3dSettPanel = null;
|
|
2233
2308
|
}
|
|
2234
2309
|
}
|
|
2235
2310
|
window.customElements.define('iobroker-webui-app-shell', IobrokerWebuiAppShell);
|