@unicef-polymer/etools-form-builder 2.1.4 → 2.1.6
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/dist/assets/translations.d.ts +6 -6
- package/dist/assets/translations.js +67 -67
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +86 -86
- package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
- package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
- package/dist/form-attachments-popup/form-attachments-popup.js +207 -207
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +11 -11
- package/dist/form-attachments-popup/index.d.ts +2 -2
- package/dist/form-attachments-popup/index.js +2 -2
- package/dist/form-fields/abstract-field-base.class.d.ts +33 -33
- package/dist/form-fields/abstract-field-base.class.js +117 -98
- package/dist/form-fields/field-renderer-component.d.ts +20 -20
- package/dist/form-fields/field-renderer-component.js +114 -108
- package/dist/form-fields/index.d.ts +12 -12
- package/dist/form-fields/index.js +12 -12
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +100 -100
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +102 -102
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +47 -47
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +49 -49
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +30 -30
- package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
- package/dist/form-fields/single-fields/attachment-field.js +85 -85
- package/dist/form-fields/single-fields/base-field.d.ts +11 -11
- package/dist/form-fields/single-fields/base-field.js +58 -58
- package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
- package/dist/form-fields/single-fields/boolean-field.js +29 -29
- package/dist/form-fields/single-fields/number-field.d.ts +10 -10
- package/dist/form-fields/single-fields/number-field.js +46 -46
- package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
- package/dist/form-fields/single-fields/scale-field.js +52 -52
- package/dist/form-fields/single-fields/text-field.d.ts +8 -8
- package/dist/form-fields/single-fields/text-field.js +29 -29
- package/dist/form-groups/form-abstract-group.d.ts +65 -65
- package/dist/form-groups/form-abstract-group.js +255 -255
- package/dist/form-groups/form-card.d.ts +32 -32
- package/dist/form-groups/form-card.js +89 -89
- package/dist/form-groups/form-collapsed-card.d.ts +70 -70
- package/dist/form-groups/form-collapsed-card.js +225 -225
- package/dist/form-groups/index.d.ts +3 -3
- package/dist/form-groups/index.js +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/lib/additional-components/confirmation-dialog.d.ts +18 -18
- package/dist/lib/additional-components/confirmation-dialog.js +52 -52
- package/dist/lib/additional-components/etools-fb-card.d.ts +21 -21
- package/dist/lib/additional-components/etools-fb-card.js +99 -99
- package/dist/lib/styles/attachments.styles.d.ts +2 -2
- package/dist/lib/styles/attachments.styles.js +3 -3
- package/dist/lib/styles/card-styles.d.ts +2 -2
- package/dist/lib/styles/card-styles.js +3 -3
- package/dist/lib/styles/dialog.styles.d.ts +2 -2
- package/dist/lib/styles/dialog.styles.js +3 -3
- package/dist/lib/styles/elevation-styles.d.ts +9 -9
- package/dist/lib/styles/elevation-styles.js +10 -10
- package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
- package/dist/lib/styles/flex-layout-classes.js +3 -3
- package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +3 -3
- package/dist/lib/styles/input-styles.d.ts +2 -2
- package/dist/lib/styles/input-styles.js +3 -3
- package/dist/lib/styles/page-layout-styles.d.ts +2 -2
- package/dist/lib/styles/page-layout-styles.js +3 -3
- package/dist/lib/styles/shared-styles.d.ts +2 -2
- package/dist/lib/styles/shared-styles.js +3 -3
- package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
- package/dist/lib/types/form-builder.types.d.ts +59 -59
- package/dist/lib/types/global.types.d.ts +4 -4
- package/dist/lib/utils/dialog.d.ts +10 -10
- package/dist/lib/utils/dialog.js +21 -21
- package/dist/lib/utils/fire-custom-event.d.ts +1 -1
- package/dist/lib/utils/fire-custom-event.js +7 -7
- package/dist/lib/utils/translate.d.ts +1 -1
- package/dist/lib/utils/translate.js +9 -9
- package/dist/lib/utils/validations.helper.d.ts +26 -26
- package/dist/lib/utils/validations.helper.js +42 -42
- package/package.json +4 -4
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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';
|
|
8
|
-
import { validate } from '../lib/utils/validations.helper';
|
|
9
|
-
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
10
|
-
/**
|
|
11
|
-
* Class that contains common properties and methods for single and repeatable fields
|
|
12
|
-
*/
|
|
13
|
-
export class AbstractFieldBaseClass extends LitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
this.questionText = '';
|
|
17
|
-
this.required = false;
|
|
18
|
-
this.placeholder = '';
|
|
19
|
-
this.value = null;
|
|
20
|
-
this.validators = [];
|
|
21
|
-
this.touched = false;
|
|
22
|
-
this._readonly = false;
|
|
23
|
-
if (!this.language) {
|
|
24
|
-
this.language = window.localStorage.defaultLanguage || 'en';
|
|
25
|
-
}
|
|
26
|
-
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
27
|
-
}
|
|
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
|
-
connectedCallback() {
|
|
42
|
-
super.connectedCallback();
|
|
43
|
-
document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
44
|
-
}
|
|
45
|
-
disconnectedCallback() {
|
|
46
|
-
super.disconnectedCallback();
|
|
47
|
-
document.removeEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
48
|
-
}
|
|
49
|
-
handleLanguageChange(e) {
|
|
50
|
-
this.language = e.detail.language;
|
|
51
|
-
}
|
|
52
|
-
render() {
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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';
|
|
8
|
+
import { validate } from '../lib/utils/validations.helper';
|
|
9
|
+
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
10
|
+
/**
|
|
11
|
+
* Class that contains common properties and methods for single and repeatable fields
|
|
12
|
+
*/
|
|
13
|
+
export class AbstractFieldBaseClass extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.questionText = '';
|
|
17
|
+
this.required = false;
|
|
18
|
+
this.placeholder = '';
|
|
19
|
+
this.value = null;
|
|
20
|
+
this.validators = [];
|
|
21
|
+
this.touched = false;
|
|
22
|
+
this._readonly = false;
|
|
23
|
+
if (!this.language) {
|
|
24
|
+
this.language = window.localStorage.defaultLanguage || 'en';
|
|
25
|
+
}
|
|
26
|
+
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
27
|
+
}
|
|
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
|
+
connectedCallback() {
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
super.disconnectedCallback();
|
|
47
|
+
document.removeEventListener('language-changed', this.handleLanguageChange.bind(this));
|
|
48
|
+
}
|
|
49
|
+
handleLanguageChange(e) {
|
|
50
|
+
this.language = e.detail.language;
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
53
|
return html `
|
|
54
54
|
<div class="finding-container">
|
|
55
55
|
<div class="question"><slot>${this.questionTemplate()}</slot></div>
|
|
56
56
|
<div class="question-control">${this.controlTemplate()}</div>
|
|
57
57
|
</div>
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
questionTemplate() {
|
|
61
|
-
return html `<span class="question-text">${this.questionText}</span>`;
|
|
62
|
-
}
|
|
63
|
-
metaValidation(value) {
|
|
64
|
-
const message = validate(this.validators, value, this.language);
|
|
65
|
-
return message ? message : this.customValidation(value);
|
|
66
|
-
}
|
|
67
|
-
setDefaultValue(readonly, defaultValue) {
|
|
68
|
-
if (readonly || (!defaultValue && defaultValue !== 0) || this.value !== undefined) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
this.getUpdateComplete().then(() => {
|
|
72
|
-
if (defaultValue === this._defaultValue && readonly === this._readonly && this.value === undefined) {
|
|
73
|
-
this.setValue(defaultValue);
|
|
74
|
-
this.validateField(defaultValue);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
static get styles() {
|
|
79
|
-
// language=CSS
|
|
80
|
-
return [
|
|
81
|
-
FlexLayoutClasses,
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
questionTemplate() {
|
|
61
|
+
return html `<span class="question-text">${this.questionText}</span>`;
|
|
62
|
+
}
|
|
63
|
+
metaValidation(value) {
|
|
64
|
+
const message = validate(this.validators, value, this.language);
|
|
65
|
+
return message ? message : this.customValidation(value);
|
|
66
|
+
}
|
|
67
|
+
setDefaultValue(readonly, defaultValue) {
|
|
68
|
+
if (readonly || (!defaultValue && defaultValue !== 0) || this.value !== undefined) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.getUpdateComplete().then(() => {
|
|
72
|
+
if (defaultValue === this._defaultValue && readonly === this._readonly && this.value === undefined) {
|
|
73
|
+
this.setValue(defaultValue);
|
|
74
|
+
this.validateField(defaultValue);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
static get styles() {
|
|
79
|
+
// language=CSS
|
|
80
|
+
return [
|
|
81
|
+
FlexLayoutClasses,
|
|
82
82
|
css `
|
|
83
83
|
:host {
|
|
84
84
|
display: block;
|
|
@@ -170,25 +170,44 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
170
170
|
flex: 0 1 auto;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
}
|
|
192
|
+
`
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: String })
|
|
198
|
+
], AbstractFieldBaseClass.prototype, "questionText", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property()
|
|
201
|
+
], AbstractFieldBaseClass.prototype, "language", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property({ type: Boolean, attribute: 'is-readonly' })
|
|
204
|
+
], AbstractFieldBaseClass.prototype, "isReadonly", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Boolean, attribute: 'required' })
|
|
207
|
+
], AbstractFieldBaseClass.prototype, "required", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property()
|
|
210
|
+
], AbstractFieldBaseClass.prototype, "placeholder", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property()
|
|
213
|
+
], AbstractFieldBaseClass.prototype, "value", void 0);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
-
import { BlueprintField } from '../lib/types/form-builder.types';
|
|
3
|
-
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
4
|
-
import { FieldOption } from './single-fields/scale-field';
|
|
5
|
-
export declare class FieldRendererComponent extends LitElement {
|
|
6
|
-
field: BlueprintField;
|
|
7
|
-
value: any;
|
|
8
|
-
errorMessage: string | null;
|
|
9
|
-
validations: FieldValidator[];
|
|
10
|
-
readonly: boolean;
|
|
11
|
-
options: (FieldOption | string | number)[];
|
|
12
|
-
computedPath: string[];
|
|
13
|
-
defaultValue: any;
|
|
14
|
-
render(): TemplateResult;
|
|
15
|
-
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
16
|
-
renderStandardField({ input_type, label, help_text, required, placeholder, styling }: BlueprintField): TemplateResult;
|
|
17
|
-
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling }: BlueprintField): TemplateResult;
|
|
18
|
-
renderFieldLabel(label: string, helperText: string): TemplateResult;
|
|
19
|
-
static get styles(): CSSResultArray;
|
|
20
|
-
}
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
+
import { BlueprintField } from '../lib/types/form-builder.types';
|
|
3
|
+
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
4
|
+
import { FieldOption } from './single-fields/scale-field';
|
|
5
|
+
export declare class FieldRendererComponent extends LitElement {
|
|
6
|
+
field: BlueprintField;
|
|
7
|
+
value: any;
|
|
8
|
+
errorMessage: string | null;
|
|
9
|
+
validations: FieldValidator[];
|
|
10
|
+
readonly: boolean;
|
|
11
|
+
options: (FieldOption | string | number)[];
|
|
12
|
+
computedPath: string[];
|
|
13
|
+
defaultValue: any;
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
renderField(blueprintField: BlueprintField): TemplateResult;
|
|
16
|
+
renderStandardField({ input_type, label, help_text, required, placeholder, styling }: BlueprintField): TemplateResult;
|
|
17
|
+
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling }: BlueprintField): TemplateResult;
|
|
18
|
+
renderFieldLabel(label: string, helperText: string): TemplateResult;
|
|
19
|
+
static get styles(): CSSResultArray;
|
|
20
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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';
|
|
8
|
-
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
9
|
-
import { FieldTypes, StructureTypes } from '../form-groups';
|
|
10
|
-
import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
|
|
11
|
-
let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.errorMessage = null;
|
|
15
|
-
this.validations = [];
|
|
16
|
-
this.readonly = false;
|
|
17
|
-
this.options = [];
|
|
18
|
-
this.computedPath = [];
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
if (!this.field) {
|
|
22
|
-
return html ``;
|
|
23
|
-
}
|
|
24
|
-
return this.renderField(this.field);
|
|
25
|
-
}
|
|
26
|
-
renderField(blueprintField) {
|
|
27
|
-
const additionalClass = blueprintField.styling.includes(StructureTypes.ADDITIONAL)
|
|
28
|
-
? 'additional-field '
|
|
29
|
-
: '';
|
|
30
|
-
const wideClass = blueprintField.styling.includes(StructureTypes.WIDE) ? 'wide-field-container ' : '';
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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';
|
|
8
|
+
import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
|
|
9
|
+
import { FieldTypes, StructureTypes } from '../form-groups';
|
|
10
|
+
import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
|
|
11
|
+
let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.errorMessage = null;
|
|
15
|
+
this.validations = [];
|
|
16
|
+
this.readonly = false;
|
|
17
|
+
this.options = [];
|
|
18
|
+
this.computedPath = [];
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
if (!this.field) {
|
|
22
|
+
return html ``;
|
|
23
|
+
}
|
|
24
|
+
return this.renderField(this.field);
|
|
25
|
+
}
|
|
26
|
+
renderField(blueprintField) {
|
|
27
|
+
const additionalClass = blueprintField.styling.includes(StructureTypes.ADDITIONAL)
|
|
28
|
+
? 'additional-field '
|
|
29
|
+
: '';
|
|
30
|
+
const wideClass = blueprintField.styling.includes(StructureTypes.WIDE) ? 'wide-field-container ' : '';
|
|
31
31
|
return html `
|
|
32
32
|
<div class="${`${additionalClass}${wideClass}finding-container`}">
|
|
33
|
-
${blueprintField.repeatable
|
|
34
|
-
? this.renderRepeatableField(blueprintField)
|
|
33
|
+
${blueprintField.repeatable
|
|
34
|
+
? this.renderRepeatableField(blueprintField)
|
|
35
35
|
: this.renderStandardField(blueprintField)}
|
|
36
36
|
</div>
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
renderStandardField({ input_type, label, help_text, required, placeholder, styling }) {
|
|
40
|
-
var _a, _b, _c, _d;
|
|
41
|
-
const isWide = styling.includes(StructureTypes.WIDE);
|
|
42
|
-
switch (input_type) {
|
|
43
|
-
case FieldTypes.TEXT_TYPE:
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
renderStandardField({ input_type, label, help_text, required, placeholder, styling }) {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
const isWide = styling.includes(StructureTypes.WIDE);
|
|
42
|
+
switch (input_type) {
|
|
43
|
+
case FieldTypes.TEXT_TYPE:
|
|
44
44
|
return html `
|
|
45
45
|
<text-field
|
|
46
46
|
class="${isWide ? 'wide' : ''}"
|
|
@@ -54,10 +54,10 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
54
54
|
>
|
|
55
55
|
${this.renderFieldLabel(label, help_text)}
|
|
56
56
|
</text-field>
|
|
57
|
-
`;
|
|
58
|
-
case FieldTypes.NUMBER_TYPE:
|
|
59
|
-
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
60
|
-
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
57
|
+
`;
|
|
58
|
+
case FieldTypes.NUMBER_TYPE:
|
|
59
|
+
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
60
|
+
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
61
61
|
return html `
|
|
62
62
|
<number-field
|
|
63
63
|
?is-readonly="${this.readonly}"
|
|
@@ -71,8 +71,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
71
71
|
>
|
|
72
72
|
${this.renderFieldLabel(label, help_text)}
|
|
73
73
|
</number-field>
|
|
74
|
-
`;
|
|
75
|
-
case FieldTypes.BOOL_TYPE:
|
|
74
|
+
`;
|
|
75
|
+
case FieldTypes.BOOL_TYPE:
|
|
76
76
|
return html `
|
|
77
77
|
<boolean-field
|
|
78
78
|
?is-readonly="${this.readonly}"
|
|
@@ -84,8 +84,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
84
84
|
>
|
|
85
85
|
${this.renderFieldLabel(label, help_text)}
|
|
86
86
|
</boolean-field>
|
|
87
|
-
`;
|
|
88
|
-
case FieldTypes.SCALE_TYPE:
|
|
87
|
+
`;
|
|
88
|
+
case FieldTypes.SCALE_TYPE:
|
|
89
89
|
return html `
|
|
90
90
|
<scale-field
|
|
91
91
|
.options="${this.options}"
|
|
@@ -99,8 +99,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
99
99
|
>
|
|
100
100
|
${this.renderFieldLabel(label, help_text)}
|
|
101
101
|
</scale-field>
|
|
102
|
-
`;
|
|
103
|
-
case FieldTypes.FILE_TYPE:
|
|
102
|
+
`;
|
|
103
|
+
case FieldTypes.FILE_TYPE:
|
|
104
104
|
return html `
|
|
105
105
|
<attachments-field
|
|
106
106
|
?is-readonly="${this.readonly}"
|
|
@@ -113,17 +113,17 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
113
113
|
>
|
|
114
114
|
${this.renderFieldLabel(label, help_text)}
|
|
115
115
|
</attachments-field>
|
|
116
|
-
`;
|
|
117
|
-
default:
|
|
118
|
-
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
119
|
-
return html ``;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling }) {
|
|
123
|
-
var _a, _b, _c;
|
|
124
|
-
const isWide = styling.includes(StructureTypes.WIDE);
|
|
125
|
-
switch (input_type) {
|
|
126
|
-
case FieldTypes.TEXT_TYPE:
|
|
116
|
+
`;
|
|
117
|
+
default:
|
|
118
|
+
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
119
|
+
return html ``;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
renderRepeatableField({ input_type, label, help_text, required, placeholder, styling }) {
|
|
123
|
+
var _a, _b, _c;
|
|
124
|
+
const isWide = styling.includes(StructureTypes.WIDE);
|
|
125
|
+
switch (input_type) {
|
|
126
|
+
case FieldTypes.TEXT_TYPE:
|
|
127
127
|
return html `
|
|
128
128
|
<repeatable-text-field
|
|
129
129
|
class="${isWide ? 'wide' : ''}"
|
|
@@ -137,10 +137,10 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
137
137
|
>
|
|
138
138
|
${this.renderFieldLabel(label, help_text)}
|
|
139
139
|
</repeatable-text-field>
|
|
140
|
-
`;
|
|
141
|
-
case FieldTypes.NUMBER_TYPE:
|
|
142
|
-
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
143
|
-
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
140
|
+
`;
|
|
141
|
+
case FieldTypes.NUMBER_TYPE:
|
|
142
|
+
case FieldTypes.NUMBER_FLOAT_TYPE:
|
|
143
|
+
case FieldTypes.NUMBER_INTEGER_TYPE:
|
|
144
144
|
return html `
|
|
145
145
|
<repeatable-number-field
|
|
146
146
|
class="${isWide ? 'wide' : ''}"
|
|
@@ -155,8 +155,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
155
155
|
>
|
|
156
156
|
${this.renderFieldLabel(label, help_text)}
|
|
157
157
|
</repeatable-number-field>
|
|
158
|
-
`;
|
|
159
|
-
case FieldTypes.SCALE_TYPE:
|
|
158
|
+
`;
|
|
159
|
+
case FieldTypes.SCALE_TYPE:
|
|
160
160
|
return html `
|
|
161
161
|
<repeatable-scale-field
|
|
162
162
|
class="${isWide ? 'wide' : ''}"
|
|
@@ -171,8 +171,8 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
171
171
|
>
|
|
172
172
|
${this.renderFieldLabel(label, help_text)}
|
|
173
173
|
</repeatable-scale-field>
|
|
174
|
-
`;
|
|
175
|
-
case FieldTypes.FILE_TYPE:
|
|
174
|
+
`;
|
|
175
|
+
case FieldTypes.FILE_TYPE:
|
|
176
176
|
return html `
|
|
177
177
|
<repeatable-attachments-field
|
|
178
178
|
?is-readonly="${this.readonly}"
|
|
@@ -185,25 +185,25 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
185
185
|
>
|
|
186
186
|
${this.renderFieldLabel(label, help_text)}
|
|
187
187
|
</repeatable-attachments-field>
|
|
188
|
-
`;
|
|
189
|
-
default:
|
|
190
|
-
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
191
|
-
return html ``;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
renderFieldLabel(label, helperText) {
|
|
188
|
+
`;
|
|
189
|
+
default:
|
|
190
|
+
console.warn(`FormBuilderGroup: Unknown field type: ${input_type}`);
|
|
191
|
+
return html ``;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
renderFieldLabel(label, helperText) {
|
|
195
195
|
return html `
|
|
196
196
|
<div class="layout vertical question-container">
|
|
197
197
|
<div class="question-text">${label}</div>
|
|
198
198
|
<div class="question-details">${helperText}</div>
|
|
199
199
|
</div>
|
|
200
|
-
`;
|
|
201
|
-
}
|
|
202
|
-
static get styles() {
|
|
203
|
-
// language=CSS
|
|
204
|
-
return [
|
|
205
|
-
FlexLayoutClasses,
|
|
206
|
-
FormBuilderCardStyles,
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
static get styles() {
|
|
203
|
+
// language=CSS
|
|
204
|
+
return [
|
|
205
|
+
FlexLayoutClasses,
|
|
206
|
+
FormBuilderCardStyles,
|
|
207
207
|
css `
|
|
208
208
|
.additional-field {
|
|
209
209
|
padding-top: 15px;
|
|
@@ -221,29 +221,35 @@ let FieldRendererComponent = class FieldRendererComponent extends LitElement {
|
|
|
221
221
|
color: var(--secondary-text-color);
|
|
222
222
|
font-weight: 400;
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
__decorate([
|
|
235
|
-
property()
|
|
236
|
-
], FieldRendererComponent.prototype, "
|
|
237
|
-
__decorate([
|
|
238
|
-
property()
|
|
239
|
-
], FieldRendererComponent.prototype, "
|
|
240
|
-
__decorate([
|
|
241
|
-
property(
|
|
242
|
-
], FieldRendererComponent.prototype, "
|
|
243
|
-
__decorate([
|
|
244
|
-
property(
|
|
245
|
-
], FieldRendererComponent.prototype, "
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
], FieldRendererComponent);
|
|
249
|
-
|
|
224
|
+
|
|
225
|
+
@media print {
|
|
226
|
+
:host {
|
|
227
|
+
break-inside: avoid;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
`
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
__decorate([
|
|
235
|
+
property()
|
|
236
|
+
], FieldRendererComponent.prototype, "field", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
property()
|
|
239
|
+
], FieldRendererComponent.prototype, "value", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
property()
|
|
242
|
+
], FieldRendererComponent.prototype, "errorMessage", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property()
|
|
245
|
+
], FieldRendererComponent.prototype, "validations", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
property({ type: Boolean, attribute: 'readonly' })
|
|
248
|
+
], FieldRendererComponent.prototype, "readonly", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
property({ type: Array })
|
|
251
|
+
], FieldRendererComponent.prototype, "options", void 0);
|
|
252
|
+
FieldRendererComponent = __decorate([
|
|
253
|
+
customElement('field-renderer')
|
|
254
|
+
], FieldRendererComponent);
|
|
255
|
+
export { FieldRendererComponent };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './single-fields/base-field';
|
|
2
|
-
export * from './single-fields/number-field';
|
|
3
|
-
export * from './single-fields/text-field';
|
|
4
|
-
export * from './single-fields/scale-field';
|
|
5
|
-
export * from './single-fields/boolean-field';
|
|
6
|
-
export * from './single-fields/attachment-field';
|
|
7
|
-
export * from './repeatable-fields/repeatable-base-field';
|
|
8
|
-
export * from './repeatable-fields/repeatable-text-field';
|
|
9
|
-
export * from './repeatable-fields/repeatable-number-field';
|
|
10
|
-
export * from './repeatable-fields/repeatable-scale-field';
|
|
11
|
-
export * from './repeatable-fields/repeatable-attachment-field';
|
|
12
|
-
export * from './field-renderer-component';
|
|
1
|
+
export * from './single-fields/base-field';
|
|
2
|
+
export * from './single-fields/number-field';
|
|
3
|
+
export * from './single-fields/text-field';
|
|
4
|
+
export * from './single-fields/scale-field';
|
|
5
|
+
export * from './single-fields/boolean-field';
|
|
6
|
+
export * from './single-fields/attachment-field';
|
|
7
|
+
export * from './repeatable-fields/repeatable-base-field';
|
|
8
|
+
export * from './repeatable-fields/repeatable-text-field';
|
|
9
|
+
export * from './repeatable-fields/repeatable-number-field';
|
|
10
|
+
export * from './repeatable-fields/repeatable-scale-field';
|
|
11
|
+
export * from './repeatable-fields/repeatable-attachment-field';
|
|
12
|
+
export * from './field-renderer-component';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './single-fields/base-field';
|
|
2
|
-
export * from './single-fields/number-field';
|
|
3
|
-
export * from './single-fields/text-field';
|
|
4
|
-
export * from './single-fields/scale-field';
|
|
5
|
-
export * from './single-fields/boolean-field';
|
|
6
|
-
export * from './single-fields/attachment-field';
|
|
7
|
-
export * from './repeatable-fields/repeatable-base-field';
|
|
8
|
-
export * from './repeatable-fields/repeatable-text-field';
|
|
9
|
-
export * from './repeatable-fields/repeatable-number-field';
|
|
10
|
-
export * from './repeatable-fields/repeatable-scale-field';
|
|
11
|
-
export * from './repeatable-fields/repeatable-attachment-field';
|
|
12
|
-
export * from './field-renderer-component';
|
|
1
|
+
export * from './single-fields/base-field';
|
|
2
|
+
export * from './single-fields/number-field';
|
|
3
|
+
export * from './single-fields/text-field';
|
|
4
|
+
export * from './single-fields/scale-field';
|
|
5
|
+
export * from './single-fields/boolean-field';
|
|
6
|
+
export * from './single-fields/attachment-field';
|
|
7
|
+
export * from './repeatable-fields/repeatable-base-field';
|
|
8
|
+
export * from './repeatable-fields/repeatable-text-field';
|
|
9
|
+
export * from './repeatable-fields/repeatable-number-field';
|
|
10
|
+
export * from './repeatable-fields/repeatable-scale-field';
|
|
11
|
+
export * from './repeatable-fields/repeatable-attachment-field';
|
|
12
|
+
export * from './field-renderer-component';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import '@unicef-polymer/etools-upload/etools-upload';
|
|
2
|
-
import { RepeatableBaseField } from './repeatable-base-field';
|
|
3
|
-
import { StoredAttachment, UploadFinishedDetails } from '../../form-attachments-popup';
|
|
4
|
-
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
5
|
-
export declare class RepeatableAttachmentField extends RepeatableBaseField<StoredAttachment> {
|
|
6
|
-
get uploadUrl(): string;
|
|
7
|
-
get jwtLocalStorageKey(): string;
|
|
8
|
-
computedPath: string[];
|
|
9
|
-
protected render(): TemplateResult;
|
|
10
|
-
protected controlTemplate(): TemplateResult;
|
|
11
|
-
protected customValidation(): string | null;
|
|
12
|
-
protected attachmentsUploaded({ success, error }: UploadFinishedDetails): void;
|
|
13
|
-
protected downloadFile(attachment: StoredAttachment | null): void;
|
|
14
|
-
private isUploadedAttachment;
|
|
15
|
-
private isOfflineSavedAttachment;
|
|
16
|
-
static get styles(): CSSResultArray;
|
|
17
|
-
}
|
|
1
|
+
import '@unicef-polymer/etools-upload/etools-upload';
|
|
2
|
+
import { RepeatableBaseField } from './repeatable-base-field';
|
|
3
|
+
import { StoredAttachment, UploadFinishedDetails } from '../../form-attachments-popup';
|
|
4
|
+
import { TemplateResult, CSSResultArray } from 'lit-element';
|
|
5
|
+
export declare class RepeatableAttachmentField extends RepeatableBaseField<StoredAttachment> {
|
|
6
|
+
get uploadUrl(): string;
|
|
7
|
+
get jwtLocalStorageKey(): string;
|
|
8
|
+
computedPath: string[];
|
|
9
|
+
protected render(): TemplateResult;
|
|
10
|
+
protected controlTemplate(): TemplateResult;
|
|
11
|
+
protected customValidation(): string | null;
|
|
12
|
+
protected attachmentsUploaded({ success, error }: UploadFinishedDetails): void;
|
|
13
|
+
protected downloadFile(attachment: StoredAttachment | null): void;
|
|
14
|
+
private isUploadedAttachment;
|
|
15
|
+
private isOfflineSavedAttachment;
|
|
16
|
+
static get styles(): CSSResultArray;
|
|
17
|
+
}
|