UNPKG

@vuesax-alpha/nightly

Version:
148 lines (145 loc) 5.84 kB
import { defineComponent, computed, openBlock, createBlock, Teleport, unref, createVNode, Transition, withCtx, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createCommentVNode, renderSlot } from 'vue'; import { IconLoading, IconClose } from '../../icon/index.mjs'; import '../../../hooks/index.mjs'; import { dialogProps, dialogEmits } from './dialog.mjs'; import './composables/index.mjs'; import { dialogDeprecated } from './deprecated.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; import { usePopperContainer, usePopperContainerId } from '../../../hooks/use-popper-container/index.mjs'; import { useNamespace } from '../../../hooks/use-namespace/index.mjs'; import { useDialog } from './composables/use-dialog.mjs'; import { useModal } from '../../../hooks/use-modal/index.mjs'; import { useSameTarget } from '../../../hooks/use-same-target/index.mjs'; const __default__ = defineComponent({ name: "VsDialog" }); const _sfc_main = defineComponent({ ...__default__, props: dialogProps, emits: dialogEmits, setup(__props, { expose: __expose, emit }) { const props = __props; usePopperContainer(); const { selector } = usePopperContainerId(); const ns = useNamespace("dialog"); dialogDeprecated(props); const { visible, zIndex, dialogKls, dialogStyles, close, afterEnter, afterLeave, beforeLeave, handleClose } = useDialog(props, emit); useModal({ handleClose }, visible); const clickDialog = useSameTarget(handleClose); const rootKls = computed(() => [ ns.b(), ns.is("full-screen", props.fullScreen), ns.is("blur", props.overlayBlur) ]); __expose({ visible, close }); return (_ctx, _cache) => { return openBlock(), createBlock(Teleport, { to: unref(selector) }, [ createVNode(Transition, { name: unref(ns).b(), onAfterEnter: unref(afterEnter), onAfterLeave: unref(afterLeave), onBeforeLeave: unref(beforeLeave) }, { default: withCtx(() => [ unref(visible) ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(rootKls.value), style: normalizeStyle({ zIndex: unref(zIndex) }), onClick: _cache[1] || (_cache[1] = (...args) => unref(clickDialog).onClick && unref(clickDialog).onClick(...args)), onMousedown: _cache[2] || (_cache[2] = (...args) => unref(clickDialog).onMousedown && unref(clickDialog).onMousedown(...args)), onMouseup: _cache[3] || (_cache[3] = (...args) => unref(clickDialog).onMouseup && unref(clickDialog).onMouseup(...args)) }, [ createElementVNode( "div", { style: normalizeStyle(unref(dialogStyles)), class: normalizeClass(unref(dialogKls)) }, [ _ctx.loading ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(unref(ns).e("loading")) }, [ createVNode(unref(IconLoading)) ], 2 )) : createCommentVNode("v-if", true), !_ctx.notClose ? (openBlock(), createElementBlock( "button", { key: 1, class: normalizeClass(unref(ns).e("close")), onClick: _cache[0] || (_cache[0] = (...args) => unref(close) && unref(close)(...args)) }, [ createVNode(unref(IconClose), { hover: "x" }) ], 2 )) : createCommentVNode("v-if", true), _ctx.$slots.header ? (openBlock(), createElementBlock( "div", { key: 2, class: normalizeClass(unref(ns).e("header")) }, [ renderSlot(_ctx.$slots, "header") ], 2 )) : createCommentVNode("v-if", true), createElementVNode( "div", { class: normalizeClass([unref(ns).e("content"), { notFooter: !_ctx.$slots.footer }]) }, [ renderSlot(_ctx.$slots, "default") ], 2 ), _ctx.$slots.footer ? (openBlock(), createElementBlock( "div", { key: 3, class: normalizeClass(unref(ns).e("footer")) }, [ renderSlot(_ctx.$slots, "footer") ], 2 )) : createCommentVNode("v-if", true) ], 6 ) ], 38 )) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"]) ], 8, ["to"]); }; } }); var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/dialog/src/dialog.vue"]]); export { Dialog as default }; //# sourceMappingURL=dialog2.mjs.map