hosanna-ui-docs - v0.9.0
    Preparing search index...

    Class BaseView<T, R>

    The BaseView class is a generic class that represents a base view in the Hosanna UI framework. It provides a foundation for creating custom views by managing state, layout, and rendering.

    It implements several interfaces including IFocusable, ILayoutable, IHosannaView

    This class manages the state and layout of a view, handles focus and key events, and supports rendering and updating the view. It maintains parent-child relationships for both the view tree and on-screen rendering. The class also provides methods for setting and applying state changes, laying out children, inflating view structures, and reconciling children based on the next view structures.

    The BaseView class uses decorators for dependency injection and state management, and it interacts with the ViewManager and ViewBuilder for managing and building views. It also supports debug information retrieval and navigation support.

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    __isMemoizedStateValid: boolean = false
    _cacheKey: string = ''
    _hid: string
    _isInFocusChain: boolean = false
    _renderer: undefined | R
    _rendereredTranslation: [number, number] = ...
    _viewPhase: ViewPhase = ViewPhase.Initial
    activeStyleViewStatus: ViewStatus = ViewStatus.Normal
    aggregateView: undefined | IAggregateView.IAggregateView

    IHosannaView


    audioGuideHint?: string = ''

    This hint can be used in conjunction with the audio guide item

    audioGuideItem?: string | IAudioGuideItem
    calculatedHeight: number = 0
    calculatedWidth: number = 0
    calculatedX: number = 0
    calculatedY: number = 0
    canReceiveFocus: boolean = true

    Indicates whether the element can receive focus.

    children: BaseView.BaseView<ViewState, ISGNGroup>[] = []

    These are the children that are rendered on screen in the tree structure of the view

    childrenChanged: boolean = false
    clippingRect: number[] = ...
    compositeView: boolean = true

    Indicdates whether the view is a focus group which means it can have a focused child Otherwise it will be focused itself

    customData?: unknown
    defaultValues: Partial<T> = {}
    eventHandlers: Record<string, Function> = {}
    focusedChildId?: string
    focusId: string = ''
    height: number = 0
    id: string = ''
    includeInLayout: boolean = true
    initialFocusId: string = ''
    instancePool: IInstancePool
    isFocused: boolean = false

    Indicates whether the element is currently focused.

    isLayoutDirty: boolean = false
    isPresented: boolean = false

    If true, this view has been presented in an AggregateViewController

    isSkeleton: boolean = false
    isSkeletonMode: boolean = false
    isWaking: boolean = false
    nextViewId: number = 0
    nodePool: INodePool
    opacity: number = 1.0
    parent?: IHosannaView<ViewState> = undefined
    partialRendererHibernatedState: Partial<T> = {}
    rotation: number = 0
    scale: number[] = ...
    scaleRotateCenter: number[] = ...
    scrollablePositionX: undefined | number = undefined
    scrollablePositionY: undefined | number = undefined
    staticType: ViewStaticType = ViewStaticType.None
    styleRegistry: IStyleRegistry
    subViews: BaseView.BaseView<ViewState, ISGNGroup>[] = []

    These are the children that were created in getViews, in a flat strcuture - it contains EVERYTHING that we declared.

    subViewsChanged: boolean = false
    translation: number[] = ...
    viewOwner: IHosannaView<ViewState>

    The IHosannaView subclass that created us in getViews

    viewStatus: ViewStatus = ViewStatus.Normal
    visible: boolean = true

    Indicates whether the navigatable entity is visible.

    width: number = 0

    Accessors

    Methods


    • Children


      Parameters

      • child: IHosannaView<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>

      Returns void

    • Parameters

      • parent: undefined | IHosannaView<ViewState>
      • childIndex: number = -1

      Returns void

    • Parameters

      • nextViewStructs: undefined | ViewStruct<ViewState>[]
      • parentId: string = ""
      • level: number = 0

      Returns void

    • Builds the view and attaches it to the view owner.

      Parameters

      • struct: ViewStruct<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>

        The target to mount the view.

      • childIndex: number = -1

      Returns undefined | IHosannaView<ViewState>

      The built view or undefined.

    • Parameters

      • nextStructs: ViewStruct<ViewState>[]
      • map: Record<string, ViewStruct<ViewState>> = {}
      • idList: { childIndex: number; id: string }[] = []

      Returns {
          idList: { childIndex: number; id: string }[];
          mappedNextStructs: Record<string, ViewStruct<ViewState>>;
      }


    • Rendererers


      Type Parameters

      • T extends IHosannaView<ViewState>

      Parameters

      • id: string
      • isDeepSearch: boolean = false

      Returns undefined | T

    • Parameters

      • child: IHosannaView<ViewState>
      • OptionalmountTarget: IHosannaView<ViewState>
      • index: number = -1

      Returns void

    • Parameters

      • view: IHosannaView<ViewState>

        The view to be added as a subview.

      • index: number = -1

        index of the child in the parent view, -1 means add to end

      Returns void

    • Parameters

      • x: number
      • y: number
      • parentWidth: number
      • parentHeight: number

      Returns void

    • This method is called before applying state changes to the view. It is used to perform any necessary preparations before the state changes are applied.

      Returns void

    • Presents a new screen in the navigation stack or as a dialog.

      Parameters

      • screen: ViewStruct<ViewState>

        The screen to be presented, represented by a ViewStruct<ViewState>.

      • Optionaloptions: IScreenPresentationOptions

        Optional presentation options.

        • isDialog

          If true, the screen will be presented as a dialog.

        • animated

          If true, the screen transition will be animated.

      Returns void

    • Prints out view type and id of each struct in the nextViewStructs array.

      Parameters

      • nextViewStructs: undefined | ViewStruct<ViewState>[]

      Returns void