@design.estate/dees-document 1.5.3 → 1.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-document",
3
- "version": "1.5.3",
3
+ "version": "1.6.3",
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.25",
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
  },
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-document',
6
- version: '1.5.3',
6
+ version: '1.6.3',
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.5.3',
6
+ version: '1.6.3',
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: 'Exo 2';
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 80px 80px 90px 90px;
208
+ grid-template-columns: 40px auto 60px 60px 84px 84px 46px;
208
209
  }
209
210
  .topLine {
210
211
  margin-top: 5px;
@@ -214,6 +215,11 @@ export class DeContentInvoice extends DeesElement {
214
215
  .lineItem {
215
216
  font-size: 12px;
216
217
  padding: 5px;
218
+ border-right: 1px dashed #ccc;
219
+ }
220
+
221
+ .lineItem.rightAlign {
222
+ text-align: right;
217
223
  }
218
224
 
219
225
  .invoiceLine {
@@ -224,6 +230,7 @@ export class DeContentInvoice extends DeesElement {
224
230
  margin-top: 5px;
225
231
  font-size: 12px;
226
232
  padding-left: 50%;
233
+ font-family: 'Dees Code', monospace;
227
234
  }
228
235
 
229
236
  .sums .sumline {
@@ -279,26 +286,30 @@ export class DeContentInvoice extends DeesElement {
279
286
  </style>
280
287
  <div>We hereby invoice products and services provided to you by Lossless GmbH:</div>
281
288
  <div class="grid topLine dataHeader">
282
- <div class="lineItem">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'itemPos', 'Item Pos.')}</div>
289
+ <div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'itemPos', 'Item Pos.')}</div>
283
290
  <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>
291
+ <div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'quantity', 'Quantity')}</div>
285
292
  <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>
293
+ <div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'unitNetPrice', 'Unit Net Price')}</div>
294
+ <div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'totalNetPrice', 'Total Net Price')}</div>
295
+ <div class="lineItem rightAlign">${plugins.shared.translation.translate(this.documentSettings.languageCode, 'vatShort', 'VAT')}</div>
288
296
  </div>
289
297
  ${(() => {
290
298
  let counter = 1;
291
299
  return this.letterData?.content.invoiceData?.items?.map(
292
300
  (invoiceItem) => html`
293
301
  <div class="grid invoiceLine needsDataHeader">
294
- <div class="lineItem">${counter++}</div>
302
+ <div class="lineItem rightAlign">${counter++}</div>
295
303
  <div class="lineItem">${invoiceItem.name}</div>
296
- <div class="lineItem">${invoiceItem.unitQuantity}</div>
304
+ <div class="lineItem rightAlign">${invoiceItem.unitQuantity}</div>
297
305
  <div class="lineItem">${invoiceItem.unitType}</div>
298
- <div class="lineItem">${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}</div>
299
- <div class="lineItem">
306
+ <div class="lineItem rightAlign">${invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}</div>
307
+ <div class="lineItem rightAlign">
300
308
  ${invoiceItem.unitQuantity * invoiceItem.unitNetPrice} ${this.letterData?.content.invoiceData.currency}
301
309
  </div>
310
+ <div class="lineItem rightAlign">
311
+ ${invoiceItem.vatPercentage}%
312
+ </div>
302
313
  </div>
303
314
  `
304
315
  );
@@ -317,8 +328,10 @@ export class DeContentInvoice extends DeesElement {
317
328
  return html`
318
329
  <div class="sumline">
319
330
  <div class="label">
320
- Vat ${vatGroupArg.vatPercentage}%<br />
321
- <span style="font-weight: normal">(on item positions: ${itemNumbers})</span>
331
+ Vat ${vatGroupArg.vatPercentage}%
332
+ ${this.documentSettings.vatGroupPositions ? html`
333
+ <br /><span style="font-weight: normal">(on item positions: ${itemNumbers})</span>
334
+ ` : html``}
322
335
  </div>
323
336
  <div class="value">${vatGroupArg.vatAmountSum} EUR</div>
324
337
  </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
- const renderedDocIsUpToDate = domtools.convenience.smartjson.deepEqualObjects(this.letterData, this.latestRenderedLetterData);
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
  }
@@ -77,6 +77,7 @@ export class DePage extends DeesElement {
77
77
  css`
78
78
  :host {
79
79
  display: block;
80
+ font-family: inherit;
80
81
  }
81
82
 
82
83
  #scaleWrapper {
@@ -49,6 +49,7 @@ export class DePageContent extends DeesElement {
49
49
  css`
50
50
  :host {
51
51
  color: #333;
52
+ font-family: inherit;
52
53
  }
53
54
 
54
55
  .content {