@formio/js 5.1.0 → 5.1.1-rc.1
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.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 +529 -529
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +529 -529
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- 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 +4 -4
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/Webform.js +4 -2
- package/lib/cjs/components/_classes/component/Component.js +1 -1
- package/lib/cjs/components/number/Number.js +11 -4
- package/lib/cjs/components/radio/Radio.js +10 -0
- package/lib/cjs/components/select/Select.js +2 -2
- package/lib/cjs/components/signature/Signature.js +3 -1
- package/lib/cjs/utils/utils.js +2 -1
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/Webform.js +4 -2
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/number/Number.js +11 -4
- package/lib/mjs/components/radio/Radio.js +10 -0
- package/lib/mjs/components/select/Select.js +2 -2
- package/lib/mjs/components/signature/Signature.js +3 -1
- package/lib/mjs/utils/utils.js +2 -1
- package/package.json +3 -3
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.1.
|
23
|
+
/*! formiojs v5.1.1-rc.1 | https://unpkg.com/formiojs@5.1.1-rc.1/LICENSE.txt */
|
24
24
|
|
25
25
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
26
26
|
|
package/lib/cjs/Embed.js
CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
|
|
418
418
|
_a._formioReady = ready;
|
419
419
|
_a._formioReadyReject = reject;
|
420
420
|
});
|
421
|
-
Formio.version = '5.1.
|
421
|
+
Formio.version = '5.1.1-rc.1';
|
422
422
|
// Create a report.
|
423
423
|
Formio.Report = {
|
424
424
|
create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
package/lib/cjs/Formio.js
CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
|
|
11
11
|
const providers_1 = __importDefault(require("./providers"));
|
12
12
|
sdk_1.Formio.cdn = new CDN_1.default();
|
13
13
|
sdk_1.Formio.Providers = providers_1.default;
|
14
|
-
sdk_1.Formio.version = '5.1.
|
14
|
+
sdk_1.Formio.version = '5.1.1-rc.1';
|
15
15
|
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
16
16
|
const isNil = (val) => val === null || val === undefined;
|
17
17
|
sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
package/lib/cjs/Webform.js
CHANGED
@@ -650,8 +650,10 @@ class Webform extends NestedDataComponent_1.default {
|
|
650
650
|
this.initialized = false;
|
651
651
|
const rebuild = this.rebuild() || Promise.resolve();
|
652
652
|
return rebuild.then(() => {
|
653
|
-
this.emit(
|
654
|
-
this.
|
653
|
+
this.emit('formLoad', form);
|
654
|
+
if (!this.options.server) {
|
655
|
+
this.triggerCaptcha();
|
656
|
+
}
|
655
657
|
// Make sure to trigger onChange after a render event occurs to speed up form rendering.
|
656
658
|
setTimeout(() => {
|
657
659
|
this.onChange(flags);
|
@@ -2605,7 +2605,7 @@ class Component extends Element_1.default {
|
|
2605
2605
|
}
|
2606
2606
|
return value;
|
2607
2607
|
};
|
2608
|
-
if (this.defaultMask) {
|
2608
|
+
if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
|
2609
2609
|
if (Array.isArray(defaultValue)) {
|
2610
2610
|
defaultValue = defaultValue.map(checkMask);
|
2611
2611
|
}
|
@@ -170,14 +170,21 @@ class NumberComponent extends Input_1.default {
|
|
170
170
|
if (typeof input === 'string') {
|
171
171
|
input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
|
172
172
|
}
|
173
|
-
let value
|
174
|
-
if (!lodash_1.default.isNaN(
|
173
|
+
let value;
|
174
|
+
if (!lodash_1.default.isNaN(input)) {
|
175
175
|
// Format scientific notation
|
176
|
-
if (/
|
176
|
+
if (/[0-9]+[eE]/.test(String(input))) {
|
177
|
+
// Convert to exponential notation will depend on the decimal limit set in the component
|
178
|
+
// Example: 1.23e-5 will be converted to 1.23e-5 if decimal limit is set to 2
|
179
|
+
// Example: 1.23e5 will be converted to 1.23e+5 if decimal limit is set to 2
|
180
|
+
// if decimal limit is 3, 1.23e5 will be converted to 1.230e+5
|
181
|
+
// if decimal limit is not set, 1.23e5 will be converted to 1.23000000000000000000e+5
|
182
|
+
value = parseFloat(input);
|
177
183
|
value = value.toExponential(this.decimalLimit);
|
178
184
|
}
|
179
185
|
else {
|
180
|
-
value =
|
186
|
+
value = parseFloat(input);
|
187
|
+
value = !lodash_1.default.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
|
181
188
|
}
|
182
189
|
}
|
183
190
|
else {
|
@@ -293,6 +293,16 @@ class RadioComponent extends ListComponent_1.default {
|
|
293
293
|
if (method.toUpperCase() === 'GET') {
|
294
294
|
body = null;
|
295
295
|
}
|
296
|
+
const limit = this.component.limit || 100;
|
297
|
+
const skip = this.isScrollLoading ? this.selectOptions.length : 0;
|
298
|
+
// Allow for url interpolation.
|
299
|
+
url = this.sanitize(this.interpolate(url, {
|
300
|
+
formioBase: Formio_1.Formio.getBaseUrl(),
|
301
|
+
search,
|
302
|
+
limit,
|
303
|
+
skip,
|
304
|
+
page: Math.abs(Math.floor(skip / limit))
|
305
|
+
}), this.shouldSanitizeValue);
|
296
306
|
// Set ignoreCache if it is
|
297
307
|
options.ignoreCache = this.component.ignoreCache;
|
298
308
|
// Make the request.
|
@@ -530,13 +530,13 @@ class SelectComponent extends ListComponent_1.default {
|
|
530
530
|
skip,
|
531
531
|
};
|
532
532
|
// Allow for url interpolation.
|
533
|
-
url = this.interpolate(url, {
|
533
|
+
url = this.sanitize(this.interpolate(url, {
|
534
534
|
formioBase: Formio_1.Formio.getBaseUrl(),
|
535
535
|
search,
|
536
536
|
limit,
|
537
537
|
skip,
|
538
538
|
page: Math.abs(Math.floor(skip / limit))
|
539
|
-
});
|
539
|
+
}), this.shouldSanitizeValue);
|
540
540
|
// Add search capability.
|
541
541
|
if (this.component.searchField && search) {
|
542
542
|
const searchValue = Array.isArray(search)
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -34,6 +34,7 @@ const Evaluator_1 = require("./Evaluator");
|
|
34
34
|
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
35
35
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
36
36
|
exports.ConditionOperators = conditionOperators_1.default;
|
37
|
+
const core_1 = require("@formio/core");
|
37
38
|
const interpolate = Evaluator_1.Evaluator.interpolate;
|
38
39
|
exports.interpolate = interpolate;
|
39
40
|
__exportStar(require("./formUtils"), exports);
|
@@ -271,7 +272,7 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
271
272
|
default:
|
272
273
|
result = lodash_1.default.every(conditionsResult.flat(), res => !!res);
|
273
274
|
}
|
274
|
-
return show ? result : !result;
|
275
|
+
return (0, core_1.convertShowToBoolean)(show) ? result : !result;
|
275
276
|
}
|
276
277
|
}
|
277
278
|
exports.checkSimpleConditional = checkSimpleConditional;
|
package/lib/mjs/Embed.js
CHANGED
@@ -14,7 +14,7 @@ export class Formio {
|
|
14
14
|
Formio._formioReady = ready;
|
15
15
|
Formio._formioReadyReject = reject;
|
16
16
|
});
|
17
|
-
static version = '5.1.
|
17
|
+
static version = '5.1.1-rc.1';
|
18
18
|
static setLicense(license, norecurse = false) {
|
19
19
|
Formio.license = license;
|
20
20
|
if (!norecurse && Formio.FormioClass) {
|
package/lib/mjs/Formio.js
CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
|
|
4
4
|
import Providers from './providers';
|
5
5
|
FormioCore.cdn = new CDN();
|
6
6
|
FormioCore.Providers = Providers;
|
7
|
-
FormioCore.version = '5.1.
|
7
|
+
FormioCore.version = '5.1.1-rc.1';
|
8
8
|
CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
9
9
|
const isNil = (val) => val === null || val === undefined;
|
10
10
|
FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
package/lib/mjs/Webform.js
CHANGED
@@ -648,8 +648,10 @@ export default class Webform extends NestedDataComponent {
|
|
648
648
|
this.initialized = false;
|
649
649
|
const rebuild = this.rebuild() || Promise.resolve();
|
650
650
|
return rebuild.then(() => {
|
651
|
-
this.emit(
|
652
|
-
this.
|
651
|
+
this.emit('formLoad', form);
|
652
|
+
if (!this.options.server) {
|
653
|
+
this.triggerCaptcha();
|
654
|
+
}
|
653
655
|
// Make sure to trigger onChange after a render event occurs to speed up form rendering.
|
654
656
|
setTimeout(() => {
|
655
657
|
this.onChange(flags);
|
@@ -2585,7 +2585,7 @@ export default class Component extends Element {
|
|
2585
2585
|
}
|
2586
2586
|
return value;
|
2587
2587
|
};
|
2588
|
-
if (this.defaultMask) {
|
2588
|
+
if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
|
2589
2589
|
if (Array.isArray(defaultValue)) {
|
2590
2590
|
defaultValue = defaultValue.map(checkMask);
|
2591
2591
|
}
|
@@ -168,14 +168,21 @@ export default class NumberComponent extends Input {
|
|
168
168
|
if (typeof input === 'string') {
|
169
169
|
input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
|
170
170
|
}
|
171
|
-
let value
|
172
|
-
if (!_.isNaN(
|
171
|
+
let value;
|
172
|
+
if (!_.isNaN(input)) {
|
173
173
|
// Format scientific notation
|
174
|
-
if (/
|
174
|
+
if (/[0-9]+[eE]/.test(String(input))) {
|
175
|
+
// Convert to exponential notation will depend on the decimal limit set in the component
|
176
|
+
// Example: 1.23e-5 will be converted to 1.23e-5 if decimal limit is set to 2
|
177
|
+
// Example: 1.23e5 will be converted to 1.23e+5 if decimal limit is set to 2
|
178
|
+
// if decimal limit is 3, 1.23e5 will be converted to 1.230e+5
|
179
|
+
// if decimal limit is not set, 1.23e5 will be converted to 1.23000000000000000000e+5
|
180
|
+
value = parseFloat(input);
|
175
181
|
value = value.toExponential(this.decimalLimit);
|
176
182
|
}
|
177
183
|
else {
|
178
|
-
value =
|
184
|
+
value = parseFloat(input);
|
185
|
+
value = !_.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
|
179
186
|
}
|
180
187
|
}
|
181
188
|
else {
|
@@ -293,6 +293,16 @@ export default class RadioComponent extends ListComponent {
|
|
293
293
|
if (method.toUpperCase() === 'GET') {
|
294
294
|
body = null;
|
295
295
|
}
|
296
|
+
const limit = this.component.limit || 100;
|
297
|
+
const skip = this.isScrollLoading ? this.selectOptions.length : 0;
|
298
|
+
// Allow for url interpolation.
|
299
|
+
url = this.sanitize(this.interpolate(url, {
|
300
|
+
formioBase: Formio.getBaseUrl(),
|
301
|
+
search,
|
302
|
+
limit,
|
303
|
+
skip,
|
304
|
+
page: Math.abs(Math.floor(skip / limit))
|
305
|
+
}), this.shouldSanitizeValue);
|
296
306
|
// Set ignoreCache if it is
|
297
307
|
options.ignoreCache = this.component.ignoreCache;
|
298
308
|
// Make the request.
|
@@ -532,13 +532,13 @@ export default class SelectComponent extends ListComponent {
|
|
532
532
|
skip,
|
533
533
|
};
|
534
534
|
// Allow for url interpolation.
|
535
|
-
url = this.interpolate(url, {
|
535
|
+
url = this.sanitize(this.interpolate(url, {
|
536
536
|
formioBase: Formio.getBaseUrl(),
|
537
537
|
search,
|
538
538
|
limit,
|
539
539
|
skip,
|
540
540
|
page: Math.abs(Math.floor(skip / limit))
|
541
|
-
});
|
541
|
+
}), this.shouldSanitizeValue);
|
542
542
|
// Add search capability.
|
543
543
|
if (this.component.searchField && search) {
|
544
544
|
const searchValue = Array.isArray(search)
|
@@ -156,7 +156,9 @@ export default class SignatureComponent extends Input {
|
|
156
156
|
if (this.dataValue) {
|
157
157
|
this.setDataToSigaturePad();
|
158
158
|
}
|
159
|
-
this.
|
159
|
+
if (!this.disabled) {
|
160
|
+
this.showCanvas(true);
|
161
|
+
}
|
160
162
|
}
|
161
163
|
}
|
162
164
|
renderElement(value, index) {
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -8,6 +8,7 @@ import dompurify from 'dompurify';
|
|
8
8
|
import { getValue } from './formUtils';
|
9
9
|
import { Evaluator } from './Evaluator';
|
10
10
|
import ConditionOperators from './conditionOperators';
|
11
|
+
import { convertShowToBoolean } from '@formio/core';
|
11
12
|
const interpolate = Evaluator.interpolate;
|
12
13
|
export * from './formUtils';
|
13
14
|
// Configure JsonLogic
|
@@ -236,7 +237,7 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
236
237
|
default:
|
237
238
|
result = _.every(conditionsResult.flat(), res => !!res);
|
238
239
|
}
|
239
|
-
return show ? result : !result;
|
240
|
+
return convertShowToBoolean(show) ? result : !result;
|
240
241
|
}
|
241
242
|
}
|
242
243
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.
|
3
|
+
"version": "5.1.1-rc.1",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -79,9 +79,9 @@
|
|
79
79
|
},
|
80
80
|
"homepage": "https://github.com/formio/formio.js#readme",
|
81
81
|
"dependencies": {
|
82
|
-
"@formio/bootstrap": "3.1.
|
82
|
+
"@formio/bootstrap": "3.1.1-rc.1",
|
83
83
|
"@formio/choices.js": "^10.2.1",
|
84
|
-
"@formio/core": "2.4.
|
84
|
+
"@formio/core": "2.4.1-rc.1",
|
85
85
|
"@formio/text-mask-addons": "^3.8.0-formio.4",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|