|
|
import _TemplatedMixin = require("./_TemplatedMixin");
|
|
|
import _FormMixin = require("./form/_FormMixin");
|
|
|
import _DialogMixin = require("./_DialogMixin");
|
|
|
import _CssStateMixin = require("./_CssStateMixin");
|
|
|
import { CSSStateNodes } from "./_CssStateMixin";
|
|
|
import DojoPromise = require("dojo/promise/Promise");
|
|
|
import { DomGeometryWidthHeight } from "dojo/dom-geometry";
|
|
|
import { _WidgetBaseConstructor, _WidgetBase } from "./_WidgetBase";
|
|
|
import ContentPane = require("./layout/ContentPane");
|
|
|
|
|
|
interface _DialogBase extends _TemplatedMixin, _FormMixin, _DialogMixin, _CssStateMixin {
|
|
|
templateString: string;
|
|
|
baseClass: string;
|
|
|
cssStateNodes: CSSStateNodes;
|
|
|
|
|
|
/**
|
|
|
* True if Dialog is currently displayed on screen.
|
|
|
*/
|
|
|
open: boolean;
|
|
|
|
|
|
/**
|
|
|
* The time in milliseconds it takes the dialog to fade in and out
|
|
|
*/
|
|
|
duration: number;
|
|
|
|
|
|
/**
|
|
|
* A Toggle to modify the default focus behavior of a Dialog, which
|
|
|
* is to re-focus the element which had focus before being opened.
|
|
|
* False will disable refocusing. Default: true
|
|
|
*/
|
|
|
refocus: boolean;
|
|
|
|
|
|
/**
|
|
|
* A Toggle to modify the default focus behavior of a Dialog, which
|
|
|
* is to focus on the first dialog element after opening the dialog.
|
|
|
* False will disable autofocusing. Default: true
|
|
|
*/
|
|
|
autofocus: boolean;
|
|
|
|
|
|
/**
|
|
|
* Toggles the movable aspect of the Dialog. If true, Dialog
|
|
|
* can be dragged by it's title. If false it will remain centered
|
|
|
* in the viewport.
|
|
|
*/
|
|
|
draggable: boolean;
|
|
|
|
|
|
/**
|
|
|
* Maximum size to allow the dialog to expand to, relative to viewport size
|
|
|
*/
|
|
|
maxRatio: number;
|
|
|
|
|
|
/**
|
|
|
* Dialog show [x] icon to close itself, and ESC key will close the dialog.
|
|
|
*/
|
|
|
closable: boolean;
|
|
|
postMixInProperties(): void;
|
|
|
postCreate(): void;
|
|
|
|
|
|
/**
|
|
|
* Called when data has been loaded from an href.
|
|
|
* Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
|
|
|
* but should *not* be overridden.
|
|
|
*/
|
|
|
onLoad(data?: any): void;
|
|
|
|
|
|
focus(): void;
|
|
|
|
|
|
/* Not entirely sure of the resolution type of these promises */
|
|
|
|
|
|
/**
|
|
|
* Display the dialog
|
|
|
*/
|
|
|
show(): DojoPromise<any>;
|
|
|
|
|
|
/**
|
|
|
* Hide the dialog
|
|
|
*/
|
|
|
hide(): DojoPromise<any>;
|
|
|
|
|
|
/**
|
|
|
* Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as
|
|
|
* necessary to keep it visible.
|
|
|
*
|
|
|
* Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the
|
|
|
* size of the dialog.
|
|
|
*/
|
|
|
resize(dim?: DomGeometryWidthHeight): void;
|
|
|
|
|
|
destroy(preserveDom?: boolean): void;
|
|
|
}
|
|
|
|
|
|
type _DialogBaseConstructor = _WidgetBaseConstructor<_DialogBase>;
|
|
|
|
|
|
interface Dialog extends ContentPane, _DialogBase {
|
|
|
/* overrides conflicting methods */
|
|
|
resize(dim?: DomGeometryWidthHeight): void;
|
|
|
}
|
|
|
|
|
|
interface DialogLevelManager {
|
|
|
_beginZIndex: number;
|
|
|
|
|
|
/**
|
|
|
* Call right before fade-in animation for new dialog.
|
|
|
*
|
|
|
* Saves current focus, displays/adjusts underlay for new dialog,
|
|
|
* and sets the z-index of the dialog itself.
|
|
|
*
|
|
|
* New dialog will be displayed on top of all currently displayed dialogs.
|
|
|
* Caller is responsible for setting focus in new dialog after the fade-in
|
|
|
* animation completes.
|
|
|
*/
|
|
|
show(dialog: _WidgetBase, underlayAttrs: Object): void;
|
|
|
|
|
|
/**
|
|
|
* Called when the specified dialog is hidden/destroyed, after the fade-out
|
|
|
* animation ends, in order to reset page focus, fix the underlay, etc.
|
|
|
* If the specified dialog isn't open then does nothing.
|
|
|
*
|
|
|
* Caller is responsible for either setting display:none on the dialog domNode,
|
|
|
* or calling dijit/popup.hide(), or removing it from the page DOM.
|
|
|
*/
|
|
|
hide(dialog: _WidgetBase): void;
|
|
|
|
|
|
/**
|
|
|
* Returns true if specified Dialog is the top in the task
|
|
|
*/
|
|
|
isTop(dialog: _WidgetBase): boolean;
|
|
|
}
|
|
|
|
|
|
declare namespace Dialog {
|
|
|
|
|
|
interface DialogConstructor extends _WidgetBaseConstructor<Dialog> {
|
|
|
/**
|
|
|
* for monkey patching and dojox/widget/DialogSimple
|
|
|
*/
|
|
|
_DialogBase: _DialogBaseConstructor;
|
|
|
_DialogLevelManager: DialogLevelManager;
|
|
|
_dialogStack: {
|
|
|
dialog: _WidgetBase,
|
|
|
focus: any,
|
|
|
underlayAttrs: any
|
|
|
}[];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
declare const Dialog: Dialog.DialogConstructor;
|
|
|
export = Dialog;
|
|
|
|