@xlcalc/vue 0.21.2 → 0.23.1

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +7 -2
  3. package/dist/components/CfDialogs.vue.d.ts +3 -0
  4. package/dist/components/CfManager.vue.d.ts +3 -0
  5. package/dist/components/CfPreview.vue.d.ts +9 -0
  6. package/dist/components/CfQuickDialog.vue.d.ts +3 -0
  7. package/dist/components/CfRuleDialog.vue.d.ts +3 -0
  8. package/dist/components/CfStyleDialog.vue.d.ts +15 -0
  9. package/dist/components/CfValuesFields.vue.d.ts +9 -0
  10. package/dist/components/DialogShell.vue.d.ts +1 -1
  11. package/dist/components/FunctionList.vue.d.ts +2 -1
  12. package/dist/components/GoToDialog.vue.d.ts +3 -0
  13. package/dist/components/LinkDialog.vue.d.ts +3 -0
  14. package/dist/components/NameBox.vue.d.ts +3 -0
  15. package/dist/components/NameDialogs.vue.d.ts +3 -0
  16. package/dist/components/NoteBox.vue.d.ts +3 -0
  17. package/dist/components/SheetToolbar.vue.d.ts +7 -4
  18. package/dist/components/SheetView.vue.d.ts +11 -4
  19. package/dist/components/SpellingDialog.vue.d.ts +3 -0
  20. package/dist/components/SymbolDialog.vue.d.ts +3 -0
  21. package/dist/components/TableDialog.vue.d.ts +3 -0
  22. package/dist/components/ToolbarBox.vue.d.ts +31 -0
  23. package/dist/components/TraceArrows.vue.d.ts +3 -0
  24. package/dist/components/ValidationDialog.vue.d.ts +3 -0
  25. package/dist/components/WatchWindow.vue.d.ts +3 -0
  26. package/dist/components/ZoomBar.vue.d.ts +3 -0
  27. package/dist/components/ZoomDialog.vue.d.ts +3 -0
  28. package/dist/components/icons.d.ts +1 -0
  29. package/dist/components/name-icons.d.ts +1 -0
  30. package/dist/components/toolbar-icons.d.ts +16 -0
  31. package/dist/contract/conditional.d.ts +16 -0
  32. package/dist/contract/memory.d.ts +5 -0
  33. package/dist/contract/messages.d.ts +260 -1
  34. package/dist/contract/source.d.ts +41 -0
  35. package/dist/contract/view.d.ts +117 -2
  36. package/dist/contract/workbook.d.ts +73 -0
  37. package/dist/contract.d.ts +4 -2
  38. package/dist/core/autocomplete.d.ts +9 -1
  39. package/dist/core/autosum.d.ts +11 -0
  40. package/dist/core/cell-style.d.ts +5 -0
  41. package/dist/core/cell-view.d.ts +2 -0
  42. package/dist/core/cf-commands.d.ts +70 -0
  43. package/dist/core/cf-describe.d.ts +4 -0
  44. package/dist/core/cf-draft.d.ts +114 -0
  45. package/dist/core/cf-formula.d.ts +30 -0
  46. package/dist/core/cf-presets.d.ts +33 -0
  47. package/dist/core/cf-ranges.d.ts +22 -0
  48. package/dist/core/commands.d.ts +4 -2
  49. package/dist/core/editing.d.ts +6 -1
  50. package/dist/core/extras.d.ts +22 -0
  51. package/dist/core/fill.d.ts +3 -0
  52. package/dist/core/formula-view.d.ts +10 -0
  53. package/dist/core/geometry.d.ts +6 -0
  54. package/dist/core/goto.d.ts +24 -0
  55. package/dist/core/links.d.ts +105 -0
  56. package/dist/core/menu.d.ts +8 -0
  57. package/dist/core/name-dialogs.d.ts +63 -0
  58. package/dist/core/names.d.ts +33 -0
  59. package/dist/core/navigation.d.ts +6 -0
  60. package/dist/core/notes.d.ts +44 -0
  61. package/dist/core/place.d.ts +10 -0
  62. package/dist/core/range-read.d.ts +11 -0
  63. package/dist/core/sheet.d.ts +337 -4
  64. package/dist/core/spell-check.d.ts +54 -0
  65. package/dist/core/state.d.ts +9 -0
  66. package/dist/core/tables.d.ts +63 -0
  67. package/dist/core/trace.d.ts +26 -0
  68. package/dist/core/validation-dialog.d.ts +33 -0
  69. package/dist/core/validation.d.ts +17 -3
  70. package/dist/core/viewport.d.ts +12 -0
  71. package/dist/core/watch.d.ts +35 -0
  72. package/dist/core/windows.d.ts +2 -0
  73. package/dist/core/zoom.d.ts +44 -0
  74. package/dist/format-cells.d.ts +0 -6
  75. package/dist/formula-shift.d.ts +3 -0
  76. package/dist/index.js +12033 -4565
  77. package/dist/local/types.d.ts +4 -1
  78. package/dist/local/workbook.d.ts +25 -0
  79. package/dist/local.js +556 -277
  80. package/dist/memory-workbook.d.ts +21 -0
  81. package/dist/messages-conditional.d.ts +3 -0
  82. package/dist/rect.d.ts +2 -0
  83. package/dist/{ru-RU-BVeg6JGM.js → ru-RU-CzebvM-s.js} +19 -2
  84. package/dist/spelling.d.ts +6 -0
  85. package/dist/style.css +1 -1
  86. package/dist/symbols.d.ts +23 -0
  87. package/dist/toolbar.d.ts +53 -1
  88. package/dist/{typed-entry-2l9Ay-hV.js → typed-entry-3r1pEbc9.js} +4546 -4453
  89. package/dist/validation-rules.d.ts +95 -0
  90. package/docs/api.md +91 -10
  91. package/docs/autocomplete.md +3 -3
  92. package/docs/checks.md +1 -1
  93. package/docs/clipboard.md +1 -1
  94. package/docs/conditional-formatting.md +135 -0
  95. package/docs/editing.md +50 -1
  96. package/docs/go-to-and-symbol.md +37 -0
  97. package/docs/links-notes.md +36 -0
  98. package/docs/local.md +1 -1
  99. package/docs/names.md +62 -0
  100. package/docs/tables.md +40 -0
  101. package/docs/toolbar.md +6 -2
  102. package/docs/validation.md +47 -0
  103. package/docs/view.md +104 -1
  104. package/package.json +2 -2
@@ -93,6 +93,8 @@ interface CellViewDeps {
93
93
  hostLinks: () => boolean;
94
94
  /** List mode's `openRows`: the first column's cells open their rows. */
95
95
  openRows: () => boolean;
96
+ /** What a cell shows under Excel's Show Formulas. */
97
+ formulaText: (data: CellData) => string;
96
98
  }
97
99
  export declare function useCellView(s: SheetState, geo: Geometry, v: Viewport, w: Windows, sel: Selection, f: Formula, nav: Navigation, ed: Editing, deps: CellViewDeps): {
98
100
  spanOf: (r: number, c: number) => MergeSpan | null | undefined;
@@ -0,0 +1,70 @@
1
+ import type { ConditionalFormat, ConditionalStyle, IconSetName, Locale, ScanOptions } from 'xlcalc/contract';
2
+ import type { ClearRulesFrom, ColorScalePreset, DataBarColor, QuickRule } from '../contract/conditional.js';
3
+ import type { EditOutcome } from '../contract/source.js';
4
+ import { type QuickInput } from './cf-presets.js';
5
+ import type { Editing } from './editing.js';
6
+ import type { Selection } from './selection.js';
7
+ import type { SheetState } from './state.js';
8
+ import type { Windows } from './windows.js';
9
+ /** Where a dialog's rule goes: the sheet, its ranges, and the active cell that typed formulas are relative to, as in Excel. */
10
+ export interface RuleTarget {
11
+ sheet: string;
12
+ ranges: string[];
13
+ active: {
14
+ row: number;
15
+ col: number;
16
+ };
17
+ }
18
+ /** The New or Edit Formatting Rule dialog: its target, the rule edited (null for a new one), and what OK does with the rule. */
19
+ export interface RuleDialog extends RuleTarget {
20
+ base: ConditionalFormat | null;
21
+ done: (rule: ConditionalFormat) => void;
22
+ }
23
+ /** A rule's Format Cells: the format it opens with, what OK does with the new one, and what Cancel does. */
24
+ export interface StyleDialog {
25
+ style: ConditionalStyle;
26
+ done: (style: ConditionalStyle) => void;
27
+ cancel?: () => void;
28
+ }
29
+ /** The Rules Manager: the sheet, the selection it lists rules for, and the sheet's rules once read. */
30
+ export interface ManagerState extends RuleTarget {
31
+ rules: ConditionalFormat[] | null;
32
+ }
33
+ export interface ConditionalDeps {
34
+ notify: (text: string) => void;
35
+ /** How the workbook's formula text is parsed (its locale); null while the locale loads. */
36
+ scan: () => ScanOptions | null;
37
+ }
38
+ export declare function useConditional(s: SheetState, sel: Selection, w: Windows, ed: Editing, deps: ConditionalDeps): {
39
+ api: {
40
+ quickRule: (kind: QuickRule) => boolean;
41
+ dataBars: (color: DataBarColor, fill?: "gradient" | "solid") => Promise<EditOutcome | null>;
42
+ colorScale: (preset: ColorScalePreset) => Promise<EditOutcome | null>;
43
+ iconSet: (icons: IconSetName) => Promise<EditOutcome | null>;
44
+ clearRules: (from: ClearRulesFrom) => Promise<EditOutcome | null>;
45
+ newRule: () => boolean;
46
+ manageRules: () => boolean;
47
+ };
48
+ quick: import("vue").ShallowRef<(RuleTarget & {
49
+ kind: QuickRule;
50
+ }) | null, (RuleTarget & {
51
+ kind: QuickRule;
52
+ }) | null>;
53
+ rule: import("vue").ShallowRef<RuleDialog | null, RuleDialog | null>;
54
+ style: import("vue").ShallowRef<StyleDialog | null, StyleDialog | null>;
55
+ manager: import("vue").ShallowRef<ManagerState | null, ManagerState | null>;
56
+ locale: () => Locale | undefined;
57
+ stored: (t: RuleTarget, ranges?: string[]) => (formula: string) => string;
58
+ shown: (t: RuleTarget, ranges: string[]) => (formula: string) => string;
59
+ activeAddress: (t: RuleTarget) => string;
60
+ quickOk: (q: QuickInput) => void;
61
+ quickClose: () => void;
62
+ openRule: (d: RuleDialog) => void;
63
+ ruleClose: () => void;
64
+ openStyle: (d: StyleDialog) => StyleDialog;
65
+ styleClose: (made: ConditionalStyle | null) => void;
66
+ managerWrite: (next: ConditionalFormat[], close: boolean) => Promise<void>;
67
+ managerClose: () => void;
68
+ closeAll: () => void;
69
+ };
70
+ export type Conditional = ReturnType<typeof useConditional>;
@@ -0,0 +1,4 @@
1
+ import type { ConditionalFormat } from 'xlcalc/contract';
2
+ import type { SheetMessages } from '../contract/messages.js';
3
+ /** The Rule column's text for a rule; `shown` gives a formula relative to the active cell. */
4
+ export declare function describeRule(rule: ConditionalFormat, m: SheetMessages, shown: (formula: string) => string): string;
@@ -0,0 +1,114 @@
1
+ import type { ConditionalFormat, ConditionalStyle, ConditionalValue, IconSetName, Locale, TimePeriodFormat, TextFormat, CellIsFormat } from 'xlcalc/contract';
2
+ import type { Entry } from '../entry.js';
3
+ export type RuleKind = 'values' | 'contain' | 'rank' | 'average' | 'unique' | 'formula';
4
+ /** The rule types in the order of Excel's list. */
5
+ export declare const RULE_KINDS: readonly RuleKind[];
6
+ export type ValuesStyle = 'scale2' | 'scale3' | 'dataBar' | 'iconSet';
7
+ export declare const VALUES_STYLES: readonly ValuesStyle[];
8
+ export type ContainKind = 'cellValue' | 'text' | 'dates' | 'blanks' | 'noBlanks' | 'errors' | 'noErrors';
9
+ export declare const CONTAIN_KINDS: readonly ContainKind[];
10
+ export type Operator = CellIsFormat['operator'];
11
+ export declare const OPERATORS: readonly Operator[];
12
+ export type TextOp = TextFormat['type'];
13
+ export declare const TEXT_OPS: readonly TextOp[];
14
+ export type Period = TimePeriodFormat['period'];
15
+ /** The periods in the order of Excel's list. */
16
+ export declare const PERIODS: readonly Period[];
17
+ export type AverageKind = 'above' | 'below' | 'equalAbove' | 'equalBelow' | 'std1Above' | 'std2Above' | 'std3Above' | 'std1Below' | 'std2Below' | 'std3Below';
18
+ export declare const AVERAGE_KINDS: readonly AverageKind[];
19
+ export type ValueType = ConditionalValue['type'];
20
+ /** The threshold types each box offers: a scale's lowest and highest point, its midpoint, a data bar's bounds, an icon's threshold. */
21
+ export declare const LOW_TYPES: readonly ValueType[];
22
+ export declare const MID_TYPES: readonly ValueType[];
23
+ export declare const HIGH_TYPES: readonly ValueType[];
24
+ export declare const BAR_LOW_TYPES: readonly ValueType[];
25
+ export declare const BAR_HIGH_TYPES: readonly ValueType[];
26
+ export declare const ICON_TYPES: readonly ValueType[];
27
+ /** Excel's icon sets in the order of its Icon Style list. */
28
+ export declare const ICON_SETS: readonly IconSetName[];
29
+ export interface PointDraft {
30
+ type: ValueType;
31
+ /** The box's text: a number, or a formula after `=`. */
32
+ value: string;
33
+ color: string;
34
+ }
35
+ export interface IconPointDraft {
36
+ gte: boolean;
37
+ type: ValueType;
38
+ value: string;
39
+ }
40
+ /** The dialog's inputs for every rule type, so switching types keeps what was typed. */
41
+ export interface RuleDraft {
42
+ kind: RuleKind;
43
+ values: ValuesStyle;
44
+ scale2: PointDraft[];
45
+ scale3: PointDraft[];
46
+ barMin: PointDraft;
47
+ barMax: PointDraft;
48
+ barColor: string;
49
+ barGradient: boolean;
50
+ barBorder: boolean;
51
+ barBorderColor: string;
52
+ barOnly: boolean;
53
+ barDirection: 'context' | 'leftToRight' | 'rightToLeft';
54
+ iconSet: IconSetName;
55
+ iconReverse: boolean;
56
+ iconOnly: boolean;
57
+ /** The thresholds of the icons after the first, from the lowest. */
58
+ iconPoints: IconPointDraft[];
59
+ contain: ContainKind;
60
+ operator: Operator;
61
+ value1: string;
62
+ value2: string;
63
+ textOp: TextOp;
64
+ text: string;
65
+ period: Period;
66
+ top: boolean;
67
+ rank: string;
68
+ percent: boolean;
69
+ average: AverageKind;
70
+ unique: boolean;
71
+ formula: string;
72
+ style: ConditionalStyle;
73
+ }
74
+ /** A new rule's inputs, as Excel's dialog opens: a two-color scale from orange to yellow, the rest at Excel's defaults. */
75
+ export declare function newDraft(): RuleDraft;
76
+ /** A new set's thresholds, as Excel resets them when another icon style is picked. */
77
+ export declare function pickIconSet(d: RuleDraft, set: IconSetName): void;
78
+ /** The inputs as an existing rule fills them; `shown` gives a formula as the dialog shows it (relative to the active cell). */
79
+ export declare function draftOf(rule: ConditionalFormat, shown: (formula: string) => string): RuleDraft;
80
+ /** Why OK cannot write the rule: a box without a value, a formula that does not parse, a relative threshold, a number out of range. */
81
+ export type DraftError = {
82
+ key: 'value';
83
+ } | {
84
+ key: 'formula';
85
+ message?: string;
86
+ } | {
87
+ key: 'relative';
88
+ } | {
89
+ key: 'percent';
90
+ } | {
91
+ key: 'rank';
92
+ max: number;
93
+ };
94
+ export type DraftResult = {
95
+ ok: true;
96
+ rule: ConditionalFormat;
97
+ } | {
98
+ ok: false;
99
+ error: DraftError;
100
+ };
101
+ /** What OK needs besides the inputs: the rule's ranges, the locale, `xlcalc/entry`, and how a typed formula is written for the rule's first cell. */
102
+ export interface DraftContext {
103
+ ranges: string[];
104
+ locale: Locale | undefined;
105
+ entry: Entry;
106
+ /** A formula typed relative to the active cell, rewritten for the rule's first cell. */
107
+ stored: (formula: string) => string;
108
+ /** The active cell's address, which a text rule's formula is typed for. */
109
+ active: string;
110
+ }
111
+ /** The rule OK writes from the inputs, or why it cannot; an edited rule keeps its Stop If True and the fields the dialog does not show. */
112
+ export declare function ruleOf(d: RuleDraft, base: ConditionalFormat | null, c: DraftContext): DraftResult;
113
+ /** A rule for the dialog's preview, from the inputs as they are: no thresholds checked, no formulas read. */
114
+ export declare function previewOf(d: RuleDraft): ConditionalFormat;
@@ -0,0 +1,30 @@
1
+ import type { ConditionalFormat, Locale, ScanOptions } from 'xlcalc/contract';
2
+ import type { Entry } from '../entry.js';
3
+ /** A formula with its relative references moved by `rows` and `cols`, as a copied formula's are; text in the scan's locale. */
4
+ export declare function shiftFormula(formula: string, rows: number, cols: number, scan: ScanOptions): string;
5
+ /** Whether a formula has a relative reference, which Excel does not allow in the thresholds of color scales, data bars and icon sets. */
6
+ export declare function hasRelative(formula: string, scan: ScanOptions): boolean;
7
+ /** A rule's own formulas (not its thresholds, which are absolute) passed through `fn`. */
8
+ export declare function mapRuleFormulas(rule: ConditionalFormat, fn: (f: string) => string): ConditionalFormat;
9
+ /** A rule with its formulas rewritten for a first cell `rows` and `cols` away, so each cell keeps its condition. */
10
+ export declare const shiftRule: (rule: ConditionalFormat, rows: number, cols: number, scan: ScanOptions) => ConditionalFormat;
11
+ /** What a value box gives: the formula to store (in the locale, without `=`), or the reason it cannot be stored. */
12
+ export type BoxFormula = {
13
+ ok: true;
14
+ formula: string;
15
+ } | {
16
+ ok: false;
17
+ message?: string;
18
+ };
19
+ /**
20
+ * A value box's text as Excel's dialogs store it: a formula after `=` (checked as a cell's), a number, date, time or
21
+ * percentage as its number, TRUE or FALSE, otherwise text in quotes. Empty text is refused.
22
+ */
23
+ export declare function boxFormula(text: string, entry: Entry, locale: Locale | undefined): BoxFormula;
24
+ /**
25
+ * The formula Excel writes for a text rule whose text is a reference or a formula (`=$A$1`), over the cell `at`: SEARCH for
26
+ * contains and does not contain, LEFT and RIGHT for begins and ends with. A text constant needs none: xlcalc writes Excel's.
27
+ */
28
+ export declare function textRuleFormula(type: 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith', ref: string, at: string, locale: Locale | undefined): string;
29
+ /** The scan options of a locale: stored text without one. */
30
+ export declare const scanOf: (locale: Locale | undefined) => ScanOptions;
@@ -0,0 +1,33 @@
1
+ import type { ColorScaleFormat, ConditionalFormat, ConditionalStyle, DataBarFormat, IconSetFormat, IconSetName, TimePeriodFormat } from 'xlcalc/contract';
2
+ import type { ColorScalePreset, DataBarColor, QuickRule } from '../contract/conditional.js';
3
+ /** The formats of the quick dialogs' "with" box, in its order; Custom Format follows them. */
4
+ export type StylePreset = 'lightRedDarkRed' | 'yellowDarkYellow' | 'greenDarkGreen' | 'lightRed' | 'redText' | 'redBorder';
5
+ export declare const STYLE_PRESETS: readonly StylePreset[];
6
+ /** The colors of Excel's Bad, Neutral and Good cell styles, which the presets use, as Excel writes them to a file's dxf. */
7
+ export declare const PRESET_STYLES: Readonly<Record<StylePreset, ConditionalStyle>>;
8
+ /** The colors of Excel's data bar gallery, the same for its gradient and solid fills. */
9
+ export declare const DATA_BAR_COLORS: Readonly<Record<DataBarColor, string>>;
10
+ /** Excel 2010's data bar: automatic bounds, red negative bars, a black axis; a gradient bar has a border of its own color. */
11
+ export declare function dataBarRule(ranges: string[], color: DataBarColor, fill?: 'gradient' | 'solid'): DataBarFormat;
12
+ /** The color scales of Excel's gallery, their colors from the lowest number to the highest. */
13
+ export declare const COLOR_SCALES: Readonly<Record<ColorScalePreset, readonly string[]>>;
14
+ /** A gallery color scale: the lowest and the highest number, and between them the 50th percentile of a three-color one. */
15
+ export declare function colorScaleRule(ranges: string[], preset: ColorScalePreset): ColorScaleFormat;
16
+ /** The number of icons in a set, which its name begins with. */
17
+ export declare const iconCount: (set: IconSetName) => number;
18
+ /** Excel's thresholds for an icon set: equal shares in percent (0, 33, 67 for three icons; 0, 25, 50, 75 for four; 0, 20, 40, 60, 80 for five). */
19
+ export declare function iconSetRule(ranges: string[], icons: IconSetName): IconSetFormat;
20
+ /** What a quick dialog was given: its boxes' formulas (stored, in the locale), the text or its formula, the period, Duplicate or Unique, the rank. */
21
+ export interface QuickInput {
22
+ formulas?: string[];
23
+ text?: string;
24
+ textFormula?: string;
25
+ period?: TimePeriodFormat['period'];
26
+ unique?: boolean;
27
+ rank?: number;
28
+ style: ConditionalStyle;
29
+ }
30
+ /** The rule a quick dialog writes over `ranges`. */
31
+ export declare function quickRuleOf(kind: QuickRule, ranges: string[], q: QuickInput): ConditionalFormat;
32
+ /** The quick rules whose dialog has a rank box, with its largest value: 1,000 items or 100 percent. */
33
+ export declare const rankMax: (kind: QuickRule) => number | null;
@@ -0,0 +1,22 @@
1
+ import type { CellRect, ConditionalFormat } from 'xlcalc/contract';
2
+ /** The rectangles of a rule's ranges; a range that does not parse is left out. */
3
+ export declare const rectsOf: (ranges: readonly string[]) => CellRect[];
4
+ /** The top-left cell of the rectangle enclosing the ranges, which a rule's formulas are written for; null without ranges. */
5
+ export declare function topLeftOf(ranges: readonly string[]): {
6
+ row: number;
7
+ col: number;
8
+ } | null;
9
+ /** Whether a rule applies to a cell of the rectangle, as the Rules Manager's Current Selection lists it. */
10
+ export declare const ruleMeets: (rule: ConditionalFormat, rect: CellRect) => boolean;
11
+ /** What is left of a rectangle with `cut` taken out: the rows above and below it across its width, then the parts to its left and right. */
12
+ export declare function subtract(r: CellRect, cut: CellRect): CellRect[];
13
+ /**
14
+ * Clear Rules from Selected Cells: each rule loses the cells of `cut` and keeps the rest of its ranges, and a rule with no
15
+ * cells left is removed. A rule whose first cell moved has its formulas rewritten for the new one (`shift`), so each cell
16
+ * left keeps the condition it had. Null when no rule applies to the selection.
17
+ */
18
+ export declare function clearRulesIn(rules: readonly ConditionalFormat[], cut: CellRect, shift: (rule: ConditionalFormat, rows: number, cols: number) => ConditionalFormat): ConditionalFormat[] | null;
19
+ /** The "Applies to" box's text: `=` and the ranges, separated by the locale's list separator (`,` in en-US, `;` in ru-RU). */
20
+ export declare const appliesText: (ranges: readonly string[], separator: string) => string;
21
+ /** The ranges typed into "Applies to", with or without `=` and `$`, on this sheet or naming it; null for anything else. */
22
+ export declare function parseApplies(text: string, separator: string, sheet: string): string[] | null;
@@ -1,5 +1,6 @@
1
1
  import type { CellStyle } from 'xlcalc/contract';
2
2
  import type { EditOutcome, LayoutChange, OutlineChange, SheetOp } from '../contract/source.js';
3
+ import type { TableOp } from '../contract/workbook.js';
3
4
  import type { Editing } from './editing.js';
4
5
  import type { FreezeMode, SheetFormatPatch } from '../contract/view.js';
5
6
  import type { Selection } from './selection.js';
@@ -29,7 +30,7 @@ export interface CommandsDeps {
29
30
  structured: () => void;
30
31
  }
31
32
  /** The source's methods that change the workbook beyond cells. */
32
- type ChangeMethod = 'format' | 'structure' | 'layout' | 'outline' | 'freeze';
33
+ type ChangeMethod = 'format' | 'structure' | 'layout' | 'outline' | 'freeze' | 'table';
33
34
  export declare function useCommands(s: SheetState, sel: Selection, ed: Editing, deps: CommandsDeps): {
34
35
  can: (name: ChangeMethod) => boolean;
35
36
  canRanges: import("vue").ComputedRef<boolean>;
@@ -37,8 +38,9 @@ export declare function useCommands(s: SheetState, sel: Selection, ed: Editing,
37
38
  structure: (op: SheetOp, endsCopy?: boolean) => Promise<EditOutcome | null>;
38
39
  layout: (edit: LayoutChange) => Promise<EditOutcome | null>;
39
40
  outline: (command: OutlineChange) => Promise<EditOutcome | null>;
41
+ table: (op: TableOp) => Promise<EditOutcome | null>;
40
42
  freeze: (mode?: FreezeMode) => Promise<EditOutcome | null>;
41
- fontKey: (e: KeyboardEvent) => boolean;
43
+ formatKey: (e: KeyboardEvent) => boolean;
42
44
  formatOpen: import("vue").Ref<boolean, boolean>;
43
45
  openFormat: () => boolean;
44
46
  closeFormat: () => void;
@@ -36,6 +36,9 @@ export interface EditingDeps {
36
36
  point?: (e: KeyboardEvent) => boolean;
37
37
  /** Excel's alert of a data validation rule for a rejected value, or the prompt for a formula that cannot be parsed, and the user's answer; without it the rejection goes to the message line. */
38
38
  alert?: (alert: SheetAlert) => Promise<AlertAnswer>;
39
+ /** The defined names visible on the sheet, in alphabetical order, and their order, for Formula AutoComplete; none without it. */
40
+ names?: () => readonly string[];
41
+ nameOrder?: (a: string, b: string) => number;
39
42
  }
40
43
  export declare function useEditing(s: SheetState, w: Windows, sel: Selection, f: Formula, editor: Ref<EditorState | null>, deps: EditingDeps): {
41
44
  pendingAt: (row: number, col: number) => string | null | undefined;
@@ -49,12 +52,14 @@ export declare function useEditing(s: SheetState, w: Windows, sel: Selection, f:
49
52
  place?: "cell" | "bar";
50
53
  caret?: number;
51
54
  caretEnd?: number;
55
+ focus?: boolean;
52
56
  }) => boolean;
53
57
  inputOf: () => HTMLTextAreaElement | null;
54
58
  focusEditor: () => void;
55
59
  insertFunction: (name: string) => void;
60
+ insertText: (piece: string) => boolean;
56
61
  ac: {
57
- items: import("vue").ShallowRef<readonly string[], readonly string[]>;
62
+ items: import("vue").ShallowRef<readonly import("./autocomplete.js").CompletionItem[], readonly import("./autocomplete.js").CompletionItem[]>;
58
63
  index: Ref<number, number>;
59
64
  open: import("vue").ComputedRef<boolean>;
60
65
  update: (text: string, caret: number | null) => void;
@@ -0,0 +1,22 @@
1
+ import type { CellRect } from 'xlcalc/contract';
2
+ import type { EditOutcome } from '../contract/source.js';
3
+ import type { ClearKind } from '../contract/workbook.js';
4
+ import type { Editing } from './editing.js';
5
+ import type { Selection } from './selection.js';
6
+ import type { SheetState } from './state.js';
7
+ import type { Windows } from './windows.js';
8
+ export interface ExtrasDeps {
9
+ notify: (text: string) => void;
10
+ /** A change succeeded that may have changed the cells' rules too (Clear All removes data validation). */
11
+ changed: () => void;
12
+ }
13
+ /** The source's methods for what cells hold beside their values. */
14
+ type ExtraMethod = 'clear' | 'link' | 'note';
15
+ export declare function useExtras(s: SheetState, sel: Selection, w: Windows, ed: Editing, deps: ExtrasDeps): {
16
+ method: <K extends ExtraMethod>(name: K) => NonNullable<import("../index.js").SheetSource[K]> | null;
17
+ change: (call: () => Promise<EditOutcome>, sheet: string, ranges: string[]) => Promise<EditOutcome>;
18
+ locked: (rect: CellRect | null) => boolean;
19
+ clear: (what: ClearKind) => Promise<EditOutcome | null>;
20
+ };
21
+ export type Extras = ReturnType<typeof useExtras>;
22
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { type Ref } from 'vue';
2
2
  import type { CellRect } from 'xlcalc/contract';
3
+ import type { EditOutcome } from '../contract/source.js';
3
4
  import type { Commands } from './commands.js';
4
5
  import type { Editing, EditorState } from './editing.js';
5
6
  import type { Geometry } from './geometry.js';
@@ -38,5 +39,7 @@ export declare function useFill(s: SheetState, geo: Geometry, v: Viewport, sel:
38
39
  onUp: (e: PointerEvent) => void;
39
40
  onCancel: () => void;
40
41
  autofill: () => Promise<void>;
42
+ fillFrom: (direction: "down" | "right") => Promise<EditOutcome | null>;
43
+ key: (e: KeyboardEvent) => boolean;
41
44
  };
42
45
  export type Fill = ReturnType<typeof useFill>;
@@ -0,0 +1,10 @@
1
+ import type { Formula } from './formula.js';
2
+ import type { SheetState } from './state.js';
3
+ import type { CellData } from './windows.js';
4
+ export declare function useFormulaView(s: SheetState, f: Formula): {
5
+ read: () => void;
6
+ show: (on?: boolean) => boolean;
7
+ key: (e: KeyboardEvent) => boolean;
8
+ textOf: (data: CellData) => string;
9
+ };
10
+ export type FormulaView = ReturnType<typeof useFormulaView>;
@@ -6,6 +6,8 @@ export declare const MAX_COL_PX = 900;
6
6
  export declare function colPx(width: number | null | undefined): number;
7
7
  /** Pixels back to the stored width, in whole points as the library stores them. */
8
8
  export declare const widthFromPx: (px: number) => number;
9
+ /** How much wider Excel draws columns under Show Formulas. */
10
+ export declare const FORMULA_VIEW_SCALE = 2;
9
11
  /** Points to pixels at 96 dpi. */
10
12
  export declare const rowPx: (pt: number) => number;
11
13
  /** A row dragged by its edge: down to 2 px, up to Excel's tallest row. */
@@ -29,6 +31,8 @@ interface GeometryInput {
29
31
  /** Row heights in pixels that differ from the default (0 hides a row): changed in place through `setHeights`, or replaced as a whole. */
30
32
  heights: ShallowRef<Map<number, number>>;
31
33
  defaultRowPx: Ref<number>;
34
+ /** Excel's Show Formulas: columns are drawn twice as wide, and the stored widths stay as they are. */
35
+ formulaView?: Readonly<Ref<boolean>>;
32
36
  /** The display filter in effect: another one is another order of rows. */
33
37
  visible: Readonly<Ref<unknown>>;
34
38
  /** The sheet row displayed at a display index (heights are the sheet rows') and back. */
@@ -38,6 +42,8 @@ interface GeometryInput {
38
42
  /** Offsets of columns and rows, and the item under an offset; rows are display indexes (`d`). */
39
43
  export declare function useGeometry(i: GeometryInput): {
40
44
  widthOf: (c: number) => number;
45
+ baseWidthOf: (c: number) => number;
46
+ widthScale: () => number;
41
47
  heightOf: (d: number) => number;
42
48
  offsets: import("vue").ComputedRef<Float64Array<ArrayBufferLike>>;
43
49
  setHeights: (rows: Iterable<readonly [number, number | undefined]>) => boolean;
@@ -0,0 +1,24 @@
1
+ import type { AlertAnswer, SheetAlert } from './validation.js';
2
+ import type { Names } from './names.js';
3
+ import type { Navigation } from './navigation.js';
4
+ import type { Selection } from './selection.js';
5
+ import type { SheetState } from './state.js';
6
+ /** How many locations the Go To list keeps, as Excel's does. */
7
+ export declare const GOTO_PLACES = 4;
8
+ /** A reference made absolute part by part, as Excel lists locations in Go To: `B2:D5` → `$B$2:$D$5`, `B:D` → `$B:$D`. */
9
+ export declare function absoluteRef(ref: string): string;
10
+ export interface GoToDeps {
11
+ ask: (alert: SheetAlert) => Promise<AlertAnswer>;
12
+ names: Names;
13
+ }
14
+ export declare function useGoTo(s: SheetState, sel: Selection, nav: Navigation, deps: GoToDeps): {
15
+ open: import("vue").Ref<boolean, boolean>;
16
+ places: import("vue").Ref<string[], string[]>;
17
+ items: import("vue").ComputedRef<string[]>;
18
+ jump: (text: string) => Promise<boolean>;
19
+ openGoTo: () => boolean;
20
+ go: (text: string) => Promise<boolean>;
21
+ close: () => void;
22
+ key: (e: KeyboardEvent) => boolean;
23
+ };
24
+ export type GoTo = ReturnType<typeof useGoTo>;
@@ -0,0 +1,105 @@
1
+ import type { SheetLinkEvent } from '../contract/view.js';
2
+ import type { SheetWindow } from '../contract/source.js';
3
+ import type { SheetLink } from '../contract/workbook.js';
4
+ import type { Editing } from './editing.js';
5
+ import type { Extras } from './extras.js';
6
+ import type { Formula } from './formula.js';
7
+ import type { MenuItem } from './menu.js';
8
+ import type { Selection } from './selection.js';
9
+ import type { SheetState } from './state.js';
10
+ import type { Windows } from './windows.js';
11
+ /** Excel's Link to: an address outside the workbook, or a place in it. */
12
+ export type LinkTab = 'file' | 'place';
13
+ /** A place in this document the dialog lists: a sheet, with the reference typed for it, or a defined name, which is the place itself. */
14
+ export interface LinkPlace {
15
+ key: string;
16
+ label: string;
17
+ }
18
+ /** The dialog's list under its headings: Cell Reference (the sheets) and Defined Names. */
19
+ export interface LinkPlaceGroup {
20
+ kind: 'sheets' | 'names';
21
+ label: string;
22
+ places: LinkPlace[];
23
+ }
24
+ /** The open dialog: what it links (the selection), its fields, and the link it edits (Edit Hyperlink). */
25
+ export interface LinkDraft {
26
+ sheet: string;
27
+ range: string;
28
+ cell: string;
29
+ /** The link of the active cell when there is one: the dialog is then Edit Hyperlink, with Remove Link. */
30
+ old: SheetLink | null;
31
+ tab: LinkTab;
32
+ /** Text to Display: editable for a single cell without a formula; `null` shows Excel's `<<Selection in Document>>`. */
33
+ text: string | null;
34
+ /** The cell's displayed text when the dialog opened: the text is written only when it changed. */
35
+ shown: string;
36
+ /** The text was typed in: until then, for an empty cell, it follows the address as Excel's does. */
37
+ textTyped: boolean;
38
+ address: string;
39
+ ref: string;
40
+ place: string;
41
+ tooltip: string;
42
+ error: string;
43
+ }
44
+ export interface LinksDeps {
45
+ notify: (text: string) => void;
46
+ /** Whether the selection is the active cell alone, or the merged range it is in. */
47
+ single: () => boolean;
48
+ /** Goes to a location or a defined name, as a click on a hyperlink does. */
49
+ goPlace: (text: string) => Promise<boolean>;
50
+ /** The workbook's defined names that refer to ranges, for Place in This Document. */
51
+ names: () => string[];
52
+ /** Whether the host opens links through `openLink`, and the event to it. */
53
+ hostLinks: () => boolean;
54
+ openLink: (link: SheetLinkEvent) => void;
55
+ }
56
+ export declare function useLinks(s: SheetState, sel: Selection, w: Windows, f: Formula, ed: Editing, extras: Extras, deps: LinksDeps): {
57
+ draft: import("vue").Ref<{
58
+ sheet: string;
59
+ range: string;
60
+ cell: string;
61
+ old: {
62
+ href?: string | undefined;
63
+ location?: string | undefined;
64
+ tooltip?: string | undefined;
65
+ } | null;
66
+ tab: LinkTab;
67
+ text: string | null;
68
+ shown: string;
69
+ textTyped: boolean;
70
+ address: string;
71
+ ref: string;
72
+ place: string;
73
+ tooltip: string;
74
+ error: string;
75
+ } | null, LinkDraft | {
76
+ sheet: string;
77
+ range: string;
78
+ cell: string;
79
+ old: {
80
+ href?: string | undefined;
81
+ location?: string | undefined;
82
+ tooltip?: string | undefined;
83
+ } | null;
84
+ tab: LinkTab;
85
+ text: string | null;
86
+ shown: string;
87
+ textTyped: boolean;
88
+ address: string;
89
+ ref: string;
90
+ place: string;
91
+ tooltip: string;
92
+ error: string;
93
+ } | null>;
94
+ available: import("vue").ComputedRef<boolean>;
95
+ places: import("vue").ComputedRef<LinkPlaceGroup[]>;
96
+ refOn: import("vue").ComputedRef<boolean>;
97
+ follow: () => void;
98
+ open: () => boolean;
99
+ close: () => void;
100
+ apply: () => Promise<void>;
101
+ remove: (range?: string) => Promise<void>;
102
+ openLink: (link: NonNullable<SheetWindow["links"]>[string], row: number, col: number, viaClick?: boolean) => boolean;
103
+ items: () => MenuItem[];
104
+ };
105
+ export type Links = ReturnType<typeof useLinks>;
@@ -56,6 +56,14 @@ export interface MenuDeps {
56
56
  explain: Explain;
57
57
  /** Whether the workbook freezes panes on the displayed sheet: the first freeze item is then Unfreeze Panes, as in Excel. */
58
58
  frozen: () => boolean;
59
+ /** Excel's Define Name in the cell menu: offered where names can be defined. */
60
+ defineName?: {
61
+ available: () => boolean;
62
+ run: () => void;
63
+ };
64
+ /** The cell menu's items for notes and for hyperlinks, which Excel lists before and after Define Name at the menu's end. */
65
+ cellNotes: () => MenuItem[];
66
+ cellLinks: () => MenuItem[];
59
67
  }
60
68
  export declare function useMenu(s: SheetState, sel: Selection, cmd: Commands, deps: MenuDeps): {
61
69
  open: import("vue").ShallowRef<OpenMenu | null, OpenMenu | null>;
@@ -0,0 +1,63 @@
1
+ import type { SheetName } from '../contract/workbook.js';
2
+ import { type Names } from './names.js';
3
+ import type { Selection } from './selection.js';
4
+ import type { SheetState } from './state.js';
5
+ /** The New Name or Edit Name dialog's fields: the name, its scope (a sheet's name, '' for the workbook) and Refers to, with `=`. */
6
+ export interface NameDraft {
7
+ /** The name being edited, by its key; null for a new one. */
8
+ editing: string | null;
9
+ name: string;
10
+ scope: string;
11
+ ref: string;
12
+ }
13
+ /** The Name Manager's state: the selected name by its key, and Refers to as edited in the box at the bottom (null: unchanged). */
14
+ export interface NameManagerState {
15
+ selected: string | null;
16
+ ref: string | null;
17
+ }
18
+ /** An alert over the dialogs: a refusal (OK), the question before a deletion (OK, Cancel), before closing with an edited reference (Yes, No). */
19
+ export interface NameAsk {
20
+ kind: 'refused' | 'delete' | 'save';
21
+ message: string;
22
+ }
23
+ export declare function useNameDialogs(s: SheetState, sel: Selection, names: Names, deps: {
24
+ editing: () => boolean;
25
+ }): {
26
+ draft: import("vue").Ref<{
27
+ editing: string | null;
28
+ name: string;
29
+ scope: string;
30
+ ref: string;
31
+ } | null, NameDraft | {
32
+ editing: string | null;
33
+ name: string;
34
+ scope: string;
35
+ ref: string;
36
+ } | null>;
37
+ manager: import("vue").Ref<{
38
+ selected: string | null;
39
+ ref: string | null;
40
+ } | null, NameManagerState | {
41
+ selected: string | null;
42
+ ref: string | null;
43
+ } | null>;
44
+ ask: import("vue").ShallowRef<NameAsk | null, NameAsk | null>;
45
+ answer: (yes: boolean) => void;
46
+ busy: import("vue").Ref<boolean, boolean>;
47
+ rows: import("vue").ComputedRef<SheetName[]>;
48
+ selected: import("vue").ComputedRef<SheetName | null>;
49
+ refText: import("vue").ComputedRef<string>;
50
+ refChanged: import("vue").ComputedRef<boolean>;
51
+ define: () => boolean;
52
+ openManager: () => boolean;
53
+ select: (n: SheetName) => void;
54
+ edit: () => void;
55
+ submit: () => Promise<void>;
56
+ closeDraft: () => void;
57
+ remove: () => Promise<void>;
58
+ editRef: (text: string) => void;
59
+ commitRef: () => Promise<boolean>;
60
+ cancelRef: () => void;
61
+ closeManager: () => Promise<void>;
62
+ };
63
+ export type NameDialogs = ReturnType<typeof useNameDialogs>;