1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 | 1×
1×
1×
1×
975×
1×
1833×
1833×
1833×
1833×
1×
1914×
859×
859×
7×
7×
852×
859×
859×
859×
1914×
146×
146×
584×
584×
91×
91×
228×
228×
30×
30×
84×
84×
55×
55×
149×
149×
149×
149×
105×
105×
105×
105×
185×
185×
185×
185×
188×
188×
69×
69×
1914×
81×
81×
81×
81×
79×
79×
81×
81×
1833×
1833×
1833×
1833×
1833×
1833×
1833×
12×
12×
1833×
20×
20×
15×
5×
5×
1833×
1833×
1833×
1833×
1833×
4×
4×
1833×
14×
1×
1833×
1808×
1808×
10×
1798×
3×
1808×
1808×
1×
1833×
1833×
1833×
1833×
30×
1803×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../actions/virtual-scroll", "../popups/event-tooltip", "../base/css-constant"], function (require, exports, ej2_base_1, virtual_scroll_1, event_tooltip_1, cls) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Render = (function () {
function Render(parent) {
this.parent = parent;
}
Render.prototype.render = function (viewName, isDataRefresh) {
Eif (isDataRefresh === void 0) { isDataRefresh = true; }
this.initializeLayout(viewName);
Eif (this.parent.activeView && isDataRefresh) {
this.parent.crudModule.refreshDataManager();
}
};
Render.prototype.initializeLayout = function (viewName) {
if (this.parent.activeView) {
var templates = [
'cellTemplate', 'tooltipTemplate', 'majorSlotTemplate', 'minorSlotTemplate',
'headerTooltipTemplate', 'dateHeaderTemplate', 'dayHeaderTemplate', 'monthHeaderTemplate',
'headerIndentTemplate', 'resourceHeaderTemplate', 'cellHeaderTemplate', 'dateRangeTemplate'
];
if (this.parent.activeEventTemplates.length > 0) {
templates = templates.concat(this.parent.activeEventTemplates);
this.parent.activeEventTemplates = [];
}
else {
templates.push('eventTemplate');
}
this.parent.resetTemplates(templates);
this.parent.activeView.removeEventListener();
this.parent.activeView.destroy();
}
switch (viewName) {
case 'Day':
this.parent.activeView = this.parent.dayModule;
break;
case 'Week':
this.parent.activeView = this.parent.weekModule;
break;
case 'WorkWeek':
this.parent.activeView = this.parent.workWeekModule;
break;
case 'Month':
this.parent.activeView = this.parent.monthModule;
break;
case 'Year':
this.parent.activeView = this.parent.yearModule;
break;
case 'Agenda':
this.parent.activeView = this.parent.agendaModule;
break;
case 'MonthAgenda':
this.parent.activeView = this.parent.monthAgendaModule;
break;
case 'TimelineDay':
this.parent.activeView = this.parent.timelineViewsModule;
Eif (!ej2_base_1.isNullOrUndefined(this.parent.activeView)) {
this.parent.activeView.viewClass = 'e-timeline-day-view';
}
break;
case 'TimelineWorkWeek':
this.parent.activeView = this.parent.timelineViewsModule;
Eif (!ej2_base_1.isNullOrUndefined(this.parent.activeView)) {
this.parent.activeView.viewClass = 'e-timeline-work-week-view';
}
break;
case 'TimelineWeek':
this.parent.activeView = this.parent.timelineViewsModule;
Eif (!ej2_base_1.isNullOrUndefined(this.parent.activeView)) {
this.parent.activeView.viewClass = 'e-timeline-week-view';
}
break;
case 'TimelineMonth':
this.parent.activeView = this.parent.timelineMonthModule;
break;
case 'TimelineYear':
this.parent.activeView = this.parent.timelineYearModule;
break;
}
if (ej2_base_1.isNullOrUndefined(this.parent.activeView)) {
var firstView = this.parent.viewCollections[0].option;
Eif (firstView) {
this.parent.setProperties({ currentView: firstView }, true);
if (this.parent.headerModule) {
this.parent.headerModule.updateActiveView();
this.parent.headerModule.setCalendarView();
}
console.warn('[WARNING] :: Module "' + viewName + '" is not available in Schedule component!' +
' You either misspelled the module name or forgot to load it.');
return this.initializeLayout(firstView);
}
throw Error('Inject required modules');
}
this.parent.uiStateValues.scheduleHeight = this.parent.element.offsetHeight;
this.parent.activeView.viewIndex = this.parent.viewIndex;
this.updateLabelText(viewName);
this.parent.activeView.addEventListener();
this.parent.activeView.getRenderDates();
this.parent.uiStateValues.isGroupAdaptive = this.parent.activeViewOptions.group.resources.length > 0 &&
(this.parent.enableAdaptiveUI && !this.parent.isAdaptive ||
this.parent.isAdaptive && this.parent.activeViewOptions.group.enableCompactView);
if (this.parent.virtualScrollModule) {
this.parent.virtualScrollModule.destroy();
this.parent.virtualScrollModule = null;
}
if ((['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.parent.currentView) === -1 ||
(this.parent.currentView === 'TimelineYear' && this.parent.activeViewOptions.orientation === 'Vertical'))
&& this.parent.activeViewOptions.allowVirtualScrolling
&& this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
this.parent.virtualScrollModule = new virtual_scroll_1.VirtualScroll(this.parent);
if (this.parent.activeView.isTimelineView()) {
this.parent.uiStateValues.top = 0;
}
else {
this.parent.virtualScrollModule.isHorizontalScroll = true;
this.parent.uiStateValues.left = 0;
}
}
this.updateHeader();
this.parent.currentTimezoneDate = this.parent.getCurrentTime();
this.parent.activeView.renderLayout(cls.CURRENT_PANEL_CLASS);
this.parent.renderTemplates();
if (this.parent.eventTooltip) {
this.parent.eventTooltip.destroy();
this.parent.eventTooltip = null;
}
if (this.parent.eventSettings.enableTooltip || (this.parent.activeViewOptions.group.resources.length > 0
&& this.parent.activeViewOptions.group.headerTooltipTemplate)) {
this.parent.eventTooltip = new event_tooltip_1.EventTooltip(this.parent);
}
};
Render.prototype.updateHeader = function () {
if (this.parent.headerModule) {
this.parent.headerModule.setDayOfWeek(this.parent.activeViewOptions.firstDayOfWeek);
if (this.parent.activeViewOptions.readonly) {
ej2_base_1.addClass([this.parent.element], cls.READ_ONLY);
}
else if (this.parent.element.classList.contains(cls.READ_ONLY)) {
ej2_base_1.removeClass([this.parent.element], cls.READ_ONLY);
}
this.parent.headerModule.updateDateRange();
this.parent.headerModule.updateHeaderItems('remove');
}
};
Render.prototype.updateLabelText = function (view) {
this.parent.element.setAttribute('role', 'application');
this.parent.element.removeAttribute('aria-labelledby');
this.parent.element.removeAttribute('aria-label');
if (view === 'Year') {
this.parent.element.setAttribute('aria-label', this.parent.activeView.getLabelText(view));
}
else {
this.parent.element.setAttribute('aria-labelledby', this.parent.element.id + '_table');
}
};
return Render;
}());
exports.Render = Render;
});
|