@design.estate/dees-document 1.6.7 → 1.6.9
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 +87 -58
- 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 +51 -19
- package/dist_ts_web/elements/document.d.ts +1 -0
- package/dist_ts_web/elements/document.js +20 -9
- package/dist_ts_web/elements/page.js +1 -3
- package/dist_ts_web/elements/pagecontent.js +1 -3
- package/dist_watch/bundle.js +101 -32
- 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 +86 -23
- package/ts_web/elements/document.ts +22 -8
- package/ts_web/elements/page.ts +0 -2
- 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.9",
|
|
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.9',
|
|
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.9',
|
|
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
|
}
|
|
@@ -18,7 +18,6 @@ import * as plugins from '../plugins.js';
|
|
|
18
18
|
|
|
19
19
|
import { dedocumentSharedStyle } from '../style.js';
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
declare global {
|
|
23
22
|
interface HTMLElementTagNameMap {
|
|
24
23
|
'dedocument-contentinvoice': DeContentInvoice;
|
|
@@ -175,7 +174,6 @@ export class DeContentInvoice extends DeesElement {
|
|
|
175
174
|
(await this.getContentNodes()).trimmedContent.append(
|
|
176
175
|
(await this.getContentNodes()).currentContent.children.item(0)
|
|
177
176
|
);
|
|
178
|
-
console.log('hey' + this.shadowRoot.children.length);
|
|
179
177
|
}
|
|
180
178
|
if (
|
|
181
179
|
(await this.getContentNodes()).currentContent.children
|
|
@@ -220,14 +218,26 @@ export class DeContentInvoice extends DeesElement {
|
|
|
220
218
|
border-right: 1px dashed #ccc;
|
|
221
219
|
}
|
|
222
220
|
|
|
221
|
+
.lineItem:last-child {
|
|
222
|
+
border-right: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
223
225
|
.lineItem.rightAlign {
|
|
224
226
|
text-align: right;
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
.invoiceLine {
|
|
230
|
+
background: #ffffff00;
|
|
228
231
|
border-bottom: 1px dotted #ccc;
|
|
229
232
|
}
|
|
230
233
|
|
|
234
|
+
.invoiceLine.highlighted {
|
|
235
|
+
transition: background 0.2s;
|
|
236
|
+
background: #ffc18f;
|
|
237
|
+
border: 1px solid #ff9d4d;
|
|
238
|
+
box-sizing: content-box;
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
.sums {
|
|
232
242
|
margin-top: 5px;
|
|
233
243
|
font-size: 12px;
|
|
@@ -287,33 +297,77 @@ export class DeContentInvoice extends DeesElement {
|
|
|
287
297
|
</style>
|
|
288
298
|
<div>We hereby invoice products and services provided to you by Lossless GmbH:</div>
|
|
289
299
|
<div class="grid topLine dataHeader">
|
|
290
|
-
<div class="lineItem rightAlign"
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
300
|
+
<div class="lineItem rightAlign">
|
|
301
|
+
${plugins.shared.translation.translate(
|
|
302
|
+
this.documentSettings.languageCode,
|
|
303
|
+
'itemPos',
|
|
304
|
+
'Item Pos.'
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
307
|
+
<div class="lineItem">
|
|
308
|
+
${plugins.shared.translation.translate(
|
|
309
|
+
this.documentSettings.languageCode,
|
|
310
|
+
'description',
|
|
311
|
+
'Description'
|
|
312
|
+
)}
|
|
313
|
+
</div>
|
|
314
|
+
<div class="lineItem rightAlign">
|
|
315
|
+
${plugins.shared.translation.translate(
|
|
316
|
+
this.documentSettings.languageCode,
|
|
317
|
+
'quantity',
|
|
318
|
+
'Quantity'
|
|
319
|
+
)}
|
|
320
|
+
</div>
|
|
321
|
+
<div class="lineItem">
|
|
322
|
+
${plugins.shared.translation.translate(
|
|
323
|
+
this.documentSettings.languageCode,
|
|
324
|
+
'unitType',
|
|
325
|
+
'Unit Type'
|
|
326
|
+
)}
|
|
327
|
+
</div>
|
|
328
|
+
<div class="lineItem rightAlign">
|
|
329
|
+
${plugins.shared.translation.translate(
|
|
330
|
+
this.documentSettings.languageCode,
|
|
331
|
+
'unitNetPrice',
|
|
332
|
+
'Unit Net Price'
|
|
333
|
+
)}
|
|
334
|
+
</div>
|
|
335
|
+
<div class="lineItem rightAlign">
|
|
336
|
+
${plugins.shared.translation.translate(
|
|
337
|
+
this.documentSettings.languageCode,
|
|
338
|
+
'totalNetPrice',
|
|
339
|
+
'Total Net Price'
|
|
340
|
+
)}
|
|
341
|
+
</div>
|
|
342
|
+
<div class="lineItem rightAlign">
|
|
343
|
+
${plugins.shared.translation.translate(
|
|
344
|
+
this.documentSettings.languageCode,
|
|
345
|
+
'vatShort',
|
|
346
|
+
'VAT'
|
|
347
|
+
)}
|
|
348
|
+
</div>
|
|
297
349
|
</div>
|
|
298
350
|
${(() => {
|
|
299
351
|
let counter = 1;
|
|
300
|
-
return this.letterData?.content.invoiceData?.items?.map(
|
|
301
|
-
|
|
302
|
-
|
|
352
|
+
return this.letterData?.content.invoiceData?.items?.map((invoiceItem) => {
|
|
353
|
+
const isHighlighted = false; // TODO: implement rest of highlight logic
|
|
354
|
+
return html`
|
|
355
|
+
<div class="grid invoiceLine needsDataHeader ${isHighlighted ? 'highlighted' : ''}">
|
|
303
356
|
<div class="lineItem rightAlign">${counter++}</div>
|
|
304
357
|
<div class="lineItem">${invoiceItem.name}</div>
|
|
305
358
|
<div class="lineItem rightAlign">${invoiceItem.unitQuantity}</div>
|
|
306
359
|
<div class="lineItem">${invoiceItem.unitType}</div>
|
|
307
|
-
<div class="lineItem rightAlign">${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}</div>
|
|
308
360
|
<div class="lineItem rightAlign">
|
|
309
|
-
${invoiceItem.
|
|
361
|
+
${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}
|
|
310
362
|
</div>
|
|
311
363
|
<div class="lineItem rightAlign">
|
|
312
|
-
${invoiceItem.
|
|
364
|
+
${invoiceItem.unitQuantity * invoiceItem.unitNetPrice}
|
|
365
|
+
${this.letterData?.content.invoiceData.currency}
|
|
313
366
|
</div>
|
|
367
|
+
<div class="lineItem rightAlign">${invoiceItem.vatPercentage}%</div>
|
|
314
368
|
</div>
|
|
315
|
-
|
|
316
|
-
);
|
|
369
|
+
`;
|
|
370
|
+
});
|
|
317
371
|
})()}
|
|
318
372
|
<div class="sums">
|
|
319
373
|
<div class="sumline">
|
|
@@ -332,9 +386,13 @@ export class DeContentInvoice extends DeesElement {
|
|
|
332
386
|
<div class="sumline">
|
|
333
387
|
<div class="label">
|
|
334
388
|
Vat ${vatGroupArg.vatPercentage}%
|
|
335
|
-
${this.documentSettings.vatGroupPositions
|
|
336
|
-
|
|
337
|
-
|
|
389
|
+
${this.documentSettings.vatGroupPositions
|
|
390
|
+
? html`
|
|
391
|
+
<br /><span style="font-weight: normal"
|
|
392
|
+
>(on item positions: ${itemNumbers})</span
|
|
393
|
+
>
|
|
394
|
+
`
|
|
395
|
+
: html``}
|
|
338
396
|
</div>
|
|
339
397
|
<div class="value">${vatGroupArg.vatAmountSum} EUR</div>
|
|
340
398
|
</div>
|
|
@@ -349,7 +407,11 @@ export class DeContentInvoice extends DeesElement {
|
|
|
349
407
|
${this.letterData?.content.invoiceData.reverseCharge
|
|
350
408
|
? html`
|
|
351
409
|
<div class="taxNote">
|
|
352
|
-
${plugins.shared.translation.translate(
|
|
410
|
+
${plugins.shared.translation.translate(
|
|
411
|
+
this.documentSettings.languageCode,
|
|
412
|
+
'reverseVatNote',
|
|
413
|
+
'VAT arises on a reverse charge basis and is payable by the customer.'
|
|
414
|
+
)}
|
|
353
415
|
</div>
|
|
354
416
|
`
|
|
355
417
|
: ``}
|
|
@@ -369,7 +431,9 @@ export class DeContentInvoice extends DeesElement {
|
|
|
369
431
|
<div class="infoBox">
|
|
370
432
|
<div class="label">Referenced contract:</div>
|
|
371
433
|
This invoice is adhering to agreements made by contract between the parties on
|
|
372
|
-
${plugins.smarttime.ExtendedDate.fromMillis(
|
|
434
|
+
${plugins.smarttime.ExtendedDate.fromMillis(
|
|
435
|
+
this.letterData?.content.contractData.contractDate
|
|
436
|
+
).format('MMMM D, YYYY')}.
|
|
373
437
|
</div>
|
|
374
438
|
`
|
|
375
439
|
: html``}
|
|
@@ -396,7 +460,6 @@ ${this.letterData.content.invoiceData.id}
|
|
|
396
460
|
EPC QR Code`,
|
|
397
461
|
(error) => {
|
|
398
462
|
if (error) console.error(error);
|
|
399
|
-
console.log('success!');
|
|
400
463
|
}
|
|
401
464
|
);
|
|
402
465
|
contentNodes.currentContent.querySelector('.paymentCode').append(canvas);
|
|
@@ -161,6 +161,7 @@ export class DeDocument extends DeesElement {
|
|
|
161
161
|
|
|
162
162
|
public latestDocumentSettings: plugins.shared.interfaces.IDocumentSettings = null;
|
|
163
163
|
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
|
164
|
+
public cleanupStore: any[] = [];
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
public async renderDocument() {
|
|
@@ -168,11 +169,12 @@ export class DeDocument extends DeesElement {
|
|
|
168
169
|
this.latestDocumentSettings = this.documentSettings;
|
|
169
170
|
this.latestRenderedLetterData = this.letterData;
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
const cleanUpStoreCurrentRender = [];
|
|
173
|
+
const cleanUpStoreNextRender = [];
|
|
173
174
|
|
|
174
175
|
const domtools = await this.domtoolsPromise;
|
|
175
176
|
const documentBuildContainer = document.createElement('div');
|
|
177
|
+
cleanUpStoreCurrentRender.push(documentBuildContainer);
|
|
176
178
|
document.body.appendChild(documentBuildContainer);
|
|
177
179
|
|
|
178
180
|
let pages: DePage[] = [];
|
|
@@ -181,6 +183,7 @@ export class DeDocument extends DeesElement {
|
|
|
181
183
|
|
|
182
184
|
// lets append the content
|
|
183
185
|
const content: DeContentInvoice = new DeContentInvoice();
|
|
186
|
+
cleanUpStoreCurrentRender.push(content);
|
|
184
187
|
content.letterData = this.letterData;
|
|
185
188
|
content.documentSettings = this.documentSettings;
|
|
186
189
|
document.body.appendChild(content);
|
|
@@ -192,6 +195,7 @@ export class DeDocument extends DeesElement {
|
|
|
192
195
|
while (!complete) {
|
|
193
196
|
pageCounter++;
|
|
194
197
|
const currentContent = content.cloneNode(true) as DeContentInvoice;
|
|
198
|
+
cleanUpStoreNextRender.push(currentContent);
|
|
195
199
|
const newPage = new DePage();
|
|
196
200
|
newPage.printMode = this.printMode;
|
|
197
201
|
newPage.letterData = this.letterData;
|
|
@@ -200,6 +204,9 @@ export class DeDocument extends DeesElement {
|
|
|
200
204
|
newPage.pageNumber = pageCounter;
|
|
201
205
|
newPage.append(currentContent);
|
|
202
206
|
newPage.pageTotalNumber = pageCounter;
|
|
207
|
+
|
|
208
|
+
// store current page
|
|
209
|
+
cleanUpStoreNextRender.push(newPage);
|
|
203
210
|
documentBuildContainer.append(newPage);
|
|
204
211
|
|
|
205
212
|
await currentContent.elementDomReady;
|
|
@@ -216,16 +223,24 @@ export class DeDocument extends DeesElement {
|
|
|
216
223
|
if (trimmed === 0) {
|
|
217
224
|
complete = true;
|
|
218
225
|
}
|
|
219
|
-
// complete = true;
|
|
220
|
-
console.log(currentContentOffset);
|
|
221
226
|
}
|
|
222
|
-
|
|
223
|
-
|
|
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
|
+
});
|
|
224
236
|
|
|
225
237
|
const documentContainer = this.shadowRoot.querySelector('.documentContainer');
|
|
226
238
|
if (documentContainer) {
|
|
227
239
|
const children = Array.from(documentContainer.children);
|
|
228
|
-
children.forEach((child) =>
|
|
240
|
+
children.forEach((child) => {
|
|
241
|
+
documentContainer.removeChild(child);
|
|
242
|
+
child.remove();
|
|
243
|
+
});
|
|
229
244
|
}
|
|
230
245
|
for (const page of pages) {
|
|
231
246
|
page.pageTotalNumber = pageCounter;
|
|
@@ -269,7 +284,6 @@ export class DeDocument extends DeesElement {
|
|
|
269
284
|
}
|
|
270
285
|
if (this.viewWidth) {
|
|
271
286
|
page.viewWidth = this.viewWidth;
|
|
272
|
-
console.log('setting viewWidth: ', this.viewWidth);
|
|
273
287
|
}
|
|
274
288
|
});
|
|
275
289
|
}
|
package/ts_web/elements/page.ts
CHANGED
|
@@ -196,7 +196,6 @@ export class DePage extends DeesElement {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
private adjustScaling() {
|
|
199
|
-
console.log('page scale adjustment triggered.');
|
|
200
199
|
const scaleWrapper: HTMLDivElement = this.shadowRoot.querySelector('#scaleWrapper');
|
|
201
200
|
|
|
202
201
|
if (!scaleWrapper) return;
|
|
@@ -207,7 +206,6 @@ export class DePage extends DeesElement {
|
|
|
207
206
|
} else if (this.viewWidth) {
|
|
208
207
|
scale = this.viewWidth / plugins.shared.a4Width;
|
|
209
208
|
}
|
|
210
|
-
console.log(`new scale is ${scale}`);
|
|
211
209
|
scaleWrapper.style.transform = `scale(${scale})`;
|
|
212
210
|
|
|
213
211
|
// Adjust the outer dimensions so they match the scaled content
|
|
@@ -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
|
}
|