Skip to content

Commit

Permalink
feat(filter): 代码规范
Browse files Browse the repository at this point in the history
  • Loading branch information
xiamiao committed Jun 26, 2024
1 parent 4cda67d commit 8a9e9ae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/ui/filter/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { HiBaseFieldNameKeys, HiBaseFieldNames } from "@hi-ui/core"
import { FilterDataItem } from "./types"
import { HiBaseFieldNameKeys, HiBaseFieldNames } from '@hi-ui/core'
import { FilterDataItem } from './types'
import React from 'react'

export const transformTreeData = (
data: FilterDataItem[],
Expand All @@ -15,14 +16,15 @@ export const transformTreeData = (
const traverseNode = (node: FilterDataItem): FilterDataItem => {
const newNode: FilterDataItem = { ...node }

newNode.id = getKeyFields(newNode, "id") as React.ReactText
newNode.title = getKeyFields(newNode, "title") as React.ReactText
newNode.disabled = (getKeyFields(newNode, "disabled") ?? false) as boolean
newNode.children = getKeyFields(newNode, "children") as FilterDataItem[]
newNode.id = getKeyFields(newNode, 'id') as React.ReactText
newNode.title = getKeyFields(newNode, 'title') as React.ReactText
newNode.disabled = (getKeyFields(newNode, 'disabled') ?? false) as boolean
newNode.children = getKeyFields(newNode, 'children') as FilterDataItem[]

if (newNode.children) {
newNode.children = newNode.children.map(traverseNode)
}

return newNode
}

Expand Down

0 comments on commit 8a9e9ae

Please sign in to comment.