@dxos/plugin-sheet 0.6.12-main.5cc132e → 0.6.12-main.c974201
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-V4GCCZTX.mjs +261 -0
- package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GNNVBNCX.mjs → chunk-6ZMQVB4Z.mjs} +358 -678
- package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JRL5LGCE.mjs → chunk-QILRZNE5.mjs} +2 -5
- package/dist/lib/browser/chunk-QILRZNE5.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-WUPTZUTX.mjs → browser/chunk-T3NJFTD4.mjs} +4 -14
- package/dist/lib/browser/chunk-T3NJFTD4.mjs.map +7 -0
- package/dist/lib/browser/{SheetContainer-Y7ZMFBAP.mjs → chunk-U2JHW3L6.mjs} +819 -498
- package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +7 -0
- package/dist/lib/browser/graph-T27BOBOV.mjs +21 -0
- package/dist/lib/browser/graph-T27BOBOV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +58 -55
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +4 -6
- package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs +279 -0
- package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-BJ6ZD7MN.cjs → chunk-BNARJ5GM.cjs} +5 -18
- package/dist/lib/node/chunk-BNARJ5GM.cjs.map +7 -0
- package/dist/lib/node/{chunk-ZRQZFV5T.cjs → chunk-DD6FIXWC.cjs} +359 -679
- package/dist/lib/node/chunk-DD6FIXWC.cjs.map +7 -0
- package/dist/lib/node/{SheetContainer-KEOKUKAQ.cjs → chunk-OTTD7FBK.cjs} +875 -551
- package/dist/lib/node/chunk-OTTD7FBK.cjs.map +7 -0
- package/dist/lib/node/{chunk-VJU3NPUJ.cjs → chunk-Q3HBHPRL.cjs} +8 -19
- package/dist/lib/node/chunk-Q3HBHPRL.cjs.map +7 -0
- package/dist/lib/node/graph-SPKGX7W4.cjs +43 -0
- package/dist/lib/node/graph-SPKGX7W4.cjs.map +7 -0
- package/dist/lib/node/index.cjs +75 -64
- package/dist/lib/node/index.cjs.map +3 -3
- 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 +10 -12
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs +262 -0
- package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs.map +7 -0
- package/dist/lib/node-esm/{SheetContainer-Y7ZMFBAP.mjs → chunk-7HVSOTGA.mjs} +820 -498
- package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WUPTZUTX.mjs → node-esm/chunk-BMNA27EX.mjs} +5 -14
- package/dist/lib/node-esm/chunk-BMNA27EX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GNNVBNCX.mjs → chunk-D6KU5MI7.mjs} +359 -677
- package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JRL5LGCE.mjs → chunk-IU2L277A.mjs} +4 -5
- package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +7 -0
- package/dist/lib/node-esm/graph-U67IO4UC.mjs +22 -0
- package/dist/lib/node-esm/graph-U67IO4UC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +59 -55
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +2 -1
- package/dist/lib/node-esm/types.mjs +5 -6
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/CellEditor.d.ts +23 -3
- package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts +2 -2
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/extension.d.ts +1 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +11 -0
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/index.d.ts +1 -3
- package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +10 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +9 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/util.d.ts +6 -0
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts +5 -6
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/grid.d.ts +2 -2
- package/dist/types/src/components/Sheet/grid.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/nav.d.ts +3 -3
- package/dist/types/src/components/Sheet/nav.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +4 -5
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/threads.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer.d.ts +1 -1
- package/dist/types/src/components/SheetContainer.d.ts.map +1 -1
- 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 +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/defs/index.d.ts +3 -0
- package/dist/types/src/defs/index.d.ts.map +1 -0
- package/dist/types/src/{model → defs}/types.d.ts +8 -3
- package/dist/types/src/defs/types.d.ts.map +1 -0
- package/dist/types/src/defs/types.test.d.ts.map +1 -0
- package/dist/types/src/{model → defs}/util.d.ts +8 -4
- package/dist/types/src/defs/util.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.d.ts +5 -0
- package/dist/types/src/extensions/compute.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts +26 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/{components/ComputeGraph → graph}/async-function.d.ts +1 -1
- package/dist/types/src/graph/async-function.d.ts.map +1 -0
- package/dist/types/src/graph/compute-graph.browser.test.d.ts +2 -0
- package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +1 -0
- package/dist/types/src/graph/compute-graph.d.ts +81 -0
- package/dist/types/src/graph/compute-graph.d.ts.map +1 -0
- package/dist/types/src/graph/compute-graph.stories.d.ts +10 -0
- package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -0
- package/dist/types/src/graph/compute-node.d.ts +19 -0
- package/dist/types/src/graph/compute-node.d.ts.map +1 -0
- package/dist/types/src/{components/ComputeGraph/custom.d.ts → graph/custom-function.d.ts} +1 -1
- package/dist/types/src/graph/custom-function.d.ts.map +1 -0
- package/dist/types/src/graph/edge-function.d.ts.map +1 -0
- package/dist/types/src/{model/functions.d.ts → graph/function-defs.d.ts} +1 -1
- package/dist/types/src/graph/function-defs.d.ts.map +1 -0
- package/dist/types/src/graph/hyperformula.test.d.ts +2 -0
- package/dist/types/src/graph/hyperformula.test.d.ts.map +1 -0
- package/dist/types/src/graph/index.d.ts +4 -0
- package/dist/types/src/graph/index.d.ts.map +1 -0
- package/dist/types/src/graph/util.d.ts +2 -0
- package/dist/types/src/graph/util.d.ts.map +1 -0
- package/dist/types/src/hooks/hooks.stories.d.ts +11 -0
- package/dist/types/src/hooks/hooks.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +4 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeGraph.d.ts +7 -0
- package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -0
- package/dist/types/src/hooks/useFormattingModel.d.ts +3 -0
- package/dist/types/src/hooks/useFormattingModel.d.ts.map +1 -0
- package/dist/types/src/hooks/useSheetModel.d.ts +8 -0
- package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +1 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/formatting-model.d.ts +16 -0
- package/dist/types/src/model/formatting-model.d.ts.map +1 -0
- package/dist/types/src/model/index.d.ts +2 -4
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/{model.d.ts → sheet-model.d.ts} +9 -48
- package/dist/types/src/model/sheet-model.d.ts.map +1 -0
- package/dist/types/src/sanity.test.d.ts +2 -0
- package/dist/types/src/sanity.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +9 -0
- package/dist/types/src/testing/testing.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +12 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/vendor/hyperformula.mjs +37145 -0
- package/package.json +41 -38
- package/src/SheetPlugin.tsx +39 -59
- package/src/components/CellEditor/CellEditor.stories.tsx +4 -3
- package/src/components/CellEditor/CellEditor.tsx +59 -9
- package/src/components/CellEditor/extension.test.ts +3 -3
- package/src/components/CellEditor/extension.ts +1 -3
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +20 -0
- package/src/components/ComputeGraph/index.ts +1 -3
- package/src/components/GridSheet/GridSheet.stories.tsx +35 -0
- package/src/components/GridSheet/GridSheet.tsx +153 -0
- package/src/components/GridSheet/util.ts +89 -0
- package/src/components/Sheet/Sheet.stories.tsx +41 -82
- package/src/components/Sheet/Sheet.tsx +12 -10
- package/src/components/Sheet/grid.ts +3 -3
- package/src/components/Sheet/nav.ts +19 -19
- package/src/components/Sheet/sheet-context.tsx +10 -80
- package/src/components/Sheet/threads.tsx +10 -6
- package/src/components/SheetContainer.tsx +2 -2
- package/src/components/Toolbar/Toolbar.tsx +1 -2
- package/src/components/index.ts +1 -0
- package/src/defs/index.ts +6 -0
- package/src/{model → defs}/types.test.ts +7 -7
- package/src/{model → defs}/types.ts +23 -14
- package/src/{model → defs}/util.ts +49 -17
- package/src/extensions/compute.stories.tsx +151 -0
- package/src/extensions/compute.ts +98 -0
- package/src/extensions/index.ts +5 -0
- package/src/{components/ComputeGraph → graph}/async-function.ts +3 -1
- package/src/graph/compute-graph.browser.test.ts +104 -0
- package/src/graph/compute-graph.stories.tsx +92 -0
- package/src/graph/compute-graph.ts +290 -0
- package/src/graph/compute-node.ts +51 -0
- package/src/{components/ComputeGraph/custom.ts → graph/custom-function.ts} +2 -6
- package/src/{components/ComputeGraph → graph}/edge-function.ts +2 -1
- package/src/graph/hyperformula.test.ts +15 -0
- package/src/graph/index.ts +7 -0
- package/src/graph/util.ts +8 -0
- package/src/hooks/hooks.stories.tsx +50 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useComputeGraph.ts +20 -0
- package/src/hooks/useFormattingModel.ts +11 -0
- package/src/hooks/useSheetModel.ts +43 -0
- package/src/meta.tsx +1 -5
- package/src/{components/Sheet/formatting.ts → model/formatting-model.ts} +20 -13
- package/src/model/index.ts +2 -4
- package/src/model/{model.ts → sheet-model.ts} +67 -184
- package/src/sanity.test.ts +40 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/testing.tsx +66 -0
- package/src/types.ts +14 -12
- package/dist/lib/browser/SheetContainer-Y7ZMFBAP.mjs.map +0 -7
- package/dist/lib/browser/chunk-GNNVBNCX.mjs.map +0 -7
- package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +0 -7
- package/dist/lib/browser/chunk-PGKZPKUD.mjs +0 -175
- package/dist/lib/browser/chunk-PGKZPKUD.mjs.map +0 -7
- package/dist/lib/browser/chunk-VBF7YENS.mjs +0 -8
- package/dist/lib/browser/chunk-VBF7YENS.mjs.map +0 -7
- package/dist/lib/browser/chunk-WUPTZUTX.mjs.map +0 -7
- package/dist/lib/browser/testing.mjs +0 -92
- package/dist/lib/browser/testing.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-KEOKUKAQ.cjs.map +0 -7
- package/dist/lib/node/chunk-57PB2HPY.cjs +0 -40
- package/dist/lib/node/chunk-57PB2HPY.cjs.map +0 -7
- package/dist/lib/node/chunk-6LWBQAQZ.cjs +0 -202
- package/dist/lib/node/chunk-6LWBQAQZ.cjs.map +0 -7
- package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +0 -7
- package/dist/lib/node/chunk-VJU3NPUJ.cjs.map +0 -7
- package/dist/lib/node/chunk-ZRQZFV5T.cjs.map +0 -7
- package/dist/lib/node/testing.cjs +0 -111
- package/dist/lib/node/testing.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-Y7ZMFBAP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GNNVBNCX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JRL5LGCE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PGKZPKUD.mjs +0 -175
- package/dist/lib/node-esm/chunk-PGKZPKUD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VBF7YENS.mjs +0 -8
- package/dist/lib/node-esm/chunk-VBF7YENS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WUPTZUTX.mjs.map +0 -7
- package/dist/lib/node-esm/testing.mjs +0 -92
- package/dist/lib/node-esm/testing.mjs.map +0 -7
- package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/custom.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph-context.d.ts +0 -12
- package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +0 -2
- package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph.d.ts +0 -26
- package/dist/types/src/components/ComputeGraph/graph.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/formatting.d.ts +0 -14
- package/dist/types/src/components/Sheet/formatting.d.ts.map +0 -1
- package/dist/types/src/model/functions.d.ts.map +0 -1
- package/dist/types/src/model/model.browser.test.d.ts +0 -2
- package/dist/types/src/model/model.browser.test.d.ts.map +0 -1
- package/dist/types/src/model/model.d.ts.map +0 -1
- package/dist/types/src/model/types.d.ts.map +0 -1
- package/dist/types/src/model/types.test.d.ts.map +0 -1
- package/dist/types/src/model/util.d.ts.map +0 -1
- package/dist/types/src/testing.d.ts +0 -9
- package/dist/types/src/testing.d.ts.map +0 -1
- package/src/components/ComputeGraph/graph-context.tsx +0 -50
- package/src/components/ComputeGraph/graph.browser.test.ts +0 -49
- package/src/components/ComputeGraph/graph.ts +0 -62
- package/src/model/model.browser.test.ts +0 -99
- package/src/testing.ts +0 -50
- /package/dist/types/src/{model → defs}/types.test.d.ts +0 -0
- /package/dist/types/src/{components/ComputeGraph → graph}/edge-function.d.ts +0 -0
- /package/src/{model/functions.ts → graph/function-defs.ts} +0 -0
|
@@ -26,47 +26,42 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
addressFromIndex: () => addressFromIndex,
|
|
37
|
-
addressToA1Notation: () => addressToA1Notation,
|
|
38
|
-
addressToIndex: () => addressToIndex,
|
|
39
|
-
closest: () => closest,
|
|
40
|
-
columnLetter: () => columnLetter,
|
|
41
|
-
compareIndexPositions: () => compareIndexPositions,
|
|
42
|
-
createComputeGraph: () => createComputeGraph,
|
|
29
|
+
var chunk_DD6FIXWC_exports = {};
|
|
30
|
+
__export(chunk_DD6FIXWC_exports, {
|
|
31
|
+
ComputeGraph: () => ComputeGraph,
|
|
32
|
+
ComputeGraphRegistry: () => ComputeGraphRegistry,
|
|
33
|
+
ComputeNode: () => ComputeNode,
|
|
34
|
+
createComputeGraphRegistry: () => createComputeGraphRegistry,
|
|
35
|
+
createSheetName: () => createSheetName,
|
|
43
36
|
defaultFunctions: () => defaultFunctions,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
rangeFromIndex: () => rangeFromIndex,
|
|
47
|
-
rangeToA1Notation: () => rangeToA1Notation
|
|
37
|
+
defaultOptions: () => defaultOptions,
|
|
38
|
+
getSheetId: () => getSheetId
|
|
48
39
|
});
|
|
49
|
-
module.exports = __toCommonJS(
|
|
50
|
-
var import_chunk_VJU3NPUJ = require("./chunk-VJU3NPUJ.cjs");
|
|
51
|
-
var import_hyperformula = require("hyperformula");
|
|
40
|
+
module.exports = __toCommonJS(chunk_DD6FIXWC_exports);
|
|
52
41
|
var import_async = require("@dxos/async");
|
|
42
|
+
var import_echo = require("@dxos/client/echo");
|
|
43
|
+
var import_context = require("@dxos/context");
|
|
44
|
+
var import_invariant = require("@dxos/invariant");
|
|
53
45
|
var import_keys = require("@dxos/keys");
|
|
54
46
|
var import_log = require("@dxos/log");
|
|
55
|
-
var
|
|
47
|
+
var import_types = require("@dxos/plugin-script/types");
|
|
48
|
+
var import_util = require("@dxos/util");
|
|
49
|
+
var import_hyperformula = require("#hyperformula");
|
|
56
50
|
var import_lodash = __toESM(require("lodash.defaultsdeep"));
|
|
57
51
|
var import_async2 = require("@dxos/async");
|
|
58
52
|
var import_log2 = require("@dxos/log");
|
|
59
|
-
var
|
|
53
|
+
var import_hyperformula2 = require("#hyperformula");
|
|
60
54
|
var import_async3 = require("@dxos/async");
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var
|
|
55
|
+
var import_context2 = require("@dxos/context");
|
|
56
|
+
var import_hyperformula3 = require("#hyperformula");
|
|
57
|
+
var import_signals_core = require("@preact/signals-core");
|
|
58
|
+
var import_echo2 = require("@dxos/client/echo");
|
|
64
59
|
var import_log3 = require("@dxos/log");
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/
|
|
60
|
+
var import_edge = require("@dxos/plugin-script/edge");
|
|
61
|
+
var import_types2 = require("@dxos/plugin-script/types");
|
|
62
|
+
var import_util2 = require("@dxos/util");
|
|
63
|
+
var import_hyperformula4 = require("#hyperformula");
|
|
64
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/async-function.ts";
|
|
70
65
|
var defaultFunctionContextOptions = {
|
|
71
66
|
defaultTtl: 5e3,
|
|
72
67
|
recalculationDelay: 200,
|
|
@@ -93,6 +88,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
93
88
|
onUpdate(this);
|
|
94
89
|
}, this._options.recalculationDelay);
|
|
95
90
|
}
|
|
91
|
+
// TODO(burdon): Remove?
|
|
96
92
|
get space() {
|
|
97
93
|
return this._space;
|
|
98
94
|
}
|
|
@@ -141,7 +137,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
141
137
|
value: value2
|
|
142
138
|
}, {
|
|
143
139
|
F: __dxlog_file,
|
|
144
|
-
L:
|
|
140
|
+
L: 138,
|
|
145
141
|
S: this,
|
|
146
142
|
C: (f, a) => f(...a)
|
|
147
143
|
});
|
|
@@ -152,7 +148,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
152
148
|
err
|
|
153
149
|
}, {
|
|
154
150
|
F: __dxlog_file,
|
|
155
|
-
L:
|
|
151
|
+
L: 142,
|
|
156
152
|
S: this,
|
|
157
153
|
C: (f, a) => f(...a)
|
|
158
154
|
});
|
|
@@ -172,7 +168,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
172
168
|
cache: value
|
|
173
169
|
}, {
|
|
174
170
|
F: __dxlog_file,
|
|
175
|
-
L:
|
|
171
|
+
L: 150,
|
|
176
172
|
S: this,
|
|
177
173
|
C: (f, a) => f(...a)
|
|
178
174
|
});
|
|
@@ -191,40 +187,156 @@ var FunctionPluginAsync = class extends import_hyperformula2.FunctionPlugin {
|
|
|
191
187
|
});
|
|
192
188
|
}
|
|
193
189
|
};
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.hf
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, this._options);
|
|
214
|
-
this.hf.updateConfig({
|
|
215
|
-
context: this.context
|
|
190
|
+
var ComputeNode = class extends import_context2.Resource {
|
|
191
|
+
constructor(_graph, sheetId) {
|
|
192
|
+
super();
|
|
193
|
+
this._graph = _graph;
|
|
194
|
+
this.sheetId = sheetId;
|
|
195
|
+
this.update = new import_async3.Event();
|
|
196
|
+
}
|
|
197
|
+
// TODO(burdon): Remove?
|
|
198
|
+
get graph() {
|
|
199
|
+
return this._graph;
|
|
200
|
+
}
|
|
201
|
+
get hf() {
|
|
202
|
+
return this._graph.hf;
|
|
203
|
+
}
|
|
204
|
+
getValue(cell) {
|
|
205
|
+
const value = this._graph.hf.getCellValue({
|
|
206
|
+
sheet: this.sheetId,
|
|
207
|
+
row: cell.row,
|
|
208
|
+
col: cell.col
|
|
216
209
|
});
|
|
210
|
+
if (value instanceof import_hyperformula3.DetailedCellError) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
return value;
|
|
217
214
|
}
|
|
218
|
-
|
|
219
|
-
(0
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
215
|
+
setValue(cell, value) {
|
|
216
|
+
const mappedValue = typeof value === "string" && value.charAt(0) === "=" ? this._graph.mapFormulaToNative(value) : value;
|
|
217
|
+
this._graph.hf.setCellContents({
|
|
218
|
+
sheet: this.sheetId,
|
|
219
|
+
row: cell.row,
|
|
220
|
+
col: cell.col
|
|
221
|
+
}, [
|
|
222
|
+
[
|
|
223
|
+
mappedValue
|
|
224
|
+
]
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/edge-function.ts";
|
|
229
|
+
var EDGE_FUNCTION_TTL = 1e4;
|
|
230
|
+
var EdgeFunctionPlugin = class extends FunctionPluginAsync {
|
|
231
|
+
edge(ast, state) {
|
|
232
|
+
const handler = (subscribe = false) => async (binding, ...args) => {
|
|
233
|
+
const space = this.context.space;
|
|
234
|
+
if (!space) {
|
|
235
|
+
return new import_hyperformula4.CellError(import_hyperformula4.ErrorType.REF, "Missing space");
|
|
236
|
+
}
|
|
237
|
+
const { objects: [fn] } = await space.db.query(import_echo2.Filter.schema(import_types2.FunctionType, {
|
|
238
|
+
binding
|
|
239
|
+
})).run();
|
|
240
|
+
if (!fn) {
|
|
241
|
+
import_log3.log.info("Function not found", {
|
|
242
|
+
binding
|
|
243
|
+
}, {
|
|
244
|
+
F: __dxlog_file2,
|
|
245
|
+
L: 39,
|
|
246
|
+
S: this,
|
|
247
|
+
C: (f, a) => f(...a)
|
|
248
|
+
});
|
|
249
|
+
return new import_hyperformula4.CellError(import_hyperformula4.ErrorType.REF, "Function not found");
|
|
250
|
+
}
|
|
251
|
+
if (subscribe) {
|
|
252
|
+
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
253
|
+
import_log3.log.info("function changed", {
|
|
254
|
+
fn
|
|
255
|
+
}, {
|
|
256
|
+
F: __dxlog_file2,
|
|
257
|
+
L: 45,
|
|
258
|
+
S: this,
|
|
259
|
+
C: (f, a) => f(...a)
|
|
260
|
+
});
|
|
261
|
+
const _ = fn?.version;
|
|
262
|
+
this.runAsyncFunction(ast, state, handler(false), {
|
|
263
|
+
ttl: EDGE_FUNCTION_TTL
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
this.context.createSubscription(ast.procedureName, unsubscribe);
|
|
267
|
+
}
|
|
268
|
+
const path = (0, import_edge.getUserFunctionUrlInMetadata)((0, import_echo2.getMeta)(fn));
|
|
269
|
+
const result = await fetch(`${this.context.remoteFunctionUrl}${path}`, {
|
|
270
|
+
method: "POST",
|
|
271
|
+
headers: {
|
|
272
|
+
"Content-Type": "application/json"
|
|
273
|
+
},
|
|
274
|
+
body: JSON.stringify({
|
|
275
|
+
args: args.filter(import_util2.nonNullable)
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
return await result.text();
|
|
279
|
+
};
|
|
280
|
+
return this.runAsyncFunction(ast, state, handler(true), {
|
|
281
|
+
ttl: EDGE_FUNCTION_TTL
|
|
226
282
|
});
|
|
227
|
-
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
EdgeFunctionPlugin.implementedFunctions = {
|
|
286
|
+
EDGE: {
|
|
287
|
+
method: "edge",
|
|
288
|
+
parameters: [
|
|
289
|
+
// Binding
|
|
290
|
+
{
|
|
291
|
+
argumentType: import_hyperformula4.FunctionArgumentType.STRING
|
|
292
|
+
},
|
|
293
|
+
// Remote function arguments (currently supporting up to 9).
|
|
294
|
+
{
|
|
295
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
296
|
+
optionalArg: true
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
300
|
+
optionalArg: true
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
304
|
+
optionalArg: true
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
308
|
+
optionalArg: true
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
312
|
+
optionalArg: true
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
316
|
+
optionalArg: true
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
320
|
+
optionalArg: true
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
324
|
+
optionalArg: true
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
argumentType: import_hyperformula4.FunctionArgumentType.ANY,
|
|
328
|
+
optionalArg: true
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
isVolatile: true
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
var EdgeFunctionPluginTranslations = {
|
|
335
|
+
enGB: {
|
|
336
|
+
EDGE: "EDGE"
|
|
337
|
+
},
|
|
338
|
+
enUS: {
|
|
339
|
+
EDGE: "EDGE"
|
|
228
340
|
}
|
|
229
341
|
};
|
|
230
342
|
var defaultFunctions = [
|
|
@@ -2599,674 +2711,242 @@ var defaultFunctions = [
|
|
|
2599
2711
|
section: "Text"
|
|
2600
2712
|
}
|
|
2601
2713
|
];
|
|
2602
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
"column < MAX_COLUMNS",
|
|
2614
|
-
"`Invalid column: ${column}`"
|
|
2615
|
-
]
|
|
2616
|
-
});
|
|
2617
|
-
return (column >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(column / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + column % 26);
|
|
2618
|
-
};
|
|
2619
|
-
var addressToA1Notation = ({ column, row }) => {
|
|
2620
|
-
return `${columnLetter(column)}${row + 1}`;
|
|
2714
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/graph/compute-graph.ts";
|
|
2715
|
+
var OBJECT_ID_LENGTH = 60;
|
|
2716
|
+
var CUSTOM_FUNCTION = "ECHO";
|
|
2717
|
+
var defaultOptions = {
|
|
2718
|
+
licenseKey: "gpl-v3",
|
|
2719
|
+
plugins: [
|
|
2720
|
+
{
|
|
2721
|
+
plugin: EdgeFunctionPlugin,
|
|
2722
|
+
translations: EdgeFunctionPluginTranslations
|
|
2723
|
+
}
|
|
2724
|
+
]
|
|
2621
2725
|
};
|
|
2622
|
-
var
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
"match",
|
|
2630
|
-
"`Invalid notation: ${ref}`"
|
|
2631
|
-
]
|
|
2726
|
+
var PREFIX = "__";
|
|
2727
|
+
var createSheetName = (id) => `${PREFIX}${id}`;
|
|
2728
|
+
var getSheetId = (name) => name.startsWith(PREFIX) ? name.slice(PREFIX.length) : void 0;
|
|
2729
|
+
var createComputeGraphRegistry = (options = {}) => {
|
|
2730
|
+
return new ComputeGraphRegistry({
|
|
2731
|
+
...defaultOptions,
|
|
2732
|
+
...options
|
|
2632
2733
|
});
|
|
2633
|
-
return {
|
|
2634
|
-
row: parseInt(match[2], 10) - 1,
|
|
2635
|
-
column: match[1].split("").reduce((acc, c) => acc * 26 + c.charCodeAt(0) - "A".charCodeAt(0) + 1, 0) - 1
|
|
2636
|
-
};
|
|
2637
|
-
};
|
|
2638
|
-
var rangeToA1Notation = (range) => {
|
|
2639
|
-
return [
|
|
2640
|
-
range?.from && addressToA1Notation(range?.from),
|
|
2641
|
-
range?.to && addressToA1Notation(range?.to)
|
|
2642
|
-
].filter(Boolean).join(":");
|
|
2643
|
-
};
|
|
2644
|
-
var inRange = (range, cell) => {
|
|
2645
|
-
if (!range) {
|
|
2646
|
-
return false;
|
|
2647
|
-
}
|
|
2648
|
-
const { from, to } = range;
|
|
2649
|
-
if (from && posEquals(from, cell) || to && posEquals(to, cell)) {
|
|
2650
|
-
return true;
|
|
2651
|
-
}
|
|
2652
|
-
if (!from || !to) {
|
|
2653
|
-
return false;
|
|
2654
|
-
}
|
|
2655
|
-
const { column: c1, row: r1 } = from;
|
|
2656
|
-
const { column: c2, row: r2 } = to;
|
|
2657
|
-
const cMin = Math.min(c1, c2);
|
|
2658
|
-
const cMax = Math.max(c1, c2);
|
|
2659
|
-
const rMin = Math.min(r1, r2);
|
|
2660
|
-
const rMax = Math.max(r1, r2);
|
|
2661
|
-
const { column, row } = cell;
|
|
2662
|
-
return column >= cMin && column <= cMax && row >= rMin && row <= rMax;
|
|
2663
2734
|
};
|
|
2664
|
-
var
|
|
2665
|
-
|
|
2666
|
-
var ReadonlyException = class extends ApiError {
|
|
2667
|
-
};
|
|
2668
|
-
var RangeException = class extends ApiError {
|
|
2669
|
-
constructor(n) {
|
|
2735
|
+
var ComputeGraphRegistry = class extends import_context.Resource {
|
|
2736
|
+
constructor(_options = defaultOptions) {
|
|
2670
2737
|
super();
|
|
2738
|
+
this._options = _options;
|
|
2739
|
+
this._registry = /* @__PURE__ */ new Map();
|
|
2740
|
+
this._options.plugins?.forEach(({ plugin, translations }) => {
|
|
2741
|
+
import_hyperformula.HyperFormula.registerFunctionPlugin(plugin, translations);
|
|
2742
|
+
});
|
|
2671
2743
|
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
return {
|
|
2688
|
-
column: sheet.columns.indexOf(column),
|
|
2689
|
-
row: sheet.rows.indexOf(row)
|
|
2690
|
-
};
|
|
2691
|
-
};
|
|
2692
|
-
var rangeFromIndex = (sheet, idx) => {
|
|
2693
|
-
const [from, to] = idx.split(":").map((index) => addressFromIndex(sheet, index));
|
|
2694
|
-
return {
|
|
2695
|
-
from,
|
|
2696
|
-
to
|
|
2697
|
-
};
|
|
2698
|
-
};
|
|
2699
|
-
var closest = (cursor, cells) => {
|
|
2700
|
-
let closestCell;
|
|
2701
|
-
let closestDistance = Number.MAX_SAFE_INTEGER;
|
|
2702
|
-
for (const cell of cells) {
|
|
2703
|
-
const distance = Math.abs(cell.row - cursor.row) + Math.abs(cell.column - cursor.column);
|
|
2704
|
-
if (distance < closestDistance) {
|
|
2705
|
-
closestCell = cell;
|
|
2706
|
-
closestDistance = distance;
|
|
2744
|
+
getGraph(spaceId) {
|
|
2745
|
+
return this._registry.get(spaceId);
|
|
2746
|
+
}
|
|
2747
|
+
async getOrCreateGraph(space) {
|
|
2748
|
+
let graph = this.getGraph(space.id);
|
|
2749
|
+
if (!graph) {
|
|
2750
|
+
import_log.log.info("create graph", {
|
|
2751
|
+
space: space.id
|
|
2752
|
+
}, {
|
|
2753
|
+
F: __dxlog_file3,
|
|
2754
|
+
L: 95,
|
|
2755
|
+
S: this,
|
|
2756
|
+
C: (f, a) => f(...a)
|
|
2757
|
+
});
|
|
2758
|
+
graph = await this.createGraph(space);
|
|
2707
2759
|
}
|
|
2760
|
+
return graph;
|
|
2708
2761
|
}
|
|
2709
|
-
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2762
|
+
async createGraph(space) {
|
|
2763
|
+
(0, import_invariant.invariant)(!this._registry.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
|
|
2764
|
+
F: __dxlog_file3,
|
|
2765
|
+
L: 103,
|
|
2766
|
+
S: this,
|
|
2767
|
+
A: [
|
|
2768
|
+
"!this._registry.has(space.id)",
|
|
2769
|
+
"`ComputeGraph already exists for space: ${space.id}`"
|
|
2770
|
+
]
|
|
2771
|
+
});
|
|
2772
|
+
const hf = import_hyperformula.HyperFormula.buildEmpty(this._options);
|
|
2773
|
+
const graph = new ComputeGraph(hf, space, this._options);
|
|
2774
|
+
await graph.open(this._ctx);
|
|
2775
|
+
this._registry.set(space.id, graph);
|
|
2776
|
+
return graph;
|
|
2718
2777
|
}
|
|
2719
2778
|
};
|
|
2720
|
-
var
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
BOOLEAN: import_chunk_VJU3NPUJ.ValueTypeEnum.Boolean,
|
|
2725
|
-
NUMBER_RAW: import_chunk_VJU3NPUJ.ValueTypeEnum.Number,
|
|
2726
|
-
NUMBER_PERCENT: import_chunk_VJU3NPUJ.ValueTypeEnum.Percent,
|
|
2727
|
-
NUMBER_CURRENCY: import_chunk_VJU3NPUJ.ValueTypeEnum.Currency,
|
|
2728
|
-
NUMBER_DATETIME: import_chunk_VJU3NPUJ.ValueTypeEnum.DateTime,
|
|
2729
|
-
NUMBER_DATE: import_chunk_VJU3NPUJ.ValueTypeEnum.Date,
|
|
2730
|
-
NUMBER_TIME: import_chunk_VJU3NPUJ.ValueTypeEnum.Time
|
|
2731
|
-
};
|
|
2732
|
-
var defaultOptions = {
|
|
2733
|
-
rows: 50,
|
|
2734
|
-
columns: 26,
|
|
2735
|
-
mapFormulaBindingFromId: () => (formula) => formula,
|
|
2736
|
-
mapFormulaBindingToId: () => (formula) => formula
|
|
2737
|
-
};
|
|
2738
|
-
var getTopLeft = (range) => {
|
|
2739
|
-
const to = range.to ?? range.from;
|
|
2740
|
-
return {
|
|
2741
|
-
row: Math.min(range.from.row, to.row),
|
|
2742
|
-
column: Math.min(range.from.column, to.column)
|
|
2743
|
-
};
|
|
2744
|
-
};
|
|
2745
|
-
var toSimpleCellAddress = (sheet, cell) => ({
|
|
2746
|
-
sheet,
|
|
2747
|
-
row: cell.row,
|
|
2748
|
-
col: cell.column
|
|
2749
|
-
});
|
|
2750
|
-
var toModelRange = (sheet, range) => ({
|
|
2751
|
-
start: toSimpleCellAddress(sheet, range.from),
|
|
2752
|
-
end: toSimpleCellAddress(sheet, range.to ?? range.from)
|
|
2753
|
-
});
|
|
2754
|
-
var SheetModel = class {
|
|
2755
|
-
constructor(_graph, _sheet, _space, options = {}) {
|
|
2756
|
-
this._graph = _graph;
|
|
2757
|
-
this._sheet = _sheet;
|
|
2779
|
+
var ComputeGraph = class extends import_context.Resource {
|
|
2780
|
+
constructor(_hf, _space, _options) {
|
|
2781
|
+
super();
|
|
2782
|
+
this._hf = _hf;
|
|
2758
2783
|
this._space = _space;
|
|
2759
|
-
this.
|
|
2760
|
-
this.
|
|
2784
|
+
this._options = _options;
|
|
2785
|
+
this.id = `graph-${import_keys.PublicKey.random().truncate()}`;
|
|
2786
|
+
this._nodes = /* @__PURE__ */ new Map();
|
|
2761
2787
|
this._functions = [];
|
|
2762
|
-
this.
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
this.
|
|
2766
|
-
}
|
|
2767
|
-
this._sheetId = this._graph.hf.getSheetId(name);
|
|
2768
|
-
this._options = {
|
|
2769
|
-
...defaultOptions,
|
|
2770
|
-
...options
|
|
2771
|
-
};
|
|
2772
|
-
this.reset();
|
|
2773
|
-
}
|
|
2774
|
-
get graph() {
|
|
2775
|
-
return this._graph;
|
|
2776
|
-
}
|
|
2777
|
-
get sheet() {
|
|
2778
|
-
return this._sheet;
|
|
2779
|
-
}
|
|
2780
|
-
get readonly() {
|
|
2781
|
-
return this._options.readonly;
|
|
2782
|
-
}
|
|
2783
|
-
get bounds() {
|
|
2784
|
-
return {
|
|
2785
|
-
rows: this._sheet.rows.length,
|
|
2786
|
-
columns: this._sheet.columns.length
|
|
2787
|
-
};
|
|
2788
|
-
}
|
|
2789
|
-
get functions() {
|
|
2790
|
-
const hfFunctions = this._graph.hf.getRegisteredFunctionNames().map((name) => defaultFunctions.find((fn) => fn.name === name) ?? {
|
|
2791
|
-
name
|
|
2788
|
+
this.context = new FunctionContext(this._hf, this._space, this.refresh.bind(this), this._options);
|
|
2789
|
+
this.update = new import_async.Event();
|
|
2790
|
+
this._hf.updateConfig({
|
|
2791
|
+
context: this.context
|
|
2792
2792
|
});
|
|
2793
|
-
const echoFunctions = this._functions.map((fn) => ({
|
|
2794
|
-
name: fn.binding
|
|
2795
|
-
}));
|
|
2796
|
-
return [
|
|
2797
|
-
...hfFunctions,
|
|
2798
|
-
...echoFunctions
|
|
2799
|
-
];
|
|
2800
|
-
}
|
|
2801
|
-
get initialized() {
|
|
2802
|
-
return !!this._ctx;
|
|
2803
2793
|
}
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
async initialize() {
|
|
2808
|
-
(0, import_log3.log)("initialize", {
|
|
2809
|
-
id: this.id
|
|
2810
|
-
}, {
|
|
2811
|
-
F: __dxlog_file4,
|
|
2812
|
-
L: 142,
|
|
2813
|
-
S: this,
|
|
2814
|
-
C: (f, a) => f(...a)
|
|
2815
|
-
});
|
|
2816
|
-
(0, import_invariant.invariant)(!this.initialized, "Already initialized.", {
|
|
2817
|
-
F: __dxlog_file4,
|
|
2818
|
-
L: 143,
|
|
2819
|
-
S: this,
|
|
2820
|
-
A: [
|
|
2821
|
-
"!this.initialized",
|
|
2822
|
-
"'Already initialized.'"
|
|
2823
|
-
]
|
|
2824
|
-
});
|
|
2825
|
-
this._ctx = new import_context.Context(void 0, {
|
|
2826
|
-
F: __dxlog_file4,
|
|
2827
|
-
L: 144
|
|
2828
|
-
});
|
|
2829
|
-
if (!this._sheet.rows.length) {
|
|
2830
|
-
this._insertIndices(this._sheet.rows, 0, this._options.rows, DEFAULT_ROWS);
|
|
2831
|
-
}
|
|
2832
|
-
if (!this._sheet.columns.length) {
|
|
2833
|
-
this._insertIndices(this._sheet.columns, 0, this._options.columns, DEFAULT_COLUMNS);
|
|
2834
|
-
}
|
|
2835
|
-
this.reset();
|
|
2836
|
-
const unsubscribe = this._graph.update.on(() => this.update.emit());
|
|
2837
|
-
this._ctx.onDispose(unsubscribe);
|
|
2838
|
-
if (this._space) {
|
|
2839
|
-
const { Filter } = await import("@dxos/client/echo");
|
|
2840
|
-
const { FunctionType } = await import("@dxos/plugin-script/types");
|
|
2841
|
-
const query = this._space?.db.query(Filter.schema(FunctionType));
|
|
2842
|
-
const unsubscribe2 = query.subscribe(({ objects }) => {
|
|
2843
|
-
this._functions = objects.filter((fn) => fn.binding);
|
|
2844
|
-
this.update.emit();
|
|
2845
|
-
});
|
|
2846
|
-
this._ctx.onDispose(unsubscribe2);
|
|
2847
|
-
}
|
|
2848
|
-
return this;
|
|
2794
|
+
// TODO(burdon): Remove.
|
|
2795
|
+
get hf() {
|
|
2796
|
+
return this._hf;
|
|
2849
2797
|
}
|
|
2850
|
-
|
|
2851
|
-
(0,
|
|
2798
|
+
refresh() {
|
|
2799
|
+
(0, import_log.log)("refresh", {
|
|
2852
2800
|
id: this.id
|
|
2853
2801
|
}, {
|
|
2854
|
-
F:
|
|
2855
|
-
L:
|
|
2802
|
+
F: __dxlog_file3,
|
|
2803
|
+
L: 152,
|
|
2856
2804
|
S: this,
|
|
2857
2805
|
C: (f, a) => f(...a)
|
|
2858
2806
|
});
|
|
2859
|
-
|
|
2860
|
-
await this._ctx.dispose();
|
|
2861
|
-
this._ctx = void 0;
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* Update engine.
|
|
2866
|
-
* NOTE: This resets the undo history.
|
|
2867
|
-
* @deprecated
|
|
2868
|
-
*/
|
|
2869
|
-
reset() {
|
|
2870
|
-
this._graph.hf.clearSheet(this._sheetId);
|
|
2871
|
-
Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
|
|
2872
|
-
const { column, row } = addressFromIndex(this._sheet, key);
|
|
2873
|
-
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
2874
|
-
value = this.mapFormulaBindingToFormula(this.mapFormulaBindingFromId(this.mapFormulaIndicesToRefs(value)));
|
|
2875
|
-
}
|
|
2876
|
-
this._graph.hf.setCellContents({
|
|
2877
|
-
sheet: this._sheetId,
|
|
2878
|
-
row,
|
|
2879
|
-
col: column
|
|
2880
|
-
}, value);
|
|
2881
|
-
});
|
|
2882
|
-
}
|
|
2883
|
-
/**
|
|
2884
|
-
* Recalculate formulas.
|
|
2885
|
-
* NOTE: This resets the undo history.
|
|
2886
|
-
* https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
|
|
2887
|
-
* @deprecated
|
|
2888
|
-
*/
|
|
2889
|
-
// TODO(burdon): Remove.
|
|
2890
|
-
recalculate() {
|
|
2891
|
-
this._graph.hf.rebuildAndRecalculate();
|
|
2892
|
-
}
|
|
2893
|
-
insertRows(i, n = 1) {
|
|
2894
|
-
this._insertIndices(this._sheet.rows, i, n, DEFAULT_ROWS);
|
|
2895
|
-
this.reset();
|
|
2807
|
+
this.update.emit();
|
|
2896
2808
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2809
|
+
getFunctions({ standard = true, echo = true } = {}) {
|
|
2810
|
+
return [
|
|
2811
|
+
...standard ? this._hf.getRegisteredFunctionNames().map((name) => defaultFunctions.find((fn) => fn.name === name) ?? {
|
|
2812
|
+
name
|
|
2813
|
+
}) : [],
|
|
2814
|
+
...echo ? this._functions.map((fn) => ({
|
|
2815
|
+
name: fn.binding
|
|
2816
|
+
})) : []
|
|
2817
|
+
];
|
|
2900
2818
|
}
|
|
2901
|
-
//
|
|
2902
|
-
// Undoable actions.
|
|
2903
|
-
// TODO(burdon): Group undoable methods; consistently update hf/sheet.
|
|
2904
|
-
//
|
|
2905
2819
|
/**
|
|
2906
|
-
*
|
|
2820
|
+
* Get or create cell representing a sheet.
|
|
2907
2821
|
*/
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2822
|
+
// TODO(burdon): Async (open node).
|
|
2823
|
+
// The graph should be an extensible factory that plugins extend with model constructors.
|
|
2824
|
+
// This would enable on-the-fly instantiation of new models when then are referenced.
|
|
2825
|
+
// E.g., Cross-object reference would be stored as "ObjectId!A1"
|
|
2826
|
+
// The graph would then load the object and create a ComputeNode (model) of the appropriate type.
|
|
2827
|
+
getOrCreateNode(name) {
|
|
2828
|
+
(0, import_invariant.invariant)(name.length, void 0, {
|
|
2829
|
+
F: __dxlog_file3,
|
|
2830
|
+
L: 176,
|
|
2831
|
+
S: this,
|
|
2832
|
+
A: [
|
|
2833
|
+
"name.length",
|
|
2834
|
+
""
|
|
2835
|
+
]
|
|
2922
2836
|
});
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
row: address.row,
|
|
2935
|
-
column: address.col
|
|
2936
|
-
});
|
|
2937
|
-
this._sheet.cells[idx] = {
|
|
2938
|
-
value: newValue
|
|
2939
|
-
};
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
// TODO(burdon): Display undo/redo state.
|
|
2945
|
-
undo() {
|
|
2946
|
-
if (this._graph.hf.isThereSomethingToUndo()) {
|
|
2947
|
-
this._graph.hf.undo();
|
|
2948
|
-
this.update.emit();
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
redo() {
|
|
2952
|
-
if (this._graph.hf.isThereSomethingToRedo()) {
|
|
2953
|
-
this._graph.hf.redo();
|
|
2837
|
+
if (!this._hf.doesSheetExist(name)) {
|
|
2838
|
+
import_log.log.info("created node", {
|
|
2839
|
+
space: this._space?.id,
|
|
2840
|
+
name
|
|
2841
|
+
}, {
|
|
2842
|
+
F: __dxlog_file3,
|
|
2843
|
+
L: 178,
|
|
2844
|
+
S: this,
|
|
2845
|
+
C: (f, a) => f(...a)
|
|
2846
|
+
});
|
|
2847
|
+
this._hf.addSheet(name);
|
|
2954
2848
|
this.update.emit();
|
|
2955
2849
|
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
/**
|
|
2965
|
-
* Get value as a string for editing.
|
|
2966
|
-
*/
|
|
2967
|
-
getCellText(cell) {
|
|
2968
|
-
const value = this.getCellValue(cell);
|
|
2969
|
-
if (value == null) {
|
|
2970
|
-
return void 0;
|
|
2971
|
-
}
|
|
2972
|
-
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
2973
|
-
return this.mapFormulaBindingFromId(this.mapFormulaIndicesToRefs(value));
|
|
2974
|
-
} else {
|
|
2975
|
-
return String(value);
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
/**
|
|
2979
|
-
* Get array of raw values from sheet.
|
|
2980
|
-
*/
|
|
2981
|
-
getCellValues(range) {
|
|
2982
|
-
return this._iterRange(range, (cell) => this.getCellValue(cell));
|
|
2983
|
-
}
|
|
2984
|
-
/**
|
|
2985
|
-
* Gets the regular or computed value from the engine.
|
|
2986
|
-
*/
|
|
2987
|
-
getValue(cell) {
|
|
2988
|
-
const value = this._graph.hf.getCellValue(toSimpleCellAddress(this._sheetId, cell));
|
|
2989
|
-
if (value instanceof import_hyperformula3.DetailedCellError) {
|
|
2990
|
-
return value.toString();
|
|
2991
|
-
}
|
|
2992
|
-
return value;
|
|
2993
|
-
}
|
|
2994
|
-
/**
|
|
2995
|
-
* Get value type.
|
|
2996
|
-
*/
|
|
2997
|
-
getValueType(cell) {
|
|
2998
|
-
const addr = toSimpleCellAddress(this._sheetId, cell);
|
|
2999
|
-
const type = this._graph.hf.getCellValueDetailedType(addr);
|
|
3000
|
-
return typeMap[type];
|
|
3001
|
-
}
|
|
3002
|
-
/**
|
|
3003
|
-
* Sets the value, updating the sheet and engine.
|
|
3004
|
-
*/
|
|
3005
|
-
setValue(cell, value) {
|
|
3006
|
-
if (this._options.readonly) {
|
|
3007
|
-
throw new ReadonlyException();
|
|
3008
|
-
}
|
|
3009
|
-
let refresh = false;
|
|
3010
|
-
if (cell.row >= this._sheet.rows.length) {
|
|
3011
|
-
this._insertIndices(this._sheet.rows, cell.row, 1, DEFAULT_ROWS);
|
|
3012
|
-
refresh = true;
|
|
3013
|
-
}
|
|
3014
|
-
if (cell.column >= this._sheet.columns.length) {
|
|
3015
|
-
this._insertIndices(this._sheet.columns, cell.column, 1, DEFAULT_COLUMNS);
|
|
3016
|
-
refresh = true;
|
|
3017
|
-
}
|
|
3018
|
-
if (refresh) {
|
|
3019
|
-
this.reset();
|
|
3020
|
-
}
|
|
3021
|
-
this._graph.hf.setCellContents({
|
|
3022
|
-
sheet: this._sheetId,
|
|
3023
|
-
row: cell.row,
|
|
3024
|
-
col: cell.column
|
|
3025
|
-
}, [
|
|
3026
|
-
[
|
|
3027
|
-
typeof value === "string" && value.charAt(0) === "=" ? this.mapFormulaBindingToFormula(value) : value
|
|
2850
|
+
const sheetId = this._hf.getSheetId(name);
|
|
2851
|
+
(0, import_invariant.invariant)(sheetId !== void 0, void 0, {
|
|
2852
|
+
F: __dxlog_file3,
|
|
2853
|
+
L: 184,
|
|
2854
|
+
S: this,
|
|
2855
|
+
A: [
|
|
2856
|
+
"sheetId !== undefined",
|
|
2857
|
+
""
|
|
3028
2858
|
]
|
|
3029
|
-
]);
|
|
3030
|
-
const idx = addressToIndex(this._sheet, cell);
|
|
3031
|
-
if (value === void 0 || value === null) {
|
|
3032
|
-
delete this._sheet.cells[idx];
|
|
3033
|
-
} else {
|
|
3034
|
-
if (typeof value === "string" && value.charAt(0) === "=") {
|
|
3035
|
-
value = this.mapFormulaBindingToId(this.mapFormulaRefsToIndices(value));
|
|
3036
|
-
}
|
|
3037
|
-
this._sheet.cells[idx] = {
|
|
3038
|
-
value
|
|
3039
|
-
};
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
/**
|
|
3043
|
-
* Sets values from a simple map.
|
|
3044
|
-
*/
|
|
3045
|
-
setValues(values) {
|
|
3046
|
-
Object.entries(values).forEach(([key, { value }]) => {
|
|
3047
|
-
this.setValue(addressFromA1Notation(key), value);
|
|
3048
2859
|
});
|
|
2860
|
+
const node = new ComputeNode(this, sheetId);
|
|
2861
|
+
this._nodes.set(sheetId, node);
|
|
2862
|
+
return node;
|
|
3049
2863
|
}
|
|
3050
2864
|
/**
|
|
3051
|
-
*
|
|
2865
|
+
* Map bound value to custom function invocation.
|
|
2866
|
+
* E.g., "HELLO(...args)" => "EDGE("HELLO", ...args)".
|
|
3052
2867
|
*/
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
for (let row = rowRange[0]; row <= rowRange[1]; row++) {
|
|
3065
|
-
const rowCells = [];
|
|
3066
|
-
for (let column = columnRange[0]; column <= columnRange[1]; column++) {
|
|
3067
|
-
const value = cb({
|
|
3068
|
-
row,
|
|
3069
|
-
column
|
|
3070
|
-
});
|
|
3071
|
-
if (value !== void 0) {
|
|
3072
|
-
rowCells.push(value);
|
|
2868
|
+
mapFormulaToNative(formula) {
|
|
2869
|
+
return formula.replace(/['"]?([ \w]+)['"]?!/, (_match, name) => {
|
|
2870
|
+
if (name) {
|
|
2871
|
+
const objects = this._hf.getSheetNames().map((name2) => {
|
|
2872
|
+
const id = getSheetId(name2);
|
|
2873
|
+
return id ? this._space?.db.getObjectById(id) : void 0;
|
|
2874
|
+
}).filter(import_util.nonNullable);
|
|
2875
|
+
for (const obj of objects) {
|
|
2876
|
+
if (obj.name === name || obj.title === name) {
|
|
2877
|
+
return `${createSheetName(obj.id)}!`;
|
|
2878
|
+
}
|
|
3073
2879
|
}
|
|
3074
2880
|
}
|
|
3075
|
-
|
|
3076
|
-
}
|
|
3077
|
-
return rows;
|
|
3078
|
-
}
|
|
3079
|
-
/**
|
|
3080
|
-
*
|
|
3081
|
-
*/
|
|
3082
|
-
// TODO(burdon): Insert indices into sheet.
|
|
3083
|
-
_insertIndices(indices, i, n, max) {
|
|
3084
|
-
if (i + n > max) {
|
|
3085
|
-
throw new RangeException(i + n);
|
|
3086
|
-
}
|
|
3087
|
-
const idx = createIndices(n);
|
|
3088
|
-
indices.splice(i, 0, ...idx);
|
|
3089
|
-
}
|
|
3090
|
-
// TODO(burdon): Delete index.
|
|
3091
|
-
_deleteIndices(indices, i, n) {
|
|
3092
|
-
throw new Error("Not implemented");
|
|
3093
|
-
}
|
|
3094
|
-
// TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
|
|
3095
|
-
_moveIndices(indices, i, j, n) {
|
|
3096
|
-
throw new Error("Not implemented");
|
|
3097
|
-
}
|
|
3098
|
-
//
|
|
3099
|
-
// Indices.
|
|
3100
|
-
//
|
|
3101
|
-
/**
|
|
3102
|
-
* E.g., "HELLO()" => "EDGE("HELLO")".
|
|
3103
|
-
*/
|
|
3104
|
-
mapFormulaBindingToFormula(formula) {
|
|
3105
|
-
return formula.replace(/([a-zA-Z0-9]+)\((.*)\)/g, (match, binding, args) => {
|
|
2881
|
+
return `${name}!`;
|
|
2882
|
+
}).replace(/(\w+)\((.*)\)/g, (match, binding, args) => {
|
|
3106
2883
|
const fn = this._functions.find((fn2) => fn2.binding === binding);
|
|
3107
2884
|
if (!fn) {
|
|
3108
2885
|
return match;
|
|
3109
2886
|
}
|
|
3110
2887
|
if (args.trim() === "") {
|
|
3111
|
-
return
|
|
2888
|
+
return `${CUSTOM_FUNCTION}("${binding}")`;
|
|
2889
|
+
} else {
|
|
2890
|
+
return `${CUSTOM_FUNCTION}("${binding}", ${args})`;
|
|
3112
2891
|
}
|
|
3113
|
-
return `EDGE("${binding}", ${args})`;
|
|
3114
2892
|
});
|
|
3115
2893
|
}
|
|
3116
2894
|
/**
|
|
3117
|
-
*
|
|
2895
|
+
* Map from binding to fully qualified ECHO ID (to store).
|
|
2896
|
+
* E.g., HELLO() => spaceId:objectId()
|
|
3118
2897
|
*/
|
|
3119
|
-
|
|
3120
|
-
return formula.replace(/
|
|
3121
|
-
if (
|
|
3122
|
-
return
|
|
2898
|
+
mapFunctionBindingToId(formula) {
|
|
2899
|
+
return formula.replace(/(\w+)\((.*)\)/g, (match, binding, args) => {
|
|
2900
|
+
if (binding === CUSTOM_FUNCTION || defaultFunctions.find((fn2) => fn2.name === binding)) {
|
|
2901
|
+
return match;
|
|
2902
|
+
}
|
|
2903
|
+
const fn = this._functions.find((fn2) => fn2.binding === binding);
|
|
2904
|
+
if (fn) {
|
|
2905
|
+
const id = (0, import_echo.fullyQualifiedId)(fn);
|
|
2906
|
+
return `${id}(${args})`;
|
|
2907
|
+
} else {
|
|
2908
|
+
return match;
|
|
3123
2909
|
}
|
|
3124
|
-
return `${binding}(${args.slice(2)})`;
|
|
3125
|
-
});
|
|
3126
|
-
}
|
|
3127
|
-
/**
|
|
3128
|
-
* Map from binding to fully qualified ECHO ID.
|
|
3129
|
-
*/
|
|
3130
|
-
mapFormulaBindingToId(formula) {
|
|
3131
|
-
return this._options.mapFormulaBindingToId(this._functions)(formula);
|
|
3132
|
-
}
|
|
3133
|
-
/**
|
|
3134
|
-
* Map from fully qualified ECHO ID to binding.
|
|
3135
|
-
*/
|
|
3136
|
-
mapFormulaBindingFromId(formula) {
|
|
3137
|
-
return this._options.mapFormulaBindingFromId(this._functions)(formula);
|
|
3138
|
-
}
|
|
3139
|
-
/**
|
|
3140
|
-
* Map from A1 notation to indices.
|
|
3141
|
-
*/
|
|
3142
|
-
mapFormulaRefsToIndices(formula) {
|
|
3143
|
-
(0, import_invariant.invariant)(formula.charAt(0) === "=", void 0, {
|
|
3144
|
-
F: __dxlog_file4,
|
|
3145
|
-
L: 475,
|
|
3146
|
-
S: this,
|
|
3147
|
-
A: [
|
|
3148
|
-
"formula.charAt(0) === '='",
|
|
3149
|
-
""
|
|
3150
|
-
]
|
|
3151
|
-
});
|
|
3152
|
-
return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
|
|
3153
|
-
return addressToIndex(this._sheet, addressFromA1Notation(match));
|
|
3154
|
-
});
|
|
3155
|
-
}
|
|
3156
|
-
/**
|
|
3157
|
-
* Map from indices to A1 notation.
|
|
3158
|
-
*/
|
|
3159
|
-
mapFormulaIndicesToRefs(formula) {
|
|
3160
|
-
(0, import_invariant.invariant)(formula.charAt(0) === "=", void 0, {
|
|
3161
|
-
F: __dxlog_file4,
|
|
3162
|
-
L: 485,
|
|
3163
|
-
S: this,
|
|
3164
|
-
A: [
|
|
3165
|
-
"formula.charAt(0) === '='",
|
|
3166
|
-
""
|
|
3167
|
-
]
|
|
3168
|
-
});
|
|
3169
|
-
return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
|
|
3170
|
-
return addressToA1Notation(addressFromIndex(this._sheet, idx));
|
|
3171
2910
|
});
|
|
3172
2911
|
}
|
|
3173
|
-
//
|
|
3174
|
-
// Values
|
|
3175
|
-
//
|
|
3176
2912
|
/**
|
|
3177
|
-
*
|
|
3178
|
-
*
|
|
3179
|
-
* NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
|
|
2913
|
+
* Map from fully qualified ECHO ID to binding (from store).
|
|
2914
|
+
* E.g., spaceId:objectId() => HELLO()
|
|
3180
2915
|
*/
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
return this._graph.hf.numberToDateTime(num);
|
|
3187
|
-
}
|
|
3188
|
-
toDate(num) {
|
|
3189
|
-
return this._graph.hf.numberToDate(num);
|
|
3190
|
-
}
|
|
3191
|
-
toTime(num) {
|
|
3192
|
-
return this._graph.hf.numberToTime(num);
|
|
3193
|
-
}
|
|
3194
|
-
};
|
|
3195
|
-
var parseNumberString = (str) => {
|
|
3196
|
-
return parseFloat(str.replace(/[^\d.]/g, ""));
|
|
3197
|
-
};
|
|
3198
|
-
var CustomPlugin = class extends FunctionPluginAsync {
|
|
3199
|
-
test(ast, state) {
|
|
3200
|
-
const handler = async () => {
|
|
3201
|
-
return Math.random();
|
|
3202
|
-
};
|
|
3203
|
-
return this.runAsyncFunction(ast, state, handler);
|
|
3204
|
-
}
|
|
3205
|
-
crypto(ast, state) {
|
|
3206
|
-
const handler = async (_currency) => {
|
|
3207
|
-
const currency = (_currency || "USD").toUpperCase();
|
|
3208
|
-
const result = await fetch(`https://api.coindesk.com/v1/bpi/currentprice/${currency}.json`);
|
|
3209
|
-
const data = await result.json();
|
|
3210
|
-
const rate = (0, import_util.getDeep)(data, [
|
|
3211
|
-
"bpi",
|
|
3212
|
-
currency,
|
|
3213
|
-
"rate"
|
|
3214
|
-
]);
|
|
3215
|
-
if (!rate) {
|
|
3216
|
-
return NaN;
|
|
2916
|
+
mapFunctionBindingFromId(formula) {
|
|
2917
|
+
return formula.replace(/(\w+):([a-zA-Z0-9]+)\((.*)\)/g, (match, spaceId, objectId, args) => {
|
|
2918
|
+
const id = `${spaceId}:${objectId}`;
|
|
2919
|
+
if (id.length !== OBJECT_ID_LENGTH) {
|
|
2920
|
+
return match;
|
|
3217
2921
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
}
|
|
3224
|
-
};
|
|
3225
|
-
CustomPlugin.implementedFunctions = {
|
|
3226
|
-
TEST: {
|
|
3227
|
-
method: "test",
|
|
3228
|
-
parameters: [],
|
|
3229
|
-
isVolatile: true
|
|
3230
|
-
},
|
|
3231
|
-
CRYPTO: {
|
|
3232
|
-
method: "crypto",
|
|
3233
|
-
parameters: [
|
|
3234
|
-
{
|
|
3235
|
-
argumentType: import_hyperformula4.FunctionArgumentType.STRING,
|
|
3236
|
-
optionalArg: true
|
|
2922
|
+
const fn = this._functions.find((fn2) => (0, import_echo.fullyQualifiedId)(fn2) === id);
|
|
2923
|
+
if (fn?.binding) {
|
|
2924
|
+
return `${fn.binding}(${args})`;
|
|
2925
|
+
} else {
|
|
2926
|
+
return match;
|
|
3237
2927
|
}
|
|
3238
|
-
|
|
3239
|
-
isVolatile: true
|
|
2928
|
+
});
|
|
3240
2929
|
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
2930
|
+
async _open() {
|
|
2931
|
+
if (this._space) {
|
|
2932
|
+
const query = this._space.db.query(import_echo.Filter.schema(import_types.FunctionType));
|
|
2933
|
+
const unsubscribe = query.subscribe(({ objects }) => {
|
|
2934
|
+
this._functions = objects.filter(({ binding }) => binding);
|
|
2935
|
+
this.update.emit();
|
|
2936
|
+
});
|
|
2937
|
+
this._ctx.onDispose(unsubscribe);
|
|
2938
|
+
}
|
|
3250
2939
|
}
|
|
3251
2940
|
};
|
|
3252
2941
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3253
2942
|
0 && (module.exports = {
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
addressFromIndex,
|
|
3260
|
-
addressToA1Notation,
|
|
3261
|
-
addressToIndex,
|
|
3262
|
-
closest,
|
|
3263
|
-
columnLetter,
|
|
3264
|
-
compareIndexPositions,
|
|
3265
|
-
createComputeGraph,
|
|
2943
|
+
ComputeGraph,
|
|
2944
|
+
ComputeGraphRegistry,
|
|
2945
|
+
ComputeNode,
|
|
2946
|
+
createComputeGraphRegistry,
|
|
2947
|
+
createSheetName,
|
|
3266
2948
|
defaultFunctions,
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
rangeFromIndex,
|
|
3270
|
-
rangeToA1Notation
|
|
2949
|
+
defaultOptions,
|
|
2950
|
+
getSheetId
|
|
3271
2951
|
});
|
|
3272
|
-
//# sourceMappingURL=chunk-
|
|
2952
|
+
//# sourceMappingURL=chunk-DD6FIXWC.cjs.map
|