mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
Added definition and tests for angular-bootstrap-lightbox. (https://github.com/compact/angular-bootstrap-lightbox)
This commit is contained in:
@@ -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)
|
||||
};
|
||||
};
|
||||
49
angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts
vendored
Normal file
49
angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Created by Roland on 7/31/2014.
|
||||
*/
|
||||
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