JewelryMall/admin/node_modules/element-plus/es/hooks/use-popper-container/index.mjs.map
2026-02-14 19:29:15 +08:00

1 line
2.3 KiB
Plaintext

{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-popper-container/index.ts"],"sourcesContent":["import { computed, onBeforeMount } from 'vue'\nimport { isClient } from '@element-plus/utils'\nimport { useGetDerivedNamespace } from '../use-namespace'\nimport { useIdInjection } from '../use-id'\n\nexport const usePopperContainerId = () => {\n const namespace = useGetDerivedNamespace()\n const idInjection = useIdInjection()\n\n const id = computed(() => {\n return `${namespace.value}-popper-container-${idInjection.prefix}`\n })\n const selector = computed(() => `#${id.value}`)\n\n return {\n id,\n selector,\n }\n}\n\nconst createContainer = (id: string) => {\n const container = document.createElement('div')\n container.id = id\n document.body.appendChild(container)\n return container\n}\n\nexport const usePopperContainer = () => {\n const { id, selector } = usePopperContainerId()\n onBeforeMount(() => {\n if (!isClient) return\n\n // This is for bypassing the error that when under testing env, we often encounter\n // document.body.innerHTML = '' situation\n // for this we need to disable the caching since it's not really needed\n if (\n process.env.NODE_ENV === 'test' ||\n !document.body.querySelector(selector.value)\n ) {\n createContainer(id.value)\n }\n })\n\n return {\n id,\n selector,\n }\n}\n"],"names":[],"mappings":";;;;;AAKO,MAAM,uBAAuB,MAAM;AACxC,EAAA,MAAM,YAAY,sBAAA,EAAuB;AACzC,EAAA,MAAM,cAAc,cAAA,EAAe;AAEnC,EAAA,MAAM,EAAA,GAAK,SAAS,MAAM;AACxB,IAAA,OAAO,CAAA,EAAG,SAAA,CAAU,KAAK,CAAA,kBAAA,EAAqB,YAAY,MAAM,CAAA,CAAA;AAAA,EAClE,CAAC,CAAA;AACD,EAAA,MAAM,WAAW,QAAA,CAAS,MAAM,CAAA,CAAA,EAAI,EAAA,CAAG,KAAK,CAAA,CAAE,CAAA;AAE9C,EAAA,OAAO;AAAA,IACL,EAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,MAAM,eAAA,GAAkB,CAAC,EAAA,KAAe;AACtC,EAAA,MAAM,SAAA,GAAY,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AAC9C,EAAA,SAAA,CAAU,EAAA,GAAK,EAAA;AACf,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,SAAS,CAAA;AACnC,EAAA,OAAO,SAAA;AACT,CAAA;AAEO,MAAM,qBAAqB,MAAM;AACtC,EAAA,MAAM,EAAE,EAAA,EAAI,QAAA,EAAS,GAAI,oBAAA,EAAqB;AAC9C,EAAA,aAAA,CAAc,MAAM;AAClB,IAAA,IAAI,CAAC,QAAA,EAAU;AAKf,IAAA,IACE,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,MAAA,IACzB,CAAC,SAAS,IAAA,CAAK,aAAA,CAAc,QAAA,CAAS,KAAK,CAAA,EAC3C;AACA,MAAA,eAAA,CAAgB,GAAG,KAAK,CAAA;AAAA,IAC1B;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,EAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}