diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/EventFilterTableDemo.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/EventFilterTableDemo.tsx
index 42d0809dab..ea5704b092 100644
--- a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/EventFilterTableDemo.tsx
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/EventFilterTableDemo.tsx
@@ -327,7 +327,7 @@ eventFlowManager.addFlow({
// --- FilterFlow 定义 ---
filterFlowManager.addFlow({
- name: 'tabulator:columns',
+ key: 'tabulator:columns',
title: '表格列展示流程',
steps: [
{
@@ -416,7 +416,7 @@ const EventFilterTableDemo: React.FC = (props) => {
[hooks, filterFlowParams],
);
- const tableColumns = useApplyFilters(filterFlowManager, 'tabulator:columns', {}, filterContext);
+ const { columns: tableColumns } = useApplyFilters(filterFlowManager, 'tabulator:columns', null, filterContext);
// 初始化和刷新数据
const refreshData = useCallback(async () => {
diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/basic-filterflow.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/basic-filterflow.tsx
index 5cd7ad9e2a..b8675322bb 100644
--- a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/basic-filterflow.tsx
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/basic-filterflow.tsx
@@ -30,7 +30,7 @@ filterFlowManager.addFilter({
// 创建过滤器流
filterFlowManager.addFlow({
- name: 'basic-text-transform',
+ key: 'basic-text-transform',
title: '基础文本转换',
steps: [
{
diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/conditional-filterflow.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/conditional-filterflow.tsx
index 23deac4a02..c5671fa2d4 100644
--- a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/conditional-filterflow.tsx
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/conditional-filterflow.tsx
@@ -1,5 +1,5 @@
-import { Button, Card, Input, Radio, Space, Typography } from 'antd';
-import React, { useMemo, useState } from 'react';
+import { Card, Input, Space, Typography } from 'antd';
+import React, { useState } from 'react';
import { FilterFlowManager, useApplyFilters } from '@nocobase/client';
// 创建FilterFlowManager实例
@@ -60,7 +60,7 @@ filterFlowManager.addFilter({
// 创建条件FilterFlow
filterFlowManager.addFlow({
- name: 'conditional-text-transform',
+ key: 'conditional-text-transform',
title: '条件文本转换',
steps: [
{
diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/configurable-filter.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/configurable-filter.tsx
index cc48f6b248..c1173d8c42 100644
--- a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/configurable-filter.tsx
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/configurable-filter.tsx
@@ -119,7 +119,7 @@ filterFlowManager.addFilter({
// 创建可配置FilterFlow
filterFlowManager.addFlow({
- name: 'configurable-text-transform',
+ key: 'configurable-text-transform',
title: '可配置文本转换',
steps: [
{
diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/data-transform-filterflow.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/data-transform-filterflow.tsx
index 1b2e7e90ee..0a79e22dcc 100644
--- a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/data-transform-filterflow.tsx
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/data-transform-filterflow.tsx
@@ -160,7 +160,7 @@ filterFlowManager.addFilter({
// 创建FilterFlow
filterFlowManager.addFlow({
- name: 'data-transform-flow',
+ key: 'data-transform-flow',
title: '数据转换流程',
steps: [
{
diff --git a/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/hide-show-filterflow.tsx b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/hide-show-filterflow.tsx
new file mode 100644
index 0000000000..ee458152c2
--- /dev/null
+++ b/packages/core/client/docs/zh-CN/core/event-and-filter/demos/filters/hide-show-filterflow.tsx
@@ -0,0 +1,213 @@
+import { Card, Space, Typography, Input, Button, Form, Checkbox } from 'antd';
+import React, { useState, useEffect, useMemo } from 'react';
+import { FilterFlowManager, useApplyFilters } from '@nocobase/client';
+
+// 创建过滤器管理器实例
+const filterFlowManager = new FilterFlowManager();
+
+// 注册过滤器组
+filterFlowManager.addFilterGroup({
+ name: 'visibilityControl',
+ title: '可见性控制',
+ sort: 1,
+});
+
+// 注册过滤器
+filterFlowManager.addFilter({
+ name: 'showHideElements',
+ title: '显示/隐藏元素',
+ description: '根据条件控制 actions 和 fields 的可见性',
+ group: 'visibilityControl',
+ sort: 1,
+ uiSchema: {
+ showActions: {
+ type: 'array',
+ title: '显示的操作',
+ enum: [
+ { label: 'Action 1', value: 'action1' },
+ { label: 'Action 2', value: 'action2' },
+ { label: 'Action 3', value: 'action3' },
+ ],
+ default: ['action1', 'action2', 'action3'],
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Checkbox.Group',
+ },
+ showFields: {
+ type: 'array',
+ title: '显示的字段',
+ enum: [
+ { label: 'Field 1', value: 'field1' },
+ { label: 'Field 2', value: 'field2' },
+ { label: 'Field 3', value: 'field3' },
+ ],
+ default: ['field1', 'field2', 'field3'],
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Checkbox.Group',
+ },
+ },
+ handler: (currentValue, params, context) => {
+ // 过滤器处理函数,返回应显示的元素配置
+ return {
+ visibleActions: params.showActions || [],
+ visibleFields: params.showFields || [],
+ };
+ },
+});
+
+// 创建过滤器流
+filterFlowManager.addFlow({
+ key: 'visibility-control',
+ title: '元素可见性控制',
+ steps: [
+ {
+ key: 'show-hide-step',
+ filterName: 'showHideElements',
+ title: '控制元素可见性',
+ },
+ ],
+});
+
+const HideShowFilterFlow = () => {
+ const [filterParams, setFilterParams] = useState({
+ showActions: ['action1', 'action2', 'action3'],
+ showFields: ['field1', 'field2', 'field3'],
+ });
+ const filterContext = useMemo(() => {
+ return {
+ meta: {
+ params: {
+ 'show-hide-step': filterParams,
+ },
+ },
+ };
+ }, [filterParams]);
+ // 应用过滤器获取可见性配置
+ const visibilityConfig = useApplyFilters(filterFlowManager, 'visibility-control', null, filterContext);
+
+ // 渲染 Action 按钮
+ const renderActions = () => {
+ const actions = [
+ { key: 'action1', title: 'Action 1', color: '#1890ff' },
+ { key: 'action2', title: 'Action 2', color: '#52c41a' },
+ { key: 'action3', title: 'Action 3', color: '#faad14' },
+ ];
+
+ return (
+
{JSON.stringify(visibilityConfig, null, 2)}+