Provides a dialog for creating documents that by default is modal and not draggable.

Hierarchy

Constructors

  • Create a new Document of the type specified by documentCls by rendering a dialog window to provide basic creation details.

    Parameters

    • documentCls: object

      Document class to create.

    • Optionaldata: object

      Document data.

    • Optionalcontext: {
          options?: Partial<any>;
          pack?: object;
          parent?: object;
          renderSheet?: boolean;
      }

      Additional context options or dialog positioning options.

      • Optionaloptions?: Partial<any>

        Rest of options to pass to TJSDialog / Application.

      • Optionalpack?: object

        A Compendium pack identifier within which the Documents should be modified.

      • Optionalparent?: object

        A parent Document within which these Documents should be embedded.

      • OptionalrenderSheet?: boolean

        Render the sheet for the new document.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns TJSDocumentCreate

Accessors

  • get elementContent(): HTMLElement
  • Returns the content element if an application shell is mounted.

    Returns HTMLElement

    Content element.

  • get elementTarget(): HTMLElement
  • Returns the target element or main element if no target defined.

    Returns HTMLElement

    Target element.

  • get position(): TJSPosition
  • Returns the TJSPosition instance.

    Returns TJSPosition

    The TJSPosition instance.

  • get reactive(): SvelteReactive
  • Returns the reactive accessors & Svelte stores for SvelteApplication.

    Returns SvelteReactive

    The reactive accessors & Svelte stores.

  • get svelte(): GetSvelteData
  • Returns the Svelte helper class w/ various methods to access mounted Svelte components.

    Returns GetSvelteData

    GetSvelteData

Methods

  • Provides a mechanism to update the UI options store for maximized.

    Note: the sanity check is duplicated from Application.maximize the store is updated before performing the rest of animations. This allows application shells to remove / show any resize handlers correctly. Extra constraint data is stored in a saved position state in SvelteApplication.minimize to animate the content area.

    Parameters

    • Optionalopts: {
          animate?: boolean;
          duration?: number;
      }

      Optional parameters.

      • Optionalanimate?: boolean

        When true perform default maximizing animation.

      • Optionalduration?: number

        Controls content area animation duration in seconds.

    Returns Promise<void>

  • Provides a mechanism to update the UI options store for minimized.

    Note: the sanity check is duplicated from Application.minimize the store is updated before performing the rest of animations. This allows application shells to remove / show any resize handlers correctly. Extra constraint data is stored in a saved position state in SvelteApplication.minimize to animate the content area.

    Parameters

    • Optionalopts: {
          animate?: boolean;
          duration?: number;
      }

      Optional parameters.

      • Optionalanimate?: boolean

        When true perform default minimizing animation.

      • Optionalduration?: number

        Controls content area animation duration in seconds.

    Returns Promise<void>

  • Provides a callback after all Svelte components are initialized.

    Parameters

    Returns void

  • Provides a callback after the main application shell is remounted. This may occur during HMR / hot module replacement or directly invoked from the elementRootUpdate callback passed to the application shell component context.

    Parameters

    Returns void

  • Brings to top or renders this dialog returning a Promise that is resolved any button pressed or when the dialog is closed.

    Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a choice.

    Note: null is returned if the dialog is closed without a user making a choice.

    Type Parameters

    • T

    Parameters

    • Optionaloptions: {
          reuse?: boolean;
      }

      Options.

      • Optionalreuse?: boolean

        When true if there is an existing managed Promise this allows multiple sources to await on the same result.

    Returns Promise<T>

    A promise for dialog resolution.

  • A helper factory method to create simple confirmation dialog windows which consist of simple yes / no prompts. If you require more flexibility, a custom TJSDialog instance is preferred. The default focused button is 'yes'. You can change the default focused button by setting default to yes or no.

    Type Parameters

    • T

    Parameters

    • Optionaldata: TJSDialogOptions & {
          onNo?: string | ((data?: {
              application?: TJSDialog;
          }) => any);
          onYes?: string | ((data?: {
              application?: TJSDialog;
          }) => any);
      }

      Confirm dialog options.

    • Optionaloptions: SvelteApplicationOptions

      SvelteApplication options passed to the TJSDialog constructor.

    Returns Promise<T>

    A promise which resolves with result of yes / no callbacks or true / false.

    const result = await TJSDialog.confirm({
    title: 'A Yes or No Question',
    content: '<p>Choose wisely.</p>',
    onYes: () => 'YES Result',
    onNo: () => 'NO Result'
    });

    // Logs 'YES result', 'NO Result', or null if the user closed the dialog without making a selection.
    console.log(result);
  • A helper factory method to display a basic "prompt" style TJSDialog with a single button.

    Type Parameters

    • T

    Parameters

    • Optionaldata: TJSDialogOptions & {
          icon?: string;
          label?: string;
          onOk?: string | ((data?: {
              application?: TJSDialog;
          }) => any);
      }

      Prompt dialog options that includes any TJSDialog options along with the following optional fields:

    • Optionaloptions: SvelteApplicationOptions

      SvelteApplication options passed to the TJSDialog constructor.

    Returns Promise<T>

    The returned value from the provided callback function or true if the button is pressed.

    const result = await TJSDialog.prompt({
    title: 'Are you OK?',
    content: '<p>Are you OK?.</p>',
    label: 'Feeling Fine!',
    onOk: () => 'OK'
    });

    // Logs 'OK' or null if the user closed the dialog without making a selection.
    console.log(result);
  • Create a new Document of the type specified by documentCls by rendering a dialog window to provide basic creation details.

    Parameters

    • documentCls: object

      Document class to create.

    • Optionaldata: object

      Document data.

    • Optionalcontext: {
          options?: any;
          pack?: object;
          parent?: object;
          renderSheet?: boolean;
      }

      Additional context options or dialog positioning options.

      • Optionaloptions?: any

        Rest of options to pass to TJSDialog / Application.

      • Optionalpack?: object

        A Compendium pack identifier within which the Documents should be modified.

      • Optionalparent?: object

        A parent Document within which these Documents should be embedded.

      • OptionalrenderSheet?: boolean

        Render the sheet for the new document.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<object>

    The newly created document or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a choice.

    Note: By default null is returned if the dialog is closed without a user making a choice.

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

    A Promise that resolves to the chosen result.