@design.estate/dees-document 1.6.7 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-document",
3
- "version": "1.6.7",
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",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-document',
6
- version: '1.6.7',
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.7',
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);
@@ -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
- console.log(`rendering with settings:`);
172
- console.log(this.latestDocumentSettings);
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
- document.body.removeChild(content);
223
- document.body.removeChild(documentBuildContainer);
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) => documentContainer.removeChild(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
  }
@@ -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
  }