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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1195× 1195× 1195× 1195× 1× 4495× 4495× 4495× 4495× 4495× 4495× 4495× 4495× 4495× 4495× 27× 4495× 4495× 812× 1149× 164× 164× 156× 8× 8× 8× 8× 8× 8× 2× 2× 2× 2× 6× 6× 4× 2× 164× 812× 812× 1149× 1149× 164× 4495× 24× 24× 24× 2× 2× 2× 22× 2× 20× 24× 22× 22× 4× 4471× 921× 3550× 4495× 4495× 4495× 4495× 1× 1× 1× 1× 1× 1195× 1195× 1195× 1× 94× 94× 94× 94× 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/util", "../base/enum"], function (require, exports, ej2_base_1, cell_renderer_1, util_1, enum_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var GroupCaptionCellRenderer = (function (_super) { __extends(GroupCaptionCellRenderer, _super); function GroupCaptionCellRenderer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.cellUid = 0; _this.element = _this.parent .createElement('TD', { className: 'e-groupcaption', attrs: { id: _this.parent.element.id + 'captioncell', tabindex: '-1' } }); return _this; } GroupCaptionCellRenderer.prototype.render = function (cell, data) { this.element.id = this.parent.element.id + 'captioncell' + this.cellUid++; var node = this.element.cloneNode(); var gObj = this.parent; var column = cell.column; var domSetter = column.getDomSetter ? column.getDomSetter() : 'innerHTML'; var result; var fKeyValue; var gTemplateValue; data.headerText = cell.column.headerText; if (cell.isForeignKey) { fKeyValue = this.format(cell.column, cell.column.valueAccessor('foreignKey', data, cell.column)); } var value = cell.isForeignKey ? fKeyValue : cell.column.enableGroupByFormat ? data.key : this.format(cell.column, cell.column.valueAccessor('key', data, cell.column)); for (var j = 0; j < gObj.aggregates.length; j++) { var _loop_1 = function (i) { if (gObj.getVisibleColumns()[0].field === gObj.aggregates[parseInt(j.toString(), 10)].columns[parseInt(i.toString(), 10)] .field && gObj.aggregates[parseInt(j.toString(), 10)].columns[parseInt(i.toString(), 10)].groupCaptionTemplate) { var gCaptionTemp = gObj.aggregates[parseInt(j.toString(), 10)] .columns[parseInt(i.toString(), 10)].groupCaptionTemplate; if (typeof gCaptionTemp === 'string' && gCaptionTemp.includes('$')) { gTemplateValue = gObj.aggregates[parseInt(j.toString(), 10)].columns[parseInt(i.toString(), 10)] .groupCaptionTemplate.split('$')[0] + data[gObj.getVisibleColumns()[0].field][gObj .aggregates[parseInt(j.toString(), 10)].columns[parseInt(i.toString(), 10)].type] + gObj.aggregates[parseInt(j.toString(), 10)].columns[parseInt(i.toString(), 10)] .groupCaptionTemplate.split('}')[1]; } else { var column_1 = (gObj.aggregates[parseInt(j.toString(), 10)] .columns[parseInt(i.toString(), 10)]); var tempObj = column_1.getTemplate(enum_1.CellType.CaptionSummary); var tempID = ''; Eif (!ej2_base_1.isNullOrUndefined(tempObj)) { var tempValue_1 = tempObj.fn(data[column_1.columnName], this_1.parent, tempObj.property, tempID); if (this_1.parent.isReact && typeof column_1.groupCaptionTemplate !== 'string') { this_1.parent.renderTemplates(function () { Eif (tempValue_1 && tempValue_1.length) { Eif (!ej2_base_1.isNullOrUndefined(gObj.groupSettings.captionTemplate)) { node.appendChild(tempValue_1[0]); } else { node.innerText += ' ' + tempValue_1[0].textContent; } } }); } else { Eif (tempValue_1 && tempValue_1.length) { if (!ej2_base_1.isNullOrUndefined(gObj.groupSettings.captionTemplate)) { gTemplateValue = tempValue_1; } else { gTemplateValue = tempValue_1[0].textContent; } } } } } return "break"; } }; var this_1 = this; for (var i = 0; i < gObj.aggregates[parseInt(j.toString(), 10)].columns.length; i++) { var state_1 = _loop_1(i); if (state_1 === "break") break; } } if (!ej2_base_1.isNullOrUndefined(gObj.groupSettings.captionTemplate)) { var isReactCompiler = this.parent.isReact && typeof (gObj.groupSettings.captionTemplate) !== 'string' && !(gObj.groupSettings.captionTemplate.prototype && gObj.groupSettings.captionTemplate.prototype.CSPTemplate); var isReactChild = this.parent.parentDetails && this.parent.parentDetails.parentInstObj && this.parent.parentDetails.parentInstObj.isReact; if (isReactCompiler || isReactChild) { var tempID = gObj.element.id + 'captionTemplate'; util_1.templateCompiler(gObj.groupSettings.captionTemplate)(data, this.parent, 'captionTemplate', tempID, null, null, node); this.parent.renderTemplates(); } else if (this.parent.isVue || (gObj.parentDetails && gObj.parentDetails.parentInstObj && gObj.parentDetails.parentInstObj.isVue)) { result = util_1.templateCompiler(gObj.groupSettings.captionTemplate)(data, this.parent, 'captionTemplate', null, null, null, null, gObj.root); } else { result = util_1.templateCompiler(gObj.groupSettings.captionTemplate)(data); } if (!isReactCompiler && !isReactChild) { util_1.appendChildren(node, result); if (gTemplateValue && gTemplateValue.length && gTemplateValue[0].textContent) { node.appendChild(gTemplateValue[0]); } } } else { if (gObj.groupSettings.enableLazyLoading) { node["" + domSetter] = this.parent.sanitize(cell.column.headerText) + ': ' + this.parent.sanitize(value) + (gTemplateValue ? ' ' + gTemplateValue : ''); } else { node["" + domSetter] = this.parent.sanitize(cell.column.headerText) + ': ' + this.parent.sanitize(value) + ' - ' + data.count + ' ' + (data.count < 2 ? this.localizer.getConstant('Item') : this.localizer.getConstant('Items')) + (gTemplateValue ? ' ' + gTemplateValue : ''); } } node.setAttribute('colspan', cell.colSpan.toString()); node.setAttribute('aria-label', node.innerHTML + this.localizer.getConstant('GroupCaption')); node.setAttribute('title', node.textContent); return node; }; return GroupCaptionCellRenderer; }(cell_renderer_1.CellRenderer)); exports.GroupCaptionCellRenderer = GroupCaptionCellRenderer; var GroupCaptionEmptyCellRenderer = (function (_super) { __extends(GroupCaptionEmptyCellRenderer, _super); function GroupCaptionEmptyCellRenderer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.element = _this.parent.createElement('TD', { className: 'e-groupcaption' }); return _this; } GroupCaptionEmptyCellRenderer.prototype.render = function (cell, data) { var node = this.element.cloneNode(); node.innerHTML = ' '; node.setAttribute('colspan', cell.colSpan.toString()); return node; }; return GroupCaptionEmptyCellRenderer; }(cell_renderer_1.CellRenderer)); exports.GroupCaptionEmptyCellRenderer = GroupCaptionEmptyCellRenderer; }); |