From 91eb243dfa4639d6ea6306ae790cf5860d65847d Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Sun, 14 Jun 2015 03:56:19 -0400 Subject: [PATCH] Update to angular ui bootstrap v0.13.0 --- .../angular-ui-bootstrap-tests.ts | 24 +++++- .../angular-ui-bootstrap.d.ts | 74 ++++++++++++++----- 2 files changed, 79 insertions(+), 19 deletions(-) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 5aef97afa..a732d9ac7 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -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 diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 92a7411c9..d725e529c 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -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 // 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; /** - * 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; + + /** + * A promise that is resolved when a modal is rendered. + */ + rendered: angular.IPromise; } 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.