UNPKG

iobroker.lovelace

Version:

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

1 lines 3.92 kB
export const __rspack_esm_id=99117;export const __rspack_esm_ids=[99117];export const __webpack_modules__={91484(e,t,o){o.a(e,async function(e,a){try{o.r(t),o.d(t,{HuiButtonCardEditor:()=>q});o(74423);var n=o(62826),i=o(5124),c=o(22441),s=o(22786),l=o(63533),h=o(1087),r=o(52763),_=o(40205),d=o(999),m=o(91408),u=o(84698),p=o(44155),g=o(7382),f=e([r,_,d]);[r,_,d]=f.then?(await f)():f;const b="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",y=(0,l.kp)(u.H,(0,l.Ik)({entity:(0,l.lq)((0,l.Yj)()),name:(0,l.lq)(p.q),show_name:(0,l.lq)((0,l.zM)()),icon:(0,l.lq)((0,l.Yj)()),show_icon:(0,l.lq)((0,l.zM)()),icon_height:(0,l.lq)((0,l.Yj)()),tap_action:(0,l.lq)(m.kn),hold_action:(0,l.lq)(m.kn),double_tap_action:(0,l.lq)(m.kn),theme:(0,l.lq)((0,l.Yj)()),show_state:(0,l.lq)((0,l.zM)()),state_color:(0,l.lq)((0,l.zM)()),color:(0,l.lq)((0,l.Yj)())}));class q extends i.WF{setConfig(e){if((0,l.vA)(e,y),void 0!==e.state_color)return delete(e={...e,color:e.state_color?void 0:"none"}).state_color,void(0,h.r)(this,"config-changed",{config:e});this._config=e}render(){if(!this.hass||!this._config)return i.s6;const e={show_name:!0,show_icon:!0,...this._config};e.icon_height?.includes("px")&&(e.icon_height=String(parseFloat(e.icon_height)));const t=this._schema(this._config.entity);return i.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${t}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(e){const t=e.detail.value;t.icon_height&&!t.icon_height.endsWith("px")&&(t.icon_height+="px"),(0,h.r)(this,"config-changed",{config:t})}constructor(...e){super(...e),this._schema=(0,s.A)(e=>[{name:"entity",selector:{entity:{}}},{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"",type:"grid",schema:[{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"icon_height",selector:{text:{suffix:"px"}}},{name:"color",selector:{ui_color:{default_color:"state",include_state:!0,include_none:!0}}},{name:"theme",selector:{theme:{}}}]},{name:"",type:"grid",column_min_width:"100px",schema:[{name:"show_name",selector:{boolean:{}}},{name:"show_state",selector:{boolean:{}}},{name:"show_icon",selector:{boolean:{}}}]},{name:"interactions",type:"expandable",flatten:!0,iconPath:b,schema:[{name:"tap_action",selector:{ui_action:{default_action:(0,_.N)(e)}},context:d.Tq},{name:"hold_action",selector:{ui_action:{default_action:"more-info"}},context:d.Tq},{name:"",type:"optional_actions",flatten:!0,schema:[{name:"double_tap_action",selector:{ui_action:{default_action:"none"}},context:d.Tq}]}]}]),this._computeHelperCallback=e=>{switch(e.name){case"tap_action":case"hold_action":return this.hass.localize("ui.panel.lovelace.editor.card.button.default_action_help");default:return}},this._computeLabelCallback=e=>{switch(e.name){case"theme":case"tap_action":case"hold_action":return`${this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}}q.styles=g.U,(0,n.Cg)([(0,c.MZ)({attribute:!1})],q.prototype,"hass",void 0),(0,n.Cg)([(0,c.wk)()],q.prototype,"_config",void 0),q=(0,n.Cg)([(0,c.EM)("hui-button-card-editor")],q),a()}catch(e){a(e)}})},84698(e,t,o){o.d(t,{H:()=>n});var a=o(63533);const n=(0,a.Ik)({type:(0,a.Yj)(),view_layout:(0,a.bz)(),layout_options:(0,a.bz)(),grid_options:(0,a.bz)(),visibility:(0,a.bz)(),disabled:(0,a.lq)((0,a.zM)())})}};