@formio/js 5.1.0-dev.5969.9a6e3f5 → 5.1.0-dev.5972.67b2845
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 +74 -52
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +77 -55
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.js +4 -4
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +12 -12
- 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 +12 -11
- 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/nestedarray/NestedArrayComponent.js +3 -3
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +5 -2
- package/lib/cjs/components/datetime/DateTime.js +4 -0
- package/lib/cjs/components/day/Day.js +4 -20
- package/lib/cjs/components/editgrid/EditGrid.js +4 -4
- package/lib/cjs/components/file/File.js +15 -15
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +11 -7
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- 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.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/components/textfield/TextField.js +3 -0
- 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/Embed.js +1 -1
- package/lib/mjs/Form.js +4 -4
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +12 -12
- 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 +12 -11
- 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/nestedarray/NestedArrayComponent.js +3 -3
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +5 -2
- package/lib/mjs/components/datetime/DateTime.js +5 -1
- package/lib/mjs/components/day/Day.js +4 -20
- package/lib/mjs/components/editgrid/EditGrid.js +4 -4
- package/lib/mjs/components/file/File.js +15 -15
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +10 -7
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- 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.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/components/textfield/TextField.js +3 -0
- package/lib/mjs/formio.form.js +4 -0
- package/lib/mjs/translations/en.d.ts +234 -81
- package/lib/mjs/translations/en.js +89 -3
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +32 -5
- package/package.json +4 -4
@@ -1,4 +1,6 @@
|
|
1
|
+
import bootstrap from '@formio/bootstrap';
|
1
2
|
export default {
|
3
|
+
...(bootstrap?.translations?.en || {}),
|
2
4
|
unsavedRowsError: 'Please save all rows before proceeding.',
|
3
5
|
invalidRowsError: 'Please correct invalid rows before proceeding.',
|
4
6
|
invalidRowError: 'Invalid row. Please correct it or delete.',
|
@@ -24,8 +26,8 @@ export default {
|
|
24
26
|
maxWords: '{{field}} must have no more than {{length}} words.',
|
25
27
|
min: '{{field}} cannot be less than {{min}}.',
|
26
28
|
max: '{{field}} cannot be greater than {{max}}.',
|
27
|
-
maxDate: '{{field}} should not contain date after {{
|
28
|
-
minDate: '{{field}} should not contain date before {{
|
29
|
+
maxDate: '{{field}} should not contain date after {{maxDate}}',
|
30
|
+
minDate: '{{field}} should not contain date before {{minDate}}',
|
29
31
|
maxYear: '{{field}} should not contain year greater than {{maxYear}}',
|
30
32
|
minYear: '{{field}} should not contain year less than {{minYear}}',
|
31
33
|
minSelectedCount: 'You must select at least {{minCount}} items',
|
@@ -77,5 +79,89 @@ export default {
|
|
77
79
|
requiredDayField: '{{ field }} is required',
|
78
80
|
requiredDayEmpty: '{{ field }} is required',
|
79
81
|
requiredMonthField: '{{ field }} is required',
|
80
|
-
requiredYearField: '{{ field }} is required'
|
82
|
+
requiredYearField: '{{ field }} is required',
|
83
|
+
formNotReady: 'Form not ready. Use form.ready promise',
|
84
|
+
noFormElement: 'No DOM element for form.',
|
85
|
+
notUniqueKey: 'API Key is not unique',
|
86
|
+
newFormSchema: 'Form schema is for a newer version, please upgrade your renderer. Some functionality may not work.',
|
87
|
+
missingUrl: 'Missing URL argument',
|
88
|
+
urlNotAttachedToBtn: 'You should add a URL to this button.',
|
89
|
+
loadingProjectSettingsError: 'Could not load project settings',
|
90
|
+
sessionStorageSupportError: 'Session storage is not supported in this browser.',
|
91
|
+
builderUniqueError: `You cannot add more than one {{componentKeyOrTitle}} component to one page.`,
|
92
|
+
pageNotFound: 'Page not found',
|
93
|
+
noDragInfoError: 'There is no Drag Info available for either dragged or sibling element',
|
94
|
+
addonSupportTypeError: 'Addon {{label}} does not support component of type {{type}}',
|
95
|
+
setPathError: 'Should not be setting the path of a component.',
|
96
|
+
calculatedPathDeprecation: 'component.calculatedPath was deprecated, use component.path instead.',
|
97
|
+
unknownTemplate: 'Unknown template: {{name}}',
|
98
|
+
unknownComponent: 'Unknown component: {{type}}',
|
99
|
+
renderTemplateFunctionDeprecation: `Form.io 'render' template function is deprecated.
|
100
|
+
If you need to render template (template A) inside of another template (template B),
|
101
|
+
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`,
|
102
|
+
whenReadyDeprecation: 'The whenReady() method has been deprecated. Please use the dataReady property instead.',
|
103
|
+
loadResourcesError: 'Unable to load resources for {{componentKey}}',
|
104
|
+
noSelectDataConfiguration: 'Select component {{componentKey}} does not have data configuration.',
|
105
|
+
indexedDBSupportError: "Your browser doesn't support current version of indexedDB",
|
106
|
+
caretPositionSavingError: 'An error occurred while trying to save caret position',
|
107
|
+
iteratableRowsError: 'Getter #iteratableRows() is not implemented',
|
108
|
+
checkRowDeprecation: 'Deprecation Warning: checkRow method has been replaced with processRow',
|
109
|
+
noOAuthBtn: 'You must add the OAuth button to a form for it to function properly',
|
110
|
+
noOAuthConfiguration: 'OAuth not configured. You must configure oauth for your project before it will work.',
|
111
|
+
oAuthErrorsTitle: 'The Following Error Has Occured',
|
112
|
+
noOAuthFormUrl: 'You must attach a Form API url to your form in order to use OAuth buttons.',
|
113
|
+
oAuthStateError: 'OAuth state does not match. Please try logging in again.',
|
114
|
+
componentInvalidRowValidation: 'Invalid row validation for {{componentKey}}',
|
115
|
+
videoPlayerNotFound: 'Video player not found in template.',
|
116
|
+
synchronizationFailed: 'Synchronization is failed',
|
117
|
+
fileWithDuplicatedNameInProgress: 'File with the same name is already being uploaded',
|
118
|
+
fileWithDuplicatedNameLoaded: 'File with the same name is already uploaded',
|
119
|
+
nestedForm: 'Nested form',
|
120
|
+
noDataProvided: 'No data provided',
|
121
|
+
subformSubmissionLoadingError: 'Unable to load subform submission {{submissionId}}:',
|
122
|
+
noDelimiterSet: 'In order for thousands separator to work properly, you must set the delimiter to true in the component json',
|
123
|
+
noSiteKey: 'There is no Site Key specified in settings in form JSON',
|
124
|
+
failedToNormalize: 'Failed to normalize value',
|
125
|
+
failedToCompareItems: 'Error while comparing items',
|
126
|
+
editorFocusError: 'An editor did not initialize properly when trying to focus:',
|
127
|
+
quillImageUploadFailed: 'Quill image upload failed',
|
128
|
+
noFilesSelected: 'No files selected',
|
129
|
+
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.',
|
130
|
+
waitPdfConverting: 'Converting PDF. Please wait.',
|
131
|
+
uploading: 'Uploading',
|
132
|
+
pasteBelow: 'Paste below',
|
133
|
+
copy: 'Copy',
|
134
|
+
move: 'Move',
|
135
|
+
edit: 'Edit',
|
136
|
+
editJson: 'Edit JSON',
|
137
|
+
remove: 'Remove',
|
138
|
+
clickToSetValue: 'Click to set value',
|
139
|
+
words: 'words',
|
140
|
+
characters: 'characters',
|
141
|
+
addAnother: 'Add Another',
|
142
|
+
yes: 'Yes',
|
143
|
+
no: 'No',
|
144
|
+
wantToClearData: 'Do you want to clear data?',
|
145
|
+
yesDelete: 'Yes, delete it',
|
146
|
+
waitFileProcessing: 'Processing file. Please wait...',
|
147
|
+
wrongFileType: 'File is the wrong type; it must be {{ pattern }}',
|
148
|
+
fileTooSmall: 'File is too small; it must be at least {{ size }}',
|
149
|
+
fileTooBig: 'File is too big; it must be at most {{ size }}',
|
150
|
+
noFileService: 'File Service not provided.',
|
151
|
+
fileProcessingFailed: 'File processing has been failed.',
|
152
|
+
readyForUpload: 'Ready to be uploaded into storage',
|
153
|
+
readyForRemovingFromStorage: 'Ready to be removed from storage',
|
154
|
+
preparingFileToRemove: 'Preparing file to remove',
|
155
|
+
succefullyRemoved: 'Succefully removed',
|
156
|
+
succefullyUploaded: 'Succefully uploaded',
|
157
|
+
maxSelectItems: 'You may only select up to {{maxCount}} items',
|
158
|
+
minSelectItems: 'You must select at least {{minCount}} items',
|
159
|
+
clickToSign: 'Click to Sign',
|
160
|
+
surveyQuestion: 'Question',
|
161
|
+
surveyQuestionValue: 'Value',
|
162
|
+
success: 'Success',
|
163
|
+
noResultsFound: 'No results found',
|
164
|
+
noChoices: 'No choices to choose from',
|
165
|
+
typeToSearch: 'Type to search',
|
166
|
+
loading: 'Loading',
|
81
167
|
};
|
package/lib/mjs/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/mjs/utils/i18n.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import { Evaluator } from '@formio/core/utils';
|
2
2
|
import i18n from '../i18n';
|
3
|
+
import { isEmpty } from 'lodash';
|
4
|
+
import { fastCloneDeep } from '@formio/core';
|
3
5
|
const i18Defaults = {};
|
4
6
|
for (const lang in i18n.resources) {
|
5
7
|
if (i18n.resources.hasOwnProperty(lang)) {
|
@@ -10,14 +12,29 @@ for (const lang in i18n.resources) {
|
|
10
12
|
* This file is used to mimic the i18n library interface.
|
11
13
|
*/
|
12
14
|
export class I18n {
|
13
|
-
languages = i18Defaults;
|
15
|
+
static languages = i18Defaults;
|
16
|
+
languages = fastCloneDeep(I18n.languages || {});
|
17
|
+
defaultKeys = I18n.languages?.en || {};
|
14
18
|
language = 'en';
|
15
19
|
currentLanguage = i18Defaults.en;
|
16
20
|
constructor(languages = {}) {
|
17
21
|
this.setLanguages(languages);
|
18
22
|
this.changeLanguage(this.language);
|
19
23
|
}
|
20
|
-
|
24
|
+
static setDefaultTranslations(languages) {
|
25
|
+
if (isEmpty(languages)) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
for (const lang in languages) {
|
29
|
+
if (lang !== 'language' && languages.hasOwnProperty(lang)) {
|
30
|
+
if (!this.languages[lang]) {
|
31
|
+
this.languages[lang] = {};
|
32
|
+
}
|
33
|
+
this.languages[lang] = { ...languages[lang], ...this.languages[lang], };
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
setLanguages(languages, noDefaultOverride) {
|
21
38
|
if (languages.resources) {
|
22
39
|
for (const lang in languages.resources) {
|
23
40
|
if (languages.resources.hasOwnProperty(lang)) {
|
@@ -44,7 +61,9 @@ export class I18n {
|
|
44
61
|
if (!this.languages[lang]) {
|
45
62
|
this.languages[lang] = {};
|
46
63
|
}
|
47
|
-
this.languages[lang] =
|
64
|
+
this.languages[lang] = noDefaultOverride
|
65
|
+
? { ...languages[lang], ...this.languages[lang] }
|
66
|
+
: { ...this.languages[lang], ...languages[lang] };
|
48
67
|
}
|
49
68
|
}
|
50
69
|
}
|
@@ -73,12 +92,20 @@ export class I18n {
|
|
73
92
|
this.languages[language] = strings;
|
74
93
|
}
|
75
94
|
t(text, ...args) {
|
76
|
-
|
95
|
+
let currentTranslation = this.currentLanguage[text];
|
96
|
+
// provide compatibility with cases where the entire phrase is used as a key
|
97
|
+
// get the phrase that is possibly being used as a key
|
98
|
+
const defaultKey = this.defaultKeys[text];
|
99
|
+
if (defaultKey && this.currentLanguage[defaultKey]) {
|
100
|
+
// get translation using the phrase as a key
|
101
|
+
currentTranslation = this.currentLanguage[defaultKey];
|
102
|
+
}
|
103
|
+
if (currentTranslation) {
|
77
104
|
const customTranslationFieldName = args[0]?.field;
|
78
105
|
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
79
106
|
args[0].field = this.currentLanguage[customTranslationFieldName];
|
80
107
|
}
|
81
|
-
return Evaluator.interpolateString(
|
108
|
+
return Evaluator.interpolateString(currentTranslation, ...args);
|
82
109
|
}
|
83
110
|
return Evaluator.interpolateString(text, ...args);
|
84
111
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.0-dev.
|
3
|
+
"version": "5.1.0-dev.5972.67b2845",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"build": "yarn doc && yarn lib && yarn dist",
|
42
42
|
"doc": "typedoc",
|
43
43
|
"dist": "gulp clean:dist && webpack --config webpack.config.js && webpack --config webpack.prod.js && gulp build",
|
44
|
-
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && yarn lib:package",
|
44
|
+
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && yarn lib:package && gulp version",
|
45
45
|
"lib:package": "node ./libpackage.js",
|
46
46
|
"version": "node -e 'console.log(require(`./package.json`).version)'",
|
47
47
|
"build-app": "yarn build-app:create-app && yarn build-app:jekyll && yarn build-app:remove-app",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
},
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
82
82
|
"dependencies": {
|
83
|
-
"@formio/bootstrap": "
|
83
|
+
"@formio/bootstrap": "v3.0.0-dev.121.085d187",
|
84
84
|
"@formio/choices.js": "^10.2.1",
|
85
|
-
"@formio/core": "
|
85
|
+
"@formio/core": "v2.4.0-dev.210.e634ab4",
|
86
86
|
"@formio/text-mask-addons": "3.8.0-formio.4",
|
87
87
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
88
88
|
"abortcontroller-polyfill": "^1.7.5",
|