@yahya.saidi/super-header-react-data-grid
Advanced tools
Comparing version 7.0.0-canary.26 to 7.0.1-canary.26
@@ -24,12 +24,25 @@ import React, { useCallback, memo } from "react"; | ||
else { | ||
return (React.createElement("div", null, superHeader.map((header) => (React.createElement("div", { role: "superHeader", "aria-rowindex": 1, className: "rdg-header-row" }, header.map((subHeader, i, arr) => { | ||
var prevWidth; | ||
if (i > 0) { | ||
prevWidth = arr[i - 1].span; | ||
} | ||
else { | ||
prevWidth = arr[i].span; | ||
} | ||
return (React.createElement(SuperHeaderCell, { key: subHeader.name, prevWidth: prevWidth * columns[0].width, column: columns[0], index: i, superSpecs: subHeader, onResize: onColumnResize, allRowsSelected: allRowsSelected, onAllRowsSelectionChange: handleAllRowsSelectionChange, onSort: onSort, sortColumn: sortColumn, sortDirection: sortDirection })); | ||
})))))); | ||
return (React.createElement("div", null, superHeader.map((header) => { | ||
var leftSum = 0; // this variable is only to get the sum of left for the positioning of the grid elements | ||
return (React.createElement("div", { role: "superHeader", "aria-rowindex": 1, className: "rdg-header-row" }, header.map((subHeader, i, arr) => { | ||
var left; | ||
if (i == 0) { | ||
left = 0; | ||
} | ||
else if (i == 1) { | ||
left = arr[i - 1].span * columns[0].width; | ||
} | ||
else { | ||
left = arr[i - 1].span * columns[1].width; | ||
} | ||
if (i == 0) { | ||
leftSum += left; | ||
return (React.createElement(SuperHeaderCell, { key: subHeader.name, left: leftSum, column: columns[0], index: i, superSpecs: subHeader, onResize: onColumnResize, allRowsSelected: allRowsSelected, onAllRowsSelectionChange: handleAllRowsSelectionChange, onSort: onSort, sortColumn: sortColumn, sortDirection: sortDirection })); | ||
} | ||
else { | ||
leftSum += left; | ||
return (React.createElement(SuperHeaderCell, { key: subHeader.name, left: leftSum, column: columns[1], index: i, superSpecs: subHeader, onResize: onColumnResize, allRowsSelected: allRowsSelected, onAllRowsSelectionChange: handleAllRowsSelectionChange, onSort: onSort, sortColumn: sortColumn, sortDirection: sortDirection })); | ||
} | ||
}))); | ||
}))); | ||
} | ||
@@ -36,0 +49,0 @@ } |
@@ -9,7 +9,7 @@ import React from "react"; | ||
index: number; | ||
prevWidth: number; | ||
left: number; | ||
onResize: (column: CalculatedColumn<R, SR>, width: number) => void; | ||
onAllRowsSelectionChange: (checked: boolean) => void; | ||
} | ||
export default function SuperHeaderCell<R, SR>({ column, onResize, index, prevWidth, superSpecs: superSpecs, allRowsSelected, onAllRowsSelectionChange, sortColumn, sortDirection, onSort, }: superHeaderCellProps<R, SR>): React.ReactElement<import("./types").HeaderRendererProps<R, SR>, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
export default function SuperHeaderCell<R, SR>({ column, onResize, index, left, superSpecs: superSpecs, allRowsSelected, onAllRowsSelectionChange, sortColumn, sortDirection, onSort, }: superHeaderCellProps<R, SR>): React.ReactElement<import("./types").HeaderRendererProps<R, SR>, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
export {}; |
@@ -15,3 +15,3 @@ import React, { createElement } from "react"; | ||
} | ||
export default function SuperHeaderCell({ column, onResize, index, prevWidth, superSpecs: superSpecs, allRowsSelected, onAllRowsSelectionChange, sortColumn, sortDirection, onSort, }) { | ||
export default function SuperHeaderCell({ column, onResize, index, left, superSpecs: superSpecs, allRowsSelected, onAllRowsSelectionChange, sortColumn, sortDirection, onSort, }) { | ||
function getCell() { | ||
@@ -36,5 +36,6 @@ if (!column.headerRenderer) | ||
width: column.width * superSpecs.span, | ||
left: prevWidth * index, | ||
left: left, | ||
textAlign: superSpecs.textPlace, | ||
}; | ||
cell = (React.createElement("div", { role: "column-header", "aria-colindex": index + 1, "aria-sort": sortColumn === column.key ? getAriaSort(sortDirection) : undefined, className: className, style: style }, cell)); | ||
cell = (React.createElement("div", { role: "column-header", "aria-colindex": index + 1, "aria-sort": sortColumn === superSpecs.name ? getAriaSort(sortDirection) : undefined, className: className, style: style }, cell)); | ||
if (column.resizable) { | ||
@@ -41,0 +42,0 @@ cell = (React.createElement(ResizableHeaderCell, { column: column, onResize: onResize }, cell)); |
@@ -236,3 +236,5 @@ import { KeyboardEvent } from 'react'; | ||
span: number; | ||
textPlace?: "left" | "center"; | ||
value?: number | string | undefined; | ||
} | ||
export {}; |
{ | ||
"name": "@yahya.saidi/super-header-react-data-grid", | ||
"version": "7.0.0-canary.26", | ||
"version": "7.0.1-canary.26", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Excel-like grid component built with React, with editors, keyboard navigation, copy & paste, and the like", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
825695
6207