@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,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 { html, property, customElement } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
8
4
|
import { clone } from 'ramda';
|
|
9
5
|
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
10
6
|
import { openDialog } from '../lib/utils/dialog';
|
|
@@ -12,6 +8,7 @@ import { FormAbstractGroup, StructureTypes } from './form-abstract-group';
|
|
|
12
8
|
import '../lib/additional-components/etools-fb-card';
|
|
13
9
|
import '../lib/additional-components/confirmation-dialog';
|
|
14
10
|
import { getTranslation } from '../lib/utils/translate';
|
|
11
|
+
import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
|
|
15
12
|
const PARTNER_KEY = 'partner';
|
|
16
13
|
const OUTPUT_KEY = 'output';
|
|
17
14
|
const INTERVENTION_KEY = 'intervention';
|
|
@@ -19,22 +16,23 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
19
16
|
constructor() {
|
|
20
17
|
super(...arguments);
|
|
21
18
|
this.collapsed = false;
|
|
19
|
+
/**
|
|
20
|
+
* Overrides readonly property
|
|
21
|
+
* In collapsed card it must consider isEditMode property,
|
|
22
|
+
* components inside card are readonly if isEditMode is off or if card is readonly
|
|
23
|
+
*/
|
|
24
|
+
// set readonly(state: boolean) {
|
|
25
|
+
// this._readonly = state;
|
|
26
|
+
// }
|
|
27
|
+
// @dci seems to not be used, use instead getIsReadonly
|
|
28
|
+
// get readonly(): boolean {
|
|
29
|
+
// return this._readonly || !this.isEditMode;
|
|
30
|
+
// }
|
|
22
31
|
this.isEditMode = false;
|
|
23
|
-
this.
|
|
32
|
+
this.readonly = false;
|
|
24
33
|
this._value = {};
|
|
25
34
|
this.originalValue = {};
|
|
26
35
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Overrides readonly property
|
|
29
|
-
* In collapsed card it must consider isEditMode property,
|
|
30
|
-
* components inside card are readonly if isEditMode is off or if card is readonly
|
|
31
|
-
*/
|
|
32
|
-
set readonly(state) {
|
|
33
|
-
this._readonly = state;
|
|
34
|
-
}
|
|
35
|
-
get readonly() {
|
|
36
|
-
return this._readonly || !this.isEditMode;
|
|
37
|
-
}
|
|
38
36
|
/**
|
|
39
37
|
* Overrides errors setter
|
|
40
38
|
* In collapsed card it must consider isEditMode property,
|
|
@@ -67,35 +65,39 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
67
65
|
get value() {
|
|
68
66
|
return this._value;
|
|
69
67
|
}
|
|
68
|
+
isReadonly() {
|
|
69
|
+
return this.readonly || !this.isEditMode;
|
|
70
|
+
}
|
|
70
71
|
/**
|
|
71
72
|
* Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
|
|
72
73
|
* and adds etools-card as container wrapper
|
|
73
74
|
*/
|
|
74
75
|
render() {
|
|
75
|
-
return html `
|
|
76
|
-
<section class="elevation page-content card-container" elevation="1">
|
|
77
|
-
<etools-fb-card
|
|
78
|
-
card-title="${this.retrieveTitle(this.parentGroupName) + this.groupStructure.title}"
|
|
79
|
-
is-collapsible
|
|
80
|
-
?is-editable="${!this.
|
|
81
|
-
?edit="${this.isEditMode}"
|
|
82
|
-
.collapsed="${this.collapsed}"
|
|
83
|
-
@start-edit="${() => this.startEdit()}"
|
|
84
|
-
@save="${() => this.saveChanges()}"
|
|
85
|
-
@cancel="${() => this.cancelEdit()}"
|
|
86
|
-
>
|
|
87
|
-
<!-- Open Attachments popup button -->
|
|
88
|
-
<div slot="actions" class="layout horizontal center">${this.getAdditionalButtons()}</div>
|
|
89
|
-
<div slot="postfix" class="layout horizontal center" ?hidden="${!this.groupStructure.repeatable}">
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
76
|
+
return html `
|
|
77
|
+
<section class="elevation page-content card-container" elevation="1">
|
|
78
|
+
<etools-fb-card
|
|
79
|
+
card-title="${this.retrieveTitle(this.parentGroupName) + this.groupStructure.title}"
|
|
80
|
+
is-collapsible
|
|
81
|
+
?is-editable="${!this.readonly}"
|
|
82
|
+
?edit="${this.isEditMode}"
|
|
83
|
+
.collapsed="${this.collapsed}"
|
|
84
|
+
@start-edit="${() => this.startEdit()}"
|
|
85
|
+
@save="${() => this.saveChanges()}"
|
|
86
|
+
@cancel="${() => this.cancelEdit()}"
|
|
87
|
+
>
|
|
88
|
+
<!-- Open Attachments popup button -->
|
|
89
|
+
<div slot="actions" class="layout horizontal center">${this.getAdditionalButtons()}</div>
|
|
90
|
+
<div slot="postfix" class="layout horizontal center" ?hidden="${!this.groupStructure.repeatable}">
|
|
91
|
+
<etools-icon-button
|
|
92
|
+
class="attachments-warning"
|
|
93
|
+
name="close"
|
|
94
|
+
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
95
|
+
>
|
|
96
|
+
</etools-icon-button>
|
|
97
|
+
</div>
|
|
98
|
+
<div slot="content">${this.renderGroupChildren()}</div>
|
|
99
|
+
</etools-fb-card>
|
|
100
|
+
</section>
|
|
99
101
|
`;
|
|
100
102
|
}
|
|
101
103
|
/**
|
|
@@ -113,16 +115,19 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
113
115
|
*/
|
|
114
116
|
getAdditionalButtons() {
|
|
115
117
|
var _a, _b, _c, _d, _e, _f;
|
|
116
|
-
const hideAttachmentsButton = (this.
|
|
118
|
+
const hideAttachmentsButton = (this.readonly && !((_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.attachments) === null || _b === void 0 ? void 0 : _b.length)) ||
|
|
117
119
|
!this.groupStructure.children.some(({ styling }) => styling.includes(StructureTypes.ATTACHMENTS_BUTTON));
|
|
118
120
|
return hideAttachmentsButton
|
|
119
121
|
? html ``
|
|
120
|
-
: html `
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
: html `
|
|
123
|
+
<etools-icon id="attachments-warning" name="warning" ?hidden="${!this._errors.attachments}"></etools-icon>
|
|
124
|
+
<etools-button id="primary" variant="text" class="primary" @click="${this.openAttachmentsPopup}">
|
|
125
|
+
<etools-icon
|
|
126
|
+
slot="prefix"
|
|
127
|
+
name="${((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.attachments) === null || _d === void 0 ? void 0 : _d.length) ? 'file-download' : 'file-upload'}"
|
|
128
|
+
></etools-icon>
|
|
129
|
+
${this.getAttachmentsBtnText((_f = (_e = this.value) === null || _e === void 0 ? void 0 : _e.attachments) === null || _f === void 0 ? void 0 : _f.length)}
|
|
130
|
+
</etools-button>
|
|
126
131
|
`;
|
|
127
132
|
}
|
|
128
133
|
retrieveTitle(target) {
|
|
@@ -138,7 +143,7 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
startEdit() {
|
|
141
|
-
if (this.
|
|
146
|
+
if (this.readonly) {
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
144
149
|
this.isEditMode = true;
|
|
@@ -149,7 +154,8 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
149
154
|
* Only then we can reset all changed values to their original
|
|
150
155
|
*/
|
|
151
156
|
cancelEdit() {
|
|
152
|
-
this.requestUpdate()
|
|
157
|
+
this.requestUpdate();
|
|
158
|
+
this.updateComplete.then(() => {
|
|
153
159
|
this._value = clone(this.originalValue);
|
|
154
160
|
this.isEditMode = false;
|
|
155
161
|
});
|
|
@@ -194,7 +200,7 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
|
|
|
194
200
|
computedPath: this.computedPath.concat([this.groupStructure.name, 'attachments']),
|
|
195
201
|
errors: this._errors.attachments
|
|
196
202
|
},
|
|
197
|
-
readonly: this.
|
|
203
|
+
readonly: this.readonly
|
|
198
204
|
}).then((response) => {
|
|
199
205
|
if (!response.confirmed) {
|
|
200
206
|
return;
|
|
@@ -249,7 +255,7 @@ __decorate([
|
|
|
249
255
|
], FormCollapsedCard.prototype, "isEditMode", void 0);
|
|
250
256
|
__decorate([
|
|
251
257
|
property({ type: Boolean, attribute: 'readonly', reflect: true })
|
|
252
|
-
], FormCollapsedCard.prototype, "
|
|
258
|
+
], FormCollapsedCard.prototype, "readonly", void 0);
|
|
253
259
|
__decorate([
|
|
254
260
|
property()
|
|
255
261
|
], FormCollapsedCard.prototype, "_value", void 0);
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, property, html, css, customElement } from 'lit-element';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
8
4
|
import { fireEvent } from '../utils/fire-custom-event';
|
|
9
5
|
import { getTranslation } from '../utils/translate';
|
|
10
6
|
let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
7
|
+
set dialogData({ text, dialogTitle = 'Are you', hideConfirmBtn = false }) {
|
|
8
|
+
this.text = text;
|
|
9
|
+
this.dialogTitle = dialogTitle;
|
|
10
|
+
this.hideConfirmBtn = hideConfirmBtn;
|
|
11
|
+
this.requestUpdate();
|
|
12
|
+
}
|
|
11
13
|
constructor() {
|
|
12
14
|
super();
|
|
13
15
|
this.dialogOpened = true;
|
|
@@ -18,29 +20,23 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
|
18
20
|
this.language = window.localStorage.defaultLanguage || 'en';
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
set dialogData({ text, dialogTitle = 'Are you', hideConfirmBtn = false }) {
|
|
22
|
-
this.text = text;
|
|
23
|
-
this.dialogTitle = dialogTitle;
|
|
24
|
-
this.hideConfirmBtn = hideConfirmBtn;
|
|
25
|
-
this.requestUpdate();
|
|
26
|
-
}
|
|
27
23
|
render() {
|
|
28
|
-
return html `
|
|
29
|
-
<etools-dialog
|
|
30
|
-
id="confirmation-dialog"
|
|
31
|
-
size="md"
|
|
32
|
-
no-padding
|
|
33
|
-
keep-dialog-open
|
|
34
|
-
?hide-confirm-btn="${this.hideConfirmBtn}"
|
|
35
|
-
cancel-btn-text="${getTranslation(this.language, this.hideConfirmBtn ? 'OK' : 'CANCEL')}"
|
|
36
|
-
?opened="${this.dialogOpened}"
|
|
37
|
-
theme="confirmation"
|
|
38
|
-
dialog-title="${this.dialogTitle}"
|
|
39
|
-
@close="${this.onClose}"
|
|
40
|
-
@confirm-btn-clicked="${() => this.confirm()}"
|
|
41
|
-
>
|
|
42
|
-
<div class="confirmation-message">${this.text}</div>
|
|
43
|
-
</etools-dialog>
|
|
24
|
+
return html `
|
|
25
|
+
<etools-dialog
|
|
26
|
+
id="confirmation-dialog"
|
|
27
|
+
size="md"
|
|
28
|
+
no-padding
|
|
29
|
+
keep-dialog-open
|
|
30
|
+
?hide-confirm-btn="${this.hideConfirmBtn}"
|
|
31
|
+
cancel-btn-text="${getTranslation(this.language, this.hideConfirmBtn ? 'OK' : 'CANCEL')}"
|
|
32
|
+
?opened="${this.dialogOpened}"
|
|
33
|
+
theme="confirmation"
|
|
34
|
+
dialog-title="${this.dialogTitle}"
|
|
35
|
+
@close="${this.onClose}"
|
|
36
|
+
@confirm-btn-clicked="${() => this.confirm()}"
|
|
37
|
+
>
|
|
38
|
+
<div class="confirmation-message">${this.text}</div>
|
|
39
|
+
</etools-dialog>
|
|
44
40
|
`;
|
|
45
41
|
}
|
|
46
42
|
onClose() {
|
|
@@ -52,10 +48,10 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
|
|
|
52
48
|
static get styles() {
|
|
53
49
|
// language=CSS
|
|
54
50
|
return [
|
|
55
|
-
css `
|
|
56
|
-
.confirmation-message {
|
|
57
|
-
padding-left: 24px;
|
|
58
|
-
}
|
|
51
|
+
css `
|
|
52
|
+
.confirmation-message {
|
|
53
|
+
padding-left: 24px;
|
|
54
|
+
}
|
|
59
55
|
`
|
|
60
56
|
];
|
|
61
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSResultArray, LitElement, TemplateResult } from 'lit
|
|
2
|
-
import '@polymer/
|
|
1
|
+
import { CSSResultArray, LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import '@unicef-polymer/etools-unicef/src/etools-collapse/etools-collapse';
|
|
3
3
|
export declare class EtoolsFbCard extends LitElement {
|
|
4
4
|
cardTitle: string;
|
|
5
5
|
isEditable: boolean;
|
|
@@ -1,17 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { css, customElement, html, LitElement, property } from 'lit-element';
|
|
8
|
-
import '@polymer/iron-icons/iron-icons';
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import '@unicef-polymer/etools-unicef/src/etools-collapse/etools-collapse';
|
|
9
5
|
import { CardStyles } from '../styles/card-styles';
|
|
10
6
|
import { elevationStyles } from '../styles/elevation-styles';
|
|
11
7
|
import { FlexLayoutClasses } from '../styles/flex-layout-classes';
|
|
12
8
|
import { fireEvent } from '../utils/fire-custom-event';
|
|
13
9
|
import { getTranslation } from '../utils/translate';
|
|
14
10
|
let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
11
|
+
static get styles() {
|
|
12
|
+
// language=CSS
|
|
13
|
+
return [
|
|
14
|
+
elevationStyles,
|
|
15
|
+
CardStyles,
|
|
16
|
+
FlexLayoutClasses,
|
|
17
|
+
css `
|
|
18
|
+
:host {
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
etools-icon {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 6px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.card-container {
|
|
28
|
+
background-color: var(--primary-background-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.card-title-box[is-collapsible] {
|
|
32
|
+
padding-left: 17px;
|
|
33
|
+
padding-right: 25px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.card-content {
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.card-buttons {
|
|
41
|
+
padding: 12px 24px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.save-button {
|
|
45
|
+
--sl-color-primary-500: var(--primary-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.edit-button, etools-icon[name="create"] {
|
|
49
|
+
color: var(--gray-mid);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.edit-button[edit] {
|
|
53
|
+
color: var(--primary-color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.flex-header {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
padding-top: auto;
|
|
60
|
+
flex-wrap: nowrap;
|
|
61
|
+
}
|
|
62
|
+
.flex-header__collapse {
|
|
63
|
+
flex-basis: auto;
|
|
64
|
+
}
|
|
65
|
+
.flex-header__title {
|
|
66
|
+
font-size: 18px;
|
|
67
|
+
flex-basis: auto;
|
|
68
|
+
flex-grow: 1;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
}
|
|
73
|
+
.flex-header__actions {
|
|
74
|
+
order: 1;
|
|
75
|
+
width: auto;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-basis: auto;
|
|
78
|
+
}
|
|
79
|
+
.flex-header__postfix {
|
|
80
|
+
order: 3;
|
|
81
|
+
}
|
|
82
|
+
.flex-header__edit {
|
|
83
|
+
order: 2;
|
|
84
|
+
}
|
|
85
|
+
@media (max-width: 380px) {
|
|
86
|
+
.card-title-box[is-collapsible] {
|
|
87
|
+
padding-left: 0;
|
|
88
|
+
padding-right: 0;
|
|
89
|
+
}
|
|
90
|
+
.flex-header {
|
|
91
|
+
align-items: baseline;
|
|
92
|
+
padding-top: 10px;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
}
|
|
95
|
+
.flex-header__collapse {
|
|
96
|
+
flex-basis: 20%;
|
|
97
|
+
}
|
|
98
|
+
.flex-header__title {
|
|
99
|
+
flex-basis: 60%;
|
|
100
|
+
overflow: unset;
|
|
101
|
+
white-space: unset;
|
|
102
|
+
text-overflow: unset;
|
|
103
|
+
}
|
|
104
|
+
.flex-header__actions {
|
|
105
|
+
order: 2;
|
|
106
|
+
width: 100%;
|
|
107
|
+
border-top: 1px solid lightgrey;
|
|
108
|
+
justify-content: flex-end;
|
|
109
|
+
}
|
|
110
|
+
.flex-header__postfix {
|
|
111
|
+
order: 3;
|
|
112
|
+
}
|
|
113
|
+
.flex-header__edit {
|
|
114
|
+
order: 1;
|
|
115
|
+
flex-basis: 20%;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`
|
|
119
|
+
];
|
|
120
|
+
}
|
|
15
121
|
constructor() {
|
|
16
122
|
super();
|
|
17
123
|
this.isEditable = false;
|
|
@@ -24,112 +130,6 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
24
130
|
}
|
|
25
131
|
this.handleLanguageChange = this.handleLanguageChange.bind(this);
|
|
26
132
|
}
|
|
27
|
-
static get styles() {
|
|
28
|
-
// language=CSS
|
|
29
|
-
return [
|
|
30
|
-
elevationStyles,
|
|
31
|
-
CardStyles,
|
|
32
|
-
FlexLayoutClasses,
|
|
33
|
-
css `
|
|
34
|
-
:host {
|
|
35
|
-
display: block;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.card-container {
|
|
39
|
-
background-color: var(--primary-background-color);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.card-title-box[is-collapsible] {
|
|
43
|
-
padding-left: 17px;
|
|
44
|
-
padding-right: 25px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.card-content {
|
|
48
|
-
padding: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.card-buttons {
|
|
52
|
-
padding: 12px 24px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.save-button {
|
|
56
|
-
color: var(--primary-background-color);
|
|
57
|
-
background-color: var(--primary-color);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.edit-button {
|
|
61
|
-
color: var(--gray-mid);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.edit-button[edit] {
|
|
65
|
-
color: var(--primary-color);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.flex-header {
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
padding-top: auto;
|
|
72
|
-
flex-wrap: nowrap;
|
|
73
|
-
}
|
|
74
|
-
.flex-header__collapse {
|
|
75
|
-
flex-basis: auto;
|
|
76
|
-
}
|
|
77
|
-
.flex-header__title {
|
|
78
|
-
font-size: 18px;
|
|
79
|
-
flex-basis: auto;
|
|
80
|
-
flex-grow: 1;
|
|
81
|
-
overflow: hidden;
|
|
82
|
-
white-space: nowrap;
|
|
83
|
-
text-overflow: ellipsis;
|
|
84
|
-
}
|
|
85
|
-
.flex-header__actions {
|
|
86
|
-
order: 1;
|
|
87
|
-
width: auto;
|
|
88
|
-
display: flex;
|
|
89
|
-
flex-basis: auto;
|
|
90
|
-
}
|
|
91
|
-
.flex-header__postfix {
|
|
92
|
-
order: 3;
|
|
93
|
-
}
|
|
94
|
-
.flex-header__edit {
|
|
95
|
-
order: 2;
|
|
96
|
-
}
|
|
97
|
-
@media (max-width: 380px) {
|
|
98
|
-
.card-title-box[is-collapsible] {
|
|
99
|
-
padding-left: 0;
|
|
100
|
-
padding-right: 0;
|
|
101
|
-
}
|
|
102
|
-
.flex-header {
|
|
103
|
-
align-items: baseline;
|
|
104
|
-
padding-top: 10px;
|
|
105
|
-
flex-wrap: wrap;
|
|
106
|
-
}
|
|
107
|
-
.flex-header__collapse {
|
|
108
|
-
flex-basis: 20%;
|
|
109
|
-
}
|
|
110
|
-
.flex-header__title {
|
|
111
|
-
flex-basis: 60%;
|
|
112
|
-
overflow: unset;
|
|
113
|
-
white-space: unset;
|
|
114
|
-
text-overflow: unset;
|
|
115
|
-
}
|
|
116
|
-
.flex-header__actions {
|
|
117
|
-
order: 2;
|
|
118
|
-
width: 100%;
|
|
119
|
-
border-top: 1px solid lightgrey;
|
|
120
|
-
justify-content: flex-end;
|
|
121
|
-
}
|
|
122
|
-
.flex-header__postfix {
|
|
123
|
-
order: 3;
|
|
124
|
-
}
|
|
125
|
-
.flex-header__edit {
|
|
126
|
-
order: 1;
|
|
127
|
-
flex-basis: 20%;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
`
|
|
131
|
-
];
|
|
132
|
-
}
|
|
133
133
|
save() {
|
|
134
134
|
fireEvent(this, 'save');
|
|
135
135
|
}
|
|
@@ -161,54 +161,45 @@ let EtoolsFbCard = class EtoolsFbCard extends LitElement {
|
|
|
161
161
|
}
|
|
162
162
|
// language=HTML
|
|
163
163
|
render() {
|
|
164
|
-
return html `
|
|
165
|
-
<div class="elevation card-container" elevation="1">
|
|
166
|
-
<header class="card-title-box with-bottom-line flex-header" ?is-collapsible="${this.isCollapsible}">
|
|
164
|
+
return html `
|
|
165
|
+
<div class="elevation card-container" elevation="1">
|
|
166
|
+
<header class="card-title-box with-bottom-line flex-header" ?is-collapsible="${this.isCollapsible}">
|
|
167
167
|
${this.isCollapsible
|
|
168
|
-
? html `
|
|
169
|
-
<
|
|
170
|
-
class="flex-header__collapse"
|
|
171
|
-
@tap="${() => this.toggleCollapse()}"
|
|
172
|
-
icon="${this.collapsed ? 'expand-more' : 'expand-less'}"
|
|
173
|
-
></paper-icon-button>
|
|
168
|
+
? html `
|
|
169
|
+
<etools-icon name="${this.collapsed ? 'expand-more' : 'expand-less'}" @click="${() => this.toggleCollapse()}"></etools-icon>
|
|
174
170
|
`
|
|
175
|
-
: ''}
|
|
176
|
-
<div class="flex-header__title">${this.cardTitle}</div>
|
|
177
|
-
<div class="flex-header__actions"><slot name="actions"></slot></div>
|
|
178
|
-
<div class="layout horizontal center flex-header__edit">
|
|
171
|
+
: ''}
|
|
172
|
+
<div class="flex-header__title">${this.cardTitle}</div>
|
|
173
|
+
<div class="flex-header__actions"><slot name="actions"></slot></div>
|
|
174
|
+
<div class="layout horizontal center flex-header__edit">
|
|
179
175
|
${this.isEditable
|
|
180
|
-
? html `
|
|
181
|
-
|
|
182
|
-
icon="create"
|
|
183
|
-
?edit=${this.edit}
|
|
184
|
-
?hidden="${this.hideEditButton}"
|
|
185
|
-
class="edit-button"
|
|
186
|
-
@tap="${() => this.startEdit()}"
|
|
187
|
-
></paper-icon-button>
|
|
176
|
+
? html `
|
|
177
|
+
<etools-icon slot="trigger" ?hidden="${this.hideEditButton}" @click="${() => this.startEdit()}" name="create"></etools-icon>
|
|
188
178
|
`
|
|
189
|
-
: ''}
|
|
190
|
-
</div>
|
|
191
|
-
<div class="flex-header__postfix"><slot name="postfix"></slot></div>
|
|
192
|
-
</header>
|
|
193
|
-
<
|
|
194
|
-
<section class="card-content-block">
|
|
195
|
-
<slot name="content"></slot>
|
|
196
|
-
|
|
179
|
+
: ''}
|
|
180
|
+
</div>
|
|
181
|
+
<div class="flex-header__postfix"><slot name="postfix"></slot></div>
|
|
182
|
+
</header>
|
|
183
|
+
<etools-collapse ?opened="${!this.collapsed}">
|
|
184
|
+
<section class="card-content-block">
|
|
185
|
+
<slot name="content"></slot>
|
|
186
|
+
|
|
197
187
|
${this.isEditable && this.edit
|
|
198
|
-
? html `
|
|
199
|
-
<div class="layout horizontal end-justified card-buttons">
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
188
|
+
? html `
|
|
189
|
+
<div class="layout horizontal end-justified card-buttons">
|
|
190
|
+
<etools-button variant="text" class="neutral" @click="${this.cancel}">
|
|
191
|
+
${getTranslation(this.language, 'CANCEL')}
|
|
192
|
+
</etools-button>
|
|
193
|
+
|
|
194
|
+
<etools-button variant="primary" class="save-button" @click="${this.save}">
|
|
195
|
+
${getTranslation(this.language, 'SAVE')}
|
|
196
|
+
</etools-button>
|
|
197
|
+
</div>
|
|
207
198
|
`
|
|
208
|
-
: ''}
|
|
209
|
-
</section>
|
|
210
|
-
</
|
|
211
|
-
</div>
|
|
199
|
+
: ''}
|
|
200
|
+
</section>
|
|
201
|
+
</etools-collapse>
|
|
202
|
+
</div>
|
|
212
203
|
`;
|
|
213
204
|
}
|
|
214
205
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CSSResult } from 'lit
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
2
|
export declare const AttachmentsStyles: CSSResult;
|