com.phloxui
Version:
PhloxUI Ng2+ Framework
53 lines (52 loc) • 2.63 kB
TypeScript
import { INeedFocus } from '../component/INeedFocus';
import { ObservableManager } from './ObservableManager.service';
/**
* <p style="text-indent: 2em;">
* A <code>ng</code> service class mainly handles the logic of UI component user's focus. For example, a notification pop up which will be disappered when
* a user clicks on anywhere else out of its area --or, saying that losing its focus. A notification pop up component class must implement the [[INeedFocus]]
* interface and register itself to <code>this</code> service via [[setFocusingComponent]] method to obtain the user's focus. Then, it must implement the
* [[INeedFocus.onLostFocus]] method to hide itself when losing the focus. The [[NeedFocusService]] will mark a component losing the focus when the
* [[resetFocusingComponent]] method is called or another [[INeedFocus]] component is getting focus instead.
* </p>
*
* @author shiorin, tee4cute
* @see [[INeedFocus]]
*/
export declare class NeedFocusService {
static readonly FOCUS_TOPIC_NAME: string;
static readonly LOST_FOCUS_TOPIC_NAME: string;
static readonly FOCUS_CMD_TOPIC_NAME: string;
private observableMgr;
private focusingComponent;
private focusSubject;
private lostFocusSubject;
constructor(obsvMgr: ObservableManager);
private getDataParent(component);
private getDataAncestorChain(component);
/**
* <p style="text-indent: 1em;">
* Get the component instance currently being focused.
* </p>
*/
getFocusingComponent(): INeedFocus;
/**
* <p style="text-indent: 1em;">
* Set focusing component to the given <code><b>component</b></code>. If there is current focusing component, the [[NeedFocusService]]
* will automatically call [[INeedFocus.onLostFocus]] callback method on the current focusing component before setting focus to a new
* one.
* </p>
*
* @param component The component to set focus to.
* @param event The source UI event --for example, click events, etc.-- causing this <code><b>component</b></code> to be focused.
*/
setFocusingComponent(component: INeedFocus, event?: any): void;
/**
* <p style="text-indent: 1em;">
* Reset the focusing component. This method will automatically call [[INeedFocus.onLostFocus]] callback method on the current focusing component.
* If there is no current focusing component, this method will do nothing.
* </p>
*
* @param event The source UI event --for example, click events, etc.-- causing the component's focus to be reset.
*/
resetFocusingComponent(event?: any): void;
}