@vuu-ui/vuu-table 0.8.17-debug → 0.8.18-debug

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 (63) hide show
  1. package/cjs/index.js +444 -372
  2. package/cjs/index.js.map +4 -4
  3. package/esm/index.js +328 -264
  4. package/esm/index.js.map +4 -4
  5. package/index.css +32 -40
  6. package/index.css.map +3 -3
  7. package/package.json +12 -13
  8. package/types/{vuu-table/src/Table.d.ts → Table.d.ts} +8 -5
  9. package/types/{vuu-table/src/cell-renderers → cell-renderers}/cell-utils.d.ts +1 -1
  10. package/types/{vuu-table/src/cell-renderers → cell-renderers}/index.d.ts +1 -2
  11. package/types/{vuu-table/src/column-resizing → column-resizing}/useTableColumnResize.d.ts +1 -3
  12. package/types/{vuu-table/src/context-menu → context-menu}/buildContextMenuDescriptors.d.ts +1 -2
  13. package/types/{vuu-table/src/context-menu → context-menu}/useHandleTableContextMenu.d.ts +1 -2
  14. package/types/{vuu-table/src/header-cell → header-cell}/GroupHeaderCellNext.d.ts +1 -2
  15. package/types/header-cell/HeaderCell.d.ts +4 -0
  16. package/types/{vuu-table/src/index.d.ts → index.d.ts} +1 -0
  17. package/types/{vuu-table/src/table-header → table-header}/TableHeader.d.ts +2 -3
  18. package/types/{vuu-table/src/useDataSource.d.ts → useDataSource.d.ts} +3 -2
  19. package/types/{vuu-table/src/useSelection.d.ts → useSelection.d.ts} +2 -2
  20. package/types/{vuu-table/src/useTable.d.ts → useTable.d.ts} +1 -2
  21. package/types/useTableAndColumnSettings.d.ts +15 -0
  22. package/types/{vuu-table/src/useTableContextMenu.d.ts → useTableContextMenu.d.ts} +1 -2
  23. package/types/{vuu-table/src/useTableModel.d.ts → useTableModel.d.ts} +2 -4
  24. package/types/{vuu-table/src/useVirtualViewport.d.ts → useVirtualViewport.d.ts} +2 -2
  25. package/types/vuu-table/src/cell-renderers/dropdown-cell/DropdownCell.d.ts +0 -4
  26. package/types/vuu-table/src/cell-renderers/dropdown-cell/index.d.ts +0 -1
  27. package/types/vuu-table/src/cell-renderers/lookup-cell/LookupCell.d.ts +0 -3
  28. package/types/vuu-table/src/cell-renderers/lookup-cell/index.d.ts +0 -1
  29. package/types/vuu-table/src/header-cell/HeaderCell.d.ts +0 -10
  30. package/types/vuu-ui-controls/src/drag-drop/DragDropState.d.ts +0 -15
  31. package/types/vuu-ui-controls/src/drag-drop/dragDropTypesNext.d.ts +0 -91
  32. /package/types/{vuu-table/src/Row.d.ts → Row.d.ts} +0 -0
  33. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/checkbox-cell/CheckboxCell.d.ts +0 -0
  34. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/checkbox-cell/index.d.ts +0 -0
  35. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/input-cell/InputCell.d.ts +0 -0
  36. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/input-cell/index.d.ts +0 -0
  37. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/toggle-cell/ToggleCell.d.ts +0 -0
  38. /package/types/{vuu-table/src/cell-renderers → cell-renderers}/toggle-cell/index.d.ts +0 -0
  39. /package/types/{vuu-table/src/column-header-pill → column-header-pill}/ColumnHeaderPill.d.ts +0 -0
  40. /package/types/{vuu-table/src/column-header-pill → column-header-pill}/GroupColumnPill.d.ts +0 -0
  41. /package/types/{vuu-table/src/column-header-pill → column-header-pill}/SortIndicator.d.ts +0 -0
  42. /package/types/{vuu-table/src/column-header-pill → column-header-pill}/index.d.ts +0 -0
  43. /package/types/{vuu-table/src/column-menu → column-menu}/ColumnMenu.d.ts +0 -0
  44. /package/types/{vuu-table/src/column-menu → column-menu}/index.d.ts +0 -0
  45. /package/types/{vuu-table/src/column-resizing → column-resizing}/ColumnResizer.d.ts +0 -0
  46. /package/types/{vuu-table/src/column-resizing → column-resizing}/index.d.ts +0 -0
  47. /package/types/{vuu-table/src/context-menu → context-menu}/index.d.ts +0 -0
  48. /package/types/{vuu-table/src/header-cell → header-cell}/index.d.ts +0 -0
  49. /package/types/{vuu-table/src/moving-window.d.ts → moving-window.d.ts} +0 -0
  50. /package/types/{vuu-table/src/table-cell → table-cell}/TableCell.d.ts +0 -0
  51. /package/types/{vuu-table/src/table-cell → table-cell}/TableGroupCell.d.ts +0 -0
  52. /package/types/{vuu-table/src/table-cell → table-cell}/index.d.ts +0 -0
  53. /package/types/{vuu-table/src/table-config.d.ts → table-config.d.ts} +0 -0
  54. /package/types/{vuu-table/src/table-dom-utils.d.ts → table-dom-utils.d.ts} +0 -0
  55. /package/types/{vuu-table/src/table-header → table-header}/useTableHeader.d.ts +0 -0
  56. /package/types/{vuu-table/src/useCell.d.ts → useCell.d.ts} +0 -0
  57. /package/types/{vuu-table/src/useCellEditing.d.ts → useCellEditing.d.ts} +0 -0
  58. /package/types/{vuu-table/src/useControlledTableNavigation.d.ts → useControlledTableNavigation.d.ts} +0 -0
  59. /package/types/{vuu-table/src/useInitialValue.d.ts → useInitialValue.d.ts} +0 -0
  60. /package/types/{vuu-table/src/useKeyboardNavigation.d.ts → useKeyboardNavigation.d.ts} +0 -0
  61. /package/types/{vuu-table/src/useResizeObserver.d.ts → useResizeObserver.d.ts} +0 -0
  62. /package/types/{vuu-table/src/useTableScroll.d.ts → useTableScroll.d.ts} +0 -0
  63. /package/types/{vuu-table/src/useTableViewport.d.ts → useTableViewport.d.ts} +0 -0
package/esm/index.js CHANGED
@@ -1,10 +1,80 @@
1
1
  // src/header-cell/GroupHeaderCellNext.tsx
2
- import cx3 from "classnames";
2
+ import { OverflowContainer } from "@vuu-ui/vuu-layout";
3
+ import { useLayoutEffectSkipFirst } from "@vuu-ui/vuu-utils";
4
+ import cx3 from "clsx";
3
5
  import { useCallback as useCallback4, useRef as useRef3, useState as useState2 } from "react";
4
6
 
7
+ // src/column-header-pill/ColumnHeaderPill.tsx
8
+ import cx from "clsx";
9
+ import { useCallback } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var classBase = "vuuColumnHeaderPill";
12
+ var ColumnHeaderPill = ({
13
+ children,
14
+ className,
15
+ column,
16
+ onRemove,
17
+ removable,
18
+ ...htmlAttributes
19
+ }) => {
20
+ if (removable && typeof onRemove !== "function") {
21
+ throw Error(
22
+ "ColumnHeaderPill onRemove prop must be provided if Pill is removable"
23
+ );
24
+ }
25
+ const handleClickRemove = useCallback(
26
+ (evt) => {
27
+ evt.preventDefault();
28
+ evt.stopPropagation();
29
+ onRemove == null ? void 0 : onRemove(column);
30
+ },
31
+ [column, onRemove]
32
+ );
33
+ return /* @__PURE__ */ jsxs("div", { ...htmlAttributes, className: cx(classBase, className), children: [
34
+ children,
35
+ removable ? /* @__PURE__ */ jsx(
36
+ "span",
37
+ {
38
+ className: `${classBase}-removeButton`,
39
+ role: "button",
40
+ "data-icon": "cross",
41
+ onClick: handleClickRemove
42
+ }
43
+ ) : null
44
+ ] });
45
+ };
46
+
47
+ // src/column-header-pill/GroupColumnPill.tsx
48
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
49
+ var GroupColumnPill = ({
50
+ column,
51
+ ...columnHeaderProps
52
+ }) => {
53
+ const { name, sorted } = column;
54
+ const icon = typeof sorted === "number" ? sorted < 0 ? "arrow-down" : "arrow-up" : sorted === "A" ? "arrow-up" : sorted === "D" ? "arrow-down" : void 0;
55
+ return /* @__PURE__ */ jsxs2(ColumnHeaderPill, { ...columnHeaderProps, column, children: [
56
+ /* @__PURE__ */ jsx2("span", { className: "vuuGroupColumnPill-label", children: name }),
57
+ icon !== void 0 ? /* @__PURE__ */ jsx2("span", { "data-icon": icon }) : null,
58
+ typeof sorted === "number" ? /* @__PURE__ */ jsx2("span", { className: "vuuSortPosition", children: Math.abs(sorted) }) : null
59
+ ] });
60
+ };
61
+
62
+ // src/column-header-pill/SortIndicator.tsx
63
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
64
+ var SortIndicator = ({ column }) => {
65
+ if (!column.sorted) {
66
+ return null;
67
+ }
68
+ const icon = typeof column.sorted === "number" ? column.sorted < 0 ? "arrow-down" : "arrow-up" : column.sorted === "A" ? "arrow-up" : "arrow-down";
69
+ return /* @__PURE__ */ jsxs3(ColumnHeaderPill, { column, children: [
70
+ /* @__PURE__ */ jsx3("span", { "data-icon": icon }),
71
+ typeof column.sorted === "number" ? /* @__PURE__ */ jsx3("span", { className: "vuuSortPosition", children: Math.abs(column.sorted) }) : null
72
+ ] });
73
+ };
74
+
5
75
  // src/column-resizing/ColumnResizer.tsx
6
- import { useCallback, useRef } from "react";
7
- import { jsx } from "react/jsx-runtime";
76
+ import { useCallback as useCallback2, useRef } from "react";
77
+ import { jsx as jsx4 } from "react/jsx-runtime";
8
78
  var NOOP = () => void 0;
9
79
  var baseClass = "vuuColumnResizerNext";
10
80
  var ColumnResizer = ({
@@ -13,7 +83,7 @@ var ColumnResizer = ({
13
83
  onDragStart = NOOP
14
84
  }) => {
15
85
  const position = useRef(0);
16
- const onMouseMove = useCallback(
86
+ const onMouseMove = useCallback2(
17
87
  (e) => {
18
88
  if (e.stopPropagation) {
19
89
  e.stopPropagation();
@@ -30,7 +100,7 @@ var ColumnResizer = ({
30
100
  },
31
101
  [onDrag]
32
102
  );
33
- const onMouseUp = useCallback(
103
+ const onMouseUp = useCallback2(
34
104
  (e) => {
35
105
  window.removeEventListener("mouseup", onMouseUp);
36
106
  window.removeEventListener("mousemove", onMouseMove);
@@ -38,7 +108,7 @@ var ColumnResizer = ({
38
108
  },
39
109
  [onDragEnd, onMouseMove]
40
110
  );
41
- const handleMouseDown = useCallback(
111
+ const handleMouseDown = useCallback2(
42
112
  (e) => {
43
113
  onDragStart(e);
44
114
  position.current = Math.round(e.clientX);
@@ -53,11 +123,11 @@ var ColumnResizer = ({
53
123
  },
54
124
  [onDragStart, onMouseMove, onMouseUp]
55
125
  );
56
- return /* @__PURE__ */ jsx("div", { className: baseClass, onMouseDown: handleMouseDown });
126
+ return /* @__PURE__ */ jsx4("div", { className: baseClass, onMouseDown: handleMouseDown });
57
127
  };
58
128
 
59
129
  // src/column-resizing/useTableColumnResize.tsx
60
- import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
130
+ import { useCallback as useCallback3, useRef as useRef2, useState } from "react";
61
131
  var useTableColumnResize = ({
62
132
  column,
63
133
  onResize,
@@ -66,7 +136,7 @@ var useTableColumnResize = ({
66
136
  const widthRef = useRef2(0);
67
137
  const [isResizing, setResizing] = useState(false);
68
138
  const { name } = column;
69
- const handleResizeStart = useCallback2(() => {
139
+ const handleResizeStart = useCallback3(() => {
70
140
  if (onResize && rootRef.current) {
71
141
  const { width } = rootRef.current.getBoundingClientRect();
72
142
  widthRef.current = Math.round(width);
@@ -74,7 +144,7 @@ var useTableColumnResize = ({
74
144
  onResize == null ? void 0 : onResize("begin", name);
75
145
  }
76
146
  }, [name, onResize, rootRef]);
77
- const handleResize = useCallback2(
147
+ const handleResize = useCallback3(
78
148
  (_evt, moveBy) => {
79
149
  if (rootRef.current) {
80
150
  if (onResize) {
@@ -89,7 +159,7 @@ var useTableColumnResize = ({
89
159
  },
90
160
  [name, onResize, rootRef]
91
161
  );
92
- const handleResizeEnd = useCallback2(() => {
162
+ const handleResizeEnd = useCallback3(() => {
93
163
  if (onResize) {
94
164
  onResize("end", name, widthRef.current);
95
165
  setTimeout(() => {
@@ -107,101 +177,29 @@ var useTableColumnResize = ({
107
177
 
108
178
  // src/useCell.ts
109
179
  import { getColumnStyle } from "@vuu-ui/vuu-utils";
110
- import cx from "classnames";
180
+ import cx2 from "clsx";
111
181
  import { useMemo } from "react";
112
- var useCell = (column, classBase11, isHeader) => (
182
+ var useCell = (column, classBase10, isHeader) => (
113
183
  // TODO measure perf without the memo, might not be worth the cost
114
184
  useMemo(() => {
115
- const className = cx(classBase11, {
185
+ const className = cx2(classBase10, {
116
186
  vuuPinFloating: column.pin === "floating",
117
187
  vuuPinLeft: column.pin === "left",
118
188
  vuuPinRight: column.pin === "right",
119
189
  vuuEndPin: isHeader && column.endPin,
120
190
  // [`${classBase}-resizing`]: column.resizing,
121
- [`${classBase11}-editable`]: column.editable,
122
- [`${classBase11}-right`]: column.align === "right"
191
+ [`${classBase10}-editable`]: column.editable,
192
+ [`${classBase10}-right`]: column.align === "right"
123
193
  });
124
194
  const style = getColumnStyle(column);
125
195
  return {
126
196
  className,
127
197
  style
128
198
  };
129
- }, [column, classBase11, isHeader])
199
+ }, [column, classBase10, isHeader])
130
200
  );
131
201
 
132
- // src/column-header-pill/ColumnHeaderPill.tsx
133
- import cx2 from "classnames";
134
- import { useCallback as useCallback3 } from "react";
135
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
136
- var classBase = "vuuColumnHeaderPill";
137
- var ColumnHeaderPill = ({
138
- children,
139
- className,
140
- column,
141
- onRemove,
142
- removable,
143
- ...htmlAttributes
144
- }) => {
145
- if (removable && typeof onRemove !== "function") {
146
- throw Error(
147
- "ColumnHeaderPill onRemove prop must be provided if Pill is removable"
148
- );
149
- }
150
- const handleClickRemove = useCallback3(
151
- (evt) => {
152
- evt.preventDefault();
153
- evt.stopPropagation();
154
- onRemove == null ? void 0 : onRemove(column);
155
- },
156
- [column, onRemove]
157
- );
158
- return /* @__PURE__ */ jsxs("div", { ...htmlAttributes, className: cx2(classBase, className), children: [
159
- children,
160
- removable ? /* @__PURE__ */ jsx2(
161
- "span",
162
- {
163
- className: `${classBase}-removeButton`,
164
- role: "button",
165
- "data-icon": "cross",
166
- onClick: handleClickRemove
167
- }
168
- ) : null
169
- ] });
170
- };
171
-
172
- // src/column-header-pill/GroupColumnPill.tsx
173
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
174
- var GroupColumnPill = ({
175
- column,
176
- ...columnHeaderProps
177
- }) => {
178
- const { name, sorted } = column;
179
- const icon = typeof sorted === "number" ? sorted < 0 ? "arrow-down" : "arrow-up" : sorted === "A" ? "arrow-up" : sorted === "D" ? "arrow-down" : void 0;
180
- return /* @__PURE__ */ jsxs2(ColumnHeaderPill, { ...columnHeaderProps, column, children: [
181
- /* @__PURE__ */ jsx3("span", { className: "vuuGroupColumnPill-label", children: name }),
182
- icon !== void 0 ? /* @__PURE__ */ jsx3("span", { "data-icon": icon }) : null,
183
- typeof sorted === "number" ? /* @__PURE__ */ jsx3("span", { className: "vuuSortPosition", children: Math.abs(sorted) }) : null
184
- ] });
185
- };
186
-
187
- // src/column-header-pill/SortIndicator.tsx
188
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
189
- var SortIndicator = ({ column }) => {
190
- if (!column.sorted) {
191
- return null;
192
- }
193
- const icon = typeof column.sorted === "number" ? column.sorted < 0 ? "arrow-down" : "arrow-up" : column.sorted === "A" ? "arrow-up" : "arrow-down";
194
- return /* @__PURE__ */ jsxs3(ColumnHeaderPill, { column, children: [
195
- /* @__PURE__ */ jsx4("span", { "data-icon": icon }),
196
- typeof column.sorted === "number" ? /* @__PURE__ */ jsx4("span", { className: "vuuSortPosition", children: Math.abs(column.sorted) }) : null
197
- ] });
198
- };
199
-
200
202
  // src/header-cell/GroupHeaderCellNext.tsx
201
- import {
202
- OverflowContainer,
203
- useLayoutEffectSkipFirst
204
- } from "@vuu-ui/vuu-layout";
205
203
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
206
204
  import { createElement } from "react";
207
205
  var classBase2 = "vuuTableGroupHeaderCell";
@@ -299,11 +297,12 @@ var GroupHeaderCellNext = ({
299
297
  };
300
298
 
301
299
  // src/header-cell/HeaderCell.tsx
300
+ import cx5 from "clsx";
302
301
  import { useCallback as useCallback6, useRef as useRef5 } from "react";
303
302
 
304
303
  // src/column-menu/ColumnMenu.tsx
305
304
  import { useContextMenu } from "@vuu-ui/vuu-popups";
306
- import cx4 from "classnames";
305
+ import cx4 from "clsx";
307
306
  import {
308
307
  useCallback as useCallback5,
309
308
  useRef as useRef4,
@@ -355,7 +354,6 @@ var ColumnMenu = ({
355
354
  };
356
355
 
357
356
  // src/header-cell/HeaderCell.tsx
358
- import cx5 from "classnames";
359
357
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
360
358
  var classBase3 = "vuuTableHeaderCell";
361
359
  var HeaderCell = ({
@@ -406,17 +404,16 @@ var HeaderCell = ({
406
404
 
407
405
  // src/Table.tsx
408
406
  import {
409
- MeasuredContainer,
410
- useId
407
+ MeasuredContainer
411
408
  } from "@vuu-ui/vuu-layout";
412
409
  import { ContextMenuProvider } from "@vuu-ui/vuu-popups";
413
- import { metadataKeys as metadataKeys7 } from "@vuu-ui/vuu-utils";
410
+ import { metadataKeys as metadataKeys7, useId } from "@vuu-ui/vuu-utils";
414
411
  import { useForkRef } from "@salt-ds/core";
415
- import cx9 from "classnames";
412
+ import cx9 from "clsx";
416
413
  import {
417
414
  forwardRef,
418
- useRef as useRef14,
419
- useState as useState6
415
+ useRef as useRef15,
416
+ useState as useState7
420
417
  } from "react";
421
418
 
422
419
  // src/Row.tsx
@@ -428,7 +425,7 @@ import {
428
425
  isNotHidden,
429
426
  RowSelected
430
427
  } from "@vuu-ui/vuu-utils";
431
- import cx7 from "classnames";
428
+ import cx7 from "clsx";
432
429
  import { memo, useCallback as useCallback9 } from "react";
433
430
 
434
431
  // src/table-cell/TableCell.tsx
@@ -491,7 +488,7 @@ var TableCell = ({
491
488
  // src/table-cell/TableGroupCell.tsx
492
489
  import { getGroupValueAndOffset, metadataKeys } from "@vuu-ui/vuu-utils";
493
490
  import { useCallback as useCallback8 } from "react";
494
- import cx6 from "classnames";
491
+ import cx6 from "clsx";
495
492
  import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
496
493
  var { IS_LEAF } = metadataKeys;
497
494
  var classBase5 = "vuuTableGroupCell";
@@ -578,7 +575,7 @@ var Row = memo(
578
575
  "div",
579
576
  {
580
577
  ...htmlAttributes,
581
- "aria-rowindex": row[0],
578
+ "aria-rowindex": row[0] + 1,
582
579
  key: `row-${row[0]}`,
583
580
  role: "row",
584
581
  className,
@@ -609,10 +606,6 @@ var Row = memo(
609
606
  Row.displayName = "Row";
610
607
 
611
608
  // src/useTable.ts
612
- import {
613
- useLayoutEffectSkipFirst as useLayoutEffectSkipFirst2
614
- } from "@vuu-ui/vuu-layout";
615
- import { useTableAndColumnSettings } from "@vuu-ui/vuu-table-extras";
616
609
  import {
617
610
  useDragDropNext as useDragDrop
618
611
  } from "@vuu-ui/vuu-ui-controls";
@@ -623,13 +616,14 @@ import {
623
616
  isJsonGroup as isJsonGroup2,
624
617
  isValidNumber,
625
618
  metadataKeys as metadataKeys6,
626
- updateColumn
619
+ updateColumn,
620
+ useLayoutEffectSkipFirst as useLayoutEffectSkipFirst2
627
621
  } from "@vuu-ui/vuu-utils";
628
622
  import {
629
- useCallback as useCallback18,
623
+ useCallback as useCallback19,
630
624
  useEffect as useEffect4,
631
625
  useMemo as useMemo5,
632
- useState as useState5
626
+ useState as useState6
633
627
  } from "react";
634
628
 
635
629
  // src/context-menu/buildContextMenuDescriptors.ts
@@ -977,7 +971,7 @@ function getRowIndex(rowEl) {
977
971
  if (rowEl) {
978
972
  const idx = rowEl.ariaRowIndex;
979
973
  if (idx !== null) {
980
- return parseInt(idx, 10);
974
+ return parseInt(idx, 10) - 1;
981
975
  }
982
976
  }
983
977
  return -1;
@@ -1058,9 +1052,6 @@ var useCellEditing = ({ navigate }) => {
1058
1052
  };
1059
1053
 
1060
1054
  // src/useDataSource.ts
1061
- import {
1062
- isVuuFeatureInvocation
1063
- } from "@vuu-ui/vuu-data";
1064
1055
  import { getFullRange, NULL_RANGE } from "@vuu-ui/vuu-utils";
1065
1056
  import { useCallback as useCallback11, useEffect, useMemo as useMemo2, useRef as useRef6, useState as useState4 } from "react";
1066
1057
 
@@ -1126,6 +1117,7 @@ var MovingWindow = class {
1126
1117
  };
1127
1118
 
1128
1119
  // src/useDataSource.ts
1120
+ var isVuuFeatureInvocation = (action) => action.type === "vuu-link-created" || action.type === "vuu-link-removed";
1129
1121
  var useDataSource = ({
1130
1122
  dataSource,
1131
1123
  onFeatureInvocation,
@@ -1699,6 +1691,8 @@ import {
1699
1691
  applyGroupByToColumns,
1700
1692
  applySortToColumns,
1701
1693
  getCellRenderer,
1694
+ getColumnHeaderContentRenderer,
1695
+ getColumnHeaderLabelRenderer,
1702
1696
  getColumnLabel,
1703
1697
  getTableHeadings,
1704
1698
  getValueFormatter,
@@ -1772,7 +1766,6 @@ var useTableModel = (tableConfigProp, dataSource) => {
1772
1766
  };
1773
1767
  function init({ dataSource, tableConfig }) {
1774
1768
  const { columns, ...tableAttributes } = tableConfig;
1775
- console.log(JSON.stringify(tableAttributes, null, 2));
1776
1769
  const { config: dataSourceConfig, tableSchema } = dataSource;
1777
1770
  const runtimeColumns = columns.filter(subscribedOnly(dataSourceConfig == null ? void 0 : dataSourceConfig.columns)).map(
1778
1771
  columnDescriptorToRuntimeColumDescriptor(tableAttributes, tableSchema)
@@ -1816,8 +1809,8 @@ var columnDescriptorToRuntimeColumDescriptor = (tableAttributes, tableSchema) =>
1816
1809
  ...rest,
1817
1810
  align,
1818
1811
  CellRenderer: getCellRenderer(column),
1819
- HeaderCellLabelRenderer: getCellRenderer(column, "col-label"),
1820
- HeaderCellContentRenderer: getCellRenderer(column, "col-content"),
1812
+ HeaderCellContentRenderer: getColumnHeaderContentRenderer(column),
1813
+ HeaderCellLabelRenderer: getColumnHeaderLabelRenderer(column),
1821
1814
  clientSideEditValidationCheck: hasValidationRules(column.type) ? buildValidationChecker(column.type.renderer.rules) : void 0,
1822
1815
  label: getLabel(label, columnFormatHeader),
1823
1816
  key: key != null ? key : index + KEY_OFFSET,
@@ -2312,13 +2305,12 @@ var useTableViewport = ({
2312
2305
  // src/useVirtualViewport.ts
2313
2306
  import { useCallback as useCallback17, useEffect as useEffect3, useRef as useRef12 } from "react";
2314
2307
  var useVirtualViewport = ({
2315
- columns,
2316
2308
  getRowAtPosition,
2317
2309
  setRange,
2318
2310
  viewportMeasurements
2319
2311
  }) => {
2320
2312
  const firstRowRef = useRef12(0);
2321
- const { contentWidth, rowCount: viewportRowCount } = viewportMeasurements;
2313
+ const { rowCount: viewportRowCount } = viewportMeasurements;
2322
2314
  const handleVerticalScroll = useCallback17(
2323
2315
  (scrollTop) => {
2324
2316
  const firstRow = getRowAtPosition(scrollTop);
@@ -2339,6 +2331,132 @@ var useVirtualViewport = ({
2339
2331
  };
2340
2332
  };
2341
2333
 
2334
+ // src/useTableAndColumnSettings.ts
2335
+ import { useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
2336
+ import { getCalculatedColumnType } from "@vuu-ui/vuu-utils";
2337
+ import { useCallback as useCallback18, useRef as useRef13, useState as useState5 } from "react";
2338
+ var useTableAndColumnSettings = ({
2339
+ availableColumns: availableColumnsProps,
2340
+ onAvailableColumnsChange,
2341
+ onConfigChange,
2342
+ onCreateCalculatedColumn,
2343
+ onDataSourceConfigChange,
2344
+ tableConfig
2345
+ }) => {
2346
+ const dispatchLayoutAction = useLayoutProviderDispatch();
2347
+ const showTableSettingsRef = useRef13();
2348
+ const [availableColumns, setAvailableColumns] = useState5(
2349
+ availableColumnsProps
2350
+ );
2351
+ const showContextPanel = useCallback18(
2352
+ (componentType, title, props) => {
2353
+ dispatchLayoutAction({
2354
+ type: "set-props",
2355
+ path: "#context-panel",
2356
+ props: {
2357
+ expanded: true,
2358
+ content: {
2359
+ type: componentType,
2360
+ props
2361
+ },
2362
+ title
2363
+ }
2364
+ });
2365
+ },
2366
+ [dispatchLayoutAction]
2367
+ );
2368
+ const handleCancelCreateColumn = useCallback18(() => {
2369
+ requestAnimationFrame(() => {
2370
+ var _a;
2371
+ (_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
2372
+ });
2373
+ }, []);
2374
+ const handleCreateCalculatedColumn = useCallback18(
2375
+ (column) => {
2376
+ const newAvailableColumns = availableColumns.concat({
2377
+ name: column.name,
2378
+ serverDataType: getCalculatedColumnType(column)
2379
+ });
2380
+ setAvailableColumns(newAvailableColumns);
2381
+ onAvailableColumnsChange == null ? void 0 : onAvailableColumnsChange(newAvailableColumns);
2382
+ requestAnimationFrame(() => {
2383
+ var _a;
2384
+ (_a = showTableSettingsRef.current) == null ? void 0 : _a.call(showTableSettingsRef);
2385
+ });
2386
+ onCreateCalculatedColumn(column);
2387
+ },
2388
+ [availableColumns, onAvailableColumnsChange, onCreateCalculatedColumn]
2389
+ );
2390
+ const showColumnSettingsPanel = useCallback18(
2391
+ (action) => {
2392
+ showContextPanel("ColumnSettings", "Column Settings", {
2393
+ column: action.column,
2394
+ onCancelCreateColumn: handleCancelCreateColumn,
2395
+ onConfigChange,
2396
+ onCreateCalculatedColumn: handleCreateCalculatedColumn,
2397
+ tableConfig,
2398
+ vuuTable: action.vuuTable
2399
+ });
2400
+ },
2401
+ [
2402
+ handleCancelCreateColumn,
2403
+ handleCreateCalculatedColumn,
2404
+ onConfigChange,
2405
+ showContextPanel,
2406
+ tableConfig
2407
+ ]
2408
+ );
2409
+ const handleAddCalculatedColumn = useCallback18(() => {
2410
+ showColumnSettingsPanel({
2411
+ column: {
2412
+ name: "::",
2413
+ serverDataType: "string"
2414
+ },
2415
+ type: "columnSettings",
2416
+ vuuTable: { module: "SIMUL", table: "instruments" }
2417
+ });
2418
+ }, [showColumnSettingsPanel]);
2419
+ const handleNavigateToColumn = useCallback18(
2420
+ (columnName) => {
2421
+ const column = tableConfig.columns.find((c) => c.name === columnName);
2422
+ if (column) {
2423
+ showColumnSettingsPanel({
2424
+ type: "columnSettings",
2425
+ column,
2426
+ //TODO where do we get this from
2427
+ vuuTable: { module: "SIMUL", table: "instruments" }
2428
+ });
2429
+ }
2430
+ },
2431
+ [showColumnSettingsPanel, tableConfig.columns]
2432
+ );
2433
+ showTableSettingsRef.current = useCallback18(() => {
2434
+ showContextPanel("TableSettings", "DataGrid Settings", {
2435
+ availableColumns: availableColumns != null ? availableColumns : tableConfig.columns.map(({ name, serverDataType }) => ({
2436
+ name,
2437
+ serverDataType
2438
+ })),
2439
+ onAddCalculatedColumn: handleAddCalculatedColumn,
2440
+ onConfigChange,
2441
+ onDataSourceConfigChange,
2442
+ onNavigateToColumn: handleNavigateToColumn,
2443
+ tableConfig
2444
+ });
2445
+ }, [
2446
+ availableColumns,
2447
+ handleAddCalculatedColumn,
2448
+ handleNavigateToColumn,
2449
+ onConfigChange,
2450
+ onDataSourceConfigChange,
2451
+ showContextPanel,
2452
+ tableConfig
2453
+ ]);
2454
+ return {
2455
+ showColumnSettingsPanel,
2456
+ showTableSettingsPanel: showTableSettingsRef.current
2457
+ };
2458
+ };
2459
+
2342
2460
  // src/useTable.ts
2343
2461
  var stripInternalProperties = (tableConfig) => {
2344
2462
  return tableConfig;
@@ -2378,7 +2496,7 @@ var useTable = ({
2378
2496
  selectionModel,
2379
2497
  size
2380
2498
  }) => {
2381
- const [rowCount, setRowCount] = useState5(dataSource.size);
2499
+ const [rowCount, setRowCount] = useState6(dataSource.size);
2382
2500
  if (dataSource === void 0) {
2383
2501
  throw Error("no data source provided to Vuu Table");
2384
2502
  }
@@ -2387,7 +2505,7 @@ var useTable = ({
2387
2505
  () => buildContextMenuDescriptors(dataSource),
2388
2506
  [dataSource]
2389
2507
  );
2390
- const onDataRowcountChange = useCallback18((size2) => {
2508
+ const onDataRowcountChange = useCallback19((size2) => {
2391
2509
  setRowCount(size2);
2392
2510
  }, []);
2393
2511
  const {
@@ -2404,7 +2522,7 @@ var useTable = ({
2404
2522
  tableConfig
2405
2523
  });
2406
2524
  }, [tableConfig, dataSource, dispatchColumnAction]);
2407
- const applyTableConfigChange = useCallback18(
2525
+ const applyTableConfigChange = useCallback19(
2408
2526
  (config2) => {
2409
2527
  dispatchColumnAction({
2410
2528
  type: "init",
@@ -2415,7 +2533,7 @@ var useTable = ({
2415
2533
  },
2416
2534
  [dataSource, dispatchColumnAction, onConfigChange]
2417
2535
  );
2418
- const [stateColumns, setStateColumns] = useState5();
2536
+ const [stateColumns, setStateColumns] = useState6();
2419
2537
  const [columns, setColumnSize] = useMemo5(() => {
2420
2538
  const setSize = (columnName, width) => {
2421
2539
  const cols = updateColumn(runtimeColumns, columnName, { width });
@@ -2444,7 +2562,7 @@ var useTable = ({
2444
2562
  from: 0,
2445
2563
  to: viewportMeasurements.rowCount
2446
2564
  });
2447
- const onSubscribed = useCallback18(
2565
+ const onSubscribed = useCallback19(
2448
2566
  ({ tableSchema }) => {
2449
2567
  if (tableSchema) {
2450
2568
  dispatchColumnAction({
@@ -2459,13 +2577,14 @@ var useTable = ({
2459
2577
  );
2460
2578
  const { data, dataRef, getSelectedRows, range, setRange } = useDataSource({
2461
2579
  dataSource,
2580
+ // We need to factor this out of Table
2462
2581
  onFeatureInvocation,
2463
2582
  renderBufferSize,
2464
2583
  onSizeChange: onDataRowcountChange,
2465
2584
  onSubscribed,
2466
2585
  range: initialRange
2467
2586
  });
2468
- const handleConfigEditedInSettingsPanel = useCallback18(
2587
+ const handleConfigEditedInSettingsPanel = useCallback19(
2469
2588
  (tableConfig2) => {
2470
2589
  console.log(`settings changed`);
2471
2590
  dispatchColumnAction({
@@ -2477,7 +2596,7 @@ var useTable = ({
2477
2596
  },
2478
2597
  [dataSource, dispatchColumnAction, onConfigChange]
2479
2598
  );
2480
- const handleDataSourceConfigChanged = useCallback18(
2599
+ const handleDataSourceConfigChanged = useCallback19(
2481
2600
  (dataSourceConfig) => {
2482
2601
  dataSource.config = {
2483
2602
  ...dataSource.config,
@@ -2495,14 +2614,14 @@ var useTable = ({
2495
2614
  });
2496
2615
  });
2497
2616
  }, [dataSource, dispatchColumnAction]);
2498
- const handleCreateCalculatedColumn = useCallback18(
2617
+ const handleCreateCalculatedColumn = useCallback19(
2499
2618
  (column) => {
2500
2619
  dataSource.columns = dataSource.columns.concat(column.name);
2501
2620
  applyTableConfigChange(addColumn(tableConfig, column));
2502
2621
  },
2503
2622
  [dataSource, tableConfig, applyTableConfigChange]
2504
2623
  );
2505
- const hideColumns2 = useCallback18(
2624
+ const hideColumns2 = useCallback19(
2506
2625
  (action) => {
2507
2626
  const { columns: columns2 } = action;
2508
2627
  const hiddenColumns = columns2.map((c) => c.name);
@@ -2516,7 +2635,7 @@ var useTable = ({
2516
2635
  },
2517
2636
  [tableConfig, applyTableConfigChange]
2518
2637
  );
2519
- const pinColumn3 = useCallback18(
2638
+ const pinColumn3 = useCallback19(
2520
2639
  (action) => {
2521
2640
  applyTableConfigChange({
2522
2641
  ...tableConfig,
@@ -2539,7 +2658,7 @@ var useTable = ({
2539
2658
  onDataSourceConfigChange: handleDataSourceConfigChanged,
2540
2659
  tableConfig
2541
2660
  });
2542
- const onPersistentColumnOperation = useCallback18(
2661
+ const onPersistentColumnOperation = useCallback19(
2543
2662
  (action) => {
2544
2663
  if (isShowColumnSettings(action)) {
2545
2664
  showColumnSettingsPanel(action);
@@ -2568,7 +2687,7 @@ var useTable = ({
2568
2687
  dataSource,
2569
2688
  onPersistentColumnOperation
2570
2689
  });
2571
- const handleSort = useCallback18(
2690
+ const handleSort = useCallback19(
2572
2691
  (column, extendSort = false, sortType) => {
2573
2692
  if (dataSource) {
2574
2693
  dataSource.sort = applySort(
@@ -2581,7 +2700,7 @@ var useTable = ({
2581
2700
  },
2582
2701
  [dataSource]
2583
2702
  );
2584
- const onResizeColumn = useCallback18(
2703
+ const onResizeColumn = useCallback19(
2585
2704
  (phase, columnName, width) => {
2586
2705
  const column = columns.find((column2) => column2.name === columnName);
2587
2706
  if (column) {
@@ -2625,16 +2744,17 @@ var useTable = ({
2625
2744
  },
2626
2745
  [columns, tableConfig, dispatchColumnAction, onConfigChange, setColumnSize]
2627
2746
  );
2628
- const onToggleGroup = useCallback18(
2747
+ const onToggleGroup = useCallback19(
2629
2748
  (row, column) => {
2749
+ var _a, _b;
2630
2750
  const isJson = isJsonGroup2(column, row);
2631
2751
  const key = row[KEY];
2632
2752
  if (row[IS_EXPANDED2]) {
2633
2753
  dataSource.closeTreeNode(key, true);
2634
2754
  if (isJson) {
2635
2755
  const idx = columns.indexOf(column);
2636
- const rows = dataSource.getRowsAtDepth(idx + 1);
2637
- if (!rows.some((row2) => row2[IS_EXPANDED2] || row2[IS_LEAF2])) {
2756
+ const rows = (_a = dataSource.getRowsAtDepth) == null ? void 0 : _a.call(dataSource, idx + 1);
2757
+ if (rows && !rows.some((row2) => row2[IS_EXPANDED2] || row2[IS_LEAF2])) {
2638
2758
  dispatchColumnAction({
2639
2759
  type: "hideColumns",
2640
2760
  columns: columns.slice(idx + 2)
@@ -2644,10 +2764,10 @@ var useTable = ({
2644
2764
  } else {
2645
2765
  dataSource.openTreeNode(key);
2646
2766
  if (isJson) {
2647
- const childRows = dataSource.getChildRows(key);
2767
+ const childRows = (_b = dataSource.getChildRows) == null ? void 0 : _b.call(dataSource, key);
2648
2768
  const idx = columns.indexOf(column) + 1;
2649
2769
  const columnsToShow = [columns[idx]];
2650
- if (childRows.some((row2) => row2[IS_LEAF2])) {
2770
+ if (childRows && childRows.some((row2) => row2[IS_LEAF2])) {
2651
2771
  columnsToShow.push(columns[idx + 1]);
2652
2772
  }
2653
2773
  if (columnsToShow.some((col) => col.hidden)) {
@@ -2667,7 +2787,7 @@ var useTable = ({
2667
2787
  setRange,
2668
2788
  viewportMeasurements
2669
2789
  });
2670
- const handleVerticalScroll = useCallback18(
2790
+ const handleVerticalScroll = useCallback19(
2671
2791
  (scrollTop) => {
2672
2792
  onVerticalScroll(scrollTop);
2673
2793
  },
@@ -2706,7 +2826,7 @@ var useTable = ({
2706
2826
  } = useCellEditing({
2707
2827
  navigate
2708
2828
  });
2709
- const handleFocus = useCallback18(
2829
+ const handleFocus = useCallback19(
2710
2830
  (e) => {
2711
2831
  navigationFocus();
2712
2832
  if (!e.defaultPrevented) {
@@ -2721,13 +2841,13 @@ var useTable = ({
2721
2841
  dataSource,
2722
2842
  getSelectedRows
2723
2843
  });
2724
- const onMoveGroupColumn = useCallback18(
2844
+ const onMoveGroupColumn = useCallback19(
2725
2845
  (columns2) => {
2726
2846
  dataSource.groupBy = columns2.map((col) => col.name);
2727
2847
  },
2728
2848
  [dataSource]
2729
2849
  );
2730
- const onRemoveGroupColumn = useCallback18(
2850
+ const onRemoveGroupColumn = useCallback19(
2731
2851
  (column) => {
2732
2852
  if (isGroupColumn3(column)) {
2733
2853
  dataSource.groupBy = [];
@@ -2741,7 +2861,7 @@ var useTable = ({
2741
2861
  },
2742
2862
  [dataSource]
2743
2863
  );
2744
- const handleSelectionChange = useCallback18(
2864
+ const handleSelectionChange = useCallback19(
2745
2865
  (selected) => {
2746
2866
  dataSource.select(selected);
2747
2867
  onSelectionChange == null ? void 0 : onSelectionChange(selected);
@@ -2757,7 +2877,7 @@ var useTable = ({
2757
2877
  onSelectionChange: handleSelectionChange,
2758
2878
  selectionModel
2759
2879
  });
2760
- const handleKeyDown = useCallback18(
2880
+ const handleKeyDown = useCallback19(
2761
2881
  (e) => {
2762
2882
  navigationKeyDown(e);
2763
2883
  if (!e.defaultPrevented) {
@@ -2769,7 +2889,7 @@ var useTable = ({
2769
2889
  },
2770
2890
  [navigationKeyDown, editingKeyDown, selectionHookKeyDown]
2771
2891
  );
2772
- const handleRowClick = useCallback18(
2892
+ const handleRowClick = useCallback19(
2773
2893
  (row, rangeSelect, keepExistingSelection) => {
2774
2894
  selectionHookOnRowClick(row, rangeSelect, keepExistingSelection);
2775
2895
  onRowClickProp == null ? void 0 : onRowClickProp(row);
@@ -2783,8 +2903,11 @@ var useTable = ({
2783
2903
  dataSource
2784
2904
  });
2785
2905
  }, [config, dataSource, dispatchColumnAction]);
2786
- const onMoveColumn = useCallback18(
2906
+ const onMoveColumn = useCallback19(
2787
2907
  (columns2) => {
2908
+ console.log(`useTable onMoveColumn`, {
2909
+ columns: columns2
2910
+ });
2788
2911
  const newTableConfig = {
2789
2912
  ...tableConfig,
2790
2913
  columns: columns2
@@ -2798,17 +2921,17 @@ var useTable = ({
2798
2921
  },
2799
2922
  [dataSource, dispatchColumnAction, onConfigChange, tableConfig]
2800
2923
  );
2801
- const handleDropRow = useCallback18(
2924
+ const handleDropRow = useCallback19(
2802
2925
  (dragDropState) => {
2803
2926
  onDrop == null ? void 0 : onDrop(dragDropState);
2804
2927
  },
2805
2928
  [onDrop]
2806
2929
  );
2807
- const handleDataEdited = useCallback18(
2930
+ const handleDataEdited = useCallback19(
2808
2931
  async (row, columnName, value) => dataSource.applyEdit(row, columnName, value),
2809
2932
  [dataSource]
2810
2933
  );
2811
- const handleDragStartRow = useCallback18(
2934
+ const handleDragStartRow = useCallback19(
2812
2935
  (dragDropState) => {
2813
2936
  const { initialDragElement } = dragDropState;
2814
2937
  const rowIndex = initialDragElement.ariaRowIndex;
@@ -2868,20 +2991,20 @@ var useTable = ({
2868
2991
 
2869
2992
  // src/table-header/TableHeader.tsx
2870
2993
  import { isGroupColumn as isGroupColumn4, isNotHidden as isNotHidden2 } from "@vuu-ui/vuu-utils";
2871
- import cx8 from "classnames";
2994
+ import cx8 from "clsx";
2872
2995
 
2873
2996
  // src/table-header/useTableHeader.ts
2874
2997
  import { useDragDropNext as useDragDrop2 } from "@vuu-ui/vuu-ui-controls";
2875
2998
  import { moveColumnTo, visibleColumnAtIndex } from "@vuu-ui/vuu-utils";
2876
- import { useCallback as useCallback19, useRef as useRef13 } from "react";
2999
+ import { useCallback as useCallback20, useRef as useRef14 } from "react";
2877
3000
  var useTableHeader = ({
2878
3001
  columns,
2879
3002
  onMoveColumn,
2880
3003
  onSortColumn,
2881
3004
  tableConfig
2882
3005
  }) => {
2883
- const containerRef = useRef13(null);
2884
- const handleDropColumnHeader = useCallback19(
3006
+ const containerRef = useRef14(null);
3007
+ const handleDropColumnHeader = useCallback20(
2885
3008
  (moveFrom, moveTo) => {
2886
3009
  const column = columns[moveFrom];
2887
3010
  const orderedColumns = moveColumnTo(columns, column, moveTo);
@@ -2889,11 +3012,15 @@ var useTableHeader = ({
2889
3012
  const targetIndex = orderedColumns.findIndex(ofColumn(column));
2890
3013
  const nextColumn = orderedColumns[targetIndex + 1];
2891
3014
  const insertPos = nextColumn ? tableConfig.columns.findIndex(ofColumn(nextColumn)) : -1;
2892
- onMoveColumn(moveColumnTo(tableConfig.columns, column, insertPos));
3015
+ if (moveTo > moveFrom && insertPos !== -1) {
3016
+ onMoveColumn(moveColumnTo(tableConfig.columns, column, insertPos - 1));
3017
+ } else {
3018
+ onMoveColumn(moveColumnTo(tableConfig.columns, column, insertPos));
3019
+ }
2893
3020
  },
2894
3021
  [columns, onMoveColumn, tableConfig.columns]
2895
3022
  );
2896
- const handleColumnHeaderClick = useCallback19(
3023
+ const handleColumnHeaderClick = useCallback20(
2897
3024
  (evt) => {
2898
3025
  var _a;
2899
3026
  const targetElement = evt.target;
@@ -2931,7 +3058,7 @@ var useTableHeader = ({
2931
3058
  // src/table-header/TableHeader.tsx
2932
3059
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
2933
3060
  var TableHeader = ({
2934
- classBase: classBase11 = "vuuTable",
3061
+ classBase: classBase10 = "vuuTable",
2935
3062
  columns,
2936
3063
  headings,
2937
3064
  onMoveColumn,
@@ -2954,9 +3081,9 @@ var TableHeader = ({
2954
3081
  onSortColumn,
2955
3082
  tableConfig
2956
3083
  });
2957
- return /* @__PURE__ */ jsxs7("div", { className: `${classBase11}-col-headings`, ref: containerRef, children: [
3084
+ return /* @__PURE__ */ jsxs7("div", { className: `${classBase10}-col-headings`, ref: containerRef, children: [
2958
3085
  headings.map((colHeaders, i) => /* @__PURE__ */ jsx11("div", { className: "vuuTable-heading", children: colHeaders.map(({ label, width }, j) => /* @__PURE__ */ jsx11("div", { className: "vuuTable-headingCell", style: { width }, children: label }, j)) }, i)),
2959
- /* @__PURE__ */ jsxs7("div", { className: `${classBase11}-col-headers`, role: "row", children: [
3086
+ /* @__PURE__ */ jsxs7("div", { className: `${classBase10}-col-headers`, role: "row", children: [
2960
3087
  columns.filter(isNotHidden2).map(
2961
3088
  (col, i) => isGroupColumn4(col) ? /* @__PURE__ */ jsx11(
2962
3089
  GroupHeaderCellNext,
@@ -3113,6 +3240,7 @@ var TableCore = ({
3113
3240
  {
3114
3241
  ...tableProps,
3115
3242
  className: `${classBase7}-table`,
3243
+ role: "table",
3116
3244
  tabIndex: disableFocus ? void 0 : -1,
3117
3245
  children: [
3118
3246
  showColumnHeaders ? /* @__PURE__ */ jsx12(
@@ -3182,8 +3310,16 @@ var Table = forwardRef(function TableNext({
3182
3310
  style: styleProp,
3183
3311
  ...htmlAttributes
3184
3312
  }, forwardedRef) {
3185
- const containerRef = useRef14(null);
3186
- const [size, setSize] = useState6();
3313
+ const containerRef = useRef15(null);
3314
+ const [size, setSize] = useState7();
3315
+ if (config === void 0) {
3316
+ throw Error(
3317
+ "vuu Table requires config prop. Minimum config is list of Column Descriptors"
3318
+ );
3319
+ }
3320
+ if (dataSource === void 0) {
3321
+ throw Error("vuu Table requires dataSource prop");
3322
+ }
3187
3323
  return /* @__PURE__ */ jsx12(
3188
3324
  MeasuredContainer,
3189
3325
  {
@@ -3227,12 +3363,12 @@ var Table = forwardRef(function TableNext({
3227
3363
  });
3228
3364
 
3229
3365
  // src/cell-renderers/checkbox-cell/CheckboxCell.tsx
3230
- import { memo as memo2, useCallback as useCallback20 } from "react";
3366
+ import { memo as memo2, useCallback as useCallback21 } from "react";
3231
3367
  import { CheckboxIcon, WarnCommit } from "@vuu-ui/vuu-ui-controls";
3232
3368
  import { Checkbox } from "@salt-ds/core";
3233
3369
 
3234
3370
  // src/cell-renderers/cell-utils.ts
3235
- var dataAndColumnUnchanged = (p, p1) => p.column === p1.column && p.row[p.columnMap[p.column.name]] === p1.row[p1.columnMap[p1.column.name]];
3371
+ var dataAndColumnUnchanged = (p, p1) => p.column === p1.column && p.column.valueFormatter(p.row[p.columnMap[p.column.name]]) === p1.column.valueFormatter(p1.row[p1.columnMap[p1.column.name]]);
3236
3372
 
3237
3373
  // src/cell-renderers/checkbox-cell/CheckboxCell.tsx
3238
3374
  import { dispatchCustomEvent, registerComponent } from "@vuu-ui/vuu-utils";
@@ -3241,7 +3377,7 @@ var CheckboxCell = memo2(
3241
3377
  ({ column, columnMap, onCommit = WarnCommit, row }) => {
3242
3378
  const dataIdx = columnMap[column.name];
3243
3379
  const isChecked = row[dataIdx];
3244
- const handleCommit = useCallback20(
3380
+ const handleCommit = useCallback21(
3245
3381
  (value) => async (evt) => {
3246
3382
  const res = await onCommit(value);
3247
3383
  if (res === true) {
@@ -3251,7 +3387,7 @@ var CheckboxCell = memo2(
3251
3387
  },
3252
3388
  [onCommit]
3253
3389
  );
3254
- return !!column.editable ? /* @__PURE__ */ jsx13(Checkbox, { checked: isChecked, onClick: handleCommit(!isChecked) }) : /* @__PURE__ */ jsx13(CheckboxIcon, { checked: isChecked, disabled: true });
3390
+ return column.editable ? /* @__PURE__ */ jsx13(Checkbox, { checked: isChecked, onClick: handleCommit(!isChecked) }) : /* @__PURE__ */ jsx13(CheckboxIcon, { checked: isChecked, disabled: true });
3255
3391
  },
3256
3392
  dataAndColumnUnchanged
3257
3393
  );
@@ -3260,64 +3396,14 @@ registerComponent("checkbox-cell", CheckboxCell, "cell-renderer", {
3260
3396
  serverDataType: "boolean"
3261
3397
  });
3262
3398
 
3263
- // src/cell-renderers/dropdown-cell/DropdownCell.tsx
3264
- import { useLookupValues } from "@vuu-ui/vuu-data-react";
3265
- import {
3266
- Dropdown,
3267
- WarnCommit as WarnCommit2
3268
- } from "@vuu-ui/vuu-ui-controls";
3269
- import { dispatchCustomEvent as dispatchCustomEvent2, registerComponent as registerComponent2 } from "@vuu-ui/vuu-utils";
3270
- import { memo as memo3, useCallback as useCallback21, useState as useState7 } from "react";
3271
- import { jsx as jsx14 } from "react/jsx-runtime";
3272
- var classBase8 = "vuuTableDropdownCell";
3273
- var openKeys = ["Enter", " "];
3274
- var DropdownCell = memo3(
3275
- function DropdownCell2({
3276
- column,
3277
- columnMap,
3278
- onCommit = WarnCommit2,
3279
- row
3280
- }) {
3281
- const dataIdx = columnMap[column.name];
3282
- const { initialValue, values } = useLookupValues(column, row[dataIdx]);
3283
- const [value, setValue] = useState7(null);
3284
- const handleSelectionChange = useCallback21(
3285
- (evt, selectedOption) => {
3286
- if (selectedOption) {
3287
- setValue(selectedOption);
3288
- onCommit(selectedOption.value).then((response) => {
3289
- if (response === true && evt) {
3290
- dispatchCustomEvent2(evt.target, "vuu-commit");
3291
- }
3292
- });
3293
- }
3294
- },
3295
- [onCommit]
3296
- );
3297
- return /* @__PURE__ */ jsx14(
3298
- Dropdown,
3299
- {
3300
- className: classBase8,
3301
- onSelectionChange: handleSelectionChange,
3302
- openKeys,
3303
- selected: value != null ? value : initialValue,
3304
- source: values,
3305
- width: column.width - 17
3306
- }
3307
- );
3308
- },
3309
- dataAndColumnUnchanged
3310
- );
3311
- registerComponent2("dropdown-cell", DropdownCell, "cell-renderer", {});
3312
-
3313
3399
  // src/cell-renderers/input-cell/InputCell.tsx
3314
- import { registerComponent as registerComponent3 } from "@vuu-ui/vuu-utils";
3400
+ import { registerComponent as registerComponent2 } from "@vuu-ui/vuu-utils";
3315
3401
  import { Input } from "@salt-ds/core";
3316
3402
  import { useEditableText } from "@vuu-ui/vuu-ui-controls";
3317
- import cx10 from "classnames";
3318
- import { jsx as jsx15 } from "react/jsx-runtime";
3319
- var classBase9 = "vuuTableInputCell";
3320
- var WarnCommit3 = () => {
3403
+ import cx10 from "clsx";
3404
+ import { jsx as jsx14 } from "react/jsx-runtime";
3405
+ var classBase8 = "vuuTableInputCell";
3406
+ var WarnCommit2 = () => {
3321
3407
  console.warn(
3322
3408
  "onCommit handler has not been provided to InputCell cell renderer"
3323
3409
  );
@@ -3326,68 +3412,45 @@ var WarnCommit3 = () => {
3326
3412
  var InputCell = ({
3327
3413
  column,
3328
3414
  columnMap,
3329
- onCommit = WarnCommit3,
3415
+ onCommit = WarnCommit2,
3330
3416
  row
3331
3417
  }) => {
3332
3418
  const dataIdx = columnMap[column.name];
3333
- const {
3334
- align = "left",
3335
- clientSideEditValidationCheck,
3336
- valueFormatter
3337
- } = column;
3419
+ const { align = "left", clientSideEditValidationCheck } = column;
3338
3420
  const { warningMessage, ...editProps } = useEditableText({
3339
- initialValue: valueFormatter(row[dataIdx]),
3421
+ initialValue: row[dataIdx],
3340
3422
  onCommit,
3341
3423
  clientSideEditValidationCheck
3342
3424
  });
3343
- const endAdornment = warningMessage && align === "left" ? /* @__PURE__ */ jsx15("span", { className: `${classBase9}-icon`, "data-icon": "error" }) : void 0;
3344
- const startAdornment = warningMessage && align === "right" ? /* @__PURE__ */ jsx15("span", { className: `${classBase9}-icon`, "data-icon": "error" }) : void 0;
3345
- return /* @__PURE__ */ jsx15(
3425
+ const endAdornment = warningMessage && align === "left" ? /* @__PURE__ */ jsx14("span", { className: `${classBase8}-icon`, "data-icon": "error" }) : void 0;
3426
+ const startAdornment = warningMessage && align === "right" ? /* @__PURE__ */ jsx14("span", { className: `${classBase8}-icon`, "data-icon": "error" }) : void 0;
3427
+ return /* @__PURE__ */ jsx14(
3346
3428
  Input,
3347
3429
  {
3348
3430
  ...editProps,
3349
- className: cx10(classBase9, {
3350
- [`${classBase9}-error`]: warningMessage !== void 0
3431
+ className: cx10(classBase8, {
3432
+ [`${classBase8}-error`]: warningMessage !== void 0
3351
3433
  }),
3352
3434
  endAdornment,
3353
3435
  startAdornment
3354
3436
  }
3355
3437
  );
3356
3438
  };
3357
- registerComponent3("input-cell", InputCell, "cell-renderer", {});
3358
-
3359
- // src/cell-renderers/lookup-cell/LookupCell.tsx
3360
- import { useLookupValues as useLookupValues2 } from "@vuu-ui/vuu-data-react";
3361
- import { registerComponent as registerComponent4 } from "@vuu-ui/vuu-utils";
3362
- import { memo as memo4 } from "react";
3363
- import { jsx as jsx16 } from "react/jsx-runtime";
3364
- var LookupCell = memo4(
3365
- function LookupCell2({
3366
- column,
3367
- columnMap,
3368
- row
3369
- }) {
3370
- const dataIdx = columnMap[column.name];
3371
- const { initialValue: value } = useLookupValues2(column, row[dataIdx]);
3372
- return /* @__PURE__ */ jsx16("span", { children: value == null ? void 0 : value.label });
3373
- },
3374
- dataAndColumnUnchanged
3375
- );
3376
- registerComponent4("lookup-cell", LookupCell, "cell-renderer", {});
3439
+ registerComponent2("input-cell", InputCell, "cell-renderer", {});
3377
3440
 
3378
3441
  // src/cell-renderers/toggle-cell/ToggleCell.tsx
3379
- import { WarnCommit as WarnCommit4 } from "@vuu-ui/vuu-ui-controls";
3442
+ import { WarnCommit as WarnCommit3 } from "@vuu-ui/vuu-ui-controls";
3380
3443
  import {
3381
- dispatchCustomEvent as dispatchCustomEvent3,
3444
+ dispatchCustomEvent as dispatchCustomEvent2,
3382
3445
  isTypeDescriptor,
3383
3446
  isValueListRenderer,
3384
- registerComponent as registerComponent5
3447
+ registerComponent as registerComponent3
3385
3448
  } from "@vuu-ui/vuu-utils";
3386
- import cx11 from "classnames";
3387
- import { memo as memo5, useCallback as useCallback22 } from "react";
3449
+ import cx11 from "clsx";
3450
+ import { memo as memo3, useCallback as useCallback22 } from "react";
3388
3451
  import { CycleStateButton } from "@vuu-ui/vuu-ui-controls";
3389
- import { jsx as jsx17 } from "react/jsx-runtime";
3390
- var classBase10 = "vuuTableToggleCell";
3452
+ import { jsx as jsx15 } from "react/jsx-runtime";
3453
+ var classBase9 = "vuuTableToggleCell";
3391
3454
  var getValueList = ({ name, type }) => {
3392
3455
  if (isTypeDescriptor(type) && isValueListRenderer(type.renderer)) {
3393
3456
  return type.renderer.values;
@@ -3397,11 +3460,11 @@ var getValueList = ({ name, type }) => {
3397
3460
  );
3398
3461
  }
3399
3462
  };
3400
- var ToggleCell = memo5(
3463
+ var ToggleCell = memo3(
3401
3464
  function ToggleCell2({
3402
3465
  column,
3403
3466
  columnMap,
3404
- onCommit = WarnCommit4,
3467
+ onCommit = WarnCommit3,
3405
3468
  row
3406
3469
  }) {
3407
3470
  const values = getValueList(column);
@@ -3411,17 +3474,17 @@ var ToggleCell = memo5(
3411
3474
  (evt, value2) => {
3412
3475
  return onCommit(value2).then((response) => {
3413
3476
  if (response === true) {
3414
- dispatchCustomEvent3(evt.target, "vuu-commit");
3477
+ dispatchCustomEvent2(evt.target, "vuu-commit");
3415
3478
  }
3416
3479
  return response;
3417
3480
  });
3418
3481
  },
3419
3482
  [onCommit]
3420
3483
  );
3421
- return /* @__PURE__ */ jsx17(
3484
+ return /* @__PURE__ */ jsx15(
3422
3485
  CycleStateButton,
3423
3486
  {
3424
- className: cx11(classBase10, `${classBase10}-${column.name}`),
3487
+ className: cx11(classBase9, `${classBase9}-${column.name}`),
3425
3488
  onCommit: handleCommit,
3426
3489
  value,
3427
3490
  values,
@@ -3432,14 +3495,14 @@ var ToggleCell = memo5(
3432
3495
  },
3433
3496
  dataAndColumnUnchanged
3434
3497
  );
3435
- registerComponent5("toggle-cell", ToggleCell, "cell-renderer", {});
3498
+ registerComponent3("toggle-cell", ToggleCell, "cell-renderer", {});
3436
3499
 
3437
3500
  // src/useControlledTableNavigation.ts
3438
3501
  import { useStateRef } from "@vuu-ui/vuu-ui-controls";
3439
3502
  import { dispatchMouseEvent as dispatchMouseEvent2 } from "@vuu-ui/vuu-utils";
3440
- import { useCallback as useCallback23, useRef as useRef15 } from "react";
3503
+ import { useCallback as useCallback23, useRef as useRef16 } from "react";
3441
3504
  var useControlledTableNavigation = (initialValue, rowCount) => {
3442
- const tableRef = useRef15(null);
3505
+ const tableRef = useRef16(null);
3443
3506
  const [highlightedIndexRef, setHighlightedIndex] = useStateRef(initialValue);
3444
3507
  const handleKeyDown = useCallback23(
3445
3508
  (e) => {
@@ -3475,13 +3538,14 @@ var useControlledTableNavigation = (initialValue, rowCount) => {
3475
3538
  };
3476
3539
  export {
3477
3540
  CheckboxCell,
3478
- DropdownCell,
3479
3541
  GroupHeaderCellNext,
3480
3542
  HeaderCell,
3481
3543
  InputCell,
3482
- LookupCell,
3483
3544
  Table,
3545
+ TableCell,
3546
+ TableGroupCell,
3484
3547
  ToggleCell,
3548
+ dataAndColumnUnchanged,
3485
3549
  isShowColumnSettings,
3486
3550
  isShowTableSettings,
3487
3551
  updateTableConfig,