@dxos/plugin-sheet 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6
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/chunk-CBNIKBPQ.mjs +278 -0
- package/dist/lib/browser/chunk-CBNIKBPQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-GZ2EV64I.mjs +118 -0
- package/dist/lib/browser/chunk-GZ2EV64I.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/drop-axis-PB7F3LBV.mjs +23 -0
- package/dist/lib/browser/drop-axis-PB7F3LBV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +122 -114
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/insert-axis-DH5CO4AY.mjs +16 -0
- package/dist/lib/browser/insert-axis-DH5CO4AY.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs +16 -0
- package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs +65 -0
- package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -2
- package/dist/lib/node-esm/chunk-3ZYLQWHC.mjs +279 -0
- package/dist/lib/node-esm/chunk-3ZYLQWHC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-74MOADQ7.mjs +119 -0
- package/dist/lib/node-esm/chunk-74MOADQ7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs +24 -0
- package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +122 -114
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs +17 -0
- package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs +17 -0
- package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs +66 -0
- package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -2
- package/dist/types/src/SheetPlugin.d.ts +2 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +4 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +3 -2
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +9 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +3 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +29 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +10 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +63 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +7 -5
- package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
- package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
- package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +10 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +9 -5
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -66
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +13 -20
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +13 -19
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +1 -1
- package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/containers/RangeList/index.d.ts +3 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +58 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +0 -2
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +3 -3
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +1 -1
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +1 -1
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +45 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/drop-axis.d.ts +5 -0
- package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/insert-axis.d.ts +5 -0
- package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
- package/dist/types/src/operations/restore-axis.d.ts +5 -0
- package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/serializer.d.ts +1 -1
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +16 -16
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +38 -35
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +41 -35
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +18 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -68
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +2 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +93 -68
- package/src/SheetPlugin.tsx +63 -67
- package/src/capabilities/anchor-sort.ts +20 -15
- package/src/capabilities/compute-graph-registry.ts +18 -14
- package/src/capabilities/index.ts +12 -8
- package/src/capabilities/markdown.ts +20 -13
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +38 -29
- package/src/capabilities/state.ts +29 -0
- package/src/capabilities/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/compute-graph.stories.tsx +13 -8
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +10 -7
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +16 -15
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +80 -50
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +15 -9
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +48 -41
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +18 -6
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +50 -39
- package/src/components/SheetToolbar/align.ts +48 -23
- package/src/components/SheetToolbar/style.ts +51 -21
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +18 -14
- package/src/containers/RangeList/index.ts +7 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +109 -0
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/{components → containers}/SheetContainer/index.ts +1 -1
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +25 -15
- package/src/extensions/compute.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +16 -13
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +17 -60
- package/src/meta.ts +3 -3
- package/src/model/sheet-model.test.ts +3 -3
- package/src/model/sheet-model.ts +79 -47
- package/src/model/testing.ts +1 -1
- package/src/model/useSheetModel.ts +1 -1
- package/src/operations/definitions.ts +73 -0
- package/src/operations/drop-axis.ts +26 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/insert-axis.ts +19 -0
- package/src/operations/restore-axis.ts +19 -0
- package/src/operations/scroll-to-anchor.ts +31 -0
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +2 -1
- package/src/sanity.test.ts +6 -3
- package/src/serializer.ts +2 -2
- package/src/testing/data.ts +1 -1
- package/src/testing/testing.tsx +2 -2
- package/src/translations.ts +38 -35
- package/src/types/Sheet.ts +31 -31
- package/src/types/capabilities.ts +26 -0
- package/src/types/index.ts +1 -0
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +4 -40
- package/src/types/util.ts +2 -1
- package/dist/lib/browser/SheetContainer-GTINUSNB.mjs +0 -349
- package/dist/lib/browser/SheetContainer-GTINUSNB.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-R5CB37J7.mjs +0 -24
- package/dist/lib/browser/anchor-sort-R5CB37J7.mjs.map +0 -7
- package/dist/lib/browser/chunk-73AV3NH6.mjs +0 -15
- package/dist/lib/browser/chunk-73AV3NH6.mjs.map +0 -7
- package/dist/lib/browser/chunk-7VEWYJJN.mjs +0 -234
- package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVJ3QW3F.mjs +0 -907
- package/dist/lib/browser/chunk-DVJ3QW3F.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWFAAGXL.mjs +0 -28
- package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +0 -7
- package/dist/lib/browser/chunk-LS6D4GG7.mjs +0 -850
- package/dist/lib/browser/chunk-LS6D4GG7.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-66OAYVQF.mjs +0 -56
- package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +0 -7
- package/dist/lib/browser/markdown-B6VKYY2S.mjs +0 -26
- package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +0 -7
- package/dist/lib/browser/react-surface-F3VQPGDV.mjs +0 -53
- package/dist/lib/browser/react-surface-F3VQPGDV.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-PW4KNZME.mjs +0 -350
- package/dist/lib/node-esm/SheetContainer-PW4KNZME.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-HEND452H.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-HEND452H.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44YTKTMP.mjs +0 -16
- package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4H2EHVWE.mjs +0 -908
- package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4QV4AGWK.mjs +0 -236
- package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HILDMVPL.mjs +0 -29
- package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LYUIM3QG.mjs +0 -851
- package/dist/lib/node-esm/chunk-LYUIM3QG.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-VKY7HXU2.mjs +0 -27
- package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-GGX76V2Y.mjs +0 -54
- package/dist/lib/node-esm/react-surface-GGX76V2Y.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -54
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/index.d.ts +0 -2
- package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -55
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -90
- package/src/components/SheetContainer/SheetContainer.tsx +0 -40
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './ComputeGraph';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './RangeList';
|
|
10
|
-
export * from './SheetContext';
|
|
11
|
-
|
|
12
|
-
export const SheetContainer = lazy(() => import('./SheetContainer'));
|
|
6
|
+
export * from './Sheet';
|
|
@@ -6,13 +6,13 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import { rangeToA1Notation } from '@dxos/compute';
|
|
9
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Input, Message, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { List } from '@dxos/react-ui-list';
|
|
11
|
-
import { ghostHover } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
|
-
import { meta } from '
|
|
14
|
-
import { rangeFromIndex } from '
|
|
15
|
-
import { Sheet } from '
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { rangeFromIndex } from '#types';
|
|
15
|
+
import { Sheet } from '#types';
|
|
16
16
|
|
|
17
17
|
export type RangeListProps = {
|
|
18
18
|
sheet: Sheet.Sheet;
|
|
@@ -25,28 +25,32 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
25
25
|
const handleDeleteRange = useCallback(
|
|
26
26
|
(range: Sheet.Range) => {
|
|
27
27
|
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
28
|
-
|
|
28
|
+
Obj.change(sheet, (obj) => {
|
|
29
|
+
obj.ranges.splice(index, 1);
|
|
30
|
+
});
|
|
29
31
|
},
|
|
30
32
|
[sheet],
|
|
31
33
|
);
|
|
32
34
|
return (
|
|
33
35
|
<>
|
|
34
|
-
<
|
|
36
|
+
<Input.Root>
|
|
37
|
+
<Input.Label>{t('range-list.heading')}</Input.Label>
|
|
38
|
+
</Input.Root>
|
|
35
39
|
{sheet.ranges.length < 1 ? (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
</
|
|
40
|
+
<Message.Root>
|
|
41
|
+
<Message.Title>{t('no-ranges.message')}</Message.Title>
|
|
42
|
+
</Message.Root>
|
|
39
43
|
) : (
|
|
40
44
|
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
41
45
|
{({ items: ranges }) =>
|
|
42
46
|
ranges.map((range, i) => (
|
|
43
|
-
<List.Item key={i} item={range}
|
|
47
|
+
<List.Item key={i} item={range}>
|
|
44
48
|
<List.ItemDragHandle />
|
|
45
49
|
<List.ItemTitle onClick={() => handleSelectRange(range)}>
|
|
46
|
-
{t('range
|
|
50
|
+
{t('range.title', {
|
|
47
51
|
position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),
|
|
48
|
-
key: t(`range
|
|
49
|
-
value: t(`range
|
|
52
|
+
key: t(`range-key-${range.key}.label`),
|
|
53
|
+
value: t(`range-value-${range.value}.label`),
|
|
50
54
|
})}
|
|
51
55
|
</List.ItemTitle>
|
|
52
56
|
<List.ItemDeleteButton onClick={() => handleDeleteRange(range)} />
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { Operation, OperationHandlerSet } from '@dxos/operation';
|
|
13
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
17
|
+
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
18
|
+
|
|
19
|
+
import { ComputeGraphContext, useComputeGraph } from '#components';
|
|
20
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
21
|
+
import { translations } from '../../translations';
|
|
22
|
+
import { Sheet } from '#types';
|
|
23
|
+
import { SheetOperation } from '#operations';
|
|
24
|
+
import RangeList from '../RangeList';
|
|
25
|
+
|
|
26
|
+
import { SheetContainer } from './SheetContainer';
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
title: 'plugins/plugin-sheet/containers/SheetContainer',
|
|
30
|
+
component: SheetContainer,
|
|
31
|
+
decorators: [
|
|
32
|
+
withLayout({ layout: 'fullscreen' }),
|
|
33
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
34
|
+
withComputeGraphDecorator(),
|
|
35
|
+
withPluginManager({
|
|
36
|
+
plugins: [...corePlugins()],
|
|
37
|
+
capabilities: [
|
|
38
|
+
Capability.contributes(
|
|
39
|
+
Capabilities.OperationHandler,
|
|
40
|
+
OperationHandlerSet.make(
|
|
41
|
+
Operation.withHandler(SheetOperation.DropAxis, ({ model, axis, axisIndex }) =>
|
|
42
|
+
Effect.sync(() => {
|
|
43
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
44
|
+
return { axis, axisIndex, index: 0, axisMeta: null, values: [] };
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
],
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
parameters: {
|
|
53
|
+
layout: 'fullscreen',
|
|
54
|
+
translations,
|
|
55
|
+
},
|
|
56
|
+
} satisfies Meta<typeof SheetContainer>;
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
|
|
60
|
+
export const Default = () => {
|
|
61
|
+
const space = useSpace();
|
|
62
|
+
const graph = useComputeGraph(space);
|
|
63
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
64
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
65
|
+
if (!sheet || !space || !registry) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
71
|
+
<SheetContainer
|
|
72
|
+
role='article'
|
|
73
|
+
space={space}
|
|
74
|
+
subject={sheet}
|
|
75
|
+
attendableId='test'
|
|
76
|
+
registry={registry}
|
|
77
|
+
ignoreAttention
|
|
78
|
+
/>
|
|
79
|
+
</AttendableContainer>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Spec = () => {
|
|
84
|
+
const space = useSpace();
|
|
85
|
+
const graph = useComputeGraph(space);
|
|
86
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
87
|
+
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
88
|
+
if (!sheet || !space || !registry) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
94
|
+
<div role='none' className='w-full grid grid-cols-[1fr_20rem]'>
|
|
95
|
+
<SheetContainer
|
|
96
|
+
role='article'
|
|
97
|
+
space={space}
|
|
98
|
+
subject={sheet}
|
|
99
|
+
attendableId='test'
|
|
100
|
+
registry={registry}
|
|
101
|
+
ignoreAttention
|
|
102
|
+
/>
|
|
103
|
+
<div role='none' data-testid='grid.range-list'>
|
|
104
|
+
<RangeList sheet={sheet} />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</AttendableContainer>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type ComputeGraphRegistry } from '@dxos/compute';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';
|
|
13
|
+
import { type Sheet as SheetType } from '#types';
|
|
14
|
+
|
|
15
|
+
export type SheetContainerProps = ObjectSurfaceProps<
|
|
16
|
+
SheetType.Sheet,
|
|
17
|
+
{
|
|
18
|
+
space: Space;
|
|
19
|
+
registry: ComputeGraphRegistry;
|
|
20
|
+
ignoreAttention?: boolean;
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const SheetContainer = ({ registry, ...props }: SheetContainerProps) => (
|
|
25
|
+
<ComputeGraphContextProvider registry={registry}>
|
|
26
|
+
<SheetContainerInner {...props} />
|
|
27
|
+
</ComputeGraphContextProvider>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const SheetContainerInner = ({
|
|
31
|
+
role,
|
|
32
|
+
subject: sheet,
|
|
33
|
+
attendableId,
|
|
34
|
+
space,
|
|
35
|
+
ignoreAttention,
|
|
36
|
+
}: Omit<SheetContainerProps, 'registry'>) => {
|
|
37
|
+
const graph = useComputeGraph(space);
|
|
38
|
+
if (!graph) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>
|
|
44
|
+
<Panel.Root classNames={role === 'section' && 'aspect-aquare'}>
|
|
45
|
+
<Panel.Toolbar asChild>
|
|
46
|
+
<Sheet.Toolbar />
|
|
47
|
+
</Panel.Toolbar>
|
|
48
|
+
<Panel.Content asChild>
|
|
49
|
+
<Sheet.Content />
|
|
50
|
+
</Panel.Content>
|
|
51
|
+
<Panel.Statusbar asChild>
|
|
52
|
+
<Sheet.Statusbar />
|
|
53
|
+
</Panel.Statusbar>
|
|
54
|
+
</Panel.Root>
|
|
55
|
+
</Sheet.Root>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const RangeList: ComponentType<any> = lazy(() => import('./RangeList'));
|
|
8
|
+
export const SheetContainer: ComponentType<any> = lazy(() => import('./SheetContainer'));
|
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
9
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
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
15
16
|
import {
|
|
16
17
|
createBasicExtensions,
|
|
17
18
|
createMarkdownExtensions,
|
|
18
19
|
createThemeExtensions,
|
|
19
20
|
decorateMarkdown,
|
|
20
21
|
documentId,
|
|
21
|
-
|
|
22
|
-
} from '@dxos/react-ui-editor';
|
|
22
|
+
} from '@dxos/ui-editor';
|
|
23
23
|
import { isNonNullable } from '@dxos/util';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import { Sheet, useComputeGraph } from '#components';
|
|
26
26
|
import { useSheetModel } from '../model';
|
|
27
|
-
import { useTestSheet, withComputeGraphDecorator } from '
|
|
28
|
-
import { Sheet } from '
|
|
27
|
+
import { useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
28
|
+
import { Sheet as SheetType } from '#types';
|
|
29
29
|
|
|
30
30
|
import { compute, computeGraphFacet } from './compute';
|
|
31
31
|
|
|
@@ -73,7 +73,12 @@ const Grid = () => {
|
|
|
73
73
|
const model = useSheetModel(graph, sheet);
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (model) {
|
|
76
|
-
model.setValues({
|
|
76
|
+
model.setValues({
|
|
77
|
+
A1: { value: 100 },
|
|
78
|
+
A2: { value: 200 },
|
|
79
|
+
A3: { value: 300 },
|
|
80
|
+
A5: { value: '=SUM(A1:A3)' },
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
}, [model]);
|
|
79
84
|
|
|
@@ -83,9 +88,9 @@ const Grid = () => {
|
|
|
83
88
|
|
|
84
89
|
return (
|
|
85
90
|
<div className='flex w-[40rem] overflow-hidden'>
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
</
|
|
91
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId='test'>
|
|
92
|
+
<Sheet.Content />
|
|
93
|
+
</Sheet.Root>
|
|
89
94
|
</div>
|
|
90
95
|
);
|
|
91
96
|
};
|
|
@@ -100,12 +105,17 @@ const GraphStory = (props: EditorProps) => {
|
|
|
100
105
|
};
|
|
101
106
|
|
|
102
107
|
const meta = {
|
|
103
|
-
title: 'plugins/plugin-sheet/extensions',
|
|
108
|
+
title: 'plugins/plugin-sheet/extensions/compute',
|
|
104
109
|
decorators: [
|
|
105
|
-
withTheme,
|
|
106
|
-
|
|
110
|
+
withTheme(),
|
|
111
|
+
withLayout({ layout: 'fullscreen' }),
|
|
112
|
+
withClientProvider({
|
|
113
|
+
types: [SheetType.Sheet],
|
|
114
|
+
createIdentity: true,
|
|
115
|
+
createSpace: true,
|
|
116
|
+
}),
|
|
107
117
|
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
108
|
-
withPluginManager({ plugins: [
|
|
118
|
+
withPluginManager({ plugins: [OperationPlugin(), RuntimePlugin()] }),
|
|
109
119
|
withComputeGraphDecorator(),
|
|
110
120
|
],
|
|
111
121
|
parameters: {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
createSheetName,
|
|
24
24
|
} from '@dxos/compute';
|
|
25
25
|
import { invariant } from '@dxos/invariant';
|
|
26
|
-
import { documentId, singleValueFacet } from '@dxos/
|
|
26
|
+
import { documentId, singleValueFacet } from '@dxos/ui-editor';
|
|
27
27
|
|
|
28
28
|
const LANGUAGE_TAG = 'dx';
|
|
29
29
|
|
|
@@ -20,8 +20,8 @@ import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
|
20
20
|
|
|
21
21
|
import { type FunctionDefinition } from '@dxos/compute';
|
|
22
22
|
import { RANGE_NOTATION } from '@dxos/compute';
|
|
23
|
-
import { singleValueFacet } from '@dxos/
|
|
24
|
-
import { mx } from '@dxos/
|
|
23
|
+
import { singleValueFacet } from '@dxos/ui-editor';
|
|
24
|
+
import { mx } from '@dxos/ui-theme';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* https://codemirror.net/examples/styling
|
|
@@ -33,30 +33,30 @@ const highlightStyles = HighlightStyle.define([
|
|
|
33
33
|
// Function.
|
|
34
34
|
{
|
|
35
35
|
tag: tags.name,
|
|
36
|
-
class: 'text-
|
|
36
|
+
class: 'text-accent-text',
|
|
37
37
|
},
|
|
38
38
|
// Range.
|
|
39
39
|
{
|
|
40
40
|
tag: tags.tagName,
|
|
41
|
-
class: 'text-
|
|
41
|
+
class: 'text-pink-text',
|
|
42
42
|
},
|
|
43
43
|
// Values.
|
|
44
44
|
{
|
|
45
45
|
tag: tags.number,
|
|
46
|
-
class: 'text-
|
|
46
|
+
class: 'text-teal-text',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
tag: tags.bool,
|
|
50
|
-
class: 'text-
|
|
50
|
+
class: 'text-teal-text',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
tag: tags.string,
|
|
54
|
-
class: 'text-
|
|
54
|
+
class: 'text-teal-text',
|
|
55
55
|
},
|
|
56
56
|
// Error.
|
|
57
57
|
{
|
|
58
58
|
tag: tags.invalid,
|
|
59
|
-
class: 'text-
|
|
59
|
+
class: 'text-un-accent',
|
|
60
60
|
},
|
|
61
61
|
]);
|
|
62
62
|
|
|
@@ -75,7 +75,10 @@ export type SheetExtensionOptions = {
|
|
|
75
75
|
* https://hyperformula.handsontable.com/guide/key-concepts.html#grammar
|
|
76
76
|
*/
|
|
77
77
|
export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions): Extension => {
|
|
78
|
-
const { extension, language } = spreadsheet({
|
|
78
|
+
const { extension, language } = spreadsheet({
|
|
79
|
+
idiom: 'en-US',
|
|
80
|
+
decimalSeparator: '.',
|
|
81
|
+
});
|
|
79
82
|
|
|
80
83
|
const createCompletion = (name: string) => {
|
|
81
84
|
const { section = 'Custom', description, syntax } = functions.find((value) => value.name === name) ?? {};
|
|
@@ -94,7 +97,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
94
97
|
|
|
95
98
|
const title = document.createElement('h2');
|
|
96
99
|
title.innerText = name;
|
|
97
|
-
title.className = 'text-lg font-mono text-
|
|
100
|
+
title.className = 'text-lg font-mono text-accent-text';
|
|
98
101
|
root.appendChild(title);
|
|
99
102
|
|
|
100
103
|
if (description) {
|
|
@@ -107,7 +110,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
107
110
|
if (syntax) {
|
|
108
111
|
const detail = document.createElement('pre');
|
|
109
112
|
detail.innerText = syntax;
|
|
110
|
-
detail.className = 'whitespace-pre-wrap text-
|
|
113
|
+
detail.className = 'whitespace-pre-wrap text-green-text';
|
|
111
114
|
root.appendChild(detail);
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -166,8 +169,8 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
166
169
|
icons: false,
|
|
167
170
|
tooltipClass: () =>
|
|
168
171
|
mx(
|
|
169
|
-
'!-left-[1px] !top-[33px] !-m-0 border
|
|
170
|
-
'[&>ul>li[aria-selected]]:!bg-
|
|
172
|
+
'!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
|
|
173
|
+
'[&>ul>li[aria-selected]]:!bg-accent-surface',
|
|
171
174
|
'border-separator',
|
|
172
175
|
),
|
|
173
176
|
}),
|
package/src/index.ts
CHANGED
|
@@ -2,29 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Function from 'effect/Function';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
chain,
|
|
12
|
-
createIntent,
|
|
13
|
-
createResolver,
|
|
14
|
-
useIntentDispatcher,
|
|
15
|
-
useIntentResolver,
|
|
16
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { linkedSegment } from '@dxos/react-ui-attention';
|
|
17
9
|
import { debounce } from '@dxos/async';
|
|
18
10
|
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
19
11
|
import { Obj, Relation } from '@dxos/echo';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { Filter, Query,
|
|
23
|
-
import {
|
|
24
|
-
import { AnchoredTo } from '@dxos/schema';
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/operations';
|
|
13
|
+
import { ThreadOperation } from '@dxos/plugin-thread/operations';
|
|
14
|
+
import { Filter, Query, useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { AnchoredTo, Thread } from '@dxos/types';
|
|
25
16
|
|
|
26
|
-
import { useSheetContext } from '
|
|
27
|
-
import { meta } from '../meta';
|
|
17
|
+
import { useSheetContext } from '#components';
|
|
28
18
|
|
|
29
19
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
30
20
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -43,45 +33,12 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
43
33
|
}
|
|
44
34
|
};
|
|
45
35
|
|
|
46
|
-
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
47
|
-
const { model, setActiveRefs } = useSheetContext();
|
|
48
|
-
const scrollIntoViewResolver = useMemo(
|
|
49
|
-
() =>
|
|
50
|
-
createResolver({
|
|
51
|
-
intent: LayoutAction.ScrollIntoView,
|
|
52
|
-
position: 'hoist',
|
|
53
|
-
filter: (
|
|
54
|
-
data,
|
|
55
|
-
): data is {
|
|
56
|
-
part: 'current';
|
|
57
|
-
subject: string;
|
|
58
|
-
options: { cursor: string; ref: GridContentProps['activeRefs'] };
|
|
59
|
-
} => {
|
|
60
|
-
if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
|
|
65
|
-
},
|
|
66
|
-
resolve: ({ options: { cursor, ref } }) => {
|
|
67
|
-
setActiveRefs(ref);
|
|
68
|
-
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
69
|
-
const range = parseThreadAnchorAsCellRange(cursor!);
|
|
70
|
-
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
[model.sheet, setActiveRefs],
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
useIntentResolver(meta.id, scrollIntoViewResolver);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
36
|
export const useSelectThreadOnCellFocus = () => {
|
|
80
37
|
const { model, cursor } = useSheetContext();
|
|
81
|
-
const {
|
|
38
|
+
const { invokePromise } = useOperationInvoker();
|
|
82
39
|
|
|
83
|
-
const
|
|
84
|
-
const anchors = useQuery(
|
|
40
|
+
const db = Obj.getDatabase(model.sheet);
|
|
41
|
+
const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
85
42
|
|
|
86
43
|
const selectClosestThread = useCallback(
|
|
87
44
|
(cellAddress: CellAddress) => {
|
|
@@ -100,15 +57,15 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
100
57
|
});
|
|
101
58
|
|
|
102
59
|
if (closestThread) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
60
|
+
void (async () => {
|
|
61
|
+
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
62
|
+
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
63
|
+
companion: linkedSegment('comments'),
|
|
64
|
+
});
|
|
65
|
+
})();
|
|
109
66
|
}
|
|
110
67
|
},
|
|
111
|
-
[
|
|
68
|
+
[invokePromise, anchors],
|
|
112
69
|
);
|
|
113
70
|
|
|
114
71
|
const debounced = useMemo(() => {
|
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
9
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.sheet',
|
|
10
10
|
name: 'Sheet',
|
|
11
11
|
description: trim`
|
|
12
12
|
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
@@ -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 { Function } from '@dxos/functions';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
12
|
|
|
13
|
-
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '
|
|
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: [Operation.PersistentOperation], plugins: testFunctionPlugins });
|
|
22
22
|
await testBuilder.open();
|
|
23
23
|
});
|
|
24
24
|
afterEach(async () => {
|