Bugfix/fix issue with exact matches in activities filter (#1724)
* Fix issue with exact match * Update changelog
This commit is contained in:
parent
ce022c024f
commit
2b4a1dc480
@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Upgraded `angular` from version `15.1.2` to `15.1.5`
|
||||
- Upgraded `Nx` from version `15.6.3` to `15.7.2`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an issue with exact matches in the activities table filter (`VT` vs. `VTI`)
|
||||
|
||||
## 1.236.0 - 2023-02-17
|
||||
|
||||
### Changed
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
@ -33,7 +34,7 @@ import { Subject, Subscription, distinctUntilChanged, takeUntil } from 'rxjs';
|
||||
styleUrls: ['./activities-table.component.scss'],
|
||||
templateUrl: './activities-table.component.html'
|
||||
})
|
||||
export class ActivitiesTableComponent implements OnChanges, OnDestroy {
|
||||
export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit {
|
||||
@Input() activities: Activity[];
|
||||
@Input() baseCurrency: string;
|
||||
@Input() deviceType: string;
|
||||
@ -89,6 +90,17 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
if (this.showCheckbox) {
|
||||
this.toggleAllRows();
|
||||
this.selectedRows.changed
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((selectedRows) => {
|
||||
this.selectedActivities.emit(selectedRows.source.selected);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public areAllRowsSelected() {
|
||||
const numSelectedRows = this.selectedRows.selected.length;
|
||||
const numTotalRows = this.dataSource.data.length;
|
||||
@ -136,19 +148,19 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy {
|
||||
|
||||
this.dataSource = new MatTableDataSource(this.activities);
|
||||
this.dataSource.filterPredicate = (data, filter) => {
|
||||
const dataString = this.getFilterableValues(data)
|
||||
.map((currentFilter) => {
|
||||
return currentFilter.label;
|
||||
})
|
||||
.join(' ')
|
||||
.toLowerCase();
|
||||
|
||||
let contains = true;
|
||||
for (const singleFilter of filter.split(this.SEARCH_STRING_SEPARATOR)) {
|
||||
contains =
|
||||
contains && dataString.includes(singleFilter.trim().toLowerCase());
|
||||
const filterableLabels = this.getFilterableValues(data).map(
|
||||
({ label }) => {
|
||||
return label.toLowerCase();
|
||||
}
|
||||
return contains;
|
||||
);
|
||||
|
||||
let includes = true;
|
||||
for (const singleFilter of filter.split(this.SEARCH_STRING_SEPARATOR)) {
|
||||
includes =
|
||||
includes &&
|
||||
filterableLabels.includes(singleFilter.trim().toLowerCase());
|
||||
}
|
||||
return includes;
|
||||
};
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
@ -158,17 +170,6 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.showCheckbox) {
|
||||
this.toggleAllRows();
|
||||
this.selectedRows.changed
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((selectedRows) => {
|
||||
this.selectedActivities.emit(selectedRows.source.selected);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public onChangePage(page: PageEvent) {
|
||||
this.pageIndex = page.pageIndex;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user