@design.estate/dees-document 1.5.3 → 1.6.2
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 +131 -114
- package/dist_bundle/bundle.js.map +3 -3
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts_shared/demoletter.js +3 -3
- package/dist_ts_shared/interfaces/document.d.ts +1 -0
- package/dist_ts_shared/interfaces/index.d.ts +0 -1
- package/dist_ts_shared/interfaces/index.js +1 -2
- package/dist_ts_shared/translation.d.ts +25 -13
- package/dist_ts_shared/translation.js +25 -18
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/contentinvoice.js +26 -12
- package/dist_ts_web/elements/document.d.ts +1 -0
- package/dist_ts_web/elements/document.js +17 -3
- package/dist_ts_web/elements/page.js +2 -1
- package/dist_ts_web/elements/pagecontent.js +2 -1
- package/dist_watch/bundle.js +53 -28
- package/dist_watch/bundle.js.map +2 -2
- package/package.json +2 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/contentinvoice.ts +25 -11
- package/ts_web/elements/document.ts +19 -4
- package/ts_web/elements/page.ts +1 -0
- package/ts_web/elements/pagecontent.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-document",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.2",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@git.zone/tsbuild": "^2.2.0",
|
|
34
34
|
"@git.zone/tsbundle": "^2.1.0",
|
|
35
35
|
"@git.zone/tstest": "^1.0.90",
|
|
36
|
-
"@git.zone/tswatch": "^2.0.
|
|
36
|
+
"@git.zone/tswatch": "^2.0.34",
|
|
37
37
|
"@push.rocks/projectinfo": "^5.0.2",
|
|
38
38
|
"@push.rocks/tapbundle": "^5.5.3"
|
|
39
39
|
},
|
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
|
+
version: '1.6.2',
|
|
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
|
+
version: '1.6.2',
|
|
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
|
}
|
|
@@ -59,6 +59,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
59
59
|
css`
|
|
60
60
|
:host {
|
|
61
61
|
color: #333;
|
|
62
|
+
font-family: inherit;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
.trimmedContent {
|
|
@@ -204,7 +205,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
204
205
|
<style>
|
|
205
206
|
.grid {
|
|
206
207
|
display: grid;
|
|
207
|
-
grid-template-columns: 40px auto
|
|
208
|
+
grid-template-columns: 40px auto 60px 60px 84px 84px 46px;
|
|
208
209
|
}
|
|
209
210
|
.topLine {
|
|
210
211
|
margin-top: 5px;
|
|
@@ -214,6 +215,12 @@ export class DeContentInvoice extends DeesElement {
|
|
|
214
215
|
.lineItem {
|
|
215
216
|
font-size: 12px;
|
|
216
217
|
padding: 5px;
|
|
218
|
+
font-family: 'Dees Code', monospace;
|
|
219
|
+
border-right: 1px dashed #ccc;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.lineItem.rightAlign {
|
|
223
|
+
text-align: right;
|
|
217
224
|
}
|
|
218
225
|
|
|
219
226
|
.invoiceLine {
|
|
@@ -224,6 +231,7 @@ export class DeContentInvoice extends DeesElement {
|
|
|
224
231
|
margin-top: 5px;
|
|
225
232
|
font-size: 12px;
|
|
226
233
|
padding-left: 50%;
|
|
234
|
+
font-family: 'Dees Code', monospace;
|
|
227
235
|
}
|
|
228
236
|
|
|
229
237
|
.sums .sumline {
|
|
@@ -279,26 +287,30 @@ export class DeContentInvoice extends DeesElement {
|
|
|
279
287
|
</style>
|
|
280
288
|
<div>We hereby invoice products and services provided to you by Lossless GmbH:</div>
|
|
281
289
|
<div class="grid topLine dataHeader">
|
|
282
|
-
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'itemPos', 'Item Pos.')}</div>
|
|
290
|
+
<div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'itemPos', 'Item Pos.')}</div>
|
|
283
291
|
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'description', 'Description')}</div>
|
|
284
|
-
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'quantity', 'Quantity')}</div>
|
|
292
|
+
<div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'quantity', 'Quantity')}</div>
|
|
285
293
|
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'unitType', 'Unit Type')}</div>
|
|
286
|
-
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'unitNetPrice', 'Unit Net Price')}</div>
|
|
287
|
-
<div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'totalNetPrice', 'Total Net Price')}</div>
|
|
294
|
+
<div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'unitNetPrice', 'Unit Net Price')}</div>
|
|
295
|
+
<div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'totalNetPrice', 'Total Net Price')}</div>
|
|
296
|
+
<div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'vatShort', 'VAT')}</div>
|
|
288
297
|
</div>
|
|
289
298
|
${(() => {
|
|
290
299
|
let counter = 1;
|
|
291
300
|
return this.letterData?.content.invoiceData?.items?.map(
|
|
292
301
|
(invoiceItem) => html`
|
|
293
302
|
<div class="grid invoiceLine needsDataHeader">
|
|
294
|
-
<div class="lineItem">${counter++}</div>
|
|
303
|
+
<div class="lineItem rightAlign">${counter++}</div>
|
|
295
304
|
<div class="lineItem">${invoiceItem.name}</div>
|
|
296
|
-
<div class="lineItem">${invoiceItem.unitQuantity}</div>
|
|
305
|
+
<div class="lineItem rightAlign">${invoiceItem.unitQuantity}</div>
|
|
297
306
|
<div class="lineItem">${invoiceItem.unitType}</div>
|
|
298
|
-
<div class="lineItem">${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}</div>
|
|
299
|
-
<div class="lineItem">
|
|
307
|
+
<div class="lineItem rightAlign">${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}</div>
|
|
308
|
+
<div class="lineItem rightAlign">
|
|
300
309
|
${invoiceItem.unitQuantity * invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}
|
|
301
310
|
</div>
|
|
311
|
+
<div class="lineItem rightAlign">
|
|
312
|
+
${invoiceItem.vatPercentage}%
|
|
313
|
+
</div>
|
|
302
314
|
</div>
|
|
303
315
|
`
|
|
304
316
|
);
|
|
@@ -317,8 +329,10 @@ export class DeContentInvoice extends DeesElement {
|
|
|
317
329
|
return html`
|
|
318
330
|
<div class="sumline">
|
|
319
331
|
<div class="label">
|
|
320
|
-
Vat ${vatGroupArg.vatPercentage}
|
|
321
|
-
|
|
332
|
+
Vat ${vatGroupArg.vatPercentage}%
|
|
333
|
+
${this.documentSettings.vatGroupPositions ? html`
|
|
334
|
+
<br /><span style="font-weight: normal">(on item positions: ${itemNumbers})</span>
|
|
335
|
+
` : html``}
|
|
322
336
|
</div>
|
|
323
337
|
<div class="value">${vatGroupArg.vatAmountSum} EUR</div>
|
|
324
338
|
</div>
|
|
@@ -16,6 +16,8 @@ export const defaultDocumentSettings: plugins.shared.interfaces.IDocumentSetting
|
|
|
16
16
|
enableTopDraftText: true,
|
|
17
17
|
enableDefaultHeader: true,
|
|
18
18
|
enableDefaultFooter: true,
|
|
19
|
+
languageCode: 'EN',
|
|
20
|
+
vatGroupPositions: true,
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
|
|
@@ -97,6 +99,7 @@ export class DeDocument extends DeesElement {
|
|
|
97
99
|
color: #333;
|
|
98
100
|
padding: 0px;
|
|
99
101
|
position: relative;
|
|
102
|
+
font-family: 'Dees Sans', sans-serif;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
.betweenPagesSpacer {
|
|
@@ -112,6 +115,12 @@ export class DeDocument extends DeesElement {
|
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
public async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) {
|
|
118
|
+
domtools.plugins.smartdelay.delayFor(0).then(() => {
|
|
119
|
+
this.documentSettings = {
|
|
120
|
+
...defaultDocumentSettings,
|
|
121
|
+
...this.documentSettings,
|
|
122
|
+
}
|
|
123
|
+
});
|
|
115
124
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
116
125
|
for (const entry of entries) {
|
|
117
126
|
const width = entry.contentRect.width;
|
|
@@ -126,13 +135,19 @@ export class DeDocument extends DeesElement {
|
|
|
126
135
|
})
|
|
127
136
|
}
|
|
128
137
|
|
|
138
|
+
public latestDocumentSettings: plugins.shared.interfaces.IDocumentSettings = null;
|
|
129
139
|
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
|
130
140
|
|
|
131
141
|
|
|
132
142
|
public async renderDocument() {
|
|
133
|
-
const domtools = await this.domtoolsPromise;
|
|
134
|
-
|
|
135
143
|
|
|
144
|
+
this.latestDocumentSettings = this.documentSettings;
|
|
145
|
+
this.latestRenderedLetterData = this.letterData;
|
|
146
|
+
|
|
147
|
+
console.log(`rendering with settings:`);
|
|
148
|
+
console.log(this.latestDocumentSettings);
|
|
149
|
+
|
|
150
|
+
const domtools = await this.domtoolsPromise;
|
|
136
151
|
const documentBuildContainer = document.createElement('div');
|
|
137
152
|
document.body.appendChild(documentBuildContainer);
|
|
138
153
|
|
|
@@ -199,13 +214,13 @@ export class DeDocument extends DeesElement {
|
|
|
199
214
|
}
|
|
200
215
|
}
|
|
201
216
|
this.adjustDePageScaling();
|
|
202
|
-
this.latestRenderedLetterData = this.letterData;
|
|
203
217
|
}
|
|
204
218
|
|
|
205
219
|
async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
|
206
220
|
super.updated(changedProperties);
|
|
207
221
|
const domtools = await this.domtoolsPromise;
|
|
208
|
-
|
|
222
|
+
let renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData)
|
|
223
|
+
&& domtools.convenience.smartjson.deepEqualObjects(this.documentSettings, this.latestDocumentSettings);
|
|
209
224
|
if (!renderedDocIsUpToDate) {
|
|
210
225
|
this.renderDocument();
|
|
211
226
|
}
|
package/ts_web/elements/page.ts
CHANGED