@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
@@ -231,7 +231,7 @@ class WebformBuilder extends Component_1.default {
|
|
231
231
|
}
|
232
232
|
}
|
233
233
|
}).catch((err) => {
|
234
|
-
console.warn(
|
234
|
+
console.warn(`${this.t('loadingProjectSettingsError')}: ${err.message || err}`);
|
235
235
|
});
|
236
236
|
if (!formio.noProject && !isResourcesDisabled && formio.formsUrl) {
|
237
237
|
const resourceOptions = this.options.builder && this.options.builder.resource;
|
@@ -334,18 +334,18 @@ class WebformBuilder extends Component_1.default {
|
|
334
334
|
editJson: 'single'
|
335
335
|
});
|
336
336
|
if (component.refs.copyComponent) {
|
337
|
-
this.attachTooltip(component.refs.copyComponent, this.t('
|
337
|
+
this.attachTooltip(component.refs.copyComponent, this.t('copy'));
|
338
338
|
component.addEventListener(component.refs.copyComponent, 'click', () => this.copyComponent(component));
|
339
339
|
}
|
340
340
|
if (component.refs.pasteComponent) {
|
341
|
-
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('
|
341
|
+
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('pasteBelow'));
|
342
342
|
component.addEventListener(component.refs.pasteComponent, 'click', () => {
|
343
343
|
pasteToolTip.hide();
|
344
344
|
this.pasteComponent(component);
|
345
345
|
});
|
346
346
|
}
|
347
347
|
if (component.refs.moveComponent) {
|
348
|
-
this.attachTooltip(component.refs.moveComponent, this.t('
|
348
|
+
this.attachTooltip(component.refs.moveComponent, this.t('move'));
|
349
349
|
if (this.keyboardActionsEnabled) {
|
350
350
|
component.addEventListener(component.refs.moveComponent, 'click', () => {
|
351
351
|
this.moveComponent(component);
|
@@ -354,15 +354,15 @@ class WebformBuilder extends Component_1.default {
|
|
354
354
|
}
|
355
355
|
const parent = this.getParentElement(element);
|
356
356
|
if (component.refs.editComponent) {
|
357
|
-
this.attachTooltip(component.refs.editComponent, this.t('
|
357
|
+
this.attachTooltip(component.refs.editComponent, this.t('edit'));
|
358
358
|
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, { inDataGrid: component.isInDataGrid }));
|
359
359
|
}
|
360
360
|
if (component.refs.editJson) {
|
361
|
-
this.attachTooltip(component.refs.editJson, this.t('
|
361
|
+
this.attachTooltip(component.refs.editJson, this.t('editJson'));
|
362
362
|
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component));
|
363
363
|
}
|
364
364
|
if (component.refs.removeComponent) {
|
365
|
-
this.attachTooltip(component.refs.removeComponent, this.t('
|
365
|
+
this.attachTooltip(component.refs.removeComponent, this.t('remove'));
|
366
366
|
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
367
367
|
}
|
368
368
|
return element;
|
@@ -819,7 +819,7 @@ class WebformBuilder extends Component_1.default {
|
|
819
819
|
}, true);
|
820
820
|
if (isCompAlreadyExists) {
|
821
821
|
this.webform.redraw();
|
822
|
-
this.webform.setAlert('danger',
|
822
|
+
this.webform.setAlert('danger', this.t('builderUniqueError', { componentKeyOrTitle: lodash_1.default.get(draggableComponent, draggableComponent.uniqueComponent ? 'title' : 'key') }));
|
823
823
|
return;
|
824
824
|
}
|
825
825
|
}
|
@@ -1516,7 +1516,7 @@ class WebformBuilder extends Component_1.default {
|
|
1516
1516
|
*/
|
1517
1517
|
copyComponent(component) {
|
1518
1518
|
if (!window.sessionStorage) {
|
1519
|
-
return console.warn(
|
1519
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1520
1520
|
}
|
1521
1521
|
this.addClass(this.refs.form, 'builder-paste-mode');
|
1522
1522
|
window.sessionStorage.setItem('formio.clipboard', JSON.stringify(component.schema));
|
@@ -1528,7 +1528,7 @@ class WebformBuilder extends Component_1.default {
|
|
1528
1528
|
*/
|
1529
1529
|
pasteComponent(component) {
|
1530
1530
|
if (!window.sessionStorage) {
|
1531
|
-
return console.warn(
|
1531
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1532
1532
|
}
|
1533
1533
|
this.removeClass(this.refs.form, 'builder-paste-mode');
|
1534
1534
|
if (window.sessionStorage) {
|
package/lib/cjs/Wizard.js
CHANGED
package/lib/cjs/WizardBuilder.js
CHANGED
@@ -223,7 +223,7 @@ class WizardBuilder extends WebformBuilder_1.default {
|
|
223
223
|
const isSiblingAnAddPageButton = sibling === null || sibling === void 0 ? void 0 : sibling.classList.contains('wizard-add-page');
|
224
224
|
// We still can paste before Add Page button
|
225
225
|
if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
|
226
|
-
console.warn('
|
226
|
+
console.warn(this.t('noDragInfoError'));
|
227
227
|
return;
|
228
228
|
}
|
229
229
|
const oldPosition = element.dragInfo.index;
|
@@ -545,7 +545,10 @@ class Component extends Element_1.default {
|
|
545
545
|
this.addons.push(addon);
|
546
546
|
}
|
547
547
|
else {
|
548
|
-
console.warn(
|
548
|
+
console.warn(this.t('addonSupportTypeError', {
|
549
|
+
type: this.component.type,
|
550
|
+
label: name.label
|
551
|
+
}));
|
549
552
|
}
|
550
553
|
}
|
551
554
|
return addon;
|
@@ -597,7 +600,7 @@ class Component extends Element_1.default {
|
|
597
600
|
return this.paths.dataPath;
|
598
601
|
}
|
599
602
|
set path(path) {
|
600
|
-
throw new Error(
|
603
|
+
throw new Error(this.t('setPathError'));
|
601
604
|
}
|
602
605
|
set parentVisible(value) {
|
603
606
|
this._parentVisible = value;
|
@@ -692,7 +695,7 @@ class Component extends Element_1.default {
|
|
692
695
|
return this.options.attachMode === 'builder';
|
693
696
|
}
|
694
697
|
get calculatedPath() {
|
695
|
-
console.error(
|
698
|
+
console.error(this.t('calculatedPathDeprecation'));
|
696
699
|
return this.path;
|
697
700
|
}
|
698
701
|
get labelPosition() {
|
@@ -858,7 +861,7 @@ class Component extends Element_1.default {
|
|
858
861
|
const name = names[names.length - 1];
|
859
862
|
const templatesByName = Templates_1.default.defaultTemplates[name];
|
860
863
|
if (!templatesByName) {
|
861
|
-
return { template:
|
864
|
+
return { template: this.t('unknownTemplate', { name }) };
|
862
865
|
}
|
863
866
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
864
867
|
if (templateByMode) {
|
@@ -915,9 +918,7 @@ class Component extends Element_1.default {
|
|
915
918
|
data.disabled = this.disabled;
|
916
919
|
data.builder = this.builderMode;
|
917
920
|
data.render = (...args) => {
|
918
|
-
console.warn(
|
919
|
-
If you need to render template (template A) inside of another template (template B),
|
920
|
-
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
921
|
+
console.warn(this.t('renderTemplateFunctionDeprecation'));
|
921
922
|
return this.renderTemplate(...args);
|
922
923
|
};
|
923
924
|
data.label = data.labelInfo || this.labelInfo;
|
@@ -1120,7 +1121,7 @@ class Component extends Element_1.default {
|
|
1120
1121
|
modalLabel = { className: 'field-required' };
|
1121
1122
|
}
|
1122
1123
|
return this.renderModalPreview({
|
1123
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
1124
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
1124
1125
|
messages: '',
|
1125
1126
|
labelInfo: modalLabel,
|
1126
1127
|
});
|
@@ -1145,7 +1146,7 @@ class Component extends Element_1.default {
|
|
1145
1146
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
1146
1147
|
* @returns {string} - The rendered HTML string of a component.
|
1147
1148
|
*/
|
1148
|
-
render(children =
|
1149
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
1149
1150
|
const isVisible = this.visible;
|
1150
1151
|
this.rendered = true;
|
1151
1152
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
@@ -1295,7 +1296,7 @@ class Component extends Element_1.default {
|
|
1295
1296
|
detach() {
|
1296
1297
|
// First iterate through each ref and delete the component so there are no dangling component references.
|
1297
1298
|
lodash_1.default.each(this.refs, (ref) => {
|
1298
|
-
if (
|
1299
|
+
if ((window === null || window === void 0 ? void 0 : window.NodeList) && ref instanceof NodeList) {
|
1299
1300
|
ref.forEach((elem) => {
|
1300
1301
|
delete elem.component;
|
1301
1302
|
});
|
@@ -3343,7 +3344,7 @@ class Component extends Element_1.default {
|
|
3343
3344
|
}
|
3344
3345
|
// Maintain reverse compatibility.
|
3345
3346
|
whenReady() {
|
3346
|
-
console.warn(
|
3347
|
+
console.warn(this.t('whenReadyDeprecation'));
|
3347
3348
|
return this.dataReady;
|
3348
3349
|
}
|
3349
3350
|
get dataReady() {
|
@@ -138,12 +138,12 @@ class ListComponent extends Field_1.default {
|
|
138
138
|
component: this.component,
|
139
139
|
message: err.toString(),
|
140
140
|
});
|
141
|
-
console.warn(
|
141
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
142
142
|
}
|
143
143
|
/* eslint-disable max-statements */
|
144
144
|
updateItems(searchInput, forceUpdate) {
|
145
145
|
if (!this.component.data) {
|
146
|
-
console.warn(
|
146
|
+
console.warn(this.t('noSelectDataConfiguration', { componentKey: this.key }));
|
147
147
|
this.itemsLoadedResolve();
|
148
148
|
return;
|
149
149
|
}
|
@@ -175,7 +175,7 @@ class ListComponent extends Field_1.default {
|
|
175
175
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
176
176
|
}
|
177
177
|
catch (err) {
|
178
|
-
console.warn(
|
178
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
179
179
|
}
|
180
180
|
}
|
181
181
|
else {
|
@@ -219,7 +219,7 @@ class ListComponent extends Field_1.default {
|
|
219
219
|
return;
|
220
220
|
}
|
221
221
|
if (!window.indexedDB) {
|
222
|
-
window.alert(
|
222
|
+
window.alert(this.t('indexedDBSupportError'));
|
223
223
|
}
|
224
224
|
if (this.component.indexeddb && this.component.indexeddb.database && this.component.indexeddb.table) {
|
225
225
|
const request = window.indexedDB.open(this.component.indexeddb.database);
|
@@ -66,7 +66,7 @@ class Multivalue extends Field_1.default {
|
|
66
66
|
return value;
|
67
67
|
}
|
68
68
|
get addAnother() {
|
69
|
-
return this.t(this.component.addAnother || '
|
69
|
+
return this.t(this.component.addAnother || 'addAnother');
|
70
70
|
}
|
71
71
|
/**
|
72
72
|
* @returns {Field} - The created field.
|
@@ -185,7 +185,7 @@ class Multivalue extends Field_1.default {
|
|
185
185
|
this.saveCaretPosition(element, index);
|
186
186
|
}
|
187
187
|
catch (err) {
|
188
|
-
console.warn('
|
188
|
+
console.warn(this.t('caretPositionSavingError'), err);
|
189
189
|
}
|
190
190
|
// If a mask is present, delay the update to allow mask to update first.
|
191
191
|
if (element.mask) {
|
@@ -22,7 +22,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
22
22
|
return this.iteratableRows[component.rowIndex].data;
|
23
23
|
}
|
24
24
|
get iteratableRows() {
|
25
|
-
throw new Error(
|
25
|
+
throw new Error(this.t('iteratableRowsError'));
|
26
26
|
}
|
27
27
|
get rowIndex() {
|
28
28
|
return this._rowIndex;
|
@@ -65,7 +65,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
65
65
|
return this.validateComponents([this.component], data, flags);
|
66
66
|
}
|
67
67
|
checkRow(...args) {
|
68
|
-
console.log('
|
68
|
+
console.log(this.t('checkRowDeprecation'));
|
69
69
|
return this.processRow.call(this, ...args);
|
70
70
|
}
|
71
71
|
processRow(method, data, opts, row, components, silentCheck) {
|
@@ -119,7 +119,7 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
119
119
|
return '';
|
120
120
|
}
|
121
121
|
const label = component.label || component.key;
|
122
|
-
return `<th style="padding: 5px 10px;">${label}</th>`;
|
122
|
+
return `<th style="padding: 5px 10px;">${this.t(label, { _userInput: true })}</th>`;
|
123
123
|
};
|
124
124
|
const components = this.getComponents(0);
|
125
125
|
for (const component of components) {
|
@@ -312,7 +312,7 @@ class AddressComponent extends Container_1.default {
|
|
312
312
|
return !this.isMultiple && (this.builderMode || this.manualModeEnabled);
|
313
313
|
}
|
314
314
|
get addAnother() {
|
315
|
-
return this.t(this.component.addAnother || '
|
315
|
+
return this.t(this.component.addAnother || 'addAnother');
|
316
316
|
}
|
317
317
|
renderElement(value) {
|
318
318
|
return this.renderTemplate(this.templateName, {
|
@@ -342,17 +342,17 @@ class ButtonComponent extends Field_1.default {
|
|
342
342
|
break;
|
343
343
|
case 'oauth':
|
344
344
|
if (this.root === this) {
|
345
|
-
console.warn('
|
345
|
+
console.warn(this.t('noOAuthBtn'));
|
346
346
|
return;
|
347
347
|
}
|
348
348
|
// Display Alert if OAuth config is missing
|
349
349
|
if (!this.oauthConfig) {
|
350
|
-
this.root.setAlert('danger',
|
350
|
+
this.root.setAlert('danger', this.t('noOAuthConfiguration'));
|
351
351
|
break;
|
352
352
|
}
|
353
353
|
// Display Alert if oAuth has an error is missing
|
354
354
|
if (this.oauthConfig.error) {
|
355
|
-
this.root.setAlert('danger',
|
355
|
+
this.root.setAlert('danger', `${this.t('oAuthErrorsTitle')} ${this.t(this.oauthConfig.error)}`);
|
356
356
|
break;
|
357
357
|
}
|
358
358
|
this.openOauth(this.oauthConfig);
|
@@ -361,7 +361,7 @@ class ButtonComponent extends Field_1.default {
|
|
361
361
|
}
|
362
362
|
openOauth(settings) {
|
363
363
|
if (!this.root.formio) {
|
364
|
-
console.warn(
|
364
|
+
console.warn(this.t('noOAuthFormUrl'));
|
365
365
|
return;
|
366
366
|
}
|
367
367
|
/*eslint-disable camelcase */
|
@@ -409,7 +409,7 @@ class ButtonComponent extends Field_1.default {
|
|
409
409
|
}
|
410
410
|
// TODO: check for error response here
|
411
411
|
if (settings.state !== params.state) {
|
412
|
-
this.root.setAlert('danger',
|
412
|
+
this.root.setAlert('danger', this.t('oAuthStateError'));
|
413
413
|
return;
|
414
414
|
}
|
415
415
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
@@ -442,7 +442,7 @@ class ButtonComponent extends Field_1.default {
|
|
442
442
|
}
|
443
443
|
catch (error) {
|
444
444
|
if (error.name !== 'SecurityError' && (error.name !== 'Error' || error.message !== 'Permission denied')) {
|
445
|
-
this.root.setAlert('danger', error.message || error);
|
445
|
+
this.root.setAlert('danger', this.t(`${error.message || error}`));
|
446
446
|
}
|
447
447
|
}
|
448
448
|
if (!popup || popup.closed || popup.closed === undefined) {
|
@@ -188,7 +188,7 @@ class CheckBoxComponent extends Field_1.default {
|
|
188
188
|
if (lodash_1.default.isUndefined(value) && this.inDataTable) {
|
189
189
|
return '';
|
190
190
|
}
|
191
|
-
return this.t(hasValue ? '
|
191
|
+
return this.t(hasValue ? 'yes' : 'no');
|
192
192
|
}
|
193
193
|
updateValue(value, flags) {
|
194
194
|
// If this is a radio and is alredy checked, uncheck it.
|
@@ -342,7 +342,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
342
342
|
}
|
343
343
|
onReorder(element, _target, _source, sibling) {
|
344
344
|
if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
|
345
|
-
console.warn('
|
345
|
+
console.warn(this.t('noDragInfoError'));
|
346
346
|
return;
|
347
347
|
}
|
348
348
|
const oldPosition = element.dragInfo.index;
|
@@ -411,7 +411,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
411
411
|
row
|
412
412
|
});
|
413
413
|
this.checkConditions();
|
414
|
-
this.triggerChange();
|
414
|
+
this.triggerChange({ modified: true });
|
415
415
|
this.redraw().then(() => {
|
416
416
|
this.focusOnNewRowElement(this.rows[index]);
|
417
417
|
});
|
@@ -491,6 +491,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
491
491
|
options.name += `[${rowIndex}]`;
|
492
492
|
options.row = `${rowIndex}-${colIndex}`;
|
493
493
|
options.rowIndex = rowIndex;
|
494
|
+
options.onChange = (flags, changed, modified) => {
|
495
|
+
this.triggerChange({ modified });
|
496
|
+
};
|
494
497
|
let columnComponent;
|
495
498
|
if (this.builderMode) {
|
496
499
|
col.id = col.id + rowIndex;
|
@@ -103,6 +103,10 @@ class DateTimeComponent extends Input_1.default {
|
|
103
103
|
}
|
104
104
|
/* eslint-disable camelcase */
|
105
105
|
this.component.widget = Object.assign({ type: 'calendar', timezone, displayInTimezone: lodash_1.default.get(this.component, 'displayInTimezone', 'viewer'), locale: this.options.language, useLocaleSettings: lodash_1.default.get(this.component, 'useLocaleSettings', false), allowInput: lodash_1.default.get(this.component, 'allowInput', true), mode: 'single', enableTime: lodash_1.default.get(this.component, 'enableTime', true), noCalendar: !lodash_1.default.get(this.component, 'enableDate', true), format: this.component.format, hourIncrement: lodash_1.default.get(this.component, 'timePicker.hourStep', 1), minuteIncrement: lodash_1.default.get(this.component, 'timePicker.minuteStep', 5), time_24hr: time24hr, readOnly: this.options.readOnly, minDate: lodash_1.default.get(this.component, 'datePicker.minDate'), disabledDates: lodash_1.default.get(this.component, 'datePicker.disable'), disableWeekends: lodash_1.default.get(this.component, 'datePicker.disableWeekends'), disableWeekdays: lodash_1.default.get(this.component, 'datePicker.disableWeekdays'), disableFunction: lodash_1.default.get(this.component, 'datePicker.disableFunction'), maxDate: lodash_1.default.get(this.component, 'datePicker.maxDate') }, customOptions);
|
106
|
+
// update originalComponent to include widget and other updated settings
|
107
|
+
// it is done here since these settings depend on properties present after the component is initialized
|
108
|
+
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
109
|
+
this.originalComponent = (0, utils_2.fastCloneDeep)(this.component);
|
106
110
|
/* eslint-enable camelcase */
|
107
111
|
}
|
108
112
|
get defaultSchema() {
|
@@ -7,6 +7,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
8
8
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
9
9
|
const utils_1 = require("../../utils/utils");
|
10
|
+
const core_1 = require("@formio/core");
|
10
11
|
class DayComponent extends Field_1.default {
|
11
12
|
static schema(...extend) {
|
12
13
|
return Field_1.default.schema({
|
@@ -173,7 +174,7 @@ class DayComponent extends Field_1.default {
|
|
173
174
|
this._months = [
|
174
175
|
{
|
175
176
|
value: '',
|
176
|
-
label: lodash_1.default.get(this.component, 'fields.month.placeholder') || (this.hideInputLabels ? this.t('
|
177
|
+
label: lodash_1.default.get(this.component, 'fields.month.placeholder') || (this.hideInputLabels ? this.t('month') : '')
|
177
178
|
},
|
178
179
|
{ value: 1, label: 'January' },
|
179
180
|
{ value: 2, label: 'February' },
|
@@ -267,7 +268,7 @@ class DayComponent extends Field_1.default {
|
|
267
268
|
this.saveCaretPosition(element, name);
|
268
269
|
}
|
269
270
|
catch (err) {
|
270
|
-
console.warn('
|
271
|
+
console.warn(this.t('caretPositionSavingError'), err);
|
271
272
|
}
|
272
273
|
this.updateValue(null, {
|
273
274
|
modified: true,
|
@@ -474,24 +475,7 @@ class DayComponent extends Field_1.default {
|
|
474
475
|
* @returns {string} - the format for the value string.
|
475
476
|
*/
|
476
477
|
get format() {
|
477
|
-
|
478
|
-
if (this.component.dayFirst && this.showDay) {
|
479
|
-
format += 'D/';
|
480
|
-
}
|
481
|
-
if (this.showMonth) {
|
482
|
-
format += 'M/';
|
483
|
-
}
|
484
|
-
if (!this.component.dayFirst && this.showDay) {
|
485
|
-
format += 'D/';
|
486
|
-
}
|
487
|
-
if (this.showYear) {
|
488
|
-
format += 'YYYY';
|
489
|
-
return format;
|
490
|
-
}
|
491
|
-
else {
|
492
|
-
// Trim off the "/" from the end of the format string.
|
493
|
-
return format.length ? format.substring(0, format.length - 1) : format;
|
494
|
-
}
|
478
|
+
return (0, core_1.getDayFormat)(this.component);
|
495
479
|
}
|
496
480
|
/**
|
497
481
|
* Return the date for this component.
|
@@ -120,10 +120,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
120
120
|
}
|
121
121
|
get defaultDialogTemplate() {
|
122
122
|
return `
|
123
|
-
<h3 ${this._referenceAttributeName}="dialogHeader">${this.t('
|
123
|
+
<h3 ${this._referenceAttributeName}="dialogHeader">${this.t('wantToClearData')}</h3>
|
124
124
|
<div style="display:flex; justify-content: flex-end;">
|
125
|
-
<button ${this._referenceAttributeName}="dialogCancelButton" class="btn btn-secondary" aria-label="${this.t('
|
126
|
-
<button ${this._referenceAttributeName}="dialogYesButton" class="btn btn-danger" aria-label="${this.t('
|
125
|
+
<button ${this._referenceAttributeName}="dialogCancelButton" class="btn btn-secondary" aria-label="${this.t('cancel')}">${this.t('cancel')}</button>
|
126
|
+
<button ${this._referenceAttributeName}="dialogYesButton" class="btn btn-danger" aria-label="${this.t('yesDelete')}">${this.t('yesDelete')}</button>
|
127
127
|
</div>
|
128
128
|
`;
|
129
129
|
}
|
@@ -1038,7 +1038,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1038
1038
|
if (valid === null) {
|
1039
1039
|
editRow.errors.push({
|
1040
1040
|
type: 'error',
|
1041
|
-
message:
|
1041
|
+
message: this.t('componentInvalidRowValidation', { componentKey: this.key })
|
1042
1042
|
});
|
1043
1043
|
}
|
1044
1044
|
}
|
@@ -207,7 +207,7 @@ class FileComponent extends Field_1.default {
|
|
207
207
|
this.videoStream = stream;
|
208
208
|
const { videoPlayer } = this.refs;
|
209
209
|
if (!videoPlayer) {
|
210
|
-
console.warn(
|
210
|
+
console.warn(this.t('videoPlayerNotFound'));
|
211
211
|
this.cameraMode = false;
|
212
212
|
this.redraw();
|
213
213
|
return;
|
@@ -232,7 +232,7 @@ class FileComponent extends Field_1.default {
|
|
232
232
|
takePicture() {
|
233
233
|
const { videoPlayer } = this.refs;
|
234
234
|
if (!videoPlayer) {
|
235
|
-
console.warn(
|
235
|
+
console.warn(this.t('videoPlayerNotFound'));
|
236
236
|
this.cameraMode = false;
|
237
237
|
this.redraw();
|
238
238
|
return;
|
@@ -632,7 +632,7 @@ class FileComponent extends Field_1.default {
|
|
632
632
|
file,
|
633
633
|
size: file.size,
|
634
634
|
status: 'info',
|
635
|
-
message: this.t('
|
635
|
+
message: this.t('waitFileProcessing'),
|
636
636
|
hash: '',
|
637
637
|
};
|
638
638
|
}
|
@@ -663,7 +663,7 @@ class FileComponent extends Field_1.default {
|
|
663
663
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
664
664
|
? {
|
665
665
|
status: 'error',
|
666
|
-
message: this.t(
|
666
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
667
667
|
}
|
668
668
|
: {};
|
669
669
|
}
|
@@ -672,7 +672,7 @@ class FileComponent extends Field_1.default {
|
|
672
672
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
673
673
|
return {
|
674
674
|
status: 'error',
|
675
|
-
message: this.t('
|
675
|
+
message: this.t('wrongFileType', {
|
676
676
|
pattern: this.component.filePattern,
|
677
677
|
}),
|
678
678
|
};
|
@@ -681,7 +681,7 @@ class FileComponent extends Field_1.default {
|
|
681
681
|
if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
|
682
682
|
return {
|
683
683
|
status: 'error',
|
684
|
-
message: this.t('
|
684
|
+
message: this.t('fileTooSmall', {
|
685
685
|
size: this.component.fileMinSize,
|
686
686
|
}),
|
687
687
|
};
|
@@ -690,7 +690,7 @@ class FileComponent extends Field_1.default {
|
|
690
690
|
if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
|
691
691
|
return {
|
692
692
|
status: 'error',
|
693
|
-
message: this.t('
|
693
|
+
message: this.t('fileTooBig', {
|
694
694
|
size: this.component.fileMaxSize,
|
695
695
|
}),
|
696
696
|
};
|
@@ -702,7 +702,7 @@ class FileComponent extends Field_1.default {
|
|
702
702
|
return !fileService
|
703
703
|
? {
|
704
704
|
status: 'error',
|
705
|
-
message: this.t('
|
705
|
+
message: this.t('noFileService'),
|
706
706
|
}
|
707
707
|
: {};
|
708
708
|
}
|
@@ -752,7 +752,7 @@ class FileComponent extends Field_1.default {
|
|
752
752
|
this.fileDropHidden = false;
|
753
753
|
return {
|
754
754
|
status: 'error',
|
755
|
-
message: this.t('
|
755
|
+
message: this.t('fileProcessingFailed'),
|
756
756
|
};
|
757
757
|
}
|
758
758
|
finally {
|
@@ -788,7 +788,7 @@ class FileComponent extends Field_1.default {
|
|
788
788
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
789
789
|
}
|
790
790
|
if (this.autoSync) {
|
791
|
-
fileToSync.message = this.t('
|
791
|
+
fileToSync.message = this.t('readyForUpload');
|
792
792
|
}
|
793
793
|
this.filesToSync.filesToUpload.push(Object.assign(Object.assign({}, fileToSync), { message: fileToSync.message, file: processedFile.file || file, url: this.interpolate(this.component.url, { file: fileToSync }), groupPermissions, groupResourceId: groupKey ? this.currentForm.submission.data[groupKey]._id : null }));
|
794
794
|
});
|
@@ -821,8 +821,8 @@ class FileComponent extends Field_1.default {
|
|
821
821
|
}
|
822
822
|
prepareFileToDelete(fileInfo) {
|
823
823
|
this.filesToSync.filesToDelete.push(Object.assign(Object.assign({}, fileInfo), { status: 'info', message: this.autoSync
|
824
|
-
? this.t('
|
825
|
-
: this.t('
|
824
|
+
? this.t('readyForRemovingFromStorage')
|
825
|
+
: this.t('preparingFileToRemove') }));
|
826
826
|
const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
|
827
827
|
this.splice(index);
|
828
828
|
this.redraw();
|
@@ -862,7 +862,7 @@ class FileComponent extends Field_1.default {
|
|
862
862
|
}
|
863
863
|
yield this.deleteFile(fileToSync);
|
864
864
|
fileToSync.status = 'success';
|
865
|
-
fileToSync.message = this.t('
|
865
|
+
fileToSync.message = this.t('succefullyRemoved');
|
866
866
|
}
|
867
867
|
catch (response) {
|
868
868
|
fileToSync.status = 'error';
|
@@ -930,7 +930,7 @@ class FileComponent extends Field_1.default {
|
|
930
930
|
}
|
931
931
|
fileInfo = yield this.uploadFile(fileToSync);
|
932
932
|
fileToSync.status = 'success';
|
933
|
-
fileToSync.message = this.t('
|
933
|
+
fileToSync.message = this.t('succefullyUploaded');
|
934
934
|
fileInfo.originalName = fileToSync.originalName;
|
935
935
|
fileInfo.hash = fileToSync.hash;
|
936
936
|
}
|
@@ -1033,7 +1033,7 @@ class FileComponent extends Field_1.default {
|
|
1033
1033
|
}
|
1034
1034
|
yield this.syncFiles();
|
1035
1035
|
return this.shouldSyncFiles
|
1036
|
-
? Promise.reject('
|
1036
|
+
? Promise.reject(this.t('synchronizationFailed'))
|
1037
1037
|
: Promise.resolve();
|
1038
1038
|
}
|
1039
1039
|
catch (error) {
|
@@ -32,6 +32,7 @@ export default class FormComponent extends Component {
|
|
32
32
|
attach(element: any): Promise<void>;
|
33
33
|
get hasLoadedForm(): any;
|
34
34
|
get isRevisionChanged(): any;
|
35
|
+
get subFormData(): any;
|
35
36
|
subFormReady: Promise<any> | null | undefined;
|
36
37
|
/**
|
37
38
|
* Pass everyComponent to subform.
|