@dxos/plugin-sheet 0.6.12-staging.e11e696 → 0.6.13-main.041e8aa
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/SheetContainer-NDNIS44E.mjs +265 -0
- package/dist/lib/browser/SheetContainer-NDNIS44E.mjs.map +7 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs +1614 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QILRZNE5.mjs → chunk-D3QTX46O.mjs} +4 -5
- package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZMOZKQZ.mjs → chunk-GKI67SEF.mjs} +19 -25
- package/dist/lib/browser/chunk-GKI67SEF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -19
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +4 -8
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs +276 -0
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +7 -0
- package/dist/lib/node/chunk-6F43RV45.cjs +1610 -0
- package/dist/lib/node/chunk-6F43RV45.cjs.map +7 -0
- package/dist/lib/node/{chunk-AOP42UAA.cjs → chunk-ER3PM7GD.cjs} +25 -33
- package/dist/lib/node/chunk-ER3PM7GD.cjs.map +7 -0
- package/dist/lib/node/{chunk-BNARJ5GM.cjs → chunk-QIFIGEKV.cjs} +6 -7
- package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
- package/dist/lib/node/index.cjs +36 -40
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +8 -12
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs +266 -0
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs +1615 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IU2L277A.mjs → chunk-VCYJWE3O.mjs} +4 -5
- package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RR2AO4SM.mjs → chunk-ZVLLQ2PJ.mjs} +19 -25
- package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +14 -19
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types.mjs +4 -8
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +1 -8
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +2 -2
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/index.d.ts +2 -0
- package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/util.d.ts +11 -2
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +6 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +11 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
- package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +27 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/index.d.ts +2 -0
- package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +31 -17
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/index.d.ts +2 -0
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +1 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/threads.d.ts +8 -0
- package/dist/types/src/hooks/threads.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -6
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/{components/Sheet → model}/decorations.d.ts +1 -0
- package/dist/types/src/model/decorations.d.ts.map +1 -0
- package/dist/types/src/model/formatting-model.d.ts +3 -0
- package/dist/types/src/model/formatting-model.d.ts.map +1 -1
- package/dist/types/src/model/index.d.ts +1 -0
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +3 -2
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +13 -28
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +36 -39
- package/src/SheetPlugin.tsx +3 -2
- package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
- package/src/components/FunctionEditor/index.ts +5 -0
- package/src/components/GridSheet/GridSheet.stories.tsx +7 -2
- package/src/components/GridSheet/GridSheet.tsx +77 -69
- package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +2 -2
- package/src/components/{Sheet → GridSheet}/index.ts +1 -1
- package/src/components/GridSheet/util.ts +63 -27
- package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -0
- package/src/components/SheetContainer/SheetContainer.tsx +52 -0
- package/src/components/SheetContainer/index.ts +7 -0
- package/src/components/{Sheet/sheet-context.tsx → SheetContext/SheetContext.tsx} +47 -27
- package/src/components/SheetContext/index.ts +5 -0
- package/src/components/Toolbar/Toolbar.tsx +127 -86
- package/src/components/index.ts +2 -1
- package/src/defs/util.ts +1 -1
- package/src/extensions/compute.stories.tsx +4 -4
- package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
- package/src/extensions/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/{components/Sheet/threads.tsx → hooks/threads.ts} +26 -84
- package/src/{meta.tsx → meta.ts} +3 -3
- package/src/{components/Sheet → model}/decorations.ts +2 -0
- package/src/model/formatting-model.ts +12 -9
- package/src/model/index.ts +1 -0
- package/src/model/sheet-model.test.ts +1 -3
- package/src/model/sheet-model.ts +13 -11
- package/src/types.ts +9 -35
- package/dist/lib/browser/SheetContainer-LG77O4RM.mjs +0 -262
- package/dist/lib/browser/SheetContainer-LG77O4RM.mjs.map +0 -7
- package/dist/lib/browser/chunk-CHQAW4F4.mjs +0 -2705
- package/dist/lib/browser/chunk-CHQAW4F4.mjs.map +0 -7
- package/dist/lib/browser/chunk-QILRZNE5.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZMOZKQZ.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-OZ7DHH4L.cjs +0 -280
- package/dist/lib/node/SheetContainer-OZ7DHH4L.cjs.map +0 -7
- package/dist/lib/node/chunk-5FTFZL5W.cjs +0 -2690
- package/dist/lib/node/chunk-5FTFZL5W.cjs.map +0 -7
- package/dist/lib/node/chunk-AOP42UAA.cjs.map +0 -7
- package/dist/lib/node/chunk-BNARJ5GM.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-4XS2G25Z.mjs +0 -263
- package/dist/lib/node-esm/SheetContainer-4XS2G25Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KK3XL37M.mjs +0 -2706
- package/dist/lib/node-esm/chunk-KK3XL37M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RR2AO4SM.mjs.map +0 -7
- package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -34
- package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/index.d.ts +0 -3
- package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -53
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/decorations.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/grid.d.ts +0 -52
- package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/index.d.ts +0 -2
- package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/nav.d.ts +0 -29
- package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -26
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/threads.d.ts +0 -2
- package/dist/types/src/components/Sheet/threads.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/util.d.ts +0 -18
- package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer.d.ts +0 -8
- package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -20
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/src/components/CellEditor/CellEditor.tsx +0 -163
- package/src/components/Sheet/Sheet.stories.tsx +0 -251
- package/src/components/Sheet/Sheet.tsx +0 -1215
- package/src/components/Sheet/grid.ts +0 -191
- package/src/components/Sheet/nav.ts +0 -157
- package/src/components/Sheet/util.ts +0 -56
- package/src/components/SheetContainer.tsx +0 -86
- package/src/components/Toolbar/common.tsx +0 -72
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +0 -0
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
- /package/src/{components/CellEditor → extensions/editor}/extension.test.ts +0 -0
- /package/src/{components/CellEditor → extensions/editor}/extension.ts +0 -0
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React, { useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { log } from '@dxos/log';
|
|
10
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
11
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
|
-
import { Button } from '@dxos/react-ui';
|
|
13
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { Sheet } from './Sheet';
|
|
17
|
-
import { type SizeMap } from './grid';
|
|
18
|
-
import { useSheetContext } from './sheet-context';
|
|
19
|
-
import { addressToIndex, rangeToIndex } from '../../defs';
|
|
20
|
-
import { type ComputeGraph } from '../../graph';
|
|
21
|
-
import { testFunctionPlugins } from '../../graph/testing';
|
|
22
|
-
import { useComputeGraph } from '../../hooks';
|
|
23
|
-
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
24
|
-
import { SheetType, ValueTypeEnum } from '../../types';
|
|
25
|
-
import { Toolbar, type ToolbarActionHandler } from '../Toolbar';
|
|
26
|
-
|
|
27
|
-
// TODO(burdon): Allow toolbar to access sheet context; provide state for current cursor/range.
|
|
28
|
-
const SheetWithToolbar = ({ graph, debug }: { graph: ComputeGraph; debug?: boolean }) => {
|
|
29
|
-
const { model, cursor, range } = useSheetContext();
|
|
30
|
-
|
|
31
|
-
const handleRefresh = () => {
|
|
32
|
-
// graph?.refresh(); // TODO(burdon): ???
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// TODO(burdon): Factor out.
|
|
36
|
-
const handleAction: ToolbarActionHandler = ({ type }) => {
|
|
37
|
-
log.info('action', { type, cursor, range });
|
|
38
|
-
if (!cursor) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const idx = range ? rangeToIndex(model.sheet, range) : addressToIndex(model.sheet, cursor);
|
|
43
|
-
model.sheet.formatting[idx] ??= {};
|
|
44
|
-
const format = model.sheet.formatting[idx];
|
|
45
|
-
|
|
46
|
-
switch (type) {
|
|
47
|
-
case 'clear': {
|
|
48
|
-
// TODO(burdon): Toggle to show all ranges to allow user to delete range.
|
|
49
|
-
format.classNames = [];
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'highlight': {
|
|
53
|
-
// TODO(burdon): Util to add to set.
|
|
54
|
-
format.classNames = ['bg-green-300 dark:bg-green-700'];
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case 'left': {
|
|
59
|
-
format.classNames = ['text-left'];
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case 'center': {
|
|
63
|
-
format.classNames = ['text-center'];
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
case 'right': {
|
|
67
|
-
format.classNames = ['text-right'];
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
case 'date': {
|
|
72
|
-
format.type = ValueTypeEnum.Date;
|
|
73
|
-
format.format = 'YYYY-MM-DD';
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case 'currency': {
|
|
77
|
-
format.type = ValueTypeEnum.Currency;
|
|
78
|
-
format.precision = 2;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case 'comment': {
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<div className='flex flex-col overflow-hidden'>
|
|
89
|
-
<Toolbar.Root onAction={handleAction}>
|
|
90
|
-
<Toolbar.Styles />
|
|
91
|
-
<Toolbar.Format />
|
|
92
|
-
<Toolbar.Alignment />
|
|
93
|
-
<Toolbar.Separator />
|
|
94
|
-
<Toolbar.Actions />
|
|
95
|
-
<Button onClick={handleRefresh}>Refresh</Button>
|
|
96
|
-
</Toolbar.Root>
|
|
97
|
-
<Sheet.Main />
|
|
98
|
-
{debug && <Sheet.Debug />}
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export default {
|
|
104
|
-
title: 'plugin-sheet/Sheet',
|
|
105
|
-
component: Sheet,
|
|
106
|
-
decorators: [
|
|
107
|
-
withClientProvider({ types: [SheetType], createIdentity: true }),
|
|
108
|
-
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
109
|
-
withTheme,
|
|
110
|
-
withLayout({ fullscreen: true, tooltips: true, classNames: 'inset-4' }),
|
|
111
|
-
],
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const Default = () => {
|
|
115
|
-
const [debug, setDebug] = useState(false);
|
|
116
|
-
const space = useSpace();
|
|
117
|
-
const graph = useComputeGraph(space);
|
|
118
|
-
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
119
|
-
if (!graph || !sheet) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<Sheet.Root graph={graph} sheet={sheet} onInfo={() => setDebug((debug) => !debug)}>
|
|
125
|
-
<SheetWithToolbar graph={graph} debug={debug} />
|
|
126
|
-
</Sheet.Root>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const Debug = () => {
|
|
131
|
-
const space = useSpace();
|
|
132
|
-
const graph = useComputeGraph(space);
|
|
133
|
-
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
134
|
-
if (!graph || !sheet) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<Sheet.Root graph={graph} sheet={sheet}>
|
|
140
|
-
<Sheet.Main />
|
|
141
|
-
<Sheet.Debug />
|
|
142
|
-
</Sheet.Root>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const Rows = () => {
|
|
147
|
-
const [rowSizes, setRowSizes] = useState<SizeMap>({});
|
|
148
|
-
const space = useSpace();
|
|
149
|
-
const graph = useComputeGraph(space);
|
|
150
|
-
const sheet = useTestSheet(space, graph);
|
|
151
|
-
if (!graph || !sheet) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<Sheet.Root graph={graph} sheet={sheet}>
|
|
157
|
-
<Sheet.Rows
|
|
158
|
-
rows={sheet.rows}
|
|
159
|
-
sizes={rowSizes}
|
|
160
|
-
onResize={(id, size) => setRowSizes((sizes) => ({ ...sizes, [id]: size }))}
|
|
161
|
-
/>
|
|
162
|
-
</Sheet.Root>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export const Columns = () => {
|
|
167
|
-
const [columnSizes, setColumnSizes] = useState<SizeMap>({});
|
|
168
|
-
const space = useSpace();
|
|
169
|
-
const graph = useComputeGraph(space);
|
|
170
|
-
const sheet = useTestSheet(space, graph);
|
|
171
|
-
if (!graph || !sheet) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
<Sheet.Root graph={graph} sheet={sheet}>
|
|
177
|
-
<Sheet.Columns
|
|
178
|
-
columns={sheet.columns}
|
|
179
|
-
sizes={columnSizes}
|
|
180
|
-
onResize={(id, size) => setColumnSizes((sizes) => ({ ...sizes, [id]: size }))}
|
|
181
|
-
/>
|
|
182
|
-
</Sheet.Root>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export const Main = () => {
|
|
187
|
-
const space = useSpace();
|
|
188
|
-
const graph = useComputeGraph(space);
|
|
189
|
-
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
190
|
-
if (!graph || !sheet) {
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return (
|
|
195
|
-
<Sheet.Root graph={graph} sheet={sheet}>
|
|
196
|
-
<Sheet.Grid
|
|
197
|
-
size={{
|
|
198
|
-
numRows: 50,
|
|
199
|
-
numCols: 26,
|
|
200
|
-
}}
|
|
201
|
-
rows={sheet.rows}
|
|
202
|
-
columns={sheet.columns}
|
|
203
|
-
rowSizes={{}}
|
|
204
|
-
columnSizes={{}}
|
|
205
|
-
/>
|
|
206
|
-
</Sheet.Root>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Scrolling container with fixed border that overlaps the border of inner elements.
|
|
212
|
-
*/
|
|
213
|
-
export const ScrollLayout = () => {
|
|
214
|
-
return (
|
|
215
|
-
<div className='relative flex grow overflow-hidden'>
|
|
216
|
-
{/* Fixed border. */}
|
|
217
|
-
<div className='z-20 absolute inset-0 border border-primary-500 pointer-events-none' />
|
|
218
|
-
|
|
219
|
-
{/* Scroll container. */}
|
|
220
|
-
<div className='grow overflow-auto scrollbar-thin'>
|
|
221
|
-
{/* Scroll content. */}
|
|
222
|
-
<div className='relative w-[2000px] h-[2000px]'>
|
|
223
|
-
<Cell label='A1' className='absolute left-0 top-0 w-20 h-20' />
|
|
224
|
-
<Cell label='A1' className='absolute right-0 top-0 w-20 h-20' />
|
|
225
|
-
<Cell label='A1' className='absolute left-0 bottom-0 w-20 h-20' />
|
|
226
|
-
<Cell label='A1' className='absolute right-0 bottom-0 w-20 h-20' />
|
|
227
|
-
</div>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export const GridLayout = () => {
|
|
234
|
-
return (
|
|
235
|
-
<div className='grid grid-cols-[40px_1fr_40px] grid-rows-[40px_1fr_40px] grow'>
|
|
236
|
-
<Cell label='A1' />
|
|
237
|
-
<Cell label='B1' />
|
|
238
|
-
<Cell label='C1' />
|
|
239
|
-
<Cell label='A2' />
|
|
240
|
-
<Cell label='B2' />
|
|
241
|
-
<Cell label='C2' />
|
|
242
|
-
<Cell label='A3' />
|
|
243
|
-
<Cell label='B3' />
|
|
244
|
-
<Cell label='C3' />
|
|
245
|
-
</div>
|
|
246
|
-
);
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
const Cell = ({ className, label }: { className?: string; label: string }) => (
|
|
250
|
-
<div className={mx('flex items-center justify-center border', className)}>{label}</div>
|
|
251
|
-
);
|