@dxos/react-ui-table 0.8.1 → 0.8.2-main.12df754
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.
- package/dist/lib/browser/index.mjs +10 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +5 -5
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +10 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/testing.d.ts +1 -1
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts +2 -2
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts +3 -3
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/components/Table/CreateRefPanel.tsx +2 -2
- package/src/components/Table/DynamicTable.stories.tsx +2 -2
- package/src/components/Table/Table.stories.tsx +7 -7
- package/src/components/Table/relations.stories.tsx +5 -5
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +3 -3
- package/src/components/TableToolbar/TableToolbar.tsx +2 -2
- package/src/components/testing.ts +3 -3
- package/src/hooks/useTableModel.ts +2 -2
- package/src/model/modal-controller.ts +3 -3
- package/src/model/table-model.test.ts +3 -3
- package/src/model/table-model.ts +2 -2
- package/src/model/table-presentation.test.ts +3 -3
- package/src/util/dynamic-table.ts +2 -2
- package/src/util/table.ts +2 -2
|
@@ -152,7 +152,7 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
152
152
|
// packages/ui/react-ui-table/src/components/Table/CreateRefPanel.tsx
|
|
153
153
|
import React3, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
154
154
|
import { S } from "@dxos/echo-schema";
|
|
155
|
-
import {
|
|
155
|
+
import { live } from "@dxos/react-client/echo";
|
|
156
156
|
import { Popover } from "@dxos/react-ui";
|
|
157
157
|
import { Form } from "@dxos/react-ui-form";
|
|
158
158
|
import { useGridContext } from "@dxos/react-ui-grid";
|
|
@@ -183,7 +183,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
|
183
183
|
typename: state.typename
|
|
184
184
|
}).runSync();
|
|
185
185
|
if (schema2) {
|
|
186
|
-
const obj = space.db.add(
|
|
186
|
+
const obj = space.db.add(live(schema2, values));
|
|
187
187
|
state.onCreate?.(obj);
|
|
188
188
|
}
|
|
189
189
|
void modals.close();
|
|
@@ -295,7 +295,7 @@ import { computed as computed3, effect as effect2, signal as signal3 } from "@pr
|
|
|
295
295
|
import { Resource as Resource2 } from "@dxos/context";
|
|
296
296
|
import { FormatEnum as FormatEnum3, getValue as getValue2, setValue } from "@dxos/echo-schema";
|
|
297
297
|
import { invariant } from "@dxos/invariant";
|
|
298
|
-
import {
|
|
298
|
+
import { isLiveObject, makeRef as makeRef3 } from "@dxos/live-object";
|
|
299
299
|
import { formatForEditing, parseValue } from "@dxos/react-ui-form";
|
|
300
300
|
|
|
301
301
|
// packages/ui/react-ui-table/src/model/selection-model.ts
|
|
@@ -303,7 +303,7 @@ import { computed, effect, signal } from "@preact/signals-core";
|
|
|
303
303
|
import { Resource } from "@dxos/context";
|
|
304
304
|
|
|
305
305
|
// packages/ui/react-ui-table/src/util/dynamic-table.ts
|
|
306
|
-
import {
|
|
306
|
+
import { live as live2, makeRef } from "@dxos/live-object";
|
|
307
307
|
import { createView, getSchemaFromPropertyDefinitions, ViewProjection } from "@dxos/schema";
|
|
308
308
|
var getBaseSchems = ({ typename, properties, jsonSchema, schema }) => {
|
|
309
309
|
if (typename && properties) {
|
|
@@ -335,7 +335,7 @@ var makeDynamicTable = ({ typename, jsonSchema, properties }) => {
|
|
|
335
335
|
fields: properties.map((property) => property.name)
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
|
-
const table =
|
|
338
|
+
const table = live2(TableType, {
|
|
339
339
|
name: "dynamic-table",
|
|
340
340
|
view: makeRef(view)
|
|
341
341
|
});
|
|
@@ -384,7 +384,7 @@ var touch = (value) => value;
|
|
|
384
384
|
// packages/ui/react-ui-table/src/util/table.ts
|
|
385
385
|
import { AST, Format, FormatEnum, S as S2, TypedObject, TypeEnum } from "@dxos/echo-schema";
|
|
386
386
|
import { PublicKey } from "@dxos/react-client";
|
|
387
|
-
import {
|
|
387
|
+
import { live as live3, makeRef as makeRef2 } from "@dxos/react-client/echo";
|
|
388
388
|
import { createFieldId, createView as createView2, getSchemaProperties, ViewProjection as ViewProjection2 } from "@dxos/schema";
|
|
389
389
|
var initializeTable = async ({ client, space, table, typename, initialRow = true }) => {
|
|
390
390
|
if (typename) {
|
|
@@ -414,7 +414,7 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
|
|
|
414
414
|
}));
|
|
415
415
|
createProjection(schema, table.view.target);
|
|
416
416
|
if (initialRow) {
|
|
417
|
-
space.db.add(
|
|
417
|
+
space.db.add(live3(schema, {}));
|
|
418
418
|
}
|
|
419
419
|
return schema;
|
|
420
420
|
}
|
|
@@ -992,7 +992,7 @@ var TableModel = class extends Resource2 {
|
|
|
992
992
|
const { props } = this._projection.getFieldProjection(field.id);
|
|
993
993
|
switch (props.format) {
|
|
994
994
|
case FormatEnum3.Ref: {
|
|
995
|
-
if (
|
|
995
|
+
if (isLiveObject(value)) {
|
|
996
996
|
setValue(this._rows.value[rowIdx], field.path, makeRef3(value));
|
|
997
997
|
}
|
|
998
998
|
break;
|
|
@@ -2318,7 +2318,7 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
|
|
|
2318
2318
|
|
|
2319
2319
|
// packages/ui/react-ui-table/src/components/TableToolbar/TableToolbar.tsx
|
|
2320
2320
|
import React9, { useCallback as useCallback6, useMemo as useMemo6 } from "react";
|
|
2321
|
-
import {
|
|
2321
|
+
import { live as live4 } from "@dxos/live-object";
|
|
2322
2322
|
import { createGapSeparator, createMenuAction, MenuProvider, ToolbarMenu, useMenuActions } from "@dxos/react-ui-menu";
|
|
2323
2323
|
var createTableToolbarActions = (state) => {
|
|
2324
2324
|
const add = createMenuAction("add-row", {
|
|
@@ -2372,7 +2372,7 @@ var createTableToolbarActions = (state) => {
|
|
|
2372
2372
|
};
|
|
2373
2373
|
};
|
|
2374
2374
|
var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
|
|
2375
|
-
const state = useMemo6(() =>
|
|
2375
|
+
const state = useMemo6(() => live4({
|
|
2376
2376
|
viewDirty
|
|
2377
2377
|
}), []);
|
|
2378
2378
|
const actionsCreator = useCallback6(() => createTableToolbarActions(state), [
|