UNPKG

tav-ui

Version:
1 lines 2.25 kB
{"version":3,"file":"useModalFullScreen2.mjs","sources":["../../../../../../../../packages/components/modal/src/hooks/useModalFullScreen.ts"],"sourcesContent":["import { computed, ref, unref } from 'vue'\nimport type { Ref } from 'vue'\nimport type { ComponentRef } from '../types'\n\nexport interface UseFullScreenContext {\n wrapClassName: Ref<string | undefined>\n modalWrapperRef: Ref<ComponentRef>\n extHeightRef: Ref<number>\n}\n\nexport function useFullScreen(context: UseFullScreenContext) {\n // const formerHeightRef = ref(0);\n const fullScreenRef = ref(false)\n\n const getWrapClassName = computed(() => {\n const clsName = unref(context.wrapClassName) || ''\n return unref(fullScreenRef) ? `fullscreen-modal ${clsName} ` : unref(clsName)\n })\n\n function handleFullScreen(e: Event) {\n e && e.stopPropagation()\n fullScreenRef.value = !unref(fullScreenRef)\n\n // const modalWrapper = unref(context.modalWrapperRef);\n\n // if (!modalWrapper) return;\n\n // const wrapperEl = modalWrapper.$el as HTMLElement;\n // if (!wrapperEl) return;\n // const modalWrapSpinEl = wrapperEl.querySelector('.ant-spin-nested-loading') as HTMLElement;\n\n // if (!modalWrapSpinEl) return;\n\n // if (!unref(formerHeightRef) && unref(fullScreenRef)) {\n // formerHeightRef.value = modalWrapSpinEl.offsetHeight;\n // }\n\n // if (unref(fullScreenRef)) {\n // modalWrapSpinEl.style.height = `${window.innerHeight - unref(context.extHeightRef)}px`;\n // } else {\n // modalWrapSpinEl.style.height = `${unref(formerHeightRef)}px`;\n // }\n }\n return { getWrapClassName, handleFullScreen, fullScreenRef }\n}\n"],"names":[],"mappings":";;AACO,SAAS,aAAa,CAAC,OAAO,EAAE;AACvC,EAAE,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AACnC,EAAE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM;AAC1C,IAAI,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;AACvD,IAAI,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAClF,GAAG,CAAC,CAAC;AACL,EAAE,SAAS,gBAAgB,CAAC,CAAC,EAAE;AAC/B,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AAC7B,IAAI,aAAa,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;AAChD,GAAG;AACH,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AAC/D;;;;"}