@formio/js 5.0.0-dev.5871.544083b → 5.0.0-dev.5873.124778a
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 +1 -0
- package/dist/formio.form.js +84 -84
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +84 -84
- 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/Wizard.js +1 -1
- 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/Wizard.js +1 -1
- 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
package/lib/cjs/Wizard.js
CHANGED
|
@@ -916,7 +916,7 @@ class Wizard extends Webform_1.default {
|
|
|
916
916
|
const components = !currentPageOnly || this.isLastPage()
|
|
917
917
|
? this.getComponents()
|
|
918
918
|
: this.currentPage.components;
|
|
919
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
|
919
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
920
920
|
}
|
|
921
921
|
get errors() {
|
|
922
922
|
if (!this.isLastPage()) {
|
|
@@ -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;
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -903,7 +903,7 @@ export default class Wizard extends Webform {
|
|
|
903
903
|
const components = !currentPageOnly || this.isLastPage()
|
|
904
904
|
? this.getComponents()
|
|
905
905
|
: this.currentPage.components;
|
|
906
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
|
906
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
907
907
|
}
|
|
908
908
|
get errors() {
|
|
909
909
|
if (!this.isLastPage()) {
|
|
@@ -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.5873.124778a",
|
|
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",
|