Merge branch 'main' into T-1764

This commit is contained in:
Rain 2023-09-21 14:56:19 +08:00
commit 4e882c582c
6 changed files with 21 additions and 1 deletions

View File

@ -14,6 +14,7 @@ export const PluginManagerLink = () => {
return (
<Tooltip title={t('Plugin manager')}>
<Button
data-testid={'pm-button'}
icon={<ApiOutlined />}
title={t('Plugin manager')}
onClick={() => {

View File

@ -77,6 +77,7 @@ export const Action: ComposedAction = observer(
}
return (
<SortableItem
data-testid={`${fieldSchema['x-action'] || fieldSchema.name}-action`}
{...others}
loading={field?.data?.loading}
icon={icon ? <Icon type={icon} /> : null}

View File

@ -1,14 +1,29 @@
import { css } from '@emotion/css';
import { useFieldSchema } from '@formily/react';
import cls from 'classnames';
import React from 'react';
import { SortableItem } from '../../common';
import { useDesigner, useProps } from '../../hooks';
const getTestId = (schema) => {
const resource = schema?.['x-decorator-props']?.['resource'];
if (resource) {
return `${resource}-resource`;
}
const field = schema['x-collection-field'];
if (field) {
return `${field}-field`;
}
return `${schema.name}-item`;
};
export const BlockItem: React.FC<any> = (props) => {
const { className, children } = useProps(props);
const Designer = useDesigner();
const schema = useFieldSchema();
return (
<SortableItem
data-testid={getTestId(schema)}
className={cls(
'nb-block-item',
className,

View File

@ -196,7 +196,7 @@ const HeaderMenu = ({
key: 'x-designer-button',
disabled: true,
style: { padding: '0 8px', order: 9999 },
label: render({ style: { background: 'none' } }),
label: render({ 'data-testid': 'add-menu-item-button-in-header', style: { background: 'none' } }),
notdelete: true,
};
const result = getMenuItems(() => {
@ -281,6 +281,7 @@ const SideMenu = ({
key: 'x-designer-button',
disabled: true,
label: render({
'data-testid': 'add-menu-item-button-in-side',
insert: (s) => {
const dn = createDesignable({
t,

View File

@ -19,6 +19,7 @@ export const DesignableSwitch = () => {
return (
<Tooltip title={t('UI Editor')}>
<Button
data-testid={'ui-editor-button'}
// selected={designable}
icon={<HighlightOutlined />}
title={t('UI Editor')}

View File

@ -123,6 +123,7 @@ export const DuplicateAction = observer((props: any) => {
</a>
) : (
<Button
data-testid={'duplicate-action'}
disabled={disabled}
style={{
opacity: designable && field?.data?.hidden && 0.1,