Update to angular ui bootstrap v0.13.0

This commit is contained in:
Brian Surowiec
2015-07-28 14:27:35 -04:00
parent b2345aee40
commit 91eb243dfa
2 changed files with 79 additions and 19 deletions
@@ -7,6 +7,7 @@ testApp.config((
$buttonConfig: ng.ui.bootstrap.IButtonConfig,
$datepickerConfig: ng.ui.bootstrap.IDatepickerConfig,
$datepickerPopupConfig: ng.ui.bootstrap.IDatepickerPopupConfig,
$modalProvider: ng.ui.bootstrap.IModalProvider,
$paginationConfig: ng.ui.bootstrap.IPaginationConfig,
$pagerConfig: ng.ui.bootstrap.IPagerConfig,
$progressConfig: ng.ui.bootstrap.IProgressConfig,
@@ -41,6 +42,7 @@ testApp.config((
$datepickerConfig.startingDay = 1;
$datepickerConfig.yearFormat = 'y';
$datepickerConfig.yearRange = 10;
$datepickerConfig.shortcutPropagation = true;
/**
@@ -56,6 +58,12 @@ testApp.config((
$datepickerPopupConfig.toggleWeeksText = 'Show Weeks';
/**
* $modalProvider tests
*/
$modalProvider.options.animation = false;
/**
* $paginationConfig tests
*/
@@ -110,7 +118,8 @@ testApp.config((
placement: 'bottom',
animation: false,
popupDelay: 1000,
appendtoBody: true
appendtoBody: true,
useContentExp: true
});
$tooltipProvider.setTriggers({
'customOpenTrigger': 'customCloseTrigger'
@@ -129,7 +138,9 @@ testApp.controller('TestCtrl', (
* test the $modal service
*/
var modalInstance = $modal.open({
animation: false,
backdrop: 'static',
backdropClass: 'testing',
controller: 'ModalTestCtrl',
controllerAs: 'vm',
keyboard: true,
@@ -149,12 +160,23 @@ testApp.controller('TestCtrl', (
$log.log('modal opened');
});
modalInstance.rendered.then(() => {
$log.log('modal rendered');
});
modalInstance.result.then((closeResult:any)=> {
$log.log('modal closed', closeResult);
}, (dismissResult:any)=> {
$log.log('modal dismissed', dismissResult);
});
$modal.open({
backdrop: 'static'
});
$modal.open({
templateUrl: () => '/templates/modal.html'
});
/**
* test the $modalStack service
+56 -18
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular UI Bootstrap 0.11.0
// Type definitions for Angular UI Bootstrap 0.13.0
// Project: https://github.com/angular-ui/bootstrap
// Definitions by: Brian Surowiec <https://github.com/xt0rted>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -107,6 +107,13 @@ declare module angular.ui.bootstrap {
* @default null
*/
maxDate?: any;
/**
* An option to disable or enable shortcut's event propagation
*
* @default false
*/
shortcutPropagation?: boolean;
}
interface IDatepickerPopupConfig {
@@ -168,6 +175,13 @@ declare module angular.ui.bootstrap {
}
interface IModalProvider {
/**
* Default options all modals will use.
*/
options: IModalSettings;
}
interface IModalService {
/**
* @param {IModalSettings} options
@@ -178,47 +192,52 @@ declare module angular.ui.bootstrap {
interface IModalServiceInstance {
/**
* a method that can be used to close a modal, passing a result
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
close(result?: any): void;
/**
* a method that can be used to dismiss a modal, passing a reason
* A method that can be used to dismiss a modal, passing a reason. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
dismiss(reason?: any): void;
/**
* a promise that is resolved when a modal is closed and rejected when a modal is dismissed
* A promise that is resolved when a modal is closed and rejected when a modal is dismissed.
*/
result: angular.IPromise<any>;
/**
* a promise that is resolved when a modal gets opened after downloading content's template and resolving all variables
* A promise that is resolved when a modal gets opened after downloading content's template and resolving all variables.
*/
opened: angular.IPromise<any>;
/**
* A promise that is resolved when a modal is rendered.
*/
rendered: angular.IPromise<any>;
}
interface IModalScope extends angular.IScope {
/**
* Those methods make it easy to close a modal window without a need to create a dedicated controller
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*
* @returns true if the modal was closed; otherwise false
*/
$dismiss(reason?: any): boolean;
/**
* Dismiss the dialog without assigning a value to the promise output
* Close the dialog resolving the promise to the given value. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*
* @returns true if the modal was closed; otherwise false
*/
$dismiss(reason?: any): void;
/**
* Close the dialog resolving the promise to the given value
*/
$close(result?: any): void;
$close(result?: any): boolean;
}
interface IModalSettings {
/**
* a path to a template representing modal's content
*/
templateUrl?: string;
templateUrl?: string | (() => string);
/**
* inline template representing the modal's content
@@ -248,6 +267,13 @@ declare module angular.ui.bootstrap {
*/
resolve?: any;
/**
* Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed.
*
* @default true
*/
animation?: boolean;
/**
* controls the presence of a backdrop
* Allowed values:
@@ -257,10 +283,12 @@ declare module angular.ui.bootstrap {
*
* @default true
*/
backdrop?: any;
backdrop?: boolean | string;
/**
* indicates whether the dialog should be closable by hitting the ESC key, defaults to true
* indicates whether the dialog should be closable by hitting the ESC key
*
* @default true
*/
keyboard?: boolean;
@@ -275,7 +303,7 @@ declare module angular.ui.bootstrap {
windowClass?: string;
/**
* optional size of modal window. Allowed values: 'sm' (small) or 'lg' (large). Requires Bootstrap 3.1.0 or later
* Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`.
*/
size?: string;
@@ -577,7 +605,7 @@ declare module angular.ui.bootstrap {
placement?: string;
/**
* Should it fade in and out?
* Should the modal fade in and out?
*
* @default true
*/
@@ -603,6 +631,13 @@ declare module angular.ui.bootstrap {
* @default 'mouseenter' for tooltip, 'click' for popover
*/
trigger?: string;
/**
* Should an expression on the scope be used to load the content?
*
* @default false
*/
useContentExp?: boolean;
}
interface ITooltipProvider {
@@ -618,6 +653,9 @@ declare module angular.ui.bootstrap {
}
/**
* WARNING: $transition is now deprecated. Use $animate from ngAnimate instead.
*/
interface ITransitionService {
/**
* The browser specific animation event name.