|
1 | | -import { ChangeDetectorRef, Component, Inject, LOCALE_ID } from "@angular/core"; |
2 | | -import { FormBuilder, FormGroup, ReactiveFormsModule } from "@angular/forms"; |
3 | | -import { KENDO_DROPDOWNLIST } from "@progress/kendo-angular-dropdowns"; |
4 | | -import { CldrIntlService, IntlService } from "@progress/kendo-angular-intl"; |
5 | | -import { MessageService } from "@progress/kendo-angular-l10n"; |
6 | | -import { CreateFormGroupArgs, KENDO_SCHEDULER } from "@progress/kendo-angular-scheduler"; |
7 | | -import { KENDO_TOOLBAR } from "@progress/kendo-angular-toolbar"; |
8 | | -import { customModelFields, displayDate, sampleDataWithCustomSchema } from "../../data/scheduler-data"; |
9 | | -import { SchedulerMessageService } from "../../services/scheduler-message.service"; |
| 1 | +import { Component, Inject, LOCALE_ID } from '@angular/core'; |
| 2 | +import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; |
| 3 | +import { KENDO_DROPDOWNLIST } from '@progress/kendo-angular-dropdowns'; |
| 4 | +import { CldrIntlService, IntlService } from '@progress/kendo-angular-intl'; |
| 5 | +import { MessageService } from '@progress/kendo-angular-l10n'; |
| 6 | +import { CreateFormGroupArgs, KENDO_SCHEDULER } from '@progress/kendo-angular-scheduler'; |
| 7 | +import { KENDO_TOOLBAR } from '@progress/kendo-angular-toolbar'; |
| 8 | +import { customModelFields, displayDate, sampleDataWithCustomSchema } from '../../data/scheduler-data'; |
| 9 | +import { SchedulerMessageService } from '../../services/scheduler-message.service'; |
10 | 10 |
|
11 | | -import "@progress/kendo-angular-intl/locales/en/all"; |
12 | | -import "@progress/kendo-angular-intl/locales/es/all"; |
| 11 | +import '@progress/kendo-angular-intl/locales/en/all'; |
| 12 | +import '@progress/kendo-angular-intl/locales/es/all'; |
13 | 13 |
|
14 | 14 | interface LanguageOption { |
15 | 15 | text: string; |
16 | 16 | value: string; |
17 | 17 | } |
18 | 18 | @Component({ |
19 | | - selector: "app-scheduler", |
| 19 | + selector: 'app-scheduler', |
20 | 20 | imports: [KENDO_SCHEDULER, KENDO_TOOLBAR, KENDO_DROPDOWNLIST, ReactiveFormsModule], |
21 | 21 | providers: [ |
22 | 22 | { provide: MessageService, useClass: SchedulerMessageService }, |
23 | | - { provide: LOCALE_ID, useValue: "en" }, |
| 23 | + { provide: LOCALE_ID, useValue: 'en' }, |
24 | 24 | ], |
25 | | - templateUrl: "./scheduler.component.html", |
26 | | - styleUrls: ["./scheduler.component.css"], |
| 25 | + templateUrl: './scheduler.component.html', |
| 26 | + styleUrls: ['./scheduler.component.css'], |
27 | 27 | }) |
28 | 28 | export class SchedulerComponent { |
29 | 29 | public selectedDate: Date = displayDate; |
30 | 30 | public events: any[] = sampleDataWithCustomSchema; |
31 | | - public currentView: string = "day"; |
| 31 | + public currentView: string = 'day'; |
32 | 32 | public modelFields = customModelFields; |
33 | | - public orientation: "horizontal" | "vertical" = "horizontal"; |
| 33 | + public orientation: 'horizontal' | 'vertical' = 'horizontal'; |
34 | 34 | public formGroup!: FormGroup; |
35 | | - public group: any = { resources: ["Rooms", "Persons"] }; |
| 35 | + public group: any = { resources: ['Rooms', 'Persons'] }; |
36 | 36 |
|
37 | 37 | public resources = [ |
38 | 38 | { |
39 | | - name: "Rooms", |
| 39 | + name: 'Rooms', |
40 | 40 | data: [ |
41 | | - { text: "Meeting Room 101", value: 1, color: "#5392E4" }, |
42 | | - { text: "Meeting Room 201", value: 2, color: "#FF7272" }, |
| 41 | + { text: 'Meeting Room 101', value: 1, color: '#5392E4' }, |
| 42 | + { text: 'Meeting Room 201', value: 2, color: '#FF7272' }, |
43 | 43 | ], |
44 | | - field: "RoomID", |
45 | | - valueField: "value", |
46 | | - textField: "text", |
47 | | - colorField: "color", |
| 44 | + field: 'RoomID', |
| 45 | + valueField: 'value', |
| 46 | + textField: 'text', |
| 47 | + colorField: 'color', |
48 | 48 | }, |
49 | 49 | { |
50 | | - name: "Persons", |
| 50 | + name: 'Persons', |
51 | 51 | data: [ |
52 | | - { text: "Peter", value: 1, color: "#5392E4" }, |
53 | | - { text: "Alex", value: 2, color: "#54677B" }, |
| 52 | + { text: 'Peter', value: 1, color: '#5392E4' }, |
| 53 | + { text: 'Alex', value: 2, color: '#54677B' }, |
54 | 54 | ], |
55 | | - field: "PersonIDs", |
56 | | - valueField: "value", |
57 | | - textField: "text", |
58 | | - colorField: "color", |
| 55 | + field: 'PersonIDs', |
| 56 | + valueField: 'value', |
| 57 | + textField: 'text', |
| 58 | + colorField: 'color', |
59 | 59 | }, |
60 | 60 | ]; |
61 | 61 | public languages: LanguageOption[] = [ |
62 | | - { text: "English", value: "en" }, |
63 | | - { text: "Spanish", value: "es" }, |
| 62 | + { text: 'English', value: 'en' }, |
| 63 | + { text: 'Spanish', value: 'es' }, |
64 | 64 | ]; |
65 | | - public selectedLanguage: any = { text: "English", value: "en-US" }; |
| 65 | + public selectedLanguage: any = { text: 'English', value: 'en-US' }; |
66 | 66 | constructor( |
67 | 67 | private formBuilder: FormBuilder, |
68 | 68 | private messages: MessageService, |
69 | 69 | @Inject(LOCALE_ID) public localeId: string, |
70 | | - public intlService: IntlService, |
71 | | - private cdr: ChangeDetectorRef |
| 70 | + public intlService: IntlService |
72 | 71 | ) { |
73 | 72 | this.createFormGroup = this.createFormGroup.bind(this); |
74 | 73 | } |
@@ -121,12 +120,12 @@ export class SchedulerComponent { |
121 | 120 | } |
122 | 121 | } |
123 | 122 |
|
124 | | - public handleOrientationChange(orientation: "horizontal" | "vertical"): void { |
| 123 | + public handleOrientationChange(orientation: 'horizontal' | 'vertical'): void { |
125 | 124 | this.orientation = orientation; |
126 | 125 | } |
127 | 126 | public changeLanguage(language: LanguageOption): void { |
128 | 127 | const svc = <SchedulerMessageService>this.messages; |
129 | | - svc.language = svc.language === "es" ? "en" : "es"; |
| 128 | + svc.language = svc.language === 'es' ? 'en' : 'es'; |
130 | 129 | (this.intlService as CldrIntlService).localeId = language.value; |
131 | 130 | } |
132 | 131 | } |
0 commit comments