BIM.works SDKs - v3.0.0-b.115
    Preparing search index...

    Interface TemplateContext

    The second argument of a template's render

    interface TemplateContext {
        format: {
            date(value: string | number | Date): string;
            initials(name: string): string;
            number(value: number, digits?: number): string;
            quantity(value: unknown): string;
            relative(value: string | number | Date, now?: number): string;
            type(type: string | null): string;
        };
        hovered: boolean;
        icons: {
            glyph(name: string): TemplateResult;
            ifc(type: string | null): TemplateResult;
        };
        key: string;
        mergedCount: number;
        now: number;
        qid: Qid
        | null;
        state: "expanded" | "compact";
        type: string | null;
    }
    Index

    Properties

    format: {
        date(value: string | number | Date): string;
        initials(name: string): string;
        number(value: number, digits?: number): string;
        quantity(value: unknown): string;
        relative(value: string | number | Date, now?: number): string;
        type(type: string | null): string;
    }

    Type Declaration

    • date: function
      • Parameters

        • value: string | number | Date

        Returns string

    • initials: function
      • Parameters

        • name: string

        Returns string

    • number: function
      • Parameters

        • value: number
        • Optionaldigits: number

        Returns string

    • quantity: function
      • Any data value as text: a Quantity with its unit, Yes or No for a boolean, a dash for no value

        Parameters

        • value: unknown

        Returns string

    • relative: function
      • "3 min ago", "in 2 days"

        Parameters

        • value: string | number | Date
        • Optionalnow: number

        Returns string

    • type: function
      • "Door" for IFCDOOR

        Parameters

        • type: string | null

        Returns string

    hovered: boolean

    The annotation, or its object in a viewer, is under the pointer. The compact state is drawn again when this changes; a template with hover "template" shows it (keep the size: change colour, shadow or a transform)

    icons: {
        glyph(name: string): TemplateResult;
        ifc(type: string | null): TemplateResult;
    }

    Type Declaration

    • glyph: function
      • A glyph: check, cross, warning, clock, chat, wrench, eye, zoom, open

        Parameters

        • name: string

        Returns TemplateResult

    • ifc: function
      • The icon of an IFC class, a generic object icon for a class without one

        Parameters

        • type: string | null

        Returns TemplateResult

    key: string
    mergedCount: number

    More than 1 when this annotation fronts a cluster

    now: number

    Time of this render

    qid: Qid | null
    state: "expanded" | "compact"

    "compact" at rest; "expanded" in the card that opens on hover or click (expandable templates)

    type: string | null

    IFC class of the row ("IfcDoor"), null without one