@snabcentr/client-ui 3.31.0 → 3.31.2

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.
@@ -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.cartItem()?.length ?? this.product().properties?.minLength ?? (this.product().ignoreMinCountCheck ? 0 : this.product().minCount) ?? 1);
4326
+ this.minLength = computed(() => this.product().properties?.minLength ?? (this.product().ignoreMinCountCheck ? 0 : this.product().minCount));
4323
4327
  /**
4324
4328
  * Максимальный метраж для товара.
4325
4329
  */
@@ -4334,18 +4338,9 @@ class ScAddOrEditingCartItemFormComponent {
4334
4338
  this.lengthHint = computed(() => {
4335
4339
  const min = this.minLength();
4336
4340
  const max = this.maxLength();
4337
- // eslint-disable-next-line sonarjs/no-nested-conditional, @typescript-eslint/no-unnecessary-condition
4338
- return (min ?? max) ? `(${min ? `от ${min}` : ''}${min && max ? ' ' : ''}${max ? `до ${max}` : ''} ${this.product().unit})` : '';
4341
+ // eslint-disable-next-line sonarjs/no-nested-conditional, sonarjs/prefer-nullish-coalescing
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,53 @@ class ScAddOrEditingCartItemFormComponent {
4369
4364
  }
4370
4365
  /** @inheritDoc */
4371
4366
  ngOnInit() {
4367
+ this.userMetrikaService.emitUserMetrikaEvent({
4368
+ target: ScUserMetrikaGoalsEnum.cartItemAddShow,
4369
+ params: { product_id: this.product().id },
4370
+ });
4372
4371
  if (this.productIsMeasurable()) {
4373
- this.form.addControl('length', new FormControl(this.minLength(), [Validators.required, Validators.min(0.01)]));
4372
+ // Добавляем поле ввода длины, если товар измеряемый.
4373
+ this.form.addControl('length', new FormControl(this.cartItem()?.length ?? this.minLength() ?? 0.01, [Validators.required, Validators.min(0.01)]));
4374
4374
  }
4375
+ // Устанавливаем количество из корзины или кратности товара.
4375
4376
  this.form.patchValue({
4376
4377
  quantity: this.cartItem()?.quantity ?? this.unitsHelper.productMultiplicity(this.product()),
4378
+ marker: this.cartItem()?.marker ?? '',
4377
4379
  });
4380
+ const step = this.lengthStep();
4381
+ if (this.isLengthConfigurator() && this.lengthStep() && this.form.controls.quantity.value && step) {
4382
+ // Если есть конфигуратор длины, рассчитываем начально значение длины.
4383
+ this.form.controls.length?.patchValue(this.form.controls.quantity.value * step);
4384
+ }
4385
+ // Добавляем валидацию шага для количества.
4378
4386
  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
- this.userMetrikaService.emitUserMetrikaEvent({
4381
- target: ScUserMetrikaGoalsEnum.cartItemAddShow,
4382
- params: { product_id: this.product().id },
4383
- });
4387
+ // Добавляем валидацию шага для длины.
4388
+ this.form.get('length')?.addValidators(stepValidator(this.product().properties?.lengthStep ?? (this.product().ignoreMinCountCheck ? 0 : (this.product().minCount ?? 0))));
4389
+ // Считаем итоговую стоимость заказа.
4390
+ this.totalCost$ = tuiControlValue(this.form).pipe(debounceTime(0), // Исправляем ошибку NG0950.
4391
+ filter(() => this.form.valid), distinctUntilChanged((previous, current) => previous.length === current.length && previous.quantity === current.quantity), // Только при изменении значений
4392
+ startWith(this.form.value), pairwise(), map(([previous, current]) => {
4393
+ const lengthControl = this.form.get('length');
4394
+ // Если нет конфигуратора длины или некорректные данные — возвращаем без изменений.
4395
+ if (!this.isLengthConfigurator() || isUndefined(current.length) || !lengthControl || this.form.invalid || !step) {
4396
+ return current;
4397
+ }
4398
+ // Если изменилось количество — пересчитываем длину.
4399
+ if (previous.quantity !== current.quantity && this.form.controls.quantity.value) {
4400
+ const newValue = this.form.controls.quantity.value * step;
4401
+ lengthControl.patchValue(newValue);
4402
+ }
4403
+ // Если изменилась длина — пересчитываем количество и возвращаем значение длины.
4404
+ if (previous.length !== current.length && lengthControl.value) {
4405
+ const newValue = lengthControl.value / step;
4406
+ this.form.controls.quantity.patchValue(newValue);
4407
+ return { length: step, quantity: newValue };
4408
+ }
4409
+ // Возвращаем итоговые значения для расчёта стоимости.
4410
+ return { length: step, quantity: current.quantity };
4411
+ }),
4412
+ // Считаем стоимость: цена * длина * количество.
4413
+ map(({ length, quantity }) => (this.product().costRub ?? 0) * (length ?? 1) * quantity), map((sum) => Math.round(sum * 100) / 100));
4384
4414
  }
4385
4415
  /**
4386
4416
  * Обработчик события шага метража.
@@ -4388,12 +4418,15 @@ class ScAddOrEditingCartItemFormComponent {
4388
4418
  * @param step Шаг.
4389
4419
  */
4390
4420
  onStepLength(step) {
4391
- // eslint-disable-next-line unicorn/explicit-length-check
4392
- if (!this.productIsMeasurable() || !this.form.controls.length) {
4421
+ const lengthControl = this.form.get('length');
4422
+ if (!this.productIsMeasurable() || !lengthControl) {
4393
4423
  return;
4394
4424
  }
4395
- const length = this.form.controls.length.value ?? 0;
4396
- this.form.controls.length.setValue(Math.max(this.minLength(), length - (length % step) + step));
4425
+ const length = lengthControl.value ?? 0;
4426
+ let newLength = Math.max(this.minLength() ?? step, length + step);
4427
+ // Округляем до ближайшего кратного числа.
4428
+ newLength = Math.round(newLength / step) * step;
4429
+ lengthControl.setValue(Number(newLength.toFixed(2)));
4397
4430
  }
4398
4431
  /**
4399
4432
  * Обработчик события шага количества.
@@ -4408,16 +4441,20 @@ class ScAddOrEditingCartItemFormComponent {
4408
4441
  * Обработчик события отправки формы.
4409
4442
  */
4410
4443
  onSubmit() {
4444
+ // Удаляем null-поля из значения формы.
4411
4445
  const value = this.convertersService.removeNull(this.form.value);
4446
+ // Если это добавление нового товара — добавляем productId.
4412
4447
  if (!this.cartItem()) {
4413
4448
  value.productId = this.product().id;
4414
4449
  }
4415
4450
  const step = this.lengthStep();
4416
- if (this.productIsMeasurable() && step) {
4417
- value.quantity = Math.round(value.quantity * (value.length / step));
4451
+ // Если товар измеряемый и есть конфигуратор длины — устанавливаем длину по шагу (количество уже будет вычислено по формуле Метраж/min-count)
4452
+ if (this.productIsMeasurable() && this.isLengthConfigurator() && step) {
4418
4453
  value.length = step;
4419
4454
  }
4455
+ // Помечаем все поля формы как "touch" и запускаем валидацию для отображения ошибок с сервера.
4420
4456
  tuiMarkControlAsTouchedAndValidate(this.form);
4457
+ // В зависимости от режима — редактируем или добавляем товар.
4421
4458
  if (this.cartItem()) {
4422
4459
  this.editCartItem.emit(value);
4423
4460
  }
@@ -4426,7 +4463,7 @@ class ScAddOrEditingCartItemFormComponent {
4426
4463
  }
4427
4464
  }
4428
4465
  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.1.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 <!-- \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 @let step = lengthStep();\n <tui-chip\n *ngIf=\"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();\n\n <div *ngIf=\"cost\">\n \u0418\u0442\u043E\u0433\u043E:<span class=\"text-2xl font-bold\">\n {{ cost | tuiAmount: 'RUB' | async }}\n {{ product().currency }}</span\n >\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 }); }
4466
+ 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
4467
  }
4431
4468
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ScAddOrEditingCartItemFormComponent, decorators: [{
4432
4469
  type: Component,
@@ -4453,7 +4490,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
4453
4490
  TuiTextfield,
4454
4491
  TuiAmountPipe,
4455
4492
  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 @let step = lengthStep();\n <tui-chip\n *ngIf=\"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();\n\n <div *ngIf=\"cost\">\n \u0418\u0442\u043E\u0433\u043E:<span class=\"text-2xl font-bold\">\n {{ cost | tuiAmount: 'RUB' | async }}\n {{ product().currency }}</span\n >\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" }]
4493
+ ], 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
4494
  }] });
4458
4495
 
4459
4496
  /* eslint-disable sonarjs/no-nested-template-literals,@typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */