ImMaddd / ABB-Trading

Selling Houseware and others!
MIT License
8 stars 1 forks source link

Version 3.2 - quanity-widget input bug fix #8

Closed HashJProgramming closed 1 year ago

HashJProgramming commented 1 year ago

quanity-widget input bug

Here's the screenshots

image

Bug fixed

image

CSS

.ref-quantity-widget input {
  text-align: center;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  width: 5.5em;
  font-size: 0.9em;
  padding: var(--ref-input-padding);
}

JavaScript

onChange(e) {
  if (e.target === this.input) {
    if (!this.inStock) return;
    let r = Math.max(1, parseInt(e.target.value, 10) || 1);
    if (
      ((r = Math.min(r, 99999)),
      (e.target.value = r),
      r == this.getQuantity(r))
    )
      return;
    this.setQuantity(r),
      this._onQuantityChange && this._onQuantityChange(this);
    return;
  }
}

@ImMaddd

ImMaddd commented 1 year ago

Thanks 💪