# TreeSelectSearch

### config
参数 | 说明 | 类型 | 默认值 | 是否必填 | 版本
---|---|---|---|---|---
options | 数据源 | OptionType[] | 无 | 是 | 3.1.0
optionsType | 根据数据源的可用程度做选择，若为平面结构需要转换，则默认为 flat，若已在外层做好处理可传 tree | 'tree' / 'flat' | flat | options为完整的树结构时可必传 tree | 3.1.0
value | 选中的值 | any[] | 无 | 否 | 3.1.0
disabled | 是否禁止编辑 | boolean | false | 否 | 3.1.0
rootPid | 若 optionsType 为 flat 类型，必传，否则非必传，根级父节点ID | string / number | - | optionsType 为 flat 类型，必传 | 3.1.0
onChange | 数据改变的回调 | (values: any[]) => void | 无 | 否 | 3.1.0
onChangeCheckedStrategy | onChange 触发时定制的回填方式 | 'CHILD'回填最底层节点 / 'PARENT'当父节点的子节点都选中时，回填父节点 / 'ALL'回填所有选中的节点 | 'CHILD' | 否 | 3.1.0

### 类型
```typescript
type PropsKeyValue = {
    propPValue: string,
    propValue: string,
    propName: string,
}
type OptionType = {
    key: string | number,
    title?: string,
    fullName?: (string)[],
    parent?: OptionType,
    children?: OptionType[],
    checked?: boolean,
    halfChecked?: boolean,
    checkable?: boolean,
    selectable?: boolean,
    disabled?: boolean,
    [propName: string]: any,
};
type TreeSelectSearchProps = {
    options: OptionType[], // options 与 options二选一
    optionsType: 'tree' | 'flat', // 数据源的数据格式类型：tree 树状有 children；flat 二维数组，有pid需要拿到后转换成；默认 flat
    value?: any[],
    disabled?: boolean,
    keyValue?: PropsKeyValue,
    onChange?: (values: any[]) => void,
    rootPid?: string | number,
    onChangeCheckedStrategy?: 'CHILD' | 'PARENT' | 'ALL', // 默认 CHILD
    [propName: string]: any,
}
```

### example
```typescript
<TreeSelectSearch
    options={[
        {
            key: 'key1',
            id: 1,
            pid: null,
            title: 'title1',
            children: [
                {
                    id: 2,
                    pid: 1,
                    key: 'key11',
                    title: 'title11',
                }
            ]
        }
    ]}
    optionsType='tree'
    keyValue={{
        propPValue: 'pid',
        propValue: 'key',
        propName: 'title',
    }}
/>
```