@colijnit/sharedcomponents 262.1.11 → 262.1.12
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/3rdpartylicenses.txt +3327 -0
- package/browser/chunk-H5HZ6YB3.js +1 -0
- package/browser/chunk-JXHTPMR7.js +5 -0
- package/browser/chunk-KTNFH73E.js +5 -0
- package/browser/chunk-ZGRJSZN6.js +2 -0
- package/browser/favicon.ico +0 -0
- package/browser/index.html +13 -0
- package/browser/main-F2722GVT.js +289 -0
- package/browser/polyfills-5FDKUQTZ.js +2 -0
- package/browser/styles-JCQQ25VB.css +1 -0
- package/fesm2022/colijnit-sharedcomponents.mjs +46 -40
- package/fesm2022/colijnit-sharedcomponents.mjs.map +1 -1
- package/index.d.ts +3 -3
- package/lib/components/docsign/style/_layout.scss +10 -0
- package/package.json +1 -1
- package/prerendered-routes.json +3 -0
|
@@ -293,7 +293,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
293
293
|
PDFJS.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
294
294
|
class DocsignComponent {
|
|
295
295
|
_changeDetector;
|
|
296
|
-
|
|
296
|
+
pdfContainer;
|
|
297
297
|
/**
|
|
298
298
|
* Load an existing [[PDFDocument]]. The input data can be provided in
|
|
299
299
|
* multiple formats:
|
|
@@ -408,31 +408,40 @@ class DocsignComponent {
|
|
|
408
408
|
this.showSigSeller = false;
|
|
409
409
|
this._savePdf();
|
|
410
410
|
}
|
|
411
|
-
openPdfInNewTab() {
|
|
412
|
-
if (!this._pdf) {
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
const blob = new Blob([this._pdf], {
|
|
416
|
-
type: 'application/pdf'
|
|
417
|
-
});
|
|
418
|
-
const url = URL.createObjectURL(blob);
|
|
419
|
-
window.open(url, '_blank');
|
|
420
|
-
// Optional cleanup later
|
|
421
|
-
setTimeout(() => URL.revokeObjectURL(url), 60_000);
|
|
422
|
-
}
|
|
423
411
|
async _openPDF() {
|
|
424
|
-
this._checkSignatures();
|
|
425
|
-
this.pdfDoc = await PDFDocument.load(this.
|
|
412
|
+
await this._checkSignatures();
|
|
413
|
+
this.pdfDoc = await PDFDocument.load(this._getPdfBytesCopy(), {
|
|
426
414
|
updateMetadata: false
|
|
427
415
|
});
|
|
428
|
-
|
|
429
|
-
this.openPdfInNewTab();
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const pdfDataUri = await this.pdfDoc.saveAsBase64({ dataUri: true });
|
|
433
|
-
this.iframe.nativeElement.src = pdfDataUri;
|
|
416
|
+
await this._renderPdfPages();
|
|
434
417
|
this._changeDetector.detectChanges();
|
|
435
418
|
}
|
|
419
|
+
async _renderPdfPages() {
|
|
420
|
+
const container = this.pdfContainer.nativeElement;
|
|
421
|
+
container.innerHTML = '';
|
|
422
|
+
const pdfReader = await PDFJS.getDocument({
|
|
423
|
+
data: this._getPdfBytesCopy()
|
|
424
|
+
}).promise;
|
|
425
|
+
for (let pageNumber = 1; pageNumber <= pdfReader.numPages; pageNumber++) {
|
|
426
|
+
const page = await pdfReader.getPage(pageNumber);
|
|
427
|
+
const viewport = page.getViewport({ scale: 1.5 });
|
|
428
|
+
const canvas = document.createElement('canvas');
|
|
429
|
+
canvas.className = 'pdf-page';
|
|
430
|
+
canvas.width = viewport.width;
|
|
431
|
+
canvas.height = viewport.height;
|
|
432
|
+
const context = canvas.getContext('2d');
|
|
433
|
+
if (!context) {
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
await page.render({
|
|
437
|
+
canvas,
|
|
438
|
+
canvasContext: context,
|
|
439
|
+
viewport
|
|
440
|
+
}).promise;
|
|
441
|
+
container.appendChild(canvas);
|
|
442
|
+
page.cleanup();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
436
445
|
async _savePdf() {
|
|
437
446
|
if (!this.showSigBuyer && !this.showSigSeller) {
|
|
438
447
|
// ready, save the pdf and emit result
|
|
@@ -444,17 +453,9 @@ class DocsignComponent {
|
|
|
444
453
|
if (!this._pdf) {
|
|
445
454
|
return;
|
|
446
455
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
// (window as any).pdfWorkerSrc) {
|
|
451
|
-
// pdfWorkerSrc = (window as any).pdfWorkerSrc;
|
|
452
|
-
// }
|
|
453
|
-
// else {
|
|
454
|
-
// pdfWorkerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${PDFJS.version}/pdf.worker.min.mjs`;
|
|
455
|
-
// }
|
|
456
|
-
// PDFJS.GlobalWorkerOptions.workerSrc = pdfWorkerSrc;
|
|
457
|
-
const pdfReader = await PDFJS.getDocument(this._pdf).promise;
|
|
456
|
+
const pdfReader = await PDFJS.getDocument({
|
|
457
|
+
data: this._getPdfBytesCopy()
|
|
458
|
+
}).promise;
|
|
458
459
|
const numPages = pdfReader.numPages;
|
|
459
460
|
for (let i = 0; i < numPages; i++) {
|
|
460
461
|
const page = await pdfReader.getPage(i + 1);
|
|
@@ -511,13 +512,18 @@ class DocsignComponent {
|
|
|
511
512
|
}
|
|
512
513
|
this._pdf = bytes;
|
|
513
514
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
515
|
+
_getPdfBytesCopy() {
|
|
516
|
+
if (this._pdf instanceof Uint8Array) {
|
|
517
|
+
return new Uint8Array(this._pdf);
|
|
518
|
+
}
|
|
519
|
+
if (this._pdf instanceof ArrayBuffer) {
|
|
520
|
+
return new Uint8Array(this._pdf.slice(0));
|
|
521
|
+
}
|
|
522
|
+
return new Uint8Array(this._pdf);
|
|
517
523
|
}
|
|
518
524
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DocsignComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
519
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DocsignComponent, isStandalone: false, selector: "co-docsign", inputs: { pdf: "pdf", firstSignatureLabel: "firstSignatureLabel", firstSignatureField: "firstSignatureField", secondSignatureLabel: "secondSignatureLabel", secondSignatureField: "secondSignatureField", saveButtonLabel: "saveButtonLabel", clearButtonLabel: "clearButtonLabel", signDocumentButtonLabel: "signDocumentButtonLabel", cancelButtonLabel: "cancelButtonLabel" }, outputs: { pdfSaved: "pdfSaved", cancelClick: "cancelClick" }, host: { properties: { "class.co-docsign": "this.showClass" } }, viewQueries: [{ propertyName: "
|
|
520
|
-
|
|
525
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DocsignComponent, isStandalone: false, selector: "co-docsign", inputs: { pdf: "pdf", firstSignatureLabel: "firstSignatureLabel", firstSignatureField: "firstSignatureField", secondSignatureLabel: "secondSignatureLabel", secondSignatureField: "secondSignatureField", saveButtonLabel: "saveButtonLabel", clearButtonLabel: "clearButtonLabel", signDocumentButtonLabel: "signDocumentButtonLabel", cancelButtonLabel: "cancelButtonLabel" }, outputs: { pdfSaved: "pdfSaved", cancelClick: "cancelClick" }, host: { properties: { "class.co-docsign": "this.showClass" } }, viewQueries: [{ propertyName: "pdfContainer", first: true, predicate: ["pdfContainer"], descendants: true, read: ElementRef }], ngImport: i0, template: `
|
|
526
|
+
<div #pdfContainer class="pdf-container"></div>
|
|
521
527
|
@if (showSignatures) {
|
|
522
528
|
<co-signatures @showHideSignature
|
|
523
529
|
[showFirstSignature]="showSigBuyer"
|
|
@@ -553,7 +559,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
553
559
|
args: [{
|
|
554
560
|
selector: "co-docsign",
|
|
555
561
|
template: `
|
|
556
|
-
|
|
562
|
+
<div #pdfContainer class="pdf-container"></div>
|
|
557
563
|
@if (showSignatures) {
|
|
558
564
|
<co-signatures @showHideSignature
|
|
559
565
|
[showFirstSignature]="showSigBuyer"
|
|
@@ -587,9 +593,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
587
593
|
encapsulation: ViewEncapsulation.None,
|
|
588
594
|
standalone: false
|
|
589
595
|
}]
|
|
590
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: {
|
|
596
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { pdfContainer: [{
|
|
591
597
|
type: ViewChild,
|
|
592
|
-
args: [
|
|
598
|
+
args: ['pdfContainer', { read: ElementRef }]
|
|
593
599
|
}], pdf: [{
|
|
594
600
|
type: Input
|
|
595
601
|
}], firstSignatureLabel: [{
|