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