victory-core
Version:
65 lines • 3.57 kB
TypeScript
import React from "react";
import type { EventMixinCalculatedValues } from "./add-events";
type ComponentEventKey = string | number;
export interface ComponentEvent {
target?: "parent" | string;
eventKey?: ComponentEventKey | ComponentEventKey[];
eventHandlers: ComponentEventHandlers;
}
export type ComponentEventName = string;
export interface ComponentEventHandlers {
[k: ComponentEventName]: ComponentEventHandler;
}
export type ComponentEventHandler = (evt: React.SyntheticEvent, childProps: unknown, eventKey: ComponentEventKey, eventName: ComponentEventName) => UpdatedProps;
export type UpdatedProps = any;
interface ComponentWithEvents extends EventMixinCalculatedValues {
state: any;
setState: any;
}
export declare function getEvents(this: ComponentWithEvents, props: any, target?: any, eventKey?: any, getScopedEvents?: any): any;
export declare function getScopedEvents(this: ComponentWithEvents, events: any, namespace: any, childType: any, baseProps: any): {};
export declare function getPartialEvents(events: ComponentEventHandlers, eventKey: ComponentEventKey, childProps: unknown): PartialEvents;
export interface PartialEvents {
[eventName: ComponentEventName]: (evt: React.SyntheticEvent) => UpdatedProps;
}
export declare function getEventState(this: ComponentWithEvents, eventKey: ComponentEventKey, namespace: string, childType?: string): any;
/**
* Returns a set of all mutations for shared events
*
* @param {Array} mutations an array of mutations objects
* @param {Object} baseProps an object that describes all props for children of VictorySharedEvents
* @param {Object} baseState an object that describes state for children of VictorySharedEvents
* @param {Array} childNames an array of childNames
*
* @return {Object} a object describing all mutations for VictorySharedEvents
*/
export declare function getExternalMutationsWithChildren(mutations: any, baseProps: {} | undefined, baseState: {} | undefined, childNames: any): any;
/**
* Returns a set of all mutations for a component
*
* @param {Array} mutations an array of mutations objects
* @param {Object} baseProps a props object (scoped to a childName when used by shared events)
* @param {Object} baseState a state object (scoped to a childName when used by shared events)
* @param {String} childName an optional childName
*
* @return {Object} a object describing mutations for a given component
*/
export declare function getExternalMutations(mutations: any, baseProps?: {}, baseState?: {}, childName?: any): {};
/**
* Returns a set of mutations for a particular element given scoped baseProps and baseState
*
* @param {Array} mutations an array of mutations objects
* @param {Object} baseProps a props object (scoped the element specified by the identifier)
* @param {Object} baseState a state object (scoped the element specified by the identifier)
* @param {Object} identifier { eventKey, target, childName }
*
* @return {Object | undefined} a object describing mutations for a given element, or undefined
*/
export declare function getExternalMutation(mutations: any, baseProps: any, baseState: any, identifier: any): any;
export declare function getComponentEvents(props: any, components: any): any;
export declare function getGlobalEventNameFromKey(key: any): any;
export declare const getGlobalEvents: (events: any) => Partial<any>;
export declare const omitGlobalEvents: (events: any) => Partial<any>;
export declare const emulateReactEvent: (event: any) => any;
export {};
//# sourceMappingURL=events.d.ts.map