@unicef-polymer/etools-form-builder 4.0.0 → 4.0.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/assets/translations.js +8 -0
- 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.d.ts +4 -3
- package/dist/form-fields/field-renderer-component.js +209 -195
- 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.js +63 -63
- 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.js +65 -65
- 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.js +129 -129
- package/dist/form-groups/form-card.js +30 -30
- package/dist/form-groups/form-collapsed-card.js +40 -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 -0
- package/dist/rich-editor/rich-action.js +34 -34
- package/dist/rich-editor/rich-text.js +64 -64
- package/dist/rich-editor/rich-toolbar.js +125 -125
- package/dist/rich-editor/rich-viewer.js +21 -21
- package/package.json +53 -53
|
@@ -6,6 +6,7 @@ import { FieldTypes, StructureTypes } from '../form-groups';
|
|
|
6
6
|
import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
|
|
7
7
|
import '@unicef-polymer/etools-unicef/src/etools-icons/etools-icon';
|
|
8
8
|
import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
|
|
9
|
+
import '@unicef-polymer/etools-unicef/src/etools-info-tooltip/etools-info-tooltip';
|
|
9
10
|
import { getTranslation } from '../lib/utils/translate';
|
|
10
11
|
let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
11
12
|
constructor() {
|
|
@@ -31,113 +32,113 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
31
32
|
const mandatoryClass = blueprintField.styling.includes(StructureTypes.MANDATORY_WARNING)
|
|
32
33
|
? 'mandatory_warning '
|
|
33
34
|
: '';
|
|
34
|
-
return html `
|
|
35
|
-
<div class="${`${additionalClass}${wideClass}${mandatoryClass}finding-container`}">
|
|
35
|
+
return html `
|
|
36
|
+
<div class="${`${additionalClass}${wideClass}${mandatoryClass}finding-container`}">
|
|
36
37
|
${blueprintField.repeatable
|
|
37
38
|
? this.renderRepeatableField(blueprintField, !!mandatoryClass)
|
|
38
|
-
: this.renderStandardField(blueprintField, !!mandatoryClass, isAdditionalField)}
|
|
39
|
-
</div>
|
|
39
|
+
: this.renderStandardField(blueprintField, !!mandatoryClass, isAdditionalField)}
|
|
40
|
+
</div>
|
|
40
41
|
`;
|
|
41
42
|
}
|
|
42
|
-
renderStandardField({ input_type, label, help_text, required, placeholder, styling, name }, isMandatory = false, isAdditionalField = false) {
|
|
43
|
+
renderStandardField({ input_type, label, help_text, required, placeholder, styling, name, tooltip }, isMandatory = false, isAdditionalField = false) {
|
|
43
44
|
var _a, _b, _c, _d, _e;
|
|
44
45
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
45
46
|
switch (input_type) {
|
|
46
47
|
case FieldTypes.TEXT_TYPE:
|
|
47
|
-
return html `
|
|
48
|
-
<text-field
|
|
49
|
-
class="${isWide ? 'wide' : ''}"
|
|
50
|
-
?is-readonly="${this.readonly}"
|
|
51
|
-
?required="${required}"
|
|
52
|
-
.placeholder="${placeholder}"
|
|
53
|
-
.name="${name}"
|
|
54
|
-
.value="${this.value}"
|
|
55
|
-
.validators="${this.validations}"
|
|
56
|
-
.errorMessage="${this.errorMessage}"
|
|
57
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
58
|
-
.showRichEditor="${isAdditionalField}"
|
|
59
|
-
>
|
|
60
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
61
|
-
</text-field>
|
|
48
|
+
return html `
|
|
49
|
+
<text-field
|
|
50
|
+
class="${isWide ? 'wide' : ''}"
|
|
51
|
+
?is-readonly="${this.readonly}"
|
|
52
|
+
?required="${required}"
|
|
53
|
+
.placeholder="${placeholder}"
|
|
54
|
+
.name="${name}"
|
|
55
|
+
.value="${this.value}"
|
|
56
|
+
.validators="${this.validations}"
|
|
57
|
+
.errorMessage="${this.errorMessage}"
|
|
58
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
59
|
+
.showRichEditor="${isAdditionalField}"
|
|
60
|
+
>
|
|
61
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
62
|
+
</text-field>
|
|
62
63
|
`;
|
|
63
64
|
case FieldTypes.NUMBER_TYPE:
|
|
64
65
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
65
66
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
66
|
-
return html `
|
|
67
|
-
<number-field
|
|
68
|
-
?is-readonly="${this.readonly}"
|
|
69
|
-
?required="${required}"
|
|
70
|
-
.placeholder="${placeholder}"
|
|
71
|
-
.value="${this.value}"
|
|
72
|
-
.name="${name}"
|
|
73
|
-
.validators="${this.validations}"
|
|
74
|
-
.errorMessage="${this.errorMessage}"
|
|
75
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
76
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
77
|
-
>
|
|
78
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
79
|
-
</number-field>
|
|
67
|
+
return html `
|
|
68
|
+
<number-field
|
|
69
|
+
?is-readonly="${this.readonly}"
|
|
70
|
+
?required="${required}"
|
|
71
|
+
.placeholder="${placeholder}"
|
|
72
|
+
.value="${this.value}"
|
|
73
|
+
.name="${name}"
|
|
74
|
+
.validators="${this.validations}"
|
|
75
|
+
.errorMessage="${this.errorMessage}"
|
|
76
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
77
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
78
|
+
>
|
|
79
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
80
|
+
</number-field>
|
|
80
81
|
`;
|
|
81
82
|
case FieldTypes.BOOL_TYPE:
|
|
82
|
-
return html `
|
|
83
|
-
<boolean-field
|
|
84
|
-
?is-readonly="${this.readonly}"
|
|
85
|
-
?required="${required}"
|
|
86
|
-
.value="${this.value}"
|
|
87
|
-
.name="${name}"
|
|
88
|
-
.validators="${this.validations}"
|
|
89
|
-
.errorMessage="${this.errorMessage}"
|
|
90
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
91
|
-
>
|
|
92
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
93
|
-
</boolean-field>
|
|
83
|
+
return html `
|
|
84
|
+
<boolean-field
|
|
85
|
+
?is-readonly="${this.readonly}"
|
|
86
|
+
?required="${required}"
|
|
87
|
+
.value="${this.value}"
|
|
88
|
+
.name="${name}"
|
|
89
|
+
.validators="${this.validations}"
|
|
90
|
+
.errorMessage="${this.errorMessage}"
|
|
91
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
92
|
+
>
|
|
93
|
+
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
94
|
+
</boolean-field>
|
|
94
95
|
`;
|
|
95
96
|
case FieldTypes.SCALE_TYPE:
|
|
96
|
-
return html `
|
|
97
|
-
<scale-field
|
|
98
|
-
.options="${this.options}"
|
|
99
|
-
?is-readonly="${this.readonly}"
|
|
100
|
-
?required="${required}"
|
|
101
|
-
.placeholder="${placeholder}"
|
|
102
|
-
.value="${this.value}"
|
|
103
|
-
.name="${name}"
|
|
104
|
-
.validators="${this.validations}"
|
|
105
|
-
.errorMessage="${this.errorMessage}"
|
|
106
|
-
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
107
|
-
>
|
|
108
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
109
|
-
</scale-field>
|
|
97
|
+
return html `
|
|
98
|
+
<scale-field
|
|
99
|
+
.options="${this.options}"
|
|
100
|
+
?is-readonly="${this.readonly}"
|
|
101
|
+
?required="${required}"
|
|
102
|
+
.placeholder="${placeholder}"
|
|
103
|
+
.value="${this.value}"
|
|
104
|
+
.name="${name}"
|
|
105
|
+
.validators="${this.validations}"
|
|
106
|
+
.errorMessage="${this.errorMessage}"
|
|
107
|
+
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
108
|
+
>
|
|
109
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
110
|
+
</scale-field>
|
|
110
111
|
`;
|
|
111
112
|
case FieldTypes.MULTIPLE_CHOICE_TYPE:
|
|
112
|
-
return html `
|
|
113
|
-
<choice-field
|
|
114
|
-
.options="${this.options}"
|
|
115
|
-
?is-readonly="${this.readonly}"
|
|
116
|
-
?required="${required}"
|
|
117
|
-
.placeholder="${placeholder}"
|
|
118
|
-
.value="${this.value}"
|
|
119
|
-
.name="${name}"
|
|
120
|
-
.validators="${this.validations}"
|
|
121
|
-
.errorMessage="${this.errorMessage}"
|
|
122
|
-
.defaultValue="${(_e = this.field) === null || _e === void 0 ? void 0 : _e.default_value}"
|
|
123
|
-
>
|
|
124
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
125
|
-
</choice-field>
|
|
113
|
+
return html `
|
|
114
|
+
<choice-field
|
|
115
|
+
.options="${this.options}"
|
|
116
|
+
?is-readonly="${this.readonly}"
|
|
117
|
+
?required="${required}"
|
|
118
|
+
.placeholder="${placeholder}"
|
|
119
|
+
.value="${this.value}"
|
|
120
|
+
.name="${name}"
|
|
121
|
+
.validators="${this.validations}"
|
|
122
|
+
.errorMessage="${this.errorMessage}"
|
|
123
|
+
.defaultValue="${(_e = this.field) === null || _e === void 0 ? void 0 : _e.default_value}"
|
|
124
|
+
>
|
|
125
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
126
|
+
</choice-field>
|
|
126
127
|
`;
|
|
127
128
|
case FieldTypes.FILE_TYPE:
|
|
128
|
-
return html `
|
|
129
|
-
<attachments-field
|
|
130
|
-
?is-readonly="${this.readonly}"
|
|
131
|
-
?required="${required}"
|
|
132
|
-
.placeholder="${placeholder}"
|
|
133
|
-
.value="${this.value}"
|
|
134
|
-
.name="${name}"
|
|
135
|
-
.validators="${this.validations}"
|
|
136
|
-
.errorMessage="${this.errorMessage}"
|
|
137
|
-
.computedPath="${this.computedPath}"
|
|
138
|
-
>
|
|
139
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
140
|
-
</attachments-field>
|
|
129
|
+
return html `
|
|
130
|
+
<attachments-field
|
|
131
|
+
?is-readonly="${this.readonly}"
|
|
132
|
+
?required="${required}"
|
|
133
|
+
.placeholder="${placeholder}"
|
|
134
|
+
.value="${this.value}"
|
|
135
|
+
.name="${name}"
|
|
136
|
+
.validators="${this.validations}"
|
|
137
|
+
.errorMessage="${this.errorMessage}"
|
|
138
|
+
.computedPath="${this.computedPath}"
|
|
139
|
+
>
|
|
140
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
141
|
+
</attachments-field>
|
|
141
142
|
`;
|
|
142
143
|
default:
|
|
143
144
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
@@ -146,105 +147,115 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
146
147
|
}
|
|
147
148
|
renderTooltip(isMandatory) {
|
|
148
149
|
return isMandatory
|
|
149
|
-
? html ` <sl-tooltip placement="top" content="${getTranslation(this.language, 'PLEASE_ANSWER')}">
|
|
150
|
-
<etools-icon id="users-icon" name="info-outline"></etools-icon>
|
|
150
|
+
? html ` <sl-tooltip placement="top" content="${getTranslation(this.language, 'PLEASE_ANSWER')}">
|
|
151
|
+
<etools-icon id="users-icon" name="info-outline"></etools-icon>
|
|
151
152
|
</sl-tooltip>`
|
|
152
153
|
: ``;
|
|
153
154
|
}
|
|
154
|
-
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling }, isMandatory = false) {
|
|
155
|
+
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling, tooltip }, isMandatory = false) {
|
|
155
156
|
var _a, _b, _c, _d;
|
|
156
157
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
157
158
|
switch (input_type) {
|
|
158
159
|
case FieldTypes.TEXT_TYPE:
|
|
159
|
-
return html `
|
|
160
|
-
<repeatable-text-field
|
|
161
|
-
class="${isWide ? 'wide' : ''}"
|
|
162
|
-
?is-readonly="${this.readonly}"
|
|
163
|
-
?required="${required}"
|
|
164
|
-
.placeholder="${placeholder}"
|
|
165
|
-
.value="${this.value}"
|
|
166
|
-
.validators="${this.validations}"
|
|
167
|
-
.errorMessage="${this.errorMessage}"
|
|
168
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
169
|
-
>
|
|
170
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
171
|
-
</repeatable-text-field>
|
|
160
|
+
return html `
|
|
161
|
+
<repeatable-text-field
|
|
162
|
+
class="${isWide ? 'wide' : ''}"
|
|
163
|
+
?is-readonly="${this.readonly}"
|
|
164
|
+
?required="${required}"
|
|
165
|
+
.placeholder="${placeholder}"
|
|
166
|
+
.value="${this.value}"
|
|
167
|
+
.validators="${this.validations}"
|
|
168
|
+
.errorMessage="${this.errorMessage}"
|
|
169
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
170
|
+
>
|
|
171
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
172
|
+
</repeatable-text-field>
|
|
172
173
|
`;
|
|
173
174
|
case FieldTypes.NUMBER_TYPE:
|
|
174
175
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
175
176
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
176
|
-
return html `
|
|
177
|
-
<repeatable-number-field
|
|
178
|
-
class="${isWide ? 'wide' : ''}"
|
|
179
|
-
?is-readonly="${this.readonly}"
|
|
180
|
-
?required="${required}"
|
|
181
|
-
.placeholder="${placeholder}"
|
|
182
|
-
.value="${this.value}"
|
|
183
|
-
.validators="${this.validations}"
|
|
184
|
-
.errorMessage="${this.errorMessage}"
|
|
185
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
186
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
187
|
-
>
|
|
188
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
189
|
-
</repeatable-number-field>
|
|
177
|
+
return html `
|
|
178
|
+
<repeatable-number-field
|
|
179
|
+
class="${isWide ? 'wide' : ''}"
|
|
180
|
+
?is-readonly="${this.readonly}"
|
|
181
|
+
?required="${required}"
|
|
182
|
+
.placeholder="${placeholder}"
|
|
183
|
+
.value="${this.value}"
|
|
184
|
+
.validators="${this.validations}"
|
|
185
|
+
.errorMessage="${this.errorMessage}"
|
|
186
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
187
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
188
|
+
>
|
|
189
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
190
|
+
</repeatable-number-field>
|
|
190
191
|
`;
|
|
191
192
|
case FieldTypes.SCALE_TYPE:
|
|
192
|
-
return html `
|
|
193
|
-
<repeatable-scale-field
|
|
194
|
-
class="${isWide ? 'wide' : ''}"
|
|
195
|
-
.options="${this.options}"
|
|
196
|
-
?is-readonly="${this.readonly}"
|
|
197
|
-
?required="${required}"
|
|
198
|
-
.placeholder="${placeholder}"
|
|
199
|
-
.value="${this.value}"
|
|
200
|
-
.validators="${this.validations}"
|
|
201
|
-
.errorMessage="${this.errorMessage}"
|
|
202
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
203
|
-
>
|
|
204
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
205
|
-
</repeatable-scale-field>
|
|
193
|
+
return html `
|
|
194
|
+
<repeatable-scale-field
|
|
195
|
+
class="${isWide ? 'wide' : ''}"
|
|
196
|
+
.options="${this.options}"
|
|
197
|
+
?is-readonly="${this.readonly}"
|
|
198
|
+
?required="${required}"
|
|
199
|
+
.placeholder="${placeholder}"
|
|
200
|
+
.value="${this.value}"
|
|
201
|
+
.validators="${this.validations}"
|
|
202
|
+
.errorMessage="${this.errorMessage}"
|
|
203
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
204
|
+
>
|
|
205
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
206
|
+
</repeatable-scale-field>
|
|
206
207
|
`;
|
|
207
208
|
case FieldTypes.MULTIPLE_CHOICE_TYPE:
|
|
208
|
-
return html `
|
|
209
|
-
<repeatable-choice-field
|
|
210
|
-
class="${isWide ? 'wide' : ''}"
|
|
211
|
-
.options="${this.options}"
|
|
212
|
-
?is-readonly="${this.readonly}"
|
|
213
|
-
?required="${required}"
|
|
214
|
-
.placeholder="${placeholder}"
|
|
215
|
-
.value="${this.value}"
|
|
216
|
-
.validators="${this.validations}"
|
|
217
|
-
.errorMessage="${this.errorMessage}"
|
|
218
|
-
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
219
|
-
>
|
|
220
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
221
|
-
</repeatable-choice-field>
|
|
209
|
+
return html `
|
|
210
|
+
<repeatable-choice-field
|
|
211
|
+
class="${isWide ? 'wide' : ''}"
|
|
212
|
+
.options="${this.options}"
|
|
213
|
+
?is-readonly="${this.readonly}"
|
|
214
|
+
?required="${required}"
|
|
215
|
+
.placeholder="${placeholder}"
|
|
216
|
+
.value="${this.value}"
|
|
217
|
+
.validators="${this.validations}"
|
|
218
|
+
.errorMessage="${this.errorMessage}"
|
|
219
|
+
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
220
|
+
>
|
|
221
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
222
|
+
</repeatable-choice-field>
|
|
222
223
|
`;
|
|
223
224
|
case FieldTypes.FILE_TYPE:
|
|
224
|
-
return html `
|
|
225
|
-
<repeatable-attachments-field
|
|
226
|
-
?is-readonly="${this.readonly}"
|
|
227
|
-
?required="${required}"
|
|
228
|
-
.placeholder="${placeholder}"
|
|
229
|
-
.value="${this.value}"
|
|
230
|
-
.validators="${this.validations}"
|
|
231
|
-
.errorMessage="${this.errorMessage}"
|
|
232
|
-
.computedPath="${this.computedPath}"
|
|
233
|
-
>
|
|
234
|
-
${this.renderFieldLabel(label, help_text, isMandatory)}
|
|
235
|
-
</repeatable-attachments-field>
|
|
225
|
+
return html `
|
|
226
|
+
<repeatable-attachments-field
|
|
227
|
+
?is-readonly="${this.readonly}"
|
|
228
|
+
?required="${required}"
|
|
229
|
+
.placeholder="${placeholder}"
|
|
230
|
+
.value="${this.value}"
|
|
231
|
+
.validators="${this.validations}"
|
|
232
|
+
.errorMessage="${this.errorMessage}"
|
|
233
|
+
.computedPath="${this.computedPath}"
|
|
234
|
+
>
|
|
235
|
+
${this.renderFieldLabel(label, help_text, isMandatory, tooltip)}
|
|
236
|
+
</repeatable-attachments-field>
|
|
236
237
|
`;
|
|
237
238
|
default:
|
|
238
239
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
239
240
|
return html ``;
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
|
-
renderFieldLabel(label, helperText, isMandatory = false) {
|
|
243
|
-
return html `
|
|
244
|
-
<div class="layout vertical question-container">
|
|
245
|
-
<div class="question-text"
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
renderFieldLabel(label, helperText, isMandatory = false, tooltip) {
|
|
244
|
+
return html `
|
|
245
|
+
<div class="layout vertical question-container">
|
|
246
|
+
<div class="question-text">
|
|
247
|
+
${this.renderTooltip(isMandatory)}
|
|
248
|
+
${tooltip
|
|
249
|
+
? html `
|
|
250
|
+
<etools-info-tooltip hoist to="body" class="question-tooltip">
|
|
251
|
+
<span slot="field">${label}</span>
|
|
252
|
+
<span slot="message">${tooltip}</span>
|
|
253
|
+
</etools-info-tooltip>
|
|
254
|
+
`
|
|
255
|
+
: html `${label}`}
|
|
256
|
+
</div>
|
|
257
|
+
<div class="question-details">${helperText}</div>
|
|
258
|
+
</div>
|
|
248
259
|
`;
|
|
249
260
|
}
|
|
250
261
|
static get styles() {
|
|
@@ -252,38 +263,41 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
252
263
|
return [
|
|
253
264
|
FlexLayoutClasses,
|
|
254
265
|
FormBuilderCardStyles,
|
|
255
|
-
css `
|
|
256
|
-
.additional-field {
|
|
257
|
-
padding-top: 15px;
|
|
258
|
-
padding-bottom: 20px;
|
|
259
|
-
}
|
|
260
|
-
.wide-field-container {
|
|
261
|
-
padding-bottom: 10px;
|
|
262
|
-
}
|
|
263
|
-
.wide-field-container .question-container {
|
|
264
|
-
min-height: 0;
|
|
265
|
-
padding: 7px 0 0;
|
|
266
|
-
}
|
|
267
|
-
.wide-field-container .question-text {
|
|
268
|
-
color: var(--secondary-text-color);
|
|
269
|
-
font-weight: 600;
|
|
270
|
-
}
|
|
271
|
-
.mandatory_warning etools-icon {
|
|
272
|
-
--etools-icon-fill-color: #f59e0b !important;
|
|
273
|
-
}
|
|
274
|
-
:host(:not([readonly])) {
|
|
275
|
-
.overall {
|
|
276
|
-
background-color: #ffffff;
|
|
277
|
-
border-style: inset;
|
|
278
|
-
border-width: 0 1px 1px 1px;
|
|
279
|
-
border-color: var(--dark-divider-color);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
266
|
+
css `
|
|
267
|
+
.additional-field {
|
|
268
|
+
padding-top: 15px;
|
|
269
|
+
padding-bottom: 20px;
|
|
270
|
+
}
|
|
271
|
+
.wide-field-container {
|
|
272
|
+
padding-bottom: 10px;
|
|
273
|
+
}
|
|
274
|
+
.wide-field-container .question-container {
|
|
275
|
+
min-height: 0;
|
|
276
|
+
padding: 7px 0 0;
|
|
277
|
+
}
|
|
278
|
+
.wide-field-container .question-text {
|
|
279
|
+
color: var(--secondary-text-color);
|
|
280
|
+
font-weight: 600;
|
|
281
|
+
}
|
|
282
|
+
.mandatory_warning etools-icon {
|
|
283
|
+
--etools-icon-fill-color: #f59e0b !important;
|
|
284
|
+
}
|
|
285
|
+
:host(:not([readonly])) {
|
|
286
|
+
.overall {
|
|
287
|
+
background-color: #ffffff;
|
|
288
|
+
border-style: inset;
|
|
289
|
+
border-width: 0 1px 1px 1px;
|
|
290
|
+
border-color: var(--dark-divider-color);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
.question-tooltip {
|
|
294
|
+
align-items: start;
|
|
295
|
+
}
|
|
296
|
+
@media print {
|
|
297
|
+
:host {
|
|
298
|
+
break-inside: avoid;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
287
301
|
`
|
|
288
302
|
];
|
|
289
303
|
}
|