simple-table-core 1.0.11 → 1.0.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/README.md +21 -42
- package/dist/components/simple-table/RenderCells.d.ts +1 -2
- package/dist/components/simple-table/SimpleTable.d.ts +3 -0
- package/dist/components/simple-table/TableHeader.d.ts +1 -1
- package/dist/components/simple-table/TableHeaderCell.d.ts +0 -1
- package/dist/components/simple-table/TableHeaderSection.d.ts +1 -1
- package/dist/components/simple-table/TableHorizontalScrollbar.d.ts +2 -3
- package/dist/components/simple-table/TableRow.d.ts +1 -2
- package/dist/components/simple-table/TableSection.d.ts +1 -2
- package/dist/components/simple-table/table-column-editor/ColumnEditorCheckbox.d.ts +2 -9
- package/dist/components/simple-table/table-column-editor/TableColumnEditor.d.ts +1 -8
- package/dist/components/simple-table/table-column-editor/TableColumnEditorPopout.d.ts +1 -8
- package/dist/components/simple-table/table-column-editor/columnEditorUtils.d.ts +3 -9
- package/dist/context/TableContext.d.ts +4 -7
- package/dist/hooks/useDragHandler.d.ts +1 -1
- package/dist/hooks/useSortableData.d.ts +0 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/DragHandlerProps.d.ts +1 -1
- package/dist/types/HandleResizeStartProps.d.ts +2 -4
- package/dist/types/HeaderObject.d.ts +5 -0
- package/dist/types/SharedTableProps.d.ts +1 -2
- package/dist/types/TableCellProps.d.ts +1 -1
- package/dist/types/TableHeaderProps.d.ts +1 -2
- package/dist/types/TableHeaderSectionProps.d.ts +1 -2
- package/dist/types/TableRowProps.d.ts +0 -2
- package/dist/utils/cellUtils.d.ts +1 -2
- package/dist/utils/columnIndicesUtils.d.ts +2 -5
- package/dist/utils/columnUtils.d.ts +1 -2
- package/dist/utils/generalUtils.d.ts +3 -0
- package/dist/utils/resizeUtils.d.ts +2 -16
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Simple Table is a **lightweight**, **high-performance** React data grid componen
|
|
|
14
14
|
- **Intuitive**: Minimal boilerplate with a clean, React-first API
|
|
15
15
|
- **TypeScript-ready**: Full TypeScript support for type-safe development
|
|
16
16
|
|
|
17
|
-
## Quick Start
|
|
17
|
+
## 🚀 Quick Start
|
|
18
18
|
|
|
19
19
|
Get started with Simple Table in just a few lines of code!
|
|
20
20
|
|
|
@@ -24,39 +24,9 @@ Get started with Simple Table in just a few lines of code!
|
|
|
24
24
|
npm install simple-table-core
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import { SimpleTable, HeaderObject } from "simple-table-core";
|
|
31
|
-
import "simple-table-core/styles.css";
|
|
32
|
-
|
|
33
|
-
const QuickStartDemo = () => {
|
|
34
|
-
// Sample data for a quick start demo
|
|
35
|
-
const data = [
|
|
36
|
-
{ id: 1, name: "John Doe", age: 28, role: "Developer" },
|
|
37
|
-
{ id: 2, name: "Jane Smith", age: 32, role: "Designer" },
|
|
38
|
-
{ id: 3, name: "Bob Johnson", age: 45, role: "Manager" },
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
// Define headers
|
|
42
|
-
const headers: HeaderObject[] = [
|
|
43
|
-
{ accessor: "id", label: "ID", width: 80, isSortable: true, type: "number" },
|
|
44
|
-
{ accessor: "name", label: "Name", minWidth: 80, width: "1fr", type: "string" },
|
|
45
|
-
{ accessor: "age", label: "Age", width: 100, isSortable: true, type: "number" },
|
|
46
|
-
{ accessor: "role", label: "Role", width: 150, isSortable: true, type: "string" },
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
// Map data to rows format expected by SimpleTable
|
|
50
|
-
const rows = data.map((item) => ({
|
|
51
|
-
rowMeta: { rowId: item.id },
|
|
52
|
-
rowData: item,
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
return <SimpleTable defaultHeaders={headers} rows={rows} selectableCells />;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default QuickStartDemo;
|
|
59
|
-
```
|
|
27
|
+
### 📖 Complete Guide
|
|
28
|
+
|
|
29
|
+
**[👉 Follow our Quick Start Guide](https://www.simple-table.com/docs/quick-start)** for step-by-step instructions and live examples.
|
|
60
30
|
|
|
61
31
|
## Features
|
|
62
32
|
|
|
@@ -79,18 +49,27 @@ export default QuickStartDemo;
|
|
|
79
49
|
<img src="https://github.com/petera2c/simple-table-marketing/blob/main/src/assets/simple-table-demo-fast.gif?raw=true" alt="Simple Table Demo" width="600" />
|
|
80
50
|
</div>
|
|
81
51
|
|
|
82
|
-
## Examples
|
|
52
|
+
## 🎯 Live Examples
|
|
53
|
+
|
|
54
|
+
Explore our interactive examples with complete source code:
|
|
55
|
+
|
|
56
|
+
### 📊 **[Finance Dashboard](https://www.simple-table.com/examples/finance)**
|
|
57
|
+
|
|
58
|
+
Complete financial data table with advanced filtering and sorting
|
|
59
|
+
|
|
60
|
+
### 💰 **[Sales Dashboard](https://www.simple-table.com/examples/sales)**
|
|
61
|
+
|
|
62
|
+
Sales analytics table with custom cell renderers and grouping
|
|
83
63
|
|
|
84
|
-
|
|
64
|
+
### 📘 **[Documentation & More Examples](https://www.simple-table.com/docs/installation)**
|
|
85
65
|
|
|
86
|
-
|
|
87
|
-
- [Sales Dashboard](https://www.simple-table.com/examples/sales?theme=light)
|
|
66
|
+
Browse all available examples and comprehensive documentation
|
|
88
67
|
|
|
89
|
-
##
|
|
68
|
+
## 📚 Resources
|
|
90
69
|
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
70
|
+
- **🌐 Website**: [Simple Table](https://www.simple-table.com/)
|
|
71
|
+
- **📖 Documentation**: [Complete Documentation](https://www.simple-table.com/docs/installation)
|
|
72
|
+
- **🚀 Quick Start**: [Get Started Now](https://www.simple-table.com/docs/quick-start)
|
|
94
73
|
|
|
95
74
|
## Community & Support
|
|
96
75
|
|
|
@@ -7,11 +7,10 @@ interface RenderCellsProps {
|
|
|
7
7
|
columnIndexStart?: number;
|
|
8
8
|
columnIndices: ColumnIndices;
|
|
9
9
|
headers: HeaderObject[];
|
|
10
|
-
hiddenColumns: Record<string, boolean>;
|
|
11
10
|
pinned?: Pinned;
|
|
12
11
|
rowIndex: number;
|
|
13
12
|
rowIndices: RowIndices;
|
|
14
13
|
visibleRow: TableRowType;
|
|
15
14
|
}
|
|
16
|
-
declare const RenderCells: ({ columnIndexStart, columnIndices, headers,
|
|
15
|
+
declare const RenderCells: ({ columnIndexStart, columnIndices, headers, pinned, rowIndex, rowIndices, visibleRow, }: RenderCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
export default RenderCells;
|
|
@@ -7,6 +7,7 @@ import ColumnEditorPosition from "../../types/ColumnEditorPosition";
|
|
|
7
7
|
import TableRefType from "../../types/TableRefType";
|
|
8
8
|
import OnNextPage from "../../types/OnNextPage";
|
|
9
9
|
import "../../styles/simple-table.css";
|
|
10
|
+
import { FilterCondition } from "../../types/FilterTypes";
|
|
10
11
|
interface SimpleTableProps {
|
|
11
12
|
allowAnimations?: boolean;
|
|
12
13
|
cellUpdateFlash?: boolean;
|
|
@@ -19,11 +20,13 @@ interface SimpleTableProps {
|
|
|
19
20
|
editColumnsInitOpen?: boolean;
|
|
20
21
|
expandAll?: boolean;
|
|
21
22
|
expandIcon?: ReactNode;
|
|
23
|
+
externalFilterHandling?: boolean;
|
|
22
24
|
height?: string;
|
|
23
25
|
hideFooter?: boolean;
|
|
24
26
|
nextIcon?: ReactNode;
|
|
25
27
|
onCellEdit?: (props: CellChangeProps) => void;
|
|
26
28
|
onColumnOrderChange?: (newHeaders: HeaderObject[]) => void;
|
|
29
|
+
onFilterChange?: (filter: FilterCondition) => void;
|
|
27
30
|
onGridReady?: () => void;
|
|
28
31
|
onNextPage?: OnNextPage;
|
|
29
32
|
prevIcon?: ReactNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
2
|
-
declare const TableHeader: ({ centerHeaderRef, headerContainerRef,
|
|
2
|
+
declare const TableHeader: ({ centerHeaderRef, headerContainerRef, headers, mainTemplateColumns, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedRightColumns, pinnedRightTemplateColumns, sort, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableHeader;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableHeaderSectionProps from "../../types/TableHeaderSectionProps";
|
|
2
|
-
declare const TableHeaderSection: ({ columnIndices, gridTemplateColumns, handleScroll,
|
|
2
|
+
declare const TableHeaderSection: ({ columnIndices, gridTemplateColumns, handleScroll, headers, maxDepth, pinned, sectionRef, sort, }: TableHeaderSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableHeaderSection;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { RefObject
|
|
2
|
-
declare const TableHorizontalScrollbar: ({ mainBodyWidth, mainBodyRef, pinnedLeftWidth, pinnedRightWidth,
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
declare const TableHorizontalScrollbar: ({ mainBodyWidth, mainBodyRef, pinnedLeftWidth, pinnedRightWidth, tableBodyContainerRef, }: {
|
|
3
3
|
mainBodyRef: RefObject<HTMLDivElement | null>;
|
|
4
4
|
mainBodyWidth: number;
|
|
5
5
|
pinnedLeftWidth: number;
|
|
6
6
|
pinnedRightWidth: number;
|
|
7
|
-
setMainBodyWidth: Dispatch<SetStateAction<number>>;
|
|
8
7
|
tableBodyContainerRef: RefObject<HTMLDivElement | null>;
|
|
9
8
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
9
|
export default TableHorizontalScrollbar;
|
|
@@ -8,7 +8,6 @@ interface TableRowProps {
|
|
|
8
8
|
columnIndices: ColumnIndices;
|
|
9
9
|
gridTemplateColumns: string;
|
|
10
10
|
headers: HeaderObject[];
|
|
11
|
-
hiddenColumns: Record<string, boolean>;
|
|
12
11
|
hoveredIndex: number | null;
|
|
13
12
|
index: number;
|
|
14
13
|
pinned?: Pinned;
|
|
@@ -17,5 +16,5 @@ interface TableRowProps {
|
|
|
17
16
|
setHoveredIndex: (index: number | null) => void;
|
|
18
17
|
visibleRow: TableRowType;
|
|
19
18
|
}
|
|
20
|
-
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers,
|
|
19
|
+
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers, hoveredIndex, index, pinned, rowHeight, rowIndices, setHoveredIndex, visibleRow, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default TableRow;
|
|
@@ -8,7 +8,6 @@ interface TableSectionProps {
|
|
|
8
8
|
columnIndexStart?: number;
|
|
9
9
|
columnIndices: ColumnIndices;
|
|
10
10
|
headers: HeaderObject[];
|
|
11
|
-
hiddenColumns: Record<string, boolean>;
|
|
12
11
|
hoveredIndex: number | null;
|
|
13
12
|
pinned?: Pinned;
|
|
14
13
|
ref?: RefObject<HTMLDivElement | null>;
|
|
@@ -20,5 +19,5 @@ interface TableSectionProps {
|
|
|
20
19
|
visibleRows: TableRowType[];
|
|
21
20
|
width?: number;
|
|
22
21
|
}
|
|
23
|
-
declare const TableSection: ({ columnIndexStart, columnIndices, headers,
|
|
22
|
+
declare const TableSection: ({ columnIndexStart, columnIndices, headers, hoveredIndex, pinned, ref, rowHeight, rowIndices, setHoveredIndex, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
23
|
export default TableSection;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { SetStateAction } from "react";
|
|
2
|
-
import { Dispatch } from "react";
|
|
3
1
|
import HeaderObject from "../../../types/HeaderObject";
|
|
4
|
-
declare const ColumnEditorCheckbox: ({ allHeaders, depth,
|
|
2
|
+
declare const ColumnEditorCheckbox: ({ allHeaders, depth, doesAnyHeaderHaveChildren, header, }: {
|
|
5
3
|
allHeaders: HeaderObject[];
|
|
6
4
|
depth?: number | undefined;
|
|
5
|
+
doesAnyHeaderHaveChildren: boolean;
|
|
7
6
|
header: HeaderObject;
|
|
8
|
-
hiddenColumns: {
|
|
9
|
-
[key: string]: boolean;
|
|
10
|
-
};
|
|
11
|
-
setHiddenColumns: Dispatch<SetStateAction<{
|
|
12
|
-
[key: string]: boolean;
|
|
13
|
-
}>>;
|
|
14
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
8
|
export default ColumnEditorCheckbox;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from "react";
|
|
2
1
|
import HeaderObject from "../../../types/HeaderObject";
|
|
3
2
|
type TableColumnEditorProps = {
|
|
4
3
|
columnEditorText: string;
|
|
5
4
|
editColumns: boolean;
|
|
6
5
|
editColumnsInitOpen: boolean;
|
|
7
6
|
headers: HeaderObject[];
|
|
8
|
-
hiddenColumns: {
|
|
9
|
-
[key: string]: boolean;
|
|
10
|
-
};
|
|
11
7
|
position: "left" | "right";
|
|
12
|
-
setHiddenColumns: Dispatch<SetStateAction<{
|
|
13
|
-
[key: string]: boolean;
|
|
14
|
-
}>>;
|
|
15
8
|
};
|
|
16
|
-
declare const TableColumnEditor: ({ columnEditorText, editColumns, editColumnsInitOpen, headers,
|
|
9
|
+
declare const TableColumnEditor: ({ columnEditorText, editColumns, editColumnsInitOpen, headers, position, }: TableColumnEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
10
|
export default TableColumnEditor;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from "react";
|
|
2
1
|
import HeaderObject from "../../../types/HeaderObject";
|
|
3
2
|
type TableColumnEditorPopoutProps = {
|
|
4
3
|
headers: HeaderObject[];
|
|
5
4
|
open: boolean;
|
|
6
5
|
position: "left" | "right";
|
|
7
|
-
setHiddenColumns: Dispatch<SetStateAction<{
|
|
8
|
-
[key: string]: boolean;
|
|
9
|
-
}>>;
|
|
10
|
-
hiddenColumns: {
|
|
11
|
-
[key: string]: boolean;
|
|
12
|
-
};
|
|
13
6
|
};
|
|
14
|
-
declare const TableColumnEditorPopout: ({ headers, open, position
|
|
7
|
+
declare const TableColumnEditorPopout: ({ headers, open, position }: TableColumnEditorPopoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
8
|
export default TableColumnEditorPopout;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import HeaderObject from "../../../types/HeaderObject";
|
|
2
|
-
export declare const findAndMarkParentsVisible: (headers: HeaderObject[], childAccessor: string,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const areAllChildrenHidden: (children: HeaderObject[], hiddenColumns: {
|
|
6
|
-
[key: string]: boolean;
|
|
7
|
-
}) => boolean;
|
|
8
|
-
export declare const updateParentHeaders: (headers: HeaderObject[], updatedHiddenColumns: {
|
|
9
|
-
[key: string]: boolean;
|
|
10
|
-
}) => void;
|
|
2
|
+
export declare const findAndMarkParentsVisible: (headers: HeaderObject[], childAccessor: string, visited?: Set<string>) => void;
|
|
3
|
+
export declare const areAllChildrenHidden: (children: HeaderObject[]) => boolean;
|
|
4
|
+
export declare const updateParentHeaders: (headers: HeaderObject[]) => void;
|
|
@@ -20,16 +20,14 @@ interface TableContextType {
|
|
|
20
20
|
expandIcon?: ReactNode;
|
|
21
21
|
expandedRows: Set<string>;
|
|
22
22
|
filters: TableFilterState;
|
|
23
|
-
tableRows: TableRow[];
|
|
24
23
|
forceUpdate: () => void;
|
|
25
24
|
getBorderClass: (cell: Cell) => string;
|
|
26
25
|
handleApplyFilter: (filter: FilterCondition) => void;
|
|
27
|
-
handleClearFilter: (accessor: string) => void;
|
|
28
26
|
handleClearAllFilters: () => void;
|
|
27
|
+
handleClearFilter: (accessor: string) => void;
|
|
29
28
|
handleMouseDown: (cell: Cell) => void;
|
|
30
29
|
handleMouseOver: (cell: Cell) => void;
|
|
31
|
-
|
|
32
|
-
hiddenColumns: Record<string, boolean>;
|
|
30
|
+
headers: HeaderObject[];
|
|
33
31
|
hoveredHeaderRef: RefObject<HeaderObject | null>;
|
|
34
32
|
isCopyFlashing: (cell: Cell) => boolean;
|
|
35
33
|
isInitialFocusedCell: (cell: Cell) => boolean;
|
|
@@ -51,16 +49,15 @@ interface TableContextType {
|
|
|
51
49
|
selectColumns?: (columnIndices: number[], isShiftKey?: boolean) => void;
|
|
52
50
|
selectableColumns: boolean;
|
|
53
51
|
setExpandedRows: Dispatch<SetStateAction<Set<string>>>;
|
|
52
|
+
setHeaders: Dispatch<SetStateAction<HeaderObject[]>>;
|
|
54
53
|
setInitialFocusedCell: Dispatch<SetStateAction<Cell | null>>;
|
|
55
|
-
setMainBodyWidth: Dispatch<SetStateAction<number>>;
|
|
56
|
-
setPinnedLeftWidth: Dispatch<SetStateAction<number>>;
|
|
57
|
-
setPinnedRightWidth: Dispatch<SetStateAction<number>>;
|
|
58
54
|
setSelectedCells: Dispatch<SetStateAction<Set<string>>>;
|
|
59
55
|
setSelectedColumns: Dispatch<SetStateAction<Set<number>>>;
|
|
60
56
|
shouldPaginate: boolean;
|
|
61
57
|
sortDownIcon: ReactNode;
|
|
62
58
|
sortUpIcon: ReactNode;
|
|
63
59
|
tableBodyContainerRef: RefObject<HTMLDivElement | null>;
|
|
60
|
+
tableRows: TableRow[];
|
|
64
61
|
theme: Theme;
|
|
65
62
|
useHoverRowBackground: boolean;
|
|
66
63
|
useOddColumnBackground: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DragEvent } from "react";
|
|
2
2
|
import HeaderObject from "../types/HeaderObject";
|
|
3
3
|
import DragHandlerProps from "../types/DragHandlerProps";
|
|
4
|
-
declare const useDragHandler: ({ draggedHeaderRef,
|
|
4
|
+
declare const useDragHandler: ({ draggedHeaderRef, headers, hoveredHeaderRef, onColumnOrderChange, onTableHeaderDragEnd, }: DragHandlerProps) => {
|
|
5
5
|
handleDragStart: (header: HeaderObject) => void;
|
|
6
6
|
handleDragOver: ({ event, hoveredHeader, }: {
|
|
7
7
|
event: DragEvent<HTMLDivElement>;
|
|
@@ -6,8 +6,6 @@ declare const useSortableData: ({ headers, tableRows }: {
|
|
|
6
6
|
headers: HeaderObject[];
|
|
7
7
|
tableRows: Row[];
|
|
8
8
|
}) => {
|
|
9
|
-
hiddenColumns: Record<string, boolean>;
|
|
10
|
-
setHiddenColumns: import("react").Dispatch<import("react").SetStateAction<Record<string, boolean>>>;
|
|
11
9
|
setSort: import("react").Dispatch<import("react").SetStateAction<SortConfig | null>>;
|
|
12
10
|
sort: SortConfig | null;
|
|
13
11
|
sortedRows: Row[];
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,6 @@ import TableRefType from "./types/TableRefType";
|
|
|
17
17
|
import type TableRowProps from "./types/TableRowProps";
|
|
18
18
|
import type Theme from "./types/Theme";
|
|
19
19
|
import type UpdateDataProps from "./types/UpdateCellProps";
|
|
20
|
+
import { FilterCondition } from "./types/FilterTypes";
|
|
20
21
|
export { SimpleTable };
|
|
21
|
-
export type { BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, EnumOption, HeaderObject, OnSortProps, Row, SharedTableProps, SortConfig, TableCellProps, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };
|
|
22
|
+
export type { BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, EnumOption, FilterCondition, HeaderObject, OnSortProps, Row, SharedTableProps, SortConfig, TableCellProps, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };
|