Class TJSDocumentDialog
Methods
StaticconfigureOwnership
- 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.
Optionaloptions: OptionsCoreRest of options to pass to TJSDialog / SvelteApp.
OptionaldialogData: 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.
StaticdocumentCreate
- 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
documentClsby rendering a dialog window to provide basic creation details.Type Parameters
- D extends DocumentConstructor
Parameters
- documentCls: D
Document class to create.
Optionaldata: objectDocument data.
Optionalcontext: { pack?: string; parent?: Document; renderSheet?: boolean } & Partial<
OptionsCore,
>Additional context options or dialog positioning options.
Optionalpack?: stringA Compendium pack identifier within which the Documents should be modified.
Optionalparent?: DocumentA parent Document within which these Documents should be embedded.
OptionalrenderSheet?: 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.
OptionaldialogData: 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.
StaticdocumentDelete
- 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.
Optionaloptions: OptionsCoreTJSDialog / SvelteApp options.
OptionaldialogData: 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.
StaticfolderCreate
- folderCreate(
folderData: { folder?: string; type: string },
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder<EnfolderableDocument>>Create a new Folder by rendering a dialog to provide basic creation details.
Parameters
- folderData: { folder?: string; type: string }
Initial data with which to populate the creation form.
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder<EnfolderableDocument>>
The newly created Folder or null if the dialog is closed.
- folderData: { folder?: string; type: string }
StaticfolderDelete
- folderDelete(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder<EnfolderableDocument>>Deletes a folder and does delete subfolders / documents.
Parameters
- document: Folder
Folder to delete.
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder<EnfolderableDocument>>
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
StaticfolderExport
- 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.
Optionalopts: { keepId?: boolean; merge?: boolean; pack?: string } & Partial<OptionsCore>Additional options.
OptionalkeepId?: booleanKeep document IDs.
Optionalmerge?: booleanUpdate existing entries in the Compendium pack, matching by name
Optionalpack?: 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.
OptionaldialogData: 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
StaticfolderRemove
- folderRemove(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<false | Folder<EnfolderableDocument>>Removes a folder, but does not delete / remove sub-folders / documents.
Parameters
- document: Folder
The folder to remove.
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: OptionsDataOptional data to modify dialog.
Returns Promise<false | Folder<EnfolderableDocument>>
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
StaticfolderRolltable
- 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...
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: 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
StaticfolderUpdate
- folderUpdate(
document: Folder,
options?: OptionsCore,
dialogData?: OptionsData,
): Promise<Folder<EnfolderableDocument>>Updates an existing Folder by rendering a dialog window with basic details.
Parameters
- document: Folder
The folder to edit.
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: OptionsDataOptional data to modify dialog.
Returns Promise<Folder<EnfolderableDocument>>
The modified Folder or null if the dialog is closed.
- document: Folder
StaticimportFromJSON
- 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...
Optionaloptions: OptionsCoreOptions to pass to TJSDialog / SvelteApp.
OptionaldialogData: 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.