@syncfusion/ej2-schedule 30.2.7 → 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 +110 -36
- package/dist/es6/ej2-schedule.es2015.js.map +1 -1
- package/dist/es6/ej2-schedule.es5.js +110 -36
- 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 +8 -5
- 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/vertical-view.js +1 -1
- 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,911 @@
|
|
|
1
|
+
import { isNullOrUndefined, extend, EventHandler, formatUnit, Browser } from '@syncfusion/ej2-base';
|
|
2
|
+
import { createElement, remove, addClass, removeClass, append, prepend } from '@syncfusion/ej2-base';
|
|
3
|
+
import { Schedule } from '../base/schedule';
|
|
4
|
+
import { ViewBase } from './view-base';
|
|
5
|
+
import { VerticalEvent } from '../event-renderer/vertical-view';
|
|
6
|
+
import { MonthEvent } from '../event-renderer/month';
|
|
7
|
+
import { RenderCellEventArgs, CellTemplateArgs, TdData, NotifyEventArgs, IRenderer, TimeSlotData, CallbackFunction } from '../base/interface';
|
|
8
|
+
import * as util from '../base/util';
|
|
9
|
+
import * as event from '../base/constant';
|
|
10
|
+
import * as cls from '../base/css-constant';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* vertical view
|
|
14
|
+
*/
|
|
15
|
+
export class VerticalView extends ViewBase implements IRenderer {
|
|
16
|
+
public currentTimeIndicatorTimer: number;
|
|
17
|
+
public viewClass: string = 'e-day-view';
|
|
18
|
+
public isInverseTableSelect: boolean = true;
|
|
19
|
+
public baseCssClass: string = 'e-vertical-view';
|
|
20
|
+
private appointment: VerticalEvent | MonthEvent = null;
|
|
21
|
+
|
|
22
|
+
constructor(parent: Schedule) {
|
|
23
|
+
super(parent);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected getModuleName(): string {
|
|
27
|
+
return 'verticalView';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public addEventListener(): void {
|
|
31
|
+
this.parent.on(event.scrollUiUpdate, this.scrollUiUpdate, this);
|
|
32
|
+
this.parent.on(event.dataReady, this.renderEvents, this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public removeEventListener(): void {
|
|
36
|
+
if (this.parent) {
|
|
37
|
+
this.parent.off(event.scrollUiUpdate, this.scrollUiUpdate);
|
|
38
|
+
this.parent.off(event.dataReady, this.renderEvents);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public renderEvents(): void {
|
|
43
|
+
this.appointment = this.parent.activeViewOptions.timeScale.enable ?
|
|
44
|
+
new VerticalEvent(this.parent) : new MonthEvent(this.parent);
|
|
45
|
+
this.appointment.renderAppointments();
|
|
46
|
+
this.parent.notify(event.eventsLoaded, {});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private onContentScroll(e: Event): void {
|
|
50
|
+
this.parent.removeNewEventElement();
|
|
51
|
+
const target: HTMLElement = <HTMLElement>e.target;
|
|
52
|
+
this.parent.notify(event.virtualScroll, e);
|
|
53
|
+
this.scrollLeftPanel(target);
|
|
54
|
+
this.scrollTopPanel(target);
|
|
55
|
+
if (!this.parent.isAdaptive) {
|
|
56
|
+
this.parent.uiStateValues.top = target.scrollTop;
|
|
57
|
+
}
|
|
58
|
+
this.parent.uiStateValues.left = target.scrollLeft;
|
|
59
|
+
if (!isNullOrUndefined(this.parent.quickPopup) && !this.parent.uiStateValues.isTapHold) {
|
|
60
|
+
this.parent.quickPopup.quickPopupHide();
|
|
61
|
+
}
|
|
62
|
+
this.setPersistence();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private onAdaptiveMove(e: Event): void {
|
|
66
|
+
if (this.parent.uiStateValues.action) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onAdaptiveScroll(e: Event): void {
|
|
72
|
+
if (this.parent && !this.parent.isDestroyed) {
|
|
73
|
+
this.parent.removeNewEventElement();
|
|
74
|
+
this.parent.uiStateValues.top = (<HTMLElement>e.target).scrollTop;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public scrollLeftPanel(target: HTMLElement): void {
|
|
79
|
+
const leftPanel: HTMLElement = this.getLeftPanelElement();
|
|
80
|
+
if (!isNullOrUndefined(leftPanel)) {
|
|
81
|
+
leftPanel.scrollTop = target.scrollTop;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private scrollUiUpdate(args: NotifyEventArgs): void {
|
|
86
|
+
if (!this.parent) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const dateHeader: HTMLElement = (this.parent.element.querySelector('.' + cls.DATE_HEADER_WRAP_CLASS) as HTMLElement);
|
|
90
|
+
const headerBarHeight: number = this.getHeaderBarHeight();
|
|
91
|
+
const timeCells: HTMLElement = this.getLeftPanelElement();
|
|
92
|
+
const content: HTMLElement = this.getScrollableElement() as HTMLElement;
|
|
93
|
+
const header: HTMLElement = this.getDatesHeaderElement();
|
|
94
|
+
const scrollerHeight: number = this.parent.element.offsetHeight - headerBarHeight - header.offsetHeight;
|
|
95
|
+
this.setContentHeight(content, timeCells, scrollerHeight);
|
|
96
|
+
this.setColWidth(content);
|
|
97
|
+
const scrollBarWidth: number = util.getScrollBarWidth();
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
(header.firstElementChild as HTMLElement).style[<any>args.cssProperties.rtlBorder] = '';
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
header.style[<any>args.cssProperties.rtlPadding] = '';
|
|
102
|
+
const isDateHeaderScroll: boolean = this.parent.enableAllDayScroll ? !((content.offsetWidth - content.clientWidth) <=
|
|
103
|
+
(dateHeader.offsetWidth - dateHeader.clientWidth) && dateHeader.classList.contains('e-all-day-scroll')) : true;
|
|
104
|
+
if (content.offsetWidth - content.clientWidth > 0 && isDateHeaderScroll) {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
+
(header.firstElementChild as HTMLElement).style[<any>args.cssProperties.border] = scrollBarWidth > 0 ? '1px' : '0px';
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
header.style[<any>args.cssProperties.padding] = scrollBarWidth > 0 ? scrollBarWidth - 1 + 'px' : '0px';
|
|
109
|
+
} else {
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
+
(header.firstElementChild as HTMLElement).style[<any>args.cssProperties.border] = '';
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
header.style[<any>args.cssProperties.padding] = '';
|
|
114
|
+
}
|
|
115
|
+
if (!args.isPreventScrollUpdate) {
|
|
116
|
+
if (this.parent.uiStateValues.isInitial) {
|
|
117
|
+
if (this.parent.currentView.indexOf('Timeline') > -1) {
|
|
118
|
+
content.scrollTop = this.parent.uiStateValues.top;
|
|
119
|
+
}
|
|
120
|
+
this.scrollToWorkHour();
|
|
121
|
+
this.parent.uiStateValues.isInitial = false;
|
|
122
|
+
} else {
|
|
123
|
+
if (timeCells) {
|
|
124
|
+
timeCells.scrollTop = this.parent.uiStateValues.top;
|
|
125
|
+
}
|
|
126
|
+
content.scrollTop = this.parent.uiStateValues.top;
|
|
127
|
+
content.scrollLeft = this.parent.uiStateValues.left;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (this.parent.activeViewOptions.timeScale.enable) {
|
|
131
|
+
this.highlightCurrentTime();
|
|
132
|
+
}
|
|
133
|
+
this.retainScrollPosition();
|
|
134
|
+
if (!isNullOrUndefined(timeCells) && !isNullOrUndefined(content) && timeCells.scrollTop !== content.scrollTop) {
|
|
135
|
+
timeCells.scrollTop = content.scrollTop;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public setContentHeight(element: HTMLElement, leftPanelElement: HTMLElement, height: number): void {
|
|
140
|
+
if (this.parent.isAdaptive && !this.isTimelineView()) {
|
|
141
|
+
element.style.height = (this.parent.height === 'auto') ? 'auto' : formatUnit(height);
|
|
142
|
+
} else {
|
|
143
|
+
if (!isNullOrUndefined(leftPanelElement)) {
|
|
144
|
+
leftPanelElement.style.height = (this.parent.height === 'auto') ? 'auto'
|
|
145
|
+
: formatUnit(height - this.getScrollXIndent(element));
|
|
146
|
+
}
|
|
147
|
+
element.style.height = (this.parent.height === 'auto') ? 'auto' : formatUnit(height);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public scrollToWorkHour(): void {
|
|
152
|
+
if (this.parent.workHours.highlight) {
|
|
153
|
+
const firstWorkHourCell: HTMLElement = <HTMLElement>this.element.querySelector('.' + cls.WORK_HOURS_CLASS);
|
|
154
|
+
if (firstWorkHourCell) {
|
|
155
|
+
this.getScrollableElement().scrollTop = firstWorkHourCell.offsetTop;
|
|
156
|
+
this.parent.uiStateValues.top = firstWorkHourCell.offsetTop;
|
|
157
|
+
this.parent.uiStateValues.left = 0;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public scrollToHour(hour: string, scrollDate?: Date): void {
|
|
163
|
+
const date: Date = this.parent.getStartEndTime(hour);
|
|
164
|
+
if (!isNullOrUndefined(scrollDate)) {
|
|
165
|
+
const headerElement: HTMLElement = this.element.querySelector('.' + cls.HEADER_CELLS_CLASS + '[data-date="' + new Date(util.resetTime(scrollDate)).getTime() + '"]');
|
|
166
|
+
if (headerElement) {
|
|
167
|
+
if (this.parent.enableRtl) {
|
|
168
|
+
const conWrap: HTMLElement = this.element.querySelector('.' + cls.CONTENT_TABLE_CLASS) as HTMLElement;
|
|
169
|
+
this.getScrollableElement().scrollLeft = -(conWrap.offsetWidth - headerElement.offsetLeft - headerElement.offsetWidth);
|
|
170
|
+
} else {
|
|
171
|
+
this.getScrollableElement().scrollLeft = headerElement.offsetLeft;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (isNullOrUndefined(date)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this.getScrollableElement().scrollTop = this.getTopFromDateTime(date);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public scrollToDate(scrollDate: Date): void {
|
|
182
|
+
this.scrollToHour(null, scrollDate);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public generateColumnLevels(): TdData[][] {
|
|
186
|
+
let level: TdData[] = this.getDateSlots(this.renderDates, this.parent.activeViewOptions.workDays);
|
|
187
|
+
let columnLevels: TdData[][] = [];
|
|
188
|
+
if (this.parent.activeViewOptions.group.resources.length > 0) {
|
|
189
|
+
columnLevels = this.parent.resourceBase.generateResourceLevels(level);
|
|
190
|
+
if (this.parent.activeViewOptions.group.hideNonWorkingDays) {
|
|
191
|
+
while (columnLevels[0].length === 0) {
|
|
192
|
+
this.parent.setProperties({ selectedDate: this.parent.activeView.getNextPreviousDate(this.previousNextAction) }, true);
|
|
193
|
+
this.parent.activeView.getRenderDates();
|
|
194
|
+
if (this.parent.headerModule) {
|
|
195
|
+
this.parent.headerModule.setCalendarDate(this.parent.selectedDate);
|
|
196
|
+
this.parent.headerModule.updateDateRange();
|
|
197
|
+
}
|
|
198
|
+
level = this.getDateSlots(this.renderDates, this.parent.activeViewOptions.workDays);
|
|
199
|
+
columnLevels = this.parent.resourceBase.generateResourceLevels(level);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (this.parent.uiStateValues.isGroupAdaptive && this.parent.resourceBase.lastResourceLevel.length > 0) {
|
|
203
|
+
const resourceLevel: TdData = this.parent.resourceBase.lastResourceLevel[this.parent.uiStateValues.groupIndex];
|
|
204
|
+
const resStartHour: string = resourceLevel.resourceData[resourceLevel.resource.startHourField] as string;
|
|
205
|
+
const resEndHour: string = resourceLevel.resourceData[resourceLevel.resource.endHourField] as string;
|
|
206
|
+
const dateSlots: TdData[] = this.getDateSlots(resourceLevel.renderDates, resourceLevel.workDays, resStartHour, resEndHour);
|
|
207
|
+
columnLevels = [dateSlots];
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
columnLevels.push(level);
|
|
211
|
+
}
|
|
212
|
+
this.colLevels = columnLevels;
|
|
213
|
+
return columnLevels;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// eslint-disable-next-line max-len
|
|
217
|
+
public getDateSlots(renderDates: Date[], workDays: number[], workStartHour: string = this.parent.workHours.start, workEndHour: string = this.parent.workHours.end): TdData[] {
|
|
218
|
+
const dateCol: TdData[] = [];
|
|
219
|
+
const start: Date = this.parent.getStartEndTime(workStartHour);
|
|
220
|
+
const end: Date = this.parent.getStartEndTime(workEndHour);
|
|
221
|
+
for (const col of renderDates) {
|
|
222
|
+
const classList: string[] = [cls.HEADER_CELLS_CLASS];
|
|
223
|
+
if (this.isCurrentDate(col)) {
|
|
224
|
+
classList.push(cls.CURRENT_DAY_CLASS);
|
|
225
|
+
}
|
|
226
|
+
dateCol.push({
|
|
227
|
+
date: col, type: 'dateHeader', className: classList, colSpan: 1,
|
|
228
|
+
workDays: workDays, startHour: new Date(+start), endHour: new Date(+end)
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return dateCol;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private isWorkHourRange(date: Date): boolean {
|
|
235
|
+
return (this.getStartHour().getTime() <= date.getTime()) && (this.getEndHour().getTime() >= date.getTime());
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
public highlightCurrentTime(): void {
|
|
239
|
+
if (this.parent.activeViewOptions.headerRows.length > 0 &&
|
|
240
|
+
this.parent.activeViewOptions.headerRows.slice(-1)[0].option !== 'Hour') {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const currentDate: Date = this.parent.getCurrentTime();
|
|
244
|
+
if (this.parent.showTimeIndicator && this.isWorkHourRange(currentDate)) {
|
|
245
|
+
const currentDateIndex: number[] = this.getCurrentTimeIndicatorIndex();
|
|
246
|
+
if (currentDateIndex.length > 0 && !isNullOrUndefined(this.element.querySelector('.' + cls.WORK_CELLS_CLASS))) {
|
|
247
|
+
this.changeCurrentTimePosition();
|
|
248
|
+
if (isNullOrUndefined(this.currentTimeIndicatorTimer)) {
|
|
249
|
+
const interval: number = util.MS_PER_MINUTE - ((currentDate.getSeconds() * 1000) + currentDate.getMilliseconds());
|
|
250
|
+
if (interval <= (util.MS_PER_MINUTE - 1000)) {
|
|
251
|
+
window.setTimeout(() => {
|
|
252
|
+
if (!isNullOrUndefined(this.currentTimeIndicatorTimer)) {
|
|
253
|
+
this.clearCurrentTimeIndicatorTimer();
|
|
254
|
+
this.changeCurrentTimePosition();
|
|
255
|
+
this.updateCurrentTimeIndicatorTimer();
|
|
256
|
+
}
|
|
257
|
+
}, interval);
|
|
258
|
+
}
|
|
259
|
+
this.updateCurrentTimeIndicatorTimer();
|
|
260
|
+
}
|
|
261
|
+
} else {
|
|
262
|
+
this.clearCurrentTimeIndicatorTimer();
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
this.clearCurrentTimeIndicatorTimer();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
public getCurrentTimeIndicatorIndex(): number[] {
|
|
270
|
+
const currentDateIndex: number[] = [];
|
|
271
|
+
if (!isNullOrUndefined(this.parent.resourceBase) && (this.parent.activeViewOptions.group.resources.length > 0) &&
|
|
272
|
+
!this.parent.uiStateValues.isGroupAdaptive) {
|
|
273
|
+
let count: number = 0;
|
|
274
|
+
const currentDate: Date = util.resetTime(this.parent.getCurrentTime());
|
|
275
|
+
if (this.parent.virtualScrollModule && this.parent.activeViewOptions.allowVirtualScrolling &&
|
|
276
|
+
this.parent.activeViewOptions.group.byDate) {
|
|
277
|
+
for (const resource of this.parent.resourceBase.expandedResources) {
|
|
278
|
+
if (util.resetTime(resource.date).getTime() === currentDate.getTime()) {
|
|
279
|
+
currentDateIndex.push(count);
|
|
280
|
+
}
|
|
281
|
+
count += 1;
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
for (const resource of this.parent.resourceBase.renderedResources) {
|
|
285
|
+
const index: number = this.parent.getIndexOfDate(resource.renderDates, currentDate);
|
|
286
|
+
if (index >= 0) {
|
|
287
|
+
const resIndex: number = this.parent.activeViewOptions.group.byDate ?
|
|
288
|
+
(this.parent.resourceBase.lastResourceLevel.length * index) + count : count + index;
|
|
289
|
+
currentDateIndex.push(resIndex);
|
|
290
|
+
}
|
|
291
|
+
count += this.parent.activeViewOptions.group.byDate ? 1 : resource.renderDates.length;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
const renderDates: Date[] = (this.parent.uiStateValues.isGroupAdaptive && this.parent.resourceBase.lastResourceLevel.length > 0)
|
|
296
|
+
? this.parent.resourceBase.lastResourceLevel[this.parent.uiStateValues.groupIndex].renderDates : this.renderDates;
|
|
297
|
+
const index: number = this.parent.getIndexOfDate(renderDates, util.resetTime(this.parent.getCurrentTime()));
|
|
298
|
+
if (index >= 0) {
|
|
299
|
+
currentDateIndex.push(index);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return currentDateIndex;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private clearCurrentTimeIndicatorTimer(): void {
|
|
306
|
+
if (!isNullOrUndefined(this.currentTimeIndicatorTimer)) {
|
|
307
|
+
window.clearInterval(this.currentTimeIndicatorTimer);
|
|
308
|
+
this.currentTimeIndicatorTimer = null;
|
|
309
|
+
this.removeCurrentTimeIndicatorElements();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private updateCurrentTimeIndicatorTimer(): void {
|
|
314
|
+
this.currentTimeIndicatorTimer = window.setInterval(() => { this.changeCurrentTimePosition(); }, util.MS_PER_MINUTE);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
public removeCurrentTimeIndicatorElements(): void {
|
|
318
|
+
const queryString: string = '.' + cls.PREVIOUS_TIMELINE_CLASS + ',.' + cls.CURRENT_TIMELINE_CLASS + ',.' + cls.CURRENT_TIME_CLASS;
|
|
319
|
+
const timeIndicator: HTMLElement[] = [].slice.call(this.element.querySelectorAll(queryString));
|
|
320
|
+
for (const indicator of timeIndicator) {
|
|
321
|
+
remove(indicator);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
public changeCurrentTimePosition(): void {
|
|
326
|
+
if (!this.parent || this.parent && this.parent.isDestroyed) {
|
|
327
|
+
this.parent = null;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
this.removeCurrentTimeIndicatorElements();
|
|
331
|
+
const currentDateIndex: number[] = this.getCurrentTimeIndicatorIndex();
|
|
332
|
+
const firstRow: HTMLTableRowElement = (this.parent.getContentTable() as HTMLTableElement).rows[0];
|
|
333
|
+
const top: number = this.getTopFromDateTime(this.parent.getCurrentTime());
|
|
334
|
+
const topInPx: string = formatUnit(top);
|
|
335
|
+
const rowIndex: number = Math.floor(top / firstRow.cells[0].offsetHeight);
|
|
336
|
+
const timeCellsWrap: Element = this.getLeftPanelElement();
|
|
337
|
+
const timeTrs: HTMLElement[] = [].slice.call(timeCellsWrap.querySelectorAll('tr'));
|
|
338
|
+
if (isNullOrUndefined(rowIndex) || isNaN(rowIndex) || rowIndex === timeTrs.length) { return; }
|
|
339
|
+
const curTimeWrap: HTMLElement[] = [].slice.call(this.element.querySelectorAll('.' + cls.TIMELINE_WRAPPER_CLASS));
|
|
340
|
+
for (let i: number = 0, length: number = currentDateIndex[0]; i < length; i++) {
|
|
341
|
+
curTimeWrap[parseInt(i.toString(), 10)].appendChild(createElement('div', { className: cls.PREVIOUS_TIMELINE_CLASS, styles: 'top:' + topInPx }));
|
|
342
|
+
}
|
|
343
|
+
for (const day of currentDateIndex) {
|
|
344
|
+
if (curTimeWrap.length > day) {
|
|
345
|
+
curTimeWrap[parseInt(day.toString(), 10)].appendChild(createElement('div', {
|
|
346
|
+
className: cls.CURRENT_TIMELINE_CLASS, styles: 'top:' + topInPx
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const currentTimeEle: HTMLElement = createElement('div', {
|
|
351
|
+
innerHTML: this.parent.getTimeString(this.parent.getCurrentTime()),
|
|
352
|
+
className: cls.CURRENT_TIME_CLASS,
|
|
353
|
+
styles: 'top:' + topInPx
|
|
354
|
+
});
|
|
355
|
+
if (rowIndex <= timeTrs.length) {
|
|
356
|
+
removeClass(timeCellsWrap.querySelectorAll('.' + cls.HIDE_CHILDS_CLASS), cls.HIDE_CHILDS_CLASS);
|
|
357
|
+
if (timeTrs[parseInt(rowIndex.toString(), 10)]) {
|
|
358
|
+
addClass([timeTrs[parseInt(rowIndex.toString(), 10)].lastElementChild as Element], cls.HIDE_CHILDS_CLASS);
|
|
359
|
+
}
|
|
360
|
+
prepend([currentTimeEle], timeCellsWrap);
|
|
361
|
+
currentTimeEle.style.top = formatUnit(currentTimeEle.offsetTop - (currentTimeEle.offsetHeight / 2));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
public getTopFromDateTime(date: Date): number {
|
|
366
|
+
const startHour: Date = this.getStartEndHours(this.parent.activeViewOptions.startHour);
|
|
367
|
+
const endHour: Date = this.getStartEndHours(this.parent.activeViewOptions.endHour);
|
|
368
|
+
const diffInMinutes: number = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
|
|
369
|
+
const hoursRange: { [key: string]: Date } =
|
|
370
|
+
util.getStartEndHours(util.resetTime(new Date(date.getTime())), startHour, endHour);
|
|
371
|
+
const totalMinutes: number = (hoursRange.endHour.getTime() - hoursRange.startHour.getTime()) / util.MS_PER_MINUTE;
|
|
372
|
+
const timescaleInterval: number = this.parent.activeViewOptions.timeScale.interval;
|
|
373
|
+
let interval: number = 0;
|
|
374
|
+
if (startHour.getHours() === 0 && startHour.getMinutes() === 0 && endHour.getHours() === 0 && endHour.getMinutes() === 0) {
|
|
375
|
+
interval = timescaleInterval;
|
|
376
|
+
} else {
|
|
377
|
+
interval = (this.parent.activeViewOptions.timeScale.slotCount !== 1) ? timescaleInterval :
|
|
378
|
+
(timescaleInterval > totalMinutes ? totalMinutes : timescaleInterval);
|
|
379
|
+
}
|
|
380
|
+
return (diffInMinutes * this.getWorkCellHeight() * this.parent.activeViewOptions.timeScale.slotCount) / interval;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private getWorkCellHeight(): number {
|
|
384
|
+
return parseFloat(this.parent.getElementHeight(this.element.querySelector('.' + cls.WORK_CELLS_CLASS)).toFixed(2));
|
|
385
|
+
}
|
|
386
|
+
private getTdContent(date: Date, type: string, groupIndex?: number): HTMLElement[] {
|
|
387
|
+
let cntEle: HTMLElement[];
|
|
388
|
+
const wrapper: HTMLElement = createElement('div');
|
|
389
|
+
let templateName: string = '';
|
|
390
|
+
const templateId: string = this.parent.element.id + '_';
|
|
391
|
+
switch (type) {
|
|
392
|
+
case 'dateHeader':
|
|
393
|
+
if (this.parent.activeViewOptions.dateHeaderTemplate) {
|
|
394
|
+
templateName = 'dateHeaderTemplate';
|
|
395
|
+
const args: CellTemplateArgs = { date: date, type: type, groupIndex: groupIndex };
|
|
396
|
+
const viewName: string = this.parent.activeViewOptions.dateHeaderTemplateName;
|
|
397
|
+
cntEle = [].slice.call(this.parent.getDateHeaderTemplate()(args, this.parent, templateName,
|
|
398
|
+
templateId + viewName + templateName,
|
|
399
|
+
false, undefined, undefined, this.parent.root));
|
|
400
|
+
} else {
|
|
401
|
+
wrapper.innerHTML = this.parent.activeView.isTimelineView() ?
|
|
402
|
+
`<span class="e-header-date e-navigate">${this.getTimelineDate(date)}</span>` :
|
|
403
|
+
`<div class="e-header-day">${util.capitalizeFirstWord(this.getDayName(date), 'single')}</div>` +
|
|
404
|
+
`<div class="e-header-date e-navigate" role="link">${this.getDate(date)}</div>`;
|
|
405
|
+
cntEle = [].slice.call(wrapper.childNodes);
|
|
406
|
+
}
|
|
407
|
+
break;
|
|
408
|
+
case 'majorSlot':
|
|
409
|
+
if (this.parent.activeViewOptions.timeScale.majorSlotTemplate) {
|
|
410
|
+
templateName = 'majorSlotTemplate';
|
|
411
|
+
const args: CellTemplateArgs = { date: date, type: type };
|
|
412
|
+
cntEle = [].slice.call(this.parent.getMajorSlotTemplate()(args, this.parent, templateName,
|
|
413
|
+
templateId + templateName,
|
|
414
|
+
false, undefined, undefined, this.parent.root));
|
|
415
|
+
} else {
|
|
416
|
+
wrapper.innerHTML = `<span>${this.getTime(date)}</span>`;
|
|
417
|
+
cntEle = [].slice.call(wrapper.childNodes);
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
case 'minorSlot':
|
|
421
|
+
if (this.parent.activeViewOptions.timeScale.minorSlotTemplate) {
|
|
422
|
+
templateName = 'minorSlotTemplate';
|
|
423
|
+
const args: CellTemplateArgs = { date: date, type: type };
|
|
424
|
+
cntEle = [].slice.call(this.parent.getMinorSlotTemplate()(args, this.parent,
|
|
425
|
+
templateName, templateId + templateName,
|
|
426
|
+
false, undefined, undefined, this.parent.root));
|
|
427
|
+
} else {
|
|
428
|
+
cntEle = [].slice.call(wrapper.childNodes);
|
|
429
|
+
}
|
|
430
|
+
break;
|
|
431
|
+
case 'alldayCells':
|
|
432
|
+
if (this.parent.activeViewOptions.cellTemplate) {
|
|
433
|
+
const viewName: string = this.parent.activeViewOptions.cellTemplateName;
|
|
434
|
+
templateName = 'cellTemplate';
|
|
435
|
+
const args: CellTemplateArgs = { date: date, type: type, groupIndex: groupIndex };
|
|
436
|
+
cntEle = [].slice.call(this.parent.getCellTemplate()(args, this.parent, templateName,
|
|
437
|
+
templateId + viewName + templateName,
|
|
438
|
+
false, undefined, undefined, this.parent.root));
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
return cntEle;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
public refreshHeader(): void {
|
|
446
|
+
remove(this.element.querySelector('tbody tr'));
|
|
447
|
+
this.renderHeader();
|
|
448
|
+
this.parent.notify(event.contentReady, {});
|
|
449
|
+
const dateHeader: HTMLElement = (this.element.querySelector('.' + cls.DATE_HEADER_WRAP_CLASS) as HTMLElement);
|
|
450
|
+
if (dateHeader) {
|
|
451
|
+
dateHeader.scrollLeft = this.parent.uiStateValues.left;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
public renderLayout(type: string): void {
|
|
456
|
+
this.setPanel(createElement('div', { className: cls.TABLE_WRAP_CLASS }));
|
|
457
|
+
const clsList: string[] = [this.baseCssClass, this.viewClass];
|
|
458
|
+
clsList.push(type);
|
|
459
|
+
if (this.parent.activeViewOptions.group.byDate) {
|
|
460
|
+
clsList.push('e-by-date');
|
|
461
|
+
}
|
|
462
|
+
if (!this.parent.activeViewOptions.timeScale.enable) {
|
|
463
|
+
addClass([this.element], [cls.TIMESCALE_DISABLE, this.viewClass]);
|
|
464
|
+
}
|
|
465
|
+
if (this.parent.activeViewOptions.allowVirtualScrolling && !this.parent.uiStateValues.isGroupAdaptive) {
|
|
466
|
+
clsList.push(cls.VIRTUAL_SCROLL_CLASS);
|
|
467
|
+
}
|
|
468
|
+
if (this.parent.rowAutoHeight && this.parent.eventSettings.ignoreWhitespace) {
|
|
469
|
+
clsList.push(cls.IGNORE_WHITESPACE);
|
|
470
|
+
}
|
|
471
|
+
this.renderPanel(type);
|
|
472
|
+
addClass([this.element], clsList);
|
|
473
|
+
this.element.appendChild(this.createTableLayout(cls.OUTER_TABLE_CLASS) as HTMLElement);
|
|
474
|
+
this.element.querySelector('table').setAttribute('role', 'presentation');
|
|
475
|
+
this.colLevels = this.generateColumnLevels();
|
|
476
|
+
this.renderHeader();
|
|
477
|
+
this.renderContent();
|
|
478
|
+
if (this.parent.uiStateValues.isGroupAdaptive && !this.parent.element.querySelector('.' + cls.RESOURCE_TOOLBAR_CONTAINER)) {
|
|
479
|
+
this.renderResourceMobileLayout();
|
|
480
|
+
}
|
|
481
|
+
this.parent.notify(event.contentReady, {});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
public renderHeader(): void {
|
|
485
|
+
const tr: Element = createElement('tr');
|
|
486
|
+
const dateTd: Element = createElement('td');
|
|
487
|
+
dateTd.appendChild(this.renderDatesHeader());
|
|
488
|
+
if (this.parent.activeViewOptions.timeScale.enable) {
|
|
489
|
+
const indentTd: Element = createElement('td', { className: cls.LEFT_INDENT_CLASS });
|
|
490
|
+
indentTd.appendChild(this.renderLeftIndent());
|
|
491
|
+
tr.appendChild(indentTd);
|
|
492
|
+
}
|
|
493
|
+
tr.appendChild(dateTd);
|
|
494
|
+
prepend([tr], this.element.querySelector('tbody'));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
public renderContent(): void {
|
|
498
|
+
if (this.parent.activeViewOptions.group.resources.length > 0) {
|
|
499
|
+
this.parent.resourceBase.renderedResources = <TdData[]>extend([], this.parent.resourceBase.lastResourceLevel, null, true);
|
|
500
|
+
}
|
|
501
|
+
const tr: Element = createElement('tr');
|
|
502
|
+
const workTd: Element = createElement('td');
|
|
503
|
+
if (this.parent.isAdaptive) {
|
|
504
|
+
workTd.setAttribute('colspan', (this.parent.activeViewOptions.timeScale.enable ? '2' : '1'));
|
|
505
|
+
const scrollContainer: HTMLElement = createElement('div', { className: cls.SCROLL_CONTAINER_CLASS });
|
|
506
|
+
if (this.parent.activeViewOptions.timeScale.enable) {
|
|
507
|
+
scrollContainer.appendChild(this.renderTimeCells());
|
|
508
|
+
}
|
|
509
|
+
scrollContainer.appendChild(this.renderContentArea());
|
|
510
|
+
workTd.appendChild(scrollContainer);
|
|
511
|
+
EventHandler.add(scrollContainer, 'scroll', this.onAdaptiveScroll, this);
|
|
512
|
+
EventHandler.add(scrollContainer, Browser.touchMoveEvent, this.onAdaptiveMove, this);
|
|
513
|
+
tr.appendChild(workTd);
|
|
514
|
+
} else {
|
|
515
|
+
const levels: TdData[][] = this.colLevels.slice(0);
|
|
516
|
+
if (this.parent.virtualScrollModule) {
|
|
517
|
+
this.resetColLevels();
|
|
518
|
+
}
|
|
519
|
+
const wrap: Element = this.renderContentArea();
|
|
520
|
+
workTd.appendChild(wrap);
|
|
521
|
+
if (this.parent.activeViewOptions.timeScale.enable) {
|
|
522
|
+
const timesTd: Element = createElement('td');
|
|
523
|
+
timesTd.appendChild(this.renderTimeCells());
|
|
524
|
+
tr.appendChild(timesTd);
|
|
525
|
+
}
|
|
526
|
+
tr.appendChild(workTd);
|
|
527
|
+
if (this.parent.virtualScrollModule) {
|
|
528
|
+
this.colLevels = levels;
|
|
529
|
+
this.parent.virtualScrollModule.renderVirtualTrack(wrap);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
this.element.querySelector('tbody').appendChild(tr);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
private renderLeftIndent(): HTMLElement {
|
|
536
|
+
const wrap: HTMLElement = createElement('div', { className: cls.LEFT_INDENT_WRAP_CLASS });
|
|
537
|
+
const tbl: Element = this.createTableLayout();
|
|
538
|
+
const trEle: Element = createElement('tr');
|
|
539
|
+
const rowCount: number = this.colLevels.length;
|
|
540
|
+
let nth: Element;
|
|
541
|
+
for (let i: number = 0; i < rowCount; i++) {
|
|
542
|
+
const ntr: Element = trEle.cloneNode() as Element;
|
|
543
|
+
const data: TdData = { className: [(this.colLevels[parseInt(i.toString(), 10)][0] && this.colLevels[parseInt(i.toString(), 10)][0].className[0])], type: 'emptyCells' };
|
|
544
|
+
if (this.parent.activeViewOptions.showWeekNumber && data.className.indexOf(cls.HEADER_CELLS_CLASS) !== -1) {
|
|
545
|
+
data.className.push(cls.WEEK_NUMBER_CLASS);
|
|
546
|
+
const weekNo: string = this.parent.getWeekNumberContent(this.renderDates);
|
|
547
|
+
data.template = [createElement('span', {
|
|
548
|
+
innerHTML: '' + weekNo,
|
|
549
|
+
attrs: { title: this.parent.localeObj.getConstant('week') + ' ' + weekNo }
|
|
550
|
+
})];
|
|
551
|
+
}
|
|
552
|
+
nth = this.createTd(data);
|
|
553
|
+
this.parent.renderHeaderIndentTemplate(data, nth);
|
|
554
|
+
ntr.appendChild(nth);
|
|
555
|
+
tbl.querySelector('tbody').appendChild(ntr);
|
|
556
|
+
}
|
|
557
|
+
const ntr: Element = trEle.cloneNode() as Element;
|
|
558
|
+
const appointmentExpandCollapse: Element = createElement('div', {
|
|
559
|
+
attrs: {
|
|
560
|
+
'tabindex': '0', 'role': 'button',
|
|
561
|
+
title: this.parent.localeObj.getConstant('expandAllDaySection'), 'aria-disabled': 'false',
|
|
562
|
+
'aria-label': this.parent.localeObj.getConstant('expandAllDaySection')
|
|
563
|
+
},
|
|
564
|
+
className: cls.ALLDAY_APPOINTMENT_SECTION_CLASS + ' ' + cls.APPOINTMENT_ROW_EXPAND_CLASS + ' ' +
|
|
565
|
+
cls.ICON + ' ' + cls.DISABLE_CLASS
|
|
566
|
+
});
|
|
567
|
+
const data: TdData = { className: [cls.ALLDAY_CELLS_CLASS], type: 'emptyCells' };
|
|
568
|
+
nth = this.createTd(data);
|
|
569
|
+
nth.appendChild(appointmentExpandCollapse);
|
|
570
|
+
this.parent.renderHeaderIndentTemplate(data, nth);
|
|
571
|
+
ntr.appendChild(nth);
|
|
572
|
+
tbl.querySelector('tbody').appendChild(ntr);
|
|
573
|
+
wrap.appendChild(tbl);
|
|
574
|
+
return wrap;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
public renderDatesHeader(): Element {
|
|
578
|
+
const container: Element = createElement('div', { className: cls.DATE_HEADER_CONTAINER_CLASS });
|
|
579
|
+
const wrap: Element = createElement('div', { className: cls.DATE_HEADER_WRAP_CLASS });
|
|
580
|
+
container.appendChild(wrap);
|
|
581
|
+
const tbl: Element = this.createTableLayout();
|
|
582
|
+
const trEle: Element = createElement('tr', { className: cls.HEADER_ROW_CLASS });
|
|
583
|
+
const rowCount: number = this.colLevels.length;
|
|
584
|
+
const lastLevel: TdData[] = this.colLevels[rowCount - 1];
|
|
585
|
+
for (let i: number = 0; i < rowCount; i++) {
|
|
586
|
+
const ntr: Element = trEle.cloneNode() as Element;
|
|
587
|
+
const level: TdData[] = this.colLevels[parseInt(i.toString(), 10)];
|
|
588
|
+
for (let j: number = 0; j < level.length; j++) {
|
|
589
|
+
ntr.appendChild(this.createTd(level[parseInt(j.toString(), 10)]));
|
|
590
|
+
}
|
|
591
|
+
tbl.querySelector('tbody').appendChild(ntr);
|
|
592
|
+
}
|
|
593
|
+
this.createAllDayRow(tbl, lastLevel);
|
|
594
|
+
this.createColGroup(tbl, lastLevel);
|
|
595
|
+
wrap.appendChild(tbl);
|
|
596
|
+
return container;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
public createAllDayRow(table: Element, tdData: TdData[]): void {
|
|
600
|
+
const ntr: Element = createElement('tr', { className: cls.ALLDAY_ROW_CLASS });
|
|
601
|
+
for (let j: number = 0; j < tdData.length; j++) {
|
|
602
|
+
const td: TdData = <TdData>extend({}, tdData[parseInt(j.toString(), 10)]);
|
|
603
|
+
td.className = [cls.ALLDAY_CELLS_CLASS];
|
|
604
|
+
td.type = 'alldayCells';
|
|
605
|
+
const ntd: Element = this.createTd(td);
|
|
606
|
+
ntd.setAttribute('data-date', td.date.getTime().toString());
|
|
607
|
+
if (!isNullOrUndefined(td.groupIndex)) {
|
|
608
|
+
ntd.setAttribute('data-group-index', '' + td.groupIndex);
|
|
609
|
+
} else if (this.parent.uiStateValues.isGroupAdaptive) {
|
|
610
|
+
ntd.setAttribute('data-group-index', '' + this.parent.uiStateValues.groupIndex);
|
|
611
|
+
}
|
|
612
|
+
this.wireCellEvents(ntd);
|
|
613
|
+
ntr.appendChild(ntd);
|
|
614
|
+
}
|
|
615
|
+
table.querySelector('tbody').appendChild(ntr);
|
|
616
|
+
const thead: HTMLElement = createElement('thead');
|
|
617
|
+
thead.appendChild(this.parent.eventBase.createEventWrapper('allDay'));
|
|
618
|
+
prepend([thead], table);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
public createTd(td: TdData): Element {
|
|
622
|
+
const tdEle: Element = createElement('td');
|
|
623
|
+
this.addAttributes(td, tdEle);
|
|
624
|
+
if (td.date && td.type) {
|
|
625
|
+
const ele: HTMLElement[] = this.getTdContent(td.date, td.type, td.groupIndex);
|
|
626
|
+
if (ele && ele.length) {
|
|
627
|
+
append(ele, tdEle);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (!this.parent.isMinMaxDate(util.resetTime(new Date('' + td.date)))) {
|
|
631
|
+
addClass([tdEle], cls.DISABLE_DATES);
|
|
632
|
+
}
|
|
633
|
+
if (td.type === 'resourceHeader') {
|
|
634
|
+
this.setResourceHeaderContent(tdEle, td);
|
|
635
|
+
}
|
|
636
|
+
if (td.type === 'dateHeader' && td.className.indexOf(cls.HEADER_CELLS_CLASS) >= 0) {
|
|
637
|
+
tdEle.setAttribute('data-date', td.date.getTime().toString());
|
|
638
|
+
if (!isNullOrUndefined(td.groupIndex)) {
|
|
639
|
+
tdEle.setAttribute('data-group-index', '' + td.groupIndex);
|
|
640
|
+
}
|
|
641
|
+
this.wireMouseEvents(tdEle);
|
|
642
|
+
}
|
|
643
|
+
const args: RenderCellEventArgs = { elementType: td.type, element: tdEle, date: td.date, groupIndex: td.groupIndex };
|
|
644
|
+
this.parent.trigger(event.renderCell, args);
|
|
645
|
+
return tdEle;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
private wireCellEvents(element: Element): void {
|
|
649
|
+
EventHandler.add(element, 'mousedown', this.parent.workCellAction.cellMouseDown, this.parent.workCellAction);
|
|
650
|
+
this.wireMouseEvents(element);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
private wireMouseEvents(element: Element): void {
|
|
654
|
+
EventHandler.add(element, 'click', this.parent.workCellAction.cellClick, this.parent.workCellAction);
|
|
655
|
+
if (!this.parent.isAdaptive) {
|
|
656
|
+
EventHandler.add(element, 'dblclick', this.parent.workCellAction.cellDblClick, this.parent.workCellAction);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
private renderTimeCells(): HTMLElement {
|
|
661
|
+
const wrap: HTMLElement = createElement('div', { className: cls.TIME_CELLS_WRAP_CLASS });
|
|
662
|
+
const tbl: Element = this.createTableLayout();
|
|
663
|
+
const trEle: Element = createElement('tr');
|
|
664
|
+
const handler: CallbackFunction = (r: TimeSlotData): TimeSlotData => {
|
|
665
|
+
r.type = r.first ? 'majorSlot' : 'minorSlot';
|
|
666
|
+
r.className = r.last ? [cls.TIME_CELLS_CLASS, cls.TIME_SLOT_CLASS] : [cls.TIME_SLOT_CLASS];
|
|
667
|
+
const ntr: Element = trEle.cloneNode() as Element;
|
|
668
|
+
const data: TdData = { date: r.date, type: r.type, className: r.className };
|
|
669
|
+
ntr.appendChild(this.createTd(data));
|
|
670
|
+
tbl.querySelector('tbody').appendChild(ntr);
|
|
671
|
+
return r;
|
|
672
|
+
};
|
|
673
|
+
this.getTimeSlotRows(handler);
|
|
674
|
+
wrap.appendChild(tbl);
|
|
675
|
+
return wrap;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
public renderContentArea(): Element {
|
|
679
|
+
const wrap: Element = createElement('div', { className: cls.CONTENT_WRAP_CLASS });
|
|
680
|
+
const tbl: Element = this.createTableLayout(cls.CONTENT_TABLE_CLASS);
|
|
681
|
+
this.setAriaAttributes(tbl);
|
|
682
|
+
this.addAutoHeightClass(tbl);
|
|
683
|
+
this.renderContentTable(tbl);
|
|
684
|
+
this.createColGroup(tbl, this.colLevels.slice(-1)[0]);
|
|
685
|
+
wrap.appendChild(tbl);
|
|
686
|
+
this.wireCellEvents(tbl.querySelector('tbody'));
|
|
687
|
+
EventHandler.add(wrap, 'scroll', this.onContentScroll, this);
|
|
688
|
+
EventHandler.add(wrap, Browser.touchMoveEvent, this.onAdaptiveMove, this);
|
|
689
|
+
return wrap;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
public renderContentTable(table: Element): void {
|
|
693
|
+
const tBody: Element = table.querySelector('tbody');
|
|
694
|
+
append(this.getContentRows(), tBody);
|
|
695
|
+
this.renderContentTableHeader(table);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
public getContentRows(): Element[] {
|
|
699
|
+
const rows: Element[] = [];
|
|
700
|
+
const tr: Element = createElement('tr');
|
|
701
|
+
const td: Element = createElement('td');
|
|
702
|
+
const existingGroupIndices: number[] = this.getGroupIndices();
|
|
703
|
+
const handler: CallbackFunction = (r: TimeSlotData): TimeSlotData => {
|
|
704
|
+
const ntr: Element = tr.cloneNode() as Element;
|
|
705
|
+
for (const tdData of this.colLevels[this.colLevels.length - 1]) {
|
|
706
|
+
let isAllowTdCreation: boolean = true;
|
|
707
|
+
if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
|
|
708
|
+
if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
|
|
709
|
+
isAllowTdCreation = false;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (isAllowTdCreation) {
|
|
713
|
+
const ntd: Element = this.createContentTd(tdData, r, td);
|
|
714
|
+
ntr.appendChild(ntd);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
rows.push(ntr);
|
|
718
|
+
return r;
|
|
719
|
+
};
|
|
720
|
+
this.getTimeSlotRows(handler);
|
|
721
|
+
return rows;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
public createContentTd(tdData: TdData, r: TimeSlotData, td: Element): Element {
|
|
725
|
+
const ntd: Element = td.cloneNode() as Element;
|
|
726
|
+
if (tdData.colSpan) { ntd.setAttribute('colspan', tdData.colSpan.toString()); }
|
|
727
|
+
const clsName: string[] = this.getContentTdClass(r);
|
|
728
|
+
let cellDate: Date = util.resetTime(tdData.date);
|
|
729
|
+
if (!this.parent.isMinMaxDate(cellDate)) {
|
|
730
|
+
clsName.push(cls.DISABLE_DATES);
|
|
731
|
+
}
|
|
732
|
+
cellDate = new Date(cellDate.setHours(r.date.getHours(), r.date.getMinutes(), r.date.getSeconds(), r.date.getMilliseconds()));
|
|
733
|
+
let type: string = 'workCells';
|
|
734
|
+
if (tdData.className.indexOf(cls.RESOURCE_PARENT_CLASS) !== -1) {
|
|
735
|
+
clsName.push(cls.RESOURCE_GROUP_CELLS_CLASS);
|
|
736
|
+
type = 'resourceGroupCells';
|
|
737
|
+
}
|
|
738
|
+
if (this.parent.workHours.highlight && ((this.parent.activeViewOptions.timeScale.enable &&
|
|
739
|
+
this.isWorkHour(cellDate, tdData.startHour, tdData.endHour, tdData.workDays)) ||
|
|
740
|
+
(!this.parent.activeViewOptions.timeScale.enable && this.isWorkDay(cellDate, tdData.workDays)))) {
|
|
741
|
+
clsName.push(cls.WORK_HOURS_CLASS);
|
|
742
|
+
}
|
|
743
|
+
addClass([ntd], clsName);
|
|
744
|
+
if (this.parent.activeViewOptions.cellTemplate) {
|
|
745
|
+
const args: CellTemplateArgs = { date: cellDate, type: type, groupIndex: tdData.groupIndex };
|
|
746
|
+
const scheduleId: string = this.parent.element.id + '_';
|
|
747
|
+
const viewName: string = this.parent.activeViewOptions.cellTemplateName;
|
|
748
|
+
const templateId: string = scheduleId + viewName + 'cellTemplate';
|
|
749
|
+
const tooltipTemplate: HTMLElement[] = [].slice.call(this.parent.getCellTemplate()(args, this.parent, 'cellTemplate',
|
|
750
|
+
templateId, false, undefined, undefined,
|
|
751
|
+
this.parent.root));
|
|
752
|
+
append(tooltipTemplate, ntd);
|
|
753
|
+
}
|
|
754
|
+
ntd.setAttribute('data-date', cellDate.getTime().toString());
|
|
755
|
+
const skeleton: string = 'full';
|
|
756
|
+
if (!this.parent.activeViewOptions.timeScale.enable) {
|
|
757
|
+
const announcementText: string =
|
|
758
|
+
this.parent.globalize.formatDate(tdData.date, { skeleton: skeleton, calendar: this.parent.getCalendarMode() });
|
|
759
|
+
ntd.setAttribute('aria-label', announcementText);
|
|
760
|
+
} else {
|
|
761
|
+
const startDateText: string = this.parent.globalize.formatDate( cellDate, {
|
|
762
|
+
type: 'dateTime', skeleton: skeleton, calendar: this.parent.getCalendarMode()
|
|
763
|
+
});
|
|
764
|
+
const endDateText: string = this.parent.globalize.formatDate(this.getEndDateFromStartDate(cellDate), {
|
|
765
|
+
type: 'dateTime', skeleton: skeleton, calendar: this.parent.getCalendarMode()
|
|
766
|
+
});
|
|
767
|
+
ntd.setAttribute('aria-label', startDateText + ' ' + this.parent.localeObj.getConstant('endAt') + ' ' + endDateText);
|
|
768
|
+
}
|
|
769
|
+
if (!isNullOrUndefined(tdData.groupIndex) || this.parent.uiStateValues.isGroupAdaptive) {
|
|
770
|
+
const groupIndex: number = this.parent.uiStateValues.isGroupAdaptive ? this.parent.uiStateValues.groupIndex :
|
|
771
|
+
tdData.groupIndex;
|
|
772
|
+
ntd.setAttribute('data-group-index', '' + groupIndex);
|
|
773
|
+
}
|
|
774
|
+
const args: RenderCellEventArgs = { elementType: type, element: ntd, date: cellDate, groupIndex: tdData.groupIndex };
|
|
775
|
+
this.parent.trigger(event.renderCell, args);
|
|
776
|
+
return ntd;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
public getContentTdClass(r: TimeSlotData): string[] {
|
|
780
|
+
return r.last ? [cls.WORK_CELLS_CLASS] : [cls.WORK_CELLS_CLASS, cls.ALTERNATE_CELLS_CLASS];
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
private renderContentTableHeader(table: Element): void {
|
|
784
|
+
const thead: Element = createElement('thead');
|
|
785
|
+
thead.appendChild(this.parent.eventBase.createEventWrapper());
|
|
786
|
+
if (this.parent.activeViewOptions.timeScale.enable) {
|
|
787
|
+
thead.appendChild(this.parent.eventBase.createEventWrapper('timeIndicator'));
|
|
788
|
+
}
|
|
789
|
+
prepend([thead], table);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
public getScrollableElement(): Element {
|
|
793
|
+
if (this.parent.isAdaptive && !this.isTimelineView()) {
|
|
794
|
+
return this.element.querySelector('.' + cls.SCROLL_CONTAINER_CLASS);
|
|
795
|
+
} else {
|
|
796
|
+
return this.getContentAreaElement();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
public getLeftPanelElement(): HTMLElement {
|
|
801
|
+
return this.element.querySelector('.' + cls.TIME_CELLS_WRAP_CLASS) as HTMLElement;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
public getEndDateFromStartDate(start: Date): Date {
|
|
805
|
+
const msMajorInterval: number = this.parent.activeViewOptions.timeScale.interval * util.MS_PER_MINUTE;
|
|
806
|
+
const msInterval: number = msMajorInterval / this.parent.activeViewOptions.timeScale.slotCount;
|
|
807
|
+
const end: Date = new Date(start.getTime());
|
|
808
|
+
end.setMilliseconds(end.getMilliseconds() + msInterval);
|
|
809
|
+
return end;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
private getStartEndHours(startEndTime: string): Date {
|
|
813
|
+
if (!isNullOrUndefined(startEndTime) && startEndTime !== '') {
|
|
814
|
+
const startEndDate: Date = new Date(2000, 0, 0, 0);
|
|
815
|
+
const timeString: string[] = startEndTime.split(':');
|
|
816
|
+
if (timeString.length === 2) {
|
|
817
|
+
startEndDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0);
|
|
818
|
+
}
|
|
819
|
+
return startEndDate;
|
|
820
|
+
}
|
|
821
|
+
return new Date(2000, 0, 0, 0);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
public getTimeSlotRows(handler?: CallbackFunction): TimeSlotData[] {
|
|
825
|
+
const rows: TimeSlotData[] = [];
|
|
826
|
+
const startHour: Date = this.getStartEndHours(this.parent.activeViewOptions.startHour);
|
|
827
|
+
const endHour: Date = this.getStartEndHours(this.parent.activeViewOptions.endHour);
|
|
828
|
+
const msMajorInterval: number = this.parent.activeViewOptions.timeScale.interval * util.MS_PER_MINUTE;
|
|
829
|
+
const msInterval: number = msMajorInterval / this.parent.activeViewOptions.timeScale.slotCount;
|
|
830
|
+
let length: number = Math.round(util.MS_PER_DAY / msInterval);
|
|
831
|
+
const msStartHour: number = startHour.getTime();
|
|
832
|
+
const msEndHour: number = endHour.getTime();
|
|
833
|
+
if (msStartHour !== msEndHour) {
|
|
834
|
+
const milliSeconds: number = (startHour.getTimezoneOffset() !== endHour.getTimezoneOffset()) ?
|
|
835
|
+
(msEndHour - msStartHour) - 3600000 : (msEndHour - msStartHour);
|
|
836
|
+
length = Math.round(milliSeconds / msInterval);
|
|
837
|
+
}
|
|
838
|
+
if (!this.parent.activeViewOptions.timeScale.enable) {
|
|
839
|
+
length = 1;
|
|
840
|
+
}
|
|
841
|
+
const start: Date = this.parent.getStartEndTime(this.parent.workHours.start);
|
|
842
|
+
const end: Date = this.parent.getStartEndTime(this.parent.workHours.end);
|
|
843
|
+
for (let i: number = 0; i < length; i++) {
|
|
844
|
+
let dt: Date = new Date(msStartHour + (msInterval * i));
|
|
845
|
+
if (util.isDaylightSavingTime(dt) || new Date(msStartHour).getTimezoneOffset() !== dt.getTimezoneOffset()) {
|
|
846
|
+
const timeOffset: number = new Date(msStartHour).getTimezoneOffset() - dt.getTimezoneOffset();
|
|
847
|
+
dt = new Date(dt.getTime() - (1000 * 60 * timeOffset));
|
|
848
|
+
}
|
|
849
|
+
const majorTickDivider: number = i % (msMajorInterval / msInterval);
|
|
850
|
+
const row: TimeSlotData = {
|
|
851
|
+
date: new Date('' + dt),
|
|
852
|
+
startHour: start,
|
|
853
|
+
endHour: end,
|
|
854
|
+
first: (majorTickDivider === 0),
|
|
855
|
+
middle: (majorTickDivider < this.parent.activeViewOptions.timeScale.slotCount - 1),
|
|
856
|
+
last: (majorTickDivider === this.parent.activeViewOptions.timeScale.slotCount - 1),
|
|
857
|
+
type: ''
|
|
858
|
+
};
|
|
859
|
+
if (handler) {
|
|
860
|
+
handler(row);
|
|
861
|
+
}
|
|
862
|
+
rows.push(row);
|
|
863
|
+
}
|
|
864
|
+
return rows;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
public getAdjustedDate(startTime: Date): Date {
|
|
868
|
+
if (!this.parent.activeViewOptions.timeScale.enable) {
|
|
869
|
+
return new Date(startTime.setHours(0, 0, 0, 0));
|
|
870
|
+
} else {
|
|
871
|
+
const timeSlots: TimeSlotData[] = this.getTimeSlotRows();
|
|
872
|
+
const startDate: Date = new Date(new Date(timeSlots[0].date.getTime()).
|
|
873
|
+
setHours(startTime.getHours(), startTime.getMinutes(), startTime.getMilliseconds()));
|
|
874
|
+
for (let i: number = 0; i < timeSlots.length; i++) {
|
|
875
|
+
if (timeSlots[parseInt(i.toString(), 10)].date.getTime() > startDate.getTime()) {
|
|
876
|
+
startTime.setHours(
|
|
877
|
+
timeSlots[i - 1].date.getHours(), timeSlots[i - 1].date.getMinutes(), timeSlots[i - 1].date.getMilliseconds());
|
|
878
|
+
return new Date(startTime);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return null;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
public destroy(): void {
|
|
886
|
+
if (!this.parent || this.parent && this.parent.isDestroyed) {
|
|
887
|
+
this.parent = null;
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
this.clearCurrentTimeIndicatorTimer();
|
|
891
|
+
if (this.element) {
|
|
892
|
+
if (this.appointment) {
|
|
893
|
+
this.appointment.destroy();
|
|
894
|
+
this.appointment = null;
|
|
895
|
+
}
|
|
896
|
+
const contentScrollableEle: Element = this.getContentAreaElement();
|
|
897
|
+
if (contentScrollableEle) {
|
|
898
|
+
EventHandler.remove(contentScrollableEle, 'scroll', this.onContentScroll);
|
|
899
|
+
EventHandler.remove(contentScrollableEle, Browser.touchMoveEvent, this.onAdaptiveMove);
|
|
900
|
+
}
|
|
901
|
+
if (this.parent.resourceBase) {
|
|
902
|
+
this.parent.resourceBase.destroy();
|
|
903
|
+
}
|
|
904
|
+
if (this.parent.scheduleTouchModule) {
|
|
905
|
+
this.parent.scheduleTouchModule.resetValues();
|
|
906
|
+
}
|
|
907
|
+
super.destroy();
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
}
|