@dxos/react-ui-table 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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-FBURZBPH.mjs +70 -0
- package/dist/lib/browser/chunk-FBURZBPH.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-YGC7LZJN.mjs +1695 -0
- package/dist/lib/browser/chunk-YGC7LZJN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1158 -2872
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +115 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +36 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -5
- package/dist/lib/node-esm/chunk-DKKMSVKP.mjs +71 -0
- package/dist/lib/node-esm/chunk-DKKMSVKP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GKIWDEZ7.mjs +1697 -0
- package/dist/lib/node-esm/chunk-GKIWDEZ7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1158 -2872
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +116 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +37 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -5
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts +2 -3
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts +4 -2
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +7 -7
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts +35 -3
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/Relations.stories.d.ts +111 -0
- package/dist/types/src/components/Table/Relations.stories.d.ts.map +1 -0
- package/dist/types/src/components/Table/RowActionsMenu.d.ts +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +21 -18
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +110 -6
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableContent.d.ts +17 -0
- package/dist/types/src/components/Table/TableContent.d.ts.map +1 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts +21 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts +1 -1
- package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +14 -9
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +12 -18
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts +38 -5
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/index.d.ts +1 -0
- package/dist/types/src/components/TableCellEditor/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +26 -56
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAddRow.d.ts +6 -6
- package/dist/types/src/hooks/useAddRow.d.ts.map +1 -1
- package/dist/types/src/hooks/useProjectionModel.d.ts +6 -0
- package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -0
- package/dist/types/src/hooks/useTableModel.d.ts +11 -10
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts +5 -8
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/model/selection-model.d.ts +18 -8
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +116 -34
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts +5 -2
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/playwright/TableManager.d.ts +2 -1
- package/dist/types/src/playwright/TableManager.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/useTestTableModel.d.ts +25 -0
- package/dist/types/src/testing/useTestTableModel.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +21 -23
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Table.d.ts +26 -0
- package/dist/types/src/types/Table.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +15 -14
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.test.d.ts +2 -0
- package/dist/types/src/util/dynamic-table.test.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/query-ast.d.ts +7 -0
- package/dist/types/src/util/query-ast.d.ts.map +1 -0
- package/dist/types/src/util/schema.d.ts +1 -1
- package/dist/types/src/util/schema.d.ts.map +1 -1
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/sort.d.ts +12 -0
- package/dist/types/src/util/sort.d.ts.map +1 -0
- package/dist/types/src/util/table-buttons.d.ts +20 -20
- package/dist/types/src/util/table-buttons.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts +4 -4
- package/dist/types/src/util/table-controls.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 +80 -69
- package/src/components/Table/ColumnActionsMenu.tsx +18 -13
- package/src/components/Table/ColumnSettings.tsx +18 -15
- package/src/components/Table/DynamicTable.stories.tsx +40 -36
- package/src/components/Table/DynamicTable.tsx +38 -34
- package/src/components/Table/Relations.stories.tsx +281 -0
- package/src/components/Table/RowActionsMenu.tsx +28 -18
- package/src/components/Table/Table.stories.tsx +198 -220
- package/src/components/Table/Table.tsx +47 -376
- package/src/components/Table/TableContent.tsx +421 -0
- package/src/components/Table/TableToolbar.tsx +111 -0
- package/src/components/TableCellEditor/CellValidationMessage.tsx +6 -6
- package/src/components/TableCellEditor/FormCellEditor.tsx +153 -49
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +38 -77
- package/src/components/TableCellEditor/TableCellEditor.tsx +104 -233
- package/src/components/TableCellEditor/index.ts +1 -0
- package/src/components/index.ts +0 -1
- package/src/components/testing.ts +46 -37
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useAddRow.ts +14 -14
- package/src/hooks/useProjectionModel.ts +39 -0
- package/src/hooks/useTableModel.ts +41 -35
- package/src/index.ts +0 -5
- package/src/model/modal-controller.ts +24 -41
- package/src/model/selection-model.ts +75 -41
- package/src/model/table-model.test.ts +91 -56
- package/src/model/table-model.ts +468 -187
- package/src/model/table-presentation.test.ts +77 -60
- package/src/model/table-presentation.ts +112 -66
- package/src/playwright/TableManager.ts +13 -6
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/smoke.spec.ts +180 -43
- package/src/testing/index.ts +5 -0
- package/src/testing/useTestTableModel.ts +133 -0
- package/src/translations.ts +20 -22
- package/src/types/Table.ts +79 -0
- package/src/types/index.ts +2 -2
- package/src/util/dynamic-table.test.ts +77 -0
- package/src/util/dynamic-table.ts +51 -36
- package/src/util/index.ts +2 -1
- package/src/util/query-ast.ts +22 -0
- package/src/util/schema.ts +4 -4
- package/src/util/sort.ts +90 -0
- package/src/util/table-buttons.ts +4 -3
- package/src/util/table-controls.ts +6 -3
- package/dist/lib/browser/chunk-Q5QQXJUO.mjs +0 -27
- package/dist/lib/browser/chunk-Q5QQXJUO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZNOU6LHG.mjs +0 -29
- package/dist/lib/node-esm/chunk-ZNOU6LHG.mjs.map +0 -7
- package/dist/types/src/components/Table/CreateRefPanel.d.ts +0 -9
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +0 -1
- package/dist/types/src/components/Table/relations.stories.d.ts +0 -9
- package/dist/types/src/components/Table/relations.stories.d.ts.map +0 -1
- package/dist/types/src/components/TableCellEditor/extension.d.ts +0 -13
- package/dist/types/src/components/TableCellEditor/extension.d.ts.map +0 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +0 -21
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +0 -1
- package/dist/types/src/components/TableToolbar/index.d.ts +0 -2
- package/dist/types/src/components/TableToolbar/index.d.ts.map +0 -1
- package/dist/types/src/model/table-sorting.d.ts +0 -53
- package/dist/types/src/model/table-sorting.d.ts.map +0 -1
- package/dist/types/src/types/table.d.ts +0 -56
- package/dist/types/src/types/table.d.ts.map +0 -1
- package/dist/types/src/util/table.d.ts +0 -14
- package/dist/types/src/util/table.d.ts.map +0 -1
- package/src/components/Table/CreateRefPanel.tsx +0 -84
- package/src/components/Table/relations.stories.tsx +0 -123
- package/src/components/TableCellEditor/extension.ts +0 -61
- package/src/components/TableToolbar/TableToolbar.tsx +0 -102
- package/src/components/TableToolbar/index.ts +0 -5
- package/src/model/table-sorting.ts +0 -216
- package/src/types/table.ts +0 -27
- package/src/util/table.ts +0 -127
package/package.json
CHANGED
|
@@ -1,110 +1,121 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.fcc0d83b33",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#translations": "./src/translations.ts"
|
|
17
|
+
},
|
|
11
18
|
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"source": "./src/index.ts",
|
|
21
|
+
"types": "./dist/types/src/index.d.ts",
|
|
22
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
23
|
+
"node": "./dist/lib/node-esm/index.mjs"
|
|
24
|
+
},
|
|
12
25
|
"./deprecated": {
|
|
26
|
+
"source": "./src/deprecated/index.ts",
|
|
13
27
|
"types": "./dist/types/src/deprecated/index.d.ts",
|
|
14
28
|
"browser": "./dist/lib/browser/deprecated/index.mjs",
|
|
15
29
|
"node": "./dist/lib/node-esm/deprecated/index.mjs"
|
|
16
30
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
31
|
+
"./testing": {
|
|
32
|
+
"source": "./src/testing/index.ts",
|
|
33
|
+
"types": "./dist/types/src/testing/index.d.ts",
|
|
34
|
+
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
35
|
+
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./translations": {
|
|
38
|
+
"source": "./src/translations.ts",
|
|
39
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
40
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
41
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
21
42
|
},
|
|
22
43
|
"./types": {
|
|
44
|
+
"source": "./src/types/index.ts",
|
|
23
45
|
"types": "./dist/types/src/types/index.d.ts",
|
|
24
46
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
25
47
|
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
26
48
|
}
|
|
27
49
|
},
|
|
28
50
|
"types": "dist/types/src/index.d.ts",
|
|
29
|
-
"typesVersions": {
|
|
30
|
-
"*": {
|
|
31
|
-
"deprecated": [
|
|
32
|
-
"dist/types/src/deprecated/index.d.ts"
|
|
33
|
-
],
|
|
34
|
-
"types": [
|
|
35
|
-
"dist/types/src/types/index.d.ts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
51
|
"files": [
|
|
40
52
|
"dist",
|
|
41
53
|
"src"
|
|
42
54
|
],
|
|
43
55
|
"dependencies": {
|
|
44
|
-
"@codemirror/autocomplete": "^6.
|
|
45
|
-
"@codemirror/state": "^6.
|
|
46
|
-
"@codemirror/view": "^6.
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@preact/signals-core": "^1.9.0",
|
|
56
|
+
"@codemirror/autocomplete": "^6.19.0",
|
|
57
|
+
"@codemirror/state": "^6.5.2",
|
|
58
|
+
"@codemirror/view": "^6.38.4",
|
|
59
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
60
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
50
61
|
"@radix-ui/react-context": "1.1.1",
|
|
51
62
|
"@radix-ui/react-primitive": "2.0.2",
|
|
52
63
|
"@radix-ui/react-slot": "1.1.2",
|
|
53
64
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
54
|
-
"date-fns": "^3.
|
|
65
|
+
"date-fns": "^3.6.0",
|
|
55
66
|
"lodash.orderby": "^4.6.0",
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/echo
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/lit-grid": "0.8.4-main.
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/react-
|
|
69
|
-
"@dxos/react-ui-
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/util": "0.8.4-main.
|
|
67
|
+
"@dxos/async": "0.8.4-main.fcc0d83b33",
|
|
68
|
+
"@dxos/context": "0.8.4-main.fcc0d83b33",
|
|
69
|
+
"@dxos/debug": "0.8.4-main.fcc0d83b33",
|
|
70
|
+
"@dxos/echo": "0.8.4-main.fcc0d83b33",
|
|
71
|
+
"@dxos/invariant": "0.8.4-main.fcc0d83b33",
|
|
72
|
+
"@dxos/keys": "0.8.4-main.fcc0d83b33",
|
|
73
|
+
"@dxos/effect": "0.8.4-main.fcc0d83b33",
|
|
74
|
+
"@dxos/lit-grid": "0.8.4-main.fcc0d83b33",
|
|
75
|
+
"@dxos/echo-atom": "0.8.4-main.fcc0d83b33",
|
|
76
|
+
"@dxos/random": "0.8.4-main.fcc0d83b33",
|
|
77
|
+
"@dxos/log": "0.8.4-main.fcc0d83b33",
|
|
78
|
+
"@dxos/react-client": "0.8.4-main.fcc0d83b33",
|
|
79
|
+
"@dxos/react-ui-attention": "0.8.4-main.fcc0d83b33",
|
|
80
|
+
"@dxos/react-ui-editor": "0.8.4-main.fcc0d83b33",
|
|
81
|
+
"@dxos/react-ui-form": "0.8.4-main.fcc0d83b33",
|
|
82
|
+
"@dxos/react-ui-grid": "0.8.4-main.fcc0d83b33",
|
|
83
|
+
"@dxos/react-ui-menu": "0.8.4-main.fcc0d83b33",
|
|
84
|
+
"@dxos/react-ui-components": "0.8.4-main.fcc0d83b33",
|
|
85
|
+
"@dxos/react-ui-stack": "0.8.4-main.fcc0d83b33",
|
|
86
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.fcc0d83b33",
|
|
87
|
+
"@dxos/react-ui-search": "0.8.4-main.fcc0d83b33",
|
|
88
|
+
"@dxos/schema": "0.8.4-main.fcc0d83b33",
|
|
89
|
+
"@dxos/ui-types": "0.8.4-main.fcc0d83b33",
|
|
90
|
+
"@dxos/types": "0.8.4-main.fcc0d83b33",
|
|
91
|
+
"@dxos/util": "0.8.4-main.fcc0d83b33"
|
|
81
92
|
},
|
|
82
93
|
"devDependencies": {
|
|
83
|
-
"@effect
|
|
84
|
-
"@effect/platform": "0.88.0",
|
|
94
|
+
"@effect/platform": "0.94.4",
|
|
85
95
|
"@types/lodash.orderby": "^4.6.9",
|
|
86
|
-
"@types/react": "~
|
|
87
|
-
"@types/react-dom": "~
|
|
88
|
-
"effect": "3.
|
|
96
|
+
"@types/react": "~19.2.7",
|
|
97
|
+
"@types/react-dom": "~19.2.3",
|
|
98
|
+
"effect": "3.20.0",
|
|
89
99
|
"fast-check": "^3.19.0",
|
|
90
|
-
"react": "~
|
|
91
|
-
"react-dom": "~
|
|
92
|
-
"vite": "
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/random": "0.8.4-main.
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/react-
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/
|
|
100
|
+
"react": "~19.2.3",
|
|
101
|
+
"react-dom": "~19.2.3",
|
|
102
|
+
"vite": "^8.0.10",
|
|
103
|
+
"@dxos/lit-ui": "0.8.4-main.fcc0d83b33",
|
|
104
|
+
"@dxos/random": "0.8.4-main.fcc0d83b33",
|
|
105
|
+
"@dxos/storybook-utils": "0.8.4-main.fcc0d83b33",
|
|
106
|
+
"@dxos/react-client": "0.8.4-main.fcc0d83b33",
|
|
107
|
+
"@dxos/test-utils": "0.8.4-main.fcc0d83b33",
|
|
108
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33",
|
|
109
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33"
|
|
99
110
|
},
|
|
100
111
|
"peerDependencies": {
|
|
101
|
-
"@effect-
|
|
102
|
-
"@effect/platform": "
|
|
103
|
-
"effect": "
|
|
104
|
-
"react": "~
|
|
105
|
-
"react-dom": "~
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/react-ui
|
|
112
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
113
|
+
"@effect/platform": "0.94.4",
|
|
114
|
+
"effect": "3.20.0",
|
|
115
|
+
"react": "~19.2.3",
|
|
116
|
+
"react-dom": "~19.2.3",
|
|
117
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33",
|
|
118
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33"
|
|
108
119
|
},
|
|
109
120
|
"publishConfig": {
|
|
110
121
|
"access": "public"
|
|
@@ -2,23 +2,28 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { DropdownMenu, useTranslation } from '@dxos/react-ui';
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
-
import { translationKey } from '../../translations';
|
|
10
|
+
import { translationKey } from '#translations';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
import { type ModalController, type TableModel } from '../../model';
|
|
13
|
+
|
|
14
|
+
export type ColumnActionsMenuProps = {
|
|
15
|
+
model: TableModel;
|
|
16
|
+
modals: ModalController;
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) => {
|
|
15
20
|
const { t } = useTranslation(translationKey);
|
|
16
|
-
const state = modals.state
|
|
21
|
+
const state = useAtomValue(modals.state);
|
|
17
22
|
if (state?.type !== 'column') {
|
|
18
23
|
return null;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
const currentSort = model.
|
|
26
|
+
const currentSort = model.getSorting();
|
|
22
27
|
const isCurrentColumnSorted = currentSort?.fieldId === state.fieldId;
|
|
23
28
|
|
|
24
29
|
return (
|
|
@@ -30,32 +35,32 @@ export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) =>
|
|
|
30
35
|
{(!isCurrentColumnSorted || currentSort?.direction === 'asc') && (
|
|
31
36
|
<DropdownMenu.Item
|
|
32
37
|
data-testid='column-sort-descending'
|
|
33
|
-
onClick={() => model.
|
|
38
|
+
onClick={() => model.setSort(state.fieldId, 'desc')}
|
|
34
39
|
>
|
|
35
|
-
{t('column
|
|
40
|
+
{t('column-action-sort-descending.menu')}
|
|
36
41
|
</DropdownMenu.Item>
|
|
37
42
|
)}
|
|
38
43
|
{(!isCurrentColumnSorted || currentSort?.direction === 'desc') && (
|
|
39
44
|
<DropdownMenu.Item
|
|
40
45
|
data-testid='column-sort-ascending'
|
|
41
|
-
onClick={() => model.
|
|
46
|
+
onClick={() => model.setSort(state.fieldId, 'asc')}
|
|
42
47
|
>
|
|
43
|
-
{t('column
|
|
48
|
+
{t('column-action-sort-ascending.menu')}
|
|
44
49
|
</DropdownMenu.Item>
|
|
45
50
|
)}
|
|
46
51
|
{isCurrentColumnSorted && (
|
|
47
|
-
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.
|
|
48
|
-
{t('column
|
|
52
|
+
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.clearSort()}>
|
|
53
|
+
{t('column-action-clear-sorting.menu')}
|
|
49
54
|
</DropdownMenu.Item>
|
|
50
55
|
)}
|
|
51
56
|
{model.getColumnCount() > 1 && model.features.schemaEditable && (
|
|
52
57
|
<DropdownMenu.Item data-testid='column-delete' onClick={() => model.deleteColumn(state.fieldId)}>
|
|
53
|
-
{t('column
|
|
58
|
+
{t('column-action-delete.menu')}
|
|
54
59
|
</DropdownMenu.Item>
|
|
55
60
|
)}
|
|
56
61
|
{model.features.schemaEditable && (
|
|
57
62
|
<DropdownMenu.Item data-testid='column-settings' onClick={() => modals.openColumnSettings()}>
|
|
58
|
-
{t('column
|
|
63
|
+
{t('column-action-settings.menu')}
|
|
59
64
|
</DropdownMenu.Item>
|
|
60
65
|
)}
|
|
61
66
|
</DropdownMenu.Viewport>
|
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
5
6
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
7
|
|
|
8
|
+
import { type SchemaRegistry, type View } from '@dxos/echo';
|
|
7
9
|
import { Popover } from '@dxos/react-ui';
|
|
8
10
|
import { FieldEditor } from '@dxos/react-ui-form';
|
|
9
|
-
import { type FieldType } from '@dxos/schema';
|
|
10
11
|
|
|
11
|
-
import { type
|
|
12
|
+
import { type ModalController, type TableModel } from '../../model';
|
|
12
13
|
|
|
13
|
-
type ColumnSettingsProps = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
type ColumnSettingsProps = {
|
|
15
|
+
registry?: SchemaRegistry.SchemaRegistry;
|
|
16
|
+
model?: TableModel;
|
|
17
|
+
modals: ModalController;
|
|
18
|
+
onNewColumn: () => void;
|
|
19
|
+
};
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
export const ColumnSettings = ({ registry, model, modals, onNewColumn }: ColumnSettingsProps) => {
|
|
22
|
+
const [newField, setNewField] = useState<View.FieldType>();
|
|
23
|
+
const state = useAtomValue(modals.state);
|
|
20
24
|
|
|
21
25
|
useEffect(() => {
|
|
22
26
|
if (state?.type === 'columnSettings' && state.mode.type === 'create' && model?.projection) {
|
|
@@ -33,11 +37,11 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
33
37
|
if (state?.type === 'columnSettings') {
|
|
34
38
|
const { mode } = state;
|
|
35
39
|
if (mode.type === 'edit') {
|
|
36
|
-
return model?.
|
|
40
|
+
return model?.projection?.getFields().find((f) => f.id === mode.fieldId);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
return undefined;
|
|
40
|
-
}, [model?.
|
|
44
|
+
}, [model?.projection, state]);
|
|
41
45
|
|
|
42
46
|
const field = existingField ?? newField;
|
|
43
47
|
|
|
@@ -47,11 +51,11 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
47
51
|
|
|
48
52
|
const handleCancel = useCallback(() => {
|
|
49
53
|
if (state?.type === 'columnSettings' && state.mode.type === 'create' && newField) {
|
|
50
|
-
model?.projection
|
|
54
|
+
model?.projection.deleteFieldProjection(newField.id);
|
|
51
55
|
}
|
|
52
56
|
}, [model?.projection, state, newField]);
|
|
53
57
|
|
|
54
|
-
if (!model?.
|
|
58
|
+
if (!model?.projection || !field) {
|
|
55
59
|
return null;
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -59,13 +63,12 @@ export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsPro
|
|
|
59
63
|
<Popover.Root modal={false} open={state?.type === 'columnSettings'}>
|
|
60
64
|
<Popover.VirtualTrigger virtualRef={modals.trigger} />
|
|
61
65
|
<Popover.Portal>
|
|
62
|
-
<Popover.Content classNames='md:
|
|
66
|
+
<Popover.Content classNames='md:w-64'>
|
|
63
67
|
<Popover.Viewport>
|
|
64
68
|
<FieldEditor
|
|
65
|
-
view={model.view!}
|
|
66
69
|
projection={model.projection}
|
|
67
70
|
field={field}
|
|
68
|
-
registry={
|
|
71
|
+
registry={registry}
|
|
69
72
|
onSave={handleSave}
|
|
70
73
|
onCancel={handleCancel}
|
|
71
74
|
/>
|
|
@@ -2,41 +2,41 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import type * as Types from 'effect/Types';
|
|
8
7
|
import React, { useMemo, useState } from 'react';
|
|
9
8
|
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { useClient } from '@dxos/react-client';
|
|
9
|
+
import { type JsonSchema, Obj } from '@dxos/echo';
|
|
10
|
+
import { Format } from '@dxos/echo/internal';
|
|
11
|
+
import { random } from '@dxos/random';
|
|
14
12
|
import { Filter, useQuery, useSchema } from '@dxos/react-client/echo';
|
|
15
|
-
import {
|
|
13
|
+
import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
15
|
import { type SchemaPropertyDefinition } from '@dxos/schema';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
17
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
18
|
+
|
|
19
|
+
import { translations } from '#translations';
|
|
19
20
|
|
|
20
|
-
import { DynamicTable } from './DynamicTable';
|
|
21
21
|
import { type TableFeatures } from '../../model';
|
|
22
|
-
import {
|
|
22
|
+
import { DynamicTable } from './DynamicTable';
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
random.seed(0);
|
|
25
25
|
|
|
26
26
|
const useTestPropertiesAndObjects = () => {
|
|
27
27
|
const properties = useMemo<SchemaPropertyDefinition[]>(
|
|
28
28
|
() => [
|
|
29
|
-
{ name: 'name', format:
|
|
30
|
-
{ name: 'age', format:
|
|
29
|
+
{ name: 'name', format: Format.TypeFormat.String },
|
|
30
|
+
{ name: 'age', format: Format.TypeFormat.Number },
|
|
31
31
|
],
|
|
32
32
|
[],
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
const [rows] = useState<any[]>(
|
|
36
36
|
Array.from({ length: 10 }, () => ({
|
|
37
|
-
id:
|
|
38
|
-
name:
|
|
39
|
-
age:
|
|
37
|
+
id: random.string.uuid(),
|
|
38
|
+
name: random.person.fullName(),
|
|
39
|
+
age: random.number.int({ min: 18, max: 80 }),
|
|
40
40
|
})),
|
|
41
41
|
);
|
|
42
42
|
|
|
@@ -56,15 +56,20 @@ const DynamicTableStory = () => {
|
|
|
56
56
|
// Story definitions.
|
|
57
57
|
//
|
|
58
58
|
|
|
59
|
-
const meta
|
|
59
|
+
const meta = {
|
|
60
60
|
title: 'ui/react-ui-table/DynamicTable',
|
|
61
61
|
component: DynamicTable,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' }), withRegistry],
|
|
63
|
+
parameters: {
|
|
64
|
+
layout: 'fullscreen',
|
|
65
|
+
translations,
|
|
66
|
+
},
|
|
67
|
+
} satisfies Meta<typeof DynamicTable>;
|
|
65
68
|
|
|
66
69
|
export default meta;
|
|
67
70
|
|
|
71
|
+
type Story = StoryObj<typeof meta>;
|
|
72
|
+
|
|
68
73
|
export const Default: StoryObj = {
|
|
69
74
|
render: DynamicTableStory,
|
|
70
75
|
};
|
|
@@ -97,7 +102,7 @@ export const WithClickToSelect: StoryObj = {
|
|
|
97
102
|
|
|
98
103
|
export const WithJsonSchema: StoryObj = {
|
|
99
104
|
render: () => {
|
|
100
|
-
const schema = useMemo<
|
|
105
|
+
const schema = useMemo<Types.DeepMutable<JsonSchema.JsonSchema>>(
|
|
101
106
|
() => ({
|
|
102
107
|
type: 'object',
|
|
103
108
|
properties: {
|
|
@@ -113,10 +118,10 @@ export const WithJsonSchema: StoryObj = {
|
|
|
113
118
|
|
|
114
119
|
const [rows] = useState<any[]>(
|
|
115
120
|
Array.from({ length: 15 }, () => ({
|
|
116
|
-
name:
|
|
117
|
-
age:
|
|
118
|
-
email:
|
|
119
|
-
active:
|
|
121
|
+
name: random.person.fullName(),
|
|
122
|
+
age: random.number.int({ min: 18, max: 80 }),
|
|
123
|
+
email: random.internet.email(),
|
|
124
|
+
active: random.datatype.boolean(),
|
|
120
125
|
})),
|
|
121
126
|
);
|
|
122
127
|
|
|
@@ -126,10 +131,9 @@ export const WithJsonSchema: StoryObj = {
|
|
|
126
131
|
|
|
127
132
|
export const WithEchoSchema: StoryObj = {
|
|
128
133
|
render: () => {
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const objects = useQuery(space, schema ? Filter.type(schema) : Filter.nothing());
|
|
134
|
+
const { space } = useClientStory();
|
|
135
|
+
const schema = useSchema(space?.db, TestSchema.Person.typename);
|
|
136
|
+
const objects = useQuery(space?.db, schema ? Filter.type(schema) : Filter.nothing());
|
|
133
137
|
if (!schema) {
|
|
134
138
|
return <div>Loading schema...</div>;
|
|
135
139
|
}
|
|
@@ -138,15 +142,15 @@ export const WithEchoSchema: StoryObj = {
|
|
|
138
142
|
},
|
|
139
143
|
decorators: [
|
|
140
144
|
withClientProvider({
|
|
141
|
-
types: [
|
|
145
|
+
types: [TestSchema.Person],
|
|
142
146
|
createIdentity: true,
|
|
143
147
|
createSpace: true,
|
|
144
|
-
|
|
148
|
+
onCreateSpace: async ({ space }) => {
|
|
145
149
|
Array.from({ length: 10 }).forEach(() => {
|
|
146
150
|
space.db.add(
|
|
147
|
-
Obj.make(
|
|
148
|
-
name:
|
|
149
|
-
email:
|
|
151
|
+
Obj.make(TestSchema.Person, {
|
|
152
|
+
name: random.person.fullName(),
|
|
153
|
+
email: random.internet.email(),
|
|
150
154
|
}),
|
|
151
155
|
);
|
|
152
156
|
});
|
|
@@ -2,24 +2,28 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Types from 'effect/Types';
|
|
7
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import { type
|
|
9
|
+
import { type Type } from '@dxos/echo';
|
|
10
|
+
import { type JsonSchema } from '@dxos/echo';
|
|
9
11
|
import { type ThemedClassName, useDefaultValue } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
12
|
+
import { type ProjectionModel } from '@dxos/schema';
|
|
13
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
14
|
|
|
12
|
-
import { Table, type TableController } from './Table';
|
|
13
15
|
import { useTableModel } from '../../hooks';
|
|
14
16
|
import { type TableFeatures, TablePresentation, type TableRowAction } from '../../model';
|
|
15
|
-
import {
|
|
17
|
+
import { type Table as TableType } from '../../types';
|
|
18
|
+
import { type TablePropertyDefinition, getBaseSchema, makeDynamicTable } from '../../util';
|
|
19
|
+
import { Table, type TableController } from './Table';
|
|
16
20
|
|
|
17
|
-
type DynamicTableProps = ThemedClassName<{
|
|
21
|
+
export type DynamicTableProps<T extends Type.AnyEntity = Type.AnyEntity> = ThemedClassName<{
|
|
22
|
+
schema?: T;
|
|
18
23
|
name?: string; // TODO(burdon): Remove?
|
|
19
24
|
rows: any[];
|
|
20
25
|
properties?: TablePropertyDefinition[];
|
|
21
|
-
jsonSchema?:
|
|
22
|
-
schema?: Schema.Schema.AnyNoContext;
|
|
26
|
+
jsonSchema?: Types.DeepMutable<JsonSchema.JsonSchema>;
|
|
23
27
|
features?: Partial<TableFeatures>;
|
|
24
28
|
rowActions?: TableRowAction[];
|
|
25
29
|
onRowClick?: (row: any) => void;
|
|
@@ -31,23 +35,30 @@ type DynamicTableProps = ThemedClassName<{
|
|
|
31
35
|
*/
|
|
32
36
|
// TODO(burdon): Instead of creating component variants, create helpers/hooks that normalize the props.
|
|
33
37
|
// TODO(burdon): Warning: Cannot update a component (`DynamicTable`) while rendering a different component (`DynamicTable`).
|
|
34
|
-
export const DynamicTable = ({
|
|
38
|
+
export const DynamicTable = <T extends Type.AnyEntity = Type.AnyEntity>({
|
|
35
39
|
classNames,
|
|
36
|
-
|
|
40
|
+
schema,
|
|
41
|
+
name = 'com.example.dynamicTable', // Remove default or make random; this will lead to type collisions.
|
|
37
42
|
rows,
|
|
38
43
|
properties,
|
|
39
|
-
jsonSchema,
|
|
40
|
-
schema,
|
|
44
|
+
jsonSchema: jsonSchemaProp,
|
|
41
45
|
rowActions,
|
|
42
46
|
onRowClick,
|
|
43
47
|
onRowAction,
|
|
44
48
|
...props
|
|
45
|
-
}: DynamicTableProps) => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
}: DynamicTableProps<T>) => {
|
|
50
|
+
const registry = useContext(RegistryContext);
|
|
51
|
+
const [dynamicTable, setDynamicTable] = useState<{ object: TableType.Table; projection: ProjectionModel }>();
|
|
52
|
+
|
|
53
|
+
// TODO(burdon): Remove variance from the props (should be normalized externally; possibly via hooks).
|
|
54
|
+
const { jsonSchema } = useMemo(
|
|
55
|
+
() => getBaseSchema({ typename: name, properties, jsonSchema: jsonSchemaProp, schema }),
|
|
56
|
+
[name, properties, jsonSchemaProp, schema],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
setDynamicTable(makeDynamicTable({ registry, jsonSchema, properties }));
|
|
61
|
+
}, [registry, jsonSchema, properties]);
|
|
51
62
|
|
|
52
63
|
const tableRef = useRef<TableController>(null);
|
|
53
64
|
const handleCellUpdate = useCallback((cell: any) => {
|
|
@@ -68,9 +79,9 @@ export const DynamicTable = ({
|
|
|
68
79
|
);
|
|
69
80
|
|
|
70
81
|
const model = useTableModel({
|
|
71
|
-
table,
|
|
72
82
|
rows,
|
|
73
|
-
|
|
83
|
+
object: dynamicTable?.object,
|
|
84
|
+
projection: dynamicTable?.projection,
|
|
74
85
|
features,
|
|
75
86
|
rowActions,
|
|
76
87
|
onCellUpdate: handleCellUpdate,
|
|
@@ -80,22 +91,15 @@ export const DynamicTable = ({
|
|
|
80
91
|
|
|
81
92
|
const presentation = useMemo(() => {
|
|
82
93
|
if (model) {
|
|
83
|
-
return new TablePresentation(model);
|
|
94
|
+
return new TablePresentation(registry, model);
|
|
84
95
|
}
|
|
85
|
-
}, [model]);
|
|
96
|
+
}, [registry, model]);
|
|
86
97
|
|
|
87
|
-
// TODO(burdon): Do we need the outer divs?
|
|
88
98
|
return (
|
|
89
|
-
<div role='none' className={mx('
|
|
90
|
-
<div role='none' className='grid min-
|
|
91
|
-
<Table.Root>
|
|
92
|
-
<Table.
|
|
93
|
-
ref={tableRef}
|
|
94
|
-
model={model}
|
|
95
|
-
presentation={presentation}
|
|
96
|
-
ignoreAttention
|
|
97
|
-
onRowClick={onRowClick}
|
|
98
|
-
/>
|
|
99
|
+
<div role='none' className={mx('dx-expander grid', classNames)}>
|
|
100
|
+
<div role='none' className='grid min-h-0 overflow-hidden'>
|
|
101
|
+
<Table.Root ref={tableRef}>
|
|
102
|
+
<Table.Content model={model} presentation={presentation} ignoreAttention onRowClick={onRowClick} />
|
|
99
103
|
</Table.Root>
|
|
100
104
|
</div>
|
|
101
105
|
</div>
|