@unicef-polymer/etools-form-builder 2.1.9 → 3.0.0-rc.10
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.d.ts +0 -0
- package/dist/assets/translations.js +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +10 -12
- package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.helper.js +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +70 -76
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +5 -1
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +92 -81
- package/dist/form-attachments-popup/index.d.ts +0 -0
- package/dist/form-attachments-popup/index.js +0 -0
- package/dist/form-fields/abstract-field-base.class.d.ts +1 -1
- package/dist/form-fields/abstract-field-base.class.js +131 -135
- package/dist/form-fields/field-renderer-component.d.ts +1 -1
- package/dist/form-fields/field-renderer-component.js +150 -154
- package/dist/form-fields/index.d.ts +0 -0
- package/dist/form-fields/index.js +0 -0
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +4 -2
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +117 -117
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +2 -1
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +26 -29
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +2 -2
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +24 -28
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +5 -5
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +68 -72
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +2 -2
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +27 -31
- package/dist/form-fields/single-fields/attachment-field.d.ts +2 -2
- package/dist/form-fields/single-fields/attachment-field.js +17 -21
- package/dist/form-fields/single-fields/base-field.d.ts +1 -1
- package/dist/form-fields/single-fields/base-field.js +2 -7
- package/dist/form-fields/single-fields/boolean-field.d.ts +2 -2
- package/dist/form-fields/single-fields/boolean-field.js +24 -28
- package/dist/form-fields/single-fields/number-field.d.ts +2 -2
- package/dist/form-fields/single-fields/number-field.js +25 -29
- package/dist/form-fields/single-fields/scale-field.d.ts +6 -6
- package/dist/form-fields/single-fields/scale-field.js +69 -70
- package/dist/form-fields/single-fields/text-field.d.ts +2 -2
- package/dist/form-fields/single-fields/text-field.js +28 -33
- package/dist/form-groups/form-abstract-group.d.ts +3 -2
- package/dist/form-groups/form-abstract-group.js +147 -144
- package/dist/form-groups/form-card.d.ts +5 -2
- package/dist/form-groups/form-card.js +39 -32
- package/dist/form-groups/form-collapsed-card.d.ts +4 -4
- package/dist/form-groups/form-collapsed-card.js +60 -54
- package/dist/form-groups/index.d.ts +0 -0
- package/dist/form-groups/index.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/lib/additional-components/confirmation-dialog.d.ts +1 -1
- package/dist/lib/additional-components/confirmation-dialog.js +29 -33
- package/dist/lib/additional-components/etools-fb-card.d.ts +2 -2
- package/dist/lib/additional-components/etools-fb-card.js +147 -156
- package/dist/lib/styles/attachments.styles.d.ts +1 -1
- package/dist/lib/styles/attachments.styles.js +67 -70
- package/dist/lib/styles/card-styles.d.ts +1 -1
- package/dist/lib/styles/card-styles.js +152 -152
- package/dist/lib/styles/dialog.styles.d.ts +1 -1
- package/dist/lib/styles/dialog.styles.js +84 -83
- package/dist/lib/styles/elevation-styles.d.ts +1 -1
- package/dist/lib/styles/elevation-styles.js +34 -34
- package/dist/lib/styles/flex-layout-classes.d.ts +1 -1
- package/dist/lib/styles/flex-layout-classes.js +317 -317
- package/dist/lib/styles/form-builder-card.styles.d.ts +1 -1
- package/dist/lib/styles/form-builder-card.styles.js +47 -47
- package/dist/lib/styles/input-styles.d.ts +1 -1
- package/dist/lib/styles/input-styles.js +141 -136
- package/dist/lib/styles/page-layout-styles.d.ts +1 -1
- package/dist/lib/styles/page-layout-styles.js +199 -199
- package/dist/lib/styles/shared-styles.d.ts +1 -1
- package/dist/lib/styles/shared-styles.js +68 -68
- package/dist/lib/types/form-builder.interfaces.d.ts +2 -1
- package/dist/lib/types/form-builder.interfaces.js +1 -0
- package/dist/lib/types/form-builder.types.d.ts +7 -7
- package/dist/lib/types/form-builder.types.js +1 -0
- package/dist/lib/types/global.types.d.ts +2 -2
- package/dist/lib/types/global.types.js +1 -0
- package/dist/lib/utils/dialog.d.ts +0 -0
- package/dist/lib/utils/dialog.js +0 -0
- package/dist/lib/utils/fire-custom-event.d.ts +0 -0
- package/dist/lib/utils/fire-custom-event.js +0 -0
- package/dist/lib/utils/translate.d.ts +0 -0
- package/dist/lib/utils/translate.js +0 -0
- package/dist/lib/utils/validations.helper.d.ts +5 -5
- package/dist/lib/utils/validations.helper.js +0 -0
- package/package.json +55 -56
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, property, css, html } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
8
4
|
import { validate } from '../lib/utils/validations.helper';
|
|
9
5
|
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
10
6
|
/**
|
|
11
7
|
* Class that contains common properties and methods for single and repeatable fields
|
|
12
8
|
*/
|
|
13
9
|
export class AbstractFieldBaseClass extends LitElement {
|
|
10
|
+
set isReadonly(readonly) {
|
|
11
|
+
this._readonly = readonly;
|
|
12
|
+
this.setDefaultValue(readonly, this._defaultValue);
|
|
13
|
+
this.requestUpdate();
|
|
14
|
+
}
|
|
15
|
+
get isReadonly() {
|
|
16
|
+
return this._readonly;
|
|
17
|
+
}
|
|
18
|
+
set defaultValue(value) {
|
|
19
|
+
this._defaultValue = value;
|
|
20
|
+
this.setDefaultValue(this._readonly, value);
|
|
21
|
+
this.requestUpdate();
|
|
22
|
+
}
|
|
14
23
|
constructor() {
|
|
15
24
|
super();
|
|
16
25
|
this.questionText = '';
|
|
@@ -25,19 +34,6 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
25
34
|
}
|
|
26
35
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
27
36
|
}
|
|
28
|
-
set isReadonly(readonly) {
|
|
29
|
-
this._readonly = readonly;
|
|
30
|
-
this.setDefaultValue(readonly, this._defaultValue);
|
|
31
|
-
this.requestUpdate();
|
|
32
|
-
}
|
|
33
|
-
get isReadonly() {
|
|
34
|
-
return this._readonly;
|
|
35
|
-
}
|
|
36
|
-
set defaultValue(value) {
|
|
37
|
-
this._defaultValue = value;
|
|
38
|
-
this.setDefaultValue(this._readonly, value);
|
|
39
|
-
this.requestUpdate();
|
|
40
|
-
}
|
|
41
37
|
connectedCallback() {
|
|
42
38
|
super.connectedCallback();
|
|
43
39
|
document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
@@ -50,11 +46,11 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
50
46
|
this.language = e.detail.language;
|
|
51
47
|
}
|
|
52
48
|
render() {
|
|
53
|
-
return html `
|
|
54
|
-
<div class="finding-container">
|
|
55
|
-
<div class="question"><slot>${this.questionTemplate()}</slot></div>
|
|
56
|
-
<div class="question-control">${this.controlTemplate()}</div>
|
|
57
|
-
</div>
|
|
49
|
+
return html `
|
|
50
|
+
<div class="finding-container">
|
|
51
|
+
<div class="question"><slot>${this.questionTemplate()}</slot></div>
|
|
52
|
+
<div class="question-control">${this.controlTemplate()}</div>
|
|
53
|
+
</div>
|
|
58
54
|
`;
|
|
59
55
|
}
|
|
60
56
|
questionTemplate() {
|
|
@@ -79,116 +75,116 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
79
75
|
// language=CSS
|
|
80
76
|
return [
|
|
81
77
|
FlexLayoutClasses,
|
|
82
|
-
css `
|
|
83
|
-
:host {
|
|
84
|
-
display: block;
|
|
85
|
-
width: 100%;
|
|
86
|
-
padding: 0 25px 0 45px;
|
|
87
|
-
box-sizing: border-box;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.finding-container {
|
|
91
|
-
width: 100%;
|
|
92
|
-
display: flex;
|
|
93
|
-
}
|
|
94
|
-
.flex-wrapping {
|
|
95
|
-
flex-wrap: wrap;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
:host(.wide) .finding-container {
|
|
99
|
-
flex-direction: column;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
:host(.wide) .question {
|
|
103
|
-
margin-bottom: -8px;
|
|
104
|
-
min-height: 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.question-control,
|
|
108
|
-
.question {
|
|
109
|
-
min-width: 0;
|
|
110
|
-
min-height: 57px;
|
|
111
|
-
display: flex;
|
|
112
|
-
align-items: center;
|
|
113
|
-
}
|
|
114
|
-
.question {
|
|
115
|
-
flex: 2;
|
|
116
|
-
}
|
|
117
|
-
.question-control {
|
|
118
|
-
flex: 3;
|
|
119
|
-
}
|
|
120
|
-
.add-button {
|
|
121
|
-
padding: 3px;
|
|
122
|
-
margin: 10px;
|
|
123
|
-
background: transparent;
|
|
124
|
-
color: var(--primary-color);
|
|
125
|
-
border: 1px solid;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.full-width,
|
|
129
|
-
paper-input,
|
|
130
|
-
paper-textarea {
|
|
131
|
-
width: 100%;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.question-text {
|
|
135
|
-
font-weight: 500;
|
|
136
|
-
font-size: 13px;
|
|
137
|
-
color: var(--primary-text-color);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
paper-input,
|
|
141
|
-
paper-textarea {
|
|
142
|
-
outline: none !important;
|
|
143
|
-
}
|
|
144
|
-
paper-input[required],
|
|
145
|
-
paper-textarea[required] {
|
|
146
|
-
--paper-input-container-label_-_background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%221235%22%20height%3D%221175%22%3E%3Cpath%20fill%3D%22%23de0000%22%20d%3D%22M0%2C449h1235l-999%2C726%20382-1175%20382%2C1175z%22%2F%3E%3C%2Fsvg%3E')
|
|
147
|
-
no-repeat 98% 14%/7px;
|
|
148
|
-
--paper-input-container-label_-_max-width: max-content;
|
|
149
|
-
--paper-input-container-label_-_padding-right: 15px;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
iron-icon[icon='close'] {
|
|
153
|
-
cursor: pointer;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.error-text {
|
|
157
|
-
color: var(--error-color);
|
|
158
|
-
font-size: 12px;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@media (max-width: 1080px) {
|
|
162
|
-
:host {
|
|
163
|
-
padding: 0 15px;
|
|
164
|
-
}
|
|
165
|
-
.finding-container {
|
|
166
|
-
flex-direction: column;
|
|
167
|
-
}
|
|
168
|
-
.question,
|
|
169
|
-
.question-control {
|
|
170
|
-
flex: 0 1 auto;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@media print {
|
|
175
|
-
.question-control {
|
|
176
|
-
align-items: start;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
:host(text-field) .question-control {
|
|
180
|
-
min-height: 150px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.question-control .container paper-radio-group {
|
|
184
|
-
flex-direction: column;
|
|
185
|
-
opacity: 1 !important;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.finding-container {
|
|
189
|
-
flex-direction: column;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
78
|
+
css `
|
|
79
|
+
:host {
|
|
80
|
+
display: block;
|
|
81
|
+
width: 100%;
|
|
82
|
+
padding: 0 25px 0 45px;
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.finding-container {
|
|
87
|
+
width: 100%;
|
|
88
|
+
display: flex;
|
|
89
|
+
}
|
|
90
|
+
.flex-wrapping {
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host(.wide) .finding-container {
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host(.wide) .question {
|
|
99
|
+
margin-bottom: -8px;
|
|
100
|
+
min-height: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.question-control,
|
|
104
|
+
.question {
|
|
105
|
+
min-width: 0;
|
|
106
|
+
min-height: 57px;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
}
|
|
110
|
+
.question {
|
|
111
|
+
flex: 2;
|
|
112
|
+
}
|
|
113
|
+
.question-control {
|
|
114
|
+
flex: 3;
|
|
115
|
+
}
|
|
116
|
+
.add-button {
|
|
117
|
+
padding: 3px;
|
|
118
|
+
margin: 10px;
|
|
119
|
+
background: transparent;
|
|
120
|
+
color: var(--primary-color);
|
|
121
|
+
border: 1px solid;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.full-width,
|
|
125
|
+
paper-input,
|
|
126
|
+
paper-textarea {
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.question-text {
|
|
131
|
+
font-weight: 500;
|
|
132
|
+
font-size: 13px;
|
|
133
|
+
color: var(--primary-text-color);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
paper-input,
|
|
137
|
+
paper-textarea {
|
|
138
|
+
outline: none !important;
|
|
139
|
+
}
|
|
140
|
+
paper-input[required],
|
|
141
|
+
paper-textarea[required] {
|
|
142
|
+
--paper-input-container-label_-_background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%221235%22%20height%3D%221175%22%3E%3Cpath%20fill%3D%22%23de0000%22%20d%3D%22M0%2C449h1235l-999%2C726%20382-1175%20382%2C1175z%22%2F%3E%3C%2Fsvg%3E')
|
|
143
|
+
no-repeat 98% 14%/7px;
|
|
144
|
+
--paper-input-container-label_-_max-width: max-content;
|
|
145
|
+
--paper-input-container-label_-_padding-right: 15px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
iron-icon[icon='close'] {
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.error-text {
|
|
153
|
+
color: var(--error-color);
|
|
154
|
+
font-size: 12px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@media (max-width: 1080px) {
|
|
158
|
+
:host {
|
|
159
|
+
padding: 0 15px;
|
|
160
|
+
}
|
|
161
|
+
.finding-container {
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
}
|
|
164
|
+
.question,
|
|
165
|
+
.question-control {
|
|
166
|
+
flex: 0 1 auto;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media print {
|
|
171
|
+
.question-control {
|
|
172
|
+
align-items: start;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host(text-field) .question-control {
|
|
176
|
+
min-height: 150px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.question-control .container paper-radio-group {
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
opacity: 1 !important;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.finding-container {
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
192
188
|
`
|
|
193
189
|
];
|
|
194
190
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import { BlueprintField } from '../lib/types/form-builder.types';
|
|
3
3
|
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
4
4
|
import { FieldOption } from './single-fields/scale-field';
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, customElement, html, LitElement, property } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
8
4
|
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
9
5
|
import { FieldTypes, StructureTypes } from '../form-groups';
|
|
10
6
|
import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
|
|
@@ -28,12 +24,12 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
28
24
|
? 'additional-field '
|
|
29
25
|
: '';
|
|
30
26
|
const wideClass = blueprintField.styling.includes(StructureTypes.WIDE) ? 'wide-field-container ' : '';
|
|
31
|
-
return html `
|
|
32
|
-
<div class="${`${additionalClass}${wideClass}finding-container`}">
|
|
27
|
+
return html `
|
|
28
|
+
<div class="${`${additionalClass}${wideClass}finding-container`}">
|
|
33
29
|
${blueprintField.repeatable
|
|
34
30
|
? this.renderRepeatableField(blueprintField)
|
|
35
|
-
: this.renderStandardField(blueprintField)}
|
|
36
|
-
</div>
|
|
31
|
+
: this.renderStandardField(blueprintField)}
|
|
32
|
+
</div>
|
|
37
33
|
`;
|
|
38
34
|
}
|
|
39
35
|
renderStandardField({ input_type, label, help_text, required, placeholder, styling }) {
|
|
@@ -41,78 +37,78 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
41
37
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
42
38
|
switch (input_type) {
|
|
43
39
|
case FieldTypes.TEXT_TYPE:
|
|
44
|
-
return html `
|
|
45
|
-
<text-field
|
|
46
|
-
class="${isWide ? 'wide' : ''}"
|
|
47
|
-
?is-readonly="${this.readonly}"
|
|
48
|
-
?required="${required}"
|
|
49
|
-
.placeholder="${placeholder}"
|
|
50
|
-
.value="${this.value}"
|
|
51
|
-
.validators="${this.validations}"
|
|
52
|
-
.errorMessage="${this.errorMessage}"
|
|
53
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
54
|
-
>
|
|
55
|
-
${this.renderFieldLabel(label, help_text)}
|
|
56
|
-
</text-field>
|
|
40
|
+
return html `
|
|
41
|
+
<text-field
|
|
42
|
+
class="${isWide ? 'wide' : ''}"
|
|
43
|
+
?is-readonly="${this.readonly}"
|
|
44
|
+
?required="${required}"
|
|
45
|
+
.placeholder="${placeholder}"
|
|
46
|
+
.value="${this.value}"
|
|
47
|
+
.validators="${this.validations}"
|
|
48
|
+
.errorMessage="${this.errorMessage}"
|
|
49
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
50
|
+
>
|
|
51
|
+
${this.renderFieldLabel(label, help_text)}
|
|
52
|
+
</text-field>
|
|
57
53
|
`;
|
|
58
54
|
case FieldTypes.NUMBER_TYPE:
|
|
59
55
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
60
56
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
61
|
-
return html `
|
|
62
|
-
<number-field
|
|
63
|
-
?is-readonly="${this.readonly}"
|
|
64
|
-
?required="${required}"
|
|
65
|
-
.placeholder="${placeholder}"
|
|
66
|
-
.value="${this.value}"
|
|
67
|
-
.validators="${this.validations}"
|
|
68
|
-
.errorMessage="${this.errorMessage}"
|
|
69
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
70
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
71
|
-
>
|
|
72
|
-
${this.renderFieldLabel(label, help_text)}
|
|
73
|
-
</number-field>
|
|
57
|
+
return html `
|
|
58
|
+
<number-field
|
|
59
|
+
?is-readonly="${this.readonly}"
|
|
60
|
+
?required="${required}"
|
|
61
|
+
.placeholder="${placeholder}"
|
|
62
|
+
.value="${this.value}"
|
|
63
|
+
.validators="${this.validations}"
|
|
64
|
+
.errorMessage="${this.errorMessage}"
|
|
65
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
66
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
67
|
+
>
|
|
68
|
+
${this.renderFieldLabel(label, help_text)}
|
|
69
|
+
</number-field>
|
|
74
70
|
`;
|
|
75
71
|
case FieldTypes.BOOL_TYPE:
|
|
76
|
-
return html `
|
|
77
|
-
<boolean-field
|
|
78
|
-
?is-readonly="${this.readonly}"
|
|
79
|
-
?required="${required}"
|
|
80
|
-
.value="${this.value}"
|
|
81
|
-
.validators="${this.validations}"
|
|
82
|
-
.errorMessage="${this.errorMessage}"
|
|
83
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
84
|
-
>
|
|
85
|
-
${this.renderFieldLabel(label, help_text)}
|
|
86
|
-
</boolean-field>
|
|
72
|
+
return html `
|
|
73
|
+
<boolean-field
|
|
74
|
+
?is-readonly="${this.readonly}"
|
|
75
|
+
?required="${required}"
|
|
76
|
+
.value="${this.value}"
|
|
77
|
+
.validators="${this.validations}"
|
|
78
|
+
.errorMessage="${this.errorMessage}"
|
|
79
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
80
|
+
>
|
|
81
|
+
${this.renderFieldLabel(label, help_text)}
|
|
82
|
+
</boolean-field>
|
|
87
83
|
`;
|
|
88
84
|
case FieldTypes.SCALE_TYPE:
|
|
89
|
-
return html `
|
|
90
|
-
<scale-field
|
|
91
|
-
.options="${this.options}"
|
|
92
|
-
?is-readonly="${this.readonly}"
|
|
93
|
-
?required="${required}"
|
|
94
|
-
.placeholder="${placeholder}"
|
|
95
|
-
.value="${this.value}"
|
|
96
|
-
.validators="${this.validations}"
|
|
97
|
-
.errorMessage="${this.errorMessage}"
|
|
98
|
-
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
99
|
-
>
|
|
100
|
-
${this.renderFieldLabel(label, help_text)}
|
|
101
|
-
</scale-field>
|
|
85
|
+
return html `
|
|
86
|
+
<scale-field
|
|
87
|
+
.options="${this.options}"
|
|
88
|
+
?is-readonly="${this.readonly}"
|
|
89
|
+
?required="${required}"
|
|
90
|
+
.placeholder="${placeholder}"
|
|
91
|
+
.value="${this.value}"
|
|
92
|
+
.validators="${this.validations}"
|
|
93
|
+
.errorMessage="${this.errorMessage}"
|
|
94
|
+
.defaultValue="${(_d = this.field) === null || _d === void 0 ? void 0 : _d.default_value}"
|
|
95
|
+
>
|
|
96
|
+
${this.renderFieldLabel(label, help_text)}
|
|
97
|
+
</scale-field>
|
|
102
98
|
`;
|
|
103
99
|
case FieldTypes.FILE_TYPE:
|
|
104
|
-
return html `
|
|
105
|
-
<attachments-field
|
|
106
|
-
?is-readonly="${this.readonly}"
|
|
107
|
-
?required="${required}"
|
|
108
|
-
.placeholder="${placeholder}"
|
|
109
|
-
.value="${this.value}"
|
|
110
|
-
.validators="${this.validations}"
|
|
111
|
-
.errorMessage="${this.errorMessage}"
|
|
112
|
-
.computedPath="${this.computedPath}"
|
|
113
|
-
>
|
|
114
|
-
${this.renderFieldLabel(label, help_text)}
|
|
115
|
-
</attachments-field>
|
|
100
|
+
return html `
|
|
101
|
+
<attachments-field
|
|
102
|
+
?is-readonly="${this.readonly}"
|
|
103
|
+
?required="${required}"
|
|
104
|
+
.placeholder="${placeholder}"
|
|
105
|
+
.value="${this.value}"
|
|
106
|
+
.validators="${this.validations}"
|
|
107
|
+
.errorMessage="${this.errorMessage}"
|
|
108
|
+
.computedPath="${this.computedPath}"
|
|
109
|
+
>
|
|
110
|
+
${this.renderFieldLabel(label, help_text)}
|
|
111
|
+
</attachments-field>
|
|
116
112
|
`;
|
|
117
113
|
default:
|
|
118
114
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
@@ -124,67 +120,67 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
124
120
|
const isWide = styling.includes(StructureTypes.WIDE);
|
|
125
121
|
switch (input_type) {
|
|
126
122
|
case FieldTypes.TEXT_TYPE:
|
|
127
|
-
return html `
|
|
128
|
-
<repeatable-text-field
|
|
129
|
-
class="${isWide ? 'wide' : ''}"
|
|
130
|
-
?is-readonly="${this.readonly}"
|
|
131
|
-
?required="${required}"
|
|
132
|
-
.placeholder="${placeholder}"
|
|
133
|
-
.value="${this.value}"
|
|
134
|
-
.validators="${this.validations}"
|
|
135
|
-
.errorMessage="${this.errorMessage}"
|
|
136
|
-
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
137
|
-
>
|
|
138
|
-
${this.renderFieldLabel(label, help_text)}
|
|
139
|
-
</repeatable-text-field>
|
|
123
|
+
return html `
|
|
124
|
+
<repeatable-text-field
|
|
125
|
+
class="${isWide ? 'wide' : ''}"
|
|
126
|
+
?is-readonly="${this.readonly}"
|
|
127
|
+
?required="${required}"
|
|
128
|
+
.placeholder="${placeholder}"
|
|
129
|
+
.value="${this.value}"
|
|
130
|
+
.validators="${this.validations}"
|
|
131
|
+
.errorMessage="${this.errorMessage}"
|
|
132
|
+
.defaultValue="${(_a = this.field) === null || _a === void 0 ? void 0 : _a.default_value}"
|
|
133
|
+
>
|
|
134
|
+
${this.renderFieldLabel(label, help_text)}
|
|
135
|
+
</repeatable-text-field>
|
|
140
136
|
`;
|
|
141
137
|
case FieldTypes.NUMBER_TYPE:
|
|
142
138
|
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
143
139
|
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
144
|
-
return html `
|
|
145
|
-
<repeatable-number-field
|
|
146
|
-
class="${isWide ? 'wide' : ''}"
|
|
147
|
-
?is-readonly="${this.readonly}"
|
|
148
|
-
?required="${required}"
|
|
149
|
-
.placeholder="${placeholder}"
|
|
150
|
-
.value="${this.value}"
|
|
151
|
-
.validators="${this.validations}"
|
|
152
|
-
.errorMessage="${this.errorMessage}"
|
|
153
|
-
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
154
|
-
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
155
|
-
>
|
|
156
|
-
${this.renderFieldLabel(label, help_text)}
|
|
157
|
-
</repeatable-number-field>
|
|
140
|
+
return html `
|
|
141
|
+
<repeatable-number-field
|
|
142
|
+
class="${isWide ? 'wide' : ''}"
|
|
143
|
+
?is-readonly="${this.readonly}"
|
|
144
|
+
?required="${required}"
|
|
145
|
+
.placeholder="${placeholder}"
|
|
146
|
+
.value="${this.value}"
|
|
147
|
+
.validators="${this.validations}"
|
|
148
|
+
.errorMessage="${this.errorMessage}"
|
|
149
|
+
.isInteger="${Boolean(input_type === FieldTypes.NUMBER_INTEGER_TYPE)}"
|
|
150
|
+
.defaultValue="${(_b = this.field) === null || _b === void 0 ? void 0 : _b.default_value}"
|
|
151
|
+
>
|
|
152
|
+
${this.renderFieldLabel(label, help_text)}
|
|
153
|
+
</repeatable-number-field>
|
|
158
154
|
`;
|
|
159
155
|
case FieldTypes.SCALE_TYPE:
|
|
160
|
-
return html `
|
|
161
|
-
<repeatable-scale-field
|
|
162
|
-
class="${isWide ? 'wide' : ''}"
|
|
163
|
-
.options="${this.options}"
|
|
164
|
-
?is-readonly="${this.readonly}"
|
|
165
|
-
?required="${required}"
|
|
166
|
-
.placeholder="${placeholder}"
|
|
167
|
-
.value="${this.value}"
|
|
168
|
-
.validators="${this.validations}"
|
|
169
|
-
.errorMessage="${this.errorMessage}"
|
|
170
|
-
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
171
|
-
>
|
|
172
|
-
${this.renderFieldLabel(label, help_text)}
|
|
173
|
-
</repeatable-scale-field>
|
|
156
|
+
return html `
|
|
157
|
+
<repeatable-scale-field
|
|
158
|
+
class="${isWide ? 'wide' : ''}"
|
|
159
|
+
.options="${this.options}"
|
|
160
|
+
?is-readonly="${this.readonly}"
|
|
161
|
+
?required="${required}"
|
|
162
|
+
.placeholder="${placeholder}"
|
|
163
|
+
.value="${this.value}"
|
|
164
|
+
.validators="${this.validations}"
|
|
165
|
+
.errorMessage="${this.errorMessage}"
|
|
166
|
+
.defaultValue="${(_c = this.field) === null || _c === void 0 ? void 0 : _c.default_value}"
|
|
167
|
+
>
|
|
168
|
+
${this.renderFieldLabel(label, help_text)}
|
|
169
|
+
</repeatable-scale-field>
|
|
174
170
|
`;
|
|
175
171
|
case FieldTypes.FILE_TYPE:
|
|
176
|
-
return html `
|
|
177
|
-
<repeatable-attachments-field
|
|
178
|
-
?is-readonly="${this.readonly}"
|
|
179
|
-
?required="${required}"
|
|
180
|
-
.placeholder="${placeholder}"
|
|
181
|
-
.value="${this.value}"
|
|
182
|
-
.validators="${this.validations}"
|
|
183
|
-
.errorMessage="${this.errorMessage}"
|
|
184
|
-
.computedPath="${this.computedPath}"
|
|
185
|
-
>
|
|
186
|
-
${this.renderFieldLabel(label, help_text)}
|
|
187
|
-
</repeatable-attachments-field>
|
|
172
|
+
return html `
|
|
173
|
+
<repeatable-attachments-field
|
|
174
|
+
?is-readonly="${this.readonly}"
|
|
175
|
+
?required="${required}"
|
|
176
|
+
.placeholder="${placeholder}"
|
|
177
|
+
.value="${this.value}"
|
|
178
|
+
.validators="${this.validations}"
|
|
179
|
+
.errorMessage="${this.errorMessage}"
|
|
180
|
+
.computedPath="${this.computedPath}"
|
|
181
|
+
>
|
|
182
|
+
${this.renderFieldLabel(label, help_text)}
|
|
183
|
+
</repeatable-attachments-field>
|
|
188
184
|
`;
|
|
189
185
|
default:
|
|
190
186
|
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
@@ -192,11 +188,11 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
192
188
|
}
|
|
193
189
|
}
|
|
194
190
|
renderFieldLabel(label, helperText) {
|
|
195
|
-
return html `
|
|
196
|
-
<div class="layout vertical question-container">
|
|
197
|
-
<div class="question-text">${label}</div>
|
|
198
|
-
<div class="question-details">${helperText}</div>
|
|
199
|
-
</div>
|
|
191
|
+
return html `
|
|
192
|
+
<div class="layout vertical question-container">
|
|
193
|
+
<div class="question-text">${label}</div>
|
|
194
|
+
<div class="question-details">${helperText}</div>
|
|
195
|
+
</div>
|
|
200
196
|
`;
|
|
201
197
|
}
|
|
202
198
|
static get styles() {
|
|
@@ -204,29 +200,29 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
204
200
|
return [
|
|
205
201
|
FlexLayoutClasses,
|
|
206
202
|
FormBuilderCardStyles,
|
|
207
|
-
css `
|
|
208
|
-
.additional-field {
|
|
209
|
-
padding-top: 15px;
|
|
210
|
-
padding-bottom: 20px;
|
|
211
|
-
background-color: var(--secondary-background-color);
|
|
212
|
-
}
|
|
213
|
-
.wide-field-container {
|
|
214
|
-
padding-bottom: 10px;
|
|
215
|
-
}
|
|
216
|
-
.wide-field-container .question-container {
|
|
217
|
-
min-height: 0;
|
|
218
|
-
padding: 7px 0 0;
|
|
219
|
-
}
|
|
220
|
-
.wide-field-container .question-text {
|
|
221
|
-
color: var(--secondary-text-color);
|
|
222
|
-
font-weight: 400;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
@media print {
|
|
226
|
-
:host {
|
|
227
|
-
break-inside: avoid;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
203
|
+
css `
|
|
204
|
+
.additional-field {
|
|
205
|
+
padding-top: 15px;
|
|
206
|
+
padding-bottom: 20px;
|
|
207
|
+
background-color: var(--secondary-background-color);
|
|
208
|
+
}
|
|
209
|
+
.wide-field-container {
|
|
210
|
+
padding-bottom: 10px;
|
|
211
|
+
}
|
|
212
|
+
.wide-field-container .question-container {
|
|
213
|
+
min-height: 0;
|
|
214
|
+
padding: 7px 0 0;
|
|
215
|
+
}
|
|
216
|
+
.wide-field-container .question-text {
|
|
217
|
+
color: var(--secondary-text-color);
|
|
218
|
+
font-weight: 400;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media print {
|
|
222
|
+
:host {
|
|
223
|
+
break-inside: avoid;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
230
226
|
`
|
|
231
227
|
];
|
|
232
228
|
}
|
|
File without changes
|
|
File without changes
|