react-base-data-table 0.4.0 → 0.5.2
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 +14 -0
- package/dist/index.cjs.js +37 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +18748 -9955
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/BaseIcon.d.ts +11 -0
- package/dist/types/components/BaseTable/BaseTable.d.ts +13 -1
- package/dist/types/components/BaseTable/BaseTableRow.d.ts +1 -0
- package/dist/types/components/BaseTable/CustomRenderItem.d.ts +1 -0
- package/dist/types/components/BaseTable/contextMenu/actions/cellActions.d.ts +2 -1
- package/dist/types/components/BaseTable/contexts/useTableInteractionContext.d.ts +6 -49
- package/dist/types/components/BaseTable/dialogs/columnsDialog/ChartDialog.d.ts +7 -0
- package/dist/types/components/BaseTable/hooks/useTableInteractions.d.ts +20 -4
- package/dist/types/components/BaseTable/models/AdvancedTableSettings.d.ts +5 -1
- package/dist/types/components/BaseTable/models/BaseTableHeaders.d.ts +1 -1
- package/dist/types/components/BaseTable/models/DialogItem.d.ts +6 -0
- package/dist/types/components/BaseTable/tableCell/BaseTableCell.d.ts +1 -1
- package/dist/types/components/BaseTable/tableCell/baseTableCellFunctions.d.ts +16 -0
- package/dist/types/components/BaseTable/tableCell/cellImplementation/ListCell.d.ts +1 -1
- package/dist/types/components/BaseTable/tableCell/cellImplementation/NumberCell.d.ts +1 -1
- package/dist/types/components/BaseTable/tableFunctions/CellSelection.d.ts +2 -0
- package/dist/types/stores/clipboardStore.d.ts +24 -0
- package/dist/types/stores/dialogsStore.d.ts +2 -2
- package/dist/types/stores/tableSelectionStore.d.ts +4 -0
- package/dist/types/utils/cellCoordinates.d.ts +3 -0
- package/dist/types/utils/cellOverlapping.d.ts +6 -0
- package/package.json +3 -1
- package/dist/types/components/BaseTable/hooks/useTableData.d.ts +0 -19
- package/dist/types/components/BaseTable/hooks/useTableFiltering.d.ts +0 -13
- package/dist/types/components/BaseTable/hooks/useTableSorting.d.ts +0 -13
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type CellCoordinate from "../models/CellCordinate";
|
|
2
2
|
import type TableItem from "../models/TableItem";
|
|
3
3
|
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
4
|
+
type ArrowKey = "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight";
|
|
4
5
|
declare const calculateSelectedCellAndExpandedSelection: (e: React.KeyboardEvent, selectedCell: CellCoordinate | undefined, expandedSelection: CellCoordinate[], columnsCount: number, rowsCount: number, processedLeafHeaders: BaseTableHeader[], selectedItem?: TableItem) => {
|
|
5
6
|
newSelectedCell: CellCoordinate | undefined;
|
|
6
7
|
newExpandedSelection: CellCoordinate[];
|
|
7
8
|
};
|
|
9
|
+
export declare function expandSelectionWithArrow(selectedCell: CellCoordinate | undefined, expandedSelection: CellCoordinate[], arrowKey: ArrowKey): CellCoordinate[];
|
|
8
10
|
export default calculateSelectedCellAndExpandedSelection;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface ClipboardState {
|
|
2
|
+
clipboardData: {
|
|
3
|
+
value: any;
|
|
4
|
+
headerId: string;
|
|
5
|
+
}[];
|
|
6
|
+
actions: {
|
|
7
|
+
setClipboardData: (data: {
|
|
8
|
+
value: any;
|
|
9
|
+
headerId: string;
|
|
10
|
+
}[]) => void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const useClipboardStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ClipboardState>>;
|
|
14
|
+
export declare const useClipboardData: () => {
|
|
15
|
+
value: any;
|
|
16
|
+
headerId: string;
|
|
17
|
+
}[];
|
|
18
|
+
export declare const useClipboardActions: () => {
|
|
19
|
+
setClipboardData: (data: {
|
|
20
|
+
value: any;
|
|
21
|
+
headerId: string;
|
|
22
|
+
}[]) => void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -5,7 +5,7 @@ interface DialogsState {
|
|
|
5
5
|
openDialog: (position: {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
8
|
-
}, title: string, dialogImplementation: React.ReactNode) => void;
|
|
8
|
+
}, title: string, iconPath: string | undefined, iconColor: string | undefined, dialogImplementation: React.ReactNode) => void;
|
|
9
9
|
closeDialog: (dialogId: string) => void;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
@@ -15,7 +15,7 @@ export declare const useDialogsActions: () => {
|
|
|
15
15
|
openDialog: (position: {
|
|
16
16
|
x: number;
|
|
17
17
|
y: number;
|
|
18
|
-
}, title: string, dialogImplementation: React.ReactNode) => void;
|
|
18
|
+
}, title: string, iconPath: string | undefined, iconColor: string | undefined, dialogImplementation: React.ReactNode) => void;
|
|
19
19
|
closeDialog: (dialogId: string) => void;
|
|
20
20
|
};
|
|
21
21
|
export {};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type CellCoordinate from "../components/BaseTable/models/CellCordinate";
|
|
2
2
|
interface TableSelectionState {
|
|
3
|
+
selectedHeaderIds: string[];
|
|
3
4
|
selectedCell?: CellCoordinate;
|
|
4
5
|
expandedSelection: CellCoordinate[];
|
|
5
6
|
actions: {
|
|
7
|
+
setSelectedHeaderIds: (headerIds: string[]) => void;
|
|
6
8
|
setSelectedCell: (cell?: CellCoordinate) => void;
|
|
7
9
|
setExpandedSelection: (cells: CellCoordinate[]) => void;
|
|
8
10
|
clearSelection: () => void;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
export declare const useTableSelectionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TableSelectionState>>;
|
|
14
|
+
export declare const useSelectedHeaderIds: () => string[];
|
|
12
15
|
export declare const useSelectedCell: () => CellCoordinate | undefined;
|
|
13
16
|
export declare const useExpandedSelection: () => CellCoordinate[];
|
|
14
17
|
export declare const useSelectionActions: () => {
|
|
18
|
+
setSelectedHeaderIds: (headerIds: string[]) => void;
|
|
15
19
|
setSelectedCell: (cell?: CellCoordinate) => void;
|
|
16
20
|
setExpandedSelection: (cells: CellCoordinate[]) => void;
|
|
17
21
|
clearSelection: () => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type CellCoordinate from "../components/BaseTable/models/CellCordinate";
|
|
2
|
+
export declare const isSameCellCoordinate: (cellA: CellCoordinate, cellB?: CellCoordinate) => boolean;
|
|
3
|
+
export declare const mergeCellCoordinatesWithoutDuplicates: (cellsA: CellCoordinate[], cellsB: CellCoordinate[]) => CellCoordinate[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-base-data-table",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -71,6 +71,8 @@
|
|
|
71
71
|
"@dnd-kit/core": "^6.3.1",
|
|
72
72
|
"@dnd-kit/sortable": "^10.0.0",
|
|
73
73
|
"@tanstack/react-virtual": "^3.13.12",
|
|
74
|
+
"chart.js": "^4.5.1",
|
|
75
|
+
"react-chartjs-2": "^5.3.1",
|
|
74
76
|
"react-color": "^2.19.3",
|
|
75
77
|
"zustand": "^5.0.8"
|
|
76
78
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type TableItem from "../models/TableItem";
|
|
2
|
-
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
3
|
-
import type ActiveTableFilter from "../models/ActiveTableFilter";
|
|
4
|
-
interface UseTableDataReturn {
|
|
5
|
-
activeFilters: ActiveTableFilter[];
|
|
6
|
-
setActiveFilters: (filters: ActiveTableFilter[]) => void;
|
|
7
|
-
clearActiveFilters: () => void;
|
|
8
|
-
setActiveTableFilter: (headerId: string, itemsToHide: string[] | number[]) => void;
|
|
9
|
-
filterItemsCache: Record<string, (string | number)[]>;
|
|
10
|
-
currentSortId: string | undefined;
|
|
11
|
-
setCurrentSortId: (id: string | undefined) => void;
|
|
12
|
-
ascendingOrder: boolean;
|
|
13
|
-
setAscendingOrder: (ascending: boolean) => void;
|
|
14
|
-
onResetSort: () => void;
|
|
15
|
-
onSortByColumn: (header: BaseTableHeader | undefined) => void;
|
|
16
|
-
processedItems: TableItem[];
|
|
17
|
-
}
|
|
18
|
-
export default function useTableData(items: TableItem[], headers: BaseTableHeader[], initialFilters?: ActiveTableFilter[], initialSortId?: string, onSortCallback?: (columnId: string) => void): UseTableDataReturn;
|
|
19
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type ActiveTableFilter from "../models/ActiveTableFilter";
|
|
2
|
-
import type TableItem from "../models/TableItem";
|
|
3
|
-
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
4
|
-
interface UseTableFilteringReturn {
|
|
5
|
-
activeFilters: ActiveTableFilter[];
|
|
6
|
-
setActiveFilters: (filters: ActiveTableFilter[]) => void;
|
|
7
|
-
clearActiveFilters: () => void;
|
|
8
|
-
setActiveTableFilter: (headerId: string, itemsToHide: string[] | number[]) => void;
|
|
9
|
-
filteredItems: TableItem[];
|
|
10
|
-
filterItemsCache: Record<string, (string | number)[]>;
|
|
11
|
-
}
|
|
12
|
-
export default function useTableFiltering(items: TableItem[], headers: BaseTableHeader[], initialFilters?: ActiveTableFilter[], sortedItems?: TableItem[]): UseTableFilteringReturn;
|
|
13
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
2
|
-
import type TableItem from "../models/TableItem";
|
|
3
|
-
interface UseTableSortingReturn {
|
|
4
|
-
currentSortId: string | undefined;
|
|
5
|
-
setCurrentSortId: (id: string | undefined) => void;
|
|
6
|
-
ascendingOrder: boolean;
|
|
7
|
-
setAscendingOrder: (ascending: boolean) => void;
|
|
8
|
-
onResetSort: () => void;
|
|
9
|
-
onSortByColumn: (header: BaseTableHeader | undefined) => void;
|
|
10
|
-
sortedItems: TableItem[];
|
|
11
|
-
}
|
|
12
|
-
export default function useTableSorting(items: TableItem[], headers: BaseTableHeader[], initialSortId?: string, onSortCallback?: (columnId: string) => void): UseTableSortingReturn;
|
|
13
|
-
export {};
|