@dxos/react-ui-grid 0.8.4-main.cb12b3f963 → 0.8.4-main.d05539e30a
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +15 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/CellEditor/CellEditor.d.ts.map +1 -1
- package/dist/types/src/Grid/Grid.stories.d.ts +4 -0
- package/dist/types/src/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -17
- package/src/CellEditor/CellEditor.tsx +16 -5
- package/src/Grid/Grid.stories.tsx +24 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-grid",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.d05539e30a",
|
|
4
4
|
"description": "React component which manages a `dx-grid` Lit web component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
19
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
19
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
20
|
+
"node": "./dist/lib/browser/index.mjs"
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -27,34 +28,34 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@codemirror/autocomplete": "^6.19.0",
|
|
29
30
|
"@codemirror/state": "^6.5.2",
|
|
30
|
-
"@codemirror/view": "^6.38.
|
|
31
|
+
"@codemirror/view": "^6.38.5",
|
|
31
32
|
"@lit/react": "^1.0.8",
|
|
32
33
|
"@radix-ui/react-context": "1.1.1",
|
|
33
34
|
"@radix-ui/react-popper": "1.2.2",
|
|
34
35
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
35
|
-
"@dxos/lit-grid": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/ui-editor": "0.8.4-main.
|
|
38
|
-
"@dxos/
|
|
36
|
+
"@dxos/lit-grid": "0.8.4-main.d05539e30a",
|
|
37
|
+
"@dxos/util": "0.8.4-main.d05539e30a",
|
|
38
|
+
"@dxos/ui-editor": "0.8.4-main.d05539e30a",
|
|
39
|
+
"@dxos/react-ui-editor": "0.8.4-main.d05539e30a"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@types/react": "~19.2.7",
|
|
42
43
|
"@types/react-dom": "~19.2.3",
|
|
43
44
|
"react": "~19.2.3",
|
|
44
45
|
"react-dom": "~19.2.3",
|
|
45
|
-
"vite": "^8.0.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
46
|
+
"vite": "^8.0.13",
|
|
47
|
+
"@dxos/react-ui": "0.8.4-main.d05539e30a",
|
|
48
|
+
"@dxos/random": "0.8.4-main.d05539e30a",
|
|
49
|
+
"@dxos/react-ui-search": "0.8.4-main.d05539e30a",
|
|
50
|
+
"@dxos/react-ui-list": "0.8.4-main.d05539e30a",
|
|
51
|
+
"@dxos/ui-theme": "0.8.4-main.d05539e30a",
|
|
52
|
+
"@dxos/storybook-utils": "0.8.4-main.d05539e30a"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"react": "~19.2.3",
|
|
55
56
|
"react-dom": "~19.2.3",
|
|
56
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
57
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
57
|
+
"@dxos/react-ui": "0.8.4-main.d05539e30a",
|
|
58
|
+
"@dxos/ui-theme": "0.8.4-main.d05539e30a"
|
|
58
59
|
},
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
@@ -132,11 +132,22 @@ export const CellEditor = ({ value, extensions, box, gridId, autoFocus, slots, o
|
|
|
132
132
|
extensions: [
|
|
133
133
|
extensions ?? [],
|
|
134
134
|
filterChars(/[\n\r]+/),
|
|
135
|
-
EditorView.focusChangeEffect
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
// Observe the underlying blur DOM event rather than `EditorView.focusChangeEffect`. The
|
|
136
|
+
// focus-change facet fires asynchronously (CodeMirror schedules it on a 10ms setTimeout),
|
|
137
|
+
// which means in React strict mode the destroy → blur of the first EditorView runs the
|
|
138
|
+
// callback after the second view has mounted — committing stale data and closing the
|
|
139
|
+
// editor on the user's first keystroke. Deferring via `queueMicrotask` runs the check
|
|
140
|
+
// *after* `view.destroy()` finishes its synchronous body (which calls `dom.remove()`),
|
|
141
|
+
// so `view.dom.isConnected === false` reliably distinguishes a programmatic teardown
|
|
142
|
+
// from a real user blur. Pass `undefined` on teardown so downstream handlers can consume
|
|
143
|
+
// any pending suppress-next-blur flag without committing stale data.
|
|
144
|
+
EditorView.domEventObservers({
|
|
145
|
+
blur: (_event, view) => {
|
|
146
|
+
const doc = view.state.doc.toString();
|
|
147
|
+
queueMicrotask(() => {
|
|
148
|
+
onBlur?.(view.dom.isConnected ? doc : undefined);
|
|
149
|
+
});
|
|
150
|
+
},
|
|
140
151
|
}),
|
|
141
152
|
createBasicExtensions({ lineWrapping: true }),
|
|
142
153
|
createThemeExtensions({
|
|
@@ -65,7 +65,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
65
65
|
}, []);
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
|
-
<div
|
|
68
|
+
<div className='contents'>
|
|
69
69
|
<Grid.Root id='story' editing={editing} onEditingChange={handleEditingChange}>
|
|
70
70
|
{/* TODO(burdon): Why is this property not just "cells" or "values" */}
|
|
71
71
|
<Grid.Content {...props} initialCells={cells} onClick={handleClick} />
|
|
@@ -127,6 +127,29 @@ type Story = StoryObj<typeof meta>;
|
|
|
127
127
|
|
|
128
128
|
export const Default: Story = {};
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Single focusable cell — for verifying focus-ring alignment with grid lines.
|
|
132
|
+
*/
|
|
133
|
+
export const SingleCell: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
id: 'story',
|
|
136
|
+
limitColumns: 1,
|
|
137
|
+
limitRows: 1,
|
|
138
|
+
columnDefault: { grid: { size: 200, resizeable: false } },
|
|
139
|
+
rowDefault: { grid: { size: 32, resizeable: false } },
|
|
140
|
+
initialCells: {
|
|
141
|
+
grid: {
|
|
142
|
+
'0,0': { value: 'Focus me' },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
render: (args) => (
|
|
147
|
+
<div className='h-full grid place-items-center'>
|
|
148
|
+
<GridStory {...args} />
|
|
149
|
+
</div>
|
|
150
|
+
),
|
|
151
|
+
};
|
|
152
|
+
|
|
130
153
|
export const Basic: Story = {
|
|
131
154
|
args: {
|
|
132
155
|
id: 'story',
|