@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
101 lines • 4.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function getHeaderHeight(gridApi) {
return gridApi.headerRootComp.eHeaderContainer.clientHeight;
}
function getCellElement(gridApi, attributeId, rowIndex) {
var rowComp = gridApi.rowRenderer.rowCompsByIndex[rowIndex];
return rowComp && rowComp.cellComps[attributeId] ? rowComp.cellComps[attributeId].eGui : null;
}
function addCellClass(gridApi, attributeId, rowIndex, className) {
var cellElement = getCellElement(gridApi, attributeId, rowIndex);
if (cellElement !== null) {
cellElement.classList.add(className);
}
}
function removeCellClass(gridApi, attributeId, rowIndex, className) {
var cellElement = getCellElement(gridApi, attributeId, rowIndex);
if (cellElement !== null) {
cellElement.classList.remove(className);
}
}
function getPaginationBottomRowIndex(gridApi) {
var paginationProxy = gridApi.paginationProxy;
if (paginationProxy) {
var index = paginationProxy.bottomRowIndex;
return typeof index === "number" ? index : null;
}
return null;
}
function getPinnedTopRow(gridApi) {
var pinnedTopRow = gridApi.rowRenderer.floatingTopRowComps[0];
return pinnedTopRow ? pinnedTopRow : null;
}
function getPinnedTopRowElement(gridApi) {
var pinnedTopRow = getPinnedTopRow(gridApi);
return pinnedTopRow ? pinnedTopRow.bodyContainerComp.eContainer.parentElement.parentElement : null;
}
function addPinnedTopRowClass(gridApi, className) {
var rowElement = getPinnedTopRowElement(gridApi);
rowElement.classList.add(className);
}
function removePinnedTopRowClass(gridApi, className) {
var rowElement = getPinnedTopRowElement(gridApi);
rowElement.classList.remove(className);
}
function setPinnedTopRowStyle(gridApi, propertyName, propertyValue) {
var rowElement = getPinnedTopRowElement(gridApi);
rowElement.style[propertyName] = propertyValue;
}
function getPinnedTopRowCellElementWrapper(gridApi, attributeId) {
var pinnedTopRow = getPinnedTopRow(gridApi);
if (!pinnedTopRow) {
return null;
}
var columnIndex = Object.keys(pinnedTopRow.cellComps).find(function (index) {
return index.slice(0, attributeId.length) === attributeId && pinnedTopRow.cellComps[index] !== null;
});
return pinnedTopRow.cellComps[columnIndex] ? pinnedTopRow.cellComps[columnIndex].eGui : null;
}
function getPinnedTopRowCellElement(gridApi, attributeId) {
var pinnedTopRowCellElementWrapper = getPinnedTopRowCellElementWrapper(gridApi, attributeId);
return pinnedTopRowCellElementWrapper ? pinnedTopRowCellElementWrapper.querySelector("span") : null;
}
function addPinnedTopRowCellClass(gridApi, attributeId, className) {
var cellElement = getPinnedTopRowCellElementWrapper(gridApi, attributeId);
if (cellElement !== null) {
cellElement.classList.add(className);
}
}
function removePinnedTopRowCellClass(gridApi, attributeId, className) {
var cellElement = getPinnedTopRowCellElementWrapper(gridApi, attributeId);
if (cellElement !== null) {
cellElement.classList.remove(className);
}
}
function setPinnedTopRowCellText(gridApi, attributeId, text) {
var cellElement = getPinnedTopRowCellElement(gridApi, attributeId);
if (cellElement !== null) {
cellElement.innerText = text;
}
}
exports.default = {
getHeaderHeight: getHeaderHeight,
// cell element
getCellElement: getCellElement,
addCellClass: addCellClass,
removeCellClass: removeCellClass,
// pinned row element
getPinnedTopRowElement: getPinnedTopRowElement,
addPinnedTopRowClass: addPinnedTopRowClass,
removePinnedTopRowClass: removePinnedTopRowClass,
setPinnedTopRowStyle: setPinnedTopRowStyle,
// pinned row cell element
getPinnedTopRowCellElement: getPinnedTopRowCellElement,
getPinnedTopRowCellElementWrapper: getPinnedTopRowCellElementWrapper,
addPinnedTopRowCellClass: addPinnedTopRowCellClass,
removePinnedTopRowCellClass: removePinnedTopRowCellClass,
setPinnedTopRowCellText: setPinnedTopRowCellText,
getPaginationBottomRowIndex: getPaginationBottomRowIndex,
};
//# sourceMappingURL=agGridApiWrapper.js.map