@dxos/plugin-sheet 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
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/RangeList-S3SHV7T6.mjs → neutral/RangeList-HYB5S6KQ.mjs} +21 -28
- package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
- package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs +33 -0
- package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs.map +7 -0
- package/dist/lib/neutral/SheetPlugin.mjs +48 -0
- package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
- package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
- package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
- package/dist/lib/{browser/anchor-sort-DZ3IHHJJ.mjs → neutral/anchor-sort-TTCKGX7V.mjs} +5 -7
- package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +25 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4GWJDLTH.mjs +83 -0
- package/dist/lib/neutral/chunk-4GWJDLTH.mjs.map +7 -0
- package/dist/lib/{browser/chunk-NNWF7EKC.mjs → neutral/chunk-4SBAIU6F.mjs} +3 -3
- package/dist/lib/neutral/chunk-4SBAIU6F.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/{browser/chunk-S445OQGW.mjs → neutral/chunk-KC2SMDNF.mjs} +167 -191
- package/dist/lib/neutral/chunk-KC2SMDNF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YFHTB6MX.mjs +8 -0
- package/dist/lib/neutral/chunk-YFHTB6MX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZWOQCLH7.mjs +21 -0
- package/dist/lib/neutral/chunk-ZWOQCLH7.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs +20 -0
- package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs.map +7 -0
- package/dist/lib/{browser/SheetContainer-I3NFVVDQ.mjs → neutral/components/index.mjs} +160 -414
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/{browser/compute-graph-registry-W6HO2G3P.mjs → neutral/compute-graph-registry-IEQBF5XZ.mjs} +5 -6
- package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-OKQAXJCW.mjs +27 -0
- package/dist/lib/neutral/create-object-OKQAXJCW.mjs.map +7 -0
- package/dist/lib/neutral/drop-axis-G6UOXG54.mjs +23 -0
- package/dist/lib/neutral/drop-axis-G6UOXG54.mjs.map +7 -0
- package/dist/lib/{browser/types → neutral}/index.mjs +14 -5
- package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs +16 -0
- package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs.map +7 -0
- package/dist/lib/{browser/markdown-S6GVLHB4.mjs → neutral/markdown-I2AKJYPF.mjs} +5 -6
- package/dist/lib/neutral/markdown-I2AKJYPF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
- package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-KIU6DGKW.mjs → neutral/react-surface-ID4JCAFR.mjs} +12 -19
- package/dist/lib/neutral/react-surface-ID4JCAFR.mjs.map +7 -0
- package/dist/lib/neutral/restore-axis-44DM6N54.mjs +16 -0
- package/dist/lib/neutral/restore-axis-44DM6N54.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-WHX3HJC7.mjs +33 -0
- package/dist/lib/neutral/scroll-to-anchor-WHX3HJC7.mjs.map +7 -0
- package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
- package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +103 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +55 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{node-esm → neutral}/types/index.mjs +6 -6
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
- package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
- package/dist/types/src/SheetPlugin.d.ts +1 -0
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/SheetPlugin.node.d.ts +4 -0
- package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
- package/dist/types/src/SheetPlugin.test.d.ts +2 -0
- package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/comment-config.d.ts +12 -0
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +23 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- 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.map +1 -0
- package/dist/types/src/capabilities/{compute-graph-registry/compute-graph-registry.d.ts → state.d.ts} +3 -2
- 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/ComputeGraphContextProvider.d.ts +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.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +10 -4
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +4 -3
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -1
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +77 -39
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContent/util.d.ts +1 -1
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetRoot/SheetRoot.d.ts +5 -3
- package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -1
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +4 -3
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -8
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -68
- 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 +2 -2
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/containers/RangeList/RangeList.d.ts +2 -2
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/containers/RangeList/index.d.ts +1 -2
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -1
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +4 -4
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +74 -38
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/SheetContainer/index.d.ts +1 -2
- package/dist/types/src/containers/SheetContainer/index.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.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +2 -2
- 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 +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- 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 +3 -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/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- 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 +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +3 -3
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +74 -39
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +2 -2
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/SheetCapabilities.d.ts +16 -0
- package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/SheetOperation.d.ts +45 -0
- package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -92
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +1 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +116 -73
- package/src/SheetPlugin.node.ts +21 -0
- package/src/SheetPlugin.test.ts +30 -0
- package/src/SheetPlugin.tsx +25 -35
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +1 -1
- package/src/capabilities/comment-config.ts +24 -0
- package/src/capabilities/{compute-graph-registry/compute-graph-registry.ts → compute-graph-registry.ts} +4 -2
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +17 -5
- package/src/capabilities/{markdown/markdown.ts → markdown.ts} +3 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +12 -9
- package/src/capabilities/state.ts +29 -0
- package/src/capabilities/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +17 -14
- package/src/components/SheetContent/SheetCellEditor.stories.tsx +8 -7
- package/src/components/SheetContent/SheetContent.stories.tsx +10 -10
- package/src/components/SheetContent/SheetContent.tsx +40 -23
- package/src/components/SheetContent/util.ts +3 -2
- package/src/components/SheetRoot/SheetRoot.tsx +18 -7
- package/src/components/SheetStatusbar/SheetStatusbar.tsx +15 -8
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +1 -1
- package/src/components/SheetToolbar/SheetToolbar.tsx +15 -20
- package/src/components/SheetToolbar/align.ts +9 -9
- package/src/components/SheetToolbar/style.ts +7 -7
- package/src/containers/RangeList/RangeList.tsx +17 -17
- package/src/containers/RangeList/index.ts +1 -3
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +36 -20
- package/src/containers/SheetContainer/SheetContainer.tsx +8 -8
- package/src/containers/SheetContainer/index.ts +1 -3
- package/src/extensions/compute.stories.tsx +9 -9
- package/src/extensions/compute.ts +1 -1
- package/src/extensions/editor/sheet-extension.test.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +2 -2
- package/src/index.ts +2 -2
- package/src/integrations/thread-ranges.ts +7 -39
- package/src/meta.ts +1 -1
- package/src/model/sheet-model.test.ts +5 -5
- package/src/model/sheet-model.ts +17 -17
- package/src/model/testing.ts +2 -2
- package/src/model/useSheetModel.ts +3 -2
- package/src/operations/drop-axis.ts +26 -0
- package/src/operations/index.ts +12 -0
- package/src/operations/insert-axis.ts +19 -0
- package/src/operations/restore-axis.ts +19 -0
- package/src/operations/scroll-to-anchor.ts +30 -0
- package/src/playwright/sheet.spec.ts +2 -2
- package/src/plugin.ts +11 -0
- 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 +4 -4
- package/src/translations.ts +41 -36
- package/src/types/Sheet.ts +15 -9
- package/src/types/SheetCapabilities.ts +26 -0
- package/src/types/SheetOperation.ts +75 -0
- package/src/types/index.ts +4 -2
- package/src/types/types.ts +0 -80
- package/src/types/util.ts +1 -1
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs.map +0 -7
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-NNWF7EKC.mjs.map +0 -7
- package/dist/lib/browser/chunk-S445OQGW.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -145
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/markdown-S6GVLHB4.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs +0 -79
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +0 -7
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs +0 -54
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs +0 -1806
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs +0 -236
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs +0 -398
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -146
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs +0 -30
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs +0 -52
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -6
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/compute-graph-registry/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -77
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/types/capabilities.ts +0 -14
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{anchor-sort/anchor-sort.d.ts → anchor-sort.d.ts} +0 -0
- /package/dist/types/src/capabilities/{markdown/markdown.d.ts → markdown.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
// Copyright 2025 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { SheetOperation } from '../types';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof SheetOperation.InsertAxis> = SheetOperation.InsertAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, index, count }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'insertColumns' : 'insertRows'](index, count);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
// Copyright 2025 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { SheetOperation } from '../types';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof SheetOperation.RestoreAxis> = SheetOperation.RestoreAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, ...restoreData }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'restoreColumn' : 'restoreRow'](restoreData);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { parseThreadAnchorAsCellRange } from '../integrations/thread-ranges';
|
|
11
|
+
import { SheetCapabilities, SheetOperation } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof SheetOperation.ScrollToAnchor> = SheetOperation.ScrollToAnchor.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* ({ subject, cursor, ref }) {
|
|
16
|
+
const gridInstances = yield* Capability.get(SheetCapabilities.GridInstances);
|
|
17
|
+
const entry = gridInstances.get(subject);
|
|
18
|
+
if (!entry) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
entry.setActiveRefs(ref);
|
|
22
|
+
const range = parseThreadAnchorAsCellRange(cursor);
|
|
23
|
+
if (range) {
|
|
24
|
+
entry.grid.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export default handler;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Page, expect, test } from '@playwright/test';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { random } from '@dxos/random';
|
|
8
8
|
import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
|
|
9
9
|
|
|
10
10
|
import { SheetManager } from './sheet-manager';
|
|
@@ -39,7 +39,7 @@ test.describe('plugin-sheet', () => {
|
|
|
39
39
|
// Confirm editor displays
|
|
40
40
|
await expect(sheet.cellEditor()).toBeVisible();
|
|
41
41
|
// Type in a value and press enter
|
|
42
|
-
const testString =
|
|
42
|
+
const testString = random.string.uuid();
|
|
43
43
|
await sheet.setFocusedCellValue(testString, 'Enter');
|
|
44
44
|
// Expect that value to now show in the grid
|
|
45
45
|
await expect(sheet.cellByText(testString)).toBeVisible();
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const SheetPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { SheetOperationHandlerSet } from './operations';
|
package/src/sanity.test.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Client } from '@dxos/client';
|
|
8
|
-
import {
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
|
|
10
11
|
// Part 2.
|
|
11
12
|
// TODO(burdon): Cannot test outside of browser.
|
|
@@ -22,7 +23,7 @@ import { Function } from '@dxos/functions';
|
|
|
22
23
|
describe('test', () => {
|
|
23
24
|
test('test', async () => {
|
|
24
25
|
const client = new Client();
|
|
25
|
-
await client.addTypes([
|
|
26
|
+
await client.addTypes([Operation.PersistentOperation]);
|
|
26
27
|
await client.initialize();
|
|
27
28
|
await client.halo.createIdentity();
|
|
28
29
|
|
|
@@ -33,7 +34,9 @@ describe('test', () => {
|
|
|
33
34
|
// - ERROR "process.nextTick is not a function"
|
|
34
35
|
// - ERROR "Identifier 'Buffer' has already been declared" if { nodeExternal: true }
|
|
35
36
|
const space = await client.spaces.create();
|
|
36
|
-
const fn = space.db.add(
|
|
37
|
+
const fn = space.db.add(
|
|
38
|
+
Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: 'HELLO' }),
|
|
39
|
+
);
|
|
37
40
|
expect(fn).to.exist;
|
|
38
41
|
});
|
|
39
42
|
});
|
package/src/serializer.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { Obj } from '@dxos/echo';
|
|
6
6
|
import { getObjectCore } from '@dxos/echo-db';
|
|
7
|
-
import { type TypedObjectSerializer } from '@dxos/plugin-space
|
|
7
|
+
import { type TypedObjectSerializer } from '@dxos/plugin-space';
|
|
8
8
|
|
|
9
|
-
import { Sheet } from '
|
|
9
|
+
import { Sheet } from '#types';
|
|
10
10
|
|
|
11
11
|
export const serializer: TypedObjectSerializer<Sheet.Sheet> = {
|
|
12
12
|
serialize: async ({ object }): Promise<string> => {
|
package/src/testing/data.ts
CHANGED
package/src/testing/testing.tsx
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import { type Decorator } from '@storybook/react';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute';
|
|
9
|
-
import { createMockedComputeRuntimeProvider } from '@dxos/compute/testing';
|
|
8
|
+
import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { createMockedComputeRuntimeProvider } from '@dxos/compute-hyperformula/testing';
|
|
10
10
|
import { type Space } from '@dxos/react-client/echo';
|
|
11
11
|
import { useAsyncState } from '@dxos/react-hooks';
|
|
12
12
|
|
|
13
|
-
import { ComputeGraphContextProvider } from '
|
|
14
|
-
import { Sheet } from '
|
|
13
|
+
import { ComputeGraphContextProvider } from '#components';
|
|
14
|
+
import { Sheet } from '#types';
|
|
15
15
|
|
|
16
16
|
export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: Sheet.SheetProps) => {
|
|
17
17
|
const [sheet] = useAsyncState(async () => {
|
package/src/translations.ts
CHANGED
|
@@ -4,49 +4,54 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
8
|
-
import { Sheet } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
import { Sheet } from '#types';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
13
|
[Sheet.Sheet.typename]: {
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'object
|
|
14
|
+
'typename.label': 'Sheet',
|
|
15
|
+
'typename.label_zero': 'Sheets',
|
|
16
|
+
'typename.label_one': 'Sheet',
|
|
17
|
+
'typename.label_other': 'Sheets',
|
|
18
|
+
'object-name.placeholder': 'New sheet',
|
|
19
|
+
'add-object.label': 'Add sheet',
|
|
20
|
+
'rename-object.label': 'Rename sheet',
|
|
21
|
+
'delete-object.label': 'Delete sheet',
|
|
22
|
+
'object-deleted.label': 'Sheet deleted',
|
|
22
23
|
},
|
|
23
24
|
[meta.id]: {
|
|
24
|
-
'plugin
|
|
25
|
-
'cell
|
|
26
|
-
|
|
27
|
-
'range
|
|
28
|
-
'range
|
|
29
|
-
|
|
30
|
-
'range
|
|
31
|
-
'range
|
|
32
|
-
'range
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'add
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'range
|
|
48
|
-
'
|
|
49
|
-
'
|
|
25
|
+
'plugin.name': 'Sheets',
|
|
26
|
+
'cell.placeholder': 'Cell value...',
|
|
27
|
+
|
|
28
|
+
'range-key.alignment.label': 'Align',
|
|
29
|
+
'range-key.style.label': 'Style',
|
|
30
|
+
|
|
31
|
+
'range-value.start.label': 'Align left',
|
|
32
|
+
'range-value.center.label': 'Align center',
|
|
33
|
+
'range-value.end.label': 'Align right',
|
|
34
|
+
'range-value.softwrap.label': 'Wrap text',
|
|
35
|
+
'range-value.highlight.label': 'Highlight',
|
|
36
|
+
|
|
37
|
+
'toolbar-action.label': '{{value}}',
|
|
38
|
+
'selection-overlaps-existing-comment.label': 'Selected cell already has a comment',
|
|
39
|
+
'comment.label': 'Add comment',
|
|
40
|
+
'comment-ranges-not-supported.label': 'Commenting on ranges is not yet supported',
|
|
41
|
+
'no-cursor.label': 'Select a cell to comment',
|
|
42
|
+
'add-col-before.label': 'Add column before',
|
|
43
|
+
'add-col-after.label': 'Add column after',
|
|
44
|
+
'delete-col.label': 'Delete column',
|
|
45
|
+
'add-row-before.label': 'Add row before',
|
|
46
|
+
'add-row-after.label': 'Add row after',
|
|
47
|
+
'delete-row.label': 'Delete row',
|
|
48
|
+
'range-list.heading': 'Ranges',
|
|
49
|
+
'no-ranges.message': 'No ranges',
|
|
50
|
+
'range.title': '{{position}} — {{value}}',
|
|
51
|
+
'col-dropped.label': 'Deleted a column',
|
|
52
|
+
'row-dropped.label': 'Deleted a row',
|
|
53
|
+
'align.label': 'Text align',
|
|
54
|
+
'axis-dropped.label': 'Drop axis', // TODO(burdon): What does this mean?
|
|
50
55
|
},
|
|
51
56
|
},
|
|
52
57
|
},
|
package/src/types/Sheet.ts
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
5
7
|
import * as Schema from 'effect/Schema';
|
|
6
8
|
|
|
7
|
-
import { addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
8
|
-
import { Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
10
|
+
import { Annotation, Obj, Type } from '@dxos/echo';
|
|
9
11
|
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
10
12
|
|
|
11
13
|
import { addressToIndex, initialize, mapFormulaRefsToIndices } from './util';
|
|
@@ -62,9 +64,13 @@ export const Sheet = Schema.Struct({
|
|
|
62
64
|
ranges: Schema.Array(Range).pipe(FormInputAnnotation.set(false)),
|
|
63
65
|
}).pipe(
|
|
64
66
|
Type.object({
|
|
65
|
-
typename: 'dxos.
|
|
67
|
+
typename: 'org.dxos.type.sheet',
|
|
66
68
|
version: '0.1.0',
|
|
67
69
|
}),
|
|
70
|
+
Annotation.IconAnnotation.set({
|
|
71
|
+
icon: 'ph--grid-nine--regular',
|
|
72
|
+
hue: 'indigo',
|
|
73
|
+
}),
|
|
68
74
|
);
|
|
69
75
|
|
|
70
76
|
export interface Sheet extends Schema.Schema.Type<typeof Sheet> {}
|
|
@@ -77,18 +83,18 @@ export type SheetProps = {
|
|
|
77
83
|
export const make = ({ name, cells = {}, ...size }: SheetProps = {}) => {
|
|
78
84
|
const sheet = Obj.make(Sheet, { name, cells: {}, rows: [], columns: [], rowMeta: {}, columnMeta: {}, ranges: [] });
|
|
79
85
|
|
|
80
|
-
// Initialize and set cells within Obj.
|
|
81
|
-
Obj.
|
|
82
|
-
initialize(
|
|
86
|
+
// Initialize and set cells within Obj.update to satisfy change context requirements.
|
|
87
|
+
Obj.update(sheet, (sheet) => {
|
|
88
|
+
initialize(sheet, size);
|
|
83
89
|
|
|
84
90
|
if (cells) {
|
|
85
91
|
Object.entries(cells).forEach(([key, { value }]) => {
|
|
86
|
-
const idx = addressToIndex(
|
|
92
|
+
const idx = addressToIndex(sheet, addressFromA1Notation(key));
|
|
87
93
|
if (isFormula(value)) {
|
|
88
|
-
value = mapFormulaRefsToIndices(
|
|
94
|
+
value = mapFormulaRefsToIndices(sheet, value);
|
|
89
95
|
}
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
sheet.cells[idx] = { value };
|
|
92
98
|
});
|
|
93
99
|
}
|
|
94
100
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { type ComputeGraphRegistry as ComputeGraphRegistryType } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
export type GridEntry = { grid: DxGridElement; setActiveRefs: (refs: GridContentProps['activeRefs']) => void };
|
|
14
|
+
|
|
15
|
+
export type GridRegistry = {
|
|
16
|
+
register: (attendableId: string, grid: DxGridElement, setActiveRefs: GridEntry['setActiveRefs']) => void;
|
|
17
|
+
unregister: (attendableId: string) => void;
|
|
18
|
+
get: (attendableId: string) => GridEntry | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ComputeGraphRegistry = Capability.make<ComputeGraphRegistryType>(
|
|
22
|
+
`${meta.id}.capability.compute-graph-registry`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/** Registry of active grid instances keyed by attendable ID. */
|
|
26
|
+
export const GridInstances = Capability.make<GridRegistry>(`${meta.id}.capability.grid-instances`);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
const SHEET_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
|
|
16
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
17
|
+
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
18
|
+
|
|
19
|
+
export const InsertAxis = Operation.make({
|
|
20
|
+
meta: { key: `${SHEET_OPERATION}.axis-insert`, name: 'Insert Axis' },
|
|
21
|
+
input: Schema.Struct({
|
|
22
|
+
model: Schema.Any,
|
|
23
|
+
axis: Axis,
|
|
24
|
+
index: Schema.Number,
|
|
25
|
+
count: Schema.optional(Schema.Number),
|
|
26
|
+
}),
|
|
27
|
+
output: Schema.Void,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const DropAxisOutput = Schema.Struct({
|
|
31
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
32
|
+
axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
|
|
33
|
+
index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
|
|
34
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
35
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
|
|
39
|
+
|
|
40
|
+
export const DropAxis = Operation.make({
|
|
41
|
+
meta: { key: `${SHEET_OPERATION}.axis-drop`, name: 'Drop Axis' },
|
|
42
|
+
input: Schema.Struct({
|
|
43
|
+
model: Schema.Any,
|
|
44
|
+
axis: Axis,
|
|
45
|
+
axisIndex: Schema.String,
|
|
46
|
+
}),
|
|
47
|
+
output: DropAxisOutput,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const ScrollToAnchor = Operation.make({
|
|
51
|
+
meta: { key: `${SHEET_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
|
|
52
|
+
services: [Capability.Service],
|
|
53
|
+
input: Schema.Struct({
|
|
54
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
|
|
55
|
+
cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
|
|
56
|
+
ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
|
|
57
|
+
}),
|
|
58
|
+
output: Schema.Void,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Restore a dropped axis (inverse of DropAxis).
|
|
63
|
+
*/
|
|
64
|
+
export const RestoreAxis = Operation.make({
|
|
65
|
+
meta: { key: `${SHEET_OPERATION}.restore-axis`, name: 'Restore Axis' },
|
|
66
|
+
input: Schema.Struct({
|
|
67
|
+
model: Schema.Any.annotations({ description: 'The sheet model.' }),
|
|
68
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
69
|
+
axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
|
|
70
|
+
index: Schema.Number.annotations({ description: 'The position to restore at.' }),
|
|
71
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
72
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
|
|
73
|
+
}),
|
|
74
|
+
output: Schema.Void,
|
|
75
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './capabilities';
|
|
6
|
-
export * as Sheet from './Sheet';
|
|
7
5
|
export * from './sheet-range-types';
|
|
8
6
|
export * from './types';
|
|
9
7
|
export * from './util';
|
|
8
|
+
|
|
9
|
+
export * as Sheet from './Sheet';
|
|
10
|
+
export * as SheetCapabilities from './SheetCapabilities';
|
|
11
|
+
export * as SheetOperation from './SheetOperation';
|
package/src/types/types.ts
CHANGED
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { Collection } from '@dxos/echo';
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
10
|
-
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
|
|
14
7
|
import * as Sheet from './Sheet';
|
|
15
8
|
|
|
16
9
|
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
@@ -27,76 +20,3 @@ export namespace SheetAction {
|
|
|
27
20
|
|
|
28
21
|
export type RestoreAxis = Schema.Schema.Type<typeof RestoreAxis>;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
const SHEET_OPERATION = `${meta.id}/operation`;
|
|
32
|
-
|
|
33
|
-
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
34
|
-
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
35
|
-
|
|
36
|
-
export namespace SheetOperation {
|
|
37
|
-
export const OnCreateSpace = Operation.make({
|
|
38
|
-
meta: { key: `${SHEET_OPERATION}/on-create-space`, name: 'On Create Space' },
|
|
39
|
-
services: [Capability.Service],
|
|
40
|
-
schema: {
|
|
41
|
-
input: Schema.Struct({
|
|
42
|
-
space: SpaceSchema,
|
|
43
|
-
rootCollection: Collection.Collection,
|
|
44
|
-
isDefault: Schema.optional(Schema.Boolean),
|
|
45
|
-
}),
|
|
46
|
-
output: Schema.Void,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export const InsertAxis = Operation.make({
|
|
51
|
-
meta: { key: `${SHEET_OPERATION}/axis-insert`, name: 'Insert Axis' },
|
|
52
|
-
schema: {
|
|
53
|
-
input: Schema.Struct({
|
|
54
|
-
model: Schema.Any,
|
|
55
|
-
axis: Axis,
|
|
56
|
-
index: Schema.Number,
|
|
57
|
-
count: Schema.optional(Schema.Number),
|
|
58
|
-
}),
|
|
59
|
-
output: Schema.Void,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export const DropAxisOutput = Schema.Struct({
|
|
64
|
-
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
65
|
-
axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
|
|
66
|
-
index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
|
|
67
|
-
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
68
|
-
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
|
|
72
|
-
|
|
73
|
-
export const DropAxis = Operation.make({
|
|
74
|
-
meta: { key: `${SHEET_OPERATION}/axis-drop`, name: 'Drop Axis' },
|
|
75
|
-
schema: {
|
|
76
|
-
input: Schema.Struct({
|
|
77
|
-
model: Schema.Any,
|
|
78
|
-
axis: Axis,
|
|
79
|
-
axisIndex: Schema.String,
|
|
80
|
-
}),
|
|
81
|
-
output: DropAxisOutput,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Restore a dropped axis (inverse of DropAxis).
|
|
87
|
-
*/
|
|
88
|
-
export const RestoreAxis = Operation.make({
|
|
89
|
-
meta: { key: `${SHEET_OPERATION}/restore-axis`, name: 'Restore Axis' },
|
|
90
|
-
schema: {
|
|
91
|
-
input: Schema.Struct({
|
|
92
|
-
model: Schema.Any.annotations({ description: 'The sheet model.' }),
|
|
93
|
-
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
94
|
-
axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
|
|
95
|
-
index: Schema.Number.annotations({ description: 'The position to restore at.' }),
|
|
96
|
-
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
97
|
-
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
|
|
98
|
-
}),
|
|
99
|
-
output: Schema.Void,
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
package/src/types/util.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
addressFromA1Notation,
|
|
10
10
|
addressToA1Notation,
|
|
11
11
|
isFormula,
|
|
12
|
-
} from '@dxos/compute';
|
|
12
|
+
} from '@dxos/compute-hyperformula';
|
|
13
13
|
import { randomBytes } from '@dxos/crypto';
|
|
14
14
|
import { type Obj } from '@dxos/echo';
|
|
15
15
|
import { invariant } from '@dxos/invariant';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/RangeList/RangeList.tsx", "../../../src/containers/RangeList/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback } from 'react';\n\nimport { rangeToA1Notation } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { Input, Message, useTranslation } from '@dxos/react-ui';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\nimport { rangeFromIndex } from '../../types';\nimport { Sheet } from '../../types';\n\nexport type RangeListProps = {\n sheet: Sheet.Sheet;\n};\n\nexport const RangeList = ({ sheet }: RangeListProps) => {\n const { t } = useTranslation(meta.id);\n // TODO(thure): Implement similar to comments, #8121\n const handleSelectRange = (range: Sheet.Range) => {};\n const handleDeleteRange = useCallback(\n (range: Sheet.Range) => {\n const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);\n Obj.change(sheet, (obj) => {\n obj.ranges.splice(index, 1);\n });\n },\n [sheet],\n );\n return (\n <>\n <Input.Root>\n <Input.Label>{t('range list heading')}</Input.Label>\n </Input.Root>\n {sheet.ranges.length < 1 ? (\n <Message.Root>\n <Message.Title>{t('no ranges message')}</Message.Title>\n </Message.Root>\n ) : (\n <List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>\n {({ items: ranges }) =>\n ranges.map((range, i) => (\n <List.Item key={i} item={range} classNames={['p-2', ghostHover]}>\n <List.ItemDragHandle />\n <List.ItemTitle onClick={() => handleSelectRange(range)}>\n {t('range title', {\n position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),\n key: t(`range key ${range.key} label`),\n value: t(`range value ${range.value} label`),\n })}\n </List.ItemTitle>\n <List.ItemDeleteButton onClick={() => handleDeleteRange(range)} />\n </List.Item>\n ))\n }\n </List.Root>\n )}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { RangeList } from './RangeList';\n\nexport default RangeList;\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,yBAAyB;AAClC,SAASC,WAAW;AACpB,SAASC,OAAOC,SAASC,sBAAsB;AAC/C,SAASC,YAAY;AACrB,SAASC,kBAAkB;AAUpB,IAAMC,YAAY,CAAC,EAAEC,MAAK,MAAkB;AACjD,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,oBAAoB,CAACC,UAAAA;EAAwB;AACnD,QAAMC,oBAAoBC,YACxB,CAACF,UAAAA;AACC,UAAMG,QAAQT,MAAMU,OAAOC,UAAU,CAACC,eAAeA,eAAeN,KAAAA;AACpEO,QAAIC,OAAOd,OAAO,CAACe,QAAAA;AACjBA,UAAIL,OAAOM,OAAOP,OAAO,CAAA;IAC3B,CAAA;EACF,GACA;IAACT;GAAM;AAET,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACiB,MAAMC,MAAI,MACT,sBAAA,cAACD,MAAME,OAAK,MAAElB,EAAE,oBAAA,CAAA,CAAA,GAEjBD,MAAMU,OAAOU,SAAS,IACrB,sBAAA,cAACC,QAAQH,MAAI,MACX,sBAAA,cAACG,QAAQC,OAAK,MAAErB,EAAE,mBAAA,CAAA,CAAA,IAGpB,sBAAA,cAACsB,KAAKL,MAAI;IAAcM,OAAOxB,MAAMU;IAAQe,QAAeC,UAAGC,cAAMC,KAAK;KACvE,CAAC,EAAEJ,OAAOd,OAAM,MACfA,OAAOmB,IAAI,CAACvB,OAAOwB,MACjB,sBAAA,cAACP,KAAKQ,MAAI;IAACC,KAAKF;IAAGG,MAAM3B;IAAO4B,YAAY;MAAC;MAAOC;;KAClD,sBAAA,cAACZ,KAAKa,gBAAc,IAAA,GACpB,sBAAA,cAACb,KAAKc,WAAS;IAACC,SAAS,MAAMjC,kBAAkBC,KAAAA;KAC9CL,EAAE,eAAe;IAChBsC,UAAUC,kBAAkBC,eAAezC,OAAOM,MAAMA,KAAK,CAAA;IAC7D0B,KAAK/B,EAAE,aAAaK,MAAM0B,GAAG,QAAQ;IACrCU,OAAOzC,EAAE,eAAeK,MAAMoC,KAAK,QAAQ;EAC7C,CAAA,CAAA,GAEF,sBAAA,cAACnB,KAAKoB,kBAAgB;IAACL,SAAS,MAAM/B,kBAAkBD,KAAAA;;AAQxE;;;AC1DA,IAAA,oBAAesC;",
|
|
6
|
-
"names": ["Schema", "React", "useCallback", "rangeToA1Notation", "Obj", "Input", "Message", "useTranslation", "List", "ghostHover", "RangeList", "sheet", "t", "useTranslation", "meta", "id", "handleSelectRange", "range", "handleDeleteRange", "useCallback", "index", "ranges", "findIndex", "sheetRange", "Obj", "change", "obj", "splice", "Input", "Root", "Label", "length", "Message", "Title", "List", "items", "isItem", "is", "Sheet", "Range", "map", "i", "Item", "key", "item", "classNames", "ghostHover", "ItemDragHandle", "ItemTitle", "onClick", "position", "rangeToA1Notation", "rangeFromIndex", "value", "ItemDeleteButton", "RangeList"]
|
|
7
|
-
}
|