Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

canBeReordered

canBeReordered: boolean

Flag indicating whether the item can be reordered or not.

id

id: string

Unique ID of the element. It should be computed once, before any adaptation, using getID method.

items

items: Item[]

List of all the group items.

node

node: JQuery

Node of the element.

parent

parent: Menu

Menu element owning the item.

selector

selector: Selector | NoSelector

Selector used to find the node. If no selector was used, it should be set to NO_SELECTOR.

Static ELEMENT_TYPE

ELEMENT_TYPE: string = "group"

Type of group elements.

Static HTML_CLASS

HTML_CLASS: string = "sam-group"

Standard HTML class for group elements.

Static TAG_PREFIX

TAG_PREFIX: string = "data-sam-"

Prefix of all tags added to nodes by SAM. It acts as a sort of HTML attribute namespace.

Methods

Private fillUsingItemSelector

  • fillUsingItemSelector(itemSelector: Selector): void
  • Create item from the given selector, and add them all to the group.

    Item nodes are only searched inside the group node.

    Parameters

    • itemSelector: Selector

      The selector for all item elements.

    Returns void

getSelector

  • getSelector(): string

getTag

  • getTag(name: string): string | undefined

getType

  • getType(): string

isAlphabeticallySorted

  • isAlphabeticallySorted(): boolean
  • Test whether the group items are alphabetically sorted. Character case and punctation are ignored (see localCompare details).

    Returns boolean

    true if they are sorted, false otherwise.

tag

  • tag(name: string, value: string): void
  • Add a tag to the element node, i.e. an prefixed HTML attribute. Note: the prefix is automatically prepended to the tag name.

    Parameters

    • name: string

      The name of the tag (without the prefix).

    • value: string

      The value of the attribute.

    Returns void

updateItemsReorderingConstraints

  • updateItemsReorderingConstraints(): void
  • Update the reordering constraints of all the group items, such that:

    • any item which already is non-reorderable remains so;
    • all other item remain reorderable, except if all items are alphabetically ordered.

    Returns void

Static fromSelectors

  • Create a group from the given selectors.

    If NO_SELECTOR is passed to groupSelector, the group node will be equal to the node of its parent menu.

    Parameters

    • groupSelector: Selector | NoSelector

      Selector of the group node, or NO_SELECTOR flag.

    • itemSelector: Selector

      Selector of the item nodes.

    • parent: Menu

      The menu containing this group.

    Returns ItemGroup

    A new instance of ItemGroup.

Static getNodeTag

  • getNodeTag(node: JQuery, name: string): string | undefined
  • Get the value of a tag of the given node. Note: the prefix is automatically prepended to the tag name.

    Parameters

    • node: JQuery

      The tagged node (with the attribute).

    • name: string

      The name of the tag (without the prefix).

    Returns string | undefined

    The value of the tag, or undefined if the tag was not found.

Static nodeToSelector

  • nodeToSelector(node: JQuery): string
  • Return a standalone jQuery string selector for the given node, i.e. $(<selector>) should select the node.

    The selector is built recursively, in the following way:

    • if the node is the body or html node, it returns the related tag selector;
    • if the node has an ID, it returns the related ID selector;
    • otherwise, it calls nodeToSelector on the parent node of the given node, and returns the result with the following concatenation: (1) a child selector (>); (2) the node tag; (3) the node positional selector (:eq(<index>)).

    Parameters

    • node: JQuery

      The node to represent with a selector.

    Returns string

    The standalone selector.

Generated using TypeDoc