iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 2.52 kB
JavaScript
;(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["47424"],{6303:function(e,t,o){o.r(t),o.d(t,{HuiWaterHeaterOperationModesCardFeatureEditor:()=>m});var i=o(58814),s=o(61701),a=(o(71695),o(61893),o(9359),o(70104),o(19423),o(47021),o(57243)),n=o(50778),d=o(27486),r=o(36522),c=(o(29073),o(6703));const l=["customize_modes"];let u,h=e=>e,m=(0,s.Z)([(0,n.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,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,o)=>[{name:"customize_modes",selector:{boolean:{}}},...o?[{name:"operation_modes",selector:{select:{reorder:!0,multiple:!0,options:((null==t?void 0:t.attributes.operation_list)||[]).concat().sort(c.P_).map((o=>({value:o,label:t?e(t,o):o})))}}}]:[]]))}},{kind:"method",key:"render",value:function(){var e,t;if(!this.hass||!this._config)return a.Ld;const o=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({},this._config),{},{customize_modes:void 0!==this._config.operation_modes}),s=this._schema(this.hass.formatEntityState,o,i.customize_modes);return(0,a.dy)(u||(u=h` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,i,s,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){var t,o;const s=e.detail.value,{customize_modes:a}=s,n=(0,i.Z)(s,l),d=null!==(t=this.context)&&void 0!==t&&t.entity_id?this.hass.states[null===(o=this.context)||void 0===o?void 0:o.entity_id]:void 0;a&&!n.operation_modes&&(n.operation_modes=((null==d?void 0:d.attributes.operation_list)||[]).concat().sort(c.P_)),!a&&n.operation_modes&&delete n.operation_modes,(0,r.B)(this,"config-changed",{config:n})}},{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.a524e45aa6f33d01.js.map