@xlcalc/vue 0.0.0-stage → 0.21.2
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/dist/abort.d.ts +6 -0
- package/dist/components/CellDraft.vue.d.ts +7 -0
- package/dist/components/CellEditor.vue.d.ts +3 -0
- package/dist/components/ColourSwatches.vue.d.ts +13 -0
- package/dist/components/DialogShell.vue.d.ts +37 -0
- package/dist/components/ExplainPanel.vue.d.ts +3 -0
- package/dist/components/FilterPopover.vue.d.ts +3 -0
- package/dist/components/FindBar.vue.d.ts +3 -0
- package/dist/components/FormatBorders.vue.d.ts +14 -0
- package/dist/components/FormatColour.vue.d.ts +19 -0
- package/dist/components/FormatDialog.vue.d.ts +24 -0
- package/dist/components/FormulaBar.vue.d.ts +3 -0
- package/dist/components/FunctionList.vue.d.ts +28 -0
- package/dist/components/FunctionTip.vue.d.ts +14 -0
- package/dist/components/InsertFunction.vue.d.ts +9 -0
- package/dist/components/OutlineCell.vue.d.ts +8 -0
- package/dist/components/OutlineLevels.vue.d.ts +7 -0
- package/dist/components/SheetGrid.vue.d.ts +3 -0
- package/dist/components/SheetMarks.vue.d.ts +3 -0
- package/dist/components/SheetMenu.vue.d.ts +3 -0
- package/dist/components/SheetRow.vue.d.ts +18 -0
- package/dist/components/SheetTabs.vue.d.ts +3 -0
- package/dist/components/SheetToolbar.vue.d.ts +43 -0
- package/dist/components/SheetView.vue.d.ts +56 -0
- package/dist/components/ValidationAlert.vue.d.ts +16 -0
- package/dist/components/ValidationDropdown.vue.d.ts +33 -0
- package/dist/components/ValidationPrompt.vue.d.ts +16 -0
- package/dist/components/cf-icons.d.ts +6 -0
- package/dist/components/context.d.ts +4 -0
- package/dist/components/dom.d.ts +7 -0
- package/dist/components/icons.d.ts +33 -0
- package/dist/components/popup.d.ts +29 -0
- package/dist/components/toolbar-icons.d.ts +24 -0
- package/dist/contract/memory.d.ts +108 -0
- package/dist/contract/messages.d.ts +260 -0
- package/dist/contract/source.d.ts +433 -0
- package/dist/contract/view.d.ts +108 -0
- package/dist/contract.d.ts +9 -0
- package/dist/core/ask.d.ts +2 -0
- package/dist/core/autocomplete.d.ts +28 -0
- package/dist/core/cell-style.d.ts +33 -0
- package/dist/core/cell-view.d.ts +104 -0
- package/dist/core/clip.d.ts +43 -0
- package/dist/core/commands.d.ts +47 -0
- package/dist/core/conditional.d.ts +16 -0
- package/dist/core/editing.d.ts +85 -0
- package/dist/core/explain.d.ts +36 -0
- package/dist/core/fill.d.ts +42 -0
- package/dist/core/filter.d.ts +72 -0
- package/dist/core/find.d.ts +53 -0
- package/dist/core/formula.d.ts +41 -0
- package/dist/core/function-tip.d.ts +34 -0
- package/dist/core/geometry.d.ts +55 -0
- package/dist/core/keys.d.ts +8 -0
- package/dist/core/list-keys.d.ts +4 -0
- package/dist/core/list.d.ts +17 -0
- package/dist/core/menu.d.ts +155 -0
- package/dist/core/merge.d.ts +19 -0
- package/dist/core/navigation.d.ts +72 -0
- package/dist/core/outline.d.ts +34 -0
- package/dist/core/point.d.ts +34 -0
- package/dist/core/ref-paint.d.ts +21 -0
- package/dist/core/selection.d.ts +45 -0
- package/dist/core/sheet.d.ts +774 -0
- package/dist/core/state.d.ts +107 -0
- package/dist/core/storage.d.ts +6 -0
- package/dist/core/totals.d.ts +16 -0
- package/dist/core/validation.d.ts +95 -0
- package/dist/core/viewport.d.ts +83 -0
- package/dist/core/windows.d.ts +102 -0
- package/dist/entry.d.ts +3 -0
- package/dist/failure.d.ts +5 -0
- package/dist/filter-key.d.ts +3 -0
- package/dist/find-match.d.ts +24 -0
- package/dist/format-cells.d.ts +85 -0
- package/dist/frame.d.ts +5 -0
- package/dist/grid-ref.d.ts +3 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12767 -0
- package/dist/lines.d.ts +16 -0
- package/dist/local/find.d.ts +15 -0
- package/dist/local/index.d.ts +3 -0
- package/dist/local/locale.d.ts +5 -0
- package/dist/local/outcome.d.ts +21 -0
- package/dist/local/query.d.ts +23 -0
- package/dist/local/source.d.ts +4 -0
- package/dist/local/types.d.ts +37 -0
- package/dist/local/validation.d.ts +8 -0
- package/dist/local/window.d.ts +16 -0
- package/dist/local/xlsx.d.ts +23 -0
- package/dist/local.js +1025 -0
- package/dist/locale-ref.d.ts +7 -0
- package/dist/locales.d.ts +3 -0
- package/dist/memory-outline.d.ts +31 -0
- package/dist/memory-query.d.ts +26 -0
- package/dist/memory-source.d.ts +3 -0
- package/dist/memory-validation.d.ts +17 -0
- package/dist/messages.d.ts +6 -0
- package/dist/number-formats.d.ts +13 -0
- package/dist/rect.d.ts +9 -0
- package/dist/ru-RU-BVeg6JGM.js +931 -0
- package/dist/sheet-query.d.ts +22 -0
- package/dist/stats.d.ts +8 -0
- package/dist/style.css +2 -0
- package/dist/toolbar.d.ts +39 -0
- package/dist/typed-entry-2l9Ay-hV.js +4559 -0
- package/dist/window-size.d.ts +4 -0
- package/docs/api.md +520 -0
- package/docs/autocomplete.md +60 -0
- package/docs/checks.md +40 -0
- package/docs/clipboard.md +48 -0
- package/docs/editing.md +97 -0
- package/docs/example-app.md +26 -0
- package/docs/find-replace.md +26 -0
- package/docs/list-mode.md +86 -0
- package/docs/local.md +94 -0
- package/docs/quick-start.md +221 -0
- package/docs/sheets.md +61 -0
- package/docs/toolbar.md +72 -0
- package/docs/validation.md +41 -0
- package/docs/view.md +50 -0
- package/package.json +92 -4
package/dist/lines.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OutlineChange } from './contract/source.js';
|
|
2
|
+
/** Rows or columns of a sheet. */
|
|
3
|
+
export type LineAxis = 'rows' | 'columns';
|
|
4
|
+
/** The rows or columns of `text` on one axis (`C`, `C:C`, `B:D`; `5`, `5:5`, `3:6`; any letter case); null for anything else. */
|
|
5
|
+
export declare function lineSpan(text: string, axis: LineAxis): {
|
|
6
|
+
first: number;
|
|
7
|
+
last: number;
|
|
8
|
+
} | null;
|
|
9
|
+
/** The axis an outline command acts on. */
|
|
10
|
+
export declare const axisOf: (change: OutlineChange) => LineAxis;
|
|
11
|
+
/** Rows or columns on an axis as a change names them: `{ rows: '3:6' }`, `{ columns: 'B:D' }`. */
|
|
12
|
+
export declare const linesOn: (axis: LineAxis, key: string) => {
|
|
13
|
+
rows: string;
|
|
14
|
+
} | {
|
|
15
|
+
columns: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AsyncSession, ReplaceResult } from 'xlcalc';
|
|
2
|
+
import type { FindRequest, FindResult } from '../contract/source.js';
|
|
3
|
+
import type { CellsBox } from './outcome.js';
|
|
4
|
+
/** Excel's Find: at most `FIND_MAX_HITS` matches in its order, from the first after `after`, wrapping around at the end, and the total count; `rows`, the display filter's in ascending order. */
|
|
5
|
+
export declare function findHits(s: AsyncSession, req: FindRequest, rows: number[] | null, signal?: AbortSignal): Promise<FindResult>;
|
|
6
|
+
/** Excel's Replace All: the cells Find finds in the text they open with, whatever Look in says, each with its matches replaced, as a single undo step. */
|
|
7
|
+
export declare function replaceAll(s: AsyncSession, req: FindRequest, by: string, rows: number[] | null): Promise<ReplaceResult>;
|
|
8
|
+
/**
|
|
9
|
+
* Cells scattered over a sheet (Replace All's) in ranges of at most `max` cells, so that reading them fits in windows;
|
|
10
|
+
* the cells come in Find's order, which keeps neighbors together.
|
|
11
|
+
*/
|
|
12
|
+
export declare function boxesUnder(sheet: string, cells: {
|
|
13
|
+
row: number;
|
|
14
|
+
col: number;
|
|
15
|
+
}[], max: number): Required<CellsBox>[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Locale } from 'xlcalc/contract';
|
|
2
|
+
/** Loads the locale of `tag` once; a tag without a module is left to the session, which rejects it, listing the locales it has. */
|
|
3
|
+
export declare function loadLocale(tag: string): Promise<void>;
|
|
4
|
+
/** The loaded locale of `tag` with its tooltip text attached, loaded once; the tag alone where it has none (en-US) or it fails to load. */
|
|
5
|
+
export declare function tipLocale(tag: string): Promise<Locale | string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CellRect, CellRef, CellTextsRefusal, EditResult, PasteTextRefusal, ViewportCell } from 'xlcalc';
|
|
2
|
+
import type { CellUpdate, EditOutcome } from '../contract/source.js';
|
|
3
|
+
export declare const failed: (message: string) => EditOutcome;
|
|
4
|
+
/** A session exception as an outcome: input the workbook rejects as `input`, anything else (a busy calculator too) as failed. */
|
|
5
|
+
export declare function outcomeOf(e: unknown, input: 'refused' | 'failed'): EditOutcome;
|
|
6
|
+
/** A text the session did not accept: a value a rule rejects, with the rule's alert; a formula that cannot be parsed, as invalid at its position with the correction Excel suggests; the rest as refused. */
|
|
7
|
+
export declare function refusalOf(r: CellTextsRefusal | PasteTextRefusal): EditOutcome;
|
|
8
|
+
/** A window cell as the update of an edited cell: its formula as displayed and the text it opens with. */
|
|
9
|
+
export declare function updateOf(sheet: string, addr: string, cell: ViewportCell | undefined): CellUpdate;
|
|
10
|
+
/** The change moved, laid out, restyled, or changed a note or a hyperlink, which cell updates do not carry: the sheets and windows are read again. */
|
|
11
|
+
export declare const needsReload: (got: EditResult) => boolean;
|
|
12
|
+
/** A cell key that matches sheet names as the library does, case-insensitively. */
|
|
13
|
+
export declare const cellKey: (sheet: string, cell: string) => string;
|
|
14
|
+
/** Cells on a sheet: the range that contains them and their addresses. */
|
|
15
|
+
export interface CellsBox {
|
|
16
|
+
sheet: string;
|
|
17
|
+
rect: CellRect;
|
|
18
|
+
only?: Set<string>;
|
|
19
|
+
}
|
|
20
|
+
/** Cells by sheet, each sheet's in the range that contains them; an address that is not a cell is omitted. */
|
|
21
|
+
export declare function boxesOf(refs: CellRef[]): CellsBox[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CellValue, CellView } from 'xlcalc';
|
|
2
|
+
import type { QuerySheet } from '../sheet-query.js';
|
|
3
|
+
/** A sheet's columns as the display filter has needed them, read through `read` (the session's `getCells` over ranges, stopped by a signal). */
|
|
4
|
+
export declare class SheetValues implements QuerySheet {
|
|
5
|
+
maxRow: number;
|
|
6
|
+
private readonly read;
|
|
7
|
+
/** Columns read, and those being read. */
|
|
8
|
+
private readonly cols;
|
|
9
|
+
private readonly reading;
|
|
10
|
+
/** `maxRow`: where the sheet's cells end; an edit beyond it extends it, as Excel's used range grows. */
|
|
11
|
+
constructor(maxRow: number, read: (ranges: string[], signal?: AbortSignal) => Promise<Record<string, CellView>>);
|
|
12
|
+
/**
|
|
13
|
+
* The columns read, with the missing ones read in one call that `signal` stops. A read that another request started and
|
|
14
|
+
* its signal stopped is repeated for this one.
|
|
15
|
+
*/
|
|
16
|
+
load(cols: number[], signal?: AbortSignal): Promise<void>;
|
|
17
|
+
/** Reads columns `want` in one call. */
|
|
18
|
+
private start;
|
|
19
|
+
/** A cell's new text and value, stored where its column is read or being read. */
|
|
20
|
+
set(row: number, col: number, text: string, value: CellValue | undefined): void;
|
|
21
|
+
textAt(row: number, col: number): string;
|
|
22
|
+
valueAt(row: number, col: number): CellValue | undefined;
|
|
23
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type BookInput } from 'xlcalc';
|
|
2
|
+
import type { LocalSource, LocalSourceOptions } from './types.js';
|
|
3
|
+
/** A source over `input`: the workbook is passed to the session as is (its cells are not copied), so do not change it afterwards. */
|
|
4
|
+
export declare function localSource(input: BookInput, opts?: LocalSourceOptions): LocalSource;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AsyncSessionOptions, BookInput, BookSnapshot, Calc, CalcPoolOptions, SessionHistory } from 'xlcalc';
|
|
2
|
+
import type { SheetSource } from '../contract/source.js';
|
|
3
|
+
export interface LocalSourceOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Where the workbook is calculated: `pool`, in Web Workers of `xlcalc/worker` (the default where `Worker` exists);
|
|
6
|
+
* `inline`, on the page's own thread in slices (the default elsewhere, e.g. Node); or by the host's calculator, which
|
|
7
|
+
* the source does not close.
|
|
8
|
+
*/
|
|
9
|
+
calc?: 'pool' | 'inline' | Calc;
|
|
10
|
+
/** Options for the pool the source starts (`calc: 'pool'`), e.g. `spawn` for a bundler that relocates the thread script. */
|
|
11
|
+
pool?: CalcPoolOptions;
|
|
12
|
+
/** Options for the workbook's session (a live clock, limits, deadlines). */
|
|
13
|
+
session?: AsyncSessionOptions;
|
|
14
|
+
/** The maximum number of cells in one window, 20,000 by default. */
|
|
15
|
+
maxCells?: number;
|
|
16
|
+
/** A notice included in every window (displayed above the grid), e.g. what the xlsx reader left out. */
|
|
17
|
+
notice?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Methods of `SheetSource` that the local source always has. */
|
|
20
|
+
type Given = 'edit' | 'paste' | 'fill' | 'pick' | 'end' | 'undo' | 'redo' | 'structure' | 'layout' | 'format' | 'replace' | 'outline' | 'freeze' | 'subscribe' | 'validation' | 'functionNames' | 'functionSignature' | 'explain' | 'stats' | 'find' | 'visibleRows' | 'columnValues';
|
|
21
|
+
/** A sheet source over an xlcalc workbook: every method of `SheetSource`, plus the host's handles on the workbook. */
|
|
22
|
+
export interface LocalSource extends Omit<SheetSource, Given | 'maxCells'>, Required<Pick<SheetSource, Given>> {
|
|
23
|
+
readonly maxCells: number;
|
|
24
|
+
/** The workbook's locale tag: formulas are displayed and typed values parsed in it. */
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
/** Resolves when the workbook is calculated; rejects if it could not be opened (the methods reject with the same error). */
|
|
27
|
+
readonly ready: Promise<void>;
|
|
28
|
+
/** The number of steps `undo` and `redo` can take now, for a toolbar's buttons. */
|
|
29
|
+
readonly history: SessionHistory;
|
|
30
|
+
/** The workbook with all changes so far, to save or store. */
|
|
31
|
+
book(): Promise<BookInput>;
|
|
32
|
+
/** The workbook and its calculated values captured at one moment, as `writeXlsx` takes them. */
|
|
33
|
+
snapshot(): Promise<BookSnapshot>;
|
|
34
|
+
/** Closes the session, and the pool when the source started it. */
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellValidation, CellValidationRefusal } from 'xlcalc';
|
|
2
|
+
import type { EditOutcome, SheetValidation } from '../contract/source.js';
|
|
3
|
+
/** A cell's rule as the component displays it: a list's items when it shows its dropdown (a formula's error yields none), and the input message unless it is turned off; null without a rule. */
|
|
4
|
+
export declare function validationOf(got: CellValidation | null): SheetValidation | null;
|
|
5
|
+
/** A value rejected by its rule, with Excel's alert: the rule's style, its title (the component's default without one) and its message (the library's text without one). */
|
|
6
|
+
export declare function alertRefusalOf(r: CellValidationRefusal): Extract<EditOutcome, {
|
|
7
|
+
ok: false;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Viewport } from 'xlcalc';
|
|
2
|
+
import type { SheetWindow } from '../contract/source.js';
|
|
3
|
+
interface WindowShape {
|
|
4
|
+
/** The window's first row as requested: a sheet row, or a display index under a filter. */
|
|
5
|
+
row: number;
|
|
6
|
+
/** The window's sheet rows in display order. */
|
|
7
|
+
rows: number[];
|
|
8
|
+
col: number;
|
|
9
|
+
cols: number;
|
|
10
|
+
/** The rows come from a display filter: merged ranges over several rows are omitted, as Excel displays them then. */
|
|
11
|
+
filtered: boolean;
|
|
12
|
+
notice?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The component's window from a viewport of the shape's rows and columns. */
|
|
15
|
+
export declare function windowOf(v: Viewport, a: WindowShape): SheetWindow;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Locale } from 'xlcalc';
|
|
2
|
+
import type { XlsxIssue, XlsxRead, XlsxWritten } from 'xlcalc/xlsx';
|
|
3
|
+
import type { LocalSource } from './types.js';
|
|
4
|
+
/** The language of the issue messages: a tag (`ru-RU`, whose module is loaded on demand) or a locale object; en-US by default. */
|
|
5
|
+
export interface XlsxIssuesOptions {
|
|
6
|
+
locale?: string | Locale;
|
|
7
|
+
}
|
|
8
|
+
/** Reads a file (the bytes, or a `File` from a file input or a drop) into a workbook; `issues` lists what the workbook cannot keep, in `locale`'s language. */
|
|
9
|
+
export declare function openXlsx(data: Blob | ArrayBuffer | Uint8Array, opts?: XlsxIssuesOptions): Promise<XlsxRead>;
|
|
10
|
+
/** Writes the source's workbook with its calculated values (`formulas`, the default, or `values` only); `issues` lists what the file cannot keep, in `locale`'s language. */
|
|
11
|
+
export declare function saveXlsx(source: LocalSource, opts?: XlsxIssuesOptions & {
|
|
12
|
+
mode?: 'formulas' | 'values';
|
|
13
|
+
}): Promise<XlsxWritten>;
|
|
14
|
+
export interface IssueGroup {
|
|
15
|
+
code: XlsxIssue['code'];
|
|
16
|
+
count: number;
|
|
17
|
+
/** The sheets the issues concern, in order of appearance. */
|
|
18
|
+
sheets: string[];
|
|
19
|
+
/** The first issue's message. */
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
/** Issues grouped by kind, in order of first appearance: for a notice of what a file lost. */
|
|
23
|
+
export declare function groupIssues(issues: XlsxIssue[]): IssueGroup[];
|