UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 2.87 kB
export const __rspack_esm_id=8260;export const __rspack_esm_ids=[8260];export const __webpack_modules__={4623(e,t,s){s.a(e,async function(e,o){try{s.r(t),s.d(t,{HuiClimateSwingHorizontalModesCardFeatureEditor:()=>l});var i=s(62826),a=s(22441),r=s(23929),d=e([r]);r=(d.then?(await d)():d)[0];const n={featureType:"climate-swing-horizontal-modes",i18nFeatureId:"climate-swing-horizontal-modes",modeField:"swing_horizontal_modes",defaultStyle:"dropdown",getAvailableModesOrdered:e=>e?.attributes.swing_horizontal_modes??[],getModeLabel:(e,t,s)=>t?e.formatEntityAttributeValue(t,"swing_horizontal_mode",s):s};class l extends r.k{constructor(...e){super(...e),this.descriptor=n}}l=(0,i.Cg)([(0,a.EM)("hui-climate-swing-horizontal-modes-card-feature-editor")],l),o()}catch(e){o(e)}})},23929(e,t,s){s.a(e,async function(e,o){try{s.d(t,{k:()=>m});s(18111),s(61701);var i=s(62826),a=s(5124),r=s(22441),d=s(22786),n=s(1087),l=s(52763),c=e([l]);function h(e){const{customize_modes:t,...s}=e;return s}l=(c.then?(await c)():c)[0];class m extends a.WF{setConfig(e){e.type===this.descriptor.featureType&&(this._config=e)}render(){if(!this.hass||!this._config)return a.s6;const e=this.context?.entity_id?this.hass.states[this.context.entity_id]:void 0,{modeField:t,defaultStyle:s}=this.descriptor,o={style:s,...this._config,customize_modes:void 0!==this._config[t]},i=this._schema(this.hass.localize,e,o.customize_modes);return a.qy` <ha-form .hass="${this.hass}" .data="${o}" .schema="${i}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(e){const t=e.detail.value,s=t.customize_modes;let o=h(t);const i=this.context?.entity_id?this.hass.states[this.context.entity_id]:void 0,{modeField:a,getAvailableModesOrdered:r}=this.descriptor,d=a;s&&!o[d]&&(o={...o,[a]:r(i)}),s||void 0===o[d]||delete o[d],(0,n.r)(this,"config-changed",{config:o})}constructor(...e){super(...e),this._schema=(0,d.A)((e,t,s)=>{const o=this.descriptor,i=o.styleListI18nFeatureId??o.i18nFeatureId;return[{name:"style",selector:{select:{multiple:!1,mode:"list",options:["dropdown","icons"].map(t=>({value:t,label:e(`ui.panel.lovelace.editor.features.types.${i}.style_list.${t}`)}))}}},{name:"customize_modes",selector:{boolean:{}}},...s?[{name:o.modeField,selector:{select:{reorder:!0,multiple:!0,options:o.getAvailableModesOrdered(t).map(e=>({value:e,label:o.getModeLabel(this.hass,t,e)}))}}}]:[]]}),this._computeLabelCallback=e=>{const t=this.descriptor.i18nFeatureId,{modeField:s}=this.descriptor;return"style"===e.name||"customize_modes"===e.name||e.name===s?this.hass.localize(`ui.panel.lovelace.editor.features.types.${t}.${e.name}`):""}}}(0,i.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],m.prototype,"context",void 0),(0,i.Cg)([(0,r.wk)()],m.prototype,"_config",void 0),o()}catch(u){o(u)}})}};