import { array, actions, actionGroup, filter } from './common';
var initialValues = {
  columns: [{
    dataIndex: 'instanceName',
    title: '实例ID/实例名称'
  }, {
    dataIndex: 'organizationName',
    title: '组织',
    tooltip: '我这一列是可以被复制的～',
    render: {
      copy: true
    }
  }],
  url: 'https://oneapi.alibaba-inc.com/mock/teamix-pro/api/getTableResource',
  formatResult: {
    data: 'data',
    total: 'pageInfo.total'
  },
  mainAction: {
    actions: [{
      key: 'action',
      children: '操作按钮'
    }]
  }
};
var defaultValues = {
  showSkeleton: true,
  skeletonSize: 5,
  showPagination: true,
  pageSize: 10,
  method: 'get',
  pageKey: 'currentPage',
  pageSizeKey: 'pageSize',
  pageSizeList: [5, 10, 20],
  requestWhenMount: true,
  paginationProps: {},
  formatResult: {},
  params: {}
};
var schema = [{
  component: 'FormTab',
  children: [{
    title: '基础配置',
    children: [{
      component: 'FormCollapse',
      children: [{
        title: '数据请求',
        children: [{
          name: 'url',
          title: '请求地址',
          component: 'Input',
          default: '/data/api.json'
        }, {
          name: 'method',
          title: '请求方式',
          component: 'Radio',
          dataSource: [{
            label: 'get',
            value: 'get'
          }, {
            label: 'post',
            value: 'post'
          }],
          default: 'get'
        }, {
          name: 'params',
          title: '请求参数',
          component: 'JsonInput'
        }]
      }, array('列配置', 'columns', [{
        name: 'dataIndex',
        title: '数据索引',
        component: 'Input'
      }, {
        name: 'title',
        title: '标题',
        component: 'Input'
      }, {
        name: 'tooltip',
        title: '标题帮助',
        component: 'Input'
      }, {
        name: 'tooltipIcon',
        title: '标题帮助图标',
        component: 'IconPicker',
        props: {
          width: '100%'
        }
      }, {
        name: 'valueType',
        title: '数据类型',
        component: 'Input'
      }, {
        name: 'dataSource',
        title: 'value映射',
        component: 'JsonInput'
      }, {
        name: 'render',
        title: '渲染器配置',
        component: 'JsonInput'
      }, {
        name: 'actionSchema',
        type: 'object',
        children: [actions({
          arrayTitle: '操作项配置'
        })]
      }], 'title'), {
        title: '分页',
        children: [{
          name: 'showPagination',
          title: '是否有分页',
          component: 'Switch',
          default: true
        }, {
          name: 'pageSize',
          title: '分页大小',
          component: 'NumberPicker',
          default: 10
        }, {
          name: 'pageKey',
          title: '分页参数名',
          component: 'Input',
          default: 'currentPage'
        }, {
          name: 'pageSizeKey',
          title: '分页大小参数名',
          component: 'Input',
          default: 'pageSize'
        }, {
          name: 'paginationProps',
          title: '分页器属性',
          component: 'JsonInput'
        }, {
          name: 'pageSizeList',
          title: '分页大小列表',
          component: 'ArrayItems',
          items: {
            component: 'FormFlex',
            children: [{
              component: 'ArrayItems.SortHandle'
            }, {
              component: 'NumberPicker',
              decoratorProps: {
                feedbackLayout: 'none'
              }
            }, {
              component: 'ArrayItems.Remove'
            }]
          },
          children: [{
            title: '添加一条'
          }],
          default: [5, 10, 20]
        }]
      }, {
        title: '请求格式化',
        children: [{
          name: 'formatResult',
          type: 'object',
          children: [{
            name: 'data',
            title: '数据源',
            component: 'Input'
          }, {
            name: 'total',
            title: '总数',
            component: 'Input'
          }]
        }]
      }, {
        title: '骨架屏',
        children: [{
          name: 'showSkeleton',
          title: '骨架屏',
          component: 'Switch',
          default: true
        }, {
          name: 'skeletonSize',
          title: '骨架屏条数',
          component: 'NumberPicker',
          default: 5
        }]
      }, {
        title: '其他',
        children: [{
          name: 'requestWhenMount',
          title: '是否第一次加载时就发起请求',
          component: 'Switch',
          default: true
        }]
      }]
    }]
  }, {
    title: '标题区',
    name: 'header',
    type: 'object',
    children: [{
      component: 'FormCollapse',
      children: [{
        title: '标题',
        children: [{
          name: 'title',
          title: '标题',
          component: 'Input'
        }, {
          name: 'description',
          title: '描述',
          component: 'Input'
        }]
      }, {
        title: '帮助',
        children: [{
          name: 'tooltip',
          title: '帮助文案',
          component: 'Input'
        }, {
          name: 'icon',
          title: '帮助图标',
          component: 'IconPicker',
          props: {
            width: '100%'
          }
        }, {
          name: 'iconSize',
          title: '帮助图标大小',
          component: 'Select',
          dataSource: [{
            label: '极小',
            value: 'xxs'
          }, {
            label: '超小',
            value: 'xs'
          }, {
            label: '小',
            value: 'small'
          }, {
            label: '中',
            value: 'medium'
          }, {
            label: '大',
            value: 'large'
          }, {
            label: '超大',
            value: 'xl'
          }, {
            label: '极大',
            value: 'xxl'
          }, {
            label: '最大',
            value: 'xxxl'
          }]
        }]
      }]
    }]
  }, actionGroup('操作区', 'mainAction'), {
    title: '筛选区',
    children: [{
      component: 'FormCollapse',
      children: [{
        title: '常规筛选区',
        children: [filter('regularFilter')]
      }, {
        title: '高级筛选区',
        children: [filter('advancedFilter')]
      }]
    }]
  }, {
    title: '设置区',
    children: [{
      component: 'FormCollapse',
      children: [{
        title: '设置区',
        children: [{
          name: 'toolBar',
          title: '是否有工具栏',
          component: 'Switch',
          default: true
        }]
      }]
    }]
  }]
}];
var configurator = {
  schema: schema,
  initialValues: initialValues,
  defaultValues: defaultValues
};
export default configurator;