@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
@@ -1,4 +1,6 @@
1
- export interface SheetMessages {
1
+ import type { ConditionalFormat, IconSetName } from 'xlcalc/contract';
2
+ import type { QuickRule } from './conditional.js';
3
+ export interface SheetMessages extends ConditionalMessages {
2
4
  back: string;
3
5
  backEmpty: string;
4
6
  address: string;
@@ -187,6 +189,11 @@ export interface SheetMessages {
187
189
  italic: string;
188
190
  underline: string;
189
191
  fontColor: string;
192
+ /** The Font and Font Size boxes, and Increase and Decrease Font Size. */
193
+ fontName: string;
194
+ fontSize: string;
195
+ fontSizeUp: string;
196
+ fontSizeDown: string;
190
197
  fillColor: string;
191
198
  pickColor: string;
192
199
  colorAuto: string;
@@ -199,8 +206,20 @@ export interface SheetMessages {
199
206
  alignLeft: string;
200
207
  alignCenter: string;
201
208
  alignRight: string;
209
+ alignTop: string;
210
+ alignMiddle: string;
211
+ alignBottom: string;
212
+ indentDecrease: string;
213
+ indentIncrease: string;
202
214
  wrapText: string;
203
215
  numberFormat: string;
216
+ /** Excel's Percent Style button, with its key. */
217
+ percentStyle: string;
218
+ /** Excel's Accounting Number Format, Comma Style, Increase Decimal and Decrease Decimal buttons. */
219
+ accountingStyle: string;
220
+ commaStyle: string;
221
+ decimalIncrease: string;
222
+ decimalDecrease: string;
204
223
  /** Excel's Format Cells dialog (`FormatDialog`): its tabs, inputs and the names of their options. */
205
224
  formatCells: string;
206
225
  formatCellsOpen: string;
@@ -257,4 +276,244 @@ export interface SheetMessages {
257
276
  mergeCells: string;
258
277
  unmergeCells: string;
259
278
  mergeWarning: string;
279
+ /** Excel's Go To dialog (F5, Ctrl+G): its title, the list's label, the Reference box, and its message for text that is not a reference. */
280
+ goToTitle: string;
281
+ goToList: string;
282
+ goToReference: string;
283
+ goToBad: string;
284
+ /** Excel's Symbol dialog: its title and tabs, the Subset box and its blocks, the recently used row, the Character code box, the Special Characters tab's names, Insert. */
285
+ symbolTitle: string;
286
+ symbolTab: (tab: 'symbols' | 'special') => string;
287
+ symbolSubsetLabel: string;
288
+ symbolSubset: (subset: SymbolSubset) => string;
289
+ symbolRecent: string;
290
+ symbolCode: string;
291
+ symbolCodeFrom: string;
292
+ symbolCharacter: string;
293
+ symbolSpecial: (character: SymbolSpecial) => string;
294
+ symbolInsert: string;
295
+ /** Defined names: the Name Box's list button, its messages for a typed name, the cell menu's Define Name, and a name in Formula AutoComplete. */
296
+ nameBoxList: string;
297
+ nameBoxBad: string;
298
+ nameNotRange: string;
299
+ menuDefineName: string;
300
+ nameItem: (name: string) => string;
301
+ /** Excel's New Name and Edit Name dialog and its fields; the scope that is not a sheet. */
302
+ nameNewTitle: string;
303
+ nameEditTitle: string;
304
+ nameLabel: string;
305
+ nameScope: string;
306
+ nameRefersTo: string;
307
+ nameWorkbook: string;
308
+ /** Excel's Name Manager: its title, buttons, the list's columns, Commit beside Refers to, and its questions before a deletion and before closing with an edited reference. */
309
+ nameManager: string;
310
+ nameNew: string;
311
+ nameEdit: string;
312
+ nameDelete: string;
313
+ nameColumn: (column: 'name' | 'refersTo' | 'scope') => string;
314
+ nameCommit: string;
315
+ nameDeleteAsk: (name: string) => string;
316
+ nameSaveAsk: string;
317
+ /** Excel's zoom on the status bar (Zoom Out, the slider, Zoom In, the percentage that opens the Zoom dialog), and the dialog's title, choices and limits. */
318
+ zoomOut: string;
319
+ zoomIn: string;
320
+ zoomSlider: string;
321
+ zoomLevel: string;
322
+ zoomTitle: string;
323
+ zoomFit: string;
324
+ zoomCustom: string;
325
+ zoomRange: string;
326
+ /** Excel's Watch Window: its title, Add Watch and Delete Watch, its columns, and the cap on the cells watched. */
327
+ watchTitle: string;
328
+ watchAdd: string;
329
+ watchDelete: string;
330
+ watchBook: string;
331
+ watchSheet: string;
332
+ watchName: string;
333
+ watchCell: string;
334
+ watchValue: string;
335
+ watchFormula: string;
336
+ watchTooMany: (max: number) => string;
337
+ /** Excel's Trace Dependents: the message when no formula refers to the active cell, and when the source could not be asked. */
338
+ traceNone: string;
339
+ traceFailed: string;
340
+ /** Excel's Create Table dialog, the range it refuses, the words a new table's and an unnamed column's names start with (`Table1`, `Column1`), and Convert to Range's question. */
341
+ tableCreate: string;
342
+ tableWhere: string;
343
+ tableHeaders: string;
344
+ tableRangeBad: string;
345
+ tableNamePrefix: string;
346
+ tableColumnPrefix: string;
347
+ tableConvert: string;
348
+ /** Excel's Spelling dialog: its title, boxes and buttons (Cancel is `cancel`), the message when the check is complete, and the one when it fails. */
349
+ spelling: string;
350
+ spellNotInDictionary: string;
351
+ spellSuggestions: string;
352
+ spellNoSuggestions: string;
353
+ spellIgnoreOnce: string;
354
+ spellIgnoreAll: string;
355
+ spellAdd: string;
356
+ spellChange: string;
357
+ spellChangeAll: string;
358
+ spellDone: string;
359
+ spellFailed: string;
360
+ /** Excel's hyperlink items in the cell menu and its Insert Hyperlink dialog (Edit Hyperlink on a cell with a link), with Excel's names. */
361
+ menuLink: string;
362
+ menuEditLink: string;
363
+ menuOpenLink: string;
364
+ menuRemoveLink: string;
365
+ linkInsertTitle: string;
366
+ linkEditTitle: string;
367
+ linkTo: string;
368
+ linkToFile: string;
369
+ linkToPlace: string;
370
+ linkText: string;
371
+ /** Text to Display over several cells or a formula, which the link does not change. */
372
+ linkSelection: string;
373
+ linkTip: string;
374
+ linkAddress: string;
375
+ linkRef: string;
376
+ linkPlaces: string;
377
+ linkCellReference: string;
378
+ linkDefinedNames: string;
379
+ linkRemove: string;
380
+ linkBadRef: string;
381
+ /** Excel's note items in the cell menu (New Note, Edit Note, Delete Note) and the note box's label. */
382
+ menuNewNote: string;
383
+ menuEditNote: string;
384
+ menuDeleteNote: string;
385
+ noteEditor: string;
386
+ /** Excel's Data Validation dialog: its title and tabs, the Settings tab's boxes by the rule's type and comparison, the Input Message and Error Alert tabs (the styles are `validationStyle`), Clear All, Excel's questions before it opens and its checks before OK. */
387
+ dataValidation: string;
388
+ dvTab: (tab: 'settings' | 'input' | 'error') => string;
389
+ dvCriteria: string;
390
+ dvAllow: string;
391
+ dvType: (type: 'any' | 'whole' | 'decimal' | 'list' | 'date' | 'time' | 'textLength' | 'custom') => string;
392
+ dvData: string;
393
+ dvOperator: (op: 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual') => string;
394
+ dvBox: (box: 'min' | 'max' | 'value' | 'length' | 'start' | 'end' | 'date' | 'startTime' | 'endTime' | 'time' | 'source' | 'formula') => string;
395
+ dvIgnoreBlank: string;
396
+ dvDropdown: string;
397
+ dvApplyAll: string;
398
+ dvShowPrompt: string;
399
+ dvPromptLead: string;
400
+ dvFieldTitle: string;
401
+ dvPromptText: string;
402
+ dvShowError: string;
403
+ dvErrorLead: string;
404
+ dvStyle: string;
405
+ dvErrorText: string;
406
+ dvClearAll: string;
407
+ dvMany: string;
408
+ dvExtend: string;
409
+ /** OK refused: an empty box, a box whose value is not one, a maximum below the minimum; with the boxes' names from `dvBox`. */
410
+ dvEmpty: (box: string) => string;
411
+ dvInvalid: (box: string) => string;
412
+ dvOrder: (min: string, max: string) => string;
260
413
  }
414
+ /** The Symbol dialog's Subset list: Unicode blocks by Excel's names (`basicLatin` is Basic Latin, `latin1` Latin-1 Supplement). */
415
+ export type SymbolSubset = 'basicLatin' | 'latin1' | 'latinExtA' | 'latinExtB' | 'ipa' | 'spacingModifiers' | 'combiningMarks' | 'greek' | 'cyrillic' | 'cyrillicSupplement' | 'phoneticExt' | 'latinExtAdditional' | 'greekExt' | 'punctuation' | 'superSub' | 'currency' | 'letterlike' | 'numberForms' | 'arrows' | 'math' | 'technical' | 'enclosed' | 'boxDrawing' | 'blocks' | 'geometric' | 'miscSymbols' | 'dingbats' | 'latinExtC' | 'presentationForms' | 'specials';
416
+ /** The characters of the Symbol dialog's Special Characters tab, in Excel's order. */
417
+ export type SymbolSpecial = 'emDash' | 'enDash' | 'nonBreakingHyphen' | 'optionalHyphen' | 'emSpace' | 'enSpace' | 'quarterEmSpace' | 'nonBreakingSpace' | 'copyright' | 'registered' | 'trademark' | 'section' | 'paragraph' | 'ellipsis' | 'singleOpeningQuote' | 'singleClosingQuote' | 'doubleOpeningQuote' | 'doubleClosingQuote' | 'noWidthOptionalBreak' | 'noWidthNonBreak';
418
+ type CfOperator = Extract<ConditionalFormat, {
419
+ type: 'cellIs';
420
+ }>['operator'];
421
+ type CfTextType = 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith';
422
+ type CfPeriod = Extract<ConditionalFormat, {
423
+ type: 'timePeriod';
424
+ }>['period'];
425
+ type CfValueType = 'min' | 'max' | 'num' | 'percent' | 'formula' | 'percentile' | 'autoMin' | 'autoMax';
426
+ /** Excel's conditional formatting dialogs: the quick rules' dialogs, the Rules Manager, New and Edit Formatting Rule, a rule's Format Cells. */
427
+ export interface ConditionalMessages {
428
+ /** A quick rule's dialog: its title, the label above its box, and the "with" box's formats, Custom Format last. */
429
+ cfQuickTitle: (kind: QuickRule) => string;
430
+ cfQuickLabel: (kind: QuickRule) => string;
431
+ cfWith: string;
432
+ cfAnd: string;
433
+ cfValuesWith: string;
434
+ cfForRange: string;
435
+ cfPreset: (preset: 'lightRedDarkRed' | 'yellowDarkYellow' | 'greenDarkGreen' | 'lightRed' | 'redText' | 'redBorder') => string;
436
+ cfCustomFormat: string;
437
+ cfPeriod: (period: CfPeriod) => string;
438
+ cfDuplicate: (unique: boolean) => string;
439
+ /** Why OK does not write the rule. */
440
+ cfValueMissing: string;
441
+ cfRankRange: (max: number) => string;
442
+ cfPercentRange: string;
443
+ cfRelative: string;
444
+ cfAppliesBad: string;
445
+ /** The Rules Manager: its list's choice, buttons, columns and the rules' descriptions. */
446
+ cfManager: string;
447
+ cfShowFor: string;
448
+ cfShowSelection: string;
449
+ cfShowSheet: string;
450
+ cfNewRule: string;
451
+ cfEditRule: string;
452
+ cfDeleteRule: string;
453
+ cfDuplicateRule: string;
454
+ cfMoveUp: string;
455
+ cfMoveDown: string;
456
+ cfColRule: string;
457
+ cfColFormat: string;
458
+ cfColApplies: string;
459
+ cfColStop: string;
460
+ cfApply: string;
461
+ cfLoading: string;
462
+ cfNoFormat: string;
463
+ cfSample: string;
464
+ cfDescCell: (operator: CfOperator, a: string, b?: string) => string;
465
+ cfDescFormula: (formula: string) => string;
466
+ cfDescText: (type: CfTextType, text: string) => string;
467
+ cfDescBlanks: (type: 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors') => string;
468
+ cfDescTop: (rank: number, percent: boolean, bottom: boolean) => string;
469
+ cfDescAverage: (below: boolean, equal: boolean, stdDev?: number) => string;
470
+ cfDescDuplicate: (unique: boolean) => string;
471
+ cfDescScale: string;
472
+ cfDescBar: string;
473
+ cfDescIcons: string;
474
+ /** New Formatting Rule and Edit Formatting Rule: the rule types and each one's inputs. */
475
+ cfNewTitle: string;
476
+ cfEditTitle: string;
477
+ cfSelectType: string;
478
+ cfType: (kind: 'values' | 'contain' | 'rank' | 'average' | 'unique' | 'formula') => string;
479
+ cfEditDescription: string;
480
+ cfFormatStyle: string;
481
+ cfStyleKind: (style: 'scale2' | 'scale3' | 'dataBar' | 'iconSet') => string;
482
+ cfPoint: (which: 'min' | 'mid' | 'max') => string;
483
+ cfTypeLabel: string;
484
+ cfValueLabel: string;
485
+ cfColorLabel: string;
486
+ cfValueType: (type: CfValueType) => string;
487
+ cfBarAppearance: string;
488
+ cfBarFill: (gradient: boolean) => string;
489
+ cfBarBorder: (on: boolean) => string;
490
+ cfShowBarOnly: string;
491
+ cfDirection: string;
492
+ cfDirectionKind: (d: 'context' | 'leftToRight' | 'rightToLeft') => string;
493
+ cfIconStyle: string;
494
+ cfIconSet: (set: IconSetName) => string;
495
+ cfReverse: string;
496
+ cfShowIconOnly: string;
497
+ cfIconRules: string;
498
+ cfWhenValue: string;
499
+ cfIconLast: string;
500
+ cfFormatOnly: string;
501
+ cfContain: (kind: 'cellValue' | 'text' | 'dates' | 'blanks' | 'noBlanks' | 'errors' | 'noErrors') => string;
502
+ cfOperator: (operator: CfOperator) => string;
503
+ cfTextOp: (type: CfTextType) => string;
504
+ cfRankLabel: string;
505
+ cfTopBottom: (top: boolean) => string;
506
+ cfPercentOf: string;
507
+ cfAverageLabel: string;
508
+ cfAverageKind: (kind: 'above' | 'below' | 'equalAbove' | 'equalBelow' | 'std1Above' | 'std2Above' | 'std3Above' | 'std1Below' | 'std2Below' | 'std3Below') => string;
509
+ cfAverageOf: string;
510
+ cfUniqueLabel: string;
511
+ cfInRange: string;
512
+ cfFormulaLabel: string;
513
+ cfPreview: string;
514
+ cfFormatButton: string;
515
+ /** A rule's Format Cells: no choice in a list, and Clear. */
516
+ cfNotSet: string;
517
+ cfClear: string;
518
+ }
519
+ export {};
@@ -5,6 +5,7 @@
5
5
  * is read-only, without `find` there is no search, and so on.
6
6
  */
7
7
  import type { CellStyle, CellValue, ConditionalAppearance, FunctionSignature, NumberFormat, StructureOp, StylePatch } from 'xlcalc/contract';
8
+ import type { ClearKind, SheetDependents, SheetLink, SheetName, SheetNote, SheetRules, SpellingHit, SpellingRequest, TableOp } from './workbook.js';
8
9
  /** The sheet's data source; the component accesses its data only through this interface. */
9
10
  export interface SheetSource {
10
11
  /** The workbook's sheets in order; read again after a structure change and on a `reload` event. */
@@ -93,6 +94,30 @@ export interface SheetSource {
93
94
  }[];
94
95
  more: number;
95
96
  }>;
97
+ /** Excel's Clear Formats and Clear All over ranges, as a single undo step; Delete clears contents through `edit`. Without it neither is offered. */
98
+ clear?(sheet: string, ranges: string[], what: ClearKind): Promise<EditOutcome>;
99
+ /** Excel's Insert Link over a range (null: Remove Hyperlinks), the cells' contents kept; a single undo step. Without it links can be followed but not edited. */
100
+ link?(sheet: string, range: string, link: SheetLink | null): Promise<EditOutcome>;
101
+ /** Excel's New Note and Edit Note on a cell (null: Delete Note); a single undo step. Without it notes are shown but not edited. */
102
+ note?(sheet: string, cell: string, note: SheetNote | null): Promise<EditOutcome>;
103
+ /** The workbook's defined names, for the Name Box, Go To, Formula AutoComplete and the Name Manager. */
104
+ names?(signal?: AbortSignal): Promise<SheetName[]>;
105
+ /** Replaces the workbook's defined names (Excel's Name Manager and Define Name), as a single undo step; a name Excel rejects is refused with its message. */
106
+ setNames?(names: SheetName[]): Promise<EditOutcome>;
107
+ /** The cells whose formulas refer directly to a range, for Excel's Trace Dependents. Without it there are no arrows. */
108
+ dependents?(sheet: string, range: string, signal?: AbortSignal): Promise<SheetDependents>;
109
+ /** A sheet's conditional formatting and data validation rules, for their dialogs. */
110
+ rules?(sheet: string, signal?: AbortSignal): Promise<SheetRules>;
111
+ /** Replaces a sheet's conditional formatting rules, its data validation rules, or both, as a single undo step. Without it the rules are applied but not edited. */
112
+ setRules?(sheet: string, rules: Partial<SheetRules>): Promise<EditOutcome>;
113
+ /** Excel's table commands. Without it there is no Format as Table. */
114
+ table?(op: TableOp): Promise<EditOutcome>;
115
+ /** Excel's Spelling: the next misspelt word from `req.after` on, wrapping around once, or null when there is none. Without it there is no Spelling. */
116
+ spelling?(req: SpellingRequest, signal?: AbortSignal): Promise<SpellingHit | null>;
117
+ /** Excel's Add to Dictionary in the Spelling dialog: the word is the user's own from now on. */
118
+ learnWord?(word: string): Promise<void>;
119
+ /** Excel's AutoSum (Alt+=) at a cell: the range it offers and its `SUM`; null when the source cannot guess one. Without it there is no AutoSum. */
120
+ autoSum?(sheet: string, cell: string, signal?: AbortSignal): Promise<SheetAutoSum | null>;
96
121
  /** The maximum number of cells in one window, 20,000 by default. */
97
122
  readonly maxCells?: number;
98
123
  /** The number of steps `undo` and `redo` can take, as of the last completed call: a toolbar enables its buttons by them. */
@@ -101,6 +126,15 @@ export interface SheetSource {
101
126
  readonly redo: number;
102
127
  };
103
128
  }
129
+ /**
130
+ * Excel's AutoSum at a cell: the range it offers to sum (the run of numbers above the cell, else to its left, up to a
131
+ * subtotal; the subtotals alone when the nearest is one), null without numbers, and the formula it enters, as the source
132
+ * displays formulas, without `=` (`SUM(B2:B9)`, `СУММ(B2:B9)` in ru-RU, `SUM()` without a range).
133
+ */
134
+ export interface SheetAutoSum {
135
+ range: string | null;
136
+ formula: string;
137
+ }
104
138
  /** A function's signature as returned by a source, with what Excel's Insert Function displays under the syntax: a one-line description of the function, in the source's locale. */
105
139
  export type SheetFunctionSignature = FunctionSignature & {
106
140
  description?: string;
@@ -158,6 +192,13 @@ export interface SheetInfo {
158
192
  totals?: (string | null)[];
159
193
  /** Excel's outline (Data > Group): the sheet's groups of rows and columns; a sheet without groups has none. */
160
194
  outline?: SheetOutline;
195
+ /** The workbook's default font (its Normal style), in which a cell without a font of its own is drawn; the component's `--xs-font` without it. */
196
+ font?: {
197
+ name: string;
198
+ size: number;
199
+ };
200
+ /** The sheet's saved zoom in percent (xlsx `zoomScale`), with which the sheet opens; 100 without it. */
201
+ zoom?: number;
161
202
  }
162
203
  /** A sheet's groups as Excel draws them in the bars next to the row numbers and above the column letters. */
163
204
  export interface SheetOutline {
@@ -1,12 +1,14 @@
1
- import type { CellStyle } from 'xlcalc/contract';
1
+ import type { CellStyle, CellValue, IconSetName } from 'xlcalc/contract';
2
+ import type { ClearRulesFrom, ColorScalePreset, DataBarColor, QuickRule } from './conditional.js';
2
3
  import type { SheetMessages } from './messages.js';
3
4
  import type { EditOutcome, FormatPatch, OutlineChange, SheetOp, SheetSource, SheetWindow } from './source.js';
5
+ import type { ClearKind } from './workbook.js';
4
6
  /** Properties of `SheetView`. */
5
7
  export interface SheetViewProps {
6
8
  source: SheetSource;
7
9
  /** Interface texts; a partial set overrides the English defaults. */
8
10
  messages?: Partial<SheetMessages>;
9
- /** Key in the browser's storage for the frozen panes display choice and column widths; without it they last as long as the component. */
11
+ /** Key in the browser's storage for the frozen panes display choice, Show Formulas and column widths; without it they last as long as the component. */
10
12
  storageKey?: string;
11
13
  /** A location to show: `Sheet!B12:D15`, `B7`, `Sheet`; each new object is a new jump. */
12
14
  focus?: {
@@ -29,6 +31,20 @@ export interface SheetViewProps {
29
31
  openRows?: boolean;
30
32
  /** The host opens links itself through `openLink`: for a host whose listener the component cannot see, such as a custom element's. */
31
33
  hostLinks?: boolean;
34
+ /**
35
+ * Excel's zoom by sheet name, in percent (10 to 400), as the host kept it from the `zoom` event; a sheet without one opens
36
+ * at the workbook's saved zoom (`SheetInfo.zoom`), otherwise 100%. A new object applies its changed entries, to the active sheet at once.
37
+ */
38
+ zoom?: Record<string, number>;
39
+ /** Excel's Watch Window list, as the host kept it from the `watches` event; a new array replaces the list. */
40
+ watches?: SheetWatch[];
41
+ /** The author's name for a new note, which Excel writes in bold on its first line (Excel takes the user name from its Options); without it a new note has no author. */
42
+ noteAuthor?: string;
43
+ }
44
+ /** A cell in Excel's Watch Window: its sheet and address (`B12`). */
45
+ export interface SheetWatch {
46
+ sheet: string;
47
+ cell: string;
32
48
  }
33
49
  /** Why the workbook cannot be displayed: the source's error and its text. */
34
50
  export interface SheetFailure {
@@ -45,10 +61,28 @@ export interface SheetViewState {
45
61
  style?: CellStyle;
46
62
  /** The active cell's number format code, from a source whose windows include them; absent for General. */
47
63
  numberFormat?: string;
64
+ /** The active cell's value from the loaded window (absent for an empty cell), for a toolbar's Increase and Decrease Decimal. */
65
+ cellValue?: CellValue;
66
+ /** The width of the active cell's column as the workbook stores it (xlcalc's `ColumnInput.width`), absent for the default: Increase Decimal on General depends on it. */
67
+ columnWidth?: number;
48
68
  /** The merged range containing the active cell (`A1:B2`), from the loaded windows: Excel's Merge & Center shows as pressed on it. */
49
69
  merged?: string;
50
70
  /** The merge commands are available (`SheetViewApi.merge`): the source has `structure`, the sheet is editable, and no display filter is on. */
51
71
  canMerge?: true;
72
+ /** Excel's Show Formulas is on for the displayed sheet (Ctrl+` or `SheetViewApi.showFormulas`): a ribbon shows its button pressed. */
73
+ showFormulas?: true;
74
+ /** The sheet's zoom in percent; absent at 100%. */
75
+ zoom?: number;
76
+ /** The workbook's default font (`SheetInfo.font`), which a cell without a font of its own displays: a toolbar's Font and Font Size boxes show it for such a cell. */
77
+ font?: {
78
+ name: string;
79
+ size: number;
80
+ };
81
+ }
82
+ /** The `zoom` event: the user changed a sheet's zoom (Ctrl+wheel, a pinch, the status bar, the Zoom dialog), in percent. */
83
+ export interface SheetZoomEvent {
84
+ sheet: string;
85
+ zoom: number;
52
86
  }
53
87
  /** A hyperlink the component does not open itself, with the cell it belongs to. */
54
88
  export type SheetLinkEvent = NonNullable<SheetWindow['links']>[string] & {
@@ -90,6 +124,87 @@ export interface SheetViewApi {
90
124
  * in the warning.
91
125
  */
92
126
  merge(command: MergeCommand): Promise<EditOutcome | null>;
127
+ /** Opens Excel's Go To dialog (F5, Ctrl+G) with the locations its jumps have left; false while no sheet is displayed. */
128
+ goTo(): boolean;
129
+ /**
130
+ * Opens Excel's Symbol dialog (Insert > Symbol): Insert puts the character at the caret of an open edit, otherwise starts
131
+ * editing the active cell with it, as typing does; false on a read-only sheet or without an active cell.
132
+ */
133
+ insertSymbol(): boolean;
134
+ /**
135
+ * Excel's Fill Down (Ctrl+D): the selection's top row copied over its other rows through the source's `structure`
136
+ * (`copyRange`, relative references shifted), or the row above it into a selection one row tall, as a single undo step.
137
+ * null when nothing was sent: no `structure`, a read-only sheet, a display filter, row 1 alone, or a locked cell.
138
+ */
139
+ fillDown(): Promise<EditOutcome | null>;
140
+ /** Excel's Fill Right (Ctrl+R): `fillDown` along the columns, from the selection's left column or the column to its left. */
141
+ fillRight(): Promise<EditOutcome | null>;
142
+ /** Excel's Show Formulas (Ctrl+`) on the displayed sheet, toggled without `on`: a view setting kept as the frozen panes choice is, the workbook unchanged; whether it is on afterwards. */
143
+ showFormulas(on?: boolean): boolean;
144
+ /** Excel's Define Name: the New Name dialog for the selection; false when names cannot be defined (no `names` or `setNames`, a read-only sheet) or a cell is being edited. */
145
+ defineName(): boolean;
146
+ /** Excel's Name Manager (Ctrl+F3); false when the source has no `names` or a cell is being edited. Without `setNames` or on a read-only sheet it only lists the names. */
147
+ nameManager(): boolean;
148
+ /**
149
+ * Excel's zoom of the active sheet: a percentage (rounded and kept within 10 to 400), or `selection` for Zoom to Selection,
150
+ * which fits the selection into the viewport and scrolls it to the top-left corner. Returns the zoom set; it is not
151
+ * reported by the `zoom` event, which reports the user's changes.
152
+ */
153
+ setZoom(zoom: number | 'selection'): number;
154
+ /** Opens Excel's Watch Window over the sheet (`true`, the default), or closes it (`false`); returns whether it is open. */
155
+ watchWindow(open?: boolean): boolean;
156
+ /**
157
+ * Excel's Trace Dependents through the source's `dependents`: arrows from the active cell to the cells whose formulas refer
158
+ * to it, and with each further call the next level; false when nothing was added (no `dependents`, no further level).
159
+ */
160
+ traceDependents(): Promise<boolean>;
161
+ /** Excel's Remove Arrows: every tracer arrow; false when there were none. */
162
+ removeArrows(): boolean;
163
+ /** Excel's Insert Table and Format as Table (Ctrl+T, Ctrl+L): the Create Table dialog for the selection or the data around the active cell; false without the source's `table`, or on a read-only sheet. */
164
+ insertTable(): Promise<boolean>;
165
+ /** Excel's Convert to Range on the table at the active cell, after Excel's question; null when nothing was sent (no table there, no `table`, No). */
166
+ convertToRange(): Promise<EditOutcome | null>;
167
+ /** Delete Table: the table at the active cell with its cells; null when nothing was sent. */
168
+ deleteTable(): Promise<EditOutcome | null>;
169
+ /** Excel's Spelling (F7) through the source's `spelling`: the dialog from the active cell, within a selection of several cells; false without `spelling`. */
170
+ checkSpelling(): boolean;
171
+ /**
172
+ * Excel's AutoSum (Alt+=) through the source's `autoSum`: the active cell's edit opens with `=SUM(range)`, the range
173
+ * selected, so Enter enters it and typing or the arrows replace it; false without `autoSum`, on a read-only sheet,
174
+ * while a cell is being edited or when the source guesses nothing.
175
+ */
176
+ autoSum(): Promise<boolean>;
177
+ /**
178
+ * Excel's Home > Clear > Clear Formats (`formats`) or Clear All (`all`) over the selection through the source's `clear`, as a
179
+ * single undo step (under a display filter, over its visible rows), after which the windows over it are read again. null when
180
+ * nothing was sent: no `clear`, a read-only sheet, or a locked cell in the selection.
181
+ */
182
+ clear(what: ClearKind): Promise<EditOutcome | null>;
183
+ /**
184
+ * Excel's Insert Link (Ctrl+K) over the selection: opens its dialog, as Edit Hyperlink when the active cell has a link; OK
185
+ * writes the link through the source's `link`. false when links cannot be edited: no `link`, a read-only sheet, a locked cell.
186
+ */
187
+ insertLink(): boolean;
188
+ /**
189
+ * Opens Excel's Data Validation dialog (Data > Data Validation) for the selection over the source's `rules` and `setRules`,
190
+ * after Excel's question when the selection holds rules of more than one kind or cells without the rule; false when the
191
+ * sheet is read-only or the source lacks either method.
192
+ */
193
+ dataValidation(): boolean;
194
+ /** Opens a quick rule's dialog (Highlight Cells Rules, Top/Bottom Rules) for the selection; OK adds the rule first in priority. */
195
+ quickRule(kind: QuickRule): boolean;
196
+ /** Adds Excel's data bar of that color over the selection, with a gradient fill (the default) or a solid one. */
197
+ dataBars(color: DataBarColor, fill?: 'gradient' | 'solid'): Promise<EditOutcome | null>;
198
+ /** Adds the color scale of Excel's gallery over the selection. */
199
+ colorScale(preset: ColorScalePreset): Promise<EditOutcome | null>;
200
+ /** Adds the icon set over the selection, with Excel's default thresholds: equal shares in percent. */
201
+ iconSet(icons: IconSetName): Promise<EditOutcome | null>;
202
+ /** Excel's Clear Rules from Selected Cells (a rule keeps the rest of its cells) or from Entire Sheet; null when there is nothing to clear. */
203
+ clearRules(from: ClearRulesFrom): Promise<EditOutcome | null>;
204
+ /** Opens Excel's New Formatting Rule dialog for the selection. */
205
+ newRule(): boolean;
206
+ /** Opens Excel's Conditional Formatting Rules Manager. */
207
+ manageRules(): boolean;
93
208
  }
94
209
  /** A patch for `SheetView.format`: applied to its own range, or to the selection without one. */
95
210
  export type SheetFormatPatch = Omit<FormatPatch, 'range'> & {
@@ -0,0 +1,73 @@
1
+ /**
2
+ * What a workbook holds beside its cells' values, as `SheetSource` reads and writes it for Excel's dialogs: hyperlinks,
3
+ * notes, defined names, conditional formatting and data validation rules, tables, formula dependents and spelling.
4
+ * Formulas in these types are written as the source displays formulas, in its locale and without `=`.
5
+ */
6
+ import type { ConditionalFormat, DataValidation, StructureOp } from 'xlcalc/contract';
7
+ /** What `SheetSource.clear` clears: Excel's Clear Formats (styles, number formats and the conditional formats over the cells) or Clear All (also the contents, hyperlinks, notes and data validation rules). */
8
+ export type ClearKind = 'formats' | 'all';
9
+ /** A hyperlink as Excel's Insert Link writes it: an address outside the workbook (`href`), a place in it (`location`: `'Sheet 2'!B12`, a defined name), or both, and its ScreenTip. */
10
+ export interface SheetLink {
11
+ href?: string;
12
+ location?: string;
13
+ tooltip?: string;
14
+ }
15
+ /** A cell's note (Excel's New Note), with its author's name as Excel shows it above the text. */
16
+ export interface SheetNote {
17
+ author?: string;
18
+ text: string;
19
+ }
20
+ /** A defined name as Excel's Name Manager lists it: what it refers to (a formula, in the source's locale, without `=`) and the sheet it is visible on, the workbook without `scope`. */
21
+ export interface SheetName {
22
+ name: string;
23
+ ref: string;
24
+ scope?: string;
25
+ }
26
+ /** A cell whose formula refers to the range `dependents` was asked about, for Excel's Trace Dependents arrows. */
27
+ export interface SheetDependent {
28
+ sheet: string;
29
+ cell: string;
30
+ }
31
+ /** The direct dependents of a range: at most as many as the source returns in one response, `more` when it left some out. */
32
+ export interface SheetDependents {
33
+ cells: SheetDependent[];
34
+ more: boolean;
35
+ }
36
+ /** A sheet's rules as Excel's Conditional Formatting Rules Manager and Data Validation edit them; their formulas in the source's locale. */
37
+ export interface SheetRules {
38
+ /** In priority order, highest first. */
39
+ conditionalFormats: ConditionalFormat[];
40
+ validations: DataValidation[];
41
+ }
42
+ /** Excel's table commands: Format as Table and Insert Table (`addTable`), Rename, Delete Table and Convert to Range. */
43
+ export type TableOp = Extract<StructureOp, {
44
+ op: 'addTable' | 'renameTable' | 'deleteTable' | 'convertTable';
45
+ }>;
46
+ /**
47
+ * Where Excel's Spelling looks next: within `range` or the entire sheet, from the active cell (`after`, from position `from` of its
48
+ * text, after Ignore Once on a word of it) on, by rows, skipping the words of Ignore All. As Excel's defaults, words in uppercase and
49
+ * words with digits are not checked.
50
+ */
51
+ export interface SpellingRequest {
52
+ sheet: string;
53
+ range?: string;
54
+ after?: string;
55
+ from?: number;
56
+ ignore?: string[];
57
+ }
58
+ /** A misspelt word in a cell's text constant (formulas are not checked): its position in the cell's text and the checker's suggestions, best first. */
59
+ export interface SpellingHit {
60
+ cell: string;
61
+ word: string;
62
+ at: number;
63
+ suggestions: string[];
64
+ }
65
+ /** A word checker the host supplies (a dictionary such as hunspell's, and the user's own words): `memorySource` and `@xlcalc/vue/local` check spelling with it. */
66
+ export interface SpellChecker {
67
+ /** Whether the word is spelt correctly. */
68
+ check(word: string): boolean;
69
+ /** Corrections for a misspelt word, best first. */
70
+ suggest(word: string): string[];
71
+ /** Excel's Add to Dictionary: the word is kept as the user's own. */
72
+ add?(word: string): void;
73
+ }
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * The package's contract: every public type, in modules by area, with no code. `source` is the sheet source contract a
3
- * host implements, `view` the sheet's props, state, events and methods, `memory` memorySource's types, `messages` the
4
- * interface texts' keys. The `@xlcalc/vue/local` entry's types are in src/local/types.ts.
3
+ * host implements, `workbook` what it reads and writes beside cell values (links, notes, names, rules, tables), `view` the sheet's props, state, events and methods, `memory` memorySource's types, `messages` the
4
+ * interface texts' keys, `conditional` the commands of Excel's Conditional Formatting menu. The `@xlcalc/vue/local` entry's types are in src/local/types.ts.
5
5
  */
6
6
  export type * from './contract/source.js';
7
+ export type * from './contract/workbook.js';
7
8
  export type * from './contract/view.js';
8
9
  export type * from './contract/memory.js';
9
10
  export type * from './contract/messages.js';
11
+ export type * from './contract/conditional.js';
@@ -4,6 +4,11 @@ import type { SheetSource } from '../contract/source.js';
4
4
  import type { EditorState } from './editing.js';
5
5
  /** Items the list displays at once; Page Up and Page Down move by them. */
6
6
  export declare const FUNCTION_ROWS = 8;
7
+ /** An item of the list: a function, or a defined name, which Excel lists with its own icon and inserts without a parenthesis. */
8
+ export interface CompletionItem {
9
+ text: string;
10
+ kind: 'function' | 'name';
11
+ }
7
12
  export interface AutocompleteDeps {
8
13
  source: () => SheetSource;
9
14
  editor: Ref<EditorState | null>;
@@ -13,10 +18,13 @@ export interface AutocompleteDeps {
13
18
  show: () => void;
14
19
  /** How the workbook's formula text is parsed (its list separator); null while its locale loads. */
15
20
  scan: () => ScanOptions | null;
21
+ /** The defined names visible on the sheet in alphabetical order, and that order, in which they join the functions; none without them. */
22
+ names?: () => readonly string[];
23
+ nameOrder?: (a: string, b: string) => number;
16
24
  }
17
25
  /** The list's state over the editor's draft: what it displays, the highlighted item, the keys it handles, the name it inserts. */
18
26
  export declare function useAutocomplete(deps: AutocompleteDeps): {
19
- items: import("vue").ShallowRef<readonly string[], readonly string[]>;
27
+ items: import("vue").ShallowRef<readonly CompletionItem[], readonly CompletionItem[]>;
20
28
  index: Ref<number, number>;
21
29
  open: import("vue").ComputedRef<boolean>;
22
30
  update: (text: string, caret: number | null) => void;
@@ -0,0 +1,11 @@
1
+ import type { Editing } from './editing.js';
2
+ import type { SheetState } from './state.js';
3
+ export interface AutoSumDeps {
4
+ /** Whether a cell is being edited: AutoSum starts a new edit only from the grid. */
5
+ editing: () => boolean;
6
+ }
7
+ export declare function useAutoSum(s: SheetState, ed: Editing, deps: AutoSumDeps): {
8
+ run: () => Promise<boolean>;
9
+ key: (e: KeyboardEvent) => boolean;
10
+ };
11
+ export type AutoSum = ReturnType<typeof useAutoSum>;
@@ -21,6 +21,11 @@ export interface CssLine {
21
21
  export declare function borderCss(line: BorderLine | undefined): CssLine | undefined;
22
22
  /** Puts a line on one side of a cell's CSS. */
23
23
  export declare function setSide(css: Record<string, string>, side: 'Top' | 'Right' | 'Bottom' | 'Left', line: CssLine): void;
24
+ /** The workbook's default font (`SheetInfo.font`) as CSS for the grid, which the cells without a font of their own inherit. */
25
+ export declare const defaultFontCss: (font: {
26
+ name: string;
27
+ size: number;
28
+ }) => Record<string, string>;
24
29
  /** A cell's font, color and fill; `section` is the color from the number format's section, which takes precedence over the font's. */
25
30
  export declare function fontCss(style: CellStyle | undefined, section: string | undefined): Record<string, string>;
26
31
  /** Underline and strikethrough, for the element that holds the text: decorations do not reach an absolutely positioned overflow run. A link is underlined anyway. */