@dxos/react-ui-grid 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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/index.mjs +12 -11
- 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 +3 -3
- package/dist/types/src/CellEditor/CellEditor.d.ts.map +1 -1
- package/dist/types/src/CellEditor/CellEditor.stories.d.ts +12 -4
- package/dist/types/src/CellEditor/CellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/CellEditor/GridCellEditor.d.ts +3 -3
- package/dist/types/src/CellEditor/GridCellEditor.d.ts.map +1 -1
- package/dist/types/src/Grid/Grid.d.ts +4 -4
- package/dist/types/src/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/Grid/Grid.stories.d.ts +12 -4
- package/dist/types/src/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -22
- package/src/CellEditor/CellEditor.stories.tsx +10 -12
- package/src/CellEditor/CellEditor.tsx +12 -10
- package/src/CellEditor/GridCellEditor.tsx +5 -4
- package/src/Grid/Grid.stories.tsx +55 -30
- package/src/Grid/Grid.tsx +11 -8
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.3c1ae3b",
|
|
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",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
}
|
|
@@ -23,35 +24,35 @@
|
|
|
23
24
|
"src"
|
|
24
25
|
],
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@codemirror/autocomplete": "^6.
|
|
27
|
-
"@codemirror/state": "^6.
|
|
28
|
-
"@codemirror/view": "^6.
|
|
29
|
-
"@lit/react": "^1.0.
|
|
27
|
+
"@codemirror/autocomplete": "^6.19.0",
|
|
28
|
+
"@codemirror/state": "^6.5.2",
|
|
29
|
+
"@codemirror/view": "^6.38.4",
|
|
30
|
+
"@lit/react": "^1.0.8",
|
|
30
31
|
"@preact-signals/safe-react": "^0.9.0",
|
|
31
32
|
"@radix-ui/react-context": "1.1.1",
|
|
32
33
|
"@radix-ui/react-popper": "1.2.2",
|
|
33
34
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
34
|
-
"@dxos/lit-grid": "0.8.4-main.
|
|
35
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
36
|
-
"@dxos/util": "0.8.4-main.
|
|
35
|
+
"@dxos/lit-grid": "0.8.4-main.3c1ae3b",
|
|
36
|
+
"@dxos/react-ui-editor": "0.8.4-main.3c1ae3b",
|
|
37
|
+
"@dxos/util": "0.8.4-main.3c1ae3b"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@types/react": "~
|
|
40
|
-
"@types/react-dom": "~
|
|
41
|
-
"react": "~
|
|
42
|
-
"react-dom": "~
|
|
43
|
-
"vite": "
|
|
44
|
-
"@dxos/random": "0.8.4-main.
|
|
45
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
46
|
-
"@dxos/react-ui-searchlist": "0.8.4-main.
|
|
47
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
48
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
40
|
+
"@types/react": "~19.2.2",
|
|
41
|
+
"@types/react-dom": "~19.2.2",
|
|
42
|
+
"react": "~19.2.0",
|
|
43
|
+
"react-dom": "~19.2.0",
|
|
44
|
+
"vite": "7.1.9",
|
|
45
|
+
"@dxos/random": "0.8.4-main.3c1ae3b",
|
|
46
|
+
"@dxos/react-ui": "0.8.4-main.3c1ae3b",
|
|
47
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.3c1ae3b",
|
|
48
|
+
"@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
|
|
49
|
+
"@dxos/storybook-utils": "0.8.4-main.3c1ae3b"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
53
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
54
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
52
|
+
"react": "^19.0.0",
|
|
53
|
+
"react-dom": "^19.0.0",
|
|
54
|
+
"@dxos/react-ui": "0.8.4-main.3c1ae3b",
|
|
55
|
+
"@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
|
|
55
56
|
},
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import { withTheme } from '@dxos/
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { CellEditor, type CellEditorProps, type EditorKeyEvent, editorKeys } from './CellEditor';
|
|
13
11
|
|
|
14
|
-
const DefaultStory = (
|
|
15
|
-
const [value, setValue] = useState(
|
|
12
|
+
const DefaultStory = (props: CellEditorProps) => {
|
|
13
|
+
const [value, setValue] = useState(props.value || 'Edit me');
|
|
16
14
|
const [lastAction, setLastAction] = useState<string>('');
|
|
17
15
|
|
|
18
16
|
const handleBlur = (newValue?: string) => {
|
|
@@ -32,7 +30,7 @@ const DefaultStory = (args: CellEditorProps) => {
|
|
|
32
30
|
};
|
|
33
31
|
|
|
34
32
|
// Create an extension with editor keys
|
|
35
|
-
const
|
|
33
|
+
const extensions = props.extensions || [
|
|
36
34
|
editorKeys({
|
|
37
35
|
onClose: handleKeyEvent,
|
|
38
36
|
onNav: (value, event) => {
|
|
@@ -49,11 +47,11 @@ const DefaultStory = (args: CellEditorProps) => {
|
|
|
49
47
|
<div className='text-sm'>
|
|
50
48
|
Last action: <span className='font-mono'>{lastAction}</span>
|
|
51
49
|
</div>
|
|
52
|
-
<div className='relative border border-separator
|
|
50
|
+
<div className='relative border border-separator bs-[100px] is-[300px]'>
|
|
53
51
|
<CellEditor
|
|
54
52
|
value={value}
|
|
55
|
-
|
|
56
|
-
autoFocus={
|
|
53
|
+
extensions={extensions}
|
|
54
|
+
autoFocus={props.autoFocus}
|
|
57
55
|
onBlur={handleBlur}
|
|
58
56
|
box={{
|
|
59
57
|
insetInlineStart: 10,
|
|
@@ -68,7 +66,7 @@ const DefaultStory = (args: CellEditorProps) => {
|
|
|
68
66
|
);
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
const meta
|
|
69
|
+
const meta = {
|
|
72
70
|
title: 'ui/react-ui-grid/CellEditor',
|
|
73
71
|
component: CellEditor,
|
|
74
72
|
render: DefaultStory,
|
|
@@ -76,11 +74,11 @@ const meta: Meta<CellEditorProps> = {
|
|
|
76
74
|
parameters: {
|
|
77
75
|
layout: 'centered',
|
|
78
76
|
},
|
|
79
|
-
}
|
|
77
|
+
} satisfies Meta<typeof CellEditor>;
|
|
80
78
|
|
|
81
79
|
export default meta;
|
|
82
80
|
|
|
83
|
-
type Story = StoryObj<
|
|
81
|
+
type Story = StoryObj<typeof meta>;
|
|
84
82
|
|
|
85
83
|
export const Default: Story = {
|
|
86
84
|
args: {
|
|
@@ -9,12 +9,12 @@ import React, { type KeyboardEvent } from 'react';
|
|
|
9
9
|
|
|
10
10
|
import { useThemeContext } from '@dxos/react-ui';
|
|
11
11
|
import {
|
|
12
|
+
type ThemeExtensionsOptions,
|
|
12
13
|
type UseTextEditorProps,
|
|
13
14
|
createBasicExtensions,
|
|
14
15
|
createThemeExtensions,
|
|
15
|
-
|
|
16
|
+
filterChars,
|
|
16
17
|
useTextEditor,
|
|
17
|
-
type ThemeExtensionsOptions,
|
|
18
18
|
} from '@dxos/react-ui-editor';
|
|
19
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
20
|
|
|
@@ -116,14 +116,14 @@ export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
|
|
|
116
116
|
|
|
117
117
|
export type CellEditorProps = {
|
|
118
118
|
value?: string;
|
|
119
|
-
|
|
119
|
+
extensions?: Extension;
|
|
120
120
|
box?: GridEditBox;
|
|
121
121
|
gridId?: string;
|
|
122
122
|
onBlur?: EditorBlurHandler;
|
|
123
123
|
} & Pick<UseTextEditorProps, 'autoFocus'> &
|
|
124
124
|
Pick<ThemeExtensionsOptions, 'slots'>;
|
|
125
125
|
|
|
126
|
-
export const CellEditor = ({ value,
|
|
126
|
+
export const CellEditor = ({ value, extensions, box, gridId, onBlur, autoFocus, slots }: CellEditorProps) => {
|
|
127
127
|
const { themeMode } = useThemeContext();
|
|
128
128
|
const { parentRef } = useTextEditor(() => {
|
|
129
129
|
return {
|
|
@@ -131,8 +131,8 @@ export const CellEditor = ({ value, extension, autoFocus, onBlur, box, gridId, s
|
|
|
131
131
|
initialValue: value,
|
|
132
132
|
selection: { anchor: value?.length ?? 0 },
|
|
133
133
|
extensions: [
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
extensions ?? [],
|
|
135
|
+
filterChars(/[\n\r]+/),
|
|
136
136
|
EditorView.focusChangeEffect.of((state, focusing) => {
|
|
137
137
|
if (!focusing) {
|
|
138
138
|
onBlur?.(state.doc.toString());
|
|
@@ -149,18 +149,20 @@ export const CellEditor = ({ value, extension, autoFocus, onBlur, box, gridId, s
|
|
|
149
149
|
slots?.editor?.className,
|
|
150
150
|
),
|
|
151
151
|
},
|
|
152
|
-
|
|
152
|
+
scroll: {
|
|
153
153
|
className: mx(
|
|
154
154
|
'!overflow-x-hidden !plb-[max(0,calc(var(--dx-grid-cell-editor-padding-block)-1px))] !pie-0 !pis-[--dx-grid-cell-editor-padding-inline]',
|
|
155
|
-
slots?.
|
|
155
|
+
slots?.scroll?.className,
|
|
156
156
|
),
|
|
157
157
|
},
|
|
158
|
-
content: {
|
|
158
|
+
content: {
|
|
159
|
+
className: mx('!break-normal', slots?.content?.className),
|
|
160
|
+
},
|
|
159
161
|
},
|
|
160
162
|
}),
|
|
161
163
|
],
|
|
162
164
|
};
|
|
163
|
-
}, [
|
|
165
|
+
}, [extensions, autoFocus, value, onBlur, themeMode, slots]);
|
|
164
166
|
|
|
165
167
|
return (
|
|
166
168
|
<div
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type DxGridCellIndex, type GridScopedProps, useGridContext } from '../Grid';
|
|
8
|
+
|
|
7
9
|
import { CellEditor, type CellEditorProps } from './CellEditor';
|
|
8
|
-
import { type GridScopedProps, useGridContext, type DxGridCellIndex } from '../Grid';
|
|
9
10
|
|
|
10
11
|
export type GridCellEditorProps = GridScopedProps<
|
|
11
|
-
Pick<CellEditorProps, '
|
|
12
|
+
Pick<CellEditorProps, 'extensions' | 'onBlur' | 'slots'> & {
|
|
12
13
|
getCellContent: (index: DxGridCellIndex) => string | undefined;
|
|
13
14
|
}
|
|
14
15
|
>;
|
|
15
16
|
|
|
16
|
-
export const GridCellEditor = ({
|
|
17
|
+
export const GridCellEditor = ({ extensions, getCellContent, onBlur, slots, __gridScope }: GridCellEditorProps) => {
|
|
17
18
|
const { id, editing, setEditing, editBox } = useGridContext('GridCellEditor', __gridScope);
|
|
18
19
|
|
|
19
20
|
const handleBlur = useCallback(
|
|
@@ -30,7 +31,7 @@ export const GridCellEditor = ({ extension, getCellContent, onBlur, slots, __gri
|
|
|
30
31
|
autoFocus
|
|
31
32
|
box={editBox}
|
|
32
33
|
onBlur={handleBlur}
|
|
33
|
-
|
|
34
|
+
extensions={extensions}
|
|
34
35
|
gridId={id}
|
|
35
36
|
slots={slots}
|
|
36
37
|
/>
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { type MouseEvent, type MutableRefObject, useCallback, useRef, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { defaultRowSize } from '@dxos/lit-grid';
|
|
9
|
+
import { type DxGridPlaneCells } from '@dxos/lit-grid';
|
|
11
10
|
import { faker } from '@dxos/random';
|
|
12
11
|
import { DropdownMenu } from '@dxos/react-ui';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { toPlaneCellIndex } from '@dxos/react-ui-grid';
|
|
14
|
+
import { Combobox, type ComboboxRootProps } from '@dxos/react-ui-searchlist';
|
|
15
15
|
|
|
16
|
-
import { Grid, type
|
|
16
|
+
import { Grid, type GridContentProps, type GridEditing, type GridRootProps } from './Grid';
|
|
17
17
|
|
|
18
18
|
const storybookItems = faker.helpers.uniqueArray(faker.commerce.productName, 16);
|
|
19
19
|
|
|
@@ -33,7 +33,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
33
33
|
// Multiselect
|
|
34
34
|
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
35
35
|
const [multiSelectValue, setInternalMultiselectValue] = useState('');
|
|
36
|
-
const setMultiselectValue = useCallback<NonNullable<
|
|
36
|
+
const setMultiselectValue = useCallback<NonNullable<ComboboxRootProps['onValueChange']>>((nextValue) => {
|
|
37
37
|
setInternalMultiselectValue(nextValue);
|
|
38
38
|
setCells((cells) => {
|
|
39
39
|
// TODO(burdon): How can we get the cell address to update?
|
|
@@ -64,7 +64,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
64
64
|
}, []);
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
|
-
<div role='none' className='
|
|
67
|
+
<div role='none' className='contents'>
|
|
68
68
|
<Grid.Root id='story' editing={editing} onEditingChange={handleEditingChange}>
|
|
69
69
|
{/* TODO(burdon): Why is this property not just "cells" or "values" */}
|
|
70
70
|
<Grid.Content {...props} initialCells={cells} onClick={handleClick} />
|
|
@@ -80,38 +80,42 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
80
80
|
</DropdownMenu.Root>
|
|
81
81
|
|
|
82
82
|
{/* Multiselect */}
|
|
83
|
-
<
|
|
83
|
+
<Combobox.Root
|
|
84
84
|
open={popoverOpen}
|
|
85
85
|
onOpenChange={setPopoverOpen}
|
|
86
86
|
value={multiSelectValue}
|
|
87
87
|
onValueChange={setMultiselectValue}
|
|
88
88
|
>
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<
|
|
89
|
+
<Combobox.VirtualTrigger virtualRef={triggerRef} />
|
|
90
|
+
<Combobox.Content filter={(value, search) => (value.includes(search) ? 1 : 0)}>
|
|
91
|
+
<Combobox.Input placeholder='Search...' />
|
|
92
|
+
<Combobox.List>
|
|
93
93
|
{storybookItems.map((value) => (
|
|
94
|
-
<
|
|
94
|
+
<Combobox.Item key={value}>{value}</Combobox.Item>
|
|
95
95
|
))}
|
|
96
|
-
</
|
|
97
|
-
<
|
|
98
|
-
</
|
|
99
|
-
</
|
|
96
|
+
</Combobox.List>
|
|
97
|
+
<Combobox.Arrow />
|
|
98
|
+
</Combobox.Content>
|
|
99
|
+
</Combobox.Root>
|
|
100
100
|
</div>
|
|
101
101
|
);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
const meta
|
|
104
|
+
const meta = {
|
|
105
105
|
title: 'ui/react-ui-grid/Grid',
|
|
106
106
|
component: GridStory,
|
|
107
|
-
decorators: [withTheme],
|
|
108
|
-
parameters: {
|
|
109
|
-
|
|
107
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
108
|
+
parameters: {
|
|
109
|
+
layout: 'fullscreen',
|
|
110
|
+
},
|
|
111
|
+
} satisfies Meta<typeof GridStory>;
|
|
110
112
|
|
|
111
113
|
export default meta;
|
|
112
114
|
|
|
113
115
|
type Story = StoryObj<typeof meta>;
|
|
114
116
|
|
|
117
|
+
export const Default: Story = {};
|
|
118
|
+
|
|
115
119
|
export const Basic: Story = {
|
|
116
120
|
args: {
|
|
117
121
|
id: 'story',
|
|
@@ -158,26 +162,47 @@ export const Basic: Story = {
|
|
|
158
162
|
},
|
|
159
163
|
};
|
|
160
164
|
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
const cellSize = 40;
|
|
166
|
+
|
|
167
|
+
// TODO(burdon): Calendar.
|
|
168
|
+
export const Calendar: Story = {
|
|
163
169
|
args: {
|
|
164
170
|
id: 'story',
|
|
165
|
-
limitColumns:
|
|
171
|
+
limitColumns: 7,
|
|
166
172
|
columnDefault: {
|
|
167
173
|
grid: {
|
|
168
|
-
size:
|
|
174
|
+
size: cellSize,
|
|
175
|
+
resizeable: false,
|
|
169
176
|
},
|
|
170
177
|
},
|
|
171
178
|
rowDefault: {
|
|
172
179
|
grid: {
|
|
173
|
-
size:
|
|
180
|
+
size: cellSize,
|
|
174
181
|
resizeable: false,
|
|
175
182
|
},
|
|
176
183
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
getCells: (range, plane) => {
|
|
185
|
+
const cells: DxGridPlaneCells = {};
|
|
186
|
+
if (plane === 'grid') {
|
|
187
|
+
for (let col = range.start.col; col <= range.end.col; col++) {
|
|
188
|
+
for (let row = range.start.row; row <= range.end.row; row++) {
|
|
189
|
+
// TODO(burdon): Formatting changes when cell is selected.
|
|
190
|
+
cells[toPlaneCellIndex({ col, row })] = {
|
|
191
|
+
readonly: true,
|
|
192
|
+
accessoryHtml: '<div class="flex bs-full is-full justify-center items-center overflow-hidden">0</div>',
|
|
193
|
+
className: '',
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return cells;
|
|
181
199
|
},
|
|
182
200
|
},
|
|
201
|
+
render: (args) => (
|
|
202
|
+
<div className='bs-full flex justify-center'>
|
|
203
|
+
<div className='bs-full is-[288px] border-x border-separator'>
|
|
204
|
+
<GridStory {...args} />
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
),
|
|
183
208
|
};
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos/lit-grid/dx-grid.pcss';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { type EventName, createComponent } from '@lit/react';
|
|
8
|
+
import { type Scope, createContextScope } from '@radix-ui/react-context';
|
|
9
9
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
10
10
|
import React, {
|
|
11
11
|
type ComponentProps,
|
|
@@ -63,7 +63,9 @@ const [createGridContext, createGridScope] = createContextScope(GRID_NAME, []);
|
|
|
63
63
|
const [GridProvider, useGridContext] = createGridContext<GridContextValue>(GRID_NAME);
|
|
64
64
|
|
|
65
65
|
type GridRootProps = PropsWithChildren<
|
|
66
|
-
{
|
|
66
|
+
{
|
|
67
|
+
id: string;
|
|
68
|
+
} & Partial<{
|
|
67
69
|
editing: GridEditing;
|
|
68
70
|
defaultEditing: GridEditing;
|
|
69
71
|
onEditingChange: (nextEditing: GridEditing) => void;
|
|
@@ -71,12 +73,12 @@ type GridRootProps = PropsWithChildren<
|
|
|
71
73
|
>;
|
|
72
74
|
|
|
73
75
|
const GridRoot = ({
|
|
76
|
+
__gridScope,
|
|
77
|
+
children,
|
|
74
78
|
id,
|
|
75
79
|
editing: propsEditing,
|
|
76
80
|
defaultEditing,
|
|
77
81
|
onEditingChange,
|
|
78
|
-
children,
|
|
79
|
-
__gridScope,
|
|
80
82
|
}: GridScopedProps<GridRootProps>) => {
|
|
81
83
|
const [editing = null, setEditing] = useControllableState({
|
|
82
84
|
prop: propsEditing,
|
|
@@ -102,13 +104,13 @@ const GridRoot = ({
|
|
|
102
104
|
|
|
103
105
|
GridRoot.displayName = GRID_NAME;
|
|
104
106
|
|
|
107
|
+
const GRID_CONTENT_NAME = 'GridContent';
|
|
108
|
+
|
|
105
109
|
type GridContentProps = Omit<ComponentProps<typeof DxGrid>, 'onEdit'> & {
|
|
106
110
|
getCells?: NaturalDxGrid['getCells'];
|
|
107
111
|
activeRefs?: string;
|
|
108
112
|
};
|
|
109
113
|
|
|
110
|
-
const GRID_CONTENT_NAME = 'GridContent';
|
|
111
|
-
|
|
112
114
|
const GridContent = forwardRef<NaturalDxGrid, GridScopedProps<GridContentProps>>((props, forwardedRef) => {
|
|
113
115
|
const { id, editing, setEditBox, setEditing } = useGridContext(GRID_CONTENT_NAME, props.__gridScope);
|
|
114
116
|
const [dxGrid, setDxGridInternal] = useState<NaturalDxGrid | null>(null);
|
|
@@ -166,7 +168,7 @@ export const Grid = {
|
|
|
166
168
|
Content: GridContent,
|
|
167
169
|
};
|
|
168
170
|
|
|
169
|
-
export { GridRoot, GridContent,
|
|
171
|
+
export { GridRoot, GridContent, createGridScope, gridSeparatorInlineEnd, gridSeparatorBlockEnd, useGridContext };
|
|
170
172
|
|
|
171
173
|
export type { GridRootProps, GridContentProps, GridEditing, GridEditBox, GridScopedProps, DxGridElement };
|
|
172
174
|
|
|
@@ -178,6 +180,7 @@ export {
|
|
|
178
180
|
toPlaneCellIndex,
|
|
179
181
|
parseCellIndex,
|
|
180
182
|
cellQuery,
|
|
183
|
+
DxEditRequest,
|
|
181
184
|
} from '@dxos/lit-grid';
|
|
182
185
|
|
|
183
186
|
export type {
|