iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 4.38 kB
JavaScript
export const __rspack_esm_id=16700;export const __rspack_esm_ids=[16700];export const __webpack_modules__={27722(e,t,a){a.d(t,{d:()=>n});var i=a(28978);function o(e,t,a,i){if(!a||!a.action||"none"===a.action)return"";let o=i?e.localize("ui.panel.lovelace.cards.picture-elements.hold"):e.localize("ui.panel.lovelace.cards.picture-elements.tap");switch(a.action){case"navigate":o+=` ${e.localize("ui.panel.lovelace.cards.picture-elements.navigate_to",{location:a.navigation_path})}`;break;case"url":o+=` ${e.localize("ui.panel.lovelace.cards.picture-elements.url",{url_path:a.url_path})}`;break;case"toggle":o+=` ${e.localize("ui.panel.lovelace.cards.picture-elements.toggle",{name:t})}`;break;case"call-service":o+=`${e.localize("ui.panel.lovelace.cards.picture-elements.perform_action",{name:a.service})}`;break;case"more-info":o+=`${e.localize("ui.panel.lovelace.cards.picture-elements.more_info",{name:t})}`}return o}const n=(e,t)=>{if(null===t.title)return"";if(t.title)return t.title;let a="";if(t.entity&&(a=t.entity in e.states?(0,i.u)(e.states[t.entity]):t.entity),!t.tap_action&&!t.hold_action)return a;const n=t.tap_action?o(e,a,t.tap_action,!1):"",s=t.hold_action?o(e,a,t.hold_action,!0):"";return n+(n&&s?"\n":"")+s}},96314(e,t,a){a.a(e,async function(e,t){try{a(18111),a(61701);var i=a(62826),o=a(5124),n=a(22441),s=a(28978),r=a(74281),l=a(27722),c=a(19037),d=a(22064),p=a(97176),h=(a(34296),a(5745),a(14503)),u=e([r]);r=(u.then?(await u)():u)[0];class g extends o.WF{render(){return o.qy` <ha-chip-set class="ha-scrollbar"> ${(this.configEntities||[]).map(e=>{const t=this.hass.states[e.entity],a=e.show_name&&t||e.name&&!1!==e.show_name?e.name||(0,s.u)(t):"";return o.qy` <ha-assist-chip filled @action="${this._handleAction}" .actionHandler="${(0,c.T)({hasHold:(0,p.h)(e.hold_action),hasDoubleClick:(0,p.h)(e.double_tap_action)})}" .config="${e}" tabindex="0" .label="${a}"> ${!1!==e.show_icon?o.qy` <state-badge title="${(0,l.d)(this.hass,e)}" .hass="${this.hass}" .stateObj="${t}" .overrideIcon="${e.icon}" .overrideImage="${e.image}" .stateColor="${!0}" slot="icon"></state-badge> `:""} </ha-assist-chip> `})} </ha-chip-set> `}_handleAction(e){(0,d.$)(this,this.hass,e.currentTarget.config,e.detail.action)}static get styles(){return[h.dp,o.AH`.ha-scrollbar{padding:12px;padding-top:var(--padding-top,8px);padding-bottom:var(--padding-bottom,8px);width:100%;overflow-x:auto;overflow-y:hidden;white-space:nowrap;box-sizing:border-box;display:flex;flex-wrap:wrap}state-badge{display:inline-flex;line-height:inherit;color:var(--secondary-text-color);align-items:center;justify-content:center}@media all and (max-width:450px),all and (max-height:500px){.ha-scrollbar{flex-wrap:nowrap}}`]}}(0,i.Cg)([(0,n.wk)()],g.prototype,"hass",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"configEntities",void 0),g=(0,i.Cg)([(0,n.EM)("hui-buttons-base")],g),t()}catch(e){t(e)}})},72791(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{HuiButtonsHeaderFooter:()=>h});a(18111),a(61701);var o=a(62826),n=a(5124),s=a(6412),r=a(22441),l=a(71727),c=a(20939),d=a(96314),p=e([d]);d=(p.then?(await p)():p)[0];class h extends n.WF{static getStubConfig(){return{entities:[]}}getCardSize(){return 3}setConfig(e){this._configEntities=(0,c.L)(e.entities).map(e=>{const t={tap_action:{action:"toggle"},hold_action:{action:"more-info"},...e};return"scene"===(0,l.m)(e.entity)&&(t.tap_action={action:"call-service",service:"scene.turn_on",target:{entity_id:t.entity}}),t})}render(){return n.qy` ${"footer"===this.type?n.qy`<li class="divider footer" role="separator"></li>`:""} <hui-buttons-base .hass="${this.hass}" .configEntities="${this._configEntities}" class="${(0,s.H)({footer:"footer"===this.type,header:"header"===this.type})}"></hui-buttons-base> ${"header"===this.type?n.qy`<li class="divider header" role="separator"></li>`:""} `}}h.styles=n.AH`.divider{height:0;margin:16px 0;list-style-type:none;border:none;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--divider-color)}.divider.header{margin-top:0}hui-buttons-base.footer{--padding-bottom:16px}hui-buttons-base.header{--padding-top:16px}`,(0,o.Cg)([(0,r.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)()],h.prototype,"type",void 0),(0,o.Cg)([(0,r.wk)()],h.prototype,"_configEntities",void 0),h=(0,o.Cg)([(0,r.EM)("hui-buttons-header-footer")],h),i()}catch(e){i(e)}})}};