import { createVNode as _createVNode } from "vue";
import { defineComponent, provide } from "vue";
import { createItem, useMenu } from "./utils";
import { submenuContextKey } from "./Submenu";
export const submenuProps = {
  node: Object,
  label: [String, Object],
  value: [String, Number],
  children: Array,
  icon: Object,
  disabled: Boolean
};
export default defineComponent({
  name: 'x-menu-item-group',
  props: submenuProps,

  setup(props) {
    const {
      paddingLeftRef,
      parentPaddingLeftRef
    } = useMenu(props);
    provide(submenuContextKey, {
      props,
      paddingLeftRef: parentPaddingLeftRef
    });
    return () => {
      const prefixCls = 'x-menu-item-group';

      const childrenNode = _createVNode("div", {
        "class": `${prefixCls}_children`
      }, [props.children.map(createItem)]);

      return _createVNode("div", {
        "class": prefixCls
      }, [_createVNode("div", {
        "class": `${prefixCls}_label`,
        "style": `padding-left:${paddingLeftRef.value}px`
      }, [props.label]), childrenNode]);
    };
  }

});