iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 2.67 kB
JavaScript
;(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["49493"],{31371:function(e,t,s){s.r(t),s.d(t,{HuiClimateFanModesCardFeatureEditor:()=>m});var i=s(58814),a=s(61701),o=(s(71695),s(9359),s(70104),s(19423),s(47021),s(57243)),n=s(50778),d=s(27486),l=s(36522);s(29073);const u=["customize_modes"];let c,r=e=>e,m=(0,a.Z)([(0,n.Mo)("hui-climate-fan-modes-card-feature-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){this._config=e}},{kind:"field",key:"_schema",value(){return(0,d.Z)(((e,t,s,i)=>{var a;return[{name:"style",selector:{select:{multiple:!1,mode:"list",options:["dropdown","icons"].map((t=>({value:t,label:e(`ui.panel.lovelace.editor.features.types.climate-fan-modes.style_list.${t}`)})))}}},{name:"customize_modes",selector:{boolean:{}}},...i?[{name:"fan_modes",selector:{select:{multiple:!0,reorder:!0,options:(null==s||null===(a=s.attributes.fan_modes)||void 0===a?void 0:a.map((e=>({value:e,label:t(s,"fan_mode",e)}))))||[]}}}]:[]]}))}},{kind:"method",key:"render",value:function(){var e,t;if(!this.hass||!this._config)return o.Ld;const s=null!==(e=this.context)&&void 0!==e&&e.entity_id?this.hass.states[null===(t=this.context)||void 0===t?void 0:t.entity_id]:void 0,i=Object.assign(Object.assign({style:"dropdown"},this._config),{},{customize_modes:void 0!==this._config.fan_modes}),a=this._schema(this.hass.localize,this.hass.formatEntityAttributeValue,s,i.customize_modes);return(0,o.dy)(c||(c=r` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,i,a,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){var t,s;const a=e.detail.value,{customize_modes:o}=a,n=(0,i.Z)(a,u),d=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&&!n.fan_modes&&(n.fan_modes=(null==d?void 0:d.attributes.fan_modes)||[]),!o&&n.fan_modes&&delete n.fan_modes,(0,l.B)(this,"config-changed",{config:n})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"style":case"fan_modes":case"customize_modes":return this.hass.localize(`ui.panel.lovelace.editor.features.types.climate-fan-modes.${e.name}`);default:return""}}}}]}}),o.oi)}}]);
//# sourceMappingURL=49493.9920ed3a0ea5aa4f.js.map