API reference
@salmonui/pivot-table/engine
64 exported symbols: 11 functions, 2 classes, 30 interfaces, 18 types and 3 constants. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/pivot-table/engine';Functions
compileFormulaCompiles a calculated field formula. fields are the source field names a reference may name (an empty list accepts any field). Throws PivotFormulaError with th…computePivotOne-shot compute (SSR, servers).createPivotEnginecreatePivotJobA resumable compute for time slicing on the main thread or a Worker.createPivotWorkerEngineheadersInHeader nodes (any depth) whose span overlaps [start, end), outer levels first per branch.measureIdMeasure id of the value field at k (types.ts "Measure ids"): the field, field#aggregate when another value field uses the same field, and field#aggregate#k whe…normalizePivotModelFills every default of a report model. The result is deeply frozen plain JSON; normalizing a normalized model returns an equal model.parseCsvParses CSV text into row objects keyed by the header (quoted fields, escaped quotes, CRLF, BOM).stableStringifyModelKey-sorted JSON of a model with its default-valued fields omitted (stable cache and URL key).windowOfComputes one window of a result (used by the worker and by in-process hosts).
Classes
Interfaces
AsyncPivotEngineThe window-based engine running in a Worker; every call resolves once the worker is done.CompiledFormulaParseCsvOptionsPivotAxisFieldA field placed on the rows, columns or filters axis.PivotCalculatedFieldPivotCellPivotConditionalFormatPivotCustomAggregatorA custom mergeable aggregator (client-only, never on the wire).PivotDiagnosticsInternal counters for tests and benchmarks (not a stable API).PivotEnginePivotEngineOptionsPivotEngineTextLabels the engine writes into header nodes ({label} is replaced by the member label).PivotFieldDefinitionOne source field.PivotFieldInfoPivotFormatIntl.NumberFormat options (or date options for date members) per value or field.PivotFormulaReferencePivotHeaderNodeA header node of the row or column tree (lazily materialized).PivotJobPivotMemberPivotModelPivotModelErrorA calculated field whose formula does not compile (its cells are empty).PivotResultThe result of one engine run. Header nodes and cells are materialized on demand.PivotShowAsPivotSummaryResult metadata without cells (what every state-changing call resolves to).PivotTotalsPivotValueFieldA value field (one measure of the result).PivotValueSortSort row members by the values of one column tuple.PivotWindowOne window of a result: leaf headers per position, every header overlapping it, and the cells row-major.PivotWindowRequestWorkerLikeWhat createPivotWorkerEngine needs of a Worker (a DOM Worker or an adapter over node:worker_threads).
Types
JsonPivotAggregatePivotComputeStatusPivotDatePartPivotFieldTypePivotFilterMember filter (include or exclude member keys), label filter or value filter (-03, -04).PivotGroupingPivotHeaderKindPivotLabelOperatorLabel filter operators reuse the Data Grid FilterOperator names.PivotMemberPathMember keys from the axis root, prefixed by the axis: ['rows', 'Asia', 'Japan'].PivotMemberSortPivotModelInputEvery field optional: what callers pass; normalizePivotModel() fills the defaults.PivotShowAsKindPivotValueOperatorPivotWorkerEngineOptionsPivotWorkerRequestPivotWorkerResponseWorkerScopeLikeThe worker side: a DedicatedWorkerGlobalScope or an adapter over parentPort.
Constants
DEFAULT_PIVOT_MODELThe normalized default model: every field present, nothing placed.matchesValueOperatorWhether a pivot value operator matches (conditional formats reuse it).plainHeaderA header node without children (plain JSON, never materializes the subtree).