@colijnit/sharedcomponents 262.1.10 → 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/browser/index.html +2 -2
- package/browser/{main-4A7DG3UU.js → main-F2722GVT.js} +69 -69
- package/browser/{styles-FA2CB3GS.css → styles-JCQQ25VB.css} +1 -1
- package/fesm2022/colijnit-sharedcomponents.mjs +46 -62
- package/fesm2022/colijnit-sharedcomponents.mjs.map +1 -1
- package/index.d.ts +3 -5
- package/lib/components/docsign/style/_layout.scss +10 -0
- package/package.json +2 -2
|
@@ -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: [{
|
|
@@ -18973,12 +18979,6 @@ class NotificationSummaryBlockComponent extends BaseActivitySummaryComponent {
|
|
|
18973
18979
|
return addresses.join(';');
|
|
18974
18980
|
}
|
|
18975
18981
|
}
|
|
18976
|
-
createEmailSubject() {
|
|
18977
|
-
let subject = '- ';
|
|
18978
|
-
subject += (this.editActivity.task.workflowCategory ? this.editActivity.task.workflowCategory : this.dictionaryService.get('TASK')) + ' ' +
|
|
18979
|
-
(this.editActivity.task.workflowCategory ? this.editActivity.task.reference : this.editActivity.task.taskId);
|
|
18980
|
-
return subject;
|
|
18981
|
-
}
|
|
18982
18982
|
async sendEmailIfNeccesary(activityId, activityTable) {
|
|
18983
18983
|
const addresses = this.editActivity?.task?.emailAddresses ?? [];
|
|
18984
18984
|
if (addresses.length === 0) {
|
|
@@ -19009,7 +19009,6 @@ class NotificationSummaryBlockComponent extends BaseActivitySummaryComponent {
|
|
|
19009
19009
|
}
|
|
19010
19010
|
_createEmailParams(template, activityId, activityTable, addresses) {
|
|
19011
19011
|
const request = new EmailActivityRequest();
|
|
19012
|
-
request.emailSubject = this.createEmailSubject();
|
|
19013
19012
|
request.toAddresses = this.createEmailAddressString(addresses);
|
|
19014
19013
|
request.activityId = activityId;
|
|
19015
19014
|
request.activityTableName = activityTable;
|
|
@@ -23293,7 +23292,6 @@ class TaskCreatorComponent {
|
|
|
23293
23292
|
}
|
|
23294
23293
|
_createEmailParams(template, activityId, activityTable) {
|
|
23295
23294
|
let request = new EmailActivityRequest();
|
|
23296
|
-
request.emailSubject = this._createEmailSubject();
|
|
23297
23295
|
request.toAddresses = this._createEmailAddressString(this.emailAddresses);
|
|
23298
23296
|
request.bccAddresses = this._createEmailAddressString(this.bccEmailAddresses);
|
|
23299
23297
|
request.activityId = activityId;
|
|
@@ -23309,20 +23307,6 @@ class TaskCreatorComponent {
|
|
|
23309
23307
|
return addresses.join(';');
|
|
23310
23308
|
}
|
|
23311
23309
|
}
|
|
23312
|
-
_createEmailSubject() {
|
|
23313
|
-
let subject = "";
|
|
23314
|
-
if (this.createdRemark) {
|
|
23315
|
-
subject += this.dictionaryService.get("REMARK") + " " + this.createdRemark.remarkId;
|
|
23316
|
-
}
|
|
23317
|
-
else if (this.createdWork) {
|
|
23318
|
-
subject += this.dictionaryService.get("WORK") + " " + this.createdWork.workId;
|
|
23319
|
-
}
|
|
23320
|
-
else if (this.createdTask) {
|
|
23321
|
-
subject += (this.createdTask.workflowCategory ? this.createdTask.workflowCategory : this.dictionaryService.get("TASK")) + " " +
|
|
23322
|
-
(this.createdTask.workflowCategory ? this.createdTask.reference : this.createdTask.taskId);
|
|
23323
|
-
}
|
|
23324
|
-
return subject;
|
|
23325
|
-
}
|
|
23326
23310
|
_clearFields() {
|
|
23327
23311
|
this.remarkText = "";
|
|
23328
23312
|
this.workDescription = "";
|