@rowsncolumns/spreadsheet 10.2.72 → 10.2.74
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/evaluate-formula.d.ts +17 -0
- package/dist/cjs/api/evaluate-formula.d.ts.map +1 -0
- package/dist/cjs/api/evaluate-formula.js +141 -0
- package/dist/cjs/api/go-to.d.ts +19 -0
- package/dist/cjs/api/go-to.d.ts.map +1 -0
- package/dist/cjs/api/go-to.js +49 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.d.ts +36 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.js +36 -0
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts +36 -0
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/go-to-dialog.atom.js +34 -0
- package/dist/cjs/atoms/index.d.ts +4 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +4 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.d.ts +29 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.js +34 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.d.ts +45 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.js +37 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +109 -3
- package/dist/cjs/components/canvas-grid/typings.d.ts +54 -8
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.d.ts +16 -3
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +112 -5
- package/dist/cjs/components/context-menu/total-row-functions.d.ts +32 -0
- package/dist/cjs/components/context-menu/total-row-functions.d.ts.map +1 -0
- package/dist/cjs/components/context-menu/total-row-functions.js +62 -0
- package/dist/cjs/components/evaluate-formula-dialog/index.d.ts +34 -0
- package/dist/cjs/components/evaluate-formula-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/evaluate-formula-dialog/index.js +106 -0
- package/dist/cjs/components/go-to-dialog/index.d.ts +35 -0
- package/dist/cjs/components/go-to-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/go-to-dialog/index.js +93 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts +29 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/paste-special-dialog/index.js +99 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.d.ts +37 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.js +91 -0
- package/dist/cjs/components/toolbar/index.d.ts +1 -0
- package/dist/cjs/components/toolbar/index.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/index.js +1 -0
- package/dist/cjs/components/toolbar/text-rotation-selector.d.ts +29 -0
- package/dist/cjs/components/toolbar/text-rotation-selector.d.ts.map +1 -0
- package/dist/cjs/components/toolbar/text-rotation-selector.js +78 -0
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts +7 -1
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-wrap-selector.js +10 -3
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts +20 -1
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +27 -21
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +17 -2
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +186 -21
- package/dist/cjs/index.d.ts +6 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +173 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/evaluate-formula.d.ts +17 -0
- package/dist/esm/api/evaluate-formula.d.ts.map +1 -0
- package/dist/esm/api/evaluate-formula.js +109 -0
- package/dist/esm/api/go-to.d.ts +19 -0
- package/dist/esm/api/go-to.d.ts.map +1 -0
- package/dist/esm/api/go-to.js +41 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.d.ts +36 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.js +25 -0
- package/dist/esm/atoms/go-to-dialog.atom.d.ts +36 -0
- package/dist/esm/atoms/go-to-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/go-to-dialog.atom.js +25 -0
- package/dist/esm/atoms/index.d.ts +4 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +4 -0
- package/dist/esm/atoms/paste-special-dialog.atom.d.ts +29 -0
- package/dist/esm/atoms/paste-special-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/paste-special-dialog.atom.js +25 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.d.ts +45 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.js +26 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +107 -3
- package/dist/esm/components/canvas-grid/typings.d.ts +54 -8
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.d.ts +16 -3
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +114 -7
- package/dist/esm/components/context-menu/total-row-functions.d.ts +32 -0
- package/dist/esm/components/context-menu/total-row-functions.d.ts.map +1 -0
- package/dist/esm/components/context-menu/total-row-functions.js +50 -0
- package/dist/esm/components/evaluate-formula-dialog/index.d.ts +34 -0
- package/dist/esm/components/evaluate-formula-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/evaluate-formula-dialog/index.js +86 -0
- package/dist/esm/components/go-to-dialog/index.d.ts +35 -0
- package/dist/esm/components/go-to-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/go-to-dialog/index.js +84 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts +29 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/paste-special-dialog/index.js +90 -0
- package/dist/esm/components/remove-duplicates-dialog/index.d.ts +37 -0
- package/dist/esm/components/remove-duplicates-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/remove-duplicates-dialog/index.js +82 -0
- package/dist/esm/components/toolbar/index.d.ts +1 -0
- package/dist/esm/components/toolbar/index.d.ts.map +1 -1
- package/dist/esm/components/toolbar/index.js +1 -0
- package/dist/esm/components/toolbar/text-rotation-selector.d.ts +29 -0
- package/dist/esm/components/toolbar/text-rotation-selector.d.ts.map +1 -0
- package/dist/esm/components/toolbar/text-rotation-selector.js +71 -0
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts +7 -1
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-wrap-selector.js +10 -3
- package/dist/esm/hooks/use-copy-paste-cut.d.ts +20 -1
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +10 -4
- package/dist/esm/hooks/use-keyboard-handler.d.ts +17 -2
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +173 -21
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +173 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EvaluationValue } from "@rowsncolumns/calculator";
|
|
2
|
+
import type { CellInterface } from "@rowsncolumns/grid";
|
|
3
|
+
import type { CanvasGridProps } from "../components/canvas-grid/typings";
|
|
4
|
+
/** `ERROR.TYPE` result → Excel error literal. */
|
|
5
|
+
export declare const ERROR_TYPE_CODES: Record<number, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Build the Evaluate Formula stepper's `evaluate` from the grid's
|
|
8
|
+
* `onRequestCalculate` (the cell editor's live-preview calculator — a
|
|
9
|
+
* read-only scratch evaluation in both engines). A string result is
|
|
10
|
+
* re-typed through the engine (see `retypeDisplayText`); a `FormulaError`
|
|
11
|
+
* instance (unwrapped reference calculator) becomes the error literal; the
|
|
12
|
+
* wrapped calculators report a formula error as an empty result, so a blank
|
|
13
|
+
* answer is re-asked as `ERROR.TYPE(expression)` to recover the error
|
|
14
|
+
* literal and a genuine blank stays `null`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const createExpressionEvaluator: (onRequestCalculate: NonNullable<CanvasGridProps["onRequestCalculate"]>, sheetId: number, cell: CellInterface) => (expression: string) => Promise<EvaluationValue>;
|
|
17
|
+
//# sourceMappingURL=evaluate-formula.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-formula.d.ts","sourceRoot":"","sources":["../../../api/evaluate-formula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASnD,CAAC;AAiFF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,WAAW,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,EACtE,SAAS,MAAM,EACf,MAAM,aAAa,MAIL,YAAY,MAAM,KAAG,OAAO,CAAC,eAAe,CAkB3D,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExpressionEvaluator = exports.ERROR_TYPE_CODES = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
/** `ERROR.TYPE` result → Excel error literal. */
|
|
6
|
+
exports.ERROR_TYPE_CODES = {
|
|
7
|
+
1: "#NULL!",
|
|
8
|
+
2: "#DIV/0!",
|
|
9
|
+
3: "#VALUE!",
|
|
10
|
+
4: "#REF!",
|
|
11
|
+
5: "#NAME?",
|
|
12
|
+
6: "#NUM!",
|
|
13
|
+
7: "#N/A",
|
|
14
|
+
8: "#GETTING_DATA",
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The error code of a `FormulaError`-shaped result (the unwrapped reference
|
|
18
|
+
* `useCalculation().onRequestCalculate` returns the error instance rather
|
|
19
|
+
* than throwing; the wrapped calculators return `undefined`). Duck-typed like
|
|
20
|
+
* the wrapper's `isFormulaErrorLike` so no parser import is needed here.
|
|
21
|
+
*/
|
|
22
|
+
var formulaErrorCode = function (value) {
|
|
23
|
+
if (!(value instanceof Error))
|
|
24
|
+
return undefined;
|
|
25
|
+
var code = value.error;
|
|
26
|
+
return typeof code === "string" && code.startsWith("#") ? code : undefined;
|
|
27
|
+
};
|
|
28
|
+
var toEvaluationValue = function (result) {
|
|
29
|
+
var error = formulaErrorCode(result);
|
|
30
|
+
if (error)
|
|
31
|
+
return { error: error };
|
|
32
|
+
if (Array.isArray(result)) {
|
|
33
|
+
return result.map(function (row) {
|
|
34
|
+
return Array.isArray(row)
|
|
35
|
+
? row.map(function (cell) { return toEvaluationValue(cell); })
|
|
36
|
+
: [toEvaluationValue(row)];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (result === null ||
|
|
40
|
+
result === undefined ||
|
|
41
|
+
typeof result === "string" ||
|
|
42
|
+
typeof result === "number" ||
|
|
43
|
+
typeof result === "boolean" ||
|
|
44
|
+
result instanceof Date) {
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
return String(result);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* `onRequestCalculate` is the cell editor's live preview, so it reports
|
|
51
|
+
* DISPLAY text: the rnc engine stringifies numbers and booleans, the
|
|
52
|
+
* reference wrapper returns the formatted value (`1,234.50`, `$5.00`,
|
|
53
|
+
* `TRUE`). Substituting that text verbatim would turn `=A1=15` into
|
|
54
|
+
* `"15"=15` (FALSE) or `"1,234.50"*2` (#VALUE!), so the text is re-typed
|
|
55
|
+
* through the engine itself: `TYPE(expression)` says number / text /
|
|
56
|
+
* boolean, and a number is re-read as General text (`&""` keeps both probes
|
|
57
|
+
* clear of the cell's number format) so it parses back to a number.
|
|
58
|
+
*/
|
|
59
|
+
var retypeDisplayText = function (text, expression, calculate) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
var typeCode, _a, direct, general, parsed, upper, numeric;
|
|
61
|
+
return tslib_1.__generator(this, function (_b) {
|
|
62
|
+
switch (_b.label) {
|
|
63
|
+
case 0: return [4 /*yield*/, calculate("=TYPE(".concat(expression, ")&\"\""))];
|
|
64
|
+
case 1:
|
|
65
|
+
typeCode = _b.sent();
|
|
66
|
+
_a = typeof typeCode === "string" ? typeCode.trim() : typeCode;
|
|
67
|
+
switch (_a) {
|
|
68
|
+
case "1": return [3 /*break*/, 2];
|
|
69
|
+
case 1: return [3 /*break*/, 2];
|
|
70
|
+
case "4": return [3 /*break*/, 4];
|
|
71
|
+
case 4: return [3 /*break*/, 4];
|
|
72
|
+
}
|
|
73
|
+
return [3 /*break*/, 6];
|
|
74
|
+
case 2:
|
|
75
|
+
direct = Number(text);
|
|
76
|
+
if (Number.isFinite(direct) && text.trim() !== "")
|
|
77
|
+
return [2 /*return*/, direct];
|
|
78
|
+
return [4 /*yield*/, calculate("=(".concat(expression, ")&\"\""))];
|
|
79
|
+
case 3:
|
|
80
|
+
general = _b.sent();
|
|
81
|
+
parsed = Number(typeof general === "string" ? general : NaN);
|
|
82
|
+
return [2 /*return*/, Number.isFinite(parsed) ? parsed : text];
|
|
83
|
+
case 4:
|
|
84
|
+
upper = text.trim().toUpperCase();
|
|
85
|
+
if (upper === "TRUE")
|
|
86
|
+
return [2 /*return*/, true];
|
|
87
|
+
if (upper === "FALSE")
|
|
88
|
+
return [2 /*return*/, false];
|
|
89
|
+
return [4 /*yield*/, calculate("=--(".concat(expression, ")&\"\""))];
|
|
90
|
+
case 5:
|
|
91
|
+
numeric = _b.sent();
|
|
92
|
+
return [2 /*return*/, typeof numeric === "string" ? numeric.trim() === "1" : text];
|
|
93
|
+
case 6: return [2 /*return*/, text];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); };
|
|
97
|
+
/**
|
|
98
|
+
* Build the Evaluate Formula stepper's `evaluate` from the grid's
|
|
99
|
+
* `onRequestCalculate` (the cell editor's live-preview calculator — a
|
|
100
|
+
* read-only scratch evaluation in both engines). A string result is
|
|
101
|
+
* re-typed through the engine (see `retypeDisplayText`); a `FormulaError`
|
|
102
|
+
* instance (unwrapped reference calculator) becomes the error literal; the
|
|
103
|
+
* wrapped calculators report a formula error as an empty result, so a blank
|
|
104
|
+
* answer is re-asked as `ERROR.TYPE(expression)` to recover the error
|
|
105
|
+
* literal and a genuine blank stays `null`.
|
|
106
|
+
*/
|
|
107
|
+
var createExpressionEvaluator = function (onRequestCalculate, sheetId, cell) {
|
|
108
|
+
var calculate = function (formula) {
|
|
109
|
+
return onRequestCalculate(formula, sheetId, cell.rowIndex, cell.columnIndex);
|
|
110
|
+
};
|
|
111
|
+
return function (expression) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var value, _a, errorType, code;
|
|
113
|
+
return tslib_1.__generator(this, function (_b) {
|
|
114
|
+
switch (_b.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
_a = toEvaluationValue;
|
|
117
|
+
return [4 /*yield*/, calculate("=".concat(expression))];
|
|
118
|
+
case 1:
|
|
119
|
+
value = _a.apply(void 0, [_b.sent()]);
|
|
120
|
+
if (typeof value === "string") {
|
|
121
|
+
return [2 /*return*/, retypeDisplayText(value, expression, calculate)];
|
|
122
|
+
}
|
|
123
|
+
if (value !== null && value !== undefined)
|
|
124
|
+
return [2 /*return*/, value];
|
|
125
|
+
return [4 /*yield*/, calculate("=ERROR.TYPE(".concat(expression, ")&\"\""))];
|
|
126
|
+
case 2:
|
|
127
|
+
errorType = _b.sent();
|
|
128
|
+
code = typeof errorType === "number"
|
|
129
|
+
? errorType
|
|
130
|
+
: typeof errorType === "string"
|
|
131
|
+
? Number(errorType)
|
|
132
|
+
: NaN;
|
|
133
|
+
if (exports.ERROR_TYPE_CODES[code]) {
|
|
134
|
+
return [2 /*return*/, { error: exports.ERROR_TYPE_CODES[code] }];
|
|
135
|
+
}
|
|
136
|
+
return [2 /*return*/, null];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); };
|
|
140
|
+
};
|
|
141
|
+
exports.createExpressionEvaluator = createExpressionEvaluator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NamedRange, SheetRange } from "../types";
|
|
2
|
+
export type GoToResolverContext = {
|
|
3
|
+
/** The sheet an unqualified reference (`A1`, `B2:C4`) is resolved against. */
|
|
4
|
+
sheetId: number;
|
|
5
|
+
namedRanges?: NamedRange[] | null;
|
|
6
|
+
/** Resolves `Sheet2!A1` / `'My Sheet'!A1`. Sheet-qualified input fails without it. */
|
|
7
|
+
getSheetId?: (sheetName: string) => number | undefined;
|
|
8
|
+
rowCount?: number;
|
|
9
|
+
columnCount?: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Resolve what the user typed into Excel's Go To box: a defined name (case
|
|
13
|
+
* insensitive), an A1 reference (`A1`, `$B$2:C4`, `A:A`, `3:3`) or a
|
|
14
|
+
* sheet-qualified reference (`Sheet2!A1`, `'My Sheet'!B2:C3`). A leading `=`
|
|
15
|
+
* is tolerated. Returns `undefined` when nothing matches — the dialog shows
|
|
16
|
+
* Excel's "Reference is not valid." then.
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveGoToReference: (input: string, context: GoToResolverContext) => SheetRange | undefined;
|
|
19
|
+
//# sourceMappingURL=go-to.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go-to.d.ts","sourceRoot":"","sources":["../../../api/go-to.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAClC,sFAAsF;IACtF,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAiBF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,SAAS,mBAAmB,KAC3B,UAAU,GAAG,SA6Bf,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveGoToReference = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var utils_1 = require("@rowsncolumns/utils");
|
|
6
|
+
// Rows are 1-based: `A0` / `0:0` are "Reference is not valid." in Excel (on
|
|
7
|
+
// this grid row 0 is the column header).
|
|
8
|
+
var CELL = "\\$?[A-Za-z]{1,3}\\$?[1-9]\\d*";
|
|
9
|
+
var COLUMN = "\\$?[A-Za-z]{1,3}";
|
|
10
|
+
var ROW = "\\$?[1-9]\\d*";
|
|
11
|
+
var A1_REFERENCE = new RegExp("^(?:".concat(CELL, "(?::").concat(CELL, ")?|").concat(COLUMN, ":").concat(COLUMN, "|").concat(ROW, ":").concat(ROW, ")$"));
|
|
12
|
+
/** `'My Sheet'` → `My Sheet` (doubled quotes unescaped); bare names pass through. */
|
|
13
|
+
var unquoteSheetName = function (name) {
|
|
14
|
+
return name.startsWith("'") && name.endsWith("'") && name.length >= 2
|
|
15
|
+
? name.slice(1, -1).replace(/''/g, "'")
|
|
16
|
+
: name;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolve what the user typed into Excel's Go To box: a defined name (case
|
|
20
|
+
* insensitive), an A1 reference (`A1`, `$B$2:C4`, `A:A`, `3:3`) or a
|
|
21
|
+
* sheet-qualified reference (`Sheet2!A1`, `'My Sheet'!B2:C3`). A leading `=`
|
|
22
|
+
* is tolerated. Returns `undefined` when nothing matches — the dialog shows
|
|
23
|
+
* Excel's "Reference is not valid." then.
|
|
24
|
+
*/
|
|
25
|
+
var resolveGoToReference = function (input, context) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
var text = input.trim().replace(/^=/, "").trim();
|
|
28
|
+
if (!text)
|
|
29
|
+
return undefined;
|
|
30
|
+
var named = (_a = context.namedRanges) === null || _a === void 0 ? void 0 : _a.find(function (range) { return range.name.toLowerCase() === text.toLowerCase(); });
|
|
31
|
+
if (named === null || named === void 0 ? void 0 : named.range) {
|
|
32
|
+
return tslib_1.__assign({}, named.range);
|
|
33
|
+
}
|
|
34
|
+
var sheetId = context.sheetId;
|
|
35
|
+
var reference = text;
|
|
36
|
+
var bang = text.lastIndexOf("!");
|
|
37
|
+
if (bang !== -1) {
|
|
38
|
+
var sheetName = unquoteSheetName(text.slice(0, bang).trim());
|
|
39
|
+
reference = text.slice(bang + 1).trim();
|
|
40
|
+
var resolved = (_b = context.getSheetId) === null || _b === void 0 ? void 0 : _b.call(context, sheetName);
|
|
41
|
+
if (resolved === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
sheetId = resolved;
|
|
44
|
+
}
|
|
45
|
+
if (!A1_REFERENCE.test(reference))
|
|
46
|
+
return undefined;
|
|
47
|
+
return (0, utils_1.addressToSheetRange)(reference.toUpperCase(), sheetId, context.rowCount, context.columnCount);
|
|
48
|
+
};
|
|
49
|
+
exports.resolveGoToReference = resolveGoToReference;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EvaluationValue } from "@rowsncolumns/calculator";
|
|
2
|
+
import type { CellInterface } from "@rowsncolumns/grid";
|
|
3
|
+
/**
|
|
4
|
+
* Open-state + payload for the Evaluate Formula dialog (Excel → Formulas →
|
|
5
|
+
* Evaluate Formula). The grid opens it for the active cell with a read-only
|
|
6
|
+
* `evaluate` that scratch-evaluates a sub-expression through the host's
|
|
7
|
+
* calculator (`onRequestCalculate`); nothing is written back.
|
|
8
|
+
*/
|
|
9
|
+
export type EvaluateFormulaDialogRequest = {
|
|
10
|
+
sheetId: number;
|
|
11
|
+
cell: CellInterface;
|
|
12
|
+
sheetName?: string;
|
|
13
|
+
/** The cell's formula, including the leading `=`. */
|
|
14
|
+
formula: string;
|
|
15
|
+
/** Evaluates `expression` (no leading `=`) in the cell's context. */
|
|
16
|
+
evaluate: (expression: string) => Promise<EvaluationValue>;
|
|
17
|
+
};
|
|
18
|
+
export declare const evaluateFormulaDialogAtom: import("jotai").PrimitiveAtom<EvaluateFormulaDialogRequest | null> & {
|
|
19
|
+
init: EvaluateFormulaDialogRequest | null;
|
|
20
|
+
};
|
|
21
|
+
export declare const useEvaluateFormulaDialogState: () => [EvaluateFormulaDialogRequest | null, (args_0: EvaluateFormulaDialogRequest | ((prev: EvaluateFormulaDialogRequest | null) => EvaluateFormulaDialogRequest | null) | null) => void];
|
|
22
|
+
/**
|
|
23
|
+
* Number of mounted `EvaluateFormulaDialogHost`s. The grid only claims the trigger
|
|
24
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
25
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
26
|
+
*/
|
|
27
|
+
export declare const evaluateFormulaDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
28
|
+
init: number;
|
|
29
|
+
};
|
|
30
|
+
/** True when at least one `EvaluateFormulaDialogHost` is mounted. */
|
|
31
|
+
export declare const useIsEvaluateFormulaDialogMounted: () => boolean;
|
|
32
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
33
|
+
export declare const useRegisterEvaluateFormulaDialogHost: () => void;
|
|
34
|
+
/** Returns a function that opens the host-mounted Evaluate Formula dialog. */
|
|
35
|
+
export declare const useOpenEvaluateFormulaDialog: () => (request: EvaluateFormulaDialogRequest) => void;
|
|
36
|
+
//# sourceMappingURL=evaluate-formula-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-formula-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/evaluate-formula-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,yBAAyB;;CACW,CAAC;AAElD,eAAO,MAAM,6BAA6B,2LACN,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,kCAAkC;;CAAU,CAAC;AAE1D,qEAAqE;AACrE,eAAO,MAAM,iCAAiC,eACQ,CAAC;AAEvD,yEAAyE;AACzE,eAAO,MAAM,oCAAoC,YAMhD,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,kBAG3B,4BAA4B,SAGzC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenEvaluateFormulaDialog = exports.useRegisterEvaluateFormulaDialogHost = exports.useIsEvaluateFormulaDialogMounted = exports.evaluateFormulaDialogHostCountAtom = exports.useEvaluateFormulaDialogState = exports.evaluateFormulaDialogAtom = void 0;
|
|
4
|
+
var jotai_1 = require("jotai");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
exports.evaluateFormulaDialogAtom = (0, jotai_1.atom)(null);
|
|
7
|
+
var useEvaluateFormulaDialogState = function () {
|
|
8
|
+
return (0, jotai_1.useAtom)(exports.evaluateFormulaDialogAtom);
|
|
9
|
+
};
|
|
10
|
+
exports.useEvaluateFormulaDialogState = useEvaluateFormulaDialogState;
|
|
11
|
+
/**
|
|
12
|
+
* Number of mounted `EvaluateFormulaDialogHost`s. The grid only claims the trigger
|
|
13
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
14
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
15
|
+
*/
|
|
16
|
+
exports.evaluateFormulaDialogHostCountAtom = (0, jotai_1.atom)(0);
|
|
17
|
+
/** True when at least one `EvaluateFormulaDialogHost` is mounted. */
|
|
18
|
+
var useIsEvaluateFormulaDialogMounted = function () {
|
|
19
|
+
return (0, jotai_1.useAtomValue)(exports.evaluateFormulaDialogHostCountAtom) > 0;
|
|
20
|
+
};
|
|
21
|
+
exports.useIsEvaluateFormulaDialogMounted = useIsEvaluateFormulaDialogMounted;
|
|
22
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
23
|
+
var useRegisterEvaluateFormulaDialogHost = function () {
|
|
24
|
+
var setCount = (0, jotai_1.useSetAtom)(exports.evaluateFormulaDialogHostCountAtom);
|
|
25
|
+
(0, react_1.useEffect)(function () {
|
|
26
|
+
setCount(function (count) { return count + 1; });
|
|
27
|
+
return function () { return setCount(function (count) { return count - 1; }); };
|
|
28
|
+
}, [setCount]);
|
|
29
|
+
};
|
|
30
|
+
exports.useRegisterEvaluateFormulaDialogHost = useRegisterEvaluateFormulaDialogHost;
|
|
31
|
+
/** Returns a function that opens the host-mounted Evaluate Formula dialog. */
|
|
32
|
+
var useOpenEvaluateFormulaDialog = function () {
|
|
33
|
+
var setRequest = (0, jotai_1.useSetAtom)(exports.evaluateFormulaDialogAtom);
|
|
34
|
+
return (0, react_1.useCallback)(function (request) { return setRequest(request); }, [setRequest]);
|
|
35
|
+
};
|
|
36
|
+
exports.useOpenEvaluateFormulaDialog = useOpenEvaluateFormulaDialog;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CellInterface } from "@rowsncolumns/grid";
|
|
2
|
+
import type { NamedRange, SheetRange } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Open-state + payload for the Go To dialog (Excel `Ctrl+G` / `F5`). The grid
|
|
5
|
+
* opens it with everything needed to resolve a reference against the
|
|
6
|
+
* workbook; the host-mounted dialog hands the resolved range to `onNavigate`.
|
|
7
|
+
*/
|
|
8
|
+
export type GoToDialogRequest = {
|
|
9
|
+
sheetId: number;
|
|
10
|
+
activeCell: CellInterface;
|
|
11
|
+
namedRanges?: NamedRange[] | null;
|
|
12
|
+
getSheetId?: (sheetName: string) => number | undefined;
|
|
13
|
+
getSheetName?: (sheetId: number) => string | undefined;
|
|
14
|
+
rowCount?: number;
|
|
15
|
+
columnCount?: number;
|
|
16
|
+
onNavigate: (range: SheetRange) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const goToDialogAtom: import("jotai").PrimitiveAtom<GoToDialogRequest | null> & {
|
|
19
|
+
init: GoToDialogRequest | null;
|
|
20
|
+
};
|
|
21
|
+
export declare const useGoToDialogState: () => [GoToDialogRequest | null, (args_0: GoToDialogRequest | ((prev: GoToDialogRequest | null) => GoToDialogRequest | null) | null) => void];
|
|
22
|
+
/**
|
|
23
|
+
* Number of mounted `GoToDialogHost`s. The grid only claims the trigger
|
|
24
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
25
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
26
|
+
*/
|
|
27
|
+
export declare const goToDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
28
|
+
init: number;
|
|
29
|
+
};
|
|
30
|
+
/** True when at least one `GoToDialogHost` is mounted. */
|
|
31
|
+
export declare const useIsGoToDialogMounted: () => boolean;
|
|
32
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
33
|
+
export declare const useRegisterGoToDialogHost: () => void;
|
|
34
|
+
/** Returns a function that opens the host-mounted Go To dialog. */
|
|
35
|
+
export declare const useOpenGoToDialog: () => (request: GoToDialogRequest) => void;
|
|
36
|
+
//# sourceMappingURL=go-to-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go-to-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/go-to-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,cAAc;;CAAuC,CAAC;AAEnE,eAAO,MAAM,kBAAkB,+IAAgC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAAU,CAAC;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,eACQ,CAAC;AAE5C,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,YAMrC,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,kBAGhB,iBAAiB,SAG9B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenGoToDialog = exports.useRegisterGoToDialogHost = exports.useIsGoToDialogMounted = exports.goToDialogHostCountAtom = exports.useGoToDialogState = exports.goToDialogAtom = void 0;
|
|
4
|
+
var jotai_1 = require("jotai");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
exports.goToDialogAtom = (0, jotai_1.atom)(null);
|
|
7
|
+
var useGoToDialogState = function () { return (0, jotai_1.useAtom)(exports.goToDialogAtom); };
|
|
8
|
+
exports.useGoToDialogState = useGoToDialogState;
|
|
9
|
+
/**
|
|
10
|
+
* Number of mounted `GoToDialogHost`s. The grid only claims the trigger
|
|
11
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
12
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
13
|
+
*/
|
|
14
|
+
exports.goToDialogHostCountAtom = (0, jotai_1.atom)(0);
|
|
15
|
+
/** True when at least one `GoToDialogHost` is mounted. */
|
|
16
|
+
var useIsGoToDialogMounted = function () {
|
|
17
|
+
return (0, jotai_1.useAtomValue)(exports.goToDialogHostCountAtom) > 0;
|
|
18
|
+
};
|
|
19
|
+
exports.useIsGoToDialogMounted = useIsGoToDialogMounted;
|
|
20
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
21
|
+
var useRegisterGoToDialogHost = function () {
|
|
22
|
+
var setCount = (0, jotai_1.useSetAtom)(exports.goToDialogHostCountAtom);
|
|
23
|
+
(0, react_1.useEffect)(function () {
|
|
24
|
+
setCount(function (count) { return count + 1; });
|
|
25
|
+
return function () { return setCount(function (count) { return count - 1; }); };
|
|
26
|
+
}, [setCount]);
|
|
27
|
+
};
|
|
28
|
+
exports.useRegisterGoToDialogHost = useRegisterGoToDialogHost;
|
|
29
|
+
/** Returns a function that opens the host-mounted Go To dialog. */
|
|
30
|
+
var useOpenGoToDialog = function () {
|
|
31
|
+
var setRequest = (0, jotai_1.useSetAtom)(exports.goToDialogAtom);
|
|
32
|
+
return (0, react_1.useCallback)(function (request) { return setRequest(request); }, [setRequest]);
|
|
33
|
+
};
|
|
34
|
+
exports.useOpenGoToDialog = useOpenGoToDialog;
|
|
@@ -15,4 +15,8 @@ export * from "./paste-menu.atom";
|
|
|
15
15
|
export * from "./magic-fill-state.atom";
|
|
16
16
|
export * from "./validation-alert.atom";
|
|
17
17
|
export * from "./sort-dialog.atom";
|
|
18
|
+
export * from "./paste-special-dialog.atom";
|
|
19
|
+
export * from "./go-to-dialog.atom";
|
|
20
|
+
export * from "./evaluate-formula-dialog.atom";
|
|
21
|
+
export * from "./remove-duplicates-dialog.atom";
|
|
18
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
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,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
|
package/dist/cjs/atoms/index.js
CHANGED
|
@@ -20,3 +20,7 @@ tslib_1.__exportStar(require("./paste-menu.atom"), exports);
|
|
|
20
20
|
tslib_1.__exportStar(require("./magic-fill-state.atom"), exports);
|
|
21
21
|
tslib_1.__exportStar(require("./validation-alert.atom"), exports);
|
|
22
22
|
tslib_1.__exportStar(require("./sort-dialog.atom"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./paste-special-dialog.atom"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./go-to-dialog.atom"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./evaluate-formula-dialog.atom"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./remove-duplicates-dialog.atom"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PasteSpecialOptions } from "../hooks/use-copy-paste-cut";
|
|
2
|
+
/**
|
|
3
|
+
* Open-state + payload for the Paste Special dialog (Excel `Ctrl+Alt+V` /
|
|
4
|
+
* context menu → Paste special…). The grid opens it with the paste callback
|
|
5
|
+
* of the current sheet; the host-mounted dialog routes the chosen options
|
|
6
|
+
* back through `onApply`.
|
|
7
|
+
*/
|
|
8
|
+
export type PasteSpecialDialogRequest = {
|
|
9
|
+
onApply: (options: PasteSpecialOptions) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const pasteSpecialDialogAtom: import("jotai").PrimitiveAtom<PasteSpecialDialogRequest | null> & {
|
|
12
|
+
init: PasteSpecialDialogRequest | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const usePasteSpecialDialogState: () => [PasteSpecialDialogRequest | null, (args_0: PasteSpecialDialogRequest | ((prev: PasteSpecialDialogRequest | null) => PasteSpecialDialogRequest | null) | null) => void];
|
|
15
|
+
/**
|
|
16
|
+
* Number of mounted `PasteSpecialDialogHost`s. The grid only claims the trigger
|
|
17
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
18
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
19
|
+
*/
|
|
20
|
+
export declare const pasteSpecialDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
21
|
+
init: number;
|
|
22
|
+
};
|
|
23
|
+
/** True when at least one `PasteSpecialDialogHost` is mounted. */
|
|
24
|
+
export declare const useIsPasteSpecialDialogMounted: () => boolean;
|
|
25
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
26
|
+
export declare const useRegisterPasteSpecialDialogHost: () => void;
|
|
27
|
+
/** Returns a function that opens the host-mounted Paste Special dialog. */
|
|
28
|
+
export declare const useOpenPasteSpecialDialog: () => (request: PasteSpecialDialogRequest) => void;
|
|
29
|
+
//# sourceMappingURL=paste-special-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-special-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/paste-special-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAElC,CAAC;AAEF,eAAO,MAAM,0BAA0B,+KAAwC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;CAAU,CAAC;AAEvD,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,eACQ,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,iCAAiC,YAM7C,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,kBAGxB,yBAAyB,SAGtC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenPasteSpecialDialog = exports.useRegisterPasteSpecialDialogHost = exports.useIsPasteSpecialDialogMounted = exports.pasteSpecialDialogHostCountAtom = exports.usePasteSpecialDialogState = exports.pasteSpecialDialogAtom = void 0;
|
|
4
|
+
var jotai_1 = require("jotai");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
exports.pasteSpecialDialogAtom = (0, jotai_1.atom)(null);
|
|
7
|
+
var usePasteSpecialDialogState = function () { return (0, jotai_1.useAtom)(exports.pasteSpecialDialogAtom); };
|
|
8
|
+
exports.usePasteSpecialDialogState = usePasteSpecialDialogState;
|
|
9
|
+
/**
|
|
10
|
+
* Number of mounted `PasteSpecialDialogHost`s. The grid only claims the trigger
|
|
11
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
12
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
13
|
+
*/
|
|
14
|
+
exports.pasteSpecialDialogHostCountAtom = (0, jotai_1.atom)(0);
|
|
15
|
+
/** True when at least one `PasteSpecialDialogHost` is mounted. */
|
|
16
|
+
var useIsPasteSpecialDialogMounted = function () {
|
|
17
|
+
return (0, jotai_1.useAtomValue)(exports.pasteSpecialDialogHostCountAtom) > 0;
|
|
18
|
+
};
|
|
19
|
+
exports.useIsPasteSpecialDialogMounted = useIsPasteSpecialDialogMounted;
|
|
20
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
21
|
+
var useRegisterPasteSpecialDialogHost = function () {
|
|
22
|
+
var setCount = (0, jotai_1.useSetAtom)(exports.pasteSpecialDialogHostCountAtom);
|
|
23
|
+
(0, react_1.useEffect)(function () {
|
|
24
|
+
setCount(function (count) { return count + 1; });
|
|
25
|
+
return function () { return setCount(function (count) { return count - 1; }); };
|
|
26
|
+
}, [setCount]);
|
|
27
|
+
};
|
|
28
|
+
exports.useRegisterPasteSpecialDialogHost = useRegisterPasteSpecialDialogHost;
|
|
29
|
+
/** Returns a function that opens the host-mounted Paste Special dialog. */
|
|
30
|
+
var useOpenPasteSpecialDialog = function () {
|
|
31
|
+
var setRequest = (0, jotai_1.useSetAtom)(exports.pasteSpecialDialogAtom);
|
|
32
|
+
return (0, react_1.useCallback)(function (request) { return setRequest(request); }, [setRequest]);
|
|
33
|
+
};
|
|
34
|
+
exports.useOpenPasteSpecialDialog = useOpenPasteSpecialDialog;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RemoveDuplicatesOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* One column of the range being de-duplicated.
|
|
4
|
+
*/
|
|
5
|
+
export type RemoveDuplicatesDialogColumn = {
|
|
6
|
+
/** Absolute sheet column index. */
|
|
7
|
+
columnIndex: number;
|
|
8
|
+
/** Positional label, e.g. "Column B". */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Text of the first row, shown instead of `label` when "My data has headers" is on. */
|
|
11
|
+
header?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Open-state + payload for the Remove Duplicates dialog. The context menu
|
|
15
|
+
* (which unmounts when it closes) opens the dialog by setting this atom; the
|
|
16
|
+
* dialog itself is host-mounted so it survives the menu closing. Mirrors the
|
|
17
|
+
* Sort dialog atom pattern.
|
|
18
|
+
*/
|
|
19
|
+
export type RemoveDuplicatesDialogRequest = {
|
|
20
|
+
columns: RemoveDuplicatesDialogColumn[];
|
|
21
|
+
/** Initial state of "My data has headers". */
|
|
22
|
+
hasHeader: boolean;
|
|
23
|
+
/** Routed to `onRemoveDuplicates` by the opener. */
|
|
24
|
+
onApply: (options: RemoveDuplicatesOptions) => void;
|
|
25
|
+
};
|
|
26
|
+
export declare const removeDuplicatesDialogAtom: import("jotai").PrimitiveAtom<RemoveDuplicatesDialogRequest | null> & {
|
|
27
|
+
init: RemoveDuplicatesDialogRequest | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Number of mounted `RemoveDuplicatesDialogHost`s. Openers fall back to an
|
|
31
|
+
* immediate de-dupe when no host is mounted, so a host that has not adopted
|
|
32
|
+
* the dialog keeps the previous one-click behaviour instead of a dead menu
|
|
33
|
+
* item.
|
|
34
|
+
*/
|
|
35
|
+
export declare const removeDuplicatesDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
36
|
+
init: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const useRemoveDuplicatesDialogState: () => [RemoveDuplicatesDialogRequest | null, (args_0: RemoveDuplicatesDialogRequest | ((prev: RemoveDuplicatesDialogRequest | null) => RemoveDuplicatesDialogRequest | null) | null) => void];
|
|
39
|
+
/** Returns a function that opens the host-mounted Remove Duplicates dialog. */
|
|
40
|
+
export declare const useOpenRemoveDuplicatesDialog: () => (request: RemoveDuplicatesDialogRequest) => void;
|
|
41
|
+
/** True when at least one `RemoveDuplicatesDialogHost` is mounted. */
|
|
42
|
+
export declare const useIsRemoveDuplicatesDialogMounted: () => boolean;
|
|
43
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
44
|
+
export declare const useRegisterRemoveDuplicatesDialogHost: () => void;
|
|
45
|
+
//# sourceMappingURL=remove-duplicates-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-duplicates-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/remove-duplicates-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,0BAA0B;;CACW,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC;;CAAU,CAAC;AAE3D,eAAO,MAAM,8BAA8B,+LACN,CAAC;AAEtC,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,kBAG5B,6BAA6B,SAG1C,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,kCAAkC,eACQ,CAAC;AAExD,yEAAyE;AACzE,eAAO,MAAM,qCAAqC,YAMjD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRegisterRemoveDuplicatesDialogHost = exports.useIsRemoveDuplicatesDialogMounted = exports.useOpenRemoveDuplicatesDialog = exports.useRemoveDuplicatesDialogState = exports.removeDuplicatesDialogHostCountAtom = exports.removeDuplicatesDialogAtom = void 0;
|
|
4
|
+
var jotai_1 = require("jotai");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
exports.removeDuplicatesDialogAtom = (0, jotai_1.atom)(null);
|
|
7
|
+
/**
|
|
8
|
+
* Number of mounted `RemoveDuplicatesDialogHost`s. Openers fall back to an
|
|
9
|
+
* immediate de-dupe when no host is mounted, so a host that has not adopted
|
|
10
|
+
* the dialog keeps the previous one-click behaviour instead of a dead menu
|
|
11
|
+
* item.
|
|
12
|
+
*/
|
|
13
|
+
exports.removeDuplicatesDialogHostCountAtom = (0, jotai_1.atom)(0);
|
|
14
|
+
var useRemoveDuplicatesDialogState = function () {
|
|
15
|
+
return (0, jotai_1.useAtom)(exports.removeDuplicatesDialogAtom);
|
|
16
|
+
};
|
|
17
|
+
exports.useRemoveDuplicatesDialogState = useRemoveDuplicatesDialogState;
|
|
18
|
+
/** Returns a function that opens the host-mounted Remove Duplicates dialog. */
|
|
19
|
+
var useOpenRemoveDuplicatesDialog = function () {
|
|
20
|
+
var setRequest = (0, jotai_1.useSetAtom)(exports.removeDuplicatesDialogAtom);
|
|
21
|
+
return (0, react_1.useCallback)(function (request) { return setRequest(request); }, [setRequest]);
|
|
22
|
+
};
|
|
23
|
+
exports.useOpenRemoveDuplicatesDialog = useOpenRemoveDuplicatesDialog;
|
|
24
|
+
/** True when at least one `RemoveDuplicatesDialogHost` is mounted. */
|
|
25
|
+
var useIsRemoveDuplicatesDialogMounted = function () {
|
|
26
|
+
return (0, jotai_1.useAtomValue)(exports.removeDuplicatesDialogHostCountAtom) > 0;
|
|
27
|
+
};
|
|
28
|
+
exports.useIsRemoveDuplicatesDialogMounted = useIsRemoveDuplicatesDialogMounted;
|
|
29
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
30
|
+
var useRegisterRemoveDuplicatesDialogHost = function () {
|
|
31
|
+
var setCount = (0, jotai_1.useSetAtom)(exports.removeDuplicatesDialogHostCountAtom);
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
33
|
+
setCount(function (count) { return count + 1; });
|
|
34
|
+
return function () { return setCount(function (count) { return count - 1; }); };
|
|
35
|
+
}, [setCount]);
|
|
36
|
+
};
|
|
37
|
+
exports.useRegisterRemoveDuplicatesDialogHost = useRegisterRemoveDuplicatesDialogHost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AA2CA,OAAO,KASN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AA2CA,OAAO,KASN,MAAM,OAAO,CAAC;AA2Kf,OAAO,KAAK,EAEV,QAAQ,EAST,MAAM,aAAa,CAAC;AAarB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AA2wJnB,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"}
|