{"version":3,"file":"dropdown-item.vue.mjs","sources":["../../../../../../packages/components/dropdown/src/dropdown-item.vue"],"sourcesContent":["<script lang=\"ts\">\n  import {\n    computed,\n    defineComponent,\n    getCurrentInstance,\n    inject,\n    onMounted,\n    onUnmounted\n  } from 'vue'\n  import { getComponentNamespace, getNamespace } from '../../../utils/global-config'\n  import { isUndefined } from '../../../utils/is'\n  import { dropdownContextKey } from './context'\n\n  export default defineComponent({\n    name: getComponentNamespace('DropdownItem'),\n    props: {\n      disabled: {\n        type: Boolean,\n        default: false\n      },\n      command: {\n        type: [String, Number],\n        default: undefined\n      },\n      divided: {\n        type: Boolean,\n        default: false\n      },\n      label: {\n        type: [String, Number, Object],\n        default: undefined\n      }\n    },\n    setup(props) {\n      const ns = getNamespace('dropdown-item')\n      const dropdownContext = inject(dropdownContextKey)\n      const selected = computed(\n        () => dropdownContext?.command === props.command && !isUndefined(props.command)\n      )\n      const cls = computed(() => [\n        ns,\n        props.disabled && 'is-disabled',\n        selected.value && 'is-selected',\n        `${ns}--${dropdownContext?.size}`\n      ])\n      const proxy = getCurrentInstance()?.proxy as any\n      const handleDropdownItem = () => {\n        dropdownContext?.handleDropdownItem(proxy)\n      }\n\n      onMounted(() => {\n        if (!isUndefined(props.command)) {\n          dropdownContext?.dropdownItemCreate(proxy)\n        }\n      })\n\n      onUnmounted(() => {\n        if (!isUndefined(props.command)) {\n          dropdownContext?.dropdownItemDestroy(proxy)\n        }\n      })\n\n      return {\n        ns,\n        cls,\n        handleDropdownItem\n      }\n    }\n  })\n</script>\n\n<template>\n  <div :class=\"cls\" @click=\"handleDropdownItem\">\n    <slot>\n      {{ label }}\n    </slot>\n  </div>\n</template>\n"],"names":["cls","_openBlock","_createElementBlock","_normalizeClass"],"mappings":";;;;AAwEa,SAAA,YAAA,IAAEA,EAAAA,MAAAA,EAAG,MAAA,EAAA,MAAA,EAAA,OAAA,QAAA,EAAA;SAAGC,WAAK,EAAAC,kBAAA;AAAA,IAAA,KAAA;AAAA,IAAA;AAAA,MAAA,KAAA,EAAAC,cAAA,CAAA,IAAA,CAAA,GAAA,CAAA;AAAA,MACtB,OAEO,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,OAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,kBAAA,IAAA,IAAA,CAAA,kBAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,KAAA;AAAA;;;;;;;;;;;;;;;;;"}