From 83a61cdad962d8df64f32643b6043b06e7eb5f1c Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Tue, 20 Feb 2024 20:26:05 +0800 Subject: [PATCH] refactor: display title (#3535) --- .../Kanban.Card.Designer.TitleSwitch.tsx | 24 ------------------- .../src/client/Kanban.Card.Designer.tsx | 6 ----- .../plugin-kanban/src/client/Kanban.Card.tsx | 2 -- .../plugin-kanban/src/client/index.tsx | 2 -- 4 files changed, 34 deletions(-) delete mode 100644 packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.TitleSwitch.tsx diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.TitleSwitch.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.TitleSwitch.tsx deleted file mode 100644 index 27f086823..000000000 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.TitleSwitch.tsx +++ /dev/null @@ -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 ; -}; diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx index 915c47e40..2f1c30035 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx @@ -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, diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx index fdfebd90c..3f58489c6 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.tsx @@ -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 ( diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx index 2bbb65b6a..07bf896fc 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx @@ -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;