@dxos/plugin-sheet 0.7.2 → 0.7.3-staging.0905f03
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-YAMIOFC6.mjs → SheetContainer-KCLT6PEO.mjs} +8 -6
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QHQFM7LV.mjs → chunk-E5WQ7U7G.mjs} +77 -78
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VMSX6Z4X.mjs → chunk-F3HE6D3J.mjs} +76 -26
- package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BVUN7SHF.mjs → chunk-JXFPOYNA.mjs} +1 -1
- package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +7 -0
- package/dist/lib/browser/{compute-graph-GGWUX644.mjs → compute-graph-SNUS7HOH.mjs} +3 -3
- package/dist/lib/browser/index.mjs +84 -32
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-BSDHHYXE.cjs → SheetContainer-VVVRYTQG.cjs} +32 -31
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +7 -0
- package/dist/lib/node/{chunk-J5ZFWMOD.cjs → chunk-45YW2DX2.cjs} +96 -101
- package/dist/lib/node/chunk-45YW2DX2.cjs.map +7 -0
- package/dist/lib/node/{chunk-O7XR4R7Y.cjs → chunk-KSEEI5VC.cjs} +87 -27
- package/dist/lib/node/chunk-KSEEI5VC.cjs.map +7 -0
- package/dist/lib/node/{chunk-AWKOWDMI.cjs → chunk-OWH2EUHZ.cjs} +4 -4
- package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +7 -0
- package/dist/lib/node/{compute-graph-KGWA2QLE.cjs → compute-graph-WILPHO4A.cjs} +20 -20
- package/dist/lib/node/{compute-graph-KGWA2QLE.cjs.map → compute-graph-WILPHO4A.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +101 -47
- package/dist/lib/node/index.cjs.map +3 -3
- 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-T47T2NYJ.mjs → SheetContainer-LSBE6Q4X.mjs} +8 -6
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CR4K75EL.mjs → chunk-6JF2AHKO.mjs} +76 -26
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UIBWRHW7.mjs → chunk-BVS2IQRO.mjs} +1 -1
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6GSTEN7N.mjs → chunk-NYDNXI7L.mjs} +77 -78
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +7 -0
- package/dist/lib/node-esm/{compute-graph-2SCZT7N5.mjs → compute-graph-S6CVN7RS.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +84 -32
- package/dist/lib/node-esm/index.mjs.map +3 -3
- 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/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts +0 -2
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +2 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetObjectSettings.d.ts +7 -0
- package/dist/types/src/components/SheetObjectSettings.d.ts.map +1 -0
- 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/defs/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/defs/types.d.ts +2 -4
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +8 -0
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts +2 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +0 -4
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +6 -0
- package/dist/types/src/model/testing.d.ts.map +1 -0
- package/dist/types/src/testing/data.d.ts +3 -0
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/playwright/playwright.config.d.ts +3 -0
- package/dist/types/src/testing/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/testing/playwright/sheet-manager.d.ts +24 -0
- package/dist/types/src/testing/playwright/sheet-manager.d.ts.map +1 -0
- package/dist/types/src/testing/playwright/sheet.spec.d.ts +2 -0
- package/dist/types/src/testing/playwright/sheet.spec.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +1 -2
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +61 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +2 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +40 -37
- package/src/SheetPlugin.tsx +9 -21
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -2
- package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
- package/src/components/GridSheet/GridSheet.tsx +18 -8
- package/src/components/GridSheet/util.ts +1 -9
- package/src/components/SheetContainer/SheetContainer.stories.tsx +44 -2
- package/src/components/SheetObjectSettings.tsx +38 -0
- package/src/components/Toolbar/Toolbar.tsx +7 -1
- package/src/components/index.ts +1 -0
- package/src/compute-graph/compute-graph.stories.tsx +1 -1
- package/src/compute-graph/compute-graph.test.ts +1 -1
- package/src/defs/sheet-range-types.ts +3 -0
- package/src/defs/types.ts +3 -1
- package/src/defs/util.ts +32 -1
- package/src/extensions/editor/extension.ts +3 -3
- package/src/index.ts +3 -0
- package/src/integrations/thread-ranges.ts +2 -0
- package/src/model/sheet-model.test.ts +35 -1
- package/src/model/sheet-model.ts +5 -17
- package/src/model/testing.ts +35 -0
- package/src/sanity.test.ts +1 -1
- package/src/testing/data.ts +33 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/playwright/playwright.config.ts +18 -0
- package/src/testing/playwright/sheet-manager.ts +91 -0
- package/src/testing/playwright/sheet.spec.ts +78 -0
- package/src/testing/testing.tsx +1 -31
- package/src/translations.ts +4 -0
- package/src/types.ts +1 -3
- package/dist/lib/browser/SheetContainer-YAMIOFC6.mjs.map +0 -7
- package/dist/lib/browser/chunk-BVUN7SHF.mjs.map +0 -7
- package/dist/lib/browser/chunk-QHQFM7LV.mjs.map +0 -7
- package/dist/lib/browser/chunk-VMSX6Z4X.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-BSDHHYXE.cjs.map +0 -7
- package/dist/lib/node/chunk-AWKOWDMI.cjs.map +0 -7
- package/dist/lib/node/chunk-J5ZFWMOD.cjs.map +0 -7
- package/dist/lib/node/chunk-O7XR4R7Y.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-T47T2NYJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6GSTEN7N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CR4K75EL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UIBWRHW7.mjs.map +0 -7
- /package/dist/lib/browser/{compute-graph-GGWUX644.mjs.map → compute-graph-SNUS7HOH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compute-graph-2SCZT7N5.mjs.map → compute-graph-S6CVN7RS.mjs.map} +0 -0
|
@@ -26,21 +26,21 @@ 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_45YW2DX2_exports = {};
|
|
30
|
+
__export(chunk_45YW2DX2_exports, {
|
|
31
31
|
ComputeGraphContextProvider: () => ComputeGraphContextProvider,
|
|
32
32
|
GridSheet: () => GridSheet,
|
|
33
|
-
RangeList: () => RangeList,
|
|
34
33
|
SheetContainer: () => SheetContainer,
|
|
34
|
+
SheetObjectSettings: () => SheetObjectSettings,
|
|
35
35
|
SheetProvider: () => SheetProvider,
|
|
36
36
|
completeCellRangeToThreadCursor: () => completeCellRangeToThreadCursor,
|
|
37
37
|
computeGraphFacet: () => computeGraphFacet,
|
|
38
38
|
useComputeGraph: () => useComputeGraph,
|
|
39
39
|
useSheetContext: () => useSheetContext
|
|
40
40
|
});
|
|
41
|
-
module.exports = __toCommonJS(
|
|
42
|
-
var
|
|
43
|
-
var
|
|
41
|
+
module.exports = __toCommonJS(chunk_45YW2DX2_exports);
|
|
42
|
+
var import_chunk_KSEEI5VC = require("./chunk-KSEEI5VC.cjs");
|
|
43
|
+
var import_chunk_OWH2EUHZ = require("./chunk-OWH2EUHZ.cjs");
|
|
44
44
|
var import_chunk_2ZVZI2KJ = require("./chunk-2ZVZI2KJ.cjs");
|
|
45
45
|
var import_react = __toESM(require("react"));
|
|
46
46
|
var import_debug = require("@dxos/debug");
|
|
@@ -90,6 +90,9 @@ var import_echo_schema2 = require("@dxos/echo-schema");
|
|
|
90
90
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
91
91
|
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
92
92
|
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
93
|
+
var import_react9 = __toESM(require("react"));
|
|
94
|
+
var import_meta = require("@dxos/plugin-space/meta");
|
|
95
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
93
96
|
var ComputeGraphContext = /* @__PURE__ */ (0, import_react.createContext)(void 0);
|
|
94
97
|
var ComputeGraphContextProvider = ({ registry, children }) => {
|
|
95
98
|
return /* @__PURE__ */ import_react.default.createElement(ComputeGraphContext.Provider, {
|
|
@@ -145,7 +148,7 @@ var highlightStyles = import_language2.HighlightStyle.define([
|
|
|
145
148
|
}
|
|
146
149
|
]);
|
|
147
150
|
var languageFacet = (0, import_react_ui_editor2.singleValueFacet)();
|
|
148
|
-
var sheetExtension = ({ functions = [] }) => {
|
|
151
|
+
var sheetExtension = ({ debug, functions = [] }) => {
|
|
149
152
|
const { extension, language } = (0, import_codemirror_lang_spreadsheet.spreadsheet)({
|
|
150
153
|
idiom: "en-US",
|
|
151
154
|
decimalSeparator: "."
|
|
@@ -221,8 +224,7 @@ var sheetExtension = ({ functions = [] }) => {
|
|
|
221
224
|
aboveCursor: false,
|
|
222
225
|
defaultKeymap: true,
|
|
223
226
|
activateOnTyping: true,
|
|
224
|
-
|
|
225
|
-
closeOnBlur: false,
|
|
227
|
+
closeOnBlur: !debug,
|
|
226
228
|
icons: false,
|
|
227
229
|
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")
|
|
228
230
|
}),
|
|
@@ -293,7 +295,7 @@ var rangeExtension = ({ onInit, onStateChange }) => {
|
|
|
293
295
|
});
|
|
294
296
|
if (!activeRange && view2.state.doc.toString()[0] === "=") {
|
|
295
297
|
const str = view2.state.doc.sliceString(1);
|
|
296
|
-
if (
|
|
298
|
+
if (import_chunk_KSEEI5VC.RANGE_NOTATION.test(str)) {
|
|
297
299
|
activeRange = {
|
|
298
300
|
from: 1,
|
|
299
301
|
to: str.length + 1
|
|
@@ -394,17 +396,17 @@ var SheetModel = class extends import_context.Resource {
|
|
|
394
396
|
id: this.id
|
|
395
397
|
}, {
|
|
396
398
|
F: __dxlog_file,
|
|
397
|
-
L:
|
|
399
|
+
L: 115,
|
|
398
400
|
S: this,
|
|
399
401
|
C: (f, a) => f(...a)
|
|
400
402
|
});
|
|
401
|
-
(0,
|
|
403
|
+
(0, import_chunk_KSEEI5VC.initialize)(this._sheet);
|
|
402
404
|
this._graph.update.on((event) => {
|
|
403
405
|
if (event.type === "functionsUpdated") {
|
|
404
406
|
this.reset();
|
|
405
407
|
}
|
|
406
408
|
});
|
|
407
|
-
this._node = this._graph.getOrCreateNode((0,
|
|
409
|
+
this._node = this._graph.getOrCreateNode((0, import_chunk_KSEEI5VC.createSheetName)({
|
|
408
410
|
type: (0, import_echo_schema.getTypename)(this._sheet),
|
|
409
411
|
id: this._sheet.id
|
|
410
412
|
}));
|
|
@@ -421,7 +423,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
421
423
|
reset() {
|
|
422
424
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
423
425
|
F: __dxlog_file,
|
|
424
|
-
L:
|
|
426
|
+
L: 141,
|
|
425
427
|
S: this,
|
|
426
428
|
A: [
|
|
427
429
|
"this._node",
|
|
@@ -432,16 +434,16 @@ var SheetModel = class extends import_context.Resource {
|
|
|
432
434
|
Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
|
|
433
435
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
434
436
|
F: __dxlog_file,
|
|
435
|
-
L:
|
|
437
|
+
L: 144,
|
|
436
438
|
S: this,
|
|
437
439
|
A: [
|
|
438
440
|
"this._node",
|
|
439
441
|
""
|
|
440
442
|
]
|
|
441
443
|
});
|
|
442
|
-
const { col, row } = (0,
|
|
443
|
-
if ((0,
|
|
444
|
-
const binding = this._graph.mapFunctionBindingFromId(
|
|
444
|
+
const { col, row } = (0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, key);
|
|
445
|
+
if ((0, import_chunk_KSEEI5VC.isFormula)(value)) {
|
|
446
|
+
const binding = this._graph.mapFunctionBindingFromId((0, import_chunk_KSEEI5VC.mapFormulaIndicesToRefs)(this._sheet, value));
|
|
445
447
|
if (binding) {
|
|
446
448
|
value = this._graph.mapFormulaToNative(binding);
|
|
447
449
|
} else {
|
|
@@ -466,19 +468,19 @@ var SheetModel = class extends import_context.Resource {
|
|
|
466
468
|
this._node?.graph.hf.rebuildAndRecalculate();
|
|
467
469
|
}
|
|
468
470
|
insertRows(i, n = 1) {
|
|
469
|
-
const idx = (0,
|
|
471
|
+
const idx = (0, import_chunk_KSEEI5VC.insertIndices)(this._sheet.rows, i, n, import_chunk_KSEEI5VC.MAX_ROWS);
|
|
470
472
|
this.reset();
|
|
471
473
|
return idx;
|
|
472
474
|
}
|
|
473
475
|
insertColumns(i, n = 1) {
|
|
474
|
-
const idx = (0,
|
|
476
|
+
const idx = (0, import_chunk_KSEEI5VC.insertIndices)(this._sheet.columns, i, n, import_chunk_KSEEI5VC.MAX_COLUMNS);
|
|
475
477
|
this.reset();
|
|
476
478
|
return idx;
|
|
477
479
|
}
|
|
478
480
|
dropRow(rowIndex) {
|
|
479
481
|
const range = {
|
|
480
|
-
from: (0,
|
|
481
|
-
to: (0,
|
|
482
|
+
from: (0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
|
|
483
|
+
to: (0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`)
|
|
482
484
|
};
|
|
483
485
|
const values = this.getCellValues(range).flat();
|
|
484
486
|
const index = this._sheet.rows.indexOf(rowIndex);
|
|
@@ -496,8 +498,8 @@ var SheetModel = class extends import_context.Resource {
|
|
|
496
498
|
}
|
|
497
499
|
dropColumn(colIndex) {
|
|
498
500
|
const range = {
|
|
499
|
-
from: (0,
|
|
500
|
-
to: (0,
|
|
501
|
+
from: (0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
|
|
502
|
+
to: (0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
|
|
501
503
|
};
|
|
502
504
|
const values = this.getCellValues(range).flat();
|
|
503
505
|
const index = this._sheet.columns.indexOf(colIndex);
|
|
@@ -551,7 +553,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
551
553
|
clear(range) {
|
|
552
554
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
553
555
|
F: __dxlog_file,
|
|
554
|
-
L:
|
|
556
|
+
L: 247,
|
|
555
557
|
S: this,
|
|
556
558
|
A: [
|
|
557
559
|
"this._node",
|
|
@@ -562,14 +564,14 @@ var SheetModel = class extends import_context.Resource {
|
|
|
562
564
|
const values = this._iterRange(range, () => null);
|
|
563
565
|
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
564
566
|
this._iterRange(range, (cell) => {
|
|
565
|
-
const idx = (0,
|
|
567
|
+
const idx = (0, import_chunk_KSEEI5VC.addressToIndex)(this._sheet, cell);
|
|
566
568
|
delete this._sheet.cells[idx];
|
|
567
569
|
});
|
|
568
570
|
}
|
|
569
571
|
cut(range) {
|
|
570
572
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
571
573
|
F: __dxlog_file,
|
|
572
|
-
L:
|
|
574
|
+
L: 258,
|
|
573
575
|
S: this,
|
|
574
576
|
A: [
|
|
575
577
|
"this._node",
|
|
@@ -578,14 +580,14 @@ var SheetModel = class extends import_context.Resource {
|
|
|
578
580
|
});
|
|
579
581
|
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
580
582
|
this._iterRange(range, (cell) => {
|
|
581
|
-
const idx = (0,
|
|
583
|
+
const idx = (0, import_chunk_KSEEI5VC.addressToIndex)(this._sheet, cell);
|
|
582
584
|
delete this._sheet.cells[idx];
|
|
583
585
|
});
|
|
584
586
|
}
|
|
585
587
|
copy(range) {
|
|
586
588
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
587
589
|
F: __dxlog_file,
|
|
588
|
-
L:
|
|
590
|
+
L: 267,
|
|
589
591
|
S: this,
|
|
590
592
|
A: [
|
|
591
593
|
"this._node",
|
|
@@ -597,7 +599,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
597
599
|
paste(cell) {
|
|
598
600
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
599
601
|
F: __dxlog_file,
|
|
600
|
-
L:
|
|
602
|
+
L: 272,
|
|
601
603
|
S: this,
|
|
602
604
|
A: [
|
|
603
605
|
"this._node",
|
|
@@ -609,7 +611,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
609
611
|
for (const change of changes) {
|
|
610
612
|
if (change instanceof import_hyperformula.ExportedCellChange) {
|
|
611
613
|
const { address, newValue } = change;
|
|
612
|
-
const idx = (0,
|
|
614
|
+
const idx = (0, import_chunk_KSEEI5VC.addressToIndex)(this._sheet, {
|
|
613
615
|
row: address.row,
|
|
614
616
|
col: address.col
|
|
615
617
|
});
|
|
@@ -624,7 +626,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
624
626
|
undo() {
|
|
625
627
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
626
628
|
F: __dxlog_file,
|
|
627
|
-
L:
|
|
629
|
+
L: 287,
|
|
628
630
|
S: this,
|
|
629
631
|
A: [
|
|
630
632
|
"this._node",
|
|
@@ -638,7 +640,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
638
640
|
redo() {
|
|
639
641
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
640
642
|
F: __dxlog_file,
|
|
641
|
-
L:
|
|
643
|
+
L: 295,
|
|
642
644
|
S: this,
|
|
643
645
|
A: [
|
|
644
646
|
"this._node",
|
|
@@ -653,7 +655,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
653
655
|
* Get value from sheet.
|
|
654
656
|
*/
|
|
655
657
|
getCellValue(cell) {
|
|
656
|
-
const idx = (0,
|
|
658
|
+
const idx = (0, import_chunk_KSEEI5VC.addressToIndex)(this._sheet, cell);
|
|
657
659
|
return this._sheet.cells[idx]?.value ?? null;
|
|
658
660
|
}
|
|
659
661
|
/**
|
|
@@ -664,8 +666,8 @@ var SheetModel = class extends import_context.Resource {
|
|
|
664
666
|
if (value == null) {
|
|
665
667
|
return void 0;
|
|
666
668
|
}
|
|
667
|
-
if ((0,
|
|
668
|
-
return this._graph.mapFunctionBindingFromId(
|
|
669
|
+
if ((0, import_chunk_KSEEI5VC.isFormula)(value)) {
|
|
670
|
+
return this._graph.mapFunctionBindingFromId((0, import_chunk_KSEEI5VC.mapFormulaIndicesToRefs)(this._sheet, value));
|
|
669
671
|
} else {
|
|
670
672
|
return String(value);
|
|
671
673
|
}
|
|
@@ -682,7 +684,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
682
684
|
getValue(cell) {
|
|
683
685
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
684
686
|
F: __dxlog_file,
|
|
685
|
-
L:
|
|
687
|
+
L: 338,
|
|
686
688
|
S: this,
|
|
687
689
|
A: [
|
|
688
690
|
"this._node",
|
|
@@ -697,7 +699,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
697
699
|
error: value
|
|
698
700
|
}, {
|
|
699
701
|
F: __dxlog_file,
|
|
700
|
-
L:
|
|
702
|
+
L: 343,
|
|
701
703
|
S: this,
|
|
702
704
|
C: (f, a) => f(...a)
|
|
703
705
|
});
|
|
@@ -711,7 +713,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
711
713
|
getValueDescription(cell) {
|
|
712
714
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
713
715
|
F: __dxlog_file,
|
|
714
|
-
L:
|
|
716
|
+
L: 354,
|
|
715
717
|
S: this,
|
|
716
718
|
A: [
|
|
717
719
|
"this._node",
|
|
@@ -728,7 +730,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
728
730
|
setValue(cell, value) {
|
|
729
731
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
730
732
|
F: __dxlog_file,
|
|
731
|
-
L:
|
|
733
|
+
L: 364,
|
|
732
734
|
S: this,
|
|
733
735
|
A: [
|
|
734
736
|
"this._node",
|
|
@@ -736,15 +738,15 @@ var SheetModel = class extends import_context.Resource {
|
|
|
736
738
|
]
|
|
737
739
|
});
|
|
738
740
|
if (this._options.readonly) {
|
|
739
|
-
throw new
|
|
741
|
+
throw new import_chunk_KSEEI5VC.ReadonlyException();
|
|
740
742
|
}
|
|
741
743
|
let refresh = false;
|
|
742
744
|
if (cell.row >= this._sheet.rows.length) {
|
|
743
|
-
(0,
|
|
745
|
+
(0, import_chunk_KSEEI5VC.insertIndices)(this._sheet.rows, cell.row, 1, import_chunk_KSEEI5VC.MAX_ROWS);
|
|
744
746
|
refresh = true;
|
|
745
747
|
}
|
|
746
748
|
if (cell.col >= this._sheet.columns.length) {
|
|
747
|
-
(0,
|
|
749
|
+
(0, import_chunk_KSEEI5VC.insertIndices)(this._sheet.columns, cell.col, 1, import_chunk_KSEEI5VC.MAX_COLUMNS);
|
|
748
750
|
refresh = true;
|
|
749
751
|
}
|
|
750
752
|
if (refresh) {
|
|
@@ -756,15 +758,15 @@ var SheetModel = class extends import_context.Resource {
|
|
|
756
758
|
col: cell.col
|
|
757
759
|
}, [
|
|
758
760
|
[
|
|
759
|
-
(0,
|
|
761
|
+
(0, import_chunk_KSEEI5VC.isFormula)(value) ? this._graph.mapFormulaToNative(value) : value
|
|
760
762
|
]
|
|
761
763
|
]);
|
|
762
|
-
const idx = (0,
|
|
764
|
+
const idx = (0, import_chunk_KSEEI5VC.addressToIndex)(this._sheet, cell);
|
|
763
765
|
if (value === void 0 || value === null) {
|
|
764
766
|
delete this._sheet.cells[idx];
|
|
765
767
|
} else {
|
|
766
|
-
if ((0,
|
|
767
|
-
value = this._graph.mapFunctionBindingToId(
|
|
768
|
+
if ((0, import_chunk_KSEEI5VC.isFormula)(value)) {
|
|
769
|
+
value = this._graph.mapFunctionBindingToId((0, import_chunk_KSEEI5VC.mapFormulaRefsToIndices)(this._sheet, value));
|
|
768
770
|
}
|
|
769
771
|
this._sheet.cells[idx] = {
|
|
770
772
|
value
|
|
@@ -776,7 +778,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
776
778
|
*/
|
|
777
779
|
setValues(values) {
|
|
778
780
|
Object.entries(values).forEach(([key, { value }]) => {
|
|
779
|
-
this.setValue((0,
|
|
781
|
+
this.setValue((0, import_chunk_KSEEI5VC.addressFromA1Notation)(key), value);
|
|
780
782
|
});
|
|
781
783
|
}
|
|
782
784
|
/**
|
|
@@ -816,33 +818,13 @@ var SheetModel = class extends import_context.Resource {
|
|
|
816
818
|
_moveIndices(indices, i, j, n) {
|
|
817
819
|
throw new Error("Not implemented");
|
|
818
820
|
}
|
|
819
|
-
//
|
|
820
|
-
// Indices.
|
|
821
|
-
//
|
|
822
|
-
/**
|
|
823
|
-
* Map from A1 notation to indices.
|
|
824
|
-
*/
|
|
825
|
-
mapFormulaRefsToIndices(formula) {
|
|
826
|
-
(0, import_invariant3.invariant)((0, import_chunk_O7XR4R7Y.isFormula)(formula), void 0, {
|
|
827
|
-
F: __dxlog_file,
|
|
828
|
-
L: 451,
|
|
829
|
-
S: this,
|
|
830
|
-
A: [
|
|
831
|
-
"isFormula(formula)",
|
|
832
|
-
""
|
|
833
|
-
]
|
|
834
|
-
});
|
|
835
|
-
return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
|
|
836
|
-
return (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, (0, import_chunk_O7XR4R7Y.addressFromA1Notation)(match));
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
821
|
/**
|
|
840
822
|
* Map from indices to A1 notation.
|
|
841
823
|
*/
|
|
842
824
|
mapFormulaIndicesToRefs(formula) {
|
|
843
|
-
(0, import_invariant3.invariant)((0,
|
|
825
|
+
(0, import_invariant3.invariant)((0, import_chunk_KSEEI5VC.isFormula)(formula), void 0, {
|
|
844
826
|
F: __dxlog_file,
|
|
845
|
-
L:
|
|
827
|
+
L: 449,
|
|
846
828
|
S: this,
|
|
847
829
|
A: [
|
|
848
830
|
"isFormula(formula)",
|
|
@@ -850,7 +832,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
850
832
|
]
|
|
851
833
|
});
|
|
852
834
|
return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
|
|
853
|
-
return (0,
|
|
835
|
+
return (0, import_chunk_KSEEI5VC.addressToA1Notation)((0, import_chunk_KSEEI5VC.addressFromIndex)(this._sheet, idx));
|
|
854
836
|
});
|
|
855
837
|
}
|
|
856
838
|
//
|
|
@@ -868,7 +850,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
868
850
|
toDateTime(num) {
|
|
869
851
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
870
852
|
F: __dxlog_file,
|
|
871
|
-
L:
|
|
853
|
+
L: 470,
|
|
872
854
|
S: this,
|
|
873
855
|
A: [
|
|
874
856
|
"this._node",
|
|
@@ -880,7 +862,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
880
862
|
toDate(num) {
|
|
881
863
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
882
864
|
F: __dxlog_file,
|
|
883
|
-
L:
|
|
865
|
+
L: 475,
|
|
884
866
|
S: this,
|
|
885
867
|
A: [
|
|
886
868
|
"this._node",
|
|
@@ -892,7 +874,7 @@ var SheetModel = class extends import_context.Resource {
|
|
|
892
874
|
toTime(num) {
|
|
893
875
|
(0, import_invariant3.invariant)(this._node, void 0, {
|
|
894
876
|
F: __dxlog_file,
|
|
895
|
-
L:
|
|
877
|
+
L: 480,
|
|
896
878
|
S: this,
|
|
897
879
|
A: [
|
|
898
880
|
"this._node",
|
|
@@ -1011,7 +993,7 @@ var RangeList = ({ sheet }) => {
|
|
|
1011
993
|
className: "p-2 text-sm font-semibold"
|
|
1012
994
|
}, t("range list heading")), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.Root, {
|
|
1013
995
|
items: sheet.ranges,
|
|
1014
|
-
isItem: import_echo_schema2.S.is(
|
|
996
|
+
isItem: import_echo_schema2.S.is(import_chunk_OWH2EUHZ.Range)
|
|
1015
997
|
}, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.Item, {
|
|
1016
998
|
key: i,
|
|
1017
999
|
item: range,
|
|
@@ -1022,14 +1004,29 @@ var RangeList = ({ sheet }) => {
|
|
|
1022
1004
|
}, /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemDragHandle, null), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
1023
1005
|
onClick: () => handleSelectRange(range)
|
|
1024
1006
|
}, t("range title", {
|
|
1025
|
-
position: (0,
|
|
1007
|
+
position: (0, import_chunk_KSEEI5VC.rangeToA1Notation)((0, import_chunk_KSEEI5VC.rangeFromIndex)(sheet, range.range)),
|
|
1026
1008
|
key: t(`range key ${range.key} label`),
|
|
1027
1009
|
value: t(`range value ${range.value} label`)
|
|
1028
1010
|
})), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
1029
1011
|
onClick: () => handleDeleteRange(range)
|
|
1030
1012
|
})))));
|
|
1031
1013
|
};
|
|
1032
|
-
var
|
|
1014
|
+
var SheetObjectSettings = ({ sheet }) => {
|
|
1015
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_meta.SPACE_PLUGIN);
|
|
1016
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1017
|
+
role: "form",
|
|
1018
|
+
className: "flex flex-col w-full p-2 gap-1"
|
|
1019
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Input.Label, null, t("name label")), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Input.TextInput, {
|
|
1020
|
+
placeholder: t("name placeholder"),
|
|
1021
|
+
value: sheet.name ?? "",
|
|
1022
|
+
onChange: (event) => {
|
|
1023
|
+
sheet.name = event.target.value;
|
|
1024
|
+
}
|
|
1025
|
+
}))), /* @__PURE__ */ import_react9.default.createElement(RangeList, {
|
|
1026
|
+
sheet
|
|
1027
|
+
}));
|
|
1028
|
+
};
|
|
1029
|
+
var SheetContainer = (0, import_react7.lazy)(() => import("./SheetContainer-VVVRYTQG.cjs"));
|
|
1033
1030
|
var completeCellRangeToThreadCursor = (range) => {
|
|
1034
1031
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
1035
1032
|
};
|
|
@@ -1065,6 +1062,9 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
|
1065
1062
|
...range.to,
|
|
1066
1063
|
plane: "grid"
|
|
1067
1064
|
}, true);
|
|
1065
|
+
return {
|
|
1066
|
+
data: true
|
|
1067
|
+
};
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
}, [
|
|
@@ -1087,7 +1087,7 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
1087
1087
|
const closestThread = threads?.find(({ anchor }) => {
|
|
1088
1088
|
if (anchor) {
|
|
1089
1089
|
const range = parseThreadAnchorAsCellRange(anchor);
|
|
1090
|
-
return range ? (0,
|
|
1090
|
+
return range ? (0, import_chunk_KSEEI5VC.inRange)(range, cellAddress) : false;
|
|
1091
1091
|
} else {
|
|
1092
1092
|
return false;
|
|
1093
1093
|
}
|
|
@@ -1121,13 +1121,6 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
1121
1121
|
debounced
|
|
1122
1122
|
]);
|
|
1123
1123
|
};
|
|
1124
|
-
var dxGridCellIndexToSheetCellAddress = (index) => {
|
|
1125
|
-
const [colStr, rowStr] = index.split(",");
|
|
1126
|
-
return {
|
|
1127
|
-
col: parseInt(colStr),
|
|
1128
|
-
row: parseInt(rowStr)
|
|
1129
|
-
};
|
|
1130
|
-
};
|
|
1131
1124
|
var createDxGridColumns = (model) => {
|
|
1132
1125
|
return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
|
|
1133
1126
|
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
@@ -1160,15 +1153,15 @@ var projectCellProps = (model, col, row) => {
|
|
|
1160
1153
|
row
|
|
1161
1154
|
};
|
|
1162
1155
|
const rawValue = model.getValue(address);
|
|
1163
|
-
const ranges = model.sheet.ranges?.filter(({ range }) => (0,
|
|
1156
|
+
const ranges = model.sheet.ranges?.filter(({ range }) => (0, import_chunk_KSEEI5VC.inRange)((0, import_chunk_KSEEI5VC.rangeFromIndex)(model.sheet, range), address));
|
|
1164
1157
|
const threadRefs = model.sheet.threads?.filter((thread) => {
|
|
1165
1158
|
const range = thread?.anchor && parseThreadAnchorAsCellRange(thread.anchor);
|
|
1166
|
-
return thread && range ? (0,
|
|
1159
|
+
return thread && range ? (0, import_chunk_KSEEI5VC.inRange)(range, address) : false;
|
|
1167
1160
|
}).map((thread) => (0, import_echo2.fullyQualifiedId)(thread)).join(" ");
|
|
1168
1161
|
const description = model.getValueDescription(address);
|
|
1169
1162
|
const type = description?.type;
|
|
1170
1163
|
const format = description?.format;
|
|
1171
|
-
const classNames = ranges?.map(
|
|
1164
|
+
const classNames = ranges?.map(import_chunk_KSEEI5VC.cellClassNameForRange).reverse();
|
|
1172
1165
|
return {
|
|
1173
1166
|
value: (0, import_react_ui_form.parseValue)({
|
|
1174
1167
|
type,
|
|
@@ -1384,7 +1377,7 @@ var GridSheet = () => {
|
|
|
1384
1377
|
]);
|
|
1385
1378
|
const handleBlur = (0, import_react4.useCallback)((value) => {
|
|
1386
1379
|
if (value !== void 0) {
|
|
1387
|
-
model.setValue(
|
|
1380
|
+
model.setValue((0, import_react_ui_grid2.parseCellIndex)(editing.index), value);
|
|
1388
1381
|
}
|
|
1389
1382
|
}, [
|
|
1390
1383
|
model,
|
|
@@ -1417,7 +1410,7 @@ var GridSheet = () => {
|
|
|
1417
1410
|
};
|
|
1418
1411
|
}
|
|
1419
1412
|
if (editing) {
|
|
1420
|
-
rangeController.current?.setRange((0,
|
|
1413
|
+
rangeController.current?.setRange((0, import_chunk_KSEEI5VC.rangeToA1Notation)(range));
|
|
1421
1414
|
} else {
|
|
1422
1415
|
setRange(range.to ? range : void 0);
|
|
1423
1416
|
}
|
|
@@ -1536,7 +1529,7 @@ var GridSheet = () => {
|
|
|
1536
1529
|
case "insert-before":
|
|
1537
1530
|
case "insert-after":
|
|
1538
1531
|
return dispatch({
|
|
1539
|
-
action:
|
|
1532
|
+
action: import_chunk_OWH2EUHZ.SheetAction.INSERT_AXIS,
|
|
1540
1533
|
data: {
|
|
1541
1534
|
model,
|
|
1542
1535
|
axis: contextMenuAxis,
|
|
@@ -1546,7 +1539,7 @@ var GridSheet = () => {
|
|
|
1546
1539
|
break;
|
|
1547
1540
|
case "drop":
|
|
1548
1541
|
return dispatch({
|
|
1549
|
-
action:
|
|
1542
|
+
action: import_chunk_OWH2EUHZ.SheetAction.DROP_AXIS,
|
|
1550
1543
|
data: {
|
|
1551
1544
|
model,
|
|
1552
1545
|
axis: contextMenuAxis,
|
|
@@ -1585,8 +1578,7 @@ var GridSheet = () => {
|
|
|
1585
1578
|
editing
|
|
1586
1579
|
]);
|
|
1587
1580
|
const getCellContent = (0, import_react4.useCallback)((index) => {
|
|
1588
|
-
|
|
1589
|
-
return model.getCellText(cell);
|
|
1581
|
+
return model.getCellText((0, import_react_ui_grid2.parseCellIndex)(index));
|
|
1590
1582
|
}, [
|
|
1591
1583
|
model
|
|
1592
1584
|
]);
|
|
@@ -1601,8 +1593,8 @@ var GridSheet = () => {
|
|
|
1601
1593
|
onBlur: handleBlur
|
|
1602
1594
|
}), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_grid2.Grid.Content, {
|
|
1603
1595
|
initialCells,
|
|
1604
|
-
limitColumns:
|
|
1605
|
-
limitRows:
|
|
1596
|
+
limitColumns: import_chunk_KSEEI5VC.DEFAULT_COLUMNS,
|
|
1597
|
+
limitRows: import_chunk_KSEEI5VC.DEFAULT_ROWS,
|
|
1606
1598
|
columns,
|
|
1607
1599
|
rows,
|
|
1608
1600
|
onAxisResize: handleAxisResize,
|
|
@@ -1630,17 +1622,20 @@ var GridSheet = () => {
|
|
|
1630
1622
|
sideOffset: 4,
|
|
1631
1623
|
collisionPadding: 8
|
|
1632
1624
|
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Viewport, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
|
|
1633
|
-
onClick: () => handleAxisMenuAction("insert-before")
|
|
1625
|
+
onClick: () => handleAxisMenuAction("insert-before"),
|
|
1626
|
+
"data-testid": `grid.${contextMenuAxis}.insert-before`
|
|
1634
1627
|
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
|
|
1635
1628
|
size: 5,
|
|
1636
1629
|
icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
|
|
1637
1630
|
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
|
|
1638
|
-
onClick: () => handleAxisMenuAction("insert-after")
|
|
1631
|
+
onClick: () => handleAxisMenuAction("insert-after"),
|
|
1632
|
+
"data-testid": `grid.${contextMenuAxis}.insert-after`
|
|
1639
1633
|
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
|
|
1640
1634
|
size: 5,
|
|
1641
1635
|
icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
|
|
1642
1636
|
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
|
|
1643
|
-
onClick: () => handleAxisMenuAction("drop")
|
|
1637
|
+
onClick: () => handleAxisMenuAction("drop"),
|
|
1638
|
+
"data-testid": `grid.${contextMenuAxis}.drop`
|
|
1644
1639
|
}, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
|
|
1645
1640
|
size: 5,
|
|
1646
1641
|
icon: "ph--backspace--regular"
|
|
@@ -1650,12 +1645,12 @@ var GridSheet = () => {
|
|
|
1650
1645
|
0 && (module.exports = {
|
|
1651
1646
|
ComputeGraphContextProvider,
|
|
1652
1647
|
GridSheet,
|
|
1653
|
-
RangeList,
|
|
1654
1648
|
SheetContainer,
|
|
1649
|
+
SheetObjectSettings,
|
|
1655
1650
|
SheetProvider,
|
|
1656
1651
|
completeCellRangeToThreadCursor,
|
|
1657
1652
|
computeGraphFacet,
|
|
1658
1653
|
useComputeGraph,
|
|
1659
1654
|
useSheetContext
|
|
1660
1655
|
});
|
|
1661
|
-
//# sourceMappingURL=chunk-
|
|
1656
|
+
//# sourceMappingURL=chunk-45YW2DX2.cjs.map
|