@rowsncolumns/spreadsheet 10.6.5 → 10.7.0
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/autocomplete.d.ts +42 -0
- package/dist/cjs/api/autocomplete.d.ts.map +1 -0
- package/dist/cjs/api/autocomplete.js +114 -0
- package/dist/cjs/api/banded-ranges.d.ts.map +1 -1
- package/dist/cjs/api/banded-ranges.js +51 -1
- package/dist/cjs/api/error-checking.d.ts +82 -0
- package/dist/cjs/api/error-checking.d.ts.map +1 -0
- package/dist/cjs/api/error-checking.js +207 -0
- package/dist/cjs/api/move-overwrite.d.ts +8 -2
- package/dist/cjs/api/move-overwrite.d.ts.map +1 -1
- package/dist/cjs/api/move-overwrite.js +19 -3
- package/dist/cjs/api/selections.d.ts +2 -2
- package/dist/cjs/api/validation.d.ts +39 -1
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +87 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/enter-key-direction.atom.js +13 -0
- package/dist/cjs/atoms/index.d.ts +1 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +1 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/paste-menu.atom.js +13 -1
- package/dist/cjs/atoms/pick-list.atom.d.ts +15 -0
- package/dist/cjs/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/pick-list.atom.js +7 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +305 -70
- package/dist/cjs/components/canvas-grid/typings.d.ts +96 -11
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +7 -8
- package/dist/cjs/components/cell/typings.d.ts +9 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.d.ts +22 -2
- package/dist/cjs/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.js +32 -8
- package/dist/cjs/components/cell-editor/index.d.ts +7 -1
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +85 -13
- package/dist/cjs/components/cell-indicator/index.d.ts +41 -0
- package/dist/cjs/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/cjs/components/cell-indicator/index.js +90 -0
- package/dist/cjs/components/cell-input/cell-input.d.ts +10 -2
- package/dist/cjs/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/cell-input.js +5 -3
- package/dist/cjs/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline-math.js +48 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline.js +36 -92
- package/dist/cjs/components/cell-structured/types.d.ts +6 -0
- package/dist/cjs/components/cell-structured/types.d.ts.map +1 -1
- package/dist/cjs/components/data-table-dialog/index.d.ts +22 -0
- package/dist/cjs/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/data-table-dialog/index.js +93 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/cjs/components/error-check-smart-tag/index.js +39 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.js +92 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/cjs/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/paste-special-dialog/index.js +61 -23
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +196 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.js +5 -0
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/protect-sheet-dialog/index.js +5 -3
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/scenario-manager-dialog/index.js +257 -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 +9 -4
- package/dist/cjs/components/selection/paste-menu.d.ts +14 -1
- package/dist/cjs/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/cjs/components/selection/paste-menu.js +78 -6
- package/dist/cjs/components/selection/paste-options.d.ts +28 -0
- package/dist/cjs/components/selection/paste-options.d.ts.map +1 -0
- package/dist/cjs/components/selection/paste-options.js +70 -0
- package/dist/cjs/components/selection/types.d.ts +12 -1
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- package/dist/cjs/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/cjs/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/cjs/components/selection-drop-menu/index.js +62 -0
- package/dist/cjs/components/solver-dialog/index.d.ts +57 -0
- package/dist/cjs/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/solver-dialog/index.js +204 -0
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/sparkline-actions.js +6 -2
- package/dist/cjs/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/table-style-selector.js +33 -2
- package/dist/cjs/config.d.ts +5 -4
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +13 -9
- package/dist/cjs/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +6 -3
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +131 -5
- package/dist/cjs/hooks/use-editable.d.ts +6 -0
- package/dist/cjs/hooks/use-editable.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.d.ts +45 -3
- package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.js +91 -7
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +10 -1
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/cjs/hooks/use-selection-drag-copy.js +274 -0
- package/dist/cjs/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +7 -2
- package/dist/cjs/hooks/use-selection.d.ts +59 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +270 -61
- package/dist/cjs/index.d.ts +6 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +50 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/autocomplete.d.ts +42 -0
- package/dist/esm/api/autocomplete.d.ts.map +1 -0
- package/dist/esm/api/autocomplete.js +91 -0
- package/dist/esm/api/banded-ranges.d.ts.map +1 -1
- package/dist/esm/api/banded-ranges.js +52 -2
- package/dist/esm/api/error-checking.d.ts +82 -0
- package/dist/esm/api/error-checking.d.ts.map +1 -0
- package/dist/esm/api/error-checking.js +156 -0
- package/dist/esm/api/move-overwrite.d.ts +8 -2
- package/dist/esm/api/move-overwrite.d.ts.map +1 -1
- package/dist/esm/api/move-overwrite.js +17 -2
- package/dist/esm/api/selections.d.ts +2 -2
- package/dist/esm/api/validation.d.ts +39 -1
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +70 -0
- package/dist/esm/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/esm/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/esm/atoms/enter-key-direction.atom.js +8 -0
- package/dist/esm/atoms/index.d.ts +1 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +1 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/esm/atoms/paste-menu.atom.js +10 -1
- package/dist/esm/atoms/pick-list.atom.d.ts +15 -0
- package/dist/esm/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/esm/atoms/pick-list.atom.js +3 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +239 -13
- package/dist/esm/components/canvas-grid/typings.d.ts +96 -11
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +8 -9
- package/dist/esm/components/cell/typings.d.ts +9 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.d.ts +22 -2
- package/dist/esm/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.js +25 -7
- package/dist/esm/components/cell-editor/index.d.ts +7 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +80 -9
- package/dist/esm/components/cell-indicator/index.d.ts +41 -0
- package/dist/esm/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/esm/components/cell-indicator/index.js +76 -0
- package/dist/esm/components/cell-input/cell-input.d.ts +10 -2
- package/dist/esm/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/cell-input.js +5 -3
- package/dist/esm/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/esm/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/esm/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline-math.js +35 -0
- package/dist/esm/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/esm/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline.js +34 -88
- package/dist/esm/components/cell-structured/types.d.ts +6 -0
- package/dist/esm/components/cell-structured/types.d.ts.map +1 -1
- package/dist/esm/components/data-table-dialog/index.d.ts +22 -0
- package/dist/esm/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/data-table-dialog/index.js +75 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/esm/components/error-check-smart-tag/index.js +33 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/forecast-sheet-dialog/index.js +83 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/esm/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/paste-special-dialog/index.js +58 -23
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +177 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/constants.js +2 -0
- package/dist/esm/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/esm/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/protect-sheet-dialog/index.js +3 -2
- package/dist/esm/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/esm/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/scenario-manager-dialog/index.js +213 -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 +9 -4
- package/dist/esm/components/selection/paste-menu.d.ts +14 -1
- package/dist/esm/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/esm/components/selection/paste-menu.js +76 -8
- package/dist/esm/components/selection/paste-options.d.ts +28 -0
- package/dist/esm/components/selection/paste-options.d.ts.map +1 -0
- package/dist/esm/components/selection/paste-options.js +62 -0
- package/dist/esm/components/selection/types.d.ts +12 -1
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- package/dist/esm/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/esm/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/esm/components/selection-drop-menu/index.js +56 -0
- package/dist/esm/components/solver-dialog/index.d.ts +57 -0
- package/dist/esm/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/solver-dialog/index.js +176 -0
- package/dist/esm/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/esm/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/esm/components/toolbar/sparkline-actions.js +6 -2
- package/dist/esm/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/table-style-selector.js +29 -3
- package/dist/esm/config.d.ts +5 -4
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +12 -8
- package/dist/esm/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +5 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +117 -6
- package/dist/esm/hooks/use-editable.d.ts +6 -0
- package/dist/esm/hooks/use-editable.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.d.ts +45 -3
- package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.js +81 -6
- package/dist/esm/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +10 -1
- package/dist/esm/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/esm/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/esm/hooks/use-selection-drag-copy.js +245 -0
- package/dist/esm/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +7 -2
- package/dist/esm/hooks/use-selection.d.ts +59 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +245 -52
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +50 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +6 -5
- package/dist/cjs/components/cell-error/index.d.ts +0 -14
- package/dist/cjs/components/cell-error/index.d.ts.map +0 -1
- package/dist/cjs/components/cell-error/index.js +0 -24
- package/dist/esm/components/cell-error/index.d.ts +0 -14
- package/dist/esm/components/cell-error/index.d.ts.map +0 -1
- package/dist/esm/components/cell-error/index.js +0 -18
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's AutoComplete for cell values (support.microsoft.com "Turn automatic
|
|
3
|
+
* completion of cell entries on or off"): while you type text in a cell,
|
|
4
|
+
* Excel completes it from the entries already in the same column, once the
|
|
5
|
+
* typed characters match exactly one of them. Only entries that contain text
|
|
6
|
+
* are offered; entries that are only numbers, dates or times are not.
|
|
7
|
+
*/
|
|
8
|
+
/** What a column cell holds, for AutoComplete: a text entry, another value, or nothing. */
|
|
9
|
+
export type AutoCompleteCell = {
|
|
10
|
+
text: string;
|
|
11
|
+
} | "value" | null;
|
|
12
|
+
/** How far up and down the contiguous block is scanned (a bound on a huge column). */
|
|
13
|
+
export declare const AUTOCOMPLETE_SCAN_LIMIT = 5000;
|
|
14
|
+
/**
|
|
15
|
+
* The distinct text entries of the column's contiguous block around `rowIndex`:
|
|
16
|
+
* the cells directly above and below the edited cell up to the first blank
|
|
17
|
+
* cell on each side (the edited cell itself is skipped). Numbers, dates and
|
|
18
|
+
* other non-text values keep the block going but are not entries. Duplicates
|
|
19
|
+
* differing only in case are listed once, with the first spelling found.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getColumnAutoCompleteEntries: ({ rowIndex, getCell, minRowIndex, maxRowIndex, limit, }: {
|
|
22
|
+
rowIndex: number;
|
|
23
|
+
getCell(rowIndex: number): AutoCompleteCell;
|
|
24
|
+
minRowIndex?: number;
|
|
25
|
+
maxRowIndex: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}) => string[];
|
|
28
|
+
/**
|
|
29
|
+
* The entry `typed` completes to, or `undefined`. Case-insensitive prefix
|
|
30
|
+
* match; Excel waits until the typed characters identify ONE entry, so a
|
|
31
|
+
* prefix shared by two distinct entries (or one that already equals an entry
|
|
32
|
+
* another entry extends) completes nothing.
|
|
33
|
+
*/
|
|
34
|
+
export declare const findAutoCompleteMatch: (typed: string, entries: string[]) => string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* A text cell value for AutoComplete: a text constant that is not only a
|
|
37
|
+
* number, a date or a time. `null` = blank.
|
|
38
|
+
*/
|
|
39
|
+
export declare const toAutoCompleteCell: (userEnteredValue: Partial<Record<"sv" | "stringValue" | "fv" | "formulaValue" | "nv" | "numberValue" | "bv" | "boolValue", unknown>> | null | undefined) => AutoCompleteCell;
|
|
40
|
+
/** Excel's Pick From Drop-down List: the block's entries, sorted A to Z. */
|
|
41
|
+
export declare const getPickListEntries: (entries: string[]) => string[];
|
|
42
|
+
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../api/autocomplete.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,2FAA2F;AAC3F,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,GAAG,IAAI,CAAC;AAEjE,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,yDAM1C;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KAAG,MAAM,EAuBT,CAAC;AASF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,MAAM,EACb,SAAS,MAAM,EAAE,KAChB,MAAM,GAAG,SAUX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,kBAAkB,OAAO,CACvB,MAAM,CACF,IAAI,GACJ,aAAa,GACb,IAAI,GACJ,cAAc,GACd,IAAI,GACJ,aAAa,GACb,IAAI,GACJ,WAAW,EACb,OAAO,CACR,CACF,GAAG,IAAI,GAAG,SAAS,KACnB,gBAaF,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,KAAG,MAAM,EACwB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Excel's AutoComplete for cell values (support.microsoft.com "Turn automatic
|
|
4
|
+
* completion of cell entries on or off"): while you type text in a cell,
|
|
5
|
+
* Excel completes it from the entries already in the same column, once the
|
|
6
|
+
* typed characters match exactly one of them. Only entries that contain text
|
|
7
|
+
* are offered; entries that are only numbers, dates or times are not.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getPickListEntries = exports.toAutoCompleteCell = exports.findAutoCompleteMatch = exports.getColumnAutoCompleteEntries = exports.AUTOCOMPLETE_SCAN_LIMIT = void 0;
|
|
11
|
+
var tslib_1 = require("tslib");
|
|
12
|
+
/** How far up and down the contiguous block is scanned (a bound on a huge column). */
|
|
13
|
+
exports.AUTOCOMPLETE_SCAN_LIMIT = 5000;
|
|
14
|
+
/**
|
|
15
|
+
* The distinct text entries of the column's contiguous block around `rowIndex`:
|
|
16
|
+
* the cells directly above and below the edited cell up to the first blank
|
|
17
|
+
* cell on each side (the edited cell itself is skipped). Numbers, dates and
|
|
18
|
+
* other non-text values keep the block going but are not entries. Duplicates
|
|
19
|
+
* differing only in case are listed once, with the first spelling found.
|
|
20
|
+
*/
|
|
21
|
+
var getColumnAutoCompleteEntries = function (_a) {
|
|
22
|
+
var rowIndex = _a.rowIndex, getCell = _a.getCell, _b = _a.minRowIndex, minRowIndex = _b === void 0 ? 1 : _b, maxRowIndex = _a.maxRowIndex, _c = _a.limit, limit = _c === void 0 ? exports.AUTOCOMPLETE_SCAN_LIMIT : _c;
|
|
23
|
+
var entries = [];
|
|
24
|
+
var seen = new Set();
|
|
25
|
+
var visit = function (r) {
|
|
26
|
+
var cell = getCell(r);
|
|
27
|
+
if (cell === null)
|
|
28
|
+
return false;
|
|
29
|
+
if (cell !== "value") {
|
|
30
|
+
var text = cell.text;
|
|
31
|
+
var key = text.toLowerCase();
|
|
32
|
+
if (text.trim() && !seen.has(key)) {
|
|
33
|
+
seen.add(key);
|
|
34
|
+
entries.push(text);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
for (var r = rowIndex - 1, n = 0; r >= minRowIndex && n < limit; r--, n++) {
|
|
40
|
+
if (!visit(r))
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
for (var r = rowIndex + 1, n = 0; r <= maxRowIndex && n < limit; r++, n++) {
|
|
44
|
+
if (!visit(r))
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
return entries;
|
|
48
|
+
};
|
|
49
|
+
exports.getColumnAutoCompleteEntries = getColumnAutoCompleteEntries;
|
|
50
|
+
/** A typed entry Excel would never complete: empty, a formula, or a number / date / time. */
|
|
51
|
+
var isCompletable = function (typed) {
|
|
52
|
+
if (!typed || typed.includes("\n"))
|
|
53
|
+
return false;
|
|
54
|
+
if (typed.startsWith("=") || typed.startsWith("+") || typed.startsWith("-"))
|
|
55
|
+
return false;
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The entry `typed` completes to, or `undefined`. Case-insensitive prefix
|
|
60
|
+
* match; Excel waits until the typed characters identify ONE entry, so a
|
|
61
|
+
* prefix shared by two distinct entries (or one that already equals an entry
|
|
62
|
+
* another entry extends) completes nothing.
|
|
63
|
+
*/
|
|
64
|
+
var findAutoCompleteMatch = function (typed, entries) {
|
|
65
|
+
var e_1, _a;
|
|
66
|
+
if (!isCompletable(typed))
|
|
67
|
+
return undefined;
|
|
68
|
+
var lower = typed.toLowerCase();
|
|
69
|
+
var match;
|
|
70
|
+
try {
|
|
71
|
+
for (var entries_1 = tslib_1.__values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
72
|
+
var entry = entries_1_1.value;
|
|
73
|
+
if (!entry.toLowerCase().startsWith(lower))
|
|
74
|
+
continue;
|
|
75
|
+
if (match !== undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
match = entry;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
81
|
+
finally {
|
|
82
|
+
try {
|
|
83
|
+
if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);
|
|
84
|
+
}
|
|
85
|
+
finally { if (e_1) throw e_1.error; }
|
|
86
|
+
}
|
|
87
|
+
return match && match.length > typed.length ? match : undefined;
|
|
88
|
+
};
|
|
89
|
+
exports.findAutoCompleteMatch = findAutoCompleteMatch;
|
|
90
|
+
/**
|
|
91
|
+
* A text cell value for AutoComplete: a text constant that is not only a
|
|
92
|
+
* number, a date or a time. `null` = blank.
|
|
93
|
+
*/
|
|
94
|
+
var toAutoCompleteCell = function (userEnteredValue) {
|
|
95
|
+
var _a, _b, _c, _d;
|
|
96
|
+
if (!userEnteredValue)
|
|
97
|
+
return null;
|
|
98
|
+
var present = function (value) { return value !== undefined && value !== null; };
|
|
99
|
+
var formula = (_a = userEnteredValue.fv) !== null && _a !== void 0 ? _a : userEnteredValue.formulaValue;
|
|
100
|
+
var text = (_b = userEnteredValue.sv) !== null && _b !== void 0 ? _b : userEnteredValue.stringValue;
|
|
101
|
+
if (!present(formula) && typeof text === "string") {
|
|
102
|
+
return text === "" ? null : { text: text };
|
|
103
|
+
}
|
|
104
|
+
var hasValue = present(formula) ||
|
|
105
|
+
present((_c = userEnteredValue.nv) !== null && _c !== void 0 ? _c : userEnteredValue.numberValue) ||
|
|
106
|
+
present((_d = userEnteredValue.bv) !== null && _d !== void 0 ? _d : userEnteredValue.boolValue);
|
|
107
|
+
return hasValue ? "value" : null;
|
|
108
|
+
};
|
|
109
|
+
exports.toAutoCompleteCell = toAutoCompleteCell;
|
|
110
|
+
/** Excel's Pick From Drop-down List: the block's entries, sorted A to Z. */
|
|
111
|
+
var getPickListEntries = function (entries) {
|
|
112
|
+
return tslib_1.__spreadArray([], tslib_1.__read(entries), false).sort(function (a, b) { return a.localeCompare(b, undefined, { sensitivity: "base" }); });
|
|
113
|
+
};
|
|
114
|
+
exports.getPickListEntries = getPickListEntries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banded-ranges.d.ts","sourceRoot":"","sources":["../../../api/banded-ranges.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"banded-ranges.d.ts","sourceRoot":"","sources":["../../../api/banded-ranges.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,cAAc,WAAW,EAAE,EAC3B,OAAO,gBAAgB,EACvB,SAAS,MAAM,EACf,aAAa,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,EAC1C,gBAAgB,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,4BAoLjD,CAAC;AAuDF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,iBAE5D,CAAC"}
|
|
@@ -17,11 +17,22 @@ var getBandedCells = function (bandedRanges, theme, sheetId, isHiddenRow, isHidd
|
|
|
17
17
|
var bandedCells = new Map();
|
|
18
18
|
try {
|
|
19
19
|
for (var bandedRanges_1 = tslib_1.__values(bandedRanges), bandedRanges_1_1 = bandedRanges_1.next(); !bandedRanges_1_1.done; bandedRanges_1_1 = bandedRanges_1.next()) {
|
|
20
|
-
var _e = bandedRanges_1_1.value, range = _e.range, rowProperties = _e.rowProperties, columnProperties = _e.columnProperties, showFirstColumn = _e.showFirstColumn, showLastColumn = _e.showLastColumn, totalRow = _e.totalRow;
|
|
20
|
+
var _e = bandedRanges_1_1.value, range = _e.range, rowProperties = _e.rowProperties, columnProperties = _e.columnProperties, showFirstColumn = _e.showFirstColumn, showLastColumn = _e.showLastColumn, totalRow = _e.totalRow, headerRow = _e.headerRow, tableStyleElements = _e.tableStyleElements;
|
|
21
21
|
// Only pick current sheet
|
|
22
22
|
if (range.sheetId !== sheetId) {
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
|
+
if (tableStyleElements) {
|
|
26
|
+
setTableStyleCells(bandedCells, tableStyleElements, range, {
|
|
27
|
+
headerRow: headerRow !== false,
|
|
28
|
+
totalRow: !!totalRow,
|
|
29
|
+
showFirstColumn: !!showFirstColumn,
|
|
30
|
+
showLastColumn: !!showLastColumn,
|
|
31
|
+
isHiddenRow: isHiddenRow,
|
|
32
|
+
isHiddenColumn: isHiddenColumn,
|
|
33
|
+
});
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
25
36
|
if (rowProperties || columnProperties) {
|
|
26
37
|
var _f = rowProperties !== null && rowProperties !== void 0 ? rowProperties : {}, headerColor = _f.headerColor, firstBandColor = _f.firstBandColor, secondBandColor = _f.secondBandColor, footerColor = _f.footerColor, headerBorder = _f.headerBorder, firstBandBorder = _f.firstBandBorder, footerBorder = _f.footerBorder, firstColumnColor = _f.firstColumnColor, lastColumnColor = _f.lastColumnColor, totalRowColor = _f.totalRowColor, totalRowBorder = _f.totalRowBorder, totalRowBold = _f.totalRowBold;
|
|
27
38
|
var _g = columnProperties !== null && columnProperties !== void 0 ? columnProperties : {}, firstBandColorColumn = _g.firstBandColor, secondBandColorColumn = _g.secondBandColor;
|
|
@@ -133,6 +144,45 @@ var getBandedCells = function (bandedRanges, theme, sheetId, isHiddenRow, isHidd
|
|
|
133
144
|
return bandedCells;
|
|
134
145
|
};
|
|
135
146
|
exports.getBandedCells = getBandedCells;
|
|
147
|
+
/**
|
|
148
|
+
* Paint a table from its style elements (Excel's built-in styles): every visible cell takes the
|
|
149
|
+
* format `resolveTableStyleCell` layers for its position. Stripes count visible rows / columns,
|
|
150
|
+
* like Excel's banding over a filtered table.
|
|
151
|
+
*/
|
|
152
|
+
var setTableStyleCells = function (bandedCells, elements, range, options) {
|
|
153
|
+
var rows = [];
|
|
154
|
+
for (var r = range.startRowIndex; r <= range.endRowIndex; r++) {
|
|
155
|
+
if (!options.isHiddenRow(r))
|
|
156
|
+
rows.push(r);
|
|
157
|
+
}
|
|
158
|
+
var columns = [];
|
|
159
|
+
for (var c = range.startColumnIndex; c <= range.endColumnIndex; c++) {
|
|
160
|
+
if (!options.isHiddenColumn(c))
|
|
161
|
+
columns.push(c);
|
|
162
|
+
}
|
|
163
|
+
for (var i = 0; i < rows.length; i++) {
|
|
164
|
+
for (var j = 0; j < columns.length; j++) {
|
|
165
|
+
var _a = (0, utils_1.resolveTableStyleCell)(elements, {
|
|
166
|
+
rowIndex: i,
|
|
167
|
+
columnIndex: j,
|
|
168
|
+
rowCount: rows.length,
|
|
169
|
+
columnCount: columns.length,
|
|
170
|
+
// The header / totals rows and first / last columns are the range's own edges: hidden,
|
|
171
|
+
// their element has nothing to paint.
|
|
172
|
+
headerRow: options.headerRow && rows[0] === range.startRowIndex,
|
|
173
|
+
totalRow: options.totalRow && rows[rows.length - 1] === range.endRowIndex,
|
|
174
|
+
showFirstColumn: options.showFirstColumn && columns[0] === range.startColumnIndex,
|
|
175
|
+
showLastColumn: options.showLastColumn &&
|
|
176
|
+
columns[columns.length - 1] === range.endColumnIndex,
|
|
177
|
+
}), fill = _a.fill, color = _a.color, bold = _a.bold, borders = _a.borders;
|
|
178
|
+
bandedCells.set((0, grid_1.cellIdentifier)(rows[i], columns[j]), {
|
|
179
|
+
backgroundColor: fill,
|
|
180
|
+
borders: borders,
|
|
181
|
+
textFormat: { color: color, bold: bold },
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
136
186
|
/**
|
|
137
187
|
* Parse tinted color. returns undefined if tint >= 1
|
|
138
188
|
* @param color
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { GridRange } from "@rowsncolumns/common-types";
|
|
2
|
+
import type { ErrorValue, ExtendedValue, IgnoredError } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* The Excel background error-checking rules the grid flags with the green ◤ indicator. The names
|
|
5
|
+
* are the OOXML `<ignoredError>` attribute names, so an ignored error round-trips through xlsx.
|
|
6
|
+
*
|
|
7
|
+
* - `evalError` — "Cells containing formulas that result in an error".
|
|
8
|
+
* - `numberStoredAsText` — "Numbers formatted as text or preceded by an apostrophe".
|
|
9
|
+
*/
|
|
10
|
+
export type ErrorCheckKind = "evalError" | "numberStoredAsText";
|
|
11
|
+
/**
|
|
12
|
+
* The number a "number stored as text" holds, or `undefined` when the text is not one. This is
|
|
13
|
+
* the value Excel's Convert to Number writes back.
|
|
14
|
+
*/
|
|
15
|
+
export declare const parseNumberStoredAsText: (text: string | null | undefined) => number | undefined;
|
|
16
|
+
export type ErrorCheckInput = {
|
|
17
|
+
/** What the user typed (`uev`): a formula, a number, a string, … */
|
|
18
|
+
userEnteredValue: ExtendedValue | null | undefined;
|
|
19
|
+
/** The cell's error, if its effective value is one. */
|
|
20
|
+
errorValue: ErrorValue | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Which error-checking rule (if any) flags this cell, before ignored errors are applied.
|
|
24
|
+
* A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
|
|
25
|
+
* A data-validation failure is not an error-checking rule (Excel only circles it on request).
|
|
26
|
+
*/
|
|
27
|
+
export declare const getErrorCheckKind: ({ userEnteredValue, errorValue, }: ErrorCheckInput) => ErrorCheckKind | undefined;
|
|
28
|
+
/** What the error-checking smart tag's menu can do. */
|
|
29
|
+
export type ErrorCheckOption = "convertToNumber" | "help" | "ignore" | "editInFormulaBar" | "options";
|
|
30
|
+
/** The menu's heading, as Excel words it. */
|
|
31
|
+
export declare const getErrorCheckTitle: (kind: ErrorCheckKind, errorName?: string) => string;
|
|
32
|
+
/** Excel's own help pages: hiding error values and error indicators, and the rule options. */
|
|
33
|
+
export declare const ERROR_CHECKING_HELP_URL = "https://support.microsoft.com/en-us/office/hide-error-values-and-error-indicators-in-cells-d171b96e-8fb4-4863-a1ba-b64557474439";
|
|
34
|
+
/** "Help on this Error": Excel's article for the error, else the error-indicators article. */
|
|
35
|
+
export declare const getErrorHelpUrl: (kind: ErrorCheckKind, errorName?: string) => string;
|
|
36
|
+
/** Has the user ignored this rule for this cell ("Ignore Error", or the file's `<ignoredErrors>`)? */
|
|
37
|
+
export declare const isErrorIgnored: (ignoredErrors: ReadonlyArray<IgnoredError> | null | undefined, rowIndex: number, columnIndex: number, kind: ErrorCheckKind) => boolean;
|
|
38
|
+
/** The sheet's ignored-errors list after "Ignore Error" on `ranges` (one new entry, as Excel writes). */
|
|
39
|
+
export declare const appendIgnoredError: (ignoredErrors: ReadonlyArray<IgnoredError> | null | undefined, ranges: GridRange[], kind: ErrorCheckKind) => IgnoredError[];
|
|
40
|
+
/** One row's run of adjacent cells Convert to Number rewrites, with their numbers. */
|
|
41
|
+
export type NumberRun = {
|
|
42
|
+
rowIndex: number;
|
|
43
|
+
startColumnIndex: number;
|
|
44
|
+
values: number[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The numbers stored as text inside `ranges`, as runs of adjacent cells per row — so Convert to
|
|
48
|
+
* Number writes each run in one call and never touches the cells between them. Rows / columns are
|
|
49
|
+
* clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
|
|
50
|
+
* only the used rows.
|
|
51
|
+
*/
|
|
52
|
+
export declare const collectNumberStoredAsTextRuns: (ranges: GridRange[], getUserEnteredValue: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined, maxRow: number, maxColumn: number) => NumberRun[];
|
|
53
|
+
export type ErrorCheckActionContext = {
|
|
54
|
+
sheetId: number;
|
|
55
|
+
kind: ErrorCheckKind;
|
|
56
|
+
errorName?: string;
|
|
57
|
+
/** The selection's ranges (the active cell's when nothing else is selected). */
|
|
58
|
+
ranges: GridRange[];
|
|
59
|
+
getUserEnteredValue(rowIndex: number, columnIndex: number): ExtendedValue | null | undefined;
|
|
60
|
+
/** The sheet's data extent: Convert to Number scans no further. */
|
|
61
|
+
maxRow: number;
|
|
62
|
+
maxColumn: number;
|
|
63
|
+
getIgnoredErrors?(sheetId: number): IgnoredError[] | null | undefined;
|
|
64
|
+
onChangeBatch?(sheetId: number, range: GridRange, values: number[][]): void;
|
|
65
|
+
/** Records every write `action` makes as one undo step. */
|
|
66
|
+
batchHistory?<R>(action: () => R): R;
|
|
67
|
+
onUpdateSheet?(sheetId: number, sheet: {
|
|
68
|
+
ignoredErrors: IgnoredError[];
|
|
69
|
+
}): void;
|
|
70
|
+
/** Start editing the active cell in the formula bar (or in the cell when there is no bar). */
|
|
71
|
+
editInFormulaBar(): void;
|
|
72
|
+
openUrl(url: string): void;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Run one of the error-checking smart tag's menu items. Convert to Number and Ignore Error act on
|
|
76
|
+
* every selected cell, as Excel does: Convert to Number rewrites each number stored as text as its
|
|
77
|
+
* number — one `onChangeBatch` per run of adjacent cells, all inside one `batchHistory`, so it is a
|
|
78
|
+
* single undo step and syncs as ordinary value writes; Ignore Error appends the selection to the
|
|
79
|
+
* sheet's `ignoredErrors` (persisted, xlsx `<ignoredErrors>`).
|
|
80
|
+
*/
|
|
81
|
+
export declare const runErrorCheckOption: (option: ErrorCheckOption, context: ErrorCheckActionContext) => void;
|
|
82
|
+
//# sourceMappingURL=error-checking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-checking.d.ts","sourceRoot":"","sources":["../../../api/error-checking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAShE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,KAC9B,MAAM,GAAG,SAQX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,gBAAgB,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,uDAAuD;IACvD,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,mCAG/B,eAAe,KAAG,cAAc,GAAG,SAQrC,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,MAAM,GACN,QAAQ,GACR,kBAAkB,GAClB,SAAS,CAAC;AAcd,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,GAAI,MAAM,cAAc,EAAE,YAAY,MAAM,WAGT,CAAC;AAEnE,8FAA8F;AAC9F,eAAO,MAAM,uBAAuB,oIAC+F,CAAC;AAapI,8FAA8F;AAC9F,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,EAAE,YAAY,MAAM,WAE/C,CAAC;AAQ1B,sGAAsG;AACtG,eAAO,MAAM,cAAc,GACzB,eAAe,aAAa,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,SAAS,EAC7D,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,MAAM,cAAc,YAMnB,CAAC;AAEJ,yGAAyG;AACzG,eAAO,MAAM,kBAAkB,GAC7B,eAAe,aAAa,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,SAAS,EAC7D,QAAQ,SAAS,EAAE,EACnB,MAAM,cAAc,KACnB,YAAY,EAGd,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GACxC,QAAQ,SAAS,EAAE,EACnB,qBAAqB,CACnB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,aAAa,GAAG,IAAI,GAAG,SAAS,EACrC,QAAQ,MAAM,EACd,WAAW,MAAM,KAChB,SAAS,EA8BX,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IACtE,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC;IAC5E,2DAA2D;IAC3D,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACrC,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,aAAa,EAAE,YAAY,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,8FAA8F;IAC9F,gBAAgB,IAAI,IAAI,CAAC;IACzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,gBAAgB,EACxB,SAAS,uBAAuB,SAiDjC,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runErrorCheckOption = exports.collectNumberStoredAsTextRuns = exports.appendIgnoredError = exports.isErrorIgnored = exports.getErrorHelpUrl = exports.ERROR_CHECKING_HELP_URL = exports.getErrorCheckTitle = exports.getErrorCheckKind = exports.parseNumberStoredAsText = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Text that Excel's "Number Stored as Text" rule flags: an optionally signed number, with optional
|
|
7
|
+
* thousands separators, decimals, exponent or a trailing percent sign — and nothing else.
|
|
8
|
+
*/
|
|
9
|
+
var NUMBER_STORED_AS_TEXT = /^[+-]?(?:\d{1,3}(?:,\d{3})+|\d+)?(?:\.\d+)?(?:[eE][+-]?\d+)?%?$/;
|
|
10
|
+
/**
|
|
11
|
+
* The number a "number stored as text" holds, or `undefined` when the text is not one. This is
|
|
12
|
+
* the value Excel's Convert to Number writes back.
|
|
13
|
+
*/
|
|
14
|
+
var parseNumberStoredAsText = function (text) {
|
|
15
|
+
if (typeof text !== "string" || !/\d/.test(text))
|
|
16
|
+
return undefined;
|
|
17
|
+
if (!NUMBER_STORED_AS_TEXT.test(text))
|
|
18
|
+
return undefined;
|
|
19
|
+
var isPercent = text.endsWith("%");
|
|
20
|
+
var body = (isPercent ? text.slice(0, -1) : text).replace(/,/g, "");
|
|
21
|
+
var value = Number(body);
|
|
22
|
+
if (!Number.isFinite(value))
|
|
23
|
+
return undefined;
|
|
24
|
+
return isPercent ? value / 100 : value;
|
|
25
|
+
};
|
|
26
|
+
exports.parseNumberStoredAsText = parseNumberStoredAsText;
|
|
27
|
+
/**
|
|
28
|
+
* Which error-checking rule (if any) flags this cell, before ignored errors are applied.
|
|
29
|
+
* A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
|
|
30
|
+
* A data-validation failure is not an error-checking rule (Excel only circles it on request).
|
|
31
|
+
*/
|
|
32
|
+
var getErrorCheckKind = function (_a) {
|
|
33
|
+
var _b, _c;
|
|
34
|
+
var userEnteredValue = _a.userEnteredValue, errorValue = _a.errorValue;
|
|
35
|
+
var formula = (_b = userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.fv) !== null && _b !== void 0 ? _b : userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.formulaValue;
|
|
36
|
+
if (formula) {
|
|
37
|
+
return (errorValue === null || errorValue === void 0 ? void 0 : errorValue.type) === "Error" ? "evalError" : undefined;
|
|
38
|
+
}
|
|
39
|
+
var text = (_c = userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.sv) !== null && _c !== void 0 ? _c : userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.stringValue;
|
|
40
|
+
if ((0, exports.parseNumberStoredAsText)(text) !== undefined)
|
|
41
|
+
return "numberStoredAsText";
|
|
42
|
+
return undefined;
|
|
43
|
+
};
|
|
44
|
+
exports.getErrorCheckKind = getErrorCheckKind;
|
|
45
|
+
var ERROR_TITLES = {
|
|
46
|
+
"#VALUE!": "Error in Value",
|
|
47
|
+
"#DIV/0!": "Divide by Zero Error",
|
|
48
|
+
"#N/A": "Value Not Available Error",
|
|
49
|
+
"#NAME?": "Invalid Name Error",
|
|
50
|
+
"#NULL!": "Null Error",
|
|
51
|
+
"#NUM!": "Invalid Number Error",
|
|
52
|
+
"#REF!": "Invalid Cell Reference Error",
|
|
53
|
+
"#SPILL!": "Spill Range Isn't Blank",
|
|
54
|
+
"#CALC!": "Calculation Error",
|
|
55
|
+
};
|
|
56
|
+
/** The menu's heading, as Excel words it. */
|
|
57
|
+
var getErrorCheckTitle = function (kind, errorName) {
|
|
58
|
+
return kind === "numberStoredAsText"
|
|
59
|
+
? "Number Stored as Text"
|
|
60
|
+
: (errorName && ERROR_TITLES[errorName]) || "Error in Formula";
|
|
61
|
+
};
|
|
62
|
+
exports.getErrorCheckTitle = getErrorCheckTitle;
|
|
63
|
+
/** Excel's own help pages: hiding error values and error indicators, and the rule options. */
|
|
64
|
+
exports.ERROR_CHECKING_HELP_URL = "https://support.microsoft.com/en-us/office/hide-error-values-and-error-indicators-in-cells-d171b96e-8fb4-4863-a1ba-b64557474439";
|
|
65
|
+
var ERROR_HELP_URLS = {
|
|
66
|
+
"#VALUE!": "https://support.microsoft.com/en-us/office/how-to-correct-a-value-error-15e1b616-fbf2-4147-9c0b-0a11a20e409e",
|
|
67
|
+
"#NAME?": "https://support.microsoft.com/en-us/office/how-to-correct-a-name-error-b6d54e31-a743-4d7d-9b61-40002a7b4286",
|
|
68
|
+
"#NUM!": "https://support.microsoft.com/en-us/office/how-to-correct-a-num-error-f5193bfc-4400-43f4-88c4-8e1dcca0428b",
|
|
69
|
+
"#SPILL!": "https://support.microsoft.com/en-us/office/how-to-correct-a-spill-error-ffe0f555-b479-4a17-a6e2-ef9cc9ad4023",
|
|
70
|
+
};
|
|
71
|
+
/** "Help on this Error": Excel's article for the error, else the error-indicators article. */
|
|
72
|
+
var getErrorHelpUrl = function (kind, errorName) {
|
|
73
|
+
return (kind === "evalError" && errorName && ERROR_HELP_URLS[errorName]) ||
|
|
74
|
+
exports.ERROR_CHECKING_HELP_URL;
|
|
75
|
+
};
|
|
76
|
+
exports.getErrorHelpUrl = getErrorHelpUrl;
|
|
77
|
+
var inRange = function (range, rowIndex, columnIndex) {
|
|
78
|
+
return rowIndex >= range.startRowIndex &&
|
|
79
|
+
rowIndex <= range.endRowIndex &&
|
|
80
|
+
columnIndex >= range.startColumnIndex &&
|
|
81
|
+
columnIndex <= range.endColumnIndex;
|
|
82
|
+
};
|
|
83
|
+
/** Has the user ignored this rule for this cell ("Ignore Error", or the file's `<ignoredErrors>`)? */
|
|
84
|
+
var isErrorIgnored = function (ignoredErrors, rowIndex, columnIndex, kind) {
|
|
85
|
+
return !!(ignoredErrors === null || ignoredErrors === void 0 ? void 0 : ignoredErrors.some(function (entry) {
|
|
86
|
+
return entry[kind] === true &&
|
|
87
|
+
entry.ranges.some(function (range) { return inRange(range, rowIndex, columnIndex); });
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
exports.isErrorIgnored = isErrorIgnored;
|
|
91
|
+
/** The sheet's ignored-errors list after "Ignore Error" on `ranges` (one new entry, as Excel writes). */
|
|
92
|
+
var appendIgnoredError = function (ignoredErrors, ranges, kind) {
|
|
93
|
+
var _a;
|
|
94
|
+
return tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read((ignoredErrors !== null && ignoredErrors !== void 0 ? ignoredErrors : [])), false), [
|
|
95
|
+
(_a = { ranges: ranges.map(function (range) { return (tslib_1.__assign({}, range)); }) }, _a[kind] = true, _a),
|
|
96
|
+
], false);
|
|
97
|
+
};
|
|
98
|
+
exports.appendIgnoredError = appendIgnoredError;
|
|
99
|
+
/**
|
|
100
|
+
* The numbers stored as text inside `ranges`, as runs of adjacent cells per row — so Convert to
|
|
101
|
+
* Number writes each run in one call and never touches the cells between them. Rows / columns are
|
|
102
|
+
* clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
|
|
103
|
+
* only the used rows.
|
|
104
|
+
*/
|
|
105
|
+
var collectNumberStoredAsTextRuns = function (ranges, getUserEnteredValue, maxRow, maxColumn) {
|
|
106
|
+
var e_1, _a;
|
|
107
|
+
var _b;
|
|
108
|
+
var runs = [];
|
|
109
|
+
var seen = new Set();
|
|
110
|
+
try {
|
|
111
|
+
for (var ranges_1 = tslib_1.__values(ranges), ranges_1_1 = ranges_1.next(); !ranges_1_1.done; ranges_1_1 = ranges_1.next()) {
|
|
112
|
+
var range = ranges_1_1.value;
|
|
113
|
+
var endRow = Math.min(range.endRowIndex, maxRow);
|
|
114
|
+
var endColumn = Math.min(range.endColumnIndex, maxColumn);
|
|
115
|
+
for (var row = range.startRowIndex; row <= endRow; row++) {
|
|
116
|
+
var run = null;
|
|
117
|
+
for (var col = range.startColumnIndex; col <= endColumn; col++) {
|
|
118
|
+
var key = "".concat(row, ":").concat(col);
|
|
119
|
+
var uev = seen.has(key) ? null : getUserEnteredValue(row, col);
|
|
120
|
+
seen.add(key);
|
|
121
|
+
var kind = (0, exports.getErrorCheckKind)({ userEnteredValue: uev, errorValue: null });
|
|
122
|
+
var value = kind === "numberStoredAsText"
|
|
123
|
+
? (0, exports.parseNumberStoredAsText)((_b = uev === null || uev === void 0 ? void 0 : uev.sv) !== null && _b !== void 0 ? _b : uev === null || uev === void 0 ? void 0 : uev.stringValue)
|
|
124
|
+
: undefined;
|
|
125
|
+
if (value === undefined) {
|
|
126
|
+
run = null;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!run) {
|
|
130
|
+
run = { rowIndex: row, startColumnIndex: col, values: [] };
|
|
131
|
+
runs.push(run);
|
|
132
|
+
}
|
|
133
|
+
run.values.push(value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
139
|
+
finally {
|
|
140
|
+
try {
|
|
141
|
+
if (ranges_1_1 && !ranges_1_1.done && (_a = ranges_1.return)) _a.call(ranges_1);
|
|
142
|
+
}
|
|
143
|
+
finally { if (e_1) throw e_1.error; }
|
|
144
|
+
}
|
|
145
|
+
return runs;
|
|
146
|
+
};
|
|
147
|
+
exports.collectNumberStoredAsTextRuns = collectNumberStoredAsTextRuns;
|
|
148
|
+
/**
|
|
149
|
+
* Run one of the error-checking smart tag's menu items. Convert to Number and Ignore Error act on
|
|
150
|
+
* every selected cell, as Excel does: Convert to Number rewrites each number stored as text as its
|
|
151
|
+
* number — one `onChangeBatch` per run of adjacent cells, all inside one `batchHistory`, so it is a
|
|
152
|
+
* single undo step and syncs as ordinary value writes; Ignore Error appends the selection to the
|
|
153
|
+
* sheet's `ignoredErrors` (persisted, xlsx `<ignoredErrors>`).
|
|
154
|
+
*/
|
|
155
|
+
var runErrorCheckOption = function (option, context) {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
var sheetId = context.sheetId, kind = context.kind, ranges = context.ranges;
|
|
158
|
+
switch (option) {
|
|
159
|
+
case "convertToNumber": {
|
|
160
|
+
var runs_1 = (0, exports.collectNumberStoredAsTextRuns)(ranges, context.getUserEnteredValue, context.maxRow, context.maxColumn);
|
|
161
|
+
if (!runs_1.length)
|
|
162
|
+
return;
|
|
163
|
+
var write = function () {
|
|
164
|
+
var e_2, _a;
|
|
165
|
+
var _b;
|
|
166
|
+
try {
|
|
167
|
+
for (var runs_2 = tslib_1.__values(runs_1), runs_2_1 = runs_2.next(); !runs_2_1.done; runs_2_1 = runs_2.next()) {
|
|
168
|
+
var run = runs_2_1.value;
|
|
169
|
+
(_b = context.onChangeBatch) === null || _b === void 0 ? void 0 : _b.call(context, sheetId, {
|
|
170
|
+
startRowIndex: run.rowIndex,
|
|
171
|
+
endRowIndex: run.rowIndex,
|
|
172
|
+
startColumnIndex: run.startColumnIndex,
|
|
173
|
+
endColumnIndex: run.startColumnIndex + run.values.length - 1,
|
|
174
|
+
}, [run.values]);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
178
|
+
finally {
|
|
179
|
+
try {
|
|
180
|
+
if (runs_2_1 && !runs_2_1.done && (_a = runs_2.return)) _a.call(runs_2);
|
|
181
|
+
}
|
|
182
|
+
finally { if (e_2) throw e_2.error; }
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
if (context.batchHistory)
|
|
186
|
+
context.batchHistory(write);
|
|
187
|
+
else
|
|
188
|
+
write();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
case "ignore":
|
|
192
|
+
(_a = context.onUpdateSheet) === null || _a === void 0 ? void 0 : _a.call(context, sheetId, {
|
|
193
|
+
ignoredErrors: (0, exports.appendIgnoredError)((_b = context.getIgnoredErrors) === null || _b === void 0 ? void 0 : _b.call(context, sheetId), ranges, kind),
|
|
194
|
+
});
|
|
195
|
+
return;
|
|
196
|
+
case "editInFormulaBar":
|
|
197
|
+
context.editInFormulaBar();
|
|
198
|
+
return;
|
|
199
|
+
case "help":
|
|
200
|
+
context.openUrl((0, exports.getErrorHelpUrl)(kind, context.errorName));
|
|
201
|
+
return;
|
|
202
|
+
case "options":
|
|
203
|
+
context.openUrl(exports.ERROR_CHECKING_HELP_URL);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
exports.runErrorCheckOption = runErrorCheckOption;
|
|
@@ -7,8 +7,14 @@ export declare const MOVE_OVERWRITE_PROMPT = "There's already data here. Do you
|
|
|
7
7
|
* destination cell OUTSIDE the source block holds a value. Cells the block itself
|
|
8
8
|
* currently occupies are never "data here" — they leave with the move — so an
|
|
9
9
|
* overlapping drag one cell over prompts only for the newly covered strip. An
|
|
10
|
-
* empty destination never prompts; Shift+drag (insert)
|
|
11
|
-
*
|
|
10
|
+
* empty destination never prompts; Shift+drag (insert) never reaches this check and
|
|
11
|
+
* Ctrl+drag (copy) uses {@link needsCopyOverwritePrompt}.
|
|
12
12
|
*/
|
|
13
13
|
export declare const needsOverwritePrompt: (from: GridRange, to: GridRange, hasValue: (rowIndex: number, columnIndex: number) => boolean) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a Ctrl+drag (⌥+drag on macOS) COPY onto `to` needs the same prompt: any
|
|
16
|
+
* destination cell holding a value counts — a copy leaves the source in place, so
|
|
17
|
+
* source cells the copy lands on are replaced too.
|
|
18
|
+
*/
|
|
19
|
+
export declare const needsCopyOverwritePrompt: (to: GridRange, hasValue: (rowIndex: number, columnIndex: number) => boolean) => boolean;
|
|
14
20
|
//# sourceMappingURL=move-overwrite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-overwrite.d.ts","sourceRoot":"","sources":["../../../api/move-overwrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,0DACuB,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,SAAS,EACf,IAAI,SAAS,EACb,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,KAC3D,OAkBF,CAAC"}
|
|
1
|
+
{"version":3,"file":"move-overwrite.d.ts","sourceRoot":"","sources":["../../../api/move-overwrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,0DACuB,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,SAAS,EACf,IAAI,SAAS,EACb,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,KAC3D,OAkBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,IAAI,SAAS,EACb,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,KAC3D,OAaF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.needsOverwritePrompt = exports.MOVE_OVERWRITE_PROMPT = void 0;
|
|
3
|
+
exports.needsCopyOverwritePrompt = exports.needsOverwritePrompt = exports.MOVE_OVERWRITE_PROMPT = void 0;
|
|
4
4
|
/** Excel's prompt before a plain drag-move overwrites non-empty destination cells. */
|
|
5
5
|
exports.MOVE_OVERWRITE_PROMPT = "There's already data here. Do you want to replace it?";
|
|
6
6
|
/**
|
|
@@ -9,8 +9,8 @@ exports.MOVE_OVERWRITE_PROMPT = "There's already data here. Do you want to repla
|
|
|
9
9
|
* destination cell OUTSIDE the source block holds a value. Cells the block itself
|
|
10
10
|
* currently occupies are never "data here" — they leave with the move — so an
|
|
11
11
|
* overlapping drag one cell over prompts only for the newly covered strip. An
|
|
12
|
-
* empty destination never prompts; Shift+drag (insert)
|
|
13
|
-
*
|
|
12
|
+
* empty destination never prompts; Shift+drag (insert) never reaches this check and
|
|
13
|
+
* Ctrl+drag (copy) uses {@link needsCopyOverwritePrompt}.
|
|
14
14
|
*/
|
|
15
15
|
var needsOverwritePrompt = function (from, to, hasValue) {
|
|
16
16
|
for (var rowIndex = to.startRowIndex; rowIndex <= to.endRowIndex; rowIndex++) {
|
|
@@ -27,3 +27,19 @@ var needsOverwritePrompt = function (from, to, hasValue) {
|
|
|
27
27
|
return false;
|
|
28
28
|
};
|
|
29
29
|
exports.needsOverwritePrompt = needsOverwritePrompt;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a Ctrl+drag (⌥+drag on macOS) COPY onto `to` needs the same prompt: any
|
|
32
|
+
* destination cell holding a value counts — a copy leaves the source in place, so
|
|
33
|
+
* source cells the copy lands on are replaced too.
|
|
34
|
+
*/
|
|
35
|
+
var needsCopyOverwritePrompt = function (to, hasValue) {
|
|
36
|
+
for (var rowIndex = to.startRowIndex; rowIndex <= to.endRowIndex; rowIndex++) {
|
|
37
|
+
for (var columnIndex = to.startColumnIndex; columnIndex <= to.endColumnIndex; columnIndex++) {
|
|
38
|
+
if (hasValue(rowIndex, columnIndex)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
exports.needsCopyOverwritePrompt = needsCopyOverwritePrompt;
|
|
@@ -8,7 +8,7 @@ import type { SheetRange, TableView } from "../types";
|
|
|
8
8
|
* @param isActiveCell
|
|
9
9
|
* @param isSelection
|
|
10
10
|
*/
|
|
11
|
-
export declare const getSelectionStrokeStyle: (formulaMode: boolean, isFill: boolean, isActiveCell: boolean, emptySelections: boolean) => "
|
|
11
|
+
export declare const getSelectionStrokeStyle: (formulaMode: boolean, isFill: boolean, isActiveCell: boolean, emptySelections: boolean) => "solid" | "dashed";
|
|
12
12
|
export type SelectionStrokeOptions = {
|
|
13
13
|
/** Border width of a range selection outside formula mode. Default `1`. */
|
|
14
14
|
selectionStrokeWidth?: number;
|
|
@@ -37,7 +37,7 @@ export declare const getSelectionStrokeWidth: (formulaMode: boolean, isFill: boo
|
|
|
37
37
|
* @param isFill
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
|
-
export declare const getSelectionFillOpacity: (formulaMode: boolean, isFill: boolean) =>
|
|
40
|
+
export declare const getSelectionFillOpacity: (formulaMode: boolean, isFill: boolean) => 0 | 1 | 0.2;
|
|
41
41
|
/**
|
|
42
42
|
* Get background color of selection
|
|
43
43
|
* @param formulaMode
|