@dxos/react-ui-grid 0.8.4-main.406dc2a → 0.8.4-main.548089c
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/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.548089c",
|
|
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",
|
|
@@ -32,27 +32,27 @@
|
|
|
32
32
|
"@radix-ui/react-context": "1.1.1",
|
|
33
33
|
"@radix-ui/react-popper": "1.2.2",
|
|
34
34
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
35
|
-
"@dxos/lit-grid": "0.8.4-main.
|
|
36
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
37
|
-
"@dxos/util": "0.8.4-main.
|
|
35
|
+
"@dxos/lit-grid": "0.8.4-main.548089c",
|
|
36
|
+
"@dxos/react-ui-editor": "0.8.4-main.548089c",
|
|
37
|
+
"@dxos/util": "0.8.4-main.548089c"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "~19.2.2",
|
|
41
|
-
"@types/react-dom": "~19.2.
|
|
41
|
+
"@types/react-dom": "~19.2.2",
|
|
42
42
|
"react": "~19.2.0",
|
|
43
43
|
"react-dom": "~19.2.0",
|
|
44
44
|
"vite": "7.1.9",
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/react-ui-searchlist": "0.8.4-main.
|
|
48
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
49
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
45
|
+
"@dxos/react-ui": "0.8.4-main.548089c",
|
|
46
|
+
"@dxos/random": "0.8.4-main.548089c",
|
|
47
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.548089c",
|
|
48
|
+
"@dxos/react-ui-theme": "0.8.4-main.548089c",
|
|
49
|
+
"@dxos/storybook-utils": "0.8.4-main.548089c"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^19.0.0",
|
|
53
53
|
"react-dom": "^19.0.0",
|
|
54
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
55
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
54
|
+
"@dxos/react-ui": "0.8.4-main.548089c",
|
|
55
|
+
"@dxos/react-ui-theme": "0.8.4-main.548089c"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
@@ -6,9 +6,11 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { type MouseEvent, type MutableRefObject, useCallback, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { defaultRowSize } from '@dxos/lit-grid';
|
|
9
|
+
import { type DxGridPlaneCells } from '@dxos/lit-grid';
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
import { DropdownMenu } from '@dxos/react-ui';
|
|
11
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { toPlaneCellIndex } from '@dxos/react-ui-grid';
|
|
12
14
|
import { Combobox, type ComboboxRootProps } from '@dxos/react-ui-searchlist';
|
|
13
15
|
|
|
14
16
|
import { Grid, type GridContentProps, type GridEditing, type GridRootProps } from './Grid';
|
|
@@ -62,7 +64,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
62
64
|
}, []);
|
|
63
65
|
|
|
64
66
|
return (
|
|
65
|
-
<div role='none' className='
|
|
67
|
+
<div role='none' className='contents'>
|
|
66
68
|
<Grid.Root id='story' editing={editing} onEditingChange={handleEditingChange}>
|
|
67
69
|
{/* TODO(burdon): Why is this property not just "cells" or "values" */}
|
|
68
70
|
<Grid.Content {...props} initialCells={cells} onClick={handleClick} />
|
|
@@ -102,7 +104,7 @@ const GridStory = ({ initialCells, ...props }: GridStoryProps) => {
|
|
|
102
104
|
const meta = {
|
|
103
105
|
title: 'ui/react-ui-grid/Grid',
|
|
104
106
|
component: GridStory,
|
|
105
|
-
decorators: [withTheme],
|
|
107
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
106
108
|
parameters: {
|
|
107
109
|
layout: 'fullscreen',
|
|
108
110
|
},
|
|
@@ -112,6 +114,8 @@ 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
|
};
|