define(["require", "exports", "@syncfusion/ej2-base", "../base/css-constants"], function (require, exports, ej2_base_1, cls) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EventMarker = (function () {
function EventMarker(gantt) {
this.parent = gantt;
this.eventMarkersContainer = null;
}
EventMarker.prototype.renderEventMarkers = function () {
if (this.parent.eventMarkers && this.parent.eventMarkers.length > 0) {
if (!this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)) {
this.eventMarkersContainer = ej2_base_1.createElement('div', {
className: cls.eventMarkersContainer
});
this.eventMarkersContainer.setAttribute('role', 'term');
this.parent.ganttChartModule.chartBodyContent.appendChild(this.eventMarkersContainer);
}
this.eventMarkersContainer.innerHTML = '';
this.getEventMarkersElements(this.eventMarkersContainer);
}
else {
this.removeContainer();
}
};
EventMarker.prototype.removeContainer = function () {
if (this.eventMarkersContainer) {
ej2_base_1.remove(this.eventMarkersContainer);
this.eventMarkersContainer = null;
}
};
EventMarker.prototype.getEventMarkersElements = function (container) {
var left;
var eventMarkerElement;
var spanElement;
var rightArrow;
var eventMarkerCollection = [];
for (var i = 0; i < this.parent.eventMarkers.length; i++) {
if (!ej2_base_1.isNullOrUndefined(this.parent.eventMarkers[i].day)) {
left = this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[i].day, true), false, true);
eventMarkerCollection.push({ id: i, left: left, label: this.parent.eventMarkers[i].label,
date: this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[i].day, true) });
var align = void 0;
if (this.parent.enableRtl) {
align = "right:" + left + "px;";
}
else {
align = "left:" + left + "px;";
}
eventMarkerElement = ej2_base_1.createElement('div', {
className: cls.eventMarkersChild, styles: align + " height:100%;",
id: 'stripline' + i
});
if (this.parent.eventMarkers[i].label) {
spanElement = ej2_base_1.createElement('div', {
className: cls.eventMarkersSpan
});
var property = this.parent.disableHtmlEncode ? 'textContent' : 'innerHTML';
spanElement[property] = this.parent.eventMarkers[i].label;
if (this.parent.enableHtmlSanitizer && typeof (spanElement[property]) === 'string') {
spanElement[property] = ej2_base_1.SanitizeHtmlHelper.sanitize(spanElement[property]);
}
if (this.parent.enableRtl) {
spanElement.style.right = '5px';
}
else {
spanElement.style.left = '5px';
}
eventMarkerElement.appendChild(spanElement);
rightArrow = ej2_base_1.createElement('div', {
className: 'e-gantt-right-arrow'
});
eventMarkerElement.appendChild(rightArrow);
}
if (this.parent.eventMarkers[i].cssClass) {
eventMarkerElement.classList.add(this.parent.eventMarkers[i].cssClass);
}
eventMarkerElement.setAttribute('tabindex', '-1');
eventMarkerElement.setAttribute('aria-label', this.parent.localeObj.getConstant('eventMarkers') + ' '
+ (typeof this.parent.eventMarkers[i].day === 'string' ?
this.parent.eventMarkers[i].day :
this.parent.getFormatedDate(this.parent.eventMarkers[i].day))
+ ' ' + this.parent.eventMarkers[i].label);
container.appendChild(eventMarkerElement);
}
}
this.parent.eventMarkerColloction = eventMarkerCollection;
};
EventMarker.prototype.updateContainerHeight = function () {
if (this.eventMarkersContainer) {
this.eventMarkersContainer.style.height = ej2_base_1.formatUnit(this.parent.getContentHeight());
}
};
return EventMarker;
}());
exports.EventMarker = EventMarker;
});
|