@formio/js 5.0.0-dev.5846.7f5a910 → 5.0.0-dev.5846.9041a67

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.
@@ -1238,9 +1238,15 @@ class Webform extends NestedDataComponent_1.default {
1238
1238
  * @param {any} changes - The changes that have occured in the form.
1239
1239
  */
1240
1240
  onChange(flags, changed, modified, changes) {
1241
+ var _a;
1241
1242
  flags = flags || {};
1242
1243
  let isChangeEventEmitted = false;
1243
- super.onChange(flags, true);
1244
+ if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.subForm) === this) {
1245
+ super.onChange(Object.assign(Object.assign({}, flags), { modified }), false);
1246
+ }
1247
+ else {
1248
+ super.onChange(flags, true);
1249
+ }
1244
1250
  const value = lodash_1.default.clone(this.submission);
1245
1251
  flags.changed = value.changed = changed;
1246
1252
  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
  }
@@ -2967,7 +2967,7 @@ class Component extends Element_1.default {
2967
2967
  dirty = true;
2968
2968
  }
2969
2969
  if (flags.fromSubmission && !lodash_1.default.isUndefined(lodash_1.default.get((_a = flags === null || flags === void 0 ? void 0 : flags.submission) === null || _a === void 0 ? void 0 : _a.data, this.key)) && !(this.pristine && this.protected)) {
2970
- dirty = this.pristine && this.component.protected ? false : true;
2970
+ dirty = true;
2971
2971
  }
2972
2972
  this.setDirty(dirty);
2973
2973
  return this.setComponentValidity(errors, dirty, flags.silentCheck, flags.fromSubmission);
@@ -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: 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;
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;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
@@ -1242,7 +1242,12 @@ export default class Webform extends NestedDataComponent {
1242
1242
  onChange(flags, changed, modified, changes) {
1243
1243
  flags = flags || {};
1244
1244
  let isChangeEventEmitted = false;
1245
- super.onChange(flags, true);
1245
+ if (this.parent?.subForm === this) {
1246
+ super.onChange({ ...flags, modified }, false);
1247
+ }
1248
+ else {
1249
+ super.onChange(flags, true);
1250
+ }
1246
1251
  const value = _.clone(this.submission);
1247
1252
  flags.changed = value.changed = changed;
1248
1253
  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
  }
@@ -2930,7 +2930,7 @@ export default class Component extends Element {
2930
2930
  dirty = true;
2931
2931
  }
2932
2932
  if (flags.fromSubmission && !_.isUndefined(_.get(flags?.submission?.data, this.key)) && !(this.pristine && this.protected)) {
2933
- dirty = this.pristine && this.component.protected ? false : true;
2933
+ dirty = true;
2934
2934
  }
2935
2935
  this.setDirty(dirty);
2936
2936
  return this.setComponentValidity(errors, dirty, flags.silentCheck, flags.fromSubmission);
@@ -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: 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;
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;
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.5846.7f5a910",
3
+ "version": "5.0.0-dev.5846.9041a67",
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.156.78a83fd",
85
+ "@formio/core": "v2.1.0-dev.165.e6994a9",
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",