simple-table-core 0.6.1 → 0.6.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.
- package/README.md +112 -58
- package/dist/components/Animate.d.ts +13 -5
- package/dist/components/SimpleTable/PinnedLeftColumns.d.ts +2 -0
- package/dist/components/SimpleTable/PinnedRightColumns.d.ts +2 -0
- package/dist/components/SimpleTable/RenderCells.d.ts +16 -0
- package/dist/components/SimpleTable/SimpleTable.d.ts +38 -9
- package/dist/components/SimpleTable/TableBody.d.ts +2 -24
- package/dist/components/SimpleTable/TableCell.d.ts +2 -19
- package/dist/components/SimpleTable/TableColumnEditor/TableColumnEditor.d.ts +2 -1
- package/dist/components/SimpleTable/TableContent.d.ts +13 -0
- package/dist/components/SimpleTable/TableHeader.d.ts +2 -25
- package/dist/components/SimpleTable/TableHeaderCell.d.ts +1 -0
- package/dist/components/SimpleTable/TableHorizontalScrollbar.d.ts +9 -0
- package/dist/components/SimpleTable/TableRow.d.ts +14 -0
- package/dist/components/SimpleTable/TableRowSeparator.d.ts +3 -1
- package/dist/components/SimpleTable/TableSection.d.ts +12 -0
- package/dist/consts/general-consts.d.ts +1 -0
- package/dist/context/TableContext.d.ts +3 -7
- package/dist/helpers/calculateBoundingBoxes.d.ts +9 -11
- package/dist/hooks/useDragHandler.d.ts +12 -0
- package/dist/hooks/usePrevious.d.ts +1 -1
- package/dist/hooks/useSortableData.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/types/BoundingBox.d.ts +11 -0
- package/dist/types/CellChangeProps.d.ts +2 -3
- package/dist/types/DragHandlerProps.d.ts +9 -0
- package/dist/types/GroupedRow.d.ts +8 -0
- package/dist/types/HeaderObject.d.ts +3 -0
- package/dist/types/Row.d.ts +9 -1
- package/dist/types/SharedTableProps.d.ts +19 -0
- package/dist/types/TableBodyProps.d.ts +22 -0
- package/dist/types/TableCellProps.d.ts +28 -0
- package/dist/types/TableHeaderProps.d.ts +21 -0
- package/dist/types/TableRowProps.d.ts +31 -0
- package/dist/utils/cellUtils.d.ts +10 -0
- package/dist/utils/formatters.d.ts +3 -0
- package/dist/utils/performanceUtils.d.ts +7 -1
- package/dist/utils/sortUtils.d.ts +13 -6
- package/package.json +6 -3
- package/dist/consts/SampleData.d.ts +0 -3
- package/dist/hooks/useTableHeaderCell.d.ts +0 -14
package/README.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
# Simple Table
|
|
2
2
|
|
|
3
|
-
Any questions, support or features requests join me on
|
|
3
|
+
Any questions, support or features requests join me on Discord <a href="https://discord.gg/RvKHCfg3PC" target="_blank" rel="noopener noreferrer">https://discord.gg/RvKHCfg3PC</a>. I am happy to help and make this table even better!
|
|
4
4
|
|
|
5
|
-
Simple Table is a React grid
|
|
5
|
+
Simple Table is a powerful yet lightweight React grid component that provides a flexible, customizable, and high-performance solution for displaying and manipulating tabular data in your applications.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Highly Customizable**: Fully customizable appearance with CSS variables and themes
|
|
10
|
+
- **Cell Editing**: Built-in support for editable cells with controlled state
|
|
11
|
+
- **Column Management**: Resize, reorder, pin, and hide columns with intuitive UI
|
|
12
|
+
- **Pagination**: Built-in pagination with customizable controls
|
|
13
|
+
- **Infinite Scroll**: Alternative to pagination for large datasets
|
|
14
|
+
- **Row Grouping**: Hierarchical data presentation with expandable rows
|
|
15
|
+
- **Theming**: Multiple built-in themes with ability to create custom themes
|
|
16
|
+
- **Performance Optimized**: Efficiently renders thousands of rows and columns
|
|
17
|
+
|
|
18
|
+
## Documentation
|
|
19
|
+
|
|
20
|
+
For detailed documentation, visit: [Simple Table Documentation](https://docs.simple-table.com/)
|
|
6
21
|
|
|
7
22
|
## Website
|
|
8
23
|
|
|
@@ -18,6 +33,49 @@ Check out the live demo on CodeSandbox: <a href="https://codesandbox.io/p/sandbo
|
|
|
18
33
|
</a>
|
|
19
34
|
</div>
|
|
20
35
|
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# npm
|
|
40
|
+
npm install simple-table-react
|
|
41
|
+
|
|
42
|
+
# yarn
|
|
43
|
+
yarn add simple-table-react
|
|
44
|
+
|
|
45
|
+
# pnpm
|
|
46
|
+
pnpm add simple-table-react
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import React, { useState } from "react";
|
|
53
|
+
import SimpleTable from "simple-table-react";
|
|
54
|
+
import "simple-table-react/dist/styles.css";
|
|
55
|
+
|
|
56
|
+
const App = () => {
|
|
57
|
+
const [rows, setRows] = useState([
|
|
58
|
+
{ rowMeta: { rowId: 0 }, rowData: { name: "John", age: 25 } },
|
|
59
|
+
{ rowMeta: { rowId: 1 }, rowData: { name: "Jane", age: 30 } },
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
const headers = [
|
|
63
|
+
{ accessor: "name", label: "Name", width: 200 },
|
|
64
|
+
{ accessor: "age", label: "Age", width: 100 },
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const handleCellChange = ({ accessor, newValue, originalRowIndex }) => {
|
|
68
|
+
const updatedRows = [...rows];
|
|
69
|
+
updatedRows[originalRowIndex].rowData[accessor] = newValue;
|
|
70
|
+
setRows(updatedRows);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return <SimpleTable defaultHeaders={headers} rows={rows} onCellChange={handleCellChange} selectableCells />;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default App;
|
|
77
|
+
```
|
|
78
|
+
|
|
21
79
|
## Props
|
|
22
80
|
|
|
23
81
|
The Simple Table component accepts the following props:
|
|
@@ -31,77 +89,73 @@ The Simple Table component accepts the following props:
|
|
|
31
89
|
- **isSortable**: An optional boolean indicating if the column is sortable.
|
|
32
90
|
- **type**: An optional string specifying the data type of the column. Can be "string", "number", "boolean", "date", or "enum".
|
|
33
91
|
- **cellRenderer**: An optional function that takes a row object and returns a `ReactNode` for custom cell rendering.
|
|
92
|
+
- **align**: Text alignment within cells - "left", "center", or "right"
|
|
93
|
+
|
|
94
|
+
- **rows**: An array of data rows to be displayed in the table. Each row object should have:
|
|
34
95
|
|
|
96
|
+
- **rowMeta**: Object containing metadata for the row
|
|
97
|
+
- **rowId**: Unique identifier for the row
|
|
98
|
+
- **isExpanded**: Optional boolean for row grouping expansion state
|
|
99
|
+
- **children**: Optional array of child rows for row grouping
|
|
100
|
+
- **rowData**: Object containing the actual data to display (keys should match header accessors)
|
|
101
|
+
|
|
102
|
+
- **theme**: Theme name to apply to the table. Options include "light", "dark", "high-contrast", etc.
|
|
103
|
+
- **height**: The height of the table. Can be a string (e.g., "500px", "calc(100vh - 100px)") or "auto".
|
|
104
|
+
- **shouldPaginate**: A boolean to enable or disable pagination. Default is `true`.
|
|
105
|
+
- **rowsPerPage**: The number of rows to display per page. Default is `10`.
|
|
35
106
|
- **columnResizing**: A boolean to enable or disable column resizing. Default is `true`.
|
|
36
107
|
- **draggable**: A boolean to enable or disable column dragging.
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
108
|
+
- **pinned**: A boolean to enable or disable column pinning.
|
|
109
|
+
- **editColumns**: A boolean to enable or disable column management.
|
|
39
110
|
- **hideFooter**: A boolean to hide or show the footer. Default is `false`.
|
|
40
|
-
- **nextIcon**: A React element to display as the next page icon. Default is `<AngleRightIcon />`.
|
|
41
|
-
- **prevIcon**: A React element to display as the previous page icon. Default is `<AngleLeftIcon />`.
|
|
42
|
-
- **rows**: An array of data rows to be displayed in the table.
|
|
43
|
-
- **rowsPerPage**: The number of rows to display per page. Default is `10`.
|
|
44
111
|
- **selectableCells**: A boolean to enable or disable cell selection.
|
|
45
|
-
- **
|
|
112
|
+
- **selectableColumns**: A boolean to enable selection of entire columns by clicking headers.
|
|
113
|
+
- **onCellChange**: A function called when a cell value changes.
|
|
114
|
+
- **nextIcon**: A React element to display as the next page icon.
|
|
115
|
+
- **prevIcon**: A React element to display as the previous page icon.
|
|
46
116
|
- **sortDownIcon**: A React element to display as the sort down icon.
|
|
47
117
|
- **sortUpIcon**: A React element to display as the sort up icon.
|
|
48
|
-
- **onCellChange**: A function that is called when a cell value changes. It receives an object with the following properties:
|
|
49
|
-
- **accessor**: The accessor of the column whose cell value changed.
|
|
50
|
-
- **newValue**: The new value of the cell.
|
|
51
|
-
- **newRowIndex**: The index of the row in the current page.
|
|
52
|
-
- **originalRowIndex**: The original index of the row in the entire dataset.
|
|
53
|
-
- **row**: The entire row object.
|
|
54
118
|
|
|
55
119
|
## Customizable Styles
|
|
56
120
|
|
|
57
|
-
All styles for the Simple Table are customizable
|
|
121
|
+
All styles for the Simple Table are customizable through CSS variables. You can override these variables in your own CSS to match your application's design system.
|
|
58
122
|
|
|
59
123
|
### CSS Variables
|
|
60
124
|
|
|
61
125
|
You can override the following CSS variables to customize the appearance of the table:
|
|
62
126
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `.st-selected-bottom-border`
|
|
96
|
-
- `.st-selected-left-border`
|
|
97
|
-
- `.st-selected-right-border`
|
|
98
|
-
- `.st-footer`
|
|
99
|
-
- `.st-next-prev-btn`
|
|
100
|
-
- `.st-page-btn`
|
|
101
|
-
- `.st-page-btn.active`
|
|
102
|
-
- `.editable-cell-input`
|
|
103
|
-
- `.st-column-editor`
|
|
104
|
-
- `.st-column-editor.open`
|
|
127
|
+
```css
|
|
128
|
+
:root {
|
|
129
|
+
/* Base variables */
|
|
130
|
+
--st-border-radius: 4px;
|
|
131
|
+
--st-border-width: 1px;
|
|
132
|
+
--st-cell-padding: 8px;
|
|
133
|
+
--st-font-size: 0.875rem;
|
|
134
|
+
--st-font-weight-normal: 400;
|
|
135
|
+
--st-font-weight-bold: 600;
|
|
136
|
+
--st-transition-duration: 0.2s;
|
|
137
|
+
--st-transition-ease: ease-in-out;
|
|
138
|
+
--st-opacity-disabled: 0.5;
|
|
139
|
+
--st-spacing-small: 4px;
|
|
140
|
+
--st-spacing-medium: 8px;
|
|
141
|
+
--st-spacing-large: 16px;
|
|
142
|
+
|
|
143
|
+
/* Colors */
|
|
144
|
+
--st-border-color: #e0e0e0;
|
|
145
|
+
--st-text-color: #333;
|
|
146
|
+
--st-background-color: #fff;
|
|
147
|
+
--st-header-background-color: #f5f5f5;
|
|
148
|
+
--st-resize-handle-color: #ccc;
|
|
149
|
+
--st-separator-border-color: #e0e0e0;
|
|
150
|
+
--st-odd-row-background-color: #f9f9f9;
|
|
151
|
+
--st-hover-background-color: #f0f0f0;
|
|
152
|
+
--st-dragging-background-color: #eaeaea;
|
|
153
|
+
--st-selected-cell-background-color: rgba(0, 120, 215, 0.1);
|
|
154
|
+
--st-selected-first-cell-background-color: rgba(0, 120, 215, 0.2);
|
|
155
|
+
--st-footer-background-color: #f5f5f5;
|
|
156
|
+
--st-last-group-row-separator-border-color: #4b5eaa;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
105
159
|
|
|
106
160
|
## License
|
|
107
161
|
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
export declare const TEST_KEY = "productId";
|
|
2
4
|
interface AnimateProps {
|
|
3
5
|
allowHorizontalAnimate?: boolean;
|
|
4
|
-
children:
|
|
6
|
+
children: React.ReactNode | React.ReactNode[];
|
|
7
|
+
draggedHeaderRef?: RefObject<HeaderObject | null>;
|
|
8
|
+
headersRef: RefObject<HeaderObject[]>;
|
|
9
|
+
isBody?: boolean;
|
|
5
10
|
pauseAnimation?: boolean;
|
|
6
|
-
|
|
11
|
+
rowIndex: number;
|
|
12
|
+
tableRef: RefObject<HTMLDivElement | null>;
|
|
7
13
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
14
|
+
declare const AnimateWrapper: ({ allowAnimations, children, ...props }: AnimateProps & {
|
|
15
|
+
allowAnimations: boolean;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default AnimateWrapper;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
4
|
+
declare const RenderCells: ({ getBorderClass, handleMouseDown, handleMouseOver, headers, hiddenColumns, isRowExpanded, isSelected, isTopLeftCell, lastGroupRow, onExpandRowClick, pinned, row, rowIndex, shouldDisplayLastColumnCell, ...props }: {
|
|
5
|
+
depth: number;
|
|
6
|
+
headers: HeaderObject[];
|
|
7
|
+
hiddenColumns: Record<string, boolean>;
|
|
8
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
9
|
+
lastGroupRow?: boolean | undefined;
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
pinned?: "left" | "right" | undefined;
|
|
12
|
+
row: Row;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
shouldDisplayLastColumnCell: boolean;
|
|
15
|
+
} & Omit<TableBodyProps, "currentRows">) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default RenderCells;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
-
import CellValue from "../../types/CellValue";
|
|
4
3
|
import CellChangeProps from "../../types/CellChangeProps";
|
|
5
4
|
import "../../styles/simple-table.css";
|
|
6
5
|
import Theme from "../../types/Theme";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import Row from "../../types/Row";
|
|
7
|
+
declare enum ColumnEditorPosition {
|
|
8
|
+
Left = "left",
|
|
9
|
+
Right = "right"
|
|
10
|
+
}
|
|
11
|
+
interface SimpleTableProps {
|
|
12
|
+
allowAnimations?: boolean;
|
|
13
|
+
columnEditorPosition?: ColumnEditorPosition;
|
|
9
14
|
columnEditorText?: string;
|
|
10
15
|
columnResizing?: boolean;
|
|
11
16
|
defaultHeaders: HeaderObject[];
|
|
12
17
|
draggable?: boolean;
|
|
13
18
|
editColumns?: boolean;
|
|
19
|
+
editColumnsInitOpen?: boolean;
|
|
14
20
|
height?: string;
|
|
15
21
|
hideFooter?: boolean;
|
|
16
22
|
nextIcon?: ReactNode;
|
|
17
|
-
onCellChange?: ({ accessor, newValue, originalRowIndex, row
|
|
23
|
+
onCellChange?: ({ accessor, newValue, originalRowIndex, row }: CellChangeProps) => void;
|
|
18
24
|
prevIcon?: ReactNode;
|
|
19
|
-
rows:
|
|
20
|
-
[key: string]: CellValue;
|
|
21
|
-
}[];
|
|
25
|
+
rows: Row[];
|
|
22
26
|
rowsPerPage?: number;
|
|
23
27
|
selectableCells?: boolean;
|
|
24
28
|
selectableColumns?: boolean;
|
|
@@ -27,5 +31,30 @@ interface SpreadsheetProps {
|
|
|
27
31
|
sortUpIcon?: ReactNode;
|
|
28
32
|
theme?: Theme;
|
|
29
33
|
}
|
|
30
|
-
declare const
|
|
31
|
-
|
|
34
|
+
declare const _default: import("react").MemoExoticComponent<{
|
|
35
|
+
({ allowAnimations, columnEditorPosition, columnEditorText, columnResizing, defaultHeaders, draggable, editColumns, editColumnsInitOpen, height, hideFooter, nextIcon, onCellChange, prevIcon, rows, rowsPerPage, selectableCells, selectableColumns, shouldPaginate, sortDownIcon, sortUpIcon, theme, }: SimpleTableProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
defaultProps: {
|
|
37
|
+
allowAnimations: boolean;
|
|
38
|
+
columnEditorPosition: ColumnEditorPosition;
|
|
39
|
+
columnEditorText: string;
|
|
40
|
+
columnResizing: boolean;
|
|
41
|
+
defaultHeaders: never[];
|
|
42
|
+
draggable: boolean;
|
|
43
|
+
editColumns: boolean;
|
|
44
|
+
editColumnsInitOpen: boolean;
|
|
45
|
+
height: string;
|
|
46
|
+
hideFooter: boolean;
|
|
47
|
+
nextIcon: import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
onCellChange: () => void;
|
|
49
|
+
prevIcon: import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
rows: never[];
|
|
51
|
+
rowsPerPage: number;
|
|
52
|
+
selectableCells: boolean;
|
|
53
|
+
selectableColumns: boolean;
|
|
54
|
+
shouldPaginate: boolean;
|
|
55
|
+
sortDownIcon: import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
sortUpIcon: import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
theme: string;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
export default _default;
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import CellChangeProps from "../../types/CellChangeProps";
|
|
4
|
-
import { MouseDownProps } from "../../hooks/useSelection";
|
|
5
|
-
interface TableBodyProps {
|
|
6
|
-
currentRows: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}[];
|
|
9
|
-
getBorderClass: (rowIndex: number, columnIndex: number) => string;
|
|
10
|
-
handleMouseDown: (props: MouseDownProps) => void;
|
|
11
|
-
handleMouseOver: (rowIndex: number, columnIndex: number) => void;
|
|
12
|
-
headers: HeaderObject[];
|
|
13
|
-
hiddenColumns: Record<string, boolean>;
|
|
14
|
-
isSelected: (rowIndex: number, columnIndex: number) => boolean;
|
|
15
|
-
isTopLeftCell: (rowIndex: number, columnIndex: number) => boolean;
|
|
16
|
-
isWidthDragging: boolean;
|
|
17
|
-
onCellChange?: (props: CellChangeProps) => void;
|
|
18
|
-
shouldDisplayLastColumnCell: boolean;
|
|
19
|
-
shouldPaginate: boolean;
|
|
20
|
-
tableRef: RefObject<HTMLDivElement>;
|
|
21
|
-
}
|
|
22
|
-
declare const TableBody: ({ currentRows, getBorderClass, handleMouseDown, handleMouseOver, headers, hiddenColumns, isSelected, isTopLeftCell, isWidthDragging, onCellChange, shouldDisplayLastColumnCell, shouldPaginate, tableRef, }: TableBodyProps & {
|
|
23
|
-
shouldDisplayLastColumnCell: boolean;
|
|
24
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
2
|
+
declare const TableBody: (props: TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
3
|
export default TableBody;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import CellValue from "../../types/CellValue";
|
|
5
|
-
interface TableCellProps {
|
|
6
|
-
borderClass: string;
|
|
7
|
-
colIndex: number;
|
|
8
|
-
content: CellValue;
|
|
9
|
-
header: HeaderObject;
|
|
10
|
-
isSelected: boolean;
|
|
11
|
-
isTopLeftCell: boolean;
|
|
12
|
-
onCellChange?: (props: CellChangeProps) => void;
|
|
13
|
-
onMouseDown: (rowIndex: number, colIndex: number) => void;
|
|
14
|
-
onMouseOver: (rowIndex: number, colIndex: number) => void;
|
|
15
|
-
row: {
|
|
16
|
-
[key: string]: CellValue;
|
|
17
|
-
};
|
|
18
|
-
rowIndex: number;
|
|
19
|
-
}
|
|
20
|
-
declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
2
|
+
import TableCellProps from "../../types/TableCellProps";
|
|
3
|
+
declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
4
|
export default TableCell;
|
|
@@ -4,6 +4,7 @@ type TableColumnEditorProps = {
|
|
|
4
4
|
headers: HeaderObject[];
|
|
5
5
|
columnEditorText: string;
|
|
6
6
|
editColumns: boolean;
|
|
7
|
+
editColumnsInitOpen: boolean;
|
|
7
8
|
position: "left" | "right";
|
|
8
9
|
setHiddenColumns: Dispatch<SetStateAction<{
|
|
9
10
|
[key: string]: boolean;
|
|
@@ -12,5 +13,5 @@ type TableColumnEditorProps = {
|
|
|
12
13
|
[key: string]: boolean;
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
|
-
declare const TableColumnEditor: ({ columnEditorText, editColumns, headers, position, setHiddenColumns, hiddenColumns, }: TableColumnEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
declare const TableColumnEditor: ({ columnEditorText, editColumns, editColumnsInitOpen, headers, position, setHiddenColumns, hiddenColumns, }: TableColumnEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
17
|
export default TableColumnEditor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
3
|
+
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
4
|
+
type OmittedTableProps = "shouldDisplayLastColumnCell" | "pinnedLeftColumns" | "pinnedRightColumns" | "mainTemplateColumns" | "pinnedLeftTemplateColumns" | "pinnedRightTemplateColumns";
|
|
5
|
+
interface TableContentProps extends Omit<TableHeaderProps, OmittedTableProps>, Omit<TableBodyProps, OmittedTableProps> {
|
|
6
|
+
editColumns: boolean;
|
|
7
|
+
pinnedLeftRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
pinnedRightRef: RefObject<HTMLDivElement | null>;
|
|
9
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const TableContent: ({ allowAnimations, columnResizing, currentRows, draggable, draggedHeaderRef, editColumns, forceUpdate, getBorderClass, handleMouseDown, handleMouseOver, headersRef, hiddenColumns, hoveredHeaderRef, isRowExpanded, isSelected, isTopLeftCell, isWidthDragging, onCellChange, onExpandRowClick, onSort, onTableHeaderDragEnd, pinnedLeftRef, pinnedRightRef, selectableColumns, setIsWidthDragging, setSelectedCells, shouldPaginate, sort, sortDownIcon, sortUpIcon, tableRef, }: TableContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default TableContent;
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import SortConfig from "../../types/SortConfig";
|
|
4
|
-
import OnSortProps from "../../types/OnSortProps";
|
|
5
|
-
import Row from "../../types/Row";
|
|
6
|
-
interface TableHeaderProps {
|
|
7
|
-
columnResizing: boolean;
|
|
8
|
-
currentRows: Row[];
|
|
9
|
-
draggable: boolean;
|
|
10
|
-
forceUpdate: () => void;
|
|
11
|
-
headersRef: React.RefObject<HeaderObject[]>;
|
|
12
|
-
hiddenColumns: Record<string, boolean>;
|
|
13
|
-
isWidthDragging: boolean;
|
|
14
|
-
onSort: OnSortProps;
|
|
15
|
-
onTableHeaderDragEnd: (newHeaders: HeaderObject[]) => void;
|
|
16
|
-
selectableColumns: boolean;
|
|
17
|
-
setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
|
|
18
|
-
setSelectedCells: Dispatch<React.SetStateAction<Set<string>>>;
|
|
19
|
-
shouldDisplayLastColumnCell: boolean;
|
|
20
|
-
sort: SortConfig | null;
|
|
21
|
-
sortDownIcon?: ReactNode;
|
|
22
|
-
sortUpIcon?: ReactNode;
|
|
23
|
-
tableRef: RefObject<HTMLDivElement>;
|
|
24
|
-
}
|
|
25
|
-
declare const TableHeader: ({ columnResizing, currentRows, draggable, forceUpdate, headersRef, hiddenColumns, isWidthDragging, onSort, onTableHeaderDragEnd, selectableColumns, setIsWidthDragging, setSelectedCells, shouldDisplayLastColumnCell, sort, sortDownIcon, sortUpIcon, tableRef, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
2
|
+
declare const TableHeader: ({ allowAnimations, columnResizing, currentRows, draggable, draggedHeaderRef, forceUpdate, headersRef, hiddenColumns, hoveredHeaderRef, isWidthDragging, mainTemplateColumns, onSort, onTableHeaderDragEnd, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedRightColumns, pinnedRightTemplateColumns, selectableColumns, setIsWidthDragging, setSelectedCells, shouldDisplayLastColumnCell, sort, sortDownIcon, sortUpIcon, tableRef, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
3
|
export default TableHeader;
|
|
@@ -14,6 +14,7 @@ interface TableHeaderCellProps {
|
|
|
14
14
|
index: number;
|
|
15
15
|
onSort: OnSortProps;
|
|
16
16
|
onTableHeaderDragEnd: (newHeaders: HeaderObject[]) => void;
|
|
17
|
+
reverse?: boolean;
|
|
17
18
|
selectableColumns: boolean;
|
|
18
19
|
setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
|
|
19
20
|
setSelectedCells: Dispatch<React.SetStateAction<Set<string>>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
declare const TableHorizontalScrollbar: ({ headersRef, pinnedLeftRef, pinnedRightRef, tableRef, }: {
|
|
4
|
+
headersRef: RefObject<HeaderObject[]>;
|
|
5
|
+
pinnedLeftRef: RefObject<HTMLDivElement | null>;
|
|
6
|
+
pinnedRightRef: RefObject<HTMLDivElement | null>;
|
|
7
|
+
tableRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default TableHorizontalScrollbar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
3
|
+
declare const TableRow: ({ depth, getNextRowIndex, index, lastGroupRow, pinned, props, row, }: {
|
|
4
|
+
depth?: number | undefined;
|
|
5
|
+
getNextRowIndex: () => number;
|
|
6
|
+
index: number;
|
|
7
|
+
lastGroupRow?: boolean | undefined;
|
|
8
|
+
pinned?: "left" | "right" | undefined;
|
|
9
|
+
props: Omit<TableBodyProps, "currentRows"> & {
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
};
|
|
12
|
+
row: Row;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default TableRow;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import { RefObject } from "react";
|
|
3
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
4
|
+
declare const TableSection: ({ rows, templateColumns, pinned, sectionRef, isRowExpanded, onExpandRowClick, ...props }: {
|
|
5
|
+
rows: Row[];
|
|
6
|
+
templateColumns: string;
|
|
7
|
+
pinned?: "left" | "right" | undefined;
|
|
8
|
+
sectionRef?: RefObject<HTMLDivElement | null> | undefined;
|
|
9
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
} & Omit<TableBodyProps, "currentRows">) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default TableSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DRAG_THROTTLE_LIMIT = 50;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import Row from "../types/Row";
|
|
3
3
|
declare const TableContext: import("react").Context<{
|
|
4
|
-
rows:
|
|
5
|
-
|
|
6
|
-
}[];
|
|
7
|
-
tableRows: {
|
|
8
|
-
[key: string]: CellValue;
|
|
9
|
-
}[];
|
|
4
|
+
rows: Row[];
|
|
5
|
+
tableRows: Row[];
|
|
10
6
|
}>;
|
|
11
7
|
export default TableContext;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare const calculateBoundingBoxes: (children: ReactNode) => {
|
|
11
|
-
[key: string]: BoundingBox;
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
import BoundingBox from "../types/BoundingBox";
|
|
3
|
+
import HeaderObject from "../types/HeaderObject";
|
|
4
|
+
declare const calculateBoundingBoxes: ({ currentHeaders, draggedHeaderRef, rowIndex, }: {
|
|
5
|
+
currentHeaders: HeaderObject[];
|
|
6
|
+
draggedHeaderRef?: MutableRefObject<HeaderObject | null> | undefined;
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
}) => {
|
|
9
|
+
[key: string]: false | BoundingBox;
|
|
12
10
|
};
|
|
13
11
|
export default calculateBoundingBoxes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DragEvent } from "react";
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
import DragHandlerProps from "../types/DragHandlerProps";
|
|
4
|
+
declare const useDragHandler: ({ draggedHeaderRef, headersRef, hoveredHeaderRef, onTableHeaderDragEnd, }: DragHandlerProps) => {
|
|
5
|
+
handleDragStart: (header: HeaderObject) => void;
|
|
6
|
+
handleDragOver: ({ event, hoveredHeader, }: {
|
|
7
|
+
event: DragEvent<HTMLDivElement>;
|
|
8
|
+
hoveredHeader: HeaderObject;
|
|
9
|
+
}) => void;
|
|
10
|
+
handleDragEnd: () => void;
|
|
11
|
+
};
|
|
12
|
+
export default useDragHandler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const usePrevious: (value:
|
|
1
|
+
declare const usePrevious: <T>(value: T) => T;
|
|
2
2
|
export default usePrevious;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
import Row from "../types/Row";
|
|
4
|
+
import SortConfig from "../types/SortConfig";
|
|
5
|
+
declare const useSortableData: (tableRows: Row[], headers: HeaderObject[]) => {
|
|
6
|
+
sort: SortConfig | null;
|
|
7
|
+
setSort: import("react").Dispatch<import("react").SetStateAction<SortConfig | null>>;
|
|
8
|
+
sortedRows: Row[];
|
|
9
|
+
hiddenColumns: Record<string, boolean>;
|
|
10
|
+
setHiddenColumns: import("react").Dispatch<import("react").SetStateAction<Record<string, boolean>>>;
|
|
11
|
+
};
|
|
12
|
+
export default useSortableData;
|