@unicef-polymer/etools-form-builder 3.0.0-rc.9 → 3.1.1
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/assets/translations.js +70 -2
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +4 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +108 -5
- package/dist/form-fields/abstract-field-base.class.d.ts +1 -0
- package/dist/form-fields/abstract-field-base.class.js +10 -20
- package/dist/form-fields/field-renderer-component.d.ts +7 -3
- package/dist/form-fields/field-renderer-component.js +50 -19
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +3 -3
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +0 -2
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +0 -2
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +0 -5
- package/dist/form-fields/single-fields/boolean-field.js +0 -5
- package/dist/form-fields/single-fields/number-field.js +1 -3
- package/dist/form-fields/single-fields/scale-field.js +0 -2
- package/dist/form-fields/single-fields/text-field.js +1 -2
- package/dist/form-groups/form-abstract-group.d.ts +2 -1
- package/dist/form-groups/form-abstract-group.js +7 -3
- package/dist/form-groups/form-card.js +6 -0
- package/dist/lib/additional-components/confirmation-dialog.js +1 -1
- package/dist/lib/additional-components/etools-fb-card.js +20 -10
- package/dist/lib/styles/attachments.styles.js +3 -8
- package/dist/lib/styles/card-styles.js +5 -9
- package/dist/lib/styles/dialog.styles.js +1 -1
- package/dist/lib/styles/elevation-styles.d.ts +2 -2
- package/dist/lib/styles/elevation-styles.js +20 -7
- package/dist/lib/styles/form-builder-card.styles.js +10 -3
- package/dist/lib/styles/shared-styles.js +3 -9
- package/dist/lib/utils/translate.js +1 -1
- package/package.json +23 -26
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +0 -7
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +0 -102
- package/dist/lib/styles/input-styles.d.ts +0 -2
- package/dist/lib/styles/input-styles.js +0 -143
|
@@ -3,7 +3,6 @@ import { css, html } from 'lit';
|
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { BaseField } from './base-field';
|
|
5
5
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
|
|
6
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
7
6
|
import { getTranslation } from '../../lib/utils/translate';
|
|
8
7
|
let NumberField = class NumberField extends BaseField {
|
|
9
8
|
constructor() {
|
|
@@ -12,7 +11,6 @@ let NumberField = class NumberField extends BaseField {
|
|
|
12
11
|
}
|
|
13
12
|
controlTemplate() {
|
|
14
13
|
return html `
|
|
15
|
-
${InputStyles}
|
|
16
14
|
<etools-input
|
|
17
15
|
class="no-padding-left"
|
|
18
16
|
no-label-float
|
|
@@ -38,7 +36,7 @@ let NumberField = class NumberField extends BaseField {
|
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
40
38
|
if (isNaN(value)) {
|
|
41
|
-
return
|
|
39
|
+
return getTranslation(this.language, 'MUST_BE_NUMBER');
|
|
42
40
|
}
|
|
43
41
|
const integerValidation = !this.isInteger || value - Math.floor(value) === 0;
|
|
44
42
|
return integerValidation ? null : getTranslation(this.language, 'MUST_BE_INTEGER');
|
|
@@ -6,7 +6,6 @@ import { repeat } from 'lit/directives/repeat.js';
|
|
|
6
6
|
import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
|
|
7
7
|
import '@shoelace-style/shoelace/dist/components/radio/radio.js';
|
|
8
8
|
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
9
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
10
9
|
import { getTranslation } from '../../lib/utils/translate';
|
|
11
10
|
let ScaleField = class ScaleField extends BaseField {
|
|
12
11
|
constructor() {
|
|
@@ -15,7 +14,6 @@ let ScaleField = class ScaleField extends BaseField {
|
|
|
15
14
|
}
|
|
16
15
|
controlTemplate() {
|
|
17
16
|
return html `
|
|
18
|
-
${InputStyles}
|
|
19
17
|
<div class="container">
|
|
20
18
|
<etools-radio-group
|
|
21
19
|
class="radio-group"
|
|
@@ -3,11 +3,9 @@ import { css, html } from 'lit';
|
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { BaseField } from './base-field';
|
|
5
5
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
|
|
6
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
7
6
|
let TextField = class TextField extends BaseField {
|
|
8
7
|
controlTemplate() {
|
|
9
8
|
return html `
|
|
10
|
-
${InputStyles}
|
|
11
9
|
<etools-textarea
|
|
12
10
|
id="otherInfo"
|
|
13
11
|
class="no-padding-left"
|
|
@@ -18,6 +16,7 @@ let TextField = class TextField extends BaseField {
|
|
|
18
16
|
@focus="${() => (this.touched = true)}"
|
|
19
17
|
?readonly="${this.isReadonly}"
|
|
20
18
|
?invalid="${this.errorMessage}"
|
|
19
|
+
name="${this.name}"
|
|
21
20
|
error-message="${this.errorMessage}"
|
|
22
21
|
>
|
|
23
22
|
</etools-textarea>
|
|
@@ -21,7 +21,8 @@ export declare enum StructureTypes {
|
|
|
21
21
|
CARD = "card",
|
|
22
22
|
ABSTRACT = "abstract",
|
|
23
23
|
COLLAPSED = "collapse",
|
|
24
|
-
ATTACHMENTS_BUTTON = "floating_attachments"
|
|
24
|
+
ATTACHMENTS_BUTTON = "floating_attachments",
|
|
25
|
+
MANDATORY_WARNING = "mandatory_warning"
|
|
25
26
|
}
|
|
26
27
|
export declare class FormAbstractGroup extends LitElement implements IFormBuilderAbstractGroup {
|
|
27
28
|
groupStructure: BlueprintGroup;
|
|
@@ -34,6 +34,7 @@ export var StructureTypes;
|
|
|
34
34
|
StructureTypes["ABSTRACT"] = "abstract";
|
|
35
35
|
StructureTypes["COLLAPSED"] = "collapse";
|
|
36
36
|
StructureTypes["ATTACHMENTS_BUTTON"] = "floating_attachments";
|
|
37
|
+
StructureTypes["MANDATORY_WARNING"] = "mandatory_warning";
|
|
37
38
|
})(StructureTypes || (StructureTypes = {}));
|
|
38
39
|
let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
39
40
|
/**
|
|
@@ -79,7 +80,7 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
79
80
|
this._value = {};
|
|
80
81
|
this.computedPath = [];
|
|
81
82
|
if (!this.language) {
|
|
82
|
-
this.language = window.
|
|
83
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
83
84
|
}
|
|
84
85
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
85
86
|
}
|
|
@@ -133,6 +134,7 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
133
134
|
return html `
|
|
134
135
|
<field-renderer
|
|
135
136
|
.field="${blueprintField}"
|
|
137
|
+
.language="${this.language}"
|
|
136
138
|
?readonly="${live(this.isReadonly())}"
|
|
137
139
|
.value="${this.value && this.value[blueprintField.name]}"
|
|
138
140
|
.validations="${blueprintField.validations.map((validation) => this.metadata.validations[validation])}"
|
|
@@ -314,7 +316,9 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
314
316
|
align-self: flex-end;
|
|
315
317
|
margin-right: 23px;
|
|
316
318
|
margin-top: 20px;
|
|
317
|
-
box-shadow:
|
|
319
|
+
box-shadow:
|
|
320
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
|
321
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
318
322
|
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
319
323
|
}
|
|
320
324
|
.card-header {
|
|
@@ -333,7 +337,7 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
333
337
|
}
|
|
334
338
|
.card-header .title {
|
|
335
339
|
padding: 0 24px 8px;
|
|
336
|
-
font-size: 18px;
|
|
340
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
337
341
|
font-weight: bold;
|
|
338
342
|
}
|
|
339
343
|
.save-button {
|
|
@@ -48,6 +48,12 @@ let FormCard = class FormCard extends FormAbstractGroup {
|
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
50
|
return html `
|
|
51
|
+
<style>
|
|
52
|
+
.card-buttons {
|
|
53
|
+
padding: 12px 24px;
|
|
54
|
+
padding-top: 0;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
51
57
|
<section class="elevation page-content card-container form-card" elevation="1">
|
|
52
58
|
<div class="card-header">
|
|
53
59
|
<div class="title">${this.groupStructure.title}</div>
|
|
@@ -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
|
-
|
|
24
|
-
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 6px;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
.card-container {
|
|
28
28
|
background-color: var(--primary-background-color);
|
|
29
29
|
}
|
|
@@ -45,7 +45,8 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
45
45
|
--sl-color-primary-500: var(--primary-color);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.edit-button,
|
|
48
|
+
.edit-button,
|
|
49
|
+
etools-icon[name='create'] {
|
|
49
50
|
color: var(--gray-mid);
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -63,7 +64,7 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
63
64
|
flex-basis: auto;
|
|
64
65
|
}
|
|
65
66
|
.flex-header__title {
|
|
66
|
-
font-size: 18px;
|
|
67
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
67
68
|
flex-basis: auto;
|
|
68
69
|
flex-grow: 1;
|
|
69
70
|
overflow: hidden;
|
|
@@ -112,7 +113,7 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
112
113
|
}
|
|
113
114
|
.flex-header__edit {
|
|
114
115
|
order: 1;
|
|
115
|
-
flex-basis:
|
|
116
|
+
flex-basis: 12%;
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
`
|
|
@@ -126,7 +127,7 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
126
127
|
this.collapsed = false;
|
|
127
128
|
this.edit = false;
|
|
128
129
|
if (!this.language) {
|
|
129
|
-
this.language = window.
|
|
130
|
+
this.language = window.EtoolsLanguage || 'en';
|
|
130
131
|
}
|
|
131
132
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
132
133
|
}
|
|
@@ -166,7 +167,11 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
166
167
|
<header class="card-title-box with-bottom-line flex-header" ?is-collapsible="${this.isCollapsible}">
|
|
167
168
|
${this.isCollapsible
|
|
168
169
|
? html `
|
|
169
|
-
<etools-icon
|
|
170
|
+
<etools-icon
|
|
171
|
+
name="${this.collapsed ? 'expand-more' : 'expand-less'}"
|
|
172
|
+
@click="${() => this.toggleCollapse()}"
|
|
173
|
+
>
|
|
174
|
+
</etools-icon>
|
|
170
175
|
`
|
|
171
176
|
: ''}
|
|
172
177
|
<div class="flex-header__title">${this.cardTitle}</div>
|
|
@@ -174,7 +179,12 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
174
179
|
<div class="layout horizontal center flex-header__edit">
|
|
175
180
|
${this.isEditable
|
|
176
181
|
? html `
|
|
177
|
-
|
|
182
|
+
<etools-icon
|
|
183
|
+
slot="trigger"
|
|
184
|
+
?hidden="${this.hideEditButton}"
|
|
185
|
+
@click="${() => this.startEdit()}"
|
|
186
|
+
name="create"
|
|
187
|
+
></etools-icon>
|
|
178
188
|
`
|
|
179
189
|
: ''}
|
|
180
190
|
</div>
|
|
@@ -14,7 +14,7 @@ export const AttachmentsStyles = css `
|
|
|
14
14
|
margin: 0 14px 0 0;
|
|
15
15
|
min-width: 145px;
|
|
16
16
|
overflow-wrap: break-word;
|
|
17
|
-
font-size: 16px;
|
|
17
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
18
18
|
}
|
|
19
19
|
:host([is-readonly]) .filename-container {
|
|
20
20
|
border-bottom-color: transparent;
|
|
@@ -37,14 +37,9 @@ export const AttachmentsStyles = css `
|
|
|
37
37
|
.change-button {
|
|
38
38
|
color: var(--secondary-text-color, rgba(0, 0, 0, 0.54));
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
etools-icon {
|
|
41
41
|
margin-right: 8px;
|
|
42
42
|
}
|
|
43
|
-
paper-button {
|
|
44
|
-
font-weight: 700;
|
|
45
|
-
margin: 0 0;
|
|
46
|
-
padding: 0 0;
|
|
47
|
-
}
|
|
48
43
|
.file-selector-container.with-type-dropdown {
|
|
49
44
|
padding: 0;
|
|
50
45
|
}
|
|
@@ -55,7 +50,7 @@ export const AttachmentsStyles = css `
|
|
|
55
50
|
.file-selector-container.with-type-dropdown .filename-container {
|
|
56
51
|
height: 32px;
|
|
57
52
|
box-sizing: border-box;
|
|
58
|
-
margin: 22px
|
|
53
|
+
margin: 22px 8px;
|
|
59
54
|
border-bottom: 1px solid var(--gray-20);
|
|
60
55
|
}
|
|
61
56
|
.file-selector-container.with-type-dropdown .delete-button,
|
|
@@ -18,11 +18,11 @@ export const CardStyles = css `
|
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
white-space: nowrap;
|
|
20
20
|
text-overflow: ellipsis;
|
|
21
|
-
font-size: 18px;
|
|
21
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.card-title-box .card-title.counter {
|
|
25
|
-
font-size: 20px;
|
|
25
|
+
font-size: var(--etools-font-size-20, 20px);
|
|
26
26
|
font-weight: 500;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -61,7 +61,7 @@ export const CardStyles = css `
|
|
|
61
61
|
z-index: 100;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.editable-row .hover-block
|
|
64
|
+
.editable-row .hover-block etools-icon-button {
|
|
65
65
|
color: rgba(0, 0, 0, 0.54);
|
|
66
66
|
padding-left: 5px;
|
|
67
67
|
}
|
|
@@ -108,7 +108,7 @@ export const CardStyles = css `
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.row-details-content {
|
|
111
|
-
font-size: 12px;
|
|
111
|
+
font-size: var(--etools-font-size-12, 12px);
|
|
112
112
|
padding-right: 100px;
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -136,16 +136,12 @@ export const CardStyles = css `
|
|
|
136
136
|
|
|
137
137
|
.remove-title {
|
|
138
138
|
padding: 16px 25px 15px;
|
|
139
|
-
font-size:
|
|
139
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
140
140
|
color: rgba(0, 0, 0, 0.87);
|
|
141
141
|
font-weight: 500;
|
|
142
142
|
line-height: 28px;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
paper-textarea {
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
145
|
a.link-cell {
|
|
150
146
|
font-weight: 500;
|
|
151
147
|
text-decoration: none;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CSSResult } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* LitElement css version for used
|
|
3
|
+
* LitElement css version for used material-styles
|
|
4
4
|
* TODO:
|
|
5
5
|
* - use only in new litElements
|
|
6
6
|
* - add more elevations if needed
|
|
7
|
-
* - replace all
|
|
7
|
+
* - replace all material-styles with this css module
|
|
8
8
|
*/
|
|
9
9
|
export declare const elevationStyles: CSSResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* LitElement css version for used
|
|
3
|
+
* LitElement css version for used material-styles
|
|
4
4
|
* TODO:
|
|
5
5
|
* - use only in new litElements
|
|
6
6
|
* - add more elevations if needed
|
|
7
|
-
* - replace all
|
|
7
|
+
* - replace all material-styles with this css module
|
|
8
8
|
*/
|
|
9
9
|
// language=CSS
|
|
10
10
|
export const elevationStyles = css `
|
|
@@ -16,28 +16,41 @@ export const elevationStyles = css `
|
|
|
16
16
|
|
|
17
17
|
.elevation[elevation='1'],
|
|
18
18
|
:host(.elevation[elevation='1']) {
|
|
19
|
-
box-shadow:
|
|
19
|
+
box-shadow:
|
|
20
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
|
21
|
+
0 1px 5px 0 rgba(0, 0, 0, 0.12),
|
|
22
|
+
0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.elevation[elevation='2'],
|
|
23
26
|
:host(.elevation[elevation='2']) {
|
|
24
|
-
box-shadow:
|
|
27
|
+
box-shadow:
|
|
28
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
|
29
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
30
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
.elevation[elevation='3'],
|
|
28
34
|
:host(.elevation[elevation='3']) {
|
|
29
|
-
box-shadow:
|
|
35
|
+
box-shadow:
|
|
36
|
+
0 6px 10px 0 rgba(0, 0, 0, 0.14),
|
|
37
|
+
0 1px 18px 0 rgba(0, 0, 0, 0.12),
|
|
38
|
+
0 3px 5px -1px rgba(0, 0, 0, 0.4);
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
.elevation[elevation='4'],
|
|
33
42
|
:host(.elevation[elevation='4']) {
|
|
34
|
-
box-shadow:
|
|
43
|
+
box-shadow:
|
|
44
|
+
0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
45
|
+
0 3px 14px 2px rgba(0, 0, 0, 0.12),
|
|
35
46
|
0 5px 5px -3px rgba(0, 0, 0, 0.4);
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
.elevation[elevation='5'],
|
|
39
50
|
:host(.elevation[elevation='5']) {
|
|
40
|
-
box-shadow:
|
|
51
|
+
box-shadow:
|
|
52
|
+
0 16px 24px 2px rgba(0, 0, 0, 0.14),
|
|
53
|
+
0 6px 30px 5px rgba(0, 0, 0, 0.12),
|
|
41
54
|
0 8px 10px -5px rgba(0, 0, 0, 0.4);
|
|
42
55
|
}
|
|
43
56
|
`;
|
|
@@ -22,11 +22,12 @@ export const FormBuilderCardStyles = css `
|
|
|
22
22
|
box-shadow: 0 0 5px 5px rgb(170 165 165 / 20%);
|
|
23
23
|
background-color: rgba(170, 165, 165, 0.2);
|
|
24
24
|
}
|
|
25
|
-
.attachments-button
|
|
25
|
+
.attachments-button etools-icon {
|
|
26
26
|
margin-right: 8px;
|
|
27
27
|
}
|
|
28
28
|
.question-container {
|
|
29
29
|
padding: 7px 0;
|
|
30
|
+
padding-right: 10px;
|
|
30
31
|
width: 100%;
|
|
31
32
|
min-height: 57px;
|
|
32
33
|
box-sizing: border-box;
|
|
@@ -34,11 +35,11 @@ export const FormBuilderCardStyles = css `
|
|
|
34
35
|
}
|
|
35
36
|
.question-text {
|
|
36
37
|
font-weight: 500;
|
|
37
|
-
font-size:
|
|
38
|
+
font-size: var(--etools-font-size-14, 14px);
|
|
38
39
|
color: var(--primary-text-color);
|
|
39
40
|
}
|
|
40
41
|
.question-details {
|
|
41
|
-
font-size:
|
|
42
|
+
font-size: var(--etools-font-size-12, 12px);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
@media (max-width: 380px) {
|
|
@@ -46,4 +47,10 @@ export const FormBuilderCardStyles = css `
|
|
|
46
47
|
padding: 5px;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
|
|
51
|
+
@media (max-width: 1080px) {
|
|
52
|
+
.question-container {
|
|
53
|
+
padding-right: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
49
56
|
`;
|
|
@@ -19,11 +19,11 @@ export const SharedStyles = css `
|
|
|
19
19
|
|
|
20
20
|
h1 {
|
|
21
21
|
text-transform: capitalize;
|
|
22
|
-
font-size: 24px;
|
|
22
|
+
font-size: var(--etools-font-size-24, 24px);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
h2 {
|
|
26
|
-
font-size: 20px;
|
|
26
|
+
font-size: var(--etools-font-size-20, 20px);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
a {
|
|
@@ -47,13 +47,7 @@ export const SharedStyles = css `
|
|
|
47
47
|
|
|
48
48
|
.toggle-button-control span {
|
|
49
49
|
padding: 0 12px;
|
|
50
|
-
font-size: 16px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.toggle-button-control paper-checkbox {
|
|
54
|
-
--paper-checkbox-label: {
|
|
55
|
-
padding-left: 0;
|
|
56
|
-
}
|
|
50
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
.readonly {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unicef-polymer/etools-form-builder",
|
|
3
3
|
"description": "Etools FM Form Builder components",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.1",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"contributors": [
|
|
6
7
|
"eTools Team"
|
|
7
8
|
],
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"scripts": {
|
|
16
17
|
"tsToJs": "rm -rf dist && tsc --skipLibCheck",
|
|
17
18
|
"watch": "tsc --watch",
|
|
18
|
-
"lint": "eslint
|
|
19
|
+
"lint": "eslint",
|
|
19
20
|
"format": "eslint --ext .ts ./src/**/*.ts --fix --ignore-path .gitignore",
|
|
20
21
|
"rd:init": "relative-deps init",
|
|
21
22
|
"rd:add": "relative-deps add",
|
|
@@ -23,33 +24,29 @@
|
|
|
23
24
|
"prepublishOnly": "npm run tsToJs"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@shoelace-style/shoelace": "
|
|
27
|
-
"@types/ramda": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"lit": "^2.7.5",
|
|
31
|
-
"lit-element": "^2.5.1",
|
|
32
|
-
"lit-translate": "^1.2.1",
|
|
33
|
-
"ramda": "^0.27.1",
|
|
27
|
+
"@shoelace-style/shoelace": "2.18.0",
|
|
28
|
+
"@types/ramda": "0.30.2",
|
|
29
|
+
"lit": "^3.2.1",
|
|
30
|
+
"ramda": "0.30.1",
|
|
34
31
|
"relative-deps": "^1.0.7",
|
|
35
|
-
"typescript": "^4.9.5"
|
|
36
|
-
|
|
32
|
+
"typescript": "^4.9.5"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@unicef-polymer/etools-unicef": ">=1.1.1"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@typescript-eslint/
|
|
42
|
-
"
|
|
43
|
-
"
|
|
38
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
39
|
+
"@eslint/js": "^9.16.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
41
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
42
|
+
"@unicef-polymer/etools-unicef": "^1.1.1",
|
|
43
|
+
"eslint": "^9.16.0",
|
|
44
44
|
"eslint-config-google": "^0.14.0",
|
|
45
|
-
"eslint-config-prettier": "^
|
|
46
|
-
"eslint-plugin-html": "^
|
|
47
|
-
"eslint-plugin-lit": "^1.
|
|
48
|
-
"eslint-plugin-prettier": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"lodash": ">=4.17.21",
|
|
52
|
-
"ansi-regex": ">=5.0.1",
|
|
53
|
-
"glob-parent": ">=5.1.2"
|
|
45
|
+
"eslint-config-prettier": "^9.1.0",
|
|
46
|
+
"eslint-plugin-html": "^8.1.2",
|
|
47
|
+
"eslint-plugin-lit": "^1.15.0",
|
|
48
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
49
|
+
"globals": "^15.13.0",
|
|
50
|
+
"prettier": "^3.4.2"
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FormAttachmentsPopup } from './form-attachments-popup';
|
|
2
|
-
import { TemplateResult } from 'lit';
|
|
3
|
-
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
4
|
-
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
5
|
-
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
6
|
-
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
7
|
-
export declare function template(this: FormAttachmentsPopup): TemplateResult;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
|
-
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
4
|
-
import { getTranslation } from '../lib/utils/translate';
|
|
5
|
-
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
6
|
-
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
7
|
-
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
8
|
-
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
9
|
-
export function template() {
|
|
10
|
-
var _a;
|
|
11
|
-
return html `
|
|
12
|
-
${InputStyles} ${DialogStyles}
|
|
13
|
-
<style>
|
|
14
|
-
etools-icon[name='error-outline'] {
|
|
15
|
-
color: var(--etools-upload-danger-color, #ea4022);
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
<etools-dialog
|
|
19
|
-
id="form-attachments-dialog"
|
|
20
|
-
size="md"
|
|
21
|
-
no-padding
|
|
22
|
-
keep-dialog-open
|
|
23
|
-
?opened="${this.dialogOpened}"
|
|
24
|
-
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
25
|
-
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
26
|
-
.hideConfirmBtn="${this.readonly}"
|
|
27
|
-
dialog-title="${this.popupTitle}"
|
|
28
|
-
@close="${this.onClose}"
|
|
29
|
-
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
30
|
-
>
|
|
31
|
-
<!-- Link is used to download attachments -->
|
|
32
|
-
<a id="link" target="_blank" hidden></a>
|
|
33
|
-
|
|
34
|
-
<div class="popup-container">
|
|
35
|
-
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
return html `
|
|
38
|
-
<div class="file-selector-container with-type-dropdown">
|
|
39
|
-
<!-- Type select Dropdown -->
|
|
40
|
-
<etools-dropdown
|
|
41
|
-
class="type-dropdown file-selector__type-dropdown"
|
|
42
|
-
.selected="${attachment.file_type}"
|
|
43
|
-
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
44
|
-
trigger-value-change-event
|
|
45
|
-
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
46
|
-
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
47
|
-
required
|
|
48
|
-
?readonly="${this.readonly}"
|
|
49
|
-
hide-search
|
|
50
|
-
.options="${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.options.target_attachments_file_types) === null || _b === void 0 ? void 0 : _b.values}"
|
|
51
|
-
option-label="label"
|
|
52
|
-
option-value="value"
|
|
53
|
-
?invalid="${this.checkFileType(index)}"
|
|
54
|
-
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
55
|
-
allow-outside-scroll
|
|
56
|
-
dynamic-align
|
|
57
|
-
></etools-dropdown>
|
|
58
|
-
|
|
59
|
-
<!-- File name component -->
|
|
60
|
-
<div class="filename-container file-selector__filename">
|
|
61
|
-
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
62
|
-
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<!-- Download Button -->
|
|
66
|
-
<etools-button
|
|
67
|
-
variant="text"
|
|
68
|
-
?hidden="${!attachment.url}"
|
|
69
|
-
class="download-button file-selector__download"
|
|
70
|
-
@click="${() => this.downloadFile(attachment)}"
|
|
71
|
-
>
|
|
72
|
-
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
73
|
-
${getTranslation(this.language, 'DOWNLOAD')}
|
|
74
|
-
</etools-button>
|
|
75
|
-
|
|
76
|
-
<!-- Delete Button -->
|
|
77
|
-
<etools-button
|
|
78
|
-
variant="text"
|
|
79
|
-
class="danger delete-button file-selector__delete"
|
|
80
|
-
?hidden="${this.readonly}"
|
|
81
|
-
@click="${() => this.deleteAttachment(index)}"
|
|
82
|
-
>
|
|
83
|
-
${getTranslation(this.language, 'DELETE')}
|
|
84
|
-
</etools-button>
|
|
85
|
-
</div>
|
|
86
|
-
`;
|
|
87
|
-
})}
|
|
88
|
-
|
|
89
|
-
<!-- Upload button -->
|
|
90
|
-
<etools-upload-multi
|
|
91
|
-
class="with-padding"
|
|
92
|
-
activate-offline
|
|
93
|
-
?hidden="${this.readonly}"
|
|
94
|
-
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
95
|
-
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
96
|
-
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
97
|
-
>
|
|
98
|
-
</etools-upload-multi>
|
|
99
|
-
</div>
|
|
100
|
-
</etools-dialog>
|
|
101
|
-
`;
|
|
102
|
-
}
|