From 282c4c28548911940f9bea3aeba34bdd59e20ce5 Mon Sep 17 00:00:00 2001 From: William Comartin Date: Tue, 6 Oct 2015 15:59:48 -0400 Subject: [PATCH 1/3] add angular-dialog-service typescript definitions --- .../angular-dialog-service.d.ts | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 angular-dialog-service/angular-dialog-service.d.ts diff --git a/angular-dialog-service/angular-dialog-service.d.ts b/angular-dialog-service/angular-dialog-service.d.ts new file mode 100644 index 000000000..aa057642c --- /dev/null +++ b/angular-dialog-service/angular-dialog-service.d.ts @@ -0,0 +1,82 @@ +// Type definitions for Angular Dialog Service 5.2.8 +// Project: https://github.com/m-e-conroy/angular-dialog-service +// Definitions by: William Comartin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.dialogservice { + + interface IDialogOptions { + /** + * Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed. + * + * @default false + */ + animation?: boolean; + + /** + * controls the presence of a backdrop + * Allowed values: + * - true (default) + * - false (no backdrop) + * - 'static' backdrop is present but modal window is not closed when clicking outside of the modal window + * + * @default true + */ + backdrop?: boolean | string; + + /** + * indicates whether the dialog should be closable by hitting the ESC key + * + * @default true + */ + keyboard?: boolean; + + /** + * additional CSS class(es) to be added to a modal backdrop template + * + * @default 'dialogs-backdrop-default' + */ + backdropClass?: string; + + /** + * additional CSS class(es) to be added to a modal window template + * + * @default 'dialogs-default' + */ + windowClass?: string; + + /** + * Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`. + * + * @default 'lg' + */ + size?: string; + } + + interface IDialogService { + /** + * Opens a new error modal instance. + */ + error(header: string, msg: string, progress: number, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + /** + * Opens a new wait modal instance. + */ + wait(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + /** + * Opens a new notify modal instance. + */ + notify(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + /** + * Opens a new confirm modal instance. + */ + confirm(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + /** + * Opens a new custom modal instance. + */ + create(url: string, ctrlr: string, data: any, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + } + +} From c91de3cf9a015956bc5702a78fd04235ed677403 Mon Sep 17 00:00:00 2001 From: William Comartin Date: Wed, 7 Oct 2015 11:30:13 -0400 Subject: [PATCH 2/3] add angular-dialog-service-tests --- .../angular-dialog-service-tests.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 angular-dialog-service/angular-dialog-service-tests.ts diff --git a/angular-dialog-service/angular-dialog-service-tests.ts b/angular-dialog-service/angular-dialog-service-tests.ts new file mode 100644 index 000000000..646b9b1ce --- /dev/null +++ b/angular-dialog-service/angular-dialog-service-tests.ts @@ -0,0 +1,16 @@ +/// + + +var options : angular.dialogservice.IDialogOptions = {}; +options.animation = true; +options.backdrop = true; +options.keyboard = true; +options.backdropClass = "some-css-class"; +options.windowClass = "some-css-class"; +options.size = 'md'; + +var dialogs : angular.dialogservice.IDialogService; +dialogs.error('Error','An unknown error occurred preventing the completion of the requested action.'); +dialogs.wait('Creating User','Please wait while we attempt to create user "Michael Conroy."

This should only take a moment.',50); +dialogs.notify('Something Happened','Something happened at this point in the application that I wish to let you know about'); +dialogs.create('url/to/a/template','ctrlrToUse',{data: topass,anotherVar: 'value'},{}); From 0078ccfafc5515a07abc501ebb93f7767855e35c Mon Sep 17 00:00:00 2001 From: William Comartin Date: Wed, 7 Oct 2015 11:33:40 -0400 Subject: [PATCH 3/3] Fix Tests for angular-dialog-service --- angular-dialog-service/angular-dialog-service-tests.ts | 2 +- angular-dialog-service/angular-dialog-service.d.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/angular-dialog-service/angular-dialog-service-tests.ts b/angular-dialog-service/angular-dialog-service-tests.ts index 646b9b1ce..8142a3a71 100644 --- a/angular-dialog-service/angular-dialog-service-tests.ts +++ b/angular-dialog-service/angular-dialog-service-tests.ts @@ -13,4 +13,4 @@ var dialogs : angular.dialogservice.IDialogService; dialogs.error('Error','An unknown error occurred preventing the completion of the requested action.'); dialogs.wait('Creating User','Please wait while we attempt to create user "Michael Conroy."

This should only take a moment.',50); dialogs.notify('Something Happened','Something happened at this point in the application that I wish to let you know about'); -dialogs.create('url/to/a/template','ctrlrToUse',{data: topass,anotherVar: 'value'},{}); +dialogs.create('url/to/a/template','ctrlrToUse',{},{}); diff --git a/angular-dialog-service/angular-dialog-service.d.ts b/angular-dialog-service/angular-dialog-service.d.ts index aa057642c..38ce8589e 100644 --- a/angular-dialog-service/angular-dialog-service.d.ts +++ b/angular-dialog-service/angular-dialog-service.d.ts @@ -60,23 +60,23 @@ declare module angular.dialogservice { /** * Opens a new error modal instance. */ - error(header: string, msg: string, progress: number, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + error(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance /** * Opens a new wait modal instance. */ - wait(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + wait(header: string, msg: string, progress: number, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance /** * Opens a new notify modal instance. */ - notify(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + notify(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance /** * Opens a new confirm modal instance. */ - confirm(header: string, msg: string, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + confirm(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance /** * Opens a new custom modal instance. */ - create(url: string, ctrlr: string, data: any, opts: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance + create(url: string, ctrlr: string, data: any, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance } }