@dxos/plugin-sheet 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b
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/{chunk-EDWHV64N.mjs → SheetContainer-I3NFVVDQ.mjs} +535 -203
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-AMMLA66W.mjs → anchor-sort-DZ3IHHJJ.mjs} +2 -2
- package/dist/lib/browser/{chunk-IFLWVS2V.mjs → chunk-NNWF7EKC.mjs} +10 -10
- package/dist/lib/browser/{chunk-IFLWVS2V.mjs.map → chunk-NNWF7EKC.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-KE3AKN5W.mjs → chunk-S445OQGW.mjs} +5 -5
- package/dist/lib/browser/{chunk-KE3AKN5W.mjs.map → chunk-S445OQGW.mjs.map} +3 -3
- package/dist/lib/browser/{compute-graph-registry-RC5L7RE4.mjs → compute-graph-registry-W6HO2G3P.mjs} +2 -2
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/{markdown-D2T2DOVX.mjs → markdown-S6GVLHB4.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-P2RX75DA.mjs → operation-resolver-Z4X4UWNR.mjs} +4 -4
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-45CRAB5G.mjs → react-surface-KIU6DGKW.mjs} +13 -13
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- 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/{chunk-AYSEWH7N.mjs → SheetContainer-KUXNCSFP.mjs} +535 -203
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-VHMBRX2E.mjs → anchor-sort-24OXMOSX.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-PPOYR7DK.mjs → chunk-M52YLLWU.mjs} +10 -10
- package/dist/lib/node-esm/{chunk-PPOYR7DK.mjs.map → chunk-M52YLLWU.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-6J5L47IB.mjs → chunk-NKZ3O4OR.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-6J5L47IB.mjs.map → chunk-NKZ3O4OR.mjs.map} +3 -3
- package/dist/lib/node-esm/{compute-graph-registry-ZGXVLVGD.mjs → compute-graph-registry-2C3Y2RPQ.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/{markdown-PTV72DLO.mjs → markdown-YT5KJTQT.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-WPIWQ5IO.mjs → operation-resolver-7VD2YXSQ.mjs} +4 -4
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-ITV2L6HK.mjs → react-surface-7FZAE3S7.mjs} +13 -13
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +1 -1
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +1 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.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.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/{GridSheet/GridSheet.stories.d.ts → SheetContent/SheetContent.stories.d.ts} +2 -2
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +4 -4
- 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 -3
- package/dist/types/src/components/SheetToolbar/SheetToolbar.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.map +1 -1
- package/dist/types/src/containers/RangeList/index.d.ts +3 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/SheetContainer.stories.d.ts +1 -2
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/types/Sheet.d.ts +1 -1
- package/dist/types/src/types/types.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -57
- package/src/capabilities/operation-resolver/operation-resolver.ts +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +7 -4
- package/src/components/ComputeGraph/compute-graph.stories.tsx +1 -1
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +1 -1
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +11 -10
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +12 -9
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +3 -3
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +36 -34
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +11 -6
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +10 -9
- package/src/components/SheetToolbar/align.ts +3 -3
- package/src/components/SheetToolbar/style.ts +3 -3
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +7 -5
- package/src/containers/RangeList/index.ts +7 -0
- package/src/{components → containers}/SheetContainer/SheetContainer.stories.tsx +11 -30
- 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 +11 -10
- package/src/extensions/editor/sheet-extension.ts +10 -10
- package/src/integrations/thread-ranges.ts +0 -1
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +1 -1
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +1 -1
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs +0 -397
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs.map +0 -7
- package/dist/lib/browser/chunk-EDWHV64N.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-P2RX75DA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-45CRAB5G.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs +0 -398
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AYSEWH7N.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-WPIWQ5IO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ITV2L6HK.mjs.map +0 -7
- 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.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/index.d.ts +0 -2
- package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -10
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/src/components/SheetContainer/SheetContainer.tsx +0 -48
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/lib/browser/{anchor-sort-AMMLA66W.mjs.map → anchor-sort-DZ3IHHJJ.mjs.map} +0 -0
- /package/dist/lib/browser/{compute-graph-registry-RC5L7RE4.mjs.map → compute-graph-registry-W6HO2G3P.mjs.map} +0 -0
- /package/dist/lib/browser/{markdown-D2T2DOVX.mjs.map → markdown-S6GVLHB4.mjs.map} +0 -0
- /package/dist/lib/node-esm/{anchor-sort-VHMBRX2E.mjs.map → anchor-sort-24OXMOSX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compute-graph-registry-ZGXVLVGD.mjs.map → compute-graph-registry-2C3Y2RPQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{markdown-PTV72DLO.mjs.map → markdown-YT5KJTQT.mjs.map} +0 -0
- /package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +0 -0
- /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
- /package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rangeExtension,
|
|
3
3
|
sheetExtension
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NNWF7EKC.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_COLS,
|
|
7
7
|
DEFAULT_ROWS,
|
|
@@ -9,17 +9,23 @@ import {
|
|
|
9
9
|
MAX_ROWS,
|
|
10
10
|
ReadonlyException,
|
|
11
11
|
SheetOperation,
|
|
12
|
-
Sheet_exports,
|
|
13
12
|
addressFromIndex,
|
|
14
13
|
addressToIndex,
|
|
14
|
+
alignKey,
|
|
15
15
|
cellClassNameForRange,
|
|
16
16
|
initialize,
|
|
17
17
|
insertIndices,
|
|
18
18
|
mapFormulaIndicesToRefs,
|
|
19
19
|
mapFormulaRefsToIndices,
|
|
20
20
|
meta,
|
|
21
|
-
rangeFromIndex
|
|
22
|
-
|
|
21
|
+
rangeFromIndex,
|
|
22
|
+
rangeToIndex
|
|
23
|
+
} from "./chunk-S445OQGW.mjs";
|
|
24
|
+
|
|
25
|
+
// src/containers/SheetContainer/SheetContainer.tsx
|
|
26
|
+
import React6 from "react";
|
|
27
|
+
import { Obj as Obj7 } from "@dxos/echo";
|
|
28
|
+
import { Panel } from "@dxos/react-ui";
|
|
23
29
|
|
|
24
30
|
// src/components/ComputeGraph/ComputeGraphContextProvider.tsx
|
|
25
31
|
import React, { createContext, useContext } from "react";
|
|
@@ -48,70 +54,25 @@ var useComputeGraph = (space) => {
|
|
|
48
54
|
return graph;
|
|
49
55
|
};
|
|
50
56
|
|
|
51
|
-
// src/components/
|
|
52
|
-
import
|
|
53
|
-
import React2, { useCallback } from "react";
|
|
54
|
-
import { rangeToA1Notation } from "@dxos/compute";
|
|
55
|
-
import { Obj } from "@dxos/echo";
|
|
56
|
-
import { Callout, useTranslation } from "@dxos/react-ui";
|
|
57
|
-
import { List } from "@dxos/react-ui-list";
|
|
58
|
-
import { ghostHover } from "@dxos/ui-theme";
|
|
59
|
-
var RangeList = ({ sheet }) => {
|
|
60
|
-
const { t } = useTranslation(meta.id);
|
|
61
|
-
const handleSelectRange = (range) => {
|
|
62
|
-
};
|
|
63
|
-
const handleDeleteRange = useCallback((range) => {
|
|
64
|
-
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
65
|
-
Obj.change(sheet, (obj) => {
|
|
66
|
-
obj.ranges.splice(index, 1);
|
|
67
|
-
});
|
|
68
|
-
}, [
|
|
69
|
-
sheet
|
|
70
|
-
]);
|
|
71
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
|
|
72
|
-
className: "mbs-cardSpacingBlock mbe-labelSpacingBlock text-sm font-semibold"
|
|
73
|
-
}, 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, {
|
|
74
|
-
items: sheet.ranges,
|
|
75
|
-
isItem: Schema.is(Sheet_exports.Range)
|
|
76
|
-
}, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ React2.createElement(List.Item, {
|
|
77
|
-
key: i,
|
|
78
|
-
item: range,
|
|
79
|
-
classNames: [
|
|
80
|
-
"p-2",
|
|
81
|
-
ghostHover
|
|
82
|
-
]
|
|
83
|
-
}, /* @__PURE__ */ React2.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React2.createElement(List.ItemTitle, {
|
|
84
|
-
onClick: () => handleSelectRange(range)
|
|
85
|
-
}, t("range title", {
|
|
86
|
-
position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),
|
|
87
|
-
key: t(`range key ${range.key} label`),
|
|
88
|
-
value: t(`range value ${range.value} label`)
|
|
89
|
-
})), /* @__PURE__ */ React2.createElement(List.ItemDeleteButton, {
|
|
90
|
-
onClick: () => handleDeleteRange(range)
|
|
91
|
-
})))));
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// src/components/index.ts
|
|
95
|
-
import { lazy } from "react";
|
|
96
|
-
|
|
97
|
-
// src/components/GridSheet/GridSheet.tsx
|
|
98
|
-
import React4, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState4 } from "react";
|
|
57
|
+
// src/components/SheetContent/SheetContent.tsx
|
|
58
|
+
import React3, { useCallback as useCallback3, useMemo as useMemo2, useRef, useState as useState4 } from "react";
|
|
99
59
|
import { useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
|
|
100
|
-
import { rangeToA1Notation
|
|
101
|
-
import { Obj as
|
|
60
|
+
import { rangeToA1Notation } from "@dxos/compute";
|
|
61
|
+
import { Obj as Obj4 } from "@dxos/echo";
|
|
102
62
|
import { defaultColSize, defaultRowSize } from "@dxos/lit-grid";
|
|
103
|
-
import { DropdownMenu, Icon, useTranslation
|
|
63
|
+
import { DropdownMenu, Icon, useTranslation } from "@dxos/react-ui";
|
|
104
64
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
105
65
|
import { Grid as Grid2, GridCellEditor, closestCell, editorKeys, parseCellIndex } from "@dxos/react-ui-grid";
|
|
66
|
+
import { mx as mx2, useComposableProps } from "@dxos/ui-theme";
|
|
106
67
|
|
|
107
68
|
// src/integrations/thread-ranges.ts
|
|
108
69
|
import * as Effect from "effect/Effect";
|
|
109
|
-
import { useCallback
|
|
70
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
110
71
|
import { useOperationInvoker, useOperationResolver } from "@dxos/app-framework/ui";
|
|
111
72
|
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
112
73
|
import { debounce } from "@dxos/async";
|
|
113
74
|
import { inRange } from "@dxos/compute";
|
|
114
|
-
import { Obj
|
|
75
|
+
import { Obj, Relation } from "@dxos/echo";
|
|
115
76
|
import { OperationResolver } from "@dxos/operation";
|
|
116
77
|
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from "@dxos/plugin-deck/types";
|
|
117
78
|
import { ThreadOperation } from "@dxos/plugin-thread/types";
|
|
@@ -137,7 +98,7 @@ var parseThreadAnchorAsCellRange = (cursor) => {
|
|
|
137
98
|
};
|
|
138
99
|
var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
139
100
|
const { model, setActiveRefs } = useSheetContext();
|
|
140
|
-
const sheetId =
|
|
101
|
+
const sheetId = Obj.getDXN(model.sheet).toString();
|
|
141
102
|
const scrollIntoViewHandler = useMemo(() => OperationResolver.make({
|
|
142
103
|
operation: LayoutOperation.ScrollIntoView,
|
|
143
104
|
position: "hoist",
|
|
@@ -163,15 +124,15 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
|
163
124
|
var useSelectThreadOnCellFocus = () => {
|
|
164
125
|
const { model, cursor } = useSheetContext();
|
|
165
126
|
const { invokePromise } = useOperationInvoker();
|
|
166
|
-
const db =
|
|
127
|
+
const db = Obj.getDatabase(model.sheet);
|
|
167
128
|
const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
168
|
-
const selectClosestThread =
|
|
129
|
+
const selectClosestThread = useCallback((cellAddress) => {
|
|
169
130
|
if (!cellAddress) {
|
|
170
131
|
return;
|
|
171
132
|
}
|
|
172
133
|
const closestThread = anchors.find((anchor) => {
|
|
173
134
|
const source = Relation.getSource(anchor);
|
|
174
|
-
if (anchor.anchor &&
|
|
135
|
+
if (anchor.anchor && Obj.instanceOf(Thread.Thread, source)) {
|
|
175
136
|
const range = parseThreadAnchorAsCellRange(anchor.anchor);
|
|
176
137
|
return range ? inRange(range, cellAddress) : false;
|
|
177
138
|
} else {
|
|
@@ -179,13 +140,12 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
179
140
|
}
|
|
180
141
|
});
|
|
181
142
|
if (closestThread) {
|
|
182
|
-
const primary =
|
|
143
|
+
const primary = Obj.getDXN(model.sheet).toString();
|
|
183
144
|
void (async () => {
|
|
184
145
|
await invokePromise(ThreadOperation.Select, {
|
|
185
146
|
current: Relation.getDXN(closestThread).toString()
|
|
186
147
|
});
|
|
187
148
|
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
188
|
-
primary,
|
|
189
149
|
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`
|
|
190
150
|
});
|
|
191
151
|
})();
|
|
@@ -210,17 +170,17 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
210
170
|
]);
|
|
211
171
|
};
|
|
212
172
|
|
|
213
|
-
// src/components/
|
|
214
|
-
import
|
|
215
|
-
import {
|
|
216
|
-
import {
|
|
173
|
+
// src/components/SheetRoot/SheetRoot.tsx
|
|
174
|
+
import React2, { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useState as useState2 } from "react";
|
|
175
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
176
|
+
import { Obj as Obj3 } from "@dxos/echo";
|
|
217
177
|
import { Grid, useGridContext } from "@dxos/react-ui-grid";
|
|
218
178
|
|
|
219
179
|
// src/model/sheet-model.ts
|
|
220
180
|
import { Event } from "@dxos/async";
|
|
221
181
|
import { DetailedCellError, ExportedCellChange, addressFromA1Notation, addressToA1Notation, createSheetName, isFormula } from "@dxos/compute";
|
|
222
182
|
import { Resource } from "@dxos/context";
|
|
223
|
-
import { Obj as
|
|
183
|
+
import { Obj as Obj2 } from "@dxos/echo";
|
|
224
184
|
import { Format, TypeEnum } from "@dxos/echo/internal";
|
|
225
185
|
import { invariant } from "@dxos/invariant";
|
|
226
186
|
import { PublicKey } from "@dxos/keys";
|
|
@@ -308,7 +268,7 @@ var SheetModel = class extends Resource {
|
|
|
308
268
|
S: this,
|
|
309
269
|
C: (f, a) => f(...a)
|
|
310
270
|
});
|
|
311
|
-
|
|
271
|
+
Obj2.change(this._sheet, (obj) => {
|
|
312
272
|
initialize(obj);
|
|
313
273
|
});
|
|
314
274
|
this._graph.update.on((event) => {
|
|
@@ -317,7 +277,7 @@ var SheetModel = class extends Resource {
|
|
|
317
277
|
}
|
|
318
278
|
});
|
|
319
279
|
this._node = this._graph.getOrCreateNode(createSheetName({
|
|
320
|
-
type:
|
|
280
|
+
type: Obj2.getTypename(this._sheet),
|
|
321
281
|
id: this._sheet.id
|
|
322
282
|
}));
|
|
323
283
|
await this._node.open();
|
|
@@ -379,7 +339,7 @@ var SheetModel = class extends Resource {
|
|
|
379
339
|
}
|
|
380
340
|
insertRows(i, n = 1) {
|
|
381
341
|
let idx = [];
|
|
382
|
-
|
|
342
|
+
Obj2.change(this._sheet, (obj) => {
|
|
383
343
|
idx = insertIndices(obj.rows, i, n, MAX_ROWS);
|
|
384
344
|
});
|
|
385
345
|
this.reset();
|
|
@@ -387,7 +347,7 @@ var SheetModel = class extends Resource {
|
|
|
387
347
|
}
|
|
388
348
|
insertColumns(i, n = 1) {
|
|
389
349
|
let idx = [];
|
|
390
|
-
|
|
350
|
+
Obj2.change(this._sheet, (obj) => {
|
|
391
351
|
idx = insertIndices(obj.columns, i, n, MAX_COLS);
|
|
392
352
|
});
|
|
393
353
|
this.reset();
|
|
@@ -401,7 +361,7 @@ var SheetModel = class extends Resource {
|
|
|
401
361
|
const values = this.getCellValues(range).flat();
|
|
402
362
|
const index = this._sheet.rows.indexOf(rowIndex);
|
|
403
363
|
this.clear(range);
|
|
404
|
-
|
|
364
|
+
Obj2.change(this._sheet, (obj) => {
|
|
405
365
|
obj.rows.splice(index, 1);
|
|
406
366
|
delete obj.rowMeta[rowIndex];
|
|
407
367
|
});
|
|
@@ -422,7 +382,7 @@ var SheetModel = class extends Resource {
|
|
|
422
382
|
const values = this.getCellValues(range).flat();
|
|
423
383
|
const index = this._sheet.columns.indexOf(colIndex);
|
|
424
384
|
this.clear(range);
|
|
425
|
-
|
|
385
|
+
Obj2.change(this._sheet, (obj) => {
|
|
426
386
|
obj.columns.splice(index, 1);
|
|
427
387
|
delete obj.columnMeta[colIndex];
|
|
428
388
|
});
|
|
@@ -436,7 +396,7 @@ var SheetModel = class extends Resource {
|
|
|
436
396
|
};
|
|
437
397
|
}
|
|
438
398
|
restoreRow({ index, axisIndex, axisMeta, values }) {
|
|
439
|
-
|
|
399
|
+
Obj2.change(this._sheet, (obj) => {
|
|
440
400
|
obj.rows.splice(index, 0, axisIndex);
|
|
441
401
|
values.forEach((value, col) => {
|
|
442
402
|
if (value) {
|
|
@@ -452,7 +412,7 @@ var SheetModel = class extends Resource {
|
|
|
452
412
|
this.reset();
|
|
453
413
|
}
|
|
454
414
|
restoreColumn({ index, axisIndex, axisMeta, values }) {
|
|
455
|
-
|
|
415
|
+
Obj2.change(this._sheet, (obj) => {
|
|
456
416
|
obj.columns.splice(index, 0, axisIndex);
|
|
457
417
|
values.forEach((value, row) => {
|
|
458
418
|
if (value) {
|
|
@@ -487,7 +447,7 @@ var SheetModel = class extends Resource {
|
|
|
487
447
|
const topLeft = getTopLeft(range);
|
|
488
448
|
const values = this._iterRange(range, () => null);
|
|
489
449
|
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
490
|
-
|
|
450
|
+
Obj2.change(this._sheet, (obj) => {
|
|
491
451
|
this._iterRange(range, (cell) => {
|
|
492
452
|
const idx = addressToIndex(this._sheet, cell);
|
|
493
453
|
delete obj.cells[idx];
|
|
@@ -505,7 +465,7 @@ var SheetModel = class extends Resource {
|
|
|
505
465
|
]
|
|
506
466
|
});
|
|
507
467
|
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
508
|
-
|
|
468
|
+
Obj2.change(this._sheet, (obj) => {
|
|
509
469
|
this._iterRange(range, (cell) => {
|
|
510
470
|
const idx = addressToIndex(this._sheet, cell);
|
|
511
471
|
delete obj.cells[idx];
|
|
@@ -536,7 +496,7 @@ var SheetModel = class extends Resource {
|
|
|
536
496
|
});
|
|
537
497
|
if (!this._node.graph.hf.isClipboardEmpty()) {
|
|
538
498
|
const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
|
|
539
|
-
|
|
499
|
+
Obj2.change(this._sheet, (obj) => {
|
|
540
500
|
for (const change of changes) {
|
|
541
501
|
if (change instanceof ExportedCellChange) {
|
|
542
502
|
const { address, newValue } = change;
|
|
@@ -672,13 +632,13 @@ var SheetModel = class extends Resource {
|
|
|
672
632
|
}
|
|
673
633
|
let refresh = false;
|
|
674
634
|
if (cell.row >= this._sheet.rows.length) {
|
|
675
|
-
|
|
635
|
+
Obj2.change(this._sheet, (obj) => {
|
|
676
636
|
insertIndices(obj.rows, cell.row, 1, MAX_ROWS);
|
|
677
637
|
});
|
|
678
638
|
refresh = true;
|
|
679
639
|
}
|
|
680
640
|
if (cell.col >= this._sheet.columns.length) {
|
|
681
|
-
|
|
641
|
+
Obj2.change(this._sheet, (obj) => {
|
|
682
642
|
insertIndices(obj.columns, cell.col, 1, MAX_COLS);
|
|
683
643
|
});
|
|
684
644
|
refresh = true;
|
|
@@ -697,14 +657,14 @@ var SheetModel = class extends Resource {
|
|
|
697
657
|
]);
|
|
698
658
|
const idx = addressToIndex(this._sheet, cell);
|
|
699
659
|
if (value === void 0 || value === null) {
|
|
700
|
-
|
|
660
|
+
Obj2.change(this._sheet, (obj) => {
|
|
701
661
|
delete obj.cells[idx];
|
|
702
662
|
});
|
|
703
663
|
} else {
|
|
704
664
|
if (isFormula(value)) {
|
|
705
665
|
value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
|
|
706
666
|
}
|
|
707
|
-
|
|
667
|
+
Obj2.change(this._sheet, (obj) => {
|
|
708
668
|
obj.cells[idx] = {
|
|
709
669
|
value
|
|
710
670
|
};
|
|
@@ -851,21 +811,25 @@ var useSheetModel = (graph, sheet, { readonly } = {}) => {
|
|
|
851
811
|
return model;
|
|
852
812
|
};
|
|
853
813
|
|
|
854
|
-
// src/components/
|
|
855
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
|
|
814
|
+
// src/components/SheetRoot/SheetRoot.tsx
|
|
856
815
|
var SheetContext = /* @__PURE__ */ createContext2(void 0);
|
|
857
816
|
var useSheetContext = () => {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
A: [
|
|
864
|
-
"context",
|
|
865
|
-
""
|
|
866
|
-
]
|
|
817
|
+
return useContext2(SheetContext) ?? raise2(new Error("Missing SheetContext"));
|
|
818
|
+
};
|
|
819
|
+
var SheetRoot = ({ children, graph, sheet, readonly, ignoreAttention, onInfo }) => {
|
|
820
|
+
const model = useSheetModel(graph, sheet, {
|
|
821
|
+
readonly
|
|
867
822
|
});
|
|
868
|
-
|
|
823
|
+
if (!model) {
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
return /* @__PURE__ */ React2.createElement(Grid.Root, {
|
|
827
|
+
id: Obj3.getDXN(sheet).toString()
|
|
828
|
+
}, /* @__PURE__ */ React2.createElement(SheetProviderImpl, {
|
|
829
|
+
model,
|
|
830
|
+
onInfo,
|
|
831
|
+
ignoreAttention
|
|
832
|
+
}, children));
|
|
869
833
|
};
|
|
870
834
|
var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo }) => {
|
|
871
835
|
const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
|
|
@@ -873,7 +837,7 @@ var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo
|
|
|
873
837
|
const [range, setRangeInternal] = useState2();
|
|
874
838
|
const [cursorFallbackRange, setCursorFallbackRange] = useState2();
|
|
875
839
|
const [activeRefs, setActiveRefs] = useState2("");
|
|
876
|
-
const setCursor =
|
|
840
|
+
const setCursor = useCallback2((nextCursor) => {
|
|
877
841
|
setCursorInternal(nextCursor);
|
|
878
842
|
setCursorFallbackRange(range?.to ? range : nextCursor ? {
|
|
879
843
|
from: nextCursor,
|
|
@@ -882,7 +846,7 @@ var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo
|
|
|
882
846
|
}, [
|
|
883
847
|
range
|
|
884
848
|
]);
|
|
885
|
-
const setRange =
|
|
849
|
+
const setRange = useCallback2((nextRange) => {
|
|
886
850
|
setRangeInternal(nextRange);
|
|
887
851
|
setCursorFallbackRange(nextRange?.to ? nextRange : cursor ? {
|
|
888
852
|
from: cursor,
|
|
@@ -891,7 +855,7 @@ var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo
|
|
|
891
855
|
}, [
|
|
892
856
|
cursor
|
|
893
857
|
]);
|
|
894
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ React2.createElement(SheetContext.Provider, {
|
|
895
859
|
value: {
|
|
896
860
|
id,
|
|
897
861
|
model,
|
|
@@ -904,26 +868,14 @@ var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo
|
|
|
904
868
|
cursorFallbackRange,
|
|
905
869
|
activeRefs,
|
|
906
870
|
setActiveRefs,
|
|
871
|
+
ignoreAttention,
|
|
907
872
|
// TODO(burdon): Change to event.
|
|
908
|
-
onInfo
|
|
909
|
-
ignoreAttention
|
|
873
|
+
onInfo
|
|
910
874
|
}
|
|
911
875
|
}, children);
|
|
912
876
|
};
|
|
913
|
-
var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo }) => {
|
|
914
|
-
const model = useSheetModel(graph, sheet, {
|
|
915
|
-
readonly
|
|
916
|
-
});
|
|
917
|
-
return !model ? null : /* @__PURE__ */ React3.createElement(Grid.Root, {
|
|
918
|
-
id: Obj4.getDXN(sheet).toString()
|
|
919
|
-
}, /* @__PURE__ */ React3.createElement(SheetProviderImpl, {
|
|
920
|
-
model,
|
|
921
|
-
onInfo,
|
|
922
|
-
ignoreAttention
|
|
923
|
-
}, children));
|
|
924
|
-
};
|
|
925
877
|
|
|
926
|
-
// src/components/
|
|
878
|
+
// src/components/SheetContent/util.ts
|
|
927
879
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
928
880
|
import { inRange as inRange2 } from "@dxos/compute";
|
|
929
881
|
import { createDocAccessor } from "@dxos/echo-db";
|
|
@@ -1000,12 +952,12 @@ var gridCellGetter = (model) => {
|
|
|
1000
952
|
};
|
|
1001
953
|
var rowLabelCell = (row) => ({
|
|
1002
954
|
value: rowToA1Notation(row),
|
|
1003
|
-
className: "!bg-
|
|
955
|
+
className: "!bg-toolbar-surface text-subdued text-end pe-1",
|
|
1004
956
|
resizeHandle: "row"
|
|
1005
957
|
});
|
|
1006
958
|
var colLabelCell = (col) => ({
|
|
1007
959
|
value: colToA1Notation(col),
|
|
1008
|
-
className: "!bg-
|
|
960
|
+
className: "!bg-toolbar-surface text-subdued",
|
|
1009
961
|
resizeHandle: "col"
|
|
1010
962
|
});
|
|
1011
963
|
var cellGetter = (model) => {
|
|
@@ -1017,7 +969,7 @@ var cellGetter = (model) => {
|
|
|
1017
969
|
case "fixedStartStart": {
|
|
1018
970
|
return {
|
|
1019
971
|
"0,0": {
|
|
1020
|
-
className: "!bg-
|
|
972
|
+
className: "!bg-toolbar-surface"
|
|
1021
973
|
}
|
|
1022
974
|
};
|
|
1023
975
|
}
|
|
@@ -1094,7 +1046,7 @@ var useSheetModelDxGridProps = (dxGrid, model) => {
|
|
|
1094
1046
|
};
|
|
1095
1047
|
};
|
|
1096
1048
|
|
|
1097
|
-
// src/components/
|
|
1049
|
+
// src/components/SheetContent/SheetContent.tsx
|
|
1098
1050
|
var inertPosition = {
|
|
1099
1051
|
plane: "grid",
|
|
1100
1052
|
col: 0,
|
|
@@ -1141,15 +1093,16 @@ var sheetRowDefault = {
|
|
|
1141
1093
|
resizeable: true
|
|
1142
1094
|
}
|
|
1143
1095
|
};
|
|
1144
|
-
var
|
|
1145
|
-
const { t } =
|
|
1096
|
+
var SheetContent = (props) => {
|
|
1097
|
+
const { t } = useTranslation(meta.id);
|
|
1146
1098
|
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } = useSheetContext();
|
|
1147
1099
|
const [dxGrid, setDxGrid] = useState4(null);
|
|
1148
1100
|
const [extraplanarFocus, setExtraplanarFocus] = useState4(null);
|
|
1149
1101
|
const { invokePromise } = useOperationInvoker2();
|
|
1150
1102
|
const rangeController = useRef(null);
|
|
1151
1103
|
const { hasAttention } = useAttention(id);
|
|
1152
|
-
const
|
|
1104
|
+
const { className, ...rest } = useComposableProps(props);
|
|
1105
|
+
const handleFocus = useCallback3((event) => {
|
|
1153
1106
|
if (!editing) {
|
|
1154
1107
|
const cell = closestCell(event.target);
|
|
1155
1108
|
if (cell) {
|
|
@@ -1169,7 +1122,7 @@ var GridSheet = () => {
|
|
|
1169
1122
|
}, [
|
|
1170
1123
|
editing
|
|
1171
1124
|
]);
|
|
1172
|
-
const handleClose =
|
|
1125
|
+
const handleClose = useCallback3((_value, event) => {
|
|
1173
1126
|
if (event) {
|
|
1174
1127
|
const { key, shift } = event;
|
|
1175
1128
|
const axis = [
|
|
@@ -1192,7 +1145,7 @@ var GridSheet = () => {
|
|
|
1192
1145
|
editing,
|
|
1193
1146
|
dxGrid
|
|
1194
1147
|
]);
|
|
1195
|
-
const handleBlur =
|
|
1148
|
+
const handleBlur = useCallback3((value) => {
|
|
1196
1149
|
if (value !== void 0) {
|
|
1197
1150
|
model.setValue(parseCellIndex(editing.index), value);
|
|
1198
1151
|
}
|
|
@@ -1200,8 +1153,8 @@ var GridSheet = () => {
|
|
|
1200
1153
|
model,
|
|
1201
1154
|
editing
|
|
1202
1155
|
]);
|
|
1203
|
-
const handleAxisResize =
|
|
1204
|
-
|
|
1156
|
+
const handleAxisResize = useCallback3(({ axis, size, index: numericIndex }) => {
|
|
1157
|
+
Obj4.change(model.sheet, (sheet) => {
|
|
1205
1158
|
if (axis === "row") {
|
|
1206
1159
|
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
1207
1160
|
sheet.rowMeta[rowId] ??= {};
|
|
@@ -1215,7 +1168,7 @@ var GridSheet = () => {
|
|
|
1215
1168
|
}, [
|
|
1216
1169
|
model
|
|
1217
1170
|
]);
|
|
1218
|
-
const handleSelect =
|
|
1171
|
+
const handleSelect = useCallback3(({ minCol, maxCol, minRow, maxRow }) => {
|
|
1219
1172
|
const range = {
|
|
1220
1173
|
from: {
|
|
1221
1174
|
col: minCol,
|
|
@@ -1229,14 +1182,14 @@ var GridSheet = () => {
|
|
|
1229
1182
|
};
|
|
1230
1183
|
}
|
|
1231
1184
|
if (editing) {
|
|
1232
|
-
rangeController.current?.setRange(
|
|
1185
|
+
rangeController.current?.setRange(rangeToA1Notation(range));
|
|
1233
1186
|
} else {
|
|
1234
1187
|
setRange(range.to ? range : void 0);
|
|
1235
1188
|
}
|
|
1236
1189
|
}, [
|
|
1237
1190
|
editing
|
|
1238
1191
|
]);
|
|
1239
|
-
const handleWheel =
|
|
1192
|
+
const handleWheel = useCallback3((event) => {
|
|
1240
1193
|
if (!ignoreAttention && !hasAttention) {
|
|
1241
1194
|
event.stopPropagation();
|
|
1242
1195
|
}
|
|
@@ -1244,7 +1197,7 @@ var GridSheet = () => {
|
|
|
1244
1197
|
hasAttention,
|
|
1245
1198
|
ignoreAttention
|
|
1246
1199
|
]);
|
|
1247
|
-
const selectEntireAxis =
|
|
1200
|
+
const selectEntireAxis = useCallback3((pos) => {
|
|
1248
1201
|
switch (pos.plane) {
|
|
1249
1202
|
case "frozenRowsStart":
|
|
1250
1203
|
return dxGrid?.setSelection({
|
|
@@ -1277,7 +1230,7 @@ var GridSheet = () => {
|
|
|
1277
1230
|
dxGrid,
|
|
1278
1231
|
model.sheet
|
|
1279
1232
|
]);
|
|
1280
|
-
const handleClick =
|
|
1233
|
+
const handleClick = useCallback3((event) => {
|
|
1281
1234
|
const cell = closestCell(event.target);
|
|
1282
1235
|
if (cell) {
|
|
1283
1236
|
selectEntireAxis(cell);
|
|
@@ -1285,7 +1238,7 @@ var GridSheet = () => {
|
|
|
1285
1238
|
}, [
|
|
1286
1239
|
selectEntireAxis
|
|
1287
1240
|
]);
|
|
1288
|
-
const handleKeyDown =
|
|
1241
|
+
const handleKeyDown = useCallback3((event) => {
|
|
1289
1242
|
switch (event.key) {
|
|
1290
1243
|
case "Backspace":
|
|
1291
1244
|
case "Delete":
|
|
@@ -1335,7 +1288,7 @@ var GridSheet = () => {
|
|
|
1335
1288
|
const contextMenuAnchorRef = useRef(null);
|
|
1336
1289
|
const [contextMenuOpen, setContextMenuOpen] = useState4(null);
|
|
1337
1290
|
const contextMenuAxis = contextMenuOpen?.plane.startsWith("frozenRows") ? "col" : "row";
|
|
1338
|
-
const handleContextMenu =
|
|
1291
|
+
const handleContextMenu = useCallback3((event) => {
|
|
1339
1292
|
const cell = closestCell(event.target);
|
|
1340
1293
|
if (cell && cell.plane.startsWith("frozen")) {
|
|
1341
1294
|
event.preventDefault();
|
|
@@ -1343,7 +1296,7 @@ var GridSheet = () => {
|
|
|
1343
1296
|
setContextMenuOpen(cell);
|
|
1344
1297
|
}
|
|
1345
1298
|
}, []);
|
|
1346
|
-
const handleAxisMenuAction =
|
|
1299
|
+
const handleAxisMenuAction = useCallback3((operation) => {
|
|
1347
1300
|
switch (operation) {
|
|
1348
1301
|
case "insert-before":
|
|
1349
1302
|
case "insert-after":
|
|
@@ -1389,85 +1342,464 @@ var GridSheet = () => {
|
|
|
1389
1342
|
handleClose,
|
|
1390
1343
|
editing
|
|
1391
1344
|
]);
|
|
1392
|
-
const getCellContent =
|
|
1345
|
+
const getCellContent = useCallback3((index) => {
|
|
1393
1346
|
return model.getCellText(parseCellIndex(index));
|
|
1394
1347
|
}, [
|
|
1395
1348
|
model
|
|
1396
1349
|
]);
|
|
1397
1350
|
useUpdateFocusedCellOnThreadSelection(dxGrid);
|
|
1398
1351
|
useSelectThreadOnCellFocus();
|
|
1399
|
-
return (
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1352
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
1353
|
+
...rest,
|
|
1354
|
+
role: "none",
|
|
1355
|
+
className: mx2("relative min-h-0", className)
|
|
1356
|
+
}, /* @__PURE__ */ React3.createElement(GridCellEditor, {
|
|
1357
|
+
getCellContent,
|
|
1358
|
+
extensions,
|
|
1359
|
+
onBlur: handleBlur
|
|
1360
|
+
}), /* @__PURE__ */ React3.createElement(Grid2.Content, {
|
|
1361
|
+
className: "[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0",
|
|
1362
|
+
initialCells,
|
|
1363
|
+
limitColumns: DEFAULT_COLS,
|
|
1364
|
+
limitRows: DEFAULT_ROWS,
|
|
1365
|
+
columns,
|
|
1366
|
+
rows,
|
|
1367
|
+
columnDefault: sheetColDefault,
|
|
1368
|
+
rowDefault: sheetRowDefault,
|
|
1369
|
+
activeRefs,
|
|
1370
|
+
frozen,
|
|
1371
|
+
overscroll: "trap",
|
|
1372
|
+
onAxisResize: handleAxisResize,
|
|
1373
|
+
onSelect: handleSelect,
|
|
1374
|
+
onFocus: handleFocus,
|
|
1375
|
+
onWheelCapture: handleWheel,
|
|
1376
|
+
onKeyDown: handleKeyDown,
|
|
1377
|
+
onContextMenu: handleContextMenu,
|
|
1378
|
+
onClick: handleClick,
|
|
1379
|
+
ref: setDxGrid
|
|
1380
|
+
}), /* @__PURE__ */ React3.createElement(DropdownMenu.Root, {
|
|
1381
|
+
modal: false,
|
|
1382
|
+
open: !!contextMenuOpen,
|
|
1383
|
+
onOpenChange: (nextOpen) => setContextMenuOpen(nextOpen ? inertPosition : null)
|
|
1384
|
+
}, /* @__PURE__ */ React3.createElement(DropdownMenu.VirtualTrigger, {
|
|
1385
|
+
virtualRef: contextMenuAnchorRef
|
|
1386
|
+
}), /* @__PURE__ */ React3.createElement(DropdownMenu.Content, {
|
|
1387
|
+
side: contextMenuAxis === "col" ? "bottom" : "right",
|
|
1388
|
+
sideOffset: 4,
|
|
1389
|
+
collisionPadding: 8
|
|
1390
|
+
}, /* @__PURE__ */ React3.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
|
|
1391
|
+
onClick: () => handleAxisMenuAction("insert-before"),
|
|
1392
|
+
"data-testid": `grid.${contextMenuAxis}.insert-before`
|
|
1393
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
1394
|
+
size: 5,
|
|
1395
|
+
icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
|
|
1396
|
+
}), /* @__PURE__ */ React3.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
|
|
1397
|
+
onClick: () => handleAxisMenuAction("insert-after"),
|
|
1398
|
+
"data-testid": `grid.${contextMenuAxis}.insert-after`
|
|
1399
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
1400
|
+
size: 5,
|
|
1401
|
+
icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
|
|
1402
|
+
}), /* @__PURE__ */ React3.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
|
|
1403
|
+
onClick: () => handleAxisMenuAction("drop"),
|
|
1404
|
+
"data-testid": `grid.${contextMenuAxis}.drop`
|
|
1405
|
+
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
1406
|
+
size: 5,
|
|
1407
|
+
icon: "ph--backspace--regular"
|
|
1408
|
+
}), /* @__PURE__ */ React3.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ React3.createElement(DropdownMenu.Arrow, null))));
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
// src/components/SheetStatusbar/SheetStatusbar.tsx
|
|
1412
|
+
import React4 from "react";
|
|
1413
|
+
import { addressToA1Notation as addressToA1Notation2, isFormula as isFormula2, rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
|
|
1414
|
+
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
1415
|
+
var SheetStatusbar = (props) => {
|
|
1416
|
+
const { model, cursor, range } = useSheetContext();
|
|
1417
|
+
let value;
|
|
1418
|
+
let formula = false;
|
|
1419
|
+
if (cursor) {
|
|
1420
|
+
value = model.getCellValue(cursor);
|
|
1421
|
+
if (isFormula2(value)) {
|
|
1422
|
+
value = model.graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(model.sheet, value));
|
|
1423
|
+
formula = true;
|
|
1424
|
+
} else if (value != null) {
|
|
1425
|
+
value = String(value);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
1429
|
+
...props,
|
|
1430
|
+
className: "flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbar-surface border-y !border-subdued-separator"
|
|
1431
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
1432
|
+
className: "flex gap-4 items-center"
|
|
1433
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
1434
|
+
className: "flex w-16 items-center font-mono"
|
|
1435
|
+
}, range && rangeToA1Notation2(range) || cursor && addressToA1Notation2(cursor)), /* @__PURE__ */ React4.createElement("div", {
|
|
1436
|
+
className: "flex gap-2 items-center"
|
|
1437
|
+
}, /* @__PURE__ */ React4.createElement(Icon2, {
|
|
1438
|
+
icon: "ph--function--regular",
|
|
1439
|
+
classNames: [
|
|
1440
|
+
"text-green-text",
|
|
1441
|
+
formula ? "visible" : "invisible"
|
|
1442
|
+
]
|
|
1443
|
+
}), /* @__PURE__ */ React4.createElement("span", {
|
|
1444
|
+
className: "font-mono"
|
|
1445
|
+
}, value))));
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
// src/components/SheetToolbar/SheetToolbar.tsx
|
|
1449
|
+
import { Atom as Atom2, RegistryContext as RegistryContext4 } from "@effect-atom/atom-react";
|
|
1450
|
+
import React5, { useContext as useContext6, useMemo as useMemo4 } from "react";
|
|
1451
|
+
import { useAppGraph } from "@dxos/app-toolkit/ui";
|
|
1452
|
+
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
1453
|
+
|
|
1454
|
+
// src/components/SheetToolbar/align.ts
|
|
1455
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
1456
|
+
import { useContext as useContext3, useEffect as useEffect4 } from "react";
|
|
1457
|
+
import { inRange as inRange3 } from "@dxos/compute";
|
|
1458
|
+
import { Obj as Obj5 } from "@dxos/echo";
|
|
1459
|
+
import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
|
|
1460
|
+
var aligns = {
|
|
1461
|
+
start: "ph--text-align-left--regular",
|
|
1462
|
+
center: "ph--text-align-center--regular",
|
|
1463
|
+
end: "ph--text-align-right--regular"
|
|
1464
|
+
};
|
|
1465
|
+
var useAlignState = (stateAtom) => {
|
|
1466
|
+
const registry = useContext3(RegistryContext);
|
|
1467
|
+
const { cursor, model } = useSheetContext();
|
|
1468
|
+
useEffect4(() => {
|
|
1469
|
+
const alignValue = cursor ? model.sheet.ranges?.findLast(({ range, key }) => key === alignKey && inRange3(rangeFromIndex(model.sheet, range), cursor))?.value : void 0;
|
|
1470
|
+
const prev = registry.get(stateAtom);
|
|
1471
|
+
registry.set(stateAtom, {
|
|
1472
|
+
...prev,
|
|
1473
|
+
[alignKey]: alignValue
|
|
1474
|
+
});
|
|
1475
|
+
}, [
|
|
1476
|
+
cursor,
|
|
1477
|
+
model.sheet,
|
|
1478
|
+
registry,
|
|
1479
|
+
stateAtom
|
|
1480
|
+
]);
|
|
1481
|
+
};
|
|
1482
|
+
var createAlignGroupAction = (value) => createMenuItemGroup("align", {
|
|
1483
|
+
label: [
|
|
1484
|
+
"align label",
|
|
1485
|
+
{
|
|
1486
|
+
ns: meta.id
|
|
1487
|
+
}
|
|
1488
|
+
],
|
|
1489
|
+
variant: "toggleGroup",
|
|
1490
|
+
selectCardinality: "single",
|
|
1491
|
+
value: `${alignKey}--${value}`
|
|
1492
|
+
});
|
|
1493
|
+
var createAlignActions = ({ model, state, stateAtom, registry, cursorFallbackRange }) => Object.entries(aligns).map(([alignValue, icon]) => {
|
|
1494
|
+
return createMenuAction(`${alignKey}--${alignValue}`, () => {
|
|
1495
|
+
if (!cursorFallbackRange) {
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
const index = model.sheet.ranges?.findIndex((range) => range.key === alignKey && inRange3(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
|
|
1499
|
+
const nextRangeEntity = {
|
|
1500
|
+
range: rangeToIndex(model.sheet, cursorFallbackRange),
|
|
1501
|
+
key: alignKey,
|
|
1502
|
+
value: alignValue
|
|
1503
|
+
};
|
|
1504
|
+
const currentState = registry.get(stateAtom);
|
|
1505
|
+
if (index < 0) {
|
|
1506
|
+
Obj5.change(model.sheet, (obj) => {
|
|
1507
|
+
obj.ranges?.push(nextRangeEntity);
|
|
1508
|
+
});
|
|
1509
|
+
registry.set(stateAtom, {
|
|
1510
|
+
...currentState,
|
|
1511
|
+
[alignKey]: nextRangeEntity.value
|
|
1512
|
+
});
|
|
1513
|
+
} else if (model.sheet.ranges[index].value === nextRangeEntity.value) {
|
|
1514
|
+
Obj5.change(model.sheet, (obj) => {
|
|
1515
|
+
obj.ranges?.splice(index, 1);
|
|
1516
|
+
});
|
|
1517
|
+
registry.set(stateAtom, {
|
|
1518
|
+
...currentState,
|
|
1519
|
+
[alignKey]: void 0
|
|
1520
|
+
});
|
|
1521
|
+
} else {
|
|
1522
|
+
Obj5.change(model.sheet, (obj) => {
|
|
1523
|
+
obj.ranges?.splice(index, 1, nextRangeEntity);
|
|
1524
|
+
});
|
|
1525
|
+
registry.set(stateAtom, {
|
|
1526
|
+
...currentState,
|
|
1527
|
+
[alignKey]: nextRangeEntity.value
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
}, {
|
|
1531
|
+
key: alignKey,
|
|
1532
|
+
value: alignValue,
|
|
1533
|
+
checked: state[alignKey] === alignValue,
|
|
1534
|
+
label: [
|
|
1535
|
+
`range value ${alignValue} label`,
|
|
1536
|
+
{
|
|
1537
|
+
ns: meta.id
|
|
1538
|
+
}
|
|
1539
|
+
],
|
|
1540
|
+
icon,
|
|
1541
|
+
testId: `grid.toolbar.${alignKey}.${alignValue}`
|
|
1542
|
+
});
|
|
1543
|
+
});
|
|
1544
|
+
var createAlign = (context) => {
|
|
1545
|
+
const alignGroup = createAlignGroupAction(context.state[alignKey]);
|
|
1546
|
+
const alignActions = createAlignActions(context);
|
|
1547
|
+
return {
|
|
1548
|
+
nodes: [
|
|
1549
|
+
alignGroup,
|
|
1550
|
+
...alignActions
|
|
1551
|
+
],
|
|
1552
|
+
edges: [
|
|
1553
|
+
{
|
|
1554
|
+
source: "root",
|
|
1555
|
+
target: "align",
|
|
1556
|
+
relation: "child"
|
|
1557
|
+
},
|
|
1558
|
+
...alignActions.map(({ id }) => ({
|
|
1559
|
+
source: alignGroup.id,
|
|
1560
|
+
target: id,
|
|
1561
|
+
relation: "child"
|
|
1562
|
+
}))
|
|
1563
|
+
]
|
|
1564
|
+
};
|
|
1459
1565
|
};
|
|
1460
1566
|
|
|
1461
|
-
// src/components/
|
|
1462
|
-
|
|
1567
|
+
// src/components/SheetToolbar/style.ts
|
|
1568
|
+
import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
|
|
1569
|
+
import { useContext as useContext4, useEffect as useEffect5 } from "react";
|
|
1570
|
+
import { inRange as inRange4 } from "@dxos/compute";
|
|
1571
|
+
import { Obj as Obj6 } from "@dxos/echo";
|
|
1572
|
+
import { createMenuAction as createMenuAction2, createMenuItemGroup as createMenuItemGroup2 } from "@dxos/react-ui-menu";
|
|
1573
|
+
var styles = {
|
|
1574
|
+
highlight: "ph--highlighter--regular",
|
|
1575
|
+
softwrap: "ph--paragraph--regular"
|
|
1576
|
+
};
|
|
1577
|
+
var useStyleState = (stateAtom) => {
|
|
1578
|
+
const registry = useContext4(RegistryContext2);
|
|
1579
|
+
const { cursorFallbackRange, model } = useSheetContext();
|
|
1580
|
+
useEffect5(() => {
|
|
1581
|
+
let highlight = false;
|
|
1582
|
+
let softwrap = false;
|
|
1583
|
+
if (cursorFallbackRange && model.sheet.ranges) {
|
|
1584
|
+
model.sheet.ranges.filter(({ range, key }) => key === "style" && inRange4(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).forEach(({ value }) => {
|
|
1585
|
+
if (value === "highlight") {
|
|
1586
|
+
highlight = true;
|
|
1587
|
+
}
|
|
1588
|
+
if (value === "softwrap") {
|
|
1589
|
+
softwrap = true;
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
const prev = registry.get(stateAtom);
|
|
1594
|
+
registry.set(stateAtom, {
|
|
1595
|
+
...prev,
|
|
1596
|
+
highlight,
|
|
1597
|
+
softwrap
|
|
1598
|
+
});
|
|
1599
|
+
}, [
|
|
1600
|
+
cursorFallbackRange,
|
|
1601
|
+
model.sheet,
|
|
1602
|
+
registry,
|
|
1603
|
+
stateAtom
|
|
1604
|
+
]);
|
|
1605
|
+
};
|
|
1606
|
+
var createStyleGroup = (state) => {
|
|
1607
|
+
return createMenuItemGroup2("style", {
|
|
1608
|
+
variant: "toggleGroup",
|
|
1609
|
+
selectCardinality: "multiple",
|
|
1610
|
+
value: Object.keys(styles).filter((key) => !!state[key]).map((styleValue) => `style--${styleValue}`)
|
|
1611
|
+
});
|
|
1612
|
+
};
|
|
1613
|
+
var createStyleActions = ({ model, state, stateAtom, registry, cursorFallbackRange }) => Object.entries(styles).map(([styleValue, icon]) => {
|
|
1614
|
+
return createMenuAction2(`style--${styleValue}`, () => {
|
|
1615
|
+
if (!cursorFallbackRange) {
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
const index = model.sheet.ranges?.findIndex((range) => range.key === "style" && inRange4(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
|
|
1619
|
+
const nextRangeEntity = {
|
|
1620
|
+
range: rangeToIndex(model.sheet, cursorFallbackRange),
|
|
1621
|
+
key: "style",
|
|
1622
|
+
value: styleValue
|
|
1623
|
+
};
|
|
1624
|
+
const currentState = registry.get(stateAtom);
|
|
1625
|
+
if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && inRange4(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === styleValue)) {
|
|
1626
|
+
if (index >= 0) {
|
|
1627
|
+
Obj6.change(model.sheet, (obj) => {
|
|
1628
|
+
obj.ranges?.splice(index, 1);
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
registry.set(stateAtom, {
|
|
1632
|
+
...currentState,
|
|
1633
|
+
[nextRangeEntity.value]: false
|
|
1634
|
+
});
|
|
1635
|
+
} else {
|
|
1636
|
+
Obj6.change(model.sheet, (obj) => {
|
|
1637
|
+
obj.ranges?.push(nextRangeEntity);
|
|
1638
|
+
});
|
|
1639
|
+
registry.set(stateAtom, {
|
|
1640
|
+
...currentState,
|
|
1641
|
+
[nextRangeEntity.value]: true
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
}, {
|
|
1645
|
+
key: "style",
|
|
1646
|
+
value: styleValue,
|
|
1647
|
+
icon,
|
|
1648
|
+
label: [
|
|
1649
|
+
`range value ${styleValue} label`,
|
|
1650
|
+
{
|
|
1651
|
+
ns: meta.id
|
|
1652
|
+
}
|
|
1653
|
+
],
|
|
1654
|
+
checked: !!state[styleValue]
|
|
1655
|
+
});
|
|
1656
|
+
});
|
|
1657
|
+
var createStyle = (context) => {
|
|
1658
|
+
const styleGroupAction = createStyleGroup(context.state);
|
|
1659
|
+
const styleActions = createStyleActions(context);
|
|
1660
|
+
return {
|
|
1661
|
+
nodes: [
|
|
1662
|
+
styleGroupAction,
|
|
1663
|
+
...styleActions
|
|
1664
|
+
],
|
|
1665
|
+
edges: [
|
|
1666
|
+
{
|
|
1667
|
+
source: "root",
|
|
1668
|
+
target: "style",
|
|
1669
|
+
relation: "child"
|
|
1670
|
+
},
|
|
1671
|
+
...styleActions.map(({ id }) => ({
|
|
1672
|
+
source: styleGroupAction.id,
|
|
1673
|
+
target: id,
|
|
1674
|
+
relation: "child"
|
|
1675
|
+
}))
|
|
1676
|
+
]
|
|
1677
|
+
};
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
// src/components/SheetToolbar/useToolbarState.ts
|
|
1681
|
+
import { Atom, RegistryContext as RegistryContext3, useAtomValue } from "@effect-atom/atom-react";
|
|
1682
|
+
import { useContext as useContext5, useMemo as useMemo3 } from "react";
|
|
1683
|
+
var useToolbarState = (initialState = {}) => {
|
|
1684
|
+
return useMemo3(() => Atom.make(initialState).pipe(Atom.keepAlive), []);
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
// src/components/SheetToolbar/SheetToolbar.tsx
|
|
1688
|
+
var createToolbarActions = ({ model, stateAtom, registry, cursorFallbackRange, customActions }) => {
|
|
1689
|
+
return Atom2.make((get) => {
|
|
1690
|
+
const state = get(stateAtom);
|
|
1691
|
+
const context = {
|
|
1692
|
+
model,
|
|
1693
|
+
state,
|
|
1694
|
+
stateAtom,
|
|
1695
|
+
registry,
|
|
1696
|
+
cursorFallbackRange
|
|
1697
|
+
};
|
|
1698
|
+
const align = createAlign(context);
|
|
1699
|
+
const style = createStyle(context);
|
|
1700
|
+
const gap = createGapSeparator();
|
|
1701
|
+
const graph = {
|
|
1702
|
+
nodes: [
|
|
1703
|
+
...align.nodes,
|
|
1704
|
+
...style.nodes,
|
|
1705
|
+
...gap.nodes
|
|
1706
|
+
],
|
|
1707
|
+
edges: [
|
|
1708
|
+
...align.edges,
|
|
1709
|
+
...style.edges,
|
|
1710
|
+
...gap.edges
|
|
1711
|
+
]
|
|
1712
|
+
};
|
|
1713
|
+
if (customActions) {
|
|
1714
|
+
const custom = get(customActions);
|
|
1715
|
+
graph.nodes.push(...custom.nodes);
|
|
1716
|
+
graph.edges.push(...custom.edges);
|
|
1717
|
+
}
|
|
1718
|
+
return graph;
|
|
1719
|
+
});
|
|
1720
|
+
};
|
|
1721
|
+
var SheetToolbar = ({ id, ...props }) => {
|
|
1722
|
+
const { model, cursorFallbackRange } = useSheetContext();
|
|
1723
|
+
const stateAtom = useToolbarState({});
|
|
1724
|
+
const registry = useContext6(RegistryContext4);
|
|
1725
|
+
useAlignState(stateAtom);
|
|
1726
|
+
useStyleState(stateAtom);
|
|
1727
|
+
const { graph } = useAppGraph();
|
|
1728
|
+
const customActions = useMemo4(() => {
|
|
1729
|
+
return Atom2.make((get) => {
|
|
1730
|
+
const actions = get(graph.actions(id));
|
|
1731
|
+
const nodes = actions.filter((action) => action.properties.disposition === "toolbar");
|
|
1732
|
+
return {
|
|
1733
|
+
nodes,
|
|
1734
|
+
edges: nodes.map((node) => ({
|
|
1735
|
+
source: "root",
|
|
1736
|
+
target: node.id,
|
|
1737
|
+
relation: "child"
|
|
1738
|
+
}))
|
|
1739
|
+
};
|
|
1740
|
+
});
|
|
1741
|
+
}, [
|
|
1742
|
+
graph,
|
|
1743
|
+
id
|
|
1744
|
+
]);
|
|
1745
|
+
const actionsCreator = useMemo4(() => createToolbarActions({
|
|
1746
|
+
model,
|
|
1747
|
+
stateAtom,
|
|
1748
|
+
registry,
|
|
1749
|
+
cursorFallbackRange,
|
|
1750
|
+
customActions
|
|
1751
|
+
}), [
|
|
1752
|
+
model,
|
|
1753
|
+
stateAtom,
|
|
1754
|
+
registry,
|
|
1755
|
+
cursorFallbackRange,
|
|
1756
|
+
customActions
|
|
1757
|
+
]);
|
|
1758
|
+
const menu = useMenuActions(actionsCreator);
|
|
1759
|
+
return /* @__PURE__ */ React5.createElement(Menu.Root, {
|
|
1760
|
+
...props,
|
|
1761
|
+
...menu,
|
|
1762
|
+
attendableId: id
|
|
1763
|
+
}, /* @__PURE__ */ React5.createElement(Menu.Toolbar, null));
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
// src/components/Sheet/Sheet.tsx
|
|
1767
|
+
var Sheet = {
|
|
1768
|
+
Root: SheetRoot,
|
|
1769
|
+
Toolbar: SheetToolbar,
|
|
1770
|
+
Content: SheetContent,
|
|
1771
|
+
Statusbar: SheetStatusbar
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1774
|
+
// src/containers/SheetContainer/SheetContainer.tsx
|
|
1775
|
+
var SheetContainer = ({ registry, ...props }) => /* @__PURE__ */ React6.createElement(ComputeGraphContextProvider, {
|
|
1776
|
+
registry
|
|
1777
|
+
}, /* @__PURE__ */ React6.createElement(SheetContainerInner, props));
|
|
1778
|
+
var SheetContainerInner = ({ role, subject: sheet, space, ignoreAttention }) => {
|
|
1779
|
+
const graph = useComputeGraph(space);
|
|
1780
|
+
if (!graph) {
|
|
1781
|
+
return null;
|
|
1782
|
+
}
|
|
1783
|
+
return /* @__PURE__ */ React6.createElement(Sheet.Root, {
|
|
1784
|
+
graph,
|
|
1785
|
+
sheet,
|
|
1786
|
+
ignoreAttention
|
|
1787
|
+
}, /* @__PURE__ */ React6.createElement(Panel.Root, {
|
|
1788
|
+
classNames: role === "section" && "aspect-aquare"
|
|
1789
|
+
}, /* @__PURE__ */ React6.createElement(Panel.Toolbar, {
|
|
1790
|
+
asChild: true
|
|
1791
|
+
}, /* @__PURE__ */ React6.createElement(Sheet.Toolbar, {
|
|
1792
|
+
id: Obj7.getDXN(sheet).toString()
|
|
1793
|
+
})), /* @__PURE__ */ React6.createElement(Panel.Content, {
|
|
1794
|
+
asChild: true
|
|
1795
|
+
}, /* @__PURE__ */ React6.createElement(Sheet.Content, null)), /* @__PURE__ */ React6.createElement(Panel.Statusbar, {
|
|
1796
|
+
asChild: true
|
|
1797
|
+
}, /* @__PURE__ */ React6.createElement(Sheet.Statusbar, null))));
|
|
1798
|
+
};
|
|
1463
1799
|
|
|
1800
|
+
// src/containers/SheetContainer/index.ts
|
|
1801
|
+
var SheetContainer_default = SheetContainer;
|
|
1464
1802
|
export {
|
|
1465
|
-
|
|
1466
|
-
useComputeGraph,
|
|
1467
|
-
useSheetContext,
|
|
1468
|
-
SheetProvider,
|
|
1469
|
-
GridSheet,
|
|
1470
|
-
RangeList,
|
|
1471
|
-
SheetContainer
|
|
1803
|
+
SheetContainer_default as default
|
|
1472
1804
|
};
|
|
1473
|
-
//# sourceMappingURL=
|
|
1805
|
+
//# sourceMappingURL=SheetContainer-I3NFVVDQ.mjs.map
|