Skip to content

Commit f8da4bf

Browse files
authored
Merge pull request #121 from vicky-polatov/feature/overflow-functionality
feat: overflow functionality
2 parents b93df6c + db8731b commit f8da4bf

File tree

7 files changed

+19
-3
lines changed

7 files changed

+19
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ bootstrapApplication(AppComponent, {
281281
backdrop: boolean,
282282
resizable: boolean,
283283
draggable: boolean,
284+
overflow: boolean,
284285
draggableConstraint: none | bounce | constrain,
285286
sizes,
286287
size: sm | md | lg | fullScreen | string,

apps/playground/src/app/app.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ <h2>Configure your dialog</h2>
5757
<label>Close Button</label>
5858
<input type="checkbox" formControlName="closeButton" />
5959
</div>
60+
<div>
61+
<label>Overflow ❌</label>
62+
<input type="checkbox" formControlName="overflow" />
63+
</div>
6064
<ng-container formGroupName="enableClose">
6165
<div>
6266
<label>Escape to Close ❌</label>

apps/playground/src/app/app.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ button {
2424
}
2525

2626
form {
27-
max-height: 260px;
27+
max-height: 300px;
2828
display: flex;
2929
flex-direction: column;
3030
flex-wrap: wrap;

apps/playground/src/app/app.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class AppComponent {
3737
backdrop: [true],
3838
resizable: [false],
3939
draggable: [false],
40+
overflow: [true],
4041
dragConstraint: ['none'],
4142
size: [''],
4243
windowClass: [''],
@@ -76,6 +77,9 @@ export class AppComponent {
7677
this.backDropClicked = false;
7778
this.cleanConfig = this.normalizeConfig(config);
7879

80+
if (this.cleanConfig.overflow) document.body.style.setProperty('--dialog-overflow', 'visible');
81+
else document.body.style.setProperty('--dialog-overflow', 'hidden');
82+
7983
const ref = this.dialog.open(compOrTemplate as any, this.cleanConfig);
8084

8185
ref?.backdropClick$.subscribe({

libs/dialog/src/lib/dialog.component.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
flex-direction: column;
44
overflow: hidden;
55
position: relative;
6+
67
@keyframes dialog-open {
78
0% {
89
transform: translateX(50px);
910
}
11+
1012
100% {
1113
transform: none;
1214
}
@@ -97,6 +99,6 @@
9799
}
98100
}
99101

100-
body.ngneat-dialog-hidden {
101-
overflow: hidden;
102+
body {
103+
overflow: var(--dialog-overflow, hidden);
102104
}

libs/dialog/src/lib/dialog.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export class DialogComponent implements OnInit, OnDestroy {
115115
}
116116
}
117117

118+
if (this.config.overflow) {
119+
document.body.style.setProperty('--dialog-overflow', 'visible');
120+
}
121+
118122
this.host.id = this.config.id;
119123
}
120124

libs/dialog/src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface GlobalDialogConfig {
3232
backdrop: CloseStrategy;
3333
};
3434
resizable: boolean;
35+
overflow: boolean;
3536
width: string | number;
3637
minWidth: string | number;
3738
maxWidth: string | number;

0 commit comments

Comments
 (0)