mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-07 10:40:13 +00:00
Added angular-gridster definitions (#13961)
* added angular-gridster definitions * stripped out bom * fixed index.d.ts based on travis * fixed interfaces name on test file
This commit is contained in:
27
angular-gridster/angular-gridster-tests.ts
Normal file
27
angular-gridster/angular-gridster-tests.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as ng from "angular";
|
||||
import * as angular from "angular";
|
||||
|
||||
import gridster from "angular-gridster";
|
||||
|
||||
var myApp = angular.module("testModule", ["gridster"]);
|
||||
|
||||
// configure gridster's global options
|
||||
myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) => {
|
||||
|
||||
gridsterConfig.mobileBreakPoint = 697;
|
||||
gridsterConfig.colWidth = "100";
|
||||
gridsterConfig.rowHeight = "100";
|
||||
gridsterConfig.minColumns = 1;
|
||||
gridsterConfig.columns = 20;
|
||||
gridsterConfig.margins = [5, 5];
|
||||
gridsterConfig.minSizeX = 2;
|
||||
gridsterConfig.minSizeY = 2;
|
||||
gridsterConfig.outerMargin = true;
|
||||
gridsterConfig.pushing = true;
|
||||
gridsterConfig.floating = true;
|
||||
gridsterConfig.swapping = true;
|
||||
gridsterConfig.draggable = { enabled: true};
|
||||
gridsterConfig.resizable = { enabled: true,
|
||||
handles: ["n", "s", "e", "w", "ne", "se", "sw", "nw"]};
|
||||
}
|
||||
]);
|
||||
145
angular-gridster/index.d.ts
vendored
Normal file
145
angular-gridster/index.d.ts
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
// Type definitions for angular-gridster (gridster module) 0.13
|
||||
// Project: https://github.com/ManifestWebDesign/angular-gridster
|
||||
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as angular from "angular";
|
||||
|
||||
export default "gridster";
|
||||
|
||||
declare module "angular" {
|
||||
|
||||
export namespace gridster {
|
||||
|
||||
interface GridsterConfig {
|
||||
|
||||
// number of columns in the grid
|
||||
columns?: number;
|
||||
// whether to push other items out of the way
|
||||
|
||||
// whether to push other items out of the way
|
||||
pushing?: boolean;
|
||||
|
||||
// whether to automatically float items up so they stack
|
||||
floating?: boolean;
|
||||
|
||||
// whether or not to have items switch places instead of push down if they are the same size
|
||||
swapping?: boolean;
|
||||
|
||||
// width of the grid. "auto" will expand the grid to its parent container
|
||||
width?: string;
|
||||
|
||||
// width of grid columns. "auto" will divide the width of the grid evenly among the columns
|
||||
colWidth?: string;
|
||||
|
||||
// height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels,
|
||||
// '/2' is half the column width, '*5' is five times the column width, etc.
|
||||
rowHeight?: string;
|
||||
|
||||
// margins in between grid items
|
||||
margins?: number[];
|
||||
|
||||
// whether to set the outer margin
|
||||
outerMargin?: boolean;
|
||||
|
||||
// toggle mobile view
|
||||
isMobile?: boolean;
|
||||
|
||||
// width threshold to toggle mobile mode
|
||||
mobileBreakPoint?: number;
|
||||
|
||||
// whether or not to toggle mobile mode when screen width is less than mobileBreakPoint
|
||||
mobileModeEnabled?: boolean;
|
||||
|
||||
// minimum amount of columns the grid can scale down to
|
||||
minColumns?: number;
|
||||
|
||||
// minimum amount of rows to show if the grid is empty
|
||||
minRows?: number;
|
||||
|
||||
// maximum amount of rows in the grid
|
||||
maxRows?: number;
|
||||
|
||||
// default width of an item in columns
|
||||
defaultSizeX?: number;
|
||||
|
||||
// default height of an item in rows
|
||||
defaultSizeY?: number;
|
||||
|
||||
// minimum column width of an item
|
||||
minSizeX?: number;
|
||||
|
||||
// maximum column width of an item
|
||||
maxSizeX?: number;
|
||||
|
||||
// minumum row height of an item
|
||||
minSizeY?: number;
|
||||
|
||||
// maximum row height of an item
|
||||
maxSizeY?: number;
|
||||
|
||||
saveGridItemCalculatedHeightInMobile?: boolean;
|
||||
// grid item height in mobile display. true- to use the calculated height by sizeY given
|
||||
|
||||
// options to pass to resizable handler
|
||||
resizable?: {
|
||||
|
||||
// whether the items are resizable
|
||||
enabled?: boolean;
|
||||
|
||||
// location of the resize handles
|
||||
// e.g // ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw']
|
||||
handles?: string[];
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is resized
|
||||
resize?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
|
||||
// options to pass to draggable handler
|
||||
draggable?: {
|
||||
|
||||
// whether the items are resizable
|
||||
enabled?: boolean;
|
||||
|
||||
// Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer
|
||||
scrollSensitivity?: number;
|
||||
|
||||
// Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance
|
||||
scrollSpeed?: number;
|
||||
|
||||
// optional selector for drag handle
|
||||
handle?: string;
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is moved,
|
||||
drag?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface StandardGridsterItem {
|
||||
|
||||
// width of the item expressed in terms of number of columns it will occupy
|
||||
sizeX: number;
|
||||
|
||||
// height of the item expressed in terms of number of rows it will occupy
|
||||
sizeY: number;
|
||||
|
||||
// starting row where the item will be placed
|
||||
row: number;
|
||||
|
||||
// starting column where the item will be placed
|
||||
col: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
angular-gridster/tsconfig.json
Normal file
20
angular-gridster/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-gridster-tests.ts"
|
||||
]
|
||||
}
|
||||
1
angular-gridster/tslint.json
Normal file
1
angular-gridster/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user