@unicef-polymer/etools-form-builder 3.0.0-rc.17 → 3.0.0-rc.19
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/form-attachments-popup/form-attachments-popup.d.ts +1 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +95 -3
- package/dist/form-fields/abstract-field-base.class.js +5 -19
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +0 -2
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +0 -2
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +0 -5
- package/dist/form-fields/single-fields/boolean-field.js +0 -5
- package/dist/form-fields/single-fields/number-field.js +0 -2
- package/dist/form-fields/single-fields/scale-field.js +0 -2
- package/dist/form-fields/single-fields/text-field.js +0 -2
- package/dist/form-groups/form-abstract-group.js +1 -1
- package/dist/form-groups/form-card.js +6 -0
- package/dist/lib/additional-components/etools-fb-card.js +5 -4
- package/dist/lib/styles/attachments.styles.js +2 -7
- package/dist/lib/styles/card-styles.js +5 -9
- package/dist/lib/styles/dialog.styles.js +1 -1
- package/dist/lib/styles/elevation-styles.d.ts +2 -2
- package/dist/lib/styles/elevation-styles.js +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +10 -3
- package/dist/lib/styles/shared-styles.js +3 -9
- package/package.json +1 -1
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +0 -7
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +0 -102
- package/dist/lib/styles/input-styles.d.ts +0 -2
- package/dist/lib/styles/input-styles.js +0 -143
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
|
|
2
2
|
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
3
3
|
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
4
5
|
import { CSSResultArray, LitElement, TemplateResult } from 'lit';
|
|
5
6
|
import { GenericObject } from '../lib/types/global.types';
|
|
6
7
|
import { BlueprintMetadata } from '../lib/types/form-builder.types';
|
|
@@ -2,16 +2,17 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import '@unicef-polymer/etools-unicef/src/etools-dialog/etools-dialog';
|
|
3
3
|
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
4
4
|
import '@unicef-polymer/etools-unicef/src/etools-dropdown/etools-dropdown';
|
|
5
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
5
6
|
import { deleteFileFromDexie } from '@unicef-polymer/etools-unicef/src/etools-upload/offline/dexie-operations';
|
|
6
|
-
import { css, LitElement } from 'lit';
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
7
8
|
import { property, query, customElement } from 'lit/decorators.js';
|
|
8
9
|
import { clone, equals } from 'ramda';
|
|
9
|
-
import { template } from './form-attachments-popup.tpl';
|
|
10
10
|
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
11
11
|
import { SharedStyles } from '../lib/styles/shared-styles';
|
|
12
12
|
import { AttachmentsStyles } from '../lib/styles/attachments.styles';
|
|
13
13
|
import { AttachmentsHelper } from './form-attachments-popup.helper';
|
|
14
14
|
import { getTranslation } from '../lib/utils/translate';
|
|
15
|
+
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
15
16
|
let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
16
17
|
set dialogData({ attachments, title, metadata, readonly, computedPath, errors }) {
|
|
17
18
|
this.popupTitle = title;
|
|
@@ -62,7 +63,98 @@ let FormAttachmentsPopup = class FormAttachmentsPopup extends LitElement {
|
|
|
62
63
|
this.language = e.detail.language;
|
|
63
64
|
}
|
|
64
65
|
render() {
|
|
65
|
-
|
|
66
|
+
var _a;
|
|
67
|
+
return html `
|
|
68
|
+
${DialogStyles}
|
|
69
|
+
<style>
|
|
70
|
+
etools-icon[name='error-outline'] {
|
|
71
|
+
color: var(--etools-upload-danger-color, #ea4022);
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
<etools-dialog
|
|
75
|
+
id="form-attachments-dialog"
|
|
76
|
+
size="md"
|
|
77
|
+
no-padding
|
|
78
|
+
keep-dialog-open
|
|
79
|
+
?opened="${this.dialogOpened}"
|
|
80
|
+
.okBtnText="${getTranslation(this.language, 'SAVE')}"
|
|
81
|
+
.cancelBtnText="${getTranslation(this.language, 'CANCEL')}"
|
|
82
|
+
.hideConfirmBtn="${this.readonly}"
|
|
83
|
+
dialog-title="${this.popupTitle}"
|
|
84
|
+
@close="${this.onClose}"
|
|
85
|
+
@confirm-btn-clicked="${() => this.saveChanges()}"
|
|
86
|
+
>
|
|
87
|
+
<!-- Link is used to download attachments -->
|
|
88
|
+
<a id="link" target="_blank" hidden></a>
|
|
89
|
+
|
|
90
|
+
<div class="popup-container">
|
|
91
|
+
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
return html `
|
|
94
|
+
<div class="file-selector-container with-type-dropdown">
|
|
95
|
+
<!-- Type select Dropdown -->
|
|
96
|
+
<etools-dropdown
|
|
97
|
+
class="type-dropdown file-selector__type-dropdown"
|
|
98
|
+
.selected="${attachment.file_type}"
|
|
99
|
+
@etools-selected-item-changed="${({ detail }) => { var _a; return this.changeFileType(attachment, (_a = detail.selectedItem) === null || _a === void 0 ? void 0 : _a.value, index); }}"
|
|
100
|
+
trigger-value-change-event
|
|
101
|
+
label="${getTranslation(this.language, 'DOCUMENT_TYPE')}"
|
|
102
|
+
placeholder="${getTranslation(this.language, 'SELECT_DOCUMENT_TYPE')}"
|
|
103
|
+
required
|
|
104
|
+
?readonly="${this.readonly}"
|
|
105
|
+
hide-search
|
|
106
|
+
.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}"
|
|
107
|
+
option-label="label"
|
|
108
|
+
option-value="value"
|
|
109
|
+
?invalid="${this.checkFileType(index)}"
|
|
110
|
+
.errorMessage="${this.retrieveErrorMessage(index)}"
|
|
111
|
+
allow-outside-scroll
|
|
112
|
+
dynamic-align
|
|
113
|
+
></etools-dropdown>
|
|
114
|
+
|
|
115
|
+
<!-- File name component -->
|
|
116
|
+
<div class="filename-container file-selector__filename">
|
|
117
|
+
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
118
|
+
<span class="filename" title="${attachment.filename}">${attachment.filename}</span>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<!-- Download Button -->
|
|
122
|
+
<etools-button
|
|
123
|
+
variant="text"
|
|
124
|
+
?hidden="${!attachment.url}"
|
|
125
|
+
class="download-button file-selector__download"
|
|
126
|
+
@click="${() => this.downloadFile(attachment)}"
|
|
127
|
+
>
|
|
128
|
+
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
129
|
+
${getTranslation(this.language, 'DOWNLOAD')}
|
|
130
|
+
</etools-button>
|
|
131
|
+
|
|
132
|
+
<!-- Delete Button -->
|
|
133
|
+
<etools-button
|
|
134
|
+
variant="text"
|
|
135
|
+
class="danger delete-button file-selector__delete"
|
|
136
|
+
?hidden="${this.readonly}"
|
|
137
|
+
@click="${() => this.deleteAttachment(index)}"
|
|
138
|
+
>
|
|
139
|
+
${getTranslation(this.language, 'DELETE')}
|
|
140
|
+
</etools-button>
|
|
141
|
+
</div>
|
|
142
|
+
`;
|
|
143
|
+
})}
|
|
144
|
+
|
|
145
|
+
<!-- Upload button -->
|
|
146
|
+
<etools-upload-multi
|
|
147
|
+
class="with-padding"
|
|
148
|
+
activate-offline
|
|
149
|
+
?hidden="${this.readonly}"
|
|
150
|
+
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
151
|
+
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
152
|
+
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
153
|
+
>
|
|
154
|
+
</etools-upload-multi>
|
|
155
|
+
</div>
|
|
156
|
+
</etools-dialog>
|
|
157
|
+
`;
|
|
66
158
|
}
|
|
67
159
|
/**
|
|
68
160
|
* on Cancel button click
|
|
@@ -121,37 +121,23 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
121
121
|
border: 1px solid;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.full-width
|
|
125
|
-
paper-input,
|
|
126
|
-
paper-textarea {
|
|
124
|
+
.full-width {
|
|
127
125
|
width: 100%;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
.question-text {
|
|
131
129
|
font-weight: 500;
|
|
132
|
-
font-size: 13px;
|
|
130
|
+
font-size: var(--etools-font-size-13, 13px);
|
|
133
131
|
color: var(--primary-text-color);
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
|
|
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'] {
|
|
134
|
+
etools-icon[name='close'] {
|
|
149
135
|
cursor: pointer;
|
|
150
136
|
}
|
|
151
137
|
|
|
152
138
|
.error-text {
|
|
153
139
|
color: var(--error-color);
|
|
154
|
-
font-size: 12px;
|
|
140
|
+
font-size: var(--etools-font-size-12, 12px);
|
|
155
141
|
}
|
|
156
142
|
|
|
157
143
|
@media (max-width: 1080px) {
|
|
@@ -176,7 +162,7 @@ export class AbstractFieldBaseClass extends LitElement {
|
|
|
176
162
|
min-height: 150px;
|
|
177
163
|
}
|
|
178
164
|
|
|
179
|
-
.question-control .container
|
|
165
|
+
.question-control .container etools-radio-group {
|
|
180
166
|
flex-direction: column;
|
|
181
167
|
opacity: 1 !important;
|
|
182
168
|
}
|
|
@@ -2,7 +2,6 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
|
|
5
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
6
5
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
7
6
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
8
7
|
import { getTranslation } from '../../lib/utils/translate';
|
|
@@ -13,7 +12,6 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
|
|
|
13
12
|
}
|
|
14
13
|
controlTemplate(value, index) {
|
|
15
14
|
return html `
|
|
16
|
-
${InputStyles}
|
|
17
15
|
<etools-input
|
|
18
16
|
class="no-padding-left"
|
|
19
17
|
no-label-float
|
|
@@ -5,7 +5,6 @@ import { repeat } from 'lit/directives/repeat.js';
|
|
|
5
5
|
import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
|
|
6
6
|
import '@shoelace-style/shoelace/dist/components/radio/radio.js';
|
|
7
7
|
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
8
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
9
8
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
10
9
|
import { getTranslation } from '../../lib/utils/translate';
|
|
11
10
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
@@ -16,7 +15,6 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
|
|
|
16
15
|
}
|
|
17
16
|
controlTemplate(value, index) {
|
|
18
17
|
return html `
|
|
19
|
-
${InputStyles}
|
|
20
18
|
<div class="container">
|
|
21
19
|
<etools-radio-group
|
|
22
20
|
class="radio-group"
|
|
@@ -2,13 +2,11 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
|
|
5
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
6
5
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
7
6
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
8
7
|
let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField {
|
|
9
8
|
controlTemplate(value, index) {
|
|
10
9
|
return html `
|
|
11
|
-
${InputStyles}
|
|
12
10
|
<etools-textarea
|
|
13
11
|
id="textarea"
|
|
14
12
|
class="no-padding-left"
|
|
@@ -31,9 +29,6 @@ let RepeatableTextField = class RepeatableTextField extends RepeatableBaseField
|
|
|
31
29
|
return [
|
|
32
30
|
...AbstractFieldBaseClass.styles,
|
|
33
31
|
css `
|
|
34
|
-
:host(.wide) paper-textarea {
|
|
35
|
-
padding-left: 0;
|
|
36
|
-
}
|
|
37
32
|
@media (max-width: 380px) {
|
|
38
33
|
.no-padding-left {
|
|
39
34
|
padding-left: 0;
|
|
@@ -2,12 +2,10 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { BaseField } from './base-field';
|
|
5
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
6
5
|
import '@shoelace-style/shoelace/dist/components/switch/switch.js';
|
|
7
6
|
let BooleanField = class BooleanField extends BaseField {
|
|
8
7
|
controlTemplate() {
|
|
9
8
|
return html `
|
|
10
|
-
${InputStyles}
|
|
11
9
|
<sl-switch
|
|
12
10
|
class="no-padding-left"
|
|
13
11
|
?checked="${this.value}"
|
|
@@ -27,9 +25,6 @@ let BooleanField = class BooleanField extends BaseField {
|
|
|
27
25
|
return [
|
|
28
26
|
...BaseField.styles,
|
|
29
27
|
css `
|
|
30
|
-
:host(.wide) paper-textarea {
|
|
31
|
-
padding-left: 0;
|
|
32
|
-
}
|
|
33
28
|
@media (max-width: 380px) {
|
|
34
29
|
.no-padding-left {
|
|
35
30
|
padding-left: 0;
|
|
@@ -3,7 +3,6 @@ import { css, html } from 'lit';
|
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { BaseField } from './base-field';
|
|
5
5
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
|
|
6
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
7
6
|
import { getTranslation } from '../../lib/utils/translate';
|
|
8
7
|
let NumberField = class NumberField extends BaseField {
|
|
9
8
|
constructor() {
|
|
@@ -12,7 +11,6 @@ let NumberField = class NumberField extends BaseField {
|
|
|
12
11
|
}
|
|
13
12
|
controlTemplate() {
|
|
14
13
|
return html `
|
|
15
|
-
${InputStyles}
|
|
16
14
|
<etools-input
|
|
17
15
|
class="no-padding-left"
|
|
18
16
|
no-label-float
|
|
@@ -6,7 +6,6 @@ import { repeat } from 'lit/directives/repeat.js';
|
|
|
6
6
|
import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
|
|
7
7
|
import '@shoelace-style/shoelace/dist/components/radio/radio.js';
|
|
8
8
|
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
9
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
10
9
|
import { getTranslation } from '../../lib/utils/translate';
|
|
11
10
|
let ScaleField = class ScaleField extends BaseField {
|
|
12
11
|
constructor() {
|
|
@@ -15,7 +14,6 @@ let ScaleField = class ScaleField extends BaseField {
|
|
|
15
14
|
}
|
|
16
15
|
controlTemplate() {
|
|
17
16
|
return html `
|
|
18
|
-
${InputStyles}
|
|
19
17
|
<div class="container">
|
|
20
18
|
<etools-radio-group
|
|
21
19
|
class="radio-group"
|
|
@@ -3,11 +3,9 @@ import { css, html } from 'lit';
|
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { BaseField } from './base-field';
|
|
5
5
|
import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
|
|
6
|
-
import { InputStyles } from '../../lib/styles/input-styles';
|
|
7
6
|
let TextField = class TextField extends BaseField {
|
|
8
7
|
controlTemplate() {
|
|
9
8
|
return html `
|
|
10
|
-
${InputStyles}
|
|
11
9
|
<etools-textarea
|
|
12
10
|
id="otherInfo"
|
|
13
11
|
class="no-padding-left"
|
|
@@ -48,6 +48,12 @@ let FormCard = class FormCard extends FormAbstractGroup {
|
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
50
|
return html `
|
|
51
|
+
<style>
|
|
52
|
+
.card-buttons {
|
|
53
|
+
padding: 12px 24px;
|
|
54
|
+
padding-top: 0;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
51
57
|
<section class="elevation page-content card-container form-card" elevation="1">
|
|
52
58
|
<div class="card-header">
|
|
53
59
|
<div class="title">${this.groupStructure.title}</div>
|
|
@@ -20,8 +20,8 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
etools-icon {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 6px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.card-container {
|
|
@@ -45,7 +45,8 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
45
45
|
--sl-color-primary-500: var(--primary-color);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.edit-button,
|
|
48
|
+
.edit-button,
|
|
49
|
+
etools-icon[name='create'] {
|
|
49
50
|
color: var(--gray-mid);
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -63,7 +64,7 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
63
64
|
flex-basis: auto;
|
|
64
65
|
}
|
|
65
66
|
.flex-header__title {
|
|
66
|
-
font-size: 18px;
|
|
67
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
67
68
|
flex-basis: auto;
|
|
68
69
|
flex-grow: 1;
|
|
69
70
|
overflow: hidden;
|
|
@@ -14,7 +14,7 @@ export const AttachmentsStyles = css `
|
|
|
14
14
|
margin: 0 14px 0 0;
|
|
15
15
|
min-width: 145px;
|
|
16
16
|
overflow-wrap: break-word;
|
|
17
|
-
font-size: 16px;
|
|
17
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
18
18
|
}
|
|
19
19
|
:host([is-readonly]) .filename-container {
|
|
20
20
|
border-bottom-color: transparent;
|
|
@@ -37,14 +37,9 @@ export const AttachmentsStyles = css `
|
|
|
37
37
|
.change-button {
|
|
38
38
|
color: var(--secondary-text-color, rgba(0, 0, 0, 0.54));
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
etools-icon {
|
|
41
41
|
margin-right: 8px;
|
|
42
42
|
}
|
|
43
|
-
paper-button {
|
|
44
|
-
font-weight: 700;
|
|
45
|
-
margin: 0 0;
|
|
46
|
-
padding: 0 0;
|
|
47
|
-
}
|
|
48
43
|
.file-selector-container.with-type-dropdown {
|
|
49
44
|
padding: 0;
|
|
50
45
|
}
|
|
@@ -18,11 +18,11 @@ export const CardStyles = css `
|
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
white-space: nowrap;
|
|
20
20
|
text-overflow: ellipsis;
|
|
21
|
-
font-size: 18px;
|
|
21
|
+
font-size: var(--etools-font-size-18, 18px);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.card-title-box .card-title.counter {
|
|
25
|
-
font-size: 20px;
|
|
25
|
+
font-size: var(--etools-font-size-20, 20px);
|
|
26
26
|
font-weight: 500;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -61,7 +61,7 @@ export const CardStyles = css `
|
|
|
61
61
|
z-index: 100;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.editable-row .hover-block
|
|
64
|
+
.editable-row .hover-block etools-icon-button {
|
|
65
65
|
color: rgba(0, 0, 0, 0.54);
|
|
66
66
|
padding-left: 5px;
|
|
67
67
|
}
|
|
@@ -108,7 +108,7 @@ export const CardStyles = css `
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.row-details-content {
|
|
111
|
-
font-size: 12px;
|
|
111
|
+
font-size: var(--etools-font-size-12, 12px);
|
|
112
112
|
padding-right: 100px;
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -136,16 +136,12 @@ export const CardStyles = css `
|
|
|
136
136
|
|
|
137
137
|
.remove-title {
|
|
138
138
|
padding: 16px 25px 15px;
|
|
139
|
-
font-size:
|
|
139
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
140
140
|
color: rgba(0, 0, 0, 0.87);
|
|
141
141
|
font-weight: 500;
|
|
142
142
|
line-height: 28px;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
paper-textarea {
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
145
|
a.link-cell {
|
|
150
146
|
font-weight: 500;
|
|
151
147
|
text-decoration: none;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CSSResult } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* LitElement css version for used
|
|
3
|
+
* LitElement css version for used material-styles
|
|
4
4
|
* TODO:
|
|
5
5
|
* - use only in new litElements
|
|
6
6
|
* - add more elevations if needed
|
|
7
|
-
* - replace all
|
|
7
|
+
* - replace all material-styles with this css module
|
|
8
8
|
*/
|
|
9
9
|
export declare const elevationStyles: CSSResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* LitElement css version for used
|
|
3
|
+
* LitElement css version for used material-styles
|
|
4
4
|
* TODO:
|
|
5
5
|
* - use only in new litElements
|
|
6
6
|
* - add more elevations if needed
|
|
7
|
-
* - replace all
|
|
7
|
+
* - replace all material-styles with this css module
|
|
8
8
|
*/
|
|
9
9
|
// language=CSS
|
|
10
10
|
export const elevationStyles = css `
|
|
@@ -22,11 +22,12 @@ export const FormBuilderCardStyles = css `
|
|
|
22
22
|
box-shadow: 0 0 5px 5px rgb(170 165 165 / 20%);
|
|
23
23
|
background-color: rgba(170, 165, 165, 0.2);
|
|
24
24
|
}
|
|
25
|
-
.attachments-button
|
|
25
|
+
.attachments-button etools-icon {
|
|
26
26
|
margin-right: 8px;
|
|
27
27
|
}
|
|
28
28
|
.question-container {
|
|
29
29
|
padding: 7px 0;
|
|
30
|
+
padding-right: 10px;
|
|
30
31
|
width: 100%;
|
|
31
32
|
min-height: 57px;
|
|
32
33
|
box-sizing: border-box;
|
|
@@ -34,11 +35,11 @@ export const FormBuilderCardStyles = css `
|
|
|
34
35
|
}
|
|
35
36
|
.question-text {
|
|
36
37
|
font-weight: 500;
|
|
37
|
-
font-size: 13px;
|
|
38
|
+
font-size: var(--etools-font-size-13, 13px);
|
|
38
39
|
color: var(--primary-text-color);
|
|
39
40
|
}
|
|
40
41
|
.question-details {
|
|
41
|
-
font-size:
|
|
42
|
+
font-size: var(--etools-font-size-10, 10px);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
@media (max-width: 380px) {
|
|
@@ -46,4 +47,10 @@ export const FormBuilderCardStyles = css `
|
|
|
46
47
|
padding: 5px;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
|
|
51
|
+
@media (max-width: 1080px) {
|
|
52
|
+
.question-container {
|
|
53
|
+
padding-right: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
49
56
|
`;
|
|
@@ -19,11 +19,11 @@ export const SharedStyles = css `
|
|
|
19
19
|
|
|
20
20
|
h1 {
|
|
21
21
|
text-transform: capitalize;
|
|
22
|
-
font-size: 24px;
|
|
22
|
+
font-size: var(--etools-font-size-24, 24px);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
h2 {
|
|
26
|
-
font-size: 20px;
|
|
26
|
+
font-size: var(--etools-font-size-20, 20px);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
a {
|
|
@@ -47,13 +47,7 @@ export const SharedStyles = css `
|
|
|
47
47
|
|
|
48
48
|
.toggle-button-control span {
|
|
49
49
|
padding: 0 12px;
|
|
50
|
-
font-size: 16px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.toggle-button-control paper-checkbox {
|
|
54
|
-
--paper-checkbox-label: {
|
|
55
|
-
padding-left: 0;
|
|
56
|
-
}
|
|
50
|
+
font-size: var(--etools-font-size-16, 16px);
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
.readonly {
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FormAttachmentsPopup } from './form-attachments-popup';
|
|
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';
|
|
7
|
-
export declare function template(this: FormAttachmentsPopup): TemplateResult;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { InputStyles } from '../lib/styles/input-styles';
|
|
3
|
-
import { DialogStyles } from '../lib/styles/dialog.styles';
|
|
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';
|
|
9
|
-
export function template() {
|
|
10
|
-
var _a;
|
|
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">
|
|
35
|
-
${(_a = this.attachments) === null || _a === void 0 ? void 0 : _a.map((attachment, index) => {
|
|
36
|
-
var _a, _b;
|
|
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>
|
|
86
|
-
`;
|
|
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>
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
// language=HTML
|
|
3
|
-
export const InputStyles = html `
|
|
4
|
-
<style>
|
|
5
|
-
etools-dropdown,
|
|
6
|
-
etools-dropdown-multi,
|
|
7
|
-
paper-input,
|
|
8
|
-
paper-textarea,
|
|
9
|
-
paper-dropdown-menu,
|
|
10
|
-
etools-currency-amount-input,
|
|
11
|
-
datepicker-lite {
|
|
12
|
-
outline: none !important;
|
|
13
|
-
padding: 0 12px;
|
|
14
|
-
color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
|
|
17
|
-
--paper-input-container-input-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
18
|
-
--esmm-placeholder-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
19
|
-
--esmm-multi-placeholder-color: var(--gray-dark, rgba(0, 0, 0, 0.87));
|
|
20
|
-
|
|
21
|
-
--paper-input-container-focus-color: var(--primary-color, #0099ff);
|
|
22
|
-
|
|
23
|
-
--paper-input-container-label: {
|
|
24
|
-
color: var(--gray-50, rgba(0, 0, 0, 0.5));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
--paper-input-container-invalid-color: var(--module-error, #ea4022);
|
|
28
|
-
|
|
29
|
-
--paper-input-char-counter: {
|
|
30
|
-
color: var(--gray-light, rgba(0, 0, 0, 0.38));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
--paper-input-container-label-floating: {
|
|
34
|
-
-webkit-transform: none;
|
|
35
|
-
-moz-transform: none;
|
|
36
|
-
-ms-transform: none;
|
|
37
|
-
-o-transform: none;
|
|
38
|
-
transform: none;
|
|
39
|
-
top: -21px;
|
|
40
|
-
width: 100%;
|
|
41
|
-
font-size: 12px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
--etools-currency-container-label-floating: {
|
|
45
|
-
-webkit-transform: none;
|
|
46
|
-
-moz-transform: none;
|
|
47
|
-
-ms-transform: none;
|
|
48
|
-
-o-transform: none;
|
|
49
|
-
transform: none;
|
|
50
|
-
top: -21px;
|
|
51
|
-
width: 100%;
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
--paper-input-container-shared-input-style: {
|
|
56
|
-
font-size: 16px;
|
|
57
|
-
width: 100%;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
--paper-input-prefix: {
|
|
61
|
-
margin-right: 10px;
|
|
62
|
-
color: var(--gray-mid, rgba(0, 0, 0, 0.54));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
--paper-input-error: {
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
--iron-autogrow-textarea: {
|
|
70
|
-
padding: 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
etools-dropdown-multi[disabled],
|
|
75
|
-
etools-dropdown[disabled],
|
|
76
|
-
paper-textarea[disabled],
|
|
77
|
-
paper-dropdown-menu[disabled],
|
|
78
|
-
paper-input[disabled],
|
|
79
|
-
datepicker-lite[disabled] {
|
|
80
|
-
--paper-input-container: {
|
|
81
|
-
opacity: 1 !important;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
--paper-input-container-underline-focus: {
|
|
85
|
-
display: none;
|
|
86
|
-
}
|
|
87
|
-
--esmm-select-cursor: initial;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
etools-dropdown-multi[readonly],
|
|
91
|
-
etools-dropdown[readonly],
|
|
92
|
-
paper-textarea[readonly],
|
|
93
|
-
paper-dropdown-menu[readonly],
|
|
94
|
-
paper-input[readonly],
|
|
95
|
-
datepicker-lite[readonly] {
|
|
96
|
-
--paper-input-container-underline_-_display: none;
|
|
97
|
-
--paper-input-container-underline-focus_-_display: none;
|
|
98
|
-
--paper-input-container: {
|
|
99
|
-
opacity: 1 !important;
|
|
100
|
-
}
|
|
101
|
-
--paper-input-container-underline: {
|
|
102
|
-
border-bottom: none !important;
|
|
103
|
-
display: none !important;
|
|
104
|
-
}
|
|
105
|
-
--paper-input-container-underline-focus: {
|
|
106
|
-
display: none;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
--esmm-select-cursor: initial;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
etools-dropdown-multi.required:not([disabled]),
|
|
113
|
-
etools-dropdown-multi[required]:not([disabled]),
|
|
114
|
-
etools-dropdown-multi[required].readonly-required,
|
|
115
|
-
etools-dropdown.required:not([disabled]),
|
|
116
|
-
etools-dropdown[required]:not([disabled]),
|
|
117
|
-
etools-dropdown[required].readonly-required,
|
|
118
|
-
paper-dropdown-menu.required:not([disabled]),
|
|
119
|
-
paper-dropdown-menu[required]:not([disabled]),
|
|
120
|
-
paper-dropdown-menu[required].readonly-required,
|
|
121
|
-
paper-textarea.required:not([disabled]),
|
|
122
|
-
paper-textarea[required]:not([disabled]),
|
|
123
|
-
paper-textarea[required].readonly-required,
|
|
124
|
-
paper-input.required:not([disabled]),
|
|
125
|
-
paper-input[required].readonly-required,
|
|
126
|
-
paper-input[required]:not([disabled]) {
|
|
127
|
-
--paper-input-container-label: {
|
|
128
|
-
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')
|
|
129
|
-
no-repeat 98% 14%/7px;
|
|
130
|
-
width: auto !important;
|
|
131
|
-
max-width: max-content;
|
|
132
|
-
right: auto;
|
|
133
|
-
padding-right: 15px;
|
|
134
|
-
color: var(--gray-50, rgba(0, 0, 0, 0.5));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
sl-radio {
|
|
138
|
-
display: inline-block;
|
|
139
|
-
margin-inline-end: 15px;
|
|
140
|
-
--sl-input-font-size-medium: 14px;
|
|
141
|
-
}
|
|
142
|
-
</style>
|
|
143
|
-
`;
|