版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

HTMLInputElementValueStepping.js 1.3 KiB

1 год назад
1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const DOMException_1 = __importDefault(require("../../exception/DOMException"));
  7. /**
  8. * HTML input element value stepping.
  9. */
  10. class HTMLInputElementValueStepping {
  11. /**
  12. * Steps up or down.
  13. *
  14. * @param type Type.
  15. * @param value Value.
  16. * @param direction Direction.
  17. * @param [increment] Increment.
  18. * @returns New value.
  19. */
  20. static step(type, value, direction, increment) {
  21. switch (type) {
  22. case 'number':
  23. return String(Number(value) + (increment !== undefined ? increment * direction : direction));
  24. case 'date':
  25. case 'month':
  26. case 'week':
  27. case 'time':
  28. case 'datetime-local':
  29. case 'range':
  30. // TODO: Implement support for additional types
  31. return null;
  32. default:
  33. throw new DOMException_1.default('This form element is not steppable.');
  34. }
  35. }
  36. }
  37. exports.default = HTMLInputElementValueStepping;
  38. //# sourceMappingURL=HTMLInputElementValueStepping.js.map