@formio/js 5.2.0-rc.3 → 5.2.0-rc.5
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.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +51 -62
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +57 -68
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +10 -10
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Element.js +13 -36
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -5
- package/lib/cjs/Webform.js +3 -4
- package/lib/cjs/WebformBuilder.js +9 -10
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -0
- package/lib/cjs/components/_classes/component/Component.js +33 -52
- 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 +1 -1
- package/lib/cjs/components/button/Button.js +4 -4
- 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 +1 -1
- 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.js +1 -1
- 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.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 +10 -2
- package/lib/cjs/components/textfield/TextField.js +7 -30
- 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 +1 -1
- package/lib/cjs/utils/Evaluator.d.ts +14 -6
- package/lib/cjs/utils/Evaluator.js +29 -15
- 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 +160 -2
- package/lib/cjs/utils/index.js +13 -2
- package/lib/cjs/utils/utils.d.ts +0 -5
- package/lib/cjs/utils/utils.js +4 -42
- package/lib/cjs/widgets/CalendarWidget.js +1 -1
- package/lib/mjs/Element.js +6 -6
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -2
- package/lib/mjs/Webform.js +1 -2
- package/lib/mjs/WebformBuilder.js +1 -2
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -0
- package/lib/mjs/components/_classes/component/Component.js +6 -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 +1 -1
- package/lib/mjs/components/button/Button.js +1 -1
- 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 +1 -1
- 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.js +1 -1
- 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.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 +10 -2
- 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 +1 -1
- package/lib/mjs/utils/Evaluator.d.ts +14 -6
- package/lib/mjs/utils/Evaluator.js +23 -13
- 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 +160 -2
- package/lib/mjs/utils/index.js +12 -1
- package/lib/mjs/utils/utils.d.ts +0 -5
- package/lib/mjs/utils/utils.js +1 -23
- package/lib/mjs/widgets/CalendarWidget.js +1 -1
- package/package.json +1 -1
@@ -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';
|
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';
|
2
2
|
import Input from '../_classes/input/Input';
|
3
3
|
import Choices from '@formio/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';
|
5
5
|
export default class TextAreaComponent extends TextFieldComponent {
|
6
6
|
static schema(...extend) {
|
7
7
|
return TextFieldComponent.schema({
|
@@ -57,7 +57,15 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
57
57
|
info.content = value;
|
58
58
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
59
59
|
const elementStyle = this.info.attr.style || '';
|
60
|
-
const children =
|
60
|
+
const children = `
|
61
|
+
<div ${this._referenceAttributeName}="input"
|
62
|
+
class="formio-editor-read-only-content"
|
63
|
+
${elementStyle ? `style='${elementStyle}'` : ''}
|
64
|
+
role="textbox"
|
65
|
+
aria-multiline="true"
|
66
|
+
aria-readonly="true"
|
67
|
+
>
|
68
|
+
</div>`;
|
61
69
|
return this.renderTemplate('well', {
|
62
70
|
children,
|
63
71
|
nestedKey: this.key,
|
@@ -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
|
4
|
+
import FormioUtils from '../../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';
|
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,10 +8,10 @@ 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';
|
12
11
|
import Licenses from './licenses';
|
13
12
|
import EventEmitter from './EventEmitter';
|
14
13
|
import Webform from './Webform';
|
14
|
+
import { Evaluator, registerEvaluator } from './utils';
|
15
15
|
Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
16
16
|
Formio.requireLibrary(name, name, path, true)
|
17
17
|
.then((modules) => {
|
@@ -81,7 +81,7 @@ export function registerModule(mod, defaultFn = null, options = {}) {
|
|
81
81
|
Formio.Displays.addDisplays(mod.displays);
|
82
82
|
break;
|
83
83
|
case 'evaluator':
|
84
|
-
|
84
|
+
registerEvaluator(mod.evaluator);
|
85
85
|
break;
|
86
86
|
case 'library':
|
87
87
|
options.license
|
package/lib/mjs/i18n.js
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
/**
|
2
|
+
* Set the evaluator to use for evaluating expressions.
|
3
|
+
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
4
|
+
* @returns {void}
|
5
|
+
*/
|
6
|
+
export function registerEvaluator(override: CoreEvaluator): void;
|
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;
|
7
12
|
}
|
13
|
+
export let Evaluator: DefaultEvaluator;
|
14
|
+
export function interpolate(rawTemplate: any, data: any, _options: any): any;
|
15
|
+
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -1,25 +1,24 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import stringHash from 'string-hash';
|
3
|
-
import {
|
4
|
-
export class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
static template(template, hash) {
|
3
|
+
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
4
|
+
export class DefaultEvaluator extends CoreEvaluator {
|
5
|
+
cache = {};
|
6
|
+
protectedEval = false;
|
7
|
+
template(template, hash) {
|
9
8
|
hash = hash || stringHash(template);
|
10
|
-
if (
|
11
|
-
return
|
9
|
+
if (this.cache[hash]) {
|
10
|
+
return this.cache[hash];
|
12
11
|
}
|
13
12
|
try {
|
14
13
|
// Ensure we handle copied templates from the ejs files.
|
15
14
|
template = template.replace(/ctx\./g, '');
|
16
|
-
return (
|
15
|
+
return (this.cache[hash] = _.template(template, this.templateSettings));
|
17
16
|
}
|
18
17
|
catch (err) {
|
19
18
|
console.warn('Error while processing template', err, template);
|
20
19
|
}
|
21
20
|
}
|
22
|
-
|
21
|
+
interpolate(rawTemplate, data, _options) {
|
23
22
|
// Ensure reverse compatability.
|
24
23
|
const options = _.isObject(_options) ? _options : { noeval: _options };
|
25
24
|
if (typeof rawTemplate === 'function') {
|
@@ -33,11 +32,11 @@ export class Evaluator extends CoreEvaluator {
|
|
33
32
|
}
|
34
33
|
rawTemplate = String(rawTemplate);
|
35
34
|
let template;
|
36
|
-
if (
|
37
|
-
return
|
35
|
+
if (this.noeval || options.noeval) {
|
36
|
+
return this.interpolateString(rawTemplate, data, _options);
|
38
37
|
}
|
39
38
|
else {
|
40
|
-
template =
|
39
|
+
template = this.template(rawTemplate);
|
41
40
|
}
|
42
41
|
if (typeof template === 'function') {
|
43
42
|
try {
|
@@ -51,3 +50,14 @@ export class Evaluator extends CoreEvaluator {
|
|
51
50
|
return template;
|
52
51
|
}
|
53
52
|
}
|
53
|
+
export let Evaluator = new DefaultEvaluator();
|
54
|
+
// preserve the standalone interpolate function for backwards compatibility
|
55
|
+
export const interpolate = Evaluator.interpolate;
|
56
|
+
/**
|
57
|
+
* Set the evaluator to use for evaluating expressions.
|
58
|
+
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
59
|
+
* @returns {void}
|
60
|
+
*/
|
61
|
+
export function registerEvaluator(override) {
|
62
|
+
Evaluator = override;
|
63
|
+
}
|
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 '../';
|
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,3 +1,161 @@
|
|
1
|
-
export
|
1
|
+
export * from "./utils";
|
2
|
+
export * from "./formUtils";
|
2
3
|
export default FormioUtils;
|
3
|
-
|
4
|
+
declare const FormioUtils: {
|
5
|
+
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
+
interpolate: (rawTemplate: any, data: any, _options: any) => any;
|
7
|
+
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
8
|
+
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
9
|
+
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
10
|
+
MODEL_TYPES_OF_KNOWN_COMPONENTS: {
|
11
|
+
nestedArray: string[];
|
12
|
+
nestedDataArray: string[];
|
13
|
+
dataObject: string[];
|
14
|
+
object: string[];
|
15
|
+
map: string[];
|
16
|
+
content: string[];
|
17
|
+
string: string[];
|
18
|
+
number: string[];
|
19
|
+
boolean: string[];
|
20
|
+
none: string[];
|
21
|
+
any: string[];
|
22
|
+
};
|
23
|
+
getModelType: typeof import("@formio/core/lib/utils/formUtil").getModelType;
|
24
|
+
getComponentPath: any;
|
25
|
+
setComponentScope: typeof import("@formio/core/lib/utils/formUtil").setComponentScope;
|
26
|
+
resetComponentScope: typeof import("@formio/core/lib/utils/formUtil").resetComponentScope;
|
27
|
+
isComponentNestedDataType: typeof import("@formio/core/lib/utils/formUtil").isComponentNestedDataType;
|
28
|
+
componentPath: typeof import("@formio/core/lib/utils/formUtil").componentPath;
|
29
|
+
getComponentPaths: typeof import("@formio/core/lib/utils/formUtil").getComponentPaths;
|
30
|
+
componentMatches: typeof import("@formio/core/lib/utils/formUtil").componentMatches;
|
31
|
+
getBestMatch: typeof import("@formio/core/lib/utils/formUtil").getBestMatch;
|
32
|
+
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
33
|
+
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
34
|
+
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
35
|
+
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>;
|
36
|
+
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;
|
37
|
+
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
38
|
+
getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
|
39
|
+
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
40
|
+
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
41
|
+
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
42
|
+
eachComponentAsync: typeof import("@formio/core/lib/utils/formUtil").eachComponentAsync;
|
43
|
+
getComponentData: typeof import("@formio/core/lib/utils/formUtil").getComponentData;
|
44
|
+
getComponentActualValue: any;
|
45
|
+
isLayoutComponent: typeof import("@formio/core/lib/utils/formUtil").isLayoutComponent;
|
46
|
+
matchComponent: typeof import("@formio/core/lib/utils/formUtil").matchComponent;
|
47
|
+
getComponent: typeof import("@formio/core/lib/utils/formUtil").getComponent;
|
48
|
+
searchComponents: typeof import("@formio/core/lib/utils/formUtil").searchComponents;
|
49
|
+
removeComponent: typeof import("@formio/core/lib/utils/formUtil").removeComponent;
|
50
|
+
hasCondition: typeof import("@formio/core/lib/utils/formUtil").hasCondition;
|
51
|
+
parseFloatExt: typeof import("@formio/core/lib/utils/formUtil").parseFloatExt;
|
52
|
+
formatAsCurrency: typeof import("@formio/core/lib/utils/formUtil").formatAsCurrency;
|
53
|
+
escapeRegExCharacters: typeof import("@formio/core/lib/utils/formUtil").escapeRegExCharacters;
|
54
|
+
getValue: typeof import("@formio/core/lib/utils/formUtil").getValue;
|
55
|
+
getStrings: typeof import("@formio/core/lib/utils/formUtil").getStrings;
|
56
|
+
generateFormChange: typeof import("@formio/core/lib/utils/formUtil").generateFormChange;
|
57
|
+
applyFormChanges: typeof import("@formio/core/lib/utils/formUtil").applyFormChanges;
|
58
|
+
findComponent: typeof import("@formio/core/lib/utils/formUtil").findComponent;
|
59
|
+
getEmptyValue: typeof import("@formio/core/lib/utils/formUtil").getEmptyValue;
|
60
|
+
isComponentDataEmpty: typeof import("@formio/core/lib/utils/formUtil").isComponentDataEmpty;
|
61
|
+
isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
|
62
|
+
compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
|
63
|
+
getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
|
64
|
+
evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
|
65
|
+
getRandomComponentId(): string;
|
66
|
+
getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
|
67
|
+
getElementRect(element: HTMLElement): {
|
68
|
+
x: number;
|
69
|
+
y: number;
|
70
|
+
width: number;
|
71
|
+
height: number;
|
72
|
+
};
|
73
|
+
getScriptPlugin(property: string): any;
|
74
|
+
boolValue(value: string | boolean): boolean;
|
75
|
+
isMongoId(text: string): boolean;
|
76
|
+
checkCalculated(component: import("@formio/core").Component, submission: import("@formio/core").Submission, rowData: any): void;
|
77
|
+
checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
78
|
+
checkCustomConditional(component: import("@formio/core").Component, custom: string, row: any, data: any, form: import("@formio/core").Form, variable: string, onError: any, instance: any): any;
|
79
|
+
checkJsonConditional(component: import("@formio/core").Component, json: import("@formio/core").JSONConditional, row: any, data: any, form: import("@formio/core").Form, onError: any): boolean;
|
80
|
+
checkCondition(component: import("@formio/core").Component, row: any, data: any, form: import("@formio/core").Form, instance: any): boolean;
|
81
|
+
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;
|
82
|
+
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;
|
83
|
+
removeHTML(str: string): string;
|
84
|
+
unescapeHTML(str: string): string;
|
85
|
+
convertStringToHTMLElement(str: string, selector: string): HTMLElement;
|
86
|
+
getDateSetting(date: string | Date): Date | null;
|
87
|
+
isValidDate(date: string | Date): boolean;
|
88
|
+
currentTimezone(): string;
|
89
|
+
offsetDate(date: Date, timezone: string): Date;
|
90
|
+
zonesLoaded(): boolean;
|
91
|
+
shouldLoadZones(timezone: string): boolean;
|
92
|
+
loadZones(url: string, timezone: string): any;
|
93
|
+
momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
94
|
+
formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
95
|
+
formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
96
|
+
getLocaleDateFormatInfo(locale: Intl.LocalesArgument): object;
|
97
|
+
convertFormatToFlatpickr(format: string): string;
|
98
|
+
convertFormatToMoment(format: string): string;
|
99
|
+
convertFormatToMask(format: string): string;
|
100
|
+
getInputMask(mask: string, placeholderChar: string): any[];
|
101
|
+
unmaskValue(value: string, mask: string, placeholderChar: string): string;
|
102
|
+
matchInputMask(value: string, inputMask: string): boolean;
|
103
|
+
getNumberSeparators(lang?: string): {
|
104
|
+
delimiter: string;
|
105
|
+
decimalSeparator: string;
|
106
|
+
};
|
107
|
+
getNumberDecimalLimit(component: import("@formio/core").Component, defaultLimit: number): number;
|
108
|
+
getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
|
109
|
+
currency: string;
|
110
|
+
decimalLimit: number;
|
111
|
+
decimalSeparator: string;
|
112
|
+
lang: string;
|
113
|
+
}): {
|
114
|
+
prefix: string;
|
115
|
+
suffix: string;
|
116
|
+
};
|
117
|
+
fieldData(data: import("@formio/core").DataObject, component: import("@formio/core").Component): any;
|
118
|
+
delay(fn: Function, delay?: number, ...args: any[]): any;
|
119
|
+
iterateKey(key: string): string;
|
120
|
+
uniqueKey(map: Record<string, string>, base: string): string;
|
121
|
+
bootstrapVersion(options: {
|
122
|
+
bootstrap: string;
|
123
|
+
}): number;
|
124
|
+
unfold(e: any): any;
|
125
|
+
withSwitch(a: any, b: any): Functions[];
|
126
|
+
observeOverload(callback: Function, options?: {
|
127
|
+
limit: number;
|
128
|
+
delay: number;
|
129
|
+
}): Function;
|
130
|
+
getContextComponents(context: any, excludeNested: boolean, excludedTypes?: string[]): any[];
|
131
|
+
getContextButtons(context: any): any[];
|
132
|
+
translateHTMLTemplate(template: string, translate: Function): string;
|
133
|
+
sanitize(string: string, options: any): string;
|
134
|
+
fastCloneDeep(obj: any): any;
|
135
|
+
isInputComponent(componentJson: import("@formio/core").Component): bool;
|
136
|
+
getArrayFromComponentPath(pathStr: string): Arryay<number>;
|
137
|
+
isChildOf(child: any, parent: any): boolean;
|
138
|
+
getStringFromComponentPath(path: number[]): string;
|
139
|
+
round(number: number, precision: number): string;
|
140
|
+
getIEBrowserVersion(): number | null;
|
141
|
+
getBrowserInfo(): object;
|
142
|
+
getComponentPathWithoutIndicies(path?: string): string;
|
143
|
+
getDataParentComponent(componentInstance: Component): any;
|
144
|
+
isPromise(value: any): boolean;
|
145
|
+
getFocusableElements(element: HTMLElement): NodeList<HTMLElement>;
|
146
|
+
getComponentSavedTypes(fullSchema: import("@formio/core").Component): string[] | null;
|
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 };
|
package/lib/mjs/utils/index.js
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
-
import * as
|
1
|
+
import * as utils from './utils';
|
2
|
+
import * as formUtils from './formUtils';
|
3
|
+
import { Evaluator, registerEvaluator, interpolate } from './Evaluator';
|
4
|
+
const FormioUtils = {
|
5
|
+
...utils,
|
6
|
+
...formUtils,
|
7
|
+
Evaluator,
|
8
|
+
interpolate
|
9
|
+
};
|
2
10
|
if (typeof global === 'object') {
|
3
11
|
global.FormioUtils = FormioUtils;
|
4
12
|
}
|
5
13
|
export { FormioUtils as Utils };
|
14
|
+
export { Evaluator, registerEvaluator };
|
15
|
+
export * from './utils';
|
16
|
+
export * from './formUtils';
|
6
17
|
export default FormioUtils;
|
package/lib/mjs/utils/utils.d.ts
CHANGED
@@ -490,7 +490,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
|
|
490
490
|
* @returns {Array<string>|null} - The saved types for the component
|
491
491
|
*/
|
492
492
|
export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
|
493
|
-
export * from "./formUtils";
|
494
493
|
/**
|
495
494
|
* Map values through unfold and return first non-nil value.
|
496
495
|
* @param {Array<T>} collection - The collection to map through unfold.;
|
@@ -507,7 +506,3 @@ export namespace componentValueTypes {
|
|
507
506
|
let any: string;
|
508
507
|
}
|
509
508
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
510
|
-
import ConditionOperators from './conditionOperators';
|
511
|
-
import { Evaluator } from './Evaluator';
|
512
|
-
export const interpolate: typeof Evaluator.interpolate;
|
513
|
-
export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1,31 +1,12 @@
|
|
1
1
|
/* global jQuery */
|
2
2
|
import _ from 'lodash';
|
3
|
-
import jsonLogic from 'json-logic-js';
|
4
3
|
import moment from 'moment-timezone/moment-timezone';
|
5
4
|
import jtz from 'jstimezonedetect';
|
6
|
-
import { lodashOperators } from './jsonlogic/operators';
|
7
5
|
import dompurify from 'dompurify';
|
8
6
|
import { getValue } from './formUtils';
|
9
7
|
import { Evaluator } from './Evaluator';
|
10
8
|
import ConditionOperators from './conditionOperators';
|
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 };
|
9
|
+
import { jsonLogic, convertShowToBoolean } from '@formio/core';
|
29
10
|
/**
|
30
11
|
* Evaluate a method.
|
31
12
|
* @param {Function|string|object} func - The function to evaluate.
|
@@ -1311,7 +1292,6 @@ export function sanitize(string, options) {
|
|
1311
1292
|
export function fastCloneDeep(obj) {
|
1312
1293
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
1313
1294
|
}
|
1314
|
-
export { Evaluator, interpolate };
|
1315
1295
|
/**
|
1316
1296
|
* Returns if the component is an input component.
|
1317
1297
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
@@ -1513,8 +1493,6 @@ export function getFocusableElements(element) {
|
|
1513
1493
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
1514
1494
|
return element.querySelectorAll(focusableSelector);
|
1515
1495
|
}
|
1516
|
-
// Export lodash to save space with other libraries.
|
1517
|
-
export { _ };
|
1518
1496
|
export const componentValueTypes = {
|
1519
1497
|
number: 'number',
|
1520
1498
|
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
|
3
|
+
import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones } from '../utils';
|
4
4
|
import moment from 'moment';
|
5
5
|
import _ from 'lodash';
|
6
6
|
const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
|