@formio/js 5.1.0-dev.6227.3eac551 → 5.1.0-dev.6231.bbaf317

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.
@@ -7,6 +7,7 @@ const Component_1 = __importDefault(require("./_classes/component/Component"));
7
7
  const utils_1 = __importDefault(require("./_classes/component/editForm/utils"));
8
8
  const Component_form_1 = __importDefault(require("./_classes/component/Component.form"));
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
+ const utils_2 = require("../utils");
10
11
  class Components {
11
12
  static set EditFormUtils(value) {
12
13
  Components._editFormUtils = value;
@@ -72,7 +73,7 @@ class Components {
72
73
  else {
73
74
  comp = new Component_1.default(component, options, data);
74
75
  }
75
- if (comp.path) {
76
+ if (comp.path && (0, utils_2.isDataComponent)(comp.component)) {
76
77
  comp.componentsMap[comp.path] = comp;
77
78
  }
78
79
  // Reset the componentMatches on the root element if any new component is created.
@@ -55,4 +55,10 @@ export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
55
55
  export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
56
56
  export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
57
57
  export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
58
+ /**
59
+ * Checks if the component is expected to have data in submission object.
60
+ * @param {import('@formio/core').Component} component - The component to check.
61
+ * @returns {boolean} - TRUE if the component is a data component.
62
+ */
63
+ export function isDataComponent(component: import('@formio/core').Component): boolean;
58
64
  import { Utils } from '@formio/core';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getItemTemplateKeys = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.findComponents = exports.getComponentValue = exports.getComponentFromPath = exports.getBestMatch = exports.componentMatches = exports.getComponentPaths = exports.componentPath = exports.isComponentNestedDataType = exports.resetComponentScope = exports.setComponentScope = exports.getComponentPath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;
3
+ exports.isDataComponent = exports.getItemTemplateKeys = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.eachComponentAsync = exports.eachComponent = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.eachComponentData = exports.eachComponentDataAsync = exports.findComponents = exports.getComponentValue = exports.getComponentFromPath = exports.getBestMatch = exports.componentMatches = exports.getComponentPaths = exports.componentPath = exports.isComponentNestedDataType = exports.resetComponentScope = exports.setComponentScope = exports.getComponentPath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;
4
4
  const core_1 = require("@formio/core");
5
5
  const { flattenComponents, guid, uniqueName, MODEL_TYPES_OF_KNOWN_COMPONENTS, getModelType, getComponentPath, setComponentScope, resetComponentScope, isComponentNestedDataType, componentPath, getComponentPaths, componentMatches, getBestMatch, getComponentFromPath, getComponentValue, findComponents, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys } = core_1.Utils;
6
6
  exports.flattenComponents = flattenComponents;
@@ -48,3 +48,13 @@ exports.isComponentDataEmpty = isComponentDataEmpty;
48
48
  exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
49
49
  exports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;
50
50
  exports.getItemTemplateKeys = getItemTemplateKeys;
51
+ /**
52
+ * Checks if the component is expected to have data in submission object.
53
+ * @param {import('@formio/core').Component} component - The component to check.
54
+ * @returns {boolean} - TRUE if the component is a data component.
55
+ */
56
+ function isDataComponent(component) {
57
+ const modelType = getModelType(component);
58
+ return modelType !== 'none' && modelType !== 'content';
59
+ }
60
+ exports.isDataComponent = isDataComponent;
@@ -66,6 +66,7 @@ declare const FormioUtils: {
66
66
  isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
67
67
  compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
68
68
  getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
69
+ isDataComponent: typeof formUtils.isDataComponent;
69
70
  evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
70
71
  getRandomComponentId(): string;
71
72
  getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
@@ -168,4 +169,5 @@ import { DefaultEvaluator } from './Evaluator';
168
169
  import { registerEvaluator } from './Evaluator';
169
170
  import { interpolate } from './Evaluator';
170
171
  import moment from 'moment';
172
+ import * as formUtils from './formUtils';
171
173
  export { FormioUtils as Utils, Evaluator, DefaultEvaluator, registerEvaluator };
@@ -2,6 +2,7 @@ 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
4
  import _ from 'lodash';
5
+ import { isDataComponent } from '../utils';
5
6
  export default class Components {
6
7
  static _editFormUtils = EditFormUtils;
7
8
  static _baseEditForm = BaseEditForm;
@@ -69,7 +70,7 @@ export default class Components {
69
70
  else {
70
71
  comp = new Component(component, options, data);
71
72
  }
72
- if (comp.path) {
73
+ if (comp.path && isDataComponent(comp.component)) {
73
74
  comp.componentsMap[comp.path] = comp;
74
75
  }
75
76
  // Reset the componentMatches on the root element if any new component is created.
@@ -55,4 +55,10 @@ export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
55
55
  export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
56
56
  export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
57
57
  export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
58
+ /**
59
+ * Checks if the component is expected to have data in submission object.
60
+ * @param {import('@formio/core').Component} component - The component to check.
61
+ * @returns {boolean} - TRUE if the component is a data component.
62
+ */
63
+ export function isDataComponent(component: import('@formio/core').Component): boolean;
58
64
  import { Utils } from '@formio/core';
@@ -1,3 +1,12 @@
1
1
  import { Utils } from '@formio/core';
2
2
  const { flattenComponents, guid, uniqueName, MODEL_TYPES_OF_KNOWN_COMPONENTS, getModelType, getComponentPath, setComponentScope, resetComponentScope, isComponentNestedDataType, componentPath, getComponentPaths, componentMatches, getBestMatch, getComponentFromPath, getComponentValue, findComponents, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys } = Utils;
3
- export { flattenComponents, guid, uniqueName, MODEL_TYPES_OF_KNOWN_COMPONENTS, getModelType, getComponentPath, setComponentScope, resetComponentScope, isComponentNestedDataType, componentPath, getComponentPaths, componentMatches, getBestMatch, getComponentFromPath, getComponentValue, findComponents, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys };
3
+ /**
4
+ * Checks if the component is expected to have data in submission object.
5
+ * @param {import('@formio/core').Component} component - The component to check.
6
+ * @returns {boolean} - TRUE if the component is a data component.
7
+ */
8
+ function isDataComponent(component) {
9
+ const modelType = getModelType(component);
10
+ return modelType !== 'none' && modelType !== 'content';
11
+ }
12
+ export { flattenComponents, guid, uniqueName, MODEL_TYPES_OF_KNOWN_COMPONENTS, getModelType, getComponentPath, setComponentScope, resetComponentScope, isComponentNestedDataType, componentPath, getComponentPaths, componentMatches, getBestMatch, getComponentFromPath, getComponentValue, findComponents, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty, isSelectResourceWithObjectValue, compareSelectResourceWithObjectTypeValues, getItemTemplateKeys, isDataComponent };
@@ -66,6 +66,7 @@ declare const FormioUtils: {
66
66
  isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
67
67
  compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
68
68
  getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
69
+ isDataComponent: typeof formUtils.isDataComponent;
69
70
  evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
70
71
  getRandomComponentId(): string;
71
72
  getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
@@ -168,4 +169,5 @@ import { DefaultEvaluator } from './Evaluator';
168
169
  import { registerEvaluator } from './Evaluator';
169
170
  import { interpolate } from './Evaluator';
170
171
  import moment from 'moment';
172
+ import * as formUtils from './formUtils';
171
173
  export { FormioUtils as Utils, Evaluator, DefaultEvaluator, registerEvaluator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6227.3eac551",
3
+ "version": "5.1.0-dev.6231.bbaf317",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {