@formio/js 5.1.0-dev.6101.0682abe → 5.1.0-dev.6102.9a0147c
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/README.md +5 -0
- package/dist/formio.form.js +125 -125
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +131 -131
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +73 -62
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +85 -74
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Element.js +13 -36
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- 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.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +22 -9
- package/lib/cjs/Wizard.d.ts +1 -2
- package/lib/cjs/Wizard.js +18 -24
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +29 -53
- 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 +7 -7
- 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 +5 -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.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 +3 -3
- 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 +3 -3
- package/lib/cjs/utils/Evaluator.d.ts +13 -6
- package/lib/cjs/utils/Evaluator.js +27 -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 +12 -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/EventEmitter.js +2 -2
- package/lib/mjs/Form.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.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +14 -2
- package/lib/mjs/Wizard.d.ts +1 -2
- package/lib/mjs/Wizard.js +17 -23
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +2 -3
- 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 +7 -7
- 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 +5 -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.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 +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 +13 -6
- package/lib/mjs/utils/Evaluator.js +21 -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 +11 -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 +4 -4
@@ -9,7 +9,7 @@ const components_1 = require("@formio/bootstrap/components");
|
|
9
9
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
10
10
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
11
11
|
const Alert_1 = __importDefault(require("../alert/Alert"));
|
12
|
-
const utils_1 = require("../../utils
|
12
|
+
const utils_1 = require("../../utils");
|
13
13
|
const EditRowState = {
|
14
14
|
New: 'new',
|
15
15
|
Editing: 'editing',
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
16
|
-
const utils_1 = require("../../utils
|
16
|
+
const utils_1 = require("../../utils");
|
17
17
|
const downloadjs_1 = __importDefault(require("downloadjs"));
|
18
18
|
const lodash_1 = __importDefault(require("lodash"));
|
19
19
|
const fileProcessor_1 = __importDefault(require("../../providers/processor/fileProcessor"));
|
@@ -905,17 +905,16 @@ class FileComponent extends Field_1.default {
|
|
905
905
|
}
|
906
906
|
uploadFile(fileToSync) {
|
907
907
|
return __awaiter(this, void 0, void 0, function* () {
|
908
|
-
|
908
|
+
return yield this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
|
909
909
|
// Progress callback
|
910
910
|
this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
|
911
|
-
this.emit('fileUploadingStart'
|
911
|
+
this.emit('fileUploadingStart');
|
912
912
|
},
|
913
913
|
// Abort upload callback
|
914
914
|
(abort) => this.abortUploads.push({
|
915
915
|
id: fileToSync.id,
|
916
916
|
abort,
|
917
917
|
}), this.getMultipartOptions(fileToSync));
|
918
|
-
return yield filePromise;
|
919
918
|
});
|
920
919
|
}
|
921
920
|
upload() {
|
@@ -937,7 +936,7 @@ class FileComponent extends Field_1.default {
|
|
937
936
|
fileToSync.message = this.t('succefullyUploaded');
|
938
937
|
fileInfo.originalName = fileToSync.originalName;
|
939
938
|
fileInfo.hash = fileToSync.hash;
|
940
|
-
this.emit('fileUploadingEnd'
|
939
|
+
this.emit('fileUploadingEnd');
|
941
940
|
}
|
942
941
|
catch (response) {
|
943
942
|
fileToSync.status = 'error';
|
@@ -947,7 +946,7 @@ class FileComponent extends Field_1.default {
|
|
947
946
|
: response.type === 'abort'
|
948
947
|
? this.t('Request was aborted')
|
949
948
|
: response.toString();
|
950
|
-
this.emit('fileUploadingEnd'
|
949
|
+
this.emit('fileUploadingEnd');
|
951
950
|
this.emit('fileUploadError', {
|
952
951
|
fileToSync,
|
953
952
|
response,
|
@@ -8,7 +8,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
9
9
|
const ComponentModal_1 = __importDefault(require("../_classes/componentModal/ComponentModal"));
|
10
10
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
11
|
-
const utils_1 = require("../../utils
|
11
|
+
const utils_1 = require("../../utils");
|
12
12
|
const Formio_1 = require("../../Formio");
|
13
13
|
const Form_1 = __importDefault(require("../../Form"));
|
14
14
|
class FormComponent extends Component_1.default {
|
@@ -7,7 +7,7 @@ const text_mask_addons_1 = require("@formio/text-mask-addons");
|
|
7
7
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
9
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
10
|
-
const utils_1 = require("../../utils/
|
10
|
+
const utils_1 = require("../../utils/");
|
11
11
|
class NumberComponent extends Input_1.default {
|
12
12
|
static schema(...extend) {
|
13
13
|
return Input_1.default.schema({
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const NestedComponent_1 = __importDefault(require("../_classes/nested/NestedComponent"));
|
7
|
-
const utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
class PanelComponent extends NestedComponent_1.default {
|
9
9
|
static schema(...extend) {
|
10
10
|
return NestedComponent_1.default.schema({
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
|
8
8
|
const Formio_1 = require("../../Formio");
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class RadioComponent extends ListComponent_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return ListComponent_1.default.schema({
|
@@ -7,7 +7,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const Formio_1 = require("../../Formio");
|
8
8
|
const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
|
9
9
|
const Form_1 = __importDefault(require("../../Form"));
|
10
|
-
const utils_1 = require("../../utils
|
10
|
+
const utils_1 = require("../../utils");
|
11
11
|
const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
|
12
12
|
class SelectComponent extends ListComponent_1.default {
|
13
13
|
static schema(...extend) {
|
@@ -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 utils_1 = require("../../../utils
|
7
|
+
const utils_1 = require("../../../utils");
|
8
8
|
const calculateSingleSelectData = (context, defaultValue) => {
|
9
9
|
const { instance, data } = context;
|
10
10
|
const rawDefaultValue = instance.downloadedResources.find(resource => lodash_1.default.get(resource, data.valueProperty) === defaultValue);
|
@@ -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 utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
const Radio_1 = __importDefault(require("../radio/Radio"));
|
9
9
|
class SelectBoxesComponent extends Radio_1.default {
|
10
10
|
static schema(...extend) {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const signature_pad_1 = __importDefault(require("signature_pad"));
|
7
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class SignatureComponent extends Input_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Input_1.default.schema({
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
8
|
-
const utils_1 = require("../../utils
|
8
|
+
const utils_1 = require("../../utils");
|
9
9
|
class SurveyComponent extends Field_1.default {
|
10
10
|
static schema(...extend) {
|
11
11
|
return Field_1.default.schema({
|
@@ -3,7 +3,7 @@ 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
|
-
const utils_1 = require("../../utils
|
6
|
+
const utils_1 = require("../../utils");
|
7
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
8
8
|
const choices_js_1 = __importDefault(require("choices.js"));
|
9
9
|
class TagsComponent extends Input_1.default {
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* global Quill */
|
7
7
|
const TextField_1 = __importDefault(require("../textfield/TextField"));
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class TextAreaComponent extends TextField_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return TextField_1.default.schema({
|
@@ -63,8 +63,8 @@ class TextAreaComponent extends TextField_1.default {
|
|
63
63
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
64
64
|
const elementStyle = this.info.attr.style || '';
|
65
65
|
const children = `
|
66
|
-
<div ${this._referenceAttributeName}="input"
|
67
|
-
class="formio-editor-read-only-content"
|
66
|
+
<div ${this._referenceAttributeName}="input"
|
67
|
+
class="formio-editor-read-only-content"
|
68
68
|
${elementStyle ? `style='${elementStyle}'` : ''}
|
69
69
|
role="textbox"
|
70
70
|
aria-multiline="true"
|
@@ -1,27 +1,4 @@
|
|
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
|
-
};
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
4
|
};
|
@@ -29,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
30
7
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
31
8
|
const inputmask_1 = __importDefault(require("inputmask"));
|
32
|
-
const
|
9
|
+
const utils_1 = __importDefault(require("../../utils"));
|
33
10
|
const lodash_1 = __importDefault(require("lodash"));
|
34
11
|
class TextFieldComponent extends Input_1.default {
|
35
12
|
static schema(...extend) {
|
@@ -71,7 +48,7 @@ class TextFieldComponent extends Input_1.default {
|
|
71
48
|
} });
|
72
49
|
}
|
73
50
|
static savedValueTypes(schema) {
|
74
|
-
return
|
51
|
+
return utils_1.default.getComponentSavedTypes(schema) || [utils_1.default.componentValueTypes.string];
|
75
52
|
}
|
76
53
|
get defaultSchema() {
|
77
54
|
return TextFieldComponent.schema();
|
@@ -104,7 +81,7 @@ class TextFieldComponent extends Input_1.default {
|
|
104
81
|
displayInTimezone, locale: this.component.widget.locale || this.options.language, saveAs: 'text' });
|
105
82
|
// update originalComponent to include widget settings after component initialization
|
106
83
|
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
107
|
-
this.originalComponent =
|
84
|
+
this.originalComponent = utils_1.default.fastCloneDeep(this.component);
|
108
85
|
}
|
109
86
|
}
|
110
87
|
attach(element) {
|
@@ -175,7 +152,7 @@ class TextFieldComponent extends Input_1.default {
|
|
175
152
|
}
|
176
153
|
else {
|
177
154
|
const placeholderChar = this.placeholderChar;
|
178
|
-
textInput.value = (0, vanilla_text_mask_1.conformToMask)(textValue,
|
155
|
+
textInput.value = (0, vanilla_text_mask_1.conformToMask)(textValue, utils_1.default.getInputMask(mask), { placeholderChar }).conformedValue;
|
179
156
|
}
|
180
157
|
}
|
181
158
|
else {
|
@@ -183,8 +160,8 @@ class TextFieldComponent extends Input_1.default {
|
|
183
160
|
}
|
184
161
|
}
|
185
162
|
unmaskValue(value, format = this.component.displayMask) {
|
186
|
-
const mask =
|
187
|
-
return
|
163
|
+
const mask = utils_1.default.getInputMask(format, this.placeholderChar);
|
164
|
+
return utils_1.default.unmaskValue(value, mask, this.placeholderChar);
|
188
165
|
}
|
189
166
|
/**
|
190
167
|
* Returns the value at this index.
|
@@ -245,7 +222,7 @@ class TextFieldComponent extends Input_1.default {
|
|
245
222
|
return;
|
246
223
|
}
|
247
224
|
inputMask = inputMask || this.component.displayMask || this.component.inputMask;
|
248
|
-
const mask =
|
225
|
+
const mask = utils_1.default.getInputMask(inputMask, this.placeholderChar);
|
249
226
|
this.defaultMask = mask;
|
250
227
|
if (input && inputMask) {
|
251
228
|
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");
|
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,7 +22,6 @@ 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");
|
26
25
|
const licenses_1 = __importDefault(require("./licenses"));
|
27
26
|
exports.Licenses = licenses_1.default;
|
28
27
|
const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
@@ -30,6 +29,7 @@ exports.EventEmitter = EventEmitter_1.default;
|
|
30
29
|
const Webform_1 = __importDefault(require("./Webform"));
|
31
30
|
exports.Webform = Webform_1.default;
|
32
31
|
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 = utils_2.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
|
+
(0, utils_2.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");
|
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");
|
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,7 +1,14 @@
|
|
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
|
+
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -3,26 +3,31 @@ 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.Evaluator = void 0;
|
6
|
+
exports.registerEvaluator = exports.Evaluator = exports.DefaultEvaluator = 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
|
-
|
9
|
+
const core_1 = require("@formio/core");
|
10
|
+
class DefaultEvaluator extends core_1.DefaultEvaluator {
|
11
|
+
constructor() {
|
12
|
+
super(...arguments);
|
13
|
+
this.cache = {};
|
14
|
+
this.protectedEval = false;
|
15
|
+
}
|
16
|
+
template(template, hash) {
|
12
17
|
hash = hash || (0, string_hash_1.default)(template);
|
13
|
-
if (
|
14
|
-
return
|
18
|
+
if (this.cache[hash]) {
|
19
|
+
return this.cache[hash];
|
15
20
|
}
|
16
21
|
try {
|
17
22
|
// Ensure we handle copied templates from the ejs files.
|
18
23
|
template = template.replace(/ctx\./g, '');
|
19
|
-
return (
|
24
|
+
return (this.cache[hash] = lodash_1.default.template(template, this.templateSettings));
|
20
25
|
}
|
21
26
|
catch (err) {
|
22
27
|
console.warn('Error while processing template', err, template);
|
23
28
|
}
|
24
29
|
}
|
25
|
-
|
30
|
+
interpolate(rawTemplate, data, _options) {
|
26
31
|
// Ensure reverse compatability.
|
27
32
|
const options = lodash_1.default.isObject(_options) ? _options : { noeval: _options };
|
28
33
|
if (typeof rawTemplate === 'function') {
|
@@ -36,11 +41,11 @@ class Evaluator extends utils_1.JSONLogicEvaluator {
|
|
36
41
|
}
|
37
42
|
rawTemplate = String(rawTemplate);
|
38
43
|
let template;
|
39
|
-
if (
|
40
|
-
return
|
44
|
+
if (this.noeval || options.noeval) {
|
45
|
+
return this.interpolateString(rawTemplate, data, _options);
|
41
46
|
}
|
42
47
|
else {
|
43
|
-
template =
|
48
|
+
template = this.template(rawTemplate);
|
44
49
|
}
|
45
50
|
if (typeof template === 'function') {
|
46
51
|
try {
|
@@ -54,7 +59,14 @@ class Evaluator extends utils_1.JSONLogicEvaluator {
|
|
54
59
|
return template;
|
55
60
|
}
|
56
61
|
}
|
57
|
-
exports.
|
58
|
-
Evaluator
|
59
|
-
|
60
|
-
|
62
|
+
exports.DefaultEvaluator = DefaultEvaluator;
|
63
|
+
exports.Evaluator = new DefaultEvaluator();
|
64
|
+
/**
|
65
|
+
* Set the evaluator to use for evaluating expressions.
|
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;
|
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 index_1 = require("./index");
|
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, index_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, index_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, index_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, index_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 __1 = require("../");
|
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, __1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
|
29
29
|
&& ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
|
30
|
-
return (0,
|
30
|
+
return (0, __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 Evaluator_1 = require("./Evaluator");
|
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 Evaluator_1.Evaluator.interpolateString(currentTranslation, ...args);
|
115
115
|
}
|
116
|
-
return
|
116
|
+
return Evaluator_1.Evaluator.interpolateString(text, ...args);
|
117
117
|
}
|
118
118
|
}
|
119
119
|
exports.I18n = I18n;
|