@trudb/tru-common-lib 0.1.973 → 0.1.975

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.
@@ -5946,10 +5946,10 @@ class TruDataGridHeader {
5946
5946
  this.params.column.getColDef().headerComponentParams = this.params;
5947
5947
  this.params.showColumnMenu(event.target, () => {
5948
5948
  this.columnMenuIsOpen = false;
5949
- this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
5950
5949
  this.filterIsActive = this.params.column.isFilterActive();
5951
5950
  this.ascSort = this.params.column.isSortAscending();
5952
5951
  this.descSort = this.params.column.isSortDescending();
5952
+ this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
5953
5953
  });
5954
5954
  this.columnMenuIsOpen = true;
5955
5955
  }
@@ -6154,78 +6154,119 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
6154
6154
  }], ctorParameters: () => [] });
6155
6155
 
6156
6156
  class TruDataGridRefHeader {
6157
+ headerRef;
6157
6158
  params;
6158
- ascSort = 'inactive';
6159
- descSort = 'inactive';
6160
- noSort = 'inactive';
6159
+ ascSort = false;
6160
+ descSort = false;
6161
+ isHovering = false;
6162
+ columnMenuIsOpen = false;
6163
+ showFilterMenu = false;
6164
+ filterIsActive = false;
6161
6165
  agInit(params) {
6162
6166
  this.params = params;
6163
- this.params.column.addEventListener('sortChanged', this.onSortChanged.bind(this));
6164
- this.onSortChanged();
6167
+ this.params.api.addEventListener('cellFocused', this.onCellFocused.bind(this));
6168
+ }
6169
+ getHeaderParams() {
6170
+ return this.params;
6165
6171
  }
6166
6172
  refresh(params) {
6167
6173
  return false;
6168
6174
  }
6169
- onSortChanged() {
6170
- this.ascSort = this.descSort = this.noSort = 'inactive';
6171
- if (this.params.column.isSortAscending()) {
6172
- this.ascSort = 'active';
6175
+ onSelectAllIconClicked() {
6176
+ this.params.api.selectAll();
6177
+ }
6178
+ onCellFocused(event) {
6179
+ var column = event.column;
6180
+ if (column?.getColDef().pinned) {
6181
+ this.headerRef.nativeElement.classList.add('ag-column-focus');
6182
+ }
6183
+ else {
6184
+ if (this.params.column.getColId() === column.getColId()) {
6185
+ this.headerRef.nativeElement.classList.add('ag-column-focus');
6186
+ }
6187
+ else {
6188
+ this.headerRef.nativeElement.classList.remove('ag-column-focus');
6189
+ }
6173
6190
  }
6174
- else if (this.params.column.isSortDescending()) {
6175
- this.descSort = 'active';
6191
+ }
6192
+ onFilterMenuButtonClicked(event) {
6193
+ if (!this.columnMenuIsOpen) {
6194
+ this.params.column.getColDef().headerComponentParams = this.params;
6195
+ this.params.showColumnMenu(event.target, () => {
6196
+ this.columnMenuIsOpen = false;
6197
+ this.filterIsActive = this.params.column.isFilterActive();
6198
+ this.ascSort = this.params.column.isSortAscending();
6199
+ this.descSort = this.params.column.isSortDescending();
6200
+ this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
6201
+ });
6202
+ this.columnMenuIsOpen = true;
6176
6203
  }
6177
6204
  else {
6178
- this.noSort = 'active';
6205
+ this.params.api.hidePopupMenu();
6206
+ this.columnMenuIsOpen = false;
6179
6207
  }
6180
6208
  }
6181
- onSortRequested(order, event) {
6182
- this.params.setSort(order, event.shiftKey);
6209
+ onHeaderMouseEnter(event) {
6210
+ this.isHovering = true;
6211
+ this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
6212
+ this.filterIsActive = this.params.column.isFilterActive();
6183
6213
  }
6184
- onSelectAllIconClicked() {
6185
- this.params.api.selectAll();
6214
+ onHeaderMouseLeave(event) {
6215
+ this.isHovering = false;
6216
+ this.showFilterMenu = this.isHovering && this.params.api.getDisplayedRowCount() > 0 || this.columnMenuIsOpen || this.params.column.isFilterActive() || this.ascSort || this.descSort;
6217
+ this.filterIsActive = this.params.column.isFilterActive();
6186
6218
  }
6187
6219
  ngOnDestroy() {
6188
- this.params.column.removeEventListener('sortChanged', this.onSortChanged.bind(this));
6220
+ this.params.api.removeEventListener('cellFocused', this.onCellFocused.bind(this));
6189
6221
  }
6190
6222
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridRefHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
6191
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: TruDataGridRefHeader, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
6223
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: TruDataGridRefHeader, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "headerRef", first: true, predicate: ["header"], descendants: true }], ngImport: i0, template: `
6192
6224
  <div #header class="ag-cell-label-container" role="presentation">
6193
- <div ref="eLabel" class="ag-header-cell-label" role="presentation">
6194
- <span ref="eText" class="ag-header-cell-text">{{params.displayName}}</span>
6195
- <span *ngIf="ascSort === 'active'" ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-ascending-icon" (click)="onSortRequested('desc', $event)">
6196
- <mat-icon [svgIcon]="'sort-icon'"></mat-icon>
6197
- </span>
6198
- <span *ngIf="descSort === 'active'" ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-descending-icon" (click)="onSortRequested(null, $event)">
6199
- <mat-icon [svgIcon]="'sort-icon'"></mat-icon>
6200
- </span>
6201
- <span *ngIf="noSort === 'active'" ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-none-icon" (click)="onSortRequested('asc', $event)"></span>
6225
+ <div ref="eLabel" class="ag-header-cell-label" role="presentation" (mouseenter)="onHeaderMouseEnter($event)" (mouseleave)="onHeaderMouseLeave($event)">
6226
+ <div>
6227
+ <span ref="eText" class="ag-header-cell-text">{{params.displayName}}</span>
6228
+ </div>
6229
+ <div class="ag-header-control-filter-container" *ngIf="showFilterMenu">
6230
+ <span ref="eFilterButton" class="ag-filter-icon" (click)="onFilterMenuButtonClicked($event)">
6231
+ <mat-icon class="ag-header-more" [svgIcon]="'more-icon'" *ngIf="!filterIsActive && !ascSort && !descSort"></mat-icon>
6232
+ <mat-icon class="ag-header-asc" [svgIcon]="'asc-sort-icon'" [ngClass]="{'filtering': filterIsActive}" *ngIf="ascSort"></mat-icon>
6233
+ <mat-icon class="ag-header-desc" [svgIcon]="'desc-sort-icon'" [ngClass]="{'filtering': filterIsActive}" *ngIf="descSort"></mat-icon>
6234
+ <mat-icon class="ag-header-filter" [svgIcon]="'filter-icon'" *ngIf="filterIsActive"></mat-icon>
6235
+ </span>
6236
+ </div>
6202
6237
  </div>
6203
6238
  <mat-icon [svgIcon]="'select-all-icon'"
6204
6239
  (click)="onSelectAllIconClicked()"
6205
6240
  class="tru-data-grid-select-all-icon"
6206
6241
  title="Select All (Ctrl+A)"></mat-icon>
6207
- </div>`, isInline: true, styles: [".ag-sort-icon{height:100%;width:100%}.tru-data-grid-select-all-icon{width:16px;font-size:28px;color:#ddd;float:right;position:absolute;top:-1px;right:4px}.ag-sort-icon mat-icon{height:20px;width:16px;padding-top:4px}::ng-deep .tru-data-grid-select-all-icon path{fill:#d3d3d3;position:relative;z-index:100;pointer-events:all}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
6242
+ </div>`, isInline: true, styles: [".ag-header-control-container{display:flex}.ag-header-control-filter-container{position:absolute;top:1px;left:5px;width:20px;height:20px;display:table}.ag-header-cell-text{position:relative;pointer-events:none;vertical-align:middle;vertical-align:-webkit-baseline-middle}.ag-sort-icon{height:100%;width:100%;margin-left:0!important}.ag-sort-icon mat-icon{height:16px;width:16px;padding-top:4px}.ag-column-focus .ag-header-cell-text{color:#3f51b5;font-weight:700}.ag-column-focus{background-color:#ddd;border-bottom:1px solid #3f51b5}::ng-deep .ag-header-control-filter-container mat-icon{height:20px!important;width:20px!important;padding-top:2px!important}::ng-deep .ag-filter-icon .ag-header-asc.filtering{position:relative;right:-7px}::ng-deep .ag-filter-icon .ag-header-desc.filtering{position:relative;right:-7px}::ng-deep .ag-filter-icon mat-icon{height:18px!important;width:18px!important;color:#ddd}::ng-deep .ag-filter-icon mat-icon svg{fill:#949494!important}.tru-data-grid-select-all-icon{width:16px;font-size:28px;color:#ddd;float:right;position:absolute;top:-1px;right:4px}::ng-deep .tru-data-grid-select-all-icon path{fill:#d3d3d3;position:relative;z-index:100;pointer-events:all}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
6208
6243
  }
6209
6244
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: TruDataGridRefHeader, decorators: [{
6210
6245
  type: Component,
6211
- args: [{ standalone: true, imports: [NgIf, NgClass, MatIconModule], template: `
6246
+ args: [{ standalone: true, imports: [NgIf, NgClass, CommonModule, MatIconModule], template: `
6212
6247
  <div #header class="ag-cell-label-container" role="presentation">
6213
- <div ref="eLabel" class="ag-header-cell-label" role="presentation">
6214
- <span ref="eText" class="ag-header-cell-text">{{params.displayName}}</span>
6215
- <span *ngIf="ascSort === 'active'" ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-ascending-icon" (click)="onSortRequested('desc', $event)">
6216
- <mat-icon [svgIcon]="'sort-icon'"></mat-icon>
6217
- </span>
6218
- <span *ngIf="descSort === 'active'" ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-descending-icon" (click)="onSortRequested(null, $event)">
6219
- <mat-icon [svgIcon]="'sort-icon'"></mat-icon>
6220
- </span>
6221
- <span *ngIf="noSort === 'active'" ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-icon ag-sort-none-icon" (click)="onSortRequested('asc', $event)"></span>
6248
+ <div ref="eLabel" class="ag-header-cell-label" role="presentation" (mouseenter)="onHeaderMouseEnter($event)" (mouseleave)="onHeaderMouseLeave($event)">
6249
+ <div>
6250
+ <span ref="eText" class="ag-header-cell-text">{{params.displayName}}</span>
6251
+ </div>
6252
+ <div class="ag-header-control-filter-container" *ngIf="showFilterMenu">
6253
+ <span ref="eFilterButton" class="ag-filter-icon" (click)="onFilterMenuButtonClicked($event)">
6254
+ <mat-icon class="ag-header-more" [svgIcon]="'more-icon'" *ngIf="!filterIsActive && !ascSort && !descSort"></mat-icon>
6255
+ <mat-icon class="ag-header-asc" [svgIcon]="'asc-sort-icon'" [ngClass]="{'filtering': filterIsActive}" *ngIf="ascSort"></mat-icon>
6256
+ <mat-icon class="ag-header-desc" [svgIcon]="'desc-sort-icon'" [ngClass]="{'filtering': filterIsActive}" *ngIf="descSort"></mat-icon>
6257
+ <mat-icon class="ag-header-filter" [svgIcon]="'filter-icon'" *ngIf="filterIsActive"></mat-icon>
6258
+ </span>
6259
+ </div>
6222
6260
  </div>
6223
6261
  <mat-icon [svgIcon]="'select-all-icon'"
6224
6262
  (click)="onSelectAllIconClicked()"
6225
6263
  class="tru-data-grid-select-all-icon"
6226
6264
  title="Select All (Ctrl+A)"></mat-icon>
6227
- </div>`, styles: [".ag-sort-icon{height:100%;width:100%}.tru-data-grid-select-all-icon{width:16px;font-size:28px;color:#ddd;float:right;position:absolute;top:-1px;right:4px}.ag-sort-icon mat-icon{height:20px;width:16px;padding-top:4px}::ng-deep .tru-data-grid-select-all-icon path{fill:#d3d3d3;position:relative;z-index:100;pointer-events:all}\n"] }]
6228
- }] });
6265
+ </div>`, styles: [".ag-header-control-container{display:flex}.ag-header-control-filter-container{position:absolute;top:1px;left:5px;width:20px;height:20px;display:table}.ag-header-cell-text{position:relative;pointer-events:none;vertical-align:middle;vertical-align:-webkit-baseline-middle}.ag-sort-icon{height:100%;width:100%;margin-left:0!important}.ag-sort-icon mat-icon{height:16px;width:16px;padding-top:4px}.ag-column-focus .ag-header-cell-text{color:#3f51b5;font-weight:700}.ag-column-focus{background-color:#ddd;border-bottom:1px solid #3f51b5}::ng-deep .ag-header-control-filter-container mat-icon{height:20px!important;width:20px!important;padding-top:2px!important}::ng-deep .ag-filter-icon .ag-header-asc.filtering{position:relative;right:-7px}::ng-deep .ag-filter-icon .ag-header-desc.filtering{position:relative;right:-7px}::ng-deep .ag-filter-icon mat-icon{height:18px!important;width:18px!important;color:#ddd}::ng-deep .ag-filter-icon mat-icon svg{fill:#949494!important}.tru-data-grid-select-all-icon{width:16px;font-size:28px;color:#ddd;float:right;position:absolute;top:-1px;right:4px}::ng-deep .tru-data-grid-select-all-icon path{fill:#d3d3d3;position:relative;z-index:100;pointer-events:all}\n"] }]
6266
+ }], propDecorators: { headerRef: [{
6267
+ type: ViewChild,
6268
+ args: ['header', { static: false }]
6269
+ }] } });
6229
6270
 
6230
6271
  class TruDataGridUtil {
6231
6272
  getColumnIndexByColId = (api, colId) => {