iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 19 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["86431"],{22071:function(e,t,i){i.d(t,{C:()=>a});const a=(e,t)=>{const i=t.areas[e]||null;if(!i)return{area:null,floor:null};const a=null==i?void 0:i.floor_id;return{area:i,floor:a?t.floors[a]:null}}},40487:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),o=(i(71695),i(61893),i(9359),i(70104),i(19423),i(40251),i(47021),i(57243)),n=i(50778),d=i(36522),r=i(22071),s=i(82100),l=(i(41307),i(84346)),h=(i(37583),i(83166),e([l]));l=(h.then?(await h)():h)[0];let c,u=e=>e;const v="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z";(0,a.Z)([(0,n.Mo)("ha-areas-display-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"expanded",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"show-navigation-button"})],key:"showNavigationButton",value(){return!1}},{kind:"method",key:"render",value:function(){var e,t,i,a;const n=(0,s.a)(this.hass.areas),d=Object.values(this.hass.areas).sort(((e,t)=>n(e.area_id,t.area_id))).map((e=>{var t;const{floor:i}=(0,r.C)(e.area_id,this.hass);return{value:e.area_id,label:e.name,icon:null!==(t=e.icon)&&void 0!==t?t:void 0,iconPath:v,description:null==i?void 0:i.name}})),l={order:null!==(e=null===(t=this.value)||void 0===t?void 0:t.order)&&void 0!==e?e:[],hidden:null!==(i=null===(a=this.value)||void 0===a?void 0:a.hidden)&&void 0!==i?i:[]};return(0,o.dy)(c||(c=u` <ha-expansion-panel outlined .header="${0}" .expanded="${0}"> <ha-svg-icon slot="leading-icon" .path="${0}"></ha-svg-icon> <ha-items-display-editor .hass="${0}" .items="${0}" .value="${0}" -changed="${0}" .showNavigationButton="${0}"></ha-items-display-editor> </ha-expansion-panel> `),this.label,this.expanded,v,this.hass,d,l,this._areaDisplayChanged,this.showNavigationButton)}},{kind:"method",key:"_areaDisplayChanged",value:async function(e){var t,i;e.stopPropagation();const a=e.detail.value,o=Object.assign(Object.assign({},this.value),a);0===(null===(t=o.hidden)||void 0===t?void 0:t.length)&&delete o.hidden,0===(null===(i=o.order)||void 0===i?void 0:i.length)&&delete o.order,(0,d.B)(this,"value-changed",{value:o})}}]}}),o.oi);t()}catch(c){t(c)}}))},41307:function(e,t,i){var a=i(61701),o=i(72621),n=(i(71695),i(40251),i(47021),i(57243)),d=i(50778),r=i(35359),s=i(36522),l=i(76320);i(37583);let h,c,u,v,p=e=>e;(0,a.Z)([(0,d.Mo)("ha-expansion-panel")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"expanded",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"outlined",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({attribute:"left-chevron",type:Boolean,reflect:!0})],key:"leftChevron",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({attribute:"no-collapse",type:Boolean,reflect:!0})],key:"noCollapse",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)()],key:"header",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"secondary",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_showContent",value(){return this.expanded}},{kind:"field",decorators:[(0,d.IO)(".container")],key:"_container",value:void 0},{kind:"method",key:"render",value:function(){const e=this.noCollapse?n.Ld:(0,n.dy)(h||(h=p` <ha-svg-icon .path="${0}" class="summary-icon ${0}"></ha-svg-icon> `),"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",(0,r.$)({expanded:this.expanded}));return(0,n.dy)(c||(c=p` <div class="top ${0}"> <div id="summary" class="${0}" ="${0}" ="${0}" ="${0}" ="${0}" role="button" tabindex="${0}" aria-expanded="${0}" aria-controls="sect1"> ${0} <slot name="leading-icon"></slot> <slot name="header"> <div class="header"> ${0} <slot class="secondary" name="secondary">${0}</slot> </div> </slot> ${0} <slot name="icons"></slot> </div> </div> <div class="container ${0}" ="${0}" role="region" aria-labelledby="summary" aria-hidden="${0}" tabindex="-1"> ${0} </div> `),(0,r.$)({expanded:this.expanded}),(0,r.$)({noCollapse:this.noCollapse}),this._toggleContainer,this._toggleContainer,this._focusChanged,this._focusChanged,this.noCollapse?-1:0,this.expanded,this.leftChevron?e:n.Ld,this.header,this.secondary,this.leftChevron?n.Ld:e,(0,r.$)({expanded:this.expanded}),this._handleTransitionEnd,!this.expanded,this._showContent?(0,n.dy)(u||(u=p`<slot></slot>`)):"")}},{kind:"method",key:"willUpdate",value:function(e){(0,o.Z)(i,"willUpdate",this,3)([e]),e.has("expanded")&&(this._showContent=this.expanded,setTimeout((()=>{this._container.style.overflow=this.expanded?"initial":"hidden"}),300))}},{kind:"method",key:"_handleTransitionEnd",value:function(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}},{kind:"method",key:"_toggleContainer",value:async function(e){if(e.defaultPrevented)return;if("keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)return;if(e.preventDefault(),this.noCollapse)return;const t=!this.expanded;(0,s.B)(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await(0,l.y)());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,t||setTimeout((()=>{this._container.style.height="0px"}),0),this.expanded=t,(0,s.B)(this,"expanded-changed",{expanded:this.expanded})}},{kind:"method",key:"_focusChanged",value:function(e){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(v||(v=p`:host{display:block}.top{display:flex;align-items:center;border-radius:var(--ha-card-border-radius,12px)}.top.expanded{border-bottom-left-radius:0px;border-bottom-right-radius:0px}.top.focused{background:var(--input-fill-color)}:host([outlined]){box-shadow:none;border-width:1px;border-style:solid;border-color:var(--outline-color);border-radius:var(--ha-card-border-radius,12px)}.summary-icon{transition:transform 150ms cubic-bezier(.4, 0, .2, 1);direction:var(--direction);margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}::slotted([slot=leading-icon]),:host([left-chevron]) .summary-icon{margin-left:0;margin-right:8px;margin-inline-start:0;margin-inline-end:8px}#summary{flex:1;display:flex;padding:var(--expansion-panel-summary-padding,0 8px);min-height:48px;align-items:center;cursor:pointer;overflow:hidden;font-weight:500;outline:0}#summary.noCollapse{cursor:default}.summary-icon.expanded{transform:rotate(180deg)}.header,::slotted([slot=header]){flex:1}.container{padding:var(--expansion-panel-content-padding,0 8px);overflow:hidden;transition:height .3s cubic-bezier(.4, 0, .2, 1);height:0px}.container.expanded{height:auto}.secondary{display:block;color:var(--secondary-text-color);font-size:12px}`))}}]}}),n.oi)},13928:function(e,t,i){i.r(t),i.d(t,{HaIconNext:()=>r});var a=i(61701),o=(i(71695),i(47021),i(50778)),n=i(5111),d=i(37583);let r=(0,a.Z)([(0,o.Mo)("ha-icon-next")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)()],key:"path",value(){return"rtl"===n.E.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}]}}),d.HaSvgIcon)},84346:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),o=(i(63721),i(19083),i(71695),i(92745),i(61893),i(9359),i(56475),i(70104),i(19423),i(61006),i(47021),i(18672)),n=i(57243),d=i(50778),r=i(35359),s=i(20552),l=i(91583),h=i(94571),c=i(27486),u=i(36522),v=i(1416),p=(i(65981),i(23334),i(13928),i(19993),i(74633),i(62801),i(37583),e([o]));o=(p.then?(await p)():p)[0];let y,m,k,b,f,g,x,C,_,w,$=e=>e;const L="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",B="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",M="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z";(0,a.Z)([(0,d.Mo)("ha-items-display-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"items",value(){return[]}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:"show-navigation-button"})],key:"showNavigationButton",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"value",value(){return{order:[],hidden:[]}}},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"actionsRenderer",value:void 0},{kind:"field",key:"_showIcon",value(){return new o.Z(this,{callback:e=>{var t;return(null===(t=e[0])||void 0===t?void 0:t.contentRect.width)>450}})}},{kind:"method",key:"_toggle",value:function(e){e.stopPropagation();const t=e.currentTarget.value,i=this._hiddenItems(this.items,this.value.hidden).map((e=>e.value));i.includes(t)?i.splice(i.indexOf(t),1):i.push(t);const a=this._visibleItems(this.items,i,this.value.order).map((e=>e.value));this.value={hidden:i,order:a},(0,u.B)(this,"value-changed",{value:this.value})}},{kind:"method",key:"_itemMoved",value:function(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail,a=this._visibleItems(this.items,this.value.hidden,this.value.order).map((e=>e.value)),o=a.splice(t,1)[0];a.splice(i,0,o),this.value=Object.assign(Object.assign({},this.value),{},{order:a}),(0,u.B)(this,"value-changed",{value:this.value})}},{kind:"method",key:"_navigate",value:function(e){const t=e.currentTarget.value;(0,u.B)(this,"item-display-navigate-clicked",{value:t}),e.stopPropagation()}},{kind:"field",key:"_visibleItems",value(){return(0,c.Z)(((e,t,i)=>{const a=(0,v.UB)(i);return e.filter((e=>!t.includes(e.value))).sort(((e,t)=>a(e.value,t.value)))}))}},{kind:"field",key:"_allItems",value(){return(0,c.Z)(((e,t,i)=>[...this._visibleItems(e,t,i),...this._hiddenItems(e,t)]))}},{kind:"field",key:"_hiddenItems",value(){return(0,c.Z)(((e,t)=>e.filter((e=>t.includes(e.value)))))}},{kind:"method",key:"render",value:function(){const e=this._allItems(this.items,this.value.hidden,this.value.order),t=this._showIcon.value;return(0,n.dy)(y||(y=$` <ha-sortable draggable-selector=".draggable" handle-selector=".handle" -moved="${0}"> <ha-md-list> ${0} </ha-md-list> </ha-sortable> `),this._itemMoved,(0,l.r)(e,(e=>e.value),((e,i)=>{const a=!this.value.hidden.includes(e.value),{label:o,value:d,description:l,icon:c,iconPath:u}=e;return(0,n.dy)(m||(m=$` <ha-md-list-item type="${0}" ="${0}" .value="${0}" class="${0}"> <span slot="headline">${0}</span> ${0} ${0} ${0} ${0} <ha-icon-button .path="${0}" slot="end" .label="${0}" .value="${0}" ="${0}"></ha-icon-button> ${0} </ha-md-list-item> `),(0,s.o)(this.showNavigationButton?"button":void 0),this.showNavigationButton?this._navigate:void 0,d,(0,r.$)({hidden:!a,draggable:a}),o,l?(0,n.dy)(k||(k=$`<span slot="supporting-text">${0}</span>`),l):n.Ld,a?(0,n.dy)(b||(b=$` <ha-svg-icon class="handle" .path="${0}" slot="start"></ha-svg-icon> `),L):(0,n.dy)(f||(f=$`<ha-svg-icon slot="start"></ha-svg-icon>`)),t?c?(0,n.dy)(g||(g=$` <ha-icon class="icon" .icon="${0}" slot="start"></ha-icon> `),(0,h.C)(c,"")):u?(0,n.dy)(x||(x=$` <ha-svg-icon class="icon" .path="${0}" slot="start"></ha-svg-icon> `),u):n.Ld:n.Ld,this.actionsRenderer?(0,n.dy)(C||(C=$` <span slot="end"> ${0} </span> `),this.actionsRenderer(e)):n.Ld,a?B:M,this.hass.localize("ui.components.items-display-editor."+(a?"hide":"show"),{label:o}),d,this._toggle,this.showNavigationButton?(0,n.dy)(_||(_=$` <ha-icon-next slot="end"></ha-icon-next> `)):n.Ld)})))}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(w||(w=$`:host{display:block}.handle{cursor:move;padding:8px;margin:-8px}ha-md-list{padding:0}ha-md-list-item{--md-list-item-top-space:0;--md-list-item-bottom-space:0;--md-list-item-leading-space:8px;--md-list-item-trailing-space:8px;--md-list-item-two-line-container-height:48px;--md-list-item-one-line-container-height:48px}ha-md-list-item ha-icon-button{margin-left:-12px;margin-right:-12px}ha-md-list-item.hidden{--md-list-item-label-text-color:var(--disabled-text-color);--md-list-item-supporting-text-color:var(--disabled-text-color)}ha-md-list-item.hidden .icon{color:var(--disabled-text-color)}`))}}]}}),n.oi);t()}catch(y){t(y)}}))},74633:function(e,t,i){var a=i(61701),o=i(72621),n=(i(71695),i(47021),i(78755)),d=i(57243),r=i(50778);let s,l=e=>e;(0,a.Z)([(0,r.Mo)("ha-md-list-item")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(i,"styles",this),(0,d.iv)(s||(s=l`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color)}md-item{overflow:var(--md-item-overflow,hidden);align-items:var(--md-item-align-items,center)}`))]}}]}}),n.g)},19993:function(e,t,i){var a=i(61701),o=i(72621),n=(i(71695),i(47021),i(623)),d=i(57243),r=i(50778);let s,l=e=>e;(0,a.Z)([(0,r.Mo)("ha-md-list")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(i,"styles",this),(0,d.iv)(s||(s=l`:host{--md-sys-color-surface:var(--card-background-color)}`))]}}]}}),n.j)},62801:function(e,t,i){var a=i(61701),o=i(72621),n=(i(71695),i(9359),i(56475),i(19423),i(40251),i(22139),i(47021),i(57243)),d=i(50778),r=i(36522);let s,l=e=>e;(0,a.Z)([(0,d.Mo)("ha-sortable")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",key:"_sortable",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:"no-style"})],key:"noStyle",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:String,attribute:"draggable-selector"})],key:"draggableSelector",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:String,attribute:"handle-selector"})],key:"handleSelector",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:String,attribute:"filter"})],key:"filter",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:String})],key:"group",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:"invert-swap"})],key:"invertSwap",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"options",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"rollback",value(){return!0}},{kind:"method",key:"updated",value:function(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}},{kind:"field",key:"_shouldBeDestroy",value(){return!1}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(a,"disconnectedCallback",this,3)([]),this._shouldBeDestroy=!0,setTimeout((()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)}),1)}},{kind:"method",key:"connectedCallback",value:function(){(0,o.Z)(a,"connectedCallback",this,3)([]),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"render",value:function(){return this.noStyle?n.Ld:(0,n.dy)(s||(s=l` <style>.sortable-fallback{display:none!important}.sortable-ghost{box-shadow:0 0 0 2px var(--primary-color);background:rgba(var(--rgb-primary-color),.25);border-radius:4px;opacity:.4}.sortable-drag{border-radius:4px;opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `))}},{kind:"method",key:"_createSortable",value:async function(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([i.e("34153"),i.e("467")]).then(i.bind(i,59807))).default,a=Object.assign(Object.assign({scroll:!0,forceAutoScrollFallback:!0,scrollSpeed:20,animation:150},this.options),{},{onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd,onUpdate:this._handleUpdate,onAdd:this._handleAdd,onRemove:this._handleRemove});this.draggableSelector&&(a.draggable=this.draggableSelector),this.handleSelector&&(a.handle=this.handleSelector),void 0!==this.invertSwap&&(a.invertSwap=this.invertSwap),this.group&&(a.group=this.group),this.filter&&(a.filter=this.filter),this._sortable=new t(e,a)}},{kind:"field",key:"_handleUpdate",value(){return e=>{(0,r.B)(this,"item-moved",{newIndex:e.newIndex,oldIndex:e.oldIndex})}}},{kind:"field",key:"_handleAdd",value(){return e=>{(0,r.B)(this,"item-added",{index:e.newIndex,data:e.item.sortableData})}}},{kind:"field",key:"_handleRemove",value(){return e=>{(0,r.B)(this,"item-removed",{index:e.oldIndex})}}},{kind:"field",key:"_handleEnd",value(){return async e=>{(0,r.B)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder)}}},{kind:"field",key:"_handleStart",value(){return()=>{(0,r.B)(this,"drag-start")}}},{kind:"field",key:"_handleChoose",value(){return e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}},{kind:"method",key:"_destroySortable",value:function(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}}]}}),n.oi)}}]);
//# sourceMappingURL=86431.30920d59b5cbfe62.js.map