Skip to content

Commit

Permalink
feat(alert): add attributes min & max to alert inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDemulierChevret committed Mar 1, 2017
1 parent fdd50ba commit d666e8b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/alert/alert-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { ViewController } from '../../navigation/view-controller';
'<template ngSwitchDefault>' +
'<div class="alert-input-group">' +
'<div *ngFor="let i of d.inputs" class="alert-input-wrapper">' +
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" class="alert-input">' +
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" [min]="i.min" [max]="i.max" class="alert-input">' +
'</div>' +
'</div>' +
'</template>' +
Expand Down Expand Up @@ -157,6 +157,8 @@ export class AlertCmp {
disabled: !!input.disabled,
id: isPresent(input.id) ? input.id : `alert-input-${this.id}-${index}`,
handler: isPresent(input.handler) ? input.handler : null,
min: isPresent(input.min) ? input.min : null,
max: isPresent(input.max) ? input.max : null
};
});

Expand Down
2 changes: 2 additions & 0 deletions src/components/alert/alert-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ export interface AlertInputOptions {
checked?: boolean;
disabled?: boolean;
id?: string;
min?: string;
max?: string;
}
2 changes: 2 additions & 0 deletions src/components/alert/alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ export class Alert extends ViewController {
* | label | `string` | The input's label (only for radio/checkbox inputs) |
* | checked | `boolean` | Whether or not the input is checked. |
* | id | `string` | The input's id. |
* | min | `string` | The input's minimum authorized value (only for date inputs) |
* | max | `string` | The input's maximum authorized value (only for date inputs) |
*
* Button options
*
Expand Down
12 changes: 12 additions & 0 deletions src/components/alert/test/basic/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ export class E2EPage {
type: 'url',
placeholder: 'Favorite site ever'
});
// input date with min & max
alert.addInput({
name: 'name4',
type: 'date',
min: '2017-03-01',
max: '2018-01-12'
});
// input date without min nor max
alert.addInput({
name: 'name5',
type: 'date'
});
alert.addButton({
text: 'Cancel',
handler: (data: any) => {
Expand Down

0 comments on commit d666e8b

Please sign in to comment.