UNPKG

iobroker.lovelace

Version:

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

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