@rowsncolumns/spreadsheet 10.6.0 → 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/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 +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/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 +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 +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 +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/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 +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 +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
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HiddenRowMarkers = exports.HiddenColumnMarkers = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var grid_1 = require("@rowsncolumns/grid");
|
|
6
|
-
var icons_1 = require("@rowsncolumns/icons");
|
|
7
6
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
8
7
|
var style_1 = require("./style");
|
|
9
8
|
var HiddenColumnMarkers = function (_a) {
|
|
@@ -14,12 +13,13 @@ var HiddenColumnMarkers = function (_a) {
|
|
|
14
13
|
rowIndex: 0,
|
|
15
14
|
columnIndex: columnIndex,
|
|
16
15
|
});
|
|
17
|
-
var _a = position !== null && position !== void 0 ? position : {}, _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c;
|
|
16
|
+
var _a = position !== null && position !== void 0 ? position : {}, _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.height, height = _d === void 0 ? 0 : _d;
|
|
17
|
+
// Excel marks hidden columns with a double line on the header boundary.
|
|
18
18
|
return (react_1.default.createElement(style_1.StyledHiddenMarkerButton, { style: {
|
|
19
19
|
transform: "translate3d(".concat(x, "px, ").concat(y, "px, 0)"),
|
|
20
|
+
height: height,
|
|
20
21
|
}, key: columnIndex, onClick: function () { return onShowColumn === null || onShowColumn === void 0 ? void 0 : onShowColumn(expandedDimensions[index]); }, "aria-label": "Show column", tooltip: "Show column" },
|
|
21
|
-
react_1.default.createElement(
|
|
22
|
-
react_1.default.createElement(icons_1.TriangleRightIcon, null)));
|
|
22
|
+
react_1.default.createElement(style_1.HiddenDoubleLine, null)));
|
|
23
23
|
});
|
|
24
24
|
return react_1.default.createElement(react_1.default.Fragment, null, markers);
|
|
25
25
|
};
|
|
@@ -32,15 +32,16 @@ var HiddenRowMarkers = function (_a) {
|
|
|
32
32
|
rowIndex: rowIndex,
|
|
33
33
|
columnIndex: 0,
|
|
34
34
|
});
|
|
35
|
-
var _a = position !== null && position !== void 0 ? position : {}, _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c;
|
|
35
|
+
var _a = position !== null && position !== void 0 ? position : {}, _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.width, width = _d === void 0 ? 0 : _d;
|
|
36
|
+
// Excel marks hidden rows with a double line on the header boundary.
|
|
36
37
|
return (react_1.default.createElement(style_1.StyledHiddenMarkerButton, { style: {
|
|
37
38
|
position: "absolute",
|
|
38
39
|
left: x,
|
|
39
40
|
top: y,
|
|
41
|
+
width: width,
|
|
40
42
|
pointerEvents: "all",
|
|
41
43
|
}, key: rowIndex, onClick: function () { return onShowRow === null || onShowRow === void 0 ? void 0 : onShowRow(expandedDimensions[index]); }, isVertical: true, "aria-label": "Show row", tooltip: "Show row" },
|
|
42
|
-
react_1.default.createElement(
|
|
43
|
-
react_1.default.createElement(icons_1.TriangleDownIcon, null)));
|
|
44
|
+
react_1.default.createElement(style_1.HiddenDoubleLine, { isVertical: true })));
|
|
44
45
|
});
|
|
45
46
|
return react_1.default.createElement(react_1.default.Fragment, null, markers);
|
|
46
47
|
};
|
|
@@ -2,4 +2,11 @@ import React from "react";
|
|
|
2
2
|
export declare const StyledHiddenMarkerButton: React.ForwardRefExoticComponent<Omit<import("@rowsncolumns/ui").IconButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
3
3
|
isVertical?: boolean;
|
|
4
4
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
/**
|
|
6
|
+
* Two 1 px lines with a 1 px gap — Excel's marker for hidden rows / columns
|
|
7
|
+
* in the headers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HiddenDoubleLine: ({ isVertical }: {
|
|
10
|
+
isVertical?: boolean;
|
|
11
|
+
}) => React.JSX.Element;
|
|
5
12
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../components/hidden-markers/style.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,wBAAwB;iBAEgC,OAAO;2CAY1E,CAAC"}
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../components/hidden-markers/style.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,wBAAwB;iBAEgC,OAAO;2CAY1E,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,sBAWxE,CAAC"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledHiddenMarkerButton = void 0;
|
|
3
|
+
exports.HiddenDoubleLine = exports.StyledHiddenMarkerButton = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var ui_1 = require("@rowsncolumns/ui");
|
|
6
6
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
7
|
exports.StyledHiddenMarkerButton = react_1.default.forwardRef(function (_a, ref) {
|
|
8
8
|
var className = _a.className, isVertical = _a.isVertical, props = tslib_1.__rest(_a, ["className", "isVertical"]);
|
|
9
|
-
return (react_1.default.createElement(ui_1.IconButton, tslib_1.__assign({ ref: ref, className: (0, ui_1.cn)("flex absolute border-none p-0 rounded-
|
|
9
|
+
return (react_1.default.createElement(ui_1.IconButton, tslib_1.__assign({ ref: ref, className: (0, ui_1.cn)("flex absolute border-none p-0 rounded-none left-0 top-0 pointer-events-auto w-[5px] -ml-[2px] justify-center items-stretch", "bg-transparent hover:bg-transparent print:hidden min-h-0 min-w-0", isVertical ? "h-[5px] -mt-[2px] ml-0 flex-col" : undefined, className) }, props)));
|
|
10
10
|
});
|
|
11
11
|
exports.StyledHiddenMarkerButton.displayName = "StyledHiddenMarkerButton";
|
|
12
|
+
/**
|
|
13
|
+
* Two 1 px lines with a 1 px gap — Excel's marker for hidden rows / columns
|
|
14
|
+
* in the headers.
|
|
15
|
+
*/
|
|
16
|
+
var HiddenDoubleLine = function (_a) {
|
|
17
|
+
var isVertical = _a.isVertical;
|
|
18
|
+
return (react_1.default.createElement("span", { "aria-hidden": true, "data-hidden-double-line": "", className: (0, ui_1.cn)("block border-rnc-foreground/60", isVertical
|
|
19
|
+
? "w-full h-[3px] border-y border-solid"
|
|
20
|
+
: "h-full w-[3px] border-x border-solid") }));
|
|
21
|
+
};
|
|
22
|
+
exports.HiddenDoubleLine = HiddenDoubleLine;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SheetProtection } from "../../types";
|
|
3
|
+
/** An OOXML `CT_SheetProtection` action flag the Protect Sheet dialog offers. */
|
|
4
|
+
export type SheetProtectionAllowFlag = "selectLockedCells" | "selectUnlockedCells" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables" | "objects" | "scenarios";
|
|
5
|
+
/**
|
|
6
|
+
* Excel's "Allow all users of this worksheet to:" list, in the dialog's order
|
|
7
|
+
* (support.microsoft.com "Protect a worksheet"), with the dialog defaults:
|
|
8
|
+
* only selecting locked and unlocked cells is ticked.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SHEET_PROTECTION_ALLOW_OPTIONS: ReadonlyArray<{
|
|
11
|
+
flag: SheetProtectionAllowFlag;
|
|
12
|
+
label: string;
|
|
13
|
+
defaultAllowed: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export type SheetProtectionAllowState = Record<SheetProtectionAllowFlag, boolean>;
|
|
16
|
+
/** The dialog's ticked boxes for a sheet's last protection (or the defaults). */
|
|
17
|
+
export declare const sheetProtectionToAllowState: (protection?: SheetProtection | null) => SheetProtectionAllowState;
|
|
18
|
+
/**
|
|
19
|
+
* The ticked boxes → OOXML flags, where `true` PROHIBITS the action. Every
|
|
20
|
+
* flag is written explicitly so the stored protection never depends on a
|
|
21
|
+
* schema default.
|
|
22
|
+
*/
|
|
23
|
+
export declare const allowStateToSheetProtection: (state: SheetProtectionAllowState) => Omit<SheetProtection, "password" | "algorithmName" | "hashValue" | "saltValue" | "spinCount">;
|
|
24
|
+
/** Excel's text when the re-entered password differs. */
|
|
25
|
+
export declare const CONFIRM_PASSWORD_MISMATCH = "Confirmation password is not identical.";
|
|
26
|
+
export type ProtectSheetDialogProps = {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onOpenChange(open: boolean): void;
|
|
29
|
+
/** The sheet's previous protection, to pre-tick its choices. */
|
|
30
|
+
initial?: SheetProtection | null;
|
|
31
|
+
/**
|
|
32
|
+
* OK: the OOXML flags and the plaintext password (empty = none). rnc engine:
|
|
33
|
+
* `onProtectSheet(sheetId, { sheetProtection, password })`, which stores only
|
|
34
|
+
* the password's hash.
|
|
35
|
+
*/
|
|
36
|
+
onConfirm(options: {
|
|
37
|
+
sheetProtection: ReturnType<typeof allowStateToSheetProtection>;
|
|
38
|
+
password?: string;
|
|
39
|
+
}): void;
|
|
40
|
+
};
|
|
41
|
+
/** Review ▸ Protect Sheet (support.microsoft.com "Protect a worksheet"). */
|
|
42
|
+
export declare const ProtectSheetDialog: React.MemoExoticComponent<({ open, onOpenChange, initial, onConfirm }: ProtectSheetDialogProps) => React.JSX.Element>;
|
|
43
|
+
export type ProtectWorkbookDialogProps = {
|
|
44
|
+
open: boolean;
|
|
45
|
+
onOpenChange(open: boolean): void;
|
|
46
|
+
/** OK: rnc engine `onProtectWorkbook({ lockStructure, password })`. */
|
|
47
|
+
onConfirm(options: {
|
|
48
|
+
lockStructure: boolean;
|
|
49
|
+
password?: string;
|
|
50
|
+
}): void;
|
|
51
|
+
};
|
|
52
|
+
/** Review ▸ Protect Workbook (support.microsoft.com "Protect a workbook"). */
|
|
53
|
+
export declare const ProtectWorkbookDialog: React.MemoExoticComponent<({ open, onOpenChange, onConfirm }: ProtectWorkbookDialogProps) => React.JSX.Element>;
|
|
54
|
+
export type UnprotectDialogProps = {
|
|
55
|
+
open: boolean;
|
|
56
|
+
onOpenChange(open: boolean): void;
|
|
57
|
+
/** `"Unprotect Sheet"` or `"Unprotect Workbook"`. */
|
|
58
|
+
title: string;
|
|
59
|
+
/**
|
|
60
|
+
* OK with the typed password. The engine verifies it and refuses a wrong one
|
|
61
|
+
* (`incorrect-password`, shown by the host's rejection dialog).
|
|
62
|
+
*/
|
|
63
|
+
onConfirm(password: string): void;
|
|
64
|
+
};
|
|
65
|
+
/** The password prompt Excel shows for Unprotect Sheet / Unprotect Workbook. */
|
|
66
|
+
export declare const UnprotectDialog: React.MemoExoticComponent<({ open, onOpenChange, title, onConfirm }: UnprotectDialogProps) => React.JSX.Element>;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/protect-sheet-dialog/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,iFAAiF;AACjF,MAAM,MAAM,wBAAwB,GAChC,mBAAmB,GACnB,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,aAAa,GACb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AE,GAAG,IAAI,CAAC;CACzE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,gEACI,0BAA0B,uBAwD/D,CAAC;AAIF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,eAAe,uEACiB,oBAAoB,uBAmChE,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnprotectDialog = exports.ProtectWorkbookDialog = exports.ProtectSheetDialog = exports.CONFIRM_PASSWORD_MISMATCH = exports.allowStateToSheetProtection = exports.sheetProtectionToAllowState = exports.SHEET_PROTECTION_ALLOW_OPTIONS = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var ui_1 = require("@rowsncolumns/ui");
|
|
6
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
/**
|
|
8
|
+
* Excel's "Allow all users of this worksheet to:" list, in the dialog's order
|
|
9
|
+
* (support.microsoft.com "Protect a worksheet"), with the dialog defaults:
|
|
10
|
+
* only selecting locked and unlocked cells is ticked.
|
|
11
|
+
*/
|
|
12
|
+
exports.SHEET_PROTECTION_ALLOW_OPTIONS = [
|
|
13
|
+
{ flag: "selectLockedCells", label: "Select locked cells", defaultAllowed: true },
|
|
14
|
+
{ flag: "selectUnlockedCells", label: "Select unlocked cells", defaultAllowed: true },
|
|
15
|
+
{ flag: "formatCells", label: "Format cells", defaultAllowed: false },
|
|
16
|
+
{ flag: "formatColumns", label: "Format columns", defaultAllowed: false },
|
|
17
|
+
{ flag: "formatRows", label: "Format rows", defaultAllowed: false },
|
|
18
|
+
{ flag: "insertColumns", label: "Insert columns", defaultAllowed: false },
|
|
19
|
+
{ flag: "insertRows", label: "Insert rows", defaultAllowed: false },
|
|
20
|
+
{ flag: "insertHyperlinks", label: "Insert hyperlinks", defaultAllowed: false },
|
|
21
|
+
{ flag: "deleteColumns", label: "Delete columns", defaultAllowed: false },
|
|
22
|
+
{ flag: "deleteRows", label: "Delete rows", defaultAllowed: false },
|
|
23
|
+
{ flag: "sort", label: "Sort", defaultAllowed: false },
|
|
24
|
+
{ flag: "autoFilter", label: "Use AutoFilter", defaultAllowed: false },
|
|
25
|
+
{ flag: "pivotTables", label: "Use PivotTable & PivotChart", defaultAllowed: false },
|
|
26
|
+
{ flag: "objects", label: "Edit objects", defaultAllowed: false },
|
|
27
|
+
{ flag: "scenarios", label: "Edit scenarios", defaultAllowed: false },
|
|
28
|
+
];
|
|
29
|
+
/** The dialog's ticked boxes for a sheet's last protection (or the defaults). */
|
|
30
|
+
var sheetProtectionToAllowState = function (protection) {
|
|
31
|
+
var e_1, _a;
|
|
32
|
+
var state = {};
|
|
33
|
+
try {
|
|
34
|
+
for (var SHEET_PROTECTION_ALLOW_OPTIONS_1 = tslib_1.__values(exports.SHEET_PROTECTION_ALLOW_OPTIONS), SHEET_PROTECTION_ALLOW_OPTIONS_1_1 = SHEET_PROTECTION_ALLOW_OPTIONS_1.next(); !SHEET_PROTECTION_ALLOW_OPTIONS_1_1.done; SHEET_PROTECTION_ALLOW_OPTIONS_1_1 = SHEET_PROTECTION_ALLOW_OPTIONS_1.next()) {
|
|
35
|
+
var _b = SHEET_PROTECTION_ALLOW_OPTIONS_1_1.value, flag = _b.flag, defaultAllowed = _b.defaultAllowed;
|
|
36
|
+
var prohibited = protection === null || protection === void 0 ? void 0 : protection[flag];
|
|
37
|
+
state[flag] = typeof prohibited === "boolean" ? !prohibited : defaultAllowed;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
41
|
+
finally {
|
|
42
|
+
try {
|
|
43
|
+
if (SHEET_PROTECTION_ALLOW_OPTIONS_1_1 && !SHEET_PROTECTION_ALLOW_OPTIONS_1_1.done && (_a = SHEET_PROTECTION_ALLOW_OPTIONS_1.return)) _a.call(SHEET_PROTECTION_ALLOW_OPTIONS_1);
|
|
44
|
+
}
|
|
45
|
+
finally { if (e_1) throw e_1.error; }
|
|
46
|
+
}
|
|
47
|
+
return state;
|
|
48
|
+
};
|
|
49
|
+
exports.sheetProtectionToAllowState = sheetProtectionToAllowState;
|
|
50
|
+
/**
|
|
51
|
+
* The ticked boxes → OOXML flags, where `true` PROHIBITS the action. Every
|
|
52
|
+
* flag is written explicitly so the stored protection never depends on a
|
|
53
|
+
* schema default.
|
|
54
|
+
*/
|
|
55
|
+
var allowStateToSheetProtection = function (state) {
|
|
56
|
+
var e_2, _a;
|
|
57
|
+
var protection = { sheet: true };
|
|
58
|
+
try {
|
|
59
|
+
for (var SHEET_PROTECTION_ALLOW_OPTIONS_2 = tslib_1.__values(exports.SHEET_PROTECTION_ALLOW_OPTIONS), SHEET_PROTECTION_ALLOW_OPTIONS_2_1 = SHEET_PROTECTION_ALLOW_OPTIONS_2.next(); !SHEET_PROTECTION_ALLOW_OPTIONS_2_1.done; SHEET_PROTECTION_ALLOW_OPTIONS_2_1 = SHEET_PROTECTION_ALLOW_OPTIONS_2.next()) {
|
|
60
|
+
var flag = SHEET_PROTECTION_ALLOW_OPTIONS_2_1.value.flag;
|
|
61
|
+
protection[flag] = !state[flag];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
if (SHEET_PROTECTION_ALLOW_OPTIONS_2_1 && !SHEET_PROTECTION_ALLOW_OPTIONS_2_1.done && (_a = SHEET_PROTECTION_ALLOW_OPTIONS_2.return)) _a.call(SHEET_PROTECTION_ALLOW_OPTIONS_2);
|
|
68
|
+
}
|
|
69
|
+
finally { if (e_2) throw e_2.error; }
|
|
70
|
+
}
|
|
71
|
+
return protection;
|
|
72
|
+
};
|
|
73
|
+
exports.allowStateToSheetProtection = allowStateToSheetProtection;
|
|
74
|
+
/** Excel's text when the re-entered password differs. */
|
|
75
|
+
exports.CONFIRM_PASSWORD_MISMATCH = "Confirmation password is not identical.";
|
|
76
|
+
/** Password + "Reenter password to proceed", as Excel's Confirm Password step. */
|
|
77
|
+
var PasswordFields = function (_a) {
|
|
78
|
+
var label = _a.label, password = _a.password, confirm = _a.confirm, mismatch = _a.mismatch, onPassword = _a.onPassword, onConfirm = _a.onConfirm;
|
|
79
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
80
|
+
react_1.default.createElement("label", { className: "flex flex-col gap-1 text-xs font-medium" },
|
|
81
|
+
label,
|
|
82
|
+
react_1.default.createElement(ui_1.Input, { type: "password", autoComplete: "new-password", value: password, onChange: function (e) { return onPassword(e.target.value); }, "data-testid": "protection-password" })),
|
|
83
|
+
password !== "" && (react_1.default.createElement("label", { className: "flex flex-col gap-1 text-xs font-medium" },
|
|
84
|
+
"Reenter password to proceed:",
|
|
85
|
+
react_1.default.createElement(ui_1.Input, { type: "password", autoComplete: "new-password", value: confirm, onChange: function (e) { return onConfirm(e.target.value); }, "data-testid": "protection-password-confirm" }))),
|
|
86
|
+
mismatch && (react_1.default.createElement("p", { role: "alert", className: "text-xs text-red-600" }, exports.CONFIRM_PASSWORD_MISMATCH))));
|
|
87
|
+
};
|
|
88
|
+
var DialogButtons = function (_a) {
|
|
89
|
+
var onCancel = _a.onCancel;
|
|
90
|
+
return (react_1.default.createElement("div", { className: "flex justify-end gap-2" },
|
|
91
|
+
react_1.default.createElement(ui_1.Button, { type: "button", variant: "outline", size: "sm", onClick: onCancel }, "Cancel"),
|
|
92
|
+
react_1.default.createElement(ui_1.Button, { type: "submit", size: "sm" }, "OK")));
|
|
93
|
+
};
|
|
94
|
+
/** Review ▸ Protect Sheet (support.microsoft.com "Protect a worksheet"). */
|
|
95
|
+
exports.ProtectSheetDialog = (0, react_1.memo)(function (_a) {
|
|
96
|
+
var open = _a.open, onOpenChange = _a.onOpenChange, initial = _a.initial, onConfirm = _a.onConfirm;
|
|
97
|
+
var _b = tslib_1.__read((0, react_1.useState)(function () { return (0, exports.sheetProtectionToAllowState)(initial); }), 2), allow = _b[0], setAllow = _b[1];
|
|
98
|
+
var _c = tslib_1.__read((0, react_1.useState)(""), 2), password = _c[0], setPassword = _c[1];
|
|
99
|
+
var _d = tslib_1.__read((0, react_1.useState)(""), 2), confirm = _d[0], setConfirm = _d[1];
|
|
100
|
+
var _e = tslib_1.__read((0, react_1.useState)(false), 2), mismatch = _e[0], setMismatch = _e[1];
|
|
101
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: open, onOpenChange: onOpenChange, modal: true },
|
|
102
|
+
react_1.default.createElement(ui_1.DialogContent, { className: "w-[360px] max-w-[92vw] pointer-events-auto" },
|
|
103
|
+
react_1.default.createElement(ui_1.DialogTitle, null, "Protect Sheet"),
|
|
104
|
+
react_1.default.createElement(ui_1.DialogCloseButton, null),
|
|
105
|
+
react_1.default.createElement(ui_1.DialogBody, null,
|
|
106
|
+
react_1.default.createElement("form", { className: "flex flex-col gap-3", onSubmit: function (e) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
if (password !== "" && password !== confirm) {
|
|
109
|
+
setMismatch(true);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
onConfirm(tslib_1.__assign({ sheetProtection: (0, exports.allowStateToSheetProtection)(allow) }, (password ? { password: password } : {})));
|
|
113
|
+
onOpenChange(false);
|
|
114
|
+
} },
|
|
115
|
+
react_1.default.createElement(PasswordFields, { label: "Password to unprotect sheet:", password: password, confirm: confirm, mismatch: mismatch, onPassword: function (v) {
|
|
116
|
+
setPassword(v);
|
|
117
|
+
setMismatch(false);
|
|
118
|
+
}, onConfirm: function (v) {
|
|
119
|
+
setConfirm(v);
|
|
120
|
+
setMismatch(false);
|
|
121
|
+
} }),
|
|
122
|
+
react_1.default.createElement("fieldset", { className: "flex flex-col gap-1" },
|
|
123
|
+
react_1.default.createElement("legend", { className: "mb-1 text-xs font-medium" }, "Allow all users of this worksheet to:"),
|
|
124
|
+
react_1.default.createElement("div", { className: "flex max-h-56 flex-col gap-1 overflow-y-auto rounded border p-2" }, exports.SHEET_PROTECTION_ALLOW_OPTIONS.map(function (_a) {
|
|
125
|
+
var flag = _a.flag, label = _a.label;
|
|
126
|
+
return (react_1.default.createElement("label", { key: flag, className: "flex items-center gap-2 text-xs" },
|
|
127
|
+
react_1.default.createElement("input", { type: "checkbox", checked: allow[flag], "data-testid": "protect-allow-".concat(flag), onChange: function (e) {
|
|
128
|
+
return setAllow(function (prev) {
|
|
129
|
+
var _a;
|
|
130
|
+
return (tslib_1.__assign(tslib_1.__assign({}, prev), (_a = {}, _a[flag] = e.target.checked, _a)));
|
|
131
|
+
});
|
|
132
|
+
} }),
|
|
133
|
+
label));
|
|
134
|
+
}))),
|
|
135
|
+
react_1.default.createElement(ui_1.Separator, null),
|
|
136
|
+
react_1.default.createElement(DialogButtons, { onCancel: function () { return onOpenChange(false); } }))))));
|
|
137
|
+
});
|
|
138
|
+
exports.ProtectSheetDialog.displayName = "ProtectSheetDialog";
|
|
139
|
+
/** Review ▸ Protect Workbook (support.microsoft.com "Protect a workbook"). */
|
|
140
|
+
exports.ProtectWorkbookDialog = (0, react_1.memo)(function (_a) {
|
|
141
|
+
var open = _a.open, onOpenChange = _a.onOpenChange, onConfirm = _a.onConfirm;
|
|
142
|
+
var _b = tslib_1.__read((0, react_1.useState)(true), 2), structure = _b[0], setStructure = _b[1];
|
|
143
|
+
var _c = tslib_1.__read((0, react_1.useState)(""), 2), password = _c[0], setPassword = _c[1];
|
|
144
|
+
var _d = tslib_1.__read((0, react_1.useState)(""), 2), confirm = _d[0], setConfirm = _d[1];
|
|
145
|
+
var _e = tslib_1.__read((0, react_1.useState)(false), 2), mismatch = _e[0], setMismatch = _e[1];
|
|
146
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: open, onOpenChange: onOpenChange, modal: true },
|
|
147
|
+
react_1.default.createElement(ui_1.DialogContent, { className: "w-[340px] max-w-[92vw] pointer-events-auto" },
|
|
148
|
+
react_1.default.createElement(ui_1.DialogTitle, null, "Protect Structure and Windows"),
|
|
149
|
+
react_1.default.createElement(ui_1.DialogCloseButton, null),
|
|
150
|
+
react_1.default.createElement(ui_1.DialogBody, null,
|
|
151
|
+
react_1.default.createElement("form", { className: "flex flex-col gap-3", onSubmit: function (e) {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
if (password !== "" && password !== confirm) {
|
|
154
|
+
setMismatch(true);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (structure) {
|
|
158
|
+
onConfirm(tslib_1.__assign({ lockStructure: true }, (password ? { password: password } : {})));
|
|
159
|
+
}
|
|
160
|
+
onOpenChange(false);
|
|
161
|
+
} },
|
|
162
|
+
react_1.default.createElement("label", { className: "flex items-center gap-2 text-xs font-medium" },
|
|
163
|
+
react_1.default.createElement("input", { type: "checkbox", checked: structure, "data-testid": "protect-workbook-structure", onChange: function (e) { return setStructure(e.target.checked); } }),
|
|
164
|
+
"Structure"),
|
|
165
|
+
react_1.default.createElement(PasswordFields, { label: "Password (optional):", password: password, confirm: confirm, mismatch: mismatch, onPassword: function (v) {
|
|
166
|
+
setPassword(v);
|
|
167
|
+
setMismatch(false);
|
|
168
|
+
}, onConfirm: function (v) {
|
|
169
|
+
setConfirm(v);
|
|
170
|
+
setMismatch(false);
|
|
171
|
+
} }),
|
|
172
|
+
react_1.default.createElement(ui_1.Separator, null),
|
|
173
|
+
react_1.default.createElement(DialogButtons, { onCancel: function () { return onOpenChange(false); } }))))));
|
|
174
|
+
});
|
|
175
|
+
exports.ProtectWorkbookDialog.displayName = "ProtectWorkbookDialog";
|
|
176
|
+
/** The password prompt Excel shows for Unprotect Sheet / Unprotect Workbook. */
|
|
177
|
+
exports.UnprotectDialog = (0, react_1.memo)(function (_a) {
|
|
178
|
+
var open = _a.open, onOpenChange = _a.onOpenChange, title = _a.title, onConfirm = _a.onConfirm;
|
|
179
|
+
var _b = tslib_1.__read((0, react_1.useState)(""), 2), password = _b[0], setPassword = _b[1];
|
|
180
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: open, onOpenChange: onOpenChange, modal: true },
|
|
181
|
+
react_1.default.createElement(ui_1.DialogContent, { className: "w-[320px] max-w-[92vw] pointer-events-auto" },
|
|
182
|
+
react_1.default.createElement(ui_1.DialogTitle, null, title),
|
|
183
|
+
react_1.default.createElement(ui_1.DialogCloseButton, null),
|
|
184
|
+
react_1.default.createElement(ui_1.DialogBody, null,
|
|
185
|
+
react_1.default.createElement("form", { className: "flex flex-col gap-3", onSubmit: function (e) {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
onConfirm(password);
|
|
188
|
+
onOpenChange(false);
|
|
189
|
+
} },
|
|
190
|
+
react_1.default.createElement("label", { className: "flex flex-col gap-1 text-xs font-medium" },
|
|
191
|
+
"Password:",
|
|
192
|
+
react_1.default.createElement(ui_1.Input, { type: "password", autoComplete: "current-password", autoFocus: true, value: password, onChange: function (e) { return setPassword(e.target.value); }, "data-testid": "unprotect-password" })),
|
|
193
|
+
react_1.default.createElement(ui_1.Separator, null),
|
|
194
|
+
react_1.default.createElement(DialogButtons, { onCancel: function () { return onOpenChange(false); } }))))));
|
|
195
|
+
});
|
|
196
|
+
exports.UnprotectDialog.displayName = "UnprotectDialog";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type BorderLocation = "all" | "outer" | "inner" | "vertical" | "horizontal" | "left" | "right" | "bottom" | "top";
|
|
1
|
+
export type BorderLocation = "all" | "outer" | "inner" | "vertical" | "horizontal" | "left" | "right" | "bottom" | "top" | "diagonalUp" | "diagonalDown" | "none";
|
|
2
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,GACZ,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../components/toolbar/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,GACZ,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GAGL,YAAY,GACZ,cAAc,GACd,MAAM,CAAC"}
|
package/dist/cjs/config.d.ts
CHANGED
|
@@ -19,7 +19,19 @@ export declare const COLUMN_HEADER_HEIGHT = 24;
|
|
|
19
19
|
export declare const OUTLINE_GUTTER_LEVEL_PX = 17;
|
|
20
20
|
export declare const OUTLINE_GUTTER_PAD_PX = 4;
|
|
21
21
|
export declare const DEFAULT_CELL_SPACING = 2.5;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* One indent level (Format Cells ▸ Alignment ▸ Indent) at 100 % zoom. ECMA-376
|
|
24
|
+
* §18.8.1 defines a level as three spaces of the Normal font — 3 × 3.3 px for
|
|
25
|
+
* 11 pt Calibri at 96 dpi. Callers multiply it by the zoom scale.
|
|
26
|
+
*/
|
|
27
|
+
export declare const INDENT_SPACING = 10;
|
|
28
|
+
/**
|
|
29
|
+
* Excel's AutoFilter / table header button: a light grey square with a grey
|
|
30
|
+
* border and a dark grey glyph.
|
|
31
|
+
*/
|
|
32
|
+
export declare const FILTER_BUTTON_GLYPH_COLOR = "#444444";
|
|
33
|
+
export declare const FILTER_BUTTON_BORDER_COLOR = "#ABABAB";
|
|
34
|
+
export declare const FILTER_BUTTON_FILL_COLOR = "#F3F3F3";
|
|
23
35
|
export declare const MIN_COLUMN_WIDTH = 24;
|
|
24
36
|
export declare const CELL_VERTICAL_ALIGNMENT = "bottom";
|
|
25
37
|
export declare const CELL_HORIZONTAL_ALIGNMENT = "left";
|
package/dist/cjs/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,aAGhC,CAAC;AACH,eAAO,MAAM,kBAAkB,kBAAoB,CAAC;AACpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,GAAG,CAAM,CAAC;AAC5C,eAAO,MAAM,kBAAkB,kBAAqB,CAAC;AACrD,eAAO,MAAM,uBAAuB,EAAE,YAGpC,CAAC;AAEH,eAAO,MAAM,aAAa,UAAY,CAAC;AAEvC,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAGvC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAMvC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","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8B,SAAS,CAAC;AAGrD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAGrC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC;IACnC,SAAS,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf,CAqEA,CAAC;AAEF,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,eAAO,MAAM,2BAA2B,EAAE,OAAO,gBAchD,CAAC;AAEF,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,WAAW,QAC4a,CAAC;AACrc,eAAO,MAAM,SAAS,QACyF,CAAC;AAEhH,eAAO,MAAM,aAAa,mBAyExB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wDACiB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,mDACE,CAAC"}
|
package/dist/cjs/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.MULTIPLE_SELECTIONS_CLIPBOARD_ERROR = exports.MULTIPLE_SELECTIONS_ERROR = exports.IndexedColors = exports.URL_REGEX = exports.EMAIL_REGEX = exports.BLANK_LABEL = exports.VALIDATION_CONDITION_LABELS = exports.CONDITION_NONE = exports.CONDITION_LABELS = exports.SCROLLBAR_SIZE_FIREFOX = exports.SCROLLBAR_SIZE = exports.FORMULA_BAR_HEIGHT = exports.DEFAULT_CELL_INPUT_LINE_HEIGHT = exports.COMMENT_COLOR = exports.NOTE_COLOR = exports.ERROR_COLOR = exports.INVALID_COLOR = exports.HEADER_MENU_DIM = exports.CF_ICON_SPACING = exports.CF_ICON_WIDTH = exports.EXPAND_COLLAPSE_ICON_WIDTH = exports.COLLAPSE_ICON_PATH = exports.EXPAND_ICON_PATH = exports.CHECKBOX_ICON_WIDTH = exports.CHECKBOX_ICON_ACTIVE_COLOR = exports.CHECKBOX_ICON_COLOR = exports.CHECKBOX_CHECKED_ICON_PATH = exports.CHECKBOX_ICON_PATH = exports.SORT_DESCENDING_ICON_PATH = exports.SORT_ASCENDING_ICON_PATH = exports.FILTER_ICON_WIDTH = exports.FUNNEL_ICON_PATH = exports.FITLER_ICON_PATH = exports.CALCULATED_ICON_HEIGHT = exports.CALCULATED_ICON_WIDTH = exports.CHIP_COLOR_DARK = exports.CHIP_COLOR = exports.CHIP_RADIUS = exports.CHIP_HEIGHT = exports.CHIP_SPACING = exports.ARROW_DOWN_COLOR = exports.ARROW_DOWN_WIDTH = exports.ARROW_DOWN_ICON_PATH = exports.defaultSpreadsheetTheme = void 0;
|
|
3
|
+
exports.DEFAULT_HEADER_SELECTED_TABLE_BG = exports.DEFAULT_HEADER_ACTIVE_TABLE_BG_DARK = exports.DEFAULT_HEADER_ACTIVE_TABLE_BG = exports.DEFAULT_HEADER_TABLE_BG_DARK = exports.DEFAULT_HEADER_TABLE_BG = exports.DEFAULT_HEADER_SELECTED_BG = exports.DEFAULT_HEADER_ACTIVE_BG_DARK = exports.DEFAULT_HEADER_ACTIVE_BG = exports.DEFAULT_HEADER_BG_DARK = exports.DEFAULT_HEADER_BG = exports.DEFAULT_HEADER_BORDER_COLOR_DARK = exports.DEFAULT_HEADER_BORDER_COLOR = exports.DEFAULT_HEADER_COLOR_DARK = exports.DEFAULT_HEADER_COLOR = exports.GRIDLINE_COLOR_DARK = exports.GRIDLINE_COLOR = exports.DEFAULT_CELL_BACKGROUND_COLOR_DARK = exports.DEFAULT_CELL_BACKGROUND_COLOR = exports.DEFAULT_CELL_COLOR_DARK = exports.DEFAULT_CELL_COLOR = exports.HEADER_TEXT_FORMAT = exports.DEFAULT_CELL_FORMAT = exports.DEFAULT_TEXT_FORMAT = exports.FORMULA_FONT_CONFIG = exports.EDITOR_FORMULA_VERTICAL_ALIGNMENT = exports.EDITOR_VERTICAL_ALIGNMENT = exports.CELL_HORIZONTAL_ALIGNMENT = exports.CELL_VERTICAL_ALIGNMENT = exports.MIN_COLUMN_WIDTH = exports.FILTER_BUTTON_FILL_COLOR = exports.FILTER_BUTTON_BORDER_COLOR = exports.FILTER_BUTTON_GLYPH_COLOR = exports.INDENT_SPACING = exports.DEFAULT_CELL_SPACING = exports.OUTLINE_GUTTER_PAD_PX = exports.OUTLINE_GUTTER_LEVEL_PX = exports.COLUMN_HEADER_HEIGHT = exports.ROW_HEADER_WIDTH = exports.DEFAULT_COLUMN_WIDTH = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_FONT_SIZE_PT = exports.DEFAULT_COLUMN_COUNT = exports.DEFAULT_ROW_COUNT = exports.MAX_COLUMN_COUNT = exports.MAX_ROW_COUNT = exports.DEFAULT_SCROLL_POSITION = exports.FROZEN_EMPTY_ARRAY = exports.DEFAULT_ARRAY = exports.DEFAULT_SELECTIONS = exports.DEFAULT_ACTIVE_CELL = void 0;
|
|
4
|
+
exports.MULTIPLE_SELECTIONS_CLIPBOARD_ERROR = exports.MULTIPLE_SELECTIONS_ERROR = exports.IndexedColors = exports.URL_REGEX = exports.EMAIL_REGEX = exports.BLANK_LABEL = exports.VALIDATION_CONDITION_LABELS = exports.CONDITION_NONE = exports.CONDITION_LABELS = exports.SCROLLBAR_SIZE_FIREFOX = exports.SCROLLBAR_SIZE = exports.FORMULA_BAR_HEIGHT = exports.DEFAULT_CELL_INPUT_LINE_HEIGHT = exports.COMMENT_COLOR = exports.NOTE_COLOR = exports.ERROR_COLOR = exports.INVALID_COLOR = exports.HEADER_MENU_DIM = exports.CF_ICON_SPACING = exports.CF_ICON_WIDTH = exports.EXPAND_COLLAPSE_ICON_WIDTH = exports.COLLAPSE_ICON_PATH = exports.EXPAND_ICON_PATH = exports.CHECKBOX_ICON_WIDTH = exports.CHECKBOX_ICON_ACTIVE_COLOR = exports.CHECKBOX_ICON_COLOR = exports.CHECKBOX_CHECKED_ICON_PATH = exports.CHECKBOX_ICON_PATH = exports.SORT_DESCENDING_ICON_PATH = exports.SORT_ASCENDING_ICON_PATH = exports.FILTER_ICON_WIDTH = exports.FUNNEL_ICON_PATH = exports.FITLER_ICON_PATH = exports.CALCULATED_ICON_HEIGHT = exports.CALCULATED_ICON_WIDTH = exports.CHIP_COLOR_DARK = exports.CHIP_COLOR = exports.CHIP_RADIUS = exports.CHIP_HEIGHT = exports.CHIP_SPACING = exports.ARROW_DOWN_COLOR = exports.ARROW_DOWN_WIDTH = exports.ARROW_DOWN_ICON_PATH = exports.defaultSpreadsheetTheme = exports.DEFAULT_OVERLAY_POSITION = exports.SELECTION_BORDER = exports.SELECTION_BG = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var themes_1 = require("./themes");
|
|
7
7
|
exports.DEFAULT_ACTIVE_CELL = Object.freeze({
|
|
@@ -35,7 +35,19 @@ exports.COLUMN_HEADER_HEIGHT = 24;
|
|
|
35
35
|
exports.OUTLINE_GUTTER_LEVEL_PX = 17;
|
|
36
36
|
exports.OUTLINE_GUTTER_PAD_PX = 4;
|
|
37
37
|
exports.DEFAULT_CELL_SPACING = 2.5;
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* One indent level (Format Cells ▸ Alignment ▸ Indent) at 100 % zoom. ECMA-376
|
|
40
|
+
* §18.8.1 defines a level as three spaces of the Normal font — 3 × 3.3 px for
|
|
41
|
+
* 11 pt Calibri at 96 dpi. Callers multiply it by the zoom scale.
|
|
42
|
+
*/
|
|
43
|
+
exports.INDENT_SPACING = 10;
|
|
44
|
+
/**
|
|
45
|
+
* Excel's AutoFilter / table header button: a light grey square with a grey
|
|
46
|
+
* border and a dark grey glyph.
|
|
47
|
+
*/
|
|
48
|
+
exports.FILTER_BUTTON_GLYPH_COLOR = "#444444";
|
|
49
|
+
exports.FILTER_BUTTON_BORDER_COLOR = "#ABABAB";
|
|
50
|
+
exports.FILTER_BUTTON_FILL_COLOR = "#F3F3F3";
|
|
39
51
|
exports.MIN_COLUMN_WIDTH = 24;
|
|
40
52
|
exports.CELL_VERTICAL_ALIGNMENT = "bottom";
|
|
41
53
|
exports.CELL_HORIZONTAL_ALIGNMENT = "left";
|
package/dist/cjs/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":"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,SA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AS,wBAO/C,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,eAAe,aAAa,GAAG,SAAS,YAkCjD,CAAC;AAE5B,eAAO,MAAM,6BAA6B,GACxC,YAAY,MAAM,GAAG,SAAS,KAC7B,cAAc,EAqBhB,CAAC;AAGF,eAAO,MAAM,aAAa,SAAwC,CAAC;AAGnE,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,QAAQ,EACjD,aAAa,CAAC,CAAC,IAAI,CAAC,KACnB,UAAU,IAAI,cAKhB,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,QAAQ,EAClD,KAAK,CAAC,CAAC,gBAAgB,CAAC,KACvB,EAAE,IAAI,eAKR,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,OAAO,SAAS,GAAG,SAAS,EAC5B,YAAY,aAAa,GAAG,SAAS,GAAG,IAAI,EAC5C,aAAa,aAAa,GAAG,SAAS,GAAG,IAAI,+BAM9C,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC"}
|
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");
|
|
@@ -30,47 +30,58 @@ var normalizeDisplayText = function (text, shouldWrap) {
|
|
|
30
30
|
return text.replace(/\n/g, " ");
|
|
31
31
|
};
|
|
32
32
|
exports.normalizeDisplayText = normalizeDisplayText;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Excel's border dash patterns at 100 % zoom, as `setLineDash` on/off runs in
|
|
35
|
+
* CSS pixels (Format Cells ▸ Border ▸ Line style; ECMA-376 §18.18.3
|
|
36
|
+
* ST_BorderStyle). Every style is distinct: hair and dotted differ in spacing,
|
|
37
|
+
* the medium variants share their thin pattern at twice the width (see
|
|
38
|
+
* {@link getBorderStyleWidth}), and `slantDashDot` is the medium dash-dot
|
|
39
|
+
* painted as slanted parallelograms (`getSlantDashQuads` in cell-overlay).
|
|
40
|
+
*/
|
|
41
|
+
var BORDER_DASH_PATTERNS = {
|
|
42
|
+
hair: [1, 1],
|
|
43
|
+
dotted: [2, 2],
|
|
44
|
+
dashed: [3, 1],
|
|
45
|
+
mediumDashed: [9, 3],
|
|
46
|
+
dashDot: [9, 3, 3, 3],
|
|
47
|
+
mediumDashDot: [9, 3, 3, 3],
|
|
48
|
+
dashDotDot: [9, 3, 3, 3, 3, 3],
|
|
49
|
+
mediumDashDotDot: [9, 3, 3, 3, 3, 3],
|
|
50
|
+
slantDashDot: [9, 1, 3, 1],
|
|
40
51
|
};
|
|
41
52
|
/**
|
|
42
|
-
* Converts border style to dash array
|
|
43
|
-
*
|
|
44
|
-
|
|
53
|
+
* Converts border style to a dash array, scaled by the zoom so a dash keeps
|
|
54
|
+
* its length relative to the cells.
|
|
55
|
+
*/
|
|
56
|
+
var convertBorderStyleToDashArray = function (style, scale) {
|
|
57
|
+
if (scale === void 0) { scale = 1; }
|
|
58
|
+
var pattern = style ? BORDER_DASH_PATTERNS[style] : undefined;
|
|
59
|
+
return pattern === null || pattern === void 0 ? void 0 : pattern.map(function (length) { return length * scale; });
|
|
60
|
+
};
|
|
61
|
+
exports.convertBorderStyleToDashArray = convertBorderStyleToDashArray;
|
|
62
|
+
/**
|
|
63
|
+
* Stroke width (unscaled px) Excel paints a dashed / dotted border style
|
|
64
|
+
* with: the medium variants and `slantDashDot` are 2 px, the thin ones 1 px.
|
|
65
|
+
* Solid and double styles keep the width they carry.
|
|
45
66
|
*/
|
|
46
|
-
var
|
|
47
|
-
// Dash patterns follow Canvas's `setLineDash` convention: pairs of
|
|
48
|
-
// [on, off, on, off, ...]. Values chosen to give visually distinct
|
|
49
|
-
// strokes that match Excel's rendering at typical zoom levels.
|
|
67
|
+
var getBorderStyleWidth = function (style, width) {
|
|
50
68
|
switch (style) {
|
|
51
|
-
case "dashed":
|
|
52
|
-
case "mediumDashed":
|
|
53
|
-
return [2, 2];
|
|
54
|
-
case "dotted":
|
|
55
|
-
return getDotArray();
|
|
56
69
|
case "hair":
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
case "dotted":
|
|
71
|
+
case "dashed":
|
|
59
72
|
case "dashDot":
|
|
60
|
-
case "mediumDashDot":
|
|
61
|
-
return [4, 2, 1, 2];
|
|
62
73
|
case "dashDotDot":
|
|
63
|
-
return
|
|
74
|
+
return 1;
|
|
75
|
+
case "mediumDashed":
|
|
76
|
+
case "mediumDashDot":
|
|
77
|
+
case "mediumDashDotDot":
|
|
64
78
|
case "slantDashDot":
|
|
65
|
-
|
|
66
|
-
// standard dash-dot pattern. Visually distinct from `solid` even
|
|
67
|
-
// without the slant.
|
|
68
|
-
return [4, 2, 1, 2];
|
|
79
|
+
return 2;
|
|
69
80
|
default:
|
|
70
|
-
return
|
|
81
|
+
return width !== null && width !== void 0 ? width : 0;
|
|
71
82
|
}
|
|
72
83
|
};
|
|
73
|
-
exports.
|
|
84
|
+
exports.getBorderStyleWidth = getBorderStyleWidth;
|
|
74
85
|
/**
|
|
75
86
|
* Converts border thickness to value
|
|
76
87
|
* @param style
|
|
@@ -81,6 +92,7 @@ var convertThicknessStyleToScaleFactor = function (style) {
|
|
|
81
92
|
case "solid_medium":
|
|
82
93
|
case "mediumDashed":
|
|
83
94
|
case "mediumDashDot":
|
|
95
|
+
case "mediumDashDotDot":
|
|
84
96
|
return 1.5;
|
|
85
97
|
case "solid_thick":
|
|
86
98
|
return 2;
|