@verdocs/web-sdk 2.3.87 → 2.3.88
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/{utils-13f8ed3f.js → utils-e2bd04bf.js} +2 -4
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_15.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_8.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +37 -18
- package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +36 -17
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +3 -3
- package/dist/collection/utils/utils.js +2 -4
- package/dist/components/utils.js +2 -4
- package/dist/components/verdocs-sign.js +36 -17
- package/dist/docs.json +1 -1
- package/dist/esm/{utils-a56ee5e9.js → utils-f35325fe.js} +2 -4
- package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_15.entry.js +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_8.entry.js +1 -1
- package/dist/esm/verdocs-settings-api-keys_4.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +37 -18
- package/dist/esm/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm/verdocs-view.entry.js +1 -1
- package/dist/esm-es5/{utils-a56ee5e9.js → utils-f35325fe.js} +1 -1
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_15.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-view.entry.js +1 -1
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +1 -1
- package/dist/verdocs-web-sdk/{p-e63fe8b9.system.entry.js → p-078e5b77.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0ef04e14.system.entry.js → p-1a2d3a78.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-dd9dba09.entry.js → p-1acb7da0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-2ad3ba4f.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-bb983c03.entry.js → p-2b874610.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-aa49605f.system.entry.js → p-33c284a7.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-964f83ef.entry.js → p-43bdeda7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5c67e9f6.system.entry.js → p-473926f1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7f487279.entry.js → p-55e47f7d.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-69422d8f.system.entry.js → p-621549c9.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b72328af.js → p-632bdc29.js} +1 -1
- package/dist/verdocs-web-sdk/{p-3dc2013b.system.entry.js → p-64974b4f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-1fa5ef9a.entry.js → p-683e778c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-1823e8cd.entry.js → p-81acd17f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e1b527eb.entry.js → p-851737fb.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bb2b0122.entry.js → p-8a5ef117.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-21294863.system.entry.js → p-907de1bb.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-98c9b7d7.entry.js → p-9d8e63ea.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b55a122e.system.entry.js → p-a5499e42.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cf6a9502.entry.js → p-c0e43c7f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8de34628.system.entry.js → p-d0a110f1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0cafdb16.system.js → p-e041e991.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-04bef805.system.entry.js → p-ee408daa.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-012d2533.system.entry.js → p-f461f285.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/verdocs-web-sdk/p-c622d7b3.entry.js +0 -1
@@ -181,11 +181,9 @@ const updateDocumentFieldValue = (field) => {
|
|
181
181
|
existingField.setAttribute('disabled', false); // We need this to trigger a re-render
|
182
182
|
}
|
183
183
|
};
|
184
|
-
const renderDocumentField = (field, docPage, fieldOptions) => {
|
184
|
+
const renderDocumentField = (field, docPage, fieldOptions, tabIndex = 1) => {
|
185
185
|
var _a, _b;
|
186
|
-
// console.log('rdf', field);
|
187
186
|
const { disabled = false, editable = false, draggable = false, done = false } = fieldOptions;
|
188
|
-
// console.log('[renderDocumentField]', field, docPage, roleIndex, fieldOptions);
|
189
187
|
const controlsDiv = document.getElementById(docPage.containerId + '-controls');
|
190
188
|
if (!controlsDiv) {
|
191
189
|
console.log('[renderDocumentField] No controls DIV found', docPage.containerId + '-controls', docPage);
|
@@ -223,7 +221,7 @@ const renderDocumentField = (field, docPage, fieldOptions) => {
|
|
223
221
|
el.setAttribute('disabled', true);
|
224
222
|
}
|
225
223
|
else {
|
226
|
-
el.setAttribute('tabIndex',
|
224
|
+
el.setAttribute('tabIndex', tabIndex);
|
227
225
|
}
|
228
226
|
if (editable) {
|
229
227
|
el.setAttribute('editable', true);
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-5463795e.js');
|
6
6
|
require('./Types-f89f9116.js');
|
7
7
|
const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
8
|
-
const utils = require('./utils-
|
8
|
+
const utils = require('./utils-e2bd04bf.js');
|
9
9
|
require('./_commonjsHelpers-0c557e26.js');
|
10
10
|
require('./Envelopes-0b9deb2c.js');
|
11
11
|
require('./Types-f83b8488.js');
|
@@ -6,7 +6,7 @@ const index = require('./index-5463795e.js');
|
|
6
6
|
const Envelopes = require('./Envelopes-0b9deb2c.js');
|
7
7
|
require('./Types-f89f9116.js');
|
8
8
|
const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
9
|
-
const utils = require('./utils-
|
9
|
+
const utils = require('./utils-e2bd04bf.js');
|
10
10
|
require('./_commonjsHelpers-0c557e26.js');
|
11
11
|
require('./Types-f83b8488.js');
|
12
12
|
require('./index-7c19ba1d.js');
|
@@ -8,7 +8,7 @@ const Permissions = require('./Permissions-1436f847.js');
|
|
8
8
|
require('./Types-f89f9116.js');
|
9
9
|
const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
10
10
|
const Primitives = require('./Primitives-a59870a2.js');
|
11
|
-
const utils = require('./utils-
|
11
|
+
const utils = require('./utils-e2bd04bf.js');
|
12
12
|
const Toast = require('./Toast-06880504.js');
|
13
13
|
const errors = require('./errors-0396da3d.js');
|
14
14
|
require('./_commonjsHelpers-0c557e26.js');
|
@@ -6,7 +6,7 @@ const index = require('./index-5463795e.js');
|
|
6
6
|
const Colors = require('./Colors-e809dcc9.js');
|
7
7
|
const TemplateRoleStore = require('./TemplateRoleStore-a7f2b586.js');
|
8
8
|
const TemplateFieldStore = require('./TemplateFieldStore-3d25fc86.js');
|
9
|
-
const utils = require('./utils-
|
9
|
+
const utils = require('./utils-e2bd04bf.js');
|
10
10
|
const Icons = require('./Icons-3286d014.js');
|
11
11
|
const _commonjsHelpers = require('./_commonjsHelpers-0c557e26.js');
|
12
12
|
const Types = require('./Types-f83b8488.js');
|
@@ -6,7 +6,7 @@ const index = require('./index-5463795e.js');
|
|
6
6
|
const Colors = require('./Colors-e809dcc9.js');
|
7
7
|
const TemplateRoleStore = require('./TemplateRoleStore-a7f2b586.js');
|
8
8
|
const TemplateFieldStore = require('./TemplateFieldStore-3d25fc86.js');
|
9
|
-
const utils = require('./utils-
|
9
|
+
const utils = require('./utils-e2bd04bf.js');
|
10
10
|
require('./index-f712049c.js');
|
11
11
|
require('./_commonjsHelpers-0c557e26.js');
|
12
12
|
require('./Envelopes-0b9deb2c.js');
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-5463795e.js');
|
6
6
|
const Primitives = require('./Primitives-a59870a2.js');
|
7
|
-
const utils = require('./utils-
|
7
|
+
const utils = require('./utils-e2bd04bf.js');
|
8
8
|
const popper = require('./popper-d7adcfc6.js');
|
9
9
|
require('./_commonjsHelpers-0c557e26.js');
|
10
10
|
require('./Envelopes-0b9deb2c.js');
|
@@ -8,7 +8,7 @@ const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
|
8
8
|
const TemplateFieldStore = require('./TemplateFieldStore-3d25fc86.js');
|
9
9
|
const TemplateRoleStore = require('./TemplateRoleStore-a7f2b586.js');
|
10
10
|
const TemplateStore = require('./TemplateStore-62c90f8c.js');
|
11
|
-
const utils = require('./utils-
|
11
|
+
const utils = require('./utils-e2bd04bf.js');
|
12
12
|
const errors = require('./errors-0396da3d.js');
|
13
13
|
const Envelopes = require('./Envelopes-0b9deb2c.js');
|
14
14
|
const Validators = require('./Validators-16e6d7d1.js');
|
@@ -10,7 +10,7 @@ const Toast = require('./Toast-06880504.js');
|
|
10
10
|
const errors = require('./errors-0396da3d.js');
|
11
11
|
const Profiles = require('./Profiles-1a26e4eb.js');
|
12
12
|
const index$1 = require('./index-7c19ba1d.js');
|
13
|
-
const utils = require('./utils-
|
13
|
+
const utils = require('./utils-e2bd04bf.js');
|
14
14
|
require('./_commonjsHelpers-0c557e26.js');
|
15
15
|
require('./Envelopes-0b9deb2c.js');
|
16
16
|
require('./Types-f83b8488.js');
|
@@ -9,7 +9,7 @@ const Recipients = require('./Recipients-f3d6cf10.js');
|
|
9
9
|
const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
10
10
|
const Validators = require('./Validators-16e6d7d1.js');
|
11
11
|
const Primitives = require('./Primitives-a59870a2.js');
|
12
|
-
const utils = require('./utils-
|
12
|
+
const utils = require('./utils-e2bd04bf.js');
|
13
13
|
const TemplateFieldStore = require('./TemplateFieldStore-3d25fc86.js');
|
14
14
|
const Toast = require('./Toast-06880504.js');
|
15
15
|
const errors = require('./errors-0396da3d.js');
|
@@ -343,6 +343,24 @@ const VerdocsSign = class {
|
|
343
343
|
const { required = false } = field;
|
344
344
|
return !required || this.isFieldFilled(field);
|
345
345
|
}
|
346
|
+
getSortedFillableFields() {
|
347
|
+
const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
|
348
|
+
recipientFields.sort((a, b) => {
|
349
|
+
var _a, _b, _c, _d;
|
350
|
+
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
351
|
+
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
352
|
+
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
353
|
+
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
354
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
355
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
356
|
+
// the division is because no human makes perfect templates and frequently
|
357
|
+
// two fields on the "same line" will be slightly offset vertically.
|
358
|
+
const divaY = Math.floor(aY / 5);
|
359
|
+
const divbY = Math.floor(bY / 5);
|
360
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
361
|
+
});
|
362
|
+
return recipientFields;
|
363
|
+
}
|
346
364
|
async handleNext() {
|
347
365
|
var _a, _b;
|
348
366
|
if (this.nextSubmits) {
|
@@ -368,17 +386,21 @@ const VerdocsSign = class {
|
|
368
386
|
this.submitting = false;
|
369
387
|
return;
|
370
388
|
}
|
371
|
-
// Find and focus the next incomplete field (that is fillable)
|
372
|
-
const emptyFields = this.
|
373
|
-
.filter(field => !this.isFieldFilled(field)) // field.required)
|
374
|
-
.filter(field => field.type !== 'timestamp');
|
389
|
+
// Find and focus the next incomplete` field (that is fillable)
|
390
|
+
const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
|
375
391
|
emptyFields.sort((a, b) => {
|
376
392
|
var _a, _b, _c, _d;
|
377
393
|
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
378
394
|
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
379
395
|
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
380
396
|
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
381
|
-
|
397
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
398
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
399
|
+
// the division is because no human makes perfect templates and frequently
|
400
|
+
// two fields on the "same line" will be slightly offset vertically.
|
401
|
+
const divaY = Math.floor(aY / 5);
|
402
|
+
const divbY = Math.floor(bY / 5);
|
403
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
382
404
|
});
|
383
405
|
const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
|
384
406
|
let nextFocusedIndex = focusedIndex + 1;
|
@@ -460,22 +482,19 @@ const VerdocsSign = class {
|
|
460
482
|
}
|
461
483
|
handlePageRendered(e) {
|
462
484
|
const pageInfo = e.detail;
|
463
|
-
//
|
464
|
-
//
|
465
|
-
|
466
|
-
//
|
467
|
-
// this.envelope.fields.filter(field => field.recipient_role === this.recipient.role_name),
|
468
|
-
// );
|
469
|
-
const recipientFields = this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
470
|
-
// console.log('[SIGN] Page rendered, updating fields', {pageInfo, roleIndex, recipientFields});
|
485
|
+
// NOTE: We don't filter on pageNumber here because we need the position in the
|
486
|
+
// entire list to set the tabIndex.
|
487
|
+
const recipientFields = this.getSortedFillableFields();
|
488
|
+
// this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
471
489
|
// First render the fields for the signer
|
472
490
|
// Also show field placeholders for other signers who have yet to act
|
473
491
|
// In template list in Beta, show second date being sorted on
|
474
492
|
// Sign top to bottom left to right
|
475
|
-
recipientFields
|
476
|
-
|
477
|
-
|
478
|
-
|
493
|
+
recipientFields.forEach((field, tabIndex) => {
|
494
|
+
if (field.page !== pageInfo.pageNumber) {
|
495
|
+
return;
|
496
|
+
}
|
497
|
+
const el = utils.renderDocumentField(field, pageInfo, { disabled: false, editable: false, draggable: false, done: this.isDone }, tabIndex);
|
479
498
|
if (!el) {
|
480
499
|
return;
|
481
500
|
}
|
@@ -9,7 +9,7 @@ const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
|
9
9
|
const Fields = require('./Fields-705a2168.js');
|
10
10
|
const Primitives = require('./Primitives-a59870a2.js');
|
11
11
|
const TemplateFieldStore = require('./TemplateFieldStore-3d25fc86.js');
|
12
|
-
const utils = require('./utils-
|
12
|
+
const utils = require('./utils-e2bd04bf.js');
|
13
13
|
const TemplateRoleStore = require('./TemplateRoleStore-a7f2b586.js');
|
14
14
|
const TemplateStore = require('./TemplateStore-62c90f8c.js');
|
15
15
|
const errors = require('./errors-0396da3d.js');
|
@@ -8,7 +8,7 @@ const Permissions = require('./Permissions-1436f847.js');
|
|
8
8
|
require('./Types-f89f9116.js');
|
9
9
|
const VerdocsEndpoint = require('./VerdocsEndpoint-3036bbb7.js');
|
10
10
|
const Primitives = require('./Primitives-a59870a2.js');
|
11
|
-
const utils = require('./utils-
|
11
|
+
const utils = require('./utils-e2bd04bf.js');
|
12
12
|
const errors = require('./errors-0396da3d.js');
|
13
13
|
require('./_commonjsHelpers-0c557e26.js');
|
14
14
|
require('./Types-f83b8488.js');
|
@@ -320,6 +320,24 @@ export class VerdocsSign {
|
|
320
320
|
const { required = false } = field;
|
321
321
|
return !required || this.isFieldFilled(field);
|
322
322
|
}
|
323
|
+
getSortedFillableFields() {
|
324
|
+
const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
|
325
|
+
recipientFields.sort((a, b) => {
|
326
|
+
var _a, _b, _c, _d;
|
327
|
+
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
328
|
+
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
329
|
+
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
330
|
+
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
331
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
332
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
333
|
+
// the division is because no human makes perfect templates and frequently
|
334
|
+
// two fields on the "same line" will be slightly offset vertically.
|
335
|
+
const divaY = Math.floor(aY / 5);
|
336
|
+
const divbY = Math.floor(bY / 5);
|
337
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
338
|
+
});
|
339
|
+
return recipientFields;
|
340
|
+
}
|
323
341
|
async handleNext() {
|
324
342
|
var _a, _b;
|
325
343
|
if (this.nextSubmits) {
|
@@ -345,17 +363,21 @@ export class VerdocsSign {
|
|
345
363
|
this.submitting = false;
|
346
364
|
return;
|
347
365
|
}
|
348
|
-
// Find and focus the next incomplete field (that is fillable)
|
349
|
-
const emptyFields = this.
|
350
|
-
.filter(field => !this.isFieldFilled(field)) // field.required)
|
351
|
-
.filter(field => field.type !== 'timestamp');
|
366
|
+
// Find and focus the next incomplete` field (that is fillable)
|
367
|
+
const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
|
352
368
|
emptyFields.sort((a, b) => {
|
353
369
|
var _a, _b, _c, _d;
|
354
370
|
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
355
371
|
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
356
372
|
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
357
373
|
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
358
|
-
|
374
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
375
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
376
|
+
// the division is because no human makes perfect templates and frequently
|
377
|
+
// two fields on the "same line" will be slightly offset vertically.
|
378
|
+
const divaY = Math.floor(aY / 5);
|
379
|
+
const divbY = Math.floor(bY / 5);
|
380
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
359
381
|
});
|
360
382
|
const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
|
361
383
|
let nextFocusedIndex = focusedIndex + 1;
|
@@ -437,22 +459,19 @@ export class VerdocsSign {
|
|
437
459
|
}
|
438
460
|
handlePageRendered(e) {
|
439
461
|
const pageInfo = e.detail;
|
440
|
-
//
|
441
|
-
//
|
442
|
-
|
443
|
-
//
|
444
|
-
// this.envelope.fields.filter(field => field.recipient_role === this.recipient.role_name),
|
445
|
-
// );
|
446
|
-
const recipientFields = this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
447
|
-
// console.log('[SIGN] Page rendered, updating fields', {pageInfo, roleIndex, recipientFields});
|
462
|
+
// NOTE: We don't filter on pageNumber here because we need the position in the
|
463
|
+
// entire list to set the tabIndex.
|
464
|
+
const recipientFields = this.getSortedFillableFields();
|
465
|
+
// this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
448
466
|
// First render the fields for the signer
|
449
467
|
// Also show field placeholders for other signers who have yet to act
|
450
468
|
// In template list in Beta, show second date being sorted on
|
451
469
|
// Sign top to bottom left to right
|
452
|
-
recipientFields
|
453
|
-
|
454
|
-
|
455
|
-
|
470
|
+
recipientFields.forEach((field, tabIndex) => {
|
471
|
+
if (field.page !== pageInfo.pageNumber) {
|
472
|
+
return;
|
473
|
+
}
|
474
|
+
const el = renderDocumentField(field, pageInfo, { disabled: false, editable: false, draggable: false, done: this.isDone }, tabIndex);
|
456
475
|
if (!el) {
|
457
476
|
return;
|
458
477
|
}
|
@@ -3,9 +3,9 @@ export default {
|
|
3
3
|
title: 'Embeds/Sign',
|
4
4
|
component: 'verdocs-sign',
|
5
5
|
args: {
|
6
|
-
envelopeId: '',
|
7
|
-
roleId: '',
|
8
|
-
inviteCode: '',
|
6
|
+
envelopeId: 'f2de9204-c56f-4fe7-9348-0736bc14bbcd',
|
7
|
+
roleId: 'Recipient 1',
|
8
|
+
inviteCode: '817ce4e62d747611388276555afc0016',
|
9
9
|
},
|
10
10
|
argTypes: {
|
11
11
|
envelopeId: {
|
@@ -116,11 +116,9 @@ export const updateDocumentFieldValue = (field) => {
|
|
116
116
|
existingField.setAttribute('disabled', false); // We need this to trigger a re-render
|
117
117
|
}
|
118
118
|
};
|
119
|
-
export const renderDocumentField = (field, docPage, fieldOptions) => {
|
119
|
+
export const renderDocumentField = (field, docPage, fieldOptions, tabIndex = 1) => {
|
120
120
|
var _a, _b;
|
121
|
-
// console.log('rdf', field);
|
122
121
|
const { disabled = false, editable = false, draggable = false, done = false } = fieldOptions;
|
123
|
-
// console.log('[renderDocumentField]', field, docPage, roleIndex, fieldOptions);
|
124
122
|
const controlsDiv = document.getElementById(docPage.containerId + '-controls');
|
125
123
|
if (!controlsDiv) {
|
126
124
|
console.log('[renderDocumentField] No controls DIV found', docPage.containerId + '-controls', docPage);
|
@@ -158,7 +156,7 @@ export const renderDocumentField = (field, docPage, fieldOptions) => {
|
|
158
156
|
el.setAttribute('disabled', true);
|
159
157
|
}
|
160
158
|
else {
|
161
|
-
el.setAttribute('tabIndex',
|
159
|
+
el.setAttribute('tabIndex', tabIndex);
|
162
160
|
}
|
163
161
|
if (editable) {
|
164
162
|
el.setAttribute('editable', true);
|
package/dist/components/utils.js
CHANGED
@@ -137,11 +137,9 @@ const updateDocumentFieldValue = (field) => {
|
|
137
137
|
existingField.setAttribute('disabled', false); // We need this to trigger a re-render
|
138
138
|
}
|
139
139
|
};
|
140
|
-
const renderDocumentField = (field, docPage, fieldOptions) => {
|
140
|
+
const renderDocumentField = (field, docPage, fieldOptions, tabIndex = 1) => {
|
141
141
|
var _a, _b;
|
142
|
-
// console.log('rdf', field);
|
143
142
|
const { disabled = false, editable = false, draggable = false, done = false } = fieldOptions;
|
144
|
-
// console.log('[renderDocumentField]', field, docPage, roleIndex, fieldOptions);
|
145
143
|
const controlsDiv = document.getElementById(docPage.containerId + '-controls');
|
146
144
|
if (!controlsDiv) {
|
147
145
|
console.log('[renderDocumentField] No controls DIV found', docPage.containerId + '-controls', docPage);
|
@@ -179,7 +177,7 @@ const renderDocumentField = (field, docPage, fieldOptions) => {
|
|
179
177
|
el.setAttribute('disabled', true);
|
180
178
|
}
|
181
179
|
else {
|
182
|
-
el.setAttribute('tabIndex',
|
180
|
+
el.setAttribute('tabIndex', tabIndex);
|
183
181
|
}
|
184
182
|
if (editable) {
|
185
183
|
el.setAttribute('editable', true);
|
@@ -343,6 +343,24 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
343
343
|
const { required = false } = field;
|
344
344
|
return !required || this.isFieldFilled(field);
|
345
345
|
}
|
346
|
+
getSortedFillableFields() {
|
347
|
+
const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
|
348
|
+
recipientFields.sort((a, b) => {
|
349
|
+
var _a, _b, _c, _d;
|
350
|
+
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
351
|
+
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
352
|
+
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
353
|
+
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
354
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
355
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
356
|
+
// the division is because no human makes perfect templates and frequently
|
357
|
+
// two fields on the "same line" will be slightly offset vertically.
|
358
|
+
const divaY = Math.floor(aY / 5);
|
359
|
+
const divbY = Math.floor(bY / 5);
|
360
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
361
|
+
});
|
362
|
+
return recipientFields;
|
363
|
+
}
|
346
364
|
async handleNext() {
|
347
365
|
var _a, _b;
|
348
366
|
if (this.nextSubmits) {
|
@@ -368,17 +386,21 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
368
386
|
this.submitting = false;
|
369
387
|
return;
|
370
388
|
}
|
371
|
-
// Find and focus the next incomplete field (that is fillable)
|
372
|
-
const emptyFields = this.
|
373
|
-
.filter(field => !this.isFieldFilled(field)) // field.required)
|
374
|
-
.filter(field => field.type !== 'timestamp');
|
389
|
+
// Find and focus the next incomplete` field (that is fillable)
|
390
|
+
const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
|
375
391
|
emptyFields.sort((a, b) => {
|
376
392
|
var _a, _b, _c, _d;
|
377
393
|
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
378
394
|
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
379
395
|
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
380
396
|
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
381
|
-
|
397
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
398
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
399
|
+
// the division is because no human makes perfect templates and frequently
|
400
|
+
// two fields on the "same line" will be slightly offset vertically.
|
401
|
+
const divaY = Math.floor(aY / 5);
|
402
|
+
const divbY = Math.floor(bY / 5);
|
403
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
382
404
|
});
|
383
405
|
const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
|
384
406
|
let nextFocusedIndex = focusedIndex + 1;
|
@@ -460,22 +482,19 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
460
482
|
}
|
461
483
|
handlePageRendered(e) {
|
462
484
|
const pageInfo = e.detail;
|
463
|
-
//
|
464
|
-
//
|
465
|
-
|
466
|
-
//
|
467
|
-
// this.envelope.fields.filter(field => field.recipient_role === this.recipient.role_name),
|
468
|
-
// );
|
469
|
-
const recipientFields = this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
470
|
-
// console.log('[SIGN] Page rendered, updating fields', {pageInfo, roleIndex, recipientFields});
|
485
|
+
// NOTE: We don't filter on pageNumber here because we need the position in the
|
486
|
+
// entire list to set the tabIndex.
|
487
|
+
const recipientFields = this.getSortedFillableFields();
|
488
|
+
// this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
471
489
|
// First render the fields for the signer
|
472
490
|
// Also show field placeholders for other signers who have yet to act
|
473
491
|
// In template list in Beta, show second date being sorted on
|
474
492
|
// Sign top to bottom left to right
|
475
|
-
recipientFields
|
476
|
-
|
477
|
-
|
478
|
-
|
493
|
+
recipientFields.forEach((field, tabIndex) => {
|
494
|
+
if (field.page !== pageInfo.pageNumber) {
|
495
|
+
return;
|
496
|
+
}
|
497
|
+
const el = renderDocumentField(field, pageInfo, { disabled: false, editable: false, draggable: false, done: this.isDone }, tabIndex);
|
479
498
|
if (!el) {
|
480
499
|
return;
|
481
500
|
}
|
package/dist/docs.json
CHANGED
@@ -179,11 +179,9 @@ const updateDocumentFieldValue = (field) => {
|
|
179
179
|
existingField.setAttribute('disabled', false); // We need this to trigger a re-render
|
180
180
|
}
|
181
181
|
};
|
182
|
-
const renderDocumentField = (field, docPage, fieldOptions) => {
|
182
|
+
const renderDocumentField = (field, docPage, fieldOptions, tabIndex = 1) => {
|
183
183
|
var _a, _b;
|
184
|
-
// console.log('rdf', field);
|
185
184
|
const { disabled = false, editable = false, draggable = false, done = false } = fieldOptions;
|
186
|
-
// console.log('[renderDocumentField]', field, docPage, roleIndex, fieldOptions);
|
187
185
|
const controlsDiv = document.getElementById(docPage.containerId + '-controls');
|
188
186
|
if (!controlsDiv) {
|
189
187
|
console.log('[renderDocumentField] No controls DIV found', docPage.containerId + '-controls', docPage);
|
@@ -221,7 +219,7 @@ const renderDocumentField = (field, docPage, fieldOptions) => {
|
|
221
219
|
el.setAttribute('disabled', true);
|
222
220
|
}
|
223
221
|
else {
|
224
|
-
el.setAttribute('tabIndex',
|
222
|
+
el.setAttribute('tabIndex', tabIndex);
|
225
223
|
}
|
226
224
|
if (editable) {
|
227
225
|
el.setAttribute('editable', true);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
|
2
2
|
import './Types-5f31149e.js';
|
3
3
|
import { V as VerdocsEndpoint } from './VerdocsEndpoint-8196ff47.js';
|
4
|
-
import { c as convertToE164 } from './utils-
|
4
|
+
import { c as convertToE164 } from './utils-f35325fe.js';
|
5
5
|
import './_commonjsHelpers-5ec8f9b7.js';
|
6
6
|
import './Envelopes-627c5239.js';
|
7
7
|
import './Types-086facf7.js';
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, a as getElement
|
|
2
2
|
import { m as getEnvelopeDocumentPageDisplayUri } from './Envelopes-627c5239.js';
|
3
3
|
import './Types-5f31149e.js';
|
4
4
|
import { V as VerdocsEndpoint } from './VerdocsEndpoint-8196ff47.js';
|
5
|
-
import { t as throttle } from './utils-
|
5
|
+
import { t as throttle } from './utils-f35325fe.js';
|
6
6
|
import './_commonjsHelpers-5ec8f9b7.js';
|
7
7
|
import './Types-086facf7.js';
|
8
8
|
import './index-914ed6f7.js';
|
@@ -4,7 +4,7 @@ import { g as getRecipientsWithActions, a as userCanAct, b as userCanCancelEnvel
|
|
4
4
|
import './Types-5f31149e.js';
|
5
5
|
import { V as VerdocsEndpoint } from './VerdocsEndpoint-8196ff47.js';
|
6
6
|
import { i as integerSequence } from './Primitives-8fe93caf.js';
|
7
|
-
import { s as saveEnvelopesAsZip } from './utils-
|
7
|
+
import { s as saveEnvelopesAsZip } from './utils-f35325fe.js';
|
8
8
|
import { V as VerdocsToast } from './Toast-f3b8fd46.js';
|
9
9
|
import { S as SDKError } from './errors-9b5498c8.js';
|
10
10
|
import './_commonjsHelpers-5ec8f9b7.js';
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, a
|
|
2
2
|
import { g as getRGBA } from './Colors-1b298092.js';
|
3
3
|
import { g as getTemplateRoleStore, a as getRoleIndex } from './TemplateRoleStore-33229997.js';
|
4
4
|
import { g as getTemplateFieldStore, u as updateStoreField } from './TemplateFieldStore-6e67e86b.js';
|
5
|
-
import { g as getFieldSettings, t as throttle, k as getControlStyles, b as getFieldId, h as getFieldOptionId, l as fileToDataUrl } from './utils-
|
5
|
+
import { g as getFieldSettings, t as throttle, k as getControlStyles, b as getFieldId, h as getFieldOptionId, l as fileToDataUrl } from './utils-f35325fe.js';
|
6
6
|
import { S as SettingsIcon } from './Icons-ddea87bf.js';
|
7
7
|
import { c as createCommonjsModule, a as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-5ec8f9b7.js';
|
8
8
|
import { a as FORMAT_DATE, F as FORMAT_TIMESTAMP } from './Types-086facf7.js';
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment }
|
|
2
2
|
import { g as getRGBA } from './Colors-1b298092.js';
|
3
3
|
import { g as getTemplateRoleStore, a as getRoleIndex } from './TemplateRoleStore-33229997.js';
|
4
4
|
import { g as getTemplateFieldStore } from './TemplateFieldStore-6e67e86b.js';
|
5
|
-
import { g as getFieldSettings } from './utils-
|
5
|
+
import { g as getFieldSettings } from './utils-f35325fe.js';
|
6
6
|
import './index-4439b0d1.js';
|
7
7
|
import './_commonjsHelpers-5ec8f9b7.js';
|
8
8
|
import './Envelopes-627c5239.js';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-172625c5.js';
|
2
2
|
import { i as integerSequence } from './Primitives-8fe93caf.js';
|
3
|
-
import { d as renderedTextWidth } from './utils-
|
3
|
+
import { d as renderedTextWidth } from './utils-f35325fe.js';
|
4
4
|
import { c as createPopper } from './popper-15e448b4.js';
|
5
5
|
import './_commonjsHelpers-5ec8f9b7.js';
|
6
6
|
import './Envelopes-627c5239.js';
|
@@ -4,7 +4,7 @@ import { V as VerdocsEndpoint, b as createTemplatev2, u as updateTemplate } from
|
|
4
4
|
import { g as getTemplateFieldStore } from './TemplateFieldStore-6e67e86b.js';
|
5
5
|
import { g as getTemplateRoleStore, b as getRoleNames, a as getRoleIndex } from './TemplateRoleStore-33229997.js';
|
6
6
|
import { g as getTemplateStore } from './TemplateStore-940da116.js';
|
7
|
-
import { r as renderDocumentField } from './utils-
|
7
|
+
import { r as renderDocumentField } from './utils-f35325fe.js';
|
8
8
|
import { S as SDKError } from './errors-9b5498c8.js';
|
9
9
|
import { j as createEnvelope } from './Envelopes-627c5239.js';
|
10
10
|
import { a as isValidEmail, i as isValidPhone } from './Validators-16a2a43b.js';
|
@@ -6,7 +6,7 @@ import { V as VerdocsToast } from './Toast-f3b8fd46.js';
|
|
6
6
|
import { S as SDKError } from './errors-9b5498c8.js';
|
7
7
|
import { g as getRoles, a as getCurrentProfile, u as updateProfile } from './Profiles-d4df4d1c.js';
|
8
8
|
import { f as format } from './index-914ed6f7.js';
|
9
|
-
import { c as convertToE164 } from './utils-
|
9
|
+
import { c as convertToE164 } from './utils-f35325fe.js';
|
10
10
|
import './_commonjsHelpers-5ec8f9b7.js';
|
11
11
|
import './Envelopes-627c5239.js';
|
12
12
|
import './Types-086facf7.js';
|