@dxos/plugin-sheet 0.8.4-main.67995b8 → 0.8.4-main.c4373fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{SheetContainer-KDGD4AVG.mjs → SheetContainer-VL34UND4.mjs} +29 -29
- package/dist/lib/browser/SheetContainer-VL34UND4.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-VHURGBOY.mjs → anchor-sort-3N44DS5F.mjs} +5 -5
- package/dist/lib/browser/{anchor-sort-VHURGBOY.mjs.map → anchor-sort-3N44DS5F.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-SI4X5GUR.mjs → chunk-ADK2HW4A.mjs} +25 -11
- package/dist/lib/browser/chunk-ADK2HW4A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6AKBCBL4.mjs → chunk-CSBSADPQ.mjs} +2 -4
- package/dist/lib/browser/chunk-CSBSADPQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7HQX4NQP.mjs → chunk-SSN4HYJL.mjs} +6 -6
- package/dist/lib/browser/chunk-SSN4HYJL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JUOVL3LE.mjs → chunk-ZJWJMX4E.mjs} +208 -203
- package/dist/lib/browser/chunk-ZJWJMX4E.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KJWZUQVA.mjs → chunk-ZMPNHFIP.mjs} +4 -4
- package/dist/lib/browser/chunk-ZMPNHFIP.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +12 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-WOJGZMSV.mjs → intent-resolver-BQLV6IAA.mjs} +8 -8
- package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs.map +7 -0
- package/dist/lib/browser/{markdown-VXMIPUQC.mjs → markdown-RMTMI237.mjs} +6 -6
- package/dist/lib/browser/markdown-RMTMI237.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-SE4HGAEH.mjs → react-surface-7ZDMQDCT.mjs} +11 -11
- package/dist/lib/browser/react-surface-7ZDMQDCT.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{SheetContainer-RMG24NZC.mjs → SheetContainer-NWJ7L6FC.mjs} +29 -29
- package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-CTJGOPET.mjs → anchor-sort-YL2OZHYM.mjs} +5 -5
- package/dist/lib/node-esm/{anchor-sort-CTJGOPET.mjs.map → anchor-sort-YL2OZHYM.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-CADTJFAS.mjs → chunk-BZAPYBSH.mjs} +25 -11
- package/dist/lib/node-esm/chunk-BZAPYBSH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3K5VNYOF.mjs → chunk-H3GSD33H.mjs} +2 -4
- package/dist/lib/node-esm/chunk-H3GSD33H.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Q6UYC4G5.mjs → chunk-IK4O7FUJ.mjs} +6 -6
- package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6SK5LJ5S.mjs → chunk-LN6ZSAII.mjs} +4 -4
- package/dist/lib/node-esm/chunk-LN6ZSAII.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IFMIRCZH.mjs → chunk-YL7BVJPC.mjs} +208 -203
- package/dist/lib/node-esm/chunk-YL7BVJPC.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +12 -13
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-PZRXBNIJ.mjs → intent-resolver-MV5ZFXAQ.mjs} +8 -8
- package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-4VPQJZNZ.mjs → markdown-EDIWHA3P.mjs} +6 -6
- package/dist/lib/node-esm/markdown-EDIWHA3P.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-LAU23XBH.mjs → react-surface-TUME5MM2.mjs} +11 -11
- package/dist/lib/node-esm/react-surface-TUME5MM2.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/SheetPlugin.d.ts +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +2 -2
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +1 -3
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +50 -3
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +11 -20
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +52 -5
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +86 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +2 -2
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts +10 -13
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/index.d.ts +1 -1
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +2 -2
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +8 -8
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -67
- package/src/SheetPlugin.tsx +69 -61
- package/src/capabilities/anchor-sort.ts +1 -1
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/compute-graph-registry.ts +9 -14
- package/src/capabilities/intent-resolver.ts +4 -4
- package/src/capabilities/markdown.ts +3 -2
- package/src/capabilities/react-surface.tsx +5 -4
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +15 -14
- package/src/components/GridSheet/GridSheet.stories.tsx +18 -12
- package/src/components/GridSheet/GridSheet.tsx +23 -22
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +39 -41
- package/src/components/GridSheet/util.ts +6 -6
- package/src/components/RangeList/RangeList.tsx +3 -3
- package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -39
- package/src/components/SheetContainer/SheetContainer.tsx +6 -2
- package/src/components/SheetContext/SheetContext.tsx +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +19 -13
- package/src/components/SheetToolbar/SheetToolbar.tsx +16 -15
- package/src/components/SheetToolbar/align.ts +7 -6
- package/src/components/SheetToolbar/style.ts +4 -4
- package/src/extensions/compute.stories.tsx +28 -24
- package/src/extensions/compute.ts +2 -3
- package/src/extensions/editor/index.ts +1 -1
- package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
- package/src/integrations/thread-ranges.ts +9 -8
- package/src/meta.ts +1 -3
- package/src/model/sheet-model.test.ts +2 -1
- package/src/model/sheet-model.ts +7 -7
- package/src/playwright/sheet-manager.ts +1 -1
- package/src/playwright/sheet.spec.ts +1 -1
- package/src/sanity.test.ts +1 -1
- package/src/testing/testing.tsx +9 -3
- package/src/types/schema.ts +1 -1
- package/src/types/types.ts +5 -4
- package/src/types/util.ts +3 -3
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs.map +0 -7
- package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
- package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUOVL3LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
- package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs.map +0 -7
- package/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
- package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
- /package/src/extensions/editor/{extension.ts → sheet-extension.ts} +0 -0
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
cellClassNameForRange,
|
|
8
8
|
rangeFromIndex,
|
|
9
9
|
useSheetModel
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BZAPYBSH.mjs";
|
|
11
11
|
import {
|
|
12
12
|
rangeExtension,
|
|
13
13
|
sheetExtension
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IK4O7FUJ.mjs";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
meta
|
|
17
|
+
} from "./chunk-H3GSD33H.mjs";
|
|
18
18
|
|
|
19
19
|
// src/components/ComputeGraph/ComputeGraphContextProvider.tsx
|
|
20
20
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
@@ -51,7 +51,7 @@ var useComputeGraph = (space) => {
|
|
|
51
51
|
|
|
52
52
|
// src/components/RangeList/RangeList.tsx
|
|
53
53
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
54
|
-
import
|
|
54
|
+
import * as Schema from "effect/Schema";
|
|
55
55
|
import React2, { useCallback } from "react";
|
|
56
56
|
import { rangeToA1Notation } from "@dxos/compute";
|
|
57
57
|
import { Callout, useTranslation } from "@dxos/react-ui";
|
|
@@ -60,7 +60,7 @@ import { ghostHover } from "@dxos/react-ui-theme";
|
|
|
60
60
|
var RangeList = ({ sheet }) => {
|
|
61
61
|
var _effect = _useSignals2();
|
|
62
62
|
try {
|
|
63
|
-
const { t } = useTranslation(
|
|
63
|
+
const { t } = useTranslation(meta.id);
|
|
64
64
|
const handleSelectRange = (range) => {
|
|
65
65
|
};
|
|
66
66
|
const handleDeleteRange = useCallback((range) => {
|
|
@@ -106,189 +106,19 @@ import { rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
|
|
|
106
106
|
import { defaultColSize, defaultRowSize } from "@dxos/lit-grid";
|
|
107
107
|
import { DropdownMenu, Icon, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
108
108
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
109
|
-
import {
|
|
110
|
-
|
|
111
|
-
// src/components/GridSheet/util.ts
|
|
112
|
-
import { useEffect, useState } from "react";
|
|
113
|
-
import { inRange } from "@dxos/compute";
|
|
114
|
-
import { createDocAccessor } from "@dxos/react-client/echo";
|
|
115
|
-
import { parseValue, cellClassesForFieldType } from "@dxos/react-ui-form";
|
|
116
|
-
import { colToA1Notation, rowToA1Notation, commentedClassName } from "@dxos/react-ui-grid";
|
|
117
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
118
|
-
var createDxGridColumns = (model) => {
|
|
119
|
-
return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
|
|
120
|
-
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
121
|
-
acc.grid[numericIndex] = {
|
|
122
|
-
size: model.sheet.columnMeta[columnId].size,
|
|
123
|
-
resizeable: true
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
return acc;
|
|
127
|
-
}, {
|
|
128
|
-
grid: {}
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
var createDxGridRows = (model) => {
|
|
132
|
-
return model.sheet.rows.reduce((acc, rowId, numericIndex) => {
|
|
133
|
-
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
134
|
-
acc.grid[numericIndex] = {
|
|
135
|
-
size: model.sheet.rowMeta[rowId].size,
|
|
136
|
-
resizeable: true
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return acc;
|
|
140
|
-
}, {
|
|
141
|
-
grid: {}
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
var projectCellProps = (model, col, row) => {
|
|
145
|
-
const address = {
|
|
146
|
-
col,
|
|
147
|
-
row
|
|
148
|
-
};
|
|
149
|
-
const rawValue = model.getValue(address);
|
|
150
|
-
const ranges = model.sheet.ranges?.filter(({ range }) => inRange(rangeFromIndex(model.sheet, range), address));
|
|
151
|
-
const threadRefs = void 0;
|
|
152
|
-
const description = model.getValueDescription(address);
|
|
153
|
-
const type = description?.type;
|
|
154
|
-
const format = description?.format;
|
|
155
|
-
const classNames = ranges?.map(cellClassNameForRange).reverse();
|
|
156
|
-
return {
|
|
157
|
-
value: parseValue({
|
|
158
|
-
type,
|
|
159
|
-
format,
|
|
160
|
-
value: rawValue
|
|
161
|
-
}),
|
|
162
|
-
className: mx(cellClassesForFieldType({
|
|
163
|
-
type,
|
|
164
|
-
format
|
|
165
|
-
}), threadRefs && commentedClassName, classNames),
|
|
166
|
-
dataRefs: threadRefs
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
var gridCellGetter = (model) => {
|
|
170
|
-
const cachedGridCells = {};
|
|
171
|
-
return (nextBounds) => {
|
|
172
|
-
[
|
|
173
|
-
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
174
|
-
].forEach((_, c0) => {
|
|
175
|
-
return [
|
|
176
|
-
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
177
|
-
].forEach((_2, r0) => {
|
|
178
|
-
const col = nextBounds.start.col + c0;
|
|
179
|
-
const row = nextBounds.start.row + r0;
|
|
180
|
-
cachedGridCells[`${col},${row}`] = projectCellProps(model, col, row);
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
return cachedGridCells;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
var rowLabelCell = (row) => ({
|
|
187
|
-
value: rowToA1Notation(row),
|
|
188
|
-
className: "!bg-toolbarSurface text-subdued text-end pie-1",
|
|
189
|
-
resizeHandle: "row"
|
|
190
|
-
});
|
|
191
|
-
var colLabelCell = (col) => ({
|
|
192
|
-
value: colToA1Notation(col),
|
|
193
|
-
className: "!bg-toolbarSurface text-subdued",
|
|
194
|
-
resizeHandle: "col"
|
|
195
|
-
});
|
|
196
|
-
var cellGetter = (model) => {
|
|
197
|
-
const getGridCells = gridCellGetter(model);
|
|
198
|
-
return (nextBounds, plane) => {
|
|
199
|
-
switch (plane) {
|
|
200
|
-
case "grid":
|
|
201
|
-
return getGridCells(nextBounds);
|
|
202
|
-
case "fixedStartStart": {
|
|
203
|
-
return {
|
|
204
|
-
"0,0": {
|
|
205
|
-
className: "!bg-toolbarSurface"
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
case "frozenColsStart":
|
|
210
|
-
return [
|
|
211
|
-
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
212
|
-
].reduce((acc, _, r0) => {
|
|
213
|
-
const r = nextBounds.start.row + r0;
|
|
214
|
-
acc[`0,${r}`] = rowLabelCell(r);
|
|
215
|
-
return acc;
|
|
216
|
-
}, {});
|
|
217
|
-
case "frozenRowsStart":
|
|
218
|
-
return [
|
|
219
|
-
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
220
|
-
].reduce((acc, _, c0) => {
|
|
221
|
-
const c = nextBounds.start.col + c0;
|
|
222
|
-
acc[`${c},0`] = colLabelCell(c);
|
|
223
|
-
return acc;
|
|
224
|
-
}, {});
|
|
225
|
-
default:
|
|
226
|
-
return {};
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
var useSheetModelDxGridProps = (dxGrid, model) => {
|
|
231
|
-
const [columns, setColumns] = useState(createDxGridColumns(model));
|
|
232
|
-
const [rows, setRows] = useState(createDxGridRows(model));
|
|
233
|
-
useEffect(() => {
|
|
234
|
-
const cellsAccessor = createDocAccessor(model.sheet, [
|
|
235
|
-
"cells"
|
|
236
|
-
]);
|
|
237
|
-
if (dxGrid) {
|
|
238
|
-
dxGrid.getCells = cellGetter(model);
|
|
239
|
-
}
|
|
240
|
-
const handleCellsUpdate = () => {
|
|
241
|
-
dxGrid?.requestUpdate("initialCells");
|
|
242
|
-
};
|
|
243
|
-
cellsAccessor.handle.addListener("change", handleCellsUpdate);
|
|
244
|
-
const unsubscribe = model.graph.update.on(handleCellsUpdate);
|
|
245
|
-
return () => {
|
|
246
|
-
cellsAccessor.handle.removeListener("change", handleCellsUpdate);
|
|
247
|
-
unsubscribe();
|
|
248
|
-
};
|
|
249
|
-
}, [
|
|
250
|
-
model,
|
|
251
|
-
dxGrid
|
|
252
|
-
]);
|
|
253
|
-
useEffect(() => {
|
|
254
|
-
const columnMetaAccessor = createDocAccessor(model.sheet, [
|
|
255
|
-
"columnMeta"
|
|
256
|
-
]);
|
|
257
|
-
const rowMetaAccessor = createDocAccessor(model.sheet, [
|
|
258
|
-
"rowMeta"
|
|
259
|
-
]);
|
|
260
|
-
const handleColumnMetaUpdate = () => {
|
|
261
|
-
setColumns(createDxGridColumns(model));
|
|
262
|
-
};
|
|
263
|
-
const handleRowMetaUpdate = () => {
|
|
264
|
-
setRows(createDxGridRows(model));
|
|
265
|
-
};
|
|
266
|
-
columnMetaAccessor.handle.addListener("change", handleColumnMetaUpdate);
|
|
267
|
-
rowMetaAccessor.handle.addListener("change", handleRowMetaUpdate);
|
|
268
|
-
return () => {
|
|
269
|
-
columnMetaAccessor.handle.removeListener("change", handleColumnMetaUpdate);
|
|
270
|
-
rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
|
|
271
|
-
};
|
|
272
|
-
}, [
|
|
273
|
-
model,
|
|
274
|
-
dxGrid
|
|
275
|
-
]);
|
|
276
|
-
return {
|
|
277
|
-
columns,
|
|
278
|
-
rows
|
|
279
|
-
};
|
|
280
|
-
};
|
|
109
|
+
import { Grid as Grid2, GridCellEditor, closestCell, editorKeys, parseCellIndex } from "@dxos/react-ui-grid";
|
|
281
110
|
|
|
282
111
|
// src/integrations/thread-ranges.ts
|
|
283
|
-
import
|
|
284
|
-
import
|
|
285
|
-
import {
|
|
112
|
+
import * as Function from "effect/Function";
|
|
113
|
+
import * as Schema2 from "effect/Schema";
|
|
114
|
+
import { useCallback as useCallback2, useEffect, useMemo } from "react";
|
|
115
|
+
import { LayoutAction, chain, createIntent, createResolver, useIntentDispatcher, useIntentResolver } from "@dxos/app-framework";
|
|
286
116
|
import { debounce } from "@dxos/async";
|
|
287
|
-
import { inRange
|
|
117
|
+
import { inRange } from "@dxos/compute";
|
|
288
118
|
import { Obj, Relation } from "@dxos/echo";
|
|
289
119
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from "@dxos/plugin-deck/types";
|
|
290
120
|
import { ThreadAction, ThreadType } from "@dxos/plugin-thread/types";
|
|
291
|
-
import { Filter, fullyQualifiedId, getSpace,
|
|
121
|
+
import { Filter, Query, fullyQualifiedId, getSpace, useQuery } from "@dxos/react-client/echo";
|
|
292
122
|
import { AnchoredTo } from "@dxos/schema";
|
|
293
123
|
var parseThreadAnchorAsCellRange = (cursor) => {
|
|
294
124
|
const coords = cursor.split(",");
|
|
@@ -331,7 +161,7 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
|
331
161
|
model.sheet,
|
|
332
162
|
setActiveRefs
|
|
333
163
|
]);
|
|
334
|
-
useIntentResolver(
|
|
164
|
+
useIntentResolver(meta.id, scrollIntoViewResolver);
|
|
335
165
|
};
|
|
336
166
|
var useSelectThreadOnCellFocus = () => {
|
|
337
167
|
const { model, cursor } = useSheetContext();
|
|
@@ -346,14 +176,14 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
346
176
|
const source = Relation.getSource(anchor);
|
|
347
177
|
if (anchor.anchor && Obj.instanceOf(ThreadType, source)) {
|
|
348
178
|
const range = parseThreadAnchorAsCellRange(anchor.anchor);
|
|
349
|
-
return range ?
|
|
179
|
+
return range ? inRange(range, cellAddress) : false;
|
|
350
180
|
} else {
|
|
351
181
|
return false;
|
|
352
182
|
}
|
|
353
183
|
});
|
|
354
184
|
if (closestThread) {
|
|
355
185
|
const primary = fullyQualifiedId(model.sheet);
|
|
356
|
-
const intent = pipe(createIntent(ThreadAction.Select, {
|
|
186
|
+
const intent = Function.pipe(createIntent(ThreadAction.Select, {
|
|
357
187
|
current: fullyQualifiedId(closestThread)
|
|
358
188
|
}), chain(DeckAction.ChangeCompanion, {
|
|
359
189
|
primary,
|
|
@@ -370,7 +200,7 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
370
200
|
}, [
|
|
371
201
|
selectClosestThread
|
|
372
202
|
]);
|
|
373
|
-
|
|
203
|
+
useEffect(() => {
|
|
374
204
|
if (!cursor) {
|
|
375
205
|
return;
|
|
376
206
|
}
|
|
@@ -383,7 +213,7 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
383
213
|
|
|
384
214
|
// src/components/SheetContext/SheetContext.tsx
|
|
385
215
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
386
|
-
import React3, { createContext as createContext2, useCallback as useCallback3, useContext as useContext2, useState
|
|
216
|
+
import React3, { createContext as createContext2, useCallback as useCallback3, useContext as useContext2, useState } from "react";
|
|
387
217
|
import { invariant } from "@dxos/invariant";
|
|
388
218
|
import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
|
|
389
219
|
import { Grid, useGridContext } from "@dxos/react-ui-grid";
|
|
@@ -406,10 +236,10 @@ var SheetProviderImpl = ({ model, onInfo, ignoreAttention, children, __gridScope
|
|
|
406
236
|
var _effect = _useSignals3();
|
|
407
237
|
try {
|
|
408
238
|
const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
|
|
409
|
-
const [cursor, setCursorInternal] =
|
|
410
|
-
const [range, setRangeInternal] =
|
|
411
|
-
const [cursorFallbackRange, setCursorFallbackRange] =
|
|
412
|
-
const [activeRefs, setActiveRefs] =
|
|
239
|
+
const [cursor, setCursorInternal] = useState();
|
|
240
|
+
const [range, setRangeInternal] = useState();
|
|
241
|
+
const [cursorFallbackRange, setCursorFallbackRange] = useState();
|
|
242
|
+
const [activeRefs, setActiveRefs] = useState("");
|
|
413
243
|
const setCursor = useCallback3((nextCursor) => {
|
|
414
244
|
setCursorInternal(nextCursor);
|
|
415
245
|
setCursorFallbackRange(range?.to ? range : nextCursor ? {
|
|
@@ -468,6 +298,177 @@ var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo
|
|
|
468
298
|
}
|
|
469
299
|
};
|
|
470
300
|
|
|
301
|
+
// src/components/GridSheet/util.ts
|
|
302
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
303
|
+
import { inRange as inRange2 } from "@dxos/compute";
|
|
304
|
+
import { createDocAccessor } from "@dxos/react-client/echo";
|
|
305
|
+
import { cellClassesForFieldType, parseValue } from "@dxos/react-ui-form";
|
|
306
|
+
import { colToA1Notation, commentedClassName, rowToA1Notation } from "@dxos/react-ui-grid";
|
|
307
|
+
import { mx } from "@dxos/react-ui-theme";
|
|
308
|
+
var createDxGridColumns = (model) => {
|
|
309
|
+
return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
|
|
310
|
+
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
311
|
+
acc.grid[numericIndex] = {
|
|
312
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
313
|
+
resizeable: true
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return acc;
|
|
317
|
+
}, {
|
|
318
|
+
grid: {}
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
var createDxGridRows = (model) => {
|
|
322
|
+
return model.sheet.rows.reduce((acc, rowId, numericIndex) => {
|
|
323
|
+
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
324
|
+
acc.grid[numericIndex] = {
|
|
325
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
326
|
+
resizeable: true
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
return acc;
|
|
330
|
+
}, {
|
|
331
|
+
grid: {}
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
var projectCellProps = (model, col, row) => {
|
|
335
|
+
const address = {
|
|
336
|
+
col,
|
|
337
|
+
row
|
|
338
|
+
};
|
|
339
|
+
const rawValue = model.getValue(address);
|
|
340
|
+
const ranges = model.sheet.ranges?.filter(({ range }) => inRange2(rangeFromIndex(model.sheet, range), address));
|
|
341
|
+
const threadRefs = void 0;
|
|
342
|
+
const description = model.getValueDescription(address);
|
|
343
|
+
const type = description?.type;
|
|
344
|
+
const format = description?.format;
|
|
345
|
+
const classNames = ranges?.map(cellClassNameForRange).reverse();
|
|
346
|
+
return {
|
|
347
|
+
value: parseValue({
|
|
348
|
+
type,
|
|
349
|
+
format,
|
|
350
|
+
value: rawValue
|
|
351
|
+
}),
|
|
352
|
+
className: mx(cellClassesForFieldType({
|
|
353
|
+
type,
|
|
354
|
+
format
|
|
355
|
+
}), threadRefs && commentedClassName, classNames),
|
|
356
|
+
dataRefs: threadRefs
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
var gridCellGetter = (model) => {
|
|
360
|
+
const cachedGridCells = {};
|
|
361
|
+
return (nextBounds) => {
|
|
362
|
+
[
|
|
363
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
364
|
+
].forEach((_, c0) => {
|
|
365
|
+
return [
|
|
366
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
367
|
+
].forEach((_2, r0) => {
|
|
368
|
+
const col = nextBounds.start.col + c0;
|
|
369
|
+
const row = nextBounds.start.row + r0;
|
|
370
|
+
cachedGridCells[`${col},${row}`] = projectCellProps(model, col, row);
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
return cachedGridCells;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
var rowLabelCell = (row) => ({
|
|
377
|
+
value: rowToA1Notation(row),
|
|
378
|
+
className: "!bg-toolbarSurface text-subdued text-end pie-1",
|
|
379
|
+
resizeHandle: "row"
|
|
380
|
+
});
|
|
381
|
+
var colLabelCell = (col) => ({
|
|
382
|
+
value: colToA1Notation(col),
|
|
383
|
+
className: "!bg-toolbarSurface text-subdued",
|
|
384
|
+
resizeHandle: "col"
|
|
385
|
+
});
|
|
386
|
+
var cellGetter = (model) => {
|
|
387
|
+
const getGridCells = gridCellGetter(model);
|
|
388
|
+
return (nextBounds, plane) => {
|
|
389
|
+
switch (plane) {
|
|
390
|
+
case "grid":
|
|
391
|
+
return getGridCells(nextBounds);
|
|
392
|
+
case "fixedStartStart": {
|
|
393
|
+
return {
|
|
394
|
+
"0,0": {
|
|
395
|
+
className: "!bg-toolbarSurface"
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
case "frozenColsStart":
|
|
400
|
+
return [
|
|
401
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
402
|
+
].reduce((acc, _, r0) => {
|
|
403
|
+
const r = nextBounds.start.row + r0;
|
|
404
|
+
acc[`0,${r}`] = rowLabelCell(r);
|
|
405
|
+
return acc;
|
|
406
|
+
}, {});
|
|
407
|
+
case "frozenRowsStart":
|
|
408
|
+
return [
|
|
409
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
410
|
+
].reduce((acc, _, c0) => {
|
|
411
|
+
const c = nextBounds.start.col + c0;
|
|
412
|
+
acc[`${c},0`] = colLabelCell(c);
|
|
413
|
+
return acc;
|
|
414
|
+
}, {});
|
|
415
|
+
default:
|
|
416
|
+
return {};
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
var useSheetModelDxGridProps = (dxGrid, model) => {
|
|
421
|
+
const [columns, setColumns] = useState2(createDxGridColumns(model));
|
|
422
|
+
const [rows, setRows] = useState2(createDxGridRows(model));
|
|
423
|
+
useEffect2(() => {
|
|
424
|
+
const cellsAccessor = createDocAccessor(model.sheet, [
|
|
425
|
+
"cells"
|
|
426
|
+
]);
|
|
427
|
+
if (dxGrid) {
|
|
428
|
+
dxGrid.getCells = cellGetter(model);
|
|
429
|
+
}
|
|
430
|
+
const handleCellsUpdate = () => {
|
|
431
|
+
dxGrid?.requestUpdate("initialCells");
|
|
432
|
+
};
|
|
433
|
+
cellsAccessor.handle.addListener("change", handleCellsUpdate);
|
|
434
|
+
const unsubscribe = model.graph.update.on(handleCellsUpdate);
|
|
435
|
+
return () => {
|
|
436
|
+
cellsAccessor.handle.removeListener("change", handleCellsUpdate);
|
|
437
|
+
unsubscribe();
|
|
438
|
+
};
|
|
439
|
+
}, [
|
|
440
|
+
model,
|
|
441
|
+
dxGrid
|
|
442
|
+
]);
|
|
443
|
+
useEffect2(() => {
|
|
444
|
+
const columnMetaAccessor = createDocAccessor(model.sheet, [
|
|
445
|
+
"columnMeta"
|
|
446
|
+
]);
|
|
447
|
+
const rowMetaAccessor = createDocAccessor(model.sheet, [
|
|
448
|
+
"rowMeta"
|
|
449
|
+
]);
|
|
450
|
+
const handleColumnMetaUpdate = () => {
|
|
451
|
+
setColumns(createDxGridColumns(model));
|
|
452
|
+
};
|
|
453
|
+
const handleRowMetaUpdate = () => {
|
|
454
|
+
setRows(createDxGridRows(model));
|
|
455
|
+
};
|
|
456
|
+
columnMetaAccessor.handle.addListener("change", handleColumnMetaUpdate);
|
|
457
|
+
rowMetaAccessor.handle.addListener("change", handleRowMetaUpdate);
|
|
458
|
+
return () => {
|
|
459
|
+
columnMetaAccessor.handle.removeListener("change", handleColumnMetaUpdate);
|
|
460
|
+
rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
|
|
461
|
+
};
|
|
462
|
+
}, [
|
|
463
|
+
model,
|
|
464
|
+
dxGrid
|
|
465
|
+
]);
|
|
466
|
+
return {
|
|
467
|
+
columns,
|
|
468
|
+
rows
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
|
|
471
472
|
// src/components/GridSheet/GridSheet.tsx
|
|
472
473
|
var inertPosition = {
|
|
473
474
|
plane: "grid",
|
|
@@ -496,7 +497,8 @@ var frozen = {
|
|
|
496
497
|
var sheetColDefault = {
|
|
497
498
|
frozenColsStart: {
|
|
498
499
|
size: 48,
|
|
499
|
-
readonly: true
|
|
500
|
+
readonly: true,
|
|
501
|
+
focusUnfurl: false
|
|
500
502
|
},
|
|
501
503
|
grid: {
|
|
502
504
|
size: defaultColSize,
|
|
@@ -506,7 +508,8 @@ var sheetColDefault = {
|
|
|
506
508
|
var sheetRowDefault = {
|
|
507
509
|
frozenRowsStart: {
|
|
508
510
|
size: defaultRowSize,
|
|
509
|
-
readonly: true
|
|
511
|
+
readonly: true,
|
|
512
|
+
focusUnfurl: false
|
|
510
513
|
},
|
|
511
514
|
grid: {
|
|
512
515
|
size: defaultRowSize,
|
|
@@ -516,12 +519,12 @@ var sheetRowDefault = {
|
|
|
516
519
|
var GridSheet = () => {
|
|
517
520
|
var _effect = _useSignals4();
|
|
518
521
|
try {
|
|
519
|
-
const { t } = useTranslation2(
|
|
522
|
+
const { t } = useTranslation2(meta.id);
|
|
520
523
|
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } = useSheetContext();
|
|
521
524
|
const [dxGrid, setDxGrid] = useState3(null);
|
|
522
525
|
const [extraplanarFocus, setExtraplanarFocus] = useState3(null);
|
|
523
526
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
524
|
-
const rangeController = useRef();
|
|
527
|
+
const rangeController = useRef(null);
|
|
525
528
|
const { hasAttention } = useAttention(id);
|
|
526
529
|
const handleFocus = useCallback4((event) => {
|
|
527
530
|
if (!editing) {
|
|
@@ -576,12 +579,14 @@ var GridSheet = () => {
|
|
|
576
579
|
]);
|
|
577
580
|
const handleAxisResize = useCallback4(({ axis, size, index: numericIndex }) => {
|
|
578
581
|
if (axis === "row") {
|
|
582
|
+
var _model_sheet_rowMeta, _rowId;
|
|
579
583
|
const rowId = model.sheet.rows[parseInt(numericIndex)];
|
|
580
|
-
model.sheet.rowMeta[rowId]
|
|
584
|
+
(_model_sheet_rowMeta = model.sheet.rowMeta)[_rowId = rowId] ?? (_model_sheet_rowMeta[_rowId] = {});
|
|
581
585
|
model.sheet.rowMeta[rowId].size = size;
|
|
582
586
|
} else {
|
|
587
|
+
var _model_sheet_columnMeta, _columnId;
|
|
583
588
|
const columnId = model.sheet.columns[parseInt(numericIndex)];
|
|
584
|
-
model.sheet.columnMeta[columnId]
|
|
589
|
+
(_model_sheet_columnMeta = model.sheet.columnMeta)[_columnId = columnId] ?? (_model_sheet_columnMeta[_columnId] = {});
|
|
585
590
|
model.sheet.columnMeta[columnId].size = size;
|
|
586
591
|
}
|
|
587
592
|
}, [
|
|
@@ -738,7 +743,7 @@ var GridSheet = () => {
|
|
|
738
743
|
dispatch
|
|
739
744
|
]);
|
|
740
745
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
741
|
-
const
|
|
746
|
+
const extensions = useMemo2(() => [
|
|
742
747
|
editorKeys({
|
|
743
748
|
onClose: handleClose,
|
|
744
749
|
...editing?.initialContent && {
|
|
@@ -772,10 +777,10 @@ var GridSheet = () => {
|
|
|
772
777
|
// TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
|
|
773
778
|
/* @__PURE__ */ React4.createElement("div", {
|
|
774
779
|
role: "none",
|
|
775
|
-
className: "relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent
|
|
780
|
+
className: "relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent"
|
|
776
781
|
}, /* @__PURE__ */ React4.createElement(GridCellEditor, {
|
|
777
782
|
getCellContent,
|
|
778
|
-
|
|
783
|
+
extensions,
|
|
779
784
|
onBlur: handleBlur
|
|
780
785
|
}), /* @__PURE__ */ React4.createElement(Grid2.Content, {
|
|
781
786
|
initialCells,
|
|
@@ -834,7 +839,7 @@ var GridSheet = () => {
|
|
|
834
839
|
};
|
|
835
840
|
|
|
836
841
|
// src/components/index.ts
|
|
837
|
-
var SheetContainer = lazy(() => import("./SheetContainer-
|
|
842
|
+
var SheetContainer = lazy(() => import("./SheetContainer-NWJ7L6FC.mjs"));
|
|
838
843
|
|
|
839
844
|
export {
|
|
840
845
|
ComputeGraphContextProvider,
|
|
@@ -845,4 +850,4 @@ export {
|
|
|
845
850
|
RangeList,
|
|
846
851
|
SheetContainer
|
|
847
852
|
};
|
|
848
|
-
//# sourceMappingURL=chunk-
|
|
853
|
+
//# sourceMappingURL=chunk-YL7BVJPC.mjs.map
|