react-base-data-table 0.3.1 → 0.3.3

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.
Files changed (52) hide show
  1. package/dist/index.cjs.js +17 -15
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +3104 -3022
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +1 -1
  7. package/dist/types/App.d.ts +0 -3
  8. package/dist/types/DUMMY_ITEMS.d.ts +0 -6
  9. package/dist/types/components/BaseButton.d.ts +0 -17
  10. package/dist/types/components/BaseTable/BaseTable.d.ts +0 -46
  11. package/dist/types/components/BaseTable/BaseTableCell.d.ts +0 -29
  12. package/dist/types/components/BaseTable/BaseTableGroupRow.d.ts +0 -13
  13. package/dist/types/components/BaseTable/BaseTableHeader.d.ts +0 -18
  14. package/dist/types/components/BaseTable/BaseTableHeaders.d.ts +0 -16
  15. package/dist/types/components/BaseTable/BaseTableRow.d.ts +0 -29
  16. package/dist/types/components/BaseTable/BaseTableWithContext.d.ts +0 -3
  17. package/dist/types/components/BaseTable/CommentPopup.d.ts +0 -15
  18. package/dist/types/components/BaseTable/ContextMenu.d.ts +0 -15
  19. package/dist/types/components/BaseTable/CustomRenderItem.d.ts +0 -8
  20. package/dist/types/components/BaseTable/TableFilter.d.ts +0 -16
  21. package/dist/types/components/BaseTable/cellImplementation/ListCell.d.ts +0 -10
  22. package/dist/types/components/BaseTable/contexts/useCommentPopupContext.d.ts +0 -12
  23. package/dist/types/components/BaseTable/hooks/useCellPopup.d.ts +0 -16
  24. package/dist/types/components/BaseTable/hooks/useDragSelection.d.ts +0 -13
  25. package/dist/types/components/BaseTable/hooks/useRowDragDrop.d.ts +0 -16
  26. package/dist/types/components/BaseTable/hooks/useTableData.d.ts +0 -19
  27. package/dist/types/components/BaseTable/hooks/useTableFiltering.d.ts +0 -13
  28. package/dist/types/components/BaseTable/hooks/useTableGrouping.d.ts +0 -28
  29. package/dist/types/components/BaseTable/hooks/useTableInteractions.d.ts +0 -35
  30. package/dist/types/components/BaseTable/hooks/useTableSorting.d.ts +0 -13
  31. package/dist/types/components/BaseTable/hooks/useVirtualRows.d.ts +0 -10
  32. package/dist/types/components/BaseTable/models/ActiveTableFilter.d.ts +0 -4
  33. package/dist/types/components/BaseTable/models/BaseTableHeaders.d.ts +0 -30
  34. package/dist/types/components/BaseTable/models/CellCordinate.d.ts +0 -4
  35. package/dist/types/components/BaseTable/models/CommentData.d.ts +0 -9
  36. package/dist/types/components/BaseTable/models/ContextMenuAction.d.ts +0 -12
  37. package/dist/types/components/BaseTable/models/GroupInfo.d.ts +0 -7
  38. package/dist/types/components/BaseTable/models/HighlightCondition.d.ts +0 -7
  39. package/dist/types/components/BaseTable/models/ItemWithGroupInfo.d.ts +0 -7
  40. package/dist/types/components/BaseTable/models/TableConfiguration.d.ts +0 -4
  41. package/dist/types/components/BaseTable/models/TableItem.d.ts +0 -4
  42. package/dist/types/components/BaseTable/tableFunctions/CellSelection.d.ts +0 -6
  43. package/dist/types/components/BaseTable/tableFunctions/FilteringAndSorting.d.ts +0 -7
  44. package/dist/types/components/ColorPicker.d.ts +0 -7
  45. package/dist/types/enum/DateUnits.d.ts +0 -8
  46. package/dist/types/enum/FilterTypes.d.ts +0 -4
  47. package/dist/types/hooks/useClickOutside.d.ts +0 -2
  48. package/dist/types/index.d.ts +0 -7
  49. package/dist/types/main.d.ts +0 -1
  50. package/dist/types/utils/array.d.ts +0 -5
  51. package/dist/types/utils/enum.d.ts +0 -3
  52. package/dist/types/utils/sorting.d.ts +0 -4
@@ -1,16 +0,0 @@
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 {};
@@ -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,28 +0,0 @@
1
- import type TableItem from "../models/TableItem";
2
- import type ItemWithGroupInfo from "../models/ItemWithGroupInfo";
3
- import type GroupInfo from "../models/GroupInfo";
4
- interface GroupedItems {
5
- [key: string]: {
6
- rowIndex: number;
7
- item: TableItem;
8
- }[];
9
- }
10
- interface LinkedGroup {
11
- master: string;
12
- linked: string[];
13
- }
14
- interface UseTableGroupingReturn {
15
- groupedItems: GroupedItems;
16
- groupedItemsEntries: [string, {
17
- rowIndex: number;
18
- item: TableItem;
19
- }[]][];
20
- collapsedGroups: string[];
21
- flatGroupedItemsToDisplay: Array<GroupInfo | ItemWithGroupInfo>;
22
- onCollapseGroup: (group: string) => void;
23
- setCollapsedGroup: (groupNames: string[]) => void;
24
- isGroupLinked: (groupName: string) => boolean;
25
- getMasterGroupNameLinked: (groupName: string) => string | undefined;
26
- }
27
- export default function useTableGrouping(filteredItems: TableItem[], groupBy?: string, linkedGroups?: LinkedGroup[]): UseTableGroupingReturn;
28
- export {};
@@ -1,35 +0,0 @@
1
- import type BaseTableHeader from "../models/BaseTableHeaders";
2
- import type TableItem from "../models/TableItem";
3
- import type CellCoordinate from "../models/CellCordinate";
4
- interface UseTableInteractionsProps<T extends TableItem> {
5
- headers: BaseTableHeader[];
6
- items: TableItem[];
7
- groupedItemsEntries?: [string, {
8
- rowIndex: number;
9
- item: TableItem;
10
- }[]][];
11
- onChange?: (itemUpdated: T, originalIndex: number) => void;
12
- onBulkChange?: (items: {
13
- itemUpdated: T;
14
- originalIndex: number;
15
- }[], headerId: string) => void;
16
- onRowDoubleClick?: (item: T) => void;
17
- }
18
- export declare function useTableInteractions<T extends TableItem>({ headers, items, groupedItemsEntries, onChange, onBulkChange, onRowDoubleClick, }: UseTableInteractionsProps<T>): {
19
- selectedCell: CellCoordinate | undefined;
20
- expandedSelection: CellCoordinate[];
21
- isDragging: boolean;
22
- setSelectedCell: import("react").Dispatch<import("react").SetStateAction<CellCoordinate | undefined>>;
23
- setExpandedSelection: import("react").Dispatch<import("react").SetStateAction<CellCoordinate[]>>;
24
- onCellBlur: (editValue: string | number | undefined, item: TableItem, header: BaseTableHeader) => void;
25
- onCellEnter: (editValue: string | number | undefined, item: TableItem, header: BaseTableHeader) => void;
26
- onCellClick: (rowIndex: number, columnIndex: number) => void;
27
- handleCellKeyDown: (e: React.KeyboardEvent) => void;
28
- handleRowDoubleClick: (item: TableItem) => void;
29
- onCellMouseDown: (e: React.MouseEvent<HTMLTableCellElement>, rowIndex: number, columnIndex: number) => void;
30
- onCellMouseEnter: (e: React.MouseEvent<HTMLTableCellElement>, rowIndex: number, columnIndex: number) => void;
31
- onMouseMove: (e: React.MouseEvent) => void;
32
- onRightClick: (rowIndex: number, columnIndex: number, e: React.MouseEvent) => void;
33
- getItemFromCellCoordinates: (cell: CellCoordinate) => TableItem | undefined;
34
- };
35
- 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 {};
@@ -1,10 +0,0 @@
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
- virtualRows: import("@tanstack/virtual-core").VirtualItem[];
8
- before: number;
9
- after: number;
10
- };
@@ -1,4 +0,0 @@
1
- export default interface ActiveTableFilter {
2
- headerId: string;
3
- itemsToHide: string[] | number[];
4
- }
@@ -1,30 +0,0 @@
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) => boolean;
18
- greyedOutIfNotEditable?: boolean;
19
- required?: boolean;
20
- type: TableHeaderType;
21
- options?: string[];
22
- defaultValue?: string | number;
23
- canAddNewOption?: boolean;
24
- };
25
- sortable?: boolean;
26
- align?: "left" | "center" | "right";
27
- customSort?: (a: TableItem, b: TableItem, ascendingOrder: boolean) => number;
28
- customHeader?: (header: BaseTableHeader) => ReactNode;
29
- customRender?: (item: TableItem, header: BaseTableHeader) => ReactNode;
30
- }
@@ -1,4 +0,0 @@
1
- export default interface CellCoordinate {
2
- rowIndex: number;
3
- columnIndex: number;
4
- }
@@ -1,9 +0,0 @@
1
- export default interface CommentData {
2
- propertyId: string;
3
- value: unknown;
4
- date: Date;
5
- formatDateFunction?: (date: Date) => string;
6
- author?: string;
7
- columnId?: string;
8
- text: string;
9
- }
@@ -1,12 +0,0 @@
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: (item: TableItem, itemCoordinates: CellCoordinate) => void;
8
- groupName?: string;
9
- disabled?: boolean;
10
- subActions?: ContextMenuAction[];
11
- customRender?: () => React.ReactNode;
12
- }
@@ -1,7 +0,0 @@
1
- export default interface GroupInfo {
2
- isGroup: boolean;
3
- groupName: string;
4
- isCollapsed?: boolean;
5
- masterGroupName?: string;
6
- linkedGroupNames?: string[];
7
- }
@@ -1,7 +0,0 @@
1
- import { type CSSProperties } from "react";
2
- export default interface HighlightCondition {
3
- propertyId: string;
4
- value: unknown;
5
- style: CSSProperties;
6
- columnId?: string;
7
- }
@@ -1,7 +0,0 @@
1
- import type GroupInfo from "./GroupInfo";
2
- import type TableItem from "./TableItem";
3
- export default interface ItemWithGroupInfo extends GroupInfo {
4
- isGroup: false;
5
- rowIndex: number;
6
- item: TableItem;
7
- }
@@ -1,4 +0,0 @@
1
- export default interface TableConfiguration {
2
- defaultSortBy?: string;
3
- defaultSortDesc?: boolean;
4
- }
@@ -1,4 +0,0 @@
1
- export default interface TableItem {
2
- [key: string]: string | number | undefined;
3
- section?: string;
4
- }
@@ -1,6 +0,0 @@
1
- import type CellCoordinate from "../models/CellCordinate";
2
- declare const calculateSelectedCellAndExpandedSelection: (e: React.KeyboardEvent, selectedCell: CellCoordinate | undefined, expandedSelection: CellCoordinate[], columnsCount: number, rowsCount: number) => {
3
- newSelectedCell: CellCoordinate | undefined;
4
- newExpandedSelection: CellCoordinate[];
5
- };
6
- export default calculateSelectedCellAndExpandedSelection;
@@ -1,7 +0,0 @@
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;
@@ -1,7 +0,0 @@
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;
@@ -1,8 +0,0 @@
1
- export declare enum DateUnits {
2
- YEARS = "Years",
3
- MONTHS = "Months",
4
- WEEKS = "Weeks",
5
- DAYS = "Days",
6
- HOURS = "Hours",
7
- MINUTES = "Minutes"
8
- }
@@ -1,4 +0,0 @@
1
- export declare enum FilterTypes {
2
- STRING = "string",
3
- NUMBER = "number"
4
- }
@@ -1,2 +0,0 @@
1
- import { RefObject } from 'react';
2
- export default function useClickOutside(ref: RefObject<HTMLElement>, callback: () => void): void;
@@ -1,7 +0,0 @@
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 };
@@ -1 +0,0 @@
1
- import "./index.css";
@@ -1,5 +0,0 @@
1
- import TableItem from "../components/BaseTable/models/TableItem";
2
- export declare const arrayMove: <T>(array: Array<T>, fromIndex: number, toIndex: number) => void;
3
- export declare const removeDuplicates: (arr: string[]) => string[];
4
- export declare const isArrayOfType: <T>(array: TableItem[], type: T) => boolean;
5
- export declare const isNumberArray: (array: unknown[]) => array is number[];
@@ -1,3 +0,0 @@
1
- export declare function getEnumKeyByEnumValue<T extends {
2
- [index: string]: string;
3
- }>(myEnum: T, enumValue: string): keyof T | null;
@@ -1,4 +0,0 @@
1
- export declare const alphabeticalSort: (a: string, b: string) => 1 | 0 | -1;
2
- export declare const alphabeticalSortInverse: (a: string, b: string) => 1 | 0 | -1;
3
- export declare const numericalSort: (a: number, b: number) => number;
4
- export declare const numericalSortInverse: (a: number, b: number) => number;