@verdocs/web-sdk 1.12.13 → 1.12.15
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 +41 -33
- package/dist/cjs/verdocs-field-date.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +34 -3
- package/dist/cjs/verdocs-template-create_2.cjs.entry.js +5 -2
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/controls/verdocs-button-panel/verdocs-button-panel.js +22 -26
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +2 -2
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.css +37 -0
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +33 -2
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.stories.js +22 -3
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.css +10 -0
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +21 -7
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +5 -2
- package/dist/components/verdocs-button-panel2.js +22 -26
- package/dist/components/verdocs-field-date.js +2 -2
- package/dist/components/verdocs-field-textbox.js +34 -3
- package/dist/components/verdocs-template-field-properties2.js +22 -8
- package/dist/components/verdocs-template-fields2.js +5 -2
- package/dist/docs.json +1 -16
- package/dist/esm/{interact.min-dc773ac7.js → interact.min-9ecbb023.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-14a84a09.js → utils-be76f4d8.js} +1 -1
- package/dist/esm/verdocs-button-panel_3.entry.js +41 -33
- package/dist/esm/verdocs-dropdown_2.entry.js +1 -1
- package/dist/esm/verdocs-field-checkbox.entry.js +1 -1
- package/dist/esm/verdocs-field-date.entry.js +3 -3
- package/dist/esm/verdocs-field-dropdown.entry.js +1 -1
- package/dist/esm/verdocs-field-initial.entry.js +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-field-signature.entry.js +1 -1
- package/dist/esm/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +36 -5
- package/dist/esm/verdocs-field-timestamp.entry.js +1 -1
- package/dist/esm/verdocs-preview.entry.js +1 -1
- package/dist/esm/verdocs-send.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm/verdocs-template-create_2.entry.js +7 -4
- package/dist/esm/verdocs-template-document-page.entry.js +1 -1
- package/dist/esm/verdocs-template-roles.entry.js +2 -2
- package/dist/esm/verdocs-view.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/{interact.min-dc773ac7.js → interact.min-9ecbb023.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{utils-14a84a09.js → utils-be76f4d8.js} +1 -1
- package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-dropdown_2.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-dropdown.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-signature.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-field-timestamp.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.entry.js +1 -1
- package/dist/esm-es5/verdocs-send.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-create_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-roles.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/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +5 -1
- package/dist/types/components/fields/verdocs-field-textbox/verdocs-field-textbox.stories.d.ts +5 -1
- package/dist/types/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.d.ts +2 -0
- package/dist/verdocs-web-sdk/{p-f2c98257.entry.js → p-05e4a811.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8293540f.entry.js → p-0662b924.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-dda83545.entry.js → p-112daa16.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9a935949.system.js → p-177c637d.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c9f8ff41.entry.js → p-1be57028.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-3fdd61f2.system.entry.js → p-24266a89.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-ec345452.system.entry.js → p-31813507.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-d36c8de2.system.entry.js → p-34996fc6.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-096d1436.entry.js → p-37ba7969.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-de5fec97.entry.js → p-399744e1.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7c1803cd.system.entry.js → p-3b5acfe7.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-62ceaf3a.system.entry.js → p-3c00e2fa.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-26d49a69.system.entry.js → p-416d1f60.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-275eb2b1.system.entry.js → p-475b76cf.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0daa6100.system.entry.js → p-4cc767d8.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-50c2b2df.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-554a992e.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-1bf5383a.system.entry.js → p-5662175d.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f239387c.entry.js → p-569844d0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f106b96c.entry.js → p-65b43861.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-855dbfcd.system.entry.js → p-68602cb0.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-6ba8adc5.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-dd70fdcb.system.entry.js → p-6f705797.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-7e6d7c07.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-997fc4dd.entry.js → p-854cf75f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8990cde6.system.entry.js → p-8a784d93.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-9e2c24ef.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-4f8d48c4.entry.js → p-a24fc6db.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5fec33d8.system.entry.js → p-a339ae33.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-329ba73d.entry.js → p-a5e2612b.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-ae44e57b.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-92fedce7.entry.js → p-b92991d0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f19969ec.entry.js → p-ba34157a.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f127e95a.system.js → p-be2bfca8.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-4bde376b.system.entry.js → p-c0146adc.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cebebb9e.entry.js → p-c28e49a7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-2c2de2e7.system.entry.js → p-c38d2d4a.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-4a36fe61.js → p-d2baa74e.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e87ad9cc.entry.js → p-db960f7f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-ebe3da9f.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-46986642.system.entry.js → p-f529edb0.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9e7679fa.js → p-fa5a2e43.js} +1 -1
- package/dist/verdocs-web-sdk/{p-15fdbcbc.system.entry.js → p-fd718d03.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-2f1dd220.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-452fa351.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-4e874241.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-62db0bfe.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e76245f0.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-ea4ea279.entry.js +0 -1
@@ -1,3 +1,4 @@
|
|
1
|
+
import interact from 'interactjs';
|
1
2
|
import { getRGBA } from '@verdocs/js-sdk/Utils/Colors';
|
2
3
|
import { h, Host } from '@stencil/core';
|
3
4
|
import TemplateStore from '../../../utils/templateStore';
|
@@ -17,7 +18,7 @@ export class VerdocsFieldTextbox {
|
|
17
18
|
this.rerender = 0;
|
18
19
|
}
|
19
20
|
async focusField() {
|
20
|
-
this.
|
21
|
+
this.inputEl.focus();
|
21
22
|
}
|
22
23
|
async showSettingsPanel() {
|
23
24
|
const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.field.name}`);
|
@@ -33,16 +34,45 @@ export class VerdocsFieldTextbox {
|
|
33
34
|
}
|
34
35
|
TemplateStore.updateCount++;
|
35
36
|
}
|
37
|
+
componentDidRender() {
|
38
|
+
interact.dynamicDrop(true);
|
39
|
+
if (this.editable) {
|
40
|
+
interact(this.resizeHandle).resizable({
|
41
|
+
listeners: {
|
42
|
+
start(event) {
|
43
|
+
console.log('[TEXTBOX] Resize started', event.type, event.target);
|
44
|
+
},
|
45
|
+
move: this.handleResize.bind(this),
|
46
|
+
end(event) {
|
47
|
+
console.log('[TEXTBOX] Resize end', event);
|
48
|
+
},
|
49
|
+
},
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
handleResize(event) {
|
54
|
+
console.log('[TEXTBOX] Resize', event.delta);
|
55
|
+
const oldX = +(event.target.getAttribute('resizeX') || 0);
|
56
|
+
const oldY = +(event.target.getAttribute('resizeY') || 0);
|
57
|
+
const newX = event.dx + oldX;
|
58
|
+
const newY = event.dy + oldY;
|
59
|
+
this.el.style.width = `${parseFloat(this.el.style.width || '0') + event.dx}px`;
|
60
|
+
// Single line text fields are not resizeable in height
|
61
|
+
// this.el.style.height = `${parseFloat(this.el.style.height || '0') + event.dy}px`;
|
62
|
+
event.target.setAttribute('resizeX', newX);
|
63
|
+
event.target.setAttribute('resizeY', newY);
|
64
|
+
}
|
36
65
|
render() {
|
37
66
|
var _a, _b, _c, _d;
|
38
67
|
const settings = getFieldSettings(this.field);
|
39
68
|
let disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
|
40
69
|
const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);
|
41
70
|
const value = (settings === null || settings === void 0 ? void 0 : settings.result) || '';
|
71
|
+
console.log('settings', settings);
|
42
72
|
if (this.done) {
|
43
73
|
return h(Host, { class: { done: this.done } }, value);
|
44
74
|
}
|
45
|
-
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.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
75
|
+
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: TemplateStore.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
46
76
|
var _a;
|
47
77
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
48
78
|
return this.hideSettingsPanel();
|
@@ -285,4 +315,5 @@ export class VerdocsFieldTextbox {
|
|
285
315
|
}
|
286
316
|
};
|
287
317
|
}
|
318
|
+
static get elementRef() { return "el"; }
|
288
319
|
}
|
package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.stories.js
CHANGED
@@ -3,13 +3,23 @@ export default {
|
|
3
3
|
title: 'Fields/Textbox',
|
4
4
|
component: 'verdocs-field-textbox',
|
5
5
|
args: {
|
6
|
+
disabled: false,
|
7
|
+
editable: true,
|
8
|
+
moveable: true,
|
9
|
+
done: false,
|
10
|
+
roleindex: 0,
|
6
11
|
field: {
|
7
|
-
|
12
|
+
name: 'textbox-1',
|
13
|
+
role_name: 'Recipient 1',
|
14
|
+
template_id: '0239fe5f-1b89-499a-bd83-098a2e1b4b9c',
|
15
|
+
type: 'textbox',
|
16
|
+
required: false,
|
17
|
+
setting: {
|
8
18
|
x: 0,
|
9
19
|
y: 0,
|
10
20
|
},
|
21
|
+
page_sequence: 1,
|
11
22
|
},
|
12
|
-
disabled: false,
|
13
23
|
},
|
14
24
|
argTypes: {
|
15
25
|
input: {
|
@@ -18,4 +28,13 @@ export default {
|
|
18
28
|
},
|
19
29
|
},
|
20
30
|
};
|
21
|
-
export const Textbox = ({ field, disabled, input }) => html `<verdocs-field-textbox
|
31
|
+
export const Textbox = ({ field, disabled, editable, moveable, done, roleindex, input }) => html `<verdocs-field-textbox
|
32
|
+
style="transform: scale(1.5); width: 150px; height: 15px;"
|
33
|
+
.field=${field}
|
34
|
+
.disabled=${disabled}
|
35
|
+
.editable=${editable}
|
36
|
+
.moveable=${moveable}
|
37
|
+
.done=${done}
|
38
|
+
.roleindex=${roleindex}
|
39
|
+
@input=${input}
|
40
|
+
/>`;
|
@@ -32,6 +32,7 @@ verdocs-template-field-properties verdocs-select-input {
|
|
32
32
|
}
|
33
33
|
verdocs-template-field-properties verdocs-text-input {
|
34
34
|
margin: 0;
|
35
|
+
flex: 1;
|
35
36
|
}
|
36
37
|
verdocs-template-field-properties verdocs-text-input label {
|
37
38
|
margin: 0;
|
@@ -70,11 +71,20 @@ verdocs-template-field-properties .delete-button svg {
|
|
70
71
|
}
|
71
72
|
verdocs-template-field-properties h6 {
|
72
73
|
flex: 1;
|
74
|
+
display: flex;
|
73
75
|
font-size: 16px;
|
74
76
|
font-weight: bold;
|
75
77
|
margin: 0 0 8px 0;
|
78
|
+
flex-direction: row;
|
76
79
|
color: #092c4c;
|
77
80
|
}
|
81
|
+
verdocs-template-field-properties h6 .help-icon {
|
82
|
+
opacity: 0.5;
|
83
|
+
}
|
84
|
+
verdocs-template-field-properties h6 .help-icon:hover {
|
85
|
+
opacity: 1;
|
86
|
+
cursor: pointer;
|
87
|
+
}
|
78
88
|
verdocs-template-field-properties .row-header {
|
79
89
|
gap: 15px;
|
80
90
|
display: flex;
|
@@ -4,7 +4,9 @@ import { h, Host } from '@stencil/core';
|
|
4
4
|
import TemplateStore from '../../../utils/templateStore';
|
5
5
|
import { loadTemplate } from '../../../utils/Templates';
|
6
6
|
import { SDKError } from '../../../utils/errors';
|
7
|
+
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
7
8
|
const TrashIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>`;
|
9
|
+
const HelpIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';
|
8
10
|
// const PlusIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`;
|
9
11
|
/**
|
10
12
|
* Displays an edit form that allows the user to adjust a field's settings.
|
@@ -20,10 +22,12 @@ export class VerdocsTemplateFieldProperties {
|
|
20
22
|
this.setting = null;
|
21
23
|
this.name = '';
|
22
24
|
this.roleName = '';
|
25
|
+
this.fieldType = '';
|
23
26
|
this.required = false;
|
24
27
|
this.options = [];
|
25
28
|
this.placeholder = '';
|
26
29
|
this.defaultValue = '';
|
30
|
+
this.showingHelp = true;
|
27
31
|
}
|
28
32
|
async componentWillLoad() {
|
29
33
|
var _a, _b, _c, _d, _e;
|
@@ -50,6 +54,7 @@ export class VerdocsTemplateFieldProperties {
|
|
50
54
|
this.name = field.name;
|
51
55
|
this.roleName = field.role_name;
|
52
56
|
this.required = field.required;
|
57
|
+
this.fieldType = field.type;
|
53
58
|
this.placeholder = field.label; // TODO: Talk about how we want to handle labels/placeholders
|
54
59
|
this.defaultValue = ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.value) || '';
|
55
60
|
this.setting = field.setting || {};
|
@@ -97,18 +102,18 @@ export class VerdocsTemplateFieldProperties {
|
|
97
102
|
options: this.options,
|
98
103
|
};
|
99
104
|
}
|
100
|
-
console.log('np', this.required, newProperties);
|
101
105
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
102
106
|
.then(() => {
|
103
107
|
var _a, _b;
|
104
108
|
this.dirty = false;
|
105
|
-
TemplateStore.fields.
|
109
|
+
const field = TemplateStore.fields.find(field => field.name === this.fieldName);
|
110
|
+
if (field) {
|
106
111
|
field.name = this.name;
|
107
112
|
field.role_name = this.roleName;
|
108
113
|
field.required = this.required;
|
109
114
|
field.label = this.placeholder;
|
110
115
|
field.setting.result = this.defaultValue;
|
111
|
-
}
|
116
|
+
}
|
112
117
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
113
118
|
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
114
119
|
})
|
@@ -142,13 +147,20 @@ export class VerdocsTemplateFieldProperties {
|
|
142
147
|
if (!this.endpoint.session || !TemplateStore.template) {
|
143
148
|
return h(Host, { class: "empty" });
|
144
149
|
}
|
145
|
-
|
150
|
+
if (this.showingHelp) {
|
151
|
+
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" }, "Text boxes may be used to capture simple text input. Participant-entered values will be stored for later retrieval via the \"name\" field."), h("p", { class: "instructions" }, "If marked required, the participant must complete the field before proceeding..")));
|
152
|
+
}
|
153
|
+
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 = 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",
|
154
|
+
// 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."
|
155
|
+
placeholder: "Field Name...", onInput: (e) => {
|
146
156
|
this.name = e.target.value;
|
147
157
|
this.dirty = true;
|
148
158
|
} })), h("div", { class: "row" }, h("div", { class: "input-label" }, "Role:"), h("verdocs-select-input", { value: this.roleName, options: TemplateStore.template.roles.map(role => ({ label: role.name, value: role.name })), onInput: (e) => {
|
149
159
|
this.roleName = e.target.value;
|
150
160
|
this.dirty = true;
|
151
|
-
} })
|
161
|
+
} })), ['textbox', 'textarea'].includes(this.type) && (h("verdocs-text-input", { id: "verdocs-field-placeholder", label: "Placeholder", value: this.name, autocomplete: "off",
|
162
|
+
// helpText="Placeholder to display if the field is empty."
|
163
|
+
placeholder: "Placeholder...", onInput: (e) => {
|
152
164
|
this.placeholder = e.target.value;
|
153
165
|
this.dirty = true;
|
154
166
|
} })), h("div", { class: "row", style: { marginTop: '15px', marginBottom: '15px' } }, h("label", { htmlFor: "verdocs-is-required", class: "input-label" }, "Required"), h("verdocs-checkbox", { id: "verdocs-is-required", name: "is-required", checked: this.required, value: "on", onInput: (e) => {
|
@@ -164,7 +176,7 @@ export class VerdocsTemplateFieldProperties {
|
|
164
176
|
backgroundColor: '#333333',
|
165
177
|
padding: '5px 8px',
|
166
178
|
color: '#ffffff',
|
167
|
-
} }, "Options
|
179
|
+
} }, "Options"), h("div", { class: "row-header" }, h("h6", null, "ID"), h("h6", null, "Label"), h("div", { style: { width: '34px' } })), this.options.map((option, index) => (h("div", { class: "row option-row", key: index }, h("verdocs-text-input", { id: `verdocs-option-id-${option.id}`, value: option.id, placeholder: "Unique ID", onInput: (e) => {
|
168
180
|
this.options[index].id = e.target.value;
|
169
181
|
this.dirty = true;
|
170
182
|
} }), h("verdocs-text-input", { id: `verdocs-option-value-${option.id}`, value: option.value, placeholder: "Display value", onInput: (e) => {
|
@@ -258,10 +270,12 @@ export class VerdocsTemplateFieldProperties {
|
|
258
270
|
"setting": {},
|
259
271
|
"name": {},
|
260
272
|
"roleName": {},
|
273
|
+
"fieldType": {},
|
261
274
|
"required": {},
|
262
275
|
"options": {},
|
263
276
|
"placeholder": {},
|
264
|
-
"defaultValue": {}
|
277
|
+
"defaultValue": {},
|
278
|
+
"showingHelp": {}
|
265
279
|
};
|
266
280
|
}
|
267
281
|
static get events() {
|
package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js
CHANGED
@@ -99,7 +99,9 @@ export class VerdocsTemplateFields {
|
|
99
99
|
el.addEventListener('input', e => this.handleFieldChange(field, e));
|
100
100
|
el.addEventListener('settingsChanged', () => {
|
101
101
|
var _a;
|
102
|
-
console.log('
|
102
|
+
console.log('Settings', TemplateStore.fields);
|
103
|
+
this.selectedRoleName = field.role_name;
|
104
|
+
console.log('settings changed', this.selectedRoleName, field);
|
103
105
|
el.setAttribute('roleindex', getRoleIndex(TemplateStore.roleNames, field.role_name));
|
104
106
|
this.rerender++;
|
105
107
|
el.setAttribute('rerender', this.rerender);
|
@@ -230,9 +232,10 @@ export class VerdocsTemplateFields {
|
|
230
232
|
let fieldName;
|
231
233
|
do {
|
232
234
|
fieldName = `${type}P${pageNumber}-${i}`;
|
235
|
+
console.log('testing field', fieldName);
|
233
236
|
i++;
|
234
237
|
} while (TemplateStore.fields.some(field => field.name === fieldName));
|
235
|
-
console.log('
|
238
|
+
console.log('Will use field name', fieldName, TemplateStore.fields);
|
236
239
|
return fieldName;
|
237
240
|
}
|
238
241
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|
@@ -31,39 +31,35 @@ const VerdocsButtonPanel = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
async showPanel() {
|
34
|
-
|
35
|
-
|
36
|
-
}
|
34
|
+
var _a, _b;
|
35
|
+
(_a = this.panelEl) === null || _a === void 0 ? void 0 : _a.setAttribute('data-show', '');
|
36
|
+
(_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update().catch(() => { });
|
37
|
+
this.showing = true;
|
38
|
+
this.hiderEl = document.createElement('div');
|
39
|
+
this.hiderEl.style.zIndex = '100';
|
40
|
+
this.hiderEl.style.position = 'absolute';
|
41
|
+
this.hiderEl.style.top = '0px';
|
42
|
+
this.hiderEl.style.left = '0px';
|
43
|
+
this.hiderEl.style.right = '0px';
|
44
|
+
this.hiderEl.style.bottom = '0px';
|
45
|
+
this.hiderEl.onclick = (e) => {
|
46
|
+
e.stopPropagation();
|
47
|
+
this.toggle();
|
48
|
+
};
|
49
|
+
document.body.appendChild(this.hiderEl);
|
37
50
|
}
|
38
51
|
async hidePanel() {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
52
|
+
var _a, _b;
|
53
|
+
(_a = this.panelEl) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-show');
|
54
|
+
(_b = this.hiderEl) === null || _b === void 0 ? void 0 : _b.remove();
|
55
|
+
this.showing = false;
|
43
56
|
}
|
44
57
|
async toggle() {
|
45
|
-
var _a, _b, _c, _d;
|
46
58
|
if (this.showing) {
|
47
|
-
|
48
|
-
(_b = this.hiderEl) === null || _b === void 0 ? void 0 : _b.remove();
|
49
|
-
this.showing = false;
|
59
|
+
await this.hidePanel();
|
50
60
|
}
|
51
61
|
else {
|
52
|
-
|
53
|
-
(_d = this.popperInstance) === null || _d === void 0 ? void 0 : _d.update().catch(() => { });
|
54
|
-
this.showing = true;
|
55
|
-
this.hiderEl = document.createElement('div');
|
56
|
-
this.hiderEl.style.zIndex = '100';
|
57
|
-
this.hiderEl.style.position = 'absolute';
|
58
|
-
this.hiderEl.style.top = '0px';
|
59
|
-
this.hiderEl.style.left = '0px';
|
60
|
-
this.hiderEl.style.right = '0px';
|
61
|
-
this.hiderEl.style.bottom = '0px';
|
62
|
-
this.hiderEl.onclick = (e) => {
|
63
|
-
e.stopPropagation();
|
64
|
-
this.toggle();
|
65
|
-
};
|
66
|
-
document.body.appendChild(this.hiderEl);
|
62
|
+
await this.showPanel();
|
67
63
|
}
|
68
64
|
}
|
69
65
|
render() {
|
@@ -2615,7 +2615,7 @@ const VerdocsFieldDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
2615
2615
|
}
|
2616
2616
|
// NOTE: We don't use a "date" field here because browsers vary widely in their formatting of it.
|
2617
2617
|
render() {
|
2618
|
-
var _a, _b;
|
2618
|
+
var _a, _b, _c;
|
2619
2619
|
const settings = getFieldSettings(this.field);
|
2620
2620
|
const disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
|
2621
2621
|
const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);
|
@@ -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:
|
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: state.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();
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
+
import { i as interact } from './interact.min.js';
|
2
3
|
import { g as getRGBA } from './Colors.js';
|
3
4
|
import { s as state } from './templateStore.js';
|
4
5
|
import { g as getFieldSettings } from './utils.js';
|
@@ -11,7 +12,7 @@ import { d as defineCustomElement$4 } from './verdocs-select-input2.js';
|
|
11
12
|
import { d as defineCustomElement$3 } from './verdocs-template-field-properties2.js';
|
12
13
|
import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
|
13
14
|
|
14
|
-
const verdocsFieldTextboxCss = "verdocs-field-textbox{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;width:150px;height:15px;display:block;font-size:11px;position:relative;letter-spacing:-0.2px;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-textbox.disabled{opacity:0.5}verdocs-field-textbox input{width:100%;height:100%;font-size:11px;background:none;font-weight:500;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-box-sizing:border-box;box-sizing:border-box;color:rgba(0, 0, 0, 0.87);border:none;outline:none}verdocs-field-textbox input.hide{display:none}verdocs-field-textbox.required{border:1px solid #cc0000}verdocs-field-textbox.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-textbox verdocs-button-panel{top:-3px;left:-2px;opacity:0.5;z-index:1000;cursor:pointer;position:absolute;-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-field-textbox verdocs-button-panel[data-active],verdocs-field-textbox verdocs-button-panel:hover{opacity:1}verdocs-field-textbox verdocs-button-panel .icon svg{fill:#333333}verdocs-field-textbox verdocs-button-panel .icon:hover svg{fill:#000000}verdocs-field-textbox [data-lastpass-icon-root]{display:none !important}";
|
15
|
+
const verdocsFieldTextboxCss = "verdocs-field-textbox{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;width:150px;height:15px;display:block;font-size:11px;position:relative;letter-spacing:-0.2px;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-textbox.disabled{opacity:0.5}verdocs-field-textbox input{width:100%;height:100%;font-size:11px;background:none;font-weight:500;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-box-sizing:border-box;box-sizing:border-box;color:rgba(0, 0, 0, 0.87);border:none;outline:none}verdocs-field-textbox input.hide{display:none}verdocs-field-textbox.required{border:1px solid #cc0000}verdocs-field-textbox.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-textbox .resizer{position:absolute;bottom:1px;right:1px;width:8px;height:8px;z-index:9999}verdocs-field-textbox .resizer:hover{cursor:nwse-resize}verdocs-field-textbox .resizer .resizer-inner{position:absolute;bottom:0}verdocs-field-textbox .resizer .resizer-inner:before{position:absolute;top:-4px;left:-0.5px;content:\"\";display:block;width:10px;height:1px;background-color:rgba(0, 0, 0, 0.32);-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}verdocs-field-textbox .resizer .resizer-inner:after{position:absolute;top:-1.5px;left:4.5px;content:\"\";display:block;width:5px;height:1px;background-color:rgba(0, 0, 0, 0.32);-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}verdocs-field-textbox verdocs-button-panel{top:-3px;left:-2px;opacity:0.5;z-index:1000;cursor:pointer;position:absolute;-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-field-textbox verdocs-button-panel[data-active],verdocs-field-textbox verdocs-button-panel:hover{opacity:1}verdocs-field-textbox verdocs-button-panel .icon svg{fill:#333333}verdocs-field-textbox verdocs-button-panel .icon:hover svg{fill:#000000}verdocs-field-textbox [data-lastpass-icon-root]{display:none !important}";
|
15
16
|
|
16
17
|
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>';
|
17
18
|
const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
@@ -29,7 +30,7 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
29
30
|
this.rerender = 0;
|
30
31
|
}
|
31
32
|
async focusField() {
|
32
|
-
this.
|
33
|
+
this.inputEl.focus();
|
33
34
|
}
|
34
35
|
async showSettingsPanel() {
|
35
36
|
const settingsPanel = document.getElementById(`verdocs-settings-panel-${this.field.name}`);
|
@@ -45,16 +46,45 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
45
46
|
}
|
46
47
|
state.updateCount++;
|
47
48
|
}
|
49
|
+
componentDidRender() {
|
50
|
+
interact.dynamicDrop(true);
|
51
|
+
if (this.editable) {
|
52
|
+
interact(this.resizeHandle).resizable({
|
53
|
+
listeners: {
|
54
|
+
start(event) {
|
55
|
+
console.log('[TEXTBOX] Resize started', event.type, event.target);
|
56
|
+
},
|
57
|
+
move: this.handleResize.bind(this),
|
58
|
+
end(event) {
|
59
|
+
console.log('[TEXTBOX] Resize end', event);
|
60
|
+
},
|
61
|
+
},
|
62
|
+
});
|
63
|
+
}
|
64
|
+
}
|
65
|
+
handleResize(event) {
|
66
|
+
console.log('[TEXTBOX] Resize', event.delta);
|
67
|
+
const oldX = +(event.target.getAttribute('resizeX') || 0);
|
68
|
+
const oldY = +(event.target.getAttribute('resizeY') || 0);
|
69
|
+
const newX = event.dx + oldX;
|
70
|
+
const newY = event.dy + oldY;
|
71
|
+
this.el.style.width = `${parseFloat(this.el.style.width || '0') + event.dx}px`;
|
72
|
+
// Single line text fields are not resizeable in height
|
73
|
+
// this.el.style.height = `${parseFloat(this.el.style.height || '0') + event.dy}px`;
|
74
|
+
event.target.setAttribute('resizeX', newX);
|
75
|
+
event.target.setAttribute('resizeY', newY);
|
76
|
+
}
|
48
77
|
render() {
|
49
78
|
var _a, _b, _c, _d;
|
50
79
|
const settings = getFieldSettings(this.field);
|
51
80
|
let disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
|
52
81
|
const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);
|
53
82
|
const value = (settings === null || settings === void 0 ? void 0 : settings.result) || '';
|
83
|
+
console.log('settings', settings);
|
54
84
|
if (this.done) {
|
55
85
|
return h(Host, { class: { done: this.done } }, value);
|
56
86
|
}
|
57
|
-
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.el = el) }), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
87
|
+
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: state.templateId, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
|
58
88
|
var _a;
|
59
89
|
(_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
|
60
90
|
return this.hideSettingsPanel();
|
@@ -64,6 +94,7 @@ const VerdocsFieldTextbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
64
94
|
return this.hideSettingsPanel();
|
65
95
|
} })))));
|
66
96
|
}
|
97
|
+
get el() { return this; }
|
67
98
|
static get style() { return verdocsFieldTextboxCss; }
|
68
99
|
}, [0, "verdocs-field-textbox", {
|
69
100
|
"field": [16],
|
@@ -11,9 +11,11 @@ import { d as defineCustomElement$3 } from './verdocs-help-icon2.js';
|
|
11
11
|
import { d as defineCustomElement$2 } from './verdocs-select-input2.js';
|
12
12
|
import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
|
13
13
|
|
14
|
-
const verdocsTemplateFieldPropertiesCss = "verdocs-template-field-properties{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-field-properties .buttons{display:-ms-flexbox;display:flex;margin-top:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-field-properties .buttons verdocs-button{margin-left:16px}verdocs-template-field-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-field-properties verdocs-text-input{margin:0}verdocs-template-field-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .delete-button:active{background:#f3f3f3}verdocs-template-field-properties .delete-button svg{width:24px;height:24px}verdocs-template-field-properties h6{-ms-flex:1;flex:1;font-size:16px;font-weight:bold;margin:0 0 8px 0;color:#092c4c}verdocs-template-field-properties .row-header{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties .row-header h6{margin-bottom:0}verdocs-template-field-properties .row-header verdocs-help-icon{-webkit-transform:scale(0.85);transform:scale(0.85)}verdocs-template-field-properties .row-header verdocs-help-icon svg{margin-bottom:-5px}verdocs-template-field-properties .row-header .add-button{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-field-properties .row-header .add-button:hover{opacity:1}verdocs-template-field-properties .row-header .add-button svg{width:32px;height:32px}verdocs-template-field-properties .option-row{margin:15px 0}verdocs-template-field-properties .option-row .remove-button{height:28px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .option-row .remove-button:active{background:#f3f3f3}verdocs-template-field-properties .option-row .remove-button:hover svg{stroke:#a50021}verdocs-template-field-properties .option-row .remove-button svg{width:20px;height:20px;stroke:#333333}verdocs-template-field-properties .options{background:#f3f3f3;padding:0 0 10px 0}verdocs-template-field-properties .options .row-header,verdocs-template-field-properties .options .option-row{padding:0 10px}verdocs-template-field-properties .options .add-option-button{border-radius:5px;border:1px solid #cccccc;background:#46497d;color:#ffffff;padding:3px 8px}verdocs-template-field-properties .options .option-row .input-element{font-size:14px}verdocs-template-field-properties .options verdocs-help-icon{opacity:1;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-field-properties .options verdocs-help-icon svg{fill:#ffffff}";
|
14
|
+
const verdocsTemplateFieldPropertiesCss = "verdocs-template-field-properties{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-field-properties .buttons{display:-ms-flexbox;display:flex;margin-top:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-field-properties .buttons verdocs-button{margin-left:16px}verdocs-template-field-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-field-properties verdocs-text-input{margin:0;-ms-flex:1;flex:1}verdocs-template-field-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-field-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-field-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .delete-button:active{background:#f3f3f3}verdocs-template-field-properties .delete-button svg{width:24px;height:24px}verdocs-template-field-properties h6{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:16px;font-weight:bold;margin:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;color:#092c4c}verdocs-template-field-properties h6 .help-icon{opacity:0.5}verdocs-template-field-properties h6 .help-icon:hover{opacity:1;cursor:pointer}verdocs-template-field-properties .row-header{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-field-properties .row-header h6{margin-bottom:0}verdocs-template-field-properties .row-header verdocs-help-icon{-webkit-transform:scale(0.85);transform:scale(0.85)}verdocs-template-field-properties .row-header verdocs-help-icon svg{margin-bottom:-5px}verdocs-template-field-properties .row-header .add-button{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-field-properties .row-header .add-button:hover{opacity:1}verdocs-template-field-properties .row-header .add-button svg{width:32px;height:32px}verdocs-template-field-properties .option-row{margin:15px 0}verdocs-template-field-properties .option-row .remove-button{height:28px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-field-properties .option-row .remove-button:active{background:#f3f3f3}verdocs-template-field-properties .option-row .remove-button:hover svg{stroke:#a50021}verdocs-template-field-properties .option-row .remove-button svg{width:20px;height:20px;stroke:#333333}verdocs-template-field-properties .options{background:#f3f3f3;padding:0 0 10px 0}verdocs-template-field-properties .options .row-header,verdocs-template-field-properties .options .option-row{padding:0 10px}verdocs-template-field-properties .options .add-option-button{border-radius:5px;border:1px solid #cccccc;background:#46497d;color:#ffffff;padding:3px 8px}verdocs-template-field-properties .options .option-row .input-element{font-size:14px}verdocs-template-field-properties .options verdocs-help-icon{opacity:1;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-field-properties .options verdocs-help-icon svg{fill:#ffffff}";
|
15
15
|
|
16
|
+
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
16
17
|
const TrashIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>`;
|
18
|
+
const HelpIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';
|
17
19
|
const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
18
20
|
constructor() {
|
19
21
|
super();
|
@@ -31,10 +33,12 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
31
33
|
this.setting = null;
|
32
34
|
this.name = '';
|
33
35
|
this.roleName = '';
|
36
|
+
this.fieldType = '';
|
34
37
|
this.required = false;
|
35
38
|
this.options = [];
|
36
39
|
this.placeholder = '';
|
37
40
|
this.defaultValue = '';
|
41
|
+
this.showingHelp = true;
|
38
42
|
}
|
39
43
|
async componentWillLoad() {
|
40
44
|
var _a, _b, _c, _d, _e;
|
@@ -61,6 +65,7 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
61
65
|
this.name = field.name;
|
62
66
|
this.roleName = field.role_name;
|
63
67
|
this.required = field.required;
|
68
|
+
this.fieldType = field.type;
|
64
69
|
this.placeholder = field.label; // TODO: Talk about how we want to handle labels/placeholders
|
65
70
|
this.defaultValue = ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.value) || '';
|
66
71
|
this.setting = field.setting || {};
|
@@ -108,18 +113,18 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
108
113
|
options: this.options,
|
109
114
|
};
|
110
115
|
}
|
111
|
-
console.log('np', this.required, newProperties);
|
112
116
|
updateField(this.endpoint, this.templateId, this.fieldName, newProperties)
|
113
117
|
.then(() => {
|
114
118
|
var _a, _b;
|
115
119
|
this.dirty = false;
|
116
|
-
state.fields.
|
120
|
+
const field = state.fields.find(field => field.name === this.fieldName);
|
121
|
+
if (field) {
|
117
122
|
field.name = this.name;
|
118
123
|
field.role_name = this.roleName;
|
119
124
|
field.required = this.required;
|
120
125
|
field.label = this.placeholder;
|
121
126
|
field.setting.result = this.defaultValue;
|
122
|
-
}
|
127
|
+
}
|
123
128
|
(_a = this.settingsChanged) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.fieldName });
|
124
129
|
(_b = this.close) === null || _b === void 0 ? void 0 : _b.emit();
|
125
130
|
})
|
@@ -153,13 +158,20 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
153
158
|
if (!this.endpoint.session || !state.template) {
|
154
159
|
return h(Host, { class: "empty" });
|
155
160
|
}
|
156
|
-
|
161
|
+
if (this.showingHelp) {
|
162
|
+
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" }, "Text boxes may be used to capture simple text input. Participant-entered values will be stored for later retrieval via the \"name\" field."), h("p", { class: "instructions" }, "If marked required, the participant must complete the field before proceeding..")));
|
163
|
+
}
|
164
|
+
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 = 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",
|
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."
|
166
|
+
placeholder: "Field Name...", onInput: (e) => {
|
157
167
|
this.name = e.target.value;
|
158
168
|
this.dirty = true;
|
159
169
|
} })), h("div", { class: "row" }, h("div", { class: "input-label" }, "Role:"), h("verdocs-select-input", { value: this.roleName, options: state.template.roles.map(role => ({ label: role.name, value: role.name })), onInput: (e) => {
|
160
170
|
this.roleName = e.target.value;
|
161
171
|
this.dirty = true;
|
162
|
-
} })
|
172
|
+
} })), ['textbox', 'textarea'].includes(this.type) && (h("verdocs-text-input", { id: "verdocs-field-placeholder", label: "Placeholder", value: this.name, autocomplete: "off",
|
173
|
+
// helpText="Placeholder to display if the field is empty."
|
174
|
+
placeholder: "Placeholder...", onInput: (e) => {
|
163
175
|
this.placeholder = e.target.value;
|
164
176
|
this.dirty = true;
|
165
177
|
} })), h("div", { class: "row", style: { marginTop: '15px', marginBottom: '15px' } }, h("label", { htmlFor: "verdocs-is-required", class: "input-label" }, "Required"), h("verdocs-checkbox", { id: "verdocs-is-required", name: "is-required", checked: this.required, value: "on", onInput: (e) => {
|
@@ -175,7 +187,7 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
175
187
|
backgroundColor: '#333333',
|
176
188
|
padding: '5px 8px',
|
177
189
|
color: '#ffffff',
|
178
|
-
} }, "Options
|
190
|
+
} }, "Options"), h("div", { class: "row-header" }, h("h6", null, "ID"), h("h6", null, "Label"), h("div", { style: { width: '34px' } })), this.options.map((option, index) => (h("div", { class: "row option-row", key: index }, h("verdocs-text-input", { id: `verdocs-option-id-${option.id}`, value: option.id, placeholder: "Unique ID", onInput: (e) => {
|
179
191
|
this.options[index].id = e.target.value;
|
180
192
|
this.dirty = true;
|
181
193
|
} }), h("verdocs-text-input", { id: `verdocs-option-value-${option.id}`, value: option.value, placeholder: "Display value", onInput: (e) => {
|
@@ -201,10 +213,12 @@ const VerdocsTemplateFieldProperties = /*@__PURE__*/ proxyCustomElement(class ex
|
|
201
213
|
"setting": [32],
|
202
214
|
"name": [32],
|
203
215
|
"roleName": [32],
|
216
|
+
"fieldType": [32],
|
204
217
|
"required": [32],
|
205
218
|
"options": [32],
|
206
219
|
"placeholder": [32],
|
207
|
-
"defaultValue": [32]
|
220
|
+
"defaultValue": [32],
|
221
|
+
"showingHelp": [32]
|
208
222
|
}]);
|
209
223
|
function defineCustomElement() {
|
210
224
|
if (typeof customElements === "undefined") {
|
@@ -106,7 +106,9 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
106
106
|
el.addEventListener('input', e => this.handleFieldChange(field, e));
|
107
107
|
el.addEventListener('settingsChanged', () => {
|
108
108
|
var _a;
|
109
|
-
console.log('
|
109
|
+
console.log('Settings', state.fields);
|
110
|
+
this.selectedRoleName = field.role_name;
|
111
|
+
console.log('settings changed', this.selectedRoleName, field);
|
110
112
|
el.setAttribute('roleindex', getRoleIndex(state.roleNames, field.role_name));
|
111
113
|
this.rerender++;
|
112
114
|
el.setAttribute('rerender', this.rerender);
|
@@ -237,9 +239,10 @@ const VerdocsTemplateFields = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
237
239
|
let fieldName;
|
238
240
|
do {
|
239
241
|
fieldName = `${type}P${pageNumber}-${i}`;
|
242
|
+
console.log('testing field', fieldName);
|
240
243
|
i++;
|
241
244
|
} while (state.fields.some(field => field.name === fieldName));
|
242
|
-
console.log('
|
245
|
+
console.log('Will use field name', fieldName, state.fields);
|
243
246
|
return fieldName;
|
244
247
|
}
|
245
248
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|