Skip to main content

@paprize/vanilla

PaprizeReport​

Defined in: PaprizeReport.ts:72

The report builder class that contains the logic for handling pagination and managing the report layout.

Constructors​

Constructor​

new PaprizeReport(options?): PaprizeReport

Defined in: PaprizeReport.ts:80

Parameters​
ParameterType
options?PaprizeReportOptions
Returns​

PaprizeReport

Accessors​

monitor​

Get Signature​

get monitor(): Core.Monitor<PaprizeReportEvents>

Defined in: PaprizeReport.ts:159

Monitor instance used to subscribe to pagination events. See PaprizeReportEvents for available event types.

Returns​

Core.Monitor<PaprizeReportEvents>

Methods​

addSection()​

addSection(options): Promise<PaprizeReport>

Defined in: PaprizeReport.ts:168

Registers a section by its id, specifying the page size, margins, and other options. If a section with the same id already exists, the operation will be ignored.

Parameters​
ParameterTypeDescription
optionsSectionOptionsConfiguration options for the section.
Returns​

Promise<PaprizeReport>

schedulePagination()​

schedulePagination(): Promise<DomScheduleResult>

Defined in: PaprizeReport.ts:143

Schedules a pagination operation.

It is not possible to schedule multiple pagination operations in parallel, as the process involves DOM manipulation, and concurrent modifications could cause conflicts and unexpected results. Each newly scheduled operation is queued and executed sequentially. When a new pagination is scheduled, any ongoing or pending operations will be aborted, and the new pagination will start immediately afterward.

Returns​

Promise<DomScheduleResult>

A promise that resolves when the first pagination cycle is completed. It does not wait for suspended sections to resolve and be paginated. To wait for all sections to complete pagination, use the suspension property of the returned result object.


DomPageContext​

Defined in: PaprizeReportEvents.ts:6

Context information for a paginated page.

Properties​

PropertyTypeDescription
componentsSectionComponentsCollection of HTMLElement components present on this page.
pageHTMLElementThe root HTMLElement for this paginated page in the DOM.
pageIndexnumberIndex of this page within its section.
sectionIdstringIndex of the section to which this page belongs
totalPagesnumberTotal number of pages in the section that contains this page.

DomPaginationCycleCompleted​

Defined in: PaprizeReportEvents.ts:58

Context information for pagination cycle.

Properties​

PropertyTypeDescription
sectionsDomSectionContext[]All paginated section within the report.

DomScheduleResult​

Defined in: PaprizeReport.ts:52

Represents the result of a scheduled pagination process.

Properties​

PropertyTypeDescription
sectionsDomSectionContext[]List of all registered sections.
suspensionPromise<void>If there are any suspended sections, this Promise tracks their state and resolves only after all suspended sections have been resumed and paginated.

DomSectionContext​

Defined in: PaprizeReportEvents.ts:32

Context information for a paginated section.

Properties​

PropertyTypeDescription
isPaginatedbooleanIndicates whether pagination for this section has completed.
isSuspendedbooleanIndicates whether pagination for this section is suspended and waiting for the suspension to be resolved.
pagesDomPageContext[]All paginated pages that belong to this section.
sectionIdstringUnique identifier of the section.
sectionIndexnumberIndex of the section within the report.

PaprizeReportEvents​

Defined in: PaprizeReportEvents.ts:68

Available events that can be subscribed to, during the pagination process.

Properties​

PropertyTypeDescription
pageCompleted(event) => voidTriggered when a page has been fully paginated. event: DomPageContext
paginationCycleCompleted(event) => voidTriggered when an entire pagination cycle is completed. event: DomPaginationCycleCompleted
sectionCompleted(event) => voidTriggered when a section has been fully paginated. event: DomSectionContext
sectionCreated(event) => voidTriggered when a new section is created. event: DomSectionContext

PaprizeReportOptions​

Defined in: PaprizeReport.ts:34

Options for configuring a PaprizeReport instance.

Properties​

PropertyTypeDescription
keepInitialElementAfterPagination?booleanDetermines whether to keep the original DOM elements after pagination. When set to false (default), the original elements are removed and replaced with the paginated output. When set to true, the original elements remain in the DOM but are marked as invisible.
root?HTMLElementOptional root element where the final paginated report will be created. If not specified, document.body will be used as the default container.