@eclipse-scout/core
Version:
Eclipse Scout runtime
58 lines • 2.96 kB
TypeScript
import { Event, InitModelOf, ObjectWithType, ResponsiveHandlerModel, ResponsiveState, SomeRequired, Widget } from '../index';
export declare class ResponsiveHandler implements ResponsiveHandlerModel, ObjectWithType {
model: ResponsiveHandlerModel;
initModel: SomeRequired<this['model'], 'widget'>;
objectType: string;
widget: Widget;
compactThreshold: number;
condensedThreshold: number;
oldState: ResponsiveState;
state: ResponsiveState;
allowedStates: ResponsiveState[];
transformations: Record<string, (widget: Widget, apply: boolean) => void>;
enabledTransformations: Record<ResponsiveState, string[]>;
protected _transformationsToApply: string[];
protected _transformationsToReset: string[];
/** Event handlers */
protected _destroyHandler: (Event: any) => void;
constructor();
init(model: InitModelOf<this>): void;
destroy(): void;
getCompactThreshold(): number;
getCondensedThreshold(): number;
active(): boolean;
setAllowedStates(allowedStates: ResponsiveState[]): void;
acceptState(newState: ResponsiveState): boolean;
/**
* Register a transformation with a given transformation id. The transformation id has to be unique.
*/
protected _registerTransformation(transformationId: string, transformation: (widget: Widget, apply: boolean) => void): void;
/**
* Enable a transformation for a given state. Once the responsive handler changes in to the given state,
* the transformation will be applied.
* Before a transformation can be enabled, it has to be registered first.
*/
protected _enableTransformation(state: ResponsiveState, transformationId: string): void;
/**
* Disable a transformation for a given state.
*/
protected _disableTransformation(state: ResponsiveState, transformationId: string): void;
protected _storeFieldProperty(widget: Widget, property: string, value: any): void;
protected _hasFieldProperty(widget: Widget, property: string): boolean;
protected _getFieldProperty(widget: Widget, property: string): any;
/**
* Performs the transformations and computes which transformations have to be applied and which have to be reset.
* Transformations to be applied are the ones enabled for the new state, but not for the old state.
* The ones to be reset are those enabled of the old state but not for the new state.
*/
transform(newState: ResponsiveState, force?: boolean): boolean;
/**
* Performs all the transformations. By default, this method calls _transformWidget() for the own widget.
* If e.g. child elements need to be transformed as well, override this method and call _transformWidget() for
* each child as well.
*/
protected _transform(): void;
protected _transformWidget(widget: Widget): void;
protected _onDestroy(event: Event<Widget>): void;
}
//# sourceMappingURL=ResponsiveHandler.d.ts.map