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.

0 lines
5.8 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, inject, computed, ref, onMounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createCommentVNode } from 'vue';\nimport { useResizeObserver } from '@vueuse/core';\nimport { selectKey } from './token.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nconst _sfc_main = defineComponent({\n name: \"ElSelectDropdown\",\n componentName: \"ElSelectDropdown\",\n setup() {\n const select = inject(selectKey);\n const ns = useNamespace(\"select\");\n const popperClass = computed(() => select.props.popperClass);\n const isMultiple = computed(() => select.props.multiple);\n const isFitInputWidth = computed(() => select.props.fitInputWidth);\n const minWidth = ref(\"\");\n function updateMinWidth() {\n var _a;\n minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;\n }\n onMounted(() => {\n updateMinWidth();\n useResizeObserver(select.selectRef, updateMinWidth);\n });\n return {\n ns,\n minWidth,\n popperClass,\n isMultiple,\n isFitInputWidth\n };\n }\n});\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", {\n class: normalizeClass([_ctx.ns.b(\"dropdown\"), _ctx.ns.is(\"multiple\", _ctx.isMultiple), _ctx.popperClass]),\n style: normalizeStyle({\n [_ctx.isFitInputWidth ? \"width\" : \"minWidth\"]: _ctx.minWidth\n })\n }, [_ctx.$slots.header ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass(_ctx.ns.be(\"dropdown\", \"header\"))\n }, [renderSlot(_ctx.$slots, \"header\")], 2)) : createCommentVNode(\"v-if\", true), renderSlot(_ctx.$slots, \"default\"), _ctx.$slots.footer ? (openBlock(), createElementBlock(\"div\", {\n key: 1,\n class: normalizeClass(_ctx.ns.be(\"dropdown\", \"footer\"))\n }, [renderSlot(_ctx.$slots, \"footer\")], 2)) : createCommentVNode(\"v-if\", true)], 6);\n}\nvar ElSelectMenu = /* @__PURE__ */_export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__file\", \"select-dropdown.vue\"]]);\nexport { ElSelectMenu as default };","map":{"version":3,"names":["_sfc_main","defineComponent","name","componentName","setup","select","inject","selectKey","ns","useNamespace","popperClass","computed","props","isMultiple","multiple","isFitInputWidth","fitInputWidth","minWidth","ref","updateMinWidth","_a","value","selectRef","offsetWidth","onMounted","useResizeObserver","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","openBlock","createElementBlock","class","normalizeClass","b","is","style","normalizeStyle","$slots","header","be","renderSlot","createCommentVNode","footer","ElSelectMenu","_export_sfc"],"sources":["../../../../../../packages/components/select/src/select-dropdown.vue"],"sourcesContent":["<template>\n <div\n :class=\"[ns.b('dropdown'), ns.is('multiple', isMultiple), popperClass]\"\n :style=\"{ [isFitInputWidth ? 'width' : 'minWidth']: minWidth }\"\n >\n <div v-if=\"$slots.header\" :class=\"ns.be('dropdown', 'header')\">\n <slot name=\"header\" />\n </div>\n <slot />\n <div v-if=\"$slots.footer\" :class=\"ns.be('dropdown', 'footer')\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, inject, onMounted, ref } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { useNamespace } from '@element-plus/hooks'\nimport { selectKey } from './token'\n\nexport default defineComponent({\n name: 'ElSelectDropdown',\n\n componentName: 'ElSelectDropdown',\n\n setup() {\n const select = inject(selectKey)!\n const ns = useNamespace('select')\n\n // computed\n const popperClass = computed(() => select.props.popperClass)\n const isMultiple = computed(() => select.props.multiple)\n const isFitInputWidth = computed(() => select.props.fitInputWidth)\n const minWidth = ref(''