@formio/js 5.0.0-dev.5800.896e9df → 5.0.0-dev.5801.effff2f

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 (40) hide show
  1. package/Changelog.md +4 -0
  2. package/dist/formio.form.js +5 -5
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.full.js +12 -12
  5. package/dist/formio.full.min.js +1 -1
  6. package/lib/cjs/Webform.js +3 -0
  7. package/lib/cjs/components/day/Day.d.ts +5 -0
  8. package/lib/cjs/components/day/Day.js +51 -11
  9. package/lib/cjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  10. package/lib/cjs/components/day/editForm/Day.edit.day.js +19 -0
  11. package/lib/cjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  12. package/lib/cjs/components/day/editForm/Day.edit.month.js +19 -0
  13. package/lib/cjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  14. package/lib/cjs/components/day/editForm/Day.edit.year.js +13 -0
  15. package/lib/cjs/components/radio/Radio.js +1 -1
  16. package/lib/cjs/components/select/Select.js +5 -2
  17. package/lib/cjs/components/select/editForm/Select.edit.validation.js +2 -1
  18. package/lib/cjs/components/select/fixtures/comp27.d.ts +18 -0
  19. package/lib/cjs/components/select/fixtures/comp27.js +19 -0
  20. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  21. package/lib/cjs/components/select/fixtures/index.js +3 -1
  22. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  23. package/lib/mjs/Webform.js +3 -0
  24. package/lib/mjs/components/day/Day.d.ts +5 -0
  25. package/lib/mjs/components/day/Day.js +51 -11
  26. package/lib/mjs/components/day/editForm/Day.edit.day.d.ts +17 -0
  27. package/lib/mjs/components/day/editForm/Day.edit.day.js +16 -0
  28. package/lib/mjs/components/day/editForm/Day.edit.month.d.ts +5 -0
  29. package/lib/mjs/components/day/editForm/Day.edit.month.js +16 -0
  30. package/lib/mjs/components/day/editForm/Day.edit.year.d.ts +5 -0
  31. package/lib/mjs/components/day/editForm/Day.edit.year.js +10 -0
  32. package/lib/mjs/components/radio/Radio.js +1 -1
  33. package/lib/mjs/components/select/Select.js +5 -2
  34. package/lib/mjs/components/select/editForm/Select.edit.validation.js +2 -1
  35. package/lib/mjs/components/select/fixtures/comp27.d.ts +18 -0
  36. package/lib/mjs/components/select/fixtures/comp27.js +17 -0
  37. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  38. package/lib/mjs/components/select/fixtures/index.js +2 -1
  39. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  40. package/package.json +1 -1
@@ -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 {
@@ -1514,7 +1517,7 @@ export default class SelectComponent extends ListComponent {
1514
1517
  if (Array.isArray(data)) {
1515
1518
  data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
1516
1519
  }
1517
- else {
1520
+ else if (_.isObject(data)) {
1518
1521
  data[valueProperty] = data[valueProperty].toString();
1519
1522
  }
1520
1523
  return data;
@@ -1549,7 +1552,7 @@ export default class SelectComponent extends ListComponent {
1549
1552
  };
1550
1553
  value = (this.component.multiple && Array.isArray(value))
1551
1554
  ? _.filter(items, (item) => value.includes(item.value))
1552
- : valueProperty
1555
+ : (valueProperty && items)
1553
1556
  ? getFromValues() ?? { value, label: value }
1554
1557
  : value;
1555
1558
  }
@@ -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
  },
@@ -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,17 @@
1
+ export default {
2
+ type: 'select',
3
+ label: 'Select',
4
+ widget: 'choicesjs',
5
+ tableView: true,
6
+ dataSrc: 'custom',
7
+ data: {
8
+ custom: 'values = data.dataSource;'
9
+ },
10
+ dataType: 'string',
11
+ idPath: 'name',
12
+ valueProperty: 'name',
13
+ template: '<span>{{ item.name }}</span>',
14
+ validateWhenHidden: false,
15
+ key: 'select',
16
+ input: true
17
+ };
@@ -23,5 +23,6 @@ import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
24
  import comp25 from './comp25';
25
25
  import comp26 from './comp26';
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 };
26
+ import comp27 from './comp27';
27
+ 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 };
27
28
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -24,4 +24,5 @@ import comp23 from './comp23';
24
24
  import comp24 from './comp24';
25
25
  import comp25 from './comp25';
26
26
  import comp26 from './comp26';
27
- 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 };
27
+ import comp27 from './comp27';
28
+ 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 };
@@ -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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5800.896e9df",
3
+ "version": "5.0.0-dev.5801.effff2f",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {