TP_JO2024/home/dist/component/display/display.module.min.js

4 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2024-03-27 17:19:37 +01:00
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
const e=window.dsfr,s={DISPLAY:e.internals.ns.selector("display"),RADIO_BUTTONS:`input[name="${e.internals.ns("radios-theme")}"]`,FIELDSET:e.internals.ns.selector("fieldset")};class i extends e.core.Instance{static get instanceClassName(){return"Display"}init(){if(this.radios=this.querySelectorAll(s.RADIO_BUTTONS),e.scheme){this.changing=this.change.bind(this);for(const e of this.radios)e.addEventListener("change",this.changing);this.addDescent(e.scheme.SchemeEmission.SCHEME,this.apply.bind(this)),this.ascend(e.scheme.SchemeEmission.ASK)}else this.querySelector(s.FIELDSET).setAttribute("disabled","")}get scheme(){return this._scheme}set scheme(s){if(this._scheme!==s&&e.scheme)switch(s){case e.scheme.SchemeValue.SYSTEM:case e.scheme.SchemeValue.LIGHT:case e.scheme.SchemeValue.DARK:this._scheme=s;for(const e of this.radios)e.checked=e.value===s;this.ascend(e.scheme.SchemeEmission.SCHEME,s)}}change(){for(const e of this.radios)if(e.checked)return void(this.scheme=e.value)}apply(e){this.scheme=e}dispose(){for(const e of this.radios)e.removeEventListener("change",this.changing)}}e.display={Display:i,DisplaySelector:s},e.internals.register(e.display.DisplaySelector.DISPLAY,e.display.Display);
//# sourceMappingURL=display.module.min.js.map