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