@dxos/plugin-sheet 0.8.3 → 0.8.4-main.1068cf700f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs +397 -0
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-AMMLA66W.mjs +24 -0
- package/dist/lib/browser/anchor-sort-AMMLA66W.mjs.map +7 -0
- package/dist/lib/browser/chunk-EDWHV64N.mjs +1473 -0
- package/dist/lib/browser/chunk-EDWHV64N.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FJRLDX7Z.mjs → chunk-IFLWVS2V.mjs} +7 -7
- package/dist/lib/browser/chunk-IFLWVS2V.mjs.map +7 -0
- package/dist/lib/browser/chunk-KE3AKN5W.mjs +397 -0
- package/dist/lib/browser/chunk-KE3AKN5W.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +80 -89
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/markdown-D2T2DOVX.mjs +29 -0
- package/dist/lib/browser/markdown-D2T2DOVX.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-P2RX75DA.mjs +79 -0
- package/dist/lib/browser/operation-resolver-P2RX75DA.mjs.map +7 -0
- package/dist/lib/browser/react-surface-45CRAB5G.mjs +51 -0
- package/dist/lib/browser/react-surface-45CRAB5G.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -12
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs +398 -0
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-VHMBRX2E.mjs +25 -0
- package/dist/lib/node-esm/anchor-sort-VHMBRX2E.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6J5L47IB.mjs +398 -0
- package/dist/lib/node-esm/chunk-6J5L47IB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AYSEWH7N.mjs +1474 -0
- package/dist/lib/node-esm/chunk-AYSEWH7N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NMCVJWDT.mjs → chunk-PPOYR7DK.mjs} +7 -7
- package/dist/lib/node-esm/chunk-PPOYR7DK.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +80 -89
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs +30 -0
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-WPIWQ5IO.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-WPIWQ5IO.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-ITV2L6HK.mjs +52 -0
- package/dist/lib/node-esm/react-surface-ITV2L6HK.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/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +51 -3
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +11 -20
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts +2 -2
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +5 -6
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +54 -5
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +3 -3
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +3 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +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 -1
- package/dist/types/src/components/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 +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/playwright.config.d.ts +3 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/{testing/playwright → playwright}/sheet-manager.d.ts +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -0
- package/dist/types/src/playwright/sheet.spec.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 +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 +8 -62
- 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 +83 -73
- package/src/SheetPlugin.tsx +53 -65
- 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 +43 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +21 -20
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -2
- package/src/components/GridSheet/GridSheet.stories.tsx +23 -17
- package/src/components/GridSheet/GridSheet.tsx +63 -52
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +44 -43
- package/src/components/GridSheet/util.ts +17 -11
- package/src/components/RangeList/RangeList.tsx +13 -10
- package/src/components/SheetContainer/SheetContainer.stories.tsx +71 -47
- package/src/components/SheetContainer/SheetContainer.tsx +30 -18
- package/src/components/SheetContext/SheetContext.tsx +9 -9
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +19 -13
- package/src/components/SheetToolbar/SheetToolbar.tsx +52 -42
- package/src/components/SheetToolbar/align.ts +46 -20
- package/src/components/SheetToolbar/style.ts +48 -18
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/extensions/compute.stories.tsx +43 -30
- 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} +7 -4
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +43 -51
- 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 +17 -0
- package/src/{testing/playwright → playwright}/sheet-manager.ts +1 -1
- package/src/{testing/playwright → 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 +10 -7
- 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 +2 -2
- package/src/types/types.ts +84 -49
- package/src/types/util.ts +14 -41
- package/dist/lib/browser/SheetContainer-BDZXBB5U.mjs +0 -351
- package/dist/lib/browser/SheetContainer-BDZXBB5U.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-NYYZLRAA.mjs +0 -24
- package/dist/lib/browser/anchor-sort-NYYZLRAA.mjs.map +0 -7
- package/dist/lib/browser/chunk-5TA43LO4.mjs +0 -847
- package/dist/lib/browser/chunk-5TA43LO4.mjs.map +0 -7
- package/dist/lib/browser/chunk-D3G4UGEK.mjs +0 -18
- package/dist/lib/browser/chunk-D3G4UGEK.mjs.map +0 -7
- package/dist/lib/browser/chunk-FJRLDX7Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-I7FZ4TWJ.mjs +0 -892
- package/dist/lib/browser/chunk-I7FZ4TWJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-IR42IS3F.mjs +0 -15
- package/dist/lib/browser/chunk-IR42IS3F.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-IXGGJJBU.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-IXGGJJBU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-IBBI6B74.mjs +0 -56
- package/dist/lib/browser/intent-resolver-IBBI6B74.mjs.map +0 -7
- package/dist/lib/browser/markdown-T4TUP4BF.mjs +0 -26
- package/dist/lib/browser/markdown-T4TUP4BF.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UI46P43F.mjs +0 -53
- package/dist/lib/browser/react-surface-UI46P43F.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-VWPM3HYJ.cjs +0 -351
- package/dist/lib/node/SheetContainer-VWPM3HYJ.cjs.map +0 -7
- package/dist/lib/node/anchor-sort-A7NABMJM.cjs +0 -39
- package/dist/lib/node/anchor-sort-A7NABMJM.cjs.map +0 -7
- package/dist/lib/node/chunk-FIM6EZ6M.cjs +0 -256
- package/dist/lib/node/chunk-FIM6EZ6M.cjs.map +0 -7
- package/dist/lib/node/chunk-JSIDCZHB.cjs +0 -41
- package/dist/lib/node/chunk-JSIDCZHB.cjs.map +0 -7
- package/dist/lib/node/chunk-LJWWS53Z.cjs +0 -34
- package/dist/lib/node/chunk-LJWWS53Z.cjs.map +0 -7
- package/dist/lib/node/chunk-N7FSEUIN.cjs +0 -927
- package/dist/lib/node/chunk-N7FSEUIN.cjs.map +0 -7
- package/dist/lib/node/chunk-ST3WA73J.cjs +0 -855
- package/dist/lib/node/chunk-ST3WA73J.cjs.map +0 -7
- package/dist/lib/node/compute-graph-registry-ARLDHPFW.cjs +0 -56
- package/dist/lib/node/compute-graph-registry-ARLDHPFW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -173
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-2657YDOU.cjs +0 -69
- package/dist/lib/node/intent-resolver-2657YDOU.cjs.map +0 -7
- package/dist/lib/node/markdown-DBPOAYI7.cjs +0 -40
- package/dist/lib/node/markdown-DBPOAYI7.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-XQEIRKWU.cjs +0 -71
- package/dist/lib/node/react-surface-XQEIRKWU.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -84
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-V632Q4HA.mjs +0 -352
- package/dist/lib/node-esm/SheetContainer-V632Q4HA.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-JTNZOE67.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-JTNZOE67.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C4IKYVTV.mjs +0 -893
- package/dist/lib/node-esm/chunk-C4IKYVTV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IQ76YE6M.mjs +0 -16
- package/dist/lib/node-esm/chunk-IQ76YE6M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NMCVJWDT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SOC52B67.mjs +0 -848
- package/dist/lib/node-esm/chunk-SOC52B67.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y6ND5HWX.mjs +0 -20
- package/dist/lib/node-esm/chunk-Y6ND5HWX.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-7PDWXMHF.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-7PDWXMHF.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-M2HNR7PJ.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-M2HNR7PJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-WWUJ3E5F.mjs +0 -27
- package/dist/lib/node-esm/markdown-WWUJ3E5F.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-OLXO2MVB.mjs +0 -54
- package/dist/lib/node-esm/react-surface-OLXO2MVB.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/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/testing/playwright/sheet-manager.d.ts.map +0 -1
- package/dist/types/src/testing/playwright/sheet.spec.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/testing/playwright/playwright.config.cts +0 -18
- package/src/types/schema.ts +0 -60
- /package/dist/types/src/{testing/playwright → playwright}/sheet.spec.d.ts +0 -0
|
@@ -0,0 +1,1474 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
rangeExtension,
|
|
4
|
+
sheetExtension
|
|
5
|
+
} from "./chunk-PPOYR7DK.mjs";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_COLS,
|
|
8
|
+
DEFAULT_ROWS,
|
|
9
|
+
MAX_COLS,
|
|
10
|
+
MAX_ROWS,
|
|
11
|
+
ReadonlyException,
|
|
12
|
+
SheetOperation,
|
|
13
|
+
Sheet_exports,
|
|
14
|
+
addressFromIndex,
|
|
15
|
+
addressToIndex,
|
|
16
|
+
cellClassNameForRange,
|
|
17
|
+
initialize,
|
|
18
|
+
insertIndices,
|
|
19
|
+
mapFormulaIndicesToRefs,
|
|
20
|
+
mapFormulaRefsToIndices,
|
|
21
|
+
meta,
|
|
22
|
+
rangeFromIndex
|
|
23
|
+
} from "./chunk-6J5L47IB.mjs";
|
|
24
|
+
|
|
25
|
+
// src/components/ComputeGraph/ComputeGraphContextProvider.tsx
|
|
26
|
+
import React, { createContext, useContext } from "react";
|
|
27
|
+
import { raise } from "@dxos/debug";
|
|
28
|
+
import { useAsyncState } from "@dxos/react-hooks";
|
|
29
|
+
var ComputeGraphContext = /* @__PURE__ */ createContext(void 0);
|
|
30
|
+
var ComputeGraphContextProvider = ({ registry, children }) => {
|
|
31
|
+
return /* @__PURE__ */ React.createElement(ComputeGraphContext.Provider, {
|
|
32
|
+
value: {
|
|
33
|
+
registry
|
|
34
|
+
}
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
|
37
|
+
var useComputeGraph = (space) => {
|
|
38
|
+
const { registry } = useContext(ComputeGraphContext) ?? raise(new Error("Missing ComputeGraphContext"));
|
|
39
|
+
const [graph] = useAsyncState(async () => {
|
|
40
|
+
if (space) {
|
|
41
|
+
const graph2 = registry.getOrCreateGraph(space);
|
|
42
|
+
await graph2.open();
|
|
43
|
+
return graph2;
|
|
44
|
+
}
|
|
45
|
+
}, [
|
|
46
|
+
space,
|
|
47
|
+
registry
|
|
48
|
+
]);
|
|
49
|
+
return graph;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/components/RangeList/RangeList.tsx
|
|
53
|
+
import * as Schema from "effect/Schema";
|
|
54
|
+
import React2, { useCallback } from "react";
|
|
55
|
+
import { rangeToA1Notation } from "@dxos/compute";
|
|
56
|
+
import { Obj } from "@dxos/echo";
|
|
57
|
+
import { Callout, useTranslation } from "@dxos/react-ui";
|
|
58
|
+
import { List } from "@dxos/react-ui-list";
|
|
59
|
+
import { ghostHover } from "@dxos/ui-theme";
|
|
60
|
+
var RangeList = ({ sheet }) => {
|
|
61
|
+
const { t } = useTranslation(meta.id);
|
|
62
|
+
const handleSelectRange = (range) => {
|
|
63
|
+
};
|
|
64
|
+
const handleDeleteRange = useCallback((range) => {
|
|
65
|
+
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
66
|
+
Obj.change(sheet, (obj) => {
|
|
67
|
+
obj.ranges.splice(index, 1);
|
|
68
|
+
});
|
|
69
|
+
}, [
|
|
70
|
+
sheet
|
|
71
|
+
]);
|
|
72
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
|
|
73
|
+
className: "mbs-cardSpacingBlock mbe-labelSpacingBlock text-sm font-semibold"
|
|
74
|
+
}, t("range list heading")), sheet.ranges.length < 1 ? /* @__PURE__ */ React2.createElement(Callout.Root, null, /* @__PURE__ */ React2.createElement(Callout.Title, null, t("no ranges message"))) : /* @__PURE__ */ React2.createElement(List.Root, {
|
|
75
|
+
items: sheet.ranges,
|
|
76
|
+
isItem: Schema.is(Sheet_exports.Range)
|
|
77
|
+
}, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ React2.createElement(List.Item, {
|
|
78
|
+
key: i,
|
|
79
|
+
item: range,
|
|
80
|
+
classNames: [
|
|
81
|
+
"p-2",
|
|
82
|
+
ghostHover
|
|
83
|
+
]
|
|
84
|
+
}, /* @__PURE__ */ React2.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React2.createElement(List.ItemTitle, {
|
|
85
|
+
onClick: () => handleSelectRange(range)
|
|
86
|
+
}, t("range title", {
|
|
87
|
+
position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),
|
|
88
|
+
key: t(`range key ${range.key} label`),
|
|
89
|
+
value: t(`range value ${range.value} label`)
|
|
90
|
+
})), /* @__PURE__ */ React2.createElement(List.ItemDeleteButton, {
|
|
91
|
+
onClick: () => handleDeleteRange(range)
|
|
92
|
+
})))));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/components/index.ts
|
|
96
|
+
import { lazy } from "react";
|
|
97
|
+
|
|
98
|
+
// src/components/GridSheet/GridSheet.tsx
|
|
99
|
+
import React4, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState4 } from "react";
|
|
100
|
+
import { useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
|
|
101
|
+
import { rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
|
|
102
|
+
import { Obj as Obj5 } from "@dxos/echo";
|
|
103
|
+
import { defaultColSize, defaultRowSize } from "@dxos/lit-grid";
|
|
104
|
+
import { DropdownMenu, Icon, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
105
|
+
import { useAttention } from "@dxos/react-ui-attention";
|
|
106
|
+
import { Grid as Grid2, GridCellEditor, closestCell, editorKeys, parseCellIndex } from "@dxos/react-ui-grid";
|
|
107
|
+
|
|
108
|
+
// src/integrations/thread-ranges.ts
|
|
109
|
+
import * as Effect from "effect/Effect";
|
|
110
|
+
import { useCallback as useCallback2, useEffect, useMemo } from "react";
|
|
111
|
+
import { useOperationInvoker, useOperationResolver } from "@dxos/app-framework/ui";
|
|
112
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
113
|
+
import { debounce } from "@dxos/async";
|
|
114
|
+
import { inRange } from "@dxos/compute";
|
|
115
|
+
import { Obj as Obj2, Relation } from "@dxos/echo";
|
|
116
|
+
import { OperationResolver } from "@dxos/operation";
|
|
117
|
+
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from "@dxos/plugin-deck/types";
|
|
118
|
+
import { ThreadOperation } from "@dxos/plugin-thread/types";
|
|
119
|
+
import { Filter, Query, useQuery } from "@dxos/react-client/echo";
|
|
120
|
+
import { AnchoredTo, Thread } from "@dxos/types";
|
|
121
|
+
var parseThreadAnchorAsCellRange = (cursor) => {
|
|
122
|
+
const coords = cursor.split(",");
|
|
123
|
+
if (coords.length !== 4) {
|
|
124
|
+
return null;
|
|
125
|
+
} else {
|
|
126
|
+
const [fromCol, fromRow, toCol, toRow] = coords;
|
|
127
|
+
return {
|
|
128
|
+
from: {
|
|
129
|
+
col: parseInt(fromCol),
|
|
130
|
+
row: parseInt(fromRow)
|
|
131
|
+
},
|
|
132
|
+
to: {
|
|
133
|
+
col: parseInt(toCol),
|
|
134
|
+
row: parseInt(toRow)
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
140
|
+
const { model, setActiveRefs } = useSheetContext();
|
|
141
|
+
const sheetId = Obj2.getDXN(model.sheet).toString();
|
|
142
|
+
const scrollIntoViewHandler = useMemo(() => OperationResolver.make({
|
|
143
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
144
|
+
position: "hoist",
|
|
145
|
+
filter: (input) => input.subject === sheetId && !!input.cursor,
|
|
146
|
+
handler: (input) => Effect.sync(() => {
|
|
147
|
+
const { cursor, ref } = input;
|
|
148
|
+
if (cursor) {
|
|
149
|
+
setActiveRefs(ref);
|
|
150
|
+
const range = parseThreadAnchorAsCellRange(cursor);
|
|
151
|
+
range && grid?.setFocus({
|
|
152
|
+
...range.to,
|
|
153
|
+
plane: "grid"
|
|
154
|
+
}, true);
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
}), [
|
|
158
|
+
sheetId,
|
|
159
|
+
setActiveRefs,
|
|
160
|
+
grid
|
|
161
|
+
]);
|
|
162
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
163
|
+
};
|
|
164
|
+
var useSelectThreadOnCellFocus = () => {
|
|
165
|
+
const { model, cursor } = useSheetContext();
|
|
166
|
+
const { invokePromise } = useOperationInvoker();
|
|
167
|
+
const db = Obj2.getDatabase(model.sheet);
|
|
168
|
+
const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
169
|
+
const selectClosestThread = useCallback2((cellAddress) => {
|
|
170
|
+
if (!cellAddress) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const closestThread = anchors.find((anchor) => {
|
|
174
|
+
const source = Relation.getSource(anchor);
|
|
175
|
+
if (anchor.anchor && Obj2.instanceOf(Thread.Thread, source)) {
|
|
176
|
+
const range = parseThreadAnchorAsCellRange(anchor.anchor);
|
|
177
|
+
return range ? inRange(range, cellAddress) : false;
|
|
178
|
+
} else {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
if (closestThread) {
|
|
183
|
+
const primary = Obj2.getDXN(model.sheet).toString();
|
|
184
|
+
void (async () => {
|
|
185
|
+
await invokePromise(ThreadOperation.Select, {
|
|
186
|
+
current: Relation.getDXN(closestThread).toString()
|
|
187
|
+
});
|
|
188
|
+
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
189
|
+
primary,
|
|
190
|
+
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`
|
|
191
|
+
});
|
|
192
|
+
})();
|
|
193
|
+
}
|
|
194
|
+
}, [
|
|
195
|
+
invokePromise,
|
|
196
|
+
anchors
|
|
197
|
+
]);
|
|
198
|
+
const debounced = useMemo(() => {
|
|
199
|
+
return debounce((cellCoords) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
|
|
200
|
+
}, [
|
|
201
|
+
selectClosestThread
|
|
202
|
+
]);
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
if (!cursor) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
debounced(cursor);
|
|
208
|
+
}, [
|
|
209
|
+
cursor,
|
|
210
|
+
debounced
|
|
211
|
+
]);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// src/components/SheetContext/SheetContext.tsx
|
|
215
|
+
import React3, { createContext as createContext2, useCallback as useCallback3, useContext as useContext2, useState as useState2 } from "react";
|
|
216
|
+
import { Obj as Obj4 } from "@dxos/echo";
|
|
217
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
218
|
+
import { Grid, useGridContext } from "@dxos/react-ui-grid";
|
|
219
|
+
|
|
220
|
+
// src/model/sheet-model.ts
|
|
221
|
+
import { Event } from "@dxos/async";
|
|
222
|
+
import { DetailedCellError, ExportedCellChange, addressFromA1Notation, addressToA1Notation, createSheetName, isFormula } from "@dxos/compute";
|
|
223
|
+
import { Resource } from "@dxos/context";
|
|
224
|
+
import { Obj as Obj3 } from "@dxos/echo";
|
|
225
|
+
import { Format, TypeEnum } from "@dxos/echo/internal";
|
|
226
|
+
import { invariant } from "@dxos/invariant";
|
|
227
|
+
import { PublicKey } from "@dxos/keys";
|
|
228
|
+
import { log } from "@dxos/log";
|
|
229
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
|
|
230
|
+
var typeMap = {
|
|
231
|
+
BOOLEAN: {
|
|
232
|
+
type: TypeEnum.Boolean
|
|
233
|
+
},
|
|
234
|
+
NUMBER_RAW: {
|
|
235
|
+
type: TypeEnum.Number
|
|
236
|
+
},
|
|
237
|
+
NUMBER_PERCENT: {
|
|
238
|
+
type: TypeEnum.Number,
|
|
239
|
+
format: Format.TypeFormat.Percent
|
|
240
|
+
},
|
|
241
|
+
NUMBER_CURRENCY: {
|
|
242
|
+
type: TypeEnum.Number,
|
|
243
|
+
format: Format.TypeFormat.Currency
|
|
244
|
+
},
|
|
245
|
+
NUMBER_DATETIME: {
|
|
246
|
+
type: TypeEnum.String,
|
|
247
|
+
format: Format.TypeFormat.DateTime
|
|
248
|
+
},
|
|
249
|
+
NUMBER_DATE: {
|
|
250
|
+
type: TypeEnum.String,
|
|
251
|
+
format: Format.TypeFormat.Date
|
|
252
|
+
},
|
|
253
|
+
NUMBER_TIME: {
|
|
254
|
+
type: TypeEnum.String,
|
|
255
|
+
format: Format.TypeFormat.Time
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var getTopLeft = (range) => {
|
|
259
|
+
const to = range.to ?? range.from;
|
|
260
|
+
return {
|
|
261
|
+
row: Math.min(range.from.row, to.row),
|
|
262
|
+
col: Math.min(range.from.col, to.col)
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
var toSimpleCellAddress = (sheet, cell) => ({
|
|
266
|
+
sheet,
|
|
267
|
+
row: cell.row,
|
|
268
|
+
col: cell.col
|
|
269
|
+
});
|
|
270
|
+
var toModelRange = (sheet, range) => ({
|
|
271
|
+
start: toSimpleCellAddress(sheet, range.from),
|
|
272
|
+
end: toSimpleCellAddress(sheet, range.to ?? range.from)
|
|
273
|
+
});
|
|
274
|
+
var SheetModel = class extends Resource {
|
|
275
|
+
_graph;
|
|
276
|
+
_sheet;
|
|
277
|
+
_options;
|
|
278
|
+
id = `model-${PublicKey.random().truncate()}`;
|
|
279
|
+
// Wraps compute node.
|
|
280
|
+
update = new Event();
|
|
281
|
+
_node;
|
|
282
|
+
constructor(_graph, _sheet, _options = {}) {
|
|
283
|
+
super(), this._graph = _graph, this._sheet = _sheet, this._options = _options;
|
|
284
|
+
}
|
|
285
|
+
get graph() {
|
|
286
|
+
return this._graph;
|
|
287
|
+
}
|
|
288
|
+
get sheet() {
|
|
289
|
+
return this._sheet;
|
|
290
|
+
}
|
|
291
|
+
get readonly() {
|
|
292
|
+
return this._options.readonly;
|
|
293
|
+
}
|
|
294
|
+
get bounds() {
|
|
295
|
+
return {
|
|
296
|
+
rows: this._sheet.rows.length,
|
|
297
|
+
columns: this._sheet.columns.length
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Initialize sheet and engine.
|
|
302
|
+
*/
|
|
303
|
+
async _open() {
|
|
304
|
+
log("initialize", {
|
|
305
|
+
id: this.id
|
|
306
|
+
}, {
|
|
307
|
+
F: __dxlog_file,
|
|
308
|
+
L: 124,
|
|
309
|
+
S: this,
|
|
310
|
+
C: (f, a) => f(...a)
|
|
311
|
+
});
|
|
312
|
+
Obj3.change(this._sheet, (obj) => {
|
|
313
|
+
initialize(obj);
|
|
314
|
+
});
|
|
315
|
+
this._graph.update.on((event) => {
|
|
316
|
+
if (event.type === "functionsUpdated") {
|
|
317
|
+
this.reset();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
this._node = this._graph.getOrCreateNode(createSheetName({
|
|
321
|
+
type: Obj3.getTypename(this._sheet),
|
|
322
|
+
id: this._sheet.id
|
|
323
|
+
}));
|
|
324
|
+
await this._node.open();
|
|
325
|
+
const unsubscribe = this._node.update.on((event) => this.update.emit(event));
|
|
326
|
+
this._ctx.onDispose(unsubscribe);
|
|
327
|
+
this.reset();
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Update engine.
|
|
331
|
+
* NOTE: This resets the undo history.
|
|
332
|
+
* @deprecated
|
|
333
|
+
*/
|
|
334
|
+
reset() {
|
|
335
|
+
invariant(this._node, void 0, {
|
|
336
|
+
F: __dxlog_file,
|
|
337
|
+
L: 154,
|
|
338
|
+
S: this,
|
|
339
|
+
A: [
|
|
340
|
+
"this._node",
|
|
341
|
+
""
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
this._node.graph.hf.clearSheet(this._node.sheetId);
|
|
345
|
+
Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
|
|
346
|
+
invariant(this._node, void 0, {
|
|
347
|
+
F: __dxlog_file,
|
|
348
|
+
L: 157,
|
|
349
|
+
S: this,
|
|
350
|
+
A: [
|
|
351
|
+
"this._node",
|
|
352
|
+
""
|
|
353
|
+
]
|
|
354
|
+
});
|
|
355
|
+
const { col, row } = addressFromIndex(this._sheet, key);
|
|
356
|
+
if (isFormula(value)) {
|
|
357
|
+
const binding = this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
|
|
358
|
+
if (binding) {
|
|
359
|
+
value = this._graph.mapFormulaToNative(binding);
|
|
360
|
+
} else {
|
|
361
|
+
value = "";
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
this._node.graph.hf.setCellContents({
|
|
365
|
+
sheet: this._node.sheetId,
|
|
366
|
+
row,
|
|
367
|
+
col
|
|
368
|
+
}, value);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Recalculate formulas.
|
|
373
|
+
* NOTE: This resets the undo history.
|
|
374
|
+
* https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
|
|
375
|
+
* @deprecated
|
|
376
|
+
*/
|
|
377
|
+
// TODO(burdon): Remove.
|
|
378
|
+
recalculate() {
|
|
379
|
+
this._node?.graph.hf.rebuildAndRecalculate();
|
|
380
|
+
}
|
|
381
|
+
insertRows(i, n = 1) {
|
|
382
|
+
let idx = [];
|
|
383
|
+
Obj3.change(this._sheet, (obj) => {
|
|
384
|
+
idx = insertIndices(obj.rows, i, n, MAX_ROWS);
|
|
385
|
+
});
|
|
386
|
+
this.reset();
|
|
387
|
+
return idx;
|
|
388
|
+
}
|
|
389
|
+
insertColumns(i, n = 1) {
|
|
390
|
+
let idx = [];
|
|
391
|
+
Obj3.change(this._sheet, (obj) => {
|
|
392
|
+
idx = insertIndices(obj.columns, i, n, MAX_COLS);
|
|
393
|
+
});
|
|
394
|
+
this.reset();
|
|
395
|
+
return idx;
|
|
396
|
+
}
|
|
397
|
+
dropRow(rowIndex) {
|
|
398
|
+
const range = {
|
|
399
|
+
from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
|
|
400
|
+
to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`)
|
|
401
|
+
};
|
|
402
|
+
const values = this.getCellValues(range).flat();
|
|
403
|
+
const index = this._sheet.rows.indexOf(rowIndex);
|
|
404
|
+
this.clear(range);
|
|
405
|
+
Obj3.change(this._sheet, (obj) => {
|
|
406
|
+
obj.rows.splice(index, 1);
|
|
407
|
+
delete obj.rowMeta[rowIndex];
|
|
408
|
+
});
|
|
409
|
+
this.reset();
|
|
410
|
+
return {
|
|
411
|
+
axis: "row",
|
|
412
|
+
index,
|
|
413
|
+
axisIndex: rowIndex,
|
|
414
|
+
axisMeta: this._sheet.rowMeta[rowIndex],
|
|
415
|
+
values
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
dropColumn(colIndex) {
|
|
419
|
+
const range = {
|
|
420
|
+
from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
|
|
421
|
+
to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
|
|
422
|
+
};
|
|
423
|
+
const values = this.getCellValues(range).flat();
|
|
424
|
+
const index = this._sheet.columns.indexOf(colIndex);
|
|
425
|
+
this.clear(range);
|
|
426
|
+
Obj3.change(this._sheet, (obj) => {
|
|
427
|
+
obj.columns.splice(index, 1);
|
|
428
|
+
delete obj.columnMeta[colIndex];
|
|
429
|
+
});
|
|
430
|
+
this.reset();
|
|
431
|
+
return {
|
|
432
|
+
axis: "col",
|
|
433
|
+
index,
|
|
434
|
+
axisIndex: colIndex,
|
|
435
|
+
axisMeta: this._sheet.rowMeta[colIndex],
|
|
436
|
+
values
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
restoreRow({ index, axisIndex, axisMeta, values }) {
|
|
440
|
+
Obj3.change(this._sheet, (obj) => {
|
|
441
|
+
obj.rows.splice(index, 0, axisIndex);
|
|
442
|
+
values.forEach((value, col) => {
|
|
443
|
+
if (value) {
|
|
444
|
+
obj.cells[`${obj.columns[col]}@${axisIndex}`] = {
|
|
445
|
+
value
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
if (axisMeta) {
|
|
450
|
+
obj.rowMeta[axisIndex] = axisMeta;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
this.reset();
|
|
454
|
+
}
|
|
455
|
+
restoreColumn({ index, axisIndex, axisMeta, values }) {
|
|
456
|
+
Obj3.change(this._sheet, (obj) => {
|
|
457
|
+
obj.columns.splice(index, 0, axisIndex);
|
|
458
|
+
values.forEach((value, row) => {
|
|
459
|
+
if (value) {
|
|
460
|
+
obj.cells[`${axisIndex}@${obj.rows[row]}`] = {
|
|
461
|
+
value
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
if (axisMeta) {
|
|
466
|
+
obj.columnMeta[axisIndex] = axisMeta;
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
this.reset();
|
|
470
|
+
}
|
|
471
|
+
//
|
|
472
|
+
// Undoable actions.
|
|
473
|
+
// TODO(burdon): Group undoable methods; consistently update hf/sheet.
|
|
474
|
+
//
|
|
475
|
+
/**
|
|
476
|
+
* Clear range of values.
|
|
477
|
+
*/
|
|
478
|
+
clear(range) {
|
|
479
|
+
invariant(this._node, void 0, {
|
|
480
|
+
F: __dxlog_file,
|
|
481
|
+
L: 276,
|
|
482
|
+
S: this,
|
|
483
|
+
A: [
|
|
484
|
+
"this._node",
|
|
485
|
+
""
|
|
486
|
+
]
|
|
487
|
+
});
|
|
488
|
+
const topLeft = getTopLeft(range);
|
|
489
|
+
const values = this._iterRange(range, () => null);
|
|
490
|
+
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
491
|
+
Obj3.change(this._sheet, (obj) => {
|
|
492
|
+
this._iterRange(range, (cell) => {
|
|
493
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
494
|
+
delete obj.cells[idx];
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
cut(range) {
|
|
499
|
+
invariant(this._node, void 0, {
|
|
500
|
+
F: __dxlog_file,
|
|
501
|
+
L: 289,
|
|
502
|
+
S: this,
|
|
503
|
+
A: [
|
|
504
|
+
"this._node",
|
|
505
|
+
""
|
|
506
|
+
]
|
|
507
|
+
});
|
|
508
|
+
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
509
|
+
Obj3.change(this._sheet, (obj) => {
|
|
510
|
+
this._iterRange(range, (cell) => {
|
|
511
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
512
|
+
delete obj.cells[idx];
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
copy(range) {
|
|
517
|
+
invariant(this._node, void 0, {
|
|
518
|
+
F: __dxlog_file,
|
|
519
|
+
L: 300,
|
|
520
|
+
S: this,
|
|
521
|
+
A: [
|
|
522
|
+
"this._node",
|
|
523
|
+
""
|
|
524
|
+
]
|
|
525
|
+
});
|
|
526
|
+
this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
|
|
527
|
+
}
|
|
528
|
+
paste(cell) {
|
|
529
|
+
invariant(this._node, void 0, {
|
|
530
|
+
F: __dxlog_file,
|
|
531
|
+
L: 305,
|
|
532
|
+
S: this,
|
|
533
|
+
A: [
|
|
534
|
+
"this._node",
|
|
535
|
+
""
|
|
536
|
+
]
|
|
537
|
+
});
|
|
538
|
+
if (!this._node.graph.hf.isClipboardEmpty()) {
|
|
539
|
+
const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
|
|
540
|
+
Obj3.change(this._sheet, (obj) => {
|
|
541
|
+
for (const change of changes) {
|
|
542
|
+
if (change instanceof ExportedCellChange) {
|
|
543
|
+
const { address, newValue } = change;
|
|
544
|
+
const idx = addressToIndex(this._sheet, {
|
|
545
|
+
row: address.row,
|
|
546
|
+
col: address.col
|
|
547
|
+
});
|
|
548
|
+
obj.cells[idx] = {
|
|
549
|
+
value: newValue
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
// TODO(burdon): Display undo/redo state.
|
|
557
|
+
undo() {
|
|
558
|
+
invariant(this._node, void 0, {
|
|
559
|
+
F: __dxlog_file,
|
|
560
|
+
L: 322,
|
|
561
|
+
S: this,
|
|
562
|
+
A: [
|
|
563
|
+
"this._node",
|
|
564
|
+
""
|
|
565
|
+
]
|
|
566
|
+
});
|
|
567
|
+
if (this._node.graph.hf.isThereSomethingToUndo()) {
|
|
568
|
+
this._node.graph.hf.undo();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
redo() {
|
|
572
|
+
invariant(this._node, void 0, {
|
|
573
|
+
F: __dxlog_file,
|
|
574
|
+
L: 330,
|
|
575
|
+
S: this,
|
|
576
|
+
A: [
|
|
577
|
+
"this._node",
|
|
578
|
+
""
|
|
579
|
+
]
|
|
580
|
+
});
|
|
581
|
+
if (this._node.graph.hf.isThereSomethingToRedo()) {
|
|
582
|
+
this._node.graph.hf.redo();
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Get value from sheet.
|
|
587
|
+
*/
|
|
588
|
+
getCellValue(cell) {
|
|
589
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
590
|
+
return this._sheet.cells[idx]?.value ?? null;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Get value as a string for editing.
|
|
594
|
+
*/
|
|
595
|
+
getCellText(cell) {
|
|
596
|
+
const value = this.getCellValue(cell);
|
|
597
|
+
if (value == null) {
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
if (isFormula(value)) {
|
|
601
|
+
return this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
|
|
602
|
+
} else {
|
|
603
|
+
return String(value);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Get array of raw values from sheet.
|
|
608
|
+
*/
|
|
609
|
+
getCellValues(range) {
|
|
610
|
+
return this._iterRange(range, (cell) => this.getCellValue(cell));
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Gets the regular or computed value from the engine.
|
|
614
|
+
*/
|
|
615
|
+
getValue(cell) {
|
|
616
|
+
invariant(this._node, void 0, {
|
|
617
|
+
F: __dxlog_file,
|
|
618
|
+
L: 373,
|
|
619
|
+
S: this,
|
|
620
|
+
A: [
|
|
621
|
+
"this._node",
|
|
622
|
+
""
|
|
623
|
+
]
|
|
624
|
+
});
|
|
625
|
+
const address = toSimpleCellAddress(this._node.sheetId, cell);
|
|
626
|
+
const value = this._node.graph.hf.getCellValue(address);
|
|
627
|
+
if (value instanceof DetailedCellError) {
|
|
628
|
+
log.warn("cell error", {
|
|
629
|
+
cell,
|
|
630
|
+
error: value
|
|
631
|
+
}, {
|
|
632
|
+
F: __dxlog_file,
|
|
633
|
+
L: 378,
|
|
634
|
+
S: this,
|
|
635
|
+
C: (f, a) => f(...a)
|
|
636
|
+
});
|
|
637
|
+
return value.toString();
|
|
638
|
+
}
|
|
639
|
+
return value;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Get value type.
|
|
643
|
+
*/
|
|
644
|
+
getValueDescription(cell) {
|
|
645
|
+
invariant(this._node, void 0, {
|
|
646
|
+
F: __dxlog_file,
|
|
647
|
+
L: 389,
|
|
648
|
+
S: this,
|
|
649
|
+
A: [
|
|
650
|
+
"this._node",
|
|
651
|
+
""
|
|
652
|
+
]
|
|
653
|
+
});
|
|
654
|
+
const addr = toSimpleCellAddress(this._node.sheetId, cell);
|
|
655
|
+
const type = this._node.graph.hf.getCellValueDetailedType(addr);
|
|
656
|
+
return typeMap[type];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Sets the value, updating the sheet and engine.
|
|
660
|
+
*/
|
|
661
|
+
setValue(cell, value) {
|
|
662
|
+
invariant(this._node, void 0, {
|
|
663
|
+
F: __dxlog_file,
|
|
664
|
+
L: 399,
|
|
665
|
+
S: this,
|
|
666
|
+
A: [
|
|
667
|
+
"this._node",
|
|
668
|
+
""
|
|
669
|
+
]
|
|
670
|
+
});
|
|
671
|
+
if (this._options.readonly) {
|
|
672
|
+
throw new ReadonlyException();
|
|
673
|
+
}
|
|
674
|
+
let refresh = false;
|
|
675
|
+
if (cell.row >= this._sheet.rows.length) {
|
|
676
|
+
Obj3.change(this._sheet, (obj) => {
|
|
677
|
+
insertIndices(obj.rows, cell.row, 1, MAX_ROWS);
|
|
678
|
+
});
|
|
679
|
+
refresh = true;
|
|
680
|
+
}
|
|
681
|
+
if (cell.col >= this._sheet.columns.length) {
|
|
682
|
+
Obj3.change(this._sheet, (obj) => {
|
|
683
|
+
insertIndices(obj.columns, cell.col, 1, MAX_COLS);
|
|
684
|
+
});
|
|
685
|
+
refresh = true;
|
|
686
|
+
}
|
|
687
|
+
if (refresh) {
|
|
688
|
+
this.reset();
|
|
689
|
+
}
|
|
690
|
+
this._node.graph.hf.setCellContents({
|
|
691
|
+
sheet: this._node.sheetId,
|
|
692
|
+
row: cell.row,
|
|
693
|
+
col: cell.col
|
|
694
|
+
}, [
|
|
695
|
+
[
|
|
696
|
+
isFormula(value) ? this._graph.mapFormulaToNative(value) : value
|
|
697
|
+
]
|
|
698
|
+
]);
|
|
699
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
700
|
+
if (value === void 0 || value === null) {
|
|
701
|
+
Obj3.change(this._sheet, (obj) => {
|
|
702
|
+
delete obj.cells[idx];
|
|
703
|
+
});
|
|
704
|
+
} else {
|
|
705
|
+
if (isFormula(value)) {
|
|
706
|
+
value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
|
|
707
|
+
}
|
|
708
|
+
Obj3.change(this._sheet, (obj) => {
|
|
709
|
+
obj.cells[idx] = {
|
|
710
|
+
value
|
|
711
|
+
};
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Sets values from a simple map.
|
|
717
|
+
*/
|
|
718
|
+
setValues(values) {
|
|
719
|
+
Object.entries(values).forEach(([key, { value }]) => {
|
|
720
|
+
this.setValue(addressFromA1Notation(key), value);
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Iterate range.
|
|
725
|
+
*/
|
|
726
|
+
_iterRange(range, cb) {
|
|
727
|
+
const to = range.to ?? range.from;
|
|
728
|
+
const rowRange = [
|
|
729
|
+
Math.min(range.from.row, to.row),
|
|
730
|
+
Math.max(range.from.row, to.row)
|
|
731
|
+
];
|
|
732
|
+
const columnRange = [
|
|
733
|
+
Math.min(range.from.col, to.col),
|
|
734
|
+
Math.max(range.from.col, to.col)
|
|
735
|
+
];
|
|
736
|
+
const rows = [];
|
|
737
|
+
for (let row = rowRange[0]; row <= rowRange[1]; row++) {
|
|
738
|
+
const rowCells = [];
|
|
739
|
+
for (let column = columnRange[0]; column <= columnRange[1]; column++) {
|
|
740
|
+
const value = cb({
|
|
741
|
+
row,
|
|
742
|
+
col: column
|
|
743
|
+
});
|
|
744
|
+
if (value !== void 0) {
|
|
745
|
+
rowCells.push(value);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
rows.push(rowCells);
|
|
749
|
+
}
|
|
750
|
+
return rows;
|
|
751
|
+
}
|
|
752
|
+
// TODO(burdon): Delete index.
|
|
753
|
+
_deleteIndices(indices, i, n) {
|
|
754
|
+
throw new Error("Not implemented");
|
|
755
|
+
}
|
|
756
|
+
// TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
|
|
757
|
+
_moveIndices(indices, i, j, n) {
|
|
758
|
+
throw new Error("Not implemented");
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Map from indices to A1 notation.
|
|
762
|
+
*/
|
|
763
|
+
mapFormulaIndicesToRefs(formula) {
|
|
764
|
+
invariant(isFormula(formula), void 0, {
|
|
765
|
+
F: __dxlog_file,
|
|
766
|
+
L: 492,
|
|
767
|
+
S: this,
|
|
768
|
+
A: [
|
|
769
|
+
"isFormula(formula)",
|
|
770
|
+
""
|
|
771
|
+
]
|
|
772
|
+
});
|
|
773
|
+
return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
|
|
774
|
+
return addressToA1Notation(addressFromIndex(this._sheet, idx));
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
//
|
|
778
|
+
// Values
|
|
779
|
+
//
|
|
780
|
+
/**
|
|
781
|
+
* https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example
|
|
782
|
+
* https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate
|
|
783
|
+
* NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
|
|
784
|
+
*/
|
|
785
|
+
toLocalDate(num) {
|
|
786
|
+
const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);
|
|
787
|
+
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
788
|
+
}
|
|
789
|
+
toDateTime(num) {
|
|
790
|
+
invariant(this._node, void 0, {
|
|
791
|
+
F: __dxlog_file,
|
|
792
|
+
L: 513,
|
|
793
|
+
S: this,
|
|
794
|
+
A: [
|
|
795
|
+
"this._node",
|
|
796
|
+
""
|
|
797
|
+
]
|
|
798
|
+
});
|
|
799
|
+
return this._node.graph.hf.numberToDateTime(num);
|
|
800
|
+
}
|
|
801
|
+
toDate(num) {
|
|
802
|
+
invariant(this._node, void 0, {
|
|
803
|
+
F: __dxlog_file,
|
|
804
|
+
L: 518,
|
|
805
|
+
S: this,
|
|
806
|
+
A: [
|
|
807
|
+
"this._node",
|
|
808
|
+
""
|
|
809
|
+
]
|
|
810
|
+
});
|
|
811
|
+
return this._node.graph.hf.numberToDate(num);
|
|
812
|
+
}
|
|
813
|
+
toTime(num) {
|
|
814
|
+
invariant(this._node, void 0, {
|
|
815
|
+
F: __dxlog_file,
|
|
816
|
+
L: 523,
|
|
817
|
+
S: this,
|
|
818
|
+
A: [
|
|
819
|
+
"this._node",
|
|
820
|
+
""
|
|
821
|
+
]
|
|
822
|
+
});
|
|
823
|
+
return this._node.graph.hf.numberToTime(num);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
// src/model/useSheetModel.ts
|
|
828
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
829
|
+
var useSheetModel = (graph, sheet, { readonly } = {}) => {
|
|
830
|
+
const [model, setModel] = useState();
|
|
831
|
+
useEffect2(() => {
|
|
832
|
+
if (!graph || !sheet) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
let model2;
|
|
836
|
+
const t = setTimeout(async () => {
|
|
837
|
+
model2 = new SheetModel(graph, sheet, {
|
|
838
|
+
readonly
|
|
839
|
+
});
|
|
840
|
+
await model2.open();
|
|
841
|
+
setModel(model2);
|
|
842
|
+
});
|
|
843
|
+
return () => {
|
|
844
|
+
clearTimeout(t);
|
|
845
|
+
void model2?.close();
|
|
846
|
+
};
|
|
847
|
+
}, [
|
|
848
|
+
graph,
|
|
849
|
+
sheet,
|
|
850
|
+
readonly
|
|
851
|
+
]);
|
|
852
|
+
return model;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
// src/components/SheetContext/SheetContext.tsx
|
|
856
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
|
|
857
|
+
var SheetContext = /* @__PURE__ */ createContext2(void 0);
|
|
858
|
+
var useSheetContext = () => {
|
|
859
|
+
const context = useContext2(SheetContext);
|
|
860
|
+
invariant2(context, void 0, {
|
|
861
|
+
F: __dxlog_file2,
|
|
862
|
+
L: 54,
|
|
863
|
+
S: void 0,
|
|
864
|
+
A: [
|
|
865
|
+
"context",
|
|
866
|
+
""
|
|
867
|
+
]
|
|
868
|
+
});
|
|
869
|
+
return context;
|
|
870
|
+
};
|
|
871
|
+
var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo }) => {
|
|
872
|
+
const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
|
|
873
|
+
const [cursor, setCursorInternal] = useState2();
|
|
874
|
+
const [range, setRangeInternal] = useState2();
|
|
875
|
+
const [cursorFallbackRange, setCursorFallbackRange] = useState2();
|
|
876
|
+
const [activeRefs, setActiveRefs] = useState2("");
|
|
877
|
+
const setCursor = useCallback3((nextCursor) => {
|
|
878
|
+
setCursorInternal(nextCursor);
|
|
879
|
+
setCursorFallbackRange(range?.to ? range : nextCursor ? {
|
|
880
|
+
from: nextCursor,
|
|
881
|
+
to: nextCursor
|
|
882
|
+
} : void 0);
|
|
883
|
+
}, [
|
|
884
|
+
range
|
|
885
|
+
]);
|
|
886
|
+
const setRange = useCallback3((nextRange) => {
|
|
887
|
+
setRangeInternal(nextRange);
|
|
888
|
+
setCursorFallbackRange(nextRange?.to ? nextRange : cursor ? {
|
|
889
|
+
from: cursor,
|
|
890
|
+
to: cursor
|
|
891
|
+
} : void 0);
|
|
892
|
+
}, [
|
|
893
|
+
cursor
|
|
894
|
+
]);
|
|
895
|
+
return /* @__PURE__ */ React3.createElement(SheetContext.Provider, {
|
|
896
|
+
value: {
|
|
897
|
+
id,
|
|
898
|
+
model,
|
|
899
|
+
editing,
|
|
900
|
+
setEditing,
|
|
901
|
+
cursor,
|
|
902
|
+
setCursor,
|
|
903
|
+
range,
|
|
904
|
+
setRange,
|
|
905
|
+
cursorFallbackRange,
|
|
906
|
+
activeRefs,
|
|
907
|
+
setActiveRefs,
|
|
908
|
+
// TODO(burdon): Change to event.
|
|
909
|
+
onInfo,
|
|
910
|
+
ignoreAttention
|
|
911
|
+
}
|
|
912
|
+
}, children);
|
|
913
|
+
};
|
|
914
|
+
var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo }) => {
|
|
915
|
+
const model = useSheetModel(graph, sheet, {
|
|
916
|
+
readonly
|
|
917
|
+
});
|
|
918
|
+
return !model ? null : /* @__PURE__ */ React3.createElement(Grid.Root, {
|
|
919
|
+
id: Obj4.getDXN(sheet).toString()
|
|
920
|
+
}, /* @__PURE__ */ React3.createElement(SheetProviderImpl, {
|
|
921
|
+
model,
|
|
922
|
+
onInfo,
|
|
923
|
+
ignoreAttention
|
|
924
|
+
}, children));
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
// src/components/GridSheet/util.ts
|
|
928
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
929
|
+
import { inRange as inRange2 } from "@dxos/compute";
|
|
930
|
+
import { createDocAccessor } from "@dxos/echo-db";
|
|
931
|
+
import { cellClassesForFieldType, parseValue } from "@dxos/react-ui-form";
|
|
932
|
+
import { colToA1Notation, commentedClassName, rowToA1Notation } from "@dxos/react-ui-grid";
|
|
933
|
+
import { mx } from "@dxos/ui-theme";
|
|
934
|
+
var createDxGridColumns = (model) => {
|
|
935
|
+
return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
|
|
936
|
+
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
937
|
+
acc.grid[numericIndex] = {
|
|
938
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
939
|
+
resizeable: true
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
return acc;
|
|
943
|
+
}, {
|
|
944
|
+
grid: {}
|
|
945
|
+
});
|
|
946
|
+
};
|
|
947
|
+
var createDxGridRows = (model) => {
|
|
948
|
+
return model.sheet.rows.reduce((acc, rowId, numericIndex) => {
|
|
949
|
+
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
950
|
+
acc.grid[numericIndex] = {
|
|
951
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
952
|
+
resizeable: true
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
return acc;
|
|
956
|
+
}, {
|
|
957
|
+
grid: {}
|
|
958
|
+
});
|
|
959
|
+
};
|
|
960
|
+
var projectCellProps = (model, col, row) => {
|
|
961
|
+
const address = {
|
|
962
|
+
col,
|
|
963
|
+
row
|
|
964
|
+
};
|
|
965
|
+
const rawValue = model.getValue(address);
|
|
966
|
+
const ranges = model.sheet.ranges?.filter(({ range }) => inRange2(rangeFromIndex(model.sheet, range), address));
|
|
967
|
+
const threadRefs = void 0;
|
|
968
|
+
const description = model.getValueDescription(address);
|
|
969
|
+
const type = description?.type;
|
|
970
|
+
const format = description?.format;
|
|
971
|
+
const classNames = ranges?.map(cellClassNameForRange).reverse();
|
|
972
|
+
return {
|
|
973
|
+
value: parseValue({
|
|
974
|
+
type,
|
|
975
|
+
format,
|
|
976
|
+
value: rawValue
|
|
977
|
+
}),
|
|
978
|
+
className: mx(cellClassesForFieldType({
|
|
979
|
+
type,
|
|
980
|
+
format
|
|
981
|
+
}), threadRefs && commentedClassName, classNames),
|
|
982
|
+
dataRefs: threadRefs
|
|
983
|
+
};
|
|
984
|
+
};
|
|
985
|
+
var gridCellGetter = (model) => {
|
|
986
|
+
const cachedGridCells = {};
|
|
987
|
+
return (nextBounds) => {
|
|
988
|
+
[
|
|
989
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
990
|
+
].forEach((_, c0) => {
|
|
991
|
+
return [
|
|
992
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
993
|
+
].forEach((_2, r0) => {
|
|
994
|
+
const col = nextBounds.start.col + c0;
|
|
995
|
+
const row = nextBounds.start.row + r0;
|
|
996
|
+
cachedGridCells[`${col},${row}`] = projectCellProps(model, col, row);
|
|
997
|
+
});
|
|
998
|
+
});
|
|
999
|
+
return cachedGridCells;
|
|
1000
|
+
};
|
|
1001
|
+
};
|
|
1002
|
+
var rowLabelCell = (row) => ({
|
|
1003
|
+
value: rowToA1Notation(row),
|
|
1004
|
+
className: "!bg-toolbarSurface text-subdued text-end pie-1",
|
|
1005
|
+
resizeHandle: "row"
|
|
1006
|
+
});
|
|
1007
|
+
var colLabelCell = (col) => ({
|
|
1008
|
+
value: colToA1Notation(col),
|
|
1009
|
+
className: "!bg-toolbarSurface text-subdued",
|
|
1010
|
+
resizeHandle: "col"
|
|
1011
|
+
});
|
|
1012
|
+
var cellGetter = (model) => {
|
|
1013
|
+
const getGridCells = gridCellGetter(model);
|
|
1014
|
+
return (nextBounds, plane) => {
|
|
1015
|
+
switch (plane) {
|
|
1016
|
+
case "grid":
|
|
1017
|
+
return getGridCells(nextBounds);
|
|
1018
|
+
case "fixedStartStart": {
|
|
1019
|
+
return {
|
|
1020
|
+
"0,0": {
|
|
1021
|
+
className: "!bg-toolbarSurface"
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
case "frozenColsStart":
|
|
1026
|
+
return [
|
|
1027
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
1028
|
+
].reduce((acc, _, r0) => {
|
|
1029
|
+
const r = nextBounds.start.row + r0;
|
|
1030
|
+
acc[`0,${r}`] = rowLabelCell(r);
|
|
1031
|
+
return acc;
|
|
1032
|
+
}, {});
|
|
1033
|
+
case "frozenRowsStart":
|
|
1034
|
+
return [
|
|
1035
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
1036
|
+
].reduce((acc, _, c0) => {
|
|
1037
|
+
const c = nextBounds.start.col + c0;
|
|
1038
|
+
acc[`${c},0`] = colLabelCell(c);
|
|
1039
|
+
return acc;
|
|
1040
|
+
}, {});
|
|
1041
|
+
default:
|
|
1042
|
+
return {};
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1046
|
+
var useSheetModelDxGridProps = (dxGrid, model) => {
|
|
1047
|
+
const [columns, setColumns] = useState3(createDxGridColumns(model));
|
|
1048
|
+
const [rows, setRows] = useState3(createDxGridRows(model));
|
|
1049
|
+
useEffect3(() => {
|
|
1050
|
+
const cellsAccessor = createDocAccessor(model.sheet, [
|
|
1051
|
+
"cells"
|
|
1052
|
+
]);
|
|
1053
|
+
if (dxGrid) {
|
|
1054
|
+
dxGrid.getCells = cellGetter(model);
|
|
1055
|
+
}
|
|
1056
|
+
const handleCellsUpdate = () => {
|
|
1057
|
+
dxGrid?.requestUpdate("initialCells");
|
|
1058
|
+
};
|
|
1059
|
+
cellsAccessor.handle.addListener("change", handleCellsUpdate);
|
|
1060
|
+
const unsubscribe = model.graph.update.on(handleCellsUpdate);
|
|
1061
|
+
return () => {
|
|
1062
|
+
cellsAccessor.handle.removeListener("change", handleCellsUpdate);
|
|
1063
|
+
unsubscribe();
|
|
1064
|
+
};
|
|
1065
|
+
}, [
|
|
1066
|
+
model,
|
|
1067
|
+
dxGrid
|
|
1068
|
+
]);
|
|
1069
|
+
useEffect3(() => {
|
|
1070
|
+
const columnMetaAccessor = createDocAccessor(model.sheet, [
|
|
1071
|
+
"columnMeta"
|
|
1072
|
+
]);
|
|
1073
|
+
const rowMetaAccessor = createDocAccessor(model.sheet, [
|
|
1074
|
+
"rowMeta"
|
|
1075
|
+
]);
|
|
1076
|
+
const handleColumnMetaUpdate = () => {
|
|
1077
|
+
setColumns(createDxGridColumns(model));
|
|
1078
|
+
};
|
|
1079
|
+
const handleRowMetaUpdate = () => {
|
|
1080
|
+
setRows(createDxGridRows(model));
|
|
1081
|
+
};
|
|
1082
|
+
columnMetaAccessor.handle.addListener("change", handleColumnMetaUpdate);
|
|
1083
|
+
rowMetaAccessor.handle.addListener("change", handleRowMetaUpdate);
|
|
1084
|
+
return () => {
|
|
1085
|
+
columnMetaAccessor.handle.removeListener("change", handleColumnMetaUpdate);
|
|
1086
|
+
rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
|
|
1087
|
+
};
|
|
1088
|
+
}, [
|
|
1089
|
+
model,
|
|
1090
|
+
dxGrid
|
|
1091
|
+
]);
|
|
1092
|
+
return {
|
|
1093
|
+
columns,
|
|
1094
|
+
rows
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// src/components/GridSheet/GridSheet.tsx
|
|
1099
|
+
var inertPosition = {
|
|
1100
|
+
plane: "grid",
|
|
1101
|
+
col: 0,
|
|
1102
|
+
row: 0
|
|
1103
|
+
};
|
|
1104
|
+
var initialCells = {
|
|
1105
|
+
grid: {},
|
|
1106
|
+
frozenColsStart: [
|
|
1107
|
+
...Array(64)
|
|
1108
|
+
].reduce((acc, _, i) => {
|
|
1109
|
+
acc[`0,${i}`] = rowLabelCell(i);
|
|
1110
|
+
return acc;
|
|
1111
|
+
}, {}),
|
|
1112
|
+
frozenRowsStart: [
|
|
1113
|
+
...Array(12)
|
|
1114
|
+
].reduce((acc, _, i) => {
|
|
1115
|
+
acc[`${i},0`] = colLabelCell(i);
|
|
1116
|
+
return acc;
|
|
1117
|
+
}, {})
|
|
1118
|
+
};
|
|
1119
|
+
var frozen = {
|
|
1120
|
+
frozenColsStart: 1,
|
|
1121
|
+
frozenRowsStart: 1
|
|
1122
|
+
};
|
|
1123
|
+
var sheetColDefault = {
|
|
1124
|
+
frozenColsStart: {
|
|
1125
|
+
size: 48,
|
|
1126
|
+
readonly: true,
|
|
1127
|
+
focusUnfurl: false
|
|
1128
|
+
},
|
|
1129
|
+
grid: {
|
|
1130
|
+
size: defaultColSize,
|
|
1131
|
+
resizeable: true
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
var sheetRowDefault = {
|
|
1135
|
+
frozenRowsStart: {
|
|
1136
|
+
size: defaultRowSize,
|
|
1137
|
+
readonly: true,
|
|
1138
|
+
focusUnfurl: false
|
|
1139
|
+
},
|
|
1140
|
+
grid: {
|
|
1141
|
+
size: defaultRowSize,
|
|
1142
|
+
resizeable: true
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
var GridSheet = () => {
|
|
1146
|
+
const { t } = useTranslation2(meta.id);
|
|
1147
|
+
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } = useSheetContext();
|
|
1148
|
+
const [dxGrid, setDxGrid] = useState4(null);
|
|
1149
|
+
const [extraplanarFocus, setExtraplanarFocus] = useState4(null);
|
|
1150
|
+
const { invokePromise } = useOperationInvoker2();
|
|
1151
|
+
const rangeController = useRef(null);
|
|
1152
|
+
const { hasAttention } = useAttention(id);
|
|
1153
|
+
const handleFocus = useCallback4((event) => {
|
|
1154
|
+
if (!editing) {
|
|
1155
|
+
const cell = closestCell(event.target);
|
|
1156
|
+
if (cell) {
|
|
1157
|
+
if (cell.plane === "grid") {
|
|
1158
|
+
setCursor({
|
|
1159
|
+
col: cell.col,
|
|
1160
|
+
row: cell.row
|
|
1161
|
+
});
|
|
1162
|
+
setExtraplanarFocus(null);
|
|
1163
|
+
} else {
|
|
1164
|
+
setExtraplanarFocus(cell);
|
|
1165
|
+
}
|
|
1166
|
+
} else {
|
|
1167
|
+
setExtraplanarFocus(null);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}, [
|
|
1171
|
+
editing
|
|
1172
|
+
]);
|
|
1173
|
+
const handleClose = useCallback4((_value, event) => {
|
|
1174
|
+
if (event) {
|
|
1175
|
+
const { key, shift } = event;
|
|
1176
|
+
const axis = [
|
|
1177
|
+
"Enter",
|
|
1178
|
+
"ArrowUp",
|
|
1179
|
+
"ArrowDown"
|
|
1180
|
+
].includes(key) ? "row" : [
|
|
1181
|
+
"Tab",
|
|
1182
|
+
"ArrowLeft",
|
|
1183
|
+
"ArrowRight"
|
|
1184
|
+
].includes(key) ? "col" : void 0;
|
|
1185
|
+
const delta = key.startsWith("Arrow") ? [
|
|
1186
|
+
"ArrowUp",
|
|
1187
|
+
"ArrowLeft"
|
|
1188
|
+
].includes(key) ? -1 : 1 : shift ? -1 : 1;
|
|
1189
|
+
dxGrid?.refocus(axis, delta);
|
|
1190
|
+
}
|
|
1191
|
+
}, [
|
|
1192
|
+
model,
|
|
1193
|
+
editing,
|
|
1194
|
+
dxGrid
|
|
1195
|
+
]);
|
|
1196
|
+
const handleBlur = useCallback4((value) => {
|
|
1197
|
+
if (value !== void 0) {
|
|
1198
|
+
model.setValue(parseCellIndex(editing.index), value);
|
|
1199
|
+
}
|
|
1200
|
+
}, [
|
|
1201
|
+
model,
|
|
1202
|
+
editing
|
|
1203
|
+
]);
|
|
1204
|
+
const handleAxisResize = useCallback4(({ axis, size, index: numericIndex }) => {
|
|
1205
|
+
Obj5.change(model.sheet, (sheet) => {
|
|
1206
|
+
if (axis === "row") {
|
|
1207
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
1208
|
+
sheet.rowMeta[rowId] ??= {};
|
|
1209
|
+
sheet.rowMeta[rowId].size = size;
|
|
1210
|
+
} else {
|
|
1211
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
1212
|
+
sheet.columnMeta[columnId] ??= {};
|
|
1213
|
+
sheet.columnMeta[columnId].size = size;
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
}, [
|
|
1217
|
+
model
|
|
1218
|
+
]);
|
|
1219
|
+
const handleSelect = useCallback4(({ minCol, maxCol, minRow, maxRow }) => {
|
|
1220
|
+
const range = {
|
|
1221
|
+
from: {
|
|
1222
|
+
col: minCol,
|
|
1223
|
+
row: minRow
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
if (minCol !== maxCol || minRow !== maxRow) {
|
|
1227
|
+
range.to = {
|
|
1228
|
+
col: maxCol,
|
|
1229
|
+
row: maxRow
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
if (editing) {
|
|
1233
|
+
rangeController.current?.setRange(rangeToA1Notation2(range));
|
|
1234
|
+
} else {
|
|
1235
|
+
setRange(range.to ? range : void 0);
|
|
1236
|
+
}
|
|
1237
|
+
}, [
|
|
1238
|
+
editing
|
|
1239
|
+
]);
|
|
1240
|
+
const handleWheel = useCallback4((event) => {
|
|
1241
|
+
if (!ignoreAttention && !hasAttention) {
|
|
1242
|
+
event.stopPropagation();
|
|
1243
|
+
}
|
|
1244
|
+
}, [
|
|
1245
|
+
hasAttention,
|
|
1246
|
+
ignoreAttention
|
|
1247
|
+
]);
|
|
1248
|
+
const selectEntireAxis = useCallback4((pos) => {
|
|
1249
|
+
switch (pos.plane) {
|
|
1250
|
+
case "frozenRowsStart":
|
|
1251
|
+
return dxGrid?.setSelection({
|
|
1252
|
+
start: {
|
|
1253
|
+
col: pos.col,
|
|
1254
|
+
row: 0,
|
|
1255
|
+
plane: "grid"
|
|
1256
|
+
},
|
|
1257
|
+
end: {
|
|
1258
|
+
col: pos.col,
|
|
1259
|
+
row: model.sheet.rows.length - 1,
|
|
1260
|
+
plane: "grid"
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
case "frozenColsStart":
|
|
1264
|
+
return dxGrid?.setSelection({
|
|
1265
|
+
start: {
|
|
1266
|
+
row: pos.row,
|
|
1267
|
+
col: 0,
|
|
1268
|
+
plane: "grid"
|
|
1269
|
+
},
|
|
1270
|
+
end: {
|
|
1271
|
+
row: pos.row,
|
|
1272
|
+
col: model.sheet.columns.length - 1,
|
|
1273
|
+
plane: "grid"
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}, [
|
|
1278
|
+
dxGrid,
|
|
1279
|
+
model.sheet
|
|
1280
|
+
]);
|
|
1281
|
+
const handleClick = useCallback4((event) => {
|
|
1282
|
+
const cell = closestCell(event.target);
|
|
1283
|
+
if (cell) {
|
|
1284
|
+
selectEntireAxis(cell);
|
|
1285
|
+
}
|
|
1286
|
+
}, [
|
|
1287
|
+
selectEntireAxis
|
|
1288
|
+
]);
|
|
1289
|
+
const handleKeyDown = useCallback4((event) => {
|
|
1290
|
+
switch (event.key) {
|
|
1291
|
+
case "Backspace":
|
|
1292
|
+
case "Delete":
|
|
1293
|
+
event.preventDefault();
|
|
1294
|
+
return cursorFallbackRange && model.clear(cursorFallbackRange);
|
|
1295
|
+
case "Enter":
|
|
1296
|
+
case "Space":
|
|
1297
|
+
if (dxGrid && extraplanarFocus) {
|
|
1298
|
+
switch (extraplanarFocus.plane) {
|
|
1299
|
+
case "frozenRowsStart":
|
|
1300
|
+
case "frozenColsStart":
|
|
1301
|
+
event.preventDefault();
|
|
1302
|
+
return selectEntireAxis(extraplanarFocus);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
if (event.metaKey || event.ctrlKey) {
|
|
1307
|
+
switch (event.key) {
|
|
1308
|
+
case "x":
|
|
1309
|
+
case "X":
|
|
1310
|
+
event.preventDefault();
|
|
1311
|
+
return cursorFallbackRange && model.cut(cursorFallbackRange);
|
|
1312
|
+
case "c":
|
|
1313
|
+
case "C":
|
|
1314
|
+
event.preventDefault();
|
|
1315
|
+
return cursorFallbackRange && model.copy(cursorFallbackRange);
|
|
1316
|
+
case "v":
|
|
1317
|
+
case "V":
|
|
1318
|
+
event.preventDefault();
|
|
1319
|
+
return cursor && model.paste(cursor);
|
|
1320
|
+
case "z":
|
|
1321
|
+
event.preventDefault();
|
|
1322
|
+
return event.shiftKey ? model.redo() : model.undo();
|
|
1323
|
+
case "Z":
|
|
1324
|
+
case "y":
|
|
1325
|
+
event.preventDefault();
|
|
1326
|
+
return model.redo();
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}, [
|
|
1330
|
+
cursorFallbackRange,
|
|
1331
|
+
model,
|
|
1332
|
+
cursor,
|
|
1333
|
+
extraplanarFocus,
|
|
1334
|
+
selectEntireAxis
|
|
1335
|
+
]);
|
|
1336
|
+
const contextMenuAnchorRef = useRef(null);
|
|
1337
|
+
const [contextMenuOpen, setContextMenuOpen] = useState4(null);
|
|
1338
|
+
const contextMenuAxis = contextMenuOpen?.plane.startsWith("frozenRows") ? "col" : "row";
|
|
1339
|
+
const handleContextMenu = useCallback4((event) => {
|
|
1340
|
+
const cell = closestCell(event.target);
|
|
1341
|
+
if (cell && cell.plane.startsWith("frozen")) {
|
|
1342
|
+
event.preventDefault();
|
|
1343
|
+
contextMenuAnchorRef.current = event.target;
|
|
1344
|
+
setContextMenuOpen(cell);
|
|
1345
|
+
}
|
|
1346
|
+
}, []);
|
|
1347
|
+
const handleAxisMenuAction = useCallback4((operation) => {
|
|
1348
|
+
switch (operation) {
|
|
1349
|
+
case "insert-before":
|
|
1350
|
+
case "insert-after":
|
|
1351
|
+
return invokePromise(SheetOperation.InsertAxis, {
|
|
1352
|
+
model,
|
|
1353
|
+
axis: contextMenuAxis,
|
|
1354
|
+
index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
|
|
1355
|
+
});
|
|
1356
|
+
case "drop":
|
|
1357
|
+
return invokePromise(SheetOperation.DropAxis, {
|
|
1358
|
+
model,
|
|
1359
|
+
axis: contextMenuAxis,
|
|
1360
|
+
axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
}, [
|
|
1364
|
+
contextMenuAxis,
|
|
1365
|
+
contextMenuOpen,
|
|
1366
|
+
model,
|
|
1367
|
+
invokePromise
|
|
1368
|
+
]);
|
|
1369
|
+
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
1370
|
+
const extensions = useMemo2(() => [
|
|
1371
|
+
editorKeys({
|
|
1372
|
+
onClose: handleClose,
|
|
1373
|
+
...editing?.initialContent && {
|
|
1374
|
+
onNav: handleClose
|
|
1375
|
+
}
|
|
1376
|
+
}),
|
|
1377
|
+
sheetExtension({
|
|
1378
|
+
functions: model.graph.getFunctions()
|
|
1379
|
+
}),
|
|
1380
|
+
rangeExtension({
|
|
1381
|
+
onInit: (fn) => rangeController.current = fn,
|
|
1382
|
+
onStateChange: (state) => {
|
|
1383
|
+
if (dxGrid) {
|
|
1384
|
+
dxGrid.mode = typeof state.activeRange === "undefined" ? "edit" : "edit-select";
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
})
|
|
1388
|
+
], [
|
|
1389
|
+
model,
|
|
1390
|
+
handleClose,
|
|
1391
|
+
editing
|
|
1392
|
+
]);
|
|
1393
|
+
const getCellContent = useCallback4((index) => {
|
|
1394
|
+
return model.getCellText(parseCellIndex(index));
|
|
1395
|
+
}, [
|
|
1396
|
+
model
|
|
1397
|
+
]);
|
|
1398
|
+
useUpdateFocusedCellOnThreadSelection(dxGrid);
|
|
1399
|
+
useSelectThreadOnCellFocus();
|
|
1400
|
+
return (
|
|
1401
|
+
// TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
|
|
1402
|
+
/* @__PURE__ */ React4.createElement("div", {
|
|
1403
|
+
role: "none",
|
|
1404
|
+
className: "relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent"
|
|
1405
|
+
}, /* @__PURE__ */ React4.createElement(GridCellEditor, {
|
|
1406
|
+
getCellContent,
|
|
1407
|
+
extensions,
|
|
1408
|
+
onBlur: handleBlur
|
|
1409
|
+
}), /* @__PURE__ */ React4.createElement(Grid2.Content, {
|
|
1410
|
+
initialCells,
|
|
1411
|
+
limitColumns: DEFAULT_COLS,
|
|
1412
|
+
limitRows: DEFAULT_ROWS,
|
|
1413
|
+
columns,
|
|
1414
|
+
rows,
|
|
1415
|
+
// TODO(burdon): `col` vs. `column`?
|
|
1416
|
+
columnDefault: sheetColDefault,
|
|
1417
|
+
rowDefault: sheetRowDefault,
|
|
1418
|
+
frozen,
|
|
1419
|
+
onAxisResize: handleAxisResize,
|
|
1420
|
+
onSelect: handleSelect,
|
|
1421
|
+
onFocus: handleFocus,
|
|
1422
|
+
onWheelCapture: handleWheel,
|
|
1423
|
+
onKeyDown: handleKeyDown,
|
|
1424
|
+
onContextMenu: handleContextMenu,
|
|
1425
|
+
onClick: handleClick,
|
|
1426
|
+
overscroll: "trap",
|
|
1427
|
+
className: "[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0",
|
|
1428
|
+
activeRefs,
|
|
1429
|
+
ref: setDxGrid
|
|
1430
|
+
}), /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
|
|
1431
|
+
modal: false,
|
|
1432
|
+
open: !!contextMenuOpen,
|
|
1433
|
+
onOpenChange: (nextOpen) => setContextMenuOpen(nextOpen ? inertPosition : null)
|
|
1434
|
+
}, /* @__PURE__ */ React4.createElement(DropdownMenu.VirtualTrigger, {
|
|
1435
|
+
virtualRef: contextMenuAnchorRef
|
|
1436
|
+
}), /* @__PURE__ */ React4.createElement(DropdownMenu.Content, {
|
|
1437
|
+
side: contextMenuAxis === "col" ? "bottom" : "right",
|
|
1438
|
+
sideOffset: 4,
|
|
1439
|
+
collisionPadding: 8
|
|
1440
|
+
}, /* @__PURE__ */ React4.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
|
|
1441
|
+
onClick: () => handleAxisMenuAction("insert-before"),
|
|
1442
|
+
"data-testid": `grid.${contextMenuAxis}.insert-before`
|
|
1443
|
+
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
1444
|
+
size: 5,
|
|
1445
|
+
icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
|
|
1446
|
+
}), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
|
|
1447
|
+
onClick: () => handleAxisMenuAction("insert-after"),
|
|
1448
|
+
"data-testid": `grid.${contextMenuAxis}.insert-after`
|
|
1449
|
+
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
1450
|
+
size: 5,
|
|
1451
|
+
icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
|
|
1452
|
+
}), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
|
|
1453
|
+
onClick: () => handleAxisMenuAction("drop"),
|
|
1454
|
+
"data-testid": `grid.${contextMenuAxis}.drop`
|
|
1455
|
+
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
1456
|
+
size: 5,
|
|
1457
|
+
icon: "ph--backspace--regular"
|
|
1458
|
+
}), /* @__PURE__ */ React4.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ React4.createElement(DropdownMenu.Arrow, null))))
|
|
1459
|
+
);
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
// src/components/index.ts
|
|
1463
|
+
var SheetContainer = lazy(() => import("./SheetContainer-7H5R7M54.mjs"));
|
|
1464
|
+
|
|
1465
|
+
export {
|
|
1466
|
+
ComputeGraphContextProvider,
|
|
1467
|
+
useComputeGraph,
|
|
1468
|
+
useSheetContext,
|
|
1469
|
+
SheetProvider,
|
|
1470
|
+
GridSheet,
|
|
1471
|
+
RangeList,
|
|
1472
|
+
SheetContainer
|
|
1473
|
+
};
|
|
1474
|
+
//# sourceMappingURL=chunk-AYSEWH7N.mjs.map
|