import type { HotInstance } from '../core/types'; import type { EDITOR_TYPE as BASE_EDITOR } from './baseEditor'; import type { EDITOR_TYPE as AUTOCOMPLETE_EDITOR } from './autocompleteEditor'; import type { EDITOR_TYPE as CHECKBOX_EDITOR } from './checkboxEditor'; import type { EDITOR_TYPE as DATE_EDITOR } from './dateEditor'; import type { EDITOR_TYPE as DROPDOWN_EDITOR } from './dropdownEditor'; import type { EDITOR_TYPE as HANDSONTABLE_EDITOR } from './handsontableEditor'; import type { EDITOR_TYPE as INTL_DATE_EDITOR } from './intlDateEditor'; import type { EDITOR_TYPE as INTL_TIME_EDITOR } from './intlTimeEditor'; import type { EDITOR_TYPE as MULTI_SELECT_EDITOR } from './multiSelectEditor'; import type { EDITOR_TYPE as NUMERIC_EDITOR } from './numericEditor'; import type { EDITOR_TYPE as PASSWORD_EDITOR } from './passwordEditor'; import type { EDITOR_TYPE as SELECT_EDITOR } from './selectEditor'; import type { EDITOR_TYPE as TEXT_EDITOR } from './textEditor'; import type { EDITOR_TYPE as TIME_EDITOR } from './timeEditor'; /** * Constructor signature of any editor class. Editors extend `BaseEditor` but historically * the public API also accepts plain constructors, so we use a structural type here. */ type EditorConstructor = new (hotInstance: HotInstance) => unknown; /** * Editor constructor with the optional static `EDITOR_TYPE` identifier used during registration. */ type EditorConstructorWithType = EditorConstructor & { EDITOR_TYPE?: string; }; /** * Public accepted shape for an editor class. Historically the registry accepts any `Function` * (this is the documented type used by `CellTypeObject.editor`), so the public signatures * stay compatible while the internal logic narrows to `EditorConstructorWithType`. */ type EditorClass = EditorConstructorWithType | Function; declare const hasItem: (name: string) => boolean, getNames: () => string[], getValues: () => unknown[]; /** * Wraps an editor class and lazily creates a single editor instance per Handsontable instance. */ export declare class RegisteredEditor { #private; /** * Wraps the given editor class and registers an afterDestroy hook to clean up instances. */ constructor(editorClass: EditorConstructorWithType); /** * Returns the underlying editor constructor. * * @returns {Function} The editor class. */ getConstructor(): EditorConstructorWithType; /** * Returns a memoized editor instance for the given Handsontable instance. * * @param {HotInstance} hotInstance The Handsontable instance. * @returns {object} The editor instance. */ getInstance(hotInstance: HotInstance): unknown; } /** * Returns instance (singleton) of editor class. * * @param {string} name Name of an editor under which it has been stored. * @param {object} hotInstance Instance of Handsontable. * @returns {Function} Returns instance of editor. */ export declare function _getEditorInstance(name: string | EditorClass, hotInstance: HotInstance): unknown; /** * Retrieve editor class. * * @param {string} name Editor identification. * @returns {Function} Returns editor class. */ declare function _getItem(name: string | EditorClass): EditorConstructorWithType; /** * Register editor class under specified name. * * @param {string} name Editor identification. * @param {Function} editorClass Editor class. */ declare function _register(name: string | EditorClass | null, editorClass?: EditorClass): void; export { _register as registerEditor, _getItem as getEditor, _getEditorInstance as getEditorInstance, hasItem as hasEditor, getNames as getRegisteredEditorNames, getValues as getRegisteredEditors, }; /** * All built-in editor type names. */ export type EditorType = typeof AUTOCOMPLETE_EDITOR | typeof BASE_EDITOR | typeof CHECKBOX_EDITOR | typeof DATE_EDITOR | typeof DROPDOWN_EDITOR | typeof HANDSONTABLE_EDITOR | typeof INTL_DATE_EDITOR | typeof INTL_TIME_EDITOR | typeof MULTI_SELECT_EDITOR | typeof NUMERIC_EDITOR | typeof PASSWORD_EDITOR | typeof SELECT_EDITOR | typeof TEXT_EDITOR | typeof TIME_EDITOR | string;