@react-fabric/data 1.0.0-beta.3 → 1.0.0-beta.30

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 (80) hide show
  1. package/dist/cjs/checklist/CheckList.js +143 -0
  2. package/dist/cjs/histogram/Histogram.js +16 -5
  3. package/dist/cjs/hooks/usePagination.js +7 -4
  4. package/dist/cjs/hooks/useSelectableList.js +54 -0
  5. package/dist/cjs/index.js +2 -0
  6. package/dist/cjs/table/BodyCell.js +38 -5
  7. package/dist/cjs/table/BodyRow.js +107 -0
  8. package/dist/cjs/table/CheckboxCell.js +1 -1
  9. package/dist/cjs/table/HeaderCell.js +29 -36
  10. package/dist/cjs/table/Table.js +104 -66
  11. package/dist/cjs/table/useResizer.js +4 -4
  12. package/dist/cjs/table/useVirtualTable.js +118 -17
  13. package/dist/cjs/tree/TreeNode.js +44 -24
  14. package/dist/cjs/tree/TreePanel.js +28 -10
  15. package/dist/cjs/tree/useTree.js +96 -14
  16. package/dist/cjs/tree/utils.js +20 -5
  17. package/dist/cjs/virtual/Gallery.js +41 -27
  18. package/dist/cjs/virtual/List.js +41 -29
  19. package/dist/esm/checklist/CheckList.js +143 -0
  20. package/dist/esm/histogram/Histogram.js +16 -5
  21. package/dist/esm/hooks/usePagination.js +7 -4
  22. package/dist/esm/hooks/useSelectableList.js +54 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/table/BodyCell.js +38 -5
  25. package/dist/esm/table/BodyRow.js +107 -0
  26. package/dist/esm/table/CheckboxCell.js +1 -1
  27. package/dist/esm/table/HeaderCell.js +30 -37
  28. package/dist/esm/table/Table.js +106 -68
  29. package/dist/esm/table/useResizer.js +4 -4
  30. package/dist/esm/table/useVirtualTable.js +120 -19
  31. package/dist/esm/tree/TreeNode.js +46 -26
  32. package/dist/esm/tree/TreePanel.js +28 -10
  33. package/dist/esm/tree/useTree.js +98 -16
  34. package/dist/esm/tree/utils.js +20 -5
  35. package/dist/esm/virtual/Gallery.js +41 -27
  36. package/dist/esm/virtual/List.js +41 -29
  37. package/dist/types/checklist/CheckList.d.ts +30 -0
  38. package/dist/types/histogram/Histogram.d.ts +3 -3
  39. package/dist/types/hooks/useSelectableList.d.ts +28 -0
  40. package/dist/types/index.d.ts +2 -1
  41. package/dist/types/table/AddColumn.d.ts +2 -2
  42. package/dist/types/table/BodyCell.d.ts +4 -3
  43. package/dist/types/table/BodyRow.d.ts +20 -0
  44. package/dist/types/table/EmptyCell.d.ts +2 -2
  45. package/dist/types/table/HeaderCell.d.ts +2 -2
  46. package/dist/types/table/Table.d.ts +1 -1
  47. package/dist/types/table/types.d.ts +19 -8
  48. package/dist/types/table/useTableColumns.d.ts +6 -6
  49. package/dist/types/table/useVirtualTable.d.ts +20 -5
  50. package/dist/types/tree/TreeNode.d.ts +1 -1
  51. package/dist/types/tree/TreePanel.d.ts +1 -1
  52. package/dist/types/tree/types.d.ts +25 -5
  53. package/dist/types/tree/useTree.d.ts +2 -9
  54. package/dist/types/tree/utils.d.ts +4 -1
  55. package/dist/types/virtual/Gallery.d.ts +11 -3
  56. package/dist/types/virtual/List.d.ts +7 -3
  57. package/package.json +8 -7
  58. package/src/checklist/CheckList.tsx +222 -0
  59. package/src/histogram/Histogram.tsx +9 -2
  60. package/src/hooks/usePagination.tsx +13 -7
  61. package/src/hooks/useSelectableList.ts +94 -0
  62. package/src/index.ts +2 -1
  63. package/src/table/AddColumn.tsx +2 -2
  64. package/src/table/BodyCell.tsx +34 -5
  65. package/src/table/BodyRow.tsx +143 -0
  66. package/src/table/CheckboxCell.tsx +1 -1
  67. package/src/table/EmptyCell.tsx +2 -2
  68. package/src/table/HeaderCell.tsx +27 -13
  69. package/src/table/Table.tsx +141 -73
  70. package/src/table/types.ts +22 -7
  71. package/src/table/useResizer.ts +5 -3
  72. package/src/table/useTableColumns.ts +7 -7
  73. package/src/table/useVirtualTable.ts +142 -27
  74. package/src/tree/TreeNode.tsx +90 -56
  75. package/src/tree/TreePanel.tsx +23 -3
  76. package/src/tree/types.ts +32 -4
  77. package/src/tree/useTree.ts +102 -23
  78. package/src/tree/utils.ts +23 -8
  79. package/src/virtual/Gallery.tsx +43 -32
  80. package/src/virtual/List.tsx +38 -25
@@ -23,6 +23,7 @@
23
23
 
24
24
  import {
25
25
  CoreIcons,
26
+ Divider,
26
27
  DropdownTool,
27
28
  Icon,
28
29
  Menu,
@@ -35,7 +36,7 @@ import {
35
36
  COL_DEFAULT_WIDTH,
36
37
  COL_MAX_WIDTH,
37
38
  COL_MIN_WIDTH,
38
- type ColumnType,
39
+ type TableColumn,
39
40
  type TableProps,
40
41
  } from "./types";
41
42
 
@@ -48,6 +49,7 @@ export const HeaderCell = ({
48
49
  rtlFlip,
49
50
  actions,
50
51
  locked,
52
+ tooltip,
51
53
  sortable,
52
54
  resizable,
53
55
  width: _width,
@@ -55,7 +57,7 @@ export const HeaderCell = ({
55
57
  minWidth,
56
58
  sort,
57
59
  onSort,
58
- }: ColumnType & Pick<TableProps, "sort" | "onSort">) => {
60
+ }: TableColumn & Pick<TableProps, "sort" | "onSort">) => {
59
61
  const { startResize, widths } = useTableContext();
60
62
 
61
63
  const width = useMemo(
@@ -63,13 +65,17 @@ export const HeaderCell = ({
63
65
  [widths, _width, id],
64
66
  );
65
67
 
66
- const handleSort = useCallback(() => {
67
- sortable &&
68
- onSort?.({
69
- id: id.toString(),
70
- order: sort?.id === id && sort.order === "asc" ? "desc" : "asc",
71
- });
72
- }, [onSort, name, sort, sortable]);
68
+ const handleSort = useCallback(
69
+ (order?: "asc" | "desc") => {
70
+ sortable &&
71
+ onSort?.({
72
+ id: id.toString(),
73
+ order:
74
+ order ?? (sort?.id === id && sort.order === "asc" ? "desc" : "asc"),
75
+ });
76
+ },
77
+ [onSort, sort, sortable],
78
+ );
73
79
 
74
80
  const menus = useMemo(() => {
75
81
  const ret = [];
@@ -79,30 +85,38 @@ export const HeaderCell = ({
79
85
  key="sort-asc"
80
86
  label="Sort ascending"
81
87
  icon={CoreIcons.sortAsc}
88
+ onClick={() => handleSort("asc")}
82
89
  />,
83
90
  <MenuItem
84
91
  key="sort-desc"
85
92
  label="Sort descending"
86
93
  icon={CoreIcons.sortDesc}
94
+ onClick={() => handleSort("desc")}
87
95
  />,
88
96
  );
89
97
  }
98
+ if (sortable && actions) {
99
+ ret.push(<Divider />);
100
+ }
101
+ if (actions) {
102
+ ret.push(...actions);
103
+ }
90
104
  return ret;
91
- }, [sortable]);
105
+ }, [sortable, actions]);
92
106
 
93
107
  return (
94
108
  <div
95
109
  role="none"
96
110
  data-id={id}
97
- onClick={handleSort}
98
- className="group font-medium border-e flex flex-nowrap text-start items-center table-header-cell"
111
+ onClick={() => handleSort()}
112
+ className="group/tool font-medium border-e flex flex-nowrap text-start items-center table-header-cell"
99
113
  style={{
100
114
  width: width ?? COL_DEFAULT_WIDTH,
101
115
  minWidth: minWidth ?? COL_MIN_WIDTH,
102
116
  maxWidth: maxWidth ?? COL_MAX_WIDTH,
103
117
  }}
104
118
  >
105
- <Tooltip content={label} disabled={!label}>
119
+ <Tooltip content={tooltip ?? label} disabled={!(tooltip ?? label)}>
106
120
  <div className="flex-initial px-2 py-1 text-sm truncate sticky start-0">
107
121
  {icon && (
108
122
  <Icon icon={icon} bg={iconBg} color={iconColor} rtlFlip={rtlFlip} />
@@ -21,12 +21,25 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { EmptyContent, Loading, useDebounce } from "@react-fabric/core";
24
+ import {
25
+ CoreIcons,
26
+ EmptyContent,
27
+ Icon,
28
+ Loading,
29
+ useDebounce,
30
+ } from "@react-fabric/core";
31
+ import { debounce } from "@react-fabric/utilities";
25
32
  import classNames from "classnames";
26
- import { useImperativeHandle, useMemo, useRef } from "react";
33
+ import {
34
+ useEffect,
35
+ useImperativeHandle,
36
+ useLayoutEffect,
37
+ useMemo,
38
+ useRef,
39
+ } from "react";
27
40
  import { useTranslation } from "react-i18next";
28
41
  import { AddColumn } from "./AddColumn";
29
- import { BodyCell } from "./BodyCell";
42
+ import { BodyRow } from "./BodyRow";
30
43
  import { CheckboxCell } from "./CheckboxCell";
31
44
  import { TableProvider } from "./Context";
32
45
  import { EmptyCell } from "./EmptyCell";
@@ -39,12 +52,20 @@ export const Table = <T extends KeyValue = KeyValue>({
39
52
  ref,
40
53
  data,
41
54
  columns,
42
- keyProperty,
55
+ keyProperty = "id",
56
+ groupProperty,
43
57
  checkableRows,
58
+ initialScroll,
44
59
  hideableColumns,
45
60
  sort,
46
61
  loading,
62
+ checked,
63
+ emptyDisplay,
64
+ groupRenderer,
65
+ canExpand,
66
+ children,
47
67
  onSort,
68
+ onScroll,
48
69
  onRowClick,
49
70
  onCheckedChanged,
50
71
  }: TableProps<T>) => {
@@ -58,13 +79,24 @@ export const Table = <T extends KeyValue = KeyValue>({
58
79
  const {
59
80
  scrollerRef,
60
81
  items,
82
+ top,
61
83
  checkState,
84
+ virtualizer,
85
+ hasActiveSticky,
86
+ toggleExpand,
62
87
  toggleChecked,
63
88
  toggleAllChecked,
89
+ toggleGroupExpand,
64
90
  getData,
65
91
  totalSize,
92
+ isActiveSticky,
66
93
  measureElement,
67
- } = useVirtualTable(data, keyProperty, fireCheckChanged);
94
+ } = useVirtualTable(data, {
95
+ checked,
96
+ keyProperty,
97
+ groupProperty,
98
+ onCheckChanged: fireCheckChanged,
99
+ });
68
100
  const refBody = useRef<HTMLDivElement>(null);
69
101
 
70
102
  const wrapperStart = useMemo(
@@ -76,32 +108,51 @@ export const Table = <T extends KeyValue = KeyValue>({
76
108
  [],
77
109
  );
78
110
 
111
+ useLayoutEffect(() => {
112
+ setTimeout(() => {
113
+ initialScroll &&
114
+ virtualizer.scrollToIndex(initialScroll, { align: "start" });
115
+ }, 100);
116
+ }, []);
117
+
79
118
  useImperativeHandle(
80
119
  ref,
81
120
  () => ({
82
- hilight: (row: number) => {
83
- refBody.current
84
- ?.querySelectorAll<HTMLElement>(`.datatable-row[data-hilight="true"]`)
85
- .forEach((el) => el && (el.dataset.hilight = undefined));
86
- const el = refBody.current?.querySelector<HTMLElement>(
87
- `[data-row="${row}"]`,
88
- );
89
- el?.scrollIntoView({ behavior: "smooth", block: "center" });
90
- el && (el.dataset.hilight = "true");
121
+ scrollTo: (row: number) => {
122
+ virtualizer.scrollToIndex(row, { align: "start" });
91
123
  },
92
- unhilight: () => {
93
- refBody.current
94
- ?.querySelectorAll<HTMLElement>(`.datatable-row[data-hilight="true"]`)
95
- .forEach((el) => el && (el.dataset.hilight = undefined));
124
+ hilight(row) {
125
+ scrollerRef.current
126
+ ?.querySelector(".hilight")
127
+ ?.classList.remove("hilight", "ring-1");
128
+ virtualizer.scrollToIndex(Math.floor(row), {
129
+ align: "start",
130
+ });
131
+ setTimeout(() => {
132
+ scrollerRef.current
133
+ ?.querySelector(`[data-index="${row}"]`)
134
+ ?.classList.add("hilight", "ring-1");
135
+ }, 100);
96
136
  },
97
- scrollTo: (row: number) => {
98
- const el = refBody.current?.querySelector(`[data-row="${row}"]`);
99
- el?.scrollIntoView({ behavior: "smooth" });
137
+ unhilight() {
138
+ scrollerRef.current
139
+ ?.querySelector(".hilight")
140
+ ?.classList.remove("hilight", "ring-1");
100
141
  },
101
142
  }),
102
143
  [],
103
144
  );
104
145
 
146
+ useEffect(() => {
147
+ const handle = debounce((top: number) => {
148
+ onScroll?.(top ?? 0);
149
+ });
150
+ handle(top);
151
+ return () => {
152
+ handle.cancel();
153
+ };
154
+ }, [top]);
155
+
105
156
  return (
106
157
  <TableProvider>
107
158
  <div
@@ -109,10 +160,15 @@ export const Table = <T extends KeyValue = KeyValue>({
109
160
  style={{
110
161
  gridTemplate: `"head" auto "loader" auto "content" 1fr "foot" auto/1fr`,
111
162
  }}
163
+ data-ref="tableScroller"
112
164
  ref={scrollerRef}
113
165
  >
114
- <div className="bg-base font-medium sticky top-0 area-head border-b select-none flex flex-nowrap z-2">
166
+ <div
167
+ data-ref="tableHeader"
168
+ className="bg-base font-medium sticky top-0 area-head border-b select-none flex flex-nowrap z-2"
169
+ >
115
170
  <div className={wrapperStart}>
171
+ {canExpand && <div className="w-6" />}
116
172
  {checkableRows && (
117
173
  <CheckboxCell
118
174
  state={checkState.allChecked}
@@ -146,62 +202,72 @@ export const Table = <T extends KeyValue = KeyValue>({
146
202
  style={{ height: totalSize() }}
147
203
  ref={refBody}
148
204
  >
149
- <div style={{ height: items[0]?.start }} />
205
+ <div
206
+ style={{
207
+ height: items[hasActiveSticky ? 1 : 0]?.start,
208
+ }}
209
+ />
150
210
  {items.map(({ index, key }) => {
151
211
  const data = getData(index);
152
- return (
212
+ return "__GROUP__" in data ? (
153
213
  <div
154
214
  key={key}
155
- role="none"
156
- data-row={index}
215
+ ref={measureElement}
216
+ data-index={index}
157
217
  className={classNames(
158
- "flex flex-nowrap datatable-row data-[hilight]:outline-1 -outline-offset-1 outline-primary-500",
159
- index % 2 ? "bg-even" : "bg-odd",
160
- onRowClick && "hover:bg-primary-50 active:bg-primary-100",
218
+ "px-2 py-1 text-md bg-base border-y border-tint-100 cursor-pointer flex items-center gap-1",
219
+ isActiveSticky(index) && "sticky top-8 z-30",
161
220
  )}
162
- onClick={() =>
163
- checkableRows && !onRowClick
164
- ? toggleChecked(data[keyProperty])
165
- : onRowClick?.(data)
166
- }
167
- data-index={index}
168
- ref={measureElement}
221
+ role="none"
222
+ onClick={() => toggleGroupExpand(data.key)}
169
223
  >
170
- <div className={wrapperStart}>
171
- {checkableRows && (
172
- <CheckboxCell
173
- onClick={() => toggleChecked(data[keyProperty])}
174
- state={
175
- checkState.checked.includes(data[keyProperty]) ? 1 : 0
176
- }
177
- />
178
- )}
179
- {state.start?.map((col, ids) => (
180
- <BodyCell
181
- key={`${key}:${ids}`}
182
- column={col}
183
- item={data}
184
- />
185
- ))}
186
- </div>
187
- {state.cols?.map((col, idc) => (
188
- <BodyCell key={`${key}:${idc}`} column={col} item={data} />
189
- ))}
190
- <div className={wrapperEnd}>
191
- {state.end?.map((col, ide) => (
192
- <BodyCell
193
- key={`${key}:${ide}`}
194
- column={col}
195
- item={data}
196
- />
197
- ))}
198
- {hideableColumns && <div className="w-6" />}
199
- </div>
224
+ <Icon
225
+ rtlFlip
226
+ icon={
227
+ data.open ? CoreIcons.chevronDown : CoreIcons.chevronRight
228
+ }
229
+ />
230
+ {groupRenderer?.(data) ?? (
231
+ <div className="flex gap-1 items-center">
232
+ <span>{data.key}</span>
233
+ <span className="text-sm">({data.itemCount})</span>
234
+ </div>
235
+ )}
200
236
  </div>
237
+ ) : (
238
+ <BodyRow
239
+ rowKey={key}
240
+ index={index}
241
+ checkableRows={checkableRows}
242
+ checked={
243
+ keyProperty &&
244
+ checkState.checked.includes(data[keyProperty])
245
+ ? 1
246
+ : 0
247
+ }
248
+ expanded={
249
+ !!keyProperty &&
250
+ checkState.expanded.includes(data[keyProperty])
251
+ }
252
+ data={data}
253
+ hideableColumns={hideableColumns}
254
+ keyProperty={keyProperty}
255
+ measureElement={measureElement}
256
+ onRowClick={onRowClick}
257
+ state={state}
258
+ canExpand={canExpand}
259
+ toggleExpand={toggleExpand}
260
+ expandRow={children}
261
+ toggleChecked={toggleChecked}
262
+ wrapperEnd={wrapperEnd}
263
+ wrapperStart={wrapperStart}
264
+ key={key}
265
+ />
201
266
  );
202
267
  })}
203
268
  <div className="flex-1 flex flex-nowrap">
204
269
  <div className={wrapperStart}>
270
+ {canExpand && <div className="w-6" />}
205
271
  {checkableRows && <div className="w-6" />}
206
272
  {state.start?.map((col) => (
207
273
  <EmptyCell key={String(col.id)} {...col} />
@@ -220,13 +286,15 @@ export const Table = <T extends KeyValue = KeyValue>({
220
286
  </div>
221
287
  </div>
222
288
  )}
223
- {!loading && data.length === 0 && (
224
- <EmptyContent
225
- size="sm"
226
- className="bg-dimmed"
227
- message={t("datagrid.empty")}
228
- />
229
- )}
289
+ {!loading &&
290
+ data.length === 0 &&
291
+ (emptyDisplay ?? (
292
+ <EmptyContent
293
+ size="sm"
294
+ className="bg-dimmed"
295
+ message={t("datagrid.empty")}
296
+ />
297
+ ))}
230
298
  </div>
231
299
  </TableProvider>
232
300
  );
@@ -23,6 +23,7 @@
23
23
 
24
24
  import {
25
25
  type CssProp,
26
+ type Elements,
26
27
  type IconProps,
27
28
  type RefProp,
28
29
  type TestProps,
@@ -33,16 +34,18 @@ export const COL_MIN_WIDTH = "3rem";
33
34
  export const COL_MAX_WIDTH = "64rem";
34
35
  export const COL_DEFAULT_WIDTH = "12rem";
35
36
 
36
- export interface ColumnType<T = KeyValue>
37
+ export interface TableColumn<T = KeyValue>
37
38
  extends CssProp,
38
39
  IconProps,
39
40
  TestProps {
40
- id: keyof T;
41
+ id: keyof T | string;
41
42
  label?: string;
42
- actions?: ReactElement;
43
+ tooltip?: string;
44
+ actions?: ReactElement[];
43
45
  align?: "start" | "center" | "end";
44
46
  locked?: "start" | "end";
45
47
  hidden?: boolean;
48
+ truncate?: boolean;
46
49
  hideable?: boolean;
47
50
  resizable?: boolean;
48
51
  sortable?: boolean;
@@ -60,7 +63,8 @@ export interface ColumnType<T = KeyValue>
60
63
  | "time"
61
64
  | "unknown";
62
65
  format?: string;
63
- renderer?: (value: AnyObject, data: T) => void;
66
+ valueMap?: KeyValue;
67
+ renderer?: (value: AnyObject, data: T, index: number) => Elements<AnyObject>;
64
68
  }
65
69
 
66
70
  export interface TableRef {
@@ -70,14 +74,19 @@ export interface TableRef {
70
74
  }
71
75
 
72
76
  export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
73
- columns: Array<ColumnType<T>>;
77
+ columns: Array<TableColumn<T>>;
74
78
  data: T[];
75
- keyProperty: keyof T;
79
+ keyProperty?: keyof T;
80
+ groupProperty?: keyof T;
81
+ groupRenderer?: (key: AnyObject) => ReactElement;
82
+ emptyDisplay?: ReactElement;
83
+
76
84
  /**
77
85
  * checkable rows
78
86
  */
87
+ checked?: AnyObject[];
79
88
  checkableRows?: boolean;
80
- onCheckedChanged?: (rows: Array<keyof T>) => void;
89
+ onCheckedChanged?: (rows: AnyObject[]) => void;
81
90
  /**
82
91
  * sorting
83
92
  */
@@ -88,4 +97,10 @@ export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
88
97
  hideableColumns?: boolean;
89
98
 
90
99
  onRowClick?: (data: T) => void;
100
+
101
+ initialScroll?: number;
102
+ onScroll?: (firstItem: number) => void;
103
+
104
+ canExpand?: (record: T) => boolean;
105
+ children?: (record: T) => Elements<AnyObject>;
91
106
  }
@@ -47,13 +47,15 @@ export const useResizer = (
47
47
  /** ***************** attach handlers *******************/
48
48
  const box = colEl.getBoundingClientRect();
49
49
  if (colEl.parentElement != null) {
50
- const parentBox = colEl.parentElement?.getBoundingClientRect();
50
+ const parentBox = colEl
51
+ .closest("[data-ref='tableScroller']")
52
+ ?.getBoundingClientRect() as unknown as DOMRect;
51
53
  if (isRtl) {
52
54
  placeholder.style.left = "unset";
53
- placeholder.style.right = `${box.right - parentBox.right}px`;
55
+ placeholder.style.right = `${parentBox.width - box.right}px`;
54
56
  } else {
55
57
  placeholder.style.right = "unset";
56
- placeholder.style.left = `${box.left - parentBox.left}px`;
58
+ placeholder.style.left = `${box.left}px`;
57
59
  }
58
60
  }
59
61
  placeholder.style.width = `${colEl.offsetWidth}px`;
@@ -23,20 +23,20 @@
23
23
 
24
24
  import { groupBy } from "@react-fabric/utilities";
25
25
  import { useEffect, useReducer } from "react";
26
- import { type ColumnType } from "./types";
26
+ import { type TableColumn } from "./types";
27
27
 
28
28
  interface ColumnState {
29
- columns: ColumnType[];
30
- start: ColumnType[];
31
- end: ColumnType[];
32
- cols: ColumnType[];
29
+ columns: TableColumn[];
30
+ start: TableColumn[];
31
+ end: TableColumn[];
32
+ cols: TableColumn[];
33
33
  }
34
34
 
35
35
  type ColumnActions =
36
- | { type: "columns"; columns: ColumnType[] }
36
+ | { type: "columns"; columns: TableColumn[] }
37
37
  | { type: "hide"; id: string };
38
38
 
39
- export const useTableColumns = (columns: ColumnType[]) => {
39
+ export const useTableColumns = (columns: TableColumn[]) => {
40
40
  const [state, dispatch] = useReducer(
41
41
  (state: ColumnState, action: ColumnActions) => {
42
42
  if (action.type === "columns") {