refactor: display title (#3535)

This commit is contained in:
katherinehhh 2024-02-20 20:26:05 +08:00 committed by GitHub
parent 5e2b0c3a8d
commit 83a61cdad9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 34 deletions

View File

@ -1,24 +0,0 @@
import React from 'react';
import { useFieldSchema } from '@formily/react';
import { useDesignable, SchemaInitializerSwitch, useSchemaInitializerItem } from '@nocobase/client';
export const KanbanCardDesignerTitleSwitch = () => {
const itemConfig = useSchemaInitializerItem();
const fieldSchema = useFieldSchema();
const { dn } = useDesignable();
const disabled = fieldSchema['x-label-disabled'];
const handleSwitch = () => {
fieldSchema['x-label-disabled'] = !disabled;
dn.emit('patch', {
schema: {
'x-uid': fieldSchema['x-uid'],
'x-label-disabled': fieldSchema['x-label-disabled'],
},
});
dn.refresh();
};
return <SchemaInitializerSwitch checked={!disabled} title={itemConfig.title} onClick={handleSwitch} />;
};

View File

@ -127,12 +127,6 @@ export const kanbanCardInitializers: SchemaInitializer = new SchemaInitializer({
name: 'divider',
type: 'divider',
},
{
title: '{{t("Display field title")}}',
name: 'displayFieldTitle',
Component: 'Kanban.Card.Designer.TitleSwitch',
enable: true,
},
{
name: 'openMode',
Component: SchemaInitializerOpenModeSchemaItems,

View File

@ -13,7 +13,6 @@ export const KanbanCard: any = observer(
useContext(KanbanCardContext);
const fieldSchema = useFieldSchema();
const [visible, setVisible] = useState(false);
const labelDisabled = fieldSchema['x-label-disabled'];
return (
<SchemaComponentOptions components={{}} scope={{}}>
<Card
@ -65,7 +64,6 @@ export const KanbanCard: any = observer(
.ant-formily-item-label {
color: #8c8c8c;
fontweight: normal;
display: ${labelDisabled ? 'none' : 'flex'};
}
`)}
>

View File

@ -9,7 +9,6 @@ import {
import { Kanban } from './Kanban';
import { KanbanCard } from './Kanban.Card';
import { KanbanCardDesigner, kanbanCardInitializers } from './Kanban.Card.Designer';
import { KanbanCardDesignerTitleSwitch } from './Kanban.Card.Designer.TitleSwitch';
import { KanbanCardViewer } from './Kanban.CardViewer';
import { KanbanDesigner } from './Kanban.Designer';
import { kanbanActionInitializers } from './KanbanActionInitializers';
@ -21,7 +20,6 @@ Kanban.Card = KanbanCard;
Kanban.CardAdder = Action;
Kanban.CardViewer = KanbanCardViewer;
Kanban.Card.Designer = KanbanCardDesigner;
Kanban.Card.Designer.TitleSwitch = KanbanCardDesignerTitleSwitch;
Kanban.Designer = KanbanDesigner;
const KanbanV2 = Kanban;