@formio/js 5.0.0-dev.5911.81fbc1f → 5.0.0-dev.5912.590e895
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 +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/WebformBuilder.js +17 -4
- package/lib/cjs/components/signature/Signature.js +3 -1
- package/lib/cjs/utils/i18n.js +5 -0
- package/lib/mjs/WebformBuilder.js +17 -4
- package/lib/mjs/components/signature/Signature.js +3 -1
- package/lib/mjs/utils/i18n.js +4 -0
- package/package.json +1 -1
|
@@ -808,18 +808,31 @@ class WebformBuilder extends Component_1.default {
|
|
|
808
808
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
|
809
809
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
|
810
810
|
const draggableComponent = ((_a = this.groups[group]) === null || _a === void 0 ? void 0 : _a.components[compKey]) || {};
|
|
811
|
-
if (draggableComponent.disableSiblings
|
|
811
|
+
if (draggableComponent.disableSiblings) {
|
|
812
812
|
let isCompAlreadyExists = false;
|
|
813
813
|
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
|
814
|
-
if (
|
|
815
|
-
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
|
814
|
+
if (component.type === draggableComponent.schema.type) {
|
|
816
815
|
isCompAlreadyExists = true;
|
|
817
816
|
return;
|
|
818
817
|
}
|
|
819
818
|
}, true);
|
|
820
819
|
if (isCompAlreadyExists) {
|
|
821
820
|
this.webform.redraw();
|
|
822
|
-
this.webform.setAlert('danger', `You cannot add more than one ${
|
|
821
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.key} component to one page.`);
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (draggableComponent.uniqueComponent) {
|
|
826
|
+
let isCompAlreadyExists = false;
|
|
827
|
+
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
|
828
|
+
if (component.key === draggableComponent.schema.key) {
|
|
829
|
+
isCompAlreadyExists = true;
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
}, true);
|
|
833
|
+
if (isCompAlreadyExists) {
|
|
834
|
+
this.webform.redraw();
|
|
835
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
|
823
836
|
return;
|
|
824
837
|
}
|
|
825
838
|
}
|
package/lib/cjs/utils/i18n.js
CHANGED
|
@@ -79,7 +79,12 @@ class I18n {
|
|
|
79
79
|
this.languages[language] = strings;
|
|
80
80
|
}
|
|
81
81
|
t(text, ...args) {
|
|
82
|
+
var _a;
|
|
82
83
|
if (this.currentLanguage[text]) {
|
|
84
|
+
const customTranslationFieldName = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.field;
|
|
85
|
+
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
|
86
|
+
args[0].field = this.currentLanguage[customTranslationFieldName];
|
|
87
|
+
}
|
|
83
88
|
return utils_1.Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
84
89
|
}
|
|
85
90
|
return utils_1.Evaluator.interpolateString(text, ...args);
|
|
@@ -793,18 +793,31 @@ export default class WebformBuilder extends Component {
|
|
|
793
793
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
|
794
794
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
|
795
795
|
const draggableComponent = this.groups[group]?.components[compKey] || {};
|
|
796
|
-
if (draggableComponent.disableSiblings
|
|
796
|
+
if (draggableComponent.disableSiblings) {
|
|
797
797
|
let isCompAlreadyExists = false;
|
|
798
798
|
eachComponent(this.webform.components, (component) => {
|
|
799
|
-
if (
|
|
800
|
-
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
|
799
|
+
if (component.type === draggableComponent.schema.type) {
|
|
801
800
|
isCompAlreadyExists = true;
|
|
802
801
|
return;
|
|
803
802
|
}
|
|
804
803
|
}, true);
|
|
805
804
|
if (isCompAlreadyExists) {
|
|
806
805
|
this.webform.redraw();
|
|
807
|
-
this.webform.setAlert('danger', `You cannot add more than one ${
|
|
806
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.key} component to one page.`);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (draggableComponent.uniqueComponent) {
|
|
811
|
+
let isCompAlreadyExists = false;
|
|
812
|
+
eachComponent(this.webform.components, (component) => {
|
|
813
|
+
if (component.key === draggableComponent.schema.key) {
|
|
814
|
+
isCompAlreadyExists = true;
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
}, true);
|
|
818
|
+
if (isCompAlreadyExists) {
|
|
819
|
+
this.webform.redraw();
|
|
820
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
|
808
821
|
return;
|
|
809
822
|
}
|
|
810
823
|
}
|
|
@@ -156,7 +156,9 @@ export default class SignatureComponent extends Input {
|
|
|
156
156
|
if (this.dataValue) {
|
|
157
157
|
this.setDataToSigaturePad();
|
|
158
158
|
}
|
|
159
|
-
this.
|
|
159
|
+
if (!this.disabled) {
|
|
160
|
+
this.showCanvas(true);
|
|
161
|
+
}
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
renderElement(value, index) {
|
package/lib/mjs/utils/i18n.js
CHANGED
|
@@ -74,6 +74,10 @@ export class I18n {
|
|
|
74
74
|
}
|
|
75
75
|
t(text, ...args) {
|
|
76
76
|
if (this.currentLanguage[text]) {
|
|
77
|
+
const customTranslationFieldName = args[0]?.field;
|
|
78
|
+
if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
|
|
79
|
+
args[0].field = this.currentLanguage[customTranslationFieldName];
|
|
80
|
+
}
|
|
77
81
|
return Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
78
82
|
}
|
|
79
83
|
return Evaluator.interpolateString(text, ...args);
|