@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
| Parameter | Type |
|---|---|
options? | PaprizeReportOptions |
Returns
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
| Parameter | Type | Description |
|---|---|---|
options | SectionOptions | Configuration 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
| Property | Type | Description |
|---|---|---|
components | SectionComponents | Collection of HTMLElement components present on this page. |
page | HTMLElement | The root HTMLElement for this paginated page in the DOM. |
pageIndex | number | Index of this page within its section. |
sectionId | string | Index of the section to which this page belongs |
totalPages | number | Total number of pages in the section that contains this page. |
DomPaginationCycleCompleted
Defined in: PaprizeReportEvents.ts:58
Context information for pagination cycle.
Properties
| Property | Type | Description |
|---|---|---|
sections | DomSectionContext[] | All paginated section within the report. |
DomScheduleResult
Defined in: PaprizeReport.ts:52
Represents the result of a scheduled pagination process.
Properties
| Property | Type | Description |
|---|---|---|
sections | DomSectionContext[] | List of all registered sections. |
suspension | Promise<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
| Property | Type | Description |
|---|---|---|
isPaginated | boolean | Indicates whether pagination for this section has completed. |
isSuspended | boolean | Indicates whether pagination for this section is suspended and waiting for the suspension to be resolved. |
pages | DomPageContext[] | All paginated pages that belong to this section. |
sectionId | string | Unique identifier of the section. |
sectionIndex | number | Index of the section within the report. |
PaprizeReportEvents
Defined in: PaprizeReportEvents.ts:68
Available events that can be subscribed to, during the pagination process.
Properties
| Property | Type | Description |
|---|---|---|
pageCompleted | (event) => void | Triggered when a page has been fully paginated. event: DomPageContext |
paginationCycleCompleted | (event) => void | Triggered when an entire pagination cycle is completed. event: DomPaginationCycleCompleted |
sectionCompleted | (event) => void | Triggered when a section has been fully paginated. event: DomSectionContext |
sectionCreated | (event) => void | Triggered when a new section is created. event: DomSectionContext |
PaprizeReportOptions
Defined in: PaprizeReport.ts:34
Options for configuring a PaprizeReport instance.