@unicef-polymer/etools-form-builder 3.0.0-rc.9 → 3.1.0
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/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 +156 -53
- package/dist/form-fields/abstract-field-base.class.d.ts +1 -0
- package/dist/form-fields/abstract-field-base.class.js +106 -116
- package/dist/form-fields/field-renderer-component.d.ts +7 -3
- package/dist/form-fields/field-renderer-component.js +185 -154
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +112 -112
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +22 -22
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +19 -21
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +57 -59
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +19 -24
- package/dist/form-fields/single-fields/attachment-field.js +13 -13
- package/dist/form-fields/single-fields/boolean-field.js +16 -21
- package/dist/form-fields/single-fields/number-field.js +21 -23
- package/dist/form-fields/single-fields/scale-field.js +58 -60
- package/dist/form-fields/single-fields/text-field.js +24 -25
- package/dist/form-groups/form-abstract-group.d.ts +2 -1
- package/dist/form-groups/form-abstract-group.js +129 -127
- package/dist/form-groups/form-card.js +30 -24
- package/dist/form-groups/form-collapsed-card.js +34 -34
- package/dist/lib/additional-components/confirmation-dialog.js +21 -21
- package/dist/lib/additional-components/etools-fb-card.js +136 -135
- package/dist/lib/styles/attachments.styles.js +61 -66
- package/dist/lib/styles/card-styles.js +147 -151
- package/dist/lib/styles/dialog.styles.js +83 -83
- package/dist/lib/styles/elevation-styles.d.ts +2 -2
- package/dist/lib/styles/elevation-styles.js +35 -35
- package/dist/lib/styles/flex-layout-classes.js +316 -316
- package/dist/lib/styles/form-builder-card.styles.js +53 -46
- package/dist/lib/styles/page-layout-styles.js +198 -198
- package/dist/lib/styles/shared-styles.js +61 -67
- package/package.json +55 -55
- 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,24 +3,23 @@ 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
|
-
return html `
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
?
|
|
20
|
-
|
|
21
|
-
error-message="${this.errorMessage}"
|
|
22
|
-
>
|
|
23
|
-
</etools-textarea>
|
|
8
|
+
return html `
|
|
9
|
+
<etools-textarea
|
|
10
|
+
id="otherInfo"
|
|
11
|
+
class="no-padding-left"
|
|
12
|
+
no-label-float
|
|
13
|
+
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
14
|
+
.value="${this.value}"
|
|
15
|
+
@value-changed="${({ detail }) => this.valueChanged(detail.value)}"
|
|
16
|
+
@focus="${() => (this.touched = true)}"
|
|
17
|
+
?readonly="${this.isReadonly}"
|
|
18
|
+
?invalid="${this.errorMessage}"
|
|
19
|
+
name="${this.name}"
|
|
20
|
+
error-message="${this.errorMessage}"
|
|
21
|
+
>
|
|
22
|
+
</etools-textarea>
|
|
24
23
|
`;
|
|
25
24
|
}
|
|
26
25
|
customValidation() {
|
|
@@ -30,15 +29,15 @@ let TextField = class TextField extends BaseField {
|
|
|
30
29
|
// language=CSS
|
|
31
30
|
return [
|
|
32
31
|
...BaseField.styles,
|
|
33
|
-
css `
|
|
34
|
-
:host(.wide) etools-textarea {
|
|
35
|
-
padding-left: 0;
|
|
36
|
-
}
|
|
37
|
-
@media (max-width: 380px) {
|
|
38
|
-
.no-padding-left {
|
|
39
|
-
padding-left: 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
32
|
+
css `
|
|
33
|
+
:host(.wide) etools-textarea {
|
|
34
|
+
padding-left: 0;
|
|
35
|
+
}
|
|
36
|
+
@media (max-width: 380px) {
|
|
37
|
+
.no-padding-left {
|
|
38
|
+
padding-left: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
42
41
|
`
|
|
43
42
|
];
|
|
44
43
|
}
|
|
@@ -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
|
}
|
|
@@ -110,8 +111,8 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
110
111
|
if (!this.groupStructure || !this.metadata) {
|
|
111
112
|
return html ``;
|
|
112
113
|
}
|
|
113
|
-
return html `
|
|
114
|
-
${this.groupStructure.children.map((child) => this.renderChild(child))}
|
|
114
|
+
return html `
|
|
115
|
+
${this.groupStructure.children.map((child) => this.renderChild(child))}
|
|
115
116
|
`;
|
|
116
117
|
}
|
|
117
118
|
renderChild(child) {
|
|
@@ -130,18 +131,19 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
130
131
|
}
|
|
131
132
|
renderField(blueprintField) {
|
|
132
133
|
var _a;
|
|
133
|
-
return html `
|
|
134
|
-
<field-renderer
|
|
135
|
-
.field="${blueprintField}"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.
|
|
139
|
-
.
|
|
140
|
-
.
|
|
141
|
-
.
|
|
142
|
-
|
|
143
|
-
@
|
|
144
|
-
|
|
134
|
+
return html `
|
|
135
|
+
<field-renderer
|
|
136
|
+
.field="${blueprintField}"
|
|
137
|
+
.language="${this.language}"
|
|
138
|
+
?readonly="${live(this.isReadonly())}"
|
|
139
|
+
.value="${this.value && this.value[blueprintField.name]}"
|
|
140
|
+
.validations="${blueprintField.validations.map((validation) => this.metadata.validations[validation])}"
|
|
141
|
+
.errorMessage="${this.getErrorMessage(blueprintField.name)}"
|
|
142
|
+
.options="${((_a = this.metadata.options[blueprintField.options_key || '']) === null || _a === void 0 ? void 0 : _a.values) || []}"
|
|
143
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [blueprintField.name] : [this.groupStructure.name, blueprintField.name])}"
|
|
144
|
+
@value-changed="${(event) => this.valueChanged(event, blueprintField.name)}"
|
|
145
|
+
@error-changed="${(event) => this.errorChanged(event, blueprintField.name)}"
|
|
146
|
+
></field-renderer>
|
|
145
147
|
`;
|
|
146
148
|
}
|
|
147
149
|
renderInformation(information) {
|
|
@@ -152,18 +154,18 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
152
154
|
return this.getGroupTemplate(groupStructure);
|
|
153
155
|
}
|
|
154
156
|
const value = (this.value && this.value[groupStructure.name]) || [{}];
|
|
155
|
-
return html `
|
|
156
|
-
${value.map((_, index) => this.getGroupTemplate(groupStructure, index))}
|
|
157
|
-
<etools-button
|
|
158
|
-
variant="primary"
|
|
159
|
-
class="add-group save-button"
|
|
160
|
-
@click="${() => this.addGroup(groupStructure.name)}"
|
|
161
|
-
>
|
|
162
|
-
${getTranslation(this.language, 'ADD')}
|
|
157
|
+
return html `
|
|
158
|
+
${value.map((_, index) => this.getGroupTemplate(groupStructure, index))}
|
|
159
|
+
<etools-button
|
|
160
|
+
variant="primary"
|
|
161
|
+
class="add-group save-button"
|
|
162
|
+
@click="${() => this.addGroup(groupStructure.name)}"
|
|
163
|
+
>
|
|
164
|
+
${getTranslation(this.language, 'ADD')}
|
|
163
165
|
${!groupStructure.title || groupStructure.title.length > 15
|
|
164
166
|
? getTranslation(this.language, 'GROUP')
|
|
165
|
-
: groupStructure.title}
|
|
166
|
-
</etools-button>
|
|
167
|
+
: groupStructure.title}
|
|
168
|
+
</etools-button>
|
|
167
169
|
`;
|
|
168
170
|
}
|
|
169
171
|
getGroupTemplate(groupStructure, index) {
|
|
@@ -179,52 +181,52 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
179
181
|
errors = errors && errors[index];
|
|
180
182
|
}
|
|
181
183
|
if (isAbstract) {
|
|
182
|
-
return html `
|
|
183
|
-
<form-abstract-group
|
|
184
|
-
.groupStructure="${groupStructure}"
|
|
185
|
-
.value="${value}"
|
|
186
|
-
.metadata="${this.metadata}"
|
|
187
|
-
.parentGroupName="${this.groupStructure.name}"
|
|
188
|
-
.collapsed="${this.collapsed}"
|
|
189
|
-
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
190
|
-
.readonly="${this.isReadonly()}"
|
|
191
|
-
.errors="${errors || null}"
|
|
192
|
-
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
193
|
-
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
194
|
-
></form-abstract-group>
|
|
184
|
+
return html `
|
|
185
|
+
<form-abstract-group
|
|
186
|
+
.groupStructure="${groupStructure}"
|
|
187
|
+
.value="${value}"
|
|
188
|
+
.metadata="${this.metadata}"
|
|
189
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
190
|
+
.collapsed="${this.collapsed}"
|
|
191
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
192
|
+
.readonly="${this.isReadonly()}"
|
|
193
|
+
.errors="${errors || null}"
|
|
194
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
195
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
196
|
+
></form-abstract-group>
|
|
195
197
|
`;
|
|
196
198
|
}
|
|
197
199
|
else if (isCard && isCollapsed) {
|
|
198
|
-
return html `
|
|
199
|
-
<form-collapsed-card
|
|
200
|
-
.groupStructure="${groupStructure}"
|
|
201
|
-
.value="${value}"
|
|
202
|
-
.metadata="${this.metadata}"
|
|
203
|
-
.parentGroupName="${this.groupStructure.name}"
|
|
204
|
-
.collapsed="${this.collapsed}"
|
|
205
|
-
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
206
|
-
.readonly="${this.isReadonly()}"
|
|
207
|
-
.errors="${errors || null}"
|
|
208
|
-
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
209
|
-
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
210
|
-
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
211
|
-
></form-collapsed-card>
|
|
200
|
+
return html `
|
|
201
|
+
<form-collapsed-card
|
|
202
|
+
.groupStructure="${groupStructure}"
|
|
203
|
+
.value="${value}"
|
|
204
|
+
.metadata="${this.metadata}"
|
|
205
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
206
|
+
.collapsed="${this.collapsed}"
|
|
207
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
208
|
+
.readonly="${this.isReadonly()}"
|
|
209
|
+
.errors="${errors || null}"
|
|
210
|
+
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
211
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
212
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
213
|
+
></form-collapsed-card>
|
|
212
214
|
`;
|
|
213
215
|
}
|
|
214
216
|
else if (isCard) {
|
|
215
|
-
return html `
|
|
216
|
-
<form-card
|
|
217
|
-
.groupStructure="${groupStructure}"
|
|
218
|
-
.value="${value}"
|
|
219
|
-
.metadata="${this.metadata}"
|
|
220
|
-
.parentGroupName="${this.groupStructure.name}"
|
|
221
|
-
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
222
|
-
.readonly="${this.isReadonly()}"
|
|
223
|
-
.errors="${errors || null}"
|
|
224
|
-
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
225
|
-
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
226
|
-
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
227
|
-
></form-card>
|
|
217
|
+
return html `
|
|
218
|
+
<form-card
|
|
219
|
+
.groupStructure="${groupStructure}"
|
|
220
|
+
.value="${value}"
|
|
221
|
+
.metadata="${this.metadata}"
|
|
222
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
223
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
224
|
+
.readonly="${this.isReadonly()}"
|
|
225
|
+
.errors="${errors || null}"
|
|
226
|
+
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
227
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
228
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
229
|
+
></form-card>
|
|
228
230
|
`;
|
|
229
231
|
}
|
|
230
232
|
else {
|
|
@@ -305,68 +307,68 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
305
307
|
CardStyles,
|
|
306
308
|
FlexLayoutClasses,
|
|
307
309
|
FormBuilderCardStyles,
|
|
308
|
-
css `
|
|
309
|
-
:host {
|
|
310
|
-
display: flex;
|
|
311
|
-
flex-direction: column;
|
|
312
|
-
}
|
|
313
|
-
.add-group {
|
|
314
|
-
align-self: flex-end;
|
|
315
|
-
margin-right: 23px;
|
|
316
|
-
margin-top: 20px;
|
|
317
|
-
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
318
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
319
|
-
}
|
|
320
|
-
.card-header {
|
|
321
|
-
display: flex;
|
|
322
|
-
align-items: center;
|
|
323
|
-
justify-content: space-between;
|
|
324
|
-
}
|
|
325
|
-
.card-header .remove-group {
|
|
326
|
-
display: flex;
|
|
327
|
-
align-items: center;
|
|
328
|
-
justify-content: flex-end;
|
|
329
|
-
padding: 0 10px 8px;
|
|
330
|
-
cursor: pointer;
|
|
331
|
-
width: min-content;
|
|
332
|
-
white-space: nowrap;
|
|
333
|
-
}
|
|
334
|
-
.card-header .title {
|
|
335
|
-
padding: 0 24px 8px;
|
|
336
|
-
font-size: 18px;
|
|
337
|
-
font-weight: bold;
|
|
338
|
-
}
|
|
339
|
-
.save-button {
|
|
340
|
-
margin-top: 8px;
|
|
341
|
-
color: var(--primary-background-color);
|
|
342
|
-
background-color: var(--primary-color);
|
|
343
|
-
}
|
|
344
|
-
.information-source {
|
|
345
|
-
padding: 0.5% 2% 0.5% 1%;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.additional-field {
|
|
349
|
-
padding-top: 15px;
|
|
350
|
-
padding-bottom: 20px;
|
|
351
|
-
background-color: var(--secondary-background-color);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.actions-container {
|
|
355
|
-
padding: 0 25px 5px 45px;
|
|
356
|
-
box-sizing: border-box;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.card-container.form-card {
|
|
360
|
-
padding: 12px 0 15px;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.attachments-warning {
|
|
364
|
-
color: red;
|
|
365
|
-
}
|
|
366
|
-
etools-icon-button[name='close'] {
|
|
367
|
-
cursor: pointer;
|
|
368
|
-
color: var(--primary-text-color);
|
|
369
|
-
}
|
|
310
|
+
css `
|
|
311
|
+
:host {
|
|
312
|
+
display: flex;
|
|
313
|
+
flex-direction: column;
|
|
314
|
+
}
|
|
315
|
+
.add-group {
|
|
316
|
+
align-self: flex-end;
|
|
317
|
+
margin-right: 23px;
|
|
318
|
+
margin-top: 20px;
|
|
319
|
+
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
320
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
321
|
+
}
|
|
322
|
+
.card-header {
|
|
323
|
+
display: flex;
|
|
324
|
+
align-items: center;
|
|
325
|
+
justify-content: space-between;
|
|
326
|
+
}
|
|
327
|
+
.card-header .remove-group {
|
|
328
|
+
display: flex;
|
|
329
|
+
align-items: center;
|
|
330
|
+
justify-content: flex-end;
|
|
331
|
+
padding: 0 10px 8px;
|
|
332
|
+
cursor: pointer;
|
|
333
|
+
width: min-content;
|
|
334
|
+
white-space: nowrap;
|
|
335
|
+
}
|
|
336
|
+
.card-header .title {
|
|
337
|
+
padding: 0 24px 8px;
|
|
338
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
339
|
+
font-weight: bold;
|
|
340
|
+
}
|
|
341
|
+
.save-button {
|
|
342
|
+
margin-top: 8px;
|
|
343
|
+
color: var(--primary-background-color);
|
|
344
|
+
background-color: var(--primary-color);
|
|
345
|
+
}
|
|
346
|
+
.information-source {
|
|
347
|
+
padding: 0.5% 2% 0.5% 1%;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.additional-field {
|
|
351
|
+
padding-top: 15px;
|
|
352
|
+
padding-bottom: 20px;
|
|
353
|
+
background-color: var(--secondary-background-color);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.actions-container {
|
|
357
|
+
padding: 0 25px 5px 45px;
|
|
358
|
+
box-sizing: border-box;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.card-container.form-card {
|
|
362
|
+
padding: 12px 0 15px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.attachments-warning {
|
|
366
|
+
color: red;
|
|
367
|
+
}
|
|
368
|
+
etools-icon-button[name='close'] {
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
color: var(--primary-text-color);
|
|
371
|
+
}
|
|
370
372
|
`
|
|
371
373
|
];
|
|
372
374
|
}
|
|
@@ -47,32 +47,38 @@ let FormCard = class FormCard extends FormAbstractGroup {
|
|
|
47
47
|
return [SharedStyles, pageLayoutStyles, elevationStyles, CardStyles, FlexLayoutClasses, FormBuilderCardStyles];
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
return html `
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
return html `
|
|
51
|
+
<style>
|
|
52
|
+
.card-buttons {
|
|
53
|
+
padding: 12px 24px;
|
|
54
|
+
padding-top: 0;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
<section class="elevation page-content card-container form-card" elevation="1">
|
|
58
|
+
<div class="card-header">
|
|
59
|
+
<div class="title">${this.groupStructure.title}</div>
|
|
60
|
+
<div
|
|
61
|
+
class="remove-group"
|
|
62
|
+
?hidden="${!this.groupStructure.repeatable}"
|
|
63
|
+
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
64
|
+
>
|
|
65
|
+
Remove
|
|
60
66
|
${!this.groupStructure.title || this.groupStructure.title.length > 15
|
|
61
67
|
? getTranslation(this.language, 'GROUP')
|
|
62
|
-
: this.groupStructure.title}
|
|
63
|
-
<etools-icon-button class="attachments-warning" name="delete"></etools-icon-button>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
${super.render()}
|
|
67
|
-
|
|
68
|
-
<etools-collapse ?opened="${this.showSaveButton}">
|
|
69
|
-
<div class="layout horizontal end-justified card-buttons actions-container">
|
|
70
|
-
<etools-button variant="primary" @click="${this.saveChanges}">
|
|
71
|
-
${getTranslation(this.language, 'SAVE')}
|
|
72
|
-
</etools-button>
|
|
73
|
-
</div>
|
|
74
|
-
</etools-collapse>
|
|
75
|
-
</section>
|
|
68
|
+
: this.groupStructure.title}
|
|
69
|
+
<etools-icon-button class="attachments-warning" name="delete"></etools-icon-button>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
${super.render()}
|
|
73
|
+
|
|
74
|
+
<etools-collapse ?opened="${this.showSaveButton}">
|
|
75
|
+
<div class="layout horizontal end-justified card-buttons actions-container">
|
|
76
|
+
<etools-button variant="primary" @click="${this.saveChanges}">
|
|
77
|
+
${getTranslation(this.language, 'SAVE')}
|
|
78
|
+
</etools-button>
|
|
79
|
+
</div>
|
|
80
|
+
</etools-collapse>
|
|
81
|
+
</section>
|
|
76
82
|
`;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
@@ -73,31 +73,31 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
73
73
|
* and adds etools-card as container wrapper
|
|
74
74
|
*/
|
|
75
75
|
render() {
|
|
76
|
-
return html `
|
|
77
|
-
<section class="elevation page-content card-container" elevation="1">
|
|
78
|
-
<etools-fb-card
|
|
79
|
-
card-title="${this.retrieveTitle(this.parentGroupName) + this.groupStructure.title}"
|
|
80
|
-
is-collapsible
|
|
81
|
-
?is-editable="${!this.readonly}"
|
|
82
|
-
?edit="${this.isEditMode}"
|
|
83
|
-
.collapsed="${this.collapsed}"
|
|
84
|
-
@start-edit="${() => this.startEdit()}"
|
|
85
|
-
@save="${() => this.saveChanges()}"
|
|
86
|
-
@cancel="${() => this.cancelEdit()}"
|
|
87
|
-
>
|
|
88
|
-
<!-- Open Attachments popup button -->
|
|
89
|
-
<div slot="actions" class="layout horizontal center">${this.getAdditionalButtons()}</div>
|
|
90
|
-
<div slot="postfix" class="layout horizontal center" ?hidden="${!this.groupStructure.repeatable}">
|
|
91
|
-
<etools-icon-button
|
|
92
|
-
class="attachments-warning"
|
|
93
|
-
name="close"
|
|
94
|
-
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
95
|
-
>
|
|
96
|
-
</etools-icon-button>
|
|
97
|
-
</div>
|
|
98
|
-
<div slot="content">${this.renderGroupChildren()}</div>
|
|
99
|
-
</etools-fb-card>
|
|
100
|
-
</section>
|
|
76
|
+
return html `
|
|
77
|
+
<section class="elevation page-content card-container" elevation="1">
|
|
78
|
+
<etools-fb-card
|
|
79
|
+
card-title="${this.retrieveTitle(this.parentGroupName) + this.groupStructure.title}"
|
|
80
|
+
is-collapsible
|
|
81
|
+
?is-editable="${!this.readonly}"
|
|
82
|
+
?edit="${this.isEditMode}"
|
|
83
|
+
.collapsed="${this.collapsed}"
|
|
84
|
+
@start-edit="${() => this.startEdit()}"
|
|
85
|
+
@save="${() => this.saveChanges()}"
|
|
86
|
+
@cancel="${() => this.cancelEdit()}"
|
|
87
|
+
>
|
|
88
|
+
<!-- Open Attachments popup button -->
|
|
89
|
+
<div slot="actions" class="layout horizontal center">${this.getAdditionalButtons()}</div>
|
|
90
|
+
<div slot="postfix" class="layout horizontal center" ?hidden="${!this.groupStructure.repeatable}">
|
|
91
|
+
<etools-icon-button
|
|
92
|
+
class="attachments-warning"
|
|
93
|
+
name="close"
|
|
94
|
+
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
95
|
+
>
|
|
96
|
+
</etools-icon-button>
|
|
97
|
+
</div>
|
|
98
|
+
<div slot="content">${this.renderGroupChildren()}</div>
|
|
99
|
+
</etools-fb-card>
|
|
100
|
+
</section>
|
|
101
101
|
`;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
@@ -119,15 +119,15 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
119
119
|
!this.groupStructure.children.some(({ styling }) => styling.includes(StructureTypes.ATTACHMENTS_BUTTON));
|
|
120
120
|
return hideAttachmentsButton
|
|
121
121
|
? html ``
|
|
122
|
-
: html `
|
|
123
|
-
<etools-icon id="attachments-warning" name="warning" ?hidden="${!this._errors.attachments}"></etools-icon>
|
|
124
|
-
<etools-button id="primary" variant="text" class="primary" @click="${this.openAttachmentsPopup}">
|
|
125
|
-
<etools-icon
|
|
126
|
-
slot="prefix"
|
|
127
|
-
name="${((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.attachments) === null || _d === void 0 ? void 0 : _d.length) ? 'file-download' : 'file-upload'}"
|
|
128
|
-
></etools-icon>
|
|
129
|
-
${this.getAttachmentsBtnText((_f = (_e = this.value) === null || _e === void 0 ? void 0 : _e.attachments) === null || _f === void 0 ? void 0 : _f.length)}
|
|
130
|
-
</etools-button>
|
|
122
|
+
: html `
|
|
123
|
+
<etools-icon id="attachments-warning" name="warning" ?hidden="${!this._errors.attachments}"></etools-icon>
|
|
124
|
+
<etools-button id="primary" variant="text" class="primary" @click="${this.openAttachmentsPopup}">
|
|
125
|
+
<etools-icon
|
|
126
|
+
slot="prefix"
|
|
127
|
+
name="${((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.attachments) === null || _d === void 0 ? void 0 : _d.length) ? 'file-download' : 'file-upload'}"
|
|
128
|
+
></etools-icon>
|
|
129
|
+
${this.getAttachmentsBtnText((_f = (_e = this.value) === null || _e === void 0 ? void 0 : _e.attachments) === null || _f === void 0 ? void 0 : _f.length)}
|
|
130
|
+
</etools-button>
|
|
131
131
|
`;
|
|
132
132
|
}
|
|
133
133
|
retrieveTitle(target) {
|
|
@@ -17,26 +17,26 @@ 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() {
|
|
24
|
-
return html `
|
|
25
|
-
<etools-dialog
|
|
26
|
-
id="confirmation-dialog"
|
|
27
|
-
size="md"
|
|
28
|
-
no-padding
|
|
29
|
-
keep-dialog-open
|
|
30
|
-
?hide-confirm-btn="${this.hideConfirmBtn}"
|
|
31
|
-
cancel-btn-text="${getTranslation(this.language, this.hideConfirmBtn ? 'OK' : 'CANCEL')}"
|
|
32
|
-
?opened="${this.dialogOpened}"
|
|
33
|
-
theme="confirmation"
|
|
34
|
-
dialog-title="${this.dialogTitle}"
|
|
35
|
-
@close="${this.onClose}"
|
|
36
|
-
@confirm-btn-clicked="${() => this.confirm()}"
|
|
37
|
-
>
|
|
38
|
-
<div class="confirmation-message">${this.text}</div>
|
|
39
|
-
</etools-dialog>
|
|
24
|
+
return html `
|
|
25
|
+
<etools-dialog
|
|
26
|
+
id="confirmation-dialog"
|
|
27
|
+
size="md"
|
|
28
|
+
no-padding
|
|
29
|
+
keep-dialog-open
|
|
30
|
+
?hide-confirm-btn="${this.hideConfirmBtn}"
|
|
31
|
+
cancel-btn-text="${getTranslation(this.language, this.hideConfirmBtn ? 'OK' : 'CANCEL')}"
|
|
32
|
+
?opened="${this.dialogOpened}"
|
|
33
|
+
theme="confirmation"
|
|
34
|
+
dialog-title="${this.dialogTitle}"
|
|
35
|
+
@close="${this.onClose}"
|
|
36
|
+
@confirm-btn-clicked="${() => this.confirm()}"
|
|
37
|
+
>
|
|
38
|
+
<div class="confirmation-message">${this.text}</div>
|
|
39
|
+
</etools-dialog>
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
42
|
onClose() {
|
|
@@ -48,10 +48,10 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
|
48
48
|
static get styles() {
|
|
49
49
|
// language=CSS
|
|
50
50
|
return [
|
|
51
|
-
css `
|
|
52
|
-
.confirmation-message {
|
|
53
|
-
padding-left: 24px;
|
|
54
|
-
}
|
|
51
|
+
css `
|
|
52
|
+
.confirmation-message {
|
|
53
|
+
padding-left: 24px;
|
|
54
|
+
}
|
|
55
55
|
`
|
|
56
56
|
];
|
|
57
57
|
}
|