@huanban/rulego-editor-core 1.3.18 → 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 +153 -2
- package/assets/images/discovery-dark.svg +1 -0
- package/assets/images/discovery.svg +1 -0
- package/assets/images/nacos-dark.svg +1 -0
- package/assets/images/nacos.svg +1 -0
- package/assets/theme-icons/ant-blue/discovery-dark.svg +1 -0
- package/assets/theme-icons/ant-blue/discovery.svg +1 -0
- package/assets/theme-icons/ant-blue/nacos-dark.svg +1 -0
- package/assets/theme-icons/ant-blue/nacos.svg +1 -0
- package/assets/theme-icons/apple/discovery-dark.svg +1 -0
- package/assets/theme-icons/apple/discovery.svg +1 -0
- package/assets/theme-icons/apple/nacos-dark.svg +1 -0
- package/assets/theme-icons/apple/nacos.svg +1 -0
- package/assets/theme-icons/colorful/discovery-dark.svg +1 -0
- package/assets/theme-icons/colorful/discovery.svg +1 -0
- package/assets/theme-icons/colorful/nacos-dark.svg +1 -0
- package/assets/theme-icons/colorful/nacos.svg +1 -0
- package/assets/theme-icons/dark/discovery-dark.svg +1 -0
- package/assets/theme-icons/dark/discovery.svg +1 -0
- package/assets/theme-icons/dark/nacos-dark.svg +1 -0
- package/assets/theme-icons/dark/nacos.svg +1 -0
- package/assets/theme-icons/default/discovery-dark.svg +1 -0
- package/assets/theme-icons/default/discovery.svg +1 -0
- package/assets/theme-icons/default/nacos-dark.svg +1 -0
- package/assets/theme-icons/default/nacos.svg +1 -0
- package/assets/theme-icons/elegant/discovery-dark.svg +1 -0
- package/assets/theme-icons/elegant/discovery.svg +1 -0
- package/assets/theme-icons/elegant/nacos-dark.svg +1 -0
- package/assets/theme-icons/elegant/nacos.svg +1 -0
- package/assets/theme-icons/github/discovery-dark.svg +1 -0
- package/assets/theme-icons/github/discovery.svg +1 -0
- package/assets/theme-icons/github/nacos-dark.svg +1 -0
- package/assets/theme-icons/github/nacos.svg +1 -0
- package/assets/theme-icons/icon-theme-manifest.json +30 -14
- package/assets/theme-icons/icon-theme-overview.svg +1599 -1287
- package/assets/theme-icons/material/discovery-dark.svg +1 -0
- package/assets/theme-icons/material/discovery.svg +1 -0
- package/assets/theme-icons/material/nacos-dark.svg +1 -0
- package/assets/theme-icons/material/nacos.svg +1 -0
- package/assets/theme-icons/modern/discovery-dark.svg +1 -0
- package/assets/theme-icons/modern/discovery.svg +1 -0
- package/assets/theme-icons/modern/nacos-dark.svg +1 -0
- package/assets/theme-icons/modern/nacos.svg +1 -0
- package/assets/theme-icons/nature/discovery-dark.svg +1 -0
- package/assets/theme-icons/nature/discovery.svg +1 -0
- package/assets/theme-icons/nature/nacos-dark.svg +1 -0
- package/assets/theme-icons/nature/nacos.svg +1 -0
- package/assets/theme-icons/tailwind/discovery-dark.svg +1 -0
- package/assets/theme-icons/tailwind/discovery.svg +1 -0
- package/assets/theme-icons/tailwind/nacos-dark.svg +1 -0
- package/assets/theme-icons/tailwind/nacos.svg +1 -0
- package/assets/theme-icons/tech/discovery-dark.svg +1 -0
- package/assets/theme-icons/tech/discovery.svg +1 -0
- package/assets/theme-icons/tech/nacos-dark.svg +1 -0
- package/assets/theme-icons/tech/nacos.svg +1 -0
- package/assets/theme-icons/vscode/discovery-dark.svg +1 -0
- package/assets/theme-icons/vscode/discovery.svg +1 -0
- package/assets/theme-icons/vscode/nacos-dark.svg +1 -0
- package/assets/theme-icons/vscode/nacos.svg +1 -0
- package/dist/ai/copilot-markdown.d.ts +40 -0
- package/dist/ai/copilot-transport.d.ts +39 -0
- package/dist/api/AIManager.d.ts +5 -4
- package/dist/api/ApiProvider.d.ts +17 -69
- package/dist/api/ComponentCatalogCache.d.ts +27 -0
- package/dist/api/DebugSocketClient.d.ts +18 -25
- package/dist/api/RuleChainAPI.d.ts +24 -145
- package/dist/api/StreamParser.d.ts +0 -10
- package/dist/api/index.d.ts +4 -14
- package/dist/api/response-utils.d.ts +4 -22
- package/dist/api/types.d.ts +44 -179
- package/dist/chunks/editor-core-code-editor-CRki2wA_.js +512 -0
- package/dist/chunks/editor-core-default-components-BjF65lar.js +9448 -0
- package/dist/chunks/editor-core-dialogs-CkFLaC8Q.js +17176 -0
- package/dist/chunks/editor-core-icons-BqeFofNA.js +668 -0
- package/dist/chunks/editor-core-json-diff-RHsPeX-w.js +199 -0
- package/dist/chunks/editor-core-locales-i6o28vm2.js +4159 -0
- package/dist/chunks/editor-core-node-patches-BJTT3TuX.js +8060 -0
- package/dist/chunks/editor-core-node-views-BOaPVdmN.js +1288 -0
- package/dist/chunks/editor-core-property-drawers-lLsBIoCa.js +8035 -0
- package/dist/chunks/editor-core-standalone-CHXk3ukc.js +11270 -0
- package/dist/chunks/editor-core-styles-C1TbLgCK.js +8841 -0
- package/dist/chunks/vendor-logicflow-core-runtime-Cp6IBEjB.js +217 -0
- package/dist/chunks/vendor-logicflow-shared-C7YynLDn.js +4 -0
- package/dist/chunks/xlsx-BopDBbWb.js +24176 -0
- package/dist/core/ActionRegistry.d.ts +47 -0
- package/dist/core/AutoLayout.d.ts +1 -48
- package/dist/core/ComponentDocService.d.ts +28 -0
- package/dist/core/ComponentRegistry.d.ts +1 -125
- package/dist/core/DataAdapter.d.ts +4 -89
- package/dist/core/DiagnosticService.d.ts +15 -0
- package/dist/core/EditorCore.d.ts +22 -212
- package/dist/core/EditorWorkspace.d.ts +111 -0
- package/dist/core/EventBus.d.ts +0 -86
- package/dist/core/ExplorerTreeStore.d.ts +43 -0
- package/dist/core/FieldCapabilityRegistry.d.ts +16 -0
- package/dist/core/FieldChangeRegistry.d.ts +48 -0
- package/dist/core/HistoryManager.d.ts +0 -123
- package/dist/core/I18nManager.d.ts +0 -120
- package/dist/core/Optimizations.d.ts +0 -14
- package/dist/core/OptionSourceRegistry.d.ts +38 -0
- package/dist/core/RuleChainChatManager.d.ts +0 -37
- package/dist/core/RuleChainValidator.d.ts +0 -79
- package/dist/core/StateStore.d.ts +4 -140
- package/dist/core/ThemeManager.d.ts +0 -141
- package/dist/core/ValidationEngine.d.ts +0 -103
- package/dist/core/component-palette.d.ts +20 -0
- package/dist/core/component-payload.d.ts +0 -9
- package/dist/core/connection-status.d.ts +77 -0
- package/dist/core/context-menu-position.d.ts +27 -0
- package/dist/core/cron-schedule.d.ts +85 -0
- package/dist/core/debug-panel.d.ts +6 -0
- package/dist/core/editor-capabilities.d.ts +95 -0
- package/dist/core/editor-dock.d.ts +100 -0
- package/dist/core/editor-panel.d.ts +68 -0
- package/dist/core/explorer-tree.d.ts +27 -0
- package/dist/core/field-protocol.d.ts +32 -0
- package/dist/core/foundation-tokens.d.ts +38 -0
- package/dist/core/graph-operations.d.ts +34 -0
- package/dist/core/hover-tools.d.ts +26 -0
- package/dist/core/index.d.ts +68 -16
- package/dist/core/infer-run-input.d.ts +11 -0
- package/dist/core/key-value-editor.d.ts +6 -0
- package/dist/core/overlay-layers.d.ts +28 -0
- package/dist/core/recent-components.d.ts +51 -0
- package/dist/core/run-guard.d.ts +7 -0
- package/dist/core/runtime-field-dictionary.d.ts +68 -0
- package/dist/core/runtime-limits.d.ts +0 -5
- package/dist/core/save-conflict.d.ts +4 -0
- package/dist/core/server-status.d.ts +34 -0
- package/dist/core/simple-array.d.ts +4 -0
- package/dist/core/table-protocol.d.ts +36 -0
- package/dist/core/table-spreadsheet.d.ts +3 -0
- package/dist/core/test-cases.d.ts +54 -0
- package/dist/core/toolbar-icons.d.ts +4 -0
- package/dist/core/topology-rules.d.ts +17 -0
- package/dist/core/virtual-window.d.ts +20 -0
- package/dist/core/workspace-tab-actions.d.ts +13 -0
- package/dist/defaults/components.d.ts +0 -9
- package/dist/defaults/index.d.ts +0 -15
- package/dist/defaults/locale-en-US.d.ts +0 -24
- package/dist/defaults/locale-zh-CN.d.ts +0 -39
- package/dist/defaults/official-component-fallbacks.d.ts +0 -8
- package/dist/extensions/ClipboardExtension.d.ts +0 -23
- package/dist/extensions/KeyboardExtension.d.ts +0 -17
- package/dist/extensions/MenuExtension.d.ts +0 -23
- package/dist/iconRegistry.d.ts +0 -22
- package/dist/index.cjs +11320 -0
- package/dist/index.d.ts +25 -47
- package/dist/index.esm.js +1123 -99614
- package/dist/index.umd.js +3380 -1471
- package/dist/models/BaseNodeModel.d.ts +0 -32
- package/dist/models/index.d.ts +0 -1
- package/dist/nodes/AgentOrchestrationNode.d.ts +0 -24
- package/dist/nodes/GroupNode.d.ts +0 -38
- package/dist/nodes/HeadlessHtmlNode.d.ts +0 -16
- package/dist/nodes/SwitchNode.d.ts +0 -22
- package/dist/nodes/UnknownNodeModel.d.ts +0 -19
- package/dist/standalone/HuanbanRulegoEditor.d.ts +202 -401
- package/dist/standalone/ai-model-policy.d.ts +0 -1
- package/dist/standalone/ai-providers.d.ts +0 -1
- package/dist/standalone/auth-fetch.d.ts +2 -46
- package/dist/standalone/browser-assets.d.ts +0 -8
- package/dist/standalone/canvas-view.d.ts +6 -0
- package/dist/standalone/code-editor-language-loaders.d.ts +2 -0
- package/dist/standalone/code-editor-language-loaders.legacy.d.ts +7 -0
- package/dist/standalone/code-editor.d.ts +3 -87
- package/dist/standalone/connection-status-binding.d.ts +8 -0
- package/dist/standalone/custom-nodes.d.ts +0 -26
- package/dist/standalone/drawer-unsaved-guard.d.ts +2 -9
- package/dist/standalone/edge-label-quick-editor.d.ts +2 -0
- package/dist/standalone/editor-actions.d.ts +4 -0
- package/dist/standalone/editor-chain-info.d.ts +5 -38
- package/dist/standalone/editor-context-menu.d.ts +0 -21
- package/dist/standalone/editor-debug-ws.d.ts +37 -145
- package/dist/standalone/editor-delete.d.ts +0 -1
- package/dist/standalone/editor-dialogs.d.ts +16 -66
- package/dist/standalone/editor-events.d.ts +0 -27
- package/dist/standalone/editor-overlays.d.ts +14 -0
- package/dist/standalone/editor-property-drawers.d.ts +13 -71
- package/dist/standalone/editor-route-settings.d.ts +7 -55
- package/dist/standalone/editor-sidebar.d.ts +0 -18
- package/dist/standalone/editor-styles.d.ts +0 -11
- package/dist/standalone/editor-toast.d.ts +1 -2
- package/dist/standalone/editor-toolbar.d.ts +5 -80
- package/dist/standalone/editor-tour.d.ts +7 -0
- package/dist/standalone/editor-trace-overlay.d.ts +0 -5
- package/dist/standalone/full-json-dialog.d.ts +5 -1
- package/dist/standalone/group-node.d.ts +1 -51
- package/dist/standalone/icon-utils.d.ts +0 -20
- package/dist/standalone/index.d.ts +10 -7
- package/dist/standalone/json-diff.d.ts +0 -1
- package/dist/standalone/keyboard-events.d.ts +0 -1
- package/dist/standalone/layout-scheduler.d.ts +0 -6
- package/dist/standalone/lifecycle.d.ts +0 -5
- package/dist/standalone/logger.d.ts +0 -32
- package/dist/standalone/models-dev-catalog.d.ts +0 -1
- package/dist/standalone/node-copy.d.ts +7 -4
- package/dist/standalone/node-definitions.d.ts +0 -63
- package/dist/standalone/node-identity.d.ts +0 -1
- package/dist/standalone/node-theme.d.ts +8 -0
- package/dist/standalone/node-views-data.d.ts +0 -20
- package/dist/standalone/official-node-view-patches.d.ts +1 -14
- package/dist/standalone/outline-style.d.ts +7 -0
- package/dist/standalone/run-history-format.d.ts +0 -1
- package/dist/standalone/security-utils.d.ts +1 -5
- package/dist/standalone/shared-node-manager.d.ts +31 -0
- package/dist/standalone/themes.d.ts +0 -48
- package/dist/tools/tool-editor.d.ts +0 -1
- package/dist/types/component.d.ts +105 -87
- package/dist/types/editor.d.ts +16 -169
- package/dist/types/events.d.ts +30 -107
- package/dist/types/index.d.ts +3 -10
- package/dist/types/rule-chain.d.ts +0 -90
- package/dist/utils/GraphUtils.d.ts +0 -10
- package/dist/utils/helpers.d.ts +0 -80
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/pinyin-search.d.ts +0 -57
- package/dist/utils/relation-utils.d.ts +0 -1
- package/dist/utils/textUtils.d.ts +0 -12
- package/dist/version.d.ts +2 -3
- package/dist/xlsx-qn1xoUuv.cjs +105 -0
- package/package.json +19 -5
- package/vite-chunks.d.ts +11 -0
- package/vite-chunks.mjs +120 -0
- package/dist/index.cjs.js +0 -9515
|
@@ -1,141 +1,51 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file rule-chain.ts
|
|
3
|
-
* @description RuleGo 规则链数据格式类型定义
|
|
4
|
-
*
|
|
5
|
-
* 对应 RuleGo 后端的 JSON 数据结构,用于前后端数据交互。
|
|
6
|
-
* 包含规则链元信息、节点定义、连接定义等完整类型。
|
|
7
|
-
*
|
|
8
|
-
* 数据结构需与当前后端 JSON 协议保持一致。
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* 节点在画布上的布局信息
|
|
12
|
-
* 存储于 additionalInfo 中,用于还原节点位置
|
|
13
|
-
*/
|
|
14
1
|
export interface LayoutInfo {
|
|
15
|
-
/** 节点 X 坐标 */
|
|
16
2
|
layoutX: number;
|
|
17
|
-
/** 节点 Y 坐标 */
|
|
18
3
|
layoutY: number;
|
|
19
4
|
}
|
|
20
|
-
/**
|
|
21
|
-
* 节点附加信息
|
|
22
|
-
* 用于存储与业务逻辑无关的元数据(如布局、描述、自定义属性)
|
|
23
|
-
*/
|
|
24
5
|
export interface AdditionalInfo extends LayoutInfo {
|
|
25
|
-
/** 节点描述 */
|
|
26
6
|
description?: string;
|
|
27
|
-
/** 其他自定义属性 */
|
|
28
7
|
[key: string]: unknown;
|
|
29
8
|
}
|
|
30
|
-
/**
|
|
31
|
-
* 规则链头部配置
|
|
32
|
-
* 定义规则链的基本标识信息
|
|
33
|
-
*/
|
|
34
9
|
export interface RuleChainConfig {
|
|
35
|
-
/** 规则链唯一 ID (UUID 格式) */
|
|
36
10
|
id: string;
|
|
37
|
-
/** 规则链名称 */
|
|
38
11
|
name?: string;
|
|
39
|
-
/** 是否为根规则链 */
|
|
40
12
|
root?: boolean;
|
|
41
|
-
/** 是否启用调试模式 */
|
|
42
13
|
debugMode?: boolean;
|
|
43
|
-
/** 附加配置 */
|
|
44
14
|
additionalInfo?: Record<string, unknown>;
|
|
45
|
-
/** 是否禁用 (disabled=true 表示停用中) */
|
|
46
15
|
disabled?: boolean;
|
|
47
|
-
/** 创建时间 (ISO 8601) */
|
|
48
16
|
createTime?: string;
|
|
49
|
-
/** 更新时间 (ISO 8601) */
|
|
50
17
|
updateTime?: string;
|
|
51
18
|
}
|
|
52
|
-
/**
|
|
53
|
-
* 规则链中的节点定义
|
|
54
|
-
* 对应 metadata.nodes[] 中的每一项
|
|
55
|
-
*/
|
|
56
19
|
export interface RuleNodeConfig {
|
|
57
|
-
/** 节点唯一 ID (格式: node_1, node_2, ...) */
|
|
58
20
|
id: string;
|
|
59
|
-
/** 节点类型 (对应注册的组件类型, 如 jsFilter, restApiCall 等) */
|
|
60
21
|
type: string;
|
|
61
|
-
/** 节点显示名称 */
|
|
62
22
|
name: string;
|
|
63
|
-
/** 节点配置参数 (JSON 格式, 根据节点类型不同有不同结构) */
|
|
64
23
|
configuration?: Record<string, unknown>;
|
|
65
|
-
/** 节点附加信息 (包含布局位置等) */
|
|
66
24
|
additionalInfo?: AdditionalInfo;
|
|
67
|
-
/** 是否启用调试 */
|
|
68
25
|
debugMode?: boolean;
|
|
69
26
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 节点间的连接定义
|
|
72
|
-
* 对应 metadata.connections[] 中的每一项
|
|
73
|
-
*/
|
|
74
27
|
export interface RuleConnectionConfig {
|
|
75
|
-
/** 源节点 ID */
|
|
76
28
|
fromId: string;
|
|
77
|
-
/** 目标节点 ID */
|
|
78
29
|
toId: string;
|
|
79
|
-
/** 关系类型 (如 True, False, Success, Failure) */
|
|
80
30
|
type: string;
|
|
81
31
|
}
|
|
82
|
-
/**
|
|
83
|
-
* 端点 (Endpoint) 节点定义
|
|
84
|
-
* 对应 metadata.endpoints[] 中的每一项
|
|
85
|
-
* 端点是规则链的输入/输出接口 (如 HTTP、MQTT、Cron 等)
|
|
86
|
-
*/
|
|
87
32
|
export interface RuleEndpointConfig {
|
|
88
|
-
/** 端点节点 ID (格式: node_N) */
|
|
89
33
|
id: string;
|
|
90
|
-
/** 端点类型 (如 endpoint/http, endpoint/mqtt) */
|
|
91
34
|
type: string;
|
|
92
|
-
/** 端点显示名称 */
|
|
93
35
|
name: string;
|
|
94
|
-
/** 端点配置参数 */
|
|
95
36
|
configuration?: Record<string, unknown>;
|
|
96
|
-
/** 附加信息 (包含布局位置等) */
|
|
97
37
|
additionalInfo?: AdditionalInfo;
|
|
98
|
-
/** 是否启用调试 */
|
|
99
38
|
debugMode?: boolean;
|
|
100
|
-
/** 路由配置 (HTTP 端点特有) */
|
|
101
39
|
routers?: unknown[];
|
|
102
|
-
/** 处理器列表 */
|
|
103
40
|
processors?: unknown[] | null;
|
|
104
41
|
}
|
|
105
|
-
/**
|
|
106
|
-
* 规则链元数据
|
|
107
|
-
* 包含所有节点和连接信息
|
|
108
|
-
*/
|
|
109
42
|
export interface RuleChainMetadata {
|
|
110
|
-
/** 节点列表 */
|
|
111
43
|
nodes: RuleNodeConfig[];
|
|
112
|
-
/** 连接列表 */
|
|
113
44
|
connections: RuleConnectionConfig[];
|
|
114
|
-
/** 端点列表 (输入/输出接口节点) */
|
|
115
45
|
endpoints?: RuleEndpointConfig[];
|
|
116
|
-
/** 第一个节点的索引 (指向 nodes 数组中的下标) */
|
|
117
46
|
firstNodeIndex?: number;
|
|
118
47
|
}
|
|
119
|
-
/**
|
|
120
|
-
* 完整的规则链数据结构
|
|
121
|
-
* 用于前后端数据交互的顶层结构
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```json
|
|
125
|
-
* {
|
|
126
|
-
* "ruleChain": { "id": "xxx", "name": "test" },
|
|
127
|
-
* "metadata": {
|
|
128
|
-
* "nodes": [...],
|
|
129
|
-
* "connections": [...],
|
|
130
|
-
* "firstNodeIndex": 0
|
|
131
|
-
* }
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
48
|
export interface RuleChainData {
|
|
136
|
-
/** 规则链头部配置 */
|
|
137
49
|
ruleChain: RuleChainConfig;
|
|
138
|
-
/** 规则链元数据 (节点和连接) */
|
|
139
50
|
metadata: RuleChainMetadata;
|
|
140
51
|
}
|
|
141
|
-
//# sourceMappingURL=rule-chain.d.ts.map
|
|
@@ -3,22 +3,12 @@ export interface GraphData {
|
|
|
3
3
|
edges: any[];
|
|
4
4
|
}
|
|
5
5
|
export declare class GraphUtils {
|
|
6
|
-
/**
|
|
7
|
-
* 洗白并重新分配图数据中的 ID,避免复制粘贴时与现有图产生 ID 冲突
|
|
8
|
-
* @param data 要处理的图数据(剪贴板中读取的原始数据)
|
|
9
|
-
* @param counters 引用计数器
|
|
10
|
-
* @returns 洗白后的安全图数据
|
|
11
|
-
*/
|
|
12
6
|
static sanitizeGraphData(data: GraphData, counters: {
|
|
13
7
|
nodeCount: number;
|
|
14
8
|
edgeCount: number;
|
|
15
9
|
}): GraphData;
|
|
16
|
-
/**
|
|
17
|
-
* 刷新整个画布节点的全局计数器
|
|
18
|
-
*/
|
|
19
10
|
static refreshCounters(data: GraphData, counters: {
|
|
20
11
|
nodeCount: number;
|
|
21
12
|
edgeCount: number;
|
|
22
13
|
}): void;
|
|
23
14
|
}
|
|
24
|
-
//# sourceMappingURL=GraphUtils.d.ts.map
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,100 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file utils/helpers.ts
|
|
3
|
-
* @description 通用工具函数
|
|
4
|
-
*
|
|
5
|
-
* 从原版 util.js 移植的功能函数, 去除 Vue 依赖。
|
|
6
|
-
* 包含:
|
|
7
|
-
* - 文本宽度计算
|
|
8
|
-
* - 节点/边查找
|
|
9
|
-
* - 节点 ID 序号提取
|
|
10
|
-
* - UUID 生成
|
|
11
|
-
*
|
|
12
|
-
* @see 原版: src/components/utils/util.js
|
|
13
|
-
*/
|
|
14
1
|
import type { ComponentDefinition, ComponentGroup, RawComponentData } from '../types/component';
|
|
15
|
-
/**
|
|
16
|
-
* 从节点数组中根据 ID 查找节点
|
|
17
|
-
*
|
|
18
|
-
* @param nodes - 节点数组
|
|
19
|
-
* @param id - 目标节点 ID
|
|
20
|
-
* @returns 找到的节点, 未找到返回 undefined
|
|
21
|
-
*/
|
|
22
2
|
export declare function getNodeByID<T extends {
|
|
23
3
|
id: string;
|
|
24
4
|
}>(nodes: T[], id: string): T | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* 从边数组中根据源/目标节点 ID 查找边
|
|
27
|
-
*
|
|
28
|
-
* @param edges - 边数组
|
|
29
|
-
* @param sourceNodeId - 源节点 ID
|
|
30
|
-
* @param targetNodeId - 目标节点 ID
|
|
31
|
-
* @returns 找到的边, 未找到返回 undefined
|
|
32
|
-
*/
|
|
33
5
|
export declare function getEdgeBySourceNodeIdAndTargetNodeId<T extends {
|
|
34
6
|
sourceNodeId: string;
|
|
35
7
|
targetNodeId: string;
|
|
36
8
|
}>(edges: T[], sourceNodeId: string, targetNodeId: string): T | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* 从节点 ID 中提取序号
|
|
39
|
-
*
|
|
40
|
-
* 节点 ID 格式: node_1, node_23 等
|
|
41
|
-
* 返回数字部分, 如果格式不匹配返回 0
|
|
42
|
-
*
|
|
43
|
-
* @param nodeId - 节点 ID
|
|
44
|
-
* @returns 序号数字
|
|
45
|
-
*/
|
|
46
9
|
export declare function getNodeSeq(nodeId: string): number;
|
|
47
|
-
/**
|
|
48
|
-
* 计算字符串的字节长度 (中文算 2, 英文算 1)
|
|
49
|
-
* 用于估算节点文本的显示宽度
|
|
50
|
-
*
|
|
51
|
-
* @param str - 输入字符串
|
|
52
|
-
* @returns 字节长度
|
|
53
|
-
*/
|
|
54
10
|
export declare function getBytesLength(str: string): number;
|
|
55
|
-
/**
|
|
56
|
-
* 生成 UUID v4
|
|
57
|
-
*
|
|
58
|
-
* 如果浏览器支持 crypto.randomUUID() 则优先使用,
|
|
59
|
-
* 否则使用 Math.random() 回退方案。
|
|
60
|
-
*
|
|
61
|
-
* @returns UUID 字符串
|
|
62
|
-
*/
|
|
63
11
|
export declare function generateUUID(): string;
|
|
64
|
-
/**
|
|
65
|
-
* 将后端 API 返回的原始组件数据转换为按分类分组的格式
|
|
66
|
-
*
|
|
67
|
-
* 对应原版 util.js 中的 adapterComponents 函数。
|
|
68
|
-
* 按 category 字段分组, 并附加分类颜色和标签信息。
|
|
69
|
-
*
|
|
70
|
-
* @param rawData - 后端返回的原始组件列表
|
|
71
|
-
* @param categoryConfig - 自定义分类配置 (可选)
|
|
72
|
-
* @returns 分组后的组件列表
|
|
73
|
-
*/
|
|
74
12
|
export declare function adapterComponents(rawData: RawComponentData, categoryConfig?: Record<string, {
|
|
75
13
|
label: string;
|
|
76
14
|
color: string;
|
|
77
15
|
}>): ComponentGroup[];
|
|
78
|
-
/**
|
|
79
|
-
* 将分组后的组件列表转换为扁平的 type => definition 映射
|
|
80
|
-
*
|
|
81
|
-
* 对应原版的 toComponentList 函数。
|
|
82
|
-
*
|
|
83
|
-
* @param componentGroups - 分组后的组件列表
|
|
84
|
-
* @returns type => ComponentDefinition 的映射
|
|
85
|
-
*/
|
|
86
16
|
export declare function toComponentMap(componentGroups: ComponentGroup[]): Record<string, ComponentDefinition>;
|
|
87
|
-
/**
|
|
88
|
-
* 默认的 ID 生成器
|
|
89
|
-
*
|
|
90
|
-
* 基于计数器的简单 ID 生成 (对应原版 options.idGenerator)
|
|
91
|
-
*
|
|
92
|
-
* @param type - 元素类型 ('flow-link' 为边, 其他为节点)
|
|
93
|
-
* @param counters - 计数器引用 (nodeCount, edgeCount)
|
|
94
|
-
* @returns 生成的 ID 字符串
|
|
95
|
-
*/
|
|
96
17
|
export declare function defaultIdGenerator(type: string, counters: {
|
|
97
18
|
nodeCount: number;
|
|
98
19
|
edgeCount: number;
|
|
99
20
|
}): string;
|
|
100
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file utils/index.ts
|
|
3
|
-
* @description 工具函数统一导出入口
|
|
4
|
-
*/
|
|
5
1
|
export { getNodeByID, getEdgeBySourceNodeIdAndTargetNodeId, getNodeSeq, getBytesLength, generateUUID, adapterComponents, toComponentMap, defaultIdGenerator, } from './helpers';
|
|
6
2
|
export { GraphUtils, type GraphData } from './GraphUtils';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,60 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file utils/pinyin-search.ts
|
|
3
|
-
* @description 拼音搜索工具 — 支持中文拼音首字母和模糊匹配
|
|
4
|
-
*
|
|
5
|
-
* 功能:
|
|
6
|
-
* - 中文汉字 → 拼音首字母映射(轻量级,无需外部依赖)
|
|
7
|
-
* - 模糊匹配(支持关键字分词、首字母匹配)
|
|
8
|
-
* - 用于侧边栏组件搜索的增强搜索
|
|
9
|
-
*
|
|
10
|
-
* 使用方式:
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { fuzzyMatch } from './pinyin-search'
|
|
13
|
-
*
|
|
14
|
-
* fuzzyMatch('JS过滤器', 'jsgl') // true (首字母匹配)
|
|
15
|
-
* fuzzyMatch('JS过滤器', '过滤') // true (中文包含)
|
|
16
|
-
* fuzzyMatch('JS过滤器', 'guolv') // true (拼音匹配)
|
|
17
|
-
* fuzzyMatch('数据库', 'sjk') // true (首字母)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* 获取单个汉字的拼音首字母
|
|
22
|
-
*
|
|
23
|
-
* @param char - 单个汉字
|
|
24
|
-
* @returns 拼音首字母(小写),非汉字返回原字符
|
|
25
|
-
*/
|
|
26
1
|
export declare function getCharPinyin(char: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* 获取字符串的拼音首字母串
|
|
29
|
-
* 中文提取首字母,英文/数字保持原样
|
|
30
|
-
*
|
|
31
|
-
* @param str - 输入字符串
|
|
32
|
-
* @returns 拼音首字母组成的字符串(全小写)
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* getPinyinInitials('JS过滤器') // 'jsglq'
|
|
36
|
-
* getPinyinInitials('数据库') // 'sjk'
|
|
37
|
-
* getPinyinInitials('REST') // 'rest'
|
|
38
|
-
*/
|
|
39
2
|
export declare function getPinyinInitials(str: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* 模糊匹配函数 — 支持多种匹配策略
|
|
42
|
-
*
|
|
43
|
-
* 匹配策略(按优先级):
|
|
44
|
-
* 1. 精确包含匹配(原文包含关键字)
|
|
45
|
-
* 2. 拼音首字母匹配(关键字 = 拼音首字母缩写)
|
|
46
|
-
* 3. 分词匹配(关键字以空格分隔,每个词都需要匹配)
|
|
47
|
-
*
|
|
48
|
-
* @param text - 被搜索的文本
|
|
49
|
-
* @param keyword - 搜索关键字(已小写化)
|
|
50
|
-
* @returns 是否匹配
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* fuzzyMatch('JS过滤器', 'jsgl') // true — 拼音首字母
|
|
54
|
-
* fuzzyMatch('JS过滤器', '过滤') // true — 包含匹配
|
|
55
|
-
* fuzzyMatch('数据库', 'sjk') // true — 拼音首字母
|
|
56
|
-
* fuzzyMatch('REST API', 'rest') // true — 包含匹配
|
|
57
|
-
* fuzzyMatch('发邮件', 'fy') // true — 拼音首字母
|
|
58
|
-
*/
|
|
59
3
|
export declare function fuzzyMatch(text: string, keyword: string): boolean;
|
|
60
|
-
//# sourceMappingURL=pinyin-search.d.ts.map
|
|
@@ -10,4 +10,3 @@ export declare function getRelationOptionsForNode(nodeView: any, nodeModel: any)
|
|
|
10
10
|
export declare function resolveRelationLabel(value: unknown, nodeView?: any, nodeModel?: any): string;
|
|
11
11
|
export declare function parseRelationValues(value: unknown, splitToken?: string, relationOptions?: RelationOption[]): string[];
|
|
12
12
|
export declare function parseNodeIds(value: unknown): string[];
|
|
13
|
-
//# sourceMappingURL=relation-utils.d.ts.map
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file textUtils.ts
|
|
3
|
-
* @description 文本处理相关工具库
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* 获取字符串的字节长度
|
|
7
|
-
* 中文/全角字符算作 2 个长度,其他算 1 个
|
|
8
|
-
*
|
|
9
|
-
* @param str 输入字符串
|
|
10
|
-
* @returns 长度
|
|
11
|
-
*/
|
|
12
1
|
export declare function getBytesLength(str: string): number;
|
|
13
|
-
//# sourceMappingURL=textUtils.d.ts.map
|
package/dist/version.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare const HUANBAN_RULEGO_EDITOR_VERSION = "1.
|
|
2
|
-
export declare const EDITOR_VERSION = "1.
|
|
3
|
-
//# sourceMappingURL=version.d.ts.map
|
|
1
|
+
export declare const HUANBAN_RULEGO_EDITOR_VERSION = "1.4.0";
|
|
2
|
+
export declare const EDITOR_VERSION = "1.4.0";
|