@huanban/rulego-editor-core 1.3.9 → 1.3.11
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/dist/index.cjs.js +999 -741
- package/dist/index.esm.js +18700 -17202
- package/dist/index.umd.js +1071 -813
- package/dist/standalone/HuanbanRulegoEditor.d.ts +4 -4
- package/dist/standalone/drawer-unsaved-guard.d.ts +20 -0
- package/dist/standalone/json-diff.d.ts +45 -0
- package/dist/standalone/run-history-format.d.ts +19 -0
- package/package.json +4 -3
|
@@ -554,22 +554,22 @@ export declare class HuanbanRulegoEditor {
|
|
|
554
554
|
*/
|
|
555
555
|
private _autoLoadComponents;
|
|
556
556
|
/**
|
|
557
|
-
* 通用数据请求方法 —
|
|
557
|
+
* 通用数据请求方法 — 只从真实 API 加载,失败直接 reject。
|
|
558
558
|
*
|
|
559
559
|
* @param apiBase - API 基础地址 (如 'http://127.0.0.1:9090/api/v1')
|
|
560
560
|
* @param path - 请求路径 (如 '/components')
|
|
561
|
-
* @param
|
|
561
|
+
* @param legacyFallbackFile - 旧版本兼容参数,当前不再读取本地替代数据
|
|
562
562
|
* @param timeout - 超时毫秒数, 默认 5000
|
|
563
563
|
* @param headers - 可选的自定义请求头 (如认证 Token)
|
|
564
564
|
* @returns Promise<any> 解析后的 JSON 数据
|
|
565
565
|
*
|
|
566
566
|
* @example
|
|
567
567
|
* ```js
|
|
568
|
-
* HuanbanRulegoEditor.fetchData('http://api.example.com
|
|
568
|
+
* HuanbanRulegoEditor.fetchData('http://api.example.com/api/v1', '/components')
|
|
569
569
|
* .then(data => console.log(data))
|
|
570
570
|
* ```
|
|
571
571
|
*/
|
|
572
|
-
static fetchData(apiBase: string, path: string,
|
|
572
|
+
static fetchData(apiBase: string, path: string, legacyFallbackFile?: string, timeout?: number, headers?: Record<string, string>): Promise<unknown>;
|
|
573
573
|
/**
|
|
574
574
|
* 开启/关闭编辑器内部调试日志
|
|
575
575
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared guard for editable right-side drawers.
|
|
3
|
+
*
|
|
4
|
+
* The guard intentionally tracks only real form controls. Debug filters, search
|
|
5
|
+
* boxes, transient picker inputs, and tab state are excluded so browsing a
|
|
6
|
+
* drawer does not trigger an unsaved-change prompt.
|
|
7
|
+
*/
|
|
8
|
+
export type DrawerCloseDecision = 'save' | 'discard' | 'cancel';
|
|
9
|
+
export interface DrawerGuardI18nContext {
|
|
10
|
+
t(key: string, params?: Record<string, string>): string;
|
|
11
|
+
}
|
|
12
|
+
export interface DrawerSnapshotOptions {
|
|
13
|
+
selector?: string;
|
|
14
|
+
extra?: unknown;
|
|
15
|
+
beforeCapture?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function captureDrawerFormSnapshot(root: ParentNode, options?: DrawerSnapshotOptions): string;
|
|
18
|
+
export declare function isDrawerFormDirty(root: ParentNode, initialSnapshot: string, options?: DrawerSnapshotOptions): boolean;
|
|
19
|
+
export declare function confirmDrawerUnsavedClose(ctx: DrawerGuardI18nContext): Promise<DrawerCloseDecision>;
|
|
20
|
+
//# sourceMappingURL=drawer-unsaved-guard.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Delta } from 'jsondiffpatch';
|
|
2
|
+
export type JsonDiffKind = 'added' | 'removed' | 'changed';
|
|
3
|
+
export type UnifiedJsonDiffLineKind = 'meta' | 'hunk' | 'context' | 'added' | 'removed';
|
|
4
|
+
export interface JsonDiffEntry {
|
|
5
|
+
path: string;
|
|
6
|
+
kind: JsonDiffKind;
|
|
7
|
+
before: unknown;
|
|
8
|
+
after: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface UnifiedJsonDiffLine {
|
|
11
|
+
kind: UnifiedJsonDiffLineKind;
|
|
12
|
+
oldLine?: number;
|
|
13
|
+
newLine?: number;
|
|
14
|
+
marker: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface JsonDiffResult {
|
|
18
|
+
beforeJson: string;
|
|
19
|
+
afterJson: string;
|
|
20
|
+
delta: Delta;
|
|
21
|
+
deltaJson: string;
|
|
22
|
+
entries: JsonDiffEntry[];
|
|
23
|
+
unifiedDiff: UnifiedJsonDiffLine[];
|
|
24
|
+
hasChanges: boolean;
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface RuleChainJsonValidationResult {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
errors: string[];
|
|
30
|
+
jsonString?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const MAX_FRONTEND_DIFF_ENTRIES = 800;
|
|
33
|
+
export declare const MAX_UNIFIED_DIFF_LINES = 1600;
|
|
34
|
+
export declare function normalizeSnapshotValue(value: unknown, seen?: WeakSet<object>): unknown;
|
|
35
|
+
export declare function stableSnapshotString(value: unknown): string;
|
|
36
|
+
export declare function parseSnapshotJson(json: string): unknown;
|
|
37
|
+
export declare function collectFrontendJsonDiff(before: unknown, after: unknown, path?: string, entries?: JsonDiffEntry[]): JsonDiffEntry[];
|
|
38
|
+
export declare function formatDiffPreviewValue(value: unknown): string;
|
|
39
|
+
export declare function createUnifiedJsonDiff(beforeJson: string, afterJson: string): {
|
|
40
|
+
lines: UnifiedJsonDiffLine[];
|
|
41
|
+
truncated: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare function createJsonDiffResult(beforeRaw: unknown, afterRaw: unknown): JsonDiffResult;
|
|
44
|
+
export declare function validateRuleChainJsonIntegrity(data: unknown): RuleChainJsonValidationResult;
|
|
45
|
+
//# sourceMappingURL=json-diff.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type RunHistoryRecord = Record<string, any>;
|
|
2
|
+
export type RunHistoryStatusKind = 'success' | 'failed' | 'unknown';
|
|
3
|
+
export interface RunHistoryStatusView {
|
|
4
|
+
kind: RunHistoryStatusKind;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function getRunHistoryId(item: RunHistoryRecord): string;
|
|
8
|
+
export declare function formatRunHistoryTime(item: RunHistoryRecord, locale?: string): string;
|
|
9
|
+
export declare function getRunHistoryMsgType(item: RunHistoryRecord): string;
|
|
10
|
+
export declare function getRunHistoryStatusView(item: RunHistoryRecord, labels?: {
|
|
11
|
+
success?: string;
|
|
12
|
+
failed?: string;
|
|
13
|
+
unknown?: string;
|
|
14
|
+
}): RunHistoryStatusView;
|
|
15
|
+
export declare function formatRunHistoryDuration(item: RunHistoryRecord): string;
|
|
16
|
+
export declare function getRunHistoryLogDuration(log: RunHistoryRecord): string;
|
|
17
|
+
export declare function formatRunHistoryMessageForDetail(msg: any): string;
|
|
18
|
+
export declare function formatRunHistoryRecordJson(item: RunHistoryRecord, maxChars?: 20000): string;
|
|
19
|
+
//# sourceMappingURL=run-history-format.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanban/rulego-editor-core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "RuleGo 规则链编辑器核心库 - 框架无关的 Headless 编辑器引擎 + API 抽象层 (WorkflowFetcher)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -53,10 +53,11 @@
|
|
|
53
53
|
"@codemirror/state": "^6.6.0",
|
|
54
54
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
55
55
|
"@codemirror/view": "^6.40.0",
|
|
56
|
+
"@lezer/javascript": "^1.5.4",
|
|
56
57
|
"@logicflow/core": "2.1.11",
|
|
57
58
|
"@logicflow/extension": "2.1.11",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
59
|
+
"codemirror": "^6.0.2",
|
|
60
|
+
"jsondiffpatch": "^0.7.6"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"typescript": "^5.4.0",
|