@formio/js 5.0.0-dev.5896.56bf2bd → 5.0.0-dev.5902.1eb1690
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.
- package/Changelog.md +307 -10
- package/dist/formio.form.js +602 -590
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.js +604 -592
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +3131 -209
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +14 -0
- package/dist/formio.utils.js +58 -46
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Webform.d.ts +1 -1
- package/lib/cjs/Webform.js +27 -28
- package/lib/cjs/WebformBuilder.js +26 -35
- package/lib/cjs/Wizard.d.ts +0 -1
- package/lib/cjs/Wizard.js +19 -33
- package/lib/cjs/components/Components.d.ts +0 -7
- package/lib/cjs/components/Components.js +1 -33
- package/lib/cjs/components/_classes/component/Component.d.ts +39 -7
- package/lib/cjs/components/_classes/component/Component.js +106 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.d.ts +1 -0
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +4 -19
- package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -60
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +9 -46
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -45
- package/lib/cjs/components/datamap/DataMap.js +2 -3
- package/lib/cjs/components/editgrid/EditGrid.js +13 -13
- package/lib/cjs/components/form/Form.d.ts +1 -3
- package/lib/cjs/components/form/Form.js +20 -28
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/html/HTML.js +15 -3
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/cjs/components/signature/Signature.js +3 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.d.ts +2 -2
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.d.ts +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/cjs/utils/formUtils.d.ts +25 -14
- package/lib/cjs/utils/formUtils.js +11 -16
- package/lib/cjs/utils/i18n.js +5 -0
- package/lib/cjs/utils/utils.d.ts +1 -2
- package/lib/cjs/utils/utils.js +19 -35
- package/lib/mjs/Webform.d.ts +1 -1
- package/lib/mjs/Webform.js +24 -27
- package/lib/mjs/WebformBuilder.js +26 -35
- package/lib/mjs/Wizard.d.ts +0 -1
- package/lib/mjs/Wizard.js +16 -29
- package/lib/mjs/components/Components.d.ts +0 -7
- package/lib/mjs/components/Components.js +1 -32
- package/lib/mjs/components/_classes/component/Component.d.ts +39 -7
- package/lib/mjs/components/_classes/component/Component.js +108 -38
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.d.ts +1 -0
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +4 -19
- package/lib/mjs/components/_classes/nested/NestedComponent.js +55 -61
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +8 -43
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -45
- package/lib/mjs/components/datamap/DataMap.js +2 -3
- package/lib/mjs/components/editgrid/EditGrid.js +15 -12
- package/lib/mjs/components/form/Form.d.ts +1 -3
- package/lib/mjs/components/form/Form.js +21 -28
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/html/HTML.js +15 -3
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/mjs/components/signature/Signature.js +3 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +2 -2
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.d.ts +2 -2
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/mjs/utils/conditionOperators/IsEqualTo.d.ts +2 -2
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/mjs/utils/formUtils.d.ts +25 -14
- package/lib/mjs/utils/formUtils.js +2 -12
- package/lib/mjs/utils/i18n.js +4 -0
- package/lib/mjs/utils/utils.d.ts +1 -2
- package/lib/mjs/utils/utils.js +18 -33
- package/package.json +4 -4
|
@@ -51,9 +51,21 @@ export default class HTMLComponent extends Component {
|
|
|
51
51
|
}
|
|
52
52
|
checkRefreshOn(changed) {
|
|
53
53
|
super.checkRefreshOn(changed);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.
|
|
54
|
+
let visible;
|
|
55
|
+
if (this.hasCondition()) {
|
|
56
|
+
this._conditionallyHidden = this.checkConditionallyHidden();
|
|
57
|
+
visible = !this.conditionallyHidden;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
visible = !this.component.hidden;
|
|
61
|
+
}
|
|
62
|
+
const shouldSetContent = !this.builderMode
|
|
63
|
+
&& this.component.refreshOnChange
|
|
64
|
+
&& this.element
|
|
65
|
+
&& !_.isUndefined(changed)
|
|
66
|
+
&& ((_.isBoolean(changed) && changed) || !_.isEmpty(changed))
|
|
67
|
+
&& visible;
|
|
68
|
+
if (shouldSetContent) {
|
|
57
69
|
this.setContent(this.element, this.renderContent());
|
|
58
70
|
}
|
|
59
71
|
}
|
|
@@ -1099,6 +1099,7 @@ declare const _default: ({
|
|
|
1099
1099
|
alwaysEnabled?: undefined;
|
|
1100
1100
|
} | {
|
|
1101
1101
|
key: string;
|
|
1102
|
+
type: string;
|
|
1102
1103
|
conditional: {
|
|
1103
1104
|
json: {
|
|
1104
1105
|
and: ({
|
|
@@ -1149,7 +1150,6 @@ declare const _default: ({
|
|
|
1149
1150
|
};
|
|
1150
1151
|
};
|
|
1151
1152
|
data?: undefined;
|
|
1152
|
-
type?: undefined;
|
|
1153
1153
|
weight?: undefined;
|
|
1154
1154
|
input?: undefined;
|
|
1155
1155
|
label?: undefined;
|
|
@@ -141,6 +141,14 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
|
141
141
|
checkedValues.forEach((value) => selectData.push(this.templateData[value]));
|
|
142
142
|
_.set(submission.metadata.selectData, this.path, selectData);
|
|
143
143
|
}
|
|
144
|
+
// Ensure that for dataSrc == 'values' that there are not any other superfluous values.
|
|
145
|
+
if (this.component.dataSrc === 'values') {
|
|
146
|
+
for (const key in value) {
|
|
147
|
+
if (!this.component.values.find((val) => val.value === key)) {
|
|
148
|
+
delete value[key];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
144
152
|
return value;
|
|
145
153
|
}
|
|
146
154
|
/**
|
|
@@ -268,7 +276,6 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
|
268
276
|
else {
|
|
269
277
|
return super.setCustomValidity(messages, dirty, external);
|
|
270
278
|
}
|
|
271
|
-
;
|
|
272
279
|
}
|
|
273
280
|
validateValueAvailability(setting, value) {
|
|
274
281
|
if (!boolValue(setting) || !value) {
|
|
@@ -156,7 +156,9 @@ export default class SignatureComponent extends Input {
|
|
|
156
156
|
if (this.dataValue) {
|
|
157
157
|
this.setDataToSigaturePad();
|
|
158
158
|
}
|
|
159
|
-
this.
|
|
159
|
+
if (!this.disabled) {
|
|
160
|
+
this.showCanvas(true);
|
|
161
|
+
}
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
renderElement(value, index) {
|
|
@@ -14,13 +14,13 @@ export default class DateGeaterThan extends ConditionOperator {
|
|
|
14
14
|
return { date, comparedDate };
|
|
15
15
|
}
|
|
16
16
|
execute(options, functionName = 'isAfter') {
|
|
17
|
-
const { value, instance,
|
|
17
|
+
const { value, instance, path } = options;
|
|
18
18
|
if (!value) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
let conditionTriggerComponent = null;
|
|
22
22
|
if (instance?.root?.getComponent) {
|
|
23
|
-
conditionTriggerComponent = instance.root.getComponent(
|
|
23
|
+
conditionTriggerComponent = instance.root.getComponent(path);
|
|
24
24
|
}
|
|
25
25
|
if (conditionTriggerComponent && conditionTriggerComponent.isPartialDay && conditionTriggerComponent.isPartialDay(value)) {
|
|
26
26
|
return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class IsEmptyValue extends ConditionOperator {
|
|
2
|
-
execute({ value, instance,
|
|
2
|
+
execute({ value, instance, path }: {
|
|
3
3
|
value: any;
|
|
4
4
|
instance: any;
|
|
5
|
-
|
|
5
|
+
path: any;
|
|
6
6
|
}): any;
|
|
7
7
|
getResult(options: any): any;
|
|
8
8
|
}
|
|
@@ -10,10 +10,10 @@ export default class IsEmptyValue extends ConditionOperator {
|
|
|
10
10
|
static get requireValue() {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
-
execute({ value, instance,
|
|
13
|
+
execute({ value, instance, path }) {
|
|
14
14
|
const isEmptyValue = _.isEmpty(_.isNumber(value) ? String(value) : value);
|
|
15
15
|
if (instance?.root?.getComponent) {
|
|
16
|
-
const conditionTriggerComponent = instance.root.getComponent(
|
|
16
|
+
const conditionTriggerComponent = instance.root.getComponent(path);
|
|
17
17
|
return conditionTriggerComponent?.isEmpty ? conditionTriggerComponent.isEmpty() : isEmptyValue;
|
|
18
18
|
}
|
|
19
19
|
return isEmptyValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default class IsEqualTo extends ConditionOperator {
|
|
2
|
-
execute({ value, comparedValue, instance,
|
|
2
|
+
execute({ value, comparedValue, instance, path }: {
|
|
3
3
|
value: any;
|
|
4
4
|
comparedValue: any;
|
|
5
5
|
instance: any;
|
|
6
|
-
|
|
6
|
+
path: any;
|
|
7
7
|
}): any;
|
|
8
8
|
}
|
|
9
9
|
import ConditionOperator from './ConditionOperator';
|
|
@@ -8,7 +8,7 @@ export default class IsEqualTo extends ConditionOperator {
|
|
|
8
8
|
static get displayedName() {
|
|
9
9
|
return 'Is Equal To';
|
|
10
10
|
}
|
|
11
|
-
execute({ value, comparedValue, instance,
|
|
11
|
+
execute({ value, comparedValue, instance, path }) {
|
|
12
12
|
if ((value || value === false) && comparedValue && typeof value !== typeof comparedValue && _.isString(comparedValue)) {
|
|
13
13
|
try {
|
|
14
14
|
comparedValue = JSON.parse(comparedValue);
|
|
@@ -17,7 +17,7 @@ export default class IsEqualTo extends ConditionOperator {
|
|
|
17
17
|
catch (e) { }
|
|
18
18
|
}
|
|
19
19
|
if (instance?.root?.getComponent) {
|
|
20
|
-
const conditionTriggerComponent = instance.root.getComponent(
|
|
20
|
+
const conditionTriggerComponent = instance.root.getComponent(path);
|
|
21
21
|
if (conditionTriggerComponent
|
|
22
22
|
&& isSelectResourceWithObjectValue(conditionTriggerComponent.component)
|
|
23
23
|
&& conditionTriggerComponent.component?.template) {
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deprecated version of findComponents. Renamed to searchComponents.
|
|
3
|
-
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
|
4
|
-
* @param {object} query - The query to use when searching for the components.
|
|
5
|
-
* @returns {import('@formio/core').Component[]} - The result of the component that is found.
|
|
6
|
-
*/
|
|
7
|
-
export function findComponents(components: import('@formio/core').Component[], query: object): import('@formio/core').Component[];
|
|
8
1
|
export const flattenComponents: typeof Utils.flattenComponents;
|
|
9
2
|
export const guid: typeof Utils.guid;
|
|
10
3
|
export const uniqueName: typeof Utils.uniqueName;
|
|
11
|
-
export const
|
|
4
|
+
export const MODEL_TYPES_OF_KNOWN_COMPONENTS: {
|
|
5
|
+
nestedArray: string[];
|
|
6
|
+
nestedDataArray: string[];
|
|
7
|
+
dataObject: string[];
|
|
8
|
+
object: string[];
|
|
9
|
+
map: string[];
|
|
10
|
+
content: string[];
|
|
11
|
+
string: string[];
|
|
12
|
+
number: string[];
|
|
13
|
+
boolean: string[];
|
|
14
|
+
none: string[];
|
|
15
|
+
any: string[];
|
|
16
|
+
};
|
|
12
17
|
export const getModelType: typeof Utils.getModelType;
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
18
|
+
export const getComponentPath: any;
|
|
19
|
+
export const setComponentScope: typeof Utils.setComponentScope;
|
|
20
|
+
export const resetComponentScope: typeof Utils.resetComponentScope;
|
|
15
21
|
export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
|
|
16
22
|
export const componentPath: typeof Utils.componentPath;
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
23
|
+
export const getComponentPaths: typeof Utils.getComponentPaths;
|
|
24
|
+
export const componentMatches: typeof Utils.componentMatches;
|
|
25
|
+
export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
|
+
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
|
27
|
+
export const getComponentValue: typeof Utils.getComponentValue;
|
|
28
|
+
export const findComponents: typeof Utils.findComponents;
|
|
29
|
+
export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => Promise<void>;
|
|
30
|
+
export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => void;
|
|
20
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
|
21
32
|
export const getContextualRowPath: typeof Utils.getContextualRowPath;
|
|
22
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
|
@@ -24,7 +35,7 @@ export const componentInfo: typeof Utils.componentInfo;
|
|
|
24
35
|
export const eachComponent: typeof Utils.eachComponent;
|
|
25
36
|
export const eachComponentAsync: typeof Utils.eachComponentAsync;
|
|
26
37
|
export const getComponentData: typeof Utils.getComponentData;
|
|
27
|
-
export const getComponentActualValue:
|
|
38
|
+
export const getComponentActualValue: any;
|
|
28
39
|
export const isLayoutComponent: typeof Utils.isLayoutComponent;
|
|
29
40
|
export const matchComponent: typeof Utils.matchComponent;
|
|
30
41
|
export const getComponent: typeof Utils.getComponent;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import { Utils } from '@formio/core';
|
|
2
|
-
const { flattenComponents, guid, uniqueName,
|
|
3
|
-
|
|
4
|
-
* Deprecated version of findComponents. Renamed to searchComponents.
|
|
5
|
-
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
|
6
|
-
* @param {object} query - The query to use when searching for the components.
|
|
7
|
-
* @returns {import('@formio/core').Component[]} - The result of the component that is found.
|
|
8
|
-
*/
|
|
9
|
-
export function findComponents(components, query) {
|
|
10
|
-
console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');
|
|
11
|
-
return searchComponents(components, query);
|
|
12
|
-
}
|
|
13
|
-
export { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentNestedDataType, componentPath, componentChildPath, 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 };
|
|
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 };
|
package/lib/mjs/utils/i18n.js
CHANGED
|
@@ -74,6 +74,10 @@ export class I18n {
|
|
|
74
74
|
}
|
|
75
75
|
t(text, ...args) {
|
|
76
76
|
if (this.currentLanguage[text]) {
|
|
77
|
+
const customTranslationFieldName = args[0]?.field;
|
|
78
|
+
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
|
79
|
+
args[0].field = this.currentLanguage[customTranslationFieldName];
|
|
80
|
+
}
|
|
77
81
|
return Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
78
82
|
}
|
|
79
83
|
return Evaluator.interpolateString(text, ...args);
|
package/lib/mjs/utils/utils.d.ts
CHANGED
|
@@ -462,10 +462,9 @@ export function getComponentPathWithoutIndicies(path?: string): string;
|
|
|
462
462
|
/**
|
|
463
463
|
* Returns a path to the component which based on its schema
|
|
464
464
|
* @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
|
|
465
|
-
* @param {string} path - Path to the component
|
|
466
465
|
* @returns {string} - Path to the component
|
|
467
466
|
*/
|
|
468
|
-
export function getComponentPath(component: import('@formio/core').Component
|
|
467
|
+
export function getComponentPath(component: import('@formio/core').Component): string;
|
|
469
468
|
/**
|
|
470
469
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
|
471
470
|
* @param {Component} componentInstance - The component to check for the parent.
|
package/lib/mjs/utils/utils.js
CHANGED
|
@@ -25,17 +25,6 @@ jsonLogic.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
|
|
25
25
|
return moment().add(relativeMaxDate, 'days').toISOString();
|
|
26
26
|
});
|
|
27
27
|
export { jsonLogic, ConditionOperators, moment };
|
|
28
|
-
/**
|
|
29
|
-
* Sets the path to the component and parent schema.
|
|
30
|
-
* @param {import('@formio/core').Component} component - The component to set the path for.
|
|
31
|
-
*/
|
|
32
|
-
function setPathToComponentAndPerentSchema(component) {
|
|
33
|
-
component.path = getComponentPath(component);
|
|
34
|
-
const dataParent = getDataParentComponent(component);
|
|
35
|
-
if (dataParent && typeof dataParent === 'object') {
|
|
36
|
-
dataParent.path = getComponentPath(dataParent);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
28
|
/**
|
|
40
29
|
* Evaluate a method.
|
|
41
30
|
* @param {Function|string|object} func - The function to evaluate.
|
|
@@ -227,7 +216,7 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
|
227
216
|
const value = getComponentActualValue(path, data, row);
|
|
228
217
|
const ConditionOperator = ConditionOperators[operator];
|
|
229
218
|
return ConditionOperator
|
|
230
|
-
? new ConditionOperator().getResult({ value, comparedValue, instance, component,
|
|
219
|
+
? new ConditionOperator().getResult({ value, comparedValue, instance, component, path })
|
|
231
220
|
: true;
|
|
232
221
|
});
|
|
233
222
|
}
|
|
@@ -235,7 +224,7 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
|
235
224
|
const value = getComponentActualValue(conditionComponentPath, data, row);
|
|
236
225
|
const СonditionOperator = ConditionOperators[operator];
|
|
237
226
|
return СonditionOperator
|
|
238
|
-
? new СonditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
|
|
227
|
+
? new СonditionOperator().getResult({ value, comparedValue, instance, component, path: conditionComponentPath })
|
|
239
228
|
: true;
|
|
240
229
|
}
|
|
241
230
|
});
|
|
@@ -259,12 +248,12 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
|
259
248
|
*/
|
|
260
249
|
export function getComponentActualValue(compPath, data, row) {
|
|
261
250
|
let value = null;
|
|
262
|
-
if (
|
|
263
|
-
value = getValue({ data: row }, compPath);
|
|
264
|
-
}
|
|
265
|
-
if (data && _.isNil(value)) {
|
|
251
|
+
if (data) {
|
|
266
252
|
value = getValue({ data }, compPath);
|
|
267
253
|
}
|
|
254
|
+
if (row && _.isNil(value)) {
|
|
255
|
+
value = getValue({ data: row }, compPath);
|
|
256
|
+
}
|
|
268
257
|
// FOR-400 - Fix issue where falsey values were being evaluated as show=true
|
|
269
258
|
if (_.isNil(value) || (_.isObject(value) && _.isEmpty(value))) {
|
|
270
259
|
value = '';
|
|
@@ -332,17 +321,18 @@ function getRow(component, row, instance, conditional) {
|
|
|
332
321
|
// If no component's instance passed (happens only in 6.x server), calculate its path based on the schema
|
|
333
322
|
if (!instance) {
|
|
334
323
|
instance = _.cloneDeep(component);
|
|
335
|
-
setPathToComponentAndPerentSchema(instance);
|
|
336
324
|
}
|
|
337
325
|
const dataParent = getDataParentComponent(instance);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
326
|
+
if (dataParent) {
|
|
327
|
+
const parentPath = dataParent.paths?.localDataPath;
|
|
328
|
+
const isTriggerCondtionComponentPath = condition.when || !condition.conditions
|
|
329
|
+
? condition.when?.startsWith(dataParent.paths?.localPath)
|
|
330
|
+
: _.some(condition.conditions, cond => cond.component.startsWith(dataParent.paths?.localPath));
|
|
331
|
+
if (isTriggerCondtionComponentPath) {
|
|
332
|
+
const newRow = {};
|
|
333
|
+
_.set(newRow, parentPath, row);
|
|
334
|
+
row = newRow;
|
|
335
|
+
}
|
|
346
336
|
}
|
|
347
337
|
return row;
|
|
348
338
|
}
|
|
@@ -1478,15 +1468,10 @@ export function getComponentPathWithoutIndicies(path = '') {
|
|
|
1478
1468
|
/**
|
|
1479
1469
|
* Returns a path to the component which based on its schema
|
|
1480
1470
|
* @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
|
|
1481
|
-
* @param {string} path - Path to the component
|
|
1482
1471
|
* @returns {string} - Path to the component
|
|
1483
1472
|
*/
|
|
1484
|
-
export function getComponentPath(component
|
|
1485
|
-
|
|
1486
|
-
return path;
|
|
1487
|
-
}
|
|
1488
|
-
path = component.isInputComponent || component.input === true ? `${component.key}${path ? '.' : ''}${path}` : path;
|
|
1489
|
-
return getComponentPath(component.parent, path);
|
|
1473
|
+
export function getComponentPath(component) {
|
|
1474
|
+
return component.paths.localDataPath;
|
|
1490
1475
|
}
|
|
1491
1476
|
/**
|
|
1492
1477
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5902.1eb1690",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
},
|
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@formio/bootstrap": "3.0.0-dev.
|
|
83
|
+
"@formio/bootstrap": "3.0.0-dev.111.ae7f187",
|
|
84
84
|
"@formio/choices.js": "^10.2.1",
|
|
85
|
-
"@formio/core": "
|
|
86
|
-
"@formio/text-mask-addons": "
|
|
85
|
+
"@formio/core": "2.1.0-dev.193.68cf8c3",
|
|
86
|
+
"@formio/text-mask-addons": "3.8.0-formio.4",
|
|
87
87
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
|
88
88
|
"abortcontroller-polyfill": "^1.7.5",
|
|
89
89
|
"autocompleter": "^8.0.4",
|