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