@dxos/react-ui-table 0.4.10-main.c32f430 → 0.4.10-main.c5e8686

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 (65) hide show
  1. package/dist/lib/browser/index.mjs +507 -308
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/{ColumnMenu.d.ts → ColumnMenu/ColumnMenu.d.ts} +1 -1
  5. package/dist/types/src/components/ColumnMenu/ColumnMenu.d.ts.map +1 -0
  6. package/dist/types/src/components/{ColumnMenu.stories.d.ts → ColumnMenu/ColumnMenu.stories.d.ts} +6 -2
  7. package/dist/types/src/components/ColumnMenu/ColumnMenu.stories.d.ts.map +1 -0
  8. package/dist/types/src/components/{ColumnSettingsForm.d.ts → ColumnMenu/ColumnSettingsForm.d.ts} +5 -4
  9. package/dist/types/src/components/ColumnMenu/ColumnSettingsForm.d.ts.map +1 -0
  10. package/dist/types/src/components/ColumnMenu/index.d.ts +3 -0
  11. package/dist/types/src/components/ColumnMenu/index.d.ts.map +1 -0
  12. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  13. package/dist/types/src/components/Table/Table.stories.d.ts +3 -0
  14. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/index.d.ts +1 -1
  16. package/dist/types/src/components/index.d.ts.map +1 -1
  17. package/dist/types/src/helpers.d.ts +4 -0
  18. package/dist/types/src/helpers.d.ts.map +1 -1
  19. package/dist/types/src/hooks/index.d.ts +3 -0
  20. package/dist/types/src/hooks/index.d.ts.map +1 -0
  21. package/dist/types/src/hooks/useColumnSorting.d.ts.map +1 -0
  22. package/dist/types/src/hooks/usePinLastRow.d.ts +3 -0
  23. package/dist/types/src/hooks/usePinLastRow.d.ts.map +1 -0
  24. package/dist/types/src/index.d.ts +2 -1
  25. package/dist/types/src/index.d.ts.map +1 -1
  26. package/dist/types/src/schema/SchemaToTable.stories.d.ts +11 -0
  27. package/dist/types/src/schema/SchemaToTable.stories.d.ts.map +1 -0
  28. package/dist/types/src/schema/index.d.ts +3 -0
  29. package/dist/types/src/schema/index.d.ts.map +1 -0
  30. package/dist/types/src/schema/schema.d.ts +5 -0
  31. package/dist/types/src/schema/schema.d.ts.map +1 -0
  32. package/dist/types/src/schema/schema.test.d.ts +2 -0
  33. package/dist/types/src/schema/schema.test.d.ts.map +1 -0
  34. package/dist/types/src/schema/schemaToColumns.d.ts +4 -0
  35. package/dist/types/src/schema/schemaToColumns.d.ts.map +1 -0
  36. package/dist/types/src/{schema.d.ts → schema/types.d.ts} +1 -1
  37. package/dist/types/src/schema/types.d.ts.map +1 -0
  38. package/package.json +18 -15
  39. package/src/components/{ColumnMenu.stories.tsx → ColumnMenu/ColumnMenu.stories.tsx} +31 -1
  40. package/src/components/{ColumnMenu.tsx → ColumnMenu/ColumnMenu.tsx} +2 -2
  41. package/src/components/{ColumnSettingsForm.tsx → ColumnMenu/ColumnSettingsForm.tsx} +83 -75
  42. package/src/components/ColumnMenu/index.ts +6 -0
  43. package/src/components/Table/Table.stories.tsx +58 -3
  44. package/src/components/Table/Table.tsx +24 -9
  45. package/src/components/index.ts +1 -1
  46. package/src/helpers.tsx +22 -0
  47. package/src/hooks/index.ts +6 -0
  48. package/src/hooks/usePinLastRow.ts +64 -0
  49. package/src/index.ts +3 -1
  50. package/src/schema/SchemaToTable.stories.tsx +72 -0
  51. package/src/schema/index.ts +6 -0
  52. package/src/schema/schema.test.ts +148 -0
  53. package/src/schema/schema.ts +92 -0
  54. package/src/schema/schemaToColumns.ts +48 -0
  55. package/dist/types/src/components/ColumnMenu.d.ts.map +0 -1
  56. package/dist/types/src/components/ColumnMenu.stories.d.ts.map +0 -1
  57. package/dist/types/src/components/ColumnSettingsForm.d.ts.map +0 -1
  58. package/dist/types/src/components/hooks/useColumnSorting.d.ts.map +0 -1
  59. package/dist/types/src/components/hooks/usePinLastRow.d.ts +0 -3
  60. package/dist/types/src/components/hooks/usePinLastRow.d.ts.map +0 -1
  61. package/dist/types/src/schema.d.ts.map +0 -1
  62. package/src/components/hooks/usePinLastRow.ts +0 -43
  63. /package/dist/types/src/{components/hooks → hooks}/useColumnSorting.d.ts +0 -0
  64. /package/src/{components/hooks → hooks}/useColumnSorting.ts +0 -0
  65. /package/src/{schema.ts → schema/types.ts} +0 -0
@@ -1,16 +1,3 @@
1
- // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
2
- import { X as X2, GearSix, CaretDown, ArrowDown, ArrowUp } from "@phosphor-icons/react";
3
- import React2, { useRef as useRef2, useState as useState3, useCallback } from "react";
4
- import { Button as Button2, DensityProvider, Popover, DropdownMenu } from "@dxos/react-ui";
5
- import { getSize as getSize2, mx as mx2 } from "@dxos/react-ui-theme";
6
-
7
- // packages/ui/react-ui-table/src/components/ColumnSettingsForm.tsx
8
- import { Check, Trash, X } from "@phosphor-icons/react";
9
- import React, { useRef, useState } from "react";
10
- import { Button, Input, Select, Separator, useTranslation } from "@dxos/react-ui";
11
- import { getSize, mx } from "@dxos/react-ui-theme";
12
- import { safeParseInt } from "@dxos/util";
13
-
14
1
  // packages/ui/react-ui-table/src/translations.ts
15
2
  var translationKey = "table";
16
3
  var translations_default = [
@@ -34,25 +21,107 @@ var translations_default = [
34
21
  }
35
22
  ];
36
23
 
37
- // packages/ui/react-ui-table/src/components/ColumnSettingsForm.tsx
38
- var Section = ({ children, className }) => /* @__PURE__ */ React.createElement("div", {
24
+ // packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx
25
+ import { CaretDown } from "@phosphor-icons/react";
26
+ import React, { useCallback, useState } from "react";
27
+ import { Popover, useTranslation } from "@dxos/react-ui";
28
+ import { PopoverCombobox } from "@dxos/react-ui-searchlist";
29
+ import { descriptionText, getSize, mx, staticPlaceholderText } from "@dxos/react-ui-theme";
30
+ var initialItems = (model, value) => value ? {
31
+ [model.getId(value)]: {
32
+ label: model.getText(value),
33
+ data: value
34
+ }
35
+ } : {};
36
+ var CellCombobox = ({ model, value, onValueChange }) => {
37
+ const { t } = useTranslation(translationKey);
38
+ const [items, setItems] = useState(initialItems(model, value));
39
+ const [loading, setLoading] = useState(false);
40
+ const [searchInputValue, setSearchInputValue] = useState("");
41
+ const handleSearchInputValueChange = async (text) => {
42
+ setSearchInputValue(text ?? "");
43
+ setLoading(true);
44
+ const items2 = await model.query(text);
45
+ setItems(items2.reduce((acc, item) => {
46
+ acc[model.getId(item)] = {
47
+ label: model.getText(item),
48
+ data: item
49
+ };
50
+ return acc;
51
+ }, initialItems(model, value)));
52
+ setLoading(false);
53
+ };
54
+ const handleValueChange = useCallback((id) => {
55
+ onValueChange(items[id]?.data);
56
+ }, [
57
+ items,
58
+ onValueChange
59
+ ]);
60
+ return /* @__PURE__ */ React.createElement(PopoverCombobox.Root, {
61
+ placeholder: t("no selection label")
62
+ }, /* @__PURE__ */ React.createElement(PopoverCombobox.Trigger, {
63
+ variant: "ghost",
64
+ classNames: "is-full rounded-none ring-inset"
65
+ }, value ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
66
+ className: mx("font-normal text-start text-base flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
67
+ }, model.getText(value)), /* @__PURE__ */ React.createElement(CaretDown, {
68
+ weight: "bold",
69
+ className: getSize(3)
70
+ })) : null), /* @__PURE__ */ React.createElement(PopoverCombobox.Content, {
71
+ shouldFilter: false,
72
+ classNames: "is-[--radix-popover-trigger-width]"
73
+ }, /* @__PURE__ */ React.createElement(PopoverCombobox.Input, {
74
+ value: searchInputValue,
75
+ onValueChange: handleSearchInputValueChange
76
+ }), /* @__PURE__ */ React.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React.createElement("p", {
77
+ className: mx("text-center", descriptionText)
78
+ }, "Start typing to search") : loading ? /* @__PURE__ */ React.createElement("p", {
79
+ className: mx("text-center", descriptionText)
80
+ }, "Searching\u2026") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverCombobox.Empty, {
81
+ classNames: [
82
+ "text-center",
83
+ descriptionText
84
+ ]
85
+ }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React.createElement(PopoverCombobox.Item, {
86
+ key: id,
87
+ value: id,
88
+ onSelect: handleValueChange,
89
+ classNames: "truncate"
90
+ }, label)))), /* @__PURE__ */ React.createElement(Popover.Arrow, null)));
91
+ };
92
+
93
+ // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx
94
+ import { X as X2, GearSix, CaretDown as CaretDown2, ArrowDown, ArrowUp } from "@phosphor-icons/react";
95
+ import React3, { useRef as useRef2, useState as useState5, useCallback as useCallback3 } from "react";
96
+ import { Button as Button2, DensityProvider, Popover as Popover2, DropdownMenu } from "@dxos/react-ui";
97
+ import { getSize as getSize3, mx as mx3 } from "@dxos/react-ui-theme";
98
+
99
+ // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx
100
+ import { Check, Trash, X } from "@phosphor-icons/react";
101
+ import React2, { useRef, useState as useState2 } from "react";
102
+ import { Button, Input, Select, Separator, useTranslation as useTranslation2 } from "@dxos/react-ui";
103
+ import { getSize as getSize2, mx as mx2 } from "@dxos/react-ui-theme";
104
+ import { safeParseInt } from "@dxos/util";
105
+ var Section = ({ children, className }) => /* @__PURE__ */ React2.createElement("div", {
39
106
  role: "none",
40
- className: mx("p-2", className)
107
+ className: mx2("p-2", className)
41
108
  }, children);
42
109
  var ColumnSettingsForm = ({ column, tableDef, tableDefs, onUpdate, onDelete, onClose }) => {
43
- const [prop, setProp] = useState(column.id);
44
- const [refTable, setRefTable] = useState(column.refTable);
45
- const [refProp, setRefProp] = useState(column.refProp);
46
- const [type, setType] = useState(String(column.type));
47
- const [label, setLabel] = useState(column.label);
48
- const [digits, setDigits] = useState(String(column.digits ?? "0"));
110
+ const [formState, setFormState] = useState2({
111
+ prop: column.id,
112
+ refTable: column.refTable,
113
+ refProp: column.refProp,
114
+ type: String(column.type),
115
+ label: column.label,
116
+ digits: String(column.digits ?? "0")
117
+ });
49
118
  const propRef = useRef(null);
50
- const { t } = useTranslation(translationKey);
119
+ const { t } = useTranslation2(translationKey);
51
120
  const handleCancel = () => {
52
- setProp(column.id);
53
- onClose;
121
+ onClose?.();
54
122
  };
55
123
  const handleSave = () => {
124
+ const { prop, refTable, refProp, type, label, digits } = formState;
56
125
  if (!prop.length || !prop.match(/^[a-zA-Z_].+/i)) {
57
126
  propRef.current?.focus();
58
127
  return;
@@ -64,7 +133,7 @@ var ColumnSettingsForm = ({ column, tableDef, tableDefs, onUpdate, onDelete, onC
64
133
  return;
65
134
  }
66
135
  }
67
- onUpdate?.(prop, {
136
+ onUpdate?.(column.id, {
68
137
  id: prop,
69
138
  prop,
70
139
  label,
@@ -73,104 +142,121 @@ var ColumnSettingsForm = ({ column, tableDef, tableDefs, onUpdate, onDelete, onC
73
142
  refProp,
74
143
  digits: safeParseInt(digits)
75
144
  });
76
- onClose();
145
+ onClose?.();
77
146
  };
78
- return /* @__PURE__ */ React.createElement("div", {
147
+ return /* @__PURE__ */ React2.createElement("div", {
79
148
  className: "flex flex-col gap-1"
80
- }, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
149
+ }, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
81
150
  classNames: "mbe-1"
82
- }, t("column label label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
151
+ }, t("column label label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
83
152
  placeholder: "Column label",
84
- value: label ?? "",
85
- onChange: (event) => setLabel(event.target.value),
153
+ value: formState.label ?? "",
154
+ onChange: (event) => setFormState((prevState) => ({
155
+ ...prevState,
156
+ label: event.target.value
157
+ })),
86
158
  autoFocus: true
87
- })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
159
+ })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
88
160
  classNames: "mbe-1 mbs-3"
89
- }, t("property key label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
161
+ }, t("property key label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
90
162
  ref: propRef,
91
163
  placeholder: "Property key",
92
- // TODO(burdon): Provide hooks for value normalization, ENTER, ESC, etc.
93
- value: prop ?? "",
94
- onChange: (event) => setProp(event.target.value.replace(/[^\w_]/g, ""))
95
- })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
164
+ value: formState.prop ?? "",
165
+ onChange: (event) => setFormState((prevState) => ({
166
+ ...prevState,
167
+ prop: event.target.value.replace(/[^\w_]/g, "")
168
+ }))
169
+ })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
96
170
  classNames: "mbe-1 mbs-3"
97
- }, t("column type label")), /* @__PURE__ */ React.createElement(Select.Root, {
98
- value: type,
99
- onValueChange: setType
100
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
171
+ }, t("column type label")), /* @__PURE__ */ React2.createElement(Select.Root, {
172
+ value: formState.type,
173
+ onValueChange: (value) => setFormState((prevState) => ({
174
+ ...prevState,
175
+ type: value
176
+ }))
177
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
101
178
  placeholder: "Type",
102
179
  classNames: "is-full"
103
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, [
180
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, [
104
181
  "number",
105
182
  "boolean",
106
183
  "string",
107
184
  "ref"
108
- ].map((type2) => /* @__PURE__ */ React.createElement(Select.Option, {
109
- key: type2,
110
- value: type2
111
- }, t(`${type2} column type label`))))))))), type === "number" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
185
+ ].map((type) => /* @__PURE__ */ React2.createElement(Select.Option, {
186
+ key: type,
187
+ value: type
188
+ }, t(`${type} column type label`))))))))), formState.type === "number" && /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
112
189
  classNames: "mbe-1 mbs-3"
113
- }, t("digits label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
114
- value: digits ?? "",
115
- onChange: (event) => setDigits(event.target.value)
116
- })))), type === "ref" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
190
+ }, t("digits label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
191
+ value: formState.digits ?? "",
192
+ onChange: (event) => setFormState((prevState) => ({
193
+ ...prevState,
194
+ digits: event.target.value
195
+ }))
196
+ }))), formState.type === "ref" && /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
117
197
  classNames: "mbe-1 mbs-3"
118
- }, "Table"), /* @__PURE__ */ React.createElement(Select.Root, {
119
- value: refTable,
120
- onValueChange: setRefTable
121
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
198
+ }, "Table"), /* @__PURE__ */ React2.createElement(Select.Root, {
199
+ value: formState.refTable,
200
+ onValueChange: (value) => setFormState((prevState) => ({
201
+ ...prevState,
202
+ refTable: value
203
+ }))
204
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
122
205
  placeholder: "Table",
123
206
  classNames: "is-full"
124
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, tableDefs.filter((t2) => t2.id !== tableDef.id).map(({ id, name }) => /* @__PURE__ */ React.createElement(Select.Option, {
207
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, tableDefs.filter((t2) => t2.id !== tableDef.id).map(({ id, name }) => /* @__PURE__ */ React2.createElement(Select.Option, {
125
208
  key: id,
126
209
  value: id
127
- }, name ?? id))))))), refTable && /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
210
+ }, name ?? id))))))), formState.refTable && /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
128
211
  classNames: "mbe-1 mbs-3"
129
- }, "Table property"), /* @__PURE__ */ React.createElement(Select.Root, {
130
- value: refProp,
131
- onValueChange: setRefProp
132
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
212
+ }, "Table property"), /* @__PURE__ */ React2.createElement(Select.Root, {
213
+ value: formState.refProp,
214
+ onValueChange: (value) => setFormState((prevState) => ({
215
+ ...prevState,
216
+ refProp: value
217
+ }))
218
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
133
219
  placeholder: "Property",
134
220
  classNames: "is-full"
135
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, tableDefs.find((tableDef2) => tableDef2.id === refTable)?.columns.map(({ id, label: label2 }) => /* @__PURE__ */ React.createElement(Select.Option, {
221
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, tableDefs.find((tableDef2) => tableDef2.id === formState.refTable)?.columns.map(({ id, label }) => /* @__PURE__ */ React2.createElement(Select.Option, {
136
222
  key: id,
137
223
  value: id
138
- }, label2 ?? id))))))))), /* @__PURE__ */ React.createElement(Separator, {
224
+ }, label ?? id)))))))), /* @__PURE__ */ React2.createElement(Separator, {
139
225
  classNames: "mli-2"
140
- }), /* @__PURE__ */ React.createElement(Section, {
226
+ }), /* @__PURE__ */ React2.createElement(Section, {
141
227
  className: "space-b-1.5"
142
- }, /* @__PURE__ */ React.createElement(Button, {
228
+ }, /* @__PURE__ */ React2.createElement(Button, {
143
229
  variant: "primary",
144
230
  classNames: "is-full flex gap-2",
145
231
  onClick: handleSave
146
- }, /* @__PURE__ */ React.createElement("span", null, t("save label")), /* @__PURE__ */ React.createElement("div", {
232
+ }, /* @__PURE__ */ React2.createElement("span", null, t("save label")), /* @__PURE__ */ React2.createElement("div", {
147
233
  className: "grow"
148
- }), /* @__PURE__ */ React.createElement(Check, {
149
- className: getSize(5)
150
- })), /* @__PURE__ */ React.createElement(Button, {
234
+ }), /* @__PURE__ */ React2.createElement(Check, {
235
+ className: getSize2(5)
236
+ })), /* @__PURE__ */ React2.createElement(Button, {
151
237
  classNames: "is-full flex gap-2",
152
238
  onClick: handleCancel
153
- }, /* @__PURE__ */ React.createElement("span", null, t("cancel label", {
239
+ }, /* @__PURE__ */ React2.createElement("span", null, t("cancel label", {
154
240
  ns: "os"
155
- })), /* @__PURE__ */ React.createElement("div", {
241
+ })), /* @__PURE__ */ React2.createElement("div", {
156
242
  className: "grow"
157
- }), /* @__PURE__ */ React.createElement(X, {
158
- className: getSize(5)
159
- })), /* @__PURE__ */ React.createElement(Button, {
243
+ }), /* @__PURE__ */ React2.createElement(X, {
244
+ className: getSize2(5)
245
+ })), /* @__PURE__ */ React2.createElement(Button, {
160
246
  classNames: "is-full flex gap-2",
161
247
  onClick: () => onDelete?.(column.id)
162
- }, /* @__PURE__ */ React.createElement("span", null, t("delete label")), /* @__PURE__ */ React.createElement("div", {
248
+ }, /* @__PURE__ */ React2.createElement("span", null, t("delete label")), /* @__PURE__ */ React2.createElement("div", {
163
249
  className: "grow"
164
- }), /* @__PURE__ */ React.createElement(Trash, {
165
- className: getSize(5)
250
+ }), /* @__PURE__ */ React2.createElement(Trash, {
251
+ className: getSize2(5)
166
252
  }))));
167
253
  };
168
254
 
169
- // packages/ui/react-ui-table/src/components/hooks/useColumnSorting.ts
170
- import { useState as useState2 } from "react";
255
+ // packages/ui/react-ui-table/src/hooks/useColumnSorting.ts
256
+ import { useState as useState3 } from "react";
171
257
  var useColumnSorting = (column) => {
172
- const [sortDirection, setSortDirection] = useState2(column.getIsSorted());
173
- const [firstSort, setFirstSort] = useState2();
258
+ const [sortDirection, setSortDirection] = useState3(column.getIsSorted());
259
+ const [firstSort, setFirstSort] = useState3();
174
260
  const canSort = column.getCanSort();
175
261
  const updateColumnSort = (direction) => {
176
262
  setSortDirection(direction);
@@ -212,22 +298,78 @@ var useColumnSorting = (column) => {
212
298
  };
213
299
  };
214
300
 
215
- // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
301
+ // packages/ui/react-ui-table/src/hooks/usePinLastRow.ts
302
+ import { useCallback as useCallback2, useEffect, useState as useState4 } from "react";
303
+ var usePinLastRow = (pinLastRow, table, data, getScrollElement) => {
304
+ const [pinnedRowKey, setPinnedRowKey] = useState4();
305
+ const scrollToBottom = useCallback2(() => {
306
+ const scrollElement = getScrollElement?.();
307
+ if (scrollElement) {
308
+ requestAnimationFrame(() => scrollElement.scrollTo({
309
+ top: scrollElement.scrollHeight
310
+ }));
311
+ }
312
+ }, [
313
+ getScrollElement
314
+ ]);
315
+ const pinRow = useCallback2((rowToPin) => {
316
+ table.resetRowPinning();
317
+ rowToPin.pin("bottom");
318
+ setPinnedRowKey(rowToPin.id);
319
+ }, [
320
+ table
321
+ ]);
322
+ const clearRowPinning = useCallback2(() => {
323
+ table.resetRowPinning();
324
+ setPinnedRowKey(void 0);
325
+ }, [
326
+ table
327
+ ]);
328
+ const pinLastRowCallback = useCallback2(() => {
329
+ const rows = table.getRowModel().rows;
330
+ if (rows.length === 0) {
331
+ return clearRowPinning();
332
+ }
333
+ const lastRow = rows[rows.length - 1];
334
+ if (lastRow.id === pinnedRowKey) {
335
+ return;
336
+ }
337
+ pinRow(lastRow);
338
+ if (pinnedRowKey !== void 0) {
339
+ scrollToBottom();
340
+ }
341
+ }, [
342
+ table,
343
+ scrollToBottom,
344
+ pinnedRowKey
345
+ ]);
346
+ useEffect(() => {
347
+ if (pinLastRow) {
348
+ pinLastRowCallback();
349
+ }
350
+ }, [
351
+ data,
352
+ pinLastRow,
353
+ pinLastRowCallback
354
+ ]);
355
+ };
356
+
357
+ // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx
216
358
  var ColumnMenu = ({ column, ...props }) => {
217
359
  const title = column.label?.length ? column.label : column.id;
218
360
  const header = props.context.header;
219
361
  const { canSort, sortDirection, onSelectSort, onToggleSort, onClearSort } = useColumnSorting(header.column);
220
362
  const columnSettingsAnchorRef = useRef2(null);
221
- const [isColumnSettingsOpen, setIsColumnSettingsOpen] = useState3(false);
363
+ const [isColumnSettingsOpen, setIsColumnSettingsOpen] = useState5(false);
222
364
  const shouldPreventFocusOnClose = useRef2(false);
223
- const onOpenColumnSettings = useCallback(() => {
365
+ const onOpenColumnSettings = useCallback3(() => {
224
366
  shouldPreventFocusOnClose.current = true;
225
367
  setIsColumnSettingsOpen(true);
226
368
  }, [
227
369
  shouldPreventFocusOnClose,
228
370
  setIsColumnSettingsOpen
229
371
  ]);
230
- const onDropdownCloseAutoFocus = useCallback((event) => {
372
+ const onDropdownCloseAutoFocus = useCallback3((event) => {
231
373
  if (shouldPreventFocusOnClose.current) {
232
374
  event.preventDefault();
233
375
  shouldPreventFocusOnClose.current = false;
@@ -235,85 +377,85 @@ var ColumnMenu = ({ column, ...props }) => {
235
377
  }, [
236
378
  shouldPreventFocusOnClose
237
379
  ]);
238
- return /* @__PURE__ */ React2.createElement("div", {
380
+ return /* @__PURE__ */ React3.createElement("div", {
239
381
  className: "flex items-center justify-center justify-between"
240
- }, /* @__PURE__ */ React2.createElement("div", {
382
+ }, /* @__PURE__ */ React3.createElement("div", {
241
383
  className: "flex items-center gap-1 truncate",
242
384
  title
243
- }, /* @__PURE__ */ React2.createElement(SortIndicator, {
385
+ }, /* @__PURE__ */ React3.createElement(SortIndicator, {
244
386
  direction: sortDirection,
245
387
  onClick: onToggleSort
246
- }), /* @__PURE__ */ React2.createElement("div", {
388
+ }), /* @__PURE__ */ React3.createElement("div", {
247
389
  className: "truncate"
248
- }, title)), /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
390
+ }, title)), /* @__PURE__ */ React3.createElement(DropdownMenu.Root, {
249
391
  modal: false
250
- }, /* @__PURE__ */ React2.createElement(Popover.Root, {
392
+ }, /* @__PURE__ */ React3.createElement(Popover2.Root, {
251
393
  open: isColumnSettingsOpen,
252
394
  onOpenChange: setIsColumnSettingsOpen,
253
395
  modal: false
254
- }, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
396
+ }, /* @__PURE__ */ React3.createElement(DropdownMenu.Trigger, {
255
397
  ref: columnSettingsAnchorRef,
256
398
  asChild: true
257
- }, /* @__PURE__ */ React2.createElement(Popover.Anchor, {
399
+ }, /* @__PURE__ */ React3.createElement(Popover2.Anchor, {
258
400
  asChild: true
259
- }, /* @__PURE__ */ React2.createElement(Button2, {
401
+ }, /* @__PURE__ */ React3.createElement(Button2, {
260
402
  variant: "ghost"
261
- }, /* @__PURE__ */ React2.createElement(CaretDown, {
262
- className: getSize2(4)
263
- })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
403
+ }, /* @__PURE__ */ React3.createElement(CaretDown2, {
404
+ className: getSize3(4)
405
+ })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Content, {
264
406
  onCloseAutoFocus: onDropdownCloseAutoFocus,
265
407
  sideOffset: 4,
266
408
  collisionPadding: 8
267
- }, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, canSort && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
409
+ }, /* @__PURE__ */ React3.createElement(DropdownMenu.Viewport, null, canSort && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
268
410
  onClick: () => onSelectSort("asc")
269
- }, /* @__PURE__ */ React2.createElement("span", {
411
+ }, /* @__PURE__ */ React3.createElement("span", {
270
412
  className: "grow"
271
- }, "Sort ascending"), /* @__PURE__ */ React2.createElement("span", {
413
+ }, "Sort ascending"), /* @__PURE__ */ React3.createElement("span", {
272
414
  className: "opacity-50"
273
- }, /* @__PURE__ */ React2.createElement(ArrowUp, {
274
- className: getSize2(4)
275
- }))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
415
+ }, /* @__PURE__ */ React3.createElement(ArrowUp, {
416
+ className: getSize3(4)
417
+ }))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
276
418
  onClick: () => onSelectSort("desc")
277
- }, /* @__PURE__ */ React2.createElement("span", {
419
+ }, /* @__PURE__ */ React3.createElement("span", {
278
420
  className: "grow"
279
- }, "Sort descending"), /* @__PURE__ */ React2.createElement("span", {
421
+ }, "Sort descending"), /* @__PURE__ */ React3.createElement("span", {
280
422
  className: "opacity-50"
281
- }, /* @__PURE__ */ React2.createElement(ArrowDown, {
282
- className: getSize2(4)
283
- }))), sortDirection !== false && /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
423
+ }, /* @__PURE__ */ React3.createElement(ArrowDown, {
424
+ className: getSize3(4)
425
+ }))), sortDirection !== false && /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
284
426
  onClick: onClearSort
285
- }, /* @__PURE__ */ React2.createElement("span", {
427
+ }, /* @__PURE__ */ React3.createElement("span", {
286
428
  className: "grow"
287
- }, "Clear sort"), /* @__PURE__ */ React2.createElement("span", {
429
+ }, "Clear sort"), /* @__PURE__ */ React3.createElement("span", {
288
430
  className: "opacity-50"
289
- }, /* @__PURE__ */ React2.createElement(X2, {
290
- className: getSize2(4)
291
- })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
431
+ }, /* @__PURE__ */ React3.createElement(X2, {
432
+ className: getSize3(4)
433
+ })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
292
434
  onClick: onOpenColumnSettings
293
- }, /* @__PURE__ */ React2.createElement("span", {
435
+ }, /* @__PURE__ */ React3.createElement("span", {
294
436
  className: "grow"
295
- }, "Column settings"), /* @__PURE__ */ React2.createElement("span", {
437
+ }, "Column settings"), /* @__PURE__ */ React3.createElement("span", {
296
438
  className: "opacity-50"
297
- }, /* @__PURE__ */ React2.createElement(GearSix, {
298
- className: mx2(getSize2(4), "rotate-90")
299
- })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)), /* @__PURE__ */ React2.createElement(ColumnSettingsPanel, {
439
+ }, /* @__PURE__ */ React3.createElement(GearSix, {
440
+ className: mx3(getSize3(4), "rotate-90")
441
+ })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Arrow, null)), /* @__PURE__ */ React3.createElement(ColumnSettingsPanel, {
300
442
  ...props,
301
443
  column,
302
444
  onClose: () => setIsColumnSettingsOpen(false)
303
445
  }))));
304
446
  };
305
- var ColumnSettingsPanel = ({ tableDefs, tableDef, column, onUpdate, onDelete, onClose }) => /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, null, /* @__PURE__ */ React2.createElement(Popover.Viewport, {
447
+ var ColumnSettingsPanel = ({ tableDefs, tableDef, column, onUpdate, onDelete, onClose }) => /* @__PURE__ */ React3.createElement(Popover2.Portal, null, /* @__PURE__ */ React3.createElement(Popover2.Content, null, /* @__PURE__ */ React3.createElement(Popover2.Viewport, {
306
448
  classNames: "w-60"
307
- }, /* @__PURE__ */ React2.createElement(DensityProvider, {
449
+ }, /* @__PURE__ */ React3.createElement(DensityProvider, {
308
450
  density: "fine"
309
- }, /* @__PURE__ */ React2.createElement(ColumnSettingsForm, {
451
+ }, /* @__PURE__ */ React3.createElement(ColumnSettingsForm, {
310
452
  column,
311
453
  tableDefs,
312
454
  tableDef,
313
455
  onUpdate,
314
456
  onDelete,
315
457
  onClose
316
- }))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)));
458
+ }))), /* @__PURE__ */ React3.createElement(Popover2.Arrow, null)));
317
459
  var SortIndicator = ({ direction, onClick }) => {
318
460
  if (direction === false) {
319
461
  return null;
@@ -321,17 +463,17 @@ var SortIndicator = ({ direction, onClick }) => {
321
463
  let icon;
322
464
  switch (direction) {
323
465
  case "asc":
324
- icon = /* @__PURE__ */ React2.createElement(ArrowUp, {
325
- className: getSize2(3)
466
+ icon = /* @__PURE__ */ React3.createElement(ArrowUp, {
467
+ className: getSize3(3)
326
468
  });
327
469
  break;
328
470
  case "desc":
329
- icon = /* @__PURE__ */ React2.createElement(ArrowDown, {
330
- className: getSize2(3)
471
+ icon = /* @__PURE__ */ React3.createElement(ArrowDown, {
472
+ className: getSize3(3)
331
473
  });
332
474
  break;
333
475
  }
334
- return /* @__PURE__ */ React2.createElement("div", {
476
+ return /* @__PURE__ */ React3.createElement("div", {
335
477
  onClick,
336
478
  className: "flex items-center cursor-pointer"
337
479
  }, icon);
@@ -341,20 +483,20 @@ var SortIndicator = ({ direction, onClick }) => {
341
483
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
342
484
  import { getCoreRowModel, getSortedRowModel, useReactTable, getGroupedRowModel, getExpandedRowModel } from "@tanstack/react-table";
343
485
  import { useVirtualizer } from "@tanstack/react-virtual";
344
- import React8, { Fragment, useCallback as useCallback2, useEffect as useEffect2, useState as useState5 } from "react";
486
+ import React9, { Fragment, useCallback as useCallback4, useEffect as useEffect2, useState as useState6 } from "react";
345
487
  import { log } from "@dxos/log";
346
488
  import { useDefaultValue, useOnTransition } from "@dxos/react-ui";
347
489
 
348
490
  // packages/ui/react-ui-table/src/components/Table/TableBody.tsx
349
491
  import { useArrowNavigationGroup } from "@fluentui/react-tabster";
350
492
  import { flexRender } from "@tanstack/react-table";
351
- import React5 from "react";
493
+ import React6 from "react";
352
494
 
353
495
  // packages/ui/react-ui-table/src/components/Table/TableContext.tsx
354
- import React3, { useContext, createContext } from "react";
496
+ import React4, { useContext, createContext } from "react";
355
497
  var TableContext = /* @__PURE__ */ createContext({});
356
498
  var TableProvider = ({ children, ...value }) => {
357
- return /* @__PURE__ */ React3.createElement(TableContext.Provider, {
499
+ return /* @__PURE__ */ React4.createElement(TableContext.Provider, {
358
500
  value
359
501
  }, children);
360
502
  };
@@ -364,32 +506,32 @@ var useTableContext = () => {
364
506
  };
365
507
 
366
508
  // packages/ui/react-ui-table/src/theme.ts
367
- import { modalSurface, focusRing, ghostSelected, ghostSelectedCurrent, groupBorder, mx as mx3 } from "@dxos/react-ui-theme";
509
+ import { modalSurface, focusRing, ghostSelected, ghostSelectedCurrent, groupBorder, mx as mx4 } from "@dxos/react-ui-theme";
368
510
  var currentRow = "!bg-neutral-75 !dark:bg-neutral-850";
369
511
  var selectedRow = "!bg-primary-100 dark:!bg-primary-700";
370
512
  var flushPadding = "pli-0 plb-0";
371
513
  var textPadding = "pli-2 plb-0.5";
372
514
  var headPadding = "pli-2 plb-1";
373
515
  var gridCellFocusRing = "focus-within:z-[11] focus-within:outline outline-2 outline-primary-500 dark:outline-primary-400";
374
- var tableRoot = ({ fullWidth }, ...etc) => mx3("table-fixed", fullWidth && "is-full", ...etc);
375
- var groupTh = (_props, ...etc) => mx3("text-start font-medium", flushPadding, ...etc);
376
- var theadRoot = ({ header, stickyHeader }, ...etc) => mx3(header ? stickyHeader && "sticky block-start-[--sticky-top] z-[1]" : "collapse", header && "base-surface", "drop-shadow-sm", ...etc);
377
- var theadTr = (_props, ...etc) => mx3("group", ...etc);
378
- var theadTh = ({ border }, ...etc) => mx3("relative", "text-start font-medium select-none truncate", headPadding, border && groupBorder, border && "border border-t-0 border-b-0 border-neutral-200", ...etc);
516
+ var tableRoot = ({ fullWidth }, ...etc) => mx4("table-fixed", fullWidth && "is-full", ...etc);
517
+ var groupTh = (_props, ...etc) => mx4("text-start font-medium", flushPadding, ...etc);
518
+ var theadRoot = ({ header, stickyHeader }, ...etc) => mx4(header ? stickyHeader && "sticky block-start-[--sticky-top] z-[1]" : "collapse", header && "base-surface", "drop-shadow-sm", ...etc);
519
+ var theadTr = (_props, ...etc) => mx4("group", ...etc);
520
+ var theadTh = ({ border }, ...etc) => mx4("relative", "text-start font-medium select-none truncate", headPadding, border && groupBorder, border && "border border-t-0 border-b-0 border-neutral-200", ...etc);
379
521
  var theadResizeRoot = ({ isResizing }) => {
380
- return mx3("absolute h-full w-[4px] top-0 right-0", "cursor-col-resize", "user-select-none", "touch-action-none", !isResizing && "group-hover:bg-neutral-100 dark:group-hover:bg-neutral-800", "pointer-coarse:bg-neutral-100 dark:pointer-coarse:bg-neutral-800", isResizing && "bg-primary-500 dark:bg-primary-400");
522
+ return mx4("absolute h-full w-[4px] top-0 right-0", "cursor-col-resize", "user-select-none", "touch-action-none", !isResizing && "group-hover:bg-neutral-100 dark:group-hover:bg-neutral-800", "pointer-coarse:bg-neutral-100 dark:pointer-coarse:bg-neutral-800", isResizing && "bg-primary-500 dark:bg-primary-400");
381
523
  };
382
- var tbodyRoot = (_props, ...etc) => mx3(...etc);
383
- var tbodyTr = ({ canBeCurrent, isPinned }, ...etc) => mx3("group", canBeCurrent ? ghostSelectedCurrent : ghostSelected, canBeCurrent && focusRing, canBeCurrent && "cursor-pointer rounded", isPinned && "sticky z-1 bottom-[-1px] base-surface", ...etc);
384
- var tdRoot = ({ border, isGrid }, ...etc) => mx3("relative", flushPadding, border && "border", border && groupBorder, isGrid && gridCellFocusRing, ...etc);
385
- var tdContent = (_props, ...etc) => mx3(...etc);
386
- var tfootRoot = (_props, ...etc) => mx3("sticky block-end-0 z-10", modalSurface, ...etc);
387
- var tfootTr = (_props, ...etc) => mx3(...etc);
388
- var tfootTh = ({ border }, ...etc) => mx3(textPadding, modalSurface, border && groupBorder, ...etc);
524
+ var tbodyRoot = (_props, ...etc) => mx4(...etc);
525
+ var tbodyTr = ({ canBeCurrent, isPinned }, ...etc) => mx4("group", canBeCurrent ? ghostSelectedCurrent : ghostSelected, canBeCurrent && focusRing, canBeCurrent && "cursor-pointer rounded", isPinned && "sticky z-1 bottom-[-1px] base-surface", ...etc);
526
+ var tdRoot = ({ border, isGrid }, ...etc) => mx4("relative", flushPadding, border && "border", border && groupBorder, isGrid && gridCellFocusRing, ...etc);
527
+ var tdContent = (_props, ...etc) => mx4(...etc);
528
+ var tfootRoot = (_props, ...etc) => mx4("sticky block-end-0 z-10", modalSurface, ...etc);
529
+ var tfootTr = (_props, ...etc) => mx4(...etc);
530
+ var tfootTh = ({ border }, ...etc) => mx4(textPadding, modalSurface, border && groupBorder, ...etc);
389
531
 
390
532
  // packages/ui/react-ui-table/src/components/Cell/Cell.tsx
391
533
  import { useFocusableGroup } from "@fluentui/react-tabster";
392
- import React4 from "react";
534
+ import React5 from "react";
393
535
  var CELL_NAME = "Cell";
394
536
  var FocusableCell = ({ cell, children }) => {
395
537
  const tableContext = useTableContext();
@@ -397,7 +539,7 @@ var FocusableCell = ({ cell, children }) => {
397
539
  tabBehavior: "limited"
398
540
  });
399
541
  const className = tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames);
400
- return /* @__PURE__ */ React4.createElement("td", {
542
+ return /* @__PURE__ */ React5.createElement("td", {
401
543
  tabIndex: 0,
402
544
  ...domAttributes,
403
545
  className
@@ -405,14 +547,14 @@ var FocusableCell = ({ cell, children }) => {
405
547
  };
406
548
  var StaticCell = ({ cell, children }) => {
407
549
  const tableContext = useTableContext();
408
- return /* @__PURE__ */ React4.createElement("td", {
550
+ return /* @__PURE__ */ React5.createElement("td", {
409
551
  className: tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames)
410
552
  }, children);
411
553
  };
412
554
  var Cell = ({ cell, children }) => {
413
555
  const { isGrid } = useTableContext();
414
556
  const Root = isGrid ? FocusableCell : StaticCell;
415
- return /* @__PURE__ */ React4.createElement(Root, {
557
+ return /* @__PURE__ */ React5.createElement(Root, {
416
558
  cell
417
559
  }, children);
418
560
  };
@@ -427,7 +569,7 @@ var TableBody = ({ rows }) => {
427
569
  axis: "grid"
428
570
  });
429
571
  const canBeCurrent = !isGrid && !!onDatumClick;
430
- return /* @__PURE__ */ React5.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
572
+ return /* @__PURE__ */ React6.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
431
573
  const isCurrent = currentDatum === row.original;
432
574
  const isSelected = rowSelection?.[row.id];
433
575
  const isPinned = row.getIsPinned();
@@ -435,7 +577,7 @@ var TableBody = ({ rows }) => {
435
577
  canBeCurrent,
436
578
  isPinned: isPinned !== false
437
579
  });
438
- return /* @__PURE__ */ React5.createElement("tr", {
580
+ return /* @__PURE__ */ React6.createElement("tr", {
439
581
  key: keyAccessor ? keyAccessor(row.original) : row.id,
440
582
  className: classNames,
441
583
  ...isCurrent && {
@@ -455,57 +597,57 @@ var TableBody = ({ rows }) => {
455
597
  }
456
598
  }
457
599
  }
458
- }, debug && /* @__PURE__ */ React5.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
459
- return /* @__PURE__ */ React5.createElement(Cell, {
600
+ }, debug && /* @__PURE__ */ React6.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
601
+ return /* @__PURE__ */ React6.createElement(Cell, {
460
602
  key: cell.id,
461
603
  cell
462
604
  }, flexRender(cell.column.columnDef.cell, {
463
605
  className: "pli-2",
464
606
  ...cell.getContext()
465
607
  }));
466
- }), expand && /* @__PURE__ */ React5.createElement("td", null));
608
+ }), expand && /* @__PURE__ */ React6.createElement("td", null));
467
609
  }));
468
610
  };
469
611
  TableBody.displayName = TABLE_BODY_NAME;
470
612
 
471
613
  // packages/ui/react-ui-table/src/components/Table/TableFooter.tsx
472
614
  import { flexRender as flexRender2 } from "@tanstack/react-table";
473
- import React6 from "react";
615
+ import React7 from "react";
474
616
  var TABLE_FOOT_NAME = "TableFooter";
475
617
  var TableFooter = (props) => {
476
618
  const tableContext = useTableContext();
477
619
  const { table, expand, debug } = tableContext;
478
620
  const footers = table.getFooterGroups();
479
- return /* @__PURE__ */ React6.createElement("tfoot", {
621
+ return /* @__PURE__ */ React7.createElement("tfoot", {
480
622
  className: tfootRoot(props)
481
- }, footers.map((footerGroup) => /* @__PURE__ */ React6.createElement("tr", {
623
+ }, footers.map((footerGroup) => /* @__PURE__ */ React7.createElement("tr", {
482
624
  key: footerGroup.id,
483
625
  className: tfootTr(tableContext)
484
- }, debug && /* @__PURE__ */ React6.createElement("th", null), footerGroup.headers.map((footer) => {
485
- return /* @__PURE__ */ React6.createElement("th", {
626
+ }, debug && /* @__PURE__ */ React7.createElement("th", null), footerGroup.headers.map((footer) => {
627
+ return /* @__PURE__ */ React7.createElement("th", {
486
628
  key: footer.id,
487
629
  className: tfootTh(tableContext, footer.column.columnDef.meta?.footer?.classNames)
488
630
  }, footer.isPlaceholder ? null : flexRender2(footer.column.columnDef.footer, footer.getContext()));
489
- }), expand && /* @__PURE__ */ React6.createElement("th", null))));
631
+ }), expand && /* @__PURE__ */ React7.createElement("th", null))));
490
632
  };
491
633
  TableFooter.displayName = TABLE_FOOT_NAME;
492
634
 
493
635
  // packages/ui/react-ui-table/src/components/Table/TableHead.tsx
494
636
  import { flexRender as flexRender3 } from "@tanstack/react-table";
495
- import React7 from "react";
637
+ import React8 from "react";
496
638
  var TABLE_HEAD_NAME = "TableHeader";
497
639
  var TableHead = (_props) => {
498
640
  const tableContext = useTableContext();
499
641
  const headerGroups = tableContext.table.getHeaderGroups();
500
- return /* @__PURE__ */ React7.createElement("thead", {
642
+ return /* @__PURE__ */ React8.createElement("thead", {
501
643
  className: theadRoot(tableContext)
502
644
  }, headerGroups.map((headerGroup) => {
503
645
  return (
504
646
  // Group element to hover resize handles.
505
- /* @__PURE__ */ React7.createElement("tr", {
647
+ /* @__PURE__ */ React8.createElement("tr", {
506
648
  key: headerGroup.id,
507
649
  className: theadTr(tableContext)
508
- }, tableContext.debug && /* @__PURE__ */ React7.createElement("th", {
650
+ }, tableContext.debug && /* @__PURE__ */ React8.createElement("th", {
509
651
  className: "font-mono",
510
652
  style: {
511
653
  width: 32
@@ -514,13 +656,13 @@ var TableHead = (_props) => {
514
656
  const isResizing = header.column.getIsResizing();
515
657
  const onResize = header.getResizeHandler();
516
658
  const resizable = header.column.columnDef.meta?.resizable;
517
- return /* @__PURE__ */ React7.createElement("th", {
659
+ return /* @__PURE__ */ React8.createElement("th", {
518
660
  key: header.id,
519
661
  style: {
520
662
  width: header.getSize()
521
663
  },
522
664
  className: theadTh(tableContext, header.column.columnDef.meta?.header?.classNames)
523
- }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), resizable && /* @__PURE__ */ React7.createElement("div", {
665
+ }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), resizable && /* @__PURE__ */ React8.createElement("div", {
524
666
  className: theadResizeRoot({
525
667
  isResizing
526
668
  }),
@@ -528,48 +670,12 @@ var TableHead = (_props) => {
528
670
  onMouseDown: onResize,
529
671
  onTouchStart: onResize
530
672
  }));
531
- }), tableContext.expand && /* @__PURE__ */ React7.createElement("th", null))
673
+ }), tableContext.expand && /* @__PURE__ */ React8.createElement("th", null))
532
674
  );
533
675
  }));
534
676
  };
535
677
  TableHead.displayName = TABLE_HEAD_NAME;
536
678
 
537
- // packages/ui/react-ui-table/src/components/hooks/usePinLastRow.ts
538
- import { useEffect, useState as useState4 } from "react";
539
- var usePinLastRow = (pinLastRow, table, data, getScrollElement) => {
540
- const [pinnedRowKey, setPinnedRowKey] = useState4();
541
- useEffect(() => {
542
- if (!pinLastRow) {
543
- return;
544
- }
545
- const rows = table.getRowModel().rows;
546
- const rowToPin = rows[rows.length - 1];
547
- const rowId = rowToPin.id;
548
- if (rowId === pinnedRowKey) {
549
- return;
550
- }
551
- table.resetRowPinning();
552
- rowToPin.pin("bottom");
553
- const scrollElement = getScrollElement?.();
554
- const isFirstRender = pinnedRowKey === void 0;
555
- if (scrollElement && !isFirstRender) {
556
- requestAnimationFrame(() => {
557
- scrollElement.scrollTo({
558
- top: scrollElement.scrollHeight
559
- });
560
- });
561
- }
562
- setPinnedRowKey(rowId);
563
- }, [
564
- pinLastRow,
565
- table,
566
- getScrollElement,
567
- pinnedRowKey,
568
- setPinnedRowKey,
569
- data
570
- ]);
571
- };
572
-
573
679
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
574
680
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
575
681
  var Table = (props) => {
@@ -577,8 +683,8 @@ var Table = (props) => {
577
683
  const columns = useDefaultValue(props.columns, []);
578
684
  const data = useDefaultValue(props.data, []);
579
685
  const TableProvider2 = TableProvider;
580
- const [columnsInitialised, setColumnsInitialised] = useState5(false);
581
- const [columnSizing, setColumnSizing] = useState5({});
686
+ const [columnsInitialised, setColumnsInitialised] = useState6(false);
687
+ const [columnSizing, setColumnSizing] = useState6({});
582
688
  useEffect2(() => {
583
689
  if (columnsInitialised) {
584
690
  return;
@@ -592,8 +698,8 @@ var Table = (props) => {
592
698
  columns,
593
699
  setColumnSizing
594
700
  ]);
595
- const [columnSizingInfo, setColumnSizingInfo] = useState5({});
596
- const notifyColumnResize = useCallback2(() => onColumnResize?.(columnSizing), [
701
+ const [columnSizingInfo, setColumnSizingInfo] = useState6({});
702
+ const notifyColumnResize = useCallback4(() => onColumnResize?.(columnSizing), [
597
703
  onColumnResize,
598
704
  columnSizing
599
705
  ]);
@@ -603,7 +709,7 @@ var Table = (props) => {
603
709
  onChange: props.onRowSelectionChange,
604
710
  defaultProp: props.defaultRowSelection
605
711
  });
606
- const handleRowSelectionChange = useCallback2((updaterOrValue) => {
712
+ const handleRowSelectionChange = useCallback4((updaterOrValue) => {
607
713
  const nextRowSelection = typeof updaterOrValue === "function" ? updaterOrValue(rowSelection) : updaterOrValue;
608
714
  if (rowsSelectable === "multi") {
609
715
  setRowSelection(nextRowSelection);
@@ -620,7 +726,7 @@ var Table = (props) => {
620
726
  setRowSelection,
621
727
  rowSelection
622
728
  ]);
623
- const [grouping, handleGroupingChange] = useState5(props.grouping ?? []);
729
+ const [grouping, handleGroupingChange] = useState6(props.grouping ?? []);
624
730
  useEffect2(() => handleGroupingChange(props.grouping ?? []), [
625
731
  handleGroupingChange,
626
732
  props.grouping
@@ -675,18 +781,18 @@ var Table = (props) => {
675
781
  if (!getScrollElement) {
676
782
  log.warn("Table: getScrollElement is not set. This is required for virtualized tables.", void 0, {
677
783
  F: __dxlog_file,
678
- L: 159,
784
+ L: 160,
679
785
  S: void 0,
680
786
  C: (f, a) => f(...a)
681
787
  });
682
788
  }
683
- return /* @__PURE__ */ React8.createElement(TableProvider2, {
789
+ return /* @__PURE__ */ React9.createElement(TableProvider2, {
684
790
  ...props,
685
791
  table,
686
792
  header,
687
793
  expand,
688
794
  isGrid: role === "grid" || role === "treegrid"
689
- }, /* @__PURE__ */ React8.createElement(TableImpl, {
795
+ }, /* @__PURE__ */ React9.createElement(TableImpl, {
690
796
  debug: false,
691
797
  getScrollElement,
692
798
  ...props
@@ -695,20 +801,14 @@ var Table = (props) => {
695
801
  var TableImpl = (props) => {
696
802
  const { debug, classNames, getScrollElement, role, footer, grouping, fullWidth } = props;
697
803
  const { table } = useTableContext();
698
- const centerRows = table.getCenterRows();
699
- const bottomRows = table.getBottomRows();
700
- const rows = [
701
- ...centerRows,
702
- ...bottomRows
703
- ];
704
804
  if (debug) {
705
- return /* @__PURE__ */ React8.createElement("pre", {
805
+ return /* @__PURE__ */ React9.createElement("pre", {
706
806
  className: "font-mono text-xs text-neutral-500 m-1 p-2 ring"
707
- }, /* @__PURE__ */ React8.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
807
+ }, /* @__PURE__ */ React9.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
708
808
  }
709
809
  const virtualisable = getScrollElement !== void 0;
710
810
  const isResizingColumn = table.getState().columnSizingInfo.isResizingColumn;
711
- return /* @__PURE__ */ React8.createElement("table", {
811
+ return /* @__PURE__ */ React9.createElement("table", {
712
812
  role,
713
813
  className: tableRoot(props, classNames),
714
814
  ...!fullWidth && {
@@ -716,18 +816,32 @@ var TableImpl = (props) => {
716
816
  width: table.getTotalSize()
717
817
  }
718
818
  }
719
- }, /* @__PURE__ */ React8.createElement(TableHead, null), grouping?.length !== 0 ? virtualisable ? isResizingColumn ? /* @__PURE__ */ React8.createElement(MemoizedVirtualisedTableContent, {
819
+ }, /* @__PURE__ */ React9.createElement(TableHead, null), grouping?.length !== 0 ? virtualisable ? isResizingColumn ? /* @__PURE__ */ React9.createElement(MemoizedVirtualisedTableContent, {
720
820
  getScrollElement
721
- }) : /* @__PURE__ */ React8.createElement(VirtualizedTableContent, {
821
+ }) : /* @__PURE__ */ React9.createElement(VirtualizedTableContent, {
722
822
  getScrollElement
723
- }) : /* @__PURE__ */ React8.createElement(TableBody, {
823
+ }) : /* @__PURE__ */ React9.createElement(UnvirtualizedTableContent, null) : /* @__PURE__ */ React9.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React9.createElement(TableFooter, null));
824
+ };
825
+ var UnvirtualizedTableContent = () => {
826
+ const { table } = useTableContext();
827
+ const centerRows = table.getCenterRows();
828
+ const pinnedRows = table.getBottomRows();
829
+ const rows = [
830
+ ...centerRows,
831
+ ...pinnedRows
832
+ ];
833
+ return /* @__PURE__ */ React9.createElement(TableBody, {
724
834
  rows
725
- }) : /* @__PURE__ */ React8.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React8.createElement(TableFooter, null));
835
+ });
726
836
  };
727
837
  var VirtualizedTableContent = ({ getScrollElement }) => {
728
838
  const { table } = useTableContext();
729
839
  const centerRows = table.getCenterRows();
730
- const pinnedRows = table.getBottomRows();
840
+ let pinnedRows = [];
841
+ try {
842
+ pinnedRows = table.getBottomRows();
843
+ } catch (_) {
844
+ }
731
845
  const { getTotalSize, getVirtualItems } = useVirtualizer({
732
846
  getScrollElement,
733
847
  count: centerRows.length,
@@ -742,113 +856,44 @@ var VirtualizedTableContent = ({ getScrollElement }) => {
742
856
  ...virtualRows.map((virtualRow) => centerRows[virtualRow.index]),
743
857
  ...pinnedRows
744
858
  ];
745
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React8.createElement("tbody", {
859
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React9.createElement("tbody", {
746
860
  role: "none"
747
- }, /* @__PURE__ */ React8.createElement("tr", {
861
+ }, /* @__PURE__ */ React9.createElement("tr", {
748
862
  role: "none"
749
- }, /* @__PURE__ */ React8.createElement("td", {
863
+ }, /* @__PURE__ */ React9.createElement("td", {
750
864
  style: {
751
865
  height: `${paddingTop}px`
752
866
  },
753
867
  role: "none"
754
- }))), /* @__PURE__ */ React8.createElement(TableBody, {
868
+ }))), /* @__PURE__ */ React9.createElement(TableBody, {
755
869
  rows: rowsToRender
756
- }), paddingBottom > 0 && /* @__PURE__ */ React8.createElement("tbody", {
870
+ }), paddingBottom > 0 && /* @__PURE__ */ React9.createElement("tbody", {
757
871
  role: "none"
758
- }, /* @__PURE__ */ React8.createElement("tr", {
872
+ }, /* @__PURE__ */ React9.createElement("tr", {
759
873
  role: "none"
760
- }, /* @__PURE__ */ React8.createElement("td", {
874
+ }, /* @__PURE__ */ React9.createElement("td", {
761
875
  style: {
762
876
  height: `${paddingBottom}px`
763
877
  },
764
878
  role: "none"
765
879
  }))));
766
880
  };
767
- var MemoizedVirtualisedTableContent = /* @__PURE__ */ React8.memo(VirtualizedTableContent);
881
+ var MemoizedVirtualisedTableContent = /* @__PURE__ */ React9.memo(VirtualizedTableContent);
768
882
  var GroupedTableContent = () => {
769
883
  const { table: { getGroupedRowModel: getGroupedRowModel2, getHeaderGroups, getState }, debug } = useTableContext();
770
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
771
- return /* @__PURE__ */ React8.createElement(Fragment, {
884
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
885
+ return /* @__PURE__ */ React9.createElement(Fragment, {
772
886
  key: i
773
- }, /* @__PURE__ */ React8.createElement("thead", null, /* @__PURE__ */ React8.createElement("tr", null, debug && /* @__PURE__ */ React8.createElement("th", null), /* @__PURE__ */ React8.createElement("th", {
887
+ }, /* @__PURE__ */ React9.createElement("thead", null, /* @__PURE__ */ React9.createElement("tr", null, debug && /* @__PURE__ */ React9.createElement("th", null), /* @__PURE__ */ React9.createElement("th", {
774
888
  // TODO(burdon): Calculate row span.
775
889
  colSpan: getHeaderGroups()[0].headers.length,
776
890
  className: groupTh({})
777
- }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React8.createElement(TableBody, {
891
+ }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React9.createElement(TableBody, {
778
892
  rows: row.subRows
779
893
  }));
780
894
  }));
781
895
  };
782
896
 
783
- // packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx
784
- import { CaretDown as CaretDown2 } from "@phosphor-icons/react";
785
- import React9, { useCallback as useCallback3, useState as useState6 } from "react";
786
- import { Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
787
- import { PopoverCombobox } from "@dxos/react-ui-searchlist";
788
- import { descriptionText, getSize as getSize3, mx as mx4, staticPlaceholderText } from "@dxos/react-ui-theme";
789
- var initialItems = (model, value) => value ? {
790
- [model.getId(value)]: {
791
- label: model.getText(value),
792
- data: value
793
- }
794
- } : {};
795
- var CellCombobox = ({ model, value, onValueChange }) => {
796
- const { t } = useTranslation2(translationKey);
797
- const [items, setItems] = useState6(initialItems(model, value));
798
- const [loading, setLoading] = useState6(false);
799
- const [searchInputValue, setSearchInputValue] = useState6("");
800
- const handleSearchInputValueChange = async (text) => {
801
- setSearchInputValue(text ?? "");
802
- setLoading(true);
803
- const items2 = await model.query(text);
804
- setItems(items2.reduce((acc, item) => {
805
- acc[model.getId(item)] = {
806
- label: model.getText(item),
807
- data: item
808
- };
809
- return acc;
810
- }, initialItems(model, value)));
811
- setLoading(false);
812
- };
813
- const handleValueChange = useCallback3((id) => {
814
- onValueChange(items[id]?.data);
815
- }, [
816
- items,
817
- onValueChange
818
- ]);
819
- return /* @__PURE__ */ React9.createElement(PopoverCombobox.Root, {
820
- placeholder: t("no selection label")
821
- }, /* @__PURE__ */ React9.createElement(PopoverCombobox.Trigger, {
822
- variant: "ghost",
823
- classNames: "is-full rounded-none ring-inset"
824
- }, value ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", {
825
- className: mx4("font-normal text-start text-base flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
826
- }, model.getText(value)), /* @__PURE__ */ React9.createElement(CaretDown2, {
827
- weight: "bold",
828
- className: getSize3(3)
829
- })) : null), /* @__PURE__ */ React9.createElement(PopoverCombobox.Content, {
830
- shouldFilter: false,
831
- classNames: "is-[--radix-popover-trigger-width]"
832
- }, /* @__PURE__ */ React9.createElement(PopoverCombobox.Input, {
833
- value: searchInputValue,
834
- onValueChange: handleSearchInputValueChange
835
- }), /* @__PURE__ */ React9.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React9.createElement("p", {
836
- className: mx4("text-center", descriptionText)
837
- }, "Start typing to search") : loading ? /* @__PURE__ */ React9.createElement("p", {
838
- className: mx4("text-center", descriptionText)
839
- }, "Searching\u2026") : /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(PopoverCombobox.Empty, {
840
- classNames: [
841
- "text-center",
842
- descriptionText
843
- ]
844
- }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React9.createElement(PopoverCombobox.Item, {
845
- key: id,
846
- value: id,
847
- onSelect: handleValueChange,
848
- classNames: "truncate"
849
- }, label)))), /* @__PURE__ */ React9.createElement(Popover2.Arrow, null)));
850
- };
851
-
852
897
  // packages/ui/react-ui-table/src/helpers.tsx
853
898
  import { useFocusFinders } from "@fluentui/react-tabster";
854
899
  import { Check as Check2, ClipboardText, X as X3 } from "@phosphor-icons/react";
@@ -1246,11 +1291,162 @@ var ColumnBuilder = class {
1246
1291
  ...props
1247
1292
  };
1248
1293
  }
1294
+ /**
1295
+ * This display column type is for nested/unhandled data to appear as JSON.
1296
+ */
1297
+ display({ label, classNames, ...props } = {}) {
1298
+ return {
1299
+ size: 120,
1300
+ minSize: 120,
1301
+ header: (cell) => label ?? cell.header.id,
1302
+ cell: (cell) => {
1303
+ const value = cell.getValue();
1304
+ return /* @__PURE__ */ React10.createElement("div", {
1305
+ className: "overflow-scroll"
1306
+ }, /* @__PURE__ */ React10.createElement("code", {
1307
+ className: "text-xs"
1308
+ }, JSON.stringify(value)));
1309
+ },
1310
+ ...props,
1311
+ meta: {
1312
+ ...props.meta,
1313
+ cell: {
1314
+ ...props.meta?.cell,
1315
+ classNames: [
1316
+ "font-mono",
1317
+ textPadding,
1318
+ classNames
1319
+ ]
1320
+ }
1321
+ }
1322
+ };
1323
+ }
1324
+ };
1325
+
1326
+ // packages/ui/react-ui-table/src/schema/schema.ts
1327
+ import * as AST from "@effect/schema/AST";
1328
+ var classifySchemaProperties = (schema) => {
1329
+ const recurse = (node, path, acc) => {
1330
+ const properties = AST.getPropertySignatures(node);
1331
+ properties.forEach((prop) => {
1332
+ const propName = prop.name.toString();
1333
+ if (prop.isOptional) {
1334
+ const unwrappedAst = unwrapOptionProperty(prop);
1335
+ if (isStruct(unwrappedAst)) {
1336
+ return recurse(unwrappedAst, [
1337
+ ...path,
1338
+ propName
1339
+ ], acc);
1340
+ }
1341
+ }
1342
+ if (isStruct(prop.type)) {
1343
+ recurse(prop.type, [
1344
+ ...path,
1345
+ propName
1346
+ ], acc);
1347
+ } else {
1348
+ acc.push([
1349
+ path.concat(propName).join("."),
1350
+ propertyToColumn(prop)
1351
+ ]);
1352
+ }
1353
+ });
1354
+ return acc;
1355
+ };
1356
+ return recurse(schema.ast, [], []);
1357
+ };
1358
+ var isStruct = (node) => AST.isTypeLiteral(node);
1359
+ var isOptionalUnion = (prop) => AST.isUnion(prop.type) && prop.isOptional;
1360
+ var unwrapOptionProperty = (prop) => {
1361
+ if (!isOptionalUnion(prop)) {
1362
+ throw new Error(`Not an optional property: ${String(prop.name)}`);
1363
+ }
1364
+ if (!AST.isUnion(prop.type)) {
1365
+ throw new Error(`Not a union type: ${String(prop.name)}`);
1366
+ }
1367
+ const [type, _undefinedCase] = prop.type.types;
1368
+ return type;
1369
+ };
1370
+ var typeToColumn = (type) => {
1371
+ if (AST.isStringKeyword(type)) {
1372
+ return "string";
1373
+ } else if (AST.isNumberKeyword(type)) {
1374
+ return "number";
1375
+ } else if (AST.isBooleanKeyword(type)) {
1376
+ return "boolean";
1377
+ }
1378
+ if (AST.isRefinement(type)) {
1379
+ return typeToColumn(type.from);
1380
+ }
1381
+ if (AST.isTransform(type)) {
1382
+ const identifier = AST.getIdentifierAnnotation(type);
1383
+ if (identifier._tag === "Some") {
1384
+ if (identifier.value === "DateFromString") {
1385
+ return "date";
1386
+ }
1387
+ }
1388
+ }
1389
+ return "display";
1390
+ };
1391
+ var propertyToColumn = (prop) => {
1392
+ let type = prop.type;
1393
+ if (prop.isOptional) {
1394
+ type = unwrapOptionProperty(prop);
1395
+ }
1396
+ return typeToColumn(type);
1397
+ };
1398
+
1399
+ // packages/ui/react-ui-table/src/schema/schemaToColumns.ts
1400
+ var schemaToColumnDefs = (schema) => {
1401
+ const { helper, builder } = createColumnBuilder();
1402
+ const classified = classifySchemaProperties(schema);
1403
+ return classified.map(([name, type]) => {
1404
+ const propertyKey = name.toString();
1405
+ let column;
1406
+ switch (type) {
1407
+ case "string": {
1408
+ column = builder.string({
1409
+ label: propertyKey
1410
+ });
1411
+ break;
1412
+ }
1413
+ case "number": {
1414
+ column = builder.number({
1415
+ label: propertyKey
1416
+ });
1417
+ break;
1418
+ }
1419
+ case "boolean": {
1420
+ column = builder.switch({
1421
+ label: propertyKey
1422
+ });
1423
+ break;
1424
+ }
1425
+ case "date": {
1426
+ column = builder.date({
1427
+ label: propertyKey
1428
+ });
1429
+ break;
1430
+ }
1431
+ case "display": {
1432
+ column = builder.display({
1433
+ label: propertyKey,
1434
+ id: propertyKey
1435
+ });
1436
+ break;
1437
+ }
1438
+ default: {
1439
+ throw new Error(`Unhandled column type: ${type}`);
1440
+ }
1441
+ }
1442
+ return helper.accessor(propertyKey, column);
1443
+ });
1249
1444
  };
1250
1445
  export {
1251
1446
  CellCombobox,
1252
1447
  ColumnBuilder,
1253
1448
  ColumnMenu,
1449
+ ColumnSettingsForm,
1254
1450
  ColumnSettingsPanel,
1255
1451
  MemoizedVirtualisedTableContent,
1256
1452
  SortIndicator,
@@ -1261,6 +1457,7 @@ export {
1261
1457
  gridCellFocusRing,
1262
1458
  groupTh,
1263
1459
  headPadding,
1460
+ schemaToColumnDefs,
1264
1461
  selectedRow,
1265
1462
  tableRoot,
1266
1463
  tbodyRoot,
@@ -1275,6 +1472,8 @@ export {
1275
1472
  theadRoot,
1276
1473
  theadTh,
1277
1474
  theadTr,
1278
- translations_default as translations
1475
+ translations_default as translations,
1476
+ useColumnSorting,
1477
+ usePinLastRow
1279
1478
  };
1280
1479
  //# sourceMappingURL=index.mjs.map