Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fieldNames replace with hook #6268

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading