@nospamproxy/core
    Preparing search index...

    A generic dialog.

    <!-- example-dialog.html -->
    <generic-dialog load-model.bind="load" finish.bind="finish" width="25rem">
    <normal-text slot="header" value="Example dialog."></normal-text>

    <generic-dialog-content au-slot>
    <text-box value.two-way="name"></text-box>
    </generic-dialog-content>

    <cancel-button au-slot="footer"></cancel-button>
    <save-button au-slot="footer"></save-button>
    </generic-dialog>
    // example-dialog.ts

    export class ExampleDialog {
    public constructor(private readonly service: IGenericDialogService = resolve(IGenericDialogService)) {}

    private name = "";

    private loadModel = async (model): Promise<void> => {
    // Load some data.
    };

    private finish = async (): Promise<string> => {
    // Save data.
    return "Example dialog result.";
    };
    }
    export class ExampleUsage {
    public constructor(private readonly service: IGenericDialogService = resolve(IGenericDialogService)) {}

    public async showDialog() {
    const result = this.service.open({ viewModel: ExampleDialog });
    if (!result.canceled) {
    console.log(result.value);
    }
    }
    }

    Implements

    • ICustomElementViewModel
    Index

    Constructors

    • Returns GenericDialog

    Properties

    $controller: ICustomElementController<GenericDialog>
    activity: ActivityManager = ...
    controller: IGenericDialogController<Constructable, unknown, unknown> = ...
    finish?: () => unknown

    The finish action.

    If an error occurs, the dialog will not be closed and the current activity manager's default error handling is used.

    Type Declaration

      • (): unknown
      • Returns unknown

        The value that will be returned as the dialog result or GenericDialog.CANCEL_FINISH to cancel finishing/saving and leave the dialog open without showing any errors automatically.

    height: string = 'auto'
    helpLink: string | null | undefined

    When set to null, no link to documentation is shown in the dialog header.

    isLoading: boolean = false
    loadModel?: (model: unknown) => void | Promise<void>

    The load action.

    The first parameter is the model passed to the generic dialog service.

    A spinner is shown while loading.

    If an error occurs, the dialog will be closed immediately and the current activity manager's default error handling is used.

    lock: boolean = false

    When set to true, the dialog cannot be closed by pressing hotkeys.

    width: string = 'auto'
    CANCEL_FINISH: typeof CANCEL_FINISH = ...

    Methods

    • Returns void

    • Internal

      Called when unbound and by the dialog controller to dispose this dialogs's focus layer.

      Returns void

    • Returns void

    • Returns void