@formio/js 5.1.0-dev.6102.8eddaab → 5.1.0-dev.6104.98e707b
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 +117 -84
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +123 -90
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +44 -33
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +66 -44
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Element.js +36 -13
- package/lib/cjs/EventEmitter.js +25 -2
- package/lib/cjs/Form.js +25 -2
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +5 -4
- package/lib/cjs/Webform.js +4 -3
- package/lib/cjs/WebformBuilder.js +10 -9
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.js +53 -29
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +6 -6
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +2 -2
- package/lib/cjs/components/button/Button.js +10 -14
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/cjs/components/datamap/DataMap.js +4 -4
- package/lib/cjs/components/datetime/DateTime.js +1 -1
- package/lib/cjs/components/day/Day.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +1 -1
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/file/File.js +5 -6
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +8 -0
- package/lib/cjs/components/radio/Radio.js +16 -6
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +30 -7
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +3 -3
- package/lib/cjs/i18n.js +1 -1
- package/lib/cjs/providers/storage/uploadAdapter.js +3 -3
- package/lib/cjs/utils/Evaluator.d.ts +6 -13
- package/lib/cjs/utils/Evaluator.js +15 -27
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/i18n.js +3 -3
- package/lib/cjs/utils/index.d.ts +2 -160
- package/lib/cjs/utils/index.js +2 -12
- package/lib/cjs/utils/utils.d.ts +5 -0
- package/lib/cjs/utils/utils.js +42 -4
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.js +6 -6
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +2 -1
- package/lib/mjs/Webform.js +2 -1
- package/lib/mjs/WebformBuilder.js +2 -1
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.js +3 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +6 -6
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +2 -2
- package/lib/mjs/components/button/Button.js +7 -10
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/datetime/DateTime.js +1 -1
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/file/File.js +5 -6
- package/lib/mjs/components/form/Form.js +1 -1
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +8 -0
- package/lib/mjs/components/radio/Radio.js +16 -6
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +1 -1
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +2 -2
- package/lib/mjs/i18n.js +1 -1
- package/lib/mjs/providers/storage/uploadAdapter.js +3 -3
- package/lib/mjs/utils/Evaluator.d.ts +6 -13
- package/lib/mjs/utils/Evaluator.js +13 -21
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/i18n.js +1 -1
- package/lib/mjs/utils/index.d.ts +2 -160
- package/lib/mjs/utils/index.js +1 -11
- package/lib/mjs/utils/utils.d.ts +5 -0
- package/lib/mjs/utils/utils.js +23 -1
- package/lib/mjs/widgets/CalendarWidget.js +1 -1
- package/package.json +2 -2
@@ -8,6 +8,12 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
8
8
|
* @returns {boolean} - If the value is empty.
|
9
9
|
*/
|
10
10
|
isEmpty(value?: any): boolean;
|
11
|
+
/**
|
12
|
+
* Normalize values coming into updateValue.
|
13
|
+
* @param {any} value - The value to normalize.
|
14
|
+
* @returns {*} - The normalized value
|
15
|
+
*/
|
16
|
+
normalizeValue(value: any): any;
|
11
17
|
setInputsDisabled(value: any, onlyUnchecked: any): void;
|
12
18
|
checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
|
13
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils';
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils/utils';
|
3
3
|
import RadioComponent from '../radio/Radio';
|
4
4
|
export default class SelectBoxesComponent extends RadioComponent {
|
5
5
|
static schema(...extend) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import SignaturePad from 'signature_pad';
|
2
2
|
import Input from '../_classes/input/Input';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils';
|
4
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
5
5
|
export default class SignatureComponent extends Input {
|
6
6
|
static schema(...extend) {
|
7
7
|
return Input.schema({
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Field from '../_classes/field/Field';
|
3
|
-
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils';
|
3
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
4
4
|
export default class SurveyComponent extends Field {
|
5
5
|
static schema(...extend) {
|
6
6
|
return Field.schema({
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils';
|
1
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
2
2
|
import Input from '../_classes/input/Input';
|
3
3
|
import Choices from 'choices.js';
|
4
4
|
export default class TagsComponent extends Input {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* global Quill */
|
2
2
|
import TextFieldComponent from '../textfield/TextField';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { uniqueName, getBrowserInfo } from '../../utils';
|
4
|
+
import { uniqueName, getBrowserInfo } from '../../utils/utils';
|
5
5
|
export default class TextAreaComponent extends TextFieldComponent {
|
6
6
|
static schema(...extend) {
|
7
7
|
return TextFieldComponent.schema({
|
@@ -58,8 +58,8 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
58
58
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
59
59
|
const elementStyle = this.info.attr.style || '';
|
60
60
|
const children = `
|
61
|
-
<div ${this._referenceAttributeName}="input"
|
62
|
-
class="formio-editor-read-only-content"
|
61
|
+
<div ${this._referenceAttributeName}="input"
|
62
|
+
class="formio-editor-read-only-content"
|
63
63
|
${elementStyle ? `style='${elementStyle}'` : ''}
|
64
64
|
role="textbox"
|
65
65
|
aria-multiline="true"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Input from '../_classes/input/Input';
|
2
2
|
import { conformToMask } from '@formio/vanilla-text-mask';
|
3
3
|
import Inputmask from 'inputmask';
|
4
|
-
import FormioUtils from '../../utils';
|
4
|
+
import * as FormioUtils from '../../utils/utils';
|
5
5
|
import _ from 'lodash';
|
6
6
|
export default class TextFieldComponent extends Input {
|
7
7
|
static schema(...extend) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import moment from 'moment';
|
2
2
|
import TextFieldComponent from '../textfield/TextField';
|
3
|
-
import { getBrowserInfo } from '../../utils';
|
3
|
+
import { getBrowserInfo } from '../../utils/utils';
|
4
4
|
const defaultDataFormat = 'HH:mm:ss';
|
5
5
|
export default class TimeComponent extends TextFieldComponent {
|
6
6
|
static schema(...extend) {
|
package/lib/mjs/formio.form.js
CHANGED
@@ -8,11 +8,11 @@ import Providers from './providers';
|
|
8
8
|
import Widgets from './widgets';
|
9
9
|
import Form from './Form';
|
10
10
|
import Utils from './utils';
|
11
|
+
import { Evaluator } from './utils/Evaluator';
|
11
12
|
import Licenses from './licenses';
|
12
13
|
import EventEmitter from './EventEmitter';
|
13
14
|
import Webform from './Webform';
|
14
15
|
import { I18n } from './utils/i18n';
|
15
|
-
import { Evaluator, registerEvaluator } from './utils';
|
16
16
|
Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
17
17
|
Formio.requireLibrary(name, name, path, true)
|
18
18
|
.then((modules) => {
|
@@ -83,7 +83,7 @@ export function registerModule(mod, defaultFn = null, options = {}) {
|
|
83
83
|
Formio.Displays.addDisplays(mod.displays);
|
84
84
|
break;
|
85
85
|
case 'evaluator':
|
86
|
-
registerEvaluator(mod.evaluator);
|
86
|
+
Formio.Evaluator.registerEvaluator(mod.evaluator);
|
87
87
|
break;
|
88
88
|
case 'translations':
|
89
89
|
I18n.setDefaultTranslations(mod.translations);
|
package/lib/mjs/i18n.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { uniqueName } from '../../utils';
|
1
|
+
import { uniqueName } from '../../utils/utils';
|
2
2
|
/**
|
3
3
|
* UploadAdapter for CKEditor https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html
|
4
4
|
*/
|
@@ -24,7 +24,7 @@ class FormioUploadAdapter {
|
|
24
24
|
null,
|
25
25
|
null
|
26
26
|
];
|
27
|
-
|
27
|
+
this.fileService.uploadFile(...uploadParams, () => this.component.emit('fileUploadingStart')).then((result) => {
|
28
28
|
return this.fileService.downloadFile(result);
|
29
29
|
}).then((result) => {
|
30
30
|
return resolve({
|
@@ -34,7 +34,7 @@ class FormioUploadAdapter {
|
|
34
34
|
console.warn('An Error occured while uploading file', err);
|
35
35
|
reject(err);
|
36
36
|
}).finally(() => {
|
37
|
-
this.component.emit('fileUploadingEnd'
|
37
|
+
this.component.emit('fileUploadingEnd');
|
38
38
|
});
|
39
39
|
}));
|
40
40
|
}
|
@@ -1,14 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export class DefaultEvaluator extends CoreEvaluator {
|
8
|
-
cache: {};
|
9
|
-
protectedEval: boolean;
|
10
|
-
template(template: any, hash: any): any;
|
11
|
-
interpolate(rawTemplate: any, data: any, _options: any): any;
|
1
|
+
export class Evaluator {
|
2
|
+
static cache: {};
|
3
|
+
static protectedEval: boolean;
|
4
|
+
static noeval: boolean;
|
5
|
+
static template(template: any, hash: any): any;
|
6
|
+
static interpolate(rawTemplate: any, data: any, _options: any): any;
|
12
7
|
}
|
13
|
-
export let Evaluator: DefaultEvaluator;
|
14
|
-
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -1,24 +1,25 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import stringHash from 'string-hash';
|
3
|
-
import {
|
4
|
-
export class
|
5
|
-
cache = {};
|
6
|
-
protectedEval = false;
|
7
|
-
|
3
|
+
import { JSONLogicEvaluator as CoreEvaluator } from '@formio/core/utils';
|
4
|
+
export class Evaluator extends CoreEvaluator {
|
5
|
+
static cache = {};
|
6
|
+
static protectedEval = false;
|
7
|
+
static noeval = false;
|
8
|
+
static template(template, hash) {
|
8
9
|
hash = hash || stringHash(template);
|
9
|
-
if (
|
10
|
-
return
|
10
|
+
if (Evaluator.cache[hash]) {
|
11
|
+
return Evaluator.cache[hash];
|
11
12
|
}
|
12
13
|
try {
|
13
14
|
// Ensure we handle copied templates from the ejs files.
|
14
15
|
template = template.replace(/ctx\./g, '');
|
15
|
-
return (
|
16
|
+
return (Evaluator.cache[hash] = _.template(template, Evaluator.templateSettings));
|
16
17
|
}
|
17
18
|
catch (err) {
|
18
19
|
console.warn('Error while processing template', err, template);
|
19
20
|
}
|
20
21
|
}
|
21
|
-
interpolate(rawTemplate, data, _options) {
|
22
|
+
static interpolate(rawTemplate, data, _options) {
|
22
23
|
// Ensure reverse compatability.
|
23
24
|
const options = _.isObject(_options) ? _options : { noeval: _options };
|
24
25
|
if (typeof rawTemplate === 'function') {
|
@@ -32,11 +33,11 @@ export class DefaultEvaluator extends CoreEvaluator {
|
|
32
33
|
}
|
33
34
|
rawTemplate = String(rawTemplate);
|
34
35
|
let template;
|
35
|
-
if (
|
36
|
-
return
|
36
|
+
if (Evaluator.noeval || options.noeval) {
|
37
|
+
return CoreEvaluator.interpolateString(rawTemplate, data, _options);
|
37
38
|
}
|
38
39
|
else {
|
39
|
-
template =
|
40
|
+
template = Evaluator.template(rawTemplate);
|
40
41
|
}
|
41
42
|
if (typeof template === 'function') {
|
42
43
|
try {
|
@@ -50,12 +51,3 @@ export class DefaultEvaluator extends CoreEvaluator {
|
|
50
51
|
return template;
|
51
52
|
}
|
52
53
|
}
|
53
|
-
export let Evaluator = new DefaultEvaluator();
|
54
|
-
/**
|
55
|
-
* Set the evaluator to use for evaluating expressions.
|
56
|
-
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
57
|
-
* @returns {void}
|
58
|
-
*/
|
59
|
-
export function registerEvaluator(override) {
|
60
|
-
Evaluator = override;
|
61
|
-
}
|
package/lib/mjs/utils/builder.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import ConditionOperator from './ConditionOperator';
|
2
2
|
import _ from 'lodash';
|
3
|
-
import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../';
|
3
|
+
import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../utils';
|
4
4
|
export default class IsEqualTo extends ConditionOperator {
|
5
5
|
static get operatorKey() {
|
6
6
|
return 'isEqual';
|
package/lib/mjs/utils/i18n.js
CHANGED
package/lib/mjs/utils/index.d.ts
CHANGED
@@ -1,161 +1,3 @@
|
|
1
|
-
export
|
2
|
-
export * from "./formUtils";
|
1
|
+
export { FormioUtils as Utils };
|
3
2
|
export default FormioUtils;
|
4
|
-
|
5
|
-
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
-
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
7
|
-
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
8
|
-
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
9
|
-
MODEL_TYPES_OF_KNOWN_COMPONENTS: {
|
10
|
-
nestedArray: string[];
|
11
|
-
nestedDataArray: string[];
|
12
|
-
dataObject: string[];
|
13
|
-
object: string[];
|
14
|
-
map: string[];
|
15
|
-
content: string[];
|
16
|
-
string: string[];
|
17
|
-
number: string[];
|
18
|
-
boolean: string[];
|
19
|
-
none: string[];
|
20
|
-
any: string[];
|
21
|
-
};
|
22
|
-
getModelType: typeof import("@formio/core/lib/utils/formUtil").getModelType;
|
23
|
-
getComponentPath: any;
|
24
|
-
setComponentScope: typeof import("@formio/core/lib/utils/formUtil").setComponentScope;
|
25
|
-
resetComponentScope: typeof import("@formio/core/lib/utils/formUtil").resetComponentScope;
|
26
|
-
isComponentNestedDataType: typeof import("@formio/core/lib/utils/formUtil").isComponentNestedDataType;
|
27
|
-
componentPath: typeof import("@formio/core/lib/utils/formUtil").componentPath;
|
28
|
-
getComponentPaths: typeof import("@formio/core/lib/utils/formUtil").getComponentPaths;
|
29
|
-
componentMatches: typeof import("@formio/core/lib/utils/formUtil").componentMatches;
|
30
|
-
getBestMatch: typeof import("@formio/core/lib/utils/formUtil").getBestMatch;
|
31
|
-
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
32
|
-
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
33
|
-
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
34
|
-
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
35
|
-
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
36
|
-
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
37
|
-
getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
|
38
|
-
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
39
|
-
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
40
|
-
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
41
|
-
eachComponentAsync: typeof import("@formio/core/lib/utils/formUtil").eachComponentAsync;
|
42
|
-
getComponentData: typeof import("@formio/core/lib/utils/formUtil").getComponentData;
|
43
|
-
getComponentActualValue: any;
|
44
|
-
isLayoutComponent: typeof import("@formio/core/lib/utils/formUtil").isLayoutComponent;
|
45
|
-
matchComponent: typeof import("@formio/core/lib/utils/formUtil").matchComponent;
|
46
|
-
getComponent: typeof import("@formio/core/lib/utils/formUtil").getComponent;
|
47
|
-
searchComponents: typeof import("@formio/core/lib/utils/formUtil").searchComponents;
|
48
|
-
removeComponent: typeof import("@formio/core/lib/utils/formUtil").removeComponent;
|
49
|
-
hasCondition: typeof import("@formio/core/lib/utils/formUtil").hasCondition;
|
50
|
-
parseFloatExt: typeof import("@formio/core/lib/utils/formUtil").parseFloatExt;
|
51
|
-
formatAsCurrency: typeof import("@formio/core/lib/utils/formUtil").formatAsCurrency;
|
52
|
-
escapeRegExCharacters: typeof import("@formio/core/lib/utils/formUtil").escapeRegExCharacters;
|
53
|
-
getValue: typeof import("@formio/core/lib/utils/formUtil").getValue;
|
54
|
-
getStrings: typeof import("@formio/core/lib/utils/formUtil").getStrings;
|
55
|
-
generateFormChange: typeof import("@formio/core/lib/utils/formUtil").generateFormChange;
|
56
|
-
applyFormChanges: typeof import("@formio/core/lib/utils/formUtil").applyFormChanges;
|
57
|
-
findComponent: typeof import("@formio/core/lib/utils/formUtil").findComponent;
|
58
|
-
getEmptyValue: typeof import("@formio/core/lib/utils/formUtil").getEmptyValue;
|
59
|
-
isComponentDataEmpty: typeof import("@formio/core/lib/utils/formUtil").isComponentDataEmpty;
|
60
|
-
isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
|
61
|
-
compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
|
62
|
-
getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
|
63
|
-
evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
|
64
|
-
getRandomComponentId(): string;
|
65
|
-
getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
|
66
|
-
getElementRect(element: HTMLElement): {
|
67
|
-
x: number;
|
68
|
-
y: number;
|
69
|
-
width: number;
|
70
|
-
height: number;
|
71
|
-
};
|
72
|
-
getScriptPlugin(property: string): any;
|
73
|
-
boolValue(value: string | boolean): boolean;
|
74
|
-
isMongoId(text: string): boolean;
|
75
|
-
checkCalculated(component: import("@formio/core").Component, submission: import("@formio/core").Submission, rowData: any): void;
|
76
|
-
checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
77
|
-
checkCustomConditional(component: import("@formio/core").Component, custom: string, row: any, data: any, form: import("@formio/core").Form, variable: string, onError: any, instance: any): any;
|
78
|
-
checkJsonConditional(component: import("@formio/core").Component, json: import("@formio/core").JSONConditional, row: any, data: any, form: import("@formio/core").Form, onError: any): boolean;
|
79
|
-
checkCondition(component: import("@formio/core").Component, row: any, data: any, form: import("@formio/core").Form, instance: any): boolean;
|
80
|
-
checkTrigger(component: import("@formio/core").Component, trigger: any, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, form: import("@formio/core").Form, instance: any): boolean;
|
81
|
-
setActionProperty(component: import("@formio/core").Component, action: any, result: string, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, instance: any): import("@formio/core").Component;
|
82
|
-
removeHTML(str: string): string;
|
83
|
-
unescapeHTML(str: string): string;
|
84
|
-
convertStringToHTMLElement(str: string, selector: string): HTMLElement;
|
85
|
-
getDateSetting(date: string | Date): Date | null;
|
86
|
-
isValidDate(date: string | Date): boolean;
|
87
|
-
currentTimezone(): string;
|
88
|
-
offsetDate(date: Date, timezone: string): Date;
|
89
|
-
zonesLoaded(): boolean;
|
90
|
-
shouldLoadZones(timezone: string): boolean;
|
91
|
-
loadZones(url: string, timezone: string): any;
|
92
|
-
momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
93
|
-
formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
94
|
-
formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
95
|
-
getLocaleDateFormatInfo(locale: Intl.LocalesArgument): object;
|
96
|
-
convertFormatToFlatpickr(format: string): string;
|
97
|
-
convertFormatToMoment(format: string): string;
|
98
|
-
convertFormatToMask(format: string): string;
|
99
|
-
getInputMask(mask: string, placeholderChar: string): any[];
|
100
|
-
unmaskValue(value: string, mask: string, placeholderChar: string): string;
|
101
|
-
matchInputMask(value: string, inputMask: string): boolean;
|
102
|
-
getNumberSeparators(lang?: string): {
|
103
|
-
delimiter: string;
|
104
|
-
decimalSeparator: string;
|
105
|
-
};
|
106
|
-
getNumberDecimalLimit(component: import("@formio/core").Component, defaultLimit: number): number;
|
107
|
-
getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
|
108
|
-
currency: string;
|
109
|
-
decimalLimit: number;
|
110
|
-
decimalSeparator: string;
|
111
|
-
lang: string;
|
112
|
-
}): {
|
113
|
-
prefix: string;
|
114
|
-
suffix: string;
|
115
|
-
};
|
116
|
-
fieldData(data: import("@formio/core").DataObject, component: import("@formio/core").Component): any;
|
117
|
-
delay(fn: Function, delay?: number, ...args: any[]): any;
|
118
|
-
iterateKey(key: string): string;
|
119
|
-
uniqueKey(map: Record<string, string>, base: string): string;
|
120
|
-
bootstrapVersion(options: {
|
121
|
-
bootstrap: string;
|
122
|
-
}): number;
|
123
|
-
unfold(e: any): any;
|
124
|
-
withSwitch(a: any, b: any): Functions[];
|
125
|
-
observeOverload(callback: Function, options?: {
|
126
|
-
limit: number;
|
127
|
-
delay: number;
|
128
|
-
}): Function;
|
129
|
-
getContextComponents(context: any, excludeNested: boolean, excludedTypes?: string[]): any[];
|
130
|
-
getContextButtons(context: any): any[];
|
131
|
-
translateHTMLTemplate(template: string, translate: Function): string;
|
132
|
-
sanitize(string: string, options: any): string;
|
133
|
-
fastCloneDeep(obj: any): any;
|
134
|
-
isInputComponent(componentJson: import("@formio/core").Component): bool;
|
135
|
-
getArrayFromComponentPath(pathStr: string): Arryay<number>;
|
136
|
-
isChildOf(child: any, parent: any): boolean;
|
137
|
-
getStringFromComponentPath(path: number[]): string;
|
138
|
-
round(number: number, precision: number): string;
|
139
|
-
getIEBrowserVersion(): number | null;
|
140
|
-
getBrowserInfo(): object;
|
141
|
-
getComponentPathWithoutIndicies(path?: string): string;
|
142
|
-
getDataParentComponent(componentInstance: Component): any;
|
143
|
-
isPromise(value: any): boolean;
|
144
|
-
getFocusableElements(element: HTMLElement): NodeList<HTMLElement>;
|
145
|
-
getComponentSavedTypes(fullSchema: import("@formio/core").Component): string[] | null;
|
146
|
-
hasEncodedTimezone(value: string): boolean;
|
147
|
-
firstNonNil: any;
|
148
|
-
componentValueTypes: {
|
149
|
-
number: string;
|
150
|
-
string: string;
|
151
|
-
boolean: string;
|
152
|
-
array: string;
|
153
|
-
object: string;
|
154
|
-
date: string;
|
155
|
-
any: string;
|
156
|
-
};
|
157
|
-
interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
|
158
|
-
};
|
159
|
-
import { Evaluator } from './Evaluator';
|
160
|
-
import { registerEvaluator } from './Evaluator';
|
161
|
-
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
3
|
+
import * as FormioUtils from './utils';
|
package/lib/mjs/utils/index.js
CHANGED
@@ -1,16 +1,6 @@
|
|
1
|
-
import * as
|
2
|
-
import * as formUtils from './formUtils';
|
3
|
-
import { Evaluator, registerEvaluator } from './Evaluator';
|
4
|
-
const FormioUtils = {
|
5
|
-
...utils,
|
6
|
-
...formUtils,
|
7
|
-
Evaluator,
|
8
|
-
};
|
1
|
+
import * as FormioUtils from './utils';
|
9
2
|
if (typeof global === 'object') {
|
10
3
|
global.FormioUtils = FormioUtils;
|
11
4
|
}
|
12
5
|
export { FormioUtils as Utils };
|
13
|
-
export { Evaluator, registerEvaluator };
|
14
|
-
export * from './utils';
|
15
|
-
export * from './formUtils';
|
16
6
|
export default FormioUtils;
|
package/lib/mjs/utils/utils.d.ts
CHANGED
@@ -499,6 +499,7 @@ export function getComponentSavedTypes(fullSchema: import('@formio/core').Compon
|
|
499
499
|
* @returns {boolean} if value has encoded timezone
|
500
500
|
*/
|
501
501
|
export function hasEncodedTimezone(value: string): boolean;
|
502
|
+
export * from "./formUtils";
|
502
503
|
/**
|
503
504
|
* Map values through unfold and return first non-nil value.
|
504
505
|
* @param {Array<T>} collection - The collection to map through unfold.;
|
@@ -515,3 +516,7 @@ export namespace componentValueTypes {
|
|
515
516
|
let any: string;
|
516
517
|
}
|
517
518
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
519
|
+
import ConditionOperators from './conditionOperators';
|
520
|
+
import { Evaluator } from './Evaluator';
|
521
|
+
export const interpolate: typeof Evaluator.interpolate;
|
522
|
+
export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
/* global jQuery */
|
2
2
|
import _ from 'lodash';
|
3
|
+
import jsonLogic from 'json-logic-js';
|
3
4
|
import moment from 'moment-timezone/moment-timezone';
|
4
5
|
import jtz from 'jstimezonedetect';
|
6
|
+
import { lodashOperators } from './jsonlogic/operators';
|
5
7
|
import dompurify from 'dompurify';
|
6
8
|
import { getValue } from './formUtils';
|
7
9
|
import { Evaluator } from './Evaluator';
|
8
10
|
import ConditionOperators from './conditionOperators';
|
9
|
-
import {
|
11
|
+
import { convertShowToBoolean } from '@formio/core';
|
12
|
+
const interpolate = Evaluator.interpolate;
|
13
|
+
export * from './formUtils';
|
14
|
+
// Configure JsonLogic
|
15
|
+
lodashOperators.forEach((name) => jsonLogic.add_operation(`_${name}`, _[name]));
|
16
|
+
// Retrieve Any Date
|
17
|
+
jsonLogic.add_operation('getDate', (date) => {
|
18
|
+
return moment(date).toISOString();
|
19
|
+
});
|
20
|
+
// Set Relative Minimum Date
|
21
|
+
jsonLogic.add_operation('relativeMinDate', (relativeMinDate) => {
|
22
|
+
return moment().subtract(relativeMinDate, 'days').toISOString();
|
23
|
+
});
|
24
|
+
// Set Relative Maximum Date
|
25
|
+
jsonLogic.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
26
|
+
return moment().add(relativeMaxDate, 'days').toISOString();
|
27
|
+
});
|
28
|
+
export { jsonLogic, ConditionOperators, moment };
|
10
29
|
/**
|
11
30
|
* Evaluate a method.
|
12
31
|
* @param {Function|string|object} func - The function to evaluate.
|
@@ -1292,6 +1311,7 @@ export function sanitize(string, options) {
|
|
1292
1311
|
export function fastCloneDeep(obj) {
|
1293
1312
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
1294
1313
|
}
|
1314
|
+
export { Evaluator, interpolate };
|
1295
1315
|
/**
|
1296
1316
|
* Returns if the component is an input component.
|
1297
1317
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
@@ -1493,6 +1513,8 @@ export function getFocusableElements(element) {
|
|
1493
1513
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
1494
1514
|
return element.querySelectorAll(focusableSelector);
|
1495
1515
|
}
|
1516
|
+
// Export lodash to save space with other libraries.
|
1517
|
+
export { _ };
|
1496
1518
|
export const componentValueTypes = {
|
1497
1519
|
number: 'number',
|
1498
1520
|
string: 'string',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Formio } from '../Formio';
|
2
2
|
import InputWidget from './InputWidget';
|
3
|
-
import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, hasEncodedTimezone, } from '../utils';
|
3
|
+
import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, hasEncodedTimezone, } from '../utils/utils';
|
4
4
|
import moment from 'moment';
|
5
5
|
import _ from 'lodash';
|
6
6
|
const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.0-dev.
|
3
|
+
"version": "5.1.0-dev.6104.98e707b",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
82
82
|
"dependencies": {
|
83
83
|
"@formio/bootstrap": "v3.0.0-dev.121.085d187",
|
84
|
-
"@formio/core": "
|
84
|
+
"@formio/core": "v2.4.0-dev.232.d91b1e4",
|
85
85
|
"@formio/text-mask-addons": "3.8.0-formio.4",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|