Class NotebookViewModel

Notebook view model for the windowed list.

Hierarchy

Constructors

Properties

_estimatedWidgetSize: number

Default widget size estimation

_stateChanged: Signal<WindowedListModel, IChangedArgs<any, any, "index" | "list" | "count" | "overscanCount" | "windowingActive">>
cells: Cell<ICellModel>[]
estimateWidgetSize: ((index) => number)

Type declaration

    • (index): number
    • Cell size estimator

      Parameters

      • index: number

        Cell index

      Returns number

      Cell height in pixels

paddingTop: number

Top padding of the the outer window node.

scrollDownThreshold: number

Threshold used to decide if the cell should be scrolled to in the smart mode. Defaults to scrolling when less than a full line of the cell is visible.

scrollUpThreshold: number

Threshold used to decide if the cell should be scrolled to in the smart mode. Defaults to scrolling when the cell margin or more is invisible.

widgetRenderer: ((index) => Widget)

Type declaration

    • (index): Widget
    • Render the cell at index.

      Parameters

      • index: number

        Cell index

      Returns Widget

      Cell widget

DEFAULT_CELL_MARGIN: number

Default cell margin (top + bottom)

DEFAULT_CELL_SIZE: number

Default cell height

DEFAULT_EDITOR_LINE_HEIGHT: number

Default editor line height

Accessors

  • get height(): number
  • List widget height

    Returns number

  • set height(h): void
  • List widget height

    Parameters

    • h: number

    Returns void

  • get isDisposed(): boolean
  • Test whether the model is disposed.

    Returns boolean

  • get itemsList(): IObservableList<any>
  • Items list to be rendered

    Returns IObservableList<any>

  • set itemsList(v): void
  • Items list to be rendered

    Parameters

    Returns void

  • get overscanCount(): number
  • Number of widgets to render in addition to those visible in the viewport.

    Returns number

  • set overscanCount(newValue): void
  • Number of widgets to render in addition to those visible in the viewport.

    Parameters

    • newValue: number

    Returns void

  • get scrollOffset(): number
  • Viewport scroll offset.

    Returns number

  • set scrollOffset(offset): void
  • Viewport scroll offset.

    Parameters

    • offset: number

    Returns void

  • get stateChanged(): ISignal<WindowedListModel, IChangedArgs<any, any, "index" | "list" | "count" | "overscanCount" | "windowingActive">>
  • A signal emitted when any model state changes.

    Returns ISignal<WindowedListModel, IChangedArgs<any, any, "index" | "list" | "count" | "overscanCount" | "windowingActive">>

  • get widgetCount(): number
  • Total number of widgets in the list

    Returns number

  • set widgetCount(newValue): void
  • Total number of widgets in the list

    Parameters

    • newValue: number

    Returns void

  • get windowingActive(): boolean
  • Whether windowing is active or not.

    This is true by default.

    Returns boolean

  • set windowingActive(newValue): void
  • Whether windowing is active or not.

    Parameters

    • newValue: boolean

    Returns void

Methods

  • Dispose the model.

    Returns void

  • Get the total list size.

    Returns number

    Total estimated size

  • Get the scroll offset to display an item in the viewport.

    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.

    An item is considered significantly visible if:

    • it overlaps with the viewport by the amount specified by scrollDownThreshold when below the viewport
    • it exceeds the viewport by the amount less than specified by scrollUpThreshold when above the viewport.

    Parameters

    • index: number

      Item index

    • Optional align: ScrollToAlign

      Where to align the item in the viewport

    • Optional margin: number

      The proportion of viewport to add when aligning with the top/bottom of the list.

    • Optional precomputed: {
          currentOffset: number;
          itemMetadata: ItemMetadata;
          totalSize: number;
      }

      Precomputed values to use when windowing is disabled.

      • currentOffset: number
      • itemMetadata: ItemMetadata
      • totalSize: number
    • 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 number

    The needed scroll offset

  • Compute the items range to display.

    It returns null if the range does not need to be updated.

    Returns WindowIndex

    The current items range to display

  • Return the viewport top position and height for range spanning from startIndex to stopIndex.

    Parameters

    • startIndex: number

      First item in viewport index

    • stopIndex: number

      Last item in viewport index

    Returns [number, number]

    The viewport top position and its height

  • WindowedListModel caches offsets and measurements for each index for performance purposes. This method clears that cached data for all items after (and including) the specified index.

    The list will automatically re-render after the index is reset.

    Parameters

    • index: number

    Returns void

  • Update item sizes.

    This should be called when the real item sizes has been measured.

    Parameters

    • sizes: {
          index: number;
          size: number;
      }[]

      New sizes per item index

    Returns boolean

    Whether some sizes changed or not

Generated using TypeDoc