import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'

const SearchBarMeta: IPublicTypeComponentMetadata = {
  group: '低代码组件',
  componentName: 'SearchBar',
  title: '搜索栏',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  category: '信息输入',
  npm: {
    package: '@dckj-npm/dc-material',
    version: '0.1.0',
    exportName: 'SearchBar',
    main: 'src\\index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    supports: {
      style: true,
      events: [
        {
          name: 'onClick',
          // template: "onSearch(params,${extParams}){\n window.location.href=`http://localhost:4500/preview.html?pathId=${params.pathId}`;\n console.log(params.pathId) \n}"
        },
        {
          name: 'onConfirm',
          // template: "onSearch(params,${extParams}){\n window.location.href=`http://localhost:4500/preview.html?pathId=${params.pathId}`;\n console.log(params.pathId) \n}"
        },
      ],
    },
    props: [
      {
        name: 'defaultValue',
        title: '绑定跳转',
        setter: 'StringSetter',
        description: '搜索框绑定跳转',
        defaultValue: '请输入',
      },
      {
        name: 'searchText',
        title: '搜索按钮文字',
        setter: 'StringSetter',
        description: '搜索按钮文字',
        defaultValue: '搜索',
      },
      {
        name: 'placeholder',
        title: '占位文本',
        setter: 'StringSetter',
        description: '占位文本',
        defaultValue: '请输入',
      },
      {
        name: 'autofocus',
        title: '自动聚焦',
        setter: 'BoolSetter',
        description: '自动聚焦',
        defaultValue: false,
      },
      {
        name: 'searchValue',
        title: '搜索值',
        setter: 'StringSetter',
        description: '搜索值',
        defaultValue: '',
      },
      {
        name: 'iconSrc',
        title: '搜索图标',
        setter: 'StringSetter',
        description: '搜索图标',
        defaultValue: '',
      },
    ],
    component: {
      disableBehaviors: ['copy'],
    },
  },
}
const snippets: IPublicTypeSnippet[] = [
  {
    title: '搜索栏',
    screenshot: '',
    schema: {
      componentName: 'SearchBar',
      props: {},
      children: [
        {
          componentName: 'Image',
          props: {
            imgSrc:
              'https://img.alicdn.com/imgextra/i1/O1CN011UyX4n1J6zZksYXZS_!!6000000007158-55-tps-100-100.svg',
            key: 'img-right',
          },
        },
      ],
    },
  },
]

export default {
  ...SearchBarMeta,
  snippets,
}
