Class TJSFolderExport
Hierarchy
- TJSDialog
- TJSFolderExport (View Summary)
Index
Accessors
Methods
Properties
Accessors
closing
- get closing(): boolean
Whether the Application is currently closing.
Returns boolean
data
element
- get element(): JQuery
Return the active application element, if it currently exists in the DOM
Returns JQuery
elementContent
elementTarget
id
- get id(): string
Return the CSS application ID which uniquely references this UI element
Returns string
managedPromise
Returns ManagedPromise
Returns the managed promise.
popOut
- get popOut(): boolean
Control the rendering style of the application. If popOut is true, the application is rendered in its own wrapper window, otherwise only the inner app content is rendered
Returns boolean
position
reactive
rendered
- get rendered(): boolean
Return a flag for whether the Application instance is currently rendered
Returns boolean
state
svelte
template
- get template(): string
The path to the HTML template file which should be used to render the inner content of the app
Returns string
title
- get title(): string
An Application window should define its own title definition logic which may be dynamic depending on its data
Returns string
Static
defaultOptions
Methods
Protected
_activateCoreListeners
Activate required listeners which must be enabled on every Application. These are internal interactions which should not be overridden by downstream subclasses.
Parameters
- html: JQuery
Returns void
Protected
_canDragDrop
Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
Parameters
- selector: string
The candidate HTML selector for the drop target
Returns boolean
Can the current user drop on this selector?
- selector: string
Protected
_canDragStart
Define whether a user is able to begin a dragstart workflow for a given drag selector
Parameters
- selector: string
The candidate HTML selector for dragging
Returns boolean
Can the current user drag this selector?
- selector: string
Protected
_createDragDropHandlers
Create drag-and-drop workflow handlers for this Application
Returns DragDrop[]
An array of DragDrop handlers
Protected
_createTabHandlers
Protected
_getHeaderButtons
Protected
Specify the set of config buttons which should appear in the SvelteApp header. Buttons should be returned as an Array of objects. The header buttons which are added to the application can be modified by the
getApplicationHeaderButtons
hook.SvelteApp extends the button functionality with full reactivity for state changes during callbacks. Callbacks receive the button data and can modify it to update the button state.
Returns HeaderButton[]
All header buttons.
Protected
_injectHTML
Customize how a new HTML Application is added and first appears in the DOC
Parameters
- html: JQuery
Returns void
Protected
_onChangeTab
Handle changes to the active tab in a configured Tabs controller
Parameters
- event: MouseEvent
A left click event
- tabs: Tabs
The TabsV2 controller
- active: string
The new active tab name
Returns void
- event: MouseEvent
Protected
_onDragOver
Callback actions which occur when a dragged element is over a drop target.
Parameters
- event: DragEvent
The originating DragEvent
Returns void
- event: DragEvent
Protected
_onDragStart
Callback actions which occur at the beginning of a drag start workflow.
Parameters
- event: DragEvent
The originating DragEvent
Returns void
- event: DragEvent
Protected
_onDrop
Callback actions which occur when a dragged element is dropped on a target.
Parameters
- event: DragEvent
The originating DragEvent
Returns void
- event: DragEvent
Protected
_onResize
Additional actions to take when the application window is resized
Parameters
- event: any
Returns void
Protected
_onSearchFilter
Handle changes to search filtering controllers which are bound to the Application
Parameters
- event: KeyboardEvent
The key-up event from keyboard input
- query: string
The raw string input to the search field
- rgx: RegExp
The regular expression to test against
- html: HTMLElement
The HTML element which should be filtered
Returns void
- event: KeyboardEvent
Protected
_onToggleMinimize
Handle application minimization behavior - collapsing content and reducing the size of the header
Parameters
- ev: any
Returns void
Protected
_render
An asynchronous inner function which handles the rendering of the Application
Parameters
Optional
force: booleanRender and display the application even if it is not currently displayed.
Optional
options: AppV1RenderOptionsProvided rendering options, see the render function for details
Returns Promise<void>
A Promise that resolves to the Application once rendering is complete
Protected
_renderInner
Render the inner application content
Parameters
- data: object
The data used to render the inner template
- options: AppV1RenderOptions
Returns Promise<JQuery>
A promise resolving to the constructed jQuery object
- data: object
Protected
_renderOuter
Render the outer application wrapper
Parameters
- options: AppV1RenderOptions
Returns Promise<JQuery>
A promise resolving to the constructed jQuery object
Protected
_replaceHTML
Customize how inner HTML is replaced when the application is refreshed
Parameters
- element: JQuery
The original HTML element
- html: any
New updated HTML
- options: Record<string, unknown>
Returns void
- element: JQuery
Protected
_restoreScrollPositions
Restore the scroll positions of containers within the app after re-rendering the content
Parameters
- html: any
Returns void
Protected
_saveScrollPositions
Persist the scroll positions of containers within the app before re-rendering the content
Parameters
- html: any
Returns void
activateListeners
After rendering, activate event listeners which provide interactivity for the Application. This is where user-defined Application subclasses should attach their event-handling logic.
Parameters
- html: JQuery
Returns void
bringToTop
Bring the application to the top of the rendering stack
Returns void
close
Close the application and un-register references to it within UI mappings This function returns a Promise which resolves once the window closing animation concludes
Parameters
Optional
options: { force?: boolean }Options which affect how the Application is closed
Returns Promise<void>
A Promise which resolves once the application is closed
getData
An application should define the data object used to render its template. This function may either return an Object directly, or a Promise which resolves to an Object If undefined, the default implementation will return an empty object allowing only for rendering of static HTML
Parameters
Optional
options: Partial<ApplicationV1Options>
Returns object | Promise<object>
maximize
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 SvelteApp.minimize to animate the content area.
Parameters
Optional
opts: { animate?: boolean; duration?: number }Optional parameters.
Optional
animate?: booleanWhen true perform default maximizing animation.
Optional
duration?: numberControls content area animation duration in seconds.
Returns Promise<void>
minimize
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 SvelteApp.minimize to animate the content area.
Parameters
Optional
opts: { animate?: boolean; duration?: number }Optional parameters.
Optional
animate?: booleanWhen true perform default minimizing animation.
Optional
duration?: numberControls content area animation duration in seconds.
Returns Promise<void>
onSvelteMount
Provides a callback after all Svelte components are initialized.
Returns void
onSvelteRemount
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.Returns void
render
Render the Application by evaluating it's HTML template against the object of data provided by the getData method If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls
Parameters
Optional
force: booleanAdd the rendered application to the DOM if it is not already present. If false, the Application will only be re-rendered if it is already present.
Optional
options: AppV1RenderOptionsAdditional rendering options which are applied to customize the way that the Application is rendered in the DOM.
Returns this
The rendered Application instance
wait
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
Optional
options: { reuse?: boolean }Options.
Optional
reuse?: booleanWhen 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.
Static
confirm
- confirm<T>(
data?: OptionsData & {
onNo?: string | ((data?: { application?: TJSDialog }) => any);
onYes?: string | ((data?: { application?: TJSDialog }) => any);
},
options?: OptionsCore,
): Promise<T>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
toyes
orno
.Type Parameters
- T
Parameters
Optional
data: OptionsData & {
onNo?: string | ((data?: { application?: TJSDialog }) => any);
onYes?: string | ((data?: { application?: TJSDialog }) => any);
}Confirm dialog options.
Optional
onNo?: string | ((data?: { application?: TJSDialog }) => any)Callback function upon
no
; may be an async function. When defined as a string any matching function by name exported from content Svelte component is invoked.Optional
onYes?: string | ((data?: { application?: TJSDialog }) => any)Callback function upon
yes
; may be an async function. When defined as a string any matching function by name exported from content Svelte component is invoked.
Optional
options: OptionsCoreSvelteApp options passed to the TJSDialog constructor.
Returns Promise<T>
A promise which resolves with result of yes / no callbacks or true / false.
Static
prompt
- prompt<T>(
data?: OptionsData & {
icon?: string;
label?: string;
onOk?: string | ((data?: { application?: TJSDialog }) => any);
},
options?: OptionsCore,
): Promise<T>A helper factory method to display a basic "prompt" style TJSDialog with a single button.
Type Parameters
- T
Parameters
Optional
data: OptionsData & {
icon?: string;
label?: string;
onOk?: string | ((data?: { application?: TJSDialog }) => any);
}Prompt dialog options that includes any TJSDialog options along with the following optional fields:
Optional
icon?: stringSet another icon besides
fas fa-check
for button.Optional
label?: stringThe OK prompt button text.
Optional
onOk?: string | ((data?: { application?: TJSDialog }) => any)Callback function upon
ok
; may be an async function. When defined as a string any matching function by name exported from content Svelte component is invoked.
Optional
options: OptionsCoreSvelteApp options passed to the TJSDialog constructor.
Returns Promise<T>
The returned value from the provided callback function or
true
if the button is pressed.
Static
show
- show(
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
wait
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
- data: OptionsData
Dialog data passed to the TJSDialog constructor.
Optional
options: OptionsCoreSvelteApp options passed to the TJSDialog constructor.
Returns Promise<T>
A Promise that resolves to the chosen result.
Properties
Protected
_dragDrop
DragDrop workflow handlers which are active for this Application
Protected
_element
An internal reference to the HTML element this application renders
_minimized
Track whether the Application is currently minimized
_priorState
The prior render state of this Application. This allows for rendering logic to understand if the application is being rendered for the first time.
Protected
_scrollPositions
Track the most recent scroll positions for any vertically scrolling containers
Protected
_searchFilters
SearchFilter handlers which are active for this Application
_state
Track the render state of the Application
Protected
_tabs
Tab navigation handlers which are active for this Application
appId
The application ID is a unique incrementing integer which is used to identify every application window drawn by the VTT
options
The options provided to this application upon initialization
Protected
Static
_warnedAppV1
Static
Readonly
RENDER_STATES
CLOSED: -1;
CLOSING: -2;
ERROR: 3;
NONE: 0;
RENDERED: 2;
RENDERING: 1;
}
Provides a reactive dialog for exporting folders to a compendium that by default is modal and not draggable.