@mcistudio/unoui-vue 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/alert/Alert.vue.d.ts +67 -0
- package/dist/alert/index.d.ts +40 -0
- package/dist/alert/index.js +2 -0
- package/dist/attrs.d.ts +11 -0
- package/dist/attrs.js +16 -0
- package/dist/attrs.js.map +1 -0
- package/dist/badge/Badge.vue.d.ts +57 -0
- package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
- package/dist/badge/index.d.ts +42 -0
- package/dist/badge/index.js +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/button/Button.vue.d.ts +46 -0
- package/dist/button/ButtonGroup.vue.d.ts +13 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +2 -0
- package/dist/checkbox/Checkbox.vue.d.ts +47 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
- package/dist/checkbox/index.d.ts +30 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
- package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
- package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
- package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
- package/dist/chunks/Table-DhXmuKQd.js +330 -0
- package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/alert-CczW_DKs.js +190 -0
- package/dist/chunks/alert-CczW_DKs.js.map +1 -0
- package/dist/chunks/badge-BHOZeImh.js +287 -0
- package/dist/chunks/badge-BHOZeImh.js.map +1 -0
- package/dist/chunks/button-pDObrN_X.js +168 -0
- package/dist/chunks/button-pDObrN_X.js.map +1 -0
- package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
- package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
- package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
- package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
- package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
- package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
- package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
- package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
- package/dist/chunks/dropdown-0l967g7D.js +329 -0
- package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
- package/dist/chunks/form-Qeqkd-HH.js +642 -0
- package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
- package/dist/chunks/input-BDOXVCrK.js +1281 -0
- package/dist/chunks/input-BDOXVCrK.js.map +1 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
- package/dist/chunks/message-xPfuG0EX.js +107 -0
- package/dist/chunks/message-xPfuG0EX.js.map +1 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
- package/dist/chunks/modal-D6l1iIvE.js +81 -0
- package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
- package/dist/chunks/pagination-Bc583AQX.js +265 -0
- package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
- package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
- package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
- package/dist/chunks/radio-DnYm59xH.js +477 -0
- package/dist/chunks/radio-DnYm59xH.js.map +1 -0
- package/dist/chunks/rate-0sme__Kb.js +309 -0
- package/dist/chunks/rate-0sme__Kb.js.map +1 -0
- package/dist/chunks/select-ChTfQM5u.js +417 -0
- package/dist/chunks/select-ChTfQM5u.js.map +1 -0
- package/dist/chunks/slider-C-W5GzTP.js +724 -0
- package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
- package/dist/chunks/splitter-CgfiXY65.js +524 -0
- package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
- package/dist/chunks/switch-BULGbODP.js +327 -0
- package/dist/chunks/switch-BULGbODP.js.map +1 -0
- package/dist/chunks/tab-Dxfg1_To.js +663 -0
- package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
- package/dist/chunks/tag-BYmNsrZC.js +167 -0
- package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
- package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
- package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
- package/dist/chunks/tooltip-DMhiAqto.js +242 -0
- package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
- package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
- package/dist/colorpicker/color.d.ts +56 -0
- package/dist/colorpicker/color.js +99 -0
- package/dist/colorpicker/color.js.map +1 -0
- package/dist/colorpicker/index.d.ts +12 -0
- package/dist/colorpicker/index.js +2 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +260 -0
- package/dist/config.js.map +1 -0
- package/dist/datepicker/DatePicker.vue.d.ts +82 -0
- package/dist/datepicker/RangePicker.vue.d.ts +87 -0
- package/dist/datepicker/index.d.ts +59 -0
- package/dist/datepicker/index.js +2 -0
- package/dist/drawer/Drawer.vue.d.ts +86 -0
- package/dist/drawer/index.d.ts +23 -0
- package/dist/drawer/index.js +2 -0
- package/dist/dropdown/Dropdown.vue.d.ts +118 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/form/Form.vue.d.ts +170 -0
- package/dist/form/FormItem.vue.d.ts +83 -0
- package/dist/form/index.d.ts +176 -0
- package/dist/form/index.js +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/input/Autocomplete.vue.d.ts +121 -0
- package/dist/input/Input.vue.d.ts +142 -0
- package/dist/input/InputI18n.vue.d.ts +80 -0
- package/dist/input/InputTag.vue.d.ts +114 -0
- package/dist/input/index.d.ts +41 -0
- package/dist/input/index.js +2 -0
- package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
- package/dist/inputOtp/index.d.ts +21 -0
- package/dist/inputOtp/index.js +2 -0
- package/dist/message/MessageContainer.vue.d.ts +11 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +2 -0
- package/dist/message/types.d.ts +25 -0
- package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
- package/dist/millercolumns/index.d.ts +39 -0
- package/dist/millercolumns/index.js +2 -0
- package/dist/modal/Modal.vue.d.ts +54 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/pagination/Pagination.vue.d.ts +70 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +2 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
- package/dist/popconfirm/index.d.ts +36 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/progress/Progress.vue.d.ts +64 -0
- package/dist/progress/index.d.ts +26 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/QRCode.vue.d.ts +87 -0
- package/dist/qrcode/index.d.ts +43 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/qrcode/qr.d.ts +51 -0
- package/dist/qrcode/qrcodegen.d.ts +94 -0
- package/dist/radio/Radio.vue.d.ts +52 -0
- package/dist/radio/RadioGroup.vue.d.ts +44 -0
- package/dist/radio/index.d.ts +55 -0
- package/dist/radio/index.js +2 -0
- package/dist/rate/Rate.vue.d.ts +100 -0
- package/dist/rate/index.d.ts +38 -0
- package/dist/rate/index.js +2 -0
- package/dist/select/Select.vue.d.ts +129 -0
- package/dist/select/index.d.ts +33 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/Skeleton.vue.d.ts +31 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/Slider.vue.d.ts +81 -0
- package/dist/slider/index.d.ts +61 -0
- package/dist/slider/index.js +2 -0
- package/dist/splitter/Splitter.vue.d.ts +63 -0
- package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
- package/dist/splitter/index.d.ts +39 -0
- package/dist/splitter/index.js +2 -0
- package/dist/style.css +2 -0
- package/dist/switch/Switch.vue.d.ts +97 -0
- package/dist/switch/index.d.ts +31 -0
- package/dist/switch/index.js +2 -0
- package/dist/tab/TabPane.vue.d.ts +32 -0
- package/dist/tab/Tabs.vue.d.ts +87 -0
- package/dist/tab/index.d.ts +78 -0
- package/dist/tab/index.js +2 -0
- package/dist/table/Table.vue.d.ts +96 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +2 -0
- package/dist/table/types.d.ts +35 -0
- package/dist/table/types.js +0 -0
- package/dist/tag/Tag.vue.d.ts +46 -0
- package/dist/tag/index.d.ts +11 -0
- package/dist/tag/index.js +2 -0
- package/dist/timepicker/TimePicker.vue.d.ts +92 -0
- package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
- package/dist/timepicker/index.d.ts +39 -0
- package/dist/timepicker/index.js +2 -0
- package/dist/tooltip/Tooltip.vue.d.ts +79 -0
- package/dist/tooltip/index.d.ts +14 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/uno.d.ts +32 -0
- package/dist/uno.js +83 -0
- package/dist/uno.js.map +1 -0
- package/dist/utils/DnD.d.ts +38 -0
- package/package.json +115 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-0l967g7D.js","names":["$slots"],"sources":["../../src/dropdown/Dropdown.vue","../../src/dropdown/Dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SimpleBar from 'simplebar-vue'\n\nimport 'simplebar-vue/dist/simplebar.min.css'\nimport { computed, nextTick, onMounted, onUnmounted, ref, useSlots, useTemplateRef, watch } from 'vue'\n\ntype DropdownItem = object & { disabled?: boolean }\ntype DropdownValue = unknown | unknown[]\ntype DropdownTrigger = 'click' | 'hover' | 'contextMenu'\ntype DropdownPlacement = 'bottomLeft' | 'bottom' | 'bottomRight' | 'topLeft' | 'top' | 'topRight'\ntype OpenChangeSource = 'trigger' | 'menu'\ntype DropdownArrow = boolean | { pointAtCenter?: boolean }\ntype DropdownStyle = string | Record<string, string | number>\n\ninterface TriggerBounds {\n top: number\n bottom: number\n left: number\n right: number\n width: number\n height: number\n}\n\n/**\n * Dropdown 是支持 Teleport、键盘导航和多选值的轻量下拉容器。\n */\nconst props = withDefaults(\n defineProps<{\n /** items 是下拉项数据源,可选;每项可通过 disabled 禁用。 */\n items?: DropdownItem[]\n /** valueKey 是从 item 取值的字段名,可选;为空时使用 item 本身。 */\n valueKey?: string\n /** align 是下拉层水平对齐方式,可选,默认 left。 */\n align?: 'left' | 'right'\n /** placement 是下拉层弹出位置,支持六个常用方位。 */\n placement?: DropdownPlacement\n /** trigger 是触发方式,可组合 click、hover、contextMenu。 */\n trigger?: DropdownTrigger | DropdownTrigger[]\n /** arrow 控制是否显示箭头,可用 pointAtCenter 让箭头指向触发器中心。 */\n arrow?: DropdownArrow\n /** autoAdjustOverflow 控制空间不足时是否自动翻转并限制视口溢出。 */\n autoAdjustOverflow?: boolean\n /** disabled 表示禁用触发器打开行为。 */\n disabled?: boolean\n /** destroyOnHidden 控制关闭后是否销毁下拉层 DOM,默认保留本地旧行为。 */\n destroyOnHidden?: boolean\n /** closeOnSelect 控制选中后是否关闭;未设置时单选关闭、多选保持展开。 */\n closeOnSelect?: boolean\n /** minWidth 是下拉层最小宽度,可选,需为 CSS 长度。 */\n minWidth?: string\n /** width 是下拉层固定宽度,可选,需为 CSS 长度。 */\n width?: string\n /** maxHeight 是滚动区域最大高度,可选,默认 320px。 */\n maxHeight?: string\n /** contentClass 是下拉层额外类名,可选。 */\n contentClass?: string\n /** popupStyle 是浮层额外内联样式。 */\n popupStyle?: DropdownStyle\n /** focusOnOpen 控制打开后是否自动聚焦菜单容器,输入型触发器需要关闭。 */\n focusOnOpen?: boolean\n /** fullWidth 控制触发器容器是否撑满父级,表单控件型下拉可开启。 */\n fullWidth?: boolean\n }>(),\n {\n align: 'left',\n trigger: 'click',\n arrow: false,\n autoAdjustOverflow: true,\n disabled: false,\n destroyOnHidden: true,\n minWidth: '128px',\n maxHeight: '320px',\n focusOnOpen: true,\n fullWidth: false\n }\n)\n\nconst value = defineModel<DropdownValue>('value')\nconst isOpen = defineModel<boolean>('open', { default: false })\nconst slots = useSlots()\nconst dropdownRef = useTemplateRef('dropdownRef')\nconst menuContainerRef = useTemplateRef('menuContainerRef')\nconst menuRef = useTemplateRef('menuRef')\nconst activeIndex = ref(-1)\nconst keyboardNavigationActive = ref(false)\nconst menuTop = ref<number | null>(null)\nconst menuScrollMaxHeight = ref(props.maxHeight)\nconst menuMeasuredWidth = ref<number | null>(null)\nconst menuGap = 4\nconst viewportPadding = 8\nconst arrowSize = 8\nlet positionFrame = 0\nlet positionUpdateId = 0\nlet shouldRefreshTriggerBounds = false\nlet latestOpenChangeSource: OpenChangeSource = 'trigger'\nlet triggerResizeObserver: ResizeObserver | null = null\nlet hoverOpenTimer: number | undefined\n\nconst triggerBounds = ref<TriggerBounds>({\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0\n})\nconst activePlacement = ref<DropdownPlacement>(props.placement ?? (props.align === 'right' ? 'bottomRight' : 'bottomLeft'))\nconst contextMenuPoint = ref<{ left: number; top: number } | null>(null)\n\nconst getTriggerBounds = (): TriggerBounds | null => {\n const triggerEl = dropdownRef.value\n if (!triggerEl) return null\n\n const rect = triggerEl.getBoundingClientRect()\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: rect.left,\n right: rect.right,\n width: rect.width,\n height: rect.height\n }\n}\n\n// 触发器在普通文档流中,下拉层通过 Teleport 固定到 body,需要缓存触发器的视口坐标。\nconst updateTriggerBounds = () => {\n const bounds = getTriggerBounds()\n if (bounds) triggerBounds.value = bounds\n}\n\nconst parsePixelLength = (value?: string) => {\n const match = value?.match(/^(\\d+(?:\\.\\d+)?)px$/)\n return match ? Number(match[1]) : undefined\n}\n\nconst normalizePlacement = (): DropdownPlacement => props.placement ?? (props.align === 'right' ? 'bottomRight' : 'bottomLeft')\n\nconst normalizedTriggers = computed<DropdownTrigger[]>(() => (Array.isArray(props.trigger) ? props.trigger : [props.trigger]))\nconst shouldRenderMenu = computed(() => isOpen.value || !props.destroyOnHidden)\nconst hasArrow = computed(() => Boolean(props.arrow))\nconst arrowPointAtCenter = computed(() => typeof props.arrow === 'object' && Boolean(props.arrow.pointAtCenter))\n\nconst normalizeStyleValue = (style?: DropdownStyle) => {\n if (!style) return {}\n if (typeof style === 'string') return style\n return style\n}\n\nconst extraPopupStyle = computed(() => normalizeStyleValue(props.popupStyle))\n\nconst getAlignment = (placement: DropdownPlacement) => {\n if (placement.endsWith('Left')) return 'left'\n if (placement.endsWith('Right')) return 'right'\n return 'center'\n}\n\nconst getVerticalPlacement = (placement: DropdownPlacement) => (placement.startsWith('top') ? 'top' : 'bottom')\n\nconst getOppositePlacement = (placement: DropdownPlacement): DropdownPlacement => {\n const alignment = getAlignment(placement)\n const isTop = placement.startsWith('top')\n if (alignment === 'left') return isTop ? 'bottomLeft' : 'topLeft'\n if (alignment === 'right') return isTop ? 'bottomRight' : 'topRight'\n return isTop ? 'bottom' : 'top'\n}\n\nconst getHorizontalPosition = (placement: DropdownPlacement, anchorBounds: TriggerBounds, menuWidth: number) => {\n if (contextMenuPoint.value) return contextMenuPoint.value.left\n const alignment = getAlignment(placement)\n if (alignment === 'center') return anchorBounds.left + (anchorBounds.width - menuWidth) / 2\n if (alignment === 'right') return anchorBounds.right - menuWidth\n return anchorBounds.left\n}\n\nconst getAnchorBounds = (): TriggerBounds => {\n if (!contextMenuPoint.value) return triggerBounds.value\n const { left, top } = contextMenuPoint.value\n return {\n top,\n bottom: top,\n left,\n right: left,\n width: 0,\n height: 0\n }\n}\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(value, max))\n\nconst getClampedLeft = (left: number, menuWidth: number, viewportWidth: number) => {\n if (!props.autoAdjustOverflow) return left\n const maxLeft = Math.max(viewportPadding, viewportWidth - menuWidth - viewportPadding)\n return clamp(left, viewportPadding, maxLeft)\n}\n\nconst getArrowLeft = (menuLeft: number, menuWidth: number) => {\n const anchorCenter = contextMenuPoint.value ? contextMenuPoint.value.left : triggerBounds.value.left + triggerBounds.value.width / 2\n if (arrowPointAtCenter.value) return clamp(anchorCenter - menuLeft - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n const alignment = getAlignment(activePlacement.value)\n if (alignment === 'center') return clamp(menuWidth / 2 - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n return clamp(anchorCenter - menuLeft - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n}\n\nconst menuStyle = computed(() => {\n const anchorBounds = getAnchorBounds()\n const expectedWidth = menuMeasuredWidth.value ?? parsePixelLength(props.width) ?? parsePixelLength(props.minWidth) ?? 0\n const viewportWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const menuWidth = expectedWidth || anchorBounds.width || parsePixelLength(props.minWidth) || 128\n const rawLeft = getHorizontalPosition(activePlacement.value, anchorBounds, menuWidth)\n const style: Record<string, string | number> = {\n position: 'fixed',\n top: `${menuTop.value ?? anchorBounds.bottom + menuGap}px`,\n left: `${getClampedLeft(rawLeft, menuWidth, viewportWidth)}px`,\n minWidth: props.minWidth,\n maxWidth: props.autoAdjustOverflow ? `calc(100vw - ${viewportPadding * 2}px)` : 'none',\n zIndex: 2000\n }\n\n if (props.width) {\n style.width = props.width\n }\n\n return style\n})\n\nconst arrowStyle = computed(() => {\n const menuWidth = menuMeasuredWidth.value ?? parsePixelLength(props.width) ?? parsePixelLength(props.minWidth) ?? triggerBounds.value.width ?? 128\n const menuLeft = parseFloat(String(menuStyle.value.left || '0'))\n return {\n left: `${getArrowLeft(menuLeft, menuWidth)}px`\n }\n})\n\nconst arrowClass = computed(() => (getVerticalPlacement(activePlacement.value) === 'top' ? 'bottom-[-4px] border-b border-r' : 'top-[-4px] border-l border-t'))\n\nconst transformOrigin = computed(() => {\n const vertical = getVerticalPlacement(activePlacement.value)\n const alignment = getAlignment(activePlacement.value)\n const x = alignment === 'left' ? 'left' : alignment === 'right' ? 'right' : 'center'\n return `${x} ${vertical === 'top' ? 'bottom' : 'top'}`\n})\n\nconst hasDefaultContent = computed(() => !!slots.default)\nconst menuContentStyle = computed(() => ({ maxHeight: menuScrollMaxHeight.value }))\n\nconst emit = defineEmits<{\n (e: 'select', item: DropdownItem): void\n (e: 'openChange', open: boolean, info: { source: OpenChangeSource }): void\n (e: 'visible-change', open: boolean): void\n (e: 'visibleChange', open: boolean): void\n}>()\n\nconst getMenuElement = () => {\n const current = menuRef.value\n if (!current) return null\n return current instanceof HTMLElement ? current : current.$el || null\n}\n\nconst setOpen = (open: boolean, source: OpenChangeSource = 'trigger') => {\n if (props.disabled && open) return\n latestOpenChangeSource = source\n isOpen.value = open\n}\n\nconst openByTrigger = () => {\n contextMenuPoint.value = null\n activePlacement.value = normalizePlacement()\n setOpen(true, 'trigger')\n}\n\nconst closeByTrigger = () => {\n setOpen(false, 'trigger')\n}\n\nconst toggleByTrigger = () => {\n contextMenuPoint.value = null\n activePlacement.value = normalizePlacement()\n setOpen(!isOpen.value, 'trigger')\n}\n\nconst clearHoverTimers = () => {\n if (hoverOpenTimer !== undefined) {\n window.clearTimeout(hoverOpenTimer)\n hoverOpenTimer = undefined\n }\n}\n\nconst updateMenuPosition = async (refreshTriggerBounds = false) => {\n const updateId = ++positionUpdateId\n if (!isOpen.value) return\n\n menuScrollMaxHeight.value = props.maxHeight\n await nextTick()\n\n const menuEl = menuContainerRef.value\n if (updateId !== positionUpdateId || !isOpen.value || !menuEl) return\n\n if (refreshTriggerBounds) {\n const nextTriggerBounds = getTriggerBounds()\n if (!nextTriggerBounds) return\n triggerBounds.value = nextTriggerBounds\n }\n\n const anchorBounds = getAnchorBounds()\n const placement = activePlacement.value\n const verticalPlacement = getVerticalPlacement(placement)\n const viewportTop = 0\n const viewportBottom = window.innerHeight\n const paddedTop = viewportTop + viewportPadding\n const paddedBottom = viewportBottom - viewportPadding\n const defaultTop = verticalPlacement === 'top' ? anchorBounds.top - menuEl.offsetHeight - menuGap : anchorBounds.bottom + menuGap\n const menuHeight = menuEl.offsetHeight\n menuMeasuredWidth.value = menuEl.offsetWidth\n\n if (!props.autoAdjustOverflow) {\n menuTop.value = defaultTop\n return\n }\n\n const canFitBelow = anchorBounds.bottom + menuGap + menuHeight <= paddedBottom\n const canFitAbove = anchorBounds.top - menuHeight - menuGap >= paddedTop\n\n if (verticalPlacement === 'bottom' && (canFitBelow || !canFitAbove)) {\n menuTop.value = anchorBounds.bottom + menuGap\n return\n }\n\n if (verticalPlacement === 'top' && (canFitAbove || !canFitBelow)) {\n menuTop.value = anchorBounds.top - menuHeight - menuGap\n return\n }\n\n activePlacement.value = getOppositePlacement(placement)\n const nextVerticalPlacement = getVerticalPlacement(activePlacement.value)\n const nextDefaultTop = nextVerticalPlacement === 'top' ? anchorBounds.top - menuHeight - menuGap : anchorBounds.bottom + menuGap\n\n if (nextDefaultTop >= paddedTop && nextDefaultTop + menuHeight <= paddedBottom) {\n menuTop.value = nextDefaultTop\n return\n }\n\n const scrollEl = getMenuElement()\n const nonScrollableHeight = hasDefaultContent.value ? 0 : Math.max(0, menuHeight - (scrollEl?.offsetHeight || 0))\n const availableBelow = Math.max(0, paddedBottom - (anchorBounds.bottom + menuGap))\n const availableAbove = Math.max(0, anchorBounds.top - menuGap - paddedTop)\n const shouldPlaceAbove = nextVerticalPlacement === 'top' ? availableAbove >= availableBelow : availableAbove > availableBelow\n activePlacement.value = shouldPlaceAbove ? (activePlacement.value.endsWith('Right') ? 'topRight' : activePlacement.value.endsWith('Left') ? 'topLeft' : 'top') : activePlacement.value.endsWith('Right') ? 'bottomRight' : activePlacement.value.endsWith('Left') ? 'bottomLeft' : 'bottom'\n const availableHeight = shouldPlaceAbove ? availableAbove : Math.max(availableBelow, paddedBottom - paddedTop)\n\n // 两侧都放不下完整菜单时,压缩滚动区域高度,保留 header/footer 的实际高度。\n menuScrollMaxHeight.value = `${Math.max(0, Math.floor(availableHeight - nonScrollableHeight))}px`\n await nextTick()\n\n if (updateId !== positionUpdateId || !isOpen.value) return\n const nextMenuHeight = menuEl.offsetHeight\n const nextBottomTop = anchorBounds.bottom + menuGap\n menuTop.value = shouldPlaceAbove ? Math.max(paddedTop, anchorBounds.top - nextMenuHeight - menuGap) : Math.min(nextBottomTop, paddedBottom - nextMenuHeight)\n}\n\nconst scheduleMenuPositionUpdate = (options: { refreshTriggerBounds?: boolean } = {}) => {\n if (!isOpen.value) return\n shouldRefreshTriggerBounds ||= Boolean(options.refreshTriggerBounds)\n if (positionFrame) cancelAnimationFrame(positionFrame)\n positionFrame = requestAnimationFrame(() => {\n positionFrame = 0\n const refreshTriggerBounds = shouldRefreshTriggerBounds\n shouldRefreshTriggerBounds = false\n void updateMenuPosition(refreshTriggerBounds)\n })\n}\n\nconst scheduleMenuPositionRefresh = () => scheduleMenuPositionUpdate({ refreshTriggerBounds: true })\n\nconst handleScroll = (event: Event) => {\n const target = event.target\n if (target instanceof Node && menuContainerRef.value?.contains(target)) return\n scheduleMenuPositionRefresh()\n}\n\nconst isTriggerEnabled = (trigger: DropdownTrigger) => !props.disabled && normalizedTriggers.value.includes(trigger)\n\nconst isInsideHoverArea = (target: EventTarget | null) => {\n if (!(target instanceof Node)) return false\n return Boolean(dropdownRef.value?.contains(target) || menuContainerRef.value?.contains(target))\n}\n\nconst handleTriggerClick = () => {\n if (!isTriggerEnabled('click')) return\n toggleByTrigger()\n}\n\nconst handleContextMenu = (event: MouseEvent) => {\n if (!isTriggerEnabled('contextMenu')) return\n event.preventDefault()\n contextMenuPoint.value = { left: event.clientX, top: event.clientY }\n activePlacement.value = normalizePlacement()\n setOpen(true, 'trigger')\n}\n\nconst handleMouseEnter = () => {\n if (!isTriggerEnabled('hover')) return\n clearHoverTimers()\n hoverOpenTimer = window.setTimeout(() => {\n hoverOpenTimer = undefined\n openByTrigger()\n }, 80)\n}\n\nconst handleMouseLeave = (event: MouseEvent) => {\n if (!isTriggerEnabled('hover')) return\n if (hoverOpenTimer !== undefined) {\n window.clearTimeout(hoverOpenTimer)\n hoverOpenTimer = undefined\n }\n if (isInsideHoverArea(event.relatedTarget)) return\n closeByTrigger()\n}\n\nconst getItemValue = (item: DropdownItem) => (props.valueKey ? (item as Record<string, unknown>)[props.valueKey] : item)\n\nconst getIndexByValue = (val: unknown) => {\n if (!props.items) return -1\n return props.items.findIndex((item) => {\n const itemValue = getItemValue(item)\n if (Array.isArray(val)) {\n return val.includes(itemValue)\n }\n return itemValue === val\n })\n}\n\nconst isItemSelected = (item: DropdownItem) => {\n const itemValue = getItemValue(item)\n if (Array.isArray(value.value)) {\n return value.value.includes(itemValue)\n }\n return value.value === itemValue\n}\n\nwatch(isOpen, (val) => {\n keyboardNavigationActive.value = false\n emit('openChange', val, { source: latestOpenChangeSource })\n emit('visible-change', val)\n emit('visibleChange', val)\n if (val) {\n activeIndex.value = getIndexByValue(value.value)\n if (!contextMenuPoint.value) activePlacement.value = normalizePlacement()\n menuTop.value = null\n menuMeasuredWidth.value = null\n if (!contextMenuPoint.value) updateTriggerBounds()\n nextTick(() => {\n scheduleMenuPositionUpdate()\n\n // SimpleBar component's root element or its wrapper\n const el = getMenuElement()\n if (props.focusOnOpen) el?.focus()\n\n // Scroll to active item if exists\n if (activeIndex.value >= 0) {\n const items = el?.querySelectorAll('.dropdown-item-wrapper')\n const activeItem = items?.[activeIndex.value]\n if (activeItem && 'scrollIntoView' in activeItem && typeof activeItem.scrollIntoView === 'function') {\n activeItem.scrollIntoView({ block: 'nearest' })\n }\n }\n })\n } else {\n clearHoverTimers()\n contextMenuPoint.value = null\n shouldRefreshTriggerBounds = false\n menuTop.value = null\n menuMeasuredWidth.value = null\n menuScrollMaxHeight.value = props.maxHeight\n }\n})\n\nwatch(\n () => props.items,\n () => {\n keyboardNavigationActive.value = false\n }\n)\n\nwatch(\n () => [props.items, props.width, props.minWidth, props.maxHeight, props.placement, props.align],\n () => {\n activeIndex.value = getIndexByValue(value.value)\n activePlacement.value = normalizePlacement()\n menuScrollMaxHeight.value = props.maxHeight\n scheduleMenuPositionUpdate()\n }\n)\n\nconst handleKeyDown = (e: KeyboardEvent) => {\n if (!isOpen.value || !props.items?.length) return false\n\n const items = props.items\n const itemCount = items.length\n e.preventDefault()\n e.stopPropagation()\n if (e.code === 'ArrowDown') {\n keyboardNavigationActive.value = true\n activeIndex.value = (activeIndex.value + 1) % itemCount\n } else if (e.code === 'ArrowUp') {\n keyboardNavigationActive.value = true\n activeIndex.value = (activeIndex.value - 1 + itemCount) % itemCount\n } else if (e.code === 'PageDown') {\n keyboardNavigationActive.value = true\n activeIndex.value = Math.min(activeIndex.value + 5, itemCount - 1)\n } else if (e.code === 'PageUp') {\n keyboardNavigationActive.value = true\n activeIndex.value = Math.max(activeIndex.value - 5, 0)\n } else if (e.code === 'Enter' || e.code === 'Space') {\n keyboardNavigationActive.value = true\n if (activeIndex.value >= 0) {\n handleItemClick(items[activeIndex.value])\n return true\n }\n return false\n } else if (e.code === 'Escape') {\n isOpen.value = false\n return true\n }\n\n // 键盘移动后保持当前激活项在 SimpleBar 可视区域内。\n if (activeIndex.value >= 0) {\n nextTick(() => {\n const menuEl = getMenuElement()\n const itemEl = menuEl?.querySelectorAll('.dropdown-item-wrapper')[activeIndex.value]\n if (itemEl && 'scrollIntoView' in itemEl && typeof itemEl.scrollIntoView === 'function') {\n itemEl.scrollIntoView({ block: 'nearest' })\n }\n })\n }\n\n return true\n}\n\nconst handleItemMouseEnter = (index: number) => {\n activeIndex.value = index\n keyboardNavigationActive.value = false\n}\n\nconst handleItemClick = (item: DropdownItem) => {\n if (item?.disabled) return\n\n const isMultiple = Array.isArray(value.value)\n const itemValue = getItemValue(item)\n if (isMultiple && Array.isArray(value.value)) {\n // 数组值表示多选模式,点击同一项时切换选中状态。\n const index = value.value.indexOf(itemValue)\n if (index === -1) {\n value.value = [...value.value, itemValue]\n } else {\n value.value = value.value.filter((v) => v !== itemValue)\n }\n } else {\n // 单选模式选择后立即关闭下拉层,符合菜单选择预期。\n value.value = itemValue\n if (props.closeOnSelect ?? true) setOpen(false, 'menu')\n }\n\n if (isMultiple && props.closeOnSelect) setOpen(false, 'menu')\n emit('select', item)\n}\n\nconst handleClickOutside = (event: PointerEvent) => {\n const target = event.target as Node\n const isOutsideTrigger = dropdownRef.value && !dropdownRef.value.contains(target)\n const isOutsideMenu = menuContainerRef.value && !menuContainerRef.value.contains(target)\n\n if (isOutsideTrigger && isOutsideMenu) {\n closeByTrigger()\n }\n}\n\nonMounted(() => {\n updateTriggerBounds()\n if (isOpen.value) {\n activeIndex.value = getIndexByValue(value.value)\n activePlacement.value = normalizePlacement()\n scheduleMenuPositionUpdate()\n }\n document.addEventListener('pointerdown', handleClickOutside, true)\n document.addEventListener('scroll', handleScroll, true)\n window.addEventListener('resize', scheduleMenuPositionRefresh)\n\n if (typeof ResizeObserver !== 'undefined' && dropdownRef.value) {\n triggerResizeObserver = new ResizeObserver(() => scheduleMenuPositionUpdate())\n triggerResizeObserver.observe(dropdownRef.value)\n }\n})\n\nonUnmounted(() => {\n clearHoverTimers()\n document.removeEventListener('pointerdown', handleClickOutside, true)\n document.removeEventListener('scroll', handleScroll, true)\n window.removeEventListener('resize', scheduleMenuPositionRefresh)\n triggerResizeObserver?.disconnect()\n if (positionFrame) cancelAnimationFrame(positionFrame)\n})\n\ndefineExpose({\n close: () => (isOpen.value = false),\n open: () => (isOpen.value = true),\n handleKeyDown\n})\n</script>\n\n<template>\n <div ref=\"dropdownRef\" :class=\"['relative inline-block', fullWidth ? 'w-full min-w-0' : '', { 'pointer-events-none opacity-50': disabled }]\" @mouseenter=\"handleMouseEnter\" @mouseleave=\"handleMouseLeave\" @contextmenu=\"handleContextMenu\">\n <div :class=\"['h-full flex items-center', fullWidth ? 'w-full min-w-0' : '']\" @click=\"handleTriggerClick\">\n <slot name=\"trigger\" :open=\"isOpen\" />\n </div>\n\n <Teleport to=\"body\">\n <Transition name=\"ui-dropdown-motion\">\n <div\n v-if=\"shouldRenderMenu\"\n v-show=\"isOpen\"\n ref=\"menuContainerRef\"\n :class=\"['fixed bg-primary border border-medium shadow-xl rounded-lg outline-none overflow-hidden', contentClass]\"\n :style=\"[menuStyle, { transformOrigin }, extraPopupStyle]\"\n :data-placement=\"activePlacement\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <span v-if=\"hasArrow\" :class=\"['absolute z-1 size-2 rotate-45 border-medium bg-primary', arrowClass]\" :style=\"arrowStyle\"></span>\n <slot name=\"header\" />\n <slot v-if=\"$slots.default\" />\n <SimpleBar v-else ref=\"menuRef\" tabindex=\"-1\" role=\"menu\" @keydown=\"handleKeyDown\" class=\"outline-none\" :style=\"menuContentStyle\">\n <div\n v-for=\"(item, index) in items\"\n :key=\"index\"\n class=\"dropdown-item-wrapper\"\n :class=\"{ 'is-active': keyboardNavigationActive && index === activeIndex, 'is-selected': isItemSelected(item), 'pointer-events-none opacity-50': item.disabled }\"\n :data-selected=\"isItemSelected(item) ? 'true' : undefined\"\n @mouseenter=\"handleItemMouseEnter(index)\"\n @click=\"handleItemClick(item)\"\n >\n <slot name=\"item\" :item=\"item\" :index=\"index\" :active=\"keyboardNavigationActive && index === activeIndex\" :selected=\"isItemSelected(item)\" />\n </div>\n </SimpleBar>\n <slot name=\"footer\" />\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<style scoped>\n.ui-dropdown-motion-enter-active,\n.ui-dropdown-motion-leave-active {\n transition:\n opacity 120ms cubic-bezier(0.2, 0, 0.2, 1),\n transform 120ms cubic-bezier(0.2, 0, 0.2, 1);\n}\n\n.ui-dropdown-motion-enter-from,\n.ui-dropdown-motion-leave-to {\n opacity: 0;\n transform: scaleY(0.92);\n}\n\n.ui-dropdown-motion-enter-to,\n.ui-dropdown-motion-leave-from {\n opacity: 1;\n transform: scaleY(1);\n}\n\n:deep(.dropdown-item-wrapper),\n:deep(.dropdown-item-wrapper > *) {\n --at-apply: '!text-primary';\n transition-property: color, background-color;\n transition-duration: 150ms;\n}\n\n:deep(.dropdown-item-wrapper:not(.is-selected):hover),\n:deep(.dropdown-item-wrapper:not(.is-selected):hover > *) {\n --at-apply: '!bg-secondary/70';\n}\n\n:deep(.dropdown-item-wrapper.is-selected),\n:deep(.dropdown-item-wrapper.is-selected > *) {\n --at-apply: '!bg-brand/10 !text-brand';\n}\n\n:deep(.dropdown-item-wrapper.is-selected:hover),\n:deep(.dropdown-item-wrapper.is-selected:hover > *) {\n --at-apply: '!bg-brand/15';\n}\n\n:deep(.dropdown-item-wrapper.is-active:not(.is-selected)),\n:deep(.dropdown-item-wrapper.is-active:not(.is-selected) > *) {\n --at-apply: '!bg-brand/10';\n}\n\n:deep(.dropdown-item-wrapper.is-selected.is-active),\n:deep(.dropdown-item-wrapper.is-selected.is-active > *) {\n --at-apply: '!bg-brand/20';\n box-shadow: none !important;\n outline: none !important;\n}\n</style>\n","<script setup lang=\"ts\">\nimport SimpleBar from 'simplebar-vue'\n\nimport 'simplebar-vue/dist/simplebar.min.css'\nimport { computed, nextTick, onMounted, onUnmounted, ref, useSlots, useTemplateRef, watch } from 'vue'\n\ntype DropdownItem = object & { disabled?: boolean }\ntype DropdownValue = unknown | unknown[]\ntype DropdownTrigger = 'click' | 'hover' | 'contextMenu'\ntype DropdownPlacement = 'bottomLeft' | 'bottom' | 'bottomRight' | 'topLeft' | 'top' | 'topRight'\ntype OpenChangeSource = 'trigger' | 'menu'\ntype DropdownArrow = boolean | { pointAtCenter?: boolean }\ntype DropdownStyle = string | Record<string, string | number>\n\ninterface TriggerBounds {\n top: number\n bottom: number\n left: number\n right: number\n width: number\n height: number\n}\n\n/**\n * Dropdown 是支持 Teleport、键盘导航和多选值的轻量下拉容器。\n */\nconst props = withDefaults(\n defineProps<{\n /** items 是下拉项数据源,可选;每项可通过 disabled 禁用。 */\n items?: DropdownItem[]\n /** valueKey 是从 item 取值的字段名,可选;为空时使用 item 本身。 */\n valueKey?: string\n /** align 是下拉层水平对齐方式,可选,默认 left。 */\n align?: 'left' | 'right'\n /** placement 是下拉层弹出位置,支持六个常用方位。 */\n placement?: DropdownPlacement\n /** trigger 是触发方式,可组合 click、hover、contextMenu。 */\n trigger?: DropdownTrigger | DropdownTrigger[]\n /** arrow 控制是否显示箭头,可用 pointAtCenter 让箭头指向触发器中心。 */\n arrow?: DropdownArrow\n /** autoAdjustOverflow 控制空间不足时是否自动翻转并限制视口溢出。 */\n autoAdjustOverflow?: boolean\n /** disabled 表示禁用触发器打开行为。 */\n disabled?: boolean\n /** destroyOnHidden 控制关闭后是否销毁下拉层 DOM,默认保留本地旧行为。 */\n destroyOnHidden?: boolean\n /** closeOnSelect 控制选中后是否关闭;未设置时单选关闭、多选保持展开。 */\n closeOnSelect?: boolean\n /** minWidth 是下拉层最小宽度,可选,需为 CSS 长度。 */\n minWidth?: string\n /** width 是下拉层固定宽度,可选,需为 CSS 长度。 */\n width?: string\n /** maxHeight 是滚动区域最大高度,可选,默认 320px。 */\n maxHeight?: string\n /** contentClass 是下拉层额外类名,可选。 */\n contentClass?: string\n /** popupStyle 是浮层额外内联样式。 */\n popupStyle?: DropdownStyle\n /** focusOnOpen 控制打开后是否自动聚焦菜单容器,输入型触发器需要关闭。 */\n focusOnOpen?: boolean\n /** fullWidth 控制触发器容器是否撑满父级,表单控件型下拉可开启。 */\n fullWidth?: boolean\n }>(),\n {\n align: 'left',\n trigger: 'click',\n arrow: false,\n autoAdjustOverflow: true,\n disabled: false,\n destroyOnHidden: true,\n minWidth: '128px',\n maxHeight: '320px',\n focusOnOpen: true,\n fullWidth: false\n }\n)\n\nconst value = defineModel<DropdownValue>('value')\nconst isOpen = defineModel<boolean>('open', { default: false })\nconst slots = useSlots()\nconst dropdownRef = useTemplateRef('dropdownRef')\nconst menuContainerRef = useTemplateRef('menuContainerRef')\nconst menuRef = useTemplateRef('menuRef')\nconst activeIndex = ref(-1)\nconst keyboardNavigationActive = ref(false)\nconst menuTop = ref<number | null>(null)\nconst menuScrollMaxHeight = ref(props.maxHeight)\nconst menuMeasuredWidth = ref<number | null>(null)\nconst menuGap = 4\nconst viewportPadding = 8\nconst arrowSize = 8\nlet positionFrame = 0\nlet positionUpdateId = 0\nlet shouldRefreshTriggerBounds = false\nlet latestOpenChangeSource: OpenChangeSource = 'trigger'\nlet triggerResizeObserver: ResizeObserver | null = null\nlet hoverOpenTimer: number | undefined\n\nconst triggerBounds = ref<TriggerBounds>({\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0\n})\nconst activePlacement = ref<DropdownPlacement>(props.placement ?? (props.align === 'right' ? 'bottomRight' : 'bottomLeft'))\nconst contextMenuPoint = ref<{ left: number; top: number } | null>(null)\n\nconst getTriggerBounds = (): TriggerBounds | null => {\n const triggerEl = dropdownRef.value\n if (!triggerEl) return null\n\n const rect = triggerEl.getBoundingClientRect()\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: rect.left,\n right: rect.right,\n width: rect.width,\n height: rect.height\n }\n}\n\n// 触发器在普通文档流中,下拉层通过 Teleport 固定到 body,需要缓存触发器的视口坐标。\nconst updateTriggerBounds = () => {\n const bounds = getTriggerBounds()\n if (bounds) triggerBounds.value = bounds\n}\n\nconst parsePixelLength = (value?: string) => {\n const match = value?.match(/^(\\d+(?:\\.\\d+)?)px$/)\n return match ? Number(match[1]) : undefined\n}\n\nconst normalizePlacement = (): DropdownPlacement => props.placement ?? (props.align === 'right' ? 'bottomRight' : 'bottomLeft')\n\nconst normalizedTriggers = computed<DropdownTrigger[]>(() => (Array.isArray(props.trigger) ? props.trigger : [props.trigger]))\nconst shouldRenderMenu = computed(() => isOpen.value || !props.destroyOnHidden)\nconst hasArrow = computed(() => Boolean(props.arrow))\nconst arrowPointAtCenter = computed(() => typeof props.arrow === 'object' && Boolean(props.arrow.pointAtCenter))\n\nconst normalizeStyleValue = (style?: DropdownStyle) => {\n if (!style) return {}\n if (typeof style === 'string') return style\n return style\n}\n\nconst extraPopupStyle = computed(() => normalizeStyleValue(props.popupStyle))\n\nconst getAlignment = (placement: DropdownPlacement) => {\n if (placement.endsWith('Left')) return 'left'\n if (placement.endsWith('Right')) return 'right'\n return 'center'\n}\n\nconst getVerticalPlacement = (placement: DropdownPlacement) => (placement.startsWith('top') ? 'top' : 'bottom')\n\nconst getOppositePlacement = (placement: DropdownPlacement): DropdownPlacement => {\n const alignment = getAlignment(placement)\n const isTop = placement.startsWith('top')\n if (alignment === 'left') return isTop ? 'bottomLeft' : 'topLeft'\n if (alignment === 'right') return isTop ? 'bottomRight' : 'topRight'\n return isTop ? 'bottom' : 'top'\n}\n\nconst getHorizontalPosition = (placement: DropdownPlacement, anchorBounds: TriggerBounds, menuWidth: number) => {\n if (contextMenuPoint.value) return contextMenuPoint.value.left\n const alignment = getAlignment(placement)\n if (alignment === 'center') return anchorBounds.left + (anchorBounds.width - menuWidth) / 2\n if (alignment === 'right') return anchorBounds.right - menuWidth\n return anchorBounds.left\n}\n\nconst getAnchorBounds = (): TriggerBounds => {\n if (!contextMenuPoint.value) return triggerBounds.value\n const { left, top } = contextMenuPoint.value\n return {\n top,\n bottom: top,\n left,\n right: left,\n width: 0,\n height: 0\n }\n}\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(value, max))\n\nconst getClampedLeft = (left: number, menuWidth: number, viewportWidth: number) => {\n if (!props.autoAdjustOverflow) return left\n const maxLeft = Math.max(viewportPadding, viewportWidth - menuWidth - viewportPadding)\n return clamp(left, viewportPadding, maxLeft)\n}\n\nconst getArrowLeft = (menuLeft: number, menuWidth: number) => {\n const anchorCenter = contextMenuPoint.value ? contextMenuPoint.value.left : triggerBounds.value.left + triggerBounds.value.width / 2\n if (arrowPointAtCenter.value) return clamp(anchorCenter - menuLeft - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n const alignment = getAlignment(activePlacement.value)\n if (alignment === 'center') return clamp(menuWidth / 2 - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n return clamp(anchorCenter - menuLeft - arrowSize / 2, arrowSize, Math.max(arrowSize, menuWidth - arrowSize * 2))\n}\n\nconst menuStyle = computed(() => {\n const anchorBounds = getAnchorBounds()\n const expectedWidth = menuMeasuredWidth.value ?? parsePixelLength(props.width) ?? parsePixelLength(props.minWidth) ?? 0\n const viewportWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const menuWidth = expectedWidth || anchorBounds.width || parsePixelLength(props.minWidth) || 128\n const rawLeft = getHorizontalPosition(activePlacement.value, anchorBounds, menuWidth)\n const style: Record<string, string | number> = {\n position: 'fixed',\n top: `${menuTop.value ?? anchorBounds.bottom + menuGap}px`,\n left: `${getClampedLeft(rawLeft, menuWidth, viewportWidth)}px`,\n minWidth: props.minWidth,\n maxWidth: props.autoAdjustOverflow ? `calc(100vw - ${viewportPadding * 2}px)` : 'none',\n zIndex: 2000\n }\n\n if (props.width) {\n style.width = props.width\n }\n\n return style\n})\n\nconst arrowStyle = computed(() => {\n const menuWidth = menuMeasuredWidth.value ?? parsePixelLength(props.width) ?? parsePixelLength(props.minWidth) ?? triggerBounds.value.width ?? 128\n const menuLeft = parseFloat(String(menuStyle.value.left || '0'))\n return {\n left: `${getArrowLeft(menuLeft, menuWidth)}px`\n }\n})\n\nconst arrowClass = computed(() => (getVerticalPlacement(activePlacement.value) === 'top' ? 'bottom-[-4px] border-b border-r' : 'top-[-4px] border-l border-t'))\n\nconst transformOrigin = computed(() => {\n const vertical = getVerticalPlacement(activePlacement.value)\n const alignment = getAlignment(activePlacement.value)\n const x = alignment === 'left' ? 'left' : alignment === 'right' ? 'right' : 'center'\n return `${x} ${vertical === 'top' ? 'bottom' : 'top'}`\n})\n\nconst hasDefaultContent = computed(() => !!slots.default)\nconst menuContentStyle = computed(() => ({ maxHeight: menuScrollMaxHeight.value }))\n\nconst emit = defineEmits<{\n (e: 'select', item: DropdownItem): void\n (e: 'openChange', open: boolean, info: { source: OpenChangeSource }): void\n (e: 'visible-change', open: boolean): void\n (e: 'visibleChange', open: boolean): void\n}>()\n\nconst getMenuElement = () => {\n const current = menuRef.value\n if (!current) return null\n return current instanceof HTMLElement ? current : current.$el || null\n}\n\nconst setOpen = (open: boolean, source: OpenChangeSource = 'trigger') => {\n if (props.disabled && open) return\n latestOpenChangeSource = source\n isOpen.value = open\n}\n\nconst openByTrigger = () => {\n contextMenuPoint.value = null\n activePlacement.value = normalizePlacement()\n setOpen(true, 'trigger')\n}\n\nconst closeByTrigger = () => {\n setOpen(false, 'trigger')\n}\n\nconst toggleByTrigger = () => {\n contextMenuPoint.value = null\n activePlacement.value = normalizePlacement()\n setOpen(!isOpen.value, 'trigger')\n}\n\nconst clearHoverTimers = () => {\n if (hoverOpenTimer !== undefined) {\n window.clearTimeout(hoverOpenTimer)\n hoverOpenTimer = undefined\n }\n}\n\nconst updateMenuPosition = async (refreshTriggerBounds = false) => {\n const updateId = ++positionUpdateId\n if (!isOpen.value) return\n\n menuScrollMaxHeight.value = props.maxHeight\n await nextTick()\n\n const menuEl = menuContainerRef.value\n if (updateId !== positionUpdateId || !isOpen.value || !menuEl) return\n\n if (refreshTriggerBounds) {\n const nextTriggerBounds = getTriggerBounds()\n if (!nextTriggerBounds) return\n triggerBounds.value = nextTriggerBounds\n }\n\n const anchorBounds = getAnchorBounds()\n const placement = activePlacement.value\n const verticalPlacement = getVerticalPlacement(placement)\n const viewportTop = 0\n const viewportBottom = window.innerHeight\n const paddedTop = viewportTop + viewportPadding\n const paddedBottom = viewportBottom - viewportPadding\n const defaultTop = verticalPlacement === 'top' ? anchorBounds.top - menuEl.offsetHeight - menuGap : anchorBounds.bottom + menuGap\n const menuHeight = menuEl.offsetHeight\n menuMeasuredWidth.value = menuEl.offsetWidth\n\n if (!props.autoAdjustOverflow) {\n menuTop.value = defaultTop\n return\n }\n\n const canFitBelow = anchorBounds.bottom + menuGap + menuHeight <= paddedBottom\n const canFitAbove = anchorBounds.top - menuHeight - menuGap >= paddedTop\n\n if (verticalPlacement === 'bottom' && (canFitBelow || !canFitAbove)) {\n menuTop.value = anchorBounds.bottom + menuGap\n return\n }\n\n if (verticalPlacement === 'top' && (canFitAbove || !canFitBelow)) {\n menuTop.value = anchorBounds.top - menuHeight - menuGap\n return\n }\n\n activePlacement.value = getOppositePlacement(placement)\n const nextVerticalPlacement = getVerticalPlacement(activePlacement.value)\n const nextDefaultTop = nextVerticalPlacement === 'top' ? anchorBounds.top - menuHeight - menuGap : anchorBounds.bottom + menuGap\n\n if (nextDefaultTop >= paddedTop && nextDefaultTop + menuHeight <= paddedBottom) {\n menuTop.value = nextDefaultTop\n return\n }\n\n const scrollEl = getMenuElement()\n const nonScrollableHeight = hasDefaultContent.value ? 0 : Math.max(0, menuHeight - (scrollEl?.offsetHeight || 0))\n const availableBelow = Math.max(0, paddedBottom - (anchorBounds.bottom + menuGap))\n const availableAbove = Math.max(0, anchorBounds.top - menuGap - paddedTop)\n const shouldPlaceAbove = nextVerticalPlacement === 'top' ? availableAbove >= availableBelow : availableAbove > availableBelow\n activePlacement.value = shouldPlaceAbove ? (activePlacement.value.endsWith('Right') ? 'topRight' : activePlacement.value.endsWith('Left') ? 'topLeft' : 'top') : activePlacement.value.endsWith('Right') ? 'bottomRight' : activePlacement.value.endsWith('Left') ? 'bottomLeft' : 'bottom'\n const availableHeight = shouldPlaceAbove ? availableAbove : Math.max(availableBelow, paddedBottom - paddedTop)\n\n // 两侧都放不下完整菜单时,压缩滚动区域高度,保留 header/footer 的实际高度。\n menuScrollMaxHeight.value = `${Math.max(0, Math.floor(availableHeight - nonScrollableHeight))}px`\n await nextTick()\n\n if (updateId !== positionUpdateId || !isOpen.value) return\n const nextMenuHeight = menuEl.offsetHeight\n const nextBottomTop = anchorBounds.bottom + menuGap\n menuTop.value = shouldPlaceAbove ? Math.max(paddedTop, anchorBounds.top - nextMenuHeight - menuGap) : Math.min(nextBottomTop, paddedBottom - nextMenuHeight)\n}\n\nconst scheduleMenuPositionUpdate = (options: { refreshTriggerBounds?: boolean } = {}) => {\n if (!isOpen.value) return\n shouldRefreshTriggerBounds ||= Boolean(options.refreshTriggerBounds)\n if (positionFrame) cancelAnimationFrame(positionFrame)\n positionFrame = requestAnimationFrame(() => {\n positionFrame = 0\n const refreshTriggerBounds = shouldRefreshTriggerBounds\n shouldRefreshTriggerBounds = false\n void updateMenuPosition(refreshTriggerBounds)\n })\n}\n\nconst scheduleMenuPositionRefresh = () => scheduleMenuPositionUpdate({ refreshTriggerBounds: true })\n\nconst handleScroll = (event: Event) => {\n const target = event.target\n if (target instanceof Node && menuContainerRef.value?.contains(target)) return\n scheduleMenuPositionRefresh()\n}\n\nconst isTriggerEnabled = (trigger: DropdownTrigger) => !props.disabled && normalizedTriggers.value.includes(trigger)\n\nconst isInsideHoverArea = (target: EventTarget | null) => {\n if (!(target instanceof Node)) return false\n return Boolean(dropdownRef.value?.contains(target) || menuContainerRef.value?.contains(target))\n}\n\nconst handleTriggerClick = () => {\n if (!isTriggerEnabled('click')) return\n toggleByTrigger()\n}\n\nconst handleContextMenu = (event: MouseEvent) => {\n if (!isTriggerEnabled('contextMenu')) return\n event.preventDefault()\n contextMenuPoint.value = { left: event.clientX, top: event.clientY }\n activePlacement.value = normalizePlacement()\n setOpen(true, 'trigger')\n}\n\nconst handleMouseEnter = () => {\n if (!isTriggerEnabled('hover')) return\n clearHoverTimers()\n hoverOpenTimer = window.setTimeout(() => {\n hoverOpenTimer = undefined\n openByTrigger()\n }, 80)\n}\n\nconst handleMouseLeave = (event: MouseEvent) => {\n if (!isTriggerEnabled('hover')) return\n if (hoverOpenTimer !== undefined) {\n window.clearTimeout(hoverOpenTimer)\n hoverOpenTimer = undefined\n }\n if (isInsideHoverArea(event.relatedTarget)) return\n closeByTrigger()\n}\n\nconst getItemValue = (item: DropdownItem) => (props.valueKey ? (item as Record<string, unknown>)[props.valueKey] : item)\n\nconst getIndexByValue = (val: unknown) => {\n if (!props.items) return -1\n return props.items.findIndex((item) => {\n const itemValue = getItemValue(item)\n if (Array.isArray(val)) {\n return val.includes(itemValue)\n }\n return itemValue === val\n })\n}\n\nconst isItemSelected = (item: DropdownItem) => {\n const itemValue = getItemValue(item)\n if (Array.isArray(value.value)) {\n return value.value.includes(itemValue)\n }\n return value.value === itemValue\n}\n\nwatch(isOpen, (val) => {\n keyboardNavigationActive.value = false\n emit('openChange', val, { source: latestOpenChangeSource })\n emit('visible-change', val)\n emit('visibleChange', val)\n if (val) {\n activeIndex.value = getIndexByValue(value.value)\n if (!contextMenuPoint.value) activePlacement.value = normalizePlacement()\n menuTop.value = null\n menuMeasuredWidth.value = null\n if (!contextMenuPoint.value) updateTriggerBounds()\n nextTick(() => {\n scheduleMenuPositionUpdate()\n\n // SimpleBar component's root element or its wrapper\n const el = getMenuElement()\n if (props.focusOnOpen) el?.focus()\n\n // Scroll to active item if exists\n if (activeIndex.value >= 0) {\n const items = el?.querySelectorAll('.dropdown-item-wrapper')\n const activeItem = items?.[activeIndex.value]\n if (activeItem && 'scrollIntoView' in activeItem && typeof activeItem.scrollIntoView === 'function') {\n activeItem.scrollIntoView({ block: 'nearest' })\n }\n }\n })\n } else {\n clearHoverTimers()\n contextMenuPoint.value = null\n shouldRefreshTriggerBounds = false\n menuTop.value = null\n menuMeasuredWidth.value = null\n menuScrollMaxHeight.value = props.maxHeight\n }\n})\n\nwatch(\n () => props.items,\n () => {\n keyboardNavigationActive.value = false\n }\n)\n\nwatch(\n () => [props.items, props.width, props.minWidth, props.maxHeight, props.placement, props.align],\n () => {\n activeIndex.value = getIndexByValue(value.value)\n activePlacement.value = normalizePlacement()\n menuScrollMaxHeight.value = props.maxHeight\n scheduleMenuPositionUpdate()\n }\n)\n\nconst handleKeyDown = (e: KeyboardEvent) => {\n if (!isOpen.value || !props.items?.length) return false\n\n const items = props.items\n const itemCount = items.length\n e.preventDefault()\n e.stopPropagation()\n if (e.code === 'ArrowDown') {\n keyboardNavigationActive.value = true\n activeIndex.value = (activeIndex.value + 1) % itemCount\n } else if (e.code === 'ArrowUp') {\n keyboardNavigationActive.value = true\n activeIndex.value = (activeIndex.value - 1 + itemCount) % itemCount\n } else if (e.code === 'PageDown') {\n keyboardNavigationActive.value = true\n activeIndex.value = Math.min(activeIndex.value + 5, itemCount - 1)\n } else if (e.code === 'PageUp') {\n keyboardNavigationActive.value = true\n activeIndex.value = Math.max(activeIndex.value - 5, 0)\n } else if (e.code === 'Enter' || e.code === 'Space') {\n keyboardNavigationActive.value = true\n if (activeIndex.value >= 0) {\n handleItemClick(items[activeIndex.value])\n return true\n }\n return false\n } else if (e.code === 'Escape') {\n isOpen.value = false\n return true\n }\n\n // 键盘移动后保持当前激活项在 SimpleBar 可视区域内。\n if (activeIndex.value >= 0) {\n nextTick(() => {\n const menuEl = getMenuElement()\n const itemEl = menuEl?.querySelectorAll('.dropdown-item-wrapper')[activeIndex.value]\n if (itemEl && 'scrollIntoView' in itemEl && typeof itemEl.scrollIntoView === 'function') {\n itemEl.scrollIntoView({ block: 'nearest' })\n }\n })\n }\n\n return true\n}\n\nconst handleItemMouseEnter = (index: number) => {\n activeIndex.value = index\n keyboardNavigationActive.value = false\n}\n\nconst handleItemClick = (item: DropdownItem) => {\n if (item?.disabled) return\n\n const isMultiple = Array.isArray(value.value)\n const itemValue = getItemValue(item)\n if (isMultiple && Array.isArray(value.value)) {\n // 数组值表示多选模式,点击同一项时切换选中状态。\n const index = value.value.indexOf(itemValue)\n if (index === -1) {\n value.value = [...value.value, itemValue]\n } else {\n value.value = value.value.filter((v) => v !== itemValue)\n }\n } else {\n // 单选模式选择后立即关闭下拉层,符合菜单选择预期。\n value.value = itemValue\n if (props.closeOnSelect ?? true) setOpen(false, 'menu')\n }\n\n if (isMultiple && props.closeOnSelect) setOpen(false, 'menu')\n emit('select', item)\n}\n\nconst handleClickOutside = (event: PointerEvent) => {\n const target = event.target as Node\n const isOutsideTrigger = dropdownRef.value && !dropdownRef.value.contains(target)\n const isOutsideMenu = menuContainerRef.value && !menuContainerRef.value.contains(target)\n\n if (isOutsideTrigger && isOutsideMenu) {\n closeByTrigger()\n }\n}\n\nonMounted(() => {\n updateTriggerBounds()\n if (isOpen.value) {\n activeIndex.value = getIndexByValue(value.value)\n activePlacement.value = normalizePlacement()\n scheduleMenuPositionUpdate()\n }\n document.addEventListener('pointerdown', handleClickOutside, true)\n document.addEventListener('scroll', handleScroll, true)\n window.addEventListener('resize', scheduleMenuPositionRefresh)\n\n if (typeof ResizeObserver !== 'undefined' && dropdownRef.value) {\n triggerResizeObserver = new ResizeObserver(() => scheduleMenuPositionUpdate())\n triggerResizeObserver.observe(dropdownRef.value)\n }\n})\n\nonUnmounted(() => {\n clearHoverTimers()\n document.removeEventListener('pointerdown', handleClickOutside, true)\n document.removeEventListener('scroll', handleScroll, true)\n window.removeEventListener('resize', scheduleMenuPositionRefresh)\n triggerResizeObserver?.disconnect()\n if (positionFrame) cancelAnimationFrame(positionFrame)\n})\n\ndefineExpose({\n close: () => (isOpen.value = false),\n open: () => (isOpen.value = true),\n handleKeyDown\n})\n</script>\n\n<template>\n <div ref=\"dropdownRef\" :class=\"['relative inline-block', fullWidth ? 'w-full min-w-0' : '', { 'pointer-events-none opacity-50': disabled }]\" @mouseenter=\"handleMouseEnter\" @mouseleave=\"handleMouseLeave\" @contextmenu=\"handleContextMenu\">\n <div :class=\"['h-full flex items-center', fullWidth ? 'w-full min-w-0' : '']\" @click=\"handleTriggerClick\">\n <slot name=\"trigger\" :open=\"isOpen\" />\n </div>\n\n <Teleport to=\"body\">\n <Transition name=\"ui-dropdown-motion\">\n <div\n v-if=\"shouldRenderMenu\"\n v-show=\"isOpen\"\n ref=\"menuContainerRef\"\n :class=\"['fixed bg-primary border border-medium shadow-xl rounded-lg outline-none overflow-hidden', contentClass]\"\n :style=\"[menuStyle, { transformOrigin }, extraPopupStyle]\"\n :data-placement=\"activePlacement\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <span v-if=\"hasArrow\" :class=\"['absolute z-1 size-2 rotate-45 border-medium bg-primary', arrowClass]\" :style=\"arrowStyle\"></span>\n <slot name=\"header\" />\n <slot v-if=\"$slots.default\" />\n <SimpleBar v-else ref=\"menuRef\" tabindex=\"-1\" role=\"menu\" @keydown=\"handleKeyDown\" class=\"outline-none\" :style=\"menuContentStyle\">\n <div\n v-for=\"(item, index) in items\"\n :key=\"index\"\n class=\"dropdown-item-wrapper\"\n :class=\"{ 'is-active': keyboardNavigationActive && index === activeIndex, 'is-selected': isItemSelected(item), 'pointer-events-none opacity-50': item.disabled }\"\n :data-selected=\"isItemSelected(item) ? 'true' : undefined\"\n @mouseenter=\"handleItemMouseEnter(index)\"\n @click=\"handleItemClick(item)\"\n >\n <slot name=\"item\" :item=\"item\" :index=\"index\" :active=\"keyboardNavigationActive && index === activeIndex\" :selected=\"isItemSelected(item)\" />\n </div>\n </SimpleBar>\n <slot name=\"footer\" />\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<style scoped>\n.ui-dropdown-motion-enter-active,\n.ui-dropdown-motion-leave-active {\n transition:\n opacity 120ms cubic-bezier(0.2, 0, 0.2, 1),\n transform 120ms cubic-bezier(0.2, 0, 0.2, 1);\n}\n\n.ui-dropdown-motion-enter-from,\n.ui-dropdown-motion-leave-to {\n opacity: 0;\n transform: scaleY(0.92);\n}\n\n.ui-dropdown-motion-enter-to,\n.ui-dropdown-motion-leave-from {\n opacity: 1;\n transform: scaleY(1);\n}\n\n:deep(.dropdown-item-wrapper),\n:deep(.dropdown-item-wrapper > *) {\n --at-apply: '!text-primary';\n transition-property: color, background-color;\n transition-duration: 150ms;\n}\n\n:deep(.dropdown-item-wrapper:not(.is-selected):hover),\n:deep(.dropdown-item-wrapper:not(.is-selected):hover > *) {\n --at-apply: '!bg-secondary/70';\n}\n\n:deep(.dropdown-item-wrapper.is-selected),\n:deep(.dropdown-item-wrapper.is-selected > *) {\n --at-apply: '!bg-brand/10 !text-brand';\n}\n\n:deep(.dropdown-item-wrapper.is-selected:hover),\n:deep(.dropdown-item-wrapper.is-selected:hover > *) {\n --at-apply: '!bg-brand/15';\n}\n\n:deep(.dropdown-item-wrapper.is-active:not(.is-selected)),\n:deep(.dropdown-item-wrapper.is-active:not(.is-selected) > *) {\n --at-apply: '!bg-brand/10';\n}\n\n:deep(.dropdown-item-wrapper.is-selected.is-active),\n:deep(.dropdown-item-wrapper.is-selected.is-active > *) {\n --at-apply: '!bg-brand/20';\n box-shadow: none !important;\n outline: none !important;\n}\n</style>\n"],"mappings":";;;;;;;;;GAwFM,IAAU,GACV,IAAkB,GAClB,IAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhElB,IAAM,IAAQ,GAmDR,IAAQ,GAA0B,GAAC,OAAO,GAC1C,IAAS,GAAoB,GAAC,MAA0B,GACxD,KAAQ,GAAS,GACjB,IAAc,EAAe,aAAa,GAC1C,IAAmB,EAAe,kBAAkB,GACpD,KAAU,EAAe,SAAS,GAClC,IAAc,EAAI,EAAE,GACpB,IAA2B,EAAI,EAAK,GACpC,IAAU,EAAmB,IAAI,GACjC,IAAsB,EAAI,EAAM,SAAS,GACzC,IAAoB,EAAmB,IAAI,GAI7C,IAAgB,GAChB,IAAmB,GACnB,IAA6B,IAC7B,KAA2C,WAC3C,IAA+C,MAC/C,GAEE,IAAgB,EAAmB;GACvC,KAAK;GACL,QAAQ;GACR,MAAM;GACN,OAAO;GACP,OAAO;GACP,QAAQ;EACV,CAAC,GACK,IAAkB,EAAuB,EAAM,cAAc,EAAM,UAAU,UAAU,gBAAgB,aAAa,GACpH,IAAmB,EAA0C,IAAI,GAEjE,WAA+C;GACnD,IAAM,IAAY,EAAY;GAC9B,IAAI,CAAC,GAAW,OAAO;GAEvB,IAAM,IAAO,EAAU,sBAAsB;GAC7C,OAAO;IACL,KAAK,EAAK;IACV,QAAQ,EAAK;IACb,MAAM,EAAK;IACX,OAAO,EAAK;IACZ,OAAO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