@element-plus/nightly 0.0.20260716 → 0.0.20260717

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.
Files changed (70) hide show
  1. package/es/component.mjs +3 -3
  2. package/es/components/autocomplete/src/autocomplete.d.ts +1 -1
  3. package/es/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.mjs +1 -1
  4. package/es/components/color-picker/src/color-picker.vue_vue_type_script_setup_true_lang.mjs +1 -1
  5. package/es/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.mjs +1 -1
  6. package/es/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue_vue_type_script_setup_true_lang.mjs +1 -1
  7. package/es/components/date-picker-panel/src/date-picker-com/panel-date-range.vue_vue_type_script_setup_true_lang.mjs +1 -1
  8. package/es/components/index.mjs +6 -6
  9. package/es/components/input/src/input.d.ts +1 -1
  10. package/es/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.mjs +1 -1
  11. package/es/components/mention/src/mention.d.ts +1 -1
  12. package/es/components/menu/src/menu.mjs +1 -1
  13. package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs +1 -1
  14. package/es/components/pagination/src/pagination.d.ts +1 -1
  15. package/es/components/select/src/select.vue_vue_type_script_lang.mjs +1 -1
  16. package/es/components/select-v2/src/select.vue_vue_type_script_lang.mjs +1 -1
  17. package/es/components/slider/src/button.vue.d.ts +1 -1
  18. package/es/components/slider/src/slider.vue.d.ts +1 -1
  19. package/es/components/table/src/table.vue_vue_type_script_setup_true_lang.mjs +1 -1
  20. package/es/components/time-picker/src/time-picker-com/basic-time-spinner.vue_vue_type_script_setup_true_lang.mjs +1 -1
  21. package/es/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
  22. package/es/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
  23. package/es/components/virtual-list/src/components/scrollbar.d.ts +1 -1
  24. package/es/index.mjs +11 -11
  25. package/es/plugin.mjs +1 -1
  26. package/es/version.d.ts +1 -1
  27. package/es/version.mjs +1 -1
  28. package/es/version.mjs.map +1 -1
  29. package/lib/component.js +109 -109
  30. package/lib/components/autocomplete/src/autocomplete.d.ts +1 -1
  31. package/lib/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.js +26 -26
  32. package/lib/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/lib/components/color-picker/src/color-picker.vue_vue_type_script_setup_true_lang.js +18 -18
  34. package/lib/components/color-picker/src/color-picker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/lib/components/countdown/src/countdown.vue_vue_type_script_setup_true_lang.js +1 -1
  36. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue_vue_type_script_setup_true_lang.js +18 -18
  37. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue_vue_type_script_setup_true_lang.js.map +1 -1
  38. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-range.vue_vue_type_script_setup_true_lang.js +23 -23
  39. package/lib/components/date-picker-panel/src/date-picker-com/panel-date-range.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/lib/components/index.js +125 -125
  41. package/lib/components/input/src/input.d.ts +1 -1
  42. package/lib/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.js +12 -12
  43. package/lib/components/input-number/src/input-number.vue_vue_type_script_setup_true_lang.js.map +1 -1
  44. package/lib/components/mention/src/mention.d.ts +1 -1
  45. package/lib/components/menu/src/menu.js +7 -7
  46. package/lib/components/menu/src/menu.js.map +1 -1
  47. package/lib/components/message-box/src/index.vue_vue_type_script_lang.js +19 -19
  48. package/lib/components/message-box/src/index.vue_vue_type_script_lang.js.map +1 -1
  49. package/lib/components/pagination/src/pagination.d.ts +1 -1
  50. package/lib/components/select/src/select.vue_vue_type_script_lang.js +10 -10
  51. package/lib/components/select/src/select.vue_vue_type_script_lang.js.map +1 -1
  52. package/lib/components/select-v2/src/select.vue_vue_type_script_lang.js +10 -10
  53. package/lib/components/select-v2/src/select.vue_vue_type_script_lang.js.map +1 -1
  54. package/lib/components/slider/src/button.vue.d.ts +1 -1
  55. package/lib/components/slider/src/slider.vue.d.ts +1 -1
  56. package/lib/components/table/src/table.vue_vue_type_script_setup_true_lang.js +9 -9
  57. package/lib/components/table/src/table.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.vue_vue_type_script_setup_true_lang.js +10 -10
  59. package/lib/components/time-picker/src/time-picker-com/basic-time-spinner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  60. package/lib/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
  61. package/lib/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
  62. package/lib/components/virtual-list/src/components/scrollbar.d.ts +1 -1
  63. package/lib/index.js +267 -267
  64. package/lib/plugin.js +12 -12
  65. package/lib/plugin.js.map +1 -1
  66. package/lib/version.d.ts +1 -1
  67. package/lib/version.js +1 -1
  68. package/lib/version.js.map +1 -1
  69. package/package.json +3 -3
  70. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","names":["buildProps","definePropType","mutable","iconPropType","More","isUndefined","useNamespace","MENU_INJECTION_KEY","SUB_MENU_INJECTION_KEY","Menubar","useMenuCssVar","flattedChildren","ElSubMenu","ElIcon","vClickoutside","ElMenuCollapseTransition"],"sources":["../../../../../../packages/components/menu/src/menu.ts"],"sourcesContent":["import {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n withDirectives,\n} from 'vue'\nimport { unrefElement, useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport ElIcon from '@element-plus/components/icon'\nimport { More } from '@element-plus/icons-vue'\nimport {\n buildProps,\n definePropType,\n flattedChildren,\n iconPropType,\n isArray,\n isObject,\n isString,\n isUndefined,\n mutable,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { ClickOutside as vClickoutside } from '@element-plus/directives'\nimport Menubar from './utils/menu-bar'\nimport ElMenuCollapseTransition from './menu-collapse-transition.vue'\nimport ElSubMenu from './sub-menu'\nimport { useMenuCssVar } from './use-menu-css-var'\nimport { MENU_INJECTION_KEY, SUB_MENU_INJECTION_KEY } from './tokens'\n\nimport type { PopperEffect } from '@element-plus/components/popper'\nimport type { MenuItemClicked, MenuProvider, SubMenuProvider } from './types'\nimport type { NavigationFailure, Router } from 'vue-router'\nimport type {\n CSSProperties,\n Component,\n DirectiveArguments,\n ExtractPropTypes,\n ExtractPublicPropTypes,\n VNode,\n VNodeArrayChildren,\n} from 'vue'\nimport type { UseResizeObserverReturn } from '@vueuse/core'\n\nexport const menuProps = buildProps({\n /**\n * @description menu display mode\n */\n mode: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'vertical',\n },\n /**\n * @description index of active menu on page load\n */\n defaultActive: {\n type: String,\n default: '',\n },\n /**\n * @description array that contains indexes of currently active sub-menus\n */\n defaultOpeneds: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n /**\n * @description whether only one sub-menu can be active\n */\n uniqueOpened: Boolean,\n /**\n * @description whether `vue-router` mode is activated. If true, index will be used as 'path' to activate the route action. Use with `default-active` to set the active item on load.\n */\n router: Boolean,\n /**\n * @description how sub-menus are triggered, only works when `mode` is 'horizontal'\n */\n menuTrigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n /**\n * @description whether the menu is collapsed (available only in vertical mode)\n */\n collapse: Boolean,\n /**\n * @description background color of Menu (hex format) (deprecated, use `--bg-color` instead)\n * @deprecated use `--bg-color` instead\n */\n backgroundColor: String,\n /**\n * @description text color of Menu (hex format) (deprecated, use `--text-color` instead)\n * @deprecated use `--text-color` instead\n */\n textColor: String,\n /**\n * @description text color of currently active menu item (hex format) (deprecated, use `--active-color` instead)\n * @deprecated use `--active-color` instead\n */\n activeTextColor: String,\n /**\n * @description optional, whether menu is collapsed when clicking outside\n */\n closeOnClickOutside: Boolean,\n /**\n * @description whether to enable the collapse transition\n */\n collapseTransition: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether the menu is ellipsis (available only in horizontal mode)\n */\n ellipsis: {\n type: Boolean,\n default: true,\n },\n /**\n * @description offset of the popper (effective for all submenus)\n */\n popperOffset: {\n type: Number,\n default: 6,\n },\n /**\n * @description custom ellipsis icon (available only in horizontal mode and ellipsis is true)\n */\n ellipsisIcon: {\n type: iconPropType,\n default: () => More,\n },\n /**\n * @description Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed\n */\n popperEffect: {\n type: definePropType<PopperEffect>(String),\n default: 'dark',\n },\n /**\n * @description custom class name for all popup menus\n */\n popperClass: String,\n /**\n * @description custom style for all popup menus\n */\n popperStyle: {\n type: definePropType<string | CSSProperties>([String, Object]),\n },\n /**\n * @description control timeout for all menus before showing\n */\n showTimeout: {\n type: Number,\n default: 300,\n },\n /**\n * @description control timeout for all menus before hiding\n */\n hideTimeout: {\n type: Number,\n default: 300,\n },\n /**\n * @description when menu inactive and `persistent` is `false` , dropdown menu will be destroyed\n */\n persistent: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type MenuProps = ExtractPropTypes<typeof menuProps>\nexport type MenuPropsPublic = ExtractPublicPropTypes<typeof menuProps>\n\nconst checkIndexPath = (indexPath: unknown): indexPath is string[] =>\n isArray(indexPath) && indexPath.every((path) => isString(path))\n\nexport const menuEmits = {\n close: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n open: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n select: (\n index: string,\n indexPath: string[],\n item: MenuItemClicked,\n routerResult?: Promise<void | NavigationFailure>\n ) =>\n isString(index) &&\n checkIndexPath(indexPath) &&\n isObject(item) &&\n (isUndefined(routerResult) || routerResult instanceof Promise),\n}\nexport type MenuEmits = typeof menuEmits\n\nconst DEFAULT_MORE_ITEM_WIDTH = 64\n\nexport default defineComponent({\n name: 'ElMenu',\n\n props: menuProps,\n emits: menuEmits,\n\n setup(props, { emit, slots, expose }) {\n const instance = getCurrentInstance()!\n const router = instance.appContext.config.globalProperties.$router as Router\n const menu = ref<HTMLUListElement>()\n const subMenu = ref<HTMLElement>()\n const nsMenu = useNamespace('menu')\n const nsSubMenu = useNamespace('sub-menu')\n let moreItemWidth = DEFAULT_MORE_ITEM_WIDTH\n\n // data\n const sliceIndex = ref(-1)\n\n const openedMenus = ref<MenuProvider['openedMenus']>(\n props.defaultOpeneds && !props.collapse\n ? props.defaultOpeneds.slice(0)\n : []\n )\n const activeIndex = ref<MenuProvider['activeIndex']>(props.defaultActive)\n const items = ref<MenuProvider['items']>({})\n const subMenus = ref<MenuProvider['subMenus']>({})\n\n // computed\n const isMenuPopup = computed<MenuProvider['isMenuPopup']>(\n () =>\n props.mode === 'horizontal' ||\n (props.mode === 'vertical' && props.collapse)\n )\n\n // methods\n const initMenu = () => {\n const activeItem = activeIndex.value && items.value[activeIndex.value]\n if (!activeItem || props.mode === 'horizontal' || props.collapse) return\n\n const indexPath = activeItem.indexPath\n\n // 展开该菜单项的路径上所有子菜单\n // expand all subMenus of the menu item\n indexPath.forEach((index) => {\n const subMenu = subMenus.value[index]\n subMenu && openMenu(index, subMenu.indexPath)\n })\n }\n\n const openMenu: MenuProvider['openMenu'] = (index, indexPath) => {\n if (openedMenus.value.includes(index)) return\n // 将不在该菜单路径下的其余菜单收起\n // collapse all menu that are not under current menu item\n if (props.uniqueOpened) {\n openedMenus.value = openedMenus.value.filter((index: string) =>\n indexPath.includes(index)\n )\n }\n openedMenus.value.push(index)\n emit('open', index, indexPath)\n }\n\n const close = (index: string) => {\n const i = openedMenus.value.indexOf(index)\n if (i !== -1) {\n openedMenus.value.splice(i, 1)\n }\n }\n\n const closeMenu: MenuProvider['closeMenu'] = (index, indexPath) => {\n close(index)\n emit('close', index, indexPath)\n }\n\n const handleSubMenuClick: MenuProvider['handleSubMenuClick'] = ({\n index,\n indexPath,\n }) => {\n const isOpened = openedMenus.value.includes(index)\n\n isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath)\n }\n\n const handleMenuItemClick: MenuProvider['handleMenuItemClick'] = (\n menuItem\n ) => {\n if (props.mode === 'horizontal' || props.collapse) {\n openedMenus.value = []\n }\n const { index, indexPath } = menuItem\n if (isNil(index) || isNil(indexPath)) return\n\n if (props.router && router) {\n const route = menuItem.route || index\n const routerResult = router.push(route).then((res) => {\n if (!res) activeIndex.value = index\n return res\n })\n emit(\n 'select',\n index,\n indexPath,\n { index, indexPath, route },\n routerResult\n )\n } else {\n activeIndex.value = index\n emit('select', index, indexPath, { index, indexPath })\n }\n }\n\n const updateActiveIndex = (val: string) => {\n const itemsInData = items.value\n const item =\n itemsInData[val] ||\n (activeIndex.value && itemsInData[activeIndex.value]) ||\n itemsInData[props.defaultActive]\n\n activeIndex.value = item?.index ?? val\n }\n\n const calcMenuItemWidth = (menuItem: HTMLElement) => {\n const computedStyle = getComputedStyle(menuItem)\n const marginLeft = Number.parseInt(computedStyle.marginLeft, 10)\n const marginRight = Number.parseInt(computedStyle.marginRight, 10)\n return menuItem.offsetWidth + marginLeft + marginRight || 0\n }\n\n const calcSliceIndex = () => {\n if (!menu.value) return -1\n\n const items = Array.from(menu.value.childNodes).filter(\n (item) =>\n item.nodeName !== '#comment' &&\n (item.nodeName !== '#text' || item.nodeValue)\n ) as HTMLElement[]\n\n const computedMenuStyle = getComputedStyle(menu.value)\n const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10)\n const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10)\n const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight\n\n let calcWidth = 0\n let sliceIndex = 0\n items.forEach((item, index) => {\n calcWidth += calcMenuItemWidth(item)\n if (calcWidth <= menuWidth - moreItemWidth) {\n sliceIndex = index + 1\n }\n })\n return sliceIndex === items.length ? -1 : sliceIndex\n }\n\n const getIndexPath = (index: string) => subMenus.value[index].indexPath\n\n // Common computer monitor FPS is 60Hz, which means 60 redraws per second. Calculation formula: 1000ms/60 ≈ 16.67ms, In order to avoid a certain chance of repeated triggering when `resize`, set wait to 16.67 * 2 = 33.34\n const debounce = (fn: () => void, wait = 33.34) => {\n let timer: ReturnType<typeof setTimeout> | null\n return () => {\n timer && clearTimeout(timer)\n timer = setTimeout(() => {\n fn()\n }, wait)\n }\n }\n\n let isFirstTimeRender = true\n const handleResize = () => {\n const el = unrefElement(subMenu)\n if (el) moreItemWidth = calcMenuItemWidth(el) || DEFAULT_MORE_ITEM_WIDTH\n if (sliceIndex.value === calcSliceIndex()) return\n const callback = () => {\n sliceIndex.value = -1\n nextTick(() => {\n sliceIndex.value = calcSliceIndex()\n })\n }\n // execute callback directly when first time resize to avoid shaking\n isFirstTimeRender ? callback() : debounce(callback)()\n isFirstTimeRender = false\n }\n\n watch(\n () => props.defaultActive,\n (currentActive) => {\n if (!items.value[currentActive]) {\n activeIndex.value = ''\n }\n updateActiveIndex(currentActive)\n }\n )\n\n watch(\n () => props.collapse,\n (value) => {\n if (value) openedMenus.value = []\n }\n )\n\n watch(items.value, initMenu)\n\n let resizeStopper: UseResizeObserverReturn['stop']\n watchEffect(() => {\n if (props.mode === 'horizontal' && props.ellipsis)\n resizeStopper = useResizeObserver(menu, handleResize).stop\n else resizeStopper?.()\n })\n\n const mouseInChild = ref(false)\n\n // provide\n {\n const addSubMenu: MenuProvider['addSubMenu'] = (item) => {\n subMenus.value[item.index] = item\n }\n\n const removeSubMenu: MenuProvider['removeSubMenu'] = (item) => {\n delete subMenus.value[item.index]\n }\n\n const addMenuItem: MenuProvider['addMenuItem'] = (item) => {\n items.value[item.index] = item\n }\n\n const removeMenuItem: MenuProvider['removeMenuItem'] = (item) => {\n delete items.value[item.index]\n }\n\n provide<MenuProvider>(\n MENU_INJECTION_KEY,\n reactive({\n props,\n openedMenus,\n items,\n subMenus,\n activeIndex,\n isMenuPopup,\n\n addMenuItem,\n removeMenuItem,\n addSubMenu,\n removeSubMenu,\n openMenu,\n closeMenu,\n handleMenuItemClick,\n handleSubMenuClick,\n })\n )\n\n provide<SubMenuProvider>(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {\n addSubMenu,\n removeSubMenu,\n mouseInChild,\n level: 0,\n })\n }\n\n // lifecycle\n onMounted(() => {\n if (props.mode === 'horizontal') {\n new Menubar(instance.vnode.el!, nsMenu.namespace.value)\n }\n })\n\n {\n const open = (index: string) => {\n const { indexPath } = subMenus.value[index]\n indexPath.forEach((i) => openMenu(i, indexPath))\n }\n\n expose({\n open,\n close,\n updateActiveIndex,\n handleResize,\n })\n }\n\n const ulStyle = useMenuCssVar(props, 0)\n\n return () => {\n let slot: VNodeArrayChildren = slots.default?.() ?? []\n const vShowMore: VNode[] = []\n\n if (props.mode === 'horizontal' && menu.value) {\n const originalSlot = (\n flattedChildren(slot) as VNodeArrayChildren\n ).filter((vnode) => {\n // Filter text and comment nodes (https://github.com/vuejs/core/blob/c875019d49b4c36a88d929ccadc31ad414747c7b/packages/shared/src/shapeFlags.ts#L5)\n return (vnode as VNode)?.shapeFlag !== 8\n })\n const slotDefault =\n sliceIndex.value === -1\n ? originalSlot\n : originalSlot.slice(0, sliceIndex.value)\n\n const slotMore =\n sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value)\n\n if (slotMore?.length && props.ellipsis) {\n slot = slotDefault\n vShowMore.push(\n h(\n ElSubMenu,\n {\n ref: subMenu,\n index: 'sub-menu-more',\n class: nsSubMenu.e('hide-arrow'),\n popperOffset: props.popperOffset,\n },\n {\n title: () =>\n h(\n ElIcon,\n {\n class: nsSubMenu.e('icon-more'),\n },\n {\n default: () => h(props.ellipsisIcon as Component),\n }\n ),\n default: () => slotMore,\n }\n )\n )\n }\n }\n\n const directives: DirectiveArguments = props.closeOnClickOutside\n ? [\n [\n vClickoutside,\n () => {\n if (!openedMenus.value.length) return\n\n if (!mouseInChild.value) {\n openedMenus.value.forEach((openedMenu) =>\n emit('close', openedMenu, getIndexPath(openedMenu))\n )\n\n openedMenus.value = []\n }\n },\n ],\n ]\n : []\n\n const vMenu = withDirectives(\n h(\n 'ul',\n {\n key: String(props.collapse),\n role: 'menubar',\n ref: menu,\n style: ulStyle.value,\n class: {\n [nsMenu.b()]: true,\n [nsMenu.m(props.mode)]: true,\n [nsMenu.m('collapse')]: props.collapse,\n },\n },\n [...slot, ...vShowMore]\n ),\n directives\n )\n\n if (props.collapseTransition && props.mode === 'vertical') {\n return h(ElMenuCollapseTransition, () => vMenu)\n }\n\n return vMenu\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,YAAYA,kBAAAA,WAAW;;;;CAIlC,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,cAAc,WAAW;EAClC,SAAS;EACV;;;;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;;;;CAID,gBAAgB;EACd,MAAMC,kBAAAA,eAAyB,MAAM;EACrC,eAAeC,mBAAAA,QAAQ,EAAE,CAAU;EACpC;;;;CAID,cAAc;;;;CAId,QAAQ;;;;CAIR,aAAa;EACX,MAAM;EACN,QAAQ,CAAC,SAAS,QAAQ;EAC1B,SAAS;EACV;;;;CAID,UAAU;;;;;CAKV,iBAAiB;;;;;CAKjB,WAAW;;;;;CAKX,iBAAiB;;;;CAIjB,qBAAqB;;;;CAIrB,oBAAoB;EAClB,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,cAAc;EACZ,MAAM;EACN,SAAS;EACV;;;;CAID,cAAc;EACZ,MAAMC,aAAAA;EACN,eAAeC,wBAAAA;EAChB;;;;CAID,cAAc;EACZ,MAAMH,kBAAAA,eAA6B,OAAO;EAC1C,SAAS;EACV;;;;CAID,aAAa;;;;CAIb,aAAa,EACX,MAAMA,kBAAAA,eAAuC,CAAC,QAAQ,OAAO,CAAC,EAC/D;;;;CAID,aAAa;EACX,MAAM;EACN,SAAS;EACV;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YAAY,aAAa,WAAW,CAAC,CACpD;KAED,YAAY,QAAQ,EAAE;;KAG3B,CACF,GACD,EAAE;GAEN,MAAM,SAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,GAEF,MACA;IACE,KAAK,OAAO,MAAM,SAAS;IAC3B,MAAM;IACN,KAAK;IACL,OAAO,QAAQ;IACf,OAAO;MACJ,OAAO,GAAG,GAAG;MACb,OAAO,EAAE,MAAM,KAAK,GAAG;MACvB,OAAO,EAAE,WAAW,GAAG,MAAM;KAC/B;IACF,EACD,CAAC,GAAG,MAAM,GAAG,UAAU,CACxB,EACD,WACD;GAED,IAAI,MAAM,sBAAsB,MAAM,SAAS,YAC7C,QAAA,GAAA,IAAA,GAASC,iCAAAA,eAAgC,MAAM;GAGjD,OAAO;;;CAGZ,CAAC"}
1
+ {"version":3,"file":"menu.js","names":["buildProps","definePropType","mutable","iconPropType","More","isUndefined","useNamespace","MENU_INJECTION_KEY","SUB_MENU_INJECTION_KEY","Menubar","useMenuCssVar","flattedChildren","ElSubMenu","ElIcon","vClickoutside","ElMenuCollapseTransition"],"sources":["../../../../../../packages/components/menu/src/menu.ts"],"sourcesContent":["import {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n withDirectives,\n} from 'vue'\nimport { unrefElement, useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport ElIcon from '@element-plus/components/icon'\nimport { More } from '@element-plus/icons-vue'\nimport {\n buildProps,\n definePropType,\n flattedChildren,\n iconPropType,\n isArray,\n isObject,\n isString,\n isUndefined,\n mutable,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { ClickOutside as vClickoutside } from '@element-plus/directives'\nimport Menubar from './utils/menu-bar'\nimport ElMenuCollapseTransition from './menu-collapse-transition.vue'\nimport ElSubMenu from './sub-menu'\nimport { useMenuCssVar } from './use-menu-css-var'\nimport { MENU_INJECTION_KEY, SUB_MENU_INJECTION_KEY } from './tokens'\n\nimport type { PopperEffect } from '@element-plus/components/popper'\nimport type { MenuItemClicked, MenuProvider, SubMenuProvider } from './types'\nimport type { NavigationFailure, Router } from 'vue-router'\nimport type {\n CSSProperties,\n Component,\n DirectiveArguments,\n ExtractPropTypes,\n ExtractPublicPropTypes,\n VNode,\n VNodeArrayChildren,\n} from 'vue'\nimport type { UseResizeObserverReturn } from '@vueuse/core'\n\nexport const menuProps = buildProps({\n /**\n * @description menu display mode\n */\n mode: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'vertical',\n },\n /**\n * @description index of active menu on page load\n */\n defaultActive: {\n type: String,\n default: '',\n },\n /**\n * @description array that contains indexes of currently active sub-menus\n */\n defaultOpeneds: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n /**\n * @description whether only one sub-menu can be active\n */\n uniqueOpened: Boolean,\n /**\n * @description whether `vue-router` mode is activated. If true, index will be used as 'path' to activate the route action. Use with `default-active` to set the active item on load.\n */\n router: Boolean,\n /**\n * @description how sub-menus are triggered, only works when `mode` is 'horizontal'\n */\n menuTrigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n /**\n * @description whether the menu is collapsed (available only in vertical mode)\n */\n collapse: Boolean,\n /**\n * @description background color of Menu (hex format) (deprecated, use `--bg-color` instead)\n * @deprecated use `--bg-color` instead\n */\n backgroundColor: String,\n /**\n * @description text color of Menu (hex format) (deprecated, use `--text-color` instead)\n * @deprecated use `--text-color` instead\n */\n textColor: String,\n /**\n * @description text color of currently active menu item (hex format) (deprecated, use `--active-color` instead)\n * @deprecated use `--active-color` instead\n */\n activeTextColor: String,\n /**\n * @description optional, whether menu is collapsed when clicking outside\n */\n closeOnClickOutside: Boolean,\n /**\n * @description whether to enable the collapse transition\n */\n collapseTransition: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether the menu is ellipsis (available only in horizontal mode)\n */\n ellipsis: {\n type: Boolean,\n default: true,\n },\n /**\n * @description offset of the popper (effective for all submenus)\n */\n popperOffset: {\n type: Number,\n default: 6,\n },\n /**\n * @description custom ellipsis icon (available only in horizontal mode and ellipsis is true)\n */\n ellipsisIcon: {\n type: iconPropType,\n default: () => More,\n },\n /**\n * @description Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed\n */\n popperEffect: {\n type: definePropType<PopperEffect>(String),\n default: 'dark',\n },\n /**\n * @description custom class name for all popup menus\n */\n popperClass: String,\n /**\n * @description custom style for all popup menus\n */\n popperStyle: {\n type: definePropType<string | CSSProperties>([String, Object]),\n },\n /**\n * @description control timeout for all menus before showing\n */\n showTimeout: {\n type: Number,\n default: 300,\n },\n /**\n * @description control timeout for all menus before hiding\n */\n hideTimeout: {\n type: Number,\n default: 300,\n },\n /**\n * @description when menu inactive and `persistent` is `false` , dropdown menu will be destroyed\n */\n persistent: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type MenuProps = ExtractPropTypes<typeof menuProps>\nexport type MenuPropsPublic = ExtractPublicPropTypes<typeof menuProps>\n\nconst checkIndexPath = (indexPath: unknown): indexPath is string[] =>\n isArray(indexPath) && indexPath.every((path) => isString(path))\n\nexport const menuEmits = {\n close: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n open: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n select: (\n index: string,\n indexPath: string[],\n item: MenuItemClicked,\n routerResult?: Promise<void | NavigationFailure>\n ) =>\n isString(index) &&\n checkIndexPath(indexPath) &&\n isObject(item) &&\n (isUndefined(routerResult) || routerResult instanceof Promise),\n}\nexport type MenuEmits = typeof menuEmits\n\nconst DEFAULT_MORE_ITEM_WIDTH = 64\n\nexport default defineComponent({\n name: 'ElMenu',\n\n props: menuProps,\n emits: menuEmits,\n\n setup(props, { emit, slots, expose }) {\n const instance = getCurrentInstance()!\n const router = instance.appContext.config.globalProperties.$router as Router\n const menu = ref<HTMLUListElement>()\n const subMenu = ref<HTMLElement>()\n const nsMenu = useNamespace('menu')\n const nsSubMenu = useNamespace('sub-menu')\n let moreItemWidth = DEFAULT_MORE_ITEM_WIDTH\n\n // data\n const sliceIndex = ref(-1)\n\n const openedMenus = ref<MenuProvider['openedMenus']>(\n props.defaultOpeneds && !props.collapse\n ? props.defaultOpeneds.slice(0)\n : []\n )\n const activeIndex = ref<MenuProvider['activeIndex']>(props.defaultActive)\n const items = ref<MenuProvider['items']>({})\n const subMenus = ref<MenuProvider['subMenus']>({})\n\n // computed\n const isMenuPopup = computed<MenuProvider['isMenuPopup']>(\n () =>\n props.mode === 'horizontal' ||\n (props.mode === 'vertical' && props.collapse)\n )\n\n // methods\n const initMenu = () => {\n const activeItem = activeIndex.value && items.value[activeIndex.value]\n if (!activeItem || props.mode === 'horizontal' || props.collapse) return\n\n const indexPath = activeItem.indexPath\n\n // 展开该菜单项的路径上所有子菜单\n // expand all subMenus of the menu item\n indexPath.forEach((index) => {\n const subMenu = subMenus.value[index]\n subMenu && openMenu(index, subMenu.indexPath)\n })\n }\n\n const openMenu: MenuProvider['openMenu'] = (index, indexPath) => {\n if (openedMenus.value.includes(index)) return\n // 将不在该菜单路径下的其余菜单收起\n // collapse all menu that are not under current menu item\n if (props.uniqueOpened) {\n openedMenus.value = openedMenus.value.filter((index: string) =>\n indexPath.includes(index)\n )\n }\n openedMenus.value.push(index)\n emit('open', index, indexPath)\n }\n\n const close = (index: string) => {\n const i = openedMenus.value.indexOf(index)\n if (i !== -1) {\n openedMenus.value.splice(i, 1)\n }\n }\n\n const closeMenu: MenuProvider['closeMenu'] = (index, indexPath) => {\n close(index)\n emit('close', index, indexPath)\n }\n\n const handleSubMenuClick: MenuProvider['handleSubMenuClick'] = ({\n index,\n indexPath,\n }) => {\n const isOpened = openedMenus.value.includes(index)\n\n isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath)\n }\n\n const handleMenuItemClick: MenuProvider['handleMenuItemClick'] = (\n menuItem\n ) => {\n if (props.mode === 'horizontal' || props.collapse) {\n openedMenus.value = []\n }\n const { index, indexPath } = menuItem\n if (isNil(index) || isNil(indexPath)) return\n\n if (props.router && router) {\n const route = menuItem.route || index\n const routerResult = router.push(route).then((res) => {\n if (!res) activeIndex.value = index\n return res\n })\n emit(\n 'select',\n index,\n indexPath,\n { index, indexPath, route },\n routerResult\n )\n } else {\n activeIndex.value = index\n emit('select', index, indexPath, { index, indexPath })\n }\n }\n\n const updateActiveIndex = (val: string) => {\n const itemsInData = items.value\n const item =\n itemsInData[val] ||\n (activeIndex.value && itemsInData[activeIndex.value]) ||\n itemsInData[props.defaultActive]\n\n activeIndex.value = item?.index ?? val\n }\n\n const calcMenuItemWidth = (menuItem: HTMLElement) => {\n const computedStyle = getComputedStyle(menuItem)\n const marginLeft = Number.parseInt(computedStyle.marginLeft, 10)\n const marginRight = Number.parseInt(computedStyle.marginRight, 10)\n return menuItem.offsetWidth + marginLeft + marginRight || 0\n }\n\n const calcSliceIndex = () => {\n if (!menu.value) return -1\n\n const items = Array.from(menu.value.childNodes).filter(\n (item) =>\n item.nodeName !== '#comment' &&\n (item.nodeName !== '#text' || item.nodeValue)\n ) as HTMLElement[]\n\n const computedMenuStyle = getComputedStyle(menu.value)\n const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10)\n const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10)\n const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight\n\n let calcWidth = 0\n let sliceIndex = 0\n items.forEach((item, index) => {\n calcWidth += calcMenuItemWidth(item)\n if (calcWidth <= menuWidth - moreItemWidth) {\n sliceIndex = index + 1\n }\n })\n return sliceIndex === items.length ? -1 : sliceIndex\n }\n\n const getIndexPath = (index: string) => subMenus.value[index].indexPath\n\n // Common computer monitor FPS is 60Hz, which means 60 redraws per second. Calculation formula: 1000ms/60 ≈ 16.67ms, In order to avoid a certain chance of repeated triggering when `resize`, set wait to 16.67 * 2 = 33.34\n const debounce = (fn: () => void, wait = 33.34) => {\n let timer: ReturnType<typeof setTimeout> | null\n return () => {\n timer && clearTimeout(timer)\n timer = setTimeout(() => {\n fn()\n }, wait)\n }\n }\n\n let isFirstTimeRender = true\n const handleResize = () => {\n const el = unrefElement(subMenu)\n if (el) moreItemWidth = calcMenuItemWidth(el) || DEFAULT_MORE_ITEM_WIDTH\n if (sliceIndex.value === calcSliceIndex()) return\n const callback = () => {\n sliceIndex.value = -1\n nextTick(() => {\n sliceIndex.value = calcSliceIndex()\n })\n }\n // execute callback directly when first time resize to avoid shaking\n isFirstTimeRender ? callback() : debounce(callback)()\n isFirstTimeRender = false\n }\n\n watch(\n () => props.defaultActive,\n (currentActive) => {\n if (!items.value[currentActive]) {\n activeIndex.value = ''\n }\n updateActiveIndex(currentActive)\n }\n )\n\n watch(\n () => props.collapse,\n (value) => {\n if (value) openedMenus.value = []\n }\n )\n\n watch(items.value, initMenu)\n\n let resizeStopper: UseResizeObserverReturn['stop']\n watchEffect(() => {\n if (props.mode === 'horizontal' && props.ellipsis)\n resizeStopper = useResizeObserver(menu, handleResize).stop\n else resizeStopper?.()\n })\n\n const mouseInChild = ref(false)\n\n // provide\n {\n const addSubMenu: MenuProvider['addSubMenu'] = (item) => {\n subMenus.value[item.index] = item\n }\n\n const removeSubMenu: MenuProvider['removeSubMenu'] = (item) => {\n delete subMenus.value[item.index]\n }\n\n const addMenuItem: MenuProvider['addMenuItem'] = (item) => {\n items.value[item.index] = item\n }\n\n const removeMenuItem: MenuProvider['removeMenuItem'] = (item) => {\n delete items.value[item.index]\n }\n\n provide<MenuProvider>(\n MENU_INJECTION_KEY,\n reactive({\n props,\n openedMenus,\n items,\n subMenus,\n activeIndex,\n isMenuPopup,\n\n addMenuItem,\n removeMenuItem,\n addSubMenu,\n removeSubMenu,\n openMenu,\n closeMenu,\n handleMenuItemClick,\n handleSubMenuClick,\n })\n )\n\n provide<SubMenuProvider>(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {\n addSubMenu,\n removeSubMenu,\n mouseInChild,\n level: 0,\n })\n }\n\n // lifecycle\n onMounted(() => {\n if (props.mode === 'horizontal') {\n new Menubar(instance.vnode.el!, nsMenu.namespace.value)\n }\n })\n\n {\n const open = (index: string) => {\n const { indexPath } = subMenus.value[index]\n indexPath.forEach((i) => openMenu(i, indexPath))\n }\n\n expose({\n open,\n close,\n updateActiveIndex,\n handleResize,\n })\n }\n\n const ulStyle = useMenuCssVar(props, 0)\n\n return () => {\n let slot: VNodeArrayChildren = slots.default?.() ?? []\n const vShowMore: VNode[] = []\n\n if (props.mode === 'horizontal' && menu.value) {\n const originalSlot = (\n flattedChildren(slot) as VNodeArrayChildren\n ).filter((vnode) => {\n // Filter text and comment nodes (https://github.com/vuejs/core/blob/c875019d49b4c36a88d929ccadc31ad414747c7b/packages/shared/src/shapeFlags.ts#L5)\n return (vnode as VNode)?.shapeFlag !== 8\n })\n const slotDefault =\n sliceIndex.value === -1\n ? originalSlot\n : originalSlot.slice(0, sliceIndex.value)\n\n const slotMore =\n sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value)\n\n if (slotMore?.length && props.ellipsis) {\n slot = slotDefault\n vShowMore.push(\n h(\n ElSubMenu,\n {\n ref: subMenu,\n index: 'sub-menu-more',\n class: nsSubMenu.e('hide-arrow'),\n popperOffset: props.popperOffset,\n },\n {\n title: () =>\n h(\n ElIcon,\n {\n class: nsSubMenu.e('icon-more'),\n },\n {\n default: () => h(props.ellipsisIcon as Component),\n }\n ),\n default: () => slotMore,\n }\n )\n )\n }\n }\n\n const directives: DirectiveArguments = props.closeOnClickOutside\n ? [\n [\n vClickoutside,\n () => {\n if (!openedMenus.value.length) return\n\n if (!mouseInChild.value) {\n openedMenus.value.forEach((openedMenu) =>\n emit('close', openedMenu, getIndexPath(openedMenu))\n )\n\n openedMenus.value = []\n }\n },\n ],\n ]\n : []\n\n const vMenu = withDirectives(\n h(\n 'ul',\n {\n key: String(props.collapse),\n role: 'menubar',\n ref: menu,\n style: ulStyle.value,\n class: {\n [nsMenu.b()]: true,\n [nsMenu.m(props.mode)]: true,\n [nsMenu.m('collapse')]: props.collapse,\n },\n },\n [...slot, ...vShowMore]\n ),\n directives\n )\n\n if (props.collapseTransition && props.mode === 'vertical') {\n return h(ElMenuCollapseTransition, () => vMenu)\n }\n\n return vMenu\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,YAAYA,kBAAAA,WAAW;;;;CAIlC,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,cAAc,WAAW;EAClC,SAAS;EACV;;;;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;;;;CAID,gBAAgB;EACd,MAAMC,kBAAAA,eAAyB,MAAM;EACrC,eAAeC,mBAAAA,QAAQ,EAAE,CAAU;EACpC;;;;CAID,cAAc;;;;CAId,QAAQ;;;;CAIR,aAAa;EACX,MAAM;EACN,QAAQ,CAAC,SAAS,QAAQ;EAC1B,SAAS;EACV;;;;CAID,UAAU;;;;;CAKV,iBAAiB;;;;;CAKjB,WAAW;;;;;CAKX,iBAAiB;;;;CAIjB,qBAAqB;;;;CAIrB,oBAAoB;EAClB,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,cAAc;EACZ,MAAM;EACN,SAAS;EACV;;;;CAID,cAAc;EACZ,MAAMC,aAAAA;EACN,eAAeC,wBAAAA;EAChB;;;;CAID,cAAc;EACZ,MAAMH,kBAAAA,eAA6B,OAAO;EAC1C,SAAS;EACV;;;;CAID,aAAa;;;;CAIb,aAAa,EACX,MAAMA,kBAAAA,eAAuC,CAAC,QAAQ,OAAO,CAAC,EAC/D;;;;CAID,aAAa;EACX,MAAM;EACN,SAAS;EACV;;;;CAID,aAAa;EACX,MAAM;EACN,SAAS;EACV;;;;CAID,YAAY;EACV,MAAM;EACN,SAAS;EACV;CACF,CAAU;AAIX,MAAM,kBAAkB,eAAA,GAAA,YAAA,SACd,UAAU,IAAI,UAAU,OAAO,UAAA,GAAA,YAAA,UAAkB,KAAK,CAAC;AAEjE,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AAQ;IACf,OAAO;MACJ,OAAO,GAAG,GAAG;MACb,OAAO,EAAE,MAAM,KAAK,GAAG;MACvB,OAAO,EAAE,WAAW,GAAG,MAAM;KAC/B;IACF,EACD,CAAC,GAAG,MAAM,GAAG,UAAU,CACxB,EACD,WACD;GAED,IAAI,MAAM,sBAAsB,MAAM,SAAS,YAC7C,QAAA,GAAA,IAAA,GAASC,iCAAAA,eAAgC,MAAM;GAGjD,OAAO;;;CAGZ,CAAC"}
@@ -1,16 +1,16 @@
1
1
  require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_icon = require("../../../utils/vue/icon.js");
3
3
  const require_validator = require("../../../utils/vue/validator.js");
4
- const require_index = require("../../../hooks/use-draggable/index.js");
5
- const require_index$1 = require("../../../hooks/use-lockscreen/index.js");
6
- const require_index$2 = require("../../../hooks/use-same-target/index.js");
7
- const require_index$3 = require("../../../hooks/use-id/index.js");
8
- const require_index$4 = require("../../icon/index.js");
9
- const require_index$5 = require("../../focus-trap/index.js");
10
- const require_index$6 = require("../../input/index.js");
4
+ const require_index = require("../../../directives/trap-focus/index.js");
5
+ const require_index$1 = require("../../../hooks/use-draggable/index.js");
6
+ const require_index$2 = require("../../../hooks/use-lockscreen/index.js");
7
+ const require_index$3 = require("../../../hooks/use-same-target/index.js");
8
+ const require_index$4 = require("../../../hooks/use-id/index.js");
9
+ const require_index$5 = require("../../icon/index.js");
10
+ const require_index$6 = require("../../focus-trap/index.js");
11
+ const require_index$7 = require("../../input/index.js");
11
12
  const require_use_global_config = require("../../config-provider/src/hooks/use-global-config.js");
12
- const require_index$7 = require("../../button/index.js");
13
- const require_index$8 = require("../../../directives/trap-focus/index.js");
13
+ const require_index$8 = require("../../button/index.js");
14
14
  const require_index$9 = require("../../overlay/index.js");
15
15
  let _element_plus_icons_vue = require("@element-plus/icons-vue");
16
16
  let vue = require("vue");
@@ -18,13 +18,13 @@ let _vue_shared = require("@vue/shared");
18
18
  //#region ../../packages/components/message-box/src/index.vue?vue&type=script&lang.ts
19
19
  var index_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
20
20
  name: "ElMessageBox",
21
- directives: { TrapFocus: require_index$8.default },
21
+ directives: { TrapFocus: require_index.default },
22
22
  components: {
23
- ElButton: require_index$7.ElButton,
24
- ElFocusTrap: require_index$5.default,
25
- ElInput: require_index$6.ElInput,
23
+ ElButton: require_index$8.ElButton,
24
+ ElFocusTrap: require_index$6.default,
25
+ ElInput: require_index$7.ElInput,
26
26
  ElOverlay: require_index$9.ElOverlay,
27
- ElIcon: require_index$4.ElIcon,
27
+ ElIcon: require_index$5.ElIcon,
28
28
  ...require_icon.TypeComponents
29
29
  },
30
30
  inheritAttrs: false,
@@ -120,8 +120,8 @@ var index_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
120
120
  const type = state.type;
121
121
  return { [ns.bm("icon", type)]: type && require_icon.TypeComponentsMap[type] };
122
122
  });
123
- const contentId = require_index$3.useId();
124
- const inputId = require_index$3.useId();
123
+ const contentId = require_index$4.useId();
124
+ const inputId = require_index$4.useId();
125
125
  const iconComponent = (0, vue.computed)(() => {
126
126
  const type = state.type;
127
127
  return state.icon || type && require_icon.TypeComponentsMap[type] || "";
@@ -153,7 +153,7 @@ var index_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
153
153
  state.validateError = false;
154
154
  }
155
155
  });
156
- const { isDragging } = require_index.useDraggable(rootRef, headerRef, (0, vue.computed)(() => props.draggable), (0, vue.computed)(() => props.overflow));
156
+ const { isDragging } = require_index$1.useDraggable(rootRef, headerRef, (0, vue.computed)(() => props.draggable), (0, vue.computed)(() => props.overflow));
157
157
  (0, vue.onMounted)(async () => {
158
158
  await (0, vue.nextTick)();
159
159
  if (props.closeOnHashChange) window.addEventListener("hashchange", doClose);
@@ -171,7 +171,7 @@ var index_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
171
171
  const handleWrapperClick = () => {
172
172
  if (props.closeOnClickModal) handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
173
173
  };
174
- const overlayEvent = require_index$2.useSameTarget(handleWrapperClick);
174
+ const overlayEvent = require_index$3.useSameTarget(handleWrapperClick);
175
175
  const handleInputEnter = (e) => {
176
176
  if (state.inputType !== "textarea" && !inputRef.value?.isComposing) {
177
177
  e.preventDefault();
@@ -221,7 +221,7 @@ var index_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
221
221
  const onCloseRequested = () => {
222
222
  if (props.closeOnPressEscape) handleClose();
223
223
  };
224
- if (props.lockScroll) require_index$1.useLockscreen(visible, { ns });
224
+ if (props.lockScroll) require_index$2.useLockscreen(visible, { ns });
225
225
  return {
226
226
  ...(0, vue.toRefs)(state),
227
227
  ns,
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue_vue_type_script_lang.js","names":[],"sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"[ns.is('message-box'), modalClass]\"\n :mask=\"modal\"\n >\n <div\n role=\"dialog\"\n :aria-label=\"title\"\n aria-modal=\"true\"\n :aria-describedby=\"!showInput ? contentId : undefined\"\n :class=\"`${ns.namespace.value}-overlay-message-box`\"\n @click=\"overlayEvent.onClick\"\n @mousedown=\"overlayEvent.onMousedown\"\n @mouseup=\"overlayEvent.onMouseup\"\n >\n <el-focus-trap\n loop\n :trapped=\"visible\"\n :focus-trap-el=\"rootRef\"\n :focus-start-el=\"focusStartRef\"\n @release-requested=\"onCloseRequested\"\n >\n <div\n ref=\"rootRef\"\n :class=\"[\n ns.b(),\n customClass,\n ns.is('draggable', draggable),\n ns.is('dragging', isDragging),\n { [ns.m('center')]: center },\n ]\"\n :style=\"customStyle\"\n tabindex=\"-1\"\n @click.stop=\"\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n ref=\"headerRef\"\n :class=\"[ns.e('header'), { 'show-close': showClose }]\"\n >\n <div :class=\"ns.e('title')\">\n <el-icon\n v-if=\"iconComponent && center\"\n :class=\"[ns.e('status'), typeClass]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n :class=\"ns.e('headerbtn')\"\n :aria-label=\"t('el.messagebox.close')\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon :class=\"ns.e('close')\">\n <component :is=\"closeIcon || 'close'\" />\n </el-icon>\n </button>\n </div>\n <div :id=\"contentId\" :class=\"ns.e('content')\">\n <div :class=\"ns.e('container')\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n :class=\"[ns.e('status'), typeClass]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" :class=\"ns.e('message')\">\n <slot>\n <component\n :is=\"showInput ? 'label' : 'p'\"\n v-if=\"!dangerouslyUseHTMLString\"\n :for=\"showInput ? inputId : undefined\"\n v-text=\"message\"\n />\n <component\n :is=\"showInput ? 'label' : 'p'\"\n v-else\n :for=\"showInput ? inputId : undefined\"\n v-html=\"message\"\n />\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" :class=\"ns.e('input')\">\n <el-input\n :id=\"inputId\"\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :aria-invalid=\"validateError\"\n :class=\"{ invalid: validateError }\"\n @keydown.enter=\"handleInputEnter\"\n />\n <div\n :class=\"ns.e('errormsg')\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div\n v-if=\"showCancelButton || showConfirmButton\"\n :class=\"ns.e('btns')\"\n >\n <el-button\n v-if=\"showCancelButton\"\n :type=\"cancelButtonType === 'text' ? '' : cancelButtonType\"\n :text=\"cancelButtonType === 'text'\"\n :loading=\"cancelButtonLoading\"\n :loading-icon=\"cancelButtonLoadingIcon\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n :type=\"confirmButtonType === 'text' ? '' : confirmButtonType\"\n :text=\"confirmButtonType === 'text'\"\n :loading=\"confirmButtonLoading\"\n :loading-icon=\"confirmButtonLoadingIcon\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </el-focus-trap>\n </div>\n </el-overlay>\n </transition>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n markRaw,\n nextTick,\n onBeforeUnmount,\n onMounted,\n reactive,\n ref,\n toRefs,\n watch,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useDraggable,\n useId,\n useLockscreen,\n useSameTarget,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport {\n TypeComponents,\n TypeComponentsMap,\n isFunction,\n isString,\n isValidComponentSize,\n} from '@element-plus/utils'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Loading } from '@element-plus/icons-vue'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { useGlobalComponentSettings } from '@element-plus/components/config-provider'\n\nimport type { ComponentPublicInstance, PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\nimport type { InputInstance } from '@element-plus/components/input'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElFocusTrap,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n draggable: Boolean,\n overflow: Boolean,\n roundButton: Boolean,\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const {\n locale,\n zIndex,\n ns,\n size: btnSize,\n } = useGlobalComponentSettings(\n 'message-box',\n computed(() => props.buttonSize)\n )\n\n const { t } = locale\n const { nextZIndex } = zIndex\n\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n // autofocus element when open message-box\n autofocus: true,\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n cancelButtonType: '',\n confirmButtonType: 'primary',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n closeIcon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: '',\n inputValidator: undefined,\n inputErrorMessage: '',\n message: '',\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonLoadingIcon: markRaw(Loading),\n cancelButtonLoadingIcon: markRaw(Loading),\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return { [ns.bm('icon', type)]: type && TypeComponentsMap[type] }\n })\n\n const contentId = useId()\n const inputId = useId()\n\n const iconComponent = computed(() => {\n const type = state.type\n return state.icon || (type && TypeComponentsMap[type]) || ''\n })\n const hasMessage = computed(() => !!state.message)\n const rootRef = ref<HTMLElement>()\n const headerRef = ref<HTMLElement>()\n const focusStartRef = ref<HTMLElement>()\n const inputRef = ref<InputInstance>()\n const confirmRef = ref<ComponentPublicInstance>()\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType !== 'prompt') {\n if (state.autofocus) {\n focusStartRef.value = confirmRef.value?.$el ?? rootRef.value\n } else {\n focusStartRef.value = rootRef.value\n }\n }\n state.zIndex = nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n if (state.autofocus) {\n focusStartRef.value = getInputElement() ?? rootRef.value\n } else {\n focusStartRef.value = rootRef.value\n }\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n const draggable = computed(() => props.draggable)\n const overflow = computed(() => props.overflow)\n const { isDragging } = useDraggable(rootRef, headerRef, draggable, overflow)\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n window.addEventListener('hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n window.removeEventListener('hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const overlayEvent = useSameTarget(handleWrapperClick)\n\n const handleInputEnter = (e: KeyboardEvent | Event) => {\n if (state.inputType !== 'textarea' && !inputRef.value?.isComposing) {\n e.preventDefault()\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (isFunction(inputValidator)) {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (isString(validateResult)) {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value?.$refs\n return (inputRefs?.input ?? inputRefs?.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event like this\n // to dispatch, it could callout another message box.\n const onCloseRequested = () => {\n if (props.closeOnPressEscape) {\n handleClose()\n }\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible, { ns })\n }\n\n return {\n ...toRefs(state),\n ns,\n overlayEvent,\n visible,\n hasMessage,\n typeClass,\n contentId,\n inputId,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n rootRef,\n focusStartRef,\n headerRef,\n inputRef,\n isDragging,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n onCloseRequested,\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyMA,IAAA,0CAAA,GAAA,IAAA,iBAA+B;CAC7B,MAAM;CACN,YAAY,EACV,WAAA,gBAAA,SACD;CACD,YAAY;EACV,UAAA,gBAAA;EACA,aAAA,gBAAA;EACA,SAAA,gBAAA;EACA,WAAA,gBAAA;EACA,QAAA,gBAAA;EACA,GAAG,aAAA;EACJ;CACD,cAAc;CACd,OAAO;EACL,YAAY;GACV,MAAM;GACN,WAAW,kBAAA;GACZ;EACD,OAAO;GACL,MAAM;GACN,SAAS;GACV;EACD,YAAY;GACV,MAAM;GACN,SAAS;GACV;EACD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EACD,mBAAmB;GACjB,MAAM;GACN,SAAS;GACV;EACD,oBAAoB;GAClB,MAAM;GACN,SAAS;GACV;EACD,mBAAmB;GACjB,MAAM;GACN,SAAS;GACV;EACD,QAAQ;EACR,WAAW;EACX,UAAU;EACV,aAAa;EACb,WAAW;GACT,MAAM;GACN,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,SAAS;GACV;EACF;CACD,OAAO,CAAC,UAAU,SAAS;CAC3B,MAAM,OAAO,EAAE,QAAQ;EAErB,MAAM,EACJ,QACA,QACA,IACA,MAAM,YACJ,0BAAA,2BACF,gBAAA,GAAA,IAAA,gBACe,MAAM,WAAU,CACjC;EAEA,MAAM,EAAE,MAAM;EACd,MAAM,EAAE,eAAe;EAEvB,MAAM,WAAA,GAAA,IAAA,KAAc,MAAK;EAEzB,MAAM,SAAA,GAAA,IAAA,UAAkC;G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ACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACF;;CAEH,CAAA"}
1
+ {"version":3,"file":"index.vue_vue_type_script_lang.js","names":[],"sources":["../../../../../../packages/components/message-box/src/index.vue"],"sourcesContent":["<template>\n <transition name=\"fade-in-linear\" @after-leave=\"$emit('vanish')\">\n <el-overlay\n v-show=\"visible\"\n :z-index=\"zIndex\"\n :overlay-class=\"[ns.is('message-box'), modalClass]\"\n :mask=\"modal\"\n >\n <div\n role=\"dialog\"\n :aria-label=\"title\"\n aria-modal=\"true\"\n :aria-describedby=\"!showInput ? contentId : undefined\"\n :class=\"`${ns.namespace.value}-overlay-message-box`\"\n @click=\"overlayEvent.onClick\"\n @mousedown=\"overlayEvent.onMousedown\"\n @mouseup=\"overlayEvent.onMouseup\"\n >\n <el-focus-trap\n loop\n :trapped=\"visible\"\n :focus-trap-el=\"rootRef\"\n :focus-start-el=\"focusStartRef\"\n @release-requested=\"onCloseRequested\"\n >\n <div\n ref=\"rootRef\"\n :class=\"[\n ns.b(),\n customClass,\n ns.is('draggable', draggable),\n ns.is('dragging', isDragging),\n { [ns.m('center')]: center },\n ]\"\n :style=\"customStyle\"\n tabindex=\"-1\"\n @click.stop=\"\"\n >\n <div\n v-if=\"title !== null && title !== undefined\"\n ref=\"headerRef\"\n :class=\"[ns.e('header'), { 'show-close': showClose }]\"\n >\n <div :class=\"ns.e('title')\">\n <el-icon\n v-if=\"iconComponent && center\"\n :class=\"[ns.e('status'), typeClass]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <span>{{ title }}</span>\n </div>\n <button\n v-if=\"showClose\"\n type=\"button\"\n :class=\"ns.e('headerbtn')\"\n :aria-label=\"t('el.messagebox.close')\"\n @click=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n @keydown.prevent.enter=\"\n handleAction(distinguishCancelAndClose ? 'close' : 'cancel')\n \"\n >\n <el-icon :class=\"ns.e('close')\">\n <component :is=\"closeIcon || 'close'\" />\n </el-icon>\n </button>\n </div>\n <div :id=\"contentId\" :class=\"ns.e('content')\">\n <div :class=\"ns.e('container')\">\n <el-icon\n v-if=\"iconComponent && !center && hasMessage\"\n :class=\"[ns.e('status'), typeClass]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <div v-if=\"hasMessage\" :class=\"ns.e('message')\">\n <slot>\n <component\n :is=\"showInput ? 'label' : 'p'\"\n v-if=\"!dangerouslyUseHTMLString\"\n :for=\"showInput ? inputId : undefined\"\n v-text=\"message\"\n />\n <component\n :is=\"showInput ? 'label' : 'p'\"\n v-else\n :for=\"showInput ? inputId : undefined\"\n v-html=\"message\"\n />\n </slot>\n </div>\n </div>\n <div v-show=\"showInput\" :class=\"ns.e('input')\">\n <el-input\n :id=\"inputId\"\n ref=\"inputRef\"\n v-model=\"inputValue\"\n :type=\"inputType\"\n :placeholder=\"inputPlaceholder\"\n :aria-invalid=\"validateError\"\n :class=\"{ invalid: validateError }\"\n @keydown.enter=\"handleInputEnter\"\n />\n <div\n :class=\"ns.e('errormsg')\"\n :style=\"{\n visibility: !!editorErrorMessage ? 'visible' : 'hidden',\n }\"\n >\n {{ editorErrorMessage }}\n </div>\n </div>\n </div>\n <div\n v-if=\"showCancelButton || showConfirmButton\"\n :class=\"ns.e('btns')\"\n >\n <el-button\n v-if=\"showCancelButton\"\n :type=\"cancelButtonType === 'text' ? '' : cancelButtonType\"\n :text=\"cancelButtonType === 'text'\"\n :loading=\"cancelButtonLoading\"\n :loading-icon=\"cancelButtonLoadingIcon\"\n :class=\"[cancelButtonClass]\"\n :round=\"roundButton\"\n :size=\"btnSize\"\n @click=\"handleAction('cancel')\"\n @keydown.prevent.enter=\"handleAction('cancel')\"\n >\n {{ cancelButtonText || t('el.messagebox.cancel') }}\n </el-button>\n <el-button\n v-show=\"showConfirmButton\"\n ref=\"confirmRef\"\n :type=\"confirmButtonType === 'text' ? '' : confirmButtonType\"\n :text=\"confirmButtonType === 'text'\"\n :loading=\"confirmButtonLoading\"\n :loading-icon=\"confirmButtonLoadingIcon\"\n :class=\"[confirmButtonClasses]\"\n :round=\"roundButton\"\n :disabled=\"confirmButtonDisabled\"\n :size=\"btnSize\"\n @click=\"handleAction('confirm')\"\n @keydown.prevent.enter=\"handleAction('confirm')\"\n >\n {{ confirmButtonText || t('el.messagebox.confirm') }}\n </el-button>\n </div>\n </div>\n </el-focus-trap>\n </div>\n </el-overlay>\n </transition>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n markRaw,\n nextTick,\n onBeforeUnmount,\n onMounted,\n reactive,\n ref,\n toRefs,\n watch,\n} from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport { TrapFocus } from '@element-plus/directives'\nimport {\n useDraggable,\n useId,\n useLockscreen,\n useSameTarget,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { ElOverlay } from '@element-plus/components/overlay'\nimport {\n TypeComponents,\n TypeComponentsMap,\n isFunction,\n isString,\n isValidComponentSize,\n} from '@element-plus/utils'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Loading } from '@element-plus/icons-vue'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { useGlobalComponentSettings } from '@element-plus/components/config-provider'\n\nimport type { ComponentPublicInstance, PropType } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type {\n Action,\n MessageBoxState,\n MessageBoxType,\n} from './message-box.type'\nimport type { InputInstance } from '@element-plus/components/input'\n\nexport default defineComponent({\n name: 'ElMessageBox',\n directives: {\n TrapFocus,\n },\n components: {\n ElButton,\n ElFocusTrap,\n ElInput,\n ElOverlay,\n ElIcon,\n ...TypeComponents,\n },\n inheritAttrs: false,\n props: {\n buttonSize: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n modal: {\n type: Boolean,\n default: true,\n },\n lockScroll: {\n type: Boolean,\n default: true,\n },\n showClose: {\n type: Boolean,\n default: true,\n },\n closeOnClickModal: {\n type: Boolean,\n default: true,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n closeOnHashChange: {\n type: Boolean,\n default: true,\n },\n center: Boolean,\n draggable: Boolean,\n overflow: Boolean,\n roundButton: Boolean,\n container: {\n type: String, // default append to body\n default: 'body',\n },\n boxType: {\n type: String as PropType<MessageBoxType>,\n default: '',\n },\n },\n emits: ['vanish', 'action'],\n setup(props, { emit }) {\n // const popup = usePopup(props, doClose)\n const {\n locale,\n zIndex,\n ns,\n size: btnSize,\n } = useGlobalComponentSettings(\n 'message-box',\n computed(() => props.buttonSize)\n )\n\n const { t } = locale\n const { nextZIndex } = zIndex\n\n const visible = ref(false)\n // s represents state\n const state = reactive<MessageBoxState>({\n // autofocus element when open message-box\n autofocus: true,\n beforeClose: null,\n callback: null,\n cancelButtonText: '',\n cancelButtonClass: '',\n confirmButtonText: '',\n confirmButtonClass: '',\n cancelButtonType: '',\n confirmButtonType: 'primary',\n customClass: '',\n customStyle: {},\n dangerouslyUseHTMLString: false,\n distinguishCancelAndClose: false,\n icon: '',\n closeIcon: '',\n inputPattern: null,\n inputPlaceholder: '',\n inputType: 'text',\n inputValue: '',\n inputValidator: undefined,\n inputErrorMessage: '',\n message: '',\n modalFade: true,\n modalClass: '',\n showCancelButton: false,\n showConfirmButton: true,\n type: '',\n title: undefined,\n showInput: false,\n action: '' as Action,\n confirmButtonLoading: false,\n cancelButtonLoading: false,\n confirmButtonLoadingIcon: markRaw(Loading),\n cancelButtonLoadingIcon: markRaw(Loading),\n confirmButtonDisabled: false,\n editorErrorMessage: '',\n // refer to: https://github.com/ElemeFE/element/commit/2999279ae34ef10c373ca795c87b020ed6753eed\n // seemed ok for now without this state.\n // isOnComposition: false, // temporary remove\n validateError: false,\n zIndex: nextZIndex(),\n })\n\n const typeClass = computed(() => {\n const type = state.type\n return { [ns.bm('icon', type)]: type && TypeComponentsMap[type] }\n })\n\n const contentId = useId()\n const inputId = useId()\n\n const iconComponent = computed(() => {\n const type = state.type\n return state.icon || (type && TypeComponentsMap[type]) || ''\n })\n const hasMessage = computed(() => !!state.message)\n const rootRef = ref<HTMLElement>()\n const headerRef = ref<HTMLElement>()\n const focusStartRef = ref<HTMLElement>()\n const inputRef = ref<InputInstance>()\n const confirmRef = ref<ComponentPublicInstance>()\n\n const confirmButtonClasses = computed(() => state.confirmButtonClass)\n\n watch(\n () => state.inputValue,\n async (val) => {\n await nextTick()\n if (props.boxType === 'prompt' && val) {\n validate()\n }\n },\n { immediate: true }\n )\n\n watch(\n () => visible.value,\n (val) => {\n if (val) {\n if (props.boxType !== 'prompt') {\n if (state.autofocus) {\n focusStartRef.value = confirmRef.value?.$el ?? rootRef.value\n } else {\n focusStartRef.value = rootRef.value\n }\n }\n state.zIndex = nextZIndex()\n }\n if (props.boxType !== 'prompt') return\n if (val) {\n nextTick().then(() => {\n if (inputRef.value && inputRef.value.$el) {\n if (state.autofocus) {\n focusStartRef.value = getInputElement() ?? rootRef.value\n } else {\n focusStartRef.value = rootRef.value\n }\n }\n })\n } else {\n state.editorErrorMessage = ''\n state.validateError = false\n }\n }\n )\n\n const draggable = computed(() => props.draggable)\n const overflow = computed(() => props.overflow)\n const { isDragging } = useDraggable(rootRef, headerRef, draggable, overflow)\n\n onMounted(async () => {\n await nextTick()\n if (props.closeOnHashChange) {\n window.addEventListener('hashchange', doClose)\n }\n })\n\n onBeforeUnmount(() => {\n if (props.closeOnHashChange) {\n window.removeEventListener('hashchange', doClose)\n }\n })\n\n function doClose() {\n if (!visible.value) return\n visible.value = false\n nextTick(() => {\n if (state.action) emit('action', state.action)\n })\n }\n\n const handleWrapperClick = () => {\n if (props.closeOnClickModal) {\n handleAction(state.distinguishCancelAndClose ? 'close' : 'cancel')\n }\n }\n\n const overlayEvent = useSameTarget(handleWrapperClick)\n\n const handleInputEnter = (e: KeyboardEvent | Event) => {\n if (state.inputType !== 'textarea' && !inputRef.value?.isComposing) {\n e.preventDefault()\n return handleAction('confirm')\n }\n }\n\n const handleAction = (action: Action) => {\n if (props.boxType === 'prompt' && action === 'confirm' && !validate()) {\n return\n }\n\n state.action = action\n\n if (state.beforeClose) {\n state.beforeClose?.(action, state, doClose)\n } else {\n doClose()\n }\n }\n\n const validate = () => {\n if (props.boxType === 'prompt') {\n const inputPattern = state.inputPattern\n if (inputPattern && !inputPattern.test(state.inputValue || '')) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n const inputValidator = state.inputValidator\n if (isFunction(inputValidator)) {\n const validateResult = inputValidator(state.inputValue)\n if (validateResult === false) {\n state.editorErrorMessage =\n state.inputErrorMessage || t('el.messagebox.error')\n state.validateError = true\n return false\n }\n if (isString(validateResult)) {\n state.editorErrorMessage = validateResult\n state.validateError = true\n return false\n }\n }\n }\n state.editorErrorMessage = ''\n state.validateError = false\n return true\n }\n\n const getInputElement = () => {\n const inputRefs = inputRef.value?.$refs\n return (inputRefs?.input ?? inputRefs?.textarea) as HTMLElement\n }\n\n const handleClose = () => {\n handleAction('close')\n }\n\n // when close on press escape is disabled, pressing esc should not callout\n // any other message box and close any other dialog-ish elements\n // e.g. Dialog has a close on press esc feature, and when it closes, it calls\n // props.beforeClose method to make a intermediate state by callout a message box\n // for some verification or alerting. then if we allow global event like this\n // to dispatch, it could callout another message box.\n const onCloseRequested = () => {\n if (props.closeOnPressEscape) {\n handleClose()\n }\n }\n\n // locks the screen to prevent scroll\n if (props.lockScroll) {\n useLockscreen(visible, { ns })\n }\n\n return {\n ...toRefs(state),\n ns,\n overlayEvent,\n visible,\n hasMessage,\n typeClass,\n contentId,\n inputId,\n btnSize,\n iconComponent,\n confirmButtonClasses,\n rootRef,\n focusStartRef,\n headerRef,\n inputRef,\n isDragging,\n confirmRef,\n doClose, // for outside usage\n handleClose, // for out side usage\n onCloseRequested,\n handleWrapperClick,\n handleInputEnter,\n handleAction,\n t,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyMA,IAAA,0CAAA,GAAA,I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iB;GACrB,IAAI,MAAM,YAAY,UAAU;IAC9B,MAAM,eAAe,MAAM;IAC3B,IAAI,gBAAgB,CAAC,aAAa,KAAK,MAAM,cAAc,GAAG,EAAE;KAC9D,MAAM,qBACJ,MAAM,qBAAqB,EAAE,sBAAqB;KACpD,MAAM,gBAAgB;KACtB,OAAO;;IAET,MAAM,iBAAiB,MAAM;IAC7B,KAAA,GAAA,YAAA,YAAe,eAAe,EAAE;KAC9B,MAAM,iBAAiB,eAAe,MAAM,WAAU;KACtD,IAAI,mBAAmB,OAAO;MAC5B,MAAM,qBACJ,MAAM,qBAAqB,EAAE,sBAAqB;MACpD,MAAM,gBAAgB;MACtB,OAAO;;KAET,KAAA,GAAA,YAAA,UAAa,eAAe,EAAE;MAC5B,MAAM,qBAAqB;MAC3B,MAAM,gBAAgB;MACtB,OAAO;;;;GAIb,MAAM,qBAAqB;GAC3B,MAAM,gBAAgB;GACtB,OAAO;;EAGT,MAAM,wBAAwB;GAC5B,MAAM,YAAY,SAAS,OAAO;GAClC,OAAQ,WAAW,SAAS,WAAW;;EAGzC,MAAM,oBAAoB;GACxB,aAAa,QAAO;;EAStB,MAAM,yBAAyB;GAC7B,IAAI,MAAM,oBACR,aAAY;;EAKhB,IAAI,MAAM,YACR,gBAAA,cAAc,SAAS,EAAE,IAAI,CAAA;EAG/B,OAAO;GACL,IAAA,GAAA,IAAA,QAAU,MAAM;GAChB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACF;;CAEH,CAAA"}
@@ -134,10 +134,10 @@ declare const _default: _$vue.DefineComponent<ExtractPropTypes<{
134
134
  "onPrev-click"?: ((val: number) => any) | undefined;
135
135
  "onNext-click"?: ((val: number) => any) | undefined;
136
136
  }>, {
137
- readonly layout: string;
138
137
  readonly small: boolean;
139
138
  readonly teleported: EpPropMergeType<BooleanConstructor, unknown, unknown>;
140
139
  readonly disabled: boolean;
140
+ readonly layout: string;
141
141
  readonly popperClass: string;
142
142
  readonly background: boolean;
143
143
  readonly pagerCount: number;
@@ -1,10 +1,10 @@
1
1
  require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_vnode = require("../../../utils/vue/vnode.js");
3
- const require_index = require("../../../hooks/use-calc-input-width/index.js");
4
- const require_index$1 = require("../../icon/index.js");
5
- const require_index$2 = require("../../tooltip/index.js");
6
- const require_index$3 = require("../../scrollbar/index.js");
7
- const require_index$4 = require("../../../directives/click-outside/index.js");
3
+ const require_index = require("../../../directives/click-outside/index.js");
4
+ const require_index$1 = require("../../../hooks/use-calc-input-width/index.js");
5
+ const require_index$2 = require("../../icon/index.js");
6
+ const require_index$3 = require("../../tooltip/index.js");
7
+ const require_index$4 = require("../../scrollbar/index.js");
8
8
  const require_index$5 = require("../../tag/index.js");
9
9
  const require_useProps = require("../../select-v2/src/useProps.js");
10
10
  const require_token = require("./token.js");
@@ -52,11 +52,11 @@ var select_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
52
52
  ElOptions: require_options.default,
53
53
  ElOptionGroup: require_option_group.default,
54
54
  ElTag: require_index$5.ElTag,
55
- ElScrollbar: require_index$3.ElScrollbar,
56
- ElTooltip: require_index$2.ElTooltip,
57
- ElIcon: require_index$1.ElIcon
55
+ ElScrollbar: require_index$4.ElScrollbar,
56
+ ElTooltip: require_index$3.ElTooltip,
57
+ ElIcon: require_index$2.ElIcon
58
58
  },
59
- directives: { ClickOutside: require_index$4.default },
59
+ directives: { ClickOutside: require_index.default },
60
60
  props: require_select.selectProps,
61
61
  emits: require_select.selectEmits,
62
62
  setup(props, { emit, slots }) {
@@ -75,7 +75,7 @@ var select_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
75
75
  modelValue
76
76
  });
77
77
  const API = require_useSelect.useSelect(_props, emit);
78
- const { calculatorRef, inputStyle } = require_index.useCalcInputWidth();
78
+ const { calculatorRef, inputStyle } = require_index$1.useCalcInputWidth();
79
79
  const { getLabel, getValue, getOptions, getDisabled } = require_useProps.useProps(props);
80
80
  const getOptionProps = (option) => ({
81
81
  label: getLabel(option),
@@ -1 +1 @@
1
- {"version":3,"file":"select.vue_vue_type_script_lang.js","names":[],"sources":["../../../../../../packages/components/select/src/select.vue"],"sourcesContent":["<template>\n <div\n ref=\"selectRef\"\n v-click-outside:[popperRef]=\"handleClickOutside\"\n :class=\"[nsSelect.b(), nsSelect.m(selectSize)]\"\n @[mouseEnterEventName]=\"states.inputHovering = true\"\n @mouseleave=\"states.inputHovering = false\"\n >\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownMenuVisible\"\n :placement=\"placement\"\n :teleported=\"teleported\"\n :popper-class=\"[nsSelect.e('popper'), popperClass]\"\n :popper-style=\"popperStyle\"\n :popper-options=\"popperOptions\"\n :fallback-placements=\"fallbackPlacements\"\n :effect=\"effect\"\n pure\n trigger=\"click\"\n :transition=\"`${nsSelect.namespace.value}-zoom-in-top`\"\n :stop-popper-mouse-event=\"false\"\n :gpu-acceleration=\"false\"\n :persistent=\"persistent\"\n :append-to=\"appendTo\"\n :show-arrow=\"showArrow\"\n :offset=\"offset\"\n @before-show=\"handleMenuEnter\"\n @hide=\"states.isBeforeHide = false\"\n >\n <template #default>\n <div\n ref=\"wrapperRef\"\n :class=\"[\n nsSelect.e('wrapper'),\n nsSelect.is('focused', isFocused),\n nsSelect.is('hovering', states.inputHovering),\n nsSelect.is('filterable', filterable),\n nsSelect.is('disabled', selectDisabled),\n ]\"\n @click.prevent=\"toggleMenu\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixRef\"\n :class=\"nsSelect.e('prefix')\"\n >\n <slot name=\"prefix\" />\n </div>\n <div\n ref=\"selectionRef\"\n :class=\"[\n nsSelect.e('selection'),\n nsSelect.is(\n 'near',\n multiple && !$slots.prefix && !!states.selected.length\n ),\n ]\"\n >\n <slot\n v-if=\"multiple\"\n name=\"tag\"\n :data=\"states.selected\"\n :delete-tag=\"deleteTag\"\n :select-disabled=\"selectDisabled\"\n >\n <div\n v-for=\"item in showTagList\"\n :key=\"getValueKey(item)\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n :closable=\"!selectDisabled && !item.isDisabled\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n :style=\"tagStyle\"\n @close=\"deleteTag($event, item)\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n <slot\n name=\"label\"\n :index=\"item.index\"\n :label=\"item.currentLabel\"\n :value=\"item.value\"\n >\n {{ item.currentLabel }}\n </slot>\n </span>\n </el-tag>\n </div>\n\n <el-tooltip\n v-if=\"collapseTags && states.selected.length > maxCollapseTags\"\n ref=\"tagTooltipRef\"\n :disabled=\"dropdownMenuVisible || !collapseTagsTooltip\"\n :fallback-placements=\"\n tagTooltip?.fallbackPlacements ?? [\n 'bottom',\n 'top',\n 'right',\n 'left',\n ]\n \"\n :effect=\"tagTooltip?.effect ?? effect\"\n :placement=\"tagTooltip?.placement ?? 'bottom'\"\n :popper-class=\"tagTooltip?.popperClass ?? popperClass\"\n :popper-style=\"tagTooltip?.popperStyle ?? popperStyle\"\n :teleported=\"tagTooltip?.teleported ?? teleported\"\n :append-to=\"tagTooltip?.appendTo ?? appendTo\"\n :popper-options=\"tagTooltip?.popperOptions ?? popperOptions\"\n :transition=\"tagTooltip?.transition\"\n :show-after=\"tagTooltip?.showAfter\"\n :hide-after=\"tagTooltip?.hideAfter\"\n :auto-close=\"tagTooltip?.autoClose\"\n :offset=\"tagTooltip?.offset\"\n >\n <template #default>\n <div\n ref=\"collapseItemRef\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n :closable=\"false\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n :style=\"collapseTagStyle\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n + {{ states.selected.length - maxCollapseTags }}\n </span>\n </el-tag>\n </div>\n </template>\n <template #content>\n <div ref=\"tagMenuRef\" :class=\"nsSelect.e('selection')\">\n <div\n v-for=\"item in collapseTagList\"\n :key=\"getValueKey(item)\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n class=\"in-tooltip\"\n :closable=\"!selectDisabled && !item.isDisabled\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n @close=\"deleteTag($event, item)\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n <slot\n name=\"label\"\n :index=\"item.index\"\n :label=\"item.currentLabel\"\n :value=\"item.value\"\n >\n {{ item.currentLabel }}\n </slot>\n </span>\n </el-tag>\n </div>\n </div>\n </template>\n </el-tooltip>\n </slot>\n <div\n :class=\"[\n nsSelect.e('selected-item'),\n nsSelect.e('input-wrapper'),\n nsSelect.is(\n 'hidden',\n !filterable ||\n selectDisabled ||\n (multiple && !states.inputValue && !isFocused)\n ),\n ]\"\n >\n <input\n :id=\"inputId\"\n ref=\"inputRef\"\n :value=\"states.inputValue\"\n type=\"text\"\n :name=\"name\"\n :class=\"[nsSelect.e('input'), nsSelect.is(selectSize)]\"\n :disabled=\"selectDisabled\"\n :autocomplete=\"autocomplete\"\n :style=\"inputStyle\"\n :tabindex=\"tabindex\"\n role=\"combobox\"\n :readonly=\"!filterable\"\n spellcheck=\"false\"\n :aria-activedescendant=\"hoverOption?.id || ''\"\n :aria-controls=\"contentId\"\n :aria-expanded=\"dropdownMenuVisible\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n aria-haspopup=\"listbox\"\n @keydown=\"handleKeydown\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"onInput\"\n @change.stop\n @click.stop=\"toggleMenu\"\n />\n <span\n v-if=\"filterable\"\n ref=\"calculatorRef\"\n aria-hidden=\"true\"\n :class=\"nsSelect.e('input-calculator')\"\n v-text=\"states.inputValue\"\n />\n </div>\n <div\n v-if=\"shouldShowPlaceholder\"\n :class=\"[\n nsSelect.e('selected-item'),\n nsSelect.e('placeholder'),\n nsSelect.is(\n 'transparent',\n !hasModelValue || (expanded && !states.inputValue)\n ),\n ]\"\n >\n <slot\n v-if=\"hasModelValue\"\n name=\"label\"\n :index=\"getOption(modelValue!).index\"\n :label=\"currentPlaceholder\"\n :value=\"modelValue\"\n >\n <span>{{ currentPlaceholder }}</span>\n </slot>\n <span v-else>{{ currentPlaceholder }}</span>\n </div>\n </div>\n <div ref=\"suffixRef\" :class=\"nsSelect.e('suffix')\">\n <el-icon\n v-if=\"iconComponent && !showClearBtn\"\n :class=\"[nsSelect.e('caret'), nsSelect.e('icon'), iconReverse]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <el-icon\n v-if=\"showClearBtn && clearIcon\"\n :class=\"[\n nsSelect.e('caret'),\n nsSelect.e('icon'),\n nsSelect.e('clear'),\n ]\"\n @click=\"handleClearClick\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </div>\n </div>\n </template>\n <template #content>\n <el-select-menu ref=\"menuRef\">\n <div\n v-if=\"$slots.header\"\n :class=\"nsSelect.be('dropdown', 'header')\"\n @click.stop\n >\n <slot name=\"header\" />\n </div>\n <el-scrollbar\n v-show=\"states.options.size > 0 && !loading\"\n :id=\"contentId\"\n ref=\"scrollbarRef\"\n tag=\"ul\"\n :wrap-class=\"nsSelect.be('dropdown', 'wrap')\"\n :view-class=\"nsSelect.be('dropdown', 'list')\"\n :class=\"[nsSelect.is('empty', filteredOptionsCount === 0)]\"\n role=\"listbox\"\n :aria-label=\"ariaLabel\"\n aria-orientation=\"vertical\"\n @scroll=\"popupScroll\"\n @end-reached=\"endReached\"\n >\n <el-option\n v-if=\"showNewOption\"\n :value=\"states.inputValue\"\n :created=\"true\"\n />\n <el-options>\n <slot>\n <template v-for=\"(option, index) in options\" :key=\"index\">\n <el-option-group\n v-if=\"getOptions(option)?.length\"\n :label=\"getLabel(option)\"\n :disabled=\"getDisabled(option)\"\n >\n <el-option\n v-for=\"item in getOptions(option)\"\n :key=\"getValue(item)\"\n v-bind=\"getOptionProps(item)\"\n />\n </el-option-group>\n <el-option v-else v-bind=\"getOptionProps(option)\" />\n </template>\n </slot>\n </el-options>\n </el-scrollbar>\n <div\n v-if=\"$slots.loading && loading\"\n :class=\"nsSelect.be('dropdown', 'loading')\"\n >\n <slot name=\"loading\" />\n </div>\n <div\n v-else-if=\"loading || filteredOptionsCount === 0\"\n :class=\"nsSelect.be('dropdown', 'empty')\"\n >\n <slot name=\"empty\">\n <span>{{ emptyText }}</span>\n </slot>\n </div>\n <div\n v-if=\"$slots.footer\"\n :class=\"nsSelect.be('dropdown', 'footer')\"\n @click.stop\n >\n <slot name=\"footer\" />\n </div>\n </el-select-menu>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n onBeforeUnmount,\n provide,\n reactive,\n toRefs,\n watch,\n} from 'vue'\nimport { ClickOutside } from '@element-plus/directives'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport ElTag from '@element-plus/components/tag'\nimport ElIcon from '@element-plus/components/icon'\nimport { flattedChildren, isArray, isObject } from '@element-plus/utils'\nimport { useCalcInputWidth } from '@element-plus/hooks'\nimport { useProps } from '@element-plus/components/select-v2/src/useProps'\nimport ElOption from './option.vue'\nimport ElSelectMenu from './select-dropdown.vue'\nimport { useSelect } from './useSelect'\nimport { selectKey } from './token'\nimport ElOptions from './options'\nimport { selectEmits, selectProps } from './select'\nimport ElOptionGroup from './option-group.vue'\n\nimport type { AppConfig, AppContext, VNode } from 'vue'\nimport type { SelectContext } from './type'\n\nconst COMPONENT_NAME = 'ElSelect'\n\ntype WarnHandler = AppConfig['warnHandler']\n\ninterface WarnHandlerRecord {\n originalWarnHandler: WarnHandler\n handler: WarnHandler\n count: number\n}\n\nconst warnHandlerMap = new WeakMap<AppContext, WarnHandlerRecord>()\n\nconst createSelectWarnHandler = (appContext: AppContext): WarnHandler => {\n return (...args) => {\n // Overrides warnings about slots not being executable outside of a render function.\n // We call slot below just to simulate data when persist is false, this warning message should be ignored\n const message = args[0]\n if (\n !message ||\n (message.includes(\n 'Slot \"default\" invoked outside of the render function'\n ) &&\n args[2]?.includes('ElTreeSelect'))\n )\n return\n const original = warnHandlerMap.get(appContext)?.originalWarnHandler\n if (original) {\n original(...args)\n return\n }\n // eslint-disable-next-line no-console\n console.warn(...args)\n }\n}\n\nconst getWarnHandlerRecord = (appContext: AppContext): WarnHandlerRecord => {\n let record = warnHandlerMap.get(appContext)\n if (!record) {\n record = {\n originalWarnHandler: appContext.config.warnHandler,\n handler: createSelectWarnHandler(appContext),\n count: 0,\n }\n warnHandlerMap.set(appContext, record)\n }\n return record\n}\nexport default defineComponent({\n name: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n components: {\n ElSelectMenu,\n ElOption,\n ElOptions,\n ElOptionGroup,\n ElTag,\n ElScrollbar,\n ElTooltip,\n ElIcon,\n },\n directives: { ClickOutside },\n props: selectProps,\n emits: selectEmits,\n\n setup(props, { emit, slots }) {\n const instance = getCurrentInstance()!\n const warnRecord = getWarnHandlerRecord(instance.appContext)\n warnRecord.count += 1\n instance.appContext.config.warnHandler = warnRecord.handler\n const modelValue = computed(() => {\n const { modelValue: rawModelValue, multiple } = props\n const fallback = multiple ? [] : undefined\n // When it is array, we check if this is multi-select.\n // Based on the result we get\n if (isArray(rawModelValue)) {\n return multiple ? rawModelValue : fallback\n }\n\n return multiple ? fallback : rawModelValue\n })\n\n const _props = reactive({\n ...toRefs(props),\n modelValue,\n })\n\n const API = useSelect(_props, emit)\n const { calculatorRef, inputStyle } = useCalcInputWidth()\n const { getLabel, getValue, getOptions, getDisabled } = useProps(props)\n\n const getOptionProps = (option: Record<string, any>) => ({\n label: getLabel(option),\n value: getValue(option),\n disabled: getDisabled(option),\n })\n\n const flatTreeSelectData = (data: any[]) => {\n return data.reduce((acc, item) => {\n acc.push(item)\n if (item.children && item.children.length > 0) {\n acc.push(...flatTreeSelectData(item.children))\n }\n return acc\n }, [])\n }\n\n const manuallyRenderSlots = (vnodes: VNode[] | undefined) => {\n // After option rendering is completed, the useSelect internal state can collect the value of each option.\n // If the persistent value is false, option will not be rendered by default, so in this case,\n // manually render and load option data here.\n const children = flattedChildren(vnodes || []) as VNode[]\n children.forEach((item) => {\n if (\n isObject(item) &&\n // @ts-expect-error\n (item.type.name === 'ElOption' || item.type.name === 'ElTree')\n ) {\n // @ts-expect-error\n const _name = item.type.name\n if (_name === 'ElTree') {\n // tree-select component is a special case.\n // So we need to handle it separately.\n const treeData = item.props?.data || []\n const flatData = flatTreeSelectData(treeData)\n flatData.forEach((treeItem: any) => {\n treeItem.currentLabel =\n treeItem.label ??\n (isObject(treeItem.value) ? '' : treeItem.value)\n API.onOptionCreate(treeItem)\n })\n } else if (_name === 'ElOption') {\n const obj = { ...item.props } as any\n obj.currentLabel =\n obj.label ?? (isObject(obj.value) ? '' : obj.value)\n API.onOptionCreate(obj)\n }\n }\n })\n }\n watch(\n () => [\n props.persistent || API.expanded.value || !slots.default\n ? undefined\n : slots.default?.(),\n modelValue.value,\n ],\n () => {\n // When persistent is false and the dropdown is closed, the menu is unmounted.\n // We should always re-hydrate option data from slots so labels stay in sync\n // with dynamic option list updates. Skip only when persistent is true or\n // when the dropdown is currently expanded (mounted options will manage themselves).\n if (props.persistent || API.expanded.value) {\n // If persistent is true, we don't need to manually render slots.\n return\n }\n // When using :options prop (no slot content), el-option components register\n // and unregister themselves via onOptionCreate/onOptionDestroy lifecycle hooks.\n // Calling options.clear() here would prematurely wipe options that are still\n // mounted, causing a \"No Data\" flash during rapid open/close toggling.\n if (!slots.default) {\n return\n }\n // Reset current options snapshot before re-collecting from slots.\n API.states.options.clear()\n manuallyRenderSlots(slots.default?.())\n },\n {\n immediate: true,\n }\n )\n\n provide(\n selectKey,\n reactive({\n props: _props,\n states: API.states,\n selectRef: API.selectRef,\n optionsArray: API.optionsArray,\n setSelected: API.setSelected,\n handleOptionSelect: API.handleOptionSelect,\n onOptionCreate: API.onOptionCreate,\n onOptionDestroy: API.onOptionDestroy,\n }) satisfies SelectContext\n )\n\n const selectedLabel = computed(() => {\n if (!props.multiple) {\n return API.states.selectedLabel\n }\n return API.states.selected.map((i) => i.currentLabel as string)\n })\n\n onBeforeUnmount(() => {\n // https://github.com/element-plus/element-plus/issues/21279\n const record = warnHandlerMap.get(instance.appContext)\n if (!record) return\n record.count -= 1\n if (record.count <= 0) {\n instance.appContext.config.warnHandler = record.originalWarnHandler\n warnHandlerMap.delete(instance.appContext)\n }\n })\n\n return {\n ...API,\n modelValue,\n selectedLabel,\n calculatorRef,\n inputStyle,\n getLabel,\n getValue,\n getOptions,\n getDisabled,\n getOptionProps,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuXA,MAAM,iBAAiB;AAUvB,MAAM,iCAAiB,IAAI,SAAuC;AAElE,MAAM,2BAA2B,eAAwC;CACvE,QAAQ,GAAG,SAAS;EAGlB,MAAM,UAAU,KAAK;EACrB,IACE,CAAC,WACA,QAAQ,SACP,0DACF,IACE,KAAK,IAAI,SAAS,eAAe,EAEnC;EACF,MAAM,WAAW,eAAe,IAAI,WAAW,EAAE;EACjD,IAAI,UAAU;GACZ,SAAS,GAAG,KAAI;GAChB;;EAGF,QAAQ,KAAK,GAAG,KAAI;;;AAIxB,MAAM,wBAAwB,eAA8C;CAC1E,IAAI,SAAS,eAAe,IAAI,WAAU;CAC1C,IAAI,CAAC,QAAQ;EACX,SAAS;GACP,qBAAqB,WAAW,OAAO;GACvC,SAAS,wBAAwB,WAAW;GAC5C,OAAO;GACT;EACA,eAAe,IAAI,YAAY,OA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O,SAAS,KAAK,MAAM,EAAE,aAAsB;IAC/D;EAED,CAAA,GAAA,IAAA,uBAAsB;GAEpB,MAAM,SAAS,eAAe,IAAI,SAAS,WAAU;GACrD,IAAI,CAAC,QAAQ;GACb,OAAO,SAAS;GAChB,IAAI,OAAO,SAAS,GAAG;IACrB,SAAS,WAAW,OAAO,cAAc,OAAO;IAChD,eAAe,OAAO,SAAS,WAAU;;IAE5C;EAED,OAAO;GACL,GAAG;GACH;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACF;;CAEH,CAAA"}
1
+ {"version":3,"file":"select.vue_vue_type_script_lang.js","names":[],"sources":["../../../../../../packages/components/select/src/select.vue"],"sourcesContent":["<template>\n <div\n ref=\"selectRef\"\n v-click-outside:[popperRef]=\"handleClickOutside\"\n :class=\"[nsSelect.b(), nsSelect.m(selectSize)]\"\n @[mouseEnterEventName]=\"states.inputHovering = true\"\n @mouseleave=\"states.inputHovering = false\"\n >\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownMenuVisible\"\n :placement=\"placement\"\n :teleported=\"teleported\"\n :popper-class=\"[nsSelect.e('popper'), popperClass]\"\n :popper-style=\"popperStyle\"\n :popper-options=\"popperOptions\"\n :fallback-placements=\"fallbackPlacements\"\n :effect=\"effect\"\n pure\n trigger=\"click\"\n :transition=\"`${nsSelect.namespace.value}-zoom-in-top`\"\n :stop-popper-mouse-event=\"false\"\n :gpu-acceleration=\"false\"\n :persistent=\"persistent\"\n :append-to=\"appendTo\"\n :show-arrow=\"showArrow\"\n :offset=\"offset\"\n @before-show=\"handleMenuEnter\"\n @hide=\"states.isBeforeHide = false\"\n >\n <template #default>\n <div\n ref=\"wrapperRef\"\n :class=\"[\n nsSelect.e('wrapper'),\n nsSelect.is('focused', isFocused),\n nsSelect.is('hovering', states.inputHovering),\n nsSelect.is('filterable', filterable),\n nsSelect.is('disabled', selectDisabled),\n ]\"\n @click.prevent=\"toggleMenu\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixRef\"\n :class=\"nsSelect.e('prefix')\"\n >\n <slot name=\"prefix\" />\n </div>\n <div\n ref=\"selectionRef\"\n :class=\"[\n nsSelect.e('selection'),\n nsSelect.is(\n 'near',\n multiple && !$slots.prefix && !!states.selected.length\n ),\n ]\"\n >\n <slot\n v-if=\"multiple\"\n name=\"tag\"\n :data=\"states.selected\"\n :delete-tag=\"deleteTag\"\n :select-disabled=\"selectDisabled\"\n >\n <div\n v-for=\"item in showTagList\"\n :key=\"getValueKey(item)\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n :closable=\"!selectDisabled && !item.isDisabled\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n :style=\"tagStyle\"\n @close=\"deleteTag($event, item)\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n <slot\n name=\"label\"\n :index=\"item.index\"\n :label=\"item.currentLabel\"\n :value=\"item.value\"\n >\n {{ item.currentLabel }}\n </slot>\n </span>\n </el-tag>\n </div>\n\n <el-tooltip\n v-if=\"collapseTags && states.selected.length > maxCollapseTags\"\n ref=\"tagTooltipRef\"\n :disabled=\"dropdownMenuVisible || !collapseTagsTooltip\"\n :fallback-placements=\"\n tagTooltip?.fallbackPlacements ?? [\n 'bottom',\n 'top',\n 'right',\n 'left',\n ]\n \"\n :effect=\"tagTooltip?.effect ?? effect\"\n :placement=\"tagTooltip?.placement ?? 'bottom'\"\n :popper-class=\"tagTooltip?.popperClass ?? popperClass\"\n :popper-style=\"tagTooltip?.popperStyle ?? popperStyle\"\n :teleported=\"tagTooltip?.teleported ?? teleported\"\n :append-to=\"tagTooltip?.appendTo ?? appendTo\"\n :popper-options=\"tagTooltip?.popperOptions ?? popperOptions\"\n :transition=\"tagTooltip?.transition\"\n :show-after=\"tagTooltip?.showAfter\"\n :hide-after=\"tagTooltip?.hideAfter\"\n :auto-close=\"tagTooltip?.autoClose\"\n :offset=\"tagTooltip?.offset\"\n >\n <template #default>\n <div\n ref=\"collapseItemRef\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n :closable=\"false\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n :style=\"collapseTagStyle\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n + {{ states.selected.length - maxCollapseTags }}\n </span>\n </el-tag>\n </div>\n </template>\n <template #content>\n <div ref=\"tagMenuRef\" :class=\"nsSelect.e('selection')\">\n <div\n v-for=\"item in collapseTagList\"\n :key=\"getValueKey(item)\"\n :class=\"nsSelect.e('selected-item')\"\n >\n <el-tag\n class=\"in-tooltip\"\n :closable=\"!selectDisabled && !item.isDisabled\"\n :size=\"collapseTagSize\"\n :type=\"tagType\"\n :effect=\"tagEffect\"\n disable-transitions\n @close=\"deleteTag($event, item)\"\n >\n <span :class=\"nsSelect.e('tags-text')\">\n <slot\n name=\"label\"\n :index=\"item.index\"\n :label=\"item.currentLabel\"\n :value=\"item.value\"\n >\n {{ item.currentLabel }}\n </slot>\n </span>\n </el-tag>\n </div>\n </div>\n </template>\n </el-tooltip>\n </slot>\n <div\n :class=\"[\n nsSelect.e('selected-item'),\n nsSelect.e('input-wrapper'),\n nsSelect.is(\n 'hidden',\n !filterable ||\n selectDisabled ||\n (multiple && !states.inputValue && !isFocused)\n ),\n ]\"\n >\n <input\n :id=\"inputId\"\n ref=\"inputRef\"\n :value=\"states.inputValue\"\n type=\"text\"\n :name=\"name\"\n :class=\"[nsSelect.e('input'), nsSelect.is(selectSize)]\"\n :disabled=\"selectDisabled\"\n :autocomplete=\"autocomplete\"\n :style=\"inputStyle\"\n :tabindex=\"tabindex\"\n role=\"combobox\"\n :readonly=\"!filterable\"\n spellcheck=\"false\"\n :aria-activedescendant=\"hoverOption?.id || ''\"\n :aria-controls=\"contentId\"\n :aria-expanded=\"dropdownMenuVisible\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n aria-haspopup=\"listbox\"\n @keydown=\"handleKeydown\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"onInput\"\n @change.stop\n @click.stop=\"toggleMenu\"\n />\n <span\n v-if=\"filterable\"\n ref=\"calculatorRef\"\n aria-hidden=\"true\"\n :class=\"nsSelect.e('input-calculator')\"\n v-text=\"states.inputValue\"\n />\n </div>\n <div\n v-if=\"shouldShowPlaceholder\"\n :class=\"[\n nsSelect.e('selected-item'),\n nsSelect.e('placeholder'),\n nsSelect.is(\n 'transparent',\n !hasModelValue || (expanded && !states.inputValue)\n ),\n ]\"\n >\n <slot\n v-if=\"hasModelValue\"\n name=\"label\"\n :index=\"getOption(modelValue!).index\"\n :label=\"currentPlaceholder\"\n :value=\"modelValue\"\n >\n <span>{{ currentPlaceholder }}</span>\n </slot>\n <span v-else>{{ currentPlaceholder }}</span>\n </div>\n </div>\n <div ref=\"suffixRef\" :class=\"nsSelect.e('suffix')\">\n <el-icon\n v-if=\"iconComponent && !showClearBtn\"\n :class=\"[nsSelect.e('caret'), nsSelect.e('icon'), iconReverse]\"\n >\n <component :is=\"iconComponent\" />\n </el-icon>\n <el-icon\n v-if=\"showClearBtn && clearIcon\"\n :class=\"[\n nsSelect.e('caret'),\n nsSelect.e('icon'),\n nsSelect.e('clear'),\n ]\"\n @click=\"handleClearClick\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </div>\n </div>\n </template>\n <template #content>\n <el-select-menu ref=\"menuRef\">\n <div\n v-if=\"$slots.header\"\n :class=\"nsSelect.be('dropdown', 'header')\"\n @click.stop\n >\n <slot name=\"header\" />\n </div>\n <el-scrollbar\n v-show=\"states.options.size > 0 && !loading\"\n :id=\"contentId\"\n ref=\"scrollbarRef\"\n tag=\"ul\"\n :wrap-class=\"nsSelect.be('dropdown', 'wrap')\"\n :view-class=\"nsSelect.be('dropdown', 'list')\"\n :class=\"[nsSelect.is('empty', filteredOptionsCount === 0)]\"\n role=\"listbox\"\n :aria-label=\"ariaLabel\"\n aria-orientation=\"vertical\"\n @scroll=\"popupScroll\"\n @end-reached=\"endReached\"\n >\n <el-option\n v-if=\"showNewOption\"\n :value=\"states.inputValue\"\n :created=\"true\"\n />\n <el-options>\n <slot>\n <template v-for=\"(option, index) in options\" :key=\"index\">\n <el-option-group\n v-if=\"getOptions(option)?.length\"\n :label=\"getLabel(option)\"\n :disabled=\"getDisabled(option)\"\n >\n <el-option\n v-for=\"item in getOptions(option)\"\n :key=\"getValue(item)\"\n v-bind=\"getOptionProps(item)\"\n />\n </el-option-group>\n <el-option v-else v-bind=\"getOptionProps(option)\" />\n </template>\n </slot>\n </el-options>\n </el-scrollbar>\n <div\n v-if=\"$slots.loading && loading\"\n :class=\"nsSelect.be('dropdown', 'loading')\"\n >\n <slot name=\"loading\" />\n </div>\n <div\n v-else-if=\"loading || filteredOptionsCount === 0\"\n :class=\"nsSelect.be('dropdown', 'empty')\"\n >\n <slot name=\"empty\">\n <span>{{ emptyText }}</span>\n </slot>\n </div>\n <div\n v-if=\"$slots.footer\"\n :class=\"nsSelect.be('dropdown', 'footer')\"\n @click.stop\n >\n <slot name=\"footer\" />\n </div>\n </el-select-menu>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n onBeforeUnmount,\n provide,\n reactive,\n toRefs,\n watch,\n} from 'vue'\nimport { ClickOutside } from '@element-plus/directives'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport ElTag from '@element-plus/components/tag'\nimport ElIcon from '@element-plus/components/icon'\nimport { flattedChildren, isArray, isObject } from '@element-plus/utils'\nimport { useCalcInputWidth } from '@element-plus/hooks'\nimport { useProps } from '@element-plus/components/select-v2/src/useProps'\nimport ElOption from './option.vue'\nimport ElSelectMenu from './select-dropdown.vue'\nimport { useSelect } from './useSelect'\nimport { selectKey } from './token'\nimport ElOptions from './options'\nimport { selectEmits, selectProps } from './select'\nimport ElOptionGroup from './option-group.vue'\n\nimport type { AppConfig, AppContext, VNode } from 'vue'\nimport type { SelectContext } from './type'\n\nconst COMPONENT_NAME = 'ElSelect'\n\ntype WarnHandler = AppConfig['warnHandler']\n\ninterface WarnHandlerRecord {\n originalWarnHandler: WarnHandler\n handler: WarnHandler\n count: number\n}\n\nconst warnHandlerMap = new WeakMap<AppContext, WarnHandlerRecord>()\n\nconst createSelectWarnHandler = (appContext: AppContext): WarnHandler => {\n return (...args) => {\n // Overrides warnings about slots not being executable outside of a render function.\n // We call slot below just to simulate data when persist is false, this warning message should be ignored\n const message = args[0]\n if (\n !message ||\n (message.includes(\n 'Slot \"default\" invoked outside of the render function'\n ) &&\n args[2]?.includes('ElTreeSelect'))\n )\n return\n const original = warnHandlerMap.get(appContext)?.originalWarnHandler\n if (original) {\n original(...args)\n return\n }\n // eslint-disable-next-line no-console\n console.warn(...args)\n }\n}\n\nconst getWarnHandlerRecord = (appContext: AppContext): WarnHandlerRecord => {\n let record = warnHandlerMap.get(appContext)\n if (!record) {\n record = {\n originalWarnHandler: appContext.config.warnHandler,\n handler: createSelectWarnHandler(appContext),\n count: 0,\n }\n warnHandlerMap.set(appContext, record)\n }\n return record\n}\nexport default defineComponent({\n name: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n components: {\n ElSelectMenu,\n ElOption,\n ElOptions,\n ElOptionGroup,\n ElTag,\n ElScrollbar,\n ElTooltip,\n ElIcon,\n },\n directives: { ClickOutside },\n props: selectProps,\n emits: selectEmits,\n\n setup(props, { emit, slots }) {\n const instance = getCurrentInstance()!\n const warnRecord = getWarnHandlerRecord(instance.appContext)\n warnRecord.count += 1\n instance.appContext.config.warnHandler = warnRecord.handler\n const modelValue = computed(() => {\n const { modelValue: rawModelValue, multiple } = props\n const fallback = multiple ? [] : undefined\n // When it is array, we check if this is multi-select.\n // Based on the result we get\n if (isArray(rawModelValue)) {\n return multiple ? rawModelValue : fallback\n }\n\n return multiple ? fallback : rawModelValue\n })\n\n const _props = reactive({\n ...toRefs(props),\n modelValue,\n })\n\n const API = useSelect(_props, emit)\n const { calculatorRef, inputStyle } = useCalcInputWidth()\n const { getLabel, getValue, getOptions, getDisabled } = useProps(props)\n\n const getOptionProps = (option: Record<string, any>) => ({\n label: getLabel(option),\n value: getValue(option),\n disabled: getDisabled(option),\n })\n\n const flatTreeSelectData = (data: any[]) => {\n return data.reduce((acc, item) => {\n acc.push(item)\n if (item.children && item.children.length > 0) {\n acc.push(...flatTreeSelectData(item.children))\n }\n return acc\n }, [])\n }\n\n const manuallyRenderSlots = (vnodes: VNode[] | undefined) => {\n // After option rendering is completed, the useSelect internal state can collect the value of each option.\n // If the persistent value is false, option will not be rendered by default, so in this case,\n // manually render and load option data here.\n const children = flattedChildren(vnodes || []) as VNode[]\n children.forEach((item) => {\n if (\n isObject(item) &&\n // @ts-expect-error\n (item.type.name === 'ElOption' || item.type.name === 'ElTree')\n ) {\n // @ts-expect-error\n const _name = item.type.name\n if (_name === 'ElTree') {\n // tree-select component is a special case.\n // So we need to handle it separately.\n const treeData = item.props?.data || []\n const flatData = flatTreeSelectData(treeData)\n flatData.forEach((treeItem: any) => {\n treeItem.currentLabel =\n treeItem.label ??\n (isObject(treeItem.value) ? '' : treeItem.value)\n API.onOptionCreate(treeItem)\n })\n } else if (_name === 'ElOption') {\n const obj = { ...item.props } as any\n obj.currentLabel =\n obj.label ?? (isObject(obj.value) ? '' : obj.value)\n API.onOptionCreate(obj)\n }\n }\n })\n }\n watch(\n () => [\n props.persistent || API.expanded.value || !slots.default\n ? undefined\n : slots.default?.(),\n modelValue.value,\n ],\n () => {\n // When persistent is false and the dropdown is closed, the menu is unmounted.\n // We should always re-hydrate option data from slots so labels stay in sync\n // with dynamic option list updates. Skip only when persistent is true or\n // when the dropdown is currently expanded (mounted options will manage themselves).\n if (props.persistent || API.expanded.value) {\n // If persistent is true, we don't need to manually render slots.\n return\n }\n // When using :options prop (no slot content), el-option components register\n // and unregister themselves via onOptionCreate/onOptionDestroy lifecycle hooks.\n // Calling options.clear() here would prematurely wipe options that are still\n // mounted, causing a \"No Data\" flash during rapid open/close toggling.\n if (!slots.default) {\n return\n }\n // Reset current options snapshot before re-collecting from slots.\n API.states.options.clear()\n manuallyRenderSlots(slots.default?.())\n },\n {\n immediate: true,\n }\n )\n\n provide(\n selectKey,\n reactive({\n props: _props,\n states: API.states,\n selectRef: API.selectRef,\n optionsArray: API.optionsArray,\n setSelected: API.setSelected,\n handleOptionSelect: API.handleOptionSelect,\n onOptionCreate: API.onOptionCreate,\n onOptionDestroy: API.onOptionDestroy,\n }) satisfies SelectContext\n )\n\n const selectedLabel = computed(() => {\n if (!props.multiple) {\n return API.states.selectedLabel\n }\n return API.states.selected.map((i) => i.currentLabel as string)\n })\n\n onBeforeUnmount(() => {\n // https://github.com/element-plus/element-plus/issues/21279\n const record = warnHandlerMap.get(instance.appContext)\n if (!record) return\n record.count -= 1\n if (record.count <= 0) {\n instance.appContext.config.warnHandler = record.originalWarnHandler\n warnHandlerMap.delete(instance.appContext)\n }\n })\n\n return {\n ...API,\n modelValue,\n selectedLabel,\n calculatorRef,\n inputStyle,\n getLabel,\n getValue,\n getOptions,\n getDisabled,\n getOptionProps,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuXA,MAAM,iBAAiB;AAUvB,MAAM,iCAAiB,IAAI,SAAuC;AAElE,MAAM,2BAA2B,eAAwC;CACvE,QAAQ,GAAG,SAAS;EAGlB,MAAM,UAAU,KAAK;EACrB,IACE,CAAC,WACA,QAAQ,SACP,0DACF,IACE,KAAK,IAAI,SAAS,eAAe,EAEnC;EACF,MAAM,WAAW,eAAe,IAAI,WAAW,EAAE;EACjD,IAAI,UAAU;GACZ,S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P,QAAQ,IAAI;GACZ,WAAW,IAAI;GACf,cAAc,IAAI;GAClB,aAAa,IAAI;GACjB,oBAAoB,IAAI;GACxB,gBAAgB,IAAI;GACpB,iBAAiB,IAAI;GACtB,CAAA,CACH;EAEA,MAAM,iBAAA,GAAA,IAAA,gBAA+B;GACnC,IAAI,CAAC,MAAM,UACT,OAAO,IAAI,OAAO;GAEpB,OAAO,IAAI,OAAO,SAAS,KAAK,MAAM,EAAE,aAAsB;IAC/D;EAED,CAAA,GAAA,IAAA,uBAAsB;GAEpB,MAAM,SAAS,eAAe,IAAI,SAAS,WAAU;GACrD,IAAI,CAAC,QAAQ;GACb,OAAO,SAAS;GAChB,IAAI,OAAO,SAAS,GAAG;IACrB,SAAS,WAAW,OAAO,cAAc,OAAO;IAChD,eAAe,OAAO,SAAS,WAAU;;IAE5C;EAED,OAAO;GACL,GAAG;GACH;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACF;;CAEH,CAAA"}
@@ -1,10 +1,10 @@
1
1
  require("../../../_virtual/_rolldown/runtime.js");
2
2
  require("../../../constants/form.js");
3
- const require_index = require("../../../hooks/use-calc-input-width/index.js");
4
- const require_index$1 = require("../../../hooks/use-id/index.js");
5
- const require_index$2 = require("../../icon/index.js");
6
- const require_index$3 = require("../../tooltip/index.js");
7
- const require_index$4 = require("../../../directives/click-outside/index.js");
3
+ const require_index = require("../../../directives/click-outside/index.js");
4
+ const require_index$1 = require("../../../hooks/use-calc-input-width/index.js");
5
+ const require_index$2 = require("../../../hooks/use-id/index.js");
6
+ const require_index$3 = require("../../icon/index.js");
7
+ const require_index$4 = require("../../tooltip/index.js");
8
8
  const require_index$5 = require("../../tag/index.js");
9
9
  const require_defaults = require("./defaults.js");
10
10
  const require_token = require("./token.js");
@@ -18,10 +18,10 @@ var select_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
18
18
  components: {
19
19
  ElSelectMenu: require_select_dropdown.default,
20
20
  ElTag: require_index$5.ElTag,
21
- ElTooltip: require_index$3.ElTooltip,
22
- ElIcon: require_index$2.ElIcon
21
+ ElTooltip: require_index$4.ElTooltip,
22
+ ElIcon: require_index$3.ElIcon
23
23
  },
24
- directives: { ClickOutside: require_index$4.default },
24
+ directives: { ClickOutside: require_index.default },
25
25
  props: require_defaults.selectV2Props,
26
26
  emits: require_defaults.selectV2Emits,
27
27
  setup(props, { emit }) {
@@ -35,8 +35,8 @@ var select_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
35
35
  ...(0, vue.toRefs)(props),
36
36
  modelValue
37
37
  }), emit);
38
- const { calculatorRef, inputStyle } = require_index.useCalcInputWidth();
39
- const contentId = require_index$1.useId();
38
+ const { calculatorRef, inputStyle } = require_index$1.useCalcInputWidth();
39
+ const contentId = require_index$2.useId();
40
40
  (0, vue.provide)(require_token.selectV2InjectionKey, {
41
41
  props: (0, vue.reactive)({
42
42
  ...(0, vue.toRefs)(props),