@dxos/plugin-sheet 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
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 +53 -0
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs.map +7 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs +1805 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs +24 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7HQX4NQP.mjs → chunk-NNWF7EKC.mjs} +14 -14
- package/dist/lib/browser/chunk-NNWF7EKC.mjs.map +7 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs +397 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -82
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/markdown-S6GVLHB4.mjs +29 -0
- package/dist/lib/browser/markdown-S6GVLHB4.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs +79 -0
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs +51 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -12
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs +54 -0
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs +1806 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs +25 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Q6UYC4G5.mjs → chunk-M52YLLWU.mjs} +14 -14
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs +398 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -82
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs +30 -0
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs +52 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -12
- 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/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
- package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +11 -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/SheetContent/SheetCellEditor.stories.d.ts +16 -0
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +5 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +55 -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/{GridSheet → SheetContent}/util.d.ts +1 -1
- 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 -7
- 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 +5 -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 +6 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +88 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +13 -20
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +12 -18
- 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 +2 -2
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- 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 +56 -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.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts +10 -13
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/index.d.ts +1 -1
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -6
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +2 -2
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/serializer.d.ts +2 -2
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -2
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +27 -3
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +76 -0
- package/dist/types/src/types/Sheet.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +6 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts +2 -2
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +92 -75
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +10 -10
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -72
- package/src/SheetPlugin.tsx +52 -64
- package/src/capabilities/anchor-sort/anchor-sort.ts +27 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/compute-graph-registry/compute-graph-registry.ts +27 -0
- package/src/capabilities/compute-graph-registry/index.ts +7 -0
- package/src/capabilities/index.ts +5 -9
- package/src/capabilities/markdown/index.ts +7 -0
- package/src/capabilities/markdown/markdown.ts +30 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +77 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +46 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +22 -21
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/SheetContent/SheetCellEditor.stories.tsx +94 -0
- package/src/components/SheetContent/SheetContent.stories.tsx +60 -0
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +74 -60
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +20 -14
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +43 -41
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +10 -5
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +20 -14
- package/src/components/SheetToolbar/SheetToolbar.tsx +57 -46
- package/src/components/SheetToolbar/align.ts +49 -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 +20 -15
- package/src/containers/RangeList/index.ts +7 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +94 -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 +46 -32
- package/src/extensions/compute.ts +3 -4
- package/src/extensions/editor/index.ts +1 -1
- package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
- package/src/extensions/editor/{extension.ts → sheet-extension.ts} +16 -13
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +39 -49
- package/src/meta.ts +9 -7
- package/src/model/sheet-model.test.ts +5 -4
- package/src/model/sheet-model.ts +85 -53
- package/src/model/testing.ts +4 -4
- package/src/model/useSheetModel.ts +2 -2
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet-manager.ts +1 -1
- package/src/playwright/sheet.spec.ts +3 -2
- package/src/sanity.test.ts +4 -5
- package/src/serializer.ts +4 -4
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +11 -5
- package/src/translations.ts +3 -2
- package/src/types/Sheet.ts +97 -0
- package/src/types/capabilities.ts +14 -0
- package/src/types/index.ts +2 -1
- package/src/types/sheet-range-types.ts +5 -5
- package/src/types/types.ts +84 -49
- package/src/types/util.ts +14 -41
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs +0 -351
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs +0 -24
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs.map +0 -7
- package/dist/lib/browser/chunk-6AKBCBL4.mjs +0 -18
- package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
- package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUOVL3LE.mjs +0 -847
- package/dist/lib/browser/chunk-JUOVL3LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJWZUQVA.mjs +0 -15
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-SI4X5GUR.mjs +0 -892
- package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs +0 -56
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
- package/dist/lib/browser/markdown-VXMIPUQC.mjs +0 -26
- package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs +0 -53
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs +0 -352
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs +0 -20
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs +0 -16
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs +0 -893
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs +0 -848
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs +0 -27
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs +0 -54
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- 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/compute-graph-registry.d.ts +0 -4
- package/dist/types/src/capabilities/compute-graph-registry.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/capabilities/markdown.d.ts +0 -6
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.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 -7
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +0 -25
- 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/RangeList.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 -8
- 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/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
- package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -37
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -22
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/compute-graph-registry.ts +0 -28
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/capabilities/markdown.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -39
- package/src/components/GridSheet/GridSheet.stories.tsx +0 -53
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +0 -93
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -89
- package/src/components/SheetContainer/SheetContainer.tsx +0 -36
- package/src/components/SheetContext/index.ts +0 -5
- package/src/types/schema.ts +0 -61
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -2,37 +2,36 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useEffect, useRef, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { Filter } from '@dxos/echo';
|
|
10
|
+
import { Function } from '@dxos/functions';
|
|
13
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
14
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import {
|
|
13
|
+
import { Button, Input, Toolbar } from '@dxos/react-ui';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
16
15
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
18
16
|
|
|
19
|
-
import { useComputeGraph } from './ComputeGraphContextProvider';
|
|
20
17
|
import { useSheetModel } from '../../model';
|
|
21
18
|
import { withComputeGraphDecorator } from '../../testing';
|
|
22
|
-
import {
|
|
19
|
+
import { Sheet } from '../../types';
|
|
20
|
+
|
|
21
|
+
import { useComputeGraph } from './ComputeGraphContextProvider';
|
|
23
22
|
|
|
24
23
|
const FUNCTION_NAME = 'TEST';
|
|
25
24
|
|
|
26
|
-
const
|
|
25
|
+
const DefaultStory = () => {
|
|
27
26
|
const space = useSpace();
|
|
28
27
|
const graph = useComputeGraph(space);
|
|
29
|
-
const [sheet, setSheet] = useState<
|
|
28
|
+
const [sheet, setSheet] = useState<Sheet.Sheet>();
|
|
30
29
|
const [text, setText] = useState(`${FUNCTION_NAME}(100)`);
|
|
31
30
|
const [result, setResult] = useState<any>();
|
|
32
31
|
const model = useSheetModel(graph, sheet);
|
|
33
32
|
useEffect(() => {
|
|
34
33
|
if (space) {
|
|
35
|
-
const sheet = space.db.add(
|
|
34
|
+
const sheet = space.db.add(Sheet.make());
|
|
36
35
|
setSheet(sheet);
|
|
37
36
|
}
|
|
38
37
|
}, [space]);
|
|
@@ -45,14 +44,14 @@ const Story = () => {
|
|
|
45
44
|
setResult({ functions: { standard: f1.length, echo: f2.length } });
|
|
46
45
|
});
|
|
47
46
|
|
|
48
|
-
space.db.add(
|
|
47
|
+
space.db.add(Function.make({ name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
|
|
49
48
|
}
|
|
50
49
|
}, [space, graph]);
|
|
51
50
|
|
|
52
51
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
53
52
|
const handleTest = async () => {
|
|
54
53
|
if (space && graph) {
|
|
55
|
-
const
|
|
54
|
+
const objects = await space.db.query(Filter.type(Function.Function)).run();
|
|
56
55
|
const mapped = graph.mapFunctionBindingToId(text);
|
|
57
56
|
const unmapped = graph.mapFunctionBindingFromId(mapped);
|
|
58
57
|
const internal = graph.mapFormulaToNative(text);
|
|
@@ -82,16 +81,18 @@ const Story = () => {
|
|
|
82
81
|
);
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
export const Default = {};
|
|
84
|
+
export const Default: Story = {};
|
|
86
85
|
|
|
87
|
-
const meta
|
|
88
|
-
title: 'plugins/plugin-sheet/functions',
|
|
86
|
+
const meta = {
|
|
87
|
+
title: 'plugins/plugin-sheet/components/functions',
|
|
88
|
+
render: DefaultStory,
|
|
89
89
|
decorators: [
|
|
90
|
-
|
|
90
|
+
withTheme(),
|
|
91
|
+
withClientProvider({ types: [Function.Function, Sheet.Sheet], createIdentity: true, createSpace: true }),
|
|
91
92
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
92
|
-
withTheme,
|
|
93
93
|
],
|
|
94
|
-
|
|
95
|
-
};
|
|
94
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
96
95
|
|
|
97
96
|
export default meta;
|
|
97
|
+
|
|
98
|
+
type Story = StoryObj<typeof meta>;
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Client } from '@dxos/client';
|
|
9
|
+
import { defaultFunctions } from '@dxos/compute';
|
|
10
|
+
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
16
|
+
import { automerge } from '@dxos/ui-editor';
|
|
17
|
+
|
|
18
|
+
import { sheetExtension } from '../../extensions';
|
|
19
|
+
import { Sheet } from '../../types';
|
|
20
|
+
|
|
21
|
+
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
22
|
+
const extensions = useMemo(() => {
|
|
23
|
+
const functionNames = getRegisteredFunctionNames();
|
|
24
|
+
const functions = defaultFunctions.filter(({ name }) => functionNames.includes(name));
|
|
25
|
+
return [sheetExtension({ functions })];
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
32
|
+
const cell = 'A1';
|
|
33
|
+
const [object, setObject] = useState<Sheet.Sheet>();
|
|
34
|
+
useAsyncEffect(async () => {
|
|
35
|
+
const client = new Client({ types: [Sheet.Sheet] });
|
|
36
|
+
await client.initialize();
|
|
37
|
+
await client.halo.createIdentity();
|
|
38
|
+
const space = await client.spaces.create();
|
|
39
|
+
|
|
40
|
+
const sheet = Sheet.make();
|
|
41
|
+
Obj.change(sheet, (obj) => {
|
|
42
|
+
obj.name = 'Test';
|
|
43
|
+
obj.cells[cell] = { value };
|
|
44
|
+
});
|
|
45
|
+
space.db.add(sheet);
|
|
46
|
+
setObject(sheet);
|
|
47
|
+
}, [value]);
|
|
48
|
+
|
|
49
|
+
const extensions = useMemo(() => {
|
|
50
|
+
if (!object) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const functionNames = getRegisteredFunctionNames();
|
|
55
|
+
const functions = defaultFunctions.filter(({ name }) => functionNames.includes(name));
|
|
56
|
+
const accessor = createDocAccessor(object, ['cells', cell, 'value']);
|
|
57
|
+
return [automerge(accessor), sheetExtension({ functions })];
|
|
58
|
+
}, [object]);
|
|
59
|
+
|
|
60
|
+
return <CellEditor {...props} value={value} extensions={extensions} />;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const meta = {
|
|
64
|
+
title: 'plugins/plugin-sheet/components/CellEditor',
|
|
65
|
+
|
|
66
|
+
decorators: [withTheme()],
|
|
67
|
+
component: CellEditor,
|
|
68
|
+
render: DefaultStory,
|
|
69
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
|
|
73
|
+
type Story = StoryObj<typeof meta>;
|
|
74
|
+
|
|
75
|
+
export const Default: Story = {};
|
|
76
|
+
|
|
77
|
+
export const AutoComplete: Story = {
|
|
78
|
+
args: {
|
|
79
|
+
value: '=SUM',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Formatting: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Automerge: Story = {
|
|
90
|
+
render: AutomergeStory,
|
|
91
|
+
args: {
|
|
92
|
+
value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/plugin-testing';
|
|
11
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
|
|
15
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
16
|
+
import { translations } from '../../translations';
|
|
17
|
+
import { Sheet } from '../../types';
|
|
18
|
+
import { useComputeGraph } from '../ComputeGraph';
|
|
19
|
+
import { SheetRoot } from '../SheetRoot';
|
|
20
|
+
|
|
21
|
+
import { SheetContent } from './SheetContent';
|
|
22
|
+
|
|
23
|
+
export const Basic = () => {
|
|
24
|
+
const space = useSpace();
|
|
25
|
+
const graph = useComputeGraph(space);
|
|
26
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
27
|
+
if (!sheet || !graph) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<SheetRoot graph={graph} sheet={sheet} ignoreAttention>
|
|
33
|
+
<div role='none' className='grid h-full w-full'>
|
|
34
|
+
<SheetContent />
|
|
35
|
+
</div>
|
|
36
|
+
</SheetRoot>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const meta = {
|
|
41
|
+
title: 'plugins/plugin-sheet/components/SheetContent',
|
|
42
|
+
component: SheetContent,
|
|
43
|
+
decorators: [
|
|
44
|
+
withTheme(),
|
|
45
|
+
withLayout({ layout: 'fullscreen' }),
|
|
46
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
47
|
+
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
48
|
+
withPluginManager({
|
|
49
|
+
plugins: [OperationPlugin(), RuntimePlugin()],
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
parameters: {
|
|
53
|
+
layout: 'fullscreen',
|
|
54
|
+
translations,
|
|
55
|
+
},
|
|
56
|
+
} satisfies Meta<typeof SheetContent>;
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
|
|
60
|
+
type Story = StoryObj<typeof meta>;
|
|
@@ -3,41 +3,44 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import React, {
|
|
6
|
+
type FocusEvent,
|
|
7
|
+
type KeyboardEvent,
|
|
8
|
+
type MouseEvent,
|
|
9
|
+
type WheelEvent,
|
|
6
10
|
useCallback,
|
|
7
11
|
useMemo,
|
|
8
12
|
useRef,
|
|
9
13
|
useState,
|
|
10
|
-
type FocusEvent,
|
|
11
|
-
type KeyboardEvent,
|
|
12
|
-
type WheelEvent,
|
|
13
|
-
type MouseEvent,
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
17
|
+
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
18
|
+
import { Obj } from '@dxos/echo';
|
|
18
19
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
19
|
-
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
|
+
import { type ComposableProps, DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
21
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
21
22
|
import {
|
|
22
|
-
|
|
23
|
-
editorKeys,
|
|
24
|
-
parseCellIndex,
|
|
25
|
-
Grid,
|
|
26
|
-
GridCellEditor,
|
|
23
|
+
type DxGridCellIndex,
|
|
27
24
|
type DxGridElement,
|
|
28
25
|
type DxGridPosition,
|
|
29
|
-
type DxGridCellIndex,
|
|
30
|
-
type EditorKeyHandler,
|
|
31
26
|
type EditorBlurHandler,
|
|
27
|
+
type EditorKeyHandler,
|
|
28
|
+
Grid,
|
|
29
|
+
GridCellEditor,
|
|
32
30
|
type GridContentProps,
|
|
31
|
+
closestCell,
|
|
32
|
+
editorKeys,
|
|
33
|
+
parseCellIndex,
|
|
33
34
|
} from '@dxos/react-ui-grid';
|
|
35
|
+
import { mx, useComposableProps } from '@dxos/ui-theme';
|
|
34
36
|
|
|
35
|
-
import {
|
|
36
|
-
import { rangeExtension, sheetExtension, type RangeController } from '../../extensions';
|
|
37
|
+
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
37
38
|
import { useSelectThreadOnCellFocus, useUpdateFocusedCellOnThreadSelection } from '../../integrations';
|
|
38
|
-
import {
|
|
39
|
-
import { DEFAULT_COLS, DEFAULT_ROWS,
|
|
40
|
-
import { useSheetContext } from '../
|
|
39
|
+
import { meta } from '../../meta';
|
|
40
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, SheetOperation } from '../../types';
|
|
41
|
+
import { useSheetContext } from '../SheetRoot';
|
|
42
|
+
|
|
43
|
+
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
41
44
|
|
|
42
45
|
const inertPosition: DxGridPosition = { plane: 'grid', col: 0, row: 0 };
|
|
43
46
|
|
|
@@ -59,25 +62,29 @@ const frozen = {
|
|
|
59
62
|
};
|
|
60
63
|
|
|
61
64
|
const sheetColDefault = {
|
|
62
|
-
frozenColsStart: { size: 48, readonly: true },
|
|
65
|
+
frozenColsStart: { size: 48, readonly: true, focusUnfurl: false },
|
|
63
66
|
grid: { size: defaultColSize, resizeable: true },
|
|
64
67
|
};
|
|
65
68
|
const sheetRowDefault = {
|
|
66
|
-
frozenRowsStart: { size: defaultRowSize, readonly: true },
|
|
69
|
+
frozenRowsStart: { size: defaultRowSize, readonly: true, focusUnfurl: false },
|
|
67
70
|
grid: { size: defaultRowSize, resizeable: true },
|
|
68
71
|
};
|
|
69
72
|
|
|
70
|
-
export
|
|
71
|
-
|
|
73
|
+
export type SheetContentProps = ComposableProps<React.HTMLAttributes<HTMLDivElement>>;
|
|
74
|
+
|
|
75
|
+
export const SheetContent = (props: SheetContentProps) => {
|
|
76
|
+
const { t } = useTranslation(meta.id);
|
|
72
77
|
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } =
|
|
73
78
|
useSheetContext();
|
|
79
|
+
|
|
74
80
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
75
81
|
// a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
|
|
76
82
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
77
83
|
const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
|
|
78
|
-
const {
|
|
79
|
-
const rangeController = useRef<RangeController>();
|
|
84
|
+
const { invokePromise } = useOperationInvoker();
|
|
85
|
+
const rangeController = useRef<RangeController>(null);
|
|
80
86
|
const { hasAttention } = useAttention(id);
|
|
87
|
+
const { className, ...rest } = useComposableProps(props);
|
|
81
88
|
|
|
82
89
|
const handleFocus = useCallback(
|
|
83
90
|
(event: FocusEvent) => {
|
|
@@ -126,15 +133,17 @@ export const GridSheet = () => {
|
|
|
126
133
|
|
|
127
134
|
const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
|
|
128
135
|
({ axis, size, index: numericIndex }) => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
Obj.change(model.sheet, (sheet) => {
|
|
137
|
+
if (axis === 'row') {
|
|
138
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
139
|
+
sheet.rowMeta[rowId] ??= {};
|
|
140
|
+
sheet.rowMeta[rowId].size = size;
|
|
141
|
+
} else {
|
|
142
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
143
|
+
sheet.columnMeta[columnId] ??= {};
|
|
144
|
+
sheet.columnMeta[columnId].size = size;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
138
147
|
},
|
|
139
148
|
[model],
|
|
140
149
|
);
|
|
@@ -171,12 +180,20 @@ export const GridSheet = () => {
|
|
|
171
180
|
case 'frozenRowsStart':
|
|
172
181
|
return dxGrid?.setSelection({
|
|
173
182
|
start: { col: pos.col, row: 0, plane: 'grid' },
|
|
174
|
-
end: {
|
|
183
|
+
end: {
|
|
184
|
+
col: pos.col,
|
|
185
|
+
row: model.sheet.rows.length - 1,
|
|
186
|
+
plane: 'grid',
|
|
187
|
+
},
|
|
175
188
|
});
|
|
176
189
|
case 'frozenColsStart':
|
|
177
190
|
return dxGrid?.setSelection({
|
|
178
191
|
start: { row: pos.row, col: 0, plane: 'grid' },
|
|
179
|
-
end: {
|
|
192
|
+
end: {
|
|
193
|
+
row: pos.row,
|
|
194
|
+
col: model.sheet.columns.length - 1,
|
|
195
|
+
plane: 'grid',
|
|
196
|
+
},
|
|
180
197
|
});
|
|
181
198
|
}
|
|
182
199
|
},
|
|
@@ -256,31 +273,30 @@ export const GridSheet = () => {
|
|
|
256
273
|
switch (operation) {
|
|
257
274
|
case 'insert-before':
|
|
258
275
|
case 'insert-after':
|
|
259
|
-
return
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}),
|
|
265
|
-
);
|
|
276
|
+
return invokePromise(SheetOperation.InsertAxis, {
|
|
277
|
+
model,
|
|
278
|
+
axis: contextMenuAxis,
|
|
279
|
+
index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
|
|
280
|
+
});
|
|
266
281
|
case 'drop':
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}),
|
|
273
|
-
);
|
|
282
|
+
return invokePromise(SheetOperation.DropAxis, {
|
|
283
|
+
model,
|
|
284
|
+
axis: contextMenuAxis,
|
|
285
|
+
axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
|
|
286
|
+
});
|
|
274
287
|
}
|
|
275
288
|
},
|
|
276
|
-
[contextMenuAxis, contextMenuOpen, model,
|
|
289
|
+
[contextMenuAxis, contextMenuOpen, model, invokePromise],
|
|
277
290
|
);
|
|
278
291
|
|
|
279
292
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
280
293
|
|
|
281
|
-
const
|
|
294
|
+
const extensions = useMemo(
|
|
282
295
|
() => [
|
|
283
|
-
editorKeys({
|
|
296
|
+
editorKeys({
|
|
297
|
+
onClose: handleClose,
|
|
298
|
+
...(editing?.initialContent && { onNav: handleClose }),
|
|
299
|
+
}),
|
|
284
300
|
sheetExtension({ functions: model.graph.getFunctions() }),
|
|
285
301
|
rangeExtension({
|
|
286
302
|
onInit: (fn) => (rangeController.current = fn),
|
|
@@ -306,19 +322,20 @@ export const GridSheet = () => {
|
|
|
306
322
|
useSelectThreadOnCellFocus();
|
|
307
323
|
|
|
308
324
|
return (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
<GridCellEditor getCellContent={getCellContent} extension={extension} onBlur={handleBlur} />
|
|
325
|
+
<div {...rest} role='none' className={mx('relative min-h-0', className)}>
|
|
326
|
+
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
312
327
|
<Grid.Content
|
|
328
|
+
className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
313
329
|
initialCells={initialCells}
|
|
314
330
|
limitColumns={DEFAULT_COLS}
|
|
315
331
|
limitRows={DEFAULT_ROWS}
|
|
316
332
|
columns={columns}
|
|
317
333
|
rows={rows}
|
|
318
|
-
// TODO(burdon): `col` vs. `column`?
|
|
319
334
|
columnDefault={sheetColDefault}
|
|
320
335
|
rowDefault={sheetRowDefault}
|
|
336
|
+
activeRefs={activeRefs}
|
|
321
337
|
frozen={frozen}
|
|
338
|
+
overscroll='trap'
|
|
322
339
|
onAxisResize={handleAxisResize}
|
|
323
340
|
onSelect={handleSelect}
|
|
324
341
|
onFocus={handleFocus}
|
|
@@ -326,9 +343,6 @@ export const GridSheet = () => {
|
|
|
326
343
|
onKeyDown={handleKeyDown}
|
|
327
344
|
onContextMenu={handleContextMenu}
|
|
328
345
|
onClick={handleClick}
|
|
329
|
-
overscroll='trap'
|
|
330
|
-
className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
331
|
-
activeRefs={activeRefs}
|
|
332
346
|
ref={setDxGrid}
|
|
333
347
|
/>
|
|
334
348
|
<DropdownMenu.Root
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { inRange } from '@dxos/compute';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
9
|
-
import {
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
|
+
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
11
|
-
type GridContentProps,
|
|
12
|
-
type DxGridElement,
|
|
13
11
|
type DxGridAxisMeta,
|
|
12
|
+
type DxGridCellValue,
|
|
13
|
+
type DxGridElement,
|
|
14
14
|
type DxGridPlane,
|
|
15
|
-
type DxGridPlaneRange,
|
|
16
15
|
type DxGridPlaneCells,
|
|
17
|
-
type
|
|
16
|
+
type DxGridPlaneRange,
|
|
17
|
+
type GridContentProps,
|
|
18
18
|
colToA1Notation,
|
|
19
|
-
rowToA1Notation,
|
|
20
19
|
commentedClassName,
|
|
20
|
+
rowToA1Notation,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
|
-
import { mx } from '@dxos/
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
24
|
import { type SheetModel } from '../../model';
|
|
25
25
|
import { cellClassNameForRange, rangeFromIndex } from '../../types';
|
|
@@ -28,7 +28,10 @@ const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
|
28
28
|
return model.sheet.columns.reduce(
|
|
29
29
|
(acc: DxGridAxisMeta, columnId, numericIndex) => {
|
|
30
30
|
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
31
|
-
acc.grid[numericIndex] = {
|
|
31
|
+
acc.grid[numericIndex] = {
|
|
32
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
33
|
+
resizeable: true,
|
|
34
|
+
};
|
|
32
35
|
}
|
|
33
36
|
return acc;
|
|
34
37
|
},
|
|
@@ -40,7 +43,10 @@ const createDxGridRows = (model: SheetModel): DxGridAxisMeta => {
|
|
|
40
43
|
return model.sheet.rows.reduce(
|
|
41
44
|
(acc: DxGridAxisMeta, rowId, numericIndex) => {
|
|
42
45
|
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
43
|
-
acc.grid[numericIndex] = {
|
|
46
|
+
acc.grid[numericIndex] = {
|
|
47
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
48
|
+
resizeable: true,
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
return acc;
|
|
46
52
|
},
|
|
@@ -59,7 +65,7 @@ const projectCellProps = (model: SheetModel, col: number, row: number): DxGridCe
|
|
|
59
65
|
// const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target!.anchor);
|
|
60
66
|
// return thread && range ? inRange(range, address) : false;
|
|
61
67
|
// })
|
|
62
|
-
// .map((thread) =>
|
|
68
|
+
// .map((thread) => Obj.getDXN(thread!).toString())
|
|
63
69
|
// .join(' ');
|
|
64
70
|
|
|
65
71
|
const description = model.getValueDescription(address);
|
|
@@ -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':
|