iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 18.8 kB
JavaScript
export const __rspack_esm_id=64280;export const __rspack_esm_ids=[64280];export const __webpack_modules__={66033(e,t,o){o.d(t,{L:()=>i});const i=(e,t)=>{const o=e.floor_id;return{area:e,floor:(o?t[o]:void 0)||null}}},14923(e,t,o){o.a(e,async function(e,t){try{o(18111),o(61701);var i=o(62826),a=o(5124),s=o(22441),r=o(1087),n=o(66033),d=(o(11382),o(77729)),l=(o(67094),e([d]));d=(l.then?(await l)():l)[0];const h="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";class c extends a.WF{render(){const e=Object.values(this.hass.areas).map(e=>{const{floor:t}=(0,n.L)(e,this.hass.floors);return{value:e.area_id,label:e.name,icon:e.icon??void 0,iconPath:h,description:t?.name}}),t={order:this.value?.order??[],hidden:this.value?.hidden??[]};return a.qy` <ha-expansion-panel outlined .header="${this.label}" .expanded="${this.expanded}"> <ha-svg-icon slot="leading-icon" .path="${h}"></ha-svg-icon> <ha-items-display-editor .items="${e}" .value="${t}" -changed="${this._areaDisplayChanged}" .showNavigationButton="${this.showNavigationButton}"></ha-items-display-editor> </ha-expansion-panel> `}async _areaDisplayChanged(e){e.stopPropagation();const t=e.detail.value,o={...this.value,...t};0===o.hidden?.length&&delete o.hidden,0===o.order?.length&&delete o.order,(0,r.r)(this,"value-changed",{value:o})}constructor(...e){super(...e),this.expanded=!1,this.disabled=!1,this.required=!1,this.showNavigationButton=!1}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)()],c.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],c.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],c.prototype,"expanded",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],c.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],c.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"show-navigation-button"})],c.prototype,"showNavigationButton",void 0),c=(0,i.Cg)([(0,s.EM)("ha-areas-display-editor")],c),t()}catch(e){t(e)}})},11382(e,t,o){var i=o(62826),a=o(5124),s=o(22441),r=o(6412),n=o(1087),d=o(12587);o(67094);class l extends a.WF{render(){const e=this.noCollapse?a.s6:a.qy` <ha-svg-icon .path="${"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"}" class="summary-icon ${(0,r.H)({expanded:this.expanded})}"></ha-svg-icon> `;return a.qy` <div class="top ${(0,r.H)({expanded:this.expanded})}"> <div id="summary" class="${(0,r.H)({noCollapse:this.noCollapse})}" ="${this._toggleContainer}" ="${this._toggleContainer}" ="${this._focusChanged}" ="${this._focusChanged}" role="button" tabindex="${this.noCollapse?-1:0}" aria-expanded="${this.expanded}" aria-controls="sect1" part="summary"> ${this.leftChevron?e:a.s6} <slot name="leading-icon"></slot> <slot name="header"> <div class="header"> ${this.header} <slot class="secondary" name="secondary">${this.secondary}</slot> </div> </slot> <slot name="event"></slot> ${this.leftChevron?a.s6:e} <slot name="icons"></slot> </div> </div> <div class="container ${(0,r.H)({expanded:this.expanded})}" ="${this._handleTransitionEnd}" role="region" aria-labelledby="summary" aria-hidden="${!this.expanded}" tabindex="-1"> ${this._showContent?a.qy`<slot></slot>`:""} </div> `}willUpdate(e){super.willUpdate(e),e.has("expanded")&&(this._showContent=this.expanded,setTimeout(()=>{this._container.style.overflow=this.expanded?"initial":"hidden"},300))}_handleTransitionEnd(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}async _toggleContainer(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,n.r)(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await(0,d.E)());const o=this._container.scrollHeight;this._container.style.height=`${o}px`,t||setTimeout(()=>{this._container.style.height="0px"},0),this.expanded=t,(0,n.r)(this,"expanded-changed",{expanded:this.expanded})}_focusChanged(e){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}constructor(...e){super(...e),this.expanded=!1,this.outlined=!1,this.leftChevron=!1,this.noCollapse=!1,this._showContent=this.expanded}}l.styles=a.AH`:host{display:block}.top{display:flex;align-items:center;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.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,var(--ha-border-radius-lg))}.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;border-radius:var(--ha-border-radius-circle)}#summary:focus-visible ha-svg-icon.summary-icon{background-color:var(--ha-color-fill-neutral-normal-active)}::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:var(--ha-font-weight-medium);outline:0}#summary.noCollapse{cursor:default}.summary-icon.expanded{transform:rotate(180deg)}.header,::slotted([slot=header]){flex:1;overflow-wrap:anywhere;color:var(--primary-text-color)}.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:var(--ha-font-size-s)}`,(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],l.prototype,"expanded",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],l.prototype,"outlined",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"left-chevron",type:Boolean,reflect:!0})],l.prototype,"leftChevron",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"no-collapse",type:Boolean,reflect:!0})],l.prototype,"noCollapse",void 0),(0,i.Cg)([(0,s.MZ)()],l.prototype,"header",void 0),(0,i.Cg)([(0,s.MZ)()],l.prototype,"secondary",void 0),(0,i.Cg)([(0,s.wk)()],l.prototype,"_showContent",void 0),(0,i.Cg)([(0,s.P)(".container")],l.prototype,"_container",void 0),l=(0,i.Cg)([(0,s.EM)("ha-expansion-panel")],l)},43661(e,t,o){o.r(t),o.d(t,{HaIconNext:()=>n});var i=o(62826),a=o(22441),s=o(63091),r=o(67094);class n extends r.HaSvgIcon{constructor(...e){super(...e),this.path="rtl"===s.G.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"}}(0,i.Cg)([(0,a.MZ)()],n.prototype,"path",void 0),n=(0,i.Cg)([(0,a.EM)("ha-icon-next")],n)},77729(e,t,o){o.a(e,async function(e,t){try{o(74423),o(44114),o(18111),o(22489),o(61701);var i=o(62826),a=o(88696),s=o(5124),r=o(22441),n=o(6412),d=o(63672),l=o(75751),h=o(91450),c=o(22786),p=o(93421),u=o(1087),v=o(57237),g=o(52220),m=(o(47680),o(26300)),y=(o(43661),o(17308),o(2846),o(85938),o(67094),e([m]));m=(y.then?(await y)():y)[0];const b="M21 11H3V9H21V11M21 13H3V15H21V13Z",x="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",_="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";class C extends s.WF{render(){const e=this._allItems(this.items,this.value.hidden,this.value.order),t=this._showIcon.value;return s.qy` <ha-sortable draggable-selector=".draggable" handle-selector=".handle" -moved="${this._itemMoved}"> <ha-md-list> ${(0,l.u)(e,e=>e.value,(e,o)=>{const i=!this.value.hidden.includes(e.value),{label:a,value:r,description:l,icon:c,iconPath:p,disableSorting:u,disableHiding:g}=e;return s.qy` <ha-md-list-item type="button" ="${this.showNavigationButton?this._navigate:void 0}" .value="${r}" class="${(0,n.H)({hidden:!i,draggable:i&&!u,"drag-selected":this._dragIndex===o})}" ="${i&&!u?this._listElementKeydown:void 0}" .idx="${o}"> <span slot="headline">${a}</span> ${l?s.qy`<span slot="supporting-text">${l}</span>`:s.s6} ${t?c?s.qy` <ha-icon class="icon" .icon="${(0,h.T)(c,"")}" slot="start"></ha-icon> `:p?s.qy` <ha-svg-icon class="icon" .path="${p}" slot="start"></ha-svg-icon> `:s.s6:s.s6} ${this.showNavigationButton?s.qy` <ha-icon-next slot="end"></ha-icon-next> <div slot="end" class="separator"></div> `:s.s6} ${this.actionsRenderer?s.qy` <div slot="end" ="${v.d}"> ${this.actionsRenderer(e)} </div> `:s.s6} ${i&&g?s.s6:s.qy`<ha-icon-button .path="${i?x:_}" slot="end" .label="${this._localize("ui.components.items-display-editor."+(i?"hide":"show"),{label:a})}" .value="${r}" ="${this._toggle}" .disabled="${g||!1}"></ha-icon-button>`} ${i&&!u?s.qy` <ha-svg-icon tabindex="${(0,d.J)(this.showNavigationButton?"0":void 0)}" .idx="${o}" ="${this.showNavigationButton?this._dragHandleKeydown:void 0}" class="handle" .path="${b}" slot="end"></ha-svg-icon> `:s.qy`<ha-svg-icon slot="end"></ha-svg-icon>`} </ha-md-list-item> `})} </ha-md-list> </ha-sortable> `}_toggle(e){e.stopPropagation(),this._dragIndex=null;const t=e.currentTarget.value,o=this._hiddenItems(this.items,this.value.hidden).map(e=>e.value);o.includes(t)?o.splice(o.indexOf(t),1):o.push(t);const i=this._visibleItems(this.items,o,this.value.order).map(e=>e.value);this.value={hidden:o,order:i},(0,u.r)(this,"value-changed",{value:this.value})}_itemMoved(e){e.stopPropagation();const{oldIndex:t,newIndex:o}=e.detail;this._moveItem(t,o)}_moveItem(e,t){if(e===t)return;const o=this._visibleItems(this.items,this.value.hidden,this.value.order).map(e=>e.value),i=o.splice(e,1)[0];o.splice(t,0,i),this.value={...this.value,order:o},(0,u.r)(this,"value-changed",{value:this.value})}_navigate(e){const t=e.currentTarget.value;(0,u.r)(this,"item-display-navigate-clicked",{value:t}),e.stopPropagation()}_dragHandleKeydown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),null===this._dragIndex?(this._dragIndex=e.target.idx,this.addEventListener("keydown",this._sortKeydown)):(this.removeEventListener("keydown",this._sortKeydown),this._dragIndex=null))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._sortKeydown)}constructor(...e){super(...e),this.items=[],this.showNavigationButton=!1,this.dontSortVisible=!1,this.value={order:[],hidden:[]},this._dragIndex=null,this._showIcon=new a.P(this,{callback:e=>e[0]?.contentRect.width>450}),this._visibleItems=(0,c.A)((e,t,o)=>{const i=(0,g.u1)(o),a=e.filter(e=>!t.includes(e.value));return this.dontSortVisible?[...a.filter(e=>!e.disableSorting),...a.filter(e=>e.disableSorting)]:a.sort((e,t)=>e.disableSorting&&!t.disableSorting?-1:i(e.value,t.value))}),this._allItems=(0,c.A)((e,t,o)=>[...this._visibleItems(e,t,o),...this._hiddenItems(e,t)]),this._hiddenItems=(0,c.A)((e,t)=>e.filter(e=>t.includes(e.value))),this._maxSortableIndex=(0,c.A)((e,t)=>e.filter(e=>!e.disableSorting&&!t.includes(e.value)).length-1),this._keyActivatedMove=(e,t=!1)=>{const o=this._dragIndex;"ArrowUp"===e.key?this._dragIndex=Math.max(0,this._dragIndex-1):this._dragIndex=Math.min(this._maxSortableIndex(this.items,this.value.hidden),this._dragIndex+1),this._moveItem(o,this._dragIndex),setTimeout(async()=>{await this.updateComplete;const e=this.shadowRoot?.querySelector(`ha-md-list-item:nth-child(${this._dragIndex+1})`);e?.focus(),t&&(this._dragIndex=null)})},this._sortKeydown=e=>{null===this._dragIndex||"ArrowUp"!==e.key&&"ArrowDown"!==e.key?null!==this._dragIndex&&"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),this._dragIndex=null,this.removeEventListener("keydown",this._sortKeydown)):(e.preventDefault(),this._keyActivatedMove(e))},this._listElementKeydown=e=>{!e.altKey||"ArrowUp"!==e.key&&"ArrowDown"!==e.key?(!this.showNavigationButton&&"Enter"===e.key||" "===e.key)&&this._dragHandleKeydown(e):(e.preventDefault(),this._dragIndex=e.target.idx,this._keyActivatedMove(e,!0))}}}C.styles=s.AH`:host{display:block}.handle{cursor:move;padding:8px;margin:-8px}.separator{width:1px;background-color:var(--divider-color);height:21px;margin:0 -4px}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.drag-selected{--md-focus-ring-color:rgba(var(--rgb-accent-color), 0.6);border-radius:var(--ha-border-radius-md);outline:solid;outline-color:rgba(var(--rgb-accent-color),.6);outline-offset:-2px;outline-width:2px;background-color:rgba(var(--rgb-accent-color),.08)}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)}`,(0,i.Cg)([(0,r.wk)(),(0,p.IW)()],C.prototype,"_localize",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],C.prototype,"items",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"show-navigation-button"})],C.prototype,"showNavigationButton",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"dont-sort-visible"})],C.prototype,"dontSortVisible",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],C.prototype,"value",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],C.prototype,"actionsRenderer",void 0),(0,i.Cg)([(0,r.wk)()],C.prototype,"_dragIndex",void 0),C=(0,i.Cg)([(0,r.EM)("ha-items-display-editor")],C),t()}catch(e){t(e)}})},2846(e,t,o){o.d(t,{G:()=>l,J:()=>d});var i=o(62826),a=o(58168),s=o(82553),r=o(5124),n=o(22441);o(54276);const d=[s.R,r.AH`: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);gap:var(--ha-md-list-item-gap,16px)}`];class l extends a.n{renderRipple(){return"text"===this.type?r.s6:r.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled&&"link"!==this.type}"></ha-ripple>`}}l.styles=d,l=(0,i.Cg)([(0,n.EM)("ha-md-list-item")],l)},17308(e,t,o){var i=o(62826),a=o(49838),s=o(11245),r=o(5124),n=o(22441);class d extends a.B{}d.styles=[s.R,r.AH`:host{--md-sys-color-surface:var(--card-background-color)}`],d=(0,i.Cg)([(0,n.EM)("ha-md-list")],d)},85938(e,t,o){o(18111),o(22489),o(46058);var i=o(62826),a=o(5124),s=o(22441),r=o(1087);class n extends a.WF{updated(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}disconnectedCallback(){super.disconnectedCallback(),this._shouldBeDestroy=!0,setTimeout(()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)},1)}connectedCallback(){super.connectedCallback(),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}createRenderRoot(){return this}render(){return this.noStyle?a.s6:a.qy` <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:var(--ha-border-radius-sm);opacity:.4}.sortable-drag{border-radius:var(--ha-border-radius-sm);opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `}async _createSortable(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([o.e(85283),o.e(70322)]).then(o.bind(o,80745))).default,i={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&&(i.draggable=this.draggableSelector),this.handleSelector&&(i.handle=this.handleSelector),void 0!==this.invertSwap&&(i.invertSwap=this.invertSwap),this.group&&(i.group=this.group),this.filter&&(i.filter=this.filter),this._sortable=new t(e,i)}_destroySortable(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}constructor(...e){super(...e),this.disabled=!1,this.noStyle=!1,this.invertSwap=!1,this.rollback=!0,this._shouldBeDestroy=!1,this._handleUpdate=e=>{(0,r.r)(this,"item-moved",{newIndex:e.newIndex,oldIndex:e.oldIndex})},this._handleAdd=e=>{(0,r.r)(this,"item-added",{index:e.newIndex,data:e.item.sortableData,item:e.item})},this._handleRemove=e=>{(0,r.r)(this,"item-removed",{index:e.oldIndex})},this._handleEnd=async e=>{(0,r.r)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder)},this._handleStart=()=>{(0,r.r)(this,"drag-start")},this._handleChoose=e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}}(0,i.Cg)([(0,s.MZ)({type:Boolean})],n.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"no-style"})],n.prototype,"noStyle",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"draggable-selector"})],n.prototype,"draggableSelector",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"handle-selector"})],n.prototype,"handleSelector",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"filter"})],n.prototype,"filter",void 0),(0,i.Cg)([(0,s.MZ)({type:String})],n.prototype,"group",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"invert-swap"})],n.prototype,"invertSwap",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],n.prototype,"options",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],n.prototype,"rollback",void 0),n=(0,i.Cg)([(0,s.EM)("ha-sortable")],n)}};