UNPKG

iobroker.lovelace

Version:

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

1 lines 1.8 kB
export const __rspack_esm_id=45555;export const __rspack_esm_ids=[45555];export const __webpack_modules__={21630(t,e,s){s.a(t,async function(t,o){try{s.r(e),s.d(e,{HuiSelectOptionsCardFeatureEditor:()=>l});s(18111),s(61701);var i=s(62826),a=s(5124),n=s(22441),c=s(22786),r=s(1087),h=s(52763),p=t([h]);h=(p.then?(await p)():p)[0];class l extends a.WF{setConfig(t){this._config=t}render(){if(!this.hass||!this._config)return a.s6;const t=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0,e={...this._config,customize_options:void 0!==this._config.options},s=this._schema(this.hass.formatEntityState,t,e.customize_options);return a.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${s}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){const{customize_options:e,...s}=t.detail.value,o=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0;e&&!s.options&&(s.options=o?.attributes.options||[]),!e&&s.options&&delete s.options,(0,r.r)(this,"config-changed",{config:s})}constructor(...t){super(...t),this._schema=(0,c.A)((t,e,s)=>[{name:"customize_options",selector:{boolean:{}}},...s?[{name:"options",selector:{select:{multiple:!0,reorder:!0,options:e?.attributes.options?.map(s=>({value:s,label:t(e,s)}))||[]}}}]:[]]),this._computeLabelCallback=t=>{switch(t.name){case"options":case"customize_options":return this.hass.localize(`ui.panel.lovelace.editor.features.types.select-options.${t.name}`);default:return""}}}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"context",void 0),(0,i.Cg)([(0,n.wk)()],l.prototype,"_config",void 0),l=(0,i.Cg)([(0,n.EM)("hui-select-options-card-feature-editor")],l),o()}catch(t){o(t)}})}};