@rowsncolumns/spreadsheet 10.5.17 → 10.6.4
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/cf-data-bar.d.ts +73 -0
- package/dist/cjs/api/cf-data-bar.d.ts.map +1 -0
- package/dist/cjs/api/cf-data-bar.js +182 -0
- package/dist/cjs/api/cf-icons.d.ts +73 -0
- package/dist/cjs/api/cf-icons.d.ts.map +1 -0
- package/dist/cjs/api/cf-icons.js +322 -0
- package/dist/cjs/api/cf-overlays.d.ts +89 -3
- package/dist/cjs/api/cf-overlays.d.ts.map +1 -1
- package/dist/cjs/api/cf-overlays.js +256 -80
- package/dist/cjs/api/cf-priority.d.ts +34 -0
- package/dist/cjs/api/cf-priority.d.ts.map +1 -0
- package/dist/cjs/api/cf-priority.js +94 -0
- package/dist/cjs/api/heatmap.d.ts +7 -1
- package/dist/cjs/api/heatmap.d.ts.map +1 -1
- package/dist/cjs/api/heatmap.js +27 -11
- package/dist/cjs/api/selections.d.ts +2 -2
- package/dist/cjs/api/validation.d.ts +6 -0
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +10 -1
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts +8 -3
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts.map +1 -1
- 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/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +194 -51
- package/dist/cjs/components/canvas-grid/overflow.d.ts +37 -0
- package/dist/cjs/components/canvas-grid/overflow.d.ts.map +1 -0
- package/dist/cjs/components/canvas-grid/overflow.js +49 -0
- package/dist/cjs/components/canvas-grid/page-breaks.d.ts +15 -0
- package/dist/cjs/components/canvas-grid/page-breaks.d.ts.map +1 -0
- package/dist/cjs/components/canvas-grid/page-breaks.js +77 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts +32 -3
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.d.ts +58 -1
- package/dist/cjs/components/cell/alignment.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.js +144 -1
- package/dist/cjs/components/cell/cell-background.d.ts +2 -0
- package/dist/cjs/components/cell/cell-background.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-background.js +5 -6
- package/dist/cjs/components/cell/cell-backgrounds.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-backgrounds.js +5 -1
- package/dist/cjs/components/cell/cell-text-runs.js +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +378 -37
- package/dist/cjs/components/cell/number-format-layout.d.ts +35 -0
- package/dist/cjs/components/cell/number-format-layout.d.ts.map +1 -0
- package/dist/cjs/components/cell/number-format-layout.js +106 -0
- package/dist/cjs/components/cell/typings.d.ts +22 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +2 -2
- package/dist/cjs/components/cell-filter/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-filter/index.js +3 -3
- package/dist/cjs/components/cell-overlay/index.d.ts +20 -0
- package/dist/cjs/components/cell-overlay/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-overlay/index.js +155 -28
- package/dist/cjs/components/cf-icon-preview/index.d.ts +16 -0
- package/dist/cjs/components/cf-icon-preview/index.d.ts.map +1 -0
- package/dist/cjs/components/cf-icon-preview/index.js +48 -0
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +11 -3
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +3 -2
- package/dist/cjs/components/goal-seek-dialog/index.d.ts +15 -5
- package/dist/cjs/components/goal-seek-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/goal-seek-dialog/index.js +145 -42
- package/dist/cjs/components/hidden-markers/index.d.ts.map +1 -1
- package/dist/cjs/components/hidden-markers/index.js +8 -7
- package/dist/cjs/components/hidden-markers/style.d.ts +7 -0
- package/dist/cjs/components/hidden-markers/style.d.ts.map +1 -1
- package/dist/cjs/components/hidden-markers/style.js +13 -2
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts +67 -0
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/index.js +196 -0
- package/dist/cjs/components/toolbar/types.d.ts +1 -1
- package/dist/cjs/components/toolbar/types.d.ts.map +1 -1
- package/dist/cjs/config.d.ts +13 -1
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +15 -3
- package/dist/cjs/helpers.d.ts +10 -5
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +43 -31
- package/dist/cjs/hooks/use-border-styles.d.ts.map +1 -1
- package/dist/cjs/hooks/use-border-styles.js +5 -28
- package/dist/cjs/hooks/use-cell-renderer.d.ts +35 -3
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +85 -47
- package/dist/cjs/hooks/use-conditional-formatting.d.ts +13 -1
- package/dist/cjs/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/cjs/hooks/use-conditional-formatting.js +281 -230
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/themes.d.ts +8 -0
- package/dist/cjs/themes.d.ts.map +1 -1
- package/dist/cjs/themes.js +21 -3
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +115 -5
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/cf-data-bar.d.ts +73 -0
- package/dist/esm/api/cf-data-bar.d.ts.map +1 -0
- package/dist/esm/api/cf-data-bar.js +178 -0
- package/dist/esm/api/cf-icons.d.ts +73 -0
- package/dist/esm/api/cf-icons.d.ts.map +1 -0
- package/dist/esm/api/cf-icons.js +306 -0
- package/dist/esm/api/cf-overlays.d.ts +89 -3
- package/dist/esm/api/cf-overlays.d.ts.map +1 -1
- package/dist/esm/api/cf-overlays.js +223 -67
- package/dist/esm/api/cf-priority.d.ts +34 -0
- package/dist/esm/api/cf-priority.d.ts.map +1 -0
- package/dist/esm/api/cf-priority.js +61 -0
- package/dist/esm/api/heatmap.d.ts +7 -1
- package/dist/esm/api/heatmap.d.ts.map +1 -1
- package/dist/esm/api/heatmap.js +24 -9
- package/dist/esm/api/selections.d.ts +2 -2
- package/dist/esm/api/validation.d.ts +6 -0
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +6 -0
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts +8 -3
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts.map +1 -1
- 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/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +163 -47
- package/dist/esm/components/canvas-grid/overflow.d.ts +37 -0
- package/dist/esm/components/canvas-grid/overflow.d.ts.map +1 -0
- package/dist/esm/components/canvas-grid/overflow.js +39 -0
- package/dist/esm/components/canvas-grid/page-breaks.d.ts +15 -0
- package/dist/esm/components/canvas-grid/page-breaks.d.ts.map +1 -0
- package/dist/esm/components/canvas-grid/page-breaks.js +50 -0
- package/dist/esm/components/canvas-grid/typings.d.ts +32 -3
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.d.ts +58 -1
- package/dist/esm/components/cell/alignment.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.js +110 -1
- package/dist/esm/components/cell/cell-background.d.ts +2 -0
- package/dist/esm/components/cell/cell-background.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-background.js +4 -5
- package/dist/esm/components/cell/cell-backgrounds.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-backgrounds.js +5 -1
- package/dist/esm/components/cell/cell-text-runs.js +2 -2
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +339 -39
- package/dist/esm/components/cell/number-format-layout.d.ts +35 -0
- package/dist/esm/components/cell/number-format-layout.d.ts.map +1 -0
- package/dist/esm/components/cell/number-format-layout.js +99 -0
- package/dist/esm/components/cell/typings.d.ts +22 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +2 -2
- package/dist/esm/components/cell-filter/index.d.ts.map +1 -1
- package/dist/esm/components/cell-filter/index.js +4 -4
- package/dist/esm/components/cell-overlay/index.d.ts +20 -0
- package/dist/esm/components/cell-overlay/index.d.ts.map +1 -1
- package/dist/esm/components/cell-overlay/index.js +111 -25
- package/dist/esm/components/cf-icon-preview/index.d.ts +16 -0
- package/dist/esm/components/cf-icon-preview/index.d.ts.map +1 -0
- package/dist/esm/components/cf-icon-preview/index.js +41 -0
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +11 -3
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +4 -3
- package/dist/esm/components/goal-seek-dialog/index.d.ts +15 -5
- package/dist/esm/components/goal-seek-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/goal-seek-dialog/index.js +126 -29
- package/dist/esm/components/hidden-markers/index.d.ts.map +1 -1
- package/dist/esm/components/hidden-markers/index.js +9 -8
- package/dist/esm/components/hidden-markers/style.d.ts +7 -0
- package/dist/esm/components/hidden-markers/style.d.ts.map +1 -1
- package/dist/esm/components/hidden-markers/style.js +8 -1
- package/dist/esm/components/protect-sheet-dialog/index.d.ts +67 -0
- package/dist/esm/components/protect-sheet-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/index.js +154 -0
- package/dist/esm/components/toolbar/types.d.ts +1 -1
- package/dist/esm/components/toolbar/types.d.ts.map +1 -1
- package/dist/esm/config.d.ts +13 -1
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +13 -1
- package/dist/esm/helpers.d.ts +10 -5
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +40 -28
- package/dist/esm/hooks/use-border-styles.d.ts.map +1 -1
- package/dist/esm/hooks/use-border-styles.js +5 -26
- package/dist/esm/hooks/use-cell-renderer.d.ts +35 -3
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +83 -42
- package/dist/esm/hooks/use-conditional-formatting.d.ts +13 -1
- package/dist/esm/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/esm/hooks/use-conditional-formatting.js +215 -120
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/themes.d.ts +8 -0
- package/dist/esm/themes.d.ts.map +1 -1
- package/dist/esm/themes.js +20 -3
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +115 -5
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCellNumberFormatLayout = exports.layoutNumberFormatParts = void 0;
|
|
4
|
+
// Paint-time expansion of Excel's width-aware number-format tokens: `*x`
|
|
5
|
+
// repeats `x` across the cell's free width, `_x` reserves the width of `x`
|
|
6
|
+
// and `?` reserves a digit's width ("Number format codes",
|
|
7
|
+
// support.microsoft.com). The formatter keeps those as parts
|
|
8
|
+
// (`ssfFormatLayout`); this module turns them into positioned text runs once
|
|
9
|
+
// the glyph widths are known.
|
|
10
|
+
var utils_1 = require("@rowsncolumns/utils");
|
|
11
|
+
/**
|
|
12
|
+
* Position the parts inside `availableWidth`. Parts before the (first) fill
|
|
13
|
+
* start at the left edge and parts after it end at the right edge, with the
|
|
14
|
+
* fill character repeated in between as many whole times as it fits —
|
|
15
|
+
* Excel's accounting format (`$` left, number right). Without a fill the
|
|
16
|
+
* block is aligned by `align`. Returns `undefined` when the fixed parts
|
|
17
|
+
* alone do not fit, so the caller keeps its plain-text paint.
|
|
18
|
+
*/
|
|
19
|
+
var layoutNumberFormatParts = function (_a) {
|
|
20
|
+
var parts = _a.parts, measure = _a.measure, availableWidth = _a.availableWidth, align = _a.align;
|
|
21
|
+
var widthOf = function (part) {
|
|
22
|
+
switch (part.type) {
|
|
23
|
+
case "text":
|
|
24
|
+
return measure(part.text);
|
|
25
|
+
case "skip":
|
|
26
|
+
return measure(part.char);
|
|
27
|
+
case "digit":
|
|
28
|
+
return measure("0");
|
|
29
|
+
default:
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var fillIndex = parts.findIndex(function (part) { return part.type === "fill"; });
|
|
34
|
+
// Excel honours one `*` per section; a later one paints nothing.
|
|
35
|
+
var widths = parts.map(widthOf);
|
|
36
|
+
var fixedWidth = widths.reduce(function (total, width) { return total + width; }, 0);
|
|
37
|
+
if (fixedWidth > availableWidth + 0.5)
|
|
38
|
+
return undefined;
|
|
39
|
+
var runs = [];
|
|
40
|
+
var pushRuns = function (from, to, startX) {
|
|
41
|
+
var cursor = startX;
|
|
42
|
+
for (var i = from; i < to; i++) {
|
|
43
|
+
var part = parts[i];
|
|
44
|
+
if (part.type === "text" && part.text) {
|
|
45
|
+
runs.push({ text: part.text, x: cursor, width: widths[i] });
|
|
46
|
+
}
|
|
47
|
+
cursor += widths[i];
|
|
48
|
+
}
|
|
49
|
+
return cursor;
|
|
50
|
+
};
|
|
51
|
+
if (fillIndex < 0) {
|
|
52
|
+
var offset = align === "right"
|
|
53
|
+
? availableWidth - fixedWidth
|
|
54
|
+
: align === "center"
|
|
55
|
+
? (availableWidth - fixedWidth) / 2
|
|
56
|
+
: 0;
|
|
57
|
+
var end = pushRuns(0, parts.length, offset);
|
|
58
|
+
return { runs: runs, start: offset, end: end };
|
|
59
|
+
}
|
|
60
|
+
var fill = parts[fillIndex];
|
|
61
|
+
var leftEnd = pushRuns(0, fillIndex, 0);
|
|
62
|
+
var rightWidth = widths
|
|
63
|
+
.slice(fillIndex + 1)
|
|
64
|
+
.reduce(function (total, width) { return total + width; }, 0);
|
|
65
|
+
var rightStart = availableWidth - rightWidth;
|
|
66
|
+
var fillCharWidth = measure(fill.char);
|
|
67
|
+
var gap = rightStart - leftEnd;
|
|
68
|
+
var copies = fillCharWidth > 0 ? Math.max(0, Math.floor(gap / fillCharWidth + 1e-6)) : 0;
|
|
69
|
+
var leftRunCount = runs.length;
|
|
70
|
+
pushRuns(fillIndex + 1, parts.length, rightStart);
|
|
71
|
+
if (copies > 0 && fill.char.trim()) {
|
|
72
|
+
runs.splice(leftRunCount, 0, {
|
|
73
|
+
text: fill.char.repeat(copies),
|
|
74
|
+
x: leftEnd,
|
|
75
|
+
width: copies * fillCharWidth,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return { runs: runs, start: 0, end: availableWidth };
|
|
79
|
+
};
|
|
80
|
+
exports.layoutNumberFormatParts = layoutNumberFormatParts;
|
|
81
|
+
var LAYOUT_CACHE_LIMIT = 2048;
|
|
82
|
+
var layoutCache = new Map();
|
|
83
|
+
/**
|
|
84
|
+
* The layout parts for a cell, or `undefined` when the pattern has no
|
|
85
|
+
* width-aware token or when the parts would paint a different string than
|
|
86
|
+
* the cell's formatted value (another engine, locale or conditional number
|
|
87
|
+
* format produced it) — the plain string then stays authoritative.
|
|
88
|
+
*/
|
|
89
|
+
var getCellNumberFormatLayout = function (pattern, value, formattedValue, locale) {
|
|
90
|
+
var _a;
|
|
91
|
+
if (!pattern || value === null || value === undefined || !formattedValue) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
var key = "".concat(locale !== null && locale !== void 0 ? locale : "", "\0").concat(pattern, "\0").concat(typeof value, "\0").concat(value);
|
|
95
|
+
var parts = layoutCache.get(key);
|
|
96
|
+
if (parts === undefined) {
|
|
97
|
+
parts = (_a = (0, utils_1.ssfFormatLayout)(pattern, value, locale)) !== null && _a !== void 0 ? _a : null;
|
|
98
|
+
if (layoutCache.size >= LAYOUT_CACHE_LIMIT)
|
|
99
|
+
layoutCache.clear();
|
|
100
|
+
layoutCache.set(key, parts);
|
|
101
|
+
}
|
|
102
|
+
if (!parts)
|
|
103
|
+
return undefined;
|
|
104
|
+
return (0, utils_1.numberFormatLayoutText)(parts) === formattedValue ? parts : undefined;
|
|
105
|
+
};
|
|
106
|
+
exports.getCellNumberFormatLayout = getCellNumberFormatLayout;
|
|
@@ -2,6 +2,7 @@ import type { StructuredResult } from "@rowsncolumns/common-types";
|
|
|
2
2
|
import type { SparklineAxisExtents } from "../cell-structured/sparkline-math";
|
|
3
3
|
import type { CellInterface, LineHeightMode, RendererProps } from "@rowsncolumns/grid";
|
|
4
4
|
import type { TextFormatRun } from "@rowsncolumns/ui";
|
|
5
|
+
import type { NumberFormatLayoutPart } from "@rowsncolumns/utils";
|
|
5
6
|
import type { CellFormat, Color, SortOrder, WrapStrategy } from "../../types";
|
|
6
7
|
import type { CanvasGridProps, SpreadsheetTheme } from "../canvas-grid/typings";
|
|
7
8
|
import { CellRendererProps } from "../../hooks/use-cell-renderer";
|
|
@@ -157,11 +158,32 @@ export type CellProps<S extends StructuredResult = StructuredResult> = RendererP
|
|
|
157
158
|
*/
|
|
158
159
|
expanded?: boolean;
|
|
159
160
|
overflowRight?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Centred overflow: pixels the text claims left of the cell (the rest of
|
|
163
|
+
* `cellWidth` lies to its right). Unset for left / right spills.
|
|
164
|
+
*/
|
|
165
|
+
overflowLeft?: number;
|
|
166
|
+
/**
|
|
167
|
+
* Center Across Selection: centre on the whole span instead of on the
|
|
168
|
+
* cell itself.
|
|
169
|
+
*/
|
|
170
|
+
centerOnSpan?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* The dropdown button paints beside the cell, past its right edge, and
|
|
173
|
+
* reserves no room inside it (a data-validation list on the active cell).
|
|
174
|
+
*/
|
|
175
|
+
arrowOutside?: boolean;
|
|
160
176
|
defaultFontSizePoint: number;
|
|
161
177
|
/**
|
|
162
178
|
* Text formatting options of a cell
|
|
163
179
|
*/
|
|
164
180
|
textFormatRuns?: TextFormatRun[] | null;
|
|
181
|
+
/**
|
|
182
|
+
* Width-aware parts of the cell's number format (`*x` fill, `_x` and
|
|
183
|
+
* `?` reserves) when its pattern has any; the painter expands them with
|
|
184
|
+
* measured glyph widths instead of painting `value` as one string.
|
|
185
|
+
*/
|
|
186
|
+
numberFormatLayout?: NumberFormatLayoutPart[];
|
|
165
187
|
/**
|
|
166
188
|
* Structured result
|
|
167
189
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../../components/cell/typings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../../components/cell/typings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAA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H,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC9C;;OAEG;IACH,gBAAgB,EAAE,WAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACnE;;;OAGG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC1C;;;;OAIG;IACH,eAAe,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9D;;;OAGG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE;;OAEG;IACH,6BAA6B,EAAE,iBAAiB,CAAC,+BAA+B,CAAC,CAAC;IAClF;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -281,9 +281,9 @@ exports.CellEditor = (0, react_1.memo)(function (_a) {
|
|
|
281
281
|
return (react_1.default.createElement(style_1.StyledEditor, { "aria-readonly": readOnly || undefined, style: tslib_1.__assign({ top: y, left: isRightAligned ? "auto" : x, right: isRightAligned
|
|
282
282
|
? containerWidth - (x + cellWidth + borderWidth / 2)
|
|
283
283
|
: "auto", minWidth: minWidth, minHeight: minHeight, paddingLeft: finalHorizontalAlignment === "left"
|
|
284
|
-
? config_1.INDENT_SPACING * indent + 1
|
|
284
|
+
? config_1.INDENT_SPACING * indent * scale + 1
|
|
285
285
|
: 0, paddingRight: finalHorizontalAlignment === "right"
|
|
286
|
-
? config_1.INDENT_SPACING * indent + 1
|
|
286
|
+
? config_1.INDENT_SPACING * indent * scale + 1
|
|
287
287
|
: 0, maxWidth: maxWidth, maxHeight: maxHeight, backgroundColor: finalEditorBackgroundColor, borderColor: editorBorderColor, outlineColor: editorBorderOutlineColor, outlineWidth: 2, color: formulaMode ? defaultTextColor : editorColor, fontSize: fontSize * scale, fontFamily: fontFamily, textAlign: (0, alignment_1.resolveCanvasTextAlign)(finalHorizontalAlignment), fontWeight: fontWeight, fontStyle: fontStyle, textDecoration: textDecoration, justifyContent: justifyContent, lineHeight: "normal" }, (isInvisible
|
|
288
288
|
? {
|
|
289
289
|
width: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cell-filter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cell-filter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAgC,MAAM,OAAO,CAAC;AAerD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D,KAAK,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,aAAa,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkGhD,CAAC"}
|
|
@@ -11,7 +11,7 @@ var helpers_1 = require("../../helpers");
|
|
|
11
11
|
* Filter icon
|
|
12
12
|
*/
|
|
13
13
|
var CellFilter = function (_a) {
|
|
14
|
-
var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.width, width = _d === void 0 ? 0 : _d, _e = _a.height, height = _e === void 0 ? 0 : _e, rowIndex = _a.rowIndex, columnIndex = _a.columnIndex, scale = _a.scale, onClick = _a.onClick, isActive = _a.isActive, _f = _a.filterIconColor, filterIconColor = _f === void 0 ?
|
|
14
|
+
var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.width, width = _d === void 0 ? 0 : _d, _e = _a.height, height = _e === void 0 ? 0 : _e, rowIndex = _a.rowIndex, columnIndex = _a.columnIndex, scale = _a.scale, onClick = _a.onClick, isActive = _a.isActive, _f = _a.filterIconColor, filterIconColor = _f === void 0 ? config_1.FILTER_BUTTON_GLYPH_COLOR : _f, verticalAlignment = _a.verticalAlignment, sortOrder = _a.sortOrder;
|
|
15
15
|
var cellSpacing = config_1.DEFAULT_CELL_SPACING;
|
|
16
16
|
// Without a click handler (a readonly grid) the icon is a pure state indicator —
|
|
17
17
|
// no hover highlight, or it reads as clickable.
|
|
@@ -43,8 +43,8 @@ var CellFilter = function (_a) {
|
|
|
43
43
|
event.evt.stopPropagation();
|
|
44
44
|
}, perfectDrawEnabled: false, onMouseDown: function (e) { return e.evt.preventDefault(); } },
|
|
45
45
|
react_1.default.createElement(react_konva_1.Rect, { x: posX, y: posY, width: config_1.FILTER_ICON_WIDTH * scale, height: config_1.FILTER_ICON_WIDTH * scale, fill: isHovered
|
|
46
|
-
? (0, utils_1.lightenColor)(0.2, filterIconColor !== null && filterIconColor !== void 0 ? filterIconColor :
|
|
47
|
-
:
|
|
46
|
+
? (0, utils_1.lightenColor)(0.2, filterIconColor !== null && filterIconColor !== void 0 ? filterIconColor : config_1.FILTER_BUTTON_GLYPH_COLOR)
|
|
47
|
+
: config_1.FILTER_BUTTON_FILL_COLOR, cornerRadius: 0, perfectDrawEnabled: false, stroke: config_1.FILTER_BUTTON_BORDER_COLOR, strokeWidth: 1, hitStrokeWidth: 0 }),
|
|
48
48
|
sortIconPath ? (react_1.default.createElement(react_konva_1.Path, { data: sortIconPath, x: posX + 0.5, y: posY + 0.5, fill: iconFill, scaleY: 0.4 * scale, scaleX: 0.4 * scale, perfectDrawEnabled: false })) : null,
|
|
49
49
|
react_1.default.createElement(react_konva_1.Path, { data: isActive ? config_1.FUNNEL_ICON_PATH : config_1.FITLER_ICON_PATH, x: posX + 0.5 + glyphOffset, y: posY + 0.5 + glyphOffset, fill: iconFill, scaleY: glyphScale, scaleX: glyphScale, perfectDrawEnabled: false })));
|
|
50
50
|
};
|
|
@@ -17,6 +17,26 @@ export type StrokeCellProps = Omit<CellOverlayRendererProps, "key" | "rowIndex"
|
|
|
17
17
|
* @param width
|
|
18
18
|
*/
|
|
19
19
|
export declare const getOffsetFromWidth: (width: number) => number;
|
|
20
|
+
export type SlantQuad = [number, number][];
|
|
21
|
+
/**
|
|
22
|
+
* Excel paints `slantDashDot` as dash-dot runs whose ends slant: each run of
|
|
23
|
+
* `dash` (on/off lengths, already zoomed) along an edge becomes a
|
|
24
|
+
* parallelogram `width` thick, its top edge shifted forward by half the
|
|
25
|
+
* width and its bottom edge back. `at` is the edge's cross-axis position.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getSlantDashQuads: (axis: "horizontal" | "vertical", length: number, at: number, width: number, dash: readonly number[]) => SlantQuad[];
|
|
28
|
+
export type DiagonalStroke = {
|
|
29
|
+
x1: number;
|
|
30
|
+
y1: number;
|
|
31
|
+
x2: number;
|
|
32
|
+
y2: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The line(s) of a diagonal border across a `width` × `height` cell. A
|
|
36
|
+
* non-zero `doubleGap` gives the two parallel lines of a double diagonal,
|
|
37
|
+
* each `doubleGap` away from the corner-to-corner line.
|
|
38
|
+
*/
|
|
39
|
+
export declare const getDiagonalStrokes: (direction: "up" | "down", width: number, height: number, doubleGap?: number) => DiagonalStroke[];
|
|
20
40
|
/**
|
|
21
41
|
* Default CellRenderer
|
|
22
42
|
* @param props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cell-overlay/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAe,MAAM,OAAO,CAAC;AAIpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,uBAAuB,CAAC,EAAE,WAAW,CAAC;IACtC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC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MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,IAAI,GAAG,MAAM,EACxB,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,kBAAa,KACZ,cAAc,EAgBhB,CAAC;AAwRF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,6BAmFlE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CellOverlayRenderer = exports.getOffsetFromWidth = void 0;
|
|
3
|
+
exports.CellOverlayRenderer = exports.getDiagonalStrokes = exports.getSlantDashQuads = exports.getOffsetFromWidth = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
var react_konva_1 = require("react-konva");
|
|
@@ -13,11 +13,70 @@ var getOffsetFromWidth = function (width) {
|
|
|
13
13
|
return width / 2 - 0.5;
|
|
14
14
|
};
|
|
15
15
|
exports.getOffsetFromWidth = getOffsetFromWidth;
|
|
16
|
+
/**
|
|
17
|
+
* Excel paints `slantDashDot` as dash-dot runs whose ends slant: each run of
|
|
18
|
+
* `dash` (on/off lengths, already zoomed) along an edge becomes a
|
|
19
|
+
* parallelogram `width` thick, its top edge shifted forward by half the
|
|
20
|
+
* width and its bottom edge back. `at` is the edge's cross-axis position.
|
|
21
|
+
*/
|
|
22
|
+
var getSlantDashQuads = function (axis, length, at, width, dash) {
|
|
23
|
+
var quads = [];
|
|
24
|
+
if (!dash.length || width <= 0)
|
|
25
|
+
return quads;
|
|
26
|
+
var half = width / 2;
|
|
27
|
+
var cursor = 0;
|
|
28
|
+
for (var i = 0; cursor < length && i < 100000; i++) {
|
|
29
|
+
var run = dash[i % dash.length];
|
|
30
|
+
if (i % 2 === 0 && run > 0) {
|
|
31
|
+
var a = cursor;
|
|
32
|
+
var b = Math.min(length, cursor + run);
|
|
33
|
+
var points = [
|
|
34
|
+
[a + half, at - half],
|
|
35
|
+
[b + half, at - half],
|
|
36
|
+
[b - half, at + half],
|
|
37
|
+
[a - half, at + half],
|
|
38
|
+
];
|
|
39
|
+
quads.push(axis === "horizontal"
|
|
40
|
+
? points
|
|
41
|
+
: points.map(function (_a) {
|
|
42
|
+
var _b = tslib_1.__read(_a, 2), along = _b[0], across = _b[1];
|
|
43
|
+
return [across, along];
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
cursor += run;
|
|
47
|
+
}
|
|
48
|
+
return quads;
|
|
49
|
+
};
|
|
50
|
+
exports.getSlantDashQuads = getSlantDashQuads;
|
|
51
|
+
/**
|
|
52
|
+
* The line(s) of a diagonal border across a `width` × `height` cell. A
|
|
53
|
+
* non-zero `doubleGap` gives the two parallel lines of a double diagonal,
|
|
54
|
+
* each `doubleGap` away from the corner-to-corner line.
|
|
55
|
+
*/
|
|
56
|
+
var getDiagonalStrokes = function (direction, width, height, doubleGap) {
|
|
57
|
+
if (doubleGap === void 0) { doubleGap = 0; }
|
|
58
|
+
var base = direction === "down"
|
|
59
|
+
? { x1: 0, y1: 0, x2: width, y2: height }
|
|
60
|
+
: { x1: 0, y1: height, x2: width, y2: 0 };
|
|
61
|
+
if (!doubleGap)
|
|
62
|
+
return [base];
|
|
63
|
+
var length = Math.hypot(width, height) || 1;
|
|
64
|
+
// Unit normal of the line.
|
|
65
|
+
var nx = (base.y2 - base.y1) / length;
|
|
66
|
+
var ny = -(base.x2 - base.x1) / length;
|
|
67
|
+
return [-1, 1].map(function (side) { return ({
|
|
68
|
+
x1: base.x1 + side * doubleGap * nx,
|
|
69
|
+
y1: base.y1 + side * doubleGap * ny,
|
|
70
|
+
x2: base.x2 + side * doubleGap * nx,
|
|
71
|
+
y2: base.y2 + side * doubleGap * ny,
|
|
72
|
+
}); });
|
|
73
|
+
};
|
|
74
|
+
exports.getDiagonalStrokes = getDiagonalStrokes;
|
|
16
75
|
/**
|
|
17
76
|
* Only used for strokes
|
|
18
77
|
*/
|
|
19
78
|
var CellOverlay = (0, react_1.memo)(function (props) {
|
|
20
|
-
var x = props.x, y = props.y, width = props.width, height = props.height, strokeDoubleInsetWidth = props.strokeDoubleInsetWidth, strokeTopColor = props.strokeTopColor, strokeRightColor = props.strokeRightColor, strokeBottomColor = props.strokeBottomColor, strokeLeftColor = props.strokeLeftColor, strokeDiagonalUpColor = props.strokeDiagonalUpColor, strokeDiagonalDownColor = props.strokeDiagonalDownColor, _a = props.strokeTopDash, strokeTopDash = _a === void 0 ? config_1.DEFAULT_ARRAY : _a, _b = props.strokeRightDash, strokeRightDash = _b === void 0 ? config_1.DEFAULT_ARRAY : _b, _c = props.strokeBottomDash, strokeBottomDash = _c === void 0 ? config_1.DEFAULT_ARRAY : _c, _d = props.strokeLeftDash, strokeLeftDash = _d === void 0 ? config_1.DEFAULT_ARRAY : _d, _e = props.strokeDiagonalUpDash, strokeDiagonalUpDash = _e === void 0 ? config_1.DEFAULT_ARRAY : _e, _f = props.strokeDiagonalDownDash, strokeDiagonalDownDash = _f === void 0 ? config_1.DEFAULT_ARRAY : _f, _g = props.strokeTopWidth, strokeTopWidth = _g === void 0 ? 0 : _g, _h = props.strokeRightWidth, strokeRightWidth = _h === void 0 ? 0 : _h, _j = props.strokeBottomWidth, strokeBottomWidth = _j === void 0 ? 0 : _j, _k = props.strokeLeftWidth, strokeLeftWidth = _k === void 0 ? 0 : _k, _l = props.strokeDiagonalUpWidth, strokeDiagonalUpWidth = _l === void 0 ? 0 : _l, _m = props.strokeDiagonalDownWidth, strokeDiagonalDownWidth = _m === void 0 ? 0 : _m, lineCap = props.lineCap, strokeTopStyle = props.strokeTopStyle, strokeBottomStyle = props.strokeBottomStyle, strokeLeftStyle = props.strokeLeftStyle, strokeRightStyle = props.strokeRightStyle, cellBackgroundColor = props.cellBackgroundColor;
|
|
79
|
+
var x = props.x, y = props.y, width = props.width, height = props.height, strokeDoubleInsetWidth = props.strokeDoubleInsetWidth, strokeTopColor = props.strokeTopColor, strokeRightColor = props.strokeRightColor, strokeBottomColor = props.strokeBottomColor, strokeLeftColor = props.strokeLeftColor, strokeDiagonalUpColor = props.strokeDiagonalUpColor, strokeDiagonalDownColor = props.strokeDiagonalDownColor, _a = props.strokeTopDash, strokeTopDash = _a === void 0 ? config_1.DEFAULT_ARRAY : _a, _b = props.strokeRightDash, strokeRightDash = _b === void 0 ? config_1.DEFAULT_ARRAY : _b, _c = props.strokeBottomDash, strokeBottomDash = _c === void 0 ? config_1.DEFAULT_ARRAY : _c, _d = props.strokeLeftDash, strokeLeftDash = _d === void 0 ? config_1.DEFAULT_ARRAY : _d, _e = props.strokeDiagonalUpDash, strokeDiagonalUpDash = _e === void 0 ? config_1.DEFAULT_ARRAY : _e, _f = props.strokeDiagonalDownDash, strokeDiagonalDownDash = _f === void 0 ? config_1.DEFAULT_ARRAY : _f, _g = props.strokeTopWidth, strokeTopWidth = _g === void 0 ? 0 : _g, _h = props.strokeRightWidth, strokeRightWidth = _h === void 0 ? 0 : _h, _j = props.strokeBottomWidth, strokeBottomWidth = _j === void 0 ? 0 : _j, _k = props.strokeLeftWidth, strokeLeftWidth = _k === void 0 ? 0 : _k, _l = props.strokeDiagonalUpWidth, strokeDiagonalUpWidth = _l === void 0 ? 0 : _l, _m = props.strokeDiagonalDownWidth, strokeDiagonalDownWidth = _m === void 0 ? 0 : _m, lineCap = props.lineCap, strokeTopStyle = props.strokeTopStyle, strokeBottomStyle = props.strokeBottomStyle, strokeLeftStyle = props.strokeLeftStyle, strokeRightStyle = props.strokeRightStyle, strokeDiagonalUpStyle = props.strokeDiagonalUpStyle, strokeDiagonalDownStyle = props.strokeDiagonalDownStyle, cellBackgroundColor = props.cellBackgroundColor;
|
|
21
80
|
var userStroke = strokeTopColor ||
|
|
22
81
|
strokeRightColor ||
|
|
23
82
|
strokeBottomColor ||
|
|
@@ -28,8 +87,35 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
28
87
|
return null;
|
|
29
88
|
}
|
|
30
89
|
return (react_1.default.createElement(react_konva_1.Shape, { x: x, y: y, width: width, height: height, listening: false, perfectDrawEnabled: false, sceneFunc: function (context, shape) {
|
|
90
|
+
var e_1, _a, e_2, _b;
|
|
91
|
+
var fillSlant = function (quads, color) {
|
|
92
|
+
var e_3, _a;
|
|
93
|
+
context.beginPath();
|
|
94
|
+
try {
|
|
95
|
+
for (var quads_1 = tslib_1.__values(quads), quads_1_1 = quads_1.next(); !quads_1_1.done; quads_1_1 = quads_1.next()) {
|
|
96
|
+
var quad = quads_1_1.value;
|
|
97
|
+
quad.forEach(function (_a, index) {
|
|
98
|
+
var _b = tslib_1.__read(_a, 2), px = _b[0], py = _b[1];
|
|
99
|
+
return index ? context.lineTo(px, py) : context.moveTo(px, py);
|
|
100
|
+
});
|
|
101
|
+
context.closePath();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
105
|
+
finally {
|
|
106
|
+
try {
|
|
107
|
+
if (quads_1_1 && !quads_1_1.done && (_a = quads_1.return)) _a.call(quads_1);
|
|
108
|
+
}
|
|
109
|
+
finally { if (e_3) throw e_3.error; }
|
|
110
|
+
}
|
|
111
|
+
context.setAttr("fillStyle", color);
|
|
112
|
+
context.fill();
|
|
113
|
+
};
|
|
31
114
|
/* Top border */
|
|
32
|
-
if (strokeTopColor) {
|
|
115
|
+
if (strokeTopColor && strokeTopStyle === "slantDashDot") {
|
|
116
|
+
fillSlant((0, exports.getSlantDashQuads)("horizontal", shape.width() + 1, 0.5, strokeTopWidth, strokeTopDash), strokeTopColor);
|
|
117
|
+
}
|
|
118
|
+
else if (strokeTopColor) {
|
|
33
119
|
context.beginPath();
|
|
34
120
|
context.moveTo(strokeLeftColor ? -(0, exports.getOffsetFromWidth)(strokeLeftWidth) : 0, 0.5);
|
|
35
121
|
context.lineTo(shape.width() +
|
|
@@ -41,7 +127,10 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
41
127
|
context.stroke();
|
|
42
128
|
}
|
|
43
129
|
/* Bottom border */
|
|
44
|
-
if (strokeBottomColor) {
|
|
130
|
+
if (strokeBottomColor && strokeBottomStyle === "slantDashDot") {
|
|
131
|
+
fillSlant((0, exports.getSlantDashQuads)("horizontal", shape.width() + 1, shape.height() + 0.5, strokeBottomWidth, strokeBottomDash), strokeBottomColor);
|
|
132
|
+
}
|
|
133
|
+
else if (strokeBottomColor) {
|
|
45
134
|
context.beginPath();
|
|
46
135
|
context.moveTo(strokeLeftColor ? -(0, exports.getOffsetFromWidth)(strokeLeftWidth) : 0, shape.height() + 0.5);
|
|
47
136
|
context.lineTo(shape.width() +
|
|
@@ -53,7 +142,10 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
53
142
|
context.stroke();
|
|
54
143
|
}
|
|
55
144
|
/* Left border */
|
|
56
|
-
if (strokeLeftColor) {
|
|
145
|
+
if (strokeLeftColor && strokeLeftStyle === "slantDashDot") {
|
|
146
|
+
fillSlant((0, exports.getSlantDashQuads)("vertical", shape.height() + 1, 0.5, strokeLeftWidth, strokeLeftDash), strokeLeftColor);
|
|
147
|
+
}
|
|
148
|
+
else if (strokeLeftColor) {
|
|
57
149
|
context.beginPath();
|
|
58
150
|
context.moveTo(0.5, strokeTopColor ? -(0, exports.getOffsetFromWidth)(strokeTopWidth) : 0);
|
|
59
151
|
context.lineTo(0.5, shape.height() +
|
|
@@ -67,7 +159,10 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
67
159
|
context.stroke();
|
|
68
160
|
}
|
|
69
161
|
/* Right border */
|
|
70
|
-
if (strokeRightColor) {
|
|
162
|
+
if (strokeRightColor && strokeRightStyle === "slantDashDot") {
|
|
163
|
+
fillSlant((0, exports.getSlantDashQuads)("vertical", shape.height() + 1, shape.width() + 0.5, strokeRightWidth, strokeRightDash), strokeRightColor);
|
|
164
|
+
}
|
|
165
|
+
else if (strokeRightColor) {
|
|
71
166
|
context.beginPath();
|
|
72
167
|
context.moveTo(shape.width() + 0.5, strokeTopColor ? -(0, exports.getOffsetFromWidth)(strokeTopWidth) : 0);
|
|
73
168
|
context.lineTo(shape.width() + 0.5, shape.height() +
|
|
@@ -117,27 +212,59 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
117
212
|
}
|
|
118
213
|
context.closePath();
|
|
119
214
|
}
|
|
120
|
-
/*
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
215
|
+
/* Diagonals: top-left → bottom-right (diagonalDown), bottom-left →
|
|
216
|
+
top-right (diagonalUp). A double diagonal is two thin parallel
|
|
217
|
+
lines, as Excel draws it. */
|
|
218
|
+
var diagonals = [
|
|
219
|
+
{
|
|
220
|
+
direction: "down",
|
|
221
|
+
color: strokeDiagonalDownColor,
|
|
222
|
+
width: strokeDiagonalDownWidth,
|
|
223
|
+
dash: strokeDiagonalDownDash,
|
|
224
|
+
style: strokeDiagonalDownStyle,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
direction: "up",
|
|
228
|
+
color: strokeDiagonalUpColor,
|
|
229
|
+
width: strokeDiagonalUpWidth,
|
|
230
|
+
dash: strokeDiagonalUpDash,
|
|
231
|
+
style: strokeDiagonalUpStyle,
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
try {
|
|
235
|
+
for (var diagonals_1 = tslib_1.__values(diagonals), diagonals_1_1 = diagonals_1.next(); !diagonals_1_1.done; diagonals_1_1 = diagonals_1.next()) {
|
|
236
|
+
var diagonal = diagonals_1_1.value;
|
|
237
|
+
if (!diagonal.color)
|
|
238
|
+
continue;
|
|
239
|
+
var isDouble = diagonal.style === "double";
|
|
240
|
+
context.beginPath();
|
|
241
|
+
try {
|
|
242
|
+
for (var _c = (e_2 = void 0, tslib_1.__values((0, exports.getDiagonalStrokes)(diagonal.direction, shape.width(), shape.height(), isDouble ? diagonal.width / 3 : 0))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
243
|
+
var line = _d.value;
|
|
244
|
+
context.moveTo(line.x1, line.y1);
|
|
245
|
+
context.lineTo(line.x2, line.y2);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
249
|
+
finally {
|
|
250
|
+
try {
|
|
251
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
252
|
+
}
|
|
253
|
+
finally { if (e_2) throw e_2.error; }
|
|
254
|
+
}
|
|
255
|
+
context.setAttr("strokeStyle", diagonal.color);
|
|
256
|
+
context.setAttr("lineWidth", isDouble ? diagonal.width / 3 : diagonal.width);
|
|
257
|
+
context.setAttr("lineCap", lineCap);
|
|
258
|
+
context.setLineDash(diagonal.dash);
|
|
259
|
+
context.stroke();
|
|
260
|
+
}
|
|
130
261
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
context.setAttr("lineWidth", strokeDiagonalUpWidth);
|
|
138
|
-
context.setAttr("lineCap", lineCap);
|
|
139
|
-
context.setLineDash(strokeDiagonalUpDash);
|
|
140
|
-
context.stroke();
|
|
262
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
263
|
+
finally {
|
|
264
|
+
try {
|
|
265
|
+
if (diagonals_1_1 && !diagonals_1_1.done && (_a = diagonals_1.return)) _a.call(diagonals_1);
|
|
266
|
+
}
|
|
267
|
+
finally { if (e_1) throw e_1.error; }
|
|
141
268
|
}
|
|
142
269
|
} }));
|
|
143
270
|
});
|
|
@@ -146,7 +273,7 @@ var CellOverlay = (0, react_1.memo)(function (props) {
|
|
|
146
273
|
* @param props
|
|
147
274
|
*/
|
|
148
275
|
var CellOverlayRenderer = function (props) {
|
|
149
|
-
var x = props.x, y = props.y, width = props.width, height = props.height, stroke = props.stroke, _a = props.strokeTopColor, strokeTopColor = _a === void 0 ? stroke : _a, _b = props.strokeRightColor, strokeRightColor = _b === void 0 ? stroke : _b, _c = props.strokeBottomColor, strokeBottomColor = _c === void 0 ? stroke : _c, _d = props.strokeLeftColor, strokeLeftColor = _d === void 0 ? stroke : _d, strokeDiagonalUpColor = props.strokeDiagonalUpColor, strokeDiagonalDownColor = props.strokeDiagonalDownColor, _e = props.strokeDash, strokeDash = _e === void 0 ? config_1.DEFAULT_ARRAY : _e, _f = props.strokeTopDash, strokeTopDash = _f === void 0 ? config_1.DEFAULT_ARRAY : _f, _g = props.strokeRightDash, strokeRightDash = _g === void 0 ? config_1.DEFAULT_ARRAY : _g, _h = props.strokeBottomDash, strokeBottomDash = _h === void 0 ? config_1.DEFAULT_ARRAY : _h, _j = props.strokeLeftDash, strokeLeftDash = _j === void 0 ? config_1.DEFAULT_ARRAY : _j, _k = props.strokeDiagonalUpDash, strokeDiagonalUpDash = _k === void 0 ? config_1.DEFAULT_ARRAY : _k, _l = props.strokeDiagonalDownDash, strokeDiagonalDownDash = _l === void 0 ? config_1.DEFAULT_ARRAY : _l, _m = props.strokeWidth, strokeWidth = _m === void 0 ? 1 : _m, _o = props.strokeTopWidth, strokeTopWidth = _o === void 0 ? strokeWidth : _o, _p = props.strokeRightWidth, strokeRightWidth = _p === void 0 ? strokeWidth : _p, _q = props.strokeBottomWidth, strokeBottomWidth = _q === void 0 ? strokeWidth : _q, _r = props.strokeLeftWidth, strokeLeftWidth = _r === void 0 ? strokeWidth : _r, _s = props.strokeDiagonalUpWidth, strokeDiagonalUpWidth = _s === void 0 ? strokeWidth : _s, _t = props.strokeDiagonalDownWidth, strokeDiagonalDownWidth = _t === void 0 ? strokeWidth : _t, strokeTopStyle = props.strokeTopStyle, strokeBottomStyle = props.strokeBottomStyle, strokeLeftStyle = props.strokeLeftStyle, strokeRightStyle = props.strokeRightStyle, cellBackgroundColor = props.cellBackgroundColor, _u = props.lineCap, lineCap = _u === void 0 ? "butt" : _u, key = props.key, _v = props.strokeDoubleInsetWidth, strokeDoubleInsetWidth = _v === void 0 ? 1 : _v;
|
|
276
|
+
var x = props.x, y = props.y, width = props.width, height = props.height, stroke = props.stroke, _a = props.strokeTopColor, strokeTopColor = _a === void 0 ? stroke : _a, _b = props.strokeRightColor, strokeRightColor = _b === void 0 ? stroke : _b, _c = props.strokeBottomColor, strokeBottomColor = _c === void 0 ? stroke : _c, _d = props.strokeLeftColor, strokeLeftColor = _d === void 0 ? stroke : _d, strokeDiagonalUpColor = props.strokeDiagonalUpColor, strokeDiagonalDownColor = props.strokeDiagonalDownColor, _e = props.strokeDash, strokeDash = _e === void 0 ? config_1.DEFAULT_ARRAY : _e, _f = props.strokeTopDash, strokeTopDash = _f === void 0 ? config_1.DEFAULT_ARRAY : _f, _g = props.strokeRightDash, strokeRightDash = _g === void 0 ? config_1.DEFAULT_ARRAY : _g, _h = props.strokeBottomDash, strokeBottomDash = _h === void 0 ? config_1.DEFAULT_ARRAY : _h, _j = props.strokeLeftDash, strokeLeftDash = _j === void 0 ? config_1.DEFAULT_ARRAY : _j, _k = props.strokeDiagonalUpDash, strokeDiagonalUpDash = _k === void 0 ? config_1.DEFAULT_ARRAY : _k, _l = props.strokeDiagonalDownDash, strokeDiagonalDownDash = _l === void 0 ? config_1.DEFAULT_ARRAY : _l, _m = props.strokeWidth, strokeWidth = _m === void 0 ? 1 : _m, _o = props.strokeTopWidth, strokeTopWidth = _o === void 0 ? strokeWidth : _o, _p = props.strokeRightWidth, strokeRightWidth = _p === void 0 ? strokeWidth : _p, _q = props.strokeBottomWidth, strokeBottomWidth = _q === void 0 ? strokeWidth : _q, _r = props.strokeLeftWidth, strokeLeftWidth = _r === void 0 ? strokeWidth : _r, _s = props.strokeDiagonalUpWidth, strokeDiagonalUpWidth = _s === void 0 ? strokeWidth : _s, _t = props.strokeDiagonalDownWidth, strokeDiagonalDownWidth = _t === void 0 ? strokeWidth : _t, strokeTopStyle = props.strokeTopStyle, strokeBottomStyle = props.strokeBottomStyle, strokeLeftStyle = props.strokeLeftStyle, strokeRightStyle = props.strokeRightStyle, strokeDiagonalUpStyle = props.strokeDiagonalUpStyle, strokeDiagonalDownStyle = props.strokeDiagonalDownStyle, cellBackgroundColor = props.cellBackgroundColor, _u = props.lineCap, lineCap = _u === void 0 ? "butt" : _u, key = props.key, _v = props.strokeDoubleInsetWidth, strokeDoubleInsetWidth = _v === void 0 ? 1 : _v;
|
|
150
277
|
var userStroke = strokeTopColor ||
|
|
151
278
|
strokeRightColor ||
|
|
152
279
|
strokeBottomColor ||
|
|
@@ -155,7 +282,7 @@ var CellOverlayRenderer = function (props) {
|
|
|
155
282
|
strokeDiagonalDownColor;
|
|
156
283
|
if (!userStroke)
|
|
157
284
|
return null;
|
|
158
|
-
return (react_1.default.createElement(CellOverlay, { key: key, x: x, y: y, strokeDoubleInsetWidth: strokeDoubleInsetWidth, width: width, height: height, strokeTopColor: strokeTopColor, strokeRightColor: strokeRightColor, strokeBottomColor: strokeBottomColor, strokeLeftColor: strokeLeftColor, strokeDiagonalUpColor: strokeDiagonalUpColor, strokeDiagonalDownColor: strokeDiagonalDownColor, strokeDash: strokeDash, strokeTopDash: strokeTopDash, strokeRightDash: strokeRightDash, strokeBottomDash: strokeBottomDash, strokeLeftDash: strokeLeftDash, strokeDiagonalUpDash: strokeDiagonalUpDash, strokeDiagonalDownDash: strokeDiagonalDownDash, strokeTopWidth: strokeTopWidth, strokeRightWidth: strokeRightWidth, strokeBottomWidth: strokeBottomWidth, strokeLeftWidth: strokeLeftWidth, strokeDiagonalUpWidth: strokeDiagonalUpWidth, strokeDiagonalDownWidth: strokeDiagonalDownWidth, lineCap: lineCap, strokeTopStyle: strokeTopStyle, strokeBottomStyle: strokeBottomStyle, strokeLeftStyle: strokeLeftStyle, strokeRightStyle: strokeRightStyle, cellBackgroundColor: cellBackgroundColor }));
|
|
285
|
+
return (react_1.default.createElement(CellOverlay, { key: key, x: x, y: y, strokeDoubleInsetWidth: strokeDoubleInsetWidth, width: width, height: height, strokeTopColor: strokeTopColor, strokeRightColor: strokeRightColor, strokeBottomColor: strokeBottomColor, strokeLeftColor: strokeLeftColor, strokeDiagonalUpColor: strokeDiagonalUpColor, strokeDiagonalDownColor: strokeDiagonalDownColor, strokeDash: strokeDash, strokeTopDash: strokeTopDash, strokeRightDash: strokeRightDash, strokeBottomDash: strokeBottomDash, strokeLeftDash: strokeLeftDash, strokeDiagonalUpDash: strokeDiagonalUpDash, strokeDiagonalDownDash: strokeDiagonalDownDash, strokeTopWidth: strokeTopWidth, strokeRightWidth: strokeRightWidth, strokeBottomWidth: strokeBottomWidth, strokeLeftWidth: strokeLeftWidth, strokeDiagonalUpWidth: strokeDiagonalUpWidth, strokeDiagonalDownWidth: strokeDiagonalDownWidth, lineCap: lineCap, strokeTopStyle: strokeTopStyle, strokeBottomStyle: strokeBottomStyle, strokeLeftStyle: strokeLeftStyle, strokeRightStyle: strokeRightStyle, strokeDiagonalUpStyle: strokeDiagonalUpStyle, strokeDiagonalDownStyle: strokeDiagonalDownStyle, cellBackgroundColor: cellBackgroundColor }));
|
|
159
286
|
};
|
|
160
287
|
exports.CellOverlayRenderer = CellOverlayRenderer;
|
|
161
288
|
CellOverlay.displayName = "CellOverlay";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type CfIconPaintContext } from "../../api/cf-icons";
|
|
3
|
+
/** A DOM 2D context exposed through the painter's `setAttr` contract. */
|
|
4
|
+
export declare const toCfIconPaintContext: (ctx: CanvasRenderingContext2D) => CfIconPaintContext;
|
|
5
|
+
export type CfIconPreviewProps = {
|
|
6
|
+
iconSet: string;
|
|
7
|
+
iconId: number;
|
|
8
|
+
/** CSS pixel size of the square icon. */
|
|
9
|
+
size?: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* One conditional-format icon, drawn by the same painter the grid uses — for
|
|
13
|
+
* the rule editor's icon-style and per-icon pickers.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CfIconPreview: ({ iconSet, iconId, size, }: CfIconPreviewProps) => React.JSX.Element | null;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/cf-icon-preview/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,oBAAoB,CAAC;AAE5B,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,GAC/B,KAAK,wBAAwB,KAC5B,kBAsBD,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,4BAI3B,kBAAkB,6BAuBpB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CfIconPreview = exports.toCfIconPaintContext = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var cf_icons_1 = require("../../api/cf-icons");
|
|
7
|
+
/** A DOM 2D context exposed through the painter's `setAttr` contract. */
|
|
8
|
+
var toCfIconPaintContext = function (ctx) { return ({
|
|
9
|
+
save: function () { return ctx.save(); },
|
|
10
|
+
restore: function () { return ctx.restore(); },
|
|
11
|
+
beginPath: function () { return ctx.beginPath(); },
|
|
12
|
+
closePath: function () { return ctx.closePath(); },
|
|
13
|
+
moveTo: function (x, y) { return ctx.moveTo(x, y); },
|
|
14
|
+
lineTo: function (x, y) { return ctx.lineTo(x, y); },
|
|
15
|
+
arc: function (x, y, r, start, end, ccw) { return ctx.arc(x, y, r, start, end, ccw); },
|
|
16
|
+
rect: function (x, y, w, h) { return ctx.rect(x, y, w, h); },
|
|
17
|
+
fill: function () { return ctx.fill(); },
|
|
18
|
+
stroke: function () { return ctx.stroke(); },
|
|
19
|
+
clip: function () { return ctx.clip(); },
|
|
20
|
+
setAttr: function (attr, value) {
|
|
21
|
+
ctx[attr] = value;
|
|
22
|
+
},
|
|
23
|
+
}); };
|
|
24
|
+
exports.toCfIconPaintContext = toCfIconPaintContext;
|
|
25
|
+
/**
|
|
26
|
+
* One conditional-format icon, drawn by the same painter the grid uses — for
|
|
27
|
+
* the rule editor's icon-style and per-icon pickers.
|
|
28
|
+
*/
|
|
29
|
+
var CfIconPreview = function (_a) {
|
|
30
|
+
var iconSet = _a.iconSet, iconId = _a.iconId, _b = _a.size, size = _b === void 0 ? 16 : _b;
|
|
31
|
+
var ref = (0, react_1.useRef)(null);
|
|
32
|
+
var icon = (0, cf_icons_1.getCfIcon)(iconSet, iconId);
|
|
33
|
+
(0, react_1.useEffect)(function () {
|
|
34
|
+
var canvas = ref.current;
|
|
35
|
+
var ctx = canvas === null || canvas === void 0 ? void 0 : canvas.getContext("2d");
|
|
36
|
+
if (!canvas || !ctx || !icon)
|
|
37
|
+
return;
|
|
38
|
+
var ratio = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
39
|
+
canvas.width = size * ratio;
|
|
40
|
+
canvas.height = size * ratio;
|
|
41
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
42
|
+
(0, cf_icons_1.paintCfIcon)((0, exports.toCfIconPaintContext)(ctx), icon, 0, 0, size * ratio);
|
|
43
|
+
}, [icon, size]);
|
|
44
|
+
if (!icon)
|
|
45
|
+
return null;
|
|
46
|
+
return (react_1.default.createElement("canvas", { ref: ref, "data-cf-icon": "".concat(iconSet, ":").concat(iconId), style: { width: size, height: size, display: "inline-block" }, "aria-hidden": true }));
|
|
47
|
+
};
|
|
48
|
+
exports.CfIconPreview = CfIconPreview;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/context-menu/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACd,MAAM,oBAAoB,CAAC;AAyD5B,OAAO,KAAuC,MAAM,OAAO,CAAC;AAmD5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAoB,UAAU,EAAa,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClC,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IACpD,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IACpD,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,YAAY,EAAE,eAA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c,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,6gDA4FzB,gBAAgB,sBA0+DlB,CAAC"}
|
|
@@ -421,18 +421,26 @@ var ContextMenu = function (_a) {
|
|
|
421
421
|
var _a;
|
|
422
422
|
openGoalSeekDialog({
|
|
423
423
|
setCell: (_a = (0, utils_1.cellToAddress)(activeCell)) !== null && _a !== void 0 ? _a : "",
|
|
424
|
-
onApply: function (setCellAddress, targetValue, changingCellAddress) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
424
|
+
onApply: function (setCellAddress, targetValue, changingCellAddress, options) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
425
425
|
var setCell, changingCell;
|
|
426
426
|
return tslib_1.__generator(this, function (_a) {
|
|
427
427
|
setCell = (0, utils_1.addressToCell)(setCellAddress);
|
|
428
428
|
changingCell = (0, utils_1.addressToCell)(changingCellAddress);
|
|
429
429
|
if (!setCell || !changingCell || !onGoalSeek)
|
|
430
430
|
return [2 /*return*/, undefined];
|
|
431
|
-
return [2 /*return*/,
|
|
431
|
+
return [2 /*return*/, options
|
|
432
|
+
? onGoalSeek(sheetId, setCell, targetValue, changingCell, options)
|
|
433
|
+
: onGoalSeek(sheetId, setCell, targetValue, changingCell)];
|
|
432
434
|
});
|
|
433
435
|
}); },
|
|
436
|
+
// A one-sided or rounded search only proposes values: the picked one is an ordinary edit.
|
|
437
|
+
onCommit: function (changingCellAddress, value) {
|
|
438
|
+
var changingCell = (0, utils_1.addressToCell)(changingCellAddress);
|
|
439
|
+
if (changingCell)
|
|
440
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(sheetId, changingCell, String(value), undefined);
|
|
441
|
+
},
|
|
434
442
|
});
|
|
435
|
-
}, [openGoalSeekDialog, activeCell, onGoalSeek, sheetId]);
|
|
443
|
+
}, [openGoalSeekDialog, activeCell, onGoalSeek, onChange, sheetId]);
|
|
436
444
|
// Remove duplicates — Excel's dialog (column checklist + "my data has
|
|
437
445
|
// headers") when a host mounts `RemoveDuplicatesDialogHost`, otherwise the
|
|
438
446
|
// one-click de-dupe over the selection.
|