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