@rowsncolumns/spreadsheet 10.6.0 → 10.6.5
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/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 +25 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.d.ts +83 -1
- package/dist/cjs/components/cell/alignment.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.js +182 -1
- package/dist/cjs/components/cell/cell-background.d.ts +18 -0
- package/dist/cjs/components/cell/cell-background.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-background.js +145 -59
- 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.d.ts +12 -5
- package/dist/cjs/components/cell/cell-text-runs.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-text-runs.js +19 -21
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +392 -45
- 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/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +3 -2
- 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 +15 -5
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +51 -35
- 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 +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -0
- 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 +81 -4
- 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/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 +25 -0
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.d.ts +83 -1
- package/dist/esm/components/cell/alignment.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.js +143 -1
- package/dist/esm/components/cell/cell-background.d.ts +18 -0
- package/dist/esm/components/cell/cell-background.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-background.js +110 -41
- 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.d.ts +12 -5
- package/dist/esm/components/cell/cell-text-runs.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-text-runs.js +19 -24
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +352 -46
- 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/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +4 -3
- 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 +15 -5
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +48 -32
- 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 +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/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 +81 -4
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
package/dist/cjs/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExtendedValueError = exports.getExtendedValueFormula = exports.getExtendedValueBool = exports.getExtendedValueString = exports.getExtendedValueNumber = exports.getCellEffectiveValue = exports.getCellUserEnteredValue = exports.getCellFormattedValue = exports.isHoveredCellsWithinBounds = exports.isStructuredValue = exports.isStyleReference = exports.isTouchDevice = exports.splitDataValidationListValues = exports.shouldShowFromValue = exports.shouldShowToValue = exports.trimValue = exports.toEditorRangeValuesAsync = exports.checkIfStringIsReference = exports.isEqualColors = exports.sheetRangeToSheetCoordinate = exports.isSheetRange = exports.getCurrencySymbol = exports.isInSequence = exports.createArrayRange = exports.generateMultiDimTitle = exports.addIndent = exports.isGridRange = exports.definedProps = exports.getChipVerticalPosition = exports.getDefaultColumnHeader = exports.getDefaultRowHeader = exports.getHorizontalSpacing = exports.getIconSpacing = exports.getTableHeaderCells = exports.isFilterAppliedToColumnIndex = exports.createEmpty2dArray = exports.getTooltipVariant = exports.getJustifyPropertyFromAlignment = exports.isHeaderCell = exports.createNewSheet = exports.convertThicknessStyleToScaleFactor = exports.convertBorderStyleToDashArray = exports.normalizeDisplayText = exports.pixelToPoint = exports.pointToPixel = exports.isMac = exports.isFirefox = void 0;
|
|
3
|
+
exports.getExtendedValueError = exports.getExtendedValueFormula = exports.getExtendedValueBool = exports.getExtendedValueString = exports.getExtendedValueNumber = exports.getCellEffectiveValue = exports.getCellUserEnteredValue = exports.getCellFormattedValue = exports.isHoveredCellsWithinBounds = exports.isStructuredValue = exports.isStyleReference = exports.isTouchDevice = exports.splitDataValidationListValues = exports.shouldShowFromValue = exports.shouldShowToValue = exports.trimValue = exports.toEditorRangeValuesAsync = exports.checkIfStringIsReference = exports.isEqualColors = exports.sheetRangeToSheetCoordinate = exports.isSheetRange = exports.getCurrencySymbol = exports.isInSequence = exports.createArrayRange = exports.generateMultiDimTitle = exports.addIndent = exports.isGridRange = exports.definedProps = exports.getChipVerticalPosition = exports.getDefaultColumnHeader = exports.getDefaultRowHeader = exports.getHorizontalSpacing = exports.getIconSpacing = exports.getTableHeaderCells = exports.isFilterAppliedToColumnIndex = exports.createEmpty2dArray = exports.getTooltipVariant = exports.getJustifyPropertyFromAlignment = exports.isHeaderCell = exports.createNewSheet = exports.convertThicknessStyleToScaleFactor = exports.getBorderStyleWidth = exports.convertBorderStyleToDashArray = exports.normalizeDisplayText = exports.pixelToPoint = exports.pointToPixel = exports.isMac = exports.isFirefox = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var grid_1 = require("@rowsncolumns/grid");
|
|
6
6
|
var utils_1 = require("@rowsncolumns/utils");
|
|
@@ -12,11 +12,15 @@ exports.isFirefox = grid_1.canUseDOM
|
|
|
12
12
|
: false;
|
|
13
13
|
// Check if platform is macOS, where Ctrl+click is the context menu gesture
|
|
14
14
|
exports.isMac = (0, platform_1.isMacPlatform)();
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Converts a font size in points to CSS pixels: 96 px per inch over 72 pt
|
|
17
|
+
* per inch, unrounded, so 11 pt is 14.67 px as Excel paints it at 100 %
|
|
18
|
+
* (a rounded `1.3 × pt` made 11 pt 14 px and 24 pt 31 px).
|
|
19
|
+
*/
|
|
20
|
+
var pointToPixel = function (pt) { return (pt * 96) / 72; };
|
|
17
21
|
exports.pointToPixel = pointToPixel;
|
|
18
|
-
/* Convert pixel to
|
|
19
|
-
var pixelToPoint = function (px) { return Math.round((px
|
|
22
|
+
/* Convert pixel to (whole) points */
|
|
23
|
+
var pixelToPoint = function (px) { return Math.round((px * 72) / 96); };
|
|
20
24
|
exports.pixelToPoint = pixelToPoint;
|
|
21
25
|
/**
|
|
22
26
|
* Normalize text for display by replacing newlines with spaces.
|
|
@@ -30,47 +34,58 @@ var normalizeDisplayText = function (text, shouldWrap) {
|
|
|
30
34
|
return text.replace(/\n/g, " ");
|
|
31
35
|
};
|
|
32
36
|
exports.normalizeDisplayText = normalizeDisplayText;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Excel's border dash patterns at 100 % zoom, as `setLineDash` on/off runs in
|
|
39
|
+
* CSS pixels (Format Cells ▸ Border ▸ Line style; ECMA-376 §18.18.3
|
|
40
|
+
* ST_BorderStyle). Every style is distinct: hair and dotted differ in spacing,
|
|
41
|
+
* the medium variants share their thin pattern at twice the width (see
|
|
42
|
+
* {@link getBorderStyleWidth}), and `slantDashDot` is the medium dash-dot
|
|
43
|
+
* painted as slanted parallelograms (`getSlantDashQuads` in cell-overlay).
|
|
44
|
+
*/
|
|
45
|
+
var BORDER_DASH_PATTERNS = {
|
|
46
|
+
hair: [1, 1],
|
|
47
|
+
dotted: [2, 2],
|
|
48
|
+
dashed: [3, 1],
|
|
49
|
+
mediumDashed: [9, 3],
|
|
50
|
+
dashDot: [9, 3, 3, 3],
|
|
51
|
+
mediumDashDot: [9, 3, 3, 3],
|
|
52
|
+
dashDotDot: [9, 3, 3, 3, 3, 3],
|
|
53
|
+
mediumDashDotDot: [9, 3, 3, 3, 3, 3],
|
|
54
|
+
slantDashDot: [9, 1, 3, 1],
|
|
40
55
|
};
|
|
41
56
|
/**
|
|
42
|
-
* Converts border style to dash array
|
|
43
|
-
*
|
|
44
|
-
* @returns
|
|
57
|
+
* Converts border style to a dash array, scaled by the zoom so a dash keeps
|
|
58
|
+
* its length relative to the cells.
|
|
45
59
|
*/
|
|
46
|
-
var convertBorderStyleToDashArray = function (style) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
var convertBorderStyleToDashArray = function (style, scale) {
|
|
61
|
+
if (scale === void 0) { scale = 1; }
|
|
62
|
+
var pattern = style ? BORDER_DASH_PATTERNS[style] : undefined;
|
|
63
|
+
return pattern === null || pattern === void 0 ? void 0 : pattern.map(function (length) { return length * scale; });
|
|
64
|
+
};
|
|
65
|
+
exports.convertBorderStyleToDashArray = convertBorderStyleToDashArray;
|
|
66
|
+
/**
|
|
67
|
+
* Stroke width (unscaled px) Excel paints a dashed / dotted border style
|
|
68
|
+
* with: the medium variants and `slantDashDot` are 2 px, the thin ones 1 px.
|
|
69
|
+
* Solid and double styles keep the width they carry.
|
|
70
|
+
*/
|
|
71
|
+
var getBorderStyleWidth = function (style, width) {
|
|
50
72
|
switch (style) {
|
|
51
|
-
case "dashed":
|
|
52
|
-
case "mediumDashed":
|
|
53
|
-
return [2, 2];
|
|
54
|
-
case "dotted":
|
|
55
|
-
return getDotArray();
|
|
56
73
|
case "hair":
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
case "dotted":
|
|
75
|
+
case "dashed":
|
|
59
76
|
case "dashDot":
|
|
60
|
-
case "mediumDashDot":
|
|
61
|
-
return [4, 2, 1, 2];
|
|
62
77
|
case "dashDotDot":
|
|
63
|
-
return
|
|
78
|
+
return 1;
|
|
79
|
+
case "mediumDashed":
|
|
80
|
+
case "mediumDashDot":
|
|
81
|
+
case "mediumDashDotDot":
|
|
64
82
|
case "slantDashDot":
|
|
65
|
-
|
|
66
|
-
// standard dash-dot pattern. Visually distinct from `solid` even
|
|
67
|
-
// without the slant.
|
|
68
|
-
return [4, 2, 1, 2];
|
|
83
|
+
return 2;
|
|
69
84
|
default:
|
|
70
|
-
return
|
|
85
|
+
return width !== null && width !== void 0 ? width : 0;
|
|
71
86
|
}
|
|
72
87
|
};
|
|
73
|
-
exports.
|
|
88
|
+
exports.getBorderStyleWidth = getBorderStyleWidth;
|
|
74
89
|
/**
|
|
75
90
|
* Converts border thickness to value
|
|
76
91
|
* @param style
|
|
@@ -81,6 +96,7 @@ var convertThicknessStyleToScaleFactor = function (style) {
|
|
|
81
96
|
case "solid_medium":
|
|
82
97
|
case "mediumDashed":
|
|
83
98
|
case "mediumDashDot":
|
|
99
|
+
case "mediumDashDotDot":
|
|
84
100
|
return 1.5;
|
|
85
101
|
case "solid_thick":
|
|
86
102
|
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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_1 = require("../helpers");
|
|
14
|
-
var themes_1 = require("../themes");
|
|
15
14
|
var use_memo_compare_1 = require("./use-memo-compare");
|
|
16
15
|
/**
|
|
17
16
|
* Checks if the user is dragging a table or basicFilter
|
|
@@ -100,19 +99,6 @@ var getDraggedColumnStyle = function (direction, borderColor) {
|
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
|
-
// Get first table border color
|
|
104
|
-
var getTableBorder = function (properties) {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
if (properties.headerBorder) {
|
|
107
|
-
return (_a = properties.headerBorder.left) === null || _a === void 0 ? void 0 : _a.color;
|
|
108
|
-
}
|
|
109
|
-
if (properties.firstBandBorder) {
|
|
110
|
-
return (_b = properties.firstBandBorder.bottom) === null || _b === void 0 ? void 0 : _b.color;
|
|
111
|
-
}
|
|
112
|
-
if (properties.headerColor) {
|
|
113
|
-
return properties.headerColor;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
102
|
var useBorderStyles = function (_a) {
|
|
117
103
|
var draggedSelection = _a.draggedSelection, initialDraggedSelection = _a.initialDraggedSelection, users = _a.users, currentUserId = _a.userId, renderCollaboratorCursor = _a.renderCollaboratorCursor, currentSheetId = _a.sheetId, borderStyles = _a.borderStyles, flashingBorders = _a.flashingBorders, copiedSelections = _a.copiedSelections, selectionDragBorderColor = _a.selectionDragBorderColor, _b = _a.selectionBorderColor, selectionBorderColor = _b === void 0 ? config_1.SELECTION_BORDER : _b, tableBorderColor = _a.tableBorderColor, _c = _a.pivotTableBorderColor, pivotTableBorderColor = _c === void 0 ? tableBorderColor : _c, tables = _a.tables, pivotTables = _a.pivotTables, basicFilter = _a.basicFilter, hoveredCell = _a.hoveredCell, activeCell = _a.activeCell, theme = _a.theme, agentSuggestions = _a.agentSuggestions, quickEditValues = _a.quickEditValues;
|
|
118
104
|
var getAddressFromSelection = (0, atoms_1.useGetAddressFromSelection)();
|
|
@@ -210,24 +196,17 @@ var useBorderStyles = function (_a) {
|
|
|
210
196
|
var styles = [];
|
|
211
197
|
// Tables
|
|
212
198
|
tables === null || tables === void 0 ? void 0 : tables.forEach(function (table) {
|
|
213
|
-
var _a, _b, _c, _d, _e;
|
|
214
199
|
if (table.sheetId === currentSheetId) {
|
|
215
200
|
var range = table.range, id = table.id;
|
|
216
201
|
var isWithinBounds = cachedRangeIds.has(id);
|
|
217
|
-
var hasBorder = ((_a = table.bandedRange) === null || _a === void 0 ? void 0 : _a.rowProperties) ||
|
|
218
|
-
((_b = table.bandedRange) === null || _b === void 0 ? void 0 : _b.columnProperties);
|
|
219
|
-
var tableBorder = hasBorder && ((_c = table.bandedRange) === null || _c === void 0 ? void 0 : _c.rowProperties)
|
|
220
|
-
? (_e = (0, themes_1.getStringifiedColor)(getTableBorder((_d = table.bandedRange) === null || _d === void 0 ? void 0 : _d.rowProperties), theme)) !== null && _e !== void 0 ? _e : tableBorderColor
|
|
221
|
-
: tableBorderColor;
|
|
222
202
|
styles.push({
|
|
223
203
|
index: id,
|
|
224
204
|
title: isWithinBounds ? table.title : undefined,
|
|
225
205
|
type: "table",
|
|
226
206
|
range: range,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
},
|
|
207
|
+
// Excel draws no outline round a table: its own borders come from
|
|
208
|
+
// the table style. The entry stays for the name tag and dragging.
|
|
209
|
+
style: { strokeWidth: 0 },
|
|
231
210
|
table: table,
|
|
232
211
|
draggable: true,
|
|
233
212
|
});
|
|
@@ -366,10 +345,8 @@ var useBorderStyles = function (_a) {
|
|
|
366
345
|
index: id,
|
|
367
346
|
type: "table",
|
|
368
347
|
range: range,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
stroke: tableBorderColor,
|
|
372
|
-
},
|
|
348
|
+
// No outline round an AutoFilter range either (Excel).
|
|
349
|
+
style: { strokeWidth: 0 },
|
|
373
350
|
title: isWithinBounds ? (_a = basicFilter.title) !== null && _a !== void 0 ? _a : undefined : undefined,
|
|
374
351
|
draggable: false,
|
|
375
352
|
});
|
|
@@ -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,CAAC;AAE5C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAAI;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C,cA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,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"}
|
|
@@ -11,6 +11,7 @@ var validation_1 = require("../api/validation");
|
|
|
11
11
|
var alignment_1 = require("../components/cell/alignment");
|
|
12
12
|
var cell_background_1 = require("../components/cell/cell-background");
|
|
13
13
|
var cell_backgrounds_1 = require("../components/cell/cell-backgrounds");
|
|
14
|
+
var number_format_layout_1 = require("../components/cell/number-format-layout");
|
|
14
15
|
var cell_diff_1 = require("../components/cell-diff");
|
|
15
16
|
var cell_overlay_1 = require("../components/cell-overlay");
|
|
16
17
|
var config_1 = require("../config");
|
|
@@ -20,13 +21,13 @@ var themes_1 = require("../themes");
|
|
|
20
21
|
var show_zeros_1 = require("./show-zeros");
|
|
21
22
|
var use_cell_diff_highlight_1 = require("./use-cell-diff-highlight");
|
|
22
23
|
var useCellRenderer = function (_a) {
|
|
23
|
-
var sheetId = _a.sheetId, scale = _a.scale, showGridLines = _a.showGridLines, showZeros = _a.showZeros, isRowHeader = _a.isRowHeader, isColumnHeader = _a.isColumnHeader, selectedRows = _a.selectedRows, selectedColumns = _a.selectedColumns, selectedRowHeaders = _a.selectedRowHeaders, selectedColumnHeaders = _a.selectedColumnHeaders, cellBackgroundColor = _a.cellBackgroundColor, headerBorderColor = _a.headerBorderColor, headerBackgroundColor = _a.headerBackgroundColor, headerColor = _a.headerColor, headerActiveBackgroundColor = _a.headerActiveBackgroundColor, headerSelectedBackgroundColor = _a.headerSelectedBackgroundColor, headerSelectedColor = _a.headerSelectedColor, headerTableBackgroundColor = _a.headerTableBackgroundColor, headerTableActiveBackgroundColor = _a.headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor = _a.headerTableSelectedBackgroundColor, chipBackgroundColor = _a.chipBackgroundColor, filterIconColor = _a.filterIconColor, showCalculatedColumnIcon = _a.showCalculatedColumnIcon, enableTextOverflow = _a.enableTextOverflow, showHeaders = _a.showHeaders, theme = _a.theme, getDefaultHorizontalAlignment = _a.getDefaultHorizontalAlignment, isTableFilterVisible = _a.isTableFilterVisible, columnContainsTable = _a.columnContainsTable, rowsContainsTable = _a.rowsContainsTable, canOverflowToNextCell = _a.canOverflowToNextCell, getTableHeaderSortOrder = _a.getTableHeaderSortOrder, getDataValidation = _a.getDataValidation, getErrorValue = _a.getErrorValue, formulaLocale = _a.formulaLocale, getEffectiveValue = _a.getEffectiveValue, getSparklineGroup = _a.getSparklineGroup, getFormattedValue = _a.getFormattedValue, getNote = _a.getNote, getComment = _a.getComment, getEffectiveCellFormat = _a.getEffectiveCellFormat, getCellBounds = _a.getCellBounds, getCellImageUrl = _a.getCellImageUrl, getCellMetaType = _a.getCellMetaType, getRowHeaderText = _a.getRowHeaderText, getColumnHeaderText = _a.getColumnHeaderText, getMaximumOverflowTextWidth = _a.getMaximumOverflowTextWidth, getTextDimension = _a.getTextDimension, getCellGroupingInfo = _a.getCellGroupingInfo, getTextFormatRuns = _a.getTextFormatRuns, onRequestEdit = _a.onRequestEdit, onFilterClick = _a.onFilterClick, onCheckboxClick = _a.onCheckboxClick, isTableHeader = _a.isTableHeader, isTableTotalsCell = _a.isTableTotalsCell, onTotalsArrowClick = _a.onTotalsArrowClick, isCalculatedColumnHeader = _a.isCalculatedColumnHeader, isTableHeaderFilterActive = _a.isTableHeaderFilterActive, HeaderCell = _a.HeaderCell, Cell = _a.Cell, StructuredResult = _a.StructuredResult, gridLineWidth = _a.gridLineWidth, showNotes = _a.showNotes, showComments = _a.showComments, defaultFontSizePoint = _a.defaultFontSizePoint, lineHeightMode = _a.lineHeightMode, readonly = _a.readonly, onExpandCollapse = _a.onExpandCollapse, onOverflow = _a.onOverflow, _b = _a.isComparing, isComparing = _b === void 0 ? false : _b, getCellDiff = _a.getCellDiff;
|
|
24
|
+
var sheetId = _a.sheetId, scale = _a.scale, showGridLines = _a.showGridLines, showZeros = _a.showZeros, isRowHeader = _a.isRowHeader, isColumnHeader = _a.isColumnHeader, selectedRows = _a.selectedRows, selectedColumns = _a.selectedColumns, selectedRowHeaders = _a.selectedRowHeaders, selectedColumnHeaders = _a.selectedColumnHeaders, cellBackgroundColor = _a.cellBackgroundColor, headerBorderColor = _a.headerBorderColor, headerBackgroundColor = _a.headerBackgroundColor, headerColor = _a.headerColor, headerActiveBackgroundColor = _a.headerActiveBackgroundColor, headerSelectedBackgroundColor = _a.headerSelectedBackgroundColor, headerSelectedColor = _a.headerSelectedColor, headerTableBackgroundColor = _a.headerTableBackgroundColor, headerTableActiveBackgroundColor = _a.headerTableActiveBackgroundColor, headerTableSelectedBackgroundColor = _a.headerTableSelectedBackgroundColor, chipBackgroundColor = _a.chipBackgroundColor, filterIconColor = _a.filterIconColor, showCalculatedColumnIcon = _a.showCalculatedColumnIcon, enableTextOverflow = _a.enableTextOverflow, showHeaders = _a.showHeaders, theme = _a.theme, getDefaultHorizontalAlignment = _a.getDefaultHorizontalAlignment, isTableFilterVisible = _a.isTableFilterVisible, columnContainsTable = _a.columnContainsTable, rowsContainsTable = _a.rowsContainsTable, canOverflowToNextCell = _a.canOverflowToNextCell, getTableHeaderSortOrder = _a.getTableHeaderSortOrder, getDataValidation = _a.getDataValidation, getErrorValue = _a.getErrorValue, formulaLocale = _a.formulaLocale, locale = _a.locale, getEffectiveValue = _a.getEffectiveValue, getSparklineGroup = _a.getSparklineGroup, getFormattedValue = _a.getFormattedValue, getNote = _a.getNote, getComment = _a.getComment, getEffectiveCellFormat = _a.getEffectiveCellFormat, getCellBounds = _a.getCellBounds, getCellImageUrl = _a.getCellImageUrl, getCellMetaType = _a.getCellMetaType, getRowHeaderText = _a.getRowHeaderText, getColumnHeaderText = _a.getColumnHeaderText, getMaximumOverflowTextWidth = _a.getMaximumOverflowTextWidth, getCenterAcrossSelectionSpan = _a.getCenterAcrossSelectionSpan, activeCell = _a.activeCell, getTextDimension = _a.getTextDimension, getCellGroupingInfo = _a.getCellGroupingInfo, getTextFormatRuns = _a.getTextFormatRuns, onRequestEdit = _a.onRequestEdit, onFilterClick = _a.onFilterClick, onCheckboxClick = _a.onCheckboxClick, isTableHeader = _a.isTableHeader, isTableTotalsCell = _a.isTableTotalsCell, onTotalsArrowClick = _a.onTotalsArrowClick, isCalculatedColumnHeader = _a.isCalculatedColumnHeader, isTableHeaderFilterActive = _a.isTableHeaderFilterActive, HeaderCell = _a.HeaderCell, Cell = _a.Cell, StructuredResult = _a.StructuredResult, gridLineWidth = _a.gridLineWidth, showNotes = _a.showNotes, showComments = _a.showComments, defaultFontSizePoint = _a.defaultFontSizePoint, lineHeightMode = _a.lineHeightMode, readonly = _a.readonly, onExpandCollapse = _a.onExpandCollapse, onOverflow = _a.onOverflow, _b = _a.isComparing, isComparing = _b === void 0 ? false : _b, getCellDiff = _a.getCellDiff;
|
|
24
25
|
// Version comparison diff highlighting - only active when isComparing is true
|
|
25
26
|
var _c = (0, use_cell_diff_highlight_1.useCellDiffHighlight)(isComparing ? getCellDiff : undefined), mergeCellFormatWithDiff = _c.mergeCellFormatWithDiff, getDiffHighlight = _c.getDiffHighlight;
|
|
26
27
|
// Edit
|
|
27
28
|
var onRequestEditCell = (0, react_1.useCallback)(function (cell) { return onRequestEdit === null || onRequestEdit === void 0 ? void 0 : onRequestEdit(sheetId, cell); }, [sheetId, onRequestEdit]);
|
|
28
29
|
var cellRenderer = (0, react_1.useCallback)(function (props) {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
30
31
|
var rowIndex = props.rowIndex, columnIndex = props.columnIndex, isMergedCell = props.isMergedCell;
|
|
31
32
|
// Body cell
|
|
32
33
|
var rawFormattedValue = getFormattedValue(sheetId, rowIndex, columnIndex);
|
|
@@ -34,12 +35,17 @@ var useCellRenderer = function (_a) {
|
|
|
34
35
|
var effectiveCellFormat = getEffectiveCellFormat(sheetId, rowIndex, columnIndex);
|
|
35
36
|
// Checkbox for boolean values (Checkbox icon)
|
|
36
37
|
var effectiveValue = getEffectiveValue(sheetId, rowIndex, columnIndex);
|
|
37
|
-
|
|
38
|
+
// "Show Bar Only" / "Show Icon Only" conditional formats hide the value.
|
|
39
|
+
var hideConditionalValue = Boolean(((_a = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.conditionalDataBar) === null || _a === void 0 ? void 0 : _a.hideValue) ||
|
|
40
|
+
((_b = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.conditionalIcon) === null || _b === void 0 ? void 0 : _b.hideValue));
|
|
41
|
+
var formattedValue = hideConditionalValue
|
|
42
|
+
? ""
|
|
43
|
+
: (0, show_zeros_1.applyShowZeros)(rawFormattedValue, effectiveValue, showZeros);
|
|
38
44
|
var dataValidation = getDataValidation(sheetId, rowIndex, columnIndex);
|
|
39
|
-
var validationType = (
|
|
45
|
+
var validationType = (_c = dataValidation === null || dataValidation === void 0 ? void 0 : dataValidation.condition) === null || _c === void 0 ? void 0 : _c.type;
|
|
40
46
|
var horizontalAlignment = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.horizontalAlignment;
|
|
41
47
|
// Expandable
|
|
42
|
-
var
|
|
48
|
+
var _q = tslib_1.__read(getCellGroupingInfo(sheetId, rowIndex, columnIndex), 2), expandable = _q[0], expanded = _q[1];
|
|
43
49
|
// Display style
|
|
44
50
|
var showChip = getCellMetaType(sheetId, rowIndex, columnIndex) === "people";
|
|
45
51
|
// Image url
|
|
@@ -49,7 +55,13 @@ var useCellRenderer = function (_a) {
|
|
|
49
55
|
// Show dropdown arrow: a data-validation list, or a table totals cell
|
|
50
56
|
// whose arrow opens the totals-function picker.
|
|
51
57
|
var showTotalsArrow = !showFilter && !!(isTableTotalsCell === null || isTableTotalsCell === void 0 ? void 0 : isTableTotalsCell(rowIndex, columnIndex));
|
|
52
|
-
|
|
58
|
+
// Excel shows a list's in-cell dropdown button only beside the active
|
|
59
|
+
// cell, outside its right edge — it never takes room from the value.
|
|
60
|
+
var showValidationArrow = !showTotalsArrow &&
|
|
61
|
+
(activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex) === rowIndex &&
|
|
62
|
+
(activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex) === columnIndex &&
|
|
63
|
+
(0, validation_1.showValidationDropdownArrow)(dataValidation);
|
|
64
|
+
var showArrow = showValidationArrow || showTotalsArrow;
|
|
53
65
|
// Has notes
|
|
54
66
|
var showNote = showNotes
|
|
55
67
|
? !!getNote(sheetId, rowIndex, columnIndex)
|
|
@@ -66,7 +78,8 @@ var useCellRenderer = function (_a) {
|
|
|
66
78
|
// repeats the text to the cell edge — none of them ever spill into
|
|
67
79
|
// the neighbouring cells.
|
|
68
80
|
var wrapStrategy = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.wrapStrategy;
|
|
69
|
-
var wrapsByAlignment = (0, alignment_1.alignmentImpliesWrap)(horizontalAlignment)
|
|
81
|
+
var wrapsByAlignment = (0, alignment_1.alignmentImpliesWrap)(horizontalAlignment) ||
|
|
82
|
+
(0, alignment_1.verticalAlignmentImpliesWrap)(effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.verticalAlignment);
|
|
70
83
|
var fillsCell = (0, alignment_1.isFillAlignment)(horizontalAlignment);
|
|
71
84
|
var shouldWrap = wrapStrategy === "wrap" || wrapsByAlignment;
|
|
72
85
|
var isWrapEnabled = (wrapStrategy !== null && wrapStrategy !== void 0 ? wrapStrategy : "overflow") === "overflow" &&
|
|
@@ -78,7 +91,7 @@ var useCellRenderer = function (_a) {
|
|
|
78
91
|
// Indent
|
|
79
92
|
var isRightAligned = horizontalAlignment === "right";
|
|
80
93
|
// Only strings which are right aligned can overflow to neighbours
|
|
81
|
-
var isStringValue = !(0, utils_1.isNil)((
|
|
94
|
+
var isStringValue = !(0, utils_1.isNil)((_d = effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.sv) !== null && _d !== void 0 ? _d : effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.stringValue);
|
|
82
95
|
var overflowRight = isRightAligned && isStringValue;
|
|
83
96
|
// shrinkToFit and rotated text both keep the text inside the cell,
|
|
84
97
|
// so they must not spill into neighbours regardless of wrapStrategy.
|
|
@@ -87,30 +100,44 @@ var useCellRenderer = function (_a) {
|
|
|
87
100
|
Number.isFinite(numericRotation) &&
|
|
88
101
|
numericRotation !== 0;
|
|
89
102
|
var containsTextInside = !!(effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.shrinkToFit) || hasNumericRotation;
|
|
90
|
-
var
|
|
103
|
+
var isCentered = horizontalAlignment === "center";
|
|
104
|
+
var isCenterAcross = horizontalAlignment === "centerContinuous";
|
|
105
|
+
var canSpill = enableTextOverflow &&
|
|
91
106
|
isWrapEnabled &&
|
|
92
|
-
!dataValidation &&
|
|
93
107
|
!showFilter &&
|
|
94
108
|
!isCalculatedColumn &&
|
|
95
|
-
!
|
|
109
|
+
!showTotalsArrow &&
|
|
96
110
|
!expandable &&
|
|
97
111
|
!containsTextInside &&
|
|
98
112
|
// Following Excel and Google sheets behavior
|
|
99
113
|
// Text does not overflow merged cells
|
|
100
|
-
!isMergedCell
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
!isMergedCell;
|
|
115
|
+
// Center Across Selection: the text centres over the run of empty
|
|
116
|
+
// neighbours that share the alignment, however short it is.
|
|
117
|
+
var centerAcrossSpan = canSpill && isCenterAcross && !(0, utils_1.isNilOrBlank)(displayFormattedValue)
|
|
118
|
+
? getCenterAcrossSelectionSpan === null || getCenterAcrossSelectionSpan === void 0 ? void 0 : getCenterAcrossSelectionSpan(sheetId, rowIndex, columnIndex)
|
|
119
|
+
: undefined;
|
|
120
|
+
var shouldOverflow = !!centerAcrossSpan ||
|
|
121
|
+
(canSpill &&
|
|
122
|
+
(isRightAligned ? isStringValue : true) &&
|
|
123
|
+
(isCentered
|
|
124
|
+
? canOverflowToNextCell({ rowIndex: rowIndex, columnIndex: columnIndex - 1 }) ||
|
|
125
|
+
canOverflowToNextCell({ rowIndex: rowIndex, columnIndex: columnIndex + 1 })
|
|
126
|
+
: canOverflowToNextCell({
|
|
127
|
+
rowIndex: rowIndex,
|
|
128
|
+
columnIndex: columnIndex + (isRightAligned ? -1 : 1),
|
|
129
|
+
})));
|
|
130
|
+
var _r = tslib_1.__read(centerAcrossSpan
|
|
131
|
+
? centerAcrossSpan
|
|
132
|
+
: shouldOverflow
|
|
133
|
+
? getMaximumOverflowTextWidth(displayFormattedValue, sheetId, rowIndex, columnIndex,
|
|
134
|
+
// Investigate why isHiddenCell and the instance from Sheet-Grid differs
|
|
135
|
+
canOverflowToNextCell, effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.textFormat, shouldWrap, isRightAligned ? grid_1.Direction.Left : grid_1.Direction.Right, isCentered)
|
|
136
|
+
: [
|
|
137
|
+
props.width,
|
|
138
|
+
config_1.DEFAULT_ARRAY,
|
|
139
|
+
undefined,
|
|
140
|
+
], 3), cellWidth = _r[0], columnSpans = _r[1], overflowLeft = _r[2];
|
|
114
141
|
if (shouldOverflow && cellWidth > props.width) {
|
|
115
142
|
// Report the full visual width as the required buffer
|
|
116
143
|
// This ensures that even if we scroll to the far right of the overflow,
|
|
@@ -146,7 +173,7 @@ var useCellRenderer = function (_a) {
|
|
|
146
173
|
var errorValue = getErrorValue(sheetId, rowIndex, columnIndex);
|
|
147
174
|
var isInvalid = (errorValue === null || errorValue === void 0 ? void 0 : errorValue.type) === "Invalid";
|
|
148
175
|
var showCheckbox = !errorValue && validationType === "BOOLEAN";
|
|
149
|
-
var isChecked = ((
|
|
176
|
+
var isChecked = ((_e = effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.bv) !== null && _e !== void 0 ? _e : effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.boolValue) === true;
|
|
150
177
|
// Error from formula calculation (Error icon). Both engines store the canonical spelling
|
|
151
178
|
// (`#VALUE!`); the grid paints the formula locale's (`#ЗНАЧ!`).
|
|
152
179
|
var isError = (errorValue === null || errorValue === void 0 ? void 0 : errorValue.type) === "Error";
|
|
@@ -162,17 +189,24 @@ var useCellRenderer = function (_a) {
|
|
|
162
189
|
diffHighlight &&
|
|
163
190
|
diffHighlight.diffState !== "unchanged") {
|
|
164
191
|
// Get text color from format or use default
|
|
165
|
-
var textColor = ((
|
|
192
|
+
var textColor = ((_f = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.textFormat) === null || _f === void 0 ? void 0 : _f.color)
|
|
166
193
|
? (0, themes_1.getStringifiedColor)(effectiveCellFormat.textFormat.color, theme)
|
|
167
194
|
: undefined;
|
|
168
195
|
// Measure old value width for proper spacing in modified cells
|
|
169
196
|
// Use the old format for accurate measurement (bold text is wider than normal)
|
|
170
197
|
var oldValueWidth = diffHighlight.oldFormattedValue
|
|
171
|
-
? getTextDimension(sheetId, rowIndex, columnIndex, diffHighlight.oldFormattedValue, (
|
|
198
|
+
? getTextDimension(sheetId, rowIndex, columnIndex, diffHighlight.oldFormattedValue, (_h = (_g = diffHighlight.oldFormat) === null || _g === void 0 ? void 0 : _g.textFormat) !== null && _h !== void 0 ? _h : undefined).width
|
|
172
199
|
: undefined;
|
|
173
|
-
return (react_1.default.createElement(cell_diff_1.CellDiff, tslib_1.__assign({ diffHighlight: diffHighlight, value: formattedValue, defaultColor: textColor, scale: scale, fontSizePt: defaultFontSizePoint, fontFamily: (
|
|
200
|
+
return (react_1.default.createElement(cell_diff_1.CellDiff, tslib_1.__assign({ diffHighlight: diffHighlight, value: formattedValue, defaultColor: textColor, scale: scale, fontSizePt: defaultFontSizePoint, fontFamily: (_j = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.textFormat) === null || _j === void 0 ? void 0 : _j.fontFamily, bold: (_k = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.textFormat) === null || _k === void 0 ? void 0 : _k.bold, italic: (_l = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.textFormat) === null || _l === void 0 ? void 0 : _l.italic, horizontalAlignment: effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.horizontalAlignment, verticalAlignment: (effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.verticalAlignment)
|
|
201
|
+
? (0, alignment_1.resolveCanvasVerticalAlign)(effectiveCellFormat.verticalAlignment)
|
|
202
|
+
: undefined, oldValueWidth: oldValueWidth }, props)));
|
|
174
203
|
}
|
|
175
|
-
|
|
204
|
+
var numberFormatLayout = isError
|
|
205
|
+
? undefined
|
|
206
|
+
: (0, number_format_layout_1.getCellNumberFormatLayout)((_m = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.numberFormat) === null || _m === void 0 ? void 0 : _m.pattern, (_o = (0, utils_1.getExtendedValueNumber)(effectiveValue)) !== null && _o !== void 0 ? _o : (0, utils_1.getExtendedValueString)(effectiveValue), displayValue, locale);
|
|
207
|
+
return (react_1.default.createElement(Cell, tslib_1.__assign({ 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)
|
|
208
|
+
? overflowLeft !== null && overflowLeft !== void 0 ? overflowLeft : 0
|
|
209
|
+
: undefined, centerOnSpan: !!centerAcrossSpan, showGridLines: showGridLines, structuredValue: effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.structuredValue, sparklineGroupAxis: ((_p = effectiveValue === null || effectiveValue === void 0 ? void 0 : effectiveValue.structuredValue) === null || _p === void 0 ? void 0 : _p.kind) === "sparkline" &&
|
|
176
210
|
getSparklineGroup
|
|
177
211
|
? (0, sparkline_math_1.sparklineGroupAxisFor)(effectiveValue.structuredValue, function () { return getSparklineGroup(sheetId, { rowIndex: rowIndex, columnIndex: columnIndex }); }, function (cell) {
|
|
178
212
|
var _a;
|
|
@@ -190,6 +224,7 @@ var useCellRenderer = function (_a) {
|
|
|
190
224
|
sheetId,
|
|
191
225
|
scale,
|
|
192
226
|
showGridLines,
|
|
227
|
+
showZeros,
|
|
193
228
|
theme,
|
|
194
229
|
showNotes,
|
|
195
230
|
showComments,
|
|
@@ -209,6 +244,7 @@ var useCellRenderer = function (_a) {
|
|
|
209
244
|
getDataValidation,
|
|
210
245
|
getErrorValue,
|
|
211
246
|
formulaLocale,
|
|
247
|
+
locale,
|
|
212
248
|
getEffectiveValue,
|
|
213
249
|
getSparklineGroup,
|
|
214
250
|
getFormattedValue,
|
|
@@ -218,6 +254,8 @@ var useCellRenderer = function (_a) {
|
|
|
218
254
|
getNote,
|
|
219
255
|
getComment,
|
|
220
256
|
getMaximumOverflowTextWidth,
|
|
257
|
+
getCenterAcrossSelectionSpan,
|
|
258
|
+
activeCell,
|
|
221
259
|
getCellGroupingInfo,
|
|
222
260
|
onCheckboxClick,
|
|
223
261
|
onFilterClick,
|
|
@@ -313,28 +351,28 @@ var useCellRenderer = function (_a) {
|
|
|
313
351
|
var strokeDiagonalUpStyle = (_m = borders === null || borders === void 0 ? void 0 : borders.diagonalUp) === null || _m === void 0 ? void 0 : _m.style;
|
|
314
352
|
var strokeDiagonalDownStyle = (_o = borders === null || borders === void 0 ? void 0 : borders.diagonalDown) === null || _o === void 0 ? void 0 : _o.style;
|
|
315
353
|
/* Border width */
|
|
316
|
-
var strokeTopWidth = (strokeTopStyle === "double" ? 3 : (
|
|
317
|
-
var strokeBottomWidth = (strokeBottomStyle === "double" ? 3 : (
|
|
354
|
+
var strokeTopWidth = (strokeTopStyle === "double" ? 3 : (0, helpers_1.getBorderStyleWidth)((_p = borders === null || borders === void 0 ? void 0 : borders.top) === null || _p === void 0 ? void 0 : _p.style, (_q = borders === null || borders === void 0 ? void 0 : borders.top) === null || _q === void 0 ? void 0 : _q.width)) * scale;
|
|
355
|
+
var strokeBottomWidth = (strokeBottomStyle === "double" ? 3 : (0, helpers_1.getBorderStyleWidth)((_r = borders === null || borders === void 0 ? void 0 : borders.bottom) === null || _r === void 0 ? void 0 : _r.style, (_s = borders === null || borders === void 0 ? void 0 : borders.bottom) === null || _s === void 0 ? void 0 : _s.width)) *
|
|
318
356
|
scale;
|
|
319
|
-
var strokeLeftWidth = (strokeLeftStyle === "double" ? 3 : (
|
|
320
|
-
var strokeRightWidth = (strokeRightStyle === "double" ? 3 : (
|
|
357
|
+
var strokeLeftWidth = (strokeLeftStyle === "double" ? 3 : (0, helpers_1.getBorderStyleWidth)((_t = borders === null || borders === void 0 ? void 0 : borders.left) === null || _t === void 0 ? void 0 : _t.style, (_u = borders === null || borders === void 0 ? void 0 : borders.left) === null || _u === void 0 ? void 0 : _u.width)) * scale;
|
|
358
|
+
var strokeRightWidth = (strokeRightStyle === "double" ? 3 : (0, helpers_1.getBorderStyleWidth)((_v = borders === null || borders === void 0 ? void 0 : borders.right) === null || _v === void 0 ? void 0 : _v.style, (_w = borders === null || borders === void 0 ? void 0 : borders.right) === null || _w === void 0 ? void 0 : _w.width)) *
|
|
321
359
|
scale;
|
|
322
360
|
var strokeDiagonalUpWidth = (strokeDiagonalUpStyle === "double"
|
|
323
361
|
? 3
|
|
324
|
-
: (
|
|
362
|
+
: (0, helpers_1.getBorderStyleWidth)((_x = borders === null || borders === void 0 ? void 0 : borders.diagonalUp) === null || _x === void 0 ? void 0 : _x.style, (_y = borders === null || borders === void 0 ? void 0 : borders.diagonalUp) === null || _y === void 0 ? void 0 : _y.width)) * scale;
|
|
325
363
|
var strokeDiagonalDownWidth = (strokeDiagonalDownStyle === "double"
|
|
326
364
|
? 3
|
|
327
|
-
: (
|
|
365
|
+
: (0, helpers_1.getBorderStyleWidth)((_z = borders === null || borders === void 0 ? void 0 : borders.diagonalDown) === null || _z === void 0 ? void 0 : _z.style, (_0 = borders === null || borders === void 0 ? void 0 : borders.diagonalDown) === null || _0 === void 0 ? void 0 : _0.width)) * scale;
|
|
328
366
|
// Double inset
|
|
329
367
|
var strokeDoubleInsetWidth = 1 * scale;
|
|
330
368
|
/* Border style */
|
|
331
|
-
var strokeTopDash = (0, helpers_1.convertBorderStyleToDashArray)((_1 = borders === null || borders === void 0 ? void 0 : borders.top) === null || _1 === void 0 ? void 0 : _1.style);
|
|
332
|
-
var strokeBottomDash = (0, helpers_1.convertBorderStyleToDashArray)((_2 = borders === null || borders === void 0 ? void 0 : borders.bottom) === null || _2 === void 0 ? void 0 : _2.style);
|
|
333
|
-
var strokeLeftDash = (0, helpers_1.convertBorderStyleToDashArray)((_3 = borders === null || borders === void 0 ? void 0 : borders.left) === null || _3 === void 0 ? void 0 : _3.style);
|
|
334
|
-
var strokeRightDash = (0, helpers_1.convertBorderStyleToDashArray)((_4 = borders === null || borders === void 0 ? void 0 : borders.right) === null || _4 === void 0 ? void 0 : _4.style);
|
|
335
|
-
var strokeDiagonalUpDash = (0, helpers_1.convertBorderStyleToDashArray)((_5 = borders === null || borders === void 0 ? void 0 : borders.diagonalUp) === null || _5 === void 0 ? void 0 : _5.style);
|
|
336
|
-
var strokeDiagonalDownDash = (0, helpers_1.convertBorderStyleToDashArray)((_6 = borders === null || borders === void 0 ? void 0 : borders.diagonalDown) === null || _6 === void 0 ? void 0 : _6.style);
|
|
337
|
-
return (0, cell_overlay_1.CellOverlayRenderer)(tslib_1.__assign(tslib_1.__assign({}, props), { strokeDoubleInsetWidth: strokeDoubleInsetWidth, strokeTopColor: strokeTopColor, strokeBottomColor: strokeBottomColor, strokeLeftColor: strokeLeftColor, strokeRightColor: strokeRightColor, strokeDiagonalUpColor: strokeDiagonalUpColor, strokeDiagonalDownColor: strokeDiagonalDownColor, strokeTopWidth: strokeTopWidth, strokeBottomWidth: strokeBottomWidth, strokeLeftWidth: strokeLeftWidth, strokeRightWidth: strokeRightWidth, strokeDiagonalUpWidth: strokeDiagonalUpWidth, strokeDiagonalDownWidth: strokeDiagonalDownWidth, strokeTopDash: strokeTopDash, strokeBottomDash: strokeBottomDash, strokeLeftDash: strokeLeftDash, strokeRightDash: strokeRightDash, strokeDiagonalUpDash: strokeDiagonalUpDash, strokeDiagonalDownDash: strokeDiagonalDownDash, strokeTopStyle: strokeTopStyle, strokeBottomStyle: strokeBottomStyle, strokeLeftStyle: strokeLeftStyle, strokeRightStyle: strokeRightStyle, cellBackgroundColor: finalCellBackgroundColor }));
|
|
369
|
+
var strokeTopDash = (0, helpers_1.convertBorderStyleToDashArray)((_1 = borders === null || borders === void 0 ? void 0 : borders.top) === null || _1 === void 0 ? void 0 : _1.style, scale);
|
|
370
|
+
var strokeBottomDash = (0, helpers_1.convertBorderStyleToDashArray)((_2 = borders === null || borders === void 0 ? void 0 : borders.bottom) === null || _2 === void 0 ? void 0 : _2.style, scale);
|
|
371
|
+
var strokeLeftDash = (0, helpers_1.convertBorderStyleToDashArray)((_3 = borders === null || borders === void 0 ? void 0 : borders.left) === null || _3 === void 0 ? void 0 : _3.style, scale);
|
|
372
|
+
var strokeRightDash = (0, helpers_1.convertBorderStyleToDashArray)((_4 = borders === null || borders === void 0 ? void 0 : borders.right) === null || _4 === void 0 ? void 0 : _4.style, scale);
|
|
373
|
+
var strokeDiagonalUpDash = (0, helpers_1.convertBorderStyleToDashArray)((_5 = borders === null || borders === void 0 ? void 0 : borders.diagonalUp) === null || _5 === void 0 ? void 0 : _5.style, scale);
|
|
374
|
+
var strokeDiagonalDownDash = (0, helpers_1.convertBorderStyleToDashArray)((_6 = borders === null || borders === void 0 ? void 0 : borders.diagonalDown) === null || _6 === void 0 ? void 0 : _6.style, scale);
|
|
375
|
+
return (0, cell_overlay_1.CellOverlayRenderer)(tslib_1.__assign(tslib_1.__assign({}, props), { strokeDoubleInsetWidth: strokeDoubleInsetWidth, strokeTopColor: strokeTopColor, strokeBottomColor: strokeBottomColor, strokeLeftColor: strokeLeftColor, strokeRightColor: strokeRightColor, strokeDiagonalUpColor: strokeDiagonalUpColor, strokeDiagonalDownColor: strokeDiagonalDownColor, strokeTopWidth: strokeTopWidth, strokeBottomWidth: strokeBottomWidth, strokeLeftWidth: strokeLeftWidth, strokeRightWidth: strokeRightWidth, strokeDiagonalUpWidth: strokeDiagonalUpWidth, strokeDiagonalDownWidth: strokeDiagonalDownWidth, strokeTopDash: strokeTopDash, strokeBottomDash: strokeBottomDash, strokeLeftDash: strokeLeftDash, strokeRightDash: strokeRightDash, strokeDiagonalUpDash: strokeDiagonalUpDash, strokeDiagonalDownDash: strokeDiagonalDownDash, strokeTopStyle: strokeTopStyle, strokeBottomStyle: strokeBottomStyle, strokeLeftStyle: strokeLeftStyle, strokeRightStyle: strokeRightStyle, strokeDiagonalUpStyle: strokeDiagonalUpStyle, strokeDiagonalDownStyle: strokeDiagonalDownStyle, cellBackgroundColor: finalCellBackgroundColor }));
|
|
338
376
|
}, [
|
|
339
377
|
getEffectiveCellFormat,
|
|
340
378
|
getCellBounds,
|
|
@@ -357,11 +395,11 @@ var useCellRenderer = function (_a) {
|
|
|
357
395
|
*/
|
|
358
396
|
var fillPattern = (_a = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.fillPattern) !== null && _a !== void 0 ? _a : null;
|
|
359
397
|
var gradient = (_b = effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.gradient) !== null && _b !== void 0 ? _b : null;
|
|
360
|
-
|
|
398
|
+
// A pattern with no colour of its own paints in Excel's Automatic
|
|
399
|
+
// (black); a solid pattern needs its foreground.
|
|
400
|
+
var hasPaintedPattern = fillPattern === "solid"
|
|
361
401
|
? !!(effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.foregroundColor)
|
|
362
|
-
: fillPattern
|
|
363
|
-
? !!(effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.foregroundColor)
|
|
364
|
-
: false;
|
|
402
|
+
: !!fillPattern && fillPattern !== "none";
|
|
365
403
|
var hasGradient = !!gradient && ((_d = (_c = gradient.stops) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0;
|
|
366
404
|
var showFillRectange = !(0, utils_1.isNil)(effectiveCellFormat === null || effectiveCellFormat === void 0 ? void 0 : effectiveCellFormat.backgroundColor) ||
|
|
367
405
|
isMergedCell ||
|