react-kd-grid 1.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.
- package/README.md +270 -0
- package/dist/CustomGrid.d.ts +3 -0
- package/dist/components/ColumnFilterSelector.d.ts +18 -0
- package/dist/components/CustomSelect.d.ts +14 -0
- package/dist/components/FooterAggregate.d.ts +16 -0
- package/dist/components/GridHeader.d.ts +33 -0
- package/dist/components/GridRows.d.ts +49 -0
- package/dist/components/GroupBar.d.ts +12 -0
- package/dist/components/GroupHeader.d.ts +29 -0
- package/dist/components/NoDataMessage.d.ts +7 -0
- package/dist/components/PaginationControls.d.ts +15 -0
- package/dist/components/Popover.d.ts +17 -0
- package/dist/components/RowContextMenu.d.ts +22 -0
- package/dist/components/SearchToolbar.d.ts +79 -0
- package/dist/components/filters/BooleanFilter.d.ts +7 -0
- package/dist/components/filters/DateFilter.d.ts +9 -0
- package/dist/components/filters/FilterContent.d.ts +9 -0
- package/dist/components/filters/FilterPopup.d.ts +2 -0
- package/dist/components/filters/MultiselectFilter.d.ts +10 -0
- package/dist/components/filters/NumberFilter.d.ts +9 -0
- package/dist/components/filters/TextFilter.d.ts +8 -0
- package/dist/components/filters/index.d.ts +6 -0
- package/dist/components/ui/DatePicker.d.ts +10 -0
- package/dist/constants.d.ts +1 -0
- package/dist/hooks/useAdvancedFiltering.d.ts +16 -0
- package/dist/hooks/useDataWorker.d.ts +10 -0
- package/dist/hooks/useExport.d.ts +15 -0
- package/dist/hooks/useFilteringAndSorting.d.ts +16 -0
- package/dist/hooks/useGrouping.d.ts +28 -0
- package/dist/hooks/usePagination.d.ts +28 -0
- package/dist/hooks/useSelection.d.ts +13 -0
- package/dist/hooks/useVirtualization.d.ts +17 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.esm.js +10776 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +10776 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +421 -0
- package/dist/utils/highlightText.d.ts +15 -0
- package/dist/workers/dataWorker.d.ts +16 -0
- package/package.json +90 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DatePickerProps {
|
|
3
|
+
name?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string | null;
|
|
6
|
+
onChange: (value: string | null) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DatePicker: React.FC<DatePickerProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SELECT_COL_WIDTH = 48;
|
|
@@ -0,0 +1,16 @@
|
|
|
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: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
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
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GridRow, GridColumn } from "../types";
|
|
2
|
+
export type ExportFormat = "csv" | "json" | "xlsx";
|
|
3
|
+
interface UseExportProps {
|
|
4
|
+
data: GridRow[];
|
|
5
|
+
columns: GridColumn[];
|
|
6
|
+
selectedRows?: Set<string | number>;
|
|
7
|
+
filename?: string;
|
|
8
|
+
columnVisibility?: Record<string, boolean>;
|
|
9
|
+
}
|
|
10
|
+
export declare const useExport: ({ data, columns, selectedRows, filename, columnVisibility, }: UseExportProps) => {
|
|
11
|
+
exportData: (format: ExportFormat, exportSelected?: boolean) => void;
|
|
12
|
+
canExportSelected: boolean;
|
|
13
|
+
selectedCount: number;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChangeEvent } from "react";
|
|
2
|
+
import { SortConfig, GridRow, GridColumn } from "../types";
|
|
3
|
+
interface UseFilteringAndSortingProps {
|
|
4
|
+
data: GridRow[];
|
|
5
|
+
columns: GridColumn[];
|
|
6
|
+
}
|
|
7
|
+
export declare const useFilteringAndSorting: ({ data, columns, }: UseFilteringAndSortingProps) => {
|
|
8
|
+
sortConfig: SortConfig;
|
|
9
|
+
filters: Record<string, string>;
|
|
10
|
+
globalFilter: string;
|
|
11
|
+
filteredData: GridRow[];
|
|
12
|
+
handleSort: (key: string) => void;
|
|
13
|
+
handleFilter: (key: string, value: string) => void;
|
|
14
|
+
handleGlobalFilterChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GridRow, GroupConfig, GridColumn } from "../types";
|
|
2
|
+
interface UseGroupingProps {
|
|
3
|
+
data: GridRow[];
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
}
|
|
6
|
+
export declare const useGrouping: ({ data, columns }: UseGroupingProps) => {
|
|
7
|
+
groupConfig: GroupConfig;
|
|
8
|
+
displayData: (GridRow & {
|
|
9
|
+
_isGroupHeader?: boolean;
|
|
10
|
+
_groupKey?: string;
|
|
11
|
+
_groupCount?: number;
|
|
12
|
+
_groupLevel?: number;
|
|
13
|
+
_groupColumnKey?: string;
|
|
14
|
+
_groupValue?: string;
|
|
15
|
+
_groupRows?: GridRow[];
|
|
16
|
+
_isGroupFooter?: boolean;
|
|
17
|
+
_groupAgg?: Record<string, any>;
|
|
18
|
+
})[];
|
|
19
|
+
handleGroupBy: (columnKey: string | null) => void;
|
|
20
|
+
addGroupKey: (columnKey: string) => void;
|
|
21
|
+
removeGroupKey: (columnKey: string) => void;
|
|
22
|
+
setGroupKeys: (columnKeys: string[]) => void;
|
|
23
|
+
toggleGroupExpansion: (groupPath: string) => void;
|
|
24
|
+
expandAllGroups: () => void;
|
|
25
|
+
collapseAllGroups: () => void;
|
|
26
|
+
isGrouped: boolean;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PaginationConfig, GridRow } from "../types";
|
|
2
|
+
interface UsePaginationProps {
|
|
3
|
+
data: GridRow[];
|
|
4
|
+
pagination?: {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
mode?: "client" | "server";
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
showPageSizeSelector?: boolean;
|
|
9
|
+
pageSizeOptions?: number[];
|
|
10
|
+
serverConfig?: {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
onPageChange: (page: number, pageSize: number) => Promise<void> | void;
|
|
13
|
+
onPageSizeChange?: (pageSize: number) => Promise<void> | void;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
totalRows: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const usePagination: ({ data, pagination }: UsePaginationProps) => {
|
|
20
|
+
currentPage: number;
|
|
21
|
+
resetPage: () => void;
|
|
22
|
+
paginationConfig: PaginationConfig;
|
|
23
|
+
paginatedData: GridRow[];
|
|
24
|
+
isServerLoading: boolean;
|
|
25
|
+
handlePageChange: (page: number) => Promise<void>;
|
|
26
|
+
handlePageSizeChange: (newPageSize: number) => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GridRow } from "../types";
|
|
2
|
+
interface UseSelectionProps {
|
|
3
|
+
data: GridRow[];
|
|
4
|
+
selectedRowIds?: Iterable<string | number> | null;
|
|
5
|
+
onRowSelect?: (row: GridRow) => void;
|
|
6
|
+
getRowId?: (row: GridRow) => string | number;
|
|
7
|
+
}
|
|
8
|
+
export declare const useSelection: ({ data, selectedRowIds, onRowSelect, getRowId, }: UseSelectionProps) => {
|
|
9
|
+
selectedRows: Set<string | number>;
|
|
10
|
+
handleRowSelect: (rowId: string | number, isSelected: boolean) => void;
|
|
11
|
+
handleSelectAll: (isSelected: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UIEvent } from "react";
|
|
2
|
+
import { VirtualizedRange, GridRow } from "../types";
|
|
3
|
+
interface UseVirtualizationProps {
|
|
4
|
+
data: GridRow[];
|
|
5
|
+
virtualized?: boolean;
|
|
6
|
+
rowHeight?: number;
|
|
7
|
+
overscan?: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const useVirtualization: ({ data, virtualized, rowHeight, overscan, height, }: UseVirtualizationProps) => {
|
|
11
|
+
scrollRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
12
|
+
virtualizedRange: VirtualizedRange;
|
|
13
|
+
visibleData: GridRow[];
|
|
14
|
+
totalHeight: number;
|
|
15
|
+
handleScroll: (e: UIEvent<HTMLDivElement>) => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as CustomDataGrid } from "./CustomGrid";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export { usePagination } from "./hooks/usePagination";
|
|
4
|
+
export { useVirtualization } from "./hooks/useVirtualization";
|
|
5
|
+
export { useFilteringAndSorting } from "./hooks/useFilteringAndSorting";
|
|
6
|
+
export { useSelection } from "./hooks/useSelection";
|
|
7
|
+
export { PaginationControls } from "./components/PaginationControls";
|
|
8
|
+
export { GridHeader } from "./components/GridHeader";
|
|
9
|
+
export { GridRows } from "./components/GridRows";
|
|
10
|
+
export { SearchToolbar } from "./components/SearchToolbar";
|
|
11
|
+
export { FooterAggregate } from "./components/FooterAggregate";
|