iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 2.71 kB
JavaScript
;(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["48643"],{56435:function(e,t,s){s.r(t),s.d(t,{HuiClimatePresetModesCardFeatureEditor:()=>m});var i=s(58814),o=s(61701),a=(s(71695),s(9359),s(70104),s(19423),s(47021),s(57243)),d=s(50778),n=s(27486),l=s(36522);s(29073);const r=["customize_modes"];let u,c=e=>e,m=(0,o.Z)([(0,d.Mo)("hui-climate-preset-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,s,i)=>{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.climate-preset-modes.style_list.${t}`)})))}}},{name:"customize_modes",selector:{boolean:{}}},...i?[{name:"preset_modes",selector:{select:{reorder:!0,multiple:!0,options:(null==s||null===(o=s.attributes.preset_modes)||void 0===o?void 0:o.map((e=>({value:e,label:t(s,"preset_mode",e)}))))||[]}}}]:[]]}))}},{kind:"method",key:"render",value:function(){var e,t;if(!this.hass||!this._config)return a.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.preset_modes}),o=this._schema(this.hass.localize,this.hass.formatEntityAttributeValue,s,i.customize_modes);return(0,a.dy)(u||(u=c` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,i,o,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){var t,s;const o=e.detail.value,{customize_modes:a}=o,d=(0,i.Z)(o,r),n=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;a&&!d.preset_modes&&(d.preset_modes=(null==n?void 0:n.attributes.preset_modes)||[]),!a&&d.preset_modes&&delete d.preset_modes,(0,l.B)(this,"config-changed",{config:d})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"style":case"preset_modes":case"customize_modes":return this.hass.localize(`ui.panel.lovelace.editor.features.types.climate-preset-modes.${e.name}`);default:return""}}}}]}}),a.oi)}}]);
//# sourceMappingURL=48643.347b54601f9e0e18.js.map