Options
All
  • Public
  • Public/Protected
  • All
Menu

A ng 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 this 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.

author

shiorin, tee4cute

see

INeedFocus

Hierarchy

  • NeedFocusService

Index

Constructors

constructor

Properties

Private focusSubject

focusSubject: Subject<any>

Private focusingComponent

focusingComponent: INeedFocus

Private lostFocusSubject

lostFocusSubject: Subject<any>

Private observableMgr

observableMgr: ObservableManager

Static FOCUS_CMD_TOPIC_NAME

FOCUS_CMD_TOPIC_NAME: string = FOCUS_CMD_TOPIC_NAME

Static FOCUS_TOPIC_NAME

FOCUS_TOPIC_NAME: string = FOCUS_TOPIC_NAME

Static LOST_FOCUS_TOPIC_NAME

LOST_FOCUS_TOPIC_NAME: string = LOST_FOCUS_TOPIC_NAME

Methods

Private getDataAncestorChain

  • getDataAncestorChain(component: any): any[]
  • Parameters

    • component: any

    Returns any[]

Private getDataParent

  • getDataParent(component: any): any
  • Parameters

    • component: any

    Returns any

getFocusingComponent

  • Get the component instance currently being focused.

    Returns INeedFocus

resetFocusingComponent

  • resetFocusingComponent(event?: any): void
  • 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.

    Parameters

    • Optional event: any

      The source UI event --for example, click events, etc.-- causing the component's focus to be reset.

    Returns void

setFocusingComponent

  • setFocusingComponent(component: INeedFocus, event?: any): void
  • Set focusing component to the given component. 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.

    Parameters

    • component: INeedFocus

      The component to set focus to.

    • Optional event: any

      The source UI event --for example, click events, etc.-- causing this component to be focused.

    Returns void

Generated using TypeDoc