@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
@@ -210,7 +210,7 @@ export default class WebformBuilder extends Component {
|
|
210
210
|
}
|
211
211
|
}
|
212
212
|
}).catch((err) => {
|
213
|
-
console.warn(
|
213
|
+
console.warn(`${this.t('loadingProjectSettingsError')}: ${err.message || err}`);
|
214
214
|
});
|
215
215
|
if (!formio.noProject && !isResourcesDisabled && formio.formsUrl) {
|
216
216
|
const resourceOptions = this.options.builder && this.options.builder.resource;
|
@@ -320,18 +320,18 @@ export default class WebformBuilder extends Component {
|
|
320
320
|
editJson: 'single'
|
321
321
|
});
|
322
322
|
if (component.refs.copyComponent) {
|
323
|
-
this.attachTooltip(component.refs.copyComponent, this.t('
|
323
|
+
this.attachTooltip(component.refs.copyComponent, this.t('copy'));
|
324
324
|
component.addEventListener(component.refs.copyComponent, 'click', () => this.copyComponent(component));
|
325
325
|
}
|
326
326
|
if (component.refs.pasteComponent) {
|
327
|
-
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('
|
327
|
+
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('pasteBelow'));
|
328
328
|
component.addEventListener(component.refs.pasteComponent, 'click', () => {
|
329
329
|
pasteToolTip.hide();
|
330
330
|
this.pasteComponent(component);
|
331
331
|
});
|
332
332
|
}
|
333
333
|
if (component.refs.moveComponent) {
|
334
|
-
this.attachTooltip(component.refs.moveComponent, this.t('
|
334
|
+
this.attachTooltip(component.refs.moveComponent, this.t('move'));
|
335
335
|
if (this.keyboardActionsEnabled) {
|
336
336
|
component.addEventListener(component.refs.moveComponent, 'click', () => {
|
337
337
|
this.moveComponent(component);
|
@@ -340,15 +340,15 @@ export default class WebformBuilder extends Component {
|
|
340
340
|
}
|
341
341
|
const parent = this.getParentElement(element);
|
342
342
|
if (component.refs.editComponent) {
|
343
|
-
this.attachTooltip(component.refs.editComponent, this.t('
|
343
|
+
this.attachTooltip(component.refs.editComponent, this.t('edit'));
|
344
344
|
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, { inDataGrid: component.isInDataGrid }));
|
345
345
|
}
|
346
346
|
if (component.refs.editJson) {
|
347
|
-
this.attachTooltip(component.refs.editJson, this.t('
|
347
|
+
this.attachTooltip(component.refs.editJson, this.t('editJson'));
|
348
348
|
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component));
|
349
349
|
}
|
350
350
|
if (component.refs.removeComponent) {
|
351
|
-
this.attachTooltip(component.refs.removeComponent, this.t('
|
351
|
+
this.attachTooltip(component.refs.removeComponent, this.t('remove'));
|
352
352
|
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
353
353
|
}
|
354
354
|
return element;
|
@@ -804,7 +804,7 @@ export default class WebformBuilder extends Component {
|
|
804
804
|
}, true);
|
805
805
|
if (isCompAlreadyExists) {
|
806
806
|
this.webform.redraw();
|
807
|
-
this.webform.setAlert('danger',
|
807
|
+
this.webform.setAlert('danger', this.t('builderUniqueError', { componentKeyOrTitle: _.get(draggableComponent, draggableComponent.uniqueComponent ? 'title' : 'key') }));
|
808
808
|
return;
|
809
809
|
}
|
810
810
|
}
|
@@ -1519,7 +1519,7 @@ export default class WebformBuilder extends Component {
|
|
1519
1519
|
*/
|
1520
1520
|
copyComponent(component) {
|
1521
1521
|
if (!window.sessionStorage) {
|
1522
|
-
return console.warn(
|
1522
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1523
1523
|
}
|
1524
1524
|
this.addClass(this.refs.form, 'builder-paste-mode');
|
1525
1525
|
window.sessionStorage.setItem('formio.clipboard', JSON.stringify(component.schema));
|
@@ -1531,7 +1531,7 @@ export default class WebformBuilder extends Component {
|
|
1531
1531
|
*/
|
1532
1532
|
pasteComponent(component) {
|
1533
1533
|
if (!window.sessionStorage) {
|
1534
|
-
return console.warn(
|
1534
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1535
1535
|
}
|
1536
1536
|
this.removeClass(this.refs.form, 'builder-paste-mode');
|
1537
1537
|
if (window.sessionStorage) {
|
package/lib/mjs/Wizard.js
CHANGED
@@ -605,7 +605,7 @@ export default class Wizard extends Webform {
|
|
605
605
|
this.redraw();
|
606
606
|
return Promise.resolve();
|
607
607
|
}
|
608
|
-
return Promise.reject('
|
608
|
+
return Promise.reject(this.t('pageNotFound'));
|
609
609
|
}
|
610
610
|
pageFieldLogic(page) {
|
611
611
|
if (this.pages?.[page]) {
|
package/lib/mjs/WizardBuilder.js
CHANGED
@@ -217,7 +217,7 @@ export default class WizardBuilder extends WebformBuilder {
|
|
217
217
|
const isSiblingAnAddPageButton = sibling?.classList.contains('wizard-add-page');
|
218
218
|
// We still can paste before Add Page button
|
219
219
|
if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
|
220
|
-
console.warn('
|
220
|
+
console.warn(this.t('noDragInfoError'));
|
221
221
|
return;
|
222
222
|
}
|
223
223
|
const oldPosition = element.dragInfo.index;
|
@@ -509,7 +509,10 @@ export default class Component extends Element {
|
|
509
509
|
this.addons.push(addon);
|
510
510
|
}
|
511
511
|
else {
|
512
|
-
console.warn(
|
512
|
+
console.warn(this.t('addonSupportTypeError', {
|
513
|
+
type: this.component.type,
|
514
|
+
label: name.label
|
515
|
+
}));
|
513
516
|
}
|
514
517
|
}
|
515
518
|
return addon;
|
@@ -561,7 +564,7 @@ export default class Component extends Element {
|
|
561
564
|
return this.paths.dataPath;
|
562
565
|
}
|
563
566
|
set path(path) {
|
564
|
-
throw new Error(
|
567
|
+
throw new Error(this.t('setPathError'));
|
565
568
|
}
|
566
569
|
set parentVisible(value) {
|
567
570
|
this._parentVisible = value;
|
@@ -656,7 +659,7 @@ export default class Component extends Element {
|
|
656
659
|
return this.options.attachMode === 'builder';
|
657
660
|
}
|
658
661
|
get calculatedPath() {
|
659
|
-
console.error(
|
662
|
+
console.error(this.t('calculatedPathDeprecation'));
|
660
663
|
return this.path;
|
661
664
|
}
|
662
665
|
get labelPosition() {
|
@@ -822,7 +825,7 @@ export default class Component extends Element {
|
|
822
825
|
const name = names[names.length - 1];
|
823
826
|
const templatesByName = Templates.defaultTemplates[name];
|
824
827
|
if (!templatesByName) {
|
825
|
-
return { template:
|
828
|
+
return { template: this.t('unknownTemplate', { name }) };
|
826
829
|
}
|
827
830
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
828
831
|
if (templateByMode) {
|
@@ -879,9 +882,7 @@ export default class Component extends Element {
|
|
879
882
|
data.disabled = this.disabled;
|
880
883
|
data.builder = this.builderMode;
|
881
884
|
data.render = (...args) => {
|
882
|
-
console.warn(
|
883
|
-
If you need to render template (template A) inside of another template (template B),
|
884
|
-
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
885
|
+
console.warn(this.t('renderTemplateFunctionDeprecation'));
|
885
886
|
return this.renderTemplate(...args);
|
886
887
|
};
|
887
888
|
data.label = data.labelInfo || this.labelInfo;
|
@@ -1081,7 +1082,7 @@ export default class Component extends Element {
|
|
1081
1082
|
modalLabel = { className: 'field-required' };
|
1082
1083
|
}
|
1083
1084
|
return this.renderModalPreview({
|
1084
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
1085
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
1085
1086
|
messages: '',
|
1086
1087
|
labelInfo: modalLabel,
|
1087
1088
|
});
|
@@ -1106,7 +1107,7 @@ export default class Component extends Element {
|
|
1106
1107
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
1107
1108
|
* @returns {string} - The rendered HTML string of a component.
|
1108
1109
|
*/
|
1109
|
-
render(children =
|
1110
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
1110
1111
|
const isVisible = this.visible;
|
1111
1112
|
this.rendered = true;
|
1112
1113
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
@@ -1263,7 +1264,7 @@ export default class Component extends Element {
|
|
1263
1264
|
detach() {
|
1264
1265
|
// First iterate through each ref and delete the component so there are no dangling component references.
|
1265
1266
|
_.each(this.refs, (ref) => {
|
1266
|
-
if (
|
1267
|
+
if (window?.NodeList && ref instanceof NodeList) {
|
1267
1268
|
ref.forEach((elem) => {
|
1268
1269
|
delete elem.component;
|
1269
1270
|
});
|
@@ -3306,7 +3307,7 @@ export default class Component extends Element {
|
|
3306
3307
|
}
|
3307
3308
|
// Maintain reverse compatibility.
|
3308
3309
|
whenReady() {
|
3309
|
-
console.warn(
|
3310
|
+
console.warn(this.t('whenReadyDeprecation'));
|
3310
3311
|
return this.dataReady;
|
3311
3312
|
}
|
3312
3313
|
get dataReady() {
|
@@ -133,12 +133,12 @@ export default class ListComponent extends Field {
|
|
133
133
|
component: this.component,
|
134
134
|
message: err.toString(),
|
135
135
|
});
|
136
|
-
console.warn(
|
136
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
137
137
|
}
|
138
138
|
/* eslint-disable max-statements */
|
139
139
|
updateItems(searchInput, forceUpdate) {
|
140
140
|
if (!this.component.data) {
|
141
|
-
console.warn(
|
141
|
+
console.warn(this.t('noSelectDataConfiguration', { componentKey: this.key }));
|
142
142
|
this.itemsLoadedResolve();
|
143
143
|
return;
|
144
144
|
}
|
@@ -170,7 +170,7 @@ export default class ListComponent extends Field {
|
|
170
170
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
171
171
|
}
|
172
172
|
catch (err) {
|
173
|
-
console.warn(
|
173
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
174
174
|
}
|
175
175
|
}
|
176
176
|
else {
|
@@ -214,7 +214,7 @@ export default class ListComponent extends Field {
|
|
214
214
|
return;
|
215
215
|
}
|
216
216
|
if (!window.indexedDB) {
|
217
|
-
window.alert(
|
217
|
+
window.alert(this.t('indexedDBSupportError'));
|
218
218
|
}
|
219
219
|
if (this.component.indexeddb && this.component.indexeddb.database && this.component.indexeddb.table) {
|
220
220
|
const request = window.indexedDB.open(this.component.indexeddb.database);
|
@@ -61,7 +61,7 @@ export default class Multivalue extends Field {
|
|
61
61
|
return value;
|
62
62
|
}
|
63
63
|
get addAnother() {
|
64
|
-
return this.t(this.component.addAnother || '
|
64
|
+
return this.t(this.component.addAnother || 'addAnother');
|
65
65
|
}
|
66
66
|
/**
|
67
67
|
* @returns {Field} - The created field.
|
@@ -180,7 +180,7 @@ export default class Multivalue extends Field {
|
|
180
180
|
this.saveCaretPosition(element, index);
|
181
181
|
}
|
182
182
|
catch (err) {
|
183
|
-
console.warn('
|
183
|
+
console.warn(this.t('caretPositionSavingError'), err);
|
184
184
|
}
|
185
185
|
// If a mask is present, delay the update to allow mask to update first.
|
186
186
|
if (element.mask) {
|
@@ -18,7 +18,7 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
18
18
|
return this.iteratableRows[component.rowIndex].data;
|
19
19
|
}
|
20
20
|
get iteratableRows() {
|
21
|
-
throw new Error(
|
21
|
+
throw new Error(this.t('iteratableRowsError'));
|
22
22
|
}
|
23
23
|
get rowIndex() {
|
24
24
|
return this._rowIndex;
|
@@ -63,7 +63,7 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
63
63
|
return this.validateComponents([this.component], data, flags);
|
64
64
|
}
|
65
65
|
checkRow(...args) {
|
66
|
-
console.log('
|
66
|
+
console.log(this.t('checkRowDeprecation'));
|
67
67
|
return this.processRow.call(this, ...args);
|
68
68
|
}
|
69
69
|
processRow(method, data, opts, row, components, silentCheck) {
|
@@ -117,7 +117,7 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
117
117
|
return '';
|
118
118
|
}
|
119
119
|
const label = component.label || component.key;
|
120
|
-
return `<th style="padding: 5px 10px;">${label}</th>`;
|
120
|
+
return `<th style="padding: 5px 10px;">${this.t(label, { _userInput: true })}</th>`;
|
121
121
|
};
|
122
122
|
const components = this.getComponents(0);
|
123
123
|
for (const component of components) {
|
@@ -308,7 +308,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
308
308
|
return !this.isMultiple && (this.builderMode || this.manualModeEnabled);
|
309
309
|
}
|
310
310
|
get addAnother() {
|
311
|
-
return this.t(this.component.addAnother || '
|
311
|
+
return this.t(this.component.addAnother || 'addAnother');
|
312
312
|
}
|
313
313
|
renderElement(value) {
|
314
314
|
return this.renderTemplate(this.templateName, {
|
@@ -336,17 +336,17 @@ export default class ButtonComponent extends Field {
|
|
336
336
|
break;
|
337
337
|
case 'oauth':
|
338
338
|
if (this.root === this) {
|
339
|
-
console.warn('
|
339
|
+
console.warn(this.t('noOAuthBtn'));
|
340
340
|
return;
|
341
341
|
}
|
342
342
|
// Display Alert if OAuth config is missing
|
343
343
|
if (!this.oauthConfig) {
|
344
|
-
this.root.setAlert('danger',
|
344
|
+
this.root.setAlert('danger', this.t('noOAuthConfiguration'));
|
345
345
|
break;
|
346
346
|
}
|
347
347
|
// Display Alert if oAuth has an error is missing
|
348
348
|
if (this.oauthConfig.error) {
|
349
|
-
this.root.setAlert('danger',
|
349
|
+
this.root.setAlert('danger', `${this.t('oAuthErrorsTitle')} ${this.t(this.oauthConfig.error)}`);
|
350
350
|
break;
|
351
351
|
}
|
352
352
|
this.openOauth(this.oauthConfig);
|
@@ -355,7 +355,7 @@ export default class ButtonComponent extends Field {
|
|
355
355
|
}
|
356
356
|
openOauth(settings) {
|
357
357
|
if (!this.root.formio) {
|
358
|
-
console.warn(
|
358
|
+
console.warn(this.t('noOAuthFormUrl'));
|
359
359
|
return;
|
360
360
|
}
|
361
361
|
/*eslint-disable camelcase */
|
@@ -403,7 +403,7 @@ export default class ButtonComponent extends Field {
|
|
403
403
|
}
|
404
404
|
// TODO: check for error response here
|
405
405
|
if (settings.state !== params.state) {
|
406
|
-
this.root.setAlert('danger',
|
406
|
+
this.root.setAlert('danger', this.t('oAuthStateError'));
|
407
407
|
return;
|
408
408
|
}
|
409
409
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
@@ -436,7 +436,7 @@ export default class ButtonComponent extends Field {
|
|
436
436
|
}
|
437
437
|
catch (error) {
|
438
438
|
if (error.name !== 'SecurityError' && (error.name !== 'Error' || error.message !== 'Permission denied')) {
|
439
|
-
this.root.setAlert('danger', error.message || error);
|
439
|
+
this.root.setAlert('danger', this.t(`${error.message || error}`));
|
440
440
|
}
|
441
441
|
}
|
442
442
|
if (!popup || popup.closed || popup.closed === undefined) {
|
@@ -187,7 +187,7 @@ export default class CheckBoxComponent extends Field {
|
|
187
187
|
if (_.isUndefined(value) && this.inDataTable) {
|
188
188
|
return '';
|
189
189
|
}
|
190
|
-
return this.t(hasValue ? '
|
190
|
+
return this.t(hasValue ? 'yes' : 'no');
|
191
191
|
}
|
192
192
|
updateValue(value, flags) {
|
193
193
|
// If this is a radio and is alredy checked, uncheck it.
|
@@ -339,7 +339,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
339
339
|
}
|
340
340
|
onReorder(element, _target, _source, sibling) {
|
341
341
|
if (!element.dragInfo || (sibling && !sibling.dragInfo)) {
|
342
|
-
console.warn('
|
342
|
+
console.warn(this.t('noDragInfoError'));
|
343
343
|
return;
|
344
344
|
}
|
345
345
|
const oldPosition = element.dragInfo.index;
|
@@ -408,7 +408,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
408
408
|
row
|
409
409
|
});
|
410
410
|
this.checkConditions();
|
411
|
-
this.triggerChange();
|
411
|
+
this.triggerChange({ modified: true });
|
412
412
|
this.redraw().then(() => {
|
413
413
|
this.focusOnNewRowElement(this.rows[index]);
|
414
414
|
});
|
@@ -487,6 +487,9 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
487
487
|
options.name += `[${rowIndex}]`;
|
488
488
|
options.row = `${rowIndex}-${colIndex}`;
|
489
489
|
options.rowIndex = rowIndex;
|
490
|
+
options.onChange = (flags, changed, modified) => {
|
491
|
+
this.triggerChange({ modified });
|
492
|
+
};
|
490
493
|
let columnComponent;
|
491
494
|
if (this.builderMode) {
|
492
495
|
col.id = col.id + rowIndex;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import moment from 'moment';
|
3
3
|
import FormioUtils from '../../utils';
|
4
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
4
|
+
import { componentValueTypes, fastCloneDeep, getComponentSavedTypes } from '../../utils/utils';
|
5
5
|
import Input from '../_classes/input/Input';
|
6
6
|
export default class DateTimeComponent extends Input {
|
7
7
|
static schema(...extend) {
|
@@ -127,6 +127,10 @@ export default class DateTimeComponent extends Input {
|
|
127
127
|
maxDate: _.get(this.component, 'datePicker.maxDate'),
|
128
128
|
...customOptions,
|
129
129
|
};
|
130
|
+
// update originalComponent to include widget and other updated settings
|
131
|
+
// it is done here since these settings depend on properties present after the component is initialized
|
132
|
+
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
133
|
+
this.originalComponent = fastCloneDeep(this.component);
|
130
134
|
/* eslint-enable camelcase */
|
131
135
|
}
|
132
136
|
get defaultSchema() {
|
@@ -2,6 +2,7 @@ import _ from 'lodash';
|
|
2
2
|
import moment from 'moment';
|
3
3
|
import Field from '../_classes/field/Field';
|
4
4
|
import { boolValue, componentValueTypes, getComponentSavedTypes, getLocaleDateFormatInfo } from '../../utils/utils';
|
5
|
+
import { getDayFormat } from '@formio/core';
|
5
6
|
export default class DayComponent extends Field {
|
6
7
|
static schema(...extend) {
|
7
8
|
return Field.schema({
|
@@ -173,7 +174,7 @@ export default class DayComponent extends Field {
|
|
173
174
|
this._months = [
|
174
175
|
{
|
175
176
|
value: '',
|
176
|
-
label: _.get(this.component, 'fields.month.placeholder') || (this.hideInputLabels ? this.t('
|
177
|
+
label: _.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 @@ export default class DayComponent extends Field {
|
|
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 @@ export default class DayComponent extends Field {
|
|
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 getDayFormat(this.component);
|
495
479
|
}
|
496
480
|
/**
|
497
481
|
* Return the date for this component.
|
@@ -115,10 +115,10 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
115
115
|
}
|
116
116
|
get defaultDialogTemplate() {
|
117
117
|
return `
|
118
|
-
<h3 ${this._referenceAttributeName}="dialogHeader">${this.t('
|
118
|
+
<h3 ${this._referenceAttributeName}="dialogHeader">${this.t('wantToClearData')}</h3>
|
119
119
|
<div style="display:flex; justify-content: flex-end;">
|
120
|
-
<button ${this._referenceAttributeName}="dialogCancelButton" class="btn btn-secondary" aria-label="${this.t('
|
121
|
-
<button ${this._referenceAttributeName}="dialogYesButton" class="btn btn-danger" aria-label="${this.t('
|
120
|
+
<button ${this._referenceAttributeName}="dialogCancelButton" class="btn btn-secondary" aria-label="${this.t('cancel')}">${this.t('cancel')}</button>
|
121
|
+
<button ${this._referenceAttributeName}="dialogYesButton" class="btn btn-danger" aria-label="${this.t('yesDelete')}">${this.t('yesDelete')}</button>
|
122
122
|
</div>
|
123
123
|
`;
|
124
124
|
}
|
@@ -1030,7 +1030,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1030
1030
|
if (valid === null) {
|
1031
1031
|
editRow.errors.push({
|
1032
1032
|
type: 'error',
|
1033
|
-
message:
|
1033
|
+
message: this.t('componentInvalidRowValidation', { componentKey: this.key })
|
1034
1034
|
});
|
1035
1035
|
}
|
1036
1036
|
}
|
@@ -201,7 +201,7 @@ export default class FileComponent extends Field {
|
|
201
201
|
this.videoStream = stream;
|
202
202
|
const { videoPlayer } = this.refs;
|
203
203
|
if (!videoPlayer) {
|
204
|
-
console.warn(
|
204
|
+
console.warn(this.t('videoPlayerNotFound'));
|
205
205
|
this.cameraMode = false;
|
206
206
|
this.redraw();
|
207
207
|
return;
|
@@ -226,7 +226,7 @@ export default class FileComponent extends Field {
|
|
226
226
|
takePicture() {
|
227
227
|
const { videoPlayer } = this.refs;
|
228
228
|
if (!videoPlayer) {
|
229
|
-
console.warn(
|
229
|
+
console.warn(this.t('videoPlayerNotFound'));
|
230
230
|
this.cameraMode = false;
|
231
231
|
this.redraw();
|
232
232
|
return;
|
@@ -631,7 +631,7 @@ export default class FileComponent extends Field {
|
|
631
631
|
file,
|
632
632
|
size: file.size,
|
633
633
|
status: 'info',
|
634
|
-
message: this.t('
|
634
|
+
message: this.t('waitFileProcessing'),
|
635
635
|
hash: '',
|
636
636
|
};
|
637
637
|
}
|
@@ -660,7 +660,7 @@ export default class FileComponent extends Field {
|
|
660
660
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
661
661
|
? {
|
662
662
|
status: 'error',
|
663
|
-
message: this.t(
|
663
|
+
message: this.t(fileWithSameNameUploading ? 'fileWithDuplicatedNameInProgress' : 'fileWithDuplicatedNameLoaded'),
|
664
664
|
}
|
665
665
|
: {};
|
666
666
|
}
|
@@ -669,7 +669,7 @@ export default class FileComponent extends Field {
|
|
669
669
|
if (this.component.filePattern && !this.validatePattern(file, this.component.filePattern)) {
|
670
670
|
return {
|
671
671
|
status: 'error',
|
672
|
-
message: this.t('
|
672
|
+
message: this.t('wrongFileType', {
|
673
673
|
pattern: this.component.filePattern,
|
674
674
|
}),
|
675
675
|
};
|
@@ -678,7 +678,7 @@ export default class FileComponent extends Field {
|
|
678
678
|
if (this.component.fileMinSize && !this.validateMinSize(file, this.component.fileMinSize)) {
|
679
679
|
return {
|
680
680
|
status: 'error',
|
681
|
-
message: this.t('
|
681
|
+
message: this.t('fileTooSmall', {
|
682
682
|
size: this.component.fileMinSize,
|
683
683
|
}),
|
684
684
|
};
|
@@ -687,7 +687,7 @@ export default class FileComponent extends Field {
|
|
687
687
|
if (this.component.fileMaxSize && !this.validateMaxSize(file, this.component.fileMaxSize)) {
|
688
688
|
return {
|
689
689
|
status: 'error',
|
690
|
-
message: this.t('
|
690
|
+
message: this.t('fileTooBig', {
|
691
691
|
size: this.component.fileMaxSize,
|
692
692
|
}),
|
693
693
|
};
|
@@ -699,7 +699,7 @@ export default class FileComponent extends Field {
|
|
699
699
|
return !fileService
|
700
700
|
? {
|
701
701
|
status: 'error',
|
702
|
-
message: this.t('
|
702
|
+
message: this.t('noFileService'),
|
703
703
|
}
|
704
704
|
: {};
|
705
705
|
}
|
@@ -747,7 +747,7 @@ export default class FileComponent extends Field {
|
|
747
747
|
this.fileDropHidden = false;
|
748
748
|
return {
|
749
749
|
status: 'error',
|
750
|
-
message: this.t('
|
750
|
+
message: this.t('fileProcessingFailed'),
|
751
751
|
};
|
752
752
|
}
|
753
753
|
finally {
|
@@ -781,7 +781,7 @@ export default class FileComponent extends Field {
|
|
781
781
|
return this.filesToSync.filesToUpload.push(fileToSync);
|
782
782
|
}
|
783
783
|
if (this.autoSync) {
|
784
|
-
fileToSync.message = this.t('
|
784
|
+
fileToSync.message = this.t('readyForUpload');
|
785
785
|
}
|
786
786
|
this.filesToSync.filesToUpload.push({
|
787
787
|
...fileToSync,
|
@@ -819,8 +819,8 @@ export default class FileComponent extends Field {
|
|
819
819
|
...fileInfo,
|
820
820
|
status: 'info',
|
821
821
|
message: this.autoSync
|
822
|
-
? this.t('
|
823
|
-
: this.t('
|
822
|
+
? this.t('readyForRemovingFromStorage')
|
823
|
+
: this.t('preparingFileToRemove'),
|
824
824
|
});
|
825
825
|
const index = this.dataValue.findIndex(file => file.name === fileInfo.name);
|
826
826
|
this.splice(index);
|
@@ -858,7 +858,7 @@ export default class FileComponent extends Field {
|
|
858
858
|
}
|
859
859
|
await this.deleteFile(fileToSync);
|
860
860
|
fileToSync.status = 'success';
|
861
|
-
fileToSync.message = this.t('
|
861
|
+
fileToSync.message = this.t('succefullyRemoved');
|
862
862
|
}
|
863
863
|
catch (response) {
|
864
864
|
fileToSync.status = 'error';
|
@@ -926,7 +926,7 @@ export default class FileComponent extends Field {
|
|
926
926
|
}
|
927
927
|
fileInfo = await this.uploadFile(fileToSync);
|
928
928
|
fileToSync.status = 'success';
|
929
|
-
fileToSync.message = this.t('
|
929
|
+
fileToSync.message = this.t('succefullyUploaded');
|
930
930
|
fileInfo.originalName = fileToSync.originalName;
|
931
931
|
fileInfo.hash = fileToSync.hash;
|
932
932
|
}
|
@@ -1025,7 +1025,7 @@ export default class FileComponent extends Field {
|
|
1025
1025
|
}
|
1026
1026
|
await this.syncFiles();
|
1027
1027
|
return this.shouldSyncFiles
|
1028
|
-
? Promise.reject('
|
1028
|
+
? Promise.reject(this.t('synchronizationFailed'))
|
1029
1029
|
: Promise.resolve();
|
1030
1030
|
}
|
1031
1031
|
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.
|