@formio/js 5.0.0-dev.5799.552d965 → 5.0.0-dev.5801.1d6d8a9

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 (44) hide show
  1. package/Changelog.md +4 -0
  2. package/dist/formio.form.js +9 -9
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.full.js +16 -16
  5. package/dist/formio.full.min.js +1 -1
  6. package/dist/formio.js +1 -1
  7. package/dist/formio.min.js +1 -1
  8. package/dist/formio.utils.js +3 -3
  9. package/dist/formio.utils.min.js +1 -1
  10. package/lib/cjs/Webform.js +4 -0
  11. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +2 -2
  12. package/lib/cjs/components/_classes/multivalue/Multivalue.js +9 -5
  13. package/lib/cjs/components/day/Day.d.ts +5 -0
  14. package/lib/cjs/components/day/Day.js +52 -12
  15. package/lib/cjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  16. package/lib/cjs/components/day/editForm/Day.edit.day.js +19 -0
  17. package/lib/cjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  18. package/lib/cjs/components/day/editForm/Day.edit.month.js +19 -0
  19. package/lib/cjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  20. package/lib/cjs/components/day/editForm/Day.edit.year.js +13 -0
  21. package/lib/cjs/components/radio/Radio.js +1 -1
  22. package/lib/cjs/components/select/Select.js +3 -0
  23. package/lib/cjs/components/select/editForm/Select.edit.validation.js +2 -1
  24. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  25. package/lib/cjs/utils/formUtils.d.ts +1 -2
  26. package/lib/cjs/utils/formUtils.js +2 -3
  27. package/lib/mjs/Webform.js +4 -0
  28. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +2 -2
  29. package/lib/mjs/components/_classes/multivalue/Multivalue.js +9 -5
  30. package/lib/mjs/components/day/Day.d.ts +5 -0
  31. package/lib/mjs/components/day/Day.js +52 -12
  32. package/lib/mjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  33. package/lib/mjs/components/day/editForm/Day.edit.day.js +16 -0
  34. package/lib/mjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  35. package/lib/mjs/components/day/editForm/Day.edit.month.js +16 -0
  36. package/lib/mjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  37. package/lib/mjs/components/day/editForm/Day.edit.year.js +10 -0
  38. package/lib/mjs/components/radio/Radio.js +1 -1
  39. package/lib/mjs/components/select/Select.js +3 -0
  40. package/lib/mjs/components/select/editForm/Select.edit.validation.js +2 -1
  41. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  42. package/lib/mjs/utils/formUtils.d.ts +1 -2
  43. package/lib/mjs/utils/formUtils.js +2 -2
  44. package/package.json +2 -2
@@ -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,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  export default [
2
3
  {
3
4
  wieght: 200,
@@ -33,6 +34,21 @@ export default [
33
34
  label: 'Hidden',
34
35
  tooltip: 'Hide the Day part of the component.',
35
36
  key: 'fields.day.hide',
37
+ onChange: ({ data }) => {
38
+ if (data.defaultValue) {
39
+ const defaultValueParts = data.defaultValue.split('/');
40
+ if (!data.fields.day.hide && defaultValueParts.length !== 3) {
41
+ const newDefaultValue = ['00'];
42
+ if (!data.fields.month.hide) {
43
+ data.dayFirst ? newDefaultValue.push(defaultValueParts[0]) : newDefaultValue.unshift(defaultValueParts[0]);
44
+ }
45
+ if (!data.fields.year.hide) {
46
+ newDefaultValue.push(defaultValueParts[1]);
47
+ }
48
+ _.set(data, 'defaultValue', newDefaultValue.join('/'));
49
+ }
50
+ }
51
+ },
36
52
  input: true
37
53
  },
38
54
  {
@@ -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,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  export default [
2
3
  {
3
4
  wieght: 200,
@@ -33,6 +34,21 @@ export default [
33
34
  label: 'Hidden',
34
35
  tooltip: 'Hide the Month part of the component.',
35
36
  key: 'fields.month.hide',
37
+ onChange: ({ data }) => {
38
+ if (data.defaultValue) {
39
+ const defaultValueParts = data.defaultValue.split('/');
40
+ if (!data.fields.month.hide && defaultValueParts.length !== 3) {
41
+ const newDefaultValue = ['00'];
42
+ if (!data.fields.day.hide) {
43
+ data.dayFirst ? newDefaultValue.unshift(defaultValueParts[0]) : newDefaultValue.push(defaultValueParts[0]);
44
+ }
45
+ if (!data.fields.year.hide) {
46
+ newDefaultValue.push(defaultValueParts[1]);
47
+ }
48
+ _.set(data, 'defaultValue', newDefaultValue.join('/'));
49
+ }
50
+ }
51
+ },
36
52
  input: true
37
53
  },
38
54
  ];
@@ -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,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  export default [
2
3
  {
3
4
  wieght: 200,
@@ -51,6 +52,15 @@ export default [
51
52
  label: 'Hidden',
52
53
  tooltip: 'Hide the Year part of the component.',
53
54
  key: 'fields.year.hide',
55
+ onChange: ({ data }) => {
56
+ if (data.defaultValue) {
57
+ const defaultValueParts = data.defaultValue.split('/');
58
+ if (!data.fields.month.hide && defaultValueParts.length !== 3) {
59
+ defaultValueParts.push('0000');
60
+ _.set(data, 'defaultValue', defaultValueParts.join('/'));
61
+ }
62
+ }
63
+ },
54
64
  input: true
55
65
  },
56
66
  ];
@@ -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.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
  }
@@ -1457,6 +1457,9 @@ 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;
1460
1463
  }
1461
1464
  if (typeof rawItems === 'string') {
1462
1465
  try {
@@ -24,7 +24,8 @@ export default [
24
24
  [
25
25
  'values',
26
26
  'json',
27
- 'custom'
27
+ 'custom',
28
+ 'url'
28
29
  ],
29
30
  ],
30
31
  },
@@ -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.values;
259
+ const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
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));
@@ -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,5 +1,5 @@
1
1
  import { Utils } from '@formio/core';
2
- 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 } = Utils;
2
+ 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 } = Utils;
3
3
  /**
4
4
  * Deprecated version of findComponents. Renamed to searchComponents.
5
5
  * @param {import('@formio/core').Component[]} components - The components to find components within.
@@ -10,4 +10,4 @@ export function findComponents(components, query) {
10
10
  console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');
11
11
  return searchComponents(components, query);
12
12
  }
13
- export { 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 };
13
+ export { 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5799.552d965",
3
+ "version": "5.0.0-dev.5801.1d6d8a9",
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.145.4491833",
84
+ "@formio/core": "2.1.0-dev.146.e57530c",
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",