react-kd-grid 2.2.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { GridColumn, SortConfig, ActiveFilters, ColumnFilterValue, GridRow } from "../types";
2
3
  interface GridHeaderProps {
3
4
  pinnedColumns: GridColumn[];
@@ -29,5 +30,8 @@ interface GridHeaderProps {
29
30
  onColumnOrderChange: (order: string[]) => void;
30
31
  paginationMode?: "client" | "server" | null;
31
32
  }
32
- export declare const GridHeader: ({ pinnedColumns, unpinnedColumns, hvPadLeft, hvPadRight, headerHeight, sortConfig, columnFilters, selectable, selectedRows, totalRows, data, onSort, onColumnFilter, onSelectAll, onColumnResize, pinnedKeySet, onColumnPin, groupable, groupedByColumn, onGroupBy, groupedByColumns, onGroupToggle, onAutosizeColumn, onAutosizeAllColumns, onResetColumns, columnOrder, onColumnOrderChange, paginationMode, }: GridHeaderProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const GridHeader: React.MemoExoticComponent<{
34
+ ({ pinnedColumns, unpinnedColumns, hvPadLeft, hvPadRight, headerHeight, sortConfig, columnFilters, selectable, selectedRows, totalRows, data, onSort, onColumnFilter, onSelectAll, onColumnResize, pinnedKeySet, onColumnPin, groupable, groupedByColumn, onGroupBy, groupedByColumns, onGroupToggle, onAutosizeColumn, onAutosizeAllColumns, onResetColumns, columnOrder, onColumnOrderChange, paginationMode, }: GridHeaderProps): import("react/jsx-runtime").JSX.Element;
35
+ displayName: string;
36
+ }>;
33
37
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent } from "react";
2
- import { GridRow, GridColumn, VirtualizedRange } from "../types";
2
+ import { GridRow, GridColumn, VirtualizedRange, ContextMenuItem, RowEventParams, CellClickParams, CellContextMenuParams } from "../types";
3
3
  interface GridRowsProps {
4
4
  data: GridRow[];
5
5
  columns: GridColumn[];
@@ -14,25 +14,15 @@ interface GridRowsProps {
14
14
  hvPadLeft?: number;
15
15
  hvPadRight?: number;
16
16
  rowStyle?: (row: GridRow) => CSSProperties | undefined;
17
+ rowClassName?: string | ((row: GridRow, index: number) => string);
17
18
  globalFilter?: string;
18
- onContextMenu?: (row: GridRow, event: MouseEvent) => void;
19
- onRowDoubleClick?: (row: GridRow, event: MouseEvent) => void;
20
- onRowClick?: (row: GridRow, event: MouseEvent) => void;
21
- onCellClick?: (args: {
22
- row: GridRow;
23
- column: GridColumn;
24
- value: any;
25
- event: MouseEvent;
26
- }) => void;
19
+ onContextMenu?: (params: RowEventParams) => void;
20
+ onRowDoubleClick?: (params: RowEventParams) => void;
21
+ onRowClick?: (params: RowEventParams) => void;
22
+ onCellClick?: (params: CellClickParams) => void;
27
23
  isCellFocused?: (rowId: string | number, columnKey: string) => boolean;
28
24
  isCellSelected?: (rowId: string | number, columnKey: string) => boolean;
29
- onCellContextMenu?: (args: {
30
- row: GridRow;
31
- column: GridColumn;
32
- value: any;
33
- displayValue: string;
34
- event: MouseEvent;
35
- }) => void;
25
+ onCellContextMenu?: (params: CellContextMenuParams) => void;
36
26
  onCellMouseDown?: (args: {
37
27
  row: GridRow;
38
28
  column: GridColumn;
@@ -43,10 +33,12 @@ interface GridRowsProps {
43
33
  column: GridColumn;
44
34
  event: MouseEvent;
45
35
  }) => void;
36
+ /** Custom items for the row right-click context menu. */
37
+ contextMenuItems?: ContextMenuItem[];
46
38
  getRowId?: (row: GridRow) => string | number;
47
39
  }
48
40
  export declare const GridRows: import("react").MemoExoticComponent<{
49
- ({ data, columns, selectedRows, virtualized, virtualizedRange, rowHeight, selectable, isRowSelectable, onRowSelect, pinnedColumns, hvPadLeft, hvPadRight, rowStyle, globalFilter, onContextMenu, onRowDoubleClick, onRowClick, onCellClick, isCellFocused, isCellSelected, onCellContextMenu, onCellMouseDown, onCellMouseEnter, getRowId, }: GridRowsProps): import("react/jsx-runtime").JSX.Element;
41
+ ({ data, columns, selectedRows, virtualized, virtualizedRange, rowHeight, selectable, isRowSelectable, onRowSelect, pinnedColumns, hvPadLeft, hvPadRight, rowStyle, rowClassName, globalFilter, onContextMenu, onRowDoubleClick, onRowClick, onCellClick, isCellFocused, isCellSelected, onCellContextMenu, onCellMouseDown, onCellMouseEnter, contextMenuItems, getRowId, }: GridRowsProps): import("react/jsx-runtime").JSX.Element;
50
42
  displayName: string;
51
43
  }>;
52
44
  export {};
@@ -11,5 +11,8 @@ interface PaginationControlsProps {
11
11
  onPageSizeChange: (pageSize: number) => void;
12
12
  showNoDataMessage?: boolean;
13
13
  }
14
- export declare const PaginationControls: ({ paginationConfig, currentPage, isServerLoading, selectedRowsCount, totalDataLength, filteredDataLength, paginationMode, onPageChange, onPageSizeChange, }: PaginationControlsProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const PaginationControls: import("react").MemoExoticComponent<{
15
+ ({ paginationConfig, currentPage, isServerLoading, selectedRowsCount, totalDataLength, filteredDataLength, paginationMode, onPageChange, onPageSizeChange, }: PaginationControlsProps): import("react/jsx-runtime").JSX.Element;
16
+ displayName: string;
17
+ }>;
15
18
  export {};
@@ -1,13 +1,4 @@
1
- import { ReactNode } from "react";
2
- import { GridRow } from "../types";
3
- export interface ContextMenuItem {
4
- id: string;
5
- label: string;
6
- icon?: ReactNode;
7
- onClick: (row: GridRow) => void;
8
- disabled?: boolean;
9
- separator?: boolean;
10
- }
1
+ import { GridRow, ContextMenuItem } from "../types";
11
2
  interface RowContextMenuProps {
12
3
  row: GridRow;
13
4
  position: {
@@ -1,24 +1,9 @@
1
1
  import { ReactNode, ChangeEvent } from "react";
2
- import type { Density } from "../types";
2
+ import type { Density, BulkActionOption, SavedFilter } from "../types";
3
3
  export type ExportFormat = "csv" | "json" | "xlsx";
4
- export type BulkAction = "delete" | "archive" | "copy" | "edit" | "export";
5
- export interface BulkActionOption {
6
- id: BulkAction;
7
- label: string;
8
- icon: ReactNode;
9
- onClick: (selectedRows: Set<string | number>) => void;
10
- disabled?: boolean;
11
- destructive?: boolean;
12
- }
13
4
  interface ColumnVisibility {
14
5
  [columnKey: string]: boolean;
15
6
  }
16
- interface SavedFilter {
17
- id: string;
18
- name: string;
19
- globalFilter: string;
20
- columnFilters: Record<string, any>;
21
- }
22
7
  interface SearchToolbarProps {
23
8
  globalFilter: string;
24
9
  filteredDataLength: number;
@@ -47,7 +32,7 @@ interface SearchToolbarProps {
47
32
  columnFilters?: Record<string, any>;
48
33
  savedFilters?: SavedFilter[];
49
34
  bulkActions?: BulkActionOption[];
50
- isLoading?: boolean;
35
+ loading?: boolean;
51
36
  exportOptions?: {
52
37
  enabled: boolean;
53
38
  formats?: ExportFormat[];
@@ -75,5 +60,8 @@ interface SearchToolbarProps {
75
60
  customLeftContent?: ReactNode;
76
61
  customRightContent?: ReactNode;
77
62
  }
78
- export declare const SearchToolbar: ({ globalFilter, filteredDataLength, selectedRowsCount, selectedRows, showExport, showColumnToggle, showBulkActions, columns, columnVisibility, columnFilters, bulkActions, exportOptions, onGlobalFilterChange, onClearFilters, onColumnVisibilityChange, onColumnFilter, onResetColumns, columnOrder, onColumnOrderChange, pinnedColumns, onScrollToColumn, density, onDensityChange, showDensityControl, customLeftContent, customRightContent, }: SearchToolbarProps) => import("react/jsx-runtime").JSX.Element;
63
+ export declare const SearchToolbar: import("react").MemoExoticComponent<{
64
+ ({ globalFilter, filteredDataLength, selectedRowsCount, selectedRows, showExport, showColumnToggle, showBulkActions, columns, columnVisibility, columnFilters, bulkActions, exportOptions, onGlobalFilterChange, onClearFilters, onColumnVisibilityChange, onColumnFilter, onResetColumns, columnOrder, onColumnOrderChange, pinnedColumns, onScrollToColumn, density, onDensityChange, showDensityControl, customLeftContent, customRightContent, }: SearchToolbarProps): import("react/jsx-runtime").JSX.Element;
65
+ displayName: string;
66
+ }>;
79
67
  export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { KDGrid } from "./core/DataGrid";
2
- export type { KDGridProps, KDGridRef, GridColumn, GridRow, Density, SortConfig, SortDirection, PaginationConfig, GroupConfig, ActiveFilters, ColumnFilterValue, VirtualizedRange, ColumnConfig, } from "./types";
2
+ export type { KDGridProps, KDGridRef, GridColumn, GridRow, Density, SortConfig, SortDirection, PaginationConfig, PaginationOptions, ExportOptions, PerformanceConfig, GroupConfig, ActiveFilters, ColumnFilterValue, ColumnConfig, ContextMenuItem, BulkActionOption, SavedFilter, SearchMode, RowEventParams, CellClickParams, CellContextMenuParams, CellFocusParams, CellSelectionPayload, CopyCellsPayload, } from "./types";
3
3
  export { usePagination } from "./hooks/usePagination";
4
4
  export { useVirtualization } from "./hooks/useVirtualization";
5
5
  export { useSelection } from "./hooks/useSelection";