Skip to content

Commit

Permalink
feat(menu): 修改fieldNames类型
Browse files Browse the repository at this point in the history
  • Loading branch information
xiamiao committed Jun 25, 2024
1 parent 1b46f79 commit 1aba738
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/ui/menu/src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { cx, getPrefixCls } from '@hi-ui/classname'
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@hi-ui/icons'
import { __DEV__ } from '@hi-ui/env'
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state'
import { HiBaseHTMLProps, HiBaseSizeEnum } from '@hi-ui/core'
import { HiBaseFieldNames, HiBaseHTMLProps, HiBaseSizeEnum } from '@hi-ui/core'
import Tooltip from '@hi-ui/tooltip'
import { useUncontrolledToggle } from '@hi-ui/use-toggle'
import { getTreeNodesWithChildren } from '@hi-ui/tree-utils'
Expand Down Expand Up @@ -311,7 +311,7 @@ export interface MenuProps extends Omit<HiBaseHTMLProps<'div'>, 'onClick'> {
/**
* 设置 data 中 id, title, disabled, children 对应的 key
*/
fieldNames?: Record<string, string>
fieldNames?: HiBaseFieldNames
/**
* 默认激活的菜单项 id
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/menu/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { filterTree, cloneTree, getTreeNodesWithChildren } from '@hi-ui/tree-utils'
import { MenuDataItem } from './types'
import { HiBaseFieldNames } from '@hi-ui/core'

// 寻找某一节点的父节点
export const getParentId = (id: string | number, data: Record<string, any>[]): string | number => {
Expand Down Expand Up @@ -58,7 +59,7 @@ export const filterTreeData = (

export const transformTreeData = (
data: MenuDataItem[],
fieldNames: Record<string, string> | undefined
fieldNames?: HiBaseFieldNames,
) => {
/**
* 转换对象
Expand Down

0 comments on commit 1aba738

Please sign in to comment.