Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e879893af | |||
| c487ac341e | |||
| 393a235526 | |||
| 52b215b9d3 | |||
| 34278c4b04 |
20
changelog.md
20
changelog.md
@@ -1,5 +1,25 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-11 - 2.2.0 - feat(viewer)
|
||||||
|
Add pagination metadata and thumbnail offset rendering for viewer thumbnails
|
||||||
|
|
||||||
|
- Expose per-page pagination metadata (IPagePaginationInfo) from DeDocument during rendering (pageNumber, startOffset, contentLength).
|
||||||
|
- DeDocument now collects pagination info while paginating and dispatches a 'pagination-complete' CustomEvent with pageCount and paginationInfo (bubbled & composed).
|
||||||
|
- DeContentInvoice: add renderStartOffset and renderContentLength properties and applyOffsetTrimming to support rendering trimmed content (used for thumbnails).
|
||||||
|
- DeDocumentViewer: listen for 'pagination-complete', store paginationInfo, and render thumbnail previews by mounting DeContentInvoice instances with precomputed offsets to produce accurate thumbnails.
|
||||||
|
- Viewer: wire thumbnail generation to use per-page offsets so thumbnails show exactly the content slice for each page.
|
||||||
|
- Demo data: extended demo invoice items in ts_shared/demoletter.ts to better exercise pagination and thumbnail rendering.
|
||||||
|
- Remove registry override from .npmrc (previously pointed to registry.npmjs.org).
|
||||||
|
|
||||||
|
## 2025-12-11 - 2.1.1 - fix(viewer)
|
||||||
|
Improve sidebar resizing UX and update deps
|
||||||
|
|
||||||
|
- Add smooth width transition for the thumbnail sidebar to improve resize visuals
|
||||||
|
- Disable viewport CSS transitions while user is actively resizing the sidebar to avoid janky animations
|
||||||
|
- Mark viewport as resizing in classes so layout updates skip transitions during drag
|
||||||
|
- Make sidebar resize mousemove listener passive to improve scrolling/interaction performance
|
||||||
|
- Bump @design.estate/dees-wcctools to ^2.0.0 and @git.zone/tswatch to ^2.3.11
|
||||||
|
|
||||||
## 2025-12-11 - 2.1.0 - feat(viewer)
|
## 2025-12-11 - 2.1.0 - feat(viewer)
|
||||||
Add smooth zoom and scroll animations to viewer
|
Add smooth zoom and scroll animations to viewer
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@design.estate/dees-document",
|
"name": "@design.estate/dees-document",
|
||||||
"version": "2.1.0",
|
"version": "2.2.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.",
|
"description": "A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.",
|
||||||
"main": "dist_ts_web/index.js",
|
"main": "dist_ts_web/index.js",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"@design.estate/dees-catalog": "^3.3.0",
|
"@design.estate/dees-catalog": "^3.3.0",
|
||||||
"@design.estate/dees-domtools": "^2.3.6",
|
"@design.estate/dees-domtools": "^2.3.6",
|
||||||
"@design.estate/dees-element": "^2.1.3",
|
"@design.estate/dees-element": "^2.1.3",
|
||||||
"@design.estate/dees-wcctools": "^1.3.0",
|
"@design.estate/dees-wcctools": "^2.0.0",
|
||||||
"@git.zone/tsrun": "^2.0.0",
|
"@git.zone/tsrun": "^2.0.0",
|
||||||
"@push.rocks/smartfile": "^13.1.0",
|
"@push.rocks/smartfile": "^13.1.0",
|
||||||
"@push.rocks/smartfs": "^1.2.0",
|
"@push.rocks/smartfs": "^1.2.0",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"@git.zone/tsbuild": "^3.1.2",
|
"@git.zone/tsbuild": "^3.1.2",
|
||||||
"@git.zone/tsbundle": "^2.6.3",
|
"@git.zone/tsbundle": "^2.6.3",
|
||||||
"@git.zone/tstest": "^3.1.3",
|
"@git.zone/tstest": "^3.1.3",
|
||||||
"@git.zone/tswatch": "^2.3.10",
|
"@git.zone/tswatch": "^2.3.11",
|
||||||
"@push.rocks/projectinfo": "^5.0.2"
|
"@push.rocks/projectinfo": "^5.0.2"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
29
pnpm-lock.yaml
generated
29
pnpm-lock.yaml
generated
@@ -18,8 +18,8 @@ importers:
|
|||||||
specifier: ^2.1.3
|
specifier: ^2.1.3
|
||||||
version: 2.1.3
|
version: 2.1.3
|
||||||
'@design.estate/dees-wcctools':
|
'@design.estate/dees-wcctools':
|
||||||
specifier: ^1.3.0
|
specifier: ^2.0.0
|
||||||
version: 1.3.0
|
version: 2.0.0
|
||||||
'@git.zone/tsrun':
|
'@git.zone/tsrun':
|
||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
@@ -67,8 +67,8 @@ importers:
|
|||||||
specifier: ^3.1.3
|
specifier: ^3.1.3
|
||||||
version: 3.1.3(@push.rocks/smartserve@1.4.0)(socks@2.8.7)(typescript@5.9.3)
|
version: 3.1.3(@push.rocks/smartserve@1.4.0)(socks@2.8.7)(typescript@5.9.3)
|
||||||
'@git.zone/tswatch':
|
'@git.zone/tswatch':
|
||||||
specifier: ^2.3.10
|
specifier: ^2.3.11
|
||||||
version: 2.3.10(@tiptap/pm@2.27.1)
|
version: 2.3.11(@tiptap/pm@2.27.1)
|
||||||
'@push.rocks/projectinfo':
|
'@push.rocks/projectinfo':
|
||||||
specifier: ^5.0.2
|
specifier: ^5.0.2
|
||||||
version: 5.0.2
|
version: 5.0.2
|
||||||
@@ -304,6 +304,9 @@ packages:
|
|||||||
'@design.estate/dees-wcctools@1.3.0':
|
'@design.estate/dees-wcctools@1.3.0':
|
||||||
resolution: {integrity: sha512-+yd8c1gTIKNRQYCvG0xu6Am8dHsRm7ymluX2gnoBQN4aFOpZgIBi/v9CvGyPhTD1p/VRouIBz1wsUCejnwrFCA==}
|
resolution: {integrity: sha512-+yd8c1gTIKNRQYCvG0xu6Am8dHsRm7ymluX2gnoBQN4aFOpZgIBi/v9CvGyPhTD1p/VRouIBz1wsUCejnwrFCA==}
|
||||||
|
|
||||||
|
'@design.estate/dees-wcctools@2.0.0':
|
||||||
|
resolution: {integrity: sha512-+JXzU/FzOs48NcynbozX0lPfvszhp0mODdZU2ECCTkwOQi+0smhYAlFTUNZ8JcWSLDq3g5HqRMv7XoJELMk4Zw==}
|
||||||
|
|
||||||
'@emnapi/core@1.7.1':
|
'@emnapi/core@1.7.1':
|
||||||
resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==}
|
resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==}
|
||||||
|
|
||||||
@@ -509,8 +512,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-t+/cKV21JHK8X7NGAmihs5M/eMm+V+jn4R5rzfwGG97WJFAcP5qE1Os9VYtyZw3tx/NZXA2yA4abo/ELluTuRA==}
|
resolution: {integrity: sha512-t+/cKV21JHK8X7NGAmihs5M/eMm+V+jn4R5rzfwGG97WJFAcP5qE1Os9VYtyZw3tx/NZXA2yA4abo/ELluTuRA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@git.zone/tswatch@2.3.10':
|
'@git.zone/tswatch@2.3.11':
|
||||||
resolution: {integrity: sha512-88bdzD15mYoG0T0AUTg8ATNkV/dN5ecqfiYcQRX1gJHmLrE2yqymFGkb0W0/xWgpcRakc08V+wRbSI7pqg+EOQ==}
|
resolution: {integrity: sha512-FJWOsPQ9i0INn1i7uqMD0ECrZ6bwwGQC8oFDEx9PLcaS+qHpGsYj3P9UscpW1N78P+6Yd1WFUfBh9sUQiKm+KA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@happy-dom/global-registrator@15.11.7':
|
'@happy-dom/global-registrator@15.11.7':
|
||||||
@@ -5002,6 +5005,18 @@ snapshots:
|
|||||||
- supports-color
|
- supports-color
|
||||||
- vue
|
- vue
|
||||||
|
|
||||||
|
'@design.estate/dees-wcctools@2.0.0':
|
||||||
|
dependencies:
|
||||||
|
'@design.estate/dees-domtools': 2.3.6
|
||||||
|
'@design.estate/dees-element': 2.1.3
|
||||||
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
|
lit: 3.3.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@nuxt/kit'
|
||||||
|
- react
|
||||||
|
- supports-color
|
||||||
|
- vue
|
||||||
|
|
||||||
'@emnapi/core@1.7.1':
|
'@emnapi/core@1.7.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@emnapi/wasi-threads': 1.1.0
|
'@emnapi/wasi-threads': 1.1.0
|
||||||
@@ -5230,7 +5245,7 @@ snapshots:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
- vue
|
- vue
|
||||||
|
|
||||||
'@git.zone/tswatch@2.3.10(@tiptap/pm@2.27.1)':
|
'@git.zone/tswatch@2.3.11(@tiptap/pm@2.27.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@api.global/typedserver': 7.11.1(@tiptap/pm@2.27.1)
|
'@api.global/typedserver': 7.11.1(@tiptap/pm@2.27.1)
|
||||||
'@git.zone/tsbundle': 2.6.3
|
'@git.zone/tsbundle': 2.6.3
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-document',
|
name: '@design.estate/dees-document',
|
||||||
version: '2.1.0',
|
version: '2.2.0',
|
||||||
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,6 +237,86 @@ export const demoLetter: plugins.tsclass.finance.TInvoice = {
|
|||||||
vatPercentage: 0,
|
vatPercentage: 0,
|
||||||
position: 20,
|
position: 20,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Consulting Services",
|
||||||
|
unitQuantity: 5,
|
||||||
|
unitNetPrice: 150,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 21,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Development Work",
|
||||||
|
unitQuantity: 12,
|
||||||
|
unitNetPrice: 120,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 22,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Project Management",
|
||||||
|
unitQuantity: 3,
|
||||||
|
unitNetPrice: 180,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 23,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Technical Support",
|
||||||
|
unitQuantity: 8,
|
||||||
|
unitNetPrice: 90,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 7,
|
||||||
|
position: 24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Documentation",
|
||||||
|
unitQuantity: 4,
|
||||||
|
unitNetPrice: 75,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 7,
|
||||||
|
position: 25,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Code Review",
|
||||||
|
unitQuantity: 6,
|
||||||
|
unitNetPrice: 110,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 26,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Testing & QA",
|
||||||
|
unitQuantity: 10,
|
||||||
|
unitNetPrice: 95,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 27,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Infrastructure Setup",
|
||||||
|
unitQuantity: 2,
|
||||||
|
unitNetPrice: 250,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 28,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Training Session",
|
||||||
|
unitQuantity: 4,
|
||||||
|
unitNetPrice: 200,
|
||||||
|
unitType: "hours",
|
||||||
|
vatPercentage: 7,
|
||||||
|
position: 29,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Maintenance Package",
|
||||||
|
unitQuantity: 1,
|
||||||
|
unitNetPrice: 500,
|
||||||
|
unitType: "units",
|
||||||
|
vatPercentage: 19,
|
||||||
|
position: 30,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-document',
|
name: '@design.estate/dees-document',
|
||||||
version: '2.1.0',
|
version: '2.2.0',
|
||||||
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ export class DeContentInvoice extends DeesElement {
|
|||||||
})
|
})
|
||||||
accessor documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
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() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
domtools.DomTools.setupDomTools();
|
domtools.DomTools.setupDomTools();
|
||||||
@@ -307,7 +314,29 @@ export class DeContentInvoice extends DeesElement {
|
|||||||
_changedProperties: Map<string | number | symbol, unknown>
|
_changedProperties: Map<string | number | symbol, unknown>
|
||||||
) {
|
) {
|
||||||
super.firstUpdated(_changedProperties);
|
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 {
|
private renderPaymentTerms(): TemplateResult {
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ import { DeContentInvoice } from "./contentinvoice.js";
|
|||||||
|
|
||||||
import { demoFunc } from "./document.demo.js";
|
import { demoFunc } from "./document.demo.js";
|
||||||
|
|
||||||
|
export interface IPagePaginationInfo {
|
||||||
|
pageNumber: number;
|
||||||
|
startOffset: number;
|
||||||
|
contentLength: number;
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
"dedocument-dedocument": DeDocument;
|
"dedocument-dedocument": DeDocument;
|
||||||
@@ -142,10 +148,12 @@ export class DeDocument extends DeesElement {
|
|||||||
null;
|
null;
|
||||||
public latestRenderedLetterData: plugins.tsclass.business.TLetter = null;
|
public latestRenderedLetterData: plugins.tsclass.business.TLetter = null;
|
||||||
public cleanupStore: any[] = [];
|
public cleanupStore: any[] = [];
|
||||||
|
public paginationInfo: IPagePaginationInfo[] = [];
|
||||||
|
|
||||||
public async renderDocument() {
|
public async renderDocument() {
|
||||||
this.latestDocumentSettings = this.documentSettings;
|
this.latestDocumentSettings = this.documentSettings;
|
||||||
this.latestRenderedLetterData = this.letterData;
|
this.latestRenderedLetterData = this.letterData;
|
||||||
|
this.paginationInfo = [];
|
||||||
|
|
||||||
const cleanUpStoreCurrentRender = [];
|
const cleanUpStoreCurrentRender = [];
|
||||||
const cleanUpStoreNextRender = [];
|
const cleanUpStoreNextRender = [];
|
||||||
@@ -198,7 +206,16 @@ export class DeDocument extends DeesElement {
|
|||||||
newPageOverflows = await newPage.checkOverflow();
|
newPageOverflows = await newPage.checkOverflow();
|
||||||
}
|
}
|
||||||
currentContentOffset = await currentContent.getContentLength();
|
currentContentOffset = await currentContent.getContentLength();
|
||||||
|
const pageStartOffset = overallContentOffset;
|
||||||
overallContentOffset = overallContentOffset + currentContentOffset;
|
overallContentOffset = overallContentOffset + currentContentOffset;
|
||||||
|
|
||||||
|
// Track pagination info for this page
|
||||||
|
this.paginationInfo.push({
|
||||||
|
pageNumber: pageCounter,
|
||||||
|
startOffset: pageStartOffset,
|
||||||
|
contentLength: currentContentOffset,
|
||||||
|
});
|
||||||
|
|
||||||
if (trimmed === 0) {
|
if (trimmed === 0) {
|
||||||
complete = true;
|
complete = true;
|
||||||
}
|
}
|
||||||
@@ -234,6 +251,16 @@ export class DeDocument extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.adjustDePageScaling();
|
this.adjustDePageScaling();
|
||||||
|
|
||||||
|
// Emit event with pagination info for thumbnails
|
||||||
|
this.dispatchEvent(new CustomEvent('pagination-complete', {
|
||||||
|
detail: {
|
||||||
|
pageCount: pageCounter,
|
||||||
|
paginationInfo: this.paginationInfo,
|
||||||
|
},
|
||||||
|
bubbles: true,
|
||||||
|
composed: true,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async updated(
|
async updated(
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import {
|
|||||||
type TemplateResult,
|
type TemplateResult,
|
||||||
} from "@design.estate/dees-element";
|
} from "@design.estate/dees-element";
|
||||||
import { demoFunc } from "./viewer.demo.js";
|
import { demoFunc } from "./viewer.demo.js";
|
||||||
import { DeDocument } from "./document.js";
|
import { DeDocument, type IPagePaginationInfo } from "./document.js";
|
||||||
import "./page.js"; // Import DePage for thumbnail rendering
|
import "./page.js"; // Import DePage for thumbnail rendering
|
||||||
|
import "./contentinvoice.js"; // Import DeContentInvoice for thumbnail content
|
||||||
|
|
||||||
import "@design.estate/dees-catalog";
|
import "@design.estate/dees-catalog";
|
||||||
|
|
||||||
@@ -105,6 +106,9 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
@state()
|
@state()
|
||||||
accessor thumbnailPages: number[] = [];
|
accessor thumbnailPages: number[] = [];
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor paginationInfo: IPagePaginationInfo[] = [];
|
||||||
|
|
||||||
// Zoom animation
|
// Zoom animation
|
||||||
private zoomAnimationId: number | null = null;
|
private zoomAnimationId: number | null = null;
|
||||||
|
|
||||||
@@ -142,6 +146,7 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
transition: width 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar--collapsed {
|
.sidebar--collapsed {
|
||||||
@@ -551,6 +556,10 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
transition: left 0.2s ease;
|
transition: left 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.viewport--resizing {
|
||||||
|
transition: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.viewport--with-sidebar {
|
.viewport--with-sidebar {
|
||||||
left: var(--current-sidebar-width, 140px);
|
left: var(--current-sidebar-width, 140px);
|
||||||
}
|
}
|
||||||
@@ -621,6 +630,7 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
"viewport",
|
"viewport",
|
||||||
this.zoomMode !== "auto" ? "viewport--centered" : "",
|
this.zoomMode !== "auto" ? "viewport--centered" : "",
|
||||||
this.showThumbnails ? "viewport--with-sidebar" : "",
|
this.showThumbnails ? "viewport--with-sidebar" : "",
|
||||||
|
this.isResizingSidebar ? "viewport--resizing" : "",
|
||||||
].filter(Boolean).join(" ");
|
].filter(Boolean).join(" ");
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
@@ -661,8 +671,10 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
<div class="${sidebarClasses}" style="width: ${this.sidebarWidth}px;">
|
<div class="${sidebarClasses}" style="width: ${this.sidebarWidth}px;">
|
||||||
<div class="sidebar__header">Pages</div>
|
<div class="sidebar__header">Pages</div>
|
||||||
<div class="sidebar__thumbnails">
|
<div class="sidebar__thumbnails">
|
||||||
${this.thumbnailPages.map(
|
${this.thumbnailPages.map((_, i) => {
|
||||||
(_, i) => html`
|
const pageInfo = this.paginationInfo[i];
|
||||||
|
|
||||||
|
return html`
|
||||||
<div
|
<div
|
||||||
class="thumbnail ${currentPage === i + 1 ? "thumbnail--active" : ""}"
|
class="thumbnail ${currentPage === i + 1 ? "thumbnail--active" : ""}"
|
||||||
@click=${() => this.scrollToPage(i + 1)}
|
@click=${() => this.scrollToPage(i + 1)}
|
||||||
@@ -683,13 +695,20 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
.documentSettings=${this.documentSettings}
|
.documentSettings=${this.documentSettings}
|
||||||
.pageNumber=${i + 1}
|
.pageNumber=${i + 1}
|
||||||
.pageTotalNumber=${this.thumbnailPages.length}
|
.pageTotalNumber=${this.thumbnailPages.length}
|
||||||
></dedocument-page>
|
>${pageInfo ? html`
|
||||||
|
<dedocument-contentinvoice
|
||||||
|
.letterData=${this.letterData as unknown as plugins.tsclass.finance.TInvoice}
|
||||||
|
.documentSettings=${this.documentSettings}
|
||||||
|
.renderStartOffset=${pageInfo.startOffset}
|
||||||
|
.renderContentLength=${pageInfo.contentLength}
|
||||||
|
></dedocument-contentinvoice>
|
||||||
|
` : null}</dedocument-page>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="thumbnail__label">${i + 1}</span>
|
<span class="thumbnail__label">${i + 1}</span>
|
||||||
</div>
|
</div>
|
||||||
`
|
`;
|
||||||
)}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="sidebar__resize-handle"
|
class="sidebar__resize-handle"
|
||||||
@@ -1004,7 +1023,7 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
document.body.style.userSelect = "";
|
document.body.style.userSelect = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("mousemove", onMouseMove);
|
document.addEventListener("mousemove", onMouseMove, { passive: true });
|
||||||
document.addEventListener("mouseup", onMouseUp);
|
document.addEventListener("mouseup", onMouseUp);
|
||||||
document.body.style.cursor = "ew-resize";
|
document.body.style.cursor = "ew-resize";
|
||||||
document.body.style.userSelect = "none";
|
document.body.style.userSelect = "none";
|
||||||
@@ -1210,6 +1229,15 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
setTimeout(() => this.updateDisplayZoom(), 200);
|
setTimeout(() => this.updateDisplayZoom(), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Listen for pagination-complete event from DeDocument
|
||||||
|
this.addEventListener('pagination-complete', (e: CustomEvent) => {
|
||||||
|
this.paginationInfo = e.detail.paginationInfo;
|
||||||
|
const pageCount = e.detail.pageCount;
|
||||||
|
if (pageCount !== this.thumbnailPages.length) {
|
||||||
|
this.thumbnailPages = Array.from({ length: pageCount }, (_, i) => i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Handle viewport resize and scroll
|
// Handle viewport resize and scroll
|
||||||
const viewport = this.shadowRoot?.querySelector(".viewport");
|
const viewport = this.shadowRoot?.querySelector(".viewport");
|
||||||
if (viewport) {
|
if (viewport) {
|
||||||
|
|||||||
Reference in New Issue
Block a user