mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-10 09:40:21 +08:00
Merge pull request #2590 from rolandzwaga/angular-bootstrap-lightbox
Definition for angular-bootstrap-lightbox
This commit is contained in:
@@ -8,7 +8,8 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Add To Home Screen](http://cubiq.org/add-to-home-screen) (by [James Wilkins](http://www.codeplex.com/site/users/view/jamesnw))
|
||||
* [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/))
|
||||
* [AngularAgility](https://github.com/AngularAgility/AngularAgility) (by [Roland Zwaga](https://github.com/rolandzwaga)
|
||||
* [AngularAgility](https://github.com/AngularAgility/AngularAgility) (by [Roland Zwaga](https://github.com/rolandzwaga))
|
||||
* [AngularBootstrapLightbox](https://github.com/compact/angular-bootstrap-lightbox) (by [Roland Zwaga](https://github.com/rolandzwaga))
|
||||
* [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
///<reference path='angular-bootstrap-lightbox.d.ts'/>
|
||||
|
||||
var imageList:angular.bootstrap.lightbox.ILightboxImageInfo[] = [];
|
||||
imageList.push({
|
||||
url: 'url1',
|
||||
width: 100,
|
||||
height: 100
|
||||
});
|
||||
imageList.push({
|
||||
url: 'url2',
|
||||
width: 100,
|
||||
height: 100,
|
||||
thumbUrl: 'thumbUrl',
|
||||
caption: 'caption'
|
||||
});
|
||||
|
||||
var lightBox:angular.bootstrap.lightbox.ILightbox = <any> {};
|
||||
lightBox.openModal(imageList, 0);
|
||||
|
||||
var provider:angular.bootstrap.lightbox.ILightBoxProvider = <any> {};
|
||||
provider.templateUrl = 'templateUrl';
|
||||
provider.calculateImageDimensionLimits = (dimensions:angular.bootstrap.lightbox.IImageDimensionParameter):angular.bootstrap.lightbox.IImageDimensionLimits=> {
|
||||
return {
|
||||
minWidth: 100,
|
||||
minHeight: 100,
|
||||
maxWidth: dimensions.windowWidth - 102,
|
||||
maxHeight: dimensions.windowHeight - 136
|
||||
};
|
||||
};
|
||||
provider.calculateModalDimensions = (dimensions:angular.bootstrap.lightbox.IModalDimensionsParameter):angular.bootstrap.lightbox.IModalDimensions=> {
|
||||
return {
|
||||
width: Math.max(500, dimensions.imageDisplayWidth + 42),
|
||||
height: Math.max(500, dimensions.imageDisplayHeight + 76)
|
||||
};
|
||||
};
|
||||
51
angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts
vendored
Normal file
51
angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// Type definitions for angular-bootstrap-lightbox
|
||||
// Project: https://github.com/compact/angular-bootstrap-lightbox
|
||||
// Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module angular.bootstrap.lightbox {
|
||||
|
||||
export interface ILightboxImageInfo {
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
thumbUrl?: string;
|
||||
caption?: string;
|
||||
}
|
||||
|
||||
export interface IImageDimensionLimits {
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
}
|
||||
|
||||
export interface IImageDimensionParameter {
|
||||
windowWidth:number;
|
||||
windowHeight:number;
|
||||
imageWidth:number;
|
||||
imageHeight:number;
|
||||
}
|
||||
|
||||
export interface IModalDimensionsParameter {
|
||||
windowWidth:number;
|
||||
windowHeight:number;
|
||||
imageDisplayWidth:number;
|
||||
imageDisplayHeight:number;
|
||||
}
|
||||
|
||||
export interface IModalDimensions {
|
||||
width:number;
|
||||
height:number;
|
||||
}
|
||||
|
||||
export interface ILightbox {
|
||||
openModal(images:ILightboxImageInfo[], index:number):void;
|
||||
}
|
||||
|
||||
export interface ILightBoxProvider {
|
||||
templateUrl:string;
|
||||
calculateImageDimensionLimits:(dimensions:IImageDimensionParameter)=>IImageDimensionLimits;
|
||||
calculateModalDimensions:(dimensions:IModalDimensionsParameter)=>IModalDimensions;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user