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): implement
stark-date-time-picker
module/component
CLOSES ISSUE: NationalBankBelgium#587
- Loading branch information
1 parent
9429f4f
commit 6075e6a
Showing
32 changed files
with
2,202 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./date-time-picker/date-time-picker.module"; | ||
export * from "./date-time-picker/components"; |
10 changes: 10 additions & 0 deletions
10
packages/stark-ui/src/modules/date-time-picker/assets/translations/en.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @ignore | ||
*/ | ||
export const translationsEn: object = { | ||
STARK: { | ||
DATE_TIME_PICKER: { | ||
CLEAR_DATETIME: "Clear datetime" | ||
} | ||
} | ||
}; |
10 changes: 10 additions & 0 deletions
10
packages/stark-ui/src/modules/date-time-picker/assets/translations/fr.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @ignore | ||
*/ | ||
export const translationsFr: object = { | ||
STARK: { | ||
DATE_TIME_PICKER: { | ||
CLEAR_DATETIME: "Effacer la date et l'heure" | ||
} | ||
} | ||
}; |
10 changes: 10 additions & 0 deletions
10
packages/stark-ui/src/modules/date-time-picker/assets/translations/nl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @ignore | ||
*/ | ||
export const translationsNl: object = { | ||
STARK: { | ||
DATE_TIME_PICKER: { | ||
CLEAR_DATETIME: "Verwijder datetime" | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./components/date-time-picker.component"; |
39 changes: 39 additions & 0 deletions
39
packages/stark-ui/src/modules/date-time-picker/components/date-time-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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="date-time-wrapper" [formGroup]="dateTimeFormGroup"> | ||
<stark-date-picker | ||
[pickerId]="pickerId" | ||
[pickerName]="pickerName" | ||
formControlName="date" | ||
(dateChange)="onDateTimeChange()" | ||
[dateFilter]="dateFilter" | ||
[dateMask]="dateMask" | ||
[required]="required" | ||
[max]="max" | ||
[min]="min" | ||
></stark-date-picker> | ||
|
||
<input | ||
matInput | ||
#timeInput | ||
id="{{ pickerId + '-time-input' }}" | ||
name="{{ pickerName + '-time-input' }}" | ||
class="time-input" | ||
formControlName="time" | ||
(change)="onDateTimeChange()" | ||
[starkTimestampMask]="timeMask" | ||
[required]="required" | ||
/> | ||
<div class="mat-form-field-suffix mat-datepicker-toggle"> | ||
<button mat-icon-button (click)="focusTimeInput($event)" [disabled]="disabled"> | ||
<mat-icon svgIcon="clock"></mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<button | ||
mat-icon-button | ||
(click)="clearDateTime()" | ||
class="clear-date-time-button" | ||
[ngClass]="{ hidden: disabled || !focused || (!dateTimeFormGroup.value.date && !dateTimeFormGroup.value.time) }" | ||
> | ||
<mat-icon svgIcon="close" [matTooltip]="'STARK.DATE_TIME_PICKER.CLEAR_DATETIME' | translate"></mat-icon> | ||
</button> |
51 changes: 51 additions & 0 deletions
51
packages/stark-ui/src/modules/date-time-picker/components/date-time-picker.component.scss
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* The 'stark-date-time-picker-form-field-wrapper' is added dynamically by the component to the surrounding form field wrapper*/ | ||
.mat-form-field .mat-form-field-wrapper.stark-date-time-picker-form-field-wrapper { | ||
width: 280px; | ||
} | ||
|
||
.stark-date-time-picker { | ||
display: flex; | ||
|
||
.date-time-wrapper { | ||
width: 100%; | ||
display: flex; | ||
|
||
input { | ||
text-align: left; | ||
} | ||
|
||
/* Date */ | ||
> .stark-date-picker { | ||
flex: 2; | ||
max-width: 200px; | ||
} | ||
|
||
/* Time */ | ||
> .time-input { | ||
flex: 1; | ||
max-width: 60px; | ||
} | ||
} | ||
|
||
.mat-datepicker-toggle { | ||
transition: color 500ms; | ||
} | ||
|
||
/* | ||
&:not(.floating) .mat-datepicker-toggle { | ||
color: rgba(0, 0, 0, 0); | ||
} | ||
*/ | ||
|
||
.clear-date-time-button { | ||
height: 20px; | ||
width: 20px; | ||
line-height: 20px; | ||
position: absolute; | ||
margin-left: 280px; /* should be the same width of the 'stark-date-time-picker-form-field-wrapper' (see above) */ | ||
|
||
&.hidden { | ||
display: none; | ||
} | ||
} | ||
} |
Oops, something went wrong.