iobroker.mywebui 1.37.86 → 1.37.88
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
|
@@ -674,25 +674,54 @@ export class IobrokerWebuiScreenEditor extends BaseCustomWebComponentConstructor
|
|
|
674
674
|
const shadowRoot = rootEl?.shadowRoot;
|
|
675
675
|
if (!rootEl || !shadowRoot) return;
|
|
676
676
|
try {
|
|
677
|
-
//
|
|
678
|
-
//
|
|
679
|
-
|
|
677
|
+
// Proxy wraps rootEl so ALL native HTMLElement methods (querySelector, closest, etc.) work.
|
|
678
|
+
// Custom WebUI API and attachInternals stub are injected via overrides.
|
|
679
|
+
// attachInternals() is intercepted because the designer rootEl is a plain HTMLDivElement
|
|
680
|
+
// (not a custom element), so the native call would throw NotSupportedError.
|
|
681
|
+
let _internalsStub = null;
|
|
682
|
+
const overrides = {
|
|
680
683
|
shadowRoot,
|
|
681
684
|
_getDomElement(id) {
|
|
682
685
|
return shadowRoot.getElementById(id) ?? shadowRoot.querySelector(`[name="${id}"]`);
|
|
683
686
|
},
|
|
684
687
|
_assignEvent(id, evtName, handler) {
|
|
685
|
-
const el =
|
|
688
|
+
const el = overrides._getDomElement(id);
|
|
686
689
|
if (el) el.addEventListener(evtName, handler);
|
|
687
690
|
},
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
691
|
+
attachInternals() {
|
|
692
|
+
if (!_internalsStub) {
|
|
693
|
+
_internalsStub = {
|
|
694
|
+
setFormValue() {},
|
|
695
|
+
setValidity() {},
|
|
696
|
+
checkValidity() { return true; },
|
|
697
|
+
reportValidity() { return true; },
|
|
698
|
+
form: null,
|
|
699
|
+
validity: { valid: true, valueMissing: false, typeMismatch: false, patternMismatch: false, tooLong: false, tooShort: false, rangeUnderflow: false, rangeOverflow: false, stepMismatch: false, badInput: false, customError: false },
|
|
700
|
+
validationMessage: '',
|
|
701
|
+
willValidate: false,
|
|
702
|
+
labels: [],
|
|
703
|
+
states: { add() {}, delete() {}, has() { return false; }, clear() {}, forEach() {} },
|
|
704
|
+
role: null,
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
return _internalsStub;
|
|
708
|
+
},
|
|
695
709
|
};
|
|
710
|
+
const facade = new Proxy(rootEl, {
|
|
711
|
+
get(target, prop, receiver) {
|
|
712
|
+
if (prop in overrides) {
|
|
713
|
+
const v = overrides[prop];
|
|
714
|
+
return typeof v === 'function' ? v.bind(overrides) : v;
|
|
715
|
+
}
|
|
716
|
+
const v = target[prop];
|
|
717
|
+
return typeof v === 'function' ? v.bind(target) : v;
|
|
718
|
+
},
|
|
719
|
+
set(target, prop, value) {
|
|
720
|
+
if (prop in overrides) { overrides[prop] = value; return true; }
|
|
721
|
+
target[prop] = value;
|
|
722
|
+
return true;
|
|
723
|
+
},
|
|
724
|
+
});
|
|
696
725
|
this._designerFacade = facade;
|
|
697
726
|
// Use scriptSystem.assignAllScripts — handles @event attrs, init(), applyBindings, etc.
|
|
698
727
|
let scriptObj = await window.appShell.scriptSystem.assignAllScripts(
|