Skip to content

Commit

Permalink
Merge pull request #470 from UiPath/feat/grid-swap-filter-containers
Browse files Browse the repository at this point in the history
feat(grid): allow swapping filter containers
  • Loading branch information
toxik authored Apr 9, 2024
2 parents 477db1e + 942d781 commit d5660a9
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 82 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v15.2.5 (2024-04-09)
* **grid** allow swapping filter containers
* **chore** update readme with new package from apollo-design

# v15.2.4 (2024-02-22)
* **grid** remove reserved space for actions if scrollable
* **grid** update font and icon sizes for high density mode
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-components",
"version": "15.2.4",
"version": "15.2.5",
"author": {
"name": "UiPath Inc",
"url": "https://uipath.com"
Expand Down
168 changes: 90 additions & 78 deletions projects/angular/components/ui-grid/src/ui-grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,88 +11,16 @@
(isAnyFilterDefined$ | async)"
class="ui-grid-filter-container">
<div class="ui-grid-filter-container-lhs-group">
<div class="ui-grid-filter-container-lhs-group-actions">
<ng-container *ngIf="filterManager.hasCustomFilter$ | async; else noCustomFilter">
<ng-container *ngTemplateOutlet="toggleColumnsTmpl"></ng-container>
<button *ngIf="!(hasSelection$ | async)"
(click)="clearCustomFilter()"
mat-flat-button
type="button"
data-cy="clear-custom-filter">
{{ intl.clearCustomFilter }}
</button>
</ng-container>
<ng-template #noCustomFilter>
<ng-container>
<ng-container *ngIf="!(hasSelection$ | async) ||
!header?.actionButtons?.length">
<ng-container *ngIf="!!search; else defaultSearch">
<ng-container *ngTemplateOutlet="search.html ?? null"></ng-container>
</ng-container>

<ng-template #defaultSearch>
<ui-grid-search *ngIf="header?.search"
[debounce]="header!.searchDebounce"
[maxLength]="header!.searchMaxLength"
[placeholder]="intl.searchPlaceholder"
[searchTooltip]="intl.searchTooltip"
[clearTooltip]="intl.clearTooltip"
[tooltipDisabled]="resizeManager.isResizing"
[value]="header!.searchValue!"
(searchChange)="filterManager.searchChange($event, header!, footer)"
class="ui-grid-search ui-grid-filter-option">
</ui-grid-search>
</ng-template>

<ng-container *ngTemplateOutlet="toggleColumnsTmpl"></ng-container>

<ng-container *ngTemplateOutlet="filtersTmpl">
</ng-container>
</ng-container>

<div *ngIf="!(hasSelection$ | async)"
class="ui-grid-action-buttons ui-grid-action-buttons-inline">
<ng-container *ngFor="let button of header?.inlineButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html ?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
</ng-container>
</ng-template>

<div #gridActionButtons
*ngIf="hasSelection$ | async"
class="ui-grid-action-buttons ui-grid-action-buttons-selection">
<ng-container *ngFor="let button of header?.actionButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
</div>
<div *ngIf="showFilters &&
(hasAnyFiltersVisible$ | async) &&
(filterManager.hasCustomFilter$ | async) === false &&
!(hasSelection$ | async)"
[@filters-container]
class="ui-grid-filter-container-lhs-group-filters">
<ng-container *ngTemplateOutlet="inlineFiltersTmpl"></ng-container>
</div>
<ng-container *ngIf="swapFilterContainers; else gridFilterContainerLeft">
<ng-container *ngTemplateOutlet="gridFilterContainerRight"></ng-container>
</ng-container>
</div>

<div class="ui-grid-filter-container-rhs-group"
*ngLet="(hasSelection$ | async) as hasSelections">
<div class="ui-grid-action-buttons ui-grid-action-buttons-main">
<ng-container *ngFor="let button of header?.mainButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html ?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
<ng-container *ngIf="swapFilterContainers; else gridFilterContainerRight">
<ng-container *ngTemplateOutlet="gridFilterContainerLeft"></ng-container>
</ng-container>
</div>
</div>

Expand Down Expand Up @@ -827,3 +755,87 @@
(visibleColumnsToggled)="visibleColumnsToggle$.next($event)">
</ui-grid-toggle-columns>
</ng-template>

<ng-template #gridFilterContainerLeft>
<div class="ui-grid-filter-container-lhs-group-actions">
<ng-container *ngIf="filterManager.hasCustomFilter$ | async; else noCustomFilter">
<ng-container *ngTemplateOutlet="toggleColumnsTmpl"></ng-container>
<button *ngIf="!(hasSelection$ | async)"

Check warning on line 763 in projects/angular/components/ui-grid/src/ui-grid.component.html

View workflow job for this annotation

GitHub Actions / build-and-publish

Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead
(click)="clearCustomFilter()"
mat-flat-button
type="button"
data-cy="clear-custom-filter">
{{ intl.clearCustomFilter }}
</button>
</ng-container>
<ng-template #noCustomFilter>
<ng-container>
<ng-container *ngIf="!(hasSelection$ | async) ||

Check warning on line 773 in projects/angular/components/ui-grid/src/ui-grid.component.html

View workflow job for this annotation

GitHub Actions / build-and-publish

Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead
!header?.actionButtons?.length">
<ng-container *ngIf="!!search; else defaultSearch">
<ng-container *ngTemplateOutlet="search.html ?? null"></ng-container>
</ng-container>

<ng-template #defaultSearch>
<ui-grid-search *ngIf="header?.search"
[debounce]="header!.searchDebounce"
[maxLength]="header!.searchMaxLength"
[placeholder]="intl.searchPlaceholder"
[searchTooltip]="intl.searchTooltip"
[clearTooltip]="intl.clearTooltip"
[tooltipDisabled]="resizeManager.isResizing"
[value]="header!.searchValue!"
(searchChange)="filterManager.searchChange($event, header!, footer)"
class="ui-grid-search ui-grid-filter-option">
</ui-grid-search>
</ng-template>

<ng-container *ngTemplateOutlet="toggleColumnsTmpl"></ng-container>

<ng-container *ngTemplateOutlet="filtersTmpl">
</ng-container>
</ng-container>

<div *ngIf="!(hasSelection$ | async)"

Check warning on line 799 in projects/angular/components/ui-grid/src/ui-grid.component.html

View workflow job for this annotation

GitHub Actions / build-and-publish

Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead
class="ui-grid-action-buttons ui-grid-action-buttons-inline">
<ng-container *ngFor="let button of header?.inlineButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html ?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
</ng-container>
</ng-template>

<div #gridActionButtons
*ngIf="hasSelection$ | async"
class="ui-grid-action-buttons ui-grid-action-buttons-selection">
<ng-container *ngFor="let button of header?.actionButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
</div>
<div *ngIf="showFilters &&
(hasAnyFiltersVisible$ | async) &&
(filterManager.hasCustomFilter$ | async) === false &&
!(hasSelection$ | async)"

Check warning on line 825 in projects/angular/components/ui-grid/src/ui-grid.component.html

View workflow job for this annotation

GitHub Actions / build-and-publish

Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead
[@filters-container]
class="ui-grid-filter-container-lhs-group-filters">
<ng-container *ngTemplateOutlet="inlineFiltersTmpl"></ng-container>
</div>
</ng-template>

<ng-template #gridFilterContainerRight>
<div class="ui-grid-action-buttons ui-grid-action-buttons-main">
<ng-container *ngFor="let button of header?.mainButtons">
<ng-container *ngIf="button.visible">
<ng-container *ngTemplateOutlet="button.html ?? null">
</ng-container>
</ng-container>
</ng-container>
</div>
</ng-template>
7 changes: 7 additions & 0 deletions projects/angular/components/ui-grid/src/ui-grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,13 @@ export class UiGridComponent<T extends IGridDataEntry>
@Input()
selectablePageIndex: boolean;

/**
* Configure if the filter containers should be swapped
*
*/
@Input()
swapFilterContainers = false;

/**
* Emits an event with the sort model when a column sort changes.
*
Expand Down
2 changes: 1 addition & 1 deletion projects/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uipath/angular",
"version": "15.2.4",
"version": "15.2.5",
"license": "MIT",
"author": {
"name": "UiPath Inc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[resizeStrategy]="inputs.isScrollable ? scrollableGridStrategy : immediateNeighbourHaltStrategy"
[customFilterValue]="inputs.customFilter ? [{property: 'parity', method: 'eq', value: 'odd'}] : []"
[allowHighlight]="inputs.allowHighlight"
[swapFilterContainers]="inputs.swapFilterContainers"
[selectablePageIndex]="inputs.selectablePageIndex">

<ui-grid-header [search]="header.searchable">
Expand Down
1 change: 1 addition & 0 deletions projects/playground/src/app/pages/grid/grid.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface IInputs {
hideTotalCount: boolean;
isScrollable: boolean;
allowHighlight: boolean;
swapFilterContainers: boolean;
selectablePageIndex: boolean;
}

Expand Down
2 changes: 2 additions & 0 deletions projects/playground/src/app/pages/grid/grid.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class GridPageComponent implements AfterViewInit, OnDestroy {
'useCardView',
'isScrollable',
'allowHighlight',
'swapFilterContainers',
'selectablePageIndex',
];

Expand Down Expand Up @@ -134,6 +135,7 @@ export class GridPageComponent implements AfterViewInit, OnDestroy {
useCardView: [false],
isScrollable: [false],
allowHighlight: [false],
swapFilterContainers: [false],
selectablePageIndex: [true],
}),
header: this._fb.group({
Expand Down

0 comments on commit d5660a9

Please sign in to comment.