mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:47:20 +00:00
chore: menu & add block
This commit is contained in:
parent
df657baf71
commit
ab3a71a6d4
@ -14,7 +14,7 @@ export const PluginManagerLink = () => {
|
||||
return (
|
||||
<Tooltip title={t('Plugin manager')}>
|
||||
<Button
|
||||
data-testid={'pm-button'}
|
||||
data-testid={'plugin-manager-button'}
|
||||
icon={<ApiOutlined />}
|
||||
title={t('Plugin manager')}
|
||||
onClick={() => {
|
||||
|
@ -197,14 +197,12 @@ const HeaderMenu = ({
|
||||
key: 'x-designer-button',
|
||||
style: { padding: '0 8px', order: 9999 },
|
||||
label: render({
|
||||
'data-testid': 'add-menu-item-button-in-header',
|
||||
'data-testid': 'menu-schema-initializer-header',
|
||||
'aria-disabled': false,
|
||||
style: { background: 'none' },
|
||||
onClick(e) {
|
||||
// 阻止冒泡
|
||||
e.stopPropagation();
|
||||
},
|
||||
}),
|
||||
notdelete: true,
|
||||
disabled: true,
|
||||
};
|
||||
const result = getMenuItems(() => {
|
||||
return children;
|
||||
@ -223,7 +221,7 @@ const HeaderMenu = ({
|
||||
{...others}
|
||||
className={headerMenuClass}
|
||||
onSelect={(info: any) => {
|
||||
const s = schema.properties[info.key];
|
||||
const s = schema.properties?.[info.key];
|
||||
|
||||
if (!s) {
|
||||
return;
|
||||
@ -293,7 +291,8 @@ const SideMenu = ({
|
||||
key: 'x-designer-button',
|
||||
disabled: true,
|
||||
label: render({
|
||||
'data-testid': 'add-menu-item-button-in-side',
|
||||
'data-testid': 'menu-schema-initializer-side',
|
||||
'aria-disabled': false,
|
||||
insert: (s) => {
|
||||
const dn = createDesignable({
|
||||
t,
|
||||
|
@ -9,6 +9,7 @@ import { ErrorBoundary } from 'react-error-boundary';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { FormDialog } from '..';
|
||||
import { useStyles as useAClStyles } from '../../../acl/style';
|
||||
import { useAppSpin } from '../../../application/hooks/useAppSpin';
|
||||
import { useDocumentTitle } from '../../../document-title';
|
||||
import { FilterBlockProvider } from '../../../filter-provider/FilterProvider';
|
||||
@ -23,7 +24,6 @@ import { ErrorFallback } from '../error-fallback';
|
||||
import FixedBlock from './FixedBlock';
|
||||
import { PageDesigner, PageTabDesigner } from './PageTabDesigner';
|
||||
import { useStyles } from './style';
|
||||
import { useStyles as useAClStyles } from '../../../acl/style';
|
||||
|
||||
export const Page = (props) => {
|
||||
const { children, ...others } = props;
|
||||
@ -99,6 +99,7 @@ export const Page = (props) => {
|
||||
tabBarExtraContent={
|
||||
dn.designable && (
|
||||
<Button
|
||||
data-testid={'tabs-schema-initializer'}
|
||||
icon={<PlusOutlined />}
|
||||
className={'addTabBtn'}
|
||||
type={'dashed'}
|
||||
|
@ -2,7 +2,7 @@ import { gridRowColWrap } from '../utils';
|
||||
|
||||
// 页面里添加区块
|
||||
export const BlockInitializers = {
|
||||
'data-testid': 'add-block-button-in-page',
|
||||
'data-testid': 'grid-schema-initializer-BlockInitializers',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
wrap: gridRowColWrap,
|
||||
|
@ -8,6 +8,7 @@ export const CreateFormBlockInitializers = (props: any) => {
|
||||
const { insertPosition, component } = props;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="grid-schema-initializer-CreateFormBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -8,6 +8,7 @@ export const CreateFormBulkEditBlockInitializers = (props: any) => {
|
||||
const { insertPosition, component } = props;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="grid-schema-initializer-CreateFormBulkEditBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -8,6 +8,7 @@ export const CusomeizeCreateFormBlockInitializers = (props: any) => {
|
||||
const { insertPosition, component } = props;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="grid-schema-initializer-CusomeizeCreateFormBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -199,6 +199,7 @@ export const RecordBlockInitializers = (props: any) => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="grid-schema-initializer-RecordBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
insertPosition={insertPosition}
|
||||
component={component}
|
||||
|
@ -7,7 +7,7 @@ export const RecordFormBlockInitializers = (props: any) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-record-form-block"
|
||||
data-testid="grid-schema-initializer-RecordFormBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
title={t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -10,7 +10,7 @@ export const TableSelectorInitializers = (props: any) => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-table-selector"
|
||||
data-testid="grid-schema-initializer-TableSelectorInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -3,7 +3,7 @@ import { generateNTemplate } from '../../../locale';
|
||||
|
||||
// 页面里添加区块
|
||||
export const MBlockInitializers = {
|
||||
'data-testid': 'add-block-button-in-mobile-page',
|
||||
'data-testid': 'grid-schema-initializer-MBlockInitializers',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
wrap: gridRowColWrap,
|
||||
|
@ -7,7 +7,7 @@ export const SnapshotBlockInitializers = (props: any) => {
|
||||
const { insertPosition, component } = props;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-snapshot-block"
|
||||
data-testid="grid-schema-initializer-SnapshotBlockInitializers"
|
||||
wrap={gridRowColWrap}
|
||||
insertPosition={insertPosition}
|
||||
component={component}
|
||||
|
@ -169,7 +169,7 @@ function AddBlockButton(props: any) {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-workflow"
|
||||
data-testid="grid-schema-initializer-AddBlockButton"
|
||||
{...props}
|
||||
wrap={gridRowColWrap}
|
||||
items={items}
|
||||
|
Loading…
Reference in New Issue
Block a user