@design.estate/dees-document 1.6.6 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +24 -23
- package/dist_bundle/bundle.js.map +3 -3
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/contentinvoice.js +1 -3
- package/dist_ts_web/elements/document.d.ts +1 -0
- package/dist_ts_web/elements/document.js +44 -10
- package/dist_ts_web/elements/page.js +2 -4
- package/dist_ts_web/elements/pagecontent.js +1 -3
- package/dist_watch/bundle.js +44 -18
- package/dist_watch/bundle.js.map +2 -2
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/contentinvoice.ts +0 -2
- package/ts_web/elements/document.ts +47 -9
- package/ts_web/elements/page.ts +1 -3
- package/ts_web/elements/pagecontent.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-document",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.",
|
|
6
6
|
"main": "dist_ts_web/index.js",
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-document',
|
|
6
|
-
version: '1.6.
|
|
6
|
+
version: '1.6.8',
|
|
7
7
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-document',
|
|
6
|
-
version: '1.6.
|
|
6
|
+
version: '1.6.8',
|
|
7
7
|
description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.'
|
|
8
8
|
}
|
|
@@ -175,7 +175,6 @@ export class DeContentInvoice extends DeesElement {
|
|
|
175
175
|
(await this.getContentNodes()).trimmedContent.append(
|
|
176
176
|
(await this.getContentNodes()).currentContent.children.item(0)
|
|
177
177
|
);
|
|
178
|
-
console.log('hey' + this.shadowRoot.children.length);
|
|
179
178
|
}
|
|
180
179
|
if (
|
|
181
180
|
(await this.getContentNodes()).currentContent.children
|
|
@@ -396,7 +395,6 @@ ${this.letterData.content.invoiceData.id}
|
|
|
396
395
|
EPC QR Code`,
|
|
397
396
|
(error) => {
|
|
398
397
|
if (error) console.error(error);
|
|
399
|
-
console.log('success!');
|
|
400
398
|
}
|
|
401
399
|
);
|
|
402
400
|
contentNodes.currentContent.querySelector('.paymentCode').append(canvas);
|
|
@@ -115,11 +115,35 @@ export class DeDocument extends DeesElement {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
public async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) {
|
|
118
|
-
domtools.plugins.smartdelay.delayFor(0).then(() => {
|
|
118
|
+
domtools.plugins.smartdelay.delayFor(0).then(async () => {
|
|
119
119
|
this.documentSettings = {
|
|
120
120
|
...defaultDocumentSettings,
|
|
121
121
|
...this.documentSettings,
|
|
122
122
|
}
|
|
123
|
+
|
|
124
|
+
while (false) {
|
|
125
|
+
await domtools.plugins.smartdelay.delayFor(1000);
|
|
126
|
+
this.letterData = {
|
|
127
|
+
...this.letterData,
|
|
128
|
+
content: {
|
|
129
|
+
...this.letterData.content,
|
|
130
|
+
invoiceData: {
|
|
131
|
+
...this.letterData.content.invoiceData,
|
|
132
|
+
items: [
|
|
133
|
+
...this.letterData.content.invoiceData.items,
|
|
134
|
+
{
|
|
135
|
+
name: 'Test Item',
|
|
136
|
+
unitQuantity: 1,
|
|
137
|
+
unitNetPrice: 100,
|
|
138
|
+
unitType: 'hours',
|
|
139
|
+
vatPercentage: 19,
|
|
140
|
+
position: 1,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
123
147
|
});
|
|
124
148
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
125
149
|
for (const entry of entries) {
|
|
@@ -137,6 +161,7 @@ export class DeDocument extends DeesElement {
|
|
|
137
161
|
|
|
138
162
|
public latestDocumentSettings: plugins.shared.interfaces.IDocumentSettings = null;
|
|
139
163
|
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
|
164
|
+
public cleanupStore: any[] = [];
|
|
140
165
|
|
|
141
166
|
|
|
142
167
|
public async renderDocument() {
|
|
@@ -144,11 +169,12 @@ export class DeDocument extends DeesElement {
|
|
|
144
169
|
this.latestDocumentSettings = this.documentSettings;
|
|
145
170
|
this.latestRenderedLetterData = this.letterData;
|
|
146
171
|
|
|
147
|
-
|
|
148
|
-
|
|
172
|
+
const cleanUpStoreCurrentRender = [];
|
|
173
|
+
const cleanUpStoreNextRender = [];
|
|
149
174
|
|
|
150
175
|
const domtools = await this.domtoolsPromise;
|
|
151
176
|
const documentBuildContainer = document.createElement('div');
|
|
177
|
+
cleanUpStoreCurrentRender.push(documentBuildContainer);
|
|
152
178
|
document.body.appendChild(documentBuildContainer);
|
|
153
179
|
|
|
154
180
|
let pages: DePage[] = [];
|
|
@@ -157,6 +183,7 @@ export class DeDocument extends DeesElement {
|
|
|
157
183
|
|
|
158
184
|
// lets append the content
|
|
159
185
|
const content: DeContentInvoice = new DeContentInvoice();
|
|
186
|
+
cleanUpStoreCurrentRender.push(content);
|
|
160
187
|
content.letterData = this.letterData;
|
|
161
188
|
content.documentSettings = this.documentSettings;
|
|
162
189
|
document.body.appendChild(content);
|
|
@@ -168,6 +195,7 @@ export class DeDocument extends DeesElement {
|
|
|
168
195
|
while (!complete) {
|
|
169
196
|
pageCounter++;
|
|
170
197
|
const currentContent = content.cloneNode(true) as DeContentInvoice;
|
|
198
|
+
cleanUpStoreNextRender.push(currentContent);
|
|
171
199
|
const newPage = new DePage();
|
|
172
200
|
newPage.printMode = this.printMode;
|
|
173
201
|
newPage.letterData = this.letterData;
|
|
@@ -176,6 +204,9 @@ export class DeDocument extends DeesElement {
|
|
|
176
204
|
newPage.pageNumber = pageCounter;
|
|
177
205
|
newPage.append(currentContent);
|
|
178
206
|
newPage.pageTotalNumber = pageCounter;
|
|
207
|
+
|
|
208
|
+
// store current page
|
|
209
|
+
cleanUpStoreNextRender.push(newPage);
|
|
179
210
|
documentBuildContainer.append(newPage);
|
|
180
211
|
|
|
181
212
|
await currentContent.elementDomReady;
|
|
@@ -192,16 +223,24 @@ export class DeDocument extends DeesElement {
|
|
|
192
223
|
if (trimmed === 0) {
|
|
193
224
|
complete = true;
|
|
194
225
|
}
|
|
195
|
-
// complete = true;
|
|
196
|
-
console.log(currentContentOffset);
|
|
197
226
|
}
|
|
198
|
-
|
|
199
|
-
|
|
227
|
+
|
|
228
|
+
for (const cleanUp of this.cleanupStore) {
|
|
229
|
+
cleanUp.remove();
|
|
230
|
+
}
|
|
231
|
+
this.cleanupStore = cleanUpStoreNextRender
|
|
232
|
+
|
|
233
|
+
cleanUpStoreCurrentRender.forEach((cleanUp) => {
|
|
234
|
+
cleanUp.remove();
|
|
235
|
+
});
|
|
200
236
|
|
|
201
237
|
const documentContainer = this.shadowRoot.querySelector('.documentContainer');
|
|
202
238
|
if (documentContainer) {
|
|
203
239
|
const children = Array.from(documentContainer.children);
|
|
204
|
-
children.forEach((child) =>
|
|
240
|
+
children.forEach((child) => {
|
|
241
|
+
documentContainer.removeChild(child);
|
|
242
|
+
child.remove();
|
|
243
|
+
});
|
|
205
244
|
}
|
|
206
245
|
for (const page of pages) {
|
|
207
246
|
page.pageTotalNumber = pageCounter;
|
|
@@ -245,7 +284,6 @@ export class DeDocument extends DeesElement {
|
|
|
245
284
|
}
|
|
246
285
|
if (this.viewWidth) {
|
|
247
286
|
page.viewWidth = this.viewWidth;
|
|
248
|
-
console.log('setting viewWidth: ', this.viewWidth);
|
|
249
287
|
}
|
|
250
288
|
});
|
|
251
289
|
}
|
package/ts_web/elements/page.ts
CHANGED
|
@@ -77,6 +77,7 @@ export class DePage extends DeesElement {
|
|
|
77
77
|
css`
|
|
78
78
|
:host {
|
|
79
79
|
display: block;
|
|
80
|
+
overflow: hidden;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
#scaleWrapper {
|
|
@@ -195,7 +196,6 @@ export class DePage extends DeesElement {
|
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
private adjustScaling() {
|
|
198
|
-
console.log('page scale adjustment triggered.');
|
|
199
199
|
const scaleWrapper: HTMLDivElement = this.shadowRoot.querySelector('#scaleWrapper');
|
|
200
200
|
|
|
201
201
|
if (!scaleWrapper) return;
|
|
@@ -206,12 +206,10 @@ export class DePage extends DeesElement {
|
|
|
206
206
|
} else if (this.viewWidth) {
|
|
207
207
|
scale = this.viewWidth / plugins.shared.a4Width;
|
|
208
208
|
}
|
|
209
|
-
console.log(`new scale is ${scale}`);
|
|
210
209
|
scaleWrapper.style.transform = `scale(${scale})`;
|
|
211
210
|
|
|
212
211
|
// Adjust the outer dimensions so they match the scaled content
|
|
213
212
|
|
|
214
|
-
this.style.overflow = 'hidden';
|
|
215
213
|
this.style.width = `${plugins.shared.a4Width * scale}px`;
|
|
216
214
|
this.style.height = `${plugins.shared.a4Height * scale}px`;
|
|
217
215
|
}
|
|
@@ -138,10 +138,8 @@ export class DePageContent extends DeesElement {
|
|
|
138
138
|
await this.elementDomReady;
|
|
139
139
|
const contentContainer = this.shadowRoot.querySelector('.content');
|
|
140
140
|
if (contentContainer.scrollHeight > contentContainer.clientHeight) {
|
|
141
|
-
console.log('overflows');
|
|
142
141
|
return true;
|
|
143
142
|
} else {
|
|
144
|
-
console.log('does not overflow!');
|
|
145
143
|
return false;
|
|
146
144
|
}
|
|
147
145
|
}
|