knight-ui 1.2.0 → 1.2.4
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.
|
@@ -40,6 +40,8 @@ export interface AIChatInputProps extends UIProps {
|
|
|
40
40
|
minRows?: number;
|
|
41
41
|
/** 最大行数,超出后滚动 @default 4 */
|
|
42
42
|
maxRows?: number;
|
|
43
|
+
/** 底部工具条内容(输入框内、textarea 下方、发送键左侧) —— 库不关心放什么,由调用方组装;不传则保留 20px 空白垫高 */
|
|
44
|
+
bottomBar?: React.ReactNode;
|
|
43
45
|
}
|
|
44
46
|
interface AIChatInputState extends UIState {
|
|
45
47
|
value: string;
|
|
@@ -9,12 +9,22 @@ type TooltipTheme = "dark" | "light";
|
|
|
9
9
|
export declare class Tooltip extends AbstractUI<TooltipProps, TooltipState> {
|
|
10
10
|
private zIndex;
|
|
11
11
|
private wrapperRef;
|
|
12
|
+
private bubbleRef;
|
|
13
|
+
/** 视口夹取的累计偏移 — 量出溢出后回填,两个都为 0 表示无需偏移 */
|
|
14
|
+
private shiftX;
|
|
15
|
+
private shiftY;
|
|
12
16
|
private animTimer;
|
|
13
17
|
private leaveTimer;
|
|
14
18
|
private enterTimer;
|
|
15
19
|
constructor(props: TooltipProps);
|
|
16
20
|
componentDidMount(): void;
|
|
17
21
|
componentDidUpdate(prevProps: Readonly<TooltipProps>): void;
|
|
22
|
+
/**
|
|
23
|
+
* 视口夹取 — 气泡是固定定位,只按触发元素居中,靠屏幕边缘时会挂出去一截。
|
|
24
|
+
* 量在 componentDidUpdate:此时 DOM 已提交、浏览器尚未绘制,补一次 setState 仍落在同一帧,
|
|
25
|
+
* 校正过程不可见(不会先闪一下再跳)。偏移累计到 shift 上,收敛后不再 setState。
|
|
26
|
+
*/
|
|
27
|
+
private clampToViewport;
|
|
18
28
|
componentWillUnmount(): void;
|
|
19
29
|
private enter;
|
|
20
30
|
private exit;
|
|
@@ -22,6 +32,8 @@ export declare class Tooltip extends AbstractUI<TooltipProps, TooltipState> {
|
|
|
22
32
|
private cleanup;
|
|
23
33
|
protected OnRenderContent(): React.ReactElement;
|
|
24
34
|
private getArrowStyle;
|
|
35
|
+
/** 叠加视口夹取偏移 — 走 transform 而不是改 left/right:12 个方位的锚点各不相同,只有位移对全体一致 */
|
|
36
|
+
private OnShiftPosition;
|
|
25
37
|
private calcPosition;
|
|
26
38
|
}
|
|
27
39
|
type TooltipAnimPhase = "entering" | "entered" | "leaving" | "exited";
|
|
@@ -30,6 +42,8 @@ export interface TooltipProps extends UIProps {
|
|
|
30
42
|
defaultVisible?: boolean;
|
|
31
43
|
content?: React.ReactNode;
|
|
32
44
|
title?: React.ReactNode;
|
|
45
|
+
/** 内容宽度上限(px) — 传了就允许换行并以它为上限;不传则单行不换行 */
|
|
46
|
+
maxWidth?: number;
|
|
33
47
|
position?: TooltipPosition;
|
|
34
48
|
trigger?: "hover" | "click" | "focus" | "custom";
|
|
35
49
|
theme?: TooltipTheme;
|
|
@@ -2,12 +2,15 @@ import React from "react";
|
|
|
2
2
|
import { AbstractUI, type UIProps, type UIState } from "../../base";
|
|
3
3
|
/**
|
|
4
4
|
* 键值编辑器 — 动态 key/value 行,支持增删. 用法: <KeyValueEditor value={obj} onChange={setObj} />
|
|
5
|
+
* - disabled 时输入框置灰、增删按钮不渲染,四个 handler 也各自挡一道(防程序侧调用)
|
|
5
6
|
*/
|
|
6
7
|
export declare class KeyValueEditor extends AbstractUI<KeyValueEditorProps, KeyValueEditorState> {
|
|
7
8
|
private seed;
|
|
8
9
|
/** 标记内部编辑操作,阻止 componentDidUpdate 覆盖状态 */
|
|
9
10
|
private internalEdit;
|
|
10
11
|
constructor(props: KeyValueEditorProps);
|
|
12
|
+
/** 是否禁用 — 输入与增删一律不响应 */
|
|
13
|
+
private get isDisabled();
|
|
11
14
|
componentDidUpdate(prevProps: Readonly<KeyValueEditorProps>): void;
|
|
12
15
|
private static rowsEqual;
|
|
13
16
|
static objectToRows(obj: Record<string, any>): KeyValueRow[];
|