@dxos/plugin-sheet 0.6.12-staging.e11e696 → 0.6.13-main.09887cd
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-NDNIS44E.mjs +265 -0
- package/dist/lib/browser/SheetContainer-NDNIS44E.mjs.map +7 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs +1614 -0
- package/dist/lib/browser/chunk-AQSGDA4X.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QILRZNE5.mjs → chunk-D3QTX46O.mjs} +4 -5
- package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZMOZKQZ.mjs → chunk-GKI67SEF.mjs} +19 -25
- package/dist/lib/browser/chunk-GKI67SEF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -19
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +4 -8
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs +276 -0
- package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +7 -0
- package/dist/lib/node/chunk-6F43RV45.cjs +1610 -0
- package/dist/lib/node/chunk-6F43RV45.cjs.map +7 -0
- package/dist/lib/node/{chunk-AOP42UAA.cjs → chunk-ER3PM7GD.cjs} +25 -33
- package/dist/lib/node/chunk-ER3PM7GD.cjs.map +7 -0
- package/dist/lib/node/{chunk-BNARJ5GM.cjs → chunk-QIFIGEKV.cjs} +6 -7
- package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
- package/dist/lib/node/index.cjs +36 -40
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +8 -12
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs +266 -0
- package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs +1615 -0
- package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IU2L277A.mjs → chunk-VCYJWE3O.mjs} +4 -5
- package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RR2AO4SM.mjs → chunk-ZVLLQ2PJ.mjs} +19 -25
- package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +14 -19
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types.mjs +4 -8
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +1 -8
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +2 -2
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/index.d.ts +2 -0
- package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/util.d.ts +11 -2
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +6 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +11 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
- package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +27 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/index.d.ts +2 -0
- package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +31 -17
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/index.d.ts +2 -0
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +1 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/threads.d.ts +8 -0
- package/dist/types/src/hooks/threads.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -6
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/{components/Sheet → model}/decorations.d.ts +1 -0
- package/dist/types/src/model/decorations.d.ts.map +1 -0
- package/dist/types/src/model/formatting-model.d.ts +3 -0
- package/dist/types/src/model/formatting-model.d.ts.map +1 -1
- package/dist/types/src/model/index.d.ts +1 -0
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +3 -2
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +13 -28
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +36 -39
- package/src/SheetPlugin.tsx +3 -2
- package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
- package/src/components/FunctionEditor/index.ts +5 -0
- package/src/components/GridSheet/GridSheet.stories.tsx +7 -2
- package/src/components/GridSheet/GridSheet.tsx +77 -69
- package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +2 -2
- package/src/components/{Sheet → GridSheet}/index.ts +1 -1
- package/src/components/GridSheet/util.ts +63 -27
- package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -0
- package/src/components/SheetContainer/SheetContainer.tsx +52 -0
- package/src/components/SheetContainer/index.ts +7 -0
- package/src/components/{Sheet/sheet-context.tsx → SheetContext/SheetContext.tsx} +47 -27
- package/src/components/SheetContext/index.ts +5 -0
- package/src/components/Toolbar/Toolbar.tsx +127 -86
- package/src/components/index.ts +2 -1
- package/src/defs/util.ts +1 -1
- package/src/extensions/compute.stories.tsx +4 -4
- package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
- package/src/extensions/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/{components/Sheet/threads.tsx → hooks/threads.ts} +26 -84
- package/src/{meta.tsx → meta.ts} +3 -3
- package/src/{components/Sheet → model}/decorations.ts +2 -0
- package/src/model/formatting-model.ts +12 -9
- package/src/model/index.ts +1 -0
- package/src/model/sheet-model.test.ts +1 -3
- package/src/model/sheet-model.ts +13 -11
- package/src/types.ts +9 -35
- package/dist/lib/browser/SheetContainer-LG77O4RM.mjs +0 -262
- package/dist/lib/browser/SheetContainer-LG77O4RM.mjs.map +0 -7
- package/dist/lib/browser/chunk-CHQAW4F4.mjs +0 -2705
- package/dist/lib/browser/chunk-CHQAW4F4.mjs.map +0 -7
- package/dist/lib/browser/chunk-QILRZNE5.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZMOZKQZ.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-OZ7DHH4L.cjs +0 -280
- package/dist/lib/node/SheetContainer-OZ7DHH4L.cjs.map +0 -7
- package/dist/lib/node/chunk-5FTFZL5W.cjs +0 -2690
- package/dist/lib/node/chunk-5FTFZL5W.cjs.map +0 -7
- package/dist/lib/node/chunk-AOP42UAA.cjs.map +0 -7
- package/dist/lib/node/chunk-BNARJ5GM.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-4XS2G25Z.mjs +0 -263
- package/dist/lib/node-esm/SheetContainer-4XS2G25Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KK3XL37M.mjs +0 -2706
- package/dist/lib/node-esm/chunk-KK3XL37M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RR2AO4SM.mjs.map +0 -7
- package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -34
- package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/index.d.ts +0 -3
- package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -53
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/decorations.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/grid.d.ts +0 -52
- package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/index.d.ts +0 -2
- package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/nav.d.ts +0 -29
- package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -26
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/threads.d.ts +0 -2
- package/dist/types/src/components/Sheet/threads.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/util.d.ts +0 -18
- package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer.d.ts +0 -8
- package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -20
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/src/components/CellEditor/CellEditor.tsx +0 -163
- package/src/components/Sheet/Sheet.stories.tsx +0 -251
- package/src/components/Sheet/Sheet.tsx +0 -1215
- package/src/components/Sheet/grid.ts +0 -191
- package/src/components/Sheet/nav.ts +0 -157
- package/src/components/Sheet/util.ts +0 -56
- package/src/components/SheetContainer.tsx +0 -86
- package/src/components/Toolbar/common.tsx +0 -72
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +0 -0
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
- /package/src/{components/CellEditor → extensions/editor}/extension.test.ts +0 -0
- /package/src/{components/CellEditor → extensions/editor}/extension.ts +0 -0
|
@@ -0,0 +1,1610 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_6F43RV45_exports = {};
|
|
30
|
+
__export(chunk_6F43RV45_exports, {
|
|
31
|
+
ComputeGraphContextProvider: () => ComputeGraphContextProvider,
|
|
32
|
+
GridSheet: () => GridSheet,
|
|
33
|
+
SheetContainer: () => SheetContainer,
|
|
34
|
+
SheetProvider: () => SheetProvider,
|
|
35
|
+
addressToA1Notation: () => addressToA1Notation,
|
|
36
|
+
addressToIndex: () => addressToIndex,
|
|
37
|
+
compareIndexPositions: () => compareIndexPositions,
|
|
38
|
+
computeGraphFacet: () => computeGraphFacet,
|
|
39
|
+
createSheet: () => createSheet,
|
|
40
|
+
rangeToA1Notation: () => rangeToA1Notation,
|
|
41
|
+
useComputeGraph: () => useComputeGraph,
|
|
42
|
+
useSheetContext: () => useSheetContext
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(chunk_6F43RV45_exports);
|
|
45
|
+
var import_chunk_ER3PM7GD = require("./chunk-ER3PM7GD.cjs");
|
|
46
|
+
var import_chunk_QIFIGEKV = require("./chunk-QIFIGEKV.cjs");
|
|
47
|
+
var import_chunk_5XPK2V4A = require("./chunk-5XPK2V4A.cjs");
|
|
48
|
+
var import_react = __toESM(require("react"));
|
|
49
|
+
var import_crypto = require("@dxos/crypto");
|
|
50
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
51
|
+
var import_invariant = require("@dxos/invariant");
|
|
52
|
+
var import_language = require("@codemirror/language");
|
|
53
|
+
var import_state = require("@codemirror/state");
|
|
54
|
+
var import_view = require("@codemirror/view");
|
|
55
|
+
var import_async = require("@dxos/async");
|
|
56
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
57
|
+
var import_state2 = require("@dxos/react-ui-editor/state");
|
|
58
|
+
var import_autocomplete = require("@codemirror/autocomplete");
|
|
59
|
+
var import_language2 = require("@codemirror/language");
|
|
60
|
+
var import_view2 = require("@codemirror/view");
|
|
61
|
+
var import_highlight = require("@lezer/highlight");
|
|
62
|
+
var import_codemirror_lang_spreadsheet = require("codemirror-lang-spreadsheet");
|
|
63
|
+
var import_state3 = require("@dxos/react-ui-editor/state");
|
|
64
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
65
|
+
var import_react2 = require("react");
|
|
66
|
+
var import_debug = require("@dxos/debug");
|
|
67
|
+
var import_react_hooks = require("@dxos/react-hooks");
|
|
68
|
+
var import_react3 = __toESM(require("react"));
|
|
69
|
+
var import_react4 = __toESM(require("react"));
|
|
70
|
+
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
71
|
+
var import_react_ui_grid = require("@dxos/react-ui-grid");
|
|
72
|
+
var import_react5 = require("react");
|
|
73
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
74
|
+
var import_react_ui_grid2 = require("@dxos/react-ui-grid");
|
|
75
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
76
|
+
var import_react6 = require("react");
|
|
77
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
78
|
+
var import_schema = require("@dxos/schema");
|
|
79
|
+
var import_async2 = require("@dxos/async");
|
|
80
|
+
var import_context = require("@dxos/context");
|
|
81
|
+
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
82
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
83
|
+
var import_keys = require("@dxos/keys");
|
|
84
|
+
var import_log = require("@dxos/log");
|
|
85
|
+
var import_schema2 = require("@dxos/schema");
|
|
86
|
+
var import_hyperformula = require("#hyperformula");
|
|
87
|
+
var import_react7 = require("react");
|
|
88
|
+
var import_signals_core = require("@preact/signals-core");
|
|
89
|
+
var import_react8 = require("react");
|
|
90
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
91
|
+
var import_async3 = require("@dxos/async");
|
|
92
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
93
|
+
var import_react9 = __toESM(require("react"));
|
|
94
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
95
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
96
|
+
var import_react_ui_grid3 = require("@dxos/react-ui-grid");
|
|
97
|
+
var ComputeGraphContext = /* @__PURE__ */ (0, import_react.createContext)(void 0);
|
|
98
|
+
var ComputeGraphContextProvider = ({ registry, children }) => {
|
|
99
|
+
return /* @__PURE__ */ import_react.default.createElement(ComputeGraphContext.Provider, {
|
|
100
|
+
value: {
|
|
101
|
+
registry
|
|
102
|
+
}
|
|
103
|
+
}, children);
|
|
104
|
+
};
|
|
105
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/defs/types.ts";
|
|
106
|
+
var DEFAULT_ROWS = 50;
|
|
107
|
+
var DEFAULT_COLUMNS = 26;
|
|
108
|
+
var MAX_ROWS = 500;
|
|
109
|
+
var MAX_COLUMNS = 26 * 2;
|
|
110
|
+
var posEquals = (a, b) => {
|
|
111
|
+
return a?.col === b?.col && a?.row === b?.row;
|
|
112
|
+
};
|
|
113
|
+
var columnLetter = (col) => {
|
|
114
|
+
(0, import_invariant.invariant)(col < MAX_COLUMNS, `Invalid column: ${col}`, {
|
|
115
|
+
F: __dxlog_file,
|
|
116
|
+
L: 26,
|
|
117
|
+
S: void 0,
|
|
118
|
+
A: [
|
|
119
|
+
"col < MAX_COLUMNS",
|
|
120
|
+
"`Invalid column: ${col}`"
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
|
|
124
|
+
};
|
|
125
|
+
var addressToA1Notation = ({ col, row }) => {
|
|
126
|
+
return `${columnLetter(col)}${row + 1}`;
|
|
127
|
+
};
|
|
128
|
+
var addressFromA1Notation = (ref) => {
|
|
129
|
+
const match = ref.match(/([A-Z]+)(\d+)/);
|
|
130
|
+
(0, import_invariant.invariant)(match, `Invalid notation: ${ref}`, {
|
|
131
|
+
F: __dxlog_file,
|
|
132
|
+
L: 40,
|
|
133
|
+
S: void 0,
|
|
134
|
+
A: [
|
|
135
|
+
"match",
|
|
136
|
+
"`Invalid notation: ${ref}`"
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
row: parseInt(match[2], 10) - 1,
|
|
141
|
+
col: match[1].split("").reduce((acc, c) => acc * 26 + c.charCodeAt(0) - "A".charCodeAt(0) + 1, 0) - 1
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
var rangeToA1Notation = (range) => {
|
|
145
|
+
return [
|
|
146
|
+
range?.from && addressToA1Notation(range?.from),
|
|
147
|
+
range?.to && addressToA1Notation(range?.to)
|
|
148
|
+
].filter(Boolean).join(":");
|
|
149
|
+
};
|
|
150
|
+
var inRange = (range, cell) => {
|
|
151
|
+
if (!range) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const { from, to } = range;
|
|
155
|
+
if (from && posEquals(from, cell) || to && posEquals(to, cell)) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
if (!from || !to) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
const { col: c1, row: r1 } = from;
|
|
162
|
+
const { col: c2, row: r2 } = to;
|
|
163
|
+
const cMin = Math.min(c1, c2);
|
|
164
|
+
const cMax = Math.max(c1, c2);
|
|
165
|
+
const rMin = Math.min(r1, r2);
|
|
166
|
+
const rMax = Math.max(r1, r2);
|
|
167
|
+
const { col, row } = cell;
|
|
168
|
+
return col >= cMin && col <= cMax && row >= rMin && row <= rMax;
|
|
169
|
+
};
|
|
170
|
+
var ApiError = class extends Error {
|
|
171
|
+
};
|
|
172
|
+
var ReadonlyException = class extends ApiError {
|
|
173
|
+
};
|
|
174
|
+
var RangeException = class extends ApiError {
|
|
175
|
+
constructor(n) {
|
|
176
|
+
super();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var createIndex = (length = 8) => {
|
|
180
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
181
|
+
const charactersLength = characters.length;
|
|
182
|
+
const randomBuffer = (0, import_crypto.randomBytes)(length);
|
|
183
|
+
return Array.from(randomBuffer, (byte) => characters[byte % charactersLength]).join("");
|
|
184
|
+
};
|
|
185
|
+
var createIndices = (length) => Array.from({
|
|
186
|
+
length
|
|
187
|
+
}).map(() => createIndex());
|
|
188
|
+
var insertIndices = (indices, i, n, max) => {
|
|
189
|
+
if (i + n > max) {
|
|
190
|
+
throw new RangeException(i + n);
|
|
191
|
+
}
|
|
192
|
+
const idx = createIndices(n);
|
|
193
|
+
indices.splice(i, 0, ...idx);
|
|
194
|
+
};
|
|
195
|
+
var initialize = (sheet, { rows = DEFAULT_ROWS, columns = DEFAULT_COLUMNS } = {}) => {
|
|
196
|
+
if (!sheet.rows.length) {
|
|
197
|
+
insertIndices(sheet.rows, 0, rows, MAX_ROWS);
|
|
198
|
+
}
|
|
199
|
+
if (!sheet.columns.length) {
|
|
200
|
+
insertIndices(sheet.columns, 0, columns, MAX_COLUMNS);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var createSheet = ({ name, cells, ...size } = {}) => {
|
|
204
|
+
const sheet = (0, import_echo_schema.create)(import_chunk_ER3PM7GD.SheetType, {
|
|
205
|
+
name,
|
|
206
|
+
cells: {},
|
|
207
|
+
rows: [],
|
|
208
|
+
columns: [],
|
|
209
|
+
rowMeta: {},
|
|
210
|
+
columnMeta: {},
|
|
211
|
+
formatting: []
|
|
212
|
+
});
|
|
213
|
+
initialize(sheet, size);
|
|
214
|
+
if (cells) {
|
|
215
|
+
Object.entries(cells).forEach(([key, { value }]) => {
|
|
216
|
+
const idx = addressToIndex(sheet, addressFromA1Notation(key));
|
|
217
|
+
sheet.cells[idx] = {
|
|
218
|
+
value
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return sheet;
|
|
223
|
+
};
|
|
224
|
+
var addressToIndex = (sheet, cell) => {
|
|
225
|
+
return `${sheet.columns[cell.col]}@${sheet.rows[cell.row]}`;
|
|
226
|
+
};
|
|
227
|
+
var addressFromIndex = (sheet, idx) => {
|
|
228
|
+
const [column, row] = idx.split("@");
|
|
229
|
+
return {
|
|
230
|
+
col: sheet.columns.indexOf(column),
|
|
231
|
+
row: sheet.rows.indexOf(row)
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
var rangeFromIndex = (sheet, idx) => {
|
|
235
|
+
const [from, to] = idx.split(":").map((index) => addressFromIndex(sheet, index));
|
|
236
|
+
return {
|
|
237
|
+
from,
|
|
238
|
+
to
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
var closest = (cursor, cells) => {
|
|
242
|
+
let closestCell2;
|
|
243
|
+
let closestDistance = Number.MAX_SAFE_INTEGER;
|
|
244
|
+
for (const cell of cells) {
|
|
245
|
+
const distance = Math.abs(cell.row - cursor.row) + Math.abs(cell.col - cursor.col);
|
|
246
|
+
if (distance < closestDistance) {
|
|
247
|
+
closestCell2 = cell;
|
|
248
|
+
closestDistance = distance;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return closestCell2;
|
|
252
|
+
};
|
|
253
|
+
var compareIndexPositions = (sheet, indexA, indexB) => {
|
|
254
|
+
const { row: rowA, col: columnA } = addressFromIndex(sheet, indexA);
|
|
255
|
+
const { row: rowB, col: columnB } = addressFromIndex(sheet, indexB);
|
|
256
|
+
if (rowA !== rowB) {
|
|
257
|
+
return rowA - rowB;
|
|
258
|
+
} else {
|
|
259
|
+
return columnA - columnB;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var updateAllDecorations = import_state.StateEffect.define();
|
|
263
|
+
var computeGraphFacet = (0, import_state2.singleValueFacet)();
|
|
264
|
+
var highlightStyles = import_language2.HighlightStyle.define([
|
|
265
|
+
// Function.
|
|
266
|
+
{
|
|
267
|
+
tag: import_highlight.tags.name,
|
|
268
|
+
class: "text-accentText"
|
|
269
|
+
},
|
|
270
|
+
// Range.
|
|
271
|
+
{
|
|
272
|
+
tag: import_highlight.tags.tagName,
|
|
273
|
+
class: "text-pinkText"
|
|
274
|
+
},
|
|
275
|
+
// Values.
|
|
276
|
+
{
|
|
277
|
+
tag: import_highlight.tags.number,
|
|
278
|
+
class: "text-tealText"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
tag: import_highlight.tags.bool,
|
|
282
|
+
class: "text-tealText"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
tag: import_highlight.tags.string,
|
|
286
|
+
class: "text-tealText"
|
|
287
|
+
},
|
|
288
|
+
// Error.
|
|
289
|
+
{
|
|
290
|
+
tag: import_highlight.tags.invalid,
|
|
291
|
+
class: "text-unAccent"
|
|
292
|
+
}
|
|
293
|
+
]);
|
|
294
|
+
var languageFacet = (0, import_state3.singleValueFacet)();
|
|
295
|
+
var sheetExtension = ({ functions = [] }) => {
|
|
296
|
+
const { extension, language } = (0, import_codemirror_lang_spreadsheet.spreadsheet)({
|
|
297
|
+
idiom: "en-US",
|
|
298
|
+
decimalSeparator: "."
|
|
299
|
+
});
|
|
300
|
+
const createCompletion = (name) => {
|
|
301
|
+
const { section = "Custom", description, syntax } = functions.find((value) => value.name === name) ?? {};
|
|
302
|
+
return {
|
|
303
|
+
section,
|
|
304
|
+
label: name,
|
|
305
|
+
info: () => {
|
|
306
|
+
if (!description && !syntax) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
const root = document.createElement("div");
|
|
310
|
+
root.className = "flex flex-col gap-2 text-sm";
|
|
311
|
+
const title = document.createElement("h2");
|
|
312
|
+
title.innerText = name;
|
|
313
|
+
title.className = "text-lg font-mono text-accentText";
|
|
314
|
+
root.appendChild(title);
|
|
315
|
+
if (description) {
|
|
316
|
+
const info = document.createElement("p");
|
|
317
|
+
info.innerText = description;
|
|
318
|
+
info.className = "text-subdued";
|
|
319
|
+
root.appendChild(info);
|
|
320
|
+
}
|
|
321
|
+
if (syntax) {
|
|
322
|
+
const detail = document.createElement("pre");
|
|
323
|
+
detail.innerText = syntax;
|
|
324
|
+
detail.className = "whitespace-pre-wrap text-greenText";
|
|
325
|
+
root.appendChild(detail);
|
|
326
|
+
}
|
|
327
|
+
return root;
|
|
328
|
+
},
|
|
329
|
+
apply: (view, completion, from, to) => {
|
|
330
|
+
const insertParens = to === view.state.doc.toString().length;
|
|
331
|
+
view.dispatch(view.state.update({
|
|
332
|
+
changes: {
|
|
333
|
+
from,
|
|
334
|
+
to,
|
|
335
|
+
insert: completion.label + (insertParens ? "()" : "")
|
|
336
|
+
},
|
|
337
|
+
selection: {
|
|
338
|
+
anchor: from + completion.label.length + 1
|
|
339
|
+
}
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
return [
|
|
345
|
+
extension,
|
|
346
|
+
languageFacet.of(language),
|
|
347
|
+
language.data.of({
|
|
348
|
+
autocomplete: (context) => {
|
|
349
|
+
if (context.state.doc.toString()[0] !== "=") {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
const match = context.matchBefore(/\w*/);
|
|
353
|
+
if (!match || match.from === match.to) {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
const text = match.text.toUpperCase();
|
|
357
|
+
if (!context.explicit && match.text.length < 2) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
from: match.from,
|
|
362
|
+
options: functions?.filter(({ name }) => name.startsWith(text)).map(({ name }) => createCompletion(name)) ?? []
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
}),
|
|
366
|
+
(0, import_language2.syntaxHighlighting)(highlightStyles),
|
|
367
|
+
(0, import_autocomplete.autocompletion)({
|
|
368
|
+
aboveCursor: false,
|
|
369
|
+
defaultKeymap: true,
|
|
370
|
+
activateOnTyping: true,
|
|
371
|
+
// NOTE: Useful for debugging.
|
|
372
|
+
closeOnBlur: false,
|
|
373
|
+
icons: false,
|
|
374
|
+
tooltipClass: () => (0, import_react_ui_theme.mx)("!-left-[1px] !top-[33px] !-m-0 border !border-t-0 [&>ul]:!min-w-[198px]", "[&>ul>li[aria-selected]]:!bg-accentSurface", "border-separator")
|
|
375
|
+
}),
|
|
376
|
+
import_view2.keymap.of([
|
|
377
|
+
{
|
|
378
|
+
key: "Tab",
|
|
379
|
+
run: (view) => {
|
|
380
|
+
return (0, import_autocomplete.completionStatus)(view.state) === "active" ? (0, import_autocomplete.acceptCompletion)(view) : (0, import_autocomplete.startCompletion)(view);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
])
|
|
384
|
+
];
|
|
385
|
+
};
|
|
386
|
+
var rangeExtension = (onInit) => {
|
|
387
|
+
let view;
|
|
388
|
+
let activeRange;
|
|
389
|
+
const provider = (range) => {
|
|
390
|
+
if (activeRange) {
|
|
391
|
+
view.dispatch(view.state.update({
|
|
392
|
+
changes: {
|
|
393
|
+
...activeRange,
|
|
394
|
+
insert: range.toString()
|
|
395
|
+
},
|
|
396
|
+
selection: {
|
|
397
|
+
anchor: activeRange.from + range.length
|
|
398
|
+
}
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
view.focus();
|
|
402
|
+
};
|
|
403
|
+
return import_view2.ViewPlugin.fromClass(class {
|
|
404
|
+
constructor(_view) {
|
|
405
|
+
view = _view;
|
|
406
|
+
onInit(provider);
|
|
407
|
+
}
|
|
408
|
+
update(view2) {
|
|
409
|
+
const { anchor } = view2.state.selection.ranges[0];
|
|
410
|
+
activeRange = void 0;
|
|
411
|
+
const language = view2.state.facet(languageFacet);
|
|
412
|
+
const { topNode } = language.parser.parse(view2.state.doc.toString());
|
|
413
|
+
visitTree(topNode, ({ type, from, to }) => {
|
|
414
|
+
if (from <= anchor && to >= anchor) {
|
|
415
|
+
switch (type.name) {
|
|
416
|
+
case "Function": {
|
|
417
|
+
activeRange = {
|
|
418
|
+
from: to,
|
|
419
|
+
to
|
|
420
|
+
};
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
case "CloseParen": {
|
|
424
|
+
activeRange = {
|
|
425
|
+
from,
|
|
426
|
+
to: from
|
|
427
|
+
};
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
case "RangeToken":
|
|
431
|
+
case "CellToken":
|
|
432
|
+
activeRange = {
|
|
433
|
+
from,
|
|
434
|
+
to
|
|
435
|
+
};
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return false;
|
|
440
|
+
});
|
|
441
|
+
if (!activeRange && view2.state.doc.toString()[0] === "=") {
|
|
442
|
+
activeRange = {
|
|
443
|
+
from: 1,
|
|
444
|
+
to: view2.state.doc.toString().length
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
var visitTree = (node, callback) => {
|
|
451
|
+
if (callback(node)) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
for (let child = node.firstChild; child !== null; child = child.nextSibling) {
|
|
455
|
+
if (visitTree(child, callback)) {
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return false;
|
|
460
|
+
};
|
|
461
|
+
var dxGridCellIndexToSheetCellAddress = (index) => {
|
|
462
|
+
const [colStr, rowStr] = index.split(",");
|
|
463
|
+
return {
|
|
464
|
+
col: parseInt(colStr),
|
|
465
|
+
row: parseInt(rowStr)
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
var createDxGridColumns = (model) => {
|
|
469
|
+
return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
|
|
470
|
+
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
471
|
+
acc.grid[numericIndex] = {
|
|
472
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
473
|
+
resizeable: true
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
return acc;
|
|
477
|
+
}, {
|
|
478
|
+
grid: {}
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
var createDxGridRows = (model) => {
|
|
482
|
+
return model.sheet.rows.reduce((acc, rowId, numericIndex) => {
|
|
483
|
+
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
484
|
+
acc.grid[numericIndex] = {
|
|
485
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
486
|
+
resizeable: true
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return acc;
|
|
490
|
+
}, {
|
|
491
|
+
grid: {}
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
var gridCellGetter = (model, formatting) => {
|
|
495
|
+
const cachedGridCells = {};
|
|
496
|
+
return (nextBounds) => {
|
|
497
|
+
[
|
|
498
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
499
|
+
].forEach((_, c0) => {
|
|
500
|
+
return [
|
|
501
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
502
|
+
].forEach((_2, r0) => {
|
|
503
|
+
const col = nextBounds.start.col + c0;
|
|
504
|
+
const row = nextBounds.start.row + r0;
|
|
505
|
+
const cell = formatting.getFormatting({
|
|
506
|
+
col,
|
|
507
|
+
row
|
|
508
|
+
});
|
|
509
|
+
if (cell.value) {
|
|
510
|
+
cachedGridCells;
|
|
511
|
+
cachedGridCells[`${col},${row}`] = {
|
|
512
|
+
value: cell.value,
|
|
513
|
+
className: (0, import_react_ui_theme2.mx)(cell.classNames)
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
return cachedGridCells;
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
var rowLabelCell = (row) => ({
|
|
522
|
+
value: (0, import_react_ui_grid2.rowToA1Notation)(row),
|
|
523
|
+
className: "text-end !pie-1",
|
|
524
|
+
resizeHandle: "row"
|
|
525
|
+
});
|
|
526
|
+
var colLabelCell = (col) => ({
|
|
527
|
+
value: (0, import_react_ui_grid2.colToA1Notation)(col),
|
|
528
|
+
resizeHandle: "col"
|
|
529
|
+
});
|
|
530
|
+
var cellGetter = (model, formatting) => {
|
|
531
|
+
const getGridCells = gridCellGetter(model, formatting);
|
|
532
|
+
return (nextBounds, plane) => {
|
|
533
|
+
switch (plane) {
|
|
534
|
+
case "grid":
|
|
535
|
+
return getGridCells(nextBounds);
|
|
536
|
+
case "frozenColsStart":
|
|
537
|
+
return [
|
|
538
|
+
...Array(nextBounds.end.row - nextBounds.start.row)
|
|
539
|
+
].reduce((acc, _, r0) => {
|
|
540
|
+
const r = nextBounds.start.row + r0;
|
|
541
|
+
acc[`0,${r}`] = rowLabelCell(r);
|
|
542
|
+
return acc;
|
|
543
|
+
}, {});
|
|
544
|
+
case "frozenRowsStart":
|
|
545
|
+
return [
|
|
546
|
+
...Array(nextBounds.end.col - nextBounds.start.col)
|
|
547
|
+
].reduce((acc, _, c0) => {
|
|
548
|
+
const c = nextBounds.start.col + c0;
|
|
549
|
+
acc[`${c},0`] = colLabelCell(c);
|
|
550
|
+
return acc;
|
|
551
|
+
}, {});
|
|
552
|
+
default:
|
|
553
|
+
return {};
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
var useSheetModelDxGridProps = (dxGridRef, model, formatting) => {
|
|
558
|
+
const [columns, setColumns] = (0, import_react5.useState)(createDxGridColumns(model));
|
|
559
|
+
const [rows, setRows] = (0, import_react5.useState)(createDxGridColumns(model));
|
|
560
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
561
|
+
const cellsAccessor = (0, import_echo.createDocAccessor)(model.sheet, [
|
|
562
|
+
"cells"
|
|
563
|
+
]);
|
|
564
|
+
if (dxGridRef.current) {
|
|
565
|
+
dxGridRef.current.getCells = cellGetter(model, formatting);
|
|
566
|
+
}
|
|
567
|
+
const handleCellsUpdate = () => {
|
|
568
|
+
dxGridRef.current?.requestUpdate("initialCells");
|
|
569
|
+
};
|
|
570
|
+
cellsAccessor.handle.addListener("change", handleCellsUpdate);
|
|
571
|
+
return () => cellsAccessor.handle.removeListener("change", handleCellsUpdate);
|
|
572
|
+
}, [
|
|
573
|
+
model,
|
|
574
|
+
formatting
|
|
575
|
+
]);
|
|
576
|
+
(0, import_react5.useEffect)(() => {
|
|
577
|
+
const columnMetaAccessor = (0, import_echo.createDocAccessor)(model.sheet, [
|
|
578
|
+
"columnMeta"
|
|
579
|
+
]);
|
|
580
|
+
const rowMetaAccessor = (0, import_echo.createDocAccessor)(model.sheet, [
|
|
581
|
+
"rowMeta"
|
|
582
|
+
]);
|
|
583
|
+
const handleColumnMetaUpdate = () => {
|
|
584
|
+
setColumns(createDxGridColumns(model));
|
|
585
|
+
};
|
|
586
|
+
const handleRowMetaUpdate = () => {
|
|
587
|
+
setRows(createDxGridRows(model));
|
|
588
|
+
};
|
|
589
|
+
columnMetaAccessor.handle.addListener("change", handleColumnMetaUpdate);
|
|
590
|
+
rowMetaAccessor.handle.addListener("change", handleRowMetaUpdate);
|
|
591
|
+
return () => {
|
|
592
|
+
columnMetaAccessor.handle.removeListener("change", handleColumnMetaUpdate);
|
|
593
|
+
rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
|
|
594
|
+
};
|
|
595
|
+
}, [
|
|
596
|
+
model
|
|
597
|
+
]);
|
|
598
|
+
return {
|
|
599
|
+
columns,
|
|
600
|
+
rows
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
var createDecorations = () => {
|
|
604
|
+
const { decorations } = (0, import_echo_schema2.create)({
|
|
605
|
+
decorations: {}
|
|
606
|
+
});
|
|
607
|
+
const addDecoration = (cellIndex, decorator) => {
|
|
608
|
+
decorations[cellIndex] = [
|
|
609
|
+
...decorations[cellIndex] || [],
|
|
610
|
+
decorator
|
|
611
|
+
];
|
|
612
|
+
};
|
|
613
|
+
const removeDecoration = (cellIndex, type) => {
|
|
614
|
+
if (type) {
|
|
615
|
+
decorations[cellIndex] = (decorations[cellIndex] || []).filter((d) => d.type !== type);
|
|
616
|
+
} else {
|
|
617
|
+
delete decorations[cellIndex];
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
const getDecorationsForCell = (cellIndex) => {
|
|
621
|
+
return decorations[cellIndex];
|
|
622
|
+
};
|
|
623
|
+
const getAllDecorations = () => {
|
|
624
|
+
const result = [];
|
|
625
|
+
for (const decoratorArray of Object.values(decorations)) {
|
|
626
|
+
for (const decorator of decoratorArray) {
|
|
627
|
+
result.push(decorator);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return result;
|
|
631
|
+
};
|
|
632
|
+
return {
|
|
633
|
+
addDecoration,
|
|
634
|
+
removeDecoration,
|
|
635
|
+
getDecorationsForCell,
|
|
636
|
+
getAllDecorations
|
|
637
|
+
};
|
|
638
|
+
};
|
|
639
|
+
var FormattingModel = class {
|
|
640
|
+
constructor(_model) {
|
|
641
|
+
this._model = _model;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Get formatted string value and className for cell.
|
|
645
|
+
*/
|
|
646
|
+
getFormatting(cell) {
|
|
647
|
+
const value = this._model.getValue(cell);
|
|
648
|
+
if (value === void 0 || value === null) {
|
|
649
|
+
return {};
|
|
650
|
+
}
|
|
651
|
+
const locales = void 0;
|
|
652
|
+
const idx = addressToIndex(this._model.sheet, cell);
|
|
653
|
+
let formatting = this._model.sheet.formatting.find?.(({ range }) => range === idx);
|
|
654
|
+
const classNames = [
|
|
655
|
+
...formatting?.classNames ?? []
|
|
656
|
+
];
|
|
657
|
+
for (const [idx2, _formatting] of Object.entries(this._model.sheet.formatting)) {
|
|
658
|
+
const range = rangeFromIndex(this._model.sheet, idx2);
|
|
659
|
+
if (inRange(range, cell)) {
|
|
660
|
+
if (_formatting.classNames) {
|
|
661
|
+
classNames.push(..._formatting.classNames);
|
|
662
|
+
}
|
|
663
|
+
if (_formatting.type) {
|
|
664
|
+
formatting = _formatting;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const defaultNumber = "justify-end font-mono";
|
|
669
|
+
const type = formatting?.type ?? this._model.getValueType(cell);
|
|
670
|
+
switch (type) {
|
|
671
|
+
case import_schema.FieldValueType.Boolean: {
|
|
672
|
+
return {
|
|
673
|
+
value: value.toLocaleString().toUpperCase(),
|
|
674
|
+
classNames: [
|
|
675
|
+
...classNames,
|
|
676
|
+
value ? "!text-greenText" : "!text-orangeText"
|
|
677
|
+
]
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
//
|
|
681
|
+
// Numbers.
|
|
682
|
+
//
|
|
683
|
+
case import_schema.FieldValueType.Number: {
|
|
684
|
+
return {
|
|
685
|
+
value: value.toLocaleString(locales),
|
|
686
|
+
classNames: [
|
|
687
|
+
...classNames,
|
|
688
|
+
defaultNumber
|
|
689
|
+
]
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
case import_schema.FieldValueType.Percent: {
|
|
693
|
+
return {
|
|
694
|
+
value: value * 100 + "%",
|
|
695
|
+
classNames: [
|
|
696
|
+
...classNames,
|
|
697
|
+
defaultNumber
|
|
698
|
+
]
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
case import_schema.FieldValueType.Currency: {
|
|
702
|
+
return {
|
|
703
|
+
value: value.toLocaleString(locales, {
|
|
704
|
+
style: "currency",
|
|
705
|
+
currency: "USD",
|
|
706
|
+
minimumFractionDigits: 2,
|
|
707
|
+
maximumFractionDigits: 2
|
|
708
|
+
}),
|
|
709
|
+
classNames: [
|
|
710
|
+
...classNames,
|
|
711
|
+
defaultNumber
|
|
712
|
+
]
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
//
|
|
716
|
+
// Dates.
|
|
717
|
+
//
|
|
718
|
+
case import_schema.FieldValueType.DateTime: {
|
|
719
|
+
const date = this._model.toLocalDate(value);
|
|
720
|
+
return {
|
|
721
|
+
value: date.toLocaleString(locales),
|
|
722
|
+
classNames
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
case import_schema.FieldValueType.Date: {
|
|
726
|
+
const date = this._model.toLocalDate(value);
|
|
727
|
+
return {
|
|
728
|
+
value: date.toLocaleDateString(locales),
|
|
729
|
+
classNames
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
case import_schema.FieldValueType.Time: {
|
|
733
|
+
const date = this._model.toLocalDate(value);
|
|
734
|
+
return {
|
|
735
|
+
value: date.toLocaleTimeString(locales),
|
|
736
|
+
classNames
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
default: {
|
|
740
|
+
return {
|
|
741
|
+
value: String(value),
|
|
742
|
+
classNames
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
|
|
749
|
+
var typeMap = {
|
|
750
|
+
BOOLEAN: import_schema2.FieldValueType.Boolean,
|
|
751
|
+
NUMBER_RAW: import_schema2.FieldValueType.Number,
|
|
752
|
+
NUMBER_PERCENT: import_schema2.FieldValueType.Percent,
|
|
753
|
+
NUMBER_CURRENCY: import_schema2.FieldValueType.Currency,
|
|
754
|
+
NUMBER_DATETIME: import_schema2.FieldValueType.DateTime,
|
|
755
|
+
NUMBER_DATE: import_schema2.FieldValueType.Date,
|
|
756
|
+
NUMBER_TIME: import_schema2.FieldValueType.Time
|
|
757
|
+
};
|
|
758
|
+
var getTopLeft = (range) => {
|
|
759
|
+
const to = range.to ?? range.from;
|
|
760
|
+
return {
|
|
761
|
+
row: Math.min(range.from.row, to.row),
|
|
762
|
+
col: Math.min(range.from.col, to.col)
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
var toSimpleCellAddress = (sheet, cell) => ({
|
|
766
|
+
sheet,
|
|
767
|
+
row: cell.row,
|
|
768
|
+
col: cell.col
|
|
769
|
+
});
|
|
770
|
+
var toModelRange = (sheet, range) => ({
|
|
771
|
+
start: toSimpleCellAddress(sheet, range.from),
|
|
772
|
+
end: toSimpleCellAddress(sheet, range.to ?? range.from)
|
|
773
|
+
});
|
|
774
|
+
var SheetModel = class extends import_context.Resource {
|
|
775
|
+
constructor(_graph, _sheet, _options = {}) {
|
|
776
|
+
super();
|
|
777
|
+
this._graph = _graph;
|
|
778
|
+
this._sheet = _sheet;
|
|
779
|
+
this._options = _options;
|
|
780
|
+
this.id = `model-${import_keys.PublicKey.random().truncate()}`;
|
|
781
|
+
this.update = new import_async2.Event();
|
|
782
|
+
}
|
|
783
|
+
get graph() {
|
|
784
|
+
return this._graph;
|
|
785
|
+
}
|
|
786
|
+
get sheet() {
|
|
787
|
+
return this._sheet;
|
|
788
|
+
}
|
|
789
|
+
get readonly() {
|
|
790
|
+
return this._options.readonly;
|
|
791
|
+
}
|
|
792
|
+
get bounds() {
|
|
793
|
+
return {
|
|
794
|
+
rows: this._sheet.rows.length,
|
|
795
|
+
columns: this._sheet.columns.length
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Initialize sheet and engine.
|
|
800
|
+
*/
|
|
801
|
+
async _open() {
|
|
802
|
+
(0, import_log.log)("initialize", {
|
|
803
|
+
id: this.id
|
|
804
|
+
}, {
|
|
805
|
+
F: __dxlog_file2,
|
|
806
|
+
L: 106,
|
|
807
|
+
S: this,
|
|
808
|
+
C: (f, a) => f(...a)
|
|
809
|
+
});
|
|
810
|
+
initialize(this._sheet);
|
|
811
|
+
this._node = this._graph.getOrCreateNode((0, import_chunk_5XPK2V4A.createSheetName)({
|
|
812
|
+
type: (0, import_echo_schema3.getTypename)(this._sheet),
|
|
813
|
+
id: this._sheet.id
|
|
814
|
+
}));
|
|
815
|
+
await this._node.open();
|
|
816
|
+
const unsubscribe = this._node.update.on((event) => this.update.emit(event));
|
|
817
|
+
this._ctx.onDispose(unsubscribe);
|
|
818
|
+
this.reset();
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Update engine.
|
|
822
|
+
* NOTE: This resets the undo history.
|
|
823
|
+
* @deprecated
|
|
824
|
+
*/
|
|
825
|
+
reset() {
|
|
826
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
827
|
+
F: __dxlog_file2,
|
|
828
|
+
L: 126,
|
|
829
|
+
S: this,
|
|
830
|
+
A: [
|
|
831
|
+
"this._node",
|
|
832
|
+
""
|
|
833
|
+
]
|
|
834
|
+
});
|
|
835
|
+
this._node.graph.hf.clearSheet(this._node.sheetId);
|
|
836
|
+
Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
|
|
837
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
838
|
+
F: __dxlog_file2,
|
|
839
|
+
L: 129,
|
|
840
|
+
S: this,
|
|
841
|
+
A: [
|
|
842
|
+
"this._node",
|
|
843
|
+
""
|
|
844
|
+
]
|
|
845
|
+
});
|
|
846
|
+
const { col, row } = addressFromIndex(this._sheet, key);
|
|
847
|
+
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
848
|
+
value = this._graph.mapFormulaToNative(this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value)));
|
|
849
|
+
}
|
|
850
|
+
this._node.graph.hf.setCellContents({
|
|
851
|
+
sheet: this._node.sheetId,
|
|
852
|
+
row,
|
|
853
|
+
col
|
|
854
|
+
}, value);
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Recalculate formulas.
|
|
859
|
+
* NOTE: This resets the undo history.
|
|
860
|
+
* https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
|
|
861
|
+
* @deprecated
|
|
862
|
+
*/
|
|
863
|
+
// TODO(burdon): Remove.
|
|
864
|
+
recalculate() {
|
|
865
|
+
this._node?.graph.hf.rebuildAndRecalculate();
|
|
866
|
+
}
|
|
867
|
+
insertRows(i, n = 1) {
|
|
868
|
+
insertIndices(this._sheet.rows, i, n, MAX_ROWS);
|
|
869
|
+
this.reset();
|
|
870
|
+
}
|
|
871
|
+
insertColumns(i, n = 1) {
|
|
872
|
+
insertIndices(this._sheet.columns, i, n, MAX_COLUMNS);
|
|
873
|
+
this.reset();
|
|
874
|
+
}
|
|
875
|
+
//
|
|
876
|
+
// Undoable actions.
|
|
877
|
+
// TODO(burdon): Group undoable methods; consistently update hf/sheet.
|
|
878
|
+
//
|
|
879
|
+
/**
|
|
880
|
+
* Clear range of values.
|
|
881
|
+
*/
|
|
882
|
+
clear(range) {
|
|
883
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
884
|
+
F: __dxlog_file2,
|
|
885
|
+
L: 171,
|
|
886
|
+
S: this,
|
|
887
|
+
A: [
|
|
888
|
+
"this._node",
|
|
889
|
+
""
|
|
890
|
+
]
|
|
891
|
+
});
|
|
892
|
+
const topLeft = getTopLeft(range);
|
|
893
|
+
const values = this._iterRange(range, () => null);
|
|
894
|
+
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
895
|
+
this._iterRange(range, (cell) => {
|
|
896
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
897
|
+
delete this._sheet.cells[idx];
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
cut(range) {
|
|
901
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
902
|
+
F: __dxlog_file2,
|
|
903
|
+
L: 182,
|
|
904
|
+
S: this,
|
|
905
|
+
A: [
|
|
906
|
+
"this._node",
|
|
907
|
+
""
|
|
908
|
+
]
|
|
909
|
+
});
|
|
910
|
+
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
911
|
+
this._iterRange(range, (cell) => {
|
|
912
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
913
|
+
delete this._sheet.cells[idx];
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
copy(range) {
|
|
917
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
918
|
+
F: __dxlog_file2,
|
|
919
|
+
L: 191,
|
|
920
|
+
S: this,
|
|
921
|
+
A: [
|
|
922
|
+
"this._node",
|
|
923
|
+
""
|
|
924
|
+
]
|
|
925
|
+
});
|
|
926
|
+
this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
|
|
927
|
+
}
|
|
928
|
+
paste(cell) {
|
|
929
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
930
|
+
F: __dxlog_file2,
|
|
931
|
+
L: 196,
|
|
932
|
+
S: this,
|
|
933
|
+
A: [
|
|
934
|
+
"this._node",
|
|
935
|
+
""
|
|
936
|
+
]
|
|
937
|
+
});
|
|
938
|
+
if (!this._node.graph.hf.isClipboardEmpty()) {
|
|
939
|
+
const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
|
|
940
|
+
for (const change of changes) {
|
|
941
|
+
if (change instanceof import_hyperformula.ExportedCellChange) {
|
|
942
|
+
const { address, newValue } = change;
|
|
943
|
+
const idx = addressToIndex(this._sheet, {
|
|
944
|
+
row: address.row,
|
|
945
|
+
col: address.col
|
|
946
|
+
});
|
|
947
|
+
this._sheet.cells[idx] = {
|
|
948
|
+
value: newValue
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
// TODO(burdon): Display undo/redo state.
|
|
955
|
+
undo() {
|
|
956
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
957
|
+
F: __dxlog_file2,
|
|
958
|
+
L: 211,
|
|
959
|
+
S: this,
|
|
960
|
+
A: [
|
|
961
|
+
"this._node",
|
|
962
|
+
""
|
|
963
|
+
]
|
|
964
|
+
});
|
|
965
|
+
if (this._node.graph.hf.isThereSomethingToUndo()) {
|
|
966
|
+
this._node.graph.hf.undo();
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
redo() {
|
|
970
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
971
|
+
F: __dxlog_file2,
|
|
972
|
+
L: 219,
|
|
973
|
+
S: this,
|
|
974
|
+
A: [
|
|
975
|
+
"this._node",
|
|
976
|
+
""
|
|
977
|
+
]
|
|
978
|
+
});
|
|
979
|
+
if (this._node.graph.hf.isThereSomethingToRedo()) {
|
|
980
|
+
this._node.graph.hf.redo();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Get value from sheet.
|
|
985
|
+
*/
|
|
986
|
+
getCellValue(cell) {
|
|
987
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
988
|
+
return this._sheet.cells[idx]?.value ?? null;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Get value as a string for editing.
|
|
992
|
+
*/
|
|
993
|
+
getCellText(cell) {
|
|
994
|
+
const value = this.getCellValue(cell);
|
|
995
|
+
if (value == null) {
|
|
996
|
+
return void 0;
|
|
997
|
+
}
|
|
998
|
+
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
999
|
+
return this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value));
|
|
1000
|
+
} else {
|
|
1001
|
+
return String(value);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Get array of raw values from sheet.
|
|
1006
|
+
*/
|
|
1007
|
+
getCellValues(range) {
|
|
1008
|
+
return this._iterRange(range, (cell) => this.getCellValue(cell));
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Gets the regular or computed value from the engine.
|
|
1012
|
+
*/
|
|
1013
|
+
getValue(cell) {
|
|
1014
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1015
|
+
F: __dxlog_file2,
|
|
1016
|
+
L: 262,
|
|
1017
|
+
S: this,
|
|
1018
|
+
A: [
|
|
1019
|
+
"this._node",
|
|
1020
|
+
""
|
|
1021
|
+
]
|
|
1022
|
+
});
|
|
1023
|
+
const value = this._node.graph.hf.getCellValue(toSimpleCellAddress(this._node.sheetId, cell));
|
|
1024
|
+
if (value instanceof import_hyperformula.DetailedCellError) {
|
|
1025
|
+
return value.toString();
|
|
1026
|
+
}
|
|
1027
|
+
return value;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Get value type.
|
|
1031
|
+
*/
|
|
1032
|
+
getValueType(cell) {
|
|
1033
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1034
|
+
F: __dxlog_file2,
|
|
1035
|
+
L: 275,
|
|
1036
|
+
S: this,
|
|
1037
|
+
A: [
|
|
1038
|
+
"this._node",
|
|
1039
|
+
""
|
|
1040
|
+
]
|
|
1041
|
+
});
|
|
1042
|
+
const addr = toSimpleCellAddress(this._node.sheetId, cell);
|
|
1043
|
+
const type = this._node.graph.hf.getCellValueDetailedType(addr);
|
|
1044
|
+
return typeMap[type];
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Sets the value, updating the sheet and engine.
|
|
1048
|
+
*/
|
|
1049
|
+
setValue(cell, value) {
|
|
1050
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1051
|
+
F: __dxlog_file2,
|
|
1052
|
+
L: 285,
|
|
1053
|
+
S: this,
|
|
1054
|
+
A: [
|
|
1055
|
+
"this._node",
|
|
1056
|
+
""
|
|
1057
|
+
]
|
|
1058
|
+
});
|
|
1059
|
+
if (this._options.readonly) {
|
|
1060
|
+
throw new ReadonlyException();
|
|
1061
|
+
}
|
|
1062
|
+
let refresh = false;
|
|
1063
|
+
if (cell.row >= this._sheet.rows.length) {
|
|
1064
|
+
insertIndices(this._sheet.rows, cell.row, 1, MAX_ROWS);
|
|
1065
|
+
refresh = true;
|
|
1066
|
+
}
|
|
1067
|
+
if (cell.col >= this._sheet.columns.length) {
|
|
1068
|
+
insertIndices(this._sheet.columns, cell.col, 1, MAX_COLUMNS);
|
|
1069
|
+
refresh = true;
|
|
1070
|
+
}
|
|
1071
|
+
if (refresh) {
|
|
1072
|
+
this.reset();
|
|
1073
|
+
}
|
|
1074
|
+
this._node.graph.hf.setCellContents({
|
|
1075
|
+
sheet: this._node.sheetId,
|
|
1076
|
+
row: cell.row,
|
|
1077
|
+
col: cell.col
|
|
1078
|
+
}, [
|
|
1079
|
+
[
|
|
1080
|
+
typeof value === "string" && value.charAt(0) === "=" ? this._graph.mapFormulaToNative(value) : value
|
|
1081
|
+
]
|
|
1082
|
+
]);
|
|
1083
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
1084
|
+
if (value === void 0 || value === null) {
|
|
1085
|
+
delete this._sheet.cells[idx];
|
|
1086
|
+
} else {
|
|
1087
|
+
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
1088
|
+
value = this._graph.mapFunctionBindingToId(this.mapFormulaRefsToIndices(value));
|
|
1089
|
+
}
|
|
1090
|
+
this._sheet.cells[idx] = {
|
|
1091
|
+
value
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Sets values from a simple map.
|
|
1097
|
+
*/
|
|
1098
|
+
setValues(values) {
|
|
1099
|
+
Object.entries(values).forEach(([key, { value }]) => {
|
|
1100
|
+
this.setValue(addressFromA1Notation(key), value);
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Iterate range.
|
|
1105
|
+
*/
|
|
1106
|
+
_iterRange(range, cb) {
|
|
1107
|
+
const to = range.to ?? range.from;
|
|
1108
|
+
const rowRange = [
|
|
1109
|
+
Math.min(range.from.row, to.row),
|
|
1110
|
+
Math.max(range.from.row, to.row)
|
|
1111
|
+
];
|
|
1112
|
+
const columnRange = [
|
|
1113
|
+
Math.min(range.from.col, to.col),
|
|
1114
|
+
Math.max(range.from.col, to.col)
|
|
1115
|
+
];
|
|
1116
|
+
const rows = [];
|
|
1117
|
+
for (let row = rowRange[0]; row <= rowRange[1]; row++) {
|
|
1118
|
+
const rowCells = [];
|
|
1119
|
+
for (let column = columnRange[0]; column <= columnRange[1]; column++) {
|
|
1120
|
+
const value = cb({
|
|
1121
|
+
row,
|
|
1122
|
+
col: column
|
|
1123
|
+
});
|
|
1124
|
+
if (value !== void 0) {
|
|
1125
|
+
rowCells.push(value);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
rows.push(rowCells);
|
|
1129
|
+
}
|
|
1130
|
+
return rows;
|
|
1131
|
+
}
|
|
1132
|
+
// TODO(burdon): Delete index.
|
|
1133
|
+
_deleteIndices(indices, i, n) {
|
|
1134
|
+
throw new Error("Not implemented");
|
|
1135
|
+
}
|
|
1136
|
+
// TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
|
|
1137
|
+
_moveIndices(indices, i, j, n) {
|
|
1138
|
+
throw new Error("Not implemented");
|
|
1139
|
+
}
|
|
1140
|
+
//
|
|
1141
|
+
// Indices.
|
|
1142
|
+
//
|
|
1143
|
+
/**
|
|
1144
|
+
* Map from A1 notation to indices.
|
|
1145
|
+
*/
|
|
1146
|
+
mapFormulaRefsToIndices(formula) {
|
|
1147
|
+
(0, import_invariant3.invariant)(formula.charAt(0) === "=", void 0, {
|
|
1148
|
+
F: __dxlog_file2,
|
|
1149
|
+
L: 374,
|
|
1150
|
+
S: this,
|
|
1151
|
+
A: [
|
|
1152
|
+
"formula.charAt(0) === '='",
|
|
1153
|
+
""
|
|
1154
|
+
]
|
|
1155
|
+
});
|
|
1156
|
+
return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
|
|
1157
|
+
return addressToIndex(this._sheet, addressFromA1Notation(match));
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Map from indices to A1 notation.
|
|
1162
|
+
*/
|
|
1163
|
+
mapFormulaIndicesToRefs(formula) {
|
|
1164
|
+
(0, import_invariant3.invariant)(formula.charAt(0) === "=", void 0, {
|
|
1165
|
+
F: __dxlog_file2,
|
|
1166
|
+
L: 384,
|
|
1167
|
+
S: this,
|
|
1168
|
+
A: [
|
|
1169
|
+
"formula.charAt(0) === '='",
|
|
1170
|
+
""
|
|
1171
|
+
]
|
|
1172
|
+
});
|
|
1173
|
+
return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
|
|
1174
|
+
return addressToA1Notation(addressFromIndex(this._sheet, idx));
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
//
|
|
1178
|
+
// Values
|
|
1179
|
+
//
|
|
1180
|
+
/**
|
|
1181
|
+
* https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example
|
|
1182
|
+
* https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate
|
|
1183
|
+
* NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
|
|
1184
|
+
*/
|
|
1185
|
+
toLocalDate(num) {
|
|
1186
|
+
const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);
|
|
1187
|
+
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
1188
|
+
}
|
|
1189
|
+
toDateTime(num) {
|
|
1190
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1191
|
+
F: __dxlog_file2,
|
|
1192
|
+
L: 405,
|
|
1193
|
+
S: this,
|
|
1194
|
+
A: [
|
|
1195
|
+
"this._node",
|
|
1196
|
+
""
|
|
1197
|
+
]
|
|
1198
|
+
});
|
|
1199
|
+
return this._node.graph.hf.numberToDateTime(num);
|
|
1200
|
+
}
|
|
1201
|
+
toDate(num) {
|
|
1202
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1203
|
+
F: __dxlog_file2,
|
|
1204
|
+
L: 410,
|
|
1205
|
+
S: this,
|
|
1206
|
+
A: [
|
|
1207
|
+
"this._node",
|
|
1208
|
+
""
|
|
1209
|
+
]
|
|
1210
|
+
});
|
|
1211
|
+
return this._node.graph.hf.numberToDate(num);
|
|
1212
|
+
}
|
|
1213
|
+
toTime(num) {
|
|
1214
|
+
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
1215
|
+
F: __dxlog_file2,
|
|
1216
|
+
L: 415,
|
|
1217
|
+
S: this,
|
|
1218
|
+
A: [
|
|
1219
|
+
"this._node",
|
|
1220
|
+
""
|
|
1221
|
+
]
|
|
1222
|
+
});
|
|
1223
|
+
return this._node.graph.hf.numberToTime(num);
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
var useFormattingModel = (model) => {
|
|
1227
|
+
return (0, import_react6.useMemo)(() => model && new FormattingModel(model), [
|
|
1228
|
+
model
|
|
1229
|
+
]);
|
|
1230
|
+
};
|
|
1231
|
+
var useSheetModel = (graph, sheet, { readonly } = {}) => {
|
|
1232
|
+
const [model, setModel] = (0, import_react7.useState)();
|
|
1233
|
+
(0, import_react7.useEffect)(() => {
|
|
1234
|
+
if (!graph || !sheet) {
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
let model2;
|
|
1238
|
+
const t = setTimeout(async () => {
|
|
1239
|
+
model2 = new SheetModel(graph, sheet, {
|
|
1240
|
+
readonly
|
|
1241
|
+
});
|
|
1242
|
+
await model2.open();
|
|
1243
|
+
setModel(model2);
|
|
1244
|
+
});
|
|
1245
|
+
return () => {
|
|
1246
|
+
clearTimeout(t);
|
|
1247
|
+
void model2?.close();
|
|
1248
|
+
};
|
|
1249
|
+
}, [
|
|
1250
|
+
graph,
|
|
1251
|
+
sheet,
|
|
1252
|
+
readonly
|
|
1253
|
+
]);
|
|
1254
|
+
return model;
|
|
1255
|
+
};
|
|
1256
|
+
var useUpdateFocusedCellOnThreadSelection = (model, grid) => {
|
|
1257
|
+
const handleScrollIntoView = (0, import_react8.useCallback)(({ action, data }) => {
|
|
1258
|
+
switch (action) {
|
|
1259
|
+
case import_app_framework.LayoutAction.SCROLL_INTO_VIEW: {
|
|
1260
|
+
if (!data?.id || data?.cursor === void 0 || data?.id !== (0, import_echo2.fullyQualifiedId)(model.sheet)) {
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
const cellAddress = addressFromIndex(model.sheet, data.cursor);
|
|
1264
|
+
grid.current?.setFocus({
|
|
1265
|
+
...cellAddress,
|
|
1266
|
+
plane: "grid"
|
|
1267
|
+
}, true);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}, [
|
|
1271
|
+
model.sheet
|
|
1272
|
+
]);
|
|
1273
|
+
(0, import_app_framework.useIntentResolver)(import_chunk_QIFIGEKV.SHEET_PLUGIN, handleScrollIntoView);
|
|
1274
|
+
};
|
|
1275
|
+
var useSelectThreadOnCellFocus = (model, cursor) => {
|
|
1276
|
+
const dispatch = (0, import_app_framework.useIntentDispatcher)();
|
|
1277
|
+
const activeThreads = (0, import_react8.useMemo)(() => model.sheet.threads?.filter((thread) => !!thread && thread.status === "active") ?? [], [
|
|
1278
|
+
// TODO(thure): Surely we can find a better dependency for this…
|
|
1279
|
+
JSON.stringify(model.sheet.threads)
|
|
1280
|
+
]);
|
|
1281
|
+
const activeThreadAddresses = (0, import_react8.useMemo)(() => activeThreads.map((thread) => thread.anchor).filter((anchor) => anchor !== void 0).map((anchor) => addressFromIndex(model.sheet, anchor)), [
|
|
1282
|
+
activeThreads,
|
|
1283
|
+
model.sheet
|
|
1284
|
+
]);
|
|
1285
|
+
const selectClosestThread = (0, import_react8.useCallback)((cellAddress) => {
|
|
1286
|
+
if (!cellAddress || !activeThreads) {
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
const closestThreadAnchor = closest(cellAddress, activeThreadAddresses);
|
|
1290
|
+
if (closestThreadAnchor) {
|
|
1291
|
+
const closestThread = activeThreads.find((thread) => thread && thread.anchor === addressToIndex(model.sheet, closestThreadAnchor));
|
|
1292
|
+
if (closestThread) {
|
|
1293
|
+
void dispatch([
|
|
1294
|
+
{
|
|
1295
|
+
action: "dxos.org/plugin/thread/action/select",
|
|
1296
|
+
data: {
|
|
1297
|
+
current: (0, import_echo2.fullyQualifiedId)(closestThread)
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
]);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, [
|
|
1304
|
+
dispatch,
|
|
1305
|
+
activeThreads,
|
|
1306
|
+
activeThreadAddresses,
|
|
1307
|
+
model.sheet
|
|
1308
|
+
]);
|
|
1309
|
+
const debounced = (0, import_react8.useMemo)(() => {
|
|
1310
|
+
return (0, import_async3.debounce)((cellCoords) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
|
|
1311
|
+
}, [
|
|
1312
|
+
selectClosestThread
|
|
1313
|
+
]);
|
|
1314
|
+
(0, import_react8.useEffect)(() => {
|
|
1315
|
+
if (!cursor) {
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
debounced(cursor);
|
|
1319
|
+
}, [
|
|
1320
|
+
cursor,
|
|
1321
|
+
selectClosestThread
|
|
1322
|
+
]);
|
|
1323
|
+
};
|
|
1324
|
+
var createThreadDecoration = (cellIndex, threadId, sheetId) => {
|
|
1325
|
+
return {
|
|
1326
|
+
type: "comment",
|
|
1327
|
+
classNames: [
|
|
1328
|
+
"bg-greenFill"
|
|
1329
|
+
],
|
|
1330
|
+
cellIndex
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1333
|
+
var useThreadDecorations = (model, decorations) => {
|
|
1334
|
+
const sheet = (0, import_react8.useMemo)(() => model.sheet, [
|
|
1335
|
+
model.sheet
|
|
1336
|
+
]);
|
|
1337
|
+
const sheetId = (0, import_react8.useMemo)(() => (0, import_echo2.fullyQualifiedId)(sheet), [
|
|
1338
|
+
sheet
|
|
1339
|
+
]);
|
|
1340
|
+
(0, import_react8.useEffect)(() => {
|
|
1341
|
+
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
1342
|
+
const activeThreadAnchors = /* @__PURE__ */ new Set();
|
|
1343
|
+
if (!sheet.threads) {
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
for (const thread of sheet.threads) {
|
|
1347
|
+
if (!thread || thread.anchor === void 0 || thread.status === "resolved") {
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
activeThreadAnchors.add(thread.anchor);
|
|
1351
|
+
const index = thread.anchor;
|
|
1352
|
+
const existingDecorations = decorations.getDecorationsForCell(index);
|
|
1353
|
+
if (!existingDecorations || !existingDecorations.some((d) => d.type === "comment")) {
|
|
1354
|
+
decorations.addDecoration(index, createThreadDecoration(index, thread.id, sheetId));
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
for (const decoration of decorations.getAllDecorations()) {
|
|
1358
|
+
if (decoration.type !== "comment") {
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
if (!activeThreadAnchors.has(decoration.cellIndex)) {
|
|
1362
|
+
decorations.removeDecoration(decoration.cellIndex, "comment");
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
return () => unsubscribe();
|
|
1367
|
+
});
|
|
1368
|
+
};
|
|
1369
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
|
|
1370
|
+
var SheetContext = /* @__PURE__ */ (0, import_react9.createContext)(null);
|
|
1371
|
+
var useSheetContext = () => {
|
|
1372
|
+
const context = (0, import_react9.useContext)(SheetContext);
|
|
1373
|
+
(0, import_invariant4.invariant)(context, void 0, {
|
|
1374
|
+
F: __dxlog_file3,
|
|
1375
|
+
L: 46,
|
|
1376
|
+
S: void 0,
|
|
1377
|
+
A: [
|
|
1378
|
+
"context",
|
|
1379
|
+
""
|
|
1380
|
+
]
|
|
1381
|
+
});
|
|
1382
|
+
return context;
|
|
1383
|
+
};
|
|
1384
|
+
var SheetProviderImpl = ({ model, formatting, onInfo, children, __gridScope }) => {
|
|
1385
|
+
const { id, editing, setEditing } = (0, import_react_ui_grid3.useGridContext)("SheetProvider", __gridScope);
|
|
1386
|
+
const decorations = (0, import_react9.useMemo)(() => createDecorations(), []);
|
|
1387
|
+
const [cursor, setCursor] = (0, import_react9.useState)();
|
|
1388
|
+
const [range, setRange] = (0, import_react9.useState)();
|
|
1389
|
+
useSelectThreadOnCellFocus(model, cursor);
|
|
1390
|
+
useThreadDecorations(model, decorations);
|
|
1391
|
+
return /* @__PURE__ */ import_react9.default.createElement(SheetContext.Provider, {
|
|
1392
|
+
value: {
|
|
1393
|
+
id,
|
|
1394
|
+
model,
|
|
1395
|
+
formatting,
|
|
1396
|
+
editing,
|
|
1397
|
+
setEditing,
|
|
1398
|
+
cursor,
|
|
1399
|
+
setCursor,
|
|
1400
|
+
range,
|
|
1401
|
+
setRange,
|
|
1402
|
+
// TODO(burdon): Change to event.
|
|
1403
|
+
onInfo,
|
|
1404
|
+
decorations
|
|
1405
|
+
}
|
|
1406
|
+
}, children);
|
|
1407
|
+
};
|
|
1408
|
+
var SheetProvider = ({ children, graph, sheet, readonly, onInfo }) => {
|
|
1409
|
+
const model = useSheetModel(graph, sheet, {
|
|
1410
|
+
readonly
|
|
1411
|
+
});
|
|
1412
|
+
const formatting = useFormattingModel(model);
|
|
1413
|
+
return !model || !formatting ? null : /* @__PURE__ */ import_react9.default.createElement(import_react_ui_grid3.Grid.Root, {
|
|
1414
|
+
id: (0, import_echo3.fullyQualifiedId)(sheet)
|
|
1415
|
+
}, /* @__PURE__ */ import_react9.default.createElement(SheetProviderImpl, {
|
|
1416
|
+
model,
|
|
1417
|
+
formatting,
|
|
1418
|
+
onInfo
|
|
1419
|
+
}, children));
|
|
1420
|
+
};
|
|
1421
|
+
var initialCells = {
|
|
1422
|
+
grid: {},
|
|
1423
|
+
frozenColsStart: [
|
|
1424
|
+
...Array(64)
|
|
1425
|
+
].reduce((acc, _, i) => {
|
|
1426
|
+
acc[`0,${i}`] = rowLabelCell(i);
|
|
1427
|
+
return acc;
|
|
1428
|
+
}, {}),
|
|
1429
|
+
frozenRowsStart: [
|
|
1430
|
+
...Array(12)
|
|
1431
|
+
].reduce((acc, _, i) => {
|
|
1432
|
+
acc[`${i},0`] = colLabelCell(i);
|
|
1433
|
+
return acc;
|
|
1434
|
+
}, {})
|
|
1435
|
+
};
|
|
1436
|
+
var frozen = {
|
|
1437
|
+
frozenColsStart: 1,
|
|
1438
|
+
frozenRowsStart: 1
|
|
1439
|
+
};
|
|
1440
|
+
var sheetRowDefault = {
|
|
1441
|
+
grid: {
|
|
1442
|
+
size: 32,
|
|
1443
|
+
resizeable: true
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
var sheetColDefault = {
|
|
1447
|
+
frozenColsStart: {
|
|
1448
|
+
size: 48
|
|
1449
|
+
},
|
|
1450
|
+
grid: {
|
|
1451
|
+
size: 180,
|
|
1452
|
+
resizeable: true
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
var GridSheet = () => {
|
|
1456
|
+
const { id, model, formatting, editing, setEditing, setCursor, setRange } = useSheetContext();
|
|
1457
|
+
const dxGrid = (0, import_react4.useRef)(null);
|
|
1458
|
+
const rangeNotifier = (0, import_react4.useRef)();
|
|
1459
|
+
const { hasAttention } = (0, import_react_ui_attention.useAttention)(id);
|
|
1460
|
+
const handleFocus = (0, import_react4.useCallback)((event) => {
|
|
1461
|
+
if (!editing) {
|
|
1462
|
+
const cell = (0, import_react_ui_grid.closestCell)(event.target);
|
|
1463
|
+
setCursor(cell && cell.plane === "grid" ? {
|
|
1464
|
+
col: cell.col,
|
|
1465
|
+
row: cell.row
|
|
1466
|
+
} : void 0);
|
|
1467
|
+
}
|
|
1468
|
+
}, [
|
|
1469
|
+
editing
|
|
1470
|
+
]);
|
|
1471
|
+
const handleClose = (0, import_react4.useCallback)((value, { key, shift }) => {
|
|
1472
|
+
if (value !== void 0) {
|
|
1473
|
+
model.setValue(dxGridCellIndexToSheetCellAddress(editing.index), value);
|
|
1474
|
+
}
|
|
1475
|
+
setEditing(null);
|
|
1476
|
+
const axis = [
|
|
1477
|
+
"Enter",
|
|
1478
|
+
"ArrowUp",
|
|
1479
|
+
"ArrowDown"
|
|
1480
|
+
].includes(key) ? "row" : [
|
|
1481
|
+
"Tab",
|
|
1482
|
+
"ArrowLeft",
|
|
1483
|
+
"ArrowRight"
|
|
1484
|
+
].includes(key) ? "col" : void 0;
|
|
1485
|
+
const delta = key.startsWith("Arrow") ? [
|
|
1486
|
+
"ArrowUp",
|
|
1487
|
+
"ArrowLeft"
|
|
1488
|
+
].includes(key) ? -1 : 1 : shift ? -1 : 1;
|
|
1489
|
+
dxGrid.current?.refocus(axis, delta);
|
|
1490
|
+
}, [
|
|
1491
|
+
model,
|
|
1492
|
+
editing,
|
|
1493
|
+
setEditing
|
|
1494
|
+
]);
|
|
1495
|
+
const handleAxisResize = (0, import_react4.useCallback)(({ axis, size, index: numericIndex }) => {
|
|
1496
|
+
if (axis === "row") {
|
|
1497
|
+
const rowId = model.sheet.rows[parseInt(numericIndex)];
|
|
1498
|
+
model.sheet.rowMeta[rowId] ??= {};
|
|
1499
|
+
model.sheet.rowMeta[rowId].size = size;
|
|
1500
|
+
} else {
|
|
1501
|
+
const columnId = model.sheet.columns[parseInt(numericIndex)];
|
|
1502
|
+
model.sheet.columnMeta[columnId] ??= {};
|
|
1503
|
+
model.sheet.columnMeta[columnId].size = size;
|
|
1504
|
+
}
|
|
1505
|
+
}, [
|
|
1506
|
+
model
|
|
1507
|
+
]);
|
|
1508
|
+
const handleSelect = (0, import_react4.useCallback)(({ minCol, maxCol, minRow, maxRow }) => {
|
|
1509
|
+
const range = {
|
|
1510
|
+
from: {
|
|
1511
|
+
col: minCol,
|
|
1512
|
+
row: minRow
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
if (minCol !== maxCol || minRow !== maxRow) {
|
|
1516
|
+
range.to = {
|
|
1517
|
+
col: maxCol,
|
|
1518
|
+
row: maxRow
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
if (editing) {
|
|
1522
|
+
rangeNotifier.current?.(rangeToA1Notation(range));
|
|
1523
|
+
} else {
|
|
1524
|
+
setRange(range.to ? range : void 0);
|
|
1525
|
+
}
|
|
1526
|
+
}, [
|
|
1527
|
+
editing
|
|
1528
|
+
]);
|
|
1529
|
+
const handleWheel = (0, import_react4.useCallback)((event) => {
|
|
1530
|
+
if (!hasAttention) {
|
|
1531
|
+
event.stopPropagation();
|
|
1532
|
+
}
|
|
1533
|
+
}, [
|
|
1534
|
+
hasAttention
|
|
1535
|
+
]);
|
|
1536
|
+
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model, formatting);
|
|
1537
|
+
const extension = (0, import_react4.useMemo)(() => [
|
|
1538
|
+
(0, import_react_ui_grid.editorKeys)({
|
|
1539
|
+
onClose: handleClose,
|
|
1540
|
+
...editing?.initialContent && {
|
|
1541
|
+
onNav: handleClose
|
|
1542
|
+
}
|
|
1543
|
+
}),
|
|
1544
|
+
sheetExtension({
|
|
1545
|
+
functions: model.graph.getFunctions()
|
|
1546
|
+
}),
|
|
1547
|
+
rangeExtension((fn) => rangeNotifier.current = fn)
|
|
1548
|
+
], [
|
|
1549
|
+
model,
|
|
1550
|
+
handleClose,
|
|
1551
|
+
editing
|
|
1552
|
+
]);
|
|
1553
|
+
const getCellContent = (0, import_react4.useCallback)((index) => {
|
|
1554
|
+
const cell = dxGridCellIndexToSheetCellAddress(index);
|
|
1555
|
+
return model.getCellText(cell);
|
|
1556
|
+
}, [
|
|
1557
|
+
model
|
|
1558
|
+
]);
|
|
1559
|
+
useUpdateFocusedCellOnThreadSelection(model, dxGrid);
|
|
1560
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui_grid.GridCellEditor, {
|
|
1561
|
+
getCellContent,
|
|
1562
|
+
extension
|
|
1563
|
+
}), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_grid.Grid.Content, {
|
|
1564
|
+
initialCells,
|
|
1565
|
+
limitColumns: DEFAULT_COLUMNS,
|
|
1566
|
+
limitRows: DEFAULT_ROWS,
|
|
1567
|
+
columns,
|
|
1568
|
+
rows,
|
|
1569
|
+
onAxisResize: handleAxisResize,
|
|
1570
|
+
onSelect: handleSelect,
|
|
1571
|
+
rowDefault: sheetRowDefault,
|
|
1572
|
+
columnDefault: sheetColDefault,
|
|
1573
|
+
frozen,
|
|
1574
|
+
onFocus: handleFocus,
|
|
1575
|
+
onWheelCapture: handleWheel,
|
|
1576
|
+
className: "[--dx-grid-base:var(--surface-bg)]",
|
|
1577
|
+
ref: dxGrid
|
|
1578
|
+
}));
|
|
1579
|
+
};
|
|
1580
|
+
var SheetContainer = import_react3.default.lazy(() => import("./SheetContainer-YSQGJD7K.cjs"));
|
|
1581
|
+
var useComputeGraph = (space) => {
|
|
1582
|
+
const { registry } = (0, import_react2.useContext)(ComputeGraphContext) ?? (0, import_debug.raise)(new Error("Missing ComputeGraphContext"));
|
|
1583
|
+
const [graph] = (0, import_react_hooks.useAsyncState)(async () => {
|
|
1584
|
+
if (space) {
|
|
1585
|
+
const graph2 = registry.getOrCreateGraph(space);
|
|
1586
|
+
await graph2.open();
|
|
1587
|
+
return graph2;
|
|
1588
|
+
}
|
|
1589
|
+
}, [
|
|
1590
|
+
space,
|
|
1591
|
+
registry
|
|
1592
|
+
]);
|
|
1593
|
+
return graph;
|
|
1594
|
+
};
|
|
1595
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1596
|
+
0 && (module.exports = {
|
|
1597
|
+
ComputeGraphContextProvider,
|
|
1598
|
+
GridSheet,
|
|
1599
|
+
SheetContainer,
|
|
1600
|
+
SheetProvider,
|
|
1601
|
+
addressToA1Notation,
|
|
1602
|
+
addressToIndex,
|
|
1603
|
+
compareIndexPositions,
|
|
1604
|
+
computeGraphFacet,
|
|
1605
|
+
createSheet,
|
|
1606
|
+
rangeToA1Notation,
|
|
1607
|
+
useComputeGraph,
|
|
1608
|
+
useSheetContext
|
|
1609
|
+
});
|
|
1610
|
+
//# sourceMappingURL=chunk-6F43RV45.cjs.map
|