@ibiz-template-plugin/ai-chat 0.0.114 → 0.0.116
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 +23284 -8717
- package/dist/index.legacy.js +28 -1
- package/dist/polyfills.legacy.js +2 -2
- package/dist/style.css +26 -1
- package/dist/types/components/chat-action-panel/chat-action-panel.d.ts +19 -0
- package/dist/types/components/chat-container/chat-container.d.ts +89 -5
- package/dist/types/components/chat-editor/node/mention-node.d.ts +3 -0
- package/dist/types/components/chat-file-preview/chat-file-preview.d.ts +18 -0
- package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +7 -0
- package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +23 -0
- package/dist/types/components/common/drawer/drawer.d.ts +28 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +69 -0
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +32 -1
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +40 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/constants/index.d.ts +8 -0
- package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +119 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +44 -15
- package/dist/types/controller/chat/chat-base.controller.d.ts +7 -0
- package/dist/types/controller/file-system/file-system.controller.d.ts +85 -0
- package/dist/types/controller/index.d.ts +3 -0
- package/dist/types/controller/overlay/drawer-overlay.controller.d.ts +34 -0
- package/dist/types/controller/overlay/index.d.ts +1 -0
- package/dist/types/controller/overlay/overlay.controller.d.ts +61 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/icons/project-svg.d.ts +1 -0
- package/dist/types/icons/workspace-svg.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interface/i-action-panel/i-action-panel.d.ts +24 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +31 -11
- package/dist/types/interface/i-file-item/i-file-item.d.ts +67 -0
- package/dist/types/interface/i-file-system-options/i-file-system-options.d.ts +61 -0
- package/dist/types/interface/index.d.ts +3 -1
- package/dist/types/locale/en/index.d.ts +8 -0
- package/dist/types/locale/zh-CN/index.d.ts +8 -0
- package/package.json +2 -1
- package/dist/types/interface/i-project/i-project.d.ts +0 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { AiActionPanelController } from '../../controller/ai-action-panel/ai-action-panel.controller';
|
|
3
|
+
|
|
4
|
+
export interface ChatActionPanelProps {
|
|
5
|
+
/**
|
|
6
|
+
* 操作区面板控制器
|
|
7
|
+
*/
|
|
8
|
+
controller: AiActionPanelController;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 聊天容器右侧操作区面板
|
|
12
|
+
* - 头部:左侧标题、右侧关闭图标,高度与容器头部(60px)保持一致
|
|
13
|
+
* - 内容区:占满剩余高度,渲染打开操作区时传入的内容组件
|
|
14
|
+
* - 自身不管理宽度(宽度由外层容器裁切)
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @class ChatActionPanel
|
|
18
|
+
*/
|
|
19
|
+
export declare const ChatActionPanel: ({ controller }: ChatActionPanelProps) => h.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, JSX } from 'preact';
|
|
2
2
|
import { Namespace } from '../../utils';
|
|
3
|
-
import { AiChatController, AiTopicController } from '../../controller';
|
|
3
|
+
import { AiActionPanelController, AiChatController, AiTopicController } from '../../controller';
|
|
4
4
|
import { IAutoClose, IChatToolbarItem, IChatContainerOptions } from '../../interface';
|
|
5
5
|
|
|
6
6
|
export interface ChatContainerProps {
|
|
@@ -101,6 +101,13 @@ export interface ChatContainerProps {
|
|
|
101
101
|
* 是否加载中
|
|
102
102
|
*/
|
|
103
103
|
isLoading: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* 操作区面板控制器
|
|
106
|
+
*
|
|
107
|
+
* @type {AiActionPanelController}
|
|
108
|
+
* @memberof ChatContainerProps
|
|
109
|
+
*/
|
|
110
|
+
actionPanel?: AiActionPanelController;
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
106
113
|
* 容器状态
|
|
@@ -152,6 +159,13 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
152
159
|
* 已绑定事件监听的聊天控制器实例(用于切换 aiChat 时重绑)
|
|
153
160
|
*/
|
|
154
161
|
private listenedAIChat?;
|
|
162
|
+
/**
|
|
163
|
+
* @description 拖拽实例
|
|
164
|
+
* @private
|
|
165
|
+
* @type {(Interactable | undefined)}
|
|
166
|
+
* @memberof ChatContainer
|
|
167
|
+
*/
|
|
168
|
+
private interactable;
|
|
155
169
|
/**
|
|
156
170
|
* 消息完成事件回调
|
|
157
171
|
*/
|
|
@@ -162,6 +176,38 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
162
176
|
private onMinimizeChangeHandler;
|
|
163
177
|
listener(): void;
|
|
164
178
|
componentDidUpdate(): void;
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* 同步操作区面板状态(visible 边沿触发窗口宽度增减与位置适配,展开收起动画由 CSS 过渡完成)
|
|
182
|
+
*
|
|
183
|
+
* @memberof ChatContainer
|
|
184
|
+
*/
|
|
185
|
+
syncPanelState(): void;
|
|
186
|
+
/**
|
|
187
|
+
* 打开操作区面板:窗口增宽面板占用(面板 + 分隔条),右边界不够时压缩面板宽度,仍不够则窗口左移补足
|
|
188
|
+
*
|
|
189
|
+
* @param {AiActionPanelController} panel
|
|
190
|
+
* @memberof ChatContainer
|
|
191
|
+
*/
|
|
192
|
+
handlePanelOpen(panel: AiActionPanelController): void;
|
|
193
|
+
/**
|
|
194
|
+
* 关闭操作区面板:窗口宽度回落面板占用(面板 + 分隔条),并回退打开时的窗口左移量
|
|
195
|
+
*
|
|
196
|
+
* @memberof ChatContainer
|
|
197
|
+
*/
|
|
198
|
+
handlePanelClose(): void;
|
|
199
|
+
/**
|
|
200
|
+
* 恢复面板打开期间为适配右边界所做的窗口左移量
|
|
201
|
+
*/
|
|
202
|
+
restorePanelShift(): void;
|
|
203
|
+
/**
|
|
204
|
+
* 面板打开后适配屏幕右边界(全屏时窗口铺满屏幕无需适配)
|
|
205
|
+
* - 先压缩面板宽度(窗口总宽同步回落),仍溢出则窗口左移补足
|
|
206
|
+
*
|
|
207
|
+
* @param {AiActionPanelController} panel
|
|
208
|
+
* @memberof ChatContainer
|
|
209
|
+
*/
|
|
210
|
+
fitPanelToViewport(panel: AiActionPanelController): void;
|
|
165
211
|
ns: Namespace;
|
|
166
212
|
containerRef: import('preact').RefObject<HTMLDivElement>;
|
|
167
213
|
dragHandle: import('preact').RefObject<HTMLDivElement>;
|
|
@@ -176,16 +222,16 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
176
222
|
*/
|
|
177
223
|
data: {
|
|
178
224
|
side: {
|
|
225
|
+
x: number;
|
|
179
226
|
y: number;
|
|
180
|
-
height: number;
|
|
181
227
|
width: number;
|
|
182
|
-
|
|
228
|
+
height: number;
|
|
183
229
|
};
|
|
184
230
|
window: {
|
|
231
|
+
x: number;
|
|
185
232
|
y: number;
|
|
186
233
|
width: number;
|
|
187
234
|
height: number;
|
|
188
|
-
x: number;
|
|
189
235
|
};
|
|
190
236
|
minWidth: number;
|
|
191
237
|
minHeight: number;
|
|
@@ -224,6 +270,18 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
224
270
|
* 输入区高度拖动时其父容器高度(px)
|
|
225
271
|
*/
|
|
226
272
|
inputDragContainerHeight: number;
|
|
273
|
+
/**
|
|
274
|
+
* 操作区面板上一帧显示状态(用于 componentDidUpdate 边沿检测)
|
|
275
|
+
*/
|
|
276
|
+
private panelVisiblePrev;
|
|
277
|
+
/**
|
|
278
|
+
* 操作区面板打开导致的窗口左移量(px),关闭面板时恢复(不持久化)
|
|
279
|
+
*/
|
|
280
|
+
private panelShiftPx;
|
|
281
|
+
/**
|
|
282
|
+
* 操作区面板宽度拖动起始值(px)
|
|
283
|
+
*/
|
|
284
|
+
private panelDragStartWidth;
|
|
227
285
|
/**
|
|
228
286
|
* 容器上下文
|
|
229
287
|
*
|
|
@@ -232,6 +290,13 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
232
290
|
* @type {ContainerContext}
|
|
233
291
|
*/
|
|
234
292
|
containerContext: ContainerContext;
|
|
293
|
+
/**
|
|
294
|
+
* 同步 props 到容器上下文(引用仅在值变化时替换,保证消费者按需重渲染)
|
|
295
|
+
*
|
|
296
|
+
* @return {*}
|
|
297
|
+
* @memberof ChatContainer
|
|
298
|
+
*/
|
|
299
|
+
syncContainerContext(): void;
|
|
235
300
|
/**
|
|
236
301
|
* 计算AI窗口样式
|
|
237
302
|
*
|
|
@@ -249,6 +314,7 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
249
314
|
};
|
|
250
315
|
/**
|
|
251
316
|
* 计算靠边模式样式
|
|
317
|
+
* - 贴右模式下面板打开时窗口整体左移,保证右边缘不超出屏幕
|
|
252
318
|
*
|
|
253
319
|
* @param {('left' | 'right')} side
|
|
254
320
|
* @memberof ChatContainer
|
|
@@ -348,7 +414,7 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
348
414
|
*/
|
|
349
415
|
handleSidebarResizeEnd: () => void;
|
|
350
416
|
/**
|
|
351
|
-
* 将侧栏宽度校正到合理区间 [200, 容器宽度/
|
|
417
|
+
* 将侧栏宽度校正到合理区间 [200, 容器宽度/3, 容器宽度-右侧最小宽]
|
|
352
418
|
*/
|
|
353
419
|
clampSidebarWidth(width: number): number;
|
|
354
420
|
/**
|
|
@@ -393,6 +459,24 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
393
459
|
* 提交拖动边框后的输入区高度(持久化到状态与本地缓存)
|
|
394
460
|
*/
|
|
395
461
|
commitInputHeight: () => void;
|
|
462
|
+
/**
|
|
463
|
+
* 操作区面板宽度拖动开始
|
|
464
|
+
*/
|
|
465
|
+
handlePanelResizeStart: () => void;
|
|
466
|
+
/**
|
|
467
|
+
* 操作区面板宽度拖动中
|
|
468
|
+
* - 向左拖:主内容区变窄、面板变宽;向右拖反之
|
|
469
|
+
*/
|
|
470
|
+
handlePanelResizeMove: (delta: number) => void;
|
|
471
|
+
/**
|
|
472
|
+
* 操作区面板宽度拖动结束(持久化)
|
|
473
|
+
*/
|
|
474
|
+
handlePanelResizeEnd: () => void;
|
|
475
|
+
/**
|
|
476
|
+
* 绘制右侧操作区(含分隔条)
|
|
477
|
+
* - DOM 常驻,宽度随 visible 切换由 CSS 过渡展开/收起
|
|
478
|
+
*/
|
|
479
|
+
renderActionRegion(): JSX.Element | null;
|
|
396
480
|
render(): JSX.Element;
|
|
397
481
|
}
|
|
398
482
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FileSystemController } from '../../controller';
|
|
2
|
+
|
|
3
|
+
interface ChatFilePreviewProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 文件路径
|
|
6
|
+
* @type {IFile}
|
|
7
|
+
* @memberof ChatFilePreviewProps
|
|
8
|
+
*/
|
|
9
|
+
filePath?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @description 系统文件控制器
|
|
12
|
+
* @type {FileSystemController}
|
|
13
|
+
* @memberof ChatFilePreviewProps
|
|
14
|
+
*/
|
|
15
|
+
controller: FileSystemController;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChatFilePreview: (props: ChatFilePreviewProps) => import("preact").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
interface BreadcrumbProps {
|
|
3
|
+
/**
|
|
4
|
+
* 当前路径(非根 -> 当前层)
|
|
5
|
+
*/
|
|
6
|
+
path: {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* 根节点
|
|
12
|
+
*/
|
|
13
|
+
root?: {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 点击某一层跳转,-1 表示回到根
|
|
19
|
+
*/
|
|
20
|
+
onJump: (index: number) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const Breadcrumb: (props: BreadcrumbProps) => import("preact").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface DrawerProps {
|
|
4
|
+
/** 抽屉内容组件(函数组件 / 类组件) */
|
|
5
|
+
content: any;
|
|
6
|
+
/** 传递给内容组件的参数(onClose 会被自动注入) */
|
|
7
|
+
contentProps?: Record<string, any>;
|
|
8
|
+
/** 弹出方向 */
|
|
9
|
+
placement?: 'left' | 'right' | 'top' | 'bottom';
|
|
10
|
+
/** 宽(左右)/ 高(上下),number(px) 或 字符串(如 '50%') */
|
|
11
|
+
size?: number | string;
|
|
12
|
+
/** 指定容器(DOM 元素),不传则默认 body */
|
|
13
|
+
container?: HTMLElement;
|
|
14
|
+
/** 关闭回调(由 DrawerManager 注入) */
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
/** 是否显示遮罩,默认 true */
|
|
17
|
+
mask?: boolean;
|
|
18
|
+
/** 是否显示右上角关闭按钮,默认 true */
|
|
19
|
+
showClose?: boolean;
|
|
20
|
+
/** 点击遮罩是否关闭,默认 true */
|
|
21
|
+
maskClosable?: boolean;
|
|
22
|
+
/** 外部扩展类名 */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** 标题 */
|
|
25
|
+
title?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const Drawer: (props: DrawerProps) => h.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LazyTreeNode } from '../lazy-tree/lazy-tree';
|
|
2
|
+
|
|
3
|
+
interface LazyListTreeProps {
|
|
4
|
+
/**
|
|
5
|
+
* 根节点数据
|
|
6
|
+
*/
|
|
7
|
+
nodes: LazyTreeNode[];
|
|
8
|
+
/**
|
|
9
|
+
* 异步加载子节点方法
|
|
10
|
+
* 返回子节点数组
|
|
11
|
+
*/
|
|
12
|
+
lazyLoad?: (node: LazyTreeNode) => Promise<LazyTreeNode[]>;
|
|
13
|
+
/**
|
|
14
|
+
* 节点选中回调
|
|
15
|
+
*/
|
|
16
|
+
onNodeCheck?: (node: LazyTreeNode, checked: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 节点点击回调
|
|
19
|
+
*/
|
|
20
|
+
onNodeClick?: (node: LazyTreeNode, event: MouseEvent) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 节点展开回调
|
|
23
|
+
*/
|
|
24
|
+
onNodeExpand?: (node: LazyTreeNode, expanded: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 路径变化回调,用于父组件同步面包屑
|
|
27
|
+
*/
|
|
28
|
+
onPathChange?: (path: LazyTreeNode[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 受控路径(根 -> 当前层),由父组件传入
|
|
31
|
+
*/
|
|
32
|
+
path?: LazyTreeNode[];
|
|
33
|
+
/**
|
|
34
|
+
* 是否显示搜索框
|
|
35
|
+
*/
|
|
36
|
+
showSearch?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 默认选中keys
|
|
39
|
+
*/
|
|
40
|
+
defaultCheckedKeys?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* 高亮选中
|
|
43
|
+
*/
|
|
44
|
+
highlight?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 标识分隔符
|
|
47
|
+
*/
|
|
48
|
+
separator?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 过滤值
|
|
51
|
+
*/
|
|
52
|
+
filter?: string;
|
|
53
|
+
/**
|
|
54
|
+
* 是否可拖拽
|
|
55
|
+
*/
|
|
56
|
+
draggable?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface LazyListTreeRef {
|
|
59
|
+
/**
|
|
60
|
+
* 重载节点
|
|
61
|
+
* @param node
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
overloadNode: (node: LazyTreeNode) => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export declare const LazyListTree: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<LazyListTreeProps> & {
|
|
67
|
+
ref?: import('preact').Ref<LazyListTreeRef> | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
export {};
|
|
@@ -40,8 +40,18 @@ export interface LazyTreeNode {
|
|
|
40
40
|
* 自定义图标
|
|
41
41
|
*/
|
|
42
42
|
icon?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 原始数据
|
|
45
|
+
*/
|
|
46
|
+
data: Record<string, any>;
|
|
47
|
+
/**
|
|
48
|
+
* @description 根节点标识
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @memberof LazyTreeNode
|
|
51
|
+
*/
|
|
52
|
+
rootId: string;
|
|
43
53
|
}
|
|
44
|
-
|
|
54
|
+
interface LazyTreeProps {
|
|
45
55
|
/**
|
|
46
56
|
* 根节点数据
|
|
47
57
|
*/
|
|
@@ -63,6 +73,14 @@ export interface LazyTreeProps {
|
|
|
63
73
|
* 节点展开回调
|
|
64
74
|
*/
|
|
65
75
|
onNodeExpand?: (node: LazyTreeNode, expanded: boolean) => void;
|
|
76
|
+
/**
|
|
77
|
+
* 当前活动路径变化回调(用户最后点击/展开的路径)
|
|
78
|
+
*/
|
|
79
|
+
onActivePathChange?: (path: LazyTreeNode[]) => void;
|
|
80
|
+
/**
|
|
81
|
+
* 当前激活路径
|
|
82
|
+
*/
|
|
83
|
+
activePath?: LazyTreeNode[];
|
|
66
84
|
/**
|
|
67
85
|
* 是否显示搜索框
|
|
68
86
|
*/
|
|
@@ -75,6 +93,10 @@ export interface LazyTreeProps {
|
|
|
75
93
|
* 高亮选中
|
|
76
94
|
*/
|
|
77
95
|
highlight?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 高亮选中父节点
|
|
98
|
+
*/
|
|
99
|
+
highlightParent?: boolean;
|
|
78
100
|
/**
|
|
79
101
|
* 是否在点击节点的时候展开或者收缩节点
|
|
80
102
|
*/
|
|
@@ -83,6 +105,14 @@ export interface LazyTreeProps {
|
|
|
83
105
|
* 标识分隔符
|
|
84
106
|
*/
|
|
85
107
|
separator?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 过滤值
|
|
110
|
+
*/
|
|
111
|
+
filter?: string;
|
|
112
|
+
/**
|
|
113
|
+
* 是否可拖拽
|
|
114
|
+
*/
|
|
115
|
+
draggable?: boolean;
|
|
86
116
|
}
|
|
87
117
|
/**
|
|
88
118
|
* 懒加载树组件
|
|
@@ -90,3 +120,4 @@ export interface LazyTreeProps {
|
|
|
90
120
|
* 具有懒加载、搜索、展开折叠等功能
|
|
91
121
|
*/
|
|
92
122
|
export declare const LazyTree: (props: LazyTreeProps) => import("preact").JSX.Element;
|
|
123
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, RefObject, JSX } from 'preact';
|
|
2
2
|
import { Namespace } from '../../utils';
|
|
3
3
|
import { AiChatController, AiTopicController } from '../../controller';
|
|
4
|
+
import { AiActionPanelController } from '../../controller/ai-action-panel/ai-action-panel.controller';
|
|
4
5
|
import { IChatToolbarItem, IExtensionOptions } from '../../interface';
|
|
5
6
|
|
|
6
7
|
export interface FlatChatContainerProps {
|
|
@@ -54,10 +55,17 @@ export interface FlatChatContainerProps {
|
|
|
54
55
|
* @memberof FlatChatContainerProps
|
|
55
56
|
*/
|
|
56
57
|
extension?: IExtensionOptions;
|
|
58
|
+
/**
|
|
59
|
+
* @description 操作区面板控制器
|
|
60
|
+
* @type {AiActionPanelController}
|
|
61
|
+
* @memberof FlatChatContainerProps
|
|
62
|
+
*/
|
|
63
|
+
actionPanel?: AiActionPanelController;
|
|
57
64
|
}
|
|
58
65
|
interface FlatContainerContext {
|
|
59
66
|
enableBackFill: boolean;
|
|
60
67
|
}
|
|
68
|
+
export declare const DEFAULT_FLAT_CONTAINER_CONTEXT: FlatContainerContext;
|
|
61
69
|
export declare const FlatContainerContext: import('preact').Context<FlatContainerContext>;
|
|
62
70
|
/**
|
|
63
71
|
* 平铺聊天容器,无拖拽/缩放/全屏/最小化,铺满外部容器
|
|
@@ -92,6 +100,14 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
92
100
|
* 输入区高度拖动时其父容器高度(px)
|
|
93
101
|
*/
|
|
94
102
|
inputDragContainerHeight: number;
|
|
103
|
+
/**
|
|
104
|
+
* 操作区面板上一帧显示状态(用于 componentDidUpdate 边沿检测)
|
|
105
|
+
*/
|
|
106
|
+
private panelVisiblePrev;
|
|
107
|
+
/**
|
|
108
|
+
* 操作区面板宽度拖动起始值(px)
|
|
109
|
+
*/
|
|
110
|
+
private panelDragStartWidth;
|
|
95
111
|
state: {
|
|
96
112
|
mountedSlots: Record<string, boolean>;
|
|
97
113
|
inputHeight: number | null;
|
|
@@ -116,6 +132,11 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
116
132
|
* @memberof FlatChatContainer
|
|
117
133
|
*/
|
|
118
134
|
componentDidUpdate(prevProps: FlatChatContainerProps): void;
|
|
135
|
+
/**
|
|
136
|
+
* @description 同步操作区面板状态(展开收起动画由 CSS 过渡完成)
|
|
137
|
+
* @memberof FlatChatContainer
|
|
138
|
+
*/
|
|
139
|
+
syncPanelState(): void;
|
|
119
140
|
/**
|
|
120
141
|
* @description 异步挂载扩展插槽
|
|
121
142
|
* @private
|
|
@@ -153,6 +174,19 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
153
174
|
* 侧栏宽度拖动结束
|
|
154
175
|
*/
|
|
155
176
|
handleSidebarResizeEnd: () => void;
|
|
177
|
+
/**
|
|
178
|
+
* 操作区面板宽度拖动开始
|
|
179
|
+
*/
|
|
180
|
+
handlePanelResizeStart: () => void;
|
|
181
|
+
/**
|
|
182
|
+
* 操作区面板宽度拖动中
|
|
183
|
+
* - 向左拖:主内容区变窄、面板变宽;向右拖反之
|
|
184
|
+
*/
|
|
185
|
+
handlePanelResizeMove: (delta: number) => void;
|
|
186
|
+
/**
|
|
187
|
+
* 操作区面板宽度拖动结束(持久化)
|
|
188
|
+
*/
|
|
189
|
+
handlePanelResizeEnd: () => void;
|
|
156
190
|
/**
|
|
157
191
|
* @description 获取输入区高度缓存key
|
|
158
192
|
* @returns {string}
|
|
@@ -189,6 +223,12 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
189
223
|
* @memberof FlatChatContainer
|
|
190
224
|
*/
|
|
191
225
|
renderHeader(): JSX.Element;
|
|
226
|
+
/**
|
|
227
|
+
* @description 绘制右侧操作区(含分隔条)
|
|
228
|
+
* - DOM 常驻,宽度随 visible 切换由 CSS 过渡展开/收起
|
|
229
|
+
* @memberof FlatChatContainer
|
|
230
|
+
*/
|
|
231
|
+
renderActionRegion(): JSX.Element | null;
|
|
192
232
|
render(): JSX.Element;
|
|
193
233
|
}
|
|
194
234
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ChatContainer } from './chat-container/chat-container';
|
|
2
2
|
export { FlatChatContainer } from './flat-chat-container/flat-chat-container';
|
|
3
|
+
export { ChatActionPanel } from './chat-action-panel/chat-action-panel';
|
|
3
4
|
export { SimpleChatContainer } from './simple-chat-container/simple-chat-container';
|
|
4
5
|
export { ChatQuesition } from './chat-quesition/chat-quesition';
|
|
@@ -18,6 +18,14 @@ export declare enum AIChatConst {
|
|
|
18
18
|
* 聊天输入区高度缓存
|
|
19
19
|
*/
|
|
20
20
|
INPUT_HEIGHT = "ai-chat-input-height",
|
|
21
|
+
/**
|
|
22
|
+
* 操作区面板宽度缓存
|
|
23
|
+
*/
|
|
24
|
+
ACTION_PANEL_WIDTH = "ai-chat-action-panel-width",
|
|
25
|
+
/**
|
|
26
|
+
* 操作区面板默认宽度(px)
|
|
27
|
+
*/
|
|
28
|
+
ACTION_PANEL_DEFAULT_WIDTH = 380,
|
|
21
29
|
/**
|
|
22
30
|
* 数据库名称
|
|
23
31
|
*/
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Signal } from '@preact/signals';
|
|
2
|
+
import { TActionPanelComponent } from '../../interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 将操作区面板宽度校正到合理区间 [最小宽度, 容器宽度/3]
|
|
6
|
+
*
|
|
7
|
+
* @param {number} width 目标宽度
|
|
8
|
+
* @param {number} containerWidth 容器整体宽度
|
|
9
|
+
* @returns {*} {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare function clampPanelWidth(width: number, containerWidth: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* 操作区面板控制器
|
|
14
|
+
* - 面板为容器级单例,挂在 ChatBaseController 上,切话题不重建
|
|
15
|
+
* - 展开收起动画由容器 CSS 过渡完成,控制器不参与
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
* @class AiActionPanelController
|
|
19
|
+
*/
|
|
20
|
+
export declare class AiActionPanelController {
|
|
21
|
+
/**
|
|
22
|
+
* 面板是否显示
|
|
23
|
+
*/
|
|
24
|
+
readonly visible: Signal<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* 面板当前宽度(px)
|
|
27
|
+
*/
|
|
28
|
+
readonly width: Signal<number>;
|
|
29
|
+
/**
|
|
30
|
+
* 面板标题
|
|
31
|
+
*/
|
|
32
|
+
readonly caption: Signal<string>;
|
|
33
|
+
/**
|
|
34
|
+
* 面板内容组件
|
|
35
|
+
*/
|
|
36
|
+
readonly component: Signal<TActionPanelComponent | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* 内容组件额外参数
|
|
39
|
+
*/
|
|
40
|
+
readonly params: Signal<Record<string, any> | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* 当前业务域key(渲染内容组件时作为key传入,不同业务域切换时强制重挂载)
|
|
43
|
+
*/
|
|
44
|
+
readonly key: Signal<string>;
|
|
45
|
+
/**
|
|
46
|
+
* 组件外层容器id(用于宽度缓存隔离)
|
|
47
|
+
*/
|
|
48
|
+
private compWrapperId;
|
|
49
|
+
/**
|
|
50
|
+
* 打开操作区面板
|
|
51
|
+
* - 已打开时仅替换标题、内容组件与额外参数
|
|
52
|
+
* - 首次打开时从缓存恢复面板宽度(无缓存则沿用当前值)
|
|
53
|
+
*
|
|
54
|
+
* @param {string} caption 标题
|
|
55
|
+
* @param {TActionPanelComponent} component 内容组件
|
|
56
|
+
* @param {Record<string, any>} [params] 额外参数(作为内容组件props传入)
|
|
57
|
+
* @param {string} [key] 业务域key(内容组件渲染key,不同业务域切换时强制重挂载)
|
|
58
|
+
* @memberof AiActionPanelController
|
|
59
|
+
*/
|
|
60
|
+
open(caption: string, component: TActionPanelComponent, params?: Record<string, any>, key?: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* 刷新面板内容(会话切换时调用)
|
|
63
|
+
* - 面板未打开时不做处理(下次 open 会生成全新参数)
|
|
64
|
+
* - 新旧 key 一致时跳过刷新(同一业务域无需重挂载)
|
|
65
|
+
* - params 中包含 controller 时替换为激活会话的控制器
|
|
66
|
+
* - 重置 key 强制内容组件重挂载并重新加载数据
|
|
67
|
+
*
|
|
68
|
+
* @param {string} [key] 业务域key(未传时生成 uuid 强制刷新)
|
|
69
|
+
* @param {unknown} [controller] 激活会话的聊天控制器
|
|
70
|
+
* @memberof AiActionPanelController
|
|
71
|
+
*/
|
|
72
|
+
refresh(key?: string, controller?: unknown): void;
|
|
73
|
+
/**
|
|
74
|
+
* 关闭操作区面板(收起动画由容器 CSS 过渡完成)
|
|
75
|
+
*
|
|
76
|
+
* @memberof AiActionPanelController
|
|
77
|
+
*/
|
|
78
|
+
close(): void;
|
|
79
|
+
/**
|
|
80
|
+
* 更新面板宽度
|
|
81
|
+
*
|
|
82
|
+
* @param {number} px 宽度(px)
|
|
83
|
+
* @memberof AiActionPanelController
|
|
84
|
+
*/
|
|
85
|
+
updateWidth(px: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* 提交当前宽度(持久化)
|
|
88
|
+
*
|
|
89
|
+
* @memberof AiActionPanelController
|
|
90
|
+
*/
|
|
91
|
+
commitWidth(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 注入组件外层容器id
|
|
94
|
+
*
|
|
95
|
+
* @param {string} id
|
|
96
|
+
* @memberof AiActionPanelController
|
|
97
|
+
*/
|
|
98
|
+
injectCompWrapperId(id: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* 读取宽度缓存
|
|
101
|
+
*
|
|
102
|
+
* @returns {*} {(number | undefined)}
|
|
103
|
+
* @memberof AiActionPanelController
|
|
104
|
+
*/
|
|
105
|
+
readWidthCache(): number | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* 重置全部状态(整个聊天窗口关闭时调用)
|
|
108
|
+
*
|
|
109
|
+
* @memberof AiActionPanelController
|
|
110
|
+
*/
|
|
111
|
+
reset(): void;
|
|
112
|
+
/**
|
|
113
|
+
* 获取宽度缓存key
|
|
114
|
+
*
|
|
115
|
+
* @returns {string}
|
|
116
|
+
* @memberof AiActionPanelController
|
|
117
|
+
*/
|
|
118
|
+
private getCacheKey;
|
|
119
|
+
}
|