angular-gridster2
Advanced tools
Comparing version 3.10.0 to 3.11.0
@@ -54,5 +54,5 @@ import { OnInit, ElementRef, OnDestroy, Renderer2, ChangeDetectorRef } from '@angular/core'; | ||
removeItem(itemComponent: GridsterItemComponent): void; | ||
checkCollision(itemComponent: GridsterItem, ignoreItem?: GridsterItem): GridsterItemComponent | boolean; | ||
checkCollision(itemComponent: GridsterItem): GridsterItemComponent | boolean; | ||
checkGridCollision(itemComponent: GridsterItem): boolean; | ||
findItemWithItem(itemComponent: GridsterItem, ignoreItem?: GridsterItem): GridsterItemComponent; | ||
findItemWithItem(itemComponent: GridsterItem): GridsterItemComponent; | ||
autoPositionItem(itemComponent: GridsterItemComponent): void; | ||
@@ -59,0 +59,0 @@ getNextPossiblePosition(newItem: GridsterItem): boolean; |
@@ -371,7 +371,7 @@ "use strict"; | ||
}; | ||
GridsterComponent.prototype.checkCollision = function (itemComponent, ignoreItem) { | ||
GridsterComponent.prototype.checkCollision = function (itemComponent) { | ||
if (this.checkGridCollision(itemComponent)) { | ||
return true; | ||
} | ||
return this.findItemWithItem(itemComponent, ignoreItem); | ||
return this.findItemWithItem(itemComponent); | ||
}; | ||
@@ -395,8 +395,7 @@ GridsterComponent.prototype.checkGridCollision = function (itemComponent) { | ||
}; | ||
GridsterComponent.prototype.findItemWithItem = function (itemComponent, ignoreItem) { | ||
GridsterComponent.prototype.findItemWithItem = function (itemComponent) { | ||
var widgetsIndex = this.grid.length - 1, widget; | ||
for (; widgetsIndex >= 0; widgetsIndex--) { | ||
widget = this.grid[widgetsIndex]; | ||
if (widget.$item !== itemComponent && widget.$item !== ignoreItem | ||
&& GridsterComponent.checkCollisionTwoItems(widget.$item, itemComponent)) { | ||
if (widget.$item !== itemComponent && GridsterComponent.checkCollisionTwoItems(widget.$item, itemComponent)) { | ||
return widget; | ||
@@ -403,0 +402,0 @@ } |
@@ -75,2 +75,3 @@ "use strict"; | ||
pushItems: false, | ||
pushResizeItems: false, | ||
displayGrid: 'onDrag&Resize', | ||
@@ -77,0 +78,0 @@ disableWindowResize: false // disable the window on resize listener. This will stop grid to recalculate on window resize. |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"GridsterConfigService":{"gridType":"fit","fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"compactType":"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,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"draggable":{"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"resizable":{"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,"displayGrid":"onDrag&Resize","disableWindowResize":false}}},{"__symbolic":"module","version":1,"metadata":{"GridsterConfigService":{"gridType":"fit","fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"compactType":"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,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"draggable":{"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"resizable":{"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,"displayGrid":"onDrag&Resize","disableWindowResize":false}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"GridsterConfigService":{"gridType":"fit","fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"compactType":"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,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"draggable":{"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"resizable":{"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,"pushResizeItems":false,"displayGrid":"onDrag&Resize","disableWindowResize":false}}},{"__symbolic":"module","version":1,"metadata":{"GridsterConfigService":{"gridType":"fit","fixedColWidth":250,"fixedRowHeight":250,"keepFixedHeightInMobile":false,"keepFixedWidthInMobile":false,"compactType":"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,"scrollSensitivity":10,"scrollSpeed":20,"initCallback":{"__symbolic":"reference","name":"undefined"},"itemChangeCallback":{"__symbolic":"reference","name":"undefined"},"itemResizeCallback":{"__symbolic":"reference","name":"undefined"},"itemInitCallback":{"__symbolic":"reference","name":"undefined"},"enableEmptyCellClick":false,"enableEmptyCellDrop":false,"enableEmptyCellDrag":false,"emptyCellClickCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDropCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragCallback":{"__symbolic":"reference","name":"undefined"},"emptyCellDragMaxCols":50,"emptyCellDragMaxRows":50,"draggable":{"enabled":false,"ignoreContentClass":"gridster-item-content","ignoreContent":false,"dragHandleClass":"drag-handler","stop":{"__symbolic":"reference","name":"undefined"},"start":{"__symbolic":"reference","name":"undefined"}},"resizable":{"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,"pushResizeItems":false,"displayGrid":"onDrag&Resize","disableWindowResize":false}}}] |
@@ -36,2 +36,3 @@ export declare type GridType = 'fit' | 'scrollVertical' | 'scrollHorizontal' | 'fixed' | 'verticalFixed' | 'horizontalFixed'; | ||
pushItems?: boolean; | ||
pushResizeItems?: boolean; | ||
displayGrid?: displayGrid; | ||
@@ -38,0 +39,0 @@ disableWindowResize?: boolean; |
@@ -17,7 +17,7 @@ import { GridsterItemComponent } from './gridsterItem.component'; | ||
setPushedItems(): void; | ||
private push(gridsterItem, direction, pushedBy); | ||
private trySouth(gridsterItemCollide, gridsterItem, direction, pushedBy); | ||
private tryNorth(gridsterItemCollide, gridsterItem, direction, pushedBy); | ||
private tryEast(gridsterItemCollide, gridsterItem, direction, pushedBy); | ||
private tryWest(gridsterItemCollide, gridsterItem, direction, pushedBy); | ||
private push(gridsterItem, direction); | ||
private trySouth(gridsterItemCollide, gridsterItem, direction); | ||
private tryNorth(gridsterItemCollide, gridsterItem, direction); | ||
private tryEast(gridsterItemCollide, gridsterItem, direction); | ||
private tryWest(gridsterItemCollide, gridsterItem, direction); | ||
private addToPushed(gridsterItem); | ||
@@ -24,0 +24,0 @@ private removeFromPushed(i); |
@@ -25,3 +25,3 @@ "use strict"; | ||
if (this.gridster.$options.pushItems) { | ||
this.push(this.gridsterItem, direction, this.gridsterItem); | ||
this.push(this.gridsterItem, direction); | ||
} | ||
@@ -53,17 +53,17 @@ }; | ||
}; | ||
GridsterPush.prototype.push = function (gridsterItem, direction, pushedBy) { | ||
var gridsterItemCollision = this.gridster.checkCollision(gridsterItem.$item, pushedBy.$item); | ||
GridsterPush.prototype.push = function (gridsterItem, direction) { | ||
var gridsterItemCollision = this.gridster.checkCollision(gridsterItem.$item); | ||
if (gridsterItemCollision && gridsterItemCollision !== true && | ||
gridsterItemCollision !== this.gridsterItem && gridsterItemCollision.canBeDragged()) { | ||
var gridsterItemCollide = gridsterItemCollision; | ||
if (this.tryPattern[direction][0].call(this, gridsterItemCollide, gridsterItem, direction, pushedBy)) { | ||
if (this.tryPattern[direction][0].call(this, gridsterItemCollide, gridsterItem, direction)) { | ||
return true; | ||
} | ||
else if (this.tryPattern[direction][1].call(this, gridsterItemCollide, gridsterItem, direction, pushedBy)) { | ||
else if (this.tryPattern[direction][1].call(this, gridsterItemCollide, gridsterItem, direction)) { | ||
return true; | ||
} | ||
else if (this.tryPattern[direction][2].call(this, gridsterItemCollide, gridsterItem, direction, pushedBy)) { | ||
else if (this.tryPattern[direction][2].call(this, gridsterItemCollide, gridsterItem, direction)) { | ||
return true; | ||
} | ||
else if (this.tryPattern[direction][3].call(this, gridsterItemCollide, gridsterItem, direction, pushedBy)) { | ||
else if (this.tryPattern[direction][3].call(this, gridsterItemCollide, gridsterItem, direction)) { | ||
return true; | ||
@@ -76,10 +76,10 @@ } | ||
}; | ||
GridsterPush.prototype.trySouth = function (gridsterItemCollide, gridsterItem, direction, pushedBy) { | ||
GridsterPush.prototype.trySouth = function (gridsterItemCollide, gridsterItem, direction) { | ||
var backUpY = gridsterItemCollide.$item.y; | ||
gridsterItemCollide.$item.y = gridsterItem.$item.y + gridsterItem.$item.rows; | ||
if (!gridster_component_1.GridsterComponent.checkCollisionTwoItems(gridsterItemCollide.$item, gridsterItem.$item) | ||
&& this.push(gridsterItemCollide, this.fromNorth, gridsterItem)) { | ||
&& this.push(gridsterItemCollide, this.fromNorth)) { | ||
gridsterItemCollide.setSize(true); | ||
this.addToPushed(gridsterItemCollide); | ||
this.push(gridsterItem, direction, pushedBy); | ||
this.push(gridsterItem, direction); | ||
return true; | ||
@@ -91,10 +91,10 @@ } | ||
}; | ||
GridsterPush.prototype.tryNorth = function (gridsterItemCollide, gridsterItem, direction, pushedBy) { | ||
GridsterPush.prototype.tryNorth = function (gridsterItemCollide, gridsterItem, direction) { | ||
var backUpY = gridsterItemCollide.$item.y; | ||
gridsterItemCollide.$item.y = gridsterItem.$item.y - gridsterItemCollide.$item.rows; | ||
if (!gridster_component_1.GridsterComponent.checkCollisionTwoItems(gridsterItemCollide.$item, gridsterItem.$item) | ||
&& this.push(gridsterItemCollide, this.fromSouth, gridsterItem)) { | ||
&& this.push(gridsterItemCollide, this.fromSouth)) { | ||
gridsterItemCollide.setSize(true); | ||
this.addToPushed(gridsterItemCollide); | ||
this.push(gridsterItem, direction, pushedBy); | ||
this.push(gridsterItem, direction); | ||
return true; | ||
@@ -106,10 +106,10 @@ } | ||
}; | ||
GridsterPush.prototype.tryEast = function (gridsterItemCollide, gridsterItem, direction, pushedBy) { | ||
GridsterPush.prototype.tryEast = function (gridsterItemCollide, gridsterItem, direction) { | ||
var backUpX = gridsterItemCollide.$item.x; | ||
gridsterItemCollide.$item.x = gridsterItem.$item.x + gridsterItem.$item.cols; | ||
if (!gridster_component_1.GridsterComponent.checkCollisionTwoItems(gridsterItemCollide.$item, gridsterItem.$item) | ||
&& this.push(gridsterItemCollide, this.fromWest, gridsterItem)) { | ||
&& this.push(gridsterItemCollide, this.fromWest)) { | ||
gridsterItemCollide.setSize(true); | ||
this.addToPushed(gridsterItemCollide); | ||
this.push(gridsterItem, direction, pushedBy); | ||
this.push(gridsterItem, direction); | ||
return true; | ||
@@ -121,10 +121,10 @@ } | ||
}; | ||
GridsterPush.prototype.tryWest = function (gridsterItemCollide, gridsterItem, direction, pushedBy) { | ||
GridsterPush.prototype.tryWest = function (gridsterItemCollide, gridsterItem, direction) { | ||
var backUpX = gridsterItemCollide.$item.x; | ||
gridsterItemCollide.$item.x = gridsterItem.$item.x - gridsterItemCollide.$item.cols; | ||
if (!gridster_component_1.GridsterComponent.checkCollisionTwoItems(gridsterItemCollide.$item, gridsterItem.$item) | ||
&& this.push(gridsterItemCollide, this.fromEast, gridsterItem)) { | ||
&& this.push(gridsterItemCollide, this.fromEast)) { | ||
gridsterItemCollide.setSize(true); | ||
this.addToPushed(gridsterItemCollide); | ||
this.push(gridsterItem, direction, pushedBy); | ||
this.push(gridsterItem, direction); | ||
return true; | ||
@@ -167,5 +167,7 @@ } | ||
var j = path.length - 2; | ||
var lastPosition; | ||
var lastPosition, x, y; | ||
for (; j > -1; j--) { | ||
lastPosition = path[j]; | ||
x = pushedItem.$item.x; | ||
y = pushedItem.$item.y; | ||
pushedItem.$item.x = lastPosition.x; | ||
@@ -178,5 +180,4 @@ pushedItem.$item.y = lastPosition.y; | ||
else { | ||
lastPosition = path[path.length - 1]; | ||
pushedItem.$item.x = lastPosition.x; | ||
pushedItem.$item.y = lastPosition.y; | ||
pushedItem.$item.x = x; | ||
pushedItem.$item.y = y; | ||
} | ||
@@ -183,0 +184,0 @@ } |
@@ -5,2 +5,3 @@ import { GridsterItemComponent } from './gridsterItem.component'; | ||
import { GridsterComponent } from './gridster.component'; | ||
import { GridsterPushResize } from './gridsterPushResize.service'; | ||
export declare class GridsterResizable { | ||
@@ -28,2 +29,3 @@ gridsterItem: GridsterItemComponent; | ||
push: GridsterPush; | ||
pushResize: GridsterPushResize; | ||
minHeight: number; | ||
@@ -30,0 +32,0 @@ minWidth: number; |
@@ -9,2 +9,3 @@ "use strict"; | ||
var gridsterUtils_service_1 = require("./gridsterUtils.service"); | ||
var gridsterPushResize_service_1 = require("./gridsterPushResize.service"); | ||
var GridsterResizable = (function () { | ||
@@ -67,2 +68,3 @@ function GridsterResizable(gridsterItem, gridster) { | ||
this.push = new gridsterPush_service_1.GridsterPush(this.gridsterItem, this.gridster); | ||
this.pushResize = new gridsterPushResize_service_1.GridsterPushResize(this.gridsterItem, this.gridster); | ||
this.gridster.dragInProgress = true; | ||
@@ -151,2 +153,4 @@ this.gridster.gridLines.updateGrid(); | ||
this.push = undefined; | ||
this.pushResize.restoreItems(); | ||
this.pushResize = undefined; | ||
}; | ||
@@ -158,2 +162,4 @@ GridsterResizable.prototype.makeResize = function () { | ||
this.push = undefined; | ||
this.pushResize.setPushedItems(); | ||
this.pushResize = undefined; | ||
}; | ||
@@ -173,2 +179,3 @@ GridsterResizable.prototype.handleN = function (e) { | ||
this.gridsterItem.$item.y = this.newPosition; | ||
this.pushResize.pushItems(this.pushResize.fromSouth); | ||
this.push.pushItems(this.push.fromSouth); | ||
@@ -186,2 +193,3 @@ if (this.gridster.checkCollision(this.gridsterItem.$item)) { | ||
} | ||
this.pushResize.checkPushBack(); | ||
this.push.checkPushBack(); | ||
@@ -205,2 +213,3 @@ } | ||
this.gridsterItem.$item.x = this.newPosition; | ||
this.pushResize.pushItems(this.pushResize.fromEast); | ||
this.push.pushItems(this.push.fromEast); | ||
@@ -218,2 +227,3 @@ if (this.gridster.checkCollision(this.gridsterItem.$item)) { | ||
} | ||
this.pushResize.checkPushBack(); | ||
this.push.checkPushBack(); | ||
@@ -234,2 +244,3 @@ } | ||
this.gridsterItem.$item.rows = this.newPosition - this.gridsterItem.$item.y; | ||
this.pushResize.pushItems(this.pushResize.fromNorth); | ||
this.push.pushItems(this.push.fromNorth); | ||
@@ -245,2 +256,3 @@ if (this.gridster.checkCollision(this.gridsterItem.$item)) { | ||
} | ||
this.pushResize.checkPushBack(); | ||
this.push.checkPushBack(); | ||
@@ -260,4 +272,5 @@ } | ||
this.gridsterItem.$item.cols = this.newPosition - this.gridsterItem.$item.x; | ||
this.pushResize.pushItems(this.pushResize.fromWest); | ||
this.push.pushItems(this.push.fromWest); | ||
if (this.gridsterItem.$item.cols < 1 || this.gridster.checkCollision(this.gridsterItem.$item)) { | ||
if (this.gridster.checkCollision(this.gridsterItem.$item)) { | ||
this.gridsterItem.$item.cols = this.itemBackup[2]; | ||
@@ -271,2 +284,3 @@ this.gridsterItem.renderer.setStyle(this.gridsterItem.el, 'width', this.gridster.positionXToPixels(this.gridsterItem.$item.cols) | ||
} | ||
this.pushResize.checkPushBack(); | ||
this.push.checkPushBack(); | ||
@@ -273,0 +287,0 @@ } |
{ | ||
"name": "angular-gridster2", | ||
"version": "3.10.0", | ||
"version": "3.11.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -158,2 +158,3 @@ angular-gridster2 | ||
pushItems: false, // push items when resizing and dragging | ||
pushResizeItems: false, // on resize of item will shrink adjacent items | ||
displayGrid: 'onDrag&Resize', // display background grid of rows and columns | ||
@@ -160,0 +161,0 @@ disableWindowResize: false // disable the window on resize listener. This will stop grid to recalculate on window resize. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260510
71
2528
249