@ibiz-template-plugin/ai-chat 0.0.117 → 0.0.118
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.es.js +17438 -14536
- package/dist/index.legacy.js +2 -2
- package/dist/style.css +2 -2
- package/dist/types/components/chat-back-bottom/chat-back-bottom.d.ts +5 -3
- package/dist/types/components/chat-file-preview/components/custom-chat-file-preview/custom-chat-file-preview.d.ts +19 -0
- package/dist/types/components/chat-file-preview/components/default-chat-file-preview/default-chat-file-preview.d.ts +19 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +10 -9
- package/dist/types/components/chat-messages/use-message-renderer.d.ts +89 -0
- package/dist/types/components/chat-net-disk/file-move-panel/file-move-panel.d.ts +27 -0
- package/dist/types/components/common/actions/actions.d.ts +29 -0
- package/dist/types/components/common/context-menu/context-menu.d.ts +34 -0
- package/dist/types/components/common/drawer/drawer.d.ts +6 -1
- package/dist/types/components/common/index.d.ts +9 -0
- package/dist/types/components/common/inline-editor/inline-editor.d.ts +13 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +31 -3
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +46 -5
- package/dist/types/components/common/modal/modal.d.ts +37 -0
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +5 -1
- package/dist/types/components/popup/popup.d.ts +2 -1
- package/dist/types/controller/file-system/file-system.controller.d.ts +68 -1
- package/dist/types/controller/overlay/drawer-overlay.controller.d.ts +7 -0
- package/dist/types/controller/overlay/index.d.ts +1 -0
- package/dist/types/controller/overlay/modal-overlay.controller.d.ts +47 -0
- package/dist/types/icons/index.d.ts +2 -1
- package/dist/types/icons/move-file-svg.d.ts +1 -0
- package/dist/types/icons/new-folder-svg.d.ts +1 -0
- package/dist/types/icons/system-file/archive.d.ts +7 -0
- package/dist/types/icons/system-file/audio.d.ts +5 -0
- package/dist/types/icons/system-file/excel.d.ts +1 -1
- package/dist/types/icons/system-file/image.d.ts +7 -0
- package/dist/types/icons/system-file/ppt.d.ts +0 -1
- package/dist/types/icons/system-file/program.d.ts +17 -0
- package/dist/types/icons/system-file/text.d.ts +4 -0
- package/dist/types/icons/system-file/video.d.ts +6 -0
- package/dist/types/icons/system-file/word.d.ts +7 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +6 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +6 -0
- package/dist/types/interface/i-file-system-options/i-file-system-options.d.ts +156 -3
- package/dist/types/locale/en/index.d.ts +11 -0
- package/dist/types/locale/zh-CN/index.d.ts +11 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/util/system-file.d.ts +2 -0
- package/package.json +2 -2
- package/dist/types/components/chat-messages/use-virtual-list.d.ts +0 -156
- package/dist/types/components/chat-scrollbar/chat-scrollbar.d.ts +0 -102
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RefObject } from 'preact';
|
|
1
2
|
|
|
2
3
|
export interface ChatBackBottomProps {
|
|
3
4
|
/**
|
|
@@ -13,11 +14,12 @@ export interface ChatBackBottomProps {
|
|
|
13
14
|
*/
|
|
14
15
|
bottom: number;
|
|
15
16
|
/**
|
|
16
|
-
* @description
|
|
17
|
-
*
|
|
17
|
+
* @description 滚动目标(元素 ref 或选择器;多实例场景应传 ref,
|
|
18
|
+
* 选择器经 document.querySelector 只会命中首个匹配实例)
|
|
19
|
+
* @type {RefObject<HTMLElement> | string}
|
|
18
20
|
* @memberof ChatBackBottomProps
|
|
19
21
|
*/
|
|
20
|
-
target: string;
|
|
22
|
+
target: RefObject<HTMLElement> | string;
|
|
21
23
|
/**
|
|
22
24
|
* @description 滚动高度达到此参数值才出现
|
|
23
25
|
* @type {number}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileSystemController } from '../../../../controller';
|
|
2
|
+
import { IFile } from '../../../../interface';
|
|
3
|
+
|
|
4
|
+
interface CustomChatFilePreviewProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 文件
|
|
7
|
+
* @type {IFile}
|
|
8
|
+
* @memberof CustomChatFilePreviewProps
|
|
9
|
+
*/
|
|
10
|
+
file?: IFile;
|
|
11
|
+
/**
|
|
12
|
+
* @description 系统文件控制器
|
|
13
|
+
* @type {FileSystemController}
|
|
14
|
+
* @memberof CustomChatFilePreviewProps
|
|
15
|
+
*/
|
|
16
|
+
controller: FileSystemController;
|
|
17
|
+
}
|
|
18
|
+
export declare const CustomChatFilePreview: (props: CustomChatFilePreviewProps) => import("preact").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileSystemController } from '../../../../controller';
|
|
2
|
+
import { IFile } from '../../../../interface';
|
|
3
|
+
|
|
4
|
+
interface DefaultChatFilePreviewProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 文件
|
|
7
|
+
* @type {IFile}
|
|
8
|
+
* @memberof DefaultChatFilePreviewProps
|
|
9
|
+
*/
|
|
10
|
+
file?: IFile;
|
|
11
|
+
/**
|
|
12
|
+
* @description 系统文件控制器
|
|
13
|
+
* @type {FileSystemController}
|
|
14
|
+
* @memberof DefaultChatFilePreviewProps
|
|
15
|
+
*/
|
|
16
|
+
controller: FileSystemController;
|
|
17
|
+
}
|
|
18
|
+
export declare const DefaultChatFilePreview: (props: DefaultChatFilePreviewProps) => import("preact").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -26,15 +26,16 @@ export interface ChatMessageProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* 聊天消息列表组件
|
|
28
28
|
*
|
|
29
|
-
* ##
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* ## 整体思路(真实绘制 + 按需扩展)
|
|
30
|
+
* 弃用虚拟列表(绝对定位 + spacer 存在滚动条抖动),所有消息按普通文档流真实渲染:
|
|
31
|
+
* 1. 初始只真实绘制最新的 20 条,更早的消息不进 DOM(无占位);
|
|
32
|
+
* 2. 滚动到顶部附近时向前扩展一批(每批 10 条)真实绘制,绘制过的消息永久保留真实渲染;
|
|
33
|
+
* 3. 绘制触达已加载数据头部且服务端仍有更早历史时,才触发 loadHistoryMore 网络加载,
|
|
34
|
+
* 与「绘制扩展」(纯前端)严格分开。
|
|
32
35
|
*
|
|
33
|
-
* ##
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* 3. 非贴底 + 数据变化(前插历史、删除)→ 按锚点恢复位置,避免画面跳动;
|
|
38
|
-
* 纯「测量回填」(totalSize 变但消息引用没变)不干预 scrollTop,避免打断手动拖动。
|
|
36
|
+
* ## 滚动位置维护
|
|
37
|
+
* - 贴底跟随由数据变化布局修正驱动:消息更新、绘制范围变化后处于贴底模式时自动贴底;
|
|
38
|
+
* - 末尾追加用户消息 → 强制贴底;前插更早历史 → 依赖浏览器 scroll anchoring 保持视口;
|
|
39
|
+
* - keep-alive 失活再激活 → 恢复失活前滚动位置。
|
|
39
40
|
*/
|
|
40
41
|
export declare const ChatMessages: (props: ChatMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { RefObject } from 'preact';
|
|
2
|
+
import { Signal } from '@preact/signals';
|
|
3
|
+
import { IChatMessage } from '../../interface';
|
|
4
|
+
|
|
5
|
+
export declare const INITIAL_BATCH_SIZE = 20;
|
|
6
|
+
export declare const EXPAND_BATCH_SIZE = 10;
|
|
7
|
+
export interface UseMessageRenderOptions {
|
|
8
|
+
/**
|
|
9
|
+
* 消息数组信号(内容/数量变化都会触发组件重渲染)
|
|
10
|
+
*
|
|
11
|
+
* @type {Signal<IChatMessage[]>}
|
|
12
|
+
*/
|
|
13
|
+
messages: Signal<IChatMessage[]>;
|
|
14
|
+
/**
|
|
15
|
+
* 是否还有更早历史可加载(绘制触达数据头部时用于触发数据加载)
|
|
16
|
+
*
|
|
17
|
+
* @type {Signal<boolean>}
|
|
18
|
+
*/
|
|
19
|
+
hasMoreHistory: Signal<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* 是否正在加载更早历史
|
|
22
|
+
*
|
|
23
|
+
* @type {Signal<boolean>}
|
|
24
|
+
*/
|
|
25
|
+
isLoadingHistory: Signal<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* 加载更早历史(数据层,网络请求)
|
|
28
|
+
*
|
|
29
|
+
* @type {() => void}
|
|
30
|
+
*/
|
|
31
|
+
loadHistoryMore: () => void;
|
|
32
|
+
}
|
|
33
|
+
export interface UseMessageRenderResult {
|
|
34
|
+
/**
|
|
35
|
+
* 挂到滚动容器上的 ref
|
|
36
|
+
*
|
|
37
|
+
* @type {RefObject<HTMLDivElement>}
|
|
38
|
+
*/
|
|
39
|
+
containerRef: RefObject<HTMLDivElement>;
|
|
40
|
+
/**
|
|
41
|
+
* 已绘制覆盖的头部索引(实际值):[renderStartIndex, messages.length) 为真实绘制区,
|
|
42
|
+
* [0, renderStartIndex) 的消息不进 DOM。由 rAF 循环逐帧逼近目标值
|
|
43
|
+
*
|
|
44
|
+
* @type {Signal<number>}
|
|
45
|
+
*/
|
|
46
|
+
renderStartIndex: Signal<number>;
|
|
47
|
+
/**
|
|
48
|
+
* 滚动事件中调用:滚动到顶部附近时向前扩展一批绘制(EXPAND_BATCH_SIZE 条),
|
|
49
|
+
* 绘制触达数据头部且仍有更早历史时触发 loadHistoryMore
|
|
50
|
+
*
|
|
51
|
+
* @type {() => void}
|
|
52
|
+
*/
|
|
53
|
+
checkExpand: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* 设置绘制范围目标索引,rAF 循环逐帧逼近(初始加载/前插共用)
|
|
56
|
+
*
|
|
57
|
+
* @type {(index: number) => void}
|
|
58
|
+
*/
|
|
59
|
+
setRenderTarget: (index: number) => void;
|
|
60
|
+
/**
|
|
61
|
+
* 头部前插历史数据后调用:前插的消息纳入绘制范围(用户在顶部看历史)
|
|
62
|
+
*
|
|
63
|
+
* @type {(prependedCount: number) => void}
|
|
64
|
+
*/
|
|
65
|
+
adjustForPrepend: (prependedCount: number) => void;
|
|
66
|
+
/**
|
|
67
|
+
* 恢复滚动条位置(keep-alive 激活时使用)
|
|
68
|
+
*
|
|
69
|
+
* @type {() => void}
|
|
70
|
+
*/
|
|
71
|
+
restoreScrollPosition: () => void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 消息渐进真实绘制 Hook
|
|
75
|
+
*
|
|
76
|
+
* ## 核心思路(真实绘制 + 按需扩展 + 渲染切片,弃用虚拟列表)
|
|
77
|
+
* 不做视口裁剪、不做占位:消息按普通文档流真实渲染,分批绘制——
|
|
78
|
+
* 1. 初始只绘制最新的 20 条,更早的消息不进 DOM;
|
|
79
|
+
* 2. 滚动到顶部附近时向前扩展一批(EXPAND_BATCH_SIZE 条),绘制过的消息永久真实渲染;
|
|
80
|
+
* 3. 批次扩展不一次性放行:renderStartIndex 由 rAF 循环每帧向目标值推进
|
|
81
|
+
* ITEMS_PER_FRAME 条,把每条消息的 Cherry 初始化/解析分摊到多帧,
|
|
82
|
+
* 避免一批消息同帧挂载导致主线程阻塞数秒。
|
|
83
|
+
*
|
|
84
|
+
* ## 与数据加载的边界
|
|
85
|
+
* 绘制扩展是纯前端行为(不动数据);只有绘制需求触达已加载数据头部
|
|
86
|
+
* (renderTargetIndex === 0)且服务端还有更早历史时,才触发 loadHistoryMore 网络加载。
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
export declare const useMessageRender: (options: UseMessageRenderOptions) => UseMessageRenderResult;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FileSystemController } from '../../../controller';
|
|
2
|
+
import { LazyTreeNode } from '../../common';
|
|
3
|
+
|
|
4
|
+
interface FileMovePanelProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 当前文件数据
|
|
7
|
+
* @type {IFile}
|
|
8
|
+
* @memberof FileMovePanelProps
|
|
9
|
+
*/
|
|
10
|
+
data: LazyTreeNode;
|
|
11
|
+
/**
|
|
12
|
+
* @description 系统文件控制器
|
|
13
|
+
* @type {FileSystemController}
|
|
14
|
+
* @memberof FileMovePanelProps
|
|
15
|
+
*/
|
|
16
|
+
controller: FileSystemController;
|
|
17
|
+
/**
|
|
18
|
+
* @description 关闭
|
|
19
|
+
* @memberof FileMovePanelProps
|
|
20
|
+
*/
|
|
21
|
+
onClose?: (params?: {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
data: any;
|
|
24
|
+
}) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const FileMovePanel: (props: FileMovePanelProps) => import("preact").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
export interface IAction {
|
|
4
|
+
id: string;
|
|
5
|
+
icon: VNode;
|
|
6
|
+
caption: string;
|
|
7
|
+
visible?: (data?: any) => boolean | boolean;
|
|
8
|
+
onClick?: (event: MouseEvent, data?: any) => void;
|
|
9
|
+
}
|
|
10
|
+
interface ActionsProps {
|
|
11
|
+
/**
|
|
12
|
+
* 平铺项
|
|
13
|
+
*/
|
|
14
|
+
flattenCount?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 自定义类名
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* 行为项数据
|
|
21
|
+
*/
|
|
22
|
+
actions: IAction[];
|
|
23
|
+
/**
|
|
24
|
+
* 行为项数据
|
|
25
|
+
*/
|
|
26
|
+
data?: any;
|
|
27
|
+
}
|
|
28
|
+
export declare const Actions: (props: ActionsProps) => import("preact").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IAction } from '../actions/actions';
|
|
2
|
+
|
|
3
|
+
export interface IContextMenuAction extends IAction {
|
|
4
|
+
clickClose?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface ContextMenuProps {
|
|
7
|
+
/**
|
|
8
|
+
* 行为数据
|
|
9
|
+
*/
|
|
10
|
+
data?: any;
|
|
11
|
+
/**
|
|
12
|
+
* 显示状态
|
|
13
|
+
*/
|
|
14
|
+
visible: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 菜单项
|
|
17
|
+
*/
|
|
18
|
+
actions: IContextMenuAction[];
|
|
19
|
+
/**
|
|
20
|
+
* 菜单出现位置(视口坐标,与 MouseEvent.clientX/clientY 一致)
|
|
21
|
+
*/
|
|
22
|
+
position: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 切换显示
|
|
28
|
+
* @param state
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
onToggleVisible: (state: boolean) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const ContextMenu: (props: ContextMenuProps) => import("preact").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -11,8 +11,13 @@ interface DrawerProps {
|
|
|
11
11
|
size?: number | string;
|
|
12
12
|
/** 指定容器(DOM 元素),不传则默认 body */
|
|
13
13
|
container?: HTMLElement;
|
|
14
|
+
/** 是否按 Esc 关闭,默认 true */
|
|
15
|
+
escClosable?: boolean;
|
|
14
16
|
/** 关闭回调(由 DrawerManager 注入) */
|
|
15
|
-
onClose?: (
|
|
17
|
+
onClose?: (params?: {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
data: any;
|
|
20
|
+
}) => void;
|
|
16
21
|
/** 是否显示遮罩,默认 true */
|
|
17
22
|
mask?: boolean;
|
|
18
23
|
/** 是否显示右上角关闭按钮,默认 true */
|
|
@@ -3,3 +3,12 @@ export { MultipleSelect } from './multiple-select/multiple-select';
|
|
|
3
3
|
export { MessageToolbar } from './messsage-toolbar/messsage-toolbar';
|
|
4
4
|
export { Slider } from './slider/slider';
|
|
5
5
|
export { Switch } from './switch/switch';
|
|
6
|
+
export { Actions, type IAction } from './actions/actions';
|
|
7
|
+
export { Breadcrumb } from './breadcrumb/breadcrumb';
|
|
8
|
+
export { LazyListTree, type LazyListTreeRef, } from './lazy-list-tree/lazy-list-tree';
|
|
9
|
+
export { ContextMenu, type IContextMenuAction, } from './context-menu/context-menu';
|
|
10
|
+
export { Drawer } from './drawer/drawer';
|
|
11
|
+
export { LazyTree, type LazyTreeRef, type LazyTreeNode, } from './lazy-tree/lazy-tree';
|
|
12
|
+
export { Loading } from './loading/loading';
|
|
13
|
+
export { InlineEditor } from './inline-editor/inline-editor';
|
|
14
|
+
export { Modal } from './modal/modal';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
interface InlineEditorProps {
|
|
3
|
+
/** 初始值 */
|
|
4
|
+
value?: string;
|
|
5
|
+
/** 占位提示 */
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
/** 回车/失焦确认,校验是否成功 */
|
|
8
|
+
onConfirm: (value: string) => Promise<void> | void;
|
|
9
|
+
/** Esc 或空值失焦取消 */
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const InlineEditor: (props: InlineEditorProps) => import("preact").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LazyTreeNode } from '../lazy-tree/lazy-tree';
|
|
2
|
+
import { IAction } from '../actions/actions';
|
|
2
3
|
|
|
3
4
|
interface LazyListTreeProps {
|
|
4
5
|
/**
|
|
@@ -54,14 +55,41 @@ interface LazyListTreeProps {
|
|
|
54
55
|
* 是否可拖拽
|
|
55
56
|
*/
|
|
56
57
|
draggable?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 行为集合
|
|
60
|
+
*/
|
|
61
|
+
actions?: IAction[];
|
|
62
|
+
/**
|
|
63
|
+
* 新建草稿:type=file/folder;null 表示无草稿
|
|
64
|
+
*/
|
|
65
|
+
draft?: {
|
|
66
|
+
type: 'file' | 'folder';
|
|
67
|
+
parent: LazyTreeNode;
|
|
68
|
+
} | null;
|
|
69
|
+
/**
|
|
70
|
+
* 确认
|
|
71
|
+
* @param name
|
|
72
|
+
* @param node
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
onConfirm?: (name: string, node?: LazyTreeNode) => Promise<void> | void;
|
|
76
|
+
/**
|
|
77
|
+
* 取消
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
onCancel?: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* 编辑的节点 id
|
|
83
|
+
*/
|
|
84
|
+
editNodeId?: string | null;
|
|
57
85
|
}
|
|
58
86
|
export interface LazyListTreeRef {
|
|
59
87
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
88
|
+
* 重载
|
|
89
|
+
* @param
|
|
62
90
|
* @returns
|
|
63
91
|
*/
|
|
64
|
-
overloadNode: (
|
|
92
|
+
overloadNode: () => Promise<void>;
|
|
65
93
|
}
|
|
66
94
|
export declare const LazyListTree: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<LazyListTreeProps> & {
|
|
67
95
|
ref?: import('preact').Ref<LazyListTreeRef> | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IAction } from '../actions/actions';
|
|
1
2
|
|
|
2
3
|
export interface LazyTreeNode {
|
|
3
4
|
/**
|
|
@@ -31,7 +32,7 @@ export interface LazyTreeNode {
|
|
|
31
32
|
/**
|
|
32
33
|
* 父节点标识
|
|
33
34
|
*/
|
|
34
|
-
parentId?: string
|
|
35
|
+
parentId?: string;
|
|
35
36
|
/**
|
|
36
37
|
* 节点深度
|
|
37
38
|
*/
|
|
@@ -45,11 +46,13 @@ export interface LazyTreeNode {
|
|
|
45
46
|
*/
|
|
46
47
|
data: Record<string, any>;
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @type {string}
|
|
50
|
-
* @memberof LazyTreeNode
|
|
49
|
+
* 根节点标识
|
|
51
50
|
*/
|
|
52
51
|
rootId: string;
|
|
52
|
+
/**
|
|
53
|
+
* 根节点
|
|
54
|
+
*/
|
|
55
|
+
isRoot?: boolean;
|
|
53
56
|
}
|
|
54
57
|
interface LazyTreeProps {
|
|
55
58
|
/**
|
|
@@ -113,11 +116,49 @@ interface LazyTreeProps {
|
|
|
113
116
|
* 是否可拖拽
|
|
114
117
|
*/
|
|
115
118
|
draggable?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 行为集合
|
|
121
|
+
*/
|
|
122
|
+
actions?: IAction[];
|
|
123
|
+
/**
|
|
124
|
+
* 新建草稿:type=file/folder;null 表示无草稿
|
|
125
|
+
*/
|
|
126
|
+
draft?: {
|
|
127
|
+
type: 'file' | 'folder';
|
|
128
|
+
parent: LazyTreeNode;
|
|
129
|
+
} | null;
|
|
130
|
+
/**
|
|
131
|
+
* 确认
|
|
132
|
+
* @param name
|
|
133
|
+
* @param node
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
onConfirm?: (name: string, node?: LazyTreeNode) => Promise<void> | void;
|
|
137
|
+
/**
|
|
138
|
+
* 取消
|
|
139
|
+
* @returns
|
|
140
|
+
*/
|
|
141
|
+
onCancel?: () => void;
|
|
142
|
+
/**
|
|
143
|
+
* 编辑的节点 id
|
|
144
|
+
*/
|
|
145
|
+
editNodeId?: string | null;
|
|
146
|
+
}
|
|
147
|
+
export interface LazyTreeRef {
|
|
148
|
+
/**
|
|
149
|
+
* @description 重载节点
|
|
150
|
+
* @param {LazyTreeNode} node 需要重载的节点
|
|
151
|
+
* @param {boolean} isParent 是否重载父节点,默认为false
|
|
152
|
+
* @memberof LazyTreeRef
|
|
153
|
+
*/
|
|
154
|
+
overloadNode: (node: LazyTreeNode, isParent?: boolean) => Promise<void>;
|
|
116
155
|
}
|
|
117
156
|
/**
|
|
118
157
|
* 懒加载树组件
|
|
119
158
|
*
|
|
120
159
|
* 具有懒加载、搜索、展开折叠等功能
|
|
121
160
|
*/
|
|
122
|
-
export declare const LazyTree: (
|
|
161
|
+
export declare const LazyTree: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<LazyTreeProps> & {
|
|
162
|
+
ref?: import('preact').Ref<LazyTreeRef> | undefined;
|
|
163
|
+
}>;
|
|
123
164
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { VNode, h } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface ModalProps {
|
|
4
|
+
/** 头部图标 */
|
|
5
|
+
icon?: VNode;
|
|
6
|
+
/** 内容组件 */
|
|
7
|
+
content: any;
|
|
8
|
+
/** 传递给内容组件的参数(onClose 会被自动注入) */
|
|
9
|
+
contentProps?: Record<string, any>;
|
|
10
|
+
/** 指定容器,不传默认 body */
|
|
11
|
+
container?: HTMLElement;
|
|
12
|
+
/** 关闭回调(由 ModalManager 注入) */
|
|
13
|
+
onClose?: (params?: {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
data: any;
|
|
16
|
+
}) => void;
|
|
17
|
+
/** 是否显示遮罩,默认 true */
|
|
18
|
+
mask?: boolean;
|
|
19
|
+
/** 是否显示右上角关闭按钮,默认 true */
|
|
20
|
+
showClose?: boolean;
|
|
21
|
+
/** 点击遮罩是否关闭,默认 true */
|
|
22
|
+
maskClosable?: boolean;
|
|
23
|
+
/** 是否按 Esc 关闭,默认 true */
|
|
24
|
+
escClosable?: boolean;
|
|
25
|
+
/** 外部扩展类名 */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** 标题 */
|
|
28
|
+
title?: string;
|
|
29
|
+
/** 宽度:number(px) / 字符串('50%' / '600px'),不传默认 80% */
|
|
30
|
+
width?: number | string;
|
|
31
|
+
/** 高度:number(px) / 字符串('50%' / '600px'),不传默认 80% */
|
|
32
|
+
height?: number | string;
|
|
33
|
+
/** 垂直居中,默认 true */
|
|
34
|
+
centered?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const Modal: (props: ModalProps) => h.JSX.Element;
|
|
37
|
+
export {};
|
|
@@ -49,6 +49,10 @@ export interface FlatChatContainerProps {
|
|
|
49
49
|
* 是否加载中
|
|
50
50
|
*/
|
|
51
51
|
isLoading: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 是否隐藏嵌入AI聊天框头部区域,仅嵌入AI聊天框生效
|
|
54
|
+
*/
|
|
55
|
+
isEmbedAiHeaderHidden: boolean;
|
|
52
56
|
/**
|
|
53
57
|
* @description 扩展
|
|
54
58
|
* @type {IExtensionOptions}
|
|
@@ -222,7 +226,7 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
222
226
|
* @description 绘制头部
|
|
223
227
|
* @memberof FlatChatContainer
|
|
224
228
|
*/
|
|
225
|
-
renderHeader(): JSX.Element;
|
|
229
|
+
renderHeader(): JSX.Element | null;
|
|
226
230
|
/**
|
|
227
231
|
* @description 绘制右侧操作区(含分隔条)
|
|
228
232
|
* - DOM 常驻,宽度随 visible 切换由 CSS 过渡展开/收起
|
|
@@ -6,13 +6,14 @@ interface ActionItem {
|
|
|
6
6
|
caption: string;
|
|
7
7
|
icon?: VNode;
|
|
8
8
|
}
|
|
9
|
-
export declare const Popup: ({ triggerMode, children, actions, content, position, isOpen: isOpenProp, onToggleOpen, onAction, }: {
|
|
9
|
+
export declare const Popup: ({ triggerMode, children, actions, content, position, isOpen: isOpenProp, onToggleOpen, popupClassName, onAction, }: {
|
|
10
10
|
triggerMode: "click" | "hover";
|
|
11
11
|
children: import('preact').ComponentChildren;
|
|
12
12
|
actions?: ActionItem[];
|
|
13
13
|
content?: import('preact').ComponentChildren;
|
|
14
14
|
position?: Position;
|
|
15
15
|
isOpen?: boolean;
|
|
16
|
+
popupClassName?: string;
|
|
16
17
|
onToggleOpen?: (isOpen: boolean) => void;
|
|
17
18
|
onAction?: (actionId: string, event: MouseEvent) => void;
|
|
18
19
|
}) => import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFile, IFileItem, IFileItemParams, IFileUploadPrams, IFileSystemOptions, FileUploaderOptions } from '../../interface';
|
|
1
|
+
import { IFile, IFileItem, IMessageUtil, IFileItemParams, IFileUploadPrams, IFileSystemOptions, FileUploaderOptions } from '../../interface';
|
|
2
2
|
import { AiChatController } from '../ai-chat/ai-chat.controller';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -24,12 +24,40 @@ export declare class FileSystemController {
|
|
|
24
24
|
* @memberof FileSystemController
|
|
25
25
|
*/
|
|
26
26
|
constructor(opts: IFileSystemOptions, uploader: FileUploaderOptions<object>, aiChat: AiChatController);
|
|
27
|
+
/**
|
|
28
|
+
* @description 文件参数
|
|
29
|
+
* @private
|
|
30
|
+
* @type {object}
|
|
31
|
+
* @memberof FileSystemController
|
|
32
|
+
*/
|
|
33
|
+
private params;
|
|
34
|
+
/**
|
|
35
|
+
* @description 消息
|
|
36
|
+
* @readonly
|
|
37
|
+
* @type {(IMessageUtil | undefined)}
|
|
38
|
+
* @memberof FileSystemController
|
|
39
|
+
*/
|
|
40
|
+
get message(): IMessageUtil | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @description 文件预览模式
|
|
43
|
+
* @readonly
|
|
44
|
+
* @memberof FileSystemController
|
|
45
|
+
*/
|
|
46
|
+
get filePreviewMode(): "DEFAULT" | "CUSTOM" | undefined;
|
|
27
47
|
/**
|
|
28
48
|
* @description 绑定函数this指向
|
|
29
49
|
* @private
|
|
30
50
|
* @memberof FileSystemController
|
|
31
51
|
*/
|
|
32
52
|
private bindFunction;
|
|
53
|
+
/**
|
|
54
|
+
* @description 拼接pattern
|
|
55
|
+
* @private
|
|
56
|
+
* @param {string} [str]
|
|
57
|
+
* @returns {*} {(string | undefined)}
|
|
58
|
+
* @memberof FileSystemController
|
|
59
|
+
*/
|
|
60
|
+
private splicingPattern;
|
|
33
61
|
/**
|
|
34
62
|
* @description 查询系统文件
|
|
35
63
|
* @param {IFileItemParams} params
|
|
@@ -82,4 +110,43 @@ export declare class FileSystemController {
|
|
|
82
110
|
* @memberof FileSystemController
|
|
83
111
|
*/
|
|
84
112
|
downLoadFile(fileid: string, filename: string, cat: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* @description 获取自定义文件预览路径
|
|
115
|
+
* @param {string} id
|
|
116
|
+
* @param {string} name
|
|
117
|
+
* @param {string} folder
|
|
118
|
+
* @returns {*}
|
|
119
|
+
* @memberof FileSystemController
|
|
120
|
+
*/
|
|
121
|
+
getCustomFilePreviewUrl(file: IFile): Promise<string>;
|
|
122
|
+
/**
|
|
123
|
+
* @description 创建文件夹
|
|
124
|
+
* @param {string} file_path 文件路径
|
|
125
|
+
* @returns {*} {Promise<boolean>}
|
|
126
|
+
* @memberof FileSystemController
|
|
127
|
+
*/
|
|
128
|
+
createFolder(file_path: string): Promise<boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* @description 创建文件
|
|
131
|
+
* @param {string} file_path 文件路径
|
|
132
|
+
* @param {string} [content=' '] 文件内容
|
|
133
|
+
* @returns {*} {Promise<boolean>}
|
|
134
|
+
* @memberof FileSystemController
|
|
135
|
+
*/
|
|
136
|
+
createFile(file_path: string, content?: string): Promise<boolean>;
|
|
137
|
+
/**
|
|
138
|
+
* @description 移动文件夹/文件
|
|
139
|
+
* @param {string} src 源路径
|
|
140
|
+
* @param {string} dst 目标路径
|
|
141
|
+
* @returns {*} {Promise<boolean>}
|
|
142
|
+
* @memberof FileSystemController
|
|
143
|
+
*/
|
|
144
|
+
move(src: string, dst: string): Promise<boolean>;
|
|
145
|
+
/**
|
|
146
|
+
* @description 删除文件夹/文件
|
|
147
|
+
* @param {string} file_path 目标路径
|
|
148
|
+
* @returns {*} {Promise<boolean>}
|
|
149
|
+
* @memberof FileSystemController
|
|
150
|
+
*/
|
|
151
|
+
delete(file_path: string): Promise<boolean>;
|
|
85
152
|
}
|
|
@@ -13,6 +13,8 @@ interface DrawerOpenOptions {
|
|
|
13
13
|
props?: Record<string, any>;
|
|
14
14
|
/** 是否显示遮罩,默认 true */
|
|
15
15
|
mask?: boolean;
|
|
16
|
+
/** 按 Esc 是否关闭,默认 true */
|
|
17
|
+
escClosable?: boolean;
|
|
16
18
|
/** 是否显示右上角关闭按钮,默认 true */
|
|
17
19
|
showClose?: boolean;
|
|
18
20
|
/** 点击遮罩是否关闭,默认 true */
|
|
@@ -23,6 +25,11 @@ interface DrawerOpenOptions {
|
|
|
23
25
|
title?: string;
|
|
24
26
|
/** 事件源 */
|
|
25
27
|
event?: MouseEvent;
|
|
28
|
+
/** 关闭回调 */
|
|
29
|
+
onClose?: (params?: {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
data: any;
|
|
32
|
+
}) => void;
|
|
26
33
|
}
|
|
27
34
|
declare class DrawerOverlayController extends OverlayController {
|
|
28
35
|
constructor();
|