UNPKG

iobroker.lovelace

Version:

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

2 lines 2.7 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["56219"],{46342:function(e,t,s){s.r(t),s.d(t,{HuiClimateSwingModesCardFeatureEditor:()=>m});var i=s(58814),o=s(61701),n=(s(71695),s(9359),s(70104),s(19423),s(47021),s(57243)),a=s(50778),d=s(27486),l=s(36522);s(29073);const u=["customize_modes"];let c,r=e=>e,m=(0,o.Z)([(0,a.Mo)("hui-climate-swing-modes-card-feature-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(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(e){this._config=e}},{kind:"field",key:"_schema",value(){return(0,d.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-swing-modes.style_list.${t}`)})))}}},{name:"customize_modes",selector:{boolean:{}}},...i?[{name:"swing_modes",selector:{select:{reorder:!0,multiple:!0,options:(null==s||null===(o=s.attributes.swing_modes)||void 0===o?void 0:o.map((e=>({value:e,label:t(s,"swing_mode",e)}))))||[]}}}]:[]]}))}},{kind:"method",key:"render",value:function(){var e,t;if(!this.hass||!this._config)return n.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.swing_modes}),o=this._schema(this.hass.localize,this.hass.formatEntityAttributeValue,s,i.customize_modes);return(0,n.dy)(c||(c=r` <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:n}=o,a=(0,i.Z)(o,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;n&&!a.swing_modes&&(a.swing_modes=(null==d?void 0:d.attributes.swing_modes)||[]),!n&&a.swing_modes&&delete a.swing_modes,(0,l.B)(this,"config-changed",{config:a})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"style":case"swing_modes":case"customize_modes":return this.hass.localize(`ui.panel.lovelace.editor.features.types.climate-swing-modes.${e.name}`);default:return""}}}}]}}),n.oi)}}]); //# sourceMappingURL=56219.d06b030aaf3bd29a.js.map