UNPKG

iobroker.lovelace

Version:

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

2 lines 2.3 kB
export const __webpack_ids__=["45280"];export const __webpack_modules__={25426:function(e,t,s){s.r(t),s.d(t,{HuiFanPresetModesCardFeatureEditor:()=>r});var o=s(44249),i=(s(9359),s(70104),s(57243)),a=s(15093),d=s(27486),n=s(36522);s(29073);let r=(0,o.Z)([(0,a.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,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:()=>(0,d.Z)(((e,t,s,o)=>[{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:s?.attributes.preset_modes?.map((e=>({value:e,label:t(s,"preset_mode",e)})))||[]}}}]:[]]))},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return i.Ld;const e=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0,t={style:"dropdown",...this._config,customize_modes:void 0!==this._config.preset_modes},s=this._schema(this.hass.localize,this.hass.formatEntityAttributeValue,e,t.customize_modes);return i.dy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${s}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){const{customize_modes:t,...s}=e.detail.value,o=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0;t&&!s.preset_modes&&(s.preset_modes=o?.attributes.preset_modes||[]),!t&&s.preset_modes&&delete s.preset_modes,(0,n.B)(this,"config-changed",{config:s})}},{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""}}}}]}}),i.oi)}}; //# sourceMappingURL=45280.c08453dd3049b70d.js.map