mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:36:44 +00:00
refactor: display title (#3535)
This commit is contained in:
parent
5e2b0c3a8d
commit
83a61cdad9
@ -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} />;
|
|
||||||
};
|
|
@ -127,12 +127,6 @@ export const kanbanCardInitializers: SchemaInitializer = new SchemaInitializer({
|
|||||||
name: 'divider',
|
name: 'divider',
|
||||||
type: 'divider',
|
type: 'divider',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '{{t("Display field title")}}',
|
|
||||||
name: 'displayFieldTitle',
|
|
||||||
Component: 'Kanban.Card.Designer.TitleSwitch',
|
|
||||||
enable: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'openMode',
|
name: 'openMode',
|
||||||
Component: SchemaInitializerOpenModeSchemaItems,
|
Component: SchemaInitializerOpenModeSchemaItems,
|
||||||
|
@ -13,7 +13,6 @@ export const KanbanCard: any = observer(
|
|||||||
useContext(KanbanCardContext);
|
useContext(KanbanCardContext);
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const labelDisabled = fieldSchema['x-label-disabled'];
|
|
||||||
return (
|
return (
|
||||||
<SchemaComponentOptions components={{}} scope={{}}>
|
<SchemaComponentOptions components={{}} scope={{}}>
|
||||||
<Card
|
<Card
|
||||||
@ -65,7 +64,6 @@ export const KanbanCard: any = observer(
|
|||||||
.ant-formily-item-label {
|
.ant-formily-item-label {
|
||||||
color: #8c8c8c;
|
color: #8c8c8c;
|
||||||
fontweight: normal;
|
fontweight: normal;
|
||||||
display: ${labelDisabled ? 'none' : 'flex'};
|
|
||||||
}
|
}
|
||||||
`)}
|
`)}
|
||||||
>
|
>
|
||||||
|
@ -9,7 +9,6 @@ import {
|
|||||||
import { Kanban } from './Kanban';
|
import { Kanban } from './Kanban';
|
||||||
import { KanbanCard } from './Kanban.Card';
|
import { KanbanCard } from './Kanban.Card';
|
||||||
import { KanbanCardDesigner, kanbanCardInitializers } from './Kanban.Card.Designer';
|
import { KanbanCardDesigner, kanbanCardInitializers } from './Kanban.Card.Designer';
|
||||||
import { KanbanCardDesignerTitleSwitch } from './Kanban.Card.Designer.TitleSwitch';
|
|
||||||
import { KanbanCardViewer } from './Kanban.CardViewer';
|
import { KanbanCardViewer } from './Kanban.CardViewer';
|
||||||
import { KanbanDesigner } from './Kanban.Designer';
|
import { KanbanDesigner } from './Kanban.Designer';
|
||||||
import { kanbanActionInitializers } from './KanbanActionInitializers';
|
import { kanbanActionInitializers } from './KanbanActionInitializers';
|
||||||
@ -21,7 +20,6 @@ Kanban.Card = KanbanCard;
|
|||||||
Kanban.CardAdder = Action;
|
Kanban.CardAdder = Action;
|
||||||
Kanban.CardViewer = KanbanCardViewer;
|
Kanban.CardViewer = KanbanCardViewer;
|
||||||
Kanban.Card.Designer = KanbanCardDesigner;
|
Kanban.Card.Designer = KanbanCardDesigner;
|
||||||
Kanban.Card.Designer.TitleSwitch = KanbanCardDesignerTitleSwitch;
|
|
||||||
Kanban.Designer = KanbanDesigner;
|
Kanban.Designer = KanbanDesigner;
|
||||||
|
|
||||||
const KanbanV2 = Kanban;
|
const KanbanV2 = Kanban;
|
||||||
|
Loading…
Reference in New Issue
Block a user