
import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';
import snippets from './snippets';
import { uuid } from '../_utils/utils';

const ButtonGroupMeta: IPublicTypeComponentMetadata = {
  "componentName": "ButtonGroup",
  "title": "ButtonGroup",
  category: "通用",
  "docUrl": "",
  "screenshot": "",
  "devMode": "proCode",
  "npm": {
    package: "@pisell/materials",
    "version": "0.1.0",
    "exportName": "ButtonGroup",
    "main": "src/index.tsx",
    "destructuring": true,
    "subName": ""
  },
  "configure": {
    "props": [
      {
        name: "options",
        title: { label: "按钮列表", tip: "按钮列表" },
        setter: {
          componentName: "ArraySetter",
          props: {
            itemSetter: {
              componentName: "ObjectSetter",
              props: {
                config: {
                  items: [
                    {
                      name: "buttonText",
                      title: "按钮名称",
                      isRequired:true,
                      setter: "StringSetter",
                    },
                    {
                      name: "buttonType",
                      title: "按钮类型",
                      isRequired:true,
                      propType: {
                        type: "oneOf",
                        value: ["primary", "default", "ghost", "dashed", "danger", "link", "text"],
                      },
                      setter: [
                        {
                          componentName: "SelectSetter",
                          props: {
                            options: [
                              {
                                title: "primary",
                                value: "primary",
                              },
                              {
                                title: "default",
                                value: "default",
                              },
                              {
                                title: "dashed",
                                value: "dashed",
                              },
                              {
                                title: "danger",
                                value: "danger",
                              },
                              {
                                title: "link",
                                value: "link",
                              },
                              {
                                title: "text",
                                value: "text",
                              },
                            ],
                          },
                        },
                        "VariableSetter",
                      ],
                    },
                    {
                      name: "onClick",
                      title: { label: "点击事件", tip: "点击事件" },
                      propType: "func",
                      isRequired:true,
                      setter: "FunctionSetter",
                    },
                  ],
                },
              },
              initialValue: () => {
                return {
                  buttonText: "按钮名称",
                  buttonType: "default",
                  onClick: () => {},
                };
              },
            },
          },
        },
      },
      {
        name: 'isShowMore',
        title: {
          label: {
            type: "i18n",
            "en-US": "Right icon",
            "zh-CN": "菜单按钮",
          },
          tip: "icon | Set the icon component of the button",
        },
        propType: { type: "oneOfType", value: ["node"] },
        setter: [{
          componentName: "SlotSetter",
          initialValue: {
            type: "JSSlot",
            value: [
              {
                componentName: "Dropdown",
                props: {
                  items: [{
                    label: '菜单名称',
                    key: uuid(),
                  }
                  ]
                },
              },
            ],
          },
          defaultValue: null
        }],

        // defaultValue: false,
        // supportVariable: true,
      }, {
        name: 'moreMenus',
        "title": { label: '下拉按钮', tip: '下拉按钮配置项' },
        "setter": {
          "componentName": "ArraySetter",
          "props": {
            "itemSetter": {
              "componentName": "ObjectSetter",
              "props": {
                "config": {
                  "items": [{
                    "name": "key",
                    title: { label: '菜单ID', tip: '菜单唯一标识' },
                    isRequired: true,
                    "setter": "StringSetter"
                  }, {
                    "name": "label",
                    title: { label: '菜单名称', tip: '菜单名称' },
                    isRequired: true,
                    "setter": "StringSetter"
                  },
                  {
                    "name": "callback",
                    title: { label: '回调函数', tip: '点击按钮绑定回调函数' },
                    isRequired: true,
                    "description": "callback",
                    "setter": {
                      "componentName": "FunctionSetter"
                    }
                  }
                  ]
                }
              },
              "initialValue": {
                "label": "按钮名称",
                "key": uuid(),
                "callback": null
              }
            }
          }
        }

      },],
    "supports": {
      "style": true
    },
    "component": {}
  }
};









export default {
  ...ButtonGroupMeta,
  snippets
};
