@annalib/anna-core 20.3.2 → 20.3.3
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkScrollable, VIRTUAL_SCROLL_STRATEGY, ScrollingModule } from '@angular/cdk/scrolling';
|
|
1
|
+
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
|
|
3
2
|
import { NgTemplateOutlet, NgIf, NgClass, TitleCasePipe, DatePipe, NgFor, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, AsyncPipe, CommonModule } from '@angular/common';
|
|
4
3
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output, Directive, HostListener, Pipe, Injectable, ViewChildren,
|
|
4
|
+
import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output, Directive, HostListener, Pipe, Injectable, ViewChildren, NgModule } from '@angular/core';
|
|
6
5
|
import * as i3 from '@angular/forms';
|
|
7
6
|
import { FormsModule } from '@angular/forms';
|
|
8
7
|
import * as i5 from '@angular/material/button-toggle';
|
|
@@ -10,7 +9,7 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
|
10
9
|
import * as i7 from '@angular/material/radio';
|
|
11
10
|
import { MatRadioModule } from '@angular/material/radio';
|
|
12
11
|
import * as i4$1 from '@angular/material/table';
|
|
13
|
-
import { MatTableModule
|
|
12
|
+
import { MatTableModule } from '@angular/material/table';
|
|
14
13
|
import * as i4 from '@angular-slider/ngx-slider';
|
|
15
14
|
import { NgxSliderModule } from '@angular-slider/ngx-slider';
|
|
16
15
|
import * as i1 from '@ng-bootstrap/ng-bootstrap';
|
|
@@ -25,14 +24,8 @@ import customParseFormat from 'dayjs/plugin/isSameOrAfter';
|
|
|
25
24
|
import customParseFormat$1 from 'dayjs/plugin/customParseFormat';
|
|
26
25
|
import isBetween from 'dayjs/plugin/isBetween';
|
|
27
26
|
import minMax from 'dayjs/plugin/minMax';
|
|
28
|
-
import { Subject, BehaviorSubject
|
|
29
|
-
import * as i1$1 from '@angular/cdk/bidi';
|
|
30
|
-
import { startWith, auditTime, takeUntil, distinctUntilChanged, pairwise, switchMap, shareReplay, map as map$1 } from 'rxjs/operators';
|
|
27
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
31
28
|
import * as i2 from '@angular/router';
|
|
32
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
33
|
-
import { isDataSource, ArrayDataSource } from '@angular/cdk/collections';
|
|
34
|
-
import * as i2$2 from '@angular/cdk/table';
|
|
35
|
-
import { _COALESCED_STYLE_SCHEDULER, STICKY_POSITIONING_LISTENER, CdkHeaderRowDef } from '@angular/cdk/table';
|
|
36
29
|
import hash from 'object-hash';
|
|
37
30
|
|
|
38
31
|
class AnnaBuyerApprovalIconTemplateComponent {
|
|
@@ -4878,859 +4871,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
4878
4871
|
args: ["tableHeader"]
|
|
4879
4872
|
}] } });
|
|
4880
4873
|
|
|
4881
|
-
class AnnaGtHelperService {
|
|
4882
|
-
constructor(annaFilterService, router, route, annaSortService) {
|
|
4883
|
-
this.annaFilterService = annaFilterService;
|
|
4884
|
-
this.router = router;
|
|
4885
|
-
this.route = route;
|
|
4886
|
-
this.annaSortService = annaSortService;
|
|
4887
|
-
this.virtualScrollSubject = new Subject();
|
|
4888
|
-
}
|
|
4889
|
-
calculateNumberOfSkeletonColumnsForTable(tableHeaders) {
|
|
4890
|
-
const numberOfSkeletonColumns = [];
|
|
4891
|
-
let headersInEachColumn = 0;
|
|
4892
|
-
tableHeaders.forEach((column) => {
|
|
4893
|
-
if (column.visible) {
|
|
4894
|
-
headersInEachColumn = 0;
|
|
4895
|
-
column.headerInfo.forEach(() => {
|
|
4896
|
-
headersInEachColumn += 1;
|
|
4897
|
-
});
|
|
4898
|
-
numberOfSkeletonColumns.push(Array(headersInEachColumn).fill(0));
|
|
4899
|
-
}
|
|
4900
|
-
});
|
|
4901
|
-
return numberOfSkeletonColumns;
|
|
4902
|
-
}
|
|
4903
|
-
initColumnFilterAndSorting() {
|
|
4904
|
-
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
4905
|
-
this.annaFilterService.selectedRadio = null;
|
|
4906
|
-
this.annaFilterService.appliedFiltersArray = [];
|
|
4907
|
-
this.annaFilterService.initialValueMap = new Map();
|
|
4908
|
-
this.annaSortService.columnSortState = new Map();
|
|
4909
|
-
this.annaSortService.noSortingAppliedData = [];
|
|
4910
|
-
}
|
|
4911
|
-
enableOrDisableClearAllBtn() {
|
|
4912
|
-
const isFilterApplied = this.annaFilterService.appliedFiltersArray.length > 0;
|
|
4913
|
-
const isSortApplied = this.isSortingAppliedToTable();
|
|
4914
|
-
return !(isFilterApplied || isSortApplied);
|
|
4915
|
-
}
|
|
4916
|
-
updateFiltersInURL() {
|
|
4917
|
-
const latestQueryParams = this.prepareQueryParamsOnFilter();
|
|
4918
|
-
if (Object.keys(latestQueryParams).length > 0) {
|
|
4919
|
-
this.router.navigate([], {
|
|
4920
|
-
queryParams: { filters: JSON.stringify(latestQueryParams) },
|
|
4921
|
-
relativeTo: this.route.parent,
|
|
4922
|
-
queryParamsHandling: "merge",
|
|
4923
|
-
});
|
|
4924
|
-
}
|
|
4925
|
-
else {
|
|
4926
|
-
this.router.navigate([], {
|
|
4927
|
-
relativeTo: this.route.parent,
|
|
4928
|
-
});
|
|
4929
|
-
}
|
|
4930
|
-
}
|
|
4931
|
-
prepareQueryParamsOnFilter() {
|
|
4932
|
-
const query = {};
|
|
4933
|
-
if (this.annaFilterService.appliedFiltersArray.length > 0) {
|
|
4934
|
-
query.appliedFilters = this.annaFilterService.appliedFiltersArray;
|
|
4935
|
-
query.selectedFilterData = JSON.stringify(Array.from(this.annaFilterService.tooltipSelectedMap));
|
|
4936
|
-
}
|
|
4937
|
-
if (this.checkIfSortingIsApplied()) {
|
|
4938
|
-
query.sortState = JSON.stringify(Array.from(this.annaSortService.columnSortState));
|
|
4939
|
-
}
|
|
4940
|
-
return query;
|
|
4941
|
-
}
|
|
4942
|
-
checkIfSortingIsApplied() {
|
|
4943
|
-
let isSortingApplied = false;
|
|
4944
|
-
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
4945
|
-
if (value === "ASC" || value === "DESC") {
|
|
4946
|
-
isSortingApplied = true;
|
|
4947
|
-
}
|
|
4948
|
-
});
|
|
4949
|
-
return isSortingApplied;
|
|
4950
|
-
}
|
|
4951
|
-
initTableFilters(clonedTableData) {
|
|
4952
|
-
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
4953
|
-
this.annaFilterService.selectedRadio = null;
|
|
4954
|
-
this.annaFilterService.appliedFiltersArray = [];
|
|
4955
|
-
this.annaSortService.columnSortState = new Map();
|
|
4956
|
-
this.annaSortService.noSortingAppliedData = cloneDeep(clonedTableData);
|
|
4957
|
-
this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
|
|
4958
|
-
}
|
|
4959
|
-
initFilters() {
|
|
4960
|
-
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
4961
|
-
this.annaFilterService.appliedFiltersArray = [];
|
|
4962
|
-
}
|
|
4963
|
-
setDataAsPerPersistingFilter(isPersistingFilter, clonedTable, filters) {
|
|
4964
|
-
let usersTable;
|
|
4965
|
-
if (isPersistingFilter) {
|
|
4966
|
-
usersTable = this.annaFilterService.filterData(clonedTable, "");
|
|
4967
|
-
this.annaSortService.noSortingAppliedData = cloneDeep(usersTable);
|
|
4968
|
-
}
|
|
4969
|
-
else {
|
|
4970
|
-
usersTable = clonedTable;
|
|
4971
|
-
this.annaSortService.noSortingAppliedData = cloneDeep(usersTable);
|
|
4972
|
-
}
|
|
4973
|
-
if (filters?.sortState) {
|
|
4974
|
-
this.annaSortService.columnSortState = new Map(JSON.parse(filters.sortState));
|
|
4975
|
-
usersTable = this.callSort(usersTable);
|
|
4976
|
-
}
|
|
4977
|
-
this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
|
|
4978
|
-
return usersTable;
|
|
4979
|
-
}
|
|
4980
|
-
callSort(usersTable) {
|
|
4981
|
-
let sortedUsersTableData = usersTable;
|
|
4982
|
-
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
4983
|
-
if (value === "ASC") {
|
|
4984
|
-
sortedUsersTableData = this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(true, usersTable, key);
|
|
4985
|
-
}
|
|
4986
|
-
else if (value === "DESC") {
|
|
4987
|
-
sortedUsersTableData = this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(false, usersTable, key);
|
|
4988
|
-
}
|
|
4989
|
-
});
|
|
4990
|
-
return sortedUsersTableData;
|
|
4991
|
-
}
|
|
4992
|
-
isSortingAppliedToTable() {
|
|
4993
|
-
let isSortingApplied = false;
|
|
4994
|
-
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
4995
|
-
if (value === "ASC" || value === "DESC") {
|
|
4996
|
-
isSortingApplied = true;
|
|
4997
|
-
}
|
|
4998
|
-
});
|
|
4999
|
-
return isSortingApplied;
|
|
5000
|
-
}
|
|
5001
|
-
updateQueryParamsFilter(key, value, operation, queryParamObj) {
|
|
5002
|
-
if (operation === "ADD") {
|
|
5003
|
-
queryParamObj[key] = value;
|
|
5004
|
-
}
|
|
5005
|
-
else if (operation === "DELETE") {
|
|
5006
|
-
delete queryParamObj[key];
|
|
5007
|
-
}
|
|
5008
|
-
return queryParamObj;
|
|
5009
|
-
}
|
|
5010
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, deps: [{ token: AnnaFilterService }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: AnnaSortService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5011
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, providedIn: "root" }); }
|
|
5012
|
-
}
|
|
5013
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, decorators: [{
|
|
5014
|
-
type: Injectable,
|
|
5015
|
-
args: [{
|
|
5016
|
-
providedIn: "root",
|
|
5017
|
-
}]
|
|
5018
|
-
}], ctorParameters: function () { return [{ type: AnnaFilterService }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: AnnaSortService }]; } });
|
|
5019
|
-
|
|
5020
|
-
/* eslint-disable no-underscore-dangle */
|
|
5021
|
-
/**
|
|
5022
|
-
* @license
|
|
5023
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5024
|
-
*
|
|
5025
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5026
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5027
|
-
*/
|
|
5028
|
-
/** Checks if the given ranges are equal. */
|
|
5029
|
-
function rangesEqual(r1, r2) {
|
|
5030
|
-
return r1.start === r2.start && r1.end === r2.end;
|
|
5031
|
-
}
|
|
5032
|
-
/**
|
|
5033
|
-
* Scheduler to be used for scroll events. Needs to fall back to
|
|
5034
|
-
* something that doesn't rely on requestAnimationFrame on environments
|
|
5035
|
-
* that don't support it (e.g. server-side rendering).
|
|
5036
|
-
*/
|
|
5037
|
-
const SCROLL_SCHEDULER = typeof requestAnimationFrame !== "undefined" ? animationFrameScheduler : asapScheduler;
|
|
5038
|
-
/**
|
|
5039
|
-
* A viewport that virtualizes its scrolling with the help of `CdkVirtualForOf`.
|
|
5040
|
-
* Uses `top: #px` instead of `transform: translateY(#px)` like the cdk virtual scroll viewport does
|
|
5041
|
-
* which avoids flickering of elements in the transformed container with `position: sticky`.
|
|
5042
|
-
*/
|
|
5043
|
-
class AnnaTableVirtualScrollViewportComponent extends CdkScrollable {
|
|
5044
|
-
/** The direction the viewport scrolls. */
|
|
5045
|
-
get orientation() {
|
|
5046
|
-
return this._orientation;
|
|
5047
|
-
}
|
|
5048
|
-
set orientation(orientation) {
|
|
5049
|
-
if (this._orientation !== orientation) {
|
|
5050
|
-
this._orientation = orientation;
|
|
5051
|
-
this._calculateSpacerSize();
|
|
5052
|
-
}
|
|
5053
|
-
}
|
|
5054
|
-
constructor(elementRef, _changeDetectorRef, ngZone, _scrollStrategy, dir, scrollDispatcher, viewportRuler, annaGtService) {
|
|
5055
|
-
super(elementRef, scrollDispatcher, ngZone, dir);
|
|
5056
|
-
this.elementRef = elementRef;
|
|
5057
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
5058
|
-
this._scrollStrategy = _scrollStrategy;
|
|
5059
|
-
this.annaGtService = annaGtService;
|
|
5060
|
-
/** Emits when the viewport is detached from a CdkVirtualForOf. */
|
|
5061
|
-
this._detachedSubject = new Subject();
|
|
5062
|
-
/** Emits when the rendered range changes. */
|
|
5063
|
-
this._renderedRangeSubject = new Subject();
|
|
5064
|
-
this._orientation = "vertical";
|
|
5065
|
-
// Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
|
|
5066
|
-
// strategy lazily (i.e. only if the user is actually listening to the events). We do this because
|
|
5067
|
-
// depending on how the strategy calculates the scrolled index, it may come at a cost to
|
|
5068
|
-
// performance.
|
|
5069
|
-
/** Emits when the index of the first element visible in the viewport changes. */
|
|
5070
|
-
this.scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe((index) => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
|
|
5071
|
-
/** A stream that emits whenever the rendered range changes. */
|
|
5072
|
-
this.renderedRangeStream = this._renderedRangeSubject;
|
|
5073
|
-
/**
|
|
5074
|
-
* The total size of all content (in pixels), including content that is not currently rendered.
|
|
5075
|
-
*/
|
|
5076
|
-
this._totalContentSize = 0;
|
|
5077
|
-
/** A string representing the `style.width` property value to be used for the spacer element. */
|
|
5078
|
-
this._totalContentWidth = "";
|
|
5079
|
-
/** A string representing the `style.height` property value to be used for the spacer element. */
|
|
5080
|
-
this._totalContentHeight = "";
|
|
5081
|
-
/** The currently rendered range of indices. */
|
|
5082
|
-
this._renderedRange = { start: 0, end: 0 };
|
|
5083
|
-
/** The length of the data bound to this viewport (in number of items). */
|
|
5084
|
-
this._dataLength = 0;
|
|
5085
|
-
/** The size of the viewport (in pixels). */
|
|
5086
|
-
this._viewportSize = 0;
|
|
5087
|
-
/** The last rendered content offset that was set. */
|
|
5088
|
-
this._renderedContentOffset = 0;
|
|
5089
|
-
/**
|
|
5090
|
-
* Whether the last rendered content offset was to the end of the content (and therefore needs to
|
|
5091
|
-
* be rewritten as an offset to the start of the content).
|
|
5092
|
-
*/
|
|
5093
|
-
this._renderedContentOffsetNeedsRewrite = false;
|
|
5094
|
-
/** Whether there is a pending change detection cycle. */
|
|
5095
|
-
this._isChangeDetectionPending = false;
|
|
5096
|
-
/** A list of functions to run after the next change detection cycle. */
|
|
5097
|
-
this._runAfterChangeDetection = [];
|
|
5098
|
-
/** Subscription to changes in the viewport size. */
|
|
5099
|
-
this._viewportChanges = Subscription.EMPTY;
|
|
5100
|
-
if (!_scrollStrategy) {
|
|
5101
|
-
throw Error('Error: cdk-virtual-scroll-viewport requires the "itemSize" property to be set.');
|
|
5102
|
-
}
|
|
5103
|
-
this._viewportChanges = viewportRuler.change().subscribe(() => {
|
|
5104
|
-
this.checkViewportSize();
|
|
5105
|
-
});
|
|
5106
|
-
}
|
|
5107
|
-
ngOnInit() {
|
|
5108
|
-
super.ngOnInit();
|
|
5109
|
-
// It's still too early to measure the viewport at this point. Deferring with a promise allows
|
|
5110
|
-
// the Viewport to be rendered with the correct size before we measure. We run this outside the
|
|
5111
|
-
// zone to avoid causing more change detection cycles. We handle the change detection loop
|
|
5112
|
-
// ourselves instead.
|
|
5113
|
-
this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {
|
|
5114
|
-
this._measureViewportSize();
|
|
5115
|
-
this._scrollStrategy.attach(this);
|
|
5116
|
-
this.elementScrolled()
|
|
5117
|
-
.pipe(
|
|
5118
|
-
// Start off with a fake scroll event so we properly detect our initial position.
|
|
5119
|
-
startWith(null),
|
|
5120
|
-
// Collect multiple events into one until the next animation frame. This way if
|
|
5121
|
-
// there are multiple scroll events in the same frame we only need to recheck
|
|
5122
|
-
// our layout once.
|
|
5123
|
-
auditTime(0, SCROLL_SCHEDULER))
|
|
5124
|
-
.subscribe(() => {
|
|
5125
|
-
this._scrollStrategy.onContentScrolled();
|
|
5126
|
-
this.annaGtService.virtualScrollSubject.next(true);
|
|
5127
|
-
});
|
|
5128
|
-
this._markChangeDetectionNeeded();
|
|
5129
|
-
}));
|
|
5130
|
-
}
|
|
5131
|
-
ngOnDestroy() {
|
|
5132
|
-
this.detach();
|
|
5133
|
-
this._scrollStrategy.detach();
|
|
5134
|
-
// Complete all subjects
|
|
5135
|
-
this._renderedRangeSubject.complete();
|
|
5136
|
-
this._detachedSubject.complete();
|
|
5137
|
-
this._viewportChanges.unsubscribe();
|
|
5138
|
-
super.ngOnDestroy();
|
|
5139
|
-
}
|
|
5140
|
-
/** Attaches a `CdkVirtualScrollRepeater` to this viewport. */
|
|
5141
|
-
attach(forOf) {
|
|
5142
|
-
if (this._forOf) {
|
|
5143
|
-
throw Error("CdkVirtualScrollViewport is already attached.");
|
|
5144
|
-
}
|
|
5145
|
-
// Subscribe to the data stream of the CdkVirtualForOf to keep track of when the data length
|
|
5146
|
-
// changes. Run outside the zone to avoid triggering change detection, since we're managing the
|
|
5147
|
-
// change detection loop ourselves.
|
|
5148
|
-
this.ngZone.runOutsideAngular(() => {
|
|
5149
|
-
this._forOf = forOf;
|
|
5150
|
-
this._forOf.dataStream.pipe(takeUntil(this._detachedSubject)).subscribe((data) => {
|
|
5151
|
-
const newLength = data.length;
|
|
5152
|
-
if (newLength !== this._dataLength) {
|
|
5153
|
-
this._dataLength = newLength;
|
|
5154
|
-
this._scrollStrategy.onDataLengthChanged();
|
|
5155
|
-
}
|
|
5156
|
-
this._doChangeDetection();
|
|
5157
|
-
});
|
|
5158
|
-
});
|
|
5159
|
-
}
|
|
5160
|
-
/** Detaches the current `CdkVirtualForOf`. */
|
|
5161
|
-
detach() {
|
|
5162
|
-
this._forOf = null;
|
|
5163
|
-
this._detachedSubject.next();
|
|
5164
|
-
}
|
|
5165
|
-
/** Gets the length of the data bound to this viewport (in number of items). */
|
|
5166
|
-
getDataLength() {
|
|
5167
|
-
return this._dataLength;
|
|
5168
|
-
}
|
|
5169
|
-
/** Gets the size of the viewport (in pixels). */
|
|
5170
|
-
getViewportSize() {
|
|
5171
|
-
return this._viewportSize;
|
|
5172
|
-
}
|
|
5173
|
-
// TODO(mmalerba): This is technically out of sync with what's really rendered until a render
|
|
5174
|
-
// cycle happens. I'm being careful to only call it after the render cycle is complete and before
|
|
5175
|
-
// setting it to something else, but its error prone and should probably be split into
|
|
5176
|
-
// `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
|
|
5177
|
-
/** Get the current rendered range of items. */
|
|
5178
|
-
getRenderedRange() {
|
|
5179
|
-
return this._renderedRange;
|
|
5180
|
-
}
|
|
5181
|
-
/**
|
|
5182
|
-
* Sets the total size of all content (in pixels), including content that is not currently
|
|
5183
|
-
* rendered.
|
|
5184
|
-
*/
|
|
5185
|
-
setTotalContentSize(size) {
|
|
5186
|
-
if (this._totalContentSize !== size) {
|
|
5187
|
-
this._totalContentSize = size;
|
|
5188
|
-
this._calculateSpacerSize();
|
|
5189
|
-
this._markChangeDetectionNeeded();
|
|
5190
|
-
}
|
|
5191
|
-
}
|
|
5192
|
-
/** Sets the currently rendered range of indices. */
|
|
5193
|
-
setRenderedRange(range) {
|
|
5194
|
-
if (!rangesEqual(this._renderedRange, range)) {
|
|
5195
|
-
this._renderedRangeSubject.next((this._renderedRange = range));
|
|
5196
|
-
this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());
|
|
5197
|
-
}
|
|
5198
|
-
}
|
|
5199
|
-
/**
|
|
5200
|
-
* Gets the offset from the start of the viewport to the start of the rendered data (in pixels).
|
|
5201
|
-
*/
|
|
5202
|
-
getOffsetToRenderedContentStart() {
|
|
5203
|
-
return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;
|
|
5204
|
-
}
|
|
5205
|
-
/**
|
|
5206
|
-
* Sets the offset from the start of the viewport to either the start or end of the rendered data
|
|
5207
|
-
* (in pixels).
|
|
5208
|
-
*/
|
|
5209
|
-
setRenderedContentOffset(offset) {
|
|
5210
|
-
const top = `${Number(offset)}px`;
|
|
5211
|
-
this._renderedContentOffset = offset;
|
|
5212
|
-
if (this._renderedContentTransform !== top) {
|
|
5213
|
-
// We know this value is safe because we parse `offset` with `Number()` before passing it
|
|
5214
|
-
// into the string.
|
|
5215
|
-
this._renderedContentTransform = top;
|
|
5216
|
-
this._markChangeDetectionNeeded(() => {
|
|
5217
|
-
if (this._renderedContentOffsetNeedsRewrite) {
|
|
5218
|
-
this._renderedContentOffset -= this.measureRenderedContentSize();
|
|
5219
|
-
this._renderedContentOffsetNeedsRewrite = false;
|
|
5220
|
-
this.setRenderedContentOffset(this._renderedContentOffset);
|
|
5221
|
-
}
|
|
5222
|
-
else {
|
|
5223
|
-
this._scrollStrategy.onRenderedOffsetChanged();
|
|
5224
|
-
}
|
|
5225
|
-
});
|
|
5226
|
-
}
|
|
5227
|
-
}
|
|
5228
|
-
/**
|
|
5229
|
-
* Scrolls to the given offset from the start of the viewport. Please note that this is not always
|
|
5230
|
-
* the same as setting `scrollTop` or `scrollLeft`. In a horizontal viewport with right-to-left
|
|
5231
|
-
* direction, this would be the equivalent of setting a fictional `scrollRight` property.
|
|
5232
|
-
* @param offset The offset to scroll to.
|
|
5233
|
-
* @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
|
|
5234
|
-
*/
|
|
5235
|
-
scrollToOffset(offset, behavior = "auto") {
|
|
5236
|
-
const options = { behavior, top: offset };
|
|
5237
|
-
this.scrollTo(options);
|
|
5238
|
-
}
|
|
5239
|
-
/**
|
|
5240
|
-
* Scrolls to the offset for the given index.
|
|
5241
|
-
* @param index The index of the element to scroll to.
|
|
5242
|
-
* @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
|
|
5243
|
-
*/
|
|
5244
|
-
scrollToIndex(index, behavior = "auto") {
|
|
5245
|
-
this._scrollStrategy.scrollToIndex(index, behavior);
|
|
5246
|
-
}
|
|
5247
|
-
/**
|
|
5248
|
-
* Gets the current scroll offset from the start of the viewport (in pixels).
|
|
5249
|
-
* @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'
|
|
5250
|
-
* in horizontal mode.
|
|
5251
|
-
*/
|
|
5252
|
-
// CHANGES@ANNALIB added override to functions
|
|
5253
|
-
measureScrollOffset(from) {
|
|
5254
|
-
return from ? super.measureScrollOffset(from) : super.measureScrollOffset("top");
|
|
5255
|
-
}
|
|
5256
|
-
/** Measure the combined size of all of the rendered items. */
|
|
5257
|
-
measureRenderedContentSize() {
|
|
5258
|
-
const contentEl = this._contentWrapper.nativeElement;
|
|
5259
|
-
return contentEl.offsetHeight;
|
|
5260
|
-
}
|
|
5261
|
-
/**
|
|
5262
|
-
* Measure the total combined size of the given range. Throws if the range includes items that are
|
|
5263
|
-
* not rendered.
|
|
5264
|
-
*/
|
|
5265
|
-
measureRangeSize(range) {
|
|
5266
|
-
if (!this._forOf) {
|
|
5267
|
-
return 0;
|
|
5268
|
-
}
|
|
5269
|
-
return this._forOf.measureRangeSize(range, this.orientation);
|
|
5270
|
-
}
|
|
5271
|
-
/** Update the viewport dimensions and re-render. */
|
|
5272
|
-
checkViewportSize() {
|
|
5273
|
-
// TODO: Cleanup later when add logic for handling content resize
|
|
5274
|
-
this._measureViewportSize();
|
|
5275
|
-
this._scrollStrategy.onDataLengthChanged();
|
|
5276
|
-
}
|
|
5277
|
-
/** Measure the viewport size. */
|
|
5278
|
-
_measureViewportSize() {
|
|
5279
|
-
const viewportEl = this.elementRef.nativeElement;
|
|
5280
|
-
this._viewportSize = viewportEl.clientHeight;
|
|
5281
|
-
}
|
|
5282
|
-
/** Queue up change detection to run. */
|
|
5283
|
-
_markChangeDetectionNeeded(runAfter) {
|
|
5284
|
-
if (runAfter) {
|
|
5285
|
-
this._runAfterChangeDetection.push(runAfter);
|
|
5286
|
-
}
|
|
5287
|
-
// Use a Promise to batch together calls to `_doChangeDetection`. This way if we set a bunch of
|
|
5288
|
-
// properties sequentially we only have to run `_doChangeDetection` once at the end.
|
|
5289
|
-
if (!this._isChangeDetectionPending) {
|
|
5290
|
-
this._isChangeDetectionPending = true;
|
|
5291
|
-
this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {
|
|
5292
|
-
this._doChangeDetection();
|
|
5293
|
-
}));
|
|
5294
|
-
}
|
|
5295
|
-
}
|
|
5296
|
-
/** Run change detection. */
|
|
5297
|
-
_doChangeDetection() {
|
|
5298
|
-
this._isChangeDetectionPending = false;
|
|
5299
|
-
// Apply the content transform. The transform can't be set via an Angular binding because
|
|
5300
|
-
// bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of
|
|
5301
|
-
// string literals, a variable that can only be 'X' or 'Y', and user input that is run through
|
|
5302
|
-
// the `Number` function first to coerce it to a numeric value.
|
|
5303
|
-
this._contentWrapper.nativeElement.style.top = this._renderedContentTransform;
|
|
5304
|
-
// Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection
|
|
5305
|
-
// from the root, since the repeated items are content projected in. Calling `detectChanges`
|
|
5306
|
-
// instead does not properly check the projected content.
|
|
5307
|
-
this.ngZone.run(() => this._changeDetectorRef.markForCheck());
|
|
5308
|
-
const runAfterChangeDetection = this._runAfterChangeDetection;
|
|
5309
|
-
this._runAfterChangeDetection = [];
|
|
5310
|
-
runAfterChangeDetection.forEach((fn) => {
|
|
5311
|
-
fn();
|
|
5312
|
-
});
|
|
5313
|
-
}
|
|
5314
|
-
/** Calculates the `style.width` and `style.height` for the spacer element. */
|
|
5315
|
-
_calculateSpacerSize() {
|
|
5316
|
-
this._totalContentHeight = `${this._totalContentSize}px`;
|
|
5317
|
-
this._totalContentWidth = "";
|
|
5318
|
-
}
|
|
5319
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaTableVirtualScrollViewportComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: VIRTUAL_SCROLL_STRATEGY, optional: true }, { token: i1$1.Directionality, optional: true }, { token: i2$1.ScrollDispatcher }, { token: i2$1.ViewportRuler }, { token: AnnaGtHelperService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5320
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AnnaTableVirtualScrollViewportComponent, isStandalone: true, selector: "anna-core-table-virtual-scroll-viewport", inputs: { orientation: "orientation" }, outputs: { scrolledIndexChange: "scrolledIndexChange" }, host: { properties: { "class.anna-table-virtual-scroll-orientation-horizontal": "orientation === \"horizontal\"", "class.anna-table-virtual-scroll-orientation-vertical": "orientation !== \"horizontal\"" }, classAttribute: "anna-table-virtual-scroll-viewport" }, providers: [
|
|
5321
|
-
{
|
|
5322
|
-
provide: CdkScrollable,
|
|
5323
|
-
useExisting: AnnaTableVirtualScrollViewportComponent,
|
|
5324
|
-
},
|
|
5325
|
-
{
|
|
5326
|
-
provide: CdkVirtualScrollViewport,
|
|
5327
|
-
useExisting: AnnaTableVirtualScrollViewportComponent,
|
|
5328
|
-
},
|
|
5329
|
-
], viewQueries: [{ propertyName: "_contentWrapper", first: true, predicate: ["contentWrapper"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!--\n Wrap the rendered content in an element that will be used to offset it based on the scroll\n position.\n-->\n<div\n #contentWrapper\n class=\"anna-table-virtual-scroll-content-wrapper\"\n>\n <ng-content></ng-content>\n</div>\n<!--\n Spacer used to force the scrolling container to the correct size for the *total* number of items\n so that the scrollbar captures the size of the entire data set.\n-->\n<div\n class=\"app-table-virtual-scroll-spacer\"\n [style.width]=\"_totalContentWidth\"\n [style.height]=\"_totalContentHeight\"\n></div>\n", styles: ["anna-table-virtual-scroll-viewport{display:block;position:relative;overflow:auto;contain:strict;will-change:scroll-position;-webkit-overflow-scrolling:touch}.anna-table-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .anna-table-virtual-scroll-content-wrapper{right:0;left:auto}.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper{min-height:100%}.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper{min-width:100%}.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.app-table-virtual-scroll-spacer{position:absolute;top:0;left:0;height:1px;width:1px;transform-origin:0 0}[dir=rtl] .app-table-virtual-scroll-spacer{right:0;left:auto;transform-origin:100% 0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
5330
|
-
}
|
|
5331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaTableVirtualScrollViewportComponent, decorators: [{
|
|
5332
|
-
type: Component,
|
|
5333
|
-
args: [{ selector: "anna-core-table-virtual-scroll-viewport", host: {
|
|
5334
|
-
class: "anna-table-virtual-scroll-viewport",
|
|
5335
|
-
"[class.anna-table-virtual-scroll-orientation-horizontal]": 'orientation === "horizontal"',
|
|
5336
|
-
"[class.anna-table-virtual-scroll-orientation-vertical]": 'orientation !== "horizontal"',
|
|
5337
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
5338
|
-
{
|
|
5339
|
-
provide: CdkScrollable,
|
|
5340
|
-
useExisting: AnnaTableVirtualScrollViewportComponent,
|
|
5341
|
-
},
|
|
5342
|
-
{
|
|
5343
|
-
provide: CdkVirtualScrollViewport,
|
|
5344
|
-
useExisting: AnnaTableVirtualScrollViewportComponent,
|
|
5345
|
-
},
|
|
5346
|
-
], standalone: true, template: "<!--\n Wrap the rendered content in an element that will be used to offset it based on the scroll\n position.\n-->\n<div\n #contentWrapper\n class=\"anna-table-virtual-scroll-content-wrapper\"\n>\n <ng-content></ng-content>\n</div>\n<!--\n Spacer used to force the scrolling container to the correct size for the *total* number of items\n so that the scrollbar captures the size of the entire data set.\n-->\n<div\n class=\"app-table-virtual-scroll-spacer\"\n [style.width]=\"_totalContentWidth\"\n [style.height]=\"_totalContentHeight\"\n></div>\n", styles: ["anna-table-virtual-scroll-viewport{display:block;position:relative;overflow:auto;contain:strict;will-change:scroll-position;-webkit-overflow-scrolling:touch}.anna-table-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .anna-table-virtual-scroll-content-wrapper{right:0;left:auto}.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper{min-height:100%}.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-horizontal .anna-table-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper{min-width:100%}.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.app-table-virtual-scroll-orientation-vertical .anna-table-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.app-table-virtual-scroll-spacer{position:absolute;top:0;left:0;height:1px;width:1px;transform-origin:0 0}[dir=rtl] .app-table-virtual-scroll-spacer{right:0;left:auto;transform-origin:100% 0}\n"] }]
|
|
5347
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
5348
|
-
type: Optional
|
|
5349
|
-
}, {
|
|
5350
|
-
type: Inject,
|
|
5351
|
-
args: [VIRTUAL_SCROLL_STRATEGY]
|
|
5352
|
-
}] }, { type: i1$1.Directionality, decorators: [{
|
|
5353
|
-
type: Optional
|
|
5354
|
-
}] }, { type: i2$1.ScrollDispatcher }, { type: i2$1.ViewportRuler }, { type: AnnaGtHelperService }]; }, propDecorators: { orientation: [{
|
|
5355
|
-
type: Input
|
|
5356
|
-
}], scrolledIndexChange: [{
|
|
5357
|
-
type: Output
|
|
5358
|
-
}], _contentWrapper: [{
|
|
5359
|
-
type: ViewChild,
|
|
5360
|
-
args: ["contentWrapper", { static: true }]
|
|
5361
|
-
}] } });
|
|
5362
|
-
|
|
5363
|
-
/**
|
|
5364
|
-
* A custom scroll strategy that accepts a static row height, static header height,
|
|
5365
|
-
* and a buffer size. The strategy
|
|
5366
|
-
*/
|
|
5367
|
-
class AnnaFixedRowSizeTableVirtualScrollStrategy {
|
|
5368
|
-
constructor(rowHeight, buffer, headerHeight) {
|
|
5369
|
-
this.scrolledIndexChangeSubject = new Subject();
|
|
5370
|
-
this.scrolledIndexChange = this.scrolledIndexChangeSubject.pipe(distinctUntilChanged());
|
|
5371
|
-
this.updateRowHeightAndBuffer(rowHeight, buffer, headerHeight);
|
|
5372
|
-
}
|
|
5373
|
-
/**
|
|
5374
|
-
* Attaches this scroll strategy to a viewport.
|
|
5375
|
-
* @param viewport The viewport to attach this strategy to.
|
|
5376
|
-
*/
|
|
5377
|
-
attach(viewport) {
|
|
5378
|
-
this.viewport = viewport;
|
|
5379
|
-
this.updateTotalContentSize();
|
|
5380
|
-
this.updateRenderedRange();
|
|
5381
|
-
}
|
|
5382
|
-
/**
|
|
5383
|
-
* Detaches this scroll strategy from the currently attached viewport.
|
|
5384
|
-
*/
|
|
5385
|
-
detach() {
|
|
5386
|
-
this.scrolledIndexChangeSubject.complete();
|
|
5387
|
-
this.viewport = null;
|
|
5388
|
-
}
|
|
5389
|
-
onContentScrolled() {
|
|
5390
|
-
this.updateRenderedRange();
|
|
5391
|
-
}
|
|
5392
|
-
onDataLengthChanged() {
|
|
5393
|
-
this.updateTotalContentSize();
|
|
5394
|
-
this.updateRenderedRange();
|
|
5395
|
-
}
|
|
5396
|
-
onContentRendered() {
|
|
5397
|
-
// This method is useful for virtual scroll strategies that measure the rendered
|
|
5398
|
-
// content to determine its height. This scroll strategy assumes that rows have
|
|
5399
|
-
// a static height, so there's no need to implement this method.
|
|
5400
|
-
}
|
|
5401
|
-
onRenderedOffsetChanged() {
|
|
5402
|
-
// Similar to onContentRendered, this method is useful for virtual scroll strategies
|
|
5403
|
-
// that need to track the offset as it changes. This scroll strategy is always able
|
|
5404
|
-
// to calculate the correct offset from other values, so there's no need to implement
|
|
5405
|
-
// this method.
|
|
5406
|
-
}
|
|
5407
|
-
scrollToIndex(index, behavior) {
|
|
5408
|
-
this.viewport?.scrollToOffset(index * this.rowHeight, behavior);
|
|
5409
|
-
}
|
|
5410
|
-
/**
|
|
5411
|
-
* Update the item size and buffer size.
|
|
5412
|
-
* @param rowHeight The height of a row in the virtually scrolling table.
|
|
5413
|
-
* @param buffer The number of rows to buffer outside the viewport.
|
|
5414
|
-
* @param headerHeight The total height of the table header, including all header rows.
|
|
5415
|
-
*/
|
|
5416
|
-
updateRowHeightAndBuffer(rowHeight, buffer, headerHeight) {
|
|
5417
|
-
this.rowHeight = rowHeight;
|
|
5418
|
-
this.buffer = buffer;
|
|
5419
|
-
this.headerHeight = headerHeight;
|
|
5420
|
-
this.updateTotalContentSize();
|
|
5421
|
-
this.updateRenderedRange();
|
|
5422
|
-
}
|
|
5423
|
-
updateRenderedRange() {
|
|
5424
|
-
if (!this.viewport) {
|
|
5425
|
-
return;
|
|
5426
|
-
}
|
|
5427
|
-
const viewportSize = this.viewport.getViewportSize();
|
|
5428
|
-
const dataLength = this.viewport.getDataLength();
|
|
5429
|
-
const scrollOffset = this.viewport.measureScrollOffset();
|
|
5430
|
-
// the index of the first item that would be at least partially visible in the viewport
|
|
5431
|
-
const firstVisibleIndex = Math.floor((scrollOffset + this.headerHeight) / this.rowHeight);
|
|
5432
|
-
// if the buffer size is 10 but the first visible item is at, say, index 7
|
|
5433
|
-
// then the buffered items must be 7, because we don't have 10 items available to buffer.
|
|
5434
|
-
const bufferedItems = Math.min(AnnaFilterService.bufferSize, firstVisibleIndex);
|
|
5435
|
-
const itemsInViewport = Math.ceil(viewportSize / this.rowHeight);
|
|
5436
|
-
const itemsToRender = itemsInViewport + this.buffer;
|
|
5437
|
-
// Clamp the new range between 0 and dataLength
|
|
5438
|
-
const newStart = Math.max(0, firstVisibleIndex - bufferedItems);
|
|
5439
|
-
const newEnd = Math.min(dataLength, firstVisibleIndex + itemsToRender);
|
|
5440
|
-
const newRange = {
|
|
5441
|
-
start: newStart,
|
|
5442
|
-
end: newEnd,
|
|
5443
|
-
};
|
|
5444
|
-
const newOffset = this.rowHeight * (firstVisibleIndex - bufferedItems);
|
|
5445
|
-
this.viewport.setRenderedContentOffset(newOffset);
|
|
5446
|
-
this.viewport.setRenderedRange(newRange);
|
|
5447
|
-
this.scrolledIndexChangeSubject.next(Math.floor(firstVisibleIndex));
|
|
5448
|
-
}
|
|
5449
|
-
updateTotalContentSize() {
|
|
5450
|
-
this.viewport?.setTotalContentSize(this.viewport.getDataLength() * this.rowHeight);
|
|
5451
|
-
}
|
|
5452
|
-
}
|
|
5453
|
-
/**
|
|
5454
|
-
* Provider factory for `FixedSizeVirtualScrollStrategy` that simply extracts the already created
|
|
5455
|
-
* `FixedSizeVirtualScrollStrategy` from the given directive.
|
|
5456
|
-
* @param fixedSizeDir The instance of `CdkFixedSizeVirtualScroll` to extract the
|
|
5457
|
-
* `FixedSizeVirtualScrollStrategy` from.
|
|
5458
|
-
*/
|
|
5459
|
-
function fixedSizeVirtualScrollStrategyFactory(fixedSizeDir) {
|
|
5460
|
-
return fixedSizeDir.scrollStrategy;
|
|
5461
|
-
}
|
|
5462
|
-
class AnnaFixedRowSizeTableVirtualScrollStrategyDirective {
|
|
5463
|
-
constructor() {
|
|
5464
|
-
this.heightOfRow = 30;
|
|
5465
|
-
this.heightOfHeaderRow = 30;
|
|
5466
|
-
this.bufferForRows = 20;
|
|
5467
|
-
this.noOfHeaderRows = null;
|
|
5468
|
-
this.headerRowCount = 1;
|
|
5469
|
-
/** The scroll strategy used by this directive. */
|
|
5470
|
-
this.scrollStrategy = new AnnaFixedRowSizeTableVirtualScrollStrategy(this.rowHeight, this.buffer, this.headerRowHeight * this.headerRowCount);
|
|
5471
|
-
}
|
|
5472
|
-
/** The height of rows in the table (in pixels). Defaults to 30. */
|
|
5473
|
-
set rowHeight(value) {
|
|
5474
|
-
this.heightOfRow = coerceNumberProperty(value);
|
|
5475
|
-
}
|
|
5476
|
-
get rowHeight() {
|
|
5477
|
-
return this.heightOfRow;
|
|
5478
|
-
}
|
|
5479
|
-
/**
|
|
5480
|
-
* The height of header rows in the table (in pixels). Defaults to 30.
|
|
5481
|
-
*/
|
|
5482
|
-
set headerRowHeight(value) {
|
|
5483
|
-
this.heightOfHeaderRow = coerceNumberProperty(value);
|
|
5484
|
-
}
|
|
5485
|
-
get headerRowHeight() {
|
|
5486
|
-
return this.heightOfHeaderRow;
|
|
5487
|
-
}
|
|
5488
|
-
/**
|
|
5489
|
-
* The number of buffered rows rendered beyond the viewport.
|
|
5490
|
-
* If the number of buffered rows dips below this number, more rows will be rendered. Defaults to 20.
|
|
5491
|
-
*/
|
|
5492
|
-
set buffer(value) {
|
|
5493
|
-
this.bufferForRows = coerceNumberProperty(value);
|
|
5494
|
-
}
|
|
5495
|
-
get buffer() {
|
|
5496
|
-
return this.bufferForRows;
|
|
5497
|
-
}
|
|
5498
|
-
set headerRows(value) {
|
|
5499
|
-
this.noOfHeaderRows = coerceNumberProperty(value, undefined);
|
|
5500
|
-
}
|
|
5501
|
-
get headerRows() {
|
|
5502
|
-
return this.noOfHeaderRows;
|
|
5503
|
-
}
|
|
5504
|
-
ngOnChanges(change) {
|
|
5505
|
-
if (this.headerRows !== undefined || this.headerRowsQuery) {
|
|
5506
|
-
this.handleChange();
|
|
5507
|
-
}
|
|
5508
|
-
if (change.buffer?.previousValue !== change.buffer?.currentValue) {
|
|
5509
|
-
AnnaFilterService.bufferSize = this.buffer;
|
|
5510
|
-
this.scrollStrategy = new AnnaFixedRowSizeTableVirtualScrollStrategy(this.rowHeight, this.buffer, this.headerRowHeight * this.headerRowCount);
|
|
5511
|
-
}
|
|
5512
|
-
}
|
|
5513
|
-
ngAfterContentInit() {
|
|
5514
|
-
this.headerRowsQuery.changes.subscribe(() => {
|
|
5515
|
-
this.handleChange();
|
|
5516
|
-
});
|
|
5517
|
-
}
|
|
5518
|
-
handleChange() {
|
|
5519
|
-
this.scrollStrategy.updateRowHeightAndBuffer(this.rowHeight, this.buffer,
|
|
5520
|
-
// Use the explicit headerRows input value if set.
|
|
5521
|
-
// Otherwise, fall back to the QueryList length.
|
|
5522
|
-
this.headerRowHeight * (this.noOfHeaderRows ?? this.headerRowsQuery.length));
|
|
5523
|
-
}
|
|
5524
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFixedRowSizeTableVirtualScrollStrategyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
5525
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AnnaFixedRowSizeTableVirtualScrollStrategyDirective, isStandalone: true, selector: "cdk-virtual-scroll-viewport[rowHeight], anna-table-virtual-scroll-viewport[rowHeight]", inputs: { rowHeight: "rowHeight", headerRowHeight: "headerRowHeight", buffer: "buffer", headerRows: "headerRows" }, providers: [
|
|
5526
|
-
{
|
|
5527
|
-
provide: VIRTUAL_SCROLL_STRATEGY,
|
|
5528
|
-
useFactory: fixedSizeVirtualScrollStrategyFactory,
|
|
5529
|
-
deps: [forwardRef(() => AnnaFixedRowSizeTableVirtualScrollStrategyDirective)],
|
|
5530
|
-
},
|
|
5531
|
-
], queries: [{ propertyName: "headerRowsQuery", predicate: MatHeaderRowDef }], usesOnChanges: true, ngImport: i0 }); }
|
|
5532
|
-
}
|
|
5533
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFixedRowSizeTableVirtualScrollStrategyDirective, decorators: [{
|
|
5534
|
-
type: Directive,
|
|
5535
|
-
args: [{
|
|
5536
|
-
selector: "cdk-virtual-scroll-viewport[rowHeight], anna-table-virtual-scroll-viewport[rowHeight]",
|
|
5537
|
-
providers: [
|
|
5538
|
-
{
|
|
5539
|
-
provide: VIRTUAL_SCROLL_STRATEGY,
|
|
5540
|
-
useFactory: fixedSizeVirtualScrollStrategyFactory,
|
|
5541
|
-
deps: [forwardRef(() => AnnaFixedRowSizeTableVirtualScrollStrategyDirective)],
|
|
5542
|
-
},
|
|
5543
|
-
],
|
|
5544
|
-
standalone: true,
|
|
5545
|
-
}]
|
|
5546
|
-
}], propDecorators: { rowHeight: [{
|
|
5547
|
-
type: Input
|
|
5548
|
-
}], headerRowHeight: [{
|
|
5549
|
-
type: Input
|
|
5550
|
-
}], buffer: [{
|
|
5551
|
-
type: Input
|
|
5552
|
-
}], headerRows: [{
|
|
5553
|
-
type: Input
|
|
5554
|
-
}], headerRowsQuery: [{
|
|
5555
|
-
type: ContentChildren,
|
|
5556
|
-
args: [MatHeaderRowDef]
|
|
5557
|
-
}] } });
|
|
5558
|
-
|
|
5559
|
-
/* eslint-disable no-underscore-dangle */
|
|
5560
|
-
/**
|
|
5561
|
-
* Directive that wraps a given data source in a "virtual" data source that emits
|
|
5562
|
-
* the slice of the original data source that matches the range that should be rendered
|
|
5563
|
-
* in the containing virtual scroll viewport.
|
|
5564
|
-
*/
|
|
5565
|
-
class AnnaVirtualTableDirective {
|
|
5566
|
-
set dataSource(value) {
|
|
5567
|
-
this.tableDataSource = value;
|
|
5568
|
-
if (isDataSource(value)) {
|
|
5569
|
-
this.dataSourceChanges.next(value);
|
|
5570
|
-
}
|
|
5571
|
-
else {
|
|
5572
|
-
this.dataSourceChanges.next(new ArrayDataSource(isObservable(value) ? value : Array.from(value || [])));
|
|
5573
|
-
}
|
|
5574
|
-
}
|
|
5575
|
-
get dataSource() {
|
|
5576
|
-
return this.tableDataSource;
|
|
5577
|
-
}
|
|
5578
|
-
constructor(elementRef, viewport, table, ngZone, _coalescedStyleScheduler) {
|
|
5579
|
-
this.viewport = viewport;
|
|
5580
|
-
this.table = table;
|
|
5581
|
-
this._coalescedStyleScheduler = _coalescedStyleScheduler;
|
|
5582
|
-
this.virtualizedDataStream = new Subject();
|
|
5583
|
-
this.dataSourceChanges = new Subject();
|
|
5584
|
-
/** The raw, unvirtualized data stream. Emits whenever the data in the current DataSource changes. */
|
|
5585
|
-
this.dataStream = this.dataSourceChanges.pipe(
|
|
5586
|
-
// Start off with null data source.
|
|
5587
|
-
startWith(null),
|
|
5588
|
-
// Bundle up the previous and current data sources so we can work with both.
|
|
5589
|
-
pairwise(),
|
|
5590
|
-
// Use `changeDataSource` to disconnect from the previous data source and connect to the
|
|
5591
|
-
// new one, passing back a stream of data changes which we run through `switchMap` to give
|
|
5592
|
-
// us a data stream that emits the latest data from whatever the current data source is.
|
|
5593
|
-
switchMap(([prev, cur]) => this.changeDataSource(prev, cur)),
|
|
5594
|
-
// Replay the last emitted data when someone subscribes.
|
|
5595
|
-
shareReplay(1));
|
|
5596
|
-
this.viewChange = new Subject();
|
|
5597
|
-
this.destroyed$ = new Subject();
|
|
5598
|
-
this.renderedRange = { start: 0, end: 0 };
|
|
5599
|
-
this.isNativeHtmlTable = false;
|
|
5600
|
-
table.dataSource = this.virtualizedDataStream;
|
|
5601
|
-
this.isNativeHtmlTable = elementRef.nativeElement.tagName === "TABLE";
|
|
5602
|
-
this.dataStream.subscribe((data) => {
|
|
5603
|
-
this.data = data;
|
|
5604
|
-
this.onRenderedDataChange();
|
|
5605
|
-
});
|
|
5606
|
-
viewport.renderedRangeStream.pipe(takeUntil(this.destroyed$)).subscribe((range) => {
|
|
5607
|
-
this.renderedRange = range;
|
|
5608
|
-
ngZone.run(() => this.viewChange.next(range));
|
|
5609
|
-
this.onRenderedDataChange();
|
|
5610
|
-
});
|
|
5611
|
-
viewport.attach(this);
|
|
5612
|
-
}
|
|
5613
|
-
ngOnInit() {
|
|
5614
|
-
// This is just a proof of concept, but the AnnaTableVirtualScrollViewportComponent uses `position: absolute`
|
|
5615
|
-
// and `top: #px` instead of `transform: translateY(#px)` to position the viewport.
|
|
5616
|
-
// This removes the need to account for the translation in the `top` of the sticky header rows.
|
|
5617
|
-
if (this.viewport instanceof AnnaTableVirtualScrollViewportComponent) {
|
|
5618
|
-
return;
|
|
5619
|
-
}
|
|
5620
|
-
this.viewport.scrolledIndexChange
|
|
5621
|
-
.pipe(map$1(() => this.viewport.getOffsetToRenderedContentStart()), takeUntil(this.destroyed$))
|
|
5622
|
-
.subscribe((offset) => {
|
|
5623
|
-
// We need to set the `style.top` property of the sticky header rows
|
|
5624
|
-
// to the negative value of the virtual scroll viewport's offset, so
|
|
5625
|
-
// make the offset negative.
|
|
5626
|
-
offset = -offset;
|
|
5627
|
-
const stickyStates = this.headerRowDefs.map((rowDef) => rowDef.sticky);
|
|
5628
|
-
// This logic is exactly the same as what's in the StickyStyler (literally copy + paste).
|
|
5629
|
-
// The only difference is that the `stickyOffset` variable starts at the virtual scroll
|
|
5630
|
-
// viewport container's offset instead of starting at zero.
|
|
5631
|
-
const rows = this.table._getRenderedRows(this.table._headerRowOutlet);
|
|
5632
|
-
const stickyOffsets = [];
|
|
5633
|
-
const stickyCellHeights = [];
|
|
5634
|
-
const elementsToStick = [];
|
|
5635
|
-
for (let rowIndex = 0, stickyOffset = offset; rowIndex < rows.length; rowIndex++) {
|
|
5636
|
-
stickyOffsets[rowIndex] = stickyOffset;
|
|
5637
|
-
if (!stickyStates[rowIndex]) {
|
|
5638
|
-
continue;
|
|
5639
|
-
}
|
|
5640
|
-
const row = rows[rowIndex];
|
|
5641
|
-
elementsToStick[rowIndex] = this.isNativeHtmlTable
|
|
5642
|
-
? Array.from(row.children)
|
|
5643
|
-
: [row];
|
|
5644
|
-
const { height } = row.getBoundingClientRect();
|
|
5645
|
-
stickyOffset += height;
|
|
5646
|
-
stickyCellHeights[rowIndex] = height;
|
|
5647
|
-
}
|
|
5648
|
-
// Using the CoalescedStyleScheduler here is optional. It'll work without it,
|
|
5649
|
-
// and CoalescedStyleScheduler is not public (yet?), so feel free to remove it.
|
|
5650
|
-
this._coalescedStyleScheduler.schedule(() => {
|
|
5651
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
5652
|
-
if (!stickyStates[rowIndex]) {
|
|
5653
|
-
continue;
|
|
5654
|
-
}
|
|
5655
|
-
elementsToStick[rowIndex].forEach((element) => {
|
|
5656
|
-
element.style.top = `${stickyOffsets[rowIndex]}px`;
|
|
5657
|
-
});
|
|
5658
|
-
}
|
|
5659
|
-
});
|
|
5660
|
-
});
|
|
5661
|
-
}
|
|
5662
|
-
ngOnDestroy() {
|
|
5663
|
-
this.destroyed$.next();
|
|
5664
|
-
this.dataSourceChanges.complete();
|
|
5665
|
-
this.virtualizedDataStream.complete();
|
|
5666
|
-
}
|
|
5667
|
-
/** React to scroll state changes in the viewport. */
|
|
5668
|
-
onRenderedDataChange() {
|
|
5669
|
-
if (!this.renderedRange) {
|
|
5670
|
-
return;
|
|
5671
|
-
}
|
|
5672
|
-
this.renderedItems = this.data.slice(this.renderedRange.start, this.renderedRange.end + 1);
|
|
5673
|
-
// delegate rendering to the table by emitting from the virtualizedDataStream
|
|
5674
|
-
this.virtualizedDataStream.next(this.renderedItems);
|
|
5675
|
-
}
|
|
5676
|
-
/** Swap out one data source for another. */
|
|
5677
|
-
changeDataSource(oldDataSource, newDs) {
|
|
5678
|
-
oldDataSource?.disconnect(this);
|
|
5679
|
-
return newDs ? newDs.connect(this) : of();
|
|
5680
|
-
}
|
|
5681
|
-
/**
|
|
5682
|
-
* This method is only used by the experimental AutoSizeVirtualScrollStrategy.
|
|
5683
|
-
* We're not using that strategy, but I've implemented it just to show how it oculd be done.
|
|
5684
|
-
* I'm not actually sure if this works.
|
|
5685
|
-
*/
|
|
5686
|
-
measureRangeSize(range, orientation) {
|
|
5687
|
-
if (orientation === "horizontal" || range.end < range.start) {
|
|
5688
|
-
// virtual scrolling columns are not supported by this directive
|
|
5689
|
-
return 0;
|
|
5690
|
-
}
|
|
5691
|
-
const renderedBodyRows = this.table._getRenderedRows(this.table._rowOutlet);
|
|
5692
|
-
const firstRow = renderedBodyRows[range.start];
|
|
5693
|
-
const lastRow = renderedBodyRows[range.end];
|
|
5694
|
-
if (!firstRow || !lastRow) {
|
|
5695
|
-
return 0;
|
|
5696
|
-
}
|
|
5697
|
-
// We need to include all header and footer rows in the sum, since they're always rendered
|
|
5698
|
-
const renderedHeaderRows = this.table._getRenderedRows(this.table._headerRowOutlet);
|
|
5699
|
-
const renderedFooterRows = this.table._getRenderedRows(this.table._footerRowOutlet);
|
|
5700
|
-
// TODO (performance): Can we just measure the offset of the first and last items
|
|
5701
|
-
// and do some math to avoid having to measure each row individually?
|
|
5702
|
-
const headerHeight = renderedHeaderRows.reduce((sum, row) => {
|
|
5703
|
-
const updatedSum = sum + row.getBoundingClientRect().height;
|
|
5704
|
-
return updatedSum;
|
|
5705
|
-
}, 0);
|
|
5706
|
-
const footerHeight = renderedFooterRows.reduce((sum, row) => {
|
|
5707
|
-
const updatedSum = sum + row.getBoundingClientRect().height;
|
|
5708
|
-
return updatedSum;
|
|
5709
|
-
}, 0);
|
|
5710
|
-
const bodyHeight = lastRow.getBoundingClientRect().bottom - firstRow.getBoundingClientRect().top;
|
|
5711
|
-
return headerHeight + footerHeight + bodyHeight;
|
|
5712
|
-
}
|
|
5713
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaVirtualTableDirective, deps: [{ token: i0.ElementRef }, { token: i2$1.CdkVirtualScrollViewport }, { token: i2$2.CdkTable }, { token: i0.NgZone }, { token: _COALESCED_STYLE_SCHEDULER }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
5714
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AnnaVirtualTableDirective, isStandalone: true, selector: "[mat-table][appVirtualDataSource], mat-table[appVirtualDataSource]", inputs: { dataSource: ["appVirtualDataSource", "dataSource"] }, providers: [{ provide: STICKY_POSITIONING_LISTENER, useExisting: AnnaVirtualTableDirective }], queries: [{ propertyName: "headerRowDefs", predicate: CdkHeaderRowDef }], ngImport: i0 }); }
|
|
5715
|
-
}
|
|
5716
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaVirtualTableDirective, decorators: [{
|
|
5717
|
-
type: Directive,
|
|
5718
|
-
args: [{
|
|
5719
|
-
selector: "[mat-table][appVirtualDataSource], mat-table[appVirtualDataSource]",
|
|
5720
|
-
providers: [{ provide: STICKY_POSITIONING_LISTENER, useExisting: AnnaVirtualTableDirective }],
|
|
5721
|
-
standalone: true,
|
|
5722
|
-
}]
|
|
5723
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.CdkVirtualScrollViewport }, { type: i2$2.CdkTable }, { type: i0.NgZone }, { type: i2$2._CoalescedStyleScheduler, decorators: [{
|
|
5724
|
-
type: Inject,
|
|
5725
|
-
args: [_COALESCED_STYLE_SCHEDULER]
|
|
5726
|
-
}] }]; }, propDecorators: { dataSource: [{
|
|
5727
|
-
type: Input,
|
|
5728
|
-
args: ["appVirtualDataSource"]
|
|
5729
|
-
}], headerRowDefs: [{
|
|
5730
|
-
type: ContentChildren,
|
|
5731
|
-
args: [CdkHeaderRowDef]
|
|
5732
|
-
}] } });
|
|
5733
|
-
|
|
5734
4874
|
/* eslint-disable max-len */
|
|
5735
4875
|
class AnnaCoreModule {
|
|
5736
4876
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -5758,10 +4898,7 @@ class AnnaCoreModule {
|
|
|
5758
4898
|
AnnaWeekCalendarComponent,
|
|
5759
4899
|
AnnaCalendarFilterComponent,
|
|
5760
4900
|
AnnaSortComponent,
|
|
5761
|
-
AnnaVirtualTableDirective,
|
|
5762
4901
|
AnnaNonEditableGenericTableComponent,
|
|
5763
|
-
AnnaTableVirtualScrollViewportComponent,
|
|
5764
|
-
AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
|
|
5765
4902
|
DigitOnlyDirective,
|
|
5766
4903
|
AnnaColumnDateRangeFilterComponent,
|
|
5767
4904
|
AnnaColumnTimeFilterComponent,
|
|
@@ -5787,13 +4924,10 @@ class AnnaCoreModule {
|
|
|
5787
4924
|
AnnaWeekCalendarComponent,
|
|
5788
4925
|
AnnaCalendarFilterComponent,
|
|
5789
4926
|
AnnaSortComponent,
|
|
5790
|
-
AnnaVirtualTableDirective,
|
|
5791
4927
|
AnnaNonEditableGenericTableComponent,
|
|
5792
|
-
AnnaTableVirtualScrollViewportComponent,
|
|
5793
4928
|
AnnaColumnDateRangeFilterComponent,
|
|
5794
4929
|
AnnaColumnTimeFilterComponent,
|
|
5795
4930
|
AnnaColumnCheckboxFilterComponent,
|
|
5796
|
-
AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
|
|
5797
4931
|
DigitOnlyDirective,
|
|
5798
4932
|
AnnaDeletedOrderIconTemplateComponent,
|
|
5799
4933
|
AnnaColumnSliderFilterComponent,
|
|
@@ -5862,10 +4996,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
5862
4996
|
AnnaWeekCalendarComponent,
|
|
5863
4997
|
AnnaCalendarFilterComponent,
|
|
5864
4998
|
AnnaSortComponent,
|
|
5865
|
-
AnnaVirtualTableDirective,
|
|
5866
4999
|
AnnaNonEditableGenericTableComponent,
|
|
5867
|
-
AnnaTableVirtualScrollViewportComponent,
|
|
5868
|
-
AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
|
|
5869
5000
|
DigitOnlyDirective,
|
|
5870
5001
|
AnnaColumnDateRangeFilterComponent,
|
|
5871
5002
|
AnnaColumnTimeFilterComponent,
|
|
@@ -5894,13 +5025,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
5894
5025
|
AnnaWeekCalendarComponent,
|
|
5895
5026
|
AnnaCalendarFilterComponent,
|
|
5896
5027
|
AnnaSortComponent,
|
|
5897
|
-
AnnaVirtualTableDirective,
|
|
5898
5028
|
AnnaNonEditableGenericTableComponent,
|
|
5899
|
-
AnnaTableVirtualScrollViewportComponent,
|
|
5900
5029
|
AnnaColumnDateRangeFilterComponent,
|
|
5901
5030
|
AnnaColumnTimeFilterComponent,
|
|
5902
5031
|
AnnaColumnCheckboxFilterComponent,
|
|
5903
|
-
AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
|
|
5904
5032
|
DigitOnlyDirective,
|
|
5905
5033
|
AnnaDeletedOrderIconTemplateComponent,
|
|
5906
5034
|
AnnaColumnSliderFilterComponent,
|
|
@@ -5911,6 +5039,145 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
5911
5039
|
}]
|
|
5912
5040
|
}] });
|
|
5913
5041
|
|
|
5042
|
+
class AnnaGtHelperService {
|
|
5043
|
+
constructor(annaFilterService, router, route, annaSortService) {
|
|
5044
|
+
this.annaFilterService = annaFilterService;
|
|
5045
|
+
this.router = router;
|
|
5046
|
+
this.route = route;
|
|
5047
|
+
this.annaSortService = annaSortService;
|
|
5048
|
+
this.virtualScrollSubject = new Subject();
|
|
5049
|
+
}
|
|
5050
|
+
calculateNumberOfSkeletonColumnsForTable(tableHeaders) {
|
|
5051
|
+
const numberOfSkeletonColumns = [];
|
|
5052
|
+
let headersInEachColumn = 0;
|
|
5053
|
+
tableHeaders.forEach((column) => {
|
|
5054
|
+
if (column.visible) {
|
|
5055
|
+
headersInEachColumn = 0;
|
|
5056
|
+
column.headerInfo.forEach(() => {
|
|
5057
|
+
headersInEachColumn += 1;
|
|
5058
|
+
});
|
|
5059
|
+
numberOfSkeletonColumns.push(Array(headersInEachColumn).fill(0));
|
|
5060
|
+
}
|
|
5061
|
+
});
|
|
5062
|
+
return numberOfSkeletonColumns;
|
|
5063
|
+
}
|
|
5064
|
+
initColumnFilterAndSorting() {
|
|
5065
|
+
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
5066
|
+
this.annaFilterService.selectedRadio = null;
|
|
5067
|
+
this.annaFilterService.appliedFiltersArray = [];
|
|
5068
|
+
this.annaFilterService.initialValueMap = new Map();
|
|
5069
|
+
this.annaSortService.columnSortState = new Map();
|
|
5070
|
+
this.annaSortService.noSortingAppliedData = [];
|
|
5071
|
+
}
|
|
5072
|
+
enableOrDisableClearAllBtn() {
|
|
5073
|
+
const isFilterApplied = this.annaFilterService.appliedFiltersArray.length > 0;
|
|
5074
|
+
const isSortApplied = this.isSortingAppliedToTable();
|
|
5075
|
+
return !(isFilterApplied || isSortApplied);
|
|
5076
|
+
}
|
|
5077
|
+
updateFiltersInURL() {
|
|
5078
|
+
const latestQueryParams = this.prepareQueryParamsOnFilter();
|
|
5079
|
+
if (Object.keys(latestQueryParams).length > 0) {
|
|
5080
|
+
this.router.navigate([], {
|
|
5081
|
+
queryParams: { filters: JSON.stringify(latestQueryParams) },
|
|
5082
|
+
relativeTo: this.route.parent,
|
|
5083
|
+
queryParamsHandling: "merge",
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
else {
|
|
5087
|
+
this.router.navigate([], {
|
|
5088
|
+
relativeTo: this.route.parent,
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
prepareQueryParamsOnFilter() {
|
|
5093
|
+
const query = {};
|
|
5094
|
+
if (this.annaFilterService.appliedFiltersArray.length > 0) {
|
|
5095
|
+
query.appliedFilters = this.annaFilterService.appliedFiltersArray;
|
|
5096
|
+
query.selectedFilterData = JSON.stringify(Array.from(this.annaFilterService.tooltipSelectedMap));
|
|
5097
|
+
}
|
|
5098
|
+
if (this.checkIfSortingIsApplied()) {
|
|
5099
|
+
query.sortState = JSON.stringify(Array.from(this.annaSortService.columnSortState));
|
|
5100
|
+
}
|
|
5101
|
+
return query;
|
|
5102
|
+
}
|
|
5103
|
+
checkIfSortingIsApplied() {
|
|
5104
|
+
let isSortingApplied = false;
|
|
5105
|
+
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
5106
|
+
if (value === "ASC" || value === "DESC") {
|
|
5107
|
+
isSortingApplied = true;
|
|
5108
|
+
}
|
|
5109
|
+
});
|
|
5110
|
+
return isSortingApplied;
|
|
5111
|
+
}
|
|
5112
|
+
initTableFilters(clonedTableData) {
|
|
5113
|
+
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
5114
|
+
this.annaFilterService.selectedRadio = null;
|
|
5115
|
+
this.annaFilterService.appliedFiltersArray = [];
|
|
5116
|
+
this.annaSortService.columnSortState = new Map();
|
|
5117
|
+
this.annaSortService.noSortingAppliedData = cloneDeep(clonedTableData);
|
|
5118
|
+
this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
|
|
5119
|
+
}
|
|
5120
|
+
initFilters() {
|
|
5121
|
+
this.annaFilterService.tooltipSelectedMap = new Map();
|
|
5122
|
+
this.annaFilterService.appliedFiltersArray = [];
|
|
5123
|
+
}
|
|
5124
|
+
setDataAsPerPersistingFilter(isPersistingFilter, clonedTable, filters) {
|
|
5125
|
+
let usersTable;
|
|
5126
|
+
if (isPersistingFilter) {
|
|
5127
|
+
usersTable = this.annaFilterService.filterData(clonedTable, "");
|
|
5128
|
+
this.annaSortService.noSortingAppliedData = cloneDeep(usersTable);
|
|
5129
|
+
}
|
|
5130
|
+
else {
|
|
5131
|
+
usersTable = clonedTable;
|
|
5132
|
+
this.annaSortService.noSortingAppliedData = cloneDeep(usersTable);
|
|
5133
|
+
}
|
|
5134
|
+
if (filters?.sortState) {
|
|
5135
|
+
this.annaSortService.columnSortState = new Map(JSON.parse(filters.sortState));
|
|
5136
|
+
usersTable = this.callSort(usersTable);
|
|
5137
|
+
}
|
|
5138
|
+
this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
|
|
5139
|
+
return usersTable;
|
|
5140
|
+
}
|
|
5141
|
+
callSort(usersTable) {
|
|
5142
|
+
let sortedUsersTableData = usersTable;
|
|
5143
|
+
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
5144
|
+
if (value === "ASC") {
|
|
5145
|
+
sortedUsersTableData = this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(true, usersTable, key);
|
|
5146
|
+
}
|
|
5147
|
+
else if (value === "DESC") {
|
|
5148
|
+
sortedUsersTableData = this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(false, usersTable, key);
|
|
5149
|
+
}
|
|
5150
|
+
});
|
|
5151
|
+
return sortedUsersTableData;
|
|
5152
|
+
}
|
|
5153
|
+
isSortingAppliedToTable() {
|
|
5154
|
+
let isSortingApplied = false;
|
|
5155
|
+
this.annaSortService.columnSortState.forEach((value, key) => {
|
|
5156
|
+
if (value === "ASC" || value === "DESC") {
|
|
5157
|
+
isSortingApplied = true;
|
|
5158
|
+
}
|
|
5159
|
+
});
|
|
5160
|
+
return isSortingApplied;
|
|
5161
|
+
}
|
|
5162
|
+
updateQueryParamsFilter(key, value, operation, queryParamObj) {
|
|
5163
|
+
if (operation === "ADD") {
|
|
5164
|
+
queryParamObj[key] = value;
|
|
5165
|
+
}
|
|
5166
|
+
else if (operation === "DELETE") {
|
|
5167
|
+
delete queryParamObj[key];
|
|
5168
|
+
}
|
|
5169
|
+
return queryParamObj;
|
|
5170
|
+
}
|
|
5171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, deps: [{ token: AnnaFilterService }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: AnnaSortService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5172
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, providedIn: "root" }); }
|
|
5173
|
+
}
|
|
5174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaGtHelperService, decorators: [{
|
|
5175
|
+
type: Injectable,
|
|
5176
|
+
args: [{
|
|
5177
|
+
providedIn: "root",
|
|
5178
|
+
}]
|
|
5179
|
+
}], ctorParameters: function () { return [{ type: AnnaFilterService }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: AnnaSortService }]; } });
|
|
5180
|
+
|
|
5914
5181
|
class AnnaNumberFormatService {
|
|
5915
5182
|
static GetRoundedValueWithUnits(inputValue, digitsToRoundDecimalPoint = 2) {
|
|
5916
5183
|
const result = AnnaNumberFormatService.GetValueInUnits(Math.abs(inputValue));
|
|
@@ -6107,5 +5374,5 @@ class ANNAIconNames {
|
|
|
6107
5374
|
* Generated bundle index. Do not edit.
|
|
6108
5375
|
*/
|
|
6109
5376
|
|
|
6110
|
-
export { ANNAIconNames, AllSelectedStatus, AnnaBuyerApprovalIconTemplateComponent, AnnaCalendarFilterComponent, AnnaColumnCheckboxFilterComponent, AnnaColumnDateRangeFilterComponent, AnnaColumnSliderFilterComponent, AnnaColumnTimeFilterComponent, AnnaConvertArrayToCommaSeperatedValue, AnnaConvertZeroOrNullOrUndefinedPipe, AnnaCoreModule, AnnaDateFormatterPipe, AnnaDateTimeFormatService, AnnaDeletedOrderIconTemplateComponent, AnnaFilterSearchedTextPipe, AnnaFilterService,
|
|
5377
|
+
export { ANNAIconNames, AllSelectedStatus, AnnaBuyerApprovalIconTemplateComponent, AnnaCalendarFilterComponent, AnnaColumnCheckboxFilterComponent, AnnaColumnDateRangeFilterComponent, AnnaColumnSliderFilterComponent, AnnaColumnTimeFilterComponent, AnnaConvertArrayToCommaSeperatedValue, AnnaConvertZeroOrNullOrUndefinedPipe, AnnaCoreModule, AnnaDateFormatterPipe, AnnaDateTimeFormatService, AnnaDeletedOrderIconTemplateComponent, AnnaFilterSearchedTextPipe, AnnaFilterService, AnnaGlobalConfigService, AnnaGtHelperService, AnnaIconColumnComponent, AnnaLiveIconTemplateComponent, AnnaNoDataComponent, AnnaNonEditableGenericTableComponent, AnnaNotifyIconTemplateComponent, AnnaNumberFormatService, AnnaPayForPerformanceIconTemplateComponent, AnnaPersistingFilterService, AnnaRejectedIconTemplateComponent, AnnaReplaceCharPipe, AnnaSortComponent, AnnaSortService, AnnaTypeofDataPipe, AnnaWeekCalendarComponent, ClickableItem, Constants, Days, DigitOnlyDirective, ErrorCodes, FixedRowsPopupTableDirective, IconCellActionKey, OrderSources, RadioButtonModel, ShowEllipsisTextOnHoverDirective, SortTypeEnum, TooltipModel, TooltipModelForColumnLevelFiltering };
|
|
6111
5378
|
//# sourceMappingURL=annalib-anna-core.mjs.map
|