@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,201 +1,201 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
  // language=CSS
3
- export const pageLayoutStyles = css `
4
- .page-content {
5
- margin: 24px 24px 0;
6
- }
7
-
8
- .page-content.filters {
9
- padding: 8px 24px;
10
- }
11
-
12
- .pr-25 {
13
- padding-right: 25px !important;
14
- }
15
- .pr-45 {
16
- padding-right: 45px !important;
17
- }
18
-
19
- .f1 {
20
- flex: 1;
21
- }
22
- .f2 {
23
- flex: 2;
24
- }
25
- .f3 {
26
- flex: 3;
27
- }
28
- .f4 {
29
- flex: 4;
30
- }
31
- .f5 {
32
- flex: 5;
33
- }
34
- .f6 {
35
- flex: 6;
36
- }
37
- .f7 {
38
- flex: 7;
39
- }
40
- .f8 {
41
- flex: 8;
42
- }
43
-
44
- .w4 {
45
- width: 4%;
46
- }
47
- .w5 {
48
- width: 5%;
49
- }
50
- .w7 {
51
- width: 7%;
52
- }
53
- .w8 {
54
- width: 8%;
55
- }
56
- .w9 {
57
- width: 9%;
58
- }
59
- .w10 {
60
- width: 10%;
61
- }
62
- .w13 {
63
- width: 13%;
64
- }
65
- .w14 {
66
- width: 14%;
67
- }
68
- .w15 {
69
- width: 15%;
70
- }
71
- .w16 {
72
- width: 16%;
73
- }
74
- .w17 {
75
- width: 17%;
76
- }
77
- .w18 {
78
- width: 18%;
79
- }
80
- .w20 {
81
- width: 20%;
82
- }
83
- .w25 {
84
- width: 25%;
85
- }
86
- .w30 {
87
- width: 30%;
88
- }
89
- .w35 {
90
- width: 35%;
91
- }
92
- .w45 {
93
- width: 45%;
94
- }
95
- .w40 {
96
- width: 40%;
97
- }
98
- .w50 {
99
- width: 50%;
100
- }
101
- .w60 {
102
- width: 60%;
103
- }
104
- .w65 {
105
- width: 65%;
106
- }
107
- .w70 {
108
- width: 70%;
109
- }
110
- .w75 {
111
- width: 75%;
112
- }
113
- .w80 {
114
- width: 80%;
115
- }
116
- .w90 {
117
- width: 90%;
118
- }
119
- .w95 {
120
- width: 95%;
121
- }
122
- .w96 {
123
- width: 96%;
124
- }
125
- .w100 {
126
- width: 100%;
127
- }
128
-
129
- .w30px {
130
- width: 30px;
131
- }
132
- .w35px {
133
- width: 35px;
134
- }
135
- .w40px {
136
- width: 40px;
137
- }
138
- .w45px {
139
- width: 45px;
140
- }
141
- .w50px {
142
- width: 50px;
143
- }
144
- .w60px {
145
- width: 60px;
146
- }
147
- .w65px {
148
- width: 65px;
149
- }
150
- .w80px {
151
- width: 80px;
152
- }
153
- .w90px {
154
- width: 90px;
155
- }
156
- .w100px {
157
- width: 100px;
158
- }
159
- .w110px {
160
- width: 110px;
161
- }
162
- .w120px {
163
- width: 120px;
164
- }
165
- .w130px {
166
- width: 130px;
167
- }
168
- .w140px {
169
- width: 140px;
170
- }
171
- .w150px {
172
- width: 150px;
173
- }
174
- .w160px {
175
- width: 160px;
176
- }
177
- .w180px {
178
- width: 180px;
179
- }
180
- .w200px {
181
- width: 200px;
182
- }
183
- .w210px {
184
- width: 210px;
185
- }
186
- .w300px {
187
- width: 300px;
188
- }
189
- .w310px {
190
- width: 310px;
191
- }
192
- .w330px {
193
- width: 330px;
194
- }
195
-
196
- @media (max-width: 768px) {
197
- .page-content {
198
- margin: 8px;
199
- }
200
- }
3
+ export const pageLayoutStyles = css `
4
+ .page-content {
5
+ margin: 24px 24px 0;
6
+ }
7
+
8
+ .page-content.filters {
9
+ padding: 8px 24px;
10
+ }
11
+
12
+ .pr-25 {
13
+ padding-right: 25px !important;
14
+ }
15
+ .pr-45 {
16
+ padding-right: 45px !important;
17
+ }
18
+
19
+ .f1 {
20
+ flex: 1;
21
+ }
22
+ .f2 {
23
+ flex: 2;
24
+ }
25
+ .f3 {
26
+ flex: 3;
27
+ }
28
+ .f4 {
29
+ flex: 4;
30
+ }
31
+ .f5 {
32
+ flex: 5;
33
+ }
34
+ .f6 {
35
+ flex: 6;
36
+ }
37
+ .f7 {
38
+ flex: 7;
39
+ }
40
+ .f8 {
41
+ flex: 8;
42
+ }
43
+
44
+ .w4 {
45
+ width: 4%;
46
+ }
47
+ .w5 {
48
+ width: 5%;
49
+ }
50
+ .w7 {
51
+ width: 7%;
52
+ }
53
+ .w8 {
54
+ width: 8%;
55
+ }
56
+ .w9 {
57
+ width: 9%;
58
+ }
59
+ .w10 {
60
+ width: 10%;
61
+ }
62
+ .w13 {
63
+ width: 13%;
64
+ }
65
+ .w14 {
66
+ width: 14%;
67
+ }
68
+ .w15 {
69
+ width: 15%;
70
+ }
71
+ .w16 {
72
+ width: 16%;
73
+ }
74
+ .w17 {
75
+ width: 17%;
76
+ }
77
+ .w18 {
78
+ width: 18%;
79
+ }
80
+ .w20 {
81
+ width: 20%;
82
+ }
83
+ .w25 {
84
+ width: 25%;
85
+ }
86
+ .w30 {
87
+ width: 30%;
88
+ }
89
+ .w35 {
90
+ width: 35%;
91
+ }
92
+ .w45 {
93
+ width: 45%;
94
+ }
95
+ .w40 {
96
+ width: 40%;
97
+ }
98
+ .w50 {
99
+ width: 50%;
100
+ }
101
+ .w60 {
102
+ width: 60%;
103
+ }
104
+ .w65 {
105
+ width: 65%;
106
+ }
107
+ .w70 {
108
+ width: 70%;
109
+ }
110
+ .w75 {
111
+ width: 75%;
112
+ }
113
+ .w80 {
114
+ width: 80%;
115
+ }
116
+ .w90 {
117
+ width: 90%;
118
+ }
119
+ .w95 {
120
+ width: 95%;
121
+ }
122
+ .w96 {
123
+ width: 96%;
124
+ }
125
+ .w100 {
126
+ width: 100%;
127
+ }
128
+
129
+ .w30px {
130
+ width: 30px;
131
+ }
132
+ .w35px {
133
+ width: 35px;
134
+ }
135
+ .w40px {
136
+ width: 40px;
137
+ }
138
+ .w45px {
139
+ width: 45px;
140
+ }
141
+ .w50px {
142
+ width: 50px;
143
+ }
144
+ .w60px {
145
+ width: 60px;
146
+ }
147
+ .w65px {
148
+ width: 65px;
149
+ }
150
+ .w80px {
151
+ width: 80px;
152
+ }
153
+ .w90px {
154
+ width: 90px;
155
+ }
156
+ .w100px {
157
+ width: 100px;
158
+ }
159
+ .w110px {
160
+ width: 110px;
161
+ }
162
+ .w120px {
163
+ width: 120px;
164
+ }
165
+ .w130px {
166
+ width: 130px;
167
+ }
168
+ .w140px {
169
+ width: 140px;
170
+ }
171
+ .w150px {
172
+ width: 150px;
173
+ }
174
+ .w160px {
175
+ width: 160px;
176
+ }
177
+ .w180px {
178
+ width: 180px;
179
+ }
180
+ .w200px {
181
+ width: 200px;
182
+ }
183
+ .w210px {
184
+ width: 210px;
185
+ }
186
+ .w300px {
187
+ width: 300px;
188
+ }
189
+ .w310px {
190
+ width: 310px;
191
+ }
192
+ .w330px {
193
+ width: 330px;
194
+ }
195
+
196
+ @media (max-width: 768px) {
197
+ .page-content {
198
+ margin: 8px;
199
+ }
200
+ }
201
201
  `;
@@ -1,2 +1,2 @@
1
- import { CSSResult } from 'lit-element';
1
+ import { CSSResult } from 'lit';
2
2
  export declare const SharedStyles: CSSResult;
@@ -1,70 +1,70 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
  // language=CSS
3
- export const SharedStyles = css `
4
- :host {
5
- display: block;
6
- box-sizing: border-box;
7
- }
8
-
9
- *[hidden] {
10
- display: none !important;
11
- }
12
-
13
- h1,
14
- h2 {
15
- color: var(--primary-text-color);
16
- margin: 0;
17
- font-weight: normal;
18
- }
19
-
20
- h1 {
21
- text-transform: capitalize;
22
- font-size: 24px;
23
- }
24
-
25
- h2 {
26
- font-size: 20px;
27
- }
28
-
29
- a {
30
- color: var(--primary-color);
31
- text-underline: none;
32
- }
33
-
34
- section {
35
- padding: 18px 24px;
36
- background-color: var(--primary-background-color);
37
- }
38
-
39
- .toggle-button-control {
40
- display: flex;
41
- flex-direction: row;
42
- align-items: center;
43
- margin: 0 16px;
44
- align-self: center;
45
- padding: 18px 0 18px 10px;
46
- }
47
-
48
- .toggle-button-control span {
49
- padding: 0 12px;
50
- font-size: 16px;
51
- }
52
-
53
- .toggle-button-control paper-checkbox {
54
- --paper-checkbox-label: {
55
- padding-left: 0;
56
- }
57
- }
58
-
59
- .readonly {
60
- pointer-events: none;
61
- }
62
-
63
- pages-header-element {
64
- box-shadow: 1px -3px 9px 0 #000000;
65
- }
66
-
67
- .filters-section {
68
- padding: 0 30px;
69
- }
3
+ export const SharedStyles = css `
4
+ :host {
5
+ display: block;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ *[hidden] {
10
+ display: none !important;
11
+ }
12
+
13
+ h1,
14
+ h2 {
15
+ color: var(--primary-text-color);
16
+ margin: 0;
17
+ font-weight: normal;
18
+ }
19
+
20
+ h1 {
21
+ text-transform: capitalize;
22
+ font-size: 24px;
23
+ }
24
+
25
+ h2 {
26
+ font-size: 20px;
27
+ }
28
+
29
+ a {
30
+ color: var(--primary-color);
31
+ text-underline: none;
32
+ }
33
+
34
+ section {
35
+ padding: 18px 24px;
36
+ background-color: var(--primary-background-color);
37
+ }
38
+
39
+ .toggle-button-control {
40
+ display: flex;
41
+ flex-direction: row;
42
+ align-items: center;
43
+ margin: 0 16px;
44
+ align-self: center;
45
+ padding: 18px 0 18px 10px;
46
+ }
47
+
48
+ .toggle-button-control span {
49
+ padding: 0 12px;
50
+ font-size: 16px;
51
+ }
52
+
53
+ .toggle-button-control paper-checkbox {
54
+ --paper-checkbox-label: {
55
+ padding-left: 0;
56
+ }
57
+ }
58
+
59
+ .readonly {
60
+ pointer-events: none;
61
+ }
62
+
63
+ pages-header-element {
64
+ box-shadow: 1px -3px 9px 0 #000000;
65
+ }
66
+
67
+ .filters-section {
68
+ padding: 0 30px;
69
+ }
70
70
  `;
@@ -1,4 +1,4 @@
1
- import { TemplateResult } from 'lit-element';
1
+ import { TemplateResult } from 'lit';
2
2
  import { BlueprintField, BlueprintGroup, BlueprintMetadata } from './form-builder.types';
3
3
  import { GenericObject } from './global.types';
4
4
  /** Component for rendering BlueprintGroup with group.extra.type.includes('abstract') or group.name === 'root' */
@@ -7,6 +7,7 @@ export interface IFormBuilderAbstractGroup {
7
7
  metadata: BlueprintMetadata;
8
8
  parentGroupName: string;
9
9
  readonly: boolean;
10
+ isReadonly: () => boolean;
10
11
  value: GenericObject;
11
12
  /**
12
13
  * Updates groupValue object by this.value[fieldName] = event.details.value
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { FieldValidator } from '../utils/validations.helper';
2
2
  import { GenericObject } from './global.types';
3
3
  /** JSON file from backend */
4
- export declare type ChecklistFormJson = {
4
+ export type ChecklistFormJson = {
5
5
  blueprint: {
6
6
  code: string;
7
7
  metadata: BlueprintMetadata;
@@ -11,7 +11,7 @@ export declare type ChecklistFormJson = {
11
11
  value: GenericObject;
12
12
  };
13
13
  /** --------- */
14
- export declare type BlueprintGroup = {
14
+ export type BlueprintGroup = {
15
15
  type: 'group';
16
16
  extra: GenericObject;
17
17
  styling: string[];
@@ -21,7 +21,7 @@ export declare type BlueprintGroup = {
21
21
  title: string | null;
22
22
  children: (BlueprintGroup | BlueprintField | Information)[];
23
23
  };
24
- export declare type BlueprintField = {
24
+ export type BlueprintField = {
25
25
  type: 'field';
26
26
  extra: GenericObject;
27
27
  styling: string[];
@@ -36,24 +36,24 @@ export declare type BlueprintField = {
36
36
  default_value: null;
37
37
  options_key: null;
38
38
  };
39
- export declare type Information = {
39
+ export type Information = {
40
40
  type: 'information';
41
41
  extra: GenericObject;
42
42
  styling: string[];
43
43
  text: string;
44
44
  };
45
45
  /** Metadata for blueprint structure */
46
- export declare type BlueprintMetadata = {
46
+ export type BlueprintMetadata = {
47
47
  options: GenericObject<BlueprintMetadataOptions>;
48
48
  validations: GenericObject<FieldValidator>;
49
49
  offline_enabled: boolean;
50
50
  allow_multiple_responses: boolean;
51
51
  };
52
- export declare type BlueprintMetadataOptions = {
52
+ export type BlueprintMetadataOptions = {
53
53
  option_type: string;
54
54
  values: BlueprintMetadataOption[];
55
55
  };
56
- export declare type BlueprintMetadataOption = {
56
+ export type BlueprintMetadataOption = {
57
57
  value: string;
58
58
  label: string;
59
59
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- export declare type GenericObject<T = any> = {
1
+ export type GenericObject<T = any> = {
2
2
  [key: string]: T;
3
3
  };
4
- export declare type Callback = (...args: any) => void;
4
+ export type Callback = (...args: any) => void;
@@ -0,0 +1 @@
1
+ export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,23 +4,23 @@ export declare enum Validations {
4
4
  LOWER_THAN = "lt",
5
5
  GREATER_THAN = "gt"
6
6
  }
7
- export declare type MaxLengthValidation = {
7
+ export type MaxLengthValidation = {
8
8
  name: Validations.MAX_LENGTH;
9
9
  [Validations.MAX_LENGTH]: number;
10
10
  };
11
- export declare type RegexValidation = {
11
+ export type RegexValidation = {
12
12
  name: Validations.REGEX;
13
13
  [Validations.REGEX]: string;
14
14
  };
15
- export declare type GreaterValidation = {
15
+ export type GreaterValidation = {
16
16
  name: Validations.GREATER_THAN;
17
17
  threshold: number;
18
18
  allow_equality: boolean;
19
19
  };
20
- export declare type LowerValidation = {
20
+ export type LowerValidation = {
21
21
  name: Validations.LOWER_THAN;
22
22
  threshold: number;
23
23
  allow_equality: boolean;
24
24
  };
25
- export declare type FieldValidator = MaxLengthValidation | RegexValidation | GreaterValidation | LowerValidation;
25
+ export type FieldValidator = MaxLengthValidation | RegexValidation | GreaterValidation | LowerValidation;
26
26
  export declare function validate(validators: FieldValidator[], value: any, language: string): string | null;
File without changes