@smartbit4all/ng-client 3.1.99 → 3.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.
@@ -3877,13 +3877,18 @@ class SmartFormService {
3877
3877
  }
3878
3878
  toFormGroup() {
3879
3879
  this.createFormControls(this.smartForm.widgets);
3880
- let formGroup = new FormGroup(this.group);
3880
+ if (this.formGroup) {
3881
+ this.formGroup.controls = this.group;
3882
+ }
3883
+ else {
3884
+ this.formGroup = new FormGroup(this.group);
3885
+ }
3881
3886
  if (this.smartForm.validators && this.smartForm.validators.length) {
3882
- formGroup.setValidators(this.smartForm.validators.map((validator) => {
3887
+ this.formGroup.setValidators(this.smartForm.validators.map((validator) => {
3883
3888
  return validator.validator;
3884
3889
  }));
3885
3890
  }
3886
- return formGroup;
3891
+ return this.formGroup;
3887
3892
  }
3888
3893
  createFormControls(widgets, parentKey) {
3889
3894
  widgets.map((widget) => {
@@ -3899,13 +3904,18 @@ class SmartFormService {
3899
3904
  widget.type !== SmartFormWidgetType.COMPONENT &&
3900
3905
  widget.type !== SmartFormWidgetType.MATRIX &&
3901
3906
  widget.type !== SmartFormWidgetType.YOUTUBE_PLAYER) {
3902
- let formControl = new FormControl(widget.value || '', widget.validators?.map((validator) => {
3903
- return validator.validator;
3904
- }));
3905
- if (widget.isDisabled) {
3906
- formControl.disable();
3907
+ let formControl = this.group[`${widget.key}`];
3908
+ if (formControl) {
3909
+ }
3910
+ else {
3911
+ formControl = new FormControl(widget.value || '', widget.validators?.map((validator) => {
3912
+ return validator.validator;
3913
+ }));
3914
+ if (widget.isDisabled) {
3915
+ formControl.disable();
3916
+ }
3917
+ this.group[`${widget.key}`] = formControl;
3907
3918
  }
3908
- this.group[`${widget.key}`] = formControl;
3909
3919
  }
3910
3920
  if (widget.type === SmartFormWidgetType.MATRIX) {
3911
3921
  if (widget.isMultiple) {
@@ -13604,12 +13614,26 @@ class SmartFilterEditorContentComponent {
13604
13614
  this.expressionUiActionModels = [];
13605
13615
  this.type = FilterExpressionBuilderUiModel.TypeEnum;
13606
13616
  }
13607
- ngAfterViewChecked() { }
13617
+ ngAfterViewInit() {
13618
+ if (this.smartFilterChangeSubscription) {
13619
+ this.smartFilterChangeSubscription.unsubscribe();
13620
+ }
13621
+ this.smartFilterChangeSubscription = this.simpleFilterFormChild.onBlurSubject?.pipe(takeUntil(this._destroy$)).subscribe(() => {
13622
+ this.saveFilter();
13623
+ });
13624
+ if (this.smartFilterSophisticatedChangeSubscription) {
13625
+ this.smartFilterSophisticatedChangeSubscription.unsubscribe();
13626
+ }
13627
+ this.smartFilterSophisticatedChangeSubscription =
13628
+ this.simpleFilterFormChild.sophisticatedValueChange?.pipe(takeUntil(this._destroy$)).subscribe((change) => {
13629
+ if (change.kind === 'selection') {
13630
+ this.saveFilter();
13631
+ }
13632
+ });
13633
+ }
13608
13634
  ngOnInit() {
13609
13635
  this.service.load();
13610
- this.service.modelChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
13611
- this.setUp();
13612
- });
13636
+ this.setUp();
13613
13637
  }
13614
13638
  ngOnDestroy() {
13615
13639
  this._destroy$.next();
@@ -13655,26 +13679,6 @@ class SmartFilterEditorContentComponent {
13655
13679
  useOnBlurEvent: true,
13656
13680
  widgets,
13657
13681
  };
13658
- if (this.smartFilterChangeSubscription) {
13659
- this.smartFilterChangeSubscription.unsubscribe();
13660
- }
13661
- this.smartFilterChangeSubscription = this.simpleFilterFormChild?.onBlurSubject
13662
- ?.pipe(takeUntil(this._destroy$))
13663
- .subscribe(() => {
13664
- this.saveFilter();
13665
- });
13666
- if (this.smartFilterSophisticatedChangeSubscription) {
13667
- this.smartFilterSophisticatedChangeSubscription.unsubscribe();
13668
- }
13669
- this.smartFilterSophisticatedChangeSubscription =
13670
- this.simpleFilterFormChild?.sophisticatedValueChange
13671
- ?.pipe(takeUntil(this._destroy$))
13672
- .subscribe((change) => {
13673
- if (change.kind === 'selection') {
13674
- console.log(change);
13675
- this.saveFilter();
13676
- }
13677
- });
13678
13682
  }
13679
13683
  extractFilterFieldFromFormModel() {
13680
13684
  let simpleFilter = this.simpleFilterFormChild?.submitForm(false).componentModel.data;