/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

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

var helper = require('../../chunks/helper.js');
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 hooks_useGlobalIcon = require('../../hooks/use-global-icon.js');
var components_inputNumber_props = require('./props.js');
var components_inputNumber_hooks_useInputNumber = require('./hooks/use-input-number.js');
require('../../utils/with-install.js');
require('vue');
require('lodash');
require('../../config.js');
require('../button/button.js');
require('../loading/index.js');
require('../loading/loading.js');
require('../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../chunks/log.js');
require('../../chunks/_commonjsHelpers-2e6815bd.js');
require('../../utils/easing.js');
require('../../utils/render-node.js');
require('../../utils/transfer-dom.js');
require('../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');
require('../../utils/mixins.js');
require('../loading/props.js');
require('../loading/icon/gradient.js');
require('../../chunks/defineProperty-838e4192.js');
require('../../chunks/set-style.js');
require('../../chunks/helper2.js');
require('../loading/plugin.js');
require('../../utils/ripple.js');
require('../button/props.js');
require('../../utils/map-props.js');
require('../input/input.js');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../utils/helper.js');
require('../../utils/event.js');
require('../input/props.js');
require('../input/group.js');
require('../config-provider/useConfig.js');
require('../../chunks/isObjectLike-c22c7e3b.js');
require('../../chunks/isArray-cd7357b9.js');
require('../../chunks/isNumber-c4eb560e.js');
require('../../hooks/use-common-classname.js');
require('../../hooks/use-vmodel.js');
require('../../hooks/use-form-disabled.js');

var _InputNumber = VueCompositionAPI.defineComponent({
  name: "LInputNumber",
  components: {
    LInput: components_input_index.Input,
    LButton: components_button_index.Button
  },
  props: components_inputNumber_props["default"],
  setup(props2, context) {
    const p = components_inputNumber_hooks_useInputNumber["default"](props2, context);
    const {
      AddIcon,
      RemoveIcon,
      ChevronDownIcon,
      ChevronUpIcon
    } = hooks_useGlobalIcon.useGlobalIcon({
      AddIcon: iconsVue.AddIcon,
      RemoveIcon: iconsVue.RemoveIcon,
      ChevronDownIcon: iconsVue.ChevronDownIcon,
      ChevronUpIcon: iconsVue.ChevronUpIcon
    });
    return {
      ...p,
      AddIcon,
      RemoveIcon,
      ChevronDownIcon,
      ChevronUpIcon
    };
  },
  render() {
    const h = arguments[0];
    const {
      AddIcon,
      RemoveIcon,
      ChevronDownIcon,
      ChevronUpIcon
    } = this;
    const reduceIcon = this.theme === "column" ? h(ChevronDownIcon, {
      "attrs": {
        "size": this.size
      }
    }) : h(RemoveIcon, {
      "attrs": {
        "size": this.size
      }
    });
    const addIcon = this.theme === "column" ? h(ChevronUpIcon, {
      "attrs": {
        "size": this.size
      }
    }) : h(AddIcon, {
      "attrs": {
        "size": this.size
      }
    });
    const 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": () => 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": () => addIcon
      },
      "on": {
        "click": this.handleAdd
      }
    }), this.tips && h("div", {
      "class": `${this.classPrefix}-input__tips ${this.classPrefix}-input__tips--${status}`
    }, [this.tips])]);
  }
});

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