"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _inputNumber = _interopRequireDefault(require("../../input-number"));
var _classNames = _interopRequireDefault(require("../../_util/classNames"));
var ColorSteppers = (0, _vue.defineComponent)({
  name: 'ColorSteppers',
  props: ['prefixCls', 'value', 'min', 'max', 'onChange', 'formatter'],
  setup: function setup(props) {
    var colorSteppersPrefixCls = (0, _vue.computed)(function () {
      return "".concat(props.prefixCls, "-steppers");
    });
    var stepValue = (0, _vue.ref)(props.value);
    (0, _vue.watch)(function () {
      return props.value;
    }, function (val) {
      if (!Number.isNaN(val)) {
        stepValue.value = val;
      }
    }, {
      immediate: true
    });
    return function () {
      return (0, _vue.createVNode)(_inputNumber.default, {
        "class": (0, _classNames.default)(colorSteppersPrefixCls.value),
        "hideControls": true,
        "min": props.min,
        "max": props.max,
        "value": stepValue.value,
        "formatter": props.formatter,
        "size": "small",
        "onChange": function onChange(step) {
          var _props$onChange;
          if (!props.value) {
            stepValue.value = step || 0;
          }
          (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, step);
        }
      }, null);
    };
  }
});
var _default = ColorSteppers;
exports.default = _default;