simple-table-core 1.2.3 → 1.2.5

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.
@@ -1,9 +1,9 @@
1
- import React, { ReactNode, RefObject } from "react";
1
+ import React, { ReactNode, MutableRefObject } from "react";
2
2
  import TableRow from "../../types/TableRow";
3
3
  interface AnimateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
4
4
  children: ReactNode;
5
5
  id: string;
6
- parentRef?: RefObject<HTMLDivElement | null>;
6
+ parentRef?: MutableRefObject<HTMLDivElement | null>;
7
7
  tableRow?: TableRow;
8
8
  }
9
9
  export declare const Animate: {
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from "react";
2
2
  export interface DropdownProps {
3
3
  children: ReactNode;
4
- containerRef?: React.RefObject<HTMLElement>;
4
+ containerRef?: React.MutableRefObject<HTMLElement>;
5
5
  onClose: () => void;
6
6
  open?: boolean;
7
7
  overflow?: "auto" | "visible";
@@ -1,6 +1,6 @@
1
- import { FC, ReactElement, RefObject } from "react";
1
+ import { FC, ReactElement, MutableRefObject } from "react";
2
2
  interface ScrollSyncPaneProps {
3
- childRef: RefObject<HTMLElement | null>;
3
+ childRef: MutableRefObject<HTMLElement | null>;
4
4
  children: ReactElement<any>;
5
5
  }
6
6
  export declare const ScrollSyncPane: FC<ScrollSyncPaneProps>;
@@ -1,4 +1,4 @@
1
- import { ReactNode, RefObject } from "react";
1
+ import { ReactNode, MutableRefObject } from "react";
2
2
  import HeaderObject from "../../types/HeaderObject";
3
3
  import CellChangeProps from "../../types/CellChangeProps";
4
4
  import Theme from "../../types/Theme";
@@ -8,7 +8,7 @@ import TableRefType from "../../types/TableRefType";
8
8
  import OnNextPage from "../../types/OnNextPage";
9
9
  import "../../styles/simple-table.css";
10
10
  import { TableFilterState } from "../../types/FilterTypes";
11
- import { SortColumn } from "../../types/SortConfig";
11
+ import SortColumn from "../../types/SortColumn";
12
12
  interface SimpleTableProps {
13
13
  allowAnimations?: boolean;
14
14
  cellUpdateFlash?: boolean;
@@ -44,7 +44,7 @@ interface SimpleTableProps {
44
44
  shouldPaginate?: boolean;
45
45
  sortDownIcon?: ReactNode;
46
46
  sortUpIcon?: ReactNode;
47
- tableRef?: RefObject<TableRefType | null>;
47
+ tableRef?: MutableRefObject<TableRefType | null>;
48
48
  theme?: Theme;
49
49
  useOddColumnBackground?: boolean;
50
50
  useHoverRowBackground?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, SetStateAction } from "react";
2
- import { SortColumn } from "../../types/SortConfig";
2
+ import SortColumn from "../../types/SortColumn";
3
3
  import TableRow from "../../types/TableRow";
4
4
  interface TableContentLocalProps {
5
5
  pinnedLeftWidth: number;
@@ -1,5 +1,5 @@
1
1
  import HeaderObject from "../../types/HeaderObject";
2
- import { SortColumn } from "../../types/SortConfig";
2
+ import SortColumn from "../../types/SortColumn";
3
3
  interface HeaderCellProps {
4
4
  colIndex: number;
5
5
  gridColumnEnd: number;
@@ -1,9 +1,9 @@
1
1
  import { RefObject } from "react";
2
2
  declare const TableHorizontalScrollbar: ({ mainBodyWidth, mainBodyRef, pinnedLeftWidth, pinnedRightWidth, tableBodyContainerRef, }: {
3
- mainBodyRef: RefObject<HTMLDivElement | null>;
3
+ mainBodyRef: RefObject<HTMLDivElement>;
4
4
  mainBodyWidth: number;
5
5
  pinnedLeftWidth: number;
6
6
  pinnedRightWidth: number;
7
- tableBodyContainerRef: RefObject<HTMLDivElement | null>;
7
+ tableBodyContainerRef: RefObject<HTMLDivElement>;
8
8
  }) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export default TableHorizontalScrollbar;
@@ -1,4 +1,4 @@
1
- import { RefObject } from "react";
1
+ /// <reference types="react" />
2
2
  import TableRowType from "../../types/TableRow";
3
3
  import { Pinned } from "../../types/Pinned";
4
4
  import HeaderObject from "../../types/HeaderObject";
@@ -10,7 +10,6 @@ interface TableSectionProps {
10
10
  headers: HeaderObject[];
11
11
  hoveredIndex: number | null;
12
12
  pinned?: Pinned;
13
- ref?: RefObject<HTMLDivElement | null>;
14
13
  rowHeight: number;
15
14
  rowIndices: RowIndices;
16
15
  rowsToRender: TableRowType[];
@@ -19,5 +18,5 @@ interface TableSectionProps {
19
18
  totalHeight: number;
20
19
  width?: number;
21
20
  }
22
- declare const TableSection: ({ columnIndexStart, columnIndices, headers, hoveredIndex, pinned, ref, rowHeight, rowIndices, setHoveredIndex, templateColumns, totalHeight, rowsToRender, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element | null;
21
+ declare const TableSection: import("react").ForwardRefExoticComponent<TableSectionProps & import("react").RefAttributes<HTMLDivElement>>;
23
22
  export default TableSection;
@@ -1,4 +1,4 @@
1
- import { ReactNode, RefObject, Dispatch, SetStateAction } from "react";
1
+ import { ReactNode, RefObject, MutableRefObject, Dispatch, SetStateAction } from "react";
2
2
  import { TableFilterState, FilterCondition } from "../types/FilterTypes";
3
3
  import TableRow from "../types/TableRow";
4
4
  import Cell from "../types/Cell";
@@ -15,7 +15,7 @@ interface TableContextType {
15
15
  cellUpdateFlash?: boolean;
16
16
  columnReordering: boolean;
17
17
  columnResizing: boolean;
18
- draggedHeaderRef: RefObject<HeaderObject | null>;
18
+ draggedHeaderRef: MutableRefObject<HeaderObject | null>;
19
19
  editColumns?: boolean;
20
20
  expandIcon?: ReactNode;
21
21
  filters: TableFilterState;
@@ -26,9 +26,9 @@ interface TableContextType {
26
26
  handleClearFilter: (accessor: string) => void;
27
27
  handleMouseDown: (cell: Cell) => void;
28
28
  handleMouseOver: (cell: Cell) => void;
29
- headerContainerRef: RefObject<HTMLDivElement | null>;
29
+ headerContainerRef: RefObject<HTMLDivElement>;
30
30
  headers: HeaderObject[];
31
- hoveredHeaderRef: RefObject<HeaderObject | null>;
31
+ hoveredHeaderRef: MutableRefObject<HeaderObject | null>;
32
32
  isAnimating: boolean;
33
33
  isCopyFlashing: (cell: Cell) => boolean;
34
34
  isInitialFocusedCell: (cell: Cell) => boolean;
@@ -36,15 +36,15 @@ interface TableContextType {
36
36
  isScrolling: boolean;
37
37
  isSelected: (cell: Cell) => boolean;
38
38
  isWarningFlashing: (cell: Cell) => boolean;
39
- mainBodyRef: RefObject<HTMLDivElement | null>;
39
+ mainBodyRef: RefObject<HTMLDivElement>;
40
40
  nextIcon: ReactNode;
41
41
  onCellEdit?: (props: any) => void;
42
42
  onColumnOrderChange?: (newHeaders: HeaderObject[]) => void;
43
43
  onLoadMore?: () => void;
44
44
  onSort: OnSortProps;
45
45
  onTableHeaderDragEnd: (newHeaders: HeaderObject[]) => void;
46
- pinnedLeftRef: RefObject<HTMLDivElement | null>;
47
- pinnedRightRef: RefObject<HTMLDivElement | null>;
46
+ pinnedLeftRef: RefObject<HTMLDivElement>;
47
+ pinnedRightRef: RefObject<HTMLDivElement>;
48
48
  prevIcon: ReactNode;
49
49
  rowGrouping?: string[];
50
50
  rowHeight: number;
@@ -62,7 +62,7 @@ interface TableContextType {
62
62
  shouldPaginate: boolean;
63
63
  sortDownIcon: ReactNode;
64
64
  sortUpIcon: ReactNode;
65
- tableBodyContainerRef: RefObject<HTMLDivElement | null>;
65
+ tableBodyContainerRef: RefObject<HTMLDivElement>;
66
66
  tableRows: TableRow[];
67
67
  theme: Theme;
68
68
  unexpandedRows: Set<string>;
@@ -1,4 +1,4 @@
1
- import { SortColumn } from "../types/SortConfig";
1
+ import SortColumn from "../types/SortColumn";
2
2
  declare const useExternalSort: ({ sort, onSortChange, }: {
3
3
  sort: SortColumn | null;
4
4
  onSortChange?: ((sort: SortColumn | null) => void) | undefined;
@@ -1,9 +1,9 @@
1
1
  import { RefObject } from "react";
2
2
  declare const useScrollbarWidth: ({ tableBodyContainerRef, }: {
3
- tableBodyContainerRef: RefObject<HTMLDivElement | null>;
3
+ tableBodyContainerRef: RefObject<HTMLDivElement>;
4
4
  }) => {
5
5
  setScrollbarWidth: import("react").Dispatch<import("react").SetStateAction<number>>;
6
6
  scrollbarWidth: number;
7
- tableBodyContainerRef: RefObject<HTMLDivElement | null>;
7
+ tableBodyContainerRef: RefObject<HTMLDivElement>;
8
8
  };
9
9
  export default useScrollbarWidth;
@@ -1,6 +1,6 @@
1
1
  import HeaderObject from "../types/HeaderObject";
2
2
  import Row from "../types/Row";
3
- import { SortColumn } from "../types/SortConfig";
3
+ import SortColumn from "../types/SortColumn";
4
4
  declare const useSortableData: ({ headers, tableRows, externalSortHandling, onSortChange, rowGrouping, }: {
5
5
  headers: HeaderObject[];
6
6
  tableRows: Row[];
@@ -1,10 +1,10 @@
1
- import { RefObject } from "react";
1
+ import { MutableRefObject } from "react";
2
2
  import { Row, TableRefType } from "..";
3
3
  import { CellRegistryEntry } from "../context/TableContext";
4
4
  declare const useTableAPI: ({ tableRef, rows, rowIdAccessor, cellRegistryRef, }: {
5
- tableRef?: RefObject<TableRefType | null> | undefined;
5
+ tableRef?: MutableRefObject<TableRefType | null> | undefined;
6
6
  rows: Row[];
7
7
  rowIdAccessor: string;
8
- cellRegistryRef: RefObject<Map<string, CellRegistryEntry>>;
8
+ cellRegistryRef: MutableRefObject<Map<string, CellRegistryEntry>>;
9
9
  }) => void;
10
10
  export default useTableAPI;
@@ -1,7 +1,7 @@
1
1
  import { RefObject } from "react";
2
2
  declare const useWindowResize: ({ forceUpdate, tableBodyContainerRef, setScrollbarWidth, }: {
3
3
  forceUpdate: () => void;
4
- tableBodyContainerRef: RefObject<HTMLDivElement | null>;
4
+ tableBodyContainerRef: RefObject<HTMLDivElement>;
5
5
  setScrollbarWidth: (width: number) => void;
6
6
  }) => void;
7
7
  export default useWindowResize;
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { AggregationConfig, AggregationType } from "./types/AggregationType
11
11
  import type OnSortProps from "./types/OnSortProps";
12
12
  import type Row from "./types/Row";
13
13
  import type SharedTableProps from "./types/SharedTableProps";
14
- import type SortConfig from "./types/SortConfig";
14
+ import type SortColumn from "./types/SortColumn";
15
15
  import type TableCellProps from "./types/TableCellProps";
16
16
  import type TableHeaderProps from "./types/TableHeaderProps";
17
17
  import TableRefType from "./types/TableRefType";
@@ -20,4 +20,4 @@ import type Theme from "./types/Theme";
20
20
  import type UpdateDataProps from "./types/UpdateCellProps";
21
21
  import { FilterCondition, TableFilterState } from "./types/FilterTypes";
22
22
  export { SimpleTable };
23
- export type { AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, EnumOption, FilterCondition, HeaderObject, OnSortProps, Row, SharedTableProps, SortConfig, TableCellProps, TableFilterState, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };
23
+ export type { AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, EnumOption, FilterCondition, HeaderObject, OnSortProps, Row, SharedTableProps, SortColumn, TableCellProps, TableFilterState, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };