ngx-mat-tui-calendar 0.0.14 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,43 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, NgModule } from '@angular/core';
2
+ import { Injectable, Component, Inject, ViewEncapsulation, EventEmitter, Output, Input, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/material/dialog';
4
+ import { MAT_DIALOG_DATA, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
5
+ import distinctColors from 'distinct-colors';
6
+ import { v4 } from 'uuid';
7
+ import { faCalendarCheck, faCaretLeft, faCaretRight, faBackward, faForward, faTable, faColumns, faListAlt } from '@fortawesome/free-solid-svg-icons';
8
+ import Calendar from 'tui-calendar';
9
+ import * as i7 from '@angular/forms';
10
+ import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
11
+ import * as i2 from '@angular/material/form-field';
12
+ import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i3 from '@angular/material/radio';
14
+ import { MatRadioModule } from '@angular/material/radio';
15
+ import * as i4 from '@angular/material/datepicker';
16
+ import { MatDatepickerModule } from '@angular/material/datepicker';
17
+ import * as i5 from '@angular/material/divider';
18
+ import { MatDividerModule } from '@angular/material/divider';
19
+ import * as i6 from '@angular/material/button';
20
+ import { MatButtonModule } from '@angular/material/button';
21
+ import * as i8 from '@angular/material/input';
22
+ import { MatInputModule } from '@angular/material/input';
23
+ import * as i9 from '@angular/common';
24
+ import * as i10 from 'mat-timepicker';
25
+ import { MatTimepickerModule } from 'mat-timepicker';
26
+ import * as i2$1 from '@angular/material/toolbar';
27
+ import { MatToolbarModule } from '@angular/material/toolbar';
28
+ import * as i4$1 from '@fortawesome/angular-fontawesome';
29
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
30
+ import * as i5$1 from '@angular/material/button-toggle';
31
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
32
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
33
+ import { BrowserModule } from '@angular/platform-browser';
34
+ import { FlexLayoutModule, FlexModule } from '@angular/flex-layout';
35
+ import { HttpClientModule } from '@angular/common/http';
36
+ import { OverlayModule } from '@angular/cdk/overlay';
37
+ import { MatCardModule } from '@angular/material/card';
38
+ import { MatIconModule } from '@angular/material/icon';
39
+ import { MatNativeDateModule, MatRippleModule } from '@angular/material/core';
40
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
3
41
 
4
42
  class NgxMatTuiCalendarService {
5
43
  constructor() { }
@@ -13,52 +51,859 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImpo
13
51
  }]
14
52
  }], ctorParameters: function () { return []; } });
15
53
 
54
+ // import { TZDate } from 'tui-calendar';
55
+ class LocalDate {
56
+ // month = 1 to 12
57
+ constructor(args) {
58
+ let numbers;
59
+ if (typeof args == 'string') {
60
+ numbers = LocalDate.parse_YYYYMMDD(args);
61
+ }
62
+ else if (args instanceof LocalDate) {
63
+ numbers = args.get();
64
+ }
65
+ else if (args instanceof Date) {
66
+ numbers = LocalDate.convertDateToNumbers(args);
67
+ }
68
+ else if (typeof args.toDate === 'function') {
69
+ numbers = LocalDate.convertDateToNumbers(args.toDate());
70
+ }
71
+ else if (args['_date'] instanceof Date) {
72
+ numbers = LocalDate.convertDateToNumbers(args['_date']);
73
+ }
74
+ else if (args instanceof Object) {
75
+ numbers = args;
76
+ }
77
+ this.date = LocalDate.convertNumbersToDate(numbers);
78
+ }
79
+ static convertToJsDate(args) {
80
+ return (new LocalDate(args)).toDate();
81
+ }
82
+ // return new LocalDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
83
+ static parse_YYYYMMDD(str) {
84
+ // yyyy-mm-dd
85
+ const regexp = /^(\d\d\d\d)-(\d\d)-(\d\d)/g;
86
+ let matches = Array.from(str.matchAll(regexp), m => ({
87
+ year: Number(m[1]),
88
+ month: Number(m[2]),
89
+ day: Number(m[3])
90
+ }));
91
+ if (matches.length != 1) {
92
+ console.error(`dateIn: unknown date format: ${str}`);
93
+ return null;
94
+ }
95
+ return matches[0];
96
+ }
97
+ static convertNumbersToDate({ year, month, day, hours, minutes, seconds, milliseconds }) {
98
+ // month = 1 to 12
99
+ // start with today's *local* date. this si really important
100
+ let date = new Date();
101
+ date.setFullYear(year);
102
+ date.setMonth((month == null) ? 0 : month - 1);
103
+ date.setDate((day == null) ? 1 : day);
104
+ date.setHours((hours == null) ? 0 : hours);
105
+ date.setMinutes((minutes == null) ? 0 : minutes);
106
+ date.setSeconds((seconds == null) ? 0 : seconds);
107
+ date.setMilliseconds((milliseconds == null) ? 1 : milliseconds);
108
+ return date;
109
+ }
110
+ static convertDateToNumbers(date) {
111
+ // month = 1 to 12
112
+ return {
113
+ year: date.getFullYear(),
114
+ month: date.getMonth() + 1,
115
+ day: date.getDate(),
116
+ hours: date.getHours(),
117
+ minutes: date.getMinutes(),
118
+ seconds: date.getSeconds(),
119
+ milliseconds: date.getMilliseconds(),
120
+ };
121
+ }
122
+ get() {
123
+ return LocalDate.convertDateToNumbers(this.date);
124
+ }
125
+ toMsgFormat() {
126
+ return this.toYYYYMMDD();
127
+ }
128
+ toYYYYMMDD() {
129
+ // yyyy-mm-dd
130
+ let yyyy = this.date.getFullYear();
131
+ let mm = (this.date.getMonth() + 1).toString().padStart(2, '0');
132
+ let dd = (this.date.getDate()).toString().padStart(2, '0');
133
+ let str = `${yyyy}-${mm}-${dd}`;
134
+ // console.warn(`date=${str}=${this.toDisplayFormat()}`);
135
+ return str;
136
+ }
137
+ toDisplayDateFormat() {
138
+ return this.date.toLocaleDateString("en-US", {
139
+ weekday: 'short',
140
+ year: 'numeric',
141
+ month: 'short',
142
+ day: 'numeric',
143
+ });
144
+ }
145
+ toDisplayFormat() {
146
+ return this.date.toString();
147
+ }
148
+ toDate() {
149
+ return this.date;
150
+ }
151
+ clearTime() {
152
+ this.date.setHours(0, 0, 0, 1);
153
+ }
154
+ }
155
+
156
+ class NgxMatTuiCalendarEditorDialogComponent {
157
+ constructor(data, dialogRef) {
158
+ // console.log('NgxMatTuiCalendarEditorDialogComponent.constructor: schedule:', schedule);
159
+ this.data = data;
160
+ this.dialogRef = dialogRef;
161
+ this.titleStr = '';
162
+ this.locationStr = '';
163
+ this.closed = false;
164
+ this.isAllDay = false;
165
+ this.themeClass = '';
166
+ console.log('NgxMatTuiCalendarEditorDialogComponent.constructor: data:', data);
167
+ this.color = data.darkMode ? 'accent' : 'primary';
168
+ const schedule = data.schedule;
169
+ if (schedule == null) {
170
+ this.id = null;
171
+ }
172
+ else {
173
+ if (schedule.id) {
174
+ this.id = schedule.id.toString();
175
+ }
176
+ }
177
+ this.titleStr = (schedule.title) ? schedule.title.toString() : '';
178
+ this.locationStr = (schedule.location) ? schedule.location.toString() : '';
179
+ this.isAllDay = (schedule.isAllDay == true);
180
+ this.startDate = LocalDate.convertToJsDate(schedule.start);
181
+ this.endDate = LocalDate.convertToJsDate(schedule.end);
182
+ this.startTime = new Date(this.startDate);
183
+ this.endTime = new Date(this.endDate);
184
+ this.startDate.setHours(0, 0, 0, 1);
185
+ this.endDate.setHours(0, 0, 0, 1);
186
+ this.eventForm = new FormGroup({
187
+ title: new FormControl(this.titleStr),
188
+ location: new FormControl(this.locationStr),
189
+ scheduleType: new FormControl((schedule.isAllDay == true) ? "all-day" : "time-slot"),
190
+ start: new FormControl(this.startDate),
191
+ end: new FormControl(this.endDate),
192
+ date: new FormControl(this.startDate),
193
+ time1: new FormControl(this.startTime),
194
+ time2: new FormControl(this.endTime, [Validators.required]),
195
+ }, this.getDateValidator());
196
+ }
197
+ getDateValidator() {
198
+ const validator = (group) => {
199
+ const scheduleType = group.get("scheduleType").value;
200
+ if (group.get("scheduleType").value == "time-slot") {
201
+ let time1 = group.get("time1").value;
202
+ let time2 = group.get("time2").value;
203
+ if (time1 >= time2) {
204
+ return {
205
+ dates: "End time must be later than the start time"
206
+ };
207
+ }
208
+ }
209
+ return {};
210
+ };
211
+ return validator;
212
+ }
213
+ ngOnInit() {
214
+ // console.dir(`Dialog config: ${this.dialogConfig}`);
215
+ // let start: Date = (LocalDate.convertToJsDate(this.schedule.start)).toDate();
216
+ // let end: Date = (LocalDate.convertToJsDate(this.schedule.end)).toDate();
217
+ // this.eventForm.get("date").setValue(start);
218
+ // this.eventForm.get("start").setValue(start);
219
+ // this.eventForm.get("end").setValue(end);
220
+ }
221
+ onSave(form) {
222
+ // console.log(`onSave form.invalid=${form.invalid}; this.closed=${this.closed} this.titleStr=${this.titleStr}`);
223
+ if (form.invalid || this.closed)
224
+ return;
225
+ let schedule = this.data.schedule;
226
+ schedule.title = this.eventForm.get("title").value;
227
+ schedule.location = this.eventForm.get("location").value;
228
+ schedule.isAllDay = this.isAllDay;
229
+ schedule.category = this.isAllDay ? 'allday' : 'time'; // CATEGORY MUST BE DEFINED: 'milestone', 'task', allday', 'time'
230
+ if (this.isAllDay) {
231
+ schedule.start = LocalDate.convertToJsDate(this.eventForm.get("start").value);
232
+ schedule.start.setHours(0, 0, 0, 1);
233
+ schedule.end = LocalDate.convertToJsDate(this.eventForm.get("end").value);
234
+ schedule.end.setHours(0, 0, 0, 1);
235
+ }
236
+ else {
237
+ this.startTime = LocalDate.convertToJsDate(this.eventForm.get("time1").value);
238
+ schedule.start = LocalDate.convertToJsDate(this.eventForm.get("date").value);
239
+ schedule.start.setHours(this.startTime.getHours(), this.startTime.getMinutes(), this.startTime.getSeconds(), this.startTime.getMilliseconds());
240
+ this.endTime = LocalDate.convertToJsDate(this.eventForm.get("time2").value);
241
+ schedule.end = LocalDate.convertToJsDate(this.eventForm.get("date").value);
242
+ schedule.end.setHours(this.endTime.getHours(), this.endTime.getMinutes(), this.endTime.getSeconds(), this.endTime.getMilliseconds());
243
+ }
244
+ // console.log(`pop-up-event-editor.component.ts: user clicked SAVE event=${schedule}`);
245
+ // this.eventOutput.emit(schedule);
246
+ form.resetForm();
247
+ this.closeMe(schedule);
248
+ }
249
+ onCancel() {
250
+ // this.cancelled.emit();
251
+ // console.log('openPopupScheduleEditor: user clicked CANCEL');
252
+ this.closeMe(null);
253
+ }
254
+ onDelete() {
255
+ // this.cancelled.emit();
256
+ // console.log('openPopupScheduleEditor: user clicked DELETE');
257
+ this.closeMe(this.data.schedule, true);
258
+ }
259
+ closeMe(schedule, performDelete) {
260
+ // console.log('closeMe: The dialog is closing', schedule);
261
+ this.closed = true;
262
+ this.dialogRef.close({ schedule, performDelete: (performDelete == true) });
263
+ }
264
+ log(str) {
265
+ console.warn(str);
266
+ }
267
+ onUseAllDay() {
268
+ this.isAllDay = true;
269
+ }
270
+ onUseTimeSlot() {
271
+ this.isAllDay = false;
272
+ }
273
+ }
274
+ NgxMatTuiCalendarEditorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarEditorDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
275
+ NgxMatTuiCalendarEditorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: NgxMatTuiCalendarEditorDialogComponent, selector: "ngx-mat-tui-calendar-editor-dialog", ngImport: i0, template: "<div [className]=\"data.themeClass + ' ' + 'event-editor'\">\n <form id=\"my-form\" [formGroup]=\"eventForm\" class=\"event-editor-form\" (submit)=\"onSave(postForm);\" #postForm=\"ngForm\">\n <div class=\"grid-wrapper\">\n <div class=\"grid-title\">\n <mat-form-field [color]=\"color\" class=\"editor-title\">\n <input matInput type=\"text\" name=\"title\" formControlName=\"title\" placeholder=\"Title\">\n <!-- <mat-error style=\"height: fit-content;\" *ngIf=\"title.invalid\">Please enter a title (of 1 characters or more)\n for\n your event.</mat-error> -->\n </mat-form-field>\n </div>\n <div class=\"grid-location\">\n <mat-form-field [color]=\"color\" class=\"editor-location\">\n <input matInput type=\"location\" name=\"location\" formControlName=\"location\" placeholder=\"Location\">\n </mat-form-field>\n </div>\n <div class=\"grid-radios\" style=\"display: flex;\">\n <mat-radio-group [color]=\"color\" aria-label=\"Select an option\" style=\"margin-bottom: 1em;\" name=\"scheduleType\"\n formControlName=\"scheduleType\" required>\n <mat-radio-button value=\"all-day\" (change)=\"onUseAllDay()\" id=\"button-all-day\" [color]=\"color\" class=\"radio-button\">All Day\n </mat-radio-button>\n <mat-radio-button value=\"time-slot\" (change)=\"onUseTimeSlot()\" id=\"button-time-slot\" [color]=\"color\" class=\"radio-button\">Time Slot\n </mat-radio-button>\n </mat-radio-group>\n </div>\n <div class=\"grid-date\">\n <mat-form-field *ngIf=\"isAllDay\" [color]=\"color\" class=\"date-range-form-field\" appearance=\"fill\">\n <mat-label [color]=\"color\">Pick a Date Range</mat-label>\n <mat-date-range-input [color]=\"color\" [panelClass]=\"data.themeClass\" [rangePicker]=\"rangePicker\" #dateRangeInput>\n <input matStartDate placeholder=\"Start date\" formControlName=\"start\" name=\"start\">\n <input matEndDate placeholder=\"End date\" formControlName=\"end\" name=\"end\">\n </mat-date-range-input>\n <mat-datepicker-toggle [color]=\"color\" [panelClass]=\"data.themeClass\" matSuffix [for]=\"rangePicker\"></mat-datepicker-toggle>\n <mat-date-range-picker [color]=\"color\" class=\"picker\" #rangePicker></mat-date-range-picker>\n </mat-form-field>\n <mat-form-field [color]=\"color\" *ngIf=\"!isAllDay\" class=\"date-form-field\" appearance=\"fill\">\n <mat-label>Choose a date</mat-label>\n <input matInput [matDatepicker]=\"dpicker\" formControlName=\"date\" name=\"date\">\n <mat-datepicker-toggle [color]=\"color\" matSuffix [for]=\"dpicker\"></mat-datepicker-toggle>\n <mat-datepicker [color]=\"color\" #dpicker></mat-datepicker>\n </mat-form-field>\n </div>\n <div *ngIf=\"!isAllDay\" class=\"grid-time time-slot\">\n <mat-form-field [color]=\"color\" class=\"form-field-time\" appearance=\"fill\">\n <mat-label>Start</mat-label>\n <input matTimepicker [color]=\"color\" [strict]=\"false\" id=\"timepicker-start\" mode=\"12h\" formControlName=\"time1\" name=\"time1\"\n placeholder=\"Please select time...\">\n </mat-form-field>\n <mat-form-field [color]=\"color\" class=\"form-field-time\" appearance=\"fill\">\n <mat-label>End</mat-label>\n <input matTimepicker [color]=\"color\" [strict]=\"false\" id=\"timepicker-end\" mode=\"12h\" formControlName=\"time2\" name=\"time2\"\n placeholder=\"Please select time...\">\n </mat-form-field>\n </div>\n <div *ngIf=\"!isAllDay\" class=\"grid-error\">\n <label *ngIf=\"eventForm.invalid\">{{ eventForm.errors?.dates }}</label>\n </div>\n </div>\n <mat-divider></mat-divider>\n <div class=\"editor-footer\">\n <button mat-raised-button [color]=\"color\" id=\"editor-submit-button\" type=\"submit\" style=\"margin-right: 4px;\">SAVE</button>\n <button mat-raised-button id=\"editor-delete-button\" type=\"button\" (click)=\"onDelete()\" *ngIf=\"(data.schedule.id!=null)\">DELETE</button>\n <button mat-raised-button id=\"editor-cancel-button\" type=\"button\" (click)=\"onCancel()\">CANCEL</button>\n </div>\n </form>\n </div>", styles: [".event-editor{padding:.25rem;margin-top:.25rem;max-width:425px}.grid-wrapper{display:grid;grid-template-columns:110px 290px;grid-template-rows:50px 50px 70px 70px 20px;grid-gap:2px;gap:2px}.grid-title{grid-column:1/3;grid-row:1}.grid-location{grid-column:1/3;grid-row:2}.grid-radios{grid-column:1;grid-row:3}.grid-date{grid-column:2;grid-row:3}.grid-time{grid-column:2;grid-row:4}.grid-error{grid-column:1/3;grid-row:5}.editor-title{width:100%;margin-bottom:auto}.editor-location{width:100%;margin-bottom:auto}.editor-footer{justify-self:right;align-self:center;margin-top:.5rem;height:40px}#editor-cancel-button{float:right}.date-range-form-field{width:290px}.date-form-field{width:290px}.time-slot{display:flex;flex-direction:row}.form-field-time{width:140px;padding:0;margin-right:10px}.form-field-time-wrapper{width:140px;padding:0 8px;margin-right:10px}.radio-button{width:120px;margin-top:10px;margin-bottom:10px;display:flex;flex-direction:row}.grid-error{color:red;font-size:.8rem}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { type: i4.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["separator", "comparisonStart", "comparisonEnd", "rangePicker", "required", "dateFilter", "min", "max", "disabled"], exportAs: ["matDateRangeInput"] }, { type: i4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["tabIndex", "disabled", "for", "aria-label", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i4.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { type: i4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i7.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i7.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i7.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i4.MatStartDate, selector: "input[matStartDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { type: i4.MatEndDate, selector: "input[matEndDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }, { type: i4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i10.MatTimepickerDirective, selector: "input[matTimepicker]", inputs: ["okButtonTemplate", "cancelButtonTemplate", "okLabel", "cancelLabel", "anteMeridiemAbbreviation", "postMeridiemAbbreviation", "mode", "color", "disableDialogOpenOnClick", "strict", "value", "id", "errorStateMatcher", "disabled", "readonly", "required", "placeholder", "minDate", "maxDate"], outputs: ["timeChange", "invalidInput"], exportAs: ["matTimepicker"] }] });
276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarEditorDialogComponent, decorators: [{
277
+ type: Component,
278
+ args: [{
279
+ selector: 'ngx-mat-tui-calendar-editor-dialog',
280
+ templateUrl: './ngx-mat-tui-calendar-editor-dialog.component.html',
281
+ styleUrls: ['./ngx-mat-tui-calendar-editor-dialog.component.scss']
282
+ }]
283
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
284
+ type: Inject,
285
+ args: [MAT_DIALOG_DATA]
286
+ }] }, { type: i1.MatDialogRef }]; } });
287
+
16
288
  class NgxMatTuiCalendarWrapperComponent {
17
289
  constructor() { }
18
290
  ngOnInit() {
19
291
  }
20
292
  }
21
293
  NgxMatTuiCalendarWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
22
- NgxMatTuiCalendarWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: NgxMatTuiCalendarWrapperComponent, selector: "ngx-mat-tui-calendar-wrapper", ngImport: i0, template: "<p>ngx-mat-tui-calendar-wrapper works!</p>\n<div id=\"calendar\"></div> <!-- TUI Calendar gets instatited here -->\n", styles: [".tui-full-calendar-week-container{min-height:auto}\n"] });
294
+ NgxMatTuiCalendarWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: NgxMatTuiCalendarWrapperComponent, selector: "ngx-mat-tui-calendar-wrapper", ngImport: i0, template: "<div id=\"calendar\"></div> <!-- TUI Calendar gets instatited here -->\n", styles: [".tui-full-calendar-week-container{min-height:auto}\n"], encapsulation: i0.ViewEncapsulation.None });
23
295
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarWrapperComponent, decorators: [{
24
296
  type: Component,
25
297
  args: [{
26
298
  selector: 'ngx-mat-tui-calendar-wrapper',
27
299
  templateUrl: './ngx-mat-tui-calendar-wrapper.component.html',
28
- styleUrls: ['./ngx-mat-tui-calendar-wrapper.component.scss']
300
+ styleUrls: ['./ngx-mat-tui-calendar-wrapper.component.scss'],
301
+ encapsulation: ViewEncapsulation.None, // this is needed so that our css rules override those in tui-calendar package
29
302
  }]
30
303
  }], ctorParameters: function () { return []; } });
31
304
 
32
305
  class NgxMatTuiCalendarComponent {
33
- constructor() { }
306
+ constructor(dialog) {
307
+ this.dialog = dialog;
308
+ this.iconToday = faCalendarCheck;
309
+ // iconPrev = faCaretSquareLeft;
310
+ // iconNext = faCaretSquareRight;
311
+ this.iconPrev = faCaretLeft;
312
+ this.iconNext = faCaretRight;
313
+ this.iconLongPrev = faBackward;
314
+ this.iconLongNext = faForward;
315
+ this.iconByMonth = faTable;
316
+ this.iconByWeek = faColumns;
317
+ this.iconByDay = faListAlt;
318
+ this.userCreatedSchedule = new EventEmitter();
319
+ this.userUpdatedSchedule = new EventEmitter();
320
+ this.userDeletedSchedule = new EventEmitter();
321
+ // we slice off the first color since it is gray
322
+ this.colors = distinctColors({ lightMin: 70, count: 15 }).slice(1);
323
+ this.colorIndex = 0;
324
+ this.calendarId = v4();
325
+ this.appliedOptions = this.getDefaultOptions();
326
+ }
34
327
  ngOnInit() {
328
+ console.warn(`calendar.component.ts: ngOnit`);
329
+ this.createTUICalendar();
330
+ this.bindCallbacks();
331
+ }
332
+ ngOnChanges(changes) {
333
+ console.warn(changes);
334
+ if (this.calendar) {
335
+ if (changes.options) {
336
+ console.warn(`change.option:`, changes.options);
337
+ let options = changes.options.currentValue;
338
+ this.setOptions(options);
339
+ }
340
+ }
341
+ }
342
+ ngOnDestroy() {
343
+ this.calendar.destroy();
344
+ }
345
+ onCalendarLongPrev() {
346
+ let date = this.calendar.getDate().toDate();
347
+ let days = 0;
348
+ let months = 0;
349
+ let years = 0;
350
+ switch (this.calendar.getViewName()) {
351
+ case 'day':
352
+ days = -7;
353
+ break;
354
+ case 'week':
355
+ days = -28;
356
+ break;
357
+ case 'month':
358
+ years = -1;
359
+ break;
360
+ }
361
+ date.setFullYear(date.getFullYear() + years);
362
+ date.setMonth(date.getMonth() + months); // date class does the modular arithmetic
363
+ date.setDate(date.getDate() + days); // date class does the modular arithmetic
364
+ this.calendar.setDate(date);
365
+ }
366
+ onCalendarPrev() {
367
+ this.calendar.prev();
368
+ }
369
+ onCalendarToday() {
370
+ this.calendar.today();
371
+ }
372
+ onCalendarNext() {
373
+ this.calendar.next();
374
+ }
375
+ onCalendarLongNext() {
376
+ let date = this.calendar.getDate().toDate();
377
+ let days = 0;
378
+ let months = 0;
379
+ let years = 0;
380
+ switch (this.calendar.getViewName()) {
381
+ case 'day':
382
+ days = 7;
383
+ break;
384
+ case 'week':
385
+ days = 28;
386
+ break;
387
+ case 'month':
388
+ years = 1;
389
+ break;
390
+ }
391
+ date.setFullYear(date.getFullYear() + years);
392
+ date.setMonth(date.getMonth() + months); // date class does the modular arithmetic
393
+ date.setDate(date.getDate() + days); // date class does the modular arithmetic
394
+ this.calendar.setDate(date);
395
+ }
396
+ onMonthView() {
397
+ this.calendar.changeView('month');
398
+ }
399
+ onWeekView() {
400
+ this.calendar.changeView('week');
401
+ }
402
+ onDayView() {
403
+ this.calendar.changeView('day');
404
+ }
405
+ getDate() {
406
+ let date = this.calendar.getDate();
407
+ let str = date.toDate().toLocaleDateString("en-US", {
408
+ year: 'numeric',
409
+ month: 'short',
410
+ });
411
+ return str;
412
+ }
413
+ createTUICalendar() {
414
+ let ioptions = this.preprocessIOptions(null);
415
+ console.warn(`calendar.component.ts: createTUICalendar: ioptions:`, ioptions);
416
+ this.calendar = new Calendar('#calendar', ioptions);
417
+ console.warn(`calendar.component.ts: createTUICalendar: this.calendar:`, this.calendar);
418
+ }
419
+ bindCallbacks() {
420
+ this.bindAfterRenderSchedule();
421
+ this.bindClickTimezonesCollapseBtn();
422
+ this.bindClickDayname();
423
+ this.bindClickMore();
424
+ this.bindClickSchedule();
425
+ this.bindBeforeCreateSchedule();
426
+ this.bindBeforeUpdateSchedule();
427
+ this.bindBeforeDeleteSchedule();
428
+ }
429
+ bindAfterRenderSchedule() {
430
+ let that = this;
431
+ this.calendar.on('afterRenderSchedule', function (event) {
432
+ // console.warn(`afterRenderSchedule`, event);
433
+ });
434
+ }
435
+ bindClickTimezonesCollapseBtn() {
436
+ let that = this;
437
+ this.calendar.on('clickTimezonesCollapseBtn', function (timezonesCollapsed) {
438
+ // console.warn(`clickTimezonesCollapseBtn`, timezonesCollapsed);
439
+ });
440
+ }
441
+ bindClickDayname() {
442
+ let that = this;
443
+ this.calendar.on('clickDayname', function (event) {
444
+ // console.warn(`clickDayname`, event);
445
+ });
446
+ }
447
+ bindClickMore() {
448
+ let that = this;
449
+ this.calendar.on('clickMore', function (event) {
450
+ // console.warn(`clickMore`, event);
451
+ });
452
+ }
453
+ bindClickSchedule() {
454
+ // only works if useDetailPopup: false,
455
+ let that = this;
456
+ this.calendar.on('clickSchedule', function (event) {
457
+ // console.warn(`clickSchedule`, event);
458
+ let schedule = Object.assign({}, event.schedule);
459
+ schedule.start = (new LocalDate(schedule.start)).toDate();
460
+ schedule.end = (new LocalDate(schedule.end)).toDate();
461
+ that.openPopupScheduleEditor(schedule);
462
+ });
463
+ }
464
+ bindBeforeCreateSchedule() {
465
+ let that = this;
466
+ this.calendar.on('beforeCreateSchedule', function (event) {
467
+ // console.log(`beforeCreateSchedule`, event);
468
+ let start = (new LocalDate(event.start)).toDate();
469
+ start.setHours(9);
470
+ let end = (new LocalDate(event.end)).toDate();
471
+ end.setHours(10);
472
+ that.openPopupScheduleEditor({
473
+ title: '',
474
+ start: start,
475
+ end: end,
476
+ id: null,
477
+ });
478
+ });
479
+ }
480
+ bindBeforeUpdateSchedule() {
481
+ let that = this;
482
+ this.calendar.on('beforeUpdateSchedule', function (event) {
483
+ // console.log(`beforeUpdateSchedule`, event);
484
+ that.updateScheduleAndNotifyParent(event);
485
+ });
486
+ }
487
+ bindBeforeDeleteSchedule() {
488
+ let that = this;
489
+ this.calendar.on('beforeDeleteSchedule', function (event) {
490
+ // console.log(`beforeDeleteSchedule`, event.schedule);
491
+ // console.log(`beforeDeleteSchedule`, event.schedule);
492
+ that.deleteScheduleAndNotifyParent({ id: event.schedule.id, calendarId: event.schedule.calendarId });
493
+ });
494
+ }
495
+ nextColor() {
496
+ let color = this.colors[this.colorIndex++].hex();
497
+ if (this.colorIndex >= this.colors.length)
498
+ this.colorIndex = 0;
499
+ return color;
500
+ }
501
+ createScheduleAndNotifyParent(args) {
502
+ let schedule = this.createSchedule(args);
503
+ this.userCreatedSchedule.emit(schedule);
504
+ return schedule;
505
+ }
506
+ createSchedules(schedules) {
507
+ let newSchedules = [];
508
+ for (let schedule of schedules) {
509
+ newSchedules.push(this.createSchedule(schedule));
510
+ }
511
+ return newSchedules;
512
+ }
513
+ createSchedule(args) {
514
+ // if (form.invalid) return;
515
+ // create a color
516
+ let color = this.nextColor();
517
+ // console.log(color);
518
+ // create an id
519
+ let id = (args.id == null) ? '' : args.id.toString();
520
+ if (id.length === 0) {
521
+ id = v4();
522
+ }
523
+ let start = LocalDate.convertToJsDate(args.start);
524
+ let end = LocalDate.convertToJsDate(args.end);
525
+ let schedule = {
526
+ id,
527
+ calendarId: (args.calendarId == null) ? this.calendarId : args.calendarId,
528
+ title: args.title,
529
+ start: start,
530
+ end: end,
531
+ category: args.category,
532
+ isAllDay: args.isAllDay,
533
+ dueDateClass: '',
534
+ bgColor: color,
535
+ };
536
+ // console.log(`event-calendar.component.ts: createEvent:`, schedule);
537
+ this.calendar.createSchedules([schedule]);
538
+ return this.calendar.getSchedule(schedule.id, schedule.calendarId);
539
+ }
540
+ updateScheduleAndNotifyParent(args) {
541
+ let schedule = this.updateSchedule(args);
542
+ this.userUpdatedSchedule.emit(schedule);
543
+ return schedule;
544
+ }
545
+ updateSchedule(schedule) {
546
+ // console.log(`event-calendar.component.ts: updateSchedule:`, schedule);
547
+ let calendarId = (schedule.calendarId == null) ? this.calendarId : schedule.calendarId;
548
+ this.calendar.updateSchedule(schedule.id, calendarId, schedule, false);
549
+ return this.calendar.getSchedule(schedule.id, calendarId);
550
+ }
551
+ getSchedule(args) {
552
+ // console.log(`event-calendar.component.ts: getSchedule:`, schedule);
553
+ let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
554
+ return this.calendar.getSchedule(args.id, calendarId);
555
+ }
556
+ deleteScheduleAndNotifyParent(args) {
557
+ this.deleteSchedule(args);
558
+ let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
559
+ this.userDeletedSchedule.emit({ id: args.id, calendarId });
560
+ }
561
+ deleteSchedule(args) {
562
+ // console.log(`event-calendar.component.ts: deleteSchedule:`, schedule);
563
+ let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
564
+ this.calendar.deleteSchedule(args.id, calendarId, false);
565
+ }
566
+ deleteAllSchedules() {
567
+ this.calendar.clear();
568
+ }
569
+ openPopupScheduleEditor(schedule) {
570
+ // console.log('openPopupScheduleEditor: calevent:', schedule);
571
+ const dialogConfig = new MatDialogConfig();
572
+ if (this.appliedOptions.themeClass) {
573
+ dialogConfig.panelClass = this.appliedOptions.themeClass;
574
+ }
575
+ console.warn(`options: `, this.appliedOptions);
576
+ dialogConfig.data = { schedule, darkMode: this.appliedOptions.darkMode, themeClass: this.appliedOptions.themeClass };
577
+ dialogConfig.autoFocus = true;
578
+ const dialogRef = this.dialog.open(NgxMatTuiCalendarEditorDialogComponent, dialogConfig);
579
+ // const dialogRef = this.dialog.open(NgxMatTuiCalendarScheduleEditorDialogComponent, {
580
+ // data: schedule,
581
+ // });
582
+ dialogRef.afterClosed().subscribe((result) => {
583
+ // console.log('openPopupScheduleEditor: The dialog was closed', result);
584
+ this.calendar.render(true); // <-- so that selection is cleared
585
+ if (result && result.schedule) {
586
+ let schedule = result.schedule;
587
+ if (result.performDelete == true) {
588
+ // delete
589
+ // console.log(`openPopupScheduleEditor:afterCLosed: deleteSchedule`);
590
+ this.deleteScheduleAndNotifyParent({ id: schedule.id, calendarId: schedule.calendarId });
591
+ }
592
+ else if (schedule.id == null) {
593
+ // console.log(`openPopupScheduleEditor:afterCLosed: addSchedule`);
594
+ this.createScheduleAndNotifyParent(schedule);
595
+ }
596
+ else {
597
+ // console.log(`openPopupScheduleEditor:afterCLosed: updateSchedule`);
598
+ this.updateScheduleAndNotifyParent(schedule);
599
+ }
600
+ }
601
+ });
602
+ }
603
+ setOptions(options) {
604
+ if (options == null) {
605
+ options = this.getDefaultOptions();
606
+ }
607
+ options.ioptions = this.setIOptions(options.ioptions);
608
+ this.appliedOptions = Object.assign({}, options);
609
+ }
610
+ setIOptions(ioptionsIn) {
611
+ let ioptions = this.preprocessIOptions(ioptionsIn);
612
+ this.calendar.setOptions(ioptions);
613
+ this.calendar.setTheme(ioptions.theme);
614
+ this.calendar.render(true);
615
+ return ioptions;
616
+ }
617
+ preprocessIOptions(ioptions) {
618
+ let defs = this.getDefaultIOptions();
619
+ if (ioptions == null) {
620
+ ioptions = defs;
621
+ }
622
+ else {
623
+ ioptions = Object.assign(Object.assign({}, defs), ioptions);
624
+ }
625
+ ioptions.useCreationPopup = false;
626
+ ioptions.useDetailPopup = false;
627
+ if (!ioptions.theme) {
628
+ ioptions.theme = this.getDefaultTheme();
629
+ }
630
+ return ioptions;
631
+ }
632
+ getDefaultOptions() {
633
+ return {
634
+ darkMode: false,
635
+ themeClass: null,
636
+ ioptions: this.getDefaultIOptions(),
637
+ };
638
+ }
639
+ getDefaultIOptions() {
640
+ return {
641
+ defaultView: 'month',
642
+ taskView: true,
643
+ useCreationPopup: false,
644
+ useDetailPopup: false,
645
+ theme: this.getDefaultTheme(),
646
+ template: {
647
+ monthDayname: function (dayname) {
648
+ return '<span class="calendar-week-dayname-name">' + dayname.label + '</span>';
649
+ }
650
+ },
651
+ week: {
652
+ // startDayOfWeek: undefined,
653
+ // daynames: undefined,
654
+ narrowWeekend: false,
655
+ // workweek: true,
656
+ showTimezoneCollapseButton: true,
657
+ timezonesCollapsed: true,
658
+ hourStart: 7,
659
+ hourEnd: 20,
660
+ },
661
+ };
662
+ }
663
+ getColor(name) {
664
+ const el = document.getElementById(`theme-${name}`);
665
+ if (el) {
666
+ const style = window.getComputedStyle(el, null);
667
+ console.warn(`theme-${name} color:`, style.color);
668
+ return style.color;
669
+ }
670
+ return '';
671
+ }
672
+ getDefaultTheme() {
673
+ function adjustHexOpacity(color, opacity) {
674
+ const r = parseInt(color.slice(1, 3), 16);
675
+ const g = parseInt(color.slice(3, 5), 16);
676
+ const b = parseInt(color.slice(5, 7), 16);
677
+ return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity + ')';
678
+ }
679
+ // default keys and styles
680
+ // TODO: apply Material Design Theme
681
+ let background = this.getColor("background");
682
+ let border = this.getColor("divider");
683
+ let borderLight = this.getColor("divider-light");
684
+ let shadow = this.getColor("divider");
685
+ let highlight = this.getColor("highlight");
686
+ let primary = this.getColor("primary");
687
+ let warn = this.getColor("warn");
688
+ let text = this.getColor("foreground");
689
+ let primaryShaded = this.getColor("primary-shaded");
690
+ // tui-full-calendar-weekday-schedule-title
691
+ //calendar-week-dayname-name
692
+ return {
693
+ 'common.border': `1px solid ${border}`,
694
+ 'common.backgroundColor': background,
695
+ 'common.holiday.color': warn,
696
+ 'common.saturday.color': text,
697
+ 'common.dayname.color': text,
698
+ 'common.today.color': '#0f0',
699
+ // creation guide style
700
+ 'common.creationGuide.backgroundColor': primaryShaded,
701
+ 'common.creationGuide.border': `1px solid ${highlight}`,
702
+ // month header 'dayname'
703
+ 'month.dayname.height': '31px',
704
+ 'month.dayname.borderLeft': `1px solid ${border}`,
705
+ 'month.dayname.paddingLeft': '10px',
706
+ 'month.dayname.paddingRight': '10px',
707
+ 'month.dayname.backgroundColor': 'inherit',
708
+ 'month.dayname.fontSize': '12px',
709
+ 'month.dayname.fontWeight': 'normal',
710
+ 'month.dayname.textAlign': 'left',
711
+ // month day grid cell 'day'
712
+ 'month.holidayExceptThisMonth.color': 'rgba(255, 64, 64, 0.4)',
713
+ 'month.dayExceptThisMonth.color': 'rgba(51, 51, 51, 0.4)',
714
+ 'month.weekend.backgroundColor': 'inherit',
715
+ 'month.day.fontSize': '14px',
716
+ 'month.schedule.color': highlight,
717
+ // month schedule style
718
+ 'month.schedule.borderRadius': '2px',
719
+ 'month.schedule.height': '24px',
720
+ 'month.schedule.marginTop': '2px',
721
+ 'month.schedule.marginLeft': '8px',
722
+ 'month.schedule.marginRight': '8px',
723
+ // month more view
724
+ 'month.moreView.border': `1px solid ${border}`,
725
+ 'month.moreView.boxShadow': `0 2px 6px 0 ${shadow}`,
726
+ 'month.moreView.backgroundColor': background,
727
+ 'month.moreView.paddingBottom': '17px',
728
+ 'month.moreViewTitle.height': '44px',
729
+ 'month.moreViewTitle.marginBottom': '12px',
730
+ 'month.moreViewTitle.backgroundColor': 'inherit',
731
+ 'month.moreViewTitle.borderBottom': 'none',
732
+ 'month.moreViewTitle.padding': '12px 17px 0 17px',
733
+ 'month.moreViewList.padding': '0 17px',
734
+ // week header 'dayname'
735
+ 'week.dayname.height': '42px',
736
+ 'week.dayname.borderTop': `1px solid ${border}`,
737
+ 'week.dayname.borderBottom': `1px solid ${border}`,
738
+ 'week.dayname.borderLeft': 'inherit',
739
+ 'week.dayname.paddingLeft': '0',
740
+ 'week.dayname.backgroundColor': 'inherit',
741
+ 'week.dayname.textAlign': 'left',
742
+ 'week.today.color': text,
743
+ 'week.pastDay.color': borderLight,
744
+ // week vertical panel 'vpanel'
745
+ 'week.vpanelSplitter.border': `1px solid ${border}`,
746
+ 'week.vpanelSplitter.height': '3px',
747
+ // week daygrid 'daygrid'
748
+ 'week.daygrid.borderRight': `1px solid ${border}`,
749
+ 'week.daygrid.backgroundColor': background,
750
+ 'week.daygridLeft.width': '72px',
751
+ 'week.daygridLeft.backgroundColor': background,
752
+ 'week.daygridLeft.paddingRight': '8px',
753
+ 'week.daygridLeft.borderRight': `1px solid ${border}`,
754
+ 'week.today.backgroundColor': primaryShaded,
755
+ 'week.weekend.backgroundColor': 'inherit',
756
+ // week timegrid 'timegrid'
757
+ 'week.timegridLeft.width': '72px',
758
+ 'week.timegridLeft.backgroundColor': 'inherit',
759
+ 'week.timegridLeft.borderRight': `1px solid ${border}`,
760
+ 'week.timegridLeft.fontSize': '11px',
761
+ 'week.timegridLeftTimezoneLabel.height': '40px',
762
+ 'week.timegridLeftAdditionalTimezone.backgroundColor': background,
763
+ 'week.timegridOneHour.height': '52px',
764
+ 'week.timegridHalfHour.height': '26px',
765
+ 'week.timegridHalfHour.borderBottom': 'none',
766
+ 'week.timegridHorizontalLine.borderBottom': `1px solid ${border}`,
767
+ 'week.timegrid.paddingRight': '8px',
768
+ 'week.timegrid.borderRight': `1px solid ${border}`,
769
+ 'week.timegridSchedule.borderRadius': '2px',
770
+ 'week.timegridSchedule.paddingLeft': '2px',
771
+ // #515ce6 is a slate blue
772
+ 'week.currentTime.color': highlight,
773
+ 'week.currentTime.fontSize': '11px',
774
+ 'week.currentTime.fontWeight': 'normal',
775
+ 'week.pastTime.color': borderLight,
776
+ 'week.pastTime.fontWeight': 'normal',
777
+ 'week.futureTime.color': border,
778
+ 'week.futureTime.fontWeight': 'normal',
779
+ 'week.currentTimeLinePast.border': `1px dashed ${highlight}`,
780
+ 'week.currentTimeLineBullet.backgroundColor': highlight,
781
+ 'week.currentTimeLineToday.border': `1px solid ${highlight}`,
782
+ 'week.currentTimeLineFuture.border': 'none',
783
+ // week creation guide style
784
+ 'week.creationGuide.color': highlight,
785
+ 'week.creationGuide.fontSize': '11px',
786
+ 'week.creationGuide.fontWeight': 'bold',
787
+ // week daygrid schedule style
788
+ 'week.dayGridSchedule.borderRadius': '2px',
789
+ 'week.dayGridSchedule.height': '24px',
790
+ 'week.dayGridSchedule.marginTop': '2px',
791
+ 'week.dayGridSchedule.marginLeft': '8px',
792
+ 'week.dayGridSchedule.marginRight': '8px'
793
+ };
35
794
  }
36
795
  }
37
- NgxMatTuiCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
38
- NgxMatTuiCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: NgxMatTuiCalendarComponent, selector: "ngx-mat-tui-calendar", ngImport: i0, template: "<p>\r\n ngx-mat-tui-calendar v0.0.14 works! added tui-calendar\r\n</p>\r\n<ngx-mat-tui-calendar-wrapper></ngx-mat-tui-calendar-wrapper>", styles: [""], components: [{ type: NgxMatTuiCalendarWrapperComponent, selector: "ngx-mat-tui-calendar-wrapper" }] });
796
+ NgxMatTuiCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
797
+ NgxMatTuiCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: NgxMatTuiCalendarComponent, selector: "ngx-mat-tui-calendar", inputs: { options: "options" }, outputs: { userCreatedSchedule: "userCreatedSchedule", userUpdatedSchedule: "userUpdatedSchedule", userDeletedSchedule: "userDeletedSchedule" }, usesOnChanges: true, ngImport: i0, template: "<section class=\"content-container\">\r\n <!-- These divs are here so that we can read the theme colors for the tui theme -->\r\n <div style=\"color: blue;\"> <div id=\"theme-primary\"></div></div>\r\n <div style=\"color: blue;\"> <div id=\"theme-primary-shaded\"></div></div>\r\n <div style=\"color: blue;\"> <div id=\"theme-highlight\"></div></div>\r\n <div style=\"color: blue;\"> <div id=\"theme-accent\"></div></div>\r\n <div style=\"color: red;\"> <div id=\"theme-warn\"></div></div>\r\n <div style=\"color: #3e3e3e;\"> <div id=\"theme-foreground\"></div></div>\r\n <div style=\"color: #e0e0e0;\"> <div id=\"theme-divider\"></div></div>\r\n <div style=\"color: white;\"> <div id=\"theme-background\"></div></div>\r\n \r\n <div class=\"calendar-container\">\r\n <!-- calendar titlebar -->\r\n <mat-toolbar class=\"menu-bar\" color=\"primary\">\r\n <!-- <div style=\"align-self: center;display: flex;\r\n align-items: center;\r\n justify-content: flex-start;\"> -->\r\n <div style=\"display: flex;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n width: 100%; \">\r\n <div class=\"left-div\">\r\n <!-- LEFT -->\r\n <button mat-button \r\n class=\"navigation-button\"\r\n style=\"margin-left: 0px; margin-right: 0px; font-size: 1.5rem !important;\" \r\n (click)=\"onCalendarLongPrev()\">\r\n <fa-icon [icon]=\"iconLongPrev\"></fa-icon>\r\n </button>\r\n <button mat-button \r\n class=\"navigation-button\" \r\n style=\"margin-left: 0px; margin-right: 0px; font-size: 2rem !important;\" \r\n (click)=\"onCalendarPrev()\">\r\n <fa-icon [icon]=\"iconPrev\"></fa-icon>\r\n </button>\r\n <button mat-button \r\n class=\"navigation-button\"\r\n style=\"margin-left: 0px; margin-right: 0px; font-size: 1.7rem !important;\" \r\n (click)=\"onCalendarToday()\">\r\n <fa-icon [icon]=\"iconToday\"></fa-icon>\r\n </button>\r\n <button mat-button \r\n class=\"navigation-button\" \r\n style=\"margin-left: 0px; margin-right: 0px; font-size: 2rem !important;\" \r\n (click)=\"onCalendarNext()\">\r\n <fa-icon [icon]=\"iconNext\"></fa-icon>\r\n </button>\r\n <button mat-button \r\n class=\"navigation-button\"\r\n style=\"margin-left: 0px; margin-right: 0px; font-size: 1.5rem !important;\" \r\n (click)=\"onCalendarLongNext()\">\r\n <fa-icon [icon]=\"iconLongNext\"></fa-icon>\r\n </button>\r\n </div>\r\n <div class=\"center-div\">\r\n <!-- CENTER -->\r\n <span class=\"event-calendar-title\">{{ getDate() }}</span>\r\n </div>\r\n <div class=\"right-div\">\r\n \r\n <!-- RIGHT -->\r\n <mat-button-toggle-group class=\"view-button\" value=\"month\" id=\"@+id/toggleButton\" layout_width=\"wrap_content\"\r\n layout_height=\"wrap_content\">\r\n <mat-button-toggle mat-button value=\"month\" class=\"view-button\" (click)=\"onMonthView()\">\r\n <fa-icon [icon]=\"iconByMonth\"></fa-icon>\r\n </mat-button-toggle>\r\n <mat-button-toggle mat-button value=\"week\" class=\"view-button\" (click)=\"onWeekView()\">\r\n <fa-icon [icon]=\"iconByWeek\"></fa-icon>\r\n </mat-button-toggle>\r\n <mat-button-toggle mat-button value=\"day\" class=\"view-button\" (click)=\"onDayView()\">\r\n <fa-icon [icon]=\"iconByDay\"></fa-icon>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n </div>\r\n </div>\r\n </mat-toolbar>\r\n <ngx-mat-tui-calendar-wrapper></ngx-mat-tui-calendar-wrapper>\r\n </div>\r\n \r\n </section>", styles: [".calendar-container{transform-origin:top left}.menu-bar{display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:2rem!important}.mat-button{font-size:1.1rem!important}.mat-button.navigation-button{padding:0;min-width:32px}.left-div{width:33%;float:left;display:flex;white-space:nowrap;vertical-align:middle}.center-div{width:33%;float:right;text-align:center;white-space:nowrap;vertical-align:middle}.event-calendar-title{font-size:2rem;vertical-align:middle}.right-div{width:33%;display:flex;white-space:nowrap;vertical-align:middle;flex-flow:row-reverse}@media screen and (max-width: 599px){.left-div{transform:scale(.75);transform-origin:center left}.center-div{transform:scale(.5)}.right-div{transform:scale(1);transform-origin:center right}.right-div .mat-button-toggle-group.view-button{font-size:1.1rem!important}.right-div ::ng-deep .mat-button-toggle-label-content{padding:0 8px!important}}.mat-button-toggle-group.view-button{height:36px;font-size:1.25rem!important}.view-button{align-items:center}::ng-deep .mat-button-toggle-label-content{padding:0 10px!important}\n"], components: [{ type: i2$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: i5$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: NgxMatTuiCalendarWrapperComponent, selector: "ngx-mat-tui-calendar-wrapper" }], directives: [{ type: i5$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }] });
39
798
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarComponent, decorators: [{
40
799
  type: Component,
41
800
  args: [{
42
801
  selector: 'ngx-mat-tui-calendar',
43
802
  templateUrl: './ngx-mat-tui-calendar.component.html',
44
- styleUrls: ['./ngx-mat-tui-calendar.component.scss']
803
+ styleUrls: [
804
+ './ngx-mat-tui-calendar.component.scss'
805
+ ],
45
806
  }]
46
- }], ctorParameters: function () { return []; } });
807
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { userCreatedSchedule: [{
808
+ type: Output
809
+ }], userUpdatedSchedule: [{
810
+ type: Output
811
+ }], userDeletedSchedule: [{
812
+ type: Output
813
+ }], options: [{
814
+ type: Input
815
+ }] } });
47
816
 
817
+ // Angular modules
48
818
  class NgxMatTuiCalendarModule {
49
819
  }
50
820
  NgxMatTuiCalendarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
51
821
  NgxMatTuiCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, declarations: [NgxMatTuiCalendarComponent,
52
- NgxMatTuiCalendarWrapperComponent], exports: [NgxMatTuiCalendarComponent] });
53
- NgxMatTuiCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, imports: [[]] });
822
+ NgxMatTuiCalendarWrapperComponent,
823
+ NgxMatTuiCalendarEditorDialogComponent], imports: [BrowserAnimationsModule,
824
+ BrowserModule,
825
+ FlexLayoutModule,
826
+ FlexModule,
827
+ FormsModule,
828
+ HttpClientModule,
829
+ OverlayModule,
830
+ ReactiveFormsModule,
831
+ MatButtonModule,
832
+ MatButtonToggleModule,
833
+ MatCardModule,
834
+ MatDatepickerModule,
835
+ MatDialogModule,
836
+ MatDividerModule,
837
+ MatFormFieldModule,
838
+ MatIconModule,
839
+ MatInputModule,
840
+ MatNativeDateModule,
841
+ MatRadioModule,
842
+ MatRippleModule,
843
+ MatSlideToggleModule,
844
+ MatToolbarModule,
845
+ FontAwesomeModule,
846
+ MatTimepickerModule], exports: [NgxMatTuiCalendarComponent] });
847
+ NgxMatTuiCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, imports: [[
848
+ BrowserAnimationsModule,
849
+ BrowserModule,
850
+ FlexLayoutModule,
851
+ FlexModule,
852
+ FormsModule,
853
+ HttpClientModule,
854
+ OverlayModule,
855
+ ReactiveFormsModule,
856
+ MatButtonModule,
857
+ MatButtonToggleModule,
858
+ MatCardModule,
859
+ MatDatepickerModule,
860
+ MatDialogModule,
861
+ MatDividerModule,
862
+ MatFormFieldModule,
863
+ MatIconModule,
864
+ MatInputModule,
865
+ MatNativeDateModule,
866
+ MatRadioModule,
867
+ MatRippleModule,
868
+ MatSlideToggleModule,
869
+ MatToolbarModule,
870
+ FontAwesomeModule,
871
+ MatTimepickerModule,
872
+ ]] });
54
873
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, decorators: [{
55
874
  type: NgModule,
56
875
  args: [{
57
876
  declarations: [
58
877
  NgxMatTuiCalendarComponent,
59
878
  NgxMatTuiCalendarWrapperComponent,
879
+ NgxMatTuiCalendarEditorDialogComponent,
880
+ ],
881
+ imports: [
882
+ BrowserAnimationsModule,
883
+ BrowserModule,
884
+ FlexLayoutModule,
885
+ FlexModule,
886
+ FormsModule,
887
+ HttpClientModule,
888
+ OverlayModule,
889
+ ReactiveFormsModule,
890
+ MatButtonModule,
891
+ MatButtonToggleModule,
892
+ MatCardModule,
893
+ MatDatepickerModule,
894
+ MatDialogModule,
895
+ MatDividerModule,
896
+ MatFormFieldModule,
897
+ MatIconModule,
898
+ MatInputModule,
899
+ MatNativeDateModule,
900
+ MatRadioModule,
901
+ MatRippleModule,
902
+ MatSlideToggleModule,
903
+ MatToolbarModule,
904
+ FontAwesomeModule,
905
+ MatTimepickerModule,
60
906
  ],
61
- imports: [],
62
907
  exports: [
63
908
  NgxMatTuiCalendarComponent,
64
909
  ],
@@ -76,5 +921,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImpo
76
921
  * Generated bundle index. Do not edit.
77
922
  */
78
923
 
79
- export { NgxMatTuiCalendarComponent, NgxMatTuiCalendarModule, NgxMatTuiCalendarService };
924
+ export { LocalDate, NgxMatTuiCalendarComponent, NgxMatTuiCalendarModule, NgxMatTuiCalendarService };
80
925
  //# sourceMappingURL=ngx-mat-tui-calendar.js.map