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 line
5.9 KiB

{"ast":null,"code":"import { defineComponent, inject, computed, ref, onMounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createCommentVNode } from 'vue';\nimport { useResizeObserver } from '@vueuse/core';\nimport '../../../hooks/index.mjs';\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('')\n\n function updateMinWidth() {\n minWidth.value = `${select.selectRef?.offsetWidth}px`\n }\n\n onMounted(() => {\n // TODO: updatePopper\n // popper.value.update()\n updateMinWidth()\n useResizeObserver(select.sel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