@trudb/tru-common-lib 0.1.955 → 0.1.958

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.
@@ -6021,34 +6021,35 @@ class TruDataGridHeaderFilter {
6021
6021
  filterParams;
6022
6022
  gui;
6023
6023
  filterText = '';
6024
- typesOfSort = [
6025
- {
6026
- value: 'asc',
6027
- label: 'Sort A to Z',
6028
- selected: false,
6029
- display: true,
6030
- icon: 'asc-sort-icon'
6031
- },
6032
- {
6033
- value: 'desc',
6034
- label: 'Sort Z to A',
6035
- selected: false,
6036
- display: true,
6037
- icon: 'desc-sort-icon'
6038
- },
6039
- {
6040
- value: 'clear',
6041
- label: 'Clear Sort',
6042
- selected: false,
6043
- display: true,
6044
- icon: 'no-sort-icon'
6045
- }
6046
- ];
6024
+ typesOfSort = [];
6047
6025
  values = [];
6048
6026
  filterInputControl = new FormControl('', []);
6049
6027
  constructor() { }
6050
6028
  agInit(params) {
6051
6029
  this.filterParams = params;
6030
+ this.typesOfSort = [
6031
+ {
6032
+ value: 'asc',
6033
+ label: 'Sort A to Z',
6034
+ selected: false,
6035
+ display: !this.filterParams.column.isSortAscending(),
6036
+ icon: 'asc-sort-icon'
6037
+ },
6038
+ {
6039
+ value: 'desc',
6040
+ label: 'Sort Z to A',
6041
+ selected: false,
6042
+ display: !this.filterParams.column.isSortDescending(),
6043
+ icon: 'desc-sort-icon'
6044
+ },
6045
+ {
6046
+ value: null,
6047
+ label: 'Clear Sort',
6048
+ selected: false,
6049
+ display: this.filterParams.column.isSortAscending() || this.filterParams.column.isSortDescending(),
6050
+ icon: 'no-sort-icon'
6051
+ }
6052
+ ];
6052
6053
  }
6053
6054
  isFilterActive() {
6054
6055
  return this.filterText != null && this.filterText !== '';
@@ -6078,14 +6079,15 @@ class TruDataGridHeaderFilter {
6078
6079
  onFilterInputChanged() {
6079
6080
  this.filterParams.filterChangedCallback();
6080
6081
  }
6081
- onSortSelection = (event) => {
6082
+ onSortSelection = (changeEvent) => {
6083
+ this.filterParams.colDef.headerComponent.params.setSort(changeEvent.options[0].value, false);
6082
6084
  };
6083
6085
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridHeaderFilter, deps: [], target: i0.ɵɵFactoryTarget.Component });
6084
6086
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: TruDataGridHeaderFilter, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
6085
6087
  <div class="tru-data-grid-header-filter-container">
6086
6088
  <mat-selection-list #sort [multiple]="false" (selectionChange)="onSortSelection($event)">
6087
6089
  @for (typeOfSort of typesOfSort; track typeOfSort.value) {
6088
- <mat-list-option>
6090
+ <mat-list-option [value]='typeOfSort'>
6089
6091
  <mat-icon [svgIcon]="typeOfSort.icon"></mat-icon>
6090
6092
  <span matListItem>{{typeOfSort.label}}</span>
6091
6093
  </mat-list-option>
@@ -6129,7 +6131,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6129
6131
  <div class="tru-data-grid-header-filter-container">
6130
6132
  <mat-selection-list #sort [multiple]="false" (selectionChange)="onSortSelection($event)">
6131
6133
  @for (typeOfSort of typesOfSort; track typeOfSort.value) {
6132
- <mat-list-option>
6134
+ <mat-list-option [value]='typeOfSort'>
6133
6135
  <mat-icon [svgIcon]="typeOfSort.icon"></mat-icon>
6134
6136
  <span matListItem>{{typeOfSort.label}}</span>
6135
6137
  </mat-list-option>