You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0 KiB

4 months ago
import { CommonEvent } from '../constants';
import type { RuntimeContext } from '../runtime/types';
import type { ID, IPointerEvent } from '../types';
import type { BaseBehaviorOptions } from './base-behavior';
import { BaseBehavior } from './base-behavior';
/**
* <zh/> /
*
* <en/> Collapse/Expand combo behavior options
*/
export interface CollapseExpandOptions extends BaseBehaviorOptions {
/**
* <zh/>
*
* <en/> Whether to enable animation
* @defaultValue true
*/
animation?: boolean;
/**
* <zh/> /
*
* <en/> Whether to enable the expand/collapse function
* @defaultValue true
*/
enable?: boolean | ((event: IPointerEvent) => boolean);
/**
* <zh/>
*
* <en/> Trigger method
* @defaultValue 'dblclick'
*/
trigger?: CommonEvent.CLICK | CommonEvent.DBLCLICK;
/**
* <zh/>
*
* <en/> Callback when collapse is completed
*/
onCollapse?: (id: ID) => void;
/**
* <zh/>
*
* <en/> Callback when expand is completed
*/
onExpand?: (id: ID) => void;
/**
* <zh/>
*
* <en/> Whether to focus on the target element to avoid view offset
*/
align?: boolean;
}
/**
* <zh/> /
*
* <en/> Collapse/Expand Element behavior
* @remarks
* <zh/> /
*
* <en/> Expand/collapse elements by operation.
*/
export declare class CollapseExpand extends BaseBehavior<CollapseExpandOptions> {
static defaultOptions: Partial<CollapseExpandOptions>;
constructor(context: RuntimeContext, options: CollapseExpandOptions);
update(options: Partial<CollapseExpandOptions>): void;
private bindEvents;
private unbindEvents;
private onCollapseExpand;
private validate;
destroy(): void;
}