@formio/js 5.0.0-dev.5865.8754bf3 → 5.0.0-dev.5870.aa1e3d9
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/dist/formio.form.js +85 -85
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +85 -85
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +9 -9
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +69 -69
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +4 -6
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +6 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -9
- package/lib/cjs/utils/formUtils.d.ts +3 -0
- package/lib/cjs/utils/formUtils.js +5 -2
- package/lib/cjs/utils/utils.d.ts +0 -13
- package/lib/cjs/utils/utils.js +1 -33
- package/lib/mjs/components/_classes/component/Component.js +4 -6
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +6 -5
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -10
- package/lib/mjs/utils/formUtils.d.ts +3 -0
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/utils.d.ts +0 -13
- package/lib/mjs/utils/utils.js +0 -30
- package/package.json +2 -2
|
@@ -2962,14 +2962,12 @@ class Component extends Element_1.default {
|
|
|
2962
2962
|
if (flags.silentCheck) {
|
|
2963
2963
|
return [];
|
|
2964
2964
|
}
|
|
2965
|
+
let isDirty = this.dirty || flags.dirty;
|
|
2965
2966
|
if (this.options.alwaysDirty) {
|
|
2966
|
-
|
|
2967
|
+
isDirty = true;
|
|
2967
2968
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
}
|
|
2971
|
-
this.setDirty(flags.dirty);
|
|
2972
|
-
return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
|
|
2969
|
+
this.setDirty(isDirty);
|
|
2970
|
+
return this.setComponentValidity(errors, isDirty, flags.silentCheck, flags.fromSubmission);
|
|
2973
2971
|
}
|
|
2974
2972
|
/**
|
|
2975
2973
|
* Perform a component validation.
|
|
@@ -89,8 +89,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
89
89
|
hasOpenRows(): any;
|
|
90
90
|
getAttachedData(data?: null): any;
|
|
91
91
|
shouldValidateDraft(editRow: any): any;
|
|
92
|
-
shouldValidateRow(editRow: any, dirty: any): any;
|
|
93
|
-
validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
|
|
92
|
+
shouldValidateRow(editRow: any, dirty: any, fromSubmission: any): any;
|
|
93
|
+
validateRow(editRow: any, dirty: any, forceSilentCheck: any, fromSubmission: any): any;
|
|
94
94
|
showRowErrorAlerts(editRow: any, errors: any): void;
|
|
95
95
|
/**
|
|
96
96
|
* @returns {boolean} - Return that this component processes its own validation.
|
|
@@ -983,17 +983,18 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
983
983
|
!this.hasOpenRows()) ||
|
|
984
984
|
((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted);
|
|
985
985
|
}
|
|
986
|
-
shouldValidateRow(editRow, dirty) {
|
|
986
|
+
shouldValidateRow(editRow, dirty, fromSubmission) {
|
|
987
987
|
return this.shouldValidateDraft(editRow) ||
|
|
988
988
|
editRow.state === EditRowState.Saving ||
|
|
989
989
|
editRow.state === EditRowState.Editing ||
|
|
990
990
|
editRow.alerts ||
|
|
991
|
+
fromSubmission ||
|
|
991
992
|
dirty;
|
|
992
993
|
}
|
|
993
|
-
validateRow(editRow, dirty, forceSilentCheck) {
|
|
994
|
+
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
|
994
995
|
var _a;
|
|
995
996
|
editRow.errors = [];
|
|
996
|
-
if (this.shouldValidateRow(editRow, dirty)) {
|
|
997
|
+
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
|
997
998
|
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
|
998
999
|
const rootValue = (0, utils_1.fastCloneDeep)(this.rootValue);
|
|
999
1000
|
const editGridValue = lodash_1.default.get(rootValue, this.path, []);
|
|
@@ -1065,7 +1066,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
|
1067
1068
|
var _a, _b;
|
|
1068
|
-
const { silentCheck } = options;
|
|
1069
|
+
const { silentCheck, fromSubmission } = options;
|
|
1069
1070
|
const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
|
|
1070
1071
|
// If super tells us that component invalid and there is no need to update alerts, just return false
|
|
1071
1072
|
if (!superValid && (!this.alert && !this.hasOpenRows())) {
|
|
@@ -1075,7 +1076,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1075
1076
|
const allRowErrors = [];
|
|
1076
1077
|
this.editRows.forEach((editRow, index) => {
|
|
1077
1078
|
// Trigger all errors on the row.
|
|
1078
|
-
const rowErrors = this.validateRow(editRow, dirty, silentCheck);
|
|
1079
|
+
const rowErrors = this.validateRow(editRow, dirty, silentCheck, fromSubmission);
|
|
1079
1080
|
errors.push(...rowErrors);
|
|
1080
1081
|
allRowErrors.push(...rowErrors);
|
|
1081
1082
|
if (this.rowRefs) {
|
|
@@ -27,15 +27,7 @@ class IsEqualTo extends ConditionOperator_1.default {
|
|
|
27
27
|
if (conditionTriggerComponent
|
|
28
28
|
&& (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
|
|
29
29
|
&& ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
|
|
30
|
-
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
const { template, valueProperty } = conditionTriggerComponent.component;
|
|
34
|
-
if (valueProperty === 'data') {
|
|
35
|
-
value = { data: value };
|
|
36
|
-
comparedValue = { data: comparedValue };
|
|
37
|
-
}
|
|
38
|
-
return lodash_1.default.every((0, utils_1.getItemTemplateKeys)(template) || [], k => lodash_1.default.isEqual(lodash_1.default.get(value, k), lodash_1.default.get(comparedValue, k)));
|
|
30
|
+
return (0, utils_1.compareSelectResourceWithObjectTypeValues)(value, comparedValue, conditionTriggerComponent.component);
|
|
39
31
|
}
|
|
40
32
|
}
|
|
41
33
|
//special check for select boxes
|
|
@@ -41,4 +41,7 @@ export const applyFormChanges: typeof Utils.applyFormChanges;
|
|
|
41
41
|
export const findComponent: typeof Utils.findComponent;
|
|
42
42
|
export const getEmptyValue: typeof Utils.getEmptyValue;
|
|
43
43
|
export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
|
|
44
|
+
export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
|
|
45
|
+
export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
|
|
46
|
+
export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
|
|
44
47
|
import { Utils } from '@formio/core';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
|
|
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.componentChildPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES = exports.uniqueName = exports.guid = exports.flattenComponents = exports.findComponents = void 0;
|
|
4
4
|
const core_1 = require("@formio/core");
|
|
5
|
-
const { 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 } = core_1.Utils;
|
|
5
|
+
const { 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 } = core_1.Utils;
|
|
6
6
|
exports.flattenComponents = flattenComponents;
|
|
7
7
|
exports.guid = guid;
|
|
8
8
|
exports.uniqueName = uniqueName;
|
|
@@ -39,6 +39,9 @@ exports.applyFormChanges = applyFormChanges;
|
|
|
39
39
|
exports.findComponent = findComponent;
|
|
40
40
|
exports.getEmptyValue = getEmptyValue;
|
|
41
41
|
exports.isComponentDataEmpty = isComponentDataEmpty;
|
|
42
|
+
exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
|
|
43
|
+
exports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;
|
|
44
|
+
exports.getItemTemplateKeys = getItemTemplateKeys;
|
|
42
45
|
/**
|
|
43
46
|
* Deprecated version of findComponents. Renamed to searchComponents.
|
|
44
47
|
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -498,18 +498,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
|
|
|
498
498
|
* @returns {Array<string>|null} - The saved types for the component
|
|
499
499
|
*/
|
|
500
500
|
export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
|
|
501
|
-
/**
|
|
502
|
-
* Returns the template keys inside the template code.
|
|
503
|
-
* @param {string} template - The template to get the keys from.
|
|
504
|
-
* @returns {Array<string>} - The keys inside the template.
|
|
505
|
-
*/
|
|
506
|
-
export function getItemTemplateKeys(template: string): Array<string>;
|
|
507
|
-
/**
|
|
508
|
-
* Returns if the component is a select resource with an object for its value.
|
|
509
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
|
510
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
511
|
-
*/
|
|
512
|
-
export function isSelectResourceWithObjectValue(comp?: import('@formio/core').Component): boolean;
|
|
513
501
|
export * from "./formUtils";
|
|
514
502
|
/**
|
|
515
503
|
* Map values through unfold and return first non-nil value.
|
|
@@ -527,7 +515,6 @@ export namespace componentValueTypes {
|
|
|
527
515
|
let any: string;
|
|
528
516
|
}
|
|
529
517
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
|
530
|
-
import jsonLogic from 'json-logic-js';
|
|
531
518
|
import ConditionOperators from './conditionOperators';
|
|
532
519
|
import { Evaluator } from './Evaluator';
|
|
533
520
|
export const interpolate: typeof Evaluator.interpolate;
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
|
22
|
-
exports.
|
|
22
|
+
exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
|
|
23
23
|
const lodash_1 = __importDefault(require("lodash"));
|
|
24
24
|
exports._ = lodash_1.default;
|
|
25
25
|
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
|
@@ -1681,35 +1681,3 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1681
1681
|
});
|
|
1682
1682
|
};
|
|
1683
1683
|
exports.interpolateErrors = interpolateErrors;
|
|
1684
|
-
/**
|
|
1685
|
-
* Returns the template keys inside the template code.
|
|
1686
|
-
* @param {string} template - The template to get the keys from.
|
|
1687
|
-
* @returns {Array<string>} - The keys inside the template.
|
|
1688
|
-
*/
|
|
1689
|
-
function getItemTemplateKeys(template) {
|
|
1690
|
-
const templateKeys = [];
|
|
1691
|
-
if (!template) {
|
|
1692
|
-
return templateKeys;
|
|
1693
|
-
}
|
|
1694
|
-
const keys = template.match(/({{\s*(.*?)\s*}})/g);
|
|
1695
|
-
if (keys) {
|
|
1696
|
-
keys.forEach((key) => {
|
|
1697
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
|
1698
|
-
if (propKey && propKey.length > 1) {
|
|
1699
|
-
templateKeys.push(propKey[1]);
|
|
1700
|
-
}
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
return templateKeys;
|
|
1704
|
-
}
|
|
1705
|
-
exports.getItemTemplateKeys = getItemTemplateKeys;
|
|
1706
|
-
/**
|
|
1707
|
-
* Returns if the component is a select resource with an object for its value.
|
|
1708
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
|
1709
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
1710
|
-
*/
|
|
1711
|
-
function isSelectResourceWithObjectValue(comp = {}) {
|
|
1712
|
-
const { reference, dataSrc, valueProperty } = comp;
|
|
1713
|
-
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|
|
1714
|
-
}
|
|
1715
|
-
exports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;
|
|
@@ -2926,14 +2926,12 @@ export default class Component extends Element {
|
|
|
2926
2926
|
if (flags.silentCheck) {
|
|
2927
2927
|
return [];
|
|
2928
2928
|
}
|
|
2929
|
+
let isDirty = this.dirty || flags.dirty;
|
|
2929
2930
|
if (this.options.alwaysDirty) {
|
|
2930
|
-
|
|
2931
|
+
isDirty = true;
|
|
2931
2932
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
}
|
|
2935
|
-
this.setDirty(flags.dirty);
|
|
2936
|
-
return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
|
|
2933
|
+
this.setDirty(isDirty);
|
|
2934
|
+
return this.setComponentValidity(errors, isDirty, flags.silentCheck, flags.fromSubmission);
|
|
2937
2935
|
}
|
|
2938
2936
|
/**
|
|
2939
2937
|
* Perform a component validation.
|
|
@@ -89,8 +89,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
89
89
|
hasOpenRows(): any;
|
|
90
90
|
getAttachedData(data?: null): any;
|
|
91
91
|
shouldValidateDraft(editRow: any): any;
|
|
92
|
-
shouldValidateRow(editRow: any, dirty: any): any;
|
|
93
|
-
validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
|
|
92
|
+
shouldValidateRow(editRow: any, dirty: any, fromSubmission: any): any;
|
|
93
|
+
validateRow(editRow: any, dirty: any, forceSilentCheck: any, fromSubmission: any): any;
|
|
94
94
|
showRowErrorAlerts(editRow: any, errors: any): void;
|
|
95
95
|
/**
|
|
96
96
|
* @returns {boolean} - Return that this component processes its own validation.
|
|
@@ -973,16 +973,17 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
973
973
|
!this.hasOpenRows()) ||
|
|
974
974
|
this.root?.submitted;
|
|
975
975
|
}
|
|
976
|
-
shouldValidateRow(editRow, dirty) {
|
|
976
|
+
shouldValidateRow(editRow, dirty, fromSubmission) {
|
|
977
977
|
return this.shouldValidateDraft(editRow) ||
|
|
978
978
|
editRow.state === EditRowState.Saving ||
|
|
979
979
|
editRow.state === EditRowState.Editing ||
|
|
980
980
|
editRow.alerts ||
|
|
981
|
+
fromSubmission ||
|
|
981
982
|
dirty;
|
|
982
983
|
}
|
|
983
|
-
validateRow(editRow, dirty, forceSilentCheck) {
|
|
984
|
+
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
|
984
985
|
editRow.errors = [];
|
|
985
|
-
if (this.shouldValidateRow(editRow, dirty)) {
|
|
986
|
+
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
|
986
987
|
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
|
987
988
|
const rootValue = fastCloneDeep(this.rootValue);
|
|
988
989
|
const editGridValue = _.get(rootValue, this.path, []);
|
|
@@ -1053,7 +1054,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1053
1054
|
return true;
|
|
1054
1055
|
}
|
|
1055
1056
|
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
|
1056
|
-
const { silentCheck } = options;
|
|
1057
|
+
const { silentCheck, fromSubmission } = options;
|
|
1057
1058
|
const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
|
|
1058
1059
|
// If super tells us that component invalid and there is no need to update alerts, just return false
|
|
1059
1060
|
if (!superValid && (!this.alert && !this.hasOpenRows())) {
|
|
@@ -1063,7 +1064,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1063
1064
|
const allRowErrors = [];
|
|
1064
1065
|
this.editRows.forEach((editRow, index) => {
|
|
1065
1066
|
// Trigger all errors on the row.
|
|
1066
|
-
const rowErrors = this.validateRow(editRow, dirty, silentCheck);
|
|
1067
|
+
const rowErrors = this.validateRow(editRow, dirty, silentCheck, fromSubmission);
|
|
1067
1068
|
errors.push(...rowErrors);
|
|
1068
1069
|
allRowErrors.push(...rowErrors);
|
|
1069
1070
|
if (this.rowRefs) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ConditionOperator from './ConditionOperator';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import {
|
|
3
|
+
import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../utils';
|
|
4
4
|
export default class IsEqualTo extends ConditionOperator {
|
|
5
5
|
static get operatorKey() {
|
|
6
6
|
return 'isEqual';
|
|
@@ -21,15 +21,7 @@ export default class IsEqualTo extends ConditionOperator {
|
|
|
21
21
|
if (conditionTriggerComponent
|
|
22
22
|
&& isSelectResourceWithObjectValue(conditionTriggerComponent.component)
|
|
23
23
|
&& conditionTriggerComponent.component?.template) {
|
|
24
|
-
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
const { template, valueProperty } = conditionTriggerComponent.component;
|
|
28
|
-
if (valueProperty === 'data') {
|
|
29
|
-
value = { data: value };
|
|
30
|
-
comparedValue = { data: comparedValue };
|
|
31
|
-
}
|
|
32
|
-
return _.every(getItemTemplateKeys(template) || [], k => _.isEqual(_.get(value, k), _.get(comparedValue, k)));
|
|
24
|
+
return compareSelectResourceWithObjectTypeValues(value, comparedValue, conditionTriggerComponent.component);
|
|
33
25
|
}
|
|
34
26
|
}
|
|
35
27
|
//special check for select boxes
|
|
@@ -41,4 +41,7 @@ export const applyFormChanges: typeof Utils.applyFormChanges;
|
|
|
41
41
|
export const findComponent: typeof Utils.findComponent;
|
|
42
42
|
export const getEmptyValue: typeof Utils.getEmptyValue;
|
|
43
43
|
export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
|
|
44
|
+
export const isSelectResourceWithObjectValue: typeof Utils.isSelectResourceWithObjectValue;
|
|
45
|
+
export const compareSelectResourceWithObjectTypeValues: typeof Utils.compareSelectResourceWithObjectTypeValues;
|
|
46
|
+
export const getItemTemplateKeys: typeof Utils.getItemTemplateKeys;
|
|
44
47
|
import { Utils } from '@formio/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Utils } from '@formio/core';
|
|
2
|
-
const { 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 } = Utils;
|
|
2
|
+
const { 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 } = Utils;
|
|
3
3
|
/**
|
|
4
4
|
* Deprecated version of findComponents. Renamed to searchComponents.
|
|
5
5
|
* @param {import('@formio/core').Component[]} components - The components to find components within.
|
|
@@ -10,4 +10,4 @@ export function findComponents(components, query) {
|
|
|
10
10
|
console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');
|
|
11
11
|
return searchComponents(components, query);
|
|
12
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 };
|
|
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 };
|
package/lib/mjs/utils/utils.d.ts
CHANGED
|
@@ -498,18 +498,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
|
|
|
498
498
|
* @returns {Array<string>|null} - The saved types for the component
|
|
499
499
|
*/
|
|
500
500
|
export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
|
|
501
|
-
/**
|
|
502
|
-
* Returns the template keys inside the template code.
|
|
503
|
-
* @param {string} template - The template to get the keys from.
|
|
504
|
-
* @returns {Array<string>} - The keys inside the template.
|
|
505
|
-
*/
|
|
506
|
-
export function getItemTemplateKeys(template: string): Array<string>;
|
|
507
|
-
/**
|
|
508
|
-
* Returns if the component is a select resource with an object for its value.
|
|
509
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
|
510
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
511
|
-
*/
|
|
512
|
-
export function isSelectResourceWithObjectValue(comp?: import('@formio/core').Component): boolean;
|
|
513
501
|
export * from "./formUtils";
|
|
514
502
|
/**
|
|
515
503
|
* Map values through unfold and return first non-nil value.
|
|
@@ -527,7 +515,6 @@ export namespace componentValueTypes {
|
|
|
527
515
|
let any: string;
|
|
528
516
|
}
|
|
529
517
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
|
530
|
-
import jsonLogic from 'json-logic-js';
|
|
531
518
|
import ConditionOperators from './conditionOperators';
|
|
532
519
|
import { Evaluator } from './Evaluator';
|
|
533
520
|
export const interpolate: typeof Evaluator.interpolate;
|
package/lib/mjs/utils/utils.js
CHANGED
|
@@ -1587,33 +1587,3 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1587
1587
|
return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
|
|
1588
1588
|
});
|
|
1589
1589
|
};
|
|
1590
|
-
/**
|
|
1591
|
-
* Returns the template keys inside the template code.
|
|
1592
|
-
* @param {string} template - The template to get the keys from.
|
|
1593
|
-
* @returns {Array<string>} - The keys inside the template.
|
|
1594
|
-
*/
|
|
1595
|
-
export function getItemTemplateKeys(template) {
|
|
1596
|
-
const templateKeys = [];
|
|
1597
|
-
if (!template) {
|
|
1598
|
-
return templateKeys;
|
|
1599
|
-
}
|
|
1600
|
-
const keys = template.match(/({{\s*(.*?)\s*}})/g);
|
|
1601
|
-
if (keys) {
|
|
1602
|
-
keys.forEach((key) => {
|
|
1603
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
|
1604
|
-
if (propKey && propKey.length > 1) {
|
|
1605
|
-
templateKeys.push(propKey[1]);
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
return templateKeys;
|
|
1610
|
-
}
|
|
1611
|
-
/**
|
|
1612
|
-
* Returns if the component is a select resource with an object for its value.
|
|
1613
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
|
1614
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
1615
|
-
*/
|
|
1616
|
-
export function isSelectResourceWithObjectValue(comp = {}) {
|
|
1617
|
-
const { reference, dataSrc, valueProperty } = comp;
|
|
1618
|
-
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|
|
1619
|
-
}
|
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.5870.aa1e3d9",
|
|
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": "
|
|
85
|
+
"@formio/core": "v2.1.0-dev.174.9a3c6ec",
|
|
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",
|