@unicef-polymer/etools-form-builder 2.1.7 → 2.1.9
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 +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 +255 -255
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +91 -91
- 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 +213 -213
- package/dist/form-fields/field-renderer-component.d.ts +20 -20
- package/dist/form-fields/field-renderer-component.js +255 -255
- 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 +209 -209
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +124 -124
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +67 -67
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +108 -108
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +53 -53
- package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
- package/dist/form-fields/single-fields/attachment-field.js +98 -98
- 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 +49 -49
- package/dist/form-fields/single-fields/number-field.d.ts +10 -10
- package/dist/form-fields/single-fields/number-field.js +67 -67
- package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
- package/dist/form-fields/single-fields/scale-field.js +108 -108
- package/dist/form-fields/single-fields/text-field.d.ts +8 -8
- package/dist/form-fields/single-fields/text-field.js +54 -54
- package/dist/form-groups/form-abstract-group.d.ts +71 -71
- package/dist/form-groups/form-abstract-group.js +398 -398
- package/dist/form-groups/form-card.d.ts +32 -32
- package/dist/form-groups/form-card.js +113 -113
- package/dist/form-groups/form-collapsed-card.d.ts +71 -71
- package/dist/form-groups/form-collapsed-card.js +259 -259
- 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 +72 -72
- package/dist/lib/additional-components/etools-fb-card.d.ts +21 -21
- package/dist/lib/additional-components/etools-fb-card.js +239 -238
- package/dist/lib/styles/attachments.styles.d.ts +2 -2
- package/dist/lib/styles/attachments.styles.js +72 -72
- package/dist/lib/styles/card-styles.d.ts +2 -2
- package/dist/lib/styles/card-styles.js +154 -154
- package/dist/lib/styles/dialog.styles.d.ts +2 -2
- package/dist/lib/styles/dialog.styles.js +85 -85
- package/dist/lib/styles/elevation-styles.d.ts +9 -9
- package/dist/lib/styles/elevation-styles.js +43 -43
- package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
- package/dist/lib/styles/flex-layout-classes.js +319 -319
- package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +49 -49
- package/dist/lib/styles/input-styles.d.ts +2 -2
- package/dist/lib/styles/input-styles.js +138 -138
- package/dist/lib/styles/page-layout-styles.d.ts +2 -2
- package/dist/lib/styles/page-layout-styles.js +201 -201
- package/dist/lib/styles/shared-styles.d.ts +2 -2
- package/dist/lib/styles/shared-styles.js +70 -70
- package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
- package/dist/lib/types/form-builder.interfaces.js +0 -0
- package/dist/lib/types/form-builder.types.d.ts +59 -59
- package/dist/lib/types/form-builder.types.js +0 -0
- package/dist/lib/types/global.types.d.ts +4 -4
- package/dist/lib/types/global.types.js +0 -0
- 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 +56 -56
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
|
-
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
4
|
-
import { getTranslation } from '../lib/utils/translate';
|
|
5
|
-
export function template() {
|
|
6
|
-
var _a;
|
|
7
|
-
return html `
|
|
8
|
-
${InputStyles} ${DialogStyles}
|
|
9
|
-
<etools-dialog
|
|
10
|
-
id="form-attachments-dialog"
|
|
11
|
-
size="md"
|
|
12
|
-
no-padding
|
|
13
|
-
keep-dialog-open
|
|
14
|
-
?opened="${this.dialogOpened}"
|
|
15
|
-
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
16
|
-
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
17
|
-
.hideConfirmBtn="${this.readonly}"
|
|
18
|
-
dialog-title="${this.popupTitle}"
|
|
19
|
-
@close="${this.onClose}"
|
|
20
|
-
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
21
|
-
>
|
|
22
|
-
<!-- Link is used to download attachments -->
|
|
23
|
-
<a id="link" target="_blank" hidden></a>
|
|
24
|
-
|
|
25
|
-
<div class="popup-container">
|
|
26
|
-
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
return html `
|
|
29
|
-
<div class="file-selector-container with-type-dropdown">
|
|
30
|
-
<!-- Type select Dropdown -->
|
|
31
|
-
<etools-dropdown
|
|
32
|
-
class="type-dropdown file-selector__type-dropdown"
|
|
33
|
-
.selected="${attachment.file_type}"
|
|
34
|
-
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
35
|
-
trigger-value-change-event
|
|
36
|
-
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
37
|
-
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
38
|
-
required
|
|
39
|
-
?readonly="${this.readonly}"
|
|
40
|
-
hide-search
|
|
41
|
-
.options="${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.options.target_attachments_file_types) === null || _b === void 0 ? void 0 : _b.values}"
|
|
42
|
-
option-label="label"
|
|
43
|
-
option-value="value"
|
|
44
|
-
?invalid="${this.checkFileType(index)}"
|
|
45
|
-
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
46
|
-
allow-outside-scroll
|
|
47
|
-
dynamic-align
|
|
48
|
-
></etools-dropdown>
|
|
49
|
-
|
|
50
|
-
<!-- File name component -->
|
|
51
|
-
<div class="filename-container file-selector__filename">
|
|
52
|
-
<iron-icon class="file-icon" icon="attachment"></iron-icon>
|
|
53
|
-
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<!-- Download Button -->
|
|
57
|
-
<paper-button
|
|
58
|
-
?hidden="${!attachment.url}"
|
|
59
|
-
class="download-button file-selector__download"
|
|
60
|
-
@tap="${() => this.downloadFile(attachment)}"
|
|
61
|
-
>
|
|
62
|
-
<iron-icon icon="cloud-download" class="dw-icon"></iron-icon>
|
|
63
|
-
${getTranslation(this.language, 'DOWNLOAD')}
|
|
64
|
-
</paper-button>
|
|
65
|
-
|
|
66
|
-
<!-- Delete Button -->
|
|
67
|
-
<paper-button
|
|
68
|
-
class="delete-button file-selector__delete"
|
|
69
|
-
?hidden="${this.readonly}"
|
|
70
|
-
@tap="${() => this.deleteAttachment(index)}"
|
|
71
|
-
>
|
|
72
|
-
${getTranslation(this.language, 'DELETE')}
|
|
73
|
-
</paper-button>
|
|
74
|
-
</div>
|
|
75
|
-
`;
|
|
76
|
-
})}
|
|
77
|
-
|
|
78
|
-
<!-- Upload button -->
|
|
79
|
-
<etools-upload-multi
|
|
80
|
-
class="with-padding"
|
|
81
|
-
activate-offline
|
|
82
|
-
?hidden="${this.readonly}"
|
|
83
|
-
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
84
|
-
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
85
|
-
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
86
|
-
>
|
|
87
|
-
</etools-upload-multi>
|
|
88
|
-
</div>
|
|
89
|
-
</etools-dialog>
|
|
90
|
-
`;
|
|
91
|
-
}
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
|
+
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
4
|
+
import { getTranslation } from '../lib/utils/translate';
|
|
5
|
+
export function template() {
|
|
6
|
+
var _a;
|
|
7
|
+
return html `
|
|
8
|
+
${InputStyles} ${DialogStyles}
|
|
9
|
+
<etools-dialog
|
|
10
|
+
id="form-attachments-dialog"
|
|
11
|
+
size="md"
|
|
12
|
+
no-padding
|
|
13
|
+
keep-dialog-open
|
|
14
|
+
?opened="${this.dialogOpened}"
|
|
15
|
+
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
16
|
+
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
17
|
+
.hideConfirmBtn="${this.readonly}"
|
|
18
|
+
dialog-title="${this.popupTitle}"
|
|
19
|
+
@close="${this.onClose}"
|
|
20
|
+
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
21
|
+
>
|
|
22
|
+
<!-- Link is used to download attachments -->
|
|
23
|
+
<a id="link" target="_blank" hidden></a>
|
|
24
|
+
|
|
25
|
+
<div class="popup-container">
|
|
26
|
+
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return html `
|
|
29
|
+
<div class="file-selector-container with-type-dropdown">
|
|
30
|
+
<!-- Type select Dropdown -->
|
|
31
|
+
<etools-dropdown
|
|
32
|
+
class="type-dropdown file-selector__type-dropdown"
|
|
33
|
+
.selected="${attachment.file_type}"
|
|
34
|
+
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
35
|
+
trigger-value-change-event
|
|
36
|
+
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
37
|
+
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
38
|
+
required
|
|
39
|
+
?readonly="${this.readonly}"
|
|
40
|
+
hide-search
|
|
41
|
+
.options="${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.options.target_attachments_file_types) === null || _b === void 0 ? void 0 : _b.values}"
|
|
42
|
+
option-label="label"
|
|
43
|
+
option-value="value"
|
|
44
|
+
?invalid="${this.checkFileType(index)}"
|
|
45
|
+
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
46
|
+
allow-outside-scroll
|
|
47
|
+
dynamic-align
|
|
48
|
+
></etools-dropdown>
|
|
49
|
+
|
|
50
|
+
<!-- File name component -->
|
|
51
|
+
<div class="filename-container file-selector__filename">
|
|
52
|
+
<iron-icon class="file-icon" icon="attachment"></iron-icon>
|
|
53
|
+
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<!-- Download Button -->
|
|
57
|
+
<paper-button
|
|
58
|
+
?hidden="${!attachment.url}"
|
|
59
|
+
class="download-button file-selector__download"
|
|
60
|
+
@tap="${() => this.downloadFile(attachment)}"
|
|
61
|
+
>
|
|
62
|
+
<iron-icon icon="cloud-download" class="dw-icon"></iron-icon>
|
|
63
|
+
${getTranslation(this.language, 'DOWNLOAD')}
|
|
64
|
+
</paper-button>
|
|
65
|
+
|
|
66
|
+
<!-- Delete Button -->
|
|
67
|
+
<paper-button
|
|
68
|
+
class="delete-button file-selector__delete"
|
|
69
|
+
?hidden="${this.readonly}"
|
|
70
|
+
@tap="${() => this.deleteAttachment(index)}"
|
|
71
|
+
>
|
|
72
|
+
${getTranslation(this.language, 'DELETE')}
|
|
73
|
+
</paper-button>
|
|
74
|
+
</div>
|
|
75
|
+
`;
|
|
76
|
+
})}
|
|
77
|
+
|
|
78
|
+
<!-- Upload button -->
|
|
79
|
+
<etools-upload-multi
|
|
80
|
+
class="with-padding"
|
|
81
|
+
activate-offline
|
|
82
|
+
?hidden="${this.readonly}"
|
|
83
|
+
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
84
|
+
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
85
|
+
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
86
|
+
>
|
|
87
|
+
</etools-upload-multi>
|
|
88
|
+
</div>
|
|
89
|
+
</etools-dialog>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './form-attachments-popup';
|
|
2
|
-
export * from './form-attachments-popup.helper';
|
|
1
|
+
export * from './form-attachments-popup';
|
|
2
|
+
export * from './form-attachments-popup.helper';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './form-attachments-popup';
|
|
2
|
-
export * from './form-attachments-popup.helper';
|
|
1
|
+
export * from './form-attachments-popup';
|
|
2
|
+
export * from './form-attachments-popup.helper';
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
-
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
3
|
-
/**
|
|
4
|
-
* Class that contains common properties and methods for single and repeatable fields
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class AbstractFieldBaseClass<T> extends LitElement {
|
|
7
|
-
questionText: string;
|
|
8
|
-
language: string;
|
|
9
|
-
set isReadonly(readonly: boolean);
|
|
10
|
-
get isReadonly(): boolean;
|
|
11
|
-
required: boolean;
|
|
12
|
-
placeholder: string;
|
|
13
|
-
value: T | null;
|
|
14
|
-
validators: FieldValidator[];
|
|
15
|
-
touched: boolean;
|
|
16
|
-
set defaultValue(value: any);
|
|
17
|
-
private _defaultValue;
|
|
18
|
-
private _readonly;
|
|
19
|
-
constructor();
|
|
20
|
-
connectedCallback(): void;
|
|
21
|
-
disconnectedCallback(): void;
|
|
22
|
-
handleLanguageChange(e: CustomEvent): void;
|
|
23
|
-
protected render(): TemplateResult;
|
|
24
|
-
protected questionTemplate(): TemplateResult;
|
|
25
|
-
protected metaValidation(value: unknown): string | null;
|
|
26
|
-
private setDefaultValue;
|
|
27
|
-
protected abstract valueChanged(...args: any): void;
|
|
28
|
-
protected abstract customValidation(value: unknown): string | null;
|
|
29
|
-
protected abstract controlTemplate(...args: any): TemplateResult;
|
|
30
|
-
protected abstract setValue(value: T): void;
|
|
31
|
-
protected abstract validateField(value: T): void;
|
|
32
|
-
static get styles(): CSSResultArray;
|
|
33
|
-
}
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
2
|
+
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
3
|
+
/**
|
|
4
|
+
* Class that contains common properties and methods for single and repeatable fields
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class AbstractFieldBaseClass<T> extends LitElement {
|
|
7
|
+
questionText: string;
|
|
8
|
+
language: string;
|
|
9
|
+
set isReadonly(readonly: boolean);
|
|
10
|
+
get isReadonly(): boolean;
|
|
11
|
+
required: boolean;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
value: T | null;
|
|
14
|
+
validators: FieldValidator[];
|
|
15
|
+
touched: boolean;
|
|
16
|
+
set defaultValue(value: any);
|
|
17
|
+
private _defaultValue;
|
|
18
|
+
private _readonly;
|
|
19
|
+
constructor();
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
handleLanguageChange(e: CustomEvent): void;
|
|
23
|
+
protected render(): TemplateResult;
|
|
24
|
+
protected questionTemplate(): TemplateResult;
|
|
25
|
+
protected metaValidation(value: unknown): string | null;
|
|
26
|
+
private setDefaultValue;
|
|
27
|
+
protected abstract valueChanged(...args: any): void;
|
|
28
|
+
protected abstract customValidation(value: unknown): string | null;
|
|
29
|
+
protected abstract controlTemplate(...args: any): TemplateResult;
|
|
30
|
+
protected abstract setValue(value: T): void;
|
|
31
|
+
protected abstract validateField(value: T): void;
|
|
32
|
+
static get styles(): CSSResultArray;
|
|
33
|
+
}
|