all files / schedule/renderer/ timeline-year.js

95.69% Statements 311/325
87.66% Branches 135/154
100% Functions 21/21
95.65% Lines 308/322
11 statements, 6 functions, 9 branches Ignored     
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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476          42× 42× 42× 42×   26333×   69× 69× 69×   17×     52× 52× 52×   69× 69× 69× 69× 69× 69× 69× 69×   15× 15×     54× 54× 54× 54× 54× 54× 54× 54× 54× 54× 1336× 1336× 1336× 1032× 37×     995×       304× 24×     280×   304×   1336× 1336×       67× 67× 67× 67× 67× 32×     35× 35×   67× 69× 69× 69× 69× 152× 152× 152× 152×   152× 100×     100× 100×   100× 100×   100×   152× 52×   152× 152× 152×   69×   67× 15×   67×   69× 69× 69× 69× 69× 69× 69×   17× 17× 17×     52× 52× 52× 52× 52×   69× 69× 69× 69× 69× 69× 69× 69× 69× 69×   69× 69×     69× 32× 32× 32×     37× 37×     37× 37× 37× 667× 667× 667× 667× 667× 667× 667× 667× 667× 667× 667× 336× 12×     324×   336×     331× 37×     294×     667× 667× 667× 667× 16356× 16356× 3972× 3972× 3972× 3972× 3972× 3972×     12384×   16356×     16356×     16356× 16356×         16356× 13506× 13506× 13506× 9636×   13506× 726×   13506×           13506× 9636×       2850× 2850× 145×     16356× 2850×     13506×   13506× 13506× 13506× 13506×   13506× 13506× 13506× 13506× 10220×         37×   11× 11× 11× 11×     48× 48× 48× 48× 24×     24×   48× 48× 48×             48× 48× 48× 48× 48× 48×       32× 32× 285× 285× 285× 285× 285× 105×   285× 285× 285× 180× 180× 180×       180× 12×     168×   180×   285× 2360× 2360× 2360× 1220× 1220× 1220× 300×     920×   1220× 1220×     1140× 1140×   2360× 2360× 2360×               2360× 2360× 2360× 2360× 2360× 2360×     32× 17×     122× 122× 122× 122× 74× 74×     48×     15914× 15914×                                                         15914× 15914× 15914× 15184×          
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "@syncfusion/ej2-base", "./year", "../base/constant", "../base/css-constant", "../base/util"], function (require, exports, ej2_base_1, year_1, event, cls, util) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var TimelineYear = (function (_super) {
        __extends(TimelineYear, _super);
        function TimelineYear(parent) {
            var _this = _super.call(this, parent) || this;
            _this.viewClass = 'e-timeline-year-view';
            _this.isInverseTableSelect = true;
            return _this;
        }
        TimelineYear.prototype.getModuleName = function () {
            return 'timelineYear';
        };
        TimelineYear.prototype.renderHeader = function (headerWrapper) {
            var tr = ej2_base_1.createElement('tr');
            headerWrapper.appendChild(tr);
            if (this.parent.activeViewOptions.orientation === 'Vertical' && this.parent.activeViewOptions.group.resources.length > 0 &&
                !this.parent.uiStateValues.isGroupAdaptive) {
                this.parent.resourceBase.renderResourceHeaderIndent(tr);
            }
            else {
                var leftHeaderCells = ej2_base_1.createElement('td', { className: cls.LEFT_INDENT_CLASS });
                tr.appendChild(leftHeaderCells);
                leftHeaderCells.appendChild(this.renderResourceHeader(cls.LEFT_INDENT_WRAP_CLASS));
            }
            var isHorizontal = this.parent.activeViewOptions.orientation === 'Horizontal';
            var isGroup = this.parent.activeViewOptions.group.resources.length > 0;
            this.isInverseTableSelect = isHorizontal && !isGroup ? false : true;
            var td = ej2_base_1.createElement('td');
            tr.appendChild(td);
            var container = ej2_base_1.createElement('div', { className: cls.DATE_HEADER_CONTAINER_CLASS });
            td.appendChild(container);
            if (this.parent.activeViewOptions.orientation === 'Horizontal' && this.parent.activeViewOptions.group.resources.length > 0 &&
                !this.parent.uiStateValues.isGroupAdaptive) {
                container.appendChild(this.renderResourceHeader(cls.DATE_HEADER_WRAP_CLASS));
                this.columnCount = this.colLevels.slice(-1)[0].length;
            }
            else {
                var wrapper = ej2_base_1.createElement('div', { className: cls.DATE_HEADER_WRAP_CLASS });
                container.appendChild(wrapper);
                var table = this.createTableLayout();
                wrapper.appendChild(table);
                table.appendChild(this.createTableColGroup(this.columnCount));
                var innerTr = ej2_base_1.createElement('tr');
                table.querySelector('tbody').appendChild(innerTr);
                var months = this.getMonths();
                var dayHeaderDates = this.getMonthDates(new Date(this.parent.selectedDate.getFullYear(), months[0], 1));
                for (var column = 0; column < this.columnCount; column++) {
                    var date = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(column.toString(), 10)], 1);
                    var innerTd = ej2_base_1.createElement('td', { className: cls.HEADER_CELLS_CLASS });
                    if (this.parent.activeViewOptions.orientation === 'Horizontal') {
                        if (this.parent.dayHeaderTemplate) {
                            ej2_base_1.append(this.renderDayMonthHeaderTemplate(dayHeaderDates[parseInt(column.toString(), 10)], column, 'dayHeaderTemplate'), innerTd);
                        }
                        else {
                            innerTd.innerHTML = "<span>" + this.parent.getDayNames('abbreviated')[column % 7] + "</span>";
                        }
                    }
                    else {
                        if (this.parent.monthHeaderTemplate) {
                            ej2_base_1.append(this.renderDayMonthHeaderTemplate(date, months[parseInt(column.toString(), 10)], 'monthHeaderTemplate'), innerTd);
                        }
                        else {
                            innerTd.innerHTML = "<span>" + this.getMonthName(date) + "</span>";
                        }
                        innerTd.setAttribute('data-date', date.getTime().toString());
                    }
                    innerTr.appendChild(innerTd);
                    this.parent.trigger(event.renderCell, { elementType: 'headerCells', element: innerTd });
                }
            }
        };
        TimelineYear.prototype.renderResourceHeader = function (className) {
            var wrap = ej2_base_1.createElement('div', { className: className });
            var tbl = this.createTableLayout();
            wrap.appendChild(tbl);
            var trEle = ej2_base_1.createElement('tr');
            if (this.parent.activeViewOptions.group.resources.length > 0) {
                this.colLevels = this.generateColumnLevels();
            }
            else {
                var colData = [{ className: [cls.HEADER_CELLS_CLASS], type: 'headerCell' }];
                this.colLevels = [colData];
            }
            for (var _i = 0, _a = this.colLevels; _i < _a.length; _i++) {
                var col = _a[_i];
                var ntr = trEle.cloneNode();
                var count = className === cls.DATE_HEADER_WRAP_CLASS ? col : [col[0]];
                for (var _b = 0, count_1 = count; _b < count_1.length; _b++) {
                    var c = count_1[_b];
                    var tdEle = ej2_base_1.createElement('td');
                    Eif (c.className) {
                        ej2_base_1.addClass([tdEle], c.className);
                    }
                    if (className === cls.DATE_HEADER_WRAP_CLASS) {
                        Iif (c.template) {
                            ej2_base_1.append(c.template, tdEle);
                        }
                        Eif (c.colSpan) {
                            tdEle.setAttribute('colspan', c.colSpan.toString());
                        }
                        Eif (c.groupIndex > -1) {
                            tdEle.setAttribute('data-group-index', c.groupIndex.toString());
                        }
                        this.setResourceHeaderContent(tdEle, c);
                    }
                    if (className === cls.LEFT_INDENT_WRAP_CLASS) {
                        this.parent.renderHeaderIndentTemplate(c, tdEle);
                    }
                    var args = { elementType: c.type, element: tdEle, date: c.date, groupIndex: c.groupIndex };
                    this.parent.trigger(event.renderCell, args);
                    ntr.appendChild(tdEle);
                }
                tbl.querySelector('tbody').appendChild(ntr);
            }
            if (className === cls.DATE_HEADER_WRAP_CLASS) {
                tbl.appendChild(this.createTableColGroup(this.colLevels.slice(-1)[0].length));
            }
            return wrap;
        };
        TimelineYear.prototype.renderContent = function (contentWrapper) {
            var tr = ej2_base_1.createElement('tr');
            contentWrapper.appendChild(tr);
            var firstTd = ej2_base_1.createElement('td');
            var lastTd = ej2_base_1.createElement('td');
            var tdCollection = [];
            var monthTBody;
            if (this.parent.activeViewOptions.orientation === 'Vertical' && this.parent.activeViewOptions.group.resources.length > 0 &&
                !this.parent.uiStateValues.isGroupAdaptive) {
                tdCollection.push(firstTd);
                firstTd.appendChild(this.parent.resourceBase.createResourceColumn());
                this.rowCount = this.parent.resourceBase.renderedResources.length;
            }
            else {
                tdCollection.push(firstTd);
                var monthWrapper = ej2_base_1.createElement('div', { className: cls.MONTH_HEADER_WRAPPER });
                firstTd.appendChild(monthWrapper);
                monthWrapper.appendChild(this.createTableLayout());
                monthTBody = monthWrapper.querySelector('tbody');
            }
            tdCollection.push(lastTd);
            ej2_base_1.append(tdCollection, tr);
            var content = ej2_base_1.createElement('div', { className: cls.CONTENT_WRAP_CLASS });
            lastTd.appendChild(content);
            var contentTable = this.createTableLayout(cls.CONTENT_TABLE_CLASS);
            this.setAriaAttributes(contentTable);
            content.appendChild(contentTable);
            var eventWrapper = ej2_base_1.createElement('div', { className: cls.EVENT_TABLE_CLASS });
            content.appendChild(eventWrapper);
            if (this.parent.virtualScrollModule) {
                this.parent.virtualScrollModule.renderVirtualTrack(content);
            }
            var contentTBody = contentTable.querySelector('tbody');
            if (this.parent.rowAutoHeight) {
                var addClassTable = [contentTable];
                var monthHeader = this.parent.element.querySelector('.' + cls.MONTH_HEADER_WRAPPER + ' .' + cls.SCHEDULE_TABLE_CLASS);
                if (monthHeader) {
                    addClassTable.push(monthHeader);
                }
                ej2_base_1.addClass(addClassTable, cls.AUTO_HEIGHT);
            }
            if (this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
                var colCount = this.parent.activeViewOptions.orientation === 'Horizontal' ? this.colLevels.slice(-1)[0].length : this.columnCount;
                contentTable.appendChild(this.createTableColGroup(colCount));
                this.renderResourceContent(eventWrapper, monthTBody, contentTBody);
            }
            else {
                contentTable.appendChild(this.createTableColGroup(this.columnCount));
                this.renderDefaultContent(eventWrapper, monthTBody, contentTBody);
            }
        };
        TimelineYear.prototype.renderDefaultContent = function (wrapper, monthBody, contentBody) {
            var months = this.getMonths();
            var dayHeaderDates = this.getMonthDates(new Date(this.parent.selectedDate.getFullYear(), months[0], 1));
            for (var month = 0; month < this.rowCount; month++) {
                wrapper.appendChild(ej2_base_1.createElement('div', { className: cls.APPOINTMENT_CONTAINER_CLASS }));
                var monthDate = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(month.toString(), 10)], 1);
                var monthStart = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                var monthEnd = this.parent.calendarUtil.getMonthEndDate(new Date(monthDate.getTime()));
                var tr = ej2_base_1.createElement('tr');
                var monthTr = tr.cloneNode();
                monthBody.appendChild(monthTr);
                var contentTr = tr.cloneNode();
                contentBody.appendChild(contentTr);
                var monthTd = ej2_base_1.createElement('td', { className: cls.MONTH_HEADER_CLASS });
                if (this.parent.activeViewOptions.orientation === 'Horizontal') {
                    if (this.parent.monthHeaderTemplate) {
                        ej2_base_1.append(this.renderDayMonthHeaderTemplate(monthStart, month, 'monthHeaderTemplate'), monthTd);
                    }
                    else {
                        monthTd.innerHTML = "<span>" + this.getMonthName(monthDate) + "</span>";
                    }
                    monthTd.setAttribute('data-date', monthDate.getTime().toString());
                }
                else {
                    if (this.parent.dayHeaderTemplate) {
                        ej2_base_1.append(this.renderDayMonthHeaderTemplate(dayHeaderDates[parseInt(month.toString(), 10)], month, 'dayHeaderTemplate'), monthTd);
                    }
                    else {
                        monthTd.innerHTML = "<span>" + this.parent.getDayNames('abbreviated')[month % 7] + "</span>";
                    }
                }
                monthTr.appendChild(monthTd);
                this.parent.trigger(event.renderCell, { elementType: 'leftHeaderCells', element: monthTd });
                var date = new Date(monthStart.getTime());
                for (var column = 0; column < this.columnCount; column++) {
                    var isDateAvail = void 0;
                    if (this.parent.activeViewOptions.orientation === 'Vertical') {
                        monthDate = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(column.toString(), 10)], 1);
                        monthStart = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                        monthEnd = this.parent.calendarUtil.getMonthEndDate(new Date(monthDate.getTime()));
                        var dayDate = (month - monthStart.getDay()) + 1;
                        date = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(column.toString(), 10)], dayDate);
                        isDateAvail = dayDate > 0 && date.getTime() < monthEnd.getTime();
                    }
                    else {
                        isDateAvail = column >= monthStart.getDay() && date.getTime() < monthEnd.getTime();
                    }
                    var announcementText = this.parent.globalize.formatDate(date, {
                        skeleton: 'full', calendar: this.parent.getCalendarMode()
                    });
                    var td = ej2_base_1.createElement('td', {
                        className: cls.WORK_CELLS_CLASS, attrs: { 'aria-selected': 'false', 'aria-label': announcementText }
                    });
                    contentTr.appendChild(td);
                    var dateHeader = ej2_base_1.createElement('div', {
                        className: cls.DATE_HEADER_CLASS + ' ' + cls.NAVIGATE_CLASS,
                        innerHTML: (isDateAvail) ?
                            this.parent.globalize.formatDate(date, { skeleton: 'd', calendar: this.parent.getCalendarMode() }) : ''
                    });
                    if (isDateAvail) {
                        var tds = [td];
                        var classList = [];
                        if (this.parent.activeViewOptions.workDays.indexOf(date.getDay()) > -1) {
                            classList.push(cls.WORKDAY_CLASS);
                        }
                        if (!this.parent.isMinMaxDate(date)) {
                            ej2_base_1.addClass([td], cls.DISABLE_DATES);
                        }
                        if (this.isCurrentDate(date)) {
                            classList.push(cls.CURRENT_DAY_CLASS);
                            Iif (this.parent.activeViewOptions.orientation === 'Horizontal') {
                                tds.push(this.element.querySelector('.' + cls.HEADER_CELLS_CLASS + (":nth-child(" + (column + 1) + ")")));
                            }
                            else {
                                tds.push(this.element.querySelectorAll('.' + cls.MONTH_HEADER_CLASS).item(month));
                            }
                        }
                        if (classList.length > 0) {
                            ej2_base_1.addClass(tds, classList);
                        }
                    }
                    else {
                        ej2_base_1.addClass([td], cls.OTHERMONTH_CLASS);
                        if (!this.parent.isMinMaxDate(date)) {
                            ej2_base_1.addClass([td], cls.DISABLE_DATES);
                        }
                    }
                    if (td.classList.contains(cls.OTHERMONTH_CLASS)) {
                        continue;
                    }
                    else {
                        this.renderDates.push(new Date(date));
                    }
                    td.appendChild(dateHeader);
                    Eif (isDateAvail) {
                        td.setAttribute('data-date', date.getTime().toString());
                        this.wireEvents(td);
                    }
                    this.renderCellTemplate({ date: date, type: 'workCells' }, td);
                    this.parent.trigger(event.renderCell, { elementType: 'workCells', element: td, date: date });
                    Eif (isDateAvail) {
                        if (this.parent.activeViewOptions.orientation === 'Horizontal') {
                            date = util.addDays(new Date(date.getTime()), 1);
                        }
                    }
                }
            }
            this.renderDates.splice(0, 1);
        };
        TimelineYear.prototype.getContentRows = function () {
            var tRow = [];
            var monthCells = this.getMonths();
            var existingGroupIndices = this.getGroupIndices();
            for (var row = 0; row < this.parent.resourceBase.renderedResources.length; row++) {
                var resData = void 0;
                Eif (this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
                    resData = this.parent.resourceBase.renderedResources[parseInt(row.toString(), 10)];
                    if (existingGroupIndices.length > 0 && existingGroupIndices.indexOf(resData.groupIndex) > -1) {
                        continue;
                    }
                }
                var tr = ej2_base_1.createElement('tr');
                tRow.push(tr);
                var monthDate = new Date(this.parent.selectedDate.getFullYear(), monthCells[parseInt(row.toString(), 10)], 1);
                var date = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                for (var month = 0; month < this.columnCount; month++) {
                    var classList = [];
                    var groupIndex = resData.groupIndex;
                    classList = classList.concat(resData.className);
                    if (classList.indexOf(cls.RESOURCE_PARENT_CLASS) > -1) {
                        classList.push(cls.RESOURCE_GROUP_CELLS_CLASS);
                    }
                    else {
                        classList.push(cls.WORKDAY_CLASS);
                    }
                    monthDate = new Date(this.parent.selectedDate.getFullYear(), monthCells[parseInt(month.toString(), 10)], 1);
                    date = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                    var tdELe = ej2_base_1.createElement('td', {
                        className: cls.WORK_CELLS_CLASS,
                        attrs: {
                            'aria-selected': 'false',
                            'data-date': date.getTime().toString()
                        }
                    });
                    ej2_base_1.addClass([tdELe], classList);
                    tdELe.setAttribute('data-group-index', groupIndex.toString());
                    this.renderCellTemplate({ date: date, type: 'resourceGroupCells', groupIndex: groupIndex }, tdELe);
                    this.wireEvents(tdELe);
                    this.parent.trigger(event.renderCell, { elementType: 'resourceGroupCells', element: tdELe, date: date });
                    tr.appendChild(tdELe);
                }
            }
            return tRow;
        };
        TimelineYear.prototype.renderResourceContent = function (wrapper, monthBody, contentBody) {
            var months = this.getMonths();
            for (var row = 0; row < this.rowCount; row++) {
                wrapper.appendChild(ej2_base_1.createElement('div', { className: cls.APPOINTMENT_CONTAINER_CLASS }));
                var tr = ej2_base_1.createElement('tr');
                contentBody.appendChild(tr);
                var resData = void 0;
                if (this.parent.activeViewOptions.orientation === 'Vertical' && this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
                    resData = this.parent.resourceBase.renderedResources[parseInt(row.toString(), 10)];
                }
                var monthDate = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(row.toString(), 10)], 1);
                var date = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                if (this.parent.activeViewOptions.orientation === 'Horizontal') {
                    var monthTr = tr.cloneNode();
                    monthBody.appendChild(monthTr);
                    var monthTd = ej2_base_1.createElement('td', {
                        className: cls.MONTH_HEADER_CLASS,
                        attrs: { 'data-date': date.getTime().toString() }
                    });
                    if (this.parent.monthHeaderTemplate) {
                        ej2_base_1.append(this.renderDayMonthHeaderTemplate(monthDate, row, 'monthHeaderTemplate'), monthTd);
                    }
                    else {
                        monthTd.innerHTML = "<span>" + this.getMonthName(monthDate) + "</span>";
                    }
                    monthTr.appendChild(monthTd);
                }
                for (var month = 0; month < this.columnCount; month++) {
                    var classList = [];
                    var groupIndex = void 0;
                    if (this.parent.activeViewOptions.orientation === 'Vertical') {
                        groupIndex = resData.groupIndex;
                        classList = classList.concat(resData.className);
                        if (classList.indexOf(cls.RESOURCE_PARENT_CLASS) > -1) {
                            classList.push(cls.RESOURCE_GROUP_CELLS_CLASS);
                        }
                        else {
                            classList.push(cls.WORKDAY_CLASS);
                        }
                        monthDate = new Date(this.parent.selectedDate.getFullYear(), months[parseInt(month.toString(), 10)], 1);
                        date = this.parent.calendarUtil.getMonthStartDate(new Date(monthDate.getTime()));
                    }
                    else {
                        groupIndex = this.colLevels.slice(-1)[0][parseInt(month.toString(), 10)].groupIndex;
                        classList.push(cls.WORKDAY_CLASS);
                    }
                    var startDateText = this.parent.globalize.formatDate(date, { type: 'dateTime', skeleton: 'full', calendar: this.parent.getCalendarMode() });
                    var endDateText = this.parent.globalize.formatDate(this.parent.calendarUtil.getMonthEndDate(new Date(monthDate.getTime())), { type: 'dateTime', skeleton: 'full', calendar: this.parent.getCalendarMode() });
                    var td = ej2_base_1.createElement('td', {
                        className: cls.WORK_CELLS_CLASS,
                        attrs: {
                            'aria-selected': 'false',
                            'data-date': date.getTime().toString(),
                            'aria-label': startDateText + ' ' + this.parent.localeObj.getConstant('endAt') + ' ' + endDateText
                        }
                    });
                    ej2_base_1.addClass([td], classList);
                    td.setAttribute('data-group-index', groupIndex.toString());
                    this.renderCellTemplate({ date: date, type: 'resourceGroupCells', groupIndex: groupIndex }, td);
                    this.wireEvents(td);
                    tr.appendChild(td);
                    this.parent.trigger(event.renderCell, { elementType: 'resourceGroupCells', element: td, date: date });
                }
            }
            if (this.parent.activeViewOptions.orientation === 'Vertical') {
                this.collapseRows(this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS));
            }
        };
        TimelineYear.prototype.renderDayMonthHeaderTemplate = function (date, column, type) {
            var args = { date: date, type: type === 'dayHeaderTemplate' ? 'dayHeader' : 'monthHeader' };
            var dayId = "schedule_" + this.parent.activeViewOptions.dayHeaderTemplateName + "dayHeaderTemplate";
            var monthId = "schedule_" + this.parent.activeViewOptions.dayHeaderTemplateName + "monthHeaderTemplate";
            if (type === 'dayHeaderTemplate') {
                args.day = this.parent.getDayNames('wide')[column % 7];
                return [].slice.call(this.parent.getDayHeaderTemplate()(args, this.parent, 'dayHeaderTemplate', dayId, false, undefined, undefined, this.parent.root));
            }
            else {
                return [].slice.call(this.parent.getMonthHeaderTemplate()(args, this.parent, 'monthHeaderTemplate', monthId, false, undefined, undefined, this.parent.root));
            }
        };
        TimelineYear.prototype.renderCellTemplate = function (data, td) {
            Eif (!this.parent.activeViewOptions.cellTemplate || td.classList.contains(cls.OTHERMONTH_CLASS)) {
                return;
            }
            var args = { date: data.date, type: data.type };
            if (data.groupIndex) {
                args.groupIndex = data.groupIndex;
            }
            var scheduleId = this.parent.element.id + '_';
            var viewName = this.parent.activeViewOptions.cellTemplateName;
            var templateId = scheduleId + viewName + 'cellTemplate';
            var cellTemplate = [].slice.call(this.parent.getCellTemplate()(args, this.parent, 'cellTemplate', templateId, false, undefined, undefined, this.parent.root));
            ej2_base_1.append(cellTemplate, td);
        };
        TimelineYear.prototype.scrollToDate = function (scrollDate) {
            var date;
            Iif (this.parent.activeViewOptions.group.resources !== null && this.parent.activeViewOptions.group.resources.length > 0 &&
                !this.parent.uiStateValues.isGroupAdaptive) {
                date = +new Date(util.resetTime(util.firstDateOfMonth(scrollDate)));
            }
            else {
                date = +new Date(util.resetTime(scrollDate));
            }
            var element = this.element.querySelector('[data-date="' + date + '"]');
            Eif (element) {
                var wrap = this.getScrollableElement();
                Iif (this.parent.enableRtl) {
                    var conTable = this.element.querySelector('.' + cls.CONTENT_TABLE_CLASS);
                    wrap.scrollLeft = -(conTable.offsetWidth - element.offsetLeft - element.offsetWidth);
                }
                else {
                    wrap.scrollLeft = element.offsetLeft;
                }
                wrap.scrollTop = element.offsetTop;
            }
        };
        TimelineYear.prototype.getScrollableElement = function () {
            Iif (this.parent.isAdaptive && !this.isTimelineView()) {
                return this.element.querySelector('.' + cls.SCROLL_CONTAINER_CLASS);
            }
            else {
                return this.getContentAreaElement();
            }
        };
        TimelineYear.prototype.wireEvents = function (element) {
            ej2_base_1.EventHandler.add(element, 'mousedown', this.parent.workCellAction.cellMouseDown, this.parent.workCellAction);
            ej2_base_1.EventHandler.add(element, 'click', this.parent.workCellAction.cellClick, this.parent.workCellAction);
            if (!this.parent.isAdaptive) {
                ej2_base_1.EventHandler.add(element, 'dblclick', this.parent.workCellAction.cellDblClick, this.parent.workCellAction);
            }
        };
        return TimelineYear;
    }(year_1.Year));
    exports.TimelineYear = TimelineYear;
});