@formio/js 5.0.0-rc.90 → 5.0.0-rc.92

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 (56) 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 +22 -22
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +23 -23
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  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 +7 -7
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/Webform.js +7 -1
  17. package/lib/cjs/components/Components.js +3 -0
  18. package/lib/cjs/components/_classes/component/Component.js +4 -4
  19. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  20. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  21. package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
  22. package/lib/cjs/components/day/Day.js +3 -0
  23. package/lib/cjs/components/editgrid/EditGrid.js +8 -2
  24. package/lib/cjs/components/editgrid/fixtures/comp19.d.ts +59 -0
  25. package/lib/cjs/components/editgrid/fixtures/comp19.js +73 -0
  26. package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
  27. package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
  28. package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
  29. package/lib/cjs/components/number/fixtures/comp11.d.ts +17 -0
  30. package/lib/cjs/components/number/fixtures/comp11.js +20 -0
  31. package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
  32. package/lib/cjs/components/number/fixtures/index.js +3 -1
  33. package/lib/cjs/components/select/Select.js +12 -4
  34. package/lib/cjs/components/time/Time.js +0 -6
  35. package/lib/cjs/components/time/fixtures/timeForm2.js +9 -0
  36. package/lib/mjs/Webform.js +6 -1
  37. package/lib/mjs/components/Components.js +4 -1
  38. package/lib/mjs/components/_classes/component/Component.js +4 -4
  39. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  40. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  41. package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
  42. package/lib/mjs/components/day/Day.js +3 -0
  43. package/lib/mjs/components/editgrid/EditGrid.js +8 -2
  44. package/lib/mjs/components/editgrid/fixtures/comp19.d.ts +59 -0
  45. package/lib/mjs/components/editgrid/fixtures/comp19.js +71 -0
  46. package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
  47. package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
  48. package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
  49. package/lib/mjs/components/number/fixtures/comp11.d.ts +17 -0
  50. package/lib/mjs/components/number/fixtures/comp11.js +18 -0
  51. package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
  52. package/lib/mjs/components/number/fixtures/index.js +2 -1
  53. package/lib/mjs/components/select/Select.js +12 -4
  54. package/lib/mjs/components/time/Time.js +0 -6
  55. package/lib/mjs/components/time/fixtures/timeForm2.js +9 -0
  56. package/package.json +3 -3
@@ -0,0 +1,59 @@
1
+ declare namespace _default {
2
+ let _id: string;
3
+ let title: string;
4
+ let name: string;
5
+ let path: string;
6
+ let type: string;
7
+ let display: string;
8
+ let components: ({
9
+ label: string;
10
+ tableView: boolean;
11
+ validateWhenHidden: boolean;
12
+ rowDrafts: boolean;
13
+ key: string;
14
+ type: string;
15
+ displayAsTable: boolean;
16
+ input: boolean;
17
+ components: {
18
+ label: string;
19
+ columns: {
20
+ components: {
21
+ label: string;
22
+ applyMaskOn: string;
23
+ tableView: boolean;
24
+ validate: {
25
+ required: boolean;
26
+ };
27
+ validateWhenHidden: boolean;
28
+ key: string;
29
+ type: string;
30
+ input: boolean;
31
+ }[];
32
+ width: number;
33
+ offset: number;
34
+ push: number;
35
+ pull: number;
36
+ size: string;
37
+ currentWidth: number;
38
+ }[];
39
+ key: string;
40
+ type: string;
41
+ input: boolean;
42
+ tableView: boolean;
43
+ }[];
44
+ disableOnInvalid?: undefined;
45
+ } | {
46
+ type: string;
47
+ label: string;
48
+ key: string;
49
+ disableOnInvalid: boolean;
50
+ input: boolean;
51
+ tableView: boolean;
52
+ validateWhenHidden?: undefined;
53
+ rowDrafts?: undefined;
54
+ displayAsTable?: undefined;
55
+ components?: undefined;
56
+ })[];
57
+ let project: string;
58
+ }
59
+ export default _default;
@@ -0,0 +1,71 @@
1
+ export default {
2
+ _id: '6704f3d329cf52a3ddd4e244',
3
+ title: 'uiu',
4
+ name: 'uiu',
5
+ path: 'uiu',
6
+ type: 'resource',
7
+ display: 'form',
8
+ components: [
9
+ {
10
+ label: 'Edit Grid',
11
+ tableView: false,
12
+ validateWhenHidden: false,
13
+ rowDrafts: false,
14
+ key: 'editGrid',
15
+ type: 'editgrid',
16
+ displayAsTable: false,
17
+ input: true,
18
+ components: [
19
+ {
20
+ label: 'Columns',
21
+ columns: [
22
+ {
23
+ components: [
24
+ {
25
+ label: 'Text Field',
26
+ applyMaskOn: 'change',
27
+ tableView: true,
28
+ validate: {
29
+ required: true,
30
+ },
31
+ validateWhenHidden: false,
32
+ key: 'textField',
33
+ type: 'textfield',
34
+ input: true,
35
+ },
36
+ ],
37
+ width: 6,
38
+ offset: 0,
39
+ push: 0,
40
+ pull: 0,
41
+ size: 'md',
42
+ currentWidth: 6,
43
+ },
44
+ {
45
+ components: [],
46
+ width: 6,
47
+ offset: 0,
48
+ push: 0,
49
+ pull: 0,
50
+ size: 'md',
51
+ currentWidth: 6,
52
+ },
53
+ ],
54
+ key: 'columns',
55
+ type: 'columns',
56
+ input: false,
57
+ tableView: false,
58
+ },
59
+ ],
60
+ },
61
+ {
62
+ type: 'button',
63
+ label: 'Submit',
64
+ key: 'submit',
65
+ disableOnInvalid: true,
66
+ input: true,
67
+ tableView: false,
68
+ },
69
+ ],
70
+ project: '66f66c655879bf08113cf465',
71
+ };
@@ -15,7 +15,8 @@ import comp14 from './comp14';
15
15
  import comp15 from './comp15';
16
16
  import comp16 from './comp16';
17
17
  import comp18 from './comp18';
18
+ import comp19 from './comp19';
18
19
  import compOpenWhenEmpty from './comp-openWhenEmpty';
19
20
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
20
21
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
21
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
22
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
@@ -16,8 +16,9 @@ import comp15 from './comp15';
16
16
  import comp16 from './comp16';
17
17
  import comp17 from './comp17';
18
18
  import comp18 from './comp18';
19
+ import comp19 from './comp19';
19
20
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
20
21
  import compOpenWhenEmpty from './comp-openWhenEmpty';
21
22
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
22
23
  import compTestEvents from './comp-test-events';
23
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
24
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
@@ -2,7 +2,7 @@ import EditFormUtils from '../../_classes/component/editForm/utils';
2
2
  /* eslint-disable max-len */
3
3
  export default [
4
4
  EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 120, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
5
- EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="http://formio.github.io/formio.js/app/examples/calculated.html" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'),
5
+ EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'),
6
6
  {
7
7
  weight: 140,
8
8
  type: 'checkbox',
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ mask: boolean;
5
+ tableView: boolean;
6
+ modalEdit: boolean;
7
+ multiple: boolean;
8
+ delimiter: string;
9
+ requireDecimal: boolean;
10
+ inputFormat: string;
11
+ truncateMultipleSpaces: boolean;
12
+ key: string;
13
+ type: string;
14
+ input: boolean;
15
+ }[];
16
+ }
17
+ export default _default;
@@ -0,0 +1,18 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ label: 'Number',
5
+ mask: true,
6
+ tableView: false,
7
+ modalEdit: true,
8
+ multiple: true,
9
+ delimiter: ',',
10
+ requireDecimal: false,
11
+ inputFormat: 'plain',
12
+ truncateMultipleSpaces: false,
13
+ key: 'number',
14
+ type: 'number',
15
+ input: true
16
+ }
17
+ ]
18
+ };
@@ -8,4 +8,5 @@ import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10 };
11
+ import comp11 from './comp11';
12
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
@@ -8,4 +8,5 @@ import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10 };
11
+ import comp11 from './comp11';
12
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
@@ -247,7 +247,11 @@ export default class SelectComponent extends ListComponent {
247
247
  const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
248
248
  return this.sanitize(value, this.shouldSanitizeValue);
249
249
  }
250
- if (this.component.multiple && _.isArray(this.dataValue) ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val) : (this.dataValue === this.normalizeSingleValue(value))) {
250
+ // Inside DataTable component won't have dataValue set
251
+ const shouldUseSelectData = (this.component.multiple && _.isArray(this.dataValue)
252
+ ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val)
253
+ : (this.dataValue === this.normalizeSingleValue(value))) || this.inDataTable;
254
+ if (shouldUseSelectData) {
251
255
  const selectData = this.selectData;
252
256
  if (selectData) {
253
257
  const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
@@ -1242,7 +1246,7 @@ export default class SelectComponent extends ListComponent {
1242
1246
  // Check to see if we need to save off the template data into our metadata.
1243
1247
  const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
1244
1248
  const shouldSaveData = !valueIsObject || this.component.reference;
1245
- if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && this.root?.submission) {
1249
+ if (!_.isNil(templateValue) && shouldSaveData && this.templateData && this.templateData[templateValue] && this.root?.submission) {
1246
1250
  const submission = this.root.submission;
1247
1251
  if (!submission.metadata) {
1248
1252
  submission.metadata = {};
@@ -1496,8 +1500,12 @@ export default class SelectComponent extends ListComponent {
1496
1500
  }
1497
1501
  asString(value, options = {}) {
1498
1502
  value = value ?? this.getValue();
1499
- if (options.modalPreview) {
1500
- const template = this.itemTemplate(value, value);
1503
+ if (options.modalPreview || this.inDataTable) {
1504
+ if (this.inDataTable) {
1505
+ value = this.undoValueTyping(value);
1506
+ }
1507
+ const templateValue = (this.isEntireObjectDisplay() && !_.isObject(value.data)) ? { data: value } : value;
1508
+ const template = this.itemTemplate(templateValue, value, options);
1501
1509
  return template;
1502
1510
  }
1503
1511
  //need to convert values to strings to be able to compare values with available options that are strings
@@ -51,12 +51,6 @@ export default class TimeComponent extends TextFieldComponent {
51
51
  }
52
52
  return value;
53
53
  }
54
- get validationValue() {
55
- if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
56
- return this.dataValue;
57
- }
58
- return this.rawData;
59
- }
60
54
  get inputInfo() {
61
55
  const info = super.inputInfo;
62
56
  info.attr.type = this.component.inputType;
@@ -12,6 +12,15 @@ export default {
12
12
  'input': true,
13
13
  'inputMask': '99:99'
14
14
  },
15
+ {
16
+ 'label': 'Multiple Time',
17
+ 'inputType': 'text',
18
+ 'tableView': true,
19
+ 'key': 'multipleTime',
20
+ 'type': 'time',
21
+ 'input': true,
22
+ 'inputMask': '99:99'
23
+ },
15
24
  {
16
25
  'label': 'Submit',
17
26
  'showValidations': false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.90",
3
+ "version": "5.0.0-rc.92",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,9 +79,9 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.0.0-rc.37",
82
+ "@formio/bootstrap": "3.0.0-rc.39",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.9",
84
+ "@formio/core": "2.3.0-rc.13",
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",