@elite.framework/ng.core 1.0.9 → 1.0.11

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.
@@ -47,7 +47,7 @@ import * as i1$7 from 'primeng/splitbutton';
47
47
  import { SplitButtonModule } from 'primeng/splitbutton';
48
48
  import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
49
49
  import { InputGroupModule } from 'primeng/inputgroup';
50
- import { finalize as finalize$1 } from 'rxjs/operators';
50
+ import { finalize as finalize$1, tap } from 'rxjs/operators';
51
51
  import { FormlyPrimeNGModule, withFormlyPrimeNG } from '@ngx-formly/primeng';
52
52
  import { ProgressSpinnerModule } from 'primeng/progressspinner';
53
53
  import { MessageModule } from 'primeng/message';
@@ -1328,7 +1328,7 @@ class AttachmentTypeComponent extends FieldType {
1328
1328
  constructor(messageService) {
1329
1329
  super();
1330
1330
  this.messageService = messageService;
1331
- this.url = this.env.apiUrl + '/ESAPI/files';
1331
+ this.url = this.env.apiUrl + '/files';
1332
1332
  }
1333
1333
  get attachments() {
1334
1334
  return this.formControl.value || [];
@@ -3736,6 +3736,7 @@ class GenericSelectorTypeComponent extends FieldType {
3736
3736
  _offlineList = [];
3737
3737
  api;
3738
3738
  dialog;
3739
+ valueChangeSubscription; // Add a subscription to manage the observable
3739
3740
  constructor(svc, injector) {
3740
3741
  super();
3741
3742
  this.svc = svc;
@@ -3748,11 +3749,13 @@ class GenericSelectorTypeComponent extends FieldType {
3748
3749
  this.formControl.setValue(Array.isArray(val) ? val.map((c) => c[vf]) : []);
3749
3750
  }
3750
3751
  else {
3751
- this.formControl.setValue(val?.[vf] ?? null);
3752
+ // this.formControl.setValue(val?.[vf] ?? null);
3753
+ // if(this.props.change){
3754
+ // this.props.change(this.field,{item:this.selectedItem});
3755
+ // }
3752
3756
  }
3753
3757
  }
3754
3758
  ngOnInit() {
3755
- // this.api = this.injector.get(BaseService);
3756
3759
  this.api = this.svc;
3757
3760
  this.dialog = this.injector.get(DialogService);
3758
3761
  const to = this.props;
@@ -3776,6 +3779,23 @@ class GenericSelectorTypeComponent extends FieldType {
3776
3779
  else {
3777
3780
  this.initOnlineSelection();
3778
3781
  }
3782
+ // Subscribe to formControl value changes
3783
+ this.valueChangeSubscription = this.formControl.valueChanges
3784
+ .pipe(tap(() => {
3785
+ // This tap operator is a good place to run side effects
3786
+ // like calling your change handler after a value changes.
3787
+ this.selectedItem = this.formControl.value;
3788
+ if (this.props.change) {
3789
+ this.props.change(this.field, { item: this.selectedItem });
3790
+ }
3791
+ }))
3792
+ .subscribe();
3793
+ }
3794
+ // Remember to unsubscribe to prevent memory leaks!
3795
+ ngOnDestroy() {
3796
+ if (this.valueChangeSubscription) {
3797
+ this.valueChangeSubscription.unsubscribe();
3798
+ }
3779
3799
  }
3780
3800
  initOfflineSelection() {
3781
3801
  const val = this.formControl.value;