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

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 +117 -98
  13. package/dist/form-fields/field-renderer-component.d.ts +20 -20
  14. package/dist/form-fields/field-renderer-component.js +114 -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 +65 -65
  40. package/dist/form-groups/form-abstract-group.js +255 -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 +70 -70
  44. package/dist/form-groups/form-collapsed-card.js +225 -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 +4 -4
@@ -1,76 +1,76 @@
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.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() {
74
74
  return html `
75
75
  <section class="elevation page-content card-container" elevation="1">
76
76
  <etools-fb-card
@@ -94,161 +94,161 @@ let FormCollapsedCard = class FormCollapsedCard extends FormAbstractGroup {
94
94
  <div slot="content">${this.renderGroupChildren()}</div>
95
95
  </etools-fb-card>
96
96
  </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 ``
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 ``
118
118
  : html `
119
119
  <iron-icon icon="warning" class="attachments-warning" ?hidden="${!this._errors.attachments}"></iron-icon>
120
120
  <paper-button @click="${() => this.openAttachmentsPopup()}" class="attachments-button">
121
121
  <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
122
  ${this.getAttachmentsBtnText((_f = (_e = this.value) === null || _e === void 0 ? void 0 : _e.attachments) === null || _f === void 0 ? void 0 : _f.length)}
123
123
  </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 };
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 };
@@ -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
+ }
@@ -1,30 +1,30 @@
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 { LitElement, property, html, css, customElement } from 'lit-element';
8
- import { fireEvent } from '../utils/fire-custom-event';
9
- import { getTranslation } from '../utils/translate';
10
- let ConfirmationDialog = class ConfirmationDialog extends LitElement {
11
- constructor() {
12
- super();
13
- this.dialogOpened = true;
14
- this.text = '';
15
- this.dialogTitle = '';
16
- this.hideConfirmBtn = false;
17
- if (!this.language) {
18
- this.language = window.localStorage.defaultLanguage || 'en';
19
- }
20
- }
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
- 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 { LitElement, property, html, css, customElement } from 'lit-element';
8
+ import { fireEvent } from '../utils/fire-custom-event';
9
+ import { getTranslation } from '../utils/translate';
10
+ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
11
+ constructor() {
12
+ super();
13
+ this.dialogOpened = true;
14
+ this.text = '';
15
+ this.dialogTitle = '';
16
+ this.hideConfirmBtn = false;
17
+ if (!this.language) {
18
+ this.language = window.localStorage.defaultLanguage || 'en';
19
+ }
20
+ }
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
+ render() {
28
28
  return html `
29
29
  <etools-dialog
30
30
  id="confirmation-dialog"
@@ -41,32 +41,32 @@ let ConfirmationDialog = class ConfirmationDialog extends LitElement {
41
41
  >
42
42
  <div class="confirmation-message">${this.text}</div>
43
43
  </etools-dialog>
44
- `;
45
- }
46
- onClose() {
47
- fireEvent(this, 'response', { confirmed: false });
48
- }
49
- confirm() {
50
- fireEvent(this, 'response', { confirmed: true });
51
- }
52
- static get styles() {
53
- // language=CSS
54
- return [
44
+ `;
45
+ }
46
+ onClose() {
47
+ fireEvent(this, 'response', { confirmed: false });
48
+ }
49
+ confirm() {
50
+ fireEvent(this, 'response', { confirmed: true });
51
+ }
52
+ static get styles() {
53
+ // language=CSS
54
+ return [
55
55
  css `
56
56
  .confirmation-message {
57
57
  padding-left: 24px;
58
58
  }
59
- `
60
- ];
61
- }
62
- };
63
- __decorate([
64
- property()
65
- ], ConfirmationDialog.prototype, "dialogOpened", void 0);
66
- __decorate([
67
- property()
68
- ], ConfirmationDialog.prototype, "language", void 0);
69
- ConfirmationDialog = __decorate([
70
- customElement('confirmation-popup')
71
- ], ConfirmationDialog);
72
- export { ConfirmationDialog };
59
+ `
60
+ ];
61
+ }
62
+ };
63
+ __decorate([
64
+ property()
65
+ ], ConfirmationDialog.prototype, "dialogOpened", void 0);
66
+ __decorate([
67
+ property()
68
+ ], ConfirmationDialog.prototype, "language", void 0);
69
+ ConfirmationDialog = __decorate([
70
+ customElement('confirmation-popup')
71
+ ], ConfirmationDialog);
72
+ export { ConfirmationDialog };