all files / grid/renderer/ row-renderer.js

95.96% Statements 285/297
92.31% Branches 276/299
100% Functions 19/19
95.93% Lines 283/295
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   4402× 4402× 4402× 4402× 4402×   45919×   97× 97× 77× 77×   97× 97× 97× 97× 97×           97× 97× 464×   97× 97× 561× 561×     46016× 46016× 46016× 234918× 46016× 46016× 46016× 46016× 208×   46016× 46016× 38895×   46016×   100× 100× 61×     46016× 46016× 46016× 46016× 46016× 231659× 231659× 231659× 231659×   231659× 231659× 17×   231659×   231659× 231659× 229651×   198437×   198437×   198437×   35× 35× 35×       35×               198402×           198437× 198437× 626× 626×   626× 626× 4568×   626×   198437× 99×   99×       99× 57× 57× 57× 57× 57× 57×   56×       56×           51×             198437×   123× 123× 123× 123× 123× 62×       229651×           229651× 727× 727× 727× 627× 627× 627× 627× 627× 627× 11× 10×   11×         627×             229651×   229651× 229508×       46016× 46016× 231659×   46016× 46016× 410× 146× 146×     146× 80×     66× 132× 132× 132× 132× 66× 66× 66× 66×     66× 56×       56×       410×   264× 264× 264× 264×       46016× 46016× 38895× 38895× 38895×   38895× 38895×   35× 35× 35× 35×             38860×   38895× 38895× 38895× 298× 298× 298×   1269× 197×     38895× 80×   38895× 841× 841× 841×       46016× 5822×   46016× 98×   45918×   46016× 3317×   46016× 24×   46016×   13×   46016× 46016× 1396× 1726× 1726× 1726× 324× 324× 40× 40× 40× 40×         46016×   99×     80× 80× 80× 80× 80× 44×   80× 80× 80× 80× 80× 80×   80× 80× 400× 400× 400×       80×       77× 466× 466×   77×   46016× 46016× 46016× 46016× 38895×   46016× 18856×   46016× 4520×   46016× 358×   46016× 38894× 38894×   46016×   46016× 43952×   46016× 278×   46016× 478×   46016× 46016×        
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/constant", "../base/util", "../base/enum", "./cell-merge-renderer", "../base/string-literals"], function (require, exports, ej2_base_1, ej2_base_2, constant_1, util_1, enum_1, cell_merge_renderer_1, literals) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var RowRenderer = (function () {
        function RowRenderer(serviceLocator, cellType, parent) {
            this.isSpan = false;
            this.cellType = cellType;
            this.serviceLocator = serviceLocator;
            this.parent = parent;
            this.element = this.parent.createElement('tr', { attrs: { role: 'row' } });
        }
        RowRenderer.prototype.render = function (row, columns, attributes, rowTemplate, cloneNode) {
            return this.refreshRow(row, columns, attributes, rowTemplate, cloneNode);
        };
        RowRenderer.prototype.refresh = function (row, columns, isChanged, attributes, rowTemplate) {
            var _this = this;
            if (isChanged) {
                row.data = util_1.extendObjWithFn({}, row.changes);
                this.refreshMergeCells(row);
            }
            var node = this.parent.element.querySelector('[data-uid=' + row.uid + ']');
            var tr = this.refreshRow(row, columns, attributes, rowTemplate, null, isChanged);
            var cells = [].slice.call(tr.cells);
            var tempCells = [].slice.call(node.querySelectorAll('.e-templatecell'));
            if (this.parent.isReact && tempCells.length) {
                var _loop_1 = function (col) {
                    if (col.template) {
                        setTimeout(function () {
                            _this.parent.refreshReactColumnTemplateByUid(col.uid, true);
                        }, 0);
                        return "break";
                    }
                };
                for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
                    var col = columns_1[_i];
                    var state_1 = _loop_1(col);
                    if (state_1 === "break")
                        break;
                }
            }
            var attr = [].slice.call(tr.attributes);
            attr.map(function (item) {
                node.setAttribute(item['name'], item['value']);
            });
            node.innerHTML = '';
            for (var _a = 0, cells_1 = cells; _a < cells_1.length; _a++) {
                var cell = cells_1[_a];
                node.appendChild(cell);
            }
        };
        RowRenderer.prototype.refreshRow = function (row, columns, attributes, rowTemplate, cloneNode, isEdit) {
            var tr = !ej2_base_1.isNullOrUndefined(cloneNode) ? cloneNode : this.element.cloneNode();
            var rowArgs = { data: row.data };
            var cellArgs = { data: row.data };
            var chekBoxEnable = this.parent.getColumns().filter(function (col) { return col.type === 'checkbox' && col.field; })[0];
            var value = false;
            var isFrozen = this.parent.isFrozenGrid();
            var isFirstVisibleCell = true;
            if (chekBoxEnable) {
                value = util_1.getObject(chekBoxEnable.field, rowArgs.data);
            }
            var selIndex = this.parent.getSelectedRowIndexes();
            if (row.isDataRow) {
                row.isSelected = selIndex.indexOf(row.index) > -1 || value;
            }
            if (row.isDataRow && this.parent.isCheckBoxSelection
                && this.parent.checkAllRows === 'Check' && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
                row.isSelected = true;
                if (selIndex.indexOf(row.index) === -1) {
                    selIndex.push(row.index);
                }
            }
            this.buildAttributeFromRow(tr, row);
            ej2_base_2.attributes(tr, ej2_base_1.extend({}, attributes, {}));
            util_1.setStyleAndAttributes(tr, row.attributes);
            var cellRendererFact = this.serviceLocator.getService('cellRendererFactory');
            var _loop_2 = function (i, len) {
                var cell = row.cells[parseInt(i.toString(), 10)];
                cell.isSelected = row.isSelected;
                cell.isColumnSelected = cell.column.isSelected;
                var cellRenderer = cellRendererFact.getCellRenderer(row.cells[parseInt(i.toString(), 10)].cellType
                    || enum_1.CellType.Data);
                var attrs = { 'index': !ej2_base_1.isNullOrUndefined(row.index) ? row.index.toString() : '' };
                if (row.isExpand && row.cells[parseInt(i.toString(), 10)].cellType === enum_1.CellType.DetailExpand) {
                    attrs['class'] = this_1.parent.isPrinting ? 'e-detailrowcollapse' : 'e-detailrowexpand';
                }
                var isGroupFirstCell = !this_1.parent.enableRtl && this_1.parent.groupSettings && isFirstVisibleCell &&
                    this_1.parent.groupSettings.columns.length && (this_1.parent.gridLines === 'Vertical' || this_1.parent.gridLines === 'Both');
                var td = cellRenderer.render(row.cells[parseInt(i.toString(), 10)], row.data, attrs, row.isExpand, isEdit);
                if (row.cells[parseInt(i.toString(), 10)].cellType !== enum_1.CellType.Filter) {
                    if (row.cells[parseInt(i.toString(), 10)].cellType === enum_1.CellType.Data
                        || row.cells[parseInt(i.toString(), 10)].cellType === enum_1.CellType.CommandColumn) {
                        if (cell.visible && isGroupFirstCell) {
                            td.classList.add('e-grid-group-first-cell');
                            isFirstVisibleCell = false;
                        }
                        var isReactChild = this_1.parent.parentDetails && this_1.parent.parentDetails.parentInstObj &&
                            this_1.parent.parentDetails.parentInstObj.isReact;
                        if (((this_1.parent.isReact && this_1.parent.requireTemplateRef) || (isReactChild &&
                            this_1.parent.parentDetails.parentInstObj.requireTemplateRef)) && cell.isTemplate) {
                            var thisRef_1 = this_1;
                            thisRef_1.parent.renderTemplates(function () {
                                Iif (typeof (cell.column.template) !== 'string') {
                                    var ariaAttr = td.getAttribute('aria-label');
                                    td.setAttribute('aria-label', td.innerText + ariaAttr);
                                }
                                thisRef_1.parent.trigger(constant_1.queryCellInfo, ej2_base_1.extend(cellArgs, {
                                    cell: td, column: cell.column, colSpan: 1,
                                    rowSpan: 1, foreignKeyData: row.cells[parseInt(i.toString(), 10)].foreignKeyData,
                                    requestType: thisRef_1.parent.requestTypeAction
                                }));
                            });
                        }
                        else {
                            this_1.parent.trigger(constant_1.queryCellInfo, ej2_base_1.extend(cellArgs, {
                                cell: td, column: cell.column, colSpan: 1,
                                rowSpan: 1, foreignKeyData: row.cells[parseInt(i.toString(), 10)].foreignKeyData,
                                requestType: this_1.parent.requestTypeAction
                            }));
                        }
                        var isRowSpanned = false;
                        if (row.index > 0 && (this_1.isSpan || (this_1.parent.isSpan && isEdit))) {
                            var rowsObject = this_1.parent.getRowsObject();
                            var prevRowCells = this_1.parent.groupSettings.columns.length > 0 &&
                                !rowsObject[row.index - 1].isDataRow ? rowsObject[row.index].cells : rowsObject[row.index - 1].cells;
                            var uid_1 = 'uid';
                            var prevRowCell = prevRowCells.filter(function (cell) {
                                return cell.column.uid === row.cells[parseInt(i.toString(), 10)].column["" + uid_1];
                            })[0];
                            isRowSpanned = prevRowCell.isRowSpanned ? prevRowCell.isRowSpanned : prevRowCell.rowSpanRange > 1;
                        }
                        if ((cellArgs.rowSpan > 1 || cellArgs.colSpan > 1)) {
                            this_1.resetrowSpanvalue(this_1.parent.frozenRows > row.index ? this_1.parent.frozenRows :
                                this_1.parent.currentViewData.length, cellArgs, row.index);
                            Iif (cellArgs.column.visible === false) {
                                cellArgs.colSpan = 1;
                            }
                            else {
                                if (isFrozen) {
                                    var columns_2 = this_1.parent.getColumns();
                                    var right = this_1.parent.getFrozenRightColumnsCount();
                                    var left = this_1.parent.getFrozenLeftCount();
                                    var movableCount = columns_2.length - right;
                                    var cellIdx = cellArgs.column.index;
                                    if (left > cellIdx && left < (cellIdx + cellArgs.colSpan)) {
                                        var colSpan = (cellIdx + cellArgs.colSpan) - left;
                                        cellArgs.colSpan = cellArgs.colSpan - colSpan;
                                    }
                                    else Iif (movableCount <= cellIdx && columns_2.length < (cellIdx + cellArgs.colSpan)) {
                                        var colSpan = (cellIdx + cellArgs.colSpan) - columns_2.length;
                                        cellArgs.colSpan = cellArgs.colSpan - colSpan;
                                    }
                                    else if (cellArgs.column.freeze === 'Fixed') {
                                        var colSpan = 1;
                                        var index = cellIdx;
                                        for (var j = index + 1; j < index + cellArgs.colSpan; j++) {
                                            if (columns_2[parseInt(j.toString(), 10)].freeze === 'Fixed') {
                                                colSpan++;
                                            }
                                            else {
                                                break;
                                            }
                                        }
                                        cellArgs.colSpan = colSpan;
                                    }
                                    else Iif (movableCount > cellIdx && movableCount < (cellIdx + cellArgs.colSpan)) {
                                        var colSpan = (cellIdx + cellArgs.colSpan) - movableCount;
                                        cellArgs.colSpan = cellArgs.colSpan - colSpan;
                                    }
                                }
                            }
                        }
                        if (cellArgs.colSpan > 1 || row.cells[parseInt(i.toString(), 10)].cellSpan > 1 || cellArgs.rowSpan > 1
                            || isRowSpanned) {
                            this_1.parent.isSpan = true;
                            this_1.isSpan = true;
                            var cellMerge = new cell_merge_renderer_1.CellMergeRender(this_1.serviceLocator, this_1.parent);
                            td = cellMerge.render(cellArgs, row, i, td);
                            if (isFrozen) {
                                util_1.resetColandRowSpanStickyPosition(this_1.parent, cellArgs.column, td, cellArgs.colSpan);
                            }
                        }
                    }
                    if ((cell.cellType === enum_1.CellType.Header || cell.cellType === enum_1.CellType.StackedHeader) &&
                        isGroupFirstCell && (cell.visible || cell.cellType === enum_1.CellType.StackedHeader)) {
                        var visibleColumns = this_1.parent.getVisibleColumns();
                        var field = 'field';
                        var type = 'type';
                        if ((cell.column["" + type] && cell.column["" + type] === 'checkbox') ||
                            (cell.cellType === enum_1.CellType.Header && cell.column["" + field] && visibleColumns.length &&
                                visibleColumns[0].field === cell.column["" + field]) || cell.cellType === enum_1.CellType.StackedHeader) {
                            td.classList.add('e-grid-group-first-cell');
                            isFirstVisibleCell = false;
                        }
                    }
                    if (this_1.isSpan) {
                        var rowsObject = this_1.parent.getRowsObject();
                        var isRtl = this_1.parent.enableRtl;
                        if (rowsObject[row.index - 1]) {
                            var prevRowCells = rowsObject[row.index - 1].cells;
                            var prevRowCell = prevRowCells[i - 1];
                            var currentRowCell = prevRowCells[parseInt(i.toString(), 10)];
                            var nextRowCell = prevRowCells[i + 1];
                            var direction = prevRowCells[parseInt(i.toString(), 10)].column.freeze;
                            if (prevRowCell && (prevRowCell.isRowSpanned || prevRowCell.rowSpanRange > 1) && prevRowCell.visible) {
                                if (!isRtl && (!currentRowCell.isRowSpanned || prevRowCell.rowSpanRange > currentRowCell.rowSpanRange)) {
                                    td.classList.add('e-rowcell-firstchild');
                                }
                                if (isFrozen) {
                                    if (prevRowCell.column.freeze === 'Fixed' && direction === 'Fixed') {
                                        td.classList.add(isRtl ? 'e-removefreezerightborder' : 'e-removefreezeleftborder');
                                    }
                                    else if (!isRtl && i === 1 && direction === 'Left') {
                                        td.classList.add('e-addfreezefirstchildborder');
                                    }
                                }
                            }
                            if (nextRowCell && (nextRowCell.isRowSpanned || nextRowCell.rowSpanRange > 1) && nextRowCell.visible) {
                                Iif (isRtl && (!currentRowCell.isRowSpanned || nextRowCell.rowSpanRange > currentRowCell.rowSpanRange)) {
                                    td.classList.add('e-rowcell-lastchild');
                                }
                                if (isFrozen && nextRowCell.column.freeze === 'Fixed' && direction === 'Fixed' && cellArgs.colSpan < 2) {
                                    td.classList.add(isRtl ? 'e-removefreezeleftborder' : 'e-removefreezerightborder');
                                }
                            }
                        }
                    }
                    if (cellArgs.rowSpan > 1 && this_1.parent.currentViewData.length - row.index === cellArgs.rowSpan) {
                        td.classList.add('e-row-span-lastrowcell');
                    }
                    if (!row.cells[parseInt(i.toString(), 10)].isSpanned) {
                        tr.appendChild(td);
                    }
                }
            };
            var this_1 = this;
            for (var i = 0, len = row.cells.length; i < len; i++) {
                _loop_2(i, len);
            }
            var emptyColspan = 0;
            if (this.parent.groupSettings.columns.length && this.parent.getFrozenLeftColumnsCount()) {
                if (tr.classList.contains('e-groupcaptionrow')) {
                    var freezeCells = [].slice.call(tr.querySelectorAll('.e-leftfreeze,.e-unfreeze,.e-rightfreeze,.e-fixedfreeze,.e-freezerightborder,.e-freezeleftborder'));
                    Iif (freezeCells.length) {
                        ej2_base_1.removeClass(freezeCells, ['e-leftfreeze', 'e-unfreeze', 'e-rightfreeze', 'e-fixedfreeze', 'e-freezerightborder', 'e-freezeleftborder']);
                    }
                    if (tr.querySelector('.e-summarycell')) {
                        util_1.groupCaptionRowLeftRightPos(tr, this.parent);
                    }
                    else {
                        for (var j = 0; j < tr.childNodes.length; j++) {
                            var td = tr.childNodes[parseInt(j.toString(), 10)];
                            td.classList.add('e-leftfreeze');
                            util_1.applyStickyLeftRightPosition(td, j * 30, this.parent.enableRtl, 'Left');
                            if (td.classList.contains('e-groupcaption')) {
                                var oldColspan = parseInt(td.getAttribute('colspan'), 10);
                                var colspan = util_1.resetColspanGroupCaption(this.parent, j);
                                td.setAttribute('colspan', colspan.toString());
                                emptyColspan = oldColspan - colspan;
                            }
                        }
                        if (emptyColspan) {
                            var td = this.parent.createElement('TD', {
                                className: 'e-groupcaption',
                                attrs: { colspan: emptyColspan.toString(), id: this.parent.element.id + 'captioncell', tabindex: '-1' }
                            });
                            tr.appendChild(td);
                        }
                    }
                }
                if ((tr.querySelectorAll('.e-leftfreeze').length || tr.classList.contains('e-columnheader')) &&
                    (tr.querySelectorAll('.e-indentcell').length || tr.querySelectorAll('.e-grouptopleftcell').length)) {
                    var td = tr.querySelectorAll('.e-indentcell, .e-grouptopleftcell');
                    for (var i = 0; i < td.length; i++) {
                        td[parseInt(i.toString(), 10)].classList.add('e-leftfreeze');
                        util_1.applyStickyLeftRightPosition(td[parseInt(i.toString(), 10)], i * 30, this.parent.enableRtl, 'Left');
                    }
                }
            }
            var args = { row: tr, rowHeight: this.parent.rowHeight };
            if (row.isDataRow) {
                var eventArg_1 = ej2_base_1.extend(rowArgs, args);
                eventArg_1.isSelectable = true;
                var isReactChild = this.parent.parentDetails && this.parent.parentDetails.parentInstObj &&
                    this.parent.parentDetails.parentInstObj.isReact;
                var cellTemplate = eventArg_1.row.querySelectorAll('.e-templatecell');
                if (((this.parent.isReact && this.parent.requireTemplateRef) || (isReactChild &&
                    this.parent.parentDetails.parentInstObj.requireTemplateRef)) && cellTemplate.length) {
                    var thisRef_2 = this;
                    thisRef_2.parent.renderTemplates(function () {
                        thisRef_2.parent.trigger(constant_1.rowDataBound, eventArg_1);
                        Iif (!eventArg_1.isSelectable) {
                            row.isSelectable = eventArg_1.isSelectable;
                            thisRef_2.disableRowSelection(thisRef_2, row, args, eventArg_1);
                        }
                    });
                }
                else {
                    this.parent.trigger(constant_1.rowDataBound, eventArg_1);
                }
                row.isSelectable = eventArg_1.isSelectable;
                var isDraggable = this.parent.isRowDragable();
                if (this.parent.allowPaging && this.parent.selectionSettings.persistSelection) {
                    var primaryKey_1 = this.parent.getPrimaryKeyFieldNames()[0];
                    var pKey_1 = row.data ? row.data["" + primaryKey_1] : null;
                    var SelectedRecords = eventArg_1.isSelectable ? this.parent.partialSelectedRecords :
                        this.parent.disableSelectedRecords;
                    if (!SelectedRecords.some(function (data) { return data["" + primaryKey_1] === pKey_1; })) {
                        SelectedRecords.push(row.data);
                    }
                }
                if (!eventArg_1.isSelectable) {
                    this.disableRowSelection(this, row, args, eventArg_1);
                }
                if (this.parent.childGrid || isDraggable || this.parent.detailTemplate) {
                    var td = tr.querySelectorAll('.e-rowcell:not(.e-hide)')[0];
                    Eif (td) {
                        td.classList.add('e-detailrowvisible');
                    }
                }
            }
            if (this.parent.enableVirtualization) {
                rowArgs.rowHeight = this.parent.rowHeight;
            }
            if (rowArgs.rowHeight) {
                tr.style.height = rowArgs.rowHeight + 'px';
            }
            else if (this.parent.rowHeight && (tr.querySelector('.e-headercell') || tr.querySelector('.e-groupcaption'))) {
                tr.style.height = this.parent.rowHeight + 'px';
            }
            if (row.cssClass) {
                tr.classList.add(row.cssClass);
            }
            if (row.lazyLoadCssClass) {
                tr.classList.add(row.lazyLoadCssClass);
            }
            if (this.parent.rowRenderingMode === 'Vertical' && this.parent.allowTextWrap && (this.parent.textWrapSettings.wrapMode === 'Header'
                || this.parent.textWrapSettings.wrapMode === 'Both')) {
                tr.classList.add('e-verticalwrap');
            }
            var vFTable = this.parent.enableColumnVirtualization;
            if (!vFTable && this.parent.aggregates.length && this.parent.element.scrollHeight > this.parent.height) {
                for (var i = 0; i < this.parent.aggregates.length; i++) {
                    var property = 'properties';
                    var column = 'columns';
                    if (this.parent.aggregates[parseInt(i.toString(), 10)]["" + property]["" + column][0].footerTemplate) {
                        var summarycell = [].slice.call(tr.getElementsByClassName('e-summarycell'));
                        if (summarycell.length) {
                            var lastSummaryCell = (summarycell[summarycell.length - 1]);
                            ej2_base_1.addClass([lastSummaryCell], ['e-lastsummarycell']);
                            var firstSummaryCell = (summarycell[0]);
                            ej2_base_1.addClass([firstSummaryCell], ['e-firstsummarycell']);
                        }
                    }
                }
            }
            return tr;
        };
        RowRenderer.prototype.resetrowSpanvalue = function (rowCount, cellArgs, rowIndex) {
            if (rowCount > rowIndex && rowCount < rowIndex + cellArgs.rowSpan) {
                var rowSpan = (rowIndex + cellArgs.rowSpan) - rowCount;
                cellArgs.rowSpan = cellArgs.rowSpan - rowSpan;
            }
        };
        RowRenderer.prototype.disableRowSelection = function (thisRef, row, args, eventArg) {
            var selIndex = this.parent.getSelectedRowIndexes();
            this.parent.selectionModule.isPartialSelection = true;
            row.isSelected = false;
            var selRowIndex = selIndex.indexOf(row.index);
            if (selRowIndex > -1) {
                selIndex.splice(selRowIndex, 1);
            }
            var chkBox = args.row.querySelectorAll('.e-rowcell.e-gridchkbox');
            var isDrag = eventArg.row.querySelector('.e-rowdragdrop');
            var cellIdx = thisRef.parent.groupSettings.columns.length + (isDrag || thisRef.parent.isDetail() ? 1 : 0);
            for (var i = 0; i < chkBox.length; i++) {
                chkBox[parseInt(i.toString(), 10)].firstElementChild.classList.add('e-checkbox-disabled');
                chkBox[parseInt(i.toString(), 10)].querySelector('.e-frame').classList.remove('e-check');
            }
            Eif (row.cells.length) {
                for (var i = cellIdx; i < row.cells.length; i++) {
                    var cell = eventArg.row.querySelector('.e-rowcell[data-colindex="' + row.cells[parseInt(i.toString(), 10)].index + '"]');
                    Eif (cell) {
                        ej2_base_1.removeClass([cell], ['e-selectionbackground', 'e-active']);
                    }
                }
            }
            Iif (isDrag) {
                ej2_base_1.removeClass([isDrag], ['e-selectionbackground', 'e-active']);
            }
        };
        RowRenderer.prototype.refreshMergeCells = function (row) {
            for (var _i = 0, _a = row.cells; _i < _a.length; _i++) {
                var cell = _a[_i];
                cell.isSpanned = false;
            }
            return row;
        };
        RowRenderer.prototype.buildAttributeFromRow = function (tr, row) {
            var attr = {};
            var prop = { 'rowindex': literals.dataRowIndex, 'dataUID': 'data-uid', 'ariaSelected': 'aria-selected' };
            var classes = [];
            if (row.isDataRow) {
                classes.push(literals.row);
            }
            if (row.isAltRow) {
                classes.push('e-altrow');
            }
            if (row.isCaptionRow) {
                classes.push('e-groupcaptionrow');
            }
            if (row.isAggregateRow && row.parentUid) {
                classes.push('e-groupfooterrow');
            }
            if (!ej2_base_1.isNullOrUndefined(row.index)) {
                attr[literals.ariaRowIndex] = row.index + 1;
                attr[prop.rowindex] = row.index;
            }
            if (row.rowSpan) {
                attr.rowSpan = row.rowSpan;
            }
            if (row.uid) {
                attr[prop.dataUID] = row.uid;
            }
            if (row.isSelected) {
                attr[prop.ariaSelected] = true;
            }
            if (row.visible === false) {
                classes.push('e-hide');
            }
            attr.class = classes;
            util_1.setStyleAndAttributes(tr, attr);
        };
        return RowRenderer;
    }());
    exports.RowRenderer = RowRenderer;
});