@dxos/plugin-sheet 0.6.14-main.7bd9c89 → 0.6.14-staging.9e90729
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-AKWROARP.mjs → SheetContainer-JBB7W52Y.mjs} +42 -52
- package/dist/lib/browser/SheetContainer-JBB7W52Y.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GSV5QNLD.mjs → chunk-2ZK3YMZG.mjs} +248 -33
- package/dist/lib/browser/{chunk-GSV5QNLD.mjs.map → chunk-2ZK3YMZG.mjs.map} +4 -4
- package/dist/lib/browser/{chunk-BWN5DZWZ.mjs → chunk-3QWIMZZJ.mjs} +2 -11
- package/dist/lib/browser/chunk-3QWIMZZJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FGMFOW6U.mjs → chunk-XXDHBYZQ.mjs} +553 -668
- package/dist/lib/browser/chunk-XXDHBYZQ.mjs.map +7 -0
- package/dist/lib/browser/{graph-M4IQ76QX.mjs → compute-graph-ZQKB6QVP.mjs} +4 -2
- package/dist/lib/browser/index.mjs +57 -14
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-N5IQGEFL.cjs → SheetContainer-L37HUFCF.cjs} +44 -58
- package/dist/lib/node/SheetContainer-L37HUFCF.cjs.map +7 -0
- package/dist/lib/node/{chunk-53BMSUIK.cjs → chunk-7AWAC3R3.cjs} +517 -645
- package/dist/lib/node/chunk-7AWAC3R3.cjs.map +7 -0
- package/dist/lib/node/{chunk-5XPK2V4A.cjs → chunk-QNFMTK3X.cjs} +252 -28
- package/dist/lib/node/{chunk-5XPK2V4A.cjs.map → chunk-QNFMTK3X.cjs.map} +4 -4
- package/dist/lib/node/{chunk-NZARD7UP.cjs → chunk-V7E5JZBD.cjs} +5 -14
- package/dist/lib/node/chunk-V7E5JZBD.cjs.map +7 -0
- package/dist/lib/node/{graph-Q3N2X26H.cjs → compute-graph-RJB6OVW6.cjs} +21 -19
- package/dist/lib/node/compute-graph-RJB6OVW6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +66 -27
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +6 -6
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{SheetContainer-46PBMF2E.mjs → SheetContainer-CLKFEM35.mjs} +42 -52
- package/dist/lib/node-esm/SheetContainer-CLKFEM35.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-T3PRH7QS.mjs → chunk-3JYJEOCF.mjs} +553 -668
- package/dist/lib/node-esm/chunk-3JYJEOCF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5WPZCXNS.mjs → chunk-JBTORSST.mjs} +247 -33
- package/dist/lib/node-esm/{chunk-5WPZCXNS.mjs.map → chunk-JBTORSST.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-WFDTY3IC.mjs → chunk-SPQFLYC2.mjs} +2 -11
- package/dist/lib/node-esm/chunk-SPQFLYC2.mjs.map +7 -0
- package/dist/lib/node-esm/{graph-SMPUMOV2.mjs → compute-graph-VKRG526N.mjs} +4 -2
- package/dist/lib/node-esm/index.mjs +57 -14
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +3 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts +9 -0
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/components/RangeList/index.d.ts +2 -0
- package/dist/types/src/components/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +7 -5
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/{graph → compute-graph}/compute-graph.d.ts +1 -1
- package/dist/types/src/compute-graph/compute-graph.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-node.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/async-function.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +1 -0
- package/dist/types/src/compute-graph/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +1 -0
- package/dist/types/src/compute-graph/util.d.ts.map +1 -0
- package/dist/types/src/defs/index.d.ts +1 -1
- package/dist/types/src/defs/index.d.ts.map +1 -1
- package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/defs/types.d.ts +6 -0
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +2 -6
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts +23 -3
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/index.d.ts +2 -0
- package/dist/types/src/integrations/index.d.ts.map +1 -0
- package/dist/types/src/integrations/thread-ranges.d.ts +8 -0
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -0
- package/dist/types/src/model/index.d.ts +1 -1
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +1 -1
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/{hooks → model}/useSheetModel.d.ts +1 -1
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -0
- package/dist/types/src/serializer.d.ts +4 -0
- package/dist/types/src/serializer.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -30
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +43 -50
- package/src/SheetPlugin.tsx +23 -10
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +19 -2
- package/src/components/FunctionEditor/FunctionEditor.tsx +5 -5
- package/src/components/GridSheet/GridSheet.stories.tsx +3 -1
- package/src/components/GridSheet/GridSheet.tsx +114 -19
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +1 -1
- package/src/components/GridSheet/util.ts +17 -7
- package/src/components/RangeList/RangeList.tsx +38 -0
- package/src/components/RangeList/index.ts +5 -0
- package/src/components/SheetContainer/SheetContainer.stories.tsx +1 -1
- package/src/components/SheetContext/SheetContext.tsx +43 -20
- package/src/components/Toolbar/Toolbar.tsx +34 -35
- package/src/components/index.ts +1 -0
- package/src/{graph → compute-graph}/compute-graph.stories.tsx +2 -1
- package/src/{graph → compute-graph}/compute-graph.ts +5 -2
- package/src/{graph → compute-graph}/compute-node.ts +2 -3
- package/src/defs/index.ts +1 -1
- package/src/defs/sheet-range-types.ts +1 -0
- package/src/defs/types.ts +6 -1
- package/src/defs/util.ts +3 -19
- package/src/extensions/compute.stories.tsx +2 -2
- package/src/extensions/compute.ts +2 -2
- package/src/extensions/editor/extension.test.ts +1 -1
- package/src/extensions/editor/extension.ts +48 -23
- package/src/index.ts +2 -2
- package/src/integrations/index.ts +5 -0
- package/src/integrations/thread-ranges.ts +101 -0
- package/src/model/index.ts +1 -1
- package/src/model/sheet-model.test.ts +1 -1
- package/src/model/sheet-model.ts +13 -8
- package/src/{hooks → model}/useSheetModel.ts +1 -1
- package/src/serializer.ts +27 -0
- package/src/testing/testing.tsx +1 -1
- package/src/translations.ts +6 -0
- package/src/types.ts +3 -1
- package/dist/lib/browser/SheetContainer-AKWROARP.mjs.map +0 -7
- package/dist/lib/browser/chunk-BWN5DZWZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FGMFOW6U.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-N5IQGEFL.cjs.map +0 -7
- package/dist/lib/node/chunk-53BMSUIK.cjs.map +0 -7
- package/dist/lib/node/chunk-NZARD7UP.cjs.map +0 -7
- package/dist/lib/node/graph-Q3N2X26H.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-46PBMF2E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T3PRH7QS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WFDTY3IC.mjs.map +0 -7
- package/dist/types/src/graph/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/graph/compute-graph.d.ts.map +0 -1
- package/dist/types/src/graph/compute-graph.stories.d.ts.map +0 -1
- package/dist/types/src/graph/compute-graph.test.d.ts.map +0 -1
- package/dist/types/src/graph/compute-node.d.ts.map +0 -1
- package/dist/types/src/graph/functions/async-function.d.ts.map +0 -1
- package/dist/types/src/graph/functions/edge-function.d.ts.map +0 -1
- package/dist/types/src/graph/functions/function-defs.d.ts.map +0 -1
- package/dist/types/src/graph/functions/index.d.ts.map +0 -1
- package/dist/types/src/graph/hyperformula.test.d.ts.map +0 -1
- package/dist/types/src/graph/index.d.ts.map +0 -1
- package/dist/types/src/graph/testing/index.d.ts.map +0 -1
- package/dist/types/src/graph/testing/test-builder.d.ts.map +0 -1
- package/dist/types/src/graph/testing/test-plugin.d.ts.map +0 -1
- package/dist/types/src/graph/util.d.ts.map +0 -1
- package/dist/types/src/hooks/hooks.stories.d.ts +0 -6
- package/dist/types/src/hooks/hooks.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -4
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/threads.d.ts +0 -8
- package/dist/types/src/hooks/threads.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeGraph.d.ts +0 -7
- package/dist/types/src/hooks/useComputeGraph.d.ts.map +0 -1
- package/dist/types/src/hooks/useSheetModel.d.ts.map +0 -1
- package/dist/types/src/model/decorations.d.ts +0 -26
- package/dist/types/src/model/decorations.d.ts.map +0 -1
- package/src/hooks/hooks.stories.tsx +0 -53
- package/src/hooks/index.ts +0 -7
- package/src/hooks/threads.ts +0 -147
- package/src/hooks/useComputeGraph.ts +0 -28
- package/src/model/decorations.ts +0 -66
- /package/dist/lib/browser/{graph-M4IQ76QX.mjs.map → compute-graph-ZQKB6QVP.mjs.map} +0 -0
- /package/dist/lib/node-esm/{graph-SMPUMOV2.mjs.map → compute-graph-VKRG526N.mjs.map} +0 -0
- /package/dist/types/src/{graph → compute-graph}/compute-graph-registry.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/compute-graph.stories.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/compute-graph.test.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/compute-node.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/functions/async-function.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/functions/edge-function.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/functions/function-defs.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/functions/index.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/hyperformula.test.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/index.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/testing/index.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/testing/test-builder.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/testing/test-plugin.d.ts +0 -0
- /package/dist/types/src/{graph → compute-graph}/util.d.ts +0 -0
- /package/src/{graph → compute-graph}/compute-graph-registry.ts +0 -0
- /package/src/{graph → compute-graph}/compute-graph.test.ts +0 -0
- /package/src/{graph → compute-graph}/functions/async-function.ts +0 -0
- /package/src/{graph → compute-graph}/functions/edge-function.ts +0 -0
- /package/src/{graph → compute-graph}/functions/function-defs.ts +0 -0
- /package/src/{graph → compute-graph}/functions/index.ts +0 -0
- /package/src/{graph → compute-graph}/hyperformula.test.ts +0 -0
- /package/src/{graph → compute-graph}/index.ts +0 -0
- /package/src/{graph → compute-graph}/testing/index.ts +0 -0
- /package/src/{graph → compute-graph}/testing/test-builder.ts +0 -0
- /package/src/{graph → compute-graph}/testing/test-plugin.ts +0 -0
- /package/src/{graph → compute-graph}/util.ts +0 -0
|
@@ -26,24 +26,45 @@ 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(
|
|
29
|
+
var chunk_QNFMTK3X_exports = {};
|
|
30
|
+
__export(chunk_QNFMTK3X_exports, {
|
|
31
31
|
AsyncFunctionPlugin: () => AsyncFunctionPlugin,
|
|
32
32
|
ComputeGraph: () => ComputeGraph,
|
|
33
33
|
ComputeGraphRegistry: () => ComputeGraphRegistry,
|
|
34
34
|
ComputeNode: () => ComputeNode,
|
|
35
|
+
DEFAULT_COLUMNS: () => DEFAULT_COLUMNS,
|
|
36
|
+
DEFAULT_ROWS: () => DEFAULT_ROWS,
|
|
35
37
|
EDGE_FUNCTION_NAME: () => EDGE_FUNCTION_NAME,
|
|
36
38
|
EdgeFunctionPlugin: () => EdgeFunctionPlugin,
|
|
37
39
|
EdgeFunctionPluginTranslations: () => EdgeFunctionPluginTranslations,
|
|
38
40
|
FunctionContext: () => FunctionContext,
|
|
41
|
+
MAX_COLUMNS: () => MAX_COLUMNS,
|
|
42
|
+
MAX_ROWS: () => MAX_ROWS,
|
|
43
|
+
RANGE_NOTATION: () => RANGE_NOTATION,
|
|
44
|
+
ReadonlyException: () => ReadonlyException,
|
|
45
|
+
addressFromA1Notation: () => addressFromA1Notation,
|
|
46
|
+
addressFromIndex: () => addressFromIndex,
|
|
47
|
+
addressToA1Notation: () => addressToA1Notation,
|
|
48
|
+
addressToIndex: () => addressToIndex,
|
|
49
|
+
cellClassNameForRange: () => cellClassNameForRange,
|
|
50
|
+
compareIndexPositions: () => compareIndexPositions,
|
|
51
|
+
createSheet: () => createSheet,
|
|
39
52
|
createSheetName: () => createSheetName,
|
|
40
53
|
defaultFunctionContextOptions: () => defaultFunctionContextOptions,
|
|
41
54
|
defaultFunctions: () => defaultFunctions,
|
|
42
55
|
defaultOptions: () => defaultOptions,
|
|
43
56
|
defaultPlugins: () => defaultPlugins,
|
|
44
|
-
|
|
57
|
+
inRange: () => inRange,
|
|
58
|
+
initialize: () => initialize,
|
|
59
|
+
insertIndices: () => insertIndices,
|
|
60
|
+
isFormula: () => isFormula,
|
|
61
|
+
parseSheetName: () => parseSheetName,
|
|
62
|
+
rangeFromIndex: () => rangeFromIndex,
|
|
63
|
+
rangeToA1Notation: () => rangeToA1Notation,
|
|
64
|
+
rangeToIndex: () => rangeToIndex
|
|
45
65
|
});
|
|
46
|
-
module.exports = __toCommonJS(
|
|
66
|
+
module.exports = __toCommonJS(chunk_QNFMTK3X_exports);
|
|
67
|
+
var import_chunk_V7E5JZBD = require("./chunk-V7E5JZBD.cjs");
|
|
47
68
|
var import_async = require("@dxos/async");
|
|
48
69
|
var import_echo = require("@dxos/client/echo");
|
|
49
70
|
var import_context = require("@dxos/context");
|
|
@@ -57,6 +78,9 @@ var import_hyperformula = require("#hyperformula");
|
|
|
57
78
|
var import_async2 = require("@dxos/async");
|
|
58
79
|
var import_context2 = require("@dxos/context");
|
|
59
80
|
var import_hyperformula2 = require("#hyperformula");
|
|
81
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
82
|
+
var import_crypto = require("@dxos/crypto");
|
|
83
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
60
84
|
var import_lodash = __toESM(require("lodash.defaultsdeep"));
|
|
61
85
|
var import_async3 = require("@dxos/async");
|
|
62
86
|
var import_log2 = require("@dxos/log");
|
|
@@ -70,9 +94,189 @@ var import_util2 = require("@dxos/util");
|
|
|
70
94
|
var import_hyperformula4 = require("#hyperformula");
|
|
71
95
|
var import_lodash2 = __toESM(require("lodash.defaultsdeep"));
|
|
72
96
|
var import_context3 = require("@dxos/context");
|
|
73
|
-
var
|
|
97
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
74
98
|
var import_log4 = require("@dxos/log");
|
|
75
99
|
var import_hyperformula5 = require("#hyperformula");
|
|
100
|
+
var cellClassNameForRange = ({ key, value }) => {
|
|
101
|
+
switch (key) {
|
|
102
|
+
case "align":
|
|
103
|
+
switch (value) {
|
|
104
|
+
case "start":
|
|
105
|
+
return "text-start";
|
|
106
|
+
case "center":
|
|
107
|
+
return "text-center";
|
|
108
|
+
case "end":
|
|
109
|
+
return "text-end";
|
|
110
|
+
default:
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
case "comment":
|
|
114
|
+
return "bg-gridComment";
|
|
115
|
+
case "style":
|
|
116
|
+
switch (value) {
|
|
117
|
+
case "highlight":
|
|
118
|
+
return "bg-gridHighlight";
|
|
119
|
+
default:
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/defs/types.ts";
|
|
127
|
+
var DEFAULT_ROWS = 50;
|
|
128
|
+
var DEFAULT_COLUMNS = 26;
|
|
129
|
+
var MAX_ROWS = 500;
|
|
130
|
+
var MAX_COLUMNS = 26 * 2;
|
|
131
|
+
var RANGE_NOTATION = /^[A-Z]+[0-9]+(:[A-Z]+[0-9]+)?$/;
|
|
132
|
+
var isFormula = (value) => typeof value === "string" && value.charAt(0) === "=";
|
|
133
|
+
var posEquals = (a, b) => {
|
|
134
|
+
return a?.col === b?.col && a?.row === b?.row;
|
|
135
|
+
};
|
|
136
|
+
var columnLetter = (col) => {
|
|
137
|
+
(0, import_invariant2.invariant)(col < MAX_COLUMNS, `Invalid column: ${col}`, {
|
|
138
|
+
F: __dxlog_file,
|
|
139
|
+
L: 31,
|
|
140
|
+
S: void 0,
|
|
141
|
+
A: [
|
|
142
|
+
"col < MAX_COLUMNS",
|
|
143
|
+
"`Invalid column: ${col}`"
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
|
|
147
|
+
};
|
|
148
|
+
var addressToA1Notation = ({ col, row }) => {
|
|
149
|
+
return `${columnLetter(col)}${row + 1}`;
|
|
150
|
+
};
|
|
151
|
+
var addressFromA1Notation = (ref) => {
|
|
152
|
+
const match = ref.match(/([A-Z]+)(\d+)/);
|
|
153
|
+
(0, import_invariant2.invariant)(match, `Invalid notation: ${ref}`, {
|
|
154
|
+
F: __dxlog_file,
|
|
155
|
+
L: 45,
|
|
156
|
+
S: void 0,
|
|
157
|
+
A: [
|
|
158
|
+
"match",
|
|
159
|
+
"`Invalid notation: ${ref}`"
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
row: parseInt(match[2], 10) - 1,
|
|
164
|
+
col: match[1].split("").reduce((acc, c) => acc * 26 + c.charCodeAt(0) - "A".charCodeAt(0) + 1, 0) - 1
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
var rangeToA1Notation = (range) => {
|
|
168
|
+
return [
|
|
169
|
+
range?.from && addressToA1Notation(range?.from),
|
|
170
|
+
range?.to && addressToA1Notation(range?.to)
|
|
171
|
+
].filter(Boolean).join(":");
|
|
172
|
+
};
|
|
173
|
+
var inRange = (range, cell) => {
|
|
174
|
+
if (!range) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const { from, to } = range;
|
|
178
|
+
if (from && posEquals(from, cell) || to && posEquals(to, cell)) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
if (!from || !to) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
const { col: c1, row: r1 } = from;
|
|
185
|
+
const { col: c2, row: r2 } = to;
|
|
186
|
+
const cMin = Math.min(c1, c2);
|
|
187
|
+
const cMax = Math.max(c1, c2);
|
|
188
|
+
const rMin = Math.min(r1, r2);
|
|
189
|
+
const rMax = Math.max(r1, r2);
|
|
190
|
+
const { col, row } = cell;
|
|
191
|
+
return col >= cMin && col <= cMax && row >= rMin && row <= rMax;
|
|
192
|
+
};
|
|
193
|
+
var ApiError = class extends Error {
|
|
194
|
+
};
|
|
195
|
+
var ReadonlyException = class extends ApiError {
|
|
196
|
+
};
|
|
197
|
+
var RangeException = class extends ApiError {
|
|
198
|
+
constructor(n) {
|
|
199
|
+
super();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
var createIndex = (length = 8) => {
|
|
203
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
204
|
+
const charactersLength = characters.length;
|
|
205
|
+
const randomBuffer = (0, import_crypto.randomBytes)(length);
|
|
206
|
+
return Array.from(randomBuffer, (byte) => characters[byte % charactersLength]).join("");
|
|
207
|
+
};
|
|
208
|
+
var createIndices = (length) => Array.from({
|
|
209
|
+
length
|
|
210
|
+
}).map(() => createIndex());
|
|
211
|
+
var insertIndices = (indices, i, n, max) => {
|
|
212
|
+
if (i + n > max) {
|
|
213
|
+
throw new RangeException(i + n);
|
|
214
|
+
}
|
|
215
|
+
const idx = createIndices(n);
|
|
216
|
+
indices.splice(i, 0, ...idx);
|
|
217
|
+
};
|
|
218
|
+
var initialize = (sheet, { rows = DEFAULT_ROWS, columns = DEFAULT_COLUMNS } = {}) => {
|
|
219
|
+
if (!sheet.rows.length) {
|
|
220
|
+
insertIndices(sheet.rows, 0, rows, MAX_ROWS);
|
|
221
|
+
}
|
|
222
|
+
if (!sheet.columns.length) {
|
|
223
|
+
insertIndices(sheet.columns, 0, columns, MAX_COLUMNS);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var createSheet = ({ name, cells, ...size } = {}) => {
|
|
227
|
+
const sheet = (0, import_echo_schema2.create)(import_chunk_V7E5JZBD.SheetType, {
|
|
228
|
+
name,
|
|
229
|
+
cells: {},
|
|
230
|
+
rows: [],
|
|
231
|
+
columns: [],
|
|
232
|
+
rowMeta: {},
|
|
233
|
+
columnMeta: {},
|
|
234
|
+
ranges: [],
|
|
235
|
+
threads: []
|
|
236
|
+
});
|
|
237
|
+
initialize(sheet, size);
|
|
238
|
+
if (cells) {
|
|
239
|
+
Object.entries(cells).forEach(([key, { value }]) => {
|
|
240
|
+
const idx = addressToIndex(sheet, addressFromA1Notation(key));
|
|
241
|
+
sheet.cells[idx] = {
|
|
242
|
+
value
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return sheet;
|
|
247
|
+
};
|
|
248
|
+
var addressToIndex = (sheet, cell) => {
|
|
249
|
+
return `${sheet.columns[cell.col]}@${sheet.rows[cell.row]}`;
|
|
250
|
+
};
|
|
251
|
+
var addressFromIndex = (sheet, idx) => {
|
|
252
|
+
const [column, row] = idx.split("@");
|
|
253
|
+
return {
|
|
254
|
+
col: sheet.columns.indexOf(column),
|
|
255
|
+
row: sheet.rows.indexOf(row)
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
var rangeToIndex = (sheet, range) => {
|
|
259
|
+
return [
|
|
260
|
+
range.from,
|
|
261
|
+
range.to ?? range.from
|
|
262
|
+
].map((cell) => addressToIndex(sheet, cell)).join(":");
|
|
263
|
+
};
|
|
264
|
+
var rangeFromIndex = (sheet, idx) => {
|
|
265
|
+
const [from, to] = idx.split(":").map((index) => addressFromIndex(sheet, index));
|
|
266
|
+
return {
|
|
267
|
+
from,
|
|
268
|
+
to
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
var compareIndexPositions = (sheet, indexA, indexB) => {
|
|
272
|
+
const { row: rowA, col: columnA } = addressFromIndex(sheet, indexA);
|
|
273
|
+
const { row: rowB, col: columnB } = addressFromIndex(sheet, indexB);
|
|
274
|
+
if (rowA !== rowB) {
|
|
275
|
+
return rowA - rowB;
|
|
276
|
+
} else {
|
|
277
|
+
return columnA - columnB;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
76
280
|
var ComputeNode = class extends import_context2.Resource {
|
|
77
281
|
constructor(_graph, sheetId) {
|
|
78
282
|
super();
|
|
@@ -98,7 +302,7 @@ var ComputeNode = class extends import_context2.Resource {
|
|
|
98
302
|
return value;
|
|
99
303
|
}
|
|
100
304
|
setValue(cell, value) {
|
|
101
|
-
const mappedValue =
|
|
305
|
+
const mappedValue = isFormula(value) ? this._graph.mapFormulaToNative(value) : value;
|
|
102
306
|
this._graph.hf.setCellContents({
|
|
103
307
|
sheet: this.sheetId,
|
|
104
308
|
row: cell.row,
|
|
@@ -113,7 +317,7 @@ var ComputeNode = class extends import_context2.Resource {
|
|
|
113
317
|
async _open() {
|
|
114
318
|
}
|
|
115
319
|
};
|
|
116
|
-
var
|
|
320
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/compute-graph/functions/async-function.ts";
|
|
117
321
|
var defaultFunctionContextOptions = {
|
|
118
322
|
defaultTtl: 5e3,
|
|
119
323
|
debounceDelay: 200,
|
|
@@ -187,7 +391,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
187
391
|
cell,
|
|
188
392
|
value: value2
|
|
189
393
|
}, {
|
|
190
|
-
F:
|
|
394
|
+
F: __dxlog_file2,
|
|
191
395
|
L: 143,
|
|
192
396
|
S: this,
|
|
193
397
|
C: (f, a) => f(...a)
|
|
@@ -201,7 +405,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
201
405
|
cell,
|
|
202
406
|
err
|
|
203
407
|
}, {
|
|
204
|
-
F:
|
|
408
|
+
F: __dxlog_file2,
|
|
205
409
|
L: 147,
|
|
206
410
|
S: this,
|
|
207
411
|
C: (f, a) => f(...a)
|
|
@@ -221,7 +425,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
221
425
|
args,
|
|
222
426
|
cache: value
|
|
223
427
|
}, {
|
|
224
|
-
F:
|
|
428
|
+
F: __dxlog_file2,
|
|
225
429
|
L: 155,
|
|
226
430
|
S: this,
|
|
227
431
|
C: (f, a) => f(...a)
|
|
@@ -244,7 +448,7 @@ var AsyncFunctionPlugin = class extends import_hyperformula3.FunctionPlugin {
|
|
|
244
448
|
});
|
|
245
449
|
}
|
|
246
450
|
};
|
|
247
|
-
var
|
|
451
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/compute-graph/functions/edge-function.ts";
|
|
248
452
|
var EDGE_FUNCTION_NAME = "DX";
|
|
249
453
|
var FUNCTION_TTL = 1e4;
|
|
250
454
|
var EdgeFunctionPlugin = class extends AsyncFunctionPlugin {
|
|
@@ -261,7 +465,7 @@ var EdgeFunctionPlugin = class extends AsyncFunctionPlugin {
|
|
|
261
465
|
import_log3.log.info("Function not found", {
|
|
262
466
|
binding
|
|
263
467
|
}, {
|
|
264
|
-
F:
|
|
468
|
+
F: __dxlog_file3,
|
|
265
469
|
L: 41,
|
|
266
470
|
S: this,
|
|
267
471
|
C: (f, a) => f(...a)
|
|
@@ -273,7 +477,7 @@ var EdgeFunctionPlugin = class extends AsyncFunctionPlugin {
|
|
|
273
477
|
import_log3.log.info("function changed", {
|
|
274
478
|
fn
|
|
275
479
|
}, {
|
|
276
|
-
F:
|
|
480
|
+
F: __dxlog_file3,
|
|
277
481
|
L: 47,
|
|
278
482
|
S: this,
|
|
279
483
|
C: (f, a) => f(...a)
|
|
@@ -2727,7 +2931,7 @@ var defaultFunctions = [
|
|
|
2727
2931
|
section: "Text"
|
|
2728
2932
|
}
|
|
2729
2933
|
];
|
|
2730
|
-
var
|
|
2934
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/compute-graph/compute-graph.ts";
|
|
2731
2935
|
var OBJECT_ID_LENGTH = 60;
|
|
2732
2936
|
var createSheetName = ({ type, id }) => `${type}@${id}`;
|
|
2733
2937
|
var parseSheetName = (name) => {
|
|
@@ -2796,8 +3000,8 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2796
3000
|
// The graph would then load the object and create a ComputeNode (model) of the appropriate type.
|
|
2797
3001
|
getOrCreateNode(name) {
|
|
2798
3002
|
(0, import_invariant.invariant)(name.length, void 0, {
|
|
2799
|
-
F:
|
|
2800
|
-
L:
|
|
3003
|
+
F: __dxlog_file4,
|
|
3004
|
+
L: 120,
|
|
2801
3005
|
S: this,
|
|
2802
3006
|
A: [
|
|
2803
3007
|
"name.length",
|
|
@@ -2805,12 +3009,12 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2805
3009
|
]
|
|
2806
3010
|
});
|
|
2807
3011
|
if (!this._hf.doesSheetExist(name)) {
|
|
2808
|
-
import_log.log
|
|
3012
|
+
(0, import_log.log)("created node", {
|
|
2809
3013
|
space: this._space?.id,
|
|
2810
3014
|
sheet: name
|
|
2811
3015
|
}, {
|
|
2812
|
-
F:
|
|
2813
|
-
L:
|
|
3016
|
+
F: __dxlog_file4,
|
|
3017
|
+
L: 122,
|
|
2814
3018
|
S: this,
|
|
2815
3019
|
C: (f, a) => f(...a)
|
|
2816
3020
|
});
|
|
@@ -2818,8 +3022,8 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2818
3022
|
}
|
|
2819
3023
|
const sheetId = this._hf.getSheetId(name);
|
|
2820
3024
|
(0, import_invariant.invariant)(sheetId !== void 0, void 0, {
|
|
2821
|
-
F:
|
|
2822
|
-
L:
|
|
3025
|
+
F: __dxlog_file4,
|
|
3026
|
+
L: 127,
|
|
2823
3027
|
S: this,
|
|
2824
3028
|
A: [
|
|
2825
3029
|
"sheetId !== undefined",
|
|
@@ -2832,7 +3036,7 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2832
3036
|
}
|
|
2833
3037
|
/**
|
|
2834
3038
|
* Map bound value to custom function invocation.
|
|
2835
|
-
* E.g., "HELLO(...args)" => "
|
|
3039
|
+
* E.g., "HELLO(...args)" => "DX("HELLO", ...args)".
|
|
2836
3040
|
*/
|
|
2837
3041
|
mapFormulaToNative(formula) {
|
|
2838
3042
|
return formula.replace(/['"]?([ \w]+)['"]?!/, (_match, name) => {
|
|
@@ -2918,7 +3122,7 @@ var ComputeGraph = class extends import_context.Resource {
|
|
|
2918
3122
|
}
|
|
2919
3123
|
}
|
|
2920
3124
|
};
|
|
2921
|
-
var
|
|
3125
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/compute-graph/compute-graph-registry.ts";
|
|
2922
3126
|
var defaultOptions = {
|
|
2923
3127
|
licenseKey: "gpl-v3"
|
|
2924
3128
|
};
|
|
@@ -2948,7 +3152,7 @@ var ComputeGraphRegistry = class extends import_context3.Resource {
|
|
|
2948
3152
|
(0, import_log4.log)("create graph", {
|
|
2949
3153
|
space: space.id
|
|
2950
3154
|
}, {
|
|
2951
|
-
F:
|
|
3155
|
+
F: __dxlog_file5,
|
|
2952
3156
|
L: 69,
|
|
2953
3157
|
S: this,
|
|
2954
3158
|
C: (f, a) => f(...a)
|
|
@@ -2958,8 +3162,8 @@ var ComputeGraphRegistry = class extends import_context3.Resource {
|
|
|
2958
3162
|
return graph;
|
|
2959
3163
|
}
|
|
2960
3164
|
createGraph(space) {
|
|
2961
|
-
(0,
|
|
2962
|
-
F:
|
|
3165
|
+
(0, import_invariant3.invariant)(!this._graphs.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
|
|
3166
|
+
F: __dxlog_file5,
|
|
2963
3167
|
L: 77,
|
|
2964
3168
|
S: this,
|
|
2965
3169
|
A: [
|
|
@@ -2985,15 +3189,35 @@ var ComputeGraphRegistry = class extends import_context3.Resource {
|
|
|
2985
3189
|
ComputeGraph,
|
|
2986
3190
|
ComputeGraphRegistry,
|
|
2987
3191
|
ComputeNode,
|
|
3192
|
+
DEFAULT_COLUMNS,
|
|
3193
|
+
DEFAULT_ROWS,
|
|
2988
3194
|
EDGE_FUNCTION_NAME,
|
|
2989
3195
|
EdgeFunctionPlugin,
|
|
2990
3196
|
EdgeFunctionPluginTranslations,
|
|
2991
3197
|
FunctionContext,
|
|
3198
|
+
MAX_COLUMNS,
|
|
3199
|
+
MAX_ROWS,
|
|
3200
|
+
RANGE_NOTATION,
|
|
3201
|
+
ReadonlyException,
|
|
3202
|
+
addressFromA1Notation,
|
|
3203
|
+
addressFromIndex,
|
|
3204
|
+
addressToA1Notation,
|
|
3205
|
+
addressToIndex,
|
|
3206
|
+
cellClassNameForRange,
|
|
3207
|
+
compareIndexPositions,
|
|
3208
|
+
createSheet,
|
|
2992
3209
|
createSheetName,
|
|
2993
3210
|
defaultFunctionContextOptions,
|
|
2994
3211
|
defaultFunctions,
|
|
2995
3212
|
defaultOptions,
|
|
2996
3213
|
defaultPlugins,
|
|
2997
|
-
|
|
3214
|
+
inRange,
|
|
3215
|
+
initialize,
|
|
3216
|
+
insertIndices,
|
|
3217
|
+
isFormula,
|
|
3218
|
+
parseSheetName,
|
|
3219
|
+
rangeFromIndex,
|
|
3220
|
+
rangeToA1Notation,
|
|
3221
|
+
rangeToIndex
|
|
2998
3222
|
});
|
|
2999
|
-
//# sourceMappingURL=chunk-
|
|
3223
|
+
//# sourceMappingURL=chunk-QNFMTK3X.cjs.map
|