@snabcentr/client-ui 0.30.0 → 0.30.2
Sign up to get free protection for your applications and to get access to all the features.
- package/directives/next-input-focus/sc-next-input-focus.directive.d.ts +1 -3
- package/esm2020/delivery-address/add-delivery-address-dialog/sc-add-delivery-address-dialog.component.mjs +17 -11
- package/esm2020/directives/next-input-focus/sc-next-input-focus.directive.mjs +6 -3
- package/fesm2015/snabcentr-client-ui.mjs +21 -13
- package/fesm2015/snabcentr-client-ui.mjs.map +1 -1
- package/fesm2020/snabcentr-client-ui.mjs +20 -12
- package/fesm2020/snabcentr-client-ui.mjs.map +1 -1
- package/package.json +1 -1
@@ -3147,6 +3147,9 @@ class ScNextInputFocusDirective {
|
|
3147
3147
|
* @param event Объект события нажатия на клавишу.
|
3148
3148
|
*/
|
3149
3149
|
onFormKeyDownEnter(event) {
|
3150
|
+
if (event.code !== 'Enter') {
|
3151
|
+
return;
|
3152
|
+
}
|
3150
3153
|
event.preventDefault();
|
3151
3154
|
const elements = this.focusableElements.toArray();
|
3152
3155
|
const focusedIndex = elements.findIndex((control) => control.focused);
|
@@ -3159,7 +3162,7 @@ class ScNextInputFocusDirective {
|
|
3159
3162
|
}
|
3160
3163
|
}
|
3161
3164
|
ScNextInputFocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNextInputFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
3162
|
-
ScNextInputFocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: ScNextInputFocusDirective, selector: "form[ScNextInputFocus]", host: { listeners: { "keydown
|
3165
|
+
ScNextInputFocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: ScNextInputFocusDirective, selector: "form[ScNextInputFocus]", host: { listeners: { "keydown": "onFormKeyDownEnter($event)" } }, queries: [{ propertyName: "focusableElements", predicate: AbstractTuiControl, descendants: true }], ngImport: i0 });
|
3163
3166
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNextInputFocusDirective, decorators: [{
|
3164
3167
|
type: Directive,
|
3165
3168
|
args: [{
|
@@ -3170,7 +3173,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
3170
3173
|
args: [AbstractTuiControl, { descendants: true }]
|
3171
3174
|
}], onFormKeyDownEnter: [{
|
3172
3175
|
type: HostListener,
|
3173
|
-
args: ['keydown
|
3176
|
+
args: ['keydown', ['$event']]
|
3174
3177
|
}] } });
|
3175
3178
|
|
3176
3179
|
/**
|
@@ -3771,6 +3774,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
3771
3774
|
}]
|
3772
3775
|
}] });
|
3773
3776
|
|
3777
|
+
/* eslint-disable @typescript-eslint/unbound-method,lodash/prefer-lodash-method */
|
3774
3778
|
/**
|
3775
3779
|
* Компонент добавления адреса доставки.
|
3776
3780
|
*
|
@@ -3807,17 +3811,21 @@ class ScAddDeliveryAddressDialogComponent {
|
|
3807
3811
|
*/
|
3808
3812
|
this.request$ = this.onSubmit$.pipe(tap(() => {
|
3809
3813
|
tuiMarkControlAsTouchedAndValidate(this.form);
|
3810
|
-
}), filter(() => this.form.valid), map(() => this.form.value), switchMap((value) => this.deliveryAddressService.createDeliveryAddress$(this.convertersService.removeNullRecursive(value)).pipe(
|
3811
|
-
const errorResponse = error.error;
|
3812
|
-
for (const key in errorResponse.errors) {
|
3813
|
-
this.form.get(key)?.setErrors({ serverResponse: errorResponse.errors[key] });
|
3814
|
-
}
|
3815
|
-
if (!errorResponse.errors && errorResponse.message) {
|
3816
|
-
this.form.setErrors({ serverResponse: [errorResponse.message] });
|
3817
|
-
}
|
3818
|
-
return of();
|
3819
|
-
}), tap(() => {
|
3814
|
+
}), filter(() => this.form.valid), map(() => this.form.value), switchMap((value) => this.deliveryAddressService.createDeliveryAddress$(this.convertersService.removeNullRecursive(value)).pipe(tap(() => {
|
3820
3815
|
this.context.completeWith();
|
3816
|
+
}), catchError((error) => {
|
3817
|
+
if (error instanceof HttpErrorResponse) {
|
3818
|
+
const { errors, message } = error.error;
|
3819
|
+
if (errors) {
|
3820
|
+
Object.keys(errors).forEach((key) => {
|
3821
|
+
this.form.get(key)?.setErrors({ serverResponse: errors[key] });
|
3822
|
+
});
|
3823
|
+
}
|
3824
|
+
else if (message) {
|
3825
|
+
this.form.setErrors({ serverResponse: [message] });
|
3826
|
+
}
|
3827
|
+
}
|
3828
|
+
return of({});
|
3821
3829
|
}), startWith(null))), share());
|
3822
3830
|
/**
|
3823
3831
|
* {@link Observable} изменения состояния загрузки данных.
|