Skip to content

Commit 3e412ea

Browse files
authored
Merge pull request #103 from RiskChallenger/min-max-width
feat: configure min-width and max-width sizes
2 parents 7e4f241 + fb7dd0c commit 3e412ea

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ In the `forRoot` method when importing the dialog module in the app module you c
230230
- `size` - Set the modal size according to your global [custom sizes](#custom-sizes) (default is `md`).
231231
- `windowClass` - Add a custom class to the modal container.
232232
- `width` - Set a custom width (default unit is `px`).
233+
- `minWidth` - Set a custom min-width (default unit is `px`).
234+
- `maxWidth` - Set a custom max-width (default unit is `px`).
233235
- `height` - Set a custom height (default unit is `px`).
234236
- `minHeight` - Set a custom min-height (default unit is `px`).
235237
- `maxHeight` - Set a custom max-height (default unit is `px`).
@@ -251,6 +253,8 @@ bootstrapApplication(AppComponent, {
251253
size: sm | md | lg | fullScreen | string,
252254
windowClass: string,
253255
width: string | number,
256+
minWidth: string | number,
257+
maxWidth: string | number,
254258
height: string | number,
255259
minHeight: string | number,
256260
maxHeight: string | number,

projects/ngneat/dialog/src/lib/dialog.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export class DialogComponent implements OnInit, OnDestroy {
5555
private size = this.config.sizes?.[this.config.size || 'md'];
5656
styles = {
5757
width: coerceCssPixelValue(this.config.width || this.size?.width),
58+
minWidth: coerceCssPixelValue(this.config.minWidth || this.size?.minWidth),
59+
maxWidth: coerceCssPixelValue(this.config.maxWidth || this.size?.maxWidth),
5860
height: coerceCssPixelValue(this.config.height || this.size?.height),
5961
minHeight: coerceCssPixelValue(this.config.minHeight || this.size?.minHeight),
6062
maxHeight: coerceCssPixelValue(this.config.maxHeight || this.size?.maxHeight),

projects/ngneat/dialog/src/lib/providers.ts

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export function defaultGlobalConfig(): Partial<GlobalDialogConfig & DialogConfig
3333
size: 'md',
3434
windowClass: undefined,
3535
width: undefined,
36+
minWidth: undefined,
37+
maxWidth: undefined,
3638
height: undefined,
3739
minHeight: undefined,
3840
maxHeight: undefined,

projects/ngneat/dialog/src/lib/types.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ export interface GlobalDialogConfig {
88
sizes: Partial<
99
Record<
1010
Sizes,
11-
{ width?: string | number; height?: string | number; minHeight?: string | number; maxHeight?: string | number }
11+
{
12+
width?: string | number;
13+
minWidth?: string | number;
14+
maxWidth?: string | number;
15+
height?: string | number;
16+
minHeight?: string | number;
17+
maxHeight?: string | number;
18+
}
1219
>
1320
>;
1421
backdrop: boolean;
@@ -19,6 +26,8 @@ export interface GlobalDialogConfig {
1926
enableClose: boolean | 'onlyLastStrategy';
2027
resizable: boolean;
2128
width: string | number;
29+
minWidth: string | number;
30+
maxWidth: string | number;
2231
height: string | number;
2332
minHeight: string | number;
2433
maxHeight: string | number;

0 commit comments

Comments
 (0)