import { defineComponent, useAttrs, ref, computed, watch, resolveComponent, createElementBlock, openBlock, createVNode, mergeProps, unref, withCtx } from 'vue';
import { omit } from 'lodash-es';
import '../../../../utils/index.mjs';
import '../config/index.mjs';
import './api-modal.vue.mjs';
import { createNamespace } from '../../../../utils/create-namespace.mjs';
import _sfc_main$1 from './api-modal.vue2.mjs';
import { clickInputEmits, clickInputProps } from '../config/click-input.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlClickInput" },
  __name: "click-input",
  props: clickInputProps,
  emits: clickInputEmits,
  setup(__props, { emit: __emit }) {
    const bem = createNamespace("api-component");
    const props = __props;
    const emits = __emit;
    const attrs = useAttrs();
    const innerValue = ref(props.value);
    const open = ref(false);
    const getBindValue = computed(() => {
      return omit({ ...attrs }, ["value"]);
    });
    const handleClick = () => {
      if (attrs.disabled) return;
      open.value = true;
    };
    watch(innerValue, (n) => {
      emits("update:value", n);
    });
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_ll_button = resolveComponent("ll-button");
      const _component_ll_input = resolveComponent("ll-input");
      return openBlock(), createElementBlock("div", null, [
        createVNode(_component_ll_input, mergeProps({
          value: innerValue.value,
          "onUpdate:value": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event)
        }, getBindValue.value, {
          disabled: props.disabled,
          class: unref(bem).m("click-input")
        }), {
          suffix: withCtx(() => [
            createVNode(_component_ll_button, {
              type: "link",
              disabled: props.disabled,
              onClick: handleClick
            }, {
              default: withCtx(() => [
                createVNode(_component_ll_icon, {
                  style: { "font-size": "16px" },
                  "icon-name": "icon-amplify2"
                })
              ]),
              _: 1
              /* STABLE */
            }, 8, ["disabled"])
          ]),
          _: 1
          /* STABLE */
        }, 16, ["value", "disabled", "class"]),
        createVNode(_sfc_main$1, {
          value: innerValue.value,
          "onUpdate:value": _cache[1] || (_cache[1] = ($event) => innerValue.value = $event),
          open: open.value,
          "onUpdate:open": _cache[2] || (_cache[2] = ($event) => open.value = $event),
          type: props.type
        }, null, 8, ["value", "open", "type"])
      ]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=click-input.vue2.mjs.map
