iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 2.15 kB
JavaScript
export const __webpack_ids__=["47424"];export const __webpack_modules__={6303:function(e,t,o){o.r(t),o.d(t,{HuiWaterHeaterOperationModesCardFeatureEditor:()=>c});var i=o(44249),a=(o(9359),o(70104),o(57243)),s=o(15093),n=o(27486),r=o(36522),d=(o(29073),o(6703));let c=(0,i.Z)([(0,s.Mo)("hui-water-heater-operation-modes-card-feature-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){this._config=e}},{kind:"field",key:"_schema",value:()=>(0,n.Z)(((e,t,o)=>[{name:"customize_modes",selector:{boolean:{}}},...o?[{name:"operation_modes",selector:{select:{reorder:!0,multiple:!0,options:(t?.attributes.operation_list||[]).concat().sort(d.P_).map((o=>({value:o,label:t?e(t,o):o})))}}}]:[]]))},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return a.Ld;const e=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0,t={...this._config,customize_modes:void 0!==this._config.operation_modes},o=this._schema(this.hass.formatEntityState,e,t.customize_modes);return a.dy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${o}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){const{customize_modes:t,...o}=e.detail.value,i=this.context?.entity_id?this.hass.states[this.context?.entity_id]:void 0;t&&!o.operation_modes&&(o.operation_modes=(i?.attributes.operation_list||[]).concat().sort(d.P_)),!t&&o.operation_modes&&delete o.operation_modes,(0,r.B)(this,"config-changed",{config:o})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"operation_modes":case"customize_modes":return this.hass.localize(`ui.panel.lovelace.editor.features.types.water-heater-operation-modes.${e.name}`);default:return""}}}}]}}),a.oi)}};
//# sourceMappingURL=47424.40e8ab2ecc1ad843.js.map