2
This commit is contained in:
7
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.d.ts
generated
vendored
Normal file
7
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Ref, VNode } from 'vue';
|
||||
export declare const useTeleport: (contentRenderer: () => VNode, appendToBody: Ref<boolean>) => {
|
||||
isTeleportVisible: Ref<boolean>;
|
||||
showTeleport: () => void;
|
||||
hideTeleport: () => void;
|
||||
renderTeleport: () => void;
|
||||
};
|
||||
43
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.mjs
generated
vendored
Normal file
43
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ref, onUnmounted, h, Teleport } from 'vue';
|
||||
import { createGlobalNode, removeGlobalNode } from '../../utils/vue/global-node.mjs';
|
||||
import { isClient } from '@vueuse/core';
|
||||
import { NOOP } from '@vue/shared';
|
||||
|
||||
const useTeleport = (contentRenderer, appendToBody) => {
|
||||
const isTeleportVisible = ref(false);
|
||||
if (!isClient) {
|
||||
return {
|
||||
isTeleportVisible,
|
||||
showTeleport: NOOP,
|
||||
hideTeleport: NOOP,
|
||||
renderTeleport: NOOP
|
||||
};
|
||||
}
|
||||
let $el = null;
|
||||
const showTeleport = () => {
|
||||
isTeleportVisible.value = true;
|
||||
if ($el !== null)
|
||||
return;
|
||||
$el = createGlobalNode();
|
||||
};
|
||||
const hideTeleport = () => {
|
||||
isTeleportVisible.value = false;
|
||||
if ($el !== null) {
|
||||
removeGlobalNode($el);
|
||||
$el = null;
|
||||
}
|
||||
};
|
||||
const renderTeleport = () => {
|
||||
return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h(Teleport, { to: $el }, contentRenderer())] : void 0;
|
||||
};
|
||||
onUnmounted(hideTeleport);
|
||||
return {
|
||||
isTeleportVisible,
|
||||
showTeleport,
|
||||
hideTeleport,
|
||||
renderTeleport
|
||||
};
|
||||
};
|
||||
|
||||
export { useTeleport };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.mjs.map
generated
vendored
Normal file
1
normal-admin/node_modules/element-plus/es/hooks/use-teleport/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-teleport/index.ts"],"sourcesContent":["import { Teleport, h, onUnmounted, ref } from 'vue'\nimport {\n NOOP,\n createGlobalNode,\n isClient,\n removeGlobalNode,\n} from '@element-plus/utils'\n\nimport type { Ref, VNode } from 'vue'\n\nexport const useTeleport = (\n contentRenderer: () => VNode,\n appendToBody: Ref<boolean>\n) => {\n const isTeleportVisible = ref(false)\n\n if (!isClient) {\n return {\n isTeleportVisible,\n showTeleport: NOOP,\n hideTeleport: NOOP,\n renderTeleport: NOOP,\n }\n }\n\n let $el: HTMLElement | null = null\n\n const showTeleport = () => {\n isTeleportVisible.value = true\n // this allows the delayed showing strategy since the the content itself could be enterable\n // e.g. el-popper\n if ($el !== null) return\n\n $el = createGlobalNode()\n }\n\n const hideTeleport = () => {\n isTeleportVisible.value = false\n if ($el !== null) {\n removeGlobalNode($el)\n $el = null\n }\n }\n\n const renderTeleport = () => {\n return appendToBody.value !== true\n ? contentRenderer()\n : isTeleportVisible.value\n ? [h(Teleport, { to: $el }, contentRenderer())]\n : undefined\n }\n\n onUnmounted(hideTeleport)\n\n return {\n isTeleportVisible,\n showTeleport,\n hideTeleport,\n renderTeleport,\n }\n}\n"],"names":[],"mappings":";;;;;AAOY,MAAC,WAAW,GAAG,CAAC,eAAe,EAAE,YAAY,KAAK;AAC9D,EAAE,MAAM,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AACvC,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO;AACX,MAAM,iBAAiB;AACvB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,Y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