@unicef-polymer/etools-form-builder 3.0.0-rc.15 → 3.0.0-rc.17
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/form-attachments-popup/form-attachments-popup.d.ts +3 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +13 -2
- package/dist/form-fields/abstract-field-base.class.js +1 -1
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +1 -1
- package/dist/form-fields/single-fields/number-field.js +1 -1
- package/dist/form-groups/form-abstract-group.js +1 -1
- package/dist/lib/additional-components/confirmation-dialog.js +1 -1
- package/dist/lib/additional-components/etools-fb-card.js +3 -3
- package/package.json +5 -2
|
@@ -65,6 +65,9 @@ export declare class FormAttachmentsPopup extends LitElement {
|
|
|
65
65
|
get uploadUrl(): string;
|
|
66
66
|
get jwtLocalStorageKey(): string;
|
|
67
67
|
constructor();
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
disconnectedCallback(): void;
|
|
70
|
+
handleLanguageChange(e: CustomEvent): void;
|
|
68
71
|
render(): TemplateResult | void;
|
|
69
72
|
/**
|
|
70
73
|
* on Cancel button click
|
|
@@ -47,9 +47,20 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
|
47
47
|
throw new Error('Please initialize attachments popup before use');
|
|
48
48
|
}
|
|
49
49
|
if (!this.language) {
|
|
50
|
-
this.language = window.
|
|
50
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
connectedCallback() {
|
|
54
|
+
super.connectedCallback();
|
|
55
|
+
document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
super.disconnectedCallback();
|
|
59
|
+
document.removeEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
60
|
+
}
|
|
61
|
+
handleLanguageChange(e) {
|
|
62
|
+
this.language = e.detail.language;
|
|
63
|
+
}
|
|
53
64
|
render() {
|
|
54
65
|
return template.call(this);
|
|
55
66
|
}
|
|
@@ -73,7 +84,7 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
|
73
84
|
this.attachments.forEach((attachment, index) => {
|
|
74
85
|
if (!attachment.file_type) {
|
|
75
86
|
fileTypeNotSelected = true;
|
|
76
|
-
this.errors[index] = { file_type: [
|
|
87
|
+
this.errors[index] = { file_type: [getTranslation(this.language, 'REQUIRED_FIELD')] };
|
|
77
88
|
}
|
|
78
89
|
else {
|
|
79
90
|
this.errors[index] = [];
|
|
@@ -30,7 +30,7 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
30
30
|
this.touched = false;
|
|
31
31
|
this._readonly = false;
|
|
32
32
|
if (!this.language) {
|
|
33
|
-
this.language = window.
|
|
33
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
34
34
|
}
|
|
35
35
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
36
36
|
}
|
|
@@ -107,7 +107,7 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
|
|
|
107
107
|
});
|
|
108
108
|
if (error && error.length) {
|
|
109
109
|
console.error(error);
|
|
110
|
-
fireEvent(this, 'toast', { text:
|
|
110
|
+
fireEvent(this, 'toast', { text: getTranslation(this.language, 'UPLOAD_ATTACHMENTS_FAILED') });
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
downloadFile(attachment) {
|
|
@@ -38,7 +38,7 @@ let NumberField = class NumberField extends BaseField {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
if (isNaN(value)) {
|
|
41
|
-
return
|
|
41
|
+
return getTranslation(this.language, 'MUST_BE_NUMBER');
|
|
42
42
|
}
|
|
43
43
|
const integerValidation = !this.isInteger || value - Math.floor(value) === 0;
|
|
44
44
|
return integerValidation ? null : getTranslation(this.language, 'MUST_BE_INTEGER');
|
|
@@ -79,7 +79,7 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
79
79
|
this._value = {};
|
|
80
80
|
this.computedPath = [];
|
|
81
81
|
if (!this.language) {
|
|
82
|
-
this.language = window.
|
|
82
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
83
83
|
}
|
|
84
84
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
85
85
|
}
|
|
@@ -17,7 +17,7 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
|
17
17
|
this.dialogTitle = '';
|
|
18
18
|
this.hideConfirmBtn = false;
|
|
19
19
|
if (!this.language) {
|
|
20
|
-
this.language = window.
|
|
20
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
@@ -18,12 +18,12 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
18
18
|
:host {
|
|
19
19
|
display: block;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
etools-icon {
|
|
23
23
|
cursor: pointer;
|
|
24
24
|
margin: 6px;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
.card-container {
|
|
28
28
|
background-color: var(--primary-background-color);
|
|
29
29
|
}
|
|
@@ -126,7 +126,7 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
126
126
|
this.collapsed = false;
|
|
127
127
|
this.edit = false;
|
|
128
128
|
if (!this.language) {
|
|
129
|
-
this.language = window.
|
|
129
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
130
130
|
}
|
|
131
131
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unicef-polymer/etools-form-builder",
|
|
3
3
|
"description": "Etools FM Form Builder components",
|
|
4
|
-
"version": "3.0.0-rc.
|
|
4
|
+
"version": "3.0.0-rc.17",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"eTools Team"
|
|
7
7
|
],
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@shoelace-style/shoelace": "^2.10.0",
|
|
27
27
|
"@types/ramda": "^0.26.43",
|
|
28
|
-
"@unicef-polymer/etools-unicef": "^1.0.0-rc.56",
|
|
29
28
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
|
30
29
|
"lit": "^2.7.5",
|
|
31
30
|
"lit-element": "^2.5.1",
|
|
@@ -35,7 +34,11 @@
|
|
|
35
34
|
"typescript": "^4.9.5",
|
|
36
35
|
"web-animations-js": "^2.3.2"
|
|
37
36
|
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@unicef-polymer/etools-unicef": ">=1.0.0"
|
|
39
|
+
},
|
|
38
40
|
"devDependencies": {
|
|
41
|
+
"@unicef-polymer/etools-unicef": "^1.0.0-rc.64",
|
|
39
42
|
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
40
43
|
"@typescript-eslint/parser": "^5.7.0",
|
|
41
44
|
"@typescript-eslint/typescript-estree": "^5.7.0",
|