@formio/js 5.0.0-dev.5860.a296208 → 5.0.0-dev.5863.8f10146
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 +16 -14
- package/dist/formio.form.js +97 -97
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +98 -98
- 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 +71 -71
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -0
- package/lib/cjs/components/day/Day.js +15 -0
- package/lib/cjs/components/editgrid/EditGrid.js +6 -8
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -0
- package/lib/cjs/components/radio/Radio.js +13 -4
- package/lib/cjs/components/select/Select.d.ts +1 -1
- package/lib/cjs/components/select/Select.js +12 -5
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -2
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/cjs/components/textarea/TextArea.js +4 -4
- package/lib/cjs/components/time/Time.js +0 -6
- 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/components/_classes/component/Component.js +2 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -0
- package/lib/mjs/components/day/Day.js +15 -0
- package/lib/mjs/components/editgrid/EditGrid.js +6 -8
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -0
- package/lib/mjs/components/radio/Radio.js +13 -4
- package/lib/mjs/components/select/Select.d.ts +1 -1
- package/lib/mjs/components/select/Select.js +11 -4
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -2
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/mjs/components/textarea/TextArea.js +4 -4
- package/lib/mjs/components/time/Time.js +0 -6
- 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
|
@@ -8,7 +8,6 @@ import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } fr
|
|
|
8
8
|
const EditRowState = {
|
|
9
9
|
New: 'new',
|
|
10
10
|
Editing: 'editing',
|
|
11
|
-
Saving: 'saving',
|
|
12
11
|
Saved: 'saved',
|
|
13
12
|
Viewing: 'viewing',
|
|
14
13
|
Removed: 'removed',
|
|
@@ -799,10 +798,6 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
799
798
|
if (!this.component.rowDrafts) {
|
|
800
799
|
editRow.components.forEach((comp) => comp.setPristine(false));
|
|
801
800
|
}
|
|
802
|
-
// Mark the row with a 'Saving' state to trigger validation for future row changes
|
|
803
|
-
if (editRow.state === EditRowState.New) {
|
|
804
|
-
editRow.state = EditRowState.Saving;
|
|
805
|
-
}
|
|
806
801
|
const errors = this.validateRow(editRow, true);
|
|
807
802
|
if (!this.component.rowDrafts) {
|
|
808
803
|
if (errors.length) {
|
|
@@ -815,7 +810,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
815
810
|
this.root.focusedComponent = null;
|
|
816
811
|
}
|
|
817
812
|
switch (editRow.state) {
|
|
818
|
-
case EditRowState.
|
|
813
|
+
case EditRowState.New: {
|
|
819
814
|
const newIndex = dataValue.length;
|
|
820
815
|
dataValue.push(editRow.data);
|
|
821
816
|
editRow.components.forEach(component => component.rowIndex = newIndex);
|
|
@@ -975,7 +970,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
975
970
|
}
|
|
976
971
|
shouldValidateRow(editRow, dirty, fromSubmission) {
|
|
977
972
|
return this.shouldValidateDraft(editRow) ||
|
|
978
|
-
editRow.state === EditRowState.
|
|
973
|
+
editRow.state === EditRowState.New ||
|
|
979
974
|
editRow.state === EditRowState.Editing ||
|
|
980
975
|
editRow.alerts ||
|
|
981
976
|
fromSubmission ||
|
|
@@ -990,7 +985,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
990
985
|
editGridValue[editRow.rowIndex] = editRow.data;
|
|
991
986
|
_.set(rootValue, this.path, editGridValue);
|
|
992
987
|
const validationProcessorProcess = (context) => this.validationProcessor(context, { dirty, silentCheck });
|
|
993
|
-
|
|
988
|
+
const errors = processSync({
|
|
994
989
|
components: fastCloneDeep(this.component.components).map((component) => {
|
|
995
990
|
component.parentPath = `${this.path}[${editRow.rowIndex}]`;
|
|
996
991
|
return component;
|
|
@@ -1007,6 +1002,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1007
1002
|
}
|
|
1008
1003
|
]
|
|
1009
1004
|
}).errors;
|
|
1005
|
+
editRow.errors = (this.component.modal || this.component.rowDrafts)
|
|
1006
|
+
? errors
|
|
1007
|
+
: errors.filter((err) => _.find(this.visibleErrors, ['component.id', err.component.id]));
|
|
1010
1008
|
}
|
|
1011
1009
|
// TODO: this is essentially running its own custom validation and should be moved into a validation rule
|
|
1012
1010
|
if (this.component.validate && this.component.validate.row) {
|
|
@@ -2,7 +2,7 @@ import EditFormUtils from '../../_classes/component/editForm/utils';
|
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
3
|
export default [
|
|
4
4
|
EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 120, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
|
|
5
|
-
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="
|
|
5
|
+
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'),
|
|
6
6
|
{
|
|
7
7
|
weight: 140,
|
|
8
8
|
type: 'checkbox',
|
|
@@ -21,6 +21,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
21
21
|
get isRadio(): boolean;
|
|
22
22
|
get optionSelectedClass(): string;
|
|
23
23
|
get listData(): any;
|
|
24
|
+
get selectMetadata(): any;
|
|
24
25
|
templateData: {} | undefined;
|
|
25
26
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
|
26
27
|
itemsLoadedResolve: ((value: any) => void) | undefined;
|
|
@@ -109,6 +109,12 @@ export default class RadioComponent extends ListComponent {
|
|
|
109
109
|
const listData = _.get(this.root, 'submission.metadata.listData', {});
|
|
110
110
|
return _.get(listData, this.path);
|
|
111
111
|
}
|
|
112
|
+
get selectMetadata() {
|
|
113
|
+
return super.selectData;
|
|
114
|
+
}
|
|
115
|
+
get selectData() {
|
|
116
|
+
return this.selectMetadata || this.component.selectData;
|
|
117
|
+
}
|
|
112
118
|
init() {
|
|
113
119
|
super.init();
|
|
114
120
|
this.templateData = {};
|
|
@@ -244,12 +250,15 @@ export default class RadioComponent extends ListComponent {
|
|
|
244
250
|
else if (!_.isString(value)) {
|
|
245
251
|
value = _.toString(value);
|
|
246
252
|
}
|
|
247
|
-
const
|
|
248
|
-
|
|
253
|
+
const shouldUseSelectData = (options.modalPreview || this.inDataTable)
|
|
254
|
+
&& this.component.dataSrc === 'url' && (this.loadedOptions.length || this.selectData);
|
|
255
|
+
if (this.component.dataSrc !== 'values' && !shouldUseSelectData) {
|
|
249
256
|
return value;
|
|
250
257
|
}
|
|
251
|
-
const values =
|
|
252
|
-
const option =
|
|
258
|
+
const values = shouldUseSelectData ? this.loadedOptions : this.component.values;
|
|
259
|
+
const option = !values?.length && shouldUseSelectData ? {
|
|
260
|
+
label: this.itemTemplate(this.selectData),
|
|
261
|
+
} : _.find(values, (v) => v.value === value);
|
|
253
262
|
if (!value) {
|
|
254
263
|
return _.get(option, 'label', '');
|
|
255
264
|
}
|
|
@@ -131,7 +131,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
131
131
|
addCurrentChoices(values: any, items: any, keyValue: any): any;
|
|
132
132
|
getValueAsString(data: any, options: any): any;
|
|
133
133
|
normalizeSingleValue(value: any): any;
|
|
134
|
-
setMetadata(value: any): any;
|
|
134
|
+
setMetadata(value: any, flags?: {}): any;
|
|
135
135
|
updateValue(value: any, flags: any): boolean;
|
|
136
136
|
undoValueTyping(value: any): any;
|
|
137
137
|
setValue(value: any, flags?: {}): boolean;
|
|
@@ -1233,7 +1233,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1233
1233
|
}
|
|
1234
1234
|
return super.normalizeValue(this.normalizeSingleValue(value));
|
|
1235
1235
|
}
|
|
1236
|
-
setMetadata(value) {
|
|
1236
|
+
setMetadata(value, flags = {}) {
|
|
1237
1237
|
if (_.isNil(value)) {
|
|
1238
1238
|
return;
|
|
1239
1239
|
}
|
|
@@ -1267,15 +1267,22 @@ export default class SelectComponent extends ListComponent {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
_.set(submission.metadata.selectData, this.path, templateData);
|
|
1269
1269
|
}
|
|
1270
|
+
if (flags.resetValue && this.root?.submission) {
|
|
1271
|
+
const submission = this.root.submission;
|
|
1272
|
+
if (!submission.metadata) {
|
|
1273
|
+
submission.metadata = {};
|
|
1274
|
+
}
|
|
1275
|
+
submission.metadata.selectData = {};
|
|
1276
|
+
}
|
|
1270
1277
|
}
|
|
1271
1278
|
updateValue(value, flags) {
|
|
1272
1279
|
const changed = super.updateValue(value, flags);
|
|
1273
|
-
if (changed || !this.selectMetadata) {
|
|
1280
|
+
if (changed || !this.selectMetadata || flags.resetValue) {
|
|
1274
1281
|
if (this.component.multiple && Array.isArray(this.dataValue)) {
|
|
1275
|
-
this.dataValue.forEach(singleValue => this.setMetadata(singleValue));
|
|
1282
|
+
this.dataValue.forEach(singleValue => this.setMetadata(singleValue, flags));
|
|
1276
1283
|
}
|
|
1277
1284
|
else {
|
|
1278
|
-
this.setMetadata(this.dataValue);
|
|
1285
|
+
this.setMetadata(this.dataValue, flags);
|
|
1279
1286
|
}
|
|
1280
1287
|
}
|
|
1281
1288
|
return changed;
|
|
@@ -172,8 +172,14 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
|
172
172
|
return '';
|
|
173
173
|
}
|
|
174
174
|
if (this.isSelectURL) {
|
|
175
|
-
if (options.modalPreview
|
|
176
|
-
|
|
175
|
+
if (options.modalPreview || this.options.readOnly || this.inDataTable) {
|
|
176
|
+
const checkedItems = _.keys(_.pickBy(value, (val) => val));
|
|
177
|
+
if (this.selectData?.length === checkedItems.length) {
|
|
178
|
+
return this.selectData.map(item => this.itemTemplate(item)).join(', ');
|
|
179
|
+
}
|
|
180
|
+
else if (this.loadedOptions?.length) {
|
|
181
|
+
return this.loadedOptions.filter((option) => value[option.value]).map((option) => option.label).join(', ');
|
|
182
|
+
}
|
|
177
183
|
}
|
|
178
184
|
return _(value).pickBy((val) => val).keys().join(', ');
|
|
179
185
|
}
|
|
@@ -20,10 +20,10 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
20
20
|
setReadOnlyValue(value: any, index: any): void;
|
|
21
21
|
get isJsonValue(): any;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
24
|
+
* @param {*} value - The value to normalize
|
|
25
|
+
* @returns {*} - Returns the normalized value
|
|
26
|
+
*/
|
|
27
27
|
normalizeValue(value: any): any;
|
|
28
28
|
normalizeSingleValue(value: any): any;
|
|
29
29
|
setConvertedValue(value: any, index: any): any;
|
|
@@ -305,10 +305,10 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
305
305
|
return this.component.as && this.component.as === 'json';
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
309
|
+
* @param {*} value - The value to normalize
|
|
310
|
+
* @returns {*} - Returns the normalized value
|
|
311
|
+
*/
|
|
312
312
|
normalizeValue(value) {
|
|
313
313
|
if (this.component.multiple && Array.isArray(value)) {
|
|
314
314
|
return value.map((singleValue) => this.normalizeSingleValue(singleValue));
|
|
@@ -51,12 +51,6 @@ export default class TimeComponent extends TextFieldComponent {
|
|
|
51
51
|
}
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
|
-
get validationValue() {
|
|
55
|
-
if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
|
|
56
|
-
return this.dataValue;
|
|
57
|
-
}
|
|
58
|
-
return this.rawData;
|
|
59
|
-
}
|
|
60
54
|
get inputInfo() {
|
|
61
55
|
const info = super.inputInfo;
|
|
62
56
|
info.attr.type = this.component.inputType;
|
|
@@ -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.5863.8f10146",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
|
|
84
84
|
"@formio/choices.js": "^10.2.1",
|
|
85
|
-
"@formio/core": "v2.1.0-dev.
|
|
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",
|