@unicef-polymer/etools-form-builder 3.2.2 → 3.2.4
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 +100 -100
- package/dist/form-fields/field-renderer-component.js +198 -166
- package/dist/form-fields/index.d.ts +2 -0
- package/dist/form-fields/index.js +2 -0
- 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-choice-field.d.ts +15 -0
- package/dist/form-fields/repeatable-fields/repeatable-choice-field.js +123 -0
- 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/choice-field.d.ts +17 -0
- package/dist/form-fields/single-fields/choice-field.js +121 -0
- 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 +30 -30
- package/dist/form-groups/form-abstract-group.d.ts +2 -1
- package/dist/form-groups/form-abstract-group.js +130 -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/dist/lib/types/form-builder.types.d.ts +1 -1
- package/dist/rich-editor/rich-action.js +34 -34
- package/dist/rich-editor/rich-text.d.ts +1 -0
- package/dist/rich-editor/rich-text.js +163 -65
- package/dist/rich-editor/rich-toolbar.js +125 -125
- package/dist/rich-editor/rich-viewer.js +21 -21
- package/package.json +52 -51
|
@@ -25,6 +25,7 @@ export var FieldTypes;
|
|
|
25
25
|
FieldTypes["SCALE_TYPE"] = "likert_scale";
|
|
26
26
|
FieldTypes["NUMBER_INTEGER_TYPE"] = "number-integer";
|
|
27
27
|
FieldTypes["NUMBER_FLOAT_TYPE"] = "number-float";
|
|
28
|
+
FieldTypes["MULTIPLE_CHOICE_TYPE"] = "multiple_choice";
|
|
28
29
|
})(FieldTypes || (FieldTypes = {}));
|
|
29
30
|
export var StructureTypes;
|
|
30
31
|
(function (StructureTypes) {
|
|
@@ -111,8 +112,8 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
111
112
|
if (!this.groupStructure || !this.metadata) {
|
|
112
113
|
return html ``;
|
|
113
114
|
}
|
|
114
|
-
return html `
|
|
115
|
-
${this.groupStructure.children.map((child) => this.renderChild(child))}
|
|
115
|
+
return html `
|
|
116
|
+
${this.groupStructure.children.map((child) => this.renderChild(child))}
|
|
116
117
|
`;
|
|
117
118
|
}
|
|
118
119
|
renderChild(child) {
|
|
@@ -131,19 +132,19 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
131
132
|
}
|
|
132
133
|
renderField(blueprintField) {
|
|
133
134
|
var _a;
|
|
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>
|
|
135
|
+
return html `
|
|
136
|
+
<field-renderer
|
|
137
|
+
.field="${blueprintField}"
|
|
138
|
+
.language="${this.language}"
|
|
139
|
+
?readonly="${live(this.isReadonly())}"
|
|
140
|
+
.value="${this.value && this.value[blueprintField.name]}"
|
|
141
|
+
.validations="${blueprintField.validations.map((validation) => this.metadata.validations[validation])}"
|
|
142
|
+
.errorMessage="${this.getErrorMessage(blueprintField.name)}"
|
|
143
|
+
.options="${((_a = this.metadata.options[blueprintField.options_key || '']) === null || _a === void 0 ? void 0 : _a.values) || []}"
|
|
144
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [blueprintField.name] : [this.groupStructure.name, blueprintField.name])}"
|
|
145
|
+
@value-changed="${(event) => this.valueChanged(event, blueprintField.name)}"
|
|
146
|
+
@error-changed="${(event) => this.errorChanged(event, blueprintField.name)}"
|
|
147
|
+
></field-renderer>
|
|
147
148
|
`;
|
|
148
149
|
}
|
|
149
150
|
renderInformation(information) {
|
|
@@ -154,18 +155,18 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
154
155
|
return this.getGroupTemplate(groupStructure);
|
|
155
156
|
}
|
|
156
157
|
const value = (this.value && this.value[groupStructure.name]) || [{}];
|
|
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')}
|
|
158
|
+
return html `
|
|
159
|
+
${value.map((_, index) => this.getGroupTemplate(groupStructure, index))}
|
|
160
|
+
<etools-button
|
|
161
|
+
variant="primary"
|
|
162
|
+
class="add-group save-button"
|
|
163
|
+
@click="${() => this.addGroup(groupStructure.name)}"
|
|
164
|
+
>
|
|
165
|
+
${getTranslation(this.language, 'ADD')}
|
|
165
166
|
${!groupStructure.title || groupStructure.title.length > 15
|
|
166
167
|
? getTranslation(this.language, 'GROUP')
|
|
167
|
-
: groupStructure.title}
|
|
168
|
-
</etools-button>
|
|
168
|
+
: groupStructure.title}
|
|
169
|
+
</etools-button>
|
|
169
170
|
`;
|
|
170
171
|
}
|
|
171
172
|
getGroupTemplate(groupStructure, index) {
|
|
@@ -181,52 +182,52 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
181
182
|
errors = errors && errors[index];
|
|
182
183
|
}
|
|
183
184
|
if (isAbstract) {
|
|
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>
|
|
185
|
+
return html `
|
|
186
|
+
<form-abstract-group
|
|
187
|
+
.groupStructure="${groupStructure}"
|
|
188
|
+
.value="${value}"
|
|
189
|
+
.metadata="${this.metadata}"
|
|
190
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
191
|
+
.collapsed="${this.collapsed}"
|
|
192
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
193
|
+
.readonly="${this.isReadonly()}"
|
|
194
|
+
.errors="${errors || null}"
|
|
195
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
196
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
197
|
+
></form-abstract-group>
|
|
197
198
|
`;
|
|
198
199
|
}
|
|
199
200
|
else if (isCard && isCollapsed) {
|
|
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>
|
|
201
|
+
return html `
|
|
202
|
+
<form-collapsed-card
|
|
203
|
+
.groupStructure="${groupStructure}"
|
|
204
|
+
.value="${value}"
|
|
205
|
+
.metadata="${this.metadata}"
|
|
206
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
207
|
+
.collapsed="${this.collapsed}"
|
|
208
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
209
|
+
.readonly="${this.isReadonly()}"
|
|
210
|
+
.errors="${errors || null}"
|
|
211
|
+
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
212
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
213
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
214
|
+
></form-collapsed-card>
|
|
214
215
|
`;
|
|
215
216
|
}
|
|
216
217
|
else if (isCard) {
|
|
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>
|
|
218
|
+
return html `
|
|
219
|
+
<form-card
|
|
220
|
+
.groupStructure="${groupStructure}"
|
|
221
|
+
.value="${value}"
|
|
222
|
+
.metadata="${this.metadata}"
|
|
223
|
+
.parentGroupName="${this.groupStructure.name}"
|
|
224
|
+
.computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
|
|
225
|
+
.readonly="${this.isReadonly()}"
|
|
226
|
+
.errors="${errors || null}"
|
|
227
|
+
@remove-group="${() => this.removeGroup(groupStructure, index)}"
|
|
228
|
+
@value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
|
|
229
|
+
@error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
|
|
230
|
+
></form-card>
|
|
230
231
|
`;
|
|
231
232
|
}
|
|
232
233
|
else {
|
|
@@ -307,70 +308,70 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
|
|
|
307
308
|
CardStyles,
|
|
308
309
|
FlexLayoutClasses,
|
|
309
310
|
FormBuilderCardStyles,
|
|
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:
|
|
320
|
-
0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
|
321
|
-
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
322
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
323
|
-
}
|
|
324
|
-
.card-header {
|
|
325
|
-
display: flex;
|
|
326
|
-
align-items: center;
|
|
327
|
-
justify-content: space-between;
|
|
328
|
-
}
|
|
329
|
-
.card-header .remove-group {
|
|
330
|
-
display: flex;
|
|
331
|
-
align-items: center;
|
|
332
|
-
justify-content: flex-end;
|
|
333
|
-
padding: 0 10px 8px;
|
|
334
|
-
cursor: pointer;
|
|
335
|
-
width: min-content;
|
|
336
|
-
white-space: nowrap;
|
|
337
|
-
}
|
|
338
|
-
.card-header .title {
|
|
339
|
-
padding: 0 24px 8px;
|
|
340
|
-
font-size: var(--etools-font-size-18, 18px);
|
|
341
|
-
font-weight: bold;
|
|
342
|
-
}
|
|
343
|
-
.save-button {
|
|
344
|
-
margin-top: 8px;
|
|
345
|
-
color: var(--primary-background-color);
|
|
346
|
-
background-color: var(--primary-color);
|
|
347
|
-
}
|
|
348
|
-
.information-source {
|
|
349
|
-
padding: 0.5% 2% 0.5% 1%;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.additional-field {
|
|
353
|
-
padding-top: 15px;
|
|
354
|
-
padding-bottom: 20px;
|
|
355
|
-
background-color: var(--secondary-background-color);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.actions-container {
|
|
359
|
-
padding: 0 25px 5px 45px;
|
|
360
|
-
box-sizing: border-box;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.card-container.form-card {
|
|
364
|
-
padding: 12px 0 15px;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.attachments-warning {
|
|
368
|
-
color: red;
|
|
369
|
-
}
|
|
370
|
-
etools-icon-button[name='close'] {
|
|
371
|
-
cursor: pointer;
|
|
372
|
-
color: var(--primary-text-color);
|
|
373
|
-
}
|
|
311
|
+
css `
|
|
312
|
+
:host {
|
|
313
|
+
display: flex;
|
|
314
|
+
flex-direction: column;
|
|
315
|
+
}
|
|
316
|
+
.add-group {
|
|
317
|
+
align-self: flex-end;
|
|
318
|
+
margin-right: 23px;
|
|
319
|
+
margin-top: 20px;
|
|
320
|
+
box-shadow:
|
|
321
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
|
322
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
323
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
|
324
|
+
}
|
|
325
|
+
.card-header {
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
justify-content: space-between;
|
|
329
|
+
}
|
|
330
|
+
.card-header .remove-group {
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
justify-content: flex-end;
|
|
334
|
+
padding: 0 10px 8px;
|
|
335
|
+
cursor: pointer;
|
|
336
|
+
width: min-content;
|
|
337
|
+
white-space: nowrap;
|
|
338
|
+
}
|
|
339
|
+
.card-header .title {
|
|
340
|
+
padding: 0 24px 8px;
|
|
341
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
342
|
+
font-weight: bold;
|
|
343
|
+
}
|
|
344
|
+
.save-button {
|
|
345
|
+
margin-top: 8px;
|
|
346
|
+
color: var(--primary-background-color);
|
|
347
|
+
background-color: var(--primary-color);
|
|
348
|
+
}
|
|
349
|
+
.information-source {
|
|
350
|
+
padding: 0.5% 2% 0.5% 1%;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.additional-field {
|
|
354
|
+
padding-top: 15px;
|
|
355
|
+
padding-bottom: 20px;
|
|
356
|
+
background-color: var(--secondary-background-color);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.actions-container {
|
|
360
|
+
padding: 0 25px 5px 45px;
|
|
361
|
+
box-sizing: border-box;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.card-container.form-card {
|
|
365
|
+
padding: 12px 0 15px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.attachments-warning {
|
|
369
|
+
color: red;
|
|
370
|
+
}
|
|
371
|
+
etools-icon-button[name='close'] {
|
|
372
|
+
cursor: pointer;
|
|
373
|
+
color: var(--primary-text-color);
|
|
374
|
+
}
|
|
374
375
|
`
|
|
375
376
|
];
|
|
376
377
|
}
|
|
@@ -47,38 +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
|
-
<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
|
|
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
|
|
66
66
|
${!this.groupStructure.title || this.groupStructure.title.length > 15
|
|
67
67
|
? getTranslation(this.language, 'GROUP')
|
|
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>
|
|
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>
|
|
82
82
|
`;
|
|
83
83
|
}
|
|
84
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) {
|
|
@@ -21,22 +21,22 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
|
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
|
}
|