rez-table-listing-mui 0.0.3 → 0.0.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.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/App.tsx +7 -7
- package/src/components/column-visibility-modal/column-list-item.tsx +8 -3
- package/src/components/index-table.tsx +2 -0
- package/src/components/table-body-dnd-cell.tsx +15 -3
- package/src/components/table-body.tsx +26 -16
- package/src/components/table-dnd.tsx +2 -0
- package/src/components/table-head-dnd-cell.tsx +7 -8
- package/src/components/table-head-popover.tsx +16 -5
- package/src/components/table-head.tsx +36 -2
- package/src/components/table.tsx +3 -0
- package/src/components/topbar/index.scss +1 -2
- package/src/components/topbar/index.tsx +3 -1
- package/src/components/viewmore/index.tsx +12 -0
- package/src/libs/hooks/useCraftTable.tsx +8 -0
- package/src/libs/hooks/useDefaultColumns.tsx +8 -2
- package/src/libs/utils/make-hierar-data.ts +2 -0
- package/src/types/common.ts +10 -0
- package/src/types/table-options.ts +4 -0
- package/src/types/table.ts +2 -0
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
Row,
|
|
6
6
|
Table,
|
|
7
7
|
} from "@tanstack/react-table";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
CraftTableFeatureProps,
|
|
10
|
+
CraftTableOptionsProps,
|
|
11
|
+
} from "../types/table-options";
|
|
9
12
|
import { align } from "../types/common";
|
|
10
13
|
import DragAlongCell from "./table-body-dnd-cell";
|
|
11
14
|
import {
|
|
@@ -20,6 +23,7 @@ interface TableBodyProps<T> {
|
|
|
20
23
|
featureOptions: CraftTableFeatureProps;
|
|
21
24
|
NestedComponent?: React.ComponentType<{ row: Row<T> }>;
|
|
22
25
|
columnOrder: ColumnOrderState;
|
|
26
|
+
tableStates: CraftTableOptionsProps;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
function TableBody<T>({
|
|
@@ -27,9 +31,11 @@ function TableBody<T>({
|
|
|
27
31
|
featureOptions,
|
|
28
32
|
NestedComponent,
|
|
29
33
|
columnOrder,
|
|
34
|
+
tableStates,
|
|
30
35
|
}: TableBodyProps<T>) {
|
|
31
|
-
const {
|
|
32
|
-
|
|
36
|
+
const { enableColumnReordering, enableRowSelection } = featureOptions;
|
|
37
|
+
|
|
38
|
+
const { wrapColumns } = tableStates;
|
|
33
39
|
|
|
34
40
|
const renderRow = (row: Row<T>) => {
|
|
35
41
|
const renderedRow = (
|
|
@@ -58,7 +64,10 @@ function TableBody<T>({
|
|
|
58
64
|
style: {
|
|
59
65
|
...getColumnPinningStylesBody(cell.column),
|
|
60
66
|
width: cell.column.getSize(),
|
|
61
|
-
...(
|
|
67
|
+
...(wrapColumns[cell.column.id] && {
|
|
68
|
+
wordBreak: "break-all",
|
|
69
|
+
// whiteSpace: "normal",
|
|
70
|
+
}),
|
|
62
71
|
} as React.CSSProperties,
|
|
63
72
|
align: (cell.column.columnDef.meta as align)?.align || "left",
|
|
64
73
|
};
|
|
@@ -69,7 +78,11 @@ function TableBody<T>({
|
|
|
69
78
|
items={columnOrder}
|
|
70
79
|
strategy={horizontalListSortingStrategy}
|
|
71
80
|
>
|
|
72
|
-
<DragAlongCell
|
|
81
|
+
<DragAlongCell
|
|
82
|
+
cell={cell}
|
|
83
|
+
featureOptions={featureOptions}
|
|
84
|
+
tableStates={tableStates}
|
|
85
|
+
/>
|
|
73
86
|
</SortableContext>
|
|
74
87
|
) : (
|
|
75
88
|
<td key={cell?.id} {...tdProps}>
|
|
@@ -82,17 +95,14 @@ function TableBody<T>({
|
|
|
82
95
|
|
|
83
96
|
if (row.getIsExpanded()) {
|
|
84
97
|
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</tr>
|
|
94
|
-
</React.Fragment>
|
|
95
|
-
)
|
|
98
|
+
<React.Fragment key={row.id}>
|
|
99
|
+
{renderedRow}
|
|
100
|
+
<tr>
|
|
101
|
+
<td colSpan={table.getAllLeafColumns().length}>
|
|
102
|
+
{NestedComponent && <NestedComponent {...{ row }} />}
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</React.Fragment>
|
|
96
106
|
);
|
|
97
107
|
} else {
|
|
98
108
|
return renderedRow;
|
|
@@ -22,6 +22,7 @@ function TableDND<T>({
|
|
|
22
22
|
columnOrder,
|
|
23
23
|
setColumnOrder,
|
|
24
24
|
isCompactTable,
|
|
25
|
+
tableStates,
|
|
25
26
|
}: CraftTableComponentProps<T>) {
|
|
26
27
|
const sensors: SensorDescriptor<SensorOptions>[] = useSensors(
|
|
27
28
|
useSensor(MouseSensor, {}),
|
|
@@ -54,6 +55,7 @@ function TableDND<T>({
|
|
|
54
55
|
columnOrder={columnOrder}
|
|
55
56
|
setColumnOrder={setColumnOrder}
|
|
56
57
|
isCompactTable={isCompactTable}
|
|
58
|
+
tableStates={tableStates}
|
|
57
59
|
/>
|
|
58
60
|
</DndContext>
|
|
59
61
|
);
|
|
@@ -15,12 +15,12 @@ import TableHeadPopover from "./table-head-popover";
|
|
|
15
15
|
function DraggableTableHeader<T>({
|
|
16
16
|
header,
|
|
17
17
|
featureOptions,
|
|
18
|
+
tableStates,
|
|
18
19
|
}: TableHeaderProps<T>) {
|
|
19
20
|
const { enableColumnPinning } = featureOptions;
|
|
20
21
|
|
|
21
22
|
// Popover
|
|
22
23
|
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
23
|
-
const [wrap, setWrap] = useState(false);
|
|
24
24
|
|
|
25
25
|
const handleHover = (event: React.MouseEvent<HTMLElement>) => {
|
|
26
26
|
setAnchorEl((prev) => (prev ? null : event.currentTarget));
|
|
@@ -30,10 +30,6 @@ function DraggableTableHeader<T>({
|
|
|
30
30
|
setAnchorEl(null);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const toggleWrap = () => {
|
|
34
|
-
setWrap((prev) => !prev);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
33
|
const { isDragging, transform, attributes, listeners } = useSortable({
|
|
38
34
|
id: header.column.id,
|
|
39
35
|
});
|
|
@@ -108,7 +104,11 @@ function DraggableTableHeader<T>({
|
|
|
108
104
|
</div>
|
|
109
105
|
|
|
110
106
|
{enableColumnPinning && (
|
|
111
|
-
<TableHeadPin
|
|
107
|
+
<TableHeadPin
|
|
108
|
+
header={header}
|
|
109
|
+
featureOptions={featureOptions}
|
|
110
|
+
tableStates={tableStates}
|
|
111
|
+
/>
|
|
112
112
|
)}
|
|
113
113
|
|
|
114
114
|
<div {...attributes} {...listeners} className="ts__dnd__button">
|
|
@@ -134,8 +134,7 @@ function DraggableTableHeader<T>({
|
|
|
134
134
|
anchorEl={anchorEl}
|
|
135
135
|
onClose={handleClose}
|
|
136
136
|
header={header}
|
|
137
|
-
|
|
138
|
-
onToggleWrap={toggleWrap}
|
|
137
|
+
tableStates={tableStates}
|
|
139
138
|
/>
|
|
140
139
|
</th>
|
|
141
140
|
);
|
|
@@ -14,26 +14,34 @@ import {
|
|
|
14
14
|
IconPinOffOutline,
|
|
15
15
|
IconPinOutline,
|
|
16
16
|
} from "../assets/svg";
|
|
17
|
+
import { CraftTableOptionsProps } from "../types/table-options";
|
|
17
18
|
|
|
18
19
|
type Props<T> = {
|
|
19
20
|
anchorEl: HTMLElement | null;
|
|
20
21
|
onClose: () => void;
|
|
21
22
|
header: Header<T, unknown>;
|
|
22
|
-
|
|
23
|
-
onToggleWrap: () => void;
|
|
23
|
+
tableStates: CraftTableOptionsProps;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
function TableHeadPopover<T>({
|
|
27
27
|
anchorEl,
|
|
28
28
|
onClose,
|
|
29
29
|
header,
|
|
30
|
-
|
|
31
|
-
onToggleWrap,
|
|
30
|
+
tableStates,
|
|
32
31
|
}: Props<T>) {
|
|
33
32
|
const open = Boolean(anchorEl);
|
|
34
33
|
const column = header.column;
|
|
35
34
|
const isPinned = column.getIsPinned() === "left";
|
|
36
35
|
|
|
36
|
+
const { wrapColumns, setWrapColumns } = tableStates;
|
|
37
|
+
|
|
38
|
+
const toggleWrapForColumn = (columnId: string) => {
|
|
39
|
+
setWrapColumns((prev: Record<string, boolean>) => ({
|
|
40
|
+
...prev,
|
|
41
|
+
[columnId]: !prev[columnId],
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
|
|
37
45
|
return (
|
|
38
46
|
<Popover
|
|
39
47
|
open={open}
|
|
@@ -75,7 +83,10 @@ function TableHeadPopover<T>({
|
|
|
75
83
|
|
|
76
84
|
<ListItemButton>
|
|
77
85
|
<ListItemText primary="Wrap Cell" />
|
|
78
|
-
<Switch
|
|
86
|
+
<Switch
|
|
87
|
+
checked={wrapColumns[column.id]}
|
|
88
|
+
onChange={() => toggleWrapForColumn(column.id)}
|
|
89
|
+
/>
|
|
79
90
|
</ListItemButton>
|
|
80
91
|
</List>
|
|
81
92
|
</Popover>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ColumnOrderState, flexRender, Table } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CraftTableFeatureProps,
|
|
4
|
+
CraftTableOptionsProps,
|
|
5
|
+
} from "../types/table-options";
|
|
3
6
|
import { DownArrow, UpArrow } from "../assets/svg";
|
|
4
|
-
import { CSSProperties } from "react";
|
|
7
|
+
import { CSSProperties, useState } from "react";
|
|
5
8
|
import {
|
|
6
9
|
getColumnAlignment,
|
|
7
10
|
getColumnPinningStyles,
|
|
@@ -14,17 +17,20 @@ import {
|
|
|
14
17
|
import DraggableTableHeader from "./table-head-dnd-cell";
|
|
15
18
|
import TableHeadPin from "./table-head-pin";
|
|
16
19
|
import Checkbox from "./inputs/checkbox";
|
|
20
|
+
import TableHeadPopover from "./table-head-popover";
|
|
17
21
|
|
|
18
22
|
interface TableHeadProps<T> {
|
|
19
23
|
table: Table<T>;
|
|
20
24
|
featureOptions: CraftTableFeatureProps;
|
|
21
25
|
columnOrder: ColumnOrderState;
|
|
26
|
+
tableStates: CraftTableOptionsProps;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
function TableHead<T>({
|
|
25
30
|
table,
|
|
26
31
|
featureOptions,
|
|
27
32
|
columnOrder,
|
|
33
|
+
tableStates,
|
|
28
34
|
}: TableHeadProps<T>) {
|
|
29
35
|
const {
|
|
30
36
|
stickyHeader,
|
|
@@ -33,6 +39,22 @@ function TableHead<T>({
|
|
|
33
39
|
enableRowSelection,
|
|
34
40
|
} = featureOptions;
|
|
35
41
|
|
|
42
|
+
// Popover
|
|
43
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
44
|
+
const [wrap, setWrap] = useState(false);
|
|
45
|
+
|
|
46
|
+
const handleClose = () => {
|
|
47
|
+
setAnchorEl(null);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const toggleWrap = () => {
|
|
51
|
+
setWrap((prev) => !prev);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleHover = (event: React.MouseEvent<HTMLElement>) => {
|
|
55
|
+
setAnchorEl((prev) => (prev ? null : event.currentTarget));
|
|
56
|
+
};
|
|
57
|
+
|
|
36
58
|
return (
|
|
37
59
|
<thead className={`ts__head ${stickyHeader ? "ts--sticky" : ""}`.trim()}>
|
|
38
60
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
@@ -91,6 +113,7 @@ function TableHead<T>({
|
|
|
91
113
|
<DraggableTableHeader
|
|
92
114
|
header={header}
|
|
93
115
|
featureOptions={featureOptions}
|
|
116
|
+
tableStates={tableStates}
|
|
94
117
|
/>
|
|
95
118
|
</SortableContext>
|
|
96
119
|
) : (
|
|
@@ -104,6 +127,7 @@ function TableHead<T>({
|
|
|
104
127
|
minWidth: `${header.column.columnDef.minSize}px`,
|
|
105
128
|
maxWidth: `${header.column.columnDef.maxSize}px`,
|
|
106
129
|
}}
|
|
130
|
+
onClick={handleHover}
|
|
107
131
|
>
|
|
108
132
|
{header.isPlaceholder ? null : (
|
|
109
133
|
<div {...sortProps}>
|
|
@@ -128,6 +152,7 @@ function TableHead<T>({
|
|
|
128
152
|
<TableHeadPin
|
|
129
153
|
header={header}
|
|
130
154
|
featureOptions={featureOptions}
|
|
155
|
+
tableStates={tableStates}
|
|
131
156
|
/>
|
|
132
157
|
)}
|
|
133
158
|
</div>
|
|
@@ -144,6 +169,15 @@ function TableHead<T>({
|
|
|
144
169
|
}`}
|
|
145
170
|
/>
|
|
146
171
|
) : null}
|
|
172
|
+
|
|
173
|
+
{/* Popover */}
|
|
174
|
+
{/* <TableHeadPopover
|
|
175
|
+
anchorEl={anchorEl}
|
|
176
|
+
onClose={handleClose}
|
|
177
|
+
header={header}
|
|
178
|
+
wrap={wrap}
|
|
179
|
+
tableStates={tableStates}
|
|
180
|
+
/> */}
|
|
147
181
|
</th>
|
|
148
182
|
);
|
|
149
183
|
})}
|
package/src/components/table.tsx
CHANGED
|
@@ -9,6 +9,7 @@ function Table<T>({
|
|
|
9
9
|
NestedComponent,
|
|
10
10
|
columnOrder,
|
|
11
11
|
isCompactTable,
|
|
12
|
+
tableStates,
|
|
12
13
|
}: CraftTableComponentProps<T>) {
|
|
13
14
|
const { striped } = featureOptions;
|
|
14
15
|
|
|
@@ -24,12 +25,14 @@ function Table<T>({
|
|
|
24
25
|
table={table}
|
|
25
26
|
featureOptions={featureOptions}
|
|
26
27
|
columnOrder={columnOrder}
|
|
28
|
+
tableStates={tableStates}
|
|
27
29
|
/>
|
|
28
30
|
<TableBody
|
|
29
31
|
table={table}
|
|
30
32
|
featureOptions={featureOptions}
|
|
31
33
|
NestedComponent={NestedComponent}
|
|
32
34
|
columnOrder={columnOrder}
|
|
35
|
+
tableStates={tableStates}
|
|
33
36
|
/>
|
|
34
37
|
</table>
|
|
35
38
|
);
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
align-items: center;
|
|
6
|
-
min-height: 2.5rem;
|
|
6
|
+
// min-height: 2.5rem;
|
|
7
7
|
background-color: #fff;
|
|
8
8
|
|
|
9
9
|
.right-section {
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
// gap: 0.4rem; // All icons gap
|
|
13
|
-
|
|
14
13
|
.search-wrapper {
|
|
15
14
|
display: flex;
|
|
16
15
|
align-items: center;
|
|
@@ -16,6 +16,7 @@ import ViewMore from "../viewmore";
|
|
|
16
16
|
import { useFullscreenPopoverContainer } from "../../libs/hooks/useFullScreen";
|
|
17
17
|
import SortPopover from "../sorting-modal.tsx";
|
|
18
18
|
import ColumnToggle from "../column-visibility-modal/index.tsx";
|
|
19
|
+
import { CraftTableOptionsProps } from "../../types/table-options.ts";
|
|
19
20
|
|
|
20
21
|
interface TopbarProps<T> {
|
|
21
22
|
table: Table<T>;
|
|
@@ -26,6 +27,7 @@ interface TopbarProps<T> {
|
|
|
26
27
|
topbarOptions?: TopbarOptionsProps;
|
|
27
28
|
columnOrder?: string[];
|
|
28
29
|
setColumnOrder?: React.Dispatch<React.SetStateAction<string[]>>;
|
|
30
|
+
tableStates?: CraftTableOptionsProps;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
function Topbar<T>({
|
|
@@ -53,7 +55,7 @@ function Topbar<T>({
|
|
|
53
55
|
table.getAllLeafColumns().map((col) => col.id)
|
|
54
56
|
);
|
|
55
57
|
|
|
56
|
-
console.log("showColumnHiding", showColumnHiding); //only for built purpose-> remove it later
|
|
58
|
+
// console.log("showColumnHiding", showColumnHiding); //only for built purpose-> remove it later
|
|
57
59
|
|
|
58
60
|
// sync column order with table instance
|
|
59
61
|
useEffect(() => {
|
|
@@ -20,6 +20,7 @@ interface ViewMorePopoverProps {
|
|
|
20
20
|
onFullscreenToggle: () => void;
|
|
21
21
|
groupBy: string;
|
|
22
22
|
onGroupByChange: (value: string) => void;
|
|
23
|
+
// tableStates: CraftTableOptionsProps;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const ViewMore = ({
|
|
@@ -45,6 +46,17 @@ const ViewMore = ({
|
|
|
45
46
|
setAnchorEl(null);
|
|
46
47
|
};
|
|
47
48
|
|
|
49
|
+
// const { wrapColumns, globalWrapColumns, setGlobalWrapColumns } = tableStates;
|
|
50
|
+
|
|
51
|
+
// const toggleGlobalWrap = (value: boolean | null) => {
|
|
52
|
+
// setGlobalWrapColumns(value); // true = wrap all, false = un-wrap all, null = use wrapState
|
|
53
|
+
// };
|
|
54
|
+
|
|
55
|
+
// const isWrapped =
|
|
56
|
+
// globalWrapColumns !== null
|
|
57
|
+
// ? globalWrapColumns
|
|
58
|
+
// : !!wrapColumns[cell.column.id];
|
|
59
|
+
|
|
48
60
|
return (
|
|
49
61
|
<>
|
|
50
62
|
<div onClick={handleClick}>
|
|
@@ -15,6 +15,10 @@ export function useCraftTable() {
|
|
|
15
15
|
const [sorting, setSorting] = useState<SortingState>([]);
|
|
16
16
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
|
17
17
|
const [expanded, setExpanded] = useState<ExpandedState>({});
|
|
18
|
+
const [wrapColumns, setWrapColumns] = useState<Record<string, boolean>>({});
|
|
19
|
+
const [globalWrapColumns, setGlobalWrapColumns] = useState<boolean | null>(
|
|
20
|
+
null
|
|
21
|
+
);
|
|
18
22
|
|
|
19
23
|
if (pagination.pageIndex < 0 || pagination.pageSize <= 0) {
|
|
20
24
|
throw new Error(
|
|
@@ -31,6 +35,10 @@ export function useCraftTable() {
|
|
|
31
35
|
setRowSelection: setRowSelection,
|
|
32
36
|
expanded: expanded,
|
|
33
37
|
setExpanded: setExpanded,
|
|
38
|
+
wrapColumns: wrapColumns,
|
|
39
|
+
setWrapColumns: setWrapColumns,
|
|
40
|
+
globalWrapColumns: globalWrapColumns,
|
|
41
|
+
setGlobalWrapColumns: setGlobalWrapColumns,
|
|
34
42
|
};
|
|
35
43
|
|
|
36
44
|
return craftTableOptions;
|
|
@@ -11,7 +11,7 @@ export const useDefaultColumns = () => {
|
|
|
11
11
|
header: "First Name",
|
|
12
12
|
id: "firstName",
|
|
13
13
|
accessorKey: "firstName",
|
|
14
|
-
meta: { label: "First Name" },
|
|
14
|
+
// meta: { label: "First Name" },
|
|
15
15
|
// header: ({ table }) => (
|
|
16
16
|
// <>
|
|
17
17
|
// <button
|
|
@@ -57,7 +57,13 @@ export const useDefaultColumns = () => {
|
|
|
57
57
|
header: "Last Name",
|
|
58
58
|
accessorKey: "lastName",
|
|
59
59
|
size: 100,
|
|
60
|
-
meta: {
|
|
60
|
+
meta: { wrap: true },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
header: "Email Id",
|
|
64
|
+
accessorKey: "email",
|
|
65
|
+
size: 150,
|
|
66
|
+
meta: { label: "Email" },
|
|
61
67
|
},
|
|
62
68
|
{
|
|
63
69
|
header: "Age",
|
|
@@ -8,6 +8,7 @@ export type Person = {
|
|
|
8
8
|
progress: number;
|
|
9
9
|
status: "Active" | "Inactive";
|
|
10
10
|
department?: string;
|
|
11
|
+
email?: string;
|
|
11
12
|
subRows?: Person[];
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -26,6 +27,7 @@ const newPerson = (): Person => {
|
|
|
26
27
|
age: faker.number.int(40),
|
|
27
28
|
visits: faker.number.int(1000),
|
|
28
29
|
progress: faker.number.int(100),
|
|
30
|
+
email: faker.internet.email(),
|
|
29
31
|
department: faker.helpers.shuffle<string>([
|
|
30
32
|
"HR",
|
|
31
33
|
"Engineering",
|
package/src/types/common.ts
CHANGED
|
@@ -28,3 +28,13 @@ export type alignProps = "left" | "center" | "right";
|
|
|
28
28
|
export interface align {
|
|
29
29
|
align: alignProps;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
export const camelCaseToTitle = (str: string): string => {
|
|
33
|
+
if (!str) return "";
|
|
34
|
+
|
|
35
|
+
return str
|
|
36
|
+
.replace(/_/g, " ") // Replace underscores with spaces
|
|
37
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2") // Add space between camelCase transitions
|
|
38
|
+
.replace(/\b\w/g, (char) => char.toUpperCase()) // Capitalize each word's first letter
|
|
39
|
+
.trim();
|
|
40
|
+
};
|
|
@@ -17,6 +17,10 @@ export interface CraftTableOptionsProps {
|
|
|
17
17
|
setIsCompactTable?: Dispatch<SetStateAction<boolean>>;
|
|
18
18
|
expanded: ExpandedState;
|
|
19
19
|
setExpanded: Dispatch<SetStateAction<ExpandedState>>;
|
|
20
|
+
wrapColumns: Record<string, boolean>;
|
|
21
|
+
setWrapColumns: Dispatch<SetStateAction<Record<string, boolean>>>;
|
|
22
|
+
globalWrapColumns: boolean | null;
|
|
23
|
+
setGlobalWrapColumns: Dispatch<SetStateAction<boolean | null>>;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
export interface CraftTableFeatureProps {
|
package/src/types/table.ts
CHANGED
|
@@ -57,9 +57,11 @@ export interface CraftTableComponentProps<T> {
|
|
|
57
57
|
columnOrder: ColumnOrderState;
|
|
58
58
|
setColumnOrder: React.Dispatch<React.SetStateAction<ColumnOrderState>>;
|
|
59
59
|
isCompactTable: boolean;
|
|
60
|
+
tableStates: CraftTableOptionsProps;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export interface TableHeaderProps<T> {
|
|
63
64
|
header: Header<T, unknown>;
|
|
64
65
|
featureOptions: CraftTableFeatureProps;
|
|
66
|
+
tableStates: CraftTableOptionsProps;
|
|
65
67
|
}
|