@formio/js 5.0.0-dev.5670.4e330b8 → 5.0.0-dev.5672.279701a
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/formio.form.js +6 -6
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Webform.d.ts +7 -0
- package/lib/cjs/Webform.js +13 -4
- package/lib/cjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/cjs/components/_classes/component/Component.js +23 -13
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +1 -2
- package/lib/cjs/components/checkbox/fixtures/index.js +1 -3
- package/lib/cjs/components/form/Form.d.ts +7 -0
- package/lib/cjs/components/form/Form.js +10 -1
- package/lib/cjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
- package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
- package/lib/cjs/components/signature/Signature.d.ts +0 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/mjs/Webform.d.ts +7 -0
- package/lib/mjs/Webform.js +13 -4
- package/lib/mjs/components/_classes/component/Component.d.ts +13 -0
- package/lib/mjs/components/_classes/component/Component.js +31 -13
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +1 -2
- package/lib/mjs/components/checkbox/fixtures/index.js +1 -2
- package/lib/mjs/components/form/Form.d.ts +7 -0
- package/lib/mjs/components/form/Form.js +10 -1
- package/lib/mjs/components/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
- package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
- package/lib/mjs/components/signature/Signature.d.ts +0 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/package.json +1 -1
- package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +0 -32
- package/lib/cjs/components/checkbox/fixtures/comp6.js +0 -30
- package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +0 -32
- package/lib/mjs/components/checkbox/fixtures/comp6.js +0 -28
package/lib/cjs/Webform.d.ts
CHANGED
|
@@ -330,6 +330,13 @@ declare class Webform extends NestedDataComponent {
|
|
|
330
330
|
* @returns {object} - The submission object.
|
|
331
331
|
*/
|
|
332
332
|
get submission(): object;
|
|
333
|
+
/**
|
|
334
|
+
* Sets the submission value
|
|
335
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
336
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
337
|
+
* @return {void}
|
|
338
|
+
*/
|
|
339
|
+
onSetSubmission(submission: object | null | undefined, flags?: object | null | undefined): void;
|
|
333
340
|
/**
|
|
334
341
|
* Sets a submission and returns the promise when it is ready.
|
|
335
342
|
* @param {any} submission - The submission to set.
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -698,6 +698,18 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
698
698
|
set submission(submission) {
|
|
699
699
|
this.setSubmission(submission);
|
|
700
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Sets the submission value
|
|
703
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
704
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
705
|
+
* @return {void}
|
|
706
|
+
*/
|
|
707
|
+
onSetSubmission(submission, flags = {}) {
|
|
708
|
+
this.submissionSet = true;
|
|
709
|
+
this.triggerChange(flags);
|
|
710
|
+
this.emit('beforeSetSubmission', submission);
|
|
711
|
+
this.setValue(submission, flags);
|
|
712
|
+
}
|
|
701
713
|
/**
|
|
702
714
|
* Sets a submission and returns the promise when it is ready.
|
|
703
715
|
* @param {any} submission - The submission to set.
|
|
@@ -711,10 +723,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
711
723
|
if (resolveFlags) {
|
|
712
724
|
flags = Object.assign(Object.assign({}, flags), resolveFlags);
|
|
713
725
|
}
|
|
714
|
-
this.
|
|
715
|
-
this.triggerChange(flags);
|
|
716
|
-
this.emit("beforeSetSubmission", submission);
|
|
717
|
-
this.setValue(submission, flags);
|
|
726
|
+
this.onSetSubmission(submission, flags);
|
|
718
727
|
return this.submissionReadyResolve(submission);
|
|
719
728
|
}, (err) => this.submissionReadyReject(err))
|
|
720
729
|
.catch((err) => this.submissionReadyReject(err)));
|
|
@@ -343,6 +343,12 @@ declare class Component extends Element {
|
|
|
343
343
|
* @param {string} template - The template to use for the modal dialog.
|
|
344
344
|
*/
|
|
345
345
|
setOpenModalElement(template?: string): void;
|
|
346
|
+
/**
|
|
347
|
+
* Renders a modal preview template and returns the markup as a string
|
|
348
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
349
|
+
* @return {string} - The modal preview markup
|
|
350
|
+
*/
|
|
351
|
+
renderModalPreview(ctx: object | null | undefined): string;
|
|
346
352
|
/**
|
|
347
353
|
* Returns the modal preview template.
|
|
348
354
|
* @returns {string} - The modal preview template.
|
|
@@ -362,6 +368,13 @@ declare class Component extends Element {
|
|
|
362
368
|
* @returns {string} - The rendered HTML string of a component.
|
|
363
369
|
*/
|
|
364
370
|
render(children?: string, topLevel?: boolean): string;
|
|
371
|
+
/**
|
|
372
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
373
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
374
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
375
|
+
* @return {import('tippy.js').Tippy} - tippy.js instance
|
|
376
|
+
*/
|
|
377
|
+
createTooltip(tooltipEl: HTMLElement, settings?: object | null | undefined): import('tippy.js').Tippy;
|
|
365
378
|
/**
|
|
366
379
|
* Attaches all the tooltips provided the refs object.
|
|
367
380
|
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
@@ -1046,6 +1046,14 @@ class Component extends Element_1.default {
|
|
|
1046
1046
|
setOpenModalElement(template = null) {
|
|
1047
1047
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1048
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Renders a modal preview template and returns the markup as a string
|
|
1051
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
1052
|
+
* @return {string} - The modal preview markup
|
|
1053
|
+
*/
|
|
1054
|
+
renderModalPreview(ctx) {
|
|
1055
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1056
|
+
}
|
|
1049
1057
|
/**
|
|
1050
1058
|
* Returns the modal preview template.
|
|
1051
1059
|
* @returns {string} - The modal preview template.
|
|
@@ -1057,7 +1065,7 @@ class Component extends Element_1.default {
|
|
|
1057
1065
|
if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
|
|
1058
1066
|
modalLabel = { className: 'field-required' };
|
|
1059
1067
|
}
|
|
1060
|
-
return this.
|
|
1068
|
+
return this.renderModalPreview({
|
|
1061
1069
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1062
1070
|
messages: '',
|
|
1063
1071
|
labelInfo: modalLabel,
|
|
@@ -1106,6 +1114,19 @@ class Component extends Element_1.default {
|
|
|
1106
1114
|
}, topLevel);
|
|
1107
1115
|
}
|
|
1108
1116
|
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
1119
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
1120
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
1121
|
+
* @return {import('tippy.js').Tippy} - tippy.js instance
|
|
1122
|
+
*/
|
|
1123
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1124
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1125
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1126
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1127
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1128
|
+
return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
|
|
1129
|
+
}
|
|
1109
1130
|
/**
|
|
1110
1131
|
* Attaches all the tooltips provided the refs object.
|
|
1111
1132
|
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
@@ -1114,18 +1135,7 @@ class Component extends Element_1.default {
|
|
|
1114
1135
|
attachTooltips(toolTipsRefs) {
|
|
1115
1136
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1116
1137
|
if (tooltip) {
|
|
1117
|
-
|
|
1118
|
-
const tooltipDataTitle = tooltip.getAttribute('data-title');
|
|
1119
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1120
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1121
|
-
this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
|
|
1122
|
-
allowHTML: true,
|
|
1123
|
-
trigger: 'mouseenter click focus',
|
|
1124
|
-
placement: 'right',
|
|
1125
|
-
zIndex: 10000,
|
|
1126
|
-
interactive: true,
|
|
1127
|
-
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1128
|
-
});
|
|
1138
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1129
1139
|
}
|
|
1130
1140
|
});
|
|
1131
1141
|
}
|
|
@@ -44,7 +44,7 @@ export default class Multivalue extends Field {
|
|
|
44
44
|
attachMultiMask(index: number): boolean;
|
|
45
45
|
/**
|
|
46
46
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
47
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
47
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
48
48
|
*/
|
|
49
49
|
updateMask(input: any, mask: string): void;
|
|
50
50
|
/**
|
|
@@ -237,10 +237,17 @@ class Multivalue extends Field_1.default {
|
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
240
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
240
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
241
241
|
*/
|
|
242
242
|
updateMask(input, mask) {
|
|
243
243
|
if (!mask) {
|
|
244
|
+
if (input.mask) {
|
|
245
|
+
input.mask.destroy();
|
|
246
|
+
}
|
|
247
|
+
if (!this.component.placeholder) {
|
|
248
|
+
input.removeAttribute('placeholder');
|
|
249
|
+
}
|
|
250
|
+
input.value = '';
|
|
244
251
|
return;
|
|
245
252
|
}
|
|
246
253
|
this.setInputMask(input, mask, !this.component.placeholder);
|
|
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
43
43
|
attach(element: any): Promise<void>;
|
|
44
44
|
input: any;
|
|
45
45
|
detach(element: any): void;
|
|
46
|
-
get emptyValue(): false |
|
|
46
|
+
get emptyValue(): false | null;
|
|
47
47
|
getValueAt(index: any): any;
|
|
48
48
|
get checked(): boolean;
|
|
49
49
|
setCheckedState(value: any): any;
|
|
@@ -117,7 +117,7 @@ class CheckBoxComponent extends Field_1.default {
|
|
|
117
117
|
super.detach();
|
|
118
118
|
}
|
|
119
119
|
get emptyValue() {
|
|
120
|
-
return this.component.inputType === 'radio' ?
|
|
120
|
+
return this.component.inputType === 'radio' ? null : false;
|
|
121
121
|
}
|
|
122
122
|
isEmpty(value = this.dataValue) {
|
|
123
123
|
return super.isEmpty(value) || value === false;
|
|
@@ -3,6 +3,5 @@ import comp2 from './comp2';
|
|
|
3
3
|
import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
|
6
|
-
import comp6 from './comp6';
|
|
7
6
|
import customDefaultComponent from './customDefaultComponent';
|
|
8
|
-
export { comp1, comp2, comp3, comp4, comp5,
|
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.customDefaultComponent = exports.
|
|
6
|
+
exports.customDefaultComponent = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const customDefaultComponent_1 = __importDefault(require("./customDefaultComponent"));
|
|
@@ -16,5 +16,3 @@ const comp4_1 = __importDefault(require("./comp4"));
|
|
|
16
16
|
exports.comp4 = comp4_1.default;
|
|
17
17
|
const comp5_1 = __importDefault(require("./comp5"));
|
|
18
18
|
exports.comp5 = comp5_1.default;
|
|
19
|
-
const comp6_1 = __importDefault(require("./comp6"));
|
|
20
|
-
exports.comp6 = comp6_1.default;
|
|
@@ -90,6 +90,13 @@ export default class FormComponent extends Component {
|
|
|
90
90
|
isHidden(): boolean;
|
|
91
91
|
setValue(submission: any, flags?: {}): boolean;
|
|
92
92
|
setSubFormValue(submission: any, flags: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the subform value
|
|
95
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
96
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
97
|
+
* @return {void}
|
|
98
|
+
*/
|
|
99
|
+
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
|
93
100
|
areAllComponentsEmpty(data: any): boolean;
|
|
94
101
|
updateSubFormVisibility(): void;
|
|
95
102
|
/**
|
|
@@ -649,9 +649,18 @@ class FormComponent extends Component_1.default {
|
|
|
649
649
|
});
|
|
650
650
|
}
|
|
651
651
|
else {
|
|
652
|
-
this.
|
|
652
|
+
this.onSetSubFormValue(submission, flags);
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Sets the subform value
|
|
657
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
658
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
659
|
+
* @return {void}
|
|
660
|
+
*/
|
|
661
|
+
onSetSubFormValue(submission, flags) {
|
|
662
|
+
this.subForm.setValue(submission, flags);
|
|
663
|
+
}
|
|
655
664
|
isEmpty(value = this.dataValue) {
|
|
656
665
|
return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
|
|
657
666
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
applyMaskOn: string;
|
|
5
|
+
allowMultipleMasks: boolean;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
key: string;
|
|
8
|
+
type: string;
|
|
9
|
+
inputMasks: {
|
|
10
|
+
label: string;
|
|
11
|
+
mask: string;
|
|
12
|
+
}[];
|
|
13
|
+
input: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
components: [
|
|
5
|
+
{
|
|
6
|
+
"label": "Phone Number",
|
|
7
|
+
"applyMaskOn": "change",
|
|
8
|
+
"allowMultipleMasks": true,
|
|
9
|
+
"tableView": true,
|
|
10
|
+
"key": "phoneNumber",
|
|
11
|
+
"type": "phoneNumber",
|
|
12
|
+
"inputMasks": [
|
|
13
|
+
{
|
|
14
|
+
"label": "Canada",
|
|
15
|
+
"mask": "(999) 999-9999"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"label": "Other",
|
|
19
|
+
"mask": ""
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"input": true
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
};
|
|
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.comp1 = void 0;
|
|
6
|
+
exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
|
+
const comp2_1 = __importDefault(require("./comp2"));
|
|
10
|
+
exports.comp2 = comp2_1.default;
|
|
@@ -22,7 +22,6 @@ export default class SignatureComponent extends Input {
|
|
|
22
22
|
showCanvas(show: any): void;
|
|
23
23
|
onDisabled(): void;
|
|
24
24
|
checkSize(force: any, scale: any): void;
|
|
25
|
-
getModalPreviewTemplate(): any;
|
|
26
25
|
signaturePad: SignaturePad | null | undefined;
|
|
27
26
|
observer: any;
|
|
28
27
|
getValueAsString(value: any): "" | "Yes" | "No";
|
|
@@ -172,7 +172,7 @@ class SignatureComponent extends Input_1.default {
|
|
|
172
172
|
return false;
|
|
173
173
|
}
|
|
174
174
|
getModalPreviewTemplate() {
|
|
175
|
-
return this.
|
|
175
|
+
return this.renderModalPreview({
|
|
176
176
|
previewText: this.dataValue ?
|
|
177
177
|
`<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
|
|
178
178
|
this.t('Click to Sign')
|
package/lib/mjs/Webform.d.ts
CHANGED
|
@@ -330,6 +330,13 @@ declare class Webform extends NestedDataComponent {
|
|
|
330
330
|
* @returns {object} - The submission object.
|
|
331
331
|
*/
|
|
332
332
|
get submission(): object;
|
|
333
|
+
/**
|
|
334
|
+
* Sets the submission value
|
|
335
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
336
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
337
|
+
* @return {void}
|
|
338
|
+
*/
|
|
339
|
+
onSetSubmission(submission: object | null | undefined, flags?: object | null | undefined): void;
|
|
333
340
|
/**
|
|
334
341
|
* Sets a submission and returns the promise when it is ready.
|
|
335
342
|
* @param {any} submission - The submission to set.
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -696,6 +696,18 @@ export default class Webform extends NestedDataComponent {
|
|
|
696
696
|
set submission(submission) {
|
|
697
697
|
this.setSubmission(submission);
|
|
698
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* Sets the submission value
|
|
701
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
702
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
703
|
+
* @return {void}
|
|
704
|
+
*/
|
|
705
|
+
onSetSubmission(submission, flags = {}) {
|
|
706
|
+
this.submissionSet = true;
|
|
707
|
+
this.triggerChange(flags);
|
|
708
|
+
this.emit('beforeSetSubmission', submission);
|
|
709
|
+
this.setValue(submission, flags);
|
|
710
|
+
}
|
|
699
711
|
/**
|
|
700
712
|
* Sets a submission and returns the promise when it is ready.
|
|
701
713
|
* @param {any} submission - The submission to set.
|
|
@@ -715,10 +727,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
715
727
|
...resolveFlags,
|
|
716
728
|
};
|
|
717
729
|
}
|
|
718
|
-
this.
|
|
719
|
-
this.triggerChange(flags);
|
|
720
|
-
this.emit("beforeSetSubmission", submission);
|
|
721
|
-
this.setValue(submission, flags);
|
|
730
|
+
this.onSetSubmission(submission, flags);
|
|
722
731
|
return this.submissionReadyResolve(submission);
|
|
723
732
|
}, (err) => this.submissionReadyReject(err))
|
|
724
733
|
.catch((err) => this.submissionReadyReject(err)));
|
|
@@ -343,6 +343,12 @@ declare class Component extends Element {
|
|
|
343
343
|
* @param {string} template - The template to use for the modal dialog.
|
|
344
344
|
*/
|
|
345
345
|
setOpenModalElement(template?: string): void;
|
|
346
|
+
/**
|
|
347
|
+
* Renders a modal preview template and returns the markup as a string
|
|
348
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
349
|
+
* @return {string} - The modal preview markup
|
|
350
|
+
*/
|
|
351
|
+
renderModalPreview(ctx: object | null | undefined): string;
|
|
346
352
|
/**
|
|
347
353
|
* Returns the modal preview template.
|
|
348
354
|
* @returns {string} - The modal preview template.
|
|
@@ -362,6 +368,13 @@ declare class Component extends Element {
|
|
|
362
368
|
* @returns {string} - The rendered HTML string of a component.
|
|
363
369
|
*/
|
|
364
370
|
render(children?: string, topLevel?: boolean): string;
|
|
371
|
+
/**
|
|
372
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
373
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
374
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
375
|
+
* @return {import('tippy.js').Tippy} - tippy.js instance
|
|
376
|
+
*/
|
|
377
|
+
createTooltip(tooltipEl: HTMLElement, settings?: object | null | undefined): import('tippy.js').Tippy;
|
|
365
378
|
/**
|
|
366
379
|
* Attaches all the tooltips provided the refs object.
|
|
367
380
|
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
@@ -1013,6 +1013,14 @@ export default class Component extends Element {
|
|
|
1013
1013
|
setOpenModalElement(template = null) {
|
|
1014
1014
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1015
1015
|
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Renders a modal preview template and returns the markup as a string
|
|
1018
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
1019
|
+
* @return {string} - The modal preview markup
|
|
1020
|
+
*/
|
|
1021
|
+
renderModalPreview(ctx) {
|
|
1022
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1023
|
+
}
|
|
1016
1024
|
/**
|
|
1017
1025
|
* Returns the modal preview template.
|
|
1018
1026
|
* @returns {string} - The modal preview template.
|
|
@@ -1023,7 +1031,7 @@ export default class Component extends Element {
|
|
|
1023
1031
|
if (this.hasInput && this.component.validate?.required && !this.isPDFReadOnlyMode) {
|
|
1024
1032
|
modalLabel = { className: 'field-required' };
|
|
1025
1033
|
}
|
|
1026
|
-
return this.
|
|
1034
|
+
return this.renderModalPreview({
|
|
1027
1035
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1028
1036
|
messages: '',
|
|
1029
1037
|
labelInfo: modalLabel,
|
|
@@ -1072,6 +1080,27 @@ export default class Component extends Element {
|
|
|
1072
1080
|
}, topLevel);
|
|
1073
1081
|
}
|
|
1074
1082
|
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
1085
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
1086
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
1087
|
+
* @return {import('tippy.js').Tippy} - tippy.js instance
|
|
1088
|
+
*/
|
|
1089
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1090
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1091
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1092
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1093
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1094
|
+
return tippy(tooltipEl, {
|
|
1095
|
+
allowHTML: true,
|
|
1096
|
+
trigger: 'mouseenter click focus',
|
|
1097
|
+
placement: 'right',
|
|
1098
|
+
zIndex: 10000,
|
|
1099
|
+
interactive: true,
|
|
1100
|
+
...settings,
|
|
1101
|
+
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1075
1104
|
/**
|
|
1076
1105
|
* Attaches all the tooltips provided the refs object.
|
|
1077
1106
|
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
@@ -1080,18 +1109,7 @@ export default class Component extends Element {
|
|
|
1080
1109
|
attachTooltips(toolTipsRefs) {
|
|
1081
1110
|
toolTipsRefs?.forEach((tooltip, index) => {
|
|
1082
1111
|
if (tooltip) {
|
|
1083
|
-
|
|
1084
|
-
const tooltipDataTitle = tooltip.getAttribute('data-title');
|
|
1085
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1086
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1087
|
-
this.tooltips[index] = tippy(tooltip, {
|
|
1088
|
-
allowHTML: true,
|
|
1089
|
-
trigger: 'mouseenter click focus',
|
|
1090
|
-
placement: 'right',
|
|
1091
|
-
zIndex: 10000,
|
|
1092
|
-
interactive: true,
|
|
1093
|
-
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1094
|
-
});
|
|
1112
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1095
1113
|
}
|
|
1096
1114
|
});
|
|
1097
1115
|
}
|
|
@@ -44,7 +44,7 @@ export default class Multivalue extends Field {
|
|
|
44
44
|
attachMultiMask(index: number): boolean;
|
|
45
45
|
/**
|
|
46
46
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
47
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
47
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
48
48
|
*/
|
|
49
49
|
updateMask(input: any, mask: string): void;
|
|
50
50
|
/**
|
|
@@ -232,10 +232,17 @@ export default class Multivalue extends Field {
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* @param {any} input - The input element on which the mask is to be applied.
|
|
235
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
|
235
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
|
236
236
|
*/
|
|
237
237
|
updateMask(input, mask) {
|
|
238
238
|
if (!mask) {
|
|
239
|
+
if (input.mask) {
|
|
240
|
+
input.mask.destroy();
|
|
241
|
+
}
|
|
242
|
+
if (!this.component.placeholder) {
|
|
243
|
+
input.removeAttribute('placeholder');
|
|
244
|
+
}
|
|
245
|
+
input.value = '';
|
|
239
246
|
return;
|
|
240
247
|
}
|
|
241
248
|
this.setInputMask(input, mask, !this.component.placeholder);
|
|
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
43
43
|
attach(element: any): Promise<void>;
|
|
44
44
|
input: any;
|
|
45
45
|
detach(element: any): void;
|
|
46
|
-
get emptyValue(): false |
|
|
46
|
+
get emptyValue(): false | null;
|
|
47
47
|
getValueAt(index: any): any;
|
|
48
48
|
get checked(): boolean;
|
|
49
49
|
setCheckedState(value: any): any;
|
|
@@ -116,7 +116,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
116
116
|
super.detach();
|
|
117
117
|
}
|
|
118
118
|
get emptyValue() {
|
|
119
|
-
return this.component.inputType === 'radio' ?
|
|
119
|
+
return this.component.inputType === 'radio' ? null : false;
|
|
120
120
|
}
|
|
121
121
|
isEmpty(value = this.dataValue) {
|
|
122
122
|
return super.isEmpty(value) || value === false;
|
|
@@ -3,6 +3,5 @@ import comp2 from './comp2';
|
|
|
3
3
|
import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
|
6
|
-
import comp6 from './comp6';
|
|
7
6
|
import customDefaultComponent from './customDefaultComponent';
|
|
8
|
-
export { comp1, comp2, comp3, comp4, comp5,
|
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
@@ -4,5 +4,4 @@ import comp2 from './comp2';
|
|
|
4
4
|
import comp3 from './comp3';
|
|
5
5
|
import comp4 from './comp4';
|
|
6
6
|
import comp5 from './comp5';
|
|
7
|
-
|
|
8
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
|
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
@@ -90,6 +90,13 @@ export default class FormComponent extends Component {
|
|
|
90
90
|
isHidden(): boolean;
|
|
91
91
|
setValue(submission: any, flags?: {}): boolean;
|
|
92
92
|
setSubFormValue(submission: any, flags: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the subform value
|
|
95
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
96
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
97
|
+
* @return {void}
|
|
98
|
+
*/
|
|
99
|
+
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
|
93
100
|
areAllComponentsEmpty(data: any): boolean;
|
|
94
101
|
updateSubFormVisibility(): void;
|
|
95
102
|
/**
|
|
@@ -639,9 +639,18 @@ export default class FormComponent extends Component {
|
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
else {
|
|
642
|
-
this.
|
|
642
|
+
this.onSetSubFormValue(submission, flags);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Sets the subform value
|
|
647
|
+
* @param {object|null|undefined} submission - The submission to set.
|
|
648
|
+
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
|
|
649
|
+
* @return {void}
|
|
650
|
+
*/
|
|
651
|
+
onSetSubFormValue(submission, flags) {
|
|
652
|
+
this.subForm.setValue(submission, flags);
|
|
653
|
+
}
|
|
645
654
|
isEmpty(value = this.dataValue) {
|
|
646
655
|
return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
|
|
647
656
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: {
|
|
3
|
+
label: string;
|
|
4
|
+
applyMaskOn: string;
|
|
5
|
+
allowMultipleMasks: boolean;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
key: string;
|
|
8
|
+
type: string;
|
|
9
|
+
inputMasks: {
|
|
10
|
+
label: string;
|
|
11
|
+
mask: string;
|
|
12
|
+
}[];
|
|
13
|
+
input: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
components: [
|
|
3
|
+
{
|
|
4
|
+
"label": "Phone Number",
|
|
5
|
+
"applyMaskOn": "change",
|
|
6
|
+
"allowMultipleMasks": true,
|
|
7
|
+
"tableView": true,
|
|
8
|
+
"key": "phoneNumber",
|
|
9
|
+
"type": "phoneNumber",
|
|
10
|
+
"inputMasks": [
|
|
11
|
+
{
|
|
12
|
+
"label": "Canada",
|
|
13
|
+
"mask": "(999) 999-9999"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"label": "Other",
|
|
17
|
+
"mask": ""
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"input": true
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
@@ -22,7 +22,6 @@ export default class SignatureComponent extends Input {
|
|
|
22
22
|
showCanvas(show: any): void;
|
|
23
23
|
onDisabled(): void;
|
|
24
24
|
checkSize(force: any, scale: any): void;
|
|
25
|
-
getModalPreviewTemplate(): any;
|
|
26
25
|
signaturePad: SignaturePad | null | undefined;
|
|
27
26
|
observer: any;
|
|
28
27
|
getValueAsString(value: any): "" | "Yes" | "No";
|