@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.
Files changed (87) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +1 -1
  3. package/dist/assets/translations.d.ts +0 -0
  4. package/dist/assets/translations.js +0 -0
  5. package/dist/form-attachments-popup/form-attachments-popup.d.ts +10 -12
  6. package/dist/form-attachments-popup/form-attachments-popup.helper.d.ts +0 -0
  7. package/dist/form-attachments-popup/form-attachments-popup.helper.js +0 -0
  8. package/dist/form-attachments-popup/form-attachments-popup.js +70 -76
  9. package/dist/form-attachments-popup/form-attachments-popup.tpl.d.ts +5 -1
  10. package/dist/form-attachments-popup/form-attachments-popup.tpl.js +92 -81
  11. package/dist/form-attachments-popup/index.d.ts +0 -0
  12. package/dist/form-attachments-popup/index.js +0 -0
  13. package/dist/form-fields/abstract-field-base.class.d.ts +1 -1
  14. package/dist/form-fields/abstract-field-base.class.js +131 -135
  15. package/dist/form-fields/field-renderer-component.d.ts +1 -1
  16. package/dist/form-fields/field-renderer-component.js +150 -154
  17. package/dist/form-fields/index.d.ts +0 -0
  18. package/dist/form-fields/index.js +0 -0
  19. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.d.ts +4 -2
  20. package/dist/form-fields/repeatable-fields/repeatable-attachment-field.js +117 -117
  21. package/dist/form-fields/repeatable-fields/repeatable-base-field.d.ts +2 -1
  22. package/dist/form-fields/repeatable-fields/repeatable-base-field.js +26 -29
  23. package/dist/form-fields/repeatable-fields/repeatable-number-field.d.ts +2 -2
  24. package/dist/form-fields/repeatable-fields/repeatable-number-field.js +24 -28
  25. package/dist/form-fields/repeatable-fields/repeatable-scale-field.d.ts +5 -5
  26. package/dist/form-fields/repeatable-fields/repeatable-scale-field.js +68 -72
  27. package/dist/form-fields/repeatable-fields/repeatable-text-field.d.ts +2 -2
  28. package/dist/form-fields/repeatable-fields/repeatable-text-field.js +27 -31
  29. package/dist/form-fields/single-fields/attachment-field.d.ts +2 -2
  30. package/dist/form-fields/single-fields/attachment-field.js +17 -21
  31. package/dist/form-fields/single-fields/base-field.d.ts +1 -1
  32. package/dist/form-fields/single-fields/base-field.js +2 -7
  33. package/dist/form-fields/single-fields/boolean-field.d.ts +2 -2
  34. package/dist/form-fields/single-fields/boolean-field.js +24 -28
  35. package/dist/form-fields/single-fields/number-field.d.ts +2 -2
  36. package/dist/form-fields/single-fields/number-field.js +25 -29
  37. package/dist/form-fields/single-fields/scale-field.d.ts +6 -6
  38. package/dist/form-fields/single-fields/scale-field.js +69 -70
  39. package/dist/form-fields/single-fields/text-field.d.ts +2 -2
  40. package/dist/form-fields/single-fields/text-field.js +28 -33
  41. package/dist/form-groups/form-abstract-group.d.ts +3 -2
  42. package/dist/form-groups/form-abstract-group.js +147 -144
  43. package/dist/form-groups/form-card.d.ts +5 -2
  44. package/dist/form-groups/form-card.js +39 -32
  45. package/dist/form-groups/form-collapsed-card.d.ts +4 -4
  46. package/dist/form-groups/form-collapsed-card.js +60 -54
  47. package/dist/form-groups/index.d.ts +0 -0
  48. package/dist/form-groups/index.js +0 -0
  49. package/dist/index.d.ts +0 -0
  50. package/dist/index.js +0 -0
  51. package/dist/lib/additional-components/confirmation-dialog.d.ts +1 -1
  52. package/dist/lib/additional-components/confirmation-dialog.js +29 -33
  53. package/dist/lib/additional-components/etools-fb-card.d.ts +2 -2
  54. package/dist/lib/additional-components/etools-fb-card.js +147 -156
  55. package/dist/lib/styles/attachments.styles.d.ts +1 -1
  56. package/dist/lib/styles/attachments.styles.js +67 -70
  57. package/dist/lib/styles/card-styles.d.ts +1 -1
  58. package/dist/lib/styles/card-styles.js +152 -152
  59. package/dist/lib/styles/dialog.styles.d.ts +1 -1
  60. package/dist/lib/styles/dialog.styles.js +84 -83
  61. package/dist/lib/styles/elevation-styles.d.ts +1 -1
  62. package/dist/lib/styles/elevation-styles.js +34 -34
  63. package/dist/lib/styles/flex-layout-classes.d.ts +1 -1
  64. package/dist/lib/styles/flex-layout-classes.js +317 -317
  65. package/dist/lib/styles/form-builder-card.styles.d.ts +1 -1
  66. package/dist/lib/styles/form-builder-card.styles.js +47 -47
  67. package/dist/lib/styles/input-styles.d.ts +1 -1
  68. package/dist/lib/styles/input-styles.js +141 -136
  69. package/dist/lib/styles/page-layout-styles.d.ts +1 -1
  70. package/dist/lib/styles/page-layout-styles.js +199 -199
  71. package/dist/lib/styles/shared-styles.d.ts +1 -1
  72. package/dist/lib/styles/shared-styles.js +68 -68
  73. package/dist/lib/types/form-builder.interfaces.d.ts +2 -1
  74. package/dist/lib/types/form-builder.interfaces.js +1 -0
  75. package/dist/lib/types/form-builder.types.d.ts +7 -7
  76. package/dist/lib/types/form-builder.types.js +1 -0
  77. package/dist/lib/types/global.types.d.ts +2 -2
  78. package/dist/lib/types/global.types.js +1 -0
  79. package/dist/lib/utils/dialog.d.ts +0 -0
  80. package/dist/lib/utils/dialog.js +0 -0
  81. package/dist/lib/utils/fire-custom-event.d.ts +0 -0
  82. package/dist/lib/utils/fire-custom-event.js +0 -0
  83. package/dist/lib/utils/translate.d.ts +0 -0
  84. package/dist/lib/utils/translate.js +0 -0
  85. package/dist/lib/utils/validations.helper.d.ts +5 -5
  86. package/dist/lib/utils/validations.helper.js +0 -0
  87. package/package.json +55 -56
@@ -1,14 +1,10 @@
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';
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
8
4
  import '../form-fields/single-fields/text-field';
9
5
  import '../form-fields/single-fields/number-field';
10
6
  import '../form-fields/single-fields/scale-field';
11
- import '@polymer/paper-input/paper-textarea';
7
+ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
12
8
  import { SharedStyles } from '../lib/styles/shared-styles';
13
9
  import { pageLayoutStyles } from '../lib/styles/page-layout-styles';
14
10
  import { elevationStyles } from '../lib/styles/elevation-styles';
@@ -16,7 +12,7 @@ import { CardStyles } from '../lib/styles/card-styles';
16
12
  import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
17
13
  import { fireEvent } from '../lib/utils/fire-custom-event';
18
14
  import { clone } from 'ramda';
19
- import { live } from 'lit-html/directives/live';
15
+ import { live } from 'lit/directives/live.js';
20
16
  import { openDialog } from '../lib/utils/dialog';
21
17
  import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
22
18
  import { getTranslation } from '../lib/utils/translate';
@@ -40,19 +36,6 @@ export var StructureTypes;
40
36
  StructureTypes["ATTACHMENTS_BUTTON"] = "floating_attachments";
41
37
  })(StructureTypes || (StructureTypes = {}));
42
38
  let FormAbstractGroup = class FormAbstractGroup extends LitElement {
43
- constructor() {
44
- super();
45
- this.parentGroupName = '';
46
- this.collapsed = false;
47
- this.readonly = false;
48
- this._errors = {};
49
- this._value = {};
50
- this.computedPath = [];
51
- if (!this.language) {
52
- this.language = window.localStorage.defaultLanguage || 'en';
53
- }
54
- this.handleLanguageChange = this.handleLanguageChange.bind(this);
55
- }
56
39
  /**
57
40
  * Make value property immutable
58
41
  * @param value
@@ -68,6 +51,9 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
68
51
  get value() {
69
52
  return this._value;
70
53
  }
54
+ isReadonly() {
55
+ return this.readonly;
56
+ }
71
57
  /**
72
58
  * Setter for handling error.
73
59
  * Normally we wouldn't have errors as string or string[] for FormGroups.
@@ -84,6 +70,19 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
84
70
  this._errors = errors;
85
71
  }
86
72
  }
73
+ constructor() {
74
+ super();
75
+ this.parentGroupName = '';
76
+ this.collapsed = false;
77
+ this.readonly = false;
78
+ this._errors = {};
79
+ this._value = {};
80
+ this.computedPath = [];
81
+ if (!this.language) {
82
+ this.language = window.localStorage.defaultLanguage || 'en';
83
+ }
84
+ this.handleLanguageChange = this.handleLanguageChange.bind(this);
85
+ }
87
86
  connectedCallback() {
88
87
  super.connectedCallback();
89
88
  document.addEventListener('language-changed', this.handleLanguageChange.bind(this));
@@ -111,8 +110,8 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
111
110
  if (!this.groupStructure || !this.metadata) {
112
111
  return html ``;
113
112
  }
114
- return html `
115
- ${this.groupStructure.children.map((child) => this.renderChild(child))}
113
+ return html `
114
+ ${this.groupStructure.children.map((child) => this.renderChild(child))}
116
115
  `;
117
116
  }
118
117
  renderChild(child) {
@@ -131,18 +130,18 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
131
130
  }
132
131
  renderField(blueprintField) {
133
132
  var _a;
134
- return html `
135
- <field-renderer
136
- .field="${blueprintField}"
137
- ?readonly="${live(this.readonly)}"
138
- .value="${this.value && this.value[blueprintField.name]}"
139
- .validations="${blueprintField.validations.map((validation) => this.metadata.validations[validation])}"
140
- .errorMessage="${this.getErrorMessage(blueprintField.name)}"
141
- .options="${((_a = this.metadata.options[blueprintField.options_key || '']) === null || _a === void 0 ? void 0 : _a.values) || []}"
142
- .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [blueprintField.name] : [this.groupStructure.name, blueprintField.name])}"
143
- @value-changed="${(event) => this.valueChanged(event, blueprintField.name)}"
144
- @error-changed="${(event) => this.errorChanged(event, blueprintField.name)}"
145
- ></field-renderer>
133
+ return html `
134
+ <field-renderer
135
+ .field="${blueprintField}"
136
+ ?readonly="${live(this.isReadonly())}"
137
+ .value="${this.value && this.value[blueprintField.name]}"
138
+ .validations="${blueprintField.validations.map((validation) => this.metadata.validations[validation])}"
139
+ .errorMessage="${this.getErrorMessage(blueprintField.name)}"
140
+ .options="${((_a = this.metadata.options[blueprintField.options_key || '']) === null || _a === void 0 ? void 0 : _a.values) || []}"
141
+ .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [blueprintField.name] : [this.groupStructure.name, blueprintField.name])}"
142
+ @value-changed="${(event) => this.valueChanged(event, blueprintField.name)}"
143
+ @error-changed="${(event) => this.errorChanged(event, blueprintField.name)}"
144
+ ></field-renderer>
146
145
  `;
147
146
  }
148
147
  renderInformation(information) {
@@ -153,14 +152,18 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
153
152
  return this.getGroupTemplate(groupStructure);
154
153
  }
155
154
  const value = (this.value && this.value[groupStructure.name]) || [{}];
156
- return html `
157
- ${value.map((_, index) => this.getGroupTemplate(groupStructure, index))}
158
- <paper-button class="add-group save-button" @click="${() => this.addGroup(groupStructure.name)}">
159
- ${getTranslation(this.language, 'ADD')}
155
+ return html `
156
+ ${value.map((_, index) => this.getGroupTemplate(groupStructure, index))}
157
+ <etools-button
158
+ variant="primary"
159
+ class="add-group save-button"
160
+ @click="${() => this.addGroup(groupStructure.name)}"
161
+ >
162
+ ${getTranslation(this.language, 'ADD')}
160
163
  ${!groupStructure.title || groupStructure.title.length > 15
161
164
  ? getTranslation(this.language, 'GROUP')
162
- : groupStructure.title}
163
- </paper-button>
165
+ : groupStructure.title}
166
+ </etools-button>
164
167
  `;
165
168
  }
166
169
  getGroupTemplate(groupStructure, index) {
@@ -176,52 +179,52 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
176
179
  errors = errors && errors[index];
177
180
  }
178
181
  if (isAbstract) {
179
- return html `
180
- <form-abstract-group
181
- .groupStructure="${groupStructure}"
182
- .value="${value}"
183
- .metadata="${this.metadata}"
184
- .parentGroupName="${this.groupStructure.name}"
185
- .collapsed="${this.collapsed}"
186
- .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
187
- .readonly="${this.readonly}"
188
- .errors="${errors || null}"
189
- @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
190
- @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
191
- ></form-abstract-group>
182
+ return html `
183
+ <form-abstract-group
184
+ .groupStructure="${groupStructure}"
185
+ .value="${value}"
186
+ .metadata="${this.metadata}"
187
+ .parentGroupName="${this.groupStructure.name}"
188
+ .collapsed="${this.collapsed}"
189
+ .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
190
+ .readonly="${this.isReadonly()}"
191
+ .errors="${errors || null}"
192
+ @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
193
+ @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
194
+ ></form-abstract-group>
192
195
  `;
193
196
  }
194
197
  else if (isCard && isCollapsed) {
195
- return html `
196
- <form-collapsed-card
197
- .groupStructure="${groupStructure}"
198
- .value="${value}"
199
- .metadata="${this.metadata}"
200
- .parentGroupName="${this.groupStructure.name}"
201
- .collapsed="${this.collapsed}"
202
- .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
203
- .readonly="${this.readonly}"
204
- .errors="${errors || null}"
205
- @remove-group="${() => this.removeGroup(groupStructure, index)}"
206
- @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
207
- @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
208
- ></form-collapsed-card>
198
+ return html `
199
+ <form-collapsed-card
200
+ .groupStructure="${groupStructure}"
201
+ .value="${value}"
202
+ .metadata="${this.metadata}"
203
+ .parentGroupName="${this.groupStructure.name}"
204
+ .collapsed="${this.collapsed}"
205
+ .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
206
+ .readonly="${this.isReadonly()}"
207
+ .errors="${errors || null}"
208
+ @remove-group="${() => this.removeGroup(groupStructure, index)}"
209
+ @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
210
+ @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
211
+ ></form-collapsed-card>
209
212
  `;
210
213
  }
211
214
  else if (isCard) {
212
- return html `
213
- <form-card
214
- .groupStructure="${groupStructure}"
215
- .value="${value}"
216
- .metadata="${this.metadata}"
217
- .parentGroupName="${this.groupStructure.name}"
218
- .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
219
- .readonly="${this.readonly}"
220
- .errors="${errors || null}"
221
- @remove-group="${() => this.removeGroup(groupStructure, index)}"
222
- @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
223
- @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
224
- ></form-card>
215
+ return html `
216
+ <form-card
217
+ .groupStructure="${groupStructure}"
218
+ .value="${value}"
219
+ .metadata="${this.metadata}"
220
+ .parentGroupName="${this.groupStructure.name}"
221
+ .computedPath="${this.computedPath.concat(this.groupStructure.name === 'root' ? [] : [this.groupStructure.name])}"
222
+ .readonly="${this.isReadonly()}"
223
+ .errors="${errors || null}"
224
+ @remove-group="${() => this.removeGroup(groupStructure, index)}"
225
+ @value-changed="${(event) => this.valueChanged(event, groupStructure.name, index)}"
226
+ @error-changed="${(event) => this.errorChanged(event, groupStructure.name, index)}"
227
+ ></form-card>
225
228
  `;
226
229
  }
227
230
  else {
@@ -302,68 +305,68 @@ let FormAbstractGroup = class FormAbstractGroup extends LitElement {
302
305
  CardStyles,
303
306
  FlexLayoutClasses,
304
307
  FormBuilderCardStyles,
305
- css `
306
- :host {
307
- display: flex;
308
- flex-direction: column;
309
- }
310
- .add-group {
311
- align-self: flex-end;
312
- margin-right: 23px;
313
- margin-top: 20px;
314
- box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12),
315
- 0 2px 4px -1px rgba(0, 0, 0, 0.4);
316
- }
317
- .card-header {
318
- display: flex;
319
- align-items: center;
320
- justify-content: space-between;
321
- }
322
- .card-header .remove-group {
323
- display: flex;
324
- align-items: center;
325
- justify-content: flex-end;
326
- padding: 0 10px 8px;
327
- cursor: pointer;
328
- width: min-content;
329
- white-space: nowrap;
330
- }
331
- .card-header .title {
332
- padding: 0 24px 8px;
333
- font-size: 18px;
334
- font-weight: bold;
335
- }
336
- .save-button {
337
- margin-top: 8px;
338
- color: var(--primary-background-color);
339
- background-color: var(--primary-color);
340
- }
341
- .information-source {
342
- padding: 0.5% 2% 0.5% 1%;
343
- }
344
-
345
- .additional-field {
346
- padding-top: 15px;
347
- padding-bottom: 20px;
348
- background-color: var(--secondary-background-color);
349
- }
350
-
351
- .actions-container {
352
- padding: 0 25px 5px 45px;
353
- box-sizing: border-box;
354
- }
355
-
356
- .card-container.form-card {
357
- padding: 12px 0 15px;
358
- }
359
-
360
- .attachments-warning {
361
- color: red;
362
- }
363
- paper-icon-button[icon='close'] {
364
- cursor: pointer;
365
- color: var(--primary-text-color);
366
- }
308
+ css `
309
+ :host {
310
+ display: flex;
311
+ flex-direction: column;
312
+ }
313
+ .add-group {
314
+ align-self: flex-end;
315
+ margin-right: 23px;
316
+ margin-top: 20px;
317
+ box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12),
318
+ 0 2px 4px -1px rgba(0, 0, 0, 0.4);
319
+ }
320
+ .card-header {
321
+ display: flex;
322
+ align-items: center;
323
+ justify-content: space-between;
324
+ }
325
+ .card-header .remove-group {
326
+ display: flex;
327
+ align-items: center;
328
+ justify-content: flex-end;
329
+ padding: 0 10px 8px;
330
+ cursor: pointer;
331
+ width: min-content;
332
+ white-space: nowrap;
333
+ }
334
+ .card-header .title {
335
+ padding: 0 24px 8px;
336
+ font-size: 18px;
337
+ font-weight: bold;
338
+ }
339
+ .save-button {
340
+ margin-top: 8px;
341
+ color: var(--primary-background-color);
342
+ background-color: var(--primary-color);
343
+ }
344
+ .information-source {
345
+ padding: 0.5% 2% 0.5% 1%;
346
+ }
347
+
348
+ .additional-field {
349
+ padding-top: 15px;
350
+ padding-bottom: 20px;
351
+ background-color: var(--secondary-background-color);
352
+ }
353
+
354
+ .actions-container {
355
+ padding: 0 25px 5px 45px;
356
+ box-sizing: border-box;
357
+ }
358
+
359
+ .card-container.form-card {
360
+ padding: 12px 0 15px;
361
+ }
362
+
363
+ .attachments-warning {
364
+ color: red;
365
+ }
366
+ etools-icon-button[name='close'] {
367
+ cursor: pointer;
368
+ color: var(--primary-text-color);
369
+ }
367
370
  `
368
371
  ];
369
372
  }
@@ -1,8 +1,10 @@
1
- import { TemplateResult } from 'lit-element';
1
+ import { CSSResultArray, TemplateResult } from 'lit';
2
2
  import { IFormBuilderCard } from '../lib/types/form-builder.interfaces';
3
3
  import { FormAbstractGroup } from './form-abstract-group';
4
4
  import { GenericObject } from '../lib/types/global.types';
5
- import '@polymer/iron-collapse';
5
+ import '@unicef-polymer/etools-unicef/src/etools-collapse/etools-collapse';
6
+ import '@unicef-polymer/etools-unicef/src/etools-icons/etools-icon';
7
+ import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
6
8
  export declare class FormCard extends FormAbstractGroup implements IFormBuilderCard {
7
9
  protected _value: GenericObject;
8
10
  /**
@@ -21,6 +23,7 @@ export declare class FormCard extends FormAbstractGroup implements IFormBuilderC
21
23
  * Extends parent render method,
22
24
  * adds card-container html wrapper and dynamic save button
23
25
  */
26
+ static get styles(): CSSResultArray;
24
27
  render(): TemplateResult;
25
28
  /**
26
29
  * Updates value property, stops event propagation.
@@ -1,16 +1,20 @@
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';
1
+ import { __decorate } from "tslib";
2
+ import { html } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
8
4
  import { fireEvent } from '../lib/utils/fire-custom-event';
9
5
  import { clone, equals } from 'ramda';
10
6
  import { FormAbstractGroup } from './form-abstract-group';
11
- import '@polymer/iron-collapse';
12
7
  import { openDialog } from '../lib/utils/dialog';
13
8
  import { getTranslation } from '../lib/utils/translate';
9
+ import '@unicef-polymer/etools-unicef/src/etools-collapse/etools-collapse';
10
+ import '@unicef-polymer/etools-unicef/src/etools-icons/etools-icon';
11
+ import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
12
+ import { SharedStyles } from '../lib/styles/shared-styles';
13
+ import { pageLayoutStyles } from '../lib/styles/page-layout-styles';
14
+ import { elevationStyles } from '../lib/styles/elevation-styles';
15
+ import { CardStyles } from '../lib/styles/card-styles';
16
+ import { FlexLayoutClasses } from '../lib/styles/flex-layout-classes';
17
+ import { FormBuilderCardStyles } from '../lib/styles/form-builder-card.styles';
14
18
  let FormCard = class FormCard extends FormAbstractGroup {
15
19
  constructor() {
16
20
  super(...arguments);
@@ -39,33 +43,36 @@ let FormCard = class FormCard extends FormAbstractGroup {
39
43
  * Extends parent render method,
40
44
  * adds card-container html wrapper and dynamic save button
41
45
  */
46
+ static get styles() {
47
+ return [SharedStyles, pageLayoutStyles, elevationStyles, CardStyles, FlexLayoutClasses, FormBuilderCardStyles];
48
+ }
42
49
  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
50
+ return html `
51
+ <section class="elevation page-content card-container form-card" elevation="1">
52
+ <div class="card-header">
53
+ <div class="title">${this.groupStructure.title}</div>
54
+ <div
55
+ class="remove-group"
56
+ ?hidden="${!this.groupStructure.repeatable}"
57
+ @click="${() => this.confirmRemove(this.groupStructure.title || getTranslation(this.language, 'THIS_GROUP'))}"
58
+ >
59
+ Remove
53
60
  ${!this.groupStructure.title || this.groupStructure.title.length > 15
54
61
  ? 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>
62
+ : this.groupStructure.title}
63
+ <etools-icon-button class="attachments-warning" name="delete"></etools-icon-button>
64
+ </div>
65
+ </div>
66
+ ${super.render()}
67
+
68
+ <etools-collapse ?opened="${this.showSaveButton}">
69
+ <div class="layout horizontal end-justified card-buttons actions-container">
70
+ <etools-button variant="primary" @click="${this.saveChanges}">
71
+ ${getTranslation(this.language, 'SAVE')}
72
+ </etools-button>
73
+ </div>
74
+ </etools-collapse>
75
+ </section>
69
76
  `;
70
77
  }
71
78
  /**
@@ -1,9 +1,10 @@
1
- import { TemplateResult } from 'lit-element';
1
+ import { TemplateResult } from 'lit';
2
2
  import { IFormBuilderCard, IFormBuilderCollapsedCard } from '../lib/types/form-builder.interfaces';
3
3
  import { FormAbstractGroup } from './form-abstract-group';
4
4
  import '../lib/additional-components/etools-fb-card';
5
5
  import { GenericObject } from '../lib/types/global.types';
6
6
  import '../lib/additional-components/confirmation-dialog';
7
+ import '@unicef-polymer/etools-unicef/src/etools-icon-button/etools-icon-button';
7
8
  export declare class FormCollapsedCard extends FormAbstractGroup implements IFormBuilderCollapsedCard, IFormBuilderCard {
8
9
  collapsed: boolean;
9
10
  /**
@@ -11,10 +12,8 @@ export declare class FormCollapsedCard extends FormAbstractGroup implements IFor
11
12
  * In collapsed card it must consider isEditMode property,
12
13
  * components inside card are readonly if isEditMode is off or if card is readonly
13
14
  */
14
- set readonly(state: boolean);
15
- get readonly(): boolean;
16
15
  protected isEditMode: boolean;
17
- protected _readonly: boolean;
16
+ readonly: boolean;
18
17
  /**
19
18
  * Overrides errors setter
20
19
  * In collapsed card it must consider isEditMode property,
@@ -31,6 +30,7 @@ export declare class FormCollapsedCard extends FormAbstractGroup implements IFor
31
30
  get value(): GenericObject;
32
31
  protected _value: GenericObject;
33
32
  protected originalValue: GenericObject;
33
+ isReadonly(): boolean;
34
34
  /**
35
35
  * Extends parent render method for handling additional types (StructureTypes.ATTACHMENTS_BUTTON in our case)
36
36
  * and adds etools-card as container wrapper