epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
63 lines (62 loc) • 2.03 kB
JavaScript
import { defineComponent as v, h as y, TransitionGroup as c, Transition as g } from "vue";
const l = v({
name: "FadeInExpandTransition",
props: {
appear: Boolean,
group: Boolean,
mode: String,
onLeave: Function,
onAfterLeave: Function,
onAfterEnter: Function,
width: Boolean,
// reverse mode is only used in tree
// it make it from expanded to collapsed after mounted
reverse: Boolean
},
setup(i, { slots: o }) {
function a(t) {
i.width ? t.style.maxWidth = `${t.offsetWidth}px` : t.style.maxHeight = `${t.offsetHeight}px`, t.offsetWidth;
}
function f(t) {
i.width ? t.style.maxWidth = "0" : t.style.maxHeight = "0", t.offsetWidth;
const { onLeave: e } = i;
e && e();
}
function d(t) {
i.width ? t.style.maxWidth = "" : t.style.maxHeight = "";
const { onAfterLeave: e } = i;
e && e();
}
function s(t) {
if (t.style.transition = "none", i.width) {
const e = t.offsetWidth;
t.style.maxWidth = "0", t.offsetWidth, t.style.transition = "", t.style.maxWidth = `${e}px`;
} else if (i.reverse)
t.style.maxHeight = `${t.offsetHeight}px`, t.offsetHeight, t.style.transition = "", t.style.maxHeight = "0";
else {
const e = t.offsetHeight;
t.style.maxHeight = "0", t.offsetWidth, t.style.transition = "", t.style.maxHeight = `${e}px`;
}
t.offsetWidth;
}
function h(t) {
var e;
i.width ? t.style.maxWidth = "" : i.reverse || (t.style.maxHeight = ""), (e = i.onAfterEnter) === null || e === void 0 || e.call(i);
}
return () => {
const { group: t, width: e, appear: r, mode: m } = i, x = t ? c : g, n = {
name: e ? "fade-in-width-expand-transition" : "fade-in-height-expand-transition",
appear: r,
onEnter: s,
onAfterEnter: h,
onBeforeLeave: a,
onLeave: f,
onAfterLeave: d
};
return t || (n.mode = m), y(x, n, o);
};
}
});
export {
l as N
};