@verdocs/web-sdk 4.2.124 → 4.2.127
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-checkbox_4.cjs.entry.js +3 -4
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +3 -7
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +7 -4
- package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_9.cjs.entry.js +49 -37
- package/dist/cjs/verdocs-sign.cjs.entry.js +6 -3
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/controls/verdocs-portal/verdocs-portal.js +1 -1
- package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.css +5 -1
- package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js +1 -1
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +7 -4
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +6 -3
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +7 -4
- package/dist/collection/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.js +1 -5
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +3 -4
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +47 -35
- package/dist/components/verdocs-field-dropdown2.js +1 -5
- package/dist/components/verdocs-portal2.js +1 -1
- package/dist/components/verdocs-preview2.js +7 -4
- package/dist/components/verdocs-sign.js +6 -3
- package/dist/components/verdocs-template-field-properties2.js +3 -4
- package/dist/components/verdocs-template-fields2.js +46 -35
- package/dist/components/verdocs-upload-dialog2.js +2 -2
- package/dist/components/verdocs-view2.js +7 -4
- package/dist/custom-elements.json +2056 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-checkbox_4.entry.js +3 -4
- package/dist/esm/verdocs-field-attachment_13.entry.js +3 -7
- package/dist/esm/verdocs-kba-dialog_2.entry.js +7 -4
- package/dist/esm/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_9.entry.js +49 -37
- package/dist/esm/verdocs-sign.entry.js +6 -3
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_9.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +3 -1
- package/dist/verdocs-web-sdk/p-174325c3.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-70006d4d.entry.js → p-1cd86ef4.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-267df026.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-2cc041aa.system.entry.js → p-377858e5.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bc9928a8.entry.js → p-40cc1c52.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-588d94b5.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-fdba52be.system.entry.js → p-5b5a0ba2.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-766e30ab.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-4fb62279.entry.js → p-b3c4d445.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7d7ca35a.system.entry.js → p-caaecfc2.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b5a223b6.system.entry.js → p-d7f0bb8b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-d879bb87.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-fc620807.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/verdocs-web-sdk/p-02af8123.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-12608391.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-43a7fce5.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-5313e672.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7cad3ec7.system.entry.js +0 -1
@@ -81,7 +81,7 @@ export class VerdocsUploadDialog {
|
|
81
81
|
render() {
|
82
82
|
var _a;
|
83
83
|
const existingFile = ((_a = this.existingFile) === null || _a === void 0 ? void 0 : _a.name) ? this.existingFile : null;
|
84
|
-
return (h(Host, { key: 'e7a5e6df6d936adbfe74ba8e212dfe79816b0c05' }, h("div", { key: 'b534d7c777b37af48c27498337b62daca283e22e', class: "background-overlay", onClick: e => this.handleDismiss(e) }, h("div", { key: '11967dfddc9da736bdf1957ee3743b1777dc971e', class: "upload-dialog-content" }, h("div", { key: 'ec967b175dfc6edffbfc57537f0a6c12f8cf3844', class: "heading" }, "Upload attachment"), this.selectedFiles.length < 1 && existingFile && (h(Fragment, { key: '9e6ec10aeacb411d5fefada717b9d724520e0869' }, h("div", { key: '5b5cd3c87833d862fd361e84155c3622d51280d1', class: "current-label" }, "Current Attachment"), h("div", { key: '866c221a7b3bda742d336d2c111da02b8fd4a960', class: "attachments", style: { marginTop: '0' } }, h("div", { key: '345302d3801fe2b0f2e69ed64d2cba8f42e57174', class: "attachment" }, h("div", { key: '7a9a948fa18aca0a99b76f089622113de7e24cee', class: "icon", innerHTML: PaperclipIcon }), h("div", { key: '5dced948f61febe18703583f7e4a3b9827782cff', class: "name" }, existingFile.name), h("div", { key: '9e715db7009c444ae2ebcdc2f7ac15e9165d2798', class: "icon trash", innerHTML: TrashIcon, onClick: () => (this.confirmDelete = true) }))))), this.selectedFiles.length < 1 && !existingFile && (h("div", { key: 'bf4a4796aeaa0d3a941299e482198c58acc26912', class: { 'drop-target': true, 'dragging-over': this.draggingOver }, onDragOver: e => this.handleDragOver(e), onDragLeave: e => this.handleDragLeave(e), onDrop: e => this.handleDrop(e) }, h("p", { key: '73708b0cc4f5a17b25336546bc167500de6b7d33' }, "Drag and drop
|
84
|
+
return (h(Host, { key: 'e7a5e6df6d936adbfe74ba8e212dfe79816b0c05' }, h("div", { key: 'b534d7c777b37af48c27498337b62daca283e22e', class: "background-overlay", onClick: e => this.handleDismiss(e) }, h("div", { key: '11967dfddc9da736bdf1957ee3743b1777dc971e', class: "upload-dialog-content" }, h("div", { key: 'ec967b175dfc6edffbfc57537f0a6c12f8cf3844', class: "heading" }, "Upload attachment"), this.selectedFiles.length < 1 && existingFile && (h(Fragment, { key: '9e6ec10aeacb411d5fefada717b9d724520e0869' }, h("div", { key: '5b5cd3c87833d862fd361e84155c3622d51280d1', class: "current-label" }, "Current Attachment"), h("div", { key: '866c221a7b3bda742d336d2c111da02b8fd4a960', class: "attachments", style: { marginTop: '0' } }, h("div", { key: '345302d3801fe2b0f2e69ed64d2cba8f42e57174', class: "attachment" }, h("div", { key: '7a9a948fa18aca0a99b76f089622113de7e24cee', class: "icon", innerHTML: PaperclipIcon }), h("div", { key: '5dced948f61febe18703583f7e4a3b9827782cff', class: "name" }, existingFile.name), h("div", { key: '9e715db7009c444ae2ebcdc2f7ac15e9165d2798', class: "icon trash", innerHTML: TrashIcon, onClick: () => (this.confirmDelete = true) }))))), this.selectedFiles.length < 1 && !existingFile && (h("div", { key: 'bf4a4796aeaa0d3a941299e482198c58acc26912', class: { 'drop-target': true, 'dragging-over': this.draggingOver }, onDragOver: e => this.handleDragOver(e), onDragLeave: e => this.handleDragLeave(e), onDrop: e => this.handleDrop(e) }, h("p", { key: '73708b0cc4f5a17b25336546bc167500de6b7d33' }, "Drag and drop your files here:"), h("p", { key: 'b4a07e8326d43f446eaecf13fd0f400fb17cd6bc', class: "subscript" }, "Supported files: PDF, Word"), h("verdocs-button", { key: '5bfb3c923be8b81cc658ed8e0c065e0b4173f223', label: !!existingFile ? 'Replace files' : 'Select files', onClick: () => this.handleSelectFile() }), h("input", { key: 'c79faf14a271446bb49c5392a09da3f436c3ea38', type: "file", ref: el => (this.fileInput = el), style: { display: 'none' }, onChange: () => this.handleFileChange() }))), this.selectedFiles.length > 0 && (h("div", { key: '00d5e4e07d8f4d0dfd883ce28f14c54a8191ca87', class: "attachments" }, this.selectedFiles.map((file, index) => (h("div", { class: "attachment" }, h("div", { class: "icon", innerHTML: PaperclipIcon }), h("div", { class: "name" }, file.name), h("div", { class: "icon trash", innerHTML: TrashIcon, onClick: () => this.handleRemoveAttachment(index) })))))), !!this.errorMessage && h("div", { key: '4206cad3dcff0055fc5f3ea8e7c217ae33c63263', class: "error" }, this.errorMessage), h("div", { key: 'e6debad16cfbae400e8e0bd42b5a928a8a233f5a', class: "buttons" }, h("verdocs-button", { key: '9dc79a516fb2f49b30f958d875b2bef8c9d78aad', label: "Cancel", variant: "outline", onClick: () => this.handleCancel() }), h("verdocs-button", { key: '45bf5a77c30a2e562a7e56637dee743800b197da', label: "Upload", onClick: () => this.handleDone(), disabled: !!this.errorMessage || this.selectedFiles.length < 1 })))), this.confirmDelete && (h("verdocs-ok-dialog", { key: '80a4428099ca88e49f84d20c5e36e54dc45be3c6', heading: "Delete Attachment?", message: "Are you sure you wish to delete this attachment? This action cannot be undone.", showCancel: true, onExit: e => {
|
85
85
|
// So we don't close the upload dialog
|
86
86
|
e.preventDefault();
|
87
87
|
e.stopPropagation();
|
@@ -76,10 +76,13 @@ export class VerdocsPreview {
|
|
76
76
|
}
|
77
77
|
return (h(Host, null, (((_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.documents) || []).map(document => {
|
78
78
|
const pageNumbers = integerSequence(1, document.pages);
|
79
|
-
return (h(Fragment, null, pageNumbers.map(pageNumber =>
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
80
|
+
const pageSize = document.page_sizes[pageNumber];
|
81
|
+
return (h("verdocs-template-document-page", { templateId: document.template_id, documentId: document.id, pageNumber: pageNumber, disabled: true, editable: false, done: false, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, onPageRendered: e => this.handlePageRendered(e), layers: [
|
82
|
+
{ name: 'page', type: 'canvas' },
|
83
|
+
{ name: 'controls', type: 'div' },
|
84
|
+
] }));
|
85
|
+
})));
|
83
86
|
})));
|
84
87
|
}
|
85
88
|
static get is() { return "verdocs-preview"; }
|
@@ -248,6 +248,8 @@ export class VerdocsSign {
|
|
248
248
|
async handleFieldChange(field, e) {
|
249
249
|
const { value, checked } = e.target;
|
250
250
|
switch (field.type) {
|
251
|
+
// TODO: Remove legacy type when no longer needed
|
252
|
+
case 'textarea':
|
251
253
|
case 'textbox':
|
252
254
|
return this.saveFieldChange(field.name, { prepared: false, value });
|
253
255
|
case 'checkbox': {
|
@@ -389,7 +391,7 @@ export class VerdocsSign {
|
|
389
391
|
nextFocusedIndex = 0;
|
390
392
|
}
|
391
393
|
let nextRequiredField = emptyFields[nextFocusedIndex];
|
392
|
-
console.log('Next field', nextRequiredField);
|
394
|
+
console.log('Next field', nextRequiredField, emptyFields);
|
393
395
|
// Skip signature and initial fields that are already filled in. We have to count our "skips" just in case, to avoid infinite loops.
|
394
396
|
let skips = 0;
|
395
397
|
if (skips < emptyFields.length && ['signature', 'initial'].includes(nextRequiredField.type) && ['initialed', 'signed'].includes(nextRequiredField.value)) {
|
@@ -406,8 +408,8 @@ export class VerdocsSign {
|
|
406
408
|
if (nextRequiredField) {
|
407
409
|
const id = getFieldId(nextRequiredField);
|
408
410
|
const el = document.getElementById(id);
|
411
|
+
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
409
412
|
el === null || el === void 0 ? void 0 : el.focusField();
|
410
|
-
el === null || el === void 0 ? void 0 : el.scrollTo({ behavior: 'smooth', top: 0 });
|
411
413
|
this.focusedField = nextRequiredField.name;
|
412
414
|
}
|
413
415
|
}
|
@@ -598,6 +600,7 @@ export class VerdocsSign {
|
|
598
600
|
return (h(Host, null, h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), !this.finishLater && h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), h("div", { class: "document", style: { paddingTop: '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
|
599
601
|
const pageNumbers = integerSequence(1, envelopeDocument.pages);
|
600
602
|
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
603
|
+
const pageSize = envelopeDocument.page_sizes[pageNumber];
|
601
604
|
// In signing mode we show the original template page with all the recipient fields so we can show source formatting and
|
602
605
|
// where everything went. This is also a visual indicator when optional fields weren't filled in by previous actors, or
|
603
606
|
// future signers still need to act. Once we're "done" we flip to showing the envelope's documents which have the final
|
@@ -606,7 +609,7 @@ export class VerdocsSign {
|
|
606
609
|
// TODO: Confirm that a pure page-number match is good enough to find the matching template page. We need to make sure
|
607
610
|
// we either don't reset our page numbers for additional attachments, or add match-on identifiers to work around that.
|
608
611
|
// console.log('tp', templatePage, page);
|
609
|
-
return (h("verdocs-envelope-document-page", { envelopeId: this.envelopeId, documentId: envelopeDocument.id, endpoint: this.endpoint, virtualWidth: 612, virtualHeight: 792, pageNumber: pageNumber, onPageRendered: e => this.handlePageRendered(e), type: "filled", layers: [
|
612
|
+
return (h("verdocs-envelope-document-page", { envelopeId: this.envelopeId, documentId: envelopeDocument.id, endpoint: this.endpoint, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, pageNumber: pageNumber, onPageRendered: e => this.handlePageRendered(e), type: "filled", layers: [
|
610
613
|
{ name: 'page', type: 'canvas' },
|
611
614
|
{ name: 'controls', type: 'div' },
|
612
615
|
] }));
|
@@ -165,10 +165,13 @@ export class VerdocsView {
|
|
165
165
|
.filter(document => document.type !== 'certificate')
|
166
166
|
.map(envelopeDocument => {
|
167
167
|
const pageNumbers = integerSequence(1, envelopeDocument.pages);
|
168
|
-
return (h(Fragment, null, pageNumbers.map(pageNumber =>
|
169
|
-
|
170
|
-
|
171
|
-
|
168
|
+
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
169
|
+
const pageSize = envelopeDocument.page_sizes[pageNumber];
|
170
|
+
return (h("verdocs-envelope-document-page", { envelopeId: this.envelopeId, documentId: envelopeDocument.id, endpoint: this.endpoint, type: "filled", virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, pageNumber: pageNumber, onPageRendered: e => this.handlePageRendered(e), layers: [
|
171
|
+
{ name: 'page', type: 'canvas' },
|
172
|
+
{ name: 'controls', type: 'div' },
|
173
|
+
] }));
|
174
|
+
})));
|
172
175
|
})), this.showCancelDone && (h("verdocs-ok-dialog", { heading: "Cancelled", message: `This envelope has been cancelled successfully.`, onNext: () => {
|
173
176
|
this.showCancelDone = false;
|
174
177
|
} })), this.canceling && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null)))));
|
@@ -59,11 +59,7 @@ export class VerdocsFieldDropdown {
|
|
59
59
|
// TODO: Look for other places this mistaken assumption was made.
|
60
60
|
// Defaults only apply in destructuring if undefined. null doesn't trigger it.
|
61
61
|
options || (options = []);
|
62
|
-
|
63
|
-
console.log('[DROPDOWN] Dropdown has no options, hiding field...', fieldname);
|
64
|
-
return h(Host, null);
|
65
|
-
}
|
66
|
-
return (h(Host, { class: { required, disabled, done, focused }, style: { backgroundColor } }, label && h("label", null, label), h("select", { disabled: disabled, onChange: e => this.handleChange(e) }, h("option", { value: "" }, "Select..."), options.map(option => (h("option", { value: option.id, selected: option.id === value }, option.label)))), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
|
62
|
+
return (h(Host, { class: { required, disabled, done, focused }, style: { backgroundColor } }, label && h("label", null, label), h("select", { disabled: disabled, onChange: e => this.handleChange(e) }, h("option", { value: "" }, "Select..."), options.map(option => (h("option", { value: option.id, selected: option.id === value }, option.label))), !options.length && h("option", { value: "NA" }, "N/A")), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
|
67
63
|
e.stopPropagation();
|
68
64
|
this.showingProperties = !this.showingProperties;
|
69
65
|
} }), this.showingProperties && (h("verdocs-portal", { anchor: `verdocs-settings-panel-trigger-${fieldname}`, onClickAway: () => (this.showingProperties = false) }, h("verdocs-template-field-properties", { templateId: templateid, fieldName: fieldname, onClose: () => (this.showingProperties = false), onDelete: () => {
|
@@ -66,9 +66,6 @@ export class VerdocsTemplateFieldProperties {
|
|
66
66
|
console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in fields`);
|
67
67
|
return;
|
68
68
|
}
|
69
|
-
else {
|
70
|
-
console.log('[FIELD PROPERTIES]', field);
|
71
|
-
}
|
72
69
|
this.type = field.type;
|
73
70
|
this.name = field.name;
|
74
71
|
this.label = field.label;
|
@@ -149,6 +146,8 @@ export class VerdocsTemplateFieldProperties {
|
|
149
146
|
if (this.helpText && this.showingHelp) {
|
150
147
|
return (h(Host, null, h("h6", null, capitalize(this.fieldType), " Settings ", h("div", { style: { flex: '1' } }), h("div", { class: "help-icon", innerHTML: HelpIcon, onClick: () => (this.showingHelp = false) })), h("p", { class: "instructions", innerHTML: this.helpText })));
|
151
148
|
}
|
149
|
+
const hasOptions = this.options.filter(opt => (opt.id || '').trim() !== '' || (opt.label || '').trim() !== '').length > 0;
|
150
|
+
const saveDisabled = !this.dirty || (this.type === 'dropdown' && !hasOptions);
|
152
151
|
return (h(Host, { id: "verdocs-template-field-properties" }, h("h6", null, capitalize(this.fieldType.replace(/_/g, ' ')), " Settings ", h("div", { style: { flex: '1' } }), this.helpText && h("div", { class: "help-icon", innerHTML: HelpIcon, onClick: () => (this.showingHelp = true) })), h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { class: "row" }, h("verdocs-text-input", { id: "verdocs-field-name", label: "Field Name", value: this.name, autocomplete: "off",
|
153
152
|
// helpText="The internal name of the field. Must be unique, and contain only letters, numbers, and dashes. After an envelope is completed, the value entered by the signer will be tagged with this key."
|
154
153
|
placeholder: "Field Name...", onInput: (e) => {
|
@@ -187,7 +186,7 @@ export class VerdocsTemplateFieldProperties {
|
|
187
186
|
this.options = this.options.filter(opt => opt.id !== option.id);
|
188
187
|
this.dirty = true;
|
189
188
|
this.cleanupOptions();
|
190
|
-
} })))))), h("div", { class: "buttons" }, h("button", { class: "delete-button", disabled: this.dirty, onClick: e => this.handleDelete(e), innerHTML: TrashIcon }), h("div", { style: { flex: '1' } }), h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled:
|
189
|
+
} })))))), h("div", { class: "buttons" }, h("button", { class: "delete-button", disabled: this.dirty, onClick: e => this.handleDelete(e), innerHTML: TrashIcon }), h("div", { style: { flex: '1' } }), h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled: saveDisabled, onClick: e => !saveDisabled && this.handleSave(e) })))));
|
191
190
|
}
|
192
191
|
static get is() { return "verdocs-template-field-properties"; }
|
193
192
|
static get originalStyleUrls() {
|
package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js
CHANGED
@@ -51,8 +51,17 @@ export class VerdocsTemplateFields {
|
|
51
51
|
this.selectedRoleName = '';
|
52
52
|
this.loading = true;
|
53
53
|
}
|
54
|
+
onTemplateIdChanged(newTemplateId) {
|
55
|
+
this.loadTemplate(newTemplateId).catch((e) => console.log('Unknown Error', e));
|
56
|
+
}
|
57
|
+
// Stop field-placement mode if ESC is pressed
|
58
|
+
handleKeyDown(ev) {
|
59
|
+
if (ev.key === 'Escape') {
|
60
|
+
this.placing = null;
|
61
|
+
}
|
62
|
+
}
|
54
63
|
async componentWillLoad() {
|
55
|
-
var _a, _b, _c;
|
64
|
+
var _a, _b, _c, _d, _e, _f;
|
56
65
|
try {
|
57
66
|
this.endpoint.loadSession();
|
58
67
|
if (!this.templateId) {
|
@@ -63,27 +72,17 @@ export class VerdocsTemplateFields {
|
|
63
72
|
console.log('[FIELDS] Unable to start builder session, must be authenticated');
|
64
73
|
return;
|
65
74
|
}
|
66
|
-
|
67
|
-
.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
this.
|
72
|
-
|
73
|
-
this.loading = false;
|
74
|
-
this.fieldStore.onChange('fields', fields => {
|
75
|
-
var _a;
|
76
|
-
console.log('[FIELDS] Fields changed', { fields });
|
77
|
-
(_a = this.fieldsUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, fields });
|
78
|
-
});
|
79
|
-
})
|
80
|
-
.catch(e => {
|
81
|
-
console.log(e);
|
82
|
-
});
|
75
|
+
try {
|
76
|
+
this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));
|
77
|
+
}
|
78
|
+
catch (e) {
|
79
|
+
console.log('[FIELDS] Error loading template', e);
|
80
|
+
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
81
|
+
}
|
83
82
|
}
|
84
83
|
catch (e) {
|
85
84
|
console.log('[FIELDS] Error with fields session', e);
|
86
|
-
(
|
85
|
+
(_d = this.sdkError) === null || _d === void 0 ? void 0 : _d.emit(new SDKError(e.message, (_e = e.response) === null || _e === void 0 ? void 0 : _e.status, (_f = e.response) === null || _f === void 0 ? void 0 : _f.data));
|
87
86
|
}
|
88
87
|
}
|
89
88
|
componentDidRender() {
|
@@ -97,23 +96,27 @@ export class VerdocsTemplateFields {
|
|
97
96
|
}
|
98
97
|
}
|
99
98
|
componentWillUpdate() {
|
100
|
-
var _a;
|
99
|
+
var _a, _b;
|
101
100
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
102
|
-
const roles = this.roleStore.get('roles');
|
101
|
+
const roles = ((_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.get('roles')) || [];
|
103
102
|
if (!this.selectedRoleName || !roles.find(role => role && role.name === this.selectedRoleName)) {
|
104
|
-
this.selectedRoleName = ((
|
103
|
+
this.selectedRoleName = ((_b = roles[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
105
104
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
106
105
|
}
|
107
106
|
}
|
108
|
-
|
109
|
-
|
110
|
-
if (
|
111
|
-
this.
|
107
|
+
async loadTemplate(templateId) {
|
108
|
+
var _a, _b;
|
109
|
+
if (templateId) {
|
110
|
+
this.loading = true;
|
111
|
+
this.templateStore = await getTemplateStore(this.endpoint, templateId, false);
|
112
|
+
this.roleStore = getTemplateRoleStore(this.templateId);
|
113
|
+
this.fieldStore = getTemplateFieldStore(this.templateId);
|
114
|
+
this.selectedRoleName = ((_b = (_a = this.roleStore.get('roles')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
115
|
+
this.loading = false;
|
116
|
+
// TODO: Necessary?
|
117
|
+
// this.fieldsUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, fields});
|
112
118
|
}
|
113
119
|
}
|
114
|
-
// async handleFieldChange(field: ITemplateField, e: any, optionId?: string) {
|
115
|
-
// console.log('[FIELDS] handleFieldChange', field, e, optionId);
|
116
|
-
// }
|
117
120
|
attachFieldAttributes(pageInfo, field, el) {
|
118
121
|
// el.addEventListener('input', e => this.handleFieldChange(field, e));
|
119
122
|
el.addEventListener('settingsChanged', () => {
|
@@ -303,10 +306,13 @@ export class VerdocsTemplateFields {
|
|
303
306
|
}
|
304
307
|
} })))), h("div", { class: "pages" }, (((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.documents) || []).map(document => {
|
305
308
|
const pageNumbers = integerSequence(1, document.pages);
|
306
|
-
return pageNumbers.map(page =>
|
307
|
-
|
308
|
-
|
309
|
-
|
309
|
+
return pageNumbers.map(page => {
|
310
|
+
const pageSize = document.page_sizes[page];
|
311
|
+
return (h("verdocs-template-document-page", { templateId: this.templateId, documentId: document.id, pageNumber: page, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, disabled: true, editable: true, done: false, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
|
312
|
+
{ name: 'page', type: 'canvas' },
|
313
|
+
{ name: 'controls', type: 'div' },
|
314
|
+
] }));
|
315
|
+
});
|
310
316
|
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: this.roleStore.get('roles').length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
|
311
317
|
}
|
312
318
|
static get is() { return "verdocs-template-fields"; }
|
@@ -346,7 +352,7 @@ export class VerdocsTemplateFields {
|
|
346
352
|
},
|
347
353
|
"templateId": {
|
348
354
|
"type": "string",
|
349
|
-
"mutable":
|
355
|
+
"mutable": true,
|
350
356
|
"complexType": {
|
351
357
|
"original": "string | null",
|
352
358
|
"resolved": "string",
|
@@ -359,7 +365,7 @@ export class VerdocsTemplateFields {
|
|
359
365
|
"text": "The ID of the template to create the document from."
|
360
366
|
},
|
361
367
|
"attribute": "template-id",
|
362
|
-
"reflect":
|
368
|
+
"reflect": true,
|
363
369
|
"defaultValue": "null"
|
364
370
|
},
|
365
371
|
"toolbarTargetId": {
|
@@ -466,6 +472,12 @@ export class VerdocsTemplateFields {
|
|
466
472
|
}
|
467
473
|
}];
|
468
474
|
}
|
475
|
+
static get watchers() {
|
476
|
+
return [{
|
477
|
+
"propName": "templateId",
|
478
|
+
"methodName": "onTemplateIdChanged"
|
479
|
+
}];
|
480
|
+
}
|
469
481
|
static get listeners() {
|
470
482
|
return [{
|
471
483
|
"name": "keydown",
|
@@ -73,11 +73,7 @@ const VerdocsFieldDropdown = /*@__PURE__*/ proxyCustomElement(class VerdocsField
|
|
73
73
|
// TODO: Look for other places this mistaken assumption was made.
|
74
74
|
// Defaults only apply in destructuring if undefined. null doesn't trigger it.
|
75
75
|
options || (options = []);
|
76
|
-
|
77
|
-
console.log('[DROPDOWN] Dropdown has no options, hiding field...', fieldname);
|
78
|
-
return h(Host, null);
|
79
|
-
}
|
80
|
-
return (h(Host, { class: { required, disabled, done, focused }, style: { backgroundColor } }, label && h("label", null, label), h("select", { disabled: disabled, onChange: e => this.handleChange(e) }, h("option", { value: "" }, "Select..."), options.map(option => (h("option", { value: option.id, selected: option.id === value }, option.label)))), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
|
76
|
+
return (h(Host, { class: { required, disabled, done, focused }, style: { backgroundColor } }, label && h("label", null, label), h("select", { disabled: disabled, onChange: e => this.handleChange(e) }, h("option", { value: "" }, "Select..."), options.map(option => (h("option", { value: option.id, selected: option.id === value }, option.label))), !options.length && h("option", { value: "NA" }, "N/A")), editable && (h(Fragment, null, h("div", { id: `verdocs-settings-panel-trigger-${fieldname}`, style: { transform: `scale(${Math.floor((1 / xscale) * 1000) / 1000}, ${Math.floor((1 / yscale) * 1000) / 1000})` }, class: "settings-icon", innerHTML: SettingsIcon, onClick: (e) => {
|
81
77
|
e.stopPropagation();
|
82
78
|
this.showingProperties = !this.showingProperties;
|
83
79
|
} }), this.showingProperties && (h("verdocs-portal", { anchor: `verdocs-settings-panel-trigger-${fieldname}`, onClickAway: () => (this.showingProperties = false) }, h("verdocs-template-field-properties", { templateId: templateid, fieldName: fieldname, onClose: () => (this.showingProperties = false), onDelete: () => {
|
@@ -39,7 +39,7 @@ const VerdocsPortal = /*@__PURE__*/ proxyCustomElement(class VerdocsPortal exten
|
|
39
39
|
// Math.max(anchorRect.left + anchorRect.width - this.portal.offsetWidth, 0);
|
40
40
|
const popupWidth = ((_a = this.element) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 400;
|
41
41
|
const offRightEdge = leftOfPopup + popupWidth > rightOfViewportWithScroll;
|
42
|
-
return offRightEdge ?
|
42
|
+
return offRightEdge ? rightOfViewportWithScroll - popupWidth - 20 : leftOfPopup;
|
43
43
|
}
|
44
44
|
calculateTop() {
|
45
45
|
var _a;
|
@@ -95,10 +95,13 @@ const VerdocsPreview = /*@__PURE__*/ proxyCustomElement(class VerdocsPreview ext
|
|
95
95
|
}
|
96
96
|
return (h(Host, null, (((_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.documents) || []).map(document => {
|
97
97
|
const pageNumbers = integerSequence(1, document.pages);
|
98
|
-
return (h(Fragment, null, pageNumbers.map(pageNumber =>
|
99
|
-
|
100
|
-
|
101
|
-
|
98
|
+
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
99
|
+
const pageSize = document.page_sizes[pageNumber];
|
100
|
+
return (h("verdocs-template-document-page", { templateId: document.template_id, documentId: document.id, pageNumber: pageNumber, disabled: true, editable: false, done: false, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, onPageRendered: e => this.handlePageRendered(e), layers: [
|
101
|
+
{ name: 'page', type: 'canvas' },
|
102
|
+
{ name: 'controls', type: 'div' },
|
103
|
+
] }));
|
104
|
+
})));
|
102
105
|
})));
|
103
106
|
}
|
104
107
|
static get watchers() { return {
|
@@ -247,6 +247,8 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
247
247
|
async handleFieldChange(field, e) {
|
248
248
|
const { value, checked } = e.target;
|
249
249
|
switch (field.type) {
|
250
|
+
// TODO: Remove legacy type when no longer needed
|
251
|
+
case 'textarea':
|
250
252
|
case 'textbox':
|
251
253
|
return this.saveFieldChange(field.name, { prepared: false, value });
|
252
254
|
case 'checkbox': {
|
@@ -388,7 +390,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
388
390
|
nextFocusedIndex = 0;
|
389
391
|
}
|
390
392
|
let nextRequiredField = emptyFields[nextFocusedIndex];
|
391
|
-
console.log('Next field', nextRequiredField);
|
393
|
+
console.log('Next field', nextRequiredField, emptyFields);
|
392
394
|
// Skip signature and initial fields that are already filled in. We have to count our "skips" just in case, to avoid infinite loops.
|
393
395
|
let skips = 0;
|
394
396
|
if (skips < emptyFields.length && ['signature', 'initial'].includes(nextRequiredField.type) && ['initialed', 'signed'].includes(nextRequiredField.value)) {
|
@@ -405,8 +407,8 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
405
407
|
if (nextRequiredField) {
|
406
408
|
const id = getFieldId(nextRequiredField);
|
407
409
|
const el = document.getElementById(id);
|
410
|
+
el === null || el === void 0 ? void 0 : el.scrollIntoView({ behavior: 'smooth' });
|
408
411
|
el === null || el === void 0 ? void 0 : el.focusField();
|
409
|
-
el === null || el === void 0 ? void 0 : el.scrollTo({ behavior: 'smooth', top: 0 });
|
410
412
|
this.focusedField = nextRequiredField.name;
|
411
413
|
}
|
412
414
|
}
|
@@ -597,6 +599,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
597
599
|
return (h(Host, null, h("div", { id: "verdocs-sign-header" }, h("div", { class: "inner" }, h("img", { src: "https://verdocs.com/assets/white-logo.svg", alt: "Verdocs Logo", class: "logo" }), h("div", { class: "title" }, this.envelope.name), h("div", { style: { flex: '1' } }), !this.finishLater && h("verdocs-button", { size: "xsmall", label: this.nextButtonLabel, disabled: !this.agreed, onClick: () => this.handleNext() }), h("div", { style: { marginLeft: '10px' } }), h("verdocs-dropdown", { options: !this.isDone && !this.finishLater ? inProgressMenuOptions : doneMenuOptions, onOptionSelected: e => this.handleOptionSelected(e) }))), h("div", { class: "document", style: { paddingTop: '15px' } }, (this.envelope.documents || []).map(envelopeDocument => {
|
598
600
|
const pageNumbers = integerSequence(1, envelopeDocument.pages);
|
599
601
|
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
602
|
+
const pageSize = envelopeDocument.page_sizes[pageNumber];
|
600
603
|
// In signing mode we show the original template page with all the recipient fields so we can show source formatting and
|
601
604
|
// where everything went. This is also a visual indicator when optional fields weren't filled in by previous actors, or
|
602
605
|
// future signers still need to act. Once we're "done" we flip to showing the envelope's documents which have the final
|
@@ -605,7 +608,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
|
|
605
608
|
// TODO: Confirm that a pure page-number match is good enough to find the matching template page. We need to make sure
|
606
609
|
// we either don't reset our page numbers for additional attachments, or add match-on identifiers to work around that.
|
607
610
|
// console.log('tp', templatePage, page);
|
608
|
-
return (h("verdocs-envelope-document-page", { envelopeId: this.envelopeId, documentId: envelopeDocument.id, endpoint: this.endpoint, virtualWidth: 612, virtualHeight: 792, pageNumber: pageNumber, onPageRendered: e => this.handlePageRendered(e), type: "filled", layers: [
|
611
|
+
return (h("verdocs-envelope-document-page", { envelopeId: this.envelopeId, documentId: envelopeDocument.id, endpoint: this.endpoint, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, pageNumber: pageNumber, onPageRendered: e => this.handlePageRendered(e), type: "filled", layers: [
|
609
612
|
{ name: 'page', type: 'canvas' },
|
610
613
|
{ name: 'controls', type: 'div' },
|
611
614
|
] }));
|
@@ -79,9 +79,6 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class Ve
|
|
79
79
|
console.log(`[FIELD PROPERTIES] Unable to find field "${this.fieldName}" in fields`);
|
80
80
|
return;
|
81
81
|
}
|
82
|
-
else {
|
83
|
-
console.log('[FIELD PROPERTIES]', field);
|
84
|
-
}
|
85
82
|
this.type = field.type;
|
86
83
|
this.name = field.name;
|
87
84
|
this.label = field.label;
|
@@ -162,6 +159,8 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class Ve
|
|
162
159
|
if (this.helpText && this.showingHelp) {
|
163
160
|
return (h(Host, null, h("h6", null, capitalize(this.fieldType), " Settings ", h("div", { style: { flex: '1' } }), h("div", { class: "help-icon", innerHTML: HelpIcon, onClick: () => (this.showingHelp = false) })), h("p", { class: "instructions", innerHTML: this.helpText })));
|
164
161
|
}
|
162
|
+
const hasOptions = this.options.filter(opt => (opt.id || '').trim() !== '' || (opt.label || '').trim() !== '').length > 0;
|
163
|
+
const saveDisabled = !this.dirty || (this.type === 'dropdown' && !hasOptions);
|
165
164
|
return (h(Host, { id: "verdocs-template-field-properties" }, h("h6", null, capitalize(this.fieldType.replace(/_/g, ' ')), " Settings ", h("div", { style: { flex: '1' } }), this.helpText && h("div", { class: "help-icon", innerHTML: HelpIcon, onClick: () => (this.showingHelp = true) })), h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("div", { class: "row" }, h("verdocs-text-input", { id: "verdocs-field-name", label: "Field Name", value: this.name, autocomplete: "off",
|
166
165
|
// helpText="The internal name of the field. Must be unique, and contain only letters, numbers, and dashes. After an envelope is completed, the value entered by the signer will be tagged with this key."
|
167
166
|
placeholder: "Field Name...", onInput: (e) => {
|
@@ -200,7 +199,7 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class Ve
|
|
200
199
|
this.options = this.options.filter(opt => opt.id !== option.id);
|
201
200
|
this.dirty = true;
|
202
201
|
this.cleanupOptions();
|
203
|
-
} })))))), h("div", { class: "buttons" }, h("button", { class: "delete-button", disabled: this.dirty, onClick: e => this.handleDelete(e), innerHTML: TrashIcon }), h("div", { style: { flex: '1' } }), h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled:
|
202
|
+
} })))))), h("div", { class: "buttons" }, h("button", { class: "delete-button", disabled: this.dirty, onClick: e => this.handleDelete(e), innerHTML: TrashIcon }), h("div", { style: { flex: '1' } }), h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled: saveDisabled, onClick: e => !saveDisabled && this.handleSave(e) })))));
|
204
203
|
}
|
205
204
|
get el() { return this; }
|
206
205
|
static get style() { return VerdocsTemplateFieldPropertiesStyle0; }
|
@@ -81,8 +81,17 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class VerdocsTemp
|
|
81
81
|
this.selectedRoleName = '';
|
82
82
|
this.loading = true;
|
83
83
|
}
|
84
|
+
onTemplateIdChanged(newTemplateId) {
|
85
|
+
this.loadTemplate(newTemplateId).catch((e) => console.log('Unknown Error', e));
|
86
|
+
}
|
87
|
+
// Stop field-placement mode if ESC is pressed
|
88
|
+
handleKeyDown(ev) {
|
89
|
+
if (ev.key === 'Escape') {
|
90
|
+
this.placing = null;
|
91
|
+
}
|
92
|
+
}
|
84
93
|
async componentWillLoad() {
|
85
|
-
var _a, _b, _c;
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
86
95
|
try {
|
87
96
|
this.endpoint.loadSession();
|
88
97
|
if (!this.templateId) {
|
@@ -93,27 +102,17 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class VerdocsTemp
|
|
93
102
|
console.log('[FIELDS] Unable to start builder session, must be authenticated');
|
94
103
|
return;
|
95
104
|
}
|
96
|
-
|
97
|
-
.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
this.
|
102
|
-
|
103
|
-
this.loading = false;
|
104
|
-
this.fieldStore.onChange('fields', fields => {
|
105
|
-
var _a;
|
106
|
-
console.log('[FIELDS] Fields changed', { fields });
|
107
|
-
(_a = this.fieldsUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, fields });
|
108
|
-
});
|
109
|
-
})
|
110
|
-
.catch(e => {
|
111
|
-
console.log(e);
|
112
|
-
});
|
105
|
+
try {
|
106
|
+
this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));
|
107
|
+
}
|
108
|
+
catch (e) {
|
109
|
+
console.log('[FIELDS] Error loading template', e);
|
110
|
+
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
111
|
+
}
|
113
112
|
}
|
114
113
|
catch (e) {
|
115
114
|
console.log('[FIELDS] Error with fields session', e);
|
116
|
-
(
|
115
|
+
(_d = this.sdkError) === null || _d === void 0 ? void 0 : _d.emit(new SDKError(e.message, (_e = e.response) === null || _e === void 0 ? void 0 : _e.status, (_f = e.response) === null || _f === void 0 ? void 0 : _f.data));
|
117
116
|
}
|
118
117
|
}
|
119
118
|
componentDidRender() {
|
@@ -127,23 +126,27 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class VerdocsTemp
|
|
127
126
|
}
|
128
127
|
}
|
129
128
|
componentWillUpdate() {
|
130
|
-
var _a;
|
129
|
+
var _a, _b;
|
131
130
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
132
|
-
const roles = this.roleStore.get('roles');
|
131
|
+
const roles = ((_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.get('roles')) || [];
|
133
132
|
if (!this.selectedRoleName || !roles.find(role => role && role.name === this.selectedRoleName)) {
|
134
|
-
this.selectedRoleName = ((
|
133
|
+
this.selectedRoleName = ((_b = roles[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
135
134
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
136
135
|
}
|
137
136
|
}
|
138
|
-
|
139
|
-
|
140
|
-
if (
|
141
|
-
this.
|
137
|
+
async loadTemplate(templateId) {
|
138
|
+
var _a, _b;
|
139
|
+
if (templateId) {
|
140
|
+
this.loading = true;
|
141
|
+
this.templateStore = await getTemplateStore(this.endpoint, templateId, false);
|
142
|
+
this.roleStore = getTemplateRoleStore(this.templateId);
|
143
|
+
this.fieldStore = getTemplateFieldStore(this.templateId);
|
144
|
+
this.selectedRoleName = ((_b = (_a = this.roleStore.get('roles')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
145
|
+
this.loading = false;
|
146
|
+
// TODO: Necessary?
|
147
|
+
// this.fieldsUpdated?.emit({event: 'updated', endpoint: this.endpoint, templateId: this.templateId, fields});
|
142
148
|
}
|
143
149
|
}
|
144
|
-
// async handleFieldChange(field: ITemplateField, e: any, optionId?: string) {
|
145
|
-
// console.log('[FIELDS] handleFieldChange', field, e, optionId);
|
146
|
-
// }
|
147
150
|
attachFieldAttributes(pageInfo, field, el) {
|
148
151
|
// el.addEventListener('input', e => this.handleFieldChange(field, e));
|
149
152
|
el.addEventListener('settingsChanged', () => {
|
@@ -333,22 +336,30 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class VerdocsTemp
|
|
333
336
|
}
|
334
337
|
} })))), h("div", { class: "pages" }, (((_c = (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.documents) || []).map(document => {
|
335
338
|
const pageNumbers = integerSequence(1, document.pages);
|
336
|
-
return pageNumbers.map(page =>
|
337
|
-
|
338
|
-
|
339
|
-
|
339
|
+
return pageNumbers.map(page => {
|
340
|
+
const pageSize = document.page_sizes[page];
|
341
|
+
return (h("verdocs-template-document-page", { templateId: this.templateId, documentId: document.id, pageNumber: page, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, disabled: true, editable: true, done: false, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
|
342
|
+
{ name: 'page', type: 'canvas' },
|
343
|
+
{ name: 'controls', type: 'div' },
|
344
|
+
] }));
|
345
|
+
});
|
340
346
|
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: this.roleStore.get('roles').length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
|
341
347
|
}
|
348
|
+
static get watchers() { return {
|
349
|
+
"templateId": ["onTemplateIdChanged"]
|
350
|
+
}; }
|
342
351
|
static get style() { return VerdocsTemplateFieldsStyle0; }
|
343
352
|
}, [0, "verdocs-template-fields", {
|
344
353
|
"endpoint": [16],
|
345
|
-
"templateId": [
|
354
|
+
"templateId": [1537, "template-id"],
|
346
355
|
"toolbarTargetId": [1, "toolbar-target-id"],
|
347
356
|
"placing": [32],
|
348
357
|
"showMustSelectRole": [32],
|
349
358
|
"selectedRoleName": [32],
|
350
359
|
"loading": [32]
|
351
|
-
}, [[4, "keydown", "handleKeyDown"]]
|
360
|
+
}, [[4, "keydown", "handleKeyDown"]], {
|
361
|
+
"templateId": ["onTemplateIdChanged"]
|
362
|
+
}]);
|
352
363
|
function defineCustomElement() {
|
353
364
|
if (typeof customElements === "undefined") {
|
354
365
|
return;
|