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-range-picker - add support for timestamp mask
ISSUES CLOSED: #1231
- Loading branch information
1 parent
a6007bd
commit 0403dea
Showing
15 changed files
with
201 additions
and
4 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
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
20 changes: 20 additions & 0 deletions
20
showcase/src/assets/examples/date-range-picker/custom-date-mask.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,20 @@ | ||
<div> | ||
<stark-date-range-picker | ||
rangePickerId="custom-date-mask-range-picker" | ||
rangePickerName="custom-date-mask-range-picker" | ||
[isDisabled]="isDisabled" | ||
[dateFilter]="customDateFilter" | ||
[dateMask]="customDateMask" | ||
[startDate]="startDate" | ||
startDateLabel="From" | ||
[startMinDate]="minDate" | ||
[startMaxDate]="maxDate" | ||
[endDate]="endDate" | ||
endDateLabel="To" | ||
[endMinDate]="startDate || minDate" | ||
[endMaxDate]="maxDate" | ||
(dateRangeChanged)="onDateChanged($event)" | ||
> | ||
</stark-date-range-picker> | ||
</div> | ||
<mat-checkbox [(ngModel)]="isDisabled">isDisabled</mat-checkbox> |
39 changes: 39 additions & 0 deletions
39
showcase/src/assets/examples/date-range-picker/custom-date-mask.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,39 @@ | ||
import { Component, Inject, OnInit } from "@angular/core"; | ||
import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; | ||
import { StarkDatePickerFilter, StarkTimestampMaskConfig } from "@nationalbankbelgium/stark-ui"; | ||
|
||
@Component({ | ||
selector: "demo-date-range-picker", | ||
templateUrl: "./demo-date-range-picker.component.html" | ||
}) | ||
export class DemoDateRangePickerComponent implements OnInit { | ||
public isDisabled: boolean; | ||
public startDate: Date; | ||
public endDate: Date; | ||
public minDate: Date; | ||
public maxDate: Date; | ||
public customDateFilter: StarkDatePickerFilter; | ||
public customDateMask: StarkTimestampMaskConfig = { | ||
format: "DD-MM-YYYY" | ||
}; | ||
|
||
public constructor(@Inject(STARK_LOGGING_SERVICE) public logger: StarkLoggingService) {} | ||
|
||
public ngOnInit(): void { | ||
this.startDate = new Date(); | ||
this.endDate = new Date(); | ||
this.endDate.setMonth(this.endDate.getMonth() + 1); | ||
this.minDate = new Date(); | ||
this.maxDate = new Date(); | ||
this.maxDate.setMonth(this.maxDate.getMonth() + 6); | ||
|
||
this.customDateFilter = (date: Date): boolean => { | ||
const day: number = date.getDay(); | ||
return day !== 0; | ||
}; | ||
} | ||
|
||
public onDateChanged(event: Object): void { | ||
this.logger.debug(event); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
showcase/src/assets/examples/date-range-picker/date-mask.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,20 @@ | ||
<div> | ||
<stark-date-range-picker | ||
rangePickerId="date-mask-range-picker" | ||
rangePickerName="date-mask-range-picker" | ||
[isDisabled]="isDisabled" | ||
[dateFilter]="customDateFilter" | ||
dateMask | ||
[startDate]="startDate" | ||
startDateLabel="From" | ||
[endDate]="endDate" | ||
endDateLabel="To" | ||
[startMinDate]="minDate" | ||
[startMaxDate]="maxDate" | ||
[endMinDate]="startDate || minDate" | ||
[endMaxDate]="maxDate" | ||
(dateRangeChanged)="onDateChanged($event)" | ||
> | ||
</stark-date-range-picker> | ||
<mat-checkbox [(ngModel)]="isDisabled">isDisabled</mat-checkbox> | ||
</div> |
36 changes: 36 additions & 0 deletions
36
showcase/src/assets/examples/date-range-picker/date-mask.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,36 @@ | ||
import { Component, Inject, OnInit } from "@angular/core"; | ||
import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; | ||
import { StarkDatePickerFilter } from "@nationalbankbelgium/stark-ui"; | ||
|
||
@Component({ | ||
selector: "demo-date-range-picker", | ||
templateUrl: "./demo-date-range-picker.component.html" | ||
}) | ||
export class DemoDateRangePickerComponent implements OnInit { | ||
public isDisabled: boolean; | ||
public startDate: Date; | ||
public endDate: Date; | ||
public minDate: Date; | ||
public maxDate: Date; | ||
public customDateFilter: StarkDatePickerFilter; | ||
|
||
public constructor(@Inject(STARK_LOGGING_SERVICE) public logger: StarkLoggingService) {} | ||
|
||
public ngOnInit(): void { | ||
this.startDate = new Date(); | ||
this.endDate = new Date(); | ||
this.endDate.setMonth(this.endDate.getMonth() + 1); | ||
this.minDate = new Date(); | ||
this.maxDate = new Date(); | ||
this.maxDate.setMonth(this.maxDate.getMonth() + 6); | ||
|
||
this.customDateFilter = (date: Date): boolean => { | ||
const day: number = date.getDay(); | ||
return day !== 0; | ||
}; | ||
} | ||
|
||
public onDateChanged(event: Object): void { | ||
this.logger.debug(event); | ||
} | ||
} |
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
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