react-kd-grid 5.0.2 → 5.0.4
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.
- package/dist/components/SearchToolbar.d.ts +6 -2
- package/dist/components/toolbar/BulkActionPopover.d.ts +17 -0
- package/dist/components/toolbar/ColumnVisibilityPopover.d.ts +35 -0
- package/dist/components/toolbar/ExportPopover.d.ts +18 -0
- package/dist/components/toolbar/FilterPopover.d.ts +29 -0
- package/dist/components/toolbar/SettingsPopover.d.ts +17 -0
- package/dist/components/ui/Button.d.ts +11 -0
- package/dist/components/ui/Checkbox.d.ts +9 -0
- package/dist/components/ui/CustomSelect.d.ts +14 -0
- package/dist/components/ui/Popover.d.ts +17 -0
- package/dist/components/ui/TextField.d.ts +12 -0
- package/dist/constants/toolbar.d.ts +17 -0
- package/dist/core/GridBodyContainer.d.ts +83 -0
- package/dist/core/GridFooterContainer.d.ts +23 -0
- package/dist/core/GridToolbarContainer.d.ts +48 -0
- package/dist/grid/components/Filters/BooleanFilter.d.ts +7 -0
- package/dist/grid/components/Filters/DateFilter.d.ts +9 -0
- package/dist/grid/components/Filters/FilterContent.d.ts +9 -0
- package/dist/grid/components/Filters/FilterPopup.d.ts +2 -0
- package/dist/grid/components/Filters/MultiselectFilter.d.ts +10 -0
- package/dist/grid/components/Filters/NumberFilter.d.ts +9 -0
- package/dist/grid/components/Filters/TextFilter.d.ts +8 -0
- package/dist/grid/components/Filters/index.d.ts +6 -0
- package/dist/grid/components/Popovers/BulkActionPopover.d.ts +17 -0
- package/dist/grid/components/Popovers/ColumnVisibilityPopover.d.ts +35 -0
- package/dist/grid/components/Popovers/ExportPopover.d.ts +18 -0
- package/dist/grid/components/Popovers/FilterPopover.d.ts +29 -0
- package/dist/grid/components/Popovers/SettingsPopover.d.ts +17 -0
- package/dist/grid/components/Shared/CellEditor.d.ts +23 -0
- package/dist/grid/components/Shared/ColumnFilterSelector.d.ts +18 -0
- package/dist/grid/components/Shared/FooterAggregate.d.ts +16 -0
- package/dist/grid/components/Shared/GridHeader.d.ts +39 -0
- package/dist/grid/components/Shared/GridRows.d.ts +53 -0
- package/dist/grid/components/Shared/GroupBar.d.ts +12 -0
- package/dist/grid/components/Shared/GroupHeader.d.ts +29 -0
- package/dist/grid/components/Shared/LicenseError.d.ts +9 -0
- package/dist/grid/components/Shared/NoDataMessage.d.ts +11 -0
- package/dist/grid/components/Shared/PaginationControls.d.ts +18 -0
- package/dist/grid/components/Shared/RowContextMenu.d.ts +18 -0
- package/dist/grid/components/Toolbar/Toolbar.d.ts +70 -0
- package/dist/grid/constants/index.d.ts +1 -0
- package/dist/grid/constants/toolbar.d.ts +17 -0
- package/dist/grid/core/DataGrid.d.ts +3 -0
- package/dist/grid/core/GridBodyContainer.d.ts +83 -0
- package/dist/grid/core/GridFooterContainer.d.ts +23 -0
- package/dist/grid/core/GridToolbarContainer.d.ts +48 -0
- package/dist/grid/hooks/toolbar/useColumnDnD.d.ts +28 -0
- package/dist/grid/hooks/toolbar/useToolbarMenus.d.ts +29 -0
- package/dist/grid/hooks/useAdvancedFiltering.d.ts +18 -0
- package/dist/grid/hooks/useCellSelection.d.ts +67 -0
- package/dist/grid/hooks/useColumnState.d.ts +52 -0
- package/dist/grid/hooks/useDataWorker.d.ts +11 -0
- package/dist/grid/hooks/useEditingCell.d.ts +49 -0
- package/dist/grid/hooks/useExport.d.ts +14 -0
- package/dist/grid/hooks/useGridDataMaps.d.ts +17 -0
- package/dist/grid/hooks/useGridMethods.d.ts +20 -0
- package/dist/grid/hooks/useGrouping.d.ts +28 -0
- package/dist/grid/hooks/useHorizontalVirtualization.d.ts +18 -0
- package/dist/grid/hooks/useInfiniteScroll.d.ts +31 -0
- package/dist/grid/hooks/useLoadingBar.d.ts +21 -0
- package/dist/grid/hooks/usePagination.d.ts +28 -0
- package/dist/grid/hooks/useScrollSync.d.ts +29 -0
- package/dist/grid/hooks/useSelection.d.ts +13 -0
- package/dist/grid/hooks/useVirtualization.d.ts +17 -0
- package/dist/grid/types.d.ts +570 -0
- package/dist/grid/utils/dateUtils.d.ts +16 -0
- package/dist/grid/utils/highlightText.d.ts +15 -0
- package/dist/grid/utils/license.d.ts +3 -0
- package/dist/hooks/toolbar/useColumnDnD.d.ts +28 -0
- package/dist/hooks/toolbar/useToolbarMenus.d.ts +29 -0
- package/dist/hooks/useColumnState.d.ts +8 -1
- package/dist/hooks/useGridDataMaps.d.ts +17 -0
- package/dist/hooks/useGridMethods.d.ts +20 -0
- package/dist/hooks/useHorizontalVirtualization.d.ts +18 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.d.ts +21 -12
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -0
- package/dist/types.d.ts +0 -22
- package/dist/utils/theme.d.ts +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GridColumn, SortConfig, ActiveFilters, ColumnFilterValue, GridRow } from "../../types";
|
|
3
|
+
interface GridHeaderProps {
|
|
4
|
+
pinnedColumns: GridColumn[];
|
|
5
|
+
unpinnedColumns: GridColumn[];
|
|
6
|
+
hvPadLeft?: number;
|
|
7
|
+
hvPadRight?: number;
|
|
8
|
+
headerHeight: number;
|
|
9
|
+
sortConfig: SortConfig;
|
|
10
|
+
columnFilters: ActiveFilters;
|
|
11
|
+
selectable: boolean;
|
|
12
|
+
selectedRows: Set<string | number>;
|
|
13
|
+
totalRows: number;
|
|
14
|
+
data: GridRow[];
|
|
15
|
+
onSort: (key: string) => void;
|
|
16
|
+
onColumnFilter: (key: string, filter: ColumnFilterValue | null) => void;
|
|
17
|
+
onSelectAll: () => void;
|
|
18
|
+
onColumnResize?: (columnKey: string, width: number) => void;
|
|
19
|
+
pinnedKeySet?: Set<string>;
|
|
20
|
+
onColumnPin?: (columnKey: string, pinned: boolean) => void;
|
|
21
|
+
groupable?: boolean;
|
|
22
|
+
groupedByColumn?: string | null;
|
|
23
|
+
onGroupBy?: (columnKey: string | null) => void;
|
|
24
|
+
groupedByColumns?: string[];
|
|
25
|
+
onGroupToggle?: (columnKey: string, nextGrouped: boolean) => void;
|
|
26
|
+
onAutosizeColumn?: (columnKey: string) => void;
|
|
27
|
+
onAutosizeAllColumns?: () => void;
|
|
28
|
+
onResetColumns?: () => void;
|
|
29
|
+
columnOrder: string[];
|
|
30
|
+
onColumnOrderChange: (order: string[]) => void;
|
|
31
|
+
paginationMode?: "client" | "server" | null;
|
|
32
|
+
/** Minimum column width enforced during drag-resize. Defaults to 80px. */
|
|
33
|
+
minResizeWidth?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const GridHeader: React.MemoExoticComponent<{
|
|
36
|
+
({ 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, minResizeWidth, }: GridHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
}>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CSSProperties, MouseEvent } from "react";
|
|
2
|
+
import { GridRow, GridColumn, VirtualizedRange, ContextMenuItem, RowEventParams, CellClickParams, CellContextMenuParams } from "../../types";
|
|
3
|
+
interface GridRowsProps {
|
|
4
|
+
data: GridRow[];
|
|
5
|
+
columns: GridColumn[];
|
|
6
|
+
selectedRows: Set<string | number>;
|
|
7
|
+
virtualized: boolean;
|
|
8
|
+
virtualizedRange: VirtualizedRange;
|
|
9
|
+
rowHeight: number;
|
|
10
|
+
selectable: boolean;
|
|
11
|
+
isRowSelectable?: (row: GridRow) => boolean;
|
|
12
|
+
onRowSelect: (rowId: string | number, isSelected: boolean) => void;
|
|
13
|
+
pinnedColumns?: Set<string>;
|
|
14
|
+
hvPadLeft?: number;
|
|
15
|
+
hvPadRight?: number;
|
|
16
|
+
rowStyle?: (row: GridRow) => CSSProperties | undefined;
|
|
17
|
+
globalFilter?: string;
|
|
18
|
+
onContextMenu?: (params: RowEventParams) => void;
|
|
19
|
+
onRowDoubleClick?: (params: RowEventParams) => void;
|
|
20
|
+
onRowClick?: (params: RowEventParams) => void;
|
|
21
|
+
onCellClick?: (params: CellClickParams) => void;
|
|
22
|
+
isCellFocused?: (rowId: string | number, columnKey: string) => boolean;
|
|
23
|
+
isCellSelected?: (rowId: string | number, columnKey: string) => boolean;
|
|
24
|
+
onCellContextMenu?: (params: CellContextMenuParams) => void;
|
|
25
|
+
onCellMouseDown?: (args: {
|
|
26
|
+
row: GridRow;
|
|
27
|
+
column: GridColumn;
|
|
28
|
+
event: MouseEvent;
|
|
29
|
+
}) => void;
|
|
30
|
+
onCellMouseEnter?: (args: {
|
|
31
|
+
row: GridRow;
|
|
32
|
+
column: GridColumn;
|
|
33
|
+
event: MouseEvent;
|
|
34
|
+
}) => void;
|
|
35
|
+
/** Custom items for the row right-click context menu. */
|
|
36
|
+
contextMenuItems?: ContextMenuItem[];
|
|
37
|
+
getRowId?: (row: GridRow) => string | number;
|
|
38
|
+
/** Returns true when a specific (rowId, columnKey) pair is currently being edited. */
|
|
39
|
+
isEditing?: (rowId: string | number, columnKey: string) => boolean;
|
|
40
|
+
/** Called when the user double-clicks (or presses F2 on) an editable cell. */
|
|
41
|
+
onStartEdit?: (row: GridRow, column: GridColumn) => void;
|
|
42
|
+
/** Called by CellEditor when the user commits a value. */
|
|
43
|
+
onCommitEdit?: (newValue: any) => void;
|
|
44
|
+
/** Called by CellEditor when the user cancels without saving. */
|
|
45
|
+
onCancelEdit?: () => void;
|
|
46
|
+
/** The current edit initial value — passed down to CellEditor to initialise draft state. */
|
|
47
|
+
editingInitialValue?: any;
|
|
48
|
+
}
|
|
49
|
+
export declare const GridRows: import("react").MemoExoticComponent<{
|
|
50
|
+
({ data, columns, selectedRows, virtualized, virtualizedRange, rowHeight, selectable, isRowSelectable, onRowSelect, pinnedColumns, hvPadLeft, hvPadRight, rowStyle, globalFilter, onContextMenu, onRowDoubleClick, onRowClick, onCellClick, isCellFocused, isCellSelected, onCellContextMenu, onCellMouseDown, onCellMouseEnter, contextMenuItems, getRowId, isEditing, onStartEdit, onCommitEdit, onCancelEdit, editingInitialValue, }: GridRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
}>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GridColumn } from "../../types";
|
|
2
|
+
interface GroupBarProps {
|
|
3
|
+
columns: GridColumn[];
|
|
4
|
+
groupedKeys: string[];
|
|
5
|
+
onRemove: (columnKey: string) => void;
|
|
6
|
+
onReorder: (newOrder: string[]) => void;
|
|
7
|
+
onDropColumnKey: (columnKey: string) => void;
|
|
8
|
+
onToggleExpandAll?: () => void;
|
|
9
|
+
isAnyExpanded?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const GroupBar: ({ columns, groupedKeys, onRemove, onReorder, onDropColumnKey, onToggleExpandAll, isAnyExpanded, }: GroupBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GridRow, KDGridProps } from "../../types";
|
|
2
|
+
interface GroupHeaderProps {
|
|
3
|
+
row: GridRow & {
|
|
4
|
+
_isGroupHeader?: boolean;
|
|
5
|
+
_groupKey?: string;
|
|
6
|
+
_groupCount?: number;
|
|
7
|
+
};
|
|
8
|
+
isExpanded: boolean;
|
|
9
|
+
onToggle: (groupKey: string) => void;
|
|
10
|
+
viewportWidth: number;
|
|
11
|
+
selectable: boolean;
|
|
12
|
+
rowHeight?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Optional function to map a column key to its display label (header).
|
|
15
|
+
* If not provided, the raw column key will be used as a fallback.
|
|
16
|
+
*/
|
|
17
|
+
getHeaderLabel?: (columnKey: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional function to map a column key and raw group value to a display label.
|
|
20
|
+
* Useful to apply the column's formatter for group headers.
|
|
21
|
+
*/
|
|
22
|
+
getValueLabel?: (columnKey: string, rawValue: any) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional custom renderer for actions on grouped rows.
|
|
25
|
+
*/
|
|
26
|
+
renderGroupActions?: KDGridProps["renderGroupActions"];
|
|
27
|
+
}
|
|
28
|
+
export declare const GroupHeader: import("react").MemoExoticComponent<({ row, isExpanded, onToggle, viewportWidth, selectable, rowHeight, getHeaderLabel, getValueLabel, renderGroupActions, }: GroupHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LicenseError
|
|
3
|
+
*
|
|
4
|
+
* Shown inside the grid body when an invalid or missing `licenseKey` is
|
|
5
|
+
* detected. Rendering it in the body (rather than replacing the entire
|
|
6
|
+
* component) keeps the column header visible so consumers can still see
|
|
7
|
+
* the grid structure and understand what data *should* be there.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LicenseError: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface NoDataMessageProps {
|
|
3
|
+
hasFilters?: boolean;
|
|
4
|
+
hasData?: boolean;
|
|
5
|
+
/** Custom text message. Overridden by `renderer` if both are set. */
|
|
6
|
+
message?: string;
|
|
7
|
+
/** Fully custom empty-state renderer — takes precedence over `message`. */
|
|
8
|
+
renderer?: () => ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const NoDataMessage: ({ hasFilters, hasData, message, renderer, }: NoDataMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PaginationConfig } from "../../types";
|
|
2
|
+
interface PaginationControlsProps {
|
|
3
|
+
paginationConfig: PaginationConfig;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
isServerLoading: boolean;
|
|
6
|
+
selectedRowsCount: number;
|
|
7
|
+
totalDataLength: number;
|
|
8
|
+
filteredDataLength?: number;
|
|
9
|
+
paginationMode?: "client" | "server";
|
|
10
|
+
onPageChange: (page: number, pageSize: number) => void;
|
|
11
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
12
|
+
showNoDataMessage?: boolean;
|
|
13
|
+
}
|
|
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
|
+
}>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GridRow, ContextMenuItem } from "../../types";
|
|
2
|
+
/** Ready-made starter items — ONLY for development / demos.
|
|
3
|
+
* All items are no-ops in dev environments (they log in DEV only).
|
|
4
|
+
* Do NOT rely on these in production; wire your own `contextMenuItems`. */
|
|
5
|
+
export declare const defaultContextMenuItems: ContextMenuItem[];
|
|
6
|
+
interface RowContextMenuProps {
|
|
7
|
+
row: GridRow;
|
|
8
|
+
position: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
isVisible: boolean;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
/** Custom menu items. If not provided the menu will not render. */
|
|
15
|
+
menuItems?: ContextMenuItem[];
|
|
16
|
+
}
|
|
17
|
+
export declare const RowContextMenu: ({ row, position, isVisible, onClose, menuItems, }: RowContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ChangeEvent, ReactNode } from "react";
|
|
2
|
+
import type { BulkActionOption, Density, ExportFormat, SavedFilter } from "../../types";
|
|
3
|
+
interface ColumnVisibility {
|
|
4
|
+
[columnKey: string]: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface SearchToolbarProps {
|
|
7
|
+
globalFilter: string;
|
|
8
|
+
filteredDataLength: number;
|
|
9
|
+
totalDataLength: number;
|
|
10
|
+
paginationMode?: "client" | "server";
|
|
11
|
+
totalRows?: number;
|
|
12
|
+
selectedRowsCount?: number;
|
|
13
|
+
selectedRows?: Set<string | number>;
|
|
14
|
+
showExport?: boolean;
|
|
15
|
+
showRefresh?: boolean;
|
|
16
|
+
showColumnToggle?: boolean;
|
|
17
|
+
showBulkActions?: boolean;
|
|
18
|
+
showSavedFilters?: boolean;
|
|
19
|
+
columns?: Array<{
|
|
20
|
+
key: string;
|
|
21
|
+
header: string;
|
|
22
|
+
visible?: boolean;
|
|
23
|
+
filterOptions?: Array<{
|
|
24
|
+
label: string;
|
|
25
|
+
value: string | number;
|
|
26
|
+
}>;
|
|
27
|
+
filterType?: "text" | "select" | "multiselect";
|
|
28
|
+
filterable?: any;
|
|
29
|
+
}>;
|
|
30
|
+
columnVisibility?: ColumnVisibility;
|
|
31
|
+
columnFilters?: Record<string, any>;
|
|
32
|
+
savedFilters?: SavedFilter[];
|
|
33
|
+
bulkActions?: BulkActionOption[];
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
exportOptions?: {
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
formats?: ExportFormat[];
|
|
38
|
+
filename?: string;
|
|
39
|
+
onExport?: (format: ExportFormat, exportSelected: boolean) => void;
|
|
40
|
+
};
|
|
41
|
+
onGlobalFilterChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
42
|
+
onClearFilters?: () => void;
|
|
43
|
+
onRefresh?: () => void;
|
|
44
|
+
onColumnVisibilityChange?: (columnKey: string, visible: boolean) => void;
|
|
45
|
+
onColumnFilter?: (columnKey: string, filter: any) => void;
|
|
46
|
+
onSaveFilter?: (filter: Omit<SavedFilter, "id">) => void;
|
|
47
|
+
onLoadFilter?: (filter: SavedFilter) => void;
|
|
48
|
+
onDeleteFilter?: (filterId: string) => void;
|
|
49
|
+
onRowSelect?: (selectedRows: number[]) => void;
|
|
50
|
+
onToggleFilters?: (show: boolean) => void;
|
|
51
|
+
onResetColumns?: () => void;
|
|
52
|
+
columnOrder?: string[];
|
|
53
|
+
onColumnOrderChange?: (order: string[]) => void;
|
|
54
|
+
pinnedColumns?: Set<string>;
|
|
55
|
+
onScrollToColumn?: (columnKey: string) => void;
|
|
56
|
+
density?: Density;
|
|
57
|
+
onDensityChange?: (density: Density) => void;
|
|
58
|
+
showDensityControl?: boolean;
|
|
59
|
+
customLeftContent?: ReactNode;
|
|
60
|
+
customRightContent?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Optimized SearchToolbar using React.memo to prevent unnecessary re-renders
|
|
64
|
+
* as users type in the global search or modify filters.
|
|
65
|
+
*/
|
|
66
|
+
export declare const Toolbar: import("react").MemoExoticComponent<{
|
|
67
|
+
({ globalFilter, filteredDataLength, totalDataLength, 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;
|
|
68
|
+
displayName: string;
|
|
69
|
+
}>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SELECT_COL_WIDTH = 48;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExportFormat, Density } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Mappings for Export formats to their respective icons.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getExportIcon: (format: ExportFormat) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Mappings for Bulk Action IDs to their respective icons.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBulkActionIcon: (action: string) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Human-readable labels for export formats.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getFormatLabel: (format: ExportFormat) => "CSV" | "JSON" | "Excel";
|
|
14
|
+
/**
|
|
15
|
+
* Default density options for the grid.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DENSITY_OPTIONS: Density[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
import type { GridColumn, GridRow, SortConfig, ColumnFilterValue } from "../types";
|
|
3
|
+
interface GridBodyContainerProps {
|
|
4
|
+
scrollRef: RefObject<HTMLDivElement>;
|
|
5
|
+
flatRows: any[];
|
|
6
|
+
columnsWithWidths: any[];
|
|
7
|
+
visibleColumns: any[];
|
|
8
|
+
totalWidth: number;
|
|
9
|
+
selectable: boolean;
|
|
10
|
+
dataToDisplay: any[];
|
|
11
|
+
pinnedAll: any[];
|
|
12
|
+
effectivePinnedColumns: Set<string>;
|
|
13
|
+
hvPadLeftMemo: number;
|
|
14
|
+
hvPadRightMemo: number;
|
|
15
|
+
resolvedHeaderHeight: number;
|
|
16
|
+
sortConfig: SortConfig;
|
|
17
|
+
columnFilters: Record<string, ColumnFilterValue | null>;
|
|
18
|
+
selectedRows: Set<string | number>;
|
|
19
|
+
data: any[];
|
|
20
|
+
handleSort: (key: string) => void;
|
|
21
|
+
setColumnFilter: (key: string, filter: ColumnFilterValue | null) => void;
|
|
22
|
+
handleSelectAll: (checked: boolean) => void;
|
|
23
|
+
handleColumnResize: (columnKey: string, width: number) => void;
|
|
24
|
+
handleColumnPin: (columnKey: string, pinned: boolean) => void;
|
|
25
|
+
addGroupKey: (key: string) => void;
|
|
26
|
+
removeGroupKey: (key: string) => void;
|
|
27
|
+
handleGroupBy: (columnKey: string) => void;
|
|
28
|
+
autosizeColumn: (columnKey: string) => void;
|
|
29
|
+
autosizeAllColumns: () => void;
|
|
30
|
+
resetColumns: () => void;
|
|
31
|
+
columnOrder: string[];
|
|
32
|
+
setColumnOrder: React.Dispatch<React.SetStateAction<string[]>>;
|
|
33
|
+
pagination: any;
|
|
34
|
+
minResizeWidth?: number;
|
|
35
|
+
effectiveVirtualized: boolean;
|
|
36
|
+
virtualizedRange: {
|
|
37
|
+
offsetY: number;
|
|
38
|
+
startIndex: number;
|
|
39
|
+
endIndex: number;
|
|
40
|
+
};
|
|
41
|
+
resolvedRowHeight: number;
|
|
42
|
+
visibleData: any[];
|
|
43
|
+
isRowSelectable?: (row: GridRow) => boolean;
|
|
44
|
+
handleRowSelect: (rowId: string | number, isSelected: boolean) => void;
|
|
45
|
+
rowStyle?: any;
|
|
46
|
+
globalFilter: string;
|
|
47
|
+
onContextMenu?: any;
|
|
48
|
+
onRowDoubleClick?: any;
|
|
49
|
+
onRowClick?: any;
|
|
50
|
+
onCellClick?: any;
|
|
51
|
+
onCellContextMenu?: any;
|
|
52
|
+
isCellFocused: (rowId: string | number, columnKey: string) => boolean;
|
|
53
|
+
isCellSelected: (rowId: string | number, columnKey: string) => boolean;
|
|
54
|
+
handleCellMouseDown: any;
|
|
55
|
+
handleCellMouseEnter: any;
|
|
56
|
+
contextMenuItems?: any;
|
|
57
|
+
getRowId?: any;
|
|
58
|
+
isEditing: (rowId: string | number, columnKey: string) => boolean;
|
|
59
|
+
startEdit: any;
|
|
60
|
+
commitEdit: any;
|
|
61
|
+
cancelEdit: any;
|
|
62
|
+
editingCell: any;
|
|
63
|
+
safeGetRowId: (r: any) => string | number;
|
|
64
|
+
toggleGroupExpansion: (groupKey: string) => void;
|
|
65
|
+
containerWidth: number;
|
|
66
|
+
groupConfig: any;
|
|
67
|
+
columns: GridColumn[];
|
|
68
|
+
renderGroupActions?: any;
|
|
69
|
+
groupFooterVariant: "chips" | "columns";
|
|
70
|
+
isValidLicense: boolean;
|
|
71
|
+
infiniteScroll: any;
|
|
72
|
+
sentinelRef: RefObject<HTMLDivElement>;
|
|
73
|
+
loading: boolean;
|
|
74
|
+
showLoader: boolean;
|
|
75
|
+
finishingLoader: boolean;
|
|
76
|
+
loaderTop: number;
|
|
77
|
+
noDataMessage?: string;
|
|
78
|
+
noDataRenderer?: any;
|
|
79
|
+
handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
80
|
+
cellSelectionEnabled: boolean;
|
|
81
|
+
}
|
|
82
|
+
export declare const GridBodyContainer: React.FC<GridBodyContainerProps>;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
interface GridFooterContainerProps {
|
|
3
|
+
hasFooterAggregate: boolean;
|
|
4
|
+
footerScrollRef: RefObject<HTMLDivElement>;
|
|
5
|
+
forwardWheelToBody: (e: React.WheelEvent) => void;
|
|
6
|
+
totalWidth: number;
|
|
7
|
+
selectable: boolean;
|
|
8
|
+
resolvedRowHeight: number;
|
|
9
|
+
columnsWithWidths: any[];
|
|
10
|
+
flatRows: any[];
|
|
11
|
+
effectivePinnedColumns: Set<string>;
|
|
12
|
+
infiniteScroll: any;
|
|
13
|
+
paginationConfig: any;
|
|
14
|
+
isServerLoading: boolean;
|
|
15
|
+
selectedRowsCount: number;
|
|
16
|
+
data: any[];
|
|
17
|
+
filteredData: any[];
|
|
18
|
+
pagination: any;
|
|
19
|
+
handlePageChange: (page: number) => void;
|
|
20
|
+
handlePageSizeChange: (pageSize: number) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const GridFooterContainer: React.FC<GridFooterContainerProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { ChangeEvent } from "react";
|
|
2
|
+
import type { GridColumn, ColumnFilterValue, Density } from "../types";
|
|
3
|
+
interface GridToolbarContainerProps {
|
|
4
|
+
showToolbar: boolean;
|
|
5
|
+
filterable: boolean;
|
|
6
|
+
globalFilter: string;
|
|
7
|
+
filteredDataLength: number;
|
|
8
|
+
totalDataLength: number;
|
|
9
|
+
paginationMode?: "client" | "server";
|
|
10
|
+
selectedRowsCount: number;
|
|
11
|
+
showExport: boolean;
|
|
12
|
+
columns: GridColumn[];
|
|
13
|
+
columnFilters: Record<string, ColumnFilterValue | null>;
|
|
14
|
+
columnVisibility: Record<string, boolean>;
|
|
15
|
+
onResetColumns: () => void;
|
|
16
|
+
exportOptions: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
formats: any[];
|
|
19
|
+
filename: string;
|
|
20
|
+
onExport: (format: any, exportSelected: boolean) => void;
|
|
21
|
+
};
|
|
22
|
+
toolbarLeft?: React.ReactNode;
|
|
23
|
+
toolbarRight?: React.ReactNode;
|
|
24
|
+
onGlobalFilterChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
25
|
+
onClearFilters: () => void;
|
|
26
|
+
onColumnFilter: (columnKey: string, filter: ColumnFilterValue | null) => void;
|
|
27
|
+
onColumnVisibilityChange: (columnKey: string, visible: boolean) => void;
|
|
28
|
+
columnOrder: string[];
|
|
29
|
+
onColumnOrderChange: (order: string[]) => void;
|
|
30
|
+
pinnedColumns: Set<string>;
|
|
31
|
+
onScrollToColumn: (columnKey: string) => void;
|
|
32
|
+
density: Density;
|
|
33
|
+
onDensityChange: (density: Density) => void;
|
|
34
|
+
showDensityControl: boolean;
|
|
35
|
+
groupable: boolean;
|
|
36
|
+
groupBarVisibility: "auto" | "visible" | "hidden";
|
|
37
|
+
groupConfig: {
|
|
38
|
+
columnKeys: string[];
|
|
39
|
+
expanded: Set<string>;
|
|
40
|
+
};
|
|
41
|
+
removeGroupKey: (key: string) => void;
|
|
42
|
+
setGroupKeys: (keys: string[]) => void;
|
|
43
|
+
addGroupKey: (key: string) => void;
|
|
44
|
+
collapseAllGroups: () => void;
|
|
45
|
+
expandAllGroups: () => void;
|
|
46
|
+
}
|
|
47
|
+
export declare const GridToolbarContainer: React.FC<GridToolbarContainerProps>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Column {
|
|
2
|
+
key: string;
|
|
3
|
+
header: string;
|
|
4
|
+
}
|
|
5
|
+
interface UseColumnDnDProps {
|
|
6
|
+
columns: Column[];
|
|
7
|
+
columnOrder: string[];
|
|
8
|
+
pinnedColumns?: Set<string>;
|
|
9
|
+
onColumnOrderChange?: (order: string[]) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* useColumnDnD
|
|
13
|
+
*
|
|
14
|
+
* Encapsulates the drag-and-drop logic for reordering columns within the toolbar menu.
|
|
15
|
+
* Previously, this logic was mixed with the rendering and menu state in SearchToolbar.tsx.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useColumnDnD({ columns, columnOrder, pinnedColumns, onColumnOrderChange, }: UseColumnDnDProps): {
|
|
18
|
+
draggingKey: string;
|
|
19
|
+
dragOver: {
|
|
20
|
+
key: string;
|
|
21
|
+
position: "before" | "after";
|
|
22
|
+
};
|
|
23
|
+
handleDragStart: (columnKey: string, e: React.DragEvent) => void;
|
|
24
|
+
handleDragOver: (targetKey: string, e: React.DragEvent) => void;
|
|
25
|
+
handleDrop: (targetKey: string) => void;
|
|
26
|
+
handleDragEnd: () => void;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useToolbarMenus
|
|
3
|
+
*
|
|
4
|
+
* Manages the visibility of various popover menus in the grid toolbar.
|
|
5
|
+
* Includes logic to close menus when clicking outside and handle specific cases like MUI DatePickers.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useToolbarMenus(): {
|
|
8
|
+
showExportMenu: boolean;
|
|
9
|
+
setShowExportMenu: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
+
showFilters: boolean;
|
|
11
|
+
setShowFilters: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
12
|
+
showBulkActionsMenu: boolean;
|
|
13
|
+
setShowBulkActionsMenu: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
14
|
+
showColumnMenu: boolean;
|
|
15
|
+
setShowColumnMenu: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
16
|
+
showSettingsMenu: boolean;
|
|
17
|
+
setShowSettingsMenu: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
18
|
+
exportMenuRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
19
|
+
bulkActionsRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
20
|
+
columnMenuRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
21
|
+
filtersMenuRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
22
|
+
settingsMenuRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
23
|
+
exportAnchorRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
24
|
+
bulkActionsAnchorRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
25
|
+
columnAnchorRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
26
|
+
filtersAnchorRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
27
|
+
settingsAnchorRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
28
|
+
closeAllMenus: () => void;
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GridRow, GridColumn, ActiveFilters, ColumnFilterValue } from "../types";
|
|
2
|
+
interface UseAdvancedFilteringProps {
|
|
3
|
+
data: GridRow[];
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
}
|
|
6
|
+
export declare const useAdvancedFiltering: ({ data, columns, }: UseAdvancedFilteringProps) => {
|
|
7
|
+
globalFilter: string;
|
|
8
|
+
setGlobalFilter: (value: string) => void;
|
|
9
|
+
columnFilters: ActiveFilters;
|
|
10
|
+
filteredData: GridRow[];
|
|
11
|
+
setColumnFilter: (columnKey: string, filter: ColumnFilterValue | null) => void;
|
|
12
|
+
clearColumnFilter: (columnKey: string) => void;
|
|
13
|
+
clearAllFilters: () => void;
|
|
14
|
+
getActiveFilterCount: () => number;
|
|
15
|
+
/** True while a filter transition is in-flight — use to show a loading indicator */
|
|
16
|
+
isFilterPending: boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import type { CellFocusParams, CellSelectionPayload, CopyCellsPayload } from "../types";
|
|
3
|
+
interface CellCoord {
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
colIndex: number;
|
|
6
|
+
}
|
|
7
|
+
interface FocusedCell {
|
|
8
|
+
rowId: string | number;
|
|
9
|
+
columnKey: string;
|
|
10
|
+
}
|
|
11
|
+
interface DragOverlay {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
rows: number;
|
|
15
|
+
cols: number;
|
|
16
|
+
}
|
|
17
|
+
interface UseCellSelectionProps {
|
|
18
|
+
cellFocusEnabled: boolean;
|
|
19
|
+
cellSelectionEnabled: boolean;
|
|
20
|
+
canSelectCell: (row: any, column: any) => boolean;
|
|
21
|
+
flatRows: any[];
|
|
22
|
+
columnsWithWidths: any[];
|
|
23
|
+
rowIndexById: Map<string | number, number>;
|
|
24
|
+
colIndexByKey: Map<string, number>;
|
|
25
|
+
rowById: Map<string | number, any>;
|
|
26
|
+
colByKey: Map<string, any>;
|
|
27
|
+
scrollRef: RefObject<HTMLDivElement>;
|
|
28
|
+
headerScrollRef: RefObject<HTMLDivElement>;
|
|
29
|
+
resolvedRowHeight: number;
|
|
30
|
+
selectable: boolean;
|
|
31
|
+
onCellFocusChange?: (params: CellFocusParams) => void;
|
|
32
|
+
onCellSelectionChange?: (payload: CellSelectionPayload) => void;
|
|
33
|
+
onCopyCells?: (payload: CopyCellsPayload) => void;
|
|
34
|
+
/** Stable column keys used to avoid dep on full column objects in effects */
|
|
35
|
+
columnKeys: string[];
|
|
36
|
+
/** Mirrors the grid-level getRowId — needed so focus/selection uses the correct key. */
|
|
37
|
+
getRowId?: (row: any) => string | number;
|
|
38
|
+
}
|
|
39
|
+
export interface UseCellSelectionReturn {
|
|
40
|
+
focusedCell: FocusedCell | null;
|
|
41
|
+
selectionAnchor: CellCoord | null;
|
|
42
|
+
selectionEnd: CellCoord | null;
|
|
43
|
+
dragOverlay: DragOverlay | null;
|
|
44
|
+
isCellSelected: (rowId: string | number, columnKey: string) => boolean;
|
|
45
|
+
isCellFocused: (rowId: string | number, columnKey: string) => boolean;
|
|
46
|
+
handleCellMouseDown: (params: {
|
|
47
|
+
row: any;
|
|
48
|
+
column: any;
|
|
49
|
+
event: any;
|
|
50
|
+
}) => void;
|
|
51
|
+
handleCellMouseEnter: (params: {
|
|
52
|
+
row: any;
|
|
53
|
+
column: any;
|
|
54
|
+
event: any;
|
|
55
|
+
}) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Owns the entire cell focus + rectangular selection subsystem:
|
|
59
|
+
* - State: focusedCell, selectionAnchor, selectionEnd, dragOverlay
|
|
60
|
+
* - Mouse handlers: handleCellMouseDown, handleCellMouseEnter
|
|
61
|
+
* - Global effects: mouseup, mousemove, Shift+Arrow, keyboard focus nav
|
|
62
|
+
* - Auto-scroll RAF loop while dragging near scroll container edges
|
|
63
|
+
* - Ctrl/Cmd+C copy handler (Excel-compatible TSV output)
|
|
64
|
+
* - onCellSelectionChange callback (de-duped via signature ref)
|
|
65
|
+
*/
|
|
66
|
+
export declare const useCellSelection: ({ cellFocusEnabled, cellSelectionEnabled, canSelectCell, flatRows, columnsWithWidths, rowIndexById, colIndexByKey, rowById, colByKey, scrollRef, headerScrollRef, resolvedRowHeight, selectable, onCellFocusChange, onCellSelectionChange, onCopyCells, columnKeys, getRowId, }: UseCellSelectionProps) => UseCellSelectionReturn;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { GridColumn, GridRow, ColumnConfig, ColumnFilterValue, Density, SortConfig } from "../types";
|
|
3
|
+
interface UseColumnStateProps {
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
data: GridRow[];
|
|
6
|
+
initialColumnConfig?: Partial<ColumnConfig>;
|
|
7
|
+
onColumnConfigChange?: (config: ColumnConfig) => void;
|
|
8
|
+
setSortConfig: (config: SortConfig) => void;
|
|
9
|
+
setGroupKeys: (keys: string[]) => void;
|
|
10
|
+
setDensity: (density: Density) => void;
|
|
11
|
+
setGlobalFilter: (value: string) => void;
|
|
12
|
+
setColumnFilter: (key: string, filter: ColumnFilterValue) => void;
|
|
13
|
+
sortConfig: SortConfig;
|
|
14
|
+
groupConfig: {
|
|
15
|
+
columnKeys: string[];
|
|
16
|
+
};
|
|
17
|
+
globalFilter: string;
|
|
18
|
+
columnFilters: Record<string, ColumnFilterValue | null>;
|
|
19
|
+
density: Density;
|
|
20
|
+
containerWidth: number;
|
|
21
|
+
selectable: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface UseColumnStateReturn {
|
|
24
|
+
columnWidths: Record<string, number>;
|
|
25
|
+
columnOrder: string[];
|
|
26
|
+
pinnedColumns: Set<string>;
|
|
27
|
+
columnVisibility: Record<string, boolean>;
|
|
28
|
+
columnsWithWidths: any[];
|
|
29
|
+
pinnedAll: any[];
|
|
30
|
+
unpinnedAll: any[];
|
|
31
|
+
effectivePinnedColumns: Set<string>;
|
|
32
|
+
handleColumnResize: (columnKey: string, width: number) => void;
|
|
33
|
+
handleColumnPin: (columnKey: string, pinned: boolean) => void;
|
|
34
|
+
handleColumnVisibilityChange: (columnKey: string, visible: boolean) => void;
|
|
35
|
+
setColumnOrder: React.Dispatch<React.SetStateAction<string[]>>;
|
|
36
|
+
autosizeColumn: (columnKey: string) => void;
|
|
37
|
+
autosizeAllColumns: () => void;
|
|
38
|
+
resetColumns: () => void;
|
|
39
|
+
setColumnWidths: React.Dispatch<React.SetStateAction<Record<string, number>>>;
|
|
40
|
+
setPinnedColumns: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
41
|
+
setColumnVisibility: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Owns all column configuration state:
|
|
45
|
+
* - Column widths, order, pinning, visibility
|
|
46
|
+
* - Autosize (canvas-based measureText, with heuristic fallback)
|
|
47
|
+
* - Column config hydration from `initialColumnConfig` on mount
|
|
48
|
+
* - Debounced `onColumnConfigChange` emission
|
|
49
|
+
* - Calculation of resolved columnsWithWidths including flex-grow
|
|
50
|
+
*/
|
|
51
|
+
export declare const useColumnState: ({ columns, data, initialColumnConfig, onColumnConfigChange, setSortConfig, setGroupKeys, setDensity, setGlobalFilter, setColumnFilter, sortConfig, groupConfig, globalFilter, columnFilters, density, containerWidth, selectable, }: UseColumnStateProps) => UseColumnStateReturn;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type SortCfg = {
|
|
2
|
+
key: string;
|
|
3
|
+
direction: "asc" | "desc";
|
|
4
|
+
} | null;
|
|
5
|
+
/** Lazily-created worker singleton per hook instance. */
|
|
6
|
+
export declare function useDataWorker(options?: {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}): {
|
|
9
|
+
process: (rows: any[], sort: SortCfg) => Promise<any[]>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|