iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
14 lines • 10.3 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["82794"],{50875:function(e,t,a){a.d(t,{Eu:()=>r,hZ:()=>d,o9:()=>l});var i=a(27486),n=a(11259);const s=["#4269d0","#f4bd4a","#ff725c","#6cc5b0","#a463f2","#ff8ab7","#9c6b4e","#97bbf5","#01ab63","#9498a0","#094bad","#c99000","#d84f3e","#49a28f","#048732","#d96895","#8043ce","#7599d1","#7a4c31","#74787f","#6989f4","#ffd444","#ff957c","#8fe9d3","#62cc71","#ffadda","#c884ff","#badeff","#bf8b6d","#b6bac2","#927acc","#97ee3f","#bf3947","#9f5b00","#f48758","#8caed6","#f2b94f","#eff26e","#e43872","#d9b100","#9d7a00","#698cff","#d9d9d9","#00d27e","#d06800","#009f82","#c49200","#cbe8ff","#fecddf","#c27eb6","#8cd2ce","#c4b8d9","#f883b0","#a49100","#f48800","#27d0df","#a04a9b"];function r(e){return s[e%s.length]}function d(e,t){const a=t.getPropertyValue(`--graph-color-${e+1}`)||r(e);return(0,n.Rq)(a)}const l=(0,i.Z)((e=>s.map(((t,a)=>d(a,e)))),((e,t)=>e[0].getPropertyValue("--graph-color-1")===t[0].getPropertyValue("--graph-color-1")))},48103:function(e,t,a){var i=a(61701),n=a(72621),s=(a(71695),a(40251),a(47021),a(57243)),r=a(93958),d=a(97536),l=a(46289),h=a(50778),o=a(36522);let c,u=e=>e;(0,i.Z)([(0,h.Mo)("ha-check-list-item")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"method",key:"onChange",value:async function(e){(0,n.Z)(a,"onChange",this,3)([e]),(0,o.B)(this,e.type)}},{kind:"field",static:!0,key:"styles",value(){return[l.W,d.W,(0,s.iv)(c||(c=u`:host{--mdc-theme-secondary:var(--primary-color)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,16px);margin-inline-start:0px;direction:var(--direction)}.mdc-deprecated-list-item__meta{flex-shrink:0;direction:var(--direction);margin-inline-start:auto;margin-inline-end:0}.mdc-deprecated-list-item__graphic{margin-top:var(--check-list-item-graphic-margin-top)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{margin-inline-start:0;margin-inline-end:var(--mdc-list-item-graphic-margin,32px)}`))]}}]}}),r.F)},59822:function(e,t,a){a.a(e,(async function(e,i){try{a.r(t);var n=a(61701),s=a(72621),r=(a(19083),a(71695),a(9359),a(56475),a(1331),a(70104),a(40251),a(19134),a(61006),a(97003),a(47021),a(18672)),d=(a(2060),a(57243)),l=a(50778),h=a(69634),o=a(68958),c=a(47194),u=(a(59826),a(34273),a(54977),a(48103),a(23334),a(43344),a(51223)),m=(a(37583),a(47593),a(91106)),f=a(57816),p=a(38572),v=a(28008),_=a(22289),g=e([u,_,r]);[u,_,r]=g.then?(await g)():g;let y,k,b,w,$,C,x,V=e=>e;const S="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",H="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",L="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";(0,n.Z)([(0,l.Mo)("ha-panel-calendar")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,reflect:!0})],key:"narrow",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,reflect:!0})],key:"mobile",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_calendars",value(){return[]}},{kind:"field",decorators:[(0,l.SB)()],key:"_events",value(){return[]}},{kind:"field",decorators:[(0,l.SB)()],key:"_error",value(){}},{kind:"field",decorators:[(0,o.t)({key:"deSelectedCalendars",state:!0})],key:"_deSelectedCalendars",value(){return[]}},{kind:"field",key:"_start",value:void 0},{kind:"field",key:"_end",value:void 0},{kind:"field",key:"_showPaneController",value(){return new r.Z(this,{callback:e=>{var t;return(null===(t=e[0])||void 0===t?void 0:t.contentRect.width)>750}})}},{kind:"field",key:"_mql",value:void 0},{kind:"field",key:"_headerHeight",value(){return 56}},{kind:"method",key:"connectedCallback",value:function(){(0,s.Z)(a,"connectedCallback",this,3)([]),this._mql=window.matchMedia("(max-width: 450px), all and (max-height: 500px)"),this._mql.addListener(this._setIsMobile),this.mobile=this._mql.matches;const e=getComputedStyle(this);this._headerHeight=Number(e.getPropertyValue("--header-height").replace("px",""))}},{kind:"method",key:"disconnectedCallback",value:function(){var e;(0,s.Z)(a,"disconnectedCallback",this,3)([]),null===(e=this._mql)||void 0===e||e.removeListener(this._setIsMobile),this._mql=void 0}},{kind:"field",key:"_setIsMobile",value(){return e=>{this.mobile=e.matches}}},{kind:"method",key:"willUpdate",value:function(e){(0,s.Z)(a,"willUpdate",this,3)([e]),this.hasUpdated||(this._calendars=(0,m.tT)(this.hass))}},{kind:"method",key:"render",value:function(){var e,t,a;const i=this._calendars.map((e=>(0,d.dy)(y||(y=V` <ha-check-list-item -selected="${0}" graphic="icon" style="${0}" .value="${0}" .selected="${0}"> <ha-state-icon slot="graphic" .hass="${0}" .stateObj="${0}"></ha-state-icon> ${0} </ha-check-list-item> `),this._requestSelected,(0,h.V)({"--mdc-theme-secondary":e.backgroundColor}),e.entity_id,!this._deSelectedCalendars.includes(e.entity_id),this.hass,e,e.name))),n=null!==(e=this._showPaneController.value)&&void 0!==e?e:!this.narrow;return(0,d.dy)(k||(k=V` <ha-two-pane-top-app-bar-fixed .pane="${0}" footer> <ha-menu-button slot="navigationIcon" .hass="${0}" .narrow="${0}"></ha-menu-button> ${0} <ha-icon-button slot="actionItems" .path="${0}" .label="${0}" ="${0}"></ha-icon-button> ${0} <ha-full-calendar .events="${0}" .calendars="${0}" .narrow="${0}" .initialView="${0}" .hass="${0}" .error="${0}" -changed="${0}"></ha-full-calendar> </ha-two-pane-top-app-bar-fixed> `),n,this.hass,this.narrow,n?(0,d.dy)($||($=V`<div slot="title"> ${0} </div>`),this.hass.localize("ui.components.calendar.my_calendars")):(0,d.dy)(b||(b=V`<ha-button-menu slot="title" class="lists" multi fixed .noAnchor="${0}" .y="${0}" .x="${0}"> <ha-button slot="trigger"> ${0} <ha-svg-icon slot="trailingIcon" .path="${0}"></ha-svg-icon> </ha-button> ${0} ${0} </ha-button-menu>`),this.mobile,this.mobile?this._headerHeight/2:this._headerHeight/4,this.mobile?0:void 0,this.hass.localize("ui.components.calendar.my_calendars"),S,i,null!==(t=this.hass.user)&&void 0!==t&&t.is_admin?(0,d.dy)(w||(w=V` <li divider role="separator"></li> <ha-list-item graphic="icon" ="${0}"> <ha-svg-icon .path="${0}" slot="graphic"></ha-svg-icon> ${0} </ha-list-item>`),this._addCalendar,H,this.hass.localize("ui.components.calendar.create_calendar")):d.Ld),L,this.hass.localize("ui.common.refresh"),this._handleRefresh,n&&null!==(a=this.hass.user)&&void 0!==a&&a.is_admin?(0,d.dy)(C||(C=V`<mwc-list slot="pane" multi}>${0}</mwc-list> <ha-list-item graphic="icon" slot="pane-footer" ="${0}"> <ha-svg-icon .path="${0}" slot="graphic"></ha-svg-icon> ${0} </ha-list-item>`),i,this._addCalendar,H,this.hass.localize("ui.components.calendar.create_calendar")):d.Ld,this._events,this._calendars,this.narrow,this.narrow?"listWeek":"dayGridMonth",this.hass,this._error,this._handleViewChanged)}},{kind:"get",key:"_selectedCalendars",value:function(){return this._calendars.filter((e=>!this._deSelectedCalendars.includes(e.entity_id))).map((e=>e))}},{kind:"method",key:"_fetchEvents",value:async function(e,t,a){return a.length&&e&&t?(0,m.GL)(this.hass,e,t,a):{events:[],errors:[]}}},{kind:"method",key:"_requestSelected",value:async function(e){e.stopPropagation();const t=e.target.value;if(e.detail.selected){if(this._deSelectedCalendars=this._deSelectedCalendars.filter((e=>e!==t)),"interaction"===e.detail.source)return;const a=this._calendars.find((e=>e.entity_id===t));if(!a)return;const i=await this._fetchEvents(this._start,this._end,[a]);this._events=[...this._events,...i.events],this._handleErrors(i.errors)}else this._deSelectedCalendars=[...this._deSelectedCalendars,t],this._events=this._events.filter((e=>e.calendar!==t))}},{kind:"method",key:"_addCalendar",value:async function(){var e;(0,p.t)(this,{startFlowHandler:"local_calendar",showAdvanced:null===(e=this.hass.userData)||void 0===e?void 0:e.showAdvanced,manifest:await(0,f.t4)(this.hass,"local_calendar"),dialogClosedCallback:({flowFinished:e})=>{e&&(this._calendars=(0,m.tT)(this.hass))}})}},{kind:"method",key:"_handleViewChanged",value:async function(e){this._start=e.detail.start,this._end=e.detail.end;const t=await this._fetchEvents(this._start,this._end,this._selectedCalendars);this._events=t.events,this._handleErrors(t.errors)}},{kind:"method",key:"_handleRefresh",value:async function(){const e=await this._fetchEvents(this._start,this._end,this._selectedCalendars);this._events=e.events,this._handleErrors(e.errors)}},{kind:"method",key:"_handleErrors",value:function(e){if(this._error=void 0,e.length>0){const t=e.map((e=>this.hass.states[e]?(0,c.C)(this.hass.states[e]):e)).join(", ");this._error=`${this.hass.localize("ui.components.calendar.event_retrieval_error")} ${t}`}}},{kind:"get",static:!0,key:"styles",value:function(){return[v.Qx,(0,d.iv)(x||(x=V`:host{display:block}ha-full-calendar{height:calc(100vh - var(--header-height));--calendar-header-padding:12px;--calendar-border-radius:0;--calendar-border-width:1px 0}ha-button-menu ha-button{--mdc-theme-primary:currentColor;--mdc-typography-button-text-transform:none;--mdc-typography-button-font-size:var(
--mdc-typography-headline6-font-size,
1.25rem
);--mdc-typography-button-font-weight:var(
--mdc-typography-headline6-font-weight,
500
);--mdc-typography-button-letter-spacing:var(
--mdc-typography-headline6-letter-spacing,
0.0125em
);--mdc-typography-button-line-height:var(
--mdc-typography-headline6-line-height,
2rem
);--button-height:40px}:host([mobile]) .lists{--mdc-menu-min-width:100vw}:host([mobile]) ha-button-menu{--mdc-shape-medium:0 0 var(--mdc-shape-medium) var(--mdc-shape-medium)}`))]}}]}}),d.oi);i()}catch(y){i(y)}}))}}]);
//# sourceMappingURL=82794.61710cd10c1ae596.js.map