UNPKG

iobroker.lovelace

Version:

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

1 lines 2.17 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[45555],{21630:function(t,s,e){e.a(t,async function(t,o){try{e.r(s),e.d(s,{HuiSelectOptionsCardFeatureEditor:function(){return _}});var i=e(86518),n=(e(18111),e(61701),e(62953),e(40445)),a=e(5124),c=e(67576),r=e(22786),l=e(1087),u=e(52763),h=t([u]);u=(h.then?(await h)():h)[0];const d=["customize_options"];let p,v=t=>t;class _ extends a.WF{setConfig(t){this._config=t}render(){var t,s;if(!this.hass||!this._config)return a.s6;const e=null!==(t=this.context)&&void 0!==t&&t.entity_id?this.hass.states[null===(s=this.context)||void 0===s?void 0:s.entity_id]:void 0,o=Object.assign(Object.assign({},this._config),{},{customize_options:void 0!==this._config.options}),i=this._schema(this.hass.formatEntityState,e,o.customize_options);return(0,a.qy)(p||(p=v` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,o,i,this._computeLabelCallback,this._valueChanged)}_valueChanged(t){var s,e;const o=t.detail.value,{customize_options:n}=o,a=(0,i.A)(o,d),c=null!==(s=this.context)&&void 0!==s&&s.entity_id?this.hass.states[null===(e=this.context)||void 0===e?void 0:e.entity_id]:void 0;n&&!a.options&&(a.options=(null==c?void 0:c.attributes.options)||[]),!n&&a.options&&delete a.options,(0,l.r)(this,"config-changed",{config:a})}constructor(...t){super(...t),this._schema=(0,r.A)((t,s,e)=>{var o;return[{name:"customize_options",selector:{boolean:{}}},...e?[{name:"options",selector:{select:{multiple:!0,reorder:!0,options:(null==s||null===(o=s.attributes.options)||void 0===o?void 0:o.map(e=>({value:e,label:t(s,e)})))||[]}}}]:[]]}),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,n.Cg)([(0,c.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,n.Cg)([(0,c.MZ)({attribute:!1})],_.prototype,"context",void 0),(0,n.Cg)([(0,c.wk)()],_.prototype,"_config",void 0),_=(0,n.Cg)([(0,c.EM)("hui-select-options-card-feature-editor")],_),o()}catch(d){o(d)}})}}]);