@handsontable/react
Version:
Best Data Grid for React with Spreadsheet Look and Feel.
92 lines (91 loc) • 4.17 kB
TypeScript
import React from 'react';
import { EditorScopeIdentifier, HotEditorCache, HotEditorElement } from './types';
/**
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
*/
export declare const AUTOSIZE_WARNING: string;
/**
* Message for the warning thrown if the Handsontable instance has been destroyed.
*/
export declare const HOT_DESTROYED_WARNING: string;
/**
* String identifier for the global-scoped editor components.
*/
export declare const GLOBAL_EDITOR_SCOPE = "global";
/**
* Default classname given to the wrapper container.
*/
export declare const DEFAULT_CLASSNAME = "hot-wrapper-editor-container";
/**
* Logs warn to the console if the `console` object is exposed.
*
* @param {...*} args Values which will be logged.
*/
export declare function warn(...args: any[]): void;
/**
* Filter out and return elements of the provided `type` from the `HotColumn` component's children.
*
* @param {React.ReactNode} children HotTable children array.
* @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
* @returns {Object|null} A child (React node) or `null`, if no child of that type was found.
*/
export declare function getChildElementByType(children: React.ReactNode, type: string): React.ReactElement | null;
/**
* Get the reference to the original editor class.
*
* @param {React.ReactElement} editorElement React element of the editor class.
* @returns {Function} Original class of the editor component.
*/
export declare function getOriginalEditorClass(editorElement: HotEditorElement): any;
/**
* Create an editor portal.
*
* @param {Document} doc Document to be used.
* @param {React.ReactElement} editorElement Editor's element.
* @returns {React.ReactPortal} The portal for the editor.
*/
export declare function createEditorPortal(doc: Document, editorElement: HotEditorElement): React.ReactPortal | null;
/**
* Get an editor element extended with an instance-emitting method.
*
* @param {React.ReactNode} children Component children.
* @param {Map} editorCache Component's editor cache.
* @param {EditorScopeIdentifier} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
* 'global'.
* @returns {React.ReactElement} An editor element containing the additional methods.
*/
export declare function getExtendedEditorElement(children: React.ReactNode, editorCache: HotEditorCache, editorColumnScope?: EditorScopeIdentifier): React.ReactElement | null;
/**
* Create a react component and render it to an external DOM done.
*
* @param {React.ReactElement} rElement React element to be used as a base for the component.
* @param {Object} props Props to be passed to the cloned element.
* @param {Document} [ownerDocument] The owner document to set the portal up into.
* @param {String} portalKey The key to be used for the portal.
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
* @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
*/
export declare function createPortal(rElement: React.ReactElement, props: any, ownerDocument: Document, portalKey: string, cachedContainer?: HTMLElement): {
portal: React.ReactPortal;
portalContainer: HTMLElement;
};
/**
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
* component.
*
* @param {Object} props Object containing the react element props.
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
* component.
*/
export declare function getContainerAttributesProps(props: any, randomizeId?: boolean): {
id: string;
className: string;
style: object;
};
/**
* Checks if the environment that the code runs in is a browser.
*
* @returns {boolean}
*/
export declare function isCSR(): boolean;