@dxos/react-ui-table 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0
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/{chunk-YWNRUF4J.mjs → chunk-PFFO5LYM.mjs} +7 -6
- package/dist/lib/browser/chunk-PFFO5LYM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +290 -105
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-TGG6OZ54.cjs → chunk-VREQOYRW.cjs} +9 -8
- package/dist/lib/node/chunk-VREQOYRW.cjs.map +7 -0
- package/dist/lib/node/index.cjs +263 -81
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-KKLP54L3.mjs → chunk-34JG3SDI.mjs} +7 -6
- package/dist/lib/node-esm/chunk-34JG3SDI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +290 -105
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +3 -4
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +2 -0
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +1 -0
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +13 -0
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -0
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +3 -0
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -2
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +39 -39
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +44 -43
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +4 -3
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/schema.d.ts +12 -0
- package/dist/types/src/util/schema.d.ts.map +1 -0
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +2 -2
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/src/util/tag.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -33
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.stories.tsx +2 -2
- package/src/components/Table/DynamicTable.tsx +4 -5
- package/src/components/Table/Table.stories.tsx +65 -19
- package/src/components/Table/Table.tsx +8 -5
- package/src/components/Table/relations.stories.tsx +16 -18
- package/src/components/TableCellEditor/FormCellEditor.tsx +94 -0
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +8 -7
- package/src/components/TableCellEditor/TableCellEditor.tsx +45 -4
- package/src/components/TableToolbar/TableToolbar.tsx +10 -11
- package/src/components/testing.ts +7 -6
- package/src/model/table-model.test.ts +4 -3
- package/src/model/table-presentation.test.ts +4 -3
- package/src/model/table-presentation.ts +52 -6
- package/src/types/table.ts +15 -7
- package/src/util/dynamic-table.ts +7 -4
- package/src/util/index.ts +1 -0
- package/src/util/schema.ts +36 -0
- package/src/util/table.ts +11 -10
- package/dist/lib/browser/chunk-YWNRUF4J.mjs.map +0 -7
- package/dist/lib/node/chunk-TGG6OZ54.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-KKLP54L3.mjs.map +0 -7
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { Expando } from '@dxos/echo-schema';
|
|
3
|
+
export declare const TableSchema: Schema.Struct<{
|
|
3
4
|
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
4
|
-
name:
|
|
5
|
-
view:
|
|
6
|
-
name:
|
|
7
|
-
query:
|
|
8
|
-
schema:
|
|
9
|
-
fields:
|
|
10
|
-
id: typeof
|
|
11
|
-
path:
|
|
12
|
-
visible:
|
|
13
|
-
size:
|
|
14
|
-
referencePath:
|
|
5
|
+
name: Schema.optional<typeof Schema.String>;
|
|
6
|
+
view: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<{
|
|
7
|
+
name: Schema.SchemaClass<string, string, never>;
|
|
8
|
+
query: Schema.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
9
|
+
schema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
10
|
+
fields: Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
|
|
11
|
+
id: typeof Schema.String;
|
|
12
|
+
path: Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
13
|
+
visible: Schema.optional<typeof Schema.Boolean>;
|
|
14
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
15
|
+
referencePath: Schema.optional<Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
15
16
|
}>>>>;
|
|
16
|
-
hiddenFields:
|
|
17
|
-
id: typeof
|
|
18
|
-
path:
|
|
19
|
-
visible:
|
|
20
|
-
size:
|
|
21
|
-
referencePath:
|
|
17
|
+
hiddenFields: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
|
|
18
|
+
id: typeof Schema.String;
|
|
19
|
+
path: Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
20
|
+
visible: Schema.optional<typeof Schema.Boolean>;
|
|
21
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
22
|
+
referencePath: Schema.optional<Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
22
23
|
}>>>>>;
|
|
23
|
-
metadata:
|
|
24
|
+
metadata: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
24
25
|
}, import("@dxos/echo-schema").TypedObjectOptions>>>;
|
|
25
|
-
threads:
|
|
26
|
+
threads: Schema.optional<Schema.Array$<import("@dxos/echo-schema").Ref$<Expando>>>;
|
|
26
27
|
}>;
|
|
27
|
-
export declare const TableType: import("@dxos/echo-schema").
|
|
28
|
+
export declare const TableType: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
|
|
28
29
|
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
29
|
-
name:
|
|
30
|
-
view:
|
|
31
|
-
name:
|
|
32
|
-
query:
|
|
33
|
-
schema:
|
|
34
|
-
fields:
|
|
35
|
-
id: typeof
|
|
36
|
-
path:
|
|
37
|
-
visible:
|
|
38
|
-
size:
|
|
39
|
-
referencePath:
|
|
30
|
+
name: Schema.optional<typeof Schema.String>;
|
|
31
|
+
view: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<{
|
|
32
|
+
name: Schema.SchemaClass<string, string, never>;
|
|
33
|
+
query: Schema.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
34
|
+
schema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
35
|
+
fields: Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
|
|
36
|
+
id: typeof Schema.String;
|
|
37
|
+
path: Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
38
|
+
visible: Schema.optional<typeof Schema.Boolean>;
|
|
39
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
40
|
+
referencePath: Schema.optional<Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
40
41
|
}>>>>;
|
|
41
|
-
hiddenFields:
|
|
42
|
-
id: typeof
|
|
43
|
-
path:
|
|
44
|
-
visible:
|
|
45
|
-
size:
|
|
46
|
-
referencePath:
|
|
42
|
+
hiddenFields: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
|
|
43
|
+
id: typeof Schema.String;
|
|
44
|
+
path: Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
45
|
+
visible: Schema.optional<typeof Schema.Boolean>;
|
|
46
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
47
|
+
referencePath: Schema.optional<Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
47
48
|
}>>>>>;
|
|
48
|
-
metadata:
|
|
49
|
+
metadata: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
|
|
49
50
|
}, import("@dxos/echo-schema").TypedObjectOptions>>>;
|
|
50
|
-
threads:
|
|
51
|
-
}
|
|
52
|
-
export interface TableType extends
|
|
51
|
+
threads: Schema.optional<Schema.Array$<import("@dxos/echo-schema").Ref$<Expando>>>;
|
|
52
|
+
}>, {}>;
|
|
53
|
+
export interface TableType extends Schema.Schema.Type<typeof TableType> {
|
|
53
54
|
}
|
|
54
55
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAoC,OAAO,EAAc,MAAM,mBAAmB,CAAC;AAG1F,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAC;AAGH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;OAKrB,CAAC;AACF,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Schema } from 'effect';
|
|
2
|
+
import type { JsonSchemaType, SortDirectionType } from '@dxos/echo-schema';
|
|
2
3
|
import { ViewProjection, type SchemaPropertyDefinition } from '@dxos/schema';
|
|
3
4
|
import { TableType } from '../types';
|
|
4
5
|
type PropertyDisplayProps = {
|
|
@@ -10,11 +11,11 @@ export type TablePropertyDefinition = SchemaPropertyDefinition & Partial<Propert
|
|
|
10
11
|
/**
|
|
11
12
|
* @deprecated
|
|
12
13
|
*/
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const getBaseSchema: ({ typename, properties, jsonSchema, schema, }: {
|
|
14
15
|
typename?: string;
|
|
15
16
|
properties?: TablePropertyDefinition[];
|
|
16
17
|
jsonSchema?: JsonSchemaType;
|
|
17
|
-
schema?:
|
|
18
|
+
schema?: Schema.Schema.AnyNoContext;
|
|
18
19
|
}) => {
|
|
19
20
|
typename: string;
|
|
20
21
|
jsonSchema: JsonSchemaType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-table.d.ts","sourceRoot":"","sources":["../../../../src/util/dynamic-table.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dynamic-table.d.ts","sourceRoot":"","sources":["../../../../src/util/dynamic-table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAGL,cAAc,EAEd,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE/F;;GAEG;AAEH,eAAO,MAAM,aAAa,GAAI,+CAK3B;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;CACrC,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,cAAc,CAAA;CAWjD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,uCAI9B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACxC,KAAG;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,cAAc,CAAA;CAkBjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a narrowed schema from an original schema that only includes
|
|
4
|
+
* the specified paths. This allows form components to only display
|
|
5
|
+
* and edit/validate specific fields rather than the entire object.
|
|
6
|
+
*
|
|
7
|
+
* @param schema The original schema to narrow
|
|
8
|
+
* @param paths Array of field paths to extract
|
|
9
|
+
* @returns A narrowed Schema instance containing only the properties at the specified paths
|
|
10
|
+
*/
|
|
11
|
+
export declare const narrowSchema: <S extends Schema.Schema.AnyNoContext>(schema: S, paths: string[]) => Schema.Schema<unknown, unknown> | undefined;
|
|
12
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/util/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAC/D,QAAQ,CAAC,EACT,OAAO,MAAM,EAAE,KACd,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAgBpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../../src/util/signals.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../../src/util/signals.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,OAAO,CAAC,MAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-controls.d.ts","sourceRoot":"","sources":["../../../../src/util/table-controls.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/G,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAE3G,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAwBX,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"table-controls.d.ts","sourceRoot":"","sources":["../../../../src/util/table-controls.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/G,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAE3G,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAwBX,eAAO,MAAM,aAAa,GAAI,0CAK3B,mBAAmB,KAAG,MAQxB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,2CAA2D,iBAAiB,KAAG,MAQ1G,CAAC;AAEF,eAAO,MAAM,aAAa;;;oEApBvB,mBAAmB,KAAG,MAAM;+BAwBb,WAAW,KAAG,OAAO,CAAC,WAAW,EAAE;YAAE,IAAI,EAAE,UAAU,CAAA;SAAE,CAAC;;;;qEAda,iBAAiB,KAAG,MAAM;+BAuB/F,WAAW,KAAG,OAAO,CAAC,WAAW,EAAE;YAAE,IAAI,EAAE,QAAQ,CAAA;SAAE,CAAC;;CAM9D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import { type Client } from '@dxos/react-client';
|
|
3
3
|
import { type Space } from '@dxos/react-client/echo';
|
|
4
4
|
import { type TableType } from '../types';
|
|
@@ -9,6 +9,6 @@ type InitialiseTableProps = {
|
|
|
9
9
|
typename?: string;
|
|
10
10
|
initialRow?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const initializeTable: ({ client, space, table, typename, initialRow, }: InitialiseTableProps) => Promise<
|
|
12
|
+
export declare const initializeTable: ({ client, space, table, typename, initialRow, }: InitialiseTableProps) => Promise<Schema.Schema.AnyNoContext>;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAY3C,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAQ,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,iDAMnC,oBAAoB,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CA0C3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../src/util/tag.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAA6B,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../src/util/tag.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAA6B,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAAM,EAAE,GAAG,SAgBzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.fbd8ed0",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -51,31 +51,32 @@
|
|
|
51
51
|
"@radix-ui/react-slot": "1.1.2",
|
|
52
52
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
53
53
|
"date-fns": "^3.3.1",
|
|
54
|
+
"effect": "3.14.21",
|
|
54
55
|
"lodash.orderby": "^4.6.0",
|
|
55
|
-
"@dxos/debug": "0.8.2-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/invariant": "0.8.2-main.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/keys": "0.8.2-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/live-object": "0.8.2-main.
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/plugin-search": "0.8.2-main.
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/react-ui-attention": "0.8.2-main.
|
|
68
|
-
"@dxos/react-ui-editor": "0.8.2-main.
|
|
69
|
-
"@dxos/react-ui-form": "0.8.2-main.
|
|
70
|
-
"@dxos/react-ui-menu": "0.8.2-main.
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-searchlist": "0.8.2-main.
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/schema": "0.8.2-main.
|
|
78
|
-
"@dxos/util": "0.8.2-main.
|
|
56
|
+
"@dxos/debug": "0.8.2-main.fbd8ed0",
|
|
57
|
+
"@dxos/context": "0.8.2-main.fbd8ed0",
|
|
58
|
+
"@dxos/invariant": "0.8.2-main.fbd8ed0",
|
|
59
|
+
"@dxos/echo-schema": "0.8.2-main.fbd8ed0",
|
|
60
|
+
"@dxos/keys": "0.8.2-main.fbd8ed0",
|
|
61
|
+
"@dxos/effect": "0.8.2-main.fbd8ed0",
|
|
62
|
+
"@dxos/lit-grid": "0.8.2-main.fbd8ed0",
|
|
63
|
+
"@dxos/live-object": "0.8.2-main.fbd8ed0",
|
|
64
|
+
"@dxos/log": "0.8.2-main.fbd8ed0",
|
|
65
|
+
"@dxos/plugin-search": "0.8.2-main.fbd8ed0",
|
|
66
|
+
"@dxos/plugin-space": "0.8.2-main.fbd8ed0",
|
|
67
|
+
"@dxos/react-client": "0.8.2-main.fbd8ed0",
|
|
68
|
+
"@dxos/react-ui-attention": "0.8.2-main.fbd8ed0",
|
|
69
|
+
"@dxos/react-ui-editor": "0.8.2-main.fbd8ed0",
|
|
70
|
+
"@dxos/react-ui-form": "0.8.2-main.fbd8ed0",
|
|
71
|
+
"@dxos/react-ui-menu": "0.8.2-main.fbd8ed0",
|
|
72
|
+
"@dxos/react-ui-grid": "0.8.2-main.fbd8ed0",
|
|
73
|
+
"@dxos/react-ui-searchlist": "0.8.2-main.fbd8ed0",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-main.fbd8ed0",
|
|
75
|
+
"@dxos/react-ui-tag-picker": "0.8.2-main.fbd8ed0",
|
|
76
|
+
"@dxos/react-ui-types": "0.8.2-main.fbd8ed0",
|
|
77
|
+
"@dxos/react-ui-stack": "0.8.2-main.fbd8ed0",
|
|
78
|
+
"@dxos/schema": "0.8.2-main.fbd8ed0",
|
|
79
|
+
"@dxos/util": "0.8.2-main.fbd8ed0"
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
81
82
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -86,19 +87,19 @@
|
|
|
86
87
|
"react": "~18.2.0",
|
|
87
88
|
"react-dom": "~18.2.0",
|
|
88
89
|
"vite": "5.4.7",
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
92
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/
|
|
90
|
+
"@dxos/random": "0.8.2-main.fbd8ed0",
|
|
91
|
+
"@dxos/echo-signals": "0.8.2-main.fbd8ed0",
|
|
92
|
+
"@dxos/react-ui": "0.8.2-main.fbd8ed0",
|
|
93
|
+
"@dxos/react-ui-theme": "0.8.2-main.fbd8ed0",
|
|
94
|
+
"@dxos/test-utils": "0.8.2-main.fbd8ed0",
|
|
95
|
+
"@dxos/storybook-utils": "0.8.2-main.fbd8ed0"
|
|
95
96
|
},
|
|
96
97
|
"peerDependencies": {
|
|
97
98
|
"@phosphor-icons/react": "^2.1.5",
|
|
98
99
|
"react": "~18.2.0",
|
|
99
100
|
"react-dom": "~18.2.0",
|
|
100
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
101
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
101
|
+
"@dxos/react-ui": "0.8.2-main.fbd8ed0",
|
|
102
|
+
"@dxos/react-ui-theme": "0.8.2-main.fbd8ed0"
|
|
102
103
|
},
|
|
103
104
|
"publishConfig": {
|
|
104
105
|
"access": "public"
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { live } from '@dxos/react-client/echo';
|
|
9
9
|
import { Popover } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
@@ -20,14 +20,14 @@ export const CreateRefPanel = ({ model, modals, __gridScope }: GridScopedProps<C
|
|
|
20
20
|
const space = model?.space;
|
|
21
21
|
const state = modals.state.value;
|
|
22
22
|
|
|
23
|
-
const schema = useMemo<
|
|
23
|
+
const schema = useMemo<Schema.Schema<any> | undefined>(() => {
|
|
24
24
|
if (!space || state?.type !== 'createRefPanel') {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const [schema] = space.db.schemaRegistry.query({ typename: state.typename }).runSync();
|
|
29
29
|
if (schema) {
|
|
30
|
-
const omit =
|
|
30
|
+
const omit = Schema.omit<any, any, ['id']>('id');
|
|
31
31
|
return omit(schema);
|
|
32
32
|
}
|
|
33
33
|
}, [space, state]);
|
|
@@ -59,7 +59,7 @@ const meta: Meta = {
|
|
|
59
59
|
title: 'ui/react-ui-table/DynamicTable',
|
|
60
60
|
component: DynamicTable,
|
|
61
61
|
parameters: { translations },
|
|
62
|
-
decorators: [
|
|
62
|
+
decorators: [withLayout({ fullscreen: true }), withTheme],
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export default meta;
|
|
@@ -128,7 +128,7 @@ export const WithEchoSchema: StoryObj = {
|
|
|
128
128
|
const client = useClient();
|
|
129
129
|
const { space } = useClientProvider();
|
|
130
130
|
const schema = useSchema(client, space, Testing.Contact.typename);
|
|
131
|
-
const objects = useQuery(space, schema ? Filter.
|
|
131
|
+
const objects = useQuery(space, schema ? Filter.type(schema) : Filter.nothing());
|
|
132
132
|
if (!schema) {
|
|
133
133
|
return <div>Loading schema...</div>;
|
|
134
134
|
}
|
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Schema } from 'effect';
|
|
5
6
|
import React, { useRef, useMemo, useCallback } from 'react';
|
|
6
7
|
|
|
7
|
-
import { type
|
|
8
|
+
import { type JsonSchemaType } from '@dxos/echo-schema';
|
|
8
9
|
import { type ThemedClassName, useDefaultValue } from '@dxos/react-ui';
|
|
9
10
|
import { mx } from '@dxos/react-ui-theme';
|
|
10
11
|
|
|
11
12
|
import { Table, type TableController } from './Table';
|
|
12
13
|
import { useTableModel } from '../../hooks';
|
|
13
14
|
import { type TableFeatures, TablePresentation, type TableRowAction } from '../../model';
|
|
14
|
-
import {
|
|
15
|
+
import { getBaseSchema, makeDynamicTable, type TablePropertyDefinition } from '../../util';
|
|
15
16
|
|
|
16
17
|
type DynamicTableProps = ThemedClassName<{
|
|
17
18
|
name?: string; // TODO(burdon): Remove?
|
|
18
19
|
rows: any[];
|
|
19
20
|
properties?: TablePropertyDefinition[];
|
|
20
21
|
jsonSchema?: JsonSchemaType;
|
|
21
|
-
schema?:
|
|
22
|
+
schema?: Schema.Schema.AnyNoContext;
|
|
22
23
|
features?: Partial<TableFeatures>;
|
|
23
24
|
rowActions?: TableRowAction[];
|
|
24
25
|
onRowClick?: (row: any) => void;
|
|
@@ -27,8 +28,6 @@ type DynamicTableProps = ThemedClassName<{
|
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Properties define both the schema and display characteristics of the table columns.
|
|
30
|
-
*
|
|
31
|
-
* @deprecated Use Table.
|
|
32
31
|
*/
|
|
33
32
|
// TODO(burdon): Instead of creating component variants, create helpers/hooks that normalize the props.
|
|
34
33
|
// TODO(burdon): Warning: Cannot update a component (`DynamicTable`) while rendering a different component (`DynamicTable`).
|
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
7
|
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import { Schema } from 'effect';
|
|
8
9
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
assertEchoSchema,
|
|
13
|
+
FormatEnum,
|
|
14
|
+
isMutable,
|
|
15
|
+
toJsonSchema,
|
|
16
|
+
EchoObject,
|
|
17
|
+
GeneratorAnnotationId,
|
|
18
|
+
} from '@dxos/echo-schema';
|
|
11
19
|
import { invariant } from '@dxos/invariant';
|
|
12
20
|
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
13
21
|
import { faker } from '@dxos/random';
|
|
@@ -28,8 +36,7 @@ import { TableType } from '../../types';
|
|
|
28
36
|
import { initializeTable } from '../../util';
|
|
29
37
|
import { TableToolbar } from '../TableToolbar';
|
|
30
38
|
|
|
31
|
-
// NOTE(ZaymonFC):
|
|
32
|
-
faker.seed(0);
|
|
39
|
+
faker.seed(0); // NOTE(ZaymonFC): Required for smoke tests.
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* Custom hook to create and manage a test table model for storybook demonstrations.
|
|
@@ -39,14 +46,14 @@ const useTestTableModel = () => {
|
|
|
39
46
|
const client = useClient();
|
|
40
47
|
const { space } = useClientProvider();
|
|
41
48
|
|
|
42
|
-
const filter = useMemo(() => Filter.
|
|
49
|
+
const filter = useMemo(() => Filter.type(TableType), []);
|
|
43
50
|
const tables = useQuery(space, filter);
|
|
44
51
|
const table = useMemo(() => tables.at(0), [tables]);
|
|
45
52
|
const schema = useSchema(client, space, table?.view?.target?.query.typename);
|
|
46
53
|
|
|
47
54
|
const projection = useMemo(() => {
|
|
48
55
|
if (schema && table?.view?.target) {
|
|
49
|
-
return new ViewProjection(schema
|
|
56
|
+
return new ViewProjection(toJsonSchema(schema), table.view.target);
|
|
50
57
|
}
|
|
51
58
|
}, [schema, table?.view?.target]);
|
|
52
59
|
|
|
@@ -54,12 +61,12 @@ const useTestTableModel = () => {
|
|
|
54
61
|
() => ({
|
|
55
62
|
selection: { enabled: true, mode: 'multiple' as const },
|
|
56
63
|
dataEditable: true,
|
|
57
|
-
schemaEditable:
|
|
64
|
+
schemaEditable: schema && isMutable(schema),
|
|
58
65
|
}),
|
|
59
66
|
[schema],
|
|
60
67
|
);
|
|
61
68
|
|
|
62
|
-
const objects = useQuery(space, schema ? Filter.
|
|
69
|
+
const objects = useQuery(space, schema ? Filter.type(schema) : Filter.nothing());
|
|
63
70
|
const filteredObjects = useGlobalFilteredObjects(objects);
|
|
64
71
|
|
|
65
72
|
const tableRef = useRef<TableController>(null);
|
|
@@ -151,11 +158,10 @@ const StoryViewEditor = () => {
|
|
|
151
158
|
|
|
152
159
|
const handleTypenameChanged = useCallback(
|
|
153
160
|
(typename: string) => {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
161
|
+
invariant(schema);
|
|
162
|
+
invariant(table?.view?.target);
|
|
163
|
+
assertEchoSchema(schema).updateTypename(typename);
|
|
164
|
+
table.view.target.query.typename = typename;
|
|
159
165
|
},
|
|
160
166
|
[schema, table?.view?.target],
|
|
161
167
|
);
|
|
@@ -191,7 +197,7 @@ const DefaultStory = () => {
|
|
|
191
197
|
<div className='grid grid-rows-[min-content_1fr] min-bs-0 overflow-hidden'>
|
|
192
198
|
<TableToolbar classNames='border-be border-separator' onAction={handleToolbarAction} />
|
|
193
199
|
<Table.Root>
|
|
194
|
-
<Table.Main ref={tableRef} model={model} presentation={presentation} ignoreAttention />
|
|
200
|
+
<Table.Main ref={tableRef} model={model} presentation={presentation} schema={schema} ignoreAttention />
|
|
195
201
|
</Table.Root>
|
|
196
202
|
</div>
|
|
197
203
|
<div className='flex flex-col h-full border-l border-separator overflow-y-auto'>
|
|
@@ -233,8 +239,8 @@ const meta: Meta<StoryProps> = {
|
|
|
233
239
|
});
|
|
234
240
|
},
|
|
235
241
|
}),
|
|
242
|
+
withLayout({ fullscreen: true }),
|
|
236
243
|
withTheme,
|
|
237
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
238
244
|
],
|
|
239
245
|
};
|
|
240
246
|
|
|
@@ -252,17 +258,57 @@ export const StaticSchema: StoryObj = {
|
|
|
252
258
|
createSpace: true,
|
|
253
259
|
onSpaceCreated: async ({ client, space }) => {
|
|
254
260
|
const table = space.db.add(live(TableType, {}));
|
|
255
|
-
await initializeTable({ client, space, table, typename: Testing.
|
|
261
|
+
await initializeTable({ client, space, table, typename: Testing.Organization.typename });
|
|
262
|
+
|
|
263
|
+
const factory = createObjectFactory(space.db, faker as any);
|
|
264
|
+
await factory([
|
|
265
|
+
// { type: Testing.Contact, count: 10 },
|
|
266
|
+
// { type: Testing.Organization, count: 1 },
|
|
267
|
+
{ type: ContactWithArrayOfEmails, count: 10 },
|
|
268
|
+
]);
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
271
|
+
withLayout({ fullscreen: true }),
|
|
272
|
+
withTheme,
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const ContactWithArrayOfEmails = Schema.Struct({
|
|
277
|
+
name: Schema.String.annotations({
|
|
278
|
+
[GeneratorAnnotationId]: 'person.fullName',
|
|
279
|
+
}),
|
|
280
|
+
emails: Schema.optional(
|
|
281
|
+
Schema.Array(
|
|
282
|
+
Schema.Struct({
|
|
283
|
+
value: Schema.String,
|
|
284
|
+
label: Schema.String.pipe(Schema.optional),
|
|
285
|
+
}),
|
|
286
|
+
),
|
|
287
|
+
),
|
|
288
|
+
}).pipe(EchoObject({ typename: 'dxos.org/type/ContactWithArrayOfEmails', version: '0.1.0' }));
|
|
289
|
+
|
|
290
|
+
export const ArrayOfObjects: StoryObj = {
|
|
291
|
+
render: DefaultStory,
|
|
292
|
+
parameters: { translations },
|
|
293
|
+
decorators: [
|
|
294
|
+
withClientProvider({
|
|
295
|
+
types: [TableType, ViewType, Testing.Contact, Testing.Organization, ContactWithArrayOfEmails],
|
|
296
|
+
createIdentity: true,
|
|
297
|
+
createSpace: true,
|
|
298
|
+
onSpaceCreated: async ({ client, space }) => {
|
|
299
|
+
const table = space.db.add(live(TableType, {}));
|
|
300
|
+
await initializeTable({ client, space, table, typename: ContactWithArrayOfEmails.typename });
|
|
256
301
|
|
|
257
302
|
const factory = createObjectFactory(space.db, faker as any);
|
|
258
303
|
await factory([
|
|
259
|
-
{ type: Testing.Contact, count: 10 },
|
|
260
|
-
{ type: Testing.Organization, count: 1 },
|
|
304
|
+
// { type: Testing.Contact, count: 10 },
|
|
305
|
+
// { type: Testing.Organization, count: 1 },
|
|
306
|
+
{ type: ContactWithArrayOfEmails, count: 10 },
|
|
261
307
|
]);
|
|
262
308
|
},
|
|
263
309
|
}),
|
|
310
|
+
withLayout({ fullscreen: true }),
|
|
264
311
|
withTheme,
|
|
265
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
266
312
|
],
|
|
267
313
|
};
|
|
268
314
|
|
|
@@ -317,7 +363,7 @@ export const Tags: Meta<StoryProps> = {
|
|
|
317
363
|
});
|
|
318
364
|
},
|
|
319
365
|
}),
|
|
366
|
+
withLayout({ fullscreen: true }),
|
|
320
367
|
withTheme,
|
|
321
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
322
368
|
],
|
|
323
369
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Schema } from 'effect/Schema';
|
|
5
6
|
import React, {
|
|
6
7
|
type MouseEvent,
|
|
7
8
|
type PropsWithChildren,
|
|
@@ -40,7 +41,7 @@ import { RowActionsMenu } from './RowActionsMenu';
|
|
|
40
41
|
import { ModalController, type TableModel, type TablePresentation } from '../../model';
|
|
41
42
|
import { translationKey } from '../../translations';
|
|
42
43
|
import { tableButtons, tableControls } from '../../util';
|
|
43
|
-
import { createOption,
|
|
44
|
+
import { createOption, TableValueEditor, type TableCellEditorProps } from '../TableCellEditor';
|
|
44
45
|
|
|
45
46
|
//
|
|
46
47
|
// Table.Root
|
|
@@ -75,13 +76,14 @@ export type TableController = {
|
|
|
75
76
|
export type TableMainProps = {
|
|
76
77
|
model?: TableModel;
|
|
77
78
|
presentation?: TablePresentation;
|
|
79
|
+
schema?: Schema.AnyNoContext;
|
|
78
80
|
// TODO(burdon): Rename since attention isn't a useful concept here? Standardize across other components. Pass property into useAttention.
|
|
79
81
|
ignoreAttention?: boolean;
|
|
80
82
|
onRowClick?: (row: any) => void;
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
const TableMain = forwardRef<TableController, TableMainProps>(
|
|
84
|
-
({ model, presentation, ignoreAttention, onRowClick }, forwardedRef) => {
|
|
86
|
+
({ model, presentation, ignoreAttention, schema, onRowClick }, forwardedRef) => {
|
|
85
87
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
86
88
|
const { hasAttention } = useAttention(model?.id ?? 'table');
|
|
87
89
|
const { t } = useTranslation(translationKey);
|
|
@@ -307,7 +309,7 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
307
309
|
invariant(space);
|
|
308
310
|
const schema = space.db.schemaRegistry.getSchema(props.referenceSchema);
|
|
309
311
|
if (schema) {
|
|
310
|
-
const { objects } = await space.db.query(Filter.
|
|
312
|
+
const { objects } = await space.db.query(Filter.type(schema)).run();
|
|
311
313
|
const options = objects
|
|
312
314
|
.map((obj) => {
|
|
313
315
|
const value = getValue(obj, field.referencePath!);
|
|
@@ -343,15 +345,16 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
343
345
|
|
|
344
346
|
return (
|
|
345
347
|
<Grid.Root id={model.id ?? 'table-grid'}>
|
|
346
|
-
<
|
|
348
|
+
<TableValueEditor
|
|
347
349
|
model={model}
|
|
348
350
|
modals={modals}
|
|
351
|
+
schema={schema}
|
|
349
352
|
onEnter={handleEnter}
|
|
350
353
|
onFocus={handleFocus}
|
|
351
354
|
onQuery={handleQuery}
|
|
352
355
|
/>
|
|
353
356
|
<Grid.Content
|
|
354
|
-
className={mx('[--dx-grid-base:var(--
|
|
357
|
+
className={mx('[--dx-grid-base:var(--baseSurface)]', gridSeparatorInlineEnd, gridSeparatorBlockEnd)}
|
|
355
358
|
frozen={frozen}
|
|
356
359
|
// getCells={getCells}
|
|
357
360
|
columns={model.columnMeta.value}
|