@zjpcy/simple-design 1.3.0 → 1.3.1
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/cjs/index.js +1 -1
- package/dist/es/Layout/styles.js +1 -1
- package/dist/types/Anchor/index.d.ts +7 -0
- package/dist/types/Anchor/types.d.ts +23 -0
- package/dist/types/Breadcrumb/index.d.ts +5 -0
- package/dist/types/Breadcrumb/types.d.ts +9 -0
- package/dist/types/Button/Button.d.ts +17 -0
- package/dist/types/Button/index.d.ts +2 -0
- package/dist/types/Carousel/index.d.ts +5 -0
- package/dist/types/Carousel/styles.d.ts +12 -0
- package/dist/types/Carousel/types.d.ts +72 -0
- package/dist/types/Cascader/index.d.ts +5 -0
- package/dist/types/Cascader/types.d.ts +36 -0
- package/dist/types/Checkbox/index.d.ts +8 -0
- package/dist/types/Checkbox/types.d.ts +37 -0
- package/dist/types/ColorPicker/index.d.ts +5 -0
- package/dist/types/ColorPicker/types.d.ts +15 -0
- package/dist/types/CopyToClipboard/index.d.ts +7 -0
- package/dist/types/CopyToClipboard/types.d.ts +5 -0
- package/dist/types/DatePicker/RangePicker.d.ts +4 -0
- package/dist/types/DatePicker/index.d.ts +9 -0
- package/dist/types/DatePicker/styles.d.ts +186 -0
- package/dist/types/DatePicker/types.d.ts +228 -0
- package/dist/types/Divider/index.d.ts +11 -0
- package/dist/types/Drawer/index.d.ts +6 -0
- package/dist/types/Drawer/styles.d.ts +0 -0
- package/dist/types/Drawer/types.d.ts +71 -0
- package/dist/types/Dropdown/index.d.ts +5 -0
- package/dist/types/Dropdown/types.d.ts +25 -0
- package/dist/types/Empty/index.d.ts +5 -0
- package/dist/types/Empty/types.d.ts +17 -0
- package/dist/types/Flex/index.d.ts +5 -0
- package/dist/types/Flex/types.d.ts +11 -0
- package/dist/types/Form/index.d.ts +12 -0
- package/dist/types/Form/styles.d.ts +22 -0
- package/dist/types/Form/types.d.ts +87 -0
- package/dist/types/Grid/index.d.ts +14 -0
- package/dist/types/Grid/styles.d.ts +22 -0
- package/dist/types/Grid/types.d.ts +49 -0
- package/dist/types/Hooks/useClickOutside.d.ts +4 -0
- package/dist/types/Hooks/useCopy.d.ts +2 -0
- package/dist/types/Icon/Icon.d.ts +18 -0
- package/dist/types/Icon/index.d.ts +3 -0
- package/dist/types/Icon/path.d.ts +16 -0
- package/dist/types/Input/AutoComplete.d.ts +0 -0
- package/dist/types/Input/InputBase.d.ts +36 -0
- package/dist/types/Input/Number.d.ts +12 -0
- package/dist/types/Input/Password.d.ts +13 -0
- package/dist/types/Input/Search.d.ts +8 -0
- package/dist/types/Input/Textarea.d.ts +51 -0
- package/dist/types/Input/index.d.ts +16 -0
- package/dist/types/Label/index.d.ts +5 -0
- package/dist/types/Label/styles.d.ts +1 -0
- package/dist/types/Label/types.d.ts +9 -0
- package/dist/types/Layout/LayoutContext.d.ts +15 -0
- package/dist/types/Layout/index.d.ts +86 -0
- package/dist/types/Layout/styles.d.ts +40 -0
- package/dist/types/Layout/types.d.ts +112 -0
- package/dist/types/Marquee/index.d.ts +15 -0
- package/dist/types/Masonry/index.d.ts +5 -0
- package/dist/types/Masonry/types.d.ts +26 -0
- package/dist/types/Menu/index.d.ts +11 -0
- package/dist/types/Menu/styles.d.ts +7 -0
- package/dist/types/Menu/types.d.ts +73 -0
- package/dist/types/Message/Message.d.ts +5 -0
- package/dist/types/Message/index.d.ts +25 -0
- package/dist/types/Message/types.d.ts +16 -0
- package/dist/types/Modal/index.d.ts +5 -0
- package/dist/types/Modal/types.d.ts +34 -0
- package/dist/types/Notice/Notice.d.ts +18 -0
- package/dist/types/Notification/Notification.d.ts +5 -0
- package/dist/types/Notification/types.d.ts +12 -0
- package/dist/types/Pagination/index.d.ts +5 -0
- package/dist/types/Pagination/types.d.ts +38 -0
- package/dist/types/Popconfirm/index.d.ts +6 -0
- package/dist/types/Popconfirm/types.d.ts +30 -0
- package/dist/types/Progress/index.d.ts +6 -0
- package/dist/types/Progress/styles.d.ts +0 -0
- package/dist/types/Progress/types.d.ts +59 -0
- package/dist/types/Radio/index.d.ts +8 -0
- package/dist/types/Radio/types.d.ts +30 -0
- package/dist/types/Rate/index.d.ts +5 -0
- package/dist/types/Rate/types.d.ts +27 -0
- package/dist/types/Select/index.d.ts +28 -0
- package/dist/types/Select/styles.d.ts +45 -0
- package/dist/types/Select/types.d.ts +134 -0
- package/dist/types/Slider/index.d.ts +5 -0
- package/dist/types/Slider/types.d.ts +28 -0
- package/dist/types/Space/index.d.ts +5 -0
- package/dist/types/Space/types.d.ts +31 -0
- package/dist/types/Spin/index.d.ts +6 -0
- package/dist/types/Spin/types.d.ts +44 -0
- package/dist/types/Splitter/index.d.ts +9 -0
- package/dist/types/Splitter/styles.d.ts +61 -0
- package/dist/types/Splitter/types.d.ts +115 -0
- package/dist/types/Steps/index.d.ts +5 -0
- package/dist/types/Steps/types.d.ts +31 -0
- package/dist/types/Switch/index.d.ts +16 -0
- package/dist/types/Switch/styles.d.ts +36 -0
- package/dist/types/Switch/types.d.ts +81 -0
- package/dist/types/Table/SortableRow.d.ts +26 -0
- package/dist/types/Table/index.d.ts +53 -0
- package/dist/types/Tabs/index.d.ts +5 -0
- package/dist/types/Tabs/types.d.ts +32 -0
- package/dist/types/Tag/index.d.ts +6 -0
- package/dist/types/Tag/styles.d.ts +52 -0
- package/dist/types/Tag/types.d.ts +46 -0
- package/dist/types/TimePicker/RangePicker.d.ts +4 -0
- package/dist/types/TimePicker/TimePickerPanel.d.ts +4 -0
- package/dist/types/TimePicker/index.d.ts +10 -0
- package/dist/types/TimePicker/styles.d.ts +33 -0
- package/dist/types/TimePicker/types.d.ts +151 -0
- package/dist/types/Tooltip/Tooltip.d.ts +15 -0
- package/dist/types/Tooltip/index.d.ts +2 -0
- package/dist/types/Top/index.d.ts +16 -0
- package/dist/types/Transfer/index.d.ts +21 -0
- package/dist/types/Transfer/styles.d.ts +104 -0
- package/dist/types/Transfer/types.d.ts +232 -0
- package/dist/types/Tree/index.d.ts +12 -0
- package/dist/types/Tree/styles.d.ts +54 -0
- package/dist/types/Tree/types.d.ts +202 -0
- package/dist/types/TreeSelect/index.d.ts +24 -0
- package/dist/types/TreeSelect/styles.d.ts +56 -0
- package/dist/types/TreeSelect/types.d.ts +107 -0
- package/dist/types/Typography/index.d.ts +5 -0
- package/dist/types/Typography/types.d.ts +13 -0
- package/dist/types/Upload/index.d.ts +6 -0
- package/dist/types/Upload/styles.d.ts +28 -0
- package/dist/types/Upload/types.d.ts +90 -0
- package/dist/types/index.d.ts +63 -0
- package/package.json +3 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Transfer 数据项接口
|
|
4
|
+
* 支持自定义字段名,通过 fieldNames 属性指定 key 和 title 对应的字段
|
|
5
|
+
*/
|
|
6
|
+
export interface TransferItem {
|
|
7
|
+
/** 唯一标识(默认字段名,可通过 fieldNames.key 自定义) */
|
|
8
|
+
key?: string;
|
|
9
|
+
/** 显示标题(默认字段名,可通过 fieldNames.title 自定义) */
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
/** 是否禁用 */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** 允许自定义字段 */
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 自定义字段名称接口
|
|
18
|
+
*/
|
|
19
|
+
export interface FieldNames {
|
|
20
|
+
/** 唯一标识字段名,默认 'key' */
|
|
21
|
+
key?: string;
|
|
22
|
+
/** 显示标题字段名,默认 'title' */
|
|
23
|
+
title?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Transfer 组件属性接口
|
|
27
|
+
*/
|
|
28
|
+
export interface TransferProps {
|
|
29
|
+
/** 数据源 */
|
|
30
|
+
dataSource: TransferItem[];
|
|
31
|
+
/** 自定义字段名称 */
|
|
32
|
+
fieldNames?: FieldNames;
|
|
33
|
+
/** 右侧已选中的 key 集合 */
|
|
34
|
+
targetKeys?: string[];
|
|
35
|
+
/** 默认已选中的 key 集合(非受控模式) */
|
|
36
|
+
defaultTargetKeys?: string[];
|
|
37
|
+
/** 不可选择的 key 集合 */
|
|
38
|
+
selectedKeys?: string[];
|
|
39
|
+
/** 默认已选择的 key 集合(非受控模式) */
|
|
40
|
+
defaultSelectedKeys?: string[];
|
|
41
|
+
/** 是否显示搜索框 */
|
|
42
|
+
showSearch?: boolean;
|
|
43
|
+
/** 是否禁用整个组件 */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** 左侧标题 */
|
|
46
|
+
leftTitle?: ReactNode;
|
|
47
|
+
/** 右侧标题 */
|
|
48
|
+
rightTitle?: ReactNode;
|
|
49
|
+
/** 左侧描述信息,显示在列表下方 */
|
|
50
|
+
leftDescription?: ReactNode;
|
|
51
|
+
/** 右侧描述信息,显示在列表下方 */
|
|
52
|
+
rightDescription?: ReactNode;
|
|
53
|
+
/** 自定义筛选函数 */
|
|
54
|
+
filterOption?: (inputValue: string, item: TransferItem) => boolean;
|
|
55
|
+
/** 自定义样式 */
|
|
56
|
+
styles?: {
|
|
57
|
+
wrapper?: CSSProperties;
|
|
58
|
+
list?: CSSProperties;
|
|
59
|
+
item?: CSSProperties;
|
|
60
|
+
search?: CSSProperties;
|
|
61
|
+
operation?: CSSProperties;
|
|
62
|
+
};
|
|
63
|
+
/** 列表高度,默认 300px */
|
|
64
|
+
listHeight?: number | string;
|
|
65
|
+
/** 列表宽度,默认 200px */
|
|
66
|
+
listWidth?: number | string;
|
|
67
|
+
/** 选中项发生改变时的回调 */
|
|
68
|
+
onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
|
69
|
+
/** 选项在两栏之间转移时的回调 */
|
|
70
|
+
onChange?: (targetKeys: string[], direction: 'left' | 'right', moveKeys: string[]) => void;
|
|
71
|
+
/** 搜索框内容变化时的回调 */
|
|
72
|
+
onSearch?: (direction: 'left' | 'right', value: string) => void;
|
|
73
|
+
/** 自定义渲染每一项 */
|
|
74
|
+
render?: (item: TransferItem) => ReactNode;
|
|
75
|
+
/** 自定义 header,传入 null 则不显示 header 区域 */
|
|
76
|
+
header?: (props: {
|
|
77
|
+
direction: 'left' | 'right';
|
|
78
|
+
dataSource: TransferItem[];
|
|
79
|
+
selectedKeys: string[];
|
|
80
|
+
sourceSelectedKeys: string[];
|
|
81
|
+
targetSelectedKeys: string[];
|
|
82
|
+
}) => ReactNode | null;
|
|
83
|
+
/** 自定义搜索区域,传入此函数则替换默认搜索框 */
|
|
84
|
+
search?: (props: {
|
|
85
|
+
direction: 'left' | 'right';
|
|
86
|
+
value: string;
|
|
87
|
+
onChange: (value: string) => void;
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
}) => ReactNode;
|
|
90
|
+
/** 自定义 body 渲染,传入此函数则使用自定义内容替换默认列表 */
|
|
91
|
+
body?: (props: {
|
|
92
|
+
direction: 'left' | 'right';
|
|
93
|
+
dataSource: TransferItem[];
|
|
94
|
+
selectedKeys: string[];
|
|
95
|
+
sourceSelectedKeys: string[];
|
|
96
|
+
targetSelectedKeys: string[];
|
|
97
|
+
onSelectChange: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
|
98
|
+
}) => ReactNode;
|
|
99
|
+
/** 自定义 footer */
|
|
100
|
+
footer?: (props: {
|
|
101
|
+
direction: 'left' | 'right';
|
|
102
|
+
}) => ReactNode;
|
|
103
|
+
/** 自定义行样式 */
|
|
104
|
+
rowClassName?: (item: TransferItem) => string;
|
|
105
|
+
/** 模式,transfer 为双栏穿梭模式(默认),single 为单栏选择模式 */
|
|
106
|
+
mode?: 'transfer' | 'single';
|
|
107
|
+
/** 是否显示加载状态 */
|
|
108
|
+
loading?: boolean;
|
|
109
|
+
/** 自定义 loading 渲染 */
|
|
110
|
+
loadingRender?: () => ReactNode;
|
|
111
|
+
/** 加载延迟时间(毫秒),设置后loading状态会在指定时间后自动取消 */
|
|
112
|
+
loadingDelay?: number;
|
|
113
|
+
/** 是否开启懒加载,默认 false */
|
|
114
|
+
lazyLoad?: boolean;
|
|
115
|
+
/** 懒加载阈值,距离底部多少像素时触发加载,默认 100 */
|
|
116
|
+
lazyLoadThreshold?: number;
|
|
117
|
+
/** 懒加载回调,当滚动到阈值位置时触发,用于加载下一组数据 */
|
|
118
|
+
onLazyLoad?: (direction: 'left' | 'right') => void;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Transfer 列表属性接口
|
|
122
|
+
*/
|
|
123
|
+
export interface TransferListProps {
|
|
124
|
+
/** 列表数据 */
|
|
125
|
+
dataSource: TransferItem[];
|
|
126
|
+
/** 自定义字段名称 */
|
|
127
|
+
fieldNames?: FieldNames;
|
|
128
|
+
/** 已选中的 key 集合 */
|
|
129
|
+
selectedKeys: string[];
|
|
130
|
+
/** 源列表已选中的 key 集合 */
|
|
131
|
+
sourceSelectedKeys: string[];
|
|
132
|
+
/** 目标列表已选中的 key 集合 */
|
|
133
|
+
targetSelectedKeys: string[];
|
|
134
|
+
/** 是否显示搜索框 */
|
|
135
|
+
showSearch: boolean;
|
|
136
|
+
/** 是否禁用 */
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
/** 列表标题 */
|
|
139
|
+
title?: ReactNode;
|
|
140
|
+
/** 列表描述 */
|
|
141
|
+
description?: ReactNode;
|
|
142
|
+
/** 搜索框占位符 */
|
|
143
|
+
searchPlaceholder?: string;
|
|
144
|
+
/** 自定义筛选函数 */
|
|
145
|
+
filterOption?: (inputValue: string, item: TransferItem) => boolean;
|
|
146
|
+
/** 自定义样式 */
|
|
147
|
+
styles?: TransferProps['styles'];
|
|
148
|
+
/** 列表高度 */
|
|
149
|
+
listHeight?: number | string;
|
|
150
|
+
/** 列表宽度 */
|
|
151
|
+
listWidth?: number | string;
|
|
152
|
+
/** 选中项改变回调 */
|
|
153
|
+
onSelectChange: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
|
154
|
+
/** 搜索回调 */
|
|
155
|
+
onSearch?: (value: string) => void;
|
|
156
|
+
/** 自定义渲染 */
|
|
157
|
+
render?: (item: TransferItem) => ReactNode;
|
|
158
|
+
/** 自定义 header */
|
|
159
|
+
header?: (props: {
|
|
160
|
+
direction: 'left' | 'right';
|
|
161
|
+
dataSource: TransferItem[];
|
|
162
|
+
selectedKeys: string[];
|
|
163
|
+
sourceSelectedKeys: string[];
|
|
164
|
+
targetSelectedKeys: string[];
|
|
165
|
+
}) => ReactNode | null;
|
|
166
|
+
/** 自定义搜索区域 */
|
|
167
|
+
search?: (props: {
|
|
168
|
+
direction: 'left' | 'right';
|
|
169
|
+
value: string;
|
|
170
|
+
onChange: (value: string) => void;
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
}) => ReactNode;
|
|
173
|
+
/** 自定义 body */
|
|
174
|
+
body?: (props: {
|
|
175
|
+
direction: 'left' | 'right';
|
|
176
|
+
dataSource: TransferItem[];
|
|
177
|
+
selectedKeys: string[];
|
|
178
|
+
sourceSelectedKeys: string[];
|
|
179
|
+
targetSelectedKeys: string[];
|
|
180
|
+
onSelectChange: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
|
181
|
+
}) => ReactNode;
|
|
182
|
+
/** 自定义 footer */
|
|
183
|
+
footer?: (props: {
|
|
184
|
+
direction: 'left' | 'right';
|
|
185
|
+
}) => ReactNode;
|
|
186
|
+
/** 方向标识 */
|
|
187
|
+
direction: 'left' | 'right';
|
|
188
|
+
/** 自定义行样式 */
|
|
189
|
+
rowClassName?: (item: TransferItem) => string;
|
|
190
|
+
/** 是否显示加载状态 */
|
|
191
|
+
loading?: boolean;
|
|
192
|
+
/** 自定义 loading 渲染 */
|
|
193
|
+
loadingRender?: () => ReactNode;
|
|
194
|
+
/** 加载延迟时间(毫秒),设置后loading状态会在指定时间后自动取消 */
|
|
195
|
+
loadingDelay?: number;
|
|
196
|
+
/** 是否开启懒加载,默认 false */
|
|
197
|
+
lazyLoad?: boolean;
|
|
198
|
+
/** 懒加载阈值,距离底部多少像素时触发加载,默认 100 */
|
|
199
|
+
lazyLoadThreshold?: number;
|
|
200
|
+
/** 懒加载回调,当滚动到阈值位置时触发,用于加载下一组数据 */
|
|
201
|
+
onLazyLoad?: () => void;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Transfer 操作按钮属性接口
|
|
205
|
+
*/
|
|
206
|
+
export interface TransferOperationProps {
|
|
207
|
+
/** 是否禁用移动到右侧按钮 */
|
|
208
|
+
moveToRightDisabled?: boolean;
|
|
209
|
+
/** 是否禁用移动到左侧按钮 */
|
|
210
|
+
moveToLeftDisabled?: boolean;
|
|
211
|
+
/** 移动到右侧回调 */
|
|
212
|
+
onMoveToRight: () => void;
|
|
213
|
+
/** 移动到左侧回调 */
|
|
214
|
+
onMoveToLeft: () => void;
|
|
215
|
+
/** 自定义样式 */
|
|
216
|
+
style?: CSSProperties;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Transfer 搜索框属性接口
|
|
220
|
+
*/
|
|
221
|
+
export interface TransferSearchProps {
|
|
222
|
+
/** 占位符文本 */
|
|
223
|
+
placeholder?: string;
|
|
224
|
+
/** 当前值 */
|
|
225
|
+
value?: string;
|
|
226
|
+
/** 值变化回调 */
|
|
227
|
+
onChange: (value: string) => void;
|
|
228
|
+
/** 是否禁用 */
|
|
229
|
+
disabled?: boolean;
|
|
230
|
+
/** 自定义样式 */
|
|
231
|
+
style?: CSSProperties;
|
|
232
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TreeProps, TreeNode } from './types';
|
|
3
|
+
import './Tree.css';
|
|
4
|
+
export type { TreeProps, TreeNode, TreeNodeTooltip } from './types';
|
|
5
|
+
export interface TreeRef {
|
|
6
|
+
scrollTo: (key: string | number) => void;
|
|
7
|
+
addNode: (parentKey: string | number | null, newNode: TreeNode | TreeNode[]) => void;
|
|
8
|
+
removeNode: (key: string | number) => boolean;
|
|
9
|
+
updateNode: (key: string | number, updates: Partial<Omit<TreeNode, 'key' | 'children'>>) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Tree: React.ForwardRefExoticComponent<TreeProps & React.RefAttributes<TreeRef>>;
|
|
12
|
+
export default Tree;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export declare const treeContainerStyle: CSSProperties;
|
|
3
|
+
export declare const treeNodeStyle: CSSProperties;
|
|
4
|
+
export declare const treeTreenodeStyle: CSSProperties;
|
|
5
|
+
export declare const treeNodeDisabledStyle: CSSProperties;
|
|
6
|
+
export declare const treeNodeContentStyle: CSSProperties;
|
|
7
|
+
export declare const treeNodeContentHoverStyle: CSSProperties;
|
|
8
|
+
export declare const treeNodeSelectedStyle: CSSProperties;
|
|
9
|
+
export declare const treeNodeSelectedHoverStyle: CSSProperties;
|
|
10
|
+
export declare const treeIndentStyle: CSSProperties;
|
|
11
|
+
export declare const treeSwitcherStyle: CSSProperties;
|
|
12
|
+
export declare const treeSwitcherHoverStyle: CSSProperties;
|
|
13
|
+
export declare const treeSwitcherCloseStyle: CSSProperties;
|
|
14
|
+
export declare const treeSwitcherOpenStyle: CSSProperties;
|
|
15
|
+
export declare const treeCheckboxStyle: CSSProperties;
|
|
16
|
+
export declare const treeCheckboxHoverStyle: CSSProperties;
|
|
17
|
+
export declare const treeCheckboxCheckedStyle: CSSProperties;
|
|
18
|
+
export declare const treeCheckboxIndeterminateStyle: CSSProperties;
|
|
19
|
+
export declare const treeCheckboxDisabledStyle: CSSProperties;
|
|
20
|
+
export declare const treeIconStyle: CSSProperties;
|
|
21
|
+
export declare const treeIconSelectedStyle: CSSProperties;
|
|
22
|
+
export declare const treeTitleStyle: CSSProperties;
|
|
23
|
+
export declare const treeChildTreeStyle: CSSProperties;
|
|
24
|
+
export declare const getMotionStyle: (duration: number, expanded: boolean) => CSSProperties;
|
|
25
|
+
export declare const treeLoadingStyle: CSSProperties;
|
|
26
|
+
export declare const treeLoadingIconStyle: CSSProperties;
|
|
27
|
+
export declare const treeSearchStyle: CSSProperties;
|
|
28
|
+
export declare const treeSearchInputStyle: CSSProperties;
|
|
29
|
+
export declare const treeSearchInputFocusStyle: CSSProperties;
|
|
30
|
+
export declare const treeSearchInputHoverStyle: CSSProperties;
|
|
31
|
+
export declare const treeHighlightStyle: CSSProperties;
|
|
32
|
+
export declare const treeEmptyStyle: CSSProperties;
|
|
33
|
+
export declare const treeEmptyIconStyle: CSSProperties;
|
|
34
|
+
export declare const treeDraggableStyle: CSSProperties;
|
|
35
|
+
export declare const treeDraggingStyle: CSSProperties;
|
|
36
|
+
export declare const treeDragOverStyle: CSSProperties;
|
|
37
|
+
export declare const treeDropTargetStyle: CSSProperties;
|
|
38
|
+
export declare const treeLineStyle: CSSProperties;
|
|
39
|
+
export declare const treeLinePointStyle: CSSProperties;
|
|
40
|
+
export declare const getNodeClassNames: (prefixCls: string, options: {
|
|
41
|
+
selected?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
draggable?: boolean;
|
|
44
|
+
dragOver?: boolean;
|
|
45
|
+
isLeaf?: boolean;
|
|
46
|
+
showLine?: boolean;
|
|
47
|
+
}) => string;
|
|
48
|
+
export declare const getContentClassNames: (prefixCls: string, selected?: boolean) => string;
|
|
49
|
+
export declare const getCheckboxClassNames: (prefixCls: string, options: {
|
|
50
|
+
checked?: boolean;
|
|
51
|
+
halfChecked?: boolean;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
}) => string;
|
|
54
|
+
export declare const getSwitcherClassNames: (prefixCls: string, expanded?: boolean) => string;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Tooltip 配置 */
|
|
3
|
+
export interface TreeNodeTooltip {
|
|
4
|
+
/** Tooltip 内容 */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** 位置 */
|
|
7
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
/** 触发方式 */
|
|
9
|
+
trigger?: 'hover' | 'click';
|
|
10
|
+
/** 延迟显示时间(毫秒) */
|
|
11
|
+
delay?: number;
|
|
12
|
+
/** 自定义背景色 */
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
/** 自定义样式 */
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
/** 自定义类名 */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TreeNode {
|
|
20
|
+
/** 节点唯一标识 */
|
|
21
|
+
key: string | number;
|
|
22
|
+
/** 节点标题 */
|
|
23
|
+
title: React.ReactNode;
|
|
24
|
+
/** 节点图标 */
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
/** 子节点 */
|
|
27
|
+
children?: TreeNode[];
|
|
28
|
+
/** 是否禁用 */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** 是否禁用复选框 */
|
|
31
|
+
disableCheckbox?: boolean;
|
|
32
|
+
/** 是否选中 */
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
/** 是否半选 */
|
|
35
|
+
halfChecked?: boolean;
|
|
36
|
+
/** 是否展开 */
|
|
37
|
+
expanded?: boolean;
|
|
38
|
+
/** 是否叶子节点 */
|
|
39
|
+
isLeaf?: boolean;
|
|
40
|
+
/** 加载中 */
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
/** 节点类名 */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** 节点样式 */
|
|
45
|
+
style?: React.CSSProperties;
|
|
46
|
+
/** 自定义渲染 */
|
|
47
|
+
render?: (node: TreeNode) => React.ReactNode;
|
|
48
|
+
/** 节点拖拽相关 */
|
|
49
|
+
draggable?: boolean;
|
|
50
|
+
/** Tooltip 配置,默认不启用 */
|
|
51
|
+
tooltip?: TreeNodeTooltip | boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface TreeProps {
|
|
54
|
+
/** 树数据 */
|
|
55
|
+
treeData?: TreeNode[];
|
|
56
|
+
/** 默认展开的键 */
|
|
57
|
+
defaultExpandedKeys?: (string | number)[];
|
|
58
|
+
/** 展开的键(受控) */
|
|
59
|
+
expandedKeys?: (string | number)[];
|
|
60
|
+
/** 展开/收起回调 */
|
|
61
|
+
onExpand?: (expandedKeys: (string | number)[], { expanded, node, nativeEvent }: {
|
|
62
|
+
expanded: boolean;
|
|
63
|
+
node: TreeNode;
|
|
64
|
+
nativeEvent: MouseEvent;
|
|
65
|
+
}) => void;
|
|
66
|
+
/** 默认选中的键 */
|
|
67
|
+
defaultSelectedKeys?: (string | number)[];
|
|
68
|
+
/** 选中的键(受控) */
|
|
69
|
+
selectedKeys?: (string | number)[];
|
|
70
|
+
/** 选中回调 */
|
|
71
|
+
onSelect?: (selectedKeys: (string | number)[], { selected, node, nativeEvent }: {
|
|
72
|
+
selected: boolean;
|
|
73
|
+
node: TreeNode;
|
|
74
|
+
nativeEvent: MouseEvent;
|
|
75
|
+
}) => void;
|
|
76
|
+
/** 默认勾选的键 */
|
|
77
|
+
defaultCheckedKeys?: (string | number)[];
|
|
78
|
+
/** 勾选的键(受控) */
|
|
79
|
+
checkedKeys?: (string | number)[];
|
|
80
|
+
/** 勾选回调 */
|
|
81
|
+
onCheck?: (checkedKeys: (string | number)[], { checked, node, nativeEvent }: {
|
|
82
|
+
checked: boolean;
|
|
83
|
+
node: TreeNode;
|
|
84
|
+
nativeEvent: MouseEvent;
|
|
85
|
+
}) => void;
|
|
86
|
+
/** 是否显示复选框 */
|
|
87
|
+
checkable?: boolean;
|
|
88
|
+
/** 是否父子关联 */
|
|
89
|
+
checkStrictly?: boolean;
|
|
90
|
+
/** 是否支持多选 */
|
|
91
|
+
multiple?: boolean;
|
|
92
|
+
/** 是否支持搜索 */
|
|
93
|
+
showSearch?: boolean;
|
|
94
|
+
/** 搜索匹配高亮 */
|
|
95
|
+
filterOption?: (search: string, node: TreeNode) => boolean;
|
|
96
|
+
/** 自定义搜索匹配渲染 */
|
|
97
|
+
renderSearch?: (search: string, node: TreeNode) => React.ReactNode;
|
|
98
|
+
/** 是否显示连接线 */
|
|
99
|
+
showLine?: boolean;
|
|
100
|
+
/** 是否显示缩进标识 */
|
|
101
|
+
showIndent?: boolean;
|
|
102
|
+
/** 是否显示图标 */
|
|
103
|
+
showIcon?: boolean;
|
|
104
|
+
/** 是否异步加载数据 */
|
|
105
|
+
loadData?: (node: TreeNode) => Promise<void>;
|
|
106
|
+
/** 动画时长(毫秒) */
|
|
107
|
+
motionDuration?: number;
|
|
108
|
+
/** 是否支持拖拽 */
|
|
109
|
+
draggable?: boolean;
|
|
110
|
+
/** 拖拽开始回调 */
|
|
111
|
+
onDragStart?: (params: {
|
|
112
|
+
event: MouseEvent;
|
|
113
|
+
node: TreeNode;
|
|
114
|
+
}) => void;
|
|
115
|
+
/** 拖拽进入回调 */
|
|
116
|
+
onDragEnter?: (params: {
|
|
117
|
+
event: MouseEvent;
|
|
118
|
+
node: TreeNode;
|
|
119
|
+
}) => void;
|
|
120
|
+
/** 拖拽放置回调 */
|
|
121
|
+
onDrop?: (params: {
|
|
122
|
+
event: MouseEvent;
|
|
123
|
+
node: TreeNode;
|
|
124
|
+
dragNode: TreeNode;
|
|
125
|
+
dragPosition: 'before' | 'after' | 'inside';
|
|
126
|
+
}) => void;
|
|
127
|
+
/** 拖拽结束回调 */
|
|
128
|
+
onDragEnd?: (params: {
|
|
129
|
+
event: MouseEvent;
|
|
130
|
+
node: TreeNode;
|
|
131
|
+
}) => void;
|
|
132
|
+
/** 是否支持动态添加节点 */
|
|
133
|
+
addable?: boolean;
|
|
134
|
+
/** 是否支持删除节点 */
|
|
135
|
+
removable?: boolean;
|
|
136
|
+
/** 是否支持编辑节点 */
|
|
137
|
+
editable?: boolean;
|
|
138
|
+
/** 操作按钮显示模式:'inline' 行内显示 | 'dropdown' 下拉菜单 */
|
|
139
|
+
actionDisplayMode?: 'inline' | 'dropdown';
|
|
140
|
+
/** 添加节点回调 - 返回新节点的初始数据 */
|
|
141
|
+
onAddNode?: (parentNode: TreeNode) => TreeNode | TreeNode[] | void;
|
|
142
|
+
/** 删除节点回调 - 返回 false 可阻止删除 */
|
|
143
|
+
onRemoveNode?: (node: TreeNode) => boolean | void;
|
|
144
|
+
/** 编辑节点回调 - 返回编辑后的标题 */
|
|
145
|
+
onEditNode?: (node: TreeNode, newTitle: string) => string | void;
|
|
146
|
+
/** 自定义节点渲染 */
|
|
147
|
+
renderNode?: (node: TreeNode) => React.ReactNode;
|
|
148
|
+
/** 节点前渲染 */
|
|
149
|
+
prefixCls?: string;
|
|
150
|
+
/** 类名 */
|
|
151
|
+
className?: string;
|
|
152
|
+
/** 样式 */
|
|
153
|
+
style?: React.CSSProperties;
|
|
154
|
+
/** 是否禁用 */
|
|
155
|
+
disabled?: boolean;
|
|
156
|
+
/** 是否自动展开父节点 */
|
|
157
|
+
autoExpandParent?: boolean;
|
|
158
|
+
/** 默认展开所有 */
|
|
159
|
+
defaultExpandAll?: boolean;
|
|
160
|
+
/** 展开动画 */
|
|
161
|
+
motion?: React.CSSProperties | ((node: TreeNode, isExpanded: boolean) => React.CSSProperties);
|
|
162
|
+
/** 全局 Tooltip 配置,默认关闭 */
|
|
163
|
+
tooltip?: TreeNodeTooltip | boolean;
|
|
164
|
+
}
|
|
165
|
+
export interface TreeNodeProps {
|
|
166
|
+
/** 节点数据 */
|
|
167
|
+
node: TreeNode;
|
|
168
|
+
/** 层级深度 */
|
|
169
|
+
level: number;
|
|
170
|
+
/** 是否展开 */
|
|
171
|
+
expanded: boolean;
|
|
172
|
+
/** 是否选中 */
|
|
173
|
+
selected: boolean;
|
|
174
|
+
/** 是否勾选 */
|
|
175
|
+
checked: boolean;
|
|
176
|
+
/** 是否半选 */
|
|
177
|
+
halfChecked: boolean;
|
|
178
|
+
/** 是否加载中 */
|
|
179
|
+
loading: boolean;
|
|
180
|
+
/** 是否叶子节点 */
|
|
181
|
+
isLeaf: boolean;
|
|
182
|
+
/** 父节点是否展开 */
|
|
183
|
+
parentExpanded: boolean;
|
|
184
|
+
/** 树组件属性 */
|
|
185
|
+
treeProps: TreeProps;
|
|
186
|
+
/** 展开节点 */
|
|
187
|
+
onExpand: (node: TreeNode, e: React.MouseEvent) => void;
|
|
188
|
+
/** 选择节点 */
|
|
189
|
+
onSelect: (node: TreeNode, e: React.MouseEvent) => void;
|
|
190
|
+
/** 勾选节点 */
|
|
191
|
+
onCheck: (node: TreeNode, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
192
|
+
}
|
|
193
|
+
export interface TreeState {
|
|
194
|
+
/** 展开的键集合 */
|
|
195
|
+
expandedKeys: (string | number)[];
|
|
196
|
+
/** 选中的键集合 */
|
|
197
|
+
selectedKeys: (string | number)[];
|
|
198
|
+
/** 勾选的键集合 */
|
|
199
|
+
checkedKeys: (string | number)[];
|
|
200
|
+
/** 加载中的键集合 */
|
|
201
|
+
loadingKeys: (string | number)[];
|
|
202
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TreeSelectProps, TreeSelectNode, TreeSelectStyles } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TreeSelect 树型选择器组件
|
|
5
|
+
* 用于在树形结构中选择数据,支持单选和多选
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <TreeSelect
|
|
10
|
+
* treeData={treeData}
|
|
11
|
+
* placeholder="请选择"
|
|
12
|
+
* onChange={(value) => console.log(value)}
|
|
13
|
+
* />
|
|
14
|
+
* <TreeSelect
|
|
15
|
+
* treeData={treeData}
|
|
16
|
+
* multiple
|
|
17
|
+
* maxTagCount={2}
|
|
18
|
+
* onChange={(value) => console.log(value)}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const TreeSelect: React.FC<TreeSelectProps>;
|
|
23
|
+
export default TreeSelect;
|
|
24
|
+
export type { TreeSelectProps, TreeSelectNode, TreeSelectStyles };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { TreeSelectStyles } from './types';
|
|
2
|
+
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
$styles?: TreeSelectStyles["wrapper"];
|
|
4
|
+
$width?: number | string;
|
|
5
|
+
}>> & string;
|
|
6
|
+
export declare const Selection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
7
|
+
$open: boolean;
|
|
8
|
+
$disabled: boolean;
|
|
9
|
+
$size: "large" | "middle" | "small";
|
|
10
|
+
$styles?: TreeSelectStyles["selection"];
|
|
11
|
+
}>> & string;
|
|
12
|
+
export declare const Rendered: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
|
+
$isPlaceholder: boolean;
|
|
14
|
+
}>> & string;
|
|
15
|
+
export declare const SelectionItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
16
|
+
export declare const Tag: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
17
|
+
$size: "large" | "middle" | "small";
|
|
18
|
+
$styles?: TreeSelectStyles["tag"];
|
|
19
|
+
}>> & string;
|
|
20
|
+
export declare const TagContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
21
|
+
export declare const TagClose: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
22
|
+
export declare const SearchWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
23
|
+
export declare const SearchInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
24
|
+
export declare const ClearIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
25
|
+
$size: "large" | "middle" | "small";
|
|
26
|
+
}>> & string;
|
|
27
|
+
export declare const ArrowIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
28
|
+
$open: boolean;
|
|
29
|
+
$size: "large" | "middle" | "small";
|
|
30
|
+
}>> & string;
|
|
31
|
+
export declare const Dropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
32
|
+
$width?: number | string;
|
|
33
|
+
$height?: number | string;
|
|
34
|
+
$styles?: TreeSelectStyles["dropdown"];
|
|
35
|
+
}>> & string;
|
|
36
|
+
export declare const DropdownSearchWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
37
|
+
export declare const DropdownSearchInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
38
|
+
export declare const DropdownContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
39
|
+
export declare const EmptyWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
40
|
+
export declare const TreeNodeWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
41
|
+
export declare const TreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
42
|
+
$selected: boolean;
|
|
43
|
+
$disabled: boolean;
|
|
44
|
+
$level: number;
|
|
45
|
+
$styles?: TreeSelectStyles["treeNode"];
|
|
46
|
+
}>> & string;
|
|
47
|
+
export declare const ExpandIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
48
|
+
$expanded: boolean;
|
|
49
|
+
$hasChildren: boolean;
|
|
50
|
+
}>> & string;
|
|
51
|
+
export declare const Checkbox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
52
|
+
export declare const CheckboxInner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
53
|
+
$checked: boolean;
|
|
54
|
+
}>> & string;
|
|
55
|
+
export declare const NodeTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
56
|
+
export declare const TreeNodeChildren: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|