-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: IvayloG <[email protected]> Co-authored-by: wnvko <[email protected]> Co-authored-by: Simeon Simeonoff <[email protected]>
- Loading branch information
1 parent
689868f
commit ee4a0fa
Showing
26 changed files
with
466 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { IgxDateRangePickerModule, IgxIconModule, IgxInputGroupModule, IgxSelectModule } from "igniteui-angular"; | ||
import { BasicDateRangePickerComponent | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-basic/daterangepicker-basic"; | ||
import { FlightBookingComponent, PipeWithoutTownFrom | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-flight-booking/daterangepicker-flight-booking"; | ||
import { DateRangePickerModeComponent | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-mode/daterangepicker-mode"; | ||
import { DateRangePickerStartEndComponent | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-start-end/daterangepicker-start-end"; | ||
import { StyledDateRangePickerComponent | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-styling/daterangepicker-styling"; | ||
import { DateRangePickerValidationComponent | ||
} from "../../src/app/scheduling/daterangepicker/daterangepicker-validation/daterangepicker-validation"; | ||
import { AppModuleConfig } from "./core/AppModuleConfig"; | ||
import { Config } from "./core/Config"; | ||
import { IConfigGenerator } from "./core/IConfigGenerator"; | ||
|
||
export class DateRangePickerConfigGenerator implements IConfigGenerator { | ||
public generateConfigs(): Config[] { | ||
const configs = new Array<Config>(); | ||
|
||
configs.push( | ||
new Config({ | ||
component: BasicDateRangePickerComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, IgxInputGroupModule, BasicDateRangePickerComponent], | ||
ngDeclarations: [BasicDateRangePickerComponent], | ||
ngImports: [IgxDateRangePickerModule, IgxInputGroupModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
configs.push( | ||
new Config({ | ||
component: DateRangePickerModeComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, DateRangePickerModeComponent], | ||
ngDeclarations: [DateRangePickerModeComponent], | ||
ngImports: [IgxDateRangePickerModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
configs.push( | ||
new Config({ | ||
component: DateRangePickerStartEndComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, DateRangePickerStartEndComponent, | ||
IgxInputGroupModule, IgxIconModule ], | ||
ngDeclarations: [DateRangePickerStartEndComponent], | ||
ngImports: [IgxDateRangePickerModule, IgxInputGroupModule, IgxIconModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
configs.push( | ||
new Config({ | ||
component: DateRangePickerValidationComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, DateRangePickerValidationComponent, | ||
IgxInputGroupModule, IgxIconModule], | ||
ngDeclarations: [DateRangePickerValidationComponent], | ||
ngImports: [IgxDateRangePickerModule, IgxInputGroupModule, IgxIconModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
configs.push( | ||
new Config({ | ||
component: StyledDateRangePickerComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, StyledDateRangePickerComponent, | ||
IgxInputGroupModule, IgxIconModule], | ||
ngDeclarations: [StyledDateRangePickerComponent], | ||
ngImports: [IgxDateRangePickerModule, IgxInputGroupModule, IgxIconModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
configs.push( | ||
new Config({ | ||
component: FlightBookingComponent, | ||
appModuleConfig: new AppModuleConfig({ | ||
imports: [IgxDateRangePickerModule, IgxSelectModule, | ||
IgxInputGroupModule, IgxIconModule, FlightBookingComponent, PipeWithoutTownFrom], | ||
ngDeclarations: [FlightBookingComponent, PipeWithoutTownFrom], | ||
ngImports: [IgxDateRangePickerModule, IgxSelectModule, IgxInputGroupModule, IgxIconModule] | ||
}), | ||
shortenComponentPathBy: "/scheduling/daterangepicker/" | ||
}) | ||
); | ||
|
||
return configs; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/app/scheduling/datepicker/datepicker-sample-1/datepicker-sample-1.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.date-picker-wrapper { | ||
.datе-picker-wrapper { | ||
padding: 1rem; | ||
max-width: 600px; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/app/scheduling/daterangepicker/daterangepicker-basic/daterangepicker-basic.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,5 @@ | ||
|
||
<igx-date-range-picker [(ngModel)]="range"> | ||
<label igxLabel>Flight dates</label> | ||
</igx-date-range-picker> | ||
|
5 changes: 5 additions & 0 deletions
5
src/app/scheduling/daterangepicker/daterangepicker-basic/daterangepicker-basic.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,5 @@ | ||
:host { | ||
display: block; | ||
padding: 1rem; | ||
max-width: 600px; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/scheduling/daterangepicker/daterangepicker-basic/daterangepicker-basic.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,11 @@ | ||
import { Component } from "@angular/core"; | ||
import { DateRange } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "basic-rangedatepicker", | ||
styleUrls: ["./daterangepicker-basic.scss"], | ||
templateUrl: "./daterangepicker-basic.html" | ||
}) | ||
export class BasicDateRangePickerComponent { | ||
public range: DateRange = { start: new Date(), end: new Date(new Date().setDate(new Date().getDate() + 5)) }; | ||
} |
34 changes: 34 additions & 0 deletions
34
...duling/daterangepicker/daterangepicker-flight-booking/daterangepicker-flight-booking.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,34 @@ | ||
|
||
<form> | ||
<div class="towns"> | ||
<igx-select name="townFrom" [(ngModel)]="townFrom" class="town-select"> | ||
<igx-prefix> | ||
<igx-icon>flight_takeoff</igx-icon> | ||
</igx-prefix> | ||
<igx-select-item *ngFor="let town of towns" [value]="town"> | ||
{{town}} | ||
</igx-select-item> | ||
</igx-select> | ||
<igx-select name="townTo" [(ngModel)]="townTo" class="town-select"> | ||
<igx-prefix> | ||
<igx-icon>flight_land</igx-icon> | ||
</igx-prefix> | ||
<igx-select-item *ngFor="let town of towns | withoutTownFrom:townFrom" [value]="town"> | ||
{{town}} | ||
</igx-select-item> | ||
</igx-select> | ||
</div> | ||
|
||
<igx-date-range-picker name="datesRange" #dateRangePicker="ngModel" required | ||
[(ngModel)]="range" | ||
[minValue]="minDate" | ||
[maxValue]="maxDate" | ||
[placeholder]="'Depart on - Return on'" | ||
> | ||
<label igxLabel>Flight dates</label> | ||
<igx-hint *ngIf="dateRangePicker.invalid && (dateRangePicker.dirty || dateRangePicker.touched)"> | ||
Please choose start and end date! | ||
</igx-hint> | ||
</igx-date-range-picker> | ||
</form> | ||
|
16 changes: 16 additions & 0 deletions
16
...duling/daterangepicker/daterangepicker-flight-booking/daterangepicker-flight-booking.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,16 @@ | ||
:host { | ||
display: block; | ||
padding: 1rem; | ||
max-width: 700px; | ||
} | ||
|
||
.towns { | ||
display: flex; | ||
margin-top: 16px; | ||
justify-content: space-between; | ||
} | ||
.town-select { | ||
display: inline-block; | ||
width: 49%; | ||
} | ||
|
54 changes: 54 additions & 0 deletions
54
...heduling/daterangepicker/daterangepicker-flight-booking/daterangepicker-flight-booking.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,54 @@ | ||
import { Component, Pipe, PipeTransform } from "@angular/core"; | ||
import { DateRange } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "flight-booking", | ||
styleUrls: ["./daterangepicker-flight-booking.scss"], | ||
templateUrl: "./daterangepicker-flight-booking.html" | ||
}) | ||
export class FlightBookingComponent { | ||
public towns: string[] = [ | ||
"New York", | ||
"Washington, D.C.", | ||
"London", | ||
"Berlin", | ||
"Sofia", | ||
"Rome", | ||
"Kiev", | ||
"Copenhagen", | ||
"Paris", | ||
"Barcelona", | ||
"Vienna", | ||
"Athens", | ||
"Dublin", | ||
"Yerevan", | ||
"Oslo", | ||
"Helsinki", | ||
"Stockholm", | ||
"Prague", | ||
"Istanbul" | ||
]; | ||
public townFrom = "Barcelona"; | ||
public townTo = "New York"; | ||
public minDate: Date; | ||
public maxDate: Date; | ||
public range: DateRange; | ||
|
||
constructor() { | ||
const today = new Date(); | ||
|
||
this.minDate = new Date(); | ||
this.minDate.setDate(today.getDate() + 10); | ||
|
||
this.maxDate = new Date(); | ||
this.maxDate.setDate(today.getDate() + 10); | ||
this.maxDate.setMonth(today.getMonth() + 1); | ||
} | ||
} | ||
|
||
@Pipe({ name: "withoutTownFrom" }) | ||
export class PipeWithoutTownFrom implements PipeTransform { | ||
public transform(collection: any[], townFrom: string) { | ||
return collection.filter((item) => item !== townFrom); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/app/scheduling/daterangepicker/daterangepicker-mode/daterangepicker-mode.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 @@ | ||
<igx-date-range-picker value="range" [mode]="'dropdown'"></igx-date-range-picker> |
5 changes: 5 additions & 0 deletions
5
src/app/scheduling/daterangepicker/daterangepicker-mode/daterangepicker-mode.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,5 @@ | ||
:host { | ||
display: block; | ||
padding: 1rem; | ||
max-width: 600px; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/scheduling/daterangepicker/daterangepicker-mode/daterangepicker-mode.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,11 @@ | ||
import { Component } from "@angular/core"; | ||
import { DateRange } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "mode-rangedatepicker", | ||
styleUrls: ["./daterangepicker-mode.scss"], | ||
templateUrl: "./daterangepicker-mode.html" | ||
}) | ||
export class DateRangePickerModeComponent { | ||
public range: DateRange = { start: new Date(), end: new Date(new Date().setDate(new Date().getDate() + 5)) }; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/scheduling/daterangepicker/daterangepicker-start-end/daterangepicker-start-end.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,11 @@ | ||
<igx-date-range-picker [(ngModel)]="range"> | ||
<igx-date-range-start> | ||
<input igxInput igxDateTimeEditor type="text"> | ||
<igx-picker-toggle igxPrefix> | ||
<igx-icon>calendar_today</igx-icon> | ||
</igx-picker-toggle> | ||
</igx-date-range-start> | ||
<igx-date-range-end> | ||
<input igxInput igxDateTimeEditor type="text"> | ||
</igx-date-range-end> | ||
</igx-date-range-picker> |
4 changes: 4 additions & 0 deletions
4
src/app/scheduling/daterangepicker/daterangepicker-start-end/daterangepicker-start-end.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,4 @@ | ||
:host { | ||
display: block; | ||
padding: 1rem; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/scheduling/daterangepicker/daterangepicker-start-end/daterangepicker-start-end.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,11 @@ | ||
import { Component } from "@angular/core"; | ||
import { DateRange } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "rangedatepicker-start-end", | ||
styleUrls: ["./daterangepicker-start-end.scss"], | ||
templateUrl: "./daterangepicker-start-end.html" | ||
}) | ||
export class DateRangePickerStartEndComponent { | ||
public range: DateRange = { start: new Date(), end: new Date(new Date().setDate(new Date().getDate() + 5)) }; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/app/scheduling/daterangepicker/daterangepicker-styling/daterangepicker-styling.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,11 @@ | ||
<igx-date-range-picker [(ngModel)]="range" [overlaySettings]="{ outlet: element }"> | ||
<igx-date-range-start> | ||
<input igxInput igxDateTimeEditor type="text"> | ||
<igx-picker-toggle igxPrefix> | ||
<igx-icon>calendar_today</igx-icon> | ||
</igx-picker-toggle> | ||
</igx-date-range-start> | ||
<igx-date-range-end> | ||
<input igxInput igxDateTimeEditor type="text"> | ||
</igx-date-range-end> | ||
</igx-date-range-picker> |
47 changes: 47 additions & 0 deletions
47
src/app/scheduling/daterangepicker/daterangepicker-styling/daterangepicker-styling.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,47 @@ | ||
// in component.scss | ||
@import '~igniteui-angular/lib/core/styles/themes/index'; | ||
|
||
// common | ||
$purple: #9E379F; | ||
$blue: #61AEDB; | ||
|
||
$custom-palette: igx-palette($primary: $blue, $secondary: $purple); | ||
|
||
$today-text: igx-color($custom-palette, "primary", 500); | ||
$text-color: igx-color($custom-palette, "secondary", 200); | ||
$color-focused: igx-color($custom-palette, "secondary", 500); | ||
|
||
|
||
// DATE-RANGE | ||
$custom-date-range-theme: igx-date-range-picker-theme( | ||
$label-color: $color-focused | ||
); | ||
|
||
// INPUT GROUP | ||
$custom-input-group-theme: igx-input-group-theme( | ||
$palette: $custom-palette, | ||
$filled-text-color: $text-color, | ||
$idle-text-color: $text-color, | ||
$focused-text-color: $color-focused, | ||
$hover-bottom-line-color: $color-focused, | ||
$idle-bottom-line-color: $purple | ||
); | ||
|
||
// CALENDAR styling specific overlay component requires outlet -> [overlaySettings]="{ outlet: element }" | ||
$custom-calendar-theme: igx-calendar-theme( | ||
$palette: $custom-palette, | ||
$date-current-text-color: $today-text, | ||
$border-radius: 0.5, | ||
$date-border-radius: 0.5 | ||
); | ||
|
||
:host { | ||
display: block; | ||
padding: 1rem; | ||
|
||
::ng-deep { | ||
@include igx-date-range-picker($custom-date-range-theme); | ||
@include igx-input-group($custom-input-group-theme); | ||
@include igx-calendar($custom-calendar-theme); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/app/scheduling/daterangepicker/daterangepicker-styling/daterangepicker-styling.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,13 @@ | ||
import { Component, ElementRef } from "@angular/core"; | ||
import { DateRange } from "igniteui-angular"; | ||
|
||
@Component({ | ||
selector: "styled-rangedatepicker", | ||
styleUrls: ["./daterangepicker-styling.scss"], | ||
templateUrl: "./daterangepicker-styling.html" | ||
}) | ||
export class StyledDateRangePickerComponent { | ||
public range: DateRange = { start: new Date(), end: new Date(new Date().setDate(new Date().getDate() + 5)) }; | ||
|
||
constructor(public element: ElementRef) { } | ||
} |
Oops, something went wrong.