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([["45280"],{25426:function(e,t,s){s.r(t),s.d(t,{HuiFanPresetModesCardFeatureEditor:()=>m});var o=s(58814),i=s(61701),a=(s(71695),s(9359),s(70104),s(19423),s(47021),s(57243)),n=s(50778),d=s(27486),l=s(36522);s(29073);const r=["customize_modes"];let u,c=e=>e,m=(0,i.Z)([(0,n.Mo)("hui-fan-preset-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,o)=>{var i;return[{name:"style",selector:{select:{multiple:!1,mode:"list",options:["dropdown","icons"].map((t=>({value:t,label:e(`ui.panel.lovelace.editor.features.types.fan-preset-modes.style_list.${t}`)})))}}},{name:"customize_modes",selector:{boolean:{}}},...o?[{name:"preset_modes",selector:{select:{reorder:!0,multiple:!0,options:(null==s||null===(i=s.attributes.preset_modes)||void 0===i?void 0:i.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,o=Object.assign(Object.assign({style:"dropdown"},this._config),{},{customize_modes:void 0!==this._config.preset_modes}),i=this._schema(this.hass.localize,this.hass.formatEntityAttributeValue,s,o.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,o,i,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){var t,s;const i=e.detail.value,{customize_modes:a}=i,n=(0,o.Z)(i,r),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;a&&!n.preset_modes&&(n.preset_modes=(null==d?void 0:d.attributes.preset_modes)||[]),!a&&n.preset_modes&&delete n.preset_modes,(0,l.B)(this,"config-changed",{config:n})}},{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.fan-preset-modes.${e.name}`);default:return""}}}}]}}),a.oi)}}]); //# sourceMappingURL=45280.16ab2278f7dcc8d1.js.map