Skip to content

Commit

Permalink
refactor: fieldNames replace with hook (#6268)
Browse files Browse the repository at this point in the history
  • Loading branch information
1587315093 authored Jul 28, 2023
1 parent 4005ea4 commit e8f6c15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/tree-select/multiple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Checkbox from '../checkbox'
import { TreeSelectOption } from '.'
import { usePropsValue } from '../../utils/use-props-value'
import { devWarning } from '../../utils/dev-log'
import { useFieldNames } from '../../hooks'
import type { FieldNamesType } from '../../hooks'

const classPrefix = `adm-tree-select-multiple`

Expand All @@ -19,7 +21,7 @@ export type MultipleProps = {
onChange?: (value: string[], nodes: TreeSelectOption[]) => void

selectAllText?: string[]
fieldNames?: { label: string; value: string; children: string }
fieldNames?: FieldNamesType

expandKeys?: string[]
defaultExpandKeys?: string[]
Expand All @@ -40,9 +42,7 @@ export const Multiple: FC<MultipleProps> = p => {
useEffect(() => {
devWarning('TreeSelect', 'TreeSelect.Multiple has been deprecated.')
}, [])
const labelName = props.fieldNames.label || 'label'
const valueName = props.fieldNames.value || 'value'
const childrenName = props.fieldNames.children || 'children'
const [labelName, valueName, childrenName] = useFieldNames(props.fieldNames)

// 打开的 keys
const [expandKeys, setExpandKeys] = usePropsValue({
Expand Down

0 comments on commit e8f6c15

Please sign in to comment.