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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -20,7 +20,7 @@
20
20
 
21
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.90 | https://unpkg.com/formiojs@5.0.0-rc.90/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.92 | https://unpkg.com/formiojs@5.0.0-rc.92/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -1228,9 +1228,15 @@ class Webform extends NestedDataComponent_1.default {
1228
1228
  * @param {any} changes - The changes that have occured in the form.
1229
1229
  */
1230
1230
  onChange(flags, changed, modified, changes) {
1231
+ var _a;
1231
1232
  flags = flags || {};
1232
1233
  let isChangeEventEmitted = false;
1233
- super.onChange(flags, true);
1234
+ if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.subForm) === this) {
1235
+ super.onChange(Object.assign(Object.assign({}, flags), { modified }), false);
1236
+ }
1237
+ else {
1238
+ super.onChange(flags, true);
1239
+ }
1234
1240
  const value = lodash_1.default.clone(this.submission);
1235
1241
  flags.changed = value.changed = changed;
1236
1242
  flags.changes = changes;
@@ -70,6 +70,9 @@ class Components {
70
70
  const rowIndex = component.row;
71
71
  const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
72
72
  path = `${thisPath.path}${rowIndexPath}.`;
73
+ if (rowIndexPath && (0, utils_2.getModelType)(thisPath) === 'nestedDataArray') {
74
+ path = `${path}data.`;
75
+ }
73
76
  path += componentKey;
74
77
  return lodash_1.default.trim(path, '.');
75
78
  }
@@ -1738,12 +1738,12 @@ class Component extends Element_1.default {
1738
1738
  var _a, _b, _c;
1739
1739
  if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
1740
1740
  if ((_b = this.refs.input) === null || _b === void 0 ? void 0 : _b.length) {
1741
- const { selection, index } = this.root.currentSelection;
1741
+ const { index } = this.root.currentSelection;
1742
1742
  let input = this.refs.input[index];
1743
1743
  const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test((i === null || i === void 0 ? void 0 : i.type) || '');
1744
1744
  if (input) {
1745
1745
  if (isInputRangeSelectable(input)) {
1746
- input.setSelectionRange(...selection);
1746
+ input.setSelectionRange(input.value.length, input.value.length);
1747
1747
  }
1748
1748
  }
1749
1749
  else {
@@ -2937,8 +2937,8 @@ class Component extends Element_1.default {
2937
2937
  if (this.options.alwaysDirty) {
2938
2938
  flags.dirty = true;
2939
2939
  }
2940
- if (flags.fromSubmission && this.hasValue(data) && !(this.pristine && this.protected)) {
2941
- flags.dirty = true;
2940
+ if (flags.fromSubmission && this.hasValue(data)) {
2941
+ flags.dirty = this.pristine && this.component.protected ? false : true;
2942
2942
  }
2943
2943
  this.setDirty(flags.dirty);
2944
2944
  return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
@@ -50,6 +50,6 @@ exports.default = [
50
50
  },
51
51
  utils_1.default.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
52
52
  '<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
53
- '<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="http://formio.github.io/formio.js/app/examples/conditions.html" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
53
+ '<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
54
54
  ];
55
55
  /* eslint-enable quotes, max-len */
@@ -140,7 +140,7 @@ exports.default = [
140
140
  input: true
141
141
  },
142
142
  utils_1.default.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<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>'),
143
- utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
143
+ utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
144
144
  {
145
145
  type: 'checkbox',
146
146
  input: true,
@@ -55,7 +55,7 @@ const EditFormUtils = {
55
55
  '<tr><th>value</th><td>The current value of the component.</td></tr>' +
56
56
  '<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +
57
57
  '<tr><th>_</th><td>An instance of <a href="https://lodash.com/docs/" target="_blank" rel="noopener noreferrer">Lodash</a>.</td></tr>' +
58
- '<tr><th>utils</th><td>An instance of the <a href="http://formio.github.io/formio.js/docs/identifiers.html#utils" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
58
+ '<tr><th>utils</th><td>An instance of the <a href="https://help.form.io/developers/javascript-development/javascript-utilities" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
59
59
  '<tr><th>util</th><td>An alias for "utils".</td></tr>' +
60
60
  '</table><br/>'
61
61
  /* eslint-enable prefer-template */
@@ -584,6 +584,9 @@ class DayComponent extends Field_1.default {
584
584
  * @returns {string|null} - The string value of the date.
585
585
  */
586
586
  getValueAsString(value) {
587
+ if (!value) {
588
+ return '';
589
+ }
587
590
  return this.getDate(value) || '';
588
591
  }
589
592
  focus(field) {
@@ -13,6 +13,7 @@ const utils_1 = require("../../utils/utils");
13
13
  const EditRowState = {
14
14
  New: 'new',
15
15
  Editing: 'editing',
16
+ Saving: 'saving',
16
17
  Saved: 'saved',
17
18
  Viewing: 'viewing',
18
19
  Removed: 'removed',
@@ -798,6 +799,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
798
799
  if (!this.component.rowDrafts) {
799
800
  editRow.components.forEach((comp) => comp.setPristine(false));
800
801
  }
802
+ // Mark the row with a 'Saving' state to trigger validation for future row changes
803
+ if (editRow.state === EditRowState.New) {
804
+ editRow.state = EditRowState.Saving;
805
+ }
801
806
  const errors = this.validateRow(editRow, true);
802
807
  if (!this.component.rowDrafts) {
803
808
  if (errors.length) {
@@ -810,7 +815,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
810
815
  this.root.focusedComponent = null;
811
816
  }
812
817
  switch (editRow.state) {
813
- case EditRowState.New: {
818
+ case EditRowState.Saving: {
814
819
  const newIndex = dataValue.length;
815
820
  dataValue.push(editRow.data);
816
821
  editRow.components.forEach(component => component.rowIndex = newIndex);
@@ -970,7 +975,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
970
975
  }
971
976
  shouldValidateRow(editRow, dirty) {
972
977
  return this.shouldValidateDraft(editRow) ||
973
- editRow.state === EditRowState.New ||
978
+ editRow.state === EditRowState.Saving ||
974
979
  editRow.state === EditRowState.Editing ||
975
980
  editRow.alerts ||
976
981
  dirty;
@@ -1074,6 +1079,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1074
1079
  }
1075
1080
  else if (errorContainer) {
1076
1081
  errorContainer.textContent = '';
1082
+ this.removeClass(errorContainer, 'help-block');
1077
1083
  }
1078
1084
  }
1079
1085
  }
@@ -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,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ _id: '6704f3d329cf52a3ddd4e244',
5
+ title: 'uiu',
6
+ name: 'uiu',
7
+ path: 'uiu',
8
+ type: 'resource',
9
+ display: 'form',
10
+ components: [
11
+ {
12
+ label: 'Edit Grid',
13
+ tableView: false,
14
+ validateWhenHidden: false,
15
+ rowDrafts: false,
16
+ key: 'editGrid',
17
+ type: 'editgrid',
18
+ displayAsTable: false,
19
+ input: true,
20
+ components: [
21
+ {
22
+ label: 'Columns',
23
+ columns: [
24
+ {
25
+ components: [
26
+ {
27
+ label: 'Text Field',
28
+ applyMaskOn: 'change',
29
+ tableView: true,
30
+ validate: {
31
+ required: true,
32
+ },
33
+ validateWhenHidden: false,
34
+ key: 'textField',
35
+ type: 'textfield',
36
+ input: true,
37
+ },
38
+ ],
39
+ width: 6,
40
+ offset: 0,
41
+ push: 0,
42
+ pull: 0,
43
+ size: 'md',
44
+ currentWidth: 6,
45
+ },
46
+ {
47
+ components: [],
48
+ width: 6,
49
+ offset: 0,
50
+ push: 0,
51
+ pull: 0,
52
+ size: 'md',
53
+ currentWidth: 6,
54
+ },
55
+ ],
56
+ key: 'columns',
57
+ type: 'columns',
58
+ input: false,
59
+ tableView: false,
60
+ },
61
+ ],
62
+ },
63
+ {
64
+ type: 'button',
65
+ label: 'Submit',
66
+ key: 'submit',
67
+ disableOnInvalid: true,
68
+ input: true,
69
+ tableView: false,
70
+ },
71
+ ],
72
+ project: '66f66c655879bf08113cf465',
73
+ };
@@ -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 };
@@ -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.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = 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.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = 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.comp3 = exports.comp2 = exports.comp1 = 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"));
@@ -40,6 +40,8 @@ const comp17_1 = __importDefault(require("./comp17"));
40
40
  exports.comp17 = comp17_1.default;
41
41
  const comp18_1 = __importDefault(require("./comp18"));
42
42
  exports.comp18 = comp18_1.default;
43
+ const comp19_1 = __importDefault(require("./comp19"));
44
+ exports.comp19 = comp19_1.default;
43
45
  const comp_with_conditions_and_openWhenEmpty_1 = __importDefault(require("./comp-with-conditions-and-openWhenEmpty"));
44
46
  exports.withOpenWhenEmptyAndConditions = comp_with_conditions_and_openWhenEmpty_1.default;
45
47
  const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
@@ -7,7 +7,7 @@ const utils_1 = __importDefault(require("../../_classes/component/editForm/utils
7
7
  /* eslint-disable max-len */
8
8
  exports.default = [
9
9
  utils_1.default.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>'),
10
- utils_1.default.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>'),
10
+ utils_1.default.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>'),
11
11
  {
12
12
  weight: 140,
13
13
  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,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ components: [
5
+ {
6
+ label: 'Number',
7
+ mask: true,
8
+ tableView: false,
9
+ modalEdit: true,
10
+ multiple: true,
11
+ delimiter: ',',
12
+ requireDecimal: false,
13
+ inputFormat: 'plain',
14
+ truncateMultipleSpaces: false,
15
+ key: 'number',
16
+ type: 'number',
17
+ input: true
18
+ }
19
+ ]
20
+ };
@@ -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 };
@@ -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.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = 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"));
@@ -24,3 +24,5 @@ const comp9_1 = __importDefault(require("./comp9"));
24
24
  exports.comp9 = comp9_1.default;
25
25
  const comp10_1 = __importDefault(require("./comp10"));
26
26
  exports.comp10 = comp10_1.default;
27
+ const comp11_1 = __importDefault(require("./comp11"));
28
+ exports.comp11 = comp11_1.default;
@@ -247,7 +247,11 @@ class SelectComponent extends ListComponent_1.default {
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 && lodash_1.default.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 && lodash_1.default.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 === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
@@ -1214,7 +1218,7 @@ class SelectComponent extends ListComponent_1.default {
1214
1218
  // Check to see if we need to save off the template data into our metadata.
1215
1219
  const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
1216
1220
  const shouldSaveData = !valueIsObject || this.component.reference;
1217
- if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
1221
+ if (!lodash_1.default.isNil(templateValue) && shouldSaveData && this.templateData && this.templateData[templateValue] && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
1218
1222
  const submission = this.root.submission;
1219
1223
  if (!submission.metadata) {
1220
1224
  submission.metadata = {};
@@ -1469,8 +1473,12 @@ class SelectComponent extends ListComponent_1.default {
1469
1473
  asString(value, options = {}) {
1470
1474
  var _a;
1471
1475
  value = value !== null && value !== void 0 ? value : this.getValue();
1472
- if (options.modalPreview) {
1473
- const template = this.itemTemplate(value, value);
1476
+ if (options.modalPreview || this.inDataTable) {
1477
+ if (this.inDataTable) {
1478
+ value = this.undoValueTyping(value);
1479
+ }
1480
+ const templateValue = (this.isEntireObjectDisplay() && !lodash_1.default.isObject(value.data)) ? { data: value } : value;
1481
+ const template = this.itemTemplate(templateValue, value, options);
1474
1482
  return template;
1475
1483
  }
1476
1484
  //need to convert values to strings to be able to compare values with available options that are strings
@@ -56,12 +56,6 @@ class TimeComponent extends TextField_1.default {
56
56
  }
57
57
  return value;
58
58
  }
59
- get validationValue() {
60
- if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
61
- return this.dataValue;
62
- }
63
- return this.rawData;
64
- }
65
59
  get inputInfo() {
66
60
  const info = super.inputInfo;
67
61
  info.attr.type = this.component.inputType;
@@ -14,6 +14,15 @@ exports.default = {
14
14
  'input': true,
15
15
  'inputMask': '99:99'
16
16
  },
17
+ {
18
+ 'label': 'Multiple Time',
19
+ 'inputType': 'text',
20
+ 'tableView': true,
21
+ 'key': 'multipleTime',
22
+ 'type': 'time',
23
+ 'input': true,
24
+ 'inputMask': '99:99'
25
+ },
17
26
  {
18
27
  'label': 'Submit',
19
28
  'showValidations': false,
@@ -1232,7 +1232,12 @@ export default class Webform extends NestedDataComponent {
1232
1232
  onChange(flags, changed, modified, changes) {
1233
1233
  flags = flags || {};
1234
1234
  let isChangeEventEmitted = false;
1235
- super.onChange(flags, true);
1235
+ if (this.parent?.subForm === this) {
1236
+ super.onChange({ ...flags, modified }, false);
1237
+ }
1238
+ else {
1239
+ super.onChange(flags, true);
1240
+ }
1236
1241
  const value = _.clone(this.submission);
1237
1242
  flags.changed = value.changed = changed;
1238
1243
  flags.changes = changes;
@@ -1,7 +1,7 @@
1
1
  import Component from './_classes/component/Component';
2
2
  import EditFormUtils from './_classes/component/editForm/utils';
3
3
  import BaseEditForm from './_classes/component/Component.form';
4
- import { getComponentKey } from '../utils/utils';
4
+ import { getComponentKey, getModelType } from '../utils/utils';
5
5
  import _ from 'lodash';
6
6
  export default class Components {
7
7
  static _editFormUtils = EditFormUtils;
@@ -66,6 +66,9 @@ export default class Components {
66
66
  const rowIndex = component.row;
67
67
  const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
68
68
  path = `${thisPath.path}${rowIndexPath}.`;
69
+ if (rowIndexPath && getModelType(thisPath) === 'nestedDataArray') {
70
+ path = `${path}data.`;
71
+ }
69
72
  path += componentKey;
70
73
  return _.trim(path, '.');
71
74
  }
@@ -1702,12 +1702,12 @@ export default class Component extends Element {
1702
1702
  restoreCaretPosition() {
1703
1703
  if (this.root?.currentSelection) {
1704
1704
  if (this.refs.input?.length) {
1705
- const { selection, index } = this.root.currentSelection;
1705
+ const { index } = this.root.currentSelection;
1706
1706
  let input = this.refs.input[index];
1707
1707
  const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test(i?.type || '');
1708
1708
  if (input) {
1709
1709
  if (isInputRangeSelectable(input)) {
1710
- input.setSelectionRange(...selection);
1710
+ input.setSelectionRange(input.value.length, input.value.length);
1711
1711
  }
1712
1712
  }
1713
1713
  else {
@@ -2904,8 +2904,8 @@ export default class Component extends Element {
2904
2904
  if (this.options.alwaysDirty) {
2905
2905
  flags.dirty = true;
2906
2906
  }
2907
- if (flags.fromSubmission && this.hasValue(data) && !(this.pristine && this.protected)) {
2908
- flags.dirty = true;
2907
+ if (flags.fromSubmission && this.hasValue(data)) {
2908
+ flags.dirty = this.pristine && this.component.protected ? false : true;
2909
2909
  }
2910
2910
  this.setDirty(flags.dirty);
2911
2911
  return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
@@ -45,6 +45,6 @@ export default [
45
45
  },
46
46
  EditFormUtils.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
47
47
  '<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
48
- '<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="http://formio.github.io/formio.js/app/examples/conditions.html" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
48
+ '<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
49
49
  ];
50
50
  /* eslint-enable quotes, max-len */
@@ -135,7 +135,7 @@ export default [
135
135
  input: true
136
136
  },
137
137
  EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<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>'),
138
- EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
138
+ EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<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>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
139
139
  {
140
140
  type: 'checkbox',
141
141
  input: true,
@@ -50,7 +50,7 @@ const EditFormUtils = {
50
50
  '<tr><th>value</th><td>The current value of the component.</td></tr>' +
51
51
  '<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +
52
52
  '<tr><th>_</th><td>An instance of <a href="https://lodash.com/docs/" target="_blank" rel="noopener noreferrer">Lodash</a>.</td></tr>' +
53
- '<tr><th>utils</th><td>An instance of the <a href="http://formio.github.io/formio.js/docs/identifiers.html#utils" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
53
+ '<tr><th>utils</th><td>An instance of the <a href="https://help.form.io/developers/javascript-development/javascript-utilities" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
54
54
  '<tr><th>util</th><td>An alias for "utils".</td></tr>' +
55
55
  '</table><br/>'
56
56
  /* eslint-enable prefer-template */
@@ -582,6 +582,9 @@ export default class DayComponent extends Field {
582
582
  * @returns {string|null} - The string value of the date.
583
583
  */
584
584
  getValueAsString(value) {
585
+ if (!value) {
586
+ return '';
587
+ }
585
588
  return this.getDate(value) || '';
586
589
  }
587
590
  focus(field) {
@@ -8,6 +8,7 @@ import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } fr
8
8
  const EditRowState = {
9
9
  New: 'new',
10
10
  Editing: 'editing',
11
+ Saving: 'saving',
11
12
  Saved: 'saved',
12
13
  Viewing: 'viewing',
13
14
  Removed: 'removed',
@@ -788,6 +789,10 @@ export default class EditGridComponent extends NestedArrayComponent {
788
789
  if (!this.component.rowDrafts) {
789
790
  editRow.components.forEach((comp) => comp.setPristine(false));
790
791
  }
792
+ // Mark the row with a 'Saving' state to trigger validation for future row changes
793
+ if (editRow.state === EditRowState.New) {
794
+ editRow.state = EditRowState.Saving;
795
+ }
791
796
  const errors = this.validateRow(editRow, true);
792
797
  if (!this.component.rowDrafts) {
793
798
  if (errors.length) {
@@ -800,7 +805,7 @@ export default class EditGridComponent extends NestedArrayComponent {
800
805
  this.root.focusedComponent = null;
801
806
  }
802
807
  switch (editRow.state) {
803
- case EditRowState.New: {
808
+ case EditRowState.Saving: {
804
809
  const newIndex = dataValue.length;
805
810
  dataValue.push(editRow.data);
806
811
  editRow.components.forEach(component => component.rowIndex = newIndex);
@@ -960,7 +965,7 @@ export default class EditGridComponent extends NestedArrayComponent {
960
965
  }
961
966
  shouldValidateRow(editRow, dirty) {
962
967
  return this.shouldValidateDraft(editRow) ||
963
- editRow.state === EditRowState.New ||
968
+ editRow.state === EditRowState.Saving ||
964
969
  editRow.state === EditRowState.Editing ||
965
970
  editRow.alerts ||
966
971
  dirty;
@@ -1062,6 +1067,7 @@ export default class EditGridComponent extends NestedArrayComponent {
1062
1067
  }
1063
1068
  else if (errorContainer) {
1064
1069
  errorContainer.textContent = '';
1070
+ this.removeClass(errorContainer, 'help-block');
1065
1071
  }
1066
1072
  }
1067
1073
  }