ntrolEls.some(el => !el.hidden); let groupbox = /** @type {XULElement} */ (this.closest("groupbox")); if (hasVisibleControls) { if (this.hasAttribute(HiddenAttr.Self)) { this.removeAttribute(HiddenAttr.Self); this.removeAttribute(HiddenAttr.Search); } if (groupbox && groupbox.hasAttribute(HiddenAttr.Self)) { groupbox.removeAttribute(HiddenAttr.Search); groupbox.removeAttribute(HiddenAttr.Self); } } else { this.setAttribute(HiddenAttr.Self, ""); this.setAttribute(HiddenAttr.Search, "true"); if (groupbox && !groupbox.hasAttribute(HiddenAttr.Search)) { groupbox.setAttribute(HiddenAttr.Search, "true"); groupbox.setAttribute(HiddenAttr.Self, ""); } } } async getUpdateComplete() { let result = await super.getUpdateComplete(); // @ts-expect-error bug 1997478 await Promise.all([...this.allControlEls].map(el => el.updateComplete)); return result; } /** * Notify child controls when their input has fired an event. When controls * are nested the parent receives events for the nested controls, so this is * actually easier to manage here; it also registers fewer listeners. * * @param {SettingControlEvent} e */ onChange(e) { let inputEl = e.target; inputEl.control?.onChange(inputEl); } /** * Notify child controls when their input has been clicked. When controls * are nested the parent receives events for the nested controls, so this is * actually easier to manage here; it also registers fewer listeners. * * @param {SettingControlEvent} e */ onClick(e) { let inputEl = e.target; if (!CLICK_HANDLERS.has(inputEl.localName)) { return; } inputEl.control?.onClick(e); } /** * @param {SettingControlConfig} item */ itemTemplate(item) { let setting = this.getSetting(item.id); return html``; } /** * @param {TemplateResult} content The content to render in a container. */ containerTemplate(content) { if ( (this.srdEnabled || this.inSubPane || this.config.card == "always") && this.config.card != "never" ) { return html`${content}`; } return content; } render() { if (!this.config) { return ""; } return this.containerTemplate( html`${this.config.items.map(item => this.itemTemplate(item))}` ); } } customElements.define("setting-group", SettingGroup); PK