@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
48 lines (47 loc) • 1.3 kB
JavaScript
import "../chunk-G2ADBYYC.js";
const computedRootStyle = ({ state, props }) => () => {
return {
height: props.height || state.height,
margin: props.margin || state.margin,
fontSize: props.fontSize
};
};
const computedLineStyle = ({ props }) => () => {
const lineStyle = {
borderTopStyle: props.borderStyle
};
if (props.color) {
Object.assign(lineStyle, { borderTopColor: props.color });
}
return lineStyle;
};
const computedTextStyle = ({ props }) => () => {
const textStyle = {
left: "unset",
right: "unset"
};
const defaultOffset = "5%";
if (props.contentPosition === "left") {
textStyle.left = props.offset || defaultOffset;
} else if (props.contentPosition === "right") {
textStyle.right = props.offset || defaultOffset;
}
return textStyle;
};
const setDividerHeight = ({ state, props, vm, nextTick }) => () => {
const verticalHeight = "12px";
if (props.direction === "vertical") {
state.height = props.height || verticalHeight;
} else {
nextTick(() => {
const offsetHeight = vm.$refs.text && vm.$refs.text.offsetHeight;
state.height = props.height || offsetHeight ? offsetHeight + "px" : "auto";
});
}
};
export {
computedLineStyle,
computedRootStyle,
computedTextStyle,
setDividerHeight
};