@snabcentr/client-ui 3.31.0 → 3.31.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/cart/add-or-editing-cart-item-dialog/add-or-editing-cart-item-form/sc-add-or-editing-cart-item-form.component.d.ts +6 -1
- package/esm2022/cart/add-or-editing-cart-item-dialog/add-or-editing-cart-item-form/sc-add-or-editing-cart-item-form.component.mjs +63 -29
- package/fesm2022/snabcentr-client-ui.mjs +62 -28
- package/fesm2022/snabcentr-client-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/release_notes.tmp +3 -3
@@ -3,7 +3,7 @@ import { inject, Injectable, Directive, ContentChildren, HostListener, NgModule,
|
|
3
3
|
import * as i1 from '@snabcentr/client-core';
|
4
4
|
import { ScContactsService, ScUserService, ScAuthService, SEARCH_TERM, ScUnitsHelper, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, IS_RUNNING_ON_TERMINAL, ScPhoneService, ScUserMetrikaService, ScUserMetrikaGoalsEnum, ScVCardService, ScVerificationService, ScISuggestionType, SC_MIN_LENGTH_SEARCH_TERM, ScConvertersService, ScOpfList, ScLocationsService, ScWarehouseService, SEARCH_TERM_PROVIDERS, ScCartService, ScUploadedFile, ScMimeTypes, ScCatalogService, SC_URLS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScIconTypesEnum, ScDocumentInfoTypesEnum, ScFrequentlyAskedQuestionsService, ScFeedbackService } from '@snabcentr/client-core';
|
5
5
|
import * as i6 from 'rxjs';
|
6
|
-
import { EMPTY, BehaviorSubject, switchMap, of, shareReplay, Subject, map, filter, tap, catchError, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, debounceTime, throwError, combineLatest, Observable, noop, first, merge, skip } from 'rxjs';
|
6
|
+
import { EMPTY, BehaviorSubject, switchMap, of, shareReplay, Subject, map, filter, tap, catchError, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, debounceTime, throwError, combineLatest, Observable, pairwise, noop, first, merge, skip } from 'rxjs';
|
7
7
|
import * as i7 from '@taiga-ui/cdk';
|
8
8
|
import { tuiCreateToken, tuiCreateTokenFromFactory, TUI_IS_MOBILE, TuiValueTransformer, TuiDay, tuiControlValue, tuiIsPresent, tuiMarkControlAsTouchedAndValidate, tuiIsFalsy, TuiLet, TuiAutoFocus, TuiRepeatTimes, TuiTime, TuiHovered, TuiDayRange, TuiMonth, tuiPure, TUI_WINDOW_SIZE, TuiValidationError, TUI_TRUE_HANDLER } from '@taiga-ui/cdk';
|
9
9
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
@@ -16,7 +16,7 @@ import { isValidPhoneNumber, getCountries } from 'libphonenumber-js';
|
|
16
16
|
import * as i4 from '@taiga-ui/legacy/components/primitive-textfield';
|
17
17
|
import * as i5 from '@taiga-ui/legacy';
|
18
18
|
import { AbstractTuiControl, TuiInputModule, TuiTextfieldControllerModule, TuiComboBoxModule, TuiInputPhoneModule, TuiSelectModule, TuiInputPasswordModule, AbstractTuiNullableControl, TuiInputNumberComponent, TuiInputNumberModule, TuiIslandDirective, TuiTextareaModule } from '@taiga-ui/legacy';
|
19
|
-
import { isNil, isObject } from 'lodash-es';
|
19
|
+
import { isNil, isUndefined, isObject } from 'lodash-es';
|
20
20
|
import * as i2$2 from '@angular/common';
|
21
21
|
import { CommonModule, NgIf, AsyncPipe, NgFor, NgClass } from '@angular/common';
|
22
22
|
import * as i4$1 from '@taiga-ui/core/components/label';
|
@@ -4300,6 +4300,10 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4300
4300
|
* Данные о товаре.
|
4301
4301
|
*/
|
4302
4302
|
this.product = input.required();
|
4303
|
+
/**
|
4304
|
+
* Признак того, что для указанной категории или продукта действует конфигуратор длины.
|
4305
|
+
*/
|
4306
|
+
this.isLengthConfigurator = computed(() => Boolean(this.product().properties?.['isLengthConfigurator']));
|
4303
4307
|
/**
|
4304
4308
|
* Данные о товаре в корзине.
|
4305
4309
|
*/
|
@@ -4319,7 +4323,7 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4319
4323
|
/**
|
4320
4324
|
* Минимальный метраж для товара.
|
4321
4325
|
*/
|
4322
|
-
this.minLength = computed(() => this.
|
4326
|
+
this.minLength = computed(() => this.product().properties?.minLength ?? (this.product().ignoreMinCountCheck ? 0 : this.product().minCount) ?? 1);
|
4323
4327
|
/**
|
4324
4328
|
* Максимальный метраж для товара.
|
4325
4329
|
*/
|
@@ -4337,15 +4341,6 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4337
4341
|
// eslint-disable-next-line sonarjs/no-nested-conditional, @typescript-eslint/no-unnecessary-condition
|
4338
4342
|
return (min ?? max) ? `(${min ? `от ${min}` : ''}${min && max ? ' ' : ''}${max ? `до ${max}` : ''} ${this.product().unit})` : '';
|
4339
4343
|
});
|
4340
|
-
/**
|
4341
|
-
* Итоговая стоимость заказа.
|
4342
|
-
*/
|
4343
|
-
this.totalCost = toSignal(combineLatest({
|
4344
|
-
// eslint-disable-next-line unicorn/explicit-length-check
|
4345
|
-
length: this.form.controls.length ? tuiControlValue(this.form.controls.length) : of(1),
|
4346
|
-
quantity: tuiControlValue(this.form.controls.quantity),
|
4347
|
-
}).pipe(debounceTime(0), // Исправляем ошибку NG0950.
|
4348
|
-
map(({ length, quantity }) => (this.product().costRub ?? 0) * length * quantity), map((sum) => Math.round(sum * 100) / 100)));
|
4349
4344
|
/**
|
4350
4345
|
* {@link Output} события добавления товара в корзину.
|
4351
4346
|
*/
|
@@ -4369,18 +4364,50 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4369
4364
|
}
|
4370
4365
|
/** @inheritDoc */
|
4371
4366
|
ngOnInit() {
|
4372
|
-
if (this.productIsMeasurable()) {
|
4373
|
-
this.form.addControl('length', new FormControl(this.minLength(), [Validators.required, Validators.min(0.01)]));
|
4374
|
-
}
|
4375
|
-
this.form.patchValue({
|
4376
|
-
quantity: this.cartItem()?.quantity ?? this.unitsHelper.productMultiplicity(this.product()),
|
4377
|
-
});
|
4378
|
-
this.form.controls.quantity.addValidators(stepValidator(this.unitsHelper.productStepForValidator(this.product())));
|
4379
|
-
this.form.controls.length?.addValidators(stepValidator(this.product().properties?.lengthStep ?? (this.product().ignoreMinCountCheck ? 0 : (this.product().minCount ?? 0))));
|
4380
4367
|
this.userMetrikaService.emitUserMetrikaEvent({
|
4381
4368
|
target: ScUserMetrikaGoalsEnum.cartItemAddShow,
|
4382
4369
|
params: { product_id: this.product().id },
|
4383
4370
|
});
|
4371
|
+
if (this.productIsMeasurable()) {
|
4372
|
+
// Добавляем поле ввода длины, если товар измеряемый.
|
4373
|
+
this.form.addControl('length', new FormControl(this.cartItem()?.length ?? this.minLength(), [Validators.required, Validators.min(0.01)]));
|
4374
|
+
}
|
4375
|
+
// Устанавливаем количество из корзины или кратности товара.
|
4376
|
+
this.form.controls.quantity.patchValue(this.cartItem()?.quantity ?? this.unitsHelper.productMultiplicity(this.product()));
|
4377
|
+
const step = this.lengthStep();
|
4378
|
+
if (this.isLengthConfigurator() && this.lengthStep() && this.form.controls.quantity.value && step) {
|
4379
|
+
// Если есть конфигуратор длины, рассчитываем начально значение длины.
|
4380
|
+
this.form.controls.length?.patchValue(this.form.controls.quantity.value * step);
|
4381
|
+
}
|
4382
|
+
// Добавляем валидацию шага для количества.
|
4383
|
+
this.form.controls.quantity.addValidators(stepValidator(this.unitsHelper.productStepForValidator(this.product())));
|
4384
|
+
// Добавляем валидацию шага для длины.
|
4385
|
+
this.form.get('length')?.addValidators(stepValidator(this.product().properties?.lengthStep ?? (this.product().ignoreMinCountCheck ? 0 : (this.product().minCount ?? 0))));
|
4386
|
+
// Считаем итоговую стоимость заказа.
|
4387
|
+
this.totalCost$ = tuiControlValue(this.form).pipe(debounceTime(0), // Исправляем ошибку NG0950.
|
4388
|
+
filter(() => this.form.valid), distinctUntilChanged((previous, current) => previous.length === current.length && previous.quantity === current.quantity), // Только при изменении значений
|
4389
|
+
startWith(this.form.value), pairwise(), map(([previous, current]) => {
|
4390
|
+
const lengthControl = this.form.get('length');
|
4391
|
+
// Если нет конфигуратора длины или некорректные данные — возвращаем без изменений.
|
4392
|
+
if (!this.isLengthConfigurator() || isUndefined(current.length) || !lengthControl || this.form.invalid || !step) {
|
4393
|
+
return current;
|
4394
|
+
}
|
4395
|
+
// Если изменилось количество — пересчитываем длину.
|
4396
|
+
if (previous.quantity !== current.quantity && this.form.controls.quantity.value) {
|
4397
|
+
const newValue = this.form.controls.quantity.value * step;
|
4398
|
+
lengthControl.patchValue(newValue);
|
4399
|
+
}
|
4400
|
+
// Если изменилась длина — пересчитываем количество и возвращаем значение длины.
|
4401
|
+
if (previous.length !== current.length && lengthControl.value) {
|
4402
|
+
const newValue = lengthControl.value / step;
|
4403
|
+
this.form.controls.quantity.patchValue(newValue);
|
4404
|
+
return { length: step, quantity: newValue };
|
4405
|
+
}
|
4406
|
+
// Возвращаем итоговые значения для расчёта стоимости.
|
4407
|
+
return { length: step, quantity: current.quantity };
|
4408
|
+
}),
|
4409
|
+
// Считаем стоимость: цена * длина * количество.
|
4410
|
+
map(({ length, quantity }) => (this.product().costRub ?? 0) * (length ?? 1) * quantity), map((sum) => Math.round(sum * 100) / 100));
|
4384
4411
|
}
|
4385
4412
|
/**
|
4386
4413
|
* Обработчик события шага метража.
|
@@ -4388,12 +4415,15 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4388
4415
|
* @param step Шаг.
|
4389
4416
|
*/
|
4390
4417
|
onStepLength(step) {
|
4391
|
-
|
4392
|
-
if (!this.productIsMeasurable() || !
|
4418
|
+
const lengthControl = this.form.get('length');
|
4419
|
+
if (!this.productIsMeasurable() || !lengthControl) {
|
4393
4420
|
return;
|
4394
4421
|
}
|
4395
|
-
const length =
|
4396
|
-
|
4422
|
+
const length = lengthControl.value ?? 0;
|
4423
|
+
let newLength = Math.max(this.minLength(), length + step);
|
4424
|
+
// Округляем до ближайшего кратного числа.
|
4425
|
+
newLength = Math.round(newLength / step) * step;
|
4426
|
+
lengthControl.setValue(Number(newLength.toFixed(2)));
|
4397
4427
|
}
|
4398
4428
|
/**
|
4399
4429
|
* Обработчик события шага количества.
|
@@ -4408,16 +4438,20 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4408
4438
|
* Обработчик события отправки формы.
|
4409
4439
|
*/
|
4410
4440
|
onSubmit() {
|
4441
|
+
// Удаляем null-поля из значения формы.
|
4411
4442
|
const value = this.convertersService.removeNull(this.form.value);
|
4443
|
+
// Если это добавление нового товара — добавляем productId.
|
4412
4444
|
if (!this.cartItem()) {
|
4413
4445
|
value.productId = this.product().id;
|
4414
4446
|
}
|
4415
4447
|
const step = this.lengthStep();
|
4416
|
-
|
4417
|
-
|
4448
|
+
// Если товар измеряемый и есть конфигуратор длины — устанавливаем длину по шагу (количество уже будет вычислено по формуле Метраж/min-count)
|
4449
|
+
if (this.productIsMeasurable() && this.isLengthConfigurator() && step) {
|
4418
4450
|
value.length = step;
|
4419
4451
|
}
|
4452
|
+
// Помечаем все поля формы как "touch" и запускаем валидацию для отображения ошибок с сервера.
|
4420
4453
|
tuiMarkControlAsTouchedAndValidate(this.form);
|
4454
|
+
// В зависимости от режима — редактируем или добавляем товар.
|
4421
4455
|
if (this.cartItem()) {
|
4422
4456
|
this.editCartItem.emit(value);
|
4423
4457
|
}
|
@@ -4426,7 +4460,7 @@ class ScAddOrEditingCartItemFormComponent {
|
|
4426
4460
|
}
|
4427
4461
|
}
|
4428
4462
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ScAddOrEditingCartItemFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4429
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
4463
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ScAddOrEditingCartItemFormComponent, isStandalone: true, selector: "sc-add-or-editing-cart-item-form", inputs: { product: { classPropertyName: "product", publicName: "product", isSignal: true, isRequired: true, transformFunction: null }, cartItem: { classPropertyName: "cartItem", publicName: "cartItem", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { addToCart: "addToCart", editCartItem: "editCartItem" }, ngImport: i0, template: "<!-- \u0424\u043E\u0440\u043C\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u0440\u044F\u0435\u043C\u043E\u0433\u043E \u0442\u043E\u0432\u0430\u0440\u0430. -->\n<form\n *ngIf=\"product\"\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n ScNextInputFocus\n class=\"flex flex-col gap-2\"\n>\n @let step = lengthStep();\n\n <!-- \u0414\u043B\u0438\u043D\u0430 \u0442\u043E\u0432\u0430\u0440\u0430 (\u043C\u0435\u0442\u0440\u0430\u0436) -->\n <label\n *ngIf=\"productIsMeasurable()\"\n tuiLabel\n >\n \u041C\u0435\u0442\u0440\u0430\u0436, {{ product().unit }}\n @if (!step || maxLength()) {\n {{ lengthHint() }}\n }\n\n <tui-textfield>\n <input\n tuiInputNumber\n formControlName=\"length\"\n [tuiNumberFormat]=\"{ precision: 2 }\"\n [max]=\"maxLength() || null\"\n [min]=\"minLength() || null\"\n (keydown.arrowDown)=\"onStepLength(-(lengthStep() ?? 0.01))\"\n (keydown.arrowUp)=\"onStepLength(lengthStep() ?? 0.01)\"\n autocomplete=\"length\"\n />\n </tui-textfield>\n <tui-error\n formControlName=\"length\"\n [error]=\"[] | tuiFieldError | async\"\n />\n <p\n *ngIf=\"lengthStep()\"\n class=\"tui-form__field-note\"\n >\n \u041C\u0435\u0442\u0440\u0430\u0436 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u0435\u043D {{ lengthStep() }}\n </p>\n </label>\n\n <!-- \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0442\u043E\u0432\u0430\u0440\u0430 -->\n <label tuiLabel>\n \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E, \u0448\u0442.\n <tui-textfield>\n <tui-chip\n *ngIf=\"isLengthConfigurator() && productMultiplicity() && step\"\n size=\"s\"\n appearance=\"negative\"\n class=\"font-bold\"\n >\n x {{ step }} {{ product().unit }}\n </tui-chip>\n\n <input\n placeholder=\"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E\"\n tuiInputNumber\n [tuiNumberFormat]=\"{ decimalMode: 'not-zero' }\"\n [min]=\"productMultiplicity()\"\n (keydown.arrowDown)=\"onStepQuantity(-productMultiplicity())\"\n (keydown.arrowUp)=\"onStepQuantity(productMultiplicity())\"\n formControlName=\"quantity\"\n autocomplete=\"quantity\"\n />\n </tui-textfield>\n <p class=\"tui-form__field-note\">\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u043E {{ productMultiplicity() }}</p>\n <tui-error\n formControlName=\"quantity\"\n [error]=\"[] | tuiFieldError | async\"\n />\n </label>\n\n <!-- \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430 -->\n <label tuiLabel>\n \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430\n <tui-input formControlName=\"marker\">\n \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430\n <input\n tuiTextfieldLegacy\n autocomplete=\"marker\"\n />\n </tui-input>\n <tui-error\n formControlName=\"marker\"\n [error]=\"[] | tuiFieldError | async\"\n />\n </label>\n\n <!-- \u041A\u043D\u043E\u043F\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F / \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0442\u043E\u0432\u0430\u0440\u0430 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443 -->\n <div class=\"flex flex-col items-center\">\n @let cost = totalCost$ | async;\n\n <div *ngIf=\"cost\">\n \u0418\u0442\u043E\u0433\u043E:<span class=\"text-2xl font-bold\">\n {{ cost | tuiAmount | async }}\n {{ product().currency }}\n </span>\n </div>\n\n <!-- \u041A\u043D\u043E\u043F\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F / \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0442\u043E\u0432\u0430\u0440\u0430 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443 -->\n <button\n tuiButton\n iconStart=\"@tui.check\"\n [disabled]=\"form.invalid\"\n [loading]=\"isLoading()\"\n type=\"submit\"\n class=\"mt-2\"\n >\n {{ cartItem() ? '\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C' : '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443' }}\n </button>\n </div>\n</form>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ScNextInputFocusModule }, { kind: "directive", type: ScNextInputFocusDirective, selector: "form[ScNextInputFocus]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: TuiLabel, selector: "label[tuiLabel]" }, { kind: "directive", type: ScSelectOnFocusinDirective, selector: "tui-input-number, tui-input, tui-input-phone, tui-input-date, tui-input-password, input[tuiInputNumber]" }, { kind: "directive", type: TuiNumberFormat, selector: "[tuiNumberFormat]", inputs: ["tuiNumberFormat"] }, { kind: "component", type: TuiError, selector: "tui-error", inputs: ["error"] }, { kind: "ngmodule", type: TuiInputModule }, { kind: "component", type: i5.TuiInputComponent, selector: "tui-input" }, { kind: "directive", type: i5.TuiInputDirective, selector: "tui-input" }, { kind: "component", type: i4.TuiTextfieldComponent, selector: "input[tuiTextfieldLegacy], textarea[tuiTextfieldLegacy]" }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "component", type: TuiButtonLoading, selector: "[tuiButton][loading],[tuiIconButton][loading]", inputs: ["size", "loading"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: TuiFieldErrorPipe, name: "tuiFieldError" }, { kind: "directive", type: i2$1.TuiInputNumberDirective, selector: "input[tuiInputNumber]", inputs: ["min", "max", "prefix", "postfix"] }, { kind: "component", type: i1$1.TuiTextfieldComponent, selector: "tui-textfield", inputs: ["content", "filler"] }, { kind: "pipe", type: TuiAmountPipe, name: "tuiAmount" }, { kind: "directive", type: TuiChip, selector: "tui-chip,[tuiChip]", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
4430
4464
|
}
|
4431
4465
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ScAddOrEditingCartItemFormComponent, decorators: [{
|
4432
4466
|
type: Component,
|
@@ -4453,7 +4487,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
4453
4487
|
TuiTextfield,
|
4454
4488
|
TuiAmountPipe,
|
4455
4489
|
TuiChip,
|
4456
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- \u0424\u043E\u0440\u043C\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u0440\u044F\u0435\u043C\u043E\u0433\u043E \u0442\u043E\u0432\u0430\u0440\u0430. -->\n<form\n *ngIf=\"product\"\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n ScNextInputFocus\n class=\"flex flex-col gap-2\"\n>\n <!-- \u0414\u043B\u0438\u043D\u0430 \u0442\u043E\u0432\u0430\u0440\u0430 (\u043C\u0435\u0442\u0440\u0430\u0436) -->\n <label\n *ngIf=\"productIsMeasurable()\"\n tuiLabel\n >\n \u041C\u0435\u0442\u0440\u0430\u0436, {{ product().unit }} {{ lengthHint() }}\n\n <tui-textfield>\n <input\n tuiInputNumber\n formControlName=\"length\"\n [tuiNumberFormat]=\"{ precision: 2 }\"\n [max]=\"maxLength() || null\"\n [min]=\"minLength() || null\"\n (keydown.arrowDown)=\"onStepLength(-(lengthStep() ?? 0.01))\"\n (keydown.arrowUp)=\"onStepLength(lengthStep() ?? 0.01)\"\n autocomplete=\"length\"\n />\n </tui-textfield>\n <tui-error\n formControlName=\"length\"\n [error]=\"[] | tuiFieldError | async\"\n />\n <p\n *ngIf=\"lengthStep()\"\n class=\"tui-form__field-note\"\n >\n \u041C\u0435\u0442\u0440\u0430\u0436 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u0435\u043D {{ lengthStep() }}\n </p>\n </label>\n\n <!-- \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0442\u043E\u0432\u0430\u0440\u0430 -->\n <label tuiLabel>\n \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E, \u0448\u0442.\n <tui-textfield>\n
|
4490
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- \u0424\u043E\u0440\u043C\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u0440\u044F\u0435\u043C\u043E\u0433\u043E \u0442\u043E\u0432\u0430\u0440\u0430. -->\n<form\n *ngIf=\"product\"\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n ScNextInputFocus\n class=\"flex flex-col gap-2\"\n>\n @let step = lengthStep();\n\n <!-- \u0414\u043B\u0438\u043D\u0430 \u0442\u043E\u0432\u0430\u0440\u0430 (\u043C\u0435\u0442\u0440\u0430\u0436) -->\n <label\n *ngIf=\"productIsMeasurable()\"\n tuiLabel\n >\n \u041C\u0435\u0442\u0440\u0430\u0436, {{ product().unit }}\n @if (!step || maxLength()) {\n {{ lengthHint() }}\n }\n\n <tui-textfield>\n <input\n tuiInputNumber\n formControlName=\"length\"\n [tuiNumberFormat]=\"{ precision: 2 }\"\n [max]=\"maxLength() || null\"\n [min]=\"minLength() || null\"\n (keydown.arrowDown)=\"onStepLength(-(lengthStep() ?? 0.01))\"\n (keydown.arrowUp)=\"onStepLength(lengthStep() ?? 0.01)\"\n autocomplete=\"length\"\n />\n </tui-textfield>\n <tui-error\n formControlName=\"length\"\n [error]=\"[] | tuiFieldError | async\"\n />\n <p\n *ngIf=\"lengthStep()\"\n class=\"tui-form__field-note\"\n >\n \u041C\u0435\u0442\u0440\u0430\u0436 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u0435\u043D {{ lengthStep() }}\n </p>\n </label>\n\n <!-- \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0442\u043E\u0432\u0430\u0440\u0430 -->\n <label tuiLabel>\n \u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E, \u0448\u0442.\n <tui-textfield>\n <tui-chip\n *ngIf=\"isLengthConfigurator() && productMultiplicity() && step\"\n size=\"s\"\n appearance=\"negative\"\n class=\"font-bold\"\n >\n x {{ step }} {{ product().unit }}\n </tui-chip>\n\n <input\n placeholder=\"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E\"\n tuiInputNumber\n [tuiNumberFormat]=\"{ decimalMode: 'not-zero' }\"\n [min]=\"productMultiplicity()\"\n (keydown.arrowDown)=\"onStepQuantity(-productMultiplicity())\"\n (keydown.arrowUp)=\"onStepQuantity(productMultiplicity())\"\n formControlName=\"quantity\"\n autocomplete=\"quantity\"\n />\n </tui-textfield>\n <p class=\"tui-form__field-note\">\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u043E {{ productMultiplicity() }}</p>\n <tui-error\n formControlName=\"quantity\"\n [error]=\"[] | tuiFieldError | async\"\n />\n </label>\n\n <!-- \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430 -->\n <label tuiLabel>\n \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430\n <tui-input formControlName=\"marker\">\n \u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u043A\u0430\n <input\n tuiTextfieldLegacy\n autocomplete=\"marker\"\n />\n </tui-input>\n <tui-error\n formControlName=\"marker\"\n [error]=\"[] | tuiFieldError | async\"\n />\n </label>\n\n <!-- \u041A\u043D\u043E\u043F\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F / \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0442\u043E\u0432\u0430\u0440\u0430 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443 -->\n <div class=\"flex flex-col items-center\">\n @let cost = totalCost$ | async;\n\n <div *ngIf=\"cost\">\n \u0418\u0442\u043E\u0433\u043E:<span class=\"text-2xl font-bold\">\n {{ cost | tuiAmount | async }}\n {{ product().currency }}\n </span>\n </div>\n\n <!-- \u041A\u043D\u043E\u043F\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F / \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0442\u043E\u0432\u0430\u0440\u0430 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443 -->\n <button\n tuiButton\n iconStart=\"@tui.check\"\n [disabled]=\"form.invalid\"\n [loading]=\"isLoading()\"\n type=\"submit\"\n class=\"mt-2\"\n >\n {{ cartItem() ? '\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C' : '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443' }}\n </button>\n </div>\n</form>\n" }]
|
4457
4491
|
}] });
|
4458
4492
|
|
4459
4493
|
/* eslint-disable sonarjs/no-nested-template-literals,@typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */
|