@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
package/dist/esm/config.js
CHANGED
|
@@ -30,7 +30,19 @@ export const COLUMN_HEADER_HEIGHT = 24;
|
|
|
30
30
|
export const OUTLINE_GUTTER_LEVEL_PX = 17;
|
|
31
31
|
export const OUTLINE_GUTTER_PAD_PX = 4;
|
|
32
32
|
export const DEFAULT_CELL_SPACING = 2.5;
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* One indent level (Format Cells ▸ Alignment ▸ Indent) at 100 % zoom. ECMA-376
|
|
35
|
+
* §18.8.1 defines a level as three spaces of the Normal font — 3 × 3.3 px for
|
|
36
|
+
* 11 pt Calibri at 96 dpi. Callers multiply it by the zoom scale.
|
|
37
|
+
*/
|
|
38
|
+
export const INDENT_SPACING = 10;
|
|
39
|
+
/**
|
|
40
|
+
* Excel's AutoFilter / table header button: a light grey square with a grey
|
|
41
|
+
* border and a dark grey glyph.
|
|
42
|
+
*/
|
|
43
|
+
export const FILTER_BUTTON_GLYPH_COLOR = "#444444";
|
|
44
|
+
export const FILTER_BUTTON_BORDER_COLOR = "#ABABAB";
|
|
45
|
+
export const FILTER_BUTTON_FILL_COLOR = "#F3F3F3";
|
|
34
46
|
export const MIN_COLUMN_WIDTH = 24;
|
|
35
47
|
export const CELL_VERTICAL_ALIGNMENT = "bottom";
|
|
36
48
|
export const CELL_HORIZONTAL_ALIGNMENT = "left";
|
package/dist/esm/helpers.d.ts
CHANGED
|
@@ -12,11 +12,16 @@ export declare const pixelToPoint: (px: number) => number;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const normalizeDisplayText: (text: string | undefined, shouldWrap: boolean) => string | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* Converts border style to dash array
|
|
16
|
-
*
|
|
17
|
-
|
|
15
|
+
* Converts border style to a dash array, scaled by the zoom so a dash keeps
|
|
16
|
+
* its length relative to the cells.
|
|
17
|
+
*/
|
|
18
|
+
export declare const convertBorderStyleToDashArray: (style: Border["style"] | undefined, scale?: number) => number[] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Stroke width (unscaled px) Excel paints a dashed / dotted border style
|
|
21
|
+
* with: the medium variants and `slantDashDot` are 2 px, the thin ones 1 px.
|
|
22
|
+
* Solid and double styles keep the width they carry.
|
|
18
23
|
*/
|
|
19
|
-
export declare const
|
|
24
|
+
export declare const getBorderStyleWidth: (style: Border["style"] | undefined, width: number | undefined) => number;
|
|
20
25
|
/**
|
|
21
26
|
* Converts border thickness to value
|
|
22
27
|
* @param style
|
|
@@ -95,7 +100,7 @@ export declare const getDefaultColumnHeader: (columnIndex: number) => string;
|
|
|
95
100
|
* @param y
|
|
96
101
|
* @param cellHeight
|
|
97
102
|
*/
|
|
98
|
-
export declare const getChipVerticalPosition: (y: number, cellHeight: number, scale: number, verticalAlign: VerticalAlign) => number;
|
|
103
|
+
export declare const getChipVerticalPosition: (y: number, cellHeight: number, scale: number, verticalAlign: VerticalAlign) => number | undefined;
|
|
99
104
|
export declare const definedProps: <T extends Record<string, any> | undefined | null>(obj: T) => Partial<NonNullable<T>> | T;
|
|
100
105
|
export declare const isGridRange: (maybeCellOrRange: CellInterface | GridRange) => maybeCellOrRange is GridRange;
|
|
101
106
|
export declare const addIndent: (text: string, indent: number, alignment: HorizontalAlign) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAS5D,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EAEN,QAAQ,EACR,KAAK,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,EACf,KAAK,EACL,eAAe,EACf,UAAU,EACV,SAAS,EAET,eAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,SAAS,SAEb,CAAC;AAGV,eAAO,MAAM,KAAK,SAAkB,CAAC;AAGrC,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,WAA+B,CAAC;AAGvE,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,WAA+B,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,GAAG,SAAS,EACxB,YAAY,OAAO,KAClB,MAAM,GAAG,SAKX,CAAC;
|
|
1
|
+
{"version":3,"file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");
|
|
25
25
|
};
|
|
26
|
-
// Dpr utils
|
|
27
|
-
const getPixelRatio = () => (canUseDOM ? window.devicePixelRatio : 1);
|
|
28
|
-
const dashDotWidth = Math.max(Math.floor(getPixelRatio() / 2), 0.5);
|
|
29
|
-
const getDotArray = () => getPixelRatio() === 1
|
|
30
|
-
? [dashDotWidth, dashDotWidth + getPixelRatio()]
|
|
31
|
-
: [dashDotWidth, dashDotWidth];
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
27
|
+
* Excel's border dash patterns at 100 % zoom, as `setLineDash` on/off runs in
|
|
28
|
+
* CSS pixels (Format Cells ▸ Border ▸ Line style; ECMA-376 §18.18.3
|
|
29
|
+
* ST_BorderStyle). Every style is distinct: hair and dotted differ in spacing,
|
|
30
|
+
* the medium variants share their thin pattern at twice the width (see
|
|
31
|
+
* {@link getBorderStyleWidth}), and `slantDashDot` is the medium dash-dot
|
|
32
|
+
* painted as slanted parallelograms (`getSlantDashQuads` in cell-overlay).
|
|
33
|
+
*/
|
|
34
|
+
const BORDER_DASH_PATTERNS = {
|
|
35
|
+
hair: [1, 1],
|
|
36
|
+
dotted: [2, 2],
|
|
37
|
+
dashed: [3, 1],
|
|
38
|
+
mediumDashed: [9, 3],
|
|
39
|
+
dashDot: [9, 3, 3, 3],
|
|
40
|
+
mediumDashDot: [9, 3, 3, 3],
|
|
41
|
+
dashDotDot: [9, 3, 3, 3, 3, 3],
|
|
42
|
+
mediumDashDotDot: [9, 3, 3, 3, 3, 3],
|
|
43
|
+
slantDashDot: [9, 1, 3, 1],
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Converts border style to a dash array, scaled by the zoom so a dash keeps
|
|
47
|
+
* its length relative to the cells.
|
|
36
48
|
*/
|
|
37
|
-
export const convertBorderStyleToDashArray = (style) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
export const convertBorderStyleToDashArray = (style, scale = 1) => {
|
|
50
|
+
const pattern = style ? BORDER_DASH_PATTERNS[style] : undefined;
|
|
51
|
+
return pattern?.map((length) => length * scale);
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Stroke width (unscaled px) Excel paints a dashed / dotted border style
|
|
55
|
+
* with: the medium variants and `slantDashDot` are 2 px, the thin ones 1 px.
|
|
56
|
+
* Solid and double styles keep the width they carry.
|
|
57
|
+
*/
|
|
58
|
+
export const getBorderStyleWidth = (style, width) => {
|
|
41
59
|
switch (style) {
|
|
42
|
-
case "dashed":
|
|
43
|
-
case "mediumDashed":
|
|
44
|
-
return [2, 2];
|
|
45
|
-
case "dotted":
|
|
46
|
-
return getDotArray();
|
|
47
60
|
case "hair":
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
case "dotted":
|
|
62
|
+
case "dashed":
|
|
50
63
|
case "dashDot":
|
|
51
|
-
case "mediumDashDot":
|
|
52
|
-
return [4, 2, 1, 2];
|
|
53
64
|
case "dashDotDot":
|
|
54
|
-
return
|
|
65
|
+
return 1;
|
|
66
|
+
case "mediumDashed":
|
|
67
|
+
case "mediumDashDot":
|
|
68
|
+
case "mediumDashDotDot":
|
|
55
69
|
case "slantDashDot":
|
|
56
|
-
|
|
57
|
-
// standard dash-dot pattern. Visually distinct from `solid` even
|
|
58
|
-
// without the slant.
|
|
59
|
-
return [4, 2, 1, 2];
|
|
70
|
+
return 2;
|
|
60
71
|
default:
|
|
61
|
-
return
|
|
72
|
+
return width ?? 0;
|
|
62
73
|
}
|
|
63
74
|
};
|
|
64
75
|
/**
|
|
@@ -71,6 +82,7 @@ export const convertThicknessStyleToScaleFactor = (style) => {
|
|
|
71
82
|
case "solid_medium":
|
|
72
83
|
case "mediumDashed":
|
|
73
84
|
case "mediumDashDot":
|
|
85
|
+
case "mediumDashDotDot":
|
|
74
86
|
return 1.5;
|
|
75
87
|
case "solid_thick":
|
|
76
88
|
return 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-border-styles.d.ts","sourceRoot":"","sources":["../../../hooks/use-border-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"use-border-styles.d.ts","sourceRoot":"","sources":["../../../hooks/use-border-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EAEN,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,wBAAwB,CAAC,EAAE,eAAe,CAAC,0BAA0B,CAAC,CAAC;IACvE,YAAY,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC/C,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACjE,gBAAgB,CAAC,EAAE,aAAa,EAAE,CAAC;IACnC,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,uBAAuB,CAAC,EAAE,aAAa,CAAC;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,KAAK,EAAE,gBAAgB,CAAC;IACxB,gBAAgB,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,eAAe,EAAE,qBAAqB,EAAE,CAAC;CAC1C,CAAC;AA8BF,eAAO,MAAM,mCAAmC,GAC9C,WAAW,aAAa,CAAC,SAAS,CAAC,EACnC,SAAQ,SAAS,EAAE,GAAG,SAAS,GAAG,IAAS,oFAoC5C,CAAC;AA4BF,eAAO,MAAM,eAAe,GAAI,gXAsB7B,oBAAoB,iBA0XtB,CAAC"}
|
|
@@ -7,7 +7,6 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { useGetAddressFromSelection } from "../atoms";
|
|
8
8
|
import { FROZEN_EMPTY_ARRAY, SELECTION_BORDER } from "../config";
|
|
9
9
|
import { isHoveredCellsWithinBounds } from "../helpers";
|
|
10
|
-
import { getStringifiedColor } from "../themes";
|
|
11
10
|
import { useMemoCompare } from "./use-memo-compare";
|
|
12
11
|
/**
|
|
13
12
|
* Checks if the user is dragging a table or basicFilter
|
|
@@ -81,18 +80,6 @@ const getDraggedColumnStyle = (direction, borderColor) => {
|
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
|
-
// Get first table border color
|
|
85
|
-
const getTableBorder = (properties) => {
|
|
86
|
-
if (properties.headerBorder) {
|
|
87
|
-
return properties.headerBorder.left?.color;
|
|
88
|
-
}
|
|
89
|
-
if (properties.firstBandBorder) {
|
|
90
|
-
return properties.firstBandBorder.bottom?.color;
|
|
91
|
-
}
|
|
92
|
-
if (properties.headerColor) {
|
|
93
|
-
return properties.headerColor;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
83
|
export const useBorderStyles = ({ draggedSelection, initialDraggedSelection, users, userId: currentUserId, renderCollaboratorCursor, sheetId: currentSheetId, borderStyles, flashingBorders, copiedSelections, selectionDragBorderColor, selectionBorderColor = SELECTION_BORDER, tableBorderColor, pivotTableBorderColor = tableBorderColor, tables, pivotTables, basicFilter, hoveredCell, activeCell, theme, agentSuggestions, quickEditValues, }) => {
|
|
97
84
|
const getAddressFromSelection = useGetAddressFromSelection();
|
|
98
85
|
/**
|
|
@@ -186,20 +173,14 @@ export const useBorderStyles = ({ draggedSelection, initialDraggedSelection, use
|
|
|
186
173
|
if (table.sheetId === currentSheetId) {
|
|
187
174
|
const { range, id } = table;
|
|
188
175
|
const isWithinBounds = cachedRangeIds.has(id);
|
|
189
|
-
const hasBorder = table.bandedRange?.rowProperties ||
|
|
190
|
-
table.bandedRange?.columnProperties;
|
|
191
|
-
const tableBorder = hasBorder && table.bandedRange?.rowProperties
|
|
192
|
-
? getStringifiedColor(getTableBorder(table.bandedRange?.rowProperties), theme) ?? tableBorderColor
|
|
193
|
-
: tableBorderColor;
|
|
194
176
|
styles.push({
|
|
195
177
|
index: id,
|
|
196
178
|
title: isWithinBounds ? table.title : undefined,
|
|
197
179
|
type: "table",
|
|
198
180
|
range,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
},
|
|
181
|
+
// Excel draws no outline round a table: its own borders come from
|
|
182
|
+
// the table style. The entry stays for the name tag and dragging.
|
|
183
|
+
style: { strokeWidth: 0 },
|
|
203
184
|
table,
|
|
204
185
|
draggable: true,
|
|
205
186
|
});
|
|
@@ -344,10 +325,8 @@ export const useBorderStyles = ({ draggedSelection, initialDraggedSelection, use
|
|
|
344
325
|
index: id,
|
|
345
326
|
type: "table",
|
|
346
327
|
range,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
stroke: tableBorderColor,
|
|
350
|
-
},
|
|
328
|
+
// No outline round an AutoFilter range either (Excel).
|
|
329
|
+
style: { strokeWidth: 0 },
|
|
351
330
|
title: isWithinBounds ? basicFilter.title ?? undefined : undefined,
|
|
352
331
|
draggable: false,
|
|
353
332
|
});
|
|
@@ -62,6 +62,11 @@ export type CellRendererProps<T extends CellData = CellData> = {
|
|
|
62
62
|
* stays canonical. Canonical when omitted.
|
|
63
63
|
*/
|
|
64
64
|
formulaLocale?: FormulaLocale;
|
|
65
|
+
/**
|
|
66
|
+
* Number-format locale (BCP 47) the cells' formatted values were rendered
|
|
67
|
+
* with — the painter re-derives `*` fill / `_` / `?` widths with it.
|
|
68
|
+
*/
|
|
69
|
+
locale?: string;
|
|
65
70
|
/**
|
|
66
71
|
* Get error value of a cell
|
|
67
72
|
* @param rowIndex
|
|
@@ -131,15 +136,42 @@ export type CellRendererProps<T extends CellData = CellData> = {
|
|
|
131
136
|
* @param rowIndex
|
|
132
137
|
* @param columnIndex
|
|
133
138
|
*/
|
|
134
|
-
getMaximumOverflowTextWidth(formattedValue: string | undefined, sheetId: number, rowIndex: number, columnIndex: number, canOverflowToNextCell: (next: CellInterface) => boolean, textFormat: TextFormat | undefined | null, shouldWrap: boolean | undefined, direction: Direction
|
|
139
|
+
getMaximumOverflowTextWidth(formattedValue: string | undefined, sheetId: number, rowIndex: number, columnIndex: number, canOverflowToNextCell: (next: CellInterface) => boolean, textFormat: TextFormat | undefined | null, shouldWrap: boolean | undefined, direction: Direction,
|
|
140
|
+
/**
|
|
141
|
+
* Centred text: spill half the excess each way. The third tuple entry
|
|
142
|
+
* is then the width claimed on the left.
|
|
143
|
+
*/
|
|
144
|
+
centered?: boolean): [
|
|
135
145
|
number,
|
|
136
146
|
[
|
|
137
147
|
columnIndex: number,
|
|
138
148
|
columnOffset: number,
|
|
139
149
|
columnWidth: number,
|
|
140
150
|
cellBackground?: Color | null
|
|
141
|
-
][]
|
|
151
|
+
][],
|
|
152
|
+
number?
|
|
142
153
|
];
|
|
154
|
+
/**
|
|
155
|
+
* Center Across Selection (`centerContinuous`): the empty neighbours on
|
|
156
|
+
* either side that carry the same alignment, as
|
|
157
|
+
* `[totalWidth, columnSpans, leftWidth]`, or `undefined` when there are
|
|
158
|
+
* none.
|
|
159
|
+
*/
|
|
160
|
+
/**
|
|
161
|
+
* The active cell: a data-validation list shows its dropdown button beside
|
|
162
|
+
* it only.
|
|
163
|
+
*/
|
|
164
|
+
activeCell?: CellInterface | null;
|
|
165
|
+
getCenterAcrossSelectionSpan?(sheetId: number, rowIndex: number, columnIndex: number): [
|
|
166
|
+
number,
|
|
167
|
+
[
|
|
168
|
+
columnIndex: number,
|
|
169
|
+
columnOffset: number,
|
|
170
|
+
columnWidth: number,
|
|
171
|
+
cellBackground?: Color | null
|
|
172
|
+
][],
|
|
173
|
+
number
|
|
174
|
+
] | undefined;
|
|
143
175
|
/**
|
|
144
176
|
* Get dimensions of a text
|
|
145
177
|
* @param sheetId
|
|
@@ -248,5 +280,5 @@ export type CellRendererProps<T extends CellData = CellData> = {
|
|
|
248
280
|
*/
|
|
249
281
|
getDefaultHorizontalAlignment(sheetId: number, rowIndex: number, columnIndex: number): HorizontalAlign | undefined;
|
|
250
282
|
};
|
|
251
|
-
export declare const useCellRenderer: <T extends CellData = CellData>({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing, getCellDiff, }: CellRendererProps<T>) => readonly [(props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element, (props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element | null | undefined, (cells: RendererProps[]) => React.JSX.Element];
|
|
283
|
+
export declare const useCellRenderer: <T extends CellData = CellData>({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing, getCellDiff, }: CellRendererProps<T>) => readonly [(props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element, (props: RendererProps) => React.JSX.Element | null, (props: RendererProps) => React.JSX.Element | null | undefined, (cells: RendererProps[]) => React.JSX.Element];
|
|
252
284
|
//# sourceMappingURL=use-cell-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-cell-renderer.d.ts","sourceRoot":"","sources":["../../../hooks/use-cell-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-cell-renderer.d.ts","sourceRoot":"","sources":["../../../hooks/use-cell-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAoB3C,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAA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AW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,QAAQ,GAAG,IAAI,CAAC;IAErB;;;;;OAKG;IACH,6BAA6B,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,eAAe,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,g1CA2E5D,iBAAiB,CAAC,CAAC,CAAC,uBAgnBX,aAAa,uCAnmBb,aAAa,gCAkfb,aAAa,uCApFb,aAAa,mDAoRb,aAAa,EAAE,uBA0B1B,CAAC"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { Direction } from "@rowsncolumns/grid";
|
|
2
|
-
import { isNil, localizeErrorValue, } from "@rowsncolumns/utils";
|
|
2
|
+
import { getExtendedValueNumber, getExtendedValueString, isNil, isNilOrBlank, localizeErrorValue, } from "@rowsncolumns/utils";
|
|
3
3
|
import { sparklineGroupAxisFor } from "../components/cell-structured/sparkline-math";
|
|
4
4
|
import React, { useCallback } from "react";
|
|
5
5
|
import { getHeaderFill } from "../api/colors";
|
|
6
6
|
import { showValidationDropdownArrow } from "../api/validation";
|
|
7
|
-
import { alignmentImpliesWrap, isFillAlignment, } from "../components/cell/alignment";
|
|
7
|
+
import { alignmentImpliesWrap, isFillAlignment, resolveCanvasVerticalAlign, verticalAlignmentImpliesWrap, } from "../components/cell/alignment";
|
|
8
8
|
import { CellBackground } from "../components/cell/cell-background";
|
|
9
9
|
import { CellBackgrounds } from "../components/cell/cell-backgrounds";
|
|
10
|
+
import { getCellNumberFormatLayout } from "../components/cell/number-format-layout";
|
|
10
11
|
import { CellDiff as CellDiffRenderer } from "../components/cell-diff";
|
|
11
12
|
import { CellOverlayRenderer } from "../components/cell-overlay";
|
|
12
13
|
import { DEFAULT_ARRAY } from "../config";
|
|
13
|
-
import { convertBorderStyleToDashArray, normalizeDisplayText, } from "../helpers";
|
|
14
|
+
import { convertBorderStyleToDashArray, getBorderStyleWidth, normalizeDisplayText, } from "../helpers";
|
|
14
15
|
import { getCellBordersForRendering } from "../helpers/merged-cell-borders";
|
|
15
16
|
import { getStringifiedColor } from "../themes";
|
|
16
17
|
import { applyShowZeros } from "./show-zeros";
|
|
17
18
|
import { useCellDiffHighlight } from "./use-cell-diff-highlight";
|
|
18
|
-
export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing = false, getCellDiff, }) => {
|
|
19
|
+
export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRowHeader, isColumnHeader, selectedRows, selectedColumns, selectedRowHeaders, selectedColumnHeaders, cellBackgroundColor, headerBorderColor, headerBackgroundColor, headerColor, headerActiveBackgroundColor, headerSelectedBackgroundColor, headerSelectedColor, headerTableBackgroundColor, headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor, chipBackgroundColor, filterIconColor, showCalculatedColumnIcon, enableTextOverflow, showHeaders, theme, getDefaultHorizontalAlignment, isTableFilterVisible, columnContainsTable, rowsContainsTable, canOverflowToNextCell, getTableHeaderSortOrder, getDataValidation, getErrorValue, formulaLocale, locale, getEffectiveValue, getSparklineGroup, getFormattedValue, getNote, getComment, getEffectiveCellFormat, getCellBounds, getCellImageUrl, getCellMetaType, getRowHeaderText, getColumnHeaderText, getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan, activeCell, getTextDimension, getCellGroupingInfo, getTextFormatRuns, onRequestEdit, onFilterClick, onCheckboxClick, isTableHeader, isTableTotalsCell, onTotalsArrowClick, isCalculatedColumnHeader, isTableHeaderFilterActive, HeaderCell, Cell, StructuredResult, gridLineWidth, showNotes, showComments, defaultFontSizePoint, lineHeightMode, readonly, onExpandCollapse, onOverflow, isComparing = false, getCellDiff, }) => {
|
|
19
20
|
// Version comparison diff highlighting - only active when isComparing is true
|
|
20
21
|
const { mergeCellFormatWithDiff, getDiffHighlight } = useCellDiffHighlight(isComparing ? getCellDiff : undefined);
|
|
21
22
|
// Edit
|
|
@@ -28,7 +29,12 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
28
29
|
const effectiveCellFormat = getEffectiveCellFormat(sheetId, rowIndex, columnIndex);
|
|
29
30
|
// Checkbox for boolean values (Checkbox icon)
|
|
30
31
|
const effectiveValue = getEffectiveValue(sheetId, rowIndex, columnIndex);
|
|
31
|
-
|
|
32
|
+
// "Show Bar Only" / "Show Icon Only" conditional formats hide the value.
|
|
33
|
+
const hideConditionalValue = Boolean(effectiveCellFormat?.conditionalDataBar?.hideValue ||
|
|
34
|
+
effectiveCellFormat?.conditionalIcon?.hideValue);
|
|
35
|
+
const formattedValue = hideConditionalValue
|
|
36
|
+
? ""
|
|
37
|
+
: applyShowZeros(rawFormattedValue, effectiveValue, showZeros);
|
|
32
38
|
const dataValidation = getDataValidation(sheetId, rowIndex, columnIndex);
|
|
33
39
|
const validationType = dataValidation?.condition?.type;
|
|
34
40
|
const horizontalAlignment = effectiveCellFormat?.horizontalAlignment;
|
|
@@ -43,7 +49,13 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
43
49
|
// Show dropdown arrow: a data-validation list, or a table totals cell
|
|
44
50
|
// whose arrow opens the totals-function picker.
|
|
45
51
|
const showTotalsArrow = !showFilter && !!isTableTotalsCell?.(rowIndex, columnIndex);
|
|
46
|
-
|
|
52
|
+
// Excel shows a list's in-cell dropdown button only beside the active
|
|
53
|
+
// cell, outside its right edge — it never takes room from the value.
|
|
54
|
+
const showValidationArrow = !showTotalsArrow &&
|
|
55
|
+
activeCell?.rowIndex === rowIndex &&
|
|
56
|
+
activeCell?.columnIndex === columnIndex &&
|
|
57
|
+
showValidationDropdownArrow(dataValidation);
|
|
58
|
+
const showArrow = showValidationArrow || showTotalsArrow;
|
|
47
59
|
// Has notes
|
|
48
60
|
const showNote = showNotes
|
|
49
61
|
? !!getNote(sheetId, rowIndex, columnIndex)
|
|
@@ -60,7 +72,8 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
60
72
|
// repeats the text to the cell edge — none of them ever spill into
|
|
61
73
|
// the neighbouring cells.
|
|
62
74
|
const wrapStrategy = effectiveCellFormat?.wrapStrategy;
|
|
63
|
-
const wrapsByAlignment = alignmentImpliesWrap(horizontalAlignment)
|
|
75
|
+
const wrapsByAlignment = alignmentImpliesWrap(horizontalAlignment) ||
|
|
76
|
+
verticalAlignmentImpliesWrap(effectiveCellFormat?.verticalAlignment);
|
|
64
77
|
const fillsCell = isFillAlignment(horizontalAlignment);
|
|
65
78
|
const shouldWrap = wrapStrategy === "wrap" || wrapsByAlignment;
|
|
66
79
|
const isWrapEnabled = (wrapStrategy ?? "overflow") === "overflow" &&
|
|
@@ -81,30 +94,44 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
81
94
|
Number.isFinite(numericRotation) &&
|
|
82
95
|
numericRotation !== 0;
|
|
83
96
|
const containsTextInside = !!effectiveCellFormat?.shrinkToFit || hasNumericRotation;
|
|
84
|
-
const
|
|
97
|
+
const isCentered = horizontalAlignment === "center";
|
|
98
|
+
const isCenterAcross = horizontalAlignment === "centerContinuous";
|
|
99
|
+
const canSpill = enableTextOverflow &&
|
|
85
100
|
isWrapEnabled &&
|
|
86
|
-
!dataValidation &&
|
|
87
101
|
!showFilter &&
|
|
88
102
|
!isCalculatedColumn &&
|
|
89
|
-
!
|
|
103
|
+
!showTotalsArrow &&
|
|
90
104
|
!expandable &&
|
|
91
105
|
!containsTextInside &&
|
|
92
106
|
// Following Excel and Google sheets behavior
|
|
93
107
|
// Text does not overflow merged cells
|
|
94
|
-
!isMergedCell
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
!isMergedCell;
|
|
109
|
+
// Center Across Selection: the text centres over the run of empty
|
|
110
|
+
// neighbours that share the alignment, however short it is.
|
|
111
|
+
const centerAcrossSpan = canSpill && isCenterAcross && !isNilOrBlank(displayFormattedValue)
|
|
112
|
+
? getCenterAcrossSelectionSpan?.(sheetId, rowIndex, columnIndex)
|
|
113
|
+
: undefined;
|
|
114
|
+
const shouldOverflow = !!centerAcrossSpan ||
|
|
115
|
+
(canSpill &&
|
|
116
|
+
(isRightAligned ? isStringValue : true) &&
|
|
117
|
+
(isCentered
|
|
118
|
+
? canOverflowToNextCell({ rowIndex, columnIndex: columnIndex - 1 }) ||
|
|
119
|
+
canOverflowToNextCell({ rowIndex, columnIndex: columnIndex + 1 })
|
|
120
|
+
: canOverflowToNextCell({
|
|
121
|
+
rowIndex,
|
|
122
|
+
columnIndex: columnIndex + (isRightAligned ? -1 : 1),
|
|
123
|
+
})));
|
|
124
|
+
const [cellWidth, columnSpans, overflowLeft] = centerAcrossSpan
|
|
125
|
+
? centerAcrossSpan
|
|
126
|
+
: shouldOverflow
|
|
127
|
+
? getMaximumOverflowTextWidth(displayFormattedValue, sheetId, rowIndex, columnIndex,
|
|
128
|
+
// Investigate why isHiddenCell and the instance from Sheet-Grid differs
|
|
129
|
+
canOverflowToNextCell, effectiveCellFormat?.textFormat, shouldWrap, isRightAligned ? Direction.Left : Direction.Right, isCentered)
|
|
130
|
+
: [
|
|
131
|
+
props.width,
|
|
132
|
+
DEFAULT_ARRAY,
|
|
133
|
+
undefined,
|
|
134
|
+
];
|
|
108
135
|
if (shouldOverflow && cellWidth > props.width) {
|
|
109
136
|
// Report the full visual width as the required buffer
|
|
110
137
|
// This ensures that even if we scroll to the far right of the overflow,
|
|
@@ -164,9 +191,17 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
164
191
|
const oldValueWidth = diffHighlight.oldFormattedValue
|
|
165
192
|
? getTextDimension(sheetId, rowIndex, columnIndex, diffHighlight.oldFormattedValue, diffHighlight.oldFormat?.textFormat ?? undefined).width
|
|
166
193
|
: undefined;
|
|
167
|
-
return (React.createElement(CellDiffRenderer, { diffHighlight: diffHighlight, value: formattedValue, defaultColor: textColor, scale: scale, fontSizePt: defaultFontSizePoint, fontFamily: effectiveCellFormat?.textFormat?.fontFamily, bold: effectiveCellFormat?.textFormat?.bold, italic: effectiveCellFormat?.textFormat?.italic, horizontalAlignment: effectiveCellFormat?.horizontalAlignment, verticalAlignment: effectiveCellFormat?.verticalAlignment
|
|
194
|
+
return (React.createElement(CellDiffRenderer, { diffHighlight: diffHighlight, value: formattedValue, defaultColor: textColor, scale: scale, fontSizePt: defaultFontSizePoint, fontFamily: effectiveCellFormat?.textFormat?.fontFamily, bold: effectiveCellFormat?.textFormat?.bold, italic: effectiveCellFormat?.textFormat?.italic, horizontalAlignment: effectiveCellFormat?.horizontalAlignment, verticalAlignment: effectiveCellFormat?.verticalAlignment
|
|
195
|
+
? resolveCanvasVerticalAlign(effectiveCellFormat.verticalAlignment)
|
|
196
|
+
: undefined, oldValueWidth: oldValueWidth, ...props }));
|
|
168
197
|
}
|
|
169
|
-
|
|
198
|
+
const numberFormatLayout = isError
|
|
199
|
+
? undefined
|
|
200
|
+
: getCellNumberFormatLayout(effectiveCellFormat?.numberFormat?.pattern, getExtendedValueNumber(effectiveValue) ??
|
|
201
|
+
getExtendedValueString(effectiveValue), displayValue, locale);
|
|
202
|
+
return (React.createElement(Cell, { value: displayValue, numberFormatLayout: numberFormatLayout, cellFormat: effectiveCellFormat, scale: scale, defaultBackgroundColor: cellBackgroundColor, onRequestEdit: onRequestEditCell, onArrowClick: showTotalsArrow ? onTotalsArrowClick : undefined, showArrow: showArrow, arrowOutside: showValidationArrow, showFilter: showFilter, isCalculatedColumn: isCalculatedColumn, showCheckbox: showCheckbox, showChip: showChip, chipBackgroundColor: chipBackgroundColor, filterIconColor: filterIconColor, onFilterClick: onFilterClick, onCheckboxClick: onCheckboxClick, isChecked: isChecked, isInvalid: isInvalid, isError: isError, imageUrl: imageUrl, isFilterActive: isFilterActive, enableOverflow: enableOverflow, cellWidth: cellWidth, showNote: showNote, showComment: showComment, showCalculatedColumnIcon: showCalculatedColumnIcon, theme: theme, expandable: expandable, expanded: expanded, textWidth: textWidth, columnSpans: columnSpans, overflowRight: overflowRight, overflowLeft: enableOverflow && (isCentered || centerAcrossSpan)
|
|
203
|
+
? overflowLeft ?? 0
|
|
204
|
+
: undefined, centerOnSpan: !!centerAcrossSpan, showGridLines: showGridLines, structuredValue: effectiveValue?.structuredValue, sparklineGroupAxis: effectiveValue?.structuredValue?.kind === "sparkline" &&
|
|
170
205
|
getSparklineGroup
|
|
171
206
|
? sparklineGroupAxisFor(effectiveValue.structuredValue, () => getSparklineGroup(sheetId, { rowIndex, columnIndex }), (cell) => getEffectiveValue(sheetId, cell.rowIndex, cell.columnIndex)
|
|
172
207
|
?.structuredValue)
|
|
@@ -176,6 +211,7 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
176
211
|
sheetId,
|
|
177
212
|
scale,
|
|
178
213
|
showGridLines,
|
|
214
|
+
showZeros,
|
|
179
215
|
theme,
|
|
180
216
|
showNotes,
|
|
181
217
|
showComments,
|
|
@@ -195,6 +231,7 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
195
231
|
getDataValidation,
|
|
196
232
|
getErrorValue,
|
|
197
233
|
formulaLocale,
|
|
234
|
+
locale,
|
|
198
235
|
getEffectiveValue,
|
|
199
236
|
getSparklineGroup,
|
|
200
237
|
getFormattedValue,
|
|
@@ -204,6 +241,8 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
204
241
|
getNote,
|
|
205
242
|
getComment,
|
|
206
243
|
getMaximumOverflowTextWidth,
|
|
244
|
+
getCenterAcrossSelectionSpan,
|
|
245
|
+
activeCell,
|
|
207
246
|
getCellGroupingInfo,
|
|
208
247
|
onCheckboxClick,
|
|
209
248
|
onFilterClick,
|
|
@@ -298,27 +337,27 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
298
337
|
const strokeDiagonalUpStyle = borders?.diagonalUp?.style;
|
|
299
338
|
const strokeDiagonalDownStyle = borders?.diagonalDown?.style;
|
|
300
339
|
/* Border width */
|
|
301
|
-
const strokeTopWidth = (strokeTopStyle === "double" ? 3 : borders?.top?.width
|
|
302
|
-
const strokeBottomWidth = (strokeBottomStyle === "double" ? 3 : borders?.bottom?.width
|
|
340
|
+
const strokeTopWidth = (strokeTopStyle === "double" ? 3 : getBorderStyleWidth(borders?.top?.style, borders?.top?.width)) * scale;
|
|
341
|
+
const strokeBottomWidth = (strokeBottomStyle === "double" ? 3 : getBorderStyleWidth(borders?.bottom?.style, borders?.bottom?.width)) *
|
|
303
342
|
scale;
|
|
304
|
-
const strokeLeftWidth = (strokeLeftStyle === "double" ? 3 : borders?.left?.width
|
|
305
|
-
const strokeRightWidth = (strokeRightStyle === "double" ? 3 : borders?.right?.width
|
|
343
|
+
const strokeLeftWidth = (strokeLeftStyle === "double" ? 3 : getBorderStyleWidth(borders?.left?.style, borders?.left?.width)) * scale;
|
|
344
|
+
const strokeRightWidth = (strokeRightStyle === "double" ? 3 : getBorderStyleWidth(borders?.right?.style, borders?.right?.width)) *
|
|
306
345
|
scale;
|
|
307
346
|
const strokeDiagonalUpWidth = (strokeDiagonalUpStyle === "double"
|
|
308
347
|
? 3
|
|
309
|
-
: borders?.diagonalUp?.width
|
|
348
|
+
: getBorderStyleWidth(borders?.diagonalUp?.style, borders?.diagonalUp?.width)) * scale;
|
|
310
349
|
const strokeDiagonalDownWidth = (strokeDiagonalDownStyle === "double"
|
|
311
350
|
? 3
|
|
312
|
-
: borders?.diagonalDown?.width
|
|
351
|
+
: getBorderStyleWidth(borders?.diagonalDown?.style, borders?.diagonalDown?.width)) * scale;
|
|
313
352
|
// Double inset
|
|
314
353
|
const strokeDoubleInsetWidth = 1 * scale;
|
|
315
354
|
/* Border style */
|
|
316
|
-
const strokeTopDash = convertBorderStyleToDashArray(borders?.top?.style);
|
|
317
|
-
const strokeBottomDash = convertBorderStyleToDashArray(borders?.bottom?.style);
|
|
318
|
-
const strokeLeftDash = convertBorderStyleToDashArray(borders?.left?.style);
|
|
319
|
-
const strokeRightDash = convertBorderStyleToDashArray(borders?.right?.style);
|
|
320
|
-
const strokeDiagonalUpDash = convertBorderStyleToDashArray(borders?.diagonalUp?.style);
|
|
321
|
-
const strokeDiagonalDownDash = convertBorderStyleToDashArray(borders?.diagonalDown?.style);
|
|
355
|
+
const strokeTopDash = convertBorderStyleToDashArray(borders?.top?.style, scale);
|
|
356
|
+
const strokeBottomDash = convertBorderStyleToDashArray(borders?.bottom?.style, scale);
|
|
357
|
+
const strokeLeftDash = convertBorderStyleToDashArray(borders?.left?.style, scale);
|
|
358
|
+
const strokeRightDash = convertBorderStyleToDashArray(borders?.right?.style, scale);
|
|
359
|
+
const strokeDiagonalUpDash = convertBorderStyleToDashArray(borders?.diagonalUp?.style, scale);
|
|
360
|
+
const strokeDiagonalDownDash = convertBorderStyleToDashArray(borders?.diagonalDown?.style, scale);
|
|
322
361
|
return CellOverlayRenderer({
|
|
323
362
|
...props,
|
|
324
363
|
strokeDoubleInsetWidth,
|
|
@@ -344,6 +383,8 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
344
383
|
strokeBottomStyle,
|
|
345
384
|
strokeLeftStyle,
|
|
346
385
|
strokeRightStyle,
|
|
386
|
+
strokeDiagonalUpStyle,
|
|
387
|
+
strokeDiagonalDownStyle,
|
|
347
388
|
cellBackgroundColor: finalCellBackgroundColor,
|
|
348
389
|
});
|
|
349
390
|
}, [
|
|
@@ -367,11 +408,11 @@ export const useCellRenderer = ({ sheetId, scale, showGridLines, showZeros, isRo
|
|
|
367
408
|
*/
|
|
368
409
|
const fillPattern = effectiveCellFormat?.fillPattern ?? null;
|
|
369
410
|
const gradient = effectiveCellFormat?.gradient ?? null;
|
|
370
|
-
|
|
411
|
+
// A pattern with no colour of its own paints in Excel's Automatic
|
|
412
|
+
// (black); a solid pattern needs its foreground.
|
|
413
|
+
const hasPaintedPattern = fillPattern === "solid"
|
|
371
414
|
? !!effectiveCellFormat?.foregroundColor
|
|
372
|
-
: fillPattern
|
|
373
|
-
? !!effectiveCellFormat?.foregroundColor
|
|
374
|
-
: false;
|
|
415
|
+
: !!fillPattern && fillPattern !== "none";
|
|
375
416
|
const hasGradient = !!gradient && (gradient.stops?.length ?? 0) > 0;
|
|
376
417
|
const showFillRectange = !isNil(effectiveCellFormat?.backgroundColor) ||
|
|
377
418
|
isMergedCell ||
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type GridRange } from "@rowsncolumns/grid";
|
|
2
|
+
import { type CfRangeStats } from "../api/cf-overlays";
|
|
2
3
|
import type { CanvasGridProps, SpreadsheetTheme } from "../components/canvas-grid/typings";
|
|
3
4
|
import type { CellData, CellFormat, ConditionalFormatRule, CustomFormulaResult } from "../types";
|
|
4
5
|
/**
|
|
@@ -38,6 +39,17 @@ export type UseConditionalFormattingProps<T extends CellData> = {
|
|
|
38
39
|
* JS computation. Omit for engine-free documents.
|
|
39
40
|
*/
|
|
40
41
|
getConditionalFormatResult?: (sheetId: number, rowIndex: number, columnIndex: number, ruleId: ConditionalFormatRule["id"]) => unknown;
|
|
42
|
+
/**
|
|
43
|
+
* Whole-range statistics of a rule's numeric covered cells, for hosts whose
|
|
44
|
+
* cell data is windowed (an engine that only streams the visible slice).
|
|
45
|
+
* Used for rules cut to the evaluation window, so data bars, colour
|
|
46
|
+
* scales, icon sets, top/bottom-N and averages resolve over the rule's
|
|
47
|
+
* full range. Return `sorted` for percentile / rank thresholds. Hosts
|
|
48
|
+
* should cache per rule and invalidate on edit; without this prop the
|
|
49
|
+
* hook computes the statistics itself from `getValidationValue` and
|
|
50
|
+
* caches them per rule until the data changes.
|
|
51
|
+
*/
|
|
52
|
+
getConditionalFormatRuleStats?: (sheetId: number, rule: ConditionalFormatRule) => CfRangeStats | null | undefined;
|
|
41
53
|
};
|
|
42
|
-
export declare const useConditionalFormatting: <T extends CellData>({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, }: UseConditionalFormattingProps<T>) => Map<string, CellFormat | undefined>;
|
|
54
|
+
export declare const useConditionalFormatting: <T extends CellData>({ sheetId, theme, conditionalFormats, locale, getValidationValue, isNumberValue, getSheetRowCount, getSheetColumnCount, window: evaluationWindow, getConditionalFormatResult, getConditionalFormatRuleStats, }: UseConditionalFormattingProps<T>) => Map<string, CellFormat | undefined>;
|
|
43
55
|
//# sourceMappingURL=use-conditional-formatting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-conditional-formatting.d.ts","sourceRoot":"","sources":["../../../hooks/use-conditional-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-conditional-formatting.d.ts","sourceRoot":"","sources":["../../../hooks/use-conditional-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAWpE,OAAO,EAIL,KAAK,YAAY,EAKlB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,UAAU,EAClB,OAAO,UAAU,KAChB,UAYF,CAAC;AAmCF,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,CAAC;IACxB,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,qBAAqB,KACzB,mBAAmB,CAAC;IACzB,aAAa,CACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IACX,gBAAgB,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;;;;;;OAOG;IAC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