@dxos/react-ui-table 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe

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 (97) hide show
  1. package/dist/lib/browser/{chunk-63UUF4IG.mjs → chunk-2PFAPQL4.mjs} +7 -7
  2. package/dist/lib/browser/chunk-2PFAPQL4.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-BBXDTWCX.mjs → chunk-GS2UNGJK.mjs} +443 -490
  4. package/dist/lib/browser/chunk-GS2UNGJK.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +161 -303
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +9 -7
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/lib/browser/types/index.mjs +1 -1
  11. package/dist/lib/node-esm/{chunk-K734DJB7.mjs → chunk-6POOFFYF.mjs} +7 -7
  12. package/dist/lib/node-esm/chunk-6POOFFYF.mjs.map +7 -0
  13. package/dist/lib/node-esm/{chunk-RNQDU7IQ.mjs → chunk-TRR3C5NX.mjs} +443 -490
  14. package/dist/lib/node-esm/chunk-TRR3C5NX.mjs.map +7 -0
  15. package/dist/lib/node-esm/index.mjs +161 -303
  16. package/dist/lib/node-esm/index.mjs.map +4 -4
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/testing/index.mjs +9 -7
  19. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/types/index.mjs +1 -1
  21. package/dist/types/src/components/Table/DynamicTable.d.ts +2 -2
  22. package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
  23. package/dist/types/src/components/Table/DynamicTable.stories.d.ts +3 -3
  24. package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Table/Relations.stories.d.ts +70 -7
  26. package/dist/types/src/components/Table/Relations.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  28. package/dist/types/src/components/Table/Table.d.ts +5 -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 +5 -6
  31. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +7 -5
  33. package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -1
  34. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +5 -3
  35. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  36. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts +1 -2
  37. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/TableCellEditor/index.d.ts +1 -0
  39. package/dist/types/src/components/TableCellEditor/index.d.ts.map +1 -1
  40. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -2
  41. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
  42. package/dist/types/src/components/testing.d.ts +3 -3
  43. package/dist/types/src/components/testing.d.ts.map +1 -1
  44. package/dist/types/src/hooks/useAddRow.d.ts +1 -1
  45. package/dist/types/src/hooks/useAddRow.d.ts.map +1 -1
  46. package/dist/types/src/hooks/useTableModel.d.ts +3 -3
  47. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  48. package/dist/types/src/model/modal-controller.d.ts +0 -7
  49. package/dist/types/src/model/modal-controller.d.ts.map +1 -1
  50. package/dist/types/src/model/table-model.d.ts +4 -4
  51. package/dist/types/src/model/table-model.d.ts.map +1 -1
  52. package/dist/types/src/model/table-presentation.d.ts.map +1 -1
  53. package/dist/types/src/model/table-sorting.d.ts +2 -2
  54. package/dist/types/src/model/table-sorting.d.ts.map +1 -1
  55. package/dist/types/src/testing/useTestTableModel.d.ts +3 -3
  56. package/dist/types/src/testing/useTestTableModel.d.ts.map +1 -1
  57. package/dist/types/src/types/schema.d.ts +6 -6
  58. package/dist/types/src/types/schema.d.ts.map +1 -1
  59. package/dist/types/src/util/dynamic-table.d.ts +5 -6
  60. package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
  61. package/dist/types/src/util/schema.d.ts +1 -1
  62. package/dist/types/src/util/schema.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +52 -51
  65. package/src/components/Table/DynamicTable.stories.tsx +11 -10
  66. package/src/components/Table/DynamicTable.tsx +4 -7
  67. package/src/components/Table/Relations.stories.tsx +127 -18
  68. package/src/components/Table/RowActionsMenu.tsx +21 -13
  69. package/src/components/Table/Table.stories.tsx +44 -43
  70. package/src/components/Table/Table.tsx +13 -9
  71. package/src/components/TableCellEditor/FormCellEditor.tsx +51 -41
  72. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +19 -46
  73. package/src/components/TableCellEditor/TableCellEditor.tsx +7 -94
  74. package/src/components/TableCellEditor/index.ts +1 -0
  75. package/src/components/TableToolbar/TableToolbar.tsx +32 -22
  76. package/src/components/testing.ts +2 -2
  77. package/src/hooks/useAddRow.ts +1 -1
  78. package/src/hooks/useTableModel.ts +5 -5
  79. package/src/model/modal-controller.ts +0 -28
  80. package/src/model/table-model.test.ts +12 -7
  81. package/src/model/table-model.ts +12 -8
  82. package/src/model/table-presentation.test.ts +15 -18
  83. package/src/model/table-presentation.ts +4 -5
  84. package/src/model/table-sorting.ts +9 -9
  85. package/src/playwright/TableManager.ts +1 -1
  86. package/src/playwright/smoke.spec.ts +7 -5
  87. package/src/testing/useTestTableModel.ts +7 -5
  88. package/src/types/schema.ts +8 -8
  89. package/src/util/dynamic-table.ts +9 -11
  90. package/src/util/schema.ts +4 -4
  91. package/dist/lib/browser/chunk-63UUF4IG.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-BBXDTWCX.mjs.map +0 -7
  93. package/dist/lib/node-esm/chunk-K734DJB7.mjs.map +0 -7
  94. package/dist/lib/node-esm/chunk-RNQDU7IQ.mjs.map +0 -7
  95. package/dist/types/src/components/Table/CreateRefPanel.d.ts +0 -9
  96. package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +0 -1
  97. package/src/components/Table/CreateRefPanel.tsx +0 -103
@@ -16,8 +16,8 @@ import {
16
16
  touch,
17
17
  useAddRow,
18
18
  useTableModel
19
- } from "./chunk-RNQDU7IQ.mjs";
20
- import "./chunk-K734DJB7.mjs";
19
+ } from "./chunk-TRR3C5NX.mjs";
20
+ import "./chunk-6POOFFYF.mjs";
21
21
 
22
22
  // src/translations.ts
23
23
  var translationKey = "react-ui-table";
@@ -52,8 +52,9 @@ var translations = [
52
52
  ];
53
53
 
54
54
  // src/components/Table/Table.tsx
55
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
56
- import React8, { forwardRef, useCallback as useCallback5, useEffect as useEffect3, useImperativeHandle, useMemo as useMemo5, useState as useState4 } from "react";
55
+ import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
56
+ import * as String2 from "effect/String";
57
+ import React7, { forwardRef, useCallback as useCallback4, useEffect as useEffect3, useImperativeHandle, useMemo as useMemo4, useState as useState4 } from "react";
57
58
  import { useAttention } from "@dxos/react-ui-attention";
58
59
  import { Grid, closestCell, gridSeparatorBlockEnd, gridSeparatorInlineEnd } from "@dxos/react-ui-grid";
59
60
  import { DxEditRequest } from "@dxos/react-ui-grid";
@@ -64,11 +65,9 @@ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking"
64
65
  import { EditorView } from "@codemirror/view";
65
66
  import React3, { useCallback as useCallback2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
66
67
  import { debounce } from "@dxos/async";
67
- import { FormatEnum, TypeEnum } from "@dxos/echo-schema";
68
+ import { FormatEnum as FormatEnum2, TypeEnum } from "@dxos/echo/internal";
68
69
  import { invariant as invariant2 } from "@dxos/invariant";
69
- import { createMarkdownExtensions } from "@dxos/react-ui-editor";
70
70
  import { GridCellEditor, editorKeys, parseCellIndex as parseCellIndex2, useGridContext as useGridContext3 } from "@dxos/react-ui-grid";
71
- import { createLinks, tagPicker } from "@dxos/react-ui-tag-picker";
72
71
 
73
72
  // src/components/TableCellEditor/CellValidationMessage.tsx
74
73
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
@@ -103,16 +102,17 @@ var CellValidationMessage = ({ validationError, variant = "error", __gridScope }
103
102
 
104
103
  // src/components/TableCellEditor/FormCellEditor.tsx
105
104
  import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
105
+ import * as Schema from "effect/Schema";
106
106
  import React2, { useCallback, useEffect, useMemo, useRef, useState } from "react";
107
107
  import { Filter, Obj } from "@dxos/echo";
108
- import { Ref, getValue } from "@dxos/echo-schema";
108
+ import { FormatEnum, Ref, getValue } from "@dxos/echo/internal";
109
109
  import { invariant } from "@dxos/invariant";
110
110
  import { getSnapshot } from "@dxos/live-object";
111
111
  import { getSpace } from "@dxos/react-client/echo";
112
112
  import { Popover } from "@dxos/react-ui";
113
113
  import { Form } from "@dxos/react-ui-form";
114
- import { cellQuery, parseCellIndex, useGridContext as useGridContext2 } from "@dxos/react-ui-grid";
115
- import { getDeep, isNotFalsy, setDeep } from "@dxos/util";
114
+ import { parseCellIndex, useGridContext as useGridContext2 } from "@dxos/react-ui-grid";
115
+ import { getDeep, isTruthy, setDeep } from "@dxos/util";
116
116
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-table/src/components/TableCellEditor/FormCellEditor.tsx";
117
117
  var createOptionLabel = [
118
118
  "create new object label",
@@ -120,7 +120,7 @@ var createOptionLabel = [
120
120
  ns: translationKey
121
121
  }
122
122
  ];
123
- var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals, __gridScope, ...formProps }) => {
123
+ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals, onCreate, __gridScope, ...formProps }) => {
124
124
  var _effect = _useSignals2();
125
125
  try {
126
126
  const { editing: contextEditing, setEditing, id: gridId } = useGridContext2("ArrayEditor", __gridScope);
@@ -130,7 +130,7 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
130
130
  const space = getSpace(model.view);
131
131
  invariant(space, void 0, {
132
132
  F: __dxlog_file,
133
- L: 53,
133
+ L: 57,
134
134
  S: void 0,
135
135
  A: [
136
136
  "space",
@@ -161,7 +161,7 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
161
161
  dxn: Obj.getDXN(obj),
162
162
  label: getValue(obj, fieldProjection.field.referencePath) || obj.id.toString()
163
163
  };
164
- }).filter(isNotFalsy);
164
+ }).filter(isTruthy);
165
165
  }
166
166
  return [];
167
167
  }, [
@@ -175,7 +175,7 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
175
175
  const draftRow = model.draftRows.value[cell.row];
176
176
  invariant(draftRow, void 0, {
177
177
  F: __dxlog_file,
178
- L: 94,
178
+ L: 98,
179
179
  S: void 0,
180
180
  A: [
181
181
  "draftRow",
@@ -187,7 +187,7 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
187
187
  const row = model.getRowAt(cell.row);
188
188
  invariant(row, void 0, {
189
189
  F: __dxlog_file,
190
- L: 98,
190
+ L: 102,
191
191
  S: void 0,
192
192
  A: [
193
193
  "row",
@@ -220,38 +220,6 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
220
220
  contextEditing,
221
221
  originalRow
222
222
  ]);
223
- const handleCreate = useCallback((object) => {
224
- const ref = Ref.make(object);
225
- const path = fieldProjection.field.path;
226
- setDeep(originalRow, [
227
- path
228
- ], ref);
229
- contextEditing?.cellElement?.focus();
230
- setEditing(null);
231
- setLocalEditing(false);
232
- onSave?.();
233
- }, [
234
- fieldProjection.field.path,
235
- onSave,
236
- contextEditing,
237
- originalRow
238
- ]);
239
- const handleCreateFromQuery = useCallback(async (typeAnnotation, query) => {
240
- if (model && modals && contextEditing?.index) {
241
- setLocalEditing(false);
242
- modals.openCreateRef(typeAnnotation.typename, document.querySelector(cellQuery(contextEditing.index, gridId)), {
243
- [fieldProjection.field.referencePath]: query
244
- }, handleCreate);
245
- }
246
- }, [
247
- model,
248
- modals,
249
- client,
250
- contextEditing?.index,
251
- gridId,
252
- fieldProjection,
253
- handleSave
254
- ]);
255
223
  useEffect(() => {
256
224
  if (contextEditing && contextEditing.cellElement) {
257
225
  anchorRef.current = contextEditing.cellElement.querySelector(".dx-grid__cell__content");
@@ -284,6 +252,47 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
284
252
  }
285
253
  setLocalEditing(nextOpen);
286
254
  }, []);
255
+ const refSchema = useMemo(() => {
256
+ if (fieldProjection.props.format === FormatEnum.Ref && fieldProjection.props.referenceSchema) {
257
+ const { schema: refSchema2 } = getSchema({
258
+ typename: fieldProjection.props.referenceSchema
259
+ });
260
+ return refSchema2;
261
+ }
262
+ return null;
263
+ }, [
264
+ fieldProjection.props.format,
265
+ fieldProjection.props.referenceSchema,
266
+ getSchema
267
+ ]);
268
+ const createSchema = useMemo(() => {
269
+ return refSchema ? Schema.omit("id")(refSchema) : null;
270
+ }, [
271
+ refSchema
272
+ ]);
273
+ const handleCreate = useCallback((values) => {
274
+ if (refSchema && onCreate) {
275
+ const objectWithId = onCreate(refSchema, values);
276
+ if (objectWithId) {
277
+ const ref = Ref.make(objectWithId);
278
+ const path = fieldProjection.field.path;
279
+ setDeep(originalRow, [
280
+ path
281
+ ], ref);
282
+ }
283
+ }
284
+ contextEditing?.cellElement?.focus();
285
+ setEditing(null);
286
+ setLocalEditing(false);
287
+ onSave?.();
288
+ }, [
289
+ fieldProjection.field.path,
290
+ onSave,
291
+ contextEditing,
292
+ originalRow,
293
+ refSchema,
294
+ onCreate
295
+ ]);
287
296
  if (!editing) {
288
297
  return null;
289
298
  }
@@ -302,9 +311,13 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
302
311
  onSave: handleSave,
303
312
  ...formProps,
304
313
  onQueryRefOptions: handleQueryRefOptions,
305
- onCreateFromQuery: handleCreateFromQuery,
306
- createOptionIcon: "ph--plus--regular",
307
- createOptionLabel
314
+ ...createSchema && {
315
+ onCreate: handleCreate,
316
+ createSchema,
317
+ createInitialValuePath: fieldProjection.field.referencePath,
318
+ createOptionIcon: "ph--plus--regular",
319
+ createOptionLabel
320
+ }
308
321
  })))));
309
322
  } finally {
310
323
  _effect.f();
@@ -314,7 +327,7 @@ var FormCellEditor = ({ fieldProjection, model, schema, onSave, client, modals,
314
327
  // src/components/TableCellEditor/TableCellEditor.tsx
315
328
  var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-table/src/components/TableCellEditor/TableCellEditor.tsx";
316
329
  var adaptValidationMessage = (message) => message ? message.endsWith("is missing") ? "Can\u2019t be blank" : message : null;
317
- var TableValueEditor = ({ model, modals, schema, onFocus, onSave, client, __gridScope }) => {
330
+ var TableValueEditor = ({ model, modals, schema, onFocus, onSave, onCreate, client, __gridScope }) => {
318
331
  var _effect = _useSignals3();
319
332
  try {
320
333
  const { editing } = useGridContext3("TableValueEditor", __gridScope);
@@ -339,13 +352,14 @@ var TableValueEditor = ({ model, modals, schema, onFocus, onSave, client, __grid
339
352
  model,
340
353
  editing
341
354
  ]);
342
- if (fieldProjection?.props.type === TypeEnum.Array || fieldProjection?.props.format === FormatEnum.SingleSelect || fieldProjection?.props.format === FormatEnum.Ref) {
355
+ if (fieldProjection?.props.type === TypeEnum.Array || fieldProjection?.props.format === FormatEnum2.SingleSelect || fieldProjection?.props.format === FormatEnum2.Ref) {
343
356
  return /* @__PURE__ */ React3.createElement(FormCellEditor, {
344
357
  fieldProjection,
345
358
  model,
346
359
  schema,
347
360
  __gridScope,
348
361
  onSave,
362
+ onCreate,
349
363
  client,
350
364
  modals
351
365
  });
@@ -382,7 +396,7 @@ var TableCellEditor = ({ model, modals, onFocus, onSave, __gridScope }) => {
382
396
  const fieldProjection2 = model.projection.getFieldProjection(field.id);
383
397
  invariant2(fieldProjection2, void 0, {
384
398
  F: __dxlog_file2,
385
- L: 120,
399
+ L: 121,
386
400
  S: void 0,
387
401
  A: [
388
402
  "fieldProjection",
@@ -484,35 +498,6 @@ var TableCellEditor = ({ model, modals, onFocus, onSave, __gridScope }) => {
484
498
  }
485
499
  })
486
500
  ];
487
- const format = fieldProjection.props.format;
488
- if (format === FormatEnum.SingleSelect || format === FormatEnum.MultiSelect) {
489
- const options = fieldProjection.props.options || [];
490
- const mode = format === FormatEnum.SingleSelect ? "single-select" : "multi-select";
491
- extensions2.push(createMarkdownExtensions());
492
- extensions2.push(tagPicker({
493
- mode,
494
- keymap: false,
495
- onSearch: (text, selectedIds) => {
496
- return options.filter((option) => selectedIds.indexOf(option.id) === -1 && (text.length === 0 || option.title.toLowerCase().includes(text.toLowerCase()))).map((option) => ({
497
- id: option.id,
498
- label: option.title,
499
- hue: option.color
500
- }));
501
- },
502
- onUpdate: (ids) => {
503
- if (model && editing) {
504
- if (ids.length === 0) {
505
- return;
506
- }
507
- if (mode === "single-select") {
508
- void handleEnter(ids[0]);
509
- } else {
510
- void handleEnter(ids);
511
- }
512
- }
513
- }
514
- }));
515
- }
516
501
  if (model && editing) {
517
502
  extensions2.push(EditorView.updateListener.of(debounce((update) => {
518
503
  const content = update.state.doc.toString();
@@ -538,42 +523,6 @@ var TableCellEditor = ({ model, modals, onFocus, onSave, __gridScope }) => {
538
523
  const getCellContent = useCallback2(() => {
539
524
  if (model && editing) {
540
525
  const cell = parseCellIndex2(editing.index);
541
- const { col } = cell;
542
- const field = model.projection.fields[col];
543
- const fieldProjection2 = model.projection.getFieldProjection(field.id);
544
- if (fieldProjection2?.props.format === FormatEnum.SingleSelect || fieldProjection2?.props.format === FormatEnum.MultiSelect) {
545
- const value2 = model.getCellData(cell);
546
- if (value2 !== void 0) {
547
- const options = fieldProjection2.props.options || [];
548
- if (fieldProjection2.props.format === FormatEnum.MultiSelect) {
549
- const tagItems = value2.split(",").map((id) => {
550
- const option = options.find((o) => o.id === id);
551
- if (option) {
552
- return {
553
- id,
554
- label: option.title,
555
- hue: option.color
556
- };
557
- }
558
- return void 0;
559
- }).filter((item) => item !== void 0);
560
- return createLinks(tagItems);
561
- } else {
562
- const option = options.find((o) => o.id === value2);
563
- if (option) {
564
- const tagItem = {
565
- id: value2,
566
- label: option.title,
567
- hue: option.color
568
- };
569
- return createLinks([
570
- tagItem
571
- ]);
572
- }
573
- }
574
- }
575
- return "";
576
- }
577
526
  const value = model.getCellData(cell);
578
527
  return value !== void 0 ? String(value) : "";
579
528
  }
@@ -733,106 +682,12 @@ var ColumnSettings = ({ registry, model, modals, onNewColumn }) => {
733
682
  }
734
683
  };
735
684
 
736
- // src/components/Table/CreateRefPanel.tsx
737
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
738
- import { Schema } from "effect";
739
- import React6, { useCallback as useCallback4, useMemo as useMemo4 } from "react";
740
- import { Type } from "@dxos/echo";
741
- import { live } from "@dxos/live-object";
742
- import { useClient } from "@dxos/react-client";
743
- import { getSpace as getSpace2 } from "@dxos/react-client/echo";
744
- import { Popover as Popover3 } from "@dxos/react-ui";
745
- import { Form as Form2 } from "@dxos/react-ui-form";
746
- import { useGridContext as useGridContext4 } from "@dxos/react-ui-grid";
747
- var CreateRefPanel = ({ model, modals, __gridScope }) => {
748
- var _effect = _useSignals6();
749
- try {
750
- const { id: gridId } = useGridContext4("TableCellEditor", __gridScope);
751
- const client = useClient();
752
- const space = model && getSpace2(model?.view);
753
- const state = modals.state.value;
754
- const getSchema = useCallback4(() => {
755
- if (!space || state?.type !== "createRefPanel") {
756
- return;
757
- }
758
- const staticSchema = client.graph.schemaRegistry.schemas.find((schema3) => Type.getTypename(schema3) === state.typename);
759
- if (staticSchema) {
760
- return staticSchema;
761
- }
762
- const [schema2] = space.db.schemaRegistry.query({
763
- typename: state.typename
764
- }).runSync();
765
- return schema2;
766
- }, [
767
- space,
768
- state
769
- ]);
770
- const schema = useMemo4(() => {
771
- const schema2 = getSchema();
772
- if (!schema2) {
773
- return;
774
- }
775
- const omit = Schema.omit("id");
776
- return omit(schema2);
777
- }, [
778
- getSchema
779
- ]);
780
- const handleSave = useCallback4((values) => {
781
- if (!model || !space || state?.type !== "createRefPanel") {
782
- return;
783
- }
784
- const schema2 = getSchema();
785
- if (schema2) {
786
- const obj = space.db.add(live(schema2, values));
787
- state.onCreate?.(obj);
788
- }
789
- void modals.close();
790
- }, [
791
- model,
792
- modals,
793
- space,
794
- state
795
- ]);
796
- const handleCancel = useCallback4(() => {
797
- if (model) {
798
- modals.close();
799
- }
800
- }, [
801
- modals
802
- ]);
803
- if (!model?.projection) {
804
- return null;
805
- }
806
- return /* @__PURE__ */ React6.createElement(Popover3.Root, {
807
- modal: false,
808
- open: state?.type === "createRefPanel" && !!schema,
809
- onOpenChange: (nextOpen) => {
810
- if (model && !nextOpen) {
811
- return modals.close();
812
- }
813
- }
814
- }, /* @__PURE__ */ React6.createElement(Popover3.VirtualTrigger, {
815
- virtualRef: modals.trigger
816
- }), /* @__PURE__ */ React6.createElement(Popover3.Portal, null, /* @__PURE__ */ React6.createElement(Popover3.Content, {
817
- classNames: "md:is-64",
818
- "data-grid": gridId
819
- }, /* @__PURE__ */ React6.createElement(Popover3.Viewport, null, state?.type === "createRefPanel" && schema && /* @__PURE__ */ React6.createElement(Form2, {
820
- schema,
821
- values: state.initialValues ?? {},
822
- onSave: handleSave,
823
- onCancel: handleCancel
824
- })), /* @__PURE__ */ React6.createElement(Popover3.Arrow, null))));
825
- } finally {
826
- _effect.f();
827
- }
828
- };
829
-
830
685
  // src/components/Table/RowActionsMenu.tsx
831
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
832
- import React7 from "react";
686
+ import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
687
+ import React6 from "react";
833
688
  import { DropdownMenu as DropdownMenu2, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
834
689
  var RowActionsMenu = ({ model, modals }) => {
835
- var _effect = _useSignals7();
690
+ var _effect = _useSignals6();
836
691
  try {
837
692
  const { t } = useTranslation2(translationKey);
838
693
  const hasSelection = model.selection.hasSelection.value;
@@ -840,23 +695,23 @@ var RowActionsMenu = ({ model, modals }) => {
840
695
  if (state?.type !== "row") {
841
696
  return null;
842
697
  }
843
- return /* @__PURE__ */ React7.createElement(DropdownMenu2.Root, {
698
+ return /* @__PURE__ */ React6.createElement(DropdownMenu2.Root, {
844
699
  modal: false,
845
700
  open: true,
846
701
  onOpenChange: modals.close
847
- }, /* @__PURE__ */ React7.createElement(DropdownMenu2.VirtualTrigger, {
702
+ }, /* @__PURE__ */ React6.createElement(DropdownMenu2.VirtualTrigger, {
848
703
  virtualRef: modals.trigger
849
- }), /* @__PURE__ */ React7.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React7.createElement(DropdownMenu2.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ React7.createElement(DropdownMenu2.Item, {
850
- "data-testid": "row-menu-delete",
851
- onClick: () => model.deleteRow(state.rowIndex)
852
- }, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ React7.createElement(DropdownMenu2.Item, {
704
+ }), /* @__PURE__ */ React6.createElement(DropdownMenu2.Content, null, /* @__PURE__ */ React6.createElement(DropdownMenu2.Viewport, null, model.rowActions?.length > 0 && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(DropdownMenu2.Group, null, model.rowActions?.map((action) => /* @__PURE__ */ React6.createElement(DropdownMenu2.Item, {
853
705
  key: action.id,
854
706
  "data-testid": `row-action-${action.id}`,
855
707
  onClick: () => {
856
708
  modals.close();
857
709
  model.handleRowAction(action.id, state.rowIndex);
858
710
  }
859
- }, toLocalizedString(action.label, t)))), /* @__PURE__ */ React7.createElement(DropdownMenu2.Arrow, null)));
711
+ }, toLocalizedString(action.label, t)))), /* @__PURE__ */ React6.createElement(DropdownMenu2.Separator, null)), model.features.dataEditable !== false && /* @__PURE__ */ React6.createElement(DropdownMenu2.Item, {
712
+ "data-testid": "row-menu-delete",
713
+ onClick: () => model.deleteRow(state.rowIndex)
714
+ }, t(hasSelection ? "bulk delete row label" : "delete row label"))), /* @__PURE__ */ React6.createElement(DropdownMenu2.Arrow, null)));
860
715
  } finally {
861
716
  _effect.f();
862
717
  }
@@ -876,9 +731,9 @@ var rowDefault = {
876
731
  }
877
732
  };
878
733
  var TableRoot = ({ children, role = "article" }) => {
879
- var _effect = _useSignals8();
734
+ var _effect = _useSignals7();
880
735
  try {
881
- return /* @__PURE__ */ React8.createElement("div", {
736
+ return /* @__PURE__ */ React7.createElement("div", {
882
737
  role: "none",
883
738
  className: mx("relative !border-separator [&_.dx-grid]:max-is-[--dx-grid-content-inline-size] [&_.dx-grid]:max-bs-[--dx-grid-content-block-size]", role === "card--popover" && "popover-card-height", role === "section" && "attention-surface", role === "card--intrinsic" && "[&_.dx-grid]:bs-[--dx-grid-content-block-size]", [
884
739
  "card--popover",
@@ -893,20 +748,20 @@ var TableRoot = ({ children, role = "article" }) => {
893
748
  _effect.f();
894
749
  }
895
750
  };
896
- var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttention, schema, client, onRowClick }, forwardedRef) => {
897
- var _effect = _useSignals8();
751
+ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttention, schema, client, onCreate, onRowClick, testId }, forwardedRef) => {
752
+ var _effect = _useSignals7();
898
753
  try {
899
754
  const [dxGrid, setDxGrid] = useState4(null);
900
755
  const { hasAttention } = useAttention(model?.id ?? "table");
901
- const modals = useMemo5(() => new ModalController(), []);
756
+ const modals = useMemo4(() => new ModalController(), []);
902
757
  const draftRowCount = model?.getDraftRowCount() ?? 0;
903
- const handleSave = useCallback5(() => {
758
+ const handleSave = useCallback4(() => {
904
759
  dxGrid?.updateCells(true);
905
760
  dxGrid?.requestUpdate();
906
761
  }, [
907
762
  dxGrid
908
763
  ]);
909
- const frozen = useMemo5(() => {
764
+ const frozen = useMemo4(() => {
910
765
  const noActionColumn = model?.features.dataEditable === false && model?.features.schemaEditable === false && model.rowActions.length === 0;
911
766
  return {
912
767
  frozenRowsStart: 1,
@@ -918,7 +773,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
918
773
  model,
919
774
  draftRowCount
920
775
  ]);
921
- const getCells = useCallback5((range, plane) => presentation?.getCells(range, plane) ?? {}, [
776
+ const getCells = useCallback4((range, plane) => presentation?.getCells(range, plane) ?? {}, [
922
777
  presentation
923
778
  ]);
924
779
  useEffect3(() => {
@@ -931,7 +786,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
931
786
  dxGrid,
932
787
  getCells
933
788
  ]);
934
- const handleInsertRowResult = useCallback5((insertResult) => {
789
+ const handleInsertRowResult = useCallback4((insertResult) => {
935
790
  if (insertResult === "draft") {
936
791
  requestAnimationFrame(() => {
937
792
  dxGrid?.setFocus({
@@ -975,7 +830,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
975
830
  dxGrid,
976
831
  model
977
832
  ]);
978
- const handleSaveDraftRow = useCallback5((rowIndex = 0) => {
833
+ const handleSaveDraftRow = useCallback4((rowIndex = 0) => {
979
834
  if (model && dxGrid) {
980
835
  const didCommitSuccessfully = model.commitDraftRow(rowIndex);
981
836
  if (didCommitSuccessfully) {
@@ -988,7 +843,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
988
843
  model,
989
844
  dxGrid
990
845
  ]);
991
- const handleGridClick = useCallback5((event) => {
846
+ const handleGridClick = useCallback4((event) => {
992
847
  const cell = closestCell(event.target);
993
848
  if (cell) {
994
849
  const { row: rowIndex, plane } = cell;
@@ -1073,9 +928,9 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1073
928
  modals,
1074
929
  dxGrid
1075
930
  ]);
1076
- const handleFocus = useCallback5((increment, delta, cell) => {
931
+ const handleFocus = useCallback4((increment, delta, cell) => {
1077
932
  if (dxGrid && model) {
1078
- if (cell?.plane === "grid" && cell?.row >= model.getRowCount() - 1) {
933
+ if (cell?.plane === "grid" && cell?.row >= model.getRowCount() - 1 && increment !== "col") {
1079
934
  handleInsertRowResult(draftRowCount < 1 ? model.insertRow() : "final");
1080
935
  } else if (cell?.plane === "frozenRowsEnd" && increment === "row") {
1081
936
  handleSaveDraftRow(cell.row);
@@ -1088,7 +943,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1088
943
  dxGrid,
1089
944
  model
1090
945
  ]);
1091
- const handleKeyDown = useCallback5((event) => {
946
+ const handleKeyDown = useCallback4((event) => {
1092
947
  if (!model?.features.dataEditable) {
1093
948
  return;
1094
949
  }
@@ -1113,7 +968,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1113
968
  event.preventDefault();
1114
969
  void navigator.clipboard.readText().then((clipboardText) => {
1115
970
  try {
1116
- model.setCellData(cell, clipboardText);
971
+ model.setCellData(cell, String2.trim(clipboardText).replace(/[\n\r]+/, " "));
1117
972
  handleSave();
1118
973
  } catch {
1119
974
  const cellElement = event.target.closest('[data-dx-grid-action="cell"]');
@@ -1144,6 +999,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1144
999
  try {
1145
1000
  model.setCellData(cell, void 0);
1146
1001
  event.preventDefault();
1002
+ handleSave();
1147
1003
  } catch {
1148
1004
  }
1149
1005
  break;
@@ -1154,7 +1010,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1154
1010
  dxGrid,
1155
1011
  handleSave
1156
1012
  ]);
1157
- const handleAxisResize = useCallback5((event) => {
1013
+ const handleAxisResize = useCallback4((event) => {
1158
1014
  if (event.axis === "col") {
1159
1015
  const columnIndex = parseInt(event.index, 10);
1160
1016
  model?.setColumnWidth(columnIndex, event.size);
@@ -1162,7 +1018,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1162
1018
  }, [
1163
1019
  model
1164
1020
  ]);
1165
- const handleWheel = useCallback5((event) => {
1021
+ const handleWheel = useCallback4((event) => {
1166
1022
  if (!ignoreAttention && !hasAttention) {
1167
1023
  event.stopPropagation();
1168
1024
  }
@@ -1170,7 +1026,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1170
1026
  hasAttention,
1171
1027
  ignoreAttention
1172
1028
  ]);
1173
- const handleNewColumn = useCallback5(() => {
1029
+ const handleNewColumn = useCallback4(() => {
1174
1030
  const columns = model?.getColumnCount();
1175
1031
  if (dxGrid && columns) {
1176
1032
  dxGrid.scrollToColumn(columns - 1);
@@ -1180,21 +1036,22 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1180
1036
  dxGrid
1181
1037
  ]);
1182
1038
  if (!model || !modals) {
1183
- return /* @__PURE__ */ React8.createElement("span", {
1039
+ return /* @__PURE__ */ React7.createElement("span", {
1184
1040
  role: "none",
1185
1041
  className: "attention-surface"
1186
1042
  });
1187
1043
  }
1188
- return /* @__PURE__ */ React8.createElement(Grid.Root, {
1044
+ return /* @__PURE__ */ React7.createElement(Grid.Root, {
1189
1045
  id: model.id ?? "table-grid"
1190
- }, /* @__PURE__ */ React8.createElement(TableValueEditor, {
1046
+ }, /* @__PURE__ */ React7.createElement(TableValueEditor, {
1191
1047
  model,
1192
1048
  modals,
1193
1049
  schema,
1194
1050
  onFocus: handleFocus,
1195
1051
  onSave: handleSave,
1052
+ onCreate,
1196
1053
  client
1197
- }), /* @__PURE__ */ React8.createElement(Grid.Content, {
1054
+ }), /* @__PURE__ */ React7.createElement(Grid.Content, {
1198
1055
  className: mx("[--dx-grid-base:var(--baseSurface)]", gridSeparatorInlineEnd, gridSeparatorBlockEnd),
1199
1056
  frozen,
1200
1057
  columns: model.columnMeta.value,
@@ -1207,20 +1064,20 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1207
1064
  onClick: handleGridClick,
1208
1065
  onKeyDownCapture: handleKeyDown,
1209
1066
  onWheelCapture: handleWheel,
1067
+ ...testId && {
1068
+ "data-testid": testId
1069
+ },
1210
1070
  ref: setDxGrid
1211
- }), /* @__PURE__ */ React8.createElement(RowActionsMenu, {
1071
+ }), /* @__PURE__ */ React7.createElement(RowActionsMenu, {
1212
1072
  model,
1213
1073
  modals
1214
- }), /* @__PURE__ */ React8.createElement(ColumnActionsMenu, {
1074
+ }), /* @__PURE__ */ React7.createElement(ColumnActionsMenu, {
1215
1075
  model,
1216
1076
  modals
1217
- }), /* @__PURE__ */ React8.createElement(ColumnSettings, {
1077
+ }), /* @__PURE__ */ React7.createElement(ColumnSettings, {
1218
1078
  model,
1219
1079
  modals,
1220
1080
  onNewColumn: handleNewColumn
1221
- }), /* @__PURE__ */ React8.createElement(CreateRefPanel, {
1222
- model,
1223
- modals
1224
1081
  }));
1225
1082
  } finally {
1226
1083
  _effect.f();
@@ -1232,14 +1089,14 @@ var Table = {
1232
1089
  };
1233
1090
 
1234
1091
  // src/components/Table/DynamicTable.tsx
1235
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1236
- import React9, { useCallback as useCallback6, useMemo as useMemo6, useRef as useRef3 } from "react";
1092
+ import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
1093
+ import React8, { useCallback as useCallback5, useMemo as useMemo5, useRef as useRef3 } from "react";
1237
1094
  import { useDefaultValue } from "@dxos/react-ui";
1238
1095
  import { mx as mx2 } from "@dxos/react-ui-theme";
1239
1096
  var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, properties, jsonSchema: _jsonSchema, schema, rowActions, onRowClick, onRowAction, ...props }) => {
1240
- var _effect = _useSignals9();
1097
+ var _effect = _useSignals8();
1241
1098
  try {
1242
- const { typename, jsonSchema } = useMemo6(() => getBaseSchema({
1099
+ const { jsonSchema } = useMemo5(() => getBaseSchema({
1243
1100
  typename: name,
1244
1101
  properties,
1245
1102
  jsonSchema: _jsonSchema,
@@ -1250,20 +1107,18 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
1250
1107
  _jsonSchema,
1251
1108
  schema
1252
1109
  ]);
1253
- const { projection, view } = useMemo6(() => makeDynamicTable({
1254
- typename,
1110
+ const { projection, view } = useMemo5(() => makeDynamicTable({
1255
1111
  jsonSchema,
1256
1112
  properties
1257
1113
  }), [
1258
- typename,
1259
1114
  jsonSchema,
1260
1115
  properties
1261
1116
  ]);
1262
1117
  const tableRef = useRef3(null);
1263
- const handleCellUpdate = useCallback6((cell) => {
1118
+ const handleCellUpdate = useCallback5((cell) => {
1264
1119
  tableRef.current?.update?.(cell);
1265
1120
  }, []);
1266
- const handleRowOrderChange = useCallback6(() => {
1121
+ const handleRowOrderChange = useCallback5(() => {
1267
1122
  tableRef.current?.update?.();
1268
1123
  }, []);
1269
1124
  const features = useDefaultValue(props.features, () => ({
@@ -1283,20 +1138,20 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
1283
1138
  onRowOrderChange: handleRowOrderChange,
1284
1139
  onRowAction
1285
1140
  });
1286
- const presentation = useMemo6(() => {
1141
+ const presentation = useMemo5(() => {
1287
1142
  if (model) {
1288
1143
  return new TablePresentation(model);
1289
1144
  }
1290
1145
  }, [
1291
1146
  model
1292
1147
  ]);
1293
- return /* @__PURE__ */ React9.createElement("div", {
1148
+ return /* @__PURE__ */ React8.createElement("div", {
1294
1149
  role: "none",
1295
1150
  className: mx2("is-full bs-full grow grid", classNames)
1296
- }, /* @__PURE__ */ React9.createElement("div", {
1151
+ }, /* @__PURE__ */ React8.createElement("div", {
1297
1152
  role: "none",
1298
1153
  className: "grid min-bs-0 overflow-hidden"
1299
- }, /* @__PURE__ */ React9.createElement(Table.Root, null, /* @__PURE__ */ React9.createElement(Table.Main, {
1154
+ }, /* @__PURE__ */ React8.createElement(Table.Root, null, /* @__PURE__ */ React8.createElement(Table.Main, {
1300
1155
  ref: tableRef,
1301
1156
  model,
1302
1157
  presentation,
@@ -1309,43 +1164,46 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
1309
1164
  };
1310
1165
 
1311
1166
  // src/components/TableToolbar/TableToolbar.tsx
1312
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1313
- import { Rx } from "@effect-rx/rx-react";
1314
- import React10, { useMemo as useMemo7 } from "react";
1315
- import { live as live2 } from "@dxos/live-object";
1167
+ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1168
+ import { Atom } from "@effect-atom/atom-react";
1169
+ import React9, { useMemo as useMemo6 } from "react";
1170
+ import { live } from "@dxos/live-object";
1316
1171
  import { MenuProvider, ToolbarMenu, createGapSeparator, createMenuAction, useMenuActions } from "@dxos/react-ui-menu";
1317
- import { rxFromSignal } from "@dxos/react-ui-menu";
1318
- var createTableToolbarActions = ({ state, onAdd, onSave, customActions }) => Rx.make((get) => {
1319
- const add = createMenuAction("add-row", onAdd, {
1320
- type: "add-row",
1321
- icon: "ph--plus--regular",
1322
- label: [
1323
- "add row",
1324
- {
1325
- ns: translationKey
1326
- }
1327
- ],
1328
- testId: "table.toolbar.add-row"
1329
- });
1330
- const save = createMenuAction("save-view", onSave, {
1331
- type: "save-view",
1332
- icon: "ph--floppy-disk--regular",
1333
- label: [
1334
- "save view label",
1335
- {
1336
- ns: translationKey
1337
- }
1338
- ],
1339
- testId: "table.toolbar.save-view",
1340
- iconOnly: false,
1341
- hidden: get(rxFromSignal(() => !state.viewDirty))
1342
- });
1172
+ import { atomFromSignal } from "@dxos/react-ui-menu";
1173
+ var createTableToolbarActions = ({ state, onAdd, onSave, customActions }) => Atom.make((get) => {
1174
+ const nodes = [];
1175
+ if (onAdd) {
1176
+ const add = createMenuAction("add-row", onAdd, {
1177
+ type: "add-row",
1178
+ icon: "ph--plus--regular",
1179
+ label: [
1180
+ "add row",
1181
+ {
1182
+ ns: translationKey
1183
+ }
1184
+ ],
1185
+ testId: "table.toolbar.add-row"
1186
+ });
1187
+ nodes.push(add);
1188
+ }
1189
+ if (onSave) {
1190
+ const save = createMenuAction("save-view", onSave, {
1191
+ type: "save-view",
1192
+ icon: "ph--floppy-disk--regular",
1193
+ label: [
1194
+ "save view label",
1195
+ {
1196
+ ns: translationKey
1197
+ }
1198
+ ],
1199
+ testId: "table.toolbar.save-view",
1200
+ iconOnly: false,
1201
+ hidden: get(atomFromSignal(() => !state.viewDirty))
1202
+ });
1203
+ nodes.push(save);
1204
+ }
1343
1205
  const gap = createGapSeparator();
1344
- const nodes = [
1345
- add,
1346
- save,
1347
- ...gap.nodes
1348
- ];
1206
+ nodes.push(...gap.nodes);
1349
1207
  const edges = nodes.map(({ id: target }) => ({
1350
1208
  source: "root",
1351
1209
  target
@@ -1361,12 +1219,12 @@ var createTableToolbarActions = ({ state, onAdd, onSave, customActions }) => Rx.
1361
1219
  };
1362
1220
  });
1363
1221
  var TableToolbar = ({ classNames, viewDirty, attendableId, onAdd, onSave, customActions }) => {
1364
- var _effect = _useSignals10();
1222
+ var _effect = _useSignals9();
1365
1223
  try {
1366
- const state = useMemo7(() => live2({
1224
+ const state = useMemo6(() => live({
1367
1225
  viewDirty
1368
1226
  }), []);
1369
- const actionsCreator = useMemo7(() => createTableToolbarActions({
1227
+ const actionsCreator = useMemo6(() => createTableToolbarActions({
1370
1228
  state,
1371
1229
  onAdd,
1372
1230
  onSave,
@@ -1378,10 +1236,10 @@ var TableToolbar = ({ classNames, viewDirty, attendableId, onAdd, onSave, custom
1378
1236
  customActions
1379
1237
  ]);
1380
1238
  const menu = useMenuActions(actionsCreator);
1381
- return /* @__PURE__ */ React10.createElement(MenuProvider, {
1239
+ return /* @__PURE__ */ React9.createElement(MenuProvider, {
1382
1240
  ...menu,
1383
1241
  attendableId
1384
- }, /* @__PURE__ */ React10.createElement(ToolbarMenu, {
1242
+ }, /* @__PURE__ */ React9.createElement(ToolbarMenu, {
1385
1243
  classNames
1386
1244
  }));
1387
1245
  } finally {