react-base-data-table 0.3.8 → 0.4.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 +0 -6
- package/dist/index.cjs.js +23 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +10073 -6021
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/App.d.ts +3 -0
- package/dist/types/DUMMY_ITEMS.d.ts +6 -0
- package/dist/types/components/BaseButton.d.ts +19 -0
- package/dist/types/components/BaseCheckbox.d.ts +11 -0
- package/dist/types/components/BaseTable/BaseTable.d.ts +38 -0
- package/dist/types/components/BaseTable/BaseTableFooter.d.ts +10 -0
- package/dist/types/components/BaseTable/BaseTableGroupRow.d.ts +15 -0
- package/dist/types/components/BaseTable/BaseTableHeader.d.ts +13 -0
- package/dist/types/components/BaseTable/BaseTableHeaders.d.ts +15 -0
- package/dist/types/components/BaseTable/BaseTableRow.d.ts +11 -0
- package/dist/types/components/BaseTable/BaseTableWithContext.d.ts +3 -0
- package/dist/types/components/BaseTable/CommentPopup.d.ts +15 -0
- package/dist/types/components/BaseTable/CustomRenderItem.d.ts +11 -0
- package/dist/types/components/BaseTable/contextMenu/ContextMenu.d.ts +13 -0
- package/dist/types/components/BaseTable/contextMenu/actions/cellActions.d.ts +5 -0
- package/dist/types/components/BaseTable/contextMenu/actions/headerActions.d.ts +5 -0
- package/dist/types/components/BaseTable/contextMenu/actions/index.d.ts +2 -0
- package/dist/types/components/BaseTable/contexts/useTableInteractionContext.d.ts +54 -0
- package/dist/types/components/BaseTable/dialogs/DialogWrapper.d.ts +6 -0
- package/dist/types/components/BaseTable/dialogs/columnsDialog/ColumnsDialog.d.ts +2 -0
- package/dist/types/components/BaseTable/dialogs/columnsDialog/DragPreview.d.ts +5 -0
- package/dist/types/components/BaseTable/dialogs/columnsDialog/HeaderItem.d.ts +20 -0
- package/dist/types/components/BaseTable/hooks/useCellPopup.d.ts +16 -0
- package/dist/types/components/BaseTable/hooks/useRowDragDrop.d.ts +16 -0
- package/dist/types/components/BaseTable/hooks/useTableData.d.ts +19 -0
- package/dist/types/components/BaseTable/hooks/useTableFiltering.d.ts +13 -0
- package/dist/types/components/BaseTable/hooks/useTableGrouping.d.ts +14 -0
- package/dist/types/components/BaseTable/hooks/useTableInteractions.d.ts +43 -0
- package/dist/types/components/BaseTable/hooks/useTableSorting.d.ts +13 -0
- package/dist/types/components/BaseTable/hooks/useVirtualRows.d.ts +11 -0
- package/dist/types/components/BaseTable/models/ActiveTableFilter.d.ts +6 -0
- package/dist/types/components/BaseTable/models/AdvancedTableSettings.d.ts +19 -0
- package/dist/types/components/BaseTable/models/BaseTableHeaders.d.ts +38 -0
- package/dist/types/components/BaseTable/models/CellCordinate.d.ts +8 -0
- package/dist/types/components/BaseTable/models/CommentData.d.ts +10 -0
- package/dist/types/components/BaseTable/models/ContextMenu.d.ts +10 -0
- package/dist/types/components/BaseTable/models/ContextMenuAction.d.ts +12 -0
- package/dist/types/components/BaseTable/models/DialogItem.d.ts +9 -0
- package/dist/types/components/BaseTable/models/GroupInfo.d.ts +7 -0
- package/dist/types/components/BaseTable/models/HighlightCondition.d.ts +7 -0
- package/dist/types/components/BaseTable/models/ItemWithGroupInfo.d.ts +7 -0
- package/dist/types/components/BaseTable/models/LinkedGroup.d.ts +4 -0
- package/dist/types/components/BaseTable/models/TableConfiguration.d.ts +4 -0
- package/dist/types/components/BaseTable/models/TableItem.d.ts +4 -0
- package/dist/types/components/BaseTable/tableCell/BaseTableCell.d.ts +21 -0
- package/dist/types/components/BaseTable/tableCell/IndexCell.d.ts +8 -0
- package/dist/types/components/BaseTable/tableCell/cellImplementation/ListCell.d.ts +13 -0
- package/dist/types/components/BaseTable/tableCell/cellImplementation/NumberCell.d.ts +11 -0
- package/dist/types/components/BaseTable/tableCell/cellImplementation/OptionList.d.ts +11 -0
- package/dist/types/components/BaseTable/tableCell/cellImplementation/formatNumberFunctions.d.ts +1 -0
- package/dist/types/components/BaseTable/tableFilter/FilterDropdown.d.ts +13 -0
- package/dist/types/components/BaseTable/tableFilter/TableFilter.d.ts +17 -0
- package/dist/types/components/BaseTable/tableFilter/filterImplementations/NumberFilter/NumberConditionItem.d.ts +10 -0
- package/dist/types/components/BaseTable/tableFilter/filterImplementations/NumberFilter/NumberFilter.d.ts +16 -0
- package/dist/types/components/BaseTable/tableFilter/filterImplementations/TextFilter.d.ts +9 -0
- package/dist/types/components/BaseTable/tableFunctions/CellSelection.d.ts +8 -0
- package/dist/types/components/BaseTable/tableFunctions/FilteringAndSorting.d.ts +7 -0
- package/dist/types/components/BaseTable/tableFunctions/highlightCondition.d.ts +5 -0
- package/dist/types/components/ColorPicker.d.ts +7 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/enum/DateUnits.d.ts +8 -0
- package/dist/types/enum/FilterTypes.d.ts +4 -0
- package/dist/types/hooks/useClickOutside.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/stores/commentPopupStore.d.ts +13 -0
- package/dist/types/stores/contextMenuStore.d.ts +13 -0
- package/dist/types/stores/dialogsStore.d.ts +21 -0
- package/dist/types/stores/tableDataStore.d.ts +99 -0
- package/dist/types/stores/tableDragStore.d.ts +17 -0
- package/dist/types/stores/tableRefStore.d.ts +17 -0
- package/dist/types/stores/tableSelectionStore.d.ts +19 -0
- package/dist/types/utils/array.d.ts +6 -0
- package/dist/types/utils/cellIdCreation.d.ts +3 -0
- package/dist/types/utils/enum.d.ts +3 -0
- package/dist/types/utils/sorting.d.ts +4 -0
- package/package.json +5 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type BaseTableHeader from "../../models/BaseTableHeaders";
|
|
2
|
+
declare const HeaderItem: React.FC<{
|
|
3
|
+
header: BaseTableHeader;
|
|
4
|
+
parentId?: string;
|
|
5
|
+
idx: number;
|
|
6
|
+
depth: number;
|
|
7
|
+
hiddenColumns: string[];
|
|
8
|
+
dropIndicator?: "above" | "below";
|
|
9
|
+
dragInfo?: {
|
|
10
|
+
parentId: string | undefined;
|
|
11
|
+
fromIdx: number;
|
|
12
|
+
};
|
|
13
|
+
setDragInfo: React.Dispatch<React.SetStateAction<{
|
|
14
|
+
parentId: string | undefined;
|
|
15
|
+
fromIdx: number;
|
|
16
|
+
} | undefined>>;
|
|
17
|
+
onCheckboxChange: (headerId: string, checked: boolean) => void;
|
|
18
|
+
getAllChildrenIds: (header: BaseTableHeader) => string[];
|
|
19
|
+
}>;
|
|
20
|
+
export default HeaderItem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UsePopupParams {
|
|
2
|
+
isInteractionDisabled: () => boolean;
|
|
3
|
+
canOpenCell: () => boolean;
|
|
4
|
+
onOpen: () => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
timeoutDuration?: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseCellPopupReturn {
|
|
9
|
+
isMouseOverPopup: boolean;
|
|
10
|
+
handleMouseEnter: () => void;
|
|
11
|
+
handleMouseLeave: () => void;
|
|
12
|
+
handlePopupMouseEnter: () => void;
|
|
13
|
+
handlePopupMouseLeave: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useCellPopup({ isInteractionDisabled, canOpenCell, onOpen, onClose, timeoutDuration, }: UsePopupParams): UseCellPopupReturn;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type TableItem from "../models/TableItem";
|
|
2
|
+
interface UseRowDragDropProps {
|
|
3
|
+
items: TableItem[];
|
|
4
|
+
onRowsReordered?: (fromIndex: number, toIndex: number, draggedItem: TableItem, targetItem: TableItem) => void;
|
|
5
|
+
groupBy?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const useRowDragDrop: ({ items, onRowsReordered, groupBy, }: UseRowDragDropProps) => {
|
|
8
|
+
draggedRowIndex: number | null;
|
|
9
|
+
dropTargetIndex: number | null;
|
|
10
|
+
isDraggingRow: boolean;
|
|
11
|
+
handleRowDragStart: (index: number, tableItem: TableItem) => void;
|
|
12
|
+
handleDrop: (targetItem: TableItem) => void;
|
|
13
|
+
handleDragEnd: () => void;
|
|
14
|
+
handleRowDragOver: (index: number) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type TableItem from "../models/TableItem";
|
|
2
|
+
import type ItemWithGroupInfo from "../models/ItemWithGroupInfo";
|
|
3
|
+
import type GroupInfo from "../models/GroupInfo";
|
|
4
|
+
interface UseTableGroupingReturn {
|
|
5
|
+
groupedItemsEntries: [string, {
|
|
6
|
+
rowIndex: number;
|
|
7
|
+
item: TableItem;
|
|
8
|
+
}[]][];
|
|
9
|
+
flatGroupedItems: Array<GroupInfo | ItemWithGroupInfo>;
|
|
10
|
+
isGroupLinked: (groupName: string) => boolean;
|
|
11
|
+
getMasterGroupNameLinked: (groupName: string) => string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export default function useTableGrouping(): UseTableGroupingReturn;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
3
|
+
import type TableItem from "../models/TableItem";
|
|
4
|
+
import type CellCoordinate from "../models/CellCordinate";
|
|
5
|
+
import type HighlightCondition from "../models/HighlightCondition";
|
|
6
|
+
import type CommentData from "../models/CommentData";
|
|
7
|
+
interface UseTableInteractionsProps<T extends TableItem> {
|
|
8
|
+
items: TableItem[];
|
|
9
|
+
groupedItemsEntries?: [string, {
|
|
10
|
+
rowIndex: number;
|
|
11
|
+
item: TableItem;
|
|
12
|
+
}[]][];
|
|
13
|
+
onChange?: (itemUpdated: T, originalIndex: number, fromArrayIndex?: number) => Promise<void> | void;
|
|
14
|
+
onBulkChange?: (items: {
|
|
15
|
+
itemUpdated: T;
|
|
16
|
+
originalIndex: number;
|
|
17
|
+
}[], headerId: string) => Promise<void> | void;
|
|
18
|
+
onRowDoubleClick?: (item: T) => Promise<void> | void;
|
|
19
|
+
onSaveComment?: (comment: CommentData, item: TableItem) => Promise<void> | void;
|
|
20
|
+
onDeleteComment?: (comment: CommentData, item: TableItem) => Promise<void> | void;
|
|
21
|
+
onSetHighlightCondition?: (highlightCondition: HighlightCondition, item: TableItem) => Promise<void> | void;
|
|
22
|
+
onRemoveHighlightCondition?: (highlightCondition: HighlightCondition, cssPropertyToRemove: keyof CSSProperties, item: TableItem) => Promise<void> | void;
|
|
23
|
+
onAddListOption?: (newOption: string, header: BaseTableHeader) => Promise<void> | void;
|
|
24
|
+
}
|
|
25
|
+
export declare function useTableInteractions<T extends TableItem>({ items, groupedItemsEntries, onChange, onBulkChange, onRowDoubleClick, onSaveComment, onDeleteComment, onSetHighlightCondition, onRemoveHighlightCondition, onAddListOption, }: UseTableInteractionsProps<T>): {
|
|
26
|
+
setExpandedSelection: (cells: CellCoordinate[]) => void;
|
|
27
|
+
onCellBlur: (editValue: string | number | undefined, item: TableItem, header: BaseTableHeader, cellCoordinate: CellCoordinate) => Promise<void>;
|
|
28
|
+
onCellEnter: (editValue: string | number | undefined, item: TableItem, header: BaseTableHeader, cellCoordinate: CellCoordinate) => Promise<void>;
|
|
29
|
+
onCellClick: (cellCoordinate: CellCoordinate) => void;
|
|
30
|
+
handleCellKeyDown: (e: React.KeyboardEvent) => void;
|
|
31
|
+
handleRowDoubleClick: (item: TableItem) => Promise<void>;
|
|
32
|
+
saveCommentHandler: (comment: CommentData, item: TableItem) => Promise<void>;
|
|
33
|
+
deleteCommentHandler: (comment: CommentData, item: TableItem) => Promise<void>;
|
|
34
|
+
setHighlightCondition: (item: TableItem, headerId: string, cssStyle: React.CSSProperties) => Promise<void>;
|
|
35
|
+
removeHighlightCondition: (item: TableItem, headerId: string, cssPropertyToRemove: keyof CSSProperties) => void;
|
|
36
|
+
onCellMouseDown: (e: React.MouseEvent<HTMLTableCellElement>, cellCoordinate: CellCoordinate) => void;
|
|
37
|
+
onCellMouseEnter: (e: React.MouseEvent<HTMLTableCellElement>, _cellCoordinate: CellCoordinate) => void;
|
|
38
|
+
onMouseMove: (e: React.MouseEvent) => void;
|
|
39
|
+
onRightClick: (cellCoordinate: CellCoordinate, e: React.MouseEvent) => void;
|
|
40
|
+
addListOption: (newOption: string, header: BaseTableHeader) => Promise<void>;
|
|
41
|
+
getItemFromCellCoordinates: (cell: CellCoordinate) => TableItem | undefined;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MutableRefObject } from "react";
|
|
2
|
+
export type Props = {
|
|
3
|
+
rowsCount: number;
|
|
4
|
+
scrollRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useVirtualRows: ({ rowsCount, scrollRef }: Props) => {
|
|
7
|
+
virtualizer: import("@tanstack/virtual-core").Virtualizer<HTMLElement, Element>;
|
|
8
|
+
virtualRows: import("@tanstack/virtual-core").VirtualItem[];
|
|
9
|
+
before: number;
|
|
10
|
+
after: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default interface AdvancedTableSettings {
|
|
2
|
+
marginTop?: string;
|
|
3
|
+
noBorder?: boolean;
|
|
4
|
+
pinColumns?: boolean;
|
|
5
|
+
alignCenterInLine?: boolean;
|
|
6
|
+
currentSortId?: string;
|
|
7
|
+
contrastRow?: boolean;
|
|
8
|
+
indexUseOriginalOrder?: boolean;
|
|
9
|
+
enableRowDragDrop?: boolean;
|
|
10
|
+
currentUsername?: string;
|
|
11
|
+
showIndex?: boolean;
|
|
12
|
+
selectNewOptionOnAdd?: boolean;
|
|
13
|
+
canAddListOptions?: boolean;
|
|
14
|
+
showFooter?: boolean;
|
|
15
|
+
rowIdProperty?: string;
|
|
16
|
+
tableId?: string;
|
|
17
|
+
focusedRowIndex?: number;
|
|
18
|
+
hasContextMenu?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type TableItem from "./TableItem";
|
|
3
|
+
export declare const TableHeaderType: {
|
|
4
|
+
readonly STRING: "string";
|
|
5
|
+
readonly LIST: "list";
|
|
6
|
+
readonly NUMBER: "number";
|
|
7
|
+
};
|
|
8
|
+
export type TableHeaderType = (typeof TableHeaderType)[keyof typeof TableHeaderType];
|
|
9
|
+
export default interface BaseTableHeader {
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
hasFilter?: boolean;
|
|
13
|
+
width?: number;
|
|
14
|
+
children?: BaseTableHeader[];
|
|
15
|
+
editOptions?: {
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
isDisabled?: (item: TableItem, fromArrayData?: {
|
|
18
|
+
index: number;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
notApplicable?: (item: TableItem, fromArrayData?: {
|
|
21
|
+
index: number;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
greyedOutIfNotEditable?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
type: TableHeaderType;
|
|
26
|
+
options?: string[];
|
|
27
|
+
defaultValue?: string | number;
|
|
28
|
+
canAddNewOption?: boolean;
|
|
29
|
+
};
|
|
30
|
+
fromArray?: string;
|
|
31
|
+
sortable?: boolean;
|
|
32
|
+
align?: "left" | "center" | "right";
|
|
33
|
+
customSort?: (a: TableItem, b: TableItem, ascendingOrder: boolean) => number;
|
|
34
|
+
customHeader?: (header: BaseTableHeader) => ReactNode;
|
|
35
|
+
customRender?: (item: TableItem, header: BaseTableHeader, fromArrayData?: {
|
|
36
|
+
index: number;
|
|
37
|
+
}) => ReactNode;
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type BaseTableHeader from "./BaseTableHeaders";
|
|
2
|
+
import type CellCoordinate from "./CellCordinate";
|
|
3
|
+
import type TableItem from "./TableItem";
|
|
4
|
+
export default interface ContextMenu {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
header: BaseTableHeader;
|
|
8
|
+
item?: TableItem;
|
|
9
|
+
cellCoordinate?: CellCoordinate;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type CellCoordinate from "./CellCordinate";
|
|
2
|
+
import type TableItem from "./TableItem";
|
|
3
|
+
export default interface ContextMenuAction {
|
|
4
|
+
icon?: string;
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
onClick: (event: React.MouseEvent, item?: TableItem, itemCoordinates?: CellCoordinate) => void;
|
|
8
|
+
groupName?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
subActions?: ContextMenuAction[];
|
|
11
|
+
customRender?: () => React.ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import "./BaseTableCell.css";
|
|
3
|
+
import type TableItem from "../models/TableItem";
|
|
4
|
+
import type CommentData from "../models/CommentData";
|
|
5
|
+
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
6
|
+
export interface BaseTableCellProps {
|
|
7
|
+
header: BaseTableHeader;
|
|
8
|
+
item: TableItem;
|
|
9
|
+
rowIndex: number;
|
|
10
|
+
columnIndex: number;
|
|
11
|
+
rowSpan?: number;
|
|
12
|
+
comments?: CommentData[];
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
fromArrayData?: {
|
|
15
|
+
fromArray: string;
|
|
16
|
+
index: number;
|
|
17
|
+
};
|
|
18
|
+
isInLinkedGroup: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const BaseTableCell: React.FC<BaseTableCellProps>;
|
|
21
|
+
export default BaseTableCell;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type BaseTableHeader from "../../models/BaseTableHeaders";
|
|
2
|
+
interface ListCellProps {
|
|
3
|
+
inputRef: React.Ref<HTMLInputElement> | null;
|
|
4
|
+
header: BaseTableHeader;
|
|
5
|
+
value?: string;
|
|
6
|
+
options: string[];
|
|
7
|
+
onSelect: (value: string) => void;
|
|
8
|
+
onEnter: (value: string) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hideOptions?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export default function ListCell(props: Readonly<ListCellProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface NumberCellProps {
|
|
2
|
+
id: string;
|
|
3
|
+
cellValue: string | number | null | undefined;
|
|
4
|
+
initialValue?: string;
|
|
5
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
6
|
+
onBlur?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default function NumberCell(props: Readonly<NumberCellProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ListCellProps {
|
|
2
|
+
onClick: (option: string, isOptionToAdd?: boolean) => void;
|
|
3
|
+
value: string;
|
|
4
|
+
text: string;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
italic?: boolean;
|
|
7
|
+
optionKey: string;
|
|
8
|
+
isOptionToAdd?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default function OptionList(props: Readonly<ListCellProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
package/dist/types/components/BaseTable/tableCell/cellImplementation/formatNumberFunctions.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatNumber: (value: number | string, precision?: number) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterTypes } from "../../../enum/FilterTypes";
|
|
2
|
+
interface TableFilterProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
tableRef?: React.RefObject<HTMLTableElement | null>;
|
|
5
|
+
headerId: string;
|
|
6
|
+
filterType: FilterTypes;
|
|
7
|
+
items: string[] | number[];
|
|
8
|
+
filterButtonRef: React.RefObject<HTMLButtonElement | null>;
|
|
9
|
+
wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
10
|
+
onShowOrHide: (show: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function FilterDropdown(props: Readonly<TableFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default FilterDropdown;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterTypes } from "../../../enum/FilterTypes";
|
|
2
|
+
import type ActiveTableFilter from "../models/ActiveTableFilter";
|
|
3
|
+
import type { NumberCondition } from "./filterImplementations/NumberFilter/NumberFilter";
|
|
4
|
+
interface TableFilterProps {
|
|
5
|
+
show: boolean;
|
|
6
|
+
currentFilter?: ActiveTableFilter;
|
|
7
|
+
tableRef?: React.RefObject<HTMLTableElement | null>;
|
|
8
|
+
filterName: string;
|
|
9
|
+
headerId: string;
|
|
10
|
+
filterType: FilterTypes;
|
|
11
|
+
items: string[] | number[];
|
|
12
|
+
itemsToHide: string[] | number[];
|
|
13
|
+
onShowOrHide: (show: boolean) => void;
|
|
14
|
+
onSetFilter: (id: string, valueToFilter: string[] | number[], numberCondition?: NumberCondition[]) => void;
|
|
15
|
+
}
|
|
16
|
+
declare function TableFilter(props: Readonly<TableFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default TableFilter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NumberCondition } from "./NumberFilter";
|
|
2
|
+
interface NumberConditionProps {
|
|
3
|
+
numberCondition: NumberCondition;
|
|
4
|
+
isNew: boolean;
|
|
5
|
+
immediatApply?: boolean;
|
|
6
|
+
deleteCondition?: (condition: NumberCondition) => void;
|
|
7
|
+
updateCondition: (condition: NumberCondition) => void;
|
|
8
|
+
}
|
|
9
|
+
declare function NumberConditionItem(props: Readonly<NumberConditionProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default NumberConditionItem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FilterTypes } from "../../../../../enum/FilterTypes";
|
|
2
|
+
interface NumberFilterProps {
|
|
3
|
+
headerId: string;
|
|
4
|
+
filterType: FilterTypes;
|
|
5
|
+
items: string[] | number[];
|
|
6
|
+
onShowOrHide: (show: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export type Operator = "=" | ">" | "<" | ">=" | "<=" | "between";
|
|
9
|
+
export interface NumberCondition {
|
|
10
|
+
id: string;
|
|
11
|
+
operator: Operator;
|
|
12
|
+
value1: number;
|
|
13
|
+
value2?: number;
|
|
14
|
+
}
|
|
15
|
+
declare function NumberFilter(props: Readonly<NumberFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default NumberFilter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterTypes } from "../../../../enum/FilterTypes";
|
|
2
|
+
interface TextFilterProps {
|
|
3
|
+
headerId: string;
|
|
4
|
+
filterType: FilterTypes;
|
|
5
|
+
items: string[] | number[];
|
|
6
|
+
onShowOrHide: (show: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
declare function TextFilter(props: Readonly<TextFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default TextFilter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type CellCoordinate from "../models/CellCordinate";
|
|
2
|
+
import type TableItem from "../models/TableItem";
|
|
3
|
+
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
4
|
+
declare const calculateSelectedCellAndExpandedSelection: (e: React.KeyboardEvent, selectedCell: CellCoordinate | undefined, expandedSelection: CellCoordinate[], columnsCount: number, rowsCount: number, processedLeafHeaders: BaseTableHeader[], selectedItem?: TableItem) => {
|
|
5
|
+
newSelectedCell: CellCoordinate | undefined;
|
|
6
|
+
newExpandedSelection: CellCoordinate[];
|
|
7
|
+
};
|
|
8
|
+
export default calculateSelectedCellAndExpandedSelection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type ActiveTableFilter from "../models/ActiveTableFilter";
|
|
2
|
+
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
3
|
+
import type TableItem from "../models/TableItem";
|
|
4
|
+
export declare const NBSP = "\u00A0";
|
|
5
|
+
export declare const filterItems: (items: TableItem[], filters: ActiveTableFilter[]) => TableItem[];
|
|
6
|
+
export declare const sortItems: (items: TableItem[], headers: BaseTableHeader[], currentSortType: "asc" | "desc", sortBy: string | undefined) => TableItem[];
|
|
7
|
+
export declare const tryToConvertToNumber: (item: any) => any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import type HighlightCondition from "../models/HighlightCondition";
|
|
3
|
+
import type TableItem from "../models/TableItem";
|
|
4
|
+
export declare const getCellHighlightConditions: (rowConditions: HighlightCondition[], columnId: string) => CSSProperties;
|
|
5
|
+
export declare const getRowHighlightConditions: (row: TableItem, highlightConditions: HighlightCondition[]) => HighlightCondition[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const ColorPicker: ({ initialColor, applyOpacity, onColorChange, onClose, }: {
|
|
2
|
+
initialColor?: string;
|
|
3
|
+
applyOpacity?: number;
|
|
4
|
+
onColorChange: (color: string) => void;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ColorPicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TABLE_ID = "main-base-table";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as BaseTable } from "./components/BaseTable/BaseTableWithContext";
|
|
2
|
+
import ActiveTableFilter from "./components/BaseTable/models/ActiveTableFilter";
|
|
3
|
+
export type { ActiveTableFilter };
|
|
4
|
+
import BaseTableHeader from "./components/BaseTable/models/BaseTableHeaders";
|
|
5
|
+
export type { BaseTableHeader };
|
|
6
|
+
import TableConfiguration from "./components/BaseTable/models/TableConfiguration";
|
|
7
|
+
export type { TableConfiguration };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type CellCoordinate from "../components/BaseTable/models/CellCordinate";
|
|
2
|
+
interface CommentPopupState {
|
|
3
|
+
openCommentCell?: CellCoordinate;
|
|
4
|
+
actions: {
|
|
5
|
+
setOpenCommentCell: (cell: CellCoordinate | undefined) => void;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const useTableDragStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CommentPopupState>>;
|
|
9
|
+
export declare const useOpenCommentCell: () => CellCoordinate | undefined;
|
|
10
|
+
export declare const useCommentPopupActions: () => {
|
|
11
|
+
setOpenCommentCell: (cell: CellCoordinate | undefined) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type ContextMenu from "../components/BaseTable/models/ContextMenu";
|
|
2
|
+
interface CommentPopupState {
|
|
3
|
+
contextMenu?: ContextMenu;
|
|
4
|
+
actions: {
|
|
5
|
+
setContextMenu: (contextMenu: ContextMenu | undefined) => void;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const useContextMenuStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CommentPopupState>>;
|
|
9
|
+
export declare const useContextMenu: () => ContextMenu | undefined;
|
|
10
|
+
export declare const useContextMenuActions: () => {
|
|
11
|
+
setContextMenu: (contextMenu: ContextMenu | undefined) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type DialogItem from "../components/BaseTable/models/DialogItem";
|
|
2
|
+
interface DialogsState {
|
|
3
|
+
openedDialogs: DialogItem[];
|
|
4
|
+
actions: {
|
|
5
|
+
openDialog: (position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}, title: string, dialogImplementation: React.ReactNode) => void;
|
|
9
|
+
closeDialog: (dialogId: string) => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const useDialogsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DialogsState>>;
|
|
13
|
+
export declare const useOpenedDialogs: () => DialogItem[];
|
|
14
|
+
export declare const useDialogsActions: () => {
|
|
15
|
+
openDialog: (position: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, title: string, dialogImplementation: React.ReactNode) => void;
|
|
19
|
+
closeDialog: (dialogId: string) => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|