@vrx-arco/pro-components
Version:
<p align="center"> <img src="https://vrx-arco.github.io/arco-design-pro/favicon.svg" width="200" height="250"> </p>
114 lines (113 loc) • 2.78 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const use = require("@vrx-arco/use");
const webVue = require("@arco-design/web-vue");
const _var = require("../style/var.js");
function _isSlot(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
}
const SpaceDividerItem = /* @__PURE__ */ vue.defineComponent({
name: "vrx-arco-space-divider-item",
props: {
direction: {
type: String,
default: "horizontal"
},
size: Number,
gap: [Number, String],
type: String,
divider: {
type: Boolean,
default: true
}
},
setup: (props, {
slots
}) => {
const {
empty
} = use.useEmptyComponentProvide();
return () => {
var _a;
if (empty.value) {
return;
}
return vue.createVNode(vue.Fragment, null, [props.divider && vue.createVNode(webVue.Divider, {
"direction": props.direction === "horizontal" ? "vertical" : "horizontal",
"size": props.size,
"margin": props.gap,
"type": props.type
}, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
};
}
});
const SpaceDivider = /* @__PURE__ */ vue.defineComponent({
name: "vrx-arco-space-divider",
props: {
/**
* 布局方向
*/
direction: {
type: String,
default: "horizontal"
},
/**
* 对齐方向
*/
align: {
type: String,
default: "center"
},
/**
* 是否占满
*/
fill: {
type: Boolean,
default: false
},
wrap: {
type: Boolean,
default: false
},
/**
* 分割线宽度
*/
size: Number,
/**
* 分割线间距
*/
gap: [Number, String],
type: String
},
setup: (props, {
slots
}) => {
const {
bemClass
} = _var.style("space-divider");
const classname = vue.computed(() => ({
[bemClass(props.fill ? "-fill" : void 0)]: true,
[bemClass(`-align-${props.align}`)]: true,
[bemClass("-wrap")]: props.wrap,
[bemClass(`-${props.direction}`)]: true
}));
return () => {
var _a;
const children = use.filterEmptyChildren((_a = slots.default) == null ? void 0 : _a.call(slots));
return vue.createVNode("div", {
"class": classname.value
}, [children.map((item, index) => vue.createVNode(SpaceDividerItem, {
"direction": props.direction,
"size": props.size,
"gap": props.gap,
"type": props.type,
"divider": index > 0,
"key": index
}, _isSlot(item) ? item : {
default: () => [item]
}))]);
};
}
});
exports.SpaceDivider = SpaceDivider;