@huanban/rulego-editor-react 1.3.17 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +304 -10
- package/dist/components/AIAssistant.d.ts +1 -7
- package/dist/components/ComponentSidebar.d.ts +13 -52
- package/dist/components/ContextMenu.d.ts +1 -59
- package/dist/components/CopilotChat.d.ts +27 -22
- package/dist/components/DataViewDialog.d.ts +0 -33
- package/dist/components/DebugPanel.d.ts +5 -65
- package/dist/components/DynamicForm.d.ts +0 -40
- package/dist/components/EdgePropertyDrawer.d.ts +0 -35
- package/dist/components/EditorConnectionStatus.d.ts +12 -0
- package/dist/components/EditorEdgeHoverTools.d.ts +11 -0
- package/dist/components/EditorIcon.d.ts +7 -0
- package/dist/components/EditorNodeHoverTools.d.ts +16 -0
- package/dist/components/EditorPanelDock.d.ts +18 -0
- package/dist/components/EditorStatusBar.d.ts +34 -0
- package/dist/components/EditorToolbar.d.ts +2 -62
- package/dist/components/ImportExportDialog.d.ts +1 -37
- package/dist/components/LogViewer.d.ts +0 -29
- package/dist/components/MiniMap.d.ts +0 -46
- package/dist/components/NodePropertyDrawer.d.ts +19 -102
- package/dist/components/ProblemsPanel.d.ts +21 -0
- package/dist/components/RuleChainSettings.d.ts +0 -45
- package/dist/components/RuleGoEditor.d.ts +37 -147
- package/dist/components/RuleMaintenancePanel.d.ts +0 -1
- package/dist/components/SearchPanel.d.ts +0 -39
- package/dist/components/SearchableSelect.d.ts +0 -1
- package/dist/components/ValidationPanel.d.ts +0 -39
- package/dist/components/WorkflowExplorer.d.ts +24 -0
- package/dist/components/WorkflowInfoPanel.d.ts +1 -36
- package/dist/components/WorkflowList.d.ts +2 -69
- package/dist/components/WorkspaceTabs.d.ts +17 -0
- package/dist/components/properties/AgentOrchestrationProperties.d.ts +2 -1
- package/dist/hooks/useBoundStore.d.ts +8 -0
- package/dist/hooks/useClipboard.d.ts +2 -63
- package/dist/hooks/useEditorCore.d.ts +0 -79
- package/dist/hooks/useEditorI18n.d.ts +0 -26
- package/dist/hooks/useEditorPanels.d.ts +23 -0
- package/dist/hooks/useEditorShell.d.ts +35 -0
- package/dist/hooks/useEditorTheme.d.ts +0 -30
- package/dist/hooks/useEditorWorkspace.d.ts +25 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +4 -44
- package/dist/i18n.d.ts +6 -4
- package/dist/index.cjs +17 -0
- package/dist/index.d.ts +28 -62
- package/dist/index.esm.js +6218 -104179
- package/dist/style.css +1 -1
- package/package.json +13 -8
- package/dist/index.cjs.js +0 -9338
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file index.tsx
|
|
3
|
-
* @description Copilot Chat 独立组件
|
|
4
|
-
*/
|
|
5
1
|
import React from 'react';
|
|
6
|
-
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
2
|
+
import type { CopilotChatMessage, CopilotChatToolCall, EditorChatHistoryMode, EditorPersistenceAdapter, EditorPersistenceNamespace, LocaleMessages } from '@huanban/rulego-editor-core';
|
|
7
3
|
import type { EditorTranslate } from '../i18n';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export interface CopilotChatViewMessage extends CopilotChatMessage {
|
|
5
|
+
id: string;
|
|
6
|
+
status?: 'sending' | 'complete' | 'error';
|
|
7
|
+
reasoning?: string;
|
|
8
|
+
toolCalls?: CopilotChatToolCall[];
|
|
9
|
+
}
|
|
10
|
+
export interface CopilotChatPersistence {
|
|
11
|
+
adapter: EditorPersistenceAdapter;
|
|
12
|
+
namespace: EditorPersistenceNamespace;
|
|
13
|
+
mode?: EditorChatHistoryMode;
|
|
14
|
+
}
|
|
12
15
|
export interface CopilotChatProps {
|
|
13
|
-
/** 绑定对话的规则链 ID,用于上下文隔离 */
|
|
14
16
|
ruleChainId: string;
|
|
15
|
-
|
|
17
|
+
apiBase?: string;
|
|
18
|
+
endpoint?: string;
|
|
19
|
+
conversationContextKey?: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
stream?: boolean;
|
|
22
|
+
fetchHeaders?: Record<string, string> | (() => Record<string, string>);
|
|
23
|
+
customFetch?: (url: string, init?: RequestInit) => Promise<Response>;
|
|
24
|
+
initialMessages?: CopilotChatMessage[];
|
|
25
|
+
persistence?: CopilotChatPersistence;
|
|
26
|
+
onMessagesChange?: (messages: CopilotChatViewMessage[]) => void;
|
|
27
|
+
onError?: (error: Error) => void;
|
|
16
28
|
locale?: string;
|
|
17
|
-
/** Extra locale messages merged into the selected locale. */
|
|
18
29
|
messages?: LocaleMessages;
|
|
19
|
-
/** Host-provided translation function. */
|
|
20
30
|
t?: EditorTranslate;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
style?: React.CSSProperties;
|
|
34
|
+
disabled?: boolean;
|
|
21
35
|
}
|
|
22
|
-
/**
|
|
23
|
-
* AI Copilot 侧边栏对话组件 (CopilotChat)
|
|
24
|
-
*
|
|
25
|
-
* @component
|
|
26
|
-
* @description 独立出来的 AI Copilot 侧边聊天面板组件。
|
|
27
|
-
* 该组件不直接依赖底层的 fetch 或 axios,而是通过 `useEditorApi()` 获取通信层能力,
|
|
28
|
-
* 以便对接 HuanbanClaw 的大模型流式传输能力 (`streamChat`)。
|
|
29
|
-
*/
|
|
30
36
|
export declare const CopilotChat: React.FC<CopilotChatProps>;
|
|
31
|
-
//# sourceMappingURL=CopilotChat.d.ts.map
|
|
@@ -1,49 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file components/DataViewDialog.tsx
|
|
3
|
-
* @description 规则链数据查看对话框 — React 实现
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 以格式化 JSON 展示规则链完整数据
|
|
7
|
-
* - 支持复制到剪贴板
|
|
8
|
-
* - 支持下载为 JSON 文件
|
|
9
|
-
* - 零 UI 框架依赖(纯 React + CSS)
|
|
10
|
-
*
|
|
11
|
-
* @see DataViewDialogProps — 组件参数
|
|
12
|
-
*/
|
|
13
1
|
import React from 'react';
|
|
14
2
|
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
15
3
|
import type { EditorTranslate } from '../i18n';
|
|
16
|
-
/** DataViewDialog Props */
|
|
17
4
|
export interface DataViewDialogProps {
|
|
18
|
-
/** 是否显示 */
|
|
19
5
|
visible: boolean;
|
|
20
|
-
/** 规则链 JSON 数据(原始对象) */
|
|
21
6
|
data: unknown;
|
|
22
|
-
/** 对话框标题 */
|
|
23
7
|
title?: string;
|
|
24
|
-
/** 文件名前缀(下载用) */
|
|
25
8
|
fileNamePrefix?: string;
|
|
26
|
-
/** 关闭回调 */
|
|
27
9
|
onClose: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* 提示消息回调(替代 antd message)
|
|
30
|
-
* @param type 类型
|
|
31
|
-
* @param content 内容
|
|
32
|
-
*/
|
|
33
10
|
onNotify?: (type: 'success' | 'error' | 'info', content: string) => void;
|
|
34
|
-
/** Current locale. Defaults to zh-CN. */
|
|
35
11
|
locale?: string;
|
|
36
|
-
/** Extra locale messages merged into the selected locale. */
|
|
37
12
|
messages?: LocaleMessages;
|
|
38
|
-
/** Host-provided translation function. */
|
|
39
13
|
t?: EditorTranslate;
|
|
40
14
|
}
|
|
41
|
-
/**
|
|
42
|
-
* DataViewDialog 组件
|
|
43
|
-
*
|
|
44
|
-
* 纯 React 实现的规则链数据查看对话框,无 antd 依赖。
|
|
45
|
-
* 提供格式化 JSON 展示、复制和下载功能。
|
|
46
|
-
*/
|
|
47
15
|
declare const DataViewDialog: React.FC<DataViewDialogProps>;
|
|
48
16
|
export default DataViewDialog;
|
|
49
|
-
//# sourceMappingURL=DataViewDialog.d.ts.map
|
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file components/DebugPanel.tsx
|
|
3
|
-
* @description 调试面板 — React 实现
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 发送测试消息到规则链
|
|
7
|
-
* - 查看节点调试日志
|
|
8
|
-
* - 查看运行日志列表
|
|
9
|
-
* - 零 UI 框架依赖(纯 React + CSS)
|
|
10
|
-
*
|
|
11
|
-
* 设计说明:
|
|
12
|
-
* 不直接调用 API,而是通过 Props 传入回调函数,
|
|
13
|
-
* 使此组件可在不同项目中复用。
|
|
14
|
-
*
|
|
15
|
-
* @see DebugPanelProps — 组件参数
|
|
16
|
-
*/
|
|
17
1
|
import React from 'react';
|
|
18
|
-
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
2
|
+
import type { LocaleMessages, RuleChainDeployState } from '@huanban/rulego-editor-core';
|
|
19
3
|
import type { EditorTranslate } from '../i18n';
|
|
20
|
-
/** 调试日志条目 */
|
|
21
4
|
export interface DebugLogItem {
|
|
22
|
-
/** 时间戳 */
|
|
23
5
|
ts: number;
|
|
24
|
-
/** 流转类型 */
|
|
25
6
|
flowType: string;
|
|
26
|
-
/** 关系类型 */
|
|
27
7
|
relationType: string;
|
|
28
|
-
/** 错误信息 */
|
|
29
8
|
err?: string;
|
|
30
|
-
/** 消息数据 */
|
|
31
9
|
msg: {
|
|
32
10
|
id: string;
|
|
33
11
|
type: string;
|
|
@@ -35,66 +13,28 @@ export interface DebugLogItem {
|
|
|
35
13
|
metadata: Record<string, unknown>;
|
|
36
14
|
};
|
|
37
15
|
}
|
|
38
|
-
/** 发送测试消息返回结果 */
|
|
39
16
|
export interface SendMessageResult {
|
|
40
|
-
/** 是否成功 */
|
|
41
17
|
success: boolean;
|
|
42
|
-
/** 返回数据 */
|
|
43
18
|
data?: unknown;
|
|
44
|
-
/** 错误/提示消息 */
|
|
45
19
|
msg?: string;
|
|
46
20
|
}
|
|
47
|
-
|
|
21
|
+
export type DebugPanelDeployResult = void | boolean | SendMessageResult;
|
|
48
22
|
export interface DebugPanelProps {
|
|
49
|
-
/** 是否显示 */
|
|
50
23
|
visible: boolean;
|
|
51
|
-
/** 当前规则链 ID */
|
|
52
24
|
chainId: string;
|
|
53
|
-
/** 选中的节点 ID(可选) */
|
|
54
25
|
selectedNodeId?: string;
|
|
55
|
-
/** 关闭回调 */
|
|
56
26
|
onClose: () => void;
|
|
57
|
-
/**
|
|
58
|
-
* 发送测试消息的回调
|
|
59
|
-
* @param chainId 规则链 ID
|
|
60
|
-
* @param msgType 消息类型
|
|
61
|
-
* @param body 消息体
|
|
62
|
-
* @returns 发送结果
|
|
63
|
-
*/
|
|
64
27
|
onSendMessage?: (chainId: string, msgType: string, body: unknown) => Promise<SendMessageResult>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* @param chainId 规则链 ID
|
|
68
|
-
* @param nodeId 可选节点 ID
|
|
69
|
-
* @returns 调试日志列表
|
|
70
|
-
*/
|
|
28
|
+
deployState?: RuleChainDeployState;
|
|
29
|
+
onDeploy?: (chainId: string) => DebugPanelDeployResult | Promise<DebugPanelDeployResult>;
|
|
71
30
|
onFetchDebugLogs?: (chainId: string, nodeId?: string) => Promise<{
|
|
72
31
|
items: DebugLogItem[];
|
|
73
32
|
}>;
|
|
74
|
-
|
|
75
|
-
* 获取运行日志的回调
|
|
76
|
-
* @returns 运行日志列表
|
|
77
|
-
*/
|
|
78
|
-
onFetchRunLogs?: () => Promise<unknown[]>;
|
|
79
|
-
/**
|
|
80
|
-
* 提示消息回调(替代 antd message)
|
|
81
|
-
* @param type 提示类型
|
|
82
|
-
* @param content 提示内容
|
|
83
|
-
*/
|
|
33
|
+
onFetchRunLogs?: (chainId: string) => Promise<unknown[]>;
|
|
84
34
|
onNotify?: (type: 'success' | 'error' | 'warning' | 'info', content: string) => void;
|
|
85
|
-
/** Current locale. Defaults to zh-CN. */
|
|
86
35
|
locale?: string;
|
|
87
|
-
/** Extra locale messages merged into the selected locale. */
|
|
88
36
|
messages?: LocaleMessages;
|
|
89
|
-
/** Host-provided translation function. */
|
|
90
37
|
t?: EditorTranslate;
|
|
91
38
|
}
|
|
92
|
-
/**
|
|
93
|
-
* DebugPanel 组件
|
|
94
|
-
*
|
|
95
|
-
* 纯 React 实现的调试面板,无 antd 依赖。
|
|
96
|
-
* 通过回调函数与外部 API 对接,实现测试消息发送和日志查看。
|
|
97
|
-
*/
|
|
98
39
|
declare const DebugPanel: React.FC<DebugPanelProps>;
|
|
99
40
|
export default DebugPanel;
|
|
100
|
-
//# sourceMappingURL=DebugPanel.d.ts.map
|
|
@@ -1,65 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file DynamicForm.tsx
|
|
3
|
-
* @description 玻璃拟态风格的动态属性表单
|
|
4
|
-
*/
|
|
5
1
|
import React from 'react';
|
|
6
2
|
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
7
3
|
import type { EditorTranslate } from '../i18n';
|
|
8
4
|
import { type SearchableSelectOption } from './SearchableSelect';
|
|
9
|
-
/**
|
|
10
|
-
* 动态表单字段定义配置项
|
|
11
|
-
* @interface FormField
|
|
12
|
-
*/
|
|
13
5
|
export interface FormField {
|
|
14
|
-
/** 字段唯一标识,对应业务数据的 key */
|
|
15
6
|
key: string;
|
|
16
|
-
/** UI 呈现的中文标签 */
|
|
17
7
|
label: string;
|
|
18
|
-
/** 可选翻译 key,优先级高于 fields.<key> */
|
|
19
8
|
labelKey?: string;
|
|
20
|
-
/** 字段类型,支持数字、文本、布尔、复杂 JSON、下拉等 */
|
|
21
9
|
type: 'string' | 'number' | 'boolean' | 'json' | 'select' | 'textarea' | 'password';
|
|
22
|
-
/** 默认值 */
|
|
23
10
|
defaultValue?: any;
|
|
24
|
-
/** select 选项 */
|
|
25
11
|
options?: SearchableSelectOption[];
|
|
26
|
-
/** select 是否多选 */
|
|
27
12
|
multiple?: boolean;
|
|
28
|
-
/** 输入提示 */
|
|
29
13
|
placeholder?: string;
|
|
30
|
-
/** 帮助文本 */
|
|
31
14
|
help?: string;
|
|
32
|
-
/** textarea 行数 */
|
|
33
15
|
rows?: number;
|
|
34
16
|
}
|
|
35
|
-
/**
|
|
36
|
-
* 动态表单组件的属性接口
|
|
37
|
-
* @interface DynamicFormProps
|
|
38
|
-
*/
|
|
39
17
|
export interface DynamicFormProps {
|
|
40
|
-
/** 外部传入的 Schema 配置 */
|
|
41
18
|
schema: FormField[];
|
|
42
|
-
/** 当前节点或配置面板绑定的实际数据模型 */
|
|
43
19
|
formData: Record<string, any>;
|
|
44
|
-
/**
|
|
45
|
-
* 表单数据变更回调
|
|
46
|
-
* @param key 修改的字段名称
|
|
47
|
-
* @param value 修改后的新值
|
|
48
|
-
*/
|
|
49
20
|
onChange: (key: string, value: any) => void;
|
|
50
|
-
/** Current locale. Defaults to zh-CN. */
|
|
51
21
|
locale?: string;
|
|
52
|
-
/** Extra locale messages merged into the selected locale. */
|
|
53
22
|
messages?: LocaleMessages;
|
|
54
|
-
/** Host-provided translation function. */
|
|
55
23
|
t?: EditorTranslate;
|
|
56
24
|
}
|
|
57
|
-
/**
|
|
58
|
-
* 玻璃拟态风格的动态属性表单组件 (DynamicForm)
|
|
59
|
-
*
|
|
60
|
-
* @component
|
|
61
|
-
* @description 接收 JSON Schema 生成配置项列表,避免写死表单。
|
|
62
|
-
* 完全剥离 Element Plus,采用原生 HTML + HSL 变量完成拟态风格渲染。
|
|
63
|
-
*/
|
|
64
25
|
export declare const DynamicForm: React.FC<DynamicFormProps>;
|
|
65
|
-
//# sourceMappingURL=DynamicForm.d.ts.map
|
|
@@ -1,62 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file components/EdgePropertyDrawer.tsx
|
|
3
|
-
* @description 边属性编辑抽屉 — React 实现
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 双击连线弹出侧边抽屉,编辑连线的关系类型(relationType)
|
|
7
|
-
* - 支持常见预定义类型、自定义类型输入
|
|
8
|
-
* - 提交后通过 onSubmit 更新边的属性
|
|
9
|
-
* - 零 UI 框架依赖(纯 React + CSS)
|
|
10
|
-
*
|
|
11
|
-
* @see EdgeModel — 边模型类型
|
|
12
|
-
*/
|
|
13
1
|
import React from 'react';
|
|
14
2
|
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
15
3
|
import type { EditorTranslate } from '../i18n';
|
|
16
|
-
/** 边模型数据 */
|
|
17
4
|
export interface EdgeModel {
|
|
18
|
-
/** 边 ID */
|
|
19
5
|
id: string;
|
|
20
|
-
/** 来源节点 ID */
|
|
21
6
|
sourceNodeId: string;
|
|
22
|
-
/** 目标节点 ID */
|
|
23
7
|
targetNodeId: string;
|
|
24
|
-
/** 边类型 */
|
|
25
8
|
type: string;
|
|
26
|
-
/** 关系类型 */
|
|
27
9
|
relationType?: string;
|
|
28
|
-
/** 额外属性 */
|
|
29
10
|
[key: string]: unknown;
|
|
30
11
|
}
|
|
31
|
-
/** EdgePropertyDrawer Props */
|
|
32
12
|
export interface EdgePropertyDrawerProps {
|
|
33
|
-
/** 是否显示 */
|
|
34
13
|
visible: boolean;
|
|
35
|
-
/** 边模型数据 */
|
|
36
14
|
edgeModel: EdgeModel | null;
|
|
37
|
-
/** Source-node relation type candidates. Aligns with sourceNodeView.relationTypes. */
|
|
38
15
|
relationTypes?: Array<string | {
|
|
39
16
|
value: string;
|
|
40
17
|
label?: string;
|
|
41
18
|
color?: string;
|
|
42
19
|
}>;
|
|
43
|
-
/** 提交回调,传递更新后的边模型 */
|
|
44
20
|
onSubmit: (model: EdgeModel) => void;
|
|
45
|
-
/** 关闭回调 */
|
|
46
21
|
onClose: () => void;
|
|
47
|
-
/** Current locale. Defaults to zh-CN. */
|
|
48
22
|
locale?: string;
|
|
49
|
-
/** Extra locale messages merged into the selected locale. */
|
|
50
23
|
messages?: LocaleMessages;
|
|
51
|
-
/** Host-provided translation function. */
|
|
52
24
|
t?: EditorTranslate;
|
|
53
25
|
}
|
|
54
|
-
/**
|
|
55
|
-
* EdgePropertyDrawer 组件
|
|
56
|
-
*
|
|
57
|
-
* 纯 React 实现的边属性编辑抽屉,无 antd 依赖。
|
|
58
|
-
* 提供预定义关系类型选择和自定义输入。
|
|
59
|
-
*/
|
|
60
26
|
declare const EdgePropertyDrawer: React.FC<EdgePropertyDrawerProps>;
|
|
61
27
|
export default EdgePropertyDrawer;
|
|
62
|
-
//# sourceMappingURL=EdgePropertyDrawer.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FrameworkI18nProps } from '../i18n';
|
|
3
|
+
import type { ServerStatusState } from '@huanban/rulego-editor-core';
|
|
4
|
+
export interface EditorConnectionStatusProps extends FrameworkI18nProps {
|
|
5
|
+
state?: Partial<ServerStatusState> | null;
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
onRetry?: () => void;
|
|
8
|
+
onLogin?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function EditorConnectionStatus({ state, compact, onRetry, onLogin, className, locale, messages, t }: EditorConnectionStatusProps): React.JSX.Element;
|
|
12
|
+
export default EditorConnectionStatus;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FrameworkI18nProps } from '../i18n';
|
|
3
|
+
import type { EditorEdgeHoverAction, EditorHoverToolTarget } from '@huanban/rulego-editor-core';
|
|
4
|
+
export interface EditorEdgeHoverToolsProps extends FrameworkI18nProps, EditorHoverToolTarget {
|
|
5
|
+
className?: string;
|
|
6
|
+
onAction?: (action: EditorEdgeHoverAction, targetId: string) => void;
|
|
7
|
+
onInsertNode?: (targetId: string) => void;
|
|
8
|
+
onDelete?: (targetId: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function EditorEdgeHoverTools({ visible, x, y, flipDown, targetId, className, onAction, onInsertNode, onDelete, locale, messages, t }: EditorEdgeHoverToolsProps): React.JSX.Element | null;
|
|
11
|
+
export default EditorEdgeHoverTools;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FrameworkI18nProps } from '../i18n';
|
|
3
|
+
import type { EditorHoverToolTarget, EditorNodeHoverAction } from '@huanban/rulego-editor-core';
|
|
4
|
+
export interface EditorNodeHoverToolsProps extends FrameworkI18nProps, EditorHoverToolTarget {
|
|
5
|
+
showRun?: boolean;
|
|
6
|
+
nodeType?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
onAction?: (action: EditorNodeHoverAction, targetId: string) => void;
|
|
9
|
+
onEdit?: (targetId: string) => void;
|
|
10
|
+
onCopy?: (targetId: string) => void;
|
|
11
|
+
onDelete?: (targetId: string) => void;
|
|
12
|
+
onRunFrom?: (targetId: string) => void;
|
|
13
|
+
onRunOnly?: (targetId: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function EditorNodeHoverTools({ visible, x, y, flipDown, targetId, showRun, nodeType, className, onAction, onEdit, onCopy, onDelete, onRunFrom, onRunOnly, locale, messages, t, }: EditorNodeHoverToolsProps): React.JSX.Element | null;
|
|
16
|
+
export default EditorNodeHoverTools;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { EditorDockId, EditorDockState, EditorPanelDefinition, EditorPanelState } from '@huanban/rulego-editor-core';
|
|
4
|
+
export interface EditorPanelDockProps {
|
|
5
|
+
dock: EditorDockId;
|
|
6
|
+
dockState: EditorDockState;
|
|
7
|
+
panelState: EditorPanelState;
|
|
8
|
+
renderPanel?: (panel: EditorPanelDefinition) => ReactNode;
|
|
9
|
+
title?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
onToggleDock?: (dock: EditorDockId, visible: boolean) => void;
|
|
12
|
+
onActivatePanel?: (panelId: string) => void;
|
|
13
|
+
onClosePanel?: (panelId: string) => void;
|
|
14
|
+
onTogglePanel?: (panelId: string, expanded: boolean) => void;
|
|
15
|
+
onResize?: (dock: EditorDockId, size: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function EditorPanelDock({ dock, dockState, panelState, renderPanel, title, className, onToggleDock, onActivatePanel, onClosePanel, onTogglePanel, onResize, }: EditorPanelDockProps): React.JSX.Element | null;
|
|
18
|
+
export default EditorPanelDock;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FrameworkI18nProps } from '../i18n';
|
|
3
|
+
export interface EditorStatusBarGraphLike {
|
|
4
|
+
graphModel?: {
|
|
5
|
+
nodes?: readonly unknown[];
|
|
6
|
+
edges?: readonly unknown[];
|
|
7
|
+
transformModel?: {
|
|
8
|
+
SCALE_X?: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
getSelectElements?: () => {
|
|
12
|
+
nodes?: readonly unknown[];
|
|
13
|
+
edges?: readonly unknown[];
|
|
14
|
+
};
|
|
15
|
+
zoom?: (scale: number | boolean) => void;
|
|
16
|
+
resetZoom?: () => void;
|
|
17
|
+
on?: (event: string, listener: (...args: any[]) => void) => void;
|
|
18
|
+
off?: (event: string, listener: (...args: any[]) => void) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface EditorStatusBarProps extends FrameworkI18nProps {
|
|
21
|
+
lf?: EditorStatusBarGraphLike | null;
|
|
22
|
+
nodeCount?: number;
|
|
23
|
+
edgeCount?: number;
|
|
24
|
+
selectedCount?: number;
|
|
25
|
+
zoom?: number;
|
|
26
|
+
problemCount?: number;
|
|
27
|
+
onZoomIn?: () => void;
|
|
28
|
+
onZoomOut?: () => void;
|
|
29
|
+
onResetZoom?: () => void;
|
|
30
|
+
onOpenDiagnostics?: () => void;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function EditorStatusBar({ lf, nodeCount: nodeCountProp, edgeCount: edgeCountProp, selectedCount: selectedCountProp, zoom: zoomProp, problemCount, onZoomIn, onZoomOut, onResetZoom, onOpenDiagnostics, className, locale, messages, t, }: EditorStatusBarProps): React.JSX.Element;
|
|
34
|
+
export default EditorStatusBar;
|
|
@@ -1,107 +1,47 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file components/EditorToolbar.tsx
|
|
3
|
-
* @description 编辑器工具栏 — React 实现
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 保存/撤销/重做操作按钮
|
|
7
|
-
* - 删除选中元素
|
|
8
|
-
* - 缩放控制(放大/缩小/适应画布/重置)
|
|
9
|
-
* - 全屏切换
|
|
10
|
-
* - 调试模式开关
|
|
11
|
-
* - 数据视图触发
|
|
12
|
-
* - 设置入口
|
|
13
|
-
* - 校验入口
|
|
14
|
-
* - 零 UI 框架依赖(纯 React + CSS)
|
|
15
|
-
*
|
|
16
|
-
* @see EditorToolbarProps — 工具栏参数
|
|
17
|
-
*/
|
|
18
1
|
import React from 'react';
|
|
19
2
|
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
20
3
|
import type { EditorTranslate } from '../i18n';
|
|
21
|
-
/** 工具栏按钮定义 */
|
|
22
4
|
export interface ToolbarButton {
|
|
23
|
-
/** 唯一标识 */
|
|
24
5
|
key: string;
|
|
25
|
-
/** 显示图标(emoji 或文本) */
|
|
26
6
|
icon: string;
|
|
27
|
-
/** 提示文本 */
|
|
28
7
|
tooltip: string;
|
|
29
|
-
/** 是否禁用 */
|
|
30
8
|
disabled?: boolean;
|
|
31
|
-
/** 是否激活状态 */
|
|
32
9
|
active?: boolean;
|
|
33
|
-
/** 点击回调 */
|
|
34
10
|
onClick: () => void;
|
|
35
|
-
/** 是否隐藏 */
|
|
36
11
|
hidden?: boolean;
|
|
37
|
-
/** 分隔符(在按钮前添加) */
|
|
38
12
|
dividerBefore?: boolean;
|
|
39
13
|
}
|
|
40
|
-
/** EditorToolbar Props */
|
|
41
14
|
export interface EditorToolbarProps {
|
|
42
|
-
/** 是否可撤销 */
|
|
43
15
|
canUndo?: boolean;
|
|
44
|
-
/** 是否可重做 */
|
|
45
16
|
canRedo?: boolean;
|
|
46
|
-
/** 是否全屏 */
|
|
47
17
|
isFullscreen?: boolean;
|
|
48
|
-
/** 是否调试模式 */
|
|
49
18
|
isDebugMode?: boolean;
|
|
50
|
-
/** 当前缩放比例 */
|
|
51
19
|
zoomLevel?: number;
|
|
52
|
-
/** 是否有选中元素 */
|
|
53
20
|
hasSelection?: boolean;
|
|
54
|
-
/** 保存 */
|
|
55
21
|
onSave?: () => void;
|
|
56
|
-
/** 撤销 */
|
|
57
22
|
onUndo?: () => void;
|
|
58
|
-
/** 重做 */
|
|
59
23
|
onRedo?: () => void;
|
|
60
|
-
/** 删除选中 */
|
|
61
24
|
onDelete?: () => void;
|
|
62
|
-
/** 放大 */
|
|
63
25
|
onZoomIn?: () => void;
|
|
64
|
-
/** 缩小 */
|
|
65
26
|
onZoomOut?: () => void;
|
|
66
|
-
|
|
27
|
+
onZoomChange?: (zoomLevel: number) => void;
|
|
67
28
|
onFitView?: () => void;
|
|
68
|
-
/** 重置缩放 */
|
|
69
29
|
onResetZoom?: () => void;
|
|
70
|
-
/** 全屏切换 */
|
|
71
30
|
onFullscreen?: () => void;
|
|
72
|
-
/** 调试模式切换 */
|
|
73
31
|
onToggleDebug?: () => void;
|
|
74
|
-
/** 查看数据 */
|
|
75
32
|
onViewData?: () => void;
|
|
76
|
-
/** 设置 */
|
|
77
33
|
onSettings?: () => void;
|
|
78
|
-
/** 校验 */
|
|
79
34
|
onValidate?: () => void;
|
|
80
|
-
/** 新建规则链 */
|
|
81
35
|
onNew?: () => void;
|
|
82
|
-
/** 导入 */
|
|
83
36
|
onImport?: () => void;
|
|
84
|
-
/** 导出 */
|
|
85
37
|
onExport?: () => void;
|
|
86
|
-
|
|
38
|
+
onAutoLayout?: () => void;
|
|
87
39
|
extraButtons?: ToolbarButton[];
|
|
88
|
-
/** 隐藏的按钮 key 列表 */
|
|
89
40
|
hiddenButtons?: string[];
|
|
90
|
-
/** 规则链名称(显示在工具栏中央) */
|
|
91
41
|
chainName?: string;
|
|
92
|
-
/** Current locale. Defaults to zh-CN. */
|
|
93
42
|
locale?: string;
|
|
94
|
-
/** Extra locale messages merged into the selected locale. */
|
|
95
43
|
messages?: LocaleMessages;
|
|
96
|
-
/** Host-provided translation function. */
|
|
97
44
|
t?: EditorTranslate;
|
|
98
45
|
}
|
|
99
|
-
/**
|
|
100
|
-
* EditorToolbar 组件
|
|
101
|
-
*
|
|
102
|
-
* 纯 React 实现的编辑器工具栏,无 antd 依赖。
|
|
103
|
-
* 提供完整的编辑器操作按钮。
|
|
104
|
-
*/
|
|
105
46
|
declare const EditorToolbar: React.FC<EditorToolbarProps>;
|
|
106
47
|
export default EditorToolbar;
|
|
107
|
-
//# sourceMappingURL=EditorToolbar.d.ts.map
|
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file ImportExportDialog.tsx
|
|
3
|
-
* @description 规则链导入/导出对话框
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 导出当前规则链为 JSON 文件
|
|
7
|
-
* - 从 JSON 文件导入规则链
|
|
8
|
-
* - 支持拖拽上传文件
|
|
9
|
-
* - JSON 格式验证和预览
|
|
10
|
-
* - 支持复制导出内容到剪贴板
|
|
11
|
-
*
|
|
12
|
-
* 设计:
|
|
13
|
-
* - 纯 React + CSS,无外部 UI 库依赖
|
|
14
|
-
* - rge- 前缀 CSS 类名避免冲突
|
|
15
|
-
* - 通过回调 props 传递导入数据
|
|
16
|
-
*/
|
|
17
1
|
import React from 'react';
|
|
18
|
-
import type
|
|
2
|
+
import { type LocaleMessages } from '@huanban/rulego-editor-core';
|
|
19
3
|
import type { EditorTranslate } from '../i18n';
|
|
20
|
-
/** 导入/导出模式 */
|
|
21
4
|
export type ImportExportMode = 'import' | 'export';
|
|
22
|
-
/** ImportExportDialog 属性 */
|
|
23
5
|
export interface ImportExportDialogProps {
|
|
24
|
-
/** 初始模式,默认 'export' */
|
|
25
6
|
mode?: ImportExportMode;
|
|
26
|
-
/** 当前规则链数据 (导出用) */
|
|
27
7
|
data?: any;
|
|
28
|
-
/** 规则链名称 (用于文件名) */
|
|
29
8
|
chainName?: string;
|
|
30
|
-
/** 导入成功回调,参数为解析后的 JSON 数据 */
|
|
31
9
|
onImport?: (data: any) => void;
|
|
32
|
-
/** 关闭对话框回调 */
|
|
33
10
|
onClose: () => void;
|
|
34
|
-
/** 通知回调 */
|
|
35
11
|
onNotify?: (type: 'success' | 'error' | 'info', message: string) => void;
|
|
36
|
-
/** Current locale. Defaults to zh-CN. */
|
|
37
12
|
locale?: string;
|
|
38
|
-
/** Extra locale messages merged into the selected locale. */
|
|
39
13
|
messages?: LocaleMessages;
|
|
40
|
-
/** Host-provided translation function. */
|
|
41
14
|
t?: EditorTranslate;
|
|
42
15
|
}
|
|
43
|
-
/**
|
|
44
|
-
* ImportExportDialog 组件
|
|
45
|
-
*
|
|
46
|
-
* @description
|
|
47
|
-
* 提供规则链的导入和导出功能。导出时展示格式化的 JSON,
|
|
48
|
-
* 支持复制到剪贴板和下载为文件。导入时支持文件选择和拖拽上传,
|
|
49
|
-
* 自动验证 JSON 格式并预览内容。
|
|
50
|
-
*/
|
|
51
16
|
declare const ImportExportDialog: React.FC<ImportExportDialogProps>;
|
|
52
17
|
export default ImportExportDialog;
|
|
53
|
-
//# sourceMappingURL=ImportExportDialog.d.ts.map
|
|
@@ -1,45 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file LogViewer.tsx
|
|
3
|
-
* @description 支持虚拟滚动的高性能调试日志面板
|
|
4
|
-
*/
|
|
5
1
|
import React from 'react';
|
|
6
2
|
import type { LocaleMessages } from '@huanban/rulego-editor-core';
|
|
7
3
|
import type { EditorTranslate } from '../i18n';
|
|
8
|
-
/**
|
|
9
|
-
* 日志实体接口定义
|
|
10
|
-
* @interface LogEntry
|
|
11
|
-
*/
|
|
12
4
|
export interface LogEntry {
|
|
13
|
-
/** 唯一日志标识 UUID */
|
|
14
5
|
id: string;
|
|
15
|
-
/** 产生日志的毫秒时间戳 */
|
|
16
6
|
timestamp: number;
|
|
17
|
-
/** 日志级别 */
|
|
18
7
|
level: 'info' | 'warn' | 'error' | 'debug';
|
|
19
|
-
/** 实际文本内容 */
|
|
20
8
|
message: string;
|
|
21
9
|
}
|
|
22
|
-
/**
|
|
23
|
-
* 日志面板组件属性
|
|
24
|
-
* @interface LogViewerProps
|
|
25
|
-
*/
|
|
26
10
|
export interface LogViewerProps {
|
|
27
|
-
/** 从外层 WebSocket 接收并维护的日志数组 */
|
|
28
11
|
logs: LogEntry[];
|
|
29
|
-
/** Current locale. Defaults to zh-CN. */
|
|
30
12
|
locale?: string;
|
|
31
|
-
/** Extra locale messages merged into the selected locale. */
|
|
32
13
|
messages?: LocaleMessages;
|
|
33
|
-
/** Host-provided translation function. */
|
|
34
14
|
t?: EditorTranslate;
|
|
35
15
|
}
|
|
36
|
-
/**
|
|
37
|
-
* 高性能调试日志控制台 (LogViewer)
|
|
38
|
-
*
|
|
39
|
-
* @component
|
|
40
|
-
* @description 专为高并发/海量报文调试设计的面板。
|
|
41
|
-
* 考虑到不引入额外的庞大虚拟列表库(如 react-window),此处实现了基础的数组切片限流策略。
|
|
42
|
-
* 始终保证 DOM 树内仅渲染最新 200 条节点,彻底根除由于 `DOM Nodes` 暴增导致的浏览器卡顿问题。
|
|
43
|
-
*/
|
|
44
16
|
export declare const LogViewer: React.FC<LogViewerProps>;
|
|
45
|
-
//# sourceMappingURL=LogViewer.d.ts.map
|