@rowsncolumns/spreadsheet 10.18.0 → 10.19.1
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 +18 -0
- package/dist/cjs/api/fill-series.d.ts.map +1 -1
- package/dist/cjs/api/fill-series.js +95 -1
- 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 +42 -0
- package/dist/cjs/atoms/frozen-area-sent.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/frozen-area-sent.atom.js +29 -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 +131 -24
- 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 +10 -1
- package/dist/cjs/components/fill-series-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/fill-series-dialog/index.js +14 -4
- 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 +18 -0
- package/dist/esm/api/fill-series.d.ts.map +1 -1
- package/dist/esm/api/fill-series.js +89 -0
- 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 +42 -0
- package/dist/esm/atoms/frozen-area-sent.atom.d.ts.map +1 -0
- package/dist/esm/atoms/frozen-area-sent.atom.js +21 -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 +129 -22
- 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 +10 -1
- package/dist/esm/components/fill-series-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/fill-series-dialog/index.js +14 -4
- 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,5 +1,23 @@
|
|
|
1
1
|
import type { GridRange } from "@rowsncolumns/grid";
|
|
2
2
|
import type { FillSeriesSpec } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* The Series dialog's Stop value as the serial the spec carries, read the way a cell entry is read,
|
|
5
|
+
* for a host that does not parse it itself (`CanvasGrid`'s `parseCellEntryNumber`, which the rnc
|
|
6
|
+
* engine's hook answers with the cell-entry inference). `undefined` when the text is empty or would
|
|
7
|
+
* not be a number in a cell (text, a boolean).
|
|
8
|
+
* - A day / month without a year (`3/4`, `15/1`) follows the locale's order (3 April and 15 January
|
|
9
|
+
* in en-GB, 4 March in en-US), in the current year, as a cell entry does. Where the decimal mark is a
|
|
10
|
+
* comma, `1.5` is such a date too (1 May in de-DE).
|
|
11
|
+
* - A plain number is taken as it is (`45306`, `-2.5`, `1e3`; `1.5` where the decimal mark is `.`).
|
|
12
|
+
* - A date with a year, a date and time, or a time, in the locale (`15/1/2024` in en-GB,
|
|
13
|
+
* `15.1.2024` in de-DE, `Jan 15, 2024`, `2024-01-15`, `1/15/2024 12:00`, `10:30`). A date counts
|
|
14
|
+
* in the workbook's date system (1462 lower in a 1904 workbook); a time part is kept.
|
|
15
|
+
* - A number the locale writes otherwise: `2,5` in de-DE, `50%` (0.5), `1,000` (1000) and `$5` in en-US.
|
|
16
|
+
*/
|
|
17
|
+
export declare const parseSeriesStopValue: (text: string, options?: {
|
|
18
|
+
locale?: string;
|
|
19
|
+
date1904?: boolean;
|
|
20
|
+
}) => number | undefined;
|
|
3
21
|
/**
|
|
4
22
|
* The seed line of a Series-dialog fill: Excel treats the target range's first
|
|
5
23
|
* row (Series in Columns — filling down) or first column (Series in Rows —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../api/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../api/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAkC/C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,UAAS;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KACpD,MAAM,GAAG,SA8CX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,EACjB,MAAM,cAAc,KACnB,SAGyD,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,MAAM,cAAc,KACnB,MAAM,GAAG,SAuBX,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,0DAA0D;IAC1D,MAAM,EAAE,SAAS,CAAC;IAClB,2CAA2C;IAC3C,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,oEAAoE;IACpE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,8DAOpC,0BAA0B,KAAG,SAAS,GAAG,SAwB3C,CAAC"}
|
|
@@ -1,7 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fillRangeForSeriesSpec = exports.seriesCountToStop = exports.seedRangeForSeriesSpec = void 0;
|
|
3
|
+
exports.fillRangeForSeriesSpec = exports.seriesCountToStop = exports.seedRangeForSeriesSpec = exports.parseSeriesStopValue = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var numfmt_1 = require("numfmt");
|
|
6
|
+
/** Days from the 1900 date system's day zero to the 1904 system's (`DATE1904_OFFSET`). */
|
|
7
|
+
var DATE_1904_OFFSET = 1462;
|
|
8
|
+
/** A locale's day / month order and decimal mark, from `Intl` (en-US conventions on a bad tag). */
|
|
9
|
+
var localeEntryConventions = function (locale) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
try {
|
|
12
|
+
var order = new Intl.DateTimeFormat(locale, {
|
|
13
|
+
year: "numeric",
|
|
14
|
+
month: "numeric",
|
|
15
|
+
day: "numeric",
|
|
16
|
+
})
|
|
17
|
+
.formatToParts(new Date(2024, 11, 25))
|
|
18
|
+
.map(function (part) { return part.type; });
|
|
19
|
+
var decimal = (_b = (_a = new Intl.NumberFormat(locale)
|
|
20
|
+
.formatToParts(1.5)
|
|
21
|
+
.find(function (part) { return part.type === "decimal"; })) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ".";
|
|
22
|
+
return {
|
|
23
|
+
monthFirst: order.indexOf("month") < order.indexOf("day"),
|
|
24
|
+
decimal: decimal,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (_c) {
|
|
28
|
+
return { monthFirst: true, decimal: "." };
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/** Excel's serial for a calendar date (UTC arithmetic, the same in every timezone; from 1 March 1900). */
|
|
32
|
+
var calendarSerial = function (year, month, day) {
|
|
33
|
+
return (Date.UTC(year, month - 1, day) - Date.UTC(1899, 11, 30)) / 86400000;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The Series dialog's Stop value as the serial the spec carries, read the way a cell entry is read,
|
|
37
|
+
* for a host that does not parse it itself (`CanvasGrid`'s `parseCellEntryNumber`, which the rnc
|
|
38
|
+
* engine's hook answers with the cell-entry inference). `undefined` when the text is empty or would
|
|
39
|
+
* not be a number in a cell (text, a boolean).
|
|
40
|
+
* - A day / month without a year (`3/4`, `15/1`) follows the locale's order (3 April and 15 January
|
|
41
|
+
* in en-GB, 4 March in en-US), in the current year, as a cell entry does. Where the decimal mark is a
|
|
42
|
+
* comma, `1.5` is such a date too (1 May in de-DE).
|
|
43
|
+
* - A plain number is taken as it is (`45306`, `-2.5`, `1e3`; `1.5` where the decimal mark is `.`).
|
|
44
|
+
* - A date with a year, a date and time, or a time, in the locale (`15/1/2024` in en-GB,
|
|
45
|
+
* `15.1.2024` in de-DE, `Jan 15, 2024`, `2024-01-15`, `1/15/2024 12:00`, `10:30`). A date counts
|
|
46
|
+
* in the workbook's date system (1462 lower in a 1904 workbook); a time part is kept.
|
|
47
|
+
* - A number the locale writes otherwise: `2,5` in de-DE, `50%` (0.5), `1,000` (1000) and `$5` in en-US.
|
|
48
|
+
*/
|
|
49
|
+
var parseSeriesStopValue = function (text, options) {
|
|
50
|
+
if (options === void 0) { options = {}; }
|
|
51
|
+
var trimmed = text.trim();
|
|
52
|
+
if (!trimmed)
|
|
53
|
+
return undefined;
|
|
54
|
+
var locale = options.locale;
|
|
55
|
+
var shift = options.date1904 ? DATE_1904_OFFSET : 0;
|
|
56
|
+
var _a = localeEntryConventions(locale), monthFirst = _a.monthFirst, decimal = _a.decimal;
|
|
57
|
+
var yearless = /^(\d{1,2})([/.-])(\d{1,2})$/.exec(trimmed);
|
|
58
|
+
if (yearless && (yearless[2] !== "." || decimal === ",")) {
|
|
59
|
+
var first = Number(yearless[1]);
|
|
60
|
+
var second = Number(yearless[3]);
|
|
61
|
+
var _b = tslib_1.__read(monthFirst ? [first, second] : [second, first], 2), month = _b[0], day = _b[1];
|
|
62
|
+
var year = new Date().getFullYear();
|
|
63
|
+
var date = new Date(Date.UTC(year, month - 1, day));
|
|
64
|
+
if (month >= 1 &&
|
|
65
|
+
month <= 12 &&
|
|
66
|
+
date.getUTCMonth() === month - 1 &&
|
|
67
|
+
date.getUTCDate() === day) {
|
|
68
|
+
return calendarSerial(year, month, day) - shift;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
if (/^[+-]?\d+$/.test(trimmed) || decimal === ".") {
|
|
73
|
+
var number = Number(trimmed);
|
|
74
|
+
if (Number.isFinite(number))
|
|
75
|
+
return number;
|
|
76
|
+
}
|
|
77
|
+
var parseOptions = locale ? { locale: locale } : undefined;
|
|
78
|
+
try {
|
|
79
|
+
var date = (0, numfmt_1.parseDate)(trimmed, parseOptions);
|
|
80
|
+
if (date && typeof date.v === "number" && Number.isFinite(date.v)) {
|
|
81
|
+
return date.v - shift;
|
|
82
|
+
}
|
|
83
|
+
// A time alone is a fraction of a day, the same in both date systems.
|
|
84
|
+
var time = (0, numfmt_1.parseTime)(trimmed, parseOptions);
|
|
85
|
+
if (time && typeof time.v === "number" && Number.isFinite(time.v)) {
|
|
86
|
+
return time.v;
|
|
87
|
+
}
|
|
88
|
+
var number = (0, numfmt_1.parseNumber)(trimmed, parseOptions);
|
|
89
|
+
if (number && typeof number.v === "number" && Number.isFinite(number.v)) {
|
|
90
|
+
return number.v;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (_c) {
|
|
94
|
+
// numfmt throws on a malformed locale tag: the text is then refused.
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
};
|
|
98
|
+
exports.parseSeriesStopValue = parseSeriesStopValue;
|
|
5
99
|
/**
|
|
6
100
|
* The seed line of a Series-dialog fill: Excel treats the target range's first
|
|
7
101
|
* row (Series in Columns — filling down) or first column (Series in Rows —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-input-context.atom.d.ts","sourceRoot":"","sources":["../../../atoms/cell-input-context.atom.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,mBAAmB;;;;
|
|
1
|
+
{"version":3,"file":"cell-input-context.atom.d.ts","sourceRoot":"","sources":["../../../atoms/cell-input-context.atom.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,mBAAmB;;;;oBAC4m8F,CAAC;qBAAwB,CAAC;;;;;;;;;;;CADvl8F,CAAC"}
|
|
@@ -16,6 +16,12 @@ export type FillSeriesDialogRequest = {
|
|
|
16
16
|
/** Pre-selected axis (a right-drag seeds it from the drag direction). */
|
|
17
17
|
initialIn?: FillSeriesSpec["in"];
|
|
18
18
|
onApply(spec: FillSeriesSpec): void;
|
|
19
|
+
/** The workbook's locale, for a date typed in Stop value. */
|
|
20
|
+
locale?: string;
|
|
21
|
+
/** The workbook's 1904 date system, for a date typed in Stop value. */
|
|
22
|
+
date1904?: boolean;
|
|
23
|
+
/** The host's cell-entry reading of Stop value (`CanvasGrid` `parseCellEntryNumber`). */
|
|
24
|
+
parseStop?(text: string): number | undefined;
|
|
19
25
|
};
|
|
20
26
|
export declare const fillSeriesDialogAtom: import("jotai").PrimitiveAtom<FillSeriesDialogRequest | null> & {
|
|
21
27
|
init: FillSeriesDialogRequest | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-series-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/fill-series-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,uFAAuF;IACvF,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC9C,yEAAyE;IACzE,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"fill-series-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/fill-series-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,uFAAuF;IACvF,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC9C,yEAAyE;IACzE,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yFAAyF;IACzF,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAA6C,CAAC;AAE/E,eAAO,MAAM,wBAAwB,uKAAsC,CAAC;AAE5E,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,kBAGtB,uBAAuB,SAGpC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** One axis of a freeze as it is sent: how many lines, and the first of them (absent = line 1). */
|
|
2
|
+
export type FrozenAxisSent = {
|
|
3
|
+
count?: number;
|
|
4
|
+
start?: number | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The last Freeze Panes / unfreeze this window itself sent, counted, with the area it asked for.
|
|
8
|
+
* `CanvasGrid` reads it so that only this window's own freeze or unfreeze places its view the way a
|
|
9
|
+
* Freeze Panes does (a frozen start, demo-app-monorepo#57258 W-5); the same change arriving from
|
|
10
|
+
* another window keeps the view's first line instead.
|
|
11
|
+
*
|
|
12
|
+
* Set by the engine hook wherever it sends one (`useSpreadsheetEngine`'s `onFreezeRow`,
|
|
13
|
+
* `onFreezeColumn`, and an `onUpdateSheet` that carries frozen counts or starts), by the legacy
|
|
14
|
+
* `useSpreadsheetState` freeze, and by `CanvasGrid`'s own menu, so a host whose ribbon calls those
|
|
15
|
+
* needs nothing more. A host that sends the command some other way calls `useNoteFrozenAreaSent()`
|
|
16
|
+
* right before it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const frozenAreaSentAtom: import("jotai").PrimitiveAtom<{
|
|
19
|
+
seq: number;
|
|
20
|
+
sheetId: number;
|
|
21
|
+
rows?: FrozenAxisSent;
|
|
22
|
+
columns?: FrozenAxisSent;
|
|
23
|
+
} | null> & {
|
|
24
|
+
init: {
|
|
25
|
+
seq: number;
|
|
26
|
+
sheetId: number;
|
|
27
|
+
rows?: FrozenAxisSent;
|
|
28
|
+
columns?: FrozenAxisSent;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
export declare const useFrozenAreaSentValue: () => {
|
|
32
|
+
seq: number;
|
|
33
|
+
sheetId: number;
|
|
34
|
+
rows?: FrozenAxisSent;
|
|
35
|
+
columns?: FrozenAxisSent;
|
|
36
|
+
} | null;
|
|
37
|
+
/** Say "the next frozen-area change on this sheet is my own freeze" (see {@link frozenAreaSentAtom}). */
|
|
38
|
+
export declare const useNoteFrozenAreaSent: () => (sheetId: number, area: {
|
|
39
|
+
rows?: FrozenAxisSent;
|
|
40
|
+
columns?: FrozenAxisSent;
|
|
41
|
+
}) => void;
|
|
42
|
+
//# sourceMappingURL=frozen-area-sent.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frozen-area-sent.atom.d.ts","sourceRoot":"","sources":["../../../atoms/frozen-area-sent.atom.ts"],"names":[],"mappings":"AAGA,mGAAmG;AACnG,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEvE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;SACxB,MAAM;aACF,MAAM;WACR,cAAc;cACX,cAAc;;;aAHnB,MAAM;iBACF,MAAM;eACR,cAAc;kBACX,cAAc;;CACX,CAAC;AAEhB,eAAO,MAAM,sBAAsB;SAN5B,MAAM;aACF,MAAM;WACR,cAAc;cACX,cAAc;QAGkD,CAAC;AAE7E,yGAAyG;AACzG,eAAO,MAAM,qBAAqB,kBAGpB,MAAM,QAAQ;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,SAI9E,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNoteFrozenAreaSent = exports.useFrozenAreaSentValue = exports.frozenAreaSentAtom = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jotai_1 = require("jotai");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
/**
|
|
8
|
+
* The last Freeze Panes / unfreeze this window itself sent, counted, with the area it asked for.
|
|
9
|
+
* `CanvasGrid` reads it so that only this window's own freeze or unfreeze places its view the way a
|
|
10
|
+
* Freeze Panes does (a frozen start, demo-app-monorepo#57258 W-5); the same change arriving from
|
|
11
|
+
* another window keeps the view's first line instead.
|
|
12
|
+
*
|
|
13
|
+
* Set by the engine hook wherever it sends one (`useSpreadsheetEngine`'s `onFreezeRow`,
|
|
14
|
+
* `onFreezeColumn`, and an `onUpdateSheet` that carries frozen counts or starts), by the legacy
|
|
15
|
+
* `useSpreadsheetState` freeze, and by `CanvasGrid`'s own menu, so a host whose ribbon calls those
|
|
16
|
+
* needs nothing more. A host that sends the command some other way calls `useNoteFrozenAreaSent()`
|
|
17
|
+
* right before it.
|
|
18
|
+
*/
|
|
19
|
+
exports.frozenAreaSentAtom = (0, jotai_1.atom)(null);
|
|
20
|
+
var useFrozenAreaSentValue = function () { return (0, jotai_1.useAtomValue)(exports.frozenAreaSentAtom); };
|
|
21
|
+
exports.useFrozenAreaSentValue = useFrozenAreaSentValue;
|
|
22
|
+
/** Say "the next frozen-area change on this sheet is my own freeze" (see {@link frozenAreaSentAtom}). */
|
|
23
|
+
var useNoteFrozenAreaSent = function () {
|
|
24
|
+
var set = (0, jotai_1.useSetAtom)(exports.frozenAreaSentAtom);
|
|
25
|
+
return (0, react_1.useCallback)(function (sheetId, area) {
|
|
26
|
+
return set(function (previous) { var _a; return (tslib_1.__assign({ seq: ((_a = previous === null || previous === void 0 ? void 0 : previous.seq) !== null && _a !== void 0 ? _a : 0) + 1, sheetId: sheetId }, area)); });
|
|
27
|
+
}, [set]);
|
|
28
|
+
};
|
|
29
|
+
exports.useNoteFrozenAreaSent = useNoteFrozenAreaSent;
|
|
@@ -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";
|
|
@@ -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,q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+40,8 @@ tslib_1.__exportStar(require("./insert-cells-dialog.atom"), exports);
|
|
|
40
40
|
tslib_1.__exportStar(require("./insert-options.atom"), exports);
|
|
41
41
|
tslib_1.__exportStar(require("./chart-actions.atom"), exports);
|
|
42
42
|
tslib_1.__exportStar(require("./table-auto-expansion.atom"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./undo-redo-sent.atom"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./frozen-area-sent.atom"), exports);
|
|
43
45
|
tslib_1.__exportStar(require("./flash-fill-options.atom"), exports);
|
|
44
46
|
tslib_1.__exportStar(require("./calculated-column-fill.atom"), exports);
|
|
45
47
|
tslib_1.__exportStar(require("./sparkline-dialog.atom"), exports);
|
|
@@ -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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNoteUndoRedoSent = exports.useUndoRedoSentValue = exports.undoRedoSentAtom = void 0;
|
|
4
|
+
var jotai_1 = require("jotai");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
/**
|
|
7
|
+
* The last undo / redo this window itself sent, counted. `CanvasGrid` reads it so that only this
|
|
8
|
+
* window's own undo or redo of its own Freeze Panes moves its view (a frozen start, demo-app-monorepo
|
|
9
|
+
* #57258 W-5); a change that arrives from another window never does.
|
|
10
|
+
*
|
|
11
|
+
* Set by the engines' undo / redo (`useSpreadsheetEngine`'s `onUndo` / `onRedo` / `undo` / `redo`) and
|
|
12
|
+
* by `CanvasGrid`'s own ⌘Z / ⇧⌘Z, so a host that calls those needs nothing more. A host that runs undo
|
|
13
|
+
* some other way (its own engine call) calls `useNoteUndoRedoSent()` right before it.
|
|
14
|
+
*/
|
|
15
|
+
exports.undoRedoSentAtom = (0, jotai_1.atom)(null);
|
|
16
|
+
var useUndoRedoSentValue = function () { return (0, jotai_1.useAtomValue)(exports.undoRedoSentAtom); };
|
|
17
|
+
exports.useUndoRedoSentValue = useUndoRedoSentValue;
|
|
18
|
+
/** Say "the next change is my own undo / redo" (see {@link undoRedoSentAtom}). */
|
|
19
|
+
var useNoteUndoRedoSent = function () {
|
|
20
|
+
var set = (0, jotai_1.useSetAtom)(exports.undoRedoSentAtom);
|
|
21
|
+
return (0, react_1.useCallback)(function (kind) { return set(function (previous) { var _a; return ({ kind: kind, seq: ((_a = previous === null || previous === void 0 ? void 0 : previous.seq) !== null && _a !== void 0 ? _a : 0) + 1 }); }); }, [set]);
|
|
22
|
+
};
|
|
23
|
+
exports.useNoteUndoRedoSent = useNoteUndoRedoSent;
|
|
@@ -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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AAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,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"}
|
|
@@ -214,14 +214,20 @@ var sameAxis = function (a, b) {
|
|
|
214
214
|
* (demo-app-monorepo#57258 W-5). `undefined` = leave the scroll position as it is (every change
|
|
215
215
|
* without a start, as before).
|
|
216
216
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
217
|
+
* The rule: **a window's view is repositioned only by a freeze, unfreeze, undo or redo that this
|
|
218
|
+
* window itself just sent, and by nothing else.** `pending` is what this window just sent; the change
|
|
219
|
+
* that follows reads it and drops it, matched or not.
|
|
220
|
+
*
|
|
221
|
+
* - **This window's freeze or unfreeze** (`pending.kind` "freeze", and the area is the one it asked
|
|
222
|
+
* for): freezing from a start puts the scrolling area right below the band (0); unfreezing keeps
|
|
223
|
+
* the start's line first on screen. Remembered as `local`, for this window's undo / redo of it.
|
|
224
|
+
* - **This window's undo** (`pending.kind` "undo", taking the area from `local.after` back to
|
|
225
|
+
* `local.before`): back where the view was before the freeze. Its **redo**: as the freeze did.
|
|
226
|
+
* - **Anything else** (another window's freeze, unfreeze, undo or redo, or a change that does not
|
|
227
|
+
* match what this window sent): the same line stays first on screen, at the same depth; the scroll
|
|
228
|
+
* moves by the band's change. When that line now lies in the band or above the start it cannot
|
|
229
|
+
* stay: the view lands on the first scrolling line (0). `local` is forgotten: a later change of the
|
|
230
|
+
* same shape is someone else's.
|
|
225
231
|
*
|
|
226
232
|
* `offset(index)` is a line's offset in the NEW layout; scroll positions are measured from the first
|
|
227
233
|
* scrolling line, as the grid's are.
|
|
@@ -240,27 +246,28 @@ var frozenStartScroll = function (_a) {
|
|
|
240
246
|
}
|
|
241
247
|
return undefined;
|
|
242
248
|
};
|
|
243
|
-
|
|
249
|
+
var consumed = pending !== undefined;
|
|
250
|
+
if ((pending === null || pending === void 0 ? void 0 : pending.kind) === "freeze" && sameAxis(after, pending.expected)) {
|
|
244
251
|
return {
|
|
245
252
|
scroll: asSent(),
|
|
246
|
-
consumed:
|
|
253
|
+
consumed: consumed,
|
|
247
254
|
local: withStart ? { before: before, after: after, scrollBefore: pending.scrollBefore } : undefined,
|
|
248
255
|
};
|
|
249
256
|
}
|
|
250
|
-
if (local && sameAxis(before, local.after) && sameAxis(after, local.before)) {
|
|
251
|
-
return { scroll: local.scrollBefore, consumed:
|
|
257
|
+
if ((pending === null || pending === void 0 ? void 0 : pending.kind) === "undo" && local && sameAxis(before, local.after) && sameAxis(after, local.before)) {
|
|
258
|
+
return { scroll: local.scrollBefore, consumed: consumed, local: local };
|
|
252
259
|
}
|
|
253
|
-
if (local && sameAxis(before, local.before) && sameAxis(after, local.after)) {
|
|
254
|
-
return { scroll: asSent(), consumed:
|
|
260
|
+
if ((pending === null || pending === void 0 ? void 0 : pending.kind) === "redo" && local && sameAxis(before, local.before) && sameAxis(after, local.after)) {
|
|
261
|
+
return { scroll: asSent(), consumed: consumed, local: local };
|
|
255
262
|
}
|
|
256
263
|
if (!withStart || !snapshot)
|
|
257
|
-
return { consumed:
|
|
264
|
+
return { consumed: consumed, local: undefined };
|
|
258
265
|
if (snapshot.topLine < firstScrolling)
|
|
259
|
-
return { scroll: 0, consumed:
|
|
266
|
+
return { scroll: 0, consumed: consumed, local: undefined };
|
|
260
267
|
return {
|
|
261
268
|
scroll: Math.max(0, offset(snapshot.topLine) + snapshot.intoLine - offset(firstScrolling)),
|
|
262
|
-
consumed:
|
|
263
|
-
local:
|
|
269
|
+
consumed: consumed,
|
|
270
|
+
local: undefined,
|
|
264
271
|
};
|
|
265
272
|
};
|
|
266
273
|
exports.frozenStartScroll = frozenStartScroll;
|
|
@@ -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;AAkuQnB,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"}
|