2022-12-21 02:00:08 +00:00
|
|
|
# x-designer
|
2022-10-31 03:52:17 +00:00
|
|
|
|
2022-12-21 02:00:08 +00:00
|
|
|
## Built-in x-designer component
|
2022-10-31 03:52:17 +00:00
|
|
|
|
|
|
|
- Action.Designer
|
|
|
|
- Calendar.Designer
|
|
|
|
- Filter.Action.Designer
|
|
|
|
- Form.Designer
|
|
|
|
- FormItem.Designer
|
|
|
|
- FormV2.Designer
|
|
|
|
- FormV2.ReadPrettyDesigner
|
|
|
|
- DetailsDesigner
|
|
|
|
- G2Plot.Designer
|
|
|
|
- Kanban.Designer
|
|
|
|
- Kanban.Card.Designer
|
|
|
|
- Markdown.Void.Designer
|
|
|
|
- Menu.Designer
|
|
|
|
- TableV2.Column.Designer
|
|
|
|
- TableV2.ActionColumnDesigner
|
|
|
|
- TableBlockDesigner
|
|
|
|
- TableSelectorDesigner
|
|
|
|
- Tabs.Designer
|
|
|
|
|
2022-12-21 02:00:08 +00:00
|
|
|
## Replacement
|
2022-10-31 03:52:17 +00:00
|
|
|
|
|
|
|
```tsx | pure
|
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import { useFieldSchema } from '@formily/react';
|
|
|
|
import {
|
|
|
|
SchemaComponentOptions,
|
|
|
|
GeneralSchemaDesigner,
|
|
|
|
SchemaSettings,
|
|
|
|
useCollection
|
|
|
|
} from '@nocobase/client';
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
const CustomActionDesigner = () => {
|
|
|
|
const { name, title } = useCollection();
|
|
|
|
const fieldSchema = useFieldSchema();
|
|
|
|
return (
|
|
|
|
<GeneralSchemaDesigner title={title || name}>
|
|
|
|
<SchemaSettings.Remove
|
|
|
|
removeParentsIfNoChildren
|
|
|
|
breakRemoveOn={{
|
|
|
|
'x-component': 'Grid',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</GeneralSchemaDesigner>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default React.memo((props) => {
|
|
|
|
return (
|
|
|
|
<SchemaComponentOptions
|
|
|
|
components={{
|
|
|
|
'Action.Designer': CustomActionDesigner,
|
|
|
|
}}
|
|
|
|
>{props.children}</SchemaComponentOptions>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
```
|