@olvnck/ingrid 0.0.0-stage → 0.15.20
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 +7 -0
- package/LICENSE +21 -0
- package/README.md +5533 -2
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/engine/clipboard/copy.d.ts +40 -0
- package/dist/engine/clipboard/options.d.ts +16 -0
- package/dist/engine/clipboard/text.d.ts +32 -0
- package/dist/engine/columns/autosize.d.ts +43 -0
- package/dist/engine/columns/dataType.d.ts +30 -0
- package/dist/engine/columns/fold.d.ts +48 -0
- package/dist/engine/columns/layout.d.ts +150 -0
- package/dist/engine/columns/model.d.ts +369 -0
- package/dist/engine/columns/query.d.ts +16 -0
- package/dist/engine/columns/tooltips.d.ts +27 -0
- package/dist/engine/data/client/clientSource.d.ts +151 -0
- package/dist/engine/data/client/columnFilters.d.ts +106 -0
- package/dist/engine/data/client/descendants.d.ts +35 -0
- package/dist/engine/data/client/diff.d.ts +23 -0
- package/dist/engine/data/client/fields.d.ts +70 -0
- package/dist/engine/data/client/filter.d.ts +95 -0
- package/dist/engine/data/client/flatten.d.ts +141 -0
- package/dist/engine/data/client/groupSize.d.ts +14 -0
- package/dist/engine/data/client/hierarchy.d.ts +85 -0
- package/dist/engine/data/client/order.d.ts +32 -0
- package/dist/engine/data/client/pipeline.d.ts +277 -0
- package/dist/engine/data/client/remap.d.ts +33 -0
- package/dist/engine/data/client/trees.d.ts +41 -0
- package/dist/engine/data/client/types.d.ts +173 -0
- package/dist/engine/data/memory/generate.d.ts +36 -0
- package/dist/engine/data/memory/memoryDatasource.d.ts +46 -0
- package/dist/engine/data/rowKey.d.ts +15 -0
- package/dist/engine/data/server/contract.d.ts +64 -0
- package/dist/engine/data/server/expansion.d.ts +35 -0
- package/dist/engine/data/server/levelStore.d.ts +99 -0
- package/dist/engine/data/server/loader.d.ts +128 -0
- package/dist/engine/data/server/reader.d.ts +88 -0
- package/dist/engine/data/server/response.d.ts +31 -0
- package/dist/engine/data/server/serverSource.d.ts +130 -0
- package/dist/engine/data/shared/aggregate.d.ts +12 -0
- package/dist/engine/data/shared/columnFilter.d.ts +19 -0
- package/dist/engine/data/shared/compare.d.ts +12 -0
- package/dist/engine/data/shared/dateParts.d.ts +19 -0
- package/dist/engine/data/shared/distinct.d.ts +30 -0
- package/dist/engine/data/shared/filterRecord.d.ts +7 -0
- package/dist/engine/data/shared/keys.d.ts +17 -0
- package/dist/engine/data/shared/quickFilter.d.ts +17 -0
- package/dist/engine/data/shared/sourceUtils.d.ts +11 -0
- package/dist/engine/data/shared/splice.d.ts +9 -0
- package/dist/engine/detail/builds.d.ts +26 -0
- package/dist/engine/detail/content.d.ts +24 -0
- package/dist/engine/detail/controller.d.ts +176 -0
- package/dist/engine/detail/events.d.ts +11 -0
- package/dist/engine/detail/follow.d.ts +56 -0
- package/dist/engine/detail/layer.d.ts +119 -0
- package/dist/engine/detail/live.d.ts +96 -0
- package/dist/engine/detail/options.d.ts +53 -0
- package/dist/engine/detail/state.d.ts +140 -0
- package/dist/engine/edit/clear.d.ts +20 -0
- package/dist/engine/edit/editing.d.ts +4 -0
- package/dist/engine/edit/editors/date.d.ts +3 -0
- package/dist/engine/edit/editors/index.d.ts +23 -0
- package/dist/engine/edit/editors/internals.d.ts +25 -0
- package/dist/engine/edit/editors/largeText.d.ts +2 -0
- package/dist/engine/edit/editors/number.d.ts +4 -0
- package/dist/engine/edit/editors/select.d.ts +2 -0
- package/dist/engine/edit/editors/text.d.ts +15 -0
- package/dist/engine/edit/fill.d.ts +47 -0
- package/dist/engine/edit/fillHandle.d.ts +66 -0
- package/dist/engine/edit/fillValues.d.ts +15 -0
- package/dist/engine/edit/operations.d.ts +68 -0
- package/dist/engine/edit/paste.d.ts +23 -0
- package/dist/engine/edit/pastePlan.d.ts +17 -0
- package/dist/engine/edit/popupHost.d.ts +63 -0
- package/dist/engine/edit/session.d.ts +52 -0
- package/dist/engine/edit/types.d.ts +234 -0
- package/dist/engine/edit/undo.d.ts +38 -0
- package/dist/engine/edit/validation.d.ts +10 -0
- package/dist/engine/edit/values.d.ts +38 -0
- package/dist/engine/export/columns.d.ts +19 -0
- package/dist/engine/export/deliver.d.ts +47 -0
- package/dist/engine/export/dsv.d.ts +2 -0
- package/dist/engine/export/expanded.d.ts +69 -0
- package/dist/engine/export/export.d.ts +25 -0
- package/dist/engine/export/headers.d.ts +15 -0
- package/dist/engine/export/options.d.ts +19 -0
- package/dist/engine/export/plan.d.ts +43 -0
- package/dist/engine/export/values.d.ts +33 -0
- package/dist/engine/export/walk.d.ts +31 -0
- package/dist/engine/export/writer.d.ts +62 -0
- package/dist/engine/export/xlsx/cells.d.ts +31 -0
- package/dist/engine/export/xlsx/index.d.ts +12 -0
- package/dist/engine/export/xlsx/parts.d.ts +36 -0
- package/dist/engine/export/xlsx/sheet.d.ts +30 -0
- package/dist/engine/export/xlsx/styles.d.ts +15 -0
- package/dist/engine/export/xlsx/table.d.ts +8 -0
- package/dist/engine/export/xlsx/zip.d.ts +24 -0
- package/dist/engine/filter/groupFilter.d.ts +28 -0
- package/dist/engine/filter/model.d.ts +235 -0
- package/dist/engine/filter/shorthand.d.ts +36 -0
- package/dist/engine/filter/state.d.ts +76 -0
- package/dist/engine/filter/summary.d.ts +16 -0
- package/dist/engine/filter/values.d.ts +40 -0
- package/dist/engine/find/index.d.ts +94 -0
- package/dist/engine/find/match.d.ts +38 -0
- package/dist/engine/find/model.d.ts +115 -0
- package/dist/engine/grid.d.ts +42 -0
- package/dist/engine/i18n/numbers.d.ts +34 -0
- package/dist/engine/i18n/texts.d.ts +306 -0
- package/dist/engine/interact/autoScroll.d.ts +11 -0
- package/dist/engine/interact/body.d.ts +41 -0
- package/dist/engine/interact/focus.d.ts +158 -0
- package/dist/engine/interact/header.d.ts +216 -0
- package/dist/engine/interact/host.d.ts +400 -0
- package/dist/engine/interact/keyboard.d.ts +20 -0
- package/dist/engine/interact/menuKey.d.ts +7 -0
- package/dist/engine/interact/own.d.ts +2 -0
- package/dist/engine/interact/ranges.d.ts +68 -0
- package/dist/engine/interact/rowSelection.d.ts +53 -0
- package/dist/engine/interact/shortcut.d.ts +21 -0
- package/dist/engine/interact/tooltips.d.ts +63 -0
- package/dist/engine/measure.d.ts +30 -0
- package/dist/engine/render/cells.d.ts +322 -0
- package/dist/engine/render/columns.d.ts +28 -0
- package/dist/engine/render/dom.d.ts +24 -0
- package/dist/engine/render/flash.d.ts +74 -0
- package/dist/engine/render/groupCell.d.ts +50 -0
- package/dist/engine/render/groupPanel.d.ts +21 -0
- package/dist/engine/render/header.d.ts +162 -0
- package/dist/engine/render/overlay.d.ts +15 -0
- package/dist/engine/render/pinnedRows.d.ts +106 -0
- package/dist/engine/render/rowPool.d.ts +3 -0
- package/dist/engine/render/scrollbars.d.ts +77 -0
- package/dist/engine/render/strategy.d.ts +397 -0
- package/dist/engine/reportError.d.ts +7 -0
- package/dist/engine/rowdrag/controller.d.ts +80 -0
- package/dist/engine/rowdrag/events.d.ts +17 -0
- package/dist/engine/rowdrag/gesture.d.ts +33 -0
- package/dist/engine/rowdrag/keys.d.ts +21 -0
- package/dist/engine/rowdrag/model.d.ts +67 -0
- package/dist/engine/rowdrag/options.d.ts +34 -0
- package/dist/engine/rowdrag/rows.d.ts +61 -0
- package/dist/engine/rowdrag/target.d.ts +59 -0
- package/dist/engine/rowdrag/zones.d.ts +79 -0
- package/dist/engine/schedule.d.ts +29 -0
- package/dist/engine/selection/aggregate.d.ts +30 -0
- package/dist/engine/selection/options.d.ts +7 -0
- package/dist/engine/selection/rangeRows.d.ts +19 -0
- package/dist/engine/selection/ranges.d.ts +114 -0
- package/dist/engine/selection/rows.d.ts +207 -0
- package/dist/engine/source.d.ts +225 -0
- package/dist/engine/synthetic.d.ts +28 -0
- package/dist/engine/table/cells.d.ts +52 -0
- package/dist/engine/table/headers.d.ts +20 -0
- package/dist/engine/table/host.d.ts +65 -0
- package/dist/engine/table/job.d.ts +21 -0
- package/dist/engine/table/rows.d.ts +99 -0
- package/dist/engine/table/slicer.d.ts +54 -0
- package/dist/engine/table/takes.d.ts +145 -0
- package/dist/engine/types.d.ts +2950 -0
- package/dist/engine/ui/announce.d.ts +7 -0
- package/dist/engine/ui/chooser.d.ts +19 -0
- package/dist/engine/ui/columnList.d.ts +41 -0
- package/dist/engine/ui/columnMenu.d.ts +96 -0
- package/dist/engine/ui/columnsPanel.d.ts +16 -0
- package/dist/engine/ui/contextMenu.d.ts +48 -0
- package/dist/engine/ui/controller.d.ts +295 -0
- package/dist/engine/ui/filters/apply.d.ts +53 -0
- package/dist/engine/ui/filters/custom.d.ts +3 -0
- package/dist/engine/ui/filters/date.d.ts +12 -0
- package/dist/engine/ui/filters/host.d.ts +102 -0
- package/dist/engine/ui/filters/multi.d.ts +6 -0
- package/dist/engine/ui/filters/number.d.ts +15 -0
- package/dist/engine/ui/filters/numberMask.d.ts +15 -0
- package/dist/engine/ui/filters/set.d.ts +3 -0
- package/dist/engine/ui/filters/simple.d.ts +52 -0
- package/dist/engine/ui/filters/text.d.ts +5 -0
- package/dist/engine/ui/filtersPanel.d.ts +18 -0
- package/dist/engine/ui/floating.d.ts +66 -0
- package/dist/engine/ui/floatingShorthand.d.ts +20 -0
- package/dist/engine/ui/floatingTypes.d.ts +82 -0
- package/dist/engine/ui/icons.d.ts +25 -0
- package/dist/engine/ui/menu.d.ts +45 -0
- package/dist/engine/ui/overlayHost.d.ts +7 -0
- package/dist/engine/ui/place.d.ts +37 -0
- package/dist/engine/ui/popup.d.ts +97 -0
- package/dist/engine/ui/sideBar.d.ts +26 -0
- package/dist/engine/ui/statusBar.d.ts +29 -0
- package/dist/engine/ui/toolbar/buttons.d.ts +21 -0
- package/dist/engine/ui/toolbar/chipState.d.ts +52 -0
- package/dist/engine/ui/toolbar/chips.d.ts +23 -0
- package/dist/engine/ui/toolbar/findBox.d.ts +10 -0
- package/dist/engine/ui/toolbar/quickFilterBox.d.ts +12 -0
- package/dist/engine/ui/toolbar/registry.d.ts +5 -0
- package/dist/engine/ui/toolbar/toolbar.d.ts +31 -0
- package/dist/engine/ui/toolbar/types.d.ts +23 -0
- package/dist/engine/ui/tooltip.d.ts +34 -0
- package/dist/engine/ui/virtualList.d.ts +35 -0
- package/dist/engine/viewport/heightView.d.ts +62 -0
- package/dist/engine/viewport/heights.d.ts +39 -0
- package/dist/engine/viewport/intervals.d.ts +19 -0
- package/dist/engine/viewport/range.d.ts +51 -0
- package/dist/engine/viewport/scroll.d.ts +45 -0
- package/dist/engine/viewport/stack.d.ts +160 -0
- package/dist/grid-C34VEap6.js +32310 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1273 -0
- package/dist/ingrid.css +1 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +1 -0
- package/dist/locale/de.d.ts +4 -0
- package/dist/locale/de.js +222 -0
- package/dist/themes/primevue.css +63 -0
- package/dist/themes/tailwind.css +68 -0
- package/dist/vue/InGrid.vue.d.ts +263 -0
- package/dist/vue/stableOptions.d.ts +8 -0
- package/dist/vue/useClientSource.d.ts +28 -0
- package/dist/vue/useServerSource.d.ts +8 -0
- package/dist/vue/vueRenderer.d.ts +164 -0
- package/dist/xlsx-59umS_n_.js +325 -0
- package/package.json +78 -5
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CellRead } from '../table/cells';
|
|
2
|
+
import type { ExportValue } from '../types';
|
|
3
|
+
import type { ExportCol } from './columns';
|
|
4
|
+
import type { ResolvedExport } from './options';
|
|
5
|
+
/**
|
|
6
|
+
* The cell values of one export: `null` reads (the pipeline writes nothing) are empty and run no
|
|
7
|
+
* hook; otherwise the `value` hook (isolated: a throw is reported once and the default used), then the column's
|
|
8
|
+
* mode — `'auto'`: CSV / TSV the displayed text, XLSX a typed raw value or the displayed text; `'text'`: the displayed
|
|
9
|
+
* text; `'value'`: the raw value (empty for null / undefined; XLSX typed, `NaN`, ±Infinity and an invalid `Date` as the
|
|
10
|
+
* displayed text; anything else through `String`) — an XLSX column of `type: 'text'` as CSV / TSV, its cells written as
|
|
11
|
+
* text by the XLSX writer; a total row's label cell (`CellRead.label`) writes its text in every
|
|
12
|
+
* mode. The displayed text is formatted at most once per cell. The
|
|
13
|
+
* hook's context is one object, refilled per cell (no object per cell). CSV / TSV text cells get the formula
|
|
14
|
+
* escape here: hook strings, raw strings, group labels and other displayed texts — but not the displayed
|
|
15
|
+
* text of a raw finite number or bigint when that text is number-shaped (`-1,234.50`, `-5 %`, `-5 €` stay; a number
|
|
16
|
+
* shown as `-2+3+cmd|…` is escaped); the writer escapes only the header rows.
|
|
17
|
+
*/
|
|
18
|
+
export declare function cellValueFn(o: ResolvedExport): (read: CellRead | null, c: ExportCol) => ExportValue;
|
|
19
|
+
/**
|
|
20
|
+
* A cell of a detail row as the file writes it: what the `value` hook may return — a string (CSV /
|
|
21
|
+
* TSV: formula-escaped as a data cell), a number, bigint, boolean or `Date`, `null` — anything else empty.
|
|
22
|
+
*/
|
|
23
|
+
export declare function detailValueFn(o: ResolvedExport): (v: unknown) => ExportValue;
|
|
24
|
+
/**
|
|
25
|
+
* A value written as text: `null` empty, a string as it is, a `Date` as `toISOString()` (UTC with `Z`; an invalid
|
|
26
|
+
* one as `String`), numbers, bigints and booleans through `String`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function textOf(v: ExportValue): string;
|
|
29
|
+
/**
|
|
30
|
+
* The formula escape: a text whose first character is `=`, `+`, `-`, `@`, a tab or a CR gets a leading
|
|
31
|
+
* `'` — unless it is a number by `Number()` (`-5`, `+3.2`, `-1e3`; not a blank text, not `-Infinity`).
|
|
32
|
+
*/
|
|
33
|
+
export declare function escapeFormula(text: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CellRead } from '../table/cells';
|
|
2
|
+
import type { TableHost } from '../table/host';
|
|
3
|
+
import type { ExportFormat, ExportValue } from '../types';
|
|
4
|
+
import type { ExportCol } from './columns';
|
|
5
|
+
import type { ResolvedExport } from './options';
|
|
6
|
+
import type { ExportSegment } from './plan';
|
|
7
|
+
import type { ExportWriter } from './writer';
|
|
8
|
+
/** An export's `detail` hook as the walk calls it: set for every resolved request but `'ranges'`. */
|
|
9
|
+
export interface WalkDetail {
|
|
10
|
+
hook: NonNullable<ResolvedExport['detail']>;
|
|
11
|
+
/** A detail cell as the file writes it (`detailValueFn`). */
|
|
12
|
+
value(v: unknown): ExportValue;
|
|
13
|
+
format: ExportFormat;
|
|
14
|
+
/**
|
|
15
|
+
* The writer's outline holds the rows' levels (a grouped or tree view's): detail rows one level below their master.
|
|
16
|
+
* Without one the masters are written at level 0 and their detail rows at level 1.
|
|
17
|
+
*/
|
|
18
|
+
levels: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Walks `walk` into `writer`: each kept row's cells through `value` (the reader's `null` included: the pipeline writes
|
|
22
|
+
* nothing there), then `writer.row(cells, level)`, then — with `detail`, for a row that is no group row — the hook's
|
|
23
|
+
* rows below it: each from the first written column on, cut to the columns' count, through
|
|
24
|
+
* `detail.value`, one level below the master. `counts` grows by the rows (`progress`' count), the detail rows (`lines`)
|
|
25
|
+
* and the cells written. Columns are the blocks' (an export's walk has one block over its export columns).
|
|
26
|
+
*/
|
|
27
|
+
export declare function walkSegment(walk: ExportSegment, cols: readonly ExportCol[], value: (read: CellRead | null, c: ExportCol) => ExportValue, writer: ExportWriter, counts: {
|
|
28
|
+
rows: number;
|
|
29
|
+
lines: number;
|
|
30
|
+
cells: number;
|
|
31
|
+
}, groupRows: boolean, host: TableHost, detail?: WalkDetail | null): Generator<void, void>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { GridTexts } from '../i18n/texts';
|
|
2
|
+
import type { ExportFormat, ExportValue } from '../types';
|
|
3
|
+
import type { ExportCol } from './columns';
|
|
4
|
+
import type { HeaderRows } from './headers';
|
|
5
|
+
import type { ResolvedExport } from './options';
|
|
6
|
+
/** Characters a writer buffers before it encodes them into one chunk: chunks of 64 KiB and more. */
|
|
7
|
+
export declare const CHUNK_CHARS = 65536;
|
|
8
|
+
/** A `stream` export's walk pauses while unwritten chunks hold this many bytes or more (back-pressure). */
|
|
9
|
+
export declare const PAUSE_BYTES = 1048576;
|
|
10
|
+
/** Where a writer's chunks go: kept for one Blob, or written to a `stream` sink in order. */
|
|
11
|
+
export interface ChunkQueue {
|
|
12
|
+
push(chunk: Uint8Array): void;
|
|
13
|
+
/** Bytes pushed and not yet delivered: a Blob's collection holds them all, a stream the unwritten ones. */
|
|
14
|
+
readonly held: number;
|
|
15
|
+
/** Bytes pushed so far. */
|
|
16
|
+
readonly total: number;
|
|
17
|
+
}
|
|
18
|
+
/** What a writer is made with. */
|
|
19
|
+
export interface WriterContext {
|
|
20
|
+
format: ExportFormat;
|
|
21
|
+
options: ResolvedExport;
|
|
22
|
+
columns: readonly ExportCol[];
|
|
23
|
+
header: HeaderRows;
|
|
24
|
+
/**
|
|
25
|
+
* The deepest row level a grouped or tree view writes (a factory with `levels`), one more while the `detail` hook
|
|
26
|
+
* writes rows below the masters (a flat view's is then 1); `Infinity` when it is not known before the
|
|
27
|
+
* rows (a server tree read in segments); null otherwise.
|
|
28
|
+
*/
|
|
29
|
+
maxLevel: number | null;
|
|
30
|
+
/**
|
|
31
|
+
* XLSX: the header row and the rows below it are one Excel table (`ExportOptions.table`) — asked for and
|
|
32
|
+
* the export a flat list under a header row (`build` in `export.ts`).
|
|
33
|
+
*/
|
|
34
|
+
table: boolean;
|
|
35
|
+
texts: GridTexts;
|
|
36
|
+
out: ChunkQueue;
|
|
37
|
+
warn(key: string, message: string): void;
|
|
38
|
+
}
|
|
39
|
+
export interface ExportWriter {
|
|
40
|
+
/** Writes what comes before the rows (a BOM, the header rows, the fixed parts). */
|
|
41
|
+
begin(): void;
|
|
42
|
+
/**
|
|
43
|
+
* One data row: `cells` by column (the array is reused by the caller: read it here); `level` its row level. `detail`:
|
|
44
|
+
* a row the `detail` hook gave below a master — XLSX types its cells by their values, not by the
|
|
45
|
+
* columns above them (a neutral column, default style).
|
|
46
|
+
*/
|
|
47
|
+
row(cells: readonly ExportValue[], level: number | null, detail?: boolean): void;
|
|
48
|
+
/** Writes the rest and pushes the last chunk. */
|
|
49
|
+
end(): void;
|
|
50
|
+
/**
|
|
51
|
+
* A row did not fit (XLSX limits): `row()` refused it — not written, `truncated` set — and refuses every later one;
|
|
52
|
+
* the walk stops and does not count it. Reading it has no side effects.
|
|
53
|
+
*/
|
|
54
|
+
readonly full: boolean;
|
|
55
|
+
/** Rows, columns or texts were cut. */
|
|
56
|
+
readonly truncated: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Makes a writer; `levels`: it wants `maxLevel` (an outline), which may need a pass over the rows first. */
|
|
59
|
+
export interface WriterFactory {
|
|
60
|
+
(ctx: WriterContext): ExportWriter;
|
|
61
|
+
readonly levels?: true;
|
|
62
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExportValue } from '../../types';
|
|
2
|
+
/** A column's letters: 0 → `A`, 25 → `Z`, 26 → `AA`, 16,383 → `XFD`. */
|
|
3
|
+
export declare function columnName(index: number): string;
|
|
4
|
+
/** `text` as the content of a `<t>` element. */
|
|
5
|
+
export declare function escapeText(text: string): string;
|
|
6
|
+
/** `text` cut to `max` UTF-16 units without splitting a surrogate pair; null when it fits. */
|
|
7
|
+
export declare function cutText(text: string, max: number): string | null;
|
|
8
|
+
/** A valid `Date`'s serial of its local wall clock (what the page shows), or null before 1900-03-01. */
|
|
9
|
+
export declare function dateSerial(d: Date): number | null;
|
|
10
|
+
/**
|
|
11
|
+
* The serial of an ISO date string's local wall clock — an offset or `Z` converted to local time — or null: not ISO,
|
|
12
|
+
* a value that rolls over (`2026-13-01`, `T24:00`), or before 1900-03-01.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isoSerial(text: string): number | null;
|
|
15
|
+
/** A cell's column as the writer needs it. */
|
|
16
|
+
export interface CellColumn {
|
|
17
|
+
type: 'number' | 'date' | 'boolean' | 'text' | undefined;
|
|
18
|
+
/** The column's number format style, 0 without one: it wins over the date styles. */
|
|
19
|
+
style: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One cell's XML at `ref` ('' for an empty cell, which is not written): numbers, safe bigints, booleans and
|
|
23
|
+
* dates typed, strings converted by the column's `type`, everything else as an inline string — cut at `max`
|
|
24
|
+
* characters (`cut` is told), wrapped when it holds a line break.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cellXml(ref: string, v: ExportValue, column: CellColumn, max: number, cut: () => void): string;
|
|
27
|
+
/**
|
|
28
|
+
* An inline string (`xml:space="preserve"`: spaces and line breaks kept) with style `style` — the wrap style when it
|
|
29
|
+
* holds a line break and has none; '' for an empty text.
|
|
30
|
+
*/
|
|
31
|
+
export declare function textXml(ref: string, text: string, style: number, max: number, cut: () => void): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type WriterFactory } from '../writer';
|
|
2
|
+
/** Excel's sheet limits (header rows count as rows) and the zip's part size without zip64. */
|
|
3
|
+
export declare const XLSX_LIMITS: {
|
|
4
|
+
rows: number;
|
|
5
|
+
columns: number;
|
|
6
|
+
cellChars: number;
|
|
7
|
+
partBytes: number;
|
|
8
|
+
};
|
|
9
|
+
/** The writer factory under `limits` (tests lower them). */
|
|
10
|
+
export declare function xlsxWriterWith(limits: typeof XLSX_LIMITS): WriterFactory;
|
|
11
|
+
/** The XLSX writer: Excel's limits; it wants `maxLevel` (the outline depth is written before the rows). */
|
|
12
|
+
export declare const createXlsxWriter: WriterFactory;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const XML_HEAD = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
|
|
2
|
+
/** The SpreadsheetML (`main`) and relationships (`r`) namespaces. */
|
|
3
|
+
export declare const MAIN = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
4
|
+
export declare const REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
5
|
+
/**
|
|
6
|
+
* The package's entries in writing order; the sheet is the only streamed one. A table's two parts
|
|
7
|
+
* follow it: the table's range is known only after the last row.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PART: {
|
|
10
|
+
readonly contentTypes: "[Content_Types].xml";
|
|
11
|
+
readonly rels: "_rels/.rels";
|
|
12
|
+
readonly workbook: "xl/workbook.xml";
|
|
13
|
+
readonly workbookRels: "xl/_rels/workbook.xml.rels";
|
|
14
|
+
readonly styles: "xl/styles.xml";
|
|
15
|
+
readonly sheet: "xl/worksheets/sheet1.xml";
|
|
16
|
+
readonly sheetRels: "xl/worksheets/_rels/sheet1.xml.rels";
|
|
17
|
+
readonly table: "xl/tables/table1.xml";
|
|
18
|
+
};
|
|
19
|
+
/** `text` as a double-quoted attribute value (the sheet name, a number format code). */
|
|
20
|
+
export declare function escapeAttribute(text: string): string;
|
|
21
|
+
/** The content types; `table`: the sheet's table part too (written after the sheet, declared here up front). */
|
|
22
|
+
export declare const contentTypesXml: (table?: boolean) => string;
|
|
23
|
+
export declare const relsXml: () => string;
|
|
24
|
+
export declare const workbookRelsXml: () => string;
|
|
25
|
+
/** The sheet's relationships: its one table. */
|
|
26
|
+
export declare const sheetRelsXml: () => string;
|
|
27
|
+
/** The workbook: one sheet, no `date1904` (the 1900 system the serials use). */
|
|
28
|
+
export declare const workbookXml: (sheetName: string) => string;
|
|
29
|
+
/** The length of `text` cut to `max` UTF-16 units without splitting a surrogate pair. */
|
|
30
|
+
export declare function cutLength(text: string, max: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* A sheet name: `name`'s forbidden characters replaced by spaces, trimmed, leading and
|
|
33
|
+
* trailing apostrophes removed, cut to 31 characters (a surrogate pair kept whole); `fallback` (sanitised the same way,
|
|
34
|
+
* else 'Sheet1') when nothing is left.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sheetName(name: string | undefined, fallback: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Excel's deepest outline level (deeper levels stay at 7). */
|
|
2
|
+
export declare const MAX_OUTLINE = 7;
|
|
3
|
+
/** Excel's widest column (in characters). */
|
|
4
|
+
export declare const MAX_WIDTH = 255;
|
|
5
|
+
/**
|
|
6
|
+
* A px width as the file stores it (amending): ECMA-376's `width` is the characters Excel shows — `(px − 5) / 7`
|
|
7
|
+
* for the default font's 7 px digit — plus its 5 px padding, `trunc((chars × 7 + 5) / 7 × 256) / 256`, which is
|
|
8
|
+
* `trunc(px / 7 × 256) / 256`; so a column keeps the grid's px. Between 0 and 255.
|
|
9
|
+
*/
|
|
10
|
+
export declare function columnWidth(px: number): number;
|
|
11
|
+
export interface SheetHead {
|
|
12
|
+
/** Column widths in px, one per written column. */
|
|
13
|
+
widths: readonly number[];
|
|
14
|
+
/** The frozen rows (`ySplit`) and columns (`xSplit`); 0 / 0: no pane. */
|
|
15
|
+
frozenRows: number;
|
|
16
|
+
frozenColumns: number;
|
|
17
|
+
/** The outline's depth (`outlineLevelRow`, at most 7); 0: no outline. */
|
|
18
|
+
outline: number;
|
|
19
|
+
}
|
|
20
|
+
/** The worksheet up to and including `<sheetData>`. */
|
|
21
|
+
export declare function sheetStartXml(head: SheetHead): string;
|
|
22
|
+
/**
|
|
23
|
+
* The worksheet from `</sheetData>` on: the merged cells (`A1:B1`, 0-based rows and columns) after the data, then —
|
|
24
|
+
* with `table` — the sheet's table by its relationship.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sheetEndXml(merges: readonly {
|
|
27
|
+
row: number;
|
|
28
|
+
first: number;
|
|
29
|
+
last: number;
|
|
30
|
+
}[], table?: boolean): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The fixed cell formats (`cellXfs` indexes). */
|
|
2
|
+
export declare const S_BOLD = 1;
|
|
3
|
+
export declare const S_GROUP = 2;
|
|
4
|
+
export declare const S_DATE = 3;
|
|
5
|
+
export declare const S_DATE_TIME = 4;
|
|
6
|
+
export declare const S_WRAP = 5;
|
|
7
|
+
/** The distinct number format codes of `columns`, in column order, and each column's cell format (0 without one). */
|
|
8
|
+
export declare function numberFormats(columns: readonly {
|
|
9
|
+
numberFormat: string | undefined;
|
|
10
|
+
}[]): {
|
|
11
|
+
codes: string[];
|
|
12
|
+
styles: number[];
|
|
13
|
+
};
|
|
14
|
+
/** `xl/styles.xml` for the number format `codes`. */
|
|
15
|
+
export declare function stylesXml(codes: readonly string[]): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The table's column names from the header row's texts — which the header cells are then written with: cut to
|
|
3
|
+
* `max` characters (at most Excel's 255), an empty one `fallback` and the column's number ("Column3", as Excel names
|
|
4
|
+
* it), a repeated one — Excel compares without case — with the next free number behind it ("Name2").
|
|
5
|
+
*/
|
|
6
|
+
export declare function tableNames(headers: readonly (string | null)[], fallback: string, max: number): string[];
|
|
7
|
+
/** `xl/tables/table1.xml`: the table over `ref` (`A1:C9`, its header row first) with an autofilter and `names`. */
|
|
8
|
+
export declare function tableXml(ref: string, names: readonly string[]): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The deflate level of every entry. */
|
|
2
|
+
export declare const DEFLATE_LEVEL = 6;
|
|
3
|
+
/** Every entry's date: local parts, so its DOS date and time fields are the same in every zone. */
|
|
4
|
+
export declare const ZIP_DATE: Date;
|
|
5
|
+
/** `out` gets chunks of at least this many bytes, the last one excepted (fflate emits a small chunk per ~8 KiB in). */
|
|
6
|
+
export declare const OUT_BYTES = 65536;
|
|
7
|
+
/** An entry written in pieces (the worksheet). */
|
|
8
|
+
export interface ZipEntry {
|
|
9
|
+
/** Appends `xml`, UTF-8 encoded. */
|
|
10
|
+
push(xml: string): void;
|
|
11
|
+
/** Ends the entry. */
|
|
12
|
+
close(): void;
|
|
13
|
+
/** Uncompressed bytes pushed so far. */
|
|
14
|
+
readonly bytes: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ZipWriter {
|
|
17
|
+
/** A whole entry at once. */
|
|
18
|
+
add(name: string, data: string): void;
|
|
19
|
+
/** An entry written in pieces; entries added later wait in fflate until it is closed. */
|
|
20
|
+
open(name: string): ZipEntry;
|
|
21
|
+
/** Writes the central directory: the archive is complete. */
|
|
22
|
+
end(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function createZip(out: (chunk: Uint8Array) => void): ZipWriter;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The group column's filter over the grouped columns: which grouped columns take part, which one shows,
|
|
3
|
+
* and the group column's own filtered state. Pure functions over the column model and the filter state.
|
|
4
|
+
*/
|
|
5
|
+
import { type ColumnModel } from '../columns/model';
|
|
6
|
+
import type { GridTexts } from '../i18n/texts';
|
|
7
|
+
import type { FilterState } from './state';
|
|
8
|
+
/**
|
|
9
|
+
* The grouped columns that take part: with `groupedFilters`, not in tree mode, those with a filter, outermost first.
|
|
10
|
+
*/
|
|
11
|
+
export declare function groupFilterEntries(model: ColumnModel, filters: FilterState): string[];
|
|
12
|
+
/** The shown entry: `picked` while it is an entry, else the outermost; null without entries. */
|
|
13
|
+
export declare function shownEntryOf(entries: readonly string[], picked: string | null): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* The main box is editable: the rows are grouped by one column, which has a filter (it is the entry) and is
|
|
16
|
+
* hidden. Two or more grouping levels — also when only one of them has a filter — or the column visible: the read-only
|
|
17
|
+
* summary.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mainEditable(model: ColumnModel, entries: readonly string[]): boolean;
|
|
20
|
+
/** The group column's filtered state: its own filter or any entry's is active. */
|
|
21
|
+
export declare function groupFilterActive(filters: FilterState, entries: readonly string[]): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Where the group popup opens when no item is asked for: the shown entry, or the group column's own filter when
|
|
24
|
+
* it is active and the shown entry's is not. Between grouped columns the shown entry stays (the last pick).
|
|
25
|
+
*/
|
|
26
|
+
export declare function openingItem(filters: FilterState, shown: string, own: boolean): string;
|
|
27
|
+
/** The group-size filter's name: with two or more grouping levels, the innermost grouped column it counts. */
|
|
28
|
+
export declare function groupSizeName(texts: GridTexts, groups: readonly string[], name: (id: string) => string): string;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { GridTexts } from '../i18n/texts';
|
|
2
|
+
import type { FilterEvalOptions } from '../source';
|
|
3
|
+
import type { CellRenderer, FilterRenderer, FloatingFilterRenderer } from '../types';
|
|
4
|
+
export interface FilterButtons {
|
|
5
|
+
/** Default none: changes apply live (debounced). */
|
|
6
|
+
buttons?: readonly ('apply' | 'clear' | 'reset' | 'cancel')[];
|
|
7
|
+
/** Default false. */
|
|
8
|
+
closeOnApply?: boolean;
|
|
9
|
+
/** Live apply: text / number 500, date / set 0; forced 0 with 'apply'. */
|
|
10
|
+
debounceMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An app's floating-filter cell, on every kind (a custom kind's since): it replaces the built-in
|
|
14
|
+
* floating editor — a multi filter's whole cell, a multi child's where the cell shows that child. Its context's `model`
|
|
15
|
+
* is the kind's own model (as `getColumnFilter` returns it; null when inactive); `setModel` applies at once (source
|
|
16
|
+
* 'floating') through the API's validation, and a model the kind rejects is reported once and changes nothing.
|
|
17
|
+
*/
|
|
18
|
+
export interface FloatingFilterOption {
|
|
19
|
+
/** Floating UI (or a Vue slot #floating-filter-<id>). */
|
|
20
|
+
floatingRenderer?: FloatingFilterRenderer;
|
|
21
|
+
}
|
|
22
|
+
export interface SimpleFilterOptions extends FilterButtons {
|
|
23
|
+
/** Offered operators, in order; default all of the kind. */
|
|
24
|
+
operators?: readonly string[];
|
|
25
|
+
/** Default: the first of `operators`. */
|
|
26
|
+
defaultOperator?: string;
|
|
27
|
+
/** Default 2; Infinity allowed. */
|
|
28
|
+
maxConditions?: number;
|
|
29
|
+
/** Conditions always shown (default 1). */
|
|
30
|
+
visibleConditions?: number;
|
|
31
|
+
/** Default 'AND'; one operator for all conditions. */
|
|
32
|
+
defaultJoin?: 'AND' | 'OR';
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TextFilterDef extends SimpleFilterOptions, FloatingFilterOption {
|
|
36
|
+
type: 'text';
|
|
37
|
+
/** Default false. */
|
|
38
|
+
caseSensitive?: boolean;
|
|
39
|
+
/** Trim on apply, not whitespace-only text (default false). */
|
|
40
|
+
trimInput?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface NumberFilterDef extends SimpleFilterOptions, FloatingFilterOption {
|
|
43
|
+
type: 'number';
|
|
44
|
+
/** Default false. */
|
|
45
|
+
inRangeInclusive?: boolean;
|
|
46
|
+
/** Input text → number; the default follows the `filterInput` style. */
|
|
47
|
+
parse?: (text: string) => number | null;
|
|
48
|
+
/** Number → input text; the default follows the `filterInput` style. */
|
|
49
|
+
formatInput?: (value: number) => string;
|
|
50
|
+
/**
|
|
51
|
+
* The characters the number inputs accept: a regular-expression character class, or the
|
|
52
|
+
* characters inside one (`'\\d,.€ -'`). It replaces InGrid's set (digits, the decimal marks the `filterInput` style
|
|
53
|
+
* reads, `+ - −`, `e E`, space) for this column; the shorthand box adds `< > = !`, `.` and space to it. An insertion
|
|
54
|
+
* with any other character is refused whole. A `,` typed is not turned into `.` (the app's format). `''` counts as
|
|
55
|
+
* unset (an empty class would refuse every keystroke). A pattern that is no valid regular expression is
|
|
56
|
+
* reported once and no mask applies. A column with its own `parse` and no pattern has no mask.
|
|
57
|
+
*/
|
|
58
|
+
allowedCharPattern?: string;
|
|
59
|
+
/** The filter row's shorthand box; default false. */
|
|
60
|
+
shorthand?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** The group column's built-in filter on a group's row count; the number filter's options and popup. */
|
|
63
|
+
export interface GroupSizeFilterDef extends SimpleFilterOptions, FloatingFilterOption {
|
|
64
|
+
type: 'groupSize';
|
|
65
|
+
/** Default true: both ends of a range are inside. */
|
|
66
|
+
inRangeInclusive?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface DateFilterDef extends SimpleFilterOptions, FloatingFilterOption {
|
|
69
|
+
type: 'date';
|
|
70
|
+
/** Default false. */
|
|
71
|
+
inRangeInclusive?: boolean;
|
|
72
|
+
/** Compare instants and offer a time input (default false: calendar days). */
|
|
73
|
+
includeTime?: boolean;
|
|
74
|
+
/** 'YYYY-MM-DD'; default '1000-01-01'. */
|
|
75
|
+
minDate?: string;
|
|
76
|
+
maxDate?: string;
|
|
77
|
+
/** Native date input (default true); false = ISO text input. */
|
|
78
|
+
picker?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface SetFilterDef extends FilterButtons, FloatingFilterOption {
|
|
81
|
+
type: 'set';
|
|
82
|
+
/** A fixed list; default: the source's distinct values. */
|
|
83
|
+
values?: readonly unknown[];
|
|
84
|
+
/** Show "(N)" after each value (default false; an InGrid extension). */
|
|
85
|
+
counts?: boolean;
|
|
86
|
+
/** The search box (default true). */
|
|
87
|
+
search?: boolean;
|
|
88
|
+
/** The select-all checkbox (default true). */
|
|
89
|
+
selectAll?: boolean;
|
|
90
|
+
/** Typing in the search box applies its matches (default false). */
|
|
91
|
+
applySearch?: boolean;
|
|
92
|
+
/** Applied to labels and search text before matching. */
|
|
93
|
+
normalize?: (text: string) => string;
|
|
94
|
+
/** The label; default the column's `format`, then textOf; blanks → "(Blanks)". */
|
|
95
|
+
format?: (value: unknown) => string;
|
|
96
|
+
/** List order; default the field's compare. */
|
|
97
|
+
compare?: (a: unknown, b: unknown) => number;
|
|
98
|
+
/** Default false: "Black" and "black" are one entry. */
|
|
99
|
+
caseSensitive?: boolean;
|
|
100
|
+
/** Ask the source again on every open (default false; server: true). */
|
|
101
|
+
refreshOnOpen?: boolean;
|
|
102
|
+
/** Custom list label (one line). */
|
|
103
|
+
renderer?: CellRenderer;
|
|
104
|
+
}
|
|
105
|
+
export interface MultiFilterDef extends FloatingFilterOption {
|
|
106
|
+
type: 'multi';
|
|
107
|
+
/** Default ['text', 'set']; children AND, inactive ones ignored. */
|
|
108
|
+
filters?: readonly (FilterKind | FilterDef)[];
|
|
109
|
+
}
|
|
110
|
+
export interface CustomFilterDef extends FilterButtons, FloatingFilterOption {
|
|
111
|
+
/** The kind's name, e.g. 'flags'; `ClientSourceOptions.filterTypes` holds its test. */
|
|
112
|
+
type: string;
|
|
113
|
+
/** Popup / panel UI (or a Vue slot #filter-<id>). */
|
|
114
|
+
renderer?: FilterRenderer;
|
|
115
|
+
/** Read-only floating text, panel and status chips. */
|
|
116
|
+
summary?: (model: unknown, texts: GridTexts) => string;
|
|
117
|
+
}
|
|
118
|
+
export type FilterKind = 'text' | 'number' | 'date' | 'set' | 'multi';
|
|
119
|
+
/** A column's (or a multi child's) filter definition; the group-size kind is not one (`GroupColumnOptions.filter`). */
|
|
120
|
+
export type FilterDef = TextFilterDef | NumberFilterDef | DateFilterDef | SetFilterDef | MultiFilterDef | CustomFilterDef;
|
|
121
|
+
/**
|
|
122
|
+
* The type of `ColumnDef.filter`. 'groupSize' is not one: it belongs on `GroupColumnOptions.filter`
|
|
123
|
+
* only; given to a data column or a multi child anyway (JS, a cast) it is ignored with one console warning.
|
|
124
|
+
*/
|
|
125
|
+
export type FilterOption = boolean | FilterKind | FilterDef;
|
|
126
|
+
/** Column id → that column's applied model; only active filters appear. */
|
|
127
|
+
export type FilterModel = Record<string, ColumnFilterModel>;
|
|
128
|
+
export type ColumnFilterModel = SimpleModel | CombinedModel | SetModel | MultiModel | unknown;
|
|
129
|
+
export interface TextCondition {
|
|
130
|
+
filterType: 'text';
|
|
131
|
+
type: string;
|
|
132
|
+
filter?: string;
|
|
133
|
+
filterTo?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface NumberCondition {
|
|
136
|
+
filterType: 'number';
|
|
137
|
+
type: string;
|
|
138
|
+
filter?: number;
|
|
139
|
+
filterTo?: number;
|
|
140
|
+
}
|
|
141
|
+
export interface DateCondition {
|
|
142
|
+
filterType: 'date';
|
|
143
|
+
type: string;
|
|
144
|
+
dateFrom: string | null;
|
|
145
|
+
dateTo: string | null;
|
|
146
|
+
}
|
|
147
|
+
export interface GroupSizeCondition {
|
|
148
|
+
filterType: 'groupSize';
|
|
149
|
+
type: string;
|
|
150
|
+
filter?: number;
|
|
151
|
+
filterTo?: number;
|
|
152
|
+
}
|
|
153
|
+
export type SimpleModel = TextCondition | NumberCondition | DateCondition | GroupSizeCondition;
|
|
154
|
+
export interface CombinedModel {
|
|
155
|
+
filterType: 'text' | 'number' | 'date' | 'groupSize';
|
|
156
|
+
operator: 'AND' | 'OR';
|
|
157
|
+
/** Two or more. */
|
|
158
|
+
conditions: SimpleModel[];
|
|
159
|
+
}
|
|
160
|
+
export interface SetModel {
|
|
161
|
+
filterType: 'set';
|
|
162
|
+
/** Ticked keys; null = blanks. */
|
|
163
|
+
values: (string | null)[];
|
|
164
|
+
}
|
|
165
|
+
export interface MultiModel {
|
|
166
|
+
filterType: 'multi';
|
|
167
|
+
filterModels: (ColumnFilterModel | null)[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* `GridOptions.filterDefaults`: merged key by key under each built-in filter definition. Not a
|
|
171
|
+
* `floatingRenderer`: its model is one kind's, and the defaults reach every kind (a shared one goes on `defaultColumn`).
|
|
172
|
+
*/
|
|
173
|
+
export type FilterDefaults = Partial<Omit<TextFilterDef, 'type' | 'floatingRenderer'> & Omit<NumberFilterDef, 'type' | 'floatingRenderer'> & Omit<DateFilterDef, 'type' | 'floatingRenderer'> & Omit<SetFilterDef, 'type' | 'floatingRenderer'>>;
|
|
174
|
+
export type SimpleKind = 'text' | 'number' | 'date' | 'groupSize';
|
|
175
|
+
export declare const TEXT_OPERATORS: readonly ["contains", "notContains", "equals", "notEqual", "startsWith", "endsWith", "blank", "notBlank"];
|
|
176
|
+
export declare const NUMBER_OPERATORS: readonly ["equals", "notEqual", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange", "blank", "notBlank"];
|
|
177
|
+
/** A count has no blanks. */
|
|
178
|
+
export declare const GROUP_SIZE_OPERATORS: readonly ["equals", "notEqual", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange"];
|
|
179
|
+
export declare const DATE_OPERATORS: readonly ["equals", "notEqual", "lessThan", "greaterThan", "inRange", "blank", "notBlank"];
|
|
180
|
+
export declare function operatorsOf(kind: SimpleKind): readonly string[];
|
|
181
|
+
/** Inputs an operator takes: blank / notBlank 0, inRange 2, the rest 1. */
|
|
182
|
+
export declare function operatorInputs(operator: string): 0 | 1 | 2;
|
|
183
|
+
/** A column's filter definition with `filterDefaults` merged under built-in kinds; null = no filter. */
|
|
184
|
+
export type ResolvedFilter = {
|
|
185
|
+
kind: 'text';
|
|
186
|
+
def: TextFilterDef;
|
|
187
|
+
} | {
|
|
188
|
+
kind: 'number';
|
|
189
|
+
def: NumberFilterDef;
|
|
190
|
+
} | {
|
|
191
|
+
kind: 'date';
|
|
192
|
+
def: DateFilterDef;
|
|
193
|
+
} | {
|
|
194
|
+
kind: 'groupSize';
|
|
195
|
+
def: GroupSizeFilterDef;
|
|
196
|
+
} | {
|
|
197
|
+
kind: 'set';
|
|
198
|
+
def: SetFilterDef;
|
|
199
|
+
} | {
|
|
200
|
+
kind: 'multi';
|
|
201
|
+
def: MultiFilterDef;
|
|
202
|
+
children: readonly ResolvedFilter[];
|
|
203
|
+
} | {
|
|
204
|
+
kind: 'custom';
|
|
205
|
+
name: string;
|
|
206
|
+
def: CustomFilterDef;
|
|
207
|
+
};
|
|
208
|
+
/** A column's filter option, or the group column's (`GroupColumnOptions.filter`), which also takes the group-size kind. */
|
|
209
|
+
export declare function resolveFilter(filter: FilterOption | 'groupSize' | GroupSizeFilterDef | null | undefined, defaults?: FilterDefaults): ResolvedFilter | null;
|
|
210
|
+
/**
|
|
211
|
+
* The option names the group-size kind, which only the group column takes: elsewhere it is ignored. So is a multi
|
|
212
|
+
* filter whose children all name it: it is no filter either.
|
|
213
|
+
*/
|
|
214
|
+
export declare function isGroupSizeOption(option: unknown): boolean;
|
|
215
|
+
/** `FieldFilter.kind`: the built-in kind or the custom name. */
|
|
216
|
+
export declare function kindName(filter: ResolvedFilter): string;
|
|
217
|
+
/** The evaluation options a data source needs, as plain data: caseSensitive, inRangeInclusive, includeTime. */
|
|
218
|
+
export declare function evalOptions(filter: ResolvedFilter): FilterEvalOptions;
|
|
219
|
+
/** 'YYYY-MM-DD', 'YYYY-MM-DD hh:mm:ss' or 'YYYY-MM-DDThh:mm:ss' as local wall-clock time; null = not a date. */
|
|
220
|
+
export declare function readDateString(text: string): Date | null;
|
|
221
|
+
/**
|
|
222
|
+
* A model date string rewritten as 'YYYY-MM-DD hh:mm:ss' (time 00:00:00 without `includeTime`) from its own parts;
|
|
223
|
+
* null = not a date. The calendar day is checked in UTC and no local Date is made, so a wall-clock time a DST change
|
|
224
|
+
* skips (02:30 on the spring-forward day) stays as written instead of becoming 03:30.
|
|
225
|
+
*/
|
|
226
|
+
export declare function normaliseDateString(text: string, includeTime: boolean): string | null;
|
|
227
|
+
/** 'YYYY-MM-DD hh:mm:ss' in local time; the time is 00:00:00 without `includeTime`. */
|
|
228
|
+
export declare function writeDateString(date: Date, includeTime: boolean): string;
|
|
229
|
+
/**
|
|
230
|
+
* Validates and normalises a model the grid receives: `filterType` is filled in, numeric strings become
|
|
231
|
+
* numbers, dates are rewritten, surplus conditions are cut to `maxConditions`, incomplete conditions are pruned, a
|
|
232
|
+
* single condition loses the combined wrapper. null = no model (inactive or dropped). Never throws; each malformed
|
|
233
|
+
* part is reported once through `report`, an incomplete condition (a normal editing state) is not.
|
|
234
|
+
*/
|
|
235
|
+
export declare function normaliseModel(filter: ResolvedFilter, model: unknown, report: (problem: string) => void): ColumnFilterModel | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** What the box text means. `unfinished` changes nothing; `invalid` applies nothing and is shown red. */
|
|
2
|
+
export type ShorthandParse = {
|
|
3
|
+
kind: 'empty';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'unfinished';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'invalid';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'condition';
|
|
10
|
+
type: string;
|
|
11
|
+
from: number;
|
|
12
|
+
to: number | null;
|
|
13
|
+
};
|
|
14
|
+
/** Whether `text` is a number cut short; `decimal` is the `filterInput` mark: `.` only, or `.` and `,`. */
|
|
15
|
+
export declare function isCutShort(text: string, decimal: '.' | ','): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `read`: the column's number reader (`SimpleKindIo.read`); `offered`: the column's operators; `decimal`: the
|
|
18
|
+
* `filterInput` mark (what counts as cut short). An operator the column does not offer is invalid, never changed into
|
|
19
|
+
* another one. A plain number is `equals`, so it needs `equals` offered. An operator alone is unfinished if an offered
|
|
20
|
+
* operator starts with it; invalid wins over unfinished in a range. A third dot (`5...10`) is invalid: split at the
|
|
21
|
+
* first `..`, it would read as the range 5 to 0.1.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseShorthand(text: string, read: (t: string) => number | null, offered: readonly string[], decimal?: '.' | ','): ShorthandParse;
|
|
24
|
+
/**
|
|
25
|
+
* The model as box text — a number model, or a group-size one (its conditions are the number filter's); null
|
|
26
|
+
* = not expressible (two conditions, blank / notBlank, an operator without a prefix, a model of another kind).
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatShorthand(model: unknown, write: (n: number) => string): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* ↑ / ↓: the number after the operator ± `delta`, prefix and spacing kept (`<= -100` → `<= -99`). A range steps its
|
|
31
|
+
* upper end (the builder's call: the end the user typed last, and the one `5..10`-style filters usually grow). An empty
|
|
32
|
+
* box, or an operator alone, steps from 0. `min` clamps the result (group sizes: 0). null = nothing to step (invalid
|
|
33
|
+
* or unfinished number, a range with an end missing). It steps whatever operator it is given, offered or not: callers
|
|
34
|
+
* parse the text first (`parseShorthand`), where an operator the column does not offer is invalid.
|
|
35
|
+
*/
|
|
36
|
+
export declare function stepShorthand(text: string, delta: number, read: (t: string) => number | null, write: (n: number) => string, min?: number): string | null;
|