@hydroperx/metrodesign
    Preparing search index...

    Class Core

    Live tiles core implementation.

    Hierarchy

    • IntermediateEventTarget<CoreEventMap, this>
      • Core
    Index

    Constructors

    • Constructs a Core instance.

      Parameters

      • params: {
            checkEnabled?: boolean;
            classNames: CoreClassNames;
            container: HTMLDivElement;
            direction: CoreDirection;
            dragEnabled?: boolean;
            groupGap: number;
            groupHeight?: number;
            groupWidth?: number;
            inlineGroups?: number;
            labelHeight: number;
            renamingGroupsEnabled?: boolean;
            rtl?: boolean;
            size1x1: number;
            tileGap: number;
        }
        • OptionalcheckEnabled?: boolean

          Whether checking tiles is enabled.

          true
          
        • classNames: CoreClassNames

          Specific class names to target for.

        • container: HTMLDivElement

          Container.

        • direction: CoreDirection

          The direction of the live tile layout.

        • OptionaldragEnabled?: boolean

          Whether drag-n-drop is enabled.

          true
          
        • groupGap: number

          Gap between groups in logical pixels.

        • OptionalgroupHeight?: number

          Height in 1x1 tiles, effective only in a horizontal layout (must be >= 4).

          6
          
        • OptionalgroupWidth?: number

          Group width in 1x1 tiles, effective only in a vertical layout (must be >= 4).

          6
          
        • OptionalinlineGroups?: number

          Number of inline groups, effective only in a vertical layout (must be >= 1).

          1
          
        • labelHeight: number

          Group label height in logical pixels.

        • OptionalrenamingGroupsEnabled?: boolean

          Whether renaming groups is enabled.

          true
          
        • Optionalrtl?: boolean

          Whether to use right-to-left group label inputs.

          false
          
        • size1x1: number

          The size of a 1x1 tile in logical pixels.

        • tileGap: number

          Gap between tiles in logical pixels.

      Returns Core

    Accessors

    • get groupHeight(): number

      Group height in 1x1 tiles, effective only in a horizontal layout (must be >= 4).

      Returns number

    • set groupHeight(val: number): void

      Parameters

      • val: number

      Returns void

    • get groupWidth(): number

      Group width in 1x1 tiles, effective only in a vertical layout (must be >= 4).

      Returns number

    • set groupWidth(val: number): void

      Parameters

      • val: number

      Returns void

    • get inlineGroups(): number

      Number of inline groups, effective only in a vertical layout. (Must be >= 1.)

      Returns number

    • set inlineGroups(val: number): void

      Parameters

      • val: number

      Returns void

    Methods

    • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

      The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

      When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

      When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

      When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

      If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

      The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

      MDN Reference

      Type Parameters

      • K extends keyof CoreEventMap

      Parameters

      • type: K
      • callback: (
            event: CoreEventMap[K] extends Event ? any[any] : never,
        ) => CoreEventMap[K] extends Event ? void : never
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

      The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

      When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

      When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

      When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

      If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

      The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Sets whether a tile is checked or not.

      Parameters

      • tileId: string
      • value: boolean

      Returns void

    • Destroys the Core instance, disposing of any observers and handlers.

      Parameters

      • removeFromDOM: boolean = true

      Returns void

    • Detects a node (tile or group) and checks if it has changed, re-positioning and rearranging things up, transferring group or removing item.

      Parameters

      • node: HTMLElement

      Returns void

    • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Returns the number of inline groups available for the given width (either in px or rem). Applies to a vertical layout only.

      Parameters

      • width: string

      Returns number

      If not in a vertical layout.

    • Shorthand to removeEventListener().

      Type Parameters

      • K extends keyof CoreEventMap

      Parameters

      • type: K
      • listenerFn: (event: CoreEventMap[K]) => void
      • Optionaloptions: EventListenerOptions

      Returns void

    • Shorthand to removeEventListener().

      Parameters

      • type: string
      • listenerFn: (event: Event) => void
      • Optionaloptions: EventListenerOptions

      Returns void

    • Shorthand to addEventListener().

      Type Parameters

      • K extends keyof CoreEventMap

      Parameters

      • type: K
      • listenerFn: (event: CoreEventMap[K]) => void
      • Optionaloptions: AddEventListenerOptions

      Returns void

    • Shorthand to addEventListener().

      Parameters

      • type: string
      • listenerFn: (event: Event) => void
      • Optionaloptions: AddEventListenerOptions

      Returns void

    • Rearranges the layout when the minimum scale to make it work is reached.

      Calling this method may be necessary if the container is initially scaled to zero.

      Returns AbortController

    • Removes the event listener in target's event listener list with the same type, callback, and options.

      MDN Reference

      Type Parameters

      • K extends keyof CoreEventMap

      Parameters

      • type: K
      • callback: (
            event: CoreEventMap[K] extends Event ? any[any] : never,
        ) => CoreEventMap[K] extends Event ? void : never
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Removes the event listener in target's event listener list with the same type, callback, and options.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void