@rowsncolumns/spreadsheet 10.2.73 → 10.2.75
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/evaluate-formula.d.ts +17 -0
- package/dist/cjs/api/evaluate-formula.d.ts.map +1 -0
- package/dist/cjs/api/evaluate-formula.js +141 -0
- package/dist/cjs/api/excel-validation-kinds.d.ts +71 -0
- package/dist/cjs/api/excel-validation-kinds.d.ts.map +1 -0
- package/dist/cjs/api/excel-validation-kinds.js +304 -0
- package/dist/cjs/api/go-to-special.d.ts +32 -0
- package/dist/cjs/api/go-to-special.d.ts.map +1 -0
- package/dist/cjs/api/go-to-special.js +111 -0
- package/dist/cjs/api/go-to.d.ts +19 -0
- package/dist/cjs/api/go-to.d.ts.map +1 -0
- package/dist/cjs/api/go-to.js +49 -0
- package/dist/cjs/api/validation-tooltip.d.ts +17 -0
- package/dist/cjs/api/validation-tooltip.d.ts.map +1 -0
- package/dist/cjs/api/validation-tooltip.js +42 -0
- package/dist/cjs/atoms/advanced-filter-dialog.atom.d.ts +28 -0
- package/dist/cjs/atoms/advanced-filter-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/advanced-filter-dialog.atom.js +32 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.d.ts +36 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/evaluate-formula-dialog.atom.js +36 -0
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts +46 -0
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/go-to-dialog.atom.js +34 -0
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts +29 -0
- package/dist/cjs/atoms/goal-seek-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/goal-seek-dialog.atom.js +30 -0
- package/dist/cjs/atoms/index.d.ts +5 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +5 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.d.ts +29 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/paste-special-dialog.atom.js +34 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.d.ts +45 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/remove-duplicates-dialog.atom.js +37 -0
- package/dist/cjs/atoms/subtotal-dialog.atom.d.ts +39 -0
- package/dist/cjs/atoms/subtotal-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/subtotal-dialog.atom.js +30 -0
- package/dist/cjs/atoms/text-to-columns-dialog.atom.d.ts +34 -0
- package/dist/cjs/atoms/text-to-columns-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/text-to-columns-dialog.atom.js +36 -0
- package/dist/cjs/atoms/watch-window.atom.d.ts +37 -0
- package/dist/cjs/atoms/watch-window.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/watch-window.atom.js +61 -0
- package/dist/cjs/components/advanced-filter-dialog/index.d.ts +28 -0
- package/dist/cjs/components/advanced-filter-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/advanced-filter-dialog/index.js +134 -0
- package/dist/cjs/components/calculation-options-dialog/index.d.ts +33 -0
- package/dist/cjs/components/calculation-options-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/calculation-options-dialog/index.js +69 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +208 -19
- package/dist/cjs/components/canvas-grid/typings.d.ts +72 -9
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.d.ts +30 -0
- package/dist/cjs/components/cell/alignment.d.ts.map +1 -1
- package/dist/cjs/components/cell/alignment.js +56 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +15 -7
- package/dist/cjs/components/cell-diff/index.d.ts +3 -2
- package/dist/cjs/components/cell-diff/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +2 -1
- package/dist/cjs/components/context-menu/index.d.ts +21 -3
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +256 -6
- package/dist/cjs/components/context-menu/total-row-functions.d.ts +32 -0
- package/dist/cjs/components/context-menu/total-row-functions.d.ts.map +1 -0
- package/dist/cjs/components/context-menu/total-row-functions.js +62 -0
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +16 -1
- package/dist/cjs/components/evaluate-formula-dialog/index.d.ts +34 -0
- package/dist/cjs/components/evaluate-formula-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/evaluate-formula-dialog/index.js +106 -0
- package/dist/cjs/components/go-to-dialog/index.d.ts +45 -0
- package/dist/cjs/components/go-to-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/go-to-dialog/index.js +136 -0
- package/dist/cjs/components/goal-seek-dialog/index.d.ts +32 -0
- package/dist/cjs/components/goal-seek-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/goal-seek-dialog/index.js +149 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts +29 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/paste-special-dialog/index.js +99 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.d.ts +37 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/remove-duplicates-dialog/index.js +91 -0
- package/dist/cjs/components/subtotal-dialog/index.d.ts +30 -0
- package/dist/cjs/components/subtotal-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/subtotal-dialog/index.js +126 -0
- package/dist/cjs/components/text-to-columns-dialog/index.d.ts +37 -0
- package/dist/cjs/components/text-to-columns-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/text-to-columns-dialog/index.js +166 -0
- package/dist/cjs/components/toolbar/background-color-selector.d.ts +13 -1
- package/dist/cjs/components/toolbar/background-color-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/background-color-selector.js +57 -11
- package/dist/cjs/components/toolbar/cell-style-selector.d.ts +15 -2
- package/dist/cjs/components/toolbar/cell-style-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/cell-style-selector.js +56 -3
- package/dist/cjs/components/toolbar/fill-selectors.d.ts +49 -0
- package/dist/cjs/components/toolbar/fill-selectors.d.ts.map +1 -0
- package/dist/cjs/components/toolbar/fill-selectors.js +196 -0
- package/dist/cjs/components/toolbar/index.d.ts +2 -0
- package/dist/cjs/components/toolbar/index.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/index.js +2 -0
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.d.ts +8 -0
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-horizontal-align-selector.js +23 -4
- package/dist/cjs/components/toolbar/text-rotation-selector.d.ts +29 -0
- package/dist/cjs/components/toolbar/text-rotation-selector.d.ts.map +1 -0
- package/dist/cjs/components/toolbar/text-rotation-selector.js +78 -0
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts +7 -1
- package/dist/cjs/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-wrap-selector.js +10 -3
- package/dist/cjs/components/watch-window/index.d.ts +25 -0
- package/dist/cjs/components/watch-window/index.d.ts.map +1 -0
- package/dist/cjs/components/watch-window/index.js +63 -0
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +17 -6
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts +20 -1
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +25 -20
- package/dist/cjs/hooks/use-get-tooltip.d.ts.map +1 -1
- package/dist/cjs/hooks/use-get-tooltip.js +7 -2
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +17 -2
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +206 -31
- package/dist/cjs/index.d.ts +14 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +15 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +289 -4
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js +19 -1
- package/dist/esm/api/evaluate-formula.d.ts +17 -0
- package/dist/esm/api/evaluate-formula.d.ts.map +1 -0
- package/dist/esm/api/evaluate-formula.js +109 -0
- package/dist/esm/api/excel-validation-kinds.d.ts +71 -0
- package/dist/esm/api/excel-validation-kinds.d.ts.map +1 -0
- package/dist/esm/api/excel-validation-kinds.js +287 -0
- package/dist/esm/api/go-to-special.d.ts +32 -0
- package/dist/esm/api/go-to-special.d.ts.map +1 -0
- package/dist/esm/api/go-to-special.js +96 -0
- package/dist/esm/api/go-to.d.ts +19 -0
- package/dist/esm/api/go-to.d.ts.map +1 -0
- package/dist/esm/api/go-to.js +41 -0
- package/dist/esm/api/validation-tooltip.d.ts +17 -0
- package/dist/esm/api/validation-tooltip.d.ts.map +1 -0
- package/dist/esm/api/validation-tooltip.js +34 -0
- package/dist/esm/atoms/advanced-filter-dialog.atom.d.ts +28 -0
- package/dist/esm/atoms/advanced-filter-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/advanced-filter-dialog.atom.js +21 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.d.ts +36 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/evaluate-formula-dialog.atom.js +25 -0
- package/dist/esm/atoms/go-to-dialog.atom.d.ts +46 -0
- package/dist/esm/atoms/go-to-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/go-to-dialog.atom.js +25 -0
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts +29 -0
- package/dist/esm/atoms/goal-seek-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/goal-seek-dialog.atom.js +21 -0
- package/dist/esm/atoms/index.d.ts +5 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +5 -0
- package/dist/esm/atoms/paste-special-dialog.atom.d.ts +29 -0
- package/dist/esm/atoms/paste-special-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/paste-special-dialog.atom.js +25 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.d.ts +45 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/remove-duplicates-dialog.atom.js +26 -0
- package/dist/esm/atoms/subtotal-dialog.atom.d.ts +39 -0
- package/dist/esm/atoms/subtotal-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/subtotal-dialog.atom.js +21 -0
- package/dist/esm/atoms/text-to-columns-dialog.atom.d.ts +34 -0
- package/dist/esm/atoms/text-to-columns-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/text-to-columns-dialog.atom.js +25 -0
- package/dist/esm/atoms/watch-window.atom.d.ts +37 -0
- package/dist/esm/atoms/watch-window.atom.d.ts.map +1 -0
- package/dist/esm/atoms/watch-window.atom.js +37 -0
- package/dist/esm/components/advanced-filter-dialog/index.d.ts +28 -0
- package/dist/esm/components/advanced-filter-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/advanced-filter-dialog/index.js +125 -0
- package/dist/esm/components/calculation-options-dialog/index.d.ts +33 -0
- package/dist/esm/components/calculation-options-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/calculation-options-dialog/index.js +61 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +202 -19
- package/dist/esm/components/canvas-grid/typings.d.ts +72 -9
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.d.ts +30 -0
- package/dist/esm/components/cell/alignment.d.ts.map +1 -1
- package/dist/esm/components/cell/alignment.js +51 -0
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +16 -8
- package/dist/esm/components/cell-diff/index.d.ts +3 -2
- package/dist/esm/components/cell-diff/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +2 -1
- package/dist/esm/components/context-menu/index.d.ts +21 -3
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +251 -9
- package/dist/esm/components/context-menu/total-row-functions.d.ts +32 -0
- package/dist/esm/components/context-menu/total-row-functions.d.ts.map +1 -0
- package/dist/esm/components/context-menu/total-row-functions.js +50 -0
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +17 -1
- package/dist/esm/components/evaluate-formula-dialog/index.d.ts +34 -0
- package/dist/esm/components/evaluate-formula-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/evaluate-formula-dialog/index.js +86 -0
- package/dist/esm/components/go-to-dialog/index.d.ts +45 -0
- package/dist/esm/components/go-to-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/go-to-dialog/index.js +124 -0
- package/dist/esm/components/goal-seek-dialog/index.d.ts +32 -0
- package/dist/esm/components/goal-seek-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/goal-seek-dialog/index.js +125 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts +29 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/paste-special-dialog/index.js +90 -0
- package/dist/esm/components/remove-duplicates-dialog/index.d.ts +37 -0
- package/dist/esm/components/remove-duplicates-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/remove-duplicates-dialog/index.js +82 -0
- package/dist/esm/components/subtotal-dialog/index.d.ts +30 -0
- package/dist/esm/components/subtotal-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/subtotal-dialog/index.js +115 -0
- package/dist/esm/components/text-to-columns-dialog/index.d.ts +37 -0
- package/dist/esm/components/text-to-columns-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/text-to-columns-dialog/index.js +147 -0
- package/dist/esm/components/toolbar/background-color-selector.d.ts +13 -1
- package/dist/esm/components/toolbar/background-color-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/background-color-selector.js +61 -11
- package/dist/esm/components/toolbar/cell-style-selector.d.ts +15 -2
- package/dist/esm/components/toolbar/cell-style-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/cell-style-selector.js +46 -2
- package/dist/esm/components/toolbar/fill-selectors.d.ts +49 -0
- package/dist/esm/components/toolbar/fill-selectors.d.ts.map +1 -0
- package/dist/esm/components/toolbar/fill-selectors.js +162 -0
- package/dist/esm/components/toolbar/index.d.ts +2 -0
- package/dist/esm/components/toolbar/index.d.ts.map +1 -1
- package/dist/esm/components/toolbar/index.js +2 -0
- package/dist/esm/components/toolbar/text-horizontal-align-selector.d.ts +8 -0
- package/dist/esm/components/toolbar/text-horizontal-align-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-horizontal-align-selector.js +21 -5
- package/dist/esm/components/toolbar/text-rotation-selector.d.ts +29 -0
- package/dist/esm/components/toolbar/text-rotation-selector.d.ts.map +1 -0
- package/dist/esm/components/toolbar/text-rotation-selector.js +71 -0
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts +7 -1
- package/dist/esm/components/toolbar/text-wrap-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-wrap-selector.js +10 -3
- package/dist/esm/components/watch-window/index.d.ts +25 -0
- package/dist/esm/components/watch-window/index.d.ts.map +1 -0
- package/dist/esm/components/watch-window/index.js +54 -0
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +17 -6
- package/dist/esm/hooks/use-copy-paste-cut.d.ts +20 -1
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +8 -3
- package/dist/esm/hooks/use-get-tooltip.d.ts.map +1 -1
- package/dist/esm/hooks/use-get-tooltip.js +7 -2
- package/dist/esm/hooks/use-keyboard-handler.d.ts +17 -2
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +193 -31
- package/dist/esm/index.d.ts +14 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +13 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +289 -4
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +18 -0
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { DataValidationRule, ErrorValue } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* The data-validation part of a cell tooltip (both engines share it):
|
|
5
|
+
*
|
|
6
|
+
* - a cell flagged **Invalid** shows the rule's own error alert title/body
|
|
7
|
+
* (Excel's custom error message, #131) — the generic "violates its
|
|
8
|
+
* validation rule" text is only the fallback when the rule has none;
|
|
9
|
+
* - a formula **Error** keeps its own tooltip (nothing here);
|
|
10
|
+
* - otherwise the rule's input message (Excel's "show input message when
|
|
11
|
+
* cell is selected", surfaced on hover here — #130).
|
|
12
|
+
*
|
|
13
|
+
* Returns `undefined` when the rule contributes nothing, so the host's own
|
|
14
|
+
* tooltip content / the generic markers apply.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getDataValidationTooltipContent: (rule: DataValidationRule | null | undefined, error: ErrorValue | null | undefined) => ReactNode | undefined;
|
|
17
|
+
//# sourceMappingURL=validation-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-tooltip.d.ts","sourceRoot":"","sources":["../../../api/validation-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAsB/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAC1C,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAC3C,OAAO,UAAU,GAAG,IAAI,GAAG,SAAS,KACnC,SAAS,GAAG,SAad,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const hasText = (message) => Boolean(message && (message.title || message.message));
|
|
3
|
+
const renderMessage = (message, accentClass) => (React.createElement("div", { className: `bg-rnc-background text-rnc-foreground p-2 shadow-md rounded-md border-l-4 border-solid ${accentClass} max-w-[300px] flex flex-col gap-0.5` },
|
|
4
|
+
message.title ? (React.createElement("div", { className: "font-bold font-system text-sm" }, message.title)) : null,
|
|
5
|
+
message.message ? (React.createElement("div", { className: "text-xs font-system whitespace-pre-wrap" }, message.message)) : null));
|
|
6
|
+
/**
|
|
7
|
+
* The data-validation part of a cell tooltip (both engines share it):
|
|
8
|
+
*
|
|
9
|
+
* - a cell flagged **Invalid** shows the rule's own error alert title/body
|
|
10
|
+
* (Excel's custom error message, #131) — the generic "violates its
|
|
11
|
+
* validation rule" text is only the fallback when the rule has none;
|
|
12
|
+
* - a formula **Error** keeps its own tooltip (nothing here);
|
|
13
|
+
* - otherwise the rule's input message (Excel's "show input message when
|
|
14
|
+
* cell is selected", surfaced on hover here — #130).
|
|
15
|
+
*
|
|
16
|
+
* Returns `undefined` when the rule contributes nothing, so the host's own
|
|
17
|
+
* tooltip content / the generic markers apply.
|
|
18
|
+
*/
|
|
19
|
+
export const getDataValidationTooltipContent = (rule, error) => {
|
|
20
|
+
if (!rule)
|
|
21
|
+
return undefined;
|
|
22
|
+
if (error?.type === "Error")
|
|
23
|
+
return undefined;
|
|
24
|
+
if (error?.type === "Invalid") {
|
|
25
|
+
const alertMessage = rule.alert?.message;
|
|
26
|
+
return hasText(alertMessage)
|
|
27
|
+
? renderMessage(alertMessage, "border-l-rnc-destructive")
|
|
28
|
+
: undefined;
|
|
29
|
+
}
|
|
30
|
+
const inputMessage = rule.inputMessage;
|
|
31
|
+
return hasText(inputMessage)
|
|
32
|
+
? renderMessage(inputMessage, "border-l-blue-700")
|
|
33
|
+
: undefined;
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AdvancedFilterOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Open-state + payload for the Advanced Filter dialog (Excel's Data → Sort &
|
|
4
|
+
* Filter → Advanced). The context menu opens it with the list range around
|
|
5
|
+
* the active cell (A1 text); the host-mounted dialog resolves the typed
|
|
6
|
+
* references and routes the options back through `onApply`.
|
|
7
|
+
*/
|
|
8
|
+
export type AdvancedFilterDialogRequest = {
|
|
9
|
+
/** A1 reference of the default "List range". */
|
|
10
|
+
listRange: string;
|
|
11
|
+
/** Routed to `onAdvancedFilter` by the opener. */
|
|
12
|
+
onApply: (options: AdvancedFilterOptions) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const advancedFilterDialogAtom: import("jotai").PrimitiveAtom<AdvancedFilterDialogRequest | null> & {
|
|
15
|
+
init: AdvancedFilterDialogRequest | null;
|
|
16
|
+
};
|
|
17
|
+
export declare const useAdvancedFilterDialogState: () => [AdvancedFilterDialogRequest | null, (args_0: AdvancedFilterDialogRequest | ((prev: AdvancedFilterDialogRequest | null) => AdvancedFilterDialogRequest | null) | null) => void];
|
|
18
|
+
/** Number of mounted `AdvancedFilterDialogHost`s — the menu item is offered only while > 0. */
|
|
19
|
+
export declare const advancedFilterDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
20
|
+
init: number;
|
|
21
|
+
};
|
|
22
|
+
/** True when at least one `AdvancedFilterDialogHost` is mounted. */
|
|
23
|
+
export declare const useIsAdvancedFilterDialogMounted: () => boolean;
|
|
24
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
25
|
+
export declare const useRegisterAdvancedFilterDialogHost: () => void;
|
|
26
|
+
/** Returns a function that opens the host-mounted Advanced Filter dialog. */
|
|
27
|
+
export declare const useOpenAdvancedFilterDialog: () => (request: AdvancedFilterDialogRequest) => void;
|
|
28
|
+
//# sourceMappingURL=advanced-filter-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-filter-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/advanced-filter-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,wBAAwB;;CAEpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,uLACN,CAAC;AAEpC,+FAA+F;AAC/F,eAAO,MAAM,iCAAiC;;CAAU,CAAC;AAEzD,oEAAoE;AACpE,eAAO,MAAM,gCAAgC,eACQ,CAAC;AAEtD,yEAAyE;AACzE,eAAO,MAAM,mCAAmC,YAM/C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,2BAA2B,kBAG1B,2BAA2B,SAGxC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const advancedFilterDialogAtom = atom(null);
|
|
4
|
+
export const useAdvancedFilterDialogState = () => useAtom(advancedFilterDialogAtom);
|
|
5
|
+
/** Number of mounted `AdvancedFilterDialogHost`s — the menu item is offered only while > 0. */
|
|
6
|
+
export const advancedFilterDialogHostCountAtom = atom(0);
|
|
7
|
+
/** True when at least one `AdvancedFilterDialogHost` is mounted. */
|
|
8
|
+
export const useIsAdvancedFilterDialogMounted = () => useAtomValue(advancedFilterDialogHostCountAtom) > 0;
|
|
9
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
10
|
+
export const useRegisterAdvancedFilterDialogHost = () => {
|
|
11
|
+
const setCount = useSetAtom(advancedFilterDialogHostCountAtom);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setCount((count) => count + 1);
|
|
14
|
+
return () => setCount((count) => count - 1);
|
|
15
|
+
}, [setCount]);
|
|
16
|
+
};
|
|
17
|
+
/** Returns a function that opens the host-mounted Advanced Filter dialog. */
|
|
18
|
+
export const useOpenAdvancedFilterDialog = () => {
|
|
19
|
+
const setRequest = useSetAtom(advancedFilterDialogAtom);
|
|
20
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EvaluationValue } from "@rowsncolumns/calculator";
|
|
2
|
+
import type { CellInterface } from "@rowsncolumns/grid";
|
|
3
|
+
/**
|
|
4
|
+
* Open-state + payload for the Evaluate Formula dialog (Excel → Formulas →
|
|
5
|
+
* Evaluate Formula). The grid opens it for the active cell with a read-only
|
|
6
|
+
* `evaluate` that scratch-evaluates a sub-expression through the host's
|
|
7
|
+
* calculator (`onRequestCalculate`); nothing is written back.
|
|
8
|
+
*/
|
|
9
|
+
export type EvaluateFormulaDialogRequest = {
|
|
10
|
+
sheetId: number;
|
|
11
|
+
cell: CellInterface;
|
|
12
|
+
sheetName?: string;
|
|
13
|
+
/** The cell's formula, including the leading `=`. */
|
|
14
|
+
formula: string;
|
|
15
|
+
/** Evaluates `expression` (no leading `=`) in the cell's context. */
|
|
16
|
+
evaluate: (expression: string) => Promise<EvaluationValue>;
|
|
17
|
+
};
|
|
18
|
+
export declare const evaluateFormulaDialogAtom: import("jotai").PrimitiveAtom<EvaluateFormulaDialogRequest | null> & {
|
|
19
|
+
init: EvaluateFormulaDialogRequest | null;
|
|
20
|
+
};
|
|
21
|
+
export declare const useEvaluateFormulaDialogState: () => [EvaluateFormulaDialogRequest | null, (args_0: EvaluateFormulaDialogRequest | ((prev: EvaluateFormulaDialogRequest | null) => EvaluateFormulaDialogRequest | null) | null) => void];
|
|
22
|
+
/**
|
|
23
|
+
* Number of mounted `EvaluateFormulaDialogHost`s. The grid only claims the trigger
|
|
24
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
25
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
26
|
+
*/
|
|
27
|
+
export declare const evaluateFormulaDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
28
|
+
init: number;
|
|
29
|
+
};
|
|
30
|
+
/** True when at least one `EvaluateFormulaDialogHost` is mounted. */
|
|
31
|
+
export declare const useIsEvaluateFormulaDialogMounted: () => boolean;
|
|
32
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
33
|
+
export declare const useRegisterEvaluateFormulaDialogHost: () => void;
|
|
34
|
+
/** Returns a function that opens the host-mounted Evaluate Formula dialog. */
|
|
35
|
+
export declare const useOpenEvaluateFormulaDialog: () => (request: EvaluateFormulaDialogRequest) => void;
|
|
36
|
+
//# sourceMappingURL=evaluate-formula-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-formula-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/evaluate-formula-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,yBAAyB;;CACW,CAAC;AAElD,eAAO,MAAM,6BAA6B,2LACN,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,kCAAkC;;CAAU,CAAC;AAE1D,qEAAqE;AACrE,eAAO,MAAM,iCAAiC,eACQ,CAAC;AAEvD,yEAAyE;AACzE,eAAO,MAAM,oCAAoC,YAMhD,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,kBAG3B,4BAA4B,SAGzC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const evaluateFormulaDialogAtom = atom(null);
|
|
4
|
+
export const useEvaluateFormulaDialogState = () => useAtom(evaluateFormulaDialogAtom);
|
|
5
|
+
/**
|
|
6
|
+
* Number of mounted `EvaluateFormulaDialogHost`s. The grid only claims the trigger
|
|
7
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
8
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
9
|
+
*/
|
|
10
|
+
export const evaluateFormulaDialogHostCountAtom = atom(0);
|
|
11
|
+
/** True when at least one `EvaluateFormulaDialogHost` is mounted. */
|
|
12
|
+
export const useIsEvaluateFormulaDialogMounted = () => useAtomValue(evaluateFormulaDialogHostCountAtom) > 0;
|
|
13
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
14
|
+
export const useRegisterEvaluateFormulaDialogHost = () => {
|
|
15
|
+
const setCount = useSetAtom(evaluateFormulaDialogHostCountAtom);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setCount((count) => count + 1);
|
|
18
|
+
return () => setCount((count) => count - 1);
|
|
19
|
+
}, [setCount]);
|
|
20
|
+
};
|
|
21
|
+
/** Returns a function that opens the host-mounted Evaluate Formula dialog. */
|
|
22
|
+
export const useOpenEvaluateFormulaDialog = () => {
|
|
23
|
+
const setRequest = useSetAtom(evaluateFormulaDialogAtom);
|
|
24
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
25
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CellInterface, GridRange } from "@rowsncolumns/grid";
|
|
2
|
+
import type { GoToSpecialKind } from "../api/go-to-special";
|
|
3
|
+
import type { NamedRange, SheetRange } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Open-state + payload for the Go To dialog (Excel `Ctrl+G` / `F5`). The grid
|
|
6
|
+
* opens it with everything needed to resolve a reference against the
|
|
7
|
+
* workbook; the host-mounted dialog hands the resolved range to `onNavigate`.
|
|
8
|
+
*/
|
|
9
|
+
export type GoToDialogRequest = {
|
|
10
|
+
sheetId: number;
|
|
11
|
+
activeCell: CellInterface;
|
|
12
|
+
namedRanges?: NamedRange[] | null;
|
|
13
|
+
getSheetId?: (sheetName: string) => number | undefined;
|
|
14
|
+
getSheetName?: (sheetId: number) => string | undefined;
|
|
15
|
+
rowCount?: number;
|
|
16
|
+
columnCount?: number;
|
|
17
|
+
onNavigate: (range: SheetRange) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Go To Special: resolves a category against the current selection (or
|
|
20
|
+
* the sheet) and selects the resulting runs. Absent when the grid cannot
|
|
21
|
+
* read cell data, in which case the dialog hides the "Special…" panel.
|
|
22
|
+
*/
|
|
23
|
+
special?: {
|
|
24
|
+
resolve: (kind: GoToSpecialKind) => GridRange[];
|
|
25
|
+
onSelectRanges: (ranges: GridRange[]) => void;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const goToDialogAtom: import("jotai").PrimitiveAtom<GoToDialogRequest | null> & {
|
|
29
|
+
init: GoToDialogRequest | null;
|
|
30
|
+
};
|
|
31
|
+
export declare const useGoToDialogState: () => [GoToDialogRequest | null, (args_0: GoToDialogRequest | ((prev: GoToDialogRequest | null) => GoToDialogRequest | null) | null) => void];
|
|
32
|
+
/**
|
|
33
|
+
* Number of mounted `GoToDialogHost`s. The grid only claims the trigger
|
|
34
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
35
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
36
|
+
*/
|
|
37
|
+
export declare const goToDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
38
|
+
init: number;
|
|
39
|
+
};
|
|
40
|
+
/** True when at least one `GoToDialogHost` is mounted. */
|
|
41
|
+
export declare const useIsGoToDialogMounted: () => boolean;
|
|
42
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
43
|
+
export declare const useRegisterGoToDialogHost: () => void;
|
|
44
|
+
/** Returns a function that opens the host-mounted Go To dialog. */
|
|
45
|
+
export declare const useOpenGoToDialog: () => (request: GoToDialogRequest) => void;
|
|
46
|
+
//# sourceMappingURL=go-to-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go-to-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/go-to-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAInE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,SAAS,EAAE,CAAC;QAChD,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;KAC/C,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,cAAc;;CAAuC,CAAC;AAEnE,eAAO,MAAM,kBAAkB,+IAAgC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAAU,CAAC;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,eACQ,CAAC;AAE5C,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,YAMrC,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,kBAGhB,iBAAiB,SAG9B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const goToDialogAtom = atom(null);
|
|
4
|
+
export const useGoToDialogState = () => useAtom(goToDialogAtom);
|
|
5
|
+
/**
|
|
6
|
+
* Number of mounted `GoToDialogHost`s. The grid only claims the trigger
|
|
7
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
8
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
9
|
+
*/
|
|
10
|
+
export const goToDialogHostCountAtom = atom(0);
|
|
11
|
+
/** True when at least one `GoToDialogHost` is mounted. */
|
|
12
|
+
export const useIsGoToDialogMounted = () => useAtomValue(goToDialogHostCountAtom) > 0;
|
|
13
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
14
|
+
export const useRegisterGoToDialogHost = () => {
|
|
15
|
+
const setCount = useSetAtom(goToDialogHostCountAtom);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setCount((count) => count + 1);
|
|
18
|
+
return () => setCount((count) => count - 1);
|
|
19
|
+
}, [setCount]);
|
|
20
|
+
};
|
|
21
|
+
/** Returns a function that opens the host-mounted Go To dialog. */
|
|
22
|
+
export const useOpenGoToDialog = () => {
|
|
23
|
+
const setRequest = useSetAtom(goToDialogAtom);
|
|
24
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GoalSeekResult } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Open-state + payload for the Goal Seek dialog (Excel's Data → What-If
|
|
4
|
+
* Analysis → Goal Seek). The context menu opens it with the active cell as
|
|
5
|
+
* the "Set cell"; the host-mounted dialog routes the three fields (as A1
|
|
6
|
+
* references) back through `onApply` and shows the search status it
|
|
7
|
+
* resolves to.
|
|
8
|
+
*/
|
|
9
|
+
export type GoalSeekDialogRequest = {
|
|
10
|
+
/** A1 reference of the active cell — the default "Set cell". */
|
|
11
|
+
setCell: string;
|
|
12
|
+
/** Runs the search; resolves to the result, or `undefined` when the engine reports none. */
|
|
13
|
+
onApply: (setCell: string, targetValue: number, changingCell: string) => Promise<GoalSeekResult | undefined>;
|
|
14
|
+
};
|
|
15
|
+
export declare const goalSeekDialogAtom: import("jotai").PrimitiveAtom<GoalSeekDialogRequest | null> & {
|
|
16
|
+
init: GoalSeekDialogRequest | null;
|
|
17
|
+
};
|
|
18
|
+
export declare const useGoalSeekDialogState: () => [GoalSeekDialogRequest | null, (args_0: GoalSeekDialogRequest | ((prev: GoalSeekDialogRequest | null) => GoalSeekDialogRequest | null) | null) => void];
|
|
19
|
+
/** Number of mounted `GoalSeekDialogHost`s — the menu item is offered only while > 0. */
|
|
20
|
+
export declare const goalSeekDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
21
|
+
init: number;
|
|
22
|
+
};
|
|
23
|
+
/** True when at least one `GoalSeekDialogHost` is mounted. */
|
|
24
|
+
export declare const useIsGoalSeekDialogMounted: () => boolean;
|
|
25
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
26
|
+
export declare const useRegisterGoalSeekDialogHost: () => void;
|
|
27
|
+
/** Returns a function that opens the host-mounted Goal Seek dialog. */
|
|
28
|
+
export declare const useOpenGoalSeekDialog: () => (request: GoalSeekDialogRequest) => void;
|
|
29
|
+
//# sourceMappingURL=goal-seek-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-seek-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/goal-seek-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,OAAO,EAAE,CACP,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CAA2C,CAAC;AAE3E,eAAO,MAAM,sBAAsB,+JAAoC,CAAC;AAExE,yFAAyF;AACzF,eAAO,MAAM,2BAA2B;;CAAU,CAAC;AAEnD,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B,eACQ,CAAC;AAEhD,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,YAMzC,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,kBAGpB,qBAAqB,SAGlC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const goalSeekDialogAtom = atom(null);
|
|
4
|
+
export const useGoalSeekDialogState = () => useAtom(goalSeekDialogAtom);
|
|
5
|
+
/** Number of mounted `GoalSeekDialogHost`s — the menu item is offered only while > 0. */
|
|
6
|
+
export const goalSeekDialogHostCountAtom = atom(0);
|
|
7
|
+
/** True when at least one `GoalSeekDialogHost` is mounted. */
|
|
8
|
+
export const useIsGoalSeekDialogMounted = () => useAtomValue(goalSeekDialogHostCountAtom) > 0;
|
|
9
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
10
|
+
export const useRegisterGoalSeekDialogHost = () => {
|
|
11
|
+
const setCount = useSetAtom(goalSeekDialogHostCountAtom);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setCount((count) => count + 1);
|
|
14
|
+
return () => setCount((count) => count - 1);
|
|
15
|
+
}, [setCount]);
|
|
16
|
+
};
|
|
17
|
+
/** Returns a function that opens the host-mounted Goal Seek dialog. */
|
|
18
|
+
export const useOpenGoalSeekDialog = () => {
|
|
19
|
+
const setRequest = useSetAtom(goalSeekDialogAtom);
|
|
20
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
21
|
+
};
|
|
@@ -15,4 +15,9 @@ export * from "./paste-menu.atom";
|
|
|
15
15
|
export * from "./magic-fill-state.atom";
|
|
16
16
|
export * from "./validation-alert.atom";
|
|
17
17
|
export * from "./sort-dialog.atom";
|
|
18
|
+
export * from "./paste-special-dialog.atom";
|
|
19
|
+
export * from "./go-to-dialog.atom";
|
|
20
|
+
export * from "./evaluate-formula-dialog.atom";
|
|
21
|
+
export * from "./remove-duplicates-dialog.atom";
|
|
22
|
+
export * from "./watch-window.atom";
|
|
18
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
|
package/dist/esm/atoms/index.js
CHANGED
|
@@ -15,3 +15,8 @@ export * from "./paste-menu.atom";
|
|
|
15
15
|
export * from "./magic-fill-state.atom";
|
|
16
16
|
export * from "./validation-alert.atom";
|
|
17
17
|
export * from "./sort-dialog.atom";
|
|
18
|
+
export * from "./paste-special-dialog.atom";
|
|
19
|
+
export * from "./go-to-dialog.atom";
|
|
20
|
+
export * from "./evaluate-formula-dialog.atom";
|
|
21
|
+
export * from "./remove-duplicates-dialog.atom";
|
|
22
|
+
export * from "./watch-window.atom";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PasteSpecialOptions } from "../hooks/use-copy-paste-cut";
|
|
2
|
+
/**
|
|
3
|
+
* Open-state + payload for the Paste Special dialog (Excel `Ctrl+Alt+V` /
|
|
4
|
+
* context menu → Paste special…). The grid opens it with the paste callback
|
|
5
|
+
* of the current sheet; the host-mounted dialog routes the chosen options
|
|
6
|
+
* back through `onApply`.
|
|
7
|
+
*/
|
|
8
|
+
export type PasteSpecialDialogRequest = {
|
|
9
|
+
onApply: (options: PasteSpecialOptions) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const pasteSpecialDialogAtom: import("jotai").PrimitiveAtom<PasteSpecialDialogRequest | null> & {
|
|
12
|
+
init: PasteSpecialDialogRequest | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const usePasteSpecialDialogState: () => [PasteSpecialDialogRequest | null, (args_0: PasteSpecialDialogRequest | ((prev: PasteSpecialDialogRequest | null) => PasteSpecialDialogRequest | null) | null) => void];
|
|
15
|
+
/**
|
|
16
|
+
* Number of mounted `PasteSpecialDialogHost`s. The grid only claims the trigger
|
|
17
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
18
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
19
|
+
*/
|
|
20
|
+
export declare const pasteSpecialDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
21
|
+
init: number;
|
|
22
|
+
};
|
|
23
|
+
/** True when at least one `PasteSpecialDialogHost` is mounted. */
|
|
24
|
+
export declare const useIsPasteSpecialDialogMounted: () => boolean;
|
|
25
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
26
|
+
export declare const useRegisterPasteSpecialDialogHost: () => void;
|
|
27
|
+
/** Returns a function that opens the host-mounted Paste Special dialog. */
|
|
28
|
+
export declare const useOpenPasteSpecialDialog: () => (request: PasteSpecialDialogRequest) => void;
|
|
29
|
+
//# sourceMappingURL=paste-special-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-special-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/paste-special-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAElC,CAAC;AAEF,eAAO,MAAM,0BAA0B,+KAAwC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;CAAU,CAAC;AAEvD,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,eACQ,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,iCAAiC,YAM7C,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,kBAGxB,yBAAyB,SAGtC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const pasteSpecialDialogAtom = atom(null);
|
|
4
|
+
export const usePasteSpecialDialogState = () => useAtom(pasteSpecialDialogAtom);
|
|
5
|
+
/**
|
|
6
|
+
* Number of mounted `PasteSpecialDialogHost`s. The grid only claims the trigger
|
|
7
|
+
* (shortcut / context-menu item) while a host is mounted, so a host that has
|
|
8
|
+
* not adopted the dialog keeps the browser default instead of a dead action.
|
|
9
|
+
*/
|
|
10
|
+
export const pasteSpecialDialogHostCountAtom = atom(0);
|
|
11
|
+
/** True when at least one `PasteSpecialDialogHost` is mounted. */
|
|
12
|
+
export const useIsPasteSpecialDialogMounted = () => useAtomValue(pasteSpecialDialogHostCountAtom) > 0;
|
|
13
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
14
|
+
export const useRegisterPasteSpecialDialogHost = () => {
|
|
15
|
+
const setCount = useSetAtom(pasteSpecialDialogHostCountAtom);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setCount((count) => count + 1);
|
|
18
|
+
return () => setCount((count) => count - 1);
|
|
19
|
+
}, [setCount]);
|
|
20
|
+
};
|
|
21
|
+
/** Returns a function that opens the host-mounted Paste Special dialog. */
|
|
22
|
+
export const useOpenPasteSpecialDialog = () => {
|
|
23
|
+
const setRequest = useSetAtom(pasteSpecialDialogAtom);
|
|
24
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
25
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RemoveDuplicatesOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* One column of the range being de-duplicated.
|
|
4
|
+
*/
|
|
5
|
+
export type RemoveDuplicatesDialogColumn = {
|
|
6
|
+
/** Absolute sheet column index. */
|
|
7
|
+
columnIndex: number;
|
|
8
|
+
/** Positional label, e.g. "Column B". */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Text of the first row, shown instead of `label` when "My data has headers" is on. */
|
|
11
|
+
header?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Open-state + payload for the Remove Duplicates dialog. The context menu
|
|
15
|
+
* (which unmounts when it closes) opens the dialog by setting this atom; the
|
|
16
|
+
* dialog itself is host-mounted so it survives the menu closing. Mirrors the
|
|
17
|
+
* Sort dialog atom pattern.
|
|
18
|
+
*/
|
|
19
|
+
export type RemoveDuplicatesDialogRequest = {
|
|
20
|
+
columns: RemoveDuplicatesDialogColumn[];
|
|
21
|
+
/** Initial state of "My data has headers". */
|
|
22
|
+
hasHeader: boolean;
|
|
23
|
+
/** Routed to `onRemoveDuplicates` by the opener. */
|
|
24
|
+
onApply: (options: RemoveDuplicatesOptions) => void;
|
|
25
|
+
};
|
|
26
|
+
export declare const removeDuplicatesDialogAtom: import("jotai").PrimitiveAtom<RemoveDuplicatesDialogRequest | null> & {
|
|
27
|
+
init: RemoveDuplicatesDialogRequest | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Number of mounted `RemoveDuplicatesDialogHost`s. Openers fall back to an
|
|
31
|
+
* immediate de-dupe when no host is mounted, so a host that has not adopted
|
|
32
|
+
* the dialog keeps the previous one-click behaviour instead of a dead menu
|
|
33
|
+
* item.
|
|
34
|
+
*/
|
|
35
|
+
export declare const removeDuplicatesDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
36
|
+
init: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const useRemoveDuplicatesDialogState: () => [RemoveDuplicatesDialogRequest | null, (args_0: RemoveDuplicatesDialogRequest | ((prev: RemoveDuplicatesDialogRequest | null) => RemoveDuplicatesDialogRequest | null) | null) => void];
|
|
39
|
+
/** Returns a function that opens the host-mounted Remove Duplicates dialog. */
|
|
40
|
+
export declare const useOpenRemoveDuplicatesDialog: () => (request: RemoveDuplicatesDialogRequest) => void;
|
|
41
|
+
/** True when at least one `RemoveDuplicatesDialogHost` is mounted. */
|
|
42
|
+
export declare const useIsRemoveDuplicatesDialogMounted: () => boolean;
|
|
43
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
44
|
+
export declare const useRegisterRemoveDuplicatesDialogHost: () => void;
|
|
45
|
+
//# sourceMappingURL=remove-duplicates-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-duplicates-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/remove-duplicates-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,0BAA0B;;CACW,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC;;CAAU,CAAC;AAE3D,eAAO,MAAM,8BAA8B,+LACN,CAAC;AAEtC,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,kBAG5B,6BAA6B,SAG1C,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,kCAAkC,eACQ,CAAC;AAExD,yEAAyE;AACzE,eAAO,MAAM,qCAAqC,YAMjD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const removeDuplicatesDialogAtom = atom(null);
|
|
4
|
+
/**
|
|
5
|
+
* Number of mounted `RemoveDuplicatesDialogHost`s. Openers fall back to an
|
|
6
|
+
* immediate de-dupe when no host is mounted, so a host that has not adopted
|
|
7
|
+
* the dialog keeps the previous one-click behaviour instead of a dead menu
|
|
8
|
+
* item.
|
|
9
|
+
*/
|
|
10
|
+
export const removeDuplicatesDialogHostCountAtom = atom(0);
|
|
11
|
+
export const useRemoveDuplicatesDialogState = () => useAtom(removeDuplicatesDialogAtom);
|
|
12
|
+
/** Returns a function that opens the host-mounted Remove Duplicates dialog. */
|
|
13
|
+
export const useOpenRemoveDuplicatesDialog = () => {
|
|
14
|
+
const setRequest = useSetAtom(removeDuplicatesDialogAtom);
|
|
15
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
16
|
+
};
|
|
17
|
+
/** True when at least one `RemoveDuplicatesDialogHost` is mounted. */
|
|
18
|
+
export const useIsRemoveDuplicatesDialogMounted = () => useAtomValue(removeDuplicatesDialogHostCountAtom) > 0;
|
|
19
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
20
|
+
export const useRegisterRemoveDuplicatesDialogHost = () => {
|
|
21
|
+
const setCount = useSetAtom(removeDuplicatesDialogHostCountAtom);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setCount((count) => count + 1);
|
|
24
|
+
return () => setCount((count) => count - 1);
|
|
25
|
+
}, [setCount]);
|
|
26
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SubtotalOptions } from "../types";
|
|
2
|
+
/** One column of the range being subtotalled. */
|
|
3
|
+
export type SubtotalDialogColumn = {
|
|
4
|
+
/** Absolute sheet column index. */
|
|
5
|
+
columnIndex: number;
|
|
6
|
+
/** Positional label, e.g. "Column B". */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Text of the first row, shown instead of `label` when the data has headers. */
|
|
9
|
+
header?: string;
|
|
10
|
+
};
|
|
11
|
+
/** The dialog's choices; the opener adds the `range`. */
|
|
12
|
+
export type SubtotalDialogChoices = Omit<SubtotalOptions, "range">;
|
|
13
|
+
/**
|
|
14
|
+
* Open-state + payload for the Subtotal dialog (Excel's Data → Outline →
|
|
15
|
+
* Subtotal). The context menu opens it with the range's columns; the
|
|
16
|
+
* host-mounted dialog routes the choices back through `onApply`.
|
|
17
|
+
*/
|
|
18
|
+
export type SubtotalDialogRequest = {
|
|
19
|
+
columns: SubtotalDialogColumn[];
|
|
20
|
+
/** Initial state of "My data has headers". */
|
|
21
|
+
hasHeader: boolean;
|
|
22
|
+
/** Routed to `onSubtotal` by the opener. */
|
|
23
|
+
onApply: (choices: SubtotalDialogChoices) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const subtotalDialogAtom: import("jotai").PrimitiveAtom<SubtotalDialogRequest | null> & {
|
|
26
|
+
init: SubtotalDialogRequest | null;
|
|
27
|
+
};
|
|
28
|
+
export declare const useSubtotalDialogState: () => [SubtotalDialogRequest | null, (args_0: SubtotalDialogRequest | ((prev: SubtotalDialogRequest | null) => SubtotalDialogRequest | null) | null) => void];
|
|
29
|
+
/** Number of mounted `SubtotalDialogHost`s — the menu item is offered only while > 0. */
|
|
30
|
+
export declare const subtotalDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
31
|
+
init: number;
|
|
32
|
+
};
|
|
33
|
+
/** True when at least one `SubtotalDialogHost` is mounted. */
|
|
34
|
+
export declare const useIsSubtotalDialogMounted: () => boolean;
|
|
35
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
36
|
+
export declare const useRegisterSubtotalDialogHost: () => void;
|
|
37
|
+
/** Returns a function that opens the host-mounted Subtotal dialog. */
|
|
38
|
+
export declare const useOpenSubtotalDialog: () => (request: SubtotalDialogRequest) => void;
|
|
39
|
+
//# sourceMappingURL=subtotal-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtotal-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/subtotal-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,OAAO,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CAA2C,CAAC;AAE3E,eAAO,MAAM,sBAAsB,+JAAoC,CAAC;AAExE,yFAAyF;AACzF,eAAO,MAAM,2BAA2B;;CAAU,CAAC;AAEnD,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B,eACQ,CAAC;AAEhD,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,YAMzC,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,kBAGpB,qBAAqB,SAGlC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const subtotalDialogAtom = atom(null);
|
|
4
|
+
export const useSubtotalDialogState = () => useAtom(subtotalDialogAtom);
|
|
5
|
+
/** Number of mounted `SubtotalDialogHost`s — the menu item is offered only while > 0. */
|
|
6
|
+
export const subtotalDialogHostCountAtom = atom(0);
|
|
7
|
+
/** True when at least one `SubtotalDialogHost` is mounted. */
|
|
8
|
+
export const useIsSubtotalDialogMounted = () => useAtomValue(subtotalDialogHostCountAtom) > 0;
|
|
9
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
10
|
+
export const useRegisterSubtotalDialogHost = () => {
|
|
11
|
+
const setCount = useSetAtom(subtotalDialogHostCountAtom);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setCount((count) => count + 1);
|
|
14
|
+
return () => setCount((count) => count - 1);
|
|
15
|
+
}, [setCount]);
|
|
16
|
+
};
|
|
17
|
+
/** Returns a function that opens the host-mounted Subtotal dialog. */
|
|
18
|
+
export const useOpenSubtotalDialog = () => {
|
|
19
|
+
const setRequest = useSetAtom(subtotalDialogAtom);
|
|
20
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
21
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SplitTextOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Open-state + payload for the Text to Columns dialog (Excel's Data → Text
|
|
4
|
+
* to Columns wizard: Delimited / Fixed width). The context menu opens it
|
|
5
|
+
* with a preview of the selected column's texts; the host-mounted dialog
|
|
6
|
+
* routes the chosen delimiter or column breaks back through `onApply`.
|
|
7
|
+
*/
|
|
8
|
+
export type TextToColumnsDialogRequest = {
|
|
9
|
+
/** Texts of the first cells of the selected column (for the preview / ruler). */
|
|
10
|
+
preview: string[];
|
|
11
|
+
/** Routed to `onSplitTextToColumns` by the opener. */
|
|
12
|
+
onApply: (options: {
|
|
13
|
+
delimiter: string;
|
|
14
|
+
} & SplitTextOptions) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const textToColumnsDialogAtom: import("jotai").PrimitiveAtom<TextToColumnsDialogRequest | null> & {
|
|
17
|
+
init: TextToColumnsDialogRequest | null;
|
|
18
|
+
};
|
|
19
|
+
export declare const useTextToColumnsDialogState: () => [TextToColumnsDialogRequest | null, (args_0: TextToColumnsDialogRequest | ((prev: TextToColumnsDialogRequest | null) => TextToColumnsDialogRequest | null) | null) => void];
|
|
20
|
+
/**
|
|
21
|
+
* Number of mounted `TextToColumnsDialogHost`s. The context menu only offers
|
|
22
|
+
* "Fixed width…" while a host is mounted, so a host that has not adopted the
|
|
23
|
+
* dialog keeps its one-click delimiter items and no dead entry.
|
|
24
|
+
*/
|
|
25
|
+
export declare const textToColumnsDialogHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
26
|
+
init: number;
|
|
27
|
+
};
|
|
28
|
+
/** True when at least one `TextToColumnsDialogHost` is mounted. */
|
|
29
|
+
export declare const useIsTextToColumnsDialogMounted: () => boolean;
|
|
30
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
31
|
+
export declare const useRegisterTextToColumnsDialogHost: () => void;
|
|
32
|
+
/** Returns a function that opens the host-mounted Text to Columns dialog. */
|
|
33
|
+
export declare const useOpenTextToColumnsDialog: () => (request: TextToColumnsDialogRequest) => void;
|
|
34
|
+
//# sourceMappingURL=text-to-columns-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-to-columns-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/text-to-columns-dialog.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,sDAAsD;IACtD,OAAO,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB,KAAK,IAAI,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,uBAAuB;;CAEnC,CAAC;AAEF,eAAO,MAAM,2BAA2B,mLACN,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;CAAU,CAAC;AAExD,mEAAmE;AACnE,eAAO,MAAM,+BAA+B,eACQ,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,kCAAkC,YAM9C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,kBAGzB,0BAA0B,SAGvC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const textToColumnsDialogAtom = atom(null);
|
|
4
|
+
export const useTextToColumnsDialogState = () => useAtom(textToColumnsDialogAtom);
|
|
5
|
+
/**
|
|
6
|
+
* Number of mounted `TextToColumnsDialogHost`s. The context menu only offers
|
|
7
|
+
* "Fixed width…" while a host is mounted, so a host that has not adopted the
|
|
8
|
+
* dialog keeps its one-click delimiter items and no dead entry.
|
|
9
|
+
*/
|
|
10
|
+
export const textToColumnsDialogHostCountAtom = atom(0);
|
|
11
|
+
/** True when at least one `TextToColumnsDialogHost` is mounted. */
|
|
12
|
+
export const useIsTextToColumnsDialogMounted = () => useAtomValue(textToColumnsDialogHostCountAtom) > 0;
|
|
13
|
+
/** Registers the calling component as a dialog host for its lifetime. */
|
|
14
|
+
export const useRegisterTextToColumnsDialogHost = () => {
|
|
15
|
+
const setCount = useSetAtom(textToColumnsDialogHostCountAtom);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setCount((count) => count + 1);
|
|
18
|
+
return () => setCount((count) => count - 1);
|
|
19
|
+
}, [setCount]);
|
|
20
|
+
};
|
|
21
|
+
/** Returns a function that opens the host-mounted Text to Columns dialog. */
|
|
22
|
+
export const useOpenTextToColumnsDialog = () => {
|
|
23
|
+
const setRequest = useSetAtom(textToColumnsDialogAtom);
|
|
24
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
25
|
+
};
|