@dxos/react-ui-table 0.8.2-main.36232bc → 0.8.2-main.5ca3450

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 (67) hide show
  1. package/dist/lib/browser/chunk-UGGYKLOH.mjs +28 -0
  2. package/dist/lib/browser/chunk-UGGYKLOH.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +40 -107
  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-TGG6OZ54.cjs → chunk-2QLLIPZK.cjs} +13 -11
  8. package/dist/lib/node/chunk-2QLLIPZK.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +108 -173
  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-KKLP54L3.mjs → chunk-N2RRVR7F.mjs} +11 -9
  15. package/dist/lib/node-esm/chunk-N2RRVR7F.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +40 -107
  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.map +1 -1
  24. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  25. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  26. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  29. package/dist/types/src/components/TableCellEditor/extension.d.ts.map +1 -1
  30. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
  31. package/dist/types/src/components/testing.d.ts +39 -39
  32. package/dist/types/src/components/testing.d.ts.map +1 -1
  33. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  34. package/dist/types/src/model/modal-controller.d.ts.map +1 -1
  35. package/dist/types/src/model/selection-model.d.ts.map +1 -1
  36. package/dist/types/src/model/table-model.d.ts.map +1 -1
  37. package/dist/types/src/model/table-presentation.d.ts.map +1 -1
  38. package/dist/types/src/types/table.d.ts +43 -43
  39. package/dist/types/src/types/table.d.ts.map +1 -1
  40. package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
  41. package/dist/types/src/util/signals.d.ts.map +1 -1
  42. package/dist/types/src/util/table-buttons.d.ts +0 -14
  43. package/dist/types/src/util/table-buttons.d.ts.map +1 -1
  44. package/dist/types/src/util/table-controls.d.ts.map +1 -1
  45. package/dist/types/src/util/table.d.ts +2 -2
  46. package/dist/types/src/util/table.d.ts.map +1 -1
  47. package/dist/types/src/util/tag.d.ts.map +1 -1
  48. package/dist/types/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +35 -33
  50. package/src/components/Table/CreateRefPanel.tsx +3 -3
  51. package/src/components/Table/Table.stories.tsx +1 -2
  52. package/src/components/Table/Table.tsx +0 -6
  53. package/src/components/Table/relations.stories.tsx +10 -9
  54. package/src/components/testing.ts +7 -6
  55. package/src/model/table-model.test.ts +4 -3
  56. package/src/model/table-presentation.test.ts +4 -3
  57. package/src/model/table-presentation.ts +3 -5
  58. package/src/types/table.ts +16 -8
  59. package/src/util/table-buttons.ts +0 -23
  60. package/src/util/table.ts +7 -7
  61. package/dist/lib/browser/chunk-YWNRUF4J.mjs +0 -26
  62. package/dist/lib/browser/chunk-YWNRUF4J.mjs.map +0 -7
  63. package/dist/lib/node/chunk-TGG6OZ54.cjs.map +0 -7
  64. package/dist/lib/node-esm/chunk-KKLP54L3.mjs.map +0 -7
  65. package/dist/types/src/components/Table/RefPanel.d.ts +0 -9
  66. package/dist/types/src/components/Table/RefPanel.d.ts.map +0 -1
  67. package/src/components/Table/RefPanel.tsx +0 -52
@@ -37,9 +37,9 @@ __export(node_exports, {
37
37
  Table: () => Table,
38
38
  TableModel: () => TableModel,
39
39
  TablePresentation: () => TablePresentation,
40
- TableSchema: () => import_chunk_TGG6OZ54.TableSchema,
40
+ TableSchema: () => import_chunk_2QLLIPZK.TableSchema,
41
41
  TableToolbar: () => TableToolbar,
42
- TableType: () => import_chunk_TGG6OZ54.TableType,
42
+ TableType: () => import_chunk_2QLLIPZK.TableType,
43
43
  cellClassesForRowSelection: () => cellClassesForRowSelection,
44
44
  getBaseSchems: () => getBaseSchems,
45
45
  initializeTable: () => initializeTable,
@@ -51,7 +51,7 @@ __export(node_exports, {
51
51
  useTableModel: () => useTableModel
52
52
  });
53
53
  module.exports = __toCommonJS(node_exports);
54
- var import_chunk_TGG6OZ54 = require("./chunk-TGG6OZ54.cjs");
54
+ var import_chunk_2QLLIPZK = require("./chunk-2QLLIPZK.cjs");
55
55
  var import_react = __toESM(require("react"));
56
56
  var import_echo_schema = require("@dxos/echo-schema");
57
57
  var import_invariant = require("@dxos/invariant");
@@ -66,61 +66,59 @@ var import_react_ui2 = require("@dxos/react-ui");
66
66
  var import_react3 = __toESM(require("react"));
67
67
  var import_react_ui3 = require("@dxos/react-ui");
68
68
  var import_react_ui_form = require("@dxos/react-ui-form");
69
+ var import_effect = require("effect");
69
70
  var import_react4 = __toESM(require("react"));
70
- var import_echo_schema2 = require("@dxos/echo-schema");
71
71
  var import_echo2 = require("@dxos/react-client/echo");
72
72
  var import_react_ui4 = require("@dxos/react-ui");
73
73
  var import_react_ui_form2 = require("@dxos/react-ui-form");
74
74
  var import_react_ui_grid2 = require("@dxos/react-ui-grid");
75
75
  var import_react5 = __toESM(require("react"));
76
76
  var import_react_ui5 = require("@dxos/react-ui");
77
- var import_react_ui_form3 = require("@dxos/react-ui-form");
78
- var import_react6 = __toESM(require("react"));
79
- var import_react_ui6 = require("@dxos/react-ui");
80
77
  var import_signals_core = require("@preact/signals-core");
81
78
  var import_context = require("@dxos/context");
82
- var import_echo_schema3 = require("@dxos/echo-schema");
79
+ var import_echo_schema2 = require("@dxos/echo-schema");
83
80
  var import_invariant2 = require("@dxos/invariant");
84
81
  var import_live_object = require("@dxos/live-object");
85
- var import_react_ui_form4 = require("@dxos/react-ui-form");
82
+ var import_react_ui_form3 = require("@dxos/react-ui-form");
86
83
  var import_signals_core2 = require("@preact/signals-core");
87
84
  var import_context2 = require("@dxos/context");
88
85
  var import_live_object2 = require("@dxos/live-object");
89
86
  var import_schema = require("@dxos/schema");
90
- var import_echo_schema4 = require("@dxos/echo-schema");
87
+ var import_effect2 = require("effect");
88
+ var import_echo_schema3 = require("@dxos/echo-schema");
91
89
  var import_react_client = require("@dxos/react-client");
92
90
  var import_echo3 = require("@dxos/react-client/echo");
93
91
  var import_schema2 = require("@dxos/schema");
94
92
  var import_signals_core3 = require("@preact/signals-core");
95
93
  var import_lodash = __toESM(require("lodash.orderby"));
96
- var import_echo_schema5 = require("@dxos/echo-schema");
97
- var import_react_ui_form5 = require("@dxos/react-ui-form");
94
+ var import_echo_schema4 = require("@dxos/echo-schema");
95
+ var import_react_ui_form4 = require("@dxos/react-ui-form");
98
96
  var import_signals_core4 = require("@preact/signals-core");
99
97
  var import_log = require("@dxos/log");
100
98
  var import_signals_core5 = require("@preact/signals-core");
101
- var import_echo_schema6 = require("@dxos/echo-schema");
102
- var import_react_ui_form6 = require("@dxos/react-ui-form");
99
+ var import_echo_schema5 = require("@dxos/echo-schema");
100
+ var import_react_ui_form5 = require("@dxos/react-ui-form");
103
101
  var import_react_ui_grid3 = require("@dxos/react-ui-grid");
104
102
  var import_react_ui_theme2 = require("@dxos/react-ui-theme");
105
103
  var import_schema3 = require("@dxos/schema");
106
- var import_react7 = __toESM(require("react"));
107
- var import_echo_schema7 = require("@dxos/echo-schema");
104
+ var import_react6 = __toESM(require("react"));
105
+ var import_echo_schema6 = require("@dxos/echo-schema");
108
106
  var import_invariant3 = require("@dxos/invariant");
109
- var import_react_ui7 = require("@dxos/react-ui");
107
+ var import_react_ui6 = require("@dxos/react-ui");
110
108
  var import_react_ui_editor = require("@dxos/react-ui-editor");
111
109
  var import_react_ui_grid4 = require("@dxos/react-ui-grid");
112
110
  var import_react_ui_tag_picker = require("@dxos/react-ui-tag-picker");
113
111
  var import_autocomplete = require("@codemirror/autocomplete");
114
112
  var import_view = require("@codemirror/view");
115
- var import_react8 = __toESM(require("react"));
116
- var import_react_ui8 = require("@dxos/react-ui");
113
+ var import_react7 = __toESM(require("react"));
114
+ var import_react_ui7 = require("@dxos/react-ui");
117
115
  var import_react_ui_theme3 = require("@dxos/react-ui-theme");
118
116
  var import_signals_core6 = require("@preact/signals-core");
119
- var import_react9 = require("react");
117
+ var import_react8 = require("react");
120
118
  var import_echo4 = require("@dxos/react-client/echo");
121
119
  var import_react_ui_attention2 = require("@dxos/react-ui-attention");
122
120
  var import_util2 = require("@dxos/util");
123
- var import_react10 = __toESM(require("react"));
121
+ var import_react9 = __toESM(require("react"));
124
122
  var import_live_object3 = require("@dxos/live-object");
125
123
  var import_react_ui_menu = require("@dxos/react-ui-menu");
126
124
  var translationKey = "table";
@@ -259,7 +257,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
259
257
  typename: state.typename
260
258
  }).runSync();
261
259
  if (schema2) {
262
- const omit = import_echo_schema2.S.omit("id");
260
+ const omit = import_effect.Schema.omit("id");
263
261
  return omit(schema2);
264
262
  }
265
263
  }, [
@@ -313,63 +311,30 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
313
311
  onCancel: handleCancel
314
312
  }), /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Popover.Arrow, null))));
315
313
  };
316
- var getRefTargetObj = (space, id) => {
317
- if (space && id) {
318
- return space?.db.getObjectById(id);
319
- } else {
320
- return void 0;
321
- }
322
- };
323
- var RefPanel = ({ model, modals }) => {
324
- const state = modals.state.value;
325
- const space = model?.space;
326
- const targetObj = getRefTargetObj(space, state?.type === "refPanel" ? state.targetId : void 0);
327
- const schema = space && state?.type === "refPanel" ? space.db.schemaRegistry.getSchema(state.typename) : void 0;
328
- if (!model.view || !model.projection) {
329
- return null;
330
- }
331
- return /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.Root, {
332
- modal: false,
333
- open: state?.type === "refPanel" && !!targetObj && !!schema,
334
- onOpenChange: (nextOpen) => {
335
- if (!nextOpen) {
336
- return modals.close();
337
- }
338
- }
339
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.VirtualTrigger, {
340
- virtualRef: modals.trigger
341
- }), /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.Portal, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.Content, {
342
- classNames: "md:is-64"
343
- }, targetObj && schema && /* @__PURE__ */ import_react5.default.createElement(import_react_ui_form3.Form, {
344
- readonly: true,
345
- values: targetObj,
346
- schema
347
- }), /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.Arrow, null))));
348
- };
349
314
  var RowActionsMenu = ({ model, modals }) => {
350
- const { t } = (0, import_react_ui6.useTranslation)(translationKey);
315
+ const { t } = (0, import_react_ui5.useTranslation)(translationKey);
351
316
  const hasSelection = model.selection.hasSelection.value;
352
317
  const state = modals.state.value;
353
318
  if (state?.type !== "row") {
354
319
  return null;
355
320
  }
356
- return /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Root, {
321
+ return /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Root, {
357
322
  modal: false,
358
323
  open: true,
359
324
  onOpenChange: modals.close
360
- }, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.VirtualTrigger, {
325
+ }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.VirtualTrigger, {
361
326
  virtualRef: modals.trigger
362
- }), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Content, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Item, {
327
+ }), /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Content, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Item, {
363
328
  "data-testid": "row-menu-delete",
364
329
  onClick: () => model.deleteRow(state.rowIndex)
365
- }, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Item, {
330
+ }, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Item, {
366
331
  key: action.id,
367
332
  "data-testid": `row-action-${action.id}`,
368
333
  onClick: () => {
369
334
  modals.close();
370
335
  model.handleRowAction(action.id, state.rowIndex);
371
336
  }
372
- }, t(action.translationKey)))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Arrow, null)));
337
+ }, t(action.translationKey)))), /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.DropdownMenu.Arrow, null)));
373
338
  };
374
339
  var getBaseSchems = ({ typename, properties, jsonSchema, schema }) => {
375
340
  if (typename && properties) {
@@ -401,7 +366,7 @@ var makeDynamicTable = ({ typename, jsonSchema, properties }) => {
401
366
  fields: properties.map((property) => property.name)
402
367
  }
403
368
  });
404
- const table = (0, import_live_object2.live)(import_chunk_TGG6OZ54.TableType, {
369
+ const table = (0, import_live_object2.live)(import_chunk_2QLLIPZK.TableType, {
405
370
  name: "dynamic-table",
406
371
  view: (0, import_live_object2.makeRef)(view)
407
372
  });
@@ -477,17 +442,17 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
477
442
  return schema;
478
443
  }
479
444
  };
480
- var ContactSchema = (0, import_echo_schema4.TypedObject)({
445
+ var ContactSchema = (0, import_echo_schema3.TypedObject)({
481
446
  typename: `example.com/type/${import_react_client.PublicKey.random().truncate()}`,
482
447
  version: "0.1.0"
483
448
  })({
484
- name: import_echo_schema4.S.optional(import_echo_schema4.S.String).annotations({
485
- [import_echo_schema4.AST.TitleAnnotationId]: "Name"
449
+ name: import_effect2.Schema.optional(import_effect2.Schema.String).annotations({
450
+ [import_effect2.SchemaAST.TitleAnnotationId]: "Name"
486
451
  }),
487
- active: import_echo_schema4.S.optional(import_echo_schema4.S.Boolean),
488
- email: import_echo_schema4.S.optional(import_echo_schema4.Format.Email),
489
- salary: import_echo_schema4.S.optional(import_echo_schema4.Format.Currency()).annotations({
490
- [import_echo_schema4.AST.TitleAnnotationId]: "Salary"
452
+ active: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
453
+ email: import_effect2.Schema.optional(import_echo_schema3.Format.Email),
454
+ salary: import_effect2.Schema.optional(import_echo_schema3.Format.Currency()).annotations({
455
+ [import_effect2.SchemaAST.TitleAnnotationId]: "Salary"
491
456
  })
492
457
  });
493
458
  var ContactFields = [
@@ -520,8 +485,8 @@ var createProjection = (schema, view) => {
520
485
  },
521
486
  props: {
522
487
  property: "manager",
523
- type: import_echo_schema4.TypeEnum.Ref,
524
- format: import_echo_schema4.FormatEnum.Ref,
488
+ type: import_echo_schema3.TypeEnum.Ref,
489
+ format: import_echo_schema3.FormatEnum.Ref,
525
490
  referenceSchema: schema.typename,
526
491
  title: "Manager"
527
492
  }
@@ -574,26 +539,6 @@ var columnSettingsButton = {
574
539
  fieldId: el.getAttribute("data-field-id")
575
540
  })
576
541
  };
577
- var referencedCellButton = {
578
- attr: BUTTON_IDENTIFIERS.referencedCell,
579
- icon: "ph--link-simple-horizontal--regular",
580
- render: ({ targetId, schemaId }) => {
581
- return createButton({
582
- attr: BUTTON_IDENTIFIERS.referencedCell,
583
- icon: referencedCellButton.icon,
584
- data: {
585
- "data-target-id": targetId,
586
- "data-schema-id": schemaId
587
- },
588
- testId: "table-ref-cell-button"
589
- });
590
- },
591
- getData: (el) => ({
592
- type: "referencedCell",
593
- targetId: el.getAttribute("data-target-id"),
594
- schemaId: el.getAttribute("data-schema-id")
595
- })
596
- };
597
542
  var rowMenuButton = {
598
543
  attr: BUTTON_IDENTIFIERS.rowMenu,
599
544
  icon: "ph--dots-three--regular",
@@ -638,7 +583,6 @@ var sortButton = {
638
583
  var tableButtons = {
639
584
  addColumn: addColumnButton,
640
585
  columnSettings: columnSettingsButton,
641
- referencedCell: referencedCellButton,
642
586
  rowMenu: rowMenuButton,
643
587
  sort: sortButton
644
588
  };
@@ -884,7 +828,7 @@ var TableSorting = class {
884
828
  const { props } = this._projection.getFieldProjection(field.id);
885
829
  const dataWithIndices = this._rows.value.map((item, index) => {
886
830
  const sortValue = this.getSortValue(props, field, item);
887
- const isEmpty = !(props.type === import_echo_schema5.TypeEnum.Boolean) && (sortValue == null || sortValue === "");
831
+ const isEmpty = !(props.type === import_echo_schema4.TypeEnum.Boolean) && (sortValue == null || sortValue === "");
888
832
  return {
889
833
  item,
890
834
  index,
@@ -909,17 +853,17 @@ var TableSorting = class {
909
853
  }
910
854
  getSortValue(props, field, item) {
911
855
  const { type, format } = props;
912
- const value = (0, import_echo_schema5.getValue)(item, field.path);
913
- if (type === import_echo_schema5.TypeEnum.Boolean) {
856
+ const value = (0, import_echo_schema4.getValue)(item, field.path);
857
+ if (type === import_echo_schema4.TypeEnum.Boolean) {
914
858
  return !!value;
915
859
  }
916
- if (type === import_echo_schema5.TypeEnum.Number) {
860
+ if (type === import_echo_schema4.TypeEnum.Number) {
917
861
  return value;
918
862
  }
919
863
  if (value == null) {
920
864
  return value;
921
865
  }
922
- if (format === import_echo_schema5.FormatEnum.SingleSelect) {
866
+ if (format === import_echo_schema4.FormatEnum.SingleSelect) {
923
867
  const options = props.options;
924
868
  if (!options) {
925
869
  return void 0;
@@ -927,11 +871,11 @@ var TableSorting = class {
927
871
  const option = options.find((option2) => option2.id === value);
928
872
  return option ? options.indexOf(option) : void 0;
929
873
  }
930
- if (format === import_echo_schema5.FormatEnum.Ref && field.referencePath) {
931
- const refValue = (0, import_echo_schema5.getValue)(value.target, field.referencePath);
874
+ if (format === import_echo_schema4.FormatEnum.Ref && field.referencePath) {
875
+ const refValue = (0, import_echo_schema4.getValue)(value.target, field.referencePath);
932
876
  return refValue;
933
877
  }
934
- return (0, import_react_ui_form5.formatForDisplay)({
878
+ return (0, import_react_ui_form4.formatForDisplay)({
935
879
  type,
936
880
  format,
937
881
  value
@@ -1016,20 +960,20 @@ var TableModel = class extends import_context.Resource {
1016
960
  }
1017
961
  const field = fields[col];
1018
962
  const dataIndex = this._sorting.getDataIndex(row);
1019
- const value = (0, import_echo_schema3.getValue)(this._rows.value[dataIndex], field.path);
963
+ const value = (0, import_echo_schema2.getValue)(this._rows.value[dataIndex], field.path);
1020
964
  if (value == null) {
1021
965
  return "";
1022
966
  }
1023
967
  const { props } = this._projection.getFieldProjection(field.id);
1024
968
  switch (props.format) {
1025
- case import_echo_schema3.FormatEnum.Ref: {
969
+ case import_echo_schema2.FormatEnum.Ref: {
1026
970
  if (!field.referencePath) {
1027
971
  return "";
1028
972
  }
1029
- return (0, import_echo_schema3.getValue)(value.target, field.referencePath);
973
+ return (0, import_echo_schema2.getValue)(value.target, field.referencePath);
1030
974
  }
1031
975
  default: {
1032
- return (0, import_react_ui_form4.formatForEditing)({
976
+ return (0, import_react_ui_form3.formatForEditing)({
1033
977
  type: props.type,
1034
978
  format: props.format,
1035
979
  value
@@ -1046,28 +990,28 @@ var TableModel = class extends import_context.Resource {
1046
990
  const field = fields[col];
1047
991
  const { props } = this._projection.getFieldProjection(field.id);
1048
992
  switch (props.format) {
1049
- case import_echo_schema3.FormatEnum.Ref: {
993
+ case import_echo_schema2.FormatEnum.Ref: {
1050
994
  if ((0, import_live_object.isLiveObject)(value)) {
1051
- (0, import_echo_schema3.setValue)(this._rows.value[rowIdx], field.path, (0, import_live_object.makeRef)(value));
995
+ (0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, (0, import_live_object.makeRef)(value));
1052
996
  }
1053
997
  break;
1054
998
  }
1055
- case import_echo_schema3.FormatEnum.SingleSelect: {
999
+ case import_echo_schema2.FormatEnum.SingleSelect: {
1056
1000
  const ids = extractTagIds(value);
1057
1001
  if (ids && ids.length > 0) {
1058
- (0, import_echo_schema3.setValue)(this._rows.value[rowIdx], field.path, ids[0]);
1002
+ (0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, ids[0]);
1059
1003
  }
1060
1004
  break;
1061
1005
  }
1062
- case import_echo_schema3.FormatEnum.MultiSelect: {
1006
+ case import_echo_schema2.FormatEnum.MultiSelect: {
1063
1007
  const ids = extractTagIds(value);
1064
1008
  if (ids) {
1065
- (0, import_echo_schema3.setValue)(this._rows.value[rowIdx], field.path, ids);
1009
+ (0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, ids);
1066
1010
  }
1067
1011
  break;
1068
1012
  }
1069
1013
  default: {
1070
- (0, import_echo_schema3.setValue)(this._rows.value[rowIdx], field.path, (0, import_react_ui_form4.parseValue)({
1014
+ (0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, (0, import_react_ui_form3.parseValue)({
1071
1015
  type: props.type,
1072
1016
  format: props.format,
1073
1017
  value
@@ -1213,7 +1157,7 @@ var TableModel = class extends import_context.Resource {
1213
1157
  for (let row = start.row; row <= end.row; row++) {
1214
1158
  rowEffects.push((0, import_signals_core.effect)(() => {
1215
1159
  const obj = this._sorting.sortedRows.value[row];
1216
- this._view?.fields.forEach((field) => touch((0, import_echo_schema3.getValue)(obj, field.path)));
1160
+ this._view?.fields.forEach((field) => touch((0, import_echo_schema2.getValue)(obj, field.path)));
1217
1161
  this._onCellUpdate?.({
1218
1162
  row,
1219
1163
  col: start.col,
@@ -1234,9 +1178,9 @@ var TableModel = class extends import_context.Resource {
1234
1178
  const dataRow = this._sorting.getDataIndex(row);
1235
1179
  const fields = this._view?.fields ?? [];
1236
1180
  const field = fields[col];
1237
- const value = (0, import_echo_schema3.getValue)(this._rows.value[dataRow], field.path);
1181
+ const value = (0, import_echo_schema2.getValue)(this._rows.value[dataRow], field.path);
1238
1182
  const updatedValue = update(value);
1239
- (0, import_echo_schema3.setValue)(this._rows.value[dataRow], field.path, updatedValue);
1183
+ (0, import_echo_schema2.setValue)(this._rows.value[dataRow], field.path, updatedValue);
1240
1184
  }
1241
1185
  //
1242
1186
  // Column Operations
@@ -1418,24 +1362,24 @@ var TablePresentation = class {
1418
1362
  const { props } = this.model.projection.getFieldProjection(field.id);
1419
1363
  const cell = {
1420
1364
  get value() {
1421
- const value = (0, import_echo_schema6.getValue)(obj, field.path);
1365
+ const value = (0, import_echo_schema5.getValue)(obj, field.path);
1422
1366
  if (value == null) {
1423
1367
  return "";
1424
1368
  }
1425
1369
  switch (props.format) {
1426
- case import_echo_schema6.FormatEnum.Boolean:
1427
- case import_echo_schema6.FormatEnum.SingleSelect:
1428
- case import_echo_schema6.FormatEnum.MultiSelect: {
1370
+ case import_echo_schema5.FormatEnum.Boolean:
1371
+ case import_echo_schema5.FormatEnum.SingleSelect:
1372
+ case import_echo_schema5.FormatEnum.MultiSelect: {
1429
1373
  return "";
1430
1374
  }
1431
- case import_echo_schema6.FormatEnum.Ref: {
1375
+ case import_echo_schema5.FormatEnum.Ref: {
1432
1376
  if (!field.referencePath) {
1433
1377
  return "";
1434
1378
  }
1435
- return (0, import_echo_schema6.getValue)(value.target, field.referencePath);
1379
+ return (0, import_echo_schema5.getValue)(value.target, field.referencePath);
1436
1380
  }
1437
1381
  default: {
1438
- return (0, import_react_ui_form6.formatForDisplay)({
1382
+ return (0, import_react_ui_form5.formatForDisplay)({
1439
1383
  type: props.type,
1440
1384
  format: props.format,
1441
1385
  value
@@ -1445,7 +1389,7 @@ var TablePresentation = class {
1445
1389
  }
1446
1390
  };
1447
1391
  const classes = [];
1448
- const formatClasses = (0, import_react_ui_form6.cellClassesForFieldType)({
1392
+ const formatClasses = (0, import_react_ui_form5.cellClassesForFieldType)({
1449
1393
  type: props.type,
1450
1394
  format: props.format
1451
1395
  });
@@ -1459,17 +1403,15 @@ var TablePresentation = class {
1459
1403
  if (classes.length > 0) {
1460
1404
  cell.className = (0, import_react_ui_theme2.mx)(classes.flat());
1461
1405
  }
1462
- if (props.format === import_echo_schema6.FormatEnum.Ref && props.referenceSchema) {
1463
- const targetObj = (0, import_echo_schema6.getValue)(obj, field.path)?.target;
1406
+ if (props.format === import_echo_schema5.FormatEnum.Ref && props.referenceSchema) {
1407
+ const targetObj = (0, import_echo_schema5.getValue)(obj, field.path)?.target;
1464
1408
  if (targetObj) {
1465
- cell.accessoryHtml = tableButtons.referencedCell.render({
1466
- targetId: targetObj.id,
1467
- schemaId: props.referenceSchema
1468
- });
1409
+ const dxn = (0, import_echo_schema5.getDXN)(targetObj)?.toString();
1410
+ 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>`;
1469
1411
  }
1470
1412
  }
1471
- if (props.format === import_echo_schema6.FormatEnum.Boolean) {
1472
- const value = (0, import_echo_schema6.getValue)(obj, field.path);
1413
+ if (props.format === import_echo_schema5.FormatEnum.Boolean) {
1414
+ const value = (0, import_echo_schema5.getValue)(obj, field.path);
1473
1415
  cell.accessoryHtml = tableControls.switch.render({
1474
1416
  colIndex,
1475
1417
  rowIndex: displayIndex,
@@ -1477,8 +1419,8 @@ var TablePresentation = class {
1477
1419
  });
1478
1420
  cell.readonly = "no-text-select";
1479
1421
  }
1480
- if (props.format === import_echo_schema6.FormatEnum.SingleSelect) {
1481
- const value = (0, import_echo_schema6.getValue)(obj, field.path);
1422
+ if (props.format === import_echo_schema5.FormatEnum.SingleSelect) {
1423
+ const value = (0, import_echo_schema5.getValue)(obj, field.path);
1482
1424
  const options = this.model.projection.getFieldProjection(field.id).props.options;
1483
1425
  if (options) {
1484
1426
  const option = options.find((o) => o.id === value);
@@ -1487,8 +1429,8 @@ var TablePresentation = class {
1487
1429
  }
1488
1430
  }
1489
1431
  }
1490
- if (props.format === import_echo_schema6.FormatEnum.MultiSelect) {
1491
- const values = (0, import_echo_schema6.getValue)(obj, field.path);
1432
+ if (props.format === import_echo_schema5.FormatEnum.MultiSelect) {
1433
+ const values = (0, import_echo_schema5.getValue)(obj, field.path);
1492
1434
  const options = this.model.projection.getFieldProjection(field.id).props.options;
1493
1435
  if (options && values && values.length > 0) {
1494
1436
  const tags = values.map((value) => {
@@ -1699,9 +1641,9 @@ var createOption = (text) => ({
1699
1641
  var isCreateOption = (data) => typeof data === "object" && data[newValue];
1700
1642
  var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }) => {
1701
1643
  const { id: gridId, editing, setEditing } = (0, import_react_ui_grid4.useGridContext)("TableCellEditor", __gridScope);
1702
- const suppressNextBlur = (0, import_react7.useRef)(false);
1703
- const { themeMode } = (0, import_react_ui7.useThemeContext)();
1704
- const fieldProjection = (0, import_react7.useMemo)(() => {
1644
+ const suppressNextBlur = (0, import_react6.useRef)(false);
1645
+ const { themeMode } = (0, import_react_ui6.useThemeContext)();
1646
+ const fieldProjection = (0, import_react6.useMemo)(() => {
1705
1647
  if (!model || !editing) {
1706
1648
  return;
1707
1649
  }
@@ -1722,7 +1664,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1722
1664
  model,
1723
1665
  editing
1724
1666
  ]);
1725
- const handleEnter = (0, import_react7.useCallback)((value) => {
1667
+ const handleEnter = (0, import_react6.useCallback)((value) => {
1726
1668
  if (!model || !editing) {
1727
1669
  return;
1728
1670
  }
@@ -1738,7 +1680,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1738
1680
  onFocus,
1739
1681
  setEditing
1740
1682
  ]);
1741
- const handleBlur = (0, import_react7.useCallback)((value) => {
1683
+ const handleBlur = (0, import_react6.useCallback)((value) => {
1742
1684
  if (!model || !editing) {
1743
1685
  return;
1744
1686
  }
@@ -1754,7 +1696,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1754
1696
  model,
1755
1697
  editing
1756
1698
  ]);
1757
- const handleClose = (0, import_react7.useCallback)((value, event) => {
1699
+ const handleClose = (0, import_react6.useCallback)((value, event) => {
1758
1700
  if (!model || !editing || !fieldProjection) {
1759
1701
  return;
1760
1702
  }
@@ -1770,7 +1712,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1770
1712
  onEnter,
1771
1713
  fieldProjection
1772
1714
  ]);
1773
- const extension = (0, import_react7.useMemo)(() => {
1715
+ const extension = (0, import_react6.useMemo)(() => {
1774
1716
  if (!fieldProjection) {
1775
1717
  return [];
1776
1718
  }
@@ -1783,12 +1725,12 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1783
1725
  })
1784
1726
  ];
1785
1727
  const format = fieldProjection.props.format;
1786
- if (format === import_echo_schema7.FormatEnum.SingleSelect || format === import_echo_schema7.FormatEnum.MultiSelect) {
1728
+ if (format === import_echo_schema6.FormatEnum.SingleSelect || format === import_echo_schema6.FormatEnum.MultiSelect) {
1787
1729
  extension2.push((0, import_react_ui_editor.createMarkdownExtensions)({
1788
1730
  themeMode
1789
1731
  }));
1790
1732
  const options = fieldProjection.props.options || [];
1791
- const mode = format === import_echo_schema7.FormatEnum.SingleSelect ? "single-select" : "multi-select";
1733
+ const mode = format === import_echo_schema6.FormatEnum.SingleSelect ? "single-select" : "multi-select";
1792
1734
  extension2.push((0, import_react_ui_tag_picker.tagPickerExtension)({
1793
1735
  mode,
1794
1736
  inGrid: true,
@@ -1815,7 +1757,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1815
1757
  }
1816
1758
  if (onQuery) {
1817
1759
  switch (fieldProjection.props.format) {
1818
- case import_echo_schema7.FormatEnum.Ref: {
1760
+ case import_echo_schema6.FormatEnum.Ref: {
1819
1761
  extension2.push([
1820
1762
  completion({
1821
1763
  onQuery: (text) => onQuery(fieldProjection, text),
@@ -1851,17 +1793,17 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1851
1793
  handleClose,
1852
1794
  themeMode
1853
1795
  ]);
1854
- const getCellContent = (0, import_react7.useCallback)(() => {
1796
+ const getCellContent = (0, import_react6.useCallback)(() => {
1855
1797
  if (model && editing) {
1856
1798
  const cell = (0, import_react_ui_grid4.parseCellIndex)(editing.index);
1857
1799
  const { col } = cell;
1858
1800
  const field = model.projection.view.fields[col];
1859
1801
  const fieldProjection2 = model.projection.getFieldProjection(field.id);
1860
- if (fieldProjection2?.props.format === import_echo_schema7.FormatEnum.SingleSelect || fieldProjection2?.props.format === import_echo_schema7.FormatEnum.MultiSelect) {
1802
+ if (fieldProjection2?.props.format === import_echo_schema6.FormatEnum.SingleSelect || fieldProjection2?.props.format === import_echo_schema6.FormatEnum.MultiSelect) {
1861
1803
  const value2 = model.getCellData(cell);
1862
1804
  if (value2 !== void 0) {
1863
1805
  const options = fieldProjection2.props.options || [];
1864
- if (fieldProjection2.props.format === import_echo_schema7.FormatEnum.MultiSelect && Array.isArray(value2)) {
1806
+ if (fieldProjection2.props.format === import_echo_schema6.FormatEnum.MultiSelect && Array.isArray(value2)) {
1865
1807
  const tagItems = value2.map((id) => {
1866
1808
  const option = options.find((o) => o.id === id);
1867
1809
  if (option) {
@@ -1897,7 +1839,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
1897
1839
  model,
1898
1840
  editing
1899
1841
  ]);
1900
- return /* @__PURE__ */ import_react7.default.createElement(import_react_ui_grid4.GridCellEditor, {
1842
+ return /* @__PURE__ */ import_react6.default.createElement(import_react_ui_grid4.GridCellEditor, {
1901
1843
  extension,
1902
1844
  getCellContent,
1903
1845
  onBlur: handleBlur
@@ -2016,10 +1958,6 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
2016
1958
  modals.showColumnCreator();
2017
1959
  break;
2018
1960
  }
2019
- case "referencedCell": {
2020
- modals.showReferencePanel(data.targetId, data.schemaId);
2021
- break;
2022
- }
2023
1961
  case "sort": {
2024
1962
  model?.sorting?.toggleSort(data.fieldId);
2025
1963
  break;
@@ -2131,7 +2069,7 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
2131
2069
  const space = model.space;
2132
2070
  (0, import_invariant.invariant)(space, void 0, {
2133
2071
  F: __dxlog_file4,
2134
- L: 312,
2072
+ L: 307,
2135
2073
  S: void 0,
2136
2074
  A: [
2137
2075
  "space",
@@ -2207,9 +2145,6 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
2207
2145
  }), /* @__PURE__ */ import_react.default.createElement(CreateRefPanel, {
2208
2146
  model,
2209
2147
  modals
2210
- }), /* @__PURE__ */ import_react.default.createElement(RefPanel, {
2211
- model,
2212
- modals
2213
2148
  }));
2214
2149
  });
2215
2150
  var Table = {
@@ -2217,8 +2152,8 @@ var Table = {
2217
2152
  Main: TableMain
2218
2153
  };
2219
2154
  var useTableModel = ({ table, projection, rows, rowActions, features, onSelectionChanged, onRowAction, ...props }) => {
2220
- const [model, setModel] = (0, import_react9.useState)();
2221
- (0, import_react9.useEffect)(() => {
2155
+ const [model, setModel] = (0, import_react8.useState)();
2156
+ (0, import_react8.useEffect)(() => {
2222
2157
  if (!table || !projection) {
2223
2158
  return;
2224
2159
  }
@@ -2248,7 +2183,7 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2248
2183
  features,
2249
2184
  rowActions
2250
2185
  ]);
2251
- (0, import_react9.useEffect)(() => {
2186
+ (0, import_react8.useEffect)(() => {
2252
2187
  if (rows) {
2253
2188
  model?.setRows(rows);
2254
2189
  }
@@ -2260,7 +2195,7 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2260
2195
  table?.id,
2261
2196
  table?.view?.target?.query.typename
2262
2197
  ].filter(import_util2.isNonNullable));
2263
- (0, import_react9.useEffect)(() => {
2198
+ (0, import_react8.useEffect)(() => {
2264
2199
  if (!model) {
2265
2200
  return;
2266
2201
  }
@@ -2282,7 +2217,7 @@ var useTableModel = ({ table, projection, rows, rowActions, features, onSelectio
2282
2217
  return model;
2283
2218
  };
2284
2219
  var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, properties, jsonSchema, schema, rowActions, onRowClick, onRowAction, ...props }) => {
2285
- const { table, projection } = (0, import_react8.useMemo)(() => {
2220
+ const { table, projection } = (0, import_react7.useMemo)(() => {
2286
2221
  const props2 = getBaseSchems({
2287
2222
  typename: name,
2288
2223
  properties,
@@ -2299,14 +2234,14 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
2299
2234
  schema,
2300
2235
  jsonSchema
2301
2236
  ]);
2302
- const tableRef = (0, import_react8.useRef)(null);
2303
- const handleCellUpdate = (0, import_react8.useCallback)((cell) => {
2237
+ const tableRef = (0, import_react7.useRef)(null);
2238
+ const handleCellUpdate = (0, import_react7.useCallback)((cell) => {
2304
2239
  tableRef.current?.update?.(cell);
2305
2240
  }, []);
2306
- const handleRowOrderChange = (0, import_react8.useCallback)(() => {
2241
+ const handleRowOrderChange = (0, import_react7.useCallback)(() => {
2307
2242
  tableRef.current?.update?.();
2308
2243
  }, []);
2309
- const features = (0, import_react_ui8.useDefaultValue)(props.features, () => ({
2244
+ const features = (0, import_react_ui7.useDefaultValue)(props.features, () => ({
2310
2245
  selection: {
2311
2246
  enabled: false
2312
2247
  },
@@ -2322,20 +2257,20 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
2322
2257
  onRowOrderChange: handleRowOrderChange,
2323
2258
  onRowAction
2324
2259
  });
2325
- const presentation = (0, import_react8.useMemo)(() => {
2260
+ const presentation = (0, import_react7.useMemo)(() => {
2326
2261
  if (model) {
2327
2262
  return new TablePresentation(model);
2328
2263
  }
2329
2264
  }, [
2330
2265
  model
2331
2266
  ]);
2332
- return /* @__PURE__ */ import_react8.default.createElement("div", {
2267
+ return /* @__PURE__ */ import_react7.default.createElement("div", {
2333
2268
  role: "none",
2334
2269
  className: (0, import_react_ui_theme3.mx)("is-full bs-full grow grid", classNames)
2335
- }, /* @__PURE__ */ import_react8.default.createElement("div", {
2270
+ }, /* @__PURE__ */ import_react7.default.createElement("div", {
2336
2271
  role: "none",
2337
2272
  className: "grid min-bs-0 overflow-hidden"
2338
- }, /* @__PURE__ */ import_react8.default.createElement(Table.Root, null, /* @__PURE__ */ import_react8.default.createElement(Table.Main, {
2273
+ }, /* @__PURE__ */ import_react7.default.createElement(Table.Root, null, /* @__PURE__ */ import_react7.default.createElement(Table.Main, {
2339
2274
  ref: tableRef,
2340
2275
  model,
2341
2276
  presentation,
@@ -2395,18 +2330,18 @@ var createTableToolbarActions = (state) => {
2395
2330
  };
2396
2331
  };
2397
2332
  var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
2398
- const state = (0, import_react10.useMemo)(() => (0, import_live_object3.live)({
2333
+ const state = (0, import_react9.useMemo)(() => (0, import_live_object3.live)({
2399
2334
  viewDirty
2400
2335
  }), []);
2401
- const actionsCreator = (0, import_react10.useCallback)(() => createTableToolbarActions(state), [
2336
+ const actionsCreator = (0, import_react9.useCallback)(() => createTableToolbarActions(state), [
2402
2337
  state
2403
2338
  ]);
2404
2339
  const menu = (0, import_react_ui_menu.useMenuActions)(actionsCreator);
2405
- return /* @__PURE__ */ import_react10.default.createElement(import_react_ui_menu.MenuProvider, {
2340
+ return /* @__PURE__ */ import_react9.default.createElement(import_react_ui_menu.MenuProvider, {
2406
2341
  ...menu,
2407
2342
  attendableId,
2408
2343
  onAction
2409
- }, /* @__PURE__ */ import_react10.default.createElement(import_react_ui_menu.ToolbarMenu, {
2344
+ }, /* @__PURE__ */ import_react9.default.createElement(import_react_ui_menu.ToolbarMenu, {
2410
2345
  classNames
2411
2346
  }));
2412
2347
  };