mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
feat: expand and collapse are only displayed in the tree table
This commit is contained in:
parent
b28b8ba536
commit
42aba5e50b
@ -47,7 +47,11 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const renderItems = (items: any) => {
|
const renderItems = (items: any) => {
|
||||||
return items?.map((item, indexA) => {
|
return items
|
||||||
|
.filter((v) => {
|
||||||
|
return v?.visible ? v.visible() : true;
|
||||||
|
})
|
||||||
|
?.map((item, indexA) => {
|
||||||
if (item.type === 'divider') {
|
if (item.type === 'divider') {
|
||||||
return <Menu.Divider key={item.key || `item-${indexA}`} />;
|
return <Menu.Divider key={item.key || `item-${indexA}`} />;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Schema } from '@formily/react';
|
import { Schema, useFieldSchema } from '@formily/react';
|
||||||
|
import { useCollection } from '../../';
|
||||||
|
|
||||||
// 表格操作配置
|
// 表格操作配置
|
||||||
export const TableActionInitializers = {
|
export const TableActionInitializers = {
|
||||||
@ -56,6 +57,12 @@ export const TableActionInitializers = {
|
|||||||
schema: {
|
schema: {
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
},
|
},
|
||||||
|
visible: () => {
|
||||||
|
const schema = useFieldSchema();
|
||||||
|
const collection = useCollection();
|
||||||
|
const { treeTable } = schema?.parent?.['x-decorator-props'];
|
||||||
|
return (collection as any).template === 'tree' && treeTable !== false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user