@rowsncolumns/spreadsheet 10.17.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 +145 -0
- package/dist/cjs/components/canvas-grid/frozen-start.d.ts.map +1 -0
- package/dist/cjs/components/canvas-grid/frozen-start.js +273 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +585 -70
- package/dist/cjs/components/canvas-grid/typings.d.ts +31 -8
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +10 -8
- package/dist/cjs/components/embeds/object-cell-offset.d.ts +10 -0
- package/dist/cjs/components/embeds/object-cell-offset.d.ts.map +1 -0
- package/dist/cjs/components/embeds/object-cell-offset.js +12 -0
- 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-export-range.d.ts +12 -1
- package/dist/cjs/hooks/use-export-range.d.ts.map +1 -1
- package/dist/cjs/hooks/use-export-range.js +75 -35
- package/dist/cjs/hooks/use-grid-children.d.ts +20 -1
- package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/cjs/hooks/use-grid-children.js +53 -19
- package/dist/cjs/hooks/use-header-actions.d.ts +3 -1
- package/dist/cjs/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/cjs/hooks/use-header-actions.js +5 -4
- package/dist/cjs/hooks/use-hidden-dimension-markers.d.ts +7 -1
- package/dist/cjs/hooks/use-hidden-dimension-markers.d.ts.map +1 -1
- package/dist/cjs/hooks/use-hidden-dimension-markers.js +9 -5
- package/dist/cjs/hooks/use-selection-interceptors.d.ts +7 -1
- package/dist/cjs/hooks/use-selection-interceptors.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-interceptors.js +14 -3
- 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/hooks/use-sizer.d.ts +9 -1
- package/dist/cjs/hooks/use-sizer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-sizer.js +5 -3
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +7 -0
- package/dist/cjs/types.d.ts.map +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 +145 -0
- package/dist/esm/components/canvas-grid/frozen-start.d.ts.map +1 -0
- package/dist/esm/components/canvas-grid/frozen-start.js +229 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +507 -16
- package/dist/esm/components/canvas-grid/typings.d.ts +31 -8
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +3 -1
- package/dist/esm/components/embeds/object-cell-offset.d.ts +10 -0
- package/dist/esm/components/embeds/object-cell-offset.d.ts.map +1 -0
- package/dist/esm/components/embeds/object-cell-offset.js +9 -0
- 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-export-range.d.ts +12 -1
- package/dist/esm/hooks/use-export-range.d.ts.map +1 -1
- package/dist/esm/hooks/use-export-range.js +31 -4
- package/dist/esm/hooks/use-grid-children.d.ts +20 -1
- package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/esm/hooks/use-grid-children.js +46 -15
- package/dist/esm/hooks/use-header-actions.d.ts +3 -1
- package/dist/esm/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/esm/hooks/use-header-actions.js +3 -2
- package/dist/esm/hooks/use-hidden-dimension-markers.d.ts +7 -1
- package/dist/esm/hooks/use-hidden-dimension-markers.d.ts.map +1 -1
- package/dist/esm/hooks/use-hidden-dimension-markers.js +7 -3
- package/dist/esm/hooks/use-selection-interceptors.d.ts +7 -1
- package/dist/esm/hooks/use-selection-interceptors.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-interceptors.js +15 -4
- 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/hooks/use-sizer.d.ts +9 -1
- package/dist/esm/hooks/use-sizer.d.ts.map +1 -1
- package/dist/esm/hooks/use-sizer.js +5 -3
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +7 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -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,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,yBAAy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Ac,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,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/cjs/atoms/index.js
CHANGED
|
@@ -40,6 +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;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { CellInterface, CellPosition, ItemSizeHint } from "@rowsncolumns/grid";
|
|
2
|
+
/**
|
|
3
|
+
* A sheet frozen while scrolled (demo-app-monorepo#57258 W-5): Excel's Freeze Panes on a sheet
|
|
4
|
+
* scrolled to row 40 freezes from row 40, and rows 1 … 39 stay out of view above the frozen band
|
|
5
|
+
* (`<sheetView topLeftCell>` of a frozen view, stored as `frozenRowStart` / `frozenColumnStart`).
|
|
6
|
+
*
|
|
7
|
+
* The grid draws this with two things only: the rows / columns above the start get NO SIZE in what
|
|
8
|
+
* the grid lays out, and the grid's frozen count covers them (`start − 1 + count`). Everything that
|
|
9
|
+
* is not layout (copy, paste, fill, sort, filters, Find, auto-fit, export, print, the stored sizes)
|
|
10
|
+
* keeps reading the sheet's own sizes and sees those rows as ordinary rows. With no start (or a
|
|
11
|
+
* start of 1) every helper here hands back what it was given, so nothing changes.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* How many rows (or columns) sit above the frozen start: `start − 1`, or 0 when there is no start,
|
|
15
|
+
* the start is 1, nothing is frozen on that axis, or the frozen area would run past the sheet (the
|
|
16
|
+
* engine does not store such a start; a hand-edited document is drawn as if it had none).
|
|
17
|
+
*/
|
|
18
|
+
export declare const linesAboveFrozenStart: (start: number | null | undefined, frozenCount: number | null | undefined, lineCount: number) => number;
|
|
19
|
+
/** Whether a grid row / column index (1-based sheet line) lies above the frozen start. */
|
|
20
|
+
export declare const isAboveFrozenStart: (index: number, linesAbove: number) => boolean;
|
|
21
|
+
/** The grid's size function: lines above the start have no size. The same function without a start. */
|
|
22
|
+
export declare const sizeAboveFrozenStartZero: (size: (index: number) => number, linesAbove: number) => ((index: number) => number);
|
|
23
|
+
type Range = {
|
|
24
|
+
start: number;
|
|
25
|
+
end: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The grid's visible row ranges without the rows above the start: the grid treats rows outside
|
|
29
|
+
* them as having no height (its size-hint path never asks their size). The same array without a
|
|
30
|
+
* start.
|
|
31
|
+
*/
|
|
32
|
+
export declare const rangesWithoutLinesAboveFrozenStart: <T extends Range>(ranges: T[], linesAbove: number) => T[];
|
|
33
|
+
/**
|
|
34
|
+
* The grid's column size hint with the columns above the start listed as exceptions (the grid then
|
|
35
|
+
* asks their size, which is 0). At most 16,383 columns; the same hint without a start.
|
|
36
|
+
*/
|
|
37
|
+
export declare const sizeHintWithLinesAboveFrozenStart: (hint: ItemSizeHint, linesAbove: number) => ItemSizeHint;
|
|
38
|
+
/**
|
|
39
|
+
* The sum of the sheet's own (unscaled) sizes of lines `from … to`, measured the way the grid's
|
|
40
|
+
* size hint describes them: `defaultSize` for every line between exceptions, `size(e)` for an
|
|
41
|
+
* exception, 0 for a line outside `visibleRanges` (rows hidden by a filter). O(exceptions and ranges
|
|
42
|
+
* in the span), whatever its length, so a start at row 1,000,000 costs no more than one at row 40.
|
|
43
|
+
*/
|
|
44
|
+
export declare const sumLineSizes: ({ from, to, size, hint, visibleRanges, }: {
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
size: (index: number) => number;
|
|
48
|
+
hint: ItemSizeHint;
|
|
49
|
+
visibleRanges?: Range[];
|
|
50
|
+
}) => number;
|
|
51
|
+
/**
|
|
52
|
+
* Where an OBJECT lays out a cell (charts, pictures, slicers): the grid's own answer, except for a
|
|
53
|
+
* cell above the frozen start, which is placed where it would be if those lines kept their size:
|
|
54
|
+
* that far above the first frozen line. An object anchored there is then drawn cut at the top of
|
|
55
|
+
* the frozen band (or not at all, when it lies wholly above), never squashed onto the band's edge.
|
|
56
|
+
* `distanceAbove(axis, index)` is the scaled distance from the line's top / left edge to the start.
|
|
57
|
+
*/
|
|
58
|
+
export declare const objectCellOffsetAboveFrozenStart: ({ getCellOffsetFromCoords, rowsAbove, columnsAbove, rowSize, columnSize, distanceAbove, }: {
|
|
59
|
+
getCellOffsetFromCoords: (cell: CellInterface) => CellPosition | undefined;
|
|
60
|
+
rowsAbove: number;
|
|
61
|
+
columnsAbove: number;
|
|
62
|
+
/** Scaled size of one line, as the sheet stores it. */
|
|
63
|
+
rowSize: (index: number) => number;
|
|
64
|
+
columnSize: (index: number) => number;
|
|
65
|
+
distanceAbove: (axis: "row" | "column", index: number) => number;
|
|
66
|
+
}) => (cell: CellInterface) => CellPosition | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Freeze Panes up to a line ("Freeze up to Row 45"): Excel freezes from the top line on screen,
|
|
69
|
+
* `firstShown`, so the count is measured from there and the start is sent when it is not line 1. A
|
|
70
|
+
* line above `firstShown` (reached with the keyboard on a sheet frozen from a start) freezes from
|
|
71
|
+
* line 1. 0 unfreezes, and an unfreeze carries no start.
|
|
72
|
+
*/
|
|
73
|
+
export declare const freezeUpTo: (line: number, firstShown: number) => {
|
|
74
|
+
count: number;
|
|
75
|
+
start?: number;
|
|
76
|
+
};
|
|
77
|
+
/** One axis of a frozen area as the grid lays it out: lines above the start, frozen lines. */
|
|
78
|
+
export type FrozenAxis = {
|
|
79
|
+
lines: number;
|
|
80
|
+
count: number;
|
|
81
|
+
};
|
|
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
|
+
*/
|
|
87
|
+
export type PendingFreeze = {
|
|
88
|
+
kind: "freeze";
|
|
89
|
+
expected: FrozenAxis;
|
|
90
|
+
scrollBefore: number;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "undo";
|
|
93
|
+
} | {
|
|
94
|
+
kind: "redo";
|
|
95
|
+
};
|
|
96
|
+
/** The last freeze or unfreeze from a start this window made, while nothing else has changed the area. */
|
|
97
|
+
export type LocalFreeze = {
|
|
98
|
+
before: FrozenAxis;
|
|
99
|
+
after: FrozenAxis;
|
|
100
|
+
scrollBefore: number;
|
|
101
|
+
};
|
|
102
|
+
/** Where the view was on one axis before a frozen area changed, read in the old layout. */
|
|
103
|
+
export type FrozenViewSnapshot = {
|
|
104
|
+
/** The first scrolling line on screen. */
|
|
105
|
+
topLine: number;
|
|
106
|
+
/** How far into it the view was scrolled (px). */
|
|
107
|
+
intoLine: number;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Where one axis of the view goes when its frozen area changes and a start is involved
|
|
111
|
+
* (demo-app-monorepo#57258 W-5). `undefined` = leave the scroll position as it is (every change
|
|
112
|
+
* without a start, as before).
|
|
113
|
+
*
|
|
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.
|
|
128
|
+
*
|
|
129
|
+
* `offset(index)` is a line's offset in the NEW layout; scroll positions are measured from the first
|
|
130
|
+
* scrolling line, as the grid's are.
|
|
131
|
+
*/
|
|
132
|
+
export declare const frozenStartScroll: ({ before, after, pending, local, snapshot, offset, }: {
|
|
133
|
+
before: FrozenAxis;
|
|
134
|
+
after: FrozenAxis;
|
|
135
|
+
pending?: PendingFreeze;
|
|
136
|
+
local?: LocalFreeze;
|
|
137
|
+
snapshot?: FrozenViewSnapshot;
|
|
138
|
+
offset: (index: number) => number;
|
|
139
|
+
}) => {
|
|
140
|
+
scroll?: number;
|
|
141
|
+
consumed: boolean;
|
|
142
|
+
local?: LocalFreeze;
|
|
143
|
+
};
|
|
144
|
+
export {};
|
|
145
|
+
//# sourceMappingURL=frozen-start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frozen-start.d.ts","sourceRoot":"","sources":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