refactor(web-antd): 重构 Tinyflow 组件并优化类型定义
- 将 Item 类型和 Tinyflow 相关类型移动到 ui/typing 文件夹 - 删除 ui/index.d.ts 文件,减少冗余类型定义 - 优化 Tinyflow 组件代码,简化 imports - 移除 formatTime.ts 中的冗余代码,使用 @vben/utils 中的 formatDate 函数
This commit is contained in:
40
apps/web-antd/src/components/Tinyflow/ui/typing.ts
Normal file
40
apps/web-antd/src/components/Tinyflow/ui/typing.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { Edge, Node as Node_2, useSvelteFlow, Viewport } from '@xyflow/svelte';
|
||||
|
||||
export declare type Item = {
|
||||
children?: Item[];
|
||||
label: string;
|
||||
value: number | string;
|
||||
};
|
||||
|
||||
export declare class Tinyflow {
|
||||
private _init;
|
||||
private _setOptions;
|
||||
private options;
|
||||
private rootEl;
|
||||
private svelteFlowInstance;
|
||||
constructor(options: TinyflowOptions);
|
||||
destroy(): void;
|
||||
getData(): {
|
||||
edges: Edge[];
|
||||
nodes: Node_2[];
|
||||
viewport: Viewport;
|
||||
};
|
||||
getOptions(): TinyflowOptions;
|
||||
setData(data: TinyflowData): void;
|
||||
}
|
||||
|
||||
export declare type TinyflowData = Partial<
|
||||
ReturnType<ReturnType<typeof useSvelteFlow>['toObject']>
|
||||
>;
|
||||
|
||||
export declare type TinyflowOptions = {
|
||||
data?: TinyflowData;
|
||||
element: Element | string;
|
||||
provider?: {
|
||||
internal?: () => Item[] | Promise<Item[]>;
|
||||
knowledge?: () => Item[] | Promise<Item[]>;
|
||||
llm?: () => Item[] | Promise<Item[]>;
|
||||
};
|
||||
};
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user