@formio/js 5.0.0-dev.5908.0f1a78f → 5.0.0-dev.5909.49919b4

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.
@@ -20,6 +20,8 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
22
22
 
23
+ /*! @license DOMPurify 3.2.0 | (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.0/LICENSE */
24
+
23
25
  /*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
24
26
 
25
27
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -2516,7 +2516,7 @@ class Component extends Element_1.default {
2516
2516
  }
2517
2517
  return value;
2518
2518
  };
2519
- if (this.defaultMask) {
2519
+ if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
2520
2520
  if (Array.isArray(defaultValue)) {
2521
2521
  defaultValue = defaultValue.map(checkMask);
2522
2522
  }
@@ -3252,12 +3252,6 @@ class Component extends Element_1.default {
3252
3252
  return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
3253
3253
  }
3254
3254
  shouldSkipValidation(data, row, flags = {}) {
3255
- const { validateWhenHidden = false } = this.component || {};
3256
- const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
3257
- if (forceValidOnHidden) {
3258
- // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3259
- this._errors = [];
3260
- }
3261
3255
  const rules = [
3262
3256
  // Do not validate if the flags say not too.
3263
3257
  () => flags.noValidate,
@@ -3268,7 +3262,14 @@ class Component extends Element_1.default {
3268
3262
  // Check to see if we are editing and if so, check component persistence.
3269
3263
  () => this.isValueHidden(),
3270
3264
  // Force valid if component is hidden.
3271
- () => forceValidOnHidden
3265
+ () => {
3266
+ if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
3267
+ // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3268
+ this._errors = [];
3269
+ return true;
3270
+ }
3271
+ return false;
3272
+ }
3272
3273
  ];
3273
3274
  return rules.some(pred => pred());
3274
3275
  }
@@ -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 = parseFloat(input);
174
- if (!lodash_1.default.isNaN(value)) {
173
+ let value;
174
+ if (!lodash_1.default.isNaN(input)) {
175
175
  // Format scientific notation
176
- if (/e/i.test(String(value))) {
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 = String(value).replace('.', this.decimalSeparator);
186
+ value = parseFloat(input);
187
+ value = !lodash_1.default.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
181
188
  }
182
189
  }
183
190
  else {
@@ -159,7 +159,9 @@ class SignatureComponent extends Input_1.default {
159
159
  if (this.dataValue) {
160
160
  this.setDataToSigaturePad();
161
161
  }
162
- this.showCanvas(true);
162
+ if (!this.disabled) {
163
+ this.showCanvas(true);
164
+ }
163
165
  }
164
166
  }
165
167
  renderElement(value, index) {
@@ -2482,7 +2482,7 @@ export default class Component extends Element {
2482
2482
  }
2483
2483
  return value;
2484
2484
  };
2485
- if (this.defaultMask) {
2485
+ if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
2486
2486
  if (Array.isArray(defaultValue)) {
2487
2487
  defaultValue = defaultValue.map(checkMask);
2488
2488
  }
@@ -3214,12 +3214,6 @@ export default class Component extends Element {
3214
3214
  return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
3215
3215
  }
3216
3216
  shouldSkipValidation(data, row, flags = {}) {
3217
- const { validateWhenHidden = false } = this.component || {};
3218
- const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
3219
- if (forceValidOnHidden) {
3220
- // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3221
- this._errors = [];
3222
- }
3223
3217
  const rules = [
3224
3218
  // Do not validate if the flags say not too.
3225
3219
  () => flags.noValidate,
@@ -3230,7 +3224,14 @@ export default class Component extends Element {
3230
3224
  // Check to see if we are editing and if so, check component persistence.
3231
3225
  () => this.isValueHidden(),
3232
3226
  // Force valid if component is hidden.
3233
- () => forceValidOnHidden
3227
+ () => {
3228
+ if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
3229
+ // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3230
+ this._errors = [];
3231
+ return true;
3232
+ }
3233
+ return false;
3234
+ }
3234
3235
  ];
3235
3236
  return rules.some(pred => pred());
3236
3237
  }
@@ -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 = parseFloat(input);
172
- if (!_.isNaN(value)) {
171
+ let value;
172
+ if (!_.isNaN(input)) {
173
173
  // Format scientific notation
174
- if (/e/i.test(String(value))) {
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 = String(value).replace('.', this.decimalSeparator);
184
+ value = parseFloat(input);
185
+ value = !_.isNaN(value) ? String(value).replace('.', this.decimalSeparator) : null;
179
186
  }
180
187
  }
181
188
  else {
@@ -156,7 +156,9 @@ export default class SignatureComponent extends Input {
156
156
  if (this.dataValue) {
157
157
  this.setDataToSigaturePad();
158
158
  }
159
- this.showCanvas(true);
159
+ if (!this.disabled) {
160
+ this.showCanvas(true);
161
+ }
160
162
  }
161
163
  }
162
164
  renderElement(value, index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5908.0f1a78f",
3
+ "version": "5.0.0-dev.5909.49919b4",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -82,8 +82,8 @@
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
84
84
  "@formio/choices.js": "^10.2.1",
85
- "@formio/core": "v2.1.0-dev.174.9a3c6ec",
86
- "@formio/text-mask-addons": "^3.8.0-formio.3",
85
+ "@formio/core": "2.1.0-dev.191.8c609ab",
86
+ "@formio/text-mask-addons": "^3.8.0-formio.4",
87
87
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
88
88
  "abortcontroller-polyfill": "^1.7.5",
89
89
  "autocompleter": "^8.0.4",