@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
@@ -1,4 +1,27 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
27
|
};
|
@@ -6,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
7
30
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
8
31
|
const inputmask_1 = __importDefault(require("inputmask"));
|
9
|
-
const
|
32
|
+
const FormioUtils = __importStar(require("../../utils/utils"));
|
10
33
|
const lodash_1 = __importDefault(require("lodash"));
|
11
34
|
class TextFieldComponent extends Input_1.default {
|
12
35
|
static schema(...extend) {
|
@@ -48,7 +71,7 @@ class TextFieldComponent extends Input_1.default {
|
|
48
71
|
} });
|
49
72
|
}
|
50
73
|
static savedValueTypes(schema) {
|
51
|
-
return
|
74
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.string];
|
52
75
|
}
|
53
76
|
get defaultSchema() {
|
54
77
|
return TextFieldComponent.schema();
|
@@ -81,7 +104,7 @@ class TextFieldComponent extends Input_1.default {
|
|
81
104
|
displayInTimezone, locale: this.component.widget.locale || this.options.language, saveAs: 'text' });
|
82
105
|
// update originalComponent to include widget settings after component initialization
|
83
106
|
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
84
|
-
this.originalComponent =
|
107
|
+
this.originalComponent = FormioUtils.fastCloneDeep(this.component);
|
85
108
|
}
|
86
109
|
}
|
87
110
|
attach(element) {
|
@@ -152,7 +175,7 @@ class TextFieldComponent extends Input_1.default {
|
|
152
175
|
}
|
153
176
|
else {
|
154
177
|
const placeholderChar = this.placeholderChar;
|
155
|
-
textInput.value = (0, vanilla_text_mask_1.conformToMask)(textValue,
|
178
|
+
textInput.value = (0, vanilla_text_mask_1.conformToMask)(textValue, FormioUtils.getInputMask(mask), { placeholderChar }).conformedValue;
|
156
179
|
}
|
157
180
|
}
|
158
181
|
else {
|
@@ -160,8 +183,8 @@ class TextFieldComponent extends Input_1.default {
|
|
160
183
|
}
|
161
184
|
}
|
162
185
|
unmaskValue(value, format = this.component.displayMask) {
|
163
|
-
const mask =
|
164
|
-
return
|
186
|
+
const mask = FormioUtils.getInputMask(format, this.placeholderChar);
|
187
|
+
return FormioUtils.unmaskValue(value, mask, this.placeholderChar);
|
165
188
|
}
|
166
189
|
/**
|
167
190
|
* Returns the value at this index.
|
@@ -222,7 +245,7 @@ class TextFieldComponent extends Input_1.default {
|
|
222
245
|
return;
|
223
246
|
}
|
224
247
|
inputMask = inputMask || this.component.displayMask || this.component.inputMask;
|
225
|
-
const mask =
|
248
|
+
const mask = FormioUtils.getInputMask(inputMask, this.placeholderChar);
|
226
249
|
this.defaultMask = mask;
|
227
250
|
if (input && inputMask) {
|
228
251
|
try {
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const moment_1 = __importDefault(require("moment"));
|
7
7
|
const TextField_1 = __importDefault(require("../textfield/TextField"));
|
8
|
-
const utils_1 = require("../../utils");
|
8
|
+
const utils_1 = require("../../utils/utils");
|
9
9
|
const defaultDataFormat = 'HH:mm:ss';
|
10
10
|
class TimeComponent extends TextField_1.default {
|
11
11
|
static schema(...extend) {
|
package/lib/cjs/formio.form.js
CHANGED
@@ -22,6 +22,7 @@ const Form_1 = __importDefault(require("./Form"));
|
|
22
22
|
exports.Form = Form_1.default;
|
23
23
|
const utils_1 = __importDefault(require("./utils"));
|
24
24
|
exports.Utils = utils_1.default;
|
25
|
+
const Evaluator_1 = require("./utils/Evaluator");
|
25
26
|
const licenses_1 = __importDefault(require("./licenses"));
|
26
27
|
exports.Licenses = licenses_1.default;
|
27
28
|
const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
@@ -29,7 +30,6 @@ exports.EventEmitter = EventEmitter_1.default;
|
|
29
30
|
const Webform_1 = __importDefault(require("./Webform"));
|
30
31
|
exports.Webform = Webform_1.default;
|
31
32
|
const i18n_1 = require("./utils/i18n");
|
32
|
-
const utils_2 = require("./utils");
|
33
33
|
Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
34
34
|
Formio_1.Formio.requireLibrary(name, name, path, true)
|
35
35
|
.then((modules) => {
|
@@ -45,7 +45,7 @@ Formio_1.Formio.Form = Form_1.default;
|
|
45
45
|
Formio_1.Formio.Displays = Displays_1.default;
|
46
46
|
Formio_1.Formio.Providers = providers_1.default;
|
47
47
|
Formio_1.Formio.Widgets = widgets_1.default;
|
48
|
-
Formio_1.Formio.Evaluator =
|
48
|
+
Formio_1.Formio.Evaluator = Evaluator_1.Evaluator;
|
49
49
|
Formio_1.Formio.AllComponents = components_1.default;
|
50
50
|
Formio_1.Formio.Licenses = licenses_1.default;
|
51
51
|
// This is strange, but is needed for "premium" components to import correctly.
|
@@ -100,7 +100,7 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
100
100
|
Formio_1.Formio.Displays.addDisplays(mod.displays);
|
101
101
|
break;
|
102
102
|
case 'evaluator':
|
103
|
-
|
103
|
+
Formio_1.Formio.Evaluator.registerEvaluator(mod.evaluator);
|
104
104
|
break;
|
105
105
|
case 'translations':
|
106
106
|
i18n_1.I18n.setDefaultTranslations(mod.translations);
|
package/lib/cjs/i18n.js
CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const en_1 = __importDefault(require("./translations/en"));
|
7
|
-
const utils_1 = require("./utils");
|
7
|
+
const utils_1 = require("./utils/utils");
|
8
8
|
exports.default = {
|
9
9
|
lng: 'en',
|
10
10
|
nsSeparator: '::',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getFormioUploadAdapterPlugin = void 0;
|
4
|
-
const utils_1 = require("../../utils");
|
4
|
+
const utils_1 = require("../../utils/utils");
|
5
5
|
/**
|
6
6
|
* UploadAdapter for CKEditor https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html
|
7
7
|
*/
|
@@ -27,7 +27,7 @@ class FormioUploadAdapter {
|
|
27
27
|
null,
|
28
28
|
null
|
29
29
|
];
|
30
|
-
|
30
|
+
this.fileService.uploadFile(...uploadParams, () => this.component.emit('fileUploadingStart')).then((result) => {
|
31
31
|
return this.fileService.downloadFile(result);
|
32
32
|
}).then((result) => {
|
33
33
|
return resolve({
|
@@ -37,7 +37,7 @@ class FormioUploadAdapter {
|
|
37
37
|
console.warn('An Error occured while uploading file', err);
|
38
38
|
reject(err);
|
39
39
|
}).finally(() => {
|
40
|
-
this.component.emit('fileUploadingEnd'
|
40
|
+
this.component.emit('fileUploadingEnd');
|
41
41
|
});
|
42
42
|
}));
|
43
43
|
}
|
@@ -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';
|
@@ -3,31 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.Evaluator = void 0;
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
8
|
const string_hash_1 = __importDefault(require("string-hash"));
|
9
|
-
const
|
10
|
-
class
|
11
|
-
|
12
|
-
super(...arguments);
|
13
|
-
this.cache = {};
|
14
|
-
this.protectedEval = false;
|
15
|
-
}
|
16
|
-
template(template, hash) {
|
9
|
+
const utils_1 = require("@formio/core/utils");
|
10
|
+
class Evaluator extends utils_1.JSONLogicEvaluator {
|
11
|
+
static template(template, hash) {
|
17
12
|
hash = hash || (0, string_hash_1.default)(template);
|
18
|
-
if (
|
19
|
-
return
|
13
|
+
if (Evaluator.cache[hash]) {
|
14
|
+
return Evaluator.cache[hash];
|
20
15
|
}
|
21
16
|
try {
|
22
17
|
// Ensure we handle copied templates from the ejs files.
|
23
18
|
template = template.replace(/ctx\./g, '');
|
24
|
-
return (
|
19
|
+
return (Evaluator.cache[hash] = lodash_1.default.template(template, Evaluator.templateSettings));
|
25
20
|
}
|
26
21
|
catch (err) {
|
27
22
|
console.warn('Error while processing template', err, template);
|
28
23
|
}
|
29
24
|
}
|
30
|
-
interpolate(rawTemplate, data, _options) {
|
25
|
+
static interpolate(rawTemplate, data, _options) {
|
31
26
|
// Ensure reverse compatability.
|
32
27
|
const options = lodash_1.default.isObject(_options) ? _options : { noeval: _options };
|
33
28
|
if (typeof rawTemplate === 'function') {
|
@@ -41,11 +36,11 @@ class DefaultEvaluator extends core_1.DefaultEvaluator {
|
|
41
36
|
}
|
42
37
|
rawTemplate = String(rawTemplate);
|
43
38
|
let template;
|
44
|
-
if (
|
45
|
-
return
|
39
|
+
if (Evaluator.noeval || options.noeval) {
|
40
|
+
return utils_1.JSONLogicEvaluator.interpolateString(rawTemplate, data, _options);
|
46
41
|
}
|
47
42
|
else {
|
48
|
-
template =
|
43
|
+
template = Evaluator.template(rawTemplate);
|
49
44
|
}
|
50
45
|
if (typeof template === 'function') {
|
51
46
|
try {
|
@@ -59,14 +54,7 @@ class DefaultEvaluator extends core_1.DefaultEvaluator {
|
|
59
54
|
return template;
|
60
55
|
}
|
61
56
|
}
|
62
|
-
exports.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
67
|
-
* @returns {void}
|
68
|
-
*/
|
69
|
-
function registerEvaluator(override) {
|
70
|
-
exports.Evaluator = override;
|
71
|
-
}
|
72
|
-
exports.registerEvaluator = registerEvaluator;
|
57
|
+
exports.Evaluator = Evaluator;
|
58
|
+
Evaluator.cache = {};
|
59
|
+
Evaluator.protectedEval = false;
|
60
|
+
Evaluator.noeval = false;
|
package/lib/cjs/utils/builder.js
CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const
|
7
|
+
const utils_1 = require("./utils");
|
8
8
|
exports.default = {
|
9
9
|
/**
|
10
10
|
* Appends a number to a component.key to keep it unique
|
@@ -15,19 +15,19 @@ exports.default = {
|
|
15
15
|
uniquify(container, component) {
|
16
16
|
let changed = false;
|
17
17
|
const formKeys = {};
|
18
|
-
(0,
|
18
|
+
(0, utils_1.eachComponent)(container, (comp) => {
|
19
19
|
formKeys[comp.key] = true;
|
20
20
|
if (['address', 'container', 'datagrid', 'editgrid', 'dynamicWizard', 'tree'].includes(comp.type) || comp.tree || comp.arrayTree) {
|
21
21
|
return true;
|
22
22
|
}
|
23
23
|
}, true);
|
24
24
|
// Recurse into all child components.
|
25
|
-
(0,
|
25
|
+
(0, utils_1.eachComponent)([component], (component) => {
|
26
26
|
// Skip key uniquification if this component doesn't have a key.
|
27
27
|
if (!component.key) {
|
28
28
|
return;
|
29
29
|
}
|
30
|
-
const newKey = (0,
|
30
|
+
const newKey = (0, utils_1.uniqueKey)(formKeys, component.key);
|
31
31
|
if (newKey !== component.key) {
|
32
32
|
component.key = newKey;
|
33
33
|
changed = true;
|
@@ -60,7 +60,7 @@ exports.default = {
|
|
60
60
|
},
|
61
61
|
getBindedShortcuts(components, input) {
|
62
62
|
const result = [];
|
63
|
-
(0,
|
63
|
+
(0, utils_1.eachComponent)(components, (component) => {
|
64
64
|
if (component === input) {
|
65
65
|
return;
|
66
66
|
}
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const ConditionOperator_1 = __importDefault(require("./ConditionOperator"));
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
|
-
const
|
8
|
+
const utils_1 = require("../utils");
|
9
9
|
class IsEqualTo extends ConditionOperator_1.default {
|
10
10
|
static get operatorKey() {
|
11
11
|
return 'isEqual';
|
@@ -25,9 +25,9 @@ class IsEqualTo extends ConditionOperator_1.default {
|
|
25
25
|
if ((_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) {
|
26
26
|
const conditionTriggerComponent = instance.root.getComponent(path);
|
27
27
|
if (conditionTriggerComponent
|
28
|
-
&& (0,
|
28
|
+
&& (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
|
29
29
|
&& ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
|
30
|
-
return (0,
|
30
|
+
return (0, utils_1.compareSelectResourceWithObjectTypeValues)(value, comparedValue, conditionTriggerComponent.component);
|
31
31
|
}
|
32
32
|
}
|
33
33
|
//special check for select boxes
|
package/lib/cjs/utils/i18n.js
CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.I18n = void 0;
|
7
|
-
const
|
7
|
+
const utils_1 = require("@formio/core/utils");
|
8
8
|
const i18n_1 = __importDefault(require("../i18n"));
|
9
9
|
const lodash_1 = require("lodash");
|
10
10
|
const core_1 = require("@formio/core");
|
@@ -111,9 +111,9 @@ class I18n {
|
|
111
111
|
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
112
112
|
args[0].field = this.currentLanguage[customTranslationFieldName];
|
113
113
|
}
|
114
|
-
return
|
114
|
+
return utils_1.Evaluator.interpolateString(currentTranslation, ...args);
|
115
115
|
}
|
116
|
-
return
|
116
|
+
return utils_1.Evaluator.interpolateString(text, ...args);
|
117
117
|
}
|
118
118
|
}
|
119
119
|
exports.I18n = I18n;
|
package/lib/cjs/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/cjs/utils/index.js
CHANGED
@@ -22,21 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
|
-
};
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.
|
30
|
-
const
|
31
|
-
const formUtils = __importStar(require("./formUtils"));
|
32
|
-
const Evaluator_1 = require("./Evaluator");
|
33
|
-
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
34
|
-
Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
|
35
|
-
const FormioUtils = Object.assign(Object.assign(Object.assign({}, utils), formUtils), { Evaluator: Evaluator_1.Evaluator });
|
26
|
+
exports.Utils = void 0;
|
27
|
+
const FormioUtils = __importStar(require("./utils"));
|
36
28
|
exports.Utils = FormioUtils;
|
37
29
|
if (typeof global === 'object') {
|
38
30
|
global.FormioUtils = FormioUtils;
|
39
31
|
}
|
40
|
-
__exportStar(require("./utils"), exports);
|
41
|
-
__exportStar(require("./formUtils"), exports);
|
42
32
|
exports.default = FormioUtils;
|
package/lib/cjs/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/cjs/utils/utils.js
CHANGED
@@ -1,19 +1,57 @@
|
|
1
1
|
"use strict";
|
2
|
+
/* global jQuery */
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
+
if (k2 === undefined) k2 = k;
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
+
}
|
9
|
+
Object.defineProperty(o, k2, desc);
|
10
|
+
}) : (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
o[k2] = m[k];
|
13
|
+
}));
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16
|
+
};
|
2
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
19
|
};
|
5
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
7
|
-
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = void 0;
|
8
|
-
/* global jQuery */
|
21
|
+
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
22
|
+
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
|
9
23
|
const lodash_1 = __importDefault(require("lodash"));
|
24
|
+
exports._ = lodash_1.default;
|
25
|
+
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
26
|
+
exports.jsonLogic = json_logic_js_1.default;
|
10
27
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
28
|
+
exports.moment = moment_timezone_1.default;
|
11
29
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
30
|
+
const operators_1 = require("./jsonlogic/operators");
|
12
31
|
const dompurify_1 = __importDefault(require("dompurify"));
|
13
32
|
const formUtils_1 = require("./formUtils");
|
14
33
|
const Evaluator_1 = require("./Evaluator");
|
34
|
+
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
15
35
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
36
|
+
exports.ConditionOperators = conditionOperators_1.default;
|
16
37
|
const core_1 = require("@formio/core");
|
38
|
+
const interpolate = Evaluator_1.Evaluator.interpolate;
|
39
|
+
exports.interpolate = interpolate;
|
40
|
+
__exportStar(require("./formUtils"), exports);
|
41
|
+
// Configure JsonLogic
|
42
|
+
operators_1.lodashOperators.forEach((name) => json_logic_js_1.default.add_operation(`_${name}`, lodash_1.default[name]));
|
43
|
+
// Retrieve Any Date
|
44
|
+
json_logic_js_1.default.add_operation('getDate', (date) => {
|
45
|
+
return (0, moment_timezone_1.default)(date).toISOString();
|
46
|
+
});
|
47
|
+
// Set Relative Minimum Date
|
48
|
+
json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
|
49
|
+
return (0, moment_timezone_1.default)().subtract(relativeMinDate, 'days').toISOString();
|
50
|
+
});
|
51
|
+
// Set Relative Maximum Date
|
52
|
+
json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
53
|
+
return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
|
54
|
+
});
|
17
55
|
/**
|
18
56
|
* Evaluate a method.
|
19
57
|
* @param {Function|string|object} func - The function to evaluate.
|
@@ -297,7 +335,7 @@ exports.checkCustomConditional = checkCustomConditional;
|
|
297
335
|
*/
|
298
336
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
299
337
|
try {
|
300
|
-
return
|
338
|
+
return json_logic_js_1.default.apply(json, {
|
301
339
|
data,
|
302
340
|
row,
|
303
341
|
form,
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const Formio_1 = require("../Formio");
|
7
7
|
const InputWidget_1 = __importDefault(require("./InputWidget"));
|
8
|
-
const utils_1 = require("../utils");
|
8
|
+
const utils_1 = require("../utils/utils");
|
9
9
|
const moment_1 = __importDefault(require("moment"));
|
10
10
|
const lodash_1 = __importDefault(require("lodash"));
|
11
11
|
const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
|