@formio/js 5.0.0-rc.78 → 5.0.0-rc.79

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.
Files changed (66) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +21 -21
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  7. package/dist/formio.full.js +28 -28
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  10. package/dist/formio.js +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +12 -12
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  16. package/lib/cjs/Webform.js +5 -2
  17. package/lib/cjs/components/_classes/component/Component.js +2 -2
  18. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
  19. package/lib/cjs/components/_classes/multivalue/Multivalue.js +18 -12
  20. package/lib/cjs/components/day/Day.d.ts +5 -0
  21. package/lib/cjs/components/day/Day.js +52 -12
  22. package/lib/cjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  23. package/lib/cjs/components/day/editForm/Day.edit.day.js +19 -0
  24. package/lib/cjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  25. package/lib/cjs/components/day/editForm/Day.edit.month.js +19 -0
  26. package/lib/cjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  27. package/lib/cjs/components/day/editForm/Day.edit.year.js +13 -0
  28. package/lib/cjs/components/radio/Radio.js +1 -1
  29. package/lib/cjs/components/select/Select.js +5 -2
  30. package/lib/cjs/components/select/editForm/Select.edit.validation.js +2 -1
  31. package/lib/cjs/components/select/fixtures/comp27.d.ts +18 -0
  32. package/lib/cjs/components/select/fixtures/comp27.js +19 -0
  33. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  34. package/lib/cjs/components/select/fixtures/index.js +5 -1
  35. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  36. package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +2 -1
  37. package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +2 -2
  38. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +2 -2
  39. package/lib/cjs/utils/formUtils.d.ts +1 -2
  40. package/lib/cjs/utils/formUtils.js +2 -3
  41. package/lib/mjs/Webform.js +9 -2
  42. package/lib/mjs/components/_classes/component/Component.js +2 -2
  43. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
  44. package/lib/mjs/components/_classes/multivalue/Multivalue.js +18 -12
  45. package/lib/mjs/components/day/Day.d.ts +5 -0
  46. package/lib/mjs/components/day/Day.js +52 -12
  47. package/lib/mjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  48. package/lib/mjs/components/day/editForm/Day.edit.day.js +16 -0
  49. package/lib/mjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  50. package/lib/mjs/components/day/editForm/Day.edit.month.js +16 -0
  51. package/lib/mjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  52. package/lib/mjs/components/day/editForm/Day.edit.year.js +10 -0
  53. package/lib/mjs/components/radio/Radio.js +1 -1
  54. package/lib/mjs/components/select/Select.js +5 -2
  55. package/lib/mjs/components/select/editForm/Select.edit.validation.js +2 -1
  56. package/lib/mjs/components/select/fixtures/comp27.d.ts +18 -0
  57. package/lib/mjs/components/select/fixtures/comp27.js +17 -0
  58. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  59. package/lib/mjs/components/select/fixtures/index.js +3 -1
  60. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  61. package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +1 -1
  62. package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +2 -2
  63. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -2
  64. package/lib/mjs/utils/formUtils.d.ts +1 -2
  65. package/lib/mjs/utils/formUtils.js +2 -2
  66. package/package.json +2 -2
@@ -18,9 +18,9 @@
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 */
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
- /*! formiojs v5.0.0-rc.78 | https://unpkg.com/formiojs@5.0.0-rc.78/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.79 | https://unpkg.com/formiojs@5.0.0-rc.79/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -1089,6 +1089,9 @@ class Webform extends NestedDataComponent_1.default {
1089
1089
  if (!Array.isArray(errors)) {
1090
1090
  errors = [errors];
1091
1091
  }
1092
+ if (Array.isArray(this.errors)) {
1093
+ errors = lodash_1.default.union(errors, this.errors);
1094
+ }
1092
1095
  errors = errors.concat(this.customErrors).filter((err) => !!err);
1093
1096
  if (!errors.length) {
1094
1097
  this.setAlert(false);
@@ -1236,10 +1239,10 @@ class Webform extends NestedDataComponent_1.default {
1236
1239
  }
1237
1240
  this.checkData(value.data, flags);
1238
1241
  const shouldValidate = !flags.noValidate ||
1239
- flags.fromIFrame ||
1242
+ flags.fromIframe ||
1240
1243
  (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
1241
1244
  const errors = shouldValidate
1242
- ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: "change" }))
1245
+ ? this.validate(value.data, Object.assign(Object.assign({}, flags), { noValidate: false, process: 'change' }))
1243
1246
  : [];
1244
1247
  value.isValid = errors.length === 0;
1245
1248
  this.loading = false;
@@ -2996,7 +2996,7 @@ class Component extends Element_1.default {
2996
2996
  this.parent.childErrors.push(...errors);
2997
2997
  }
2998
2998
  else {
2999
- lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
2999
+ lodash_1.default.remove(this.parent.childErrors, (err) => { var _a, _b; return (((_a = err === null || err === void 0 ? void 0 : err.component) === null || _a === void 0 ? void 0 : _a.key) || ((_b = err === null || err === void 0 ? void 0 : err.context) === null || _b === void 0 ? void 0 : _b.key)) === this.component.key; });
3000
3000
  }
3001
3001
  }
3002
3002
  this.showValidationErrors(errors, data, row, flags);
@@ -3012,7 +3012,7 @@ class Component extends Element_1.default {
3012
3012
  this.parent.childErrors.push(...errors);
3013
3013
  }
3014
3014
  else {
3015
- lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
3015
+ lodash_1.default.remove(this.parent.childErrors, (err) => { var _a, _b; return (((_a = err === null || err === void 0 ? void 0 : err.component) === null || _a === void 0 ? void 0 : _a.key) || ((_b = err === null || err === void 0 ? void 0 : err.context) === null || _b === void 0 ? void 0 : _b.key)) === this.component.key; });
3016
3016
  }
3017
3017
  }
3018
3018
  return errors.length === 0;
@@ -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.
@@ -5,41 +5,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Field_1 = __importDefault(require("../field/Field"));
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
+ const core_1 = require("@formio/core");
8
9
  class Multivalue extends Field_1.default {
9
10
  /**
10
11
  * Normalize values coming into updateValue.
11
12
  * @param {*} value - The value to normalize before setting.
13
+ * @param {object} flags - Flags to use when normalizing the value.
14
+ * @param {*} emptyValue - The empty value for the field.
12
15
  * @returns {*} - The normalized value.
13
16
  */
14
- normalizeValue(value) {
17
+ normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
18
+ const underlyingValueShouldBeArray = core_1.Utils.getModelType(this.component) === 'array' || this.component.storeas === 'array' || Array.isArray(emptyValue);
15
19
  if (this.component.multiple) {
16
20
  if (Array.isArray(value)) {
17
- if (value.length === 0) {
18
- return [this.emptyValue];
21
+ if (underlyingValueShouldBeArray) {
22
+ if (value.length === 0 || !Array.isArray(value[0])) {
23
+ return [value];
24
+ }
19
25
  }
20
- if (this.component.storeas === 'array') {
21
- return super.normalizeValue([value]);
26
+ if (value.length === 0) {
27
+ return [emptyValue];
22
28
  }
23
- return super.normalizeValue(value);
29
+ return super.normalizeValue(value, flags);
24
30
  }
25
31
  else {
26
- return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
32
+ return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
27
33
  }
28
34
  }
29
35
  else {
30
- if (Array.isArray(value) && this.component.storeas !== 'array') {
36
+ if (Array.isArray(value) && !underlyingValueShouldBeArray) {
31
37
  if (this.component.storeas === 'string') {
32
- return super.normalizeValue(value.join(this.delimiter || ''));
38
+ return super.normalizeValue(value.join(this.delimiter || ''), flags);
33
39
  }
34
- return super.normalizeValue(value[0] || this.emptyValue);
40
+ return super.normalizeValue(value[0] || emptyValue, flags);
35
41
  }
36
42
  else {
37
- return super.normalizeValue(value);
43
+ return super.normalizeValue(value, flags);
38
44
  }
39
45
  }
40
46
  }
41
47
  get dataValue() {
42
- return super.dataValue;
48
+ return this.normalizeValue(super.dataValue);
43
49
  }
44
50
  set dataValue(value) {
45
51
  super.dataValue = value;
@@ -97,6 +97,11 @@ export default class DayComponent extends Field {
97
97
  * @returns {null|void} - Returns null if the value is invalid, otherwise void.
98
98
  */
99
99
  setValueAt(index: number, value: any): null | void;
100
+ getDayWithHiddenFields(parts: any): {
101
+ month: any;
102
+ day: any;
103
+ year: any;
104
+ };
100
105
  getFieldValue(name: any): number;
101
106
  get parts(): {
102
107
  day: number;
@@ -344,6 +344,18 @@ class DayComponent extends Field_1.default {
344
344
  const valueParts = value.split('/');
345
345
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
346
346
  const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
347
+ let defaultDay = '';
348
+ let defaultMonth = '';
349
+ let defaultYear = '';
350
+ if (defaultValue) {
351
+ const hasHiddenFields = defaultValue.length !== 3;
352
+ defaultDay = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).day : defaultValue[DAY];
353
+ defaultMonth = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).month : defaultValue[MONTH];
354
+ defaultYear = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).year : defaultValue[YEAR];
355
+ }
356
+ if (this.options.building && defaultValue.length === 3) {
357
+ return this.component.defaultValue;
358
+ }
347
359
  const getNextPart = (shouldTake, defaultValue) => {
348
360
  // Only push the part if it's not an empty string
349
361
  const part = shouldTake ? valueParts.shift() : defaultValue;
@@ -352,13 +364,13 @@ class DayComponent extends Field_1.default {
352
364
  }
353
365
  };
354
366
  if (this.dayFirst) {
355
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
367
+ getNextPart(this.showDay, defaultDay);
356
368
  }
357
- getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
369
+ getNextPart(this.showMonth, defaultMonth);
358
370
  if (!this.dayFirst) {
359
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
371
+ getNextPart(this.showDay, defaultDay);
360
372
  }
361
- getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
373
+ getNextPart(this.showYear, defaultYear);
362
374
  return dateParts.join('/');
363
375
  }
364
376
  /**
@@ -373,16 +385,23 @@ class DayComponent extends Field_1.default {
373
385
  if (value === 'Invalid date') {
374
386
  return null;
375
387
  }
388
+ let day, month, year;
376
389
  const parts = value.split('/');
377
- let day;
378
- if (this.component.dayFirst) {
379
- day = parts.shift();
390
+ if (parts.length !== 3) {
391
+ day = this.getDayWithHiddenFields(parts).day;
392
+ month = this.getDayWithHiddenFields(parts).month;
393
+ year = this.getDayWithHiddenFields(parts).year;
380
394
  }
381
- const month = parts.shift();
382
- if (!this.component.dayFirst) {
383
- day = parts.shift();
395
+ else {
396
+ if (this.component.dayFirst) {
397
+ day = parts.shift();
398
+ }
399
+ month = parts.shift();
400
+ if (!this.component.dayFirst) {
401
+ day = parts.shift();
402
+ }
403
+ year = parts.shift();
384
404
  }
385
- const year = parts.shift();
386
405
  if (this.refs.day && this.showDay) {
387
406
  this.refs.day.value = day === '00' ? '' : parseInt(day, 10);
388
407
  }
@@ -393,6 +412,27 @@ class DayComponent extends Field_1.default {
393
412
  this.refs.year.value = year === '0000' ? '' : parseInt(year, 10);
394
413
  }
395
414
  }
415
+ getDayWithHiddenFields(parts) {
416
+ let [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
417
+ if (!this.showDay) {
418
+ MONTH = MONTH === 0 ? 0 : MONTH - 1;
419
+ YEAR = YEAR - 1;
420
+ DAY = null;
421
+ }
422
+ if (!this.showMonth) {
423
+ DAY = DAY === 0 ? 0 : DAY - 1;
424
+ YEAR = YEAR - 1;
425
+ MONTH = null;
426
+ }
427
+ if (!this.showYear) {
428
+ YEAR = null;
429
+ }
430
+ return {
431
+ month: lodash_1.default.isNull(MONTH) ? '' : parts[MONTH],
432
+ day: lodash_1.default.isNull(DAY) ? '' : parts[DAY],
433
+ year: lodash_1.default.isNull(YEAR) ? '' : parts[YEAR],
434
+ };
435
+ }
396
436
  getFieldValue(name) {
397
437
  const parts = this.dataValue ? this.dataValue.split('/') : [];
398
438
  let val = 0;
@@ -561,7 +601,7 @@ class DayComponent extends Field_1.default {
561
601
  }
562
602
  isPartialDay(value) {
563
603
  if (!value) {
564
- return false;
604
+ return true;
565
605
  }
566
606
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
567
607
  const values = value.split('/');
@@ -14,6 +14,7 @@ declare const _default: ({
14
14
  input?: undefined;
15
15
  placeholder?: undefined;
16
16
  tooltip?: undefined;
17
+ onChange?: undefined;
17
18
  } | {
18
19
  weight: number;
19
20
  type: string;
@@ -25,16 +26,32 @@ declare const _default: ({
25
26
  wieght?: undefined;
26
27
  datasrc?: undefined;
27
28
  data?: undefined;
29
+ onChange?: undefined;
28
30
  } | {
29
31
  weight: number;
30
32
  type: string;
31
33
  label: string;
32
34
  tooltip: string;
33
35
  key: string;
36
+ onChange: ({ data }: {
37
+ data: any;
38
+ }) => void;
34
39
  input: boolean;
35
40
  wieght?: undefined;
36
41
  datasrc?: undefined;
37
42
  data?: undefined;
38
43
  placeholder?: undefined;
44
+ } | {
45
+ weight: number;
46
+ type: string;
47
+ label: string;
48
+ tooltip: string;
49
+ key: string;
50
+ input: boolean;
51
+ wieght?: undefined;
52
+ datasrc?: undefined;
53
+ data?: undefined;
54
+ placeholder?: undefined;
55
+ onChange?: undefined;
39
56
  })[];
40
57
  export default _default;
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = __importDefault(require("lodash"));
3
7
  exports.default = [
4
8
  {
5
9
  wieght: 200,
@@ -35,6 +39,21 @@ exports.default = [
35
39
  label: 'Hidden',
36
40
  tooltip: 'Hide the Day part of the component.',
37
41
  key: 'fields.day.hide',
42
+ onChange: ({ data }) => {
43
+ if (data.defaultValue) {
44
+ const defaultValueParts = data.defaultValue.split('/');
45
+ if (!data.fields.day.hide && defaultValueParts.length !== 3) {
46
+ const newDefaultValue = ['00'];
47
+ if (!data.fields.month.hide) {
48
+ data.dayFirst ? newDefaultValue.push(defaultValueParts[0]) : newDefaultValue.unshift(defaultValueParts[0]);
49
+ }
50
+ if (!data.fields.year.hide) {
51
+ newDefaultValue.push(defaultValueParts[1]);
52
+ }
53
+ lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
54
+ }
55
+ }
56
+ },
38
57
  input: true
39
58
  },
40
59
  {
@@ -14,6 +14,7 @@ declare const _default: ({
14
14
  input?: undefined;
15
15
  placeholder?: undefined;
16
16
  tooltip?: undefined;
17
+ onChange?: undefined;
17
18
  } | {
18
19
  weight: number;
19
20
  type: string;
@@ -25,12 +26,16 @@ declare const _default: ({
25
26
  wieght?: undefined;
26
27
  datasrc?: undefined;
27
28
  data?: undefined;
29
+ onChange?: undefined;
28
30
  } | {
29
31
  weight: number;
30
32
  type: string;
31
33
  label: string;
32
34
  tooltip: string;
33
35
  key: string;
36
+ onChange: ({ data }: {
37
+ data: any;
38
+ }) => void;
34
39
  input: boolean;
35
40
  wieght?: undefined;
36
41
  datasrc?: undefined;
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = __importDefault(require("lodash"));
3
7
  exports.default = [
4
8
  {
5
9
  wieght: 200,
@@ -35,6 +39,21 @@ exports.default = [
35
39
  label: 'Hidden',
36
40
  tooltip: 'Hide the Month part of the component.',
37
41
  key: 'fields.month.hide',
42
+ onChange: ({ data }) => {
43
+ if (data.defaultValue) {
44
+ const defaultValueParts = data.defaultValue.split('/');
45
+ if (!data.fields.month.hide && defaultValueParts.length !== 3) {
46
+ const newDefaultValue = ['00'];
47
+ if (!data.fields.day.hide) {
48
+ data.dayFirst ? newDefaultValue.unshift(defaultValueParts[0]) : newDefaultValue.push(defaultValueParts[0]);
49
+ }
50
+ if (!data.fields.year.hide) {
51
+ newDefaultValue.push(defaultValueParts[1]);
52
+ }
53
+ lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
54
+ }
55
+ }
56
+ },
38
57
  input: true
39
58
  },
40
59
  ];
@@ -14,6 +14,7 @@ declare const _default: ({
14
14
  input?: undefined;
15
15
  placeholder?: undefined;
16
16
  tooltip?: undefined;
17
+ onChange?: undefined;
17
18
  } | {
18
19
  weight: number;
19
20
  type: string;
@@ -25,12 +26,16 @@ declare const _default: ({
25
26
  wieght?: undefined;
26
27
  datasrc?: undefined;
27
28
  data?: undefined;
29
+ onChange?: undefined;
28
30
  } | {
29
31
  weight: number;
30
32
  type: string;
31
33
  label: string;
32
34
  tooltip: string;
33
35
  key: string;
36
+ onChange: ({ data }: {
37
+ data: any;
38
+ }) => void;
34
39
  input: boolean;
35
40
  wieght?: undefined;
36
41
  datasrc?: undefined;
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = __importDefault(require("lodash"));
3
7
  exports.default = [
4
8
  {
5
9
  wieght: 200,
@@ -53,6 +57,15 @@ exports.default = [
53
57
  label: 'Hidden',
54
58
  tooltip: 'Hide the Year part of the component.',
55
59
  key: 'fields.year.hide',
60
+ onChange: ({ data }) => {
61
+ if (data.defaultValue) {
62
+ const defaultValueParts = data.defaultValue.split('/');
63
+ if (!data.fields.month.hide && defaultValueParts.length !== 3) {
64
+ defaultValueParts.push('0000');
65
+ lodash_1.default.set(data, 'defaultValue', defaultValueParts.join('/'));
66
+ }
67
+ }
68
+ },
56
69
  input: true
57
70
  },
58
71
  ];
@@ -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.values;
215
+ const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
216
216
  if (values) {
217
217
  return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
218
218
  }
@@ -1430,6 +1430,9 @@ class SelectComponent extends ListComponent_1.default {
1430
1430
  case 'custom':
1431
1431
  rawItems = this.getCustomItems();
1432
1432
  break;
1433
+ case 'url':
1434
+ rawItems = this.selectItems;
1435
+ break;
1433
1436
  }
1434
1437
  if (typeof rawItems === 'string') {
1435
1438
  try {
@@ -1488,7 +1491,7 @@ class SelectComponent extends ListComponent_1.default {
1488
1491
  if (Array.isArray(data)) {
1489
1492
  data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
1490
1493
  }
1491
- else {
1494
+ else if (lodash_1.default.isObject(data)) {
1492
1495
  data[valueProperty] = data[valueProperty].toString();
1493
1496
  }
1494
1497
  return data;
@@ -1523,7 +1526,7 @@ class SelectComponent extends ListComponent_1.default {
1523
1526
  };
1524
1527
  value = (this.component.multiple && Array.isArray(value))
1525
1528
  ? lodash_1.default.filter(items, (item) => value.includes(item.value))
1526
- : valueProperty
1529
+ : (valueProperty && items)
1527
1530
  ? (_a = getFromValues()) !== null && _a !== void 0 ? _a : { value, label: value }
1528
1531
  : value;
1529
1532
  }
@@ -26,7 +26,8 @@ exports.default = [
26
26
  [
27
27
  'values',
28
28
  'json',
29
- 'custom'
29
+ 'custom',
30
+ 'url'
30
31
  ],
31
32
  ],
32
33
  },
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let label: string;
4
+ let widget: string;
5
+ let tableView: boolean;
6
+ let dataSrc: string;
7
+ namespace data {
8
+ let custom: string;
9
+ }
10
+ let dataType: string;
11
+ let idPath: string;
12
+ let valueProperty: string;
13
+ let template: string;
14
+ let validateWhenHidden: boolean;
15
+ let key: string;
16
+ let input: boolean;
17
+ }
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'select',
5
+ label: 'Select',
6
+ widget: 'choicesjs',
7
+ tableView: true,
8
+ dataSrc: 'custom',
9
+ data: {
10
+ custom: 'values = data.dataSource;'
11
+ },
12
+ dataType: 'string',
13
+ idPath: 'name',
14
+ valueProperty: 'name',
15
+ template: '<span>{{ item.name }}</span>',
16
+ validateWhenHidden: false,
17
+ key: 'select',
18
+ input: true
19
+ };
@@ -22,5 +22,6 @@ import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
25
+ import comp27 from './comp27';
26
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25, comp26, comp27 };
26
27
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -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.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = 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;
6
+ exports.comp27 = exports.comp26 = exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = 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"));
@@ -55,3 +55,7 @@ const comp24_1 = __importDefault(require("./comp24"));
55
55
  exports.comp24 = comp24_1.default;
56
56
  const comp25_1 = __importDefault(require("./comp25"));
57
57
  exports.comp25 = comp25_1.default;
58
+ const comp26_1 = __importDefault(require("./comp26"));
59
+ exports.comp26 = comp26_1.default;
60
+ const comp27_1 = __importDefault(require("./comp27"));
61
+ exports.comp27 = comp27_1.default;
@@ -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.values;
257
+ const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
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));
@@ -19,12 +19,13 @@ class DateGeaterThan extends ConditionOperator_1.default {
19
19
  return { date, comparedDate };
20
20
  }
21
21
  execute(options, functionName = 'isAfter') {
22
+ var _a;
22
23
  const { value, instance, conditionComponentPath } = options;
23
24
  if (!value) {
24
25
  return false;
25
26
  }
26
27
  let conditionTriggerComponent = null;
27
- if (instance && instance.root) {
28
+ if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
28
29
  conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
29
30
  }
30
31
  if (conditionTriggerComponent && conditionTriggerComponent.isPartialDay && conditionTriggerComponent.isPartialDay(value)) {
@@ -18,8 +18,8 @@ class IsEmptyValue extends ConditionOperator_1.default {
18
18
  execute({ value, instance, conditionComponentPath }) {
19
19
  var _a;
20
20
  const isEmptyValue = lodash_1.default.isEmpty(lodash_1.default.isNumber(value) ? String(value) : value);
21
- if (instance && instance.root) {
22
- const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
21
+ if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
22
+ const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
23
23
  return (conditionTriggerComponent === null || conditionTriggerComponent === void 0 ? void 0 : conditionTriggerComponent.isEmpty) ? conditionTriggerComponent.isEmpty() : isEmptyValue;
24
24
  }
25
25
  return isEmptyValue;
@@ -22,8 +22,8 @@ class IsEqualTo extends ConditionOperator_1.default {
22
22
  // eslint-disable-next-line no-empty
23
23
  catch (e) { }
24
24
  }
25
- if (instance && instance.root) {
26
- const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
25
+ if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
26
+ const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
27
27
  if (conditionTriggerComponent
28
28
  && (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
29
29
  && ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
@@ -8,11 +8,10 @@ export function findComponents(components: import('@formio/core').Component[], q
8
8
  export const flattenComponents: typeof Utils.flattenComponents;
9
9
  export const guid: typeof Utils.guid;
10
10
  export const uniqueName: typeof Utils.uniqueName;
11
- export const MODEL_TYPES: Record<string, string[]>;
11
+ export const MODEL_TYPES: any;
12
12
  export const getModelType: typeof Utils.getModelType;
13
13
  export const getComponentAbsolutePath: typeof Utils.getComponentAbsolutePath;
14
14
  export const getComponentPath: typeof Utils.getComponentPath;
15
- export const isComponentModelType: typeof Utils.isComponentModelType;
16
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
17
16
  export const componentPath: typeof Utils.componentPath;
18
17
  export const componentChildPath: any;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.isComponentModelType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
3
+ exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
4
4
  const core_1 = require("@formio/core");
5
- const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentModelType, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = core_1.Utils;
5
+ const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = core_1.Utils;
6
6
  exports.flattenComponents = flattenComponents;
7
7
  exports.guid = guid;
8
8
  exports.uniqueName = uniqueName;
@@ -10,7 +10,6 @@ exports.MODEL_TYPES = MODEL_TYPES;
10
10
  exports.getModelType = getModelType;
11
11
  exports.getComponentAbsolutePath = getComponentAbsolutePath;
12
12
  exports.getComponentPath = getComponentPath;
13
- exports.isComponentModelType = isComponentModelType;
14
13
  exports.isComponentNestedDataType = isComponentNestedDataType;
15
14
  exports.componentPath = componentPath;
16
15
  exports.componentChildPath = componentChildPath;