@3kles/kles-material-dynamicforms 17.12.6 → 17.13.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.
@@ -1314,7 +1314,7 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
1314
1314
  }
1315
1315
  else if (this.field.options instanceof Function) {
1316
1316
  this.isLoading = true;
1317
- return this.field.options();
1317
+ return this.field.options(undefined, this.group.getRawValue());
1318
1318
  }
1319
1319
  else {
1320
1320
  return of(this.field.options);
@@ -1337,7 +1337,7 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
1337
1337
  this.options$ = this.field.options;
1338
1338
  }
1339
1339
  else if (this.field.options instanceof Function) {
1340
- this.options$ = this.field.options();
1340
+ this.options$ = this.field.options(undefined, this.group.getRawValue());
1341
1341
  }
1342
1342
  else {
1343
1343
  this.options$ = of(this.field.options);
@@ -1795,12 +1795,10 @@ let KlesFormListFieldComponent = class KlesFormListFieldComponent extends KlesFi
1795
1795
  this.collections = [];
1796
1796
  }
1797
1797
  ngOnInit() {
1798
- if (this.field.value && Array.isArray(this.field.value)) {
1799
- this.collections = this.field.value?.map(() => {
1800
- return this.field.collections ? cloneDeep(this.field.collections) : [];
1801
- });
1802
- }
1803
1798
  this.formArray = this.group.controls[this.field.name];
1799
+ this.collections = this.formArray?.controls?.map(() => {
1800
+ return this.field.collections ? cloneDeep(this.field.collections) : [];
1801
+ });
1804
1802
  super.ngOnInit();
1805
1803
  }
1806
1804
  createFormGroup() {
@@ -1853,13 +1851,13 @@ let KlesFormListFieldComponent = class KlesFormListFieldComponent extends KlesFi
1853
1851
  </div>
1854
1852
 
1855
1853
  <div class="dynamic-form" [formGroupName]="field.name">
1856
- @for (subGroup of formArray.controls; track subGroup.value._id; let idx = $index) {
1854
+ @for (subGroup of formArray.controls; track subGroup.value._id; let idx = $index;) {
1857
1855
  <div class="subfields">
1858
1856
  @for (subfield of collections[idx]; track subfield.name) {
1859
1857
  <ng-container klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="collections[idx]">
1860
1858
  </ng-container>
1861
1859
  }
1862
- @if(collections){
1860
+ @if(collections[idx]){
1863
1861
  <button mat-icon-button (click)="deleteField(idx)" color="primary">
1864
1862
  <mat-icon>delete_outlined</mat-icon>
1865
1863
  </button>
@@ -1899,13 +1897,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
1899
1897
  </div>
1900
1898
 
1901
1899
  <div class="dynamic-form" [formGroupName]="field.name">
1902
- @for (subGroup of formArray.controls; track subGroup.value._id; let idx = $index) {
1900
+ @for (subGroup of formArray.controls; track subGroup.value._id; let idx = $index;) {
1903
1901
  <div class="subfields">
1904
1902
  @for (subfield of collections[idx]; track subfield.name) {
1905
1903
  <ng-container klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="collections[idx]">
1906
1904
  </ng-container>
1907
1905
  }
1908
- @if(collections){
1906
+ @if(collections[idx]){
1909
1907
  <button mat-icon-button (click)="deleteField(idx)" color="primary">
1910
1908
  <mat-icon>delete_outlined</mat-icon>
1911
1909
  </button>
@@ -2990,7 +2988,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
2990
2988
  this.options$ = this.field.options;
2991
2989
  }
2992
2990
  else if (this.field.options instanceof Function) {
2993
- this.options$ = this.field.options();
2991
+ this.options$ = this.field.options(undefined, this.group.getRawValue());
2994
2992
  }
2995
2993
  else {
2996
2994
  this.options$ = of(this.field.options);
@@ -3056,7 +3054,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
3056
3054
  }
3057
3055
  else if (this.field.options instanceof Function) {
3058
3056
  this.isLoading.set(true);
3059
- return this.field.options().pipe(takeUntil(this.openClosed$));
3057
+ return this.field.options(undefined, this.group.getRawValue()).pipe(takeUntil(this.openClosed$));
3060
3058
  }
3061
3059
  else {
3062
3060
  return of(this.field.options);
@@ -4084,10 +4082,10 @@ class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
4084
4082
  if (this.field.options instanceof Function) {
4085
4083
  if (this.openChange$.getValue() && this.field.options instanceof Function) {
4086
4084
  if (value) {
4087
- return this.field.options(value).pipe(take(1));
4085
+ return this.field.options(value, this.group.getRawValue()).pipe(take(1));
4088
4086
  }
4089
4087
  else {
4090
- return this.field.options().pipe(take(1));
4088
+ return this.field.options(undefined, this.group.getRawValue()).pipe(take(1));
4091
4089
  }
4092
4090
  }
4093
4091
  return of(this.group.controls[this.field.name].value ? [this.group.controls[this.field.name].value] : []);