react-base-data-table 0.5.12 → 0.5.13
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/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -7
- package/dist/index.es.js.map +1 -1
- package/dist/types/components/BaseTable/contexts/useTableInteractionContext.d.ts +2 -2
- package/dist/types/components/BaseTable/hooks/useRowDragDrop.d.ts +2 -3
- package/dist/types/components/BaseTable/hooks/useTableInteractions.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useTableInteractions, type TableInteractionsProps } from "../hooks/useTableInteractions";
|
|
2
2
|
import type TableItem from "../models/TableItem";
|
|
3
3
|
import { useRowDragDrop } from "../hooks/useRowDragDrop";
|
|
4
|
-
type TableInteractionContextValue<T
|
|
5
|
-
export declare const TableInteractionProvider: <T
|
|
4
|
+
type TableInteractionContextValue<T> = ReturnType<typeof useTableInteractions<T>> & ReturnType<typeof useRowDragDrop<T>>;
|
|
5
|
+
export declare const TableInteractionProvider: <T>({ children, groupedItemsEntries, onChange, onBulkChange, onBulkFieldChange, onRowDoubleClick, onRowsReordered, onSaveComment, onDeleteComment, onSetHighlightCondition, onRemoveHighlightCondition, onAddListOption, }: TableInteractionsProps<T> & {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
} & {
|
|
8
8
|
onRowsReordered?: ((fromIndex: number, toIndex: number) => void) | undefined;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
interface UseRowDragDropProps<T extends TableItem> {
|
|
1
|
+
interface UseRowDragDropProps<T> {
|
|
3
2
|
items: T[];
|
|
4
3
|
onRowsReordered?: (fromIndex: number, toIndex: number, draggedItem: T, targetItem: T) => void;
|
|
5
4
|
groupBy?: string;
|
|
6
5
|
}
|
|
7
|
-
export declare const useRowDragDrop: <T
|
|
6
|
+
export declare const useRowDragDrop: <T>({ items, onRowsReordered, groupBy, }: UseRowDragDropProps<T>) => {
|
|
8
7
|
draggedRowIndex: number | null;
|
|
9
8
|
dropTargetIndex: number | null;
|
|
10
9
|
isDraggingRow: boolean;
|
|
@@ -4,7 +4,7 @@ import type TableItem from "../models/TableItem";
|
|
|
4
4
|
import type CellCoordinate from "../models/CellCordinate";
|
|
5
5
|
import type HighlightCondition from "../models/HighlightCondition";
|
|
6
6
|
import type CommentData from "../models/CommentData";
|
|
7
|
-
export interface TableInteractionsProps<T
|
|
7
|
+
export interface TableInteractionsProps<T> {
|
|
8
8
|
items: TableItem[];
|
|
9
9
|
groupedItemsEntries?: [string, {
|
|
10
10
|
rowIndex: number;
|
|
@@ -34,7 +34,7 @@ export interface TableInteractionsProps<T extends TableItem> {
|
|
|
34
34
|
onRemoveHighlightCondition?: (highlightCondition: HighlightCondition, cssPropertyToRemove: keyof CSSProperties, item: T) => Promise<void> | void;
|
|
35
35
|
onAddListOption?: (newOption: string, header: BaseTableHeader) => Promise<void> | void;
|
|
36
36
|
}
|
|
37
|
-
export declare function useTableInteractions<T
|
|
37
|
+
export declare function useTableInteractions<T>({ items, groupedItemsEntries, onChange, onBulkChange, onBulkFieldChange, onRowDoubleClick, onSaveComment, onDeleteComment, onSetHighlightCondition, onRemoveHighlightCondition, onAddListOption, }: TableInteractionsProps<T>): {
|
|
38
38
|
setExpandedSelection: (cells: CellCoordinate[]) => void;
|
|
39
39
|
onHeaderClick: (event: React.MouseEvent<HTMLTableCellElement>, headerId: string) => void;
|
|
40
40
|
onHeaderRightClick: (event: React.MouseEvent<HTMLTableCellElement>, headerId: string) => void;
|