@snabcentr/client-ui 0.2.16 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -335,14 +335,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
335
335
  * Проверяет кратность значения.
336
336
  *
337
337
  * @param step Шаг кратности.
338
- * @param tolerance Допустимая погрешность.
338
+ * @param precision Точность, количество чисел после запятой.
339
339
  */
340
- function stepValidator(step, tolerance = 0.0001) {
340
+ function stepValidator(step, precision = 3) {
341
341
  return ({ value }) => {
342
342
  if (value) {
343
- const controlValue = value / step;
344
- const closestMultiple = Math.round(controlValue / step) * step;
345
- return Math.abs(controlValue - closestMultiple) > tolerance ? { error: `Число не кратно ${step}` } : null;
343
+ return Number((value / step).toFixed(precision)) % 1 !== 0 ? { error: `Число не кратно ${step}` } : null;
346
344
  }
347
345
  return null;
348
346
  };
@@ -549,7 +547,7 @@ class ScCartItemMobileComponent {
549
547
  /**
550
548
  * {@link FormControl} поля ввода количества товара в корзине.
551
549
  */
552
- this.quantityControl = new FormControl(0);
550
+ this.quantityControl = new FormControl(0, { updateOn: 'blur' });
553
551
  /**
554
552
  * {@link Observable} изменения количества товара в корзине.
555
553
  */
@@ -841,7 +839,7 @@ class ScPriceCardComponent {
841
839
  /**
842
840
  * {@link FormControl} поля ввода количества товара в корзине.
843
841
  */
844
- this.quantityControl = new FormControl(null);
842
+ this.quantityControl = new FormControl(null, { updateOn: 'blur' });
845
843
  /**
846
844
  * {@link Observable} изменения количества товара в корзине.
847
845
  */
@@ -1632,6 +1630,7 @@ const scClientUiIconsName = [
1632
1630
  'scIconWordFile',
1633
1631
  'scIconWindowsill',
1634
1632
  'scIconWarning',
1633
+ 'scIconSandwichPanels',
1635
1634
  'scIconWallet',
1636
1635
  'scIconViewTree',
1637
1636
  'scIconViewInline',