@dxos/plugin-sheet 0.6.14-main.8b352a0 → 0.6.14-staging.8758a12

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.
Files changed (103) hide show
  1. package/dist/lib/browser/{SheetContainer-R65IDJHN.mjs → SheetContainer-GPJOTYCI.mjs} +41 -30
  2. package/dist/lib/browser/SheetContainer-GPJOTYCI.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-5KVQ5IPW.mjs → chunk-BVUN7SHF.mjs} +4 -2
  4. package/dist/lib/browser/chunk-BVUN7SHF.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-I2DKJ72A.mjs → chunk-CYOQA6UK.mjs} +277 -79
  6. package/dist/lib/browser/chunk-CYOQA6UK.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-D3QTX46O.mjs → chunk-RABELMEQ.mjs} +3 -2
  8. package/dist/lib/browser/{chunk-D3QTX46O.mjs.map → chunk-RABELMEQ.mjs.map} +3 -3
  9. package/dist/lib/browser/{chunk-KCYJSOFB.mjs → chunk-VMSX6Z4X.mjs} +51 -17
  10. package/dist/lib/browser/chunk-VMSX6Z4X.mjs.map +7 -0
  11. package/dist/lib/browser/{compute-graph-SJT67236.mjs → compute-graph-GGWUX644.mjs} +4 -4
  12. package/dist/lib/browser/index.mjs +38 -10
  13. package/dist/lib/browser/index.mjs.map +3 -3
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/meta.mjs +1 -1
  16. package/dist/lib/browser/types.mjs +2 -2
  17. package/dist/lib/node/{SheetContainer-6BO4C5X2.cjs → SheetContainer-VSC6XF3M.cjs} +60 -50
  18. package/dist/lib/node/SheetContainer-VSC6XF3M.cjs.map +7 -0
  19. package/dist/lib/node/{chunk-QIFIGEKV.cjs → chunk-2ZVZI2KJ.cjs} +6 -5
  20. package/dist/lib/node/{chunk-QIFIGEKV.cjs.map → chunk-2ZVZI2KJ.cjs.map} +3 -3
  21. package/dist/lib/node/{chunk-DEPJHN47.cjs → chunk-545PZPK3.cjs} +313 -116
  22. package/dist/lib/node/chunk-545PZPK3.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-2XJ5I4UF.cjs → chunk-AWKOWDMI.cjs} +8 -6
  24. package/dist/lib/node/chunk-AWKOWDMI.cjs.map +7 -0
  25. package/dist/lib/node/{chunk-JF5XNTF3.cjs → chunk-O7XR4R7Y.cjs} +61 -26
  26. package/dist/lib/node/chunk-O7XR4R7Y.cjs.map +7 -0
  27. package/dist/lib/node/{compute-graph-AQBDL7HO.cjs → compute-graph-KGWA2QLE.cjs} +21 -21
  28. package/dist/lib/node/{compute-graph-AQBDL7HO.cjs.map → compute-graph-KGWA2QLE.cjs.map} +2 -2
  29. package/dist/lib/node/index.cjs +66 -38
  30. package/dist/lib/node/index.cjs.map +3 -3
  31. package/dist/lib/node/meta.cjs +3 -3
  32. package/dist/lib/node/meta.cjs.map +1 -1
  33. package/dist/lib/node/meta.json +1 -1
  34. package/dist/lib/node/types.cjs +7 -7
  35. package/dist/lib/node/types.cjs.map +1 -1
  36. package/dist/lib/node-esm/{SheetContainer-MJXC5E3P.mjs → SheetContainer-SJK25GKT.mjs} +41 -30
  37. package/dist/lib/node-esm/SheetContainer-SJK25GKT.mjs.map +7 -0
  38. package/dist/lib/node-esm/{chunk-VCYJWE3O.mjs → chunk-BM2Q3FFC.mjs} +3 -2
  39. package/dist/lib/node-esm/{chunk-VCYJWE3O.mjs.map → chunk-BM2Q3FFC.mjs.map} +3 -3
  40. package/dist/lib/node-esm/{chunk-XBEHKYO7.mjs → chunk-CR4K75EL.mjs} +51 -17
  41. package/dist/lib/node-esm/chunk-CR4K75EL.mjs.map +7 -0
  42. package/dist/lib/node-esm/{chunk-25V7WY4R.mjs → chunk-EZ6K2W62.mjs} +277 -79
  43. package/dist/lib/node-esm/chunk-EZ6K2W62.mjs.map +7 -0
  44. package/dist/lib/node-esm/{chunk-5TXLF6PL.mjs → chunk-UIBWRHW7.mjs} +4 -2
  45. package/dist/lib/node-esm/chunk-UIBWRHW7.mjs.map +7 -0
  46. package/dist/lib/node-esm/{compute-graph-FRCKXEYK.mjs → compute-graph-2SCZT7N5.mjs} +4 -4
  47. package/dist/lib/node-esm/index.mjs +38 -10
  48. package/dist/lib/node-esm/index.mjs.map +3 -3
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/meta.mjs +1 -1
  51. package/dist/lib/node-esm/types.mjs +2 -2
  52. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  53. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  54. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  55. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -2
  57. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  58. package/dist/types/src/compute-graph/compute-graph.d.ts +2 -2
  59. package/dist/types/src/compute-graph/compute-graph.d.ts.map +1 -1
  60. package/dist/types/src/compute-graph/functions/async-function.d.ts.map +1 -1
  61. package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +1 -1
  62. package/dist/types/src/defs/sheet-range-types.d.ts +1 -1
  63. package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -1
  64. package/dist/types/src/defs/util.d.ts +1 -1
  65. package/dist/types/src/defs/util.d.ts.map +1 -1
  66. package/dist/types/src/meta.d.ts +1 -0
  67. package/dist/types/src/meta.d.ts.map +1 -1
  68. package/dist/types/src/model/sheet-model.d.ts +12 -5
  69. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  70. package/dist/types/src/translations.d.ts +10 -5
  71. package/dist/types/src/translations.d.ts.map +1 -1
  72. package/dist/types/src/types.d.ts +33 -3
  73. package/dist/types/src/types.d.ts.map +1 -1
  74. package/package.json +36 -36
  75. package/src/SheetPlugin.tsx +20 -0
  76. package/src/components/GridSheet/GridSheet.tsx +96 -36
  77. package/src/components/GridSheet/util.ts +13 -7
  78. package/src/components/SheetContainer/SheetContainer.stories.tsx +2 -0
  79. package/src/components/Toolbar/Toolbar.tsx +62 -41
  80. package/src/compute-graph/compute-graph.ts +22 -7
  81. package/src/compute-graph/functions/async-function.ts +1 -0
  82. package/src/compute-graph/functions/edge-function.ts +5 -3
  83. package/src/defs/sheet-range-types.ts +4 -2
  84. package/src/defs/util.ts +1 -0
  85. package/src/meta.ts +1 -0
  86. package/src/model/sheet-model.test.ts +5 -3
  87. package/src/model/sheet-model.ts +93 -21
  88. package/src/translations.ts +10 -5
  89. package/src/types.ts +20 -0
  90. package/dist/lib/browser/SheetContainer-R65IDJHN.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-5KVQ5IPW.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-I2DKJ72A.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-KCYJSOFB.mjs.map +0 -7
  94. package/dist/lib/node/SheetContainer-6BO4C5X2.cjs.map +0 -7
  95. package/dist/lib/node/chunk-2XJ5I4UF.cjs.map +0 -7
  96. package/dist/lib/node/chunk-DEPJHN47.cjs.map +0 -7
  97. package/dist/lib/node/chunk-JF5XNTF3.cjs.map +0 -7
  98. package/dist/lib/node-esm/SheetContainer-MJXC5E3P.mjs.map +0 -7
  99. package/dist/lib/node-esm/chunk-25V7WY4R.mjs.map +0 -7
  100. package/dist/lib/node-esm/chunk-5TXLF6PL.mjs.map +0 -7
  101. package/dist/lib/node-esm/chunk-XBEHKYO7.mjs.map +0 -7
  102. /package/dist/lib/browser/{compute-graph-SJT67236.mjs.map → compute-graph-GGWUX644.mjs.map} +0 -0
  103. /package/dist/lib/node-esm/{compute-graph-FRCKXEYK.mjs.map → compute-graph-2SCZT7N5.mjs.map} +0 -0
@@ -26,8 +26,8 @@ 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 chunk_DEPJHN47_exports = {};
30
- __export(chunk_DEPJHN47_exports, {
29
+ var chunk_545PZPK3_exports = {};
30
+ __export(chunk_545PZPK3_exports, {
31
31
  ComputeGraphContextProvider: () => ComputeGraphContextProvider,
32
32
  GridSheet: () => GridSheet,
33
33
  RangeList: () => RangeList,
@@ -38,10 +38,10 @@ __export(chunk_DEPJHN47_exports, {
38
38
  useComputeGraph: () => useComputeGraph,
39
39
  useSheetContext: () => useSheetContext
40
40
  });
41
- module.exports = __toCommonJS(chunk_DEPJHN47_exports);
42
- var import_chunk_JF5XNTF3 = require("./chunk-JF5XNTF3.cjs");
43
- var import_chunk_2XJ5I4UF = require("./chunk-2XJ5I4UF.cjs");
44
- var import_chunk_QIFIGEKV = require("./chunk-QIFIGEKV.cjs");
41
+ module.exports = __toCommonJS(chunk_545PZPK3_exports);
42
+ var import_chunk_O7XR4R7Y = require("./chunk-O7XR4R7Y.cjs");
43
+ var import_chunk_AWKOWDMI = require("./chunk-AWKOWDMI.cjs");
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");
47
47
  var import_react_hooks = require("@dxos/react-hooks");
@@ -68,10 +68,10 @@ var import_echo_schema = require("@dxos/echo-schema");
68
68
  var import_invariant3 = require("@dxos/invariant");
69
69
  var import_keys = require("@dxos/keys");
70
70
  var import_log = require("@dxos/log");
71
- var import_schema = require("@dxos/schema");
72
71
  var import_hyperformula = require("#hyperformula");
73
72
  var import_react3 = require("react");
74
73
  var import_react4 = __toESM(require("react"));
74
+ var import_app_framework = require("@dxos/app-framework");
75
75
  var import_react_ui = require("@dxos/react-ui");
76
76
  var import_react_ui_attention = require("@dxos/react-ui-attention");
77
77
  var import_react_ui_grid2 = require("@dxos/react-ui-grid");
@@ -81,7 +81,7 @@ var import_react_ui_data = require("@dxos/react-ui-data");
81
81
  var import_react_ui_grid3 = require("@dxos/react-ui-grid");
82
82
  var import_react_ui_theme2 = require("@dxos/react-ui-theme");
83
83
  var import_react6 = require("react");
84
- var import_app_framework = require("@dxos/app-framework");
84
+ var import_app_framework2 = require("@dxos/app-framework");
85
85
  var import_async3 = require("@dxos/async");
86
86
  var import_echo3 = require("@dxos/react-client/echo");
87
87
  var import_react7 = require("react");
@@ -293,7 +293,7 @@ var rangeExtension = ({ onInit, onStateChange }) => {
293
293
  });
294
294
  if (!activeRange && view2.state.doc.toString()[0] === "=") {
295
295
  const str = view2.state.doc.sliceString(1);
296
- if (import_chunk_JF5XNTF3.RANGE_NOTATION.test(str)) {
296
+ if (import_chunk_O7XR4R7Y.RANGE_NOTATION.test(str)) {
297
297
  activeRange = {
298
298
  from: 1,
299
299
  to: str.length + 1
@@ -319,13 +319,32 @@ var visitTree = (node, callback) => {
319
319
  };
320
320
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
321
321
  var typeMap = {
322
- BOOLEAN: import_schema.FieldValueType.Boolean,
323
- NUMBER_RAW: import_schema.FieldValueType.Number,
324
- NUMBER_PERCENT: import_schema.FieldValueType.Percent,
325
- NUMBER_CURRENCY: import_schema.FieldValueType.Currency,
326
- NUMBER_DATETIME: import_schema.FieldValueType.DateTime,
327
- NUMBER_DATE: import_schema.FieldValueType.Date,
328
- NUMBER_TIME: import_schema.FieldValueType.Time
322
+ BOOLEAN: {
323
+ type: import_echo_schema.TypeEnum.Boolean
324
+ },
325
+ NUMBER_RAW: {
326
+ type: import_echo_schema.TypeEnum.Number
327
+ },
328
+ NUMBER_PERCENT: {
329
+ type: import_echo_schema.TypeEnum.Number,
330
+ format: import_echo_schema.FormatEnum.Percent
331
+ },
332
+ NUMBER_CURRENCY: {
333
+ type: import_echo_schema.TypeEnum.Number,
334
+ format: import_echo_schema.FormatEnum.Currency
335
+ },
336
+ NUMBER_DATETIME: {
337
+ type: import_echo_schema.TypeEnum.String,
338
+ format: import_echo_schema.FormatEnum.DateTime
339
+ },
340
+ NUMBER_DATE: {
341
+ type: import_echo_schema.TypeEnum.String,
342
+ format: import_echo_schema.FormatEnum.Date
343
+ },
344
+ NUMBER_TIME: {
345
+ type: import_echo_schema.TypeEnum.String,
346
+ format: import_echo_schema.FormatEnum.Time
347
+ }
329
348
  };
330
349
  var getTopLeft = (range) => {
331
350
  const to = range.to ?? range.from;
@@ -375,12 +394,17 @@ var SheetModel = class extends import_context.Resource {
375
394
  id: this.id
376
395
  }, {
377
396
  F: __dxlog_file,
378
- L: 111,
397
+ L: 113,
379
398
  S: this,
380
399
  C: (f, a) => f(...a)
381
400
  });
382
- (0, import_chunk_JF5XNTF3.initialize)(this._sheet);
383
- this._node = this._graph.getOrCreateNode((0, import_chunk_JF5XNTF3.createSheetName)({
401
+ (0, import_chunk_O7XR4R7Y.initialize)(this._sheet);
402
+ this._graph.update.on((event) => {
403
+ if (event.type === "functionsUpdated") {
404
+ this.reset();
405
+ }
406
+ });
407
+ this._node = this._graph.getOrCreateNode((0, import_chunk_O7XR4R7Y.createSheetName)({
384
408
  type: (0, import_echo_schema.getTypename)(this._sheet),
385
409
  id: this._sheet.id
386
410
  }));
@@ -397,7 +421,7 @@ var SheetModel = class extends import_context.Resource {
397
421
  reset() {
398
422
  (0, import_invariant3.invariant)(this._node, void 0, {
399
423
  F: __dxlog_file,
400
- L: 131,
424
+ L: 139,
401
425
  S: this,
402
426
  A: [
403
427
  "this._node",
@@ -408,16 +432,21 @@ var SheetModel = class extends import_context.Resource {
408
432
  Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
409
433
  (0, import_invariant3.invariant)(this._node, void 0, {
410
434
  F: __dxlog_file,
411
- L: 134,
435
+ L: 142,
412
436
  S: this,
413
437
  A: [
414
438
  "this._node",
415
439
  ""
416
440
  ]
417
441
  });
418
- const { col, row } = (0, import_chunk_JF5XNTF3.addressFromIndex)(this._sheet, key);
419
- if ((0, import_chunk_JF5XNTF3.isFormula)(value)) {
420
- value = this._graph.mapFormulaToNative(this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value)));
442
+ const { col, row } = (0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, key);
443
+ if ((0, import_chunk_O7XR4R7Y.isFormula)(value)) {
444
+ const binding = this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value));
445
+ if (binding) {
446
+ value = this._graph.mapFormulaToNative(binding);
447
+ } else {
448
+ value = "";
449
+ }
421
450
  }
422
451
  this._node.graph.hf.setCellContents({
423
452
  sheet: this._node.sheetId,
@@ -437,11 +466,79 @@ var SheetModel = class extends import_context.Resource {
437
466
  this._node?.graph.hf.rebuildAndRecalculate();
438
467
  }
439
468
  insertRows(i, n = 1) {
440
- (0, import_chunk_JF5XNTF3.insertIndices)(this._sheet.rows, i, n, import_chunk_JF5XNTF3.MAX_ROWS);
469
+ const idx = (0, import_chunk_O7XR4R7Y.insertIndices)(this._sheet.rows, i, n, import_chunk_O7XR4R7Y.MAX_ROWS);
441
470
  this.reset();
471
+ return idx;
442
472
  }
443
473
  insertColumns(i, n = 1) {
444
- (0, import_chunk_JF5XNTF3.insertIndices)(this._sheet.columns, i, n, import_chunk_JF5XNTF3.MAX_COLUMNS);
474
+ const idx = (0, import_chunk_O7XR4R7Y.insertIndices)(this._sheet.columns, i, n, import_chunk_O7XR4R7Y.MAX_COLUMNS);
475
+ this.reset();
476
+ return idx;
477
+ }
478
+ dropRow(rowIndex) {
479
+ const range = {
480
+ from: (0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
481
+ to: (0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`)
482
+ };
483
+ const values = this.getCellValues(range).flat();
484
+ const index = this._sheet.rows.indexOf(rowIndex);
485
+ this.clear(range);
486
+ this._sheet.rows.splice(index, 1);
487
+ delete this._sheet.rowMeta[rowIndex];
488
+ this.reset();
489
+ return {
490
+ axis: "row",
491
+ index,
492
+ axisIndex: rowIndex,
493
+ axisMeta: this._sheet.rowMeta[rowIndex],
494
+ values
495
+ };
496
+ }
497
+ dropColumn(colIndex) {
498
+ const range = {
499
+ from: (0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
500
+ to: (0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
501
+ };
502
+ const values = this.getCellValues(range).flat();
503
+ const index = this._sheet.columns.indexOf(colIndex);
504
+ this.clear(range);
505
+ this._sheet.columns.splice(index, 1);
506
+ delete this._sheet.columnMeta[colIndex];
507
+ this.reset();
508
+ return {
509
+ axis: "col",
510
+ index,
511
+ axisIndex: colIndex,
512
+ axisMeta: this._sheet.rowMeta[colIndex],
513
+ values
514
+ };
515
+ }
516
+ restoreRow({ index, axisIndex, axisMeta, values }) {
517
+ this._sheet.rows.splice(index, 0, axisIndex);
518
+ values.forEach((value, col) => {
519
+ if (value) {
520
+ this._sheet.cells[`${this._sheet.columns[col]}@${axisIndex}`] = {
521
+ value
522
+ };
523
+ }
524
+ });
525
+ if (axisMeta) {
526
+ this._sheet.rowMeta[axisIndex] = axisMeta;
527
+ }
528
+ this.reset();
529
+ }
530
+ restoreColumn({ index, axisIndex, axisMeta, values }) {
531
+ this._sheet.columns.splice(index, 0, axisIndex);
532
+ values.forEach((value, row) => {
533
+ if (value) {
534
+ this._sheet.cells[`${axisIndex}@${this._sheet.rows[row]}`] = {
535
+ value
536
+ };
537
+ }
538
+ });
539
+ if (axisMeta) {
540
+ this._sheet.columnMeta[axisIndex] = axisMeta;
541
+ }
445
542
  this.reset();
446
543
  }
447
544
  //
@@ -454,7 +551,7 @@ var SheetModel = class extends import_context.Resource {
454
551
  clear(range) {
455
552
  (0, import_invariant3.invariant)(this._node, void 0, {
456
553
  F: __dxlog_file,
457
- L: 176,
554
+ L: 245,
458
555
  S: this,
459
556
  A: [
460
557
  "this._node",
@@ -465,14 +562,14 @@ var SheetModel = class extends import_context.Resource {
465
562
  const values = this._iterRange(range, () => null);
466
563
  this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
467
564
  this._iterRange(range, (cell) => {
468
- const idx = (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, cell);
565
+ const idx = (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, cell);
469
566
  delete this._sheet.cells[idx];
470
567
  });
471
568
  }
472
569
  cut(range) {
473
570
  (0, import_invariant3.invariant)(this._node, void 0, {
474
571
  F: __dxlog_file,
475
- L: 187,
572
+ L: 256,
476
573
  S: this,
477
574
  A: [
478
575
  "this._node",
@@ -481,14 +578,14 @@ var SheetModel = class extends import_context.Resource {
481
578
  });
482
579
  this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
483
580
  this._iterRange(range, (cell) => {
484
- const idx = (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, cell);
581
+ const idx = (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, cell);
485
582
  delete this._sheet.cells[idx];
486
583
  });
487
584
  }
488
585
  copy(range) {
489
586
  (0, import_invariant3.invariant)(this._node, void 0, {
490
587
  F: __dxlog_file,
491
- L: 196,
588
+ L: 265,
492
589
  S: this,
493
590
  A: [
494
591
  "this._node",
@@ -500,7 +597,7 @@ var SheetModel = class extends import_context.Resource {
500
597
  paste(cell) {
501
598
  (0, import_invariant3.invariant)(this._node, void 0, {
502
599
  F: __dxlog_file,
503
- L: 201,
600
+ L: 270,
504
601
  S: this,
505
602
  A: [
506
603
  "this._node",
@@ -512,7 +609,7 @@ var SheetModel = class extends import_context.Resource {
512
609
  for (const change of changes) {
513
610
  if (change instanceof import_hyperformula.ExportedCellChange) {
514
611
  const { address, newValue } = change;
515
- const idx = (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, {
612
+ const idx = (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, {
516
613
  row: address.row,
517
614
  col: address.col
518
615
  });
@@ -527,7 +624,7 @@ var SheetModel = class extends import_context.Resource {
527
624
  undo() {
528
625
  (0, import_invariant3.invariant)(this._node, void 0, {
529
626
  F: __dxlog_file,
530
- L: 216,
627
+ L: 285,
531
628
  S: this,
532
629
  A: [
533
630
  "this._node",
@@ -541,7 +638,7 @@ var SheetModel = class extends import_context.Resource {
541
638
  redo() {
542
639
  (0, import_invariant3.invariant)(this._node, void 0, {
543
640
  F: __dxlog_file,
544
- L: 224,
641
+ L: 293,
545
642
  S: this,
546
643
  A: [
547
644
  "this._node",
@@ -556,7 +653,7 @@ var SheetModel = class extends import_context.Resource {
556
653
  * Get value from sheet.
557
654
  */
558
655
  getCellValue(cell) {
559
- const idx = (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, cell);
656
+ const idx = (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, cell);
560
657
  return this._sheet.cells[idx]?.value ?? null;
561
658
  }
562
659
  /**
@@ -567,7 +664,7 @@ var SheetModel = class extends import_context.Resource {
567
664
  if (value == null) {
568
665
  return void 0;
569
666
  }
570
- if ((0, import_chunk_JF5XNTF3.isFormula)(value)) {
667
+ if ((0, import_chunk_O7XR4R7Y.isFormula)(value)) {
571
668
  return this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value));
572
669
  } else {
573
670
  return String(value);
@@ -585,15 +682,25 @@ var SheetModel = class extends import_context.Resource {
585
682
  getValue(cell) {
586
683
  (0, import_invariant3.invariant)(this._node, void 0, {
587
684
  F: __dxlog_file,
588
- L: 267,
685
+ L: 336,
589
686
  S: this,
590
687
  A: [
591
688
  "this._node",
592
689
  ""
593
690
  ]
594
691
  });
595
- const value = this._node.graph.hf.getCellValue(toSimpleCellAddress(this._node.sheetId, cell));
692
+ const address = toSimpleCellAddress(this._node.sheetId, cell);
693
+ const value = this._node.graph.hf.getCellValue(address);
596
694
  if (value instanceof import_hyperformula.DetailedCellError) {
695
+ import_log.log.info("cell error", {
696
+ cell,
697
+ error: value
698
+ }, {
699
+ F: __dxlog_file,
700
+ L: 341,
701
+ S: this,
702
+ C: (f, a) => f(...a)
703
+ });
597
704
  return value.toString();
598
705
  }
599
706
  return value;
@@ -601,10 +708,10 @@ var SheetModel = class extends import_context.Resource {
601
708
  /**
602
709
  * Get value type.
603
710
  */
604
- getValueType(cell) {
711
+ getValueDescription(cell) {
605
712
  (0, import_invariant3.invariant)(this._node, void 0, {
606
713
  F: __dxlog_file,
607
- L: 280,
714
+ L: 352,
608
715
  S: this,
609
716
  A: [
610
717
  "this._node",
@@ -621,7 +728,7 @@ var SheetModel = class extends import_context.Resource {
621
728
  setValue(cell, value) {
622
729
  (0, import_invariant3.invariant)(this._node, void 0, {
623
730
  F: __dxlog_file,
624
- L: 290,
731
+ L: 362,
625
732
  S: this,
626
733
  A: [
627
734
  "this._node",
@@ -629,15 +736,15 @@ var SheetModel = class extends import_context.Resource {
629
736
  ]
630
737
  });
631
738
  if (this._options.readonly) {
632
- throw new import_chunk_JF5XNTF3.ReadonlyException();
739
+ throw new import_chunk_O7XR4R7Y.ReadonlyException();
633
740
  }
634
741
  let refresh = false;
635
742
  if (cell.row >= this._sheet.rows.length) {
636
- (0, import_chunk_JF5XNTF3.insertIndices)(this._sheet.rows, cell.row, 1, import_chunk_JF5XNTF3.MAX_ROWS);
743
+ (0, import_chunk_O7XR4R7Y.insertIndices)(this._sheet.rows, cell.row, 1, import_chunk_O7XR4R7Y.MAX_ROWS);
637
744
  refresh = true;
638
745
  }
639
746
  if (cell.col >= this._sheet.columns.length) {
640
- (0, import_chunk_JF5XNTF3.insertIndices)(this._sheet.columns, cell.col, 1, import_chunk_JF5XNTF3.MAX_COLUMNS);
747
+ (0, import_chunk_O7XR4R7Y.insertIndices)(this._sheet.columns, cell.col, 1, import_chunk_O7XR4R7Y.MAX_COLUMNS);
641
748
  refresh = true;
642
749
  }
643
750
  if (refresh) {
@@ -649,14 +756,14 @@ var SheetModel = class extends import_context.Resource {
649
756
  col: cell.col
650
757
  }, [
651
758
  [
652
- (0, import_chunk_JF5XNTF3.isFormula)(value) ? this._graph.mapFormulaToNative(value) : value
759
+ (0, import_chunk_O7XR4R7Y.isFormula)(value) ? this._graph.mapFormulaToNative(value) : value
653
760
  ]
654
761
  ]);
655
- const idx = (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, cell);
762
+ const idx = (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, cell);
656
763
  if (value === void 0 || value === null) {
657
764
  delete this._sheet.cells[idx];
658
765
  } else {
659
- if ((0, import_chunk_JF5XNTF3.isFormula)(value)) {
766
+ if ((0, import_chunk_O7XR4R7Y.isFormula)(value)) {
660
767
  value = this._graph.mapFunctionBindingToId(this.mapFormulaRefsToIndices(value));
661
768
  }
662
769
  this._sheet.cells[idx] = {
@@ -669,7 +776,7 @@ var SheetModel = class extends import_context.Resource {
669
776
  */
670
777
  setValues(values) {
671
778
  Object.entries(values).forEach(([key, { value }]) => {
672
- this.setValue((0, import_chunk_JF5XNTF3.addressFromA1Notation)(key), value);
779
+ this.setValue((0, import_chunk_O7XR4R7Y.addressFromA1Notation)(key), value);
673
780
  });
674
781
  }
675
782
  /**
@@ -716,9 +823,9 @@ var SheetModel = class extends import_context.Resource {
716
823
  * Map from A1 notation to indices.
717
824
  */
718
825
  mapFormulaRefsToIndices(formula) {
719
- (0, import_invariant3.invariant)((0, import_chunk_JF5XNTF3.isFormula)(formula), void 0, {
826
+ (0, import_invariant3.invariant)((0, import_chunk_O7XR4R7Y.isFormula)(formula), void 0, {
720
827
  F: __dxlog_file,
721
- L: 379,
828
+ L: 451,
722
829
  S: this,
723
830
  A: [
724
831
  "isFormula(formula)",
@@ -726,16 +833,16 @@ var SheetModel = class extends import_context.Resource {
726
833
  ]
727
834
  });
728
835
  return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
729
- return (0, import_chunk_JF5XNTF3.addressToIndex)(this._sheet, (0, import_chunk_JF5XNTF3.addressFromA1Notation)(match));
836
+ return (0, import_chunk_O7XR4R7Y.addressToIndex)(this._sheet, (0, import_chunk_O7XR4R7Y.addressFromA1Notation)(match));
730
837
  });
731
838
  }
732
839
  /**
733
840
  * Map from indices to A1 notation.
734
841
  */
735
842
  mapFormulaIndicesToRefs(formula) {
736
- (0, import_invariant3.invariant)((0, import_chunk_JF5XNTF3.isFormula)(formula), void 0, {
843
+ (0, import_invariant3.invariant)((0, import_chunk_O7XR4R7Y.isFormula)(formula), void 0, {
737
844
  F: __dxlog_file,
738
- L: 389,
845
+ L: 461,
739
846
  S: this,
740
847
  A: [
741
848
  "isFormula(formula)",
@@ -743,7 +850,7 @@ var SheetModel = class extends import_context.Resource {
743
850
  ]
744
851
  });
745
852
  return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
746
- return (0, import_chunk_JF5XNTF3.addressToA1Notation)((0, import_chunk_JF5XNTF3.addressFromIndex)(this._sheet, idx));
853
+ return (0, import_chunk_O7XR4R7Y.addressToA1Notation)((0, import_chunk_O7XR4R7Y.addressFromIndex)(this._sheet, idx));
747
854
  });
748
855
  }
749
856
  //
@@ -761,7 +868,7 @@ var SheetModel = class extends import_context.Resource {
761
868
  toDateTime(num) {
762
869
  (0, import_invariant3.invariant)(this._node, void 0, {
763
870
  F: __dxlog_file,
764
- L: 410,
871
+ L: 482,
765
872
  S: this,
766
873
  A: [
767
874
  "this._node",
@@ -773,7 +880,7 @@ var SheetModel = class extends import_context.Resource {
773
880
  toDate(num) {
774
881
  (0, import_invariant3.invariant)(this._node, void 0, {
775
882
  F: __dxlog_file,
776
- L: 415,
883
+ L: 487,
777
884
  S: this,
778
885
  A: [
779
886
  "this._node",
@@ -785,7 +892,7 @@ var SheetModel = class extends import_context.Resource {
785
892
  toTime(num) {
786
893
  (0, import_invariant3.invariant)(this._node, void 0, {
787
894
  F: __dxlog_file,
788
- L: 420,
895
+ L: 492,
789
896
  S: this,
790
897
  A: [
791
898
  "this._node",
@@ -889,7 +996,7 @@ var SheetProvider = ({ children, graph, sheet, readonly, onInfo }) => {
889
996
  }, children));
890
997
  };
891
998
  var RangeList = ({ sheet }) => {
892
- const { t } = (0, import_react_ui2.useTranslation)(import_chunk_QIFIGEKV.SHEET_PLUGIN);
999
+ const { t } = (0, import_react_ui2.useTranslation)(import_chunk_2ZVZI2KJ.SHEET_PLUGIN);
893
1000
  const handleSelectRange = (range) => {
894
1001
  };
895
1002
  const handleDeleteRange = (0, import_react8.useCallback)((range) => {
@@ -902,7 +1009,7 @@ var RangeList = ({ sheet }) => {
902
1009
  className: "p-2 text-sm font-semibold"
903
1010
  }, t("range list heading")), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.Root, {
904
1011
  items: sheet.ranges,
905
- isItem: import_echo_schema2.S.is(import_chunk_2XJ5I4UF.Range)
1012
+ isItem: import_echo_schema2.S.is(import_chunk_AWKOWDMI.Range)
906
1013
  }, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.Item, {
907
1014
  key: i,
908
1015
  item: range,
@@ -913,14 +1020,14 @@ var RangeList = ({ sheet }) => {
913
1020
  }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemDragHandle, null), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemTitle, {
914
1021
  onClick: () => handleSelectRange(range)
915
1022
  }, t("range title", {
916
- position: (0, import_chunk_JF5XNTF3.rangeToA1Notation)((0, import_chunk_JF5XNTF3.rangeFromIndex)(sheet, range.range)),
1023
+ position: (0, import_chunk_O7XR4R7Y.rangeToA1Notation)((0, import_chunk_O7XR4R7Y.rangeFromIndex)(sheet, range.range)),
917
1024
  key: t(`range key ${range.key} label`),
918
1025
  value: t(`range value ${range.value} label`)
919
1026
  })), /* @__PURE__ */ import_react8.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
920
1027
  onClick: () => handleDeleteRange(range)
921
1028
  })))));
922
1029
  };
923
- var SheetContainer = (0, import_react7.lazy)(() => import("./SheetContainer-6BO4C5X2.cjs"));
1030
+ var SheetContainer = (0, import_react7.lazy)(() => import("./SheetContainer-VSC6XF3M.cjs"));
924
1031
  var completeCellRangeToThreadCursor = (range) => {
925
1032
  return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
926
1033
  };
@@ -946,7 +1053,7 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
946
1053
  const { model, setActiveRefs } = useSheetContext();
947
1054
  const handleScrollIntoView = (0, import_react6.useCallback)(({ action, data }) => {
948
1055
  switch (action) {
949
- case import_app_framework.LayoutAction.SCROLL_INTO_VIEW: {
1056
+ case import_app_framework2.LayoutAction.SCROLL_INTO_VIEW: {
950
1057
  if (!data?.id || data?.cursor === void 0 || data?.id !== (0, import_echo3.fullyQualifiedId)(model.sheet)) {
951
1058
  return;
952
1059
  }
@@ -962,11 +1069,11 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
962
1069
  model.sheet,
963
1070
  setActiveRefs
964
1071
  ]);
965
- (0, import_app_framework.useIntentResolver)(import_chunk_QIFIGEKV.SHEET_PLUGIN, handleScrollIntoView);
1072
+ (0, import_app_framework2.useIntentResolver)(import_chunk_2ZVZI2KJ.SHEET_PLUGIN, handleScrollIntoView);
966
1073
  };
967
1074
  var useSelectThreadOnCellFocus = () => {
968
1075
  const { model, cursor } = useSheetContext();
969
- const dispatch = (0, import_app_framework.useIntentDispatcher)();
1076
+ const dispatch = (0, import_app_framework2.useIntentDispatcher)();
970
1077
  const threads = (0, import_react6.useMemo)(() => model.sheet.threads?.filter((thread) => !!thread) ?? [], [
971
1078
  // TODO(thure): Surely we can find a better dependency for this…
972
1079
  JSON.stringify(model.sheet.threads)
@@ -978,7 +1085,7 @@ var useSelectThreadOnCellFocus = () => {
978
1085
  const closestThread = threads?.find(({ anchor }) => {
979
1086
  if (anchor) {
980
1087
  const range = parseThreadAnchorAsCellRange(anchor);
981
- return range ? (0, import_chunk_JF5XNTF3.inRange)(range, cellAddress) : false;
1088
+ return range ? (0, import_chunk_O7XR4R7Y.inRange)(range, cellAddress) : false;
982
1089
  } else {
983
1090
  return false;
984
1091
  }
@@ -1051,16 +1158,25 @@ var projectCellProps = (model, col, row) => {
1051
1158
  row
1052
1159
  };
1053
1160
  const rawValue = model.getValue(address);
1054
- const ranges = model.sheet.ranges?.filter(({ range }) => (0, import_chunk_JF5XNTF3.inRange)((0, import_chunk_JF5XNTF3.rangeFromIndex)(model.sheet, range), address));
1161
+ const ranges = model.sheet.ranges?.filter(({ range }) => (0, import_chunk_O7XR4R7Y.inRange)((0, import_chunk_O7XR4R7Y.rangeFromIndex)(model.sheet, range), address));
1055
1162
  const threadRefs = model.sheet.threads?.filter((thread) => {
1056
1163
  const range = thread?.anchor && parseThreadAnchorAsCellRange(thread.anchor);
1057
- return thread && range ? (0, import_chunk_JF5XNTF3.inRange)(range, address) : false;
1164
+ return thread && range ? (0, import_chunk_O7XR4R7Y.inRange)(range, address) : false;
1058
1165
  }).map((thread) => (0, import_echo2.fullyQualifiedId)(thread)).join(" ");
1059
- const type = model.getValueType(address);
1060
- const classNames = ranges?.map(import_chunk_JF5XNTF3.cellClassNameForRange).reverse();
1166
+ const description = model.getValueDescription(address);
1167
+ const type = description?.type;
1168
+ const format = description?.format;
1169
+ const classNames = ranges?.map(import_chunk_O7XR4R7Y.cellClassNameForRange).reverse();
1061
1170
  return {
1062
- value: (0, import_react_ui_data.parseValue)(type, rawValue),
1063
- className: (0, import_react_ui_theme2.mx)((0, import_react_ui_data.cellClassesForFieldType)(type), threadRefs && import_react_ui_grid3.commentedClassName, classNames),
1171
+ value: (0, import_react_ui_data.parseValue)({
1172
+ type,
1173
+ format,
1174
+ value: rawValue
1175
+ }),
1176
+ className: (0, import_react_ui_theme2.mx)((0, import_react_ui_data.cellClassesForFieldType)({
1177
+ type,
1178
+ format
1179
+ }), threadRefs && import_react_ui_grid3.commentedClassName, classNames),
1064
1180
  dataRefs: threadRefs
1065
1181
  };
1066
1182
  };
@@ -1119,7 +1235,7 @@ var cellGetter = (model) => {
1119
1235
  };
1120
1236
  var useSheetModelDxGridProps = (dxGrid, model) => {
1121
1237
  const [columns, setColumns] = (0, import_react5.useState)(createDxGridColumns(model));
1122
- const [rows, setRows] = (0, import_react5.useState)(createDxGridColumns(model));
1238
+ const [rows, setRows] = (0, import_react5.useState)(createDxGridRows(model));
1123
1239
  (0, import_react5.useEffect)(() => {
1124
1240
  const cellsAccessor = (0, import_echo2.createDocAccessor)(model.sheet, [
1125
1241
  "cells"
@@ -1131,7 +1247,11 @@ var useSheetModelDxGridProps = (dxGrid, model) => {
1131
1247
  dxGrid?.requestUpdate("initialCells");
1132
1248
  };
1133
1249
  cellsAccessor.handle.addListener("change", handleCellsUpdate);
1134
- return () => cellsAccessor.handle.removeListener("change", handleCellsUpdate);
1250
+ const unsubscribe = model.graph.update.on(handleCellsUpdate);
1251
+ return () => {
1252
+ cellsAccessor.handle.removeListener("change", handleCellsUpdate);
1253
+ unsubscribe();
1254
+ };
1135
1255
  }, [
1136
1256
  model,
1137
1257
  dxGrid
@@ -1156,7 +1276,8 @@ var useSheetModelDxGridProps = (dxGrid, model) => {
1156
1276
  rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
1157
1277
  };
1158
1278
  }, [
1159
- model
1279
+ model,
1280
+ dxGrid
1160
1281
  ]);
1161
1282
  return {
1162
1283
  columns,
@@ -1208,43 +1329,51 @@ var sheetColDefault = {
1208
1329
  }
1209
1330
  };
1210
1331
  var GridSheet = () => {
1211
- const { t } = (0, import_react_ui.useTranslation)(import_chunk_QIFIGEKV.SHEET_PLUGIN);
1212
- const { id, model, editing, setEditing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs } = useSheetContext();
1332
+ const { t } = (0, import_react_ui.useTranslation)(import_chunk_2ZVZI2KJ.SHEET_PLUGIN);
1333
+ const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs } = useSheetContext();
1213
1334
  const [dxGrid, setDxGrid] = (0, import_react4.useState)(null);
1335
+ const [extraplanarFocus, setExtraplanarFocus] = (0, import_react4.useState)(null);
1336
+ const dispatch = (0, import_app_framework.useIntentDispatcher)();
1214
1337
  const rangeController = (0, import_react4.useRef)();
1215
1338
  const { hasAttention } = (0, import_react_ui_attention.useAttention)(id);
1216
1339
  const handleFocus = (0, import_react4.useCallback)((event) => {
1217
1340
  if (!editing) {
1218
1341
  const cell = (0, import_react_ui_grid2.closestCell)(event.target);
1219
- if (cell && cell.plane === "grid") {
1220
- setCursor({
1221
- col: cell.col,
1222
- row: cell.row
1223
- });
1342
+ if (cell) {
1343
+ if (cell.plane === "grid") {
1344
+ setCursor({
1345
+ col: cell.col,
1346
+ row: cell.row
1347
+ });
1348
+ setExtraplanarFocus(null);
1349
+ } else {
1350
+ setExtraplanarFocus(cell);
1351
+ }
1352
+ } else {
1353
+ setExtraplanarFocus(null);
1224
1354
  }
1225
1355
  }
1226
1356
  }, [
1227
1357
  editing
1228
1358
  ]);
1229
- const handleClose = (0, import_react4.useCallback)((value, { key, shift }) => {
1230
- if (value !== void 0) {
1231
- model.setValue(dxGridCellIndexToSheetCellAddress(editing.index), value);
1359
+ const handleClose = (0, import_react4.useCallback)((_value, event) => {
1360
+ if (event) {
1361
+ const { key, shift } = event;
1362
+ const axis = [
1363
+ "Enter",
1364
+ "ArrowUp",
1365
+ "ArrowDown"
1366
+ ].includes(key) ? "row" : [
1367
+ "Tab",
1368
+ "ArrowLeft",
1369
+ "ArrowRight"
1370
+ ].includes(key) ? "col" : void 0;
1371
+ const delta = key.startsWith("Arrow") ? [
1372
+ "ArrowUp",
1373
+ "ArrowLeft"
1374
+ ].includes(key) ? -1 : 1 : shift ? -1 : 1;
1375
+ dxGrid?.refocus(axis, delta);
1232
1376
  }
1233
- setEditing(null);
1234
- const axis = [
1235
- "Enter",
1236
- "ArrowUp",
1237
- "ArrowDown"
1238
- ].includes(key) ? "row" : [
1239
- "Tab",
1240
- "ArrowLeft",
1241
- "ArrowRight"
1242
- ].includes(key) ? "col" : void 0;
1243
- const delta = key.startsWith("Arrow") ? [
1244
- "ArrowUp",
1245
- "ArrowLeft"
1246
- ].includes(key) ? -1 : 1 : shift ? -1 : 1;
1247
- dxGrid?.refocus(axis, delta);
1248
1377
  }, [
1249
1378
  model,
1250
1379
  editing,
@@ -1254,7 +1383,6 @@ var GridSheet = () => {
1254
1383
  if (value !== void 0) {
1255
1384
  model.setValue(dxGridCellIndexToSheetCellAddress(editing.index), value);
1256
1385
  }
1257
- setEditing(null);
1258
1386
  }, [
1259
1387
  model,
1260
1388
  editing
@@ -1286,7 +1414,7 @@ var GridSheet = () => {
1286
1414
  };
1287
1415
  }
1288
1416
  if (editing) {
1289
- rangeController.current?.setRange((0, import_chunk_JF5XNTF3.rangeToA1Notation)(range));
1417
+ rangeController.current?.setRange((0, import_chunk_O7XR4R7Y.rangeToA1Notation)(range));
1290
1418
  } else {
1291
1419
  setRange(range.to ? range : void 0);
1292
1420
  }
@@ -1300,12 +1428,63 @@ var GridSheet = () => {
1300
1428
  }, [
1301
1429
  hasAttention
1302
1430
  ]);
1431
+ const selectEntireAxis = (0, import_react4.useCallback)((pos) => {
1432
+ switch (pos.plane) {
1433
+ case "frozenRowsStart":
1434
+ return dxGrid?.setSelection({
1435
+ start: {
1436
+ col: pos.col,
1437
+ row: 0,
1438
+ plane: "grid"
1439
+ },
1440
+ end: {
1441
+ col: pos.col,
1442
+ row: model.sheet.rows.length - 1,
1443
+ plane: "grid"
1444
+ }
1445
+ });
1446
+ case "frozenColsStart":
1447
+ return dxGrid?.setSelection({
1448
+ start: {
1449
+ row: pos.row,
1450
+ col: 0,
1451
+ plane: "grid"
1452
+ },
1453
+ end: {
1454
+ row: pos.row,
1455
+ col: model.sheet.columns.length - 1,
1456
+ plane: "grid"
1457
+ }
1458
+ });
1459
+ }
1460
+ }, [
1461
+ dxGrid,
1462
+ model.sheet
1463
+ ]);
1464
+ const handleClick = (0, import_react4.useCallback)((event) => {
1465
+ const cell = (0, import_react_ui_grid2.closestCell)(event.target);
1466
+ if (cell) {
1467
+ selectEntireAxis(cell);
1468
+ }
1469
+ }, [
1470
+ selectEntireAxis
1471
+ ]);
1303
1472
  const handleKeyDown = (0, import_react4.useCallback)((event) => {
1304
1473
  switch (event.key) {
1305
1474
  case "Backspace":
1306
1475
  case "Delete":
1307
1476
  event.preventDefault();
1308
1477
  return cursorFallbackRange && model.clear(cursorFallbackRange);
1478
+ case "Enter":
1479
+ case "Space":
1480
+ if (dxGrid && extraplanarFocus) {
1481
+ switch (extraplanarFocus.plane) {
1482
+ case "frozenRowsStart":
1483
+ case "frozenColsStart":
1484
+ event.preventDefault();
1485
+ return selectEntireAxis(extraplanarFocus);
1486
+ }
1487
+ }
1309
1488
  }
1310
1489
  if (event.metaKey || event.ctrlKey) {
1311
1490
  switch (event.key) {
@@ -1333,7 +1512,9 @@ var GridSheet = () => {
1333
1512
  }, [
1334
1513
  cursorFallbackRange,
1335
1514
  model,
1336
- cursor
1515
+ cursor,
1516
+ extraplanarFocus,
1517
+ selectEntireAxis
1337
1518
  ]);
1338
1519
  const contextMenuAnchorRef = (0, import_react4.useRef)(null);
1339
1520
  const [contextMenuOpen, setContextMenuOpen] = (0, import_react4.useState)(null);
@@ -1348,16 +1529,32 @@ var GridSheet = () => {
1348
1529
  }, []);
1349
1530
  const handleAxisMenuAction = (0, import_react4.useCallback)((operation) => {
1350
1531
  switch (operation) {
1351
- case "add-before":
1352
- case "add-after":
1353
- model[contextMenuAxis === "col" ? "insertColumns" : "insertRows"](contextMenuOpen[contextMenuAxis] + (operation === "add-before" ? 0 : 1), 1);
1532
+ case "insert-before":
1533
+ case "insert-after":
1534
+ return dispatch({
1535
+ action: import_chunk_AWKOWDMI.SheetAction.INSERT_AXIS,
1536
+ data: {
1537
+ model,
1538
+ axis: contextMenuAxis,
1539
+ index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
1540
+ }
1541
+ });
1354
1542
  break;
1355
- case "remove":
1543
+ case "drop":
1544
+ return dispatch({
1545
+ action: import_chunk_AWKOWDMI.SheetAction.DROP_AXIS,
1546
+ data: {
1547
+ model,
1548
+ axis: contextMenuAxis,
1549
+ axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
1550
+ }
1551
+ });
1356
1552
  }
1357
1553
  }, [
1358
1554
  contextMenuAxis,
1359
1555
  contextMenuOpen,
1360
- model
1556
+ model,
1557
+ dispatch
1361
1558
  ]);
1362
1559
  const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
1363
1560
  const extension = (0, import_react4.useMemo)(() => [
@@ -1397,8 +1594,8 @@ var GridSheet = () => {
1397
1594
  onBlur: handleBlur
1398
1595
  }), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_grid2.Grid.Content, {
1399
1596
  initialCells,
1400
- limitColumns: import_chunk_JF5XNTF3.DEFAULT_COLUMNS,
1401
- limitRows: import_chunk_JF5XNTF3.DEFAULT_ROWS,
1597
+ limitColumns: import_chunk_O7XR4R7Y.DEFAULT_COLUMNS,
1598
+ limitRows: import_chunk_O7XR4R7Y.DEFAULT_ROWS,
1402
1599
  columns,
1403
1600
  rows,
1404
1601
  onAxisResize: handleAxisResize,
@@ -1410,7 +1607,8 @@ var GridSheet = () => {
1410
1607
  onWheelCapture: handleWheel,
1411
1608
  onKeyDown: handleKeyDown,
1412
1609
  onContextMenu: handleContextMenu,
1413
- overscroll: "inline",
1610
+ onClick: handleClick,
1611
+ overscroll: "trap",
1414
1612
  className: "[--dx-grid-base:var(--surface-bg)]",
1415
1613
  activeRefs,
1416
1614
  ref: setDxGrid
@@ -1425,18 +1623,17 @@ var GridSheet = () => {
1425
1623
  sideOffset: 4,
1426
1624
  collisionPadding: 8
1427
1625
  }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Viewport, null, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
1428
- onClick: () => handleAxisMenuAction("add-before")
1626
+ onClick: () => handleAxisMenuAction("insert-before")
1429
1627
  }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
1430
1628
  size: 5,
1431
1629
  icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
1432
1630
  }), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
1433
- onClick: () => handleAxisMenuAction("add-after")
1631
+ onClick: () => handleAxisMenuAction("insert-after")
1434
1632
  }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
1435
1633
  size: 5,
1436
1634
  icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
1437
1635
  }), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui.DropdownMenu.Item, {
1438
- disabled: true,
1439
- onClick: () => handleAxisMenuAction("remove")
1636
+ onClick: () => handleAxisMenuAction("drop")
1440
1637
  }, /* @__PURE__ */ import_react4.default.createElement(import_react_ui.Icon, {
1441
1638
  size: 5,
1442
1639
  icon: "ph--backspace--regular"
@@ -1454,4 +1651,4 @@ var GridSheet = () => {
1454
1651
  useComputeGraph,
1455
1652
  useSheetContext
1456
1653
  });
1457
- //# sourceMappingURL=chunk-DEPJHN47.cjs.map
1654
+ //# sourceMappingURL=chunk-545PZPK3.cjs.map