@digital-realty/ix-grid 1.4.1-alpha.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IxGrid.d.ts +13 -0
- package/dist/IxGrid.js +107 -19
- package/dist/IxGrid.js.map +1 -1
- package/dist/components/IxGridNav.js +0 -1
- package/dist/components/IxGridNav.js.map +1 -1
- package/dist/components/IxGridNoRows.js +3 -1
- package/dist/components/IxGridNoRows.js.map +1 -1
- package/dist/components/IxGridRowFilter.d.ts +2 -0
- package/dist/components/IxGridRowFilter.js +40 -18
- package/dist/components/IxGridRowFilter.js.map +1 -1
- package/dist/components/IxPagination.d.ts +1 -0
- package/dist/components/IxPagination.js +10 -4
- package/dist/components/IxPagination.js.map +1 -1
- package/dist/components/grid-row-filter-styles.js +8 -2
- package/dist/components/grid-row-filter-styles.js.map +1 -1
- package/dist/components/pagination-styles.js +8 -0
- package/dist/components/pagination-styles.js.map +1 -1
- package/dist/grid-view-styles.js +16 -10
- package/dist/grid-view-styles.js.map +1 -1
- package/dist/ix-grid.min.js +1210 -19
- package/dist/test/a11y.test.d.ts +2 -0
- package/dist/test/a11y.test.js +18 -0
- package/dist/test/a11y.test.js.map +1 -0
- package/dist/test/ix-grid-row-filter.test.js +63 -0
- package/dist/test/ix-grid-row-filter.test.js.map +1 -1
- package/dist/test/ix-grid.test.js +42 -1
- package/dist/test/ix-grid.test.js.map +1 -1
- package/dist/test/mockData.d.ts +10 -0
- package/dist/test/mockData.js +36 -0
- package/dist/test/mockData.js.map +1 -0
- package/package.json +23 -28
- package/rollup.config.mjs +4 -42
- package/src/IxGrid.ts +119 -15
- package/src/components/IxGridNav.ts +0 -1
- package/src/components/IxGridNoRows.ts +3 -1
- package/src/components/IxGridRowFilter.ts +43 -24
- package/src/components/IxPagination.ts +8 -4
- package/src/components/grid-row-filter-styles.ts +8 -2
- package/src/components/pagination-styles.ts +8 -0
- package/src/grid-view-styles.ts +16 -10
- package/src/test/a11y.test.ts +25 -0
- package/src/test/ix-grid-row-filter.test.ts +85 -0
- package/src/test/ix-grid.test.ts +64 -1
- package/src/test/mockData.ts +37 -0
- package/web-test-runner.config.mjs +5 -1
- package/src/IxGrid.d.ts +0 -148
- package/src/IxGrid.js +0 -784
- package/src/IxGrid.js.map +0 -1
- package/src/IxGridNav.d.ts +0 -2
- package/src/IxGridNav.js +0 -8
- package/src/IxGridNav.js.map +0 -1
- package/src/components/IxGridColumnFilter.d.ts +0 -35
- package/src/components/IxGridColumnFilter.js +0 -249
- package/src/components/IxGridColumnFilter.js.map +0 -1
- package/src/components/IxGridDownloadMenu.d.ts +0 -17
- package/src/components/IxGridDownloadMenu.js +0 -98
- package/src/components/IxGridDownloadMenu.js.map +0 -1
- package/src/components/IxGridNav.d.ts +0 -16
- package/src/components/IxGridNav.js +0 -103
- package/src/components/IxGridNav.js.map +0 -1
- package/src/components/IxGridNoRows.d.ts +0 -10
- package/src/components/IxGridNoRows.js +0 -74
- package/src/components/IxGridNoRows.js.map +0 -1
- package/src/components/IxGridRowFilter.d.ts +0 -55
- package/src/components/IxGridRowFilter.js +0 -441
- package/src/components/IxGridRowFilter.js.map +0 -1
- package/src/components/IxPagination.d.ts +0 -14
- package/src/components/IxPagination.js +0 -107
- package/src/components/IxPagination.js.map +0 -1
- package/src/components/grid-column-filter-styles.d.ts +0 -1
- package/src/components/grid-column-filter-styles.js +0 -89
- package/src/components/grid-column-filter-styles.js.map +0 -1
- package/src/components/grid-row-filter-styles.d.ts +0 -1
- package/src/components/grid-row-filter-styles.js +0 -311
- package/src/components/grid-row-filter-styles.js.map +0 -1
- package/src/components/ix-grid-no-rows.d.ts +0 -1
- package/src/components/ix-grid-no-rows.js +0 -2
- package/src/components/ix-grid-no-rows.js.map +0 -1
- package/src/components/pagination-styles.d.ts +0 -1
- package/src/components/pagination-styles.js +0 -84
- package/src/components/pagination-styles.js.map +0 -1
- package/src/grid-view-styles.d.ts +0 -1
- package/src/grid-view-styles.js +0 -283
- package/src/grid-view-styles.js.map +0 -1
- package/src/index.d.ts +0 -3
- package/src/index.js +0 -3
- package/src/index.js.map +0 -1
- package/src/ix-grid-copy.d.ts +0 -12
- package/src/ix-grid-copy.js +0 -12
- package/src/ix-grid-copy.js.map +0 -1
- package/src/ix-grid-nav.d.ts +0 -1
- package/src/ix-grid-nav.js +0 -2
- package/src/ix-grid-nav.js.map +0 -1
- package/src/ix-grid-no-rows.d.ts +0 -1
- package/src/ix-grid-no-rows.js +0 -2
- package/src/ix-grid-no-rows.js.map +0 -1
- package/src/ix-grid.d.ts +0 -1
- package/src/ix-grid.js +0 -2
- package/src/ix-grid.js.map +0 -1
- package/src/models/IxGridDownloadMenuItemModel.d.ts +0 -7
- package/src/models/IxGridDownloadMenuItemModel.js +0 -1
- package/src/models/IxGridDownloadMenuItemModel.js.map +0 -1
- package/src/test/ix-grid-column-filter.test.js +0 -41
- package/src/test/ix-grid-row-filter.test.js +0 -281
- package/src/test/ix-grid.test.js +0 -391
- package/src/test/ix-pagination.test.js +0 -58
package/dist/ix-grid.min.js
CHANGED
|
@@ -1,26 +1,1217 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import"@digital-realty/grid";import{columnHeaderRenderer}from"@digital-realty/grid/lit.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-progress/ix-progress.js";import{css,svg,LitElement,nothing,html,render}from"lit";import{query,property,state,customElement}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import{ifDefined}from"lit/directives/if-defined.js";import{formatDate}from"date-fns";import{repeat}from"lit/directives/repeat.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-select/ix-select.js";let IxGridViewStyles=css`:host{--_ix-grid-cell-padding:var(--ix-grid-cell-padding, 1rem);--lumo-primary-color-50pct:transparent}vaadin-grid::part(first-frozen-to-end-cell){border-left:.063rem solid var(--_lumo-grid-border-color);box-shadow:-.375rem 0 .375rem -.375rem #0000001a}*{font-family:inherit}vaadin-grid::part(cell){cursor:var(--ix-grid-cell-pointer,pointer)}vaadin-grid::part(header-cell){cursor:default;--vaadin-grid-cell-background:#fff}vaadin-grid::part(row):hover{--vaadin-grid-cell-background:#f5f5f5}vaadin-grid-cell-content{font-size:14px;--_cell-padding:var(--ix-grid-cell-padding, 14px 10px)}.hide-column-headers::part(header-cell){display:none}vaadin-grid::part(ix-disabled-cell){cursor:default;color:var(--cp-neutral-blue-60p);--vaadin-grid-cell-background:var(--cp-neutral-blue-12p)}ix-grid-download-menu{width:38px;margin-right:2px}ix-grid-column-filter{width:36px}.grid-container{background-color:var(--clr-surface-container-lowest,#fff);border-radius:8px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;box-sizing:border-box;padding:2px}.touch-edge{margin:0 -3px}.grid-header{display:flex;-webkit-box-pack:justify;place-content:space-between;-webkit-box-align:center;align-items:center;padding:1rem;flex-wrap:wrap;gap:18px}.grid-menu{display:flex;align-items:center;margin-left:auto}.grid-menu ix-button{--md-text-button-leading-space:4px;--md-text-button-trailing-space:4px}.grid-menu span{color:var(--clr-primary,#1456e0);cursor:pointer}.header{font-weight:700;display:flex;user-select:none;align-items:center;padding-right:calc(var(--_ix-grid-cell-padding) + 2px);position:relative;text-overflow:ellipsis;overflow:hidden;flex-grow:1;z-index:2;padding-left:.25rem}.header:hover .header-sort-icon{display:block}.columns-reordering{opacity:.25}.progress-container{position:relative;top:60px;z-index:1}span .disabled{color:var(--clr-on-surface-variant,rgba(9,34,65,.7))}.disable-cursor{cursor:default!important}.accounts{display:flex;align-items:center}.account-name{margin:0 8px 0 3px}vaadin-grid-cell-content{font-family:var(--text-small-font,sans-serif);font-size:var(--text-small-size,.875rem);letter-spacing:var(--text-small-letter-spacing,.0275em);line-height:var(--text-small-line-height,1.42857143em);font-weight:var(--text-small-weight,normal);text-decoration:var(--text-small-decoration,none);text-transform:var(--text-small-transform,none);--_cell-padding:var(--ix-grid-cell-padding, 14px 10px)}vaadin-grid-cell-content>div{overflow:hidden;text-overflow:ellipsis}.row-controls{border-top:solid 1px var(--clr-border-outline,#0922411f)}.row-limit{display:flex;padding:8px}.remove-all-button{margin-left:auto}.launchpad vaadin-grid{--_lumo-grid-border-width:0;--lumo-size-xl:auto}.launchpad vaadin-grid-cell-content{padding:11px 24px;border-bottom:0}.launchpad vaadin-grid::part(body-row){border-bottom:1px solid var(--clr-border-outline,rgba(9,34,65,.12))}.launchpad .grid-header{padding:.5rem 18px 0}.launchpad .header{font-family:var(--text-caption-font,sans-serif);font-size:var(--text-caption-size,.75rem);letter-spacing:var(--text-caption-letter-spacing,.03333333em);line-height:var(--text-caption-line-height,1.33333333em);font-weight:var(--text-caption-weight,normal);text-transform:var(--text-caption-transform,none);text-decoration:var(--text-caption-decoration,none)}.launchpad .grid-header h2{font-family:var(--text-page-title-font,sans-serif);font-size:var(--text-page-title-size,2.125rem);letter-spacing:var(--text-page-title-letter-spacing,.01029412em);line-height:var(--text-page-title-line-height,1.17647059em);font-weight:var(--text-page-title-weight,bold);text-decoration:var(--text-page-title-decoration,none);text-transform:var(--text-page-title-transform,none)}vaadin-grid-cell-content{height:var(--ix-grid-cell-height,52px)}@media only screen and (max-width:840px){.grid-header{display:flex;flex-direction:row;padding:1rem;justify-content:space-between}.grid-menu{padding-left:0;margin-left:-4px}}@media only screen and (max-width:600px){.grid-header{display:flex;align-items:flex-start;flex-direction:column;padding:1rem;gap:12px}.grid-container{border-radius:0;box-shadow:none;padding:0;overflow:hidden}}.column-max-width-set{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}`,IxGridColumnFilterStyles=css`.dropdown-content{position:absolute;background-color:var(--clr-surface-container-lowest,#fff);min-width:160px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:9;-webkit-box-align:center;align-items:center;cursor:pointer;vertical-align:middle;-webkit-tap-highlight-color:transparent;padding:10px;width:247px;left:-100px;border-radius:16px}.dropdown-content>div{margin:0;color:var(--clr-on-surface,#092241);font-family:var(--text-small-font,sans-serif);font-size:var(--text-small-size,.875rem);letter-spacing:var(--text-small-letter-spacing,.0275em);line-height:var(--text-small-line-height,1.42857143em);font-weight:var(--text-small-weight,normal);text-decoration:var(--text-small-decoration,none);text-transform:var(--text-small-transform,none);display:block;cursor:pointer}.dropdown-content span:hover{background-color:#f1f1f1}.dropdown-content label{display:flex;align-items:center}.dropdown-content label.dragOrigin{background:#ff000017;outline:1px #ff9d9d dashed}.dropdown-content label p{width:158px}.dropdown-content label .draggable{font-size:24px;cursor:move;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.dropdown-content label .draggable path{fill:var(--clr-primary,#1456e0)}.active{position:absolute;right:8px;top:8px;height:8px;width:8px;background-color:var(--clr-critical,#db0028);border-radius:50%}ix-switch{padding:0 0 0 6px;display:flex;width:48px}.list{position:relative}@media only screen and (max-width:840px){.dropdown-content{left:0}}`,triggerKeys=[" ","Enter"],handleIcon=svg`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM7 12C7 10.9 7.9 10 9 10C10.1 10 11 10.9 11 12C11 13.1 10.1 14 9 14C7.9 14 7 13.1 7 12ZM9 20C10.1 20 11 19.1 11 18C11 16.9 10.1 16 9 16C7.9 16 7 16.9 7 18C7 19.1 7.9 20 9 20ZM17 6C17 7.1 16.1 8 15 8C13.9 8 13 7.1 13 6C13 4.9 13.9 4 15 4C16.1 4 17 4.9 17 6ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM13 18C13 16.9 13.9 16 15 16C16.1 16 17 16.9 17 18C17 19.1 16.1 20 15 20C13.9 20 13 19.1 13 18Z" fill="#1456e0"/></svg>`,IxGridColumnFilter=class extends LitElement{constructor(){super(...arguments),this.columns=[],this.columnsLocalStorageKey=void 0,this.columnReorderingAllowed=!1,this.refreshDataOnColumnVisibilityChange=!0,this.isDropdownVisible=!1,this.disabledColumns=[],this.dragEvent={sourceEl:null,startId:-1,targetId:-1},this.outerInteraction=e=>{e.composedPath().includes(this)||(this.isDropdownVisible=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.outerInteraction),this.initializeLocalStorage()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.outerInteraction)}get preservedColumns(){let e=[];return e=this.columnsLocalStorageKey?JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]"):e}initializeLocalStorage(){0<this.preservedColumns.length&&(this.disabledColumns=this.preservedColumns.filter(t=>t.hidden&&this.columns.some(e=>e.name===t.name)).map(e=>e.name),this.columns.forEach((e,t)=>{this.disabledColumns.includes(e.name)&&(this.columns[t].hidden=!0)})),this.dispatchUpdate()}update(e){super.update(e),e.has("columnsLocalStorageKey")&&this.initializeLocalStorage()}toggleColumn(e){this.columns[e].hidden=!this.columns[e].hidden,this.disabledColumns=this.columns.filter(e=>e.hidden).map(e=>e.name),this.columnsLocalStorageKey&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify([...this.columns])),this.dispatchUpdate()}updateColumn(e,t){e=null==(e=e.target.shadowRoot)?void 0:e.querySelector("input");this.columns[t].hidden!==!(null!=e&&e.checked)&&this.dispatchEvent(new CustomEvent("columnVisibilityChange",{detail:{column:this.columns[t]},bubbles:!0,composed:!0})),this.columns[t].hidden=!(null!=e&&e.checked),this.disabledColumns=this.columns.filter(e=>e.hidden).map(e=>e.name),this.columnsLocalStorageKey&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify([...this.columns])),this.dispatchUpdate()}dispatchUpdate(e=this.columns){this.dispatchEvent(new CustomEvent("columnFilter",{detail:{columns:e},bubbles:!0,composed:!0}))}dragstart(e){this.columnReorderingAllowed&&(e=e.target,(this.dragEvent.sourceEl=e).style.opacity="0.3",e=Number(e.getAttribute("data-id")),this.dragEvent.startId=e)}dragend(){var e,t;this.columnReorderingAllowed&&(this.dragEvent.startId!==this.dragEvent.targetId&&(t=(e=[...this.columns]).splice(this.dragEvent.startId,1)[0],e.splice(this.dragEvent.targetId,0,t),this.dispatchEvent(new CustomEvent("reorderColumns",{detail:{reorderedColumns:e},bubbles:!0,composed:!0}))),null!=(t=this.dragEvent.sourceEl)&&t.style.removeProperty("opacity"),this.dragEvent={sourceEl:null,startId:-1,targetId:-1})}dragenter(e){this.columnReorderingAllowed&&(e=e.target).classList.contains("drag-target")&&(e=Number(e.getAttribute("data-id")),this.dragEvent.targetId=e)}handleDropdownToggle(e){e instanceof KeyboardEvent&&!triggerKeys.includes(e.key)||e.composedPath().includes(this.dropdown)||(this.isDropdownVisible=!this.isDropdownVisible)}render(){return html`<div class="grid-menu"><span @click="${this.handleDropdownToggle}" @keyDown="${this.handleDropdownToggle}" class="list list-dropdown"><ix-icon-button appearance="default"><svg slot="default" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z" fill="#1456E0"/></svg></ix-icon-button>${0<this.disabledColumns.length?html`<div class="active"></div>`:nothing} ${this.isDropdownVisible?html`<div class="dropdown-content" @dragover="${e=>e.preventDefault()}" @dragstart="${this.dragstart}" @dragend="${this.dragend}" @dragenter="${this.dragenter}">${repeat(this.columns.filter(e=>!1!==e.filterable),e=>e.name,(e,t)=>html`<div><label class="${"ix-switch-label drag-target "+(this.dragEvent.startId===t?"dragOrigin":"")}" draggable="${this.columnReorderingAllowed}" data-id="${t}"><ix-switch .selected="${!e.hidden}" @change="${e=>this.updateColumn(e,t)}"></ix-switch><p>${e.header}</p>${this.columnReorderingAllowed?html`<div class="draggable">${handleIcon}</div>`:nothing}</label></div>`)}</div>`:nothing}</span></div>`}},IxGridDownloadMenu=(IxGridColumnFilter.styles=[IxGridViewStyles,IxGridColumnFilterStyles],__decorate([query(".dropdown-content")],IxGridColumnFilter.prototype,"dropdown",void 0),__decorate([property({type:Array})],IxGridColumnFilter.prototype,"columns",void 0),__decorate([property({type:String})],IxGridColumnFilter.prototype,"columnsLocalStorageKey",void 0),__decorate([property({type:Boolean})],IxGridColumnFilter.prototype,"columnReorderingAllowed",void 0),__decorate([property({type:Boolean})],IxGridColumnFilter.prototype,"refreshDataOnColumnVisibilityChange",void 0),__decorate([property({attribute:!1})],IxGridColumnFilter.prototype,"requestGridUpdate",void 0),__decorate([state()],IxGridColumnFilter.prototype,"isDropdownVisible",void 0),__decorate([state()],IxGridColumnFilter.prototype,"disabledColumns",void 0),__decorate([state()],IxGridColumnFilter.prototype,"dragEvent",void 0),IxGridColumnFilter=__decorate([customElement("ix-grid-column-filter")],IxGridColumnFilter),class extends LitElement{constructor(){super(...arguments),this.items=[],this.isDownloading=!1}toggleMenu(){this.downloadMenu.open=!this.downloadMenu.open}renderMenuItems(){var e;return 0===(null==(e=this.items)?void 0:e.length)?html`<ix-menu-item @click="${()=>this.dispatchEvent(new CustomEvent("download",{detail:"all",bubbles:!0,composed:!0}))}"><div slot="headline">Download All Records</div></ix-menu-item><ix-menu-item @click="${()=>this.dispatchEvent(new CustomEvent("download",{detail:"filter",bubbles:!0,composed:!0}))}"><div slot="headline">Download Current Filter</div></ix-menu-item>`:this.items.filter(e=>!e.hidden).map(e=>html`<ix-menu-item .disabled="${e.disabled}" @click="${()=>e.onClick(e.name)}"><div slot="headline">${e.label}</div></ix-menu-item>`)}render(){return this.isDownloading?html`<ix-progress .indeterminate="${!0}" .linear="${!1}" style="--md-circular-progress-size:1.75REM;text-align:center"></ix-progress>`:html`<div style="position:relative"><ix-icon-button id="anchor" @click="${this.toggleMenu}"><svg slot="default" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 9H19L12 16L5 9H9V3H15V9ZM5 20V18H19V20H5Z" fill="#1456E0"/></svg></ix-icon-button><ix-menu id="menu" anchor="anchor" has-overflow>${this.renderMenuItems()}</ix-menu></div>`}}),copy=(IxGridDownloadMenu.styles=[IxGridViewStyles],__decorate([query("#menu")],IxGridDownloadMenu.prototype,"downloadMenu",void 0),__decorate([query("#anchor")],IxGridDownloadMenu.prototype,"downloadMenuAnchor",void 0),__decorate([property({type:Array})],IxGridDownloadMenu.prototype,"items",void 0),__decorate([property({type:Boolean})],IxGridDownloadMenu.prototype,"isDownloading",void 0),IxGridDownloadMenu=__decorate([customElement("ix-grid-download-menu")],IxGridDownloadMenu),{activeFilter:"active filter",filters:"Filters",hideFilters:"Hide Filters",showFilters:"Show Filters",rowsPerPage:"Rows per page",viewMore:"VIEW MORE",viewLess:"VIEW LESS",add:"ADD",removeAll:"REMOVE ALL"}),IxGridRowFilterStyles=css`.slot-wrap{display:flex}.slot-wrap ix-icon{--ix-icon-font-size:24px;color:var(--clr-primary,#1456e0);margin-right:5px}.grid-menu ix-button .filter{margin-top:2px}.filter-form{white-space:nowrap;padding:9px;color:var(--clr-on-surface-variant,#092241b3)}.filter-form-column{display:inline-block;vertical-align:middle}.filter-remove span{margin-right:0;color:var(--clr-on-surface-variant,#092241b3)}.filter-dropdown-content{position:absolute;display:inline;right:0;top:78%;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:3;transition:box-shadow .3s cubic-bezier(.4,0,.2,1) 0s;border-radius:12px;box-shadow:rgba(0,0,0,.2) 0 5px 5px -3px,rgba(0,0,0,.14) 0 8px 10px 1px,rgba(0,0,0,.12) 0 3px 14px 2px;background-color:#fff;z-index:10}.filter-form input,.filter-form option,.filter-form select{font-family:var(--text-default-font,sans-serif);font-size:var(--text-default-size,16px);letter-spacing:var(--text-default-letter-spacing,.0275em);line-height:var(--text-default-line-height,1.75em);font-weight:var(--text-default-weight,normal);text-transform:var(--text-default-decoration,none);text-decoration:var(--text-default-transform,none);border-radius:0;cursor:pointer;box-sizing:content-box;background:0 0;height:1.4375em;margin:0;animation-name:mui-auto-fill-cancel;animation-duration:10ms;border:none;border-image:initial;box-sizing:border-box;cursor:text;user-select:none;color:currentcolor;-webkit-tap-highlight-color:transparent;display:block;min-width:0;width:100%;height:25px;border-bottom:1px solid #000}.filter-form option{-webkit-tap-highlight-color:#9ca6b2}.filter-form input:hover,.filter-form select:hover{outline:0!important;border-bottom:2px solid #000}.filter-form input:focus,.filter-form select:focus{outline:0!important;border-bottom:2px solid #1456e0}.filter-form select:focus{background-color:rgba(0,0,0,.05)}.form-group{display:flex;flex-direction:column;align-items:baseline;height:54px;justify-content:flex-end;font-family:var(--text-default-font,sans-serif)}.form-group label{font-family:var(--text-default-font,sans-serif);font-size:var(--text-default-size,16px);letter-spacing:var(--text-default-letter-spacing,.0275em);line-height:var(--text-default-line-height,1.75em);font-weight:var(--text-default-weight,normal);text-transform:var(--text-default-decoration,none);text-decoration:var(--text-default-transform,none);padding:0;color:#092241;display:block;transform-origin:left top;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:133%;transform:translate(0,-1.5px) scale(.75);transition:color .2s cubic-bezier(0,0,.2,1) 0s,transform .2s cubic-bezier(0,0,.2,1) 0s,max-width .2s cubic-bezier(0,0,.2,1) 0s}.filter-form-group label span{font-family:var(--text-default-font,sans-serif);font-size:var(--text-default-size,16px);letter-spacing:var(--text-default-letter-spacing,.0275em);line-height:var(--text-default-line-height,1.75em);font-weight:var(--text-default-weight,normal);text-transform:var(--text-default-decoration,none);text-decoration:var(--text-default-transform,none);padding:0;color:#092241;display:block;transform-origin:left top;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:133%;transform:translate(0,-1.5px) scale(.75);transition:color .2s cubic-bezier(0,0,.2,1) 0s,transform .2s cubic-bezier(0,0,.2,1) 0s,max-width .2s cubic-bezier(0,0,.2,1) 0s}.filter-form-group label:focus-within span{color:#1456e0}.filter-form-group{display:flex;flex-direction:column;align-items:baseline;height:54px;justify-content:flex-end;font-family:var(--text-default-font,sans-serif)}option{font-weight:400;display:block;min-height:1.2em;padding:0 2px 1px;white-space:nowrap}.filter-footer{padding:9px;display:flex;justify-content:space-between}.no-display{display:none}.filter-local-operator-empty{width:54px;border:none}.grid-menu span.filter-superscript{position:absolute;top:6px;left:14px;z-index:1;display:flex;align-items:center;justify-content:center;font-family:var(--text-caption-font,sans-serif);font-size:var(--text-caption-size,.75rem);letter-spacing:var(--text-caption-letter-spacing,.03333333em);line-height:var(--text-caption-line-height,1.33333333em);font-weight:var(--text-caption-weight,normal);text-transform:var(--text-caption-transform,none);text-decoration:var(--text-caption-decoration,none);padding:0;height:16px;width:16px;border-radius:50%;background-color:var(--clr-primary,#1456e0);color:var(--clr-on-primary,#fff)}.filterlist{width:40px}.filterColumnField{width:150px}.filterValueField{width:190px}.filterOperatorField{width:120px}.form-group-operator-label{width:100%}.filter-form .filterOperatorInput{min-width:96px}select:hover{cursor:pointer}input:hover{cursor:text}.tooltip-container{position:relative;display:inline-block}.tool-tip{color:var(--clr-on-secondary,#fff);overflow-wrap:break-word;border-radius:3px;background-color:var(--clr-secondary,#071454);padding:5px 8px;font-family:var(--text-caption-font,sans-serif);font-size:var(--text-caption-size,.75rem);letter-spacing:var(--text-caption-letter-spacing,.03333333em);line-height:var(--text-caption-line-height,1.33333333em);font-weight:var(--text-caption-weight,normal);text-transform:var(--text-caption-transform,none);text-decoration:var(--text-caption-decoration,none);position:absolute;top:42px;right:0;z-index:3;white-space:nowrap;display:none}.filter-button:hover~.tool-tip{display:block}.tool-tip li{margin-left:-21px;overflow-wrap:break-word;border-radius:3px;max-width:250px;min-width:200px;white-space:wrap}.tool-tip p{margin:0;padding:0}.grid-menu ix-button{align-items:center;display:flex}@media only screen and (max-width:840px){.filter-dropdown-content{right:inherit;top:0}}@media only screen and (max-width:600px){.grid-menu ix-button .filter{display:none}.grid-menu ix-button{--md-text-button-leading-space:6px;--md-text-button-trailing-space:0;margin-left:4px}}`,IxGridRowFilter=class extends LitElement{constructor(){super(...arguments),this.columns=[],this.filterValueChangeDebounceTime=300,this.readParamsFromURL=!1,this.maxDate=formatDate(new Date,"yyyy-MM-dd"),this.isDropdownVisible=!1,this.filters=[],this.filterableColumns=[],this.filterColumns=[],this.activeFilters=[],this.mapSelect=!1,this.fromDateErrorText="",this.oldValueLength=0,this.debouncedOnFilterValueChange=()=>{},this.closeOnOuterClick=e=>{e.composedPath().includes(this)||(this.isDropdownVisible=!1)},this.handlePopState=()=>{this.filters=this.parseFilterQueryString(),0===this.filters.length&&(this.isDropdownVisible=!1,this.addFilter()),this.updateActiveFilters()}}updateActiveFilters(){this.activeFilters=this.filters.filter(e=>0<e.value.length)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeOnOuterClick),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.closeOnOuterClick),window.removeEventListener("popstate",this.handlePopState)}firstUpdated(){this.filterableColumns=this.columns.filter(e=>e.filterable),this.filterColumns=this.filterableColumns.map(e=>e.name),this.readParamsFromURL&&(this.filters=this.parseFilterQueryString()),this.filters.length||this.addFilter(),this.updateActiveFilters(),this.dispatchUpdate(!1),this.debouncedOnFilterValueChange=(e,t)=>{clearTimeout(this.debounceEvent),this.debounceEvent=setTimeout(()=>this.onfilterValueChange.bind(this)(e,t),this.filterValueChangeDebounceTime)}}get filterNames(){return this.filters.map(e=>e.columnField)}get unselectedFilters(){return this.filterColumns.filter(e=>!this.filterNames.includes(e))}parseFilterQueryString(){let r=new URLSearchParams(window.location.search),o=[];return this.filterableColumns.forEach(i=>{var e;null!=(e=i.filterOperators)&&e.forEach(e=>{var t=i.name+"_"+e;r.has(t)&&o.push({columnField:i.name,operatorValue:e,dataType:i.dataType,value:null!=(e=r.get(t))?e:""})})}),o}dispatchUpdate(e=!0){this.dispatchEvent(new CustomEvent("rowFilter",{detail:{filters:this.filters.filter(e=>e.value.length),resetPage:e},bubbles:!0,composed:!0}))}addFilter(){let e,t,i=this.filterColumns.find(e=>!this.filterNames.includes(e))||"";var r=(null==(e=this.filterableColumns.find(e=>e.name===i))?void 0:e.filterOperators)||["contains"],o=(null==(t=this.filterableColumns.find(e=>e.name===i))?void 0:t.dataType)||"string";this.filters=[...this.filters,{columnField:i,operatorValue:r[0],dataType:o,value:""}],this.updateActiveFilters()}clearFilters(){this.filters=[],this.addFilter(),this.dispatchUpdate()}removeFilter(i){this.filters=this.filters.filter((e,t)=>t!==i),this.dispatchUpdate(),0===this.filters.length&&(this.isDropdownVisible=!1,this.addFilter()),this.updateActiveFilters()}onfilterColumnChange(e,t){let i,r=t.target.value;t=this.filterableColumns.find(e=>e.name===r);this.filters[e].columnField=r,this.filters[e].dataType=null==t?void 0:t.dataType,this.filters[e].operatorValue=(null==(i=null==t?void 0:t.filterOperators)?void 0:i[0])||"contains",this.filters=[...this.filters],this.dispatchUpdate()}onfilterOperatorChange(e,t){t=t.target.value;this.filters[e].operatorValue=t,this.filters=[...this.filters],this.dispatchUpdate()}onDatefilterValueChange(e,t){this.filters[e].value=t,this.dispatchUpdate(),this.updateActiveFilters()}onfilterValueChange(e,t){t=t.value,this.filters[e].value=t,t=this.filters[e].value.length;0<this.filters[e].columnField.length&&(3<=t||t<this.oldValueLength)&&this.dispatchUpdate(),this.updateActiveFilters(),this.oldValueLength=t}formatCamelCaseToEnglish(e){e=e.replace(/([A-Z])/g," $1").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}renderToolTip(){return this.isDropdownVisible?copy.hideFilters:this.activeFilters.length?html`<p>${this.activeFilters.length} ${copy.activeFilter}</p><ul>${this.activeFilters.map(e=>html`<li>${this.formatCamelCaseToEnglish(e.columnField)} ${e.operatorValue} ${e.value}</li>`)}</ul>`:copy.showFilters}renderStringInput(e,t){return html`<label class="form-group-operator-label"><span>Value</span> <input data-testid="${"filterValueInput-"+t}" placeholder="Filter value" @input="${e=>this.debouncedOnFilterValueChange(t,e.target)}" .value="${e.value}"></label>`}renderDateInput(e,t){return html`<ix-date data-testid="${"filterValueInput-"+t}" .value="${e.value}" max="${this.maxDate}" name="${e.columnField}-valueDate" .errorText="${this.fromDateErrorText}" .onChanged="${e=>this.onDatefilterValueChange(t,e)}"></ix-date>`}renderFilterInputControl(e,t){switch(e.dataType){case"string":case void 0:return this.renderStringInput(e,t);case"dateTime":return this.renderDateInput(e,t);default:return nothing}}renderFilterInput(t,i){let e,r,o=[t.columnField,...this.unselectedFilters];var a=this.filterableColumns.filter(e=>o.includes(e.name));return html`<div class="filter-form"><div class="filter-remove filter-form-column"><div class="form-group"><ix-icon-button icon="close" data-testid="clearFilterButton" @click="${()=>this.removeFilter(i)}" @keyDown="${e=>{" "!==e.key&&"Enter"!==e.key||this.removeFilter(i)}}"></ix-icon-button></div></div>${this.mapSelect?html`<div class="filter-form-column filter-form-column-border filterColumnField"><div class="form-group"><label class="form-group-column-label" title="select: ${t.columnField}, options: ${a.map(e=>`value=${e.name}, selected=${e.name===t.columnField}, ${e.header}
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import{__decorate as e}from"tslib";import"@digital-realty/grid";import{columnHeaderRenderer as t}from"@digital-realty/grid/lit.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-progress/ix-progress.js";import{css as i,svg as o,LitElement as r,nothing as a,html as n,render as s}from"lit";import{query as l,property as d,state as p,customElement as c}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{ifDefined as u}from"lit/directives/if-defined.js";import{formatDate as m,format as g}from"date-fns/format.js";import{repeat as f}from"lit/directives/repeat.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-date-next/ix-date-next.js";import"@digital-realty/ix-select/ix-select.js";const v=i`
|
|
2
|
+
:host {
|
|
3
|
+
--_ix-grid-cell-padding: var(--ix-grid-cell-padding, 1rem);
|
|
4
|
+
--lumo-primary-color-50pct: transparent;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
vaadin-grid::part(first-frozen-to-end-cell) {
|
|
8
|
+
border-left: 0.063rem solid var(--_lumo-grid-border-color);
|
|
9
|
+
box-shadow: -0.375rem 0 0.375rem -0.375rem #0000001a;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
* {
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
vaadin-grid::part(cell) {
|
|
17
|
+
cursor: var(--ix-grid-cell-pointer, pointer);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
vaadin-grid::part(header-cell) {
|
|
21
|
+
cursor: default;
|
|
22
|
+
--vaadin-grid-cell-background: #fff;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vaadin-grid::part(row):hover {
|
|
26
|
+
--vaadin-grid-cell-background: var(--ix-grid-hover-background, #f5f5f5);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vaadin-grid-cell-content {
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
--_cell-padding: var(--ix-grid-cell-padding, 14px 10px);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.hide-column-headers::part(header-cell) {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vaadin-grid::part(ix-disabled-cell) {
|
|
39
|
+
cursor: default;
|
|
40
|
+
color: var(--cp-neutral-blue-60p);
|
|
41
|
+
--vaadin-grid-cell-background: var(--cp-neutral-blue-12p);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ix-grid-download-menu {
|
|
45
|
+
width: 38px;
|
|
46
|
+
margin-right: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ix-grid-column-filter {
|
|
50
|
+
width: 36px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.grid-container {
|
|
54
|
+
background-color: var(--clr-surface-container-lowest, #ffffff);
|
|
55
|
+
border-radius: 8px;
|
|
56
|
+
box-shadow: rgba(0, 0, 0, 0.12) 0px 12px 20px -12px,
|
|
57
|
+
#e1e4e8 0px 0px 0px 1px inset;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
padding: 2px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.touch-edge {
|
|
63
|
+
margin: 0 -3px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.grid-header {
|
|
67
|
+
display: flex;
|
|
68
|
+
-webkit-box-pack: justify;
|
|
69
|
+
place-content: space-between;
|
|
70
|
+
-webkit-box-align: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
padding: 1rem;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
gap: 18px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.grid-menu {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
margin-left: auto;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.grid-menu ix-button {
|
|
84
|
+
--md-text-button-leading-space: 4px;
|
|
85
|
+
--md-text-button-trailing-space: 4px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.grid-menu span {
|
|
89
|
+
color: var(--clr-primary, #1456e0);
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.header {
|
|
94
|
+
font-weight: bold;
|
|
95
|
+
display: flex;
|
|
96
|
+
user-select: none;
|
|
97
|
+
align-items: center;
|
|
98
|
+
padding-right: calc(var(--_ix-grid-cell-padding) + 2px);
|
|
99
|
+
position: relative;
|
|
100
|
+
|
|
101
|
+
&:not(.frozen):not(.last).border::after {
|
|
102
|
+
content: '';
|
|
103
|
+
display: block;
|
|
104
|
+
position: absolute;
|
|
105
|
+
border: 0;
|
|
106
|
+
border-right-width: var(--ix-grid-header-border-width, 2px);
|
|
107
|
+
border-color: var(
|
|
108
|
+
--ix-grid-header-border-color,
|
|
109
|
+
var(--clr-outline, #0922411f)
|
|
110
|
+
);
|
|
111
|
+
border-style: solid;
|
|
112
|
+
margin-right: 0;
|
|
113
|
+
top: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
bottom: 0;
|
|
116
|
+
left: 0;
|
|
117
|
+
z-index: 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.header-label {
|
|
121
|
+
position: relative;
|
|
122
|
+
text-overflow: ellipsis;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
flex-grow: 1;
|
|
125
|
+
z-index: 2;
|
|
126
|
+
padding-left: 0.25rem;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.header .header-sort-icon {
|
|
131
|
+
background: #fff;
|
|
132
|
+
display: none;
|
|
133
|
+
padding-left: 5px;
|
|
134
|
+
font-size: 17px;
|
|
135
|
+
color: rgba(0, 0, 0, 0.54);
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
height: 18px;
|
|
138
|
+
position: absolute;
|
|
139
|
+
top: 0;
|
|
140
|
+
right: 0;
|
|
141
|
+
bottom: 0;
|
|
142
|
+
z-index: 3;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.header:hover .header-sort-icon {
|
|
146
|
+
display: block;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.columns-reordering {
|
|
150
|
+
opacity: 0.25;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.progress-container {
|
|
154
|
+
position: relative;
|
|
155
|
+
top: var(--progress-bar-top, 60px);
|
|
156
|
+
z-index: 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
span .disabled {
|
|
160
|
+
color: var(--clr-on-surface-variant, rgba(9, 34, 65, 0.7));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.disable-cursor {
|
|
164
|
+
cursor: default !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.accounts {
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.account-name {
|
|
173
|
+
margin: 0 8px 0 3px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
vaadin-grid-cell-content {
|
|
177
|
+
font-family: var(--text-small-font, sans-serif);
|
|
178
|
+
font-size: var(--text-small-size, 0.875rem);
|
|
179
|
+
letter-spacing: var(--text-small-letter-spacing, 0.0275em);
|
|
180
|
+
line-height: var(--text-small-line-height, 1.42857143em);
|
|
181
|
+
font-weight: var(--text-small-weight, normal);
|
|
182
|
+
text-decoration: var(--text-small-decoration, none);
|
|
183
|
+
text-transform: var(--text-small-transform, none);
|
|
184
|
+
--_cell-padding: var(--ix-grid-cell-padding, 14px 10px);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
vaadin-grid-cell-content > div {
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.row-controls {
|
|
193
|
+
border-top: solid 1px var(--clr-border-outline, #0922411f);
|
|
194
|
+
padding: 8px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.more-pagination {
|
|
198
|
+
align-items: center;
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: flex-end;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.pagination {
|
|
204
|
+
flex-grow: 1;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.row-limit {
|
|
208
|
+
display: flex;
|
|
209
|
+
padding: 8px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.remove-all-button {
|
|
213
|
+
margin-left: auto;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* launchpad variant */
|
|
217
|
+
.launchpad vaadin-grid {
|
|
218
|
+
--lumo-size-xl: auto;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.launchpad {
|
|
222
|
+
--ix-grid-cell-height: 44px;
|
|
223
|
+
--ix-grid-cell-padding: 14px 24px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.launchpad .grid-header {
|
|
227
|
+
padding: 0.5rem 18px 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.launchpad .header {
|
|
231
|
+
font-family: var(--text-caption-font, sans-serif);
|
|
232
|
+
font-size: var(--text-caption-size, 0.75rem);
|
|
233
|
+
letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);
|
|
234
|
+
line-height: var(--text-caption-line-height, 1.33333333em);
|
|
235
|
+
font-weight: var(--text-caption-weight, normal);
|
|
236
|
+
text-transform: var(--text-caption-transform, none);
|
|
237
|
+
text-decoration: var(--text-caption-decoration, none);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.launchpad .grid-header h2 {
|
|
241
|
+
font-family: var(--text-page-title-font, sans-serif);
|
|
242
|
+
font-size: var(--text-page-title-size, 2.125rem);
|
|
243
|
+
letter-spacing: var(--text-page-title-letter-spacing, 0.01029412em);
|
|
244
|
+
line-height: var(--text-page-title-line-height, 1.17647059em);
|
|
245
|
+
font-weight: var(--text-page-title-weight, bold);
|
|
246
|
+
text-decoration: var(--text-page-title-decoration, none);
|
|
247
|
+
text-transform: var(--text-page-title-transform, none);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
vaadin-grid-cell-content {
|
|
251
|
+
height: var(--ix-grid-cell-height, 52px);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@media only screen and (max-width: 840px) {
|
|
255
|
+
.grid-header {
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-direction: row;
|
|
258
|
+
padding: 1rem;
|
|
259
|
+
justify-content: space-between;
|
|
260
|
+
}
|
|
261
|
+
.grid-menu {
|
|
262
|
+
padding-left: 0;
|
|
263
|
+
margin-left: -4px;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@media only screen and (max-width: 600px) {
|
|
268
|
+
.grid-header {
|
|
269
|
+
display: flex;
|
|
270
|
+
align-items: flex-start;
|
|
271
|
+
flex-direction: column;
|
|
272
|
+
padding: 1rem;
|
|
273
|
+
gap: 12px;
|
|
274
|
+
}
|
|
275
|
+
.grid-container {
|
|
276
|
+
border-radius: 0;
|
|
277
|
+
box-shadow: none;
|
|
278
|
+
padding: 0;
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
.column-max-width-set {
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
text-overflow: ellipsis;
|
|
285
|
+
white-space: nowrap;
|
|
286
|
+
display: block;
|
|
287
|
+
}
|
|
288
|
+
`,x=i`
|
|
289
|
+
.dropdown-content {
|
|
290
|
+
position: absolute;
|
|
291
|
+
background-color: var(--clr-surface-container-lowest, #fff);
|
|
292
|
+
min-width: 160px;
|
|
293
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
294
|
+
z-index: 9;
|
|
295
|
+
-webkit-box-align: center;
|
|
296
|
+
align-items: center;
|
|
297
|
+
cursor: pointer;
|
|
298
|
+
vertical-align: middle;
|
|
299
|
+
-webkit-tap-highlight-color: transparent;
|
|
300
|
+
padding: 10px;
|
|
301
|
+
width: 247px;
|
|
302
|
+
left: -100px;
|
|
303
|
+
border-radius: 16px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.dropdown-content > div {
|
|
307
|
+
margin: 0px;
|
|
308
|
+
color: var(--clr-on-surface, #092241);
|
|
309
|
+
font-family: var(--text-small-font, sans-serif);
|
|
310
|
+
font-size: var(--text-small-size, 0.875rem);
|
|
311
|
+
letter-spacing: var(--text-small-letter-spacing, 0.0275em);
|
|
312
|
+
line-height: var(--text-small-line-height, 1.42857143em);
|
|
313
|
+
font-weight: var(--text-small-weight, normal);
|
|
314
|
+
text-decoration: var(--text-small-decoration, none);
|
|
315
|
+
text-transform: var(--text-small-transform, none);
|
|
316
|
+
display: block;
|
|
317
|
+
cursor: pointer;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.dropdown-content span:hover {
|
|
321
|
+
background-color: #f1f1f1;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.dropdown-content label {
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.dropdown-content label.dragOrigin {
|
|
330
|
+
background: #ff000017;
|
|
331
|
+
outline: 1px #ff9d9d dashed;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.dropdown-content label p {
|
|
335
|
+
width: 158px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.dropdown-content label .draggable {
|
|
339
|
+
font-size: 24px;
|
|
340
|
+
cursor: move; /* fallback if grab cursor is unsupported */
|
|
341
|
+
cursor: grab;
|
|
342
|
+
cursor: -moz-grab;
|
|
343
|
+
cursor: -webkit-grab;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.dropdown-content label .draggable path {
|
|
347
|
+
fill: var(--clr-primary, #1456e0);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.active {
|
|
351
|
+
position: absolute;
|
|
352
|
+
right: 8px;
|
|
353
|
+
top: 8px;
|
|
354
|
+
height: 8px;
|
|
355
|
+
width: 8px;
|
|
356
|
+
background-color: var(--clr-critical, #db0028);
|
|
357
|
+
border-radius: 50%;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
ix-switch {
|
|
361
|
+
padding: 0 0 0 6px;
|
|
362
|
+
display: flex;
|
|
363
|
+
width: 48px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.list {
|
|
367
|
+
position: relative;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
@media only screen and (max-width: 840px) {
|
|
371
|
+
.dropdown-content {
|
|
372
|
+
left: 0;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
`,b=[" ","Enter"],w=o`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
376
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM7 12C7 10.9 7.9 10 9 10C10.1 10 11 10.9 11 12C11 13.1 10.1 14 9 14C7.9 14 7 13.1 7 12ZM9 20C10.1 20 11 19.1 11 18C11 16.9 10.1 16 9 16C7.9 16 7 16.9 7 18C7 19.1 7.9 20 9 20ZM17 6C17 7.1 16.1 8 15 8C13.9 8 13 7.1 13 6C13 4.9 13.9 4 15 4C16.1 4 17 4.9 17 6ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM13 18C13 16.9 13.9 16 15 16C16.1 16 17 16.9 17 18C17 19.1 16.1 20 15 20C13.9 20 13 19.1 13 18Z" fill="#1456e0" />
|
|
377
|
+
</svg>`;let y=class extends r{constructor(){super(...arguments),this.columns=[],this.columnsLocalStorageKey=void 0,this.columnReorderingAllowed=!1,this.refreshDataOnColumnVisibilityChange=!0,this.isDropdownVisible=!1,this.disabledColumns=[],this.dragEvent={sourceEl:null,startId:-1,targetId:-1},this.outerInteraction=e=>{e.composedPath().includes(this)||(this.isDropdownVisible=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.outerInteraction),this.initializeLocalStorage()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.outerInteraction)}get preservedColumns(){let e=[];return this.columnsLocalStorageKey&&(e=JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]")),e}initializeLocalStorage(){this.preservedColumns.length>0&&(this.disabledColumns=this.preservedColumns.filter(e=>e.hidden&&this.columns.some(t=>t.name===e.name)).map(e=>e.name),this.columns.forEach((e,t)=>{this.disabledColumns.includes(e.name)&&(this.columns[t].hidden=!0)})),this.dispatchUpdate()}update(e){super.update(e),e.has("columnsLocalStorageKey")&&this.initializeLocalStorage()}toggleColumn(e){this.columns[e].hidden=!this.columns[e].hidden,this.disabledColumns=this.columns.filter(e=>e.hidden).map(e=>e.name),this.columnsLocalStorageKey&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify([...this.columns])),this.dispatchUpdate()}updateColumn(e,t){var i;const o=null===(i=e.target.shadowRoot)||void 0===i?void 0:i.querySelector("input");this.columns[t].hidden!==!(null==o?void 0:o.checked)&&this.dispatchEvent(new CustomEvent("columnVisibilityChange",{detail:{column:this.columns[t]},bubbles:!0,composed:!0})),this.columns[t].hidden=!(null==o?void 0:o.checked),this.disabledColumns=this.columns.filter(e=>e.hidden).map(e=>e.name),this.columnsLocalStorageKey&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify([...this.columns])),this.dispatchUpdate()}dispatchUpdate(e=this.columns){this.dispatchEvent(new CustomEvent("columnFilter",{detail:{columns:e},bubbles:!0,composed:!0}))}dragstart(e){if(this.columnReorderingAllowed){const t=e.target;this.dragEvent.sourceEl=t,t.style.opacity="0.3";const i=Number(t.getAttribute("data-id"));this.dragEvent.startId=i}}dragend(){var e;if(this.columnReorderingAllowed){if(this.dragEvent.startId!==this.dragEvent.targetId){const e=[...this.columns],t=e.splice(this.dragEvent.startId,1)[0];e.splice(this.dragEvent.targetId,0,t),this.dispatchEvent(new CustomEvent("reorderColumns",{detail:{reorderedColumns:e},bubbles:!0,composed:!0}))}null===(e=this.dragEvent.sourceEl)||void 0===e||e.style.removeProperty("opacity"),this.dragEvent={sourceEl:null,startId:-1,targetId:-1}}}dragenter(e){if(this.columnReorderingAllowed){const t=e.target;if(t.classList.contains("drag-target")){const e=Number(t.getAttribute("data-id"));this.dragEvent.targetId=e}}}handleDropdownToggle(e){if(e instanceof KeyboardEvent&&!b.includes(e.key))return;e.composedPath().includes(this.dropdown)||(this.isDropdownVisible=!this.isDropdownVisible)}render(){return n`<div class="grid-menu">
|
|
378
|
+
<span
|
|
379
|
+
@click=${this.handleDropdownToggle}
|
|
380
|
+
@keyDown=${this.handleDropdownToggle}
|
|
381
|
+
class="list list-dropdown"
|
|
382
|
+
>
|
|
383
|
+
<ix-icon-button appearance="default">
|
|
384
|
+
<svg
|
|
385
|
+
slot="default"
|
|
386
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
387
|
+
width="24"
|
|
388
|
+
height="24"
|
|
389
|
+
viewBox="0 0 24 24"
|
|
390
|
+
fill="none"
|
|
391
|
+
>
|
|
392
|
+
<path
|
|
393
|
+
fill-rule="evenodd"
|
|
394
|
+
clip-rule="evenodd"
|
|
395
|
+
d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"
|
|
396
|
+
fill="#1456E0"
|
|
397
|
+
/>
|
|
398
|
+
</svg>
|
|
399
|
+
</ix-icon-button>
|
|
400
|
+
${this.disabledColumns.length>0?n`<div class="active"></div>`:a}
|
|
401
|
+
${this.isDropdownVisible?n` <div
|
|
402
|
+
class="dropdown-content"
|
|
403
|
+
@dragover=${e=>e.preventDefault()}
|
|
404
|
+
@dragstart=${this.dragstart}
|
|
405
|
+
@dragend=${this.dragend}
|
|
406
|
+
@dragenter=${this.dragenter}
|
|
407
|
+
>
|
|
408
|
+
${f(this.columns.filter(e=>!1!==e.filterable),e=>e.name,(e,t)=>n`<div>
|
|
409
|
+
<label
|
|
410
|
+
class=${"ix-switch-label drag-target "+(this.dragEvent.startId===t?"dragOrigin":"")}
|
|
411
|
+
draggable=${this.columnReorderingAllowed}
|
|
412
|
+
data-id=${t}
|
|
413
|
+
>
|
|
414
|
+
<ix-switch
|
|
415
|
+
.selected=${!e.hidden}
|
|
416
|
+
@change=${e=>this.updateColumn(e,t)}
|
|
417
|
+
>
|
|
418
|
+
</ix-switch>
|
|
419
|
+
<p>${e.header}</p>
|
|
420
|
+
${this.columnReorderingAllowed?n`<div class="draggable">${w}</div>`:a}
|
|
421
|
+
</label>
|
|
422
|
+
</div>`)}
|
|
423
|
+
</div>`:a}
|
|
424
|
+
</span>
|
|
425
|
+
</div>`}};y.styles=[v,x],e([l(".dropdown-content")],y.prototype,"dropdown",void 0),e([d({type:Array})],y.prototype,"columns",void 0),e([d({type:String})],y.prototype,"columnsLocalStorageKey",void 0),e([d({type:Boolean})],y.prototype,"columnReorderingAllowed",void 0),e([d({type:Boolean})],y.prototype,"refreshDataOnColumnVisibilityChange",void 0),e([d({attribute:!1})],y.prototype,"requestGridUpdate",void 0),e([p()],y.prototype,"isDropdownVisible",void 0),e([p()],y.prototype,"disabledColumns",void 0),e([p()],y.prototype,"dragEvent",void 0),y=e([c("ix-grid-column-filter")],y);let C=class extends r{constructor(){super(...arguments),this.items=[],this.isDownloading=!1}toggleMenu(){this.downloadMenu.open=!this.downloadMenu.open}renderMenuItems(){var e;return 0===(null===(e=this.items)||void 0===e?void 0:e.length)?n` <ix-menu-item
|
|
426
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("download",{detail:"all",bubbles:!0,composed:!0}))}
|
|
427
|
+
>
|
|
428
|
+
<div slot="headline">Download All Records</div>
|
|
429
|
+
</ix-menu-item>
|
|
430
|
+
<ix-menu-item
|
|
431
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("download",{detail:"filter",bubbles:!0,composed:!0}))}
|
|
432
|
+
>
|
|
433
|
+
<div slot="headline">Download Current Filter</div>
|
|
434
|
+
</ix-menu-item>`:this.items.filter(e=>!e.hidden).map(e=>n` <ix-menu-item
|
|
435
|
+
.disabled=${e.disabled}
|
|
436
|
+
@click=${()=>e.onClick(e.name)}
|
|
437
|
+
>
|
|
438
|
+
<div slot="headline">${e.label}</div>
|
|
439
|
+
</ix-menu-item>`)}render(){return this.isDownloading?n`<ix-progress
|
|
440
|
+
.indeterminate=${!0}
|
|
441
|
+
.linear=${!1}
|
|
442
|
+
style="--md-circular-progress-size: 1.75REM;
|
|
443
|
+
text-align: center;"
|
|
444
|
+
></ix-progress>`:n` <div style="position: relative">
|
|
445
|
+
<ix-icon-button id="anchor" @click=${this.toggleMenu}>
|
|
446
|
+
<svg
|
|
447
|
+
slot="default"
|
|
448
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
449
|
+
width="24"
|
|
450
|
+
height="24"
|
|
451
|
+
viewBox="0 0 24 24"
|
|
452
|
+
fill="none"
|
|
453
|
+
>
|
|
454
|
+
<path
|
|
455
|
+
fill-rule="evenodd"
|
|
456
|
+
clip-rule="evenodd"
|
|
457
|
+
d="M15 9H19L12 16L5 9H9V3H15V9ZM5 20V18H19V20H5Z"
|
|
458
|
+
fill="#1456E0"
|
|
459
|
+
/>
|
|
460
|
+
</svg>
|
|
461
|
+
</ix-icon-button>
|
|
462
|
+
<ix-menu id="menu" anchor="anchor" has-overflow>
|
|
463
|
+
${this.renderMenuItems()}
|
|
464
|
+
</ix-menu>
|
|
465
|
+
</div>`}};C.styles=[v],e([l("#menu")],C.prototype,"downloadMenu",void 0),e([l("#anchor")],C.prototype,"downloadMenuAnchor",void 0),e([d({type:Array})],C.prototype,"items",void 0),e([d({type:Boolean})],C.prototype,"isDownloading",void 0),C=e([c("ix-grid-download-menu")],C);const S="active filter",$="Filters",F="Hide Filters",z="Show Filters",D="Rows per page",L="VIEW MORE",k="VIEW LESS",E="ADD",P="REMOVE ALL",V=i`
|
|
466
|
+
.slot-wrap {
|
|
467
|
+
display: flex;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.slot-wrap ix-icon {
|
|
471
|
+
--ix-icon-font-size: 24px;
|
|
472
|
+
color: var(--clr-primary, #1456e0);
|
|
473
|
+
margin-right: 5px;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.grid-menu ix-button .filter {
|
|
477
|
+
margin-top: 2px;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.filter-form {
|
|
481
|
+
white-space: nowrap;
|
|
482
|
+
padding: 9px;
|
|
483
|
+
color: var(--clr-on-surface-variant, #092241b3);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.filter-form-column {
|
|
487
|
+
display: inline-block;
|
|
488
|
+
vertical-align: middle;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.filter-remove span {
|
|
492
|
+
margin-right: 0px;
|
|
493
|
+
color: var(--clr-on-surface-variant, #092241b3);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.filter-dropdown-content {
|
|
497
|
+
position: absolute;
|
|
498
|
+
display: inline;
|
|
499
|
+
right: 0;
|
|
500
|
+
top: 78%;
|
|
501
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
502
|
+
z-index: 3;
|
|
503
|
+
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
504
|
+
border-radius: 12px;
|
|
505
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
|
|
506
|
+
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px, rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
|
|
507
|
+
background-color: #ffffff;
|
|
508
|
+
z-index: 10;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.filter-form input,
|
|
512
|
+
.filter-form select,
|
|
513
|
+
.filter-form option {
|
|
514
|
+
font-family: var(--text-default-font, sans-serif);
|
|
515
|
+
font-size: var(--text-default-size, 16px);
|
|
516
|
+
letter-spacing: var(--text-default-letter-spacing, 0.0275em);
|
|
517
|
+
line-height: var(--text-default-line-height, 1.75em);
|
|
518
|
+
font-weight: var(--text-default-weight, normal);
|
|
519
|
+
text-transform: var(--text-default-decoration, none);
|
|
520
|
+
text-decoration: var(--text-default-transform, none);
|
|
521
|
+
border-radius: 0px;
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
box-sizing: content-box;
|
|
524
|
+
background: none;
|
|
525
|
+
height: 1.4375em;
|
|
526
|
+
margin: 0px;
|
|
527
|
+
animation-name: mui-auto-fill-cancel;
|
|
528
|
+
animation-duration: 10ms;
|
|
529
|
+
border: none;
|
|
530
|
+
border-image: initial;
|
|
531
|
+
box-sizing: border-box;
|
|
532
|
+
cursor: text;
|
|
533
|
+
user-select: none;
|
|
534
|
+
color: currentcolor;
|
|
535
|
+
-webkit-tap-highlight-color: transparent;
|
|
536
|
+
display: block;
|
|
537
|
+
min-width: 0px;
|
|
538
|
+
width: 100%;
|
|
539
|
+
height: 25px;
|
|
540
|
+
border-bottom: 1px solid black;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.filter-form option {
|
|
544
|
+
-webkit-tap-highlight-color: #9ca6b2;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.filter-form input:hover,
|
|
548
|
+
.filter-form select:hover {
|
|
549
|
+
outline: none !important;
|
|
550
|
+
border-bottom: 2px solid black;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.filter-form input:focus,
|
|
554
|
+
.filter-form select:focus {
|
|
555
|
+
outline: none !important;
|
|
556
|
+
border-bottom: 2px solid #1456e0;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.filter-form select:focus {
|
|
560
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.form-group {
|
|
564
|
+
display: flex;
|
|
565
|
+
flex-direction: column;
|
|
566
|
+
align-items: baseline;
|
|
567
|
+
height: 54px;
|
|
568
|
+
justify-content: flex-end;
|
|
569
|
+
font-family: var(--text-default-font, sans-serif);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.form-group label {
|
|
573
|
+
font-family: var(--text-default-font, sans-serif);
|
|
574
|
+
font-size: var(--text-default-size, 16px);
|
|
575
|
+
letter-spacing: var(--text-default-letter-spacing, 0.0275em);
|
|
576
|
+
line-height: var(--text-default-line-height, 1.75em);
|
|
577
|
+
font-weight: var(--text-default-weight, normal);
|
|
578
|
+
text-transform: var(--text-default-decoration, none);
|
|
579
|
+
text-decoration: var(--text-default-transform, none);
|
|
580
|
+
padding: 0px;
|
|
581
|
+
color: #092241;
|
|
582
|
+
display: block;
|
|
583
|
+
transform-origin: left top;
|
|
584
|
+
white-space: nowrap;
|
|
585
|
+
overflow: hidden;
|
|
586
|
+
text-overflow: ellipsis;
|
|
587
|
+
max-width: 133%;
|
|
588
|
+
transform: translate(0px, -1.5px) scale(0.75);
|
|
589
|
+
transition: color 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,
|
|
590
|
+
transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,
|
|
591
|
+
max-width 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.filter-form-group label span {
|
|
595
|
+
font-family: var(--text-default-font, sans-serif);
|
|
596
|
+
font-size: var(--text-default-size, 16px);
|
|
597
|
+
letter-spacing: var(--text-default-letter-spacing, 0.0275em);
|
|
598
|
+
line-height: var(--text-default-line-height, 1.75em);
|
|
599
|
+
font-weight: var(--text-default-weight, normal);
|
|
600
|
+
text-transform: var(--text-default-decoration, none);
|
|
601
|
+
text-decoration: var(--text-default-transform, none);
|
|
602
|
+
padding: 0px;
|
|
603
|
+
color: #092241;
|
|
604
|
+
display: block;
|
|
605
|
+
transform-origin: left top;
|
|
606
|
+
white-space: nowrap;
|
|
607
|
+
overflow: hidden;
|
|
608
|
+
text-overflow: ellipsis;
|
|
609
|
+
max-width: 133%;
|
|
610
|
+
transform: translate(0px, -1.5px) scale(0.75);
|
|
611
|
+
transition: color 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,
|
|
612
|
+
transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,
|
|
613
|
+
max-width 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.filter-form-group label:focus-within span {
|
|
617
|
+
color: #1456e0;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.filter-form-group {
|
|
621
|
+
display: flex;
|
|
622
|
+
flex-direction: column;
|
|
623
|
+
align-items: baseline;
|
|
624
|
+
height: 54px;
|
|
625
|
+
justify-content: space-between;
|
|
626
|
+
font-family: var(--text-default-font, sans-serif);
|
|
627
|
+
white-space: wrap;
|
|
628
|
+
|
|
629
|
+
ix-date-next,
|
|
630
|
+
ix-date {
|
|
631
|
+
margin-top: 10px;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
option {
|
|
636
|
+
font-weight: normal;
|
|
637
|
+
display: block;
|
|
638
|
+
min-height: 1.2em;
|
|
639
|
+
padding: 0px 2px 1px;
|
|
640
|
+
white-space: nowrap;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.filter-footer {
|
|
644
|
+
padding: 9px;
|
|
645
|
+
display: flex;
|
|
646
|
+
justify-content: space-between;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.no-display {
|
|
650
|
+
display: none;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.filter-local-operator-empty {
|
|
654
|
+
width: 54px;
|
|
655
|
+
border: none;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.grid-menu span.filter-superscript {
|
|
659
|
+
position: absolute;
|
|
660
|
+
top: 6px;
|
|
661
|
+
left: 14px;
|
|
662
|
+
z-index: 1;
|
|
663
|
+
display: flex;
|
|
664
|
+
align-items: center;
|
|
665
|
+
justify-content: center;
|
|
666
|
+
font-family: var(--text-caption-font, sans-serif);
|
|
667
|
+
font-size: var(--text-caption-size, 0.75rem);
|
|
668
|
+
letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);
|
|
669
|
+
line-height: var(--text-caption-line-height, 1.33333333em);
|
|
670
|
+
font-weight: var(--text-caption-weight, normal);
|
|
671
|
+
text-transform: var(--text-caption-transform, none);
|
|
672
|
+
text-decoration: var(--text-caption-decoration, none);
|
|
673
|
+
padding: 0;
|
|
674
|
+
height: 16px;
|
|
675
|
+
width: 16px;
|
|
676
|
+
border-radius: 50%;
|
|
677
|
+
background-color: var(--clr-primary, #1456e0);
|
|
678
|
+
color: var(--clr-on-primary, #fff);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.filterlist {
|
|
682
|
+
width: 40px;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.filterColumnField {
|
|
686
|
+
width: var(--ix-grid-filter-column-width, 150px);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.filterValueField {
|
|
690
|
+
width: 190px;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.filterOperatorField {
|
|
694
|
+
width: 120px;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.form-group-operator-label {
|
|
698
|
+
width: 100%;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.filter-form .filterOperatorInput {
|
|
702
|
+
min-width: 96px;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
select:hover {
|
|
706
|
+
cursor: pointer;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
input:hover {
|
|
710
|
+
cursor: text;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.tooltip-container {
|
|
714
|
+
position: relative;
|
|
715
|
+
display: inline-block;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.tool-tip {
|
|
719
|
+
color: var(--clr-on-secondary, #fff);
|
|
720
|
+
overflow-wrap: break-word;
|
|
721
|
+
border-radius: 3px;
|
|
722
|
+
background-color: var(--clr-secondary, #071454);
|
|
723
|
+
padding: 5px 8px;
|
|
724
|
+
font-family: var(--text-caption-font, sans-serif);
|
|
725
|
+
font-size: var(--text-caption-size, 0.75rem);
|
|
726
|
+
letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);
|
|
727
|
+
line-height: var(--text-caption-line-height, 1.33333333em);
|
|
728
|
+
font-weight: var(--text-caption-weight, normal);
|
|
729
|
+
text-transform: var(--text-caption-transform, none);
|
|
730
|
+
text-decoration: var(--text-caption-decoration, none);
|
|
731
|
+
|
|
732
|
+
position: absolute;
|
|
733
|
+
top: 42px;
|
|
734
|
+
right: 0;
|
|
735
|
+
z-index: 3;
|
|
736
|
+
white-space: nowrap;
|
|
737
|
+
display: none;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
.filter-button:hover ~ .tool-tip {
|
|
741
|
+
display: block;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.tool-tip li {
|
|
745
|
+
margin-left: -21px;
|
|
746
|
+
overflow-wrap: break-word;
|
|
747
|
+
border-radius: 3px;
|
|
748
|
+
max-width: 250px;
|
|
749
|
+
min-width: 200px;
|
|
750
|
+
white-space: wrap;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
.tool-tip p {
|
|
754
|
+
margin: 0;
|
|
755
|
+
padding: 0;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
.grid-menu ix-button {
|
|
759
|
+
align-items: center;
|
|
760
|
+
display: flex;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
@media only screen and (max-width: 840px) {
|
|
764
|
+
.filter-dropdown-content {
|
|
765
|
+
right: inherit;
|
|
766
|
+
top: 0;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
@media only screen and (max-width: 600px) {
|
|
771
|
+
.grid-menu ix-button .filter {
|
|
772
|
+
display: none;
|
|
773
|
+
}
|
|
774
|
+
.grid-menu ix-button {
|
|
775
|
+
--md-text-button-leading-space: 6px;
|
|
776
|
+
--md-text-button-trailing-space: 0;
|
|
777
|
+
margin-left: 4px;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
`;let R=class extends r{constructor(){super(...arguments),this.columns=[],this.filterValueChangeDebounceTime=300,this.readParamsFromURL=!1,this.useNewDatePicker=!1,this.maxDate=m(new Date,"yyyy-MM-dd"),this.isDropdownVisible=!1,this.filters=[],this.filterableColumns=[],this.filterColumns=[],this.activeFilters=[],this.mapSelect=!1,this.fromDateErrorText="",this.oldValueLength=0,this.debouncedOnFilterValueChange=()=>{},this.closeOnOuterClick=e=>{e.composedPath().includes(this)||(this.isDropdownVisible=!1)},this.handlePopState=()=>{this.filters=this.parseFilterQueryString(),0===this.filters.length&&(this.isDropdownVisible=!1,this.addFilter()),this.updateActiveFilters()}}updateActiveFilters(){this.activeFilters=this.filters.filter(e=>e.value.length>0)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeOnOuterClick),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.closeOnOuterClick),window.removeEventListener("popstate",this.handlePopState)}firstUpdated(){this.filterableColumns=this.columns.filter(e=>e.filterable),this.filterColumns=this.filterableColumns.map(e=>e.name),this.readParamsFromURL&&(this.filters=this.parseFilterQueryString()),this.filters.length||this.addFilter(),this.updateActiveFilters(),this.dispatchUpdate(!1),this.debouncedOnFilterValueChange=(e,t)=>{clearTimeout(this.debounceEvent),this.debounceEvent=setTimeout(()=>this.onfilterValueChange.bind(this)(e,t),this.filterValueChangeDebounceTime)}}get filterNames(){return this.filters.map(e=>e.columnField)}get unselectedFilters(){return this.filterColumns.filter(e=>!this.filterNames.includes(e))}parseFilterQueryString(){const e=new URLSearchParams(window.location.search),t=[];return this.filterableColumns.forEach(i=>{var o;null===(o=i.filterOperators)||void 0===o||o.forEach(o=>{var r;const a=`${i.name}_${o}`;e.has(a)&&t.push({columnField:i.name,operatorValue:o,dataType:i.dataType,value:null!==(r=e.get(a))&&void 0!==r?r:""})})}),t}dispatchUpdate(e=!0){this.dispatchEvent(new CustomEvent("rowFilter",{detail:{filters:this.filters.filter(e=>e.value.length),resetPage:e},bubbles:!0,composed:!0}))}addFilter(){var e,t;const i=this.filterColumns.find(e=>!this.filterNames.includes(e))||"",o=(null===(e=this.filterableColumns.find(e=>e.name===i))||void 0===e?void 0:e.filterOperators)||["contains"],r=(null===(t=this.filterableColumns.find(e=>e.name===i))||void 0===t?void 0:t.dataType)||"string";this.filters=[...this.filters,{columnField:i,operatorValue:o[0],dataType:r,value:""}],this.updateActiveFilters()}clearFilters(){this.filters=[],this.addFilter(),this.dispatchUpdate()}removeFilter(e){this.filters=this.filters.filter((t,i)=>i!==e),this.dispatchUpdate(),0===this.filters.length&&(this.isDropdownVisible=!1,this.addFilter()),this.updateActiveFilters()}onfilterColumnChange(e,t){var i;const o=t.target.value,r=this.filterableColumns.find(e=>e.name===o);this.filters[e].columnField=o,this.filters[e].dataType=null==r?void 0:r.dataType,this.filters[e].operatorValue=(null===(i=null==r?void 0:r.filterOperators)||void 0===i?void 0:i[0])||"contains",this.filters=[...this.filters],this.dispatchUpdate()}onfilterOperatorChange(e,t){const i=t.target.value;this.filters[e].operatorValue=i,this.filters=[...this.filters],this.dispatchUpdate()}onDatefilterValueChange(e,t){this.filters[e].value=t,this.dispatchUpdate(),this.updateActiveFilters()}onfilterValueChange(e,t){const{value:i}=t;this.filters[e].value=i;const o=this.filters[e].value.length;this.filters[e].columnField.length>0&&(o>=3||o<this.oldValueLength)&&this.dispatchUpdate(),this.updateActiveFilters(),this.oldValueLength=o}formatCamelCaseToEnglish(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}renderToolTip(){return this.isDropdownVisible?F:this.activeFilters.length?n` <p>${this.activeFilters.length} ${S}</p>
|
|
781
|
+
<ul>
|
|
782
|
+
${this.activeFilters.map(e=>{var t,i;let o=e.value;if("dateTime"===e.dataType&&this.useNewDatePicker){const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("ix-date-next");o=g(o,e.format)}const r=this.filterableColumns.find(t=>t.name===e.columnField),a=null!==(i=null==r?void 0:r.header)&&void 0!==i?i:this.formatCamelCaseToEnglish(e.columnField);return n`<li>
|
|
783
|
+
${a} ${e.operatorValue} ${o}
|
|
784
|
+
</li>`})}
|
|
785
|
+
</ul>`:z}renderStringInput(e,t){return n`<label class="form-group-operator-label">
|
|
786
|
+
<span>Value</span>
|
|
787
|
+
<input
|
|
788
|
+
data-testid=${`filterValueInput-${t}`}
|
|
789
|
+
placeholder="Filter value"
|
|
790
|
+
@input=${e=>this.debouncedOnFilterValueChange(t,e.target)}
|
|
791
|
+
.value=${e.value}
|
|
792
|
+
/>
|
|
793
|
+
</label>`}renderDateInput(e,t){return this.useNewDatePicker?n`<ix-date-next
|
|
794
|
+
data-testid=${`filterValueInput-${t}`}
|
|
795
|
+
.value=${e.value}
|
|
796
|
+
max=${this.maxDate}
|
|
797
|
+
name="${e.columnField}-valueDate"
|
|
798
|
+
showCalendarOnMouseDown="true"
|
|
799
|
+
.errorText=${this.fromDateErrorText}
|
|
800
|
+
.onChanged=${e=>this.onDatefilterValueChange(t,e)}
|
|
801
|
+
>
|
|
802
|
+
</ix-date-next>`:n`<ix-date
|
|
803
|
+
data-testid=${`filterValueInput-${t}`}
|
|
804
|
+
.value=${e.value}
|
|
805
|
+
max=${this.maxDate}
|
|
806
|
+
name="${e.columnField}-valueDate"
|
|
807
|
+
.errorText=${this.fromDateErrorText}
|
|
808
|
+
.onChanged=${e=>this.onDatefilterValueChange(t,e)}
|
|
809
|
+
>
|
|
810
|
+
</ix-date>`}renderFilterInputControl(e,t){switch(e.dataType){case"string":case void 0:return this.renderStringInput(e,t);case"dateTime":return this.renderDateInput(e,t);default:return a}}renderFilterInput(e,t){var i,o;const r=[e.columnField,...this.unselectedFilters],s=this.filterableColumns.filter(e=>r.includes(e.name));return n`
|
|
811
|
+
<div class="filter-form">
|
|
812
|
+
<div class="filter-remove filter-form-column">
|
|
813
|
+
<div class="form-group">
|
|
814
|
+
<ix-icon-button
|
|
815
|
+
icon="close"
|
|
816
|
+
data-testid="clearFilterButton"
|
|
817
|
+
@click=${()=>this.removeFilter(t)}
|
|
818
|
+
@keyDown=${e=>{" "!==e.key&&"Enter"!==e.key||this.removeFilter(t)}}
|
|
819
|
+
></ix-icon-button>
|
|
820
|
+
</div>
|
|
821
|
+
</div>
|
|
822
|
+
${this.mapSelect?n`<div
|
|
823
|
+
class="filter-form-column filter-form-column-border filterColumnField"
|
|
824
|
+
>
|
|
825
|
+
<div class="form-group">
|
|
826
|
+
<label
|
|
827
|
+
class="form-group-column-label"
|
|
828
|
+
title="select: ${e.columnField}, options: ${s.map(t=>`value=${t.name}, selected=${t.name===e.columnField}, ${t.header}\n `)}"
|
|
829
|
+
>Columns</label
|
|
830
|
+
>
|
|
831
|
+
|
|
832
|
+
<select
|
|
833
|
+
@change=${e=>this.onfilterColumnChange(t,e)}
|
|
834
|
+
.value=${e.columnField}
|
|
835
|
+
data-v=${e.columnField}
|
|
836
|
+
>
|
|
837
|
+
${s.map(t=>n`
|
|
838
|
+
<option
|
|
839
|
+
value=${t.name}
|
|
840
|
+
?selected=${t.name===e.columnField}
|
|
841
|
+
>
|
|
842
|
+
${t.header}
|
|
843
|
+
</option>
|
|
844
|
+
`)}
|
|
845
|
+
</select>
|
|
846
|
+
</div>
|
|
847
|
+
</div>`:a}
|
|
848
|
+
|
|
849
|
+
<div
|
|
850
|
+
class="filter-form-column filter-form-column-border filterColumnField"
|
|
851
|
+
>
|
|
852
|
+
<div class="filter-form-group">
|
|
853
|
+
<label class="form-group-column-label"
|
|
854
|
+
><span>Columns</span>
|
|
855
|
+
<select
|
|
856
|
+
data-testid=${`filterColumnInput-${t}`}
|
|
857
|
+
@change=${e=>this.onfilterColumnChange(t,e)}
|
|
858
|
+
.value=${e.columnField}
|
|
859
|
+
data-v=${e.columnField}
|
|
860
|
+
>
|
|
861
|
+
${f(s,e=>e.name,t=>n`
|
|
862
|
+
<option
|
|
863
|
+
value=${t.name}
|
|
864
|
+
?selected=${t.name===e.columnField}
|
|
865
|
+
>
|
|
866
|
+
${t.header}
|
|
867
|
+
</option>
|
|
868
|
+
`)}
|
|
869
|
+
</select>
|
|
870
|
+
</label>
|
|
871
|
+
</div>
|
|
872
|
+
</div>
|
|
873
|
+
|
|
874
|
+
<div
|
|
875
|
+
class="filter-form-column filter-form-column-border filterOperatorField"
|
|
876
|
+
>
|
|
877
|
+
<div class="filter-form-group">
|
|
878
|
+
<label class="form-group-operator-label"
|
|
879
|
+
><span>Operator</span>
|
|
880
|
+
<select
|
|
881
|
+
data-testid=${`filterOperatorInput-${t}`}
|
|
882
|
+
class="filterOperatorInput"
|
|
883
|
+
@change=${e=>this.onfilterOperatorChange(t,e)}
|
|
884
|
+
.value=${e.operatorValue}
|
|
885
|
+
data-v=${e.operatorValue}
|
|
886
|
+
>
|
|
887
|
+
${f(null!==(o=null===(i=s.find(t=>t.name===e.columnField))||void 0===i?void 0:i.filterOperators)&&void 0!==o?o:["contains"],t=>n`
|
|
888
|
+
<option
|
|
889
|
+
value=${t}
|
|
890
|
+
?selected=${t===e.operatorValue}
|
|
891
|
+
>
|
|
892
|
+
${t}
|
|
893
|
+
</option>
|
|
894
|
+
`)}
|
|
895
|
+
</select>
|
|
896
|
+
</label>
|
|
897
|
+
</div>
|
|
898
|
+
</div>
|
|
899
|
+
<div
|
|
900
|
+
class="filter-form-column filter-form-column-border filterValueField"
|
|
901
|
+
>
|
|
902
|
+
<div class="filter-form-group">
|
|
903
|
+
${this.renderFilterInputControl(e,t)}
|
|
904
|
+
</div>
|
|
905
|
+
</div>
|
|
906
|
+
</div>
|
|
907
|
+
`}renderDropdown(){const e=this.filters.length>=this.filterColumns.length||this.activeFilters.length<this.filters.length;return n` <div class="filter-dropdown-content">
|
|
908
|
+
<div class="filter-body">
|
|
909
|
+
${this.filters.map((e,t)=>this.renderFilterInput(e,t))}
|
|
910
|
+
</div>
|
|
911
|
+
<div class="filter-footer">
|
|
912
|
+
<ix-button
|
|
913
|
+
data-testid="addFilterButton"
|
|
914
|
+
class="add-filter-button"
|
|
915
|
+
@click="${()=>this.addFilter()}"
|
|
916
|
+
?disabled=${e}
|
|
917
|
+
appearance="text"
|
|
918
|
+
>
|
|
919
|
+
<ix-icon slot="icon">add</ix-icon>
|
|
920
|
+
Add filter
|
|
921
|
+
</ix-button>
|
|
922
|
+
<ix-button
|
|
923
|
+
data-testid="clearAllFiltersButton"
|
|
924
|
+
@click="${()=>this.clearFilters()}"
|
|
925
|
+
?disabled=${0===this.activeFilters.length}
|
|
926
|
+
appearance="text"
|
|
927
|
+
>
|
|
928
|
+
Clear all
|
|
929
|
+
</ix-button>
|
|
930
|
+
</div>
|
|
931
|
+
</div>`}render(){return n` <div class="grid-menu">
|
|
932
|
+
<div class="filter-container tooltip-container">
|
|
933
|
+
${this.activeFilters.length>0?n`<span class="filter-superscript"
|
|
934
|
+
>${this.activeFilters.length}</span
|
|
935
|
+
>`:a}
|
|
936
|
+
<ix-button
|
|
937
|
+
data-testid="showFiltersButton"
|
|
938
|
+
appearance="text"
|
|
939
|
+
class="filter_list filter-button"
|
|
940
|
+
@click=${()=>{this.isDropdownVisible=!this.isDropdownVisible}}
|
|
941
|
+
@keyDown=${()=>{this.isDropdownVisible=!this.isDropdownVisible}}
|
|
942
|
+
>
|
|
943
|
+
<div class="slot-wrap">
|
|
944
|
+
<ix-icon appearance="default" class="filter-icon"
|
|
945
|
+
>filter_list</ix-icon
|
|
946
|
+
>
|
|
947
|
+
<span class="filter">${$}</span>
|
|
948
|
+
</div>
|
|
949
|
+
</ix-button>
|
|
950
|
+
<div class="tool-tip">${this.renderToolTip()}</div>
|
|
951
|
+
${this.isDropdownVisible?this.renderDropdown():a}
|
|
952
|
+
</div>
|
|
953
|
+
</div>`}};R.styles=[v,V],e([d({type:Array})],R.prototype,"columns",void 0),e([d({type:Number})],R.prototype,"filterValueChangeDebounceTime",void 0),e([d({type:Boolean})],R.prototype,"readParamsFromURL",void 0),e([d({type:Boolean})],R.prototype,"useNewDatePicker",void 0),e([d({type:String})],R.prototype,"maxDate",void 0),e([p()],R.prototype,"isDropdownVisible",void 0),e([p()],R.prototype,"filters",void 0),e([p()],R.prototype,"filterableColumns",void 0),e([p()],R.prototype,"filterColumns",void 0),e([p()],R.prototype,"activeFilters",void 0),e([p()],R.prototype,"mapSelect",void 0),e([p()],R.prototype,"fromDateErrorText",void 0),e([p()],R.prototype,"oldValueLength",void 0),R=e([c("ix-grid-row-filter")],R);const B=i`
|
|
954
|
+
:host {
|
|
955
|
+
--md-filled-select-text-field-input-text-size: var(
|
|
4
956
|
--ix-filled-select-text-field-input-text-size,
|
|
5
957
|
12px
|
|
6
|
-
)
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
[hidden] {
|
|
962
|
+
display: none !important;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.pagination {
|
|
966
|
+
display: flex;
|
|
967
|
+
align-items: center;
|
|
968
|
+
justify-content: end;
|
|
969
|
+
gap: 0;
|
|
970
|
+
font-family: var(--text-caption-font, sans-serif);
|
|
971
|
+
font-size: var(--text-caption-size, 0.75rem);
|
|
972
|
+
letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);
|
|
973
|
+
line-height: var(--text-caption-line-height, 1.33333333em);
|
|
974
|
+
font-weight: var(--text-caption-weight, normal);
|
|
975
|
+
text-transform: var(--text-caption-transform, none);
|
|
976
|
+
text-decoration: var(--text-caption-decoration, none);
|
|
977
|
+
margin: 1.25rem 0.5rem 1.25rem 1rem;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.pagination.simple {
|
|
981
|
+
margin: 0;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
.pagination > div {
|
|
985
|
+
display: flex;
|
|
986
|
+
align-items: center;
|
|
987
|
+
gap: 0.5rem;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
.pagination p {
|
|
991
|
+
margin: 0;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
.pagination-nav {
|
|
995
|
+
display: flex;
|
|
996
|
+
margin-left: 1.5rem;
|
|
997
|
+
height: 1.5rem;
|
|
998
|
+
gap: 0.5rem;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
.pagination-nav > ix-icon-button {
|
|
1002
|
+
margin-top: -0.5rem;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
.rows-per-page {
|
|
1006
|
+
color: var(--clr-on-surface, #092241);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
ix-select {
|
|
1010
|
+
--md-menu-container-color: var(--bg-surface-container-lowest, #fff);
|
|
1011
|
+
--md-filled-select-text-field-container-color: var(
|
|
7
1012
|
--bg-surface-container-lowest,
|
|
8
1013
|
#fff
|
|
9
|
-
)
|
|
1014
|
+
);
|
|
1015
|
+
--md-filled-select-text-field-active-indicator-height: 0px;
|
|
1016
|
+
--md-filled-select-text-field-hover-indicator-height: 0px;
|
|
1017
|
+
--md-filled-field-hover-active-indicator-height: 0px;
|
|
1018
|
+
--md-filled-field-focus-active-indicator-height: 0px;
|
|
1019
|
+
--md-filled-field-bottom-space: 4px;
|
|
1020
|
+
--md-filled-field-top-space: 4px;
|
|
1021
|
+
|
|
1022
|
+
--md-filled-select-text-field-focus-trailing-icon-color: var(
|
|
10
1023
|
--clr-primary,
|
|
11
1024
|
#1456e0
|
|
12
|
-
)
|
|
1025
|
+
);
|
|
1026
|
+
--md-filled-select-text-field-focus-active-indicator-color: var(
|
|
13
1027
|
--md-filled-select-text-field-focus-trailing-icon-color
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`,t.textContent=i.textContent,i.addEventListener("mouseenter",()=>{t.style.display="flex";var e=i.getBoundingClientRect();t.style.left=e.left+"px",t.style.top=e.bottom+window.scrollY+4+"px",document.body.appendChild(t)}),i.addEventListener("mouseleave",()=>{t.remove()})}})},this.renderHeader=()=>html`<div class="grid-header"><slot name="header"><div class="empty"></div></slot>${this.hideFilters?nothing:html`<div class="grid-menu"><slot name="filters"><div class="empty"></div></slot><ix-grid-column-filter .columns="${this.arrangedColumns}" columnsLocalStorageKey="${ifDefined(this.columnsLocalStorageKey)}" @columnFilter="${e=>this.handleOnColumnFilter(e)}" @reorderColumns="${this.reorderColumnsFromFilter}" .columnReorderingAllowed="${this.columnReorderingAllowed}" .refreshDataOnColumnVisibilityChange="${this.refreshDataOnColumnVisibilityChange}" .requestGridUpdate="${()=>this.requestUpdate()}"></ix-grid-column-filter>${this.showDownload?html`<ix-grid-download-menu .items="${this.downloadMenuItems}" .isDownloading="${this.isDownloading}"></ix-grid-download-menu>`:nothing}<ix-grid-row-filter .columns="${this.displayColumns}" .filterValueChangeDebounceTime="${this.filterValueChangeDebounceTime}" .readParamsFromURL="${this.readParamsFromURL}" .maxDate="${this.filterMaxDate}" @rowFilter="${e=>{this.filters=e.detail.filters,e.detail.resetPage&&(this.page=this.defaultPage),this.updatePage()}}"></ix-grid-row-filter></div>`}</div><div class="touch-edge"><slot name="under-header"></slot></div>`,this.renderRowControls=()=>!1===this.showAddButton&&!1===this.showRemoveAllButton&&!1===this.showViewMoreLessButton?nothing:html`<div class="row-controls row-limit">${this.renderAddNewButton()} ${this.renderViewMoreLessButton()} ${this.renderRemoveAllButton()}</div>`,this.renderPaginationControls=()=>html`<div class="row-controls pagination"><ix-pagination .page="${this.page}" .pageSize="${this.pageSize}" .pageSizes="${this.pageSizes}" .recordCount="${this.recordCount}" @updatePagination="${e=>{this.page=e.detail.page,this.pageSize=e.detail.pageSize,this.updatePage()}}"></ix-pagination></div>`}get isPersistable(){return!!this.localStorageID}get columnNames(){return this.columns.map(e=>e.name)}get columnsLocalStorageKey(){if(""===this.hashedTableState){var e=this.columns.map(({bodyRenderer:e,hidden:t,...i})=>i),i=JSON.stringify(e);let t=0;for(let e=0;e<i.length;e+=1)t=31*t+i.charCodeAt(e)>>>0;this.hashedTableState=t.toString(36)}return`ix-grid-${this.localStorageID}-${this.hashedTableState}-columns`}get arrangedColumns(){let e=[];return(e=0===(e=this.getColumnsToDisplayFromLocalStorage()).length?[...this.columns]:e).filter(e=>e).map(e=>({...e,width:e.width||void 0}))}connectedCallback(){var e;null!=(e=super.connectedCallback)&&e.call(this),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){var e;window.removeEventListener("popstate",this.handlePopState),null!=(e=super.disconnectedCallback)&&e.call(this)}updateSearchParamsFromUri(e=!1){var t,i,r,o,a;this.readParamsFromURL&&(t=new URL(window.location.href),t=new URLSearchParams(t.search),[i,r,o,a]=this.defaultFilterKeys,i=t.get(i),r=t.get(r),o=t.get(o),a=t.get(a),i&&r&&(this.sortedColumn=i,this.sortDirection=r),o&&(this.page=parseInt(o,10)||this.defaultPage),a&&(this.pageSize=parseInt(a,10)||this.defaultPageSize),e)&&this.rebuildFiltersFromUri(t)}rebuildFiltersFromUri(e){var t,i,r=[];for([t,i]of e.entries()){var o=this.defaultFilterKeys.includes(t),[a,l]=t.split("_");!o&&a&&l&&r.push({columnField:a,operatorValue:l,value:i})}this.filters=r}update(e){!this.initialised&&0<this.columns.length&&(this.displayColumns=[...this.columns],this.checkLocalStorageUpdate(),this.initialised=!0),super.update(e)}firstUpdated(){this.updateSearchParamsFromUri(),this.removeOldLocalStorageValues()}checkLocalStorageUpdate(){if(this.isPersistable){let i=JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]");if(0<i.length){let e=!1;i.length!==this.columns.length&&(e=!0);var t=this.columns.every(t=>i.some(e=>e.name===t.name))&&i.every(t=>this.columns.some(e=>e.name===t.name));(e=t?e:!0)&&this.setColumnsToLocalStorage(this.columns)}}}buildQueryFromFilters(){let t=new URLSearchParams;return this.filters.forEach(e=>{t.append(e.columnField+"_"+e.operatorValue,e.value)}),Object.fromEntries(t)}rebuildQueryFromMatchingQuerystringParams(){let i=new URLSearchParams;var e;return 0===this.preservedQueryParamKeys.length?{}:(e=new URL(window.location.href),new URLSearchParams(e.search).forEach((e,t)=>{this.preservedQueryParamKeys.includes(t)&&i.append(t,e)}),Object.fromEntries(i))}getColumnsToDisplayFromLocalStorage(){let e=[];var t;return e=this.isPersistable&&0<(t=JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]")).length?this.mapColumnsWithPersistedSettings(t):e}mapColumnsWithPersistedSettings(o){let i=new Map(o.map(e=>[e.name,e]));var e=this.columns.map(e=>{var t=i.get(e.name);return t?{...e,hidden:t.hidden,frozenToEnd:t.frozenToEnd,width:t.width||void 0}:{...e}});return e.sort((t,i)=>{var e=o.findIndex(e=>e.name===t.name),r=o.findIndex(e=>e.name===i.name);return-1===e&&-1===r?0:-1===e?1:-1===r?-1:e-r}),e}removeOldLocalStorageValues(){var t=this.findMatchingLocalStorageKeys(`ix-grid-${this.localStorageID}-`,"-columns",this.hashedTableState);for(let e=0;e<=t.length;e+=1)localStorage.removeItem(t[e])}findMatchingLocalStorageKeys(t,i,e){var r=[],o=t+e+i;for(let e=0;e<localStorage.length;e+=1){var a=localStorage.key(e);a&&a.startsWith(t)&&a.endsWith(i)&&a!==o&&r.push(a)}return r}async updatePage(e=!0){var t,i;this.dispatchChangeEvent(),this.addParamsToURL&&e&&(e={sort:this.sortedColumn,order:this.sortDirection,page:this.page.toString(),size:this.pageSize.toString(),...this.buildQueryFromFilters(),...this.rebuildQueryFromMatchingQuerystringParams()},t=new URL(window.location.href),e=new URLSearchParams(e),this.originalSearchParams||this.saveOriginalSearchParams(e),i=new URLSearchParams([...null!=(i=this.originalSearchParams)?i:[],...e]),t.search=i.toString(),window.history.pushState(null,"",t.toString()))}saveOriginalSearchParams(e){var t=new URL(window.location.href);let i=new URLSearchParams(t.search);this.filters.forEach(e=>{i.delete(e.columnField+"_"+e.operatorValue)}),e.forEach((e,t)=>{i.delete(t)}),this.originalSearchParams=i}handleSort(e=""){this.sortedColumn!==e?this.sortDirection="asc":this.sortDirection="asc"===this.sortDirection?"desc":"asc",this.sortedColumn=e,this.updatePage()}setColumnsToLocalStorage(e){this.isPersistable&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify(e))}async reorderColumnsFromTable(){var e=[...this.arrangedColumns],t=e.filter(e=>!0!==e.hidden),r=e.filter(e=>!0===e.hidden),e=e.filter(e=>!0===e.frozenToEnd);let o=[...t.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...r.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...e];t=Array.from((null==(t=null==(t=this.grid)?void 0:t.shadowRoot)?void 0:t.querySelectorAll("th"))||[]);if(t.length){let i=t.map((e,t)=>({id:t,flexPosition:Number(e.style.order)})).sort((e,t)=>e.flexPosition-t.flexPosition).map(e=>e.id);t=[];i.every((e,t)=>0===t||e>i[t-1])||(t=i.map(e=>o[e]),this.displayColumns=[...t.filter(e=>!0!==e.hidden&&!0!==(null==e?void 0:e.frozenToEnd)),...r.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...e],this.isColumnsReordering=!0,await this.updateComplete,this.isColumnsReordering=!1,this.setColumnsToLocalStorage(this.displayColumns))}}async reorderColumnsFromFilter(e){this.displayColumns=[...e.detail.reorderedColumns],this.setColumnsToLocalStorage([...this.displayColumns]),this.isColumnsReordering=!0,await this.updateComplete,this.isColumnsReordering=!1}handleOnColumnFilter(e){e.detail.columns.forEach((e,t)=>{this.displayColumns[t]&&(this.displayColumns[t].hidden=null==e?void 0:e.hidden)}),this.displayColumns=[...this.displayColumns],this.updatePage(!1)}cellPartNameGenerator(e,t){let i="";return t.item.disabled&&(i+=" ix-disabled-cell"),i}renderAddNewButton(){return this.showAddButton?html`<ix-button name="add-new-button" appearance="text" has-icon ?disabled="${this.disableAddButton}" @click="${()=>this.onAddButtonClick()}"><ix-icon slot="icon">add</ix-icon><span>${this.addButtonLabel}</span></ix-button>`:nothing}get showViewMoreLessButton(){return 0<this.rowLimit&&this.rows.length>this.rowLimit}renderViewMoreLessButton(){return this.showViewMoreLessButton?html`<ix-button appearance="text" @click="${()=>{this.isExpanded=!this.isExpanded}}" has-icon>${this.isExpanded?copy.viewLess:copy.viewMore} ${this.hideViewMoreLessButtonIcon?nothing:html`<ix-icon slot="icon">${this.isExpanded?"remove":"add"}</ix-icon>`}</ix-button>`:nothing}renderRemoveAllButton(){return this.showRemoveAllButton?html`<ix-button class="remove-all-button" name="remove-all-button" appearance="text" ?disabled="${this.disableRemoveAllButton}" @click="${()=>this.onRemoveAllButtonClick()}"><span>${this.removeAllButtonLabel}</span></ix-button>`:nothing}renderColumns(){let t=[...this.arrangedColumns];return 0<t.length?html`${t.map((r,e)=>!0===r.hidden?nothing:html`<vaadin-grid-column ${columnHeaderRenderer(()=>this.renderColumnHeader(r,t[e+1],e,t.length),this.sortDirection)} .renderer="${(e,t,i)=>this.columnRenderer(r,e,t,i)}" resizable width="${ifDefined(r.width)}" min-width="${ifDefined(r.minWidth)}" .responsive="${r.responsive}" ?hidden="${r.hidden}" ?frozen-to-end="${r.frozenToEnd}" path="${r.name}" ?auto-width="${r.autoWidth}" flex-grow="${ifDefined(r.flexGrow)}"></vaadin-grid-column>`)}`:html`<vaadin-grid-column></vaadin-grid-column>`}renderLoading(){return html`<div class="progress-container" style="display:${this.isLoading?"":"none"}"><ix-progress .indeterminate="${!0}"></ix-progress></div>`}renderGrid(){var e,t;return this.isColumnsReordering?nothing:(e=this.displayColumns.find(e=>!0!==e.hidden),t=0<this.rowLimit&&!this.isExpanded?this.rows.slice(0,this.rowLimit):this.rows,html`<vaadin-grid class="${this.hideColumnHeaders?"hide-column-headers":""}" .items="${e?t:[]}" all-rows-visible ?column-reordering-allowed="${this.columnReorderingAllowed}" theme="no-border" .cellPartNameGenerator="${this.cellPartNameGenerator}" @mouseup="${this.reorderColumnsFromTable}">${this.renderColumns()}<div slot="empty-state"><slot name="no-rows"></slot></div></vaadin-grid>`)}render(){return html`<div class="${`grid-container ${this.isColumnsReordering?"columns-reordering":""} `+this.variantClass}">${this.hideHeader?nothing:this.renderHeader()} ${this.renderLoading()} ${this.renderGrid()} ${this.renderRowControls()} ${0<this.rowLimit?nothing:this.renderPaginationControls()}<slot name="footer"></slot></div>`}}IxGrid.styles=[IxGridViewStyles],__decorate([query("vaadin-grid")],IxGrid.prototype,"grid",void 0),__decorate([property({type:Boolean,attribute:"column-reordering-allowed"})],IxGrid.prototype,"columnReorderingAllowed",void 0),__decorate([property({type:String})],IxGrid.prototype,"variantClass",void 0),__decorate([property({type:Array})],IxGrid.prototype,"columns",void 0),__decorate([property({type:Array})],IxGrid.prototype,"rows",void 0),__decorate([property({type:String})],IxGrid.prototype,"defaultEmptyText",void 0),__decorate([property({type:String})],IxGrid.prototype,"sortedColumn",void 0),__decorate([property({type:String})],IxGrid.prototype,"sortDirection",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"hideHeader",void 0),__decorate([property({type:Boolean,attribute:"hide-filters"})],IxGrid.prototype,"hideFilters",void 0),__decorate([property({type:Number})],IxGrid.prototype,"rowLimit",void 0),__decorate([property({type:Number})],IxGrid.prototype,"page",void 0),__decorate([property({type:Number})],IxGrid.prototype,"pageSize",void 0),__decorate([property({type:Array})],IxGrid.prototype,"pageSizes",void 0),__decorate([property({type:Number})],IxGrid.prototype,"recordCount",void 0),__decorate([property({type:String})],IxGrid.prototype,"localStorageID",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"showDownload",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"isDownloading",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"isLoading",void 0),__decorate([property({type:Array})],IxGrid.prototype,"downloadMenuItems",void 0),__decorate([property({type:Boolean,attribute:"add-params-to-url"})],IxGrid.prototype,"addParamsToURL",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"readParamsFromURL",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"refreshDataOnColumnVisibilityChange",void 0),__decorate([property({type:Number})],IxGrid.prototype,"filterValueChangeDebounceTime",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"hideColumnHeaders",void 0),__decorate([property({type:Array})],IxGrid.prototype,"preservedQueryParamKeys",void 0),__decorate([property({type:String})],IxGrid.prototype,"filterMaxDate",void 0),__decorate([property({type:String})],IxGrid.prototype,"hashedTableState",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"hideViewMoreLessButtonIcon",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"showAddButton",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"disableAddButton",void 0),__decorate([property({type:String})],IxGrid.prototype,"addButtonLabel",void 0),__decorate([property({type:Function})],IxGrid.prototype,"onAddButtonClick",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"showRemoveAllButton",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"disableRemoveAllButton",void 0),__decorate([property({type:String})],IxGrid.prototype,"removeAllButtonLabel",void 0),__decorate([property({type:Function})],IxGrid.prototype,"onRemoveAllButtonClick",void 0),__decorate([state()],IxGrid.prototype,"filters",void 0),__decorate([state()],IxGrid.prototype,"isColumnsReordering",void 0),__decorate([state()],IxGrid.prototype,"isExpanded",void 0),__decorate([state()],IxGrid.prototype,"displayColumns",void 0),window.customElements.define("ix-grid",IxGrid);
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
ix-select-option {
|
|
1032
|
+
--md-menu-item-selected-container-color: rgba(20, 86, 224, 0.1);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
@media only screen and (max-width: 600px) {
|
|
1036
|
+
.pagination {
|
|
1037
|
+
justify-content: space-between;
|
|
1038
|
+
}
|
|
1039
|
+
.pagination > div {
|
|
1040
|
+
gap: 0;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
`;let A=class extends r{constructor(){super(...arguments),this.recordCount=0,this.page=1,this.pageSize=10,this.pageSizes=[5,10,25,100],this.isSimple=!1}changePage(e){this.page+=e,this.updatePagination()}handlePageSizeSelection(e){const t=e.target,i=Number(t.value),o=(this.page-1)*this.pageSize+1,r=Math.ceil(o/i);this.updatePagination(r,i)}updatePagination(e=this.page,t=this.pageSize){this.dispatchEvent(new CustomEvent("updatePagination",{detail:{page:e,pageSize:t},bubbles:!0,composed:!0}))}render(){const e=this.page>1,t=this.recordCount>this.page*this.pageSize;return n` <div class="pagination ${this.isSimple?"simple":""}">
|
|
1044
|
+
<div ?hidden=${this.isSimple}>
|
|
1045
|
+
<p class="rows-per-page" data-testid="ix-pagination-rows-per-page">
|
|
1046
|
+
${D}:
|
|
1047
|
+
</p>
|
|
1048
|
+
<ix-select
|
|
1049
|
+
wide-menu
|
|
1050
|
+
menu-positioning="fixed"
|
|
1051
|
+
class="pagination__select-input"
|
|
1052
|
+
@request-selection=${this.handlePageSizeSelection}
|
|
1053
|
+
selected-index=${this.pageSizes.indexOf(this.pageSize)}
|
|
1054
|
+
filled
|
|
1055
|
+
>
|
|
1056
|
+
${this.pageSizes.map(e=>n`
|
|
1057
|
+
<ix-select-option
|
|
1058
|
+
class="select-option"
|
|
1059
|
+
value=${e}
|
|
1060
|
+
?selected=${e===this.pageSize}
|
|
1061
|
+
>
|
|
1062
|
+
<div slot="headline">${e}</div>
|
|
1063
|
+
</ix-select-option>
|
|
1064
|
+
`)}
|
|
1065
|
+
</ix-select>
|
|
1066
|
+
</div>
|
|
1067
|
+
<div>
|
|
1068
|
+
<p data-testid="ix-pagination-page-of-page">
|
|
1069
|
+
${this.recordCount>0?(this.page-1)*this.pageSize+1:0} -
|
|
1070
|
+
${this.page*this.pageSize>this.recordCount?n`${this.recordCount}`:n`${this.page*this.pageSize}`}
|
|
1071
|
+
of ${this.recordCount>0?this.recordCount:0}
|
|
1072
|
+
</p>
|
|
1073
|
+
<div class="pagination-nav">
|
|
1074
|
+
<ix-icon-button
|
|
1075
|
+
?disabled=${!e}
|
|
1076
|
+
@click=${()=>e&&this.changePage(-1)}
|
|
1077
|
+
icon="chevron_left"
|
|
1078
|
+
data-testid="ix-pagination-prev"
|
|
1079
|
+
>
|
|
1080
|
+
</ix-icon-button>
|
|
1081
|
+
<ix-icon-button
|
|
1082
|
+
?disabled=${!t}
|
|
1083
|
+
@click=${()=>t&&this.changePage(1)}
|
|
1084
|
+
icon="chevron_right"
|
|
1085
|
+
data-testid="ix-pagination-next"
|
|
1086
|
+
>
|
|
1087
|
+
</ix-icon-button>
|
|
1088
|
+
</div>
|
|
1089
|
+
</div>
|
|
1090
|
+
</div>`}};A.styles=[v,B],e([d({type:Number})],A.prototype,"recordCount",void 0),e([d({type:Number})],A.prototype,"page",void 0),e([d({type:Number})],A.prototype,"pageSize",void 0),e([d({type:Array})],A.prototype,"pageSizes",void 0),e([d({type:Boolean,attribute:"simple"})],A.prototype,"isSimple",void 0),A=e([c("ix-pagination")],A);class T extends r{constructor(){super(...arguments),this.defaultPageSize=10,this.defaultPage=1,this.originalSearchParams=void 0,this.columnReorderingAllowed=!1,this.variantClass="",this.hasSimplePagination=!1,this.theme="no-border",this.columns=[],this.rows=[],this.defaultEmptyText="No data to display",this.sortedColumn="",this.sortDirection="",this.hideHeader=!1,this.hideFilters=!1,this.rowLimit=0,this.page=this.defaultPage,this.pageSize=this.defaultPageSize,this.pageSizes=[5,10,25,100],this.recordCount=0,this.localStorageID=void 0,this.showDownload=!0,this.isDownloading=!1,this.isLoading=!1,this.downloadMenuItems=[],this.addParamsToURL=!0,this.readParamsFromURL=!1,this.refreshDataOnColumnVisibilityChange=!0,this.filterValueChangeDebounceTime=300,this.hideColumnHeaders=!1,this.preservedQueryParamKeys=[],this.filterMaxDate=m(new Date,"yyyy-MM-dd"),this.hashedTableState="",this.hideViewMoreLessButtonIcon=!0,this.showAddButton=!1,this.disableAddButton=!1,this.showViewMore=!1,this.addButtonLabel=E,this.showRemoveAllButton=!1,this.disableRemoveAllButton=!1,this.removeAllButtonLabel=P,this.sessionStorageKey=void 0,this.useNewDatePicker=!1,this.filters=[],this.isColumnsReordering=!1,this.isExpanded=!1,this.displayColumns=[],this.sessionStorageData=void 0,this.defaultFilterKeys=["sort","order","page","size"],this.initialised=!1,this.handlePopState=()=>{this.updateSearchParamsFromUri(!0),this.dispatchChangeEvent()},this.handleUnload=()=>{sessionStorage.removeItem("urlPageSizeRead")},this.dispatchChangeEvent=()=>{var e;const t=null!==(e=this.filters)&&void 0!==e?e:[],i=t.reduce((e,{columnField:t,value:i})=>({...e,[t]:i}),{});this.dispatchEvent(new CustomEvent("change",{detail:{columnName:this.sortedColumn,sortOrder:this.sortDirection,page:this.page,pageSize:this.pageSize,filters:i,filtersOperators:t.map(e=>({columnField:e.columnField,operator:e.operatorValue}))},bubbles:!0,composed:!0}))},this.renderColumnHeader=(e,t,i,o)=>{const r=h({header:!0,frozen:!!e.frozenToEnd,first:0===i,last:i===o-1,border:!(null==t?void 0:t.frozenToEnd)});return n`
|
|
1091
|
+
<div
|
|
1092
|
+
@click=${()=>e.sortable&&this.handleSort(e.name)}
|
|
1093
|
+
@keyDown=${()=>e.sortable&&this.handleSort(e.name)}
|
|
1094
|
+
class=${r}
|
|
1095
|
+
>
|
|
1096
|
+
<span class="header-label">${e.header}</span>
|
|
1097
|
+
${e.sortable?n`<ix-icon title="Sort" class="header-sort-icon"
|
|
1098
|
+
>${"desc"===this.sortDirection&&this.sortedColumn===e.name?"arrow_upward":"arrow_downward"}</ix-icon
|
|
1099
|
+
>`:a}
|
|
1100
|
+
</div>
|
|
1101
|
+
`},this.columnRenderer=(e,t,i,o)=>{s(a,t);const r=e.bodyRenderer(o.item,o,i);let l=r;const d=!!e.maxWidth,p="column-max-width-set";d&&(l=n`
|
|
1102
|
+
<div class="${p}" style="max-width: ${e.maxWidth}">
|
|
1103
|
+
${r}
|
|
1104
|
+
</div>
|
|
1105
|
+
`),s(l,t),d&&requestAnimationFrame(()=>{var e;const i=t.querySelector(`.${p}`);if(i&&i.scrollWidth>i.clientWidth&&!i.querySelector(".custom-tooltip")&&(null===(e=i.textContent)||void 0===e?void 0:e.trim())){const e=document.createElement("div");e.className="custom-tooltip",e.style.cssText="\n background-color: #092241;\n font-size: 0.75rem;\n color: white;\n text-align: left;\n padding: 0.313rem 0.5rem;\n border-radius: 0.188rem;\n max-height: 31.25rem;\n overflow: hidden;\n position: absolute;\n z-index: 1000;\n display: none;\n ",e.textContent=i.textContent,i.addEventListener("mouseenter",()=>{e.style.display="flex";const t=i.getBoundingClientRect();e.style.left=`${t.left}px`,e.style.top=`${t.bottom+window.scrollY+4}px`,document.body.appendChild(e)}),i.addEventListener("mouseleave",()=>{e.remove()})}})},this.renderHeader=()=>n`
|
|
1106
|
+
<div class="grid-header">
|
|
1107
|
+
<slot name="header"><div class="empty"></div></slot>
|
|
1108
|
+
${this.hideFilters?a:n`<div class="grid-menu">
|
|
1109
|
+
<slot name="filters"><div class="empty"></div></slot>
|
|
1110
|
+
<ix-grid-column-filter
|
|
1111
|
+
.columns=${this.arrangedColumns}
|
|
1112
|
+
columnsLocalStorageKey=${u(this.columnsLocalStorageKey)}
|
|
1113
|
+
@columnFilter=${e=>this.handleOnColumnFilter(e)}
|
|
1114
|
+
@reorderColumns=${this.reorderColumnsFromFilter}
|
|
1115
|
+
.columnReorderingAllowed=${this.columnReorderingAllowed}
|
|
1116
|
+
.refreshDataOnColumnVisibilityChange=${this.refreshDataOnColumnVisibilityChange}
|
|
1117
|
+
.requestGridUpdate=${()=>this.requestUpdate()}
|
|
1118
|
+
></ix-grid-column-filter>
|
|
1119
|
+
${this.showDownload?n`<ix-grid-download-menu
|
|
1120
|
+
.items=${this.downloadMenuItems}
|
|
1121
|
+
.isDownloading=${this.isDownloading}
|
|
1122
|
+
></ix-grid-download-menu>`:a}
|
|
1123
|
+
<ix-grid-row-filter
|
|
1124
|
+
.columns=${this.displayColumns}
|
|
1125
|
+
.filterValueChangeDebounceTime=${this.filterValueChangeDebounceTime}
|
|
1126
|
+
.readParamsFromURL=${this.readParamsFromURL}
|
|
1127
|
+
.maxDate=${this.filterMaxDate}
|
|
1128
|
+
.useNewDatePicker=${this.useNewDatePicker}
|
|
1129
|
+
@rowFilter=${e=>{var t;this.filters=null!==(t=e.detail.filters)&&void 0!==t?t:[],e.detail.resetPage&&(this.page=this.defaultPage),this.updatePage()}}
|
|
1130
|
+
></ix-grid-row-filter>
|
|
1131
|
+
</div>`}
|
|
1132
|
+
</div>
|
|
1133
|
+
<div class="touch-edge">
|
|
1134
|
+
<slot name="under-header"></slot>
|
|
1135
|
+
</div>
|
|
1136
|
+
`,this.renderRowControls=()=>!1===this.showAddButton&&!1===this.showRemoveAllButton&&!1===this.showViewMoreLessButton?a:n` <div class="row-controls row-limit">
|
|
1137
|
+
${this.renderAddNewButton()} ${this.renderViewMoreLessButton()}
|
|
1138
|
+
${this.renderRemoveAllButton()}
|
|
1139
|
+
</div>`,this.renderPaginationControls=()=>this.rowLimit>0?a:n`
|
|
1140
|
+
<ix-pagination
|
|
1141
|
+
?simple=${this.hasSimplePagination}
|
|
1142
|
+
class="pagination"
|
|
1143
|
+
.page=${this.page}
|
|
1144
|
+
.pageSize=${this.pageSize}
|
|
1145
|
+
.pageSizes=${this.pageSizes}
|
|
1146
|
+
.recordCount=${this.recordCount}
|
|
1147
|
+
@updatePagination=${e=>{this.page=e.detail.page,this.pageSize=e.detail.pageSize,this.updateSessionStorage({pageSize:this.pageSize}),this.updatePage()}}
|
|
1148
|
+
></ix-pagination>
|
|
1149
|
+
`}get isPersistable(){return!!this.localStorageID}get columnNames(){return this.columns.map(e=>e.name)}get columnsLocalStorageKey(){if(""===this.hashedTableState){const e=this.columns.map(({bodyRenderer:e,hidden:t,...i})=>i),t=JSON.stringify(e);let i=0;for(let e=0;e<t.length;e+=1)i=31*i+t.charCodeAt(e)>>>0;this.hashedTableState=i.toString(36)}return`ix-grid-${this.localStorageID}-${this.hashedTableState}-columns`}get arrangedColumns(){let e=[];return e=this.getColumnsToDisplayFromLocalStorage(),0===e.length&&(e=[...this.columns]),e.filter(e=>e).map(e=>({...e,width:e.width?e.width:void 0}))}connectedCallback(){var e;null===(e=super.connectedCallback)||void 0===e||e.call(this),window.addEventListener("popstate",this.handlePopState),window.addEventListener("beforeunload",this.handleUnload)}disconnectedCallback(){var e;window.removeEventListener("popstate",this.handlePopState),window.removeEventListener("beforeunload",this.handleUnload),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}updateSearchParamsFromUri(e=!1){if(0!==this.grid.getBoundingClientRect().width&&this.readParamsFromURL){const t=new URL(window.location.href),i=new URLSearchParams(t.search),[o,r,a,n]=this.defaultFilterKeys,s=i.get(o),l=i.get(r),d=i.get(a),p=i.get(n);s&&l&&(this.sortedColumn=s,this.sortDirection=l),d&&(this.page=parseInt(d,10)||this.defaultPage),p&&(!this.getSessionStorageData()||!sessionStorage.getItem("urlPageSizeRead")&&this.grid.getBoundingClientRect().width>0)&&(sessionStorage.setItem("urlPageSizeRead",(!0).toString()),this.pageSize=parseInt(p,10)||this.defaultPageSize,this.updateSessionStorage({pageSize:this.pageSize})),e&&this.rebuildFiltersFromUri(i)}}rebuildFiltersFromUri(e){const t=[];for(const[i,o]of e.entries()){const e=this.defaultFilterKeys.includes(i),[r,a]=i.split("_");!e&&r&&a&&t.push({columnField:r,operatorValue:a,value:o})}this.filters=t}update(e){if(!this.initialised&&this.columns.length>0&&(this.displayColumns=[...this.columns],this.checkLocalStorageUpdate(),this.initialised=!0),e.has("sessionStorageData")&&this.sessionStorageData){const e=this.sessionStorageData.pageSize||this.defaultPageSize;this.pageSize!==e&&(this.pageSize=e)}super.update(e)}firstUpdated(){this.updateSearchParamsFromUri(),this.removeOldLocalStorageValues(),this.sessionStorageData=this.getSessionStorageData()}getSessionStorageData(){if(this.sessionStorageKey){const e=sessionStorage.getItem(`grid-${this.sessionStorageKey}`);if(e)return JSON.parse(e)}}updateSessionStorage(e){const t=this.getSessionStorageData()||{};if(this.sessionStorageKey&&e){const i={...t,...e};sessionStorage.setItem(`grid-${this.sessionStorageKey}`,JSON.stringify(i)),this.sessionStorageData=i}}checkLocalStorageUpdate(){if(this.isPersistable){const e=JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]");if(e.length>0){let t=!1;e.length!==this.columns.length&&(t=!0);this.columns.every(t=>e.some(e=>e.name===t.name))&&e.every(e=>this.columns.some(t=>t.name===e.name))||(t=!0),t&&this.setColumnsToLocalStorage(this.columns)}}}buildQueryFromFilters(){const e=new URLSearchParams;return this.filters.forEach(t=>{e.append(`${t.columnField}_${t.operatorValue}`,t.value)}),Object.fromEntries(e)}rebuildQueryFromMatchingQuerystringParams(){const e=new URLSearchParams;if(0===this.preservedQueryParamKeys.length)return{};const t=new URL(window.location.href);return new URLSearchParams(t.search).forEach((t,i)=>{this.preservedQueryParamKeys.includes(i)&&e.append(i,t)}),Object.fromEntries(e)}getColumnsToDisplayFromLocalStorage(){let e=[];if(this.isPersistable){const t=JSON.parse(localStorage.getItem(this.columnsLocalStorageKey)||"[]");t.length>0&&(e=this.mapColumnsWithPersistedSettings(t))}return e}mapColumnsWithPersistedSettings(e){const t=new Map(e.map(e=>[e.name,e])),i=this.columns.map(e=>{const i=t.get(e.name);return i?{...e,hidden:i.hidden,frozenToEnd:i.frozenToEnd,width:i.width||void 0}:{...e}});return i.sort((t,i)=>{const o=e.findIndex(e=>e.name===t.name),r=e.findIndex(e=>e.name===i.name);return-1===o&&-1===r?0:-1===o?1:-1===r?-1:o-r}),i}removeOldLocalStorageValues(){const e=this.findMatchingLocalStorageKeys(`ix-grid-${this.localStorageID}-`,"-columns",this.hashedTableState);for(let t=0;t<=e.length;t+=1)localStorage.removeItem(e[t])}findMatchingLocalStorageKeys(e,t,i){const o=[],r=e+i+t;for(let i=0;i<localStorage.length;i+=1){const a=localStorage.key(i);a&&a.startsWith(e)&&a.endsWith(t)&&a!==r&&o.push(a)}return o}async updatePage(e=!0){var t;if(this.dispatchChangeEvent(),this.addParamsToURL&&e){const e={sort:this.sortedColumn,order:this.sortDirection,page:this.page.toString(),size:this.pageSize.toString(),...this.buildQueryFromFilters(),...this.rebuildQueryFromMatchingQuerystringParams()},i=new URL(window.location.href),o=new URLSearchParams(e);this.originalSearchParams||this.saveOriginalSearchParams(o);const r=new URLSearchParams([...null!==(t=this.originalSearchParams)&&void 0!==t?t:[],...o]);i.search=r.toString(),window.history.pushState(null,"",i.toString())}}saveOriginalSearchParams(e){const t=new URL(window.location.href),i=new URLSearchParams(t.search);this.filters.forEach(e=>{i.delete(`${e.columnField}_${e.operatorValue}`)}),e.forEach((e,t)=>{i.delete(t)}),this.originalSearchParams=i}handleSort(e=""){this.sortedColumn!==e?this.sortDirection="asc":this.sortDirection="asc"===this.sortDirection?"desc":"asc",this.sortedColumn=e,this.updatePage()}setColumnsToLocalStorage(e){this.isPersistable&&localStorage.setItem(this.columnsLocalStorageKey,JSON.stringify(e))}async reorderColumnsFromTable(){var e,t;const i=[...this.arrangedColumns],o=i.filter(e=>!0!==e.hidden),r=i.filter(e=>!0===e.hidden),a=i.filter(e=>!0===e.frozenToEnd),n=[...o.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...r.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...a],s=Array.from((null===(t=null===(e=this.grid)||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelectorAll("th"))||[]);if(s.length){const e=s.map((e,t)=>({id:t,flexPosition:Number(e.style.order)})).sort((e,t)=>e.flexPosition-t.flexPosition).map(e=>e.id);let t=[];e.every((t,i)=>0===i||t>e[i-1])||(t=e.map(e=>n[e]),this.displayColumns=[...t.filter(e=>!0!==e.hidden&&!0!==(null==e?void 0:e.frozenToEnd)),...r.filter(e=>!0!==(null==e?void 0:e.frozenToEnd)),...a],this.isColumnsReordering=!0,await this.updateComplete,this.isColumnsReordering=!1,this.setColumnsToLocalStorage(this.displayColumns))}}async reorderColumnsFromFilter(e){this.displayColumns=[...e.detail.reorderedColumns],this.setColumnsToLocalStorage([...this.displayColumns]),this.isColumnsReordering=!0,await this.updateComplete,this.isColumnsReordering=!1}handleOnColumnFilter(e){e.detail.columns.forEach((e,t)=>{this.displayColumns[t]&&(this.displayColumns[t].hidden=null==e?void 0:e.hidden)}),this.displayColumns=[...this.displayColumns],this.updatePage(!1)}cellPartNameGenerator(e,t){let i="";return t.item.disabled&&(i+=" ix-disabled-cell"),i}renderAddNewButton(){return this.showAddButton?n`<ix-button
|
|
1150
|
+
name="add-new-button"
|
|
1151
|
+
appearance="text"
|
|
1152
|
+
has-icon
|
|
1153
|
+
?disabled=${this.disableAddButton}
|
|
1154
|
+
@click=${()=>this.onAddButtonClick()}
|
|
1155
|
+
>
|
|
1156
|
+
<ix-icon slot="icon">add</ix-icon>
|
|
1157
|
+
<span>${this.addButtonLabel}</span>
|
|
1158
|
+
</ix-button>`:a}renderViewMore(){return this.showViewMore?n` <div class="view-more">
|
|
1159
|
+
<slot name="viewMore"></slot>
|
|
1160
|
+
</div>`:a}get showViewMoreLessButton(){return!this.showViewMore&&this.rowLimit>0&&this.rows.length>this.rowLimit}renderViewMoreLessButton(){return this.showViewMoreLessButton?n`
|
|
1161
|
+
<ix-button
|
|
1162
|
+
appearance="text"
|
|
1163
|
+
@click=${()=>{this.isExpanded=!this.isExpanded}}
|
|
1164
|
+
has-icon
|
|
1165
|
+
>
|
|
1166
|
+
${this.isExpanded?k:L}
|
|
1167
|
+
${this.hideViewMoreLessButtonIcon?a:n`<ix-icon slot="icon"
|
|
1168
|
+
>${this.isExpanded?"remove":"add"}</ix-icon
|
|
1169
|
+
>`}
|
|
1170
|
+
</ix-button>
|
|
1171
|
+
`:a}renderRemoveAllButton(){return this.showRemoveAllButton?n`<ix-button
|
|
1172
|
+
class="remove-all-button"
|
|
1173
|
+
name="remove-all-button"
|
|
1174
|
+
appearance="text"
|
|
1175
|
+
?disabled=${this.disableRemoveAllButton}
|
|
1176
|
+
@click=${()=>this.onRemoveAllButtonClick()}
|
|
1177
|
+
>
|
|
1178
|
+
<span>${this.removeAllButtonLabel}</span>
|
|
1179
|
+
</ix-button>`:a}renderColumns(){const e=[...this.arrangedColumns];return e.length>0?n`${e.map((i,o)=>!0===i.hidden?a:n`<vaadin-grid-column
|
|
1180
|
+
${t(()=>this.renderColumnHeader(i,e[o+1],o,e.length),this.sortDirection)}
|
|
1181
|
+
.renderer=${(e,t,o)=>this.columnRenderer(i,e,t,o)}
|
|
1182
|
+
resizable
|
|
1183
|
+
width=${u(i.width)}
|
|
1184
|
+
min-width=${u(i.minWidth)}
|
|
1185
|
+
.responsive=${i.responsive}
|
|
1186
|
+
?hidden=${i.hidden}
|
|
1187
|
+
?frozen-to-end=${i.frozenToEnd}
|
|
1188
|
+
path=${i.name}
|
|
1189
|
+
?auto-width=${i.autoWidth}
|
|
1190
|
+
flex-grow=${u(i.flexGrow)}
|
|
1191
|
+
></vaadin-grid-column>`)}`:n`<vaadin-grid-column></vaadin-grid-column>`}renderLoading(){return n` <div
|
|
1192
|
+
class="progress-container"
|
|
1193
|
+
style="display: ${this.isLoading?"":"none"}"
|
|
1194
|
+
>
|
|
1195
|
+
<ix-progress .indeterminate=${!0}></ix-progress>
|
|
1196
|
+
</div>`}renderGrid(){if(this.isColumnsReordering)return a;const e=this.displayColumns.find(e=>!0!==e.hidden),t=this.rowLimit>0&&!this.isExpanded?this.rows.slice(0,this.rowLimit):this.rows;return n`<vaadin-grid
|
|
1197
|
+
class=${this.hideColumnHeaders?"hide-column-headers":""}
|
|
1198
|
+
.items=${e?t:[]}
|
|
1199
|
+
all-rows-visible
|
|
1200
|
+
theme=${this.theme}
|
|
1201
|
+
.cellPartNameGenerator=${this.cellPartNameGenerator}
|
|
1202
|
+
@mouseup=${this.reorderColumnsFromTable}
|
|
1203
|
+
>
|
|
1204
|
+
${this.renderColumns()}
|
|
1205
|
+
<div slot="empty-state"><slot name="no-rows"></slot></div>
|
|
1206
|
+
</vaadin-grid>`}render(){return n`
|
|
1207
|
+
<div
|
|
1208
|
+
class=${`grid-container ${this.isColumnsReordering?"columns-reordering":""} ${this.variantClass}`}
|
|
1209
|
+
>
|
|
1210
|
+
${this.hideHeader?a:this.renderHeader()}
|
|
1211
|
+
${this.renderLoading()} ${this.renderGrid()} ${this.renderRowControls()}
|
|
1212
|
+
<div class="row-controls more-pagination">
|
|
1213
|
+
${this.renderViewMore()} ${this.renderPaginationControls()}
|
|
1214
|
+
</div>
|
|
1215
|
+
<slot name="footer"></slot>
|
|
1216
|
+
</div>
|
|
1217
|
+
`}}T.styles=[v],e([l("vaadin-grid")],T.prototype,"grid",void 0),e([d({type:Boolean,attribute:"column-reordering-allowed"})],T.prototype,"columnReorderingAllowed",void 0),e([d({type:String})],T.prototype,"variantClass",void 0),e([d({type:Boolean,attribute:"simple-pagination"})],T.prototype,"hasSimplePagination",void 0),e([d({type:String})],T.prototype,"theme",void 0),e([d({type:Array})],T.prototype,"columns",void 0),e([d({type:Array})],T.prototype,"rows",void 0),e([d({type:String})],T.prototype,"defaultEmptyText",void 0),e([d({type:String})],T.prototype,"sortedColumn",void 0),e([d({type:String})],T.prototype,"sortDirection",void 0),e([d({type:Boolean})],T.prototype,"hideHeader",void 0),e([d({type:Boolean,attribute:"hide-filters"})],T.prototype,"hideFilters",void 0),e([d({type:Number})],T.prototype,"rowLimit",void 0),e([d({type:Number})],T.prototype,"page",void 0),e([d({type:Number})],T.prototype,"pageSize",void 0),e([d({type:Array})],T.prototype,"pageSizes",void 0),e([d({type:Number})],T.prototype,"recordCount",void 0),e([d({type:String})],T.prototype,"localStorageID",void 0),e([d({type:Boolean})],T.prototype,"showDownload",void 0),e([d({type:Boolean})],T.prototype,"isDownloading",void 0),e([d({type:Boolean})],T.prototype,"isLoading",void 0),e([d({type:Array})],T.prototype,"downloadMenuItems",void 0),e([d({type:Boolean,attribute:"add-params-to-url"})],T.prototype,"addParamsToURL",void 0),e([d({type:Boolean})],T.prototype,"readParamsFromURL",void 0),e([d({type:Boolean})],T.prototype,"refreshDataOnColumnVisibilityChange",void 0),e([d({type:Number})],T.prototype,"filterValueChangeDebounceTime",void 0),e([d({type:Boolean})],T.prototype,"hideColumnHeaders",void 0),e([d({type:Array})],T.prototype,"preservedQueryParamKeys",void 0),e([d({type:String})],T.prototype,"filterMaxDate",void 0),e([d({type:String})],T.prototype,"hashedTableState",void 0),e([d({type:Boolean})],T.prototype,"hideViewMoreLessButtonIcon",void 0),e([d({type:Boolean})],T.prototype,"showAddButton",void 0),e([d({type:Boolean})],T.prototype,"disableAddButton",void 0),e([d({type:Boolean,attribute:"show-view-more"})],T.prototype,"showViewMore",void 0),e([d({type:String})],T.prototype,"addButtonLabel",void 0),e([d({type:Function})],T.prototype,"onAddButtonClick",void 0),e([d({type:Boolean})],T.prototype,"showRemoveAllButton",void 0),e([d({type:Boolean})],T.prototype,"disableRemoveAllButton",void 0),e([d({type:String})],T.prototype,"removeAllButtonLabel",void 0),e([d({type:Function})],T.prototype,"onRemoveAllButtonClick",void 0),e([d({type:String,attribute:"session-storage-key"})],T.prototype,"sessionStorageKey",void 0),e([d({type:Boolean})],T.prototype,"useNewDatePicker",void 0),e([p()],T.prototype,"filters",void 0),e([p()],T.prototype,"isColumnsReordering",void 0),e([p()],T.prototype,"isExpanded",void 0),e([p()],T.prototype,"displayColumns",void 0),e([p()],T.prototype,"sessionStorageData",void 0),window.customElements.define("ix-grid",T);
|