@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.
@@ -3814,13 +3814,18 @@ class SmartFormService {
3814
3814
  }
3815
3815
  toFormGroup() {
3816
3816
  this.createFormControls(this.smartForm.widgets);
3817
- let formGroup = new FormGroup(this.group);
3817
+ if (this.formGroup) {
3818
+ this.formGroup.controls = this.group;
3819
+ }
3820
+ else {
3821
+ this.formGroup = new FormGroup(this.group);
3822
+ }
3818
3823
  if (this.smartForm.validators && this.smartForm.validators.length) {
3819
- formGroup.setValidators(this.smartForm.validators.map((validator) => {
3824
+ this.formGroup.setValidators(this.smartForm.validators.map((validator) => {
3820
3825
  return validator.validator;
3821
3826
  }));
3822
3827
  }
3823
- return formGroup;
3828
+ return this.formGroup;
3824
3829
  }
3825
3830
  createFormControls(widgets, parentKey) {
3826
3831
  widgets.map((widget) => {
@@ -3837,13 +3842,18 @@ class SmartFormService {
3837
3842
  widget.type !== SmartFormWidgetType.COMPONENT &&
3838
3843
  widget.type !== SmartFormWidgetType.MATRIX &&
3839
3844
  widget.type !== SmartFormWidgetType.YOUTUBE_PLAYER) {
3840
- let formControl = new FormControl(widget.value || '', (_a = widget.validators) === null || _a === void 0 ? void 0 : _a.map((validator) => {
3841
- return validator.validator;
3842
- }));
3843
- if (widget.isDisabled) {
3844
- formControl.disable();
3845
+ let formControl = this.group[`${widget.key}`];
3846
+ if (formControl) {
3847
+ }
3848
+ else {
3849
+ formControl = new FormControl(widget.value || '', (_a = widget.validators) === null || _a === void 0 ? void 0 : _a.map((validator) => {
3850
+ return validator.validator;
3851
+ }));
3852
+ if (widget.isDisabled) {
3853
+ formControl.disable();
3854
+ }
3855
+ this.group[`${widget.key}`] = formControl;
3845
3856
  }
3846
- this.group[`${widget.key}`] = formControl;
3847
3857
  }
3848
3858
  if (widget.type === SmartFormWidgetType.MATRIX) {
3849
3859
  if (widget.isMultiple) {
@@ -13743,19 +13753,34 @@ class SmartFilterEditorContentComponent {
13743
13753
  this.expressionUiActionModels = [];
13744
13754
  this.type = FilterExpressionBuilderUiModel.TypeEnum;
13745
13755
  }
13746
- ngAfterViewChecked() { }
13756
+ ngAfterViewInit() {
13757
+ var _a, _b;
13758
+ if (this.smartFilterChangeSubscription) {
13759
+ this.smartFilterChangeSubscription.unsubscribe();
13760
+ }
13761
+ this.smartFilterChangeSubscription = (_a = this.simpleFilterFormChild.onBlurSubject) === null || _a === void 0 ? void 0 : _a.pipe(takeUntil(this._destroy$)).subscribe(() => {
13762
+ this.saveFilter();
13763
+ });
13764
+ if (this.smartFilterSophisticatedChangeSubscription) {
13765
+ this.smartFilterSophisticatedChangeSubscription.unsubscribe();
13766
+ }
13767
+ this.smartFilterSophisticatedChangeSubscription =
13768
+ (_b = this.simpleFilterFormChild.sophisticatedValueChange) === null || _b === void 0 ? void 0 : _b.pipe(takeUntil(this._destroy$)).subscribe((change) => {
13769
+ if (change.kind === 'selection') {
13770
+ this.saveFilter();
13771
+ }
13772
+ });
13773
+ }
13747
13774
  ngOnInit() {
13748
13775
  this.service.load();
13749
- this.service.modelChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
13750
- this.setUp();
13751
- });
13776
+ this.setUp();
13752
13777
  }
13753
13778
  ngOnDestroy() {
13754
13779
  this._destroy$.next();
13755
13780
  this._destroy$.complete();
13756
13781
  }
13757
13782
  setupSimpleFilter() {
13758
- var _a, _b, _c, _d, _e, _f, _g;
13783
+ var _a, _b, _c;
13759
13784
  let widgets = [];
13760
13785
  let key;
13761
13786
  let model = {};
@@ -13796,22 +13821,6 @@ class SmartFilterEditorContentComponent {
13796
13821
  useOnBlurEvent: true,
13797
13822
  widgets,
13798
13823
  };
13799
- if (this.smartFilterChangeSubscription) {
13800
- this.smartFilterChangeSubscription.unsubscribe();
13801
- }
13802
- this.smartFilterChangeSubscription = (_e = (_d = this.simpleFilterFormChild) === null || _d === void 0 ? void 0 : _d.onBlurSubject) === null || _e === void 0 ? void 0 : _e.pipe(takeUntil(this._destroy$)).subscribe(() => {
13803
- this.saveFilter();
13804
- });
13805
- if (this.smartFilterSophisticatedChangeSubscription) {
13806
- this.smartFilterSophisticatedChangeSubscription.unsubscribe();
13807
- }
13808
- this.smartFilterSophisticatedChangeSubscription =
13809
- (_g = (_f = this.simpleFilterFormChild) === null || _f === void 0 ? void 0 : _f.sophisticatedValueChange) === null || _g === void 0 ? void 0 : _g.pipe(takeUntil(this._destroy$)).subscribe((change) => {
13810
- if (change.kind === 'selection') {
13811
- console.log(change);
13812
- this.saveFilter();
13813
- }
13814
- });
13815
13824
  }
13816
13825
  extractFilterFieldFromFormModel() {
13817
13826
  var _a;