50 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from 'vue';
 | 
						|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
 | 
						|
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
 | 
						|
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
 | 
						|
 | 
						|
const __default__ = defineComponent({
 | 
						|
  name: "ElContainer"
 | 
						|
});
 | 
						|
const _sfc_main = /* @__PURE__ */ defineComponent({
 | 
						|
  ...__default__,
 | 
						|
  props: buildProps({
 | 
						|
    direction: {
 | 
						|
      type: String,
 | 
						|
      values: ["horizontal", "vertical"]
 | 
						|
    }
 | 
						|
  }),
 | 
						|
  setup(__props) {
 | 
						|
    const props = __props;
 | 
						|
    const slots = useSlots();
 | 
						|
    const ns = useNamespace("container");
 | 
						|
    const isVertical = computed(() => {
 | 
						|
      if (props.direction === "vertical") {
 | 
						|
        return true;
 | 
						|
      } else if (props.direction === "horizontal") {
 | 
						|
        return false;
 | 
						|
      }
 | 
						|
      if (slots && slots.default) {
 | 
						|
        const vNodes = slots.default();
 | 
						|
        return vNodes.some((vNode) => {
 | 
						|
          const tag = vNode.type.name;
 | 
						|
          return tag === "ElHeader" || tag === "ElFooter";
 | 
						|
        });
 | 
						|
      } else {
 | 
						|
        return false;
 | 
						|
      }
 | 
						|
    });
 | 
						|
    return (_ctx, _cache) => {
 | 
						|
      return openBlock(), createElementBlock("section", {
 | 
						|
        class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
 | 
						|
      }, [
 | 
						|
        renderSlot(_ctx.$slots, "default")
 | 
						|
      ], 2);
 | 
						|
    };
 | 
						|
  }
 | 
						|
});
 | 
						|
var Container = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "container.vue"]]);
 | 
						|
 | 
						|
export { Container as default };
 | 
						|
//# sourceMappingURL=container.mjs.map
 |