Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ReorderItems

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected childrenInOriginalOrder

childrenInOriginalOrder: Map<HTMLElement, JQuery>

Map from HTML parent elements to JQuery children nodes, in their original order. This is used to save the original element ordering.

name

name: string = "Reorder items"

Static NON_REORDERABLE_ELEMENT_CLASS

NON_REORDERABLE_ELEMENT_CLASS: "sam-no-reordering" = "sam-no-reordering"

HTML class of items or groups whose nodes must not be reordered.

Such elements are flagged accordingly when they are created (see Item.canBeReordered and ItemGroup.canBeReordered).

Static REORDERED_ELEMENT_CLASS

REORDERED_ELEMENT_CLASS: string = "sam-reordered-item"

HTML class of item elements which have been reordered.

Methods

apply

Private applyInGroup

  • applyInGroup(sameGroupItems: Item[]): void
  • Reorder all the given elements, in the given order, assuming they all belong to the same group.

    Parameters

    • sameGroupItems: Item[]

      A sorted list of items located in the same group.

    Returns void

cancel

  • cancel(): void

Private getFilteredSortedItems

  • Use the given policy to score and sort the items of all the menus to adapt, and filter out any item which:

    • cannot be reordered;
    • has a null (0) score.

    Parameters

    • menuManager: MenuManager

      The menu manager containing the menus with items to reorder.

    • policy: TargetPolicy

      The policy to use to score the items.

    • Optional dataManager: DataManager

      The data manager containing data for the policy.

    Returns Item[]

    A sorted and filtered list of items.

Private getMaxNbItemsToReorder

  • getMaxNbItemsToReorder(nbItems: number): number
  • Return the maximum number of items which can be reordered in a menu.

    Parameters

    • nbItems: number

      The total number of items in the menu.

    Returns number

    The maximum number of items to reorder in the menu.

Private getMaxNbItemsToReorderInGroup

  • getMaxNbItemsToReorderInGroup(nbItemsInGroup: number): number
  • Return the maximum number of items which can be reordered in a group.

    Parameters

    • nbItemsInGroup: number

      The total number of items in the group.

    Returns number

    The maximum number of items to reorder in the group.

Protected getReorderedElementClass

  • getReorderedElementClass(): string

Protected getReorderedElementType

  • getReorderedElementType(): string

Protected reorderAllElements

  • Reorder all given elements in the given order.

    Non-given elements may be moved to a higher index if need be, except for elements marked as non-reorderable.

    This method expects a complete list of menu adaptive elements, supposedly computed by a policy. It was designed to be called by implementations of AdaptationStyle.apply.

    Parameters

    Returns void

Protected saveParentNodeChildrenInOriginalOrder

Private splitAndApplyByGroup

  • splitAndApplyByGroup(items: Item[]): void

Generated using TypeDoc