Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion examples/grid-lite/components-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
ColumnDefaults,
Column,
Description,
Pagination
Pagination,
Header
} from '@highcharts/grid-lite-react';

function App() {
Expand Down Expand Up @@ -98,6 +99,13 @@ function App() {
cellRowHeader={false}
/>
<Caption>Grid Caption v2.1</Caption>
<Header header={[
'name',
{
format: 'Details',
columns: ['age', 'city', 'salary']
}
]} />
<Column
headerFormat="#"
width={40}
Expand Down
15 changes: 13 additions & 2 deletions packages/grid-lite-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import GridLite from '@highcharts/grid-lite';

export { default as Grid } from './Grid';
export { default as GridLite } from './Grid';
export { Caption, Data, ColumnDefaults, Column, Description, Pagination } from '@highcharts/grid-shared-react';
export {
Caption,
Data,
ColumnDefaults,
Column,
Description,
Pagination,
Header
} from '@highcharts/grid-shared-react';
export { DataTable, DataConnector } from '@highcharts/grid-lite';
export { merge } from '@highcharts/grid-lite/es-modules/Shared/Utilities.js';
export type {
Expand All @@ -27,6 +35,9 @@ export type {
ColumnDataType,
ColumnSortingOrder,
CellValueGetterContext,
PaginationProps
PaginationProps,
HeaderProps,
GroupedHeaderOptions,
HeaderCellAccessibilityProps
} from '@highcharts/grid-shared-react';
export type GridOptions = GridLite.Options;
15 changes: 13 additions & 2 deletions packages/grid-pro-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import GridPro from '@highcharts/grid-pro';

export { default as Grid } from './Grid';
export { default as GridPro } from './Grid';
export { Caption, Data, ColumnDefaults, Column, Description, Pagination } from '@highcharts/grid-shared-react';
export {
Caption,
Data,
ColumnDefaults,
Column,
Description,
Pagination,
Header
} from '@highcharts/grid-shared-react';
export { DataTable, DataConnector } from '@highcharts/grid-pro';
export { merge } from '@highcharts/grid-pro/es-modules/Shared/Utilities.js';
export type {
Expand All @@ -27,6 +35,9 @@ export type {
ColumnDataType,
ColumnSortingOrder,
CellValueGetterContext,
PaginationProps
PaginationProps,
HeaderProps,
GroupedHeaderOptions,
HeaderCellAccessibilityProps
} from '@highcharts/grid-shared-react';
export type GridOptions = GridPro.Options;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Grid React integration.
* Copyright (c) 2025, Highsoft
*
* A valid license is required for using this software.
* See highcharts.com/license
*
*/

import type { HeaderProps } from './headerProps';

export function Header(_props: HeaderProps) {
return null;
}

Header._GridReact = {
type: 'Grid_Option',
gridOption: 'header'
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Grid React integration.
* Copyright (c) 2025, Highsoft
*
* A valid license is required for using this software.
* See highcharts.com/license
*
*/

/**
* Accessibility options for a header cell in the header tree.
*/
export interface HeaderCellAccessibilityProps {
description?: string;
}

/**
* Header node in the `header` tree. A group (with `columns`) or a leaf
* (with `columnId`). Mirrors Grid Core `GroupedHeaderOptions`.
*/
export interface GroupedHeaderOptions {
accessibility?: HeaderCellAccessibilityProps;
format?: string;
className?: string;
columnId?: string;
columns?: Array<GroupedHeaderOptions | string>;
}

export interface HeaderProps {
/**
* Header tree: column order, inclusion, and grouping.
* Each entry is a column id (`string`) or a {@link GroupedHeaderOptions}
* object. Maps to Grid Core `options.header`.
*/
header?: Array<GroupedHeaderOptions | string>;
}
15 changes: 15 additions & 0 deletions packages/grid-shared-react/src/components/options/header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Grid React integration.
* Copyright (c) 2025, Highsoft
*
* A valid license is required for using this software.
* See highcharts.com/license
*
*/

export { Header } from './Header';
export type {
HeaderProps,
GroupedHeaderOptions,
HeaderCellAccessibilityProps
} from './headerProps';
6 changes: 6 additions & 0 deletions packages/grid-shared-react/src/components/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ export { Description } from './description';
export type { DescriptionProps } from './description';
export { Pagination } from './pagination';
export type { PaginationProps } from './pagination';
export { Header } from './header';
export type {
HeaderProps,
GroupedHeaderOptions,
HeaderCellAccessibilityProps
} from './header';
15 changes: 13 additions & 2 deletions packages/grid-shared-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import { GridType, GridInstance } from './hooks/useGrid';
import type { GridProps, GridRefHandle } from './components/BaseGrid';

export { BaseGrid };
export { Caption, Data, ColumnDefaults, Column, Description, Pagination } from './components/options';
export {
Caption,
Data,
ColumnDefaults,
Column,
Description,
Pagination,
Header
} from './components/options';
export { getChildProps } from './utils/getChildProps';
export type {
CaptionProps,
Expand All @@ -25,6 +33,9 @@ export type {
ColumnDataType,
ColumnSortingOrder,
CellValueGetterContext,
PaginationProps
PaginationProps,
HeaderProps,
GroupedHeaderOptions,
HeaderCellAccessibilityProps
} from './components/options';
export type { GridType, GridInstance, GridProps, GridRefHandle };
9 changes: 9 additions & 0 deletions packages/grid-shared-react/src/utils/getChildProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ export function getChildProps(children: ReactNode): Record<string, unknown> {
return;
}

if (meta.gridOption === 'header') {
const { header, children: _ignored } = props;

if (header !== void 0) {
optionsFromChildren.header = header;
}
return;
}

const optionParent = optionsFromChildren[meta.gridOption] ?? (
optionsFromChildren[meta.gridOption] = meta.isArrayType ? [] : {}
);
Expand Down
Loading