@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
50 lines (49 loc) • 1.96 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
/**
* @hidden
*/
export declare const KENDO_PASTE_EVENT_NAME = "kendo-populate-event";
/**
* Represents the detail payload for the KendoPopulateEvent.
*/
export interface KendoPopulateEventDetail {
/**
* A record of field names to their values to populate.
*/
fieldValues: Record<string, any>;
}
/**
* Custom event type for smart paste population.
* Components can listen for this event to receive field values from the SmartPasteButton.
*/
export type KendoPopulateEvent = CustomEvent<KendoPopulateEventDetail>;
/**
* Creates a KendoPopulateEvent with the given field values.
*
* @param fieldValues - The field values to populate
* @returns A CustomEvent that can be dispatched
*/
export declare function createKendoPasteEvent(fieldValues: Record<string, any>): KendoPopulateEvent;
/**
* Dispatches a smart paste populate event from the given element.
* The event will bubble up through the DOM tree.
*
* @param element - The element to dispatch the event from
* @param fieldValues - The field values to populate
* @returns true if the event was not cancelled, false otherwise
*/
export declare function dispatchKendoPasteEvent(element: Element | null, fieldValues: Record<string, any>): boolean;
/**
* Finds the closest form element from a given element.
* Returns the element's closest <form>, Kendo Form wrapper, or the document body as fallback.
*
* @param element - The starting element
* @returns The closest form-like container or document body
*/
export declare function getKendoPasteEventTarget(element: Element | null): Element;