@huanban/rulego-editor-react 1.1.2 → 1.1.4

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.
@@ -17,7 +17,7 @@
17
17
  * @see ComponentDefinition — 组件定义类型
18
18
  */
19
19
  import React from 'react';
20
- import type { LocaleMessages } from '@huanban/rulego-editor-core';
20
+ import { type LocaleMessages } from '@huanban/rulego-editor-core';
21
21
  import type { EditorTranslate } from '../i18n';
22
22
  /** 组件字段定义(用于属性编辑面板) */
23
23
  export interface ComponentField {
@@ -73,6 +73,8 @@ export interface ComponentSidebarProps {
73
73
  messages?: LocaleMessages;
74
74
  /** Host-provided translation function. */
75
75
  t?: EditorTranslate;
76
+ /** Icon theme. Defaults to default; accepts default/dark/nature/elegant/tech/modern. */
77
+ theme?: string;
76
78
  }
77
79
  /**
78
80
  * ComponentSidebar 组件
@@ -34,7 +34,7 @@ export interface EdgePropertyDrawerProps {
34
34
  visible: boolean;
35
35
  /** 边模型数据 */
36
36
  edgeModel: EdgeModel | null;
37
- /** Source-node relation type candidates. Aligns with official sourceNodeView.relationTypes. */
37
+ /** Source-node relation type candidates. Aligns with sourceNodeView.relationTypes. */
38
38
  relationTypes?: Array<string | {
39
39
  value: string;
40
40
  label?: string;
@@ -12,7 +12,7 @@
12
12
  * @see ComponentField — 字段定义类型
13
13
  */
14
14
  import React from 'react';
15
- import type { LocaleMessages } from '@huanban/rulego-editor-core';
15
+ import type { AiProviderOption, LocaleMessages } from '@huanban/rulego-editor-core';
16
16
  import type { EditorTranslate } from '../i18n';
17
17
  export type FieldOption = string | {
18
18
  label?: string;
@@ -75,7 +75,7 @@ export interface FieldDef {
75
75
  desc?: string;
76
76
  /** 默认值 */
77
77
  defaultValue?: unknown;
78
- /** 官方 component 协议 */
78
+ /** component 协议 */
79
79
  component?: {
80
80
  type?: string;
81
81
  caseType?: string;
@@ -90,10 +90,12 @@ export interface FieldDef {
90
90
  };
91
91
  /** 兼容旧字段选项协议 */
92
92
  options?: FieldOption[];
93
- /** 嵌套字段定义,官方 struct/table/switch 类字段会使用 */
93
+ /** 嵌套字段定义,struct/table/switch 类字段会使用 */
94
94
  fields?: FieldDef[];
95
- /** 官方 ref 协议:primary/shared 字段会随连接模式联动隐藏 */
95
+ /** ref 协议:primary/shared 字段会随连接模式联动隐藏 */
96
96
  ref?: string;
97
+ /** providerType 协议:embedding 字段使用 embedding provider 预设 */
98
+ providerType?: string;
97
99
  /** 是否禁用 */
98
100
  disabled?: boolean;
99
101
  /** 校验规则 */
@@ -149,9 +151,9 @@ export interface NodePropertyDrawerProps {
149
151
  messages?: LocaleMessages;
150
152
  /** Host-provided translation function. */
151
153
  t?: EditorTranslate;
152
- /** Current graph nodes for official component.source=nodes hydration. */
154
+ /** Current graph nodes for component.source=nodes hydration. */
153
155
  graphNodes?: GraphNodeOptionSource[];
154
- /** Rule chain list for official component.source=ruleChains hydration. */
156
+ /** Rule chain list for component.source=ruleChains hydration. */
155
157
  ruleItems?: RuleChainOptionSource[];
156
158
  /** Current rule chain used to avoid selecting itself in rule-chain fields. */
157
159
  currentRuleChain?: RuleChainOptionSource | null;
@@ -163,6 +165,28 @@ export interface NodePropertyDrawerProps {
163
165
  rulePageSize?: number;
164
166
  /** Host override for remote rule-chain selector loading. */
165
167
  fetchRuleChains?: (params: RuleChainFetchParams) => Promise<RuleChainFetchResult | RuleChainOptionSource[] | unknown>;
168
+ /** Components API payload, used for builtins["ai/tools"].tools and skillPath parity. */
169
+ componentsPayload?: Record<string, unknown>;
170
+ /** Legacy alias for componentsPayload. */
171
+ componentPayload?: Record<string, unknown>;
172
+ /** Host-provided builtin AI tools. Accepts the original /components builtins["ai/tools"].tools rows. */
173
+ builtinTools?: unknown[];
174
+ /** Official editorOptions.tools alias. */
175
+ tools?: unknown[];
176
+ /** Global skill directory returned by /components. */
177
+ skillPath?: string;
178
+ /** Host override for loading /components payload or builtin tools. */
179
+ fetchBuiltinTools?: (params: {
180
+ signal?: AbortSignal;
181
+ }) => Promise<unknown>;
182
+ /** Open the AI assistant or skill manager from a builtin skill tool helper. */
183
+ onOpenAiAssistant?: (options: {
184
+ section?: string;
185
+ }) => void;
186
+ /** AI provider presets, aligned with editorOptions.aiProviders. */
187
+ aiProviders?: AiProviderOption[];
188
+ /** Embedding provider presets, aligned with editorOptions.aiEmbeddingProviders. */
189
+ aiEmbeddingProviders?: AiProviderOption[];
166
190
  }
167
191
  /**
168
192
  * NodePropertyDrawer 组件
@@ -65,7 +65,7 @@ export interface RuleGoEditorProps {
65
65
  customFetch?: (url: string, init?: RequestInit) => Promise<Response>;
66
66
  /** 初始规则链数据 */
67
67
  data?: RuleChainData | null;
68
- /** 初始组件列表,支持数组或官方 /api/v1/components 分段返回 */
68
+ /** 初始组件列表,支持数组或 /api/v1/components 分段返回 */
69
69
  components?: RawComponentData;
70
70
  /** 是否显示工具栏, 默认 true */
71
71
  showToolbar?: boolean;
@@ -111,6 +111,8 @@ export interface RuleGoEditorProps {
111
111
  showDebugTab?: boolean;
112
112
  /** 语言设置, 默认 'zh_cn' */
113
113
  locale?: string;
114
+ /** 初始/受控主题;支持 default/dark/nature/elegant/tech/modern,兼容 light/blue */
115
+ theme?: string;
114
116
  /** LogicFlow 额外配置 (与默认配置合并) */
115
117
  lfOptions?: Record<string, unknown>;
116
118
  /** LogicFlow 插件数组 */
@@ -211,6 +213,8 @@ export interface RuleGoEditorRef {
211
213
  openAiAssistant: (options?: AIAssistantOpenOptions) => void;
212
214
  /** 关闭 AI 助手侧栏 */
213
215
  closeAiAssistant: () => void;
216
+ /** 切换编辑器主题 */
217
+ setTheme: (theme: string) => void;
214
218
  }
215
219
  /**
216
220
  * RuleGoEditor — React 封装组件