@rowsncolumns/spreadsheet 10.5.17 → 10.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/cf-data-bar.d.ts +73 -0
- package/dist/cjs/api/cf-data-bar.d.ts.map +1 -0
- package/dist/cjs/api/cf-data-bar.js +182 -0
- package/dist/cjs/api/cf-icons.d.ts +73 -0
- package/dist/cjs/api/cf-icons.d.ts.map +1 -0
- package/dist/cjs/api/cf-icons.js +322 -0
- package/dist/cjs/api/cf-overlays.d.ts +89 -3
- package/dist/cjs/api/cf-overlays.d.ts.map +1 -1
- package/dist/cjs/api/cf-overlays.js +256 -80
- package/dist/cjs/api/cf-priority.d.ts +34 -0
- package/dist/cjs/api/cf-priority.d.ts.map +1 -0
- package/dist/cjs/api/cf-priority.js +94 -0
- package/dist/cjs/api/heatmap.d.ts +7 -1
- package/dist/cjs/api/heatmap.d.ts.map +1 -1
- package/dist/cjs/api/heatmap.js +27 -11
- package/dist/cjs/api/selections.d.ts +2 -2
- package/dist/cjs/api/validation.d.ts +6 -0
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +10 -1
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts +8 -3
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/index.d.ts +4 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +4 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +194 -51
- package/dist/cjs/components/canvas-grid/overflow.d.ts +37 -0
- package/dist/cjs/components/canvas-grid/overflow.d.ts.map +1 -0
- package/dist/cjs/components/canvas-grid/overflow.js +49 -0
- package/dist/cjs/components/canvas-grid/page-breaks.d.ts +15 -0
- package/dist/cjs/components/canvas-grid/page-breaks.d.ts.map +1 -0
- package/dist/cjs/components/canvas-grid/page-breaks.js +77 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts +32 -3
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.d.ts +58 -1
- package/dist/cjs/components/cell/alignment.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.js +144 -1
- package/dist/cjs/components/cell/cell-background.d.ts +2 -0
- package/dist/cjs/components/cell/cell-background.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-background.js +5 -6
- package/dist/cjs/components/cell/cell-backgrounds.d.ts.map +1 -1
- package/dist/cjs/components/cell/cell-backgrounds.js +5 -1
- package/dist/cjs/components/cell/cell-text-runs.js +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +378 -37
- package/dist/cjs/components/cell/number-format-layout.d.ts +35 -0
- package/dist/cjs/components/cell/number-format-layout.d.ts.map +1 -0
- package/dist/cjs/components/cell/number-format-layout.js +106 -0
- package/dist/cjs/components/cell/typings.d.ts +22 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +2 -2
- package/dist/cjs/components/cell-filter/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-filter/index.js +3 -3
- package/dist/cjs/components/cell-overlay/index.d.ts +20 -0
- package/dist/cjs/components/cell-overlay/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-overlay/index.js +155 -28
- package/dist/cjs/components/cf-icon-preview/index.d.ts +16 -0
- package/dist/cjs/components/cf-icon-preview/index.d.ts.map +1 -0
- package/dist/cjs/components/cf-icon-preview/index.js +48 -0
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +11 -3
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +3 -2
- package/dist/cjs/components/goal-seek-dialog/index.d.ts +15 -5
- package/dist/cjs/components/goal-seek-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/goal-seek-dialog/index.js +145 -42
- package/dist/cjs/components/hidden-markers/index.d.ts.map +1 -1
- package/dist/cjs/components/hidden-markers/index.js +8 -7
- package/dist/cjs/components/hidden-markers/style.d.ts +7 -0
- package/dist/cjs/components/hidden-markers/style.d.ts.map +1 -1
- package/dist/cjs/components/hidden-markers/style.js +13 -2
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts +67 -0
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/index.js +196 -0
- package/dist/cjs/components/toolbar/types.d.ts +1 -1
- package/dist/cjs/components/toolbar/types.d.ts.map +1 -1
- package/dist/cjs/config.d.ts +13 -1
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +15 -3
- package/dist/cjs/helpers.d.ts +10 -5
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +43 -31
- package/dist/cjs/hooks/use-border-styles.d.ts.map +1 -1
- package/dist/cjs/hooks/use-border-styles.js +5 -28
- package/dist/cjs/hooks/use-cell-renderer.d.ts +35 -3
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +85 -47
- package/dist/cjs/hooks/use-conditional-formatting.d.ts +13 -1
- package/dist/cjs/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/cjs/hooks/use-conditional-formatting.js +281 -230
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/themes.d.ts +8 -0
- package/dist/cjs/themes.d.ts.map +1 -1
- package/dist/cjs/themes.js +21 -3
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +115 -5
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/cf-data-bar.d.ts +73 -0
- package/dist/esm/api/cf-data-bar.d.ts.map +1 -0
- package/dist/esm/api/cf-data-bar.js +178 -0
- package/dist/esm/api/cf-icons.d.ts +73 -0
- package/dist/esm/api/cf-icons.d.ts.map +1 -0
- package/dist/esm/api/cf-icons.js +306 -0
- package/dist/esm/api/cf-overlays.d.ts +89 -3
- package/dist/esm/api/cf-overlays.d.ts.map +1 -1
- package/dist/esm/api/cf-overlays.js +223 -67
- package/dist/esm/api/cf-priority.d.ts +34 -0
- package/dist/esm/api/cf-priority.d.ts.map +1 -0
- package/dist/esm/api/cf-priority.js +61 -0
- package/dist/esm/api/heatmap.d.ts +7 -1
- package/dist/esm/api/heatmap.d.ts.map +1 -1
- package/dist/esm/api/heatmap.js +24 -9
- package/dist/esm/api/selections.d.ts +2 -2
- package/dist/esm/api/validation.d.ts +6 -0
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +6 -0
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts +8 -3
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts.map +1 -1
- package/dist/esm/atoms/index.d.ts +4 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +4 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +163 -47
- package/dist/esm/components/canvas-grid/overflow.d.ts +37 -0
- package/dist/esm/components/canvas-grid/overflow.d.ts.map +1 -0
- package/dist/esm/components/canvas-grid/overflow.js +39 -0
- package/dist/esm/components/canvas-grid/page-breaks.d.ts +15 -0
- package/dist/esm/components/canvas-grid/page-breaks.d.ts.map +1 -0
- package/dist/esm/components/canvas-grid/page-breaks.js +50 -0
- package/dist/esm/components/canvas-grid/typings.d.ts +32 -3
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.d.ts +58 -1
- package/dist/esm/components/cell/alignment.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.js +110 -1
- package/dist/esm/components/cell/cell-background.d.ts +2 -0
- package/dist/esm/components/cell/cell-background.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-background.js +4 -5
- package/dist/esm/components/cell/cell-backgrounds.d.ts.map +1 -1
- package/dist/esm/components/cell/cell-backgrounds.js +5 -1
- package/dist/esm/components/cell/cell-text-runs.js +2 -2
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +339 -39
- package/dist/esm/components/cell/number-format-layout.d.ts +35 -0
- package/dist/esm/components/cell/number-format-layout.d.ts.map +1 -0
- package/dist/esm/components/cell/number-format-layout.js +99 -0
- package/dist/esm/components/cell/typings.d.ts +22 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +2 -2
- package/dist/esm/components/cell-filter/index.d.ts.map +1 -1
- package/dist/esm/components/cell-filter/index.js +4 -4
- package/dist/esm/components/cell-overlay/index.d.ts +20 -0
- package/dist/esm/components/cell-overlay/index.d.ts.map +1 -1
- package/dist/esm/components/cell-overlay/index.js +111 -25
- package/dist/esm/components/cf-icon-preview/index.d.ts +16 -0
- package/dist/esm/components/cf-icon-preview/index.d.ts.map +1 -0
- package/dist/esm/components/cf-icon-preview/index.js +41 -0
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +11 -3
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +4 -3
- package/dist/esm/components/goal-seek-dialog/index.d.ts +15 -5
- package/dist/esm/components/goal-seek-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/goal-seek-dialog/index.js +126 -29
- package/dist/esm/components/hidden-markers/index.d.ts.map +1 -1
- package/dist/esm/components/hidden-markers/index.js +9 -8
- package/dist/esm/components/hidden-markers/style.d.ts +7 -0
- package/dist/esm/components/hidden-markers/style.d.ts.map +1 -1
- package/dist/esm/components/hidden-markers/style.js +8 -1
- package/dist/esm/components/protect-sheet-dialog/index.d.ts +67 -0
- package/dist/esm/components/protect-sheet-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/index.js +154 -0
- package/dist/esm/components/toolbar/types.d.ts +1 -1
- package/dist/esm/components/toolbar/types.d.ts.map +1 -1
- package/dist/esm/config.d.ts +13 -1
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +13 -1
- package/dist/esm/helpers.d.ts +10 -5
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +40 -28
- package/dist/esm/hooks/use-border-styles.d.ts.map +1 -1
- package/dist/esm/hooks/use-border-styles.js +5 -26
- package/dist/esm/hooks/use-cell-renderer.d.ts +35 -3
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +83 -42
- package/dist/esm/hooks/use-conditional-formatting.d.ts +13 -1
- package/dist/esm/hooks/use-conditional-formatting.d.ts.map +1 -1
- package/dist/esm/hooks/use-conditional-formatting.js +215 -120
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/themes.d.ts +8 -0
- package/dist/esm/themes.d.ts.map +1 -1
- package/dist/esm/themes.js +20 -3
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +115 -5
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,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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{ 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,CA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B,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;
|
|
@@ -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,M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F,eAAO,MAAM,mCAAmC,GAC9C,WAAW,aAAa,CAAC,SAAS,CAAC,EACnC,SAAQ,SAAS,EAAE,GAAG,SAAS,GAAG,IAAS,oFAoC5C,CAAC;AA4BF,eAAO,MAAM,eAAe,GAAI,gXAsB7B,oBAAoB,iBA0XtB,CAAC"}
|
|
@@ -11,7 +11,6 @@ var react_1 = require("react");
|
|
|
11
11
|
var atoms_1 = require("../atoms");
|
|
12
12
|
var config_1 = require("../config");
|
|
13
13
|
var helpers_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
|