@rxap/form-system 13.1.0 → 13.2.0

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.
@@ -8,7 +8,7 @@ import { RxapFormControl, RxapFormGroup, RxapFormArray } from '@rxap/forms';
8
8
  import * as i2 from '@rxap/data-source';
9
9
  import { PipeDataSource, DataSourceLoader, BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
10
10
  import { Mixin } from '@rxap/mixin';
11
- import { getMetadata, setMetadataMap, setMetadataMapMap, setMetadata } from '@rxap/utilities/reflect-metadata';
11
+ import { getMetadata, setMetadataMapMap, setMetadataMap, setMetadata } from '@rxap/utilities/reflect-metadata';
12
12
  import { map, startWith, distinctUntilChanged, shareReplay, tap, catchError, switchMap } from 'rxjs/operators';
13
13
  import { Subscription, of } from 'rxjs';
14
14
  import * as i3 from '@angular/material/form-field';
@@ -233,8 +233,8 @@ function controlDataSource(control) {
233
233
  return new ControlDataSource(control, { id: control.controlId });
234
234
  }
235
235
 
236
- class ExtractControlMixin {
237
- extractControl(parent, controlPath) {
236
+ class ExtractControlFromParentMixin {
237
+ extractControlFromParent(parent, controlPath) {
238
238
  if (!controlPath) {
239
239
  throw new RxapFormSystemError('The control path is empty', '');
240
240
  }
@@ -263,17 +263,79 @@ class ExtractFormDefinitionMixin {
263
263
  }
264
264
  }
265
265
 
266
- function UseComponent(component, setProperties = {}) {
266
+ function UseDataSource(dataSource, name, settings) {
267
267
  return function (target, propertyKey) {
268
- setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);
269
- setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);
268
+ const value = { dataSource, settings };
269
+ setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
270
270
  };
271
271
  }
272
272
 
273
- function UseDataSource(dataSource, name, settings) {
273
+ class ExtractControlMixin {
274
+ extractControl(ngControl = this.ngControl ?? this.matFormField?._control?.ngControl ?? null) {
275
+ if (!ngControl) {
276
+ throw new Error('The ngControl is not defined!');
277
+ }
278
+ this.ngControl = ngControl;
279
+ const control = this.ngControl.control;
280
+ if (!(control instanceof RxapFormControl)) {
281
+ throw new Error('Control is not a RxapFormControl!');
282
+ }
283
+ return this.control = control;
284
+ }
285
+ }
286
+
287
+ const DATA_SOURCE_NAME = 'options';
288
+ function ComposeOptionsTransformers(...fnc) {
289
+ return base => fnc.reduce((source, transform) => transform(source), base);
290
+ }
291
+ function UseOptionsDataSource(dataSource, settings) {
274
292
  return function (target, propertyKey) {
275
- const value = { dataSource, settings };
276
- setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
293
+ UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
294
+ };
295
+ }
296
+ let ExtractOptionsDataSourceMixin = class ExtractOptionsDataSourceMixin {
297
+ extractOptionsDatasource(control) {
298
+ control ?? (control = this.extractControl());
299
+ if (!(control instanceof RxapFormControl)) {
300
+ throw new Error('Ensure to use a RxapFromControl');
301
+ }
302
+ const formDefinition = this.extractFormDefinition(control);
303
+ const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
304
+ if (!useDataSourceValueMap.has('options')) {
305
+ throw new Error(`The data source with the name 'options' is not defined`);
306
+ }
307
+ const useDataSourceValue = useDataSourceValueMap.get('options');
308
+ this.settings = useDataSourceValue.settings ?? {};
309
+ let dataSource;
310
+ try {
311
+ dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
312
+ }
313
+ catch (e) {
314
+ if (e.name && e.name === 'NullInjectorError') {
315
+ if (isDevMode()) {
316
+ console.error('Cloud not inject the options data source', useDataSourceValue);
317
+ }
318
+ throw new Error('Cloud not inject the options data source:\n' + e.message);
319
+ }
320
+ throw e;
321
+ }
322
+ if (this.settings?.transformer) {
323
+ dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap(options => useDataSourceValue.lastValue = options));
324
+ }
325
+ else {
326
+ dataSource = new PipeDataSource(dataSource, tap(options => useDataSourceValue.lastValue = options));
327
+ }
328
+ return this.dataSource = dataSource;
329
+ }
330
+ };
331
+ ExtractOptionsDataSourceMixin = __decorate([
332
+ Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)
333
+ ], ExtractOptionsDataSourceMixin);
334
+
335
+ function UseComponent(component, setProperties = {}) {
336
+ return function (target, propertyKey) {
337
+ setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);
338
+ setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);
277
339
  };
278
340
  }
279
341
 
@@ -322,7 +384,7 @@ let ControlHideShowDirective = class ControlHideShowDirective {
322
384
  if (!this.ngControl && !this.controlId) {
323
385
  throw new Error('If the NgControl is not injectable then the control id must be defined!');
324
386
  }
325
- const control = this.ngControl?.control ?? this.extractControl(this.parent, this.controlId);
387
+ const control = this.ngControl?.control ?? this.extractControlFromParent(this.parent, this.controlId);
326
388
  if (!(control instanceof RxapFormControl)) {
327
389
  throw new Error('The control is not an instance of RxapFormControl');
328
390
  }
@@ -414,7 +476,7 @@ let ControlHideShowDirective = class ControlHideShowDirective {
414
476
  ControlHideShowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ControlHideShowDirective, deps: [{ token: Renderer2 }, { token: ElementRef }, { token: ControlContainer, optional: true }, { token: NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
415
477
  ControlHideShowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: ControlHideShowDirective, selector: "[rxapControlHideShow]", inputs: { controlId: ["rxapControlHideShow", "controlId"] }, ngImport: i0 });
416
478
  ControlHideShowDirective = __decorate([
417
- Mixin(ExtractControlMixin, ExtractFormDefinitionMixin),
479
+ Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin),
418
480
  __metadata("design:paramtypes", [Renderer2,
419
481
  ElementRef, Object, Object])
420
482
  ], ControlHideShowDirective);
@@ -458,15 +520,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
458
520
  }]
459
521
  }] });
460
522
 
461
- const DATA_SOURCE_NAME = 'options';
462
- function ComposeOptionsTransformers(...fnc) {
463
- return base => fnc.reduce((source, transform) => transform(source), base);
464
- }
465
- function UseOptionsDataSource(dataSource, settings) {
466
- return function (target, propertyKey) {
467
- UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
468
- };
469
- }
470
523
  let InputSelectOptionsDirective = class InputSelectOptionsDirective {
471
524
  constructor(template, dataSourceLoader, viewContainerRef, injector, cdr,
472
525
  // The ngControl could be unknown on construction
@@ -485,8 +538,7 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
485
538
  }
486
539
  ngAfterViewInit() {
487
540
  var _a;
488
- this.extractControl();
489
- this.extractDatasource();
541
+ this.extractOptionsDatasource();
490
542
  this.viewer = {
491
543
  id: '[rxapInputSelectOptions]' + this.control.controlId,
492
544
  viewChange: this.control.value$.pipe(map(value => {
@@ -499,60 +551,23 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
499
551
  };
500
552
  if (this.matAutocomplete) {
501
553
  this.matAutocomplete.displayWith = this.toDisplay.bind(this);
554
+ this.settings ?? (this.settings = {});
502
555
  (_a = this.settings).filteredOptions ?? (_a.filteredOptions = true);
503
556
  }
504
557
  this.loadOptions();
505
558
  }
506
- extractDatasource(control = this.control) {
507
- const formDefinition = this.extractFormDefinition(control);
508
- const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
509
- if (!useDataSourceValueMap.has(DATA_SOURCE_NAME)) {
510
- throw new Error(`The data source with the name 'options' is not defined`);
511
- }
512
- const useDataSourceValue = useDataSourceValueMap.get(DATA_SOURCE_NAME);
513
- this.settings = useDataSourceValue.settings;
514
- let dataSource;
515
- try {
516
- dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
517
- }
518
- catch (e) {
519
- if (e.name && e.name === 'NullInjectorError') {
520
- if (isDevMode()) {
521
- console.error('Cloud not inject the options data source', useDataSourceValue);
522
- }
523
- throw new Error('Cloud not inject the options data source:\n' + e.message);
524
- }
525
- throw e;
526
- }
527
- const settings = useDataSourceValue.settings;
528
- if (settings?.transformer) {
529
- dataSource = new PipeDataSource(dataSource, map(settings.transformer));
530
- }
531
- return this.dataSource = dataSource;
532
- }
533
559
  toDisplay(value) {
534
560
  if (!value) {
535
561
  return '';
536
562
  }
537
563
  return this.options?.find((option) => option.value === value)?.display ?? (isDevMode() ? 'to display error' : '');
538
564
  }
539
- extractControl(ngControl = this.ngControl ?? this.matFormField?._control?.ngControl ?? null) {
540
- if (!ngControl) {
541
- throw new Error('The ngControl is not defined!');
542
- }
543
- this.ngControl = ngControl;
544
- const control = this.ngControl.control;
545
- if (!(control instanceof RxapFormControl)) {
546
- throw new Error('Control is not a RxapFormControl!');
547
- }
548
- return this.control = control;
549
- }
550
565
  ngOnDestroy() {
551
566
  this.subscription?.unsubscribe();
552
567
  }
553
568
  loadOptions(dataSource = this.dataSource) {
554
569
  this.subscription.add(dataSource.connect(this.viewer).pipe(switchMap(options => {
555
- if (this.settings.filteredOptions) {
570
+ if (this.settings?.filteredOptions) {
556
571
  return this.control.value$.pipe(map(controlValue => {
557
572
  if (typeof controlValue === 'string' && controlValue) {
558
573
  controlValue = controlValue.toLowerCase();
@@ -604,7 +619,7 @@ __decorate([
604
619
  __metadata("design:type", BaseDataSource)
605
620
  ], InputSelectOptionsDirective.prototype, "dataSource", void 0);
606
621
  InputSelectOptionsDirective = __decorate([
607
- Mixin(ExtractFormDefinitionMixin, ExtractDataSourcesMixin),
622
+ Mixin(ExtractOptionsDataSourceMixin),
608
623
  __metadata("design:paramtypes", [TemplateRef,
609
624
  DataSourceLoader,
610
625
  ViewContainerRef,
@@ -752,5 +767,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
752
767
  * Generated bundle index. Do not edit.
753
768
  */
754
769
 
755
- export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, ControlHideShowDirectiveModule, DATA_SOURCE_NAME, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, FormSystemControlDirective, FormSystemDirectivesModule, FormSystemMetadataKeys, FormSystemModule, InputSelectOptionsDirective, InputSelectOptionsDirectiveModule, IsEqualToDirective, IsEqualToDirectiveModule, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RxapFormSystemError, UseComponent, UseDataSource, UseFormComponent, UseHideFunction, UseOptionsDataSource, UseShowFunction, controlDataSource };
770
+ export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, ControlHideShowDirectiveModule, DATA_SOURCE_NAME, ExtractControlFromParentMixin, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, ExtractOptionsDataSourceMixin, FormSystemControlDirective, FormSystemDirectivesModule, FormSystemMetadataKeys, FormSystemModule, InputSelectOptionsDirective, InputSelectOptionsDirectiveModule, IsEqualToDirective, IsEqualToDirectiveModule, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RxapFormSystemError, UseComponent, UseDataSource, UseFormComponent, UseHideFunction, UseOptionsDataSource, UseShowFunction, controlDataSource };
756
771
  //# sourceMappingURL=rxap-form-system.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-form-system.mjs","sources":["../../../../libs/form-system/src/lib/error.ts","../../../../libs/form-system/src/lib/decorators/metadata-keys.ts","../../../../libs/form-system/src/lib/mixins/extract-data-sources.mixin.ts","../../../../libs/form-system/src/lib/form-system-control.directive.ts","../../../../libs/form-system/src/lib/form-system.module.ts","../../../../libs/form-system/src/lib/control-data-source.ts","../../../../libs/form-system/src/lib/mixins/extract-control.mixin.ts","../../../../libs/form-system/src/lib/mixins/extract-form-definition.mixin.ts","../../../../libs/form-system/src/lib/decorators/use-component.ts","../../../../libs/form-system/src/lib/decorators/use-data-source.ts","../../../../libs/form-system/src/lib/decorators/use-form-component.ts","../../../../libs/form-system/src/lib/directives/control-hide-show.directive.ts","../../../../libs/form-system/src/lib/directives/input-select-options.directive.ts","../../../../libs/form-system/src/lib/directives/form-directives.module.ts","../../../../libs/form-system/src/lib/validators/is-equal-to.ts","../../../../libs/form-system/src/index.ts","../../../../libs/form-system/src/rxap-form-system.ts"],"sourcesContent":["import { RxapError } from '@rxap/utilities';\n\nexport class RxapFormSystemError extends RxapError {\n\n constructor(message: string, code: string, className?: string) {\n super('@rxap/form-system', message, code, className);\n }\n\n}\n","export enum FormSystemMetadataKeys {\n COMPONENTS = 'rxap/form-system/components',\n DATA_SOURCES = 'rxap/form-system/data-sources',\n COMPONENTS_PROPERTIES = 'rxap/form-system/components-properties',\n FORM_COMPONENT = 'rxap/window-form-system/form-component',\n}\n","import { FormDefinition } from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\nimport { FormSystemMetadataKeys } from '../decorators/metadata-keys';\nimport { UseDataSourceValue } from '../decorators/use-data-source';\nimport { getMetadata } from '@rxap/utilities/reflect-metadata';\n\nexport class ExtractDataSourcesMixin {\n\n protected extractDataSources(formDefinition: FormDefinition, controlId: string): Map<string, UseDataSourceValue> {\n const map = getMetadata<Map<string, Map<string, UseDataSourceValue>>>(\n FormSystemMetadataKeys.DATA_SOURCES,\n Object.getPrototypeOf(formDefinition)\n );\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use data source map from the form definition instance', '');\n }\n\n if (!map.has(controlId)) {\n throw new RxapFormSystemError('A use data source definition does not exists in the form definition metadata', '');\n }\n\n return map.get(controlId)!;\n }\n\n}\n","import {\n Input,\n Inject,\n OnInit,\n ComponentFactoryResolver,\n ViewContainerRef,\n Directive,\n ComponentRef,\n INJECTOR,\n Injector\n} from '@angular/core';\nimport {\n Required,\n Constructor\n} from '@rxap/utilities';\nimport {\n ControlContainer,\n ControlValueAccessor\n} from '@angular/forms';\nimport { RxapFormSystemError } from './error';\nimport {\n RxapFormControl,\n FormDefinition\n} from '@rxap/forms';\nimport { FormSystemMetadataKeys } from './decorators/metadata-keys';\nimport { ControlWithDataSource } from './control-with-data-source';\nimport {\n DataSourceLoader,\n PipeDataSource\n} from '@rxap/data-source';\nimport { Mixin } from '@rxap/mixin';\nimport { ExtractDataSourcesMixin } from './mixins/extract-data-sources.mixin';\nimport { map } from 'rxjs/operators';\nimport { getMetadata } from '@rxap/utilities/reflect-metadata';\n\nexport interface FormSystemControlDirective<T> extends ExtractDataSourcesMixin, ControlValueAccessor, OnInit {}\n\n@Mixin(ExtractDataSourcesMixin)\n@Directive({\n selector: '[rxapFormSystemControl]'\n})\nexport class FormSystemControlDirective<T> implements ControlValueAccessor, OnInit {\n\n /**\n * Defines the form control id\n */\n @Input()\n @Required\n public controlId!: string;\n\n @Required\n protected control!: RxapFormControl;\n\n @Required\n protected componentRef!: ComponentRef<ControlValueAccessor & Partial<ControlWithDataSource>>;\n\n constructor(\n @Inject(ControlContainer)\n private readonly parent: ControlContainer,\n @Inject(ComponentFactoryResolver)\n private readonly cfr: ComponentFactoryResolver,\n @Inject(ViewContainerRef)\n private readonly viewContainerRef: ViewContainerRef,\n @Inject(DataSourceLoader)\n private readonly dataSourceLoader: DataSourceLoader,\n @Inject(INJECTOR)\n private readonly injector: Injector\n ) {}\n\n public ngOnInit() {\n\n this.control = this.extractControl();\n\n const formDefinition = this.extractFormDefinition();\n\n this.componentRef = this.createComponent(formDefinition);\n\n this.setDataSources(formDefinition, this.componentRef.instance);\n this.setComponentProperties(formDefinition, this.componentRef.instance);\n\n this.viewContainerRef.insert(this.componentRef.hostView);\n\n }\n\n public registerOnChange(fn: (value: (any | null)) => void): void {\n this.componentRef.instance.registerOnChange(fn);\n }\n\n public registerOnTouched(fn: () => void): void {\n this.componentRef.instance.registerOnTouched(fn);\n }\n\n public writeValue(value: any): void {\n this.componentRef.instance.writeValue(value);\n }\n\n public setDisabledState(isDisabled: boolean): void {\n if (this.componentRef.instance.setDisabledState) {\n this.componentRef.instance.setDisabledState(isDisabled);\n }\n }\n\n private setDataSources(formDefinition: FormDefinition, component: Partial<ControlWithDataSource>): void {\n\n if (!component.setDataSource) {\n throw new RxapFormSystemError(\n 'The ControlWithDataSource interface is not implemented for the control component, but the control has defined data sources',\n ''\n );\n }\n\n const useDataSourceValueMap = this.extractDataSources(formDefinition, this.controlId);\n\n for (const [ name, useDataSourceValue ] of useDataSourceValueMap.entries()) {\n\n let dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource);\n\n const settings = useDataSourceValue.settings;\n\n if (settings?.transformer) {\n dataSource = new PipeDataSource(dataSource, map(settings.transformer));\n }\n\n component.setDataSource(name, dataSource, useDataSourceValue.settings);\n\n }\n\n }\n\n private setComponentProperties(formDefinition: FormDefinition, component: any) {\n const componentProperties = this.extractComponentProperties(formDefinition);\n\n for (const [ key, value ] of Object.entries(componentProperties)) {\n Reflect.set(component, key, value);\n }\n\n }\n\n private createComponent(formDefinition: FormDefinition): ComponentRef<ControlValueAccessor> {\n const component = this.extractComponent(formDefinition);\n const componentFactory = this.cfr.resolveComponentFactory(component);\n return componentFactory.create(this.injector);\n }\n\n private extractControl(): RxapFormControl {\n if (!this.parent.control) {\n throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');\n }\n\n const control = this.parent.control.get(this.controlId);\n\n if (!control) {\n throw new RxapFormSystemError('Could not find the control instance', '');\n }\n\n if (!(control instanceof RxapFormControl)) {\n throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');\n }\n\n return control;\n }\n\n private extractFormDefinition(): FormDefinition {\n const formDefinition = (this.control as any).rxapFormDefinition;\n\n if (!formDefinition) {\n throw new RxapFormSystemError('Could not find the form definition instance', '');\n }\n\n return formDefinition;\n }\n\n private extractComponent(formDefinition: FormDefinition): Constructor<ControlValueAccessor> {\n const map = getMetadata<Map<string, Constructor<ControlValueAccessor>>>(FormSystemMetadataKeys.COMPONENTS, Object.getPrototypeOf(formDefinition));\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use component map from the form definition instance', '');\n }\n\n if (!map.has(this.controlId)) {\n throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');\n }\n\n return map.get(this.controlId)!;\n }\n\n private extractComponentProperties(formDefinition: FormDefinition): Record<string, any> {\n const map = getMetadata<Map<string, Record<string, any>>>(FormSystemMetadataKeys.COMPONENTS_PROPERTIES, Object.getPrototypeOf(formDefinition));\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use component properties map from the form definition instance', '');\n }\n\n if (!map.has(this.controlId)) {\n throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');\n }\n\n return map.get(this.controlId)!;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { FormSystemControlDirective } from './form-system-control.directive';\n\n\n@NgModule({\n declarations: [ FormSystemControlDirective ],\n exports: [ FormSystemControlDirective ],\n imports: []\n})\nexport class FormSystemModule {}\n","import {\n BaseDataSource,\n BaseDataSourceMetadata,\n RXAP_DATA_SOURCE_METADATA,\n} from '@rxap/data-source';\nimport {\n Injectable,\n Inject,\n InjectionToken,\n Optional,\n isDevMode\n} from '@angular/core';\nimport { AbstractControl } from '@rxap/forms';\nimport { startWith, shareReplay, distinctUntilChanged } from 'rxjs/operators';\nimport { equals } from '@rxap/utilities';\n\nexport const RXAP_FORM_CONTROL_SOURCE = new InjectionToken(\n 'rxap/forms/data-source'\n);\n\n@Injectable()\nexport class ControlDataSource extends BaseDataSource {\n constructor(\n @Inject(RXAP_FORM_CONTROL_SOURCE)\n private readonly control: AbstractControl,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: BaseDataSourceMetadata | null = null\n ) {\n super(metadata);\n }\n\n public init() {\n if (this._initialised) {\n return;\n }\n super.init();\n\n if (isDevMode()) {\n console.log(this.control);\n }\n\n this._data$ = this.control.valueChanges.pipe(\n startWith(this.control.value),\n distinctUntilChanged((a, b) => equals(a, b)),\n shareReplay(1)\n );\n }\n}\n\nexport function controlDataSource(control: AbstractControl): ControlDataSource {\n // TODO : remove as any (wait for @rxap/forms update)\n return new ControlDataSource(control, { id: (control as any).controlId });\n}\n","import { ControlContainer } from '@angular/forms';\nimport {\n RxapFormControl,\n AbstractControl,\n RxapFormGroup,\n RxapFormArray,\n} from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\n\nexport class ExtractControlMixin {\n\n protected extractControl(parent: ControlContainer, controlPath: string): AbstractControl {\n if (!controlPath) {\n throw new RxapFormSystemError('The control path is empty', '');\n }\n\n if (!parent.control) {\n throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');\n }\n\n const control = parent.control.get(controlPath);\n\n if (!control) {\n throw new RxapFormSystemError('Could not find the control instance', '');\n }\n\n if (!(control instanceof RxapFormControl) && !(control instanceof RxapFormGroup) && !(control instanceof RxapFormArray)) {\n throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');\n }\n\n return control;\n }\n\n}\n","import {\n FormDefinition,\n AbstractControl,\n} from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\n\nexport class ExtractFormDefinitionMixin {\n\n // TODO : change to AbstractControl from @rxap/forms\n protected extractFormDefinition(control: AbstractControl): FormDefinition {\n const formDefinition = control.rxapFormDefinition;\n\n if (!formDefinition) {\n throw new RxapFormSystemError('Could not find the form definition instance', '');\n }\n\n return formDefinition;\n }\n\n}\n","import { Constructor } from '@rxap/utilities';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { setMetadataMap } from '@rxap/utilities/reflect-metadata';\n\nexport function UseComponent<Component extends ControlValueAccessor>(\n component: Constructor<Component>,\n setProperties: Partial<Record<keyof Component, any>> = {}\n) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);\n setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);\n };\n}\n","import { BaseDataSource } from '@rxap/data-source';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\nimport { setMetadataMapMap } from '@rxap/utilities/reflect-metadata';\n\nexport interface UseDataSourceSettings<Source = any, Target = any> {\n transformer: (source: Source) => Target;\n}\n\nexport interface UseDataSourceValue<Source = any, Target = any> {\n dataSource: IdOrInstanceOrToken<BaseDataSource>,\n settings?: UseDataSourceSettings<Source, Target>,\n}\n\nexport function UseDataSource<Data>(dataSource: IdOrInstanceOrToken<BaseDataSource<Data>>, name: string, settings?: UseDataSourceSettings) {\n return function(target: any, propertyKey: string) {\n const value: UseDataSourceValue<Data> = { dataSource, settings };\n setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);\n };\n}\n","import { Constructor } from '@rxap/utilities';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { setMetadata } from '@rxap/utilities/reflect-metadata';\n\n/**\n * Links a component with a form definition\n *\n * @param component\n */\nexport function UseFormComponent(component: Constructor) {\n return function (target: any) {\n setMetadata(FormSystemMetadataKeys.FORM_COMPONENT, component, target);\n };\n}\n","import {\n Directive,\n Input,\n Inject,\n OnInit,\n Renderer2,\n ElementRef,\n OnDestroy,\n NgModule,\n Optional,\n Self\n} from '@angular/core';\nimport {\n FormDefinition,\n AbstractControl,\n RxapFormControl\n} from '@rxap/forms';\nimport {\n ControlContainer,\n NgControl\n} from '@angular/forms';\nimport { Mixin } from '@rxap/mixin';\nimport {\n Subscription,\n of\n} from 'rxjs';\nimport {\n tap,\n startWith,\n catchError\n} from 'rxjs/operators';\nimport { ExtractControlMixin } from '../mixins/extract-control.mixin';\nimport { ExtractFormDefinitionMixin } from '../mixins/extract-form-definition.mixin';\nimport {\n setMetadataMap,\n getMetadata\n} from '@rxap/utilities/reflect-metadata';\n\nexport const RXAP_FORM_SYSTEM_SHOW_METADATA = 'rxap/form-system/show-function';\nexport const RXAP_FORM_SYSTEM_HIDE_METADATA = 'rxap/form-system/hide-function';\nexport const RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS = 'rxap/form-system/hide-show-options';\n\nexport type ControlHideShowFunction<T = any> = (this: T, control: AbstractControl) => boolean | null;\n\nexport interface ControlHideShowOptions {\n /**\n * Weather the hide/showFunction should be called on root group changes\n */\n rootChange?: boolean;\n}\n\nexport function UseHideFunction(hideFunction: ControlHideShowFunction, options: ControlHideShowOptions = {}) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, hideFunction, RXAP_FORM_SYSTEM_HIDE_METADATA, target);\n if (Object.keys(options).length) {\n setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);\n }\n };\n}\n\nexport function UseShowFunction(showFunction: ControlHideShowFunction, options: ControlHideShowOptions = {}) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, showFunction, RXAP_FORM_SYSTEM_SHOW_METADATA, target);\n if (Object.keys(options).length) {\n setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);\n }\n };\n}\n\nexport interface ControlHideShowDirective extends ExtractControlMixin,\n ExtractFormDefinitionMixin {}\n\n@Mixin(ExtractControlMixin, ExtractFormDefinitionMixin)\n@Directive({\n selector: '[rxapControlHideShow]'\n})\nexport class ControlHideShowDirective implements OnInit, OnDestroy {\n\n @Input('rxapControlHideShow')\n public controlId?: string;\n\n public control!: RxapFormControl;\n\n private subscription = new Subscription();\n\n constructor(\n @Inject(Renderer2)\n private readonly renderer: Renderer2,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef,\n @Optional()\n @Inject(ControlContainer)\n private readonly parent: ControlContainer | null,\n @Self()\n @Optional()\n @Inject(NgControl)\n private readonly ngControl: NgControl | null\n ) { }\n\n public ngOnInit() {\n\n if (!this.ngControl && !this.parent) {\n throw new Error('Easier the ControlContainer or NgControl must be injectable');\n }\n\n if (!this.ngControl && !this.controlId) {\n throw new Error('If the NgControl is not injectable then the control id must be defined!');\n }\n\n const control = this.ngControl?.control ?? this.extractControl(this.parent!, this.controlId!);\n\n if (!(control instanceof RxapFormControl)) {\n throw new Error('The control is not an instance of RxapFormControl');\n }\n\n this.control = control;\n\n const formDefinition = this.extractFormDefinition(control);\n\n const hideFunction = this.extractHideFunction(formDefinition);\n\n const showFunction = this.extractShowFunction(formDefinition);\n\n const options = this.extractOptions(formDefinition);\n\n let changeTrigger = formDefinition.rxapFormGroup.valueChanges;\n\n if (options.rootChange) {\n changeTrigger = formDefinition.rxapFormGroup.root.valueChanges;\n }\n\n changeTrigger = changeTrigger.pipe(startWith(null));\n\n if (showFunction) {\n this.subscription.add(\n changeTrigger.pipe(\n tap(() => {\n // TODO : resubscribe if the showFunction throws an error\n const show = showFunction.call(formDefinition, control);\n\n switch (show) {\n\n case true:\n this.show();\n break;\n\n case false:\n this.hide();\n break;\n\n case null:\n this.reset();\n break;\n\n }\n\n }),\n catchError(err => {\n console.error(err);\n return of(null);\n }),\n ).subscribe(),\n );\n }\n\n if (hideFunction) {\n this.subscription.add(\n changeTrigger.pipe(\n tap(() => {\n // TODO : resubscribe if the hideFunction throws an error\n const hide = hideFunction.call(formDefinition, control);\n\n switch (hide) {\n\n case true:\n this.hide();\n break;\n\n case false:\n this.show();\n break;\n\n case null:\n this.reset();\n break;\n\n }\n\n }),\n catchError(err => {\n console.error(err);\n return of(null);\n }),\n ).subscribe(),\n );\n }\n\n }\n\n public ngOnDestroy() {\n this.subscription.unsubscribe();\n }\n\n private extractOptions(formDefinition: FormDefinition): ControlHideShowOptions {\n const map = getMetadata<Map<string, ControlHideShowOptions>>(RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return {};\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private extractHideFunction(formDefinition: FormDefinition): ControlHideShowFunction | null {\n const map = getMetadata<Map<string, ControlHideShowFunction>>(RXAP_FORM_SYSTEM_HIDE_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return null;\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private extractShowFunction(formDefinition: FormDefinition): ControlHideShowFunction | null {\n const map = getMetadata<Map<string, ControlHideShowFunction>>(RXAP_FORM_SYSTEM_SHOW_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return null;\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private hide() {\n this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');\n }\n\n private show() {\n this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'block');\n }\n\n private reset() {\n this.renderer.removeStyle(this.elementRef.nativeElement, 'display');\n }\n\n\n}\n\n@NgModule({\n declarations: [ ControlHideShowDirective ],\n exports: [ ControlHideShowDirective ]\n})\nexport class ControlHideShowDirectiveModule {}\n","import {\n Directive,\n TemplateRef,\n OnInit,\n Inject,\n ViewContainerRef,\n Input,\n OnDestroy,\n Injector,\n INJECTOR,\n Optional,\n ChangeDetectorRef,\n NgModule,\n isDevMode,\n AfterViewInit\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport {\n DataSourceLoader,\n BaseDataSource,\n BaseDataSourceViewer,\n BaseDataSourceMetadata,\n PipeDataSource\n} from '@rxap/data-source';\nimport { RxapFormControl } from '@rxap/forms';\nimport {\n ControlOptions,\n ControlOption,\n Required\n} from '@rxap/utilities';\nimport { Mixin } from '@rxap/mixin';\nimport {\n Subscription,\n of\n} from 'rxjs';\nimport {\n tap,\n map,\n switchMap\n} from 'rxjs/operators';\nimport { ExtractDataSourcesMixin } from '../mixins/extract-data-sources.mixin';\nimport { ExtractFormDefinitionMixin } from '../mixins/extract-form-definition.mixin';\nimport {\n UseDataSource,\n UseDataSourceSettings\n} from '../decorators/use-data-source';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\nimport {\n MAT_FORM_FIELD,\n MatFormField\n} from '@angular/material/form-field';\nimport { MatAutocomplete } from '@angular/material/autocomplete';\n\nexport interface InputSelectOptionsTemplateContext {\n $implicit: ControlOption;\n}\n\nexport interface InputSelectOptionsSettings<Source> extends UseDataSourceSettings<Source, ControlOptions | Record<string, any>> {\n /**\n * true - the selected value is not send to the data source with the viewChange event.\n * Instead an empty object {} is send to trigger a data source refresh.\n *\n * The OpenApiDataSource expects a Paramters Object in the viewChange event. This\n * can couse issue if the select value object as a property that is also a parameter for\n * the open-api operation. For instaed the select object has the property company and\n * the open-api operation has a query parameter company. Then the BuildOptions method\n * in the OpenApiDataSource would create a HttpParams object with the param company and the\n * value from the select object property company. This will result in unpredictable behaviors.\n */\n ignoreSelectedValue?: boolean;\n\n /**\n * true - the options list is filtered by the current control value if the\n * control value is of type string. Then the display value of each option is\n * compared to the control value. If the display value of an option includes\n * the control value, then the option is used. This comprehensions it not type\n * sensitive\n */\n filteredOptions?: boolean;\n}\n\n\nexport const DATA_SOURCE_NAME = 'options';\n\nexport function ComposeOptionsTransformers(...fnc: Array<(value: any) => any>): (value: any) => any {\n return base => fnc.reduce((source, transform) => transform(source), base);\n}\n\n// tslint:disable-next-line:max-line-length\nexport function UseOptionsDataSource<Source>(\n dataSource: IdOrInstanceOrToken<BaseDataSource<Source>>,\n settings?: InputSelectOptionsSettings<Source>\n): (\n target: any,\n propertyKey: string\n) => any;\nexport function UseOptionsDataSource(\n dataSource: IdOrInstanceOrToken<BaseDataSource>,\n settings?: InputSelectOptionsSettings<ControlOptions>\n) {\n return function(target: any, propertyKey: string) {\n UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);\n };\n}\n\nexport interface InputSelectOptionsDirective extends OnInit,\n ExtractFormDefinitionMixin,\n ExtractDataSourcesMixin {}\n\n@Mixin(ExtractFormDefinitionMixin, ExtractDataSourcesMixin)\n@Directive({\n selector: '[rxapInputSelectOptions]'\n})\nexport class InputSelectOptionsDirective implements OnDestroy, AfterViewInit {\n\n @Input('rxapInputSelectOptionsViewer')\n public viewer: BaseDataSourceViewer = { id: '[rxapInputSelectOptions]' };\n\n @Input('rxapInputSelectOptionsMetadata')\n public metadata?: BaseDataSourceMetadata;\n\n @Input('rxapInputSelectOptionsMatAutocomplete')\n public matAutocomplete?: MatAutocomplete;\n\n protected readonly subscription = new Subscription();\n\n @Required\n protected control!: RxapFormControl;\n\n @Required\n protected dataSource!: BaseDataSource<ControlOptions | Record<string, any>>;\n\n protected options: ControlOptions | Record<string, any> | null = null;\n\n protected settings!: InputSelectOptionsSettings<any>;\n\n constructor(\n @Inject(TemplateRef)\n protected readonly template: TemplateRef<InputSelectOptionsTemplateContext>,\n @Inject(DataSourceLoader)\n protected readonly dataSourceLoader: DataSourceLoader,\n @Inject(ViewContainerRef)\n protected readonly viewContainerRef: ViewContainerRef,\n @Inject(INJECTOR)\n protected readonly injector: Injector,\n @Inject(ChangeDetectorRef)\n protected readonly cdr: ChangeDetectorRef,\n // The ngControl could be unknown on construction\n // bc it is available after the content is init\n @Optional()\n @Inject(NgControl)\n protected ngControl: NgControl | null = null,\n @Optional()\n @Inject(MAT_FORM_FIELD)\n protected matFormField: MatFormField | null = null,\n ) { }\n\n public ngAfterViewInit() {\n this.extractControl();\n this.extractDatasource();\n this.viewer = {\n id: '[rxapInputSelectOptions]' + this.control.controlId,\n viewChange: this.control.value$.pipe(\n map(value => {\n if (this.settings?.ignoreSelectedValue) {\n return {}\n }\n return value;\n })\n ),\n control: this.control,\n }\n if (this.matAutocomplete) {\n this.matAutocomplete.displayWith = this.toDisplay.bind(this);\n this.settings.filteredOptions ??= true;\n }\n this.loadOptions();\n }\n\n protected extractDatasource(control: RxapFormControl = this.control): BaseDataSource<ControlOptions | Record<string, any>> {\n const formDefinition = this.extractFormDefinition(control);\n\n const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);\n\n if (!useDataSourceValueMap.has(DATA_SOURCE_NAME)) {\n throw new Error(`The data source with the name 'options' is not defined`);\n }\n\n const useDataSourceValue = useDataSourceValueMap.get(DATA_SOURCE_NAME)!;\n\n this.settings = useDataSourceValue.settings as any;\n\n let dataSource: BaseDataSource;\n\n try {\n\n dataSource = this.dataSourceLoader.load(\n useDataSourceValue.dataSource,\n this.metadata,\n this.injector\n );\n\n } catch (e: any) {\n\n if (e.name && e.name === 'NullInjectorError') {\n if (isDevMode()) {\n console.error('Cloud not inject the options data source', useDataSourceValue);\n }\n throw new Error('Cloud not inject the options data source:\\n' + e.message);\n }\n\n throw e;\n\n }\n\n const settings = useDataSourceValue.settings;\n\n if (settings?.transformer) {\n dataSource = new PipeDataSource(dataSource, map(settings.transformer));\n }\n\n return this.dataSource = dataSource;\n }\n\n public toDisplay(value: any): string {\n if (!value) {\n return '';\n }\n return this.options?.find((option: any) => option.value === value)?.display ?? (isDevMode() ? 'to display error' : '');\n }\n\n protected extractControl(ngControl: NgControl | null = this.ngControl ?? this.matFormField?._control?.ngControl ?? null): RxapFormControl {\n\n if (!ngControl) {\n throw new Error('The ngControl is not defined!');\n }\n\n this.ngControl = ngControl;\n\n const control = this.ngControl.control;\n\n if (!(control instanceof RxapFormControl)) {\n throw new Error('Control is not a RxapFormControl!');\n }\n\n return this.control = control;\n }\n\n public ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n\n private loadOptions(dataSource: BaseDataSource<ControlOptions | Record<string, any>> = this.dataSource) {\n this.subscription.add(dataSource.connect(this.viewer).pipe(\n switchMap(options => {\n if (this.settings.filteredOptions) {\n return this.control.value$.pipe(\n map(controlValue => {\n if (typeof controlValue === 'string' && controlValue) {\n controlValue = controlValue.toLowerCase();\n if (Array.isArray(options)) {\n return options.filter(option => option.display.toLowerCase().includes(controlValue))\n } else {\n return Object.entries(options)\n .filter(([value, display]) => typeof display === 'string' && display.toLowerCase().includes(controlValue))\n .map(([value, display]) => ({ value, display }))\n }\n }\n return options;\n })\n );\n }\n return of(options);\n }),\n tap(options => this.renderTemplate(this.options = options))\n ).subscribe());\n }\n\n protected renderTemplate(options: ControlOptions | Record<string, any> | null = this.options) {\n this.viewContainerRef.clear();\n\n if (options) {\n if (!Array.isArray(options)) {\n\n for (const [ value, display ] of Object.entries(options)) {\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: { value, display } });\n }\n\n } else {\n\n for (const option of options) {\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });\n }\n\n }\n } else {\n if (isDevMode()) {\n console.warn(`The options for the control ${this.control.fullControlPath} is empty/null/undefined!`);\n }\n }\n\n this.cdr.detectChanges();\n }\n\n}\n\n@NgModule({\n declarations: [ InputSelectOptionsDirective ],\n exports: [ InputSelectOptionsDirective ]\n})\nexport class InputSelectOptionsDirectiveModule {}\n","import { NgModule } from '@angular/core';\nimport { InputSelectOptionsDirectiveModule } from './input-select-options.directive';\nimport { ControlHideShowDirectiveModule } from './control-hide-show.directive';\n\n@NgModule({\n exports: [\n InputSelectOptionsDirectiveModule,\n ControlHideShowDirectiveModule\n ]\n})\nexport class FormSystemDirectivesModule {}\n","import {\n Directive,\n forwardRef,\n Input,\n NgModule\n} from '@angular/core';\nimport {\n AbstractControl,\n NG_VALIDATORS,\n ValidationErrors,\n Validator\n} from '@angular/forms';\nimport { Required } from '@rxap/utilities';\n\n@Directive({\n selector: '[rxapIsEqualTo]',\n providers: [\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: forwardRef(() => IsEqualToDirective)\n }\n ]\n})\nexport class IsEqualToDirective implements Validator {\n\n @Input('rxapIsEqualTo')\n @Required\n public set equalTo(value: any) {\n this._equalTo = value;\n if (this._onChange) {\n this._onChange();\n }\n }\n\n private _onChange!: () => void;\n\n\n private _equalTo!: any;\n\n public validate(control: AbstractControl): ValidationErrors | null {\n if (this._equalTo === null || this._equalTo === control.value) {\n return null;\n }\n return { isEqualTo: { value: this._equalTo, actualValue: control.value } };\n }\n\n /**\n * @description\n * Registers a callback function to call when the validator inputs change.\n *\n * @param fn The callback function\n */\n public registerOnValidatorChange(fn: () => void): void {\n this._onChange = fn;\n }\n\n}\n\n@NgModule({\n declarations: [ IsEqualToDirective ],\n exports: [ IsEqualToDirective ]\n})\nexport class IsEqualToDirectiveModule {\n}\n","export * from './lib/form-system.module';\n\nexport * from './lib/error';\nexport * from './lib/control-data-source';\n\n// region mixin\n\nexport * from './lib/mixins/extract-data-sources.mixin';\nexport * from './lib/mixins/extract-control.mixin';\nexport * from './lib/mixins/extract-form-definition.mixin';\n\n// endregion\n\n// region components\n\nexport * from './lib/form-system-control.directive';\n\n\n// endregion\n\n// region decorators\n\nexport * from './lib/decorators/metadata-keys';\nexport * from './lib/decorators/use-component';\nexport * from './lib/decorators/use-data-source';\nexport * from './lib/decorators/use-form-component';\n\n// endregion\n\n// region directives\n\nexport * from './lib/directives/control-hide-show.directive';\nexport * from './lib/directives/form-directives.module';\nexport * from './lib/directives/input-select-options.directive';\n\n// endregion\n\n// region validators\n\nexport * from './lib/validators/is-equal-to';\n\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;MAEa,mBAAoB,SAAQ,SAAS;IAEhD,YAAY,OAAe,EAAE,IAAY,EAAE,SAAkB;QAC3D,KAAK,CAAC,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;KACtD;;;ICNS;AAAZ,WAAY,sBAAsB;IAChC,oEAAqD,CAAA;IACrD,wEAAuD,CAAA;IACvD,0FAAgE,CAAA;IAChE,mFAAyD,CAAA;AAC3D,CAAC,EALW,sBAAsB,KAAtB,sBAAsB;;MCMrB,uBAAuB;IAExB,kBAAkB,CAAC,cAA8B,EAAE,SAAiB;QAC5E,MAAM,GAAG,GAAG,WAAW,CACrB,sBAAs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AAS,GAAG,EAAE,CAAC;KACrB;;+GA/BU,kBAAkB;mGAAlB,kBAAkB,6FARlB;QACT;YACE,OAAO,EAAM,aAAa;YAC1B,KAAK,EAAQ,IAAI;YACjB,WAAW,EAAE,UAAU,CAAC,MAAM,kBAAkB,CAAC;SAClD;KACF;AAMD;IADC,QAAQ;;;iDAMR;2FATU,kBAAkB;kBAV9B,SAAS;mBAAC;oBACT,QAAQ,EAAG,iBAAiB;oBAC5B,SAAS,EAAE;wBACT;4BACE,OAAO,EAAM,aAAa;4BAC1B,KAAK,EAAQ,IAAI;4BACjB,WAAW,EAAE,UAAU,CAAC,wBAAwB,CAAC;yBAClD;qBACF;iBACF;8BAKY,OAAO;sBAFjB,KAAK;uBAAC,eAAe;;MAqCX,wBAAwB;;qHAAxB,wBAAwB;sHAAxB,wBAAwB,iBAvCxB,kBAAkB,aAAlB,kBAAkB;sHAuClB,wBAAwB;2FAAxB,wBAAwB;kBAJpC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAE,kBAAkB,CAAE;oBACpC,OAAO,EAAO,CAAE,kBAAkB,CAAE;iBACrC;;;ACrBD;;ACzCA;;;;;;"}
1
+ {"version":3,"file":"rxap-form-system.mjs","sources":["../../../../libs/form-system/src/lib/error.ts","../../../../libs/form-system/src/lib/decorators/metadata-keys.ts","../../../../libs/form-system/src/lib/mixins/extract-data-sources.mixin.ts","../../../../libs/form-system/src/lib/form-system-control.directive.ts","../../../../libs/form-system/src/lib/form-system.module.ts","../../../../libs/form-system/src/lib/control-data-source.ts","../../../../libs/form-system/src/lib/mixins/extract-control-from-parent.mixin.ts","../../../../libs/form-system/src/lib/mixins/extract-form-definition.mixin.ts","../../../../libs/form-system/src/lib/decorators/use-data-source.ts","../../../../libs/form-system/src/lib/mixins/extract-control.mixin.ts","../../../../libs/form-system/src/lib/mixins/extract-options-data-source.mixin.ts","../../../../libs/form-system/src/lib/decorators/use-component.ts","../../../../libs/form-system/src/lib/decorators/use-form-component.ts","../../../../libs/form-system/src/lib/directives/control-hide-show.directive.ts","../../../../libs/form-system/src/lib/directives/input-select-options.directive.ts","../../../../libs/form-system/src/lib/directives/form-directives.module.ts","../../../../libs/form-system/src/lib/validators/is-equal-to.ts","../../../../libs/form-system/src/index.ts","../../../../libs/form-system/src/rxap-form-system.ts"],"sourcesContent":["import { RxapError } from '@rxap/utilities';\n\nexport class RxapFormSystemError extends RxapError {\n\n constructor(message: string, code: string, className?: string) {\n super('@rxap/form-system', message, code, className);\n }\n\n}\n","export enum FormSystemMetadataKeys {\n COMPONENTS = 'rxap/form-system/components',\n DATA_SOURCES = 'rxap/form-system/data-sources',\n COMPONENTS_PROPERTIES = 'rxap/form-system/components-properties',\n FORM_COMPONENT = 'rxap/window-form-system/form-component',\n}\n","import { FormDefinition } from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\nimport { FormSystemMetadataKeys } from '../decorators/metadata-keys';\nimport { UseDataSourceValue } from '../decorators/use-data-source';\nimport { getMetadata } from '@rxap/utilities/reflect-metadata';\n\nexport class ExtractDataSourcesMixin {\n\n protected extractDataSources(formDefinition: FormDefinition, controlId: string): Map<string, UseDataSourceValue> {\n const map = getMetadata<Map<string, Map<string, UseDataSourceValue>>>(\n FormSystemMetadataKeys.DATA_SOURCES,\n Object.getPrototypeOf(formDefinition)\n );\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use data source map from the form definition instance', '');\n }\n\n if (!map.has(controlId)) {\n throw new RxapFormSystemError('A use data source definition does not exists in the form definition metadata', '');\n }\n\n return map.get(controlId)!;\n }\n\n}\n","import {\n Input,\n Inject,\n OnInit,\n ComponentFactoryResolver,\n ViewContainerRef,\n Directive,\n ComponentRef,\n INJECTOR,\n Injector\n} from '@angular/core';\nimport {\n Required,\n Constructor\n} from '@rxap/utilities';\nimport {\n ControlContainer,\n ControlValueAccessor\n} from '@angular/forms';\nimport { RxapFormSystemError } from './error';\nimport {\n RxapFormControl,\n FormDefinition\n} from '@rxap/forms';\nimport { FormSystemMetadataKeys } from './decorators/metadata-keys';\nimport { ControlWithDataSource } from './control-with-data-source';\nimport {\n DataSourceLoader,\n PipeDataSource\n} from '@rxap/data-source';\nimport { Mixin } from '@rxap/mixin';\nimport { ExtractDataSourcesMixin } from './mixins/extract-data-sources.mixin';\nimport { map } from 'rxjs/operators';\nimport { getMetadata } from '@rxap/utilities/reflect-metadata';\n\nexport interface FormSystemControlDirective<T> extends ExtractDataSourcesMixin, ControlValueAccessor, OnInit {}\n\n@Mixin(ExtractDataSourcesMixin)\n@Directive({\n selector: '[rxapFormSystemControl]'\n})\nexport class FormSystemControlDirective<T> implements ControlValueAccessor, OnInit {\n\n /**\n * Defines the form control id\n */\n @Input()\n @Required\n public controlId!: string;\n\n @Required\n protected control!: RxapFormControl;\n\n @Required\n protected componentRef!: ComponentRef<ControlValueAccessor & Partial<ControlWithDataSource>>;\n\n constructor(\n @Inject(ControlContainer)\n private readonly parent: ControlContainer,\n @Inject(ComponentFactoryResolver)\n private readonly cfr: ComponentFactoryResolver,\n @Inject(ViewContainerRef)\n private readonly viewContainerRef: ViewContainerRef,\n @Inject(DataSourceLoader)\n private readonly dataSourceLoader: DataSourceLoader,\n @Inject(INJECTOR)\n private readonly injector: Injector\n ) {}\n\n public ngOnInit() {\n\n this.control = this.extractControl();\n\n const formDefinition = this.extractFormDefinition();\n\n this.componentRef = this.createComponent(formDefinition);\n\n this.setDataSources(formDefinition, this.componentRef.instance);\n this.setComponentProperties(formDefinition, this.componentRef.instance);\n\n this.viewContainerRef.insert(this.componentRef.hostView);\n\n }\n\n public registerOnChange(fn: (value: (any | null)) => void): void {\n this.componentRef.instance.registerOnChange(fn);\n }\n\n public registerOnTouched(fn: () => void): void {\n this.componentRef.instance.registerOnTouched(fn);\n }\n\n public writeValue(value: any): void {\n this.componentRef.instance.writeValue(value);\n }\n\n public setDisabledState(isDisabled: boolean): void {\n if (this.componentRef.instance.setDisabledState) {\n this.componentRef.instance.setDisabledState(isDisabled);\n }\n }\n\n private setDataSources(formDefinition: FormDefinition, component: Partial<ControlWithDataSource>): void {\n\n if (!component.setDataSource) {\n throw new RxapFormSystemError(\n 'The ControlWithDataSource interface is not implemented for the control component, but the control has defined data sources',\n ''\n );\n }\n\n const useDataSourceValueMap = this.extractDataSources(formDefinition, this.controlId);\n\n for (const [ name, useDataSourceValue ] of useDataSourceValueMap.entries()) {\n\n let dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource);\n\n const settings = useDataSourceValue.settings;\n\n if (settings?.transformer) {\n dataSource = new PipeDataSource(dataSource, map(settings.transformer));\n }\n\n component.setDataSource(name, dataSource, useDataSourceValue.settings);\n\n }\n\n }\n\n private setComponentProperties(formDefinition: FormDefinition, component: any) {\n const componentProperties = this.extractComponentProperties(formDefinition);\n\n for (const [ key, value ] of Object.entries(componentProperties)) {\n Reflect.set(component, key, value);\n }\n\n }\n\n private createComponent(formDefinition: FormDefinition): ComponentRef<ControlValueAccessor> {\n const component = this.extractComponent(formDefinition);\n const componentFactory = this.cfr.resolveComponentFactory(component);\n return componentFactory.create(this.injector);\n }\n\n private extractControl(): RxapFormControl {\n if (!this.parent.control) {\n throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');\n }\n\n const control = this.parent.control.get(this.controlId);\n\n if (!control) {\n throw new RxapFormSystemError('Could not find the control instance', '');\n }\n\n if (!(control instanceof RxapFormControl)) {\n throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');\n }\n\n return control;\n }\n\n private extractFormDefinition(): FormDefinition {\n const formDefinition = (this.control as any).rxapFormDefinition;\n\n if (!formDefinition) {\n throw new RxapFormSystemError('Could not find the form definition instance', '');\n }\n\n return formDefinition;\n }\n\n private extractComponent(formDefinition: FormDefinition): Constructor<ControlValueAccessor> {\n const map = getMetadata<Map<string, Constructor<ControlValueAccessor>>>(FormSystemMetadataKeys.COMPONENTS, Object.getPrototypeOf(formDefinition));\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use component map from the form definition instance', '');\n }\n\n if (!map.has(this.controlId)) {\n throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');\n }\n\n return map.get(this.controlId)!;\n }\n\n private extractComponentProperties(formDefinition: FormDefinition): Record<string, any> {\n const map = getMetadata<Map<string, Record<string, any>>>(FormSystemMetadataKeys.COMPONENTS_PROPERTIES, Object.getPrototypeOf(formDefinition));\n\n if (!map) {\n throw new RxapFormSystemError('Could not extract the use component properties map from the form definition instance', '');\n }\n\n if (!map.has(this.controlId)) {\n throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');\n }\n\n return map.get(this.controlId)!;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { FormSystemControlDirective } from './form-system-control.directive';\n\n\n@NgModule({\n declarations: [ FormSystemControlDirective ],\n exports: [ FormSystemControlDirective ],\n imports: []\n})\nexport class FormSystemModule {}\n","import {\n BaseDataSource,\n BaseDataSourceMetadata,\n RXAP_DATA_SOURCE_METADATA,\n} from '@rxap/data-source';\nimport {\n Injectable,\n Inject,\n InjectionToken,\n Optional,\n isDevMode\n} from '@angular/core';\nimport { AbstractControl } from '@rxap/forms';\nimport { startWith, shareReplay, distinctUntilChanged } from 'rxjs/operators';\nimport { equals } from '@rxap/utilities';\n\nexport const RXAP_FORM_CONTROL_SOURCE = new InjectionToken(\n 'rxap/forms/data-source'\n);\n\n@Injectable()\nexport class ControlDataSource extends BaseDataSource {\n constructor(\n @Inject(RXAP_FORM_CONTROL_SOURCE)\n private readonly control: AbstractControl,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: BaseDataSourceMetadata | null = null\n ) {\n super(metadata);\n }\n\n public init() {\n if (this._initialised) {\n return;\n }\n super.init();\n\n if (isDevMode()) {\n console.log(this.control);\n }\n\n this._data$ = this.control.valueChanges.pipe(\n startWith(this.control.value),\n distinctUntilChanged((a, b) => equals(a, b)),\n shareReplay(1)\n );\n }\n}\n\nexport function controlDataSource(control: AbstractControl): ControlDataSource {\n // TODO : remove as any (wait for @rxap/forms update)\n return new ControlDataSource(control, { id: (control as any).controlId });\n}\n","import { ControlContainer } from '@angular/forms';\nimport {\n RxapFormControl,\n AbstractControl,\n RxapFormGroup,\n RxapFormArray,\n} from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\n\nexport class ExtractControlFromParentMixin {\n\n protected extractControlFromParent(parent: ControlContainer, controlPath: string): AbstractControl {\n if (!controlPath) {\n throw new RxapFormSystemError('The control path is empty', '');\n }\n\n if (!parent.control) {\n throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');\n }\n\n const control = parent.control.get(controlPath);\n\n if (!control) {\n throw new RxapFormSystemError('Could not find the control instance', '');\n }\n\n if (!(control instanceof RxapFormControl) && !(control instanceof RxapFormGroup) && !(control instanceof RxapFormArray)) {\n throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');\n }\n\n return control;\n }\n\n}\n","import {\n FormDefinition,\n AbstractControl,\n} from '@rxap/forms';\nimport { RxapFormSystemError } from '../error';\n\nexport class ExtractFormDefinitionMixin {\n\n // TODO : change to AbstractControl from @rxap/forms\n protected extractFormDefinition(control: AbstractControl): FormDefinition {\n const formDefinition = control.rxapFormDefinition;\n\n if (!formDefinition) {\n throw new RxapFormSystemError('Could not find the form definition instance', '');\n }\n\n return formDefinition;\n }\n\n}\n","import { BaseDataSource } from '@rxap/data-source';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\nimport { setMetadataMapMap } from '@rxap/utilities/reflect-metadata';\n\nexport interface UseDataSourceSettings<Source = any, Target = Source> {\n transformer?: (source: Source) => Target;\n}\n\nexport interface UseDataSourceValue<Source = any, Target = Source> {\n dataSource: IdOrInstanceOrToken<BaseDataSource>,\n settings?: UseDataSourceSettings<Source, Target>,\n\n /**\n * The last value of the data source\n */\n lastValue?: Target,\n}\n\nexport function UseDataSource<Data>(dataSource: IdOrInstanceOrToken<BaseDataSource<Data>>, name: string, settings?: UseDataSourceSettings) {\n return function(target: any, propertyKey: string) {\n const value: UseDataSourceValue<Data> = { dataSource, settings };\n setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);\n };\n}\n","import { NgControl } from \"@angular/forms\";\nimport { MatFormField } from '@angular/material/form-field';\nimport { RxapFormControl } from '@rxap/forms';\n\nexport class ExtractControlMixin {\n\n protected ngControl!: NgControl | null;\n\n protected readonly matFormField!: MatFormField | null;\n\n protected control?: RxapFormControl;\n\n protected extractControl(ngControl: NgControl | null = this.ngControl ?? this.matFormField?._control?.ngControl ?? null): RxapFormControl {\n\n if (!ngControl) {\n throw new Error('The ngControl is not defined!');\n }\n\n this.ngControl = ngControl;\n\n const control = this.ngControl.control;\n\n if (!(control instanceof RxapFormControl)) {\n throw new Error('Control is not a RxapFormControl!');\n }\n\n return this.control = control;\n }\n\n}\n","import { IdOrInstanceOrToken } from '@rxap/definition';\nimport {\n BaseDataSource,\n DataSourceLoader,\n BaseDataSourceMetadata,\n BaseDataSourceViewer,\n PipeDataSource\n} from '@rxap/data-source';\nimport { ControlOptions } from '@rxap/utilities';\nimport {\n UseDataSource,\n UseDataSourceSettings,\n UseDataSourceValue\n} from '../decorators/use-data-source';\nimport { InputSelectOptionsSettings } from '../directives/input-select-options.directive';\nimport { Mixin } from '@rxap/mixin';\nimport { ExtractFormDefinitionMixin } from './extract-form-definition.mixin';\nimport { ExtractDataSourcesMixin } from './extract-data-sources.mixin';\nimport { ExtractControlMixin } from './extract-control.mixin';\nimport {\n Injector,\n isDevMode\n} from '@angular/core';\nimport { AbstractControl } from '@angular/forms';\nimport { RxapFormControl } from '@rxap/forms';\nimport {\n map,\n tap\n} from 'rxjs/operators';\n\nexport interface UseOptionsDataSourceSettings<Source> extends UseDataSourceSettings<Source, ControlOptions | Record<string, any>> {\n\n}\n\nexport const DATA_SOURCE_NAME = 'options';\n\nexport function ComposeOptionsTransformers(...fnc: Array<(value: any) => any>): (value: any) => any {\n return base => fnc.reduce((source, transform) => transform(source), base);\n}\n\n// tslint:disable-next-line:max-line-length\nexport function UseOptionsDataSource<Source>(\n dataSource: IdOrInstanceOrToken<BaseDataSource<Source>>,\n settings?: InputSelectOptionsSettings<Source>\n): (\n target: any,\n propertyKey: string\n) => any;\nexport function UseOptionsDataSource(\n dataSource: IdOrInstanceOrToken<BaseDataSource>,\n settings?: InputSelectOptionsSettings<ControlOptions>\n) {\n return function(target: any, propertyKey: string) {\n UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);\n };\n}\n\nexport interface ExtractOptionsDataSourceMixin extends ExtractFormDefinitionMixin, ExtractDataSourcesMixin, ExtractControlMixin {}\n\n@Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)\nexport class ExtractOptionsDataSourceMixin {\n\n protected settings?: UseOptionsDataSourceSettings<any>;\n\n protected readonly dataSourceLoader!: DataSourceLoader;\n\n public metadata?: BaseDataSourceMetadata;\n\n public viewer?: BaseDataSourceViewer;\n\n protected dataSource?: BaseDataSource<ControlOptions | Record<string, any>>;\n\n protected readonly injector!: Injector;\n\n protected extractOptionsDatasource(control?: AbstractControl): BaseDataSource<ControlOptions | Record<string, any>> {\n control ??= this.extractControl();\n\n if (!(control instanceof RxapFormControl)) {\n throw new Error('Ensure to use a RxapFromControl');\n }\n\n const formDefinition = this.extractFormDefinition(control);\n\n const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);\n\n if (!useDataSourceValueMap.has('options')) {\n throw new Error(`The data source with the name 'options' is not defined`);\n }\n\n const useDataSourceValue: UseDataSourceValue<ControlOptions | Record<string, any>> = useDataSourceValueMap.get('options')!;\n\n this.settings = useDataSourceValue.settings ?? {};\n\n let dataSource: BaseDataSource;\n\n try {\n\n dataSource = this.dataSourceLoader.load(\n useDataSourceValue.dataSource,\n this.metadata,\n this.injector\n );\n\n } catch (e: any) {\n\n if (e.name && e.name === 'NullInjectorError') {\n if (isDevMode()) {\n console.error('Cloud not inject the options data source', useDataSourceValue);\n }\n throw new Error('Cloud not inject the options data source:\\n' + e.message);\n }\n\n throw e;\n\n }\n\n if (this.settings?.transformer) {\n dataSource = new PipeDataSource(dataSource,\n map(this.settings.transformer),\n tap(options => useDataSourceValue.lastValue = options)\n );\n } else {\n dataSource = new PipeDataSource(dataSource,\n tap(options => useDataSourceValue.lastValue = options)\n );\n }\n\n return this.dataSource = dataSource;\n }\n\n}\n","import { Constructor } from '@rxap/utilities';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { setMetadataMap } from '@rxap/utilities/reflect-metadata';\n\nexport function UseComponent<Component extends ControlValueAccessor>(\n component: Constructor<Component>,\n setProperties: Partial<Record<keyof Component, any>> = {}\n) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);\n setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);\n };\n}\n","import { Constructor } from '@rxap/utilities';\nimport { FormSystemMetadataKeys } from './metadata-keys';\nimport { setMetadata } from '@rxap/utilities/reflect-metadata';\n\n/**\n * Links a component with a form definition\n *\n * @param component\n */\nexport function UseFormComponent(component: Constructor) {\n return function (target: any) {\n setMetadata(FormSystemMetadataKeys.FORM_COMPONENT, component, target);\n };\n}\n","import {\n Directive,\n Input,\n Inject,\n OnInit,\n Renderer2,\n ElementRef,\n OnDestroy,\n NgModule,\n Optional,\n Self\n} from '@angular/core';\nimport {\n FormDefinition,\n AbstractControl,\n RxapFormControl\n} from '@rxap/forms';\nimport {\n ControlContainer,\n NgControl\n} from '@angular/forms';\nimport { Mixin } from '@rxap/mixin';\nimport {\n Subscription,\n of\n} from 'rxjs';\nimport {\n tap,\n startWith,\n catchError\n} from 'rxjs/operators';\nimport { ExtractControlFromParentMixin } from '../mixins/extract-control-from-parent.mixin';\nimport { ExtractFormDefinitionMixin } from '../mixins/extract-form-definition.mixin';\nimport {\n setMetadataMap,\n getMetadata\n} from '@rxap/utilities/reflect-metadata';\n\nexport const RXAP_FORM_SYSTEM_SHOW_METADATA = 'rxap/form-system/show-function';\nexport const RXAP_FORM_SYSTEM_HIDE_METADATA = 'rxap/form-system/hide-function';\nexport const RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS = 'rxap/form-system/hide-show-options';\n\nexport type ControlHideShowFunction<T = any> = (this: T, control: AbstractControl) => boolean | null;\n\nexport interface ControlHideShowOptions {\n /**\n * Weather the hide/showFunction should be called on root group changes\n */\n rootChange?: boolean;\n}\n\nexport function UseHideFunction(hideFunction: ControlHideShowFunction, options: ControlHideShowOptions = {}) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, hideFunction, RXAP_FORM_SYSTEM_HIDE_METADATA, target);\n if (Object.keys(options).length) {\n setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);\n }\n };\n}\n\nexport function UseShowFunction(showFunction: ControlHideShowFunction, options: ControlHideShowOptions = {}) {\n return function(target: any, propertyKey: string) {\n setMetadataMap(propertyKey, showFunction, RXAP_FORM_SYSTEM_SHOW_METADATA, target);\n if (Object.keys(options).length) {\n setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);\n }\n };\n}\n\nexport interface ControlHideShowDirective extends ExtractControlFromParentMixin,\n ExtractFormDefinitionMixin {}\n\n@Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin)\n@Directive({\n selector: '[rxapControlHideShow]'\n})\nexport class ControlHideShowDirective implements OnInit, OnDestroy {\n\n @Input('rxapControlHideShow')\n public controlId?: string;\n\n public control!: RxapFormControl;\n\n private subscription = new Subscription();\n\n constructor(\n @Inject(Renderer2)\n private readonly renderer: Renderer2,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef,\n @Optional()\n @Inject(ControlContainer)\n private readonly parent: ControlContainer | null,\n @Self()\n @Optional()\n @Inject(NgControl)\n private readonly ngControl: NgControl | null\n ) { }\n\n public ngOnInit() {\n\n if (!this.ngControl && !this.parent) {\n throw new Error('Easier the ControlContainer or NgControl must be injectable');\n }\n\n if (!this.ngControl && !this.controlId) {\n throw new Error('If the NgControl is not injectable then the control id must be defined!');\n }\n\n const control = this.ngControl?.control ?? this.extractControlFromParent(this.parent!, this.controlId!);\n\n if (!(control instanceof RxapFormControl)) {\n throw new Error('The control is not an instance of RxapFormControl');\n }\n\n this.control = control;\n\n const formDefinition = this.extractFormDefinition(control);\n\n const hideFunction = this.extractHideFunction(formDefinition);\n\n const showFunction = this.extractShowFunction(formDefinition);\n\n const options = this.extractOptions(formDefinition);\n\n let changeTrigger = formDefinition.rxapFormGroup.valueChanges;\n\n if (options.rootChange) {\n changeTrigger = formDefinition.rxapFormGroup.root.valueChanges;\n }\n\n changeTrigger = changeTrigger.pipe(startWith(null));\n\n if (showFunction) {\n this.subscription.add(\n changeTrigger.pipe(\n tap(() => {\n // TODO : resubscribe if the showFunction throws an error\n const show = showFunction.call(formDefinition, control);\n\n switch (show) {\n\n case true:\n this.show();\n break;\n\n case false:\n this.hide();\n break;\n\n case null:\n this.reset();\n break;\n\n }\n\n }),\n catchError(err => {\n console.error(err);\n return of(null);\n }),\n ).subscribe(),\n );\n }\n\n if (hideFunction) {\n this.subscription.add(\n changeTrigger.pipe(\n tap(() => {\n // TODO : resubscribe if the hideFunction throws an error\n const hide = hideFunction.call(formDefinition, control);\n\n switch (hide) {\n\n case true:\n this.hide();\n break;\n\n case false:\n this.show();\n break;\n\n case null:\n this.reset();\n break;\n\n }\n\n }),\n catchError(err => {\n console.error(err);\n return of(null);\n }),\n ).subscribe(),\n );\n }\n\n }\n\n public ngOnDestroy() {\n this.subscription.unsubscribe();\n }\n\n private extractOptions(formDefinition: FormDefinition): ControlHideShowOptions {\n const map = getMetadata<Map<string, ControlHideShowOptions>>(RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return {};\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private extractHideFunction(formDefinition: FormDefinition): ControlHideShowFunction | null {\n const map = getMetadata<Map<string, ControlHideShowFunction>>(RXAP_FORM_SYSTEM_HIDE_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return null;\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private extractShowFunction(formDefinition: FormDefinition): ControlHideShowFunction | null {\n const map = getMetadata<Map<string, ControlHideShowFunction>>(RXAP_FORM_SYSTEM_SHOW_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;\n\n if (!map || !map.has(this.control.controlId)) {\n return null;\n }\n\n return map.get(this.control.controlId)!;\n\n }\n\n private hide() {\n this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');\n }\n\n private show() {\n this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'block');\n }\n\n private reset() {\n this.renderer.removeStyle(this.elementRef.nativeElement, 'display');\n }\n\n\n}\n\n@NgModule({\n declarations: [ ControlHideShowDirective ],\n exports: [ ControlHideShowDirective ]\n})\nexport class ControlHideShowDirectiveModule {}\n","import {\n Directive,\n TemplateRef,\n Inject,\n ViewContainerRef,\n Input,\n OnDestroy,\n Injector,\n INJECTOR,\n Optional,\n ChangeDetectorRef,\n NgModule,\n isDevMode,\n AfterViewInit\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport {\n DataSourceLoader,\n BaseDataSource,\n BaseDataSourceViewer,\n BaseDataSourceMetadata,\n PipeDataSource\n} from '@rxap/data-source';\nimport { RxapFormControl } from '@rxap/forms';\nimport {\n ControlOptions,\n ControlOption,\n Required\n} from '@rxap/utilities';\nimport { Mixin } from '@rxap/mixin';\nimport {\n Subscription,\n of\n} from 'rxjs';\nimport {\n tap,\n map,\n switchMap\n} from 'rxjs/operators';\nimport { UseDataSource } from '../decorators/use-data-source';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\nimport {\n MAT_FORM_FIELD,\n MatFormField\n} from '@angular/material/form-field';\nimport { MatAutocomplete } from '@angular/material/autocomplete';\nimport {\n ExtractOptionsDataSourceMixin,\n UseOptionsDataSourceSettings\n} from '../mixins/extract-options-data-source.mixin';\n\nexport interface InputSelectOptionsTemplateContext {\n $implicit: ControlOption;\n}\n\nexport interface InputSelectOptionsSettings<Source> extends UseOptionsDataSourceSettings<Source> {\n /**\n * true - the selected value is not send to the data source with the viewChange event.\n * Instead an empty object {} is send to trigger a data source refresh.\n *\n * The OpenApiDataSource expects a Paramters Object in the viewChange event. This\n * can couse issue if the select value object as a property that is also a parameter for\n * the open-api operation. For instaed the select object has the property company and\n * the open-api operation has a query parameter company. Then the BuildOptions method\n * in the OpenApiDataSource would create a HttpParams object with the param company and the\n * value from the select object property company. This will result in unpredictable behaviors.\n */\n ignoreSelectedValue?: boolean;\n\n /**\n * true - the options list is filtered by the current control value if the\n * control value is of type string. Then the display value of each option is\n * compared to the control value. If the display value of an option includes\n * the control value, then the option is used. This comprehensions it not type\n * sensitive\n */\n filteredOptions?: boolean;\n}\n\nexport interface InputSelectOptionsDirective extends OnDestroy, AfterViewInit,\n ExtractOptionsDataSourceMixin {}\n\n@Mixin(ExtractOptionsDataSourceMixin)\n@Directive({\n selector: '[rxapInputSelectOptions]'\n})\nexport class InputSelectOptionsDirective implements OnDestroy, AfterViewInit {\n\n @Input('rxapInputSelectOptionsViewer')\n public viewer: BaseDataSourceViewer = { id: '[rxapInputSelectOptions]' };\n\n @Input('rxapInputSelectOptionsMetadata')\n public metadata?: BaseDataSourceMetadata;\n\n @Input('rxapInputSelectOptionsMatAutocomplete')\n public matAutocomplete?: MatAutocomplete;\n\n protected readonly subscription = new Subscription();\n\n @Required\n protected control!: RxapFormControl;\n\n @Required\n protected dataSource!: BaseDataSource<ControlOptions | Record<string, any>>;\n\n protected options: ControlOptions | Record<string, any> | null = null;\n\n protected settings?: InputSelectOptionsSettings<any>;\n\n constructor(\n @Inject(TemplateRef)\n protected readonly template: TemplateRef<InputSelectOptionsTemplateContext>,\n @Inject(DataSourceLoader)\n protected readonly dataSourceLoader: DataSourceLoader,\n @Inject(ViewContainerRef)\n protected readonly viewContainerRef: ViewContainerRef,\n @Inject(INJECTOR)\n protected readonly injector: Injector,\n @Inject(ChangeDetectorRef)\n protected readonly cdr: ChangeDetectorRef,\n // The ngControl could be unknown on construction\n // bc it is available after the content is init\n @Optional()\n @Inject(NgControl)\n protected ngControl: NgControl | null = null,\n @Optional()\n @Inject(MAT_FORM_FIELD)\n protected matFormField: MatFormField | null = null,\n ) { }\n\n public ngAfterViewInit() {\n this.extractOptionsDatasource();\n this.viewer = {\n id: '[rxapInputSelectOptions]' + this.control.controlId,\n viewChange: this.control.value$.pipe(\n map(value => {\n if (this.settings?.ignoreSelectedValue) {\n return {}\n }\n return value;\n })\n ),\n control: this.control,\n }\n if (this.matAutocomplete) {\n this.matAutocomplete.displayWith = this.toDisplay.bind(this);\n this.settings ??= {};\n this.settings.filteredOptions ??= true;\n }\n this.loadOptions();\n }\n\n public toDisplay(value: any): string {\n if (!value) {\n return '';\n }\n return this.options?.find((option: any) => option.value === value)?.display ?? (isDevMode() ? 'to display error' : '');\n }\n\n public ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n\n private loadOptions(dataSource: BaseDataSource<ControlOptions | Record<string, any>> = this.dataSource) {\n this.subscription.add(dataSource.connect(this.viewer).pipe(\n switchMap(options => {\n if (this.settings?.filteredOptions) {\n return this.control.value$.pipe(\n map(controlValue => {\n if (typeof controlValue === 'string' && controlValue) {\n controlValue = controlValue.toLowerCase();\n if (Array.isArray(options)) {\n return options.filter(option => option.display.toLowerCase().includes(controlValue))\n } else {\n return Object.entries(options)\n .filter(([value, display]) => typeof display === 'string' && display.toLowerCase().includes(controlValue))\n .map(([value, display]) => ({ value, display }))\n }\n }\n return options;\n })\n );\n }\n return of(options);\n }),\n tap(options => this.renderTemplate(this.options = options))\n ).subscribe());\n }\n\n protected renderTemplate(options: ControlOptions | Record<string, any> | null = this.options) {\n this.viewContainerRef.clear();\n\n if (options) {\n if (!Array.isArray(options)) {\n\n for (const [ value, display ] of Object.entries(options)) {\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: { value, display } });\n }\n\n } else {\n\n for (const option of options) {\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });\n }\n\n }\n } else {\n if (isDevMode()) {\n console.warn(`The options for the control ${this.control.fullControlPath} is empty/null/undefined!`);\n }\n }\n\n this.cdr.detectChanges();\n }\n\n}\n\n@NgModule({\n declarations: [ InputSelectOptionsDirective ],\n exports: [ InputSelectOptionsDirective ]\n})\nexport class InputSelectOptionsDirectiveModule {}\n","import { NgModule } from '@angular/core';\nimport { InputSelectOptionsDirectiveModule } from './input-select-options.directive';\nimport { ControlHideShowDirectiveModule } from './control-hide-show.directive';\n\n@NgModule({\n exports: [\n InputSelectOptionsDirectiveModule,\n ControlHideShowDirectiveModule\n ]\n})\nexport class FormSystemDirectivesModule {}\n","import {\n Directive,\n forwardRef,\n Input,\n NgModule\n} from '@angular/core';\nimport {\n AbstractControl,\n NG_VALIDATORS,\n ValidationErrors,\n Validator\n} from '@angular/forms';\nimport { Required } from '@rxap/utilities';\n\n@Directive({\n selector: '[rxapIsEqualTo]',\n providers: [\n {\n provide: NG_VALIDATORS,\n multi: true,\n useExisting: forwardRef(() => IsEqualToDirective)\n }\n ]\n})\nexport class IsEqualToDirective implements Validator {\n\n @Input('rxapIsEqualTo')\n @Required\n public set equalTo(value: any) {\n this._equalTo = value;\n if (this._onChange) {\n this._onChange();\n }\n }\n\n private _onChange!: () => void;\n\n\n private _equalTo!: any;\n\n public validate(control: AbstractControl): ValidationErrors | null {\n if (this._equalTo === null || this._equalTo === control.value) {\n return null;\n }\n return { isEqualTo: { value: this._equalTo, actualValue: control.value } };\n }\n\n /**\n * @description\n * Registers a callback function to call when the validator inputs change.\n *\n * @param fn The callback function\n */\n public registerOnValidatorChange(fn: () => void): void {\n this._onChange = fn;\n }\n\n}\n\n@NgModule({\n declarations: [ IsEqualToDirective ],\n exports: [ IsEqualToDirective ]\n})\nexport class IsEqualToDirectiveModule {\n}\n","export * from './lib/form-system.module';\n\nexport * from './lib/error';\nexport * from './lib/control-data-source';\n\n// region mixin\n\nexport * from './lib/mixins/extract-data-sources.mixin';\nexport * from './lib/mixins/extract-control-from-parent.mixin';\nexport * from './lib/mixins/extract-form-definition.mixin';\nexport * from './lib/mixins/extract-options-data-source.mixin';\nexport * from './lib/mixins/extract-control.mixin';\n\n// endregion\n\n// region components\n\nexport * from './lib/form-system-control.directive';\n\n\n// endregion\n\n// region decorators\n\nexport * from './lib/decorators/metadata-keys';\nexport * from './lib/decorators/use-component';\nexport * from './lib/decorators/use-data-source';\nexport * from './lib/decorators/use-form-component';\n\n// endregion\n\n// region directives\n\nexport * from './lib/directives/control-hide-show.directive';\nexport * from './lib/directives/form-directives.module';\nexport * from './lib/directives/input-select-options.directive';\n\n// endregion\n\n// region validators\n\nexport * from './lib/validators/is-equal-to';\n\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;MAEa,mBAAoB,SAAQ,SAAS;IAEhD,YAAY,OAAe,EAAE,IAAY,EAAE,SAAkB;QAC3D,KAAK,CAAC,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;KACtD;;;ICNS;AAAZ,WAAY,sBAAsB;IAChC,oEAAqD,CAAA;IACrD,wEAAuD,CAAA;IACvD,0FAAgE,CAAA;IAChE,mFAAyD,CAAA;AAC3D,CAAC,EALW,sBAAsB,KAAtB,sBAAsB;;MCMrB,uBAAuB;IAExB,kBAAkB,CAAC,cAA8B,EAAE,SAAiB;QAC5E,MAAM,GAAG,GAAG,WAAW,CACrB,sBAAsB,CAAC,YAAY,EACnC,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CACtC,CAAC;QAEF,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,IAAI,mBAAmB,CAAC,6EAA6E,EAAE,EAAE,CAAC,CAAC;SAClH;QAED,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;KACF;IAOM,QAAQ,CAAC,OAAwB;QACtC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,KAAK,EAAE;YAC7D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;KAC5E;;;;;;;IAQM,yBAAyB,CAAC,EAAc;QAC7C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;KACrB;;+GA/BU,kBAAkB;mGAAlB,kBAAkB,6FARlB;QACT;YACE,OAAO,EAAM,aAAa;YAC1B,KAAK,EAAQ,IAAI;YACjB,WAAW,EAAE,UAAU,CAAC,MAAM,kBAAkB,CAAC;SAClD;KACF;AAMD;IADC,QAAQ;;;iDAMR;2FATU,kBAAkB;kBAV9B,SAAS;mBAAC;oBACT,QAAQ,EAAG,iBAAiB;oBAC5B,SAAS,EAAE;wBACT;4BACE,OAAO,EAAM,aAAa;4BAC1B,KAAK,EAAQ,IAAI;4BACjB,WAAW,EAAE,UAAU,CAAC,wBAAwB,CAAC;yBAClD;qBACF;iBACF;8BAKY,OAAO;sBAFjB,KAAK;uBAAC,eAAe;;MAqCX,wBAAwB;;qHAAxB,wBAAwB;sHAAxB,wBAAwB,iBAvCxB,kBAAkB,aAAlB,kBAAkB;sHAuClB,wBAAwB;2FAAxB,wBAAwB;kBAJpC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAE,kBAAkB,CAAE;oBACpC,OAAO,EAAO,CAAE,kBAAkB,CAAE;iBACrC;;;ACnBD;;AC3CA;;;;;;"}
package/index.d.ts CHANGED
@@ -2,8 +2,10 @@ export * from './lib/form-system.module';
2
2
  export * from './lib/error';
3
3
  export * from './lib/control-data-source';
4
4
  export * from './lib/mixins/extract-data-sources.mixin';
5
- export * from './lib/mixins/extract-control.mixin';
5
+ export * from './lib/mixins/extract-control-from-parent.mixin';
6
6
  export * from './lib/mixins/extract-form-definition.mixin';
7
+ export * from './lib/mixins/extract-options-data-source.mixin';
8
+ export * from './lib/mixins/extract-control.mixin';
7
9
  export * from './lib/form-system-control.directive';
8
10
  export * from './lib/decorators/metadata-keys';
9
11
  export * from './lib/decorators/use-component';
@@ -1,10 +1,14 @@
1
1
  import { BaseDataSource } from '@rxap/data-source';
2
2
  import { IdOrInstanceOrToken } from '@rxap/definition';
3
- export interface UseDataSourceSettings<Source = any, Target = any> {
4
- transformer: (source: Source) => Target;
3
+ export interface UseDataSourceSettings<Source = any, Target = Source> {
4
+ transformer?: (source: Source) => Target;
5
5
  }
6
- export interface UseDataSourceValue<Source = any, Target = any> {
6
+ export interface UseDataSourceValue<Source = any, Target = Source> {
7
7
  dataSource: IdOrInstanceOrToken<BaseDataSource>;
8
8
  settings?: UseDataSourceSettings<Source, Target>;
9
+ /**
10
+ * The last value of the data source
11
+ */
12
+ lastValue?: Target;
9
13
  }
10
14
  export declare function UseDataSource<Data>(dataSource: IdOrInstanceOrToken<BaseDataSource<Data>>, name: string, settings?: UseDataSourceSettings): (target: any, propertyKey: string) => void;
@@ -1,7 +1,7 @@
1
1
  import { OnInit, Renderer2, ElementRef, OnDestroy } from '@angular/core';
2
2
  import { AbstractControl, RxapFormControl } from '@rxap/forms';
3
3
  import { ControlContainer, NgControl } from '@angular/forms';
4
- import { ExtractControlMixin } from '../mixins/extract-control.mixin';
4
+ import { ExtractControlFromParentMixin } from '../mixins/extract-control-from-parent.mixin';
5
5
  import { ExtractFormDefinitionMixin } from '../mixins/extract-form-definition.mixin';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare const RXAP_FORM_SYSTEM_SHOW_METADATA = "rxap/form-system/show-function";
@@ -16,7 +16,7 @@ export interface ControlHideShowOptions {
16
16
  }
17
17
  export declare function UseHideFunction(hideFunction: ControlHideShowFunction, options?: ControlHideShowOptions): (target: any, propertyKey: string) => void;
18
18
  export declare function UseShowFunction(showFunction: ControlHideShowFunction, options?: ControlHideShowOptions): (target: any, propertyKey: string) => void;
19
- export interface ControlHideShowDirective extends ExtractControlMixin, ExtractFormDefinitionMixin {
19
+ export interface ControlHideShowDirective extends ExtractControlFromParentMixin, ExtractFormDefinitionMixin {
20
20
  }
21
21
  export declare class ControlHideShowDirective implements OnInit, OnDestroy {
22
22
  private readonly renderer;
@@ -1,20 +1,17 @@
1
- import { TemplateRef, OnInit, ViewContainerRef, OnDestroy, Injector, ChangeDetectorRef, AfterViewInit } from '@angular/core';
1
+ import { TemplateRef, ViewContainerRef, OnDestroy, Injector, ChangeDetectorRef, AfterViewInit } from '@angular/core';
2
2
  import { NgControl } from '@angular/forms';
3
3
  import { DataSourceLoader, BaseDataSource, BaseDataSourceViewer, BaseDataSourceMetadata } from '@rxap/data-source';
4
4
  import { RxapFormControl } from '@rxap/forms';
5
5
  import { ControlOptions, ControlOption } from '@rxap/utilities';
6
6
  import { Subscription } from 'rxjs';
7
- import { ExtractDataSourcesMixin } from '../mixins/extract-data-sources.mixin';
8
- import { ExtractFormDefinitionMixin } from '../mixins/extract-form-definition.mixin';
9
- import { UseDataSourceSettings } from '../decorators/use-data-source';
10
- import { IdOrInstanceOrToken } from '@rxap/definition';
11
7
  import { MatFormField } from '@angular/material/form-field';
12
8
  import { MatAutocomplete } from '@angular/material/autocomplete';
9
+ import { ExtractOptionsDataSourceMixin, UseOptionsDataSourceSettings } from '../mixins/extract-options-data-source.mixin';
13
10
  import * as i0 from "@angular/core";
14
11
  export interface InputSelectOptionsTemplateContext {
15
12
  $implicit: ControlOption;
16
13
  }
17
- export interface InputSelectOptionsSettings<Source> extends UseDataSourceSettings<Source, ControlOptions | Record<string, any>> {
14
+ export interface InputSelectOptionsSettings<Source> extends UseOptionsDataSourceSettings<Source> {
18
15
  /**
19
16
  * true - the selected value is not send to the data source with the viewChange event.
20
17
  * Instead an empty object {} is send to trigger a data source refresh.
@@ -36,10 +33,7 @@ export interface InputSelectOptionsSettings<Source> extends UseDataSourceSetting
36
33
  */
37
34
  filteredOptions?: boolean;
38
35
  }
39
- export declare const DATA_SOURCE_NAME = "options";
40
- export declare function ComposeOptionsTransformers(...fnc: Array<(value: any) => any>): (value: any) => any;
41
- export declare function UseOptionsDataSource<Source>(dataSource: IdOrInstanceOrToken<BaseDataSource<Source>>, settings?: InputSelectOptionsSettings<Source>): (target: any, propertyKey: string) => any;
42
- export interface InputSelectOptionsDirective extends OnInit, ExtractFormDefinitionMixin, ExtractDataSourcesMixin {
36
+ export interface InputSelectOptionsDirective extends OnDestroy, AfterViewInit, ExtractOptionsDataSourceMixin {
43
37
  }
44
38
  export declare class InputSelectOptionsDirective implements OnDestroy, AfterViewInit {
45
39
  protected readonly template: TemplateRef<InputSelectOptionsTemplateContext>;
@@ -56,12 +50,10 @@ export declare class InputSelectOptionsDirective implements OnDestroy, AfterView
56
50
  protected control: RxapFormControl;
57
51
  protected dataSource: BaseDataSource<ControlOptions | Record<string, any>>;
58
52
  protected options: ControlOptions | Record<string, any> | null;
59
- protected settings: InputSelectOptionsSettings<any>;
53
+ protected settings?: InputSelectOptionsSettings<any>;
60
54
  constructor(template: TemplateRef<InputSelectOptionsTemplateContext>, dataSourceLoader: DataSourceLoader, viewContainerRef: ViewContainerRef, injector: Injector, cdr: ChangeDetectorRef, ngControl?: NgControl | null, matFormField?: MatFormField | null);
61
55
  ngAfterViewInit(): void;
62
- protected extractDatasource(control?: RxapFormControl): BaseDataSource<ControlOptions | Record<string, any>>;
63
56
  toDisplay(value: any): string;
64
- protected extractControl(ngControl?: NgControl | null): RxapFormControl;
65
57
  ngOnDestroy(): void;
66
58
  private loadOptions;
67
59
  protected renderTemplate(options?: ControlOptions | Record<string, any> | null): void;
@@ -0,0 +1,5 @@
1
+ import { ControlContainer } from '@angular/forms';
2
+ import { AbstractControl } from '@rxap/forms';
3
+ export declare class ExtractControlFromParentMixin {
4
+ protected extractControlFromParent(parent: ControlContainer, controlPath: string): AbstractControl;
5
+ }
@@ -1,5 +1,9 @@
1
- import { ControlContainer } from '@angular/forms';
2
- import { AbstractControl } from '@rxap/forms';
1
+ import { NgControl } from "@angular/forms";
2
+ import { MatFormField } from '@angular/material/form-field';
3
+ import { RxapFormControl } from '@rxap/forms';
3
4
  export declare class ExtractControlMixin {
4
- protected extractControl(parent: ControlContainer, controlPath: string): AbstractControl;
5
+ protected ngControl: NgControl | null;
6
+ protected readonly matFormField: MatFormField | null;
7
+ protected control?: RxapFormControl;
8
+ protected extractControl(ngControl?: NgControl | null): RxapFormControl;
5
9
  }