@falcon-ng/tailwind 0.0.2 → 0.0.4

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 (231) hide show
  1. package/esm2020/falcon-ng-tailwind.mjs +5 -0
  2. package/esm2020/lib/base-control.mjs +50 -0
  3. package/esm2020/lib/base-form-component.mjs +234 -0
  4. package/esm2020/lib/component/auto-complete/auto-complete.component.mjs +33 -0
  5. package/esm2020/lib/component/bottom-sheet/bottom-sheet.component.mjs +29 -0
  6. package/esm2020/lib/component/button/button.component.mjs +27 -0
  7. package/esm2020/lib/component/button-toggle/button-toggle.component.mjs +32 -0
  8. package/esm2020/lib/component/checkbox/checkbox.component.mjs +18 -0
  9. package/esm2020/lib/component/chips/chip.component.mjs +109 -0
  10. package/esm2020/lib/component/date-picker/date-picker.component.mjs +17 -0
  11. package/esm2020/lib/component/dialog/dialog.component.mjs +21 -0
  12. package/esm2020/lib/component/pagination/pagination.component.mjs +95 -0
  13. package/esm2020/lib/component/progress-bar/progress-bar.component.mjs +20 -0
  14. package/esm2020/lib/component/progress-spinner/progress-spinner.component.mjs +26 -0
  15. package/esm2020/lib/component/radio/radio.component.mjs +31 -0
  16. package/esm2020/lib/component/rich-text-editor/rich-text-editor.component.mjs +15 -0
  17. package/esm2020/lib/component/select/select.component.mjs +35 -0
  18. package/esm2020/lib/component/slide-toggle/slide-toggle.component.mjs +14 -0
  19. package/esm2020/lib/component/slider/slider.component.mjs +15 -0
  20. package/esm2020/lib/component/snack-bar/snack-bar.component.mjs +11 -0
  21. package/esm2020/lib/component/table/table.component.mjs +74 -0
  22. package/esm2020/lib/component/textarea/textarea.component.mjs +16 -0
  23. package/esm2020/lib/component/textbox/textbox.component.mjs +17 -0
  24. package/esm2020/lib/control-builder/control-builder.component.mjs +18 -0
  25. package/esm2020/lib/control-type/AutoComplete.mjs +8 -0
  26. package/esm2020/lib/control-type/Button.mjs +8 -0
  27. package/esm2020/lib/control-type/ButtonToggle.mjs +8 -0
  28. package/esm2020/lib/control-type/CheckBox.mjs +8 -0
  29. package/esm2020/lib/control-type/Chip.mjs +8 -0
  30. package/esm2020/lib/control-type/DatePicker.mjs +8 -0
  31. package/esm2020/lib/control-type/Divider.mjs +8 -0
  32. package/esm2020/lib/control-type/Editor.mjs +8 -0
  33. package/esm2020/lib/control-type/Radio.mjs +8 -0
  34. package/esm2020/lib/control-type/RichTextEditor.mjs +8 -0
  35. package/esm2020/lib/control-type/SlideToggle.mjs +8 -0
  36. package/esm2020/lib/control-type/Slider.mjs +8 -0
  37. package/esm2020/lib/control-type/Textarea.mjs +8 -0
  38. package/esm2020/lib/control-type/Textbox.mjs +8 -0
  39. package/esm2020/lib/control-type/select.mjs +8 -0
  40. package/esm2020/lib/falcon-core.module.mjs +230 -0
  41. package/esm2020/lib/model/constant.mjs +32 -0
  42. package/esm2020/lib/model/enum.mjs +2 -0
  43. package/esm2020/lib/model/environments.mjs +3 -0
  44. package/esm2020/lib/model/interface.mjs +2 -0
  45. package/esm2020/lib/model/ivalidator.mjs +2 -0
  46. package/esm2020/lib/module/angularmaterial.module.mjs +189 -0
  47. package/esm2020/lib/reactive-field.directive.mjs +28 -0
  48. package/esm2020/lib/service/appsetting.service.mjs +55 -0
  49. package/esm2020/lib/service/http/generic-http-client.mjs +197 -0
  50. package/esm2020/lib/service/http/igeneric-http-client.mjs +10 -0
  51. package/esm2020/lib/service/logger.service.mjs +78 -0
  52. package/esm2020/lib/service/open-id/TokenHelperService.mjs +71 -0
  53. package/esm2020/lib/service/open-id/auth-guard.service.mjs +30 -0
  54. package/esm2020/lib/service/open-id/auth.service.mjs +154 -0
  55. package/esm2020/public-api.mjs +47 -0
  56. package/fesm2015/falcon-ng-tailwind.mjs +1988 -0
  57. package/fesm2015/falcon-ng-tailwind.mjs.map +1 -0
  58. package/fesm2020/falcon-ng-tailwind.mjs +1962 -0
  59. package/fesm2020/falcon-ng-tailwind.mjs.map +1 -0
  60. package/index.d.ts +5 -0
  61. package/lib/base-control.d.ts +104 -0
  62. package/lib/base-form-component.d.ts +169 -0
  63. package/lib/component/auto-complete/auto-complete.component.d.ts +17 -0
  64. package/lib/component/bottom-sheet/bottom-sheet.component.d.ts +11 -0
  65. package/lib/component/button/button.component.d.ts +12 -0
  66. package/lib/component/button-toggle/button-toggle.component.d.ts +14 -0
  67. package/lib/component/checkbox/checkbox.component.d.ts +10 -0
  68. package/lib/component/chips/chip.component.d.ts +35 -0
  69. package/lib/component/date-picker/date-picker.component.d.ts +9 -0
  70. package/lib/component/dialog/dialog.component.d.ts +8 -0
  71. package/lib/component/pagination/pagination.component.d.ts +20 -0
  72. package/lib/component/progress-bar/progress-bar.component.d.ts +11 -0
  73. package/lib/component/progress-spinner/progress-spinner.component.d.ts +12 -0
  74. package/lib/component/radio/radio.component.d.ts +14 -0
  75. package/lib/component/rich-text-editor/rich-text-editor.component.d.ts +9 -0
  76. package/lib/component/select/select.component.d.ts +15 -0
  77. package/lib/component/slide-toggle/slide-toggle.component.d.ts +9 -0
  78. package/lib/component/slider/slider.component.d.ts +9 -0
  79. package/lib/component/snack-bar/snack-bar.component.d.ts +5 -0
  80. package/lib/component/table/table.component.d.ts +21 -0
  81. package/lib/component/textarea/textarea.component.d.ts +9 -0
  82. package/lib/component/textbox/textbox.component.d.ts +9 -0
  83. package/lib/control-builder/control-builder.component.d.ts +9 -0
  84. package/lib/control-type/AutoComplete.d.ts +5 -0
  85. package/lib/control-type/Button.d.ts +5 -0
  86. package/lib/control-type/ButtonToggle.d.ts +5 -0
  87. package/{src/lib/control-type/Chip.ts → lib/control-type/CheckBox.d.ts} +2 -3
  88. package/lib/control-type/Chip.d.ts +5 -0
  89. package/lib/control-type/DatePicker.d.ts +5 -0
  90. package/lib/control-type/Divider.d.ts +5 -0
  91. package/lib/control-type/Editor.d.ts +5 -0
  92. package/lib/control-type/Radio.d.ts +5 -0
  93. package/lib/control-type/RichTextEditor.d.ts +5 -0
  94. package/{src/lib/control-type/Radio.ts → lib/control-type/SlideToggle.d.ts} +2 -3
  95. package/lib/control-type/Slider.d.ts +5 -0
  96. package/lib/control-type/Textarea.d.ts +5 -0
  97. package/lib/control-type/Textbox.d.ts +5 -0
  98. package/lib/control-type/select.d.ts +5 -0
  99. package/lib/falcon-core.module.d.ts +35 -0
  100. package/lib/model/constant.d.ts +5 -0
  101. package/lib/model/enum.d.ts +144 -0
  102. package/{src/lib/model/environments.ts → lib/model/environments.d.ts} +5 -7
  103. package/{src/lib/model/interface.ts → lib/model/interface.d.ts} +80 -91
  104. package/{src/lib/model/ivalidator.ts → lib/model/ivalidator.d.ts} +3 -3
  105. package/lib/module/angularmaterial.module.d.ts +49 -0
  106. package/lib/reactive-field.directive.d.ts +14 -0
  107. package/lib/service/appsetting.service.d.ts +22 -0
  108. package/lib/service/http/generic-http-client.d.ts +121 -0
  109. package/lib/service/http/igeneric-http-client.d.ts +92 -0
  110. package/lib/service/logger.service.d.ts +18 -0
  111. package/lib/service/open-id/TokenHelperService.d.ts +11 -0
  112. package/lib/service/open-id/auth-guard.service.d.ts +11 -0
  113. package/lib/service/open-id/auth.service.d.ts +36 -0
  114. package/package.json +22 -2
  115. package/public-api.d.ts +34 -0
  116. package/ng-package.json +0 -7
  117. package/src/lib/base-control.ts +0 -142
  118. package/src/lib/base-form-component.ts +0 -363
  119. package/src/lib/component/auto-complete/auto-complete.component.html +0 -39
  120. package/src/lib/component/auto-complete/auto-complete.component.scss +0 -0
  121. package/src/lib/component/auto-complete/auto-complete.component.spec.ts +0 -23
  122. package/src/lib/component/auto-complete/auto-complete.component.ts +0 -31
  123. package/src/lib/component/bottom-sheet/bottom-sheet.component.html +0 -9
  124. package/src/lib/component/bottom-sheet/bottom-sheet.component.scss +0 -0
  125. package/src/lib/component/bottom-sheet/bottom-sheet.component.spec.ts +0 -23
  126. package/src/lib/component/bottom-sheet/bottom-sheet.component.ts +0 -19
  127. package/src/lib/component/button/button.component.css +0 -0
  128. package/src/lib/component/button/button.component.html +0 -54
  129. package/src/lib/component/button/button.component.spec.ts +0 -23
  130. package/src/lib/component/button/button.component.ts +0 -17
  131. package/src/lib/component/button-toggle/button-toggle.component.html +0 -21
  132. package/src/lib/component/button-toggle/button-toggle.component.scss +0 -0
  133. package/src/lib/component/button-toggle/button-toggle.component.spec.ts +0 -23
  134. package/src/lib/component/button-toggle/button-toggle.component.ts +0 -26
  135. package/src/lib/component/checkbox/checkbox.component.html +0 -6
  136. package/src/lib/component/checkbox/checkbox.component.scss +0 -0
  137. package/src/lib/component/checkbox/checkbox.component.spec.ts +0 -23
  138. package/src/lib/component/checkbox/checkbox.component.ts +0 -17
  139. package/src/lib/component/chips/chip.component.html +0 -75
  140. package/src/lib/component/chips/chip.component.scss +0 -3
  141. package/src/lib/component/chips/chip.component.spec.ts +0 -23
  142. package/src/lib/component/chips/chip.component.ts +0 -125
  143. package/src/lib/component/date-picker/date-picker.component.html +0 -18
  144. package/src/lib/component/date-picker/date-picker.component.scss +0 -0
  145. package/src/lib/component/date-picker/date-picker.component.spec.ts +0 -23
  146. package/src/lib/component/date-picker/date-picker.component.ts +0 -13
  147. package/src/lib/component/dialog/dialog.component.html +0 -12
  148. package/src/lib/component/dialog/dialog.component.scss +0 -3
  149. package/src/lib/component/dialog/dialog.component.spec.ts +0 -23
  150. package/src/lib/component/dialog/dialog.component.ts +0 -12
  151. package/src/lib/component/pagination/pagination.component.html +0 -10
  152. package/src/lib/component/pagination/pagination.component.scss +0 -0
  153. package/src/lib/component/pagination/pagination.component.spec.ts +0 -23
  154. package/src/lib/component/pagination/pagination.component.ts +0 -86
  155. package/src/lib/component/progress-bar/progress-bar.component.html +0 -1
  156. package/src/lib/component/progress-bar/progress-bar.component.scss +0 -0
  157. package/src/lib/component/progress-bar/progress-bar.component.spec.ts +0 -23
  158. package/src/lib/component/progress-bar/progress-bar.component.ts +0 -15
  159. package/src/lib/component/progress-spinner/progress-spinner.component.html +0 -7
  160. package/src/lib/component/progress-spinner/progress-spinner.component.scss +0 -0
  161. package/src/lib/component/progress-spinner/progress-spinner.component.spec.ts +0 -23
  162. package/src/lib/component/progress-spinner/progress-spinner.component.ts +0 -16
  163. package/src/lib/component/radio/radio.component.html +0 -13
  164. package/src/lib/component/radio/radio.component.scss +0 -14
  165. package/src/lib/component/radio/radio.component.spec.ts +0 -23
  166. package/src/lib/component/radio/radio.component.ts +0 -29
  167. package/src/lib/component/rich-text-editor/rich-text-editor.component.html +0 -10
  168. package/src/lib/component/rich-text-editor/rich-text-editor.component.scss +0 -0
  169. package/src/lib/component/rich-text-editor/rich-text-editor.component.spec.ts +0 -23
  170. package/src/lib/component/rich-text-editor/rich-text-editor.component.ts +0 -13
  171. package/src/lib/component/select/select.component.html +0 -25
  172. package/src/lib/component/select/select.component.scss +0 -0
  173. package/src/lib/component/select/select.component.spec.ts +0 -23
  174. package/src/lib/component/select/select.component.ts +0 -32
  175. package/src/lib/component/slide-toggle/slide-toggle.component.html +0 -7
  176. package/src/lib/component/slide-toggle/slide-toggle.component.scss +0 -0
  177. package/src/lib/component/slide-toggle/slide-toggle.component.spec.ts +0 -23
  178. package/src/lib/component/slide-toggle/slide-toggle.component.ts +0 -13
  179. package/src/lib/component/slider/slider.component.html +0 -11
  180. package/src/lib/component/slider/slider.component.scss +0 -0
  181. package/src/lib/component/slider/slider.component.spec.ts +0 -23
  182. package/src/lib/component/slider/slider.component.ts +0 -13
  183. package/src/lib/component/snack-bar/snack-bar.component.html +0 -1
  184. package/src/lib/component/snack-bar/snack-bar.component.scss +0 -0
  185. package/src/lib/component/snack-bar/snack-bar.component.spec.ts +0 -23
  186. package/src/lib/component/snack-bar/snack-bar.component.ts +0 -10
  187. package/src/lib/component/table/table.component.html +0 -82
  188. package/src/lib/component/table/table.component.scss +0 -17
  189. package/src/lib/component/table/table.component.spec.ts +0 -23
  190. package/src/lib/component/table/table.component.ts +0 -54
  191. package/src/lib/component/textarea/textarea.component.html +0 -22
  192. package/src/lib/component/textarea/textarea.component.scss +0 -3
  193. package/src/lib/component/textarea/textarea.component.spec.ts +0 -23
  194. package/src/lib/component/textarea/textarea.component.ts +0 -13
  195. package/src/lib/component/textbox/textbox.component.html +0 -27
  196. package/src/lib/component/textbox/textbox.component.scss +0 -3
  197. package/src/lib/component/textbox/textbox.component.spec.ts +0 -23
  198. package/src/lib/component/textbox/textbox.component.ts +0 -13
  199. package/src/lib/control-builder/control-builder.component.html +0 -5
  200. package/src/lib/control-builder/control-builder.component.scss +0 -0
  201. package/src/lib/control-builder/control-builder.component.ts +0 -14
  202. package/src/lib/control-type/AutoComplete.ts +0 -6
  203. package/src/lib/control-type/Button.ts +0 -6
  204. package/src/lib/control-type/ButtonToggle.ts +0 -6
  205. package/src/lib/control-type/CheckBox.ts +0 -6
  206. package/src/lib/control-type/DatePicker.ts +0 -6
  207. package/src/lib/control-type/Divider.ts +0 -6
  208. package/src/lib/control-type/Editor.ts +0 -6
  209. package/src/lib/control-type/RichTextEditor.ts +0 -6
  210. package/src/lib/control-type/SlideToggle.ts +0 -6
  211. package/src/lib/control-type/Slider.ts +0 -6
  212. package/src/lib/control-type/select.ts +0 -6
  213. package/src/lib/control-type/textarea.ts +0 -6
  214. package/src/lib/control-type/textbox.ts +0 -6
  215. package/src/lib/falcon-core.module.ts +0 -141
  216. package/src/lib/model/constant.ts +0 -32
  217. package/src/lib/model/enum.ts +0 -151
  218. package/src/lib/module/angularmaterial.module.ts +0 -98
  219. package/src/lib/reactive-field.directive.ts +0 -24
  220. package/src/lib/service/appsetting.service.ts +0 -57
  221. package/src/lib/service/http/generic-http-client.ts +0 -205
  222. package/src/lib/service/http/httpInterceptor.ts +0 -36
  223. package/src/lib/service/http/igeneric-http-client.ts +0 -110
  224. package/src/lib/service/logger.service.ts +0 -75
  225. package/src/lib/service/open-id/TokenHelperService.ts +0 -76
  226. package/src/lib/service/open-id/auth-guard.service.ts +0 -25
  227. package/src/lib/service/open-id/auth.service.ts +0 -179
  228. package/src/public-api.ts +0 -35
  229. package/tsconfig.lib.json +0 -15
  230. package/tsconfig.lib.prod.json +0 -10
  231. package/tsconfig.spec.json +0 -14
@@ -1,363 +0,0 @@
1
- import {Observable} from 'rxjs';
2
- import {
3
- FormBuilder,
4
- FormControl,
5
- FormGroup,
6
- ValidatorFn,
7
- Validators,
8
- } from '@angular/forms';
9
- import {BaseControl, Layout} from './base-control';
10
- import {inject} from '@angular/core';
11
- import {IValidator} from './model/ivalidator';
12
- import {ControlType} from './model/enum';
13
-
14
- /**
15
- * @description
16
- * Base form component initialized to create form controls, set validation, submit.
17
- *
18
- * @usageNotes
19
- * The following snippet shows how a component can implement this abstract class to
20
- * define its own initialization method.
21
- * ```ts
22
- * export class InputComponent extends BaseFormComponent<any> implements OnInit {
23
- * constructor(fb : FormBuilder) {
24
- * super(fb);
25
- * this.defineForm();
26
- * }
27
- * protected defineForm(): void {
28
- * }
29
- * ngOnInit(): void {
30
- * this.formGroup = this.createControls();
31
- * }
32
- * protected submitDatasource(model: any): Observable<any> {
33
- * return of(model);
34
- * }
35
- * ```
36
- */
37
- export abstract class BaseFormComponent<T> {
38
- public formGroup!: FormGroup;
39
-
40
- protected abstract defineForm(): void;
41
-
42
- protected abstract submitDataSource(model: T): Observable<T>;
43
-
44
- public dataSource: T | undefined = undefined;
45
- public controlsConfig!: Layout<T>;
46
- public showLoading: boolean = false;
47
- protected fb = inject(FormBuilder);
48
-
49
- constructor() {
50
- }
51
-
52
- /**
53
- * @description
54
- * Method evoke on when the form is submitted.
55
- * @returns submitDatasource() method with form data if valid otherwise form invalid.
56
- */
57
- public onSubmit() {
58
- if (this.formGroup !== undefined && this.formGroup.valid) {
59
- this.submitDataSource(this.formGroup.value);
60
- } else {
61
- this.validateAllFormFields(this.formGroup);
62
- }
63
- }
64
-
65
- /**
66
- * @description
67
- * Private method to validate all form controls before is form submited.
68
- * @param formGroup Validate form group.
69
- * @returns Groups of controls added to the form builder.
70
- */
71
- private validateAllFormFields(formGroup: FormGroup) {
72
- if (this.formGroup !== undefined) this.formGroup.markAllAsTouched();
73
- }
74
-
75
- /**
76
- * @description
77
- * Create the reactive form controls
78
- * @returns Groups of controls added to the form builder.
79
- */
80
- protected createControls() {
81
- const group = this.fb.group({});
82
- this.controlsConfig.baseControls.forEach((controls, index) => {
83
- this.bindControl(controls, group, index);
84
- });
85
- return group;
86
- }
87
-
88
- /**
89
- * @description
90
- * Private method to bind the form control.
91
- * @param controlConfig field to bind.
92
- * @param group group to add.
93
- * @param index index of the layout
94
- */
95
- private bindControl(
96
- controlConfig: BaseControl<T>,
97
- group: FormGroup,
98
- index: number
99
- ) {
100
- if (controlConfig.controlType === ControlType.Button) return;
101
- let control = null;
102
- if (controlConfig.formArray !== undefined) {
103
- control =
104
- controlConfig.formArray.length > 0
105
- ? this.fb.array([
106
- this.createFormArrayGroup(
107
- controlConfig.formArray[
108
- controlConfig.formArray.length - 1
109
- ].formArray,
110
- ),
111
- ])
112
- : this.fb.array(
113
- [],
114
- this.bindValidations(controlConfig.validations || []),
115
- );
116
- } else {
117
- control = this.fb.control(
118
- {
119
- value: controlConfig.value,
120
- disabled: controlConfig.disabled,
121
- },
122
- this.bindValidations(controlConfig.validations || [])
123
- );
124
- }
125
- group.addControl(controlConfig.formControlName, control);
126
- }
127
-
128
- /**
129
- * @description
130
- * Private method to bind the validation to the form controls on form submit.
131
- * @param validations Push the validation to the controls.
132
- * @returns Validation.
133
- */
134
- private bindValidations(validations: IValidator[]) {
135
- if (validations.length > 0) {
136
- const validList: (ValidatorFn | null | undefined)[] = [];
137
- validations.forEach((valid: IValidator) => {
138
- validList.push(valid.validator);
139
- });
140
- return Validators.compose(validList);
141
- }
142
- return null;
143
- }
144
-
145
- /**
146
- * Create an form array element
147
- * @param layoutConfig layout of form array
148
- * @returns Form array group
149
- */
150
- private createFormArrayGroup(componentConfig: BaseControl<T>[] | undefined): FormGroup {
151
- var formGroup: FormGroup = this.fb.group({});
152
- componentConfig?.forEach((item, index) => {
153
- var control = null;
154
- if (item.formArray !== undefined) {
155
- control =
156
- item.formArray.length > 0
157
- ? this.fb.array(
158
- [
159
- this.createFormArrayGroup(
160
- item.formArray[item.formArray.length - 1].formArray,
161
- ),
162
- ],
163
- this.bindValidations(item.validations || []),
164
- )
165
- : this.fb.array(
166
- [],
167
- this.bindValidations(item.validations || []),
168
- );
169
- } else {
170
- control = this.fb.control(
171
- {
172
- value: item.value,
173
- disabled: item.disabled,
174
- },
175
- this.bindValidations(item.validations || []),
176
- );
177
- }
178
- formGroup.addControl(item.formControlName, control);
179
- });
180
- return formGroup;
181
- }
182
-
183
- /**
184
- * @description
185
- * Reset fild values to default or specify some value.
186
- * @param defaultValues Specify the specific value to set to the controls.
187
- * @returns void.
188
- */
189
- public reset(defaultValues?: any): void {
190
- this.formGroup.reset(defaultValues);
191
- }
192
-
193
- /**
194
- * @description
195
- * Reset specific fild Errors.
196
- * @param name Name of the field to reset the error.
197
- * @returns void.
198
- */
199
- resetFieldErrors(name: string): void {
200
- this.formGroup?.get(name)?.setErrors(null);
201
- }
202
-
203
- /**
204
- * @description
205
- * Get the controls value from the form.
206
- * @returns Form controls values.
207
- */
208
- get value(): any {
209
- return this.formGroup.value;
210
- }
211
-
212
- /**
213
- * @description
214
- * Updating parts of the data model.
215
- * Use the patchValue() method to replace any properties defined in the object that have changed in the form model.
216
- * @returns Form controls values.
217
- * @param value The object that matches the structure of the group.
218
- * @param options Configuration options that determine how the control propagates changes and
219
- * emits events after the value is patched.
220
- * `onlySelf`: When true, each change only affects this control and not its parent. Default is
221
- * true.
222
- * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
223
- * `valueChanges`
224
- * @usageNotes
225
- * The following snippet shows how a component can implement this abstract class to
226
- * define its own initialization method.
227
- * ```ts
228
- * this.formGroup.patchValue({
229
- * name: 'Todd Motto',
230
- * event: {
231
- * title: 'AngularCamp 2016',
232
- * location: 'Barcelona, Spain'
233
- * }
234
- * });
235
- * ```
236
- */
237
- protected patchValue(
238
- value: { [key: string]: any },
239
- options?: { onlySelf?: boolean; emitEvent?: boolean }
240
- ) {
241
- return this.formGroup.patchValue(value, options);
242
- }
243
-
244
- /**
245
- * @description
246
- * Updating parts of the data model.
247
- * Use the setValue() method to set a new value for an individual control. The setValue() method strictly adheres to the structure of the form group and replaces the entire value for the control.
248
- * @returns Form controls values.
249
- * @param value The object that matches the structure of the group.
250
- * @param options Configuration options that determine how the control propagates changes and
251
- * emits events after the value is patched.
252
- * `onlySelf`: When true, each change only affects this control and not its parent. Default is
253
- * true.
254
- * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
255
- * `valueChanges`
256
- * @usageNotes
257
- * The following snippet shows how a component can implement this abstract class to
258
- * define its own initialization method.
259
- * ```ts
260
- * this.formGroup.setValue({
261
- * name: 'Todd Motto',
262
- * event: {
263
- * title: 'AngularCamp 2016',
264
- * location: 'Barcelona, Spain'
265
- * }
266
- * });
267
- * ```
268
- */
269
- protected setValue(
270
- value: { [key: string]: any },
271
- options?: { onlySelf?: boolean; emitEvent?: boolean }
272
- ) {
273
- return this.formGroup.setValue(value, options);
274
- }
275
-
276
- /**
277
- * @description
278
- * Dynamically remove the form control.
279
- * @param index Index of item.
280
- * @usageNotes
281
- * The following snippet shows how to remove the form control from Froup Group
282
- * ```ts
283
- * removeControl(1);
284
- * ```
285
- */
286
- protected removeControl(layoutIndex: number, index: number) {
287
- this.formGroup.removeControl(
288
- this.controlsConfig.baseControls[layoutIndex].formControlName
289
- );
290
- this.controlsConfig.baseControls.splice(index, 1);
291
- }
292
-
293
- /**
294
- * @description
295
- * Dynamically add the form control.
296
- * @param configToAdd Configuration of the form control.
297
- * @param index Add controls to the specific index.
298
- * @usageNotes
299
- * The following snippet shows how a component can implement this abstract class to
300
- * define its own initialization method.
301
- * ```ts
302
- * var configToadd = {
303
- * componentProperty: {
304
- * label: "Outline Auto complete",
305
- * options: [{ value: 'Extra-cheese', viewValue: 'Extra cheese' },
306
- * { value: 'Bellsprout', viewValue: 'Bellsprout' },
307
- * { value: 'Mushroom', viewValue: 'Mushroom' },
308
- * { value: 'Onion', viewValue: 'Onion' },
309
- * { value: 'Pepperoni', viewValue: 'Pepperoni' },
310
- * { value: 'Sausage', viewValue: 'Sausage' },
311
- * { value: 'Tomato', viewValue: 'Tomato' }],
312
- * appearance: Appearance.Outline,
313
- * color: 'accent'
314
- * },
315
- * componentType: ComponentType.AutoComplete,
316
- * formControlName: "test"
317
- * };
318
- * this.addControl(configToadd); or this.addControl(configToadd,1);
319
- * ```
320
- */
321
- // protected addControl(layoutToAdd?: BaseControl<string>[],index?: number) {
322
- // layoutToAdd.forEach((layout, layoutIndex) => {
323
- // layout.componentConfig.forEach(
324
- // (componentConfig, componentIndex) => {
325
- // if (componentConfig.formArray !== undefined) {
326
- // componentConfig.formArray.forEach((control) => {
327
- // this.formGroup.setControl(
328
- // 'productOption',
329
- // this.createFormArrayGroup(control.componentConfig),
330
- // );
331
- // this.controlsConfig.container.layoutConfig[1].componentConfig[0].formArray.push(
332
- // layout,
333
- // );
334
- // });
335
- // } else {
336
- // this.formGroup.addControl(
337
- // componentConfig.formControlName,
338
- // new UntypedFormControl(
339
- // {
340
- // value: componentConfig.componentProperty.value,
341
- // disabled:
342
- // componentConfig.componentProperty.disabled,
343
- // },
344
- // this.bindValidations(
345
- // componentConfig.validations || [],
346
- // ),
347
- // ),
348
- // );
349
- // index !== null
350
- // ? this.controlsConfig.container.layoutConfig.splice(
351
- // index,
352
- // 0,
353
- // layout,
354
- // )
355
- // : this.controlsConfig.container.layoutConfig.push(
356
- // layout,
357
- // );
358
- // }
359
- // },
360
- // );
361
- // });
362
- // }
363
- }
@@ -1,39 +0,0 @@
1
- <mat-form-field *ngIf="control.appearance != 'plain'; else plainInput" [appearance]="control.appearance"
2
- [formGroup]="formGroup" [ngStyle]="control.style" [ngClass]="control.class">
3
- <mat-label>{{control.label}}</mat-label>
4
- <input matInput [formControl]="autoCompleteControl" [formControlName]="control.formControlName"
5
- [placeholder]="control.placeHolder" [type]="control.type" [ngStyle]="control.style" [ngClass]="control.class"
6
- [matAutocomplete]="auto"
7
- [required]="formGroup.get(control.formControlName)?.errors !== null && formGroup.get(control.formControlName)?.errors?.['required']">
8
- <mat-autocomplete #auto="matAutocomplete" (optionSelected)='optionSelected($event.option.viewValue)'>
9
- <mat-option *ngFor="let item of filteredOptions | async" [value]="item.key">
10
- {{item.value}}
11
- </mat-option>
12
- </mat-autocomplete>
13
-
14
- <span matPrefix [matTooltip]="control.prefix.toolTipText!"
15
- [ngClass]="{'material-icons': control.prefix.isIcon}">{{control.prefix.text}} &nbsp;&nbsp;</span>
16
- <span matSuffix [matTooltip]="control.suffix.toolTipText!"
17
- [ngClass]="{'material-icons': control.suffix.isIcon}">{{control.suffix.text}} &nbsp;&nbsp;</span>
18
-
19
- <mat-hint>{{control.hint.text}}</mat-hint>
20
- <ng-container *ngFor="let validation of control.validations;" ngProjectAs="mat-error">
21
- <mat-error *ngIf="formGroup.get(control.formControlName)?.hasError(validation.name)">{{validation.message}}
22
- </mat-error>
23
- </ng-container>
24
- </mat-form-field>
25
-
26
- <ng-template #plainInput>
27
- <div [formGroup]="formGroup" [ngStyle]="control.style" [ngClass]="control.class">
28
- <input type="text" [formControl]="autoCompleteControl" [formControlName]="control.formControlName"
29
- [placeholder]="control.placeHolder" [type]="control.type" [ngStyle]="control.style" [ngClass]="control.class"
30
- [matAutocomplete]="auto"
31
- [required]="formGroup.get(control.formControlName)?.errors !== null && formGroup.get(control.formControlName)?.errors?.['required']"
32
- class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500">
33
- </div>
34
- <mat-autocomplete #auto="matAutocomplete" (optionSelected)='optionSelected($event.option.viewValue)'>
35
- <mat-option *ngFor="let item of filteredOptions | async" [value]="item.key">
36
- {{item.value}}
37
- </mat-option>
38
- </mat-autocomplete>
39
- </ng-template>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { AutoCompleteComponent } from './auto-complete.component';
4
-
5
- describe('AutoCompleteComponent', () => {
6
- let component: AutoCompleteComponent;
7
- let fixture: ComponentFixture<AutoCompleteComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ AutoCompleteComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(AutoCompleteComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,31 +0,0 @@
1
- import { Component, OnInit, Input } from '@angular/core';
2
- import {BaseControl} from "../../base-control";
3
- import {FormControl, FormGroup} from "@angular/forms";
4
- import {IOptions} from "../../model/interface";
5
- import {Observable} from "rxjs";
6
- import { map, startWith } from 'rxjs/operators';
7
- @Component({
8
- selector: 'falcon-auto-complete',
9
- templateUrl: './auto-complete.component.html',
10
- styleUrls: ['./auto-complete.component.scss'],
11
- })
12
- export class AutoCompleteComponent {
13
- control!: BaseControl<string>;
14
- formGroup!: FormGroup;
15
- autoCompleteControl = new FormControl();
16
- constructor() { }
17
- filteredOptions!: Observable<IOptions[]>;
18
-
19
- ngOnInit() {
20
- this.filteredOptions = this.autoCompleteControl.valueChanges.pipe(startWith(''),map(value => this._filter(value)));
21
- }
22
-
23
- private _filter(value: string): IOptions[] {
24
- const filterValue = value.toLowerCase();
25
- return this.control.options.filter((option: IOptions) => option?.key?.toLowerCase().includes(filterValue));
26
- }
27
-
28
- optionSelected(value: any) {
29
- this.formGroup?.get(this.control?.formControlName)?.setValue(value);
30
- }
31
- }
@@ -1,9 +0,0 @@
1
- <mat-nav-list>
2
- <ng-container *ngFor="let item of data">
3
- <a [href]="item.link" mat-list-item (click)="click($event,item)">
4
- <span matListItemTitle>{{item.levelOneText}}</span>
5
- <span matLine>{{item.levelTwoText}}</span>
6
- </a>
7
- </ng-container>
8
-
9
- </mat-nav-list>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { BottomSheetComponent } from './bottom-sheet.component';
4
-
5
- describe('BottomSheetComponent', () => {
6
- let component: BottomSheetComponent;
7
- let fixture: ComponentFixture<BottomSheetComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ BottomSheetComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(BottomSheetComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,19 +0,0 @@
1
- import {Component, Inject} from '@angular/core';
2
- import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet";
3
-
4
- @Component({
5
- selector: 'lib-bottom-sheet',
6
- templateUrl: './bottom-sheet.component.html',
7
- styleUrls: ['./bottom-sheet.component.scss']
8
- })
9
- export class BottomSheetComponent {
10
- constructor(private _bottomSheetRef: MatBottomSheetRef<BottomSheetComponent>, @Inject(MAT_BOTTOM_SHEET_DATA) public data: any) { }
11
-
12
- ngOnInit(): void {
13
- }
14
-
15
- click(event: MouseEvent, item : any): void {
16
- this._bottomSheetRef.dismiss(item);
17
- event.preventDefault();
18
- }
19
- }
File without changes
@@ -1,54 +0,0 @@
1
- <div [ngStyle]="control.style" [ngClass]="control.class">
2
- <ng-container [ngSwitch]="control.appearance">
3
- <button [disabled]="control.disabled" (click)="childBtnClick()"
4
- [color]="control.color" [ngClass]="control.class"
5
- [ngStyle]="control.style" mat-button *ngSwitchCase="0">
6
- <mat-icon *ngIf="control?.suffix?.isIcon" style="margin-bottom: 1px;">
7
- {{control.suffix.text}}</mat-icon>&nbsp;{{control.label}}
8
- </button>
9
- <button [disabled]="control.disabled" (click)="childBtnClick()"
10
- [type]="control.type" [ngClass]="control.class"
11
- [color]="control.color" [ngStyle]="control.style"
12
- mat-raised-button *ngSwitchCase="1">
13
- <mat-icon *ngIf="control.suffix?.isIcon" style="margin-bottom: 1px;">
14
- {{control.suffix.text}}</mat-icon>&nbsp;{{control.label}}
15
- </button>
16
- <button [disabled]="control.disabled" (click)="childBtnClick()"
17
- [type]="control.type" [ngClass]="control.class"
18
- [color]="control.color" [ngStyle]="control.style"
19
- mat-stroked-button *ngSwitchCase="2">
20
- <mat-icon *ngIf="control.suffix?.isIcon" style="margin-bottom: 1px;">
21
- {{control.suffix.text}}</mat-icon>&nbsp;{{control.label}}
22
- </button>
23
- <button [disabled]="control.disabled" (click)="childBtnClick()"
24
- [type]="control.type" [ngClass]="control.class"
25
- [color]="control.color" [ngStyle]="control.style"
26
- mat-flat-button *ngSwitchCase="3">
27
- <mat-icon *ngIf="control.suffix.isIcon" style="margin-bottom: 1px;">
28
- {{control.suffix.text}}</mat-icon>&nbsp;{{control.label}}
29
- </button>
30
- <button [disabled]="control.disabled" (click)="childBtnClick()"
31
- [type]="control.type" [ngClass]="control.class"
32
- [color]="control.color" [ngStyle]="control.style"
33
- mat-icon-button [attr.aria-label]="control.label" *ngSwitchCase="4">
34
- <mat-icon>{{control.label}}</mat-icon>
35
- </button>
36
- <button [disabled]="control.disabled" (click)="childBtnClick()"
37
- [type]="control.type" [ngClass]="control.class"
38
- [color]="control.color" [ngStyle]="control.style" mat-fab
39
- [attr.aria-label]="control.label" *ngSwitchCase="5">
40
- <mat-icon>{{control.label}}</mat-icon>
41
- </button>
42
- <button [disabled]="control.disabled" (click)="childBtnClick()"
43
- [type]="control.type" [ngClass]="control.class"
44
- [color]="control.color" [ngStyle]="control.style" mat-mini-fab
45
- [attr.aria-label]="control.label" *ngSwitchCase="6">
46
- <mat-icon>{{control.label}}</mat-icon>
47
- </button>
48
- <a mat-stroked-button *ngSwitchCase="7" [ngClass]="control.class"
49
- [ngStyle]="control.style" routerLink="[]">{{control.label}}</a>
50
- <a mat-stroked-button *ngSwitchCase="8" [ngClass]="control.class"
51
- [ngStyle]="control.style"
52
- href="{{control.value}}">{{control.label}}</a>
53
- </ng-container>
54
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ButtonComponent } from './button.component';
4
-
5
- describe('ButtonComponent', () => {
6
- let component: ButtonComponent;
7
- let fixture: ComponentFixture<ButtonComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ButtonComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ButtonComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,17 +0,0 @@
1
- import {Component, EventEmitter, Input, Output} from '@angular/core';
2
- import {FormGroup} from "@angular/forms";
3
- import {BaseControl} from "../../base-control";
4
-
5
- @Component({
6
- selector: 'falcon-button',
7
- templateUrl: './button.component.html',
8
- styleUrls: ['./button.component.css']
9
- })
10
- export class ButtonComponent {
11
- @Input() control!: BaseControl<string>;
12
- @Input() formGroup!: FormGroup;
13
- @Output() btnClick = new EventEmitter<string>();
14
- childBtnClick() {
15
- this.btnClick.emit("Button Click Event");
16
- }
17
- }
@@ -1,21 +0,0 @@
1
- <div [ngStyle]="control.style" [ngClass]="control.class"
2
- [formGroup]="formGroup">
3
- <mat-label [ngStyle]="control.style" [ngClass]="control.class"
4
- *ngIf="control.label != undefined">
5
- {{control.label | titlecase}}
6
- </mat-label>
7
- <mat-button-toggle-group
8
- [formControlName]="control.formControlName != undefined ? control.formControlName : 'default'"
9
- [appearance]="control.appearance" [ngStyle]="control.style"
10
- [ngClass]="control.class" [attr.aria-label]="control.label"
11
- class="botton-toggle" (change)="toggleChange($event)">
12
- <mat-button-toggle *ngFor="let item of control.options" [value]="item?.value"
13
- [ngStyle]="control.style"
14
- [ngClass]="control.class">
15
- <mat-icon [ngClass]="item?.class" aria-hidden="false" aria-label="item icon" *ngIf="item?.icon != undefined">
16
- {{item?.icon}}
17
- </mat-icon>
18
- {{item.viewValue | titlecase}}
19
- </mat-button-toggle>
20
- </mat-button-toggle-group>
21
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ButtonToggleComponent } from './button-toggle.component';
4
-
5
- describe('ButtonToggleComponent', () => {
6
- let component: ButtonToggleComponent;
7
- let fixture: ComponentFixture<ButtonToggleComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ButtonToggleComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ButtonToggleComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });