import { PropType } from 'vue';
import { PropTypes } from '/nerv-lib/util/type';
import { AxiosRequestConfig } from 'axios';
import { treeProps as TreeProps } from 'ant-design-vue/es/tree/Tree';
import { formProps } from '/nerv-lib/component/form/form/props';
export const treeFormProps = {
  formLayout: 'vertical',
  labelCol: { span: 0 },
  wrapperCol: { span: 24 },
};
export const treeProps = {
  ...TreeProps(),
  api: {
    type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
    default: undefined,
  },
  treeData: PropTypes.array.def([]),
  params: PropTypes.object.def(() => ({})),
  showLine: PropTypes.object.def(() => ({ showLeafIcon: false })),
  dynamicParams: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.array,
    PropTypes.object,
    PropTypes.func,
  ]),
  requiredParams: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.array,
    PropTypes.object,
    PropTypes.bool,
  ]),

  formConfig: PropTypes.object, //查询表单
  defaultParams: PropTypes.object, //查询表单
  value: PropTypes.array.def(() => []),
  refreshTime: PropTypes.number.def(0),
  enableTableSession: PropTypes.bool.def(false),
  expand: PropTypes.bool.def(true),
  showExpand: PropTypes.bool.def(true),
  blockNode: PropTypes.bool.def(true),
  defaultExpandAll: PropTypes.bool.def(true),
  resultField: PropTypes.string.def('data'),
  header: PropTypes.object,
  isSticky: PropTypes.bool.def(true),
  transform: {
    type: Function,
    default: (data: any) => data,
  },
  cancelable: PropTypes.bool.def(false), // 选中树节点是否可以取消
};