1 | import * as i0 from '@angular/core';
|
2 | import { EventEmitter, Directive, Inject, Input, Output, Injectable, LOCALE_ID, Pipe, Component, HostListener, InjectionToken, NgModule } from '@angular/core';
|
3 | import * as i1 from '@angular/common';
|
4 | import { DOCUMENT, formatDate, CommonModule, I18nPluralPipe } from '@angular/common';
|
5 | import { Subject, Observable, of, timer, BehaviorSubject, interval } from 'rxjs';
|
6 | import { takeUntil, switchMap, startWith, switchMapTo, map } from 'rxjs/operators';
|
7 | import { positionElements } from 'positioning';
|
8 | import { validateEvents as validateEvents$1, getMonthView, getWeekViewHeader, getWeekView } from 'calendar-utils';
|
9 | export { DAYS_OF_WEEK } from 'calendar-utils';
|
10 | import * as i2 from 'angular-draggable-droppable';
|
11 | import { DragAndDropModule } from 'angular-draggable-droppable';
|
12 | import { trigger, state, style, transition, animate } from '@angular/animations';
|
13 | import * as i4 from 'angular-resizable-element';
|
14 | import { ResizableModule } from 'angular-resizable-element';
|
15 |
|
16 | class ClickDirective {
|
17 | constructor(renderer, elm, document) {
|
18 | this.renderer = renderer;
|
19 | this.elm = elm;
|
20 | this.document = document;
|
21 | this.clickListenerDisabled = false;
|
22 | this.click = new EventEmitter();
|
23 | this.destroy$ = new Subject();
|
24 | }
|
25 | ngOnInit() {
|
26 | if (!this.clickListenerDisabled) {
|
27 | this.listen()
|
28 | .pipe(takeUntil(this.destroy$))
|
29 | .subscribe((event) => {
|
30 | event.stopPropagation();
|
31 | this.click.emit(event);
|
32 | });
|
33 | }
|
34 | }
|
35 | ngOnDestroy() {
|
36 | this.destroy$.next();
|
37 | }
|
38 | listen() {
|
39 | return new Observable((observer) => {
|
40 | return this.renderer.listen(this.elm.nativeElement, 'click', (event) => {
|
41 | observer.next(event);
|
42 | });
|
43 | });
|
44 | }
|
45 | }
|
46 | ClickDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ClickDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
47 | ClickDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: ClickDirective, selector: "[mwlClick]", inputs: { clickListenerDisabled: "clickListenerDisabled" }, outputs: { click: "mwlClick" }, ngImport: i0 });
|
48 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ClickDirective, decorators: [{
|
49 | type: Directive,
|
50 | args: [{
|
51 | selector: '[mwlClick]',
|
52 | }]
|
53 | }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: undefined, decorators: [{
|
54 | type: Inject,
|
55 | args: [DOCUMENT]
|
56 | }] }]; }, propDecorators: { clickListenerDisabled: [{
|
57 | type: Input
|
58 | }], click: [{
|
59 | type: Output,
|
60 | args: ['mwlClick']
|
61 | }] } });
|
62 |
|
63 | class KeydownEnterDirective {
|
64 | constructor(host, ngZone, renderer) {
|
65 | this.host = host;
|
66 | this.ngZone = ngZone;
|
67 | this.renderer = renderer;
|
68 | this.keydown = new EventEmitter();
|
69 | this.keydownListener = null;
|
70 | }
|
71 | ngOnInit() {
|
72 | this.ngZone.runOutsideAngular(() => {
|
73 | this.keydownListener = this.renderer.listen(this.host.nativeElement, 'keydown', (event) => {
|
74 | if (event.keyCode === 13 ||
|
75 | event.which === 13 ||
|
76 | event.key === 'Enter') {
|
77 | event.preventDefault();
|
78 | event.stopPropagation();
|
79 | this.ngZone.run(() => {
|
80 | this.keydown.emit(event);
|
81 | });
|
82 | }
|
83 | });
|
84 | });
|
85 | }
|
86 | ngOnDestroy() {
|
87 | if (this.keydownListener !== null) {
|
88 | this.keydownListener();
|
89 | this.keydownListener = null;
|
90 | }
|
91 | }
|
92 | }
|
93 | KeydownEnterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: KeydownEnterDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
94 | KeydownEnterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: KeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: { keydown: "mwlKeydownEnter" }, ngImport: i0 });
|
95 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: KeydownEnterDirective, decorators: [{
|
96 | type: Directive,
|
97 | args: [{
|
98 | selector: '[mwlKeydownEnter]',
|
99 | }]
|
100 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { keydown: [{
|
101 | type: Output,
|
102 | args: ['mwlKeydownEnter']
|
103 | }] } });
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | class CalendarA11y {
|
146 | constructor(i18nPlural) {
|
147 | this.i18nPlural = i18nPlural;
|
148 | }
|
149 | |
150 |
|
151 |
|
152 |
|
153 | monthCell({ day, locale }) {
|
154 | if (day.badgeTotal > 0) {
|
155 | return `
|
156 | ${formatDate(day.date, 'EEEE MMMM d', locale)},
|
157 | ${this.i18nPlural.transform(day.badgeTotal, {
|
158 | '=0': 'No events',
|
159 | '=1': 'One event',
|
160 | other: '# events',
|
161 | })},
|
162 | click to expand
|
163 | `;
|
164 | }
|
165 | else {
|
166 | return `${formatDate(day.date, 'EEEE MMMM d', locale)}`;
|
167 | }
|
168 | }
|
169 | |
170 |
|
171 |
|
172 |
|
173 | openDayEventsLandmark({ date, locale }) {
|
174 | return `
|
175 | Beginning of expanded view for ${formatDate(date, 'EEEE MMMM dd', locale)}
|
176 | `;
|
177 | }
|
178 | |
179 |
|
180 |
|
181 |
|
182 | openDayEventsAlert({ date, locale }) {
|
183 | return `${formatDate(date, 'EEEE MMMM dd', locale)} expanded`;
|
184 | }
|
185 | |
186 |
|
187 |
|
188 |
|
189 | eventDescription({ event, locale }) {
|
190 | if (event.allDay === true) {
|
191 | return this.allDayEventDescription({ event, locale });
|
192 | }
|
193 | const aria = `
|
194 | ${formatDate(event.start, 'EEEE MMMM dd', locale)},
|
195 | ${event.title}, from ${formatDate(event.start, 'hh:mm a', locale)}
|
196 | `;
|
197 | if (event.end) {
|
198 | return aria + ` to ${formatDate(event.end, 'hh:mm a', locale)}`;
|
199 | }
|
200 | return aria;
|
201 | }
|
202 | |
203 |
|
204 |
|
205 |
|
206 |
|
207 | allDayEventDescription({ event, locale }) {
|
208 | const aria = `
|
209 | ${event.title}, event spans multiple days:
|
210 | start time ${formatDate(event.start, 'MMMM dd hh:mm a', locale)}
|
211 | `;
|
212 | if (event.end) {
|
213 | return (aria + `, stop time ${formatDate(event.end, 'MMMM d hh:mm a', locale)}`);
|
214 | }
|
215 | return aria + `, no stop time`;
|
216 | }
|
217 | |
218 |
|
219 |
|
220 |
|
221 | actionButtonLabel({ action }) {
|
222 | return action.a11yLabel;
|
223 | }
|
224 | |
225 |
|
226 |
|
227 | monthCellTabIndex() {
|
228 | return 0;
|
229 | }
|
230 | |
231 |
|
232 |
|
233 | hideMonthCellEvents() {
|
234 | return true;
|
235 | }
|
236 | |
237 |
|
238 |
|
239 | hideEventTitle() {
|
240 | return true;
|
241 | }
|
242 | |
243 |
|
244 |
|
245 | hideWeekHourSegment() {
|
246 | return true;
|
247 | }
|
248 | |
249 |
|
250 |
|
251 | hideDayHourSegment() {
|
252 | return true;
|
253 | }
|
254 | }
|
255 | CalendarA11y.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11y, deps: [{ token: i1.I18nPluralPipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
256 | CalendarA11y.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11y });
|
257 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11y, decorators: [{
|
258 | type: Injectable
|
259 | }], ctorParameters: function () { return [{ type: i1.I18nPluralPipe }]; } });
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | class CalendarA11yPipe {
|
269 | constructor(calendarA11y, locale) {
|
270 | this.calendarA11y = calendarA11y;
|
271 | this.locale = locale;
|
272 | }
|
273 | transform(a11yParams, method) {
|
274 | a11yParams.locale = a11yParams.locale || this.locale;
|
275 | if (typeof this.calendarA11y[method] === 'undefined') {
|
276 | const allowedMethods = Object.getOwnPropertyNames(Object.getPrototypeOf(CalendarA11y.prototype)).filter((iMethod) => iMethod !== 'constructor');
|
277 | throw new Error(`${method} is not a valid a11y method. Can only be one of ${allowedMethods.join(', ')}`);
|
278 | }
|
279 | return this.calendarA11y[method](a11yParams);
|
280 | }
|
281 | }
|
282 | CalendarA11yPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11yPipe, deps: [{ token: CalendarA11y }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
283 | CalendarA11yPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11yPipe, name: "calendarA11y" });
|
284 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarA11yPipe, decorators: [{
|
285 | type: Pipe,
|
286 | args: [{
|
287 | name: 'calendarA11y',
|
288 | }]
|
289 | }], ctorParameters: function () { return [{ type: CalendarA11y }, { type: undefined, decorators: [{
|
290 | type: Inject,
|
291 | args: [LOCALE_ID]
|
292 | }] }]; } });
|
293 |
|
294 | class CalendarEventActionsComponent {
|
295 | constructor() {
|
296 | this.trackByActionId = (index, action) => action.id ? action.id : action;
|
297 | }
|
298 | }
|
299 | CalendarEventActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
300 | CalendarEventActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarEventActionsComponent, selector: "mwl-calendar-event-actions", inputs: { event: "event", customTemplate: "customTemplate" }, ngImport: i0, template: `
|
301 | <ng-template
|
302 | #defaultTemplate
|
303 | let-event="event"
|
304 | let-trackByActionId="trackByActionId"
|
305 | >
|
306 | <span *ngIf="event.actions" class="cal-event-actions">
|
307 | <a
|
308 | class="cal-event-action"
|
309 | href="javascript:;"
|
310 | *ngFor="let action of event.actions; trackBy: trackByActionId"
|
311 | (mwlClick)="action.onClick({ event: event, sourceEvent: $event })"
|
312 | (mwlKeydownEnter)="
|
313 | action.onClick({ event: event, sourceEvent: $event })
|
314 | "
|
315 | [ngClass]="action.cssClass"
|
316 | [innerHtml]="action.label"
|
317 | tabindex="0"
|
318 | role="button"
|
319 | [attr.aria-label]="
|
320 | { action: action } | calendarA11y : 'actionButtonLabel'
|
321 | "
|
322 | >
|
323 | </a>
|
324 | </span>
|
325 | </ng-template>
|
326 | <ng-template
|
327 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
328 | [ngTemplateOutletContext]="{
|
329 | event: event,
|
330 | trackByActionId: trackByActionId
|
331 | }"
|
332 | >
|
333 | </ng-template>
|
334 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "directive", type: KeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: ["mwlKeydownEnter"] }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
335 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventActionsComponent, decorators: [{
|
336 | type: Component,
|
337 | args: [{
|
338 | selector: 'mwl-calendar-event-actions',
|
339 | template: `
|
340 | <ng-template
|
341 | #defaultTemplate
|
342 | let-event="event"
|
343 | let-trackByActionId="trackByActionId"
|
344 | >
|
345 | <span *ngIf="event.actions" class="cal-event-actions">
|
346 | <a
|
347 | class="cal-event-action"
|
348 | href="javascript:;"
|
349 | *ngFor="let action of event.actions; trackBy: trackByActionId"
|
350 | (mwlClick)="action.onClick({ event: event, sourceEvent: $event })"
|
351 | (mwlKeydownEnter)="
|
352 | action.onClick({ event: event, sourceEvent: $event })
|
353 | "
|
354 | [ngClass]="action.cssClass"
|
355 | [innerHtml]="action.label"
|
356 | tabindex="0"
|
357 | role="button"
|
358 | [attr.aria-label]="
|
359 | { action: action } | calendarA11y : 'actionButtonLabel'
|
360 | "
|
361 | >
|
362 | </a>
|
363 | </span>
|
364 | </ng-template>
|
365 | <ng-template
|
366 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
367 | [ngTemplateOutletContext]="{
|
368 | event: event,
|
369 | trackByActionId: trackByActionId
|
370 | }"
|
371 | >
|
372 | </ng-template>
|
373 | `,
|
374 | }]
|
375 | }], propDecorators: { event: [{
|
376 | type: Input
|
377 | }], customTemplate: [{
|
378 | type: Input
|
379 | }] } });
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 | class CalendarEventTitleFormatter {
|
405 | |
406 |
|
407 |
|
408 | month(event, title) {
|
409 | return event.title;
|
410 | }
|
411 | |
412 |
|
413 |
|
414 | monthTooltip(event, title) {
|
415 | return event.title;
|
416 | }
|
417 | |
418 |
|
419 |
|
420 | week(event, title) {
|
421 | return event.title;
|
422 | }
|
423 | |
424 |
|
425 |
|
426 | weekTooltip(event, title) {
|
427 | return event.title;
|
428 | }
|
429 | |
430 |
|
431 |
|
432 | day(event, title) {
|
433 | return event.title;
|
434 | }
|
435 | |
436 |
|
437 |
|
438 | dayTooltip(event, title) {
|
439 | return event.title;
|
440 | }
|
441 | }
|
442 |
|
443 | class CalendarEventTitlePipe {
|
444 | constructor(calendarEventTitle) {
|
445 | this.calendarEventTitle = calendarEventTitle;
|
446 | }
|
447 | transform(title, titleType, event) {
|
448 | return this.calendarEventTitle[titleType](event, title);
|
449 | }
|
450 | }
|
451 | CalendarEventTitlePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventTitlePipe, deps: [{ token: CalendarEventTitleFormatter }], target: i0.ɵɵFactoryTarget.Pipe });
|
452 | CalendarEventTitlePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventTitlePipe, name: "calendarEventTitle" });
|
453 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventTitlePipe, decorators: [{
|
454 | type: Pipe,
|
455 | args: [{
|
456 | name: 'calendarEventTitle',
|
457 | }]
|
458 | }], ctorParameters: function () { return [{ type: CalendarEventTitleFormatter }]; } });
|
459 |
|
460 | class CalendarEventTitleComponent {
|
461 | }
|
462 | CalendarEventTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
463 | CalendarEventTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarEventTitleComponent, selector: "mwl-calendar-event-title", inputs: { event: "event", customTemplate: "customTemplate", view: "view" }, ngImport: i0, template: `
|
464 | <ng-template #defaultTemplate let-event="event" let-view="view">
|
465 | <span
|
466 | class="cal-event-title"
|
467 | [innerHTML]="event.title | calendarEventTitle : view : event"
|
468 | [attr.aria-hidden]="{} | calendarA11y : 'hideEventTitle'"
|
469 | >
|
470 | </span>
|
471 | </ng-template>
|
472 | <ng-template
|
473 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
474 | [ngTemplateOutletContext]="{
|
475 | event: event,
|
476 | view: view
|
477 | }"
|
478 | >
|
479 | </ng-template>
|
480 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: CalendarEventTitlePipe, name: "calendarEventTitle" }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
481 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarEventTitleComponent, decorators: [{
|
482 | type: Component,
|
483 | args: [{
|
484 | selector: 'mwl-calendar-event-title',
|
485 | template: `
|
486 | <ng-template #defaultTemplate let-event="event" let-view="view">
|
487 | <span
|
488 | class="cal-event-title"
|
489 | [innerHTML]="event.title | calendarEventTitle : view : event"
|
490 | [attr.aria-hidden]="{} | calendarA11y : 'hideEventTitle'"
|
491 | >
|
492 | </span>
|
493 | </ng-template>
|
494 | <ng-template
|
495 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
496 | [ngTemplateOutletContext]="{
|
497 | event: event,
|
498 | view: view
|
499 | }"
|
500 | >
|
501 | </ng-template>
|
502 | `,
|
503 | }]
|
504 | }], propDecorators: { event: [{
|
505 | type: Input
|
506 | }], customTemplate: [{
|
507 | type: Input
|
508 | }], view: [{
|
509 | type: Input
|
510 | }] } });
|
511 |
|
512 | class CalendarTooltipWindowComponent {
|
513 | }
|
514 | CalendarTooltipWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTooltipWindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
515 | CalendarTooltipWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarTooltipWindowComponent, selector: "mwl-calendar-tooltip-window", inputs: { contents: "contents", placement: "placement", event: "event", customTemplate: "customTemplate" }, ngImport: i0, template: `
|
516 | <ng-template
|
517 | #defaultTemplate
|
518 | let-contents="contents"
|
519 | let-placement="placement"
|
520 | let-event="event"
|
521 | >
|
522 | <div class="cal-tooltip" [ngClass]="'cal-tooltip-' + placement">
|
523 | <div class="cal-tooltip-arrow"></div>
|
524 | <div class="cal-tooltip-inner" [innerHtml]="contents"></div>
|
525 | </div>
|
526 | </ng-template>
|
527 | <ng-template
|
528 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
529 | [ngTemplateOutletContext]="{
|
530 | contents: contents,
|
531 | placement: placement,
|
532 | event: event
|
533 | }"
|
534 | >
|
535 | </ng-template>
|
536 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
537 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTooltipWindowComponent, decorators: [{
|
538 | type: Component,
|
539 | args: [{
|
540 | selector: 'mwl-calendar-tooltip-window',
|
541 | template: `
|
542 | <ng-template
|
543 | #defaultTemplate
|
544 | let-contents="contents"
|
545 | let-placement="placement"
|
546 | let-event="event"
|
547 | >
|
548 | <div class="cal-tooltip" [ngClass]="'cal-tooltip-' + placement">
|
549 | <div class="cal-tooltip-arrow"></div>
|
550 | <div class="cal-tooltip-inner" [innerHtml]="contents"></div>
|
551 | </div>
|
552 | </ng-template>
|
553 | <ng-template
|
554 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
555 | [ngTemplateOutletContext]="{
|
556 | contents: contents,
|
557 | placement: placement,
|
558 | event: event
|
559 | }"
|
560 | >
|
561 | </ng-template>
|
562 | `,
|
563 | }]
|
564 | }], propDecorators: { contents: [{
|
565 | type: Input
|
566 | }], placement: [{
|
567 | type: Input
|
568 | }], event: [{
|
569 | type: Input
|
570 | }], customTemplate: [{
|
571 | type: Input
|
572 | }] } });
|
573 | class CalendarTooltipDirective {
|
574 | constructor(elementRef, injector, renderer, componentFactoryResolver, viewContainerRef, document // eslint-disable-line
|
575 | ) {
|
576 | this.elementRef = elementRef;
|
577 | this.injector = injector;
|
578 | this.renderer = renderer;
|
579 | this.viewContainerRef = viewContainerRef;
|
580 | this.document = document;
|
581 | this.placement = 'auto';
|
582 | this.delay = null;
|
583 | this.cancelTooltipDelay$ = new Subject();
|
584 | this.tooltipFactory = componentFactoryResolver.resolveComponentFactory(CalendarTooltipWindowComponent);
|
585 | }
|
586 | ngOnChanges(changes) {
|
587 | if (this.tooltipRef &&
|
588 | (changes.contents || changes.customTemplate || changes.event)) {
|
589 | this.tooltipRef.instance.contents = this.contents;
|
590 | this.tooltipRef.instance.customTemplate = this.customTemplate;
|
591 | this.tooltipRef.instance.event = this.event;
|
592 | this.tooltipRef.changeDetectorRef.markForCheck();
|
593 | if (!this.contents) {
|
594 | this.hide();
|
595 | }
|
596 | }
|
597 | }
|
598 | ngOnDestroy() {
|
599 | this.hide();
|
600 | }
|
601 | onMouseOver() {
|
602 | const delay$ = this.delay === null ? of('now') : timer(this.delay);
|
603 | delay$.pipe(takeUntil(this.cancelTooltipDelay$)).subscribe(() => {
|
604 | this.show();
|
605 | });
|
606 | }
|
607 | onMouseOut() {
|
608 | this.hide();
|
609 | }
|
610 | show() {
|
611 | if (!this.tooltipRef && this.contents) {
|
612 | this.tooltipRef = this.viewContainerRef.createComponent(this.tooltipFactory, 0, this.injector, []);
|
613 | this.tooltipRef.instance.contents = this.contents;
|
614 | this.tooltipRef.instance.customTemplate = this.customTemplate;
|
615 | this.tooltipRef.instance.event = this.event;
|
616 | if (this.appendToBody) {
|
617 | this.document.body.appendChild(this.tooltipRef.location.nativeElement);
|
618 | }
|
619 | requestAnimationFrame(() => {
|
620 | this.positionTooltip();
|
621 | });
|
622 | }
|
623 | }
|
624 | hide() {
|
625 | if (this.tooltipRef) {
|
626 | this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.tooltipRef.hostView));
|
627 | this.tooltipRef = null;
|
628 | }
|
629 | this.cancelTooltipDelay$.next();
|
630 | }
|
631 | positionTooltip(previousPositions = []) {
|
632 | if (this.tooltipRef) {
|
633 | this.tooltipRef.changeDetectorRef.detectChanges();
|
634 | this.tooltipRef.instance.placement = positionElements(this.elementRef.nativeElement, this.tooltipRef.location.nativeElement.children[0], this.placement, this.appendToBody);
|
635 |
|
636 | if (previousPositions.indexOf(this.tooltipRef.instance.placement) === -1) {
|
637 | this.positionTooltip([
|
638 | ...previousPositions,
|
639 | this.tooltipRef.instance.placement,
|
640 | ]);
|
641 | }
|
642 | }
|
643 | }
|
644 | }
|
645 | CalendarTooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTooltipDirective, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i0.Renderer2 }, { token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
646 | CalendarTooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: CalendarTooltipDirective, selector: "[mwlCalendarTooltip]", inputs: { contents: ["mwlCalendarTooltip", "contents"], placement: ["tooltipPlacement", "placement"], customTemplate: ["tooltipTemplate", "customTemplate"], event: ["tooltipEvent", "event"], appendToBody: ["tooltipAppendToBody", "appendToBody"], delay: ["tooltipDelay", "delay"] }, host: { listeners: { "mouseenter": "onMouseOver()", "mouseleave": "onMouseOut()" } }, usesOnChanges: true, ngImport: i0 });
|
647 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTooltipDirective, decorators: [{
|
648 | type: Directive,
|
649 | args: [{
|
650 | selector: '[mwlCalendarTooltip]',
|
651 | }]
|
652 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i0.Renderer2 }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
653 | type: Inject,
|
654 | args: [DOCUMENT]
|
655 | }] }]; }, propDecorators: { contents: [{
|
656 | type: Input,
|
657 | args: ['mwlCalendarTooltip']
|
658 | }], placement: [{
|
659 | type: Input,
|
660 | args: ['tooltipPlacement']
|
661 | }], customTemplate: [{
|
662 | type: Input,
|
663 | args: ['tooltipTemplate']
|
664 | }], event: [{
|
665 | type: Input,
|
666 | args: ['tooltipEvent']
|
667 | }], appendToBody: [{
|
668 | type: Input,
|
669 | args: ['tooltipAppendToBody']
|
670 | }], delay: [{
|
671 | type: Input,
|
672 | args: ['tooltipDelay']
|
673 | }], onMouseOver: [{
|
674 | type: HostListener,
|
675 | args: ['mouseenter']
|
676 | }], onMouseOut: [{
|
677 | type: HostListener,
|
678 | args: ['mouseleave']
|
679 | }] } });
|
680 |
|
681 | var CalendarView;
|
682 | (function (CalendarView) {
|
683 | CalendarView["Month"] = "month";
|
684 | CalendarView["Week"] = "week";
|
685 | CalendarView["Day"] = "day";
|
686 | })(CalendarView || (CalendarView = {}));
|
687 |
|
688 | const validateEvents = (events) => {
|
689 | const warn = (...args) => console.warn('angular-calendar', ...args);
|
690 | return validateEvents$1(events, warn);
|
691 | };
|
692 | function isInsideLeftAndRight(outer, inner) {
|
693 | return (Math.floor(outer.left) <= Math.ceil(inner.left) &&
|
694 | Math.floor(inner.left) <= Math.ceil(outer.right) &&
|
695 | Math.floor(outer.left) <= Math.ceil(inner.right) &&
|
696 | Math.floor(inner.right) <= Math.ceil(outer.right));
|
697 | }
|
698 | function isInsideTopAndBottom(outer, inner) {
|
699 | return (Math.floor(outer.top) <= Math.ceil(inner.top) &&
|
700 | Math.floor(inner.top) <= Math.ceil(outer.bottom) &&
|
701 | Math.floor(outer.top) <= Math.ceil(inner.bottom) &&
|
702 | Math.floor(inner.bottom) <= Math.ceil(outer.bottom));
|
703 | }
|
704 | function isInside(outer, inner) {
|
705 | return (isInsideLeftAndRight(outer, inner) && isInsideTopAndBottom(outer, inner));
|
706 | }
|
707 | function roundToNearest(amount, precision) {
|
708 | return Math.round(amount / precision) * precision;
|
709 | }
|
710 | const trackByEventId = (index, event) => event.id ? event.id : event;
|
711 | const trackByWeekDayHeaderDate = (index, day) => day.date.toISOString();
|
712 | const trackByHourSegment = (index, segment) => segment.date.toISOString();
|
713 | const trackByHour = (index, hour) => hour.segments[0].date.toISOString();
|
714 | const trackByWeekAllDayEvent = (index, weekEvent) => (weekEvent.event.id ? weekEvent.event.id : weekEvent.event);
|
715 | const trackByWeekTimeEvent = (index, weekEvent) => (weekEvent.event.id ? weekEvent.event.id : weekEvent.event);
|
716 | const MINUTES_IN_HOUR = 60;
|
717 | function getPixelAmountInMinutes(hourSegments, hourSegmentHeight, hourDuration) {
|
718 | return (hourDuration || MINUTES_IN_HOUR) / (hourSegments * hourSegmentHeight);
|
719 | }
|
720 | function getMinutesMoved(movedY, hourSegments, hourSegmentHeight, eventSnapSize, hourDuration) {
|
721 | const draggedInPixelsSnapSize = roundToNearest(movedY, eventSnapSize || hourSegmentHeight);
|
722 | const pixelAmountInMinutes = getPixelAmountInMinutes(hourSegments, hourSegmentHeight, hourDuration);
|
723 | return draggedInPixelsSnapSize * pixelAmountInMinutes;
|
724 | }
|
725 | function getDefaultEventEnd(dateAdapter, event, minimumMinutes) {
|
726 | if (event.end) {
|
727 | return event.end;
|
728 | }
|
729 | else {
|
730 | return dateAdapter.addMinutes(event.start, minimumMinutes);
|
731 | }
|
732 | }
|
733 | function addDaysWithExclusions(dateAdapter, date, days, excluded) {
|
734 | let daysCounter = 0;
|
735 | let daysToAdd = 0;
|
736 | const changeDays = days < 0 ? dateAdapter.subDays : dateAdapter.addDays;
|
737 | let result = date;
|
738 | while (daysToAdd <= Math.abs(days)) {
|
739 | result = changeDays(date, daysCounter);
|
740 | const day = dateAdapter.getDay(result);
|
741 | if (excluded.indexOf(day) === -1) {
|
742 | daysToAdd++;
|
743 | }
|
744 | daysCounter++;
|
745 | }
|
746 | return result;
|
747 | }
|
748 | function isDraggedWithinPeriod(newStart, newEnd, period) {
|
749 | const end = newEnd || newStart;
|
750 | return ((period.start <= newStart && newStart <= period.end) ||
|
751 | (period.start <= end && end <= period.end));
|
752 | }
|
753 | function shouldFireDroppedEvent(dropEvent, date, allDay, calendarId) {
|
754 | return (dropEvent.dropData &&
|
755 | dropEvent.dropData.event &&
|
756 | (dropEvent.dropData.calendarId !== calendarId ||
|
757 | (dropEvent.dropData.event.allDay && !allDay) ||
|
758 | (!dropEvent.dropData.event.allDay && allDay)));
|
759 | }
|
760 | function getWeekViewPeriod(dateAdapter, viewDate, weekStartsOn, excluded = [], daysInWeek) {
|
761 | let viewStart = daysInWeek
|
762 | ? dateAdapter.startOfDay(viewDate)
|
763 | : dateAdapter.startOfWeek(viewDate, { weekStartsOn });
|
764 | const endOfWeek = dateAdapter.endOfWeek(viewDate, { weekStartsOn });
|
765 | while (excluded.indexOf(dateAdapter.getDay(viewStart)) > -1 &&
|
766 | viewStart < endOfWeek) {
|
767 | viewStart = dateAdapter.addDays(viewStart, 1);
|
768 | }
|
769 | if (daysInWeek) {
|
770 | const viewEnd = dateAdapter.endOfDay(addDaysWithExclusions(dateAdapter, viewStart, daysInWeek - 1, excluded));
|
771 | return { viewStart, viewEnd };
|
772 | }
|
773 | else {
|
774 | let viewEnd = endOfWeek;
|
775 | while (excluded.indexOf(dateAdapter.getDay(viewEnd)) > -1 &&
|
776 | viewEnd > viewStart) {
|
777 | viewEnd = dateAdapter.subDays(viewEnd, 1);
|
778 | }
|
779 | return { viewStart, viewEnd };
|
780 | }
|
781 | }
|
782 | function isWithinThreshold({ x, y }) {
|
783 | const DRAG_THRESHOLD = 1;
|
784 | return Math.abs(x) > DRAG_THRESHOLD || Math.abs(y) > DRAG_THRESHOLD;
|
785 | }
|
786 |
|
787 | class DateAdapter {
|
788 | }
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 | class CalendarPreviousViewDirective {
|
803 | constructor(dateAdapter) {
|
804 | this.dateAdapter = dateAdapter;
|
805 | |
806 |
|
807 |
|
808 | this.excludeDays = [];
|
809 | |
810 |
|
811 |
|
812 | this.viewDateChange = new EventEmitter();
|
813 | }
|
814 | |
815 |
|
816 |
|
817 | onClick() {
|
818 | const subFn = {
|
819 | day: this.dateAdapter.subDays,
|
820 | week: this.dateAdapter.subWeeks,
|
821 | month: this.dateAdapter.subMonths,
|
822 | }[this.view];
|
823 | if (this.view === CalendarView.Day) {
|
824 | this.viewDateChange.emit(addDaysWithExclusions(this.dateAdapter, this.viewDate, -1, this.excludeDays));
|
825 | }
|
826 | else if (this.view === CalendarView.Week && this.daysInWeek) {
|
827 | this.viewDateChange.emit(addDaysWithExclusions(this.dateAdapter, this.viewDate, -this.daysInWeek, this.excludeDays));
|
828 | }
|
829 | else {
|
830 | this.viewDateChange.emit(subFn(this.viewDate, 1));
|
831 | }
|
832 | }
|
833 | }
|
834 | CalendarPreviousViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarPreviousViewDirective, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Directive });
|
835 | CalendarPreviousViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: CalendarPreviousViewDirective, selector: "[mwlCalendarPreviousView]", inputs: { view: "view", viewDate: "viewDate", excludeDays: "excludeDays", daysInWeek: "daysInWeek" }, outputs: { viewDateChange: "viewDateChange" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
836 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarPreviousViewDirective, decorators: [{
|
837 | type: Directive,
|
838 | args: [{
|
839 | selector: '[mwlCalendarPreviousView]',
|
840 | }]
|
841 | }], ctorParameters: function () { return [{ type: DateAdapter }]; }, propDecorators: { view: [{
|
842 | type: Input
|
843 | }], viewDate: [{
|
844 | type: Input
|
845 | }], excludeDays: [{
|
846 | type: Input
|
847 | }], daysInWeek: [{
|
848 | type: Input
|
849 | }], viewDateChange: [{
|
850 | type: Output
|
851 | }], onClick: [{
|
852 | type: HostListener,
|
853 | args: ['click']
|
854 | }] } });
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 | class CalendarNextViewDirective {
|
869 | constructor(dateAdapter) {
|
870 | this.dateAdapter = dateAdapter;
|
871 | |
872 |
|
873 |
|
874 | this.excludeDays = [];
|
875 | |
876 |
|
877 |
|
878 | this.viewDateChange = new EventEmitter();
|
879 | }
|
880 | |
881 |
|
882 |
|
883 | onClick() {
|
884 | const addFn = {
|
885 | day: this.dateAdapter.addDays,
|
886 | week: this.dateAdapter.addWeeks,
|
887 | month: this.dateAdapter.addMonths,
|
888 | }[this.view];
|
889 | if (this.view === CalendarView.Day) {
|
890 | this.viewDateChange.emit(addDaysWithExclusions(this.dateAdapter, this.viewDate, 1, this.excludeDays));
|
891 | }
|
892 | else if (this.view === CalendarView.Week && this.daysInWeek) {
|
893 | this.viewDateChange.emit(addDaysWithExclusions(this.dateAdapter, this.viewDate, this.daysInWeek, this.excludeDays));
|
894 | }
|
895 | else {
|
896 | this.viewDateChange.emit(addFn(this.viewDate, 1));
|
897 | }
|
898 | }
|
899 | }
|
900 | CalendarNextViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarNextViewDirective, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Directive });
|
901 | CalendarNextViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: CalendarNextViewDirective, selector: "[mwlCalendarNextView]", inputs: { view: "view", viewDate: "viewDate", excludeDays: "excludeDays", daysInWeek: "daysInWeek" }, outputs: { viewDateChange: "viewDateChange" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
902 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarNextViewDirective, decorators: [{
|
903 | type: Directive,
|
904 | args: [{
|
905 | selector: '[mwlCalendarNextView]',
|
906 | }]
|
907 | }], ctorParameters: function () { return [{ type: DateAdapter }]; }, propDecorators: { view: [{
|
908 | type: Input
|
909 | }], viewDate: [{
|
910 | type: Input
|
911 | }], excludeDays: [{
|
912 | type: Input
|
913 | }], daysInWeek: [{
|
914 | type: Input
|
915 | }], viewDateChange: [{
|
916 | type: Output
|
917 | }], onClick: [{
|
918 | type: HostListener,
|
919 | args: ['click']
|
920 | }] } });
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 | class CalendarTodayDirective {
|
934 | constructor(dateAdapter) {
|
935 | this.dateAdapter = dateAdapter;
|
936 | |
937 |
|
938 |
|
939 | this.viewDateChange = new EventEmitter();
|
940 | }
|
941 | |
942 |
|
943 |
|
944 | onClick() {
|
945 | this.viewDateChange.emit(this.dateAdapter.startOfDay(new Date()));
|
946 | }
|
947 | }
|
948 | CalendarTodayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTodayDirective, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Directive });
|
949 | CalendarTodayDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: CalendarTodayDirective, selector: "[mwlCalendarToday]", inputs: { viewDate: "viewDate" }, outputs: { viewDateChange: "viewDateChange" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
950 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarTodayDirective, decorators: [{
|
951 | type: Directive,
|
952 | args: [{
|
953 | selector: '[mwlCalendarToday]',
|
954 | }]
|
955 | }], ctorParameters: function () { return [{ type: DateAdapter }]; }, propDecorators: { viewDate: [{
|
956 | type: Input
|
957 | }], viewDateChange: [{
|
958 | type: Output
|
959 | }], onClick: [{
|
960 | type: HostListener,
|
961 | args: ['click']
|
962 | }] } });
|
963 |
|
964 |
|
965 |
|
966 |
|
967 | class CalendarAngularDateFormatter {
|
968 | constructor(dateAdapter) {
|
969 | this.dateAdapter = dateAdapter;
|
970 | }
|
971 | |
972 |
|
973 |
|
974 | monthViewColumnHeader({ date, locale }) {
|
975 | return formatDate(date, 'EEEE', locale);
|
976 | }
|
977 | |
978 |
|
979 |
|
980 | monthViewDayNumber({ date, locale }) {
|
981 | return formatDate(date, 'd', locale);
|
982 | }
|
983 | |
984 |
|
985 |
|
986 | monthViewTitle({ date, locale }) {
|
987 | return formatDate(date, 'LLLL y', locale);
|
988 | }
|
989 | |
990 |
|
991 |
|
992 | weekViewColumnHeader({ date, locale }) {
|
993 | return formatDate(date, 'EEEE', locale);
|
994 | }
|
995 | |
996 |
|
997 |
|
998 | weekViewColumnSubHeader({ date, locale, }) {
|
999 | return formatDate(date, 'MMM d', locale);
|
1000 | }
|
1001 | |
1002 |
|
1003 |
|
1004 | weekViewTitle({ date, locale, weekStartsOn, excludeDays, daysInWeek, }) {
|
1005 | const { viewStart, viewEnd } = getWeekViewPeriod(this.dateAdapter, date, weekStartsOn, excludeDays, daysInWeek);
|
1006 | const format = (dateToFormat, showYear) => formatDate(dateToFormat, 'MMM d' + (showYear ? ', yyyy' : ''), locale);
|
1007 | return `${format(viewStart, viewStart.getUTCFullYear() !== viewEnd.getUTCFullYear())} - ${format(viewEnd, true)}`;
|
1008 | }
|
1009 | |
1010 |
|
1011 |
|
1012 | weekViewHour({ date, locale }) {
|
1013 | return formatDate(date, 'h a', locale);
|
1014 | }
|
1015 | |
1016 |
|
1017 |
|
1018 | dayViewHour({ date, locale }) {
|
1019 | return formatDate(date, 'h a', locale);
|
1020 | }
|
1021 | |
1022 |
|
1023 |
|
1024 | dayViewTitle({ date, locale }) {
|
1025 | return formatDate(date, 'EEEE, MMMM d, y', locale);
|
1026 | }
|
1027 | }
|
1028 | CalendarAngularDateFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarAngularDateFormatter, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
1029 | CalendarAngularDateFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarAngularDateFormatter });
|
1030 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarAngularDateFormatter, decorators: [{
|
1031 | type: Injectable
|
1032 | }], ctorParameters: function () { return [{ type: DateAdapter }]; } });
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 | class CalendarDateFormatter extends CalendarAngularDateFormatter {
|
1061 | }
|
1062 | CalendarDateFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDateFormatter, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
1063 | CalendarDateFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDateFormatter });
|
1064 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDateFormatter, decorators: [{
|
1065 | type: Injectable
|
1066 | }] });
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 | class CalendarDatePipe {
|
1076 | constructor(dateFormatter, locale) {
|
1077 | this.dateFormatter = dateFormatter;
|
1078 | this.locale = locale;
|
1079 | }
|
1080 | transform(date, method, locale = this.locale, weekStartsOn = 0, excludeDays = [], daysInWeek) {
|
1081 | if (typeof this.dateFormatter[method] === 'undefined') {
|
1082 | const allowedMethods = Object.getOwnPropertyNames(Object.getPrototypeOf(CalendarDateFormatter.prototype)).filter((iMethod) => iMethod !== 'constructor');
|
1083 | throw new Error(`${method} is not a valid date formatter. Can only be one of ${allowedMethods.join(', ')}`);
|
1084 | }
|
1085 | return this.dateFormatter[method]({
|
1086 | date,
|
1087 | locale,
|
1088 | weekStartsOn,
|
1089 | excludeDays,
|
1090 | daysInWeek,
|
1091 | });
|
1092 | }
|
1093 | }
|
1094 | CalendarDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDatePipe, deps: [{ token: CalendarDateFormatter }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
1095 | CalendarDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarDatePipe, name: "calendarDate" });
|
1096 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDatePipe, decorators: [{
|
1097 | type: Pipe,
|
1098 | args: [{
|
1099 | name: 'calendarDate',
|
1100 | }]
|
1101 | }], ctorParameters: function () { return [{ type: CalendarDateFormatter }, { type: undefined, decorators: [{
|
1102 | type: Inject,
|
1103 | args: [LOCALE_ID]
|
1104 | }] }]; } });
|
1105 |
|
1106 | class CalendarUtils {
|
1107 | constructor(dateAdapter) {
|
1108 | this.dateAdapter = dateAdapter;
|
1109 | }
|
1110 | getMonthView(args) {
|
1111 | return getMonthView(this.dateAdapter, args);
|
1112 | }
|
1113 | getWeekViewHeader(args) {
|
1114 | return getWeekViewHeader(this.dateAdapter, args);
|
1115 | }
|
1116 | getWeekView(args) {
|
1117 | return getWeekView(this.dateAdapter, args);
|
1118 | }
|
1119 | }
|
1120 | CalendarUtils.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarUtils, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
1121 | CalendarUtils.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarUtils });
|
1122 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarUtils, decorators: [{
|
1123 | type: Injectable
|
1124 | }], ctorParameters: function () { return [{ type: DateAdapter }]; } });
|
1125 |
|
1126 | const MOMENT = new InjectionToken('Moment');
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 | class CalendarMomentDateFormatter {
|
1144 | |
1145 |
|
1146 |
|
1147 | constructor(moment, dateAdapter) {
|
1148 | this.moment = moment;
|
1149 | this.dateAdapter = dateAdapter;
|
1150 | }
|
1151 | |
1152 |
|
1153 |
|
1154 | monthViewColumnHeader({ date, locale }) {
|
1155 | return this.moment(date).locale(locale).format('dddd');
|
1156 | }
|
1157 | |
1158 |
|
1159 |
|
1160 | monthViewDayNumber({ date, locale }) {
|
1161 | return this.moment(date).locale(locale).format('D');
|
1162 | }
|
1163 | |
1164 |
|
1165 |
|
1166 | monthViewTitle({ date, locale }) {
|
1167 | return this.moment(date).locale(locale).format('MMMM YYYY');
|
1168 | }
|
1169 | |
1170 |
|
1171 |
|
1172 | weekViewColumnHeader({ date, locale }) {
|
1173 | return this.moment(date).locale(locale).format('dddd');
|
1174 | }
|
1175 | |
1176 |
|
1177 |
|
1178 | weekViewColumnSubHeader({ date, locale, }) {
|
1179 | return this.moment(date).locale(locale).format('MMM D');
|
1180 | }
|
1181 | |
1182 |
|
1183 |
|
1184 | weekViewTitle({ date, locale, weekStartsOn, excludeDays, daysInWeek, }) {
|
1185 | const { viewStart, viewEnd } = getWeekViewPeriod(this.dateAdapter, date, weekStartsOn, excludeDays, daysInWeek);
|
1186 | const format = (dateToFormat, showYear) => this.moment(dateToFormat)
|
1187 | .locale(locale)
|
1188 | .format('MMM D' + (showYear ? ', YYYY' : ''));
|
1189 | return `${format(viewStart, viewStart.getUTCFullYear() !== viewEnd.getUTCFullYear())} - ${format(viewEnd, true)}`;
|
1190 | }
|
1191 | |
1192 |
|
1193 |
|
1194 | weekViewHour({ date, locale }) {
|
1195 | return this.moment(date).locale(locale).format('ha');
|
1196 | }
|
1197 | |
1198 |
|
1199 |
|
1200 | dayViewHour({ date, locale }) {
|
1201 | return this.moment(date).locale(locale).format('ha');
|
1202 | }
|
1203 | |
1204 |
|
1205 |
|
1206 | dayViewTitle({ date, locale }) {
|
1207 | return this.moment(date).locale(locale).format('dddd, LL');
|
1208 | }
|
1209 | }
|
1210 | CalendarMomentDateFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMomentDateFormatter, deps: [{ token: MOMENT }, { token: DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
1211 | CalendarMomentDateFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMomentDateFormatter });
|
1212 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMomentDateFormatter, decorators: [{
|
1213 | type: Injectable
|
1214 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
1215 | type: Inject,
|
1216 | args: [MOMENT]
|
1217 | }] }, { type: DateAdapter }]; } });
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 | class CalendarNativeDateFormatter {
|
1225 | constructor(dateAdapter) {
|
1226 | this.dateAdapter = dateAdapter;
|
1227 | }
|
1228 | |
1229 |
|
1230 |
|
1231 | monthViewColumnHeader({ date, locale }) {
|
1232 | return new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date);
|
1233 | }
|
1234 | |
1235 |
|
1236 |
|
1237 | monthViewDayNumber({ date, locale }) {
|
1238 | return new Intl.DateTimeFormat(locale, { day: 'numeric' }).format(date);
|
1239 | }
|
1240 | |
1241 |
|
1242 |
|
1243 | monthViewTitle({ date, locale }) {
|
1244 | return new Intl.DateTimeFormat(locale, {
|
1245 | year: 'numeric',
|
1246 | month: 'long',
|
1247 | }).format(date);
|
1248 | }
|
1249 | |
1250 |
|
1251 |
|
1252 | weekViewColumnHeader({ date, locale }) {
|
1253 | return new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date);
|
1254 | }
|
1255 | |
1256 |
|
1257 |
|
1258 | weekViewColumnSubHeader({ date, locale, }) {
|
1259 | return new Intl.DateTimeFormat(locale, {
|
1260 | day: 'numeric',
|
1261 | month: 'short',
|
1262 | }).format(date);
|
1263 | }
|
1264 | |
1265 |
|
1266 |
|
1267 | weekViewTitle({ date, locale, weekStartsOn, excludeDays, daysInWeek, }) {
|
1268 | const { viewStart, viewEnd } = getWeekViewPeriod(this.dateAdapter, date, weekStartsOn, excludeDays, daysInWeek);
|
1269 | const format = (dateToFormat, showYear) => new Intl.DateTimeFormat(locale, {
|
1270 | day: 'numeric',
|
1271 | month: 'short',
|
1272 | year: showYear ? 'numeric' : undefined,
|
1273 | }).format(dateToFormat);
|
1274 | return `${format(viewStart, viewStart.getUTCFullYear() !== viewEnd.getUTCFullYear())} - ${format(viewEnd, true)}`;
|
1275 | }
|
1276 | |
1277 |
|
1278 |
|
1279 | weekViewHour({ date, locale }) {
|
1280 | return new Intl.DateTimeFormat(locale, { hour: 'numeric' }).format(date);
|
1281 | }
|
1282 | |
1283 |
|
1284 |
|
1285 | dayViewHour({ date, locale }) {
|
1286 | return new Intl.DateTimeFormat(locale, { hour: 'numeric' }).format(date);
|
1287 | }
|
1288 | |
1289 |
|
1290 |
|
1291 | dayViewTitle({ date, locale }) {
|
1292 | return new Intl.DateTimeFormat(locale, {
|
1293 | day: 'numeric',
|
1294 | month: 'long',
|
1295 | year: 'numeric',
|
1296 | weekday: 'long',
|
1297 | }).format(date);
|
1298 | }
|
1299 | }
|
1300 | CalendarNativeDateFormatter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarNativeDateFormatter, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
1301 | CalendarNativeDateFormatter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarNativeDateFormatter });
|
1302 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarNativeDateFormatter, decorators: [{
|
1303 | type: Injectable
|
1304 | }], ctorParameters: function () { return [{ type: DateAdapter }]; } });
|
1305 |
|
1306 | var CalendarEventTimesChangedEventType;
|
1307 | (function (CalendarEventTimesChangedEventType) {
|
1308 | CalendarEventTimesChangedEventType["Drag"] = "drag";
|
1309 | CalendarEventTimesChangedEventType["Drop"] = "drop";
|
1310 | CalendarEventTimesChangedEventType["Resize"] = "resize";
|
1311 | })(CalendarEventTimesChangedEventType || (CalendarEventTimesChangedEventType = {}));
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 | class CalendarCommonModule {
|
1330 | static forRoot(dateAdapter, config = {}) {
|
1331 | return {
|
1332 | ngModule: CalendarCommonModule,
|
1333 | providers: [
|
1334 | dateAdapter,
|
1335 | config.eventTitleFormatter || CalendarEventTitleFormatter,
|
1336 | config.dateFormatter || CalendarDateFormatter,
|
1337 | config.utils || CalendarUtils,
|
1338 | config.a11y || CalendarA11y,
|
1339 | ],
|
1340 | };
|
1341 | }
|
1342 | }
|
1343 | CalendarCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1344 | CalendarCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarCommonModule, declarations: [CalendarEventActionsComponent,
|
1345 | CalendarEventTitleComponent,
|
1346 | CalendarTooltipWindowComponent,
|
1347 | CalendarTooltipDirective,
|
1348 | CalendarPreviousViewDirective,
|
1349 | CalendarNextViewDirective,
|
1350 | CalendarTodayDirective,
|
1351 | CalendarDatePipe,
|
1352 | CalendarEventTitlePipe,
|
1353 | CalendarA11yPipe,
|
1354 | ClickDirective,
|
1355 | KeydownEnterDirective], imports: [CommonModule], exports: [CalendarEventActionsComponent,
|
1356 | CalendarEventTitleComponent,
|
1357 | CalendarTooltipWindowComponent,
|
1358 | CalendarTooltipDirective,
|
1359 | CalendarPreviousViewDirective,
|
1360 | CalendarNextViewDirective,
|
1361 | CalendarTodayDirective,
|
1362 | CalendarDatePipe,
|
1363 | CalendarEventTitlePipe,
|
1364 | CalendarA11yPipe,
|
1365 | ClickDirective,
|
1366 | KeydownEnterDirective] });
|
1367 | CalendarCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarCommonModule, providers: [I18nPluralPipe], imports: [CommonModule] });
|
1368 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarCommonModule, decorators: [{
|
1369 | type: NgModule,
|
1370 | args: [{
|
1371 | declarations: [
|
1372 | CalendarEventActionsComponent,
|
1373 | CalendarEventTitleComponent,
|
1374 | CalendarTooltipWindowComponent,
|
1375 | CalendarTooltipDirective,
|
1376 | CalendarPreviousViewDirective,
|
1377 | CalendarNextViewDirective,
|
1378 | CalendarTodayDirective,
|
1379 | CalendarDatePipe,
|
1380 | CalendarEventTitlePipe,
|
1381 | CalendarA11yPipe,
|
1382 | ClickDirective,
|
1383 | KeydownEnterDirective,
|
1384 | ],
|
1385 | imports: [CommonModule],
|
1386 | exports: [
|
1387 | CalendarEventActionsComponent,
|
1388 | CalendarEventTitleComponent,
|
1389 | CalendarTooltipWindowComponent,
|
1390 | CalendarTooltipDirective,
|
1391 | CalendarPreviousViewDirective,
|
1392 | CalendarNextViewDirective,
|
1393 | CalendarTodayDirective,
|
1394 | CalendarDatePipe,
|
1395 | CalendarEventTitlePipe,
|
1396 | CalendarA11yPipe,
|
1397 | ClickDirective,
|
1398 | KeydownEnterDirective,
|
1399 | ],
|
1400 | providers: [I18nPluralPipe],
|
1401 | }]
|
1402 | }] });
|
1403 |
|
1404 | class CalendarMonthCellComponent {
|
1405 | constructor() {
|
1406 | this.highlightDay = new EventEmitter();
|
1407 | this.unhighlightDay = new EventEmitter();
|
1408 | this.eventClicked = new EventEmitter();
|
1409 | this.trackByEventId = trackByEventId;
|
1410 | this.validateDrag = isWithinThreshold;
|
1411 | }
|
1412 | }
|
1413 | CalendarMonthCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1414 | CalendarMonthCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarMonthCellComponent, selector: "mwl-calendar-month-cell", inputs: { day: "day", openDay: "openDay", locale: "locale", tooltipPlacement: "tooltipPlacement", tooltipAppendToBody: "tooltipAppendToBody", customTemplate: "customTemplate", tooltipTemplate: "tooltipTemplate", tooltipDelay: "tooltipDelay" }, outputs: { highlightDay: "highlightDay", unhighlightDay: "unhighlightDay", eventClicked: "eventClicked" }, host: { properties: { "class.cal-past": "day.isPast", "class.cal-today": "day.isToday", "class.cal-future": "day.isFuture", "class.cal-weekend": "day.isWeekend", "class.cal-in-month": "day.inMonth", "class.cal-out-month": "!day.inMonth", "class.cal-has-events": "day.events.length > 0", "class.cal-open": "day === openDay", "class.cal-event-highlight": "!!day.backgroundColor" }, classAttribute: "cal-cell cal-day-cell" }, ngImport: i0, template: `
|
1415 | <ng-template
|
1416 | #defaultTemplate
|
1417 | let-day="day"
|
1418 | let-openDay="openDay"
|
1419 | let-locale="locale"
|
1420 | let-tooltipPlacement="tooltipPlacement"
|
1421 | let-highlightDay="highlightDay"
|
1422 | let-unhighlightDay="unhighlightDay"
|
1423 | let-eventClicked="eventClicked"
|
1424 | let-tooltipTemplate="tooltipTemplate"
|
1425 | let-tooltipAppendToBody="tooltipAppendToBody"
|
1426 | let-tooltipDelay="tooltipDelay"
|
1427 | let-trackByEventId="trackByEventId"
|
1428 | let-validateDrag="validateDrag"
|
1429 | >
|
1430 | <div
|
1431 | class="cal-cell-top"
|
1432 | [attr.aria-label]="
|
1433 | { day: day, locale: locale } | calendarA11y : 'monthCell'
|
1434 | "
|
1435 | >
|
1436 | <span aria-hidden="true">
|
1437 | <span class="cal-day-badge" *ngIf="day.badgeTotal > 0">{{
|
1438 | day.badgeTotal
|
1439 | }}</span>
|
1440 | <span class="cal-day-number">{{
|
1441 | day.date | calendarDate : 'monthViewDayNumber' : locale
|
1442 | }}</span>
|
1443 | </span>
|
1444 | </div>
|
1445 | <div class="cal-events" *ngIf="day.events.length > 0">
|
1446 | <div
|
1447 | class="cal-event"
|
1448 | *ngFor="let event of day.events; trackBy: trackByEventId"
|
1449 | [ngStyle]="{ backgroundColor: event.color?.primary }"
|
1450 | [ngClass]="event?.cssClass"
|
1451 | (mouseenter)="highlightDay.emit({ event: event })"
|
1452 | (mouseleave)="unhighlightDay.emit({ event: event })"
|
1453 | [mwlCalendarTooltip]="
|
1454 | event.title | calendarEventTitle : 'monthTooltip' : event
|
1455 | "
|
1456 | [tooltipPlacement]="tooltipPlacement"
|
1457 | [tooltipEvent]="event"
|
1458 | [tooltipTemplate]="tooltipTemplate"
|
1459 | [tooltipAppendToBody]="tooltipAppendToBody"
|
1460 | [tooltipDelay]="tooltipDelay"
|
1461 | mwlDraggable
|
1462 | [class.cal-draggable]="event.draggable"
|
1463 | dragActiveClass="cal-drag-active"
|
1464 | [dropData]="{ event: event, draggedFrom: day }"
|
1465 | [dragAxis]="{ x: event.draggable, y: event.draggable }"
|
1466 | [validateDrag]="validateDrag"
|
1467 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
1468 | (mwlClick)="eventClicked.emit({ event: event, sourceEvent: $event })"
|
1469 | [attr.aria-hidden]="{} | calendarA11y : 'hideMonthCellEvents'"
|
1470 | ></div>
|
1471 | </div>
|
1472 | </ng-template>
|
1473 | <ng-template
|
1474 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1475 | [ngTemplateOutletContext]="{
|
1476 | day: day,
|
1477 | openDay: openDay,
|
1478 | locale: locale,
|
1479 | tooltipPlacement: tooltipPlacement,
|
1480 | highlightDay: highlightDay,
|
1481 | unhighlightDay: unhighlightDay,
|
1482 | eventClicked: eventClicked,
|
1483 | tooltipTemplate: tooltipTemplate,
|
1484 | tooltipAppendToBody: tooltipAppendToBody,
|
1485 | tooltipDelay: tooltipDelay,
|
1486 | trackByEventId: trackByEventId,
|
1487 | validateDrag: validateDrag
|
1488 | }"
|
1489 | >
|
1490 | </ng-template>
|
1491 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.DraggableDirective, selector: "[mwlDraggable]", inputs: ["dropData", "dragAxis", "dragSnapGrid", "ghostDragEnabled", "showOriginalElementWhileDragging", "validateDrag", "dragCursor", "dragActiveClass", "ghostElementAppendTo", "ghostElementTemplate", "touchStartLongPress", "autoScroll"], outputs: ["dragPointerDown", "dragStart", "ghostElementCreated", "dragging", "dragEnd"] }, { kind: "directive", type: CalendarTooltipDirective, selector: "[mwlCalendarTooltip]", inputs: ["mwlCalendarTooltip", "tooltipPlacement", "tooltipTemplate", "tooltipEvent", "tooltipAppendToBody", "tooltipDelay"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "pipe", type: CalendarDatePipe, name: "calendarDate" }, { kind: "pipe", type: CalendarEventTitlePipe, name: "calendarEventTitle" }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
1492 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthCellComponent, decorators: [{
|
1493 | type: Component,
|
1494 | args: [{
|
1495 | selector: 'mwl-calendar-month-cell',
|
1496 | template: `
|
1497 | <ng-template
|
1498 | #defaultTemplate
|
1499 | let-day="day"
|
1500 | let-openDay="openDay"
|
1501 | let-locale="locale"
|
1502 | let-tooltipPlacement="tooltipPlacement"
|
1503 | let-highlightDay="highlightDay"
|
1504 | let-unhighlightDay="unhighlightDay"
|
1505 | let-eventClicked="eventClicked"
|
1506 | let-tooltipTemplate="tooltipTemplate"
|
1507 | let-tooltipAppendToBody="tooltipAppendToBody"
|
1508 | let-tooltipDelay="tooltipDelay"
|
1509 | let-trackByEventId="trackByEventId"
|
1510 | let-validateDrag="validateDrag"
|
1511 | >
|
1512 | <div
|
1513 | class="cal-cell-top"
|
1514 | [attr.aria-label]="
|
1515 | { day: day, locale: locale } | calendarA11y : 'monthCell'
|
1516 | "
|
1517 | >
|
1518 | <span aria-hidden="true">
|
1519 | <span class="cal-day-badge" *ngIf="day.badgeTotal > 0">{{
|
1520 | day.badgeTotal
|
1521 | }}</span>
|
1522 | <span class="cal-day-number">{{
|
1523 | day.date | calendarDate : 'monthViewDayNumber' : locale
|
1524 | }}</span>
|
1525 | </span>
|
1526 | </div>
|
1527 | <div class="cal-events" *ngIf="day.events.length > 0">
|
1528 | <div
|
1529 | class="cal-event"
|
1530 | *ngFor="let event of day.events; trackBy: trackByEventId"
|
1531 | [ngStyle]="{ backgroundColor: event.color?.primary }"
|
1532 | [ngClass]="event?.cssClass"
|
1533 | (mouseenter)="highlightDay.emit({ event: event })"
|
1534 | (mouseleave)="unhighlightDay.emit({ event: event })"
|
1535 | [mwlCalendarTooltip]="
|
1536 | event.title | calendarEventTitle : 'monthTooltip' : event
|
1537 | "
|
1538 | [tooltipPlacement]="tooltipPlacement"
|
1539 | [tooltipEvent]="event"
|
1540 | [tooltipTemplate]="tooltipTemplate"
|
1541 | [tooltipAppendToBody]="tooltipAppendToBody"
|
1542 | [tooltipDelay]="tooltipDelay"
|
1543 | mwlDraggable
|
1544 | [class.cal-draggable]="event.draggable"
|
1545 | dragActiveClass="cal-drag-active"
|
1546 | [dropData]="{ event: event, draggedFrom: day }"
|
1547 | [dragAxis]="{ x: event.draggable, y: event.draggable }"
|
1548 | [validateDrag]="validateDrag"
|
1549 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
1550 | (mwlClick)="eventClicked.emit({ event: event, sourceEvent: $event })"
|
1551 | [attr.aria-hidden]="{} | calendarA11y : 'hideMonthCellEvents'"
|
1552 | ></div>
|
1553 | </div>
|
1554 | </ng-template>
|
1555 | <ng-template
|
1556 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1557 | [ngTemplateOutletContext]="{
|
1558 | day: day,
|
1559 | openDay: openDay,
|
1560 | locale: locale,
|
1561 | tooltipPlacement: tooltipPlacement,
|
1562 | highlightDay: highlightDay,
|
1563 | unhighlightDay: unhighlightDay,
|
1564 | eventClicked: eventClicked,
|
1565 | tooltipTemplate: tooltipTemplate,
|
1566 | tooltipAppendToBody: tooltipAppendToBody,
|
1567 | tooltipDelay: tooltipDelay,
|
1568 | trackByEventId: trackByEventId,
|
1569 | validateDrag: validateDrag
|
1570 | }"
|
1571 | >
|
1572 | </ng-template>
|
1573 | `,
|
1574 |
|
1575 | host: {
|
1576 | class: 'cal-cell cal-day-cell',
|
1577 | '[class.cal-past]': 'day.isPast',
|
1578 | '[class.cal-today]': 'day.isToday',
|
1579 | '[class.cal-future]': 'day.isFuture',
|
1580 | '[class.cal-weekend]': 'day.isWeekend',
|
1581 | '[class.cal-in-month]': 'day.inMonth',
|
1582 | '[class.cal-out-month]': '!day.inMonth',
|
1583 | '[class.cal-has-events]': 'day.events.length > 0',
|
1584 | '[class.cal-open]': 'day === openDay',
|
1585 | '[class.cal-event-highlight]': '!!day.backgroundColor',
|
1586 | },
|
1587 | }]
|
1588 | }], propDecorators: { day: [{
|
1589 | type: Input
|
1590 | }], openDay: [{
|
1591 | type: Input
|
1592 | }], locale: [{
|
1593 | type: Input
|
1594 | }], tooltipPlacement: [{
|
1595 | type: Input
|
1596 | }], tooltipAppendToBody: [{
|
1597 | type: Input
|
1598 | }], customTemplate: [{
|
1599 | type: Input
|
1600 | }], tooltipTemplate: [{
|
1601 | type: Input
|
1602 | }], tooltipDelay: [{
|
1603 | type: Input
|
1604 | }], highlightDay: [{
|
1605 | type: Output
|
1606 | }], unhighlightDay: [{
|
1607 | type: Output
|
1608 | }], eventClicked: [{
|
1609 | type: Output
|
1610 | }] } });
|
1611 |
|
1612 | const collapseAnimation = trigger('collapse', [
|
1613 | state('void', style({
|
1614 | height: 0,
|
1615 | overflow: 'hidden',
|
1616 | 'padding-top': 0,
|
1617 | 'padding-bottom': 0,
|
1618 | })),
|
1619 | state('*', style({
|
1620 | height: '*',
|
1621 | overflow: 'hidden',
|
1622 | 'padding-top': '*',
|
1623 | 'padding-bottom': '*',
|
1624 | })),
|
1625 | transition('* => void', animate('150ms ease-out')),
|
1626 | transition('void => *', animate('150ms ease-in')),
|
1627 | ]);
|
1628 | class CalendarOpenDayEventsComponent {
|
1629 | constructor() {
|
1630 | this.isOpen = false;
|
1631 | this.eventClicked = new EventEmitter();
|
1632 | this.trackByEventId = trackByEventId;
|
1633 | this.validateDrag = isWithinThreshold;
|
1634 | }
|
1635 | }
|
1636 | CalendarOpenDayEventsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarOpenDayEventsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1637 | CalendarOpenDayEventsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarOpenDayEventsComponent, selector: "mwl-calendar-open-day-events", inputs: { locale: "locale", isOpen: "isOpen", events: "events", customTemplate: "customTemplate", eventTitleTemplate: "eventTitleTemplate", eventActionsTemplate: "eventActionsTemplate", date: "date" }, outputs: { eventClicked: "eventClicked" }, ngImport: i0, template: `
|
1638 | <ng-template
|
1639 | #defaultTemplate
|
1640 | let-events="events"
|
1641 | let-eventClicked="eventClicked"
|
1642 | let-isOpen="isOpen"
|
1643 | let-trackByEventId="trackByEventId"
|
1644 | let-validateDrag="validateDrag"
|
1645 | >
|
1646 | <div
|
1647 | class="cal-open-day-events"
|
1648 | [@collapse]
|
1649 | *ngIf="isOpen"
|
1650 | role="application"
|
1651 | >
|
1652 | <span
|
1653 | tabindex="-1"
|
1654 | role="alert"
|
1655 | [attr.aria-label]="
|
1656 | { date: date, locale: locale } | calendarA11y : 'openDayEventsAlert'
|
1657 | "
|
1658 | ></span>
|
1659 | <span
|
1660 | tabindex="0"
|
1661 | role="landmark"
|
1662 | [attr.aria-label]="
|
1663 | { date: date, locale: locale }
|
1664 | | calendarA11y : 'openDayEventsLandmark'
|
1665 | "
|
1666 | ></span>
|
1667 | <div
|
1668 | *ngFor="let event of events; trackBy: trackByEventId"
|
1669 | [ngClass]="event?.cssClass"
|
1670 | mwlDraggable
|
1671 | [class.cal-draggable]="event.draggable"
|
1672 | dragActiveClass="cal-drag-active"
|
1673 | [dropData]="{ event: event }"
|
1674 | [dragAxis]="{ x: event.draggable, y: event.draggable }"
|
1675 | [validateDrag]="validateDrag"
|
1676 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
1677 | >
|
1678 | <span
|
1679 | class="cal-event"
|
1680 | [ngStyle]="{ backgroundColor: event.color?.primary }"
|
1681 | >
|
1682 | </span>
|
1683 | &ngsp;
|
1684 | <mwl-calendar-event-title
|
1685 | [event]="event"
|
1686 | [customTemplate]="eventTitleTemplate"
|
1687 | view="month"
|
1688 | (mwlClick)="
|
1689 | eventClicked.emit({ event: event, sourceEvent: $event })
|
1690 | "
|
1691 | (mwlKeydownEnter)="
|
1692 | eventClicked.emit({ event: event, sourceEvent: $event })
|
1693 | "
|
1694 | tabindex="0"
|
1695 | [attr.aria-label]="
|
1696 | { event: event, locale: locale }
|
1697 | | calendarA11y : 'eventDescription'
|
1698 | "
|
1699 | >
|
1700 | </mwl-calendar-event-title>
|
1701 | &ngsp;
|
1702 | <mwl-calendar-event-actions
|
1703 | [event]="event"
|
1704 | [customTemplate]="eventActionsTemplate"
|
1705 | >
|
1706 | </mwl-calendar-event-actions>
|
1707 | </div>
|
1708 | </div>
|
1709 | </ng-template>
|
1710 | <ng-template
|
1711 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1712 | [ngTemplateOutletContext]="{
|
1713 | events: events,
|
1714 | eventClicked: eventClicked,
|
1715 | isOpen: isOpen,
|
1716 | trackByEventId: trackByEventId,
|
1717 | validateDrag: validateDrag
|
1718 | }"
|
1719 | >
|
1720 | </ng-template>
|
1721 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.DraggableDirective, selector: "[mwlDraggable]", inputs: ["dropData", "dragAxis", "dragSnapGrid", "ghostDragEnabled", "showOriginalElementWhileDragging", "validateDrag", "dragCursor", "dragActiveClass", "ghostElementAppendTo", "ghostElementTemplate", "touchStartLongPress", "autoScroll"], outputs: ["dragPointerDown", "dragStart", "ghostElementCreated", "dragging", "dragEnd"] }, { kind: "component", type: CalendarEventActionsComponent, selector: "mwl-calendar-event-actions", inputs: ["event", "customTemplate"] }, { kind: "component", type: CalendarEventTitleComponent, selector: "mwl-calendar-event-title", inputs: ["event", "customTemplate", "view"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "directive", type: KeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: ["mwlKeydownEnter"] }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }], animations: [collapseAnimation] });
|
1722 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarOpenDayEventsComponent, decorators: [{
|
1723 | type: Component,
|
1724 | args: [{
|
1725 | selector: 'mwl-calendar-open-day-events',
|
1726 | template: `
|
1727 | <ng-template
|
1728 | #defaultTemplate
|
1729 | let-events="events"
|
1730 | let-eventClicked="eventClicked"
|
1731 | let-isOpen="isOpen"
|
1732 | let-trackByEventId="trackByEventId"
|
1733 | let-validateDrag="validateDrag"
|
1734 | >
|
1735 | <div
|
1736 | class="cal-open-day-events"
|
1737 | [@collapse]
|
1738 | *ngIf="isOpen"
|
1739 | role="application"
|
1740 | >
|
1741 | <span
|
1742 | tabindex="-1"
|
1743 | role="alert"
|
1744 | [attr.aria-label]="
|
1745 | { date: date, locale: locale } | calendarA11y : 'openDayEventsAlert'
|
1746 | "
|
1747 | ></span>
|
1748 | <span
|
1749 | tabindex="0"
|
1750 | role="landmark"
|
1751 | [attr.aria-label]="
|
1752 | { date: date, locale: locale }
|
1753 | | calendarA11y : 'openDayEventsLandmark'
|
1754 | "
|
1755 | ></span>
|
1756 | <div
|
1757 | *ngFor="let event of events; trackBy: trackByEventId"
|
1758 | [ngClass]="event?.cssClass"
|
1759 | mwlDraggable
|
1760 | [class.cal-draggable]="event.draggable"
|
1761 | dragActiveClass="cal-drag-active"
|
1762 | [dropData]="{ event: event }"
|
1763 | [dragAxis]="{ x: event.draggable, y: event.draggable }"
|
1764 | [validateDrag]="validateDrag"
|
1765 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
1766 | >
|
1767 | <span
|
1768 | class="cal-event"
|
1769 | [ngStyle]="{ backgroundColor: event.color?.primary }"
|
1770 | >
|
1771 | </span>
|
1772 | &ngsp;
|
1773 | <mwl-calendar-event-title
|
1774 | [event]="event"
|
1775 | [customTemplate]="eventTitleTemplate"
|
1776 | view="month"
|
1777 | (mwlClick)="
|
1778 | eventClicked.emit({ event: event, sourceEvent: $event })
|
1779 | "
|
1780 | (mwlKeydownEnter)="
|
1781 | eventClicked.emit({ event: event, sourceEvent: $event })
|
1782 | "
|
1783 | tabindex="0"
|
1784 | [attr.aria-label]="
|
1785 | { event: event, locale: locale }
|
1786 | | calendarA11y : 'eventDescription'
|
1787 | "
|
1788 | >
|
1789 | </mwl-calendar-event-title>
|
1790 | &ngsp;
|
1791 | <mwl-calendar-event-actions
|
1792 | [event]="event"
|
1793 | [customTemplate]="eventActionsTemplate"
|
1794 | >
|
1795 | </mwl-calendar-event-actions>
|
1796 | </div>
|
1797 | </div>
|
1798 | </ng-template>
|
1799 | <ng-template
|
1800 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1801 | [ngTemplateOutletContext]="{
|
1802 | events: events,
|
1803 | eventClicked: eventClicked,
|
1804 | isOpen: isOpen,
|
1805 | trackByEventId: trackByEventId,
|
1806 | validateDrag: validateDrag
|
1807 | }"
|
1808 | >
|
1809 | </ng-template>
|
1810 | `,
|
1811 | animations: [collapseAnimation],
|
1812 | }]
|
1813 | }], propDecorators: { locale: [{
|
1814 | type: Input
|
1815 | }], isOpen: [{
|
1816 | type: Input
|
1817 | }], events: [{
|
1818 | type: Input
|
1819 | }], customTemplate: [{
|
1820 | type: Input
|
1821 | }], eventTitleTemplate: [{
|
1822 | type: Input
|
1823 | }], eventActionsTemplate: [{
|
1824 | type: Input
|
1825 | }], date: [{
|
1826 | type: Input
|
1827 | }], eventClicked: [{
|
1828 | type: Output
|
1829 | }] } });
|
1830 |
|
1831 | class CalendarMonthViewHeaderComponent {
|
1832 | constructor() {
|
1833 | this.columnHeaderClicked = new EventEmitter();
|
1834 | this.trackByWeekDayHeaderDate = trackByWeekDayHeaderDate;
|
1835 | }
|
1836 | }
|
1837 | CalendarMonthViewHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthViewHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1838 | CalendarMonthViewHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarMonthViewHeaderComponent, selector: "mwl-calendar-month-view-header", inputs: { days: "days", locale: "locale", customTemplate: "customTemplate" }, outputs: { columnHeaderClicked: "columnHeaderClicked" }, ngImport: i0, template: `
|
1839 | <ng-template
|
1840 | #defaultTemplate
|
1841 | let-days="days"
|
1842 | let-locale="locale"
|
1843 | let-trackByWeekDayHeaderDate="trackByWeekDayHeaderDate"
|
1844 | >
|
1845 | <div class="cal-cell-row cal-header" role="row">
|
1846 | <div
|
1847 | class="cal-cell"
|
1848 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
1849 | [class.cal-past]="day.isPast"
|
1850 | [class.cal-today]="day.isToday"
|
1851 | [class.cal-future]="day.isFuture"
|
1852 | [class.cal-weekend]="day.isWeekend"
|
1853 | (click)="
|
1854 | columnHeaderClicked.emit({
|
1855 | isoDayNumber: day.day,
|
1856 | sourceEvent: $event
|
1857 | })
|
1858 | "
|
1859 | [ngClass]="day.cssClass"
|
1860 | tabindex="0"
|
1861 | role="columnheader"
|
1862 | >
|
1863 | {{ day.date | calendarDate : 'monthViewColumnHeader' : locale }}
|
1864 | </div>
|
1865 | </div>
|
1866 | </ng-template>
|
1867 | <ng-template
|
1868 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1869 | [ngTemplateOutletContext]="{
|
1870 | days: days,
|
1871 | locale: locale,
|
1872 | trackByWeekDayHeaderDate: trackByWeekDayHeaderDate
|
1873 | }"
|
1874 | >
|
1875 | </ng-template>
|
1876 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: CalendarDatePipe, name: "calendarDate" }] });
|
1877 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthViewHeaderComponent, decorators: [{
|
1878 | type: Component,
|
1879 | args: [{
|
1880 | selector: 'mwl-calendar-month-view-header',
|
1881 | template: `
|
1882 | <ng-template
|
1883 | #defaultTemplate
|
1884 | let-days="days"
|
1885 | let-locale="locale"
|
1886 | let-trackByWeekDayHeaderDate="trackByWeekDayHeaderDate"
|
1887 | >
|
1888 | <div class="cal-cell-row cal-header" role="row">
|
1889 | <div
|
1890 | class="cal-cell"
|
1891 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
1892 | [class.cal-past]="day.isPast"
|
1893 | [class.cal-today]="day.isToday"
|
1894 | [class.cal-future]="day.isFuture"
|
1895 | [class.cal-weekend]="day.isWeekend"
|
1896 | (click)="
|
1897 | columnHeaderClicked.emit({
|
1898 | isoDayNumber: day.day,
|
1899 | sourceEvent: $event
|
1900 | })
|
1901 | "
|
1902 | [ngClass]="day.cssClass"
|
1903 | tabindex="0"
|
1904 | role="columnheader"
|
1905 | >
|
1906 | {{ day.date | calendarDate : 'monthViewColumnHeader' : locale }}
|
1907 | </div>
|
1908 | </div>
|
1909 | </ng-template>
|
1910 | <ng-template
|
1911 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
1912 | [ngTemplateOutletContext]="{
|
1913 | days: days,
|
1914 | locale: locale,
|
1915 | trackByWeekDayHeaderDate: trackByWeekDayHeaderDate
|
1916 | }"
|
1917 | >
|
1918 | </ng-template>
|
1919 | `,
|
1920 | }]
|
1921 | }], propDecorators: { days: [{
|
1922 | type: Input
|
1923 | }], locale: [{
|
1924 | type: Input
|
1925 | }], customTemplate: [{
|
1926 | type: Input
|
1927 | }], columnHeaderClicked: [{
|
1928 | type: Output
|
1929 | }] } });
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 | class CalendarMonthViewComponent {
|
1942 | |
1943 |
|
1944 |
|
1945 | constructor(cdr, utils, locale, dateAdapter) {
|
1946 | this.cdr = cdr;
|
1947 | this.utils = utils;
|
1948 | this.dateAdapter = dateAdapter;
|
1949 | |
1950 |
|
1951 |
|
1952 |
|
1953 | this.events = [];
|
1954 | |
1955 |
|
1956 |
|
1957 | this.excludeDays = [];
|
1958 | |
1959 |
|
1960 |
|
1961 | this.activeDayIsOpen = false;
|
1962 | |
1963 |
|
1964 |
|
1965 | this.tooltipPlacement = 'auto';
|
1966 | |
1967 |
|
1968 |
|
1969 | this.tooltipAppendToBody = true;
|
1970 | |
1971 |
|
1972 |
|
1973 |
|
1974 | this.tooltipDelay = null;
|
1975 | |
1976 |
|
1977 |
|
1978 |
|
1979 | this.beforeViewRender = new EventEmitter();
|
1980 | |
1981 |
|
1982 |
|
1983 | this.dayClicked = new EventEmitter();
|
1984 | |
1985 |
|
1986 |
|
1987 | this.eventClicked = new EventEmitter();
|
1988 | |
1989 |
|
1990 |
|
1991 | this.columnHeaderClicked = new EventEmitter();
|
1992 | |
1993 |
|
1994 |
|
1995 | this.eventTimesChanged = new EventEmitter();
|
1996 | |
1997 |
|
1998 |
|
1999 | this.trackByRowOffset = (index, offset) => this.view.days
|
2000 | .slice(offset, this.view.totalDaysVisibleInWeek)
|
2001 | .map((day) => day.date.toISOString())
|
2002 | .join('-');
|
2003 | |
2004 |
|
2005 |
|
2006 | this.trackByDate = (index, day) => day.date.toISOString();
|
2007 | this.locale = locale;
|
2008 | }
|
2009 | |
2010 |
|
2011 |
|
2012 | ngOnInit() {
|
2013 | if (this.refresh) {
|
2014 | this.refreshSubscription = this.refresh.subscribe(() => {
|
2015 | this.refreshAll();
|
2016 | this.cdr.markForCheck();
|
2017 | });
|
2018 | }
|
2019 | }
|
2020 | |
2021 |
|
2022 |
|
2023 | ngOnChanges(changes) {
|
2024 | const refreshHeader = changes.viewDate || changes.excludeDays || changes.weekendDays;
|
2025 | const refreshBody = changes.viewDate ||
|
2026 | changes.events ||
|
2027 | changes.excludeDays ||
|
2028 | changes.weekendDays;
|
2029 | if (refreshHeader) {
|
2030 | this.refreshHeader();
|
2031 | }
|
2032 | if (changes.events) {
|
2033 | validateEvents(this.events);
|
2034 | }
|
2035 | if (refreshBody) {
|
2036 | this.refreshBody();
|
2037 | }
|
2038 | if (refreshHeader || refreshBody) {
|
2039 | this.emitBeforeViewRender();
|
2040 | }
|
2041 | if (changes.activeDayIsOpen ||
|
2042 | changes.viewDate ||
|
2043 | changes.events ||
|
2044 | changes.excludeDays ||
|
2045 | changes.activeDay) {
|
2046 | this.checkActiveDayIsOpen();
|
2047 | }
|
2048 | }
|
2049 | |
2050 |
|
2051 |
|
2052 | ngOnDestroy() {
|
2053 | if (this.refreshSubscription) {
|
2054 | this.refreshSubscription.unsubscribe();
|
2055 | }
|
2056 | }
|
2057 | |
2058 |
|
2059 |
|
2060 | toggleDayHighlight(event, isHighlighted) {
|
2061 | this.view.days.forEach((day) => {
|
2062 | if (isHighlighted && day.events.indexOf(event) > -1) {
|
2063 | day.backgroundColor =
|
2064 | (event.color && event.color.secondary) || '#D1E8FF';
|
2065 | }
|
2066 | else {
|
2067 | delete day.backgroundColor;
|
2068 | }
|
2069 | });
|
2070 | }
|
2071 | |
2072 |
|
2073 |
|
2074 | eventDropped(droppedOn, event, draggedFrom) {
|
2075 | if (droppedOn !== draggedFrom) {
|
2076 | const year = this.dateAdapter.getYear(droppedOn.date);
|
2077 | const month = this.dateAdapter.getMonth(droppedOn.date);
|
2078 | const date = this.dateAdapter.getDate(droppedOn.date);
|
2079 | const newStart = this.dateAdapter.setDate(this.dateAdapter.setMonth(this.dateAdapter.setYear(event.start, year), month), date);
|
2080 | let newEnd;
|
2081 | if (event.end) {
|
2082 | const secondsDiff = this.dateAdapter.differenceInSeconds(newStart, event.start);
|
2083 | newEnd = this.dateAdapter.addSeconds(event.end, secondsDiff);
|
2084 | }
|
2085 | this.eventTimesChanged.emit({
|
2086 | event,
|
2087 | newStart,
|
2088 | newEnd,
|
2089 | day: droppedOn,
|
2090 | type: CalendarEventTimesChangedEventType.Drop,
|
2091 | });
|
2092 | }
|
2093 | }
|
2094 | refreshHeader() {
|
2095 | this.columnHeaders = this.utils.getWeekViewHeader({
|
2096 | viewDate: this.viewDate,
|
2097 | weekStartsOn: this.weekStartsOn,
|
2098 | excluded: this.excludeDays,
|
2099 | weekendDays: this.weekendDays,
|
2100 | });
|
2101 | }
|
2102 | refreshBody() {
|
2103 | this.view = this.utils.getMonthView({
|
2104 | events: this.events,
|
2105 | viewDate: this.viewDate,
|
2106 | weekStartsOn: this.weekStartsOn,
|
2107 | excluded: this.excludeDays,
|
2108 | weekendDays: this.weekendDays,
|
2109 | });
|
2110 | }
|
2111 | checkActiveDayIsOpen() {
|
2112 | if (this.activeDayIsOpen === true) {
|
2113 | const activeDay = this.activeDay || this.viewDate;
|
2114 | this.openDay = this.view.days.find((day) => this.dateAdapter.isSameDay(day.date, activeDay));
|
2115 | const index = this.view.days.indexOf(this.openDay);
|
2116 | this.openRowIndex =
|
2117 | Math.floor(index / this.view.totalDaysVisibleInWeek) *
|
2118 | this.view.totalDaysVisibleInWeek;
|
2119 | }
|
2120 | else {
|
2121 | this.openRowIndex = null;
|
2122 | this.openDay = null;
|
2123 | }
|
2124 | }
|
2125 | refreshAll() {
|
2126 | this.refreshHeader();
|
2127 | this.refreshBody();
|
2128 | this.emitBeforeViewRender();
|
2129 | this.checkActiveDayIsOpen();
|
2130 | }
|
2131 | emitBeforeViewRender() {
|
2132 | if (this.columnHeaders && this.view) {
|
2133 | this.beforeViewRender.emit({
|
2134 | header: this.columnHeaders,
|
2135 | body: this.view.days,
|
2136 | period: this.view.period,
|
2137 | });
|
2138 | }
|
2139 | }
|
2140 | }
|
2141 | CalendarMonthViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: CalendarUtils }, { token: LOCALE_ID }, { token: DateAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
2142 | CalendarMonthViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarMonthViewComponent, selector: "mwl-calendar-month-view", inputs: { viewDate: "viewDate", events: "events", excludeDays: "excludeDays", activeDayIsOpen: "activeDayIsOpen", activeDay: "activeDay", refresh: "refresh", locale: "locale", tooltipPlacement: "tooltipPlacement", tooltipTemplate: "tooltipTemplate", tooltipAppendToBody: "tooltipAppendToBody", tooltipDelay: "tooltipDelay", weekStartsOn: "weekStartsOn", headerTemplate: "headerTemplate", cellTemplate: "cellTemplate", openDayEventsTemplate: "openDayEventsTemplate", eventTitleTemplate: "eventTitleTemplate", eventActionsTemplate: "eventActionsTemplate", weekendDays: "weekendDays" }, outputs: { beforeViewRender: "beforeViewRender", dayClicked: "dayClicked", eventClicked: "eventClicked", columnHeaderClicked: "columnHeaderClicked", eventTimesChanged: "eventTimesChanged" }, usesOnChanges: true, ngImport: i0, template: `
|
2143 | <div class="cal-month-view" role="grid">
|
2144 | <mwl-calendar-month-view-header
|
2145 | [days]="columnHeaders"
|
2146 | [locale]="locale"
|
2147 | (columnHeaderClicked)="columnHeaderClicked.emit($event)"
|
2148 | [customTemplate]="headerTemplate"
|
2149 | >
|
2150 | </mwl-calendar-month-view-header>
|
2151 | <div class="cal-days">
|
2152 | <div
|
2153 | *ngFor="let rowIndex of view.rowOffsets; trackBy: trackByRowOffset"
|
2154 | >
|
2155 | <div role="row" class="cal-cell-row">
|
2156 | <mwl-calendar-month-cell
|
2157 | role="gridcell"
|
2158 | *ngFor="
|
2159 | let day of view.days
|
2160 | | slice : rowIndex : rowIndex + view.totalDaysVisibleInWeek;
|
2161 | trackBy: trackByDate
|
2162 | "
|
2163 | [ngClass]="day?.cssClass"
|
2164 | [day]="day"
|
2165 | [openDay]="openDay"
|
2166 | [locale]="locale"
|
2167 | [tooltipPlacement]="tooltipPlacement"
|
2168 | [tooltipAppendToBody]="tooltipAppendToBody"
|
2169 | [tooltipTemplate]="tooltipTemplate"
|
2170 | [tooltipDelay]="tooltipDelay"
|
2171 | [customTemplate]="cellTemplate"
|
2172 | [ngStyle]="{ backgroundColor: day.backgroundColor }"
|
2173 | (mwlClick)="dayClicked.emit({ day: day, sourceEvent: $event })"
|
2174 | [clickListenerDisabled]="dayClicked.observers.length === 0"
|
2175 | (mwlKeydownEnter)="
|
2176 | dayClicked.emit({ day: day, sourceEvent: $event })
|
2177 | "
|
2178 | (highlightDay)="toggleDayHighlight($event.event, true)"
|
2179 | (unhighlightDay)="toggleDayHighlight($event.event, false)"
|
2180 | mwlDroppable
|
2181 | dragOverClass="cal-drag-over"
|
2182 | (drop)="
|
2183 | eventDropped(
|
2184 | day,
|
2185 | $event.dropData.event,
|
2186 | $event.dropData.draggedFrom
|
2187 | )
|
2188 | "
|
2189 | (eventClicked)="
|
2190 | eventClicked.emit({
|
2191 | event: $event.event,
|
2192 | sourceEvent: $event.sourceEvent
|
2193 | })
|
2194 | "
|
2195 | [attr.tabindex]="{} | calendarA11y : 'monthCellTabIndex'"
|
2196 | >
|
2197 | </mwl-calendar-month-cell>
|
2198 | </div>
|
2199 | <mwl-calendar-open-day-events
|
2200 | [locale]="locale"
|
2201 | [isOpen]="openRowIndex === rowIndex"
|
2202 | [events]="openDay?.events"
|
2203 | [date]="openDay?.date"
|
2204 | [customTemplate]="openDayEventsTemplate"
|
2205 | [eventTitleTemplate]="eventTitleTemplate"
|
2206 | [eventActionsTemplate]="eventActionsTemplate"
|
2207 | (eventClicked)="
|
2208 | eventClicked.emit({
|
2209 | event: $event.event,
|
2210 | sourceEvent: $event.sourceEvent
|
2211 | })
|
2212 | "
|
2213 | mwlDroppable
|
2214 | dragOverClass="cal-drag-over"
|
2215 | (drop)="
|
2216 | eventDropped(
|
2217 | openDay,
|
2218 | $event.dropData.event,
|
2219 | $event.dropData.draggedFrom
|
2220 | )
|
2221 | "
|
2222 | >
|
2223 | </mwl-calendar-open-day-events>
|
2224 | </div>
|
2225 | </div>
|
2226 | </div>
|
2227 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.DroppableDirective, selector: "[mwlDroppable]", inputs: ["dragOverClass", "dragActiveClass", "validateDrop"], outputs: ["dragEnter", "dragLeave", "dragOver", "drop"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "directive", type: KeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: ["mwlKeydownEnter"] }, { kind: "component", type: CalendarMonthCellComponent, selector: "mwl-calendar-month-cell", inputs: ["day", "openDay", "locale", "tooltipPlacement", "tooltipAppendToBody", "customTemplate", "tooltipTemplate", "tooltipDelay"], outputs: ["highlightDay", "unhighlightDay", "eventClicked"] }, { kind: "component", type: CalendarOpenDayEventsComponent, selector: "mwl-calendar-open-day-events", inputs: ["locale", "isOpen", "events", "customTemplate", "eventTitleTemplate", "eventActionsTemplate", "date"], outputs: ["eventClicked"] }, { kind: "component", type: CalendarMonthViewHeaderComponent, selector: "mwl-calendar-month-view-header", inputs: ["days", "locale", "customTemplate"], outputs: ["columnHeaderClicked"] }, { kind: "pipe", type: i1.SlicePipe, name: "slice" }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
2228 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthViewComponent, decorators: [{
|
2229 | type: Component,
|
2230 | args: [{
|
2231 | selector: 'mwl-calendar-month-view',
|
2232 | template: `
|
2233 | <div class="cal-month-view" role="grid">
|
2234 | <mwl-calendar-month-view-header
|
2235 | [days]="columnHeaders"
|
2236 | [locale]="locale"
|
2237 | (columnHeaderClicked)="columnHeaderClicked.emit($event)"
|
2238 | [customTemplate]="headerTemplate"
|
2239 | >
|
2240 | </mwl-calendar-month-view-header>
|
2241 | <div class="cal-days">
|
2242 | <div
|
2243 | *ngFor="let rowIndex of view.rowOffsets; trackBy: trackByRowOffset"
|
2244 | >
|
2245 | <div role="row" class="cal-cell-row">
|
2246 | <mwl-calendar-month-cell
|
2247 | role="gridcell"
|
2248 | *ngFor="
|
2249 | let day of view.days
|
2250 | | slice : rowIndex : rowIndex + view.totalDaysVisibleInWeek;
|
2251 | trackBy: trackByDate
|
2252 | "
|
2253 | [ngClass]="day?.cssClass"
|
2254 | [day]="day"
|
2255 | [openDay]="openDay"
|
2256 | [locale]="locale"
|
2257 | [tooltipPlacement]="tooltipPlacement"
|
2258 | [tooltipAppendToBody]="tooltipAppendToBody"
|
2259 | [tooltipTemplate]="tooltipTemplate"
|
2260 | [tooltipDelay]="tooltipDelay"
|
2261 | [customTemplate]="cellTemplate"
|
2262 | [ngStyle]="{ backgroundColor: day.backgroundColor }"
|
2263 | (mwlClick)="dayClicked.emit({ day: day, sourceEvent: $event })"
|
2264 | [clickListenerDisabled]="dayClicked.observers.length === 0"
|
2265 | (mwlKeydownEnter)="
|
2266 | dayClicked.emit({ day: day, sourceEvent: $event })
|
2267 | "
|
2268 | (highlightDay)="toggleDayHighlight($event.event, true)"
|
2269 | (unhighlightDay)="toggleDayHighlight($event.event, false)"
|
2270 | mwlDroppable
|
2271 | dragOverClass="cal-drag-over"
|
2272 | (drop)="
|
2273 | eventDropped(
|
2274 | day,
|
2275 | $event.dropData.event,
|
2276 | $event.dropData.draggedFrom
|
2277 | )
|
2278 | "
|
2279 | (eventClicked)="
|
2280 | eventClicked.emit({
|
2281 | event: $event.event,
|
2282 | sourceEvent: $event.sourceEvent
|
2283 | })
|
2284 | "
|
2285 | [attr.tabindex]="{} | calendarA11y : 'monthCellTabIndex'"
|
2286 | >
|
2287 | </mwl-calendar-month-cell>
|
2288 | </div>
|
2289 | <mwl-calendar-open-day-events
|
2290 | [locale]="locale"
|
2291 | [isOpen]="openRowIndex === rowIndex"
|
2292 | [events]="openDay?.events"
|
2293 | [date]="openDay?.date"
|
2294 | [customTemplate]="openDayEventsTemplate"
|
2295 | [eventTitleTemplate]="eventTitleTemplate"
|
2296 | [eventActionsTemplate]="eventActionsTemplate"
|
2297 | (eventClicked)="
|
2298 | eventClicked.emit({
|
2299 | event: $event.event,
|
2300 | sourceEvent: $event.sourceEvent
|
2301 | })
|
2302 | "
|
2303 | mwlDroppable
|
2304 | dragOverClass="cal-drag-over"
|
2305 | (drop)="
|
2306 | eventDropped(
|
2307 | openDay,
|
2308 | $event.dropData.event,
|
2309 | $event.dropData.draggedFrom
|
2310 | )
|
2311 | "
|
2312 | >
|
2313 | </mwl-calendar-open-day-events>
|
2314 | </div>
|
2315 | </div>
|
2316 | </div>
|
2317 | `,
|
2318 | }]
|
2319 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: CalendarUtils }, { type: undefined, decorators: [{
|
2320 | type: Inject,
|
2321 | args: [LOCALE_ID]
|
2322 | }] }, { type: DateAdapter }]; }, propDecorators: { viewDate: [{
|
2323 | type: Input
|
2324 | }], events: [{
|
2325 | type: Input
|
2326 | }], excludeDays: [{
|
2327 | type: Input
|
2328 | }], activeDayIsOpen: [{
|
2329 | type: Input
|
2330 | }], activeDay: [{
|
2331 | type: Input
|
2332 | }], refresh: [{
|
2333 | type: Input
|
2334 | }], locale: [{
|
2335 | type: Input
|
2336 | }], tooltipPlacement: [{
|
2337 | type: Input
|
2338 | }], tooltipTemplate: [{
|
2339 | type: Input
|
2340 | }], tooltipAppendToBody: [{
|
2341 | type: Input
|
2342 | }], tooltipDelay: [{
|
2343 | type: Input
|
2344 | }], weekStartsOn: [{
|
2345 | type: Input
|
2346 | }], headerTemplate: [{
|
2347 | type: Input
|
2348 | }], cellTemplate: [{
|
2349 | type: Input
|
2350 | }], openDayEventsTemplate: [{
|
2351 | type: Input
|
2352 | }], eventTitleTemplate: [{
|
2353 | type: Input
|
2354 | }], eventActionsTemplate: [{
|
2355 | type: Input
|
2356 | }], weekendDays: [{
|
2357 | type: Input
|
2358 | }], beforeViewRender: [{
|
2359 | type: Output
|
2360 | }], dayClicked: [{
|
2361 | type: Output
|
2362 | }], eventClicked: [{
|
2363 | type: Output
|
2364 | }], columnHeaderClicked: [{
|
2365 | type: Output
|
2366 | }], eventTimesChanged: [{
|
2367 | type: Output
|
2368 | }] } });
|
2369 |
|
2370 | class CalendarMonthModule {
|
2371 | }
|
2372 | CalendarMonthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2373 | CalendarMonthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthModule, declarations: [CalendarMonthViewComponent,
|
2374 | CalendarMonthCellComponent,
|
2375 | CalendarOpenDayEventsComponent,
|
2376 | CalendarMonthViewHeaderComponent], imports: [CommonModule, DragAndDropModule, CalendarCommonModule], exports: [DragAndDropModule,
|
2377 | CalendarMonthViewComponent,
|
2378 | CalendarMonthCellComponent,
|
2379 | CalendarOpenDayEventsComponent,
|
2380 | CalendarMonthViewHeaderComponent] });
|
2381 | CalendarMonthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthModule, imports: [CommonModule, DragAndDropModule, CalendarCommonModule, DragAndDropModule] });
|
2382 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarMonthModule, decorators: [{
|
2383 | type: NgModule,
|
2384 | args: [{
|
2385 | imports: [CommonModule, DragAndDropModule, CalendarCommonModule],
|
2386 | declarations: [
|
2387 | CalendarMonthViewComponent,
|
2388 | CalendarMonthCellComponent,
|
2389 | CalendarOpenDayEventsComponent,
|
2390 | CalendarMonthViewHeaderComponent,
|
2391 | ],
|
2392 | exports: [
|
2393 | DragAndDropModule,
|
2394 | CalendarMonthViewComponent,
|
2395 | CalendarMonthCellComponent,
|
2396 | CalendarOpenDayEventsComponent,
|
2397 | CalendarMonthViewHeaderComponent,
|
2398 | ],
|
2399 | }]
|
2400 | }] });
|
2401 |
|
2402 | class CalendarDragHelper {
|
2403 | constructor(dragContainerElement, draggableElement) {
|
2404 | this.dragContainerElement = dragContainerElement;
|
2405 | this.startPosition = draggableElement.getBoundingClientRect();
|
2406 | }
|
2407 | validateDrag({ x, y, snapDraggedEvents, dragAlreadyMoved, transform, }) {
|
2408 | const isDraggedWithinThreshold = isWithinThreshold({ x, y }) || dragAlreadyMoved;
|
2409 | if (snapDraggedEvents) {
|
2410 | const inner = Object.assign({}, this.startPosition, {
|
2411 | left: this.startPosition.left + transform.x,
|
2412 | right: this.startPosition.right + transform.x,
|
2413 | top: this.startPosition.top + transform.y,
|
2414 | bottom: this.startPosition.bottom + transform.y,
|
2415 | });
|
2416 | if (isDraggedWithinThreshold) {
|
2417 | const outer = this.dragContainerElement.getBoundingClientRect();
|
2418 | const isTopInside = outer.top < inner.top && inner.top < outer.bottom;
|
2419 | const isBottomInside = outer.top < inner.bottom && inner.bottom < outer.bottom;
|
2420 | return (isInsideLeftAndRight(outer, inner) && (isTopInside || isBottomInside));
|
2421 | }
|
2422 |
|
2423 | return false;
|
2424 | }
|
2425 | else {
|
2426 | return isDraggedWithinThreshold;
|
2427 | }
|
2428 | }
|
2429 | }
|
2430 |
|
2431 | class CalendarResizeHelper {
|
2432 | constructor(resizeContainerElement, minWidth, rtl) {
|
2433 | this.resizeContainerElement = resizeContainerElement;
|
2434 | this.minWidth = minWidth;
|
2435 | this.rtl = rtl;
|
2436 | }
|
2437 | validateResize({ rectangle, edges }) {
|
2438 | if (this.rtl) {
|
2439 |
|
2440 |
|
2441 | if (typeof edges.left !== 'undefined') {
|
2442 | rectangle.left -= edges.left;
|
2443 | rectangle.right += edges.left;
|
2444 | }
|
2445 | else if (typeof edges.right !== 'undefined') {
|
2446 | rectangle.left += edges.right;
|
2447 | rectangle.right -= edges.right;
|
2448 | }
|
2449 | rectangle.width = rectangle.right - rectangle.left;
|
2450 | }
|
2451 | if (this.minWidth &&
|
2452 | Math.ceil(rectangle.width) < Math.ceil(this.minWidth)) {
|
2453 | return false;
|
2454 | }
|
2455 | return isInside(this.resizeContainerElement.getBoundingClientRect(), rectangle);
|
2456 | }
|
2457 | }
|
2458 |
|
2459 | class CalendarWeekViewHeaderComponent {
|
2460 | constructor() {
|
2461 | this.dayHeaderClicked = new EventEmitter();
|
2462 | this.eventDropped = new EventEmitter();
|
2463 | this.dragEnter = new EventEmitter();
|
2464 | this.trackByWeekDayHeaderDate = trackByWeekDayHeaderDate;
|
2465 | }
|
2466 | }
|
2467 | CalendarWeekViewHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2468 | CalendarWeekViewHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarWeekViewHeaderComponent, selector: "mwl-calendar-week-view-header", inputs: { days: "days", locale: "locale", customTemplate: "customTemplate" }, outputs: { dayHeaderClicked: "dayHeaderClicked", eventDropped: "eventDropped", dragEnter: "dragEnter" }, ngImport: i0, template: `
|
2469 | <ng-template
|
2470 | #defaultTemplate
|
2471 | let-days="days"
|
2472 | let-locale="locale"
|
2473 | let-dayHeaderClicked="dayHeaderClicked"
|
2474 | let-eventDropped="eventDropped"
|
2475 | let-trackByWeekDayHeaderDate="trackByWeekDayHeaderDate"
|
2476 | let-dragEnter="dragEnter"
|
2477 | >
|
2478 | <div class="cal-day-headers" role="row">
|
2479 | <div
|
2480 | class="cal-header"
|
2481 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
2482 | [class.cal-past]="day.isPast"
|
2483 | [class.cal-today]="day.isToday"
|
2484 | [class.cal-future]="day.isFuture"
|
2485 | [class.cal-weekend]="day.isWeekend"
|
2486 | [ngClass]="day.cssClass"
|
2487 | (mwlClick)="dayHeaderClicked.emit({ day: day, sourceEvent: $event })"
|
2488 | mwlDroppable
|
2489 | dragOverClass="cal-drag-over"
|
2490 | (drop)="
|
2491 | eventDropped.emit({
|
2492 | event: $event.dropData.event,
|
2493 | newStart: day.date
|
2494 | })
|
2495 | "
|
2496 | (dragEnter)="dragEnter.emit({ date: day.date })"
|
2497 | tabindex="0"
|
2498 | role="columnheader"
|
2499 | >
|
2500 | <b>{{ day.date | calendarDate : 'weekViewColumnHeader' : locale }}</b
|
2501 | ><br />
|
2502 | <span>{{
|
2503 | day.date | calendarDate : 'weekViewColumnSubHeader' : locale
|
2504 | }}</span>
|
2505 | </div>
|
2506 | </div>
|
2507 | </ng-template>
|
2508 | <ng-template
|
2509 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2510 | [ngTemplateOutletContext]="{
|
2511 | days: days,
|
2512 | locale: locale,
|
2513 | dayHeaderClicked: dayHeaderClicked,
|
2514 | eventDropped: eventDropped,
|
2515 | dragEnter: dragEnter,
|
2516 | trackByWeekDayHeaderDate: trackByWeekDayHeaderDate
|
2517 | }"
|
2518 | >
|
2519 | </ng-template>
|
2520 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.DroppableDirective, selector: "[mwlDroppable]", inputs: ["dragOverClass", "dragActiveClass", "validateDrop"], outputs: ["dragEnter", "dragLeave", "dragOver", "drop"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "pipe", type: CalendarDatePipe, name: "calendarDate" }] });
|
2521 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewHeaderComponent, decorators: [{
|
2522 | type: Component,
|
2523 | args: [{
|
2524 | selector: 'mwl-calendar-week-view-header',
|
2525 | template: `
|
2526 | <ng-template
|
2527 | #defaultTemplate
|
2528 | let-days="days"
|
2529 | let-locale="locale"
|
2530 | let-dayHeaderClicked="dayHeaderClicked"
|
2531 | let-eventDropped="eventDropped"
|
2532 | let-trackByWeekDayHeaderDate="trackByWeekDayHeaderDate"
|
2533 | let-dragEnter="dragEnter"
|
2534 | >
|
2535 | <div class="cal-day-headers" role="row">
|
2536 | <div
|
2537 | class="cal-header"
|
2538 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
2539 | [class.cal-past]="day.isPast"
|
2540 | [class.cal-today]="day.isToday"
|
2541 | [class.cal-future]="day.isFuture"
|
2542 | [class.cal-weekend]="day.isWeekend"
|
2543 | [ngClass]="day.cssClass"
|
2544 | (mwlClick)="dayHeaderClicked.emit({ day: day, sourceEvent: $event })"
|
2545 | mwlDroppable
|
2546 | dragOverClass="cal-drag-over"
|
2547 | (drop)="
|
2548 | eventDropped.emit({
|
2549 | event: $event.dropData.event,
|
2550 | newStart: day.date
|
2551 | })
|
2552 | "
|
2553 | (dragEnter)="dragEnter.emit({ date: day.date })"
|
2554 | tabindex="0"
|
2555 | role="columnheader"
|
2556 | >
|
2557 | <b>{{ day.date | calendarDate : 'weekViewColumnHeader' : locale }}</b
|
2558 | ><br />
|
2559 | <span>{{
|
2560 | day.date | calendarDate : 'weekViewColumnSubHeader' : locale
|
2561 | }}</span>
|
2562 | </div>
|
2563 | </div>
|
2564 | </ng-template>
|
2565 | <ng-template
|
2566 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2567 | [ngTemplateOutletContext]="{
|
2568 | days: days,
|
2569 | locale: locale,
|
2570 | dayHeaderClicked: dayHeaderClicked,
|
2571 | eventDropped: eventDropped,
|
2572 | dragEnter: dragEnter,
|
2573 | trackByWeekDayHeaderDate: trackByWeekDayHeaderDate
|
2574 | }"
|
2575 | >
|
2576 | </ng-template>
|
2577 | `,
|
2578 | }]
|
2579 | }], propDecorators: { days: [{
|
2580 | type: Input
|
2581 | }], locale: [{
|
2582 | type: Input
|
2583 | }], customTemplate: [{
|
2584 | type: Input
|
2585 | }], dayHeaderClicked: [{
|
2586 | type: Output
|
2587 | }], eventDropped: [{
|
2588 | type: Output
|
2589 | }], dragEnter: [{
|
2590 | type: Output
|
2591 | }] } });
|
2592 |
|
2593 | class CalendarWeekViewEventComponent {
|
2594 | constructor() {
|
2595 | this.eventClicked = new EventEmitter();
|
2596 | }
|
2597 | }
|
2598 | CalendarWeekViewEventComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewEventComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2599 | CalendarWeekViewEventComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarWeekViewEventComponent, selector: "mwl-calendar-week-view-event", inputs: { locale: "locale", weekEvent: "weekEvent", tooltipPlacement: "tooltipPlacement", tooltipAppendToBody: "tooltipAppendToBody", tooltipDisabled: "tooltipDisabled", tooltipDelay: "tooltipDelay", customTemplate: "customTemplate", eventTitleTemplate: "eventTitleTemplate", eventActionsTemplate: "eventActionsTemplate", tooltipTemplate: "tooltipTemplate", column: "column", daysInWeek: "daysInWeek" }, outputs: { eventClicked: "eventClicked" }, ngImport: i0, template: `
|
2600 | <ng-template
|
2601 | #defaultTemplate
|
2602 | let-weekEvent="weekEvent"
|
2603 | let-tooltipPlacement="tooltipPlacement"
|
2604 | let-eventClicked="eventClicked"
|
2605 | let-tooltipTemplate="tooltipTemplate"
|
2606 | let-tooltipAppendToBody="tooltipAppendToBody"
|
2607 | let-tooltipDisabled="tooltipDisabled"
|
2608 | let-tooltipDelay="tooltipDelay"
|
2609 | let-column="column"
|
2610 | let-daysInWeek="daysInWeek"
|
2611 | >
|
2612 | <div
|
2613 | class="cal-event"
|
2614 | [ngStyle]="{
|
2615 | color: weekEvent.event.color?.secondaryText,
|
2616 | backgroundColor: weekEvent.event.color?.secondary,
|
2617 | borderColor: weekEvent.event.color?.primary
|
2618 | }"
|
2619 | [mwlCalendarTooltip]="
|
2620 | !tooltipDisabled
|
2621 | ? (weekEvent.event.title
|
2622 | | calendarEventTitle
|
2623 | : (daysInWeek === 1 ? 'dayTooltip' : 'weekTooltip')
|
2624 | : weekEvent.tempEvent || weekEvent.event)
|
2625 | : ''
|
2626 | "
|
2627 | [tooltipPlacement]="tooltipPlacement"
|
2628 | [tooltipEvent]="weekEvent.tempEvent || weekEvent.event"
|
2629 | [tooltipTemplate]="tooltipTemplate"
|
2630 | [tooltipAppendToBody]="tooltipAppendToBody"
|
2631 | [tooltipDelay]="tooltipDelay"
|
2632 | (mwlClick)="eventClicked.emit({ sourceEvent: $event })"
|
2633 | (mwlKeydownEnter)="eventClicked.emit({ sourceEvent: $event })"
|
2634 | tabindex="0"
|
2635 | role="application"
|
2636 | [attr.aria-label]="
|
2637 | { event: weekEvent.tempEvent || weekEvent.event, locale: locale }
|
2638 | | calendarA11y : 'eventDescription'
|
2639 | "
|
2640 | >
|
2641 | <mwl-calendar-event-actions
|
2642 | [event]="weekEvent.tempEvent || weekEvent.event"
|
2643 | [customTemplate]="eventActionsTemplate"
|
2644 | >
|
2645 | </mwl-calendar-event-actions>
|
2646 | &ngsp;
|
2647 | <mwl-calendar-event-title
|
2648 | [event]="weekEvent.tempEvent || weekEvent.event"
|
2649 | [customTemplate]="eventTitleTemplate"
|
2650 | [view]="daysInWeek === 1 ? 'day' : 'week'"
|
2651 | >
|
2652 | </mwl-calendar-event-title>
|
2653 | </div>
|
2654 | </ng-template>
|
2655 | <ng-template
|
2656 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2657 | [ngTemplateOutletContext]="{
|
2658 | weekEvent: weekEvent,
|
2659 | tooltipPlacement: tooltipPlacement,
|
2660 | eventClicked: eventClicked,
|
2661 | tooltipTemplate: tooltipTemplate,
|
2662 | tooltipAppendToBody: tooltipAppendToBody,
|
2663 | tooltipDisabled: tooltipDisabled,
|
2664 | tooltipDelay: tooltipDelay,
|
2665 | column: column,
|
2666 | daysInWeek: daysInWeek
|
2667 | }"
|
2668 | >
|
2669 | </ng-template>
|
2670 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CalendarEventActionsComponent, selector: "mwl-calendar-event-actions", inputs: ["event", "customTemplate"] }, { kind: "component", type: CalendarEventTitleComponent, selector: "mwl-calendar-event-title", inputs: ["event", "customTemplate", "view"] }, { kind: "directive", type: CalendarTooltipDirective, selector: "[mwlCalendarTooltip]", inputs: ["mwlCalendarTooltip", "tooltipPlacement", "tooltipTemplate", "tooltipEvent", "tooltipAppendToBody", "tooltipDelay"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "directive", type: KeydownEnterDirective, selector: "[mwlKeydownEnter]", outputs: ["mwlKeydownEnter"] }, { kind: "pipe", type: CalendarEventTitlePipe, name: "calendarEventTitle" }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
2671 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewEventComponent, decorators: [{
|
2672 | type: Component,
|
2673 | args: [{
|
2674 | selector: 'mwl-calendar-week-view-event',
|
2675 | template: `
|
2676 | <ng-template
|
2677 | #defaultTemplate
|
2678 | let-weekEvent="weekEvent"
|
2679 | let-tooltipPlacement="tooltipPlacement"
|
2680 | let-eventClicked="eventClicked"
|
2681 | let-tooltipTemplate="tooltipTemplate"
|
2682 | let-tooltipAppendToBody="tooltipAppendToBody"
|
2683 | let-tooltipDisabled="tooltipDisabled"
|
2684 | let-tooltipDelay="tooltipDelay"
|
2685 | let-column="column"
|
2686 | let-daysInWeek="daysInWeek"
|
2687 | >
|
2688 | <div
|
2689 | class="cal-event"
|
2690 | [ngStyle]="{
|
2691 | color: weekEvent.event.color?.secondaryText,
|
2692 | backgroundColor: weekEvent.event.color?.secondary,
|
2693 | borderColor: weekEvent.event.color?.primary
|
2694 | }"
|
2695 | [mwlCalendarTooltip]="
|
2696 | !tooltipDisabled
|
2697 | ? (weekEvent.event.title
|
2698 | | calendarEventTitle
|
2699 | : (daysInWeek === 1 ? 'dayTooltip' : 'weekTooltip')
|
2700 | : weekEvent.tempEvent || weekEvent.event)
|
2701 | : ''
|
2702 | "
|
2703 | [tooltipPlacement]="tooltipPlacement"
|
2704 | [tooltipEvent]="weekEvent.tempEvent || weekEvent.event"
|
2705 | [tooltipTemplate]="tooltipTemplate"
|
2706 | [tooltipAppendToBody]="tooltipAppendToBody"
|
2707 | [tooltipDelay]="tooltipDelay"
|
2708 | (mwlClick)="eventClicked.emit({ sourceEvent: $event })"
|
2709 | (mwlKeydownEnter)="eventClicked.emit({ sourceEvent: $event })"
|
2710 | tabindex="0"
|
2711 | role="application"
|
2712 | [attr.aria-label]="
|
2713 | { event: weekEvent.tempEvent || weekEvent.event, locale: locale }
|
2714 | | calendarA11y : 'eventDescription'
|
2715 | "
|
2716 | >
|
2717 | <mwl-calendar-event-actions
|
2718 | [event]="weekEvent.tempEvent || weekEvent.event"
|
2719 | [customTemplate]="eventActionsTemplate"
|
2720 | >
|
2721 | </mwl-calendar-event-actions>
|
2722 | &ngsp;
|
2723 | <mwl-calendar-event-title
|
2724 | [event]="weekEvent.tempEvent || weekEvent.event"
|
2725 | [customTemplate]="eventTitleTemplate"
|
2726 | [view]="daysInWeek === 1 ? 'day' : 'week'"
|
2727 | >
|
2728 | </mwl-calendar-event-title>
|
2729 | </div>
|
2730 | </ng-template>
|
2731 | <ng-template
|
2732 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2733 | [ngTemplateOutletContext]="{
|
2734 | weekEvent: weekEvent,
|
2735 | tooltipPlacement: tooltipPlacement,
|
2736 | eventClicked: eventClicked,
|
2737 | tooltipTemplate: tooltipTemplate,
|
2738 | tooltipAppendToBody: tooltipAppendToBody,
|
2739 | tooltipDisabled: tooltipDisabled,
|
2740 | tooltipDelay: tooltipDelay,
|
2741 | column: column,
|
2742 | daysInWeek: daysInWeek
|
2743 | }"
|
2744 | >
|
2745 | </ng-template>
|
2746 | `,
|
2747 | }]
|
2748 | }], propDecorators: { locale: [{
|
2749 | type: Input
|
2750 | }], weekEvent: [{
|
2751 | type: Input
|
2752 | }], tooltipPlacement: [{
|
2753 | type: Input
|
2754 | }], tooltipAppendToBody: [{
|
2755 | type: Input
|
2756 | }], tooltipDisabled: [{
|
2757 | type: Input
|
2758 | }], tooltipDelay: [{
|
2759 | type: Input
|
2760 | }], customTemplate: [{
|
2761 | type: Input
|
2762 | }], eventTitleTemplate: [{
|
2763 | type: Input
|
2764 | }], eventActionsTemplate: [{
|
2765 | type: Input
|
2766 | }], tooltipTemplate: [{
|
2767 | type: Input
|
2768 | }], column: [{
|
2769 | type: Input
|
2770 | }], daysInWeek: [{
|
2771 | type: Input
|
2772 | }], eventClicked: [{
|
2773 | type: Output
|
2774 | }] } });
|
2775 |
|
2776 | class CalendarWeekViewHourSegmentComponent {
|
2777 | }
|
2778 | CalendarWeekViewHourSegmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewHourSegmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2779 | CalendarWeekViewHourSegmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarWeekViewHourSegmentComponent, selector: "mwl-calendar-week-view-hour-segment", inputs: { segment: "segment", segmentHeight: "segmentHeight", locale: "locale", isTimeLabel: "isTimeLabel", daysInWeek: "daysInWeek", customTemplate: "customTemplate" }, ngImport: i0, template: `
|
2780 | <ng-template
|
2781 | #defaultTemplate
|
2782 | let-segment="segment"
|
2783 | let-locale="locale"
|
2784 | let-segmentHeight="segmentHeight"
|
2785 | let-isTimeLabel="isTimeLabel"
|
2786 | let-daysInWeek="daysInWeek"
|
2787 | >
|
2788 | <div
|
2789 | [attr.aria-hidden]="
|
2790 | {}
|
2791 | | calendarA11y
|
2792 | : (daysInWeek === 1
|
2793 | ? 'hideDayHourSegment'
|
2794 | : 'hideWeekHourSegment')
|
2795 | "
|
2796 | class="cal-hour-segment"
|
2797 | [style.height.px]="segmentHeight"
|
2798 | [class.cal-hour-start]="segment.isStart"
|
2799 | [class.cal-after-hour-start]="!segment.isStart"
|
2800 | [ngClass]="segment.cssClass"
|
2801 | >
|
2802 | <div class="cal-time" *ngIf="isTimeLabel">
|
2803 | {{
|
2804 | segment.displayDate
|
2805 | | calendarDate
|
2806 | : (daysInWeek === 1 ? 'dayViewHour' : 'weekViewHour')
|
2807 | : locale
|
2808 | }}
|
2809 | </div>
|
2810 | </div>
|
2811 | </ng-template>
|
2812 | <ng-template
|
2813 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2814 | [ngTemplateOutletContext]="{
|
2815 | segment: segment,
|
2816 | locale: locale,
|
2817 | segmentHeight: segmentHeight,
|
2818 | isTimeLabel: isTimeLabel,
|
2819 | daysInWeek: daysInWeek
|
2820 | }"
|
2821 | >
|
2822 | </ng-template>
|
2823 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: CalendarDatePipe, name: "calendarDate" }, { kind: "pipe", type: CalendarA11yPipe, name: "calendarA11y" }] });
|
2824 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewHourSegmentComponent, decorators: [{
|
2825 | type: Component,
|
2826 | args: [{
|
2827 | selector: 'mwl-calendar-week-view-hour-segment',
|
2828 | template: `
|
2829 | <ng-template
|
2830 | #defaultTemplate
|
2831 | let-segment="segment"
|
2832 | let-locale="locale"
|
2833 | let-segmentHeight="segmentHeight"
|
2834 | let-isTimeLabel="isTimeLabel"
|
2835 | let-daysInWeek="daysInWeek"
|
2836 | >
|
2837 | <div
|
2838 | [attr.aria-hidden]="
|
2839 | {}
|
2840 | | calendarA11y
|
2841 | : (daysInWeek === 1
|
2842 | ? 'hideDayHourSegment'
|
2843 | : 'hideWeekHourSegment')
|
2844 | "
|
2845 | class="cal-hour-segment"
|
2846 | [style.height.px]="segmentHeight"
|
2847 | [class.cal-hour-start]="segment.isStart"
|
2848 | [class.cal-after-hour-start]="!segment.isStart"
|
2849 | [ngClass]="segment.cssClass"
|
2850 | >
|
2851 | <div class="cal-time" *ngIf="isTimeLabel">
|
2852 | {{
|
2853 | segment.displayDate
|
2854 | | calendarDate
|
2855 | : (daysInWeek === 1 ? 'dayViewHour' : 'weekViewHour')
|
2856 | : locale
|
2857 | }}
|
2858 | </div>
|
2859 | </div>
|
2860 | </ng-template>
|
2861 | <ng-template
|
2862 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2863 | [ngTemplateOutletContext]="{
|
2864 | segment: segment,
|
2865 | locale: locale,
|
2866 | segmentHeight: segmentHeight,
|
2867 | isTimeLabel: isTimeLabel,
|
2868 | daysInWeek: daysInWeek
|
2869 | }"
|
2870 | >
|
2871 | </ng-template>
|
2872 | `,
|
2873 | }]
|
2874 | }], propDecorators: { segment: [{
|
2875 | type: Input
|
2876 | }], segmentHeight: [{
|
2877 | type: Input
|
2878 | }], locale: [{
|
2879 | type: Input
|
2880 | }], isTimeLabel: [{
|
2881 | type: Input
|
2882 | }], daysInWeek: [{
|
2883 | type: Input
|
2884 | }], customTemplate: [{
|
2885 | type: Input
|
2886 | }] } });
|
2887 |
|
2888 | class CalendarWeekViewCurrentTimeMarkerComponent {
|
2889 | constructor(dateAdapter, zone) {
|
2890 | this.dateAdapter = dateAdapter;
|
2891 | this.zone = zone;
|
2892 | this.columnDate$ = new BehaviorSubject(undefined);
|
2893 | this.marker$ = this.zone.onStable.pipe(switchMap(() => interval(60 * 1000)), startWith(0), switchMapTo(this.columnDate$), map((columnDate) => {
|
2894 | const startOfDay = this.dateAdapter.setMinutes(this.dateAdapter.setHours(columnDate, this.dayStartHour), this.dayStartMinute);
|
2895 | const endOfDay = this.dateAdapter.setMinutes(this.dateAdapter.setHours(columnDate, this.dayEndHour), this.dayEndMinute);
|
2896 | const hourHeightModifier = (this.hourSegments * this.hourSegmentHeight) /
|
2897 | (this.hourDuration || 60);
|
2898 | const now = new Date();
|
2899 | return {
|
2900 | isVisible: this.dateAdapter.isSameDay(columnDate, now) &&
|
2901 | now >= startOfDay &&
|
2902 | now <= endOfDay,
|
2903 | top: this.dateAdapter.differenceInMinutes(now, startOfDay) *
|
2904 | hourHeightModifier,
|
2905 | };
|
2906 | }));
|
2907 | }
|
2908 | ngOnChanges(changes) {
|
2909 | if (changes.columnDate) {
|
2910 | this.columnDate$.next(changes.columnDate.currentValue);
|
2911 | }
|
2912 | }
|
2913 | }
|
2914 | CalendarWeekViewCurrentTimeMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewCurrentTimeMarkerComponent, deps: [{ token: DateAdapter }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
2915 | CalendarWeekViewCurrentTimeMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarWeekViewCurrentTimeMarkerComponent, selector: "mwl-calendar-week-view-current-time-marker", inputs: { columnDate: "columnDate", dayStartHour: "dayStartHour", dayStartMinute: "dayStartMinute", dayEndHour: "dayEndHour", dayEndMinute: "dayEndMinute", hourSegments: "hourSegments", hourDuration: "hourDuration", hourSegmentHeight: "hourSegmentHeight", customTemplate: "customTemplate" }, usesOnChanges: true, ngImport: i0, template: `
|
2916 | <ng-template
|
2917 | #defaultTemplate
|
2918 | let-columnDate="columnDate"
|
2919 | let-dayStartHour="dayStartHour"
|
2920 | let-dayStartMinute="dayStartMinute"
|
2921 | let-dayEndHour="dayEndHour"
|
2922 | let-dayEndMinute="dayEndMinute"
|
2923 | let-isVisible="isVisible"
|
2924 | let-topPx="topPx"
|
2925 | >
|
2926 | <div
|
2927 | class="cal-current-time-marker"
|
2928 | *ngIf="isVisible"
|
2929 | [style.top.px]="topPx"
|
2930 | ></div>
|
2931 | </ng-template>
|
2932 | <ng-template
|
2933 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2934 | [ngTemplateOutletContext]="{
|
2935 | columnDate: columnDate,
|
2936 | dayStartHour: dayStartHour,
|
2937 | dayStartMinute: dayStartMinute,
|
2938 | dayEndHour: dayEndHour,
|
2939 | dayEndMinute: dayEndMinute,
|
2940 | isVisible: (marker$ | async)?.isVisible,
|
2941 | topPx: (marker$ | async)?.top
|
2942 | }"
|
2943 | >
|
2944 | </ng-template>
|
2945 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
|
2946 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewCurrentTimeMarkerComponent, decorators: [{
|
2947 | type: Component,
|
2948 | args: [{
|
2949 | selector: 'mwl-calendar-week-view-current-time-marker',
|
2950 | template: `
|
2951 | <ng-template
|
2952 | #defaultTemplate
|
2953 | let-columnDate="columnDate"
|
2954 | let-dayStartHour="dayStartHour"
|
2955 | let-dayStartMinute="dayStartMinute"
|
2956 | let-dayEndHour="dayEndHour"
|
2957 | let-dayEndMinute="dayEndMinute"
|
2958 | let-isVisible="isVisible"
|
2959 | let-topPx="topPx"
|
2960 | >
|
2961 | <div
|
2962 | class="cal-current-time-marker"
|
2963 | *ngIf="isVisible"
|
2964 | [style.top.px]="topPx"
|
2965 | ></div>
|
2966 | </ng-template>
|
2967 | <ng-template
|
2968 | [ngTemplateOutlet]="customTemplate || defaultTemplate"
|
2969 | [ngTemplateOutletContext]="{
|
2970 | columnDate: columnDate,
|
2971 | dayStartHour: dayStartHour,
|
2972 | dayStartMinute: dayStartMinute,
|
2973 | dayEndHour: dayEndHour,
|
2974 | dayEndMinute: dayEndMinute,
|
2975 | isVisible: (marker$ | async)?.isVisible,
|
2976 | topPx: (marker$ | async)?.top
|
2977 | }"
|
2978 | >
|
2979 | </ng-template>
|
2980 | `,
|
2981 | }]
|
2982 | }], ctorParameters: function () { return [{ type: DateAdapter }, { type: i0.NgZone }]; }, propDecorators: { columnDate: [{
|
2983 | type: Input
|
2984 | }], dayStartHour: [{
|
2985 | type: Input
|
2986 | }], dayStartMinute: [{
|
2987 | type: Input
|
2988 | }], dayEndHour: [{
|
2989 | type: Input
|
2990 | }], dayEndMinute: [{
|
2991 | type: Input
|
2992 | }], hourSegments: [{
|
2993 | type: Input
|
2994 | }], hourDuration: [{
|
2995 | type: Input
|
2996 | }], hourSegmentHeight: [{
|
2997 | type: Input
|
2998 | }], customTemplate: [{
|
2999 | type: Input
|
3000 | }] } });
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 | class CalendarWeekViewComponent {
|
3013 | |
3014 |
|
3015 |
|
3016 | constructor(cdr, utils, locale, dateAdapter, element) {
|
3017 | this.cdr = cdr;
|
3018 | this.utils = utils;
|
3019 | this.dateAdapter = dateAdapter;
|
3020 | this.element = element;
|
3021 | |
3022 |
|
3023 |
|
3024 |
|
3025 | this.events = [];
|
3026 | |
3027 |
|
3028 |
|
3029 | this.excludeDays = [];
|
3030 | |
3031 |
|
3032 |
|
3033 | this.tooltipPlacement = 'auto';
|
3034 | |
3035 |
|
3036 |
|
3037 | this.tooltipAppendToBody = true;
|
3038 | |
3039 |
|
3040 |
|
3041 |
|
3042 | this.tooltipDelay = null;
|
3043 | |
3044 |
|
3045 |
|
3046 |
|
3047 | this.precision = 'days';
|
3048 | |
3049 |
|
3050 |
|
3051 | this.snapDraggedEvents = true;
|
3052 | |
3053 |
|
3054 |
|
3055 | this.hourSegments = 2;
|
3056 | |
3057 |
|
3058 |
|
3059 | this.hourSegmentHeight = 30;
|
3060 | |
3061 |
|
3062 |
|
3063 | this.minimumEventHeight = 30;
|
3064 | |
3065 |
|
3066 |
|
3067 | this.dayStartHour = 0;
|
3068 | |
3069 |
|
3070 |
|
3071 | this.dayStartMinute = 0;
|
3072 | |
3073 |
|
3074 |
|
3075 | this.dayEndHour = 23;
|
3076 | |
3077 |
|
3078 |
|
3079 | this.dayEndMinute = 59;
|
3080 | |
3081 |
|
3082 |
|
3083 | this.dayHeaderClicked = new EventEmitter();
|
3084 | |
3085 |
|
3086 |
|
3087 | this.eventClicked = new EventEmitter();
|
3088 | |
3089 |
|
3090 |
|
3091 | this.eventTimesChanged = new EventEmitter();
|
3092 | |
3093 |
|
3094 |
|
3095 |
|
3096 | this.beforeViewRender = new EventEmitter();
|
3097 | |
3098 |
|
3099 |
|
3100 | this.hourSegmentClicked = new EventEmitter();
|
3101 | |
3102 |
|
3103 |
|
3104 | this.allDayEventResizes = new Map();
|
3105 | |
3106 |
|
3107 |
|
3108 | this.timeEventResizes = new Map();
|
3109 | |
3110 |
|
3111 |
|
3112 | this.eventDragEnterByType = {
|
3113 | allDay: 0,
|
3114 | time: 0,
|
3115 | };
|
3116 | |
3117 |
|
3118 |
|
3119 | this.dragActive = false;
|
3120 | |
3121 |
|
3122 |
|
3123 | this.dragAlreadyMoved = false;
|
3124 | |
3125 |
|
3126 |
|
3127 | this.calendarId = Symbol('angular calendar week view id');
|
3128 | |
3129 |
|
3130 |
|
3131 | this.rtl = false;
|
3132 | |
3133 |
|
3134 |
|
3135 | this.trackByWeekDayHeaderDate = trackByWeekDayHeaderDate;
|
3136 | |
3137 |
|
3138 |
|
3139 | this.trackByHourSegment = trackByHourSegment;
|
3140 | |
3141 |
|
3142 |
|
3143 | this.trackByHour = trackByHour;
|
3144 | |
3145 |
|
3146 |
|
3147 | this.trackByWeekAllDayEvent = trackByWeekAllDayEvent;
|
3148 | |
3149 |
|
3150 |
|
3151 | this.trackByWeekTimeEvent = trackByWeekTimeEvent;
|
3152 | |
3153 |
|
3154 |
|
3155 | this.trackByHourColumn = (index, column) => column.hours[0] ? column.hours[0].segments[0].date.toISOString() : column;
|
3156 | |
3157 |
|
3158 |
|
3159 | this.trackById = (index, row) => row.id;
|
3160 | this.locale = locale;
|
3161 | }
|
3162 | |
3163 |
|
3164 |
|
3165 | ngOnInit() {
|
3166 | if (this.refresh) {
|
3167 | this.refreshSubscription = this.refresh.subscribe(() => {
|
3168 | this.refreshAll();
|
3169 | this.cdr.markForCheck();
|
3170 | });
|
3171 | }
|
3172 | }
|
3173 | |
3174 |
|
3175 |
|
3176 | ngOnChanges(changes) {
|
3177 | const refreshHeader = changes.viewDate ||
|
3178 | changes.excludeDays ||
|
3179 | changes.weekendDays ||
|
3180 | changes.daysInWeek ||
|
3181 | changes.weekStartsOn;
|
3182 | const refreshBody = changes.viewDate ||
|
3183 | changes.dayStartHour ||
|
3184 | changes.dayStartMinute ||
|
3185 | changes.dayEndHour ||
|
3186 | changes.dayEndMinute ||
|
3187 | changes.hourSegments ||
|
3188 | changes.hourDuration ||
|
3189 | changes.weekStartsOn ||
|
3190 | changes.weekendDays ||
|
3191 | changes.excludeDays ||
|
3192 | changes.hourSegmentHeight ||
|
3193 | changes.events ||
|
3194 | changes.daysInWeek ||
|
3195 | changes.minimumEventHeight;
|
3196 | if (refreshHeader) {
|
3197 | this.refreshHeader();
|
3198 | }
|
3199 | if (changes.events) {
|
3200 | validateEvents(this.events);
|
3201 | }
|
3202 | if (refreshBody) {
|
3203 | this.refreshBody();
|
3204 | }
|
3205 | if (refreshHeader || refreshBody) {
|
3206 | this.emitBeforeViewRender();
|
3207 | }
|
3208 | }
|
3209 | |
3210 |
|
3211 |
|
3212 | ngOnDestroy() {
|
3213 | if (this.refreshSubscription) {
|
3214 | this.refreshSubscription.unsubscribe();
|
3215 | }
|
3216 | }
|
3217 | |
3218 |
|
3219 |
|
3220 | ngAfterViewInit() {
|
3221 | this.rtl =
|
3222 | typeof window !== 'undefined' &&
|
3223 | getComputedStyle(this.element.nativeElement).direction === 'rtl';
|
3224 | this.cdr.detectChanges();
|
3225 | }
|
3226 | |
3227 |
|
3228 |
|
3229 | timeEventResizeStarted(eventsContainer, timeEvent, resizeEvent) {
|
3230 | this.timeEventResizes.set(timeEvent.event, resizeEvent);
|
3231 | this.resizeStarted(eventsContainer, timeEvent);
|
3232 | }
|
3233 | |
3234 |
|
3235 |
|
3236 | timeEventResizing(timeEvent, resizeEvent) {
|
3237 | this.timeEventResizes.set(timeEvent.event, resizeEvent);
|
3238 | const adjustedEvents = new Map();
|
3239 | const tempEvents = [...this.events];
|
3240 | this.timeEventResizes.forEach((lastResizeEvent, event) => {
|
3241 | const newEventDates = this.getTimeEventResizedDates(event, lastResizeEvent);
|
3242 | const adjustedEvent = { ...event, ...newEventDates };
|
3243 | adjustedEvents.set(adjustedEvent, event);
|
3244 | const eventIndex = tempEvents.indexOf(event);
|
3245 | tempEvents[eventIndex] = adjustedEvent;
|
3246 | });
|
3247 | this.restoreOriginalEvents(tempEvents, adjustedEvents, true);
|
3248 | }
|
3249 | |
3250 |
|
3251 |
|
3252 | timeEventResizeEnded(timeEvent) {
|
3253 | this.view = this.getWeekView(this.events);
|
3254 | const lastResizeEvent = this.timeEventResizes.get(timeEvent.event);
|
3255 | if (lastResizeEvent) {
|
3256 | this.timeEventResizes.delete(timeEvent.event);
|
3257 | const newEventDates = this.getTimeEventResizedDates(timeEvent.event, lastResizeEvent);
|
3258 | this.eventTimesChanged.emit({
|
3259 | newStart: newEventDates.start,
|
3260 | newEnd: newEventDates.end,
|
3261 | event: timeEvent.event,
|
3262 | type: CalendarEventTimesChangedEventType.Resize,
|
3263 | });
|
3264 | }
|
3265 | }
|
3266 | |
3267 |
|
3268 |
|
3269 | allDayEventResizeStarted(allDayEventsContainer, allDayEvent, resizeEvent) {
|
3270 | this.allDayEventResizes.set(allDayEvent, {
|
3271 | originalOffset: allDayEvent.offset,
|
3272 | originalSpan: allDayEvent.span,
|
3273 | edge: typeof resizeEvent.edges.left !== 'undefined' ? 'left' : 'right',
|
3274 | });
|
3275 | this.resizeStarted(allDayEventsContainer, allDayEvent, this.getDayColumnWidth(allDayEventsContainer));
|
3276 | }
|
3277 | |
3278 |
|
3279 |
|
3280 | allDayEventResizing(allDayEvent, resizeEvent, dayWidth) {
|
3281 | const currentResize = this.allDayEventResizes.get(allDayEvent);
|
3282 | const modifier = this.rtl ? -1 : 1;
|
3283 | if (typeof resizeEvent.edges.left !== 'undefined') {
|
3284 | const diff = Math.round(+resizeEvent.edges.left / dayWidth) * modifier;
|
3285 | allDayEvent.offset = currentResize.originalOffset + diff;
|
3286 | allDayEvent.span = currentResize.originalSpan - diff;
|
3287 | }
|
3288 | else if (typeof resizeEvent.edges.right !== 'undefined') {
|
3289 | const diff = Math.round(+resizeEvent.edges.right / dayWidth) * modifier;
|
3290 | allDayEvent.span = currentResize.originalSpan + diff;
|
3291 | }
|
3292 | }
|
3293 | |
3294 |
|
3295 |
|
3296 | allDayEventResizeEnded(allDayEvent) {
|
3297 | const currentResize = this.allDayEventResizes.get(allDayEvent);
|
3298 | if (currentResize) {
|
3299 | const allDayEventResizingBeforeStart = currentResize.edge === 'left';
|
3300 | let daysDiff;
|
3301 | if (allDayEventResizingBeforeStart) {
|
3302 | daysDiff = allDayEvent.offset - currentResize.originalOffset;
|
3303 | }
|
3304 | else {
|
3305 | daysDiff = allDayEvent.span - currentResize.originalSpan;
|
3306 | }
|
3307 | allDayEvent.offset = currentResize.originalOffset;
|
3308 | allDayEvent.span = currentResize.originalSpan;
|
3309 | const newDates = this.getAllDayEventResizedDates(allDayEvent.event, daysDiff, allDayEventResizingBeforeStart);
|
3310 | this.eventTimesChanged.emit({
|
3311 | newStart: newDates.start,
|
3312 | newEnd: newDates.end,
|
3313 | event: allDayEvent.event,
|
3314 | type: CalendarEventTimesChangedEventType.Resize,
|
3315 | });
|
3316 | this.allDayEventResizes.delete(allDayEvent);
|
3317 | }
|
3318 | }
|
3319 | |
3320 |
|
3321 |
|
3322 | getDayColumnWidth(eventRowContainer) {
|
3323 | return Math.floor(eventRowContainer.offsetWidth / this.days.length);
|
3324 | }
|
3325 | |
3326 |
|
3327 |
|
3328 | dateDragEnter(date) {
|
3329 | this.lastDragEnterDate = date;
|
3330 | }
|
3331 | |
3332 |
|
3333 |
|
3334 | eventDropped(dropEvent, date, allDay) {
|
3335 | if (shouldFireDroppedEvent(dropEvent, date, allDay, this.calendarId) &&
|
3336 | this.lastDragEnterDate.getTime() === date.getTime() &&
|
3337 | (!this.snapDraggedEvents ||
|
3338 | dropEvent.dropData.event !== this.lastDraggedEvent)) {
|
3339 | this.eventTimesChanged.emit({
|
3340 | type: CalendarEventTimesChangedEventType.Drop,
|
3341 | event: dropEvent.dropData.event,
|
3342 | newStart: date,
|
3343 | allDay,
|
3344 | });
|
3345 | }
|
3346 | this.lastDraggedEvent = null;
|
3347 | }
|
3348 | |
3349 |
|
3350 |
|
3351 | dragEnter(type) {
|
3352 | this.eventDragEnterByType[type]++;
|
3353 | }
|
3354 | |
3355 |
|
3356 |
|
3357 | dragLeave(type) {
|
3358 | this.eventDragEnterByType[type]--;
|
3359 | }
|
3360 | |
3361 |
|
3362 |
|
3363 | dragStarted(eventsContainerElement, eventElement, event, useY) {
|
3364 | this.dayColumnWidth = this.getDayColumnWidth(eventsContainerElement);
|
3365 | const dragHelper = new CalendarDragHelper(eventsContainerElement, eventElement);
|
3366 | this.validateDrag = ({ x, y, transform }) => {
|
3367 | const isAllowed = this.allDayEventResizes.size === 0 &&
|
3368 | this.timeEventResizes.size === 0 &&
|
3369 | dragHelper.validateDrag({
|
3370 | x,
|
3371 | y,
|
3372 | snapDraggedEvents: this.snapDraggedEvents,
|
3373 | dragAlreadyMoved: this.dragAlreadyMoved,
|
3374 | transform,
|
3375 | });
|
3376 | if (isAllowed && this.validateEventTimesChanged) {
|
3377 | const newEventTimes = this.getDragMovedEventTimes(event, { x, y }, this.dayColumnWidth, useY);
|
3378 | return this.validateEventTimesChanged({
|
3379 | type: CalendarEventTimesChangedEventType.Drag,
|
3380 | event: event.event,
|
3381 | newStart: newEventTimes.start,
|
3382 | newEnd: newEventTimes.end,
|
3383 | });
|
3384 | }
|
3385 | return isAllowed;
|
3386 | };
|
3387 | this.dragActive = true;
|
3388 | this.dragAlreadyMoved = false;
|
3389 | this.lastDraggedEvent = null;
|
3390 | this.eventDragEnterByType = {
|
3391 | allDay: 0,
|
3392 | time: 0,
|
3393 | };
|
3394 | if (!this.snapDraggedEvents && useY) {
|
3395 | this.view.hourColumns.forEach((column) => {
|
3396 | const linkedEvent = column.events.find((columnEvent) => columnEvent.event === event.event && columnEvent !== event);
|
3397 |
|
3398 | if (linkedEvent) {
|
3399 | linkedEvent.width = 0;
|
3400 | linkedEvent.height = 0;
|
3401 | }
|
3402 | });
|
3403 | }
|
3404 | this.cdr.markForCheck();
|
3405 | }
|
3406 | |
3407 |
|
3408 |
|
3409 | dragMove(dayEvent, dragEvent) {
|
3410 | const newEventTimes = this.getDragMovedEventTimes(dayEvent, dragEvent, this.dayColumnWidth, true);
|
3411 | const originalEvent = dayEvent.event;
|
3412 | const adjustedEvent = { ...originalEvent, ...newEventTimes };
|
3413 | const tempEvents = this.events.map((event) => {
|
3414 | if (event === originalEvent) {
|
3415 | return adjustedEvent;
|
3416 | }
|
3417 | return event;
|
3418 | });
|
3419 | this.restoreOriginalEvents(tempEvents, new Map([[adjustedEvent, originalEvent]]), this.snapDraggedEvents);
|
3420 | this.dragAlreadyMoved = true;
|
3421 | }
|
3422 | |
3423 |
|
3424 |
|
3425 | allDayEventDragMove() {
|
3426 | this.dragAlreadyMoved = true;
|
3427 | }
|
3428 | |
3429 |
|
3430 |
|
3431 | dragEnded(weekEvent, dragEndEvent, dayWidth, useY = false) {
|
3432 | this.view = this.getWeekView(this.events);
|
3433 | this.dragActive = false;
|
3434 | this.validateDrag = null;
|
3435 | const { start, end } = this.getDragMovedEventTimes(weekEvent, dragEndEvent, dayWidth, useY);
|
3436 | if ((this.snapDraggedEvents ||
|
3437 | this.eventDragEnterByType[useY ? 'time' : 'allDay'] > 0) &&
|
3438 | isDraggedWithinPeriod(start, end, this.view.period)) {
|
3439 | this.lastDraggedEvent = weekEvent.event;
|
3440 | this.eventTimesChanged.emit({
|
3441 | newStart: start,
|
3442 | newEnd: end,
|
3443 | event: weekEvent.event,
|
3444 | type: CalendarEventTimesChangedEventType.Drag,
|
3445 | allDay: !useY,
|
3446 | });
|
3447 | }
|
3448 | }
|
3449 | refreshHeader() {
|
3450 | this.days = this.utils.getWeekViewHeader({
|
3451 | viewDate: this.viewDate,
|
3452 | weekStartsOn: this.weekStartsOn,
|
3453 | excluded: this.excludeDays,
|
3454 | weekendDays: this.weekendDays,
|
3455 | ...getWeekViewPeriod(this.dateAdapter, this.viewDate, this.weekStartsOn, this.excludeDays, this.daysInWeek),
|
3456 | });
|
3457 | }
|
3458 | refreshBody() {
|
3459 | this.view = this.getWeekView(this.events);
|
3460 | }
|
3461 | refreshAll() {
|
3462 | this.refreshHeader();
|
3463 | this.refreshBody();
|
3464 | this.emitBeforeViewRender();
|
3465 | }
|
3466 | emitBeforeViewRender() {
|
3467 | if (this.days && this.view) {
|
3468 | this.beforeViewRender.emit({
|
3469 | header: this.days,
|
3470 | ...this.view,
|
3471 | });
|
3472 | }
|
3473 | }
|
3474 | getWeekView(events) {
|
3475 | return this.utils.getWeekView({
|
3476 | events,
|
3477 | viewDate: this.viewDate,
|
3478 | weekStartsOn: this.weekStartsOn,
|
3479 | excluded: this.excludeDays,
|
3480 | precision: this.precision,
|
3481 | absolutePositionedEvents: true,
|
3482 | hourSegments: this.hourSegments,
|
3483 | hourDuration: this.hourDuration,
|
3484 | dayStart: {
|
3485 | hour: this.dayStartHour,
|
3486 | minute: this.dayStartMinute,
|
3487 | },
|
3488 | dayEnd: {
|
3489 | hour: this.dayEndHour,
|
3490 | minute: this.dayEndMinute,
|
3491 | },
|
3492 | segmentHeight: this.hourSegmentHeight,
|
3493 | weekendDays: this.weekendDays,
|
3494 | minimumEventHeight: this.minimumEventHeight,
|
3495 | ...getWeekViewPeriod(this.dateAdapter, this.viewDate, this.weekStartsOn, this.excludeDays, this.daysInWeek),
|
3496 | });
|
3497 | }
|
3498 | getDragMovedEventTimes(weekEvent, dragEndEvent, dayWidth, useY) {
|
3499 | const daysDragged = (roundToNearest(dragEndEvent.x, dayWidth) / dayWidth) *
|
3500 | (this.rtl ? -1 : 1);
|
3501 | const minutesMoved = useY
|
3502 | ? getMinutesMoved(dragEndEvent.y, this.hourSegments, this.hourSegmentHeight, this.eventSnapSize, this.hourDuration)
|
3503 | : 0;
|
3504 | const start = this.dateAdapter.addMinutes(addDaysWithExclusions(this.dateAdapter, weekEvent.event.start, daysDragged, this.excludeDays), minutesMoved);
|
3505 | let end;
|
3506 | if (weekEvent.event.end) {
|
3507 | end = this.dateAdapter.addMinutes(addDaysWithExclusions(this.dateAdapter, weekEvent.event.end, daysDragged, this.excludeDays), minutesMoved);
|
3508 | }
|
3509 | return { start, end };
|
3510 | }
|
3511 | restoreOriginalEvents(tempEvents, adjustedEvents, snapDraggedEvents = true) {
|
3512 | const previousView = this.view;
|
3513 | if (snapDraggedEvents) {
|
3514 | this.view = this.getWeekView(tempEvents);
|
3515 | }
|
3516 | const adjustedEventsArray = tempEvents.filter((event) => adjustedEvents.has(event));
|
3517 | this.view.hourColumns.forEach((column, columnIndex) => {
|
3518 | previousView.hourColumns[columnIndex].hours.forEach((hour, hourIndex) => {
|
3519 | hour.segments.forEach((segment, segmentIndex) => {
|
3520 | column.hours[hourIndex].segments[segmentIndex].cssClass =
|
3521 | segment.cssClass;
|
3522 | });
|
3523 | });
|
3524 | adjustedEventsArray.forEach((adjustedEvent) => {
|
3525 | const originalEvent = adjustedEvents.get(adjustedEvent);
|
3526 | const existingColumnEvent = column.events.find((columnEvent) => columnEvent.event ===
|
3527 | (snapDraggedEvents ? adjustedEvent : originalEvent));
|
3528 | if (existingColumnEvent) {
|
3529 |
|
3530 | existingColumnEvent.event = originalEvent;
|
3531 | existingColumnEvent['tempEvent'] = adjustedEvent;
|
3532 | if (!snapDraggedEvents) {
|
3533 | existingColumnEvent.height = 0;
|
3534 | existingColumnEvent.width = 0;
|
3535 | }
|
3536 | }
|
3537 | else {
|
3538 |
|
3539 | const event = {
|
3540 | event: originalEvent,
|
3541 | left: 0,
|
3542 | top: 0,
|
3543 | height: 0,
|
3544 | width: 0,
|
3545 | startsBeforeDay: false,
|
3546 | endsAfterDay: false,
|
3547 | tempEvent: adjustedEvent,
|
3548 | };
|
3549 | column.events.push(event);
|
3550 | }
|
3551 | });
|
3552 | });
|
3553 | adjustedEvents.clear();
|
3554 | }
|
3555 | getTimeEventResizedDates(calendarEvent, resizeEvent) {
|
3556 | const newEventDates = {
|
3557 | start: calendarEvent.start,
|
3558 | end: getDefaultEventEnd(this.dateAdapter, calendarEvent, this.minimumEventHeight),
|
3559 | };
|
3560 | const { end, ...eventWithoutEnd } = calendarEvent;
|
3561 | const smallestResizes = {
|
3562 | start: this.dateAdapter.addMinutes(newEventDates.end, this.minimumEventHeight * -1),
|
3563 | end: getDefaultEventEnd(this.dateAdapter, eventWithoutEnd, this.minimumEventHeight),
|
3564 | };
|
3565 | const modifier = this.rtl ? -1 : 1;
|
3566 | if (typeof resizeEvent.edges.left !== 'undefined') {
|
3567 | const daysDiff = Math.round(+resizeEvent.edges.left / this.dayColumnWidth) * modifier;
|
3568 | const newStart = addDaysWithExclusions(this.dateAdapter, newEventDates.start, daysDiff, this.excludeDays);
|
3569 | if (newStart < smallestResizes.start) {
|
3570 | newEventDates.start = newStart;
|
3571 | }
|
3572 | else {
|
3573 | newEventDates.start = smallestResizes.start;
|
3574 | }
|
3575 | }
|
3576 | else if (typeof resizeEvent.edges.right !== 'undefined') {
|
3577 | const daysDiff = Math.round(+resizeEvent.edges.right / this.dayColumnWidth) * modifier;
|
3578 | const newEnd = addDaysWithExclusions(this.dateAdapter, newEventDates.end, daysDiff, this.excludeDays);
|
3579 | if (newEnd > smallestResizes.end) {
|
3580 | newEventDates.end = newEnd;
|
3581 | }
|
3582 | else {
|
3583 | newEventDates.end = smallestResizes.end;
|
3584 | }
|
3585 | }
|
3586 | if (typeof resizeEvent.edges.top !== 'undefined') {
|
3587 | const minutesMoved = getMinutesMoved(resizeEvent.edges.top, this.hourSegments, this.hourSegmentHeight, this.eventSnapSize, this.hourDuration);
|
3588 | const newStart = this.dateAdapter.addMinutes(newEventDates.start, minutesMoved);
|
3589 | if (newStart < smallestResizes.start) {
|
3590 | newEventDates.start = newStart;
|
3591 | }
|
3592 | else {
|
3593 | newEventDates.start = smallestResizes.start;
|
3594 | }
|
3595 | }
|
3596 | else if (typeof resizeEvent.edges.bottom !== 'undefined') {
|
3597 | const minutesMoved = getMinutesMoved(resizeEvent.edges.bottom, this.hourSegments, this.hourSegmentHeight, this.eventSnapSize, this.hourDuration);
|
3598 | const newEnd = this.dateAdapter.addMinutes(newEventDates.end, minutesMoved);
|
3599 | if (newEnd > smallestResizes.end) {
|
3600 | newEventDates.end = newEnd;
|
3601 | }
|
3602 | else {
|
3603 | newEventDates.end = smallestResizes.end;
|
3604 | }
|
3605 | }
|
3606 | return newEventDates;
|
3607 | }
|
3608 | resizeStarted(eventsContainer, event, dayWidth) {
|
3609 | this.dayColumnWidth = this.getDayColumnWidth(eventsContainer);
|
3610 | const resizeHelper = new CalendarResizeHelper(eventsContainer, dayWidth, this.rtl);
|
3611 | this.validateResize = ({ rectangle, edges }) => {
|
3612 | const isWithinBoundary = resizeHelper.validateResize({
|
3613 | rectangle: { ...rectangle },
|
3614 | edges,
|
3615 | });
|
3616 | if (isWithinBoundary && this.validateEventTimesChanged) {
|
3617 | let newEventDates;
|
3618 | if (!dayWidth) {
|
3619 | newEventDates = this.getTimeEventResizedDates(event.event, {
|
3620 | rectangle,
|
3621 | edges,
|
3622 | });
|
3623 | }
|
3624 | else {
|
3625 | const modifier = this.rtl ? -1 : 1;
|
3626 | if (typeof edges.left !== 'undefined') {
|
3627 | const diff = Math.round(+edges.left / dayWidth) * modifier;
|
3628 | newEventDates = this.getAllDayEventResizedDates(event.event, diff, !this.rtl);
|
3629 | }
|
3630 | else {
|
3631 | const diff = Math.round(+edges.right / dayWidth) * modifier;
|
3632 | newEventDates = this.getAllDayEventResizedDates(event.event, diff, this.rtl);
|
3633 | }
|
3634 | }
|
3635 | return this.validateEventTimesChanged({
|
3636 | type: CalendarEventTimesChangedEventType.Resize,
|
3637 | event: event.event,
|
3638 | newStart: newEventDates.start,
|
3639 | newEnd: newEventDates.end,
|
3640 | });
|
3641 | }
|
3642 | return isWithinBoundary;
|
3643 | };
|
3644 | this.cdr.markForCheck();
|
3645 | }
|
3646 | |
3647 |
|
3648 |
|
3649 | getAllDayEventResizedDates(event, daysDiff, beforeStart) {
|
3650 | let start = event.start;
|
3651 | let end = event.end || event.start;
|
3652 | if (beforeStart) {
|
3653 | start = addDaysWithExclusions(this.dateAdapter, start, daysDiff, this.excludeDays);
|
3654 | }
|
3655 | else {
|
3656 | end = addDaysWithExclusions(this.dateAdapter, end, daysDiff, this.excludeDays);
|
3657 | }
|
3658 | return { start, end };
|
3659 | }
|
3660 | }
|
3661 | CalendarWeekViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: CalendarUtils }, { token: LOCALE_ID }, { token: DateAdapter }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
3662 | CalendarWeekViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarWeekViewComponent, selector: "mwl-calendar-week-view", inputs: { viewDate: "viewDate", events: "events", excludeDays: "excludeDays", refresh: "refresh", locale: "locale", tooltipPlacement: "tooltipPlacement", tooltipTemplate: "tooltipTemplate", tooltipAppendToBody: "tooltipAppendToBody", tooltipDelay: "tooltipDelay", weekStartsOn: "weekStartsOn", headerTemplate: "headerTemplate", eventTemplate: "eventTemplate", eventTitleTemplate: "eventTitleTemplate", eventActionsTemplate: "eventActionsTemplate", precision: "precision", weekendDays: "weekendDays", snapDraggedEvents: "snapDraggedEvents", hourSegments: "hourSegments", hourDuration: "hourDuration", hourSegmentHeight: "hourSegmentHeight", minimumEventHeight: "minimumEventHeight", dayStartHour: "dayStartHour", dayStartMinute: "dayStartMinute", dayEndHour: "dayEndHour", dayEndMinute: "dayEndMinute", hourSegmentTemplate: "hourSegmentTemplate", eventSnapSize: "eventSnapSize", allDayEventsLabelTemplate: "allDayEventsLabelTemplate", daysInWeek: "daysInWeek", currentTimeMarkerTemplate: "currentTimeMarkerTemplate", validateEventTimesChanged: "validateEventTimesChanged", resizeCursors: "resizeCursors" }, outputs: { dayHeaderClicked: "dayHeaderClicked", eventClicked: "eventClicked", eventTimesChanged: "eventTimesChanged", beforeViewRender: "beforeViewRender", hourSegmentClicked: "hourSegmentClicked" }, usesOnChanges: true, ngImport: i0, template: `
|
3663 | <div class="cal-week-view" role="grid">
|
3664 | <mwl-calendar-week-view-header
|
3665 | [days]="days"
|
3666 | [locale]="locale"
|
3667 | [customTemplate]="headerTemplate"
|
3668 | (dayHeaderClicked)="dayHeaderClicked.emit($event)"
|
3669 | (eventDropped)="
|
3670 | eventDropped({ dropData: $event }, $event.newStart, true)
|
3671 | "
|
3672 | (dragEnter)="dateDragEnter($event.date)"
|
3673 | >
|
3674 | </mwl-calendar-week-view-header>
|
3675 | <div
|
3676 | class="cal-all-day-events"
|
3677 | #allDayEventsContainer
|
3678 | *ngIf="view.allDayEventRows.length > 0"
|
3679 | mwlDroppable
|
3680 | (dragEnter)="dragEnter('allDay')"
|
3681 | (dragLeave)="dragLeave('allDay')"
|
3682 | >
|
3683 | <div class="cal-day-columns">
|
3684 | <div class="cal-time-label-column">
|
3685 | <ng-container
|
3686 | *ngTemplateOutlet="allDayEventsLabelTemplate"
|
3687 | ></ng-container>
|
3688 | </div>
|
3689 | <div
|
3690 | class="cal-day-column"
|
3691 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
3692 | mwlDroppable
|
3693 | dragOverClass="cal-drag-over"
|
3694 | (drop)="eventDropped($event, day.date, true)"
|
3695 | (dragEnter)="dateDragEnter(day.date)"
|
3696 | ></div>
|
3697 | </div>
|
3698 | <div
|
3699 | *ngFor="let eventRow of view.allDayEventRows; trackBy: trackById"
|
3700 | #eventRowContainer
|
3701 | class="cal-events-row"
|
3702 | >
|
3703 | <div
|
3704 | *ngFor="
|
3705 | let allDayEvent of eventRow.row;
|
3706 | trackBy: trackByWeekAllDayEvent
|
3707 | "
|
3708 | #event
|
3709 | class="cal-event-container"
|
3710 | [class.cal-draggable]="
|
3711 | allDayEvent.event.draggable && allDayEventResizes.size === 0
|
3712 | "
|
3713 | [class.cal-starts-within-week]="!allDayEvent.startsBeforeWeek"
|
3714 | [class.cal-ends-within-week]="!allDayEvent.endsAfterWeek"
|
3715 | [ngClass]="allDayEvent.event?.cssClass"
|
3716 | [style.width.%]="(100 / days.length) * allDayEvent.span"
|
3717 | [style.marginLeft.%]="
|
3718 | rtl ? null : (100 / days.length) * allDayEvent.offset
|
3719 | "
|
3720 | [style.marginRight.%]="
|
3721 | rtl ? (100 / days.length) * allDayEvent.offset : null
|
3722 | "
|
3723 | mwlResizable
|
3724 | [resizeCursors]="resizeCursors"
|
3725 | [resizeSnapGrid]="{ left: dayColumnWidth, right: dayColumnWidth }"
|
3726 | [validateResize]="validateResize"
|
3727 | (resizeStart)="
|
3728 | allDayEventResizeStarted(eventRowContainer, allDayEvent, $event)
|
3729 | "
|
3730 | (resizing)="
|
3731 | allDayEventResizing(allDayEvent, $event, dayColumnWidth)
|
3732 | "
|
3733 | (resizeEnd)="allDayEventResizeEnded(allDayEvent)"
|
3734 | mwlDraggable
|
3735 | dragActiveClass="cal-drag-active"
|
3736 | [dropData]="{ event: allDayEvent.event, calendarId: calendarId }"
|
3737 | [dragAxis]="{
|
3738 | x: allDayEvent.event.draggable && allDayEventResizes.size === 0,
|
3739 | y:
|
3740 | !snapDraggedEvents &&
|
3741 | allDayEvent.event.draggable &&
|
3742 | allDayEventResizes.size === 0
|
3743 | }"
|
3744 | [dragSnapGrid]="snapDraggedEvents ? { x: dayColumnWidth } : {}"
|
3745 | [validateDrag]="validateDrag"
|
3746 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
3747 | (dragStart)="
|
3748 | dragStarted(eventRowContainer, event, allDayEvent, false)
|
3749 | "
|
3750 | (dragging)="allDayEventDragMove()"
|
3751 | (dragEnd)="dragEnded(allDayEvent, $event, dayColumnWidth)"
|
3752 | >
|
3753 | <div
|
3754 | class="cal-resize-handle cal-resize-handle-before-start"
|
3755 | *ngIf="
|
3756 | allDayEvent.event?.resizable?.beforeStart &&
|
3757 | !allDayEvent.startsBeforeWeek
|
3758 | "
|
3759 | mwlResizeHandle
|
3760 | [resizeEdges]="{ left: true }"
|
3761 | ></div>
|
3762 | <mwl-calendar-week-view-event
|
3763 | [locale]="locale"
|
3764 | [weekEvent]="allDayEvent"
|
3765 | [tooltipPlacement]="tooltipPlacement"
|
3766 | [tooltipTemplate]="tooltipTemplate"
|
3767 | [tooltipAppendToBody]="tooltipAppendToBody"
|
3768 | [tooltipDelay]="tooltipDelay"
|
3769 | [customTemplate]="eventTemplate"
|
3770 | [eventTitleTemplate]="eventTitleTemplate"
|
3771 | [eventActionsTemplate]="eventActionsTemplate"
|
3772 | [daysInWeek]="daysInWeek"
|
3773 | (eventClicked)="
|
3774 | eventClicked.emit({
|
3775 | event: allDayEvent.event,
|
3776 | sourceEvent: $event.sourceEvent
|
3777 | })
|
3778 | "
|
3779 | >
|
3780 | </mwl-calendar-week-view-event>
|
3781 | <div
|
3782 | class="cal-resize-handle cal-resize-handle-after-end"
|
3783 | *ngIf="
|
3784 | allDayEvent.event?.resizable?.afterEnd &&
|
3785 | !allDayEvent.endsAfterWeek
|
3786 | "
|
3787 | mwlResizeHandle
|
3788 | [resizeEdges]="{ right: true }"
|
3789 | ></div>
|
3790 | </div>
|
3791 | </div>
|
3792 | </div>
|
3793 | <div
|
3794 | class="cal-time-events"
|
3795 | mwlDroppable
|
3796 | (dragEnter)="dragEnter('time')"
|
3797 | (dragLeave)="dragLeave('time')"
|
3798 | >
|
3799 | <div
|
3800 | class="cal-time-label-column"
|
3801 | *ngIf="view.hourColumns.length > 0 && daysInWeek !== 1"
|
3802 | >
|
3803 | <div
|
3804 | *ngFor="
|
3805 | let hour of view.hourColumns[0].hours;
|
3806 | trackBy: trackByHour;
|
3807 | let odd = odd
|
3808 | "
|
3809 | class="cal-hour"
|
3810 | [class.cal-hour-odd]="odd"
|
3811 | >
|
3812 | <mwl-calendar-week-view-hour-segment
|
3813 | *ngFor="let segment of hour.segments; trackBy: trackByHourSegment"
|
3814 | [style.height.px]="hourSegmentHeight"
|
3815 | [segment]="segment"
|
3816 | [segmentHeight]="hourSegmentHeight"
|
3817 | [locale]="locale"
|
3818 | [customTemplate]="hourSegmentTemplate"
|
3819 | [isTimeLabel]="true"
|
3820 | [daysInWeek]="daysInWeek"
|
3821 | >
|
3822 | </mwl-calendar-week-view-hour-segment>
|
3823 | </div>
|
3824 | </div>
|
3825 | <div
|
3826 | class="cal-day-columns"
|
3827 | [class.cal-resize-active]="timeEventResizes.size > 0"
|
3828 | #dayColumns
|
3829 | >
|
3830 | <div
|
3831 | class="cal-day-column"
|
3832 | *ngFor="let column of view.hourColumns; trackBy: trackByHourColumn"
|
3833 | >
|
3834 | <mwl-calendar-week-view-current-time-marker
|
3835 | [columnDate]="column.date"
|
3836 | [dayStartHour]="dayStartHour"
|
3837 | [dayStartMinute]="dayStartMinute"
|
3838 | [dayEndHour]="dayEndHour"
|
3839 | [dayEndMinute]="dayEndMinute"
|
3840 | [hourSegments]="hourSegments"
|
3841 | [hourDuration]="hourDuration"
|
3842 | [hourSegmentHeight]="hourSegmentHeight"
|
3843 | [customTemplate]="currentTimeMarkerTemplate"
|
3844 | ></mwl-calendar-week-view-current-time-marker>
|
3845 | <div class="cal-events-container">
|
3846 | <div
|
3847 | *ngFor="
|
3848 | let timeEvent of column.events;
|
3849 | trackBy: trackByWeekTimeEvent
|
3850 | "
|
3851 | #event
|
3852 | class="cal-event-container"
|
3853 | [class.cal-draggable]="
|
3854 | timeEvent.event.draggable && timeEventResizes.size === 0
|
3855 | "
|
3856 | [class.cal-starts-within-day]="!timeEvent.startsBeforeDay"
|
3857 | [class.cal-ends-within-day]="!timeEvent.endsAfterDay"
|
3858 | [ngClass]="timeEvent.event.cssClass"
|
3859 | [hidden]="timeEvent.height === 0 && timeEvent.width === 0"
|
3860 | [style.top.px]="timeEvent.top"
|
3861 | [style.height.px]="timeEvent.height"
|
3862 | [style.left.%]="timeEvent.left"
|
3863 | [style.width.%]="timeEvent.width"
|
3864 | mwlResizable
|
3865 | [resizeCursors]="resizeCursors"
|
3866 | [resizeSnapGrid]="{
|
3867 | left: dayColumnWidth,
|
3868 | right: dayColumnWidth,
|
3869 | top: eventSnapSize || hourSegmentHeight,
|
3870 | bottom: eventSnapSize || hourSegmentHeight
|
3871 | }"
|
3872 | [validateResize]="validateResize"
|
3873 | [allowNegativeResizes]="true"
|
3874 | (resizeStart)="
|
3875 | timeEventResizeStarted(dayColumns, timeEvent, $event)
|
3876 | "
|
3877 | (resizing)="timeEventResizing(timeEvent, $event)"
|
3878 | (resizeEnd)="timeEventResizeEnded(timeEvent)"
|
3879 | mwlDraggable
|
3880 | dragActiveClass="cal-drag-active"
|
3881 | [dropData]="{ event: timeEvent.event, calendarId: calendarId }"
|
3882 | [dragAxis]="{
|
3883 | x: timeEvent.event.draggable && timeEventResizes.size === 0,
|
3884 | y: timeEvent.event.draggable && timeEventResizes.size === 0
|
3885 | }"
|
3886 | [dragSnapGrid]="
|
3887 | snapDraggedEvents
|
3888 | ? {
|
3889 | x: dayColumnWidth,
|
3890 | y: eventSnapSize || hourSegmentHeight
|
3891 | }
|
3892 | : {}
|
3893 | "
|
3894 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
3895 | [ghostDragEnabled]="!snapDraggedEvents"
|
3896 | [ghostElementTemplate]="weekEventTemplate"
|
3897 | [validateDrag]="validateDrag"
|
3898 | (dragStart)="dragStarted(dayColumns, event, timeEvent, true)"
|
3899 | (dragging)="dragMove(timeEvent, $event)"
|
3900 | (dragEnd)="dragEnded(timeEvent, $event, dayColumnWidth, true)"
|
3901 | >
|
3902 | <div
|
3903 | class="cal-resize-handle cal-resize-handle-before-start"
|
3904 | *ngIf="
|
3905 | timeEvent.event?.resizable?.beforeStart &&
|
3906 | !timeEvent.startsBeforeDay
|
3907 | "
|
3908 | mwlResizeHandle
|
3909 | [resizeEdges]="{
|
3910 | left: true,
|
3911 | top: true
|
3912 | }"
|
3913 | ></div>
|
3914 | <ng-template
|
3915 | [ngTemplateOutlet]="weekEventTemplate"
|
3916 | ></ng-template>
|
3917 | <ng-template #weekEventTemplate>
|
3918 | <mwl-calendar-week-view-event
|
3919 | [locale]="locale"
|
3920 | [weekEvent]="timeEvent"
|
3921 | [tooltipPlacement]="tooltipPlacement"
|
3922 | [tooltipTemplate]="tooltipTemplate"
|
3923 | [tooltipAppendToBody]="tooltipAppendToBody"
|
3924 | [tooltipDisabled]="dragActive || timeEventResizes.size > 0"
|
3925 | [tooltipDelay]="tooltipDelay"
|
3926 | [customTemplate]="eventTemplate"
|
3927 | [eventTitleTemplate]="eventTitleTemplate"
|
3928 | [eventActionsTemplate]="eventActionsTemplate"
|
3929 | [column]="column"
|
3930 | [daysInWeek]="daysInWeek"
|
3931 | (eventClicked)="
|
3932 | eventClicked.emit({
|
3933 | event: timeEvent.event,
|
3934 | sourceEvent: $event.sourceEvent
|
3935 | })
|
3936 | "
|
3937 | >
|
3938 | </mwl-calendar-week-view-event>
|
3939 | </ng-template>
|
3940 | <div
|
3941 | class="cal-resize-handle cal-resize-handle-after-end"
|
3942 | *ngIf="
|
3943 | timeEvent.event?.resizable?.afterEnd &&
|
3944 | !timeEvent.endsAfterDay
|
3945 | "
|
3946 | mwlResizeHandle
|
3947 | [resizeEdges]="{
|
3948 | right: true,
|
3949 | bottom: true
|
3950 | }"
|
3951 | ></div>
|
3952 | </div>
|
3953 | </div>
|
3954 |
|
3955 | <div
|
3956 | *ngFor="
|
3957 | let hour of column.hours;
|
3958 | trackBy: trackByHour;
|
3959 | let odd = odd
|
3960 | "
|
3961 | class="cal-hour"
|
3962 | [class.cal-hour-odd]="odd"
|
3963 | >
|
3964 | <mwl-calendar-week-view-hour-segment
|
3965 | *ngFor="
|
3966 | let segment of hour.segments;
|
3967 | trackBy: trackByHourSegment
|
3968 | "
|
3969 | [style.height.px]="hourSegmentHeight"
|
3970 | [segment]="segment"
|
3971 | [segmentHeight]="hourSegmentHeight"
|
3972 | [locale]="locale"
|
3973 | [customTemplate]="hourSegmentTemplate"
|
3974 | [daysInWeek]="daysInWeek"
|
3975 | (mwlClick)="
|
3976 | hourSegmentClicked.emit({
|
3977 | date: segment.date,
|
3978 | sourceEvent: $event
|
3979 | })
|
3980 | "
|
3981 | [clickListenerDisabled]="
|
3982 | hourSegmentClicked.observers.length === 0
|
3983 | "
|
3984 | mwlDroppable
|
3985 | [dragOverClass]="
|
3986 | !dragActive || !snapDraggedEvents ? 'cal-drag-over' : null
|
3987 | "
|
3988 | dragActiveClass="cal-drag-active"
|
3989 | (drop)="eventDropped($event, segment.date, false)"
|
3990 | (dragEnter)="dateDragEnter(segment.date)"
|
3991 | [isTimeLabel]="daysInWeek === 1"
|
3992 | >
|
3993 | </mwl-calendar-week-view-hour-segment>
|
3994 | </div>
|
3995 | </div>
|
3996 | </div>
|
3997 | </div>
|
3998 | </div>
|
3999 | `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.ResizableDirective, selector: "[mwlResizable]", inputs: ["validateResize", "enableGhostResize", "resizeSnapGrid", "resizeCursors", "ghostElementPositioning", "allowNegativeResizes", "mouseMoveThrottleMS"], outputs: ["resizeStart", "resizing", "resizeEnd"], exportAs: ["mwlResizable"] }, { kind: "directive", type: i4.ResizeHandleDirective, selector: "[mwlResizeHandle]", inputs: ["resizeEdges", "resizableContainer"] }, { kind: "directive", type: i2.DraggableDirective, selector: "[mwlDraggable]", inputs: ["dropData", "dragAxis", "dragSnapGrid", "ghostDragEnabled", "showOriginalElementWhileDragging", "validateDrag", "dragCursor", "dragActiveClass", "ghostElementAppendTo", "ghostElementTemplate", "touchStartLongPress", "autoScroll"], outputs: ["dragPointerDown", "dragStart", "ghostElementCreated", "dragging", "dragEnd"] }, { kind: "directive", type: i2.DroppableDirective, selector: "[mwlDroppable]", inputs: ["dragOverClass", "dragActiveClass", "validateDrop"], outputs: ["dragEnter", "dragLeave", "dragOver", "drop"] }, { kind: "directive", type: ClickDirective, selector: "[mwlClick]", inputs: ["clickListenerDisabled"], outputs: ["mwlClick"] }, { kind: "component", type: CalendarWeekViewHeaderComponent, selector: "mwl-calendar-week-view-header", inputs: ["days", "locale", "customTemplate"], outputs: ["dayHeaderClicked", "eventDropped", "dragEnter"] }, { kind: "component", type: CalendarWeekViewEventComponent, selector: "mwl-calendar-week-view-event", inputs: ["locale", "weekEvent", "tooltipPlacement", "tooltipAppendToBody", "tooltipDisabled", "tooltipDelay", "customTemplate", "eventTitleTemplate", "eventActionsTemplate", "tooltipTemplate", "column", "daysInWeek"], outputs: ["eventClicked"] }, { kind: "component", type: CalendarWeekViewHourSegmentComponent, selector: "mwl-calendar-week-view-hour-segment", inputs: ["segment", "segmentHeight", "locale", "isTimeLabel", "daysInWeek", "customTemplate"] }, { kind: "component", type: CalendarWeekViewCurrentTimeMarkerComponent, selector: "mwl-calendar-week-view-current-time-marker", inputs: ["columnDate", "dayStartHour", "dayStartMinute", "dayEndHour", "dayEndMinute", "hourSegments", "hourDuration", "hourSegmentHeight", "customTemplate"] }] });
|
4000 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekViewComponent, decorators: [{
|
4001 | type: Component,
|
4002 | args: [{
|
4003 | selector: 'mwl-calendar-week-view',
|
4004 | template: `
|
4005 | <div class="cal-week-view" role="grid">
|
4006 | <mwl-calendar-week-view-header
|
4007 | [days]="days"
|
4008 | [locale]="locale"
|
4009 | [customTemplate]="headerTemplate"
|
4010 | (dayHeaderClicked)="dayHeaderClicked.emit($event)"
|
4011 | (eventDropped)="
|
4012 | eventDropped({ dropData: $event }, $event.newStart, true)
|
4013 | "
|
4014 | (dragEnter)="dateDragEnter($event.date)"
|
4015 | >
|
4016 | </mwl-calendar-week-view-header>
|
4017 | <div
|
4018 | class="cal-all-day-events"
|
4019 | #allDayEventsContainer
|
4020 | *ngIf="view.allDayEventRows.length > 0"
|
4021 | mwlDroppable
|
4022 | (dragEnter)="dragEnter('allDay')"
|
4023 | (dragLeave)="dragLeave('allDay')"
|
4024 | >
|
4025 | <div class="cal-day-columns">
|
4026 | <div class="cal-time-label-column">
|
4027 | <ng-container
|
4028 | *ngTemplateOutlet="allDayEventsLabelTemplate"
|
4029 | ></ng-container>
|
4030 | </div>
|
4031 | <div
|
4032 | class="cal-day-column"
|
4033 | *ngFor="let day of days; trackBy: trackByWeekDayHeaderDate"
|
4034 | mwlDroppable
|
4035 | dragOverClass="cal-drag-over"
|
4036 | (drop)="eventDropped($event, day.date, true)"
|
4037 | (dragEnter)="dateDragEnter(day.date)"
|
4038 | ></div>
|
4039 | </div>
|
4040 | <div
|
4041 | *ngFor="let eventRow of view.allDayEventRows; trackBy: trackById"
|
4042 | #eventRowContainer
|
4043 | class="cal-events-row"
|
4044 | >
|
4045 | <div
|
4046 | *ngFor="
|
4047 | let allDayEvent of eventRow.row;
|
4048 | trackBy: trackByWeekAllDayEvent
|
4049 | "
|
4050 | #event
|
4051 | class="cal-event-container"
|
4052 | [class.cal-draggable]="
|
4053 | allDayEvent.event.draggable && allDayEventResizes.size === 0
|
4054 | "
|
4055 | [class.cal-starts-within-week]="!allDayEvent.startsBeforeWeek"
|
4056 | [class.cal-ends-within-week]="!allDayEvent.endsAfterWeek"
|
4057 | [ngClass]="allDayEvent.event?.cssClass"
|
4058 | [style.width.%]="(100 / days.length) * allDayEvent.span"
|
4059 | [style.marginLeft.%]="
|
4060 | rtl ? null : (100 / days.length) * allDayEvent.offset
|
4061 | "
|
4062 | [style.marginRight.%]="
|
4063 | rtl ? (100 / days.length) * allDayEvent.offset : null
|
4064 | "
|
4065 | mwlResizable
|
4066 | [resizeCursors]="resizeCursors"
|
4067 | [resizeSnapGrid]="{ left: dayColumnWidth, right: dayColumnWidth }"
|
4068 | [validateResize]="validateResize"
|
4069 | (resizeStart)="
|
4070 | allDayEventResizeStarted(eventRowContainer, allDayEvent, $event)
|
4071 | "
|
4072 | (resizing)="
|
4073 | allDayEventResizing(allDayEvent, $event, dayColumnWidth)
|
4074 | "
|
4075 | (resizeEnd)="allDayEventResizeEnded(allDayEvent)"
|
4076 | mwlDraggable
|
4077 | dragActiveClass="cal-drag-active"
|
4078 | [dropData]="{ event: allDayEvent.event, calendarId: calendarId }"
|
4079 | [dragAxis]="{
|
4080 | x: allDayEvent.event.draggable && allDayEventResizes.size === 0,
|
4081 | y:
|
4082 | !snapDraggedEvents &&
|
4083 | allDayEvent.event.draggable &&
|
4084 | allDayEventResizes.size === 0
|
4085 | }"
|
4086 | [dragSnapGrid]="snapDraggedEvents ? { x: dayColumnWidth } : {}"
|
4087 | [validateDrag]="validateDrag"
|
4088 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
4089 | (dragStart)="
|
4090 | dragStarted(eventRowContainer, event, allDayEvent, false)
|
4091 | "
|
4092 | (dragging)="allDayEventDragMove()"
|
4093 | (dragEnd)="dragEnded(allDayEvent, $event, dayColumnWidth)"
|
4094 | >
|
4095 | <div
|
4096 | class="cal-resize-handle cal-resize-handle-before-start"
|
4097 | *ngIf="
|
4098 | allDayEvent.event?.resizable?.beforeStart &&
|
4099 | !allDayEvent.startsBeforeWeek
|
4100 | "
|
4101 | mwlResizeHandle
|
4102 | [resizeEdges]="{ left: true }"
|
4103 | ></div>
|
4104 | <mwl-calendar-week-view-event
|
4105 | [locale]="locale"
|
4106 | [weekEvent]="allDayEvent"
|
4107 | [tooltipPlacement]="tooltipPlacement"
|
4108 | [tooltipTemplate]="tooltipTemplate"
|
4109 | [tooltipAppendToBody]="tooltipAppendToBody"
|
4110 | [tooltipDelay]="tooltipDelay"
|
4111 | [customTemplate]="eventTemplate"
|
4112 | [eventTitleTemplate]="eventTitleTemplate"
|
4113 | [eventActionsTemplate]="eventActionsTemplate"
|
4114 | [daysInWeek]="daysInWeek"
|
4115 | (eventClicked)="
|
4116 | eventClicked.emit({
|
4117 | event: allDayEvent.event,
|
4118 | sourceEvent: $event.sourceEvent
|
4119 | })
|
4120 | "
|
4121 | >
|
4122 | </mwl-calendar-week-view-event>
|
4123 | <div
|
4124 | class="cal-resize-handle cal-resize-handle-after-end"
|
4125 | *ngIf="
|
4126 | allDayEvent.event?.resizable?.afterEnd &&
|
4127 | !allDayEvent.endsAfterWeek
|
4128 | "
|
4129 | mwlResizeHandle
|
4130 | [resizeEdges]="{ right: true }"
|
4131 | ></div>
|
4132 | </div>
|
4133 | </div>
|
4134 | </div>
|
4135 | <div
|
4136 | class="cal-time-events"
|
4137 | mwlDroppable
|
4138 | (dragEnter)="dragEnter('time')"
|
4139 | (dragLeave)="dragLeave('time')"
|
4140 | >
|
4141 | <div
|
4142 | class="cal-time-label-column"
|
4143 | *ngIf="view.hourColumns.length > 0 && daysInWeek !== 1"
|
4144 | >
|
4145 | <div
|
4146 | *ngFor="
|
4147 | let hour of view.hourColumns[0].hours;
|
4148 | trackBy: trackByHour;
|
4149 | let odd = odd
|
4150 | "
|
4151 | class="cal-hour"
|
4152 | [class.cal-hour-odd]="odd"
|
4153 | >
|
4154 | <mwl-calendar-week-view-hour-segment
|
4155 | *ngFor="let segment of hour.segments; trackBy: trackByHourSegment"
|
4156 | [style.height.px]="hourSegmentHeight"
|
4157 | [segment]="segment"
|
4158 | [segmentHeight]="hourSegmentHeight"
|
4159 | [locale]="locale"
|
4160 | [customTemplate]="hourSegmentTemplate"
|
4161 | [isTimeLabel]="true"
|
4162 | [daysInWeek]="daysInWeek"
|
4163 | >
|
4164 | </mwl-calendar-week-view-hour-segment>
|
4165 | </div>
|
4166 | </div>
|
4167 | <div
|
4168 | class="cal-day-columns"
|
4169 | [class.cal-resize-active]="timeEventResizes.size > 0"
|
4170 | #dayColumns
|
4171 | >
|
4172 | <div
|
4173 | class="cal-day-column"
|
4174 | *ngFor="let column of view.hourColumns; trackBy: trackByHourColumn"
|
4175 | >
|
4176 | <mwl-calendar-week-view-current-time-marker
|
4177 | [columnDate]="column.date"
|
4178 | [dayStartHour]="dayStartHour"
|
4179 | [dayStartMinute]="dayStartMinute"
|
4180 | [dayEndHour]="dayEndHour"
|
4181 | [dayEndMinute]="dayEndMinute"
|
4182 | [hourSegments]="hourSegments"
|
4183 | [hourDuration]="hourDuration"
|
4184 | [hourSegmentHeight]="hourSegmentHeight"
|
4185 | [customTemplate]="currentTimeMarkerTemplate"
|
4186 | ></mwl-calendar-week-view-current-time-marker>
|
4187 | <div class="cal-events-container">
|
4188 | <div
|
4189 | *ngFor="
|
4190 | let timeEvent of column.events;
|
4191 | trackBy: trackByWeekTimeEvent
|
4192 | "
|
4193 | #event
|
4194 | class="cal-event-container"
|
4195 | [class.cal-draggable]="
|
4196 | timeEvent.event.draggable && timeEventResizes.size === 0
|
4197 | "
|
4198 | [class.cal-starts-within-day]="!timeEvent.startsBeforeDay"
|
4199 | [class.cal-ends-within-day]="!timeEvent.endsAfterDay"
|
4200 | [ngClass]="timeEvent.event.cssClass"
|
4201 | [hidden]="timeEvent.height === 0 && timeEvent.width === 0"
|
4202 | [style.top.px]="timeEvent.top"
|
4203 | [style.height.px]="timeEvent.height"
|
4204 | [style.left.%]="timeEvent.left"
|
4205 | [style.width.%]="timeEvent.width"
|
4206 | mwlResizable
|
4207 | [resizeCursors]="resizeCursors"
|
4208 | [resizeSnapGrid]="{
|
4209 | left: dayColumnWidth,
|
4210 | right: dayColumnWidth,
|
4211 | top: eventSnapSize || hourSegmentHeight,
|
4212 | bottom: eventSnapSize || hourSegmentHeight
|
4213 | }"
|
4214 | [validateResize]="validateResize"
|
4215 | [allowNegativeResizes]="true"
|
4216 | (resizeStart)="
|
4217 | timeEventResizeStarted(dayColumns, timeEvent, $event)
|
4218 | "
|
4219 | (resizing)="timeEventResizing(timeEvent, $event)"
|
4220 | (resizeEnd)="timeEventResizeEnded(timeEvent)"
|
4221 | mwlDraggable
|
4222 | dragActiveClass="cal-drag-active"
|
4223 | [dropData]="{ event: timeEvent.event, calendarId: calendarId }"
|
4224 | [dragAxis]="{
|
4225 | x: timeEvent.event.draggable && timeEventResizes.size === 0,
|
4226 | y: timeEvent.event.draggable && timeEventResizes.size === 0
|
4227 | }"
|
4228 | [dragSnapGrid]="
|
4229 | snapDraggedEvents
|
4230 | ? {
|
4231 | x: dayColumnWidth,
|
4232 | y: eventSnapSize || hourSegmentHeight
|
4233 | }
|
4234 | : {}
|
4235 | "
|
4236 | [touchStartLongPress]="{ delay: 300, delta: 30 }"
|
4237 | [ghostDragEnabled]="!snapDraggedEvents"
|
4238 | [ghostElementTemplate]="weekEventTemplate"
|
4239 | [validateDrag]="validateDrag"
|
4240 | (dragStart)="dragStarted(dayColumns, event, timeEvent, true)"
|
4241 | (dragging)="dragMove(timeEvent, $event)"
|
4242 | (dragEnd)="dragEnded(timeEvent, $event, dayColumnWidth, true)"
|
4243 | >
|
4244 | <div
|
4245 | class="cal-resize-handle cal-resize-handle-before-start"
|
4246 | *ngIf="
|
4247 | timeEvent.event?.resizable?.beforeStart &&
|
4248 | !timeEvent.startsBeforeDay
|
4249 | "
|
4250 | mwlResizeHandle
|
4251 | [resizeEdges]="{
|
4252 | left: true,
|
4253 | top: true
|
4254 | }"
|
4255 | ></div>
|
4256 | <ng-template
|
4257 | [ngTemplateOutlet]="weekEventTemplate"
|
4258 | ></ng-template>
|
4259 | <ng-template #weekEventTemplate>
|
4260 | <mwl-calendar-week-view-event
|
4261 | [locale]="locale"
|
4262 | [weekEvent]="timeEvent"
|
4263 | [tooltipPlacement]="tooltipPlacement"
|
4264 | [tooltipTemplate]="tooltipTemplate"
|
4265 | [tooltipAppendToBody]="tooltipAppendToBody"
|
4266 | [tooltipDisabled]="dragActive || timeEventResizes.size > 0"
|
4267 | [tooltipDelay]="tooltipDelay"
|
4268 | [customTemplate]="eventTemplate"
|
4269 | [eventTitleTemplate]="eventTitleTemplate"
|
4270 | [eventActionsTemplate]="eventActionsTemplate"
|
4271 | [column]="column"
|
4272 | [daysInWeek]="daysInWeek"
|
4273 | (eventClicked)="
|
4274 | eventClicked.emit({
|
4275 | event: timeEvent.event,
|
4276 | sourceEvent: $event.sourceEvent
|
4277 | })
|
4278 | "
|
4279 | >
|
4280 | </mwl-calendar-week-view-event>
|
4281 | </ng-template>
|
4282 | <div
|
4283 | class="cal-resize-handle cal-resize-handle-after-end"
|
4284 | *ngIf="
|
4285 | timeEvent.event?.resizable?.afterEnd &&
|
4286 | !timeEvent.endsAfterDay
|
4287 | "
|
4288 | mwlResizeHandle
|
4289 | [resizeEdges]="{
|
4290 | right: true,
|
4291 | bottom: true
|
4292 | }"
|
4293 | ></div>
|
4294 | </div>
|
4295 | </div>
|
4296 |
|
4297 | <div
|
4298 | *ngFor="
|
4299 | let hour of column.hours;
|
4300 | trackBy: trackByHour;
|
4301 | let odd = odd
|
4302 | "
|
4303 | class="cal-hour"
|
4304 | [class.cal-hour-odd]="odd"
|
4305 | >
|
4306 | <mwl-calendar-week-view-hour-segment
|
4307 | *ngFor="
|
4308 | let segment of hour.segments;
|
4309 | trackBy: trackByHourSegment
|
4310 | "
|
4311 | [style.height.px]="hourSegmentHeight"
|
4312 | [segment]="segment"
|
4313 | [segmentHeight]="hourSegmentHeight"
|
4314 | [locale]="locale"
|
4315 | [customTemplate]="hourSegmentTemplate"
|
4316 | [daysInWeek]="daysInWeek"
|
4317 | (mwlClick)="
|
4318 | hourSegmentClicked.emit({
|
4319 | date: segment.date,
|
4320 | sourceEvent: $event
|
4321 | })
|
4322 | "
|
4323 | [clickListenerDisabled]="
|
4324 | hourSegmentClicked.observers.length === 0
|
4325 | "
|
4326 | mwlDroppable
|
4327 | [dragOverClass]="
|
4328 | !dragActive || !snapDraggedEvents ? 'cal-drag-over' : null
|
4329 | "
|
4330 | dragActiveClass="cal-drag-active"
|
4331 | (drop)="eventDropped($event, segment.date, false)"
|
4332 | (dragEnter)="dateDragEnter(segment.date)"
|
4333 | [isTimeLabel]="daysInWeek === 1"
|
4334 | >
|
4335 | </mwl-calendar-week-view-hour-segment>
|
4336 | </div>
|
4337 | </div>
|
4338 | </div>
|
4339 | </div>
|
4340 | </div>
|
4341 | `,
|
4342 | }]
|
4343 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: CalendarUtils }, { type: undefined, decorators: [{
|
4344 | type: Inject,
|
4345 | args: [LOCALE_ID]
|
4346 | }] }, { type: DateAdapter }, { type: i0.ElementRef }]; }, propDecorators: { viewDate: [{
|
4347 | type: Input
|
4348 | }], events: [{
|
4349 | type: Input
|
4350 | }], excludeDays: [{
|
4351 | type: Input
|
4352 | }], refresh: [{
|
4353 | type: Input
|
4354 | }], locale: [{
|
4355 | type: Input
|
4356 | }], tooltipPlacement: [{
|
4357 | type: Input
|
4358 | }], tooltipTemplate: [{
|
4359 | type: Input
|
4360 | }], tooltipAppendToBody: [{
|
4361 | type: Input
|
4362 | }], tooltipDelay: [{
|
4363 | type: Input
|
4364 | }], weekStartsOn: [{
|
4365 | type: Input
|
4366 | }], headerTemplate: [{
|
4367 | type: Input
|
4368 | }], eventTemplate: [{
|
4369 | type: Input
|
4370 | }], eventTitleTemplate: [{
|
4371 | type: Input
|
4372 | }], eventActionsTemplate: [{
|
4373 | type: Input
|
4374 | }], precision: [{
|
4375 | type: Input
|
4376 | }], weekendDays: [{
|
4377 | type: Input
|
4378 | }], snapDraggedEvents: [{
|
4379 | type: Input
|
4380 | }], hourSegments: [{
|
4381 | type: Input
|
4382 | }], hourDuration: [{
|
4383 | type: Input
|
4384 | }], hourSegmentHeight: [{
|
4385 | type: Input
|
4386 | }], minimumEventHeight: [{
|
4387 | type: Input
|
4388 | }], dayStartHour: [{
|
4389 | type: Input
|
4390 | }], dayStartMinute: [{
|
4391 | type: Input
|
4392 | }], dayEndHour: [{
|
4393 | type: Input
|
4394 | }], dayEndMinute: [{
|
4395 | type: Input
|
4396 | }], hourSegmentTemplate: [{
|
4397 | type: Input
|
4398 | }], eventSnapSize: [{
|
4399 | type: Input
|
4400 | }], allDayEventsLabelTemplate: [{
|
4401 | type: Input
|
4402 | }], daysInWeek: [{
|
4403 | type: Input
|
4404 | }], currentTimeMarkerTemplate: [{
|
4405 | type: Input
|
4406 | }], validateEventTimesChanged: [{
|
4407 | type: Input
|
4408 | }], resizeCursors: [{
|
4409 | type: Input
|
4410 | }], dayHeaderClicked: [{
|
4411 | type: Output
|
4412 | }], eventClicked: [{
|
4413 | type: Output
|
4414 | }], eventTimesChanged: [{
|
4415 | type: Output
|
4416 | }], beforeViewRender: [{
|
4417 | type: Output
|
4418 | }], hourSegmentClicked: [{
|
4419 | type: Output
|
4420 | }] } });
|
4421 |
|
4422 | class CalendarWeekModule {
|
4423 | }
|
4424 | CalendarWeekModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
4425 | CalendarWeekModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekModule, declarations: [CalendarWeekViewComponent,
|
4426 | CalendarWeekViewHeaderComponent,
|
4427 | CalendarWeekViewEventComponent,
|
4428 | CalendarWeekViewHourSegmentComponent,
|
4429 | CalendarWeekViewCurrentTimeMarkerComponent], imports: [CommonModule,
|
4430 | ResizableModule,
|
4431 | DragAndDropModule,
|
4432 | CalendarCommonModule], exports: [ResizableModule,
|
4433 | DragAndDropModule,
|
4434 | CalendarWeekViewComponent,
|
4435 | CalendarWeekViewHeaderComponent,
|
4436 | CalendarWeekViewEventComponent,
|
4437 | CalendarWeekViewHourSegmentComponent,
|
4438 | CalendarWeekViewCurrentTimeMarkerComponent] });
|
4439 | CalendarWeekModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekModule, imports: [CommonModule,
|
4440 | ResizableModule,
|
4441 | DragAndDropModule,
|
4442 | CalendarCommonModule, ResizableModule,
|
4443 | DragAndDropModule] });
|
4444 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarWeekModule, decorators: [{
|
4445 | type: NgModule,
|
4446 | args: [{
|
4447 | imports: [
|
4448 | CommonModule,
|
4449 | ResizableModule,
|
4450 | DragAndDropModule,
|
4451 | CalendarCommonModule,
|
4452 | ],
|
4453 | declarations: [
|
4454 | CalendarWeekViewComponent,
|
4455 | CalendarWeekViewHeaderComponent,
|
4456 | CalendarWeekViewEventComponent,
|
4457 | CalendarWeekViewHourSegmentComponent,
|
4458 | CalendarWeekViewCurrentTimeMarkerComponent,
|
4459 | ],
|
4460 | exports: [
|
4461 | ResizableModule,
|
4462 | DragAndDropModule,
|
4463 | CalendarWeekViewComponent,
|
4464 | CalendarWeekViewHeaderComponent,
|
4465 | CalendarWeekViewEventComponent,
|
4466 | CalendarWeekViewHourSegmentComponent,
|
4467 | CalendarWeekViewCurrentTimeMarkerComponent,
|
4468 | ],
|
4469 | }]
|
4470 | }] });
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 | class CalendarDayViewComponent {
|
4483 | constructor() {
|
4484 | |
4485 |
|
4486 |
|
4487 |
|
4488 | this.events = [];
|
4489 | |
4490 |
|
4491 |
|
4492 | this.hourSegments = 2;
|
4493 | |
4494 |
|
4495 |
|
4496 | this.hourSegmentHeight = 30;
|
4497 | |
4498 |
|
4499 |
|
4500 | this.minimumEventHeight = 30;
|
4501 | |
4502 |
|
4503 |
|
4504 | this.dayStartHour = 0;
|
4505 | |
4506 |
|
4507 |
|
4508 | this.dayStartMinute = 0;
|
4509 | |
4510 |
|
4511 |
|
4512 | this.dayEndHour = 23;
|
4513 | |
4514 |
|
4515 |
|
4516 | this.dayEndMinute = 59;
|
4517 | |
4518 |
|
4519 |
|
4520 | this.tooltipPlacement = 'auto';
|
4521 | |
4522 |
|
4523 |
|
4524 | this.tooltipAppendToBody = true;
|
4525 | |
4526 |
|
4527 |
|
4528 |
|
4529 | this.tooltipDelay = null;
|
4530 | |
4531 |
|
4532 |
|
4533 | this.snapDraggedEvents = true;
|
4534 | |
4535 |
|
4536 |
|
4537 | this.eventClicked = new EventEmitter();
|
4538 | |
4539 |
|
4540 |
|
4541 | this.hourSegmentClicked = new EventEmitter();
|
4542 | |
4543 |
|
4544 |
|
4545 | this.eventTimesChanged = new EventEmitter();
|
4546 | |
4547 |
|
4548 |
|
4549 |
|
4550 | this.beforeViewRender = new EventEmitter();
|
4551 | }
|
4552 | }
|
4553 | CalendarDayViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
4554 | CalendarDayViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: CalendarDayViewComponent, selector: "mwl-calendar-day-view", inputs: { viewDate: "viewDate", events: "events", hourSegments: "hourSegments", hourSegmentHeight: "hourSegmentHeight", hourDuration: "hourDuration", minimumEventHeight: "minimumEventHeight", dayStartHour: "dayStartHour", dayStartMinute: "dayStartMinute", dayEndHour: "dayEndHour", dayEndMinute: "dayEndMinute", refresh: "refresh", locale: "locale", eventSnapSize: "eventSnapSize", tooltipPlacement: "tooltipPlacement", tooltipTemplate: "tooltipTemplate", tooltipAppendToBody: "tooltipAppendToBody", tooltipDelay: "tooltipDelay", hourSegmentTemplate: "hourSegmentTemplate", eventTemplate: "eventTemplate", eventTitleTemplate: "eventTitleTemplate", eventActionsTemplate: "eventActionsTemplate", snapDraggedEvents: "snapDraggedEvents", allDayEventsLabelTemplate: "allDayEventsLabelTemplate", currentTimeMarkerTemplate: "currentTimeMarkerTemplate", validateEventTimesChanged: "validateEventTimesChanged", resizeCursors: "resizeCursors" }, outputs: { eventClicked: "eventClicked", hourSegmentClicked: "hourSegmentClicked", eventTimesChanged: "eventTimesChanged", beforeViewRender: "beforeViewRender" }, ngImport: i0, template: `
|
4555 | <mwl-calendar-week-view
|
4556 | class="cal-day-view"
|
4557 | [daysInWeek]="1"
|
4558 | [viewDate]="viewDate"
|
4559 | [events]="events"
|
4560 | [hourSegments]="hourSegments"
|
4561 | [hourDuration]="hourDuration"
|
4562 | [hourSegmentHeight]="hourSegmentHeight"
|
4563 | [minimumEventHeight]="minimumEventHeight"
|
4564 | [dayStartHour]="dayStartHour"
|
4565 | [dayStartMinute]="dayStartMinute"
|
4566 | [dayEndHour]="dayEndHour"
|
4567 | [dayEndMinute]="dayEndMinute"
|
4568 | [refresh]="refresh"
|
4569 | [locale]="locale"
|
4570 | [eventSnapSize]="eventSnapSize"
|
4571 | [tooltipPlacement]="tooltipPlacement"
|
4572 | [tooltipTemplate]="tooltipTemplate"
|
4573 | [tooltipAppendToBody]="tooltipAppendToBody"
|
4574 | [tooltipDelay]="tooltipDelay"
|
4575 | [resizeCursors]="resizeCursors"
|
4576 | [hourSegmentTemplate]="hourSegmentTemplate"
|
4577 | [eventTemplate]="eventTemplate"
|
4578 | [eventTitleTemplate]="eventTitleTemplate"
|
4579 | [eventActionsTemplate]="eventActionsTemplate"
|
4580 | [snapDraggedEvents]="snapDraggedEvents"
|
4581 | [allDayEventsLabelTemplate]="allDayEventsLabelTemplate"
|
4582 | [currentTimeMarkerTemplate]="currentTimeMarkerTemplate"
|
4583 | [validateEventTimesChanged]="validateEventTimesChanged"
|
4584 | (eventClicked)="eventClicked.emit($event)"
|
4585 | (hourSegmentClicked)="hourSegmentClicked.emit($event)"
|
4586 | (eventTimesChanged)="eventTimesChanged.emit($event)"
|
4587 | (beforeViewRender)="beforeViewRender.emit($event)"
|
4588 | ></mwl-calendar-week-view>
|
4589 | `, isInline: true, dependencies: [{ kind: "component", type: CalendarWeekViewComponent, selector: "mwl-calendar-week-view", inputs: ["viewDate", "events", "excludeDays", "refresh", "locale", "tooltipPlacement", "tooltipTemplate", "tooltipAppendToBody", "tooltipDelay", "weekStartsOn", "headerTemplate", "eventTemplate", "eventTitleTemplate", "eventActionsTemplate", "precision", "weekendDays", "snapDraggedEvents", "hourSegments", "hourDuration", "hourSegmentHeight", "minimumEventHeight", "dayStartHour", "dayStartMinute", "dayEndHour", "dayEndMinute", "hourSegmentTemplate", "eventSnapSize", "allDayEventsLabelTemplate", "daysInWeek", "currentTimeMarkerTemplate", "validateEventTimesChanged", "resizeCursors"], outputs: ["dayHeaderClicked", "eventClicked", "eventTimesChanged", "beforeViewRender", "hourSegmentClicked"] }] });
|
4590 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayViewComponent, decorators: [{
|
4591 | type: Component,
|
4592 | args: [{
|
4593 | selector: 'mwl-calendar-day-view',
|
4594 | template: `
|
4595 | <mwl-calendar-week-view
|
4596 | class="cal-day-view"
|
4597 | [daysInWeek]="1"
|
4598 | [viewDate]="viewDate"
|
4599 | [events]="events"
|
4600 | [hourSegments]="hourSegments"
|
4601 | [hourDuration]="hourDuration"
|
4602 | [hourSegmentHeight]="hourSegmentHeight"
|
4603 | [minimumEventHeight]="minimumEventHeight"
|
4604 | [dayStartHour]="dayStartHour"
|
4605 | [dayStartMinute]="dayStartMinute"
|
4606 | [dayEndHour]="dayEndHour"
|
4607 | [dayEndMinute]="dayEndMinute"
|
4608 | [refresh]="refresh"
|
4609 | [locale]="locale"
|
4610 | [eventSnapSize]="eventSnapSize"
|
4611 | [tooltipPlacement]="tooltipPlacement"
|
4612 | [tooltipTemplate]="tooltipTemplate"
|
4613 | [tooltipAppendToBody]="tooltipAppendToBody"
|
4614 | [tooltipDelay]="tooltipDelay"
|
4615 | [resizeCursors]="resizeCursors"
|
4616 | [hourSegmentTemplate]="hourSegmentTemplate"
|
4617 | [eventTemplate]="eventTemplate"
|
4618 | [eventTitleTemplate]="eventTitleTemplate"
|
4619 | [eventActionsTemplate]="eventActionsTemplate"
|
4620 | [snapDraggedEvents]="snapDraggedEvents"
|
4621 | [allDayEventsLabelTemplate]="allDayEventsLabelTemplate"
|
4622 | [currentTimeMarkerTemplate]="currentTimeMarkerTemplate"
|
4623 | [validateEventTimesChanged]="validateEventTimesChanged"
|
4624 | (eventClicked)="eventClicked.emit($event)"
|
4625 | (hourSegmentClicked)="hourSegmentClicked.emit($event)"
|
4626 | (eventTimesChanged)="eventTimesChanged.emit($event)"
|
4627 | (beforeViewRender)="beforeViewRender.emit($event)"
|
4628 | ></mwl-calendar-week-view>
|
4629 | `,
|
4630 | }]
|
4631 | }], propDecorators: { viewDate: [{
|
4632 | type: Input
|
4633 | }], events: [{
|
4634 | type: Input
|
4635 | }], hourSegments: [{
|
4636 | type: Input
|
4637 | }], hourSegmentHeight: [{
|
4638 | type: Input
|
4639 | }], hourDuration: [{
|
4640 | type: Input
|
4641 | }], minimumEventHeight: [{
|
4642 | type: Input
|
4643 | }], dayStartHour: [{
|
4644 | type: Input
|
4645 | }], dayStartMinute: [{
|
4646 | type: Input
|
4647 | }], dayEndHour: [{
|
4648 | type: Input
|
4649 | }], dayEndMinute: [{
|
4650 | type: Input
|
4651 | }], refresh: [{
|
4652 | type: Input
|
4653 | }], locale: [{
|
4654 | type: Input
|
4655 | }], eventSnapSize: [{
|
4656 | type: Input
|
4657 | }], tooltipPlacement: [{
|
4658 | type: Input
|
4659 | }], tooltipTemplate: [{
|
4660 | type: Input
|
4661 | }], tooltipAppendToBody: [{
|
4662 | type: Input
|
4663 | }], tooltipDelay: [{
|
4664 | type: Input
|
4665 | }], hourSegmentTemplate: [{
|
4666 | type: Input
|
4667 | }], eventTemplate: [{
|
4668 | type: Input
|
4669 | }], eventTitleTemplate: [{
|
4670 | type: Input
|
4671 | }], eventActionsTemplate: [{
|
4672 | type: Input
|
4673 | }], snapDraggedEvents: [{
|
4674 | type: Input
|
4675 | }], allDayEventsLabelTemplate: [{
|
4676 | type: Input
|
4677 | }], currentTimeMarkerTemplate: [{
|
4678 | type: Input
|
4679 | }], validateEventTimesChanged: [{
|
4680 | type: Input
|
4681 | }], resizeCursors: [{
|
4682 | type: Input
|
4683 | }], eventClicked: [{
|
4684 | type: Output
|
4685 | }], hourSegmentClicked: [{
|
4686 | type: Output
|
4687 | }], eventTimesChanged: [{
|
4688 | type: Output
|
4689 | }], beforeViewRender: [{
|
4690 | type: Output
|
4691 | }] } });
|
4692 |
|
4693 | class CalendarDayModule {
|
4694 | }
|
4695 | CalendarDayModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
4696 | CalendarDayModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayModule, declarations: [CalendarDayViewComponent], imports: [CommonModule, CalendarCommonModule, CalendarWeekModule], exports: [CalendarDayViewComponent] });
|
4697 | CalendarDayModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayModule, imports: [CommonModule, CalendarCommonModule, CalendarWeekModule] });
|
4698 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarDayModule, decorators: [{
|
4699 | type: NgModule,
|
4700 | args: [{
|
4701 | imports: [CommonModule, CalendarCommonModule, CalendarWeekModule],
|
4702 | declarations: [CalendarDayViewComponent],
|
4703 | exports: [CalendarDayViewComponent],
|
4704 | }]
|
4705 | }] });
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 |
|
4716 |
|
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 |
|
4722 | class CalendarModule {
|
4723 | static forRoot(dateAdapter, config = {}) {
|
4724 | return {
|
4725 | ngModule: CalendarModule,
|
4726 | providers: [
|
4727 | dateAdapter,
|
4728 | config.eventTitleFormatter || CalendarEventTitleFormatter,
|
4729 | config.dateFormatter || CalendarDateFormatter,
|
4730 | config.utils || CalendarUtils,
|
4731 | config.a11y || CalendarA11y,
|
4732 | ],
|
4733 | };
|
4734 | }
|
4735 | }
|
4736 | CalendarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
4737 | CalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: CalendarModule, imports: [CalendarCommonModule,
|
4738 | CalendarMonthModule,
|
4739 | CalendarWeekModule,
|
4740 | CalendarDayModule], exports: [CalendarCommonModule,
|
4741 | CalendarMonthModule,
|
4742 | CalendarWeekModule,
|
4743 | CalendarDayModule] });
|
4744 | CalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarModule, imports: [CalendarCommonModule,
|
4745 | CalendarMonthModule,
|
4746 | CalendarWeekModule,
|
4747 | CalendarDayModule, CalendarCommonModule,
|
4748 | CalendarMonthModule,
|
4749 | CalendarWeekModule,
|
4750 | CalendarDayModule] });
|
4751 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: CalendarModule, decorators: [{
|
4752 | type: NgModule,
|
4753 | args: [{
|
4754 | imports: [
|
4755 | CalendarCommonModule,
|
4756 | CalendarMonthModule,
|
4757 | CalendarWeekModule,
|
4758 | CalendarDayModule,
|
4759 | ],
|
4760 | exports: [
|
4761 | CalendarCommonModule,
|
4762 | CalendarMonthModule,
|
4763 | CalendarWeekModule,
|
4764 | CalendarDayModule,
|
4765 | ],
|
4766 | }]
|
4767 | }] });
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 | export { CalendarA11y, CalendarAngularDateFormatter, CalendarCommonModule, CalendarDateFormatter, CalendarDayModule, CalendarDayViewComponent, CalendarEventTimesChangedEventType, CalendarEventTitleFormatter, CalendarModule, CalendarMomentDateFormatter, CalendarMonthModule, CalendarMonthViewComponent, CalendarNativeDateFormatter, CalendarUtils, CalendarView, CalendarWeekModule, CalendarWeekViewComponent, DateAdapter, MOMENT, collapseAnimation, getWeekViewPeriod, CalendarA11yPipe as ɵCalendarA11yPipe, CalendarDatePipe as ɵCalendarDatePipe, CalendarEventActionsComponent as ɵCalendarEventActionsComponent, CalendarEventTitleComponent as ɵCalendarEventTitleComponent, CalendarEventTitlePipe as ɵCalendarEventTitlePipe, CalendarMonthCellComponent as ɵCalendarMonthCellComponent, CalendarMonthViewHeaderComponent as ɵCalendarMonthViewHeaderComponent, CalendarNextViewDirective as ɵCalendarNextViewDirective, CalendarOpenDayEventsComponent as ɵCalendarOpenDayEventsComponent, CalendarPreviousViewDirective as ɵCalendarPreviousViewDirective, CalendarTodayDirective as ɵCalendarTodayDirective, CalendarTooltipDirective as ɵCalendarTooltipDirective, CalendarTooltipWindowComponent as ɵCalendarTooltipWindowComponent, CalendarWeekViewCurrentTimeMarkerComponent as ɵCalendarWeekViewCurrentTimeMarkerComponent, CalendarWeekViewEventComponent as ɵCalendarWeekViewEventComponent, CalendarWeekViewHeaderComponent as ɵCalendarWeekViewHeaderComponent, CalendarWeekViewHourSegmentComponent as ɵCalendarWeekViewHourSegmentComponent, ClickDirective as ɵClickDirective, KeydownEnterDirective as ɵKeydownEnterDirective };
|
4778 |
|
4779 |
|