@trudb/tru-common-lib 0.2.487 → 0.2.490

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.
@@ -7546,19 +7546,6 @@ class TruDataGridHeader {
7546
7546
  columnMenuIsOpen = false;
7547
7547
  showFilterMenu = false;
7548
7548
  filterIsActive = false;
7549
- agInit(params) {
7550
- this.params = params;
7551
- this.params.api.addEventListener('cellFocused', this.onCellFocused.bind(this));
7552
- }
7553
- getHeaderParams() {
7554
- return this.params;
7555
- }
7556
- refresh(params) {
7557
- return false;
7558
- }
7559
- onSelectAllIconClicked() {
7560
- this.params.api.selectAll();
7561
- }
7562
7549
  onCellFocused(event) {
7563
7550
  var column = event.column;
7564
7551
  if (column?.getColDef().pinned) {
@@ -7573,6 +7560,23 @@ class TruDataGridHeader {
7573
7560
  }
7574
7561
  }
7575
7562
  }
7563
+ onSortChanged(event) {
7564
+ this.filterIsActive = this.params.column.isFilterActive();
7565
+ this.ascSort = this.params.column.isSortAscending();
7566
+ this.descSort = this.params.column.isSortDescending();
7567
+ this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
7568
+ }
7569
+ agInit(params) {
7570
+ this.params = params;
7571
+ this.params.api.addEventListener('cellFocused', this.onCellFocused.bind(this));
7572
+ this.params.column.addEventListener('sortChanged', this.onSortChanged.bind(this));
7573
+ }
7574
+ getHeaderParams() {
7575
+ return this.params;
7576
+ }
7577
+ refresh(params) {
7578
+ return false;
7579
+ }
7576
7580
  onFilterMenuButtonClicked(event) {
7577
7581
  if (!this.columnMenuIsOpen) {
7578
7582
  this.params.column.getColDef().headerComponentParams = this.params;
@@ -7602,6 +7606,7 @@ class TruDataGridHeader {
7602
7606
  }
7603
7607
  ngOnDestroy() {
7604
7608
  this.params.api.removeEventListener('cellFocused', this.onCellFocused.bind(this));
7609
+ this.params.column.removeEventListener('sortChanged', this.onSortChanged.bind(this));
7605
7610
  }
7606
7611
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruDataGridHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
7607
7612
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: TruDataGridHeader, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "headerRef", first: true, predicate: ["header"], descendants: true }], ngImport: i0, template: `
@@ -7659,29 +7664,6 @@ class TruDataGridHeaderFilter {
7659
7664
  constructor() { }
7660
7665
  agInit(params) {
7661
7666
  this.filterParams = params;
7662
- this.typesOfSort = [
7663
- {
7664
- value: 'asc',
7665
- label: 'Sort A to Z',
7666
- selected: false,
7667
- display: () => { return !this.filterParams.column.isSortAscending(); },
7668
- icon: 'asc-sort-menu-icon'
7669
- },
7670
- {
7671
- value: 'desc',
7672
- label: 'Sort Z to A',
7673
- selected: false,
7674
- display: () => { return !this.filterParams.column.isSortDescending(); },
7675
- icon: 'desc-sort-menu-icon'
7676
- },
7677
- {
7678
- value: null,
7679
- label: 'Clear Sort',
7680
- selected: false,
7681
- display: () => { return this.filterParams.column.isSortAscending() || this.filterParams.column.isSortDescending(); },
7682
- icon: 'no-sort-icon'
7683
- }
7684
- ];
7685
7667
  }
7686
7668
  isFilterActive() {
7687
7669
  return this.filterText != null && this.filterText !== '';
@@ -7708,6 +7690,29 @@ class TruDataGridHeaderFilter {
7708
7690
  }
7709
7691
  afterGuiAttached(params) {
7710
7692
  this.guiFilterParams = params;
7693
+ this.typesOfSort = [
7694
+ {
7695
+ value: 'asc',
7696
+ label: 'Sort A to Z',
7697
+ selected: false,
7698
+ display: () => { return !this.filterParams.column.isSortAscending(); },
7699
+ icon: 'asc-sort-menu-icon'
7700
+ },
7701
+ {
7702
+ value: 'desc',
7703
+ label: 'Sort Z to A',
7704
+ selected: false,
7705
+ display: () => { return !this.filterParams.column.isSortDescending(); },
7706
+ icon: 'desc-sort-menu-icon'
7707
+ },
7708
+ {
7709
+ value: null,
7710
+ label: 'Clear Sort',
7711
+ selected: false,
7712
+ display: () => { return this.filterParams.column.isSortAscending() || this.filterParams.column.isSortDescending(); },
7713
+ icon: 'no-sort-icon'
7714
+ }
7715
+ ];
7711
7716
  }
7712
7717
  onFilterInputChanged() {
7713
7718
  this.filterParams.filterChangedCallback();
@@ -7721,7 +7726,7 @@ class TruDataGridHeaderFilter {
7721
7726
  <div class="tru-data-grid-header-filter-container">
7722
7727
  <mat-selection-list #sort [multiple]="false" (selectionChange)="onSortSelection($event)">
7723
7728
  @for (typeOfSort of typesOfSort; track typeOfSort.value) {
7724
- <mat-list-option [value]='typeOfSort' *ngIf="typeOfSort.display()">
7729
+ <mat-list-option [selected]="typeOfSort.selected" [value]='typeOfSort' *ngIf="typeOfSort.display()">
7725
7730
  <mat-icon [svgIcon]="typeOfSort.icon"></mat-icon>
7726
7731
  <span matListItem>{{typeOfSort.label}}</span>
7727
7732
  </mat-list-option>
@@ -7765,7 +7770,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
7765
7770
  <div class="tru-data-grid-header-filter-container">
7766
7771
  <mat-selection-list #sort [multiple]="false" (selectionChange)="onSortSelection($event)">
7767
7772
  @for (typeOfSort of typesOfSort; track typeOfSort.value) {
7768
- <mat-list-option [value]='typeOfSort' *ngIf="typeOfSort.display()">
7773
+ <mat-list-option [selected]="typeOfSort.selected" [value]='typeOfSort' *ngIf="typeOfSort.display()">
7769
7774
  <mat-icon [svgIcon]="typeOfSort.icon"></mat-icon>
7770
7775
  <span matListItem>{{typeOfSort.label}}</span>
7771
7776
  </mat-list-option>