Skip to content

Commit 10a6505

Browse files
committed
fix(grid): move progress bar to parent container
1 parent 5799cc3 commit 10a6505

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

projects/angular/components/ui-grid/src/ui-grid.component.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@
102102
<div [class.ui-grid-table-refreshable]="refreshable"
103103
[style.minWidth.px]="isScrollable && dataManager.length ? (minWidth$ | async) : undefined"
104104
[style.overflow]="isScrollable ? (tableOverflowStyle$ | async) : 'visible'"
105-
class="ui-grid-table"
106-
role="grid">
105+
class="ui-grid-table"
106+
role="grid">
107+
<mat-progress-bar *ngIf="loading && !loadingState"
108+
mode="query"
109+
class="ui-grid-loader">
110+
</mat-progress-bar>
107111
<div class="ui-grid-header">
108112
<div *ngIf="showHeaderRow"
109113
class="ui-grid-header-row"
@@ -151,8 +155,8 @@
151155
(focusout)="hideColumnHeaderTooltip(columnTooltip)"
152156
(keyup.enter)="sortManager.changeSort(column)"
153157
(keyup.space)="sortManager.changeSort(column)"
154-
(keydown.ArrowLeft)="(!last || columns.freeColumns.length) && resizeManager.startKeyboardResize('left', column, columnIndex); $event.preventDefault()"
155-
(keydown.ArrowRight)="(!last || columns.freeColumns.length) && resizeManager.startKeyboardResize('right', column, columnIndex); $event.preventDefault()"
158+
(keydown.ArrowLeft)="columns.freeColumns.length && resizeManager.startKeyboardResize('left', column, columnIndex); $event.preventDefault()"
159+
(keydown.ArrowRight)="columns.freeColumns.length && resizeManager.startKeyboardResize('right', column, columnIndex); $event.preventDefault()"
156160
cdkMonitorElementFocus
157161
class="ui-grid-header-cell ui-grid-sticky-element"
158162
role="columnheader"
@@ -218,8 +222,8 @@
218222
(focusout)="hideColumnHeaderTooltip(columnTooltip)"
219223
(keyup.enter)="sortManager.changeSort(column)"
220224
(keyup.space)="sortManager.changeSort(column)"
221-
(keydown.ArrowLeft)="!last && resizeManager.startKeyboardResize('left', column, columnIndex); $event.preventDefault()"
222-
(keydown.ArrowRight)="!last && resizeManager.startKeyboardResize('right', column, columnIndex); $event.preventDefault()"
225+
(keydown.ArrowLeft)="resizeManager.startKeyboardResize('left', column, columnIndex); $event.preventDefault()"
226+
(keydown.ArrowRight)="resizeManager.startKeyboardResize('right', column, columnIndex); $event.preventDefault()"
223227
cdkMonitorElementFocus
224228
class="ui-grid-header-cell"
225229
role="columnheader"
@@ -289,10 +293,6 @@
289293
class="ui-grid-header-cell ui-grid-action-cell ui-grid-feature-cell">
290294
</div>
291295
</div>
292-
<mat-progress-bar *ngIf="loading && !loadingState"
293-
mode="query"
294-
class="ui-grid-loader">
295-
</mat-progress-bar>
296296
</div>
297297

298298
<ng-container *ngIf="dataManager?.length; else noData">

projects/angular/components/ui-grid/src/ui-grid.component.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ ui-grid {
299299

300300
&-table-container {
301301
position: relative;
302+
z-index: 2;
302303

303304
&.scrollable {
304305
overflow-x: auto;
@@ -440,15 +441,13 @@ ui-grid {
440441
}
441442
}
442443

444+
mat-progress-bar {
445+
z-index: 2;
446+
}
447+
443448
.ui-grid-header {
444449
background-color: $header-background-color;
445450

446-
mat-progress-bar {
447-
position: absolute;
448-
right: 0;
449-
z-index: 1;
450-
}
451-
452451
.ui-grid-resize-handle-container {
453452
background-color: transparent;
454453
}
@@ -481,7 +480,7 @@ ui-grid {
481480
&:focus,
482481
&.cdk-focused {
483482
.ui-grid-action-cell {
484-
> div {
483+
> div:has(button) {
485484
box-shadow: -16px 0px 16px -4px $ui-grid-row-hover-color;
486485
}
487486
}

projects/angular/components/ui-grid/src/ui-grid.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ export class UiGridComponent<T extends IGridDataEntry>
774774
}
775775

776776
deficit$ = new BehaviorSubject(0);
777-
isOverflown$ = new BehaviorSubject(false);
778777

779778
minWidth$ = defer(() => merge(
780779
this.visible$,
@@ -785,11 +784,16 @@ export class UiGridComponent<T extends IGridDataEntry>
785784
tap(minWidth => {
786785
const containerWidth = this._ref.nativeElement.getBoundingClientRect().width;
787786
this.deficit$.next(Math.max(0, containerWidth - minWidth));
788-
789-
this.isOverflown$.next(this._isOverflown(minWidth));
790787
}),
791788
tap(() => { this._cd.detectChanges(); }),
792-
));
789+
)).pipe(
790+
shareReplay(1),
791+
);
792+
793+
isOverflown$ = this.minWidth$.pipe(
794+
map(minWidth => this._isOverflown(minWidth)),
795+
distinctUntilChanged(),
796+
);
793797

794798
tableOverflowStyle$ = this.isOverflown$.pipe(
795799
map(value => value ? 'visible' : 'hidden'),

0 commit comments

Comments
 (0)