mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
01d1b3d492
* demo: rewrite render function with React.FC * demo: rewrite render function with React.FC * fix: fix snap * Update components/splitter/Splitter.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * fix: clear --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
// ================ outside ================
|
|
export interface SplitterProps {
|
|
prefixCls?: string;
|
|
className?: string;
|
|
style?: React.CSSProperties;
|
|
rootClassName?: string;
|
|
layout?: 'horizontal' | 'vertical';
|
|
onResizeStart?: (sizes: number[]) => void;
|
|
onResize?: (sizes: number[]) => void;
|
|
onResizeEnd?: (sizes: number[]) => void;
|
|
}
|
|
|
|
export interface PanelProps {
|
|
className?: string;
|
|
style?: React.CSSProperties;
|
|
min?: number | string;
|
|
max?: number | string;
|
|
size?: number | string;
|
|
collapsible?: boolean | { start?: boolean; end?: boolean };
|
|
resizable?: boolean;
|
|
defaultSize?: number | string;
|
|
}
|
|
|
|
// ================ inside ================
|
|
|
|
export interface InternalPanelProps extends PanelProps {
|
|
className?: string;
|
|
prefixCls?: string;
|
|
}
|
|
|
|
export interface UseResizeProps extends Pick<SplitterProps, 'onResize'> {
|
|
basicsState: number[];
|
|
items: PanelProps[];
|
|
panelsRef: React.RefObject<(HTMLDivElement | null)[]>;
|
|
reverse: boolean;
|
|
setBasicsState: React.Dispatch<React.SetStateAction<number[]>>;
|
|
}
|
|
|
|
export interface UseResize {
|
|
setSize: (data: { size: number; index: number }[]) => void;
|
|
setOffset: (offset: number, containerSize: number, index: number) => void;
|
|
}
|
|
|
|
export interface UseHandleProps
|
|
extends Pick<SplitterProps, 'layout' | 'onResizeStart' | 'onResizeEnd'> {
|
|
basicsState: number[];
|
|
containerRef?: React.RefObject<HTMLDivElement | null>;
|
|
setOffset: UseResize['setOffset'];
|
|
setResizing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
}
|
|
|
|
export interface UseHandle {
|
|
onStart: (x: number, y: number, index: number) => void;
|
|
}
|
|
|
|
export interface UseCollapsibleProps {
|
|
basicsState: number[];
|
|
collapsible?: PanelProps['collapsible'];
|
|
index: number;
|
|
reverse: boolean;
|
|
setSize?: UseResize['setSize'];
|
|
}
|
|
|
|
export interface UseCollapsible {
|
|
nextIcon: boolean;
|
|
overlap: boolean;
|
|
previousIcon: boolean;
|
|
onFold: (type: 'previous' | 'next') => void;
|
|
setOldBasics: () => void;
|
|
}
|