diff --git a/packages/core/client/src/schema-initializer/SchemaInitializer.tsx b/packages/core/client/src/schema-initializer/SchemaInitializer.tsx
index ac206dac44..3e6fbd76eb 100644
--- a/packages/core/client/src/schema-initializer/SchemaInitializer.tsx
+++ b/packages/core/client/src/schema-initializer/SchemaInitializer.tsx
@@ -47,59 +47,63 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
}
};
const renderItems = (items: any) => {
- return items?.map((item, indexA) => {
- if (item.type === 'divider') {
- return
;
- }
- if (item.type === 'item' && item.component) {
- const Component = findComponent(item.component);
- item.key = `${item.key || item.title}-${indexA}`;
- return (
- Component && (
-
- {
+ return v?.visible ? v.visible() : true;
+ })
+ ?.map((item, indexA) => {
+ if (item.type === 'divider') {
+ return ;
+ }
+ if (item.type === 'item' && item.component) {
+ const Component = findComponent(item.component);
+ item.key = `${item.key || item.title}-${indexA}`;
+ return (
+ Component && (
+
-
- )
- );
- }
- if (item.type === 'itemGroup') {
- return (
- !!item.children?.length && (
-
- {renderItems(item.children)}
-
- )
- );
- }
- if (item.type === 'subMenu') {
- return (
- !!item.children?.length && (
-
- {renderItems(item.children)}
-
- )
- );
- }
- });
+ >
+
+
+ )
+ );
+ }
+ if (item.type === 'itemGroup') {
+ return (
+ !!item.children?.length && (
+
+ {renderItems(item.children)}
+
+ )
+ );
+ }
+ if (item.type === 'subMenu') {
+ return (
+ !!item.children?.length && (
+
+ {renderItems(item.children)}
+
+ )
+ );
+ }
+ });
};
const menu = ;
if (!designable && props.designable !== true) {
diff --git a/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx
index 74b53bce9c..68a025b64f 100644
--- a/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx
@@ -1,4 +1,5 @@
-import { Schema } from '@formily/react';
+import { Schema, useFieldSchema } from '@formily/react';
+import { useCollection } from '../../';
// 表格操作配置
export const TableActionInitializers = {
@@ -56,6 +57,12 @@ export const TableActionInitializers = {
schema: {
'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;
+ },
},
],
},