@formio/js 5.1.0-dev.6108.401a61f → 5.1.0-dev.6112.06b0f26
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 +7 -0
- package/dist/formio.builder.css +1 -0
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +1 -0
- package/dist/formio.form.js +116 -149
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +123 -156
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +65 -54
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +76 -76
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Element.d.ts +2 -1
- package/lib/cjs/Element.js +18 -39
- 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.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +10 -11
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +9 -9
- package/lib/cjs/WebformBuilder.d.ts +1 -1
- package/lib/cjs/WebformBuilder.js +45 -21
- 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 +55 -62
- 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.d.ts +1 -1
- package/lib/cjs/components/_classes/input/Input.js +3 -3
- 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.js +1 -1
- 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.js +7 -2
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +15 -13
- package/lib/cjs/components/day/Day.js +2 -2
- 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/fieldset/Fieldset.js +1 -0
- package/lib/cjs/components/file/File.js +1 -1
- package/lib/cjs/components/form/Form.js +14 -2
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- 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.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +20 -4
- 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 +9 -4
- package/lib/cjs/components/textfield/TextField.js +13 -31
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/cjs/translations/en.d.ts +1 -232
- package/lib/cjs/translations/en.js +4 -2
- package/lib/cjs/utils/Evaluator.d.ts +20 -6
- package/lib/cjs/utils/Evaluator.js +38 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +169 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +22 -37
- package/lib/cjs/utils/utils.js +64 -135
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/cjs/widgets/CalendarWidget.js +17 -43
- package/lib/mjs/Element.d.ts +2 -1
- package/lib/mjs/Element.js +11 -9
- 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.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +9 -10
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +7 -7
- package/lib/mjs/WebformBuilder.d.ts +1 -1
- package/lib/mjs/WebformBuilder.js +36 -13
- 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 +28 -12
- 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.d.ts +1 -1
- package/lib/mjs/components/_classes/input/Input.js +3 -3
- 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.js +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datamap/DataMap.js +7 -2
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +15 -13
- package/lib/mjs/components/day/Day.js +2 -2
- 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/fieldset/Fieldset.js +1 -0
- package/lib/mjs/components/file/File.js +1 -1
- package/lib/mjs/components/form/Form.js +13 -2
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- 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.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +20 -4
- 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 +9 -4
- package/lib/mjs/components/textfield/TextField.js +7 -2
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +3 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/mjs/translations/en.d.ts +1 -232
- package/lib/mjs/translations/en.js +8 -47
- package/lib/mjs/utils/Evaluator.d.ts +20 -6
- package/lib/mjs/utils/Evaluator.js +31 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +169 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +22 -37
- package/lib/mjs/utils/utils.js +57 -109
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/mjs/widgets/CalendarWidget.js +17 -43
- package/package.json +5 -5
- package/lib/cjs/i18n.d.ts +0 -13
- package/lib/cjs/i18n.js +0 -19
- package/lib/cjs/utils/i18n.d.ts +0 -19
- package/lib/cjs/utils/i18n.js +0 -120
- package/lib/mjs/i18n.d.ts +0 -13
- package/lib/mjs/i18n.js +0 -14
- package/lib/mjs/utils/i18n.d.ts +0 -19
- package/lib/mjs/utils/i18n.js +0 -112
@@ -89,6 +89,7 @@ export default class SelectComponent extends ListComponent {
|
|
89
89
|
disableInfiniteScroll(): void;
|
90
90
|
set serverCount(value: any);
|
91
91
|
get serverCount(): any;
|
92
|
+
shouldResetChoicesItems(items: any): boolean;
|
92
93
|
setItems(items: any, fromSearch: any): void;
|
93
94
|
selectItems: any;
|
94
95
|
set downloadedResources(value: any);
|
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|
2
2
|
import { Formio } from '../../Formio';
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
4
4
|
import Form from '../../Form';
|
5
|
-
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils
|
5
|
+
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils';
|
6
6
|
import Choices from '../../utils/ChoicesWrapper';
|
7
7
|
export default class SelectComponent extends ListComponent {
|
8
8
|
static schema(...extend) {
|
@@ -359,6 +359,18 @@ export default class SelectComponent extends ListComponent {
|
|
359
359
|
this.downloadedResources.serverCount = this.downloadedResources.length;
|
360
360
|
this.serverCount = this.downloadedResources.length;
|
361
361
|
}
|
362
|
+
shouldResetChoicesItems(items) {
|
363
|
+
if (this.choices._store.choices.length !== items.length) {
|
364
|
+
return true;
|
365
|
+
}
|
366
|
+
for (let item of items) {
|
367
|
+
const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
|
368
|
+
if (!choicesItem) {
|
369
|
+
return true;
|
370
|
+
}
|
371
|
+
}
|
372
|
+
return false;
|
373
|
+
}
|
362
374
|
/* eslint-disable max-statements */
|
363
375
|
setItems(items, fromSearch) {
|
364
376
|
this.selectItems = items;
|
@@ -444,7 +456,7 @@ export default class SelectComponent extends ListComponent {
|
|
444
456
|
this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _.get(item, this.component.idPath, String(index)));
|
445
457
|
});
|
446
458
|
if (this.choices) {
|
447
|
-
this.choices.setChoices(this.selectOptions, 'value', 'label', true);
|
459
|
+
this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
|
448
460
|
}
|
449
461
|
else if (this.loading) {
|
450
462
|
// Re-attach select input.
|
@@ -935,8 +947,9 @@ export default class SelectComponent extends ListComponent {
|
|
935
947
|
});
|
936
948
|
}
|
937
949
|
// Add value options.
|
950
|
+
const value = this.undoValueTyping(this.dataValue);
|
938
951
|
this.addValueOptions();
|
939
|
-
this.setChoicesValue(
|
952
|
+
this.setChoicesValue(value);
|
940
953
|
if (this.isSelectResource && this.refs.addResource) {
|
941
954
|
this.addEventListener(this.refs.addResource, 'click', (event) => {
|
942
955
|
event.preventDefault();
|
@@ -1248,7 +1261,7 @@ export default class SelectComponent extends ListComponent {
|
|
1248
1261
|
}
|
1249
1262
|
_.set(submission.metadata.selectData, this.path, templateData);
|
1250
1263
|
}
|
1251
|
-
if (flags.resetValue && this.root?.submission && !this.options.readOnly) {
|
1264
|
+
if (flags.resetValue && !flags.fromSubmission && this.root?.submission && !this.options.readOnly) {
|
1252
1265
|
const submission = this.root.submission;
|
1253
1266
|
if (!submission.metadata) {
|
1254
1267
|
submission.metadata = {};
|
@@ -1312,6 +1325,9 @@ export default class SelectComponent extends ListComponent {
|
|
1312
1325
|
this.lazyLoadInit = true;
|
1313
1326
|
const searchProperty = this.component.searchField || this.component.valueProperty;
|
1314
1327
|
this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);
|
1328
|
+
this.itemsLoaded.then(() => {
|
1329
|
+
this.setChoicesValue(value, hasPreviousValue, flags);
|
1330
|
+
});
|
1315
1331
|
return changed;
|
1316
1332
|
}
|
1317
1333
|
// Add the value options.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { eachComponent } from '../../../utils
|
2
|
+
import { eachComponent } from '../../../utils';
|
3
3
|
const calculateSingleSelectData = (context, defaultValue) => {
|
4
4
|
const { instance, data } = context;
|
5
5
|
const rawDefaultValue = instance.downloadedResources.find(resource => _.get(resource, data.valueProperty) === defaultValue);
|
@@ -8,6 +8,12 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
8
8
|
* @returns {boolean} - If the value is empty.
|
9
9
|
*/
|
10
10
|
isEmpty(value?: any): boolean;
|
11
|
+
/**
|
12
|
+
* Normalize values coming into updateValue.
|
13
|
+
* @param {any} value - The value to normalize.
|
14
|
+
* @returns {*} - The normalized value
|
15
|
+
*/
|
16
|
+
normalizeValue(value: any): any;
|
11
17
|
setInputsDisabled(value: any, onlyUnchecked: any): void;
|
12
18
|
checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
|
13
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils';
|
3
3
|
import RadioComponent from '../radio/Radio';
|
4
4
|
export default class SelectBoxesComponent extends RadioComponent {
|
5
5
|
static schema(...extend) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import SignaturePad from 'signature_pad';
|
2
2
|
import Input from '../_classes/input/Input';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils
|
4
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils';
|
5
5
|
export default class SignatureComponent extends Input {
|
6
6
|
static schema(...extend) {
|
7
7
|
return Input.schema({
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Field from '../_classes/field/Field';
|
3
|
-
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils
|
3
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils';
|
4
4
|
export default class SurveyComponent extends Field {
|
5
5
|
static schema(...extend) {
|
6
6
|
return Field.schema({
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils
|
1
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils';
|
2
2
|
import Input from '../_classes/input/Input';
|
3
3
|
import Choices from 'choices.js';
|
4
4
|
export default class TagsComponent extends Input {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* global Quill */
|
2
2
|
import TextFieldComponent from '../textfield/TextField';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { uniqueName, getBrowserInfo } from '../../utils
|
4
|
+
import { uniqueName, getBrowserInfo } from '../../utils';
|
5
5
|
export default class TextAreaComponent extends TextFieldComponent {
|
6
6
|
static schema(...extend) {
|
7
7
|
return TextFieldComponent.schema({
|
@@ -58,8 +58,8 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
58
58
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
59
59
|
const elementStyle = this.info.attr.style || '';
|
60
60
|
const children = `
|
61
|
-
<div ${this._referenceAttributeName}="input"
|
62
|
-
class="formio-editor-read-only-content"
|
61
|
+
<div ${this._referenceAttributeName}="input"
|
62
|
+
class="formio-editor-read-only-content"
|
63
63
|
${elementStyle ? `style='${elementStyle}'` : ''}
|
64
64
|
role="textbox"
|
65
65
|
aria-multiline="true"
|
@@ -188,7 +188,12 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
188
188
|
const editorHeight = (numRows * 31) + 14;
|
189
189
|
editor.ui.view.editable.editableElement.style.height = `${(editorHeight)}px`;
|
190
190
|
}
|
191
|
-
|
191
|
+
if (isReadOnly) {
|
192
|
+
editor.enableReadOnlyMode(this.id);
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
editor.disableReadOnlyMode(this.id);
|
196
|
+
}
|
192
197
|
editor.data.set(value);
|
193
198
|
}
|
194
199
|
editorReady(editor);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import Input from '../_classes/input/Input';
|
2
2
|
import { conformToMask } from '@formio/vanilla-text-mask';
|
3
3
|
import Inputmask from 'inputmask';
|
4
|
-
import
|
4
|
+
import FormioUtils from '../../utils';
|
5
5
|
import _ from 'lodash';
|
6
6
|
export default class TextFieldComponent extends Input {
|
7
7
|
static schema(...extend) {
|
@@ -114,7 +114,12 @@ export default class TextFieldComponent extends Input {
|
|
114
114
|
// If no value is provided, then set the defaultValue.
|
115
115
|
if (!value.value) {
|
116
116
|
const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
|
117
|
-
|
117
|
+
if (Array.isArray(defaultValue)) {
|
118
|
+
value.value = _.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
value.value = _.isObject(defaultValue) ? defaultValue.value : defaultValue;
|
122
|
+
}
|
118
123
|
}
|
119
124
|
return value;
|
120
125
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import moment from 'moment';
|
2
2
|
import TextFieldComponent from '../textfield/TextField';
|
3
|
-
import { getBrowserInfo } from '../../utils
|
3
|
+
import { getBrowserInfo } from '../../utils';
|
4
4
|
const defaultDataFormat = 'HH:mm:ss';
|
5
5
|
export default class TimeComponent extends TextFieldComponent {
|
6
6
|
static schema(...extend) {
|
package/lib/mjs/formio.form.js
CHANGED
@@ -8,11 +8,11 @@ import Providers from './providers';
|
|
8
8
|
import Widgets from './widgets';
|
9
9
|
import Form from './Form';
|
10
10
|
import Utils from './utils';
|
11
|
-
import { Evaluator } from './utils/Evaluator';
|
12
11
|
import Licenses from './licenses';
|
13
12
|
import EventEmitter from './EventEmitter';
|
14
13
|
import Webform from './Webform';
|
15
|
-
import { I18n } from '
|
14
|
+
import { I18n } from '@formio/core';
|
15
|
+
import { Evaluator, registerEvaluator } from './utils';
|
16
16
|
Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
17
17
|
Formio.requireLibrary(name, name, path, true)
|
18
18
|
.then((modules) => {
|
@@ -83,7 +83,7 @@ export function registerModule(mod, defaultFn = null, options = {}) {
|
|
83
83
|
Formio.Displays.addDisplays(mod.displays);
|
84
84
|
break;
|
85
85
|
case 'evaluator':
|
86
|
-
|
86
|
+
registerEvaluator(mod.evaluator);
|
87
87
|
break;
|
88
88
|
case 'translations':
|
89
89
|
I18n.setDefaultTranslations(mod.translations);
|
@@ -1,233 +1,2 @@
|
|
1
|
-
declare const _default:
|
2
|
-
unsavedRowsError: string;
|
3
|
-
invalidRowsError: string;
|
4
|
-
invalidRowError: string;
|
5
|
-
invalidOption: string;
|
6
|
-
invalidDay: string;
|
7
|
-
complete: string;
|
8
|
-
error: string;
|
9
|
-
errorListHotkey: string;
|
10
|
-
errorsListNavigationMessage: string;
|
11
|
-
submitError: string;
|
12
|
-
required: string;
|
13
|
-
unique: string;
|
14
|
-
array: string;
|
15
|
-
array_nonempty: string;
|
16
|
-
nonarray: string;
|
17
|
-
select: string;
|
18
|
-
pattern: string;
|
19
|
-
minLength: string;
|
20
|
-
maxLength: string;
|
21
|
-
minWords: string;
|
22
|
-
maxWords: string;
|
23
|
-
min: string;
|
24
|
-
max: string;
|
25
|
-
maxDate: string;
|
26
|
-
minDate: string;
|
27
|
-
maxYear: string;
|
28
|
-
minYear: string;
|
29
|
-
minSelectedCount: string;
|
30
|
-
maxSelectedCount: string;
|
31
|
-
invalid_email: string;
|
32
|
-
invalid_url: string;
|
33
|
-
invalid_regex: string;
|
34
|
-
invalid_date: string;
|
35
|
-
invalid_day: string;
|
36
|
-
invalidValueProperty: string;
|
37
|
-
mask: string;
|
38
|
-
valueIsNotAvailable: string;
|
39
|
-
stripe: string;
|
40
|
-
month: string;
|
41
|
-
day: string;
|
42
|
-
year: string;
|
43
|
-
january: string;
|
44
|
-
february: string;
|
45
|
-
march: string;
|
46
|
-
april: string;
|
47
|
-
may: string;
|
48
|
-
june: string;
|
49
|
-
july: string;
|
50
|
-
august: string;
|
51
|
-
september: string;
|
52
|
-
october: string;
|
53
|
-
november: string;
|
54
|
-
december: string;
|
55
|
-
next: string;
|
56
|
-
previous: string;
|
57
|
-
cancel: string;
|
58
|
-
submit: string;
|
59
|
-
confirmCancel: string;
|
60
|
-
saveDraftInstanceError: string;
|
61
|
-
saveDraftAuthError: string;
|
62
|
-
restoreDraftInstanceError: string;
|
63
|
-
saveDraftError: string;
|
64
|
-
restoreDraftError: string;
|
65
|
-
time: string;
|
66
|
-
cancelButtonAriaLabel: string;
|
67
|
-
previousButtonAriaLabel: string;
|
68
|
-
nextButtonAriaLabel: string;
|
69
|
-
submitButtonAriaLabel: string;
|
70
|
-
reCaptchaTokenValidationError: string;
|
71
|
-
reCaptchaTokenNotSpecifiedError: string;
|
72
|
-
apiKey: string;
|
73
|
-
typeRemaining: string;
|
74
|
-
typeCount: string;
|
75
|
-
requiredDayField: string;
|
76
|
-
requiredDayEmpty: string;
|
77
|
-
requiredMonthField: string;
|
78
|
-
requiredYearField: string;
|
79
|
-
formNotReady: string;
|
80
|
-
noFormElement: string;
|
81
|
-
notUniqueKey: string;
|
82
|
-
newFormSchema: string;
|
83
|
-
missingUrl: string;
|
84
|
-
urlNotAttachedToBtn: string;
|
85
|
-
loadingProjectSettingsError: string;
|
86
|
-
sessionStorageSupportError: string;
|
87
|
-
builderUniqueError: string;
|
88
|
-
pageNotFound: string;
|
89
|
-
noDragInfoError: string;
|
90
|
-
addonSupportTypeError: string;
|
91
|
-
setPathError: string;
|
92
|
-
calculatedPathDeprecation: string;
|
93
|
-
unknownTemplate: string;
|
94
|
-
unknownComponent: string;
|
95
|
-
renderTemplateFunctionDeprecation: string;
|
96
|
-
whenReadyDeprecation: string;
|
97
|
-
loadResourcesError: string;
|
98
|
-
noSelectDataConfiguration: string;
|
99
|
-
indexedDBSupportError: string;
|
100
|
-
caretPositionSavingError: string;
|
101
|
-
iteratableRowsError: string;
|
102
|
-
checkRowDeprecation: string;
|
103
|
-
noOAuthBtn: string;
|
104
|
-
noOAuthConfiguration: string;
|
105
|
-
oAuthErrorsTitle: string;
|
106
|
-
noOAuthFormUrl: string;
|
107
|
-
oAuthStateError: string;
|
108
|
-
componentInvalidRowValidation: string;
|
109
|
-
videoPlayerNotFound: string;
|
110
|
-
synchronizationFailed: string;
|
111
|
-
fileWithDuplicatedNameInProgress: string;
|
112
|
-
fileWithDuplicatedNameLoaded: string;
|
113
|
-
nestedForm: string;
|
114
|
-
noDataProvided: string;
|
115
|
-
subformSubmissionLoadingError: string;
|
116
|
-
noDelimiterSet: string;
|
117
|
-
noSiteKey: string;
|
118
|
-
failedToNormalize: string;
|
119
|
-
failedToCompareItems: string;
|
120
|
-
editorFocusError: string;
|
121
|
-
quillImageUploadFailed: string;
|
122
|
-
noFilesSelected: string;
|
123
|
-
needConfigurationForQuill: string;
|
124
|
-
waitPdfConverting: string;
|
125
|
-
uploading: string;
|
126
|
-
pasteBelow: string;
|
127
|
-
copy: string;
|
128
|
-
move: string;
|
129
|
-
edit: string;
|
130
|
-
editJson: string;
|
131
|
-
remove: string;
|
132
|
-
clickToSetValue: string;
|
133
|
-
words: string;
|
134
|
-
characters: string;
|
135
|
-
addAnother: string;
|
136
|
-
yes: string;
|
137
|
-
no: string;
|
138
|
-
wantToClearData: string;
|
139
|
-
yesDelete: string;
|
140
|
-
waitFileProcessing: string;
|
141
|
-
wrongFileType: string;
|
142
|
-
fileTooSmall: string;
|
143
|
-
fileTooBig: string;
|
144
|
-
noFileService: string;
|
145
|
-
fileProcessingFailed: string;
|
146
|
-
readyForUpload: string;
|
147
|
-
readyForRemovingFromStorage: string;
|
148
|
-
preparingFileToRemove: string;
|
149
|
-
succefullyRemoved: string;
|
150
|
-
succefullyUploaded: string;
|
151
|
-
maxSelectItems: string;
|
152
|
-
minSelectItems: string;
|
153
|
-
clickToSign: string;
|
154
|
-
surveyQuestion: string;
|
155
|
-
surveyQuestionValue: string;
|
156
|
-
success: string;
|
157
|
-
noResultsFound: string;
|
158
|
-
noChoices: string;
|
159
|
-
typeToSearch: string;
|
160
|
-
loading: string;
|
161
|
-
help: string;
|
162
|
-
component: string;
|
163
|
-
save: string;
|
164
|
-
preview: string;
|
165
|
-
dragAndDropComponent: string;
|
166
|
-
searchFields: string;
|
167
|
-
noMatchesFound: string;
|
168
|
-
fileName: string;
|
169
|
-
size: string;
|
170
|
-
type: string;
|
171
|
-
gallery: string;
|
172
|
-
camera: string;
|
173
|
-
dropFilesToAttach: string;
|
174
|
-
useCamera: string;
|
175
|
-
browse: string;
|
176
|
-
takePicture: string;
|
177
|
-
switchToFileUpload: string;
|
178
|
-
completeStatus: string;
|
179
|
-
noStorageSet: string;
|
180
|
-
noFileApiSupport: string;
|
181
|
-
noFormDataSupport: string;
|
182
|
-
noProgressSupport: string;
|
183
|
-
close: string;
|
184
|
-
addResource: string;
|
185
|
-
autocomplete: string;
|
186
|
-
showPreview: string;
|
187
|
-
hidePreview: string;
|
188
|
-
createPage: string;
|
189
|
-
page: string;
|
190
|
-
closeBtnDescription: string;
|
191
|
-
cancelBtnDescription: string;
|
192
|
-
saveBtnDescription: string;
|
193
|
-
addOrRemove: string;
|
194
|
-
anyFileTypesAllowed: string;
|
195
|
-
allowedFileTypes: string;
|
196
|
-
syncing: string;
|
197
|
-
syncNow: string;
|
198
|
-
pressToOpen: string;
|
199
|
-
browseToAttachFileFor: string;
|
200
|
-
or: string;
|
201
|
-
numericOnly: string;
|
202
|
-
uploadPdfFile: string;
|
203
|
-
dropToStart: string;
|
204
|
-
expand: string;
|
205
|
-
collapse: string;
|
206
|
-
add: string;
|
207
|
-
delete: string;
|
208
|
-
revert: string;
|
209
|
-
removeBtnPressToRemove: string;
|
210
|
-
file: string;
|
211
|
-
captureVideo: string;
|
212
|
-
captureAudio: string;
|
213
|
-
captureImage: string;
|
214
|
-
browseFiles: string;
|
215
|
-
noComponentsSetInGrid: string;
|
216
|
-
sortAscending: string;
|
217
|
-
sortDescending: string;
|
218
|
-
filter: string;
|
219
|
-
clear: string;
|
220
|
-
showItemsWithValue: string;
|
221
|
-
gridItemsPerPage: string;
|
222
|
-
gridAllItems: string;
|
223
|
-
recordsSelectedOnPage: string;
|
224
|
-
recordsSelectedInTable: string;
|
225
|
-
gridSelectAll: string;
|
226
|
-
itemsInTable: string;
|
227
|
-
clearSelection: string;
|
228
|
-
editGridRow: string;
|
229
|
-
deleteGridRow: string;
|
230
|
-
selected: string;
|
231
|
-
actions: string;
|
232
|
-
};
|
1
|
+
declare const _default: any;
|
233
2
|
export default _default;
|
@@ -1,59 +1,26 @@
|
|
1
1
|
import bootstrap from '@formio/bootstrap';
|
2
|
+
import { coreEnTranslation } from '@formio/core';
|
3
|
+
import _ from 'lodash';
|
2
4
|
export default {
|
3
5
|
...(bootstrap?.translations?.en || {}),
|
6
|
+
// these keys contain a '-' to strip whitespace in core
|
7
|
+
// which is not handled correctly in the renderer, so we redefine them
|
8
|
+
..._.omit(coreEnTranslation, ['maxDate', 'minDate']),
|
4
9
|
unsavedRowsError: 'Please save all rows before proceeding.',
|
5
10
|
invalidRowsError: 'Please correct invalid rows before proceeding.',
|
6
11
|
invalidRowError: 'Invalid row. Please correct it or delete.',
|
7
12
|
invalidOption: '{{field}} is an invalid value.',
|
8
13
|
invalidDay: '{{field}} is not a valid day.',
|
14
|
+
alertMessageWithLabel: '{{label}}: {{message}}',
|
15
|
+
alertMessage: '{{message}}',
|
9
16
|
complete: 'Submission Complete',
|
10
17
|
error: 'Please fix the following errors before submitting.',
|
11
18
|
errorListHotkey: 'Press Ctrl + Alt + X to go back to the error list.',
|
12
19
|
errorsListNavigationMessage: 'Click to navigate to the field with following error.',
|
13
20
|
submitError: 'Please check the form and correct all errors before submitting.',
|
14
|
-
required: '{{field}} is required',
|
15
|
-
unique: '{{field}} must be unique',
|
16
|
-
array: '{{field}} must be an array',
|
17
|
-
array_nonempty: '{{field}} must be a non-empty array', // eslint-disable-line camelcase
|
18
|
-
nonarray: '{{field}} must not be an array',
|
19
|
-
select: '{{field}} contains an invalid selection',
|
20
|
-
pattern: '{{field}} does not match the pattern {{pattern}}',
|
21
|
-
minLength: '{{field}} must have at least {{length}} characters.',
|
22
|
-
maxLength: '{{field}} must have no more than {{length}} characters.',
|
23
|
-
minWords: '{{field}} must have at least {{length}} words.',
|
24
|
-
maxWords: '{{field}} must have no more than {{length}} words.',
|
25
|
-
min: '{{field}} cannot be less than {{min}}.',
|
26
|
-
max: '{{field}} cannot be greater than {{max}}.',
|
27
21
|
maxDate: '{{field}} should not contain date after {{maxDate}}',
|
28
22
|
minDate: '{{field}} should not contain date before {{minDate}}',
|
29
|
-
maxYear: '{{field}} should not contain year greater than {{maxYear}}',
|
30
|
-
minYear: '{{field}} should not contain year less than {{minYear}}',
|
31
|
-
minSelectedCount: 'You must select at least {{minCount}} items',
|
32
|
-
maxSelectedCount: 'You may only select up to {{maxCount}} items',
|
33
|
-
invalid_email: '{{field}} must be a valid email.', // eslint-disable-line camelcase
|
34
|
-
invalid_url: '{{field}} must be a valid url.', // eslint-disable-line camelcase
|
35
|
-
invalid_regex: '{{field}} does not match the pattern {{regex}}.', // eslint-disable-line camelcase
|
36
|
-
invalid_date: '{{field}} is not a valid date.', // eslint-disable-line camelcase
|
37
|
-
invalid_day: '{{field}} is not a valid day.', // eslint-disable-line camelcase
|
38
|
-
invalidValueProperty: 'Invalid Value Property',
|
39
|
-
mask: '{{field}} does not match the mask.',
|
40
|
-
valueIsNotAvailable: '{{ field }} is an invalid value.',
|
41
23
|
stripe: '{{stripe}}',
|
42
|
-
month: 'Month',
|
43
|
-
day: 'Day',
|
44
|
-
year: 'Year',
|
45
|
-
january: 'January',
|
46
|
-
february: 'February',
|
47
|
-
march: 'March',
|
48
|
-
april: 'April',
|
49
|
-
may: 'May',
|
50
|
-
june: 'June',
|
51
|
-
july: 'July',
|
52
|
-
august: 'August',
|
53
|
-
september: 'September',
|
54
|
-
october: 'October',
|
55
|
-
november: 'November',
|
56
|
-
december: 'December',
|
57
24
|
next: 'Next',
|
58
25
|
previous: 'Previous',
|
59
26
|
cancel: 'Cancel',
|
@@ -72,12 +39,10 @@ export default {
|
|
72
39
|
reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
|
73
40
|
reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
|
74
41
|
apiKey: 'API Key is not unique: {{key}}',
|
42
|
+
apiKeyNotValid: 'API Key is not valid: {{key}}',
|
75
43
|
typeRemaining: '{{ remaining }} {{ type }} remaining.',
|
76
44
|
typeCount: '{{ count }} {{ type }}',
|
77
|
-
requiredDayField: '{{ field }} is required',
|
78
45
|
requiredDayEmpty: '{{ field }} is required',
|
79
|
-
requiredMonthField: '{{ field }} is required',
|
80
|
-
requiredYearField: '{{ field }} is required',
|
81
46
|
formNotReady: 'Form not ready. Use form.ready promise',
|
82
47
|
noFormElement: 'No DOM element for form.',
|
83
48
|
notUniqueKey: 'API Key is not unique',
|
@@ -137,8 +102,6 @@ export default {
|
|
137
102
|
words: 'words',
|
138
103
|
characters: 'characters',
|
139
104
|
addAnother: 'Add Another',
|
140
|
-
yes: 'Yes',
|
141
|
-
no: 'No',
|
142
105
|
wantToClearData: 'Do you want to clear data?',
|
143
106
|
yesDelete: 'Yes, delete it',
|
144
107
|
waitFileProcessing: 'Processing file. Please wait...',
|
@@ -155,8 +118,6 @@ export default {
|
|
155
118
|
maxSelectItems: 'You may only select up to {{maxCount}} items',
|
156
119
|
minSelectItems: 'You must select at least {{minCount}} items',
|
157
120
|
clickToSign: 'Click to Sign',
|
158
|
-
surveyQuestion: 'Question',
|
159
|
-
surveyQuestionValue: 'Value',
|
160
121
|
success: 'Success',
|
161
122
|
noResultsFound: 'No results found',
|
162
123
|
noChoices: 'No choices to choose from',
|
@@ -1,7 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
/**
|
2
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
3
|
+
* global mutable Evaluator instance's interpolate function.
|
4
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
5
|
+
* @returns {any} the interpolation result.
|
6
|
+
*/
|
7
|
+
export function interpolate(...args: any[]): any;
|
8
|
+
/**
|
9
|
+
* Set the evaluator to use for evaluating expressions.
|
10
|
+
* @param {CoreEvaluator} override - The new evaluator instance to use.
|
11
|
+
* @returns {void}
|
12
|
+
*/
|
13
|
+
export function registerEvaluator(override: CoreEvaluator): void;
|
14
|
+
export class DefaultEvaluator extends CoreEvaluator {
|
15
|
+
cache: {};
|
16
|
+
protectedEval: boolean;
|
17
|
+
template(template: any, hash: any): any;
|
18
|
+
interpolate(rawTemplate: any, data: any, _options: any): any;
|
7
19
|
}
|
20
|
+
export let Evaluator: DefaultEvaluator;
|
21
|
+
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
@@ -1,25 +1,24 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import stringHash from 'string-hash';
|
3
|
-
import {
|
4
|
-
export class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
static template(template, hash) {
|
3
|
+
import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
|
4
|
+
export class DefaultEvaluator extends CoreEvaluator {
|
5
|
+
cache = {};
|
6
|
+
protectedEval = false;
|
7
|
+
template(template, hash) {
|
9
8
|
hash = hash || stringHash(template);
|
10
|
-
if (
|
11
|
-
return
|
9
|
+
if (this.cache[hash]) {
|
10
|
+
return this.cache[hash];
|
12
11
|
}
|
13
12
|
try {
|
14
13
|
// Ensure we handle copied templates from the ejs files.
|
15
14
|
template = template.replace(/ctx\./g, '');
|
16
|
-
return (
|
15
|
+
return (this.cache[hash] = _.template(template, this.templateSettings));
|
17
16
|
}
|
18
17
|
catch (err) {
|
19
18
|
console.warn('Error while processing template', err, template);
|
20
19
|
}
|
21
20
|
}
|
22
|
-
|
21
|
+
interpolate(rawTemplate, data, _options) {
|
23
22
|
// Ensure reverse compatability.
|
24
23
|
const options = _.isObject(_options) ? _options : { noeval: _options };
|
25
24
|
if (typeof rawTemplate === 'function') {
|
@@ -33,11 +32,11 @@ export class Evaluator extends CoreEvaluator {
|
|
33
32
|
}
|
34
33
|
rawTemplate = String(rawTemplate);
|
35
34
|
let template;
|
36
|
-
if (
|
37
|
-
return
|
35
|
+
if (this.noeval || options.noeval) {
|
36
|
+
return this.interpolateString(rawTemplate, data, _options);
|
38
37
|
}
|
39
38
|
else {
|
40
|
-
template =
|
39
|
+
template = this.template(rawTemplate);
|
41
40
|
}
|
42
41
|
if (typeof template === 'function') {
|
43
42
|
try {
|
@@ -51,3 +50,22 @@ export class Evaluator extends CoreEvaluator {
|
|
51
50
|
return template;
|
52
51
|
}
|
53
52
|
}
|
53
|
+
export let Evaluator = new DefaultEvaluator();
|
54
|
+
// preserve the standalone interpolate function for backwards compatibility
|
55
|
+
/**
|
56
|
+
* For backwards compatibility we a standalone interpolate function. This merely calls the
|
57
|
+
* global mutable Evaluator instance's interpolate function.
|
58
|
+
* @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
|
59
|
+
* @returns {any} the interpolation result.
|
60
|
+
*/
|
61
|
+
export function interpolate(...args) {
|
62
|
+
return Evaluator.interpolate(...args);
|
63
|
+
}
|
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
|
+
export function registerEvaluator(override) {
|
70
|
+
Evaluator = override;
|
71
|
+
}
|