UNPKG

iobroker.lovelace

Version:

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

2 lines 2.39 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["68728"],{19676:function(t,e,i){i.r(e),i.d(e,{HuiSelectOptionsCardFeatureEditor:()=>h});var o=i(58814),s=i(61701),n=(i(71695),i(9359),i(70104),i(19423),i(47021),i(57243)),a=i(50778),l=i(27486),d=i(36522);i(29073);const u=["customize_options"];let c,r=t=>t,h=(0,s.Z)([(0,a.Mo)("hui-select-options-card-feature-editor")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(t){this._config=t}},{kind:"field",key:"_schema",value(){return(0,l.Z)(((t,e,i)=>{var o;return[{name:"customize_options",selector:{boolean:{}}},...i?[{name:"options",selector:{select:{multiple:!0,reorder:!0,options:(null==e||null===(o=e.attributes.options)||void 0===o?void 0:o.map((i=>({value:i,label:t(e,i)}))))||[]}}}]:[]]}))}},{kind:"method",key:"render",value:function(){var t,e;if(!this.hass||!this._config)return n.Ld;const i=null!==(t=this.context)&&void 0!==t&&t.entity_id?this.hass.states[null===(e=this.context)||void 0===e?void 0:e.entity_id]:void 0,o=Object.assign(Object.assign({},this._config),{},{customize_options:void 0!==this._config.options}),s=this._schema(this.hass.formatEntityState,i,o.customize_options);return(0,n.dy)(c||(c=r` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,o,s,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(t){var e,i;const s=t.detail.value,{customize_options:n}=s,a=(0,o.Z)(s,u),l=null!==(e=this.context)&&void 0!==e&&e.entity_id?this.hass.states[null===(i=this.context)||void 0===i?void 0:i.entity_id]:void 0;n&&!a.options&&(a.options=(null==l?void 0:l.attributes.options)||[]),!n&&a.options&&delete a.options,(0,d.B)(this,"config-changed",{config:a})}},{kind:"field",key:"_computeLabelCallback",value(){return 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""}}}}]}}),n.oi)}}]); //# sourceMappingURL=68728.40ad8c403595af87.js.map