UNPKG

iobroker.lovelace

Version:

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

1 lines 5.38 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[12256],{93048:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{HuiEntityBadgeEditor:function(){return j}});n(74423),n(44114),n(62953);var i=n(40445),s=n(5124),o=n(67576),l=n(22786),c=n(63533),r=n(1087),d=n(52763),_=n(67066),h=n(999),u=n(91408),p=n(45031),m=n(44155),y=n(7382),g=n(16161),f=e([d,g,_,h]);[d,g,_,h]=f.then?(await f)():f;let b,q,v=e=>e;const C="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",w="M4,9H20V11H4V9M4,13H14V15H4V13Z",k=(0,c.kp)(p.y,(0,c.Ik)({entity:(0,c.lq)((0,c.Yj)()),display_type:(0,c.lq)((0,c.vP)(_.rU)),name:(0,c.lq)(m.q),icon:(0,c.lq)((0,c.Yj)()),state_content:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.YO)((0,c.Yj)())])),color:(0,c.lq)((0,c.Yj)()),show_name:(0,c.lq)((0,c.zM)()),show_state:(0,c.lq)((0,c.zM)()),show_icon:(0,c.lq)((0,c.zM)()),show_entity_picture:(0,c.lq)((0,c.zM)()),tap_action:(0,c.lq)(u.kn),hold_action:(0,c.lq)(u.kn),double_tap_action:(0,c.lq)(u.kn),image:(0,c.lq)((0,c.Yj)())}));class j extends s.WF{setConfig(e){(0,c.vA)(e,k),this._config=Object.assign(Object.assign({},_.PV),(0,_.P8)(e))}render(){if(!this.hass||!this._config)return s.s6;const e=this._schema(this.hass.localize),t=Object.assign(Object.assign({},this._config),{},{displayed_elements:this._displayedElements(this._config)});return(0,s.qy)(b||(b=v` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}"></ha-form> `),this.hass,t,e,this._computeLabelCallback,this._computeHelperCallback,this._valueChanged)}_valueChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=Object.assign({},e.detail.value);t.state_content||delete t.state_content,t.displayed_elements&&(t.show_name=t.displayed_elements.includes("name"),t.show_state=t.displayed_elements.includes("state"),t.show_icon=t.displayed_elements.includes("icon"),delete t.displayed_elements),(0,r.r)(this,"config-changed",{config:t})}static get styles(){return[y.U,(0,s.AH)(q||(q=v`.container{display:flex;flex-direction:column}ha-form{display:block;margin-bottom:24px}`))]}constructor(...e){super(...e),this._schema=(0,l.A)(e=>[{name:"entity",selector:{entity:{}}},{name:"content",type:"expandable",flatten:!0,iconPath:w,schema:[{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"",type:"grid",schema:[{name:"color",selector:{ui_color:{default_color:"state",include_state:!0}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"show_entity_picture",selector:{boolean:{}}}]},{name:"displayed_elements",selector:{select:{mode:"list",multiple:!0,options:[{value:"name",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.name")},{value:"state",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.state")},{value:"icon",label:e("ui.panel.lovelace.editor.badge.entity.displayed_elements_options.icon")}]}}},{name:"state_content",selector:{ui_state_content:{allow_name:!0}},context:{filter_entity:"entity"}}]},{name:"interactions",type:"expandable",flatten:!0,iconPath:C,schema:[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}},context:h.Tq},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map(e=>({name:e,selector:{ui_action:{default_action:"none"}},context:h.Tq}))}]}]),this._displayedElements=(0,l.A)(e=>{const t=[];return e.show_name&&t.push("name"),e.show_state&&t.push("state"),e.show_icon&&t.push("icon"),t}),this._computeLabelCallback=e=>{switch(e.name){case"color":case"state_content":case"show_entity_picture":case"displayed_elements":return this.hass.localize(`ui.panel.lovelace.editor.badge.entity.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}},this._computeHelperCallback=e=>{if("color"===e.name)return this.hass.localize(`ui.panel.lovelace.editor.badge.entity.${e.name}_helper`)}}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],j.prototype,"hass",void 0),(0,i.Cg)([(0,o.wk)()],j.prototype,"_config",void 0),j=(0,i.Cg)([(0,o.EM)("hui-entity-badge-editor")],j),a()}catch(b){a(b)}})},76163:function(e,t,n){n.a(e,async function(e,a){try{n.r(t),n.d(t,{HuiStateLabelBadgeEditor:function(){return h}});var i=n(40445),s=n(67576),o=n(63533),l=n(91408),c=n(45031),r=n(93048),d=e([r]);r=(d.then?(await d)():d)[0];const _=(0,o.kp)(c.y,(0,o.Ik)({entity:(0,o.lq)((0,o.Yj)()),name:(0,o.lq)((0,o.Yj)()),icon:(0,o.lq)((0,o.Yj)()),show_entity_picture:(0,o.lq)((0,o.zM)()),tap_action:(0,o.lq)(l.kn),show_name:(0,o.lq)((0,o.zM)()),image:(0,o.lq)((0,o.Yj)())}));class h extends r.HuiEntityBadgeEditor{setConfig(e){var t;(0,o.vA)(e,_);const n={type:"entity",entity:e.entity,show_name:null===(t=e.show_name)||void 0===t||t};super.setConfig(n)}}h=(0,i.Cg)([(0,s.EM)("hui-state-label-badge-editor")],h),a()}catch(_){a(_)}})},45031:function(e,t,n){n.d(t,{y:function(){return i}});var a=n(63533);const i=(0,a.Ik)({type:(0,a.Yj)(),visibility:(0,a.bz)(),disabled:(0,a.lq)((0,a.zM)())})}}]);