parent
							
								
									de849b267c
								
							
						
					
					
						commit
						945bcb194e
					
				@ -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={() => {
 | 
			
		||||
 | 
			
		||||
@ -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}
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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')}
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user