@falcon-ng/core 0.0.20

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 (85) hide show
  1. package/esm2022/falcon-ng-core.mjs +5 -0
  2. package/esm2022/lib/falcon-core/angularmaterial.module.mjs +189 -0
  3. package/esm2022/lib/falcon-core/component/button/button.component.mjs +47 -0
  4. package/esm2022/lib/falcon-core/component/card/card.component.mjs +31 -0
  5. package/esm2022/lib/falcon-core/component/textarea/textarea.component.mjs +28 -0
  6. package/esm2022/lib/falcon-core/component/textbox/textbox.component.mjs +33 -0
  7. package/esm2022/lib/falcon-core/component/validation-error/error-message.pipe.mjs +25 -0
  8. package/esm2022/lib/falcon-core/component/validation-error/error-state-matcher.service.mjs +16 -0
  9. package/esm2022/lib/falcon-core/component/validation-error/validation-error-message-token.mjs +19 -0
  10. package/esm2022/lib/falcon-core/component/validation-error/validation-error.component.mjs +42 -0
  11. package/esm2022/lib/falcon-core/component/validation-error/validation-message-container.directive.mjs +18 -0
  12. package/esm2022/lib/falcon-core/component/validation-error/validation-message.directive.mjs +53 -0
  13. package/esm2022/lib/falcon-core/component-resolver.mjs +39 -0
  14. package/esm2022/lib/falcon-core/control-builder/base-control-builder.mjs +41 -0
  15. package/esm2022/lib/falcon-core/control-builder/control-builder.component.mjs +31 -0
  16. package/esm2022/lib/falcon-core/control-builder/control-data-builder.mjs +3 -0
  17. package/esm2022/lib/falcon-core/control-builder/control-injection.pipe.mjs +29 -0
  18. package/esm2022/lib/falcon-core/control-type/AutoComplete.mjs +8 -0
  19. package/esm2022/lib/falcon-core/control-type/Button.mjs +8 -0
  20. package/esm2022/lib/falcon-core/control-type/ButtonToggle.mjs +8 -0
  21. package/esm2022/lib/falcon-core/control-type/CheckBox.mjs +8 -0
  22. package/esm2022/lib/falcon-core/control-type/Chip.mjs +8 -0
  23. package/esm2022/lib/falcon-core/control-type/DatePicker.mjs +8 -0
  24. package/esm2022/lib/falcon-core/control-type/Divider.mjs +8 -0
  25. package/esm2022/lib/falcon-core/control-type/Editor.mjs +8 -0
  26. package/esm2022/lib/falcon-core/control-type/Radio.mjs +8 -0
  27. package/esm2022/lib/falcon-core/control-type/RichTextEditor.mjs +8 -0
  28. package/esm2022/lib/falcon-core/control-type/Select.mjs +8 -0
  29. package/esm2022/lib/falcon-core/control-type/SlideToggle.mjs +8 -0
  30. package/esm2022/lib/falcon-core/control-type/Slider.mjs +8 -0
  31. package/esm2022/lib/falcon-core/control-type/Textarea.mjs +8 -0
  32. package/esm2022/lib/falcon-core/control-type/Textbox.mjs +8 -0
  33. package/esm2022/lib/falcon-core/falcon-core.module.mjs +41 -0
  34. package/esm2022/lib/falcon-core/model/base-control.mjs +50 -0
  35. package/esm2022/lib/falcon-core/model/enum.mjs +2 -0
  36. package/esm2022/lib/falcon-core/model/interface.mjs +2 -0
  37. package/esm2022/lib/falcon-core/model/ivalidator.mjs +2 -0
  38. package/esm2022/public-api.mjs +28 -0
  39. package/fesm2022/falcon-ng-core-falcon-ng-core-COOgRH2D.mjs +742 -0
  40. package/fesm2022/falcon-ng-core-falcon-ng-core-COOgRH2D.mjs.map +1 -0
  41. package/fesm2022/falcon-ng-core-textarea.component-BBAN4mNj.mjs +73 -0
  42. package/fesm2022/falcon-ng-core-textarea.component-BBAN4mNj.mjs.map +1 -0
  43. package/fesm2022/falcon-ng-core-textbox.component-CgwvtUHj.mjs +77 -0
  44. package/fesm2022/falcon-ng-core-textbox.component-CgwvtUHj.mjs.map +1 -0
  45. package/fesm2022/falcon-ng-core.mjs +50 -0
  46. package/fesm2022/falcon-ng-core.mjs.map +1 -0
  47. package/index.d.ts +5 -0
  48. package/lib/falcon-core/angularmaterial.module.d.ts +49 -0
  49. package/lib/falcon-core/component/button/button.component.d.ts +14 -0
  50. package/lib/falcon-core/component/card/card.component.d.ts +5 -0
  51. package/lib/falcon-core/component/textarea/textarea.component.d.ts +6 -0
  52. package/lib/falcon-core/component/textbox/textbox.component.d.ts +6 -0
  53. package/lib/falcon-core/component/validation-error/error-message.pipe.d.ts +8 -0
  54. package/lib/falcon-core/component/validation-error/error-state-matcher.service.d.ts +8 -0
  55. package/lib/falcon-core/component/validation-error/validation-error-message-token.d.ts +7 -0
  56. package/lib/falcon-core/component/validation-error/validation-error.component.d.ts +9 -0
  57. package/lib/falcon-core/component/validation-error/validation-message-container.directive.d.ts +7 -0
  58. package/lib/falcon-core/component/validation-error/validation-message.directive.d.ts +18 -0
  59. package/lib/falcon-core/component-resolver.d.ts +14 -0
  60. package/lib/falcon-core/control-builder/base-control-builder.d.ts +18 -0
  61. package/lib/falcon-core/control-builder/control-builder.component.d.ts +13 -0
  62. package/lib/falcon-core/control-builder/control-data-builder.d.ts +7 -0
  63. package/lib/falcon-core/control-builder/control-injection.pipe.d.ts +9 -0
  64. package/lib/falcon-core/control-type/AutoComplete.d.ts +5 -0
  65. package/lib/falcon-core/control-type/Button.d.ts +5 -0
  66. package/lib/falcon-core/control-type/ButtonToggle.d.ts +5 -0
  67. package/lib/falcon-core/control-type/CheckBox.d.ts +5 -0
  68. package/lib/falcon-core/control-type/Chip.d.ts +5 -0
  69. package/lib/falcon-core/control-type/DatePicker.d.ts +5 -0
  70. package/lib/falcon-core/control-type/Divider.d.ts +5 -0
  71. package/lib/falcon-core/control-type/Editor.d.ts +5 -0
  72. package/lib/falcon-core/control-type/Radio.d.ts +5 -0
  73. package/lib/falcon-core/control-type/RichTextEditor.d.ts +5 -0
  74. package/lib/falcon-core/control-type/Select.d.ts +5 -0
  75. package/lib/falcon-core/control-type/SlideToggle.d.ts +5 -0
  76. package/lib/falcon-core/control-type/Slider.d.ts +5 -0
  77. package/lib/falcon-core/control-type/Textarea.d.ts +5 -0
  78. package/lib/falcon-core/control-type/Textbox.d.ts +5 -0
  79. package/lib/falcon-core/falcon-core.module.d.ts +12 -0
  80. package/lib/falcon-core/model/base-control.d.ts +83 -0
  81. package/lib/falcon-core/model/enum.d.ts +144 -0
  82. package/lib/falcon-core/model/interface.d.ts +299 -0
  83. package/lib/falcon-core/model/ivalidator.d.ts +19 -0
  84. package/package.json +25 -0
  85. package/public-api.d.ts +24 -0
@@ -0,0 +1,742 @@
1
+ import * as i0 from '@angular/core';
2
+ import { NgModule, InjectionToken, inject, Injector, Pipe, Component, ChangeDetectionStrategy, Input, Injectable, ElementRef, ViewContainerRef, Directive, EventEmitter, Output } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { ScrollingModule } from '@angular/cdk/scrolling';
6
+ import { PortalModule } from '@angular/cdk/portal';
7
+ import { OverlayModule } from '@angular/cdk/overlay';
8
+ import { MatTreeModule } from '@angular/material/tree';
9
+ import { MatTooltipModule } from '@angular/material/tooltip';
10
+ import { MatToolbarModule } from '@angular/material/toolbar';
11
+ import { MatTabsModule } from '@angular/material/tabs';
12
+ import { MatTableModule } from '@angular/material/table';
13
+ import { MatSortModule } from '@angular/material/sort';
14
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
15
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
16
+ import { MatSliderModule } from '@angular/material/slider';
17
+ import { MatSidenavModule } from '@angular/material/sidenav';
18
+ import { MatSelectModule } from '@angular/material/select';
19
+ import { MatNativeDateModule, MatRippleModule } from '@angular/material/core';
20
+ import { MatRadioModule } from '@angular/material/radio';
21
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
22
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
23
+ import { MatPaginatorModule } from '@angular/material/paginator';
24
+ import { MatMenuModule } from '@angular/material/menu';
25
+ import { MatListModule } from '@angular/material/list';
26
+ import { MatInputModule } from '@angular/material/input';
27
+ import { MatIconModule } from '@angular/material/icon';
28
+ import { MatGridListModule } from '@angular/material/grid-list';
29
+ import { MatExpansionModule } from '@angular/material/expansion';
30
+ import { MatDividerModule } from '@angular/material/divider';
31
+ import { MatDialogModule } from '@angular/material/dialog';
32
+ import { MatDatepickerModule } from '@angular/material/datepicker';
33
+ import { MatStepperModule } from '@angular/material/stepper';
34
+ import { MatChipsModule } from '@angular/material/chips';
35
+ import { MatCheckboxModule } from '@angular/material/checkbox';
36
+ import * as i1 from '@angular/material/card';
37
+ import { MatCardModule } from '@angular/material/card';
38
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
39
+ import * as i1$1 from '@angular/material/button';
40
+ import { MatButtonModule } from '@angular/material/button';
41
+ import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
42
+ import { MatBadgeModule } from '@angular/material/badge';
43
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
44
+ import { DragDropModule } from '@angular/cdk/drag-drop';
45
+ import { CdkTreeModule } from '@angular/cdk/tree';
46
+ import { CdkTableModule } from '@angular/cdk/table';
47
+ import { CdkStepperModule } from '@angular/cdk/stepper';
48
+ import { ClipboardModule } from '@angular/cdk/clipboard';
49
+ import { A11yModule } from '@angular/cdk/a11y';
50
+ import { NgControl, ControlContainer, NgModel, ReactiveFormsModule, FormControl, Validators } from '@angular/forms';
51
+ import { merge, fromEvent, iif, EMPTY, startWith, skip, of, from, tap } from 'rxjs';
52
+ import * as i2$1 from '@angular/material/form-field';
53
+
54
+ class AngularmaterialModule {
55
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AngularmaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
56
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: AngularmaterialModule, exports: [A11yModule,
57
+ ClipboardModule,
58
+ CdkStepperModule,
59
+ CdkTableModule,
60
+ CdkTreeModule,
61
+ DragDropModule,
62
+ MatAutocompleteModule,
63
+ MatBadgeModule,
64
+ MatBottomSheetModule,
65
+ MatButtonModule,
66
+ MatButtonToggleModule,
67
+ MatCardModule,
68
+ MatCheckboxModule,
69
+ MatChipsModule,
70
+ MatStepperModule,
71
+ MatDatepickerModule,
72
+ MatDialogModule,
73
+ MatDividerModule,
74
+ MatExpansionModule,
75
+ MatGridListModule,
76
+ MatIconModule,
77
+ MatInputModule,
78
+ MatListModule,
79
+ MatMenuModule,
80
+ MatNativeDateModule,
81
+ MatPaginatorModule,
82
+ MatProgressBarModule,
83
+ MatProgressSpinnerModule,
84
+ MatRadioModule,
85
+ MatRippleModule,
86
+ MatSelectModule,
87
+ MatSidenavModule,
88
+ MatSliderModule,
89
+ MatSlideToggleModule,
90
+ MatSnackBarModule,
91
+ MatSortModule,
92
+ MatTableModule,
93
+ MatTabsModule,
94
+ MatToolbarModule,
95
+ MatTooltipModule,
96
+ MatTreeModule,
97
+ OverlayModule,
98
+ PortalModule,
99
+ ScrollingModule] }); }
100
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AngularmaterialModule, imports: [A11yModule,
101
+ ClipboardModule,
102
+ CdkStepperModule,
103
+ CdkTableModule,
104
+ CdkTreeModule,
105
+ DragDropModule,
106
+ MatAutocompleteModule,
107
+ MatBadgeModule,
108
+ MatBottomSheetModule,
109
+ MatButtonModule,
110
+ MatButtonToggleModule,
111
+ MatCardModule,
112
+ MatCheckboxModule,
113
+ MatChipsModule,
114
+ MatStepperModule,
115
+ MatDatepickerModule,
116
+ MatDialogModule,
117
+ MatDividerModule,
118
+ MatExpansionModule,
119
+ MatGridListModule,
120
+ MatIconModule,
121
+ MatInputModule,
122
+ MatListModule,
123
+ MatMenuModule,
124
+ MatNativeDateModule,
125
+ MatPaginatorModule,
126
+ MatProgressBarModule,
127
+ MatProgressSpinnerModule,
128
+ MatRadioModule,
129
+ MatRippleModule,
130
+ MatSelectModule,
131
+ MatSidenavModule,
132
+ MatSliderModule,
133
+ MatSlideToggleModule,
134
+ MatSnackBarModule,
135
+ MatSortModule,
136
+ MatTableModule,
137
+ MatTabsModule,
138
+ MatToolbarModule,
139
+ MatTooltipModule,
140
+ MatTreeModule,
141
+ OverlayModule,
142
+ PortalModule,
143
+ ScrollingModule] }); }
144
+ }
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AngularmaterialModule, decorators: [{
146
+ type: NgModule,
147
+ args: [{
148
+ declarations: [],
149
+ exports: [
150
+ A11yModule,
151
+ ClipboardModule,
152
+ CdkStepperModule,
153
+ CdkTableModule,
154
+ CdkTreeModule,
155
+ DragDropModule,
156
+ MatAutocompleteModule,
157
+ MatBadgeModule,
158
+ MatBottomSheetModule,
159
+ MatButtonModule,
160
+ MatButtonToggleModule,
161
+ MatCardModule,
162
+ MatCheckboxModule,
163
+ MatChipsModule,
164
+ MatStepperModule,
165
+ MatDatepickerModule,
166
+ MatDialogModule,
167
+ MatDividerModule,
168
+ MatExpansionModule,
169
+ MatGridListModule,
170
+ MatIconModule,
171
+ MatInputModule,
172
+ MatListModule,
173
+ MatMenuModule,
174
+ MatNativeDateModule,
175
+ MatPaginatorModule,
176
+ MatProgressBarModule,
177
+ MatProgressSpinnerModule,
178
+ MatRadioModule,
179
+ MatRippleModule,
180
+ MatSelectModule,
181
+ MatSidenavModule,
182
+ MatSliderModule,
183
+ MatSlideToggleModule,
184
+ MatSnackBarModule,
185
+ MatSortModule,
186
+ MatTableModule,
187
+ MatTabsModule,
188
+ MatToolbarModule,
189
+ MatTooltipModule,
190
+ MatTreeModule,
191
+ OverlayModule,
192
+ PortalModule,
193
+ ScrollingModule
194
+ ]
195
+ }]
196
+ }] });
197
+
198
+ const CONTROL_DATA = new InjectionToken('Control Data');
199
+
200
+ class ControlInjectionPipe {
201
+ constructor() {
202
+ this.injector = inject(Injector);
203
+ }
204
+ transform(formControlName, config) {
205
+ return Injector.create({
206
+ parent: this.injector,
207
+ providers: [
208
+ {
209
+ provide: CONTROL_DATA,
210
+ useValue: { formControlName, config }
211
+ }
212
+ ]
213
+ });
214
+ }
215
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ControlInjectionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
216
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: ControlInjectionPipe, isStandalone: true, name: "controlInjection" }); }
217
+ }
218
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ControlInjectionPipe, decorators: [{
219
+ type: Pipe,
220
+ args: [{
221
+ name: 'controlInjection',
222
+ standalone: true
223
+ }]
224
+ }] });
225
+
226
+ const ERROR_MESSAGES = {
227
+ required: () => `This field is required`,
228
+ requiredTrue: () => `This field is required`,
229
+ email: () => `It should be a valid email`,
230
+ minlength: ({ requiredLength }) => `The length should be at least ${requiredLength} characters`,
231
+ banWords: ({ bannedWord }) => `The word "${bannedWord}" isn't allowed`,
232
+ appBanWords: ({ bannedWord }) => `The word "${bannedWord}" isn't allowed`,
233
+ appPasswordShouldMatch: () => `Password should match`,
234
+ passwordShouldMatch: () => `Password should match`,
235
+ pattern: () => `Wrong format`,
236
+ appUniqueNickname: () => `Nickname is taken`,
237
+ uniqueName: () => `Nickname is taken`,
238
+ };
239
+ const VALIDATION_ERROR_MESSAGES = new InjectionToken(`Validation Messages`, {
240
+ providedIn: 'root',
241
+ factory: () => ERROR_MESSAGES
242
+ });
243
+
244
+ class ErrorMessagePipe {
245
+ constructor() {
246
+ this.errorMessages = inject(VALIDATION_ERROR_MESSAGES);
247
+ }
248
+ transform(key, errorValue) {
249
+ if (!this.errorMessages[key]) {
250
+ console.warn(`Missing message for ${key} validator...`);
251
+ return '';
252
+ }
253
+ return this.errorMessages[key](errorValue);
254
+ }
255
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorMessagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
256
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: ErrorMessagePipe, isStandalone: true, name: "errorMessage" }); }
257
+ }
258
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorMessagePipe, decorators: [{
259
+ type: Pipe,
260
+ args: [{
261
+ name: 'errorMessage',
262
+ standalone: true
263
+ }]
264
+ }] });
265
+
266
+ class ValidationErrorComponent {
267
+ constructor() {
268
+ this.errors = null;
269
+ }
270
+ trackByFn(item) {
271
+ return item.key;
272
+ }
273
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
274
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.1", type: ValidationErrorComponent, isStandalone: true, selector: "falcon-error", inputs: { errors: "errors" }, ngImport: i0, template: `
275
+ @if (errors) {
276
+ @for (error of errors | keyvalue; track trackByFn) {
277
+ <mat-error>{{ error.key | errorMessage:error.value }}</mat-error>
278
+ }
279
+ }
280
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
281
+ }
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationErrorComponent, decorators: [{
283
+ type: Component,
284
+ args: [{
285
+ selector: 'falcon-error',
286
+ standalone: true,
287
+ imports: [CommonModule, MatInputModule, ErrorMessagePipe],
288
+ changeDetection: ChangeDetectionStrategy.OnPush,
289
+ template: `
290
+ @if (errors) {
291
+ @for (error of errors | keyvalue; track trackByFn) {
292
+ <mat-error>{{ error.key | errorMessage:error.value }}</mat-error>
293
+ }
294
+ }
295
+ `,
296
+ }]
297
+ }], propDecorators: { errors: [{
298
+ type: Input
299
+ }] } });
300
+
301
+ class ErrorStateMatcherService {
302
+ isErrorState(control, form) {
303
+ return Boolean(control && control.invalid && (form && form.submitted));
304
+ }
305
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorStateMatcherService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
306
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorStateMatcherService, providedIn: 'root' }); }
307
+ }
308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorStateMatcherService, decorators: [{
309
+ type: Injectable,
310
+ args: [{
311
+ providedIn: 'root'
312
+ }]
313
+ }] });
314
+
315
+ class ValidationMessageDirective {
316
+ constructor() {
317
+ this.ngControl = inject(NgControl, { self: true, optional: true }) || inject(ControlContainer, { self: true });
318
+ this.elementRef = inject(ElementRef);
319
+ this.errorStateMatcher = inject(ErrorStateMatcherService);
320
+ this.container = inject(ViewContainerRef);
321
+ this.parentContainer = inject(ControlContainer, { optional: true });
322
+ this.componentRef = null;
323
+ }
324
+ get form() {
325
+ return this.parentContainer?.formDirective;
326
+ }
327
+ ngOnInit() {
328
+ if (!this.ngControl.control)
329
+ throw Error(`No control model for ${this.ngControl.name} control...`);
330
+ this.errorMessageTrigger = merge(this.ngControl.control.statusChanges, fromEvent(this.elementRef.nativeElement, 'blur'), iif(() => !!this.form, this.form.ngSubmit, EMPTY)).pipe(startWith(this.ngControl.control.status), skip(this.ngControl instanceof NgModel ? 1 : 0)).subscribe(() => {
331
+ if (this.errorStateMatcher.isErrorState(this.ngControl.control, this.form)) {
332
+ if (!this.componentRef) {
333
+ this.componentRef = this.container.createComponent(ValidationErrorComponent);
334
+ this.componentRef.changeDetectorRef.markForCheck();
335
+ }
336
+ this.componentRef.setInput('errors', this.ngControl.errors);
337
+ }
338
+ else {
339
+ this.componentRef?.destroy();
340
+ this.componentRef = null;
341
+ }
342
+ });
343
+ }
344
+ ngOnDestroy() {
345
+ this.errorMessageTrigger.unsubscribe();
346
+ }
347
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationMessageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
348
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: ValidationMessageDirective, isStandalone: true, selector: "[formControl]:not([withoutValidationErrors]),[formControlName]:not([withoutValidationErrors]),[formGroupName]:not([withoutValidationErrors]))", inputs: { errorStateMatcher: "errorStateMatcher", container: "container" }, ngImport: i0 }); }
349
+ }
350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationMessageDirective, decorators: [{
351
+ type: Directive,
352
+ args: [{
353
+ standalone: true,
354
+ selector: '[formControl]:not([withoutValidationErrors]),[formControlName]:not([withoutValidationErrors]),[formGroupName]:not([withoutValidationErrors]))',
355
+ }]
356
+ }], propDecorators: { errorStateMatcher: [{
357
+ type: Input
358
+ }], container: [{
359
+ type: Input
360
+ }] } });
361
+
362
+ class ValidationMessageContainerDirective {
363
+ constructor() {
364
+ this.container = inject(ViewContainerRef);
365
+ }
366
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationMessageContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
367
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: ValidationMessageContainerDirective, isStandalone: true, selector: "[falconValidationMessageContainer]", exportAs: ["falconValidationMessageContainer"], ngImport: i0 }); }
368
+ }
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ValidationMessageContainerDirective, decorators: [{
370
+ type: Directive,
371
+ args: [{
372
+ selector: '[falconValidationMessageContainer]',
373
+ standalone: true,
374
+ exportAs: 'falconValidationMessageContainer'
375
+ }]
376
+ }] });
377
+
378
+ const sharedControlDeps = [CommonModule, ReactiveFormsModule, ValidationMessageDirective, ValidationMessageContainerDirective];
379
+ const controlProvider = {
380
+ provide: ControlContainer,
381
+ useFactory: () => inject(ControlContainer, { skipSelf: true })
382
+ };
383
+ class BaseControlBuilder {
384
+ constructor() {
385
+ this.parentGroupDir = inject(ControlContainer);
386
+ this.control = inject(CONTROL_DATA);
387
+ this.formControl = new FormControl(this.control.config.value, this.bindValidators(this.control.config.validations));
388
+ }
389
+ get parentFormGroup() {
390
+ return this.parentGroupDir.control;
391
+ }
392
+ ngOnInit() {
393
+ this.parentFormGroup.addControl(this.control.formControlName, this.formControl);
394
+ }
395
+ ngOnDestroy() {
396
+ this.parentFormGroup.removeControl(this.control.formControlName);
397
+ }
398
+ bindValidators(validations) {
399
+ if (validations.length > 0) {
400
+ const validatorList = validations.map((valid) => valid.validator);
401
+ return Validators.compose(validatorList);
402
+ }
403
+ return Validators.nullValidator;
404
+ }
405
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BaseControlBuilder, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
406
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: BaseControlBuilder, ngImport: i0 }); }
407
+ }
408
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BaseControlBuilder, decorators: [{
409
+ type: Directive
410
+ }] });
411
+
412
+ class ComponentResolver {
413
+ constructor() {
414
+ this.loadedControlCompoments = new Map();
415
+ this.lazyControlComponents = {
416
+ textbox: () => import('./falcon-ng-core-textbox.component-CgwvtUHj.mjs').then(c => c.TextboxComponent),
417
+ textarea: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
418
+ select: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
419
+ datepicker: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
420
+ radio: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
421
+ checkbox: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
422
+ button: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
423
+ slideToggle: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
424
+ slider: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
425
+ buttonToggle: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
426
+ autocomplete: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
427
+ chip: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
428
+ editor: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
429
+ divider: () => import('./falcon-ng-core-textarea.component-BBAN4mNj.mjs').then(c => c.TextareaComponent),
430
+ };
431
+ }
432
+ resolver(controlType) {
433
+ const loadedComponent = this.loadedControlCompoments.get(controlType);
434
+ if (loadedComponent)
435
+ return of(loadedComponent);
436
+ return from(this.lazyControlComponents[controlType]()).pipe(tap(comp => this.loadedControlCompoments.set(controlType, comp)));
437
+ }
438
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ComponentResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
439
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ComponentResolver, providedIn: 'root' }); }
440
+ }
441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ComponentResolver, decorators: [{
442
+ type: Injectable,
443
+ args: [{
444
+ providedIn: 'root',
445
+ }]
446
+ }] });
447
+
448
+ class ControlBuilderComponent {
449
+ constructor(componentResolver, cdref) {
450
+ this.componentResolver = componentResolver;
451
+ this.cdref = cdref;
452
+ }
453
+ ngAfterContentChecked() {
454
+ this.cdref.detectChanges();
455
+ }
456
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ControlBuilderComponent, deps: [{ token: ComponentResolver }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
457
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: ControlBuilderComponent, selector: "falcon-control", inputs: { control: "control" }, ngImport: i0, template: `<ng-container class="w-full" [ngComponentOutlet]="componentResolver.resolver(control.controlType) | async"
458
+ [ngComponentOutletInjector]="control.formControlName | controlInjection: control"></ng-container>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: ControlInjectionPipe, name: "controlInjection" }], viewProviders: [controlProvider] }); }
459
+ }
460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ControlBuilderComponent, decorators: [{
461
+ type: Component,
462
+ args: [{
463
+ selector: 'falcon-control',
464
+ viewProviders: [controlProvider],
465
+ template: `<ng-container class="w-full" [ngComponentOutlet]="componentResolver.resolver(control.controlType) | async"
466
+ [ngComponentOutletInjector]="control.formControlName | controlInjection: control"></ng-container>`
467
+ }]
468
+ }], ctorParameters: () => [{ type: ComponentResolver }, { type: i0.ChangeDetectorRef }], propDecorators: { control: [{
469
+ type: Input,
470
+ args: [{ required: true }]
471
+ }] } });
472
+
473
+ class CardComponent {
474
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
475
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: CardComponent, selector: "falcon-card", host: { properties: { "style.--mdc-elevated-card-container-shape": "\"10px\"", "style.--mdc-elevated-card-container-elevation": "\"0px 0px 0px 0px rgba(0, 0, 0, 0.12), 0px 0px 0px 1px rgba(0, 0, 0, 0.12), 0px 0px 1px 1px rgba(0.12, 0.12, 0.12, 0.12)\"" } }, ngImport: i0, template: `
476
+ <mat-card>
477
+ <mat-card-content>
478
+ <ng-content></ng-content>
479
+ </mat-card-content>
480
+ </mat-card>
481
+ `, isInline: true, dependencies: [{ kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1.MatCardContent, selector: "mat-card-content" }] }); }
482
+ }
483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: CardComponent, decorators: [{
484
+ type: Component,
485
+ args: [{
486
+ selector: 'falcon-card',
487
+ host: {
488
+ '[style.--mdc-elevated-card-container-shape]': '"10px"',
489
+ '[style.--mdc-elevated-card-container-elevation]': '"0px 0px 0px 0px rgba(0, 0, 0, 0.12), 0px 0px 0px 1px rgba(0, 0, 0, 0.12), 0px 0px 1px 1px rgba(0.12, 0.12, 0.12, 0.12)"'
490
+ },
491
+ template: `
492
+ <mat-card>
493
+ <mat-card-content>
494
+ <ng-content></ng-content>
495
+ </mat-card-content>
496
+ </mat-card>
497
+ `,
498
+ }]
499
+ }] });
500
+
501
+ class ButtonComponent {
502
+ constructor() {
503
+ this.type = 'submit';
504
+ this.color = 'primary';
505
+ this.disabled = false;
506
+ this.click = new EventEmitter();
507
+ }
508
+ ngOnDestroy() {
509
+ this.click.complete();
510
+ }
511
+ onClick(event) {
512
+ if (['reset', 'submit'].includes(this.type)) {
513
+ this.click.emit(event);
514
+ return true;
515
+ }
516
+ return false;
517
+ }
518
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
519
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: ButtonComponent, selector: "falcon-button", inputs: { label: "label", type: "type", color: "color", disabled: "disabled" }, outputs: { click: "click" }, ngImport: i0, template: `
520
+ <button mat-flat-button [color]="color" [type]="type" (click)="onClick($event)" [disabled]="disabled">{{ label }}</button>
521
+ `, isInline: true, dependencies: [{ kind: "component", type: i1$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
522
+ }
523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ButtonComponent, decorators: [{
524
+ type: Component,
525
+ args: [{
526
+ selector: 'falcon-button',
527
+ template: `
528
+ <button mat-flat-button [color]="color" [type]="type" (click)="onClick($event)" [disabled]="disabled">{{ label }}</button>
529
+ `,
530
+ }]
531
+ }], propDecorators: { label: [{
532
+ type: Input,
533
+ args: [{ required: true }]
534
+ }], type: [{
535
+ type: Input,
536
+ args: [{ required: true }]
537
+ }], color: [{
538
+ type: Input
539
+ }], disabled: [{
540
+ type: Input
541
+ }], click: [{
542
+ type: Output
543
+ }] } });
544
+
545
+ class FalconCoreModule {
546
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FalconCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
547
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: FalconCoreModule, declarations: [ControlBuilderComponent,
548
+ CardComponent,
549
+ ButtonComponent], imports: [AngularmaterialModule,
550
+ CommonModule,
551
+ ControlInjectionPipe], exports: [AngularmaterialModule,
552
+ ControlBuilderComponent,
553
+ CardComponent,
554
+ ButtonComponent] }); }
555
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FalconCoreModule, imports: [AngularmaterialModule,
556
+ CommonModule, AngularmaterialModule] }); }
557
+ }
558
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FalconCoreModule, decorators: [{
559
+ type: NgModule,
560
+ args: [{
561
+ declarations: [
562
+ ControlBuilderComponent,
563
+ CardComponent,
564
+ ButtonComponent
565
+ ],
566
+ imports: [
567
+ AngularmaterialModule,
568
+ CommonModule,
569
+ ControlInjectionPipe,
570
+ ],
571
+ exports: [AngularmaterialModule,
572
+ ControlBuilderComponent,
573
+ CardComponent,
574
+ ButtonComponent],
575
+ }]
576
+ }] });
577
+
578
+ /**
579
+ * @description
580
+ * Class use for setting the control properties.
581
+ * @usageNotes
582
+ * ```ts
583
+ * new Dropdown({
584
+ * formControlName: 'brave',
585
+ * label: 'Bravery Rating',
586
+ * options: [
587
+ * {key: 'solid', value: 'Solid'},
588
+ * {key: 'great', value: 'Great'},
589
+ * {key: 'good', value: 'Good'},
590
+ * {key: 'unproven', value: 'Unproven'}
591
+ * ],
592
+ * order: 3
593
+ * }),
594
+ ** ```
595
+ */
596
+ class BaseControl {
597
+ constructor(options) {
598
+ this.value = options.value;
599
+ this.formControlName = options.formControlName || '';
600
+ this.label = options.label;
601
+ this.labelPosition = options.labelPosition || 'before' || 'after';
602
+ this.order = options.order === undefined ? 1 : options.order;
603
+ this.controlType = options.controlType || "button" /* Control.Button */;
604
+ this.type = options.type || '';
605
+ this.disabled = options.disabled || false;
606
+ this.options = options.options || [];
607
+ this.validations = options.validations || [];
608
+ this.appearance = options.appearance || 'outline';
609
+ this.class = options.class || '';
610
+ this.style = options.style || {};
611
+ this.placeHolder = options.placeHolder || '';
612
+ this.floatLabel = options.floatLabel || 'auto';
613
+ this.hint = options.hint || {};
614
+ this.prefix = options.prefix || {};
615
+ this.suffix = options.suffix || {};
616
+ this.textAreaProperty =
617
+ options.textAreaProperty || {};
618
+ this.event = options.event || {};
619
+ this.selectProperty = options.selectProperty || {};
620
+ this.color = options.color || undefined;
621
+ this.sliderProperty = options.sliderProperty || {};
622
+ this.chipSelectedOptions = options.chipSelectedOptions || {};
623
+ this.editorProperty = options.editorProperty || {};
624
+ this.formArray = options.formArray || undefined;
625
+ }
626
+ }
627
+
628
+ class AutoComplete extends BaseControl {
629
+ constructor() {
630
+ super(...arguments);
631
+ this.controlType = "autocomplete" /* Control.AutoComplete */;
632
+ }
633
+ }
634
+
635
+ class Button extends BaseControl {
636
+ constructor() {
637
+ super(...arguments);
638
+ this.controlType = "button" /* Control.Button */;
639
+ }
640
+ }
641
+
642
+ class ButtonToggle extends BaseControl {
643
+ constructor() {
644
+ super(...arguments);
645
+ this.controlType = "buttonToggle" /* Control.ButtonToggle */;
646
+ }
647
+ }
648
+
649
+ class CheckBox extends BaseControl {
650
+ constructor() {
651
+ super(...arguments);
652
+ this.controlType = "checkbox" /* Control.Checkbox */;
653
+ }
654
+ }
655
+
656
+ class Chip extends BaseControl {
657
+ constructor() {
658
+ super(...arguments);
659
+ this.controlType = "chip" /* Control.Chip */;
660
+ }
661
+ }
662
+
663
+ class DatePicker extends BaseControl {
664
+ constructor() {
665
+ super(...arguments);
666
+ this.controlType = "datepicker" /* Control.DatePicker */;
667
+ }
668
+ }
669
+
670
+ class Divider extends BaseControl {
671
+ constructor() {
672
+ super(...arguments);
673
+ this.controlType = "divider" /* Control.Divider */;
674
+ }
675
+ }
676
+
677
+ class Editor extends BaseControl {
678
+ constructor() {
679
+ super(...arguments);
680
+ this.controlType = "editor" /* Control.Editor */;
681
+ }
682
+ }
683
+
684
+ class Radio extends BaseControl {
685
+ constructor() {
686
+ super(...arguments);
687
+ this.controlType = "radio" /* Control.Radio */;
688
+ }
689
+ }
690
+
691
+ class RichTextEditor extends BaseControl {
692
+ constructor() {
693
+ super(...arguments);
694
+ this.controlType = "editor" /* Control.Editor */;
695
+ }
696
+ }
697
+
698
+ class Select extends BaseControl {
699
+ constructor() {
700
+ super(...arguments);
701
+ this.controlType = "select" /* Control.Select */;
702
+ }
703
+ }
704
+
705
+ class Slider extends BaseControl {
706
+ constructor() {
707
+ super(...arguments);
708
+ this.controlType = "slider" /* Control.Slider */;
709
+ }
710
+ }
711
+
712
+ class SliderToggle extends BaseControl {
713
+ constructor() {
714
+ super(...arguments);
715
+ this.controlType = "slideToggle" /* Control.SlideToggle */;
716
+ }
717
+ }
718
+
719
+ class Textarea extends BaseControl {
720
+ constructor() {
721
+ super(...arguments);
722
+ this.controlType = "textarea" /* Control.TextArea */;
723
+ }
724
+ }
725
+
726
+ class Textbox extends BaseControl {
727
+ constructor() {
728
+ super(...arguments);
729
+ this.controlType = "textbox" /* Control.TextBox */;
730
+ }
731
+ }
732
+
733
+ /*
734
+ * Public API Surface of core
735
+ */
736
+
737
+ /**
738
+ * Generated bundle index. Do not edit.
739
+ */
740
+
741
+ export { AutoComplete as A, BaseControlBuilder as B, CheckBox as C, DatePicker as D, Editor as E, FalconCoreModule as F, Radio as R, Select as S, Textarea as T, ValidationMessageDirective as V, ValidationMessageContainerDirective as a, BaseControl as b, controlProvider as c, Button as d, ButtonToggle as e, Chip as f, Divider as g, RichTextEditor as h, Slider as i, SliderToggle as j, Textbox as k, ControlBuilderComponent as l, AngularmaterialModule as m, CardComponent as n, ButtonComponent as o, sharedControlDeps as s };
742
+ //# sourceMappingURL=falcon-ng-core-falcon-ng-core-COOgRH2D.mjs.map