@dxos/plugin-sheet 0.8.4-main.67995b8 → 0.8.4-main.70d3990
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-KDGD4AVG.mjs → SheetContainer-WDKJPYCB.mjs} +41 -43
- package/dist/lib/browser/SheetContainer-WDKJPYCB.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-OWOAGQM6.mjs +23 -0
- package/dist/lib/browser/anchor-sort-OWOAGQM6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JUOVL3LE.mjs → chunk-6ILNTWSF.mjs} +218 -213
- package/dist/lib/browser/chunk-6ILNTWSF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KJWZUQVA.mjs → chunk-73AV3NH6.mjs} +4 -4
- package/dist/lib/browser/chunk-73AV3NH6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7HQX4NQP.mjs → chunk-7VEWYJJN.mjs} +2 -2
- package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +7 -0
- package/dist/lib/browser/chunk-FWFAAGXL.mjs +28 -0
- package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SI4X5GUR.mjs → chunk-GBK6OLCY.mjs} +225 -210
- package/dist/lib/browser/chunk-GBK6OLCY.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +30 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-WOJGZMSV.mjs → intent-resolver-OMHQGXFL.mjs} +10 -10
- package/dist/lib/browser/intent-resolver-OMHQGXFL.mjs.map +7 -0
- package/dist/lib/browser/{markdown-VXMIPUQC.mjs → markdown-B6VKYY2S.mjs} +6 -6
- package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-SE4HGAEH.mjs → react-surface-VPLFBQSV.mjs} +16 -15
- package/dist/lib/browser/react-surface-VPLFBQSV.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -12
- package/dist/lib/node-esm/{SheetContainer-RMG24NZC.mjs → SheetContainer-62MZAU6Q.mjs} +41 -43
- package/dist/lib/node-esm/SheetContainer-62MZAU6Q.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-CTJGOPET.mjs → anchor-sort-FG3DS4HM.mjs} +10 -11
- package/dist/lib/node-esm/anchor-sort-FG3DS4HM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6SK5LJ5S.mjs → chunk-44YTKTMP.mjs} +4 -4
- package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Q6UYC4G5.mjs → chunk-4QV4AGWK.mjs} +2 -2
- package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HILDMVPL.mjs +29 -0
- package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CADTJFAS.mjs → chunk-KSHCRK5J.mjs} +225 -210
- package/dist/lib/node-esm/chunk-KSHCRK5J.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IFMIRCZH.mjs → chunk-QI3PNRCD.mjs} +218 -213
- package/dist/lib/node-esm/chunk-QI3PNRCD.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +30 -31
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-PZRXBNIJ.mjs → intent-resolver-DHEHYV3B.mjs} +10 -10
- package/dist/lib/node-esm/intent-resolver-DHEHYV3B.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-4VPQJZNZ.mjs → markdown-VKY7HXU2.mjs} +6 -6
- package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-LAU23XBH.mjs → react-surface-YLTZQVNL.mjs} +16 -15
- package/dist/lib/node-esm/react-surface-YLTZQVNL.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -12
- package/dist/types/src/SheetPlugin.d.ts +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +2 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -10
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +1 -3
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +51 -3
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +11 -20
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts +2 -2
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +2 -2
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +53 -5
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +3 -3
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +3 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +88 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +2 -2
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts +10 -13
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/index.d.ts +1 -1
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -6
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +2 -2
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/serializer.d.ts +2 -2
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -2
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +27 -3
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/{schema.d.ts → Sheet.d.ts} +38 -5
- package/dist/types/src/types/Sheet.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/types/sheet-range-types.d.ts +2 -2
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -16
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +9 -10
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -68
- package/src/SheetPlugin.tsx +69 -66
- package/src/capabilities/anchor-sort.ts +7 -8
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/compute-graph-registry.ts +9 -14
- package/src/capabilities/intent-resolver.ts +5 -5
- package/src/capabilities/markdown.ts +3 -2
- package/src/capabilities/react-surface.tsx +11 -9
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +21 -20
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -2
- package/src/components/GridSheet/GridSheet.stories.tsx +19 -13
- package/src/components/GridSheet/GridSheet.tsx +39 -26
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +41 -43
- package/src/components/GridSheet/util.ts +16 -10
- package/src/components/RangeList/RangeList.tsx +8 -8
- package/src/components/SheetContainer/SheetContainer.stories.tsx +48 -44
- package/src/components/SheetContainer/SheetContainer.tsx +10 -5
- package/src/components/SheetContext/SheetContext.tsx +5 -5
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +19 -13
- package/src/components/SheetToolbar/SheetToolbar.tsx +31 -32
- package/src/components/SheetToolbar/align.ts +7 -6
- package/src/components/SheetToolbar/style.ts +4 -4
- package/src/extensions/compute.stories.tsx +31 -27
- package/src/extensions/compute.ts +2 -3
- package/src/extensions/editor/index.ts +1 -1
- package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
- package/src/integrations/thread-ranges.ts +15 -20
- package/src/meta.ts +7 -5
- package/src/model/sheet-model.test.ts +5 -4
- package/src/model/sheet-model.ts +16 -16
- package/src/model/testing.ts +4 -4
- package/src/model/useSheetModel.ts +2 -2
- package/src/playwright/sheet-manager.ts +1 -1
- package/src/playwright/sheet.spec.ts +1 -1
- package/src/sanity.test.ts +4 -5
- package/src/serializer.ts +4 -4
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +11 -5
- package/src/translations.ts +3 -2
- package/src/types/Sheet.ts +103 -0
- package/src/types/index.ts +1 -1
- package/src/types/sheet-range-types.ts +2 -2
- package/src/types/types.ts +6 -15
- package/src/types/util.ts +13 -41
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs +0 -24
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs.map +0 -7
- package/dist/lib/browser/chunk-6AKBCBL4.mjs +0 -18
- package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
- package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUOVL3LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
- package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs +0 -20
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs.map +0 -7
- package/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
- package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/types/schema.ts +0 -61
- /package/src/extensions/editor/{extension.ts → sheet-extension.ts} +0 -0
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
12
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
13
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import { withTheme
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
14
|
|
|
16
|
-
import { GridSheet } from './GridSheet';
|
|
17
15
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
18
16
|
import { translations } from '../../translations';
|
|
19
|
-
import {
|
|
17
|
+
import { Sheet } from '../../types';
|
|
20
18
|
import { useComputeGraph } from '../ComputeGraph';
|
|
21
19
|
import { SheetProvider } from '../SheetContext';
|
|
22
20
|
|
|
21
|
+
import { GridSheet } from './GridSheet';
|
|
22
|
+
|
|
23
23
|
export const Basic = () => {
|
|
24
24
|
const space = useSpace();
|
|
25
25
|
const graph = useComputeGraph(space);
|
|
@@ -30,24 +30,30 @@ export const Basic = () => {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<SheetProvider graph={graph} sheet={sheet} ignoreAttention>
|
|
33
|
-
<
|
|
33
|
+
<div role='none' className='grid bs-full is-full'>
|
|
34
|
+
<GridSheet />
|
|
35
|
+
</div>
|
|
34
36
|
</SheetProvider>
|
|
35
37
|
);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
const meta
|
|
40
|
+
const meta = {
|
|
39
41
|
title: 'plugins/plugin-sheet/GridSheet',
|
|
40
42
|
component: GridSheet,
|
|
41
43
|
decorators: [
|
|
42
|
-
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
43
|
-
withComputeGraphDecorator(),
|
|
44
44
|
withTheme,
|
|
45
|
-
|
|
45
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
46
|
+
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
46
47
|
withPluginManager({
|
|
47
48
|
plugins: [IntentPlugin()],
|
|
48
49
|
}),
|
|
49
50
|
],
|
|
50
|
-
parameters: {
|
|
51
|
-
|
|
51
|
+
parameters: {
|
|
52
|
+
layout: 'fullscreen',
|
|
53
|
+
translations,
|
|
54
|
+
},
|
|
55
|
+
} satisfies Meta<typeof GridSheet>;
|
|
52
56
|
|
|
53
57
|
export default meta;
|
|
58
|
+
|
|
59
|
+
type Story = StoryObj<typeof meta>;
|
|
@@ -3,42 +3,44 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import React, {
|
|
6
|
+
type FocusEvent,
|
|
7
|
+
type KeyboardEvent,
|
|
8
|
+
type MouseEvent,
|
|
9
|
+
type WheelEvent,
|
|
6
10
|
useCallback,
|
|
7
11
|
useMemo,
|
|
8
12
|
useRef,
|
|
9
13
|
useState,
|
|
10
|
-
type FocusEvent,
|
|
11
|
-
type KeyboardEvent,
|
|
12
|
-
type WheelEvent,
|
|
13
|
-
type MouseEvent,
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
|
-
import { createIntent
|
|
17
|
-
import {
|
|
16
|
+
import { createIntent } from '@dxos/app-framework';
|
|
17
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
18
|
+
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
18
19
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
19
20
|
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
21
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
21
22
|
import {
|
|
22
|
-
|
|
23
|
-
editorKeys,
|
|
24
|
-
parseCellIndex,
|
|
25
|
-
Grid,
|
|
26
|
-
GridCellEditor,
|
|
23
|
+
type DxGridCellIndex,
|
|
27
24
|
type DxGridElement,
|
|
28
25
|
type DxGridPosition,
|
|
29
|
-
type DxGridCellIndex,
|
|
30
|
-
type EditorKeyHandler,
|
|
31
26
|
type EditorBlurHandler,
|
|
27
|
+
type EditorKeyHandler,
|
|
28
|
+
Grid,
|
|
29
|
+
GridCellEditor,
|
|
32
30
|
type GridContentProps,
|
|
31
|
+
closestCell,
|
|
32
|
+
editorKeys,
|
|
33
|
+
parseCellIndex,
|
|
33
34
|
} from '@dxos/react-ui-grid';
|
|
34
35
|
|
|
35
|
-
import {
|
|
36
|
-
import { rangeExtension, sheetExtension, type RangeController } from '../../extensions';
|
|
36
|
+
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
37
37
|
import { useSelectThreadOnCellFocus, useUpdateFocusedCellOnThreadSelection } from '../../integrations';
|
|
38
|
-
import {
|
|
38
|
+
import { meta } from '../../meta';
|
|
39
39
|
import { DEFAULT_COLS, DEFAULT_ROWS, SheetAction } from '../../types';
|
|
40
40
|
import { useSheetContext } from '../SheetContext';
|
|
41
41
|
|
|
42
|
+
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
43
|
+
|
|
42
44
|
const inertPosition: DxGridPosition = { plane: 'grid', col: 0, row: 0 };
|
|
43
45
|
|
|
44
46
|
const initialCells = {
|
|
@@ -59,16 +61,16 @@ const frozen = {
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
const sheetColDefault = {
|
|
62
|
-
frozenColsStart: { size: 48, readonly: true },
|
|
64
|
+
frozenColsStart: { size: 48, readonly: true, focusUnfurl: false },
|
|
63
65
|
grid: { size: defaultColSize, resizeable: true },
|
|
64
66
|
};
|
|
65
67
|
const sheetRowDefault = {
|
|
66
|
-
frozenRowsStart: { size: defaultRowSize, readonly: true },
|
|
68
|
+
frozenRowsStart: { size: defaultRowSize, readonly: true, focusUnfurl: false },
|
|
67
69
|
grid: { size: defaultRowSize, resizeable: true },
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
export const GridSheet = () => {
|
|
71
|
-
const { t } = useTranslation(
|
|
73
|
+
const { t } = useTranslation(meta.id);
|
|
72
74
|
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } =
|
|
73
75
|
useSheetContext();
|
|
74
76
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
@@ -76,7 +78,7 @@ export const GridSheet = () => {
|
|
|
76
78
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
77
79
|
const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
|
|
78
80
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
79
|
-
const rangeController = useRef<RangeController>();
|
|
81
|
+
const rangeController = useRef<RangeController>(null);
|
|
80
82
|
const { hasAttention } = useAttention(id);
|
|
81
83
|
|
|
82
84
|
const handleFocus = useCallback(
|
|
@@ -171,12 +173,20 @@ export const GridSheet = () => {
|
|
|
171
173
|
case 'frozenRowsStart':
|
|
172
174
|
return dxGrid?.setSelection({
|
|
173
175
|
start: { col: pos.col, row: 0, plane: 'grid' },
|
|
174
|
-
end: {
|
|
176
|
+
end: {
|
|
177
|
+
col: pos.col,
|
|
178
|
+
row: model.sheet.rows.length - 1,
|
|
179
|
+
plane: 'grid',
|
|
180
|
+
},
|
|
175
181
|
});
|
|
176
182
|
case 'frozenColsStart':
|
|
177
183
|
return dxGrid?.setSelection({
|
|
178
184
|
start: { row: pos.row, col: 0, plane: 'grid' },
|
|
179
|
-
end: {
|
|
185
|
+
end: {
|
|
186
|
+
row: pos.row,
|
|
187
|
+
col: model.sheet.columns.length - 1,
|
|
188
|
+
plane: 'grid',
|
|
189
|
+
},
|
|
180
190
|
});
|
|
181
191
|
}
|
|
182
192
|
},
|
|
@@ -278,9 +288,12 @@ export const GridSheet = () => {
|
|
|
278
288
|
|
|
279
289
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
280
290
|
|
|
281
|
-
const
|
|
291
|
+
const extensions = useMemo(
|
|
282
292
|
() => [
|
|
283
|
-
editorKeys({
|
|
293
|
+
editorKeys({
|
|
294
|
+
onClose: handleClose,
|
|
295
|
+
...(editing?.initialContent && { onNav: handleClose }),
|
|
296
|
+
}),
|
|
284
297
|
sheetExtension({ functions: model.graph.getFunctions() }),
|
|
285
298
|
rangeExtension({
|
|
286
299
|
onInit: (fn) => (rangeController.current = fn),
|
|
@@ -307,8 +320,8 @@ export const GridSheet = () => {
|
|
|
307
320
|
|
|
308
321
|
return (
|
|
309
322
|
// TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
|
|
310
|
-
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent
|
|
311
|
-
<GridCellEditor getCellContent={getCellContent}
|
|
323
|
+
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
|
|
324
|
+
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
312
325
|
<Grid.Content
|
|
313
326
|
initialCells={initialCells}
|
|
314
327
|
limitColumns={DEFAULT_COLS}
|
|
@@ -2,53 +2,48 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useMemo, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Client } from '@dxos/client';
|
|
11
|
-
import { createDocAccessor } from '@dxos/client/echo';
|
|
12
9
|
import { defaultFunctions } from '@dxos/compute';
|
|
13
10
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
11
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
12
|
+
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
import { automerge } from '@dxos/react-ui-editor';
|
|
15
15
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
16
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
17
16
|
|
|
18
17
|
import { sheetExtension } from '../../extensions';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
type StoryProps = CellEditorProps;
|
|
18
|
+
import { Sheet } from '../../types';
|
|
22
19
|
|
|
23
|
-
const
|
|
24
|
-
const
|
|
20
|
+
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
21
|
+
const extensions = useMemo(() => {
|
|
25
22
|
const functionNames = getRegisteredFunctionNames();
|
|
26
23
|
const functions = defaultFunctions.filter(({ name }) => functionNames.includes(name));
|
|
27
24
|
return [sheetExtension({ functions })];
|
|
28
25
|
}, []);
|
|
29
26
|
|
|
30
|
-
return <CellEditor {...props} value={value}
|
|
27
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
31
28
|
};
|
|
32
29
|
|
|
33
|
-
const AutomergeStory = ({ value, ...props }:
|
|
30
|
+
const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
34
31
|
const cell = 'A1';
|
|
35
|
-
const [object, setObject] = useState<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
setObject(sheet);
|
|
48
|
-
});
|
|
32
|
+
const [object, setObject] = useState<Sheet.Sheet>();
|
|
33
|
+
useAsyncEffect(async () => {
|
|
34
|
+
const client = new Client({ types: [Sheet.Sheet] });
|
|
35
|
+
await client.initialize();
|
|
36
|
+
await client.halo.createIdentity();
|
|
37
|
+
const space = await client.spaces.create();
|
|
38
|
+
|
|
39
|
+
const sheet = Sheet.make();
|
|
40
|
+
sheet.name = 'Test';
|
|
41
|
+
sheet.cells[cell] = { value };
|
|
42
|
+
space.db.add(sheet);
|
|
43
|
+
setObject(sheet);
|
|
49
44
|
}, [value]);
|
|
50
45
|
|
|
51
|
-
const
|
|
46
|
+
const extensions = useMemo(() => {
|
|
52
47
|
if (!object) {
|
|
53
48
|
return [];
|
|
54
49
|
}
|
|
@@ -59,35 +54,38 @@ const AutomergeStory = ({ value, ...props }: StoryProps) => {
|
|
|
59
54
|
return [automerge(accessor), sheetExtension({ functions })];
|
|
60
55
|
}, [object]);
|
|
61
56
|
|
|
62
|
-
return <CellEditor {...props} value={value}
|
|
57
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
63
58
|
};
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
const meta = {
|
|
61
|
+
title: 'plugins/plugin-sheet/CellEditor',
|
|
62
|
+
|
|
63
|
+
decorators: [withTheme],
|
|
64
|
+
component: CellEditor,
|
|
65
|
+
render: DefaultStory,
|
|
66
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
67
|
+
|
|
68
|
+
export default meta;
|
|
69
|
+
|
|
70
|
+
type Story = StoryObj<typeof meta>;
|
|
66
71
|
|
|
67
|
-
export const
|
|
72
|
+
export const Default: Story = {};
|
|
73
|
+
|
|
74
|
+
export const AutoComplete: Story = {
|
|
68
75
|
args: {
|
|
69
76
|
value: '=SUM',
|
|
70
77
|
},
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
export const Formatting = {
|
|
80
|
+
export const Formatting: Story = {
|
|
74
81
|
args: {
|
|
75
82
|
value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
|
|
76
83
|
},
|
|
77
84
|
};
|
|
78
85
|
|
|
79
|
-
export const Automerge = {
|
|
80
|
-
render:
|
|
86
|
+
export const Automerge: Story = {
|
|
87
|
+
render: AutomergeStory,
|
|
81
88
|
args: {
|
|
82
89
|
value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
|
|
83
90
|
},
|
|
84
91
|
};
|
|
85
|
-
|
|
86
|
-
const meta: Meta = {
|
|
87
|
-
title: 'plugins/plugin-sheet/CellEditor',
|
|
88
|
-
component: CellEditor,
|
|
89
|
-
decorators: [withTheme],
|
|
90
|
-
render: (args: StoryProps) => <Story {...args} />,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default meta;
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { inRange } from '@dxos/compute';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
9
|
-
import {
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
|
+
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
11
|
-
type GridContentProps,
|
|
12
|
-
type DxGridElement,
|
|
13
11
|
type DxGridAxisMeta,
|
|
12
|
+
type DxGridCellValue,
|
|
13
|
+
type DxGridElement,
|
|
14
14
|
type DxGridPlane,
|
|
15
|
-
type DxGridPlaneRange,
|
|
16
15
|
type DxGridPlaneCells,
|
|
17
|
-
type
|
|
16
|
+
type DxGridPlaneRange,
|
|
17
|
+
type GridContentProps,
|
|
18
18
|
colToA1Notation,
|
|
19
|
-
rowToA1Notation,
|
|
20
19
|
commentedClassName,
|
|
20
|
+
rowToA1Notation,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
22
|
import { mx } from '@dxos/react-ui-theme';
|
|
23
23
|
|
|
@@ -28,7 +28,10 @@ const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
|
28
28
|
return model.sheet.columns.reduce(
|
|
29
29
|
(acc: DxGridAxisMeta, columnId, numericIndex) => {
|
|
30
30
|
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
31
|
-
acc.grid[numericIndex] = {
|
|
31
|
+
acc.grid[numericIndex] = {
|
|
32
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
33
|
+
resizeable: true,
|
|
34
|
+
};
|
|
32
35
|
}
|
|
33
36
|
return acc;
|
|
34
37
|
},
|
|
@@ -40,7 +43,10 @@ const createDxGridRows = (model: SheetModel): DxGridAxisMeta => {
|
|
|
40
43
|
return model.sheet.rows.reduce(
|
|
41
44
|
(acc: DxGridAxisMeta, rowId, numericIndex) => {
|
|
42
45
|
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
43
|
-
acc.grid[numericIndex] = {
|
|
46
|
+
acc.grid[numericIndex] = {
|
|
47
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
48
|
+
resizeable: true,
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
return acc;
|
|
46
52
|
},
|
|
@@ -59,7 +65,7 @@ const projectCellProps = (model: SheetModel, col: number, row: number): DxGridCe
|
|
|
59
65
|
// const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target!.anchor);
|
|
60
66
|
// return thread && range ? inRange(range, address) : false;
|
|
61
67
|
// })
|
|
62
|
-
// .map((thread) =>
|
|
68
|
+
// .map((thread) => Obj.getDXN(thread!).toString())
|
|
63
69
|
// .join(' ');
|
|
64
70
|
|
|
65
71
|
const description = model.getValueDescription(address);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import { rangeToA1Notation } from '@dxos/compute';
|
|
@@ -10,20 +10,20 @@ import { Callout, useTranslation } from '@dxos/react-ui';
|
|
|
10
10
|
import { List } from '@dxos/react-ui-list';
|
|
11
11
|
import { ghostHover } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../../meta';
|
|
14
14
|
import { rangeFromIndex } from '../../types';
|
|
15
|
-
import {
|
|
15
|
+
import { Sheet } from '../../types';
|
|
16
16
|
|
|
17
17
|
export type RangeListProps = {
|
|
18
|
-
sheet:
|
|
18
|
+
sheet: Sheet.Sheet;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const RangeList = ({ sheet }: RangeListProps) => {
|
|
22
|
-
const { t } = useTranslation(
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
23
|
// TODO(thure): Implement similar to comments, #8121
|
|
24
|
-
const handleSelectRange = (range: Range) => {};
|
|
24
|
+
const handleSelectRange = (range: Sheet.Range) => {};
|
|
25
25
|
const handleDeleteRange = useCallback(
|
|
26
|
-
(range: Range) => {
|
|
26
|
+
(range: Sheet.Range) => {
|
|
27
27
|
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
28
28
|
sheet.ranges.splice(index, 1);
|
|
29
29
|
},
|
|
@@ -37,7 +37,7 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
37
37
|
<Callout.Title>{t('no ranges message')}</Callout.Title>
|
|
38
38
|
</Callout.Root>
|
|
39
39
|
) : (
|
|
40
|
-
<List.Root<Range> items={sheet.ranges} isItem={Schema.is(Range)}>
|
|
40
|
+
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
41
41
|
{({ items: ranges }) =>
|
|
42
42
|
ranges.map((range, i) => (
|
|
43
43
|
<List.Item key={i} item={range} classNames={['p-2', ghostHover]}>
|
|
@@ -2,28 +2,60 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import { Capabilities, contributes, createResolver
|
|
8
|
+
import { Capabilities, IntentPlugin, contributes, createResolver } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
12
11
|
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
13
|
-
import {
|
|
12
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
14
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
16
16
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
17
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
18
17
|
|
|
19
|
-
import { SheetContainer } from './SheetContainer';
|
|
20
18
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
21
19
|
import { translations } from '../../translations';
|
|
22
|
-
import {
|
|
20
|
+
import { Sheet, SheetAction } from '../../types';
|
|
23
21
|
import { useComputeGraph } from '../ComputeGraph';
|
|
24
22
|
import { RangeList } from '../RangeList';
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
import { SheetContainer } from './SheetContainer';
|
|
25
|
+
|
|
26
|
+
const meta = {
|
|
27
|
+
title: 'plugins/plugin-sheet/SheetContainer',
|
|
28
|
+
component: SheetContainer,
|
|
29
|
+
decorators: [
|
|
30
|
+
withTheme,
|
|
31
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
32
|
+
withComputeGraphDecorator(),
|
|
33
|
+
withAttention,
|
|
34
|
+
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
35
|
+
withPluginManager({
|
|
36
|
+
plugins: [IntentPlugin(), GraphPlugin()],
|
|
37
|
+
capabilities: [
|
|
38
|
+
contributes(
|
|
39
|
+
Capabilities.IntentResolver,
|
|
40
|
+
createResolver({
|
|
41
|
+
intent: SheetAction.DropAxis,
|
|
42
|
+
resolve: ({ model, axis, axisIndex }) => {
|
|
43
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
],
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
50
|
+
parameters: {
|
|
51
|
+
layout: 'fullscreen',
|
|
52
|
+
translations,
|
|
53
|
+
},
|
|
54
|
+
} satisfies Meta<typeof SheetContainer>;
|
|
55
|
+
|
|
56
|
+
export default meta;
|
|
57
|
+
|
|
58
|
+
export const Default = () => {
|
|
27
59
|
const space = useSpace();
|
|
28
60
|
const graph = useComputeGraph(space);
|
|
29
61
|
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
@@ -32,8 +64,8 @@ export const Basic = () => {
|
|
|
32
64
|
}
|
|
33
65
|
|
|
34
66
|
return (
|
|
35
|
-
<AttendableContainer id={
|
|
36
|
-
<SheetContainer space={space} sheet={sheet} role='
|
|
67
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
68
|
+
<SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
|
|
37
69
|
</AttendableContainer>
|
|
38
70
|
);
|
|
39
71
|
};
|
|
@@ -41,15 +73,17 @@ export const Basic = () => {
|
|
|
41
73
|
export const Spec = () => {
|
|
42
74
|
const space = useSpace();
|
|
43
75
|
const graph = useComputeGraph(space);
|
|
44
|
-
const sheet = useTestSheet(space, graph, {
|
|
76
|
+
const sheet = useTestSheet(space, graph, {
|
|
77
|
+
cells: { A1: { value: 'Ready' } },
|
|
78
|
+
});
|
|
45
79
|
if (!sheet || !space) {
|
|
46
80
|
return null;
|
|
47
81
|
}
|
|
48
82
|
|
|
49
83
|
return (
|
|
50
|
-
<AttendableContainer id={
|
|
51
|
-
<div role='none' className='grid grid-rows-[66%_33%] grid-cols-1'>
|
|
52
|
-
<SheetContainer space={space} sheet={sheet} role='
|
|
84
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
85
|
+
<div role='none' className='grid grid-rows-[66%_33%] bs-full grid-cols-1'>
|
|
86
|
+
<SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
|
|
53
87
|
<div role='none' data-testid='grid.range-list'>
|
|
54
88
|
<RangeList sheet={sheet} />
|
|
55
89
|
</div>
|
|
@@ -57,33 +91,3 @@ export const Spec = () => {
|
|
|
57
91
|
</AttendableContainer>
|
|
58
92
|
);
|
|
59
93
|
};
|
|
60
|
-
|
|
61
|
-
const meta: Meta = {
|
|
62
|
-
title: 'plugins/plugin-sheet/SheetContainer',
|
|
63
|
-
component: SheetContainer,
|
|
64
|
-
decorators: [
|
|
65
|
-
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
66
|
-
withComputeGraphDecorator(),
|
|
67
|
-
withTheme,
|
|
68
|
-
withLayout({ fullscreen: true, classNames: 'grid' }),
|
|
69
|
-
withAttention,
|
|
70
|
-
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
71
|
-
withPluginManager({
|
|
72
|
-
plugins: [IntentPlugin(), GraphPlugin()],
|
|
73
|
-
capabilities: [
|
|
74
|
-
contributes(
|
|
75
|
-
Capabilities.IntentResolver,
|
|
76
|
-
createResolver({
|
|
77
|
-
intent: SheetAction.DropAxis,
|
|
78
|
-
resolve: ({ model, axis, axisIndex }) => {
|
|
79
|
-
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
80
|
-
},
|
|
81
|
-
}),
|
|
82
|
-
),
|
|
83
|
-
],
|
|
84
|
-
}),
|
|
85
|
-
],
|
|
86
|
-
parameters: { translations },
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export default meta;
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
8
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
10
|
|
|
10
|
-
import { type
|
|
11
|
+
import { type Sheet } from '../../types';
|
|
11
12
|
import { useComputeGraph } from '../ComputeGraph';
|
|
12
13
|
import { FunctionEditor } from '../FunctionEditor';
|
|
13
14
|
import { GridSheet } from '../GridSheet';
|
|
@@ -16,7 +17,7 @@ import { SheetToolbar } from '../SheetToolbar';
|
|
|
16
17
|
|
|
17
18
|
export type SheetContainerProps = {
|
|
18
19
|
space: Space;
|
|
19
|
-
sheet:
|
|
20
|
+
sheet: Sheet.Sheet;
|
|
20
21
|
role?: string;
|
|
21
22
|
ignoreAttention?: boolean;
|
|
22
23
|
};
|
|
@@ -26,8 +27,12 @@ export const SheetContainer = ({ space, sheet, role, ignoreAttention }: SheetCon
|
|
|
26
27
|
|
|
27
28
|
return graph ? (
|
|
28
29
|
<SheetProvider sheet={sheet} graph={graph} ignoreAttention={ignoreAttention}>
|
|
29
|
-
<StackItem.Content
|
|
30
|
-
|
|
30
|
+
<StackItem.Content
|
|
31
|
+
toolbar
|
|
32
|
+
statusbar
|
|
33
|
+
classNames={[role === 'section' && 'aspect-video', role === 'story' && 'bs-full']}
|
|
34
|
+
>
|
|
35
|
+
<SheetToolbar id={Obj.getDXN(sheet).toString()} />
|
|
31
36
|
<GridSheet />
|
|
32
37
|
<FunctionEditor />
|
|
33
38
|
</StackItem.Content>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type CellAddress, type CellRange, type CompleteCellRange, type ComputeGraph } from '@dxos/compute';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
10
|
import {
|
|
11
11
|
Grid,
|
|
12
12
|
type GridContentProps,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@dxos/react-ui-grid';
|
|
17
17
|
|
|
18
18
|
import { type SheetModel, useSheetModel } from '../../model';
|
|
19
|
-
import { type
|
|
19
|
+
import { type Sheet } from '../../types';
|
|
20
20
|
|
|
21
21
|
export type SheetContextValue = {
|
|
22
22
|
id: string;
|
|
@@ -114,7 +114,7 @@ const SheetProviderImpl = ({
|
|
|
114
114
|
|
|
115
115
|
export type SheetProviderProps = {
|
|
116
116
|
graph: ComputeGraph;
|
|
117
|
-
sheet:
|
|
117
|
+
sheet: Sheet.Sheet;
|
|
118
118
|
readonly?: boolean;
|
|
119
119
|
ignoreAttention?: boolean;
|
|
120
120
|
} & Pick<SheetContextValue, 'onInfo'>;
|
|
@@ -130,7 +130,7 @@ export const SheetProvider = ({
|
|
|
130
130
|
const model = useSheetModel(graph, sheet, { readonly });
|
|
131
131
|
|
|
132
132
|
return !model ? null : (
|
|
133
|
-
<Grid.Root id={
|
|
133
|
+
<Grid.Root id={Obj.getDXN(sheet).toString()}>
|
|
134
134
|
<SheetProviderImpl model={model} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
135
135
|
{children}
|
|
136
136
|
</SheetProviderImpl>
|