ngx-mat-tui-calendar 0.0.11 → 0.0.15
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.
- package/bundles/ngx-mat-tui-calendar.umd.js +1170 -13
- package/bundles/ngx-mat-tui-calendar.umd.js.map +1 -1
- package/esm2015/lib/calendar-editor-options.js +2 -0
- package/esm2015/lib/calendar-options.js +2 -0
- package/esm2015/lib/local-date.js +102 -0
- package/esm2015/lib/ngx-mat-tui-calendar-editor-dialog/ngx-mat-tui-calendar-editor-dialog.component.js +147 -0
- package/esm2015/lib/ngx-mat-tui-calendar-wrapper/ngx-mat-tui-calendar-wrapper.component.js +19 -0
- package/esm2015/lib/ngx-mat-tui-calendar.component.js +496 -16
- package/esm2015/lib/ngx-mat-tui-calendar.module.js +109 -4
- package/esm2015/public-api.js +4 -1
- package/fesm2015/ngx-mat-tui-calendar.js +852 -19
- package/fesm2015/ngx-mat-tui-calendar.js.map +1 -1
- package/lib/calendar-editor-options.d.ts +6 -0
- package/lib/calendar-options.d.ts +6 -0
- package/lib/local-date.d.ts +43 -0
- package/lib/ngx-mat-tui-calendar-editor-dialog/ngx-mat-tui-calendar-editor-dialog.component.d.ts +35 -0
- package/lib/ngx-mat-tui-calendar-wrapper/ngx-mat-tui-calendar-wrapper.component.d.ts +8 -0
- package/lib/ngx-mat-tui-calendar.component.d.ts +71 -4
- package/lib/ngx-mat-tui-calendar.module.d.ts +24 -1
- package/package.json +34 -9
- package/public-api.d.ts +3 -0
@@ -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,42 +51,837 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImpo
|
|
13
51
|
}]
|
14
52
|
}], ctorParameters: function () { return []; } });
|
15
53
|
|
16
|
-
|
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
|
+
|
288
|
+
class NgxMatTuiCalendarWrapperComponent {
|
17
289
|
constructor() { }
|
18
290
|
ngOnInit() {
|
19
291
|
}
|
20
292
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
293
|
+
NgxMatTuiCalendarWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
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 });
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarWrapperComponent, decorators: [{
|
296
|
+
type: Component,
|
297
|
+
args: [{
|
298
|
+
selector: 'ngx-mat-tui-calendar-wrapper',
|
299
|
+
templateUrl: './ngx-mat-tui-calendar-wrapper.component.html',
|
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
|
302
|
+
}]
|
303
|
+
}], ctorParameters: function () { return []; } });
|
304
|
+
|
305
|
+
class NgxMatTuiCalendarComponent {
|
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
|
+
}
|
326
|
+
ngOnInit() {
|
327
|
+
this.createTUICalendar(null);
|
328
|
+
this.bindCallbacks();
|
329
|
+
}
|
330
|
+
ngOnChanges(changes) {
|
331
|
+
console.warn(changes);
|
332
|
+
if (this.calendar) {
|
333
|
+
if (changes.options) {
|
334
|
+
console.warn(`change.option:`, changes.options);
|
335
|
+
let options = changes.options.currentValue;
|
336
|
+
if (!options.theme) {
|
337
|
+
options.theme = this.getDefaultTheme();
|
338
|
+
}
|
339
|
+
console.warn(`TUI theme:`, options.theme);
|
340
|
+
this.calendar.setOptions(options.ioptions);
|
341
|
+
this.calendar.setTheme(options.theme);
|
342
|
+
this.calendar.render(true);
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
ngOnDestroy() {
|
347
|
+
this.calendar.destroy();
|
348
|
+
}
|
349
|
+
onCalendarLongPrev() {
|
350
|
+
let date = this.calendar.getDate().toDate();
|
351
|
+
let days = 0;
|
352
|
+
let months = 0;
|
353
|
+
let years = 0;
|
354
|
+
switch (this.calendar.getViewName()) {
|
355
|
+
case 'day':
|
356
|
+
days = -7;
|
357
|
+
break;
|
358
|
+
case 'week':
|
359
|
+
days = -28;
|
360
|
+
break;
|
361
|
+
case 'month':
|
362
|
+
years = -1;
|
363
|
+
break;
|
364
|
+
}
|
365
|
+
date.setFullYear(date.getFullYear() + years);
|
366
|
+
date.setMonth(date.getMonth() + months); // date class does the modular arithmetic
|
367
|
+
date.setDate(date.getDate() + days); // date class does the modular arithmetic
|
368
|
+
this.calendar.setDate(date);
|
369
|
+
}
|
370
|
+
onCalendarPrev() {
|
371
|
+
this.calendar.prev();
|
372
|
+
}
|
373
|
+
onCalendarToday() {
|
374
|
+
this.calendar.today();
|
375
|
+
}
|
376
|
+
onCalendarNext() {
|
377
|
+
this.calendar.next();
|
378
|
+
}
|
379
|
+
onCalendarLongNext() {
|
380
|
+
let date = this.calendar.getDate().toDate();
|
381
|
+
let days = 0;
|
382
|
+
let months = 0;
|
383
|
+
let years = 0;
|
384
|
+
switch (this.calendar.getViewName()) {
|
385
|
+
case 'day':
|
386
|
+
days = 7;
|
387
|
+
break;
|
388
|
+
case 'week':
|
389
|
+
days = 28;
|
390
|
+
break;
|
391
|
+
case 'month':
|
392
|
+
years = 1;
|
393
|
+
break;
|
394
|
+
}
|
395
|
+
date.setFullYear(date.getFullYear() + years);
|
396
|
+
date.setMonth(date.getMonth() + months); // date class does the modular arithmetic
|
397
|
+
date.setDate(date.getDate() + days); // date class does the modular arithmetic
|
398
|
+
this.calendar.setDate(date);
|
399
|
+
}
|
400
|
+
onMonthView() {
|
401
|
+
this.calendar.changeView('month');
|
402
|
+
}
|
403
|
+
onWeekView() {
|
404
|
+
this.calendar.changeView('week');
|
405
|
+
}
|
406
|
+
onDayView() {
|
407
|
+
this.calendar.changeView('day');
|
408
|
+
}
|
409
|
+
getDate() {
|
410
|
+
let date = this.calendar.getDate();
|
411
|
+
let str = date.toDate().toLocaleDateString("en-US", {
|
412
|
+
year: 'numeric',
|
413
|
+
month: 'short',
|
414
|
+
});
|
415
|
+
return str;
|
416
|
+
}
|
417
|
+
createTUICalendar(options) {
|
418
|
+
this.calendar = new Calendar('#calendar', this.prerocessOptions(options));
|
419
|
+
}
|
420
|
+
bindCallbacks() {
|
421
|
+
this.bindAfterRenderSchedule();
|
422
|
+
this.bindClickTimezonesCollapseBtn();
|
423
|
+
this.bindClickDayname();
|
424
|
+
this.bindClickMore();
|
425
|
+
this.bindClickSchedule();
|
426
|
+
this.bindBeforeCreateSchedule();
|
427
|
+
this.bindBeforeUpdateSchedule();
|
428
|
+
this.bindBeforeDeleteSchedule();
|
429
|
+
}
|
430
|
+
bindAfterRenderSchedule() {
|
431
|
+
let that = this;
|
432
|
+
this.calendar.on('afterRenderSchedule', function (event) {
|
433
|
+
// console.warn(`afterRenderSchedule`, event);
|
434
|
+
});
|
435
|
+
}
|
436
|
+
bindClickTimezonesCollapseBtn() {
|
437
|
+
let that = this;
|
438
|
+
this.calendar.on('clickTimezonesCollapseBtn', function (timezonesCollapsed) {
|
439
|
+
// console.warn(`clickTimezonesCollapseBtn`, timezonesCollapsed);
|
440
|
+
});
|
441
|
+
}
|
442
|
+
bindClickDayname() {
|
443
|
+
let that = this;
|
444
|
+
this.calendar.on('clickDayname', function (event) {
|
445
|
+
// console.warn(`clickDayname`, event);
|
446
|
+
});
|
447
|
+
}
|
448
|
+
bindClickMore() {
|
449
|
+
let that = this;
|
450
|
+
this.calendar.on('clickMore', function (event) {
|
451
|
+
// console.warn(`clickMore`, event);
|
452
|
+
});
|
453
|
+
}
|
454
|
+
bindClickSchedule() {
|
455
|
+
// only works if useDetailPopup: false,
|
456
|
+
let that = this;
|
457
|
+
this.calendar.on('clickSchedule', function (event) {
|
458
|
+
// console.warn(`clickSchedule`, event);
|
459
|
+
let schedule = Object.assign({}, event.schedule);
|
460
|
+
schedule.start = (new LocalDate(schedule.start)).toDate();
|
461
|
+
schedule.end = (new LocalDate(schedule.end)).toDate();
|
462
|
+
that.openPopupScheduleEditor(schedule);
|
463
|
+
});
|
464
|
+
}
|
465
|
+
bindBeforeCreateSchedule() {
|
466
|
+
let that = this;
|
467
|
+
this.calendar.on('beforeCreateSchedule', function (event) {
|
468
|
+
// console.log(`beforeCreateSchedule`, event);
|
469
|
+
let start = (new LocalDate(event.start)).toDate();
|
470
|
+
start.setHours(9);
|
471
|
+
let end = (new LocalDate(event.end)).toDate();
|
472
|
+
end.setHours(10);
|
473
|
+
that.openPopupScheduleEditor({
|
474
|
+
title: '',
|
475
|
+
start: start,
|
476
|
+
end: end,
|
477
|
+
id: null,
|
478
|
+
});
|
479
|
+
});
|
480
|
+
}
|
481
|
+
bindBeforeUpdateSchedule() {
|
482
|
+
let that = this;
|
483
|
+
this.calendar.on('beforeUpdateSchedule', function (event) {
|
484
|
+
// console.log(`beforeUpdateSchedule`, event);
|
485
|
+
that.updateScheduleAndNotifyParent(event);
|
486
|
+
});
|
487
|
+
}
|
488
|
+
bindBeforeDeleteSchedule() {
|
489
|
+
let that = this;
|
490
|
+
this.calendar.on('beforeDeleteSchedule', function (event) {
|
491
|
+
// console.log(`beforeDeleteSchedule`, event.schedule);
|
492
|
+
// console.log(`beforeDeleteSchedule`, event.schedule);
|
493
|
+
that.deleteScheduleAndNotifyParent({ id: event.schedule.id, calendarId: event.schedule.calendarId });
|
494
|
+
});
|
495
|
+
}
|
496
|
+
nextColor() {
|
497
|
+
let color = this.colors[this.colorIndex++].hex();
|
498
|
+
if (this.colorIndex >= this.colors.length)
|
499
|
+
this.colorIndex = 0;
|
500
|
+
return color;
|
501
|
+
}
|
502
|
+
createScheduleAndNotifyParent(args) {
|
503
|
+
let schedule = this.createSchedule(args);
|
504
|
+
this.userCreatedSchedule.emit(schedule);
|
505
|
+
return schedule;
|
506
|
+
}
|
507
|
+
createSchedules(schedules) {
|
508
|
+
let newSchedules = [];
|
509
|
+
for (let schedule of schedules) {
|
510
|
+
newSchedules.push(this.createSchedule(schedule));
|
511
|
+
}
|
512
|
+
return newSchedules;
|
513
|
+
}
|
514
|
+
createSchedule(args) {
|
515
|
+
// if (form.invalid) return;
|
516
|
+
// create a color
|
517
|
+
let color = this.nextColor();
|
518
|
+
// console.log(color);
|
519
|
+
// create an id
|
520
|
+
let id = (args.id == null) ? '' : args.id.toString();
|
521
|
+
if (id.length === 0) {
|
522
|
+
id = v4();
|
523
|
+
}
|
524
|
+
let start = LocalDate.convertToJsDate(args.start);
|
525
|
+
let end = LocalDate.convertToJsDate(args.end);
|
526
|
+
let schedule = {
|
527
|
+
id,
|
528
|
+
calendarId: (args.calendarId == null) ? this.calendarId : args.calendarId,
|
529
|
+
title: args.title,
|
530
|
+
start: start,
|
531
|
+
end: end,
|
532
|
+
category: args.category,
|
533
|
+
isAllDay: args.isAllDay,
|
534
|
+
dueDateClass: '',
|
535
|
+
bgColor: color,
|
536
|
+
};
|
537
|
+
// console.log(`event-calendar.component.ts: createEvent:`, schedule);
|
538
|
+
this.calendar.createSchedules([schedule]);
|
539
|
+
return this.calendar.getSchedule(schedule.id, schedule.calendarId);
|
540
|
+
}
|
541
|
+
updateScheduleAndNotifyParent(args) {
|
542
|
+
let schedule = this.updateSchedule(args);
|
543
|
+
this.userUpdatedSchedule.emit(schedule);
|
544
|
+
return schedule;
|
545
|
+
}
|
546
|
+
updateSchedule(schedule) {
|
547
|
+
// console.log(`event-calendar.component.ts: updateSchedule:`, schedule);
|
548
|
+
let calendarId = (schedule.calendarId == null) ? this.calendarId : schedule.calendarId;
|
549
|
+
this.calendar.updateSchedule(schedule.id, calendarId, schedule, false);
|
550
|
+
return this.calendar.getSchedule(schedule.id, calendarId);
|
551
|
+
}
|
552
|
+
getSchedule(args) {
|
553
|
+
// console.log(`event-calendar.component.ts: getSchedule:`, schedule);
|
554
|
+
let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
|
555
|
+
return this.calendar.getSchedule(args.id, calendarId);
|
556
|
+
}
|
557
|
+
deleteScheduleAndNotifyParent(args) {
|
558
|
+
this.deleteSchedule(args);
|
559
|
+
let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
|
560
|
+
this.userDeletedSchedule.emit({ id: args.id, calendarId });
|
561
|
+
}
|
562
|
+
deleteSchedule(args) {
|
563
|
+
// console.log(`event-calendar.component.ts: deleteSchedule:`, schedule);
|
564
|
+
let calendarId = (args.calendarId == null) ? this.calendarId : args.calendarId;
|
565
|
+
this.calendar.deleteSchedule(args.id, calendarId, false);
|
566
|
+
}
|
567
|
+
deleteAllSchedules() {
|
568
|
+
this.calendar.clear();
|
569
|
+
}
|
570
|
+
openPopupScheduleEditor(schedule) {
|
571
|
+
// console.log('openPopupScheduleEditor: calevent:', schedule);
|
572
|
+
const dialogConfig = new MatDialogConfig();
|
573
|
+
dialogConfig.panelClass = this.options.themeClass;
|
574
|
+
console.warn(`options: `, this.options);
|
575
|
+
dialogConfig.data = { schedule, darkMode: this.options.darkMode, themeClass: this.options.themeClass };
|
576
|
+
dialogConfig.autoFocus = true;
|
577
|
+
const dialogRef = this.dialog.open(NgxMatTuiCalendarEditorDialogComponent, dialogConfig);
|
578
|
+
// const dialogRef = this.dialog.open(NgxMatTuiCalendarScheduleEditorDialogComponent, {
|
579
|
+
// data: schedule,
|
580
|
+
// });
|
581
|
+
dialogRef.afterClosed().subscribe((result) => {
|
582
|
+
// console.log('openPopupScheduleEditor: The dialog was closed', result);
|
583
|
+
this.calendar.render(true); // <-- so that selection is cleared
|
584
|
+
if (result && result.schedule) {
|
585
|
+
let schedule = result.schedule;
|
586
|
+
if (result.performDelete == true) {
|
587
|
+
// delete
|
588
|
+
// console.log(`openPopupScheduleEditor:afterCLosed: deleteSchedule`);
|
589
|
+
this.deleteScheduleAndNotifyParent({ id: schedule.id, calendarId: schedule.calendarId });
|
590
|
+
}
|
591
|
+
else if (schedule.id == null) {
|
592
|
+
// console.log(`openPopupScheduleEditor:afterCLosed: addSchedule`);
|
593
|
+
this.createScheduleAndNotifyParent(schedule);
|
594
|
+
}
|
595
|
+
else {
|
596
|
+
// console.log(`openPopupScheduleEditor:afterCLosed: updateSchedule`);
|
597
|
+
this.updateScheduleAndNotifyParent(schedule);
|
598
|
+
}
|
599
|
+
}
|
600
|
+
});
|
601
|
+
}
|
602
|
+
setOptions(options) {
|
603
|
+
this.calendar.setOptions(this.prerocessOptions(options));
|
604
|
+
}
|
605
|
+
prerocessOptions(options) {
|
606
|
+
let defs = this.getDefaultOptions();
|
607
|
+
if (options == null) {
|
608
|
+
options = defs;
|
609
|
+
}
|
610
|
+
else {
|
611
|
+
options = Object.assign(Object.assign({}, defs), options);
|
612
|
+
}
|
613
|
+
options.useCreationPopup = false;
|
614
|
+
options.useDetailPopup = false;
|
615
|
+
return options;
|
616
|
+
}
|
617
|
+
getDefaultOptions() {
|
618
|
+
return {
|
619
|
+
defaultView: 'month',
|
620
|
+
taskView: true,
|
621
|
+
useCreationPopup: false,
|
622
|
+
useDetailPopup: false,
|
623
|
+
theme: this.getDefaultTheme(),
|
624
|
+
template: {
|
625
|
+
monthDayname: function (dayname) {
|
626
|
+
return '<span class="calendar-week-dayname-name">' + dayname.label + '</span>';
|
627
|
+
}
|
628
|
+
},
|
629
|
+
week: {
|
630
|
+
// startDayOfWeek: undefined,
|
631
|
+
// daynames: undefined,
|
632
|
+
narrowWeekend: false,
|
633
|
+
// workweek: true,
|
634
|
+
showTimezoneCollapseButton: true,
|
635
|
+
timezonesCollapsed: true,
|
636
|
+
hourStart: 7,
|
637
|
+
hourEnd: 20,
|
638
|
+
},
|
639
|
+
};
|
640
|
+
}
|
641
|
+
getColor(name) {
|
642
|
+
const el = document.getElementById(`theme-${name}`);
|
643
|
+
if (el) {
|
644
|
+
const style = window.getComputedStyle(el, null);
|
645
|
+
console.warn(`color:`, style.color);
|
646
|
+
return style.color;
|
647
|
+
}
|
648
|
+
return '';
|
649
|
+
}
|
650
|
+
getDefaultTheme() {
|
651
|
+
function adjustHexOpacity(color, opacity) {
|
652
|
+
const r = parseInt(color.slice(1, 3), 16);
|
653
|
+
const g = parseInt(color.slice(3, 5), 16);
|
654
|
+
const b = parseInt(color.slice(5, 7), 16);
|
655
|
+
return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity + ')';
|
656
|
+
}
|
657
|
+
// default keys and styles
|
658
|
+
// TODO: apply Material Design Theme
|
659
|
+
let background = this.getColor("background");
|
660
|
+
let border = this.getColor("divider");
|
661
|
+
let borderLight = this.getColor("divider-light");
|
662
|
+
let shadow = this.getColor("divider");
|
663
|
+
let highlight = this.getColor("highlight");
|
664
|
+
let primary = this.getColor("primary");
|
665
|
+
let warn = this.getColor("warn");
|
666
|
+
let text = this.getColor("foreground");
|
667
|
+
let primaryShaded = this.getColor("primary-shaded");
|
668
|
+
// tui-full-calendar-weekday-schedule-title
|
669
|
+
//calendar-week-dayname-name
|
670
|
+
return {
|
671
|
+
'common.border': `1px solid ${border}`,
|
672
|
+
'common.backgroundColor': background,
|
673
|
+
'common.holiday.color': warn,
|
674
|
+
'common.saturday.color': text,
|
675
|
+
'common.dayname.color': text,
|
676
|
+
'common.today.color': '#0f0',
|
677
|
+
// creation guide style
|
678
|
+
'common.creationGuide.backgroundColor': primaryShaded,
|
679
|
+
'common.creationGuide.border': `1px solid ${highlight}`,
|
680
|
+
// month header 'dayname'
|
681
|
+
'month.dayname.height': '31px',
|
682
|
+
'month.dayname.borderLeft': `1px solid ${border}`,
|
683
|
+
'month.dayname.paddingLeft': '10px',
|
684
|
+
'month.dayname.paddingRight': '10px',
|
685
|
+
'month.dayname.backgroundColor': 'inherit',
|
686
|
+
'month.dayname.fontSize': '12px',
|
687
|
+
'month.dayname.fontWeight': 'normal',
|
688
|
+
'month.dayname.textAlign': 'left',
|
689
|
+
// month day grid cell 'day'
|
690
|
+
'month.holidayExceptThisMonth.color': 'rgba(255, 64, 64, 0.4)',
|
691
|
+
'month.dayExceptThisMonth.color': 'rgba(51, 51, 51, 0.4)',
|
692
|
+
'month.weekend.backgroundColor': 'inherit',
|
693
|
+
'month.day.fontSize': '14px',
|
694
|
+
'month.schedule.color': highlight,
|
695
|
+
// month schedule style
|
696
|
+
'month.schedule.borderRadius': '2px',
|
697
|
+
'month.schedule.height': '24px',
|
698
|
+
'month.schedule.marginTop': '2px',
|
699
|
+
'month.schedule.marginLeft': '8px',
|
700
|
+
'month.schedule.marginRight': '8px',
|
701
|
+
// month more view
|
702
|
+
'month.moreView.border': `1px solid ${border}`,
|
703
|
+
'month.moreView.boxShadow': `0 2px 6px 0 ${shadow}`,
|
704
|
+
'month.moreView.backgroundColor': background,
|
705
|
+
'month.moreView.paddingBottom': '17px',
|
706
|
+
'month.moreViewTitle.height': '44px',
|
707
|
+
'month.moreViewTitle.marginBottom': '12px',
|
708
|
+
'month.moreViewTitle.backgroundColor': 'inherit',
|
709
|
+
'month.moreViewTitle.borderBottom': 'none',
|
710
|
+
'month.moreViewTitle.padding': '12px 17px 0 17px',
|
711
|
+
'month.moreViewList.padding': '0 17px',
|
712
|
+
// week header 'dayname'
|
713
|
+
'week.dayname.height': '42px',
|
714
|
+
'week.dayname.borderTop': `1px solid ${border}`,
|
715
|
+
'week.dayname.borderBottom': `1px solid ${border}`,
|
716
|
+
'week.dayname.borderLeft': 'inherit',
|
717
|
+
'week.dayname.paddingLeft': '0',
|
718
|
+
'week.dayname.backgroundColor': 'inherit',
|
719
|
+
'week.dayname.textAlign': 'left',
|
720
|
+
'week.today.color': text,
|
721
|
+
'week.pastDay.color': borderLight,
|
722
|
+
// week vertical panel 'vpanel'
|
723
|
+
'week.vpanelSplitter.border': `1px solid ${border}`,
|
724
|
+
'week.vpanelSplitter.height': '3px',
|
725
|
+
// week daygrid 'daygrid'
|
726
|
+
'week.daygrid.borderRight': `1px solid ${border}`,
|
727
|
+
'week.daygrid.backgroundColor': background,
|
728
|
+
'week.daygridLeft.width': '72px',
|
729
|
+
'week.daygridLeft.backgroundColor': background,
|
730
|
+
'week.daygridLeft.paddingRight': '8px',
|
731
|
+
'week.daygridLeft.borderRight': `1px solid ${border}`,
|
732
|
+
'week.today.backgroundColor': primaryShaded,
|
733
|
+
'week.weekend.backgroundColor': 'inherit',
|
734
|
+
// week timegrid 'timegrid'
|
735
|
+
'week.timegridLeft.width': '72px',
|
736
|
+
'week.timegridLeft.backgroundColor': 'inherit',
|
737
|
+
'week.timegridLeft.borderRight': `1px solid ${border}`,
|
738
|
+
'week.timegridLeft.fontSize': '11px',
|
739
|
+
'week.timegridLeftTimezoneLabel.height': '40px',
|
740
|
+
'week.timegridLeftAdditionalTimezone.backgroundColor': background,
|
741
|
+
'week.timegridOneHour.height': '52px',
|
742
|
+
'week.timegridHalfHour.height': '26px',
|
743
|
+
'week.timegridHalfHour.borderBottom': 'none',
|
744
|
+
'week.timegridHorizontalLine.borderBottom': `1px solid ${border}`,
|
745
|
+
'week.timegrid.paddingRight': '8px',
|
746
|
+
'week.timegrid.borderRight': `1px solid ${border}`,
|
747
|
+
'week.timegridSchedule.borderRadius': '2px',
|
748
|
+
'week.timegridSchedule.paddingLeft': '2px',
|
749
|
+
// #515ce6 is a slate blue
|
750
|
+
'week.currentTime.color': highlight,
|
751
|
+
'week.currentTime.fontSize': '11px',
|
752
|
+
'week.currentTime.fontWeight': 'normal',
|
753
|
+
'week.pastTime.color': borderLight,
|
754
|
+
'week.pastTime.fontWeight': 'normal',
|
755
|
+
'week.futureTime.color': border,
|
756
|
+
'week.futureTime.fontWeight': 'normal',
|
757
|
+
'week.currentTimeLinePast.border': `1px dashed ${highlight}`,
|
758
|
+
'week.currentTimeLineBullet.backgroundColor': highlight,
|
759
|
+
'week.currentTimeLineToday.border': `1px solid ${highlight}`,
|
760
|
+
'week.currentTimeLineFuture.border': 'none',
|
761
|
+
// week creation guide style
|
762
|
+
'week.creationGuide.color': highlight,
|
763
|
+
'week.creationGuide.fontSize': '11px',
|
764
|
+
'week.creationGuide.fontWeight': 'bold',
|
765
|
+
// week daygrid schedule style
|
766
|
+
'week.dayGridSchedule.borderRadius': '2px',
|
767
|
+
'week.dayGridSchedule.height': '24px',
|
768
|
+
'week.dayGridSchedule.marginTop': '2px',
|
769
|
+
'week.dayGridSchedule.marginLeft': '8px',
|
770
|
+
'week.dayGridSchedule.marginRight': '8px'
|
771
|
+
};
|
772
|
+
}
|
773
|
+
}
|
774
|
+
NgxMatTuiCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarComponent, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
775
|
+
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: "<p>\r\n ngx-mat-tui-calendar v0.0.15 works!!!\r\n</p>\r\n<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 id=\"theme-primary\"></div>\r\n <div id=\"theme-primary-shaded\"></div>\r\n <div id=\"theme-highlight\"></div>\r\n <div id=\"theme-accent\"></div>\r\n <div id=\"theme-warn\"></div>\r\n <div id=\"theme-foreground\"></div>\r\n <div id=\"theme-divider\"></div>\r\n <div id=\"theme-background\"></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"] }] });
|
27
776
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarComponent, decorators: [{
|
28
777
|
type: Component,
|
29
778
|
args: [{
|
30
779
|
selector: 'ngx-mat-tui-calendar',
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
`,
|
36
|
-
styles: []
|
780
|
+
templateUrl: './ngx-mat-tui-calendar.component.html',
|
781
|
+
styleUrls: [
|
782
|
+
'./ngx-mat-tui-calendar.component.scss'
|
783
|
+
],
|
37
784
|
}]
|
38
|
-
}], ctorParameters: function () { return []; }
|
785
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { userCreatedSchedule: [{
|
786
|
+
type: Output
|
787
|
+
}], userUpdatedSchedule: [{
|
788
|
+
type: Output
|
789
|
+
}], userDeletedSchedule: [{
|
790
|
+
type: Output
|
791
|
+
}], options: [{
|
792
|
+
type: Input
|
793
|
+
}] } });
|
39
794
|
|
795
|
+
// Angular modules
|
40
796
|
class NgxMatTuiCalendarModule {
|
41
797
|
}
|
42
798
|
NgxMatTuiCalendarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
43
|
-
NgxMatTuiCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, declarations: [NgxMatTuiCalendarComponent
|
44
|
-
|
799
|
+
NgxMatTuiCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, declarations: [NgxMatTuiCalendarComponent,
|
800
|
+
NgxMatTuiCalendarWrapperComponent,
|
801
|
+
NgxMatTuiCalendarEditorDialogComponent], imports: [BrowserAnimationsModule,
|
802
|
+
BrowserModule,
|
803
|
+
FlexLayoutModule,
|
804
|
+
FlexModule,
|
805
|
+
FormsModule,
|
806
|
+
HttpClientModule,
|
807
|
+
OverlayModule,
|
808
|
+
ReactiveFormsModule,
|
809
|
+
MatButtonModule,
|
810
|
+
MatButtonToggleModule,
|
811
|
+
MatCardModule,
|
812
|
+
MatDatepickerModule,
|
813
|
+
MatDialogModule,
|
814
|
+
MatDividerModule,
|
815
|
+
MatFormFieldModule,
|
816
|
+
MatIconModule,
|
817
|
+
MatInputModule,
|
818
|
+
MatNativeDateModule,
|
819
|
+
MatRadioModule,
|
820
|
+
MatRippleModule,
|
821
|
+
MatSlideToggleModule,
|
822
|
+
MatToolbarModule,
|
823
|
+
FontAwesomeModule,
|
824
|
+
MatTimepickerModule], exports: [NgxMatTuiCalendarComponent] });
|
825
|
+
NgxMatTuiCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, imports: [[
|
826
|
+
BrowserAnimationsModule,
|
827
|
+
BrowserModule,
|
828
|
+
FlexLayoutModule,
|
829
|
+
FlexModule,
|
830
|
+
FormsModule,
|
831
|
+
HttpClientModule,
|
832
|
+
OverlayModule,
|
833
|
+
ReactiveFormsModule,
|
834
|
+
MatButtonModule,
|
835
|
+
MatButtonToggleModule,
|
836
|
+
MatCardModule,
|
837
|
+
MatDatepickerModule,
|
838
|
+
MatDialogModule,
|
839
|
+
MatDividerModule,
|
840
|
+
MatFormFieldModule,
|
841
|
+
MatIconModule,
|
842
|
+
MatInputModule,
|
843
|
+
MatNativeDateModule,
|
844
|
+
MatRadioModule,
|
845
|
+
MatRippleModule,
|
846
|
+
MatSlideToggleModule,
|
847
|
+
MatToolbarModule,
|
848
|
+
FontAwesomeModule,
|
849
|
+
MatTimepickerModule,
|
850
|
+
]] });
|
45
851
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: NgxMatTuiCalendarModule, decorators: [{
|
46
852
|
type: NgModule,
|
47
853
|
args: [{
|
48
854
|
declarations: [
|
49
855
|
NgxMatTuiCalendarComponent,
|
856
|
+
NgxMatTuiCalendarWrapperComponent,
|
857
|
+
NgxMatTuiCalendarEditorDialogComponent,
|
858
|
+
],
|
859
|
+
imports: [
|
860
|
+
BrowserAnimationsModule,
|
861
|
+
BrowserModule,
|
862
|
+
FlexLayoutModule,
|
863
|
+
FlexModule,
|
864
|
+
FormsModule,
|
865
|
+
HttpClientModule,
|
866
|
+
OverlayModule,
|
867
|
+
ReactiveFormsModule,
|
868
|
+
MatButtonModule,
|
869
|
+
MatButtonToggleModule,
|
870
|
+
MatCardModule,
|
871
|
+
MatDatepickerModule,
|
872
|
+
MatDialogModule,
|
873
|
+
MatDividerModule,
|
874
|
+
MatFormFieldModule,
|
875
|
+
MatIconModule,
|
876
|
+
MatInputModule,
|
877
|
+
MatNativeDateModule,
|
878
|
+
MatRadioModule,
|
879
|
+
MatRippleModule,
|
880
|
+
MatSlideToggleModule,
|
881
|
+
MatToolbarModule,
|
882
|
+
FontAwesomeModule,
|
883
|
+
MatTimepickerModule,
|
50
884
|
],
|
51
|
-
imports: [],
|
52
885
|
exports: [
|
53
886
|
NgxMatTuiCalendarComponent,
|
54
887
|
],
|
@@ -66,5 +899,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImpo
|
|
66
899
|
* Generated bundle index. Do not edit.
|
67
900
|
*/
|
68
901
|
|
69
|
-
export { NgxMatTuiCalendarComponent, NgxMatTuiCalendarModule, NgxMatTuiCalendarService };
|
902
|
+
export { LocalDate, NgxMatTuiCalendarComponent, NgxMatTuiCalendarModule, NgxMatTuiCalendarService };
|
70
903
|
//# sourceMappingURL=ngx-mat-tui-calendar.js.map
|