@smartbit4all/ng-client 3.1.99 → 3.2.1
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.
- package/esm2020/lib/smart-filter-editor/smart-filter-editor-content/smart-filter-editor-content.component.mjs +26 -26
- package/esm2020/lib/smart-form/services/smartform.service.mjs +20 -10
- package/fesm2015/smartbit4all-ng-client.mjs +45 -30
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +43 -33
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-filter-editor/smart-filter-editor-content/smart-filter-editor-content.component.d.ts +3 -3
- package/lib/smart-form/services/smartform.service.d.ts +1 -0
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.2.1.tgz +0 -0
- package/smartbit4all-ng-client-3.1.99.tgz +0 -0
|
@@ -3877,13 +3877,18 @@ class SmartFormService {
|
|
|
3877
3877
|
}
|
|
3878
3878
|
toFormGroup() {
|
|
3879
3879
|
this.createFormControls(this.smartForm.widgets);
|
|
3880
|
-
|
|
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 =
|
|
3903
|
-
|
|
3904
|
-
}
|
|
3905
|
-
|
|
3906
|
-
formControl.
|
|
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,18 +13614,35 @@ class SmartFilterEditorContentComponent {
|
|
|
13604
13614
|
this.expressionUiActionModels = [];
|
|
13605
13615
|
this.type = FilterExpressionBuilderUiModel.TypeEnum;
|
|
13606
13616
|
}
|
|
13607
|
-
|
|
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.service.modelChanged.pipe(takeUntil(this._destroy$)).subscribe(() => this.setUp());
|
|
13613
13637
|
}
|
|
13614
13638
|
ngOnDestroy() {
|
|
13615
13639
|
this._destroy$.next();
|
|
13616
13640
|
this._destroy$.complete();
|
|
13617
13641
|
}
|
|
13618
13642
|
setupSimpleFilter() {
|
|
13643
|
+
if (this.simpleFilterForm) {
|
|
13644
|
+
return;
|
|
13645
|
+
}
|
|
13619
13646
|
let widgets = [];
|
|
13620
13647
|
let key;
|
|
13621
13648
|
let model = {};
|
|
@@ -13655,26 +13682,6 @@ class SmartFilterEditorContentComponent {
|
|
|
13655
13682
|
useOnBlurEvent: true,
|
|
13656
13683
|
widgets,
|
|
13657
13684
|
};
|
|
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
13685
|
}
|
|
13679
13686
|
extractFilterFieldFromFormModel() {
|
|
13680
13687
|
let simpleFilter = this.simpleFilterFormChild?.submitForm(false).componentModel.data;
|
|
@@ -13724,6 +13731,9 @@ class SmartFilterEditorContentComponent {
|
|
|
13724
13731
|
}
|
|
13725
13732
|
}
|
|
13726
13733
|
constructForm() {
|
|
13734
|
+
if (this.smartForm) {
|
|
13735
|
+
return;
|
|
13736
|
+
}
|
|
13727
13737
|
let generatedWidgets = this.layoutService.render({
|
|
13728
13738
|
layoutDefinitions: this.service.model?.selectedFieldEditor?.layoutDef?.widgets,
|
|
13729
13739
|
});
|