@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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability, UndoMapping } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { SheetOperation } from '#operations';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule(() =>
|
|
13
|
+
Effect.succeed(
|
|
14
|
+
Capability.contributes(Capabilities.UndoMapping, [
|
|
15
|
+
UndoMapping.make({
|
|
16
|
+
operation: SheetOperation.DropAxis,
|
|
17
|
+
inverse: SheetOperation.RestoreAxis,
|
|
18
|
+
deriveContext: (input, output) => ({
|
|
19
|
+
model: input.model,
|
|
20
|
+
axis: output.axis,
|
|
21
|
+
axisIndex: output.axisIndex,
|
|
22
|
+
index: output.index,
|
|
23
|
+
axisMeta: output.axisMeta,
|
|
24
|
+
values: output.values,
|
|
25
|
+
}),
|
|
26
|
+
message: ['axis-dropped.label', { ns: meta.id }],
|
|
27
|
+
}),
|
|
28
|
+
]),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
@@ -7,7 +7,8 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
9
9
|
import { Filter } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
11
12
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
14
|
import { Button, Input, Toolbar } from '@dxos/react-ui';
|
|
@@ -15,8 +16,8 @@ import { withTheme } from '@dxos/react-ui/testing';
|
|
|
15
16
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
16
17
|
|
|
17
18
|
import { useSheetModel } from '../../model';
|
|
18
|
-
import { withComputeGraphDecorator } from '
|
|
19
|
-
import { Sheet } from '
|
|
19
|
+
import { withComputeGraphDecorator } from '#testing';
|
|
20
|
+
import { Sheet } from '#types';
|
|
20
21
|
|
|
21
22
|
import { useComputeGraph } from './ComputeGraphContextProvider';
|
|
22
23
|
|
|
@@ -44,14 +45,14 @@ const DefaultStory = () => {
|
|
|
44
45
|
setResult({ functions: { standard: f1.length, echo: f2.length } });
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
space.db.add(
|
|
48
|
+
space.db.add(Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
|
|
48
49
|
}
|
|
49
50
|
}, [space, graph]);
|
|
50
51
|
|
|
51
52
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
52
53
|
const handleTest = async () => {
|
|
53
54
|
if (space && graph) {
|
|
54
|
-
const
|
|
55
|
+
const objects = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
55
56
|
const mapped = graph.mapFunctionBindingToId(text);
|
|
56
57
|
const unmapped = graph.mapFunctionBindingFromId(mapped);
|
|
57
58
|
const internal = graph.mapFormulaToNative(text);
|
|
@@ -84,11 +85,15 @@ const DefaultStory = () => {
|
|
|
84
85
|
export const Default: Story = {};
|
|
85
86
|
|
|
86
87
|
const meta = {
|
|
87
|
-
title: 'plugins/plugin-sheet/functions',
|
|
88
|
+
title: 'plugins/plugin-sheet/components/functions',
|
|
88
89
|
render: DefaultStory,
|
|
89
90
|
decorators: [
|
|
90
|
-
withTheme,
|
|
91
|
-
withClientProvider({
|
|
91
|
+
withTheme(),
|
|
92
|
+
withClientProvider({
|
|
93
|
+
types: [Operation.PersistentOperation, Sheet.Sheet],
|
|
94
|
+
createIdentity: true,
|
|
95
|
+
createSpace: true,
|
|
96
|
+
}),
|
|
92
97
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
93
98
|
],
|
|
94
99
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SheetContent } from '../SheetContent';
|
|
6
|
+
import { SheetRoot } from '../SheetRoot';
|
|
7
|
+
import { SheetStatusbar } from '../SheetStatusbar';
|
|
8
|
+
import { SheetToolbar } from '../SheetToolbar';
|
|
9
|
+
|
|
10
|
+
export { useSheetContext, type SheetContextValue, type SheetRootProps } from '../SheetRoot';
|
|
11
|
+
export { type SheetContentProps } from '../SheetContent';
|
|
12
|
+
export { type SheetToolbarProps } from '../SheetToolbar';
|
|
13
|
+
export { type SheetStatusbarProps } from '../SheetStatusbar';
|
|
14
|
+
|
|
15
|
+
export const Sheet = {
|
|
16
|
+
Root: SheetRoot,
|
|
17
|
+
Toolbar: SheetToolbar,
|
|
18
|
+
Content: SheetContent,
|
|
19
|
+
Statusbar: SheetStatusbar,
|
|
20
|
+
};
|
|
@@ -6,16 +6,17 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
|
-
import { createDocAccessor } from '@dxos/client/echo';
|
|
10
9
|
import { defaultFunctions } from '@dxos/compute';
|
|
11
10
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
12
13
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
13
14
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
-
import { automerge } from '@dxos/react-ui-editor';
|
|
15
15
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
16
|
+
import { automerge } from '@dxos/ui-editor';
|
|
16
17
|
|
|
17
18
|
import { sheetExtension } from '../../extensions';
|
|
18
|
-
import { Sheet } from '
|
|
19
|
+
import { Sheet } from '#types';
|
|
19
20
|
|
|
20
21
|
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
21
22
|
const extensions = useMemo(() => {
|
|
@@ -37,8 +38,10 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
37
38
|
const space = await client.spaces.create();
|
|
38
39
|
|
|
39
40
|
const sheet = Sheet.make();
|
|
40
|
-
sheet
|
|
41
|
-
|
|
41
|
+
Obj.change(sheet, (obj) => {
|
|
42
|
+
obj.name = 'Test';
|
|
43
|
+
obj.cells[cell] = { value };
|
|
44
|
+
});
|
|
42
45
|
space.db.add(sheet);
|
|
43
46
|
setObject(sheet);
|
|
44
47
|
}, [value]);
|
|
@@ -58,9 +61,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
const meta = {
|
|
61
|
-
title: 'plugins/plugin-sheet/CellEditor',
|
|
64
|
+
title: 'plugins/plugin-sheet/components/CellEditor',
|
|
62
65
|
|
|
63
|
-
decorators: [withTheme],
|
|
66
|
+
decorators: [withTheme()],
|
|
64
67
|
component: CellEditor,
|
|
65
68
|
render: DefaultStory,
|
|
66
69
|
} satisfies Meta<typeof DefaultStory>;
|
package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx}
RENAMED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
9
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
|
-
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '
|
|
15
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
16
16
|
import { translations } from '../../translations';
|
|
17
|
-
import { Sheet } from '
|
|
17
|
+
import { Sheet } from '#types';
|
|
18
18
|
import { useComputeGraph } from '../ComputeGraph';
|
|
19
|
-
import {
|
|
19
|
+
import { SheetRoot } from '../SheetRoot';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { SheetContent } from './SheetContent';
|
|
22
22
|
|
|
23
23
|
export const Basic = () => {
|
|
24
24
|
const space = useSpace();
|
|
@@ -29,30 +29,31 @@ export const Basic = () => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
<div role='none' className='grid
|
|
34
|
-
<
|
|
32
|
+
<SheetRoot graph={graph} sheet={sheet} attendableId='test' ignoreAttention>
|
|
33
|
+
<div role='none' className='grid h-full w-full'>
|
|
34
|
+
<SheetContent />
|
|
35
35
|
</div>
|
|
36
|
-
</
|
|
36
|
+
</SheetRoot>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const meta = {
|
|
41
|
-
title: 'plugins/plugin-sheet/
|
|
42
|
-
component:
|
|
41
|
+
title: 'plugins/plugin-sheet/components/SheetContent',
|
|
42
|
+
component: SheetContent,
|
|
43
43
|
decorators: [
|
|
44
|
-
withTheme,
|
|
44
|
+
withTheme(),
|
|
45
|
+
withLayout({ layout: 'fullscreen' }),
|
|
45
46
|
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
46
47
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
47
48
|
withPluginManager({
|
|
48
|
-
plugins: [
|
|
49
|
+
plugins: [OperationPlugin(), RuntimePlugin()],
|
|
49
50
|
}),
|
|
50
51
|
],
|
|
51
52
|
parameters: {
|
|
52
53
|
layout: 'fullscreen',
|
|
53
54
|
translations,
|
|
54
55
|
},
|
|
55
|
-
} satisfies Meta<typeof
|
|
56
|
+
} satisfies Meta<typeof SheetContent>;
|
|
56
57
|
|
|
57
58
|
export default meta;
|
|
58
59
|
|
|
@@ -8,13 +8,15 @@ import React, {
|
|
|
8
8
|
type MouseEvent,
|
|
9
9
|
type WheelEvent,
|
|
10
10
|
useCallback,
|
|
11
|
+
useEffect,
|
|
11
12
|
useMemo,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from 'react';
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
17
18
|
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
19
|
+
import { Obj } from '@dxos/echo';
|
|
18
20
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
19
21
|
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
22
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
@@ -31,12 +33,14 @@ import {
|
|
|
31
33
|
editorKeys,
|
|
32
34
|
parseCellIndex,
|
|
33
35
|
} from '@dxos/react-ui-grid';
|
|
36
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
34
37
|
|
|
35
38
|
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
36
|
-
import { useSelectThreadOnCellFocus
|
|
37
|
-
import { meta } from '
|
|
38
|
-
import { DEFAULT_COLS, DEFAULT_ROWS,
|
|
39
|
-
import {
|
|
39
|
+
import { useSelectThreadOnCellFocus } from '../../integrations';
|
|
40
|
+
import { meta } from '#meta';
|
|
41
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, SheetCapabilities } from '#types';
|
|
42
|
+
import { SheetOperation } from '#operations';
|
|
43
|
+
import { useSheetContext } from '../SheetRoot';
|
|
40
44
|
|
|
41
45
|
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
42
46
|
|
|
@@ -68,15 +72,29 @@ const sheetRowDefault = {
|
|
|
68
72
|
grid: { size: defaultRowSize, resizeable: true },
|
|
69
73
|
};
|
|
70
74
|
|
|
71
|
-
export
|
|
75
|
+
export type SheetContentProps = {};
|
|
76
|
+
|
|
77
|
+
export const SheetContent = composable<HTMLDivElement, SheetContentProps>((props, forwardedRef) => {
|
|
72
78
|
const { t } = useTranslation(meta.id);
|
|
73
|
-
const {
|
|
74
|
-
|
|
79
|
+
const {
|
|
80
|
+
id,
|
|
81
|
+
attendableId,
|
|
82
|
+
model,
|
|
83
|
+
editing,
|
|
84
|
+
setCursor,
|
|
85
|
+
setRange,
|
|
86
|
+
cursor,
|
|
87
|
+
cursorFallbackRange,
|
|
88
|
+
activeRefs,
|
|
89
|
+
setActiveRefs,
|
|
90
|
+
ignoreAttention,
|
|
91
|
+
} = useSheetContext();
|
|
92
|
+
|
|
75
93
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
76
94
|
// a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
|
|
77
95
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
78
96
|
const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
|
|
79
|
-
const {
|
|
97
|
+
const { invokePromise } = useOperationInvoker();
|
|
80
98
|
const rangeController = useRef<RangeController>(null);
|
|
81
99
|
const { hasAttention } = useAttention(id);
|
|
82
100
|
|
|
@@ -127,15 +145,17 @@ export const GridSheet = () => {
|
|
|
127
145
|
|
|
128
146
|
const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
|
|
129
147
|
({ axis, size, index: numericIndex }) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
Obj.change(model.sheet, (sheet) => {
|
|
149
|
+
if (axis === 'row') {
|
|
150
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
151
|
+
sheet.rowMeta[rowId] ??= {};
|
|
152
|
+
sheet.rowMeta[rowId].size = size;
|
|
153
|
+
} else {
|
|
154
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
155
|
+
sheet.columnMeta[columnId] ??= {};
|
|
156
|
+
sheet.columnMeta[columnId].size = size;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
139
159
|
},
|
|
140
160
|
[model],
|
|
141
161
|
);
|
|
@@ -172,12 +192,20 @@ export const GridSheet = () => {
|
|
|
172
192
|
case 'frozenRowsStart':
|
|
173
193
|
return dxGrid?.setSelection({
|
|
174
194
|
start: { col: pos.col, row: 0, plane: 'grid' },
|
|
175
|
-
end: {
|
|
195
|
+
end: {
|
|
196
|
+
col: pos.col,
|
|
197
|
+
row: model.sheet.rows.length - 1,
|
|
198
|
+
plane: 'grid',
|
|
199
|
+
},
|
|
176
200
|
});
|
|
177
201
|
case 'frozenColsStart':
|
|
178
202
|
return dxGrid?.setSelection({
|
|
179
203
|
start: { row: pos.row, col: 0, plane: 'grid' },
|
|
180
|
-
end: {
|
|
204
|
+
end: {
|
|
205
|
+
row: pos.row,
|
|
206
|
+
col: model.sheet.columns.length - 1,
|
|
207
|
+
plane: 'grid',
|
|
208
|
+
},
|
|
181
209
|
});
|
|
182
210
|
}
|
|
183
211
|
},
|
|
@@ -257,31 +285,30 @@ export const GridSheet = () => {
|
|
|
257
285
|
switch (operation) {
|
|
258
286
|
case 'insert-before':
|
|
259
287
|
case 'insert-after':
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}),
|
|
266
|
-
);
|
|
288
|
+
return invokePromise(SheetOperation.InsertAxis, {
|
|
289
|
+
model,
|
|
290
|
+
axis: contextMenuAxis,
|
|
291
|
+
index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
|
|
292
|
+
});
|
|
267
293
|
case 'drop':
|
|
268
|
-
return
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
);
|
|
294
|
+
return invokePromise(SheetOperation.DropAxis, {
|
|
295
|
+
model,
|
|
296
|
+
axis: contextMenuAxis,
|
|
297
|
+
axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
|
|
298
|
+
});
|
|
275
299
|
}
|
|
276
300
|
},
|
|
277
|
-
[contextMenuAxis, contextMenuOpen, model,
|
|
301
|
+
[contextMenuAxis, contextMenuOpen, model, invokePromise],
|
|
278
302
|
);
|
|
279
303
|
|
|
280
304
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
281
305
|
|
|
282
306
|
const extensions = useMemo(
|
|
283
307
|
() => [
|
|
284
|
-
editorKeys({
|
|
308
|
+
editorKeys({
|
|
309
|
+
onClose: handleClose,
|
|
310
|
+
...(editing?.initialContent && { onNav: handleClose }),
|
|
311
|
+
}),
|
|
285
312
|
sheetExtension({ functions: model.graph.getFunctions() }),
|
|
286
313
|
rangeExtension({
|
|
287
314
|
onInit: (fn) => (rangeController.current = fn),
|
|
@@ -303,23 +330,31 @@ export const GridSheet = () => {
|
|
|
303
330
|
[model],
|
|
304
331
|
);
|
|
305
332
|
|
|
306
|
-
|
|
333
|
+
const [gridInstances] = useCapabilities(SheetCapabilities.GridInstances);
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
if (dxGrid && gridInstances) {
|
|
336
|
+
gridInstances.register(attendableId, dxGrid, setActiveRefs);
|
|
337
|
+
return () => gridInstances.unregister(attendableId);
|
|
338
|
+
}
|
|
339
|
+
}, [dxGrid, gridInstances, attendableId, setActiveRefs]);
|
|
340
|
+
|
|
307
341
|
useSelectThreadOnCellFocus();
|
|
308
342
|
|
|
309
343
|
return (
|
|
310
|
-
|
|
311
|
-
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
|
|
344
|
+
<div ref={forwardedRef} {...composableProps(props, { classNames: 'relative min-h-0' })}>
|
|
312
345
|
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
313
346
|
<Grid.Content
|
|
347
|
+
className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
314
348
|
initialCells={initialCells}
|
|
315
349
|
limitColumns={DEFAULT_COLS}
|
|
316
350
|
limitRows={DEFAULT_ROWS}
|
|
317
351
|
columns={columns}
|
|
318
352
|
rows={rows}
|
|
319
|
-
// TODO(burdon): `col` vs. `column`?
|
|
320
353
|
columnDefault={sheetColDefault}
|
|
321
354
|
rowDefault={sheetRowDefault}
|
|
355
|
+
activeRefs={activeRefs}
|
|
322
356
|
frozen={frozen}
|
|
357
|
+
overscroll='trap'
|
|
323
358
|
onAxisResize={handleAxisResize}
|
|
324
359
|
onSelect={handleSelect}
|
|
325
360
|
onFocus={handleFocus}
|
|
@@ -327,9 +362,6 @@ export const GridSheet = () => {
|
|
|
327
362
|
onKeyDown={handleKeyDown}
|
|
328
363
|
onContextMenu={handleContextMenu}
|
|
329
364
|
onClick={handleClick}
|
|
330
|
-
overscroll='trap'
|
|
331
|
-
className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
332
|
-
activeRefs={activeRefs}
|
|
333
365
|
ref={setDxGrid}
|
|
334
366
|
/>
|
|
335
367
|
<DropdownMenu.Root
|
|
@@ -345,27 +377,25 @@ export const GridSheet = () => {
|
|
|
345
377
|
data-testid={`grid.${contextMenuAxis}.insert-before`}
|
|
346
378
|
>
|
|
347
379
|
<Icon
|
|
348
|
-
size={5}
|
|
349
380
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
|
|
350
381
|
/>
|
|
351
|
-
<span>{t(`add
|
|
382
|
+
<span>{t(`add-${contextMenuAxis}-before.label`)}</span>
|
|
352
383
|
</DropdownMenu.Item>
|
|
353
384
|
<DropdownMenu.Item
|
|
354
385
|
onClick={() => handleAxisMenuAction('insert-after')}
|
|
355
386
|
data-testid={`grid.${contextMenuAxis}.insert-after`}
|
|
356
387
|
>
|
|
357
388
|
<Icon
|
|
358
|
-
size={5}
|
|
359
389
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
|
|
360
390
|
/>
|
|
361
|
-
<span>{t(`add
|
|
391
|
+
<span>{t(`add-${contextMenuAxis}-after.label`)}</span>
|
|
362
392
|
</DropdownMenu.Item>
|
|
363
393
|
<DropdownMenu.Item
|
|
364
394
|
onClick={() => handleAxisMenuAction('drop')}
|
|
365
395
|
data-testid={`grid.${contextMenuAxis}.drop`}
|
|
366
396
|
>
|
|
367
|
-
<Icon
|
|
368
|
-
<span>{t(`delete
|
|
397
|
+
<Icon icon='ph--backspace--regular' />
|
|
398
|
+
<span>{t(`delete-${contextMenuAxis}.label`)}</span>
|
|
369
399
|
</DropdownMenu.Item>
|
|
370
400
|
</DropdownMenu.Viewport>
|
|
371
401
|
<DropdownMenu.Arrow />
|
|
@@ -373,4 +403,4 @@ export const GridSheet = () => {
|
|
|
373
403
|
</DropdownMenu.Root>
|
|
374
404
|
</div>
|
|
375
405
|
);
|
|
376
|
-
};
|
|
406
|
+
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { inRange } from '@dxos/compute';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
11
11
|
type DxGridAxisMeta,
|
|
@@ -19,16 +19,19 @@ import {
|
|
|
19
19
|
commentedClassName,
|
|
20
20
|
rowToA1Notation,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
|
-
import { mx } from '@dxos/
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
24
|
import { type SheetModel } from '../../model';
|
|
25
|
-
import { cellClassNameForRange, rangeFromIndex } from '
|
|
25
|
+
import { cellClassNameForRange, rangeFromIndex } from '#types';
|
|
26
26
|
|
|
27
27
|
const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
28
28
|
return model.sheet.columns.reduce(
|
|
29
29
|
(acc: DxGridAxisMeta, columnId, numericIndex) => {
|
|
30
30
|
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
31
|
-
acc.grid[numericIndex] = {
|
|
31
|
+
acc.grid[numericIndex] = {
|
|
32
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
33
|
+
resizeable: true,
|
|
34
|
+
};
|
|
32
35
|
}
|
|
33
36
|
return acc;
|
|
34
37
|
},
|
|
@@ -40,7 +43,10 @@ const createDxGridRows = (model: SheetModel): DxGridAxisMeta => {
|
|
|
40
43
|
return model.sheet.rows.reduce(
|
|
41
44
|
(acc: DxGridAxisMeta, rowId, numericIndex) => {
|
|
42
45
|
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
43
|
-
acc.grid[numericIndex] = {
|
|
46
|
+
acc.grid[numericIndex] = {
|
|
47
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
48
|
+
resizeable: true,
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
return acc;
|
|
46
52
|
},
|
|
@@ -59,7 +65,7 @@ const projectCellProps = (model: SheetModel, col: number, row: number): DxGridCe
|
|
|
59
65
|
// const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target!.anchor);
|
|
60
66
|
// return thread && range ? inRange(range, address) : false;
|
|
61
67
|
// })
|
|
62
|
-
// .map((thread) =>
|
|
68
|
+
// .map((thread) => Obj.getDXN(thread!).toString())
|
|
63
69
|
// .join(' ');
|
|
64
70
|
|
|
65
71
|
const description = model.getValueDescription(address);
|
|
@@ -90,13 +96,13 @@ const gridCellGetter = (model: SheetModel) => {
|
|
|
90
96
|
|
|
91
97
|
export const rowLabelCell = (row: number) => ({
|
|
92
98
|
value: rowToA1Notation(row),
|
|
93
|
-
className: '!bg-
|
|
99
|
+
className: '!bg-toolbar-surface text-subdued text-end pe-1',
|
|
94
100
|
resizeHandle: 'row',
|
|
95
101
|
});
|
|
96
102
|
|
|
97
103
|
export const colLabelCell = (col: number) => ({
|
|
98
104
|
value: colToA1Notation(col),
|
|
99
|
-
className: '!bg-
|
|
105
|
+
className: '!bg-toolbar-surface text-subdued',
|
|
100
106
|
resizeHandle: 'col',
|
|
101
107
|
});
|
|
102
108
|
|
|
@@ -108,7 +114,7 @@ const cellGetter = (model: SheetModel) => {
|
|
|
108
114
|
return getGridCells(nextBounds);
|
|
109
115
|
case 'fixedStartStart': {
|
|
110
116
|
return {
|
|
111
|
-
'0,0': { className: '!bg-
|
|
117
|
+
'0,0': { className: '!bg-toolbar-surface' },
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
120
|
case 'frozenColsStart':
|