{"version":3,"file":"input-tag2.mjs","names":[],"sources":["../../../../../../packages/components/input-tag/src/input-tag.vue"],"sourcesContent":["<template>\n  <div\n    ref=\"wrapperRef\"\n    :class=\"containerKls\"\n    :style=\"containerStyle\"\n    @mouseenter=\"handleMouseEnter\"\n    @mouseleave=\"handleMouseLeave\"\n  >\n    <div v-if=\"slots.prefix\" :class=\"ns.e('prefix')\">\n      <slot name=\"prefix\" />\n    </div>\n    <div ref=\"innerRef\" :class=\"innerKls\">\n      <el-tag\n        v-for=\"(item, index) in showTagList\"\n        :key=\"index\"\n        :size=\"tagSize\"\n        :closable=\"closable\"\n        :type=\"tagType\"\n        :effect=\"tagEffect\"\n        :draggable=\"closable && draggable\"\n        :style=\"tagStyle\"\n        disable-transitions\n        @close=\"handleRemoveTag(index)\"\n        @dragstart=\"(event: DragEvent) => handleDragStart(event, index)\"\n        @dragover=\"(event: DragEvent) => handleDragOver(event, index)\"\n        @dragend=\"handleDragEnd\"\n        @drop.stop\n      >\n        <slot name=\"tag\" :value=\"item\" :index=\"index\">\n          {{ item }}\n        </slot>\n      </el-tag>\n      <el-tooltip\n        v-if=\"collapseTags && modelValue && modelValue.length > maxCollapseTags\"\n        ref=\"tagTooltipRef\"\n        :disabled=\"!collapseTagsTooltip\"\n        :fallback-placements=\"['bottom', 'top', 'right', 'left']\"\n        :effect=\"effect\"\n        placement=\"bottom\"\n      >\n        <template #default>\n          <div ref=\"collapseItemRef\" :class=\"ns.e('collapse-tag')\">\n            <el-tag\n              :closable=\"false\"\n              :size=\"tagSize\"\n              :type=\"tagType\"\n              :effect=\"tagEffect\"\n              disable-transitions\n            >\n              + {{ modelValue.length - maxCollapseTags }}\n            </el-tag>\n          </div>\n        </template>\n        <template #content>\n          <div :class=\"ns.e('input-tag-list')\">\n            <el-tag\n              v-for=\"(item, index) in collapseTagList\"\n              :key=\"index\"\n              :size=\"tagSize\"\n              :closable=\"closable\"\n              :type=\"tagType\"\n              :effect=\"tagEffect\"\n              disable-transitions\n              @close=\"handleRemoveTag(index + maxCollapseTags)\"\n            >\n              <slot name=\"tag\" :value=\"item\" :index=\"index + maxCollapseTags\">\n                {{ item }}\n              </slot>\n            </el-tag>\n          </div>\n        </template>\n      </el-tooltip>\n      <div :class=\"ns.e('input-wrapper')\">\n        <input\n          :id=\"inputId\"\n          ref=\"inputRef\"\n          v-model=\"inputValue\"\n          v-bind=\"attrs\"\n          type=\"text\"\n          :minlength=\"minlength\"\n          :maxlength=\"maxlength\"\n          :disabled=\"disabled\"\n          :readonly=\"readonly\"\n          :autocomplete=\"autocomplete\"\n          :tabindex=\"tabindex\"\n          :placeholder=\"placeholder\"\n          :autofocus=\"autofocus\"\n          :ariaLabel=\"ariaLabel\"\n          :class=\"ns.e('input')\"\n          :style=\"inputStyle\"\n          @compositionstart=\"handleCompositionStart\"\n          @compositionupdate=\"handleCompositionUpdate\"\n          @compositionend=\"handleCompositionEnd\"\n          @paste=\"handlePaste\"\n          @input=\"handleInput\"\n          @keydown=\"handleKeydown\"\n          @keyup=\"handleKeyup\"\n        />\n        <span\n          ref=\"calculatorRef\"\n          aria-hidden=\"true\"\n          :class=\"ns.e('input-calculator')\"\n          v-text=\"inputValue\"\n        />\n      </div>\n      <div\n        v-show=\"showDropIndicator\"\n        ref=\"dropIndicatorRef\"\n        :class=\"ns.e('drop-indicator')\"\n      />\n    </div>\n    <div v-if=\"showSuffix\" :class=\"ns.e('suffix')\">\n      <slot name=\"suffix\" />\n      <el-icon\n        v-if=\"showClear\"\n        :class=\"[ns.e('icon'), ns.e('clear')]\"\n        @mousedown.prevent=\"NOOP\"\n        @click=\"handleClear\"\n      >\n        <component :is=\"clearIcon\" />\n      </el-icon>\n      <el-icon\n        v-if=\"validateState && validateIcon && needStatusIcon\"\n        :class=\"[\n          nsInput.e('icon'),\n          nsInput.e('validateIcon'),\n          nsInput.is('loading', validateState === 'validating'),\n        ]\"\n      >\n        <component :is=\"validateIcon\" />\n      </el-icon>\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, markRaw, useSlots } from 'vue'\nimport { useAttrs, useCalcInputWidth } from '@element-plus/hooks'\nimport { NOOP, ValidateComponentsMap } from '@element-plus/utils'\nimport { CircleClose } from '@element-plus/icons-vue'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport ElIcon from '@element-plus/components/icon'\nimport ElTag from '@element-plus/components/tag'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { inputTagEmits } from './input-tag'\nimport {\n  useDragTag,\n  useHovering,\n  useInputTag,\n  useInputTagDom,\n} from './composables'\n\nimport type { InputTagProps } from './input-tag'\n\ndefineOptions({\n  name: 'ElInputTag',\n  inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<InputTagProps>(), {\n  tagType: 'info',\n  tagEffect: 'light',\n  effect: 'light',\n  trigger: 'Enter',\n  delimiter: '',\n  clearIcon: markRaw(CircleClose),\n  disabled: undefined,\n  validateEvent: true,\n  id: undefined,\n  tabindex: 0,\n  autocomplete: 'off',\n  saveOnBlur: true,\n  maxCollapseTags: 1,\n})\nconst emit = defineEmits(inputTagEmits)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\nconst { form, formItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, { formItemContext: formItem })\n\nconst needStatusIcon = computed(() => form?.statusIcon ?? false)\nconst validateState = computed(() => formItem?.validateState || '')\nconst validateIcon = computed(() => {\n  return validateState.value && ValidateComponentsMap[validateState.value]\n})\n\nconst {\n  inputRef,\n  wrapperRef,\n  tagTooltipRef,\n  isFocused,\n  inputValue,\n  size,\n  tagSize,\n  placeholder,\n  closable,\n  disabled,\n  showTagList,\n  collapseTagList,\n  handleDragged,\n  handlePaste,\n  handleInput,\n  handleKeydown,\n  handleKeyup,\n  handleRemoveTag,\n  handleClear,\n  handleCompositionStart,\n  handleCompositionUpdate,\n  handleCompositionEnd,\n  focus,\n  blur,\n} = useInputTag({ props, emit, formItem })\nconst { hovering, handleMouseEnter, handleMouseLeave } = useHovering()\nconst { calculatorRef, inputStyle } = useCalcInputWidth()\nconst {\n  dropIndicatorRef,\n  showDropIndicator,\n  handleDragStart,\n  handleDragOver,\n  handleDragEnd,\n} = useDragTag({ wrapperRef, handleDragged, afterDragged: focus })\nconst {\n  ns,\n  nsInput,\n  containerKls,\n  containerStyle,\n  innerKls,\n  showClear,\n  showSuffix,\n  tagStyle,\n  collapseItemRef,\n  innerRef,\n} = useInputTagDom({\n  props,\n  hovering,\n  isFocused,\n  inputValue,\n  disabled,\n  size,\n  validateState,\n  validateIcon,\n  needStatusIcon,\n})\n\ndefineExpose({\n  focus,\n  blur,\n})\n</script>\n"],"mappings":""}