@unicef-polymer/etools-form-builder 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/README.md +1 -1
- package/dist/assets/translations.d.ts +6 -0
- package/dist/assets/translations.js +67 -0
- package/dist/form-attachments-popup/form-attachments-popup.d.ts +86 -85
- package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
- package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
- package/dist/form-attachments-popup/form-attachments-popup.js +255 -248
- package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
- package/dist/form-attachments-popup/form-attachments-popup.tpl.js +91 -89
- package/dist/form-attachments-popup/index.d.ts +2 -2
- package/dist/form-attachments-popup/index.js +2 -2
- package/dist/form-fields/abstract-field-base.class.d.ts +33 -28
- package/dist/form-fields/abstract-field-base.class.js +194 -176
- package/dist/form-fields/field-renderer-component.d.ts +20 -20
- package/dist/form-fields/field-renderer-component.js +249 -249
- package/dist/form-fields/index.d.ts +12 -12
- package/dist/form-fields/index.js +12 -12
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
- package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +209 -208
- package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
- package/dist/form-fields/repeatable-fields/repeatable-base-field.js +124 -123
- package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
- package/dist/form-fields/repeatable-fields/repeatable-number-field.js +67 -66
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
- package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +108 -108
- package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
- package/dist/form-fields/repeatable-fields/repeatable-text-field.js +53 -53
- package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
- package/dist/form-fields/single-fields/attachment-field.js +98 -97
- package/dist/form-fields/single-fields/base-field.d.ts +11 -11
- package/dist/form-fields/single-fields/base-field.js +58 -57
- package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
- package/dist/form-fields/single-fields/boolean-field.js +49 -49
- package/dist/form-fields/single-fields/number-field.d.ts +10 -10
- package/dist/form-fields/single-fields/number-field.js +67 -66
- package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
- package/dist/form-fields/single-fields/scale-field.js +108 -107
- package/dist/form-fields/single-fields/text-field.d.ts +8 -8
- package/dist/form-fields/single-fields/text-field.js +54 -54
- package/dist/form-groups/form-abstract-group.d.ts +65 -60
- package/dist/form-groups/form-abstract-group.js +375 -353
- package/dist/form-groups/form-card.d.ts +32 -32
- package/dist/form-groups/form-card.js +113 -108
- package/dist/form-groups/form-collapsed-card.d.ts +70 -70
- package/dist/form-groups/form-collapsed-card.js +254 -253
- package/dist/form-groups/index.d.ts +3 -3
- package/dist/form-groups/index.js +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/lib/additional-components/confirmation-dialog.d.ts +18 -16
- package/dist/lib/additional-components/confirmation-dialog.js +72 -65
- package/dist/lib/additional-components/etools-fb-card.d.ts +21 -16
- package/dist/lib/additional-components/etools-fb-card.js +238 -215
- package/dist/lib/styles/attachments.styles.d.ts +2 -2
- package/dist/lib/styles/attachments.styles.js +72 -72
- package/dist/lib/styles/card-styles.d.ts +2 -2
- package/dist/lib/styles/card-styles.js +154 -154
- package/dist/lib/styles/dialog.styles.d.ts +2 -2
- package/dist/lib/styles/dialog.styles.js +85 -85
- package/dist/lib/styles/elevation-styles.d.ts +9 -9
- package/dist/lib/styles/elevation-styles.js +43 -43
- package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
- package/dist/lib/styles/flex-layout-classes.js +319 -319
- package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
- package/dist/lib/styles/form-builder-card.styles.js +49 -49
- package/dist/lib/styles/input-styles.d.ts +2 -2
- package/dist/lib/styles/input-styles.js +138 -138
- package/dist/lib/styles/page-layout-styles.d.ts +2 -2
- package/dist/lib/styles/page-layout-styles.js +201 -201
- package/dist/lib/styles/shared-styles.d.ts +2 -2
- package/dist/lib/styles/shared-styles.js +70 -70
- package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
- package/dist/lib/types/form-builder.interfaces.js +0 -0
- package/dist/lib/types/form-builder.types.d.ts +59 -59
- package/dist/lib/types/form-builder.types.js +0 -0
- package/dist/lib/types/global.types.d.ts +4 -4
- package/dist/lib/types/global.types.js +0 -0
- package/dist/lib/utils/dialog.d.ts +10 -10
- package/dist/lib/utils/dialog.js +21 -21
- package/dist/lib/utils/fire-custom-event.d.ts +1 -1
- package/dist/lib/utils/fire-custom-event.js +7 -7
- package/dist/lib/utils/translate.d.ts +1 -0
- package/dist/lib/utils/translate.js +9 -0
- package/dist/lib/utils/validations.helper.d.ts +26 -26
- package/dist/lib/utils/validations.helper.js +42 -35
- package/package.json +56 -56
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit-element';
|
|
2
|
-
import { IFormBuilderCard } from '../lib/types/form-builder.interfaces';
|
|
3
|
-
import { FormAbstractGroup } from './form-abstract-group';
|
|
4
|
-
import { GenericObject } from '../lib/types/global.types';
|
|
5
|
-
import '@polymer/iron-collapse';
|
|
6
|
-
export declare class FormCard extends FormAbstractGroup implements IFormBuilderCard {
|
|
7
|
-
protected _value: GenericObject;
|
|
8
|
-
/**
|
|
9
|
-
* Show save button only if value was changed by user
|
|
10
|
-
*/
|
|
11
|
-
private showSaveButton;
|
|
12
|
-
/**
|
|
13
|
-
* Overrides value property. Saves originalValue.
|
|
14
|
-
* We need to update inner _value only if it wasn't change
|
|
15
|
-
* @param value
|
|
16
|
-
*/
|
|
17
|
-
set value(value: GenericObject);
|
|
18
|
-
get value(): GenericObject;
|
|
19
|
-
protected originalValue: GenericObject;
|
|
20
|
-
/**
|
|
21
|
-
* Extends parent render method,
|
|
22
|
-
* adds card-container html wrapper and dynamic save button
|
|
23
|
-
*/
|
|
24
|
-
render(): TemplateResult;
|
|
25
|
-
/**
|
|
26
|
-
* Updates value property, stops event propagation.
|
|
27
|
-
* We need to fire value-changed event only after save button click
|
|
28
|
-
*/
|
|
29
|
-
valueChanged(event: CustomEvent, name: string): void;
|
|
30
|
-
saveChanges(): void;
|
|
31
|
-
confirmRemove(groupName: string): void;
|
|
32
|
-
}
|
|
1
|
+
import { TemplateResult } from 'lit-element';
|
|
2
|
+
import { IFormBuilderCard } from '../lib/types/form-builder.interfaces';
|
|
3
|
+
import { FormAbstractGroup } from './form-abstract-group';
|
|
4
|
+
import { GenericObject } from '../lib/types/global.types';
|
|
5
|
+
import '@polymer/iron-collapse';
|
|
6
|
+
export declare class FormCard extends FormAbstractGroup implements IFormBuilderCard {
|
|
7
|
+
protected _value: GenericObject;
|
|
8
|
+
/**
|
|
9
|
+
* Show save button only if value was changed by user
|
|
10
|
+
*/
|
|
11
|
+
private showSaveButton;
|
|
12
|
+
/**
|
|
13
|
+
* Overrides value property. Saves originalValue.
|
|
14
|
+
* We need to update inner _value only if it wasn't change
|
|
15
|
+
* @param value
|
|
16
|
+
*/
|
|
17
|
+
set value(value: GenericObject);
|
|
18
|
+
get value(): GenericObject;
|
|
19
|
+
protected originalValue: GenericObject;
|
|
20
|
+
/**
|
|
21
|
+
* Extends parent render method,
|
|
22
|
+
* adds card-container html wrapper and dynamic save button
|
|
23
|
+
*/
|
|
24
|
+
render(): TemplateResult;
|
|
25
|
+
/**
|
|
26
|
+
* Updates value property, stops event propagation.
|
|
27
|
+
* We need to fire value-changed event only after save button click
|
|
28
|
+
*/
|
|
29
|
+
valueChanged(event: CustomEvent, name: string): void;
|
|
30
|
+
saveChanges(): void;
|
|
31
|
+
confirmRemove(groupName: string): void;
|
|
32
|
+
}
|
|
@@ -1,108 +1,113 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
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 { html, property, customElement } from 'lit-element';
|
|
8
|
-
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
9
|
-
import { clone, equals } from 'ramda';
|
|
10
|
-
import { FormAbstractGroup } from './form-abstract-group';
|
|
11
|
-
import '@polymer/iron-collapse';
|
|
12
|
-
import { openDialog } from '../lib/utils/dialog';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<div
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
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 { html, property, customElement } from 'lit-element';
|
|
8
|
+
import { fireEvent } from '../lib/utils/fire-custom-event';
|
|
9
|
+
import { clone, equals } from 'ramda';
|
|
10
|
+
import { FormAbstractGroup } from './form-abstract-group';
|
|
11
|
+
import '@polymer/iron-collapse';
|
|
12
|
+
import { openDialog } from '../lib/utils/dialog';
|
|
13
|
+
import { getTranslation } from '../lib/utils/translate';
|
|
14
|
+
let FormCard = class FormCard extends FormAbstractGroup {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this._value = {};
|
|
18
|
+
/**
|
|
19
|
+
* Show save button only if value was changed by user
|
|
20
|
+
*/
|
|
21
|
+
this.showSaveButton = false;
|
|
22
|
+
this.originalValue = {};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Overrides value property. Saves originalValue.
|
|
26
|
+
* We need to update inner _value only if it wasn't change
|
|
27
|
+
* @param value
|
|
28
|
+
*/
|
|
29
|
+
set value(value) {
|
|
30
|
+
if (!this.showSaveButton) {
|
|
31
|
+
this._value = clone(value);
|
|
32
|
+
}
|
|
33
|
+
this.originalValue = value;
|
|
34
|
+
}
|
|
35
|
+
get value() {
|
|
36
|
+
return this._value;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extends parent render method,
|
|
40
|
+
* adds card-container html wrapper and dynamic save button
|
|
41
|
+
*/
|
|
42
|
+
render() {
|
|
43
|
+
return html `
|
|
44
|
+
<section class="elevation page-content card-container form-card" elevation="1">
|
|
45
|
+
<div class="card-header">
|
|
46
|
+
<div class="title">${this.groupStructure.title}</div>
|
|
47
|
+
<div
|
|
48
|
+
class="remove-group"
|
|
49
|
+
?hidden="${!this.groupStructure.repeatable}"
|
|
50
|
+
@click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
|
|
51
|
+
>
|
|
52
|
+
Remove
|
|
53
|
+
${!this.groupStructure.title || this.groupStructure.title.length > 15
|
|
54
|
+
? getTranslation(this.language, 'GROUP')
|
|
55
|
+
: this.groupStructure.title}
|
|
56
|
+
<paper-icon-button icon="delete" class="attachments-warning"></paper-icon-button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
${super.render()}
|
|
60
|
+
|
|
61
|
+
<iron-collapse ?opened="${this.showSaveButton}">
|
|
62
|
+
<div class="layout horizontal end-justified card-buttons actions-container">
|
|
63
|
+
<paper-button class="save-button" @tap="${() => this.saveChanges()}"
|
|
64
|
+
>${getTranslation(this.language, 'SAVE')}</paper-button
|
|
65
|
+
>
|
|
66
|
+
</div>
|
|
67
|
+
</iron-collapse>
|
|
68
|
+
</section>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Updates value property, stops event propagation.
|
|
73
|
+
* We need to fire value-changed event only after save button click
|
|
74
|
+
*/
|
|
75
|
+
valueChanged(event, name) {
|
|
76
|
+
if (!this._value) {
|
|
77
|
+
this._value = {};
|
|
78
|
+
}
|
|
79
|
+
this._value[name] = event.detail.value;
|
|
80
|
+
event.stopPropagation();
|
|
81
|
+
this.showSaveButton = !equals(this.value, this.originalValue);
|
|
82
|
+
}
|
|
83
|
+
saveChanges() {
|
|
84
|
+
if (Object.keys(this._errors).length) {
|
|
85
|
+
fireEvent(this, 'toast', { text: getTranslation(this.language, 'CHECK_FIELDS_TRY_AGAIN') });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
fireEvent(this, 'value-changed', { value: this.value });
|
|
89
|
+
this.showSaveButton = false;
|
|
90
|
+
}
|
|
91
|
+
confirmRemove(groupName) {
|
|
92
|
+
openDialog({
|
|
93
|
+
dialog: 'confirmation-popup',
|
|
94
|
+
dialogData: {
|
|
95
|
+
text: `${getTranslation(this.language, 'CONFIRM_DELETE')} ${groupName}`
|
|
96
|
+
}
|
|
97
|
+
}).then((response) => {
|
|
98
|
+
if (response.confirmed) {
|
|
99
|
+
fireEvent(this, 'remove-group');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
__decorate([
|
|
105
|
+
property()
|
|
106
|
+
], FormCard.prototype, "_value", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property()
|
|
109
|
+
], FormCard.prototype, "showSaveButton", void 0);
|
|
110
|
+
FormCard = __decorate([
|
|
111
|
+
customElement('form-card')
|
|
112
|
+
], FormCard);
|
|
113
|
+
export { FormCard };
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit-element';
|
|
2
|
-
import { IFormBuilderCard, IFormBuilderCollapsedCard } from '../lib/types/form-builder.interfaces';
|
|
3
|
-
import { FormAbstractGroup } from './form-abstract-group';
|
|
4
|
-
import '../lib/additional-components/etools-fb-card';
|
|
5
|
-
import { GenericObject } from '../lib/types/global.types';
|
|
6
|
-
import '../lib/additional-components/confirmation-dialog';
|
|
7
|
-
export declare class FormCollapsedCard extends FormAbstractGroup implements IFormBuilderCollapsedCard, IFormBuilderCard {
|
|
8
|
-
/**
|
|
9
|
-
* Overrides readonly property
|
|
10
|
-
* In collapsed card it must consider isEditMode property,
|
|
11
|
-
* components inside card are readonly if isEditMode is off or if card is readonly
|
|
12
|
-
*/
|
|
13
|
-
set readonly(state: boolean);
|
|
14
|
-
get readonly(): boolean;
|
|
15
|
-
protected isEditMode: boolean;
|
|
16
|
-
protected _readonly: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Overrides errors setter
|
|
19
|
-
* In collapsed card it must consider isEditMode property,
|
|
20
|
-
* We must to enable isEditMode if errors comes from backend
|
|
21
|
-
*/
|
|
22
|
-
set errors(errors: GenericObject | string[] | null);
|
|
23
|
-
/**
|
|
24
|
-
* Overrides value property
|
|
25
|
-
* We need to save originalValue to have Cancel possibility in collapsed card.
|
|
26
|
-
* Don't override current edited value if isEditMode enabled
|
|
27
|
-
* (It can be happened if other sibling card or component updates their value during current card edition)
|
|
28
|
-
*/
|
|
29
|
-
set value(value: GenericObject);
|
|
30
|
-
get value(): GenericObject;
|
|
31
|
-
protected _value: GenericObject;
|
|
32
|
-
protected originalValue: GenericObject;
|
|
33
|
-
/**
|
|
34
|
-
* Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
|
|
35
|
-
* and adds etools-card as container wrapper
|
|
36
|
-
*/
|
|
37
|
-
render(): TemplateResult;
|
|
38
|
-
/**
|
|
39
|
-
* Filters StructureTypes.ATTACHMENTS_BUTTON type. It will be rendered as button,
|
|
40
|
-
* allows parent renderChild method to render other types
|
|
41
|
-
*/
|
|
42
|
-
renderGroupChildren(): (TemplateResult | TemplateResult[])[];
|
|
43
|
-
/**
|
|
44
|
-
* Generate open Attachments popup button.
|
|
45
|
-
* It is hidden if tab is readonly and no attachments uploaded
|
|
46
|
-
*/
|
|
47
|
-
getAdditionalButtons(): TemplateResult;
|
|
48
|
-
retrieveTitle(target: string): string;
|
|
49
|
-
startEdit(): void;
|
|
50
|
-
/**
|
|
51
|
-
* We need to rerender view to update all changes that was happen,
|
|
52
|
-
* because only fields are updating during @value-change event.
|
|
53
|
-
* Only then we can reset all changed values to their original
|
|
54
|
-
*/
|
|
55
|
-
cancelEdit(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Updates value property, stops event propagation.
|
|
58
|
-
* We need to fire value-changed event only after save button click
|
|
59
|
-
*/
|
|
60
|
-
valueChanged(event: CustomEvent, name: string): void;
|
|
61
|
-
saveChanges(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Tries to save changed attachments on popup confirm
|
|
64
|
-
* Generates value-changed event with originalValue clone if isEditMode enabled.
|
|
65
|
-
* In this case it will take only attachments changes and ignore other changes that may happen during card edit
|
|
66
|
-
*/
|
|
67
|
-
openAttachmentsPopup(): void;
|
|
68
|
-
confirmRemove(groupName: string): void;
|
|
69
|
-
protected getAttachmentsBtnText(attachmentsCount?: number): string;
|
|
70
|
-
}
|
|
1
|
+
import { TemplateResult } from 'lit-element';
|
|
2
|
+
import { IFormBuilderCard, IFormBuilderCollapsedCard } from '../lib/types/form-builder.interfaces';
|
|
3
|
+
import { FormAbstractGroup } from './form-abstract-group';
|
|
4
|
+
import '../lib/additional-components/etools-fb-card';
|
|
5
|
+
import { GenericObject } from '../lib/types/global.types';
|
|
6
|
+
import '../lib/additional-components/confirmation-dialog';
|
|
7
|
+
export declare class FormCollapsedCard extends FormAbstractGroup implements IFormBuilderCollapsedCard, IFormBuilderCard {
|
|
8
|
+
/**
|
|
9
|
+
* Overrides readonly property
|
|
10
|
+
* In collapsed card it must consider isEditMode property,
|
|
11
|
+
* components inside card are readonly if isEditMode is off or if card is readonly
|
|
12
|
+
*/
|
|
13
|
+
set readonly(state: boolean);
|
|
14
|
+
get readonly(): boolean;
|
|
15
|
+
protected isEditMode: boolean;
|
|
16
|
+
protected _readonly: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Overrides errors setter
|
|
19
|
+
* In collapsed card it must consider isEditMode property,
|
|
20
|
+
* We must to enable isEditMode if errors comes from backend
|
|
21
|
+
*/
|
|
22
|
+
set errors(errors: GenericObject | string[] | null);
|
|
23
|
+
/**
|
|
24
|
+
* Overrides value property
|
|
25
|
+
* We need to save originalValue to have Cancel possibility in collapsed card.
|
|
26
|
+
* Don't override current edited value if isEditMode enabled
|
|
27
|
+
* (It can be happened if other sibling card or component updates their value during current card edition)
|
|
28
|
+
*/
|
|
29
|
+
set value(value: GenericObject);
|
|
30
|
+
get value(): GenericObject;
|
|
31
|
+
protected _value: GenericObject;
|
|
32
|
+
protected originalValue: GenericObject;
|
|
33
|
+
/**
|
|
34
|
+
* Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
|
|
35
|
+
* and adds etools-card as container wrapper
|
|
36
|
+
*/
|
|
37
|
+
render(): TemplateResult;
|
|
38
|
+
/**
|
|
39
|
+
* Filters StructureTypes.ATTACHMENTS_BUTTON type. It will be rendered as button,
|
|
40
|
+
* allows parent renderChild method to render other types
|
|
41
|
+
*/
|
|
42
|
+
renderGroupChildren(): (TemplateResult | TemplateResult[])[];
|
|
43
|
+
/**
|
|
44
|
+
* Generate open Attachments popup button.
|
|
45
|
+
* It is hidden if tab is readonly and no attachments uploaded
|
|
46
|
+
*/
|
|
47
|
+
getAdditionalButtons(): TemplateResult;
|
|
48
|
+
retrieveTitle(target: string): string;
|
|
49
|
+
startEdit(): void;
|
|
50
|
+
/**
|
|
51
|
+
* We need to rerender view to update all changes that was happen,
|
|
52
|
+
* because only fields are updating during @value-change event.
|
|
53
|
+
* Only then we can reset all changed values to their original
|
|
54
|
+
*/
|
|
55
|
+
cancelEdit(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Updates value property, stops event propagation.
|
|
58
|
+
* We need to fire value-changed event only after save button click
|
|
59
|
+
*/
|
|
60
|
+
valueChanged(event: CustomEvent, name: string): void;
|
|
61
|
+
saveChanges(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Tries to save changed attachments on popup confirm
|
|
64
|
+
* Generates value-changed event with originalValue clone if isEditMode enabled.
|
|
65
|
+
* In this case it will take only attachments changes and ignore other changes that may happen during card edit
|
|
66
|
+
*/
|
|
67
|
+
openAttachmentsPopup(): void;
|
|
68
|
+
confirmRemove(groupName: string): void;
|
|
69
|
+
protected getAttachmentsBtnText(attachmentsCount?: number): string;
|
|
70
|
+
}
|