@verdocs/web-sdk 1.13.2 → 1.13.4
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-button-panel_3.cjs.entry.js +25 -27
- package/dist/cjs/verdocs-checkbox_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-date.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +19 -5
- package/dist/cjs/verdocs-template-create_3.cjs.entry.js +4 -3
- package/dist/cjs/verdocs-view.cjs.entry.js +20 -4
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/controls/verdocs-checkbox/verdocs-checkbox.css +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +19 -5
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.css +10 -0
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +20 -4
- package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.css +12 -11
- package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js +1 -1
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +1 -1
- package/dist/collection/components/fields/verdocs-field-radio-button-group/verdocs-field-radio-button.js +1 -1
- package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +1 -1
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +1 -1
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +25 -27
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.css +11 -1
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +3 -2
- package/dist/components/verdocs-checkbox2.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +2 -2
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-radio-button.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-sign.js +19 -5
- package/dist/components/verdocs-template-field-properties2.js +25 -27
- package/dist/components/verdocs-template-fields2.js +14 -7
- package/dist/components/verdocs-view2.js +33 -11
- package/dist/custom-elements.json +1546 -0
- package/dist/docs.json +19 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-button-panel_3.entry.js +25 -27
- package/dist/esm/verdocs-checkbox_4.entry.js +1 -1
- package/dist/esm/verdocs-field-checkbox.entry.js +2 -2
- package/dist/esm/verdocs-field-date.entry.js +1 -1
- package/dist/esm/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +19 -5
- package/dist/esm/verdocs-template-create_3.entry.js +4 -3
- package/dist/esm/verdocs-view.entry.js +20 -4
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-checkbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-create_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-view.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +1 -1
- package/dist/types/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.d.ts +1 -0
- package/dist/verdocs-web-sdk/p-0714e785.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-13f91d03.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-6a0e0615.system.entry.js → p-16f3cd2d.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bc287bf9.system.entry.js → p-1a34942f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-d8343849.entry.js → p-39e906e0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7306abd0.system.entry.js → p-3b1b11a8.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c35bbaef.entry.js → p-40bb871d.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8eca5dd8.entry.js → p-42fa6b2f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-5308d546.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-60b59333.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-6caf1137.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-ba62a8f6.system.entry.js → p-798c0134.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-923f56f3.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-c21c0c00.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-c2b91d4d.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5a3d9d9f.system.entry.js → p-d595eba2.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-d643db3b.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e16ad8fe.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-92a2bb47.entry.js → p-ebce4300.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-eff8b358.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-f2f3583f.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/verdocs-web-sdk/p-2cb414ec.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-36a31514.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-530e47e2.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-65abb620.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7f927fb9.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-8d32078d.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-beb19fae.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-c2770861.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-d7ca70cc.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f7910b66.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-fd5d31ad.system.entry.js +0 -1
@@ -131,17 +131,20 @@ export class VerdocsSign {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
handleClickAgree() {
|
134
|
+
this.submitting = true;
|
134
135
|
envelopeRecipientAgree(this.endpoint, this.envelopeId, this.roleId, true)
|
135
136
|
.then(() => {
|
136
137
|
var _a;
|
137
138
|
this.nextButtonLabel = 'Next';
|
138
139
|
this.recipient.agreed = true;
|
140
|
+
this.submitting = false;
|
139
141
|
this.agreed = true; // The server returns a recipient object but it's not "deep" so we track this locally
|
140
142
|
(_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: this.envelope, event: 'agreed' });
|
141
143
|
})
|
142
144
|
.catch(e => {
|
143
145
|
var _a, _b, _c;
|
144
146
|
console.log('Update failure', e);
|
147
|
+
this.submitting = false;
|
145
148
|
(_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));
|
146
149
|
});
|
147
150
|
}
|
@@ -180,6 +183,7 @@ export class VerdocsSign {
|
|
180
183
|
}
|
181
184
|
}
|
182
185
|
updateRecipientFieldValue(fieldName, updateResult) {
|
186
|
+
console.log('[SIGN] updateRecipientFieldValue', fieldName);
|
183
187
|
this.recipient.fields.forEach(oldField => {
|
184
188
|
if (oldField.name === fieldName) {
|
185
189
|
oldField.settings = updateResult.settings;
|
@@ -190,10 +194,9 @@ export class VerdocsSign {
|
|
190
194
|
});
|
191
195
|
}
|
192
196
|
saveFieldChange(fieldName, fields) {
|
197
|
+
console.log('[SIGN] updateRecipientFieldValue', fieldName);
|
193
198
|
Envelopes.updateEnvelopeField(this.endpoint, this.envelopeId, fieldName, fields) //
|
194
|
-
.then(updateResult =>
|
195
|
-
this.updateRecipientFieldValue(fieldName, updateResult);
|
196
|
-
})
|
199
|
+
.then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
|
197
200
|
.catch(e => {
|
198
201
|
var _a, _b, _c, _d, _e, _f;
|
199
202
|
if (((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 401 && ((_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === 'jwt expired') {
|
@@ -347,7 +350,18 @@ export class VerdocsSign {
|
|
347
350
|
}
|
348
351
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
349
352
|
var _a;
|
350
|
-
el.addEventListener('input', () =>
|
353
|
+
el.addEventListener('input', (e) => {
|
354
|
+
console.log('[SIGN] onfieldInput', e.detail, e.target.value);
|
355
|
+
// These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
|
356
|
+
// text boxes because we'd be updating the field on every keystroke. We do those on blur which fires fieldChange.
|
357
|
+
if (e.target.name.includes('checkbox_group') || e.target.name.includes('radio_button_group')) {
|
358
|
+
console.log('CB', e.target);
|
359
|
+
this.handleFieldChange(field, e).finally(() => this.checkRecipientFields());
|
360
|
+
}
|
361
|
+
else {
|
362
|
+
this.checkRecipientFields();
|
363
|
+
}
|
364
|
+
});
|
351
365
|
el.addEventListener('focusout', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
352
366
|
el.addEventListener('fieldChange', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
353
367
|
el.setAttribute('roleindex', roleIndex);
|
@@ -452,7 +466,7 @@ export class VerdocsSign {
|
|
452
466
|
return (h(Host, null, h("verdocs-loader", null)));
|
453
467
|
}
|
454
468
|
if (this.isDone) {
|
455
|
-
return (h(Host, { class: { agreed: this.agreed } },
|
469
|
+
return (h(Host, { class: { agreed: this.agreed } }, h("verdocs-view", { endpoint: this.endpoint, envelopeId: this.envelopeId, onSdkError: e => { var _a; return (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }), this.errorMessage && h("verdocs-ok-dialog", { heading: "Network Error", message: this.errorMessage, onNext: () => (this.errorMessage = '') }), this.showDone && (h("verdocs-ok-dialog", { heading: "You're Done!", message: `You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`, onNext: () => {
|
456
470
|
this.showDone = false;
|
457
471
|
this.isDone = true;
|
458
472
|
} })), this.submitting && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null)))));
|
@@ -31,6 +31,16 @@ verdocs-view .document .inner {
|
|
31
31
|
width: 100%;
|
32
32
|
max-width: 1028px;
|
33
33
|
}
|
34
|
+
verdocs-view .loading-indicator {
|
35
|
+
top: 0;
|
36
|
+
left: 0;
|
37
|
+
right: 0;
|
38
|
+
bottom: 0;
|
39
|
+
display: flex;
|
40
|
+
z-index: 10000;
|
41
|
+
position: fixed;
|
42
|
+
background-color: rgba(0, 0, 0, 0.7);
|
43
|
+
}
|
34
44
|
|
35
45
|
#verdocs-view-header {
|
36
46
|
width: 100%;
|
@@ -13,7 +13,7 @@ export class VerdocsView {
|
|
13
13
|
this.endpoint = VerdocsEndpoint.getDefault();
|
14
14
|
this.envelopeId = '';
|
15
15
|
this.headerTargetId = null;
|
16
|
-
this.
|
16
|
+
this.canceling = false;
|
17
17
|
this.envelope = null;
|
18
18
|
this.roleNames = [];
|
19
19
|
this.showCancelDone = false;
|
@@ -61,7 +61,23 @@ export class VerdocsView {
|
|
61
61
|
case 'cancel':
|
62
62
|
// TODO: Better option for inline-flow confirmation and alert dialogs.
|
63
63
|
if (confirm('Are you sure you wish to cancel this envelope? This action cannot be undone.')) {
|
64
|
-
|
64
|
+
this.canceling = true;
|
65
|
+
cancelEnvelope(this.endpoint, this.envelopeId)
|
66
|
+
.then(r => {
|
67
|
+
this.canceling = false;
|
68
|
+
console.log('[VIEW] Envelope canceled', r);
|
69
|
+
return throttledGetEnvelope(this.endpoint, this.envelopeId);
|
70
|
+
})
|
71
|
+
.then(env => {
|
72
|
+
console.log('[VIEW] Loaded new envelope details', env);
|
73
|
+
this.envelope = env;
|
74
|
+
})
|
75
|
+
.catch(e => {
|
76
|
+
var _a, _b, _c;
|
77
|
+
this.canceling = false;
|
78
|
+
console.log('[VIEW] Error canceling envelope', e);
|
79
|
+
(_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));
|
80
|
+
});
|
65
81
|
this.showCancelDone = true;
|
66
82
|
(_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: this.envelope, event: 'canceled' });
|
67
83
|
}
|
@@ -136,7 +152,7 @@ export class VerdocsView {
|
|
136
152
|
] })))));
|
137
153
|
})), this.showCancelDone && (h("verdocs-ok-dialog", { heading: "Cancelled", message: `This envelope has been cancelled successfully.`, onNext: () => {
|
138
154
|
this.showCancelDone = false;
|
139
|
-
} }))));
|
155
|
+
} })), this.canceling && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null)))));
|
140
156
|
}
|
141
157
|
static get is() { return "verdocs-view"; }
|
142
158
|
static get originalStyleUrls() {
|
@@ -212,7 +228,7 @@ export class VerdocsView {
|
|
212
228
|
}
|
213
229
|
static get states() {
|
214
230
|
return {
|
215
|
-
"
|
231
|
+
"canceling": {},
|
216
232
|
"envelope": {},
|
217
233
|
"roleNames": {},
|
218
234
|
"showCancelDone": {}
|
@@ -1,10 +1,8 @@
|
|
1
1
|
@charset "UTF-8";
|
2
2
|
verdocs-field-checkbox {
|
3
|
-
|
4
|
-
font-size: 14px;
|
5
|
-
position: relative;
|
6
|
-
background-color: transparent;
|
3
|
+
line-height: 18px;
|
7
4
|
transform-origin: bottom left;
|
5
|
+
font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
|
8
6
|
}
|
9
7
|
verdocs-field-checkbox.disabled {
|
10
8
|
opacity: 0.5;
|
@@ -14,14 +12,17 @@ verdocs-field-checkbox label > input[type=checkbox] {
|
|
14
12
|
}
|
15
13
|
verdocs-field-checkbox label > input[type=checkbox] + *::before {
|
16
14
|
content: "";
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
width: 10px;
|
22
|
-
height: 10px;
|
15
|
+
width: 1rem;
|
16
|
+
height: 1rem;
|
17
|
+
flex-shrink: 0;
|
18
|
+
line-height: 18px;
|
23
19
|
border-radius: 2px;
|
24
|
-
border:
|
20
|
+
border-style: solid;
|
21
|
+
margin-right: 0.5rem;
|
22
|
+
border-width: 0.1rem;
|
23
|
+
display: inline-block;
|
24
|
+
vertical-align: bottom;
|
25
|
+
border-color: #aeb4bf;
|
25
26
|
}
|
26
27
|
verdocs-field-checkbox label > input[type=checkbox]:checked + * {
|
27
28
|
color: #55bc81;
|
@@ -39,7 +39,7 @@ export class VerdocsFieldCheckbox {
|
|
39
39
|
if (this.done) {
|
40
40
|
return h(Host, { class: { done: this.done } }, option.checked ? '✓' : '☐');
|
41
41
|
}
|
42
|
-
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
42
|
+
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { name: this.field.name, type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
43
43
|
var _a;
|
44
44
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
45
45
|
return this.hideSettingsPanel();
|
@@ -62,7 +62,7 @@ export class VerdocsFieldDate {
|
|
62
62
|
const formatted = (settings === null || settings === void 0 ? void 0 : settings.result) ? format(new Date(settings === null || settings === void 0 ? void 0 : settings.result), 'PP') : '';
|
63
63
|
return h(Host, { class: { done: this.done } }, formatted);
|
64
64
|
}
|
65
|
-
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
65
|
+
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { name: this.field.name, type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
66
66
|
var _a;
|
67
67
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
68
68
|
return this.hideSettingsPanel();
|
@@ -43,7 +43,7 @@ export class VerdocsFieldRadioButton {
|
|
43
43
|
if (this.done) {
|
44
44
|
return (h(Host, { class: { done: this.done }, style: { maxWidth: '10px' } }, h("span", { innerHTML: !!option.selected ? RadioIconSelected : RadioIconUnselected })));
|
45
45
|
}
|
46
|
-
return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", value: option.id, tabIndex: settings.order,
|
46
|
+
return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", name: this.field.name, value: option.id, tabIndex: settings.order, checked: !!option.selected, disabled: disabled, required: settings.required }), h("label", { htmlFor: id }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
47
47
|
var _a;
|
48
48
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
49
49
|
return this.hideSettingsPanel();
|
@@ -40,7 +40,7 @@ export class VerdocsFieldTextarea {
|
|
40
40
|
if (this.done) {
|
41
41
|
return h(Host, { class: { done: this.done } }, settings.value);
|
42
42
|
}
|
43
|
-
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
43
|
+
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, name: this.field.name, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
44
44
|
var _a;
|
45
45
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
46
46
|
return this.hideSettingsPanel();
|
@@ -70,7 +70,7 @@ export class VerdocsFieldTextbox {
|
|
70
70
|
if (this.done) {
|
71
71
|
return h(Host, { class: { done: this.done } }, value);
|
72
72
|
}
|
73
|
-
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
73
|
+
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
74
74
|
var _a;
|
75
75
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
76
76
|
return this.hideSettingsPanel();
|
@@ -107,21 +107,11 @@ export class VerdocsTemplateFieldProperties {
|
|
107
107
|
}
|
108
108
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
109
109
|
.then(() => {
|
110
|
-
var _a, _b
|
110
|
+
var _a, _b;
|
111
111
|
this.dirty = false;
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
field.role_name = this.roleName;
|
116
|
-
field.required = this.required;
|
117
|
-
field.label = this.placeholder;
|
118
|
-
field.setting.result = this.defaultValue;
|
119
|
-
if (field.setting.options) {
|
120
|
-
field.setting.options = this.options;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
(_c = this.settingsChanged) === null || _c === void 0 ? void 0 : _c.emit({ fieldName: this.fieldName });
|
124
|
-
(_d = this.close) === null || _d === void 0 ? void 0 : _d.emit();
|
112
|
+
this.updateField();
|
113
|
+
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
114
|
+
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
125
115
|
})
|
126
116
|
.catch(() => {
|
127
117
|
console.log('Field update failed', e);
|
@@ -150,28 +140,36 @@ export class VerdocsTemplateFieldProperties {
|
|
150
140
|
x: this.options.length > 0 ? this.options[this.options.length - 1].x : 20,
|
151
141
|
y: this.options.length > 0 ? this.options[this.options.length - 1].y - 25 : 20,
|
152
142
|
});
|
153
|
-
newProperties.setting = this.setting;
|
154
|
-
newProperties.setting.
|
143
|
+
newProperties.setting = { ...this.setting };
|
144
|
+
delete newProperties.setting.result;
|
145
|
+
newProperties.setting.options = [...this.options];
|
155
146
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
156
147
|
.then(() => {
|
157
|
-
var _a, _b
|
148
|
+
var _a, _b;
|
158
149
|
this.dirty = false;
|
159
|
-
|
160
|
-
|
150
|
+
this.updateField();
|
151
|
+
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
152
|
+
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
153
|
+
})
|
154
|
+
.catch(() => {
|
155
|
+
console.log('Field update failed', e);
|
156
|
+
});
|
157
|
+
}
|
158
|
+
updateField() {
|
159
|
+
const newFields = [...this.store.state.fields];
|
160
|
+
newFields.forEach(field => {
|
161
|
+
if (field.name === this.fieldName) {
|
161
162
|
field.name = this.name;
|
162
163
|
field.role_name = this.roleName;
|
163
164
|
field.required = this.required;
|
164
165
|
field.label = this.placeholder;
|
165
|
-
field.setting.result = this.defaultValue;
|
166
|
+
// field.setting.result = this.defaultValue;
|
167
|
+
if (field.setting.options) {
|
168
|
+
field.setting.options = this.options;
|
169
|
+
}
|
166
170
|
}
|
167
|
-
(_c = this.settingsChanged) === null || _c === void 0 ? void 0 : _c.emit({ fieldName: this.fieldName });
|
168
|
-
(_d = this.close) === null || _d === void 0 ? void 0 : _d.emit();
|
169
|
-
// TODO: Verify this
|
170
|
-
// TemplateStore.updateCount++;
|
171
|
-
})
|
172
|
-
.catch(() => {
|
173
|
-
console.log('Field update failed', e);
|
174
171
|
});
|
172
|
+
this.store.state.fields = newFields;
|
175
173
|
}
|
176
174
|
async handleDelete(e) {
|
177
175
|
e.stopPropagation();
|
package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.css
CHANGED
@@ -42,16 +42,26 @@ verdocs-template-fields #verdocs-template-fields-toolbar {
|
|
42
42
|
height: 50px;
|
43
43
|
display: flex;
|
44
44
|
flex: 0 0 50px;
|
45
|
+
column-gap: 15px;
|
46
|
+
padding: 0 20px 0 0;
|
45
47
|
align-items: center;
|
46
48
|
flex-direction: row;
|
49
|
+
color: #f5f5fa;
|
47
50
|
justify-content: center;
|
48
|
-
column-gap: 15px;
|
49
51
|
background: #46497d;
|
50
52
|
}
|
51
53
|
verdocs-template-fields #verdocs-template-fields-toolbar svg {
|
52
54
|
width: 24px;
|
53
55
|
height: 24px;
|
54
56
|
}
|
57
|
+
verdocs-template-fields #verdocs-template-fields-toolbar .add-for {
|
58
|
+
margin: 0;
|
59
|
+
font-weight: 500;
|
60
|
+
color: #f5f5fa;
|
61
|
+
}
|
62
|
+
verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input {
|
63
|
+
margin: 0 20px 0 0;
|
64
|
+
}
|
55
65
|
verdocs-template-fields.placing-attachment {
|
56
66
|
cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E") 16 16, pointer;
|
57
67
|
}
|
package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js
CHANGED
@@ -349,7 +349,7 @@ export class VerdocsTemplateFields {
|
|
349
349
|
}
|
350
350
|
}
|
351
351
|
render() {
|
352
|
-
var _a, _b;
|
352
|
+
var _a, _b, _c, _d;
|
353
353
|
if (!this.endpoint.session) {
|
354
354
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
355
355
|
}
|
@@ -359,9 +359,10 @@ export class VerdocsTemplateFields {
|
|
359
359
|
}
|
360
360
|
const pages = [...(_b = this.store) === null || _b === void 0 ? void 0 : _b.state.pages];
|
361
361
|
pages.sort((a, b) => a.sequence - b.sequence);
|
362
|
+
const selectableRoles = (_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.roles.map(role => ({ value: role.name, label: role.name }));
|
362
363
|
return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, "data-r": this.rerender, onSubmit: () => {
|
363
364
|
console.log('onSubmit');
|
364
|
-
} }, h("div", { id: "verdocs-template-fields-toolbar" }, menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
|
365
|
+
} }, h("div", { id: "verdocs-template-fields-toolbar" }, h("div", { class: "add-for" }, "Add field:"), h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, onClick: () => {
|
365
366
|
if (option.tooltip) {
|
366
367
|
// We have empty tooltips on the separators, quick hack...
|
367
368
|
this.placing = option.id;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
2
2
|
|
3
|
-
const verdocsCheckboxCss = "@charset \"UTF-8\";verdocs-checkbox{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif
|
3
|
+
const verdocsCheckboxCss = "@charset \"UTF-8\";verdocs-checkbox{line-height:18px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-checkbox label>input[type=checkbox]{display:none}verdocs-checkbox label>input[type=checkbox]+*::before{content:\"\";width:1rem;height:1rem;-ms-flex-negative:0;flex-shrink:0;line-height:18px;border-radius:2px;border-style:solid;margin-right:0.5rem;border-width:0.1rem;display:inline-block;vertical-align:bottom;border-color:#aeb4bf}verdocs-checkbox label>input[type=checkbox]:checked+*{color:#55bc81}verdocs-checkbox label>input[type=checkbox]:checked+*::before{content:\"✓\";color:white;text-align:center;background:#55bc81;border-color:#55bc81}verdocs-checkbox.dark label>input[type=checkbox]+*::before{border-color:#ffffff}verdocs-checkbox.dark label>input[type=checkbox]:checked+*::before{background:#55bc81;border-color:#55bc81}";
|
4
4
|
|
5
5
|
const VerdocsCheckbox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
6
6
|
constructor() {
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$4 } from './verdocs-select-input2.js';
|
|
10
10
|
import { d as defineCustomElement$3 } from './verdocs-template-field-properties2.js';
|
11
11
|
import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
|
12
12
|
|
13
|
-
const verdocsFieldCheckboxCss = "@charset \"UTF-8\";verdocs-field-checkbox{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif
|
13
|
+
const verdocsFieldCheckboxCss = "@charset \"UTF-8\";verdocs-field-checkbox{line-height:18px;-webkit-transform-origin:bottom left;transform-origin:bottom left;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-field-checkbox.disabled{opacity:0.5}verdocs-field-checkbox label>input[type=checkbox]{display:none}verdocs-field-checkbox label>input[type=checkbox]+*::before{content:\"\";width:1rem;height:1rem;-ms-flex-negative:0;flex-shrink:0;line-height:18px;border-radius:2px;border-style:solid;margin-right:0.5rem;border-width:0.1rem;display:inline-block;vertical-align:bottom;border-color:#aeb4bf}verdocs-field-checkbox label>input[type=checkbox]:checked+*{color:#55bc81}verdocs-field-checkbox label>input[type=checkbox]:checked+*::before{content:\"✓\";color:white;text-align:center;background:#55bc81;border-color:#55bc81}verdocs-field-checkbox.required{border:1px solid #cc0000}verdocs-field-checkbox.hide{display:none}verdocs-field-checkbox.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-checkbox verdocs-button-panel{margin-left:-20px;margin-top:-4px;-webkit-transform:scale(0.7);transform:scale(0.7)}";
|
14
14
|
|
15
15
|
const settingsIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20"><path d="m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z"/></svg>';
|
16
16
|
const VerdocsFieldCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
@@ -51,7 +51,7 @@ const VerdocsFieldCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
51
51
|
if (this.done) {
|
52
52
|
return h(Host, { class: { done: this.done } }, option.checked ? '✓' : '☐');
|
53
53
|
}
|
54
|
-
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
54
|
+
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("label", null, h("input", { name: this.field.name, type: "checkbox", tabIndex: settings.order, checked: option.checked, disabled: disabled, required: settings.required, value: option.id }), h("span", null), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
55
55
|
var _a;
|
56
56
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
57
57
|
return this.hideSettingsPanel();
|
@@ -2623,7 +2623,7 @@ const VerdocsFieldDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
2623
2623
|
const formatted = (settings === null || settings === void 0 ? void 0 : settings.result) ? format(new Date(settings === null || settings === void 0 ? void 0 : settings.result), 'PP') : '';
|
2624
2624
|
return h(Host, { class: { done: this.done } }, formatted);
|
2625
2625
|
}
|
2626
|
-
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
2626
|
+
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled }, style: { backgroundColor } }, h("input", { name: this.field.name, type: "text", value: "", id: this.containerId, disabled: disabled, placeholder: settings.placeholder, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
2627
2627
|
var _a;
|
2628
2628
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
2629
2629
|
return this.hideSettingsPanel();
|
@@ -55,7 +55,7 @@ const VerdocsFieldRadioButton$1 = /*@__PURE__*/ proxyCustomElement(class extends
|
|
55
55
|
if (this.done) {
|
56
56
|
return (h(Host, { class: { done: this.done }, style: { maxWidth: '10px' } }, h("span", { innerHTML: !!option.selected ? RadioIconSelected : RadioIconUnselected })));
|
57
57
|
}
|
58
|
-
return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", value: option.id, tabIndex: settings.order,
|
58
|
+
return (h(Host, { class: { required, disabled }, style: { backgroundColor } }, h("input", { id: id, type: "radio", name: this.field.name, value: option.id, tabIndex: settings.order, checked: !!option.selected, disabled: disabled, required: settings.required }), h("label", { htmlFor: id }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
59
59
|
var _a;
|
60
60
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
61
61
|
return this.hideSettingsPanel();
|
@@ -52,7 +52,7 @@ const VerdocsFieldTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
52
52
|
if (this.done) {
|
53
53
|
return h(Host, { class: { done: this.done } }, settings.value);
|
54
54
|
}
|
55
|
-
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
55
|
+
return (h(Host, { class: { required: settings.required, disabled }, style: { backgroundColor } }, h("textarea", { placeholder: settings.placeholder || '', tabIndex: settings.order, value: settings.value, disabled: disabled, name: this.field.name, required: settings.required, ref: el => (this.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
56
56
|
var _a;
|
57
57
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
58
58
|
return this.hideSettingsPanel();
|
@@ -82,7 +82,7 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
82
82
|
if (this.done) {
|
83
83
|
return h(Host, { class: { done: this.done } }, value);
|
84
84
|
}
|
85
|
-
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
85
|
+
return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
86
86
|
var _a;
|
87
87
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
88
88
|
return this.hideSettingsPanel();
|
@@ -217,17 +217,20 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
217
217
|
}
|
218
218
|
}
|
219
219
|
handleClickAgree() {
|
220
|
+
this.submitting = true;
|
220
221
|
envelopeRecipientAgree(this.endpoint, this.envelopeId, this.roleId, true)
|
221
222
|
.then(() => {
|
222
223
|
var _a;
|
223
224
|
this.nextButtonLabel = 'Next';
|
224
225
|
this.recipient.agreed = true;
|
226
|
+
this.submitting = false;
|
225
227
|
this.agreed = true; // The server returns a recipient object but it's not "deep" so we track this locally
|
226
228
|
(_a = this.envelopeUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, envelope: this.envelope, event: 'agreed' });
|
227
229
|
})
|
228
230
|
.catch(e => {
|
229
231
|
var _a, _b, _c;
|
230
232
|
console.log('Update failure', e);
|
233
|
+
this.submitting = false;
|
231
234
|
(_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));
|
232
235
|
});
|
233
236
|
}
|
@@ -266,6 +269,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
266
269
|
}
|
267
270
|
}
|
268
271
|
updateRecipientFieldValue(fieldName, updateResult) {
|
272
|
+
console.log('[SIGN] updateRecipientFieldValue', fieldName);
|
269
273
|
this.recipient.fields.forEach(oldField => {
|
270
274
|
if (oldField.name === fieldName) {
|
271
275
|
oldField.settings = updateResult.settings;
|
@@ -276,10 +280,9 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
276
280
|
});
|
277
281
|
}
|
278
282
|
saveFieldChange(fieldName, fields) {
|
283
|
+
console.log('[SIGN] updateRecipientFieldValue', fieldName);
|
279
284
|
updateEnvelopeField(this.endpoint, this.envelopeId, fieldName, fields) //
|
280
|
-
.then(updateResult =>
|
281
|
-
this.updateRecipientFieldValue(fieldName, updateResult);
|
282
|
-
})
|
285
|
+
.then(updateResult => this.updateRecipientFieldValue(fieldName, updateResult))
|
283
286
|
.catch(e => {
|
284
287
|
var _a, _b, _c, _d, _e, _f;
|
285
288
|
if (((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 401 && ((_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === 'jwt expired') {
|
@@ -433,7 +436,18 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
433
436
|
}
|
434
437
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
435
438
|
var _a;
|
436
|
-
el.addEventListener('input', () =>
|
439
|
+
el.addEventListener('input', (e) => {
|
440
|
+
console.log('[SIGN] onfieldInput', e.detail, e.target.value);
|
441
|
+
// These field types don't emit fieldChange. Should we standardize on that? We don't tap "input" for fields like
|
442
|
+
// text boxes because we'd be updating the field on every keystroke. We do those on blur which fires fieldChange.
|
443
|
+
if (e.target.name.includes('checkbox_group') || e.target.name.includes('radio_button_group')) {
|
444
|
+
console.log('CB', e.target);
|
445
|
+
this.handleFieldChange(field, e).finally(() => this.checkRecipientFields());
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
this.checkRecipientFields();
|
449
|
+
}
|
450
|
+
});
|
437
451
|
el.addEventListener('focusout', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
438
452
|
el.addEventListener('fieldChange', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
439
453
|
el.setAttribute('roleindex', roleIndex);
|
@@ -538,7 +552,7 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
538
552
|
return (h(Host, null, h("verdocs-loader", null)));
|
539
553
|
}
|
540
554
|
if (this.isDone) {
|
541
|
-
return (h(Host, { class: { agreed: this.agreed } },
|
555
|
+
return (h(Host, { class: { agreed: this.agreed } }, h("verdocs-view", { endpoint: this.endpoint, envelopeId: this.envelopeId, onSdkError: e => { var _a; return (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }), this.errorMessage && h("verdocs-ok-dialog", { heading: "Network Error", message: this.errorMessage, onNext: () => (this.errorMessage = '') }), this.showDone && (h("verdocs-ok-dialog", { heading: "You're Done!", message: `You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`, onNext: () => {
|
542
556
|
this.showDone = false;
|
543
557
|
this.isDone = true;
|
544
558
|
} })), this.submitting && (h("div", { class: "loading-indicator" }, h("verdocs-loader", null)))));
|
@@ -308,21 +308,11 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
308
308
|
}
|
309
309
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
310
310
|
.then(() => {
|
311
|
-
var _a, _b
|
311
|
+
var _a, _b;
|
312
312
|
this.dirty = false;
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
field.role_name = this.roleName;
|
317
|
-
field.required = this.required;
|
318
|
-
field.label = this.placeholder;
|
319
|
-
field.setting.result = this.defaultValue;
|
320
|
-
if (field.setting.options) {
|
321
|
-
field.setting.options = this.options;
|
322
|
-
}
|
323
|
-
}
|
324
|
-
(_c = this.settingsChanged) === null || _c === void 0 ? void 0 : _c.emit({ fieldName: this.fieldName });
|
325
|
-
(_d = this.close) === null || _d === void 0 ? void 0 : _d.emit();
|
313
|
+
this.updateField();
|
314
|
+
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
315
|
+
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
326
316
|
})
|
327
317
|
.catch(() => {
|
328
318
|
console.log('Field update failed', e);
|
@@ -351,28 +341,36 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
351
341
|
x: this.options.length > 0 ? this.options[this.options.length - 1].x : 20,
|
352
342
|
y: this.options.length > 0 ? this.options[this.options.length - 1].y - 25 : 20,
|
353
343
|
});
|
354
|
-
newProperties.setting = this.setting;
|
355
|
-
newProperties.setting.
|
344
|
+
newProperties.setting = { ...this.setting };
|
345
|
+
delete newProperties.setting.result;
|
346
|
+
newProperties.setting.options = [...this.options];
|
356
347
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
357
348
|
.then(() => {
|
358
|
-
var _a, _b
|
349
|
+
var _a, _b;
|
359
350
|
this.dirty = false;
|
360
|
-
|
361
|
-
|
351
|
+
this.updateField();
|
352
|
+
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
353
|
+
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
354
|
+
})
|
355
|
+
.catch(() => {
|
356
|
+
console.log('Field update failed', e);
|
357
|
+
});
|
358
|
+
}
|
359
|
+
updateField() {
|
360
|
+
const newFields = [...this.store.state.fields];
|
361
|
+
newFields.forEach(field => {
|
362
|
+
if (field.name === this.fieldName) {
|
362
363
|
field.name = this.name;
|
363
364
|
field.role_name = this.roleName;
|
364
365
|
field.required = this.required;
|
365
366
|
field.label = this.placeholder;
|
366
|
-
field.setting.result = this.defaultValue;
|
367
|
+
// field.setting.result = this.defaultValue;
|
368
|
+
if (field.setting.options) {
|
369
|
+
field.setting.options = this.options;
|
370
|
+
}
|
367
371
|
}
|
368
|
-
(_c = this.settingsChanged) === null || _c === void 0 ? void 0 : _c.emit({ fieldName: this.fieldName });
|
369
|
-
(_d = this.close) === null || _d === void 0 ? void 0 : _d.emit();
|
370
|
-
// TODO: Verify this
|
371
|
-
// TemplateStore.updateCount++;
|
372
|
-
})
|
373
|
-
.catch(() => {
|
374
|
-
console.log('Field update failed', e);
|
375
372
|
});
|
373
|
+
this.store.state.fields = newFields;
|
376
374
|
}
|
377
375
|
async handleDelete(e) {
|
378
376
|
e.stopPropagation();
|