@3kles/kles-material-dynamicforms 1.1.18 → 1.1.19

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 (28) hide show
  1. package/3kles-kles-material-dynamicforms.metadata.json +1 -1
  2. package/bundles/3kles-kles-material-dynamicforms.umd.js +28 -6
  3. package/bundles/3kles-kles-material-dynamicforms.umd.js.map +1 -1
  4. package/bundles/3kles-kles-material-dynamicforms.umd.min.js +2 -2
  5. package/bundles/3kles-kles-material-dynamicforms.umd.min.js.map +1 -1
  6. package/esm2015/lib/fields/field.abstract.js +23 -4
  7. package/esm2015/lib/fields/list-field.component.js +7 -5
  8. package/esm2015/lib/fields/select.component.js +8 -4
  9. package/esm2015/lib/interfaces/directive.interface.js +1 -0
  10. package/esm2015/lib/interfaces/field.config.interface.js +1 -1
  11. package/esm2015/public-api.js +1 -1
  12. package/esm5/lib/fields/field.abstract.js +20 -2
  13. package/esm5/lib/fields/list-field.component.js +7 -5
  14. package/esm5/lib/fields/select.component.js +8 -4
  15. package/esm5/lib/interfaces/directive.interface.js +1 -0
  16. package/esm5/lib/interfaces/field.config.interface.js +1 -1
  17. package/esm5/public-api.js +1 -1
  18. package/fesm2015/3kles-kles-material-dynamicforms.js +31 -9
  19. package/fesm2015/3kles-kles-material-dynamicforms.js.map +1 -1
  20. package/fesm5/3kles-kles-material-dynamicforms.js +29 -7
  21. package/fesm5/3kles-kles-material-dynamicforms.js.map +1 -1
  22. package/lib/fields/field.abstract.d.ts +4 -1
  23. package/lib/fields/list-field.component.d.ts +3 -2
  24. package/lib/fields/select.component.d.ts +3 -2
  25. package/lib/interfaces/directive.interface.d.ts +3 -0
  26. package/lib/interfaces/field.config.interface.d.ts +4 -1
  27. package/package.json +1 -1
  28. package/public-api.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __awaiter } from 'tslib';
2
- import { EventEmitter, Input, Output, Component, ComponentFactoryResolver, ViewContainerRef, Directive, ViewChild, ViewChildren, NgModule, forwardRef, Pipe, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Component, ComponentFactoryResolver, ViewContainerRef, Directive, HostBinding, ViewChild, ViewChildren, NgModule, forwardRef, Pipe, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { Validators, FormBuilder, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormsModule } from '@angular/forms';
5
5
  import { Subject, Observable, of, ReplaySubject } from 'rxjs';
@@ -361,8 +361,9 @@ KlesComponentDirective = __decorate([
361
361
  })
362
362
  ], KlesComponentDirective);
363
363
 
364
- class KlesFieldAbstract {
365
- constructor() {
364
+ let KlesFieldAbstract = class KlesFieldAbstract {
365
+ constructor(viewRef) {
366
+ this.viewRef = viewRef;
366
367
  this._onDestroy = new Subject();
367
368
  }
368
369
  ngOnInit() {
@@ -377,10 +378,16 @@ class KlesFieldAbstract {
377
378
  }
378
379
  // this.applyPipeTransform();
379
380
  });
381
+ if (this.field.directive) {
382
+ this.directive = new this.field.directive(this.viewRef, this);
383
+ this.directive.ngOnInit();
384
+ }
380
385
  }
381
386
  ngAfterViewInit() {
382
387
  }
383
388
  ngOnDestroy() {
389
+ var _a;
390
+ (_a = this.directive) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
384
391
  this._onDestroy.next();
385
392
  this._onDestroy.complete();
386
393
  }
@@ -406,7 +413,16 @@ class KlesFieldAbstract {
406
413
  }
407
414
  }
408
415
  }
409
- }
416
+ };
417
+ KlesFieldAbstract.ctorParameters = () => [
418
+ { type: ViewContainerRef }
419
+ ];
420
+ __decorate([
421
+ HostBinding('attr.klesDirective')
422
+ ], KlesFieldAbstract.prototype, "directive", void 0);
423
+ KlesFieldAbstract = __decorate([
424
+ Directive()
425
+ ], KlesFieldAbstract);
410
426
 
411
427
  let KlesFormLabelComponent = class KlesFormLabelComponent extends KlesFieldAbstract {
412
428
  ngOnInit() {
@@ -548,8 +564,9 @@ KlesFormSubmitButtonComponent = __decorate([
548
564
  ], KlesFormSubmitButtonComponent);
549
565
 
550
566
  let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbstract {
551
- constructor() {
552
- super();
567
+ constructor(viewRef) {
568
+ super(viewRef);
569
+ this.viewRef = viewRef;
553
570
  this.compareFn = (o1, o2) => {
554
571
  if (this.field.property && o1 && o2) {
555
572
  return o1[this.field.property] === o2[this.field.property];
@@ -578,6 +595,9 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
578
595
  }
579
596
  }
580
597
  };
598
+ KlesFormSelectComponent.ctorParameters = () => [
599
+ { type: ViewContainerRef }
600
+ ];
581
601
  __decorate([
582
602
  ViewChild(CdkVirtualScrollViewport)
583
603
  ], KlesFormSelectComponent.prototype, "cdkVirtualScrollViewport", void 0);
@@ -740,9 +760,10 @@ KlesFormCheckboxComponent = __decorate([
740
760
  ], KlesFormCheckboxComponent);
741
761
 
742
762
  let KlesFormListFieldComponent = class KlesFormListFieldComponent extends KlesFieldAbstract {
743
- constructor(fb) {
744
- super();
763
+ constructor(fb, viewRef) {
764
+ super(viewRef);
745
765
  this.fb = fb;
766
+ this.viewRef = viewRef;
746
767
  }
747
768
  ngOnInit() {
748
769
  this.formArray = this.group.controls[this.field.name];
@@ -787,7 +808,8 @@ let KlesFormListFieldComponent = class KlesFormListFieldComponent extends KlesFi
787
808
  }
788
809
  };
789
810
  KlesFormListFieldComponent.ctorParameters = () => [
790
- { type: FormBuilder }
811
+ { type: FormBuilder },
812
+ { type: ViewContainerRef }
791
813
  ];
792
814
  KlesFormListFieldComponent = __decorate([
793
815
  Component({