A custom HTMLElement used to render a set of associated Documents referenced by UUID.

Hierarchy (view full)

Properties

_value: Record<string, string> = {}
_primaryInput: HTMLElement

The primary input (if any). Used to determine what element should receive focus when an associated label is clicked on.

_internals: ElementInternals

Attached ElementInternals which provides form handling functionality.

#button: HTMLButtonElement

The button element to add a new document.

#input: HTMLInputElement

The input element to define a Document UUID.

#tags: HTMLDivElement

The list of tagged documents.

tagName: string = "document-tags"
formAssociated: boolean = true

Declare that this custom element provides form element functionality.

Accessors

  • get type(): string
  • Restrict this element to documents of a particular type.

    Returns string

  • get single(): boolean
  • Restrict to only allow referencing a single Document instead of an array of documents.

    Returns boolean

  • get max(): number
  • Allow a maximum number of documents to be tagged to the element.

    Returns number

  • get form(): HTMLFormElement
  • The form this element belongs to.

    Returns HTMLFormElement

  • get name(): string
  • The input element name.

    Returns string

  • get disabled(): boolean
  • Is this element disabled?

    Returns boolean

  • get editable(): boolean
  • Is this field editable? The field can be neither disabled nor readonly.

    Returns boolean

Methods

  • Validate that the tagged document is allowed to be added to this field. Subclasses may impose more strict validation as to which types of documents are allowed.

    Parameters

    • document: any

      A candidate document or compendium index entry to tag

    Returns void

    Throws

    An error if the candidate document is not allowed

  • Internal

    Apply key attributes on the containing custom HTML element to input elements contained within it.

    Parameters

    • input: any

    Returns void

  • Protected

    Initialize innerText or an initial value attribute of the element as a serialized JSON array.

    Returns void

  • Protected

    Special handling when the custom element is clicked. This should be implemented to transfer focus to an appropriate internal element.

    Parameters

    • event: PointerEvent

    Returns void

  • Remove a single coefficient by clicking on its tag.

    Parameters

    • event: PointerEvent

    Returns void

  • Add a new document tag by pressing the ENTER key in the UUID input field.

    Parameters

    • event: KeyboardEvent

    Returns void

  • Handle data dropped onto the form element.

    Parameters

    • event: DragEvent

    Returns void

  • Add a Document to the tagged set using the value of the input field.

    Parameters

    • uuid: string

      The UUID to attempt to add

    Returns void

  • Add a new UUID to the tagged set, throwing an error if the UUID is not valid.

    Parameters

    • uuid: string

      The UUID to add

    Returns void

    Throws

    If the UUID is not valid

  • Create an HTML string fragment for a single document tag.

    Parameters

    • uuid: string

      The document UUID

    • name: string

      The document name

    • Optional editable: boolean = true

      Is the tag editable?

    Returns HTMLDivElement