@digital-realty/ix-grid 1.3.9 → 1.3.11
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 +9 -0
- package/dist/IxGrid.js +61 -1
- package/dist/IxGrid.js.map +1 -1
- package/dist/components/IxGridRowFilter.d.ts +2 -0
- package/dist/components/IxGridRowFilter.js +37 -13
- package/dist/components/IxGridRowFilter.js.map +1 -1
- package/dist/components/grid-row-filter-styles.js +7 -1
- package/dist/components/grid-row-filter-styles.js.map +1 -1
- package/dist/ix-grid.min.js +4 -4
- package/dist/test/ix-grid-row-filter.test.js +21 -0
- package/dist/test/ix-grid-row-filter.test.js.map +1 -1
- package/dist/test/ix-grid.test.js +38 -1
- package/dist/test/ix-grid.test.js.map +1 -1
- package/package.json +4 -3
- package/src/IxGrid.ts +79 -1
- package/src/components/IxGridRowFilter.ts +36 -15
- package/src/components/grid-row-filter-styles.ts +7 -1
- package/src/test/ix-grid-row-filter.test.ts +30 -0
- package/src/test/ix-grid.test.ts +60 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IxGridRowFilter.js","sourceRoot":"","sources":["../../src/components/IxGridRowFilter.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,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,EAAE;0DAA4C;AAE3C;IAAR,KAAK,EAAE;gDAAgC;AAE/B;IAAR,KAAK,EAAE;0DAA0C;AAEzC;IAAR,KAAK,EAAE;sDAAsC;AAErC;IAAR,KAAK,EAAE;sDAAsC;AAErC;IAAR,KAAK,EAAE;kDAAoC;AAEnC;IAAR,KAAK,EAAE;0DAAiC;AAEhC;IAAR,KAAK,EAAE;uDAAoC;AA5BjC,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CAwd3B;SAxdY,eAAe","sourcesContent":["import '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport '@digital-realty/ix-select/ix-select.js';\nimport { formatDate } from 'date-fns/format.js';\nimport { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Column, DataType, FilterOperator } from '../IxGrid.js';\nimport { IxGridViewStyles } from '../grid-view-styles.js';\nimport { copy } from '../ix-grid-copy.js';\nimport { IxGridRowFilterStyles } from './grid-row-filter-styles.js';\n\nexport interface Filter {\n columnField: string;\n operatorValue: string;\n dataType?: DataType;\n value: string;\n}\n\n@customElement('ix-grid-row-filter')\nexport class IxGridRowFilter extends LitElement {\n static readonly styles = [IxGridViewStyles, IxGridRowFilterStyles];\n\n @property({ type: Array }) columns: Column[] = [];\n\n @property({ type: Number }) filterValueChangeDebounceTime: number = 300;\n\n @property({ type: Boolean }) readParamsFromURL = false;\n\n @property({ type: String }) maxDate: string = formatDate(\n new Date(),\n 'yyyy-MM-dd'\n );\n\n @state() private isDropdownVisible: boolean = false;\n\n @state() private filters: Filter[] = [];\n\n @state() private filterableColumns: Column[] = [];\n\n @state() private filterColumns: string[] = [];\n\n @state() private activeFilters: Filter[] = [];\n\n @state() private mapSelect: boolean = false;\n\n @state() private fromDateErrorText? = '';\n\n @state() private oldValueLength: number = 0;\n\n private debounceEvent: ReturnType<typeof setTimeout> | undefined;\n\n private debouncedOnFilterValueChange: (\n index: number,\n target: EventTarget\n ) => void = () => {};\n\n updateActiveFilters() {\n this.activeFilters = this.filters.filter(filter => filter.value.length > 0);\n }\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.closeOnOuterClick);\n window.addEventListener('popstate', this.handlePopState);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener('click', this.closeOnOuterClick);\n window.removeEventListener('popstate', this.handlePopState);\n }\n\n firstUpdated() {\n this.filterableColumns = this.columns.filter(column => column.filterable);\n this.filterColumns = this.filterableColumns.map(column => column.name);\n\n if (this.readParamsFromURL) {\n this.filters = this.parseFilterQueryString();\n }\n\n if (!this.filters.length) {\n this.addFilter();\n }\n\n this.updateActiveFilters();\n this.dispatchUpdate(false);\n this.debouncedOnFilterValueChange = (index, target) => {\n clearTimeout(this.debounceEvent);\n this.debounceEvent = setTimeout(\n () => this.onfilterValueChange.bind(this)(index, target),\n this.filterValueChangeDebounceTime\n );\n };\n }\n\n get filterNames() {\n return this.filters.map(filter => filter.columnField);\n }\n\n get unselectedFilters() {\n return this.filterColumns.filter(f => !this.filterNames.includes(f));\n }\n\n closeOnOuterClick = (e: Event) => {\n if (!e.composedPath().includes(this)) {\n this.isDropdownVisible = false;\n }\n };\n\n parseFilterQueryString(): Filter[] {\n const params = new URLSearchParams(window.location.search);\n const filters: Filter[] = [];\n\n this.filterableColumns.forEach(fc => {\n fc.filterOperators?.forEach(operator => {\n const key = `${fc.name}_${operator}`;\n\n if (params.has(key)) {\n filters.push({\n columnField: fc.name,\n operatorValue: operator,\n dataType: fc.dataType,\n value: params.get(key) ?? '',\n });\n }\n });\n });\n\n return filters;\n }\n\n dispatchUpdate(resetPage = true) {\n this.dispatchEvent(\n new CustomEvent('rowFilter', {\n detail: {\n filters: this.filters.filter(filter => filter.value.length),\n resetPage,\n },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n addFilter() {\n const nextFilter =\n this.filterColumns.find(filter => !this.filterNames.includes(filter)) ||\n '';\n const filterOperators = this.filterableColumns.find(\n c => c.name === nextFilter\n )?.filterOperators || ['contains'];\n\n const filterDataType =\n this.filterableColumns.find(c => c.name === nextFilter)?.dataType ||\n 'string';\n\n this.filters = [\n ...this.filters,\n {\n columnField: nextFilter,\n operatorValue: filterOperators[0],\n dataType: filterDataType,\n value: '',\n },\n ];\n this.updateActiveFilters();\n }\n\n clearFilters() {\n this.filters = [];\n this.addFilter();\n this.dispatchUpdate();\n }\n\n removeFilter(index: number) {\n this.filters = this.filters.filter((_, i) => i !== index);\n this.dispatchUpdate();\n if (this.filters.length === 0) {\n this.isDropdownVisible = false;\n this.addFilter();\n }\n\n this.updateActiveFilters();\n }\n\n private handlePopState = () => {\n this.filters = this.parseFilterQueryString();\n if (this.filters.length === 0) {\n this.isDropdownVisible = false;\n this.addFilter();\n }\n this.updateActiveFilters();\n };\n\n private onfilterColumnChange(index: number, e: Event) {\n const selectedValue = (e.target as HTMLSelectElement).value;\n const selectedColumn = this.filterableColumns.find(\n column => column.name === selectedValue\n );\n this.filters[index].columnField = selectedValue;\n this.filters[index].dataType = selectedColumn?.dataType;\n this.filters[index].operatorValue =\n selectedColumn?.filterOperators?.[0] || 'contains';\n\n this.filters = [...this.filters];\n\n this.dispatchUpdate();\n }\n\n private onfilterOperatorChange(index: number, e: Event) {\n const selectedValue = (e.target as HTMLSelectElement).value;\n this.filters[index].operatorValue = selectedValue;\n\n this.filters = [...this.filters];\n\n this.dispatchUpdate();\n }\n\n private onDatefilterValueChange(index: number, value: string) {\n this.filters[index].value = value;\n this.dispatchUpdate();\n this.updateActiveFilters();\n }\n\n private onfilterValueChange(index: number, target: EventTarget) {\n const { value } = target as HTMLInputElement;\n this.filters[index].value = value;\n\n const newValueLength = this.filters[index].value.length;\n if (\n this.filters[index].columnField.length > 0 &&\n (newValueLength >= 3 || newValueLength < this.oldValueLength)\n ) {\n this.dispatchUpdate();\n }\n this.updateActiveFilters();\n this.oldValueLength = newValueLength;\n }\n\n formatCamelCaseToEnglish(text: string) {\n const spaced = text.replace(/([A-Z])/g, ' $1').toLowerCase();\n const english = spaced.charAt(0).toUpperCase() + spaced.slice(1);\n return english;\n }\n\n renderToolTip() {\n if (this.isDropdownVisible) {\n return copy.hideFilters;\n }\n if (!this.activeFilters.length) {\n return copy.showFilters;\n }\n return html` <p>${this.activeFilters.length} ${copy.activeFilter}</p>\n <ul>\n ${this.activeFilters.map(\n filter => html`<li>\n ${this.formatCamelCaseToEnglish(filter.columnField)}\n ${filter.operatorValue} ${filter.value}\n </li>`\n )}\n </ul>`;\n }\n\n private renderStringInput(value: any, index: number) {\n return html`<label class=\"form-group-operator-label\">\n <span>Value</span>\n <input\n data-testid=${`filterValueInput-${index}`}\n placeholder=\"Filter value\"\n @input=${(e: Event) =>\n this.debouncedOnFilterValueChange(index, e.target!)}\n .value=${value.value}\n />\n </label>`;\n }\n\n private renderDateInput(value: any, index: number) {\n return html` <ix-date\n data-testid=${`filterValueInput-${index}`}\n .value=${value.value}\n max=${this.maxDate}\n name=\"${value.columnField}-valueDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${e => this.onDatefilterValueChange(index, e)}\n >\n </ix-date>`;\n }\n\n private renderFilterInputControl(value: any, index: number) {\n switch (value.dataType) {\n case 'string':\n case undefined:\n return this.renderStringInput(value, index);\n case 'dateTime':\n return this.renderDateInput(value, index);\n default:\n return nothing;\n }\n }\n\n renderFilterInput(value: Filter, index: number) {\n const options = [value.columnField, ...this.unselectedFilters];\n const filterOptions = this.filterableColumns.filter(column =>\n options.includes(column.name)\n );\n return html`\n <div class=\"filter-form\">\n <div class=\"filter-remove filter-form-column\">\n <div class=\"form-group\">\n <ix-icon-button\n icon=\"close\"\n data-testid=\"clearFilterButton\"\n @click=${() => this.removeFilter(index)}\n @keyDown=${(e: KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n this.removeFilter(index);\n }\n }}\n ></ix-icon-button>\n </div>\n </div>\n ${this.mapSelect\n ? html`<div\n class=\"filter-form-column filter-form-column-border filterColumnField\"\n >\n <div class=\"form-group\">\n <label\n class=\"form-group-column-label\"\n title=\"select: ${value.columnField}, options: ${filterOptions.map(\n column => `value=${column.name}, selected=${\n column.name === value.columnField\n }, ${column.header}\n `\n )}\"\n >Columns</label\n >\n\n <select\n @change=${(e: Event) => this.onfilterColumnChange(index, e)}\n .value=${value.columnField}\n data-v=${value.columnField}\n >\n ${filterOptions.map(\n column => html`\n <option\n value=${column.name}\n ?selected=${column.name === value.columnField}\n >\n ${column.header}\n </option>\n `\n )}\n </select>\n </div>\n </div>`\n : nothing}\n\n <div\n class=\"filter-form-column filter-form-column-border filterColumnField\"\n >\n <div class=\"filter-form-group\">\n <label class=\"form-group-column-label\"\n ><span>Columns</span>\n <select\n data-testid=${`filterColumnInput-${index}`}\n @change=${(e: Event) => this.onfilterColumnChange(index, e)}\n .value=${value.columnField}\n data-v=${value.columnField}\n >\n ${repeat(\n filterOptions,\n (column: Column) => column.name,\n (column: Column) => html`\n <option\n value=${column.name}\n ?selected=${column.name === value.columnField}\n >\n ${column.header}\n </option>\n `\n )}\n </select>\n </label>\n </div>\n </div>\n\n <div\n class=\"filter-form-column filter-form-column-border filterOperatorField\"\n >\n <div class=\"filter-form-group\">\n <label class=\"form-group-operator-label\"\n ><span>Operator</span>\n <select\n data-testid=${`filterOperatorInput-${index}`}\n class=\"filterOperatorInput\"\n @change=${(e: Event) => this.onfilterOperatorChange(index, e)}\n .value=${value.operatorValue}\n data-v=${value.operatorValue}\n >\n ${repeat(\n filterOptions.find(\n column => column.name === value.columnField\n )?.filterOperators ?? ['contains'],\n (filter: FilterOperator) => html`\n <option\n value=${filter}\n ?selected=${filter === value.operatorValue}\n >\n ${filter}\n </option>\n `\n )}\n </select>\n </label>\n </div>\n </div>\n <div\n class=\"filter-form-column filter-form-column-border filterValueField\"\n >\n <div class=\"filter-form-group\">\n ${this.renderFilterInputControl(value, index)}\n </div>\n </div>\n </div>\n `;\n }\n\n renderDropdown() {\n const disableAddButton =\n this.filters.length >= this.filterColumns.length ||\n this.activeFilters.length < this.filters.length;\n return html` <div class=\"filter-dropdown-content\">\n <div class=\"filter-body\">\n ${this.filters.map((filter, index) =>\n this.renderFilterInput(filter, index)\n )}\n </div>\n <div class=\"filter-footer\">\n <ix-button\n data-testid=\"addFilterButton\"\n class=\"add-filter-button\"\n @click=\"${() => this.addFilter()}\"\n ?disabled=${disableAddButton}\n appearance=\"text\"\n >\n <ix-icon slot=\"icon\">add</ix-icon>\n Add filter\n </ix-button>\n <ix-button\n data-testid=\"clearAllFiltersButton\"\n @click=\"${() => this.clearFilters()}\"\n ?disabled=${this.activeFilters.length === 0}\n appearance=\"text\"\n >\n Clear all\n </ix-button>\n </div>\n </div>`;\n }\n\n render() {\n return html` <div class=\"grid-menu\">\n <div class=\"filter-container tooltip-container\">\n ${this.activeFilters.length > 0\n ? html`<span class=\"filter-superscript\"\n >${this.activeFilters.length}</span\n >`\n : nothing}\n <ix-button\n data-testid=\"showFiltersButton\"\n appearance=\"text\"\n class=\"filter_list filter-button\"\n @click=${() => {\n this.isDropdownVisible = !this.isDropdownVisible;\n }}\n @keyDown=${() => {\n this.isDropdownVisible = !this.isDropdownVisible;\n }}\n >\n <div class=\"slot-wrap\">\n <ix-icon appearance=\"default\" class=\"filter-icon\"\n >filter_list</ix-icon\n >\n <span class=\"filter\">${copy.filters}</span>\n </div>\n </ix-button>\n <div class=\"tool-tip\">${this.renderToolTip()}</div>\n ${this.isDropdownVisible ? this.renderDropdown() : nothing}\n </div>\n </div>`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IxGridRowFilter.js","sourceRoot":"","sources":["../../src/components/IxGridRowFilter.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,8CAA8C,CAAC;AACtD,OAAO,kDAAkD,CAAC;AAC1D,OA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AsC;AAErC;IAAR,KAAK,EAAE;kDAAoC;AAEnC;IAAR,KAAK,EAAE;0DAAiC;AAEhC;IAAR,KAAK,EAAE;uDAAoC;AA9BjC,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CA4e3B;SA5eY,eAAe","sourcesContent":["import '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-date-next/ix-date-next.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport '@digital-realty/ix-select/ix-select.js';\nimport { format, formatDate } from 'date-fns/format.js';\nimport { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Column, DataType, FilterOperator } from '../IxGrid.js';\nimport { IxGridViewStyles } from '../grid-view-styles.js';\nimport { copy } from '../ix-grid-copy.js';\nimport { IxGridRowFilterStyles } from './grid-row-filter-styles.js';\n\nexport interface Filter {\n columnField: string;\n operatorValue: string;\n dataType?: DataType;\n value: string;\n}\n\n@customElement('ix-grid-row-filter')\nexport class IxGridRowFilter extends LitElement {\n static readonly styles = [IxGridViewStyles, IxGridRowFilterStyles];\n\n @property({ type: Array }) columns: Column[] = [];\n\n @property({ type: Number }) filterValueChangeDebounceTime: number = 300;\n\n @property({ type: Boolean }) readParamsFromURL = false;\n\n @property({ type: Boolean }) useNewDatePicker = false;\n\n @property({ type: String }) maxDate: string = formatDate(\n new Date(),\n 'yyyy-MM-dd'\n );\n\n @state() private isDropdownVisible: boolean = false;\n\n @state() private filters: Filter[] = [];\n\n @state() private filterableColumns: Column[] = [];\n\n @state() private filterColumns: string[] = [];\n\n @state() private activeFilters: Filter[] = [];\n\n @state() private mapSelect: boolean = false;\n\n @state() private fromDateErrorText? = '';\n\n @state() private oldValueLength: number = 0;\n\n private debounceEvent: ReturnType<typeof setTimeout> | undefined;\n\n private debouncedOnFilterValueChange: (\n index: number,\n target: EventTarget\n ) => void = () => {};\n\n updateActiveFilters() {\n this.activeFilters = this.filters.filter(filter => filter.value.length > 0);\n }\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.closeOnOuterClick);\n window.addEventListener('popstate', this.handlePopState);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener('click', this.closeOnOuterClick);\n window.removeEventListener('popstate', this.handlePopState);\n }\n\n firstUpdated() {\n this.filterableColumns = this.columns.filter(column => column.filterable);\n this.filterColumns = this.filterableColumns.map(column => column.name);\n\n if (this.readParamsFromURL) {\n this.filters = this.parseFilterQueryString();\n }\n\n if (!this.filters.length) {\n this.addFilter();\n }\n\n this.updateActiveFilters();\n this.dispatchUpdate(false);\n this.debouncedOnFilterValueChange = (index, target) => {\n clearTimeout(this.debounceEvent);\n this.debounceEvent = setTimeout(\n () => this.onfilterValueChange.bind(this)(index, target),\n this.filterValueChangeDebounceTime\n );\n };\n }\n\n get filterNames() {\n return this.filters.map(filter => filter.columnField);\n }\n\n get unselectedFilters() {\n return this.filterColumns.filter(f => !this.filterNames.includes(f));\n }\n\n closeOnOuterClick = (e: Event) => {\n if (!e.composedPath().includes(this)) {\n this.isDropdownVisible = false;\n }\n };\n\n parseFilterQueryString(): Filter[] {\n const params = new URLSearchParams(window.location.search);\n const filters: Filter[] = [];\n\n this.filterableColumns.forEach(fc => {\n fc.filterOperators?.forEach(operator => {\n const key = `${fc.name}_${operator}`;\n\n if (params.has(key)) {\n filters.push({\n columnField: fc.name,\n operatorValue: operator,\n dataType: fc.dataType,\n value: params.get(key) ?? '',\n });\n }\n });\n });\n\n return filters;\n }\n\n dispatchUpdate(resetPage = true) {\n this.dispatchEvent(\n new CustomEvent('rowFilter', {\n detail: {\n filters: this.filters.filter(filter => filter.value.length),\n resetPage,\n },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n addFilter() {\n const nextFilter =\n this.filterColumns.find(filter => !this.filterNames.includes(filter)) ||\n '';\n const filterOperators = this.filterableColumns.find(\n c => c.name === nextFilter\n )?.filterOperators || ['contains'];\n\n const filterDataType =\n this.filterableColumns.find(c => c.name === nextFilter)?.dataType ||\n 'string';\n\n this.filters = [\n ...this.filters,\n {\n columnField: nextFilter,\n operatorValue: filterOperators[0],\n dataType: filterDataType,\n value: '',\n },\n ];\n this.updateActiveFilters();\n }\n\n clearFilters() {\n this.filters = [];\n this.addFilter();\n this.dispatchUpdate();\n }\n\n removeFilter(index: number) {\n this.filters = this.filters.filter((_, i) => i !== index);\n this.dispatchUpdate();\n if (this.filters.length === 0) {\n this.isDropdownVisible = false;\n this.addFilter();\n }\n\n this.updateActiveFilters();\n }\n\n private handlePopState = () => {\n this.filters = this.parseFilterQueryString();\n if (this.filters.length === 0) {\n this.isDropdownVisible = false;\n this.addFilter();\n }\n this.updateActiveFilters();\n };\n\n private onfilterColumnChange(index: number, e: Event) {\n const selectedValue = (e.target as HTMLSelectElement).value;\n const selectedColumn = this.filterableColumns.find(\n column => column.name === selectedValue\n );\n this.filters[index].columnField = selectedValue;\n this.filters[index].dataType = selectedColumn?.dataType;\n this.filters[index].operatorValue =\n selectedColumn?.filterOperators?.[0] || 'contains';\n\n this.filters = [...this.filters];\n\n this.dispatchUpdate();\n }\n\n private onfilterOperatorChange(index: number, e: Event) {\n const selectedValue = (e.target as HTMLSelectElement).value;\n this.filters[index].operatorValue = selectedValue;\n\n this.filters = [...this.filters];\n\n this.dispatchUpdate();\n }\n\n private onDatefilterValueChange(index: number, value: string) {\n this.filters[index].value = value;\n this.dispatchUpdate();\n this.updateActiveFilters();\n }\n\n private onfilterValueChange(index: number, target: EventTarget) {\n const { value } = target as HTMLInputElement;\n this.filters[index].value = value;\n\n const newValueLength = this.filters[index].value.length;\n if (\n this.filters[index].columnField.length > 0 &&\n (newValueLength >= 3 || newValueLength < this.oldValueLength)\n ) {\n this.dispatchUpdate();\n }\n this.updateActiveFilters();\n this.oldValueLength = newValueLength;\n }\n\n formatCamelCaseToEnglish(text: string) {\n const spaced = text.replace(/([A-Z])/g, ' $1').toLowerCase();\n const english = spaced.charAt(0).toUpperCase() + spaced.slice(1);\n return english;\n }\n\n renderToolTip() {\n if (this.isDropdownVisible) {\n return copy.hideFilters;\n }\n if (!this.activeFilters.length) {\n return copy.showFilters;\n }\n return html` <p>${this.activeFilters.length} ${copy.activeFilter}</p>\n <ul>\n ${this.activeFilters.map(filter => {\n let displayValue = filter.value;\n\n if (filter.dataType === 'dateTime' && this.useNewDatePicker) {\n const date = this.shadowRoot?.querySelector(`ix-date-next`) as any;\n displayValue = format(displayValue, date.format);\n }\n\n return html`<li>\n ${this.formatCamelCaseToEnglish(filter.columnField)}\n ${filter.operatorValue} ${displayValue}\n </li>`;\n })}\n </ul>`;\n }\n\n private renderStringInput(value: any, index: number) {\n return html`<label class=\"form-group-operator-label\">\n <span>Value</span>\n <input\n data-testid=${`filterValueInput-${index}`}\n placeholder=\"Filter value\"\n @input=${(e: Event) =>\n this.debouncedOnFilterValueChange(index, e.target!)}\n .value=${value.value}\n />\n </label>`;\n }\n\n private renderDateInput(value: any, index: number) {\n return this.useNewDatePicker\n ? html`<ix-date-next\n data-testid=${`filterValueInput-${index}`}\n .value=${value.value}\n max=${this.maxDate}\n name=\"${value.columnField}-valueDate\"\n showCalendarOnMouseDown=\"true\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${e => this.onDatefilterValueChange(index, e)}\n >\n </ix-date-next>`\n : html`<ix-date\n data-testid=${`filterValueInput-${index}`}\n .value=${value.value}\n max=${this.maxDate}\n name=\"${value.columnField}-valueDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${e => this.onDatefilterValueChange(index, e)}\n >\n </ix-date>`;\n }\n\n private renderFilterInputControl(value: any, index: number) {\n switch (value.dataType) {\n case 'string':\n case undefined:\n return this.renderStringInput(value, index);\n case 'dateTime':\n return this.renderDateInput(value, index);\n default:\n return nothing;\n }\n }\n\n renderFilterInput(value: Filter, index: number) {\n const options = [value.columnField, ...this.unselectedFilters];\n const filterOptions = this.filterableColumns.filter(column =>\n options.includes(column.name)\n );\n return html`\n <div class=\"filter-form\">\n <div class=\"filter-remove filter-form-column\">\n <div class=\"form-group\">\n <ix-icon-button\n icon=\"close\"\n data-testid=\"clearFilterButton\"\n @click=${() => this.removeFilter(index)}\n @keyDown=${(e: KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n this.removeFilter(index);\n }\n }}\n ></ix-icon-button>\n </div>\n </div>\n ${this.mapSelect\n ? html`<div\n class=\"filter-form-column filter-form-column-border filterColumnField\"\n >\n <div class=\"form-group\">\n <label\n class=\"form-group-column-label\"\n title=\"select: ${value.columnField}, options: ${filterOptions.map(\n column => `value=${column.name}, selected=${\n column.name === value.columnField\n }, ${column.header}\n `\n )}\"\n >Columns</label\n >\n\n <select\n @change=${(e: Event) => this.onfilterColumnChange(index, e)}\n .value=${value.columnField}\n data-v=${value.columnField}\n >\n ${filterOptions.map(\n column => html`\n <option\n value=${column.name}\n ?selected=${column.name === value.columnField}\n >\n ${column.header}\n </option>\n `\n )}\n </select>\n </div>\n </div>`\n : nothing}\n\n <div\n class=\"filter-form-column filter-form-column-border filterColumnField\"\n >\n <div class=\"filter-form-group\">\n <label class=\"form-group-column-label\"\n ><span>Columns</span>\n <select\n data-testid=${`filterColumnInput-${index}`}\n @change=${(e: Event) => this.onfilterColumnChange(index, e)}\n .value=${value.columnField}\n data-v=${value.columnField}\n >\n ${repeat(\n filterOptions,\n (column: Column) => column.name,\n (column: Column) => html`\n <option\n value=${column.name}\n ?selected=${column.name === value.columnField}\n >\n ${column.header}\n </option>\n `\n )}\n </select>\n </label>\n </div>\n </div>\n\n <div\n class=\"filter-form-column filter-form-column-border filterOperatorField\"\n >\n <div class=\"filter-form-group\">\n <label class=\"form-group-operator-label\"\n ><span>Operator</span>\n <select\n data-testid=${`filterOperatorInput-${index}`}\n class=\"filterOperatorInput\"\n @change=${(e: Event) => this.onfilterOperatorChange(index, e)}\n .value=${value.operatorValue}\n data-v=${value.operatorValue}\n >\n ${repeat(\n filterOptions.find(\n column => column.name === value.columnField\n )?.filterOperators ?? ['contains'],\n (filter: FilterOperator) => html`\n <option\n value=${filter}\n ?selected=${filter === value.operatorValue}\n >\n ${filter}\n </option>\n `\n )}\n </select>\n </label>\n </div>\n </div>\n <div\n class=\"filter-form-column filter-form-column-border filterValueField\"\n >\n <div class=\"filter-form-group\">\n ${this.renderFilterInputControl(value, index)}\n </div>\n </div>\n </div>\n `;\n }\n\n renderDropdown() {\n const disableAddButton =\n this.filters.length >= this.filterColumns.length ||\n this.activeFilters.length < this.filters.length;\n return html` <div class=\"filter-dropdown-content\">\n <div class=\"filter-body\">\n ${this.filters.map((filter, index) =>\n this.renderFilterInput(filter, index)\n )}\n </div>\n <div class=\"filter-footer\">\n <ix-button\n data-testid=\"addFilterButton\"\n class=\"add-filter-button\"\n @click=\"${() => this.addFilter()}\"\n ?disabled=${disableAddButton}\n appearance=\"text\"\n >\n <ix-icon slot=\"icon\">add</ix-icon>\n Add filter\n </ix-button>\n <ix-button\n data-testid=\"clearAllFiltersButton\"\n @click=\"${() => this.clearFilters()}\"\n ?disabled=${this.activeFilters.length === 0}\n appearance=\"text\"\n >\n Clear all\n </ix-button>\n </div>\n </div>`;\n }\n\n render() {\n return html` <div class=\"grid-menu\">\n <div class=\"filter-container tooltip-container\">\n ${this.activeFilters.length > 0\n ? html`<span class=\"filter-superscript\"\n >${this.activeFilters.length}</span\n >`\n : nothing}\n <ix-button\n data-testid=\"showFiltersButton\"\n appearance=\"text\"\n class=\"filter_list filter-button\"\n @click=${() => {\n this.isDropdownVisible = !this.isDropdownVisible;\n }}\n @keyDown=${() => {\n this.isDropdownVisible = !this.isDropdownVisible;\n }}\n >\n <div class=\"slot-wrap\">\n <ix-icon appearance=\"default\" class=\"filter-icon\"\n >filter_list</ix-icon\n >\n <span class=\"filter\">${copy.filters}</span>\n </div>\n </ix-button>\n <div class=\"tool-tip\">${this.renderToolTip()}</div>\n ${this.isDropdownVisible ? this.renderDropdown() : nothing}\n </div>\n </div>`;\n }\n}\n"]}
|
|
@@ -159,8 +159,14 @@ export const IxGridRowFilterStyles = css `
|
|
|
159
159
|
flex-direction: column;
|
|
160
160
|
align-items: baseline;
|
|
161
161
|
height: 54px;
|
|
162
|
-
justify-content:
|
|
162
|
+
justify-content: space-between;
|
|
163
163
|
font-family: var(--text-default-font, sans-serif);
|
|
164
|
+
white-space: wrap;
|
|
165
|
+
|
|
166
|
+
ix-date-next,
|
|
167
|
+
ix-date {
|
|
168
|
+
margin-top: 10px;
|
|
169
|
+
}
|
|
164
170
|
}
|
|
165
171
|
|
|
166
172
|
option {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-row-filter-styles.js","sourceRoot":"","sources":["../../src/components/grid-row-filter-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"grid-row-filter-styles.js","sourceRoot":"","sources":["../../src/components/grid-row-filter-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2TvC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxGridRowFilterStyles = css`\n .slot-wrap {\n display: flex;\n }\n\n .slot-wrap ix-icon {\n --ix-icon-font-size: 24px;\n color: var(--clr-primary, #1456e0);\n margin-right: 5px;\n }\n\n .grid-menu ix-button .filter {\n margin-top: 2px;\n }\n\n .filter-form {\n white-space: nowrap;\n padding: 9px;\n color: var(--clr-on-surface-variant, #092241b3);\n }\n\n .filter-form-column {\n display: inline-block;\n vertical-align: middle;\n }\n\n .filter-remove span {\n margin-right: 0px;\n color: var(--clr-on-surface-variant, #092241b3);\n }\n\n .filter-dropdown-content {\n position: absolute;\n display: inline;\n right: 0;\n top: 78%;\n box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);\n z-index: 3;\n transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n border-radius: 12px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,\n rgba(0, 0, 0, 0.14) 0px 8px 10px 1px, rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;\n background-color: #ffffff;\n z-index: 10;\n }\n\n .filter-form input,\n .filter-form select,\n .filter-form option {\n font-family: var(--text-default-font, sans-serif);\n font-size: var(--text-default-size, 16px);\n letter-spacing: var(--text-default-letter-spacing, 0.0275em);\n line-height: var(--text-default-line-height, 1.75em);\n font-weight: var(--text-default-weight, normal);\n text-transform: var(--text-default-decoration, none);\n text-decoration: var(--text-default-transform, none);\n border-radius: 0px;\n cursor: pointer;\n box-sizing: content-box;\n background: none;\n height: 1.4375em;\n margin: 0px;\n animation-name: mui-auto-fill-cancel;\n animation-duration: 10ms;\n border: none;\n border-image: initial;\n box-sizing: border-box;\n cursor: text;\n user-select: none;\n color: currentcolor;\n -webkit-tap-highlight-color: transparent;\n display: block;\n min-width: 0px;\n width: 100%;\n height: 25px;\n border-bottom: 1px solid black;\n }\n\n .filter-form option {\n -webkit-tap-highlight-color: #9ca6b2;\n }\n\n .filter-form input:hover,\n .filter-form select:hover {\n outline: none !important;\n border-bottom: 2px solid black;\n }\n\n .filter-form input:focus,\n .filter-form select:focus {\n outline: none !important;\n border-bottom: 2px solid #1456e0;\n }\n\n .filter-form select:focus {\n background-color: rgba(0, 0, 0, 0.05);\n }\n\n .form-group {\n display: flex;\n flex-direction: column;\n align-items: baseline;\n height: 54px;\n justify-content: flex-end;\n font-family: var(--text-default-font, sans-serif);\n }\n\n .form-group label {\n font-family: var(--text-default-font, sans-serif);\n font-size: var(--text-default-size, 16px);\n letter-spacing: var(--text-default-letter-spacing, 0.0275em);\n line-height: var(--text-default-line-height, 1.75em);\n font-weight: var(--text-default-weight, normal);\n text-transform: var(--text-default-decoration, none);\n text-decoration: var(--text-default-transform, none);\n padding: 0px;\n color: #092241;\n display: block;\n transform-origin: left top;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 133%;\n transform: translate(0px, -1.5px) scale(0.75);\n transition: color 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,\n transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,\n max-width 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;\n }\n\n .filter-form-group label span {\n font-family: var(--text-default-font, sans-serif);\n font-size: var(--text-default-size, 16px);\n letter-spacing: var(--text-default-letter-spacing, 0.0275em);\n line-height: var(--text-default-line-height, 1.75em);\n font-weight: var(--text-default-weight, normal);\n text-transform: var(--text-default-decoration, none);\n text-decoration: var(--text-default-transform, none);\n padding: 0px;\n color: #092241;\n display: block;\n transform-origin: left top;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 133%;\n transform: translate(0px, -1.5px) scale(0.75);\n transition: color 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,\n transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms,\n max-width 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;\n }\n\n .filter-form-group label:focus-within span {\n color: #1456e0;\n }\n\n .filter-form-group {\n display: flex;\n flex-direction: column;\n align-items: baseline;\n height: 54px;\n justify-content: space-between;\n font-family: var(--text-default-font, sans-serif);\n white-space: wrap;\n\n ix-date-next,\n ix-date {\n margin-top: 10px;\n }\n }\n\n option {\n font-weight: normal;\n display: block;\n min-height: 1.2em;\n padding: 0px 2px 1px;\n white-space: nowrap;\n }\n\n .filter-footer {\n padding: 9px;\n display: flex;\n justify-content: space-between;\n }\n\n .no-display {\n display: none;\n }\n\n .filter-local-operator-empty {\n width: 54px;\n border: none;\n }\n\n .grid-menu span.filter-superscript {\n position: absolute;\n top: 6px;\n left: 14px;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: var(--text-caption-font, sans-serif);\n font-size: var(--text-caption-size, 0.75rem);\n letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);\n line-height: var(--text-caption-line-height, 1.33333333em);\n font-weight: var(--text-caption-weight, normal);\n text-transform: var(--text-caption-transform, none);\n text-decoration: var(--text-caption-decoration, none);\n padding: 0;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background-color: var(--clr-primary, #1456e0);\n color: var(--clr-on-primary, #fff);\n }\n\n .filterlist {\n width: 40px;\n }\n\n .filterColumnField {\n width: 150px;\n }\n\n .filterValueField {\n width: 190px;\n }\n\n .filterOperatorField {\n width: 120px;\n }\n\n .form-group-operator-label {\n width: 100%;\n }\n\n .filter-form .filterOperatorInput {\n min-width: 96px;\n }\n\n select:hover {\n cursor: pointer;\n }\n\n input:hover {\n cursor: text;\n }\n\n .tooltip-container {\n position: relative;\n display: inline-block;\n }\n\n .tool-tip {\n color: var(--clr-on-secondary, #fff);\n overflow-wrap: break-word;\n border-radius: 3px;\n background-color: var(--clr-secondary, #071454);\n padding: 5px 8px;\n font-family: var(--text-caption-font, sans-serif);\n font-size: var(--text-caption-size, 0.75rem);\n letter-spacing: var(--text-caption-letter-spacing, 0.03333333em);\n line-height: var(--text-caption-line-height, 1.33333333em);\n font-weight: var(--text-caption-weight, normal);\n text-transform: var(--text-caption-transform, none);\n text-decoration: var(--text-caption-decoration, none);\n\n position: absolute;\n top: 42px;\n right: 0;\n z-index: 3;\n white-space: nowrap;\n display: none;\n }\n\n .filter-button:hover ~ .tool-tip {\n display: block;\n }\n\n .tool-tip li {\n margin-left: -21px;\n overflow-wrap: break-word;\n border-radius: 3px;\n max-width: 250px;\n min-width: 200px;\n white-space: wrap;\n }\n\n .tool-tip p {\n margin: 0;\n padding: 0;\n }\n\n .grid-menu ix-button {\n align-items: center;\n display: flex;\n }\n\n @media only screen and (max-width: 840px) {\n .filter-dropdown-content {\n right: inherit;\n top: 0;\n }\n }\n\n @media only screen and (max-width: 600px) {\n .grid-menu ix-button .filter {\n display: none;\n }\n .grid-menu ix-button {\n --md-text-button-leading-space: 6px;\n --md-text-button-trailing-space: 0;\n margin-left: 4px;\n }\n }\n`;\n"]}
|
package/dist/ix-grid.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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/format.js";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:var(--ix-grid-hover-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:var(--progress-bar-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);padding:8px}.more-pagination{align-items:center;display:flex;justify-content:flex-end}.pagination{flex-grow:1}.row-limit{display:flex;padding:8px}.remove-all-button{margin-left:auto}.launchpad vaadin-grid{--lumo-size-xl:auto}.launchpad{--ix-grid-cell-height:44px;--ix-grid-cell-padding:14px 24px}.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
|
-
`)}">Columns</label> <select @change="${e=>this.onfilterColumnChange(i,e)}" .value="${t.columnField}" data-v="${t.columnField}">${a.map(e=>html`<option value="${e.name}" ?selected="${e.name===t.columnField}">${e.header}</option>`)}</select></div></div>`:nothing}<div class="filter-form-column filter-form-column-border filterColumnField"><div class="filter-form-group"><label class="form-group-column-label"><span>Columns</span> <select data-testid="${"filterColumnInput-"+i}" @change="${e=>this.onfilterColumnChange(i,e)}" .value="${t.columnField}" data-v="${t.columnField}">${repeat(a,e=>e.name,e=>html`<option value="${e.name}" ?selected="${e.name===t.columnField}">${e.header}</option>`)}</select></label></div></div><div class="filter-form-column filter-form-column-border filterOperatorField"><div class="filter-form-group"><label class="form-group-operator-label"><span>Operator</span> <select data-testid="${"filterOperatorInput-"+i}" class="filterOperatorInput" @change="${e=>this.onfilterOperatorChange(i,e)}" .value="${t.operatorValue}" data-v="${t.operatorValue}">${repeat(null!=(r=null==(e=a.find(e=>e.name===t.columnField))?void 0:e.filterOperators)?r:["contains"],e=>html`<option value="${e}" ?selected="${e===t.operatorValue}">${e}</option>`)}</select></label></div></div><div class="filter-form-column filter-form-column-border filterValueField"><div class="filter-form-group">${this.renderFilterInputControl(t,i)}</div></div></div>`}renderDropdown(){var e=this.filters.length>=this.filterColumns.length||this.activeFilters.length<this.filters.length;return html`<div class="filter-dropdown-content"><div class="filter-body">${this.filters.map((e,t)=>this.renderFilterInput(e,t))}</div><div class="filter-footer"><ix-button data-testid="addFilterButton" class="add-filter-button" @click="${()=>this.addFilter()}" ?disabled="${e}" appearance="text"><ix-icon slot="icon">add</ix-icon>Add filter</ix-button><ix-button data-testid="clearAllFiltersButton" @click="${()=>this.clearFilters()}" ?disabled="${0===this.activeFilters.length}" appearance="text">Clear all</ix-button></div></div>`}render(){return html`<div class="grid-menu"><div class="filter-container tooltip-container">${0<this.activeFilters.length?html`<span class="filter-superscript">${this.activeFilters.length}</span>`:nothing}<ix-button data-testid="showFiltersButton" appearance="text" class="filter_list filter-button" @click="${()=>{this.isDropdownVisible=!this.isDropdownVisible}}" @keyDown="${()=>{this.isDropdownVisible=!this.isDropdownVisible}}"><div class="slot-wrap"><ix-icon appearance="default" class="filter-icon">filter_list</ix-icon><span class="filter">${copy.filters}</span></div></ix-button><div class="tool-tip">${this.renderToolTip()}</div>${this.isDropdownVisible?this.renderDropdown():nothing}</div></div>`}},PaginationStyles=(IxGridRowFilter.styles=[IxGridViewStyles,IxGridRowFilterStyles],__decorate([property({type:Array})],IxGridRowFilter.prototype,"columns",void 0),__decorate([property({type:Number})],IxGridRowFilter.prototype,"filterValueChangeDebounceTime",void 0),__decorate([property({type:Boolean})],IxGridRowFilter.prototype,"readParamsFromURL",void 0),__decorate([property({type:String})],IxGridRowFilter.prototype,"maxDate",void 0),__decorate([state()],IxGridRowFilter.prototype,"isDropdownVisible",void 0),__decorate([state()],IxGridRowFilter.prototype,"filters",void 0),__decorate([state()],IxGridRowFilter.prototype,"filterableColumns",void 0),__decorate([state()],IxGridRowFilter.prototype,"filterColumns",void 0),__decorate([state()],IxGridRowFilter.prototype,"activeFilters",void 0),__decorate([state()],IxGridRowFilter.prototype,"mapSelect",void 0),__decorate([state()],IxGridRowFilter.prototype,"fromDateErrorText",void 0),__decorate([state()],IxGridRowFilter.prototype,"oldValueLength",void 0),IxGridRowFilter=__decorate([customElement("ix-grid-row-filter")],IxGridRowFilter),css`:host{--md-filled-select-text-field-input-text-size:var(
|
|
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,format}from"date-fns/format.js";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-date-next/ix-date-next.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:var(--ix-grid-hover-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:var(--progress-bar-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);padding:8px}.more-pagination{align-items:center;display:flex;justify-content:flex-end}.pagination{flex-grow:1}.row-limit{display:flex;padding:8px}.remove-all-button{margin-left:auto}.launchpad vaadin-grid{--lumo-size-xl:auto}.launchpad{--ix-grid-cell-height:44px;--ix-grid-cell-padding:14px 24px}.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:space-between;font-family:var(--text-default-font,sans-serif);white-space:wrap}.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.useNewDatePicker=!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=>{let t,i=e.value;var r;return"dateTime"===e.dataType&&this.useNewDatePicker&&(r=null==(t=this.shadowRoot)?void 0:t.querySelector("ix-date-next"),i=format(i,r.format)),html`<li>${this.formatCamelCaseToEnglish(e.columnField)} ${e.operatorValue} ${i}</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 this.useNewDatePicker?html`<ix-date-next data-testid="${"filterValueInput-"+t}" .value="${e.value}" max="${this.maxDate}" name="${e.columnField}-valueDate" showCalendarOnMouseDown="true" .errorText="${this.fromDateErrorText}" .onChanged="${e=>this.onDatefilterValueChange(t,e)}"></ix-date-next>`: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
|
+
`)}">Columns</label> <select @change="${e=>this.onfilterColumnChange(i,e)}" .value="${t.columnField}" data-v="${t.columnField}">${a.map(e=>html`<option value="${e.name}" ?selected="${e.name===t.columnField}">${e.header}</option>`)}</select></div></div>`:nothing}<div class="filter-form-column filter-form-column-border filterColumnField"><div class="filter-form-group"><label class="form-group-column-label"><span>Columns</span> <select data-testid="${"filterColumnInput-"+i}" @change="${e=>this.onfilterColumnChange(i,e)}" .value="${t.columnField}" data-v="${t.columnField}">${repeat(a,e=>e.name,e=>html`<option value="${e.name}" ?selected="${e.name===t.columnField}">${e.header}</option>`)}</select></label></div></div><div class="filter-form-column filter-form-column-border filterOperatorField"><div class="filter-form-group"><label class="form-group-operator-label"><span>Operator</span> <select data-testid="${"filterOperatorInput-"+i}" class="filterOperatorInput" @change="${e=>this.onfilterOperatorChange(i,e)}" .value="${t.operatorValue}" data-v="${t.operatorValue}">${repeat(null!=(r=null==(e=a.find(e=>e.name===t.columnField))?void 0:e.filterOperators)?r:["contains"],e=>html`<option value="${e}" ?selected="${e===t.operatorValue}">${e}</option>`)}</select></label></div></div><div class="filter-form-column filter-form-column-border filterValueField"><div class="filter-form-group">${this.renderFilterInputControl(t,i)}</div></div></div>`}renderDropdown(){var e=this.filters.length>=this.filterColumns.length||this.activeFilters.length<this.filters.length;return html`<div class="filter-dropdown-content"><div class="filter-body">${this.filters.map((e,t)=>this.renderFilterInput(e,t))}</div><div class="filter-footer"><ix-button data-testid="addFilterButton" class="add-filter-button" @click="${()=>this.addFilter()}" ?disabled="${e}" appearance="text"><ix-icon slot="icon">add</ix-icon>Add filter</ix-button><ix-button data-testid="clearAllFiltersButton" @click="${()=>this.clearFilters()}" ?disabled="${0===this.activeFilters.length}" appearance="text">Clear all</ix-button></div></div>`}render(){return html`<div class="grid-menu"><div class="filter-container tooltip-container">${0<this.activeFilters.length?html`<span class="filter-superscript">${this.activeFilters.length}</span>`:nothing}<ix-button data-testid="showFiltersButton" appearance="text" class="filter_list filter-button" @click="${()=>{this.isDropdownVisible=!this.isDropdownVisible}}" @keyDown="${()=>{this.isDropdownVisible=!this.isDropdownVisible}}"><div class="slot-wrap"><ix-icon appearance="default" class="filter-icon">filter_list</ix-icon><span class="filter">${copy.filters}</span></div></ix-button><div class="tool-tip">${this.renderToolTip()}</div>${this.isDropdownVisible?this.renderDropdown():nothing}</div></div>`}},PaginationStyles=(IxGridRowFilter.styles=[IxGridViewStyles,IxGridRowFilterStyles],__decorate([property({type:Array})],IxGridRowFilter.prototype,"columns",void 0),__decorate([property({type:Number})],IxGridRowFilter.prototype,"filterValueChangeDebounceTime",void 0),__decorate([property({type:Boolean})],IxGridRowFilter.prototype,"readParamsFromURL",void 0),__decorate([property({type:Boolean})],IxGridRowFilter.prototype,"useNewDatePicker",void 0),__decorate([property({type:String})],IxGridRowFilter.prototype,"maxDate",void 0),__decorate([state()],IxGridRowFilter.prototype,"isDropdownVisible",void 0),__decorate([state()],IxGridRowFilter.prototype,"filters",void 0),__decorate([state()],IxGridRowFilter.prototype,"filterableColumns",void 0),__decorate([state()],IxGridRowFilter.prototype,"filterColumns",void 0),__decorate([state()],IxGridRowFilter.prototype,"activeFilters",void 0),__decorate([state()],IxGridRowFilter.prototype,"mapSelect",void 0),__decorate([state()],IxGridRowFilter.prototype,"fromDateErrorText",void 0),__decorate([state()],IxGridRowFilter.prototype,"oldValueLength",void 0),IxGridRowFilter=__decorate([customElement("ix-grid-row-filter")],IxGridRowFilter),css`:host{--md-filled-select-text-field-input-text-size:var(
|
|
3
3
|
--ix-filled-select-text-field-input-text-size,
|
|
4
4
|
12px
|
|
5
5
|
)}[hidden]{display:none!important}.pagination{display:flex;align-items:center;justify-content:end;gap:0;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);margin:1.25rem .5rem 1.25rem 1rem}.pagination.simple{margin:0}.pagination>div{display:flex;align-items:center;gap:.5rem}.pagination p{margin:0}.pagination-nav{display:flex;margin-left:1.5rem;height:1.5rem;gap:.5rem}.pagination-nav>ix-icon-button{margin-top:-.5rem}.rows-per-page{color:var(--clr-on-surface,#092241)}ix-select{--md-menu-container-color:var(--bg-surface-container-lowest, #fff);--md-filled-select-text-field-container-color:var(
|
|
@@ -10,7 +10,7 @@ import{__decorate}from"tslib";import"@digital-realty/grid";import{columnHeaderRe
|
|
|
10
10
|
#1456e0
|
|
11
11
|
);--md-filled-select-text-field-focus-active-indicator-color:var(
|
|
12
12
|
--md-filled-select-text-field-focus-trailing-icon-color
|
|
13
|
-
)}ix-select-option{--md-menu-item-selected-container-color:rgba(20, 86, 224, 0.1)}@media only screen and (max-width:600px){.pagination{justify-content:space-between}.pagination>div{gap:0}}`),IxPagination=class extends LitElement{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){var e=e.target,e=Number(e.value),t=(this.page-1)*this.pageSize+1,t=Math.ceil(t/e);this.updatePagination(t,e)}updatePagination(e=this.page,t=this.pageSize){this.dispatchEvent(new CustomEvent("updatePagination",{detail:{page:e,pageSize:t},bubbles:!0,composed:!0}))}render(){let e=1<this.page,t=this.recordCount>this.page*this.pageSize;return html`<div class="pagination ${this.isSimple?"simple":""}"><div ?hidden="${this.isSimple}"><p class="rows-per-page" data-testid="ix-pagination-rows-per-page">${copy.rowsPerPage}:</p><ix-select wide-menu menu-positioning="fixed" class="pagination__select-input" @request-selection="${this.handlePageSizeSelection}" selected-index="${this.pageSizes.indexOf(this.pageSize)}" filled>${this.pageSizes.map(e=>html`<ix-select-option class="select-option" value="${e}" ?selected="${e===this.pageSize}"><div slot="headline">${e}</div></ix-select-option>`)}</ix-select></div><div><p data-testid="ix-pagination-page-of-page">${0<this.recordCount?(this.page-1)*this.pageSize+1:0} - ${this.page*this.pageSize>this.recordCount?html`${this.recordCount}`:html`${this.page*this.pageSize}`} of ${0<this.recordCount?this.recordCount:0}</p><div class="pagination-nav"><ix-icon-button ?disabled="${!e}" @click="${()=>e&&this.changePage(-1)}" icon="chevron_left" data-testid="ix-pagination-prev"></ix-icon-button><ix-icon-button ?disabled="${!t}" @click="${()=>t&&this.changePage(1)}" icon="chevron_right" data-testid="ix-pagination-next"></ix-icon-button></div></div></div>`}};IxPagination.styles=[IxGridViewStyles,PaginationStyles],__decorate([property({type:Number})],IxPagination.prototype,"recordCount",void 0),__decorate([property({type:Number})],IxPagination.prototype,"page",void 0),__decorate([property({type:Number})],IxPagination.prototype,"pageSize",void 0),__decorate([property({type:Array})],IxPagination.prototype,"pageSizes",void 0),__decorate([property({type:Boolean,attribute:"simple"})],IxPagination.prototype,"isSimple",void 0),IxPagination=__decorate([customElement("ix-pagination")],IxPagination);class IxGrid extends LitElement{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=formatDate(new Date,"yyyy-MM-dd"),this.hashedTableState="",this.hideViewMoreLessButtonIcon=!0,this.showAddButton=!1,this.disableAddButton=!1,this.showViewMore=!1,this.addButtonLabel=copy.add,this.showRemoveAllButton=!1,this.disableRemoveAllButton=!1,this.removeAllButtonLabel=copy.removeAll,this.filters=[],this.isColumnsReordering=!1,this.isExpanded=!1,this.displayColumns=[],this.defaultFilterKeys=["sort","order","page","size"],this.initialised=!1,this.handlePopState=()=>{this.updateSearchParamsFromUri(!0),this.dispatchChangeEvent()},this.dispatchChangeEvent=()=>{var e=this.filters.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:e,filtersOperators:this.filters.map(e=>({columnField:e.columnField,operator:e.operatorValue}))},bubbles:!0,composed:!0}))},this.renderColumnHeader=(e,t,i,r)=>{i=classMap({header:!0,frozen:!!e.frozenToEnd,first:0===i,last:i===r-1,border:!(null!=t&&t.frozenToEnd)});return html`<div @click="${()=>e.sortable&&this.handleSort(e.name)}" @keyDown="${()=>e.sortable&&this.handleSort(e.name)}" class="${i}"><span class="header-label">${e.header}</span> ${e.sortable?html`<ix-icon title="Sort" class="header-sort-icon">${"desc"===this.sortDirection&&this.sortedColumn===e.name?"arrow_upward":"arrow_downward"}</ix-icon>`:nothing}</div>`},this.columnRenderer=(e,t,i,r)=>{render(nothing,t);r=e.bodyRenderer(r.item,r,i);let o=r;i=!!e.maxWidth;let a="column-max-width-set";i&&(o=html`<div class="${a}" style="max-width:${e.maxWidth}">${r}</div>`),render(o,t),i&&requestAnimationFrame(()=>{let e,i=t.querySelector("."+a);if(i&&i.scrollWidth>i.clientWidth&&!i.querySelector(".custom-tooltip")&&null!=(e=i.textContent)&&e.trim()){let t=document.createElement("div");t.className="custom-tooltip",t.style.cssText=`
|
|
13
|
+
)}ix-select-option{--md-menu-item-selected-container-color:rgba(20, 86, 224, 0.1)}@media only screen and (max-width:600px){.pagination{justify-content:space-between}.pagination>div{gap:0}}`),IxPagination=class extends LitElement{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){var e=e.target,e=Number(e.value),t=(this.page-1)*this.pageSize+1,t=Math.ceil(t/e);this.updatePagination(t,e)}updatePagination(e=this.page,t=this.pageSize){this.dispatchEvent(new CustomEvent("updatePagination",{detail:{page:e,pageSize:t},bubbles:!0,composed:!0}))}render(){let e=1<this.page,t=this.recordCount>this.page*this.pageSize;return html`<div class="pagination ${this.isSimple?"simple":""}"><div ?hidden="${this.isSimple}"><p class="rows-per-page" data-testid="ix-pagination-rows-per-page">${copy.rowsPerPage}:</p><ix-select wide-menu menu-positioning="fixed" class="pagination__select-input" @request-selection="${this.handlePageSizeSelection}" selected-index="${this.pageSizes.indexOf(this.pageSize)}" filled>${this.pageSizes.map(e=>html`<ix-select-option class="select-option" value="${e}" ?selected="${e===this.pageSize}"><div slot="headline">${e}</div></ix-select-option>`)}</ix-select></div><div><p data-testid="ix-pagination-page-of-page">${0<this.recordCount?(this.page-1)*this.pageSize+1:0} - ${this.page*this.pageSize>this.recordCount?html`${this.recordCount}`:html`${this.page*this.pageSize}`} of ${0<this.recordCount?this.recordCount:0}</p><div class="pagination-nav"><ix-icon-button ?disabled="${!e}" @click="${()=>e&&this.changePage(-1)}" icon="chevron_left" data-testid="ix-pagination-prev"></ix-icon-button><ix-icon-button ?disabled="${!t}" @click="${()=>t&&this.changePage(1)}" icon="chevron_right" data-testid="ix-pagination-next"></ix-icon-button></div></div></div>`}};IxPagination.styles=[IxGridViewStyles,PaginationStyles],__decorate([property({type:Number})],IxPagination.prototype,"recordCount",void 0),__decorate([property({type:Number})],IxPagination.prototype,"page",void 0),__decorate([property({type:Number})],IxPagination.prototype,"pageSize",void 0),__decorate([property({type:Array})],IxPagination.prototype,"pageSizes",void 0),__decorate([property({type:Boolean,attribute:"simple"})],IxPagination.prototype,"isSimple",void 0),IxPagination=__decorate([customElement("ix-pagination")],IxPagination);class IxGrid extends LitElement{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=formatDate(new Date,"yyyy-MM-dd"),this.hashedTableState="",this.hideViewMoreLessButtonIcon=!0,this.showAddButton=!1,this.disableAddButton=!1,this.showViewMore=!1,this.addButtonLabel=copy.add,this.showRemoveAllButton=!1,this.disableRemoveAllButton=!1,this.removeAllButtonLabel=copy.removeAll,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=this.filters.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:e,filtersOperators:this.filters.map(e=>({columnField:e.columnField,operator:e.operatorValue}))},bubbles:!0,composed:!0}))},this.renderColumnHeader=(e,t,i,r)=>{i=classMap({header:!0,frozen:!!e.frozenToEnd,first:0===i,last:i===r-1,border:!(null!=t&&t.frozenToEnd)});return html`<div @click="${()=>e.sortable&&this.handleSort(e.name)}" @keyDown="${()=>e.sortable&&this.handleSort(e.name)}" class="${i}"><span class="header-label">${e.header}</span> ${e.sortable?html`<ix-icon title="Sort" class="header-sort-icon">${"desc"===this.sortDirection&&this.sortedColumn===e.name?"arrow_upward":"arrow_downward"}</ix-icon>`:nothing}</div>`},this.columnRenderer=(e,t,i,r)=>{render(nothing,t);r=e.bodyRenderer(r.item,r,i);let o=r;i=!!e.maxWidth;let a="column-max-width-set";i&&(o=html`<div class="${a}" style="max-width:${e.maxWidth}">${r}</div>`),render(o,t),i&&requestAnimationFrame(()=>{let e,i=t.querySelector("."+a);if(i&&i.scrollWidth>i.clientWidth&&!i.querySelector(".custom-tooltip")&&null!=(e=i.textContent)&&e.trim()){let t=document.createElement("div");t.className="custom-tooltip",t.style.cssText=`
|
|
14
14
|
background-color: #092241;
|
|
15
15
|
font-size: 0.75rem;
|
|
16
16
|
color: white;
|
|
@@ -22,4 +22,4 @@ import{__decorate}from"tslib";import"@digital-realty/grid";import{columnHeaderRe
|
|
|
22
22
|
position: absolute;
|
|
23
23
|
z-index: 1000;
|
|
24
24
|
display: none;
|
|
25
|
-
`,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=()=>0<this.rowLimit?nothing:html`<ix-pagination ?simple="${this.hasSimplePagination}" class="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>`}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}renderViewMore(){return this.showViewMore?html`<div class="view-more"><slot name="viewMore"></slot></div>`:nothing}get showViewMoreLessButton(){return!this.showViewMore&&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 theme="${this.theme}" .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()}<div class="row-controls more-pagination">${this.renderViewMore()} ${this.renderPaginationControls()}</div><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:Boolean,attribute:"simple-pagination"})],IxGrid.prototype,"hasSimplePagination",void 0),__decorate([property({type:String})],IxGrid.prototype,"theme",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:Boolean,attribute:"show-view-more"})],IxGrid.prototype,"showViewMore",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);
|
|
25
|
+
`,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}" .useNewDatePicker="${this.useNewDatePicker}" @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=()=>0<this.rowLimit?nothing:html`<ix-pagination ?simple="${this.hasSimplePagination}" class="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.updateSessionStorage({pageSize:this.pageSize}),this.updatePage()}}"></ix-pagination>`}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),window.addEventListener("beforeunload",this.handleUnload)}disconnectedCallback(){var e;window.removeEventListener("popstate",this.handlePopState),window.removeEventListener("beforeunload",this.handleUnload),null!=(e=super.disconnectedCallback)&&e.call(this)}updateSearchParamsFromUri(e=!1){var t,i,r,o,a;0!==this.grid.getBoundingClientRect().width&&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.getSessionStorageData()||!sessionStorage.getItem("urlPageSizeRead")&&0<this.grid.getBoundingClientRect().width)&&(sessionStorage.setItem("urlPageSizeRead",(!0).toString()),this.pageSize=parseInt(a,10)||this.defaultPageSize,this.updateSessionStorage({pageSize:this.pageSize})),e)&&this.rebuildFiltersFromUri(t)}rebuildFiltersFromUri(e){var t,i,r=[];for([t,i]of e.entries()){var o=this.defaultFilterKeys.includes(t),[a,n]=t.split("_");!o&&a&&n&&r.push({columnField:a,operatorValue:n,value:i})}this.filters=r}update(e){var t;!this.initialised&&0<this.columns.length&&(this.displayColumns=[...this.columns],this.checkLocalStorageUpdate(),this.initialised=!0),e.has("sessionStorageData")&&this.sessionStorageData&&(t=this.sessionStorageData.pageSize||this.defaultPageSize,this.pageSize!==t)&&(this.pageSize=t),super.update(e)}firstUpdated(){this.updateSearchParamsFromUri(),this.removeOldLocalStorageValues(),this.sessionStorageData=this.getSessionStorageData()}getSessionStorageData(){if(this.sessionStorageKey){var e=sessionStorage.getItem("grid-"+this.sessionStorageKey);if(e)return JSON.parse(e)}}updateSessionStorage(e){var t=this.getSessionStorageData()||{};this.sessionStorageKey&&e&&(t={...t,...e},sessionStorage.setItem("grid-"+this.sessionStorageKey,JSON.stringify(t)),this.sessionStorageData=t)}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}renderViewMore(){return this.showViewMore?html`<div class="view-more"><slot name="viewMore"></slot></div>`:nothing}get showViewMoreLessButton(){return!this.showViewMore&&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 theme="${this.theme}" .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()}<div class="row-controls more-pagination">${this.renderViewMore()} ${this.renderPaginationControls()}</div><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:Boolean,attribute:"simple-pagination"})],IxGrid.prototype,"hasSimplePagination",void 0),__decorate([property({type:String})],IxGrid.prototype,"theme",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:Boolean,attribute:"show-view-more"})],IxGrid.prototype,"showViewMore",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([property({type:String,attribute:"session-storage-key"})],IxGrid.prototype,"sessionStorageKey",void 0),__decorate([property({type:Boolean})],IxGrid.prototype,"useNewDatePicker",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),__decorate([state()],IxGrid.prototype,"sessionStorageData",void 0),window.customElements.define("ix-grid",IxGrid);
|
|
@@ -277,6 +277,27 @@ describe('IxGridRowFilter', () => {
|
|
|
277
277
|
const today = new Date().toISOString().split('T')[0];
|
|
278
278
|
expect(dateInput === null || dateInput === void 0 ? void 0 : dateInput.getAttribute('max')).to.equal(today);
|
|
279
279
|
});
|
|
280
|
+
it('should render ix-date-next if "useNewDatePicker" is true', async () => {
|
|
281
|
+
var _a, _b;
|
|
282
|
+
const columnsWithDataType = [
|
|
283
|
+
{
|
|
284
|
+
name: 'dateField',
|
|
285
|
+
header: 'Date Field',
|
|
286
|
+
filterable: true,
|
|
287
|
+
filterOperators: ['='],
|
|
288
|
+
dataType: 'dateTime',
|
|
289
|
+
},
|
|
290
|
+
];
|
|
291
|
+
const el = await fixture(html `<ix-grid-row-filter
|
|
292
|
+
.columns=${columnsWithDataType}
|
|
293
|
+
.useNewDatePicker=${true}
|
|
294
|
+
></ix-grid-row-filter>`);
|
|
295
|
+
const openMenu = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.filter-button');
|
|
296
|
+
openMenu === null || openMenu === void 0 ? void 0 : openMenu.click();
|
|
297
|
+
await elementUpdated(el);
|
|
298
|
+
const dateInput = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('div.filterValueField ix-date-next');
|
|
299
|
+
expect(dateInput).to.exist;
|
|
300
|
+
});
|
|
280
301
|
});
|
|
281
302
|
});
|
|
282
303
|
//# sourceMappingURL=ix-grid-row-filter.test.js.map
|