@dxos/react-ui-table 0.8.0 → 0.8.1-main.81238a8
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-3FR6NHPD.mjs → chunk-5MKYB7NF.mjs} +5 -7
- package/dist/lib/browser/chunk-5MKYB7NF.mjs.map +7 -0
- package/dist/lib/browser/{_deprecated → deprecated}/index.mjs +26 -26
- package/dist/lib/{node-esm/_deprecated → browser/deprecated}/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +289 -123
- 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-NB3SFHGA.cjs → chunk-NRFKBRPV.cjs} +7 -9
- package/dist/lib/node/chunk-NRFKBRPV.cjs.map +7 -0
- package/dist/lib/node/{_deprecated → deprecated}/index.cjs +5 -5
- package/dist/lib/node/{_deprecated → deprecated}/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +282 -120
- 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-RLVVOZW5.mjs → chunk-SU4D55KI.mjs} +5 -7
- package/dist/lib/node-esm/chunk-SU4D55KI.mjs.map +7 -0
- package/dist/lib/node-esm/{_deprecated → deprecated}/index.mjs +26 -26
- package/dist/lib/node-esm/deprecated/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +289 -123
- 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 +2 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts +2 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts +2 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +19 -0
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -0
- package/dist/types/src/components/Table/RefPanel.d.ts +2 -1
- package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts +2 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +6 -1
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +2 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/index.d.ts +1 -0
- package/dist/types/src/components/Table/index.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +2 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +14 -7
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/{_deprecated → deprecated}/components/Cell/Cell.d.ts +2 -2
- package/dist/types/src/deprecated/components/Cell/Cell.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Cell/CellCombobox.d.ts +2 -1
- package/dist/types/src/deprecated/components/Cell/CellCombobox.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Cell/index.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.d.ts +3 -2
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.stories.d.ts +3 -2
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.d.ts +2 -1
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.stories.d.ts +3 -2
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/index.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Table/Table.d.ts +5 -5
- package/dist/types/src/deprecated/components/Table/Table.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Table/Table.stories.d.ts +8 -7
- package/dist/types/src/deprecated/components/Table/Table.stories.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Table/TableBody.d.ts +2 -1
- package/dist/types/src/deprecated/components/Table/TableBody.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Table/TableContext.d.ts +1 -1
- package/dist/types/src/deprecated/components/Table/TableContext.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/components/Table/TableHead.d.ts +2 -1
- package/dist/types/src/deprecated/components/Table/TableHead.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/TableRootContext.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/props.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/helpers.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useColumnSizing.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useColumnSorting.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/usePinLastRow.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useRowSelection.d.ts.map +1 -0
- package/dist/types/src/deprecated/index.d.ts.map +1 -0
- package/dist/types/src/{_deprecated → deprecated}/schema/Schema.stories.d.ts +2 -1
- package/dist/types/src/deprecated/schema/Schema.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/column-utils.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/types.d.ts.map +1 -0
- package/dist/types/src/deprecated/theme.d.ts.map +1 -0
- package/dist/types/src/deprecated/translations.d.ts.map +1 -0
- package/dist/types/src/deprecated/types.d.ts.map +1 -0
- package/dist/types/src/hooks/useTableModel.d.ts +5 -2
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +26 -7
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-sorting.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +16 -21
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +40 -0
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/components/Table/ColumnSettings.tsx +5 -6
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.tsx +86 -0
- package/src/components/Table/RefPanel.tsx +3 -3
- package/src/components/Table/RowActionsMenu.tsx +13 -0
- package/src/components/Table/Table.stories.tsx +27 -2
- package/src/components/Table/Table.tsx +29 -10
- package/src/components/Table/index.ts +1 -0
- package/src/components/testing.ts +1 -0
- package/src/{_deprecated → deprecated}/components/Cell/Cell.tsx +2 -2
- package/src/{_deprecated → deprecated}/components/Table/TableBody.tsx +2 -2
- package/src/{_deprecated → deprecated}/helpers.tsx +2 -2
- package/src/{_deprecated → deprecated}/schema/Schema.stories.tsx +1 -1
- package/src/hooks/useTableModel.ts +22 -6
- package/src/model/table-model.test.ts +1 -1
- package/src/model/table-model.ts +76 -21
- package/src/model/table-presentation.test.ts +1 -1
- package/src/model/table-presentation.ts +3 -3
- package/src/model/table-sorting.ts +1 -0
- package/src/types/table.ts +5 -7
- package/src/util/dynamic-table.ts +71 -0
- package/src/util/index.ts +1 -0
- package/dist/lib/browser/_deprecated/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +0 -7
- package/dist/lib/node/chunk-NB3SFHGA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +0 -7
- package/dist/types/src/_deprecated/components/Cell/Cell.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Cell/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/Table.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableBody.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableContext.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableHead.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableRootContext.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/props.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/helpers.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useColumnSizing.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useColumnSorting.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/usePinLastRow.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useRowSelection.d.ts.map +0 -1
- package/dist/types/src/_deprecated/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/Schema.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/column-utils.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/types.d.ts.map +0 -1
- package/dist/types/src/_deprecated/theme.d.ts.map +0 -1
- package/dist/types/src/_deprecated/translations.d.ts.map +0 -1
- package/dist/types/src/_deprecated/types.d.ts.map +0 -1
- /package/dist/types/src/{_deprecated → deprecated}/components/Cell/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/TableRootContext.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/props.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/helpers.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useColumnSizing.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useColumnSorting.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/usePinLastRow.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useRowSelection.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/column-utils.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/types.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/theme.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/translations.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/types.d.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Cell/CellCombobox.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Cell/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/Table.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/Table.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableContext.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableHead.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableRootContext.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/props.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useColumnSizing.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useColumnSorting.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/usePinLastRow.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useRowSelection.ts +0 -0
- /package/src/{_deprecated → deprecated}/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/column-utils.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/types.ts +0 -0
- /package/src/{_deprecated → deprecated}/theme.ts +0 -0
- /package/src/{_deprecated → deprecated}/translations.ts +0 -0
- /package/src/{_deprecated → deprecated}/types.ts +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type SortDirectionType } from '@dxos/echo-schema';
|
|
2
|
+
import { ViewProjection, type SchemaPropertyDefinition } from '@dxos/schema';
|
|
3
|
+
type PropertyDisplayProps = {
|
|
4
|
+
size: number;
|
|
5
|
+
title: string;
|
|
6
|
+
sort: SortDirectionType;
|
|
7
|
+
};
|
|
8
|
+
export type TablePropertyDefinition = SchemaPropertyDefinition & Partial<PropertyDisplayProps>;
|
|
9
|
+
export declare const makeDynamicTable: (typename: string, properties: TablePropertyDefinition[]) => {
|
|
10
|
+
table: import("@dxos/live-object").ReactiveObject<{
|
|
11
|
+
readonly id: string;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
view?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").TypedObjectFields<{
|
|
14
|
+
name: import("effect/Schema").SchemaClass<string, string, never>;
|
|
15
|
+
query: import("effect/Schema").Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
16
|
+
schema: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
17
|
+
fields: import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").mutable<import("effect/Schema").Struct<{
|
|
18
|
+
id: typeof import("effect/Schema").String;
|
|
19
|
+
path: import("effect/Schema").Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
20
|
+
visible: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
21
|
+
size: import("effect/Schema").optional<typeof import("effect/Schema").Number>;
|
|
22
|
+
referencePath: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
23
|
+
}>>>>;
|
|
24
|
+
hiddenFields: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").mutable<import("effect/Schema").Struct<{
|
|
25
|
+
id: typeof import("effect/Schema").String;
|
|
26
|
+
path: import("effect/Schema").Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
27
|
+
visible: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
28
|
+
size: import("effect/Schema").optional<typeof import("effect/Schema").Number>;
|
|
29
|
+
referencePath: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
30
|
+
}>>>>>;
|
|
31
|
+
metadata: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Record$<typeof import("effect/Schema").String, typeof import("effect/Schema").Any>>>;
|
|
32
|
+
}, import("@dxos/echo-schema").TypedObjectOptions>> | undefined;
|
|
33
|
+
threads?: readonly import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>[] | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
schema: import("@dxos/echo-schema").EchoSchema;
|
|
36
|
+
view: import("@dxos/live-object").ReactiveObject<import("@dxos/schema").ViewType>;
|
|
37
|
+
viewProjection: ViewProjection;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=dynamic-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-table.d.ts","sourceRoot":"","sources":["../../../../src/util/dynamic-table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAGL,cAAc,EACd,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AAItB,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,eAAO,MAAM,gBAAgB,aAAc,MAAM,cAAc,uBAAuB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-main.81238a8",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
"./deprecated": {
|
|
13
|
-
"types": "./dist/types/src/
|
|
14
|
-
"browser": "./dist/lib/browser/
|
|
15
|
-
"node": "./dist/lib/node-esm/
|
|
13
|
+
"types": "./dist/types/src/deprecated/index.d.ts",
|
|
14
|
+
"browser": "./dist/lib/browser/deprecated/index.mjs",
|
|
15
|
+
"node": "./dist/lib/node-esm/deprecated/index.mjs"
|
|
16
16
|
},
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typesVersions": {
|
|
30
30
|
"*": {
|
|
31
31
|
"deprecated": [
|
|
32
|
-
"dist/types/src/
|
|
32
|
+
"dist/types/src/deprecated/index.d.ts"
|
|
33
33
|
],
|
|
34
34
|
"types": [
|
|
35
35
|
"dist/types/src/types/index.d.ts"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@codemirror/autocomplete": "^6.18.1",
|
|
45
45
|
"@codemirror/state": "^6.4.1",
|
|
46
46
|
"@codemirror/view": "^6.34.1",
|
|
47
|
-
"@fluentui/react-tabster": "9.
|
|
47
|
+
"@fluentui/react-tabster": "^9.24.2",
|
|
48
48
|
"@preact/signals-core": "^1.6.0",
|
|
49
49
|
"@radix-ui/react-context": "1.1.1",
|
|
50
50
|
"@radix-ui/react-primitive": "2.0.2",
|
|
@@ -54,27 +54,27 @@
|
|
|
54
54
|
"@tanstack/react-virtual": "^3.9.0",
|
|
55
55
|
"date-fns": "^3.3.1",
|
|
56
56
|
"lodash.orderby": "^4.6.0",
|
|
57
|
-
"@dxos/context": "0.8.
|
|
58
|
-
"@dxos/echo-schema": "0.8.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/log": "0.8.
|
|
64
|
-
"@dxos/live-object": "0.8.
|
|
65
|
-
"@dxos/plugin-search": "0.8.
|
|
66
|
-
"@dxos/plugin-space": "0.8.
|
|
67
|
-
"@dxos/react-client": "0.8.
|
|
68
|
-
"@dxos/react-ui-attention": "0.8.
|
|
69
|
-
"@dxos/react-ui-form": "0.8.
|
|
70
|
-
"@dxos/react-ui-grid": "0.8.
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-types": "0.8.
|
|
76
|
-
"@dxos/schema": "0.8.
|
|
77
|
-
"@dxos/util": "0.8.
|
|
57
|
+
"@dxos/context": "0.8.1-main.81238a8",
|
|
58
|
+
"@dxos/echo-schema": "0.8.1-main.81238a8",
|
|
59
|
+
"@dxos/invariant": "0.8.1-main.81238a8",
|
|
60
|
+
"@dxos/debug": "0.8.1-main.81238a8",
|
|
61
|
+
"@dxos/keys": "0.8.1-main.81238a8",
|
|
62
|
+
"@dxos/lit-grid": "0.8.1-main.81238a8",
|
|
63
|
+
"@dxos/log": "0.8.1-main.81238a8",
|
|
64
|
+
"@dxos/live-object": "0.8.1-main.81238a8",
|
|
65
|
+
"@dxos/plugin-search": "0.8.1-main.81238a8",
|
|
66
|
+
"@dxos/plugin-space": "0.8.1-main.81238a8",
|
|
67
|
+
"@dxos/react-client": "0.8.1-main.81238a8",
|
|
68
|
+
"@dxos/react-ui-attention": "0.8.1-main.81238a8",
|
|
69
|
+
"@dxos/react-ui-form": "0.8.1-main.81238a8",
|
|
70
|
+
"@dxos/react-ui-grid": "0.8.1-main.81238a8",
|
|
71
|
+
"@dxos/react-ui-menu": "0.8.1-main.81238a8",
|
|
72
|
+
"@dxos/react-ui-searchlist": "0.8.1-main.81238a8",
|
|
73
|
+
"@dxos/react-ui-stack": "0.8.1-main.81238a8",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.1-main.81238a8",
|
|
75
|
+
"@dxos/react-ui-types": "0.8.1-main.81238a8",
|
|
76
|
+
"@dxos/schema": "0.8.1-main.81238a8",
|
|
77
|
+
"@dxos/util": "0.8.1-main.81238a8"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -85,19 +85,19 @@
|
|
|
85
85
|
"react": "~18.2.0",
|
|
86
86
|
"react-dom": "~18.2.0",
|
|
87
87
|
"vite": "5.4.7",
|
|
88
|
-
"@dxos/echo-signals": "0.8.
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
88
|
+
"@dxos/echo-signals": "0.8.1-main.81238a8",
|
|
89
|
+
"@dxos/react-ui": "0.8.1-main.81238a8",
|
|
90
|
+
"@dxos/storybook-utils": "0.8.1-main.81238a8",
|
|
91
|
+
"@dxos/test-utils": "0.8.1-main.81238a8",
|
|
92
|
+
"@dxos/random": "0.8.1-main.81238a8",
|
|
93
|
+
"@dxos/react-ui-theme": "0.8.1-main.81238a8"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@phosphor-icons/react": "^2.1.5",
|
|
97
97
|
"react": "~18.2.0",
|
|
98
98
|
"react-dom": "~18.2.0",
|
|
99
|
-
"@dxos/react-ui": "0.8.
|
|
100
|
-
"@dxos/react-ui
|
|
99
|
+
"@dxos/react-ui-theme": "0.8.1-main.81238a8",
|
|
100
|
+
"@dxos/react-ui": "0.8.1-main.81238a8"
|
|
101
101
|
},
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
8
7
|
import { DropdownMenu } from '@dxos/react-ui';
|
|
9
8
|
import { FieldEditor } from '@dxos/react-ui-form';
|
|
10
9
|
import { type FieldType } from '@dxos/schema';
|
|
@@ -17,7 +16,7 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
17
16
|
const [newField, setNewField] = useState<FieldType>();
|
|
18
17
|
const state = modals.state.value;
|
|
19
18
|
|
|
20
|
-
const space =
|
|
19
|
+
const space = model?.space;
|
|
21
20
|
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
if (state?.type === 'columnSettings' && state.mode.type === 'create' && model?.projection) {
|
|
@@ -34,11 +33,11 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
34
33
|
if (state?.type === 'columnSettings') {
|
|
35
34
|
const { mode } = state;
|
|
36
35
|
if (mode.type === 'edit') {
|
|
37
|
-
return model?.
|
|
36
|
+
return model?.view?.fields.find((f) => f.id === mode.fieldId);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
return undefined;
|
|
41
|
-
}, [model?.
|
|
40
|
+
}, [model?.view?.fields, state]);
|
|
42
41
|
|
|
43
42
|
const field = existingField ?? newField;
|
|
44
43
|
|
|
@@ -52,7 +51,7 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
52
51
|
}
|
|
53
52
|
}, [model?.projection, state, newField]);
|
|
54
53
|
|
|
55
|
-
if (!model?.
|
|
54
|
+
if (!model?.view || !model.projection || !field) {
|
|
56
55
|
return null;
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -63,7 +62,7 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
63
62
|
<DropdownMenu.Content classNames='md:is-64'>
|
|
64
63
|
<DropdownMenu.Viewport>
|
|
65
64
|
<FieldEditor
|
|
66
|
-
view={model.
|
|
65
|
+
view={model.view!}
|
|
67
66
|
projection={model.projection}
|
|
68
67
|
field={field}
|
|
69
68
|
registry={space?.db.schemaRegistry}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { S } from '@dxos/echo-schema';
|
|
8
|
-
import { create
|
|
8
|
+
import { create } from '@dxos/react-client/echo';
|
|
9
9
|
import { Popover } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
11
|
import { type GridScopedProps, useGridContext } from '@dxos/react-ui-grid';
|
|
@@ -17,7 +17,7 @@ export type CreateRefPanelProps = { model?: TableModel; modals: ModalController
|
|
|
17
17
|
// TODO(burdon): Factor out Space dependency (to plugin?)
|
|
18
18
|
export const CreateRefPanel = ({ model, modals, __gridScope }: GridScopedProps<CreateRefPanelProps>) => {
|
|
19
19
|
const { id: gridId } = useGridContext('TableCellEditor', __gridScope);
|
|
20
|
-
const space =
|
|
20
|
+
const space = model?.space;
|
|
21
21
|
const state = modals.state.value;
|
|
22
22
|
|
|
23
23
|
const schema = useMemo<S.Schema<any> | undefined>(() => {
|
|
@@ -54,7 +54,7 @@ export const CreateRefPanel = ({ model, modals, __gridScope }: GridScopedProps<C
|
|
|
54
54
|
}
|
|
55
55
|
}, [modals]);
|
|
56
56
|
|
|
57
|
-
if (!model?.
|
|
57
|
+
if (!model?.view || !model.projection) {
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useRef, useMemo, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
8
|
+
|
|
9
|
+
import { Table, type TableFeatures, type TableController } from './Table';
|
|
10
|
+
import { useTableModel } from '../../hooks';
|
|
11
|
+
import { TablePresentation, type TableRowAction } from '../../model';
|
|
12
|
+
import { makeDynamicTable, type TablePropertyDefinition } from '../../util';
|
|
13
|
+
|
|
14
|
+
type DynamicTableProps = {
|
|
15
|
+
data: any[];
|
|
16
|
+
properties: TablePropertyDefinition[];
|
|
17
|
+
tableName?: string;
|
|
18
|
+
classNames?: string;
|
|
19
|
+
onRowClicked?: (row: any) => void;
|
|
20
|
+
rowActions?: TableRowAction[];
|
|
21
|
+
onRowAction?: (actionId: string, datum: any) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A dynamic table component that renders data using the specified properties.
|
|
26
|
+
* Properties define both the schema and display characteristics of the table columns.
|
|
27
|
+
*/
|
|
28
|
+
export const DynamicTable = ({
|
|
29
|
+
data,
|
|
30
|
+
properties,
|
|
31
|
+
classNames,
|
|
32
|
+
tableName = 'com.example/dynamic_table',
|
|
33
|
+
onRowClicked,
|
|
34
|
+
rowActions,
|
|
35
|
+
onRowAction,
|
|
36
|
+
}: DynamicTableProps) => {
|
|
37
|
+
// TODO(ZaymonFC): Consider allowing the user to supply a schema directly instead of deriving it from
|
|
38
|
+
// the properties array. (Both should be viable).
|
|
39
|
+
const { table, viewProjection } = useMemo(() => {
|
|
40
|
+
return makeDynamicTable(tableName, properties);
|
|
41
|
+
}, [tableName, properties]);
|
|
42
|
+
|
|
43
|
+
const tableRef = useRef<TableController>(null);
|
|
44
|
+
const handleCellUpdate = useCallback((cell: any) => {
|
|
45
|
+
tableRef.current?.update?.(cell);
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
const handleRowOrderChanged = useCallback(() => {
|
|
49
|
+
tableRef.current?.update?.();
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
const model = useTableModel({
|
|
53
|
+
table,
|
|
54
|
+
objects: data,
|
|
55
|
+
projection: viewProjection,
|
|
56
|
+
onCellUpdate: handleCellUpdate,
|
|
57
|
+
onRowOrderChanged: handleRowOrderChanged,
|
|
58
|
+
rowActions,
|
|
59
|
+
onRowAction,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const presentation = useMemo(() => {
|
|
63
|
+
if (model) {
|
|
64
|
+
return new TablePresentation(model);
|
|
65
|
+
}
|
|
66
|
+
}, [model]);
|
|
67
|
+
|
|
68
|
+
const features: TableFeatures = useMemo(() => ({ selection: false }), []);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div className={mx('is-full bs-full grow grid', classNames)}>
|
|
72
|
+
<div className='grid min-bs-0 overflow-hidden'>
|
|
73
|
+
<Table.Root>
|
|
74
|
+
<Table.Main
|
|
75
|
+
ref={tableRef}
|
|
76
|
+
model={model}
|
|
77
|
+
presentation={presentation}
|
|
78
|
+
features={features}
|
|
79
|
+
onRowClicked={onRowClicked}
|
|
80
|
+
ignoreAttention
|
|
81
|
+
/>
|
|
82
|
+
</Table.Root>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
8
8
|
import { Popover } from '@dxos/react-ui';
|
|
9
9
|
import { Form } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
@@ -22,11 +22,11 @@ const getRefTargetObj = (space?: Space, id?: string) => {
|
|
|
22
22
|
|
|
23
23
|
export const RefPanel = ({ model, modals }: RefPanelProps) => {
|
|
24
24
|
const state = modals.state.value;
|
|
25
|
-
const space =
|
|
25
|
+
const space = model?.space;
|
|
26
26
|
const targetObj = getRefTargetObj(space, state?.type === 'refPanel' ? state.targetId : undefined);
|
|
27
27
|
const schema = space && state?.type === 'refPanel' ? space.db.schemaRegistry.getSchema(state.typename) : undefined;
|
|
28
28
|
|
|
29
|
-
if (!model.
|
|
29
|
+
if (!model.view || !model.projection) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -26,6 +26,19 @@ export const RowActionsMenu = ({ model, modals }: RowActionsMenuProps) => {
|
|
|
26
26
|
<DropdownMenu.Item data-testid='row-menu-delete' onClick={() => model.deleteRow(state.rowIndex)}>
|
|
27
27
|
{t(hasSelection ? 'bulk delete row label' : 'delete row label')}
|
|
28
28
|
</DropdownMenu.Item>
|
|
29
|
+
{/* Custom actions */}
|
|
30
|
+
{model.rowActions?.map((action) => (
|
|
31
|
+
<DropdownMenu.Item
|
|
32
|
+
key={action.id}
|
|
33
|
+
data-testid={`row-action-${action.id}`}
|
|
34
|
+
onClick={() => {
|
|
35
|
+
modals.close();
|
|
36
|
+
model.handleRowAction(action.id, state.rowIndex);
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{t(action.translationKey)}
|
|
40
|
+
</DropdownMenu.Item>
|
|
41
|
+
))}
|
|
29
42
|
</DropdownMenu.Viewport>
|
|
30
43
|
<DropdownMenu.Arrow />
|
|
31
44
|
</DropdownMenu.Content>
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
|
+
import { FormatEnum } from '@dxos/echo-schema';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
12
|
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
12
13
|
import { faker } from '@dxos/random';
|
|
@@ -15,9 +16,10 @@ import { useClientProvider, withClientProvider } from '@dxos/react-client/testin
|
|
|
15
16
|
import { useDefaultValue } from '@dxos/react-ui';
|
|
16
17
|
import { ViewEditor } from '@dxos/react-ui-form';
|
|
17
18
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
18
|
-
import { ViewProjection, ViewType } from '@dxos/schema';
|
|
19
|
+
import { type SchemaPropertyDefinition, ViewProjection, ViewType } from '@dxos/schema';
|
|
19
20
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
20
21
|
|
|
22
|
+
import { DynamicTable as DynamicTableComponent } from './DynamicTable';
|
|
21
23
|
import { Table, type TableController } from './Table';
|
|
22
24
|
import { useTableModel, type UseTableModelParams } from '../../hooks';
|
|
23
25
|
import { TablePresentation } from '../../model';
|
|
@@ -170,6 +172,25 @@ const DefaultStory = () => {
|
|
|
170
172
|
);
|
|
171
173
|
};
|
|
172
174
|
|
|
175
|
+
const DynamicTableStory = () => {
|
|
176
|
+
const properties = useMemo<SchemaPropertyDefinition[]>(
|
|
177
|
+
() => [
|
|
178
|
+
{ name: 'name', format: FormatEnum.String },
|
|
179
|
+
{ name: 'age', format: FormatEnum.Number },
|
|
180
|
+
],
|
|
181
|
+
[],
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const [objects, _setObjects] = useState<any[]>(
|
|
185
|
+
Array.from({ length: 100 }, () => ({
|
|
186
|
+
name: faker.person.fullName(),
|
|
187
|
+
age: faker.number.int({ min: 18, max: 80 }),
|
|
188
|
+
})),
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
return <DynamicTableComponent properties={properties} data={objects} />;
|
|
192
|
+
};
|
|
193
|
+
|
|
173
194
|
type StoryProps = {
|
|
174
195
|
rows?: number;
|
|
175
196
|
} & Pick<SimulatorProps, 'insertInterval' | 'updateInterval'>;
|
|
@@ -249,6 +270,10 @@ export default meta;
|
|
|
249
270
|
|
|
250
271
|
export const Default = {};
|
|
251
272
|
|
|
273
|
+
export const DynamicTable: StoryObj = {
|
|
274
|
+
render: DynamicTableStory,
|
|
275
|
+
};
|
|
276
|
+
|
|
252
277
|
// TODO(ZaymonFC): Restore the performance stories.
|
|
253
278
|
// type Story = StoryObj<StoryProps>;
|
|
254
279
|
// export const Mutations: Story = {
|
|
@@ -15,12 +15,12 @@ import React, {
|
|
|
15
15
|
|
|
16
16
|
import { getValue } from '@dxos/echo-schema';
|
|
17
17
|
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import { Filter
|
|
19
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
18
|
+
import { Filter } from '@dxos/react-client/echo';
|
|
19
|
+
import { useDefaultValue, useTranslation } from '@dxos/react-ui';
|
|
20
20
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
21
21
|
import { type DxGridElement, Grid, type GridContentProps, closestCell, type DxGridPosition } from '@dxos/react-ui-grid';
|
|
22
22
|
import { mx } from '@dxos/react-ui-theme';
|
|
23
|
-
import { isNotFalsy } from '@dxos/util';
|
|
23
|
+
import { isNotFalsy, safeParseInt } from '@dxos/util';
|
|
24
24
|
|
|
25
25
|
import { ColumnActionsMenu } from './ColumnActionsMenu';
|
|
26
26
|
import { ColumnSettings } from './ColumnSettings';
|
|
@@ -39,8 +39,6 @@ const inlineEndLine =
|
|
|
39
39
|
const blockEndLine =
|
|
40
40
|
'[&>.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';
|
|
41
41
|
|
|
42
|
-
const frozen = { frozenRowsStart: 1, frozenColsStart: 1, frozenColsEnd: 1 };
|
|
43
|
-
|
|
44
42
|
//
|
|
45
43
|
// Root
|
|
46
44
|
//
|
|
@@ -71,19 +69,32 @@ export type TableController = {
|
|
|
71
69
|
update?: (cell?: DxGridPosition) => void;
|
|
72
70
|
};
|
|
73
71
|
|
|
72
|
+
export type TableFeatures = { selection?: boolean };
|
|
73
|
+
|
|
74
74
|
export type TableMainProps = {
|
|
75
75
|
model?: TableModel;
|
|
76
76
|
presentation?: TablePresentation;
|
|
77
77
|
ignoreAttention?: boolean;
|
|
78
|
+
features?: TableFeatures;
|
|
79
|
+
onRowClicked?: (row: any) => void;
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
const TableMain = forwardRef<TableController, TableMainProps>(
|
|
81
|
-
({ model, presentation, ignoreAttention }, forwardedRef) => {
|
|
83
|
+
({ model, presentation, ignoreAttention, onRowClicked, features }, forwardedRef) => {
|
|
82
84
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
83
|
-
const { hasAttention } = useAttention(model?.
|
|
85
|
+
const { hasAttention } = useAttention(model?.id ?? 'table');
|
|
84
86
|
const { t } = useTranslation(translationKey);
|
|
85
87
|
const modals = useMemo(() => new ModalController(), []);
|
|
86
88
|
|
|
89
|
+
const { selection } = useDefaultValue(features, () => ({
|
|
90
|
+
selection: true,
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
const frozen = useMemo(
|
|
94
|
+
() => ({ frozenRowsStart: 1, frozenColsStart: selection ? 1 : 0, frozenColsEnd: 1 }),
|
|
95
|
+
[selection],
|
|
96
|
+
);
|
|
97
|
+
|
|
87
98
|
/**
|
|
88
99
|
* Provides an external controller that can be called to repaint the table.
|
|
89
100
|
*/
|
|
@@ -111,6 +122,14 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
111
122
|
|
|
112
123
|
const handleGridClick = useCallback(
|
|
113
124
|
(event: MouseEvent) => {
|
|
125
|
+
if (onRowClicked) {
|
|
126
|
+
const rowIndex = safeParseInt((event.target as HTMLElement).ariaRowIndex ?? '');
|
|
127
|
+
if (rowIndex != null) {
|
|
128
|
+
const row = model?.getRowAt(rowIndex);
|
|
129
|
+
row && onRowClicked(row);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
114
133
|
if (!modals) {
|
|
115
134
|
return;
|
|
116
135
|
}
|
|
@@ -260,7 +279,7 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
260
279
|
const handleQuery = useCallback<NonNullable<TableCellEditorProps['onQuery']>>(
|
|
261
280
|
async ({ field, props }, text) => {
|
|
262
281
|
if (model && props.referenceSchema && field.referencePath) {
|
|
263
|
-
const space =
|
|
282
|
+
const space = model.space;
|
|
264
283
|
invariant(space);
|
|
265
284
|
const schema = space.db.schemaRegistry.getSchema(props.referenceSchema);
|
|
266
285
|
if (schema) {
|
|
@@ -299,7 +318,7 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
299
318
|
}
|
|
300
319
|
|
|
301
320
|
return (
|
|
302
|
-
<Grid.Root id={model.
|
|
321
|
+
<Grid.Root id={model.id ?? 'table-grid'}>
|
|
303
322
|
<TableCellEditor
|
|
304
323
|
model={model}
|
|
305
324
|
modals={modals}
|
|
@@ -313,7 +332,7 @@ const TableMain = forwardRef<TableController, TableMainProps>(
|
|
|
313
332
|
frozen={frozen}
|
|
314
333
|
columns={model.columnMeta.value}
|
|
315
334
|
limitRows={model.getRowCount() ?? 0}
|
|
316
|
-
limitColumns={model.
|
|
335
|
+
limitColumns={model.view?.fields?.length ?? 0}
|
|
317
336
|
onAxisResize={handleAxisResize}
|
|
318
337
|
onClick={handleGridClick}
|
|
319
338
|
onKeyDown={handleKeyDown}
|
|
@@ -75,6 +75,7 @@ export const useSimulator = ({ items, table, insertInterval, updateInterval }: S
|
|
|
75
75
|
const rowIdx = Math.floor(Math.random() * items.length);
|
|
76
76
|
const fields = table.view?.target?.fields ?? [];
|
|
77
77
|
const columnIdx = Math.floor(Math.random() * fields.length);
|
|
78
|
+
// TODO(ZaymonFC): ... This is borked.
|
|
78
79
|
const projection: ViewProjection = (table as any)._projection;
|
|
79
80
|
const field = fields[columnIdx];
|
|
80
81
|
const item = items[rowIdx];
|
|
@@ -17,7 +17,7 @@ const CELL_NAME = 'Cell';
|
|
|
17
17
|
|
|
18
18
|
const FocusableCell = <TData extends RowData, TValue>({ cell, children }: CellProps<TData, TValue>) => {
|
|
19
19
|
const tableContext = useTableContext();
|
|
20
|
-
const
|
|
20
|
+
const focusableGroupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
|
|
21
21
|
|
|
22
22
|
const pinned = tableContext.table.getState().rowPinning?.bottom?.includes(cell.row.id);
|
|
23
23
|
const className = tdRoot({ ...tableContext, pinned }, cell.column.columnDef.meta?.cell?.classNames);
|
|
@@ -60,7 +60,7 @@ const FocusableCell = <TData extends RowData, TValue>({ cell, children }: CellPr
|
|
|
60
60
|
}, []);
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<td data-testid='table.cell' tabIndex={0} {...
|
|
63
|
+
<td data-testid='table.cell' tabIndex={0} {...focusableGroupAttrs} className={className} onKeyDown={handleKeyDown}>
|
|
64
64
|
{children}
|
|
65
65
|
</td>
|
|
66
66
|
);
|
|
@@ -21,13 +21,13 @@ const TableBody = ({ rows }: TableBodyProps) => {
|
|
|
21
21
|
const { table, keyAccessor, currentDatum, debug, expand, isGrid, onDatumClick } = useTableContext();
|
|
22
22
|
|
|
23
23
|
const rowSelection = table.getState().rowSelection;
|
|
24
|
-
const
|
|
24
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'grid' });
|
|
25
25
|
const canBeCurrent = !isGrid && !!onDatumClick;
|
|
26
26
|
|
|
27
27
|
const { virtualizer } = useContext(TableRootContext);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<tbody {...(isGrid &&
|
|
30
|
+
<tbody {...(isGrid && arrowNavigationAttrs)}>
|
|
31
31
|
{rows.map((row) => {
|
|
32
32
|
const isCurrent = currentDatum === row.original;
|
|
33
33
|
const isSelected = rowSelection?.[row.id];
|
|
@@ -126,7 +126,7 @@ const StringBuilderCell = <TData extends RowData>(cellContext: CellContext<TData
|
|
|
126
126
|
let placeholder = false;
|
|
127
127
|
const columns = cellContext.table.getVisibleFlatColumns();
|
|
128
128
|
|
|
129
|
-
// Calling getRowModel is expensive, so only do it when we're a cell in the first position
|
|
129
|
+
// Calling getRowModel is expensive, so only do it when we're a cell in the first position.
|
|
130
130
|
if (columns[0].id === cellContext.column.id) {
|
|
131
131
|
const rowCount = cellContext.table.getRowModel().rows.length;
|
|
132
132
|
placeholder = cellContext.row.index === rowCount - 1 && columns[0].id === cellContext.column.id;
|
|
@@ -206,7 +206,7 @@ const NumberBuilderCell = <TData extends RowData>(cellContext: CellContext<TData
|
|
|
206
206
|
onFocus={handleEdit}
|
|
207
207
|
onChange={({ target: { value } }) => setText(value)}
|
|
208
208
|
onKeyDown={(event) => {
|
|
209
|
-
// TODO(thure): `Escape` is reserved for blurring the input and moving focus to the cell
|
|
209
|
+
// TODO(thure): `Escape` is reserved for blurring the input and moving focus to the cell.
|
|
210
210
|
return /* (event.key === 'Escape' && handleCancel()) || */ event.key === 'Enter' && handleSave();
|
|
211
211
|
}}
|
|
212
212
|
autoComplete='off'
|