iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 2.37 kB
JavaScript
export const __rspack_esm_id=8247;export const __rspack_esm_ids=[8247];export const __webpack_modules__={682(e,t,a){a.a(e,async function(e,s){try{a.r(t),a.d(t,{HuiEnergySourcesTableCardEditor:()=>y});var o=a(62826),l=a(5124),i=a(22441),r=a(63533),c=a(22786),n=a(1087),u=a(52763),h=a(84698),p=e([u]);u=(p.then?(await p)():p)[0];const _=(0,r.kp)(h.H,(0,r.Ik)({type:(0,r.eu)("energy-sources-table"),title:(0,r.lq)((0,r.Yj)()),collection_key:(0,r.lq)((0,r.Yj)()),types:(0,r.lq)((0,r.YO)((0,r.KC)([(0,r.eu)("grid"),(0,r.eu)("solar"),(0,r.eu)("battery"),(0,r.eu)("gas"),(0,r.eu)("water")]))),show_only_totals:(0,r.lq)((0,r.zM)())})),d=["grid","solar","battery","gas","water"];class y extends l.WF{setConfig(e){(0,r.vA)(e,_),this._config=e}render(){if(!this.hass||!this._config)return l.s6;const e=this._schema(this.hass.localize),t={...this._config};return l.qy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${e}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}" @value-changed="${this._valueChanged}"></ha-form>`}_valueChanged(e){(0,n.r)(this,"config-changed",{config:e.detail.value})}constructor(...e){super(...e),this._schema=(0,c.A)(e=>[{name:"title",selector:{text:{}}},{name:"",type:"grid",schema:[{name:"types",required:!1,selector:{select:{multiple:!0,mode:"list",options:d.map(t=>({value:t,label:e(`ui.panel.lovelace.editor.card.energy-sources-table.type_options.${t}`)}))}}},{name:"show_only_totals",required:!1,selector:{boolean:{}}},{type:"string",name:"collection_key",required:!1}]}]),this._computeHelperCallback=e=>{if("collection_key"===e.name)return this.hass.localize("ui.panel.lovelace.editor.card.generic.collection_key_description")},this._computeLabelCallback=e=>{switch(e.name){case"types":case"show_only_totals":return this.hass.localize(`ui.panel.lovelace.editor.card.energy-sources-table.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}}(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,i.wk)()],y.prototype,"_config",void 0),y=(0,o.Cg)([(0,i.EM)("hui-energy-sources-table-card-editor")],y),s()}catch(e){s(e)}})},84698(e,t,a){a.d(t,{H:()=>o});var s=a(63533);const o=(0,s.Ik)({type:(0,s.Yj)(),view_layout:(0,s.bz)(),layout_options:(0,s.bz)(),grid_options:(0,s.bz)(),visibility:(0,s.bz)(),disabled:(0,s.lq)((0,s.zM)())})}};