zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
{"version":3,"file":"use-content-dom.mjs","sources":["../../../../../../../packages/components/popper/src/composables/use-content-dom.ts"],"sourcesContent":["import { computed, ref, unref } from 'vue'\nimport { useNamespace, useZIndex } from '@element-plus/hooks'\n\nimport type { CSSProperties, StyleValue } from 'vue'\nimport type { UsePopperReturn } from '@element-plus/hooks'\nimport type { UsePopperContentReturn } from './use-content'\nimport type { PopperContentProps } from '../content'\n\nexport const usePopperContentDOM = (\n  props: PopperContentProps,\n  {\n    attributes,\n    styles,\n    role,\n  }: Pick<UsePopperReturn, 'attributes' | 'styles'> &\n    Pick<UsePopperContentReturn, 'role'>\n) => {\n  const { nextZIndex } = useZIndex()\n  const ns = useNamespace('popper')\n\n  const contentAttrs = computed(() => unref(attributes).popper)\n  const contentZIndex = ref<number>(props.zIndex || nextZIndex())\n  const contentClass = computed(() => [\n    ns.b(),\n    ns.is('pure', props.pure),\n    ns.is(props.effect),\n    props.popperClass,\n  ])\n  const contentStyle = computed<StyleValue[]>(() => {\n    return [\n      { zIndex: unref(contentZIndex) } as CSSProperties,\n      unref(styles).popper as CSSProperties,\n      props.popperStyle || {},\n    ]\n  })\n  const ariaModal = computed<string | undefined>(() =>\n    role.value === 'dialog' ? 'false' : undefined\n  )\n  const arrowStyle = computed(\n    () => (unref(styles).arrow || {}) as CSSProperties\n  )\n\n  const updateZIndex = () => {\n    contentZIndex.value = props.zIndex || nextZIndex()\n  }\n\n  return {\n    ariaModal,\n    arrowStyle,\n    contentAttrs,\n    contentClass,\n    contentStyle,\n    contentZIndex,\n\n    updateZIndex,\n  }\n}\n\nexport type UsePopperContentDOMReturn = ReturnType<typeof usePopperContentDOM>\n"],"names":[],"mappings":";;;;;AAEY,MAAC,mBAAmB,GAAG,CAAC,KAAK,EAAE;AAC3C,EAAE,UAAU;AACZ,EAAE,MAAM;AACR,EAAE,IAAI;AACN,CAAC,KAAK;AACN,EAAE,MAAM,EAAE,UAAU,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