@dxos/plugin-sheet 0.8.4-main.5ea62a8 → 0.8.4-main.ae835ea
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-CWSO5WTN.mjs → SheetContainer-GTINUSNB.mjs} +15 -16
- package/dist/lib/browser/SheetContainer-GTINUSNB.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-7WD2VGXW.mjs → anchor-sort-R5CB37J7.mjs} +7 -7
- package/dist/lib/browser/anchor-sort-R5CB37J7.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-CL3MDNKQ.mjs → chunk-7VEWYJJN.mjs} +5 -5
- package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XSXUU6FO.mjs → chunk-DVJ3QW3F.mjs} +222 -221
- package/dist/lib/browser/chunk-DVJ3QW3F.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-Q3VBLCSM.mjs → chunk-LS6D4GG7.mjs} +23 -24
- package/dist/lib/browser/chunk-LS6D4GG7.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 +20 -21
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-ROEY4LHM.mjs → intent-resolver-66OAYVQF.mjs} +9 -9
- package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +7 -0
- package/dist/lib/browser/{markdown-VMNYPXTQ.mjs → markdown-B6VKYY2S.mjs} +6 -6
- package/dist/lib/browser/{markdown-VMNYPXTQ.mjs.map → markdown-B6VKYY2S.mjs.map} +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-2ES3D7MJ.mjs → react-surface-F3VQPGDV.mjs} +14 -14
- package/dist/lib/browser/react-surface-F3VQPGDV.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -12
- package/dist/lib/node-esm/{SheetContainer-3RSDBWDG.mjs → SheetContainer-PW4KNZME.mjs} +15 -16
- package/dist/lib/node-esm/SheetContainer-PW4KNZME.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-ACQDUIPU.mjs → anchor-sort-HEND452H.mjs} +7 -7
- package/dist/lib/node-esm/anchor-sort-HEND452H.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-ODP4L4OV.mjs → chunk-4H2EHVWE.mjs} +222 -221
- package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZIQZU4CH.mjs → chunk-4QV4AGWK.mjs} +5 -5
- 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-LUCRXSK6.mjs → chunk-LYUIM3QG.mjs} +23 -24
- package/dist/lib/node-esm/chunk-LYUIM3QG.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 +20 -21
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-HESRI2ML.mjs → intent-resolver-VNKIMQQT.mjs} +9 -9
- package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-SCOTGSWB.mjs → markdown-VKY7HXU2.mjs} +6 -6
- package/dist/lib/node-esm/{markdown-SCOTGSWB.mjs.map → markdown-VKY7HXU2.mjs.map} +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-66VS5MY2.mjs → react-surface-GGX76V2Y.mjs} +14 -14
- package/dist/lib/node-esm/react-surface-GGX76V2Y.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/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +0 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +3 -3
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +2 -4
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.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 +5 -5
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +2 -2
- 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 +1 -2
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.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 +2 -3
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- 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 +5 -5
- 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/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 +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/{schema.d.ts → Sheet.d.ts} +37 -4
- 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 +63 -63
- package/src/SheetPlugin.tsx +70 -61
- package/src/capabilities/anchor-sort.ts +3 -3
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/compute-graph-registry.ts +8 -13
- package/src/capabilities/intent-resolver.ts +4 -4
- package/src/capabilities/react-surface.tsx +7 -7
- package/src/components/ComputeGraph/compute-graph.stories.tsx +10 -12
- package/src/components/GridSheet/GridSheet.stories.tsx +12 -9
- package/src/components/GridSheet/GridSheet.tsx +6 -6
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +14 -17
- package/src/components/RangeList/RangeList.tsx +8 -8
- package/src/components/SheetContainer/SheetContainer.stories.tsx +39 -41
- package/src/components/SheetContainer/SheetContainer.tsx +7 -3
- package/src/components/SheetContext/SheetContext.tsx +2 -2
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +9 -6
- package/src/components/SheetToolbar/SheetToolbar.tsx +4 -9
- package/src/components/SheetToolbar/align.ts +3 -3
- package/src/components/SheetToolbar/style.ts +2 -2
- package/src/extensions/compute.stories.tsx +16 -13
- package/src/extensions/compute.ts +1 -2
- package/src/integrations/thread-ranges.ts +7 -6
- package/src/meta.ts +7 -5
- package/src/model/sheet-model.test.ts +4 -4
- package/src/model/sheet-model.ts +4 -4
- package/src/model/testing.ts +4 -4
- package/src/model/useSheetModel.ts +2 -2
- package/src/sanity.test.ts +3 -4
- package/src/serializer.ts +3 -3
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +11 -5
- package/src/translations.ts +2 -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 -16
- package/src/types/util.ts +10 -38
- package/dist/lib/browser/SheetContainer-CWSO5WTN.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-7WD2VGXW.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-CL3MDNKQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q3VBLCSM.mjs.map +0 -7
- package/dist/lib/browser/chunk-XSXUU6FO.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ROEY4LHM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-2ES3D7MJ.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-3RSDBWDG.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-ACQDUIPU.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-LUCRXSK6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ODP4L4OV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZIQZU4CH.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HESRI2ML.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-66VS5MY2.mjs.map +0 -7
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/types/schema.ts +0 -61
|
@@ -2,8 +2,6 @@
|
|
|
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, { useMemo, useState } from 'react';
|
|
9
7
|
|
|
@@ -12,42 +10,40 @@ import { createDocAccessor } from '@dxos/client/echo';
|
|
|
12
10
|
import { defaultFunctions } from '@dxos/compute';
|
|
13
11
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
14
12
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
14
|
import { automerge } from '@dxos/react-ui-editor';
|
|
16
15
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
17
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
18
16
|
|
|
19
17
|
import { sheetExtension } from '../../extensions';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
type StoryProps = CellEditorProps;
|
|
18
|
+
import { Sheet } from '../../types';
|
|
23
19
|
|
|
24
|
-
const DefaultStory = ({ value, ...props }:
|
|
25
|
-
const
|
|
20
|
+
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
21
|
+
const extensions = useMemo(() => {
|
|
26
22
|
const functionNames = getRegisteredFunctionNames();
|
|
27
23
|
const functions = defaultFunctions.filter(({ name }) => functionNames.includes(name));
|
|
28
24
|
return [sheetExtension({ functions })];
|
|
29
25
|
}, []);
|
|
30
26
|
|
|
31
|
-
return <CellEditor {...props} value={value}
|
|
27
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
32
28
|
};
|
|
33
29
|
|
|
34
|
-
const AutomergeStory = ({ value, ...props }:
|
|
30
|
+
const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
35
31
|
const cell = 'A1';
|
|
36
|
-
const [object, setObject] = useState<
|
|
32
|
+
const [object, setObject] = useState<Sheet.Sheet>();
|
|
37
33
|
useAsyncEffect(async () => {
|
|
38
|
-
const client = new Client({ types: [
|
|
34
|
+
const client = new Client({ types: [Sheet.Sheet] });
|
|
39
35
|
await client.initialize();
|
|
40
36
|
await client.halo.createIdentity();
|
|
41
37
|
const space = await client.spaces.create();
|
|
42
38
|
|
|
43
|
-
const sheet =
|
|
39
|
+
const sheet = Sheet.make();
|
|
44
40
|
sheet.name = 'Test';
|
|
45
41
|
sheet.cells[cell] = { value };
|
|
46
42
|
space.db.add(sheet);
|
|
47
43
|
setObject(sheet);
|
|
48
44
|
}, [value]);
|
|
49
45
|
|
|
50
|
-
const
|
|
46
|
+
const extensions = useMemo(() => {
|
|
51
47
|
if (!object) {
|
|
52
48
|
return [];
|
|
53
49
|
}
|
|
@@ -58,14 +54,15 @@ const AutomergeStory = ({ value, ...props }: StoryProps) => {
|
|
|
58
54
|
return [automerge(accessor), sheetExtension({ functions })];
|
|
59
55
|
}, [object]);
|
|
60
56
|
|
|
61
|
-
return <CellEditor {...props} value={value}
|
|
57
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
62
58
|
};
|
|
63
59
|
|
|
64
60
|
const meta = {
|
|
65
61
|
title: 'plugins/plugin-sheet/CellEditor',
|
|
62
|
+
|
|
63
|
+
decorators: [withTheme],
|
|
66
64
|
component: CellEditor,
|
|
67
65
|
render: DefaultStory,
|
|
68
|
-
decorators: [withTheme],
|
|
69
66
|
} satisfies Meta<typeof DefaultStory>;
|
|
70
67
|
|
|
71
68
|
export default meta;
|
|
@@ -87,7 +84,7 @@ export const Formatting: Story = {
|
|
|
87
84
|
};
|
|
88
85
|
|
|
89
86
|
export const Automerge: Story = {
|
|
90
|
-
render:
|
|
87
|
+
render: AutomergeStory,
|
|
91
88
|
args: {
|
|
92
89
|
value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
|
|
93
90
|
},
|
|
@@ -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,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { Capabilities, IntentPlugin, contributes, createResolver } from '@dxos/app-framework';
|
|
@@ -12,19 +10,51 @@ import { withPluginManager } from '@dxos/app-framework/testing';
|
|
|
12
10
|
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
13
11
|
import { fullyQualifiedId, useSpace } from '@dxos/react-client/echo';
|
|
14
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
14
|
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
16
15
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
17
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
18
16
|
|
|
19
17
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
20
18
|
import { translations } from '../../translations';
|
|
21
|
-
import {
|
|
19
|
+
import { Sheet, SheetAction } from '../../types';
|
|
22
20
|
import { useComputeGraph } from '../ComputeGraph';
|
|
23
21
|
import { RangeList } from '../RangeList';
|
|
24
22
|
|
|
25
23
|
import { SheetContainer } from './SheetContainer';
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
const meta = {
|
|
26
|
+
title: 'plugins/plugin-sheet/SheetContainer',
|
|
27
|
+
component: SheetContainer,
|
|
28
|
+
decorators: [
|
|
29
|
+
withTheme,
|
|
30
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
31
|
+
withComputeGraphDecorator(),
|
|
32
|
+
withAttention,
|
|
33
|
+
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
34
|
+
withPluginManager({
|
|
35
|
+
plugins: [IntentPlugin(), GraphPlugin()],
|
|
36
|
+
capabilities: [
|
|
37
|
+
contributes(
|
|
38
|
+
Capabilities.IntentResolver,
|
|
39
|
+
createResolver({
|
|
40
|
+
intent: SheetAction.DropAxis,
|
|
41
|
+
resolve: ({ model, axis, axisIndex }) => {
|
|
42
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
],
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
49
|
+
parameters: {
|
|
50
|
+
layout: 'fullscreen',
|
|
51
|
+
translations,
|
|
52
|
+
},
|
|
53
|
+
} satisfies Meta<typeof SheetContainer>;
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
export const Default = () => {
|
|
28
58
|
const space = useSpace();
|
|
29
59
|
const graph = useComputeGraph(space);
|
|
30
60
|
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
@@ -34,7 +64,7 @@ export const Basic = () => {
|
|
|
34
64
|
|
|
35
65
|
return (
|
|
36
66
|
<AttendableContainer id={fullyQualifiedId(sheet)} classNames='contents'>
|
|
37
|
-
<SheetContainer space={space} sheet={sheet} role='
|
|
67
|
+
<SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
|
|
38
68
|
</AttendableContainer>
|
|
39
69
|
);
|
|
40
70
|
};
|
|
@@ -49,8 +79,8 @@ export const Spec = () => {
|
|
|
49
79
|
|
|
50
80
|
return (
|
|
51
81
|
<AttendableContainer id={fullyQualifiedId(sheet)} classNames='contents'>
|
|
52
|
-
<div role='none' className='grid grid-rows-[66%_33%] grid-cols-1'>
|
|
53
|
-
<SheetContainer space={space} sheet={sheet} role='
|
|
82
|
+
<div role='none' className='grid grid-rows-[66%_33%] bs-full grid-cols-1'>
|
|
83
|
+
<SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
|
|
54
84
|
<div role='none' data-testid='grid.range-list'>
|
|
55
85
|
<RangeList sheet={sheet} />
|
|
56
86
|
</div>
|
|
@@ -58,35 +88,3 @@ export const Spec = () => {
|
|
|
58
88
|
</AttendableContainer>
|
|
59
89
|
);
|
|
60
90
|
};
|
|
61
|
-
|
|
62
|
-
const meta = {
|
|
63
|
-
title: 'plugins/plugin-sheet/SheetContainer',
|
|
64
|
-
component: SheetContainer,
|
|
65
|
-
decorators: [
|
|
66
|
-
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
67
|
-
withComputeGraphDecorator(),
|
|
68
|
-
withTheme,
|
|
69
|
-
withLayout({ fullscreen: true, classNames: 'grid' }),
|
|
70
|
-
withAttention,
|
|
71
|
-
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
72
|
-
withPluginManager({
|
|
73
|
-
plugins: [IntentPlugin(), GraphPlugin()],
|
|
74
|
-
capabilities: [
|
|
75
|
-
contributes(
|
|
76
|
-
Capabilities.IntentResolver,
|
|
77
|
-
createResolver({
|
|
78
|
-
intent: SheetAction.DropAxis,
|
|
79
|
-
resolve: ({ model, axis, axisIndex }) => {
|
|
80
|
-
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
83
|
-
),
|
|
84
|
-
],
|
|
85
|
-
}),
|
|
86
|
-
],
|
|
87
|
-
parameters: { translations },
|
|
88
|
-
} satisfies Meta<typeof SheetContainer>;
|
|
89
|
-
|
|
90
|
-
export default meta;
|
|
91
|
-
|
|
92
|
-
type Story = StoryObj<typeof meta>;
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Space, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
8
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
9
|
|
|
10
|
-
import { type
|
|
10
|
+
import { type Sheet } from '../../types';
|
|
11
11
|
import { useComputeGraph } from '../ComputeGraph';
|
|
12
12
|
import { FunctionEditor } from '../FunctionEditor';
|
|
13
13
|
import { GridSheet } from '../GridSheet';
|
|
@@ -16,7 +16,7 @@ import { SheetToolbar } from '../SheetToolbar';
|
|
|
16
16
|
|
|
17
17
|
export type SheetContainerProps = {
|
|
18
18
|
space: Space;
|
|
19
|
-
sheet:
|
|
19
|
+
sheet: Sheet.Sheet;
|
|
20
20
|
role?: string;
|
|
21
21
|
ignoreAttention?: boolean;
|
|
22
22
|
};
|
|
@@ -26,7 +26,11 @@ export const SheetContainer = ({ space, sheet, role, ignoreAttention }: SheetCon
|
|
|
26
26
|
|
|
27
27
|
return graph ? (
|
|
28
28
|
<SheetProvider sheet={sheet} graph={graph} ignoreAttention={ignoreAttention}>
|
|
29
|
-
<StackItem.Content
|
|
29
|
+
<StackItem.Content
|
|
30
|
+
toolbar
|
|
31
|
+
statusbar
|
|
32
|
+
classNames={[role === 'section' && 'aspect-video', role === 'story' && 'bs-full']}
|
|
33
|
+
>
|
|
30
34
|
<SheetToolbar id={fullyQualifiedId(sheet)} />
|
|
31
35
|
<GridSheet />
|
|
32
36
|
<FunctionEditor />
|
|
@@ -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'>;
|
|
@@ -2,27 +2,30 @@
|
|
|
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 from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { translations } from '../../translations';
|
|
13
11
|
|
|
14
12
|
import { SheetToolbar } from './SheetToolbar';
|
|
15
13
|
|
|
16
14
|
const DefaultStory = () => {
|
|
17
|
-
|
|
15
|
+
// TODO(wittjosiah): Depends on SheetProvider.
|
|
16
|
+
// return <SheetToolbar id='test' />;
|
|
17
|
+
return <>TODO</>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const meta = {
|
|
21
21
|
title: 'plugins/plugin-sheet/Toolbar',
|
|
22
22
|
component: SheetToolbar as any,
|
|
23
23
|
render: DefaultStory,
|
|
24
|
-
decorators: [withTheme
|
|
25
|
-
parameters: {
|
|
24
|
+
decorators: [withTheme],
|
|
25
|
+
parameters: {
|
|
26
|
+
layout: 'fullscreen',
|
|
27
|
+
translations,
|
|
28
|
+
},
|
|
26
29
|
} satisfies Meta<typeof DefaultStory>;
|
|
27
30
|
|
|
28
31
|
export default meta;
|
|
@@ -7,7 +7,6 @@ import React, { type PropsWithChildren, useMemo } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { useAppGraph } from '@dxos/app-framework';
|
|
9
9
|
import { type CompleteCellRange } from '@dxos/compute';
|
|
10
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
10
|
import {
|
|
12
11
|
type ActionGraphProps,
|
|
13
12
|
MenuProvider,
|
|
@@ -24,12 +23,6 @@ import { createAlign, useAlignState } from './align';
|
|
|
24
23
|
import { createStyle, useStyleState } from './style';
|
|
25
24
|
import { type ToolbarState, useToolbarState } from './useToolbarState';
|
|
26
25
|
|
|
27
|
-
//
|
|
28
|
-
// Root
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
export type SheetToolbarProps = ThemedClassName<PropsWithChildren<{ id: string }>>;
|
|
32
|
-
|
|
33
26
|
const createToolbarActions = (
|
|
34
27
|
model: SheetModel,
|
|
35
28
|
state: ToolbarState,
|
|
@@ -56,7 +49,9 @@ const createToolbarActions = (
|
|
|
56
49
|
});
|
|
57
50
|
};
|
|
58
51
|
|
|
59
|
-
export
|
|
52
|
+
export type SheetToolbarProps = PropsWithChildren<{ id: string }>;
|
|
53
|
+
|
|
54
|
+
export const SheetToolbar = ({ id }: SheetToolbarProps) => {
|
|
60
55
|
const { model, cursorFallbackRange } = useSheetContext();
|
|
61
56
|
const state = useToolbarState({});
|
|
62
57
|
useAlignState(state);
|
|
@@ -79,7 +74,7 @@ export const SheetToolbar = ({ id, classNames }: SheetToolbarProps) => {
|
|
|
79
74
|
|
|
80
75
|
return (
|
|
81
76
|
<MenuProvider {...menu} attendableId={id}>
|
|
82
|
-
<ToolbarMenu
|
|
77
|
+
<ToolbarMenu />
|
|
83
78
|
</MenuProvider>
|
|
84
79
|
);
|
|
85
80
|
};
|
|
@@ -7,7 +7,7 @@ import { useEffect } from 'react';
|
|
|
7
7
|
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
8
|
import { type ToolbarMenuActionGroupProperties, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
import { type SheetModel } from '../../model';
|
|
12
12
|
import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
|
|
13
13
|
import { useSheetContext } from '../SheetContext';
|
|
@@ -40,7 +40,7 @@ export const useAlignState = (state: Partial<AlignState>) => {
|
|
|
40
40
|
|
|
41
41
|
const createAlignGroupAction = (value?: AlignValue) =>
|
|
42
42
|
createMenuItemGroup('align', {
|
|
43
|
-
label: ['align label', { ns:
|
|
43
|
+
label: ['align label', { ns: meta.id }],
|
|
44
44
|
variant: 'toggleGroup',
|
|
45
45
|
selectCardinality: 'single',
|
|
46
46
|
value: `${alignKey}--${value}`,
|
|
@@ -79,7 +79,7 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
|
|
|
79
79
|
key: alignKey,
|
|
80
80
|
value: alignValue as AlignValue,
|
|
81
81
|
checked: state[alignKey] === alignValue,
|
|
82
|
-
label: [`range value ${alignValue} label`, { ns:
|
|
82
|
+
label: [`range value ${alignValue} label`, { ns: meta.id }],
|
|
83
83
|
icon,
|
|
84
84
|
testId: `grid.toolbar.${alignKey}.${alignValue}`,
|
|
85
85
|
},
|
|
@@ -7,7 +7,7 @@ import { useEffect } from 'react';
|
|
|
7
7
|
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
8
|
import { type ToolbarMenuActionGroupProperties, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
import { type SheetModel } from '../../model';
|
|
12
12
|
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '../../types';
|
|
13
13
|
import { useSheetContext } from '../SheetContext';
|
|
@@ -89,7 +89,7 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
89
89
|
key: 'style',
|
|
90
90
|
value: styleValue as StyleValue,
|
|
91
91
|
icon,
|
|
92
|
-
label: [`range value ${styleValue} label`, { ns:
|
|
92
|
+
label: [`range value ${styleValue} label`, { ns: meta.id }],
|
|
93
93
|
checked: !!state[styleValue as StyleValue],
|
|
94
94
|
},
|
|
95
95
|
);
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 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, { useEffect, useMemo } from 'react';
|
|
9
7
|
|
|
8
|
+
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { PublicKey } from '@dxos/keys';
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { useThemeContext } from '@dxos/react-ui';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
15
|
import {
|
|
15
16
|
createBasicExtensions,
|
|
16
17
|
createMarkdownExtensions,
|
|
@@ -19,13 +20,12 @@ import {
|
|
|
19
20
|
documentId,
|
|
20
21
|
useTextEditor,
|
|
21
22
|
} from '@dxos/react-ui-editor';
|
|
22
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
23
23
|
import { isNonNullable } from '@dxos/util';
|
|
24
24
|
|
|
25
25
|
import { GridSheet, SheetProvider, useComputeGraph } from '../components';
|
|
26
26
|
import { useSheetModel } from '../model';
|
|
27
27
|
import { useTestSheet, withComputeGraphDecorator } from '../testing';
|
|
28
|
-
import {
|
|
28
|
+
import { Sheet } from '../types';
|
|
29
29
|
|
|
30
30
|
import { compute, computeGraphFacet } from './compute';
|
|
31
31
|
|
|
@@ -42,7 +42,7 @@ type EditorProps = {
|
|
|
42
42
|
|
|
43
43
|
const SHEET_NAME = 'Test Sheet';
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const DefaultStory = ({ text }: EditorProps) => {
|
|
46
46
|
const id = useMemo(() => PublicKey.random(), []);
|
|
47
47
|
const { themeMode } = useThemeContext();
|
|
48
48
|
const space = useSpace();
|
|
@@ -52,7 +52,7 @@ const EditorStory = ({ text }: EditorProps) => {
|
|
|
52
52
|
initialValue: text,
|
|
53
53
|
extensions: [
|
|
54
54
|
createBasicExtensions(),
|
|
55
|
-
createMarkdownExtensions(
|
|
55
|
+
createMarkdownExtensions(),
|
|
56
56
|
createThemeExtensions({ themeMode, syntaxHighlighting: true }),
|
|
57
57
|
documentId.of(id.toHex()),
|
|
58
58
|
computeGraph && computeGraphFacet.of(computeGraph),
|
|
@@ -93,7 +93,7 @@ const Grid = () => {
|
|
|
93
93
|
const GraphStory = (props: EditorProps) => {
|
|
94
94
|
return (
|
|
95
95
|
<div className='grid grid-rows-2'>
|
|
96
|
-
<
|
|
96
|
+
<DefaultStory {...props} />
|
|
97
97
|
<Grid />
|
|
98
98
|
</div>
|
|
99
99
|
);
|
|
@@ -102,19 +102,22 @@ const GraphStory = (props: EditorProps) => {
|
|
|
102
102
|
const meta = {
|
|
103
103
|
title: 'plugins/plugin-sheet/extensions',
|
|
104
104
|
decorators: [
|
|
105
|
-
withClientProvider({ types: [SheetType], createIdentity: true, createSpace: true }),
|
|
106
|
-
withComputeGraphDecorator(),
|
|
107
105
|
withTheme,
|
|
108
|
-
|
|
106
|
+
withClientProvider({ types: [Sheet.Sheet], createIdentity: true, createSpace: true }),
|
|
107
|
+
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
108
|
+
withPluginManager({ plugins: [IntentPlugin()] }),
|
|
109
|
+
withComputeGraphDecorator(),
|
|
109
110
|
],
|
|
110
|
-
parameters: {
|
|
111
|
+
parameters: {
|
|
112
|
+
layout: 'fullscreen',
|
|
113
|
+
},
|
|
111
114
|
} satisfies Meta;
|
|
112
115
|
|
|
113
116
|
export default meta;
|
|
114
117
|
|
|
115
118
|
// TODO(burdon): Inline formulae.
|
|
116
|
-
export const Default: StoryObj<typeof
|
|
117
|
-
render:
|
|
119
|
+
export const Default: StoryObj<typeof DefaultStory> = {
|
|
120
|
+
render: DefaultStory,
|
|
118
121
|
args: {
|
|
119
122
|
text: str(
|
|
120
123
|
//
|
|
@@ -34,7 +34,7 @@ export const computeGraphFacet = singleValueFacet<ComputeGraph>();
|
|
|
34
34
|
|
|
35
35
|
export type ComputeOptions = {};
|
|
36
36
|
|
|
37
|
-
export const compute = (
|
|
37
|
+
export const compute = (_options: ComputeOptions = {}): Extension => {
|
|
38
38
|
let computeNode: ComputeNode | undefined;
|
|
39
39
|
|
|
40
40
|
const update = (state: EditorState, current?: RangeSet<Decoration>) => {
|
|
@@ -53,7 +53,6 @@ export const compute = (options: ComputeOptions = {}): Extension => {
|
|
|
53
53
|
const text = node.node.getChild('CodeText');
|
|
54
54
|
if (type === LANGUAGE_TAG && text) {
|
|
55
55
|
const formula = state.sliceDoc(text.from, text.to);
|
|
56
|
-
|
|
57
56
|
const iter = current?.iter(node.node.from);
|
|
58
57
|
if (iter?.value && iter?.value.spec.formula === formula) {
|
|
59
58
|
// Add existing widget.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
7
8
|
|
|
8
9
|
import {
|
|
@@ -17,13 +18,13 @@ import { debounce } from '@dxos/async';
|
|
|
17
18
|
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
18
19
|
import { Obj, Relation } from '@dxos/echo';
|
|
19
20
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
20
|
-
import {
|
|
21
|
+
import { Thread, ThreadAction } from '@dxos/plugin-thread/types';
|
|
21
22
|
import { Filter, Query, fullyQualifiedId, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
22
23
|
import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
|
|
23
24
|
import { AnchoredTo } from '@dxos/schema';
|
|
24
25
|
|
|
25
26
|
import { useSheetContext } from '../components';
|
|
26
|
-
import {
|
|
27
|
+
import { meta } from '../meta';
|
|
27
28
|
|
|
28
29
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
29
30
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -72,7 +73,7 @@ export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null
|
|
|
72
73
|
[model.sheet, setActiveRefs],
|
|
73
74
|
);
|
|
74
75
|
|
|
75
|
-
useIntentResolver(
|
|
76
|
+
useIntentResolver(meta.id, scrollIntoViewResolver);
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
export const useSelectThreadOnCellFocus = () => {
|
|
@@ -90,7 +91,7 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
90
91
|
|
|
91
92
|
const closestThread = anchors.find((anchor) => {
|
|
92
93
|
const source = Relation.getSource(anchor);
|
|
93
|
-
if (anchor.anchor && Obj.instanceOf(
|
|
94
|
+
if (anchor.anchor && Obj.instanceOf(Thread.Thread, source)) {
|
|
94
95
|
const range = parseThreadAnchorAsCellRange(anchor.anchor);
|
|
95
96
|
return range ? inRange(range, cellAddress) : false;
|
|
96
97
|
} else {
|
|
@@ -100,7 +101,7 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
100
101
|
|
|
101
102
|
if (closestThread) {
|
|
102
103
|
const primary = fullyQualifiedId(model.sheet);
|
|
103
|
-
const intent = pipe(
|
|
104
|
+
const intent = Function.pipe(
|
|
104
105
|
createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }),
|
|
105
106
|
chain(DeckAction.ChangeCompanion, { primary, companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments` }),
|
|
106
107
|
);
|
package/src/meta.ts
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/sheet',
|
|
11
10
|
name: 'Sheet',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
13
|
+
Create custom JavaScript functions and integrate with AI agents for advanced automation.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--grid-nine--regular',
|
|
16
|
+
iconHue: 'indigo',
|
|
15
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',
|
|
16
18
|
screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],
|
|
17
19
|
};
|
|
@@ -7,10 +7,10 @@ import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'v
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
9
9
|
import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { Function } from '@dxos/functions';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
14
14
|
|
|
15
15
|
import { SheetModel } from './sheet-model';
|
|
16
16
|
import { createTestGrid } from './testing';
|
|
@@ -18,7 +18,7 @@ import { createTestGrid } from './testing';
|
|
|
18
18
|
describe('SheetModel', () => {
|
|
19
19
|
let testBuilder: TestBuilder;
|
|
20
20
|
beforeEach(async () => {
|
|
21
|
-
testBuilder = new TestBuilder({ types: [
|
|
21
|
+
testBuilder = new TestBuilder({ types: [Function.Function], plugins: testFunctionPlugins });
|
|
22
22
|
await testBuilder.open();
|
|
23
23
|
});
|
|
24
24
|
afterEach(async () => {
|
|
@@ -31,7 +31,7 @@ describe('SheetModel', () => {
|
|
|
31
31
|
await graph.open();
|
|
32
32
|
|
|
33
33
|
// TODO(burdon): Create via factory.
|
|
34
|
-
const sheet =
|
|
34
|
+
const sheet = Sheet.make({ rows: 5, columns: 5 });
|
|
35
35
|
const model = new SheetModel(graph, sheet);
|
|
36
36
|
await model.open();
|
|
37
37
|
testBuilder.ctx.onDispose(() => model.close());
|