knight-ui 1.1.7 → 1.1.8
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.
|
@@ -7,6 +7,16 @@ export declare class Modal extends AbstractUI<ModalProps, ModalState> {
|
|
|
7
7
|
private zIndex;
|
|
8
8
|
private animTimer;
|
|
9
9
|
private escHandler;
|
|
10
|
+
/** 本次打开是否加了 body 滚动锁 —— 容器模式下不加, 清理时必须成对判断 */
|
|
11
|
+
private scrollLocked;
|
|
12
|
+
/**
|
|
13
|
+
* 解析 getPopupContainer 指定的挂载容器。
|
|
14
|
+
*
|
|
15
|
+
* 返回 null 表示"照旧挂到 body、按视口定位": 没传 getPopupContainer、或回调返回空
|
|
16
|
+
* (容器还没挂上)都走这条路。绝不把"没拿到容器"当成"容器模式" —— 那样会渲染出一个
|
|
17
|
+
* position:absolute 却仍挂在 body 上的弹窗, top:50% 变成相对整页, 直接跑出视野。
|
|
18
|
+
*/
|
|
19
|
+
private get popupContainer();
|
|
10
20
|
constructor(props: ModalProps);
|
|
11
21
|
componentDidMount(): void;
|
|
12
22
|
componentDidUpdate(prevProps: Readonly<ModalProps>): void;
|
|
@@ -35,6 +45,12 @@ export interface ModalProps extends UIProps {
|
|
|
35
45
|
size?: "small" | "medium" | "large";
|
|
36
46
|
onOk?: () => void | Promise<void>;
|
|
37
47
|
onCancel?: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* 指定挂载容器。传了就渲染到该容器内, 并把定位从视口(fixed/vw/vh)切成容器
|
|
50
|
+
* (absolute/%), 同时不再锁 body 滚动 —— 用于把对话框嵌进一个局部区域。
|
|
51
|
+
* 不传时行为与从前完全一致(挂 body + fixed)。
|
|
52
|
+
*/
|
|
53
|
+
getPopupContainer?: () => HTMLElement;
|
|
38
54
|
}
|
|
39
55
|
interface ModalState extends UIState {
|
|
40
56
|
animPhase: ModalAnimPhase;
|
|
@@ -8,6 +8,16 @@ export declare class SideSheet extends AbstractUI<SideSheetProps, SideSheetState
|
|
|
8
8
|
private zIndex;
|
|
9
9
|
private animTimer;
|
|
10
10
|
private escHandler;
|
|
11
|
+
/** 本次打开是否加了 body 滚动锁 —— 容器模式下不加, 清理时必须成对判断 */
|
|
12
|
+
private scrollLocked;
|
|
13
|
+
/**
|
|
14
|
+
* 解析 getPopupContainer 指定的挂载容器。
|
|
15
|
+
*
|
|
16
|
+
* 返回 null 表示"照旧挂到 body、按视口定位": 没传 getPopupContainer、或回调返回空
|
|
17
|
+
* (容器还没挂上)都走这条路。绝不把"没拿到容器"当成"容器模式" —— 那样会渲染出一个
|
|
18
|
+
* position:absolute 却仍挂在 body 上的抽屉, 它靠 top:0/bottom:0 张开, 会直接铺满整页。
|
|
19
|
+
*/
|
|
20
|
+
private get popupContainer();
|
|
11
21
|
constructor(props: SideSheetProps);
|
|
12
22
|
componentDidMount(): void;
|
|
13
23
|
componentDidUpdate(prevProps: Readonly<SideSheetProps>): void;
|
|
@@ -32,6 +42,11 @@ export interface SideSheetProps extends UIProps {
|
|
|
32
42
|
onCancel?: () => void;
|
|
33
43
|
afterClose?: () => void;
|
|
34
44
|
keepDOM?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 指定挂载容器。传了就渲染到该容器内, 并把定位从视口(fixed/vw)切成容器
|
|
47
|
+
* (absolute/%), 同时不再锁 body 滚动 —— 用于把抽屉嵌进一个局部区域。
|
|
48
|
+
* 不传时行为与从前完全一致(挂 body + fixed)。
|
|
49
|
+
*/
|
|
35
50
|
getPopupContainer?: () => HTMLElement;
|
|
36
51
|
}
|
|
37
52
|
interface SideSheetState extends UIState {
|
|
@@ -8,7 +8,8 @@ export interface TableColumn {
|
|
|
8
8
|
key: string;
|
|
9
9
|
title: React.ReactNode;
|
|
10
10
|
dataIndex?: string;
|
|
11
|
-
width
|
|
11
|
+
/** 列宽。数字按 px; 字符串原样交给 CSS 的 width(如 "18%") —— 表是 tableLayout:fixed, 百分比直接生效 */
|
|
12
|
+
width?: number | string;
|
|
12
13
|
render?: (value: any, record: Record<string, any>, index: number) => React.ReactNode;
|
|
13
14
|
/**
|
|
14
15
|
* 排序比较函数。给了就在表头出排序按钮。
|
|
@@ -82,6 +83,11 @@ export interface TableProps extends UIProps {
|
|
|
82
83
|
selectedRowKeys?: (string | number)[];
|
|
83
84
|
defaultSelectedRowKeys?: (string | number)[];
|
|
84
85
|
onRowSelectionChange?: (selectedRowKeys: (string | number)[]) => void;
|
|
86
|
+
/**
|
|
87
|
+
* 行级属性钩子(antd 同款形状): 返回值展开到该行的 <tr> 上, 可用来挂 onClick / title / data-*。
|
|
88
|
+
* 返回值里的 className 会与行自身的类合并(不是替换), 所以 ku-table-row 的底色不会丢。
|
|
89
|
+
*/
|
|
90
|
+
onRow?: (record: Record<string, any>, index: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
85
91
|
/** 表头排序/筛选发生变化时回调(服务端分页时可据此重新取数) */
|
|
86
92
|
onChange?: (sorter: TableSorter, filters: Record<string, string[]>) => void;
|
|
87
93
|
}
|
|
@@ -54,6 +54,8 @@ export interface FormApi {
|
|
|
54
54
|
getValues: () => Record<string, any>;
|
|
55
55
|
setValues: (values: Record<string, any>) => void;
|
|
56
56
|
validate: () => Promise<Record<string, any> | null>;
|
|
57
|
+
/** 校验并提交: 通过才触发 onSubmit, 否则触发 onSubmitFail。validate() 是纯查询, 不会碰 onSubmit */
|
|
58
|
+
submit: () => Promise<Record<string, any> | null>;
|
|
57
59
|
reset: () => void;
|
|
58
60
|
setError: (field: string, error: string | null) => void;
|
|
59
61
|
/** 动态添加字段(若已存在则更新) */
|
|
@@ -92,6 +94,14 @@ export declare class Form extends AbstractUI<FormProps, FormState> {
|
|
|
92
94
|
private setFieldValue;
|
|
93
95
|
private setFieldsValue;
|
|
94
96
|
private validate;
|
|
97
|
+
/**
|
|
98
|
+
* 校验并提交: 通过才触发 onSubmit, 否则触发 onSubmitFail。
|
|
99
|
+
*
|
|
100
|
+
* validate() 是**纯查询**, 只返回结果 —— 它从前会在成功时顺手调一次 onSubmit, 于是
|
|
101
|
+
* "拿 validate() 当确认按钮的扳机"与"在 onSubmit 里落库"会叠成提交两次。要老行为的
|
|
102
|
+
* 调用方改用 submit()。
|
|
103
|
+
*/
|
|
104
|
+
private submit;
|
|
95
105
|
private reset;
|
|
96
106
|
private setError;
|
|
97
107
|
protected OnRenderContent(): React.ReactElement;
|
|
@@ -111,6 +121,11 @@ export interface FormProps extends UIProps {
|
|
|
111
121
|
onSubmit?: (values: Record<string, any>) => void;
|
|
112
122
|
/** 提交失败回调 */
|
|
113
123
|
onSubmitFail?: (values: Record<string, any>) => void;
|
|
124
|
+
/**
|
|
125
|
+
* 字段值变化回调 —— 非受控模型下唯一能感知"值变了"的信号(脏检查 / 自动保存门控)。
|
|
126
|
+
* 在字段值写回之后触发, 第三个参数是当前全部已注册字段的值的快照。
|
|
127
|
+
*/
|
|
128
|
+
onValuesChange?: (field: string, value: any, values: Record<string, any>) => void;
|
|
114
129
|
}
|
|
115
130
|
interface FormState extends UIState {
|
|
116
131
|
validating: boolean;
|
|
@@ -34,8 +34,11 @@ export declare class Mask {
|
|
|
34
34
|
* @param opacity 透明度(0-1),浮层组件根据动画状态传入
|
|
35
35
|
* @param onClick 点击遮罩回调
|
|
36
36
|
* @param duration 过渡时长(ms)
|
|
37
|
+
* @param position 定位方式。视口模式传 "fixed"(默认); 浮层被渲染进某个局部容器时
|
|
38
|
+
* 必须传 "absolute" —— fixed 会相对视口铺满整屏, 把容器外的内容
|
|
39
|
+
* 也一起蒙上, 与"对话框嵌在容器里"这件事自相矛盾。
|
|
37
40
|
*/
|
|
38
|
-
static render(zIndex: number, opacity: number, onClick?: () => void, duration?: number): React.ReactElement;
|
|
41
|
+
static render(zIndex: number, opacity: number, onClick?: () => void, duration?: number, position?: "fixed" | "absolute"): React.ReactElement;
|
|
39
42
|
/**
|
|
40
43
|
* 带"洞"的遮罩 —— rect 那一块不被遮住, 用于 UserGuide 高亮目标。
|
|
41
44
|
*
|