From 44656b4f6f04d5858bc05974c77aa8294cceebf0 Mon Sep 17 00:00:00 2001 From: Rain <958414905@qq.com> Date: Fri, 20 Oct 2023 09:48:40 +0800 Subject: [PATCH] chore: add collectionName --- .../schema-settings/hooks/useGetAriaLabelOfDesigner.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts b/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts index 43f5ce1a32..00e8ad3eeb 100644 --- a/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts +++ b/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts @@ -1,23 +1,26 @@ import { useFieldSchema } from '@formily/react'; import { useCallback } from 'react'; +import { useCollection } from '../../collection-manager'; /** - * label = 'designer' + name + x-component + [x-designer] + [x-collection-field] + [postfix] + * label = 'designer' + name + x-component + [x-designer] + [collectionName] + [x-collection-field] + [postfix] * @returns */ export const useGetAriaLabelOfDesigner = () => { const fieldSchema = useFieldSchema(); + let { name: collectionName } = useCollection(); const component = fieldSchema['x-component']; const designer = fieldSchema['x-designer'] ? `-${fieldSchema['x-designer']}` : ''; const collectionField = fieldSchema['x-collection-field'] ? `-${fieldSchema['x-collection-field']}` : ''; + collectionName = collectionName ? `-${collectionName}` : ''; const getAriaLabel = useCallback( (name: string, postfix?: string) => { postfix = postfix ? `-${postfix}` : ''; - return `designer-${name}-${component}${designer}${collectionField}${postfix}`; + return `designer-${name}-${component}${designer}${collectionName}${collectionField}${postfix}`; }, - [collectionField, component, designer], + [collectionField, collectionName, component, designer], ); return { getAriaLabel };