You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.1 KiB
1 lines
6.1 KiB
{"ast":null,"code":"import { useAttrs, useSlots, computed } from 'vue';\nimport { useNamespace } from '../../../../hooks/use-namespace/index.mjs';\nfunction useInputTagDom({\n props,\n isFocused,\n hovering,\n disabled,\n inputValue,\n size,\n validateState,\n validateIcon,\n needStatusIcon\n}) {\n const attrs = useAttrs();\n const slots = useSlots();\n const ns = useNamespace(\"input-tag\");\n const nsInput = useNamespace(\"input\");\n const containerKls = computed(() => [ns.b(), ns.is(\"focused\", isFocused.value), ns.is(\"hovering\", hovering.value), ns.is(\"disabled\", disabled.value), ns.m(size.value), ns.e(\"wrapper\"), attrs.class]);\n const containerStyle = computed(() => [attrs.style]);\n const innerKls = computed(() => {\n var _a, _b;\n return [ns.e(\"inner\"), ns.is(\"draggable\", props.draggable), ns.is(\"left-space\", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix), ns.is(\"right-space\", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)];\n });\n const showClear = computed(() => {\n var _a;\n return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);\n });\n const showSuffix = computed(() => {\n return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;\n });\n return {\n ns,\n nsInput,\n containerKls,\n containerStyle,\n innerKls,\n showClear,\n showSuffix\n };\n}\nexport { useInputTagDom };","map":{"version":3,"names":["useInputTagDom","props","isFocused","hovering","disabled","inputValue","size","validateState","validateIcon","needStatusIcon","attrs","useAttrs","slots","useSlots","ns","useNamespace","nsInput","containerKls","computed","b","is","value","m","e","class","containerStyle","style","innerKls","_a","_b","draggable","modelValue","length","prefix","showSuffix","showClear","clearable","readonly","suffix"],"sources":["../../../../../../../packages/components/input-tag/src/composables/use-input-tag-dom.ts"],"sourcesContent":["import { computed, useAttrs, useSlots } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport type { ComputedRef, Ref, StyleValue } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { InputTagProps } from '../input-tag'\n\ninterface UseInputTagDomOptions {\n props: InputTagProps\n isFocused: Ref<boolean>\n hovering: Ref<boolean>\n disabled: ComputedRef<boolean>\n inputValue: Ref<string | undefined>\n size: ComputedRef<ComponentSize>\n validateState: ComputedRef<string>\n validateIcon: ComputedRef<boolean>\n needStatusIcon: ComputedRef<boolean>\n}\n\nexport function useInputTagDom({\n props,\n isFocused,\n hovering,\n disabled,\n inputValue,\n size,\n validateState,\n validateIcon,\n needStatusIcon,\n}: UseInputTagDomOptions) {\n const attrs = useAttrs()\n const slots = useSlots()\n const ns = useNamespace('input-tag')\n const nsInput = useNamespace('input')\n\n const containerKls = computed(() => [\n ns.b(),\n ns.is('focused', isFocused.value),\n ns.is('hovering', hovering.value),\n ns.is('disabled', disabled.value),\n ns.m(size.value),\n ns.e('wrapper'),\n attrs.class,\n ])\n const containerStyle = computed<StyleValue>(() => [attrs.style as StyleValue])\n const innerKls = computed(() => [\n ns.e('inner'),\n ns.is('draggable', props.draggable),\n ns.is('left-space', !props.modelValue?.length && !slots.prefix),\n ns.is('right-space', !props.modelValue?.length && !showSuffix.value),\n ])\n const showClear = computed(() => {\n return (\n props.clearable &&\n !disabled.value &&\n !props.readonly &&\n (props.modelValue?.length || inputValue.value) &&\n (isFocused.value || hovering.value)\n )\n })\n const showSuffix = computed(() => {\n return (\n slots.suffix ||\n showClear.value ||\n (validateState.value && validateIcon.value && needStatusIcon.value)\n )\n })\n\n return {\n ns,\n nsInput,\n containerKls,\n containerStyle,\n innerKls,\n showClear,\n showSuffix,\n }\n}\n"],"mappings":";;AAEO,SAASA,cAAcA,CAAC;EAC7BC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC,IAAI;EACJC,aAAa;EACbC,YAAY;EACZC;AACF,CAAC,EAAE;EACD,MA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