angular-gridster2
Advanced tools
Comparing version 5.2.1 to 5.3.0
@@ -163,4 +163,9 @@ "use strict"; | ||
} | ||
this.columns = columns; | ||
this.rows = rows; | ||
if (this.columns !== columns || this.rows !== rows) { | ||
this.columns = columns; | ||
this.rows = rows; | ||
if (this.options.gridSizeChangedCallback) { | ||
this.options.gridSizeChangedCallback(this); | ||
} | ||
} | ||
}; | ||
@@ -220,2 +225,10 @@ GridsterComponent.prototype.calculateLayout = function () { | ||
this.updateGrid(); | ||
if (this.$options.setGridSize) { | ||
this.renderer.setStyle(this.el, 'width', (this.columns * this.curColWidth + this.$options.margin) + 'px'); | ||
this.renderer.setStyle(this.el, 'height', (this.rows * this.curRowHeight + this.$options.margin) + 'px'); | ||
} | ||
else { | ||
this.renderer.setStyle(this.el, 'width', null); | ||
this.renderer.setStyle(this.el, 'height', null); | ||
} | ||
var widgetsIndex = this.grid.length - 1, widget; | ||
@@ -261,2 +274,3 @@ for (; widgetsIndex >= 0; widgetsIndex--) { | ||
if (!this.$options.disableWarnings) { | ||
itemComponent.notPlaced = true; | ||
console.warn('Can\'t be placed in the bounds of the dashboard, trying to auto position!/n' + | ||
@@ -283,3 +297,13 @@ JSON.stringify(itemComponent.item, ['cols', 'rows', 'x', 'y'])); | ||
GridsterComponent.prototype.checkCollision = function (item) { | ||
return this.checkGridCollision(item) || this.findItemWithItem(item); | ||
var collision = false; | ||
if (this.options.itemValidateCallback) { | ||
collision = !this.options.itemValidateCallback(item); | ||
} | ||
if (!collision && this.checkGridCollision(item)) { | ||
collision = true; | ||
} | ||
if (!collision && this.findItemWithItem(item)) { | ||
collision = true; | ||
} | ||
return collision; | ||
}; | ||
@@ -286,0 +310,0 @@ GridsterComponent.prototype.checkGridCollision = function (item) { |
@@ -26,6 +26,4 @@ "use strict"; | ||
]; | ||
/** @nocollapse */ | ||
GridsterModule.ctorParameters = function () { return []; }; | ||
return GridsterModule; | ||
}()); | ||
exports.GridsterModule = GridsterModule; |
@@ -20,2 +20,4 @@ "use strict"; | ||
// keep the width from fixed gridType in mobile layout | ||
setGridSize: false, | ||
// sets grid size depending on content | ||
compactType: gridsterConfig_interface_1.CompactType.None, | ||
@@ -69,2 +71,4 @@ // compact items: 'none' | 'compactUp' | 'compactLeft' | 'compactUp&Left' | 'compactLeft&Up' | ||
// callback to call after grid has destroyed. Arguments: gridsterComponent | ||
gridSizeChangedCallback: undefined, | ||
// callback to call after grid has changed size. Arguments: gridsterComponent | ||
itemChangeCallback: undefined, | ||
@@ -82,2 +86,5 @@ // callback to call for each item when is changes x, y, rows, cols. | ||
// Arguments: gridsterItem, gridsterItemComponent | ||
itemValidateCallback: undefined, | ||
// callback to call to validate item position/size. Return true if valid. | ||
// Arguments: gridsterItem | ||
enableEmptyCellClick: false, | ||
@@ -84,0 +91,0 @@ // enable empty cell click events |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"GridsterConfigService":{"gridType":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"GridType","line":3,"character":12},"member":"Fit"},"fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"compactType":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"CompactType","line":13,"character":15},"member":"None"},"mobileBreakpoint":640,"minCols":1,"maxCols":100,"minRows":1,"maxRows":100,"defaultItemCols":1,"defaultItemRows":1,"maxItemCols":50,"maxItemRows":50,"minItemCols":1,"minItemRows":1,"minItemArea":1,"maxItemArea":2500,"margin":10,"outerMargin":true,"outerMarginTop":null,"outerMarginRight":null,"outerMarginBottom":null,"outerMarginLeft":null,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"destroyCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"itemRemovedCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellContextMenu":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellContextMenuCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"ignoreMarginInRow":false,"draggable":{"delayStart":0,"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"},"dropOverItems":false,"dropOverItemsCallback":{"__symbolic":"reference","name":"undefined"}},"resizable":{"delayStart":0,"enabled":false,"handles":{"s":true,"e":true,"n":true,"w":true,"se":true,"ne":true,"sw":true,"nw":true},"stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"swap":true,"pushItems":false,"disablePushOnDrag":false,"disablePushOnResize":false,"pushDirections":{"north":true,"east":true,"south":true,"west":true},"pushResizeItems":false,"displayGrid":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"DisplayGrid","line":93,"character":15},"member":"OnDragAndResize"},"disableWindowResize":false,"disableWarnings":false,"scrollToNewItems":false,"disableAutoPositionOnConflict":false}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"GridsterConfigService":{"gridType":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"GridType","line":3,"character":12},"member":"Fit"},"fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"setGridSize":false,"compactType":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"CompactType","line":14,"character":15},"member":"None"},"mobileBreakpoint":640,"minCols":1,"maxCols":100,"minRows":1,"maxRows":100,"defaultItemCols":1,"defaultItemRows":1,"maxItemCols":50,"maxItemRows":50,"minItemCols":1,"minItemRows":1,"minItemArea":1,"maxItemArea":2500,"margin":10,"outerMargin":true,"outerMarginTop":null,"outerMarginRight":null,"outerMarginBottom":null,"outerMarginLeft":null,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"destroyCallback":{"__symbolic":"reference","name":"undefined"},"gridSizeChangedCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"itemRemovedCallback":{"__symbolic":"reference","name":"undefined"},"itemValidateCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellContextMenu":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellContextMenuCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"ignoreMarginInRow":false,"draggable":{"delayStart":0,"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"},"dropOverItems":false,"dropOverItemsCallback":{"__symbolic":"reference","name":"undefined"}},"resizable":{"delayStart":0,"enabled":false,"handles":{"s":true,"e":true,"n":true,"w":true,"se":true,"ne":true,"sw":true,"nw":true},"stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"swap":true,"pushItems":false,"disablePushOnDrag":false,"disablePushOnResize":false,"pushDirections":{"north":true,"east":true,"south":true,"west":true},"pushResizeItems":false,"displayGrid":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"./gridsterConfig.interface","name":"DisplayGrid","line":97,"character":15},"member":"OnDragAndResize"},"disableWindowResize":false,"disableWarnings":false,"scrollToNewItems":false,"disableAutoPositionOnConflict":false}}}] |
@@ -33,2 +33,3 @@ import { GridsterItem } from './gridsterItem.interface'; | ||
keepFixedWidthInMobile?: boolean; | ||
setGridSize?: boolean; | ||
compactType?: compactTypes; | ||
@@ -58,2 +59,3 @@ mobileBreakpoint?: number; | ||
destroyCallback?: (gridster: GridsterComponentInterface) => void; | ||
gridSizeChangedCallback?: (gridster: GridsterComponentInterface) => void; | ||
itemChangeCallback?: (item: GridsterItem, itemComponent: GridsterItemComponentInterface) => void; | ||
@@ -63,2 +65,3 @@ itemResizeCallback?: (item: GridsterItem, itemComponent: GridsterItemComponentInterface) => void; | ||
itemRemovedCallback?: (item: GridsterItem, itemComponent: GridsterItemComponentInterface) => void; | ||
itemValidateCallback?: (item: GridsterItem) => boolean; | ||
draggable?: Draggable; | ||
@@ -65,0 +68,0 @@ resizable?: Resizable; |
@@ -10,2 +10,3 @@ import { compactTypes, displayGrids, gridTypes } from './gridsterConfig.interface'; | ||
keepFixedWidthInMobile: boolean; | ||
setGridSize: boolean; | ||
compactType: compactTypes; | ||
@@ -12,0 +13,0 @@ mobileBreakpoint: number; |
@@ -89,6 +89,4 @@ "use strict"; | ||
]; | ||
/** @nocollapse */ | ||
GridsterUtils.ctorParameters = function () { return []; }; | ||
return GridsterUtils; | ||
}()); | ||
exports.GridsterUtils = GridsterUtils; |
{ | ||
"name": "angular-gridster2", | ||
"version": "5.2.1", | ||
"version": "5.3.0", | ||
"license": "MIT", | ||
@@ -50,22 +50,22 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@angular/animations": "5.2.9", | ||
"@angular/cdk": "5.2.4", | ||
"@angular/animations": "5.2.10", | ||
"@angular/cdk": "5.2.5", | ||
"@angular/cli": "1.7.4", | ||
"@angular/common": "5.2.9", | ||
"@angular/compiler": "5.2.9", | ||
"@angular/compiler-cli": "5.2.9", | ||
"@angular/core": "5.2.9", | ||
"@angular/forms": "5.2.9", | ||
"@angular/http": "5.2.9", | ||
"@angular/language-service": "5.2.9", | ||
"@angular/material": "5.2.4", | ||
"@angular/platform-browser": "5.2.9", | ||
"@angular/platform-browser-dynamic": "5.2.9", | ||
"@angular/platform-server": "5.2.9", | ||
"@angular/router": "5.2.9", | ||
"@angular/common": "5.2.10", | ||
"@angular/compiler": "5.2.10", | ||
"@angular/compiler-cli": "5.2.10", | ||
"@angular/core": "5.2.10", | ||
"@angular/forms": "5.2.10", | ||
"@angular/http": "5.2.10", | ||
"@angular/language-service": "5.2.10", | ||
"@angular/material": "5.2.5", | ||
"@angular/platform-browser": "5.2.10", | ||
"@angular/platform-browser-dynamic": "5.2.10", | ||
"@angular/platform-server": "5.2.10", | ||
"@angular/router": "5.2.10", | ||
"@types/jasmine": "2.8.6", | ||
"@types/jasminewd2": "2.0.3", | ||
"@types/node": "9.6.2", | ||
"@types/node": "9.6.6", | ||
"angular-cli-ghpages": "0.5.2", | ||
"codelyzer": "4.2.1", | ||
"codelyzer": "4.3.0", | ||
"core-js": "2.5.5", | ||
@@ -78,3 +78,3 @@ "del": "3.0.0", | ||
"jasmine-spec-reporter": "4.2.1", | ||
"karma": "2.0.0", | ||
"karma": "2.0.2", | ||
"karma-chrome-launcher": "2.2.0", | ||
@@ -86,4 +86,4 @@ "karma-coverage-istanbul-reporter": "1.4.2", | ||
"protractor": "5.3.1", | ||
"rxjs": "5.5.8", | ||
"ts-node": "5.0.1", | ||
"rxjs": "5.5.10", | ||
"ts-node": "6.0.0", | ||
"tslint": "5.9.1", | ||
@@ -90,0 +90,0 @@ "typescript": "2.6.2", |
194787
3574