@smartbit4all/ng-client 3.1.72 → 3.1.74

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.
@@ -13034,49 +13034,39 @@ class SmartFilterEditorContentComponent {
13034
13034
  }
13035
13035
  ngOnInit() {
13036
13036
  this.service.load();
13037
- this.initChildComponents();
13038
13037
  this.service.modelChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
13039
- this.bindChildComps();
13038
+ this.setUp();
13040
13039
  });
13041
13040
  }
13042
13041
  ngOnDestroy() {
13043
13042
  this._destroy$.next();
13044
13043
  this._destroy$.complete();
13045
13044
  }
13046
- initChildComponents() {
13047
- if (this.service.model?.type === this.type.Simple) {
13048
- this.simpleFilterModel = {
13049
- data: [],
13050
- type: SmartFilterType.SIMPLE,
13051
- };
13052
- this.smartFilterChild.service.change.pipe(takeUntil(this._destroy$)).subscribe(() => {
13045
+ setupSimpleFilter() {
13046
+ this.simpleFilterModel = {
13047
+ data: this.service.model.model.workplaceList.filters,
13048
+ type: SmartFilterType.SIMPLE,
13049
+ };
13050
+ if (!this.smartFilterChangeSubscription) {
13051
+ this.smartFilterChangeSubscription = this.smartFilterChild?.service.change
13052
+ .pipe(takeUntil(this._destroy$))
13053
+ .subscribe(() => {
13053
13054
  this.saveFilter();
13054
13055
  });
13055
13056
  }
13056
- else {
13057
- this.smartForm = {
13058
- direction: SmartFormWidgetDirection.ROW,
13059
- useOnBlurEvent: true,
13060
- componentModel: { data: this.service.model?.selectedField },
13061
- widgets: [],
13062
- };
13063
- this.formChild.onBlurSubject?.pipe(takeUntil(this._destroy$)).subscribe(() => {
13064
- this.save();
13065
- });
13066
- }
13067
13057
  }
13068
- bindChildComps() {
13058
+ setUp() {
13069
13059
  if (this.service.model?.type === this.type.Simple) {
13070
- this.simpleFilterModel = {
13071
- data: this.service.model.model.workplaceList.filters,
13072
- type: SmartFilterType.SIMPLE,
13073
- };
13060
+ this.setupSimpleFilter();
13074
13061
  }
13075
13062
  else {
13076
13063
  this.constructUiActionModels();
13077
13064
  if (this.service.model.selectedFieldEditor) {
13078
13065
  this.constructForm();
13079
13066
  }
13067
+ else {
13068
+ this.smartForm = undefined;
13069
+ }
13080
13070
  }
13081
13071
  }
13082
13072
  constructUiActionModels() {
@@ -13114,6 +13104,14 @@ class SmartFilterEditorContentComponent {
13114
13104
  componentModel: { data: this.service.model?.selectedField },
13115
13105
  widgets: generatedWidgets,
13116
13106
  };
13107
+ if (this.smartformChangeSubscription) {
13108
+ this.smartformChangeSubscription.unsubscribe();
13109
+ }
13110
+ this.smartformChangeSubscription = this.formChild?.onBlurSubject
13111
+ ?.pipe(takeUntil(this._destroy$))
13112
+ .subscribe(() => {
13113
+ this.save();
13114
+ });
13117
13115
  }
13118
13116
  save() {
13119
13117
  this.formChild?.submitForm(false);