@formio/js 5.0.0-dev.5632.8d1873d → 5.0.0-dev.5633.3b83d8c
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/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Webform.d.ts +6 -0
- package/lib/cjs/Webform.js +12 -4
- package/lib/cjs/components/_classes/component/Component.d.ts +2 -0
- package/lib/cjs/components/_classes/component/Component.js +15 -13
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +4 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/utils/utils.d.ts +0 -6
- package/lib/cjs/utils/utils.js +4 -15
- package/lib/mjs/Webform.d.ts +6 -0
- package/lib/mjs/Webform.js +12 -4
- package/lib/mjs/components/_classes/component/Component.d.ts +2 -0
- package/lib/mjs/components/_classes/component/Component.js +23 -13
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +4 -1
- package/lib/mjs/components/select/Select.js +2 -2
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/utils/utils.d.ts +0 -6
- package/lib/mjs/utils/utils.js +2 -12
- package/package.json +1 -1
package/lib/cjs/Webform.d.ts
CHANGED
|
@@ -356,6 +356,12 @@ declare class Webform extends NestedDataComponent {
|
|
|
356
356
|
* @returns {Object}
|
|
357
357
|
*/
|
|
358
358
|
get submission(): Object;
|
|
359
|
+
/**
|
|
360
|
+
* @param submission
|
|
361
|
+
* @param flags
|
|
362
|
+
* @return {void}
|
|
363
|
+
*/
|
|
364
|
+
onSetSubmission(submission: any, flags?: {}): void;
|
|
359
365
|
/**
|
|
360
366
|
* Sets a submission and returns the promise when it is ready.
|
|
361
367
|
* @param submission
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -716,6 +716,17 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
716
716
|
set submission(submission) {
|
|
717
717
|
this.setSubmission(submission);
|
|
718
718
|
}
|
|
719
|
+
/**
|
|
720
|
+
* @param submission
|
|
721
|
+
* @param flags
|
|
722
|
+
* @return {void}
|
|
723
|
+
*/
|
|
724
|
+
onSetSubmission(submission, flags = {}) {
|
|
725
|
+
this.submissionSet = true;
|
|
726
|
+
this.triggerChange(flags);
|
|
727
|
+
this.emit('beforeSetSubmission', submission);
|
|
728
|
+
this.setValue(submission, flags);
|
|
729
|
+
}
|
|
719
730
|
/**
|
|
720
731
|
* Sets a submission and returns the promise when it is ready.
|
|
721
732
|
* @param submission
|
|
@@ -728,10 +739,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
728
739
|
if (resolveFlags) {
|
|
729
740
|
flags = Object.assign(Object.assign({}, flags), resolveFlags);
|
|
730
741
|
}
|
|
731
|
-
this.
|
|
732
|
-
this.triggerChange(flags);
|
|
733
|
-
this.emit('beforeSetSubmission', submission);
|
|
734
|
-
this.setValue(submission, flags);
|
|
742
|
+
this.onSetSubmission(submission, flags);
|
|
735
743
|
return this.submissionReadyResolve(submission);
|
|
736
744
|
}, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
|
|
737
745
|
}
|
|
@@ -327,10 +327,12 @@ declare class Component extends Element {
|
|
|
327
327
|
*/
|
|
328
328
|
loadRefs(element: HTMLElement, refs: object, referenceAttributeName?: string | undefined): void;
|
|
329
329
|
setOpenModalElement(template: any): void;
|
|
330
|
+
renderModalPreview(ctx: any): any;
|
|
330
331
|
getModalPreviewTemplate(): any;
|
|
331
332
|
build(element: any): Promise<void>;
|
|
332
333
|
get hasModalSaveButton(): boolean;
|
|
333
334
|
render(children?: string, topLevel?: boolean): any;
|
|
335
|
+
createTooltip(tooltipEl: any, settings?: {}): import("tippy.js").Instance<import("tippy.js").Props>[];
|
|
334
336
|
attachTooltips(toolTipsRefs: any): void;
|
|
335
337
|
createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
|
|
336
338
|
attach(element: any): Promise<void>;
|
|
@@ -1029,6 +1029,9 @@ class Component extends Element_1.default {
|
|
|
1029
1029
|
setOpenModalElement(template) {
|
|
1030
1030
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1031
1031
|
}
|
|
1032
|
+
renderModalPreview(ctx) {
|
|
1033
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1034
|
+
}
|
|
1032
1035
|
getModalPreviewTemplate() {
|
|
1033
1036
|
var _a;
|
|
1034
1037
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1036,7 +1039,7 @@ class Component extends Element_1.default {
|
|
|
1036
1039
|
if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
|
|
1037
1040
|
modalLabel = { className: 'field-required' };
|
|
1038
1041
|
}
|
|
1039
|
-
return this.
|
|
1042
|
+
return this.renderModalPreview({
|
|
1040
1043
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1041
1044
|
messages: '',
|
|
1042
1045
|
labelInfo: modalLabel,
|
|
@@ -1074,21 +1077,17 @@ class Component extends Element_1.default {
|
|
|
1074
1077
|
}, topLevel);
|
|
1075
1078
|
}
|
|
1076
1079
|
}
|
|
1080
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1081
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1082
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1083
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1084
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1085
|
+
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 }) }));
|
|
1086
|
+
}
|
|
1077
1087
|
attachTooltips(toolTipsRefs) {
|
|
1078
1088
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1079
1089
|
if (tooltip) {
|
|
1080
|
-
|
|
1081
|
-
const tooltipDataTitle = tooltip.getAttribute('data-title');
|
|
1082
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1083
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1084
|
-
this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
|
|
1085
|
-
allowHTML: true,
|
|
1086
|
-
trigger: 'mouseenter click focus',
|
|
1087
|
-
placement: 'right',
|
|
1088
|
-
zIndex: 10000,
|
|
1089
|
-
interactive: true,
|
|
1090
|
-
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1091
|
-
});
|
|
1090
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1092
1091
|
}
|
|
1093
1092
|
});
|
|
1094
1093
|
}
|
|
@@ -1850,6 +1849,9 @@ class Component extends Element_1.default {
|
|
|
1850
1849
|
messages = lodash_1.default.uniqBy(messages, message => message.message);
|
|
1851
1850
|
if (this.refs.messageContainer) {
|
|
1852
1851
|
this.setContent(this.refs.messageContainer, messages.map((message) => {
|
|
1852
|
+
if (message.message && typeof message.message === 'string') {
|
|
1853
|
+
message.message = message.message.replaceAll('<', '<').replaceAll('>', '>');
|
|
1854
|
+
}
|
|
1853
1855
|
return this.renderTemplate('message', Object.assign({}, message));
|
|
1854
1856
|
}).join(''));
|
|
1855
1857
|
}
|
|
@@ -79,6 +79,7 @@ export default class FormComponent extends Component {
|
|
|
79
79
|
isHidden(): boolean;
|
|
80
80
|
setValue(submission: any, flags?: {}): boolean;
|
|
81
81
|
setSubFormValue(submission: any, flags: any): void;
|
|
82
|
+
onSetSubFormValue(submission: any, flags: any): void;
|
|
82
83
|
areAllComponentsEmpty(data: any): boolean;
|
|
83
84
|
updateSubFormVisibility(): void;
|
|
84
85
|
/**
|
|
@@ -645,9 +645,12 @@ class FormComponent extends Component_1.default {
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
else {
|
|
648
|
-
this.
|
|
648
|
+
this.onSetSubFormValue(submission, flags);
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
|
+
onSetSubFormValue(submission, flags) {
|
|
652
|
+
this.subForm.setValue(submission, flags);
|
|
653
|
+
}
|
|
651
654
|
isEmpty(value = this.dataValue) {
|
|
652
655
|
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));
|
|
653
656
|
}
|
|
@@ -1526,7 +1526,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1526
1526
|
const getTemplateValue = (v) => {
|
|
1527
1527
|
const itemTemplate = this.itemTemplate(v);
|
|
1528
1528
|
return options.csv && itemTemplate
|
|
1529
|
-
? (0, utils_1.
|
|
1529
|
+
? (0, utils_1.unescapeHTML)(itemTemplate)
|
|
1530
1530
|
: itemTemplate;
|
|
1531
1531
|
};
|
|
1532
1532
|
if (Array.isArray(value)) {
|
|
@@ -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/cjs/utils/utils.d.ts
CHANGED
|
@@ -107,12 +107,6 @@ export function checkCondition(component: any, row: any, data: any, form: any, i
|
|
|
107
107
|
*/
|
|
108
108
|
export function checkTrigger(component: any, trigger: any, row: any, data: any, form: any, instance: any): mixed;
|
|
109
109
|
export function setActionProperty(component: any, action: any, result: any, row: any, data: any, instance: any): any;
|
|
110
|
-
/**
|
|
111
|
-
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
112
|
-
* @param {string} str
|
|
113
|
-
* @returns {string}
|
|
114
|
-
*/
|
|
115
|
-
export function removeHTML(str: string): string;
|
|
116
110
|
/**
|
|
117
111
|
* Unescape HTML characters like <, >, & and etc.
|
|
118
112
|
* @param str
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -30,8 +30,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.
|
|
34
|
-
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload =
|
|
33
|
+
exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
|
34
|
+
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = void 0;
|
|
35
35
|
const lodash_1 = __importDefault(require("lodash"));
|
|
36
36
|
exports._ = lodash_1.default;
|
|
37
37
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
|
@@ -448,16 +448,6 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
448
448
|
return component;
|
|
449
449
|
}
|
|
450
450
|
exports.setActionProperty = setActionProperty;
|
|
451
|
-
/**
|
|
452
|
-
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
453
|
-
* @param {string} str
|
|
454
|
-
* @returns {string}
|
|
455
|
-
*/
|
|
456
|
-
function removeHTML(str) {
|
|
457
|
-
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
458
|
-
return (doc.body.textContent || '').trim();
|
|
459
|
-
}
|
|
460
|
-
exports.removeHTML = removeHTML;
|
|
461
451
|
/**
|
|
462
452
|
* Unescape HTML characters like <, >, & and etc.
|
|
463
453
|
* @param str
|
|
@@ -467,9 +457,8 @@ function unescapeHTML(str) {
|
|
|
467
457
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
468
458
|
return str;
|
|
469
459
|
}
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
return elem.value;
|
|
460
|
+
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
461
|
+
return doc.documentElement.textContent;
|
|
473
462
|
}
|
|
474
463
|
exports.unescapeHTML = unescapeHTML;
|
|
475
464
|
/**
|
package/lib/mjs/Webform.d.ts
CHANGED
|
@@ -356,6 +356,12 @@ declare class Webform extends NestedDataComponent {
|
|
|
356
356
|
* @returns {Object}
|
|
357
357
|
*/
|
|
358
358
|
get submission(): Object;
|
|
359
|
+
/**
|
|
360
|
+
* @param submission
|
|
361
|
+
* @param flags
|
|
362
|
+
* @return {void}
|
|
363
|
+
*/
|
|
364
|
+
onSetSubmission(submission: any, flags?: {}): void;
|
|
359
365
|
/**
|
|
360
366
|
* Sets a submission and returns the promise when it is ready.
|
|
361
367
|
* @param submission
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -714,6 +714,17 @@ export default class Webform extends NestedDataComponent {
|
|
|
714
714
|
set submission(submission) {
|
|
715
715
|
this.setSubmission(submission);
|
|
716
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* @param submission
|
|
719
|
+
* @param flags
|
|
720
|
+
* @return {void}
|
|
721
|
+
*/
|
|
722
|
+
onSetSubmission(submission, flags = {}) {
|
|
723
|
+
this.submissionSet = true;
|
|
724
|
+
this.triggerChange(flags);
|
|
725
|
+
this.emit('beforeSetSubmission', submission);
|
|
726
|
+
this.setValue(submission, flags);
|
|
727
|
+
}
|
|
717
728
|
/**
|
|
718
729
|
* Sets a submission and returns the promise when it is ready.
|
|
719
730
|
* @param submission
|
|
@@ -732,10 +743,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
732
743
|
...resolveFlags
|
|
733
744
|
};
|
|
734
745
|
}
|
|
735
|
-
this.
|
|
736
|
-
this.triggerChange(flags);
|
|
737
|
-
this.emit('beforeSetSubmission', submission);
|
|
738
|
-
this.setValue(submission, flags);
|
|
746
|
+
this.onSetSubmission(submission, flags);
|
|
739
747
|
return this.submissionReadyResolve(submission);
|
|
740
748
|
}, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
|
|
741
749
|
}
|
|
@@ -327,10 +327,12 @@ declare class Component extends Element {
|
|
|
327
327
|
*/
|
|
328
328
|
loadRefs(element: HTMLElement, refs: object, referenceAttributeName?: string | undefined): void;
|
|
329
329
|
setOpenModalElement(template: any): void;
|
|
330
|
+
renderModalPreview(ctx: any): any;
|
|
330
331
|
getModalPreviewTemplate(): any;
|
|
331
332
|
build(element: any): Promise<void>;
|
|
332
333
|
get hasModalSaveButton(): boolean;
|
|
333
334
|
render(children?: string, topLevel?: boolean): any;
|
|
335
|
+
createTooltip(tooltipEl: any, settings?: {}): import("tippy.js").Instance<import("tippy.js").Props>[];
|
|
334
336
|
attachTooltips(toolTipsRefs: any): void;
|
|
335
337
|
createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
|
|
336
338
|
attach(element: any): Promise<void>;
|
|
@@ -996,13 +996,16 @@ export default class Component extends Element {
|
|
|
996
996
|
setOpenModalElement(template) {
|
|
997
997
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
998
998
|
}
|
|
999
|
+
renderModalPreview(ctx) {
|
|
1000
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1001
|
+
}
|
|
999
1002
|
getModalPreviewTemplate() {
|
|
1000
1003
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
1001
1004
|
let modalLabel;
|
|
1002
1005
|
if (this.hasInput && this.component.validate?.required && !this.isPDFReadOnlyMode) {
|
|
1003
1006
|
modalLabel = { className: 'field-required' };
|
|
1004
1007
|
}
|
|
1005
|
-
return this.
|
|
1008
|
+
return this.renderModalPreview({
|
|
1006
1009
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1007
1010
|
messages: '',
|
|
1008
1011
|
labelInfo: modalLabel,
|
|
@@ -1040,21 +1043,25 @@ export default class Component extends Element {
|
|
|
1040
1043
|
}, topLevel);
|
|
1041
1044
|
}
|
|
1042
1045
|
}
|
|
1046
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1047
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1048
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1049
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1050
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1051
|
+
return tippy(tooltipEl, {
|
|
1052
|
+
allowHTML: true,
|
|
1053
|
+
trigger: 'mouseenter click focus',
|
|
1054
|
+
placement: 'right',
|
|
1055
|
+
zIndex: 10000,
|
|
1056
|
+
interactive: true,
|
|
1057
|
+
...settings,
|
|
1058
|
+
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1043
1061
|
attachTooltips(toolTipsRefs) {
|
|
1044
1062
|
toolTipsRefs?.forEach((tooltip, index) => {
|
|
1045
1063
|
if (tooltip) {
|
|
1046
|
-
|
|
1047
|
-
const tooltipDataTitle = tooltip.getAttribute('data-title');
|
|
1048
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1049
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1050
|
-
this.tooltips[index] = tippy(tooltip, {
|
|
1051
|
-
allowHTML: true,
|
|
1052
|
-
trigger: 'mouseenter click focus',
|
|
1053
|
-
placement: 'right',
|
|
1054
|
-
zIndex: 10000,
|
|
1055
|
-
interactive: true,
|
|
1056
|
-
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1057
|
-
});
|
|
1064
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1058
1065
|
}
|
|
1059
1066
|
});
|
|
1060
1067
|
}
|
|
@@ -1814,6 +1821,9 @@ export default class Component extends Element {
|
|
|
1814
1821
|
messages = _.uniqBy(messages, message => message.message);
|
|
1815
1822
|
if (this.refs.messageContainer) {
|
|
1816
1823
|
this.setContent(this.refs.messageContainer, messages.map((message) => {
|
|
1824
|
+
if (message.message && typeof message.message === 'string') {
|
|
1825
|
+
message.message = message.message.replaceAll('<', '<').replaceAll('>', '>');
|
|
1826
|
+
}
|
|
1817
1827
|
return this.renderTemplate('message', { ...message });
|
|
1818
1828
|
}).join(''));
|
|
1819
1829
|
}
|
|
@@ -79,6 +79,7 @@ export default class FormComponent extends Component {
|
|
|
79
79
|
isHidden(): boolean;
|
|
80
80
|
setValue(submission: any, flags?: {}): boolean;
|
|
81
81
|
setSubFormValue(submission: any, flags: any): void;
|
|
82
|
+
onSetSubFormValue(submission: any, flags: any): void;
|
|
82
83
|
areAllComponentsEmpty(data: any): boolean;
|
|
83
84
|
updateSubFormVisibility(): void;
|
|
84
85
|
/**
|
|
@@ -635,9 +635,12 @@ export default class FormComponent extends Component {
|
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
else {
|
|
638
|
-
this.
|
|
638
|
+
this.onSetSubFormValue(submission, flags);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
+
onSetSubFormValue(submission, flags) {
|
|
642
|
+
this.subForm.setValue(submission, flags);
|
|
643
|
+
}
|
|
641
644
|
isEmpty(value = this.dataValue) {
|
|
642
645
|
return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
|
|
643
646
|
}
|
|
@@ -3,7 +3,7 @@ import { Formio } from '../../Formio';
|
|
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
|
4
4
|
import Input from '../_classes/input/Input';
|
|
5
5
|
import Form from '../../Form';
|
|
6
|
-
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, unescapeHTML, isSelectResourceWithObjectValue
|
|
6
|
+
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, unescapeHTML, isSelectResourceWithObjectValue } from '../../utils/utils';
|
|
7
7
|
import Choices from '../../utils/ChoicesWrapper';
|
|
8
8
|
export default class SelectComponent extends ListComponent {
|
|
9
9
|
static schema(...extend) {
|
|
@@ -1551,7 +1551,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1551
1551
|
const getTemplateValue = (v) => {
|
|
1552
1552
|
const itemTemplate = this.itemTemplate(v);
|
|
1553
1553
|
return options.csv && itemTemplate
|
|
1554
|
-
?
|
|
1554
|
+
? unescapeHTML(itemTemplate)
|
|
1555
1555
|
: itemTemplate;
|
|
1556
1556
|
};
|
|
1557
1557
|
if (Array.isArray(value)) {
|
|
@@ -169,7 +169,7 @@ export default class SignatureComponent extends Input {
|
|
|
169
169
|
return false;
|
|
170
170
|
}
|
|
171
171
|
getModalPreviewTemplate() {
|
|
172
|
-
return this.
|
|
172
|
+
return this.renderModalPreview({
|
|
173
173
|
previewText: this.dataValue ?
|
|
174
174
|
`<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
|
|
175
175
|
this.t('Click to Sign')
|
package/lib/mjs/utils/utils.d.ts
CHANGED
|
@@ -107,12 +107,6 @@ export function checkCondition(component: any, row: any, data: any, form: any, i
|
|
|
107
107
|
*/
|
|
108
108
|
export function checkTrigger(component: any, trigger: any, row: any, data: any, form: any, instance: any): mixed;
|
|
109
109
|
export function setActionProperty(component: any, action: any, result: any, row: any, data: any, instance: any): any;
|
|
110
|
-
/**
|
|
111
|
-
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
112
|
-
* @param {string} str
|
|
113
|
-
* @returns {string}
|
|
114
|
-
*/
|
|
115
|
-
export function removeHTML(str: string): string;
|
|
116
110
|
/**
|
|
117
111
|
* Unescape HTML characters like <, >, & and etc.
|
|
118
112
|
* @param str
|
package/lib/mjs/utils/utils.js
CHANGED
|
@@ -395,15 +395,6 @@ export function setActionProperty(component, action, result, row, data, instance
|
|
|
395
395
|
}
|
|
396
396
|
return component;
|
|
397
397
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
400
|
-
* @param {string} str
|
|
401
|
-
* @returns {string}
|
|
402
|
-
*/
|
|
403
|
-
export function removeHTML(str) {
|
|
404
|
-
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
405
|
-
return (doc.body.textContent || '').trim();
|
|
406
|
-
}
|
|
407
398
|
/**
|
|
408
399
|
* Unescape HTML characters like <, >, & and etc.
|
|
409
400
|
* @param str
|
|
@@ -413,9 +404,8 @@ export function unescapeHTML(str) {
|
|
|
413
404
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
414
405
|
return str;
|
|
415
406
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
return elem.value;
|
|
407
|
+
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
408
|
+
return doc.documentElement.textContent;
|
|
419
409
|
}
|
|
420
410
|
/**
|
|
421
411
|
* Make HTML element from string
|