feat(viewer): Add pagination metadata and thumbnail offset rendering for viewer thumbnails
This commit is contained in:
@@ -49,6 +49,13 @@ export class DeContentInvoice extends DeesElement {
|
||||
})
|
||||
accessor documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
||||
|
||||
// Offset-based rendering properties for thumbnails
|
||||
@property({ type: Number })
|
||||
accessor renderStartOffset: number = null;
|
||||
|
||||
@property({ type: Number })
|
||||
accessor renderContentLength: number = null;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
domtools.DomTools.setupDomTools();
|
||||
@@ -307,7 +314,29 @@ export class DeContentInvoice extends DeesElement {
|
||||
_changedProperties: Map<string | number | symbol, unknown>
|
||||
) {
|
||||
super.firstUpdated(_changedProperties);
|
||||
this.attachInvoiceDom();
|
||||
await this.attachInvoiceDom();
|
||||
|
||||
// Apply offset-based trimming if specified (used for thumbnails)
|
||||
if (this.renderStartOffset !== null && this.renderContentLength !== null) {
|
||||
await this.applyOffsetTrimming();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply pre-computed pagination offsets for thumbnail rendering
|
||||
*/
|
||||
private async applyOffsetTrimming(): Promise<void> {
|
||||
// Trim from start
|
||||
if (this.renderStartOffset > 0) {
|
||||
await this.trimStartToOffset(this.renderStartOffset);
|
||||
}
|
||||
|
||||
// Trim from end to match content length
|
||||
let currentLength = await this.getContentLength();
|
||||
while (currentLength > this.renderContentLength) {
|
||||
await this.trimEndByOne();
|
||||
currentLength = await this.getContentLength();
|
||||
}
|
||||
}
|
||||
|
||||
private renderPaymentTerms(): TemplateResult {
|
||||
|
||||
Reference in New Issue
Block a user