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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 2390× 2390× 2390× 1× 141× 141× 141× 141× 141× 3× 138× 141× 8× 141× 141× 2× 141× 5× 141× 141× 141× 141× 141× 29× 29× 29× 141× 27× 141× 141× 11× 11× 7× 11× 2× 9× 9× 9× 23× 9× 14× 14× 9× 130× 9× 9× 9× 9× 11× 9× 2× 2× 9× 9× 1× 121× 7× 7× 7× 7× 6× 1× 1× 7× 97× 39× 26× 26× 7× 7× 7× 55× 55× 7× 48× 22× 22× 7× 114× 141× 1× 1× | /* 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", "./cell-renderer", "../base/constant", "../base/util"], function (require, exports, ej2_base_1, cell_renderer_1, constant_1, util_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var StackedHeaderCellRenderer = (function (_super) { __extends(StackedHeaderCellRenderer, _super); function StackedHeaderCellRenderer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.element = _this.parent.createElement('TH', { className: 'e-headercell e-stackedheadercell', attrs: { tabindex: '-1', role: 'columnheader' } }); return _this; } StackedHeaderCellRenderer.prototype.render = function (cell, data, attributes) { var node = this.element.cloneNode(); var div = this.parent.createElement('div', { className: 'e-stackedheadercelldiv', attrs: { 'e-mappinguid': cell.column.uid } }); var column = cell.column; node.appendChild(div); if (!ej2_base_1.isNullOrUndefined(column.headerTemplate)) { util_1.appendChildren(div, column.getHeaderTemplate()(column, this.parent, 'headerTemplate', null, null, null, null, this.parent.root)); } else { this.appendHtml(div, this.parent.sanitize(column.headerText), column.getDomSetter()); } if (cell.column.toolTip) { node.setAttribute('title', cell.column.toolTip); } Iif (column.clipMode === 'Clip' || (!column.clipMode && this.parent.clipMode === 'Clip')) { node.classList.add('e-gridclip'); } else if (column.clipMode === 'EllipsisWithTooltip' || (!column.clipMode && this.parent.clipMode === 'EllipsisWithTooltip')) { node.classList.add('e-ellipsistooltip'); } if (!ej2_base_1.isNullOrUndefined(cell.column.textAlign)) { div.style.textAlign = cell.column.textAlign; } Iif (cell.column.customAttributes) { util_1.setStyleAndAttributes(node, cell.column.customAttributes); } node.setAttribute('colspan', cell.colSpan.toString()); node.setAttribute('aria-colspan', cell.colSpan.toString()); node.setAttribute('aria-rowspan', '1'); if (this.parent.allowResizing) { var handler = this.parent.createElement('div'); handler.className = cell.column.allowResizing ? 'e-rhandler e-rcursor' : 'e-rsuppress'; node.appendChild(handler); } if (cell.className) { node.classList.add(cell.className); } this.parent.trigger(constant_1.headerCellInfo, { cell: cell, node: node }); if (util_1.frozenDirection(column) === 'Left') { node.classList.add('e-leftfreeze'); if (column.border === 'Left') { node.classList.add('e-freezeleftborder'); } if (column.index === 0) { util_1.applyStickyLeftRightPosition(node, (this.parent.getIndentCount() * 30), this.parent.enableRtl, 'Left'); } else { var cols = this.parent.getColumns(); var width = this.parent.getIndentCount() * 30; for (var i = 0; i < cols.length; i++) { if (column.index < cols[parseInt(i.toString(), 10)].index) { break; } Eif (cols[parseInt(i.toString(), 10)].visible) { width += parseFloat(cols[parseInt(i.toString(), 10)].width.toString()); } } util_1.applyStickyLeftRightPosition(node, width, this.parent.enableRtl, 'Left'); } } else if (util_1.frozenDirection(column) === 'Right') { node.classList.add('e-rightfreeze'); var cols = this.parent.getColumns(); var width = this.parent.getFrozenMode() === 'Right' && this.parent.isRowDragable() ? 30 : 0; for (var i = cols.length - 1; i >= 0; i--) { if (util_1.isChildColumn(column, cols[parseInt(i.toString(), 10)].uid) || column.index > cols[parseInt(i.toString(), 10)].index) { break; } Eif (cols[parseInt(i.toString(), 10)].visible) { width += parseFloat(cols[parseInt(i.toString(), 10)].width.toString()); } } util_1.applyStickyLeftRightPosition(node, width, this.parent.enableRtl, 'Right'); if (column.border === 'Right') { node.classList.add('e-freezerightborder'); } } else if (util_1.frozenDirection(column) === 'Fixed') { node.classList.add('e-fixedfreeze'); var cols = this.parent.getColumns(); var width = 0; if (this.parent.getVisibleFrozenLeftCount()) { width = this.parent.getIndentCount() * 30; } else Eif (this.parent.getFrozenMode() === 'Right') { width = this.parent.groupSettings.columns.length * 30; } for (var i = 0; i < cols.length; i++) { if (column.index > cols[parseInt(i.toString(), 10)].index) { if ((cols[parseInt(i.toString(), 10)].freeze === 'Left' || cols[parseInt(i.toString(), 10)].isFrozen) || cols[parseInt(i.toString(), 10)].freeze === 'Fixed') { Eif (cols[parseInt(i.toString(), 10)].visible) { width += parseFloat(cols[parseInt(i.toString(), 10)].width.toString()); } } } } util_1.applyStickyLeftRightPosition(node, width - 1, this.parent.enableRtl, 'Left'); width = this.parent.getFrozenMode() === 'Right' && this.parent.isRowDragable() ? 30 : 0; for (var i = cols.length - 1; i >= 0; i--) { Eif (column.index < cols[parseInt(i.toString(), 10)].index) { if (util_1.isChildColumn(column, cols[parseInt(i.toString(), 10)].uid) || column.index > cols[parseInt(i.toString(), 10)].index) { break; } if (cols[parseInt(i.toString(), 10)].freeze === 'Right' || cols[parseInt(i.toString(), 10)].freeze === 'Fixed') { Eif (cols[parseInt(i.toString(), 10)].visible) { width += parseFloat(cols[parseInt(i.toString(), 10)].width.toString()); } } } } util_1.applyStickyLeftRightPosition(node, width - 1, this.parent.enableRtl, 'Right'); } else { node.classList.add('e-unfreeze'); } return node; }; return StackedHeaderCellRenderer; }(cell_renderer_1.CellRenderer)); exports.StackedHeaderCellRenderer = StackedHeaderCellRenderer; }); |