UNPKG

tyh-ui2

Version:

The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.

83 lines (82 loc) 2.52 kB
import { defineComponent as u, computed as k, getCurrentInstance as $, watch as v, openBlock as t, createBlock as g, Transition as z, withCtx as V, withDirectives as B, createElementVNode as a, normalizeClass as d, normalizeStyle as c, withModifiers as p, unref as D, createElementBlock as n, renderSlot as h, toDisplayString as S, createCommentVNode as r, vShow as _ } from "vue"; import { Props as E } from "./index2.js"; const I = ["onClick"], T = { key: 0, class: "tyh-drawer-header" }, b = { key: 0, class: "tyh-drawer-title" }, A = { key: 1, class: "tyh-drawer-title" }, N = ["onClick"], O = { key: 1, class: "tyh-drawer-body" }, H = u({ name: "TyhDrawer" }), P = /* @__PURE__ */ u({ ...H, props: E, emits: [ "update:modelValue", "open", "close", "onOpen", "onClose" ], setup(y, { emit: s }) { const l = y, i = () => { s("close"), s("update:modelValue", !1); }, m = k(() => { const e = l.direction; return e === "left" || e === "right" || e === ""; }), f = () => { !l.modalClose || i(); }, { proxy: w } = $(); return v( () => l.modelValue, (e) => { e && s("open"); const o = w.$el; e && l.appendToBody && document.body.appendChild(o); } ), (e, o) => (t(), g(z, { name: "tyh-drawer", onAfterEnter: o[0] || (o[0] = (C) => s("onOpen")), onAfterLeave: o[1] || (o[1] = (C) => s("onClose")) }, { default: V(() => [ B(a("div", { class: d(["tyh-drawer-packing", { "tyh-drawer-modal": e.modal }]), style: c({ zIndex: e.zIndex }), onClick: p(f, ["self"]) }, [ a("div", { class: d(["tyh-drawer", `tyh-drawer-${e.direction}`]), style: c(D(m) ? `width: ${e.size}` : `height: ${e.size}`) }, [ e.showHeader ? (t(), n("div", T, [ e.$slots.title ? (t(), n("span", b, [ h(e.$slots, "title") ])) : (t(), n("span", A, S(e.title), 1)), e.showClose ? (t(), n("i", { key: 2, class: "tyh-icon tyh-ui-close", onClick: p(i, ["stop"]) }, null, 8, N)) : r("", !0) ])) : r("", !0), e.$slots.default ? (t(), n("div", O, [ h(e.$slots, "default") ])) : r("", !0) ], 6) ], 14, I), [ [_, e.modelValue] ]) ]), _: 3 })); } }); export { P as default };