mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-10 16:52:15 -06:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
3 lines
11 KiB
JavaScript
3 lines
11 KiB
JavaScript
/*! For license information please see 8800.deb0cfab5c2667d7.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["8800"],{47842:function(e,t,o){o.a(e,async function(e,i){try{o.r(t),o.d(t,{DialogDataTableSettings:function(){return k}});o(39710),o(26847),o(2394),o(44438),o(18574),o(73042),o(81738),o(94814),o(22960),o(6989),o(93190),o(87799),o(56389),o(27530);var s=o(73742),a=o(59048),l=o(7616),r=o(31733),n=o(88245),d=o(28105),h=o(39884),c=o(95814),u=o(72953),p=o(83378),_=(o(64881),o(69760),o(21409),e([u]));u=(_.then?(await _)():_)[0];let m,b,g,y,f=e=>e;const v="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",C="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",x="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 k extends a.oi{showDialog(e){this._params=e,this._columnOrder=e.columnOrder,this._hiddenColumns=e.hiddenColumns}closeDialog(){this._params=void 0,(0,h.B)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return a.Ld;const e=this._params.localizeFunc||this.hass.localize,t=this._sortedColumns(this._params.columns,this._columnOrder,this._hiddenColumns);return(0,a.dy)(m||(m=f` <ha-dialog open @closed="${0}" .heading="${0}"> <ha-sortable @item-moved="${0}" draggable-selector=".draggable" handle-selector=".handle"> <ha-list> ${0} </ha-list> </ha-sortable> <ha-button appearance="plain" slot="secondaryAction" @click="${0}">${0}</ha-button> <ha-button slot="primaryAction" @click="${0}"> ${0} </ha-button> </ha-dialog> `),this.closeDialog,(0,p.i)(this.hass,e("ui.components.data-table.settings.header")),this._columnMoved,(0,n.r)(t,e=>e.key,(e,t)=>{var o,i;const s=!e.main&&!1!==e.moveable,l=!e.main&&!1!==e.hideable,n=!(this._columnOrder&&this._columnOrder.includes(e.key)&&null!==(o=null===(i=this._hiddenColumns)||void 0===i?void 0:i.includes(e.key))&&void 0!==o?o:e.defaultHidden);return(0,a.dy)(b||(b=f`<ha-list-item hasMeta class="${0}" graphic="icon" noninteractive>${0} ${0} <ha-icon-button tabindex="0" class="action" .disabled="${0}" .hidden="${0}" .path="${0}" slot="meta" .label="${0}" .column="${0}" @click="${0}"></ha-icon-button> </ha-list-item>`),(0,r.$)({hidden:!n,draggable:s&&n}),e.title||e.label||e.key,s&&n?(0,a.dy)(g||(g=f`<ha-svg-icon class="handle" .path="${0}" slot="graphic"></ha-svg-icon>`),v):a.Ld,!l,!n,n?C:x,this.hass.localize("ui.components.data-table.settings."+(n?"hide":"show"),{title:"string"==typeof e.title?e.title:""}),e.key,this._toggle)}),this._reset,e("ui.components.data-table.settings.restore"),this.closeDialog,e("ui.components.data-table.settings.done"))}_columnMoved(e){if(e.stopPropagation(),!this._params)return;const{oldIndex:t,newIndex:o}=e.detail,i=this._sortedColumns(this._params.columns,this._columnOrder,this._hiddenColumns).map(e=>e.key),s=i.splice(t,1)[0];i.splice(o,0,s),this._columnOrder=i,this._params.onUpdate(this._columnOrder,this._hiddenColumns)}_toggle(e){var t;if(!this._params)return;const o=e.target.column,i=e.target.hidden,s=[...null!==(t=this._hiddenColumns)&&void 0!==t?t:Object.entries(this._params.columns).filter(([e,t])=>t.defaultHidden).map(([e])=>e)];i&&s.includes(o)?s.splice(s.indexOf(o),1):i||s.push(o);const a=this._sortedColumns(this._params.columns,this._columnOrder,s);if(this._columnOrder){const e=this._columnOrder.filter(e=>e!==o);let t=((e,t)=>{for(let o=e.length-1;o>=0;o--)if(t(e[o],o,e))return o;return-1})(e,e=>e!==o&&!s.includes(e)&&!this._params.columns[e].main&&!1!==this._params.columns[e].moveable);-1===t&&(t=e.length-1),a.forEach(i=>{e.includes(i.key)||(!1===i.moveable?e.unshift(i.key):e.splice(t+1,0,i.key),i.key!==o&&i.defaultHidden&&!s.includes(i.key)&&s.push(i.key))}),this._columnOrder=e}else this._columnOrder=a.map(e=>e.key);this._hiddenColumns=s,this._params.onUpdate(this._columnOrder,this._hiddenColumns)}_reset(){this._columnOrder=void 0,this._hiddenColumns=void 0,this._params.onUpdate(this._columnOrder,this._hiddenColumns),this.closeDialog()}static get styles(){return[c.yu,(0,a.iv)(y||(y=f`ha-dialog{--mdc-dialog-max-width:500px;--dialog-z-index:10;--dialog-content-padding:0 8px}@media all and (max-width:451px){ha-dialog{--vertical-align-dialog:flex-start;--dialog-surface-margin-top:250px;--ha-dialog-border-radius:28px 28px 0 0;--mdc-dialog-min-height:calc(100% - 250px);--mdc-dialog-max-height:calc(100% - 250px)}}ha-list-item{--mdc-list-side-padding:12px;overflow:visible}.hidden{color:var(--disabled-text-color)}.handle{cursor:move;cursor:grab}.actions{display:flex;flex-direction:row}ha-icon-button{display:block;margin:-12px}`))]}constructor(...e){super(...e),this._sortedColumns=(0,d.Z)((e,t,o)=>Object.keys(e).filter(t=>!e[t].hidden).sort((i,s)=>{var a,l,r,n;const d=null!==(a=null==t?void 0:t.indexOf(i))&&void 0!==a?a:-1,h=null!==(l=null==t?void 0:t.indexOf(s))&&void 0!==l?l:-1,c=null!==(r=null==o?void 0:o.includes(i))&&void 0!==r?r:Boolean(e[i].defaultHidden);if(c!==(null!==(n=null==o?void 0:o.includes(s))&&void 0!==n?n:Boolean(e[s].defaultHidden)))return c?1:-1;if(d!==h){if(-1===d)return 1;if(-1===h)return-1}return d-h}).reduce((t,o)=>(t.push(Object.assign({key:o},e[o])),t),[]))}}(0,s.__decorate)([(0,l.Cb)({attribute:!1})],k.prototype,"hass",void 0),(0,s.__decorate)([(0,l.SB)()],k.prototype,"_params",void 0),(0,s.__decorate)([(0,l.SB)()],k.prototype,"_columnOrder",void 0),(0,s.__decorate)([(0,l.SB)()],k.prototype,"_hiddenColumns",void 0),k=(0,s.__decorate)([(0,l.Mo)("dialog-data-table-settings")],k),i()}catch(m){i(m)}})},21409:function(e,t,o){o(26847),o(81738),o(94814),o(87799),o(1455),o(40589),o(27530);var i=o(73742),s=o(59048),a=o(7616),l=o(39884);let r,n=e=>e;class d extends s.oi{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?s.Ld:(0,s.dy)(r||(r=n` <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> `))}async _createSortable(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([o.e("7597"),o.e("4164")]).then(o.bind(o,23038))).default,i=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&&(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,l.B)(this,"item-moved",{newIndex:e.newIndex,oldIndex:e.oldIndex})},this._handleAdd=e=>{(0,l.B)(this,"item-added",{index:e.newIndex,data:e.item.sortableData})},this._handleRemove=e=>{(0,l.B)(this,"item-removed",{index:e.oldIndex})},this._handleEnd=async e=>{(0,l.B)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder)},this._handleStart=()=>{(0,l.B)(this,"drag-start")},this._handleChoose=e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}}(0,i.__decorate)([(0,a.Cb)({type:Boolean})],d.prototype,"disabled",void 0),(0,i.__decorate)([(0,a.Cb)({type:Boolean,attribute:"no-style"})],d.prototype,"noStyle",void 0),(0,i.__decorate)([(0,a.Cb)({type:String,attribute:"draggable-selector"})],d.prototype,"draggableSelector",void 0),(0,i.__decorate)([(0,a.Cb)({type:String,attribute:"handle-selector"})],d.prototype,"handleSelector",void 0),(0,i.__decorate)([(0,a.Cb)({type:String,attribute:"filter"})],d.prototype,"filter",void 0),(0,i.__decorate)([(0,a.Cb)({type:String})],d.prototype,"group",void 0),(0,i.__decorate)([(0,a.Cb)({type:Boolean,attribute:"invert-swap"})],d.prototype,"invertSwap",void 0),(0,i.__decorate)([(0,a.Cb)({attribute:!1})],d.prototype,"options",void 0),(0,i.__decorate)([(0,a.Cb)({type:Boolean})],d.prototype,"rollback",void 0),d=(0,i.__decorate)([(0,a.Mo)("ha-sortable")],d)},88245:function(e,t,o){o.d(t,{r:function(){return r}});o(40777),o(26847),o(27530);var i=o(35340),s=o(83522),a=o(5277);const l=(e,t,o)=>{const i=new Map;for(let s=t;s<=o;s++)i.set(e[s],s);return i},r=(0,s.XM)(class extends s.Xe{dt(e,t,o){let i;void 0===o?o=t:void 0!==t&&(i=t);const s=[],a=[];let l=0;for(const r of e)s[l]=i?i(r,l):l,a[l]=o(r,l),l++;return{values:a,keys:s}}render(e,t,o){return this.dt(e,t,o).values}update(e,[t,o,s]){var r;const n=(0,a.i9)(e),{values:d,keys:h}=this.dt(t,o,s);if(!Array.isArray(n))return this.ut=h,d;const c=null!==(r=this.ut)&&void 0!==r?r:this.ut=[],u=[];let p,_,m=0,b=n.length-1,g=0,y=d.length-1;for(;m<=b&&g<=y;)if(null===n[m])m++;else if(null===n[b])b--;else if(c[m]===h[g])u[g]=(0,a.fk)(n[m],d[g]),m++,g++;else if(c[b]===h[y])u[y]=(0,a.fk)(n[b],d[y]),b--,y--;else if(c[m]===h[y])u[y]=(0,a.fk)(n[m],d[y]),(0,a._Y)(e,u[y+1],n[m]),m++,y--;else if(c[b]===h[g])u[g]=(0,a.fk)(n[b],d[g]),(0,a._Y)(e,n[m],n[b]),b--,g++;else if(void 0===p&&(p=l(h,g,y),_=l(c,m,b)),p.has(c[m]))if(p.has(c[b])){const t=_.get(h[g]),o=void 0!==t?n[t]:null;if(null===o){const t=(0,a._Y)(e,n[m]);(0,a.fk)(t,d[g]),u[g]=t}else u[g]=(0,a.fk)(o,d[g]),(0,a._Y)(e,n[m],o),n[t]=null;g++}else(0,a.ws)(n[b]),b--;else(0,a.ws)(n[m]),m++;for(;g<=y;){const t=(0,a._Y)(e,u[y+1]);(0,a.fk)(t,d[g]),u[g++]=t}for(;m<=b;){const e=n[m++];null!==e&&(0,a.ws)(e)}return this.ut=h,(0,a.hl)(e,u),i.Jb}constructor(e){if(super(e),e.type!==s.pX.CHILD)throw Error("repeat() can only be used in text expressions")}})}}]);
|
|
//# sourceMappingURL=8800.deb0cfab5c2667d7.js.map
|