Skip to content

Commit

Permalink
fix(platform): Update info bar table to reflect selected filters
Browse files Browse the repository at this point in the history
closes [#11783](#11783)

- Added feature to close the popover when the dismiss button is clicked. The popover will reappear upon changing the filters.
  • Loading branch information
khotcholava committed Oct 22, 2024
1 parent bfd86ee commit e736a33
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions libs/platform/table-helpers/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ export abstract class Table<T = any> implements PresetManagedComponent<PlatformT
/** Toolbar Column Settings button click event */
readonly openTableColumnSettings: EventEmitter<void> = new EventEmitter<void>();

/** Event fired when table state changes. */
readonly tableColumnFilterChange = new EventEmitter<void>();

/** Event fired when empty row added. */
readonly emptyRowAdded: EventEmitter<void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
}
}
</fd-toolbar>
@if (appliedFilters().length) {
@if (appliedFilters().length && _isFilterToolbarVisible()) {
<fd-toolbar
fdType="info"
[active]="true"
Expand All @@ -177,6 +177,7 @@
</label>
<fd-toolbar-spacer></fd-toolbar-spacer>
<button
(click)="_closeFilterToolbar()"
fd-button
fdType="transparent"
glyph="decline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
TemplateRef,
ViewChild,
ViewEncapsulation,
inject
inject,
signal
} from '@angular/core';
import { Observable } from 'rxjs';

Expand Down Expand Up @@ -169,6 +170,9 @@ export class TableToolbarComponent implements TableToolbarInterface {
/** @hidden */
_searchInputText = '';

/** @hidden */
_isFilterToolbarVisible = signal(false);

/** @hidden */
readonly tableLoading$: Observable<boolean> = inject(TableService).tableLoading$;

Expand Down Expand Up @@ -225,6 +229,11 @@ export class TableToolbarComponent implements TableToolbarInterface {
this._table.expandAll();
}

/** @hidden */
_closeFilterToolbar(): void {
this._isFilterToolbarVisible.set(false);
}

/** @hidden */
_collapseAll(): void {
this._table.collapseAll();
Expand All @@ -247,5 +256,9 @@ export class TableToolbarComponent implements TableToolbarInterface {
this._table.presetChanged.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((state) => {
this._searchInputText = state.searchInput?.text ?? '';
});

this._table.tableColumnFilterChange.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
this._isFilterToolbarVisible.set(true);
});
}
}
1 change: 1 addition & 0 deletions libs/platform/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@ export class TableComponent<T = any>
break;
case 'filter':
this.filterChange.emit(new TableFilterChangeEvent(this, state.current, state.previous));
this.tableColumnFilterChange.emit();
this._setAppliedFilterNames(state.current);
break;
case 'freeze':
Expand Down

0 comments on commit e736a33

Please sign in to comment.