Skip to content

Commit

Permalink
* dtable: add class to header cells.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jul 2, 2024
1 parent 4d9b20d commit 5993c31
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dtable/src/components/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function Block({
scrollLeft,
scrollTop,
className,
cellClass,
style,
onRenderCell,
children,
Expand All @@ -26,6 +27,7 @@ export function Block({
cols={left.list}
width={left.width}
rowHeight={rowHeight}
cellClass={cellClass}
onRenderCell={onRenderCell}
/>
);
Expand All @@ -43,6 +45,7 @@ export function Block({
left={left.width}
width={center.width}
rowHeight={rowHeight}
cellClass={cellClass}
onRenderCell={onRenderCell}
/>
);
Expand All @@ -59,6 +62,7 @@ export function Block({
left={left.width + center.width}
width={right.width}
rowHeight={rowHeight}
cellClass={cellClass}
onRenderCell={onRenderCell}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions lib/dtable/src/components/cells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function Cells({
height = '100%',
className,
CellComponent = Cell,
cellClass,
onRenderCell,
}: CellsProps) {
const rowsList = Array.isArray(rows) ? rows : [rows];
Expand All @@ -40,6 +41,7 @@ export function Cells({
colIndex === colsCount - 1 ? 'is-last-in-row' : '',
rowIndex ? '' : 'is-first-row',
rowIndex === rowsCount - 1 ? 'is-last-row' : '',
cellClass,
)}
col={col}
row={row}
Expand Down
1 change: 1 addition & 0 deletions lib/dtable/src/components/dtable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ export class DTable extends Component<DTableOptions, DTableState> {
scrollLeft={scrollLeft}
rowHeight={headerHeight}
scrollTop={0}
cellClass="dtable-header-cell"
rows={{id: 'HEADER', index: -1, top: 0}}
top={0}
onRenderCell={this.#handleRenderCell}
Expand Down
1 change: 1 addition & 0 deletions lib/dtable/src/types/block-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type BlockProps = {
scrollLeft: number;
scrollTop: number;
className?: ClassNameLike;
cellClass?: ClassNameLike;
style?: JSX.CSSProperties;
onRenderCell?: CellRenderCallback;
children?: ComponentChildren;
Expand Down
1 change: 1 addition & 0 deletions lib/dtable/src/types/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type CellsProps = {
width?: number;
height?: number | '100%';
className?: ClassNameLike;
cellClass?: ClassNameLike;
CellComponent?: preact.ComponentType<CellProps>;
onRenderCell?: CellRenderCallback;
};

0 comments on commit 5993c31

Please sign in to comment.