@snabcentr/client-ui 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2020/auth/sign-up-form/sc-sign-up-form.component.mjs +12 -9
- package/esm2020/contragents/new-contragent-form/sc-new-contragent-form.component.mjs +6 -5
- package/esm2020/delivery-address/add-delivery-address-dialog/sc-add-delivery-address-dialog.component.mjs +7 -6
- package/esm2020/form-fields/suggestion-field/sc-suggestion-field.component.mjs +2 -2
- package/fesm2015/snabcentr-client-ui.mjs +28 -18
- package/fesm2015/snabcentr-client-ui.mjs.map +1 -1
- package/fesm2020/snabcentr-client-ui.mjs +22 -17
- package/fesm2020/snabcentr-client-ui.mjs.map +1 -1
- package/package.json +1 -1
@@ -673,7 +673,7 @@ class ScSuggestionFieldComponent {
|
|
673
673
|
}
|
674
674
|
/** @inheritDoc */
|
675
675
|
ngOnInit() {
|
676
|
-
const request$ = tuiControlValue(this.control).pipe(debounceTime(
|
676
|
+
const request$ = tuiControlValue(this.control).pipe(debounceTime(500), filter(tuiIsPresent), map((term) => term.trim()), filter((term) => term.length >= 3), switchMap((term) => this.suggestionService.getData(term, this.type).pipe(startWith(null))), catchError((error) => {
|
677
677
|
if (error instanceof HttpErrorResponse) {
|
678
678
|
const errorResponse = error.error;
|
679
679
|
if (this.control.control) {
|
@@ -865,13 +865,14 @@ let ScNewContragentFormComponent = class ScNewContragentFormComponent {
|
|
865
865
|
/**
|
866
866
|
* {@link Observable} выбора ОПФ.
|
867
867
|
*/
|
868
|
-
this.selectOpf$ = tuiControlValue(this.form.controls.opf).pipe(tap((opf) => {
|
868
|
+
this.selectOpf$ = tuiControlValue(this.form.controls.opf).pipe(distinctUntilChanged(), tap((opf) => {
|
869
869
|
Object.keys({ ...this.entrepreneurGroup.controls, ...this.legalGroup.controls, ...this.nonResidentLegalGroup.controls }).forEach((key) => {
|
870
|
-
this.form.
|
870
|
+
this.form.get(key)?.disable();
|
871
871
|
});
|
872
872
|
const addControls = (formGroup) => {
|
873
873
|
Object.keys({ ...formGroup.controls }).forEach((key) => {
|
874
|
-
|
874
|
+
formGroup.get(key)?.enable();
|
875
|
+
this.form.setControl(key, formGroup.get(key));
|
875
876
|
});
|
876
877
|
};
|
877
878
|
if (ScOpfList[opf] > ScOpfList.individual) {
|
@@ -1098,7 +1099,7 @@ let ScSignUpFormComponent = class ScSignUpFormComponent {
|
|
1098
1099
|
this.successAuth = this.authService.getAuthChange().pipe(filter((state) => state));
|
1099
1100
|
this.opfControl.valueChanges.pipe(distinctUntilChanged(), untilDestroyed(this)).subscribe(() => {
|
1100
1101
|
this.form.patchValue({ name: '' });
|
1101
|
-
this.form.
|
1102
|
+
this.form.get('contragent')?.reset();
|
1102
1103
|
});
|
1103
1104
|
}
|
1104
1105
|
/**
|
@@ -1241,16 +1242,19 @@ let ScSignUpFormComponent = class ScSignUpFormComponent {
|
|
1241
1242
|
onSelectedOrganization(suggestion) {
|
1242
1243
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
1243
1244
|
if (this.form.controls.contragent && 'inn' in suggestion && !('bic' in suggestion)) {
|
1245
|
+
if (suggestion.opf && suggestion.opf.slug !== this.opfControl.value) {
|
1246
|
+
this.opfControl.setValue(suggestion.opf.slug);
|
1247
|
+
}
|
1244
1248
|
this.form.controls.contragent.patchValue({
|
1245
1249
|
name: suggestion.name,
|
1246
1250
|
inn: suggestion.inn,
|
1247
|
-
kpp: suggestion.kpp,
|
1248
|
-
okpo: suggestion.okpo,
|
1249
|
-
directorName: suggestion.directorName,
|
1250
|
-
directorPosition: suggestion.directorPosition,
|
1251
|
-
legalAddress: suggestion.legalAddress,
|
1252
|
-
postalAddress: suggestion.postalAddress,
|
1253
|
-
actualAddress: suggestion.actualAddress,
|
1251
|
+
kpp: suggestion.kpp ?? null,
|
1252
|
+
okpo: suggestion.okpo ?? null,
|
1253
|
+
directorName: suggestion.directorName ?? null,
|
1254
|
+
directorPosition: suggestion.directorPosition ?? null,
|
1255
|
+
legalAddress: suggestion.legalAddress ?? null,
|
1256
|
+
postalAddress: suggestion.postalAddress ?? null,
|
1257
|
+
actualAddress: suggestion.actualAddress ?? null,
|
1254
1258
|
});
|
1255
1259
|
tuiMarkControlAsTouchedAndValidate(this.form.controls.contragent);
|
1256
1260
|
}
|
@@ -3875,7 +3879,7 @@ class ScAddDeliveryAddressDialogComponent {
|
|
3875
3879
|
this.options = {
|
3876
3880
|
autoFitToViewport: 'always',
|
3877
3881
|
yandexMapDisablePoiInteractivity: false,
|
3878
|
-
maxZoom:
|
3882
|
+
maxZoom: 19,
|
3879
3883
|
};
|
3880
3884
|
/**
|
3881
3885
|
* Форма для создания адреса доставки.
|
@@ -3927,6 +3931,11 @@ class ScAddDeliveryAddressDialogComponent {
|
|
3927
3931
|
if (!this.addressPlacemark) {
|
3928
3932
|
this.addressPlacemark = this.createPlacemark(coords);
|
3929
3933
|
}
|
3934
|
+
const bounds = this.addressPlacemark.geometry?.getBounds();
|
3935
|
+
if (bounds) {
|
3936
|
+
this.yaMap?.setBounds(bounds);
|
3937
|
+
this.yaMap?.setZoom(17);
|
3938
|
+
}
|
3930
3939
|
this.setGeoCoordinates(coords);
|
3931
3940
|
}
|
3932
3941
|
}
|
@@ -3959,10 +3968,6 @@ class ScAddDeliveryAddressDialogComponent {
|
|
3959
3968
|
draggable: true,
|
3960
3969
|
});
|
3961
3970
|
this.yaMap?.geoObjects.add(placemark);
|
3962
|
-
const bounds = placemark.geometry?.getBounds();
|
3963
|
-
if (bounds) {
|
3964
|
-
this.yaMap?.setBounds(bounds);
|
3965
|
-
}
|
3966
3971
|
placemark.events.add('dragend', () => {
|
3967
3972
|
const coord = this.addressPlacemark?.geometry?.getCoordinates();
|
3968
3973
|
if (coord) {
|