/**
* DevExtreme (core/component.d.ts)
* Version: 21.2.3
* Build date: Thu Oct 28 2021
*
* Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
  DxElement,
} from './element';

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please describe your scenario in the following GitHub Issue, and we will suggest a public alternative: {@link https://github.com/DevExpress/DevExtreme/issues/17885|Internal Types}.
 */
export interface ComponentOptions<TComponent> {
  /**
   * A function that is executed before the UI component is disposed of.
   */
  onDisposing?: ((e: { component: TComponent }) => void);
  /**
   * A function used in JavaScript frameworks to save the UI component instance.
   */
  onInitialized?: ((e: { component?: TComponent; element?: DxElement }) => void);
  /**
   * A function that is executed after a UI component property is changed.
   */
  onOptionChanged?: ((e: { component?: TComponent; name?: string; fullName?: string; value?: any }) => void);
}
/**
 * A base class for all components and UI components.
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please describe your scenario in the following GitHub Issue, and we will suggest a public alternative: {@link https://github.com/DevExpress/DevExtreme/issues/17885|Internal Types}.
 */
export class Component<TProperties> {
  constructor(options?: TProperties);
  /**
   * Prevents the UI component from refreshing until the endUpdate() method is called.
   */
  beginUpdate(): void;
  /**
   * Refreshes the UI component after a call of the beginUpdate() method.
   */
  endUpdate(): void;
  /**
   * Gets the UI component&apos;s instance. Use it to access other methods of the UI component.
   */
  instance(): this;
  /**
   * Detaches all event handlers from a single event.
   */
  off(eventName: string): this;
  /**
   * Detaches a particular event handler from a single event.
   */
  off(eventName: string, eventHandler: Function): this;
  /**
   * Subscribes to an event.
   */
  on(eventName: string, eventHandler: Function): this;
  /**
   * Subscribes to events.
   */
  on(events: { [key: string]: Function }): this;
  /**
   * Gets all UI component properties.
   */
  option(): TProperties;
  /**
    * Gets the value of a single property.
    */
   option<TPropertyName extends string>(optionName: TPropertyName): TPropertyName extends (keyof TProperties) ? TProperties[TPropertyName] : unknown;
  /**
    * Updates the value of a single property.
    */
   option<TPropertyName extends string>(optionName: TPropertyName, optionValue: TPropertyName extends keyof TProperties ? TProperties[TPropertyName] : unknown): void;
  /**
    * Updates the values of several properties.
    */
   option(options: Partial<TProperties>): void;
  /**
   * Resets a property to its default value.
   */
  resetOption(optionName: string): void;
}
