Class TJSDocumentDialog
Methods
Static
configureOwnership
- configureOwnership<D extends Document>(
document: D,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<D> Change ownership of a document by rendering a dialog to alter the default and all user / player ownership.
Type Parameters
- D extends Document
Parameters
- document: D
Document instance to modify.
Optional
options: OptionsCoreRest of options to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<D>
The modified document or 'null' if the user closed the dialog via
<Esc>
or the close header button.
Static
documentCreate
- documentCreate<D extends DocumentConstructor>(
documentCls: D,
data?: object,
context?: { pack?: string; parent?: Document; renderSheet?: boolean } & Partial<
OptionsCore,
>,
dialogData?: OptionsData,
): Promise<false | InstanceType<D>> Create a new Document of the type specified by
documentCls
by rendering a dialog window to provide basic creation details.Type Parameters
- D extends DocumentConstructor
Parameters
- documentCls: D
Document class to create.
Optional
data: objectDocument data.
Optional
context: { pack?: string; parent?: Document; renderSheet?: boolean } & Partial<
OptionsCore,
>Additional context options or dialog positioning options.
Optional
pack?: stringA Compendium pack identifier within which the Documents should be modified.
Optional
parent?: DocumentA parent Document within which these Documents should be embedded.
Optional
renderSheet?: booleanRender the sheet for the new document.
parent
A parent Document within which these Documents should be embedded.
pack
A Compendium pack identifier within which the Documents should be modified.
renderSheet
Render the sheet for the new document.
options
Rest of options to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | InstanceType<D>>
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.
Static
documentDelete
- documentDelete<D extends Document>(
document: D,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<false | D> Shows a modal / non-draggable dialog to delete a document.
Type Parameters
- D extends Document
Parameters
- document: D
Document to delete.
Optional
options: OptionsCoreTJSDialog / SvelteApp options.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | D>
The document if deleted or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.
Static
folderCreate
- folderCreate(
folderData: { type: string },
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder> Create a new Folder by rendering a dialog to provide basic creation details.
Parameters
- folderData: { type: string }
Initial data with which to populate the creation form.
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder>
The newly created Folder or null if the dialog is closed.
- folderData: { type: string }
Static
folderDelete
- folderDelete(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder> Deletes a folder and does delete subfolders / documents.
Parameters
- document: Folder
Folder to delete.
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder>
The deleted Folder or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.- document: Folder
Static
folderExport
- folderExport(
document: Folder,
opts?: { keepId?: boolean; merge?: boolean; pack?: string } & Partial<
OptionsCore,
>,
dialogData?: OptionsData,
): Promise<false | CompendiumCollection> Shows a modal / non-draggable dialog to export a folder to an eligible compendium pack.
Parameters
- document: Folder
Folder to export.
Optional
opts: { keepId?: boolean; merge?: boolean; pack?: string } & Partial<OptionsCore>Additional options.
Optional
keepId?: booleanKeep document IDs.
Optional
merge?: booleanUpdate existing entries in the Compendium pack, matching by name
Optional
pack?: stringThe name of the compendium pack to provide an initial selection value in the dialog.
pack
The name of the compendium pack to provide an initial selection value in the dialog.
merge
Update existing entries in the Compendium pack, matching by name
keepId
Keep document IDs.
options
Rest of options to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | CompendiumCollection>
The compendium collection the folder is exported to or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.- document: Folder
Static
folderRemove
- folderRemove(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<false | Folder> Removes a folder, but does not delete / remove sub-folders / documents.
Parameters
- document: Folder
The folder to remove.
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | Folder>
The removed Folder or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.- document: Folder
Static
folderRolltable
- folderRolltable(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<false | RollTable> Create a RollTable from the contents of the Folder.
Parameters
- document: Folder
Folder to create roll table from...
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | RollTable>
The newly created RollTable or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.- document: Folder
Static
folderUpdate
- folderUpdate(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder> Updates an existing Folder by rendering a dialog window with basic details.
Parameters
- document: Folder
The folder to edit.
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder>
The modified Folder or null if the dialog is closed.
- document: Folder
Static
importFromJSON
- importFromJSON<D extends Document>(
document: D,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<false | D> Render an import dialog for updating the data related to this Document through an exported JSON file
Type Parameters
- D extends Document
Parameters
- document: D
The document to import JSON to...
Optional
options: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
Optional
dialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | D>
The document after import completes or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via
<Esc>
or the close header button.
Provides several methods to create documents, folders, and modify them through use of TJSDialog and a modal and non-draggable by default user experience.