cb8da875bc1f8daff5d510cc291316b030471436348c1e0c9cd11d678ff0180e384ac183917d0921920c70a82bbb3ed620aaadc15eff02a9a5c197e0d0f30e 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from 'vue';
  2. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  3. import { buildProps } from '../../../utils/vue/props/runtime.mjs';
  4. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  5. const __default__ = defineComponent({
  6. name: "ElContainer"
  7. });
  8. const _sfc_main = /* @__PURE__ */ defineComponent({
  9. ...__default__,
  10. props: buildProps({
  11. direction: {
  12. type: String,
  13. values: ["horizontal", "vertical"]
  14. }
  15. }),
  16. setup(__props) {
  17. const props = __props;
  18. const slots = useSlots();
  19. const ns = useNamespace("container");
  20. const isVertical = computed(() => {
  21. if (props.direction === "vertical") {
  22. return true;
  23. } else if (props.direction === "horizontal") {
  24. return false;
  25. }
  26. if (slots && slots.default) {
  27. const vNodes = slots.default();
  28. return vNodes.some((vNode) => {
  29. const tag = vNode.type.name;
  30. return tag === "ElHeader" || tag === "ElFooter";
  31. });
  32. } else {
  33. return false;
  34. }
  35. });
  36. return (_ctx, _cache) => {
  37. return openBlock(), createElementBlock("section", {
  38. class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
  39. }, [
  40. renderSlot(_ctx.$slots, "default")
  41. ], 2);
  42. };
  43. }
  44. });
  45. var Container = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "container.vue"]]);
  46. export { Container as default };
  47. //# sourceMappingURL=container.mjs.map