@rowsncolumns/spreadsheet 10.19.1 → 10.19.3

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 (31) hide show
  1. package/dist/cjs/api/fill-series.d.ts +30 -8
  2. package/dist/cjs/api/fill-series.d.ts.map +1 -1
  3. package/dist/cjs/api/fill-series.js +136 -24
  4. package/dist/cjs/atoms/frozen-area-sent.atom.d.ts +13 -2
  5. package/dist/cjs/atoms/frozen-area-sent.atom.d.ts.map +1 -1
  6. package/dist/cjs/atoms/frozen-area-sent.atom.js +21 -2
  7. package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
  8. package/dist/cjs/components/canvas-grid/index.js +148 -67
  9. package/dist/cjs/components/fill-series-dialog/index.d.ts +3 -3
  10. package/dist/cjs/components/fill-series-dialog/index.d.ts.map +1 -1
  11. package/dist/cjs/components/fill-series-dialog/index.js +15 -10
  12. package/dist/cjs/hooks/use-editable.d.ts +8 -1
  13. package/dist/cjs/hooks/use-editable.d.ts.map +1 -1
  14. package/dist/cjs/hooks/use-editable.js +12 -10
  15. package/dist/cjs/release-date.js +1 -1
  16. package/dist/esm/api/fill-series.d.ts +30 -8
  17. package/dist/esm/api/fill-series.d.ts.map +1 -1
  18. package/dist/esm/api/fill-series.js +133 -23
  19. package/dist/esm/atoms/frozen-area-sent.atom.d.ts +13 -2
  20. package/dist/esm/atoms/frozen-area-sent.atom.d.ts.map +1 -1
  21. package/dist/esm/atoms/frozen-area-sent.atom.js +24 -2
  22. package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
  23. package/dist/esm/components/canvas-grid/index.js +112 -36
  24. package/dist/esm/components/fill-series-dialog/index.d.ts +3 -3
  25. package/dist/esm/components/fill-series-dialog/index.d.ts.map +1 -1
  26. package/dist/esm/components/fill-series-dialog/index.js +15 -10
  27. package/dist/esm/hooks/use-editable.d.ts +8 -1
  28. package/dist/esm/hooks/use-editable.d.ts.map +1 -1
  29. package/dist/esm/hooks/use-editable.js +7 -5
  30. package/dist/esm/release-date.js +1 -1
  31. package/package.json +1 -1
@@ -157,6 +157,8 @@ var VISUALLY_HIDDEN = {
157
157
  var defaultCellCoords = { rowIndex: 1, columnIndex: 1 };
158
158
  /** The grey of Excel's Flash Fill suggestion while typing. */
159
159
  var FLASH_FILL_SUGGESTION_COLOR = "#a6a6a6";
160
+ /** No sheet has a range picked for the formula being entered. */
161
+ var NO_FORMULA_PICKS = new Map();
160
162
  /**
161
163
  * Whether a registered editor's DOM has been removed: an input that unmounted while focused
162
164
  * gets no blur from Chromium, so its `activeEditor` registration can outlive it. Such an editor
@@ -170,6 +172,11 @@ function isDetachedEditor(editor) {
170
172
  }
171
173
  /** An empty object list, stable across renders ("For objects, show: none"). */
172
174
  var EMPTY_OBJECTS = [];
175
+ /** One cell (the Series dialog treats it as Excel does: Rows by default, and it stays selected). */
176
+ var isSingleCellRange = function (range) {
177
+ return range.startRowIndex === range.endRowIndex &&
178
+ range.startColumnIndex === range.endColumnIndex;
179
+ };
173
180
  /** "For objects, show: placeholders": an object's frame drawn with nothing in it. */
174
181
  var getObjectPlaceholder = function () { return (react_1.default.createElement("div", { "data-testid": "object-placeholder", "aria-hidden": "true", className: "w-full h-full bg-rnc-muted/40 border border-dashed border-rnc-border" })); };
175
182
  function CanvasGridComponent(props, forwardedRef) {
@@ -1034,7 +1041,14 @@ function CanvasGridComponent(props, forwardedRef) {
1034
1041
  // A freeze / unfreeze this window sent outside the grid's own menu (a host ribbon through the
1035
1042
  // engine hook, or a host calling `useNoteFrozenAreaSent`), counted, with the area it asked for.
1036
1043
  var frozenAreaSent = (0, frozen_area_sent_atom_1.useFrozenAreaSentValue)();
1037
- var seenFrozenAreaRef = (0, react_1.useRef)(frozenAreaSent === null || frozenAreaSent === void 0 ? void 0 : frozenAreaSent.seq);
1044
+ // Each axis's mark is consumed once, by the count it was noted at (a mark noted before the
1045
+ // other axis's in the same act keeps its own count, rowsncolumns/spreadsheet#1769).
1046
+ var axisSeq = function (axis) {
1047
+ var _a;
1048
+ var mark = frozenAreaSent === null || frozenAreaSent === void 0 ? void 0 : frozenAreaSent[axis];
1049
+ return mark ? ((_a = mark.seq) !== null && _a !== void 0 ? _a : frozenAreaSent === null || frozenAreaSent === void 0 ? void 0 : frozenAreaSent.seq) : undefined;
1050
+ };
1051
+ var seenFrozenAreaRef = (0, react_1.useRef)({ rows: axisSeq("rows"), columns: axisSeq("columns") });
1038
1052
  var freezeRowsUpTo = (0, react_1.useCallback)(function (freezeSheetId, rowIndex) {
1039
1053
  var _a, _b;
1040
1054
  if (!onFreezeRow)
@@ -1131,15 +1145,11 @@ function CanvasGridComponent(props, forwardedRef) {
1131
1145
  var historyKind = undoRedoSent && undoRedoSent.seq !== seenUndoRedoRef.current ? undoRedoSent.kind : undefined;
1132
1146
  // A freeze this window sent through the engine hook (a ribbon) that the grid has not seen: what it
1133
1147
  // asked for, per axis, in the grid's terms. One that asks for the area already there leaves no mark.
1134
- var sentFreeze = frozenAreaSent &&
1135
- frozenAreaSent.seq !== seenFrozenAreaRef.current &&
1136
- frozenAreaSent.sheetId === sheetId
1137
- ? frozenAreaSent
1138
- : undefined;
1148
+ var sentFreeze = frozenAreaSent && frozenAreaSent.sheetId === sheetId ? frozenAreaSent : undefined;
1139
1149
  var freezeSentOn = function (axis) {
1140
1150
  var _a, _b, _c;
1141
1151
  var asked = sentFreeze === null || sentFreeze === void 0 ? void 0 : sentFreeze[axis];
1142
- if (!asked)
1152
+ if (!asked || axisSeq(axis) === seenFrozenAreaRef.current[axis])
1143
1153
  return undefined;
1144
1154
  var was = axis === "rows"
1145
1155
  ? { lines: previous.rows, count: previous.rowCount }
@@ -1211,7 +1221,7 @@ function CanvasGridComponent(props, forwardedRef) {
1211
1221
  (0, use_isomorphic_layout_effect_1.useIsomorphicLayoutEffect)(function () {
1212
1222
  pendingFreezeRef.current = {};
1213
1223
  seenUndoRedoRef.current = undoRedoSent === null || undoRedoSent === void 0 ? void 0 : undoRedoSent.seq;
1214
- seenFrozenAreaRef.current = frozenAreaSent === null || frozenAreaSent === void 0 ? void 0 : frozenAreaSent.seq;
1224
+ seenFrozenAreaRef.current = { rows: axisSeq("rows"), columns: axisSeq("columns") };
1215
1225
  });
1216
1226
  /**
1217
1227
  * Get cell coordinates from x and y position
@@ -3102,11 +3112,41 @@ function CanvasGridComponent(props, forwardedRef) {
3102
3112
  showNotes: showNotes,
3103
3113
  isNoteShown: showAllNotes ? use_shown_notes_1.alwaysTrue : isNoteVisible,
3104
3114
  });
3115
+ /**
3116
+ * What each sheet had selected before the first range was picked on it for
3117
+ * the formula being entered in a cell. A picked range (pointer or arrow
3118
+ * keys) lives in the sheet's own selection until the entry ends: appended
3119
+ * after it, or in its place (a heading click, Shift+Arrow as the first pick,
3120
+ * a pick that replaces a typed reference, a table's edge). A sheet with no
3121
+ * pick has no entry here, and a reference that was typed adds none.
3122
+ */
3123
+ var _100 = tslib_1.__read((0, react_1.useState)(NO_FORMULA_PICKS), 2), selectionsBeforeFormulaPicks = _100[0], setSelectionsBeforeFormulaPicks = _100[1];
3124
+ var isPickingForCellEntry = formulaMode && canSelectCells && editingCellCoordinate !== undefined;
3125
+ // Every selection a gesture on the grid writes goes to the host through
3126
+ // here (cells, headings, table edges, a drawn selection or its title), so
3127
+ // the first one made while an entry is taking picks records what it found.
3128
+ var onChangeSelectionsFromGrid = (0, use_callback_ref_1.useCallbackRef)((0, react_1.useCallback)(function (changedSheetId, nextSelections, finishedSelection) {
3129
+ if (isPickingForCellEntry) {
3130
+ setSelectionsBeforeFormulaPicks(function (before) {
3131
+ return before.has(changedSheetId)
3132
+ ? before
3133
+ : new Map(before).set(changedSheetId, selections);
3134
+ });
3135
+ }
3136
+ onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(changedSheetId, nextSelections, finishedSelection);
3137
+ }, [isPickingForCellEntry, selections, onChangeSelections]));
3138
+ // A formula that stops being one (deleted mid-edit, a range input that lost
3139
+ // focus) ends without a commit or a cancel: nothing is left to put back.
3140
+ (0, use_isomorphic_layout_effect_1.useIsomorphicLayoutEffect)(function () {
3141
+ if (!formulaMode) {
3142
+ setSelectionsBeforeFormulaPicks(NO_FORMULA_PICKS);
3143
+ }
3144
+ }, [formulaMode]);
3105
3145
  /**
3106
3146
  * Selection change handler
3107
3147
  */
3108
3148
  var onSelectionChange = (0, use_selection_change_1.useSelectionChange)({
3109
- onChangeSelections: onChangeSelections,
3149
+ onChangeSelections: onChangeSelectionsFromGrid,
3110
3150
  getSheetName: getSheetName,
3111
3151
  sheetId: sheetId,
3112
3152
  });
@@ -3487,18 +3527,35 @@ function CanvasGridComponent(props, forwardedRef) {
3487
3527
  * in Columns) / first column (Rows) is the seed line; `stop` may shrink or
3488
3528
  * extend the target along the axis from the seed's last value.
3489
3529
  */
3490
- var applyFillSeriesSpec = (0, react_1.useCallback)(function (fillSheetId, cell, target, spec) {
3530
+ var applyFillSeriesSpec = (0, react_1.useCallback)(function (fillSheetId, cell, target, spec, date1904) {
3491
3531
  var seed = (0, fill_series_1.seedRangeForSeriesSpec)(target.range, spec);
3492
3532
  var fillRange = (0, fill_series_1.fillRangeForSeriesSpec)({
3493
3533
  target: target.range,
3494
3534
  seed: seed,
3495
3535
  spec: spec,
3536
+ // A line the engine runs as this series (rnc-store `fill_val_of` / `fill_seed_vals` /
3537
+ // `series_spec_values`): a seed that is not a formula (a formula seed is copied down
3538
+ // instead) with a number, and for a Date series a date-, date-time- or time-formatted
3539
+ // one. The cell readers answer an ExtendedValue (`{ nv }`), never a bare number.
3496
3540
  getSeedValue: function (r, c) {
3497
- var value = getEffectiveValue(fillSheetId, r, c);
3498
- return typeof value === "number" ? value : undefined;
3541
+ var _a, _b, _c, _d;
3542
+ if (getFormulaValue(fillSheetId, r, c) !== undefined)
3543
+ return undefined;
3544
+ var value = (0, helpers_1.getExtendedValueNumber)(getEffectiveValue(fillSheetId, r, c));
3545
+ if (value === undefined || spec.type !== "date")
3546
+ return value;
3547
+ var format = getCellFormat(fillSheetId, r, c);
3548
+ var userFormat = (_a = getCellData === null || getCellData === void 0 ? void 0 : getCellData(fillSheetId, r, c)) === null || _a === void 0 ? void 0 : _a.userEnteredFormat;
3549
+ var type = (_c = (format && "numberFormat" in format ? (_b = format.numberFormat) === null || _b === void 0 ? void 0 : _b.type : undefined)) !== null && _c !== void 0 ? _c : (userFormat && "numberFormat" in userFormat
3550
+ ? (_d = userFormat.numberFormat) === null || _d === void 0 ? void 0 : _d.type
3551
+ : undefined);
3552
+ return type === "DATE" || type === "DATE_TIME" || type === "TIME" ? value : undefined;
3499
3553
  },
3500
- rowCount: rowCount,
3501
- columnCount: columnCount,
3554
+ // Bounded by the sheet, not by the drawn extent (a host may draw 1,000 rows that grow with
3555
+ // the data): rows and columns start at index 1, so the last index is the maximum itself.
3556
+ rowCount: config_1.MAX_ROW_COUNT + 1,
3557
+ columnCount: config_1.MAX_COLUMN_COUNT + 1,
3558
+ date1904: date1904,
3502
3559
  });
3503
3560
  if (!fillRange)
3504
3561
  return;
@@ -3518,25 +3575,41 @@ function CanvasGridComponent(props, forwardedRef) {
3518
3575
  : "FillDays"
3519
3576
  : undefined;
3520
3577
  onFill === null || onFill === void 0 ? void 0 : onFill(fillSheetId, cell, { range: fillRange }, [tslib_1.__assign(tslib_1.__assign({}, target), { range: seed })], undefined, fillType, { series: spec });
3521
- onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(fillSheetId, [tslib_1.__assign(tslib_1.__assign({}, target), { range: fillRange })]);
3522
- }, [getEffectiveValue, onFill, onChangeSelections, rowCount, columnCount]);
3578
+ // Excel leaves a seed-only selection (one cell, or one line across the axis) selected after
3579
+ // it runs the series from it to the Stop.
3580
+ var seedOnly = seed.endRowIndex === target.range.endRowIndex &&
3581
+ seed.endColumnIndex === target.range.endColumnIndex;
3582
+ if (!seedOnly) {
3583
+ onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(fillSheetId, [tslib_1.__assign(tslib_1.__assign({}, target), { range: fillRange })]);
3584
+ }
3585
+ }, [
3586
+ getEffectiveValue,
3587
+ getFormulaValue,
3588
+ getCellFormat,
3589
+ getCellData,
3590
+ onFill,
3591
+ onChangeSelections,
3592
+ ]);
3523
3593
  /** Open the Series dialog for a range (the current selection by default). */
3524
3594
  var openFillSeriesDialogFor = (0, react_1.useCallback)(function (target, initialIn) {
3525
3595
  var _a, _b;
3526
3596
  var selection = (_a = target !== null && target !== void 0 ? target : selections[selections.length - 1]) !== null && _a !== void 0 ? _a : {
3527
3597
  range: (0, grid_1.cellToArea)(activeCell),
3528
3598
  };
3599
+ // Asked once, as the dialog opens (the rnc engine reads it through a formula preview); the
3600
+ // typed Stop and the count to it both use it.
3601
+ var date1904 = (_b = getDate1904 === null || getDate1904 === void 0 ? void 0 : getDate1904()) !== null && _b !== void 0 ? _b : false;
3529
3602
  openFillSeriesDialog({
3530
3603
  sheetId: sheetId,
3531
3604
  activeCell: activeCell,
3532
3605
  selection: selection,
3533
- initialIn: initialIn,
3606
+ // Excel opens on Rows for a single cell; a range keeps the dialog's default.
3607
+ initialIn: initialIn !== null && initialIn !== void 0 ? initialIn : (isSingleCellRange(selection.range) ? "rows" : undefined),
3534
3608
  onApply: function (spec) {
3535
- return applyFillSeriesSpec(sheetId, activeCell, selection, spec);
3609
+ return applyFillSeriesSpec(sheetId, activeCell, selection, spec, date1904);
3536
3610
  },
3537
3611
  locale: locale,
3538
- // Asked once, as the dialog opens (the rnc engine reads it through a formula preview).
3539
- date1904: (_b = getDate1904 === null || getDate1904 === void 0 ? void 0 : getDate1904()) !== null && _b !== void 0 ? _b : false,
3612
+ date1904: date1904,
3540
3613
  parseStop: parseCellEntryNumber,
3541
3614
  });
3542
3615
  }, [
@@ -3618,7 +3691,7 @@ function CanvasGridComponent(props, forwardedRef) {
3618
3691
  /**
3619
3692
  * Handle grid selections
3620
3693
  */
3621
- var _100 = (0, use_selection_1.useSelection)({
3694
+ var _101 = (0, use_selection_1.useSelection)({
3622
3695
  sheetId: sheetId,
3623
3696
  merges: merges !== null && merges !== void 0 ? merges : config_1.DEFAULT_ARRAY,
3624
3697
  getDataRowCount: getDataRowCount,
@@ -3673,11 +3746,11 @@ function CanvasGridComponent(props, forwardedRef) {
3673
3746
  onInsertTableRow: onInsertTableRow,
3674
3747
  isRangeSelectable: getSheetProtection ? isRangeSelectable : undefined,
3675
3748
  rightToLeft: rightToLeft,
3676
- }), onMouseDownSelection = _100.onMouseDown, onPointerDownSelection = _100.onPointerDown, onKeyDownSelection = _100.onKeyDown, fillSelection = _100.fillSelection, fillShrink = _100.fillShrink, onFillHandleMouseDown = _100.onFillHandleMouseDown, onFillHandleDoubleClick = _100.onFillHandleDoubleClick, isDragging = _100.isDragging, isDragCopy = _100.isDragCopy, isFilling = _100.isFilling, isSelectionInProgress = _100.isSelectionInProgress, draggedSelection = _100.draggedSelection, onSelectionMouseDown = _100.onSelectionMouseDown, setActiveCell = _100.setActiveCell, initialDraggedSelection = _100.initialDraggedSelection, updateSelectionStartEndReference = _100.updateSelectionStartEndReference, selectColumn = _100.selectColumn, getContentfulGridRangeAroundCell = _100.getContentfulGridRangeAroundCell, newSelection = _100.newSelection, modifySelection = _100.modifySelection, clearSelections = _100.clearSelections;
3749
+ }), onMouseDownSelection = _101.onMouseDown, onPointerDownSelection = _101.onPointerDown, onKeyDownSelection = _101.onKeyDown, fillSelection = _101.fillSelection, fillShrink = _101.fillShrink, onFillHandleMouseDown = _101.onFillHandleMouseDown, onFillHandleDoubleClick = _101.onFillHandleDoubleClick, isDragging = _101.isDragging, isDragCopy = _101.isDragCopy, isFilling = _101.isFilling, isSelectionInProgress = _101.isSelectionInProgress, draggedSelection = _101.draggedSelection, onSelectionMouseDown = _101.onSelectionMouseDown, setActiveCell = _101.setActiveCell, initialDraggedSelection = _101.initialDraggedSelection, updateSelectionStartEndReference = _101.updateSelectionStartEndReference, selectColumn = _101.selectColumn, getContentfulGridRangeAroundCell = _101.getContentfulGridRangeAroundCell, newSelection = _101.newSelection, modifySelection = _101.modifySelection, clearSelections = _101.clearSelections;
3677
3750
  /**
3678
3751
  * Copy, Paste and Cut hook
3679
3752
  */
3680
- var _101 = (0, use_copy_paste_cut_1.useCopyPasteCut)({
3753
+ var _102 = (0, use_copy_paste_cut_1.useCopyPasteCut)({
3681
3754
  activeCell: activeCell,
3682
3755
  selections: selections,
3683
3756
  sheetId: sheetId,
@@ -3687,7 +3760,7 @@ function CanvasGridComponent(props, forwardedRef) {
3687
3760
  onCopy: onCopy,
3688
3761
  onCut: onCut,
3689
3762
  onReapplyPaste: onReapplyPaste,
3690
- }), copiedSelections = _101.copiedSelections, isCutPending = _101.isCutPending, copiedSheetId = _101.copiedSheetId, cancelCut = _101.cancelCut, clearCopiedSelections = _101.clearCopiedSelections, copy = _101.copy, cut = _101.cut, paste = _101.paste, onInternalCopy = _101.onInternalCopy, onInternalCut = _101.onInternalCut, onInternalPaste = _101.onInternalPaste, choosePasteOption = _101.choosePasteOption;
3763
+ }), copiedSelections = _102.copiedSelections, isCutPending = _102.isCutPending, copiedSheetId = _102.copiedSheetId, cancelCut = _102.cancelCut, clearCopiedSelections = _102.clearCopiedSelections, copy = _102.copy, cut = _102.cut, paste = _102.paste, onInternalCopy = _102.onInternalCopy, onInternalCut = _102.onInternalCut, onInternalPaste = _102.onInternalPaste, choosePasteOption = _102.choosePasteOption;
3691
3764
  /**
3692
3765
  * Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D on a selected chart. The focused chart is
3693
3766
  * the target of those events (see `EmbedDraggable`); a paste that lands in the
@@ -3885,21 +3958,20 @@ function CanvasGridComponent(props, forwardedRef) {
3885
3958
  }, [onRequestGoTo, isGoToDialogMounted]);
3886
3959
  /**
3887
3960
  * After formula mode
3888
- * Recover old selections
3961
+ * Recover old selections: every sheet a range was picked on for the formula
3962
+ * gets back what it had selected before the first pick. A sheet nothing was
3963
+ * picked on keeps its selection as it is, whatever references the formula
3964
+ * holds (Excel keeps the selected range through Enter and Escape).
3889
3965
  */
3890
3966
  var restoreSelections = (0, use_callback_ref_1.useCallbackRef)((0, react_1.useCallback)(function () {
3891
- if (!formulaMode || !formulaSelections.length) {
3967
+ if (!selectionsBeforeFormulaPicks.size) {
3892
3968
  return;
3893
3969
  }
3894
- var len = selections.length - formulaSelections.length;
3895
- onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(sheetId, selections.filter(function (_, i) { return i < len; }));
3896
- }, [
3897
- sheetId,
3898
- selections,
3899
- formulaMode,
3900
- formulaSelections,
3901
- onChangeSelections,
3902
- ]));
3970
+ selectionsBeforeFormulaPicks.forEach(function (before, pickedSheetId) {
3971
+ onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(pickedSheetId, before);
3972
+ });
3973
+ setSelectionsBeforeFormulaPicks(NO_FORMULA_PICKS);
3974
+ }, [selectionsBeforeFormulaPicks, onChangeSelections]));
3903
3975
  /**
3904
3976
  * Callback when editor value changes
3905
3977
  */
@@ -4119,10 +4191,10 @@ function CanvasGridComponent(props, forwardedRef) {
4119
4191
  */
4120
4192
  var selectRangeFromMenu = (0, react_1.useCallback)(function (targetSheetId, range) {
4121
4193
  setActiveCell(targetSheetId, { rowIndex: range.startRowIndex, columnIndex: range.startColumnIndex }, false);
4122
- onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(targetSheetId, [{ range: range }]);
4123
- }, [setActiveCell, onChangeSelections]);
4194
+ onChangeSelectionsFromGrid(targetSheetId, [{ range: range }]);
4195
+ }, [setActiveCell, onChangeSelectionsFromGrid]);
4124
4196
  // Excel's table hit zones (header top edge / corner / row left edge).
4125
- var _102 = (0, use_table_hit_zones_1.useTableHitZones)({
4197
+ var _103 = (0, use_table_hit_zones_1.useTableHitZones)({
4126
4198
  sheetId: sheetId,
4127
4199
  tables: activeTables,
4128
4200
  selections: selections,
@@ -4133,7 +4205,7 @@ function CanvasGridComponent(props, forwardedRef) {
4133
4205
  getCellOffsetFromCoords: getCellOffsetFromCoords,
4134
4206
  getScrollPosition: getScrollPosition,
4135
4207
  onSelectRange: selectRangeFromMenu,
4136
- }), tableHitCursor = _102.cursor, onMouseMoveTableHitZones = _102.onMouseMove, onMouseDownTableHitZones = _102.onMouseDown, clearTableHitZone = _102.clearHitZone;
4208
+ }), tableHitCursor = _103.cursor, onMouseMoveTableHitZones = _103.onMouseMove, onMouseDownTableHitZones = _103.onMouseDown, clearTableHitZone = _103.clearHitZone;
4137
4209
  /**
4138
4210
  * Get context Menu component
4139
4211
  */
@@ -4238,7 +4310,7 @@ function CanvasGridComponent(props, forwardedRef) {
4238
4310
  * Displays Context menu when user right clicks
4239
4311
  * the grid
4240
4312
  */
4241
- var _103 = (0, use_context_menu_1.useContextMenu)({
4313
+ var _104 = (0, use_context_menu_1.useContextMenu)({
4242
4314
  getCellCoordsFromOffset: getCellCoordsFromOffset,
4243
4315
  getRelativePositionFromOffset: getRelativePositionFromOffset,
4244
4316
  isRowHeader: isRowHeader,
@@ -4248,7 +4320,7 @@ function CanvasGridComponent(props, forwardedRef) {
4248
4320
  getScrollPosition: getScrollPosition,
4249
4321
  ContextMenuWrapper: ContextMenuWrapper,
4250
4322
  toPhysicalX: rightToLeft ? function (x) { return (0, grid_1.mirrorPointX)(x, width); } : undefined,
4251
- }), onContextMenu = _103.onContextMenu, contextMenuComponent = _103.contextMenuComponent, onRequestCloseContextMenu = _103.onRequestClose, showContextMenu = _103.showContextMenu;
4323
+ }), onContextMenu = _104.onContextMenu, contextMenuComponent = _104.contextMenuComponent, onRequestCloseContextMenu = _104.onRequestClose, showContextMenu = _104.showContextMenu;
4252
4324
  /**
4253
4325
  * Shortcut handlers for formatting
4254
4326
  * TODO: Decide on the output
@@ -4377,7 +4449,7 @@ function CanvasGridComponent(props, forwardedRef) {
4377
4449
  /**
4378
4450
  * Allow grid to be ediable
4379
4451
  */
4380
- var _104 = (0, use_editable_1.useEditable)({
4452
+ var _105 = (0, use_editable_1.useEditable)({
4381
4453
  sheetId: sheetId,
4382
4454
  enableEditOnEnterKey: enableEditOnEnterKey,
4383
4455
  keymap: keymap,
@@ -4397,6 +4469,9 @@ function CanvasGridComponent(props, forwardedRef) {
4397
4469
  frozenRows: frozenRows,
4398
4470
  activeCell: activeCell,
4399
4471
  selections: selections,
4472
+ // The commit key moves the active cell inside the sheet's own selection,
4473
+ // never inside a range picked for the formula being entered.
4474
+ navigationSelections: selectionsBeforeFormulaPicks.get(sheetId),
4400
4475
  getSheetColumnCount: getSheetColumnCount,
4401
4476
  getSheetRowCount: getSheetRowCount,
4402
4477
  getValue: getEditorDisplayValue,
@@ -4433,7 +4508,7 @@ function CanvasGridComponent(props, forwardedRef) {
4433
4508
  onCut: handleEditorCut,
4434
4509
  tables: tables,
4435
4510
  onInsertTableRow: onInsertTableRow,
4436
- }), onMouseDownEditable = _104.onMouseDown, onDoubleClickEditable = _104.onDoubleClick, editorComponent = _104.editorComponent, isEditInProgress = _104.isEditInProgress, makeEditable = _104.makeEditable, editCell = _104.editCell, setEditorValue = _104.setEditorValue, hideEditor = _104.hideEditor, getNextFocusableCell = _104.getNextFocusableCell, submitEditor = _104.submitEditor, cancelEditor = _104.cancelEditor, commit = _104.commit, onKeyDownEditable = _104.onKeyDown;
4511
+ }), onMouseDownEditable = _105.onMouseDown, onDoubleClickEditable = _105.onDoubleClick, editorComponent = _105.editorComponent, isEditInProgress = _105.isEditInProgress, makeEditable = _105.makeEditable, editCell = _105.editCell, setEditorValue = _105.setEditorValue, hideEditor = _105.hideEditor, getNextFocusableCell = _105.getNextFocusableCell, submitEditor = _105.submitEditor, cancelEditor = _105.cancelEditor, commit = _105.commit, onKeyDownEditable = _105.onKeyDown;
4437
4512
  // A typed entry Excel's limits refused reopens the editor with its text (#49969 FX-18).
4438
4513
  // `makeEditable`, not `editCell`: the submit has just closed the editor, and `editCell` would
4439
4514
  // still see this render's edit in progress and insert the text into the closed one.
@@ -4526,7 +4601,7 @@ function CanvasGridComponent(props, forwardedRef) {
4526
4601
  /**
4527
4602
  * Move rows and columns
4528
4603
  */
4529
- var _105 = (0, use_move_columns_rows_1.useMoveColumnsAndRows)({
4604
+ var _106 = (0, use_move_columns_rows_1.useMoveColumnsAndRows)({
4530
4605
  getCellOffsetFromCoords: getCellOffsetFromCoords,
4531
4606
  getCellCoordsFromOffset: getCellCoordsFromOffset,
4532
4607
  getRelativePositionFromOffset: getRelativePositionFromOffset,
@@ -4550,11 +4625,11 @@ function CanvasGridComponent(props, forwardedRef) {
4550
4625
  sheetId: sheetId,
4551
4626
  disabled: isRestricted,
4552
4627
  HeaderMoveDragComponent: HeaderMoveDragComponent,
4553
- }), draggableColumns = _105.draggableColumns, draggableRows = _105.draggableRows, isDraggingRowsAndColumns = _105.isDragging;
4628
+ }), draggableColumns = _106.draggableColumns, draggableRows = _106.draggableRows, isDraggingRowsAndColumns = _106.isDragging;
4554
4629
  /**
4555
4630
  * Header actions
4556
4631
  */
4557
- var _106 = (0, use_header_actions_1.useHeaderActions)({
4632
+ var _107 = (0, use_header_actions_1.useHeaderActions)({
4558
4633
  activeCell: isSelectionInProgress || isFilling || isDragging ? null : hoveredCell,
4559
4634
  getScrollPosition: getHeadingScrollPosition,
4560
4635
  getWindowScrollPosition: getScrollPosition,
@@ -4584,7 +4659,7 @@ function CanvasGridComponent(props, forwardedRef) {
4584
4659
  selectedRowHeaders: selectedRowHeaders,
4585
4660
  selectedColumnHeaders: selectedColumnHeaders,
4586
4661
  enableResizerOverflow: enableResizerOverflow,
4587
- }), headerMenuComponent = _106.headerMenuComponent, isHeaderMenuInFrozenColumn = _106.isHeaderMenuInFrozenColumn, headerResizer = _106.headerResizer, isDraggingHeader = _106.isDragging;
4662
+ }), headerMenuComponent = _107.headerMenuComponent, isHeaderMenuInFrozenColumn = _107.isHeaderMenuInFrozenColumn, headerResizer = _107.headerResizer, isDraggingHeader = _107.isDragging;
4588
4663
  /**
4589
4664
  * Close tooltip
4590
4665
  */
@@ -4631,7 +4706,7 @@ function CanvasGridComponent(props, forwardedRef) {
4631
4706
  /**
4632
4707
  * Show basicFilter panels
4633
4708
  */
4634
- var _107 = (0, use_filter_1.useFilter)({
4709
+ var _108 = (0, use_filter_1.useFilter)({
4635
4710
  sheetId: sheetId,
4636
4711
  scale: scale,
4637
4712
  theme: theme,
@@ -4656,9 +4731,9 @@ function CanvasGridComponent(props, forwardedRef) {
4656
4731
  // Live filter state so the open popup tracks Auto-apply spec changes.
4657
4732
  basicFilter: basicFilter,
4658
4733
  tables: activeTables,
4659
- }), showFilter = _107.showFilter, hideFilter = _107.hideFilter, filterComponent = _107.filterComponent;
4734
+ }), showFilter = _108.showFilter, hideFilter = _108.hideFilter, filterComponent = _108.filterComponent;
4660
4735
  // Table resize
4661
- var _108 = (0, use_table_resizer_1.useTableResizer)({
4736
+ var _109 = (0, use_table_resizer_1.useTableResizer)({
4662
4737
  sheetId: sheetId,
4663
4738
  tables: tables !== null && tables !== void 0 ? tables : undefined,
4664
4739
  theme: theme,
@@ -4669,7 +4744,7 @@ function CanvasGridComponent(props, forwardedRef) {
4669
4744
  scrollToCell: scrollToCell,
4670
4745
  onResizeTable: onResizeTable,
4671
4746
  focusSheet: focusSheet,
4672
- }), tableResizers = _108.tableResizers, isResizingTable = _108.isResizingTable;
4747
+ }), tableResizers = _109.tableResizers, isResizingTable = _109.isResizingTable;
4673
4748
  /**
4674
4749
  * Displays resizable/draggable charts
4675
4750
  */
@@ -4830,7 +4905,7 @@ function CanvasGridComponent(props, forwardedRef) {
4830
4905
  var shownCharts = (0, react_1.useMemo)(function () { return shownObjectsBelowFrozenStart(charts); }, [charts, shownObjectsBelowFrozenStart]);
4831
4906
  var shownEmbeds = (0, react_1.useMemo)(function () { return shownObjectsBelowFrozenStart(embeds); }, [embeds, shownObjectsBelowFrozenStart]);
4832
4907
  var shownSlicers = (0, react_1.useMemo)(function () { return shownObjectsBelowFrozenStart(slicers); }, [slicers, shownObjectsBelowFrozenStart]);
4833
- var _109 = (0, use_embeds_charts_1.useEmbedsCharts)({
4908
+ var _110 = (0, use_embeds_charts_1.useEmbedsCharts)({
4834
4909
  pageLayout: pageLayout,
4835
4910
  getLinkedPictureSource: getLinkedPictureSource,
4836
4911
  getSheetName: getSheetName,
@@ -4879,7 +4954,7 @@ function CanvasGridComponent(props, forwardedRef) {
4879
4954
  backgroundColor: cellBackgroundColor,
4880
4955
  disabled: isRestricted,
4881
4956
  readonly: readonly,
4882
- }), chartComponents = _109.chartComponents, embedComponents = _109.embedComponents, slicerComponents = _109.slicerComponents, embedContextMenuComponent = _109.contextMenuComponent, onMouseDownCharts = _109.onMouseDown, requestChartContextMenu = _109.requestChartContextMenu, selectAllObjectsUnstable = _109.selectAllObjects;
4957
+ }), chartComponents = _110.chartComponents, embedComponents = _110.embedComponents, slicerComponents = _110.slicerComponents, embedContextMenuComponent = _110.contextMenuComponent, onMouseDownCharts = _110.onMouseDown, requestChartContextMenu = _110.requestChartContextMenu, selectAllObjectsUnstable = _110.selectAllObjects;
4883
4958
  // Select Objects (Find & Select): stable identity for the imperative handle.
4884
4959
  var selectAllObjects = (0, use_callback_ref_1.useCallbackRef)(selectAllObjectsUnstable);
4885
4960
  /**
@@ -4956,7 +5031,7 @@ function CanvasGridComponent(props, forwardedRef) {
4956
5031
  * The totals-function picker a totals cell's in-cell arrow opens (Excel):
4957
5032
  * anchored at the cell's bottom-right corner like the filter dropdown.
4958
5033
  */
4959
- var _110 = tslib_1.__read((0, react_1.useState)(null), 2), totalsPicker = _110[0], setTotalsPicker = _110[1];
5034
+ var _111 = tslib_1.__read((0, react_1.useState)(null), 2), totalsPicker = _111[0], setTotalsPicker = _111[1];
4960
5035
  var closeTotalsPicker = (0, react_1.useCallback)(function () { return setTotalsPicker(null); }, []);
4961
5036
  var handleTotalsArrowClick = (0, react_1.useCallback)(function (cell) {
4962
5037
  var table = activeTables === null || activeTables === void 0 ? void 0 : activeTables.find(function (candidate) {
@@ -5394,7 +5469,7 @@ function CanvasGridComponent(props, forwardedRef) {
5394
5469
  /**
5395
5470
  * Render Cells in the grid
5396
5471
  */
5397
- var _111 = tslib_1.__read((0, use_cell_renderer_1.useCellRenderer)({
5472
+ var _112 = tslib_1.__read((0, use_cell_renderer_1.useCellRenderer)({
5398
5473
  sheetId: sheetId,
5399
5474
  isTableTotalsCell: isTableTotalsCell,
5400
5475
  onTotalsArrowClick: handleTotalsArrowClick,
@@ -5472,7 +5547,7 @@ function CanvasGridComponent(props, forwardedRef) {
5472
5547
  onOverflow: handleOverflow,
5473
5548
  isComparing: isComparing,
5474
5549
  getCellDiff: getCellDiff,
5475
- }), 5), cellBackgroundRenderer = _111[0], cellRenderer = _111[1], cellOverlayRenderer = _111[2], headerCellRenderer = _111[3], cellBackgroundsRenderer = _111[4];
5550
+ }), 5), cellBackgroundRenderer = _112[0], cellRenderer = _112[1], cellOverlayRenderer = _112[2], headerCellRenderer = _112[3], cellBackgroundsRenderer = _112[4];
5476
5551
  /**
5477
5552
  * When user selects a selection for moving
5478
5553
  * If its a table, we select the entire column
@@ -5492,14 +5567,20 @@ function CanvasGridComponent(props, forwardedRef) {
5492
5567
  range: tslib_1.__assign(tslib_1.__assign({}, table.range), { startColumnIndex: firstCell.columnIndex, endColumnIndex: Math.max(firstCell.columnIndex, (_a = selection === null || selection === void 0 ? void 0 : selection.range.endColumnIndex) !== null && _a !== void 0 ? _a : 0) }),
5493
5568
  };
5494
5569
  // Update column selection
5495
- onChangeSelections === null || onChangeSelections === void 0 ? void 0 : onChangeSelections(sheetId, [columnSelection]);
5570
+ onChangeSelectionsFromGrid(sheetId, [columnSelection]);
5496
5571
  // Pass column
5497
5572
  onSelectionMouseDown === null || onSelectionMouseDown === void 0 ? void 0 : onSelectionMouseDown(e, cell, columnSelection, index, shouldClamp);
5498
5573
  }
5499
5574
  else {
5500
5575
  onSelectionMouseDown === null || onSelectionMouseDown === void 0 ? void 0 : onSelectionMouseDown(e, cell, selection, index, shouldClamp);
5501
5576
  }
5502
- }, [onSelectionMouseDown, onChangeSelections, isTableHeader, tables, sheetId]);
5577
+ }, [
5578
+ onSelectionMouseDown,
5579
+ onChangeSelectionsFromGrid,
5580
+ isTableHeader,
5581
+ tables,
5582
+ sheetId,
5583
+ ]);
5503
5584
  // Selection resize
5504
5585
  var onMouseDownResizeHandle = (0, use_selection_resize_1.useSelectionResize)({
5505
5586
  getCellBounds: getCellBounds,
@@ -5508,16 +5589,16 @@ function CanvasGridComponent(props, forwardedRef) {
5508
5589
  tokenizer: localeTokenizer,
5509
5590
  });
5510
5591
  // Selection move: drag a formula reference via its border covers
5511
- var _112 = (0, use_selection_move_1.useSelectionMove)({
5592
+ var _113 = (0, use_selection_move_1.useSelectionMove)({
5512
5593
  getCellCoordsFromOffset: getCellCoordsFromOffset,
5513
5594
  scrollToCell: scrollToCell,
5514
5595
  tokenizer: localeTokenizer,
5515
- }), onMouseDownMoveSelection = _112.onMouseDownMoveSelection, isDraggingMoveSelection = _112.isDragging;
5596
+ }), onMouseDownMoveSelection = _113.onMouseDownMoveSelection, isDraggingMoveSelection = _113.isDragging;
5516
5597
  /**
5517
5598
  * Selected chart: outline its source ranges on this sheet and re-bind
5518
5599
  * them when a corner handle is dragged (Excel's chart data highlight).
5519
5600
  */
5520
- var _113 = (0, use_chart_source_ranges_1.useChartSourceRanges)({
5601
+ var _114 = (0, use_chart_source_ranges_1.useChartSourceRanges)({
5521
5602
  charts: charts,
5522
5603
  sheetId: sheetId,
5523
5604
  getSheetName: getSheetName,
@@ -5526,7 +5607,7 @@ function CanvasGridComponent(props, forwardedRef) {
5526
5607
  getCellBounds: getCellBounds,
5527
5608
  getCellCoordsFromOffset: getCellCoordsFromOffset,
5528
5609
  scrollToCell: scrollToCell,
5529
- }), chartSourceBorderStyles = _113.chartSourceBorderStyles, onMouseDownChartSourceResizeHandle = _113.onMouseDownChartSourceResizeHandle;
5610
+ }), chartSourceBorderStyles = _114.chartSourceBorderStyles, onMouseDownChartSourceResizeHandle = _114.onMouseDownChartSourceResizeHandle;
5530
5611
  /**
5531
5612
  * Hide fill handle
5532
5613
  * 1. When user is in edit mode
@@ -5542,9 +5623,9 @@ function CanvasGridComponent(props, forwardedRef) {
5542
5623
  /**
5543
5624
  * Flashing
5544
5625
  */
5545
- var _114 = (0, use_flash_1.useFlash)({
5626
+ var _115 = (0, use_flash_1.useFlash)({
5546
5627
  theme: theme,
5547
- }), flash = _114.flash, mark = _114.mark, unmark = _114.unmark, onFlashEnd = _114.onFlashEnd, flashingBorders = _114.flashingBorders;
5628
+ }), flash = _115.flash, mark = _115.mark, unmark = _115.unmark, onFlashEnd = _115.onFlashEnd, flashingBorders = _115.flashingBorders;
5548
5629
  // Cache hover ids
5549
5630
  var cachedHoveredSelectionIds = (0, use_hovered_selection_ids_1.useHoveredSelectionIds)({
5550
5631
  selections: selections,
@@ -5567,7 +5648,7 @@ function CanvasGridComponent(props, forwardedRef) {
5567
5648
  onMouseDownMoveSelection: onMouseDownMoveSelection,
5568
5649
  isDraggingMoveSelection: isDraggingMoveSelection,
5569
5650
  onChangeActiveCell: onChangeActiveCell,
5570
- onChangeSelections: onChangeSelections,
5651
+ onChangeSelections: onChangeSelectionsFromGrid,
5571
5652
  SelectionTitleComponent: SelectionTitleComponent,
5572
5653
  selectionCount: (formulaMode ? formulaSelections : selections).length,
5573
5654
  selectionBackgroundColor: selectionBackgroundColor,
@@ -5698,7 +5779,7 @@ function CanvasGridComponent(props, forwardedRef) {
5698
5779
  autoCorrectAnchorStyles,
5699
5780
  ]);
5700
5781
  // Hidden column markers
5701
- var _115 = tslib_1.__read((0, use_hidden_dimension_markers_1.useHiddenDimensionMarkers)({
5782
+ var _116 = tslib_1.__read((0, use_hidden_dimension_markers_1.useHiddenDimensionMarkers)({
5702
5783
  sheetId: sheetId,
5703
5784
  columnMetadata: columnMetadata,
5704
5785
  rowMetadata: rowMetadata,
@@ -5713,7 +5794,7 @@ function CanvasGridComponent(props, forwardedRef) {
5713
5794
  columnsAboveFrozenStart: columnsAboveFrozenStart,
5714
5795
  HiddenRowMarkers: HiddenRowMarkers,
5715
5796
  HiddenColumnMarkers: HiddenColumnMarkers,
5716
- }), 4), hiddenColumnMarkers = _115[0], frozenHiddenColumnMarkers = _115[1], hiddenRowMarkers = _115[2], frozenHiddenRowMarkers = _115[3];
5797
+ }), 4), hiddenColumnMarkers = _116[0], frozenHiddenColumnMarkers = _116[1], hiddenRowMarkers = _116[2], frozenHiddenRowMarkers = _116[3];
5717
5798
  // Zoom lister
5718
5799
  var onMouseWheel = (0, use_scale_listener_1.useScaleListener)({
5719
5800
  zoomSpeed: zoomSpeed,
@@ -20,9 +20,9 @@ export type FillSeriesDialogProps = {
20
20
  /**
21
21
  * Excel's Series dialog (Home > Fill > Series…). Series in Rows/Columns, Type
22
22
  * Linear/Growth/Date/AutoFill, Date unit (Type = Date only), Trend
23
- * (Linear/Growth only — disables Step/Stop), Step value (default 1, may be
24
- * negative or fractional) and Stop value. UI-only: the opener turns the spec
25
- * into a fill.
23
+ * (Linear/Growth only — disables Step/Stop and the Date / AutoFill types),
24
+ * Step value (default 1, may be negative or fractional) and Stop value (both
25
+ * disabled for AutoFill). UI-only: the opener turns the spec into a fill.
26
26
  */
27
27
  export declare const FillSeriesDialog: React.MemoExoticComponent<({ open, onOpenChange, initialIn, onApply, locale, date1904, parseStop, }: FillSeriesDialogProps) => React.JSX.Element>;
28
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/fill-series-dialog/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,oEAAoE;IACpE,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C,CAAC;AA0BF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,uGASxB,qBAAqB,uBAoNzB,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;CAgBhC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/fill-series-dialog/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,oEAAoE;IACpE,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C,CAAC;AA0BF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,uGASxB,qBAAqB,uBA+NzB,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;CAgBhC,CAAC"}
@@ -28,9 +28,9 @@ var parseNumber = function (text) {
28
28
  /**
29
29
  * Excel's Series dialog (Home > Fill > Series…). Series in Rows/Columns, Type
30
30
  * Linear/Growth/Date/AutoFill, Date unit (Type = Date only), Trend
31
- * (Linear/Growth only — disables Step/Stop), Step value (default 1, may be
32
- * negative or fractional) and Stop value. UI-only: the opener turns the spec
33
- * into a fill.
31
+ * (Linear/Growth only — disables Step/Stop and the Date / AutoFill types),
32
+ * Step value (default 1, may be negative or fractional) and Stop value (both
33
+ * disabled for AutoFill). UI-only: the opener turns the spec into a fill.
34
34
  */
35
35
  exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
36
36
  var open = _a.open, onOpenChange = _a.onOpenChange, initialIn = _a.initialIn, onApply = _a.onApply, locale = _a.locale, date1904 = _a.date1904, parseStop = _a.parseStop;
@@ -54,7 +54,9 @@ exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
54
54
  }
55
55
  }, [open, initialIn]);
56
56
  var trendAllowed = type === "linear" || type === "growth";
57
- var stepStopDisabled = trendAllowed && trend;
57
+ var trendOn = trendAllowed && trend;
58
+ // As in Excel: AutoFill has no Step or Stop, and Trend fits its own step and ignores the Stop.
59
+ var stepStopDisabled = type === "autofill" || trendOn;
58
60
  var apply = (0, react_1.useCallback)(function () {
59
61
  var stepValue = parseNumber(step);
60
62
  if (!stepStopDisabled && step.trim() && stepValue === undefined) {
@@ -72,7 +74,7 @@ exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
72
74
  setError("Stop value must be a number.");
73
75
  return;
74
76
  }
75
- var spec = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ in: axis, type: type }, (type === "date" ? { dateUnit: dateUnit } : {})), (trendAllowed && trend ? { trend: true } : {})), (!stepStopDisabled && stepValue !== undefined
77
+ var spec = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ in: axis, type: type }, (type === "date" ? { dateUnit: dateUnit } : {})), (trendOn ? { trend: true } : {})), (!stepStopDisabled && stepValue !== undefined
76
78
  ? { step: stepValue }
77
79
  : {})), (!stepStopDisabled && stopValue !== undefined
78
80
  ? { stop: stopValue }
@@ -83,8 +85,7 @@ exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
83
85
  axis,
84
86
  type,
85
87
  dateUnit,
86
- trend,
87
- trendAllowed,
88
+ trendOn,
88
89
  step,
89
90
  stop,
90
91
  stepStopDisabled,
@@ -114,8 +115,12 @@ exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
114
115
  SERIES_TYPES.map(function (_a) {
115
116
  var value = _a.value, label = _a.label;
116
117
  return (react_1.default.createElement("label", { key: value, className: "flex items-center gap-2 text-xs cursor-pointer" },
117
- react_1.default.createElement("input", { type: "radio", name: "fillSeriesType", value: value, checked: type === value, onChange: function () { return setType(value); } }),
118
- label));
118
+ react_1.default.createElement("input", { type: "radio", name: "fillSeriesType", value: value, checked: type === value, onChange: function () { return setType(value); },
119
+ // A trend is Linear or Growth only.
120
+ disabled: trendOn && (value === "date" || value === "autofill") }),
121
+ react_1.default.createElement("span", { className: trendOn && (value === "date" || value === "autofill")
122
+ ? "opacity-50"
123
+ : "" }, label)));
119
124
  })),
120
125
  react_1.default.createElement("fieldset", { className: "flex flex-col gap-1 border-0 p-0 m-0", disabled: type !== "date" },
121
126
  react_1.default.createElement("legend", { className: "text-xs font-medium pb-1" }, "Date unit"),
@@ -126,7 +131,7 @@ exports.FillSeriesDialog = (0, react_1.memo)(function (_a) {
126
131
  react_1.default.createElement("span", { className: type !== "date" ? "opacity-50" : "" }, label)));
127
132
  }))),
128
133
  react_1.default.createElement("label", { className: "flex items-center gap-2 text-xs cursor-pointer" },
129
- react_1.default.createElement("input", { type: "checkbox", name: "fillSeriesTrend", checked: trendAllowed && trend, disabled: !trendAllowed, onChange: function (e) { return setTrend(e.target.checked); } }),
134
+ react_1.default.createElement("input", { type: "checkbox", name: "fillSeriesTrend", checked: trendOn, disabled: !trendAllowed, onChange: function (e) { return setTrend(e.target.checked); } }),
130
135
  react_1.default.createElement("span", { className: !trendAllowed ? "opacity-50" : "" }, "Trend")),
131
136
  react_1.default.createElement("div", { className: "grid grid-cols-2 gap-3" },
132
137
  react_1.default.createElement("label", { className: "flex flex-col gap-1 text-xs" },