@formio/js 5.0.0-rc.39 → 5.0.0-rc.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.builder.css +2 -2
- package/dist/formio.builder.min.css +1 -1
- 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.css +2 -2
- package/dist/formio.form.js +5335 -2376
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +23 -5
- package/dist/formio.full.css +2 -2
- package/dist/formio.full.js +5663 -2696
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +23 -5
- package/dist/formio.js +72 -62
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +105 -96
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -4
- package/lib/cjs/Element.js +1 -0
- package/lib/cjs/Embed.js +131 -131
- package/lib/cjs/Webform.js +36 -13
- package/lib/cjs/WebformBuilder.js +4 -2
- package/lib/cjs/Wizard.js +6 -1
- package/lib/cjs/components/_classes/component/Component.js +33 -22
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +8 -0
- package/lib/cjs/components/_classes/component/fixtures/comp5.js +2 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +2 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +2 -2
- package/lib/cjs/components/address/fixtures/comp3.js +1 -1
- package/lib/cjs/components/builder.js +0 -2
- package/lib/cjs/components/button/Button.js +7 -1
- package/lib/cjs/components/datagrid/DataGrid.js +16 -3
- package/lib/cjs/components/datagrid/fixtures/comp-with-allow-calculate-override.js +68 -0
- package/lib/cjs/components/datagrid/fixtures/comp6.js +1 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +5 -1
- package/lib/cjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.js +104 -0
- package/lib/cjs/components/editgrid/EditGrid.js +11 -4
- package/lib/cjs/components/editgrid/fixtures/formsWithEditGridAndConditions.js +923 -0
- package/lib/cjs/components/file/File.js +2 -2
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/cjs/components/html/HTML.js +11 -2
- package/lib/cjs/components/html/fixtures/index.js +1 -3
- package/lib/cjs/components/index.js +0 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.js +46 -46
- package/lib/cjs/components/select/Select.js +3 -1
- package/lib/cjs/components/select/fixtures/comp20.js +46 -0
- package/lib/cjs/components/select/fixtures/comp21.js +106 -0
- package/lib/cjs/components/select/fixtures/index.js +5 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/components/textfield/TextField.js +63 -3
- package/lib/cjs/providers/storage/s3.js +5 -3
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/cjs/providers/storage/url.js +19 -13
- package/lib/cjs/providers/storage/util.js +2 -2
- package/lib/cjs/templates/Templates.js +4 -4
- package/lib/cjs/translations/en.js +10 -6
- package/lib/cjs/utils/Evaluator.js +1 -1
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/cjs/utils/formUtils.js +3 -3
- package/lib/cjs/utils/utils.js +4 -19
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.js +1 -0
- package/lib/mjs/Embed.js +1 -2
- package/lib/mjs/FormBuilder.js +1 -2
- package/lib/mjs/Webform.js +36 -13
- package/lib/mjs/WebformBuilder.js +4 -2
- package/lib/mjs/Wizard.js +6 -1
- package/lib/mjs/builders/Builders.js +1 -2
- package/lib/mjs/components/Components.js +1 -2
- package/lib/mjs/components/_classes/component/Component.js +33 -24
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +8 -0
- package/lib/mjs/components/_classes/component/fixtures/comp5.js +2 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +2 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +2 -2
- package/lib/mjs/components/address/fixtures/comp3.js +1 -1
- package/lib/mjs/components/builder.js +0 -2
- package/lib/mjs/components/button/Button.js +7 -1
- package/lib/mjs/components/datagrid/DataGrid.js +15 -3
- package/lib/mjs/components/datagrid/fixtures/comp-with-allow-calculate-override.js +66 -0
- package/lib/mjs/components/datagrid/fixtures/comp6.js +1 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/mjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.js +102 -0
- package/lib/mjs/components/editgrid/EditGrid.js +11 -4
- package/lib/mjs/components/editgrid/fixtures/formsWithEditGridAndConditions.js +921 -0
- package/lib/mjs/components/file/File.js +2 -2
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/mjs/components/form/Form.js +1 -1
- package/lib/mjs/components/html/HTML.js +10 -2
- package/lib/mjs/components/html/fixtures/index.js +1 -2
- package/lib/mjs/components/index.js +0 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.js +32 -43
- package/lib/mjs/components/select/Select.js +3 -1
- package/lib/mjs/components/select/fixtures/comp20.js +44 -0
- package/lib/mjs/components/select/fixtures/comp21.js +104 -0
- package/lib/mjs/components/select/fixtures/index.js +3 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/components/textfield/TextField.js +62 -3
- package/lib/mjs/displays/Displays.js +1 -2
- package/lib/mjs/licenses/Licenses.js +1 -2
- package/lib/mjs/providers/Providers.js +1 -2
- package/lib/mjs/providers/storage/s3.js +5 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/mjs/providers/storage/url.js +19 -13
- package/lib/mjs/templates/Templates.js +1 -1
- package/lib/mjs/translations/en.js +10 -6
- package/lib/mjs/utils/Evaluator.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/formUtils.js +3 -3
- package/lib/mjs/utils/utils.js +2 -16
- package/lib/mjs/widgets/CalendarWidget.js +1 -1
- package/package.json +21 -20
- package/lib/cjs/components/html/fixtures/comp3.js +0 -31
- package/lib/cjs/components/resource/Resource.form.js +0 -16
- package/lib/cjs/components/resource/Resource.js +0 -39
- package/lib/cjs/components/resource/editForm/Resource.edit.display.js +0 -102
- package/lib/cjs/components/resource/fixtures/comp1.js +0 -30
- package/lib/cjs/components/resource/fixtures/comp2.js +0 -31
- package/lib/cjs/components/resource/fixtures/index.js +0 -10
- package/lib/mjs/components/html/fixtures/comp3.js +0 -29
- package/lib/mjs/components/resource/Resource.form.js +0 -10
- package/lib/mjs/components/resource/Resource.js +0 -33
- package/lib/mjs/components/resource/editForm/Resource.edit.display.js +0 -100
- package/lib/mjs/components/resource/fixtures/comp1.js +0 -28
- package/lib/mjs/components/resource/fixtures/comp2.js +0 -29
- package/lib/mjs/components/resource/fixtures/index.js +0 -3
@@ -580,8 +580,8 @@ class FileComponent extends Field_1.default {
|
|
580
580
|
}
|
581
581
|
valid = pattern.excludes.reduce((result, excludePattern) => {
|
582
582
|
const exclude = new RegExp(excludePattern, 'i');
|
583
|
-
return result && (lodash_1.default.isNil(file.type) ||
|
584
|
-
(lodash_1.default.isNil(file.name) ||
|
583
|
+
return result && (lodash_1.default.isNil(file.type) || exclude.test(file.type)) &&
|
584
|
+
(lodash_1.default.isNil(file.name) || exclude.test(file.name));
|
585
585
|
}, valid);
|
586
586
|
return valid;
|
587
587
|
}
|
@@ -189,7 +189,7 @@ exports.default = [
|
|
189
189
|
input: true,
|
190
190
|
key: 'fileNameTemplate',
|
191
191
|
label: 'File Name Template',
|
192
|
-
placeholder: '(optional) { {name} }-{ {guid} }
|
192
|
+
placeholder: '(optional) { {name} }-{ {guid} }',
|
193
193
|
tooltip: 'Specify template for name of uploaded file(s). Regular template variables are available (`data`, `component`, `user`, `value`, `moment` etc.), also `fileName`, `guid` variables are available. `guid` part must be present, if not found in template, will be added at the end.',
|
194
194
|
weight: 25
|
195
195
|
},
|
@@ -618,7 +618,7 @@ class FormComponent extends Component_1.default {
|
|
618
618
|
}
|
619
619
|
}
|
620
620
|
isEmpty(value = this.dataValue) {
|
621
|
-
return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value.data) && !value._id);
|
621
|
+
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));
|
622
622
|
}
|
623
623
|
areAllComponentsEmpty(data) {
|
624
624
|
let res = true;
|
@@ -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.
|
46
|
+
const content = this.component.content ? this.interpolate(this.component.content, {
|
47
47
|
metadata: submission.metadata || {},
|
48
48
|
submission: submission,
|
49
49
|
data: this.rootValue,
|
50
50
|
row: this.data
|
51
51
|
}) : '';
|
52
|
-
return content;
|
52
|
+
return this.sanitize(content, this.shouldSanitizeValue);
|
53
53
|
}
|
54
54
|
get singleTags() {
|
55
55
|
return ['br', 'img', 'hr'];
|
@@ -85,8 +85,17 @@ class HTMLComponent extends Component_1.default {
|
|
85
85
|
render() {
|
86
86
|
return super.render(this.renderContent());
|
87
87
|
}
|
88
|
+
get dataReady() {
|
89
|
+
var _a;
|
90
|
+
return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submissionReady) || Promise.resolve();
|
91
|
+
}
|
88
92
|
attach(element) {
|
89
93
|
this.loadRefs(element, { html: 'single' });
|
94
|
+
this.dataReady.then(() => {
|
95
|
+
if (this.element) {
|
96
|
+
this.setContent(this.elemet, this.content);
|
97
|
+
}
|
98
|
+
});
|
90
99
|
return super.attach(element);
|
91
100
|
}
|
92
101
|
}
|
@@ -3,10 +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.
|
6
|
+
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;
|
@@ -36,7 +36,6 @@ const Password_1 = __importDefault(require("./password/Password"));
|
|
36
36
|
const PhoneNumber_1 = __importDefault(require("./phonenumber/PhoneNumber"));
|
37
37
|
const Radio_1 = __importDefault(require("./radio/Radio"));
|
38
38
|
const ReCaptcha_1 = __importDefault(require("./recaptcha/ReCaptcha"));
|
39
|
-
const Resource_1 = __importDefault(require("./resource/Resource"));
|
40
39
|
const SelectBoxes_1 = __importDefault(require("./selectboxes/SelectBoxes"));
|
41
40
|
const Select_1 = __importDefault(require("./select/Select"));
|
42
41
|
const Signature_1 = __importDefault(require("./signature/Signature"));
|
@@ -85,7 +84,6 @@ exports.default = {
|
|
85
84
|
phoneNumber: PhoneNumber_1.default,
|
86
85
|
radio: Radio_1.default,
|
87
86
|
recaptcha: ReCaptcha_1.default,
|
88
|
-
resource: Resource_1.default,
|
89
87
|
select: Select_1.default,
|
90
88
|
selectboxes: SelectBoxes_1.default,
|
91
89
|
signature: Signature_1.default,
|
@@ -1,4 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
13
|
};
|
@@ -61,46 +70,42 @@ class ReCaptchaComponent extends Component_1.default {
|
|
61
70
|
return true;
|
62
71
|
}
|
63
72
|
verify(actionName) {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
this.recaptchaApiReady
|
76
|
-
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
74
|
+
const siteKey = (0, get_1.default)(this.root.form, 'settings.recaptcha.siteKey');
|
75
|
+
if (!siteKey) {
|
76
|
+
console.warn('There is no Site Key specified in settings in form JSON');
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
if (!this.recaptchaApiReady) {
|
80
|
+
const recaptchaApiScriptUrl = `https://www.google.com/recaptcha/api.js?render=${(0, get_1.default)(this.root.form, 'settings.recaptcha.siteKey')}`;
|
81
|
+
this.recaptchaApiReady = Formio_1.Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
|
82
|
+
}
|
83
|
+
try {
|
84
|
+
yield this.recaptchaApiReady;
|
85
|
+
this.recaptchaVerifiedPromise = new Promise((resolve, reject) => {
|
77
86
|
if (!this.isLoading) {
|
78
87
|
this.isLoading = true;
|
79
|
-
grecaptcha.ready((0, debounce_1.default)(() => {
|
80
|
-
|
81
|
-
.execute(siteKey, {
|
82
|
-
|
83
|
-
|
84
|
-
.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
});
|
90
|
-
})
|
91
|
-
.catch(() => {
|
88
|
+
grecaptcha.ready((0, debounce_1.default)(() => __awaiter(this, void 0, void 0, function* () {
|
89
|
+
try {
|
90
|
+
const token = yield grecaptcha.execute(siteKey, { action: actionName });
|
91
|
+
const verificationResult = yield this.sendVerificationRequest(token);
|
92
|
+
this.recaptchaResult = Object.assign(Object.assign({}, verificationResult), { token });
|
93
|
+
this.updateValue(this.recaptchaResult);
|
94
|
+
this.isLoading = false;
|
95
|
+
return resolve(verificationResult);
|
96
|
+
}
|
97
|
+
catch (err) {
|
92
98
|
this.isLoading = false;
|
93
|
-
|
94
|
-
|
99
|
+
reject(err);
|
100
|
+
}
|
101
|
+
}), 1000));
|
95
102
|
}
|
96
|
-
})
|
97
|
-
.catch(() => {
|
98
|
-
return reject();
|
99
103
|
});
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
+
}
|
105
|
+
catch (err) {
|
106
|
+
this.loading = false;
|
107
|
+
}
|
108
|
+
});
|
104
109
|
}
|
105
110
|
beforeSubmit() {
|
106
111
|
if (this.recaptchaVerifiedPromise) {
|
@@ -110,32 +115,27 @@ class ReCaptchaComponent extends Component_1.default {
|
|
110
115
|
return super.beforeSubmit();
|
111
116
|
}
|
112
117
|
sendVerificationRequest(token) {
|
113
|
-
return Formio_1.Formio.makeStaticRequest(`${Formio_1.Formio.projectUrl}/recaptcha?recaptchaToken=${token}`)
|
114
|
-
.then((verificationResult) => ({ verificationResult, token }));
|
118
|
+
return Formio_1.Formio.makeStaticRequest(`${Formio_1.Formio.projectUrl}/recaptcha?recaptchaToken=${token}`);
|
115
119
|
}
|
116
120
|
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
117
121
|
data = data || this.rootValue;
|
118
122
|
row = row || this.data;
|
119
123
|
const { async = false } = options;
|
120
|
-
// Verification could be async only
|
124
|
+
// Verification could be async only (which for now is only the case for server-side validation)
|
121
125
|
if (!async) {
|
122
126
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|
123
127
|
}
|
124
128
|
const componentData = row[this.component.key];
|
125
129
|
if (!componentData || !componentData.token) {
|
126
|
-
this.setCustomValidity('
|
130
|
+
this.setCustomValidity(this.t('reCaptchaTokenNotSpecifiedError'));
|
127
131
|
return Promise.resolve(false);
|
128
132
|
}
|
129
133
|
if (!componentData.success) {
|
130
|
-
this.setCustomValidity('
|
134
|
+
this.setCustomValidity(this.t('reCaptchaTokenValidationError'));
|
131
135
|
return Promise.resolve(false);
|
132
136
|
}
|
133
|
-
|
134
|
-
|
135
|
-
.catch((err) => {
|
136
|
-
this.setCustomValidity(err.message || err);
|
137
|
-
return false;
|
138
|
-
});
|
137
|
+
// Any further validation will 100% not run on the client
|
138
|
+
return Promise.resolve(true);
|
139
139
|
}
|
140
140
|
normalizeValue(newValue) {
|
141
141
|
// If a recaptcha result has already been established, then do not allow it to be reset.
|
@@ -348,6 +348,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
348
348
|
/* eslint-disable max-statements */
|
349
349
|
setItems(items, fromSearch) {
|
350
350
|
var _a, _b;
|
351
|
+
this.selectItems = items;
|
351
352
|
// If the items is a string, then parse as JSON.
|
352
353
|
if (typeof items == 'string') {
|
353
354
|
try {
|
@@ -788,7 +789,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
788
789
|
this.addFocusBlurEvents(input);
|
789
790
|
this.triggerUpdate(null, true);
|
790
791
|
if (this.visible) {
|
791
|
-
this.setItems(this.
|
792
|
+
this.setItems(this.selectItems || []);
|
792
793
|
}
|
793
794
|
this.focusableElement = input;
|
794
795
|
if (this.component.dataSrc === 'custom') {
|
@@ -1164,6 +1165,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1164
1165
|
templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
|
1165
1166
|
});
|
1166
1167
|
}
|
1168
|
+
templateData[value] = this.templateData[value];
|
1167
1169
|
}
|
1168
1170
|
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
1169
1171
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
_id: '659fa81f4a40147c0ffb949b',
|
5
|
+
title: '7724',
|
6
|
+
name: '7724',
|
7
|
+
path: '7724',
|
8
|
+
type: 'form',
|
9
|
+
display: 'form',
|
10
|
+
components: [
|
11
|
+
{
|
12
|
+
label: 'Select',
|
13
|
+
widget: 'choicesjs',
|
14
|
+
tableView: true,
|
15
|
+
multiple: true,
|
16
|
+
data: {
|
17
|
+
values: [
|
18
|
+
{
|
19
|
+
label: 'Apple',
|
20
|
+
value: 'apple'
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: 'Orange',
|
24
|
+
value: 'orange'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
label: 'Pear',
|
28
|
+
value: 'pear'
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
key: 'select',
|
33
|
+
type: 'select',
|
34
|
+
input: true
|
35
|
+
},
|
36
|
+
{
|
37
|
+
type: 'button',
|
38
|
+
label: 'Submit',
|
39
|
+
key: 'submit',
|
40
|
+
disableOnInvalid: true,
|
41
|
+
input: true,
|
42
|
+
tableView: false
|
43
|
+
}
|
44
|
+
],
|
45
|
+
project: '63cead09be0090345b109e22'
|
46
|
+
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
title: 'FIO-7632',
|
5
|
+
name: 'fio7632',
|
6
|
+
path: 'fio7632',
|
7
|
+
type: 'form',
|
8
|
+
display: 'form',
|
9
|
+
components: [
|
10
|
+
{
|
11
|
+
collapsible: false,
|
12
|
+
key: 'panel',
|
13
|
+
type: 'panel',
|
14
|
+
label: 'Panel',
|
15
|
+
input: false,
|
16
|
+
tableView: false,
|
17
|
+
components: [
|
18
|
+
{
|
19
|
+
label: 'Animals',
|
20
|
+
widget: 'html5',
|
21
|
+
tableView: true,
|
22
|
+
data: {
|
23
|
+
values: [
|
24
|
+
{
|
25
|
+
label: 'Dog',
|
26
|
+
value: 'dog',
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: 'Cat',
|
30
|
+
value: 'cat',
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: 'Horse',
|
34
|
+
value: 'horse',
|
35
|
+
},
|
36
|
+
],
|
37
|
+
},
|
38
|
+
key: 'animals',
|
39
|
+
type: 'select',
|
40
|
+
input: true,
|
41
|
+
},
|
42
|
+
{
|
43
|
+
label: 'Checkbox',
|
44
|
+
tableView: false,
|
45
|
+
key: 'checkbox',
|
46
|
+
type: 'checkbox',
|
47
|
+
input: true,
|
48
|
+
},
|
49
|
+
{
|
50
|
+
label: 'Animals2',
|
51
|
+
widget: 'html5',
|
52
|
+
tableView: true,
|
53
|
+
data: {
|
54
|
+
values: [
|
55
|
+
{
|
56
|
+
label: 'Dog',
|
57
|
+
value: 'dog',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
label: 'Cat',
|
61
|
+
value: 'cat',
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: 'Horse',
|
65
|
+
value: 'horse',
|
66
|
+
},
|
67
|
+
],
|
68
|
+
},
|
69
|
+
calculateValue: 'if (data.checkbox === true) {\n value = data.animals;\n}',
|
70
|
+
key: 'animals2',
|
71
|
+
logic: [
|
72
|
+
{
|
73
|
+
name: 'disable',
|
74
|
+
trigger: {
|
75
|
+
type: 'javascript',
|
76
|
+
javascript: 'result = row.checkbox === true;',
|
77
|
+
},
|
78
|
+
actions: [
|
79
|
+
{
|
80
|
+
name: 'disable',
|
81
|
+
type: 'property',
|
82
|
+
property: {
|
83
|
+
label: 'Disabled',
|
84
|
+
value: 'disabled',
|
85
|
+
type: 'boolean',
|
86
|
+
},
|
87
|
+
state: true,
|
88
|
+
},
|
89
|
+
],
|
90
|
+
},
|
91
|
+
],
|
92
|
+
type: 'select',
|
93
|
+
input: true,
|
94
|
+
},
|
95
|
+
{
|
96
|
+
type: 'button',
|
97
|
+
label: 'Submit',
|
98
|
+
key: 'submit',
|
99
|
+
disableOnInvalid: true,
|
100
|
+
input: true,
|
101
|
+
tableView: false,
|
102
|
+
},
|
103
|
+
],
|
104
|
+
},
|
105
|
+
],
|
106
|
+
};
|
@@ -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.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
|
6
|
+
exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = 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"));
|
@@ -43,3 +43,7 @@ const comp18_1 = __importDefault(require("./comp18"));
|
|
43
43
|
exports.comp18 = comp18_1.default;
|
44
44
|
const comp19_1 = __importDefault(require("./comp19"));
|
45
45
|
exports.comp19 = comp19_1.default;
|
46
|
+
const comp20_1 = __importDefault(require("./comp20"));
|
47
|
+
exports.comp20 = comp20_1.default;
|
48
|
+
const comp21_1 = __importDefault(require("./comp21"));
|
49
|
+
exports.comp21 = comp21_1.default;
|
@@ -34,7 +34,7 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
34
34
|
type: 'select',
|
35
35
|
dataSrc: 'custom',
|
36
36
|
valueProperty: 'value',
|
37
|
-
|
37
|
+
dataType: 'string',
|
38
38
|
data: {
|
39
39
|
custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
|
40
40
|
},
|
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
30
30
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
31
|
+
const inputmask_1 = __importDefault(require("inputmask"));
|
31
32
|
const FormioUtils = __importStar(require("../../utils/utils"));
|
32
33
|
const lodash_1 = __importDefault(require("lodash"));
|
33
34
|
class TextFieldComponent extends Input_1.default {
|
@@ -164,8 +165,14 @@ class TextFieldComponent extends Input_1.default {
|
|
164
165
|
const maskInput = this.refs.select ? this.refs.select[index] : null;
|
165
166
|
const mask = this.getMaskPattern(value.maskName);
|
166
167
|
if (textInput && maskInput && mask) {
|
167
|
-
|
168
|
-
|
168
|
+
if (textInput.inputmask) {
|
169
|
+
this.setInputMask(textInput, mask);
|
170
|
+
textInput.inputmask.setValue(textValue);
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
const placeholderChar = this.placeholderChar;
|
174
|
+
textInput.value = (0, vanilla_text_mask_1.conformToMask)(textValue, FormioUtils.getInputMask(mask), { placeholderChar }).conformedValue;
|
175
|
+
}
|
169
176
|
maskInput.value = value.maskName;
|
170
177
|
}
|
171
178
|
else {
|
@@ -197,7 +204,10 @@ class TextFieldComponent extends Input_1.default {
|
|
197
204
|
if (displayMask && !valueMask) {
|
198
205
|
return this.unmaskValue(value, displayMask);
|
199
206
|
}
|
200
|
-
if (
|
207
|
+
if (displayMask && displayMask !== valueMask) {
|
208
|
+
return inputmask_1.default.format(inputmask_1.default.unmask(value, displayMask), valueMask);
|
209
|
+
}
|
210
|
+
if (((_a = this.refs.valueMaskInput) === null || _a === void 0 ? void 0 : _a.mask) && this.refs.valueMaskInput.mask.textMaskInputElement) {
|
201
211
|
this.refs.valueMaskInput.mask.textMaskInputElement.update(value);
|
202
212
|
return (_b = this.refs.valueMaskInput) === null || _b === void 0 ? void 0 : _b.value;
|
203
213
|
}
|
@@ -210,6 +220,56 @@ class TextFieldComponent extends Input_1.default {
|
|
210
220
|
maskName: maskInput ? maskInput.value : undefined
|
211
221
|
};
|
212
222
|
}
|
223
|
+
checkInputMaskValue(inputMask) {
|
224
|
+
let valid = true;
|
225
|
+
const maskValues = lodash_1.default.values(inputMask.split('').reduce((acc, el, i, mask) => {
|
226
|
+
var _a;
|
227
|
+
if (el === '{' || el === '}') {
|
228
|
+
if (mask[i + 1] === '{' || mask[i + 1] === '}') {
|
229
|
+
valid = false;
|
230
|
+
}
|
231
|
+
acc[el] = ((_a = acc[el]) !== null && _a !== void 0 ? _a : 0) + 1;
|
232
|
+
}
|
233
|
+
return acc;
|
234
|
+
}, {}));
|
235
|
+
if (maskValues[0] !== maskValues[1]) {
|
236
|
+
valid = false;
|
237
|
+
}
|
238
|
+
return valid;
|
239
|
+
}
|
240
|
+
setInputMask(input, inputMask, usePlaceholder) {
|
241
|
+
if (this.type !== 'textfield') {
|
242
|
+
super.setInputMask(input, inputMask, usePlaceholder);
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
inputMask = inputMask || this.component.displayMask || this.component.inputMask;
|
246
|
+
const mask = FormioUtils.getInputMask(inputMask, this.placeholderChar);
|
247
|
+
this.defaultMask = mask;
|
248
|
+
if (input && inputMask) {
|
249
|
+
try {
|
250
|
+
//remove previous mask
|
251
|
+
if (input.mask) {
|
252
|
+
input.mask.remove();
|
253
|
+
}
|
254
|
+
if (this.checkInputMaskValue(inputMask)) {
|
255
|
+
input.mask = new inputmask_1.default(inputMask, {
|
256
|
+
clearMaskOnLostFocus: !!this.component.placeholder,
|
257
|
+
showMaskOnHover: !this.component.placeholder,
|
258
|
+
placeholder: this.placeholderChar || '',
|
259
|
+
}).mask(input);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
catch (e) {
|
263
|
+
console.warn(e);
|
264
|
+
}
|
265
|
+
if (mask.numeric) {
|
266
|
+
input.setAttribute('pattern', '\\d*');
|
267
|
+
}
|
268
|
+
if (this.component.placeholder) {
|
269
|
+
input.setAttribute('placeholder', this.component.placeholder);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
}
|
213
273
|
isHtmlRenderMode() {
|
214
274
|
return super.isHtmlRenderMode() ||
|
215
275
|
((this.options.readOnly || this.disabled) &&
|
@@ -46,9 +46,11 @@ function s3(formio) {
|
|
46
46
|
else {
|
47
47
|
xhr.openAndSetHeaders('PUT', response.signed);
|
48
48
|
xhr.setRequestHeader('Content-Type', file.type);
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
if (response.data.headers) {
|
50
|
+
Object.keys(response.data.headers).forEach((key) => {
|
51
|
+
xhr.setRequestHeader(key, response.data.headers[key]);
|
52
|
+
});
|
53
|
+
}
|
52
54
|
return file;
|
53
55
|
}
|
54
56
|
}
|
@@ -1,6 +1,20 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
function url(formio) {
|
4
|
+
function setOptions(options, xhr) {
|
5
|
+
const parsedOptions = typeof options === 'string' ? JSON.parse(options) : options;
|
6
|
+
for (const prop in parsedOptions) {
|
7
|
+
if (prop === 'headers') {
|
8
|
+
const headers = parsedOptions['headers'];
|
9
|
+
for (const header in headers) {
|
10
|
+
xhr.setRequestHeader(header, headers[header]);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
else {
|
14
|
+
xhr[prop] = parsedOptions[prop];
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
4
18
|
const xhrRequest = (url, name, query, data, options, progressCallback, abortCallback) => {
|
5
19
|
return new Promise((resolve, reject) => {
|
6
20
|
const xhr = new XMLHttpRequest();
|
@@ -59,18 +73,7 @@ function url(formio) {
|
|
59
73
|
}
|
60
74
|
//Overrides previous request props
|
61
75
|
if (options) {
|
62
|
-
|
63
|
-
for (const prop in parsedOptions) {
|
64
|
-
if (prop === 'headers') {
|
65
|
-
const headers = parsedOptions['headers'];
|
66
|
-
for (const header in headers) {
|
67
|
-
xhr.setRequestHeader(header, headers[header]);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
xhr[prop] = parsedOptions[prop];
|
72
|
-
}
|
73
|
-
}
|
76
|
+
setOptions(options, xhr);
|
74
77
|
}
|
75
78
|
xhr.send(json ? data : fd);
|
76
79
|
});
|
@@ -111,7 +114,7 @@ function url(formio) {
|
|
111
114
|
return uploadRequest();
|
112
115
|
}
|
113
116
|
},
|
114
|
-
deleteFile(fileInfo) {
|
117
|
+
deleteFile(fileInfo, options) {
|
115
118
|
return new Promise((resolve, reject) => {
|
116
119
|
const xhr = new XMLHttpRequest();
|
117
120
|
xhr.open('DELETE', fileInfo.url, true);
|
@@ -123,6 +126,9 @@ function url(formio) {
|
|
123
126
|
reject(xhr.response || 'Unable to delete file');
|
124
127
|
}
|
125
128
|
};
|
129
|
+
if (options) {
|
130
|
+
setOptions(options, xhr);
|
131
|
+
}
|
126
132
|
xhr.send(null);
|
127
133
|
});
|
128
134
|
},
|
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.withRetries = void 0;
|
13
|
-
function withRetries(
|
14
|
-
return __awaiter(this,
|
13
|
+
function withRetries(fn_1, args_1) {
|
14
|
+
return __awaiter(this, arguments, void 0, function* (fn, args, retries = 3, err = null) {
|
15
15
|
if (!retries) {
|
16
16
|
throw new Error(err);
|
17
17
|
}
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const index_1 = __importDefault(require("./index"));
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
exports.default =
|
7
|
+
const experimental_1 = require("@formio/core/experimental");
|
8
|
+
experimental_1.Template.addTemplates(index_1.default);
|
9
|
+
experimental_1.Template.defaultTemplates = index_1.default.bootstrap;
|
10
|
+
exports.default = experimental_1.Template;
|