@formio/js 5.0.0-rc.45 → 5.0.0-rc.46
Sign up to get free protection for your applications and to get access to all the features.
- 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 +6 -476
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +6 -186
- 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 +1897 -429
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +9 -1
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +2 -2
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.d.ts +2 -2
- package/lib/cjs/addons/index.d.ts +2 -2
- package/lib/cjs/components/Components.d.ts +3 -3
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.d.ts +2 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.d.ts +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.d.ts +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -1
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.d.ts +1 -1
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.d.ts +1 -1
- package/lib/cjs/components/form/editForm/Form.edit.data.d.ts +1 -1
- package/lib/cjs/components/panel/editForm/Panel.edit.conditional.d.ts +1 -1
- package/lib/cjs/formio.form.d.ts +1 -0
- package/lib/cjs/formio.form.js +3 -1
- package/lib/cjs/utils/Evaluator.d.ts +8 -2
- package/lib/cjs/utils/Evaluator.js +11 -13
- package/lib/cjs/utils/formUtils.d.ts +38 -165
- package/lib/cjs/utils/formUtils.js +36 -566
- package/lib/cjs/utils/utils.d.ts +2 -2
- package/lib/cjs/utils/utils.js +9 -9
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +2 -2
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.d.ts +2 -2
- package/lib/mjs/addons/index.d.ts +2 -2
- package/lib/mjs/components/Components.d.ts +3 -3
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.d.ts +2 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.d.ts +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.d.ts +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -1
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.d.ts +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.d.ts +1 -1
- package/lib/mjs/components/form/editForm/Form.edit.data.d.ts +1 -1
- package/lib/mjs/components/panel/editForm/Panel.edit.conditional.d.ts +1 -1
- package/lib/mjs/formio.form.d.ts +1 -0
- package/lib/mjs/formio.form.js +1 -0
- package/lib/mjs/utils/Evaluator.d.ts +8 -2
- package/lib/mjs/utils/Evaluator.js +9 -13
- package/lib/mjs/utils/formUtils.d.ts +38 -165
- package/lib/mjs/utils/formUtils.js +3 -550
- package/lib/mjs/utils/utils.d.ts +2 -2
- package/lib/mjs/utils/utils.js +1 -1
- package/package.json +1 -1
package/lib/mjs/Webform.d.ts
CHANGED
@@ -578,7 +578,7 @@ export type FormOptions = {
|
|
578
578
|
/**
|
579
579
|
* - The render mode for this form.
|
580
580
|
*/
|
581
|
-
renderMode?: "
|
581
|
+
renderMode?: "flat" | "builder" | "form" | "html" | "pdf" | undefined;
|
582
582
|
/**
|
583
583
|
* - Highlight any errors on the form.
|
584
584
|
*/
|
@@ -648,7 +648,7 @@ export type FormOptions = {
|
|
648
648
|
/**
|
649
649
|
* - The display for this form.
|
650
650
|
*/
|
651
|
-
display?: "
|
651
|
+
display?: "wizard" | "form" | "pdf" | undefined;
|
652
652
|
/**
|
653
653
|
* - The CDN url for this form.
|
654
654
|
*/
|
@@ -23,7 +23,7 @@ export default class PasswordStrengthAddon extends FormioAddon {
|
|
23
23
|
'margin-bottom': string;
|
24
24
|
};
|
25
25
|
key: string;
|
26
|
-
customConditional():
|
26
|
+
customConditional(): any;
|
27
27
|
components: ({
|
28
28
|
type: string;
|
29
29
|
key: any;
|
@@ -321,7 +321,7 @@ export default class PasswordStrengthAddon extends FormioAddon {
|
|
321
321
|
'margin-bottom': string;
|
322
322
|
};
|
323
323
|
key: string;
|
324
|
-
customConditional():
|
324
|
+
customConditional(): any;
|
325
325
|
components: ({
|
326
326
|
type: string;
|
327
327
|
key: any;
|
@@ -19,7 +19,7 @@ declare const _default: ({
|
|
19
19
|
'margin-bottom': string;
|
20
20
|
};
|
21
21
|
key: string;
|
22
|
-
customConditional():
|
22
|
+
customConditional(): any;
|
23
23
|
components: ({
|
24
24
|
type: string;
|
25
25
|
key: any;
|
@@ -317,7 +317,7 @@ declare const _default: ({
|
|
317
317
|
'margin-bottom': string;
|
318
318
|
};
|
319
319
|
key: string;
|
320
|
-
customConditional():
|
320
|
+
customConditional(): any;
|
321
321
|
components: ({
|
322
322
|
type: string;
|
323
323
|
key: any;
|
@@ -24,7 +24,7 @@ export const editForms: {
|
|
24
24
|
'margin-bottom': string;
|
25
25
|
};
|
26
26
|
key: string;
|
27
|
-
customConditional():
|
27
|
+
customConditional(): any;
|
28
28
|
components: ({
|
29
29
|
type: string;
|
30
30
|
key: any;
|
@@ -322,7 +322,7 @@ export const editForms: {
|
|
322
322
|
'margin-bottom': string;
|
323
323
|
};
|
324
324
|
key: string;
|
325
|
-
customConditional():
|
325
|
+
customConditional(): any;
|
326
326
|
components: ({
|
327
327
|
type: string;
|
328
328
|
key: any;
|
@@ -28,7 +28,7 @@ export default class Components {
|
|
28
28
|
'margin-bottom': string;
|
29
29
|
};
|
30
30
|
key: string;
|
31
|
-
customConditional():
|
31
|
+
customConditional(): any;
|
32
32
|
components: ({
|
33
33
|
type: string;
|
34
34
|
key: any;
|
@@ -112,7 +112,7 @@ export default class Components {
|
|
112
112
|
'margin-bottom': string;
|
113
113
|
};
|
114
114
|
key: string;
|
115
|
-
customConditional():
|
115
|
+
customConditional(): any;
|
116
116
|
components: ({
|
117
117
|
type: string;
|
118
118
|
key: any;
|
@@ -195,7 +195,7 @@ export default class Components {
|
|
195
195
|
'margin-bottom': string;
|
196
196
|
};
|
197
197
|
key: string;
|
198
|
-
customConditional():
|
198
|
+
customConditional(): any;
|
199
199
|
components: ({
|
200
200
|
type: string;
|
201
201
|
key: any;
|
@@ -36,7 +36,7 @@ declare const _default: {
|
|
36
36
|
'margin-bottom': string;
|
37
37
|
};
|
38
38
|
key: string;
|
39
|
-
customConditional():
|
39
|
+
customConditional(): any;
|
40
40
|
components: ({
|
41
41
|
type: string;
|
42
42
|
key: any;
|
@@ -334,7 +334,7 @@ declare const _default: {
|
|
334
334
|
'margin-bottom': string;
|
335
335
|
};
|
336
336
|
key: string;
|
337
|
-
customConditional():
|
337
|
+
customConditional(): any;
|
338
338
|
components: ({
|
339
339
|
type: string;
|
340
340
|
key: any;
|
package/lib/mjs/formio.form.d.ts
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
*/
|
6
6
|
export function registerModule(mod: any, defaultFn?: null, options?: {}): void;
|
7
7
|
export function useModule(defaultFn?: null): (plugins: any, options?: {}) => void;
|
8
|
+
export { Formio as FormioCore } from "./Formio";
|
8
9
|
import Components from './components/Components';
|
9
10
|
import Displays from './displays/Displays';
|
10
11
|
import Providers from './providers';
|
package/lib/mjs/formio.form.js
CHANGED
@@ -117,5 +117,6 @@ export function useModule(defaultFn = null) {
|
|
117
117
|
* Formio.plugins([plugin1, plugin2, etc], options);
|
118
118
|
*/
|
119
119
|
Formio.use = useModule();
|
120
|
+
export { Formio as FormioCore } from './Formio';
|
120
121
|
// Export the components.
|
121
122
|
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
|
@@ -1,4 +1,10 @@
|
|
1
|
-
export
|
2
|
-
|
1
|
+
export class Evaluator {
|
2
|
+
static cache: {};
|
3
|
+
static protectedEval: boolean;
|
4
|
+
static template(template: any, hash: any): any;
|
5
|
+
static interpolate(rawTemplate: any, data: any, _options: any): any;
|
6
|
+
static evaluate(func: any, args: any): any;
|
7
|
+
}
|
8
|
+
export namespace Evaluator {
|
3
9
|
function registerEvaluator(evaluator: any): void;
|
4
10
|
}
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import stringHash from 'string-hash';
|
3
3
|
import { Evaluator as CoreEvaluator } from '@formio/core/utils';
|
4
|
-
|
5
|
-
|
6
|
-
protectedEval
|
7
|
-
|
8
|
-
templateSettings: CoreEvaluator.templateSettings,
|
9
|
-
evaluator: CoreEvaluator.evaluator,
|
10
|
-
template(template, hash) {
|
4
|
+
export class Evaluator extends CoreEvaluator {
|
5
|
+
static cache = {};
|
6
|
+
static protectedEval = false;
|
7
|
+
static template(template, hash) {
|
11
8
|
hash = hash || stringHash(template);
|
12
9
|
if (Evaluator.cache[hash]) {
|
13
10
|
return Evaluator.cache[hash];
|
@@ -20,8 +17,8 @@ const Evaluator = {
|
|
20
17
|
catch (err) {
|
21
18
|
console.warn('Error while processing template', err, template);
|
22
19
|
}
|
23
|
-
}
|
24
|
-
interpolate(rawTemplate, data, _options) {
|
20
|
+
}
|
21
|
+
static interpolate(rawTemplate, data, _options) {
|
25
22
|
// Ensure reverse compatability.
|
26
23
|
const options = _.isObject(_options) ? _options : { noeval: _options };
|
27
24
|
if (typeof rawTemplate === 'function') {
|
@@ -51,14 +48,13 @@ const Evaluator = {
|
|
51
48
|
}
|
52
49
|
}
|
53
50
|
return template;
|
54
|
-
}
|
55
|
-
evaluate(func, args) {
|
51
|
+
}
|
52
|
+
static evaluate(func, args) {
|
56
53
|
return Array.isArray(args) ? func(...args) : func(args);
|
57
54
|
}
|
58
|
-
}
|
55
|
+
}
|
59
56
|
Evaluator.registerEvaluator = (evaluator) => {
|
60
57
|
Object.keys(evaluator).forEach((key) => {
|
61
58
|
Evaluator[key] = evaluator[key];
|
62
59
|
});
|
63
60
|
};
|
64
|
-
export default Evaluator;
|
@@ -1,56 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* Determine if a component is a layout component or not.
|
3
|
-
*
|
4
|
-
* @param {Object} component
|
5
|
-
* The component to check.
|
6
|
-
*
|
7
|
-
* @returns {Boolean}
|
8
|
-
* Whether or not the component is a layout component.
|
9
|
-
*/
|
10
|
-
export function isLayoutComponent(component: Object): boolean;
|
11
|
-
/**
|
12
|
-
* Iterate through each component within a form.
|
13
|
-
*
|
14
|
-
* @param {Object} components
|
15
|
-
* The components to iterate.
|
16
|
-
* @param {Function} fn
|
17
|
-
* The iteration function to invoke for each component.
|
18
|
-
* @param {Boolean} includeAll
|
19
|
-
* Whether or not to include layout components.
|
20
|
-
* @param {String} path
|
21
|
-
* The current data path of the element. Example: data.user.firstName
|
22
|
-
* @param {Object} parent
|
23
|
-
* The parent object.
|
24
|
-
*/
|
25
|
-
export function eachComponent(components: Object, fn: Function, includeAll: boolean, path: string, parent: Object, inRecursion: any): void;
|
26
|
-
/**
|
27
|
-
* Matches if a component matches the query.
|
28
|
-
*
|
29
|
-
* @param component
|
30
|
-
* @param query
|
31
|
-
* @return {boolean}
|
32
|
-
*/
|
33
|
-
export function matchComponent(component: any, query: any): boolean;
|
34
|
-
/**
|
35
|
-
* Get a component by its key
|
36
|
-
*
|
37
|
-
* @param {Object} components
|
38
|
-
* The components to iterate.
|
39
|
-
* @param {String|Object} key
|
40
|
-
* The key of the component to get, or a query of the component to search.
|
41
|
-
*
|
42
|
-
* @returns {Object}
|
43
|
-
* The component that matches the given key, or undefined if not found.
|
44
|
-
*/
|
45
|
-
export function getComponent(components: Object, key: string | Object, includeAll: any): Object;
|
46
|
-
/**
|
47
|
-
* Finds a component provided a query of properties of that component.
|
48
|
-
*
|
49
|
-
* @param components
|
50
|
-
* @param query
|
51
|
-
* @return {*}
|
52
|
-
*/
|
53
|
-
export function searchComponents(components: any, query: any): any;
|
54
1
|
/**
|
55
2
|
* Deprecated version of findComponents. Renamed to searchComponents.
|
56
3
|
*
|
@@ -59,115 +6,41 @@ export function searchComponents(components: any, query: any): any;
|
|
59
6
|
* @returns {*}
|
60
7
|
*/
|
61
8
|
export function findComponents(components: any, query: any): any;
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
export
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
export
|
82
|
-
export
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
key: any;
|
101
|
-
container?: undefined;
|
102
|
-
path?: undefined;
|
103
|
-
index?: undefined;
|
104
|
-
component?: undefined;
|
105
|
-
patches?: undefined;
|
106
|
-
} | null | undefined;
|
107
|
-
export function applyFormChanges(form: any, changes: any): {
|
108
|
-
form: any;
|
109
|
-
failed: any[];
|
110
|
-
};
|
111
|
-
/**
|
112
|
-
* Flatten the form components for data manipulation.
|
113
|
-
*
|
114
|
-
* @param {Object} components
|
115
|
-
* The components to iterate.
|
116
|
-
* @param {Boolean} includeAll
|
117
|
-
* Whether or not to include layout components.
|
118
|
-
*
|
119
|
-
* @returns {Object}
|
120
|
-
* The flattened components map.
|
121
|
-
*/
|
122
|
-
export function flattenComponents(components: Object, includeAll?: boolean): Object;
|
123
|
-
/**
|
124
|
-
* Returns if this component has a conditional statement.
|
125
|
-
*
|
126
|
-
* @param component - The component JSON schema.
|
127
|
-
*
|
128
|
-
* @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.
|
129
|
-
*/
|
130
|
-
export function hasCondition(component: any): boolean;
|
131
|
-
/**
|
132
|
-
* Extension of standard #parseFloat(value) function, that also clears input string.
|
133
|
-
*
|
134
|
-
* @param {any} value
|
135
|
-
* The value to parse.
|
136
|
-
*
|
137
|
-
* @returns {Number}
|
138
|
-
* Parsed value.
|
139
|
-
*/
|
140
|
-
export function parseFloatExt(value: any): number;
|
141
|
-
/**
|
142
|
-
* Formats provided value in way how Currency component uses it.
|
143
|
-
*
|
144
|
-
* @param {any} value
|
145
|
-
* The value to format.
|
146
|
-
*
|
147
|
-
* @returns {String}
|
148
|
-
* Value formatted for Currency component.
|
149
|
-
*/
|
150
|
-
export function formatAsCurrency(value: any): string;
|
151
|
-
/**
|
152
|
-
* Escapes RegEx characters in provided String value.
|
153
|
-
*
|
154
|
-
* @param {String} value
|
155
|
-
* String for escaping RegEx characters.
|
156
|
-
* @returns {string}
|
157
|
-
* String with escaped RegEx characters.
|
158
|
-
*/
|
159
|
-
export function escapeRegExCharacters(value: string): string;
|
160
|
-
/**
|
161
|
-
* Get the value for a component key, in the given submission.
|
162
|
-
*
|
163
|
-
* @param {Object} submission
|
164
|
-
* A submission object to search.
|
165
|
-
* @param {String} key
|
166
|
-
* A for components API key to search for.
|
167
|
-
*/
|
168
|
-
export function getValue(submission: Object, key: string): any;
|
169
|
-
/**
|
170
|
-
* Iterate over all components in a form and get string values for translation.
|
171
|
-
* @param form
|
172
|
-
*/
|
173
|
-
export function getStrings(form: any): any[];
|
9
|
+
export const flattenComponents: typeof Utils.flattenComponents;
|
10
|
+
export const guid: typeof Utils.guid;
|
11
|
+
export const uniqueName: typeof Utils.uniqueName;
|
12
|
+
export const MODEL_TYPES: Record<string, string[]>;
|
13
|
+
export const getModelType: typeof Utils.getModelType;
|
14
|
+
export const getComponentAbsolutePath: typeof Utils.getComponentAbsolutePath;
|
15
|
+
export const getComponentPath: typeof Utils.getComponentPath;
|
16
|
+
export const isComponentModelType: typeof Utils.isComponentModelType;
|
17
|
+
export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
|
18
|
+
export const componentPath: typeof Utils.componentPath;
|
19
|
+
export const componentChildPath: (component: any, parentPath?: string | undefined, path?: string | undefined) => string;
|
20
|
+
export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
|
21
|
+
export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
|
22
|
+
export const getComponentKey: typeof Utils.getComponentKey;
|
23
|
+
export const getContextualRowPath: typeof Utils.getContextualRowPath;
|
24
|
+
export const getContextualRowData: typeof Utils.getContextualRowData;
|
25
|
+
export const componentInfo: typeof Utils.componentInfo;
|
26
|
+
export const eachComponent: typeof Utils.eachComponent;
|
27
|
+
export const eachComponentAsync: typeof Utils.eachComponentAsync;
|
28
|
+
export const getComponentData: typeof Utils.getComponentData;
|
29
|
+
export const getComponentActualValue: typeof Utils.getComponentActualValue;
|
30
|
+
export const isLayoutComponent: typeof Utils.isLayoutComponent;
|
31
|
+
export const matchComponent: typeof Utils.matchComponent;
|
32
|
+
export const getComponent: typeof Utils.getComponent;
|
33
|
+
export const searchComponents: typeof Utils.searchComponents;
|
34
|
+
export const removeComponent: typeof Utils.removeComponent;
|
35
|
+
export const hasCondition: typeof Utils.hasCondition;
|
36
|
+
export const parseFloatExt: typeof Utils.parseFloatExt;
|
37
|
+
export const formatAsCurrency: typeof Utils.formatAsCurrency;
|
38
|
+
export const escapeRegExCharacters: typeof Utils.escapeRegExCharacters;
|
39
|
+
export const getValue: typeof Utils.getValue;
|
40
|
+
export const getStrings: typeof Utils.getStrings;
|
41
|
+
export const generateFormChange: typeof Utils.generateFormChange;
|
42
|
+
export const applyFormChanges: typeof Utils.applyFormChanges;
|
43
|
+
export const findComponent: typeof Utils.findComponent;
|
44
|
+
export const getEmptyValue: typeof Utils.getEmptyValue;
|
45
|
+
export const isComponentDataEmpty: typeof Utils.isComponentDataEmpty;
|
46
|
+
import { Utils } from '@formio/core';
|