/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var helper = require('../../chunks/helper.js');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var iconsVue = require('@ldesign/icons-vue');
var VueCompositionAPI = require('@vue/composition-api');
var components_button_index = require('../button/index.js');
var components_input_index = require('../input/index.js');
var components_inputNumber_props = require('./props.js');
var components_inputNumber_hooks_useInputNumber = require('./hooks/use-input-number.js');
var hooks_useGlobalIcon = require('../../hooks/use-global-icon.js');
require('../button/button.js');
require('../loading/index.js');
require('../loading/loading.js');
require('../loading/icon/gradient.js');
require('vue');
require('../../chunks/defineProperty-28395935.js');
require('../../chunks/set-style.js');
require('../../chunks/helper2.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/slicedToArray');
require('../../config.js');
require('../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../utils/easing.js');
require('../../utils/render-node.js');
require('@babel/runtime/helpers/typeof');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../utils/transfer-dom.js');
require('../loading/props.js');
require('../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('lodash');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');
require('../../utils/mixins.js');
require('../../utils/with-install.js');
require('../loading/plugin.js');
require('../button/props.js');
require('../../utils/ripple.js');
require('../input/input.js');
require('../../utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('../../utils/event.js');
require('../input/props.js');
require('../input/group.js');
require('../../utils/map-props.js');
require('../../chunks/isObjectLike-2443c6ff.js');
require('../../chunks/_commonjsHelpers-ea2bee21.js');
require('../../chunks/isArray-b0f0e351.js');
require('../../chunks/log.js');
require('../../hooks/use-common-classname.js');
require('../config-provider/useConfig.js');
require('../../hooks/use-vmodel.js');
require('../../hooks/use-form-disabled.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _InputNumber = VueCompositionAPI.defineComponent({
  name: "LInputNumber",
  props: components_inputNumber_props["default"],
  components: {
    LInput: components_input_index.Input,
    LButton: components_button_index.Button
  },
  setup: function setup(props2, context) {
    var p = components_inputNumber_hooks_useInputNumber["default"](props2, context);

    var _useGlobalIcon = hooks_useGlobalIcon.useGlobalIcon({
      AddIcon: iconsVue.AddIcon,
      RemoveIcon: iconsVue.RemoveIcon,
      ChevronDownIcon: iconsVue.ChevronDownIcon,
      ChevronUpIcon: iconsVue.ChevronUpIcon
    }),
        AddIcon = _useGlobalIcon.AddIcon,
        RemoveIcon = _useGlobalIcon.RemoveIcon,
        ChevronDownIcon = _useGlobalIcon.ChevronDownIcon,
        ChevronUpIcon = _useGlobalIcon.ChevronUpIcon;

    return _objectSpread(_objectSpread({}, p), {}, {
      AddIcon: AddIcon,
      RemoveIcon: RemoveIcon,
      ChevronDownIcon: ChevronDownIcon,
      ChevronUpIcon: ChevronUpIcon
    });
  },
  render: function render() {
    var h = arguments[0];
    var AddIcon = this.AddIcon,
        RemoveIcon = this.RemoveIcon,
        ChevronDownIcon = this.ChevronDownIcon,
        ChevronUpIcon = this.ChevronUpIcon;
    var reduceIcon = this.theme === "column" ? h(ChevronDownIcon, {
      "attrs": {
        "size": this.size
      }
    }) : h(RemoveIcon, {
      "attrs": {
        "size": this.size
      }
    });
    var addIcon = this.theme === "column" ? h(ChevronUpIcon, {
      "attrs": {
        "size": this.size
      }
    }) : h(AddIcon, {
      "attrs": {
        "size": this.size
      }
    });
    var status = this.isError ? "error" : this.status;
    return h("div", {
      "class": this.wrapClasses
    }, [this.theme !== "normal" && h("l-button", {
      "class": this.reduceClasses,
      "attrs": {
        "disabled": this.tDisabled,
        "variant": "outline",
        "shape": "square",
        "icon": function icon() {
          return reduceIcon;
        }
      },
      "on": {
        "click": this.handleReduce
      }
    }), h("l-input", helper.helper([{
      "ref": "inputRef",
      "attrs": {
        "disabled": this.tDisabled,
        "readonly": this.readonly,
        "autocomplete": "off",
        "placeholder": this.placeholder,
        "unselectable": this.readonly ? "on" : "off",
        "autoWidth": this.autoWidth,
        "align": this.align || (this.theme === "row" ? "center" : void 0),
        "status": status,
        "label": this.label,
        "suffix": this.suffix
      }
    }, {
      "on": this.listeners
    }, {
      "scopedSlots": this.$scopedSlots
    }, {
      "props": this.inputProps
    }, {
      "attrs": {
        "value": this.userInput
      },
      "on": {
        "change": this.onInnerInputChange
      }
    }])), this.theme !== "normal" && h("l-button", {
      "class": this.addClasses,
      "attrs": {
        "disabled": this.tDisabled,
        "variant": "outline",
        "shape": "square",
        "icon": function icon() {
          return addIcon;
        }
      },
      "on": {
        "click": this.handleAdd
      }
    }), this.tips && h("div", {
      "class": "".concat(this.classPrefix, "-input__tips ").concat(this.classPrefix, "-input__tips--").concat(status)
    }, [this.tips])]);
  }
});

exports["default"] = _InputNumber;
//# sourceMappingURL=input-number.js.map
