@formio/js 5.0.0-dev.5796.ee2613b → 5.0.0-dev.5798.beb3cc0

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.
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * dist/inputmask
3
3
  * https://github.com/RobinHerbots/Inputmask
4
- * Copyright (c) 2010 - 2023 Robin Herbots
4
+ * Copyright (c) 2010 - 2024 Robin Herbots
5
5
  * Licensed under the MIT license
6
- * Version: 5.0.8
6
+ * Version: 5.0.9
7
7
  */
8
8
 
9
9
  /*!
@@ -18,12 +18,12 @@
18
18
  * MIT licensed
19
19
  */
20
20
 
21
- /*! @license DOMPurify 3.1.5 | (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.5/LICENSE */
22
-
23
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 */
24
22
 
25
23
  /*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
26
24
 
25
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
+
27
27
  /**
28
28
  * @license
29
29
  * Lodash <https://lodash.com/>
@@ -1,4 +1,12 @@
1
1
  export default class Multivalue extends Field {
2
+ /**
3
+ * Normalize values coming into updateValue.
4
+ * @param {*} value - The value to normalize before setting.
5
+ * @param {Object} flags - Flags to use when normalizing the value.
6
+ * @param {*} emptyValue - The empty value for the field.
7
+ * @returns {*} - The normalized value.
8
+ */
9
+ normalizeValue(value: any, flags?: Object, emptyValue?: any): any;
2
10
  get addAnother(): string;
3
11
  /**
4
12
  * @returns {Field} - The created field.
@@ -9,37 +9,39 @@ class Multivalue extends Field_1.default {
9
9
  /**
10
10
  * Normalize values coming into updateValue.
11
11
  * @param {*} value - The value to normalize before setting.
12
+ * @param {Object} flags - Flags to use when normalizing the value.
13
+ * @param {*} emptyValue - The empty value for the field.
12
14
  * @returns {*} - The normalized value.
13
15
  */
14
- normalizeValue(value) {
16
+ normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
15
17
  if (this.component.multiple) {
16
18
  if (Array.isArray(value)) {
17
19
  if (value.length === 0) {
18
- return [this.emptyValue];
20
+ return [emptyValue];
19
21
  }
20
22
  if (this.component.storeas === 'array') {
21
- return super.normalizeValue([value]);
23
+ return super.normalizeValue([value], flags);
22
24
  }
23
- return super.normalizeValue(value);
25
+ return super.normalizeValue(value, flags);
24
26
  }
25
27
  else {
26
- return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
28
+ return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
27
29
  }
28
30
  }
29
31
  else {
30
- if (Array.isArray(value) && this.component.storeas !== 'array') {
32
+ if (Array.isArray(value) && !Array.isArray(emptyValue)) {
31
33
  if (this.component.storeas === 'string') {
32
- return super.normalizeValue(value.join(this.delimiter || ''));
34
+ return super.normalizeValue(value.join(this.delimiter || ''), flags);
33
35
  }
34
- return super.normalizeValue(value[0] || this.emptyValue);
36
+ return super.normalizeValue(value[0] || emptyValue, flags);
35
37
  }
36
38
  else {
37
- return super.normalizeValue(value);
39
+ return super.normalizeValue(value, flags);
38
40
  }
39
41
  }
40
42
  }
41
43
  get dataValue() {
42
- return super.dataValue;
44
+ return this.normalizeValue(super.dataValue);
43
45
  }
44
46
  set dataValue(value) {
45
47
  super.dataValue = value;
@@ -212,7 +212,7 @@ class RadioComponent extends ListComponent_1.default {
212
212
  if (!(0, utils_1.boolValue)(setting) || !value) {
213
213
  return true;
214
214
  }
215
- const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
215
+ const values = this.component.values;
216
216
  if (values) {
217
217
  return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
218
218
  }
@@ -1429,9 +1429,6 @@ class SelectComponent extends ListComponent_1.default {
1429
1429
  case 'custom':
1430
1430
  rawItems = this.getCustomItems();
1431
1431
  break;
1432
- case 'url':
1433
- rawItems = this.selectItems;
1434
- break;
1435
1432
  }
1436
1433
  if (typeof rawItems === 'string') {
1437
1434
  try {
@@ -26,8 +26,7 @@ exports.default = [
26
26
  [
27
27
  'values',
28
28
  'json',
29
- 'custom',
30
- 'url'
29
+ 'custom'
31
30
  ],
32
31
  ],
33
32
  },
@@ -254,7 +254,7 @@ class SelectBoxesComponent extends Radio_1.default {
254
254
  if (!(0, utils_1.boolValue)(setting) || !value) {
255
255
  return true;
256
256
  }
257
- const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
257
+ const values = this.component.values;
258
258
  const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
259
259
  const valueKeys = Object.keys(value);
260
260
  return valueKeys.every((key) => availableValueKeys.includes(key));
@@ -1,4 +1,12 @@
1
1
  export default class Multivalue extends Field {
2
+ /**
3
+ * Normalize values coming into updateValue.
4
+ * @param {*} value - The value to normalize before setting.
5
+ * @param {Object} flags - Flags to use when normalizing the value.
6
+ * @param {*} emptyValue - The empty value for the field.
7
+ * @returns {*} - The normalized value.
8
+ */
9
+ normalizeValue(value: any, flags?: Object, emptyValue?: any): any;
2
10
  get addAnother(): string;
3
11
  /**
4
12
  * @returns {Field} - The created field.
@@ -4,37 +4,39 @@ export default class Multivalue extends Field {
4
4
  /**
5
5
  * Normalize values coming into updateValue.
6
6
  * @param {*} value - The value to normalize before setting.
7
+ * @param {Object} flags - Flags to use when normalizing the value.
8
+ * @param {*} emptyValue - The empty value for the field.
7
9
  * @returns {*} - The normalized value.
8
10
  */
9
- normalizeValue(value) {
11
+ normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
10
12
  if (this.component.multiple) {
11
13
  if (Array.isArray(value)) {
12
14
  if (value.length === 0) {
13
- return [this.emptyValue];
15
+ return [emptyValue];
14
16
  }
15
17
  if (this.component.storeas === 'array') {
16
- return super.normalizeValue([value]);
18
+ return super.normalizeValue([value], flags);
17
19
  }
18
- return super.normalizeValue(value);
20
+ return super.normalizeValue(value, flags);
19
21
  }
20
22
  else {
21
- return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
23
+ return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
22
24
  }
23
25
  }
24
26
  else {
25
- if (Array.isArray(value) && this.component.storeas !== 'array') {
27
+ if (Array.isArray(value) && !Array.isArray(emptyValue)) {
26
28
  if (this.component.storeas === 'string') {
27
- return super.normalizeValue(value.join(this.delimiter || ''));
29
+ return super.normalizeValue(value.join(this.delimiter || ''), flags);
28
30
  }
29
- return super.normalizeValue(value[0] || this.emptyValue);
31
+ return super.normalizeValue(value[0] || emptyValue, flags);
30
32
  }
31
33
  else {
32
- return super.normalizeValue(value);
34
+ return super.normalizeValue(value, flags);
33
35
  }
34
36
  }
35
37
  }
36
38
  get dataValue() {
37
- return super.dataValue;
39
+ return this.normalizeValue(super.dataValue);
38
40
  }
39
41
  set dataValue(value) {
40
42
  super.dataValue = value;
@@ -212,7 +212,7 @@ export default class RadioComponent extends ListComponent {
212
212
  if (!boolValue(setting) || !value) {
213
213
  return true;
214
214
  }
215
- const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
215
+ const values = this.component.values;
216
216
  if (values) {
217
217
  return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
218
218
  }
@@ -1457,9 +1457,6 @@ export default class SelectComponent extends ListComponent {
1457
1457
  case 'custom':
1458
1458
  rawItems = this.getCustomItems();
1459
1459
  break;
1460
- case 'url':
1461
- rawItems = this.selectItems;
1462
- break;
1463
1460
  }
1464
1461
  if (typeof rawItems === 'string') {
1465
1462
  try {
@@ -24,8 +24,7 @@ export default [
24
24
  [
25
25
  'values',
26
26
  'json',
27
- 'custom',
28
- 'url'
27
+ 'custom'
29
28
  ],
30
29
  ],
31
30
  },
@@ -256,7 +256,7 @@ export default class SelectBoxesComponent extends RadioComponent {
256
256
  if (!boolValue(setting) || !value) {
257
257
  return true;
258
258
  }
259
- const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
259
+ const values = this.component.values;
260
260
  const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
261
261
  const valueKeys = Object.keys(value);
262
262
  return valueKeys.every((key) => availableValueKeys.includes(key));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5796.ee2613b",
3
+ "version": "5.0.0-dev.5798.beb3cc0",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.1.0-dev.105.1bff2e6",
84
+ "@formio/core": "2.1.0-dev.145.4491833",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",