forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stark-ui): date-picker - add support for ControlValueAccessor, M…
…atFormFieldControl, Validator and starkTimestampMask directive * add `dateMask` input binding to date-picker. It allows to use timestampMask directive. * add `required` input binding. ISSUES CLOSED: #1146 BREAKING CHANGE: stark-date-picker now integrates ControlValueAccessor and Validator: - The following Input have been changed: - **date** is now **value** - **maxDate** is now **max** - **minDate** is now **min** - **label** is now **placeholder** (the date-picker does not translate the placeholder anymore, it has to be done by the developer when passing the value --> `[placeholder]="'MY_TRANSLATION_KEY' | translate"`) - **isDisabled** is now **disabled** - The output **dateChanged** is now **dateChange** - **dateInput** Output has been added and now the date-picker Input/Output are similar to the ones of MatDatepicker component - We respect now the Constraint validation standards. See: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes
- Loading branch information
1 parent
765f2f3
commit 81dcd18
Showing
32 changed files
with
1,178 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from "./components/date-picker.component"; | ||
export { StarkDatePickerMaskConfig, StarkDatePickerComponent, StarkDatePickerFilter } from "./components/date-picker.component"; | ||
export * from "./components/date-format.constants"; |
13 changes: 11 additions & 2 deletions
13
packages/stark-ui/src/modules/date-picker/components/date-format.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 21 additions & 16 deletions
37
packages/stark-ui/src/modules/date-picker/components/date-picker.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
<mat-form-field [id]="pickerId"> | ||
<input | ||
matInput | ||
[disabled]="isDisabled" | ||
[id]="pickerId + '-input'" | ||
[matDatepicker]="picker" | ||
[placeholder]="label | translate" | ||
[matDatepickerFilter]="dateFilterFnWrapper" | ||
[min]="minDate" | ||
[max]="maxDate" | ||
[name]="pickerName" | ||
[value]="date" | ||
(dateChange)="onDateChange($event)" | ||
/> | ||
<input | ||
matInput | ||
[id]="pickerId + '-input'" | ||
[matDatepicker]="picker" | ||
[value]="value" | ||
(dateInput)="onDateInput($event)" | ||
(dateChange)="onDateChange($event)" | ||
[matDatepickerFilter]="dateFilterFnWrapper" | ||
[min]="min" | ||
[disabled]="disabled" | ||
[max]="max" | ||
[name]="pickerName" | ||
[required]="required" | ||
(focus)="onFocus($event)" | ||
(blur)="onBlur()" | ||
[starkTimestampMask]="getTimestampMaskConfig()" | ||
/> | ||
<mat-datepicker [id]="pickerId" #picker></mat-datepicker> | ||
<!-- This class is necessary to apply the mat-form-field styles on the `mat-datepicker-toggle` element. --> | ||
<div class="mat-form-field-suffix"> | ||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> | ||
<mat-datepicker [id]="pickerId" #picker></mat-datepicker> | ||
</mat-form-field> | ||
</div> |
Oops, something went wrong.