@unicef-polymer/etools-form-builder 2.1.6 → 2.1.7

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.
Files changed (82) hide show
  1. package/dist/assets/translations.d.ts +6 -6
  2. package/dist/assets/translations.js +67 -67
  3. package/dist/form-attachments-popup/form-attachments-popup.d.ts +86 -86
  4. package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +8 -8
  5. package/dist/form-attachments-popup/form-attachments-popup.helper.js +14 -14
  6. package/dist/form-attachments-popup/form-attachments-popup.js +207 -207
  7. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +3 -3
  8. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +11 -11
  9. package/dist/form-attachments-popup/index.d.ts +2 -2
  10. package/dist/form-attachments-popup/index.js +2 -2
  11. package/dist/form-fields/abstract-field-base.class.d.ts +33 -33
  12. package/dist/form-fields/abstract-field-base.class.js +98 -98
  13. package/dist/form-fields/field-renderer-component.d.ts +20 -20
  14. package/dist/form-fields/field-renderer-component.js +108 -108
  15. package/dist/form-fields/index.d.ts +12 -12
  16. package/dist/form-fields/index.js +12 -12
  17. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +17 -17
  18. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +100 -100
  19. package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +20 -20
  20. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +102 -102
  21. package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +10 -10
  22. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +47 -47
  23. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +15 -15
  24. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +49 -49
  25. package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +8 -8
  26. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +30 -30
  27. package/dist/form-fields/single-fields/attachment-field.d.ts +16 -16
  28. package/dist/form-fields/single-fields/attachment-field.js +85 -85
  29. package/dist/form-fields/single-fields/base-field.d.ts +11 -11
  30. package/dist/form-fields/single-fields/base-field.js +58 -58
  31. package/dist/form-fields/single-fields/boolean-field.d.ts +8 -8
  32. package/dist/form-fields/single-fields/boolean-field.js +29 -29
  33. package/dist/form-fields/single-fields/number-field.d.ts +10 -10
  34. package/dist/form-fields/single-fields/number-field.js +46 -46
  35. package/dist/form-fields/single-fields/scale-field.d.ts +18 -18
  36. package/dist/form-fields/single-fields/scale-field.js +52 -52
  37. package/dist/form-fields/single-fields/text-field.d.ts +8 -8
  38. package/dist/form-fields/single-fields/text-field.js +29 -29
  39. package/dist/form-groups/form-abstract-group.d.ts +71 -65
  40. package/dist/form-groups/form-abstract-group.js +278 -255
  41. package/dist/form-groups/form-card.d.ts +32 -32
  42. package/dist/form-groups/form-card.js +89 -89
  43. package/dist/form-groups/form-collapsed-card.d.ts +71 -70
  44. package/dist/form-groups/form-collapsed-card.js +230 -225
  45. package/dist/form-groups/index.d.ts +3 -3
  46. package/dist/form-groups/index.js +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +3 -3
  49. package/dist/lib/additional-components/confirmation-dialog.d.ts +18 -18
  50. package/dist/lib/additional-components/confirmation-dialog.js +52 -52
  51. package/dist/lib/additional-components/etools-fb-card.d.ts +21 -21
  52. package/dist/lib/additional-components/etools-fb-card.js +99 -99
  53. package/dist/lib/styles/attachments.styles.d.ts +2 -2
  54. package/dist/lib/styles/attachments.styles.js +3 -3
  55. package/dist/lib/styles/card-styles.d.ts +2 -2
  56. package/dist/lib/styles/card-styles.js +3 -3
  57. package/dist/lib/styles/dialog.styles.d.ts +2 -2
  58. package/dist/lib/styles/dialog.styles.js +3 -3
  59. package/dist/lib/styles/elevation-styles.d.ts +9 -9
  60. package/dist/lib/styles/elevation-styles.js +10 -10
  61. package/dist/lib/styles/flex-layout-classes.d.ts +2 -2
  62. package/dist/lib/styles/flex-layout-classes.js +3 -3
  63. package/dist/lib/styles/form-builder-card.styles.d.ts +2 -2
  64. package/dist/lib/styles/form-builder-card.styles.js +3 -3
  65. package/dist/lib/styles/input-styles.d.ts +2 -2
  66. package/dist/lib/styles/input-styles.js +3 -3
  67. package/dist/lib/styles/page-layout-styles.d.ts +2 -2
  68. package/dist/lib/styles/page-layout-styles.js +3 -3
  69. package/dist/lib/styles/shared-styles.d.ts +2 -2
  70. package/dist/lib/styles/shared-styles.js +3 -3
  71. package/dist/lib/types/form-builder.interfaces.d.ts +83 -83
  72. package/dist/lib/types/form-builder.types.d.ts +59 -59
  73. package/dist/lib/types/global.types.d.ts +4 -4
  74. package/dist/lib/utils/dialog.d.ts +10 -10
  75. package/dist/lib/utils/dialog.js +21 -21
  76. package/dist/lib/utils/fire-custom-event.d.ts +1 -1
  77. package/dist/lib/utils/fire-custom-event.js +7 -7
  78. package/dist/lib/utils/translate.d.ts +1 -1
  79. package/dist/lib/utils/translate.js +9 -9
  80. package/dist/lib/utils/validations.helper.d.ts +26 -26
  81. package/dist/lib/utils/validations.helper.js +42 -42
  82. package/package.json +1 -1
@@ -1,76 +1,77 @@
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 { clone } from 'ramda';
9
- import { fireEvent } from '../lib/utils/fire-custom-event';
10
- import { openDialog } from '../lib/utils/dialog';
11
- import { FormAbstractGroup, StructureTypes } from './form-abstract-group';
12
- import '../lib/additional-components/etools-fb-card';
13
- import '../lib/additional-components/confirmation-dialog';
14
- import { getTranslation } from '../lib/utils/translate';
15
- const PARTNER_KEY = 'partner';
16
- const OUTPUT_KEY = 'output';
17
- const INTERVENTION_KEY = 'intervention';
18
- let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
19
- constructor() {
20
- super(...arguments);
21
- this.isEditMode = false;
22
- this._readonly = true;
23
- this._value = {};
24
- this.originalValue = {};
25
- }
26
- /**
27
- * Overrides readonly property
28
- * In collapsed card it must consider isEditMode property,
29
- * components inside card are readonly if isEditMode is off or if card is readonly
30
- */
31
- set readonly(state) {
32
- this._readonly = state;
33
- }
34
- get readonly() {
35
- return this._readonly || !this.isEditMode;
36
- }
37
- /**
38
- * Overrides errors setter
39
- * In collapsed card it must consider isEditMode property,
40
- * We must to enable isEditMode if errors comes from backend
41
- */
42
- set errors(errors) {
43
- if (Array.isArray(errors)) {
44
- fireEvent(this, 'toast', { text: errors[0] });
45
- fireEvent(this, 'error-changed', { error: null });
46
- }
47
- else if (errors) {
48
- this._errors = errors;
49
- }
50
- if (errors) {
51
- this.isEditMode = true;
52
- }
53
- }
54
- /**
55
- * Overrides value property
56
- * We need to save originalValue to have Cancel possibility in collapsed card.
57
- * Don't override current edited value if isEditMode enabled
58
- * (It can be happened if other sibling card or component updates their value during current card edition)
59
- */
60
- set value(value) {
61
- this.originalValue = value;
62
- if (!this.isEditMode) {
63
- this._value = clone(value);
64
- }
65
- }
66
- get value() {
67
- return this._value;
68
- }
69
- /**
70
- * Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
71
- * and adds etools-card as container wrapper
72
- */
73
- render() {
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 { clone } from 'ramda';
9
+ import { fireEvent } from '../lib/utils/fire-custom-event';
10
+ import { openDialog } from '../lib/utils/dialog';
11
+ import { FormAbstractGroup, StructureTypes } from './form-abstract-group';
12
+ import '../lib/additional-components/etools-fb-card';
13
+ import '../lib/additional-components/confirmation-dialog';
14
+ import { getTranslation } from '../lib/utils/translate';
15
+ const PARTNER_KEY = 'partner';
16
+ const OUTPUT_KEY = 'output';
17
+ const INTERVENTION_KEY = 'intervention';
18
+ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.collapsed = false;
22
+ this.isEditMode = false;
23
+ this._readonly = true;
24
+ this._value = {};
25
+ this.originalValue = {};
26
+ }
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
+ /**
39
+ * Overrides errors setter
40
+ * In collapsed card it must consider isEditMode property,
41
+ * We must to enable isEditMode if errors comes from backend
42
+ */
43
+ set errors(errors) {
44
+ if (Array.isArray(errors)) {
45
+ fireEvent(this, 'toast', { text: errors[0] });
46
+ fireEvent(this, 'error-changed', { error: null });
47
+ }
48
+ else if (errors) {
49
+ this._errors = errors;
50
+ }
51
+ if (errors) {
52
+ this.isEditMode = true;
53
+ }
54
+ }
55
+ /**
56
+ * Overrides value property
57
+ * We need to save originalValue to have Cancel possibility in collapsed card.
58
+ * Don't override current edited value if isEditMode enabled
59
+ * (It can be happened if other sibling card or component updates their value during current card edition)
60
+ */
61
+ set value(value) {
62
+ this.originalValue = value;
63
+ if (!this.isEditMode) {
64
+ this._value = clone(value);
65
+ }
66
+ }
67
+ get value() {
68
+ return this._value;
69
+ }
70
+ /**
71
+ * Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
72
+ * and adds etools-card as container wrapper
73
+ */
74
+ render() {
74
75
  return html `
75
76
  <section class="elevation page-content card-container" elevation="1">
76
77
  <etools-fb-card
@@ -78,6 +79,7 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
78
79
  is-collapsible
79
80
  ?is-editable="${!this._readonly}"
80
81
  ?edit="${this.isEditMode}"
82
+ .collapsed="${this.collapsed}"
81
83
  @start-edit="${() => this.startEdit()}"
82
84
  @save="${() => this.saveChanges()}"
83
85
  @cancel="${() => this.cancelEdit()}"
@@ -94,161 +96,164 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
94
96
  <div slot="content">${this.renderGroupChildren()}</div>
95
97
  </etools-fb-card>
96
98
  </section>
97
- `;
98
- }
99
- /**
100
- * Filters StructureTypes.ATTACHMENTS_BUTTON type. It will be rendered as button,
101
- * allows parent renderChild method to render other types
102
- */
103
- renderGroupChildren() {
104
- return this.groupStructure.children
105
- .filter(({ styling }) => !styling.includes(StructureTypes.ATTACHMENTS_BUTTON))
106
- .map((child) => super.renderChild(child));
107
- }
108
- /**
109
- * Generate open Attachments popup button.
110
- * It is hidden if tab is readonly and no attachments uploaded
111
- */
112
- getAdditionalButtons() {
113
- var _a, _b, _c, _d, _e, _f;
114
- const hideAttachmentsButton = (this._readonly && !((_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.attachments) === null || _b === void 0 ? void 0 : _b.length)) ||
115
- !this.groupStructure.children.some(({ styling }) => styling.includes(StructureTypes.ATTACHMENTS_BUTTON));
116
- return hideAttachmentsButton
117
- ? html ``
99
+ `;
100
+ }
101
+ /**
102
+ * Filters StructureTypes.ATTACHMENTS_BUTTON type. It will be rendered as button,
103
+ * allows parent renderChild method to render other types
104
+ */
105
+ renderGroupChildren() {
106
+ return this.groupStructure.children
107
+ .filter(({ styling }) => !styling.includes(StructureTypes.ATTACHMENTS_BUTTON))
108
+ .map((child) => super.renderChild(child));
109
+ }
110
+ /**
111
+ * Generate open Attachments popup button.
112
+ * It is hidden if tab is readonly and no attachments uploaded
113
+ */
114
+ getAdditionalButtons() {
115
+ var _a, _b, _c, _d, _e, _f;
116
+ 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
+ !this.groupStructure.children.some(({ styling }) => styling.includes(StructureTypes.ATTACHMENTS_BUTTON));
118
+ return hideAttachmentsButton
119
+ ? html ``
118
120
  : html `
119
121
  <iron-icon icon="warning" class="attachments-warning" ?hidden="${!this._errors.attachments}"></iron-icon>
120
122
  <paper-button @click="${() => this.openAttachmentsPopup()}" class="attachments-button">
121
123
  <iron-icon icon="${((_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.attachments) === null || _d === void 0 ? void 0 : _d.length) ? 'file-download' : 'file-upload'}"></iron-icon>
122
124
  ${this.getAttachmentsBtnText((_f = (_e = this.value) === null || _e === void 0 ? void 0 : _e.attachments) === null || _f === void 0 ? void 0 : _f.length)}
123
125
  </paper-button>
124
- `;
125
- }
126
- retrieveTitle(target) {
127
- switch (target) {
128
- case PARTNER_KEY:
129
- return `${getTranslation(this.language, 'PARTNER')}: `;
130
- case OUTPUT_KEY:
131
- return `${getTranslation(this.language, 'CP_OUTPUT')}: `;
132
- case INTERVENTION_KEY:
133
- return `${getTranslation(this.language, 'PD_SSFA')}: `;
134
- default:
135
- return '';
136
- }
137
- }
138
- startEdit() {
139
- if (this._readonly) {
140
- return;
141
- }
142
- this.isEditMode = true;
143
- }
144
- /**
145
- * We need to rerender view to update all changes that was happen,
146
- * because only fields are updating during @value-change event.
147
- * Only then we can reset all changed values to their original
148
- */
149
- cancelEdit() {
150
- this.requestUpdate().then(() => {
151
- this._value = clone(this.originalValue);
152
- this.isEditMode = false;
153
- });
154
- }
155
- /**
156
- * Updates value property, stops event propagation.
157
- * We need to fire value-changed event only after save button click
158
- */
159
- valueChanged(event, name) {
160
- event.stopPropagation();
161
- if (!this._value) {
162
- this._value = {};
163
- }
164
- if (this._value[name] !== event.detail.value) {
165
- this._value[name] = event.detail.value;
166
- }
167
- }
168
- saveChanges() {
169
- if (Object.keys(this._errors).length) {
170
- fireEvent(this, 'toast', { text: getTranslation(this.language, 'CHECK_FIELDS_TRY_AGAIN') });
171
- return;
172
- }
173
- this.isEditMode = false;
174
- fireEvent(this, 'value-changed', { value: this.value });
175
- }
176
- /**
177
- * Tries to save changed attachments on popup confirm
178
- * Generates value-changed event with originalValue clone if isEditMode enabled.
179
- * In this case it will take only attachments changes and ignore other changes that may happen during card edit
180
- */
181
- openAttachmentsPopup() {
182
- var _a;
183
- if (!customElements.get('form-attachments-popup')) {
184
- throw new Error('Please define "form-attachments-popup" custom element!');
185
- }
186
- openDialog({
187
- dialog: 'form-attachments-popup',
188
- dialogData: {
189
- attachments: (_a = this.value) === null || _a === void 0 ? void 0 : _a.attachments,
190
- metadata: this.metadata,
191
- title: `${getTranslation(this.language, 'ATTACHMENTS_FOR')} ${this.retrieveTitle(this.parentGroupName) + ': ' + this.groupStructure.title}`,
192
- computedPath: this.computedPath.concat([this.groupStructure.name, 'attachments']),
193
- errors: this._errors.attachments
194
- },
195
- readonly: this._readonly
196
- }).then((response) => {
197
- if (!response.confirmed) {
198
- return;
199
- }
200
- if (!this._value) {
201
- this._value = {};
202
- }
203
- this._value.attachments = response.attachments;
204
- delete this._errors.attachments;
205
- fireEvent(this, 'error-changed', { error: Object.keys(this._errors).length ? this._errors : null });
206
- fireEvent(this, 'attachments-changed', { attachments: this._value.attachments });
207
- if (this.isEditMode) {
208
- const tmp = clone(this.originalValue) || {};
209
- tmp.attachments = response.attachments;
210
- fireEvent(this, 'value-changed', { value: tmp });
211
- }
212
- else {
213
- this.saveChanges();
214
- }
215
- this.requestUpdate();
216
- });
217
- }
218
- confirmRemove(groupName) {
219
- openDialog({
220
- dialog: 'confirmation-popup',
221
- dialogData: {
222
- text: `${getTranslation(this.language, 'CONFIRM_DELETE')} ${groupName}`
223
- }
224
- }).then((response) => {
225
- if (response.confirmed) {
226
- fireEvent(this, 'remove-group');
227
- }
228
- });
229
- }
230
- getAttachmentsBtnText(attachmentsCount = 0) {
231
- if (attachmentsCount === 1) {
232
- return `${attachmentsCount} ${getTranslation(this.language, 'FILE')}`;
233
- }
234
- else if (attachmentsCount > 1) {
235
- return `${attachmentsCount} ${getTranslation(this.language, 'FILES')}`;
236
- }
237
- else {
238
- return getTranslation(this.language, 'UPLOAD_FILES');
239
- }
240
- }
241
- };
242
- __decorate([
243
- property()
244
- ], FormCollapsedCard.prototype, "isEditMode", void 0);
245
- __decorate([
246
- property({ type: Boolean, attribute: 'readonly', reflect: true })
247
- ], FormCollapsedCard.prototype, "_readonly", void 0);
248
- __decorate([
249
- property()
250
- ], FormCollapsedCard.prototype, "_value", void 0);
251
- FormCollapsedCard = __decorate([
252
- customElement('form-collapsed-card')
253
- ], FormCollapsedCard);
254
- export { FormCollapsedCard };
126
+ `;
127
+ }
128
+ retrieveTitle(target) {
129
+ switch (target) {
130
+ case PARTNER_KEY:
131
+ return `${getTranslation(this.language, 'PARTNER')}: `;
132
+ case OUTPUT_KEY:
133
+ return `${getTranslation(this.language, 'CP_OUTPUT')}: `;
134
+ case INTERVENTION_KEY:
135
+ return `${getTranslation(this.language, 'PD_SSFA')}: `;
136
+ default:
137
+ return '';
138
+ }
139
+ }
140
+ startEdit() {
141
+ if (this._readonly) {
142
+ return;
143
+ }
144
+ this.isEditMode = true;
145
+ }
146
+ /**
147
+ * We need to rerender view to update all changes that was happen,
148
+ * because only fields are updating during @value-change event.
149
+ * Only then we can reset all changed values to their original
150
+ */
151
+ cancelEdit() {
152
+ this.requestUpdate().then(() => {
153
+ this._value = clone(this.originalValue);
154
+ this.isEditMode = false;
155
+ });
156
+ }
157
+ /**
158
+ * Updates value property, stops event propagation.
159
+ * We need to fire value-changed event only after save button click
160
+ */
161
+ valueChanged(event, name) {
162
+ event.stopPropagation();
163
+ if (!this._value) {
164
+ this._value = {};
165
+ }
166
+ if (this._value[name] !== event.detail.value) {
167
+ this._value[name] = event.detail.value;
168
+ }
169
+ }
170
+ saveChanges() {
171
+ if (Object.keys(this._errors).length) {
172
+ fireEvent(this, 'toast', { text: getTranslation(this.language, 'CHECK_FIELDS_TRY_AGAIN') });
173
+ return;
174
+ }
175
+ this.isEditMode = false;
176
+ fireEvent(this, 'value-changed', { value: this.value });
177
+ }
178
+ /**
179
+ * Tries to save changed attachments on popup confirm
180
+ * Generates value-changed event with originalValue clone if isEditMode enabled.
181
+ * In this case it will take only attachments changes and ignore other changes that may happen during card edit
182
+ */
183
+ openAttachmentsPopup() {
184
+ var _a;
185
+ if (!customElements.get('form-attachments-popup')) {
186
+ throw new Error('Please define "form-attachments-popup" custom element!');
187
+ }
188
+ openDialog({
189
+ dialog: 'form-attachments-popup',
190
+ dialogData: {
191
+ attachments: (_a = this.value) === null || _a === void 0 ? void 0 : _a.attachments,
192
+ metadata: this.metadata,
193
+ title: `${getTranslation(this.language, 'ATTACHMENTS_FOR')} ${this.retrieveTitle(this.parentGroupName) + ': ' + this.groupStructure.title}`,
194
+ computedPath: this.computedPath.concat([this.groupStructure.name, 'attachments']),
195
+ errors: this._errors.attachments
196
+ },
197
+ readonly: this._readonly
198
+ }).then((response) => {
199
+ if (!response.confirmed) {
200
+ return;
201
+ }
202
+ if (!this._value) {
203
+ this._value = {};
204
+ }
205
+ this._value.attachments = response.attachments;
206
+ delete this._errors.attachments;
207
+ fireEvent(this, 'error-changed', { error: Object.keys(this._errors).length ? this._errors : null });
208
+ fireEvent(this, 'attachments-changed', { attachments: this._value.attachments });
209
+ if (this.isEditMode) {
210
+ const tmp = clone(this.originalValue) || {};
211
+ tmp.attachments = response.attachments;
212
+ fireEvent(this, 'value-changed', { value: tmp });
213
+ }
214
+ else {
215
+ this.saveChanges();
216
+ }
217
+ this.requestUpdate();
218
+ });
219
+ }
220
+ confirmRemove(groupName) {
221
+ openDialog({
222
+ dialog: 'confirmation-popup',
223
+ dialogData: {
224
+ text: `${getTranslation(this.language, 'CONFIRM_DELETE')} ${groupName}`
225
+ }
226
+ }).then((response) => {
227
+ if (response.confirmed) {
228
+ fireEvent(this, 'remove-group');
229
+ }
230
+ });
231
+ }
232
+ getAttachmentsBtnText(attachmentsCount = 0) {
233
+ if (attachmentsCount === 1) {
234
+ return `${attachmentsCount} ${getTranslation(this.language, 'FILE')}`;
235
+ }
236
+ else if (attachmentsCount > 1) {
237
+ return `${attachmentsCount} ${getTranslation(this.language, 'FILES')}`;
238
+ }
239
+ else {
240
+ return getTranslation(this.language, 'UPLOAD_FILES');
241
+ }
242
+ }
243
+ };
244
+ __decorate([
245
+ property({ type: Boolean })
246
+ ], FormCollapsedCard.prototype, "collapsed", void 0);
247
+ __decorate([
248
+ property()
249
+ ], FormCollapsedCard.prototype, "isEditMode", void 0);
250
+ __decorate([
251
+ property({ type: Boolean, attribute: 'readonly', reflect: true })
252
+ ], FormCollapsedCard.prototype, "_readonly", void 0);
253
+ __decorate([
254
+ property()
255
+ ], FormCollapsedCard.prototype, "_value", void 0);
256
+ FormCollapsedCard = __decorate([
257
+ customElement('form-collapsed-card')
258
+ ], FormCollapsedCard);
259
+ export { FormCollapsedCard };
@@ -1,3 +1,3 @@
1
- export * from './form-abstract-group';
2
- export * from './form-card';
3
- export * from './form-collapsed-card';
1
+ export * from './form-abstract-group';
2
+ export * from './form-card';
3
+ export * from './form-collapsed-card';
@@ -1,3 +1,3 @@
1
- export * from './form-abstract-group';
2
- export * from './form-card';
3
- export * from './form-collapsed-card';
1
+ export * from './form-abstract-group';
2
+ export * from './form-card';
3
+ export * from './form-collapsed-card';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './form-fields';
2
- export * from './form-groups';
3
- export * from './form-attachments-popup';
1
+ export * from './form-fields';
2
+ export * from './form-groups';
3
+ export * from './form-attachments-popup';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './form-fields';
2
- export * from './form-groups';
3
- export * from './form-attachments-popup';
1
+ export * from './form-fields';
2
+ export * from './form-groups';
3
+ export * from './form-attachments-popup';
@@ -1,18 +1,18 @@
1
- import { LitElement, CSSResultArray } from 'lit-element';
2
- export declare class ConfirmationDialog extends LitElement {
3
- dialogOpened: boolean;
4
- language: string;
5
- text: string;
6
- dialogTitle: string;
7
- hideConfirmBtn: boolean;
8
- set dialogData({ text, dialogTitle, hideConfirmBtn }: {
9
- text: string;
10
- dialogTitle: string;
11
- hideConfirmBtn: boolean;
12
- });
13
- constructor();
14
- render(): unknown;
15
- onClose(): void;
16
- confirm(): void;
17
- static get styles(): CSSResultArray;
18
- }
1
+ import { LitElement, CSSResultArray } from 'lit-element';
2
+ export declare class ConfirmationDialog extends LitElement {
3
+ dialogOpened: boolean;
4
+ language: string;
5
+ text: string;
6
+ dialogTitle: string;
7
+ hideConfirmBtn: boolean;
8
+ set dialogData({ text, dialogTitle, hideConfirmBtn }: {
9
+ text: string;
10
+ dialogTitle: string;
11
+ hideConfirmBtn: boolean;
12
+ });
13
+ constructor();
14
+ render(): unknown;
15
+ onClose(): void;
16
+ confirm(): void;
17
+ static get styles(): CSSResultArray;
18
+ }