@rowsncolumns/spreadsheet 10.18.0 → 10.19.2
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/cjs/api/fill-series.d.ts +48 -8
- package/dist/cjs/api/fill-series.d.ts.map +1 -1
- package/dist/cjs/api/fill-series.js +231 -25
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/fill-series-dialog.atom.d.ts +6 -0
- package/dist/cjs/atoms/fill-series-dialog.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/frozen-area-sent.atom.d.ts +53 -0
- package/dist/cjs/atoms/frozen-area-sent.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/frozen-area-sent.atom.js +48 -0
- package/dist/cjs/atoms/index.d.ts +2 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +2 -0
- package/dist/cjs/atoms/undo-redo-sent.atom.d.ts +25 -0
- package/dist/cjs/atoms/undo-redo-sent.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/undo-redo-sent.atom.js +23 -0
- package/dist/cjs/components/canvas-grid/frozen-start.d.ts +25 -10
- package/dist/cjs/components/canvas-grid/frozen-start.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/frozen-start.js +25 -18
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +181 -33
- package/dist/cjs/components/canvas-grid/typings.d.ts +15 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/fill-series-dialog/index.d.ts +13 -4
- package/dist/cjs/components/fill-series-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/fill-series-dialog/index.js +29 -14
- package/dist/cjs/hooks/use-selection-interceptors.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-interceptors.js +9 -0
- package/dist/cjs/hooks/use-selection.d.ts +8 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +39 -9
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/api/fill-series.d.ts +48 -8
- package/dist/esm/api/fill-series.d.ts.map +1 -1
- package/dist/esm/api/fill-series.js +222 -23
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/fill-series-dialog.atom.d.ts +6 -0
- package/dist/esm/atoms/fill-series-dialog.atom.d.ts.map +1 -1
- package/dist/esm/atoms/frozen-area-sent.atom.d.ts +53 -0
- package/dist/esm/atoms/frozen-area-sent.atom.d.ts.map +1 -0
- package/dist/esm/atoms/frozen-area-sent.atom.js +43 -0
- package/dist/esm/atoms/index.d.ts +2 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +2 -0
- package/dist/esm/atoms/undo-redo-sent.atom.d.ts +25 -0
- package/dist/esm/atoms/undo-redo-sent.atom.d.ts.map +1 -0
- package/dist/esm/atoms/undo-redo-sent.atom.js +18 -0
- package/dist/esm/components/canvas-grid/frozen-start.d.ts +25 -10
- package/dist/esm/components/canvas-grid/frozen-start.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/frozen-start.js +25 -18
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +176 -31
- package/dist/esm/components/canvas-grid/typings.d.ts +15 -0
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/fill-series-dialog/index.d.ts +13 -4
- package/dist/esm/components/fill-series-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/fill-series-dialog/index.js +29 -14
- package/dist/esm/hooks/use-selection-interceptors.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-interceptors.js +10 -1
- package/dist/esm/hooks/use-selection.d.ts +8 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +35 -5
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AA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,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC"}
|
package/dist/esm/atoms/index.js
CHANGED
|
@@ -35,6 +35,8 @@ export * from "./insert-cells-dialog.atom";
|
|
|
35
35
|
export * from "./insert-options.atom";
|
|
36
36
|
export * from "./chart-actions.atom";
|
|
37
37
|
export * from "./table-auto-expansion.atom";
|
|
38
|
+
export * from "./undo-redo-sent.atom";
|
|
39
|
+
export * from "./frozen-area-sent.atom";
|
|
38
40
|
export * from "./flash-fill-options.atom";
|
|
39
41
|
export * from "./calculated-column-fill.atom";
|
|
40
42
|
export * from "./sparkline-dialog.atom";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The last undo / redo this window itself sent, counted. `CanvasGrid` reads it so that only this
|
|
3
|
+
* window's own undo or redo of its own Freeze Panes moves its view (a frozen start, demo-app-monorepo
|
|
4
|
+
* #57258 W-5); a change that arrives from another window never does.
|
|
5
|
+
*
|
|
6
|
+
* Set by the engines' undo / redo (`useSpreadsheetEngine`'s `onUndo` / `onRedo` / `undo` / `redo`) and
|
|
7
|
+
* by `CanvasGrid`'s own ⌘Z / ⇧⌘Z, so a host that calls those needs nothing more. A host that runs undo
|
|
8
|
+
* some other way (its own engine call) calls `useNoteUndoRedoSent()` right before it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const undoRedoSentAtom: import("jotai").PrimitiveAtom<{
|
|
11
|
+
kind: "undo" | "redo";
|
|
12
|
+
seq: number;
|
|
13
|
+
} | null> & {
|
|
14
|
+
init: {
|
|
15
|
+
kind: "undo" | "redo";
|
|
16
|
+
seq: number;
|
|
17
|
+
} | null;
|
|
18
|
+
};
|
|
19
|
+
export declare const useUndoRedoSentValue: () => {
|
|
20
|
+
kind: "undo" | "redo";
|
|
21
|
+
seq: number;
|
|
22
|
+
} | null;
|
|
23
|
+
/** Say "the next change is my own undo / redo" (see {@link undoRedoSentAtom}). */
|
|
24
|
+
export declare const useNoteUndoRedoSent: () => (kind: "undo" | "redo") => void;
|
|
25
|
+
//# sourceMappingURL=undo-redo-sent.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo-redo-sent.atom.d.ts","sourceRoot":"","sources":["../../../atoms/undo-redo-sent.atom.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;UAAgB,MAAM,GAAG,MAAM;SAAO,MAAM;;;cAA5B,MAAM,GAAG,MAAM;aAAO,MAAM;;CAAgB,CAAC;AAE1F,eAAO,MAAM,oBAAoB;UAFY,MAAM,GAAG,MAAM;SAAO,MAAM;QAED,CAAC;AAEzE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,eAGrB,MAAM,GAAG,MAAM,SAGzB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { atom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The last undo / redo this window itself sent, counted. `CanvasGrid` reads it so that only this
|
|
5
|
+
* window's own undo or redo of its own Freeze Panes moves its view (a frozen start, demo-app-monorepo
|
|
6
|
+
* #57258 W-5); a change that arrives from another window never does.
|
|
7
|
+
*
|
|
8
|
+
* Set by the engines' undo / redo (`useSpreadsheetEngine`'s `onUndo` / `onRedo` / `undo` / `redo`) and
|
|
9
|
+
* by `CanvasGrid`'s own ⌘Z / ⇧⌘Z, so a host that calls those needs nothing more. A host that runs undo
|
|
10
|
+
* some other way (its own engine call) calls `useNoteUndoRedoSent()` right before it.
|
|
11
|
+
*/
|
|
12
|
+
export const undoRedoSentAtom = atom(null);
|
|
13
|
+
export const useUndoRedoSentValue = () => useAtomValue(undoRedoSentAtom);
|
|
14
|
+
/** Say "the next change is my own undo / redo" (see {@link undoRedoSentAtom}). */
|
|
15
|
+
export const useNoteUndoRedoSent = () => {
|
|
16
|
+
const set = useSetAtom(undoRedoSentAtom);
|
|
17
|
+
return useCallback((kind) => set((previous) => ({ kind, seq: (previous?.seq ?? 0) + 1 })), [set]);
|
|
18
|
+
};
|
|
@@ -79,12 +79,21 @@ export type FrozenAxis = {
|
|
|
79
79
|
lines: number;
|
|
80
80
|
count: number;
|
|
81
81
|
};
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* What this window just sent that may change the frozen area: a freeze or unfreeze (with the area
|
|
84
|
+
* it asked for and where the view was), or an undo / redo. Read by the next change on the axis,
|
|
85
|
+
* whatever it turns out to be, and dropped then.
|
|
86
|
+
*/
|
|
83
87
|
export type PendingFreeze = {
|
|
88
|
+
kind: "freeze";
|
|
84
89
|
expected: FrozenAxis;
|
|
85
90
|
scrollBefore: number;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "undo";
|
|
93
|
+
} | {
|
|
94
|
+
kind: "redo";
|
|
86
95
|
};
|
|
87
|
-
/** The last freeze or unfreeze from a start this window made
|
|
96
|
+
/** The last freeze or unfreeze from a start this window made, while nothing else has changed the area. */
|
|
88
97
|
export type LocalFreeze = {
|
|
89
98
|
before: FrozenAxis;
|
|
90
99
|
after: FrozenAxis;
|
|
@@ -102,14 +111,20 @@ export type FrozenViewSnapshot = {
|
|
|
102
111
|
* (demo-app-monorepo#57258 W-5). `undefined` = leave the scroll position as it is (every change
|
|
103
112
|
* without a start, as before).
|
|
104
113
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
114
|
+
* The rule: **a window's view is repositioned only by a freeze, unfreeze, undo or redo that this
|
|
115
|
+
* window itself just sent, and by nothing else.** `pending` is what this window just sent; the change
|
|
116
|
+
* that follows reads it and drops it, matched or not.
|
|
117
|
+
*
|
|
118
|
+
* - **This window's freeze or unfreeze** (`pending.kind` "freeze", and the area is the one it asked
|
|
119
|
+
* for): freezing from a start puts the scrolling area right below the band (0); unfreezing keeps
|
|
120
|
+
* the start's line first on screen. Remembered as `local`, for this window's undo / redo of it.
|
|
121
|
+
* - **This window's undo** (`pending.kind` "undo", taking the area from `local.after` back to
|
|
122
|
+
* `local.before`): back where the view was before the freeze. Its **redo**: as the freeze did.
|
|
123
|
+
* - **Anything else** (another window's freeze, unfreeze, undo or redo, or a change that does not
|
|
124
|
+
* match what this window sent): the same line stays first on screen, at the same depth; the scroll
|
|
125
|
+
* moves by the band's change. When that line now lies in the band or above the start it cannot
|
|
126
|
+
* stay: the view lands on the first scrolling line (0). `local` is forgotten: a later change of the
|
|
127
|
+
* same shape is someone else's.
|
|
113
128
|
*
|
|
114
129
|
* `offset(index)` is a line's offset in the NEW layout; scroll positions are measured from the first
|
|
115
130
|
* scrolling line, as the grid's are.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frozen-start.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/frozen-start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,aAAa,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,WAAW,MAAM,KAChB,MAOF,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,EAAE,YAAY,MAAM,YACf,CAAC;AAEtD,uGAAuG;AACvG,eAAO,MAAM,wBAAwB,GACnC,MAAM,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAC/B,YAAY,MAAM,KACjB,CAAC,CAAC,KAAK,EAAE,M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AC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1F,2FAA2F;AAC3F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,GAAI,sDAO/B;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC,KAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAA;CAgC5D,CAAC"}
|
|
@@ -172,14 +172,20 @@ const sameAxis = (a, b) => a.lines === b.lines && a.count === b.count;
|
|
|
172
172
|
* (demo-app-monorepo#57258 W-5). `undefined` = leave the scroll position as it is (every change
|
|
173
173
|
* without a start, as before).
|
|
174
174
|
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
175
|
+
* The rule: **a window's view is repositioned only by a freeze, unfreeze, undo or redo that this
|
|
176
|
+
* window itself just sent, and by nothing else.** `pending` is what this window just sent; the change
|
|
177
|
+
* that follows reads it and drops it, matched or not.
|
|
178
|
+
*
|
|
179
|
+
* - **This window's freeze or unfreeze** (`pending.kind` "freeze", and the area is the one it asked
|
|
180
|
+
* for): freezing from a start puts the scrolling area right below the band (0); unfreezing keeps
|
|
181
|
+
* the start's line first on screen. Remembered as `local`, for this window's undo / redo of it.
|
|
182
|
+
* - **This window's undo** (`pending.kind` "undo", taking the area from `local.after` back to
|
|
183
|
+
* `local.before`): back where the view was before the freeze. Its **redo**: as the freeze did.
|
|
184
|
+
* - **Anything else** (another window's freeze, unfreeze, undo or redo, or a change that does not
|
|
185
|
+
* match what this window sent): the same line stays first on screen, at the same depth; the scroll
|
|
186
|
+
* moves by the band's change. When that line now lies in the band or above the start it cannot
|
|
187
|
+
* stay: the view lands on the first scrolling line (0). `local` is forgotten: a later change of the
|
|
188
|
+
* same shape is someone else's.
|
|
183
189
|
*
|
|
184
190
|
* `offset(index)` is a line's offset in the NEW layout; scroll positions are measured from the first
|
|
185
191
|
* scrolling line, as the grid's are.
|
|
@@ -197,26 +203,27 @@ export const frozenStartScroll = ({ before, after, pending, local, snapshot, off
|
|
|
197
203
|
}
|
|
198
204
|
return undefined;
|
|
199
205
|
};
|
|
200
|
-
|
|
206
|
+
const consumed = pending !== undefined;
|
|
207
|
+
if (pending?.kind === "freeze" && sameAxis(after, pending.expected)) {
|
|
201
208
|
return {
|
|
202
209
|
scroll: asSent(),
|
|
203
|
-
consumed
|
|
210
|
+
consumed,
|
|
204
211
|
local: withStart ? { before, after, scrollBefore: pending.scrollBefore } : undefined,
|
|
205
212
|
};
|
|
206
213
|
}
|
|
207
|
-
if (local && sameAxis(before, local.after) && sameAxis(after, local.before)) {
|
|
208
|
-
return { scroll: local.scrollBefore, consumed
|
|
214
|
+
if (pending?.kind === "undo" && local && sameAxis(before, local.after) && sameAxis(after, local.before)) {
|
|
215
|
+
return { scroll: local.scrollBefore, consumed, local };
|
|
209
216
|
}
|
|
210
|
-
if (local && sameAxis(before, local.before) && sameAxis(after, local.after)) {
|
|
211
|
-
return { scroll: asSent(), consumed
|
|
217
|
+
if (pending?.kind === "redo" && local && sameAxis(before, local.before) && sameAxis(after, local.after)) {
|
|
218
|
+
return { scroll: asSent(), consumed, local };
|
|
212
219
|
}
|
|
213
220
|
if (!withStart || !snapshot)
|
|
214
|
-
return { consumed
|
|
221
|
+
return { consumed, local: undefined };
|
|
215
222
|
if (snapshot.topLine < firstScrolling)
|
|
216
|
-
return { scroll: 0, consumed
|
|
223
|
+
return { scroll: 0, consumed, local: undefined };
|
|
217
224
|
return {
|
|
218
225
|
scroll: Math.max(0, offset(snapshot.topLine) + snapshot.intoLine - offset(firstScrolling)),
|
|
219
|
-
consumed
|
|
220
|
-
local,
|
|
226
|
+
consumed,
|
|
227
|
+
local: undefined,
|
|
221
228
|
};
|
|
222
229
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAqEA,OAAO,KASN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAqEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuRf,OAAO,KAAK,EAGV,QAAQ,EAcT,MAAM,aAAa,CAAC;AA0DrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AAixQnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
|
|
@@ -45,6 +45,8 @@ import { definedProps, getCellEffectiveValue, getCellFormattedValue, getCellUser
|
|
|
45
45
|
import { useBorderStyles } from "../../hooks/use-border-styles";
|
|
46
46
|
import { useCallbackRef } from "../../hooks/use-callback-ref";
|
|
47
47
|
import { usePrevious } from "../../hooks/use-previous";
|
|
48
|
+
import { useNoteUndoRedoSent, useUndoRedoSentValue } from "../../atoms/undo-redo-sent.atom";
|
|
49
|
+
import { useFrozenAreaSentValue } from "../../atoms/frozen-area-sent.atom";
|
|
48
50
|
import { useCellPopover } from "../../hooks/use-cell-popover";
|
|
49
51
|
import { useCellRenderer } from "../../hooks/use-cell-renderer";
|
|
50
52
|
import { blocksOverflow, walkOverflowColumns } from "./overflow";
|
|
@@ -163,10 +165,13 @@ function isDetachedEditor(editor) {
|
|
|
163
165
|
}
|
|
164
166
|
/** An empty object list, stable across renders ("For objects, show: none"). */
|
|
165
167
|
const EMPTY_OBJECTS = [];
|
|
168
|
+
/** One cell (the Series dialog treats it as Excel does: Rows by default, and it stays selected). */
|
|
169
|
+
const isSingleCellRange = (range) => range.startRowIndex === range.endRowIndex &&
|
|
170
|
+
range.startColumnIndex === range.endColumnIndex;
|
|
166
171
|
/** "For objects, show: placeholders": an object's frame drawn with nothing in it. */
|
|
167
172
|
const getObjectPlaceholder = () => (React.createElement("div", { "data-testid": "object-placeholder", "aria-hidden": "true", className: "w-full h-full bg-rnc-muted/40 border border-dashed border-rnc-border" }));
|
|
168
173
|
function CanvasGridComponent(props, forwardedRef) {
|
|
169
|
-
const { licenseKey, sheetId, sheetType, ChartSheetView: ChartSheetViewComponent = ChartSheetView, instanceId, activeCell = DEFAULT_ACTIVE_CELL, selections = DEFAULT_ARRAY, frozenColumnCount = 0, frozenRowCount = 0, frozenRowStart, frozenColumnStart, rowCount = DEFAULT_ROW_COUNT, columnCount = DEFAULT_COLUMN_COUNT, autoFocus, basicFilter, tables, namedRanges, bandedRanges = DEFAULT_ARRAY, tableBorderColor = "#008000", filterIconColor = FILTER_BUTTON_GLYPH_COLOR, conditionalFormats, showFilterIcon = true, showCalculatedColumnIcon = true, showHeaders = true, backgroundImageUrl, defaultColumnWidth = DEFAULT_COLUMN_WIDTH, defaultRowHeight = DEFAULT_ROW_HEIGHT, lineHeightMode = "fontMetrics", columnHeaderHeight = COLUMN_HEADER_HEIGHT, rowHeaderWidth = ROW_HEADER_WIDTH, gridLineColor = GRIDLINE_COLOR, cellBackgroundColor = DEFAULT_CELL_BACKGROUND_COLOR, cellColor = DEFAULT_CELL_COLOR, headerBorderColor = DEFAULT_HEADER_BORDER_COLOR, headerBackgroundColor = DEFAULT_HEADER_BG, headerColor = DEFAULT_HEADER_COLOR, headerActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_BG, headerSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_BG, headerSelectedColor = "white", headerTableBackgroundColor = DEFAULT_HEADER_TABLE_BG, headerTableActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_TABLE_BG, headerTableSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_TABLE_BG, frozenShadowColor = headerBorderColor, frozenShadowThickness = 1, selectionBackgroundColor = SELECTION_BG, selectionBorderColor = SELECTION_BORDER, selectionStrokeWidth, showActiveCellBorderInSelection, selectionDragBorderColor = SELECTION_BORDER, chartSelectedColor, chipBackgroundColor = CHIP_COLOR, merges = DEFAULT_ARRAY, borderStyles, protectedRanges, allowEditRanges, isWorkbookProtected: isWorkbookProtectedProp = false, getSheetProtection, pivotTables, charts, onUpdateChart, onChangeZOrder, embeds, slicers, rowMetadata = DEFAULT_ARRAY, columnMetadata = DEFAULT_ARRAY, scale: zoomScale = 1, zoomSpeed = 1, overscanCount = 3, enableEditOnEnterKey: enableEditOnEnterKeyProp, enterKeyDirection = "down", enableAutoCorrect, shouldHandleKeyDown, enableTextOverflow = true, showGridLines: _showGridLines, showZeros, showObjects, splitPane, enableCellDragAndDrop = true, alertBeforeOverwritingCells = true, autoPercentEntry = false, errorCheckingRules, staleCells, rightToLeft: _rightToLeft, pageBreaks, pageBreakPreview: pageBreakPreviewProp, workbookView, printSettings, onChangeHeaderFooter, showRulers = true, workbookTitle, showFormulas = false, protectFormulas = false, showFrozenSeparator = true, HeaderCell = DefaultHeaderCell, Cell = DefaultCell, SelectionTitleComponent = SelectionTitle, CellEditor = DefaultCellEditor, CellTooltip, ContextMenu = DefaultContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, FilterBox = DefaultFilterBox, HeaderMoveDragComponent = DefaultHeaderMoveDragComponent, SuggestionsDropdown, stickyEditor = true, scrollSnap = false, scrollThrottleTimeout, preventBrowserDefaultScroll, mouseMoveThrottleTimeout = 60, tooltipIntentInterval = 60, selectionPolicy, users, userId, renderCollaboratorCursor, functionDescriptions, showHeaderMenuButton = true, scrollbarSize = SCROLLBAR_SIZE, theme = defaultSpreadsheetTheme, showNotes = true, showAllNotes = false, isNoteVisible: isNoteVisibleProp, showComments = true, circleInvalidData = false, getIgnoredErrors, locale, formulaLocale: formulaLocaleProp, referenceStyle = "A1", agentSuggestions, onReviewSuggestion, onShowFormulas, getDataRowCount, getDataRegion, getArrayFormula, getChartComponent, getEmbedComponent, getLinkedPictureSource: getLinkedPictureSourceProp, getSlicerComponent, onChange, onChangeBatch, onChangeArrayFormula, onExpandCollapse, onPivotDrillDown, onDelete, onChangeEditorValue, onFill, onRequestCalculate, onRequestFunctionArguments, onChangeActiveCell, onChangeActiveSheet, onChangeSelections, getSheetName, getSheetId, getCellData, getNote: getNoteProp, getTextFormatRuns, getDataValidation, getEffectiveFormat, getFormattedValue: getFormattedValueProp, getTooltipContent, errorResolutionComponent, getEffectiveValue: getEffectiveValueProp, getSparklineGroup, getUserEnteredExtendedValue, getEffectiveExtendedValue, getSheetRowCount, getSheetColumnCount, getCellPopoverContent, onScroll, onPaneScroll, onViewPortChange, windowConditionalFormats = false, engineConditionalFormatResults = false, getConditionalFormatRuleStats, onResize, onAutoResize, onHideColumn, onHideRow, onShowColumn, onShowRow, onGroupRows, onUngroupRows, onCollapseRowGroup, onExpandRowGroup, onGroupColumns, onUngroupColumns, onCollapseColumnGroup, onExpandColumnGroup, onSetOutlineDepth, onDeleteRow, onDeleteColumn, onInsertRow, onInsertColumn, onChangeAutoExpandTables, onChangeAutoCalculatedColumns, onInsertCellsShiftDown, onInsertCellsShiftRight, onDeleteCellsShiftLeft, onDeleteCellsShiftUp, onClearContents, onMoveColumns, onMoveRows, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onKeyDown, onChangeFormatting, onRepeatFormatting, onClearFormatting, onRequestEditProtectedRange, onRequestUnlockAllowEditRange, onMoveChart, onResizeChart, onDeleteChart, onCutChart, onCopyChart, objectClipboard = true, objectClipboardPolicy, onMoveEmbed, onResizeEmbed, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFillRange, onFlashFill, onFlashFillSuggest, onAcceptFlashFill, disableFillRightShortcut, keymap, enableAutoComplete = true, onCalculateNow, onRequestGoTo, onMoveSelection, onInsertCutCells, onInsertCopiedCells, onInsertTime, onInsertDate, onInsertDateTime, onInsertAutoSum, onUndo, onRedo, batchHistory, onPaste, onReapplyPaste, onCopy, onCut, onSortColumn, onSortTable, onFilterTable, onFilterPivot, onResizeTable, onUndoTableAutoExpansion, onUndoCalculatedColumn, onOverwriteCalculatedColumn, onRequestEditTable, onRequestEditPivotTable, onRequestDeletePivotTable, onRequestCreatePivotChart, onRemoveTable, onCreateTable, onRequestCreateTable, onInsertTableColumn, onDeleteTableColumn, onInsertTableRow, onDeleteTableRow, onUpdateTable, onRequestResizeTable, onRequestInsertSlicer, onCreateBasicFilter, onRequestDefineNamedRange, onRequestFormatCells, onRequestConditionalFormat, onRequestDataValidation, onRequestInsertComment, onRequestInsertLink, onFreezeColumn, onFreezeRow, onUpdateNote, onProtectRange, onUnProtectRange, onSortRange, onRequestSearch, onRequestReplace, onRequestResize, getRowHeaderText = getDefaultRowHeader, getColumnHeaderText: getColumnHeaderTextProp, getAdditionalCellSpacing, tokenizer: defaultTokenizer = defaultFormulaTokenizer, onChangeScale, onRemoveLink, onSelectLink, onSplitTextToColumns, onRemoveDuplicates, onGoalSeek, onSubtotal, onAdvancedFilter, onRequestExpand, cellExpandPredicate, StructuredResult = DefaultStructuredResult, getMentions, getStructuredProperties: getStructuredPropertiesProp, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, showSelectionResizeHandles = true, enableMagicFill, enableQuickEdit = true, MagicFillComponent, MagicFillContent, QuickEdit, PasteMenu, SuggestionAction, HiddenRowMarkers, HiddenColumnMarkers, enableResizerOverflow, className, defaultFontSizePoint = DEFAULT_FONT_SIZE_PT, defaultCellFormat, readonly, isComparing = false, getCellDiff, enableDataBoundaryNavigation, footerHeight, footerComponent, arrowComponents,
|
|
174
|
+
const { licenseKey, sheetId, sheetType, ChartSheetView: ChartSheetViewComponent = ChartSheetView, instanceId, activeCell = DEFAULT_ACTIVE_CELL, selections = DEFAULT_ARRAY, frozenColumnCount = 0, frozenRowCount = 0, frozenRowStart, frozenColumnStart, rowCount = DEFAULT_ROW_COUNT, columnCount = DEFAULT_COLUMN_COUNT, autoFocus, basicFilter, tables, namedRanges, bandedRanges = DEFAULT_ARRAY, tableBorderColor = "#008000", filterIconColor = FILTER_BUTTON_GLYPH_COLOR, conditionalFormats, showFilterIcon = true, showCalculatedColumnIcon = true, showHeaders = true, backgroundImageUrl, defaultColumnWidth = DEFAULT_COLUMN_WIDTH, defaultRowHeight = DEFAULT_ROW_HEIGHT, lineHeightMode = "fontMetrics", columnHeaderHeight = COLUMN_HEADER_HEIGHT, rowHeaderWidth = ROW_HEADER_WIDTH, gridLineColor = GRIDLINE_COLOR, cellBackgroundColor = DEFAULT_CELL_BACKGROUND_COLOR, cellColor = DEFAULT_CELL_COLOR, headerBorderColor = DEFAULT_HEADER_BORDER_COLOR, headerBackgroundColor = DEFAULT_HEADER_BG, headerColor = DEFAULT_HEADER_COLOR, headerActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_BG, headerSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_BG, headerSelectedColor = "white", headerTableBackgroundColor = DEFAULT_HEADER_TABLE_BG, headerTableActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_TABLE_BG, headerTableSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_TABLE_BG, frozenShadowColor = headerBorderColor, frozenShadowThickness = 1, selectionBackgroundColor = SELECTION_BG, selectionBorderColor = SELECTION_BORDER, selectionStrokeWidth, showActiveCellBorderInSelection, selectionDragBorderColor = SELECTION_BORDER, chartSelectedColor, chipBackgroundColor = CHIP_COLOR, merges = DEFAULT_ARRAY, borderStyles, protectedRanges, allowEditRanges, isWorkbookProtected: isWorkbookProtectedProp = false, getSheetProtection, pivotTables, charts, onUpdateChart, onChangeZOrder, embeds, slicers, rowMetadata = DEFAULT_ARRAY, columnMetadata = DEFAULT_ARRAY, scale: zoomScale = 1, zoomSpeed = 1, overscanCount = 3, enableEditOnEnterKey: enableEditOnEnterKeyProp, enterKeyDirection = "down", enableAutoCorrect, shouldHandleKeyDown, enableTextOverflow = true, showGridLines: _showGridLines, showZeros, showObjects, splitPane, enableCellDragAndDrop = true, alertBeforeOverwritingCells = true, autoPercentEntry = false, errorCheckingRules, staleCells, rightToLeft: _rightToLeft, pageBreaks, pageBreakPreview: pageBreakPreviewProp, workbookView, printSettings, onChangeHeaderFooter, showRulers = true, workbookTitle, showFormulas = false, protectFormulas = false, showFrozenSeparator = true, HeaderCell = DefaultHeaderCell, Cell = DefaultCell, SelectionTitleComponent = SelectionTitle, CellEditor = DefaultCellEditor, CellTooltip, ContextMenu = DefaultContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, FilterBox = DefaultFilterBox, HeaderMoveDragComponent = DefaultHeaderMoveDragComponent, SuggestionsDropdown, stickyEditor = true, scrollSnap = false, scrollThrottleTimeout, preventBrowserDefaultScroll, mouseMoveThrottleTimeout = 60, tooltipIntentInterval = 60, selectionPolicy, users, userId, renderCollaboratorCursor, functionDescriptions, showHeaderMenuButton = true, scrollbarSize = SCROLLBAR_SIZE, theme = defaultSpreadsheetTheme, showNotes = true, showAllNotes = false, isNoteVisible: isNoteVisibleProp, showComments = true, circleInvalidData = false, getIgnoredErrors, locale, getDate1904, parseCellEntryNumber, formulaLocale: formulaLocaleProp, referenceStyle = "A1", agentSuggestions, onReviewSuggestion, onShowFormulas, getDataRowCount, getDataRegion, getArrayFormula, getChartComponent, getEmbedComponent, getLinkedPictureSource: getLinkedPictureSourceProp, getSlicerComponent, onChange, onChangeBatch, onChangeArrayFormula, onExpandCollapse, onPivotDrillDown, onDelete, onChangeEditorValue, onFill, onRequestCalculate, onRequestFunctionArguments, onChangeActiveCell, onChangeActiveSheet, onChangeSelections, getSheetName, getSheetId, getCellData, getNote: getNoteProp, getTextFormatRuns, getDataValidation, getEffectiveFormat, getFormattedValue: getFormattedValueProp, getTooltipContent, errorResolutionComponent, getEffectiveValue: getEffectiveValueProp, getSparklineGroup, getUserEnteredExtendedValue, getEffectiveExtendedValue, getSheetRowCount, getSheetColumnCount, getCellPopoverContent, onScroll, onPaneScroll, onViewPortChange, windowConditionalFormats = false, engineConditionalFormatResults = false, getConditionalFormatRuleStats, onResize, onAutoResize, onHideColumn, onHideRow, onShowColumn, onShowRow, onGroupRows, onUngroupRows, onCollapseRowGroup, onExpandRowGroup, onGroupColumns, onUngroupColumns, onCollapseColumnGroup, onExpandColumnGroup, onSetOutlineDepth, onDeleteRow, onDeleteColumn, onInsertRow, onInsertColumn, onChangeAutoExpandTables, onChangeAutoCalculatedColumns, onInsertCellsShiftDown, onInsertCellsShiftRight, onDeleteCellsShiftLeft, onDeleteCellsShiftUp, onClearContents, onMoveColumns, onMoveRows, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onKeyDown, onChangeFormatting, onRepeatFormatting, onClearFormatting, onRequestEditProtectedRange, onRequestUnlockAllowEditRange, onMoveChart, onResizeChart, onDeleteChart, onCutChart, onCopyChart, objectClipboard = true, objectClipboardPolicy, onMoveEmbed, onResizeEmbed, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFillRange, onFlashFill, onFlashFillSuggest, onAcceptFlashFill, disableFillRightShortcut, keymap, enableAutoComplete = true, onCalculateNow, onRequestGoTo, onMoveSelection, onInsertCutCells, onInsertCopiedCells, onInsertTime, onInsertDate, onInsertDateTime, onInsertAutoSum, onUndo, onRedo, batchHistory, onPaste, onReapplyPaste, onCopy, onCut, onSortColumn, onSortTable, onFilterTable, onFilterPivot, onResizeTable, onUndoTableAutoExpansion, onUndoCalculatedColumn, onOverwriteCalculatedColumn, onRequestEditTable, onRequestEditPivotTable, onRequestDeletePivotTable, onRequestCreatePivotChart, onRemoveTable, onCreateTable, onRequestCreateTable, onInsertTableColumn, onDeleteTableColumn, onInsertTableRow, onDeleteTableRow, onUpdateTable, onRequestResizeTable, onRequestInsertSlicer, onCreateBasicFilter, onRequestDefineNamedRange, onRequestFormatCells, onRequestConditionalFormat, onRequestDataValidation, onRequestInsertComment, onRequestInsertLink, onFreezeColumn, onFreezeRow, onUpdateNote, onProtectRange, onUnProtectRange, onSortRange, onRequestSearch, onRequestReplace, onRequestResize, getRowHeaderText = getDefaultRowHeader, getColumnHeaderText: getColumnHeaderTextProp, getAdditionalCellSpacing, tokenizer: defaultTokenizer = defaultFormulaTokenizer, onChangeScale, onRemoveLink, onSelectLink, onSplitTextToColumns, onRemoveDuplicates, onGoalSeek, onSubtotal, onAdvancedFilter, onRequestExpand, cellExpandPredicate, StructuredResult = DefaultStructuredResult, getMentions, getStructuredProperties: getStructuredPropertiesProp, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, showSelectionResizeHandles = true, enableMagicFill, enableQuickEdit = true, MagicFillComponent, MagicFillContent, QuickEdit, PasteMenu, SuggestionAction, HiddenRowMarkers, HiddenColumnMarkers, enableResizerOverflow, className, defaultFontSizePoint = DEFAULT_FONT_SIZE_PT, defaultCellFormat, readonly, isComparing = false, getCellDiff, enableDataBoundaryNavigation, footerHeight, footerComponent, arrowComponents,
|
|
170
175
|
// Host-driven filter props. `hostHiddenRowRanges`
|
|
171
176
|
// supplies compact [start, end] hidden-row tuples; `getFilterValues` supplies a
|
|
172
177
|
// column's distinct values. Both let a million-row filter render without scanning
|
|
@@ -878,42 +883,83 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
878
883
|
columnsAboveFrozenStart,
|
|
879
884
|
getViewPort,
|
|
880
885
|
]);
|
|
881
|
-
//
|
|
882
|
-
// only those move this window's view
|
|
886
|
+
// What this window just sent that may change the frozen area (a freeze, an unfreeze, an undo, a
|
|
887
|
+
// redo), and the last freeze from a start it made: only those move this window's view
|
|
888
|
+
// (`frozenStartScroll`). A mark lives until the grid next commits: the change it was sent for
|
|
889
|
+
// arrives in that same render (the host applies it while handling the event), and a mark the next
|
|
890
|
+
// render did not use is dropped, whatever arrives later.
|
|
883
891
|
const pendingFreezeRef = useRef({});
|
|
884
892
|
const localFreezeRef = useRef({});
|
|
893
|
+
const noteUndoRedoSent = useNoteUndoRedoSent();
|
|
894
|
+
const markHistorySent = useCallback((kind) => {
|
|
895
|
+
pendingFreezeRef.current = { rows: { kind }, columns: { kind } };
|
|
896
|
+
noteUndoRedoSent(kind);
|
|
897
|
+
}, [noteUndoRedoSent]);
|
|
898
|
+
// An undo / redo this window sent outside the grid (the host's toolbar through the engine hook,
|
|
899
|
+
// or a host calling `useNoteUndoRedoSent`), counted: one the grid has not seen yet is this
|
|
900
|
+
// window's.
|
|
901
|
+
const undoRedoSent = useUndoRedoSentValue();
|
|
902
|
+
const seenUndoRedoRef = useRef(undoRedoSent?.seq);
|
|
903
|
+
// A freeze / unfreeze this window sent outside the grid's own menu (a host ribbon through the
|
|
904
|
+
// engine hook, or a host calling `useNoteFrozenAreaSent`), counted, with the area it asked for.
|
|
905
|
+
const frozenAreaSent = useFrozenAreaSentValue();
|
|
906
|
+
// Each axis's mark is consumed once, by the count it was noted at (a mark noted before the
|
|
907
|
+
// other axis's in the same act keeps its own count, rowsncolumns/spreadsheet#1769).
|
|
908
|
+
const axisSeq = (axis) => {
|
|
909
|
+
const mark = frozenAreaSent?.[axis];
|
|
910
|
+
return mark ? (mark.seq ?? frozenAreaSent?.seq) : undefined;
|
|
911
|
+
};
|
|
912
|
+
const seenFrozenAreaRef = useRef({ rows: axisSeq("rows"), columns: axisSeq("columns") });
|
|
885
913
|
const freezeRowsUpTo = useCallback((freezeSheetId, rowIndex) => {
|
|
886
914
|
if (!onFreezeRow)
|
|
887
915
|
return;
|
|
888
916
|
const { count, start } = freezeUpTo(rowIndex, rowIndex > 0 ? firstShownRowForFreeze() : 1);
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
count,
|
|
893
|
-
},
|
|
894
|
-
scrollBefore: gridRef.current?.getScrollPosition().scrollTop ?? 0,
|
|
917
|
+
const expected = {
|
|
918
|
+
lines: linesAboveFrozenStart(start, count, Math.min(MAX_ROW_COUNT, rowCount)),
|
|
919
|
+
count,
|
|
895
920
|
};
|
|
921
|
+
// A freeze that asks for the area already there changes nothing: it leaves no mark.
|
|
922
|
+
pendingFreezeRef.current.rows =
|
|
923
|
+
expected.lines === rowsAboveFrozenStart && expected.count === (frozenRowCount ?? 0)
|
|
924
|
+
? undefined
|
|
925
|
+
: {
|
|
926
|
+
kind: "freeze",
|
|
927
|
+
expected,
|
|
928
|
+
scrollBefore: gridRef.current?.getScrollPosition().scrollTop ?? 0,
|
|
929
|
+
};
|
|
896
930
|
if (start)
|
|
897
931
|
onFreezeRow(freezeSheetId, count, start);
|
|
898
932
|
else
|
|
899
933
|
onFreezeRow(freezeSheetId, count);
|
|
900
|
-
}, [onFreezeRow, firstShownRowForFreeze, rowCount]);
|
|
934
|
+
}, [onFreezeRow, firstShownRowForFreeze, rowCount, rowsAboveFrozenStart, frozenRowCount]);
|
|
901
935
|
const freezeColumnsUpTo = useCallback((freezeSheetId, columnIndex) => {
|
|
902
936
|
if (!onFreezeColumn)
|
|
903
937
|
return;
|
|
904
938
|
const { count, start } = freezeUpTo(columnIndex, columnIndex > 0 ? firstShownColumnForFreeze() : 1);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
count,
|
|
909
|
-
},
|
|
910
|
-
scrollBefore: gridRef.current?.getScrollPosition().scrollLeft ?? 0,
|
|
939
|
+
const expected = {
|
|
940
|
+
lines: linesAboveFrozenStart(start, count, Math.min(MAX_COLUMN_COUNT, columnCount)),
|
|
941
|
+
count,
|
|
911
942
|
};
|
|
943
|
+
pendingFreezeRef.current.columns =
|
|
944
|
+
expected.lines === columnsAboveFrozenStart &&
|
|
945
|
+
expected.count === (frozenColumnCount ?? 0)
|
|
946
|
+
? undefined
|
|
947
|
+
: {
|
|
948
|
+
kind: "freeze",
|
|
949
|
+
expected,
|
|
950
|
+
scrollBefore: gridRef.current?.getScrollPosition().scrollLeft ?? 0,
|
|
951
|
+
};
|
|
912
952
|
if (start)
|
|
913
953
|
onFreezeColumn(freezeSheetId, count, start);
|
|
914
954
|
else
|
|
915
955
|
onFreezeColumn(freezeSheetId, count);
|
|
916
|
-
}, [
|
|
956
|
+
}, [
|
|
957
|
+
onFreezeColumn,
|
|
958
|
+
firstShownColumnForFreeze,
|
|
959
|
+
columnCount,
|
|
960
|
+
columnsAboveFrozenStart,
|
|
961
|
+
frozenColumnCount,
|
|
962
|
+
]);
|
|
917
963
|
/**
|
|
918
964
|
* Where the view is left when a frozen area with a start changes (`frozenStartScroll`): a Freeze
|
|
919
965
|
* Panes this window sent places it as Excel does (the scrolling area right below the band; an
|
|
@@ -953,7 +999,42 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
953
999
|
}
|
|
954
1000
|
if (previous.suspended !== frozenStartSuspended)
|
|
955
1001
|
return;
|
|
1002
|
+
// An undo / redo this window sent through the engine hook (a toolbar) that the grid has not
|
|
1003
|
+
// seen: this change is it.
|
|
1004
|
+
const historyKind = undoRedoSent && undoRedoSent.seq !== seenUndoRedoRef.current ? undoRedoSent.kind : undefined;
|
|
1005
|
+
// A freeze this window sent through the engine hook (a ribbon) that the grid has not seen: what it
|
|
1006
|
+
// asked for, per axis, in the grid's terms. One that asks for the area already there leaves no mark.
|
|
1007
|
+
const sentFreeze = frozenAreaSent && frozenAreaSent.sheetId === sheetId ? frozenAreaSent : undefined;
|
|
1008
|
+
const freezeSentOn = (axis) => {
|
|
1009
|
+
const asked = sentFreeze?.[axis];
|
|
1010
|
+
if (!asked || axisSeq(axis) === seenFrozenAreaRef.current[axis])
|
|
1011
|
+
return undefined;
|
|
1012
|
+
const was = axis === "rows"
|
|
1013
|
+
? { lines: previous.rows, count: previous.rowCount }
|
|
1014
|
+
: { lines: previous.columns, count: previous.columnCount };
|
|
1015
|
+
const count = asked.count ?? was.count;
|
|
1016
|
+
// `freeze-row` / `freeze-column` always say where they start (absent = line 1); an
|
|
1017
|
+
// `update-sheet` that names only a count keeps the start the area had, while it stays frozen.
|
|
1018
|
+
const start = asked.start !== undefined ? asked.start : count > 0 && was.count > 0 ? was.lines + 1 : 1;
|
|
1019
|
+
const expected = {
|
|
1020
|
+
lines: linesAboveFrozenStart(start, count, axis === "rows"
|
|
1021
|
+
? Math.min(MAX_ROW_COUNT, rowCount)
|
|
1022
|
+
: Math.min(MAX_COLUMN_COUNT, columnCount)),
|
|
1023
|
+
count,
|
|
1024
|
+
};
|
|
1025
|
+
if (expected.lines === was.lines && expected.count === was.count)
|
|
1026
|
+
return undefined;
|
|
1027
|
+
const position = gridRef.current?.getScrollPosition();
|
|
1028
|
+
return {
|
|
1029
|
+
kind: "freeze",
|
|
1030
|
+
expected,
|
|
1031
|
+
scrollBefore: (axis === "rows" ? position?.scrollTop : position?.scrollLeft) ?? 0,
|
|
1032
|
+
};
|
|
1033
|
+
};
|
|
956
1034
|
const place = (axis, offset) => {
|
|
1035
|
+
const pending = pendingFreezeRef.current[axis] ??
|
|
1036
|
+
freezeSentOn(axis) ??
|
|
1037
|
+
(historyKind ? { kind: historyKind } : undefined);
|
|
957
1038
|
const result = frozenStartScroll({
|
|
958
1039
|
before: axis === "rows"
|
|
959
1040
|
? { lines: previous.rows, count: previous.rowCount }
|
|
@@ -961,12 +1042,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
961
1042
|
after: axis === "rows"
|
|
962
1043
|
? { lines: next.rows, count: next.rowCount }
|
|
963
1044
|
: { lines: next.columns, count: next.columnCount },
|
|
964
|
-
pending
|
|
1045
|
+
pending,
|
|
965
1046
|
local: localFreezeRef.current[axis],
|
|
966
1047
|
snapshot: snapshot[axis],
|
|
967
1048
|
offset,
|
|
968
1049
|
});
|
|
969
|
-
|
|
1050
|
+
// Any change on the axis reads the mark: it is dropped, matched or not.
|
|
1051
|
+
const changed = axis === "rows"
|
|
1052
|
+
? previous.rows !== next.rows || previous.rowCount !== next.rowCount
|
|
1053
|
+
: previous.columns !== next.columns ||
|
|
1054
|
+
previous.columnCount !== next.columnCount;
|
|
1055
|
+
if (changed || result.consumed)
|
|
970
1056
|
pendingFreezeRef.current[axis] = undefined;
|
|
971
1057
|
localFreezeRef.current[axis] = result.local;
|
|
972
1058
|
return result.scroll;
|
|
@@ -990,6 +1076,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
990
1076
|
columnsAboveFrozenStart,
|
|
991
1077
|
frozenColumnCount,
|
|
992
1078
|
]);
|
|
1079
|
+
// After every commit (and after the effect above): what this window sent has had its render.
|
|
1080
|
+
useIsomorphicLayoutEffect(() => {
|
|
1081
|
+
pendingFreezeRef.current = {};
|
|
1082
|
+
seenUndoRedoRef.current = undoRedoSent?.seq;
|
|
1083
|
+
seenFrozenAreaRef.current = { rows: axisSeq("rows"), columns: axisSeq("columns") };
|
|
1084
|
+
});
|
|
993
1085
|
/**
|
|
994
1086
|
* Get cell coordinates from x and y position
|
|
995
1087
|
* @param x
|
|
@@ -3043,6 +3135,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3043
3135
|
if (!request || request.sheetId !== sheetId)
|
|
3044
3136
|
return;
|
|
3045
3137
|
if (option === "undo") {
|
|
3138
|
+
markHistorySent("undo");
|
|
3046
3139
|
onUndo?.();
|
|
3047
3140
|
}
|
|
3048
3141
|
else if (option === "select-blank" || option === "select-changed") {
|
|
@@ -3061,6 +3154,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3061
3154
|
setFlashFillOptions,
|
|
3062
3155
|
sheetId,
|
|
3063
3156
|
onUndo,
|
|
3157
|
+
markHistorySent,
|
|
3064
3158
|
onChangeActiveCell,
|
|
3065
3159
|
onChangeSelections,
|
|
3066
3160
|
focusSheet,
|
|
@@ -3175,18 +3269,35 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3175
3269
|
* in Columns) / first column (Rows) is the seed line; `stop` may shrink or
|
|
3176
3270
|
* extend the target along the axis from the seed's last value.
|
|
3177
3271
|
*/
|
|
3178
|
-
const applyFillSeriesSpec = useCallback((fillSheetId, cell, target, spec) => {
|
|
3272
|
+
const applyFillSeriesSpec = useCallback((fillSheetId, cell, target, spec, date1904) => {
|
|
3179
3273
|
const seed = seedRangeForSeriesSpec(target.range, spec);
|
|
3180
3274
|
const fillRange = fillRangeForSeriesSpec({
|
|
3181
3275
|
target: target.range,
|
|
3182
3276
|
seed,
|
|
3183
3277
|
spec,
|
|
3278
|
+
// A line the engine runs as this series (rnc-store `fill_val_of` / `fill_seed_vals` /
|
|
3279
|
+
// `series_spec_values`): a seed that is not a formula (a formula seed is copied down
|
|
3280
|
+
// instead) with a number, and for a Date series a date-, date-time- or time-formatted
|
|
3281
|
+
// one. The cell readers answer an ExtendedValue (`{ nv }`), never a bare number.
|
|
3184
3282
|
getSeedValue: (r, c) => {
|
|
3185
|
-
|
|
3186
|
-
|
|
3283
|
+
if (getFormulaValue(fillSheetId, r, c) !== undefined)
|
|
3284
|
+
return undefined;
|
|
3285
|
+
const value = getExtendedValueNumber(getEffectiveValue(fillSheetId, r, c));
|
|
3286
|
+
if (value === undefined || spec.type !== "date")
|
|
3287
|
+
return value;
|
|
3288
|
+
const format = getCellFormat(fillSheetId, r, c);
|
|
3289
|
+
const userFormat = getCellData?.(fillSheetId, r, c)?.userEnteredFormat;
|
|
3290
|
+
const type = (format && "numberFormat" in format ? format.numberFormat?.type : undefined) ??
|
|
3291
|
+
(userFormat && "numberFormat" in userFormat
|
|
3292
|
+
? userFormat.numberFormat?.type
|
|
3293
|
+
: undefined);
|
|
3294
|
+
return type === "DATE" || type === "DATE_TIME" || type === "TIME" ? value : undefined;
|
|
3187
3295
|
},
|
|
3188
|
-
|
|
3189
|
-
|
|
3296
|
+
// Bounded by the sheet, not by the drawn extent (a host may draw 1,000 rows that grow with
|
|
3297
|
+
// the data): rows and columns start at index 1, so the last index is the maximum itself.
|
|
3298
|
+
rowCount: MAX_ROW_COUNT + 1,
|
|
3299
|
+
columnCount: MAX_COLUMN_COUNT + 1,
|
|
3300
|
+
date1904,
|
|
3190
3301
|
});
|
|
3191
3302
|
if (!fillRange)
|
|
3192
3303
|
return;
|
|
@@ -3206,8 +3317,21 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3206
3317
|
: "FillDays"
|
|
3207
3318
|
: undefined;
|
|
3208
3319
|
onFill?.(fillSheetId, cell, { range: fillRange }, [{ ...target, range: seed }], undefined, fillType, { series: spec });
|
|
3209
|
-
|
|
3210
|
-
|
|
3320
|
+
// Excel leaves a seed-only selection (one cell, or one line across the axis) selected after
|
|
3321
|
+
// it runs the series from it to the Stop.
|
|
3322
|
+
const seedOnly = seed.endRowIndex === target.range.endRowIndex &&
|
|
3323
|
+
seed.endColumnIndex === target.range.endColumnIndex;
|
|
3324
|
+
if (!seedOnly) {
|
|
3325
|
+
onChangeSelections?.(fillSheetId, [{ ...target, range: fillRange }]);
|
|
3326
|
+
}
|
|
3327
|
+
}, [
|
|
3328
|
+
getEffectiveValue,
|
|
3329
|
+
getFormulaValue,
|
|
3330
|
+
getCellFormat,
|
|
3331
|
+
getCellData,
|
|
3332
|
+
onFill,
|
|
3333
|
+
onChangeSelections,
|
|
3334
|
+
]);
|
|
3211
3335
|
/** Open the Series dialog for a range (the current selection by default). */
|
|
3212
3336
|
const openFillSeriesDialogFor = useCallback((target, initialIn) => {
|
|
3213
3337
|
const selection = target ??
|
|
@@ -3215,14 +3339,30 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3215
3339
|
{
|
|
3216
3340
|
range: cellToArea(activeCell),
|
|
3217
3341
|
};
|
|
3342
|
+
// Asked once, as the dialog opens (the rnc engine reads it through a formula preview); the
|
|
3343
|
+
// typed Stop and the count to it both use it.
|
|
3344
|
+
const date1904 = getDate1904?.() ?? false;
|
|
3218
3345
|
openFillSeriesDialog({
|
|
3219
3346
|
sheetId,
|
|
3220
3347
|
activeCell,
|
|
3221
3348
|
selection,
|
|
3222
|
-
|
|
3223
|
-
|
|
3349
|
+
// Excel opens on Rows for a single cell; a range keeps the dialog's default.
|
|
3350
|
+
initialIn: initialIn ?? (isSingleCellRange(selection.range) ? "rows" : undefined),
|
|
3351
|
+
onApply: (spec) => applyFillSeriesSpec(sheetId, activeCell, selection, spec, date1904),
|
|
3352
|
+
locale,
|
|
3353
|
+
date1904,
|
|
3354
|
+
parseStop: parseCellEntryNumber,
|
|
3224
3355
|
});
|
|
3225
|
-
}, [
|
|
3356
|
+
}, [
|
|
3357
|
+
selections,
|
|
3358
|
+
activeCell,
|
|
3359
|
+
sheetId,
|
|
3360
|
+
openFillSeriesDialog,
|
|
3361
|
+
applyFillSeriesSpec,
|
|
3362
|
+
locale,
|
|
3363
|
+
getDate1904,
|
|
3364
|
+
parseCellEntryNumber,
|
|
3365
|
+
]);
|
|
3226
3366
|
/** "Series…" on the right-drag fill menu: the drag's target is the range, its axis the default. */
|
|
3227
3367
|
const handleOpenFillSeriesDialog = useCallback(() => {
|
|
3228
3368
|
if (!fillOptions)
|
|
@@ -3310,6 +3450,9 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3310
3450
|
getValue: getUserEnteredStringValue,
|
|
3311
3451
|
selectionLeftBound,
|
|
3312
3452
|
selectionTopBound,
|
|
3453
|
+
// The grid's frozen counts include the heading, so they are the first scrolling row / column.
|
|
3454
|
+
scrollingTopBound: frozenRows,
|
|
3455
|
+
scrollingLeftBound: frozenColumns,
|
|
3313
3456
|
canSelectionSpanMergedCells,
|
|
3314
3457
|
mouseDownInterceptor: onMouseDownInterceptor,
|
|
3315
3458
|
mouseMoveInterceptor: onMouseMoveInterceptor,
|
|
@@ -3939,15 +4082,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3939
4082
|
const undoDroppingFillOptions = useMemo(() => onUndo
|
|
3940
4083
|
? () => {
|
|
3941
4084
|
dropSmartTags();
|
|
4085
|
+
markHistorySent("undo");
|
|
3942
4086
|
onUndo();
|
|
3943
4087
|
}
|
|
3944
|
-
: undefined, [onUndo, dropSmartTags]);
|
|
4088
|
+
: undefined, [onUndo, dropSmartTags, markHistorySent]);
|
|
3945
4089
|
const redoDroppingFillOptions = useMemo(() => onRedo
|
|
3946
4090
|
? () => {
|
|
3947
4091
|
dropSmartTags();
|
|
4092
|
+
markHistorySent("redo");
|
|
3948
4093
|
onRedo();
|
|
3949
4094
|
}
|
|
3950
|
-
: undefined, [onRedo, dropSmartTags]);
|
|
4095
|
+
: undefined, [onRedo, dropSmartTags, markHistorySent]);
|
|
3951
4096
|
const onKeyDownFormatting = useKeyboardHandler({
|
|
3952
4097
|
sheetId,
|
|
3953
4098
|
locale,
|
|
@@ -665,6 +665,21 @@ export type CanvasGridProps<T extends CellData = CellData<any, any>> = {
|
|
|
665
665
|
* Locale of the spreadsheet
|
|
666
666
|
*/
|
|
667
667
|
locale?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Whether the workbook uses the 1904 date system (`<workbookPr date1904="1">`), asked when the
|
|
670
|
+
* Series dialog opens: a date typed in its Stop value then counts its serial from 1904, as the
|
|
671
|
+
* workbook's cells do. The rnc engine's hook returns one (`getDate1904`); a host that knows its
|
|
672
|
+
* date system passes `() => true` for a 1904 workbook. Absent = the 1900 system.
|
|
673
|
+
*/
|
|
674
|
+
getDate1904?(): boolean;
|
|
675
|
+
/**
|
|
676
|
+
* The number a cell entry of `text` would hold in this workbook: a number, percentage, currency
|
|
677
|
+
* amount, date or time (its serial, in the workbook's locale and date system), or `undefined` for
|
|
678
|
+
* text, a boolean or an error. Read-only: it writes nothing. The Series dialog reads its Stop value
|
|
679
|
+
* with it; the rnc engine's hook returns one (`parseCellEntryNumber`). Absent: the dialog's own
|
|
680
|
+
* reading (`parseSeriesStopValue`, with `locale` and `getDate1904`).
|
|
681
|
+
*/
|
|
682
|
+
parseCellEntryNumber?(text: string): number | undefined;
|
|
668
683
|
/**
|
|
669
684
|
* Formula SYNTAX locale for the cell editor, formula bar, autocomplete, argument hints, syntax
|
|
670
685
|
* highlighting and error display (rowsncolumns/spreadsheet#655) — Excel's behaviour: decimal and
|