Class WindowedList<T, U>

Windowed list widget

Type Parameters

Hierarchy

Constructors

Properties

_addListeners: any

Add listeners for viewport, contents and the virtual scrollbar.

_adjustDimensionsForScrollbar: any
_applyNoWindowingStyles: any

Turn off windowing related styles in the viewport.

_applyWindowingStyles: any

Turn on windowing related styles in the viewport.

_areaResizeObserver: any
_evtPointerDown: any

Handle pointerdown events on the virtual scrollbar.

_innerElement: any
_isParentHidden: any
_isScrolling: any
_itemsResizeObserver: any
_needsUpdate: any
_onAreaResize: any

Handle viewport area resize.

_onItemResize: any

Handle viewport content (i.e. items) resize.

_outerElement: any
_removeListeners: any

Remove listeners for viewport and contents (but not the virtual scrollbar).

_renderScrollbar: any

Render virtual scrollbar.

_resetScrollToItem: any

Clear any outstanding timeout and enqueue scrolling to a new item.

_resetScrollToItemTimeout: any
_scrollBackToItemOnResize: any

Scroll to the item which was most recently requested.

This method ensures that the app scrolls to the item even if a resize event occurs shortly after the scroll. Consider the following sequence of events:

  1. User is at the nth cell, presses Shift+Enter (run current cell and advance to next)
  2. App scrolls to the next (n+1) cell
  3. The nth cell finishes running and renders the output, pushing the (n+1) cell down out of view
  4. This triggers the resize observer, which calls this method and scrolls the (n+1) cell back into view

On implementation level, this is ensured by scrolling to this._scrollToItem which is cleared after a short timeout once the scrolling settles (see this._resetScrollToItem()).

_scrollRepaint: any
_scrollToItem: any
_scrollUpdateWasRequested: any
_scrollbarElement: any
_scrollbarResizeObserver: any
_update: any

Update viewport and DOM state.

_updateTotalSize: any

Update the total size

_updater: any
_viewModel: T
_viewport: any
jumped: Signal<WindowedList<T, U>, number>

A signal that emits the index when the virtual scrollbar jumps to an item.

Get the DOM node owned by the widget.

renderer: WindowedList.IRenderer<U>

The renderer for this windowed list. Set at instantiation.

DEFAULT_WIDGET_SIZE: 50 = 50

Default widget size

Accessors

  • get dataset(): DOMStringMap
  • The dataset for the widget's DOM node.

    Returns DOMStringMap

  • get disposed(): ISignal<this, void>
  • A signal emitted when the widget is disposed.

    Returns ISignal<this, void>

  • get hiddenMode(): HiddenMode
  • Get the method for hiding the widget.

    Returns HiddenMode

  • set hiddenMode(value): void
  • Set the method for hiding the widget.

    Parameters

    • value: HiddenMode

    Returns void

  • get id(): string
  • Get the id of the widget's DOM node.

    Returns string

  • set id(value): void
  • Set the id of the widget's DOM node.

    Parameters

    • value: string

    Returns void

  • get isAttached(): boolean
  • Test whether the widget's node is attached to the DOM.

    Returns boolean

  • get isDisposed(): boolean
  • Test whether the widget has been disposed.

    Returns boolean

  • get isHidden(): boolean
  • Test whether the widget is explicitly hidden.

    Returns boolean

  • get isParentHidden(): boolean
  • Whether the parent is hidden or not.

    This should be set externally if a container is hidden to stop updating the widget size when hidden.

    Returns boolean

  • set isParentHidden(v): void
  • Parameters

    • v: boolean

    Returns void

  • get isVisible(): boolean
  • Test whether the widget is visible.

    Notes

    A widget is visible when it is attached to the DOM, is not explicitly hidden, and has no explicitly hidden ancestors.

    Returns boolean

  • get layout(): WindowedLayout
  • Widget layout

    Returns WindowedLayout

  • get outerNode(): HTMLElement
  • The outer container of the windowed list.

    Returns HTMLElement

  • get parent(): Widget
  • Get the parent of the widget.

    Returns Widget

  • set parent(value): void
  • Set the parent of the widget.

    Notes

    Children are typically added to a widget by using a layout, which means user code will not normally set the parent widget directly.

    The widget will be automatically removed from its old parent.

    This is a no-op if there is no effective parent change.

    Parameters

    Returns void

  • get scrollbar(): boolean
  • Flag to enable virtual scrollbar.

    Returns boolean

  • set scrollbar(enabled): void
  • Parameters

    • enabled: boolean

    Returns void

  • get title(): Title<Widget>
  • The title object for the widget.

    Notes

    The title object is used by some container widgets when displaying the widget alongside some title, such as a tab panel or side bar.

    Since not all widgets will use the title, it is created on demand.

    The owner property of the title is set to this widget.

    Returns Title<Widget>

  • get viewModel(): T
  • Windowed list view model

    Returns T

  • get viewportNode(): HTMLElement
  • Viewport

    Returns HTMLElement

Methods

  • Post an 'activate-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

  • Add a class name to the widget's DOM node.

    Parameters

    • name: string

      The class name to add to the node.

      Notes

      If the class name is already added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

  • Create an iterator over the widget's children.

    Returns IterableIterator<Widget>

    A new iterator over the children of the widget.

    Notes

    The widget must have a populated layout in order to have children.

    If a layout is not installed, the returned iterator will be empty.

  • Clear the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

  • Send a 'close-request' message to the widget.

    Notes

    This is a simple convenience method for sending the message.

    Returns void

  • Test whether a widget is a descendant of this widget.

    Parameters

    • widget: Widget

      The descendant widget of interest.

    Returns boolean

    true if the widget is a descendant, false otherwise.

  • Dispose the windowed list.

    Returns void

  • Post a 'fit-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

  • Callback on event.

    Parameters

    Returns void

  • Test whether the widget's DOM node has the given class name.

    Parameters

    • name: string

      The class name of interest.

    Returns boolean

    true if the node has the class, false otherwise.

  • Hide the widget and make it hidden to its parent widget.

    Notes

    This causes the isHidden property to be true.

    If the widget is explicitly hidden, this is a no-op.

    Returns void

  • Invoke the message processing routine of the widget's layout.

    Parameters

    • msg: Message

      The message to dispatch to the layout.

      Notes

      This is a no-op if the widget does not have a layout.

      This will not typically be called directly by user code.

    Returns void

  • A message handler invoked on an 'activate-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'after-attach' message.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'after-detach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'after-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'after-show' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on a 'before-attach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'before-detach' message.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on a 'before-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on a 'before-show' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on a 'child-added' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

  • A message handler invoked on a 'child-removed' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

  • A message handler invoked on a 'close-request' message.

    Notes

    The default implementation unparents or detaches the widget.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on a 'fit-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • A message handler invoked on an 'resize-request' message.

    Parameters

    • msg: ResizeMessage

    Returns void

  • Callback on scroll event

    Parameters

    • event: Event

      Scroll event

    Returns void

  • Callback on view model change

    Parameters

    Returns void

  • A message handler invoked on an 'update-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

  • Process a message sent to the widget.

    Parameters

    • msg: Message

      The message sent to the widget.

      Notes

      Subclasses may reimplement this method as needed.

    Returns void

  • Remove a class name from the widget's DOM node.

    Parameters

    • name: string

      The class name to remove from the node.

      Notes

      If the class name is not yet added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

  • Scroll to the specified offset scrollTop.

    Deprecated

    since v4 This is an internal helper. Prefer calling scrollToItem.

    Parameters

    • scrollOffset: number

      Offset to scroll

    Returns void

  • Scroll to the specified item.

    By default, the list will scroll as little as possible to ensure the item is fully visible (auto). You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are:

    auto - Automatically align with the top or bottom minimising the amount scrolled, If alignPreference is given, follow such preferred alignment. If item is smaller than the viewport and fully visible, do not scroll at all. smart - If the item is significantly visible, don't scroll at all (regardless of whether it fits in the viewport). If the item is less than one viewport away, scroll so that it becomes fully visible (following the auto heuristics). If the item is more than one viewport away, scroll so that it is centered within the viewport (center if smaller than viewport, top-center otherwise). center - Align the middle of the item with the middle of the viewport (it only works well for items smaller than the viewport). top-center - Align the top of the item with the middle of the viewport (works well for items larger than the viewport). end - Align the bottom of the item to the bottom of the list. start - Align the top of item to the top of the list.

    Parameters

    • index: number

      Item index to scroll to

    • Optional align: ScrollToAlign

      Type of alignment

    • Optional margin: number

      In 'smart' mode the viewport proportion to add

    • Optional alignPreference: BaseScrollToAlignment

      Allows to override the alignment of item when the auto heuristic decides that the item needs to be scrolled into view.

    Returns Promise<void>

  • Set the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

  • Show or hide the widget according to a boolean value.

    Parameters

    • hidden: boolean

      true to hide the widget, or false to show it.

      Notes

      This is a convenience method for hide() and show().

    Returns void

  • Show the widget and make it visible to its parent widget.

    Notes

    This causes the isHidden property to be false.

    If the widget is not explicitly hidden, this is a no-op.

    Returns void

  • Test whether the given widget flag is set.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns boolean

  • Toggle a class name on the widget's DOM node.

    Parameters

    • name: string

      The class name to toggle on the node.

    • Optional force: boolean

      Whether to force add the class (true) or force remove the class (false). If not provided, the presence of the class will be toggled from its current state.

    Returns boolean

    true if the class is now present, false otherwise.

    Notes

    The class name must not contain whitespace.

  • Post an 'update-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

Generated using TypeDoc