@ngstarter-ui/components 21.0.74 → 21.0.75
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/ai/component-registry.json +97 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-BZniTqu-.mjs → ngstarter-ui-components-content-editor-code-block.component-CLfzSb69.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-code-block.component-BZniTqu-.mjs.map → ngstarter-ui-components-content-editor-code-block.component-CLfzSb69.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-QzDMzd3u.mjs → ngstarter-ui-components-content-editor-embed-block-BMBObSRE.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-embed-block-QzDMzd3u.mjs.map → ngstarter-ui-components-content-editor-embed-block-BMBObSRE.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-CnYRnDBY.mjs → ngstarter-ui-components-content-editor-heading-block.component-DL9PehLX.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-heading-block.component-CnYRnDBY.mjs.map → ngstarter-ui-components-content-editor-heading-block.component-DL9PehLX.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-IP_eRCQ2.mjs → ngstarter-ui-components-content-editor-image-block.component-DJWItlMf.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-image-block.component-IP_eRCQ2.mjs.map → ngstarter-ui-components-content-editor-image-block.component-DJWItlMf.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-amyfzXOW.mjs → ngstarter-ui-components-content-editor-list-block.component-J9vhrddX.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-list-block.component-amyfzXOW.mjs.map → ngstarter-ui-components-content-editor-list-block.component-J9vhrddX.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-DA-VnRa_.mjs → ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-Be8dDH3z.mjs} +40 -40
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-Be8dDH3z.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-DtophI4_.mjs → ngstarter-ui-components-content-editor-paragraph-block.component-DxE2SXVt.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-paragraph-block.component-DtophI4_.mjs.map → ngstarter-ui-components-content-editor-paragraph-block.component-DxE2SXVt.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-B20eHQdw.mjs → ngstarter-ui-components-content-editor-quote-block.component-BEt5JkO8.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-quote-block.component-B20eHQdw.mjs.map → ngstarter-ui-components-content-editor-quote-block.component-BEt5JkO8.mjs.map} +1 -1
- package/fesm2022/{ngstarter-ui-components-content-editor-table-block.component-hJ4OxKRX.mjs → ngstarter-ui-components-content-editor-table-block.component-BeCHXahH.mjs} +9 -9
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-BeCHXahH.mjs.map +1 -0
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-Cs7L1wwX.mjs → ngstarter-ui-components-content-editor-video-block.component-BzFQtQwc.mjs} +2 -2
- package/fesm2022/{ngstarter-ui-components-content-editor-video-block.component-Cs7L1wwX.mjs.map → ngstarter-ui-components-content-editor-video-block.component-BzFQtQwc.mjs.map} +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +1 -1
- package/fesm2022/ngstarter-ui-components-dialog.mjs +2 -2
- package/fesm2022/ngstarter-ui-components-dialog.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs +60 -29
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-signer.mjs +805 -0
- package/fesm2022/ngstarter-ui-components-pdf-signer.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs +2 -2
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ngstarter-ui-components-pdf-builder.d.ts +119 -3
- package/types/ngstarter-ui-components-pdf-signer.d.ts +144 -0
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-DA-VnRa_.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-hJ4OxKRX.mjs.map +0 -1
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ElementRef, Renderer2, input, booleanAttribute, output, viewChild, signal, computed, effect, untracked, RendererStyleFlags2, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { Button } from '@ngstarter-ui/components/button';
|
|
5
|
+
import { Datepicker, DatepickerInput, provideNativeDateAdapter } from '@ngstarter-ui/components/datepicker';
|
|
6
|
+
import { Dialog } from '@ngstarter-ui/components/dialog';
|
|
7
|
+
import { Icon } from '@ngstarter-ui/components/icon';
|
|
8
|
+
import { Panel, PanelContent, PanelHeader, PanelSidebar } from '@ngstarter-ui/components/panel';
|
|
9
|
+
import { PdfBuilderStampDialog, PdfBuilderSignatureDialog } from '@ngstarter-ui/components/pdf-builder';
|
|
10
|
+
import { PdfViewer } from '@ngstarter-ui/components/pdf-viewer';
|
|
11
|
+
import { ScrollbarArea } from '@ngstarter-ui/components/scrollbar-area';
|
|
12
|
+
import { Toolbar, ToolbarItem, ToolbarSpacer } from '@ngstarter-ui/components/toolbar';
|
|
13
|
+
import { Tooltip } from '@ngstarter-ui/components/tooltip';
|
|
14
|
+
|
|
15
|
+
const PDF_SIGNER_PAGE_WIDTH = 595.276;
|
|
16
|
+
const PDF_SIGNER_PAGE_HEIGHT = 841.89;
|
|
17
|
+
const PDF_SIGNER_MAX_PORTRAIT_PAGE_WIDTH = 814;
|
|
18
|
+
const PDF_SIGNER_FIXED_PAGE_SCALE = PDF_SIGNER_MAX_PORTRAIT_PAGE_WIDTH / PDF_SIGNER_PAGE_WIDTH;
|
|
19
|
+
class PdfSigner {
|
|
20
|
+
document = inject(DOCUMENT);
|
|
21
|
+
dialog = inject(Dialog);
|
|
22
|
+
elementRef = inject(ElementRef);
|
|
23
|
+
renderer = inject(Renderer2);
|
|
24
|
+
lastEmittedSchema = null;
|
|
25
|
+
schema = input(null, ...(ngDevMode ? [{ debugName: "schema" }] : /* istanbul ignore next */ []));
|
|
26
|
+
signer = input(null, ...(ngDevMode ? [{ debugName: "signer" }] : /* istanbul ignore next */ []));
|
|
27
|
+
showPageList = input(true, { ...(ngDevMode ? { debugName: "showPageList" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
28
|
+
showOtherSignerFields = input(true, ...(ngDevMode ? [{ debugName: "showOtherSignerFields" }] : /* istanbul ignore next */ []));
|
|
29
|
+
stamps = input([], ...(ngDevMode ? [{ debugName: "stamps" }] : /* istanbul ignore next */ []));
|
|
30
|
+
uploadedSignatures = input([], ...(ngDevMode ? [{ debugName: "uploadedSignatures" }] : /* istanbul ignore next */ []));
|
|
31
|
+
uploadedInitials = input([], ...(ngDevMode ? [{ debugName: "uploadedInitials" }] : /* istanbul ignore next */ []));
|
|
32
|
+
drawnSignatureUploadCallback = input(undefined, ...(ngDevMode ? [{ debugName: "drawnSignatureUploadCallback" }] : /* istanbul ignore next */ []));
|
|
33
|
+
signatureImageUploadCallback = input(undefined, ...(ngDevMode ? [{ debugName: "signatureImageUploadCallback" }] : /* istanbul ignore next */ []));
|
|
34
|
+
initialsImageUploadCallback = input(undefined, ...(ngDevMode ? [{ debugName: "initialsImageUploadCallback" }] : /* istanbul ignore next */ []));
|
|
35
|
+
schemaChange = output();
|
|
36
|
+
fieldValueChange = output();
|
|
37
|
+
stampSelected = output();
|
|
38
|
+
stampUploaded = output();
|
|
39
|
+
signatureSelected = output();
|
|
40
|
+
signatureUploaded = output();
|
|
41
|
+
signatureDrawn = output();
|
|
42
|
+
signatureTyped = output();
|
|
43
|
+
initialsSelected = output();
|
|
44
|
+
initialsUploaded = output();
|
|
45
|
+
initialsTyped = output();
|
|
46
|
+
dateFieldPicker = viewChild('dateFieldPicker', ...(ngDevMode ? [{ debugName: "dateFieldPicker" }] : /* istanbul ignore next */ []));
|
|
47
|
+
dateFieldInput = viewChild('dateFieldInput', ...(ngDevMode ? [{ debugName: "dateFieldInput" }] : /* istanbul ignore next */ []));
|
|
48
|
+
viewerScrollbar = viewChild('viewerScrollbar', ...(ngDevMode ? [{ debugName: "viewerScrollbar" }] : /* istanbul ignore next */ []));
|
|
49
|
+
wasmUrl = '/assets/embedpdf/pdfium.wasm';
|
|
50
|
+
pdfScale = signal(PDF_SIGNER_FIXED_PAGE_SCALE, ...(ngDevMode ? [{ debugName: "pdfScale" }] : /* istanbul ignore next */ []));
|
|
51
|
+
textFieldPlaceholder = 'Enter value';
|
|
52
|
+
documentPages = signal([
|
|
53
|
+
this.createVirtualPage(1),
|
|
54
|
+
], ...(ngDevMode ? [{ debugName: "documentPages" }] : /* istanbul ignore next */ []));
|
|
55
|
+
fields = signal([], ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
56
|
+
activePage = signal(1, ...(ngDevMode ? [{ debugName: "activePage" }] : /* istanbul ignore next */ []));
|
|
57
|
+
documentName = computed(() => this.schema()?.document.name ?? 'Untitled.pdf', ...(ngDevMode ? [{ debugName: "documentName" }] : /* istanbul ignore next */ []));
|
|
58
|
+
documentSource = computed(() => this.schema()?.document.source ?? null, ...(ngDevMode ? [{ debugName: "documentSource" }] : /* istanbul ignore next */ []));
|
|
59
|
+
pageCount = computed(() => this.documentPages().length, ...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
|
|
60
|
+
spreadMode = computed(() => this.schema()?.view.spreadMode ?? 'single', ...(ngDevMode ? [{ debugName: "spreadMode" }] : /* istanbul ignore next */ []));
|
|
61
|
+
scrollLayout = computed(() => this.schema()?.view.scrollLayout ?? 'vertical', ...(ngDevMode ? [{ debugName: "scrollLayout" }] : /* istanbul ignore next */ []));
|
|
62
|
+
pageRotation = computed(() => this.schema()?.view.pageRotation ?? 0, ...(ngDevMode ? [{ debugName: "pageRotation" }] : /* istanbul ignore next */ []));
|
|
63
|
+
canGoPrevious = computed(() => this.activePage() > 1, ...(ngDevMode ? [{ debugName: "canGoPrevious" }] : /* istanbul ignore next */ []));
|
|
64
|
+
canGoNext = computed(() => this.activePage() < this.pageCount(), ...(ngDevMode ? [{ debugName: "canGoNext" }] : /* istanbul ignore next */ []));
|
|
65
|
+
currentSignerFieldCount = computed(() => this.fields().filter(field => this.isOwnedByCurrentSigner(field)).length, ...(ngDevMode ? [{ debugName: "currentSignerFieldCount" }] : /* istanbul ignore next */ []));
|
|
66
|
+
completedCurrentSignerFieldCount = computed(() => this.fields().filter(field => this.isOwnedByCurrentSigner(field) && this.isFieldFilled(field)).length, ...(ngDevMode ? [{ debugName: "completedCurrentSignerFieldCount" }] : /* istanbul ignore next */ []));
|
|
67
|
+
nextIncompleteField = computed(() => [...this.fields()]
|
|
68
|
+
.filter(field => this.isFieldInteractive(field) && !this.isFieldFilled(field))
|
|
69
|
+
.sort((left, right) => left.page - right.page ||
|
|
70
|
+
left.y - right.y ||
|
|
71
|
+
left.x - right.x ||
|
|
72
|
+
left.id.localeCompare(right.id))[0] ?? null, ...(ngDevMode ? [{ debugName: "nextIncompleteField" }] : /* istanbul ignore next */ []));
|
|
73
|
+
pages = computed(() => this.documentPages().map((schemaPage, index) => {
|
|
74
|
+
const page = index + 1;
|
|
75
|
+
return {
|
|
76
|
+
page,
|
|
77
|
+
label: schemaPage.label ?? `Page ${page}`,
|
|
78
|
+
kind: schemaPage.kind,
|
|
79
|
+
sourcePage: schemaPage.kind === 'source' ? schemaPage.sourcePage ?? page : null,
|
|
80
|
+
};
|
|
81
|
+
}), ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
82
|
+
pageSpreads = computed(() => this.groupPagesIntoSpreads(this.pages(), this.spreadMode()), ...(ngDevMode ? [{ debugName: "pageSpreads" }] : /* istanbul ignore next */ []));
|
|
83
|
+
constructor() {
|
|
84
|
+
effect(() => {
|
|
85
|
+
const schema = this.schema();
|
|
86
|
+
if (!schema || schema === this.lastEmittedSchema) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
untracked(() => this.restoreSchema(schema));
|
|
90
|
+
});
|
|
91
|
+
effect(() => {
|
|
92
|
+
this.documentPages();
|
|
93
|
+
this.pdfScale();
|
|
94
|
+
this.pageRotation();
|
|
95
|
+
this.scheduleDomSync(() => this.syncPageGeometry());
|
|
96
|
+
});
|
|
97
|
+
effect(() => {
|
|
98
|
+
this.fields();
|
|
99
|
+
this.showOtherSignerFields();
|
|
100
|
+
this.signer();
|
|
101
|
+
this.pdfScale();
|
|
102
|
+
this.scheduleDomSync(() => this.syncOverlayGeometry());
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
pageFields(pageNumber) {
|
|
106
|
+
return this.fields().filter(field => field.page === pageNumber &&
|
|
107
|
+
(this.showOtherSignerFields() || this.isOwnedByCurrentSigner(field)));
|
|
108
|
+
}
|
|
109
|
+
isFieldEditable(field) {
|
|
110
|
+
return this.isOwnedByCurrentSigner(field) && !field.locked && !field.readonly;
|
|
111
|
+
}
|
|
112
|
+
isFieldInteractive(field) {
|
|
113
|
+
return this.isFieldEditable(field) && field.type !== 'variable';
|
|
114
|
+
}
|
|
115
|
+
isButtonActionField(field) {
|
|
116
|
+
return this.isFieldInteractive(field) && field.type !== 'text';
|
|
117
|
+
}
|
|
118
|
+
isFieldFilled(field) {
|
|
119
|
+
if (field.type === 'checkbox') {
|
|
120
|
+
return this.isCheckboxChecked(field);
|
|
121
|
+
}
|
|
122
|
+
if (field.type === 'signature' || field.type === 'initials') {
|
|
123
|
+
return !!field.value.trim() && field.value !== (field.type === 'signature' ? 'Signature' : 'Initials');
|
|
124
|
+
}
|
|
125
|
+
return field.value.trim().length > 0;
|
|
126
|
+
}
|
|
127
|
+
isCheckboxChecked(field) {
|
|
128
|
+
return ['true', 'checked', '1', 'yes', 'on'].includes(field.value.trim().toLocaleLowerCase());
|
|
129
|
+
}
|
|
130
|
+
getFieldDisplayValue(field) {
|
|
131
|
+
if (field.type === 'text') {
|
|
132
|
+
return field.value.trim() || this.textFieldPlaceholder;
|
|
133
|
+
}
|
|
134
|
+
if (field.type === 'date') {
|
|
135
|
+
return field.value.trim() || 'Select date';
|
|
136
|
+
}
|
|
137
|
+
if (field.type === 'variable') {
|
|
138
|
+
return field.value.trim() || (field.binding ? `{{${field.binding}}}` : field.label);
|
|
139
|
+
}
|
|
140
|
+
return field.value.trim() || field.label;
|
|
141
|
+
}
|
|
142
|
+
getFieldTooltip(field) {
|
|
143
|
+
if (!field.signer) {
|
|
144
|
+
return 'This field is not assigned';
|
|
145
|
+
}
|
|
146
|
+
if (!this.isOwnedByCurrentSigner(field)) {
|
|
147
|
+
return `Assigned to ${field.signer.fullName}`;
|
|
148
|
+
}
|
|
149
|
+
if (field.locked) {
|
|
150
|
+
return 'This field is locked';
|
|
151
|
+
}
|
|
152
|
+
if (field.readonly || field.type === 'variable') {
|
|
153
|
+
return 'This field is read only';
|
|
154
|
+
}
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
isImageValue(value) {
|
|
158
|
+
const source = value.trim();
|
|
159
|
+
return /^data:image\//i.test(source) ||
|
|
160
|
+
/^blob:/i.test(source) ||
|
|
161
|
+
/^https?:\/\//i.test(source) ||
|
|
162
|
+
source.startsWith('/') ||
|
|
163
|
+
source.startsWith('assets/');
|
|
164
|
+
}
|
|
165
|
+
executeFieldAction(field, event) {
|
|
166
|
+
event?.stopPropagation();
|
|
167
|
+
if (!this.isFieldInteractive(field)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.activePage.set(field.page);
|
|
171
|
+
switch (field.type) {
|
|
172
|
+
case 'text':
|
|
173
|
+
this.focusTextFieldEditor(field.id);
|
|
174
|
+
return;
|
|
175
|
+
case 'date':
|
|
176
|
+
this.openDateFieldPicker(field);
|
|
177
|
+
return;
|
|
178
|
+
case 'signature':
|
|
179
|
+
this.openSignatureDialog(field);
|
|
180
|
+
return;
|
|
181
|
+
case 'initials':
|
|
182
|
+
this.openInitialsDialog(field);
|
|
183
|
+
return;
|
|
184
|
+
case 'stamp':
|
|
185
|
+
this.openStampDialog(field);
|
|
186
|
+
return;
|
|
187
|
+
case 'checkbox':
|
|
188
|
+
this.updateFieldValue(field.id, this.isCheckboxChecked(field) ? '' : 'true');
|
|
189
|
+
return;
|
|
190
|
+
case 'variable':
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
updateTextFieldValueFromEditor(fieldId, editor) {
|
|
195
|
+
this.updateFieldValue(fieldId, editor.textContent ?? '');
|
|
196
|
+
}
|
|
197
|
+
selectPage(pageNumber) {
|
|
198
|
+
const nextPage = this.clamp(Math.floor(pageNumber), 1, Math.max(1, this.pageCount()));
|
|
199
|
+
this.activePage.set(nextPage);
|
|
200
|
+
this.scheduleDomSync(() => {
|
|
201
|
+
this.getPageShellElement(nextPage)?.scrollIntoView({
|
|
202
|
+
block: 'start',
|
|
203
|
+
inline: 'nearest',
|
|
204
|
+
behavior: 'smooth',
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
previousPage() {
|
|
209
|
+
this.selectPage(this.activePage() - 1);
|
|
210
|
+
}
|
|
211
|
+
nextPage() {
|
|
212
|
+
this.selectPage(this.activePage() + 1);
|
|
213
|
+
}
|
|
214
|
+
goToField(field, event) {
|
|
215
|
+
event?.stopPropagation();
|
|
216
|
+
this.activePage.set(field.page);
|
|
217
|
+
this.scheduleDomSync(() => {
|
|
218
|
+
const fieldElement = this.getOverlayFieldElement(field.id);
|
|
219
|
+
if (!fieldElement) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this.scrollFieldIntoViewport(fieldElement);
|
|
223
|
+
const focusTarget = field.type === 'text'
|
|
224
|
+
? this.getTextFieldEditorElement(field.id)
|
|
225
|
+
: fieldElement;
|
|
226
|
+
focusTarget?.focus({ preventScroll: true });
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
isSourcePdfPage(pageNumber) {
|
|
230
|
+
return !!this.documentSource() && this.documentPages()[pageNumber - 1]?.kind === 'source';
|
|
231
|
+
}
|
|
232
|
+
getSourcePageNumber(pageNumber) {
|
|
233
|
+
return this.documentPages()[pageNumber - 1]?.sourcePage ?? pageNumber;
|
|
234
|
+
}
|
|
235
|
+
onPdfLoaded(event) {
|
|
236
|
+
const currentSchema = this.schema();
|
|
237
|
+
if (!currentSchema || currentSchema.document.pages?.length || event.pageCount <= 0) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const virtualPages = this.documentPages().filter(page => page.kind === 'virtual');
|
|
241
|
+
const pages = [
|
|
242
|
+
...this.createSourcePages(event.pageCount),
|
|
243
|
+
...virtualPages,
|
|
244
|
+
];
|
|
245
|
+
this.documentPages.set(pages);
|
|
246
|
+
this.activePage.update(page => this.clamp(page, 1, pages.length));
|
|
247
|
+
}
|
|
248
|
+
restoreSchema(schema) {
|
|
249
|
+
const pages = this.getSchemaPages(schema);
|
|
250
|
+
const fields = (schema.fields ?? [])
|
|
251
|
+
.filter(field => field.page >= 1 && field.page <= pages.length)
|
|
252
|
+
.map(field => ({ ...field }));
|
|
253
|
+
this.documentPages.set(pages);
|
|
254
|
+
this.fields.set(fields);
|
|
255
|
+
this.activePage.set(this.clamp(Math.floor(schema.view?.activePage ?? 1), 1, Math.max(1, pages.length)));
|
|
256
|
+
this.scheduleDomSync(() => this.syncTextFieldEditors());
|
|
257
|
+
}
|
|
258
|
+
getSchemaPages(schema) {
|
|
259
|
+
if (schema.document.pages?.length) {
|
|
260
|
+
return schema.document.pages.map(page => ({ ...page }));
|
|
261
|
+
}
|
|
262
|
+
const sourcePages = this.createSourcePages(schema.document.sourcePageCount ?? 0);
|
|
263
|
+
const virtualPages = Array.from({ length: Math.max(0, schema.document.addedPageCount ?? 0) }, (_, index) => this.createVirtualPage(sourcePages.length + index + 1));
|
|
264
|
+
const pages = [...sourcePages, ...virtualPages];
|
|
265
|
+
return pages.length ? pages : [this.createVirtualPage(1)];
|
|
266
|
+
}
|
|
267
|
+
createSourcePages(count) {
|
|
268
|
+
return Array.from({ length: Math.max(0, Math.floor(count)) }, (_, index) => {
|
|
269
|
+
const page = index + 1;
|
|
270
|
+
return {
|
|
271
|
+
id: `source-${page}`,
|
|
272
|
+
kind: 'source',
|
|
273
|
+
label: page === 1 ? 'Cover' : `Page ${page}`,
|
|
274
|
+
sourcePage: page,
|
|
275
|
+
width: PDF_SIGNER_PAGE_WIDTH,
|
|
276
|
+
height: PDF_SIGNER_PAGE_HEIGHT,
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
createVirtualPage(page) {
|
|
281
|
+
return {
|
|
282
|
+
id: `virtual-${page}`,
|
|
283
|
+
kind: 'virtual',
|
|
284
|
+
label: `Page ${page}`,
|
|
285
|
+
width: PDF_SIGNER_PAGE_WIDTH,
|
|
286
|
+
height: PDF_SIGNER_PAGE_HEIGHT,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
groupPagesIntoSpreads(pages, mode) {
|
|
290
|
+
if (mode === 'single') {
|
|
291
|
+
return pages.map(page => ({
|
|
292
|
+
id: `single-${page.page}`,
|
|
293
|
+
leadingPlaceholder: false,
|
|
294
|
+
pages: [page],
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
const spreads = [];
|
|
298
|
+
let pageIndex = 0;
|
|
299
|
+
if (mode === 'two-even' && pages.length) {
|
|
300
|
+
spreads.push({
|
|
301
|
+
id: 'two-even-cover',
|
|
302
|
+
leadingPlaceholder: true,
|
|
303
|
+
pages: [pages[0]],
|
|
304
|
+
});
|
|
305
|
+
pageIndex = 1;
|
|
306
|
+
}
|
|
307
|
+
while (pageIndex < pages.length) {
|
|
308
|
+
const spreadPages = pages.slice(pageIndex, pageIndex + 2);
|
|
309
|
+
spreads.push({
|
|
310
|
+
id: `${mode}-${spreadPages.map(page => page.page).join('-')}`,
|
|
311
|
+
leadingPlaceholder: false,
|
|
312
|
+
pages: spreadPages,
|
|
313
|
+
});
|
|
314
|
+
pageIndex += 2;
|
|
315
|
+
}
|
|
316
|
+
return spreads;
|
|
317
|
+
}
|
|
318
|
+
isOwnedByCurrentSigner(field) {
|
|
319
|
+
const signer = this.signer();
|
|
320
|
+
const fieldSigner = field.signer;
|
|
321
|
+
if (!signer || !fieldSigner) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (signer.id && fieldSigner.id === signer.id) {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
const signerEmail = signer.email?.trim().toLocaleLowerCase();
|
|
328
|
+
const fieldSignerEmail = fieldSigner.email?.trim().toLocaleLowerCase();
|
|
329
|
+
return !!signerEmail && signerEmail === fieldSignerEmail;
|
|
330
|
+
}
|
|
331
|
+
updateFieldValue(fieldId, value) {
|
|
332
|
+
const previousField = this.fields().find(field => field.id === fieldId);
|
|
333
|
+
if (!previousField || !this.isFieldEditable(previousField) || previousField.value === value) {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
const field = { ...previousField, value };
|
|
337
|
+
this.fields.update(fields => fields.map(item => item.id === fieldId ? field : item));
|
|
338
|
+
this.emitFieldChange(previousField, field);
|
|
339
|
+
return field;
|
|
340
|
+
}
|
|
341
|
+
updateField(fieldId, update) {
|
|
342
|
+
const previousField = this.fields().find(field => field.id === fieldId);
|
|
343
|
+
if (!previousField || !this.isFieldEditable(previousField)) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
const field = update(previousField);
|
|
347
|
+
this.fields.update(fields => fields.map(item => item.id === fieldId ? field : item));
|
|
348
|
+
this.emitFieldChange(previousField, field);
|
|
349
|
+
return field;
|
|
350
|
+
}
|
|
351
|
+
emitFieldChange(previousField, field) {
|
|
352
|
+
const source = this.schema();
|
|
353
|
+
if (!source) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const schema = {
|
|
357
|
+
...source,
|
|
358
|
+
view: {
|
|
359
|
+
...source.view,
|
|
360
|
+
activePage: this.activePage(),
|
|
361
|
+
selectedFieldId: null,
|
|
362
|
+
},
|
|
363
|
+
fields: this.fields().map(item => ({ ...item })),
|
|
364
|
+
};
|
|
365
|
+
this.lastEmittedSchema = schema;
|
|
366
|
+
this.schemaChange.emit(schema);
|
|
367
|
+
this.fieldValueChange.emit({
|
|
368
|
+
field,
|
|
369
|
+
previousValue: previousField.value,
|
|
370
|
+
value: field.value,
|
|
371
|
+
schema,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
focusTextFieldEditor(fieldId) {
|
|
375
|
+
const field = this.fields().find(item => item.id === fieldId);
|
|
376
|
+
if (!field || !this.isFieldEditable(field) || field.type !== 'text') {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
this.scheduleDomSync(() => {
|
|
380
|
+
const currentField = this.fields().find(item => item.id === fieldId);
|
|
381
|
+
const editor = this.getTextFieldEditorElement(fieldId);
|
|
382
|
+
if (!currentField || !editor) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if ((editor.textContent ?? '') !== currentField.value) {
|
|
386
|
+
editor.textContent = currentField.value;
|
|
387
|
+
}
|
|
388
|
+
editor.focus();
|
|
389
|
+
this.placeContentEditableCaretAtEnd(editor);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
syncTextFieldEditors() {
|
|
393
|
+
const activeElement = this.document.activeElement;
|
|
394
|
+
for (const field of this.fields()) {
|
|
395
|
+
if (field.type !== 'text' || !this.isFieldEditable(field)) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
const editor = this.getTextFieldEditorElement(field.id);
|
|
399
|
+
if (!editor || editor === activeElement || (editor.textContent ?? '') === field.value) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
editor.textContent = field.value;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
openDateFieldPicker(field) {
|
|
406
|
+
const picker = this.dateFieldPicker();
|
|
407
|
+
const input = this.dateFieldInput();
|
|
408
|
+
const anchor = this.getDatePickerAnchorElement();
|
|
409
|
+
const fieldElement = this.getOverlayFieldElement(field.id);
|
|
410
|
+
if (!picker || !input || !anchor || !fieldElement || !this.isFieldEditable(field)) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const rect = fieldElement.getBoundingClientRect();
|
|
414
|
+
this.setCssVar(anchor, '--pdf-signer-date-anchor-left', `${rect.left}px`);
|
|
415
|
+
this.setCssVar(anchor, '--pdf-signer-date-anchor-top', `${rect.top}px`);
|
|
416
|
+
this.setCssVar(anchor, '--pdf-signer-date-anchor-width', `${rect.width}px`);
|
|
417
|
+
this.setCssVar(anchor, '--pdf-signer-date-anchor-height', `${rect.height}px`);
|
|
418
|
+
input.registerOnChange((date) => this.applyDateFieldValue(field.id, date));
|
|
419
|
+
input.writeValue(this.parseDateFieldValue(field.value));
|
|
420
|
+
this.scheduleDomSync(() => picker.open());
|
|
421
|
+
}
|
|
422
|
+
applyDateFieldValue(fieldId, date) {
|
|
423
|
+
if (!date || Number.isNaN(date.getTime())) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const value = new Intl.DateTimeFormat('en-US', {
|
|
427
|
+
year: 'numeric',
|
|
428
|
+
month: '2-digit',
|
|
429
|
+
day: '2-digit',
|
|
430
|
+
}).format(date);
|
|
431
|
+
this.updateFieldValue(fieldId, value);
|
|
432
|
+
}
|
|
433
|
+
parseDateFieldValue(value) {
|
|
434
|
+
const timestamp = Date.parse(value);
|
|
435
|
+
return Number.isNaN(timestamp) ? null : new Date(timestamp);
|
|
436
|
+
}
|
|
437
|
+
openStampDialog(field) {
|
|
438
|
+
const dialogRef = this.dialog.open(PdfBuilderStampDialog, {
|
|
439
|
+
width: '640px',
|
|
440
|
+
showCloseButton: true,
|
|
441
|
+
data: { stamps: this.stamps() },
|
|
442
|
+
});
|
|
443
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
444
|
+
if (!result) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
void this.applyStampDialogResult(field, result).catch(error => {
|
|
448
|
+
console.error('Failed to apply stamp.', error);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
async applyStampDialogResult(field, result) {
|
|
453
|
+
const value = result.type === 'asset'
|
|
454
|
+
? result.stamp.dataUrl?.trim() || result.stamp.imageUrl?.trim() || ''
|
|
455
|
+
: await this.readImageFileAsDataUrl(result.file);
|
|
456
|
+
if (!value) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const appliedField = this.updateField(field.id, current => ({ ...current, value }));
|
|
460
|
+
if (!appliedField) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (result.type === 'asset') {
|
|
464
|
+
this.stampSelected.emit({ field: appliedField, stamp: result.stamp });
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
this.stampUploaded.emit({ field: appliedField, file: result.file });
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
readImageFileAsDataUrl(file) {
|
|
471
|
+
const FileReaderConstructor = this.document.defaultView?.FileReader;
|
|
472
|
+
if (!FileReaderConstructor) {
|
|
473
|
+
return Promise.reject(new Error('Image file reading is not available.'));
|
|
474
|
+
}
|
|
475
|
+
return new Promise((resolve, reject) => {
|
|
476
|
+
const reader = new FileReaderConstructor();
|
|
477
|
+
reader.addEventListener('load', () => {
|
|
478
|
+
if (typeof reader.result === 'string') {
|
|
479
|
+
resolve(reader.result);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
reject(new Error('The selected stamp image could not be read.'));
|
|
483
|
+
});
|
|
484
|
+
reader.addEventListener('error', () => {
|
|
485
|
+
reject(reader.error ?? new Error('The selected stamp image could not be read.'));
|
|
486
|
+
});
|
|
487
|
+
reader.readAsDataURL(file);
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
openSignatureDialog(field) {
|
|
491
|
+
const dialogRef = this.dialog.open(PdfBuilderSignatureDialog, {
|
|
492
|
+
width: '720px',
|
|
493
|
+
showCloseButton: true,
|
|
494
|
+
data: { signatures: this.uploadedSignatures() },
|
|
495
|
+
});
|
|
496
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
497
|
+
if (result) {
|
|
498
|
+
void this.applySignatureDialogResult(field, result);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
openInitialsDialog(field) {
|
|
503
|
+
const dialogRef = this.dialog.open(PdfBuilderSignatureDialog, {
|
|
504
|
+
width: '720px',
|
|
505
|
+
showCloseButton: true,
|
|
506
|
+
data: {
|
|
507
|
+
signatures: this.uploadedInitials(),
|
|
508
|
+
title: 'Initials',
|
|
509
|
+
includeDraw: false,
|
|
510
|
+
typePlaceholder: 'Type initials',
|
|
511
|
+
uploadMainText: 'Drag & drop an initials image here',
|
|
512
|
+
uploadDropText: 'Drop initials image here.',
|
|
513
|
+
uploadInvalidText: 'Select an image file.',
|
|
514
|
+
uploadAllowedTypesText: 'Image files are accepted.',
|
|
515
|
+
savedTabLabel: 'My Initials',
|
|
516
|
+
savedListLabel: 'Saved initials',
|
|
517
|
+
acceptLabel: 'Accept initials',
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
521
|
+
if (result) {
|
|
522
|
+
void this.applyInitialsDialogResult(field, result);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
async applySignatureDialogResult(field, result) {
|
|
527
|
+
const currentField = this.fields().find(item => item.id === field.id);
|
|
528
|
+
if (!currentField || currentField.type !== 'signature' || !this.isFieldEditable(currentField)) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const uploadResult = await this.resolveSignatureUploadResult(currentField, result);
|
|
532
|
+
const label = this.getSignatureResultLabel(uploadResult, this.getDialogResultLabel(result));
|
|
533
|
+
const value = this.getSignatureResultValue(uploadResult, this.getDialogResultValue(result));
|
|
534
|
+
const appliedField = this.updateField(field.id, current => ({ ...current, label, value }));
|
|
535
|
+
if (!appliedField) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
switch (result.type) {
|
|
539
|
+
case 'asset':
|
|
540
|
+
this.signatureSelected.emit({ field: appliedField, signature: result.signature });
|
|
541
|
+
return;
|
|
542
|
+
case 'draw':
|
|
543
|
+
this.signatureDrawn.emit({ field: appliedField, dataUrl: result.dataUrl });
|
|
544
|
+
return;
|
|
545
|
+
case 'type':
|
|
546
|
+
this.signatureTyped.emit({
|
|
547
|
+
field: appliedField,
|
|
548
|
+
value: result.value,
|
|
549
|
+
dataUrl: result.dataUrl,
|
|
550
|
+
fontFamily: result.fontFamily,
|
|
551
|
+
color: result.color,
|
|
552
|
+
});
|
|
553
|
+
return;
|
|
554
|
+
case 'file':
|
|
555
|
+
this.signatureUploaded.emit({ field: appliedField, file: result.file });
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
async applyInitialsDialogResult(field, result) {
|
|
559
|
+
const currentField = this.fields().find(item => item.id === field.id);
|
|
560
|
+
if (!currentField ||
|
|
561
|
+
currentField.type !== 'initials' ||
|
|
562
|
+
!this.isFieldEditable(currentField) ||
|
|
563
|
+
result.type === 'draw') {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const uploadResult = await this.resolveInitialsUploadResult(currentField, result);
|
|
567
|
+
const label = this.getSignatureResultLabel(uploadResult, this.getDialogResultLabel(result));
|
|
568
|
+
const value = this.getSignatureResultValue(uploadResult, this.getDialogResultValue(result));
|
|
569
|
+
const appliedField = this.updateField(field.id, current => ({ ...current, label, value }));
|
|
570
|
+
if (!appliedField) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
switch (result.type) {
|
|
574
|
+
case 'asset':
|
|
575
|
+
this.initialsSelected.emit({ field: appliedField, initials: result.signature });
|
|
576
|
+
return;
|
|
577
|
+
case 'type':
|
|
578
|
+
this.initialsTyped.emit({
|
|
579
|
+
field: appliedField,
|
|
580
|
+
value: result.value,
|
|
581
|
+
dataUrl: result.dataUrl,
|
|
582
|
+
fontFamily: result.fontFamily,
|
|
583
|
+
color: result.color,
|
|
584
|
+
});
|
|
585
|
+
return;
|
|
586
|
+
case 'file':
|
|
587
|
+
this.initialsUploaded.emit({ field: appliedField, file: result.file });
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
async resolveSignatureUploadResult(field, result) {
|
|
592
|
+
if (result.type === 'draw') {
|
|
593
|
+
const callback = this.drawnSignatureUploadCallback();
|
|
594
|
+
return callback ? callback({ field, dataUrl: result.dataUrl }) : null;
|
|
595
|
+
}
|
|
596
|
+
if (result.type === 'file') {
|
|
597
|
+
const callback = this.signatureImageUploadCallback();
|
|
598
|
+
return callback ? callback({ field, file: result.file }) : null;
|
|
599
|
+
}
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
async resolveInitialsUploadResult(field, result) {
|
|
603
|
+
if (result.type === 'file') {
|
|
604
|
+
const callback = this.initialsImageUploadCallback();
|
|
605
|
+
return callback ? callback({ field, file: result.file }) : null;
|
|
606
|
+
}
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
getSignatureResultLabel(result, fallback) {
|
|
610
|
+
if (!result || typeof result === 'string') {
|
|
611
|
+
return fallback;
|
|
612
|
+
}
|
|
613
|
+
const customResult = result;
|
|
614
|
+
return customResult.label ?? result.name ?? fallback;
|
|
615
|
+
}
|
|
616
|
+
getSignatureResultValue(result, fallback) {
|
|
617
|
+
if (!result) {
|
|
618
|
+
return fallback;
|
|
619
|
+
}
|
|
620
|
+
if (typeof result === 'string') {
|
|
621
|
+
return result;
|
|
622
|
+
}
|
|
623
|
+
const customResult = result;
|
|
624
|
+
return result.dataUrl ?? result.imageUrl ?? customResult.value ?? fallback;
|
|
625
|
+
}
|
|
626
|
+
getDialogResultLabel(result) {
|
|
627
|
+
switch (result.type) {
|
|
628
|
+
case 'asset':
|
|
629
|
+
return result.signature.name;
|
|
630
|
+
case 'draw':
|
|
631
|
+
return 'Drawn signature';
|
|
632
|
+
case 'type':
|
|
633
|
+
return result.value;
|
|
634
|
+
case 'file':
|
|
635
|
+
return result.file.name;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
getDialogResultValue(result) {
|
|
639
|
+
switch (result.type) {
|
|
640
|
+
case 'asset':
|
|
641
|
+
return result.signature.dataUrl ?? result.signature.imageUrl ?? result.signature.name;
|
|
642
|
+
case 'draw':
|
|
643
|
+
return result.dataUrl;
|
|
644
|
+
case 'type':
|
|
645
|
+
return result.dataUrl;
|
|
646
|
+
case 'file':
|
|
647
|
+
return result.file.name;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
syncPageGeometry() {
|
|
651
|
+
const width = PDF_SIGNER_PAGE_WIDTH * this.pdfScale();
|
|
652
|
+
const height = PDF_SIGNER_PAGE_HEIGHT * this.pdfScale();
|
|
653
|
+
for (const element of this.getPageShellElements()) {
|
|
654
|
+
this.setCssVar(element, '--pdf-signer-page-width', `${width}px`);
|
|
655
|
+
this.setCssVar(element, '--pdf-signer-page-height', `${height}px`);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
syncOverlayGeometry() {
|
|
659
|
+
const fields = new Map(this.fields().map(field => [field.id, field]));
|
|
660
|
+
for (const element of this.getOverlayFieldElements()) {
|
|
661
|
+
const fieldId = element.getAttribute('data-field-id');
|
|
662
|
+
const field = fieldId ? fields.get(fieldId) : null;
|
|
663
|
+
if (!field) {
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
const scale = this.getRenderedPageScale(field.page);
|
|
667
|
+
this.setCssVar(element, '--pdf-signer-field-left', `${field.x * scale.x}px`);
|
|
668
|
+
this.setCssVar(element, '--pdf-signer-field-top', `${field.y * scale.y}px`);
|
|
669
|
+
this.setCssVar(element, '--pdf-signer-field-width', `${field.width * scale.x}px`);
|
|
670
|
+
this.setCssVar(element, '--pdf-signer-field-height', `${field.height * scale.y}px`);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
getRenderedPageScale(pageNumber) {
|
|
674
|
+
const pageShell = this.getPageShellElement(pageNumber);
|
|
675
|
+
const rect = this.getElementClientRect(pageShell);
|
|
676
|
+
if (!rect || rect.width <= 0 || rect.height <= 0) {
|
|
677
|
+
const scale = this.pdfScale();
|
|
678
|
+
return { x: scale, y: scale };
|
|
679
|
+
}
|
|
680
|
+
const isQuarterTurn = this.pageRotation() === 1 || this.pageRotation() === 3;
|
|
681
|
+
return {
|
|
682
|
+
x: (isQuarterTurn ? rect.height : rect.width) / PDF_SIGNER_PAGE_WIDTH,
|
|
683
|
+
y: (isQuarterTurn ? rect.width : rect.height) / PDF_SIGNER_PAGE_HEIGHT,
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
getPageShellElement(pageNumber) {
|
|
687
|
+
return this.elementRef.nativeElement.querySelector(`.pdf-page-shell[data-page-number="${pageNumber}"]`);
|
|
688
|
+
}
|
|
689
|
+
getPageShellElements() {
|
|
690
|
+
return Array.from(this.elementRef.nativeElement.querySelectorAll('.pdf-page-shell'));
|
|
691
|
+
}
|
|
692
|
+
getOverlayFieldElements() {
|
|
693
|
+
return Array.from(this.elementRef.nativeElement.querySelectorAll('[data-field-id]'));
|
|
694
|
+
}
|
|
695
|
+
getOverlayFieldElement(fieldId) {
|
|
696
|
+
return this.elementRef.nativeElement.querySelector(`[data-field-id="${fieldId}"]`);
|
|
697
|
+
}
|
|
698
|
+
scrollFieldIntoViewport(fieldElement) {
|
|
699
|
+
const container = this.viewerScrollbar()?.scrollableContentRef().nativeElement;
|
|
700
|
+
if (!container) {
|
|
701
|
+
this.scrollElementIntoView(fieldElement);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const containerRect = this.getElementClientRect(container);
|
|
705
|
+
const fieldRect = this.getElementClientRect(fieldElement);
|
|
706
|
+
if (!containerRect || !fieldRect || typeof container.scrollTo !== 'function') {
|
|
707
|
+
this.scrollElementIntoView(fieldElement);
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const top = container.scrollTop
|
|
711
|
+
+ fieldRect.top
|
|
712
|
+
- containerRect.top
|
|
713
|
+
- (container.clientHeight - fieldRect.height) / 2;
|
|
714
|
+
const left = container.scrollLeft
|
|
715
|
+
+ fieldRect.left
|
|
716
|
+
- containerRect.left
|
|
717
|
+
- (container.clientWidth - fieldRect.width) / 2;
|
|
718
|
+
container.scrollTo({
|
|
719
|
+
top: this.clamp(top, 0, Math.max(0, container.scrollHeight - container.clientHeight)),
|
|
720
|
+
left: this.clamp(left, 0, Math.max(0, container.scrollWidth - container.clientWidth)),
|
|
721
|
+
behavior: 'smooth',
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
scrollElementIntoView(element) {
|
|
725
|
+
if (typeof element.scrollIntoView !== 'function') {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
element.scrollIntoView({
|
|
729
|
+
block: 'center',
|
|
730
|
+
inline: 'center',
|
|
731
|
+
behavior: 'smooth',
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
getElementClientRect(element) {
|
|
735
|
+
return element && typeof element.getBoundingClientRect === 'function'
|
|
736
|
+
? element.getBoundingClientRect()
|
|
737
|
+
: null;
|
|
738
|
+
}
|
|
739
|
+
getDatePickerAnchorElement() {
|
|
740
|
+
return this.elementRef.nativeElement.querySelector('.date-picker-anchor');
|
|
741
|
+
}
|
|
742
|
+
getTextFieldEditorElement(fieldId) {
|
|
743
|
+
return this.elementRef.nativeElement.querySelector(`[contenteditable][data-text-editor-for="${fieldId}"]`);
|
|
744
|
+
}
|
|
745
|
+
placeContentEditableCaretAtEnd(editor) {
|
|
746
|
+
const defaultView = this.document.defaultView;
|
|
747
|
+
if (!defaultView) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const range = this.document.createRange();
|
|
751
|
+
range.selectNodeContents(editor);
|
|
752
|
+
range.collapse(false);
|
|
753
|
+
const selection = defaultView.getSelection();
|
|
754
|
+
selection?.removeAllRanges();
|
|
755
|
+
selection?.addRange(range);
|
|
756
|
+
}
|
|
757
|
+
scheduleDomSync(callback) {
|
|
758
|
+
const defaultView = this.document.defaultView;
|
|
759
|
+
if (!defaultView) {
|
|
760
|
+
callback();
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
if (typeof defaultView.requestAnimationFrame === 'function') {
|
|
764
|
+
defaultView.requestAnimationFrame(callback);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
defaultView.setTimeout(callback, 0);
|
|
768
|
+
}
|
|
769
|
+
setCssVar(element, name, value) {
|
|
770
|
+
this.renderer.setStyle(element, name, value, RendererStyleFlags2.DashCase);
|
|
771
|
+
}
|
|
772
|
+
clamp(value, minimum, maximum) {
|
|
773
|
+
return Math.min(Math.max(value, minimum), maximum);
|
|
774
|
+
}
|
|
775
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PdfSigner, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
776
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PdfSigner, isStandalone: true, selector: "ngs-pdf-signer", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, signer: { classPropertyName: "signer", publicName: "signer", isSignal: true, isRequired: false, transformFunction: null }, showPageList: { classPropertyName: "showPageList", publicName: "showPageList", isSignal: true, isRequired: false, transformFunction: null }, showOtherSignerFields: { classPropertyName: "showOtherSignerFields", publicName: "showOtherSignerFields", isSignal: true, isRequired: false, transformFunction: null }, stamps: { classPropertyName: "stamps", publicName: "stamps", isSignal: true, isRequired: false, transformFunction: null }, uploadedSignatures: { classPropertyName: "uploadedSignatures", publicName: "uploadedSignatures", isSignal: true, isRequired: false, transformFunction: null }, uploadedInitials: { classPropertyName: "uploadedInitials", publicName: "uploadedInitials", isSignal: true, isRequired: false, transformFunction: null }, drawnSignatureUploadCallback: { classPropertyName: "drawnSignatureUploadCallback", publicName: "drawnSignatureUploadCallback", isSignal: true, isRequired: false, transformFunction: null }, signatureImageUploadCallback: { classPropertyName: "signatureImageUploadCallback", publicName: "signatureImageUploadCallback", isSignal: true, isRequired: false, transformFunction: null }, initialsImageUploadCallback: { classPropertyName: "initialsImageUploadCallback", publicName: "initialsImageUploadCallback", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { schemaChange: "schemaChange", fieldValueChange: "fieldValueChange", stampSelected: "stampSelected", stampUploaded: "stampUploaded", signatureSelected: "signatureSelected", signatureUploaded: "signatureUploaded", signatureDrawn: "signatureDrawn", signatureTyped: "signatureTyped", initialsSelected: "initialsSelected", initialsUploaded: "initialsUploaded", initialsTyped: "initialsTyped" }, host: { classAttribute: "ngs-pdf-signer not-prose" }, providers: [provideNativeDateAdapter()], viewQueries: [{ propertyName: "dateFieldPicker", first: true, predicate: ["dateFieldPicker"], descendants: true, isSignal: true }, { propertyName: "dateFieldInput", first: true, predicate: ["dateFieldInput"], descendants: true, isSignal: true }, { propertyName: "viewerScrollbar", first: true, predicate: ["viewerScrollbar"], descendants: true, isSignal: true }], exportAs: ["ngsPdfSigner"], ngImport: i0, template: "<ngs-panel class=\"pdf-signer-shell\">\n <ngs-panel-header class=\"pdf-signer-header min-w-0 border-b border-border bg-surface\" flex>\n <ngs-toolbar\n class=\"flex h-14 w-full min-w-0 items-center gap-4 overflow-visible px-2 text-on-surface-variant\"\n aria-label=\"PDF signing controls\"\n >\n <ngs-toolbar-item class=\"flex min-w-0 flex-none items-center gap-2 pl-4\">\n <span class=\"truncate text-sm font-medium text-on-surface\">{{ documentName() }}</span>\n </ngs-toolbar-item>\n\n <ngs-toolbar-spacer />\n\n <ngs-toolbar-item class=\"flex flex-none items-center gap-2\" aria-label=\"Page navigation\">\n <button\n class=\"size-10 text-on-surface-variant hover:bg-surface-container-low hover:text-on-surface\"\n ngsIconButton\n type=\"button\"\n aria-label=\"Previous page\"\n [disabled]=\"!canGoPrevious()\"\n (click)=\"previousPage()\"\n >\n <ngs-icon class=\"text-2xl\" name=\"fluent:chevron-left-24-regular\" />\n </button>\n <span class=\"inline-flex h-9 min-w-16 items-center justify-center gap-2 rounded bg-surface-container-low text-sm font-medium text-on-surface\">\n <span>{{ activePage() }}</span>\n <span>/</span>\n <span>{{ pageCount() }}</span>\n </span>\n <button\n class=\"size-10 text-on-surface-variant hover:bg-surface-container-low hover:text-on-surface\"\n ngsIconButton\n type=\"button\"\n aria-label=\"Next page\"\n [disabled]=\"!canGoNext()\"\n (click)=\"nextPage()\"\n >\n <ngs-icon class=\"text-2xl\" name=\"fluent:chevron-right-24-regular\" />\n </button>\n </ngs-toolbar-item>\n\n <ngs-toolbar-spacer />\n\n <ngs-toolbar-item class=\"flex min-w-0 flex-none items-center justify-end gap-2 pr-4\">\n <span class=\"text-sm text-on-surface-variant\">\n {{ completedCurrentSignerFieldCount() }} / {{ currentSignerFieldCount() }} completed\n </span>\n </ngs-toolbar-item>\n </ngs-toolbar>\n </ngs-panel-header>\n\n @if (showPageList()) {\n <ngs-panel-sidebar\n class=\"w-[var(--ngs-pdf-viewer-sidebar-width)] min-w-[var(--ngs-pdf-viewer-sidebar-width)] border-r border-border bg-surface\"\n >\n <div class=\"pdf-viewer-sidebar flex h-full min-h-0 flex-col gap-2 overflow-auto p-3\">\n <div class=\"pdf-viewer-sidebar__title px-1 text-xs font-semibold text-on-surface-variant\">Pages</div>\n <div class=\"pdf-viewer-sidebar__pages flex min-h-0 flex-col gap-2\" aria-label=\"PDF pages\">\n @for (page of pages(); track page.page) {\n <button\n type=\"button\"\n class=\"pdf-viewer-sidebar__page group flex w-full cursor-pointer flex-col items-stretch gap-1 rounded border border-transparent bg-transparent p-1 text-left text-on-surface-variant focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary [&.is-active]:text-on-surface\"\n [class.is-active]=\"page.page === activePage()\"\n [attr.aria-current]=\"page.page === activePage() ? 'page' : null\"\n [attr.aria-label]=\"'Open page ' + page.page\"\n [attr.data-ngs-pdf-page-button]=\"page.page\"\n (click)=\"selectPage(page.page)\"\n >\n <span class=\"pdf-viewer-sidebar__thumb flex aspect-[3/4] w-full items-center justify-center overflow-hidden rounded border border-border shadow-xs group-hover:border-border\" aria-hidden=\"true\">\n @if (isSourcePdfPage(page.page)) {\n <ngs-pdf-viewer\n class=\"thumbnail-pdf-viewer\"\n [src]=\"documentSource()\"\n [documentName]=\"documentName()\"\n [wasmUrl]=\"wasmUrl\"\n [page]=\"getSourcePageNumber(page.page)\"\n [scale]=\"0.15\"\n [renderAll]=\"false\"\n [showToolbar]=\"false\"\n [showPageList]=\"false\"\n [showSearchPanel]=\"false\"\n [showAnnotationsPanel]=\"false\"\n [enableCommandWheelZoom]=\"false\"\n />\n } @else {\n <span class=\"page-thumbnail-blank\"></span>\n }\n </span>\n <span class=\"pdf-viewer-sidebar__label block truncate text-center text-xs font-medium leading-tight\">\n Page {{ page.page }}\n </span>\n </button>\n }\n </div>\n </div>\n </ngs-panel-sidebar>\n }\n\n <ngs-panel-content class=\"pdf-signer-workspace min-h-0 min-w-0 overflow-hidden bg-surface-container-low\">\n @if (nextIncompleteField(); as nextField) {\n <button\n ngsButton=\"text\"\n type=\"button\"\n class=\"next-field-marker\"\n [attr.aria-label]=\"'Go to next field: ' + nextField.label + ', page ' + nextField.page\"\n [attr.data-next-field-id]=\"nextField.id\"\n ngsTooltip=\"Go to next field\"\n ngsTooltipPosition=\"right\"\n (click)=\"goToField(nextField, $event)\"\n >\n <ngs-icon name=\"fluent:arrow-right-24-regular\" />\n </button>\n }\n\n <ngs-scrollbar-area #viewerScrollbar [absolute]=\"true\" class=\"viewer-scrollbar\">\n <div\n class=\"viewer-stage\"\n [class.is-vertical]=\"scrollLayout() === 'vertical'\"\n [class.is-horizontal]=\"scrollLayout() === 'horizontal'\"\n >\n @for (spread of pageSpreads(); track spread.id) {\n <div class=\"pdf-signer-spread\">\n @if (spread.leadingPlaceholder) {\n <div class=\"pdf-signer-spread-placeholder\" aria-hidden=\"true\"></div>\n }\n\n @for (page of spread.pages; track page.page) {\n <div\n class=\"pdf-page-shell rounded bg-surface shadow-md\"\n [attr.data-page-number]=\"page.page\"\n [class.is-active-page]=\"page.page === activePage()\"\n [class.is-rotated-90]=\"pageRotation() === 1\"\n [class.is-rotated-180]=\"pageRotation() === 2\"\n [class.is-rotated-270]=\"pageRotation() === 3\"\n [attr.aria-label]=\"'PDF signing page ' + page.page\"\n (click)=\"activePage.set(page.page)\"\n >\n @if (isSourcePdfPage(page.page)) {\n <ngs-pdf-viewer\n class=\"embedded-pdf-viewer\"\n [src]=\"documentSource()\"\n [documentName]=\"documentName()\"\n [wasmUrl]=\"wasmUrl\"\n [page]=\"getSourcePageNumber(page.page)\"\n [scale]=\"pdfScale()\"\n [renderAll]=\"false\"\n [showToolbar]=\"false\"\n [showPageList]=\"false\"\n [showSearchPanel]=\"false\"\n [showAnnotationsPanel]=\"false\"\n [enableCommandWheelZoom]=\"false\"\n (loaded)=\"onPdfLoaded($event)\"\n />\n } @else {\n <div class=\"blank-pdf-page\" aria-label=\"Blank PDF page\"></div>\n }\n\n <div class=\"pdf-overlay-layer\">\n @for (field of pageFields(page.page); track field.id) {\n <div\n class=\"overlay-field\"\n [attr.role]=\"isButtonActionField(field) ? 'button' : null\"\n [attr.tabindex]=\"isButtonActionField(field) ? 0 : null\"\n [attr.data-field-id]=\"field.id\"\n [attr.data-signer-id]=\"field.signer?.id ?? null\"\n [attr.aria-label]=\"field.label + (isFieldEditable(field) ? '' : ' (read only)')\"\n [class.is-filled]=\"isFieldFilled(field)\"\n [class.is-readonly]=\"!isFieldEditable(field)\"\n [class.overlay-slot-primary]=\"field.slot === 'primary'\"\n [class.overlay-slot-date]=\"field.slot === 'date'\"\n [class.overlay-slot-signature]=\"field.slot === 'signature'\"\n [class.overlay-slot-initials]=\"field.slot === 'initials'\"\n [class.overlay-slot-checkbox]=\"field.slot === 'checkbox'\"\n [class.overlay-slot-comment]=\"field.slot === 'comment'\"\n [class.overlay-slot-footer]=\"field.slot === 'footer'\"\n [class.overlay-slot-side]=\"field.slot === 'side'\"\n [class.overlay-type-text]=\"field.type === 'text'\"\n [class.overlay-type-variable]=\"field.type === 'variable'\"\n [class.overlay-type-date]=\"field.type === 'date'\"\n [class.overlay-type-signature]=\"field.type === 'signature'\"\n [class.overlay-type-initials]=\"field.type === 'initials'\"\n [class.overlay-type-checkbox]=\"field.type === 'checkbox'\"\n [class.overlay-type-stamp]=\"field.type === 'stamp'\"\n [ngsTooltip]=\"getFieldTooltip(field)\"\n ngsTooltipPosition=\"above\"\n [ngsTooltipDisabled]=\"!getFieldTooltip(field)\"\n (click)=\"executeFieldAction(field, $event)\"\n (keydown.enter)=\"executeFieldAction(field, $event)\"\n (keydown.space)=\"$event.preventDefault(); executeFieldAction(field, $event)\"\n >\n @if (field.type === 'checkbox') {\n @if (isCheckboxChecked(field)) {\n <ngs-icon class=\"checkbox-mark\" name=\"fluent:checkmark-16-regular\" />\n }\n } @else if (\n (field.type === 'signature' || field.type === 'initials' || field.type === 'stamp') &&\n isImageValue(field.value)\n ) {\n <img class=\"field-image\" [src]=\"field.value\" alt=\"\" />\n } @else if (field.type === 'text' && isFieldEditable(field)) {\n <span\n class=\"text-field-editor\"\n contenteditable=\"true\"\n role=\"textbox\"\n aria-multiline=\"true\"\n spellcheck=\"false\"\n [attr.data-text-editor-for]=\"field.id\"\n [attr.data-placeholder]=\"textFieldPlaceholder\"\n aria-label=\"Text field value\"\n (focus)=\"activePage.set(field.page)\"\n (click)=\"$event.stopPropagation()\"\n (input)=\"updateTextFieldValueFromEditor(field.id, $any($event.target))\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"$any($event.target).blur()\"\n ></span>\n } @else if (field.type === 'text') {\n <span class=\"field-value\" [class.is-placeholder]=\"!field.value.trim()\">{{ getFieldDisplayValue(field) }}</span>\n } @else {\n <span class=\"field-badge\">\n @if (field.type === 'initials') {\n <span class=\"initials-mark\" aria-hidden=\"true\">IN</span>\n } @else if (field.type !== 'variable' || !field.binding) {\n <ngs-icon [name]=\"field.icon\" />\n }\n <span\n class=\"field-value\"\n [class.is-placeholder]=\"!field.value.trim()\"\n >\n {{ getFieldDisplayValue(field) }}\n </span>\n </span>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n </ngs-scrollbar-area>\n\n <input\n class=\"date-picker-anchor\"\n readonly\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [ngsDatepicker]=\"dateFieldPicker\"\n #dateFieldInput=\"ngsDatepickerInput\"\n />\n <ngs-datepicker #dateFieldPicker />\n </ngs-panel-content>\n</ngs-panel>\n", styles: [":host{--ngs-pdf-viewer-sidebar-width: 152px;--ngs-pdf-viewer-page-gap: 24px;--ngs-pdf-viewer-page-padding: 24px;display:block;width:100%;height:100%;min-height:560px}:host .pdf-signer-shell{height:100%;min-height:inherit;overflow:hidden}:host .pdf-signer-header{min-height:calc(var(--spacing, .25rem) * 14)}:host button[ngsButton].is-disabled,:host button[ngsIconButton].is-disabled{opacity:.48;pointer-events:none}:host .pdf-signer-workspace{position:relative;overflow:hidden}:host .pdf-viewer-sidebar__page.is-active .pdf-viewer-sidebar__thumb{outline:2px solid var(--ngs-color-primary)}:host .pdf-viewer-sidebar__thumb{background:var(--ngs-color-white, #fff)}:host .next-field-marker{--ngs-button-bg: var(--ngs-color-warning-container);--ngs-button-color: var(--ngs-color-on-warning-container);--ngs-button-hover-bg: var(--ngs-color-warning-container);--ngs-button-height: calc(var(--spacing, .25rem) * 9);--ngs-button-padding: 0;--ngs-button-border-radius: 0 var(--ngs-radius-sm) var(--ngs-radius-sm) 0;position:absolute;top:50%;left:0;z-index:3;width:calc(var(--spacing, .25rem) * 8);min-width:calc(var(--spacing, .25rem) * 8);border:1px solid var(--ngs-color-warning);box-shadow:var(--ngs-shadow-sm);transform:translateY(-50%)}@supports (color: color-mix(in lab,red,red)){:host .next-field-marker{--ngs-button-hover-bg: color-mix( in srgb, var(--ngs-color-warning-container), var(--ngs-color-warning) 18% )}}@supports (color: color-mix(in lab,red,red)){:host .next-field-marker{border:1px solid color-mix(in srgb,var(--ngs-color-warning),transparent 45%)}}:host .next-field-marker ngs-icon{font-size:var(--ngs-font-size-lg)}:host .page-thumbnail-blank{display:block;width:100%;height:100%;background:var(--ngs-color-white, #fff)}:host .thumbnail-pdf-viewer{--ngs-pdf-viewer-height: 100%;--ngs-pdf-viewer-min-height: 100%;--ngs-pdf-viewer-page-padding: 0;--ngs-pdf-viewer-page-gap: 0;display:block;width:100%;height:100%;pointer-events:none}:host .viewer-scrollbar{inset:0}:host .viewer-stage{position:relative;box-sizing:border-box;display:grid;gap:var(--ngs-pdf-viewer-page-gap);width:100%;min-width:calc(var(--pdf-signer-page-width, 814px) + var(--ngs-pdf-viewer-page-padding) * 2);min-height:100%;padding:var(--ngs-pdf-viewer-page-padding)}:host .viewer-stage.is-vertical{grid-auto-flow:row;grid-auto-rows:max-content;align-content:start;justify-items:center}:host .viewer-stage.is-horizontal{width:max-content;align-content:center;align-items:center;grid-auto-columns:max-content;grid-auto-flow:column;justify-content:start}:host .pdf-signer-spread{display:grid;align-items:start;gap:calc(var(--spacing, .25rem) * 4);grid-auto-columns:max-content;grid-auto-flow:column;justify-content:center}:host .pdf-signer-spread-placeholder{width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);pointer-events:none;visibility:hidden}:host .pdf-page-shell{position:relative;flex:none;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);margin:0;overflow:hidden}:host .pdf-page-shell.is-rotated-90,:host .pdf-page-shell.is-rotated-270{width:var(--pdf-signer-page-height, 1151px);height:var(--pdf-signer-page-width, 814px)}:host .pdf-page-shell.is-rotated-90>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-90>.blank-pdf-page,:host .pdf-page-shell.is-rotated-90>.pdf-overlay-layer,:host .pdf-page-shell.is-rotated-180>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-180>.blank-pdf-page,:host .pdf-page-shell.is-rotated-180>.pdf-overlay-layer,:host .pdf-page-shell.is-rotated-270>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-270>.blank-pdf-page,:host .pdf-page-shell.is-rotated-270>.pdf-overlay-layer{position:absolute;top:0;left:0;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);transform-origin:top left}:host .pdf-page-shell.is-rotated-90>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-90>.blank-pdf-page,:host .pdf-page-shell.is-rotated-90>.pdf-overlay-layer{transform:rotate(90deg) translateY(-100%)}:host .pdf-page-shell.is-rotated-180>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-180>.blank-pdf-page,:host .pdf-page-shell.is-rotated-180>.pdf-overlay-layer{transform:rotate(180deg) translate(-100%,-100%)}:host .pdf-page-shell.is-rotated-270>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-270>.blank-pdf-page,:host .pdf-page-shell.is-rotated-270>.pdf-overlay-layer{transform:rotate(-90deg) translate(-100%)}:host .embedded-pdf-viewer{--ngs-pdf-viewer-height: var(--pdf-signer-page-height, 1151px);--ngs-pdf-viewer-min-height: var(--pdf-signer-page-height, 1151px);--ngs-pdf-viewer-page-padding: 0;--ngs-pdf-viewer-page-gap: 0;display:block;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px)}:host .blank-pdf-page{width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);background:#fff}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-panel,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-panel{border:0;border-radius:0;background:var(--ngs-color-surface)}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-body,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-body{overflow:hidden}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-pages,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-pages{align-content:start;justify-items:center}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-page__surface,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-page__surface{border-radius:0;box-shadow:none}:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-panel{background:var(--ngs-color-white, #fff)}:host ::ng-deep .thumbnail-pdf-viewer ngs-block-loader,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-state{display:none}:host .pdf-overlay-layer{position:absolute;inset:0;z-index:2;pointer-events:none}:host .overlay-field{position:absolute;left:var(--pdf-signer-field-left, 0);top:var(--pdf-signer-field-top, 0);box-sizing:border-box;display:flex;width:var(--pdf-signer-field-width, calc(var(--spacing, .25rem) * 44));height:var(--pdf-signer-field-height, calc(var(--spacing, .25rem) * 10));min-width:calc(var(--spacing, .25rem) * 4);min-height:calc(var(--spacing, .25rem) * 4);flex-direction:row;align-items:center;justify-content:flex-start;border:1px solid var(--ngs-color-primary);border-radius:calc(var(--spacing, .25rem) * 1);background:var(--ngs-color-primary);color:var(--ngs-color-on-surface);cursor:pointer;overflow:hidden;padding:calc(var(--spacing, .25rem) * 2);pointer-events:auto;text-align:start;transition:background-color .14s cubic-bezier(0,0,.2,1),border-color .14s cubic-bezier(0,0,.2,1)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field{border:1px solid color-mix(in srgb,var(--ngs-color-primary),transparent 54%)}}@supports (color: color-mix(in lab,red,red)){:host .overlay-field{background:color-mix(in srgb,var(--ngs-color-primary),transparent 92%)}}:host .overlay-field:focus-visible{outline:2px solid var(--ngs-color-primary);outline-offset:2px}:host .overlay-field:hover{border-color:var(--ngs-color-primary);background:var(--ngs-color-primary)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field:hover{background:color-mix(in srgb,var(--ngs-color-primary),transparent 88%)}}:host .overlay-field.is-filled{background:transparent}:host .overlay-field.is-readonly{border-color:var(--ngs-color-border-strong);border-style:dashed;background:var(--ngs-color-surface);color:var(--ngs-color-on-surface-variant);cursor:default;opacity:.72}@supports (color: color-mix(in lab,red,red)){:host .overlay-field.is-readonly{background:color-mix(in srgb,var(--ngs-color-surface),transparent 18%)}}:host .overlay-field.is-readonly:hover{border-color:var(--ngs-color-border-strong);background:var(--ngs-color-surface)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field.is-readonly:hover{background:color-mix(in srgb,var(--ngs-color-surface),transparent 18%)}}:host .overlay-slot-primary,:host .overlay-slot-footer,:host .overlay-slot-side{align-items:flex-start}:host .overlay-slot-signature,:host .overlay-slot-initials{justify-content:center}:host .overlay-type-text{align-items:flex-start;cursor:text;padding:calc(var(--spacing, .25rem) * 2.5) calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 1.5)}:host .overlay-type-text .field-value,:host .overlay-type-text .text-field-editor{display:block;width:100%;margin:0;color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-md);font-weight:400;line-height:1.25;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap}:host .overlay-type-text .field-value.is-placeholder{color:var(--ngs-color-on-surface-variant)}:host .overlay-type-text .text-field-editor{min-height:0;border:0;outline:0;background:transparent;box-shadow:none;padding:0}:host .overlay-type-text .text-field-editor:empty:before{color:var(--ngs-color-on-surface-variant);content:attr(data-placeholder);pointer-events:none}:host .overlay-type-variable{border-color:var(--ngs-color-warning);background:var(--ngs-color-warning-container);color:var(--ngs-color-on-warning-container)}@supports (color: color-mix(in lab,red,red)){:host .overlay-type-variable{border-color:color-mix(in srgb,var(--ngs-color-warning),transparent 30%)}}:host .overlay-type-variable .field-badge{color:var(--ngs-color-warning)}:host .overlay-type-date{flex-direction:row;align-items:center;justify-content:flex-start;padding:0 calc(var(--spacing, .25rem) * 2)}:host .overlay-type-date .field-badge{width:100%;height:100%;align-items:center;gap:calc(var(--spacing, .25rem) * 2)}:host .overlay-type-date ngs-icon{flex:none;font-size:var(--ngs-font-size-xl)}:host .overlay-type-date .field-value{min-width:0;margin:0;font-size:var(--ngs-font-size-sm);font-weight:400;line-height:1}:host .overlay-type-initials{justify-content:center}:host .overlay-type-signature,:host .overlay-type-stamp{flex-direction:row;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 3);padding:0 calc(var(--spacing, .25rem) * 4)}:host .overlay-type-signature .field-badge,:host .overlay-type-stamp .field-badge{width:auto;min-height:0;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 3)}:host .overlay-type-signature .field-label,:host .overlay-type-stamp .field-label{display:inline;color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-md);font-weight:400;line-height:1}:host .overlay-type-signature ngs-icon,:host .overlay-type-stamp ngs-icon{flex:none;font-size:var(--ngs-font-size-2xl)}:host .overlay-type-checkbox{align-items:center;justify-content:center;border-color:var(--ngs-color-border-strong);border-radius:calc(var(--spacing, .25rem) * .75);background:var(--ngs-color-surface);padding:0}:host .overlay-type-checkbox.is-filled{border-color:var(--ngs-color-primary);background:var(--ngs-color-primary);color:var(--ngs-color-on-primary)}:host .overlay-type-checkbox .checkbox-mark{font-size:var(--ngs-font-size-md)}:host .field-badge{display:inline-flex;min-width:0;max-width:100%;align-items:center;gap:calc(var(--spacing, .25rem) * 1.5);color:var(--ngs-color-primary);font-size:var(--ngs-font-size-xs);font-weight:500}:host .field-value{min-width:0;max-width:100%;overflow:hidden;color:var(--ngs-color-on-surface);text-overflow:ellipsis;white-space:nowrap}:host .field-value.is-placeholder{color:var(--ngs-color-on-surface-variant)}:host .initials-mark{border-bottom:2px solid currentColor;font-size:var(--ngs-font-size-lg);font-weight:500}:host .field-image{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}:host .date-picker-anchor{position:fixed;left:var(--pdf-signer-date-anchor-left, -10000px);top:var(--pdf-signer-date-anchor-top, -10000px);z-index:-1;width:var(--pdf-signer-date-anchor-width, calc(var(--spacing, .25rem) * 28));height:var(--pdf-signer-date-anchor-height, calc(var(--spacing, .25rem) * 7));border:0;opacity:0;pointer-events:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: Datepicker, selector: "ngs-datepicker", inputs: ["startAt", "calendarHeaderComponent", "quickPresets", "showQuickPresets"], exportAs: ["ngsDatepicker"] }, { kind: "directive", type: DatepickerInput, selector: "input[ngsDatepicker]", inputs: ["ngsDatepicker"], exportAs: ["ngsDatepickerInput"] }, { kind: "component", type: Icon, selector: "ngs-icon", inputs: ["name"], exportAs: ["ngsIcon"] }, { kind: "component", type: Panel, selector: "ngs-panel", inputs: ["absolute"], exportAs: ["ngsPanel"] }, { kind: "component", type: PanelContent, selector: "ngs-panel-content", exportAs: ["ngsPanelContent"] }, { kind: "component", type: PanelHeader, selector: "ngs-panel-header", inputs: ["flex", "autoHeight"], exportAs: ["ngsPanelHeader"] }, { kind: "component", type: PanelSidebar, selector: "ngs-panel-sidebar" }, { kind: "component", type: PdfViewer, selector: "ngs-pdf-viewer", inputs: ["src", "documentName", "wasmUrl", "page", "scale", "minScale", "maxScale", "zoomStep", "maxRenderPixels", "maxRenderDimension", "renderAll", "showToolbar", "showPageList", "showSearchPanel", "showAnnotationsPanel", "enableCommandWheelZoom", "annotations", "annotationsDataSource", "annotationTypeProperty", "searchQuery", "withAnnotations", "withForms"], outputs: ["loaded", "pageChanged", "pageRendered", "error"], exportAs: ["ngsPdfViewer"] }, { kind: "component", type: ScrollbarArea, selector: "ngs-scrollbar-area", inputs: ["scrollbarWidth", "autoHide", "absolute"], outputs: ["scrolled"], exportAs: ["ngsScrollbarArea"] }, { kind: "component", type: Toolbar, selector: "ngs-toolbar", exportAs: ["ngsToolbar"] }, { kind: "component", type: ToolbarItem, selector: "ngs-toolbar-item", inputs: ["hidden"], outputs: ["hiddenChange"] }, { kind: "component", type: ToolbarSpacer, selector: "ngs-toolbar-spacer" }, { kind: "directive", type: Tooltip, selector: "[ngsTooltip]", inputs: ["ngsTooltip", "ngsTooltipPosition", "ngsTooltipClass", "ngsTooltipShowDelay", "ngsTooltipHideDelay", "ngsTooltipOffset", "ngsTooltipPositionAtOrigin", "ngsTooltipDisabled"], exportAs: ["ngsTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
777
|
+
}
|
|
778
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PdfSigner, decorators: [{
|
|
779
|
+
type: Component,
|
|
780
|
+
args: [{ selector: 'ngs-pdf-signer', exportAs: 'ngsPdfSigner', imports: [
|
|
781
|
+
Button,
|
|
782
|
+
Datepicker,
|
|
783
|
+
DatepickerInput,
|
|
784
|
+
Icon,
|
|
785
|
+
Panel,
|
|
786
|
+
PanelContent,
|
|
787
|
+
PanelHeader,
|
|
788
|
+
PanelSidebar,
|
|
789
|
+
PdfViewer,
|
|
790
|
+
ScrollbarArea,
|
|
791
|
+
Toolbar,
|
|
792
|
+
ToolbarItem,
|
|
793
|
+
ToolbarSpacer,
|
|
794
|
+
Tooltip,
|
|
795
|
+
], providers: [provideNativeDateAdapter()], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
796
|
+
class: 'ngs-pdf-signer not-prose',
|
|
797
|
+
}, template: "<ngs-panel class=\"pdf-signer-shell\">\n <ngs-panel-header class=\"pdf-signer-header min-w-0 border-b border-border bg-surface\" flex>\n <ngs-toolbar\n class=\"flex h-14 w-full min-w-0 items-center gap-4 overflow-visible px-2 text-on-surface-variant\"\n aria-label=\"PDF signing controls\"\n >\n <ngs-toolbar-item class=\"flex min-w-0 flex-none items-center gap-2 pl-4\">\n <span class=\"truncate text-sm font-medium text-on-surface\">{{ documentName() }}</span>\n </ngs-toolbar-item>\n\n <ngs-toolbar-spacer />\n\n <ngs-toolbar-item class=\"flex flex-none items-center gap-2\" aria-label=\"Page navigation\">\n <button\n class=\"size-10 text-on-surface-variant hover:bg-surface-container-low hover:text-on-surface\"\n ngsIconButton\n type=\"button\"\n aria-label=\"Previous page\"\n [disabled]=\"!canGoPrevious()\"\n (click)=\"previousPage()\"\n >\n <ngs-icon class=\"text-2xl\" name=\"fluent:chevron-left-24-regular\" />\n </button>\n <span class=\"inline-flex h-9 min-w-16 items-center justify-center gap-2 rounded bg-surface-container-low text-sm font-medium text-on-surface\">\n <span>{{ activePage() }}</span>\n <span>/</span>\n <span>{{ pageCount() }}</span>\n </span>\n <button\n class=\"size-10 text-on-surface-variant hover:bg-surface-container-low hover:text-on-surface\"\n ngsIconButton\n type=\"button\"\n aria-label=\"Next page\"\n [disabled]=\"!canGoNext()\"\n (click)=\"nextPage()\"\n >\n <ngs-icon class=\"text-2xl\" name=\"fluent:chevron-right-24-regular\" />\n </button>\n </ngs-toolbar-item>\n\n <ngs-toolbar-spacer />\n\n <ngs-toolbar-item class=\"flex min-w-0 flex-none items-center justify-end gap-2 pr-4\">\n <span class=\"text-sm text-on-surface-variant\">\n {{ completedCurrentSignerFieldCount() }} / {{ currentSignerFieldCount() }} completed\n </span>\n </ngs-toolbar-item>\n </ngs-toolbar>\n </ngs-panel-header>\n\n @if (showPageList()) {\n <ngs-panel-sidebar\n class=\"w-[var(--ngs-pdf-viewer-sidebar-width)] min-w-[var(--ngs-pdf-viewer-sidebar-width)] border-r border-border bg-surface\"\n >\n <div class=\"pdf-viewer-sidebar flex h-full min-h-0 flex-col gap-2 overflow-auto p-3\">\n <div class=\"pdf-viewer-sidebar__title px-1 text-xs font-semibold text-on-surface-variant\">Pages</div>\n <div class=\"pdf-viewer-sidebar__pages flex min-h-0 flex-col gap-2\" aria-label=\"PDF pages\">\n @for (page of pages(); track page.page) {\n <button\n type=\"button\"\n class=\"pdf-viewer-sidebar__page group flex w-full cursor-pointer flex-col items-stretch gap-1 rounded border border-transparent bg-transparent p-1 text-left text-on-surface-variant focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary [&.is-active]:text-on-surface\"\n [class.is-active]=\"page.page === activePage()\"\n [attr.aria-current]=\"page.page === activePage() ? 'page' : null\"\n [attr.aria-label]=\"'Open page ' + page.page\"\n [attr.data-ngs-pdf-page-button]=\"page.page\"\n (click)=\"selectPage(page.page)\"\n >\n <span class=\"pdf-viewer-sidebar__thumb flex aspect-[3/4] w-full items-center justify-center overflow-hidden rounded border border-border shadow-xs group-hover:border-border\" aria-hidden=\"true\">\n @if (isSourcePdfPage(page.page)) {\n <ngs-pdf-viewer\n class=\"thumbnail-pdf-viewer\"\n [src]=\"documentSource()\"\n [documentName]=\"documentName()\"\n [wasmUrl]=\"wasmUrl\"\n [page]=\"getSourcePageNumber(page.page)\"\n [scale]=\"0.15\"\n [renderAll]=\"false\"\n [showToolbar]=\"false\"\n [showPageList]=\"false\"\n [showSearchPanel]=\"false\"\n [showAnnotationsPanel]=\"false\"\n [enableCommandWheelZoom]=\"false\"\n />\n } @else {\n <span class=\"page-thumbnail-blank\"></span>\n }\n </span>\n <span class=\"pdf-viewer-sidebar__label block truncate text-center text-xs font-medium leading-tight\">\n Page {{ page.page }}\n </span>\n </button>\n }\n </div>\n </div>\n </ngs-panel-sidebar>\n }\n\n <ngs-panel-content class=\"pdf-signer-workspace min-h-0 min-w-0 overflow-hidden bg-surface-container-low\">\n @if (nextIncompleteField(); as nextField) {\n <button\n ngsButton=\"text\"\n type=\"button\"\n class=\"next-field-marker\"\n [attr.aria-label]=\"'Go to next field: ' + nextField.label + ', page ' + nextField.page\"\n [attr.data-next-field-id]=\"nextField.id\"\n ngsTooltip=\"Go to next field\"\n ngsTooltipPosition=\"right\"\n (click)=\"goToField(nextField, $event)\"\n >\n <ngs-icon name=\"fluent:arrow-right-24-regular\" />\n </button>\n }\n\n <ngs-scrollbar-area #viewerScrollbar [absolute]=\"true\" class=\"viewer-scrollbar\">\n <div\n class=\"viewer-stage\"\n [class.is-vertical]=\"scrollLayout() === 'vertical'\"\n [class.is-horizontal]=\"scrollLayout() === 'horizontal'\"\n >\n @for (spread of pageSpreads(); track spread.id) {\n <div class=\"pdf-signer-spread\">\n @if (spread.leadingPlaceholder) {\n <div class=\"pdf-signer-spread-placeholder\" aria-hidden=\"true\"></div>\n }\n\n @for (page of spread.pages; track page.page) {\n <div\n class=\"pdf-page-shell rounded bg-surface shadow-md\"\n [attr.data-page-number]=\"page.page\"\n [class.is-active-page]=\"page.page === activePage()\"\n [class.is-rotated-90]=\"pageRotation() === 1\"\n [class.is-rotated-180]=\"pageRotation() === 2\"\n [class.is-rotated-270]=\"pageRotation() === 3\"\n [attr.aria-label]=\"'PDF signing page ' + page.page\"\n (click)=\"activePage.set(page.page)\"\n >\n @if (isSourcePdfPage(page.page)) {\n <ngs-pdf-viewer\n class=\"embedded-pdf-viewer\"\n [src]=\"documentSource()\"\n [documentName]=\"documentName()\"\n [wasmUrl]=\"wasmUrl\"\n [page]=\"getSourcePageNumber(page.page)\"\n [scale]=\"pdfScale()\"\n [renderAll]=\"false\"\n [showToolbar]=\"false\"\n [showPageList]=\"false\"\n [showSearchPanel]=\"false\"\n [showAnnotationsPanel]=\"false\"\n [enableCommandWheelZoom]=\"false\"\n (loaded)=\"onPdfLoaded($event)\"\n />\n } @else {\n <div class=\"blank-pdf-page\" aria-label=\"Blank PDF page\"></div>\n }\n\n <div class=\"pdf-overlay-layer\">\n @for (field of pageFields(page.page); track field.id) {\n <div\n class=\"overlay-field\"\n [attr.role]=\"isButtonActionField(field) ? 'button' : null\"\n [attr.tabindex]=\"isButtonActionField(field) ? 0 : null\"\n [attr.data-field-id]=\"field.id\"\n [attr.data-signer-id]=\"field.signer?.id ?? null\"\n [attr.aria-label]=\"field.label + (isFieldEditable(field) ? '' : ' (read only)')\"\n [class.is-filled]=\"isFieldFilled(field)\"\n [class.is-readonly]=\"!isFieldEditable(field)\"\n [class.overlay-slot-primary]=\"field.slot === 'primary'\"\n [class.overlay-slot-date]=\"field.slot === 'date'\"\n [class.overlay-slot-signature]=\"field.slot === 'signature'\"\n [class.overlay-slot-initials]=\"field.slot === 'initials'\"\n [class.overlay-slot-checkbox]=\"field.slot === 'checkbox'\"\n [class.overlay-slot-comment]=\"field.slot === 'comment'\"\n [class.overlay-slot-footer]=\"field.slot === 'footer'\"\n [class.overlay-slot-side]=\"field.slot === 'side'\"\n [class.overlay-type-text]=\"field.type === 'text'\"\n [class.overlay-type-variable]=\"field.type === 'variable'\"\n [class.overlay-type-date]=\"field.type === 'date'\"\n [class.overlay-type-signature]=\"field.type === 'signature'\"\n [class.overlay-type-initials]=\"field.type === 'initials'\"\n [class.overlay-type-checkbox]=\"field.type === 'checkbox'\"\n [class.overlay-type-stamp]=\"field.type === 'stamp'\"\n [ngsTooltip]=\"getFieldTooltip(field)\"\n ngsTooltipPosition=\"above\"\n [ngsTooltipDisabled]=\"!getFieldTooltip(field)\"\n (click)=\"executeFieldAction(field, $event)\"\n (keydown.enter)=\"executeFieldAction(field, $event)\"\n (keydown.space)=\"$event.preventDefault(); executeFieldAction(field, $event)\"\n >\n @if (field.type === 'checkbox') {\n @if (isCheckboxChecked(field)) {\n <ngs-icon class=\"checkbox-mark\" name=\"fluent:checkmark-16-regular\" />\n }\n } @else if (\n (field.type === 'signature' || field.type === 'initials' || field.type === 'stamp') &&\n isImageValue(field.value)\n ) {\n <img class=\"field-image\" [src]=\"field.value\" alt=\"\" />\n } @else if (field.type === 'text' && isFieldEditable(field)) {\n <span\n class=\"text-field-editor\"\n contenteditable=\"true\"\n role=\"textbox\"\n aria-multiline=\"true\"\n spellcheck=\"false\"\n [attr.data-text-editor-for]=\"field.id\"\n [attr.data-placeholder]=\"textFieldPlaceholder\"\n aria-label=\"Text field value\"\n (focus)=\"activePage.set(field.page)\"\n (click)=\"$event.stopPropagation()\"\n (input)=\"updateTextFieldValueFromEditor(field.id, $any($event.target))\"\n (keydown)=\"$event.stopPropagation()\"\n (keydown.escape)=\"$any($event.target).blur()\"\n ></span>\n } @else if (field.type === 'text') {\n <span class=\"field-value\" [class.is-placeholder]=\"!field.value.trim()\">{{ getFieldDisplayValue(field) }}</span>\n } @else {\n <span class=\"field-badge\">\n @if (field.type === 'initials') {\n <span class=\"initials-mark\" aria-hidden=\"true\">IN</span>\n } @else if (field.type !== 'variable' || !field.binding) {\n <ngs-icon [name]=\"field.icon\" />\n }\n <span\n class=\"field-value\"\n [class.is-placeholder]=\"!field.value.trim()\"\n >\n {{ getFieldDisplayValue(field) }}\n </span>\n </span>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n </ngs-scrollbar-area>\n\n <input\n class=\"date-picker-anchor\"\n readonly\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [ngsDatepicker]=\"dateFieldPicker\"\n #dateFieldInput=\"ngsDatepickerInput\"\n />\n <ngs-datepicker #dateFieldPicker />\n </ngs-panel-content>\n</ngs-panel>\n", styles: [":host{--ngs-pdf-viewer-sidebar-width: 152px;--ngs-pdf-viewer-page-gap: 24px;--ngs-pdf-viewer-page-padding: 24px;display:block;width:100%;height:100%;min-height:560px}:host .pdf-signer-shell{height:100%;min-height:inherit;overflow:hidden}:host .pdf-signer-header{min-height:calc(var(--spacing, .25rem) * 14)}:host button[ngsButton].is-disabled,:host button[ngsIconButton].is-disabled{opacity:.48;pointer-events:none}:host .pdf-signer-workspace{position:relative;overflow:hidden}:host .pdf-viewer-sidebar__page.is-active .pdf-viewer-sidebar__thumb{outline:2px solid var(--ngs-color-primary)}:host .pdf-viewer-sidebar__thumb{background:var(--ngs-color-white, #fff)}:host .next-field-marker{--ngs-button-bg: var(--ngs-color-warning-container);--ngs-button-color: var(--ngs-color-on-warning-container);--ngs-button-hover-bg: var(--ngs-color-warning-container);--ngs-button-height: calc(var(--spacing, .25rem) * 9);--ngs-button-padding: 0;--ngs-button-border-radius: 0 var(--ngs-radius-sm) var(--ngs-radius-sm) 0;position:absolute;top:50%;left:0;z-index:3;width:calc(var(--spacing, .25rem) * 8);min-width:calc(var(--spacing, .25rem) * 8);border:1px solid var(--ngs-color-warning);box-shadow:var(--ngs-shadow-sm);transform:translateY(-50%)}@supports (color: color-mix(in lab,red,red)){:host .next-field-marker{--ngs-button-hover-bg: color-mix( in srgb, var(--ngs-color-warning-container), var(--ngs-color-warning) 18% )}}@supports (color: color-mix(in lab,red,red)){:host .next-field-marker{border:1px solid color-mix(in srgb,var(--ngs-color-warning),transparent 45%)}}:host .next-field-marker ngs-icon{font-size:var(--ngs-font-size-lg)}:host .page-thumbnail-blank{display:block;width:100%;height:100%;background:var(--ngs-color-white, #fff)}:host .thumbnail-pdf-viewer{--ngs-pdf-viewer-height: 100%;--ngs-pdf-viewer-min-height: 100%;--ngs-pdf-viewer-page-padding: 0;--ngs-pdf-viewer-page-gap: 0;display:block;width:100%;height:100%;pointer-events:none}:host .viewer-scrollbar{inset:0}:host .viewer-stage{position:relative;box-sizing:border-box;display:grid;gap:var(--ngs-pdf-viewer-page-gap);width:100%;min-width:calc(var(--pdf-signer-page-width, 814px) + var(--ngs-pdf-viewer-page-padding) * 2);min-height:100%;padding:var(--ngs-pdf-viewer-page-padding)}:host .viewer-stage.is-vertical{grid-auto-flow:row;grid-auto-rows:max-content;align-content:start;justify-items:center}:host .viewer-stage.is-horizontal{width:max-content;align-content:center;align-items:center;grid-auto-columns:max-content;grid-auto-flow:column;justify-content:start}:host .pdf-signer-spread{display:grid;align-items:start;gap:calc(var(--spacing, .25rem) * 4);grid-auto-columns:max-content;grid-auto-flow:column;justify-content:center}:host .pdf-signer-spread-placeholder{width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);pointer-events:none;visibility:hidden}:host .pdf-page-shell{position:relative;flex:none;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);margin:0;overflow:hidden}:host .pdf-page-shell.is-rotated-90,:host .pdf-page-shell.is-rotated-270{width:var(--pdf-signer-page-height, 1151px);height:var(--pdf-signer-page-width, 814px)}:host .pdf-page-shell.is-rotated-90>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-90>.blank-pdf-page,:host .pdf-page-shell.is-rotated-90>.pdf-overlay-layer,:host .pdf-page-shell.is-rotated-180>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-180>.blank-pdf-page,:host .pdf-page-shell.is-rotated-180>.pdf-overlay-layer,:host .pdf-page-shell.is-rotated-270>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-270>.blank-pdf-page,:host .pdf-page-shell.is-rotated-270>.pdf-overlay-layer{position:absolute;top:0;left:0;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);transform-origin:top left}:host .pdf-page-shell.is-rotated-90>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-90>.blank-pdf-page,:host .pdf-page-shell.is-rotated-90>.pdf-overlay-layer{transform:rotate(90deg) translateY(-100%)}:host .pdf-page-shell.is-rotated-180>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-180>.blank-pdf-page,:host .pdf-page-shell.is-rotated-180>.pdf-overlay-layer{transform:rotate(180deg) translate(-100%,-100%)}:host .pdf-page-shell.is-rotated-270>.embedded-pdf-viewer,:host .pdf-page-shell.is-rotated-270>.blank-pdf-page,:host .pdf-page-shell.is-rotated-270>.pdf-overlay-layer{transform:rotate(-90deg) translate(-100%)}:host .embedded-pdf-viewer{--ngs-pdf-viewer-height: var(--pdf-signer-page-height, 1151px);--ngs-pdf-viewer-min-height: var(--pdf-signer-page-height, 1151px);--ngs-pdf-viewer-page-padding: 0;--ngs-pdf-viewer-page-gap: 0;display:block;width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px)}:host .blank-pdf-page{width:var(--pdf-signer-page-width, 814px);height:var(--pdf-signer-page-height, 1151px);background:#fff}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-panel,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-panel{border:0;border-radius:0;background:var(--ngs-color-surface)}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-body,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-body{overflow:hidden}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-pages,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-pages{align-content:start;justify-items:center}:host ::ng-deep .embedded-pdf-viewer .pdf-viewer-page__surface,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-page__surface{border-radius:0;box-shadow:none}:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-panel{background:var(--ngs-color-white, #fff)}:host ::ng-deep .thumbnail-pdf-viewer ngs-block-loader,:host ::ng-deep .thumbnail-pdf-viewer .pdf-viewer-state{display:none}:host .pdf-overlay-layer{position:absolute;inset:0;z-index:2;pointer-events:none}:host .overlay-field{position:absolute;left:var(--pdf-signer-field-left, 0);top:var(--pdf-signer-field-top, 0);box-sizing:border-box;display:flex;width:var(--pdf-signer-field-width, calc(var(--spacing, .25rem) * 44));height:var(--pdf-signer-field-height, calc(var(--spacing, .25rem) * 10));min-width:calc(var(--spacing, .25rem) * 4);min-height:calc(var(--spacing, .25rem) * 4);flex-direction:row;align-items:center;justify-content:flex-start;border:1px solid var(--ngs-color-primary);border-radius:calc(var(--spacing, .25rem) * 1);background:var(--ngs-color-primary);color:var(--ngs-color-on-surface);cursor:pointer;overflow:hidden;padding:calc(var(--spacing, .25rem) * 2);pointer-events:auto;text-align:start;transition:background-color .14s cubic-bezier(0,0,.2,1),border-color .14s cubic-bezier(0,0,.2,1)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field{border:1px solid color-mix(in srgb,var(--ngs-color-primary),transparent 54%)}}@supports (color: color-mix(in lab,red,red)){:host .overlay-field{background:color-mix(in srgb,var(--ngs-color-primary),transparent 92%)}}:host .overlay-field:focus-visible{outline:2px solid var(--ngs-color-primary);outline-offset:2px}:host .overlay-field:hover{border-color:var(--ngs-color-primary);background:var(--ngs-color-primary)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field:hover{background:color-mix(in srgb,var(--ngs-color-primary),transparent 88%)}}:host .overlay-field.is-filled{background:transparent}:host .overlay-field.is-readonly{border-color:var(--ngs-color-border-strong);border-style:dashed;background:var(--ngs-color-surface);color:var(--ngs-color-on-surface-variant);cursor:default;opacity:.72}@supports (color: color-mix(in lab,red,red)){:host .overlay-field.is-readonly{background:color-mix(in srgb,var(--ngs-color-surface),transparent 18%)}}:host .overlay-field.is-readonly:hover{border-color:var(--ngs-color-border-strong);background:var(--ngs-color-surface)}@supports (color: color-mix(in lab,red,red)){:host .overlay-field.is-readonly:hover{background:color-mix(in srgb,var(--ngs-color-surface),transparent 18%)}}:host .overlay-slot-primary,:host .overlay-slot-footer,:host .overlay-slot-side{align-items:flex-start}:host .overlay-slot-signature,:host .overlay-slot-initials{justify-content:center}:host .overlay-type-text{align-items:flex-start;cursor:text;padding:calc(var(--spacing, .25rem) * 2.5) calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 1.5)}:host .overlay-type-text .field-value,:host .overlay-type-text .text-field-editor{display:block;width:100%;margin:0;color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-md);font-weight:400;line-height:1.25;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap}:host .overlay-type-text .field-value.is-placeholder{color:var(--ngs-color-on-surface-variant)}:host .overlay-type-text .text-field-editor{min-height:0;border:0;outline:0;background:transparent;box-shadow:none;padding:0}:host .overlay-type-text .text-field-editor:empty:before{color:var(--ngs-color-on-surface-variant);content:attr(data-placeholder);pointer-events:none}:host .overlay-type-variable{border-color:var(--ngs-color-warning);background:var(--ngs-color-warning-container);color:var(--ngs-color-on-warning-container)}@supports (color: color-mix(in lab,red,red)){:host .overlay-type-variable{border-color:color-mix(in srgb,var(--ngs-color-warning),transparent 30%)}}:host .overlay-type-variable .field-badge{color:var(--ngs-color-warning)}:host .overlay-type-date{flex-direction:row;align-items:center;justify-content:flex-start;padding:0 calc(var(--spacing, .25rem) * 2)}:host .overlay-type-date .field-badge{width:100%;height:100%;align-items:center;gap:calc(var(--spacing, .25rem) * 2)}:host .overlay-type-date ngs-icon{flex:none;font-size:var(--ngs-font-size-xl)}:host .overlay-type-date .field-value{min-width:0;margin:0;font-size:var(--ngs-font-size-sm);font-weight:400;line-height:1}:host .overlay-type-initials{justify-content:center}:host .overlay-type-signature,:host .overlay-type-stamp{flex-direction:row;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 3);padding:0 calc(var(--spacing, .25rem) * 4)}:host .overlay-type-signature .field-badge,:host .overlay-type-stamp .field-badge{width:auto;min-height:0;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 3)}:host .overlay-type-signature .field-label,:host .overlay-type-stamp .field-label{display:inline;color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-md);font-weight:400;line-height:1}:host .overlay-type-signature ngs-icon,:host .overlay-type-stamp ngs-icon{flex:none;font-size:var(--ngs-font-size-2xl)}:host .overlay-type-checkbox{align-items:center;justify-content:center;border-color:var(--ngs-color-border-strong);border-radius:calc(var(--spacing, .25rem) * .75);background:var(--ngs-color-surface);padding:0}:host .overlay-type-checkbox.is-filled{border-color:var(--ngs-color-primary);background:var(--ngs-color-primary);color:var(--ngs-color-on-primary)}:host .overlay-type-checkbox .checkbox-mark{font-size:var(--ngs-font-size-md)}:host .field-badge{display:inline-flex;min-width:0;max-width:100%;align-items:center;gap:calc(var(--spacing, .25rem) * 1.5);color:var(--ngs-color-primary);font-size:var(--ngs-font-size-xs);font-weight:500}:host .field-value{min-width:0;max-width:100%;overflow:hidden;color:var(--ngs-color-on-surface);text-overflow:ellipsis;white-space:nowrap}:host .field-value.is-placeholder{color:var(--ngs-color-on-surface-variant)}:host .initials-mark{border-bottom:2px solid currentColor;font-size:var(--ngs-font-size-lg);font-weight:500}:host .field-image{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}:host .date-picker-anchor{position:fixed;left:var(--pdf-signer-date-anchor-left, -10000px);top:var(--pdf-signer-date-anchor-top, -10000px);z-index:-1;width:var(--pdf-signer-date-anchor-width, calc(var(--spacing, .25rem) * 28));height:var(--pdf-signer-date-anchor-height, calc(var(--spacing, .25rem) * 7));border:0;opacity:0;pointer-events:none}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
798
|
+
}], ctorParameters: () => [], propDecorators: { schema: [{ type: i0.Input, args: [{ isSignal: true, alias: "schema", required: false }] }], signer: [{ type: i0.Input, args: [{ isSignal: true, alias: "signer", required: false }] }], showPageList: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageList", required: false }] }], showOtherSignerFields: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOtherSignerFields", required: false }] }], stamps: [{ type: i0.Input, args: [{ isSignal: true, alias: "stamps", required: false }] }], uploadedSignatures: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadedSignatures", required: false }] }], uploadedInitials: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadedInitials", required: false }] }], drawnSignatureUploadCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "drawnSignatureUploadCallback", required: false }] }], signatureImageUploadCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "signatureImageUploadCallback", required: false }] }], initialsImageUploadCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialsImageUploadCallback", required: false }] }], schemaChange: [{ type: i0.Output, args: ["schemaChange"] }], fieldValueChange: [{ type: i0.Output, args: ["fieldValueChange"] }], stampSelected: [{ type: i0.Output, args: ["stampSelected"] }], stampUploaded: [{ type: i0.Output, args: ["stampUploaded"] }], signatureSelected: [{ type: i0.Output, args: ["signatureSelected"] }], signatureUploaded: [{ type: i0.Output, args: ["signatureUploaded"] }], signatureDrawn: [{ type: i0.Output, args: ["signatureDrawn"] }], signatureTyped: [{ type: i0.Output, args: ["signatureTyped"] }], initialsSelected: [{ type: i0.Output, args: ["initialsSelected"] }], initialsUploaded: [{ type: i0.Output, args: ["initialsUploaded"] }], initialsTyped: [{ type: i0.Output, args: ["initialsTyped"] }], dateFieldPicker: [{ type: i0.ViewChild, args: ['dateFieldPicker', { isSignal: true }] }], dateFieldInput: [{ type: i0.ViewChild, args: ['dateFieldInput', { isSignal: true }] }], viewerScrollbar: [{ type: i0.ViewChild, args: ['viewerScrollbar', { isSignal: true }] }] } });
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Generated bundle index. Do not edit.
|
|
802
|
+
*/
|
|
803
|
+
|
|
804
|
+
export { PdfSigner };
|
|
805
|
+
//# sourceMappingURL=ngstarter-ui-components-pdf-signer.mjs.map
|