@unicef-polymer/etools-form-builder 3.1.1 → 3.1.2
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/LICENSE +674 -674
- package/README.md +1 -1
- package/dist/form-attachments-popup/form-attachments-popup.js +135 -135
- package/dist/form-fields/abstract-field-base.class.js +101 -101
- package/dist/form-fields/field-renderer-component.js +164 -164
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +111 -111
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +22 -22
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +19 -19
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +57 -57
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +19 -19
- package/dist/form-fields/single-fields/attachment-field.js +13 -13
- package/dist/form-fields/single-fields/boolean-field.js +16 -16
- package/dist/form-fields/single-fields/number-field.js +20 -20
- package/dist/form-fields/single-fields/scale-field.js +58 -58
- package/dist/form-fields/single-fields/text-field.js +24 -24
- package/dist/form-groups/form-abstract-group.js +129 -129
- package/dist/form-groups/form-card.js +30 -30
- package/dist/form-groups/form-collapsed-card.js +34 -34
- package/dist/lib/additional-components/confirmation-dialog.js +20 -20
- package/dist/lib/additional-components/etools-fb-card.js +144 -144
- package/dist/lib/styles/attachments.styles.js +61 -61
- package/dist/lib/styles/card-styles.js +147 -147
- package/dist/lib/styles/dialog.styles.js +83 -83
- package/dist/lib/styles/elevation-styles.js +46 -46
- package/dist/lib/styles/flex-layout-classes.js +316 -316
- package/dist/lib/styles/form-builder-card.styles.js +53 -53
- package/dist/lib/styles/page-layout-styles.js +198 -198
- package/dist/lib/styles/shared-styles.js +61 -61
- package/package.json +51 -52
|
@@ -30,12 +30,12 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
30
30
|
const mandatoryClass = blueprintField.styling.includes(StructureTypes.MANDATORY_WARNING)
|
|
31
31
|
? 'mandatory_warning '
|
|
32
32
|
: '';
|
|
33
|
-
return html `
|
|
34
|
-
<div class="${`${additionalClass}${wideClass}${mandatoryClass}finding-container`}">
|
|
33
|
+
return html `
|
|
34
|
+
<div class="${`${additionalClass}${wideClass}${mandatoryClass}finding-container`}">
|
|
35
35
|
${blueprintField.repeatable
|
|
36
36
|
? this.renderRepeatableField(blueprintField, !!mandatoryClass)
|
|
37
|
-
: this.renderStandardField(blueprintField, !!mandatoryClass)}
|
|
38
|
-
</div>
|
|
37
|
+
: this.renderStandardField(blueprintField, !!mandatoryClass)}
|
|
38
|
+
</div>
|
|
39
39
|
`;
|
|
40
40
|
}
|
|
41
41
|
renderStandardField({ input_type, label, help_text, required, placeholder, styling, name }, isMandatory = false) {
|
|
@@ -43,83 +43,83 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
43
43
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
44
44
|
switch (input_type) {
|
|
45
45
|
case FieldTypes.TEXT_TYPE:
|
|
46
|
-
return html `
|
|
47
|
-
<text-field
|
|
48
|
-
class="${isWide ? 'wide' : ''}"
|
|
49
|
-
?is-readonly="${this.readonly}"
|
|
50
|
-
?required="${required}"
|
|
51
|
-
.placeholder="${placeholder}"
|
|
52
|
-
.name="${name}"
|
|
53
|
-
.value="${this.value}"
|
|
54
|
-
.validators="${this.validations}"
|
|
55
|
-
.errorMessage="${this.errorMessage}"
|
|
56
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
57
|
-
>
|
|
58
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
59
|
-
</text-field>
|
|
46
|
+
return html `
|
|
47
|
+
<text-field
|
|
48
|
+
class="${isWide ? 'wide' : ''}"
|
|
49
|
+
?is-readonly="${this.readonly}"
|
|
50
|
+
?required="${required}"
|
|
51
|
+
.placeholder="${placeholder}"
|
|
52
|
+
.name="${name}"
|
|
53
|
+
.value="${this.value}"
|
|
54
|
+
.validators="${this.validations}"
|
|
55
|
+
.errorMessage="${this.errorMessage}"
|
|
56
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
57
|
+
>
|
|
58
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
59
|
+
</text-field>
|
|
60
60
|
`;
|
|
61
61
|
case FieldTypes.NUMBER_TYPE:
|
|
62
62
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
63
63
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
64
|
-
return html `
|
|
65
|
-
<number-field
|
|
66
|
-
?is-readonly="${this.readonly}"
|
|
67
|
-
?required="${required}"
|
|
68
|
-
.placeholder="${placeholder}"
|
|
69
|
-
.value="${this.value}"
|
|
70
|
-
.name="${name}"
|
|
71
|
-
.validators="${this.validations}"
|
|
72
|
-
.errorMessage="${this.errorMessage}"
|
|
73
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
74
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
75
|
-
>
|
|
76
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
77
|
-
</number-field>
|
|
64
|
+
return html `
|
|
65
|
+
<number-field
|
|
66
|
+
?is-readonly="${this.readonly}"
|
|
67
|
+
?required="${required}"
|
|
68
|
+
.placeholder="${placeholder}"
|
|
69
|
+
.value="${this.value}"
|
|
70
|
+
.name="${name}"
|
|
71
|
+
.validators="${this.validations}"
|
|
72
|
+
.errorMessage="${this.errorMessage}"
|
|
73
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
74
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
75
|
+
>
|
|
76
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
77
|
+
</number-field>
|
|
78
78
|
`;
|
|
79
79
|
case FieldTypes.BOOL_TYPE:
|
|
80
|
-
return html `
|
|
81
|
-
<boolean-field
|
|
82
|
-
?is-readonly="${this.readonly}"
|
|
83
|
-
?required="${required}"
|
|
84
|
-
.value="${this.value}"
|
|
85
|
-
.name="${name}"
|
|
86
|
-
.validators="${this.validations}"
|
|
87
|
-
.errorMessage="${this.errorMessage}"
|
|
88
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
89
|
-
>
|
|
90
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
91
|
-
</boolean-field>
|
|
80
|
+
return html `
|
|
81
|
+
<boolean-field
|
|
82
|
+
?is-readonly="${this.readonly}"
|
|
83
|
+
?required="${required}"
|
|
84
|
+
.value="${this.value}"
|
|
85
|
+
.name="${name}"
|
|
86
|
+
.validators="${this.validations}"
|
|
87
|
+
.errorMessage="${this.errorMessage}"
|
|
88
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
89
|
+
>
|
|
90
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
91
|
+
</boolean-field>
|
|
92
92
|
`;
|
|
93
93
|
case FieldTypes.SCALE_TYPE:
|
|
94
|
-
return html `
|
|
95
|
-
<scale-field
|
|
96
|
-
.options="${this.options}"
|
|
97
|
-
?is-readonly="${this.readonly}"
|
|
98
|
-
?required="${required}"
|
|
99
|
-
.placeholder="${placeholder}"
|
|
100
|
-
.value="${this.value}"
|
|
101
|
-
.name="${name}"
|
|
102
|
-
.validators="${this.validations}"
|
|
103
|
-
.errorMessage="${this.errorMessage}"
|
|
104
|
-
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
105
|
-
>
|
|
106
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
107
|
-
</scale-field>
|
|
94
|
+
return html `
|
|
95
|
+
<scale-field
|
|
96
|
+
.options="${this.options}"
|
|
97
|
+
?is-readonly="${this.readonly}"
|
|
98
|
+
?required="${required}"
|
|
99
|
+
.placeholder="${placeholder}"
|
|
100
|
+
.value="${this.value}"
|
|
101
|
+
.name="${name}"
|
|
102
|
+
.validators="${this.validations}"
|
|
103
|
+
.errorMessage="${this.errorMessage}"
|
|
104
|
+
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
105
|
+
>
|
|
106
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
107
|
+
</scale-field>
|
|
108
108
|
`;
|
|
109
109
|
case FieldTypes.FILE_TYPE:
|
|
110
|
-
return html `
|
|
111
|
-
<attachments-field
|
|
112
|
-
?is-readonly="${this.readonly}"
|
|
113
|
-
?required="${required}"
|
|
114
|
-
.placeholder="${placeholder}"
|
|
115
|
-
.value="${this.value}"
|
|
116
|
-
.name="${name}"
|
|
117
|
-
.validators="${this.validations}"
|
|
118
|
-
.errorMessage="${this.errorMessage}"
|
|
119
|
-
.computedPath="${this.computedPath}"
|
|
120
|
-
>
|
|
121
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
122
|
-
</attachments-field>
|
|
110
|
+
return html `
|
|
111
|
+
<attachments-field
|
|
112
|
+
?is-readonly="${this.readonly}"
|
|
113
|
+
?required="${required}"
|
|
114
|
+
.placeholder="${placeholder}"
|
|
115
|
+
.value="${this.value}"
|
|
116
|
+
.name="${name}"
|
|
117
|
+
.validators="${this.validations}"
|
|
118
|
+
.errorMessage="${this.errorMessage}"
|
|
119
|
+
.computedPath="${this.computedPath}"
|
|
120
|
+
>
|
|
121
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
122
|
+
</attachments-field>
|
|
123
123
|
`;
|
|
124
124
|
default:
|
|
125
125
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
@@ -128,8 +128,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
128
128
|
}
|
|
129
129
|
renderTooltip(isMandatory) {
|
|
130
130
|
return isMandatory
|
|
131
|
-
? html ` <sl-tooltip placement="top" content="${getTranslation(this.language, 'PLEASE_ANSWER')}">
|
|
132
|
-
<etools-icon id="users-icon" name="info-outline"></etools-icon>
|
|
131
|
+
? html ` <sl-tooltip placement="top" content="${getTranslation(this.language, 'PLEASE_ANSWER')}">
|
|
132
|
+
<etools-icon id="users-icon" name="info-outline"></etools-icon>
|
|
133
133
|
</sl-tooltip>`
|
|
134
134
|
: ``;
|
|
135
135
|
}
|
|
@@ -138,67 +138,67 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
138
138
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
139
139
|
switch (input_type) {
|
|
140
140
|
case FieldTypes.TEXT_TYPE:
|
|
141
|
-
return html `
|
|
142
|
-
<repeatable-text-field
|
|
143
|
-
class="${isWide ? 'wide' : ''}"
|
|
144
|
-
?is-readonly="${this.readonly}"
|
|
145
|
-
?required="${required}"
|
|
146
|
-
.placeholder="${placeholder}"
|
|
147
|
-
.value="${this.value}"
|
|
148
|
-
.validators="${this.validations}"
|
|
149
|
-
.errorMessage="${this.errorMessage}"
|
|
150
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
151
|
-
>
|
|
152
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
153
|
-
</repeatable-text-field>
|
|
141
|
+
return html `
|
|
142
|
+
<repeatable-text-field
|
|
143
|
+
class="${isWide ? 'wide' : ''}"
|
|
144
|
+
?is-readonly="${this.readonly}"
|
|
145
|
+
?required="${required}"
|
|
146
|
+
.placeholder="${placeholder}"
|
|
147
|
+
.value="${this.value}"
|
|
148
|
+
.validators="${this.validations}"
|
|
149
|
+
.errorMessage="${this.errorMessage}"
|
|
150
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
151
|
+
>
|
|
152
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
153
|
+
</repeatable-text-field>
|
|
154
154
|
`;
|
|
155
155
|
case FieldTypes.NUMBER_TYPE:
|
|
156
156
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
157
157
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
158
|
-
return html `
|
|
159
|
-
<repeatable-number-field
|
|
160
|
-
class="${isWide ? 'wide' : ''}"
|
|
161
|
-
?is-readonly="${this.readonly}"
|
|
162
|
-
?required="${required}"
|
|
163
|
-
.placeholder="${placeholder}"
|
|
164
|
-
.value="${this.value}"
|
|
165
|
-
.validators="${this.validations}"
|
|
166
|
-
.errorMessage="${this.errorMessage}"
|
|
167
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
168
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
169
|
-
>
|
|
170
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
171
|
-
</repeatable-number-field>
|
|
158
|
+
return html `
|
|
159
|
+
<repeatable-number-field
|
|
160
|
+
class="${isWide ? 'wide' : ''}"
|
|
161
|
+
?is-readonly="${this.readonly}"
|
|
162
|
+
?required="${required}"
|
|
163
|
+
.placeholder="${placeholder}"
|
|
164
|
+
.value="${this.value}"
|
|
165
|
+
.validators="${this.validations}"
|
|
166
|
+
.errorMessage="${this.errorMessage}"
|
|
167
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
168
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
169
|
+
>
|
|
170
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
171
|
+
</repeatable-number-field>
|
|
172
172
|
`;
|
|
173
173
|
case FieldTypes.SCALE_TYPE:
|
|
174
|
-
return html `
|
|
175
|
-
<repeatable-scale-field
|
|
176
|
-
class="${isWide ? 'wide' : ''}"
|
|
177
|
-
.options="${this.options}"
|
|
178
|
-
?is-readonly="${this.readonly}"
|
|
179
|
-
?required="${required}"
|
|
180
|
-
.placeholder="${placeholder}"
|
|
181
|
-
.value="${this.value}"
|
|
182
|
-
.validators="${this.validations}"
|
|
183
|
-
.errorMessage="${this.errorMessage}"
|
|
184
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
185
|
-
>
|
|
186
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
187
|
-
</repeatable-scale-field>
|
|
174
|
+
return html `
|
|
175
|
+
<repeatable-scale-field
|
|
176
|
+
class="${isWide ? 'wide' : ''}"
|
|
177
|
+
.options="${this.options}"
|
|
178
|
+
?is-readonly="${this.readonly}"
|
|
179
|
+
?required="${required}"
|
|
180
|
+
.placeholder="${placeholder}"
|
|
181
|
+
.value="${this.value}"
|
|
182
|
+
.validators="${this.validations}"
|
|
183
|
+
.errorMessage="${this.errorMessage}"
|
|
184
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
185
|
+
>
|
|
186
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
187
|
+
</repeatable-scale-field>
|
|
188
188
|
`;
|
|
189
189
|
case FieldTypes.FILE_TYPE:
|
|
190
|
-
return html `
|
|
191
|
-
<repeatable-attachments-field
|
|
192
|
-
?is-readonly="${this.readonly}"
|
|
193
|
-
?required="${required}"
|
|
194
|
-
.placeholder="${placeholder}"
|
|
195
|
-
.value="${this.value}"
|
|
196
|
-
.validators="${this.validations}"
|
|
197
|
-
.errorMessage="${this.errorMessage}"
|
|
198
|
-
.computedPath="${this.computedPath}"
|
|
199
|
-
>
|
|
200
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
201
|
-
</repeatable-attachments-field>
|
|
190
|
+
return html `
|
|
191
|
+
<repeatable-attachments-field
|
|
192
|
+
?is-readonly="${this.readonly}"
|
|
193
|
+
?required="${required}"
|
|
194
|
+
.placeholder="${placeholder}"
|
|
195
|
+
.value="${this.value}"
|
|
196
|
+
.validators="${this.validations}"
|
|
197
|
+
.errorMessage="${this.errorMessage}"
|
|
198
|
+
.computedPath="${this.computedPath}"
|
|
199
|
+
>
|
|
200
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
201
|
+
</repeatable-attachments-field>
|
|
202
202
|
`;
|
|
203
203
|
default:
|
|
204
204
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
@@ -206,11 +206,11 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
renderFieldLabel(label, helperText, isMandatory = false) {
|
|
209
|
-
return html `
|
|
210
|
-
<div class="layout vertical question-container">
|
|
211
|
-
<div class="question-text">${this.renderTooltip(isMandatory)}${label}</div>
|
|
212
|
-
<div class="question-details">${helperText}</div>
|
|
213
|
-
</div>
|
|
209
|
+
return html `
|
|
210
|
+
<div class="layout vertical question-container">
|
|
211
|
+
<div class="question-text">${this.renderTooltip(isMandatory)}${label}</div>
|
|
212
|
+
<div class="question-details">${helperText}</div>
|
|
213
|
+
</div>
|
|
214
214
|
`;
|
|
215
215
|
}
|
|
216
216
|
static get styles() {
|
|
@@ -218,39 +218,39 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
218
218
|
return [
|
|
219
219
|
FlexLayoutClasses,
|
|
220
220
|
FormBuilderCardStyles,
|
|
221
|
-
css `
|
|
222
|
-
.additional-field {
|
|
223
|
-
padding-top: 15px;
|
|
224
|
-
padding-bottom: 20px;
|
|
225
|
-
background-color: var(--secondary-background-color);
|
|
226
|
-
}
|
|
227
|
-
.wide-field-container {
|
|
228
|
-
padding-bottom: 10px;
|
|
229
|
-
}
|
|
230
|
-
.wide-field-container .question-container {
|
|
231
|
-
min-height: 0;
|
|
232
|
-
padding: 7px 0 0;
|
|
233
|
-
}
|
|
234
|
-
.wide-field-container .question-text {
|
|
235
|
-
color: var(--secondary-text-color);
|
|
236
|
-
font-weight: 400;
|
|
237
|
-
}
|
|
238
|
-
.mandatory_warning etools-icon {
|
|
239
|
-
--etools-icon-fill-color: #f59e0b !important;
|
|
240
|
-
}
|
|
241
|
-
:host(:not([readonly])) {
|
|
242
|
-
.overall {
|
|
243
|
-
background-color: #ffffff;
|
|
244
|
-
border-style: inset;
|
|
245
|
-
border-width: 0 1px 1px 1px;
|
|
246
|
-
border-color: var(--dark-divider-color);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
@media print {
|
|
250
|
-
:host {
|
|
251
|
-
break-inside: avoid;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
221
|
+
css `
|
|
222
|
+
.additional-field {
|
|
223
|
+
padding-top: 15px;
|
|
224
|
+
padding-bottom: 20px;
|
|
225
|
+
background-color: var(--secondary-background-color);
|
|
226
|
+
}
|
|
227
|
+
.wide-field-container {
|
|
228
|
+
padding-bottom: 10px;
|
|
229
|
+
}
|
|
230
|
+
.wide-field-container .question-container {
|
|
231
|
+
min-height: 0;
|
|
232
|
+
padding: 7px 0 0;
|
|
233
|
+
}
|
|
234
|
+
.wide-field-container .question-text {
|
|
235
|
+
color: var(--secondary-text-color);
|
|
236
|
+
font-weight: 400;
|
|
237
|
+
}
|
|
238
|
+
.mandatory_warning etools-icon {
|
|
239
|
+
--etools-icon-fill-color: #f59e0b !important;
|
|
240
|
+
}
|
|
241
|
+
:host(:not([readonly])) {
|
|
242
|
+
.overall {
|
|
243
|
+
background-color: #ffffff;
|
|
244
|
+
border-style: inset;
|
|
245
|
+
border-width: 0 1px 1px 1px;
|
|
246
|
+
border-color: var(--dark-divider-color);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
@media print {
|
|
250
|
+
:host {
|
|
251
|
+
break-inside: avoid;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
254
|
`
|
|
255
255
|
];
|
|
256
256
|
}
|
|
@@ -24,55 +24,55 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
|
|
|
24
24
|
render() {
|
|
25
25
|
var _a;
|
|
26
26
|
const values = this.getValues();
|
|
27
|
-
return html `
|
|
28
|
-
<div class="finding-container">
|
|
29
|
-
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
30
|
-
<div class="question-control layout vertical center-justified start">
|
|
27
|
+
return html `
|
|
28
|
+
<div class="finding-container">
|
|
29
|
+
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
30
|
+
<div class="question-control layout vertical center-justified start">
|
|
31
31
|
${values.map((value, index) => value
|
|
32
|
-
? html `
|
|
33
|
-
<div class="layout horizontal file-container">
|
|
34
|
-
<!-- File name component -->
|
|
35
|
-
<div class="filename-container file-selector__filename">
|
|
36
|
-
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
37
|
-
<span class="filename" title="${value.filename}">${value.filename}</span>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- Download Button -->
|
|
41
|
-
<etools-button
|
|
42
|
-
class="neutral download-button file-selector__download"
|
|
43
|
-
variant="text"
|
|
44
|
-
?hidden="${!value.url}"
|
|
45
|
-
@click="${() => this.downloadFile(value)}"
|
|
46
|
-
>
|
|
47
|
-
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
48
|
-
${getTranslation(this.language, 'DOWNLOAD')}
|
|
49
|
-
</etools-button>
|
|
50
|
-
|
|
51
|
-
<!-- Delete Button -->
|
|
52
|
-
<etools-button
|
|
53
|
-
variant="danger"
|
|
54
|
-
class="file-selector__delete"
|
|
55
|
-
?hidden="${this.isReadonly}"
|
|
56
|
-
@click="${() => this.removeControl(index)}"
|
|
57
|
-
>
|
|
58
|
-
${getTranslation(this.language, 'DELETE')}
|
|
59
|
-
</etools-button>
|
|
60
|
-
</div>
|
|
32
|
+
? html `
|
|
33
|
+
<div class="layout horizontal file-container">
|
|
34
|
+
<!-- File name component -->
|
|
35
|
+
<div class="filename-container file-selector__filename">
|
|
36
|
+
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
37
|
+
<span class="filename" title="${value.filename}">${value.filename}</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Download Button -->
|
|
41
|
+
<etools-button
|
|
42
|
+
class="neutral download-button file-selector__download"
|
|
43
|
+
variant="text"
|
|
44
|
+
?hidden="${!value.url}"
|
|
45
|
+
@click="${() => this.downloadFile(value)}"
|
|
46
|
+
>
|
|
47
|
+
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
48
|
+
${getTranslation(this.language, 'DOWNLOAD')}
|
|
49
|
+
</etools-button>
|
|
50
|
+
|
|
51
|
+
<!-- Delete Button -->
|
|
52
|
+
<etools-button
|
|
53
|
+
variant="danger"
|
|
54
|
+
class="file-selector__delete"
|
|
55
|
+
?hidden="${this.isReadonly}"
|
|
56
|
+
@click="${() => this.removeControl(index)}"
|
|
57
|
+
>
|
|
58
|
+
${getTranslation(this.language, 'DELETE')}
|
|
59
|
+
</etools-button>
|
|
60
|
+
</div>
|
|
61
61
|
`
|
|
62
|
-
: '')}
|
|
63
|
-
<!-- Upload button -->
|
|
64
|
-
<etools-upload-multi
|
|
65
|
-
class="with-padding"
|
|
66
|
-
activate-offline
|
|
67
|
-
?hidden="${this.isReadonly}"
|
|
68
|
-
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
69
|
-
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
70
|
-
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
71
|
-
>
|
|
72
|
-
</etools-upload-multi>
|
|
73
|
-
<div ?hidden="${!this.isReadonly || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length)}">—</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
62
|
+
: '')}
|
|
63
|
+
<!-- Upload button -->
|
|
64
|
+
<etools-upload-multi
|
|
65
|
+
class="with-padding"
|
|
66
|
+
activate-offline
|
|
67
|
+
?hidden="${this.isReadonly}"
|
|
68
|
+
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
69
|
+
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
70
|
+
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
71
|
+
>
|
|
72
|
+
</etools-upload-multi>
|
|
73
|
+
<div ?hidden="${!this.isReadonly || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length)}">—</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
76
|
`;
|
|
77
77
|
}
|
|
78
78
|
controlTemplate() {
|
|
@@ -135,70 +135,70 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
|
|
|
135
135
|
...RepeatableBaseField.styles,
|
|
136
136
|
SharedStyles,
|
|
137
137
|
AttachmentsStyles,
|
|
138
|
-
css `
|
|
139
|
-
.file-selector__type-dropdown {
|
|
140
|
-
flex-basis: 25%;
|
|
141
|
-
padding-left: 8px;
|
|
142
|
-
padding-right: 8px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.file-selector__filename {
|
|
146
|
-
flex-basis: 35%;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.file-selector__download {
|
|
150
|
-
flex-basis: 10%;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.file-selector__delete {
|
|
154
|
-
flex-basis: 10%;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.file-selector-container.with-type-dropdown {
|
|
158
|
-
flex-wrap: nowrap;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.popup-container {
|
|
162
|
-
padding: 12px 12px 0;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.file-container {
|
|
166
|
-
padding: 8px 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@media (max-width: 380px) {
|
|
170
|
-
.file-selector-container.with-type-dropdown {
|
|
171
|
-
justify-content: center;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
175
|
-
flex-basis: 90%;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.file-selector__filename {
|
|
179
|
-
flex-basis: 90%;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.file-selector__download {
|
|
183
|
-
flex-basis: 5%;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.file-selector__delete {
|
|
187
|
-
flex-basis: 5%;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
@media (max-width: 600px) {
|
|
192
|
-
etools-dropdown {
|
|
193
|
-
padding: 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.file-selector-container.with-type-dropdown {
|
|
197
|
-
border-bottom: 1px solid lightgrey;
|
|
198
|
-
flex-wrap: wrap;
|
|
199
|
-
padding-bottom: 10px;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
138
|
+
css `
|
|
139
|
+
.file-selector__type-dropdown {
|
|
140
|
+
flex-basis: 25%;
|
|
141
|
+
padding-left: 8px;
|
|
142
|
+
padding-right: 8px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.file-selector__filename {
|
|
146
|
+
flex-basis: 35%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.file-selector__download {
|
|
150
|
+
flex-basis: 10%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.file-selector__delete {
|
|
154
|
+
flex-basis: 10%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.file-selector-container.with-type-dropdown {
|
|
158
|
+
flex-wrap: nowrap;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.popup-container {
|
|
162
|
+
padding: 12px 12px 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.file-container {
|
|
166
|
+
padding: 8px 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@media (max-width: 380px) {
|
|
170
|
+
.file-selector-container.with-type-dropdown {
|
|
171
|
+
justify-content: center;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
175
|
+
flex-basis: 90%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.file-selector__filename {
|
|
179
|
+
flex-basis: 90%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.file-selector__download {
|
|
183
|
+
flex-basis: 5%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.file-selector__delete {
|
|
187
|
+
flex-basis: 5%;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@media (max-width: 600px) {
|
|
192
|
+
etools-dropdown {
|
|
193
|
+
padding: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.file-selector-container.with-type-dropdown {
|
|
197
|
+
border-bottom: 1px solid lightgrey;
|
|
198
|
+
flex-wrap: wrap;
|
|
199
|
+
padding-bottom: 10px;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
202
|
`
|
|
203
203
|
];
|
|
204
204
|
}
|