mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:55:33 +00:00
feat: improve locators
This commit is contained in:
parent
3001f02c0c
commit
df657baf71
@ -38,14 +38,14 @@ interface IconProps {
|
||||
export const Icon = (props: IconProps) => {
|
||||
const { type = '', component, ...restProps } = props;
|
||||
if (component) {
|
||||
return <AntdIcon component={component} {...restProps} />;
|
||||
return <AntdIcon role="button" component={component} {...restProps} />;
|
||||
}
|
||||
if (type && icons.has(type.toLowerCase())) {
|
||||
const IconComponent = icons.get(type.toLowerCase());
|
||||
return <IconComponent {...restProps} />;
|
||||
return <IconComponent role="button" {...restProps} />;
|
||||
}
|
||||
if (type && IconFont) {
|
||||
return <IconFont type={type} />;
|
||||
return <IconFont role="button" type={type} />;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ export const BlockItem: React.FC<any> = (props) => {
|
||||
return (
|
||||
<SortableItem
|
||||
data-testid={getTestId({ schema, blockName: props.name || name })}
|
||||
role="button"
|
||||
className={cls(
|
||||
'nb-block-item',
|
||||
className,
|
||||
|
@ -492,7 +492,12 @@ Menu.Item = observer(
|
||||
label: (
|
||||
<SchemaContext.Provider value={schema}>
|
||||
<FieldContext.Provider value={field}>
|
||||
<SortableItem className={designerCss} removeParentsIfNoChildren={false}>
|
||||
<SortableItem
|
||||
role="button"
|
||||
aria-label={t(field.title)}
|
||||
className={designerCss}
|
||||
removeParentsIfNoChildren={false}
|
||||
>
|
||||
<Icon type={icon} />
|
||||
<span
|
||||
style={{
|
||||
|
@ -11,6 +11,7 @@ export const MenuItemInitializers = (props: any) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
role="button"
|
||||
insertPosition={'beforeEnd'}
|
||||
icon={'PlusOutlined'}
|
||||
insert={props.insert}
|
||||
|
@ -41,7 +41,7 @@ export const TableColumnDecorator = (props) => {
|
||||
}
|
||||
}, [uiSchema?.title]);
|
||||
return (
|
||||
<SortableItem className={designerCss}>
|
||||
<SortableItem role="button" className={designerCss}>
|
||||
<Designer fieldSchema={fieldSchema} uiSchema={uiSchema} collectionField={collectionField} />
|
||||
{/* <RecursionField name={columnSchema.name} schema={columnSchema}/> */}
|
||||
{field?.title || compile(uiSchema?.title)}
|
||||
|
@ -280,6 +280,7 @@ export const Table: any = observer(
|
||||
return (
|
||||
<th
|
||||
{...props}
|
||||
role="button"
|
||||
className={cls(
|
||||
props.className,
|
||||
css`
|
||||
|
@ -38,6 +38,7 @@ export const Sortable = (props: any) => {
|
||||
return React.createElement(
|
||||
component || 'div',
|
||||
{
|
||||
role: 'none',
|
||||
...others,
|
||||
className: cx('nb-sortable-designer', props.className),
|
||||
ref: setNodeRef,
|
||||
|
@ -88,7 +88,12 @@ export const GeneralSchemaDesigner = (props: any) => {
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
<div className={'general-schema-designer-icons'}>
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
className={'general-schema-designer-icons'}
|
||||
>
|
||||
<Space size={2} align={'center'}>
|
||||
{draggable && (
|
||||
<DragHandler>
|
||||
|
@ -133,7 +133,7 @@ export const useEditProfile = () => {
|
||||
ctx?.setVisible(false);
|
||||
},
|
||||
label: (
|
||||
<>
|
||||
<div aria-label="edit-profile">
|
||||
{t('Edit profile')}
|
||||
<ActionContextProvider value={{ visible, setVisible }}>
|
||||
<div onClick={(e) => e.stopPropagation()}>
|
||||
@ -143,7 +143,7 @@ export const useEditProfile = () => {
|
||||
/>
|
||||
</div>
|
||||
</ActionContextProvider>
|
||||
</>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
}, [visible]);
|
||||
|
@ -19,6 +19,7 @@ export const useLanguageSettings = () => {
|
||||
},
|
||||
label: (
|
||||
<div
|
||||
aria-label="language-settings"
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
|
@ -14,6 +14,7 @@ export const useSwitchRole = () => {
|
||||
eventKey: 'SwitchRole',
|
||||
label: (
|
||||
<div
|
||||
aria-label="switch-role"
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
|
Loading…
Reference in New Issue
Block a user