From 8a9e9aeb2a72fee020997d35dd0fea530cda254f Mon Sep 17 00:00:00 2001 From: xiamiao Date: Wed, 26 Jun 2024 15:16:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(filter):=20=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/filter/src/utils.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/ui/filter/src/utils.ts b/packages/ui/filter/src/utils.ts index 9b0f50947..e010b1fc3 100644 --- a/packages/ui/filter/src/utils.ts +++ b/packages/ui/filter/src/utils.ts @@ -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[], @@ -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 }