@formio/js 5.0.0-dev.5853.716ddda → 5.0.0-dev.5855.daa98f8

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.
@@ -1237,9 +1237,15 @@ class Webform extends NestedDataComponent_1.default {
1237
1237
  * @param {any} changes - The changes that have occured in the form.
1238
1238
  */
1239
1239
  onChange(flags, changed, modified, changes) {
1240
+ var _a;
1240
1241
  flags = flags || {};
1241
1242
  let isChangeEventEmitted = false;
1242
- super.onChange(flags, true);
1243
+ if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.subForm) === this) {
1244
+ super.onChange(Object.assign(Object.assign({}, flags), { modified }), false);
1245
+ }
1246
+ else {
1247
+ super.onChange(flags, true);
1248
+ }
1243
1249
  const value = lodash_1.default.clone(this.submission);
1244
1250
  flags.changed = value.changed = changed;
1245
1251
  flags.changes = changes;
@@ -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',
@@ -808,6 +809,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
808
809
  if (!this.component.rowDrafts) {
809
810
  editRow.components.forEach((comp) => comp.setPristine(false));
810
811
  }
812
+ // Mark the row with a 'Saving' state to trigger validation for future row changes
813
+ if (editRow.state === EditRowState.New) {
814
+ editRow.state = EditRowState.Saving;
815
+ }
811
816
  const errors = this.validateRow(editRow, true);
812
817
  if (!this.component.rowDrafts) {
813
818
  if (errors.length) {
@@ -820,7 +825,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
820
825
  this.root.focusedComponent = null;
821
826
  }
822
827
  switch (editRow.state) {
823
- case EditRowState.New: {
828
+ case EditRowState.Saving: {
824
829
  const newIndex = dataValue.length;
825
830
  dataValue.push(editRow.data);
826
831
  editRow.components.forEach(component => component.rowIndex = newIndex);
@@ -980,7 +985,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
980
985
  }
981
986
  shouldValidateRow(editRow, dirty) {
982
987
  return this.shouldValidateDraft(editRow) ||
983
- editRow.state === EditRowState.New ||
988
+ editRow.state === EditRowState.Saving ||
984
989
  editRow.state === EditRowState.Editing ||
985
990
  editRow.alerts ||
986
991
  dirty;
@@ -1084,6 +1089,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1084
1089
  }
1085
1090
  else if (errorContainer) {
1086
1091
  errorContainer.textContent = '';
1092
+ this.removeClass(errorContainer, 'help-block');
1087
1093
  }
1088
1094
  }
1089
1095
  }
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
@@ -1241,7 +1241,12 @@ export default class Webform extends NestedDataComponent {
1241
1241
  onChange(flags, changed, modified, changes) {
1242
1242
  flags = flags || {};
1243
1243
  let isChangeEventEmitted = false;
1244
- super.onChange(flags, true);
1244
+ if (this.parent?.subForm === this) {
1245
+ super.onChange({ ...flags, modified }, false);
1246
+ }
1247
+ else {
1248
+ super.onChange(flags, true);
1249
+ }
1245
1250
  const value = _.clone(this.submission);
1246
1251
  flags.changed = value.changed = changed;
1247
1252
  flags.changes = changes;
@@ -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',
@@ -798,6 +799,10 @@ export default class EditGridComponent extends NestedArrayComponent {
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 @@ export default class EditGridComponent extends NestedArrayComponent {
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 @@ export default class EditGridComponent extends NestedArrayComponent {
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;
@@ -1072,6 +1077,7 @@ export default class EditGridComponent extends NestedArrayComponent {
1072
1077
  }
1073
1078
  else if (errorContainer) {
1074
1079
  errorContainer.textContent = '';
1080
+ this.removeClass(errorContainer, 'help-block');
1075
1081
  }
1076
1082
  }
1077
1083
  }
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5853.716ddda",
3
+ "version": "5.0.0-dev.5855.daa98f8",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -82,7 +82,7 @@
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
84
84
  "@formio/choices.js": "^10.2.1",
85
- "@formio/core": "v2.1.0-dev.165.e6994a9",
85
+ "@formio/core": "v2.1.0-dev.156.78a83fd",
86
86
  "@formio/text-mask-addons": "^3.8.0-formio.2",
87
87
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
88
88
  "abortcontroller-polyfill": "^1.7.5",