@dxos/react-ui-table 0.8.2-main.12df754 → 0.8.2-main.30e4dbb
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-UGGYKLOH.mjs +28 -0
- package/dist/lib/browser/chunk-UGGYKLOH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +89 -124
- 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-2QLLIPZK.cjs} +13 -11
- package/dist/lib/node/chunk-2QLLIPZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +149 -184
- 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-N2RRVR7F.mjs} +11 -9
- package/dist/lib/node-esm/chunk-N2RRVR7F.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +89 -124
- 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 +0 -2
- 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.map +1 -1
- 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/TableCellEditor.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 +43 -43
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/table-buttons.d.ts +0 -14
- package/dist/types/src/util/table-buttons.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 +11 -0
- package/dist/types/src/util/tag.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -33
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.stories.tsx +1 -1
- package/src/components/Table/DynamicTable.tsx +0 -2
- package/src/components/Table/Table.stories.tsx +6 -7
- package/src/components/Table/Table.tsx +18 -24
- package/src/components/Table/relations.stories.tsx +34 -24
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +1 -1
- 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-model.ts +17 -0
- package/src/model/table-presentation.test.ts +4 -3
- package/src/model/table-presentation.ts +3 -5
- package/src/types/table.ts +16 -8
- package/src/util/table-buttons.ts +0 -23
- package/src/util/table.ts +8 -12
- package/src/util/tag.ts +33 -0
- package/dist/lib/browser/chunk-YWNRUF4J.mjs +0 -26
- 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
- package/dist/types/src/components/Table/RefPanel.d.ts +0 -9
- package/dist/types/src/components/Table/RefPanel.d.ts.map +0 -1
- package/src/components/Table/RefPanel.tsx +0 -52
|
@@ -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"}
|
|
@@ -8,10 +8,6 @@ type ButtonData = {
|
|
|
8
8
|
} | {
|
|
9
9
|
type: 'newColumn';
|
|
10
10
|
disabled?: boolean;
|
|
11
|
-
} | {
|
|
12
|
-
type: 'referencedCell';
|
|
13
|
-
schemaId: string;
|
|
14
|
-
targetId: string;
|
|
15
11
|
} | {
|
|
16
12
|
type: 'rowMenu';
|
|
17
13
|
rowIndex: number;
|
|
@@ -41,16 +37,6 @@ export declare const tableButtons: {
|
|
|
41
37
|
type: "columnSettings";
|
|
42
38
|
}>;
|
|
43
39
|
};
|
|
44
|
-
readonly referencedCell: {
|
|
45
|
-
readonly attr: string;
|
|
46
|
-
readonly icon: "ph--link-simple-horizontal--regular";
|
|
47
|
-
readonly render: ({ targetId, schemaId }: Omit<Extract<ButtonData, {
|
|
48
|
-
type: "referencedCell";
|
|
49
|
-
}>, "type">) => string;
|
|
50
|
-
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
51
|
-
type: "referencedCell";
|
|
52
|
-
}>;
|
|
53
|
-
};
|
|
54
40
|
readonly rowMenu: {
|
|
55
41
|
readonly attr: string;
|
|
56
42
|
readonly icon: "ph--dots-three--regular";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEjG,eAAO,MAAM,kBAAkB,EAAE;KAAG,CAAC,IAAI,WAAW,GAAG,MAAM;CAMnD,CAAC;AAEX,KAAK,UAAU,GACX;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEjG,eAAO,MAAM,kBAAkB,EAAE;KAAG,CAAC,IAAI,WAAW,GAAG,MAAM;CAMnD,CAAC;AAEX,KAAK,UAAU,GACX;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAC;AAsGlE,eAAO,MAAM,YAAY;;;;wCA1EA,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;gCAShE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC;;;;;uCAMjD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BAUrE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC;;;;;wCASpD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,SAAS,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BAU/D,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,SAAS,CAAA;SAAE,CAAC;;;;;kDASnC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BActE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;;CAYzD,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;AAW3C,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGpE,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex pattern for matching tags in the format [Label](id)
|
|
3
|
+
*/
|
|
4
|
+
export declare const TAG_PATTERN_REGEX: RegExp;
|
|
5
|
+
/**
|
|
6
|
+
* Extracts tag IDs from a string in the format [Label](id)
|
|
7
|
+
* @param value The string to extract IDs from
|
|
8
|
+
* @returns Array of extracted IDs or undefined if no matches or value is not a string
|
|
9
|
+
*/
|
|
10
|
+
export declare const extractTagIds: (value: unknown) => string[] | undefined;
|
|
11
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +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,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.30e4dbb",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -51,31 +51,33 @@
|
|
|
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/context": "0.8.2-main.
|
|
56
|
-
"@dxos/debug": "0.8.2-main.
|
|
57
|
-
"@dxos/echo
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/log": "0.8.2-main.
|
|
65
|
-
"@dxos/plugin-
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/react-
|
|
68
|
-
"@dxos/react-ui-attention": "0.8.2-main.
|
|
69
|
-
"@dxos/react-ui-
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-searchlist": "0.8.2-main.
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/schema": "0.8.2-main.
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
56
|
+
"@dxos/context": "0.8.2-main.30e4dbb",
|
|
57
|
+
"@dxos/debug": "0.8.2-main.30e4dbb",
|
|
58
|
+
"@dxos/echo": "0.8.2-main.30e4dbb",
|
|
59
|
+
"@dxos/effect": "0.8.2-main.30e4dbb",
|
|
60
|
+
"@dxos/echo-schema": "0.8.2-main.30e4dbb",
|
|
61
|
+
"@dxos/invariant": "0.8.2-main.30e4dbb",
|
|
62
|
+
"@dxos/keys": "0.8.2-main.30e4dbb",
|
|
63
|
+
"@dxos/lit-grid": "0.8.2-main.30e4dbb",
|
|
64
|
+
"@dxos/live-object": "0.8.2-main.30e4dbb",
|
|
65
|
+
"@dxos/log": "0.8.2-main.30e4dbb",
|
|
66
|
+
"@dxos/plugin-search": "0.8.2-main.30e4dbb",
|
|
67
|
+
"@dxos/plugin-space": "0.8.2-main.30e4dbb",
|
|
68
|
+
"@dxos/react-client": "0.8.2-main.30e4dbb",
|
|
69
|
+
"@dxos/react-ui-attention": "0.8.2-main.30e4dbb",
|
|
70
|
+
"@dxos/react-ui-editor": "0.8.2-main.30e4dbb",
|
|
71
|
+
"@dxos/react-ui-grid": "0.8.2-main.30e4dbb",
|
|
72
|
+
"@dxos/react-ui-menu": "0.8.2-main.30e4dbb",
|
|
73
|
+
"@dxos/react-ui-form": "0.8.2-main.30e4dbb",
|
|
74
|
+
"@dxos/react-ui-searchlist": "0.8.2-main.30e4dbb",
|
|
75
|
+
"@dxos/react-ui-stack": "0.8.2-main.30e4dbb",
|
|
76
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-main.30e4dbb",
|
|
77
|
+
"@dxos/schema": "0.8.2-main.30e4dbb",
|
|
78
|
+
"@dxos/util": "0.8.2-main.30e4dbb",
|
|
79
|
+
"@dxos/react-ui-types": "0.8.2-main.30e4dbb",
|
|
80
|
+
"@dxos/react-ui-tag-picker": "0.8.2-main.30e4dbb"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
81
83
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -86,19 +88,19 @@
|
|
|
86
88
|
"react": "~18.2.0",
|
|
87
89
|
"react-dom": "~18.2.0",
|
|
88
90
|
"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/storybook-utils": "0.8.2-main.
|
|
94
|
-
"@dxos/test-utils": "0.8.2-main.
|
|
91
|
+
"@dxos/echo-signals": "0.8.2-main.30e4dbb",
|
|
92
|
+
"@dxos/random": "0.8.2-main.30e4dbb",
|
|
93
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
94
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb",
|
|
95
|
+
"@dxos/storybook-utils": "0.8.2-main.30e4dbb",
|
|
96
|
+
"@dxos/test-utils": "0.8.2-main.30e4dbb"
|
|
95
97
|
},
|
|
96
98
|
"peerDependencies": {
|
|
97
99
|
"@phosphor-icons/react": "^2.1.5",
|
|
98
100
|
"react": "~18.2.0",
|
|
99
101
|
"react-dom": "~18.2.0",
|
|
100
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
101
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
102
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
103
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb"
|
|
102
104
|
},
|
|
103
105
|
"publishConfig": {
|
|
104
106
|
"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;
|
|
@@ -27,8 +27,6 @@ type DynamicTableProps = ThemedClassName<{
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Properties define both the schema and display characteristics of the table columns.
|
|
30
|
-
*
|
|
31
|
-
* @deprecated Use Table.
|
|
32
30
|
*/
|
|
33
31
|
// TODO(burdon): Instead of creating component variants, create helpers/hooks that normalize the props.
|
|
34
32
|
// TODO(burdon): Warning: Cannot update a component (`DynamicTable`) while rendering a different component (`DynamicTable`).
|
|
@@ -28,8 +28,7 @@ import { TableType } from '../../types';
|
|
|
28
28
|
import { initializeTable } from '../../util';
|
|
29
29
|
import { TableToolbar } from '../TableToolbar';
|
|
30
30
|
|
|
31
|
-
// NOTE(ZaymonFC):
|
|
32
|
-
faker.seed(0);
|
|
31
|
+
faker.seed(0); // NOTE(ZaymonFC): Required for smoke tests.
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Custom hook to create and manage a test table model for storybook demonstrations.
|
|
@@ -233,8 +232,8 @@ const meta: Meta<StoryProps> = {
|
|
|
233
232
|
});
|
|
234
233
|
},
|
|
235
234
|
}),
|
|
235
|
+
withLayout({ fullscreen: true }),
|
|
236
236
|
withTheme,
|
|
237
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
238
237
|
],
|
|
239
238
|
};
|
|
240
239
|
|
|
@@ -247,7 +246,7 @@ export const StaticSchema: StoryObj = {
|
|
|
247
246
|
parameters: { translations },
|
|
248
247
|
decorators: [
|
|
249
248
|
withClientProvider({
|
|
250
|
-
types: [TableType, ViewType, Testing.Contact, Testing.
|
|
249
|
+
types: [TableType, ViewType, Testing.Contact, Testing.Organization],
|
|
251
250
|
createIdentity: true,
|
|
252
251
|
createSpace: true,
|
|
253
252
|
onSpaceCreated: async ({ client, space }) => {
|
|
@@ -257,12 +256,12 @@ export const StaticSchema: StoryObj = {
|
|
|
257
256
|
const factory = createObjectFactory(space.db, faker as any);
|
|
258
257
|
await factory([
|
|
259
258
|
{ type: Testing.Contact, count: 10 },
|
|
260
|
-
{ type: Testing.
|
|
259
|
+
{ type: Testing.Organization, count: 1 },
|
|
261
260
|
]);
|
|
262
261
|
},
|
|
263
262
|
}),
|
|
263
|
+
withLayout({ fullscreen: true }),
|
|
264
264
|
withTheme,
|
|
265
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
266
265
|
],
|
|
267
266
|
};
|
|
268
267
|
|
|
@@ -317,7 +316,7 @@ export const Tags: Meta<StoryProps> = {
|
|
|
317
316
|
});
|
|
318
317
|
},
|
|
319
318
|
}),
|
|
319
|
+
withLayout({ fullscreen: true }),
|
|
320
320
|
withTheme,
|
|
321
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
322
321
|
],
|
|
323
322
|
};
|
|
@@ -19,27 +19,29 @@ import { invariant } from '@dxos/invariant';
|
|
|
19
19
|
import { Filter } from '@dxos/react-client/echo';
|
|
20
20
|
import { useTranslation } from '@dxos/react-ui';
|
|
21
21
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
closestCell,
|
|
24
|
+
type DxGridElement,
|
|
25
|
+
type DxGridPosition,
|
|
26
|
+
type GridContentProps,
|
|
27
|
+
Grid,
|
|
28
|
+
type DxGridPlane,
|
|
29
|
+
type DxGridPlaneRange,
|
|
30
|
+
gridSeparatorInlineEnd,
|
|
31
|
+
gridSeparatorBlockEnd,
|
|
32
|
+
} from '@dxos/react-ui-grid';
|
|
23
33
|
import { mx } from '@dxos/react-ui-theme';
|
|
24
34
|
import { isNotFalsy, safeParseInt } from '@dxos/util';
|
|
25
35
|
|
|
26
36
|
import { ColumnActionsMenu } from './ColumnActionsMenu';
|
|
27
37
|
import { ColumnSettings } from './ColumnSettings';
|
|
28
38
|
import { CreateRefPanel } from './CreateRefPanel';
|
|
29
|
-
import { RefPanel } from './RefPanel';
|
|
30
39
|
import { RowActionsMenu } from './RowActionsMenu';
|
|
31
40
|
import { ModalController, type TableModel, type TablePresentation } from '../../model';
|
|
32
41
|
import { translationKey } from '../../translations';
|
|
33
42
|
import { tableButtons, tableControls } from '../../util';
|
|
34
43
|
import { createOption, TableCellEditor, type TableCellEditorProps } from '../TableCellEditor';
|
|
35
44
|
|
|
36
|
-
// NOTE(Zan): These fragments add border to inline-end and block-end of the grid using pseudo-elements.
|
|
37
|
-
// These are offset by 1px to avoid double borders in planks.
|
|
38
|
-
const inlineEndLine =
|
|
39
|
-
'[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-block-0 [&>.dx-grid]:after:-inline-end-px [&>.dx-grid]:after:is-px [&>.dx-grid]:after:bg-separator';
|
|
40
|
-
const blockEndLine =
|
|
41
|
-
'[&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-inline-0 [&>.dx-grid]:before:-block-end-px [&>.dx-grid]:before:bs-px [&>.dx-grid]:before:bg-separator';
|
|
42
|
-
|
|
43
45
|
//
|
|
44
46
|
// Table.Root
|
|
45
47
|
//
|
|
@@ -98,20 +100,17 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
98
100
|
};
|
|
99
101
|
}, [model]);
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// );
|
|
103
|
+
const getCells = useCallback<NonNullable<GridContentProps['getCells']>>(
|
|
104
|
+
(range: DxGridPlaneRange, plane: DxGridPlane) => presentation?.getCells(range, plane) ?? {},
|
|
105
|
+
[presentation],
|
|
106
|
+
);
|
|
106
107
|
|
|
107
108
|
useEffect(() => {
|
|
108
109
|
if (!presentation || !dxGrid) {
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
dxGrid.getCells = (range, plane) => presentation.getCells(range, plane);
|
|
114
|
-
}, [presentation, dxGrid]);
|
|
112
|
+
dxGrid.getCells = getCells;
|
|
113
|
+
}, [presentation, dxGrid, getCells]);
|
|
115
114
|
|
|
116
115
|
/**
|
|
117
116
|
* Provides an external controller that can be called to repaint the table.
|
|
@@ -181,10 +180,6 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
181
180
|
modals.showColumnCreator();
|
|
182
181
|
break;
|
|
183
182
|
}
|
|
184
|
-
case 'referencedCell': {
|
|
185
|
-
modals.showReferencePanel(data.targetId, data.schemaId);
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
183
|
case 'sort': {
|
|
189
184
|
model?.sorting?.toggleSort(data.fieldId);
|
|
190
185
|
break;
|
|
@@ -356,7 +351,7 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
356
351
|
onQuery={handleQuery}
|
|
357
352
|
/>
|
|
358
353
|
<Grid.Content
|
|
359
|
-
className={mx('[--dx-grid-base:var(--surface-bg)]',
|
|
354
|
+
className={mx('[--dx-grid-base:var(--surface-bg)]', gridSeparatorInlineEnd, gridSeparatorBlockEnd)}
|
|
360
355
|
frozen={frozen}
|
|
361
356
|
// getCells={getCells}
|
|
362
357
|
columns={model.columnMeta.value}
|
|
@@ -373,7 +368,6 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
373
368
|
<ColumnActionsMenu model={model} modals={modals} />
|
|
374
369
|
<ColumnSettings model={model} modals={modals} onNewColumn={handleNewColumn} />
|
|
375
370
|
<CreateRefPanel model={model} modals={modals} />
|
|
376
|
-
<RefPanel model={model} modals={modals} />
|
|
377
371
|
</Grid.Root>
|
|
378
372
|
);
|
|
379
373
|
},
|
|
@@ -5,20 +5,21 @@
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
7
|
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import { SchemaAST } from 'effect';
|
|
8
9
|
import React, { useEffect, useMemo } from 'react';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
+
import { type BaseObject, ImmutableSchema, type BaseSchema, type HasId } from '@dxos/echo-schema';
|
|
11
12
|
import { getAnnotation } from '@dxos/effect';
|
|
12
13
|
import { faker } from '@dxos/random';
|
|
13
|
-
import { live, makeRef
|
|
14
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import { createView, ViewProjection, ViewType } from '@dxos/schema';
|
|
16
|
-
import {
|
|
14
|
+
import { live, makeRef } from '@dxos/react-client/echo';
|
|
15
|
+
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
+
import { DataType, createView, ViewProjection, ViewType } from '@dxos/schema';
|
|
17
|
+
import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
|
|
17
18
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
18
19
|
|
|
19
20
|
import { Table } from './Table';
|
|
20
21
|
import { useTableModel } from '../../hooks';
|
|
21
|
-
import { TablePresentation, type TableRow } from '../../model';
|
|
22
|
+
import { type TableFeatures, TablePresentation, type TableRow } from '../../model';
|
|
22
23
|
import translations from '../../translations';
|
|
23
24
|
import { TableType } from '../../types';
|
|
24
25
|
|
|
@@ -30,10 +31,12 @@ const generator: ValueGenerator = faker as any;
|
|
|
30
31
|
// TODO(burdon): Reconcile schemas types and utils (see API PR).
|
|
31
32
|
// TODO(burdon): Base type for T (with id); see ECHO API PR?
|
|
32
33
|
const useTestModel = <T extends BaseObject & HasId>(schema: BaseSchema<T>, count: number) => {
|
|
34
|
+
const { space } = useClientProvider();
|
|
35
|
+
|
|
33
36
|
const table = useMemo(() => {
|
|
34
|
-
// const { typename } = pipe(schema.ast,
|
|
37
|
+
// const { typename } = pipe(schema.ast, SchemaAST.getAnnotation<TypeAnnotation>(TypeAnnotationId), Option.getOrThrow);
|
|
35
38
|
const typename = schema.typename;
|
|
36
|
-
const name = getAnnotation<string>(
|
|
39
|
+
const name = getAnnotation<string>(SchemaAST.TitleAnnotationId)(schema.ast) ?? typename;
|
|
37
40
|
const view = createView({ name, typename, jsonSchema: schema.jsonSchema });
|
|
38
41
|
return live(TableType, { view: makeRef(view) });
|
|
39
42
|
}, [schema]);
|
|
@@ -47,16 +50,24 @@ const useTestModel = <T extends BaseObject & HasId>(schema: BaseSchema<T>, count
|
|
|
47
50
|
return new ViewProjection(schema.jsonSchema, table.view.target);
|
|
48
51
|
}, [schema, table]);
|
|
49
52
|
|
|
50
|
-
const
|
|
53
|
+
const features = useMemo<TableFeatures>(
|
|
54
|
+
() => ({ schemaEditable: false, dataEditable: true, selection: { enabled: false } }),
|
|
55
|
+
[],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const model = useTableModel<TableRow>({ table, projection, rows: [], features });
|
|
51
59
|
useEffect(() => {
|
|
52
|
-
if (!model) {
|
|
60
|
+
if (!model || !space) {
|
|
53
61
|
return;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
const objectGenerator =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
const objectGenerator = createAsyncGenerator(generator, schema, { optional: true, db: space?.db });
|
|
65
|
+
void objectGenerator.createObjects(count).then((objects) => {
|
|
66
|
+
model.setRows(objects);
|
|
67
|
+
});
|
|
68
|
+
}, [model, space]);
|
|
69
|
+
|
|
70
|
+
console.log(projection?.getFieldProjections());
|
|
60
71
|
|
|
61
72
|
const presentation = useMemo(() => {
|
|
62
73
|
if (!model) {
|
|
@@ -71,21 +82,20 @@ const useTestModel = <T extends BaseObject & HasId>(schema: BaseSchema<T>, count
|
|
|
71
82
|
|
|
72
83
|
const DefaultStory = () => {
|
|
73
84
|
// TODO(burdon): Remove need for ImmutableSchema wrapper at API-level.
|
|
74
|
-
const orgSchema = useMemo(() => new ImmutableSchema(
|
|
75
|
-
const { model: orgModel, presentation: orgPresentation } = useTestModel<
|
|
85
|
+
const orgSchema = useMemo(() => new ImmutableSchema(DataType.Organization), []);
|
|
86
|
+
const { model: orgModel, presentation: orgPresentation } = useTestModel<DataType.Organization>(orgSchema, 50);
|
|
76
87
|
|
|
77
88
|
// TODO(burdon): Generate links with references.
|
|
78
|
-
const contactSchema = useMemo(() => new ImmutableSchema(
|
|
79
|
-
const { model: contactModel, presentation: contactPresentation } = useTestModel<
|
|
89
|
+
const contactSchema = useMemo(() => new ImmutableSchema(DataType.Person), []);
|
|
90
|
+
const { model: contactModel, presentation: contactPresentation } = useTestModel<DataType.Person>(contactSchema, 50);
|
|
80
91
|
|
|
81
|
-
// TODO(burdon): Scrolling isn't working.
|
|
82
92
|
return (
|
|
83
|
-
<div className='
|
|
93
|
+
<div className='is-full bs-full grid grid-cols-2 divide-x divide-separator'>
|
|
84
94
|
<Table.Root>
|
|
85
|
-
<Table.Main model={orgModel} presentation={orgPresentation} />
|
|
95
|
+
<Table.Main model={orgModel} presentation={orgPresentation} ignoreAttention />
|
|
86
96
|
</Table.Root>
|
|
87
97
|
<Table.Root>
|
|
88
|
-
<Table.Main model={contactModel} presentation={contactPresentation} />
|
|
98
|
+
<Table.Main model={contactModel} presentation={contactPresentation} ignoreAttention />
|
|
89
99
|
</Table.Root>
|
|
90
100
|
</div>
|
|
91
101
|
);
|
|
@@ -97,12 +107,12 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
97
107
|
parameters: { translations },
|
|
98
108
|
decorators: [
|
|
99
109
|
withClientProvider({
|
|
100
|
-
types: [TableType, ViewType,
|
|
110
|
+
types: [TableType, ViewType, DataType.Organization, DataType.Person],
|
|
101
111
|
createIdentity: true,
|
|
102
112
|
createSpace: true,
|
|
103
113
|
}),
|
|
104
114
|
withTheme,
|
|
105
|
-
withLayout({ fullscreen: true
|
|
115
|
+
withLayout({ fullscreen: true }),
|
|
106
116
|
],
|
|
107
117
|
};
|
|
108
118
|
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
createGapSeparator,
|
|
11
11
|
createMenuAction,
|
|
12
12
|
type MenuAction,
|
|
13
|
-
type MenuActionHandler,
|
|
14
13
|
MenuProvider,
|
|
15
14
|
ToolbarMenu,
|
|
16
15
|
useMenuActions,
|
|
@@ -27,18 +26,18 @@ export type TableToolbarActionType = 'add-row' | 'comment' | 'save-view';
|
|
|
27
26
|
type TableToolbarState = Partial<{ viewDirty: boolean }>;
|
|
28
27
|
|
|
29
28
|
export type TableToolbarProps = ThemedClassName<
|
|
30
|
-
TableToolbarState & { onAction
|
|
29
|
+
TableToolbarState & { onAction: (action: TableToolbarAction) => void; attendableId?: string }
|
|
31
30
|
>;
|
|
32
31
|
|
|
33
|
-
const createTableToolbarActions = (state: TableToolbarState) => {
|
|
34
|
-
const add = createMenuAction<TableToolbarActionProperties>('add-row', {
|
|
35
|
-
type: 'add-row',
|
|
32
|
+
const createTableToolbarActions = (state: TableToolbarState, onAction: (action: TableToolbarAction) => void) => {
|
|
33
|
+
const add = createMenuAction<TableToolbarActionProperties>('add-row', () => onAction(add), {
|
|
34
|
+
type: 'add-row' as const,
|
|
36
35
|
icon: 'ph--plus--regular',
|
|
37
36
|
label: ['add row', { ns: translationKey }],
|
|
38
37
|
testId: 'table.toolbar.add-row',
|
|
39
38
|
});
|
|
40
|
-
const save = createMenuAction<TableToolbarActionProperties>('save-view', {
|
|
41
|
-
type: 'save-view',
|
|
39
|
+
const save = createMenuAction<TableToolbarActionProperties>('save-view', () => onAction(save), {
|
|
40
|
+
type: 'save-view' as const,
|
|
42
41
|
icon: 'ph--floppy-disk--regular',
|
|
43
42
|
label: ['save view label', { ns: translationKey }],
|
|
44
43
|
testId: 'table.toolbar.save-view',
|
|
@@ -46,8 +45,8 @@ const createTableToolbarActions = (state: TableToolbarState) => {
|
|
|
46
45
|
hidden: !state.viewDirty,
|
|
47
46
|
});
|
|
48
47
|
const gap = createGapSeparator();
|
|
49
|
-
const comment = createMenuAction('comment', {
|
|
50
|
-
type: 'comment',
|
|
48
|
+
const comment = createMenuAction('comment', () => onAction(comment), {
|
|
49
|
+
type: 'comment' as const,
|
|
51
50
|
icon: 'ph--chat-text--regular',
|
|
52
51
|
label: ['create comment', { ns: translationKey }],
|
|
53
52
|
testId: 'table.toolbar.comment',
|
|
@@ -61,11 +60,11 @@ const createTableToolbarActions = (state: TableToolbarState) => {
|
|
|
61
60
|
|
|
62
61
|
export const TableToolbar = ({ classNames, viewDirty, attendableId, onAction }: TableToolbarProps) => {
|
|
63
62
|
const state = useMemo(() => live<TableToolbarState>({ viewDirty }), []);
|
|
64
|
-
const actionsCreator = useCallback(() => createTableToolbarActions(state), [state]);
|
|
63
|
+
const actionsCreator = useCallback(() => createTableToolbarActions(state, onAction), [state, onAction]);
|
|
65
64
|
const menu = useMenuActions(actionsCreator);
|
|
66
65
|
|
|
67
66
|
return (
|
|
68
|
-
<MenuProvider {...menu} attendableId={attendableId}
|
|
67
|
+
<MenuProvider {...menu} attendableId={attendableId}>
|
|
69
68
|
<ToolbarMenu classNames={classNames} />
|
|
70
69
|
</MenuProvider>
|
|
71
70
|
);
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import { useEffect } from 'react';
|
|
6
7
|
|
|
7
|
-
import { setValue, toJsonSchema,
|
|
8
|
+
import { setValue, toJsonSchema, TypeEnum, TypedObject, FormatEnum, ObjectId } from '@dxos/echo-schema';
|
|
8
9
|
import { faker } from '@dxos/random';
|
|
9
10
|
import { live, makeRef } from '@dxos/react-client/echo';
|
|
10
11
|
import { createView, type ViewProjection } from '@dxos/schema';
|
|
@@ -12,11 +13,11 @@ import { createView, type ViewProjection } from '@dxos/schema';
|
|
|
12
13
|
import { TableType } from '../types';
|
|
13
14
|
|
|
14
15
|
export const TestSchema = TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
|
|
15
|
-
id:
|
|
16
|
-
name:
|
|
17
|
-
age:
|
|
18
|
-
active:
|
|
19
|
-
netWorth:
|
|
16
|
+
id: ObjectId,
|
|
17
|
+
name: Schema.optional(Schema.String),
|
|
18
|
+
age: Schema.optional(Schema.Number),
|
|
19
|
+
active: Schema.optional(Schema.Boolean),
|
|
20
|
+
netWorth: Schema.optional(Schema.Number),
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
export const createTable = (schema = TestSchema) => {
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { computed } from '@preact/signals-core';
|
|
6
|
+
import { Schema } from 'effect';
|
|
6
7
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { TypedObject } from '@dxos/echo-schema';
|
|
9
10
|
import { updateCounter } from '@dxos/echo-schema/testing';
|
|
10
11
|
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
11
12
|
import { createEchoSchema } from '@dxos/live-object/testing';
|
|
@@ -99,8 +100,8 @@ describe('TableModel', () => {
|
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
|
|
102
|
-
title:
|
|
103
|
-
completed:
|
|
103
|
+
title: Schema.String,
|
|
104
|
+
completed: Schema.Boolean,
|
|
104
105
|
}) {}
|
|
105
106
|
|
|
106
107
|
const createTableModel = (props: Partial<TableModelProps> = {}): TableModel => {
|