iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 6.66 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[73044],{21220:function(i,t,s){s.a(i,async function(i,n){try{s.d(t,{t:function(){return r},v:function(){return h}});var o=s(71727),e=s(68246),c=s(85694),a=i([c]);const h={label:"",iconPath:(c=(a.then?(await a)():a)[0]).Gn},r=(i,t,s)=>{var n;const c=(0,o.m)(s),a=(0,e.Y)(s),h=null===(n=t[c])||void 0===n?void 0:n[a];return i(`component.${c}.services.${a}.name`,null==h?void 0:h.description_placeholders)||(null==h?void 0:h.name)||s};n()}catch(h){n(h)}})},96779:function(i,t,s){s.d(t,{q:function(){return o}});var n=s(45435);class o{get info(){return this._info}update(i,t){var s;this._hass=i,t!==this._subscribedPath&&(null===(s=this._unsub)||void 0===s||s.call(this),this._unsub=void 0,this._subscribedPath=t,t?this._unsub=(0,n.sy)(i,t,i=>{this._info=i,this._host.requestUpdate()}):this._info=n.Mw)}hostConnected(){if(this._hass&&this._subscribedPath&&!this._unsub){const i=this._subscribedPath;this._subscribedPath=void 0,this.update(this._hass,i)}}hostDisconnected(){var i;null===(i=this._unsub)||void 0===i||i.call(this),this._unsub=void 0}constructor(i){this._info=n.Mw,this._host=i,i.addController(this)}}},56505:function(i,t,s){s.a(i,async function(i,n){try{s.d(t,{G:function(){return l}});var o=s(35211),e=s(71727),c=s(21220),a=s(22792),h=s(85694),r=i([h,c]);[h,c]=r.then?(await r)():r;class l{_consume(i,t){new o.G(this._host,{context:i,subscribe:!0,callback:i=>{t(i),this._resolve()}})}get info(){return this._info}hostConnected(){this._resolve()}updateService(i){i!==this._service&&(this._service=i,this._resolve())}_resolve(){if(!(this._connection&&this._config&&this._services&&this._i18n))return;const i=this._service,t=this._i18n.language,s=i!==this._resolvedService,n=t!==this._resolvedLanguage;if(!s&&!n)return;if(this._resolvedService=i,this._resolvedLanguage=t,!i)return this._info=c.v,void this._host.requestUpdate();const o=(0,e.m)(i);this._info={label:(0,c.t)(this._i18n.localize,this._services,i),iconPath:s?h.l[o]||h.Gn:this._info.iconPath,icon:s?void 0:this._info.icon},this._host.requestUpdate(),this._i18n.loadBackendTranslation("services",o).then(s=>{this._resolvedService===i&&this._resolvedLanguage===t&&this._services&&(this._info=Object.assign(Object.assign({},this._info),{},{label:(0,c.t)(s,this._services,i)}),this._host.requestUpdate())}),s&&(0,h.f$)(this._connection,this._config,i).then(t=>{this._resolvedService===i&&(this._info=Object.assign(Object.assign({},this._info),{},{icon:t}),this._host.requestUpdate())})}constructor(i){this._info=c.v,this._host=i,i.addController(this),this._consume(a.Wq,i=>{this._connection=i.connection}),this._consume(a.WF,i=>{this._config=i.config}),this._consume(a.yk,i=>{this._services=i}),this._consume(a.D5,i=>{this._i18n=i})}}n()}catch(l){n(l)}})},53034:function(i,t,s){s.d(t,{J:function(){return o}});const n={label:"",iconPath:"M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z"},o=(i,t,s,o)=>{switch(null==t?void 0:t.action){case"navigate":return s;case"assist":return{label:i.localize("ui.panel.lovelace.editor.action-editor.actions.assist"),iconPath:"M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z"};case"call-service":case"perform-action":return o;case"url":return{label:t.url_path||"",iconPath:"M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z"};default:return n}}},30175:function(i,t,s){s.a(i,async function(i,n){try{s.r(t),s.d(t,{HuiShortcutCard:function(){return C}});s(89463),s(3362),s(62953);var o=s(40445),e=s(5124),c=s(67576),a=s(89784),h=s(78870),r=(s(76776),s(22573),s(80933),s(32248),s(96779)),l=s(56505),_=s(22064),u=s(97176),d=s(53034),v=s(51989),f=i([l]);l=(f.then?(await f)():f)[0];let g,p,b,m=i=>i;class C extends e.WF{static async getConfigElement(){return await s.e(85911).then(s.bind(s,48458)),document.createElement("hui-shortcut-card-editor")}static getStubConfig(){return{type:"shortcut",tap_action:{action:"navigate",navigation_path:"/home"}}}setConfig(i){this._config=Object.assign({tap_action:{action:"none"}},i)}getCardSize(){var i;return null!==(i=this._config)&&void 0!==i&&i.vertical?2:1}getGridOptions(){var i;return null!==(i=this._config)&&void 0!==i&&i.vertical?{columns:6,rows:2,min_columns:3,min_rows:2}:{columns:6,rows:1,min_columns:6,min_rows:1}}willUpdate(i){if((i.has("hass")||i.has("_config"))&&this.hass){var t;const i=null===(t=this._config)||void 0===t?void 0:t.tap_action;this._navInfo.update(this.hass,"navigate"===(null==i?void 0:i.action)?i.navigation_path:void 0),this._serviceInfo.updateService("perform-action"===(null==i?void 0:i.action)||"call-service"===(null==i?void 0:i.action)?i.perform_action||i.service:void 0)}}_handleAction(i){(0,_.$)(this,this.hass,this._config,i.detail.action)}get _hasCardAction(){var i,t,s;return(0,u.h)(null===(i=this._config)||void 0===i?void 0:i.tap_action)||(0,u.h)(null===(t=this._config)||void 0===t?void 0:t.hold_action)||(0,u.h)(null===(s=this._config)||void 0===s?void 0:s.double_tap_action)}render(){if(!this._config||!this.hass)return e.s6;const i=(0,d.J)(this.hass,this._config.tap_action,this._navInfo.info,this._serviceInfo.info),t=this._config.label||i.label,s=this._config.description,n=this._config.icon||i.icon,o=n?void 0:i.iconPath,c=this._config.color?(0,h.MP)(this._config.color):void 0,r=c?{"--tile-color":c}:{};return(0,e.qy)(g||(g=m` <ha-card style="${0}"> <ha-tile-container .vertical="${0}" .interactive="${0}" .actionHandlerOptions="${0}" ="${0}"> <ha-tile-icon slot="icon" .icon="${0}" .iconPath="${0}"></ha-tile-icon> <ha-tile-info slot="info"> <span slot="primary">${0}</span> ${0} </ha-tile-info> </ha-tile-container> </ha-card> `),(0,a.W)(r),Boolean(this._config.vertical),this._hasCardAction,{hasHold:(0,u.h)(this._config.hold_action),hasDoubleClick:(0,u.h)(this._config.double_tap_action)},this._handleAction,n||void 0,o,t,s?(0,e.qy)(p||(p=m`<span slot="secondary">${0}</span>`),s):e.s6)}constructor(...i){super(...i),this._navInfo=new r.q(this),this._serviceInfo=new l.G(this)}}C.styles=[v.c,(0,e.AH)(b||(b=m`:host{--tile-color:var(--primary-color)}`))],(0,o.Cg)([(0,c.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,o.Cg)([(0,c.wk)()],C.prototype,"_config",void 0),C=(0,o.Cg)([(0,c.EM)("hui-shortcut-card")],C),n()}catch(g){n(g)}})}}]);