@rowsncolumns/spreadsheet 10.2.74 → 10.2.76
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/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/fill-series.d.ts +38 -0
- package/dist/cjs/api/fill-series.d.ts.map +1 -0
- package/dist/cjs/api/fill-series.js +89 -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/spreadsheet-api.d.ts +6 -2
- package/dist/cjs/api/spreadsheet-api.d.ts.map +1 -1
- package/dist/cjs/api/spreadsheet-api.js +9 -3
- 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/fill-options.atom.d.ts +36 -0
- package/dist/cjs/atoms/fill-options.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/fill-options.atom.js +11 -0
- package/dist/cjs/atoms/fill-series-dialog.atom.d.ts +26 -0
- package/dist/cjs/atoms/fill-series-dialog.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/fill-series-dialog.atom.js +14 -0
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts +11 -1
- package/dist/cjs/atoms/go-to-dialog.atom.d.ts.map +1 -1
- 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 +3 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +3 -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 +328 -71
- package/dist/cjs/components/canvas-grid/typings.d.ts +31 -5
- 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/helpers.d.ts +9 -0
- package/dist/cjs/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.js +8 -1
- package/dist/cjs/components/cell-editor/helpers.spec.js +14 -0
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +7 -3
- package/dist/cjs/components/context-menu/index.d.ts +6 -1
- package/dist/cjs/components/context-menu/index.d.ts.map +1 -1
- package/dist/cjs/components/context-menu/index.js +146 -3
- 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/fill-series-dialog/index.d.ts +29 -0
- package/dist/cjs/components/fill-series-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/fill-series-dialog/index.js +156 -0
- package/dist/cjs/components/go-to-dialog/index.d.ts +11 -1
- package/dist/cjs/components/go-to-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/go-to-dialog/index.js +67 -24
- 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/selection/fill-options-menu.d.ts +32 -0
- package/dist/cjs/components/selection/fill-options-menu.d.ts.map +1 -0
- package/dist/cjs/components/selection/fill-options-menu.js +65 -0
- package/dist/cjs/components/selection/index.d.ts +1 -1
- package/dist/cjs/components/selection/index.d.ts.map +1 -1
- package/dist/cjs/components/selection/index.js +4 -2
- package/dist/cjs/components/selection/types.d.ts +11 -1
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- 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 +1 -0
- package/dist/cjs/components/toolbar/index.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/index.js +1 -0
- package/dist/cjs/components/toolbar/text-format-selector.d.ts +9 -0
- package/dist/cjs/components/toolbar/text-format-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/text-format-selector.js +15 -3
- 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/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-editable.d.ts +11 -2
- package/dist/cjs/hooks/use-editable.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editable.js +8 -0
- package/dist/cjs/hooks/use-editor-submit.d.ts +32 -3
- package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.js +111 -2
- 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.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +27 -14
- package/dist/cjs/hooks/use-selection-renderer.d.ts +13 -2
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +21 -4
- package/dist/cjs/hooks/use-selection.d.ts +54 -4
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +232 -37
- package/dist/cjs/index.d.ts +12 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +156 -5
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js +19 -1
- 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/fill-series.d.ts +38 -0
- package/dist/esm/api/fill-series.d.ts.map +1 -0
- package/dist/esm/api/fill-series.js +78 -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/spreadsheet-api.d.ts +6 -2
- package/dist/esm/api/spreadsheet-api.d.ts.map +1 -1
- package/dist/esm/api/spreadsheet-api.js +8 -3
- 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/fill-options.atom.d.ts +36 -0
- package/dist/esm/atoms/fill-options.atom.d.ts.map +1 -0
- package/dist/esm/atoms/fill-options.atom.js +5 -0
- package/dist/esm/atoms/fill-series-dialog.atom.d.ts +26 -0
- package/dist/esm/atoms/fill-series-dialog.atom.d.ts.map +1 -0
- package/dist/esm/atoms/fill-series-dialog.atom.js +9 -0
- package/dist/esm/atoms/go-to-dialog.atom.d.ts +11 -1
- package/dist/esm/atoms/go-to-dialog.atom.d.ts.map +1 -1
- 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 +3 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +3 -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 +266 -26
- package/dist/esm/components/canvas-grid/typings.d.ts +31 -5
- 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/helpers.d.ts +9 -0
- package/dist/esm/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.js +6 -0
- package/dist/esm/components/cell-editor/helpers.spec.js +15 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +8 -4
- package/dist/esm/components/context-menu/index.d.ts +6 -1
- package/dist/esm/components/context-menu/index.d.ts.map +1 -1
- package/dist/esm/components/context-menu/index.js +139 -4
- 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/fill-series-dialog/index.d.ts +29 -0
- package/dist/esm/components/fill-series-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/fill-series-dialog/index.js +151 -0
- package/dist/esm/components/go-to-dialog/index.d.ts +11 -1
- package/dist/esm/components/go-to-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/go-to-dialog/index.js +63 -23
- 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/selection/fill-options-menu.d.ts +32 -0
- package/dist/esm/components/selection/fill-options-menu.d.ts.map +1 -0
- package/dist/esm/components/selection/fill-options-menu.js +63 -0
- package/dist/esm/components/selection/index.d.ts +1 -1
- package/dist/esm/components/selection/index.d.ts.map +1 -1
- package/dist/esm/components/selection/index.js +4 -2
- package/dist/esm/components/selection/types.d.ts +11 -1
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- 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 +1 -0
- package/dist/esm/components/toolbar/index.d.ts.map +1 -1
- package/dist/esm/components/toolbar/index.js +1 -0
- package/dist/esm/components/toolbar/text-format-selector.d.ts +9 -0
- package/dist/esm/components/toolbar/text-format-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/text-format-selector.js +14 -2
- 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/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-editable.d.ts +11 -2
- package/dist/esm/hooks/use-editable.d.ts.map +1 -1
- package/dist/esm/hooks/use-editable.js +8 -0
- package/dist/esm/hooks/use-editor-submit.d.ts +32 -3
- package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.js +82 -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.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +27 -14
- package/dist/esm/hooks/use-selection-renderer.d.ts +13 -2
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +22 -5
- package/dist/esm/hooks/use-selection.d.ts +54 -4
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +220 -36
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +156 -5
- 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 +7 -7
|
@@ -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 { CellInterface, SelectionArea } from "@rowsncolumns/grid";
|
|
2
|
+
import type { SelectionAttributes } from "../components/canvas-grid/typings";
|
|
3
|
+
import type { AutoFillType } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* A completed fill-handle gesture waiting for the user to (re)choose its fill
|
|
6
|
+
* type — Excel's Auto Fill Options smart tag after a left drag, or the fill
|
|
7
|
+
* menu a right-button drag opens on release. The request keeps the ORIGINAL
|
|
8
|
+
* source `selections` (untouched by the fill), so choosing an entry simply
|
|
9
|
+
* re-issues `onFill` with an explicit `fillType` and the same target: the
|
|
10
|
+
* source is still intact and the target is overwritten with the new result.
|
|
11
|
+
*/
|
|
12
|
+
export type FillOptionsRequest = {
|
|
13
|
+
sheetId: number;
|
|
14
|
+
activeCell: CellInterface;
|
|
15
|
+
/** Target range of the drag (source + filled area). */
|
|
16
|
+
fillSelection: SelectionArea;
|
|
17
|
+
/** Source selection the drag started from. */
|
|
18
|
+
selections: SelectionArea<SelectionAttributes>[];
|
|
19
|
+
/** Fill type already applied (`undefined` = auto-detected / not yet filled). */
|
|
20
|
+
fillType?: AutoFillType;
|
|
21
|
+
/** True when a source cell is date-formatted → the menu adds Fill Days/Weekdays/Months/Years. */
|
|
22
|
+
hasDates: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `"smart-tag"` — the fill already ran; show the small button at the
|
|
25
|
+
* bottom-right of the range. `"menu"` — a right-button drag; nothing has
|
|
26
|
+
* been filled yet and the menu opens immediately.
|
|
27
|
+
*/
|
|
28
|
+
mode: "smart-tag" | "menu";
|
|
29
|
+
};
|
|
30
|
+
export declare const fillOptionsAtom: import("jotai").PrimitiveAtom<FillOptionsRequest | null> & {
|
|
31
|
+
init: FillOptionsRequest | null;
|
|
32
|
+
};
|
|
33
|
+
export declare const useFillOptionsState: () => [FillOptionsRequest | null, (args_0: FillOptionsRequest | ((prev: FillOptionsRequest | null) => FillOptionsRequest | null) | null) => void];
|
|
34
|
+
export declare const useFillOptionsValue: () => FillOptionsRequest | null;
|
|
35
|
+
export declare const useSetFillOptions: () => (args_0: FillOptionsRequest | ((prev: FillOptionsRequest | null) => FillOptionsRequest | null) | null) => void;
|
|
36
|
+
//# sourceMappingURL=fill-options.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-options.atom.d.ts","sourceRoot":"","sources":["../../../atoms/fill-options.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,uDAAuD;IACvD,aAAa,EAAE,aAAa,CAAC;IAC7B,8CAA8C;IAC9C,UAAU,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACjD,gFAAgF;IAChF,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,iGAAiG;IACjG,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAAwC,CAAC;AAErE,eAAO,MAAM,mBAAmB,mJAAiC,CAAC;AAClE,eAAO,MAAM,mBAAmB,iCAAsC,CAAC;AACvE,eAAO,MAAM,iBAAiB,sHAAoC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
export const fillOptionsAtom = atom(null);
|
|
3
|
+
export const useFillOptionsState = () => useAtom(fillOptionsAtom);
|
|
4
|
+
export const useFillOptionsValue = () => useAtomValue(fillOptionsAtom);
|
|
5
|
+
export const useSetFillOptions = () => useSetAtom(fillOptionsAtom);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CellInterface, SelectionArea } from "@rowsncolumns/grid";
|
|
2
|
+
import type { SelectionAttributes } from "../components/canvas-grid/typings";
|
|
3
|
+
import type { FillSeriesSpec } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Open-state + payload for Excel's Series dialog (Home > Fill > Series…, and
|
|
6
|
+
* "Series…" on the right-drag fill-handle menu). The dialog is host-mounted
|
|
7
|
+
* (`FillSeriesDialogHost`) and stays UI-only: `onApply` receives the chosen
|
|
8
|
+
* spec and the opener (the grid) turns it into an `onFill` call — seed line,
|
|
9
|
+
* target range and stop-bounded extent are its job, not the dialog's.
|
|
10
|
+
*/
|
|
11
|
+
export type FillSeriesDialogRequest = {
|
|
12
|
+
sheetId: number;
|
|
13
|
+
activeCell: CellInterface;
|
|
14
|
+
/** The range the series fills; its first row (Columns) / column (Rows) is the seed. */
|
|
15
|
+
selection: SelectionArea<SelectionAttributes>;
|
|
16
|
+
/** Pre-selected axis (a right-drag seeds it from the drag direction). */
|
|
17
|
+
initialIn?: FillSeriesSpec["in"];
|
|
18
|
+
onApply(spec: FillSeriesSpec): void;
|
|
19
|
+
};
|
|
20
|
+
export declare const fillSeriesDialogAtom: import("jotai").PrimitiveAtom<FillSeriesDialogRequest | null> & {
|
|
21
|
+
init: FillSeriesDialogRequest | null;
|
|
22
|
+
};
|
|
23
|
+
export declare const useFillSeriesDialogState: () => [FillSeriesDialogRequest | null, (args_0: FillSeriesDialogRequest | ((prev: FillSeriesDialogRequest | null) => FillSeriesDialogRequest | null) | null) => void];
|
|
24
|
+
/** Returns a function that opens the host-mounted Series dialog. */
|
|
25
|
+
export declare const useOpenFillSeriesDialog: () => (request: FillSeriesDialogRequest) => void;
|
|
26
|
+
//# sourceMappingURL=fill-series-dialog.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-series-dialog.atom.d.ts","sourceRoot":"","sources":["../../../atoms/fill-series-dialog.atom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,uFAAuF;IACvF,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC9C,yEAAyE;IACzE,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAA6C,CAAC;AAE/E,eAAO,MAAM,wBAAwB,uKAAsC,CAAC;AAE5E,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,kBAGtB,uBAAuB,SAGpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { atom, useAtom, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
export const fillSeriesDialogAtom = atom(null);
|
|
4
|
+
export const useFillSeriesDialogState = () => useAtom(fillSeriesDialogAtom);
|
|
5
|
+
/** Returns a function that opens the host-mounted Series dialog. */
|
|
6
|
+
export const useOpenFillSeriesDialog = () => {
|
|
7
|
+
const setRequest = useSetAtom(fillSeriesDialogAtom);
|
|
8
|
+
return useCallback((request) => setRequest(request), [setRequest]);
|
|
9
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CellInterface } from "@rowsncolumns/grid";
|
|
1
|
+
import type { CellInterface, GridRange } from "@rowsncolumns/grid";
|
|
2
|
+
import type { GoToSpecialKind } from "../api/go-to-special";
|
|
2
3
|
import type { NamedRange, SheetRange } from "../types";
|
|
3
4
|
/**
|
|
4
5
|
* Open-state + payload for the Go To dialog (Excel `Ctrl+G` / `F5`). The grid
|
|
@@ -14,6 +15,15 @@ export type GoToDialogRequest = {
|
|
|
14
15
|
rowCount?: number;
|
|
15
16
|
columnCount?: number;
|
|
16
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
|
+
};
|
|
17
27
|
};
|
|
18
28
|
export declare const goToDialogAtom: import("jotai").PrimitiveAtom<GoToDialogRequest | null> & {
|
|
19
29
|
init: GoToDialogRequest | null;
|
|
@@ -1 +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,MAAM,oBAAoB,CAAC;
|
|
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,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
|
+
};
|
|
@@ -12,6 +12,8 @@ export { useLoadingIndicator } from "./loading-indicator.atom";
|
|
|
12
12
|
export * from "./selected-chart-embed.atom";
|
|
13
13
|
export * from "./popover.atom";
|
|
14
14
|
export * from "./paste-menu.atom";
|
|
15
|
+
export * from "./fill-options.atom";
|
|
16
|
+
export * from "./fill-series-dialog.atom";
|
|
15
17
|
export * from "./magic-fill-state.atom";
|
|
16
18
|
export * from "./validation-alert.atom";
|
|
17
19
|
export * from "./sort-dialog.atom";
|
|
@@ -19,4 +21,5 @@ export * from "./paste-special-dialog.atom";
|
|
|
19
21
|
export * from "./go-to-dialog.atom";
|
|
20
22
|
export * from "./evaluate-formula-dialog.atom";
|
|
21
23
|
export * from "./remove-duplicates-dialog.atom";
|
|
24
|
+
export * from "./watch-window.atom";
|
|
22
25
|
//# 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;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,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,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,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
|
@@ -12,6 +12,8 @@ export { useLoadingIndicator } from "./loading-indicator.atom";
|
|
|
12
12
|
export * from "./selected-chart-embed.atom";
|
|
13
13
|
export * from "./popover.atom";
|
|
14
14
|
export * from "./paste-menu.atom";
|
|
15
|
+
export * from "./fill-options.atom";
|
|
16
|
+
export * from "./fill-series-dialog.atom";
|
|
15
17
|
export * from "./magic-fill-state.atom";
|
|
16
18
|
export * from "./validation-alert.atom";
|
|
17
19
|
export * from "./sort-dialog.atom";
|
|
@@ -19,3 +21,4 @@ export * from "./paste-special-dialog.atom";
|
|
|
19
21
|
export * from "./go-to-dialog.atom";
|
|
20
22
|
export * from "./evaluate-formula-dialog.atom";
|
|
21
23
|
export * from "./remove-duplicates-dialog.atom";
|
|
24
|
+
export * from "./watch-window.atom";
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SheetCoordinate } from "../types";
|
|
2
|
+
/** A watched cell (Excel's Watch Window row). */
|
|
3
|
+
export type WatchWindowEntry = SheetCoordinate;
|
|
4
|
+
/**
|
|
5
|
+
* What the grid publishes so the host-mounted panel can show live values
|
|
6
|
+
* and jump to a cell. Republished on every grid render while a host is
|
|
7
|
+
* mounted, so values track recalculation.
|
|
8
|
+
*/
|
|
9
|
+
export type WatchWindowContext = {
|
|
10
|
+
getSheetName?: (sheetId: number) => string | undefined;
|
|
11
|
+
getFormattedValue: (sheetId: number, rowIndex: number, columnIndex: number) => string | undefined;
|
|
12
|
+
getFormula: (sheetId: number, rowIndex: number, columnIndex: number) => string | undefined | null;
|
|
13
|
+
onNavigate: (cell: SheetCoordinate) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const watchWindowEntriesAtom: import("jotai").PrimitiveAtom<SheetCoordinate[]> & {
|
|
16
|
+
init: SheetCoordinate[];
|
|
17
|
+
};
|
|
18
|
+
export declare const watchWindowOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
19
|
+
init: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare const watchWindowContextAtom: import("jotai").PrimitiveAtom<WatchWindowContext | null> & {
|
|
22
|
+
init: WatchWindowContext | null;
|
|
23
|
+
};
|
|
24
|
+
/** Number of mounted `WatchWindowHost`s — the grid offers "Add watch" only then. */
|
|
25
|
+
export declare const watchWindowHostCountAtom: import("jotai").PrimitiveAtom<number> & {
|
|
26
|
+
init: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const useIsWatchWindowMounted: () => boolean;
|
|
29
|
+
export declare const useRegisterWatchWindowHost: () => void;
|
|
30
|
+
export declare const useWatchWindowEntries: () => [SheetCoordinate[], (args_0: SheetCoordinate[] | ((prev: SheetCoordinate[]) => SheetCoordinate[])) => void];
|
|
31
|
+
export declare const useWatchWindowOpen: () => [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
32
|
+
export declare const useWatchWindowContext: () => WatchWindowContext | null;
|
|
33
|
+
export declare const useSetWatchWindowContext: () => (args_0: WatchWindowContext | ((prev: WatchWindowContext | null) => WatchWindowContext | null) | null) => void;
|
|
34
|
+
/** Adds a cell (once) and opens the panel. */
|
|
35
|
+
export declare const useAddWatch: () => (cell: SheetCoordinate) => void;
|
|
36
|
+
export declare const useRemoveWatch: () => (cell: SheetCoordinate) => void;
|
|
37
|
+
//# sourceMappingURL=watch-window.atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch-window.atom.d.ts","sourceRoot":"","sources":["../../../atoms/watch-window.atom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD,iBAAiB,EAAE,CACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,SAAS,CAAC;IACxB,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAA+B,CAAC;AACnE,eAAO,MAAM,mBAAmB;;CAAc,CAAC;AAC/C,eAAO,MAAM,sBAAsB;;CAAwC,CAAC;AAE5E,oFAAoF;AACpF,eAAO,MAAM,wBAAwB;;CAAU,CAAC;AAEhD,eAAO,MAAM,uBAAuB,eACQ,CAAC;AAE7C,eAAO,MAAM,0BAA0B,YAMtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,mHAAwC,CAAC;AAC3E,eAAO,MAAM,kBAAkB,2EAAqC,CAAC;AACrE,eAAO,MAAM,qBAAqB,iCAA6C,CAAC;AAChF,eAAO,MAAM,wBAAwB,sHACD,CAAC;AAOrC,8CAA8C;AAC9C,eAAO,MAAM,WAAW,eAIb,eAAe,SAUzB,CAAC;AAEF,eAAO,MAAM,cAAc,eAGhB,eAAe,SAMzB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export const watchWindowEntriesAtom = atom([]);
|
|
4
|
+
export const watchWindowOpenAtom = atom(false);
|
|
5
|
+
export const watchWindowContextAtom = atom(null);
|
|
6
|
+
/** Number of mounted `WatchWindowHost`s — the grid offers "Add watch" only then. */
|
|
7
|
+
export const watchWindowHostCountAtom = atom(0);
|
|
8
|
+
export const useIsWatchWindowMounted = () => useAtomValue(watchWindowHostCountAtom) > 0;
|
|
9
|
+
export const useRegisterWatchWindowHost = () => {
|
|
10
|
+
const setCount = useSetAtom(watchWindowHostCountAtom);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setCount((count) => count + 1);
|
|
13
|
+
return () => setCount((count) => count - 1);
|
|
14
|
+
}, [setCount]);
|
|
15
|
+
};
|
|
16
|
+
export const useWatchWindowEntries = () => useAtom(watchWindowEntriesAtom);
|
|
17
|
+
export const useWatchWindowOpen = () => useAtom(watchWindowOpenAtom);
|
|
18
|
+
export const useWatchWindowContext = () => useAtomValue(watchWindowContextAtom);
|
|
19
|
+
export const useSetWatchWindowContext = () => useSetAtom(watchWindowContextAtom);
|
|
20
|
+
const sameCell = (a, b) => a.sheetId === b.sheetId &&
|
|
21
|
+
a.rowIndex === b.rowIndex &&
|
|
22
|
+
a.columnIndex === b.columnIndex;
|
|
23
|
+
/** Adds a cell (once) and opens the panel. */
|
|
24
|
+
export const useAddWatch = () => {
|
|
25
|
+
const setEntries = useSetAtom(watchWindowEntriesAtom);
|
|
26
|
+
const setOpen = useSetAtom(watchWindowOpenAtom);
|
|
27
|
+
return useCallback((cell) => {
|
|
28
|
+
setEntries((entries) => entries.some((entry) => sameCell(entry, cell))
|
|
29
|
+
? entries
|
|
30
|
+
: [...entries, cell]);
|
|
31
|
+
setOpen(true);
|
|
32
|
+
}, [setEntries, setOpen]);
|
|
33
|
+
};
|
|
34
|
+
export const useRemoveWatch = () => {
|
|
35
|
+
const setEntries = useSetAtom(watchWindowEntriesAtom);
|
|
36
|
+
return useCallback((cell) => setEntries((entries) => entries.filter((entry) => !sameCell(entry, cell))), [setEntries]);
|
|
37
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { AdvancedFilterOptions } from "../../types";
|
|
3
|
+
export type AdvancedFilterDialogProps = {
|
|
4
|
+
/** Controls visibility. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange(open: boolean): void;
|
|
7
|
+
/** Default "List range" (A1 reference of the data block around the active cell). */
|
|
8
|
+
initialListRange: string;
|
|
9
|
+
/** Emits the resolved options; the host routes them to `onAdvancedFilter`. */
|
|
10
|
+
onApply(options: AdvancedFilterOptions): void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Excel's Advanced Filter dialog: filter in place or copy to another
|
|
14
|
+
* location, a list range, a criteria range (header row + criteria rows),
|
|
15
|
+
* the copy destination and "Unique records only".
|
|
16
|
+
*/
|
|
17
|
+
export declare const AdvancedFilterDialog: React.MemoExoticComponent<({ open, onOpenChange, initialListRange, onApply }: AdvancedFilterDialogProps) => React.JSX.Element>;
|
|
18
|
+
/**
|
|
19
|
+
* Host-mounted, atom-driven wrapper around {@link AdvancedFilterDialog}.
|
|
20
|
+
* Mount once in the host; the context menu opens it via
|
|
21
|
+
* `useOpenAdvancedFilterDialog` and only offers the item while a host is
|
|
22
|
+
* mounted.
|
|
23
|
+
*/
|
|
24
|
+
export declare const AdvancedFilterDialogHost: {
|
|
25
|
+
(): React.JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/advanced-filter-dialog/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAMtE,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,MAAM,yBAAyB,GAAG;IACtC,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,oFAAoF;IACpF,gBAAgB,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC/C,CAAC;AAQF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gFACqB,yBAAyB,uBAsK9E,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;CAcpC,CAAC"}
|