@formio/js 5.0.0-rc.36 → 5.0.0-rc.38
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/fonts/bootstrap-icons.woff +0 -0
- package/dist/fonts/bootstrap-icons.woff2 +0 -0
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +854 -133
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +5 -3
- package/dist/formio.full.css +4 -4
- package/dist/formio.full.js +828 -137
- package/dist/formio.full.min.css +3 -3
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +5 -3
- package/dist/formio.js +5 -5
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +25 -14
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +5 -3
- package/lib/cjs/Element.js +2 -2
- package/lib/cjs/Embed.js +19 -14
- package/lib/cjs/Formio.js +3 -0
- package/lib/cjs/components/_classes/component/Component.js +21 -7
- package/lib/cjs/components/_classes/component/fixtures/comp5.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.js +5 -12
- package/lib/cjs/components/_classes/nested/NestedComponent.js +17 -9
- package/lib/cjs/components/columns/editForm/Columns.edit.display.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +11 -4
- package/lib/cjs/components/form/Form.js +3 -1
- package/lib/cjs/components/html/HTML.js +2 -2
- package/lib/cjs/components/html/fixtures/comp3.js +31 -0
- package/lib/cjs/components/html/fixtures/index.js +3 -1
- package/lib/cjs/components/radio/Radio.js +2 -1
- package/lib/cjs/components/radio/fixtures/comp10.js +23 -0
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/cjs/components/select/Select.js +84 -9
- package/lib/cjs/components/survey/Survey.js +10 -0
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +19 -1
- package/lib/cjs/utils/conditionOperators/IsNotEqualTo.js +4 -5
- package/lib/cjs/utils/utils.js +40 -2
- package/lib/mjs/Element.js +2 -2
- package/lib/mjs/Embed.js +17 -14
- package/lib/mjs/Formio.js +3 -0
- package/lib/mjs/components/_classes/component/Component.js +24 -8
- package/lib/mjs/components/_classes/component/fixtures/comp5.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.js +5 -12
- package/lib/mjs/components/_classes/nested/NestedComponent.js +17 -9
- package/lib/mjs/components/columns/editForm/Columns.edit.display.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +11 -4
- package/lib/mjs/components/form/Form.js +3 -1
- package/lib/mjs/components/html/HTML.js +2 -2
- package/lib/mjs/components/html/fixtures/comp3.js +29 -0
- package/lib/mjs/components/html/fixtures/index.js +2 -1
- package/lib/mjs/components/radio/Radio.js +2 -1
- package/lib/mjs/components/radio/fixtures/comp10.js +21 -0
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/mjs/components/select/Select.js +83 -10
- package/lib/mjs/components/survey/Survey.js +10 -0
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +18 -1
- package/lib/mjs/utils/conditionOperators/IsNotEqualTo.js +4 -5
- package/lib/mjs/utils/utils.js +35 -0
- package/package.json +2 -2
- package/types/formio.d.ts +4 -0
@@ -10,9 +10,11 @@
|
|
10
10
|
* MIT licensed
|
11
11
|
*/
|
12
12
|
|
13
|
-
/*! @license DOMPurify 3.0.
|
13
|
+
/*! @license DOMPurify 3.0.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.7/LICENSE */
|
14
14
|
|
15
|
-
/*!
|
15
|
+
/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
|
16
|
+
|
17
|
+
/*! formiojs v5.0.0-rc.38 | https://unpkg.com/formiojs@5.0.0-rc.38/LICENSE.txt */
|
16
18
|
|
17
19
|
/**
|
18
20
|
* @license
|
@@ -33,4 +35,4 @@
|
|
33
35
|
|
34
36
|
//! moment.js
|
35
37
|
|
36
|
-
//! version : 0.5.
|
38
|
+
//! version : 0.5.44
|
package/lib/cjs/Element.js
CHANGED
@@ -208,7 +208,7 @@ class Element {
|
|
208
208
|
* @param persistent
|
209
209
|
* If this listener should persist beyond "destroy" commands.
|
210
210
|
*/
|
211
|
-
addEventListener(obj, type, func, persistent) {
|
211
|
+
addEventListener(obj, type, func, persistent, capture) {
|
212
212
|
if (!obj) {
|
213
213
|
return;
|
214
214
|
}
|
@@ -216,7 +216,7 @@ class Element {
|
|
216
216
|
this.eventHandlers.push({ id: this.id, obj, type, func });
|
217
217
|
}
|
218
218
|
if ('addEventListener' in obj) {
|
219
|
-
obj.addEventListener(type, func,
|
219
|
+
obj.addEventListener(type, func, !!capture);
|
220
220
|
}
|
221
221
|
else if ('attachEvent' in obj) {
|
222
222
|
obj.attachEvent(`on${type}`, func);
|
package/lib/cjs/Embed.js
CHANGED
@@ -210,6 +210,24 @@ class Formio {
|
|
210
210
|
}
|
211
211
|
});
|
212
212
|
}
|
213
|
+
static addLoader(wrapper) {
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
215
|
+
wrapper.appendChild(Formio.createElement('div', {
|
216
|
+
'class': 'formio-loader'
|
217
|
+
}, [{
|
218
|
+
tag: 'div',
|
219
|
+
attrs: {
|
220
|
+
class: 'loader-wrapper'
|
221
|
+
},
|
222
|
+
children: [{
|
223
|
+
tag: 'div',
|
224
|
+
attrs: {
|
225
|
+
class: 'loader text-center'
|
226
|
+
}
|
227
|
+
}]
|
228
|
+
}]));
|
229
|
+
});
|
230
|
+
}
|
213
231
|
// eslint-disable-next-line max-statements
|
214
232
|
static init(element, options = {}, builder = false) {
|
215
233
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -254,20 +272,7 @@ class Formio {
|
|
254
272
|
// Load the renderer styles.
|
255
273
|
yield Formio.addStyles(wrapper, Formio.config.embedCSS || `${Formio.cdn.js}/formio.embed.css`);
|
256
274
|
// Add a loader.
|
257
|
-
|
258
|
-
'class': 'formio-loader'
|
259
|
-
}, [{
|
260
|
-
tag: 'div',
|
261
|
-
attrs: {
|
262
|
-
class: 'loader-wrapper'
|
263
|
-
},
|
264
|
-
children: [{
|
265
|
-
tag: 'div',
|
266
|
-
attrs: {
|
267
|
-
class: 'loader text-center'
|
268
|
-
}
|
269
|
-
}]
|
270
|
-
}]));
|
275
|
+
Formio.addLoader(wrapper);
|
271
276
|
const formioSrc = Formio.config.full ? 'formio.full' : 'formio.form';
|
272
277
|
const renderer = Formio.config.debug ? formioSrc : `${formioSrc}.min`;
|
273
278
|
Formio.FormioClass = yield Formio.addScript(wrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
|
package/lib/cjs/Formio.js
CHANGED
@@ -111,3 +111,6 @@ sdk_1.Formio.Form = Embed_1.Formio.Form;
|
|
111
111
|
sdk_1.Formio.FormBuilder = Embed_1.Formio.FormBuilder;
|
112
112
|
sdk_1.Formio.use = Embed_1.Formio.use;
|
113
113
|
sdk_1.Formio.createForm = Embed_1.Formio.createForm;
|
114
|
+
sdk_1.Formio.submitDone = Embed_1.Formio.submitDone;
|
115
|
+
sdk_1.Formio.addLibrary = Embed_1.Formio.addLibrary;
|
116
|
+
sdk_1.Formio.addLoader = Embed_1.Formio.addLoader;
|
@@ -850,7 +850,11 @@ class Component extends Element_1.default {
|
|
850
850
|
renderTemplate(name, data = {}, modeOption) {
|
851
851
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
852
852
|
const mode = modeOption || this.options.renderMode || 'form';
|
853
|
-
data.component = this.component;
|
853
|
+
data.component = Object.assign({}, this.component);
|
854
|
+
// Escape HTML provided in component description and render it as a string instead
|
855
|
+
if (this.component.description) {
|
856
|
+
data.component.description = FormioUtils.escapeHTML(this.component.description);
|
857
|
+
}
|
854
858
|
data.self = this;
|
855
859
|
data.options = this.options;
|
856
860
|
data.readOnly = this.options.readOnly;
|
@@ -1064,12 +1068,12 @@ class Component extends Element_1.default {
|
|
1064
1068
|
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
1065
1069
|
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
1066
1070
|
this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
|
1067
|
-
allowHTML:
|
1071
|
+
allowHTML: false,
|
1068
1072
|
trigger: 'mouseenter click focus',
|
1069
1073
|
placement: 'right',
|
1070
1074
|
zIndex: 10000,
|
1071
1075
|
interactive: true,
|
1072
|
-
content: this.t(
|
1076
|
+
content: this.t(tooltipText, { _userInput: true }),
|
1073
1077
|
});
|
1074
1078
|
}
|
1075
1079
|
});
|
@@ -2606,7 +2610,7 @@ class Component extends Element_1.default {
|
|
2606
2610
|
scope: validationScope,
|
2607
2611
|
instance: this,
|
2608
2612
|
processors: [
|
2609
|
-
process_1.
|
2613
|
+
process_1.validateProcessInfo
|
2610
2614
|
]
|
2611
2615
|
});
|
2612
2616
|
const errors = validationScope.errors;
|
@@ -2688,7 +2692,7 @@ class Component extends Element_1.default {
|
|
2688
2692
|
instance: this,
|
2689
2693
|
scope: { errors: [] },
|
2690
2694
|
processors: [
|
2691
|
-
|
2695
|
+
process_1.validateProcessInfo
|
2692
2696
|
]
|
2693
2697
|
};
|
2694
2698
|
if (async) {
|
@@ -2717,7 +2721,12 @@ class Component extends Element_1.default {
|
|
2717
2721
|
return this.validateComponent(data, row, flags).then((errors) => {
|
2718
2722
|
allErrors.push(...errors);
|
2719
2723
|
if (this.parent && this.parent.childErrors) {
|
2720
|
-
|
2724
|
+
if (errors.length) {
|
2725
|
+
this.parent.childErrors.push(...errors);
|
2726
|
+
}
|
2727
|
+
else {
|
2728
|
+
lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
|
2729
|
+
}
|
2721
2730
|
}
|
2722
2731
|
this.showValidationErrors(errors, data, row, flags);
|
2723
2732
|
return errors.length === 0;
|
@@ -2728,7 +2737,12 @@ class Component extends Element_1.default {
|
|
2728
2737
|
this.showValidationErrors(errors, data, row, flags);
|
2729
2738
|
allErrors.push(...errors);
|
2730
2739
|
if (this.parent && this.parent.childErrors) {
|
2731
|
-
|
2740
|
+
if (errors.length) {
|
2741
|
+
this.parent.childErrors.push(...errors);
|
2742
|
+
}
|
2743
|
+
else {
|
2744
|
+
lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
|
2745
|
+
}
|
2732
2746
|
}
|
2733
2747
|
return errors.length === 0;
|
2734
2748
|
}
|
@@ -6,8 +6,8 @@ exports.default = {
|
|
6
6
|
components: [
|
7
7
|
{
|
8
8
|
label: 'Text Field',
|
9
|
-
description: "<img
|
10
|
-
tooltip: "<img src='https://somesite' onerror='var _ee = 1 >",
|
9
|
+
description: "<img src='https://somesite' onerror='var _ee = 2' >",
|
10
|
+
tooltip: "<img src='https://somesite' onerror='var _ee = 1' >",
|
11
11
|
applyMaskOn: 'change',
|
12
12
|
tableView: true,
|
13
13
|
key: 'textField',
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Field_1 = __importDefault(require("../field/Field"));
|
7
7
|
const Formio_1 = require("../../../Formio");
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
+
const utils_1 = require("../../../utils/utils");
|
9
10
|
class ListComponent extends Field_1.default {
|
10
11
|
static schema(...extend) {
|
11
12
|
return Field_1.default.schema({
|
@@ -48,18 +49,10 @@ class ListComponent extends Field_1.default {
|
|
48
49
|
return true;
|
49
50
|
}
|
50
51
|
getTemplateKeys() {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
keys.forEach((key) => {
|
56
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
57
|
-
if (propKey && propKey.length > 1) {
|
58
|
-
this.templateKeys.push(propKey[1]);
|
59
|
-
}
|
60
|
-
});
|
61
|
-
}
|
62
|
-
}
|
52
|
+
const template = this.component.template;
|
53
|
+
this.templateKeys = this.options.readOnly && template
|
54
|
+
? (0, utils_1.getItemTemplateKeys)(template)
|
55
|
+
: [];
|
63
56
|
}
|
64
57
|
get requestHeaders() {
|
65
58
|
// Create the headers object.
|
@@ -586,6 +586,16 @@ class NestedComponent extends Field_1.default {
|
|
586
586
|
components = components || this.component.components;
|
587
587
|
data = data || this.rootValue;
|
588
588
|
const { async, dirty, process } = flags;
|
589
|
+
const validationProcessorProcess = (context) => this.validationProcessor(context, flags);
|
590
|
+
const checkModalProcessorProcess = ({ instance, component, components }) => {
|
591
|
+
// If we just validated the last component, and there are errors from our parent, then we need to show a model of those errors.
|
592
|
+
if (instance &&
|
593
|
+
instance.parent &&
|
594
|
+
(component === components[components.length - 1]) &&
|
595
|
+
instance.parent.componentModal) {
|
596
|
+
instance.parent.checkModal(instance.parent.childErrors, dirty);
|
597
|
+
}
|
598
|
+
};
|
589
599
|
const processorContext = {
|
590
600
|
process: process || 'unknown',
|
591
601
|
components,
|
@@ -593,15 +603,13 @@ class NestedComponent extends Field_1.default {
|
|
593
603
|
data: data,
|
594
604
|
scope: { errors: [] },
|
595
605
|
processors: [
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
instance.parent.checkModal(instance.parent.childErrors, dirty);
|
604
|
-
}
|
606
|
+
{
|
607
|
+
process: validationProcessorProcess,
|
608
|
+
processSync: validationProcessorProcess
|
609
|
+
},
|
610
|
+
{
|
611
|
+
process: checkModalProcessorProcess,
|
612
|
+
processSync: checkModalProcessorProcess
|
605
613
|
}
|
606
614
|
]
|
607
615
|
};
|
@@ -58,7 +58,7 @@ exports.default = [
|
|
58
58
|
key: 'columns',
|
59
59
|
label: 'Column Properties',
|
60
60
|
addAnother: 'Add Column',
|
61
|
-
tooltip: 'The
|
61
|
+
tooltip: 'The size and width settings for each column. One row is equal to 12. (e.g., a row with two columns spanning the entire page should be 6 and 6)',
|
62
62
|
reorder: true,
|
63
63
|
components: [
|
64
64
|
{
|
@@ -473,7 +473,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
473
473
|
].forEach(({ className, event, action, }) => {
|
474
474
|
const elements = row.getElementsByClassName(className);
|
475
475
|
Array.prototype.forEach.call(elements, (element) => {
|
476
|
-
if (this.options.
|
476
|
+
if (this.options.pdf && lodash_1.default.intersection(element.classList, ['editRow', 'removeRow']).length) {
|
477
477
|
element.style.display = 'none';
|
478
478
|
}
|
479
479
|
else {
|
@@ -608,6 +608,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
608
608
|
const dataObj = {};
|
609
609
|
const rowIndex = this.editRows.length;
|
610
610
|
const editRow = this.createRow(dataObj, rowIndex);
|
611
|
+
if (editRow.state === EditRowState.New) {
|
612
|
+
this.emptyRow = (0, utils_1.fastCloneDeep)(editRow.data);
|
613
|
+
}
|
611
614
|
if (this.inlineEditMode) {
|
612
615
|
this.triggerChange();
|
613
616
|
}
|
@@ -678,7 +681,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
678
681
|
}
|
679
682
|
showDialog(rowIndex) {
|
680
683
|
const editRow = this.editRows[rowIndex];
|
681
|
-
if (lodash_1.default.isEqual(editRow.backup, editRow.data)) {
|
684
|
+
if (editRow.state === EditRowState.New ? lodash_1.default.isEqual(this.emptyRow, editRow.data) : lodash_1.default.isEqual(editRow.backup, editRow.data)) {
|
682
685
|
return Promise.resolve();
|
683
686
|
}
|
684
687
|
const wrapper = this.ce('div', { ref: 'confirmationDialog' });
|
@@ -980,6 +983,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
980
983
|
const editGridValue = lodash_1.default.get(rootValue, this.path, []);
|
981
984
|
editGridValue[editRow.rowIndex] = editRow.data;
|
982
985
|
lodash_1.default.set(rootValue, this.path, editGridValue);
|
986
|
+
const validationProcessorProcess = (context) => this.validationProcessor(context, { dirty, silentCheck });
|
983
987
|
editRow.errors = (0, process_1.processSync)({
|
984
988
|
components: (0, utils_1.fastCloneDeep)(this.component.components).map((component) => {
|
985
989
|
component.parentPath = `${this.path}[${editRow.rowIndex}]`;
|
@@ -991,7 +995,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
991
995
|
instances: this.componentsMap,
|
992
996
|
scope: { errors: [] },
|
993
997
|
processors: [
|
994
|
-
|
998
|
+
{
|
999
|
+
process: validationProcessorProcess,
|
1000
|
+
processSync: validationProcessorProcess
|
1001
|
+
}
|
995
1002
|
]
|
996
1003
|
}).errors;
|
997
1004
|
}
|
@@ -1082,7 +1089,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1082
1089
|
this.setCustomValidity(this.t(this.errorMessage('unsavedRowsError')), dirty);
|
1083
1090
|
return false;
|
1084
1091
|
}
|
1085
|
-
const message = this.invalid || this.invalidMessage(data, dirty);
|
1092
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row);
|
1086
1093
|
if (allRowErrors.length && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted) && !message) {
|
1087
1094
|
this._errors = this.setCustomValidity(message, dirty);
|
1088
1095
|
errors.push(...this._errors);
|
@@ -609,7 +609,9 @@ class FormComponent extends Component_1.default {
|
|
609
609
|
const formId = submission.form || this.formObj.form || this.component.form;
|
610
610
|
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
|
611
611
|
this.subForm.setUrl(submissionUrl, this.options);
|
612
|
-
this.subForm.loadSubmission()
|
612
|
+
this.subForm.loadSubmission().catch((err) => {
|
613
|
+
console.error(`Unable to load subform submission ${submission._id}:`, err);
|
614
|
+
});
|
613
615
|
}
|
614
616
|
else {
|
615
617
|
this.subForm.setValue(submission, flags);
|
@@ -43,13 +43,13 @@ class HTMLComponent extends Component_1.default {
|
|
43
43
|
return ` ${this.component.content} `;
|
44
44
|
}
|
45
45
|
const submission = lodash_1.default.get(this.root, 'submission', {});
|
46
|
-
const content = this.component.content ? this.interpolate(this.component.content, {
|
46
|
+
const content = this.component.content ? this.interpolate(this.sanitize(this.component.content, this.shouldSanitizeValue), {
|
47
47
|
metadata: submission.metadata || {},
|
48
48
|
submission: submission,
|
49
49
|
data: this.rootValue,
|
50
50
|
row: this.data
|
51
51
|
}) : '';
|
52
|
-
return
|
52
|
+
return content;
|
53
53
|
}
|
54
54
|
get singleTags() {
|
55
55
|
return ['br', 'img', 'hr'];
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
type: 'form',
|
5
|
+
display: 'form',
|
6
|
+
components: [
|
7
|
+
{
|
8
|
+
label: 'HTML',
|
9
|
+
attrs: [
|
10
|
+
{
|
11
|
+
attr: '',
|
12
|
+
value: '',
|
13
|
+
},
|
14
|
+
],
|
15
|
+
content: '<img src=1 onerror=alert("htmlContent")>',
|
16
|
+
refreshOnChange: false,
|
17
|
+
key: 'html',
|
18
|
+
type: 'htmlelement',
|
19
|
+
input: false,
|
20
|
+
tableView: false,
|
21
|
+
},
|
22
|
+
{
|
23
|
+
type: 'button',
|
24
|
+
label: 'Submit',
|
25
|
+
key: 'submit',
|
26
|
+
disableOnInvalid: true,
|
27
|
+
input: true,
|
28
|
+
tableView: false,
|
29
|
+
},
|
30
|
+
],
|
31
|
+
};
|
@@ -3,8 +3,10 @@ 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.comp2 = exports.comp1 = void 0;
|
6
|
+
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 comp2_1 = __importDefault(require("./comp2"));
|
10
10
|
exports.comp2 = comp2_1.default;
|
11
|
+
const comp3_1 = __importDefault(require("./comp3"));
|
12
|
+
exports.comp3 = comp3_1.default;
|
@@ -352,7 +352,8 @@ class RadioComponent extends ListComponent_1.default {
|
|
352
352
|
if (value === this.emptyValue) {
|
353
353
|
return value;
|
354
354
|
}
|
355
|
-
|
355
|
+
const isEquivalent = lodash_1.default.toString(value) === Number(value).toString();
|
356
|
+
if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {
|
356
357
|
value = +value;
|
357
358
|
}
|
358
359
|
if (value === 'true') {
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
'label': 'Radio',
|
5
|
+
'optionsLabelPosition': 'right',
|
6
|
+
'inline': false,
|
7
|
+
'tableView': false,
|
8
|
+
'values': [
|
9
|
+
{
|
10
|
+
'label': '01',
|
11
|
+
'value': '01',
|
12
|
+
'shortcut': ''
|
13
|
+
},
|
14
|
+
{
|
15
|
+
'label': '1',
|
16
|
+
'value': '1',
|
17
|
+
'shortcut': ''
|
18
|
+
}
|
19
|
+
],
|
20
|
+
'key': 'radio',
|
21
|
+
'type': 'radio',
|
22
|
+
'input': true
|
23
|
+
};
|
@@ -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.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = 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 comp2_1 = __importDefault(require("./comp2"));
|
@@ -22,3 +22,5 @@ const comp8_1 = __importDefault(require("./comp8"));
|
|
22
22
|
exports.comp8 = comp8_1.default;
|
23
23
|
const comp9_1 = __importDefault(require("./comp9"));
|
24
24
|
exports.comp9 = comp9_1.default;
|
25
|
+
const comp10_1 = __importDefault(require("./comp10"));
|
26
|
+
exports.comp10 = comp10_1.default;
|
@@ -57,6 +57,9 @@ class ReCaptchaComponent extends Component_1.default {
|
|
57
57
|
createLabel() {
|
58
58
|
return;
|
59
59
|
}
|
60
|
+
get skipInEmail() {
|
61
|
+
return true;
|
62
|
+
}
|
60
63
|
verify(actionName) {
|
61
64
|
const siteKey = (0, get_1.default)(this.root.form, 'settings.recaptcha.siteKey');
|
62
65
|
if (!siteKey) {
|
@@ -64,7 +64,19 @@ class SelectComponent extends ListComponent_1.default {
|
|
64
64
|
}
|
65
65
|
static get conditionOperatorsSettings() {
|
66
66
|
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
|
67
|
-
|
67
|
+
const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
|
68
|
+
if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
|
69
|
+
valueComp.reference = false;
|
70
|
+
valueComp.onSetItems = `
|
71
|
+
var templateKeys = utils.getItemTemplateKeys(component.template) || [];
|
72
|
+
items = _.map(items || [], i => {
|
73
|
+
var item = {};
|
74
|
+
_.each(templateKeys, k => _.set(item, k, _.get(i, k)));
|
75
|
+
return item;
|
76
|
+
})
|
77
|
+
`;
|
78
|
+
}
|
79
|
+
return valueComp;
|
68
80
|
} });
|
69
81
|
}
|
70
82
|
static savedValueTypes(schema) {
|
@@ -122,6 +134,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
122
134
|
this.itemsLoaded = new Promise((resolve) => {
|
123
135
|
this.itemsLoadedResolve = resolve;
|
124
136
|
});
|
137
|
+
this.shouldPositionDropdown = this.hasDataGridAncestor();
|
125
138
|
if (this.isHtmlRenderMode()) {
|
126
139
|
this.activate();
|
127
140
|
}
|
@@ -822,6 +835,11 @@ class SelectComponent extends ListComponent_1.default {
|
|
822
835
|
});
|
823
836
|
}
|
824
837
|
}
|
838
|
+
if (window && this.choices && this.shouldPositionDropdown) {
|
839
|
+
this.addEventListener(window.document, 'scroll', () => {
|
840
|
+
this.positionDropdown(true);
|
841
|
+
}, false, true);
|
842
|
+
}
|
825
843
|
this.focusableElement.setAttribute('tabIndex', tabIndex);
|
826
844
|
// If a search field is provided, then add an event listener to update items on search.
|
827
845
|
if (this.component.searchField) {
|
@@ -851,7 +869,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
851
869
|
const updateComponent = (evt) => {
|
852
870
|
this.triggerUpdate(evt.detail.value);
|
853
871
|
};
|
854
|
-
this.addEventListener(input, 'search', lodash_1.default.debounce(
|
872
|
+
this.addEventListener(input, 'search', lodash_1.default.debounce((e) => {
|
873
|
+
updateComponent(e);
|
874
|
+
this.positionDropdown();
|
875
|
+
}, debounceTimeout));
|
855
876
|
this.addEventListener(input, 'stopSearch', () => this.triggerUpdate());
|
856
877
|
this.addEventListener(input, 'hideDropdown', () => {
|
857
878
|
if (this.choices && this.choices.input && this.choices.input.element) {
|
@@ -860,7 +881,15 @@ class SelectComponent extends ListComponent_1.default {
|
|
860
881
|
this.updateItems(null, true);
|
861
882
|
});
|
862
883
|
}
|
863
|
-
this.addEventListener(input, 'showDropdown', () =>
|
884
|
+
this.addEventListener(input, 'showDropdown', () => {
|
885
|
+
this.update();
|
886
|
+
this.positionDropdown();
|
887
|
+
});
|
888
|
+
if (this.shouldPositionDropdown) {
|
889
|
+
this.addEventListener(input, 'highlightChoice', () => {
|
890
|
+
this.positionDropdown();
|
891
|
+
});
|
892
|
+
}
|
864
893
|
if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
|
865
894
|
this.addPlaceholderItem(choicesOptions.placeholderValue);
|
866
895
|
this.addEventListener(input, 'removeItem', () => {
|
@@ -897,6 +926,46 @@ class SelectComponent extends ListComponent_1.default {
|
|
897
926
|
this.triggerUpdate();
|
898
927
|
return superAttach;
|
899
928
|
}
|
929
|
+
setDropdownPosition() {
|
930
|
+
var _a, _b, _c, _d;
|
931
|
+
const dropdown = (_b = (_a = this.choices) === null || _a === void 0 ? void 0 : _a.dropdown) === null || _b === void 0 ? void 0 : _b.element;
|
932
|
+
const container = (_d = (_c = this.choices) === null || _c === void 0 ? void 0 : _c.containerOuter) === null || _d === void 0 ? void 0 : _d.element;
|
933
|
+
if (!dropdown || !container) {
|
934
|
+
return;
|
935
|
+
}
|
936
|
+
const containerPosition = container.getBoundingClientRect();
|
937
|
+
const isFlipped = container.classList.contains('is-flipped');
|
938
|
+
lodash_1.default.assign(dropdown.style, {
|
939
|
+
top: `${isFlipped ? containerPosition.top - dropdown.offsetHeight : containerPosition.top + containerPosition.height}px`,
|
940
|
+
left: `${containerPosition.left}px`,
|
941
|
+
width: `${containerPosition.width}px`,
|
942
|
+
position: 'fixed',
|
943
|
+
bottom: 'unset',
|
944
|
+
right: 'unset',
|
945
|
+
});
|
946
|
+
}
|
947
|
+
hasDataGridAncestor(comp) {
|
948
|
+
comp = comp || this;
|
949
|
+
if (comp.inDataGrid || comp.type === 'datagrid') {
|
950
|
+
return true;
|
951
|
+
}
|
952
|
+
else if (comp.parent) {
|
953
|
+
return this.hasDataGridAncestor(comp.parent);
|
954
|
+
}
|
955
|
+
else {
|
956
|
+
return false;
|
957
|
+
}
|
958
|
+
}
|
959
|
+
positionDropdown(scroll) {
|
960
|
+
var _a;
|
961
|
+
if (!this.shouldPositionDropdown || !this.choices || (!((_a = this.choices.dropdown) === null || _a === void 0 ? void 0 : _a.isActive) && scroll)) {
|
962
|
+
return;
|
963
|
+
}
|
964
|
+
this.setDropdownPosition();
|
965
|
+
this.itemsLoaded.then(() => {
|
966
|
+
this.setDropdownPosition();
|
967
|
+
});
|
968
|
+
}
|
900
969
|
get isLoadingAvailable() {
|
901
970
|
return !this.isScrollLoading && this.additionalResourcesAvailable;
|
902
971
|
}
|
@@ -1014,10 +1083,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
1014
1083
|
}
|
1015
1084
|
return added;
|
1016
1085
|
}
|
1017
|
-
getValueAsString(data) {
|
1086
|
+
getValueAsString(data, options) {
|
1018
1087
|
return (this.component.multiple && Array.isArray(data))
|
1019
|
-
? data.map(this.asString
|
1020
|
-
: this.asString(data);
|
1088
|
+
? data.map((v) => this.asString(v, options)).join(', ')
|
1089
|
+
: this.asString(data, options);
|
1021
1090
|
}
|
1022
1091
|
getValue() {
|
1023
1092
|
// If the widget isn't active.
|
@@ -1370,7 +1439,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1370
1439
|
}
|
1371
1440
|
return this.component.data.values.map(value => ({ label: value.label, value: String(this.normalizeSingleValue(value.value)) }));
|
1372
1441
|
}
|
1373
|
-
asString(value) {
|
1442
|
+
asString(value, options = {}) {
|
1374
1443
|
var _a;
|
1375
1444
|
value = value !== null && value !== void 0 ? value : this.getValue();
|
1376
1445
|
//need to convert values to strings to be able to compare values with available options that are strings
|
@@ -1421,9 +1490,15 @@ class SelectComponent extends ListComponent_1.default {
|
|
1421
1490
|
if (lodash_1.default.isString(value)) {
|
1422
1491
|
return value;
|
1423
1492
|
}
|
1493
|
+
const getTemplateValue = (v) => {
|
1494
|
+
const itemTemplate = this.itemTemplate(v);
|
1495
|
+
return options.csv && itemTemplate
|
1496
|
+
? (0, utils_1.unescapeHTML)(itemTemplate)
|
1497
|
+
: itemTemplate;
|
1498
|
+
};
|
1424
1499
|
if (Array.isArray(value)) {
|
1425
1500
|
const items = [];
|
1426
|
-
value.forEach(item => items.push(
|
1501
|
+
value.forEach(item => items.push(getTemplateValue(item)));
|
1427
1502
|
if (this.component.dataSrc === 'resource' && items.length > 0) {
|
1428
1503
|
return items.join(', ');
|
1429
1504
|
}
|
@@ -1438,7 +1513,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1438
1513
|
return JSON.stringify(value);
|
1439
1514
|
}
|
1440
1515
|
return !lodash_1.default.isNil(value)
|
1441
|
-
?
|
1516
|
+
? getTemplateValue(value)
|
1442
1517
|
: '-';
|
1443
1518
|
}
|
1444
1519
|
detach() {
|
@@ -150,6 +150,16 @@ class SurveyComponent extends Field_1.default {
|
|
150
150
|
result += '</tbody></table>';
|
151
151
|
return result;
|
152
152
|
}
|
153
|
+
if (lodash_1.default.isPlainObject(value)) {
|
154
|
+
const { values = [], questions = [] } = this.component;
|
155
|
+
return lodash_1.default.isEmpty(value)
|
156
|
+
? ''
|
157
|
+
: lodash_1.default.map(value, (v, q) => {
|
158
|
+
const valueLabel = lodash_1.default.get(lodash_1.default.find(values, val => lodash_1.default.isEqual(val.value, v)), 'label', v);
|
159
|
+
const questionLabel = lodash_1.default.get(lodash_1.default.find(questions, quest => lodash_1.default.isEqual(quest.value, q)), 'label', q);
|
160
|
+
return `${questionLabel}: ${valueLabel}`;
|
161
|
+
}).join('; ');
|
162
|
+
}
|
153
163
|
return super.getValueAsString(value, options);
|
154
164
|
}
|
155
165
|
}
|