UNPKG

code-monkey-ui

Version:

A Component Library for Vue 3

46 lines (43 loc) 1.82 kB
import { defineComponent, inject, computed, ref, onMounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from 'vue'; import { useResizeObserver } from '@vueuse/core'; import '../../../hooks/index.mjs'; import { dshSelectKey } from './token.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; import { useNamespace } from '../../../hooks/use-namespace/index.mjs'; const _sfc_main = defineComponent({ name: "ElDshSelectDropdown", componentName: "ElDshSelectDropdown", setup() { const select = inject(dshSelectKey); const ns = useNamespace("dsh-select"); const popperClass = computed(() => select.props.popperClass); const isMultiple = computed(() => select.props.multiple); const isFitInputWidth = computed(() => select.props.fitInputWidth); const minWidth = ref(""); function updateMinWidth() { minWidth.value = "360px"; } onMounted(() => { updateMinWidth(); useResizeObserver(select.selectWrapper, updateMinWidth); }); return { ns, minWidth, popperClass, isMultiple, isFitInputWidth }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", { class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]), style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth }) }, [ renderSlot(_ctx.$slots, "default") ], 6); } var ElDshSelectMenu = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:\\project\\work\\code-monkey-ui\\packages\\components\\dsh-select\\src\\select-dropdown.vue"]]); export { ElDshSelectMenu as default }; //# sourceMappingURL=select-dropdown.mjs.map