@dxos/react-ui-table 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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 (95) hide show
  1. package/dist/lib/browser/{chunk-PFFO5LYM.mjs → chunk-YWNRUF4J.mjs} +6 -7
  2. package/dist/lib/browser/chunk-YWNRUF4J.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +181 -330
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-VREQOYRW.cjs → chunk-TGG6OZ54.cjs} +8 -9
  8. package/dist/lib/node/chunk-TGG6OZ54.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +160 -306
  10. package/dist/lib/node/index.cjs.map +4 -4
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/types/index.cjs +3 -3
  13. package/dist/lib/node/types/index.cjs.map +1 -1
  14. package/dist/lib/node-esm/{chunk-34JG3SDI.mjs → chunk-KKLP54L3.mjs} +6 -7
  15. package/dist/lib/node-esm/chunk-KKLP54L3.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +181 -330
  17. package/dist/lib/node-esm/index.mjs.map +4 -4
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/lib/node-esm/types/index.mjs +1 -1
  20. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
  21. package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
  22. package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
  23. package/dist/types/src/components/Table/DynamicTable.d.ts +4 -3
  24. package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
  25. package/dist/types/src/components/Table/RefPanel.d.ts +9 -0
  26. package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -0
  27. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  28. package/dist/types/src/components/Table/Table.d.ts +0 -2
  29. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  30. package/dist/types/src/components/Table/Table.stories.d.ts +0 -1
  31. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +0 -3
  34. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  35. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/TableCellEditor/extension.d.ts.map +1 -1
  37. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -2
  38. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
  39. package/dist/types/src/components/testing.d.ts +40 -40
  40. package/dist/types/src/components/testing.d.ts.map +1 -1
  41. package/dist/types/src/hooks/useTableModel.d.ts +2 -2
  42. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  43. package/dist/types/src/model/modal-controller.d.ts +3 -3
  44. package/dist/types/src/model/modal-controller.d.ts.map +1 -1
  45. package/dist/types/src/model/selection-model.d.ts.map +1 -1
  46. package/dist/types/src/model/table-model.d.ts.map +1 -1
  47. package/dist/types/src/model/table-presentation.d.ts.map +1 -1
  48. package/dist/types/src/types/table.d.ts +43 -44
  49. package/dist/types/src/types/table.d.ts.map +1 -1
  50. package/dist/types/src/util/dynamic-table.d.ts +3 -4
  51. package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
  52. package/dist/types/src/util/index.d.ts +0 -1
  53. package/dist/types/src/util/index.d.ts.map +1 -1
  54. package/dist/types/src/util/signals.d.ts.map +1 -1
  55. package/dist/types/src/util/table-buttons.d.ts +14 -0
  56. package/dist/types/src/util/table-buttons.d.ts.map +1 -1
  57. package/dist/types/src/util/table-controls.d.ts.map +1 -1
  58. package/dist/types/src/util/table.d.ts +2 -2
  59. package/dist/types/src/util/table.d.ts.map +1 -1
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +33 -34
  62. package/src/components/Table/CreateRefPanel.tsx +5 -5
  63. package/src/components/Table/DynamicTable.stories.tsx +4 -4
  64. package/src/components/Table/DynamicTable.tsx +5 -4
  65. package/src/components/Table/RefPanel.tsx +52 -0
  66. package/src/components/Table/Table.stories.tsx +27 -73
  67. package/src/components/Table/Table.tsx +28 -25
  68. package/src/components/Table/relations.stories.tsx +31 -38
  69. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +10 -11
  70. package/src/components/TableCellEditor/TableCellEditor.tsx +4 -45
  71. package/src/components/TableToolbar/TableToolbar.tsx +13 -12
  72. package/src/components/testing.ts +9 -10
  73. package/src/hooks/useTableModel.ts +2 -2
  74. package/src/model/modal-controller.ts +3 -3
  75. package/src/model/table-model.test.ts +6 -7
  76. package/src/model/table-model.ts +2 -19
  77. package/src/model/table-presentation.test.ts +6 -7
  78. package/src/model/table-presentation.ts +10 -54
  79. package/src/types/table.ts +7 -15
  80. package/src/util/dynamic-table.ts +6 -9
  81. package/src/util/index.ts +0 -1
  82. package/src/util/table-buttons.ts +23 -0
  83. package/src/util/table.ts +16 -13
  84. package/dist/lib/browser/chunk-PFFO5LYM.mjs.map +0 -7
  85. package/dist/lib/node/chunk-VREQOYRW.cjs.map +0 -7
  86. package/dist/lib/node-esm/chunk-34JG3SDI.mjs.map +0 -7
  87. package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +0 -13
  88. package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +0 -1
  89. package/dist/types/src/util/schema.d.ts +0 -12
  90. package/dist/types/src/util/schema.d.ts.map +0 -1
  91. package/dist/types/src/util/tag.d.ts +0 -11
  92. package/dist/types/src/util/tag.d.ts.map +0 -1
  93. package/src/components/TableCellEditor/FormCellEditor.tsx +0 -94
  94. package/src/util/schema.ts +0 -36
  95. package/src/util/tag.ts +0 -33
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TableSchema,
3
3
  TableType
4
- } from "./chunk-PFFO5LYM.mjs";
4
+ } from "./chunk-YWNRUF4J.mjs";
5
5
 
6
6
  // packages/ui/react-ui-table/src/translations.ts
7
7
  var translationKey = "table";
@@ -36,13 +36,13 @@ var translations_default = [
36
36
  ];
37
37
 
38
38
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
39
- import React7, { forwardRef, useCallback as useCallback5, useImperativeHandle, useState as useState2, useMemo as useMemo5, useEffect as useEffect3 } from "react";
39
+ import React7, { forwardRef, useCallback as useCallback4, useImperativeHandle, useState as useState2, useMemo as useMemo4, useEffect as useEffect2 } from "react";
40
40
  import { getValue as getValue4 } from "@dxos/echo-schema";
41
- import { invariant as invariant4 } from "@dxos/invariant";
41
+ import { invariant as invariant3 } from "@dxos/invariant";
42
42
  import { Filter } from "@dxos/react-client/echo";
43
43
  import { useTranslation as useTranslation3 } from "@dxos/react-ui";
44
44
  import { useAttention } from "@dxos/react-ui-attention";
45
- import { closestCell, Grid, gridSeparatorInlineEnd, gridSeparatorBlockEnd } from "@dxos/react-ui-grid";
45
+ import { closestCell, Grid } from "@dxos/react-ui-grid";
46
46
  import { mx as mx2 } from "@dxos/react-ui-theme";
47
47
  import { isNotFalsy, safeParseInt } from "@dxos/util";
48
48
 
@@ -150,9 +150,9 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
150
150
  };
151
151
 
152
152
  // packages/ui/react-ui-table/src/components/Table/CreateRefPanel.tsx
153
- import { Schema } from "effect";
154
153
  import React3, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
155
- import { live } from "@dxos/react-client/echo";
154
+ import { S } from "@dxos/echo-schema";
155
+ import { create } from "@dxos/react-client/echo";
156
156
  import { Popover } from "@dxos/react-ui";
157
157
  import { Form } from "@dxos/react-ui-form";
158
158
  import { useGridContext } from "@dxos/react-ui-grid";
@@ -168,7 +168,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
168
168
  typename: state.typename
169
169
  }).runSync();
170
170
  if (schema2) {
171
- const omit = Schema.omit("id");
171
+ const omit = S.omit("id");
172
172
  return omit(schema2);
173
173
  }
174
174
  }, [
@@ -183,7 +183,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
183
183
  typename: state.typename
184
184
  }).runSync();
185
185
  if (schema2) {
186
- const obj = space.db.add(live(schema2, values));
186
+ const obj = space.db.add(create(schema2, values));
187
187
  state.onCreate?.(obj);
188
188
  }
189
189
  void modals.close();
@@ -223,8 +223,46 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
223
223
  }), /* @__PURE__ */ React3.createElement(Popover.Arrow, null))));
224
224
  };
225
225
 
226
- // packages/ui/react-ui-table/src/components/Table/RowActionsMenu.tsx
226
+ // packages/ui/react-ui-table/src/components/Table/RefPanel.tsx
227
227
  import React4 from "react";
228
+ import { Popover as Popover2 } from "@dxos/react-ui";
229
+ import { Form as Form2 } from "@dxos/react-ui-form";
230
+ var getRefTargetObj = (space, id) => {
231
+ if (space && id) {
232
+ return space?.db.getObjectById(id);
233
+ } else {
234
+ return void 0;
235
+ }
236
+ };
237
+ var RefPanel = ({ model, modals }) => {
238
+ const state = modals.state.value;
239
+ const space = model?.space;
240
+ const targetObj = getRefTargetObj(space, state?.type === "refPanel" ? state.targetId : void 0);
241
+ const schema = space && state?.type === "refPanel" ? space.db.schemaRegistry.getSchema(state.typename) : void 0;
242
+ if (!model.view || !model.projection) {
243
+ return null;
244
+ }
245
+ return /* @__PURE__ */ React4.createElement(Popover2.Root, {
246
+ modal: false,
247
+ open: state?.type === "refPanel" && !!targetObj && !!schema,
248
+ onOpenChange: (nextOpen) => {
249
+ if (!nextOpen) {
250
+ return modals.close();
251
+ }
252
+ }
253
+ }, /* @__PURE__ */ React4.createElement(Popover2.VirtualTrigger, {
254
+ virtualRef: modals.trigger
255
+ }), /* @__PURE__ */ React4.createElement(Popover2.Portal, null, /* @__PURE__ */ React4.createElement(Popover2.Content, {
256
+ classNames: "md:is-64"
257
+ }, targetObj && schema && /* @__PURE__ */ React4.createElement(Form2, {
258
+ readonly: true,
259
+ values: targetObj,
260
+ schema
261
+ }), /* @__PURE__ */ React4.createElement(Popover2.Arrow, null))));
262
+ };
263
+
264
+ // packages/ui/react-ui-table/src/components/Table/RowActionsMenu.tsx
265
+ import React5 from "react";
228
266
  import { DropdownMenu as DropdownMenu3, useTranslation as useTranslation2 } from "@dxos/react-ui";
229
267
  var RowActionsMenu = ({ model, modals }) => {
230
268
  const { t } = useTranslation2(translationKey);
@@ -233,23 +271,23 @@ var RowActionsMenu = ({ model, modals }) => {
233
271
  if (state?.type !== "row") {
234
272
  return null;
235
273
  }
236
- return /* @__PURE__ */ React4.createElement(DropdownMenu3.Root, {
274
+ return /* @__PURE__ */ React5.createElement(DropdownMenu3.Root, {
237
275
  modal: false,
238
276
  open: true,
239
277
  onOpenChange: modals.close
240
- }, /* @__PURE__ */ React4.createElement(DropdownMenu3.VirtualTrigger, {
278
+ }, /* @__PURE__ */ React5.createElement(DropdownMenu3.VirtualTrigger, {
241
279
  virtualRef: modals.trigger
242
- }), /* @__PURE__ */ React4.createElement(DropdownMenu3.Content, null, /* @__PURE__ */ React4.createElement(DropdownMenu3.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ React4.createElement(DropdownMenu3.Item, {
280
+ }), /* @__PURE__ */ React5.createElement(DropdownMenu3.Content, null, /* @__PURE__ */ React5.createElement(DropdownMenu3.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ React5.createElement(DropdownMenu3.Item, {
243
281
  "data-testid": "row-menu-delete",
244
282
  onClick: () => model.deleteRow(state.rowIndex)
245
- }, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ React4.createElement(DropdownMenu3.Item, {
283
+ }, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ React5.createElement(DropdownMenu3.Item, {
246
284
  key: action.id,
247
285
  "data-testid": `row-action-${action.id}`,
248
286
  onClick: () => {
249
287
  modals.close();
250
288
  model.handleRowAction(action.id, state.rowIndex);
251
289
  }
252
- }, t(action.translationKey)))), /* @__PURE__ */ React4.createElement(DropdownMenu3.Arrow, null)));
290
+ }, t(action.translationKey)))), /* @__PURE__ */ React5.createElement(DropdownMenu3.Arrow, null)));
253
291
  };
254
292
 
255
293
  // packages/ui/react-ui-table/src/model/table-model.ts
@@ -257,7 +295,7 @@ import { computed as computed3, effect as effect2, signal as signal3 } from "@pr
257
295
  import { Resource as Resource2 } from "@dxos/context";
258
296
  import { FormatEnum as FormatEnum3, getValue as getValue2, setValue } from "@dxos/echo-schema";
259
297
  import { invariant } from "@dxos/invariant";
260
- import { isLiveObject, makeRef as makeRef2 } from "@dxos/live-object";
298
+ import { isReactiveObject, makeRef as makeRef3 } from "@dxos/live-object";
261
299
  import { formatForEditing, parseValue } from "@dxos/react-ui-form";
262
300
 
263
301
  // packages/ui/react-ui-table/src/model/selection-model.ts
@@ -265,10 +303,9 @@ import { computed, effect, signal } from "@preact/signals-core";
265
303
  import { Resource } from "@dxos/context";
266
304
 
267
305
  // packages/ui/react-ui-table/src/util/dynamic-table.ts
268
- import { getTypename, toJsonSchema } from "@dxos/echo-schema";
269
- import { live as live2, makeRef } from "@dxos/live-object";
306
+ import { create as create2, makeRef } from "@dxos/live-object";
270
307
  import { createView, getSchemaFromPropertyDefinitions, ViewProjection } from "@dxos/schema";
271
- var getBaseSchema = ({ typename, properties, jsonSchema, schema }) => {
308
+ var getBaseSchems = ({ typename, properties, jsonSchema, schema }) => {
272
309
  if (typename && properties) {
273
310
  const schema2 = getSchemaFromPropertyDefinitions(typename, properties);
274
311
  return {
@@ -277,8 +314,8 @@ var getBaseSchema = ({ typename, properties, jsonSchema, schema }) => {
277
314
  };
278
315
  } else if (schema) {
279
316
  return {
280
- typename: getTypename(schema),
281
- jsonSchema: toJsonSchema(schema)
317
+ typename: schema.typename,
318
+ jsonSchema: schema.jsonSchema
282
319
  };
283
320
  } else if (typename && jsonSchema) {
284
321
  return {
@@ -298,7 +335,7 @@ var makeDynamicTable = ({ typename, jsonSchema, properties }) => {
298
335
  fields: properties.map((property) => property.name)
299
336
  }
300
337
  });
301
- const table = live2(TableType, {
338
+ const table = create2(TableType, {
302
339
  name: "dynamic-table",
303
340
  view: makeRef(view)
304
341
  });
@@ -345,10 +382,9 @@ var setProperties = (view, projection, properties) => {
345
382
  var touch = (value) => value;
346
383
 
347
384
  // packages/ui/react-ui-table/src/util/table.ts
348
- import { Schema as Schema2, SchemaAST } from "effect";
349
- import { Format, FormatEnum, Ref, TypedObject, TypeEnum } from "@dxos/echo-schema";
385
+ import { AST, Format, FormatEnum, S as S2, TypedObject, TypeEnum } from "@dxos/echo-schema";
350
386
  import { PublicKey } from "@dxos/react-client";
351
- import { live as live3 } from "@dxos/react-client/echo";
387
+ import { create as create3, makeRef as makeRef2 } from "@dxos/react-client/echo";
352
388
  import { createFieldId, createView as createView2, getSchemaProperties, ViewProjection as ViewProjection2 } from "@dxos/schema";
353
389
  var initializeTable = async ({ client, space, table, typename, initialRow = true }) => {
354
390
  if (typename) {
@@ -356,8 +392,8 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
356
392
  if (!schema) {
357
393
  throw new Error(`Schema not found: ${typename}`);
358
394
  }
359
- const fields = getSchemaProperties(schema.ast).map((prop) => prop.name);
360
- table.view = Ref.make(createView2({
395
+ const fields = getSchemaProperties(schema.ast).filter((prop) => prop.format !== FormatEnum.Ref).map((prop) => prop.name);
396
+ table.view = makeRef2(createView2({
361
397
  // TODO(ZaymonFC): Don't hardcode name?
362
398
  name: "View",
363
399
  typename: schema.typename,
@@ -370,7 +406,7 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
370
406
  ContactSchema
371
407
  ]);
372
408
  const fields = ContactFields;
373
- table.view = Ref.make(createView2({
409
+ table.view = makeRef2(createView2({
374
410
  name: "View",
375
411
  typename: schema.typename,
376
412
  jsonSchema: schema.jsonSchema,
@@ -378,7 +414,7 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
378
414
  }));
379
415
  createProjection(schema, table.view.target);
380
416
  if (initialRow) {
381
- space.db.add(live3(schema, {}));
417
+ space.db.add(create3(schema, {}));
382
418
  }
383
419
  return schema;
384
420
  }
@@ -387,13 +423,13 @@ var ContactSchema = TypedObject({
387
423
  typename: `example.com/type/${PublicKey.random().truncate()}`,
388
424
  version: "0.1.0"
389
425
  })({
390
- name: Schema2.optional(Schema2.String).annotations({
391
- [SchemaAST.TitleAnnotationId]: "Name"
426
+ name: S2.optional(S2.String).annotations({
427
+ [AST.TitleAnnotationId]: "Name"
392
428
  }),
393
- active: Schema2.optional(Schema2.Boolean),
394
- email: Schema2.optional(Format.Email),
395
- salary: Schema2.optional(Format.Currency()).annotations({
396
- [SchemaAST.TitleAnnotationId]: "Salary"
429
+ active: S2.optional(S2.Boolean),
430
+ email: S2.optional(Format.Email),
431
+ salary: S2.optional(Format.Currency()).annotations({
432
+ [AST.TitleAnnotationId]: "Salary"
397
433
  })
398
434
  });
399
435
  var ContactFields = [
@@ -482,6 +518,26 @@ var columnSettingsButton = {
482
518
  fieldId: el.getAttribute("data-field-id")
483
519
  })
484
520
  };
521
+ var referencedCellButton = {
522
+ attr: BUTTON_IDENTIFIERS.referencedCell,
523
+ icon: "ph--link-simple-horizontal--regular",
524
+ render: ({ targetId, schemaId }) => {
525
+ return createButton({
526
+ attr: BUTTON_IDENTIFIERS.referencedCell,
527
+ icon: referencedCellButton.icon,
528
+ data: {
529
+ "data-target-id": targetId,
530
+ "data-schema-id": schemaId
531
+ },
532
+ testId: "table-ref-cell-button"
533
+ });
534
+ },
535
+ getData: (el) => ({
536
+ type: "referencedCell",
537
+ targetId: el.getAttribute("data-target-id"),
538
+ schemaId: el.getAttribute("data-schema-id")
539
+ })
540
+ };
485
541
  var rowMenuButton = {
486
542
  attr: BUTTON_IDENTIFIERS.rowMenu,
487
543
  icon: "ph--dots-three--regular",
@@ -526,6 +582,7 @@ var sortButton = {
526
582
  var tableButtons = {
527
583
  addColumn: addColumnButton,
528
584
  columnSettings: columnSettingsButton,
585
+ referencedCell: referencedCellButton,
529
586
  rowMenu: rowMenuButton,
530
587
  sort: sortButton
531
588
  };
@@ -584,21 +641,6 @@ var tableControls = {
584
641
  }
585
642
  };
586
643
 
587
- // packages/ui/react-ui-table/src/util/schema.ts
588
- import { Schema as Schema3 } from "effect";
589
- import { isTypeLiteral, TypeLiteral } from "effect/SchemaAST";
590
- var narrowSchema = (schema, paths) => {
591
- const ast = schema?.ast;
592
- if (isTypeLiteral(ast)) {
593
- const propertySignatures = ast.propertySignatures.filter((signature) => paths.includes(signature.name.toString()));
594
- if (propertySignatures.length > 0) {
595
- const narrowType = new TypeLiteral(propertySignatures, []);
596
- return Schema3.make(narrowType);
597
- }
598
- }
599
- return void 0;
600
- };
601
-
602
644
  // packages/ui/react-ui-table/src/model/selection-model.ts
603
645
  var SelectionModel = class extends Resource {
604
646
  constructor(_rows, _selectionMode, _onSelectionChanged) {
@@ -851,22 +893,6 @@ var TableSorting = class {
851
893
  }
852
894
  };
853
895
 
854
- // packages/ui/react-ui-table/src/util/tag.ts
855
- var TAG_PATTERN_REGEX = /\[([^\]]+)\]\(([^)]+)\)/g;
856
- var extractTagIds = (value) => {
857
- if (typeof value !== "string") {
858
- return void 0;
859
- }
860
- const ids = [];
861
- let match;
862
- while ((match = TAG_PATTERN_REGEX.exec(value)) !== null) {
863
- if (match[2]) {
864
- ids.push(match[2]);
865
- }
866
- }
867
- return ids.length > 0 ? ids : void 0;
868
- };
869
-
870
896
  // packages/ui/react-ui-table/src/model/table-model.ts
871
897
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/model/table-model.ts";
872
898
  var defaultFeatures = {
@@ -966,22 +992,8 @@ var TableModel = class extends Resource2 {
966
992
  const { props } = this._projection.getFieldProjection(field.id);
967
993
  switch (props.format) {
968
994
  case FormatEnum3.Ref: {
969
- if (isLiveObject(value)) {
970
- setValue(this._rows.value[rowIdx], field.path, makeRef2(value));
971
- }
972
- break;
973
- }
974
- case FormatEnum3.SingleSelect: {
975
- const ids = extractTagIds(value);
976
- if (ids && ids.length > 0) {
977
- setValue(this._rows.value[rowIdx], field.path, ids[0]);
978
- }
979
- break;
980
- }
981
- case FormatEnum3.MultiSelect: {
982
- const ids = extractTagIds(value);
983
- if (ids) {
984
- setValue(this._rows.value[rowIdx], field.path, ids);
995
+ if (isReactiveObject(value)) {
996
+ setValue(this._rows.value[rowIdx], field.path, makeRef3(value));
985
997
  }
986
998
  break;
987
999
  }
@@ -1005,7 +1017,7 @@ var TableModel = class extends Resource2 {
1005
1017
  };
1006
1018
  invariant(!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === "single"), "Single selection is not compatible with editable tables.", {
1007
1019
  F: __dxlog_file,
1008
- L: 115,
1020
+ L: 114,
1009
1021
  S: this,
1010
1022
  A: [
1011
1023
  "!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === 'single')",
@@ -1065,7 +1077,7 @@ var TableModel = class extends Resource2 {
1065
1077
  get columnMeta() {
1066
1078
  invariant(this._columnMeta, void 0, {
1067
1079
  F: __dxlog_file,
1068
- L: 184,
1080
+ L: 183,
1069
1081
  S: this,
1070
1082
  A: [
1071
1083
  "this._columnMeta",
@@ -1291,8 +1303,7 @@ var ModalController = class {
1291
1303
 
1292
1304
  // packages/ui/react-ui-table/src/model/table-presentation.ts
1293
1305
  import { signal as signal5 } from "@preact/signals-core";
1294
- import { isNotNullable } from "effect/Predicate";
1295
- import { FormatEnum as FormatEnum4, getDXN, getValue as getValue3, TypeEnum as TypeEnum3 } from "@dxos/echo-schema";
1306
+ import { FormatEnum as FormatEnum4, getValue as getValue3 } from "@dxos/echo-schema";
1296
1307
  import { cellClassesForFieldType, formatForDisplay as formatForDisplay2 } from "@dxos/react-ui-form";
1297
1308
  import { toPlaneCellIndex } from "@dxos/react-ui-grid";
1298
1309
  import { mx } from "@dxos/react-ui-theme";
@@ -1354,9 +1365,6 @@ var TablePresentation = class {
1354
1365
  if (value == null) {
1355
1366
  return "";
1356
1367
  }
1357
- if (props.type === "array") {
1358
- return "";
1359
- }
1360
1368
  switch (props.format) {
1361
1369
  case FormatEnum4.Boolean:
1362
1370
  case FormatEnum4.SingleSelect:
@@ -1394,38 +1402,13 @@ var TablePresentation = class {
1394
1402
  if (classes.length > 0) {
1395
1403
  cell.className = mx(classes.flat());
1396
1404
  }
1397
- if (props.type === TypeEnum3.Array) {
1398
- const targetArray = getValue3(obj, field.path);
1399
- if (targetArray && Array.isArray(targetArray)) {
1400
- const getLabel = (value) => {
1401
- if (!value) {
1402
- return void 0;
1403
- }
1404
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
1405
- return String(value);
1406
- }
1407
- if (Array.isArray(value)) {
1408
- return "Array";
1409
- }
1410
- if (typeof value === "object" && value.name) {
1411
- return value.name;
1412
- }
1413
- if (typeof value === "object" && value.value) {
1414
- return `${value.value}`;
1415
- }
1416
- return "Object";
1417
- };
1418
- const tags = targetArray.map(getLabel).filter(isNotNullable).map((title) => {
1419
- return `<span class="dx-tag rounded-xl" data-hue="neutral">${title}</span>`;
1420
- }).join("");
1421
- cell.accessoryHtml = `<div role='none' class="flex flex-row gap-1 overflow-x-auto">${tags}</div>`;
1422
- }
1423
- }
1424
1405
  if (props.format === FormatEnum4.Ref && props.referenceSchema) {
1425
1406
  const targetObj = getValue3(obj, field.path)?.target;
1426
1407
  if (targetObj) {
1427
- const dxn = getDXN(targetObj)?.toString();
1428
- cell.accessoryHtml = `<dx-ref-tag ref=${dxn} class="dx-button block is-6 pli-[3px] plb-[3px] pbe-[2px] min-bs-0 absolute inline-end-1"><dx-icon icon="ph--link-simple--regular"/></dx-ref-tag>`;
1408
+ cell.accessoryHtml = tableButtons.referencedCell.render({
1409
+ targetId: targetObj.id,
1410
+ schemaId: props.referenceSchema
1411
+ });
1429
1412
  }
1430
1413
  }
1431
1414
  if (props.format === FormatEnum4.Boolean) {
@@ -1459,7 +1442,7 @@ var TablePresentation = class {
1459
1442
  return null;
1460
1443
  }).filter(Boolean).join(" ");
1461
1444
  if (tags) {
1462
- cell.accessoryHtml = `<div role='none' class="flex flex-row gap-1">${tags}</div>`;
1445
+ cell.accessoryHtml = tags;
1463
1446
  }
1464
1447
  }
1465
1448
  }
@@ -1504,7 +1487,7 @@ var TablePresentation = class {
1504
1487
  fieldId: field.id
1505
1488
  })}
1506
1489
  `,
1507
- className: "!bg-toolbarSurface"
1490
+ className: "!bg-gridHeader"
1508
1491
  };
1509
1492
  }
1510
1493
  return cells;
@@ -1555,7 +1538,7 @@ var TablePresentation = class {
1555
1538
  col: 0,
1556
1539
  row: 0
1557
1540
  })]: {
1558
- className: "!bg-toolbarSurface",
1541
+ className: "!bg-gridHeader",
1559
1542
  readonly: true,
1560
1543
  value: ""
1561
1544
  }
@@ -1571,7 +1554,7 @@ var TablePresentation = class {
1571
1554
  header: true,
1572
1555
  checked: this.model.selection.allRowsSeleted.value
1573
1556
  }),
1574
- className: "!bg-toolbarSurface",
1557
+ className: "!bg-gridHeader",
1575
1558
  readonly: true,
1576
1559
  value: ""
1577
1560
  }
@@ -1586,7 +1569,7 @@ var TablePresentation = class {
1586
1569
  accessoryHtml: this.model.features.schemaEditable ? tableButtons.addColumn.render({
1587
1570
  disabled: (this.model.view?.fields?.length ?? 0) >= VIEW_FIELD_LIMIT
1588
1571
  }) : void 0,
1589
- className: "!bg-toolbarSurface",
1572
+ className: "!bg-gridHeader",
1590
1573
  readonly: true,
1591
1574
  value: ""
1592
1575
  }
@@ -1617,109 +1600,14 @@ var cellClassesForRowSelection = (selected, selectionMode) => {
1617
1600
  };
1618
1601
 
1619
1602
  // packages/ui/react-ui-table/src/components/TableCellEditor/TableCellEditor.tsx
1620
- import React6, { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef2 } from "react";
1621
- import { FormatEnum as FormatEnum5, TypeEnum as TypeEnum4 } from "@dxos/echo-schema";
1622
- import { invariant as invariant3 } from "@dxos/invariant";
1603
+ import React6, { useCallback as useCallback3, useMemo as useMemo3, useRef } from "react";
1604
+ import { FormatEnum as FormatEnum5 } from "@dxos/echo-schema";
1605
+ import { invariant as invariant2 } from "@dxos/invariant";
1623
1606
  import { useThemeContext } from "@dxos/react-ui";
1624
1607
  import { createMarkdownExtensions } from "@dxos/react-ui-editor";
1625
- import { cellQuery, editorKeys, parseCellIndex as parseCellIndex2, useGridContext as useGridContext3, GridCellEditor } from "@dxos/react-ui-grid";
1608
+ import { cellQuery, editorKeys, parseCellIndex, useGridContext as useGridContext2, GridCellEditor } from "@dxos/react-ui-grid";
1626
1609
  import { tagPickerExtension, createLinks } from "@dxos/react-ui-tag-picker";
1627
1610
 
1628
- // packages/ui/react-ui-table/src/components/TableCellEditor/FormCellEditor.tsx
1629
- import React5, { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo3, useRef } from "react";
1630
- import { getSnapshot } from "@dxos/echo-schema";
1631
- import { invariant as invariant2 } from "@dxos/invariant";
1632
- import { Popover as Popover2 } from "@dxos/react-ui";
1633
- import { Form as Form2 } from "@dxos/react-ui-form";
1634
- import { parseCellIndex, useGridContext as useGridContext2 } from "@dxos/react-ui-grid";
1635
- import { getDeep, setDeep } from "@dxos/util";
1636
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/TableCellEditor/FormCellEditor.tsx";
1637
- var FormCellEditor = ({ fieldProjection, model, schema, __gridScope }) => {
1638
- const { editing, setEditing } = useGridContext2("ArrayEditor", __gridScope);
1639
- const cellRef = useRef(null);
1640
- useEffect2(() => {
1641
- if (editing && editing.cellElement) {
1642
- cellRef.current = editing.cellElement;
1643
- }
1644
- }, [
1645
- editing?.cellElement
1646
- ]);
1647
- const narrowedSchema = useMemo3(() => {
1648
- if (!schema) {
1649
- return void 0;
1650
- }
1651
- return narrowSchema(schema, [
1652
- fieldProjection.field.path
1653
- ]);
1654
- }, [
1655
- JSON.stringify(schema),
1656
- fieldProjection.field.path
1657
- ]);
1658
- const originalRow = useMemo3(() => {
1659
- if (model && editing) {
1660
- const cell = parseCellIndex(editing.index);
1661
- const row = model.getRowAt(cell.row);
1662
- invariant2(row, void 0, {
1663
- F: __dxlog_file3,
1664
- L: 47,
1665
- S: void 0,
1666
- A: [
1667
- "row",
1668
- ""
1669
- ]
1670
- });
1671
- return row;
1672
- }
1673
- return void 0;
1674
- }, [
1675
- model,
1676
- editing
1677
- ]);
1678
- const formValues = useMemo3(() => {
1679
- if (originalRow) {
1680
- return getSnapshot(originalRow);
1681
- }
1682
- }, [
1683
- originalRow
1684
- ]);
1685
- const handleSave = useCallback3((values) => {
1686
- const path = fieldProjection.field.path;
1687
- const value = getDeep(values, [
1688
- path
1689
- ]);
1690
- setDeep(originalRow, [
1691
- path
1692
- ], value);
1693
- setEditing(null);
1694
- }, [
1695
- fieldProjection.field.path,
1696
- originalRow
1697
- ]);
1698
- const handleOpenChange = useCallback3((nextOpen) => {
1699
- if (nextOpen === false) {
1700
- setEditing(null);
1701
- }
1702
- }, [
1703
- setEditing
1704
- ]);
1705
- if (!editing) {
1706
- return null;
1707
- }
1708
- return /* @__PURE__ */ React5.createElement(Popover2.Root, {
1709
- open: editing !== null,
1710
- onOpenChange: handleOpenChange
1711
- }, /* @__PURE__ */ React5.createElement(Popover2.VirtualTrigger, {
1712
- virtualRef: cellRef
1713
- }), /* @__PURE__ */ React5.createElement(Popover2.Content, {
1714
- tabIndex: -1,
1715
- classNames: "popover-consistent-width"
1716
- }, /* @__PURE__ */ React5.createElement(Popover2.Arrow, null), /* @__PURE__ */ React5.createElement(Form2, {
1717
- values: formValues,
1718
- schema: narrowedSchema,
1719
- onSave: handleSave
1720
- })));
1721
- };
1722
-
1723
1611
  // packages/ui/react-ui-table/src/components/TableCellEditor/extension.ts
1724
1612
  import { autocompletion, pickedCompletion } from "@codemirror/autocomplete";
1725
1613
  import { EditorView } from "@codemirror/view";
@@ -1760,67 +1648,27 @@ var completion = ({ debug, onQuery, onMatch }) => {
1760
1648
  };
1761
1649
 
1762
1650
  // packages/ui/react-ui-table/src/components/TableCellEditor/TableCellEditor.tsx
1763
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/TableCellEditor/TableCellEditor.tsx";
1651
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/TableCellEditor/TableCellEditor.tsx";
1764
1652
  var newValue = Symbol.for("newValue");
1765
1653
  var createOption = (text) => ({
1766
1654
  [newValue]: true,
1767
1655
  text
1768
1656
  });
1769
1657
  var isCreateOption = (data) => typeof data === "object" && data[newValue];
1770
- var TableValueEditor = ({ model, modals, schema, onEnter, onFocus, onQuery, __gridScope }) => {
1771
- const { editing } = useGridContext3("TableValueEditor", __gridScope);
1772
- const fieldProjection = useMemo4(() => {
1773
- if (!model || !editing) {
1774
- return;
1775
- }
1776
- const { col } = parseCellIndex2(editing.index);
1777
- const field = model.projection.view.fields[col];
1778
- const fieldProjection2 = model.projection.getFieldProjection(field.id);
1779
- invariant3(fieldProjection2, void 0, {
1780
- F: __dxlog_file4,
1781
- L: 73,
1782
- S: void 0,
1783
- A: [
1784
- "fieldProjection",
1785
- ""
1786
- ]
1787
- });
1788
- return fieldProjection2;
1789
- }, [
1790
- model,
1791
- editing
1792
- ]);
1793
- if (fieldProjection?.props.type === TypeEnum4.Array) {
1794
- return /* @__PURE__ */ React6.createElement(FormCellEditor, {
1795
- fieldProjection,
1796
- model,
1797
- schema,
1798
- __gridScope
1799
- });
1800
- }
1801
- return /* @__PURE__ */ React6.createElement(TableCellEditor, {
1802
- model,
1803
- modals,
1804
- onEnter,
1805
- onFocus,
1806
- onQuery,
1807
- __gridScope
1808
- });
1809
- };
1810
1658
  var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }) => {
1811
- const { id: gridId, editing, setEditing } = useGridContext3("TableCellEditor", __gridScope);
1812
- const suppressNextBlur = useRef2(false);
1659
+ const { id: gridId, editing, setEditing } = useGridContext2("TableCellEditor", __gridScope);
1660
+ const suppressNextBlur = useRef(false);
1813
1661
  const { themeMode } = useThemeContext();
1814
- const fieldProjection = useMemo4(() => {
1662
+ const fieldProjection = useMemo3(() => {
1815
1663
  if (!model || !editing) {
1816
1664
  return;
1817
1665
  }
1818
- const { col } = parseCellIndex2(editing.index);
1666
+ const { col } = parseCellIndex(editing.index);
1819
1667
  const field = model.projection.view.fields[col];
1820
1668
  const fieldProjection2 = model.projection.getFieldProjection(field.id);
1821
- invariant3(fieldProjection2, void 0, {
1822
- F: __dxlog_file4,
1823
- L: 114,
1669
+ invariant2(fieldProjection2, void 0, {
1670
+ F: __dxlog_file3,
1671
+ L: 71,
1824
1672
  S: void 0,
1825
1673
  A: [
1826
1674
  "fieldProjection",
@@ -1832,11 +1680,11 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1832
1680
  model,
1833
1681
  editing
1834
1682
  ]);
1835
- const handleEnter = useCallback4((value) => {
1683
+ const handleEnter = useCallback3((value) => {
1836
1684
  if (!model || !editing) {
1837
1685
  return;
1838
1686
  }
1839
- const cell = parseCellIndex2(editing.index);
1687
+ const cell = parseCellIndex(editing.index);
1840
1688
  model.setCellData(cell, value);
1841
1689
  onEnter?.(cell);
1842
1690
  onFocus?.();
@@ -1848,7 +1696,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1848
1696
  onFocus,
1849
1697
  setEditing
1850
1698
  ]);
1851
- const handleBlur = useCallback4((value) => {
1699
+ const handleBlur = useCallback3((value) => {
1852
1700
  if (!model || !editing) {
1853
1701
  return;
1854
1702
  }
@@ -1856,7 +1704,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1856
1704
  suppressNextBlur.current = false;
1857
1705
  return;
1858
1706
  }
1859
- const cell = parseCellIndex2(editing.index);
1707
+ const cell = parseCellIndex(editing.index);
1860
1708
  if (value !== void 0) {
1861
1709
  model.setCellData(cell, value);
1862
1710
  }
@@ -1864,11 +1712,11 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1864
1712
  model,
1865
1713
  editing
1866
1714
  ]);
1867
- const handleClose = useCallback4((value, event) => {
1715
+ const handleClose = useCallback3((value, event) => {
1868
1716
  if (!model || !editing || !fieldProjection) {
1869
1717
  return;
1870
1718
  }
1871
- const cell = parseCellIndex2(editing.index);
1719
+ const cell = parseCellIndex(editing.index);
1872
1720
  onEnter?.(cell);
1873
1721
  if (event && onFocus) {
1874
1722
  onFocus(determineNavigationAxis(event), determineNavigationDelta(event));
@@ -1880,7 +1728,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1880
1728
  onEnter,
1881
1729
  fieldProjection
1882
1730
  ]);
1883
- const extension = useMemo4(() => {
1731
+ const extension = useMemo3(() => {
1884
1732
  if (!fieldProjection) {
1885
1733
  return [];
1886
1734
  }
@@ -1961,9 +1809,9 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1961
1809
  handleClose,
1962
1810
  themeMode
1963
1811
  ]);
1964
- const getCellContent = useCallback4(() => {
1812
+ const getCellContent = useCallback3(() => {
1965
1813
  if (model && editing) {
1966
- const cell = parseCellIndex2(editing.index);
1814
+ const cell = parseCellIndex(editing.index);
1967
1815
  const { col } = cell;
1968
1816
  const field = model.projection.view.fields[col];
1969
1817
  const fieldProjection2 = model.projection.getFieldProjection(field.id);
@@ -2039,19 +1887,21 @@ var determineNavigationDelta = ({ key, shift }) => {
2039
1887
  };
2040
1888
 
2041
1889
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
2042
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
1890
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
1891
+ var inlineEndLine = "[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-block-0 [&>.dx-grid]:after:-inline-end-px [&>.dx-grid]:after:is-px [&>.dx-grid]:after:bg-separator";
1892
+ var blockEndLine = "[&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-inline-0 [&>.dx-grid]:before:-block-end-px [&>.dx-grid]:before:bs-px [&>.dx-grid]:before:bg-separator";
2043
1893
  var TableRoot = ({ children, role }) => {
2044
1894
  return /* @__PURE__ */ React7.createElement("div", {
2045
1895
  role: "none",
2046
1896
  className: mx2("relative !border-separator", role === "section" ? "attention-surface overflow-hidden [&_.dx-grid]:max-is-[--dx-grid-content-inline-size]" : "flex flex-col [&_.dx-grid]:grow [&_.dx-grid]:max-is-[--dx-grid-content-inline-size] [&_.dx-grid]:bs-0 [&_.dx-grid]:max-bs-[--dx-grid-content-block-size]")
2047
1897
  }, children);
2048
1898
  };
2049
- var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttention, schema, onRowClick }, forwardedRef) => {
1899
+ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttention, onRowClick }, forwardedRef) => {
2050
1900
  const [dxGrid, setDxGrid] = useState2(null);
2051
1901
  const { hasAttention } = useAttention(model?.id ?? "table");
2052
1902
  const { t } = useTranslation3(translationKey);
2053
- const modals = useMemo5(() => new ModalController(), []);
2054
- const frozen = useMemo5(() => {
1903
+ const modals = useMemo4(() => new ModalController(), []);
1904
+ const frozen = useMemo4(() => {
2055
1905
  const noActionColumn = model?.features.dataEditable === false && model?.features.schemaEditable === false && model.rowActions.length === 0;
2056
1906
  return {
2057
1907
  frozenRowsStart: 1,
@@ -2061,18 +1911,14 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2061
1911
  }, [
2062
1912
  model
2063
1913
  ]);
2064
- const getCells = useCallback5((range, plane) => presentation?.getCells(range, plane) ?? {}, [
2065
- presentation
2066
- ]);
2067
- useEffect3(() => {
1914
+ useEffect2(() => {
2068
1915
  if (!presentation || !dxGrid) {
2069
1916
  return;
2070
1917
  }
2071
- dxGrid.getCells = getCells;
1918
+ dxGrid.getCells = (range, plane) => presentation.getCells(range, plane);
2072
1919
  }, [
2073
1920
  presentation,
2074
- dxGrid,
2075
- getCells
1921
+ dxGrid
2076
1922
  ]);
2077
1923
  useImperativeHandle(forwardedRef, () => {
2078
1924
  if (!presentation || !dxGrid) {
@@ -2092,7 +1938,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2092
1938
  presentation,
2093
1939
  dxGrid
2094
1940
  ]);
2095
- const handleGridClick = useCallback5((event) => {
1941
+ const handleGridClick = useCallback4((event) => {
2096
1942
  const rowIndex = safeParseInt(event.target.ariaRowIndex ?? "");
2097
1943
  if (rowIndex != null) {
2098
1944
  if (onRowClick) {
@@ -2128,6 +1974,10 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2128
1974
  modals.showColumnCreator();
2129
1975
  break;
2130
1976
  }
1977
+ case "referencedCell": {
1978
+ modals.showReferencePanel(data.targetId, data.schemaId);
1979
+ break;
1980
+ }
2131
1981
  case "sort": {
2132
1982
  model?.sorting?.toggleSort(data.fieldId);
2133
1983
  break;
@@ -2167,14 +2017,14 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2167
2017
  model,
2168
2018
  modals
2169
2019
  ]);
2170
- const handleFocus = useCallback5((increment, delta) => {
2020
+ const handleFocus = useCallback4((increment, delta) => {
2171
2021
  if (dxGrid) {
2172
2022
  dxGrid.refocus(increment, delta);
2173
2023
  }
2174
2024
  }, [
2175
2025
  dxGrid
2176
2026
  ]);
2177
- const handleEnter = useCallback5((cell) => {
2027
+ const handleEnter = useCallback4((cell) => {
2178
2028
  if (!model?.features.dataEditable) {
2179
2029
  return;
2180
2030
  }
@@ -2191,7 +2041,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2191
2041
  model,
2192
2042
  dxGrid
2193
2043
  ]);
2194
- const handleKeyDown = useCallback5((event) => {
2044
+ const handleKeyDown = useCallback4((event) => {
2195
2045
  if (!model?.features.dataEditable) {
2196
2046
  return;
2197
2047
  }
@@ -2209,7 +2059,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2209
2059
  }, [
2210
2060
  model
2211
2061
  ]);
2212
- const handleAxisResize = useCallback5((event) => {
2062
+ const handleAxisResize = useCallback4((event) => {
2213
2063
  if (event.axis === "col") {
2214
2064
  const columnIndex = parseInt(event.index, 10);
2215
2065
  model?.setColumnWidth(columnIndex, event.size);
@@ -2217,7 +2067,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2217
2067
  }, [
2218
2068
  model
2219
2069
  ]);
2220
- const handleWheel = useCallback5((event) => {
2070
+ const handleWheel = useCallback4((event) => {
2221
2071
  if (!ignoreAttention && !hasAttention) {
2222
2072
  event.stopPropagation();
2223
2073
  }
@@ -2225,7 +2075,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2225
2075
  hasAttention,
2226
2076
  ignoreAttention
2227
2077
  ]);
2228
- const handleNewColumn = useCallback5(() => {
2078
+ const handleNewColumn = useCallback4(() => {
2229
2079
  const columns = model?.getColumnCount();
2230
2080
  if (dxGrid && columns) {
2231
2081
  dxGrid.scrollToColumn(columns - 1);
@@ -2234,21 +2084,21 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2234
2084
  model,
2235
2085
  dxGrid
2236
2086
  ]);
2237
- const handleQuery = useCallback5(async ({ field, props }, text) => {
2087
+ const handleQuery = useCallback4(async ({ field, props }, text) => {
2238
2088
  if (model && props.referenceSchema && field.referencePath) {
2239
2089
  const space = model.space;
2240
- invariant4(space, void 0, {
2241
- F: __dxlog_file5,
2242
- L: 309,
2090
+ invariant3(space, void 0, {
2091
+ F: __dxlog_file4,
2092
+ L: 312,
2243
2093
  S: void 0,
2244
2094
  A: [
2245
2095
  "space",
2246
2096
  ""
2247
2097
  ]
2248
2098
  });
2249
- const schema2 = space.db.schemaRegistry.getSchema(props.referenceSchema);
2250
- if (schema2) {
2251
- const { objects } = await space.db.query(Filter.type(schema2)).run();
2099
+ const schema = space.db.schemaRegistry.getSchema(props.referenceSchema);
2100
+ if (schema) {
2101
+ const { objects } = await space.db.query(Filter.schema(schema)).run();
2252
2102
  const options = objects.map((obj) => {
2253
2103
  const value = getValue4(obj, field.referencePath);
2254
2104
  if (!value || typeof value !== "string") {
@@ -2283,15 +2133,14 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2283
2133
  }
2284
2134
  return /* @__PURE__ */ React7.createElement(Grid.Root, {
2285
2135
  id: model.id ?? "table-grid"
2286
- }, /* @__PURE__ */ React7.createElement(TableValueEditor, {
2136
+ }, /* @__PURE__ */ React7.createElement(TableCellEditor, {
2287
2137
  model,
2288
2138
  modals,
2289
- schema,
2290
2139
  onEnter: handleEnter,
2291
2140
  onFocus: handleFocus,
2292
2141
  onQuery: handleQuery
2293
2142
  }), /* @__PURE__ */ React7.createElement(Grid.Content, {
2294
- className: mx2("[--dx-grid-base:var(--baseSurface)]", gridSeparatorInlineEnd, gridSeparatorBlockEnd),
2143
+ className: mx2("[--dx-grid-base:var(--surface-bg)]", inlineEndLine, blockEndLine),
2295
2144
  frozen,
2296
2145
  // getCells={getCells}
2297
2146
  columns: model.columnMeta.value,
@@ -2316,6 +2165,9 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2316
2165
  }), /* @__PURE__ */ React7.createElement(CreateRefPanel, {
2317
2166
  model,
2318
2167
  modals
2168
+ }), /* @__PURE__ */ React7.createElement(RefPanel, {
2169
+ model,
2170
+ modals
2319
2171
  }));
2320
2172
  });
2321
2173
  var Table = {
@@ -2324,19 +2176,19 @@ var Table = {
2324
2176
  };
2325
2177
 
2326
2178
  // packages/ui/react-ui-table/src/components/Table/DynamicTable.tsx
2327
- import React8, { useRef as useRef3, useMemo as useMemo6, useCallback as useCallback6 } from "react";
2179
+ import React8, { useRef as useRef2, useMemo as useMemo5, useCallback as useCallback5 } from "react";
2328
2180
  import { useDefaultValue } from "@dxos/react-ui";
2329
2181
  import { mx as mx3 } from "@dxos/react-ui-theme";
2330
2182
 
2331
2183
  // packages/ui/react-ui-table/src/hooks/useTableModel.ts
2332
2184
  import { effect as effect3 } from "@preact/signals-core";
2333
- import { useEffect as useEffect4, useState as useState3 } from "react";
2185
+ import { useEffect as useEffect3, useState as useState3 } from "react";
2334
2186
  import { fullyQualifiedId, getSpace } from "@dxos/react-client/echo";
2335
2187
  import { useSelectionActions } from "@dxos/react-ui-attention";
2336
2188
  import { isNonNullable } from "@dxos/util";
2337
2189
  var useTableModel = ({ table, projection, rows, rowActions, features, onSelectionChanged, onRowAction, ...props }) => {
2338
2190
  const [model, setModel] = useState3();
2339
- useEffect4(() => {
2191
+ useEffect3(() => {
2340
2192
  if (!table || !projection) {
2341
2193
  return;
2342
2194
  }
@@ -2366,7 +2218,7 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2366
2218
  features,
2367
2219
  rowActions
2368
2220
  ]);
2369
- useEffect4(() => {
2221
+ useEffect3(() => {
2370
2222
  if (rows) {
2371
2223
  model?.setRows(rows);
2372
2224
  }
@@ -2378,7 +2230,7 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2378
2230
  table?.id,
2379
2231
  table?.view?.target?.query.typename
2380
2232
  ].filter(isNonNullable));
2381
- useEffect4(() => {
2233
+ useEffect3(() => {
2382
2234
  if (!model) {
2383
2235
  return;
2384
2236
  }
@@ -2402,8 +2254,8 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2402
2254
 
2403
2255
  // packages/ui/react-ui-table/src/components/Table/DynamicTable.tsx
2404
2256
  var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, properties, jsonSchema, schema, rowActions, onRowClick, onRowAction, ...props }) => {
2405
- const { table, projection } = useMemo6(() => {
2406
- const props2 = getBaseSchema({
2257
+ const { table, projection } = useMemo5(() => {
2258
+ const props2 = getBaseSchems({
2407
2259
  typename: name,
2408
2260
  properties,
2409
2261
  jsonSchema,
@@ -2419,11 +2271,11 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
2419
2271
  schema,
2420
2272
  jsonSchema
2421
2273
  ]);
2422
- const tableRef = useRef3(null);
2423
- const handleCellUpdate = useCallback6((cell) => {
2274
+ const tableRef = useRef2(null);
2275
+ const handleCellUpdate = useCallback5((cell) => {
2424
2276
  tableRef.current?.update?.(cell);
2425
2277
  }, []);
2426
- const handleRowOrderChange = useCallback6(() => {
2278
+ const handleRowOrderChange = useCallback5(() => {
2427
2279
  tableRef.current?.update?.();
2428
2280
  }, []);
2429
2281
  const features = useDefaultValue(props.features, () => ({
@@ -2442,7 +2294,7 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
2442
2294
  onRowOrderChange: handleRowOrderChange,
2443
2295
  onRowAction
2444
2296
  });
2445
- const presentation = useMemo6(() => {
2297
+ const presentation = useMemo5(() => {
2446
2298
  if (model) {
2447
2299
  return new TablePresentation(model);
2448
2300
  }
@@ -2465,11 +2317,11 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
2465
2317
  };
2466
2318
 
2467
2319
  // packages/ui/react-ui-table/src/components/TableToolbar/TableToolbar.tsx
2468
- import React9, { useCallback as useCallback7, useMemo as useMemo7 } from "react";
2469
- import { live as live4 } from "@dxos/live-object";
2320
+ import React9, { useCallback as useCallback6, useMemo as useMemo6 } from "react";
2321
+ import { create as create4 } from "@dxos/live-object";
2470
2322
  import { createGapSeparator, createMenuAction, MenuProvider, ToolbarMenu, useMenuActions } from "@dxos/react-ui-menu";
2471
- var createTableToolbarActions = (state, onAction) => {
2472
- const add = createMenuAction("add-row", () => onAction(add), {
2323
+ var createTableToolbarActions = (state) => {
2324
+ const add = createMenuAction("add-row", {
2473
2325
  type: "add-row",
2474
2326
  icon: "ph--plus--regular",
2475
2327
  label: [
@@ -2480,7 +2332,7 @@ var createTableToolbarActions = (state, onAction) => {
2480
2332
  ],
2481
2333
  testId: "table.toolbar.add-row"
2482
2334
  });
2483
- const save = createMenuAction("save-view", () => onAction(save), {
2335
+ const save = createMenuAction("save-view", {
2484
2336
  type: "save-view",
2485
2337
  icon: "ph--floppy-disk--regular",
2486
2338
  label: [
@@ -2494,7 +2346,7 @@ var createTableToolbarActions = (state, onAction) => {
2494
2346
  hidden: !state.viewDirty
2495
2347
  });
2496
2348
  const gap = createGapSeparator();
2497
- const comment = createMenuAction("comment", () => onAction(comment), {
2349
+ const comment = createMenuAction("comment", {
2498
2350
  type: "comment",
2499
2351
  icon: "ph--chat-text--regular",
2500
2352
  label: [
@@ -2520,17 +2372,17 @@ var createTableToolbarActions = (state, onAction) => {
2520
2372
  };
2521
2373
  };
2522
2374
  var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
2523
- const state = useMemo7(() => live4({
2375
+ const state = useMemo6(() => create4({
2524
2376
  viewDirty
2525
2377
  }), []);
2526
- const actionsCreator = useCallback7(() => createTableToolbarActions(state, onAction), [
2527
- state,
2528
- onAction
2378
+ const actionsCreator = useCallback6(() => createTableToolbarActions(state), [
2379
+ state
2529
2380
  ]);
2530
2381
  const menu = useMenuActions(actionsCreator);
2531
2382
  return /* @__PURE__ */ React9.createElement(MenuProvider, {
2532
2383
  ...menu,
2533
- attendableId
2384
+ attendableId,
2385
+ onAction
2534
2386
  }, /* @__PURE__ */ React9.createElement(ToolbarMenu, {
2535
2387
  classNames
2536
2388
  }));
@@ -2549,10 +2401,9 @@ export {
2549
2401
  TableToolbar,
2550
2402
  TableType,
2551
2403
  cellClassesForRowSelection,
2552
- getBaseSchema,
2404
+ getBaseSchems,
2553
2405
  initializeTable,
2554
2406
  makeDynamicTable,
2555
- narrowSchema,
2556
2407
  tableButtons,
2557
2408
  tableControls,
2558
2409
  touch,