@unicef-polymer/etools-form-builder 2.1.9 → 3.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/README.md +1 -1
- package/dist/assets/translations.d.ts +0 -0
- package/dist/assets/translations.js +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +10 -12
- package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.helper.js +0 -0
- package/dist/form-attachments-popup/form-attachments-popup.js +70 -76
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +5 -1
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +92 -81
- package/dist/form-attachments-popup/index.d.ts +0 -0
- package/dist/form-attachments-popup/index.js +0 -0
- package/dist/form-fields/abstract-field-base.class.d.ts +1 -1
- package/dist/form-fields/abstract-field-base.class.js +131 -135
- package/dist/form-fields/field-renderer-component.d.ts +1 -1
- package/dist/form-fields/field-renderer-component.js +150 -154
- package/dist/form-fields/index.d.ts +0 -0
- package/dist/form-fields/index.js +0 -0
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +4 -2
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +117 -117
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +2 -1
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +26 -29
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +2 -2
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +24 -28
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +5 -5
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +68 -72
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +2 -2
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +27 -31
- package/dist/form-fields/single-fields/attachment-field.d.ts +2 -2
- package/dist/form-fields/single-fields/attachment-field.js +17 -21
- package/dist/form-fields/single-fields/base-field.d.ts +1 -1
- package/dist/form-fields/single-fields/base-field.js +2 -7
- package/dist/form-fields/single-fields/boolean-field.d.ts +2 -2
- package/dist/form-fields/single-fields/boolean-field.js +24 -28
- package/dist/form-fields/single-fields/number-field.d.ts +2 -2
- package/dist/form-fields/single-fields/number-field.js +25 -29
- package/dist/form-fields/single-fields/scale-field.d.ts +6 -6
- package/dist/form-fields/single-fields/scale-field.js +69 -70
- package/dist/form-fields/single-fields/text-field.d.ts +2 -2
- package/dist/form-fields/single-fields/text-field.js +28 -33
- package/dist/form-groups/form-abstract-group.d.ts +3 -2
- package/dist/form-groups/form-abstract-group.js +147 -144
- package/dist/form-groups/form-card.d.ts +5 -2
- package/dist/form-groups/form-card.js +39 -32
- package/dist/form-groups/form-collapsed-card.d.ts +4 -4
- package/dist/form-groups/form-collapsed-card.js +60 -54
- package/dist/form-groups/index.d.ts +0 -0
- package/dist/form-groups/index.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/lib/additional-components/confirmation-dialog.d.ts +1 -1
- package/dist/lib/additional-components/confirmation-dialog.js +29 -33
- package/dist/lib/additional-components/etools-fb-card.d.ts +2 -2
- package/dist/lib/additional-components/etools-fb-card.js +147 -156
- package/dist/lib/styles/attachments.styles.d.ts +1 -1
- package/dist/lib/styles/attachments.styles.js +67 -70
- package/dist/lib/styles/card-styles.d.ts +1 -1
- package/dist/lib/styles/card-styles.js +152 -152
- package/dist/lib/styles/dialog.styles.d.ts +1 -1
- package/dist/lib/styles/dialog.styles.js +84 -83
- package/dist/lib/styles/elevation-styles.d.ts +1 -1
- package/dist/lib/styles/elevation-styles.js +34 -34
- package/dist/lib/styles/flex-layout-classes.d.ts +1 -1
- package/dist/lib/styles/flex-layout-classes.js +317 -317
- package/dist/lib/styles/form-builder-card.styles.d.ts +1 -1
- package/dist/lib/styles/form-builder-card.styles.js +47 -47
- package/dist/lib/styles/input-styles.d.ts +1 -1
- package/dist/lib/styles/input-styles.js +141 -136
- package/dist/lib/styles/page-layout-styles.d.ts +1 -1
- package/dist/lib/styles/page-layout-styles.js +199 -199
- package/dist/lib/styles/shared-styles.d.ts +1 -1
- package/dist/lib/styles/shared-styles.js +68 -68
- package/dist/lib/types/form-builder.interfaces.d.ts +2 -1
- package/dist/lib/types/form-builder.interfaces.js +1 -0
- package/dist/lib/types/form-builder.types.d.ts +7 -7
- package/dist/lib/types/form-builder.types.js +1 -0
- package/dist/lib/types/global.types.d.ts +2 -2
- package/dist/lib/types/global.types.js +1 -0
- package/dist/lib/utils/dialog.d.ts +0 -0
- package/dist/lib/utils/dialog.js +0 -0
- package/dist/lib/utils/fire-custom-event.d.ts +0 -0
- package/dist/lib/utils/fire-custom-event.js +0 -0
- package/dist/lib/utils/translate.d.ts +0 -0
- package/dist/lib/utils/translate.js +0 -0
- package/dist/lib/utils/validations.helper.d.ts +5 -5
- package/dist/lib/utils/validations.helper.js +0 -0
- package/package.json +55 -56
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import '@unicef-polymer/etools-upload/etools-upload';
|
|
1
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
|
|
2
2
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
3
3
|
import { StoredAttachment, UploadFinishedDetails } from '../../form-attachments-popup';
|
|
4
|
-
import {
|
|
4
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
5
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
6
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
5
7
|
export declare class RepeatableAttachmentField extends RepeatableBaseField<StoredAttachment> {
|
|
6
8
|
get uploadUrl(): string;
|
|
7
9
|
get jwtLocalStorageKey(): string;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 '@unicef-polymer/etools-upload/etools-upload';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload';
|
|
8
3
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
9
4
|
import { AttachmentsHelper } from '../../form-attachments-popup';
|
|
10
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { customElement } from 'lit/decorators.js';
|
|
11
7
|
import { fireEvent } from '../../lib/utils/fire-custom-event';
|
|
12
8
|
import { SharedStyles } from '../../lib/styles/shared-styles';
|
|
13
9
|
import { AttachmentsStyles } from '../../lib/styles/attachments.styles';
|
|
14
10
|
import { getTranslation } from '../../lib/utils/translate';
|
|
11
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
12
|
+
import '@unicef-polymer/etools-unicef/src/etools-upload/etools-upload-multi';
|
|
15
13
|
let RepeatableAttachmentField = class RepeatableAttachmentField extends RepeatableBaseField {
|
|
16
14
|
constructor() {
|
|
17
15
|
super(...arguments);
|
|
@@ -26,53 +24,55 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
|
|
|
26
24
|
render() {
|
|
27
25
|
var _a;
|
|
28
26
|
const values = this.getValues();
|
|
29
|
-
return html `
|
|
30
|
-
<div class="finding-container">
|
|
31
|
-
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
32
|
-
<div class="question-control layout vertical center-justified start">
|
|
27
|
+
return html `
|
|
28
|
+
<div class="finding-container">
|
|
29
|
+
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
30
|
+
<div class="question-control layout vertical center-justified start">
|
|
33
31
|
${values.map((value, index) => value
|
|
34
|
-
? html `
|
|
35
|
-
<div class="layout horizontal file-container">
|
|
36
|
-
<!-- File name component -->
|
|
37
|
-
<div class="filename-container file-selector__filename">
|
|
38
|
-
<
|
|
39
|
-
<span class="filename" title="${value.filename}">${value.filename}</span>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<!-- Download Button -->
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
${
|
|
59
|
-
|
|
60
|
-
|
|
32
|
+
? html `
|
|
33
|
+
<div class="layout horizontal file-container">
|
|
34
|
+
<!-- File name component -->
|
|
35
|
+
<div class="filename-container file-selector__filename">
|
|
36
|
+
<etools-icon class="file-icon" name="attachment"></etools-icon>
|
|
37
|
+
<span class="filename" title="${value.filename}">${value.filename}</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Download Button -->
|
|
41
|
+
<etools-button
|
|
42
|
+
class="neutral download-button file-selector__download"
|
|
43
|
+
variant="text"
|
|
44
|
+
?hidden="${!value.url}"
|
|
45
|
+
@click="${() => this.downloadFile(value)}"
|
|
46
|
+
>
|
|
47
|
+
<etools-icon name="cloud-download" class="dw-icon" slot="prefix"></etools-icon>
|
|
48
|
+
${getTranslation(this.language, 'DOWNLOAD')}
|
|
49
|
+
</etools-button>
|
|
50
|
+
|
|
51
|
+
<!-- Delete Button -->
|
|
52
|
+
<etools-button
|
|
53
|
+
variant="danger"
|
|
54
|
+
class="file-selector__delete"
|
|
55
|
+
?hidden="${this.isReadonly}"
|
|
56
|
+
@click="${() => this.removeControl(index)}"
|
|
57
|
+
>
|
|
58
|
+
${getTranslation(this.language, 'DELETE')}
|
|
59
|
+
</etools-button>
|
|
60
|
+
</div>
|
|
61
61
|
`
|
|
62
|
-
: '')}
|
|
63
|
-
<!-- Upload button -->
|
|
64
|
-
<etools-upload-multi
|
|
65
|
-
class="with-padding"
|
|
66
|
-
activate-offline
|
|
67
|
-
?hidden="${this.isReadonly}"
|
|
68
|
-
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
69
|
-
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
70
|
-
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
71
|
-
>
|
|
72
|
-
</etools-upload-multi>
|
|
73
|
-
<div ?hidden="${!this.isReadonly || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length)}">—</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
62
|
+
: '')}
|
|
63
|
+
<!-- Upload button -->
|
|
64
|
+
<etools-upload-multi
|
|
65
|
+
class="with-padding"
|
|
66
|
+
activate-offline
|
|
67
|
+
?hidden="${this.isReadonly}"
|
|
68
|
+
@upload-finished="${({ detail }) => this.attachmentsUploaded(detail)}"
|
|
69
|
+
.endpointInfo="${{ endpoint: this.uploadUrl, extraInfo: { composedPath: this.computedPath } }}"
|
|
70
|
+
.jwtLocalStorageKey="${this.jwtLocalStorageKey}"
|
|
71
|
+
>
|
|
72
|
+
</etools-upload-multi>
|
|
73
|
+
<div ?hidden="${!this.isReadonly || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length)}">—</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
76
|
`;
|
|
77
77
|
}
|
|
78
78
|
controlTemplate() {
|
|
@@ -135,70 +135,70 @@ let RepeatableAttachmentField = class RepeatableAttachmentField extends Repeatab
|
|
|
135
135
|
...RepeatableBaseField.styles,
|
|
136
136
|
SharedStyles,
|
|
137
137
|
AttachmentsStyles,
|
|
138
|
-
css `
|
|
139
|
-
.file-selector__type-dropdown {
|
|
140
|
-
flex-basis: 25%;
|
|
141
|
-
padding-left: 8px;
|
|
142
|
-
padding-right: 8px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.file-selector__filename {
|
|
146
|
-
flex-basis: 35%;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.file-selector__download {
|
|
150
|
-
flex-basis: 10%;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.file-selector__delete {
|
|
154
|
-
flex-basis: 10%;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.file-selector-container.with-type-dropdown {
|
|
158
|
-
flex-wrap: nowrap;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.popup-container {
|
|
162
|
-
padding: 12px 12px 0;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.file-container {
|
|
166
|
-
padding: 8px 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@media (max-width: 380px) {
|
|
170
|
-
.file-selector-container.with-type-dropdown {
|
|
171
|
-
justify-content: center;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
175
|
-
flex-basis: 90%;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.file-selector__filename {
|
|
179
|
-
flex-basis: 90%;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.file-selector__download {
|
|
183
|
-
flex-basis: 5%;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.file-selector__delete {
|
|
187
|
-
flex-basis: 5%;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
@media (max-width: 600px) {
|
|
192
|
-
etools-dropdown {
|
|
193
|
-
padding: 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.file-selector-container.with-type-dropdown {
|
|
197
|
-
border-bottom: 1px solid lightgrey;
|
|
198
|
-
flex-wrap: wrap;
|
|
199
|
-
padding-bottom: 10px;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
138
|
+
css `
|
|
139
|
+
.file-selector__type-dropdown {
|
|
140
|
+
flex-basis: 25%;
|
|
141
|
+
padding-left: 8px;
|
|
142
|
+
padding-right: 8px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.file-selector__filename {
|
|
146
|
+
flex-basis: 35%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.file-selector__download {
|
|
150
|
+
flex-basis: 10%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.file-selector__delete {
|
|
154
|
+
flex-basis: 10%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.file-selector-container.with-type-dropdown {
|
|
158
|
+
flex-wrap: nowrap;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.popup-container {
|
|
162
|
+
padding: 12px 12px 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.file-container {
|
|
166
|
+
padding: 8px 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@media (max-width: 380px) {
|
|
170
|
+
.file-selector-container.with-type-dropdown {
|
|
171
|
+
justify-content: center;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.file-selector-container.with-type-dropdown etools-dropdown.type-dropdown {
|
|
175
|
+
flex-basis: 90%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.file-selector__filename {
|
|
179
|
+
flex-basis: 90%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.file-selector__download {
|
|
183
|
+
flex-basis: 5%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.file-selector__delete {
|
|
187
|
+
flex-basis: 5%;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@media (max-width: 600px) {
|
|
192
|
+
etools-dropdown {
|
|
193
|
+
padding: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.file-selector-container.with-type-dropdown {
|
|
197
|
+
border-bottom: 1px solid lightgrey;
|
|
198
|
+
flex-wrap: wrap;
|
|
199
|
+
padding-bottom: 10px;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
202
|
`
|
|
203
203
|
];
|
|
204
204
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CSSResultArray, TemplateResult } from 'lit
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
|
|
2
3
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
3
4
|
export declare abstract class RepeatableBaseField<T> extends AbstractFieldBaseClass<T[]> {
|
|
4
5
|
set errorMessage(messages: (string | null)[]);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, html, property } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
|
|
8
5
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
9
6
|
import { fireEvent } from '../../lib/utils/fire-custom-event';
|
|
10
7
|
import { getTranslation } from '../../lib/utils/translate';
|
|
@@ -22,23 +19,23 @@ export class RepeatableBaseField extends AbstractFieldBaseClass {
|
|
|
22
19
|
}
|
|
23
20
|
render() {
|
|
24
21
|
const values = this.getValues();
|
|
25
|
-
return html `
|
|
26
|
-
<div class="finding-container">
|
|
27
|
-
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
28
|
-
<div class="question-control layout vertical center-justified start">
|
|
29
|
-
${values.map((value, index) => html `<div class="layout horizontal center full-width">
|
|
30
|
-
${this.controlTemplate(value, index)}
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
?hidden="${this.isReadonly || values.length < 2}"
|
|
34
|
-
@click="${() => this.removeControl(index)}"
|
|
35
|
-
></
|
|
36
|
-
</div>`)}
|
|
37
|
-
<
|
|
38
|
-
${getTranslation(this.language, 'ADD')}
|
|
39
|
-
</
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
22
|
+
return html `
|
|
23
|
+
<div class="finding-container">
|
|
24
|
+
<div class="question layout start"><slot>${this.questionTemplate()}</slot></div>
|
|
25
|
+
<div class="question-control layout vertical center-justified start">
|
|
26
|
+
${values.map((value, index) => html `<div class="layout horizontal center full-width">
|
|
27
|
+
${this.controlTemplate(value, index)}
|
|
28
|
+
<etools-icon-button
|
|
29
|
+
name="close"
|
|
30
|
+
?hidden="${this.isReadonly || values.length < 2}"
|
|
31
|
+
@click="${() => this.removeControl(index)}"
|
|
32
|
+
></etools-icon-button>
|
|
33
|
+
</div>`)}
|
|
34
|
+
<etools-button variant="primary" class="add-button" ?hidden="${this.isReadonly}" @click="${this.addNewField}">
|
|
35
|
+
${getTranslation(this.language, 'ADD')}
|
|
36
|
+
</etools-button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
42
39
|
`;
|
|
43
40
|
}
|
|
44
41
|
questionTemplate() {
|
|
@@ -107,11 +104,11 @@ export class RepeatableBaseField extends AbstractFieldBaseClass {
|
|
|
107
104
|
// language=CSS
|
|
108
105
|
return [
|
|
109
106
|
...AbstractFieldBaseClass.styles,
|
|
110
|
-
css `
|
|
111
|
-
:host(:not([is-readonly])) .question-control,
|
|
112
|
-
:host(:not([is-readonly])) .question {
|
|
113
|
-
padding-bottom: 10px;
|
|
114
|
-
}
|
|
107
|
+
css `
|
|
108
|
+
:host(:not([is-readonly])) .question-control,
|
|
109
|
+
:host(:not([is-readonly])) .question {
|
|
110
|
+
padding-bottom: 10px;
|
|
111
|
+
}
|
|
115
112
|
`
|
|
116
113
|
];
|
|
117
114
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSResultArray, TemplateResult } from 'lit
|
|
2
|
-
import '@polymer/
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
|
|
3
3
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
4
4
|
export declare class RepeatableNumberField extends RepeatableBaseField<number> {
|
|
5
5
|
isInteger: boolean;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, customElement, html } from 'lit-element';
|
|
8
|
-
import '@polymer/paper-input/paper-input';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-input/etools-input';
|
|
9
5
|
import { InputStyles } from '../../lib/styles/input-styles';
|
|
10
6
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
11
7
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
@@ -16,20 +12,20 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
|
|
|
16
12
|
this.isInteger = false;
|
|
17
13
|
}
|
|
18
14
|
controlTemplate(value, index) {
|
|
19
|
-
return html `
|
|
20
|
-
${InputStyles}
|
|
21
|
-
<
|
|
22
|
-
class="no-padding-left"
|
|
23
|
-
no-label-float
|
|
24
|
-
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
25
|
-
.value="${value}"
|
|
26
|
-
@value-changed="${({ detail }) => this.valueChanged(detail.value, index)}"
|
|
27
|
-
placeholder="—"
|
|
28
|
-
?invalid="${this.errorMessage[index]}"
|
|
29
|
-
error-message="${this.errorMessage[index]}"
|
|
30
|
-
?readonly="${this.isReadonly}"
|
|
31
|
-
>
|
|
32
|
-
</
|
|
15
|
+
return html `
|
|
16
|
+
${InputStyles}
|
|
17
|
+
<etools-input
|
|
18
|
+
class="no-padding-left"
|
|
19
|
+
no-label-float
|
|
20
|
+
placeholder="${this.isReadonly ? '—' : this.placeholder}"
|
|
21
|
+
.value="${value}"
|
|
22
|
+
@value-changed="${({ detail }) => this.valueChanged(detail.value, index)}"
|
|
23
|
+
placeholder="—"
|
|
24
|
+
?invalid="${this.errorMessage[index]}"
|
|
25
|
+
error-message="${this.errorMessage[index]}"
|
|
26
|
+
?readonly="${this.isReadonly}"
|
|
27
|
+
>
|
|
28
|
+
</etools-input>
|
|
33
29
|
`;
|
|
34
30
|
}
|
|
35
31
|
valueChanged(newValue, index) {
|
|
@@ -51,12 +47,12 @@ let RepeatableNumberField = class RepeatableNumberField extends RepeatableBaseFi
|
|
|
51
47
|
// language=CSS
|
|
52
48
|
return [
|
|
53
49
|
...AbstractFieldBaseClass.styles,
|
|
54
|
-
css `
|
|
55
|
-
@media (max-width: 380px) {
|
|
56
|
-
.no-padding-left {
|
|
57
|
-
padding-left: 0;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
50
|
+
css `
|
|
51
|
+
@media (max-width: 380px) {
|
|
52
|
+
.no-padding-left {
|
|
53
|
+
padding-left: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
60
56
|
`
|
|
61
57
|
];
|
|
62
58
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '@polymer/
|
|
3
|
-
import '@
|
|
4
|
-
import
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
|
|
3
|
+
import '@shoelace-style/shoelace/dist/components/radio/radio.js';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
5
5
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
6
6
|
import { FieldOption } from '..';
|
|
7
7
|
export declare class RepeatableScaleField extends RepeatableBaseField<string | number | null> {
|
|
8
8
|
options: (FieldOption | string | number)[];
|
|
9
9
|
protected controlTemplate(value: string | null, index: number): TemplateResult;
|
|
10
|
-
protected onSelect(
|
|
10
|
+
protected onSelect(itemValue: string, index: number): void;
|
|
11
11
|
protected getLabel(option: FieldOption | string | number): unknown;
|
|
12
12
|
protected getValue(option: FieldOption | string | number): unknown;
|
|
13
13
|
protected customValidation(): string | null;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import { repeat } from 'lit-html/directives/repeat';
|
|
9
|
-
import '@polymer/paper-radio-group/paper-radio-group';
|
|
10
|
-
import '@polymer/paper-radio-button/paper-radio-button';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
5
|
+
import '@unicef-polymer/etools-unicef/src/etools-radio/etools-radio-group';
|
|
6
|
+
import '@shoelace-style/shoelace/dist/components/radio/radio.js';
|
|
7
|
+
import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
11
8
|
import { InputStyles } from '../../lib/styles/input-styles';
|
|
12
9
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
10
|
+
import { getTranslation } from '../../lib/utils/translate';
|
|
13
11
|
import { AbstractFieldBaseClass } from '../abstract-field-base.class';
|
|
14
12
|
let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseField {
|
|
15
13
|
constructor() {
|
|
@@ -17,34 +15,32 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
|
|
|
17
15
|
this.options = [];
|
|
18
16
|
}
|
|
19
17
|
controlTemplate(value, index) {
|
|
20
|
-
return html `
|
|
21
|
-
${InputStyles}
|
|
22
|
-
<div class="container">
|
|
23
|
-
<
|
|
24
|
-
class="radio-group"
|
|
25
|
-
|
|
26
|
-
@
|
|
27
|
-
>
|
|
28
|
-
${repeat(this.options, (option) => html `
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</div>
|
|
18
|
+
return html `
|
|
19
|
+
${InputStyles}
|
|
20
|
+
<div class="container">
|
|
21
|
+
<etools-radio-group
|
|
22
|
+
class="radio-group"
|
|
23
|
+
.value="${value}"
|
|
24
|
+
@sl-change="${(e) => this.onSelect(e.target.value, index)}"
|
|
25
|
+
>
|
|
26
|
+
${repeat(this.options, (option) => html `
|
|
27
|
+
<sl-radio class="radio-button" value="${this.getValue(option)}"> ${this.getLabel(option)} </sl-radio>
|
|
28
|
+
`)}
|
|
29
|
+
</etools-radio-group>
|
|
30
|
+
<etools-button
|
|
31
|
+
class="neutral clear-button"
|
|
32
|
+
variant="text"
|
|
33
|
+
?hidden="${this.isReadonly}"
|
|
34
|
+
@click="${() => this.valueChanged(null, index)}"
|
|
35
|
+
>
|
|
36
|
+
<etools-icon name="clear" slot="prefix"></etools-icon>
|
|
37
|
+
${getTranslation(this.language, 'CLEAR')}
|
|
38
|
+
</etools-button>
|
|
39
|
+
</div>
|
|
43
40
|
`;
|
|
44
41
|
}
|
|
45
|
-
onSelect(
|
|
46
|
-
|
|
47
|
-
this.valueChanged(newValue, index);
|
|
42
|
+
onSelect(itemValue, index) {
|
|
43
|
+
this.valueChanged(itemValue, index);
|
|
48
44
|
}
|
|
49
45
|
getLabel(option) {
|
|
50
46
|
return typeof option === 'object' ? option.label : option;
|
|
@@ -59,42 +55,42 @@ let RepeatableScaleField = class RepeatableScaleField extends RepeatableBaseFiel
|
|
|
59
55
|
// language=CSS
|
|
60
56
|
return [
|
|
61
57
|
...AbstractFieldBaseClass.styles,
|
|
62
|
-
css `
|
|
63
|
-
.container {
|
|
64
|
-
position: relative;
|
|
65
|
-
min-height: 48px;
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.radio-group {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: row;
|
|
74
|
-
flex-wrap: wrap;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:host([is-readonly])
|
|
78
|
-
pointer-events: none;
|
|
79
|
-
opacity: 0.55;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@media (max-width: 1080px) {
|
|
83
|
-
.container {
|
|
84
|
-
flex-direction: column;
|
|
85
|
-
align-items: flex-start;
|
|
86
|
-
}
|
|
87
|
-
.radio-group {
|
|
88
|
-
flex-direction: column;
|
|
89
|
-
}
|
|
90
|
-
.radio-button {
|
|
91
|
-
padding-left: 3px;
|
|
92
|
-
}
|
|
93
|
-
.clear-button {
|
|
94
|
-
margin: 0;
|
|
95
|
-
padding-left: 0;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
58
|
+
css `
|
|
59
|
+
.container {
|
|
60
|
+
position: relative;
|
|
61
|
+
min-height: 48px;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.radio-group {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
flex-wrap: wrap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([is-readonly]) etools-radio-group {
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
opacity: 0.55;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (max-width: 1080px) {
|
|
79
|
+
.container {
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
}
|
|
83
|
+
.radio-group {
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
}
|
|
86
|
+
.radio-button {
|
|
87
|
+
padding-left: 3px;
|
|
88
|
+
}
|
|
89
|
+
.clear-button {
|
|
90
|
+
margin: 0;
|
|
91
|
+
padding-left: 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
98
94
|
`
|
|
99
95
|
];
|
|
100
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSResultArray, TemplateResult } from 'lit
|
|
2
|
-
import '@polymer/
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-input/etools-textarea';
|
|
3
3
|
import { RepeatableBaseField } from './repeatable-base-field';
|
|
4
4
|
export declare class RepeatableTextField extends RepeatableBaseField<string> {
|
|
5
5
|
protected controlTemplate(value: string | null, index: number): TemplateResult;
|