@syncfusion/ej2-schedule 30.2.4 → 31.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-schedule.min.js +2 -2
- package/dist/ej2-schedule.umd.min.js +2 -2
- package/dist/ej2-schedule.umd.min.js.map +1 -1
- package/dist/es6/ej2-schedule.es2015.js +132 -43
- package/dist/es6/ej2-schedule.es2015.js.map +1 -1
- package/dist/es6/ej2-schedule.es5.js +132 -43
- package/dist/es6/ej2-schedule.es5.js.map +1 -1
- package/dist/global/ej2-schedule.min.js +2 -2
- package/dist/global/ej2-schedule.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/common/calendar-util.d.ts +92 -0
- package/dist/ts/common/calendar-util.ts +261 -0
- package/dist/ts/common/index.d.ts +4 -0
- package/dist/ts/common/index.ts +4 -0
- package/dist/ts/components.d.ts +5 -0
- package/dist/ts/components.ts +5 -0
- package/dist/ts/index.d.ts +6 -0
- package/dist/ts/index.ts +7 -0
- package/dist/ts/recurrence-editor/date-generator.d.ts +76 -0
- package/dist/ts/recurrence-editor/date-generator.ts +1699 -0
- package/dist/ts/recurrence-editor/index.d.ts +6 -0
- package/dist/ts/recurrence-editor/index.ts +6 -0
- package/dist/ts/recurrence-editor/recurrence-editor-model.d.ts +112 -0
- package/dist/ts/recurrence-editor/recurrence-editor.d.ts +245 -0
- package/dist/ts/recurrence-editor/recurrence-editor.ts +1257 -0
- package/dist/ts/schedule/actions/action-base.d.ts +44 -0
- package/dist/ts/schedule/actions/action-base.ts +493 -0
- package/dist/ts/schedule/actions/crud.d.ts +41 -0
- package/dist/ts/schedule/actions/crud.ts +784 -0
- package/dist/ts/schedule/actions/data.d.ts +63 -0
- package/dist/ts/schedule/actions/data.ts +128 -0
- package/dist/ts/schedule/actions/drag.d.ts +75 -0
- package/dist/ts/schedule/actions/drag.ts +1401 -0
- package/dist/ts/schedule/actions/keyboard.d.ts +100 -0
- package/dist/ts/schedule/actions/keyboard.ts +1435 -0
- package/dist/ts/schedule/actions/resize.d.ts +27 -0
- package/dist/ts/schedule/actions/resize.ts +602 -0
- package/dist/ts/schedule/actions/scroll.d.ts +69 -0
- package/dist/ts/schedule/actions/scroll.ts +105 -0
- package/dist/ts/schedule/actions/touch.d.ts +32 -0
- package/dist/ts/schedule/actions/touch.ts +314 -0
- package/dist/ts/schedule/actions/virtual-scroll.d.ts +55 -0
- package/dist/ts/schedule/actions/virtual-scroll.ts +596 -0
- package/dist/ts/schedule/actions/work-cells.d.ts +14 -0
- package/dist/ts/schedule/actions/work-cells.ts +151 -0
- package/dist/ts/schedule/base/constant.d.ts +102 -0
- package/dist/ts/schedule/base/constant.ts +103 -0
- package/dist/ts/schedule/base/css-constant.d.ts +475 -0
- package/dist/ts/schedule/base/css-constant.ts +475 -0
- package/dist/ts/schedule/base/interface.d.ts +673 -0
- package/dist/ts/schedule/base/interface.ts +738 -0
- package/dist/ts/schedule/base/resource.d.ts +59 -0
- package/dist/ts/schedule/base/resource.ts +1091 -0
- package/dist/ts/schedule/base/schedule-model.d.ts +930 -0
- package/dist/ts/schedule/base/schedule.d.ts +1967 -0
- package/dist/ts/schedule/base/schedule.ts +4221 -0
- package/dist/ts/schedule/base/type.d.ts +134 -0
- package/dist/ts/schedule/base/type.ts +142 -0
- package/dist/ts/schedule/base/util.d.ts +266 -0
- package/dist/ts/schedule/base/util.ts +492 -0
- package/dist/ts/schedule/event-renderer/agenda-base.d.ts +15 -0
- package/dist/ts/schedule/event-renderer/agenda-base.ts +423 -0
- package/dist/ts/schedule/event-renderer/event-base.d.ts +101 -0
- package/dist/ts/schedule/event-renderer/event-base.ts +1501 -0
- package/dist/ts/schedule/event-renderer/inline-edit.d.ts +23 -0
- package/dist/ts/schedule/event-renderer/inline-edit.ts +287 -0
- package/dist/ts/schedule/event-renderer/month.d.ts +60 -0
- package/dist/ts/schedule/event-renderer/month.ts +760 -0
- package/dist/ts/schedule/event-renderer/timeline-view.d.ts +51 -0
- package/dist/ts/schedule/event-renderer/timeline-view.ts +606 -0
- package/dist/ts/schedule/event-renderer/vertical-view.d.ts +57 -0
- package/dist/ts/schedule/event-renderer/vertical-view.ts +898 -0
- package/dist/ts/schedule/event-renderer/year.d.ts +27 -0
- package/dist/ts/schedule/event-renderer/year.ts +623 -0
- package/dist/ts/schedule/exports/calendar-export.d.ts +16 -0
- package/dist/ts/schedule/exports/calendar-export.ts +160 -0
- package/dist/ts/schedule/exports/calendar-import.d.ts +18 -0
- package/dist/ts/schedule/exports/calendar-import.ts +277 -0
- package/dist/ts/schedule/exports/excel-export.d.ts +14 -0
- package/dist/ts/schedule/exports/excel-export.ts +89 -0
- package/dist/ts/schedule/exports/index.d.ts +7 -0
- package/dist/ts/schedule/exports/index.ts +7 -0
- package/dist/ts/schedule/exports/print.d.ts +20 -0
- package/dist/ts/schedule/exports/print.ts +233 -0
- package/dist/ts/schedule/index.d.ts +26 -0
- package/dist/ts/schedule/index.ts +26 -0
- package/dist/ts/schedule/models/event-settings-model.d.ts +165 -0
- package/dist/ts/schedule/models/event-settings.d.ts +149 -0
- package/dist/ts/schedule/models/event-settings.ts +187 -0
- package/dist/ts/schedule/models/field-options-model.d.ts +37 -0
- package/dist/ts/schedule/models/field-options.d.ts +31 -0
- package/dist/ts/schedule/models/field-options.ts +41 -0
- package/dist/ts/schedule/models/fields-model.d.ts +129 -0
- package/dist/ts/schedule/models/fields.d.ts +117 -0
- package/dist/ts/schedule/models/fields.ts +149 -0
- package/dist/ts/schedule/models/group-model.d.ts +69 -0
- package/dist/ts/schedule/models/group.d.ts +60 -0
- package/dist/ts/schedule/models/group.ts +75 -0
- package/dist/ts/schedule/models/header-rows-model.d.ts +33 -0
- package/dist/ts/schedule/models/header-rows.d.ts +30 -0
- package/dist/ts/schedule/models/header-rows.ts +35 -0
- package/dist/ts/schedule/models/models.d.ts +14 -0
- package/dist/ts/schedule/models/models.ts +15 -0
- package/dist/ts/schedule/models/quick-info-templates-model.d.ts +52 -0
- package/dist/ts/schedule/models/quick-info-templates.d.ts +47 -0
- package/dist/ts/schedule/models/quick-info-templates.ts +56 -0
- package/dist/ts/schedule/models/resources-model.d.ts +122 -0
- package/dist/ts/schedule/models/resources.d.ts +106 -0
- package/dist/ts/schedule/models/resources.ts +138 -0
- package/dist/ts/schedule/models/time-scale-model.d.ts +57 -0
- package/dist/ts/schedule/models/time-scale.d.ts +50 -0
- package/dist/ts/schedule/models/time-scale.ts +61 -0
- package/dist/ts/schedule/models/toolbar-model.d.ts +196 -0
- package/dist/ts/schedule/models/toolbar.d.ts +176 -0
- package/dist/ts/schedule/models/toolbar.ts +196 -0
- package/dist/ts/schedule/models/views-model.d.ts +370 -0
- package/dist/ts/schedule/models/views.d.ts +335 -0
- package/dist/ts/schedule/models/views.ts +408 -0
- package/dist/ts/schedule/models/work-hours-model.d.ts +29 -0
- package/dist/ts/schedule/models/work-hours.d.ts +24 -0
- package/dist/ts/schedule/models/work-hours.ts +31 -0
- package/dist/ts/schedule/popups/event-tooltip.d.ts +16 -0
- package/dist/ts/schedule/popups/event-tooltip.ts +203 -0
- package/dist/ts/schedule/popups/event-window.d.ts +118 -0
- package/dist/ts/schedule/popups/event-window.ts +2055 -0
- package/dist/ts/schedule/popups/form-validator.d.ts +16 -0
- package/dist/ts/schedule/popups/form-validator.ts +110 -0
- package/dist/ts/schedule/popups/quick-popups.d.ts +78 -0
- package/dist/ts/schedule/popups/quick-popups.ts +1470 -0
- package/dist/ts/schedule/renderer/agenda.d.ts +45 -0
- package/dist/ts/schedule/renderer/agenda.ts +497 -0
- package/dist/ts/schedule/renderer/day.d.ts +20 -0
- package/dist/ts/schedule/renderer/day.ts +28 -0
- package/dist/ts/schedule/renderer/header-renderer.d.ts +48 -0
- package/dist/ts/schedule/renderer/header-renderer.ts +736 -0
- package/dist/ts/schedule/renderer/month-agenda.d.ts +29 -0
- package/dist/ts/schedule/renderer/month-agenda.ts +184 -0
- package/dist/ts/schedule/renderer/month.d.ts +61 -0
- package/dist/ts/schedule/renderer/month.ts +766 -0
- package/dist/ts/schedule/renderer/renderer.d.ts +13 -0
- package/dist/ts/schedule/renderer/renderer.ts +165 -0
- package/dist/ts/schedule/renderer/timeline-header-row.d.ts +15 -0
- package/dist/ts/schedule/renderer/timeline-header-row.ts +132 -0
- package/dist/ts/schedule/renderer/timeline-month.d.ts +29 -0
- package/dist/ts/schedule/renderer/timeline-month.ts +184 -0
- package/dist/ts/schedule/renderer/timeline-view.d.ts +31 -0
- package/dist/ts/schedule/renderer/timeline-view.ts +308 -0
- package/dist/ts/schedule/renderer/timeline-year.d.ts +22 -0
- package/dist/ts/schedule/renderer/timeline-year.ts +450 -0
- package/dist/ts/schedule/renderer/vertical-view.d.ts +63 -0
- package/dist/ts/schedule/renderer/vertical-view.ts +911 -0
- package/dist/ts/schedule/renderer/view-base.d.ts +83 -0
- package/dist/ts/schedule/renderer/view-base.ts +709 -0
- package/dist/ts/schedule/renderer/week.d.ts +22 -0
- package/dist/ts/schedule/renderer/week.ts +35 -0
- package/dist/ts/schedule/renderer/work-week.d.ts +22 -0
- package/dist/ts/schedule/renderer/work-week.ts +36 -0
- package/dist/ts/schedule/renderer/year.d.ts +46 -0
- package/dist/ts/schedule/renderer/year.ts +470 -0
- package/dist/ts/schedule/timezone/timezone.d.ts +16 -0
- package/dist/ts/schedule/timezone/timezone.ts +313 -0
- package/package.json +56 -21
- package/src/schedule/actions/action-base.js +3 -0
- package/src/schedule/actions/drag.js +11 -4
- package/src/schedule/actions/keyboard.js +1 -1
- package/src/schedule/actions/resize.js +9 -5
- package/src/schedule/actions/virtual-scroll.js +3 -0
- package/src/schedule/base/css-constant.d.ts +2 -0
- package/src/schedule/base/css-constant.js +2 -0
- package/src/schedule/base/schedule.js +15 -1
- package/src/schedule/event-renderer/agenda-base.d.ts +1 -1
- package/src/schedule/event-renderer/agenda-base.js +5 -4
- package/src/schedule/event-renderer/inline-edit.js +11 -6
- package/src/schedule/event-renderer/month.js +5 -3
- package/src/schedule/event-renderer/vertical-view.js +3 -0
- package/src/schedule/event-renderer/year.d.ts +2 -0
- package/src/schedule/event-renderer/year.js +28 -4
- package/src/schedule/popups/event-tooltip.js +4 -0
- package/src/schedule/popups/event-window.js +2 -2
- package/src/schedule/popups/quick-popups.js +5 -1
- package/src/schedule/renderer/agenda.js +3 -2
- package/src/schedule/renderer/month.js +9 -7
- package/src/schedule/renderer/vertical-view.js +1 -1
- package/src/schedule/renderer/view-base.d.ts +2 -0
- package/src/schedule/renderer/view-base.js +9 -0
- package/src/schedule/renderer/year.js +3 -2
- package/styles/bds-lite.css +11 -8
- package/styles/bds.css +11 -8
- package/styles/bootstrap-dark-lite.css +12 -9
- package/styles/bootstrap-dark.css +12 -9
- package/styles/bootstrap-lite.css +12 -9
- package/styles/bootstrap.css +12 -9
- package/styles/bootstrap4-lite.css +11 -8
- package/styles/bootstrap4.css +11 -8
- package/styles/bootstrap5-dark-lite.css +11 -8
- package/styles/bootstrap5-dark.css +11 -8
- package/styles/bootstrap5-lite.css +11 -8
- package/styles/bootstrap5.3-lite.css +11 -8
- package/styles/bootstrap5.3.css +11 -8
- package/styles/bootstrap5.css +11 -8
- package/styles/fabric-dark-lite.css +12 -9
- package/styles/fabric-dark.css +12 -9
- package/styles/fabric-lite.css +12 -9
- package/styles/fabric.css +12 -9
- package/styles/fluent-dark-lite.css +13 -10
- package/styles/fluent-dark.css +13 -10
- package/styles/fluent-lite.css +13 -10
- package/styles/fluent.css +13 -10
- package/styles/fluent2-lite.css +11 -8
- package/styles/fluent2.css +11 -8
- package/styles/highcontrast-light-lite.css +12 -9
- package/styles/highcontrast-light.css +12 -9
- package/styles/highcontrast-lite.css +12 -9
- package/styles/highcontrast.css +12 -9
- package/styles/material-dark-lite.css +12 -9
- package/styles/material-dark.css +12 -9
- package/styles/material-lite.css +12 -9
- package/styles/material.css +12 -9
- package/styles/material3-dark-lite.css +11 -8
- package/styles/material3-dark.css +11 -8
- package/styles/material3-lite.css +11 -8
- package/styles/material3.css +11 -8
- package/styles/recurrence-editor/_bds-definition.scss +1 -0
- package/styles/recurrence-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/recurrence-editor/_bootstrap-definition.scss +1 -0
- package/styles/recurrence-editor/_bootstrap4-definition.scss +1 -0
- package/styles/recurrence-editor/_bootstrap5-definition.scss +1 -0
- package/styles/recurrence-editor/_bootstrap5.3-definition.scss +1 -0
- package/styles/recurrence-editor/_fabric-dark-definition.scss +1 -0
- package/styles/recurrence-editor/_fabric-definition.scss +1 -0
- package/styles/recurrence-editor/_fluent-definition.scss +1 -0
- package/styles/recurrence-editor/_fluent2-definition.scss +1 -0
- package/styles/recurrence-editor/_fusionnew-definition.scss +1 -0
- package/styles/recurrence-editor/_highcontrast-definition.scss +1 -0
- package/styles/recurrence-editor/_highcontrast-light-definition.scss +1 -0
- package/styles/recurrence-editor/_layout.scss +5 -1
- package/styles/recurrence-editor/_material-dark-definition.scss +1 -0
- package/styles/recurrence-editor/_material-definition.scss +1 -0
- package/styles/recurrence-editor/_material3-definition.scss +1 -0
- package/styles/recurrence-editor/_tailwind-definition.scss +1 -0
- package/styles/recurrence-editor/_tailwind3-definition.scss +1 -0
- package/styles/recurrence-editor/bds.css +3 -0
- package/styles/recurrence-editor/bootstrap-dark.css +4 -1
- package/styles/recurrence-editor/bootstrap.css +4 -1
- package/styles/recurrence-editor/bootstrap4.css +3 -0
- package/styles/recurrence-editor/bootstrap5-dark.css +3 -0
- package/styles/recurrence-editor/bootstrap5.3.css +3 -0
- package/styles/recurrence-editor/bootstrap5.css +3 -0
- package/styles/recurrence-editor/fabric-dark.css +4 -1
- package/styles/recurrence-editor/fabric.css +4 -1
- package/styles/recurrence-editor/fluent-dark.css +4 -1
- package/styles/recurrence-editor/fluent.css +4 -1
- package/styles/recurrence-editor/fluent2.css +3 -0
- package/styles/recurrence-editor/highcontrast-light.css +4 -1
- package/styles/recurrence-editor/highcontrast.css +4 -1
- package/styles/recurrence-editor/material-dark.css +4 -1
- package/styles/recurrence-editor/material.css +4 -1
- package/styles/recurrence-editor/material3-dark.css +3 -0
- package/styles/recurrence-editor/material3.css +3 -0
- package/styles/recurrence-editor/tailwind-dark.css +3 -0
- package/styles/recurrence-editor/tailwind.css +3 -0
- package/styles/recurrence-editor/tailwind3.css +3 -0
- package/styles/schedule/_bds-definition.scss +2 -0
- package/styles/schedule/_bootstrap-dark-definition.scss +2 -0
- package/styles/schedule/_bootstrap-definition.scss +2 -0
- package/styles/schedule/_bootstrap4-definition.scss +2 -0
- package/styles/schedule/_bootstrap5-definition.scss +2 -0
- package/styles/schedule/_bootstrap5.3-definition.scss +2 -0
- package/styles/schedule/_fabric-dark-definition.scss +2 -0
- package/styles/schedule/_fabric-definition.scss +2 -0
- package/styles/schedule/_fluent-definition.scss +3 -1
- package/styles/schedule/_fluent2-definition.scss +2 -0
- package/styles/schedule/_fusionnew-definition.scss +2 -0
- package/styles/schedule/_highcontrast-definition.scss +2 -0
- package/styles/schedule/_highcontrast-light-definition.scss +2 -0
- package/styles/schedule/_layout.scss +12 -11
- package/styles/schedule/_material-dark-definition.scss +2 -0
- package/styles/schedule/_material-definition.scss +2 -0
- package/styles/schedule/_material3-definition.scss +2 -0
- package/styles/schedule/_tailwind-definition.scss +2 -0
- package/styles/schedule/_tailwind3-definition.scss +2 -0
- package/styles/schedule/bds.css +8 -8
- package/styles/schedule/bootstrap-dark.css +8 -8
- package/styles/schedule/bootstrap.css +8 -8
- package/styles/schedule/bootstrap4.css +8 -8
- package/styles/schedule/bootstrap5-dark.css +8 -8
- package/styles/schedule/bootstrap5.3.css +8 -8
- package/styles/schedule/bootstrap5.css +8 -8
- package/styles/schedule/fabric-dark.css +8 -8
- package/styles/schedule/fabric.css +8 -8
- package/styles/schedule/fluent-dark.css +9 -9
- package/styles/schedule/fluent.css +9 -9
- package/styles/schedule/fluent2.css +8 -8
- package/styles/schedule/highcontrast-light.css +8 -8
- package/styles/schedule/highcontrast.css +8 -8
- package/styles/schedule/material-dark.css +8 -8
- package/styles/schedule/material.css +8 -8
- package/styles/schedule/material3-dark.css +8 -8
- package/styles/schedule/material3.css +8 -8
- package/styles/schedule/tailwind-dark.css +8 -8
- package/styles/schedule/tailwind.css +8 -8
- package/styles/schedule/tailwind3.css +8 -8
- package/styles/tailwind-dark-lite.css +11 -8
- package/styles/tailwind-dark.css +11 -8
- package/styles/tailwind-lite.css +11 -8
- package/styles/tailwind.css +11 -8
- package/styles/tailwind3-lite.css +11 -8
- package/styles/tailwind3.css +11 -8
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { append, prepend, createElement, extend, EventHandler, closest, addClass } from '@syncfusion/ej2-base';
|
|
3
|
+
import { isNullOrUndefined, setStyleAttribute, remove } from '@syncfusion/ej2-base';
|
|
4
|
+
import { EventFieldsMapping, EventClickArgs, EventRenderedArgs, TdData, NotifyEventArgs, MoreEventsClickArgs } from '../base/interface';
|
|
5
|
+
import { Schedule } from '../base/schedule';
|
|
6
|
+
import { EventBase } from './event-base';
|
|
7
|
+
import * as cls from '../base/css-constant';
|
|
8
|
+
import * as events from '../base/constant';
|
|
9
|
+
import * as util from '../base/util';
|
|
10
|
+
|
|
11
|
+
const EVENT_GAP: number = 0;
|
|
12
|
+
/**
|
|
13
|
+
* Month view events render
|
|
14
|
+
*/
|
|
15
|
+
export class MonthEvent extends EventBase {
|
|
16
|
+
public element: HTMLElement;
|
|
17
|
+
public fields: EventFieldsMapping;
|
|
18
|
+
public dateRender: Date[];
|
|
19
|
+
public renderedEvents: Record<string, any>[] = [];
|
|
20
|
+
public eventHeight: number;
|
|
21
|
+
private monthHeaderHeight: number = 0;
|
|
22
|
+
public workCells: HTMLElement[];
|
|
23
|
+
public cellWidth: number;
|
|
24
|
+
public cellHeight: number;
|
|
25
|
+
public moreIndicatorHeight: number = 19;
|
|
26
|
+
public renderType: string = 'day';
|
|
27
|
+
public maxHeight: boolean;
|
|
28
|
+
public withIndicator: boolean;
|
|
29
|
+
public maxOrIndicator: boolean;
|
|
30
|
+
public inlineValue: boolean;
|
|
31
|
+
private isResourceEventTemplate: boolean;
|
|
32
|
+
|
|
33
|
+
constructor(parent: Schedule) {
|
|
34
|
+
super(parent);
|
|
35
|
+
this.element = this.parent.activeView.getPanel();
|
|
36
|
+
this.fields = this.parent.eventFields;
|
|
37
|
+
this.maxHeight = this.parent.eventSettings.enableMaxHeight && !this.parent.eventSettings.enableIndicator
|
|
38
|
+
&& !this.parent.rowAutoHeight;
|
|
39
|
+
this.withIndicator = this.parent.eventSettings.enableMaxHeight && this.parent.eventSettings.enableIndicator
|
|
40
|
+
&& !this.parent.rowAutoHeight;
|
|
41
|
+
this.maxOrIndicator = (this.maxHeight || this.withIndicator);
|
|
42
|
+
this.moreIndicatorHeight =
|
|
43
|
+
(this.parent.rowAutoHeight && this.parent.eventSettings.ignoreWhitespace) ? 0 : this.moreIndicatorHeight;
|
|
44
|
+
this.addEventListener();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private removeEventWrapper(appElement: Element[]): void {
|
|
48
|
+
if (appElement.length > 0) {
|
|
49
|
+
appElement = (this.parent.currentView === 'Month' || (!this.parent.activeView.isTimelineView() &&
|
|
50
|
+
!this.parent.activeViewOptions.timeScale.enable)) ? appElement : [appElement[0]];
|
|
51
|
+
for (const wrap of appElement) {
|
|
52
|
+
if (wrap.parentElement && wrap.parentElement.parentNode) {
|
|
53
|
+
remove(wrap.parentElement);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public renderAppointments(): void {
|
|
60
|
+
if (this.parent.dragAndDropModule) {
|
|
61
|
+
this.parent.dragAndDropModule.setDragArea();
|
|
62
|
+
}
|
|
63
|
+
this.isResourceEventTemplate = this.parent.isSpecificResourceEvents();
|
|
64
|
+
const conWrap: HTMLElement = this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS) as HTMLElement;
|
|
65
|
+
if (this.parent.rowAutoHeight) {
|
|
66
|
+
this.parent.uiStateValues.top = conWrap.scrollTop;
|
|
67
|
+
this.parent.uiStateValues.left = conWrap.scrollLeft;
|
|
68
|
+
}
|
|
69
|
+
const appointmentWrapper: HTMLElement[] = [].slice.call(this.element.querySelectorAll('.' + cls.APPOINTMENT_WRAPPER_CLASS));
|
|
70
|
+
if (this.parent.crudModule && this.parent.crudModule.crudObj.isCrudAction) {
|
|
71
|
+
for (let i: number = 0, len: number = this.parent.crudModule.crudObj.sourceEvent.length; i < len; i++) {
|
|
72
|
+
const appElement: Element[] = [].slice.call(this.element.querySelectorAll('.e-appointment-wrapper ' + '[data-group-index="' +
|
|
73
|
+
this.parent.crudModule.crudObj.sourceEvent[parseInt(i.toString(), 10)].groupIndex + '"]'));
|
|
74
|
+
this.removeEventWrapper(appElement);
|
|
75
|
+
if (this.parent.crudModule.crudObj.targetEvent[parseInt(i.toString(), 10)] &&
|
|
76
|
+
this.parent.crudModule.crudObj.sourceEvent[parseInt(i.toString(), 10)].groupIndex !==
|
|
77
|
+
this.parent.crudModule.crudObj.targetEvent[parseInt(i.toString(), 10)].groupIndex) {
|
|
78
|
+
const ele: Element[] = [].slice.call(this.element.querySelectorAll('.e-appointment-wrapper ' + '[data-group-index="' +
|
|
79
|
+
this.parent.crudModule.crudObj.targetEvent[parseInt(i.toString(), 10)].groupIndex + '"]'));
|
|
80
|
+
this.removeEventWrapper(ele);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
for (const wrap of appointmentWrapper) {
|
|
85
|
+
remove(wrap);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
this.removeHeightProperty(cls.CONTENT_TABLE_CLASS);
|
|
89
|
+
if (!this.element.querySelector('.' + cls.WORK_CELLS_CLASS)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (this.parent.currentView === 'Month') {
|
|
93
|
+
const wrapper: HTMLElement = createElement('div', { className: cls.APPOINTMENT_WRAPPER_CLASS });
|
|
94
|
+
const cellTd: HTMLTableCellElement = this.parent.element.querySelector('.' + cls.WORK_CELLS_CLASS);
|
|
95
|
+
cellTd.appendChild(wrapper);
|
|
96
|
+
this.monthHeaderHeight = wrapper.offsetTop - cellTd.offsetTop;
|
|
97
|
+
cellTd.removeChild(wrapper);
|
|
98
|
+
}
|
|
99
|
+
this.eventHeight = this.parent.getElementHeightFromClass(this.element, cls.APPOINTMENT_CLASS);
|
|
100
|
+
const selector: string = '.' + cls.CONTENT_TABLE_CLASS + ' tbody tr';
|
|
101
|
+
this.addCellHeight(selector, this.eventHeight, (this.parent.currentView === 'Month' ? EVENT_GAP : 2), this.monthHeaderHeight, this.moreIndicatorHeight);
|
|
102
|
+
const scrollTop: number = conWrap.scrollTop;
|
|
103
|
+
if (this.parent.rowAutoHeight && this.parent.virtualScrollModule && !this.parent.virtualScrollModule.isHorizontalScroll
|
|
104
|
+
&& !isNullOrUndefined(this.parent.currentAction)) {
|
|
105
|
+
conWrap.scrollTop = conWrap.scrollTop - 1;
|
|
106
|
+
}
|
|
107
|
+
if (this.parent.activeViewOptions.group.resources.length > 0) {
|
|
108
|
+
this.renderResourceEvents();
|
|
109
|
+
if (this.parent.virtualScrollModule) {
|
|
110
|
+
this.parent.virtualScrollModule.updateFocusedWorkCell();
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
this.renderEventsHandler(this.parent.activeView.renderDates, this.parent.activeViewOptions.workDays);
|
|
114
|
+
}
|
|
115
|
+
if (this.parent.rowAutoHeight) {
|
|
116
|
+
this.updateBlockElements();
|
|
117
|
+
const data: NotifyEventArgs = {
|
|
118
|
+
cssProperties: this.parent.getCssProperties(),
|
|
119
|
+
module: this.parent.getModuleName(),
|
|
120
|
+
isPreventScrollUpdate: true,
|
|
121
|
+
scrollPosition: { left: this.parent.uiStateValues.left, top: this.parent.uiStateValues.top }
|
|
122
|
+
};
|
|
123
|
+
if (this.parent.virtualScrollModule && !this.parent.virtualScrollModule.isHorizontalScroll) {
|
|
124
|
+
if (this.parent.currentAction) {
|
|
125
|
+
conWrap.scrollTop = scrollTop;
|
|
126
|
+
this.parent.currentAction = null;
|
|
127
|
+
} else {
|
|
128
|
+
this.parent.virtualScrollModule.updateVirtualScrollHeight();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!this.parent.enablePersistence) {
|
|
132
|
+
this.parent.notify(events.contentReady, {});
|
|
133
|
+
}
|
|
134
|
+
this.parent.notify(events.scrollUiUpdate, data);
|
|
135
|
+
if (this.parent.currentView === 'Month' && this.parent.showWeekNumber) {
|
|
136
|
+
const totalCells: HTMLElement[] =
|
|
137
|
+
[].slice.call(this.parent.element.querySelectorAll('.e-content-wrap table tr td:first-child'));
|
|
138
|
+
const weekNumberCells: HTMLElement[] = [].slice.call(this.parent.element.querySelectorAll('td' + '.' + cls.WEEK_NUMBER_CLASS));
|
|
139
|
+
weekNumberCells.forEach((cell: HTMLElement, i: number) => {
|
|
140
|
+
const height: number = totalCells[parseInt(i.toString(), 10)].offsetHeight;
|
|
141
|
+
setStyleAttribute(cell, { 'height': height + 'px' });
|
|
142
|
+
});
|
|
143
|
+
const weekNumberWrapper: HTMLElement = this.parent.element.querySelector('.' + cls.WEEK_NUMBER_WRAPPER_CLASS) as HTMLElement;
|
|
144
|
+
if (!isNullOrUndefined(weekNumberWrapper)) {
|
|
145
|
+
weekNumberWrapper.scrollTop = this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS).scrollTop;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.parent.renderTemplates();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public renderEventsHandler(dateRender: Date[], workDays: number[], resData?: TdData): void {
|
|
153
|
+
this.renderedEvents = [];
|
|
154
|
+
let eventsList: Record<string, any>[];
|
|
155
|
+
let blockList: Record<string, any>[];
|
|
156
|
+
let resIndex: number = 0;
|
|
157
|
+
if (resData) {
|
|
158
|
+
resIndex = resData.groupIndex;
|
|
159
|
+
this.cssClass = resData.cssClass;
|
|
160
|
+
this.groupOrder = resData.groupOrder;
|
|
161
|
+
eventsList = this.parent.eventBase.filterEventsByResource(resData, this.parent.eventsProcessed) as Record<string, any>[];
|
|
162
|
+
blockList = this.parent.eventBase.filterEventsByResource(resData, this.parent.blockProcessed) as Record<string, any>[];
|
|
163
|
+
this.workCells = [].slice.call(this.element.querySelectorAll('.' + cls.WORK_CELLS_CLASS + '[data-group-index="' + resIndex + '"]'));
|
|
164
|
+
} else {
|
|
165
|
+
eventsList = this.parent.eventsProcessed;
|
|
166
|
+
blockList = this.parent.blockProcessed;
|
|
167
|
+
this.workCells = [].slice.call(this.element.querySelectorAll('.' + cls.WORK_CELLS_CLASS));
|
|
168
|
+
}
|
|
169
|
+
this.sortByDateTime(eventsList);
|
|
170
|
+
this.sortByDateTime(blockList);
|
|
171
|
+
if (this.parent.currentView === 'Month' && this.parent.rowAutoHeight && this.parent.activeViewOptions.group.resources.length === 0) {
|
|
172
|
+
const totalCells: HTMLElement[] = [].slice.call(this.parent.element.querySelectorAll('.e-content-wrap table tr td:first-child'));
|
|
173
|
+
const height: number = this.parent.element.querySelector('.' + cls.CONTENT_TABLE_CLASS).clientHeight / totalCells.length;
|
|
174
|
+
totalCells.forEach((cell: HTMLElement) => {
|
|
175
|
+
setStyleAttribute(cell, { 'height': height + 'px' });
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const cellDetail: HTMLElement = this.workCells[this.parent.activeView.isTimelineView() ? 0 : this.workCells.length - 1];
|
|
179
|
+
this.cellWidth = this.parent.getElementWidth(cellDetail);
|
|
180
|
+
this.cellHeight = this.parent.getElementHeight(cellDetail);
|
|
181
|
+
this.dateRender = dateRender;
|
|
182
|
+
const filteredDates: Date[] = this.getRenderedDates(dateRender);
|
|
183
|
+
this.getSlotDates(workDays || this.parent.activeViewOptions.workDays);
|
|
184
|
+
this.processBlockEvents(blockList, resIndex, resData);
|
|
185
|
+
let events: Record<string, any>[] = [];
|
|
186
|
+
for (const event of eventsList) {
|
|
187
|
+
if (this.parent.resourceBase && !resData) {
|
|
188
|
+
this.cssClass = this.parent.resourceBase.getCssClass(event);
|
|
189
|
+
}
|
|
190
|
+
events = events.concat(this.splitEvent(event, filteredDates || this.dateRender));
|
|
191
|
+
}
|
|
192
|
+
for (let level: number = 0; level < this.slots.length; level++) {
|
|
193
|
+
this.renderedEvents = [];
|
|
194
|
+
const slot: number[] = this.slots[parseInt(level.toString(), 10)] as any;
|
|
195
|
+
const endDate: Date = util.addDays(new Date(slot[slot.length - 1]), 1);
|
|
196
|
+
const spannedEvents: Record<string, any>[] = this.filterEvents(new Date(slot[0]), endDate, events);
|
|
197
|
+
for (const event of spannedEvents) {
|
|
198
|
+
if (this.maxHeight) {
|
|
199
|
+
const sDate: Date = this.parent.currentView === 'Month' ? event[this.fields.startTime] as Date :
|
|
200
|
+
this.getStartTime(event, event.data as Record<string, any>);
|
|
201
|
+
if (this.getIndex(sDate) > 0) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
this.updateIndicatorIcon(event);
|
|
206
|
+
this.renderEvents(event, resIndex, eventsList);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
this.cssClass = null;
|
|
210
|
+
this.groupOrder = null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private processBlockEvents(blockEvents: Record<string, any>[], resIndex: number, resData?: TdData): void {
|
|
214
|
+
for (const event of blockEvents) {
|
|
215
|
+
if (this.parent.resourceBase && !resData) {
|
|
216
|
+
this.cssClass = this.parent.resourceBase.getCssClass(event);
|
|
217
|
+
}
|
|
218
|
+
const blockSpannedList: Record<string, any>[] = [];
|
|
219
|
+
if (this.renderType === 'day' && !event[this.fields.isAllDay]) {
|
|
220
|
+
const temp: Record<string, any> = extend({}, event, null, true) as Record<string, any>;
|
|
221
|
+
let isSameDate: boolean = this.isSameDate(temp[this.fields.startTime] as Date, temp[this.fields.endTime] as Date);
|
|
222
|
+
temp.isBlockIcon = isSameDate;
|
|
223
|
+
if (!isSameDate && util.getDateInMs(temp[this.fields.startTime] as Date) > 0) {
|
|
224
|
+
const e: Record<string, any> = extend({}, event, null, true) as Record<string, any>;
|
|
225
|
+
e[this.fields.endTime] = util.addDays(util.resetTime(new Date(event[this.fields.startTime] + '')), 1);
|
|
226
|
+
e.isBlockIcon = true;
|
|
227
|
+
temp[this.fields.startTime] = e[this.fields.endTime];
|
|
228
|
+
blockSpannedList.push(e);
|
|
229
|
+
}
|
|
230
|
+
isSameDate = this.isSameDate(temp[this.fields.startTime] as Date, temp[this.fields.endTime] as Date);
|
|
231
|
+
if (!isSameDate && util.getDateInMs(temp[this.fields.endTime] as Date) > 0) {
|
|
232
|
+
const e: Record<string, any> = extend({}, event, null, true) as Record<string, any>;
|
|
233
|
+
e[this.fields.startTime] = util.resetTime(new Date(event[this.fields.endTime] + ''));
|
|
234
|
+
e.isBlockIcon = true;
|
|
235
|
+
blockSpannedList.push(e);
|
|
236
|
+
temp[this.fields.endTime] = e[this.fields.startTime];
|
|
237
|
+
}
|
|
238
|
+
blockSpannedList.push(temp);
|
|
239
|
+
} else {
|
|
240
|
+
blockSpannedList.push(event);
|
|
241
|
+
}
|
|
242
|
+
for (const blockEvent of blockSpannedList) {
|
|
243
|
+
const spannedEvents: Record<string, any>[] = this.splitEvent(blockEvent, this.dateRender);
|
|
244
|
+
for (const event of spannedEvents) {
|
|
245
|
+
this.renderBlockEvents(event, resIndex, !!blockEvent.isBlockIcon);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
private isSameDate(start: Date, end: Date): boolean {
|
|
252
|
+
return new Date(+start).setHours(0, 0, 0, 0) === new Date(+end).setHours(0, 0, 0, 0);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
public renderBlockEvents(event: Record<string, any>, resIndex: number, isIcon: boolean): void {
|
|
256
|
+
const eventData: Record<string, any> = event.data as Record<string, any>;
|
|
257
|
+
const startTime: Date = this.getStartTime(event, eventData);
|
|
258
|
+
const endTime: Date = this.getEndTime(event, eventData);
|
|
259
|
+
const day: number = this.parent.getIndexOfDate(this.dateRender, util.resetTime(new Date(startTime.getTime())));
|
|
260
|
+
if (day < 0 || startTime > endTime) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const cellTd: HTMLElement = this.getCellTd(day);
|
|
264
|
+
const position: number = this.getPosition(startTime, endTime, event[this.fields.isAllDay] as boolean, day);
|
|
265
|
+
if (!isIcon) {
|
|
266
|
+
const diffInDays: number = eventData.count as number;
|
|
267
|
+
let appWidth: number = this.getEventWidth(startTime, endTime, event[this.fields.isAllDay] as boolean, diffInDays);
|
|
268
|
+
appWidth = (appWidth <= 0) ? this.cellWidth : appWidth;
|
|
269
|
+
appWidth = event.IsBlock ? appWidth - 1 : appWidth;
|
|
270
|
+
const appLeft: number = (this.parent.enableRtl) ? 0 : event.IsBlock ? position + 1 : position;
|
|
271
|
+
const appRight: number = (this.parent.enableRtl) ? event.IsBlock ? position + 1 : position : 0;
|
|
272
|
+
let appHeight: number = this.cellHeight - this.monthHeaderHeight;
|
|
273
|
+
appHeight = event.IsBlock ? appHeight - 1 : appHeight;
|
|
274
|
+
const appTop: number = this.getRowTop(resIndex);
|
|
275
|
+
const blockElement: HTMLElement = this.createBlockAppointmentElement(event, resIndex, this.isResourceEventTemplate);
|
|
276
|
+
setStyleAttribute(blockElement, {
|
|
277
|
+
'width': appWidth + 'px', 'height': appHeight + 'px', 'left': appLeft + 'px',
|
|
278
|
+
'right': appRight + 'px', 'top': appTop + 'px'
|
|
279
|
+
});
|
|
280
|
+
this.renderEventElement(event, blockElement, cellTd);
|
|
281
|
+
} else {
|
|
282
|
+
this.renderBlockIndicator(cellTd, position, resIndex);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
287
|
+
public renderBlockIndicator(cellTd: HTMLElement, position: number, resIndex: number): void {
|
|
288
|
+
const blockIndicator: HTMLElement = createElement('div', { className: 'e-icons ' + cls.BLOCK_INDICATOR_CLASS });
|
|
289
|
+
if (isNullOrUndefined(cellTd.querySelector('.' + cls.BLOCK_INDICATOR_CLASS))) {
|
|
290
|
+
cellTd.appendChild(blockIndicator);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
295
|
+
public getStartTime(event: Record<string, any>, eventData: Record<string, any>): Date {
|
|
296
|
+
return event[this.fields.startTime] as Date;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
300
|
+
public getEndTime(event: Record<string, any>, eventData: Record<string, any>): Date {
|
|
301
|
+
return event[this.fields.endTime] as Date;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
public getCellTd(day: number): HTMLElement {
|
|
305
|
+
return this.workCells[parseInt(day.toString(), 10)];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
public getEventWidth(startDate: Date, endDate: Date, isAllDay: boolean, count: number): number {
|
|
309
|
+
return count * this.cellWidth - 1;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
313
|
+
public getPosition(startTime: Date, endTime: Date, isAllDay: boolean, day: number): number {
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
318
|
+
public getRowTop(resIndex: number): number {
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
public updateIndicatorIcon(event: Record<string, any>): void {
|
|
323
|
+
if (this.parent.currentView.indexOf('Timeline') === -1 || this.parent.currentView === 'TimelineMonth'
|
|
324
|
+
|| event[this.fields.isAllDay]) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const cloneData: Record<string, any> = event.data as Record<string, any>;
|
|
328
|
+
const start: Date = this.parent.activeView.getStartHour();
|
|
329
|
+
const end: Date = this.parent.activeView.getEndHour();
|
|
330
|
+
const startHour: Record<string, Date> = util.getStartEndHours(event[this.fields.startTime] as Date, start, end);
|
|
331
|
+
const endHour: Record<string, Date> = util.getStartEndHours(event[this.fields.endTime] as Date, start, end);
|
|
332
|
+
const actualStartTime: Date = <Date>cloneData[this.fields.startTime];
|
|
333
|
+
const actualEndTime: Date = <Date>cloneData[this.fields.endTime];
|
|
334
|
+
cloneData.isLeft = cloneData.isLeft || actualStartTime.getTime() < startHour.startHour.getTime();
|
|
335
|
+
cloneData.isRight = cloneData.isRight || actualEndTime.getTime() > endHour.endHour.getTime();
|
|
336
|
+
if (util.resetTime(actualStartTime).getTime() !== util.resetTime(actualEndTime).getTime()) {
|
|
337
|
+
const actualStartHour: Date = startHour.startHour;
|
|
338
|
+
const actualEndHour: Date = endHour.endHour;
|
|
339
|
+
const startTime: Date = new Date(util.resetTime(actualStartTime));
|
|
340
|
+
startTime.setHours(actualEndHour.getHours(), actualEndHour.getMinutes(), actualEndHour.getSeconds());
|
|
341
|
+
cloneData.isLeft = cloneData.isLeft || actualStartTime.getTime() >= (actualStartHour.getDate() === startHour.endHour.getDate() ?
|
|
342
|
+
startTime.getTime() : util.addDays(startTime, 1).getTime());
|
|
343
|
+
if (actualEndTime.getTime() !== util.resetTime(actualEndTime).getTime()) {
|
|
344
|
+
const endTime: Date = new Date(util.resetTime(actualEndTime));
|
|
345
|
+
cloneData.isRight = cloneData.isRight || actualEndTime.getTime() <=
|
|
346
|
+
endTime.setHours(actualStartHour.getHours(), actualStartHour.getMinutes(), actualStartHour.getSeconds());
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
public renderResourceEvents(): void {
|
|
352
|
+
const resources: TdData[] = this.parent.uiStateValues.isGroupAdaptive ?
|
|
353
|
+
[this.parent.resourceBase.lastResourceLevel[this.parent.uiStateValues.groupIndex]] :
|
|
354
|
+
this.parent.resourceBase.renderedResources;
|
|
355
|
+
if (this.parent.crudModule && this.parent.crudModule.crudObj.isCrudAction) {
|
|
356
|
+
for (let i: number = 0, len: number = this.parent.crudModule.crudObj.sourceEvent.length; i < len; i++) {
|
|
357
|
+
const sourceRes: TdData = this.parent.crudModule.crudObj.sourceEvent[parseInt(i.toString(), 10)];
|
|
358
|
+
if (!this.parent.uiStateValues.isGroupAdaptive ||
|
|
359
|
+
(this.parent.uiStateValues.groupIndex === sourceRes.groupIndex && this.parent.uiStateValues.isGroupAdaptive)) {
|
|
360
|
+
this.renderEventsHandler(sourceRes.renderDates, sourceRes.workDays, sourceRes);
|
|
361
|
+
}
|
|
362
|
+
if (this.parent.crudModule.crudObj.sourceEvent[parseInt(i.toString(), 10)].groupIndex !==
|
|
363
|
+
this.parent.crudModule.crudObj.targetEvent[parseInt(i.toString(), 10)].groupIndex) {
|
|
364
|
+
const target: TdData = this.parent.crudModule.crudObj.targetEvent[parseInt(i.toString(), 10)];
|
|
365
|
+
this.renderEventsHandler(target.renderDates, target.workDays, target);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
this.parent.crudModule.crudObj.isCrudAction = false;
|
|
369
|
+
} else {
|
|
370
|
+
for (const slotData of resources) {
|
|
371
|
+
this.renderEventsHandler(slotData.renderDates, slotData.workDays, slotData);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
public getSlotDates(workDays?: number[]): void {
|
|
377
|
+
this.slots = [];
|
|
378
|
+
const dates: number[] = this.dateRender.map((date: Date) => { return +date; });
|
|
379
|
+
const noOfDays: number = !this.parent.activeViewOptions.showWeekend || (this.parent.activeViewOptions.group.byDate &&
|
|
380
|
+
this.parent.activeViewOptions.group.hideNonWorkingDays) ? workDays.length : util.WEEK_LENGTH;
|
|
381
|
+
while (dates.length > 0) {
|
|
382
|
+
this.slots.push(dates.splice(0, noOfDays) as any);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
public createAppointmentElement(record: Record<string, any>, resIndex: number, isCloneElement: boolean = false): HTMLElement {
|
|
387
|
+
const eventSubject: string = (record[this.fields.subject] || this.parent.eventSettings.fields.subject.default ||
|
|
388
|
+
this.parent.localeObj.getConstant('addTitle')) as string;
|
|
389
|
+
const newRecord: Record<string, any> = extend({}, record, record.data, true) as Record<string, any>;
|
|
390
|
+
const attrs: { [key: string]: string } = {
|
|
391
|
+
'data-id': 'Appointment_' + record[this.fields.id],
|
|
392
|
+
'role': 'button', 'tabindex': '0',
|
|
393
|
+
'aria-disabled': this.parent.eventBase.getReadonlyAttribute(record),
|
|
394
|
+
'aria-label': this.parent.getAnnouncementString(newRecord, eventSubject)
|
|
395
|
+
};
|
|
396
|
+
if (!isCloneElement) {
|
|
397
|
+
attrs['data-guid'] = record.Guid;
|
|
398
|
+
}
|
|
399
|
+
if (this.parent.activeViewOptions.group.resources.length > 0) {
|
|
400
|
+
attrs['data-group-index'] = resIndex.toString();
|
|
401
|
+
}
|
|
402
|
+
const appointmentWrapper: HTMLElement = createElement('div', { className: cls.APPOINTMENT_CLASS, attrs: attrs });
|
|
403
|
+
|
|
404
|
+
if (!isNullOrUndefined(this.cssClass)) {
|
|
405
|
+
addClass([appointmentWrapper], this.cssClass);
|
|
406
|
+
}
|
|
407
|
+
if (record[this.fields.isReadonly]) {
|
|
408
|
+
addClass([appointmentWrapper], 'e-read-only');
|
|
409
|
+
}
|
|
410
|
+
const appointmentDetails: HTMLElement = createElement('div', { className: cls.APPOINTMENT_DETAILS });
|
|
411
|
+
appointmentWrapper.appendChild(appointmentDetails);
|
|
412
|
+
let templateElement: HTMLElement[];
|
|
413
|
+
const eventData: Record<string, any> = record.data as Record<string, any>;
|
|
414
|
+
const eventObj: Record<string, any> = this.getEventData(record);
|
|
415
|
+
if (!isNullOrUndefined(this.parent.activeViewOptions.eventTemplate)) {
|
|
416
|
+
const scheduleId: string = this.parent.element.id + '_';
|
|
417
|
+
const viewName: string = this.parent.activeViewOptions.eventTemplateName;
|
|
418
|
+
const templateId: string = scheduleId + viewName + 'eventTemplate';
|
|
419
|
+
const eventTemplate: string = this.isResourceEventTemplate ? this.parent.getEventTemplateName(resIndex) : 'eventTemplate';
|
|
420
|
+
templateElement = this.parent.getAppointmentTemplate()(eventObj, this.parent, eventTemplate, templateId, false,
|
|
421
|
+
undefined, undefined, this.parent.root);
|
|
422
|
+
} else {
|
|
423
|
+
const eventLocation: string = (record[this.fields.location] || this.parent.eventSettings.fields.location.default || '') as string;
|
|
424
|
+
const appointmentSubject: HTMLElement = createElement('div', { className: cls.SUBJECT_CLASS });
|
|
425
|
+
this.parent.sanitize((eventSubject + (eventLocation ? '; ' + eventLocation : '')), appointmentSubject);
|
|
426
|
+
const appointmentStartTime: HTMLElement = createElement('div', {
|
|
427
|
+
className: cls.APPOINTMENT_TIME + (this.parent.isAdaptive ? ' ' + cls.DISABLE_CLASS : ''),
|
|
428
|
+
innerHTML: this.parent.getTimeString(eventData[this.fields.startTime] as Date)
|
|
429
|
+
});
|
|
430
|
+
const appointmentEndTime: HTMLElement = createElement('div', {
|
|
431
|
+
className: cls.APPOINTMENT_TIME + (this.parent.isAdaptive ? ' ' + cls.DISABLE_CLASS : ''),
|
|
432
|
+
innerHTML: this.parent.getTimeString(eventData[this.fields.endTime] as Date)
|
|
433
|
+
});
|
|
434
|
+
if (this.parent.currentView === 'Month') {
|
|
435
|
+
if (record[this.fields.isAllDay]) {
|
|
436
|
+
templateElement = [appointmentSubject];
|
|
437
|
+
addClass([appointmentSubject], 'e-text-center');
|
|
438
|
+
} else if (eventData.count <= 1 && !eventData.isLeft && !eventData.isRight) {
|
|
439
|
+
templateElement = [appointmentStartTime, appointmentSubject];
|
|
440
|
+
} else {
|
|
441
|
+
templateElement = [];
|
|
442
|
+
addClass([appointmentSubject], 'e-text-center');
|
|
443
|
+
if (!eventData.isLeft) {
|
|
444
|
+
templateElement.push(appointmentStartTime);
|
|
445
|
+
}
|
|
446
|
+
templateElement.push(appointmentSubject);
|
|
447
|
+
if (!eventData.isRight) {
|
|
448
|
+
templateElement.push(appointmentEndTime);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
let innerElement: HTMLElement[];
|
|
453
|
+
if (record[this.fields.isAllDay]) {
|
|
454
|
+
const allDayString: HTMLElement = createElement('div', {
|
|
455
|
+
className: cls.APPOINTMENT_TIME, innerHTML: this.parent.localeObj.getConstant('allDay')
|
|
456
|
+
});
|
|
457
|
+
innerElement = [appointmentSubject, allDayString];
|
|
458
|
+
} else {
|
|
459
|
+
const timeString: string = this.parent.getTimeString(eventData[this.fields.startTime] as Date)
|
|
460
|
+
+ ' - ' + this.parent.getTimeString(eventData[this.fields.endTime] as Date);
|
|
461
|
+
const appTime: HTMLElement = createElement('div', {
|
|
462
|
+
className: cls.APPOINTMENT_TIME + (this.parent.isAdaptive ? ' ' + cls.DISABLE_CLASS : ''), innerHTML: timeString
|
|
463
|
+
});
|
|
464
|
+
const appLocation: HTMLElement = createElement('div', { className: cls.LOCATION_CLASS });
|
|
465
|
+
this.parent.sanitize(eventLocation, appLocation);
|
|
466
|
+
innerElement = [appointmentSubject, appTime, appLocation];
|
|
467
|
+
}
|
|
468
|
+
const wrap: HTMLElement = createElement('div', { className: 'e-inner-wrap' });
|
|
469
|
+
append(innerElement, wrap);
|
|
470
|
+
templateElement = [wrap];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
append(templateElement, appointmentDetails);
|
|
474
|
+
this.appendEventIcons(record, appointmentDetails);
|
|
475
|
+
this.renderResizeHandler(appointmentWrapper, record.data as Record<string, any>, record[this.fields.isReadonly] as boolean);
|
|
476
|
+
return appointmentWrapper;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
private appendEventIcons(record: Record<string, any>, appointmentDetails: HTMLElement): void {
|
|
480
|
+
const eventData: Record<string, any> = record.data as Record<string, any>;
|
|
481
|
+
if (!isNullOrUndefined(record[this.fields.recurrenceRule]) || !isNullOrUndefined(record[this.fields.recurrenceID])) {
|
|
482
|
+
const iconClass: string = (record[this.fields.id] === record[this.fields.recurrenceID]) ?
|
|
483
|
+
cls.EVENT_RECURRENCE_ICON_CLASS : cls.EVENT_RECURRENCE_EDIT_ICON_CLASS;
|
|
484
|
+
appointmentDetails.appendChild(createElement('div', {
|
|
485
|
+
className: cls.ICON + ' ' + iconClass + (this.parent.isAdaptive ? ' ' + cls.DISABLE_CLASS : '')
|
|
486
|
+
}));
|
|
487
|
+
}
|
|
488
|
+
if (eventData.isLeft) {
|
|
489
|
+
const iconLeft: HTMLElement = createElement('div', {
|
|
490
|
+
className: cls.EVENT_INDICATOR_CLASS + ' ' + cls.ICON + ' ' + cls.EVENT_ICON_LEFT_CLASS
|
|
491
|
+
});
|
|
492
|
+
prepend([iconLeft], appointmentDetails);
|
|
493
|
+
}
|
|
494
|
+
if (eventData.isRight) {
|
|
495
|
+
const iconRight: HTMLElement = createElement('div', {
|
|
496
|
+
className: cls.EVENT_INDICATOR_CLASS + ' ' + cls.ICON + ' ' + cls.EVENT_ICON_RIGHT_CLASS
|
|
497
|
+
});
|
|
498
|
+
append([iconRight], appointmentDetails);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
503
|
+
public renderEvents(event: Record<string, any>, resIndex: number, eventsList?: Record<string, any>[]): void {
|
|
504
|
+
const startTime: Date = event[this.fields.startTime] as Date;
|
|
505
|
+
const endTime: Date = event[this.fields.endTime] as Date;
|
|
506
|
+
const day: number = this.parent.getIndexOfDate(this.dateRender, util.resetTime(startTime));
|
|
507
|
+
if ((day < 0) || (startTime.getTime() < this.parent.minDate.getTime()) || (endTime.getTime() > this.parent.maxDate.getTime())) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
const eventsPerRow: number = this.parent.rowAutoHeight ? 1 : this.parent.activeViewOptions.maxEventsPerRow;
|
|
511
|
+
const overlapCount: number = this.getIndex(startTime);
|
|
512
|
+
event.Index = overlapCount;
|
|
513
|
+
const diffInDays: number = (event.data as Record<string, any>).count as number;
|
|
514
|
+
if (startTime.getTime() <= endTime.getTime()) {
|
|
515
|
+
const appWidth: number = (diffInDays * this.cellWidth) - 5;
|
|
516
|
+
const cellTd: Element = this.workCells[parseInt(day.toString(), 10)];
|
|
517
|
+
const appTop: number = (overlapCount * (this.eventHeight + EVENT_GAP));
|
|
518
|
+
const height: number =
|
|
519
|
+
this.monthHeaderHeight + ((overlapCount + 1) * (this.eventHeight + EVENT_GAP)) + this.moreIndicatorHeight;
|
|
520
|
+
const enableAppRender: boolean = this.parent.activeViewOptions.maxEventsPerRow && !this.parent.rowAutoHeight &&
|
|
521
|
+
!this.parent.eventSettings.enableIndicator ? overlapCount < eventsPerRow : this.maxOrIndicator ? overlapCount < 1
|
|
522
|
+
? true : false : this.cellHeight > height;
|
|
523
|
+
if (this.parent.rowAutoHeight || enableAppRender) {
|
|
524
|
+
this.renderedEvents.push(extend({}, event, null, true) as Record<string, any>);
|
|
525
|
+
let appointmentElement: HTMLElement;
|
|
526
|
+
if (this.inlineValue) {
|
|
527
|
+
appointmentElement = this.parent.inlineModule.createInlineAppointmentElement();
|
|
528
|
+
} else {
|
|
529
|
+
appointmentElement = this.createAppointmentElement(event, resIndex);
|
|
530
|
+
}
|
|
531
|
+
this.applyResourceColor(appointmentElement, event, 'backgroundColor', this.groupOrder);
|
|
532
|
+
this.wireAppointmentEvents(appointmentElement, event);
|
|
533
|
+
setStyleAttribute(appointmentElement, { 'width': appWidth + 'px', 'top': appTop + 'px' });
|
|
534
|
+
this.renderEventElement(event, appointmentElement, cellTd);
|
|
535
|
+
if (this.parent.rowAutoHeight) {
|
|
536
|
+
const conWrap: HTMLElement = this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS) as HTMLElement;
|
|
537
|
+
const conWidth: number = this.parent.getElementWidth(conWrap);
|
|
538
|
+
const isWithoutScroll: boolean = conWrap.offsetHeight === conWrap.clientHeight &&
|
|
539
|
+
conWrap.offsetWidth === conWrap.clientWidth;
|
|
540
|
+
const firstChild: HTMLElement = cellTd.parentElement.firstElementChild as HTMLElement;
|
|
541
|
+
this.updateCellHeight(firstChild, height);
|
|
542
|
+
if (isWithoutScroll &&
|
|
543
|
+
(conWrap.offsetWidth > conWrap.clientWidth || conWidth !== this.parent.getElementWidth(conWrap))) {
|
|
544
|
+
this.adjustAppointments(conWidth);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
} else {
|
|
548
|
+
for (let i: number = 0; i < diffInDays; i++) {
|
|
549
|
+
if (this.workCells[day + i]) {
|
|
550
|
+
const indicator: HTMLElement = this.workCells[day + i].querySelector('.' + cls.MORE_INDICATOR_CLASS);
|
|
551
|
+
if (indicator) {
|
|
552
|
+
const count: number = parseInt(indicator.getAttribute('data-count'), 10) + 1;
|
|
553
|
+
indicator.setAttribute('data-count', count.toString());
|
|
554
|
+
indicator.setAttribute('aria-label', count + ' ' + this.parent.localeObj.getConstant('moreEvents'));
|
|
555
|
+
indicator.innerHTML = this.getMoreIndicatorText(count);
|
|
556
|
+
} else {
|
|
557
|
+
const startDate: Date = new Date(this.dateRender[day + i].getTime());
|
|
558
|
+
const endDate: Date = util.addDays(this.dateRender[day + i], 1);
|
|
559
|
+
const groupIndex: string = this.workCells[day + i].getAttribute('data-group-index');
|
|
560
|
+
const moreIndicatorElement: HTMLElement = this.getMoreIndicatorElement(1, startDate, endDate);
|
|
561
|
+
if (!isNullOrUndefined(groupIndex)) {
|
|
562
|
+
moreIndicatorElement.setAttribute('data-group-index', groupIndex);
|
|
563
|
+
}
|
|
564
|
+
moreIndicatorElement.style.top = (this.cellHeight - this.monthHeaderHeight - this.moreIndicatorHeight) + 'px';
|
|
565
|
+
moreIndicatorElement.style.width = this.cellWidth - 2 + 'px';
|
|
566
|
+
this.renderElement(this.workCells[day + i], moreIndicatorElement);
|
|
567
|
+
EventHandler.add(moreIndicatorElement, 'click', this.moreIndicatorClick, this);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
public adjustAppointments(conWidth: number): void {
|
|
576
|
+
const tr: HTMLElement = this.parent.element.querySelector('.' + cls.CONTENT_TABLE_CLASS + ' tbody tr');
|
|
577
|
+
const actualCellWidth: number = this.parent.getElementWidth(this.workCells[0]);
|
|
578
|
+
this.cellWidth = actualCellWidth / +(this.workCells[0].getAttribute('colspan') || 1);
|
|
579
|
+
const currentPercentage: number = (actualCellWidth * tr.children.length) / (conWidth / 100);
|
|
580
|
+
const apps: HTMLElement[] = [].slice.call(this.parent.element.querySelectorAll('.' + cls.APPOINTMENT_CLASS));
|
|
581
|
+
apps.forEach((app: HTMLElement) => {
|
|
582
|
+
if (this.parent.enableRtl && app.style.right !== '0px') {
|
|
583
|
+
app.style.right = ((parseFloat(app.style.right) / 100) * currentPercentage) + 'px';
|
|
584
|
+
} else if (app.style.left !== '0px') {
|
|
585
|
+
app.style.left = ((parseFloat(app.style.left) / 100) * currentPercentage) + 'px';
|
|
586
|
+
}
|
|
587
|
+
app.style.width = ((parseFloat(app.style.width) / 100) * currentPercentage) + 'px';
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
public updateCellHeight(cell: HTMLElement, height: number): void {
|
|
592
|
+
if ((height > cell.offsetHeight)) {
|
|
593
|
+
setStyleAttribute(cell as HTMLElement, { 'height': height + 'px' });
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
public updateBlockElements(): void {
|
|
598
|
+
const blockElement: HTMLElement[] = [].slice.call(this.element.querySelectorAll('.' + cls.BLOCK_APPOINTMENT_CLASS));
|
|
599
|
+
for (const element of blockElement) {
|
|
600
|
+
const target: HTMLElement = closest(element, 'tr') as HTMLElement;
|
|
601
|
+
this.monthHeaderHeight = (<HTMLElement>element.offsetParent).offsetTop - target.offsetTop;
|
|
602
|
+
element.style.height = ((target.offsetHeight - 1) - this.monthHeaderHeight) + 'px';
|
|
603
|
+
const firstChild: HTMLElement = target.firstElementChild as HTMLElement;
|
|
604
|
+
const width: number = Math.round(element.offsetWidth / firstChild.offsetWidth);
|
|
605
|
+
element.style.width = (firstChild.offsetWidth * width) + 'px';
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// eslint-disable-next-line max-len
|
|
610
|
+
public getFilteredEvents(startDate: Date, endDate: Date, groupIndex: string, eventsList?: Record<string, any>[]): Record<string, any>[] {
|
|
611
|
+
let filteredEvents: Record<string, any>[];
|
|
612
|
+
if (isNullOrUndefined(groupIndex)) {
|
|
613
|
+
filteredEvents = this.filterEvents(startDate, endDate);
|
|
614
|
+
} else {
|
|
615
|
+
const data: TdData = this.parent.resourceBase.lastResourceLevel[parseInt(groupIndex, 10)];
|
|
616
|
+
filteredEvents = this.filterEvents(startDate, endDate, isNullOrUndefined(eventsList) ? undefined : eventsList, data);
|
|
617
|
+
}
|
|
618
|
+
return filteredEvents;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
public getOverlapEvents(date: Date, appointments: Record<string, any>[]): Record<string, any>[] {
|
|
622
|
+
const appointmentsList: Record<string, any>[] = [];
|
|
623
|
+
const dateTime: number = util.resetTime(date).getTime();
|
|
624
|
+
for (const app of appointments) {
|
|
625
|
+
if ((util.resetTime(<Date>app[this.fields.startTime]).getTime() <= dateTime) &&
|
|
626
|
+
(util.resetTime(<Date>app[this.fields.endTime]).getTime() >= dateTime)) {
|
|
627
|
+
appointmentsList.push(app);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return appointmentsList;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
public getIndex(date: Date): number {
|
|
634
|
+
let appIndex: number = -1;
|
|
635
|
+
const appointments: Record<string, any>[] = <Record<string, any>[]>this.renderedEvents;
|
|
636
|
+
if (appointments.length > 0) {
|
|
637
|
+
const appointmentsList: Record<string, any>[] = this.getOverlapEvents(date, appointments);
|
|
638
|
+
const appLevel: number[] = appointmentsList.map((obj: Record<string, any>) => obj.Index) as number[];
|
|
639
|
+
appIndex = (appLevel.length > 0) ? this.getSmallestMissingNumber(appLevel) : 0;
|
|
640
|
+
}
|
|
641
|
+
return (appIndex === -1) ? 0 : appIndex;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
public moreIndicatorClick(event: Event): void {
|
|
645
|
+
const target: Element = closest((event.target as Element), '.' + cls.MORE_INDICATOR_CLASS);
|
|
646
|
+
const startDate: Date = new Date(parseInt(target.getAttribute('data-start-date'), 10));
|
|
647
|
+
const endDate: Date = new Date(parseInt(target.getAttribute('data-end-date'), 10));
|
|
648
|
+
const groupIndex: string = target.getAttribute('data-group-index');
|
|
649
|
+
const moreArgs: MoreEventsClickArgs = {
|
|
650
|
+
cancel: false, event: event, element: target, isPopupOpen: true,
|
|
651
|
+
startTime: startDate, endTime: endDate, viewName: this.parent.getNavigateView()
|
|
652
|
+
};
|
|
653
|
+
if (groupIndex) {
|
|
654
|
+
moreArgs.groupIndex = parseInt(groupIndex, 10);
|
|
655
|
+
}
|
|
656
|
+
this.parent.trigger(events.moreEventsClick, moreArgs, (clickArgs: MoreEventsClickArgs) => {
|
|
657
|
+
if (!clickArgs.cancel) {
|
|
658
|
+
if (clickArgs.isPopupOpen) {
|
|
659
|
+
const filteredEvents: Record<string, any>[] = this.getFilteredEvents(startDate, endDate, groupIndex);
|
|
660
|
+
const moreArgs: EventClickArgs = { date: startDate, event: filteredEvents, element: event.target } as EventClickArgs;
|
|
661
|
+
this.parent.quickPopup.moreEventClick(moreArgs, endDate, groupIndex);
|
|
662
|
+
} else {
|
|
663
|
+
this.parent.setProperties({ selectedDate: startDate }, true);
|
|
664
|
+
this.parent.changeView(clickArgs.viewName, event);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
public renderEventElement(event: Record<string, any>, appointmentElement: HTMLElement, cellTd: Element): void {
|
|
671
|
+
const eventType: string = appointmentElement.classList.contains(cls.BLOCK_APPOINTMENT_CLASS) ? 'blockEvent' : 'event';
|
|
672
|
+
const isAppointment: boolean = appointmentElement.classList.contains(cls.APPOINTMENT_CLASS);
|
|
673
|
+
const eventObj: Record<string, any> = this.parent.currentView === 'Month' ? this.getSpannedTime(event) : this.getEventData(event);
|
|
674
|
+
const args: EventRenderedArgs = { data: eventObj, element: appointmentElement, cancel: false, type: eventType };
|
|
675
|
+
this.parent.trigger(events.eventRendered, args, (eventArgs: EventRenderedArgs) => {
|
|
676
|
+
if (eventArgs.cancel) {
|
|
677
|
+
this.renderedEvents.pop();
|
|
678
|
+
} else {
|
|
679
|
+
this.renderElement(cellTd, appointmentElement, isAppointment);
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
private getSpannedTime(event: Record<string, any>): Record<string, any> {
|
|
685
|
+
const eventObj: Record<string, any> = extend({}, event, null, true) as Record<string, any>;
|
|
686
|
+
if ((eventObj[this.fields.startTime]).getDate() === (eventObj.data[this.fields.startTime]).getDate()) {
|
|
687
|
+
eventObj[this.fields.startTime] = eventObj.data[this.fields.startTime];
|
|
688
|
+
}
|
|
689
|
+
if ((eventObj[this.fields.endTime]).getDate() === (eventObj.data[this.fields.endTime]).getDate()) {
|
|
690
|
+
eventObj[this.fields.endTime] = eventObj.data[this.fields.endTime];
|
|
691
|
+
}
|
|
692
|
+
return eventObj;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
public getEventData(event: Record<string, any>): Record<string, any> {
|
|
696
|
+
const eventObj: Record<string, any> = extend({}, event, null, true) as Record<string, any>;
|
|
697
|
+
eventObj[this.fields.startTime] = (event.data as Record<string, any>)[this.fields.startTime];
|
|
698
|
+
eventObj[this.fields.endTime] = (event.data as Record<string, any>)[this.fields.endTime];
|
|
699
|
+
return eventObj;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
public renderElement(cellTd: HTMLElement | Element, element: HTMLElement, isAppointment: boolean = false): void {
|
|
703
|
+
if (this.maxOrIndicator && isAppointment) {
|
|
704
|
+
this.setMaxEventHeight(element, cellTd as HTMLElement);
|
|
705
|
+
}
|
|
706
|
+
const wrapperEle: HTMLElement = cellTd.querySelector('.' + cls.APPOINTMENT_WRAPPER_CLASS);
|
|
707
|
+
if (wrapperEle) {
|
|
708
|
+
wrapperEle.appendChild(element);
|
|
709
|
+
} else {
|
|
710
|
+
const wrapper: HTMLElement = createElement('div', { className: cls.APPOINTMENT_WRAPPER_CLASS });
|
|
711
|
+
wrapper.appendChild(element);
|
|
712
|
+
cellTd.appendChild(wrapper);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
public getMoreIndicatorElement(count: number, startDate: Date, endDate: Date): HTMLElement {
|
|
717
|
+
const moreIndicatorElement: HTMLElement = createElement('div', {
|
|
718
|
+
className: cls.MORE_INDICATOR_CLASS,
|
|
719
|
+
innerHTML: this.getMoreIndicatorText(count),
|
|
720
|
+
attrs: {
|
|
721
|
+
'role': 'button',
|
|
722
|
+
'tabindex': '0',
|
|
723
|
+
'aria-label': this.parent.globalize.formatNumber(count) + ' ' + this.parent.localeObj.getConstant('moreEvents'),
|
|
724
|
+
'data-count': count.toString(),
|
|
725
|
+
'data-start-date': startDate.getTime().toString(),
|
|
726
|
+
'data-end-date': endDate.getTime().toString()
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
return moreIndicatorElement;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
private getMoreIndicatorText(count: number): string {
|
|
733
|
+
return '+' + this.parent.globalize.formatNumber(count) + ' ' + (this.parent.isAdaptive ? '' : this.parent.localeObj.getConstant('more'));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
public removeHeightProperty(selector: string): void {
|
|
737
|
+
const rows: HTMLElement[] = [].slice.call(this.element.querySelectorAll('.' + selector + ' tbody tr'));
|
|
738
|
+
for (const row of rows) {
|
|
739
|
+
(row.firstElementChild as HTMLElement).style.height = '';
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
public setMaxEventHeight(event: HTMLElement, cell: HTMLElement): void {
|
|
744
|
+
const headerHeight: number = util.getOuterHeight(cell.querySelector('.' + cls.DATE_HEADER_CLASS));
|
|
745
|
+
const height: number = (cell.offsetHeight - headerHeight) - (this.maxHeight ? 0 : this.moreIndicatorHeight);
|
|
746
|
+
setStyleAttribute(event, { 'height': height + 'px', 'align-items': 'center' });
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
public destroy(): void {
|
|
750
|
+
this.element = null;
|
|
751
|
+
this.fields = null;
|
|
752
|
+
this.maxHeight = null;
|
|
753
|
+
this.withIndicator = null;
|
|
754
|
+
this.maxOrIndicator = null;
|
|
755
|
+
this.moreIndicatorHeight = null;
|
|
756
|
+
this.removeEventListener();
|
|
757
|
+
super.destroy();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
}
|