primevue-mirror/components/lib/splitter/Splitter.d.ts

248 lines
5.7 KiB
TypeScript
Raw Normal View History

2023-02-28 21:23:26 +00:00
/**
*
* Splitter is utilized to separate and resize panels.
*
* [Live Demo](https://www.primevue.org/splitter/)
*
* @module splitter
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type SplitterPassThroughOptionType = SplitterPassThroughAttributes | ((options: SplitterPassThroughMethodOptions) => SplitterPassThroughAttributes | string) | string | null | undefined;
2023-03-27 07:13:31 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface SplitterPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-03-27 07:13:31 +00:00
props: SplitterProps;
/**
* Defines current inline state.
*/
2023-03-27 07:13:31 +00:00
state: SplitterState;
/**
* Defines current options.
*/
2023-08-01 08:26:08 +00:00
context: SplitterContext;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-03-27 07:13:31 +00:00
}
2023-02-28 21:23:26 +00:00
/**
* Custom resize start event.
2023-05-04 14:13:31 +00:00
* @see {@link SplitterEmits.resizestart}
2023-02-28 21:23:26 +00:00
*/
2022-12-08 11:04:25 +00:00
export interface SplitterResizeStartEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Sizes of the panels
*/
sizes: number[];
}
/**
* Custom resize event.
* @see {@link SplitterEmits.resize}
*/
export interface SplitterResizeEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Sizes of the panels
*/
sizes: number[];
}
2023-02-28 21:23:26 +00:00
/**
* Custom resize end event.
2023-05-04 14:13:31 +00:00
* @see {@link SplitterEmits.resizeend}
2023-02-28 21:23:26 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface SplitterResizeEndEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Sizes of the panels
*/
sizes: number[];
}
2023-03-27 07:13:31 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link SplitterProps.pt}
*/
export interface SplitterPassThroughOptions {
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the roots DOM element.
2023-03-27 07:13:31 +00:00
*/
root?: SplitterPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the gutters DOM element.
2023-03-27 07:13:31 +00:00
*/
gutter?: SplitterPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the gutter handles DOM element.
2023-03-27 07:13:31 +00:00
*/
gutterHandle?: SplitterPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-11-07 06:16:39 +00:00
* Used to manage all lifecycle hooks.
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-03-27 07:13:31 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SplitterPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Panel component.
*/
export interface SplitterState {
/**
* Previous size state as a number.
*/
prevSize: number;
}
2023-08-01 08:26:08 +00:00
/**
* Defines options in Splitter component.
*/
export interface SplitterContext {
/**
* Current nested state of the component.
*/
nested?: boolean;
}
2023-02-28 21:23:26 +00:00
/**
* Defines valid properties in Splitter component.
*/
2022-09-06 12:03:37 +00:00
export interface SplitterProps {
/**
* Orientation of the panels.
2023-02-28 21:23:26 +00:00
* @defaultValue horizontal
2022-09-06 12:03:37 +00:00
*/
2023-02-28 21:23:26 +00:00
layout?: 'horizontal' | 'vertical' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Size of the divider in pixels.
2023-02-28 21:23:26 +00:00
* @defaultValue 4
2022-09-06 12:03:37 +00:00
*/
gutterSize?: number | undefined;
/**
* Storage identifier of a stateful Splitter.
*/
stateKey?: string | undefined;
/**
* Defines where a stateful splitter keeps its state, valid values are 'session' for sessionStorage and 'local' for localStorage.
2023-03-08 10:51:52 +00:00
* @defaultValue session
2022-09-06 12:03:37 +00:00
*/
2023-02-28 21:23:26 +00:00
stateStorage?: 'local' | 'session' | undefined;
2022-09-14 11:26:01 +00:00
/**
* Step factor to increment/decrement the size of the panels while pressing the arrow keys.
2023-02-28 21:23:26 +00:00
* @defaultValue 1
2022-09-14 11:26:01 +00:00
*/
step?: number | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-03-27 07:13:31 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-03-27 07:13:31 +00:00
* @type {SplitterPassThroughOptions}
*/
pt?: PassThrough<SplitterPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-24 08:54:19 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
2022-09-06 12:03:37 +00:00
}
2023-02-28 21:23:26 +00:00
/**
* Defines valid slots in Splitter slots.
*/
2022-09-06 12:03:37 +00:00
export interface SplitterSlots {
/**
* Default slot to detect SplitterPanel components.
*/
2023-02-28 21:23:26 +00:00
default(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-02-28 21:23:26 +00:00
/**
* Defines valid emits in Splitter component.
*/
export interface SplitterEmits {
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when resize starts.
* @param {SplitterResizeStartEvent} event - Custom resize start event.
*/
2023-05-04 14:13:31 +00:00
resizestart(event: SplitterResizeStartEvent): void;
/**
* Callback to invoke during the resizing process.
* @param {SplitterResizeEvent} event - Custom resize event.
*/
resize(event: SplitterResizeEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when resize ends.
* @param {SplitterResizeEndEvent} event - Custom resize end event.
*/
2023-02-28 21:23:26 +00:00
resizeend(event: SplitterResizeEndEvent): void;
}
2022-09-06 12:03:37 +00:00
2023-02-28 21:23:26 +00:00
/**
* **PrimeVue - Splitter**
*
* _Splitter is utilized to separate and resize panels._
*
* [Live Demo](https://www.primevue.org/splitter/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-02-28 21:23:26 +00:00
*
* @group Component
*
*/
2023-03-01 12:30:54 +00:00
declare class Splitter extends ClassComponent<SplitterProps, SplitterSlots, SplitterEmits> {}
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Splitter: GlobalComponentConstructor<Splitter>;
2022-09-06 12:03:37 +00:00
}
}
export default Splitter;