Ibyar/Aurora
    Preparing search index...

    Interface BaseFormAssociatedComponent<T>

    Custom Elements

    One of the key features of web components is the ability to create custom elements: that is, HTML elements whose behavior is defined by the web developer, that extend the set of elements available in the browser. This article introduces custom elements, and walks through some examples.

    There are two types of custom element:

    • Autonomous custom elements inherit from the HTML element base class HTMLElement. You have to implement their behavior from scratch.

    • Customized built-in elements inherit from standard HTML elements such as HTMLImageElement or HTMLParagraphElement. Their implementation extends the behavior of select instances of the standard element.

    interface BaseFormAssociatedComponent<T extends Object> {
        _detector: ChangeDetectorRef;
        _model: ModelType<T>;
        _modelScope: ReactiveControlScope<T & Context>;
        _provider: InjectionProvider;
        _render: ComponentRender<any>;
        _signalScope: SignalScope;
        _viewScope: ReactiveScope<{ this: BaseComponent<T> }>;
        _zone: AuroraZone;
        form: HTMLFormElement | null;
        internals: ElementInternals;
        valueControl?: ValueControl<T>;
        adoptedCallback(): void;
        attributeChangedCallback(name: string, oldValue: any, newValue: any): void;
        connectedCallback(): void;
        connectedMoveCallback(): void;
        disconnectedCallback(): void;
        formAssociatedCallback(form: HTMLFormElement | null): void;
        formDisabledCallback(disabled: boolean): void;
        formResetCallback(): void;
        formStateRestoreCallback(
            value: any,
            mode: "autocomplete" | "restore",
        ): void;
        getComponentRef(): ComponentRef<T>;
        getInput(viewProp: string): PropertyRef | undefined;
        getInputValue(viewProp: string): any;
        onDestroy(callback: () => void): void;
        registerValueControl(valueControl: ValueControl): void;
        setInputValue(viewProp: string, value: any): void;
    }

    Type Parameters

    • T extends Object

    Hierarchy (View Summary)

    Index
    _model: ModelType<T>
    _render: ComponentRender<any>
    _signalScope: SignalScope
    _viewScope: ReactiveScope<{ this: BaseComponent<T> }>
    _zone: AuroraZone
    form: HTMLFormElement | null
    internals: ElementInternals
    valueControl?: ValueControl<T>
    • Called each time the element is moved to a new document.

      Returns void

    • Called when attributes are changed, added, removed, or replaced. See Responding to attribute changes for more details about this callback.

      Parameters

      • name: string

        The name of the attribute which changed

      • oldValue: any

        The attribute's old value.

      • newValue: any

        The attribute's new value.

      Returns void

    • Called each time the element is added to the document. The specification recommends that, as far as possible, developers should implement custom element setup in this callback rather than the constructor.

      Returns void

    • When defined, this is called instead of () and () each time the element is moved to a different place in the DOM via (). Use this to avoid running initialization/cleanup code in the () and () callbacks when the element is not actually being added to or removed from the DOM. See Lifecycle callbacks and state-preserving moves for more details.

      Returns void

    • Called each time the element is removed from the document.

      Returns void

    • Called after the disabled state of the element changes, either because the disabled attribute of this element was added or removed; or because the disabled state changed on a

      that's an ancestor of this element. The disabled parameter represents the new disabled state of the element. The element may, for example, disable elements in its shadow DOM when it is disabled.

      Parameters

      • disabled: boolean

      Returns void

    • Called after the form is reset. The element should reset itself to some kind of default state. For elements, this usually involves setting the value property to match the value attribute set in markup (or in the case of a checkbox, setting the checked property to match the checked attribute.

      Returns void

    • Called in one of two circumstances: When the browser restores the state of the element (for example, after a navigation, or when the browser restarts). The mode argument is "restore" in this case.

      When the browser's input-assist features such as form auto filling sets a value. The mode argument is "autocomplete" in this case.

      The type of the first argument depends on how the setFormValue() method was called. For more details, see Restoring form state.

      Parameters

      • value: any
      • mode: "autocomplete" | "restore"

      Returns void

    • Parameters

      • viewProp: string

      Returns PropertyRef | undefined

    • Parameters

      • viewProp: string

      Returns any

    • Parameters

      • callback: () => void

      Returns void

    • Parameters

      Returns void

    • Parameters

      • viewProp: string
      • value: any

      Returns void