@formio/js 5.0.0-dev.5956.0e71b6d → 5.0.0-dev.5957.bed9ce0
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 +70 -48
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +73 -51
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Form.js +4 -4
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +13 -13
- package/lib/cjs/Webform.js +132 -131
- package/lib/cjs/WebformBuilder.js +10 -10
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +11 -10
- package/lib/cjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/cjs/components/_classes/field/Field.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +2 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +3 -3
- package/lib/cjs/components/address/Address.d.ts +2 -1
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +4 -4
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +15 -15
- package/lib/cjs/components/form/Form.js +4 -4
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +1 -1
- package/lib/cjs/components/select/Select.js +5 -5
- package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +2 -2
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/formio.form.js +4 -0
- package/lib/cjs/translations/en.d.ts +234 -81
- package/lib/cjs/translations/en.js +8 -81
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +32 -5
- package/lib/mjs/Form.js +4 -4
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +13 -13
- package/lib/mjs/Webform.js +142 -141
- package/lib/mjs/WebformBuilder.js +10 -10
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +11 -10
- package/lib/mjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/mjs/components/_classes/field/Field.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +2 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +3 -3
- package/lib/mjs/components/address/Address.d.ts +2 -1
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +4 -4
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +15 -15
- package/lib/mjs/components/form/Form.js +4 -4
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +1 -1
- package/lib/mjs/components/select/Select.js +7 -7
- package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +2 -2
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/formio.form.js +4 -0
- package/lib/mjs/translations/en.d.ts +234 -81
- package/lib/mjs/translations/en.js +87 -1
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +32 -5
- package/package.json +2 -2
@@ -1,83 +1,10 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
unsavedRowsError: 'Please save all rows before proceeding.',
|
5
|
-
invalidRowsError: 'Please correct invalid rows before proceeding.',
|
6
|
-
invalidRowError: 'Invalid row. Please correct it or delete.',
|
7
|
-
invalidOption: '{{field}} is an invalid value.',
|
8
|
-
invalidDay: '{{field}} is not a valid day.',
|
9
|
-
alertMessageWithLabel: '{{label}}: {{message}}',
|
10
|
-
alertMessage: '{{message}}',
|
11
|
-
complete: 'Submission Complete',
|
12
|
-
error: 'Please fix the following errors before submitting.',
|
13
|
-
errorListHotkey: 'Press Ctrl + Alt + X to go back to the error list.',
|
14
|
-
errorsListNavigationMessage: 'Click to navigate to the field with following error.',
|
15
|
-
submitError: 'Please check the form and correct all errors before submitting.',
|
16
|
-
required: '{{field}} is required',
|
17
|
-
unique: '{{field}} must be unique',
|
18
|
-
array: '{{field}} must be an array',
|
19
|
-
array_nonempty: '{{field}} must be a non-empty array', // eslint-disable-line camelcase
|
20
|
-
nonarray: '{{field}} must not be an array',
|
21
|
-
select: '{{field}} contains an invalid selection',
|
22
|
-
pattern: '{{field}} does not match the pattern {{pattern}}',
|
23
|
-
minLength: '{{field}} must have at least {{length}} characters.',
|
24
|
-
maxLength: '{{field}} must have no more than {{length}} characters.',
|
25
|
-
minWords: '{{field}} must have at least {{length}} words.',
|
26
|
-
maxWords: '{{field}} must have no more than {{length}} words.',
|
27
|
-
min: '{{field}} cannot be less than {{min}}.',
|
28
|
-
max: '{{field}} cannot be greater than {{max}}.',
|
29
|
-
maxDate: '{{field}} should not contain date after {{- maxDate}}',
|
30
|
-
minDate: '{{field}} should not contain date before {{- minDate}}',
|
31
|
-
maxYear: '{{field}} should not contain year greater than {{maxYear}}',
|
32
|
-
minYear: '{{field}} should not contain year less than {{minYear}}',
|
33
|
-
minSelectedCount: 'You must select at least {{minCount}} items',
|
34
|
-
maxSelectedCount: 'You may only select up to {{maxCount}} items',
|
35
|
-
invalid_email: '{{field}} must be a valid email.', // eslint-disable-line camelcase
|
36
|
-
invalid_url: '{{field}} must be a valid url.', // eslint-disable-line camelcase
|
37
|
-
invalid_regex: '{{field}} does not match the pattern {{regex}}.', // eslint-disable-line camelcase
|
38
|
-
invalid_date: '{{field}} is not a valid date.', // eslint-disable-line camelcase
|
39
|
-
invalid_day: '{{field}} is not a valid day.', // eslint-disable-line camelcase
|
40
|
-
invalidValueProperty: 'Invalid Value Property',
|
41
|
-
mask: '{{field}} does not match the mask.',
|
42
|
-
valueIsNotAvailable: '{{ field }} is an invalid value.',
|
43
|
-
stripe: '{{stripe}}',
|
44
|
-
month: 'Month',
|
45
|
-
day: 'Day',
|
46
|
-
year: 'Year',
|
47
|
-
january: 'January',
|
48
|
-
february: 'February',
|
49
|
-
march: 'March',
|
50
|
-
april: 'April',
|
51
|
-
may: 'May',
|
52
|
-
june: 'June',
|
53
|
-
july: 'July',
|
54
|
-
august: 'August',
|
55
|
-
september: 'September',
|
56
|
-
october: 'October',
|
57
|
-
november: 'November',
|
58
|
-
december: 'December',
|
59
|
-
next: 'Next',
|
60
|
-
previous: 'Previous',
|
61
|
-
cancel: 'Cancel',
|
62
|
-
submit: 'Submit Form',
|
63
|
-
confirmCancel: 'Are you sure you want to cancel?',
|
64
|
-
saveDraftInstanceError: 'Cannot save draft because there is no formio instance.',
|
65
|
-
saveDraftAuthError: 'Cannot save draft unless a user is authenticated.',
|
66
|
-
restoreDraftInstanceError: 'Cannot restore draft because there is no formio instance.',
|
67
|
-
saveDraftError: 'Unable to save draft.',
|
68
|
-
restoreDraftError: 'Unable to restore draft.',
|
69
|
-
time: 'Invalid time',
|
70
|
-
cancelButtonAriaLabel: 'Cancel button. Click to reset the form',
|
71
|
-
previousButtonAriaLabel: 'Previous button. Click to go back to the previous tab',
|
72
|
-
nextButtonAriaLabel: 'Next button. Click to go to the next tab',
|
73
|
-
submitButtonAriaLabel: 'Submit Form button. Click to submit the form',
|
74
|
-
reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
|
75
|
-
reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
|
76
|
-
apiKey: 'API Key is not unique: {{key}}',
|
77
|
-
typeRemaining: '{{ remaining }} {{ type }} remaining.',
|
78
|
-
typeCount: '{{ count }} {{ type }}',
|
79
|
-
requiredDayField: '{{ field }} is required',
|
80
|
-
requiredDayEmpty: '{{ field }} is required',
|
81
|
-
requiredMonthField: '{{ field }} is required',
|
82
|
-
requiredYearField: '{{ field }} is required'
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
83
4
|
};
|
5
|
+
var _a;
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
+
const bootstrap_1 = __importDefault(require("@formio/bootstrap"));
|
8
|
+
exports.default = Object.assign(Object.assign({}, (((_a = bootstrap_1.default === null || bootstrap_1.default === void 0 ? void 0 : bootstrap_1.default.translations) === null || _a === void 0 ? void 0 : _a.en) || {})), { unsavedRowsError: 'Please save all rows before proceeding.', invalidRowsError: 'Please correct invalid rows before proceeding.', invalidRowError: 'Invalid row. Please correct it or delete.', invalidOption: '{{field}} is an invalid value.', invalidDay: '{{field}} is not a valid day.', alertMessageWithLabel: '{{label}}: {{message}}', alertMessage: '{{message}}', complete: 'Submission Complete', error: 'Please fix the following errors before submitting.', errorListHotkey: 'Press Ctrl + Alt + X to go back to the error list.', errorsListNavigationMessage: 'Click to navigate to the field with following error.', submitError: 'Please check the form and correct all errors before submitting.', required: '{{field}} is required', unique: '{{field}} must be unique', array: '{{field}} must be an array', array_nonempty: '{{field}} must be a non-empty array', nonarray: '{{field}} must not be an array', select: '{{field}} contains an invalid selection', pattern: '{{field}} does not match the pattern {{pattern}}', minLength: '{{field}} must have at least {{length}} characters.', maxLength: '{{field}} must have no more than {{length}} characters.', minWords: '{{field}} must have at least {{length}} words.', maxWords: '{{field}} must have no more than {{length}} words.', min: '{{field}} cannot be less than {{min}}.', max: '{{field}} cannot be greater than {{max}}.', maxDate: '{{field}} should not contain date after {{- maxDate}}', minDate: '{{field}} should not contain date before {{- minDate}}', maxYear: '{{field}} should not contain year greater than {{maxYear}}', minYear: '{{field}} should not contain year less than {{minYear}}', minSelectedCount: 'You must select at least {{minCount}} items', maxSelectedCount: 'You may only select up to {{maxCount}} items', invalid_email: '{{field}} must be a valid email.', invalid_url: '{{field}} must be a valid url.', invalid_regex: '{{field}} does not match the pattern {{regex}}.', invalid_date: '{{field}} is not a valid date.', invalid_day: '{{field}} is not a valid day.', invalidValueProperty: 'Invalid Value Property', mask: '{{field}} does not match the mask.', valueIsNotAvailable: '{{ field }} is an invalid value.', stripe: '{{stripe}}', month: 'Month', day: 'Day', year: 'Year', january: 'January', february: 'February', march: 'March', april: 'April', may: 'May', june: 'June', july: 'July', august: 'August', september: 'September', october: 'October', november: 'November', december: 'December', next: 'Next', previous: 'Previous', cancel: 'Cancel', submit: 'Submit Form', confirmCancel: 'Are you sure you want to cancel?', saveDraftInstanceError: 'Cannot save draft because there is no formio instance.', saveDraftAuthError: 'Cannot save draft unless a user is authenticated.', restoreDraftInstanceError: 'Cannot restore draft because there is no formio instance.', saveDraftError: 'Unable to save draft.', restoreDraftError: 'Unable to restore draft.', time: 'Invalid time', cancelButtonAriaLabel: 'Cancel button. Click to reset the form', previousButtonAriaLabel: 'Previous button. Click to go back to the previous tab', nextButtonAriaLabel: 'Next button. Click to go to the next tab', submitButtonAriaLabel: 'Submit Form button. Click to submit the form', reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error', reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission', apiKey: 'API Key is not unique: {{key}}', typeRemaining: '{{ remaining }} {{ type }} remaining.', typeCount: '{{ count }} {{ type }}', requiredDayField: '{{ field }} is required', requiredDayEmpty: '{{ field }} is required', requiredMonthField: '{{ field }} is required', requiredYearField: '{{ field }} is required', formNotReady: 'Form not ready. Use form.ready promise', noFormElement: 'No DOM element for form.', notUniqueKey: 'API Key is not unique', newFormSchema: 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.', missingUrl: 'Missing URL argument', urlNotAttachedToBtn: 'You should add a URL to this button.', loadingProjectSettingsError: 'Could not load project settings', sessionStorageSupportError: 'Session storage is not supported in this browser.', builderUniqueError: `You cannot add more than one {{componentKeyOrTitle}} component to one page.`, pageNotFound: 'Page not found', noDragInfoError: 'There is no Drag Info available for either dragged or sibling element', addonSupportTypeError: 'Addon {{label}} does not support component of type {{type}}', setPathError: 'Should not be setting the path of a component.', calculatedPathDeprecation: 'component.calculatedPath was deprecated, use component.path instead.', unknownTemplate: 'Unknown template: {{name}}', unknownComponent: 'Unknown component: {{type}}', renderTemplateFunctionDeprecation: `Form.io 'render' template function is deprecated.
|
9
|
+
If you need to render template (template A) inside of another template (template B),
|
10
|
+
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`, whenReadyDeprecation: 'The whenReady() method has been deprecated. Please use the dataReady property instead.', loadResourcesError: 'Unable to load resources for {{componentKey}}', noSelectDataConfiguration: 'Select component {{componentKey}} does not have data configuration.', indexedDBSupportError: "Your browser doesn't support current version of indexedDB", caretPositionSavingError: 'An error occurred while trying to save caret position', iteratableRowsError: 'Getter #iteratableRows() is not implemented', checkRowDeprecation: 'Deprecation Warning: checkRow method has been replaced with processRow', noOAuthBtn: 'You must add the OAuth button to a form for it to function properly', noOAuthConfiguration: 'OAuth not configured. You must configure oauth for your project before it will work.', oAuthErrorsTitle: 'The Following Error Has Occured', noOAuthFormUrl: 'You must attach a Form API url to your form in order to use OAuth buttons.', oAuthStateError: 'OAuth state does not match. Please try logging in again.', componentInvalidRowValidation: 'Invalid row validation for {{componentKey}}', videoPlayerNotFound: 'Video player not found in template.', synchronizationFailed: 'Synchronization is failed', fileWithDuplicatedNameInProgress: 'File with the same name is already being uploaded', fileWithDuplicatedNameLoaded: 'File with the same name is already uploaded', nestedForm: 'Nested form', noDataProvided: 'No data provided', subformSubmissionLoadingError: 'Unable to load subform submission {{submissionId}}:', noDelimiterSet: 'In order for thousands separator to work properly, you must set the delimiter to true in the component json', noSiteKey: 'There is no Site Key specified in settings in form JSON', failedToNormalize: 'Failed to normalize value', failedToCompareItems: 'Error while comparing items', editorFocusError: 'An editor did not initialize properly when trying to focus:', quillImageUploadFailed: 'Quill image upload failed', noFilesSelected: 'No files selected', needConfigurationForQuill: 'The WYSIWYG settings are configured for CKEditor. For this renderer, you will need to use configurations for the Quill Editor. See https://quilljs.com/docs/configuration for more information.', waitPdfConverting: 'Converting PDF. Please wait.', uploading: 'Uploading', pasteBelow: 'Paste below', copy: 'Copy', move: 'Move', edit: 'Edit', editJson: 'Edit JSON', remove: 'Remove', clickToSetValue: 'Click to set value', words: 'words', characters: 'characters', addAnother: 'Add Another', yes: 'Yes', no: 'No', wantToClearData: 'Do you want to clear data?', yesDelete: 'Yes, delete it', waitFileProcessing: 'Processing file. Please wait...', wrongFileType: 'File is the wrong type; it must be {{ pattern }}', fileTooSmall: 'File is too small; it must be at least {{ size }}', fileTooBig: 'File is too big; it must be at most {{ size }}', noFileService: 'File Service not provided.', fileProcessingFailed: 'File processing has been failed.', readyForUpload: 'Ready to be uploaded into storage', readyForRemovingFromStorage: 'Ready to be removed from storage', preparingFileToRemove: 'Preparing file to remove', succefullyRemoved: 'Succefully removed', succefullyUploaded: 'Succefully uploaded', maxSelectItems: 'You may only select up to {{maxCount}} items', minSelectItems: 'You must select at least {{minCount}} items', clickToSign: 'Click to Sign', surveyQuestion: 'Question', surveyQuestionValue: 'Value', success: 'Success', noResultsFound: 'No results found', noChoices: 'No choices to choose from', typeToSearch: 'Type to search', loading: 'Loading' });
|
package/lib/cjs/utils/i18n.d.ts
CHANGED
@@ -2,13 +2,16 @@
|
|
2
2
|
* This file is used to mimic the i18n library interface.
|
3
3
|
*/
|
4
4
|
export class I18n {
|
5
|
+
static languages: {};
|
6
|
+
static setDefaultTranslations(languages: any): void;
|
5
7
|
static init(languages?: {}): I18n;
|
6
8
|
static createInstance(): I18n;
|
7
9
|
constructor(languages?: {});
|
8
|
-
languages:
|
10
|
+
languages: any;
|
11
|
+
defaultKeys: any;
|
9
12
|
language: string;
|
10
13
|
currentLanguage: any;
|
11
|
-
setLanguages(languages: any): void;
|
14
|
+
setLanguages(languages: any, noDefaultOverride: any): void;
|
12
15
|
dir(lang?: string): "rtl" | "ltr";
|
13
16
|
changeLanguage(language: any, ready?: null): void;
|
14
17
|
addResourceBundle(language: any, type: any, strings: any): void;
|
package/lib/cjs/utils/i18n.js
CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.I18n = void 0;
|
7
7
|
const utils_1 = require("@formio/core/utils");
|
8
8
|
const i18n_1 = __importDefault(require("../i18n"));
|
9
|
+
const lodash_1 = require("lodash");
|
10
|
+
const core_1 = require("@formio/core");
|
9
11
|
const i18Defaults = {};
|
10
12
|
for (const lang in i18n_1.default.resources) {
|
11
13
|
if (i18n_1.default.resources.hasOwnProperty(lang)) {
|
@@ -17,13 +19,28 @@ for (const lang in i18n_1.default.resources) {
|
|
17
19
|
*/
|
18
20
|
class I18n {
|
19
21
|
constructor(languages = {}) {
|
20
|
-
|
22
|
+
var _a;
|
23
|
+
this.languages = (0, core_1.fastCloneDeep)(I18n.languages || {});
|
24
|
+
this.defaultKeys = ((_a = I18n.languages) === null || _a === void 0 ? void 0 : _a.en) || {};
|
21
25
|
this.language = 'en';
|
22
26
|
this.currentLanguage = i18Defaults.en;
|
23
27
|
this.setLanguages(languages);
|
24
28
|
this.changeLanguage(this.language);
|
25
29
|
}
|
26
|
-
|
30
|
+
static setDefaultTranslations(languages) {
|
31
|
+
if ((0, lodash_1.isEmpty)(languages)) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
for (const lang in languages) {
|
35
|
+
if (lang !== 'language' && languages.hasOwnProperty(lang)) {
|
36
|
+
if (!this.languages[lang]) {
|
37
|
+
this.languages[lang] = {};
|
38
|
+
}
|
39
|
+
this.languages[lang] = Object.assign(Object.assign({}, languages[lang]), this.languages[lang]);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
setLanguages(languages, noDefaultOverride) {
|
27
44
|
if (languages.resources) {
|
28
45
|
for (const lang in languages.resources) {
|
29
46
|
if (languages.resources.hasOwnProperty(lang)) {
|
@@ -50,7 +67,8 @@ class I18n {
|
|
50
67
|
if (!this.languages[lang]) {
|
51
68
|
this.languages[lang] = {};
|
52
69
|
}
|
53
|
-
this.languages[lang] =
|
70
|
+
this.languages[lang] = noDefaultOverride
|
71
|
+
? Object.assign(Object.assign({}, languages[lang]), this.languages[lang]) : Object.assign(Object.assign({}, this.languages[lang]), languages[lang]);
|
54
72
|
}
|
55
73
|
}
|
56
74
|
}
|
@@ -80,14 +98,23 @@ class I18n {
|
|
80
98
|
}
|
81
99
|
t(text, ...args) {
|
82
100
|
var _a;
|
83
|
-
|
101
|
+
let currentTranslation = this.currentLanguage[text];
|
102
|
+
// provide compatibility with cases where the entire phrase is used as a key
|
103
|
+
// get the phrase that is possibly being used as a key
|
104
|
+
const defaultKey = this.defaultKeys[text];
|
105
|
+
if (defaultKey && this.currentLanguage[defaultKey]) {
|
106
|
+
// get translation using the phrase as a key
|
107
|
+
currentTranslation = this.currentLanguage[defaultKey];
|
108
|
+
}
|
109
|
+
if (currentTranslation) {
|
84
110
|
const customTranslationFieldName = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.field;
|
85
111
|
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
86
112
|
args[0].field = this.currentLanguage[customTranslationFieldName];
|
87
113
|
}
|
88
|
-
return utils_1.Evaluator.interpolateString(
|
114
|
+
return utils_1.Evaluator.interpolateString(currentTranslation, ...args);
|
89
115
|
}
|
90
116
|
return utils_1.Evaluator.interpolateString(text, ...args);
|
91
117
|
}
|
92
118
|
}
|
93
119
|
exports.I18n = I18n;
|
120
|
+
I18n.languages = i18Defaults;
|
package/lib/mjs/Form.js
CHANGED
@@ -406,10 +406,10 @@ export default class Form extends Element {
|
|
406
406
|
*/
|
407
407
|
build() {
|
408
408
|
if (!this.instance) {
|
409
|
-
return Promise.reject(
|
409
|
+
return Promise.reject(this.t('formNotReady'));
|
410
410
|
}
|
411
411
|
if (!this.element) {
|
412
|
-
return Promise.reject(
|
412
|
+
return Promise.reject(this.t('noFormElement'));
|
413
413
|
}
|
414
414
|
// Add temporary loader.
|
415
415
|
const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
|
@@ -426,7 +426,7 @@ export default class Form extends Element {
|
|
426
426
|
}
|
427
427
|
render() {
|
428
428
|
if (!this.instance) {
|
429
|
-
return Promise.reject(
|
429
|
+
return Promise.reject(this.t('formNotReady'));
|
430
430
|
}
|
431
431
|
return Promise.resolve(this.instance.render())
|
432
432
|
.then((param) => {
|
@@ -436,7 +436,7 @@ export default class Form extends Element {
|
|
436
436
|
}
|
437
437
|
attach(element) {
|
438
438
|
if (!this.instance) {
|
439
|
-
return Promise.reject(
|
439
|
+
return Promise.reject(this.t('formNotReady'));
|
440
440
|
}
|
441
441
|
if (this.element) {
|
442
442
|
delete this.element.component;
|
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -196,10 +196,10 @@ export default class PDFBuilder extends WebformBuilder {
|
|
196
196
|
const progress = Math.floor((event.loaded / event.total) * 100);
|
197
197
|
this.refs.uploadProgress.style.width = `${progress}%`;
|
198
198
|
if (progress > 98) {
|
199
|
-
this.refs.uploadProgress.innerHTML = this.t('
|
199
|
+
this.refs.uploadProgress.innerHTML = this.t('waitPdfConverting');
|
200
200
|
}
|
201
201
|
else {
|
202
|
-
this.refs.uploadProgress.innerHTML = `${this.t('
|
202
|
+
this.refs.uploadProgress.innerHTML = `${this.t('uploading')} ${progress}%`;
|
203
203
|
}
|
204
204
|
}
|
205
205
|
}, `${this.projectUrl}/upload`, {}, 'file')
|
@@ -236,7 +236,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
236
236
|
return;
|
237
237
|
}
|
238
238
|
this.refs.uploadError.style.display = message ? '' : 'none';
|
239
|
-
this.refs.uploadError.innerHTML = message;
|
239
|
+
this.refs.uploadError.innerHTML = this.t(`${message}`);
|
240
240
|
}
|
241
241
|
createForm(options) {
|
242
242
|
// Instantiate the webform from the PDF class instead of Webform
|
@@ -464,7 +464,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
464
464
|
name: 'showBuilderErrors',
|
465
465
|
data: {
|
466
466
|
compId: comp.component.id,
|
467
|
-
errorMessage:
|
467
|
+
errorMessage: `${this.t('notUniqueKey')}: ${comp.key}`,
|
468
468
|
}
|
469
469
|
});
|
470
470
|
}
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -34,10 +34,10 @@
|
|
34
34
|
*/
|
35
35
|
/**
|
36
36
|
* @typedef {object} ButtonSettings
|
37
|
-
* @property {boolean} [showPrevious] - Show the
|
38
|
-
* @property {boolean} [showNext] - Show the
|
39
|
-
* @property {boolean} [showCancel] - Show the
|
40
|
-
* @property {boolean} [showSubmit] - Show the
|
37
|
+
* @property {boolean} [showPrevious] - Show the 'Previous' button.
|
38
|
+
* @property {boolean} [showNext] - Show the 'Next' button.
|
39
|
+
* @property {boolean} [showCancel] - Show the 'Cancel' button.
|
40
|
+
* @property {boolean} [showSubmit] - Show the 'Submit' button.
|
41
41
|
*/
|
42
42
|
/**
|
43
43
|
* @typedef {object} FormOptions
|
@@ -257,7 +257,7 @@ declare class Webform extends NestedDataComponent {
|
|
257
257
|
get ready(): Promise<any>;
|
258
258
|
/**
|
259
259
|
* Set the loading state for this form, and also show the loader spinner.
|
260
|
-
* @param {boolean} loading - If this form should be
|
260
|
+
* @param {boolean} loading - If this form should be 'loading' or not.
|
261
261
|
*/
|
262
262
|
set loading(loading: boolean);
|
263
263
|
/**
|
@@ -363,13 +363,13 @@ declare class Webform extends NestedDataComponent {
|
|
363
363
|
executeFormController(): false | undefined;
|
364
364
|
build(element: any): Promise<any>;
|
365
365
|
getClassName(): string;
|
366
|
-
render():
|
366
|
+
render(): import("./components/_classes/field/Field").default;
|
367
367
|
redraw(): Promise<void> | Promise<boolean>;
|
368
368
|
attach(element: any): Promise<boolean>;
|
369
369
|
hasRequiredFields(): boolean;
|
370
370
|
/**
|
371
371
|
* Sets a new alert to display in the error dialog of the form.
|
372
|
-
* @param {string} type - The type of alert to display.
|
372
|
+
* @param {string} type - The type of alert to display. 'danger', 'success', 'warning', etc.
|
373
373
|
* @param {string} message - The message to show in the alert.
|
374
374
|
* @param {object} options - The options for the alert.
|
375
375
|
*/
|
@@ -547,19 +547,19 @@ export type SanitizeConfig = {
|
|
547
547
|
};
|
548
548
|
export type ButtonSettings = {
|
549
549
|
/**
|
550
|
-
* - Show the
|
550
|
+
* - Show the 'Previous' button.
|
551
551
|
*/
|
552
552
|
showPrevious?: boolean | undefined;
|
553
553
|
/**
|
554
|
-
* - Show the
|
554
|
+
* - Show the 'Next' button.
|
555
555
|
*/
|
556
556
|
showNext?: boolean | undefined;
|
557
557
|
/**
|
558
|
-
* - Show the
|
558
|
+
* - Show the 'Cancel' button.
|
559
559
|
*/
|
560
560
|
showCancel?: boolean | undefined;
|
561
561
|
/**
|
562
|
-
* - Show the
|
562
|
+
* - Show the 'Submit' button.
|
563
563
|
*/
|
564
564
|
showSubmit?: boolean | undefined;
|
565
565
|
};
|
@@ -739,5 +739,5 @@ export type FormOptions = {
|
|
739
739
|
*/
|
740
740
|
zoom?: number | undefined;
|
741
741
|
};
|
742
|
-
import NestedDataComponent from
|
743
|
-
import EventEmitter from
|
742
|
+
import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
|
743
|
+
import EventEmitter from './EventEmitter';
|