Skip to content

Commit d666e8b

Browse files
feat(alert): add attributes min & max to alert inputs
1 parent fdd50ba commit d666e8b

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

src/components/alert/alert-component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { ViewController } from '../../navigation/view-controller';
5151
'<template ngSwitchDefault>' +
5252
'<div class="alert-input-group">' +
5353
'<div *ngFor="let i of d.inputs" class="alert-input-wrapper">' +
54-
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" class="alert-input">' +
54+
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" [min]="i.min" [max]="i.max" class="alert-input">' +
5555
'</div>' +
5656
'</div>' +
5757
'</template>' +
@@ -157,6 +157,8 @@ export class AlertCmp {
157157
disabled: !!input.disabled,
158158
id: isPresent(input.id) ? input.id : `alert-input-${this.id}-${index}`,
159159
handler: isPresent(input.handler) ? input.handler : null,
160+
min: isPresent(input.min) ? input.min : null,
161+
max: isPresent(input.max) ? input.max : null
160162
};
161163
});
162164

src/components/alert/alert-options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ export interface AlertInputOptions {
1919
checked?: boolean;
2020
disabled?: boolean;
2121
id?: string;
22+
min?: string;
23+
max?: string;
2224
}

src/components/alert/alert.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ export class Alert extends ViewController {
244244
* | label | `string` | The input's label (only for radio/checkbox inputs) |
245245
* | checked | `boolean` | Whether or not the input is checked. |
246246
* | id | `string` | The input's id. |
247+
* | min | `string` | The input's minimum authorized value (only for date inputs) |
248+
* | max | `string` | The input's maximum authorized value (only for date inputs) |
247249
*
248250
* Button options
249251
*

src/components/alert/test/basic/app.module.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,18 @@ export class E2EPage {
109109
type: 'url',
110110
placeholder: 'Favorite site ever'
111111
});
112+
// input date with min & max
113+
alert.addInput({
114+
name: 'name4',
115+
type: 'date',
116+
min: '2017-03-01',
117+
max: '2018-01-12'
118+
});
119+
// input date without min nor max
120+
alert.addInput({
121+
name: 'name5',
122+
type: 'date'
123+
});
112124
alert.addButton({
113125
text: 'Cancel',
114126
handler: (data: any) => {

0 commit comments

Comments
 (0)