@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
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# Etools FM Form Builder Components
|
|
1
|
+
# Etools FM Form Builder Components
|
|
File without changes
|
|
File without changes
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import '@unicef-polymer/etools-dialog/etools-dialog';
|
|
2
|
-
import '@unicef-polymer/etools-upload/etools-upload-multi';
|
|
3
|
-
import '@unicef-polymer/etools-dropdown/etools-dropdown';
|
|
4
|
-
import '
|
|
5
|
-
import '@polymer/iron-icons/iron-icons';
|
|
6
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit-element';
|
|
1
|
+
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
3
|
+
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
|
|
4
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit';
|
|
7
5
|
import { GenericObject } from '../lib/types/global.types';
|
|
8
6
|
import { BlueprintMetadata } from '../lib/types/form-builder.types';
|
|
9
|
-
export
|
|
7
|
+
export type FormBuilderAttachmentsPopupData = {
|
|
10
8
|
attachments: StoredAttachment[];
|
|
11
9
|
metadata: BlueprintMetadata;
|
|
12
10
|
title: string;
|
|
@@ -14,14 +12,14 @@ export declare type FormBuilderAttachmentsPopupData = {
|
|
|
14
12
|
computedPath: string[];
|
|
15
13
|
errors: GenericObject[];
|
|
16
14
|
};
|
|
17
|
-
export
|
|
15
|
+
export type StoredAttachment = {
|
|
18
16
|
attachment: string | number;
|
|
19
17
|
filename: string;
|
|
20
18
|
file_type: number | null;
|
|
21
19
|
url?: string;
|
|
22
20
|
composedPath?: string[];
|
|
23
21
|
};
|
|
24
|
-
export
|
|
22
|
+
export type UploadedAttachment = {
|
|
25
23
|
id: number;
|
|
26
24
|
object_link: string;
|
|
27
25
|
file_type: string;
|
|
@@ -31,18 +29,18 @@ export declare type UploadedAttachment = {
|
|
|
31
29
|
created: string;
|
|
32
30
|
attachment: number;
|
|
33
31
|
};
|
|
34
|
-
export
|
|
32
|
+
export type OfflineSavedAttachment = {
|
|
35
33
|
id: string;
|
|
36
34
|
filetype: string;
|
|
37
35
|
filename: string;
|
|
38
36
|
extraInfo: string[];
|
|
39
37
|
unsynced: boolean;
|
|
40
38
|
};
|
|
41
|
-
export
|
|
39
|
+
export type UploadFinishedDetails = {
|
|
42
40
|
success: (UploadedAttachment | OfflineSavedAttachment)[];
|
|
43
41
|
error: any[];
|
|
44
42
|
};
|
|
45
|
-
export
|
|
43
|
+
export type SingleUploadFinishedDetails = {
|
|
46
44
|
success: UploadedAttachment | OfflineSavedAttachment;
|
|
47
45
|
error: any[];
|
|
48
46
|
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
import '
|
|
8
|
-
import '@unicef-polymer/etools-upload/etools-upload-multi';
|
|
9
|
-
import '@unicef-polymer/etools-dropdown/etools-dropdown';
|
|
10
|
-
import '@polymer/paper-button/paper-button';
|
|
11
|
-
import '@polymer/iron-icons/iron-icons';
|
|
12
|
-
import { css, customElement, LitElement, property, query } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
|
|
3
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
|
|
5
|
+
import { deleteFileFromDexie } from '@unicef-polymer/etools-unicef/src/etools-upload/offline/dexie-operations';
|
|
6
|
+
import { css, LitElement } from 'lit';
|
|
7
|
+
import { property, query, customElement } from 'lit/decorators.js';
|
|
13
8
|
import { clone, equals } from 'ramda';
|
|
14
9
|
import { template } from './form-attachments-popup.tpl';
|
|
15
10
|
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
16
11
|
import { SharedStyles } from '../lib/styles/shared-styles';
|
|
17
12
|
import { AttachmentsStyles } from '../lib/styles/attachments.styles';
|
|
18
13
|
import { AttachmentsHelper } from './form-attachments-popup.helper';
|
|
19
|
-
import { deleteFileFromDexie } from '@unicef-polymer/etools-upload/offline/dexie-operations';
|
|
20
14
|
import { getTranslation } from '../lib/utils/translate';
|
|
21
15
|
let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
16
|
+
set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
|
|
17
|
+
this.popupTitle = title;
|
|
18
|
+
this.attachments = clone(attachments) || [];
|
|
19
|
+
this.originalAttachments = clone(attachments) || [];
|
|
20
|
+
this.metadata = clone(metadata);
|
|
21
|
+
this.readonly = Boolean(readonly);
|
|
22
|
+
this.computedPath = computedPath;
|
|
23
|
+
this.errors = clone(errors) || [];
|
|
24
|
+
}
|
|
25
|
+
get uploadUrl() {
|
|
26
|
+
return AttachmentsHelper.uploadUrl;
|
|
27
|
+
}
|
|
28
|
+
get jwtLocalStorageKey() {
|
|
29
|
+
return AttachmentsHelper.jwtLocalStorageKey;
|
|
30
|
+
}
|
|
22
31
|
constructor() {
|
|
23
32
|
super();
|
|
24
33
|
this.dialogOpened = true;
|
|
@@ -41,21 +50,6 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
|
41
50
|
this.language = window.localStorage.defaultLanguage || 'en';
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
|
-
set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
|
|
45
|
-
this.popupTitle = title;
|
|
46
|
-
this.attachments = clone(attachments) || [];
|
|
47
|
-
this.originalAttachments = clone(attachments) || [];
|
|
48
|
-
this.metadata = clone(metadata);
|
|
49
|
-
this.readonly = Boolean(readonly);
|
|
50
|
-
this.computedPath = computedPath;
|
|
51
|
-
this.errors = clone(errors) || [];
|
|
52
|
-
}
|
|
53
|
-
get uploadUrl() {
|
|
54
|
-
return AttachmentsHelper.uploadUrl;
|
|
55
|
-
}
|
|
56
|
-
get jwtLocalStorageKey() {
|
|
57
|
-
return AttachmentsHelper.jwtLocalStorageKey;
|
|
58
|
-
}
|
|
59
53
|
render() {
|
|
60
54
|
return template.call(this);
|
|
61
55
|
}
|
|
@@ -179,54 +173,54 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
|
179
173
|
return [
|
|
180
174
|
SharedStyles,
|
|
181
175
|
AttachmentsStyles,
|
|
182
|
-
css `
|
|
183
|
-
.file-selector__type-dropdown {
|
|
184
|
-
flex-basis: 25%;
|
|
185
|
-
padding-left: 8px;
|
|
186
|
-
padding-right: 8px;
|
|
187
|
-
}
|
|
188
|
-
.file-selector__filename {
|
|
189
|
-
flex-basis: 35%;
|
|
190
|
-
}
|
|
191
|
-
.file-selector__download {
|
|
192
|
-
flex-basis: 10%;
|
|
193
|
-
}
|
|
194
|
-
.file-selector__delete {
|
|
195
|
-
flex-basis: 10%;
|
|
196
|
-
}
|
|
197
|
-
.file-selector-container.with-type-dropdown {
|
|
198
|
-
flex-wrap: nowrap;
|
|
199
|
-
}
|
|
200
|
-
.popup-container {
|
|
201
|
-
padding: 12px 12px 0;
|
|
202
|
-
}
|
|
203
|
-
@media (max-width: 380px) {
|
|
204
|
-
.file-selector-container.with-type-dropdown {
|
|
205
|
-
justify-content: center;
|
|
206
|
-
}
|
|
207
|
-
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
208
|
-
flex-basis: 90%;
|
|
209
|
-
}
|
|
210
|
-
.file-selector__filename {
|
|
211
|
-
flex-basis: 90%;
|
|
212
|
-
}
|
|
213
|
-
.file-selector__download {
|
|
214
|
-
flex-basis: 5%;
|
|
215
|
-
}
|
|
216
|
-
.file-selector__delete {
|
|
217
|
-
flex-basis: 5%;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
@media (max-width: 600px) {
|
|
221
|
-
etools-dropdown {
|
|
222
|
-
padding: 0;
|
|
223
|
-
}
|
|
224
|
-
.file-selector-container.with-type-dropdown {
|
|
225
|
-
border-bottom: 1px solid lightgrey;
|
|
226
|
-
flex-wrap: wrap;
|
|
227
|
-
padding-bottom: 10px;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
176
|
+
css `
|
|
177
|
+
.file-selector__type-dropdown {
|
|
178
|
+
flex-basis: 25%;
|
|
179
|
+
padding-left: 8px;
|
|
180
|
+
padding-right: 8px;
|
|
181
|
+
}
|
|
182
|
+
.file-selector__filename {
|
|
183
|
+
flex-basis: 35%;
|
|
184
|
+
}
|
|
185
|
+
.file-selector__download {
|
|
186
|
+
flex-basis: 10%;
|
|
187
|
+
}
|
|
188
|
+
.file-selector__delete {
|
|
189
|
+
flex-basis: 10%;
|
|
190
|
+
}
|
|
191
|
+
.file-selector-container.with-type-dropdown {
|
|
192
|
+
flex-wrap: nowrap;
|
|
193
|
+
}
|
|
194
|
+
.popup-container {
|
|
195
|
+
padding: 12px 12px 0;
|
|
196
|
+
}
|
|
197
|
+
@media (max-width: 380px) {
|
|
198
|
+
.file-selector-container.with-type-dropdown {
|
|
199
|
+
justify-content: center;
|
|
200
|
+
}
|
|
201
|
+
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
202
|
+
flex-basis: 90%;
|
|
203
|
+
}
|
|
204
|
+
.file-selector__filename {
|
|
205
|
+
flex-basis: 90%;
|
|
206
|
+
}
|
|
207
|
+
.file-selector__download {
|
|
208
|
+
flex-basis: 5%;
|
|
209
|
+
}
|
|
210
|
+
.file-selector__delete {
|
|
211
|
+
flex-basis: 5%;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
@media (max-width: 600px) {
|
|
215
|
+
etools-dropdown {
|
|
216
|
+
padding: 0;
|
|
217
|
+
}
|
|
218
|
+
.file-selector-container.with-type-dropdown {
|
|
219
|
+
border-bottom: 1px solid lightgrey;
|
|
220
|
+
flex-wrap: wrap;
|
|
221
|
+
padding-bottom: 10px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
230
224
|
`
|
|
231
225
|
];
|
|
232
226
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { FormAttachmentsPopup } from './form-attachments-popup';
|
|
2
|
-
import { TemplateResult } from 'lit
|
|
2
|
+
import { TemplateResult } from 'lit';
|
|
3
|
+
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
5
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
6
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
3
7
|
export declare function template(this: FormAttachmentsPopup): TemplateResult;
|
|
@@ -1,91 +1,102 @@
|
|
|
1
|
-
import { html } from 'lit
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
3
|
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
4
4
|
import { getTranslation } from '../lib/utils/translate';
|
|
5
|
+
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog.js';
|
|
6
|
+
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown.js';
|
|
7
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
8
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
5
9
|
export function template() {
|
|
6
10
|
var _a;
|
|
7
|
-
return html `
|
|
8
|
-
${InputStyles} ${DialogStyles}
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
dialog-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
return html `
|
|
12
|
+
${InputStyles} ${DialogStyles}
|
|
13
|
+
<style>
|
|
14
|
+
etools-icon[name='error-outline'] {
|
|
15
|
+
color: var(--etools-upload-danger-color, #ea4022);
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
<etools-dialog
|
|
19
|
+
id="form-attachments-dialog"
|
|
20
|
+
size="md"
|
|
21
|
+
no-padding
|
|
22
|
+
keep-dialog-open
|
|
23
|
+
?opened="${this.dialogOpened}"
|
|
24
|
+
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
25
|
+
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
26
|
+
.hideConfirmBtn="${this.readonly}"
|
|
27
|
+
dialog-title="${this.popupTitle}"
|
|
28
|
+
@close="${this.onClose}"
|
|
29
|
+
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
30
|
+
>
|
|
31
|
+
<!-- Link is used to download attachments -->
|
|
32
|
+
<a id="link" target="_blank" hidden></a>
|
|
33
|
+
|
|
34
|
+
<div class="popup-container">
|
|
26
35
|
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
27
36
|
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
|
-
<
|
|
53
|
-
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<!-- Download Button -->
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
${
|
|
73
|
-
|
|
74
|
-
|
|
37
|
+
return html `
|
|
38
|
+
<div class="file-selector-container with-type-dropdown">
|
|
39
|
+
<!-- Type select Dropdown -->
|
|
40
|
+
<etools-dropdown
|
|
41
|
+
class="type-dropdown file-selector__type-dropdown"
|
|
42
|
+
.selected="${attachment.file_type}"
|
|
43
|
+
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
44
|
+
trigger-value-change-event
|
|
45
|
+
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
46
|
+
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
47
|
+
required
|
|
48
|
+
?readonly="${this.readonly}"
|
|
49
|
+
hide-search
|
|
50
|
+
.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}"
|
|
51
|
+
option-label="label"
|
|
52
|
+
option-value="value"
|
|
53
|
+
?invalid="${this.checkFileType(index)}"
|
|
54
|
+
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
55
|
+
allow-outside-scroll
|
|
56
|
+
dynamic-align
|
|
57
|
+
></etools-dropdown>
|
|
58
|
+
|
|
59
|
+
<!-- File name component -->
|
|
60
|
+
<div class="filename-container file-selector__filename">
|
|
61
|
+
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
62
|
+
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<!-- Download Button -->
|
|
66
|
+
<etools-button
|
|
67
|
+
variant="text"
|
|
68
|
+
?hidden="${!attachment.url}"
|
|
69
|
+
class="download-button file-selector__download"
|
|
70
|
+
@click="${() => this.downloadFile(attachment)}"
|
|
71
|
+
>
|
|
72
|
+
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
73
|
+
${getTranslation(this.language, 'DOWNLOAD')}
|
|
74
|
+
</etools-button>
|
|
75
|
+
|
|
76
|
+
<!-- Delete Button -->
|
|
77
|
+
<etools-button
|
|
78
|
+
variant="text"
|
|
79
|
+
class="danger delete-button file-selector__delete"
|
|
80
|
+
?hidden="${this.readonly}"
|
|
81
|
+
@click="${() => this.deleteAttachment(index)}"
|
|
82
|
+
>
|
|
83
|
+
${getTranslation(this.language, 'DELETE')}
|
|
84
|
+
</etools-button>
|
|
85
|
+
</div>
|
|
75
86
|
`;
|
|
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>
|
|
87
|
+
})}
|
|
88
|
+
|
|
89
|
+
<!-- Upload button -->
|
|
90
|
+
<etools-upload-multi
|
|
91
|
+
class="with-padding"
|
|
92
|
+
activate-offline
|
|
93
|
+
?hidden="${this.readonly}"
|
|
94
|
+
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
95
|
+
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
96
|
+
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
97
|
+
>
|
|
98
|
+
</etools-upload-multi>
|
|
99
|
+
</div>
|
|
100
|
+
</etools-dialog>
|
|
90
101
|
`;
|
|
91
102
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import { FieldValidator } from '../lib/utils/validations.helper';
|
|
3
3
|
/**
|
|
4
4
|
* Class that contains common properties and methods for single and repeatable fields
|