Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-gridster2

Package Overview
Dependencies
Maintainers
1
Versions
245
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-gridster2 - npm Package Compare versions

Comparing version 3.11.3 to 3.11.4

7

dist/gridster.component.d.ts

@@ -45,5 +45,6 @@ import { OnInit, ElementRef, OnDestroy, Renderer2, ChangeDetectorRef } from '@angular/core';

removeItem(itemComponent: GridsterItemComponent): void;
checkCollision(itemComponent: GridsterItemS): GridsterItemComponent | boolean;
checkGridCollision(itemComponent: GridsterItemS): boolean;
findItemWithItem(itemComponent: GridsterItemS): GridsterItemComponent | boolean;
checkCollision(item: GridsterItemS): GridsterItemComponent | boolean;
checkGridCollision(item: GridsterItemS): boolean;
findItemWithItem(item: GridsterItemS): GridsterItemComponent | boolean;
findItemsWithItem(item: GridsterItemS): Array<GridsterItemComponent>;
autoPositionItem(itemComponent: GridsterItemComponent): void;

@@ -50,0 +51,0 @@ getNextPossiblePosition(newItem: GridsterItemS): boolean;

@@ -231,3 +231,3 @@ "use strict";

}
if (itemComponent.$item.x === undefined || itemComponent.$item.y === undefined) {
if (itemComponent.$item.x === -1 || itemComponent.$item.y === -1) {
this.autoPositionItem(itemComponent);

@@ -253,21 +253,18 @@ }

};
GridsterComponent.prototype.checkCollision = function (itemComponent) {
if (this.checkGridCollision(itemComponent)) {
return true;
}
return this.findItemWithItem(itemComponent);
GridsterComponent.prototype.checkCollision = function (item) {
return this.checkGridCollision(item) || this.findItemWithItem(item);
};
GridsterComponent.prototype.checkGridCollision = function (itemComponent) {
var noNegativePosition = itemComponent.y > -1 && itemComponent.x > -1;
var maxGridCols = itemComponent.cols + itemComponent.x <= this.$options.maxCols;
var maxGridRows = itemComponent.rows + itemComponent.y <= this.$options.maxRows;
var maxItemCols = itemComponent.maxItemCols === undefined ? this.$options.maxItemCols : itemComponent.maxItemCols;
var minItemCols = itemComponent.minItemCols === undefined ? this.$options.minItemCols : itemComponent.minItemCols;
var maxItemRows = itemComponent.maxItemRows === undefined ? this.$options.maxItemRows : itemComponent.maxItemRows;
var minItemRows = itemComponent.minItemRows === undefined ? this.$options.minItemRows : itemComponent.minItemRows;
var inColsLimits = itemComponent.cols <= maxItemCols && itemComponent.cols >= minItemCols;
var inRowsLimits = itemComponent.rows <= maxItemRows && itemComponent.rows >= minItemRows;
var minAreaLimit = itemComponent.minItemArea === undefined ? this.$options.minItemArea : itemComponent.minItemArea;
var maxAreaLimit = itemComponent.maxItemArea === undefined ? this.$options.maxItemArea : itemComponent.maxItemArea;
var area = itemComponent.cols * itemComponent.rows;
GridsterComponent.prototype.checkGridCollision = function (item) {
var noNegativePosition = item.y > -1 && item.x > -1;
var maxGridCols = item.cols + item.x <= this.$options.maxCols;
var maxGridRows = item.rows + item.y <= this.$options.maxRows;
var maxItemCols = item.maxItemCols === undefined ? this.$options.maxItemCols : item.maxItemCols;
var minItemCols = item.minItemCols === undefined ? this.$options.minItemCols : item.minItemCols;
var maxItemRows = item.maxItemRows === undefined ? this.$options.maxItemRows : item.maxItemRows;
var minItemRows = item.minItemRows === undefined ? this.$options.minItemRows : item.minItemRows;
var inColsLimits = item.cols <= maxItemCols && item.cols >= minItemCols;
var inRowsLimits = item.rows <= maxItemRows && item.rows >= minItemRows;
var minAreaLimit = item.minItemArea === undefined ? this.$options.minItemArea : item.minItemArea;
var maxAreaLimit = item.maxItemArea === undefined ? this.$options.maxItemArea : item.maxItemArea;
var area = item.cols * item.rows;
var inMinArea = minAreaLimit <= area;

@@ -277,7 +274,7 @@ var inMaxArea = maxAreaLimit >= area;

};
GridsterComponent.prototype.findItemWithItem = function (itemComponent) {
GridsterComponent.prototype.findItemWithItem = function (item) {
var widgetsIndex = this.grid.length - 1, widget;
for (; widgetsIndex >= 0; widgetsIndex--) {
for (; widgetsIndex > -1; widgetsIndex--) {
widget = this.grid[widgetsIndex];
if (widget.$item !== itemComponent && GridsterComponent.checkCollisionTwoItems(widget.$item, itemComponent)) {
if (widget.$item !== item && GridsterComponent.checkCollisionTwoItems(widget.$item, item)) {
return widget;

@@ -288,2 +285,13 @@ }

};
GridsterComponent.prototype.findItemsWithItem = function (item) {
var a = [];
var widgetsIndex = this.grid.length - 1, widget;
for (; widgetsIndex > -1; widgetsIndex--) {
widget = this.grid[widgetsIndex];
if (widget.$item !== item && GridsterComponent.checkCollisionTwoItems(widget.$item, item)) {
a.push(widget);
}
}
return a;
};
GridsterComponent.prototype.autoPositionItem = function (itemComponent) {

@@ -302,6 +310,6 @@ if (this.getNextPossiblePosition(itemComponent.$item)) {

GridsterComponent.prototype.getNextPossiblePosition = function (newItem) {
if (newItem.cols === undefined) {
if (newItem.cols === -1) {
newItem.cols = this.$options.defaultItemCols;
}
if (newItem.rows === undefined) {
if (newItem.rows === -1) {
newItem.rows = this.$options.defaultItemRows;

@@ -321,4 +329,4 @@ }

}
var canAddToRows = this.$options.maxRows > this.rows + newItem.rows;
var canAddToColumns = this.$options.maxCols > this.columns + newItem.cols;
var canAddToRows = this.$options.maxRows >= this.rows + newItem.rows;
var canAddToColumns = this.$options.maxCols >= this.columns + newItem.cols;
var addToRows = this.rows <= this.columns && canAddToRows;

@@ -341,6 +349,6 @@ if (!addToRows && canAddToColumns) {

GridsterComponent.prototype.pixelsToPositionX = function (x, roundingMethod) {
return roundingMethod(x / this.curColWidth);
return Math.max(roundingMethod(x / this.curColWidth), 0);
};
GridsterComponent.prototype.pixelsToPositionY = function (y, roundingMethod) {
return roundingMethod(y / this.curRowHeight);
return Math.max(roundingMethod(y / this.curRowHeight), 0);
};

@@ -347,0 +355,0 @@ GridsterComponent.prototype.positionXToPixels = function (x) {

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":3,"metadata":{"GridsterComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"gridster","template":"<gridster-grid class=\"gridster-grid\"></gridster-grid> <ng-content></ng-content> <gridster-preview class=\"gridster-preview\"></gridster-preview>","styles":[":host { position: relative; display: flex; overflow: auto; flex: 1 auto; background: grey; width: 100%; height: 100%; } :host(.fit) { overflow-x: hidden; overflow-y: hidden; } :host(.scrollVertical) { overflow-x: hidden; overflow-y: auto; } :host(.scrollHorizontal) { overflow-x: auto; overflow-y: hidden; } :host(.fixed) { overflow: auto; } :host(.mobile) { overflow-x: hidden; overflow-y: auto; display: block; } :host(.mobile) /deep/ gridster-item { position: relative; }"]}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"resize":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"optionsChanged":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"onResize":[{"__symbolic":"method"}],"checkIfToResize":[{"__symbolic":"method"}],"setGridSize":[{"__symbolic":"method"}],"setGridDimensions":[{"__symbolic":"method"}],"calculateLayout":[{"__symbolic":"method"}],"addItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"checkCollision":[{"__symbolic":"method"}],"checkGridCollision":[{"__symbolic":"method"}],"findItemWithItem":[{"__symbolic":"method"}],"autoPositionItem":[{"__symbolic":"method"}],"getNextPossiblePosition":[{"__symbolic":"method"}],"pixelsToPosition":[{"__symbolic":"method"}],"pixelsToPositionX":[{"__symbolic":"method"}],"pixelsToPositionY":[{"__symbolic":"method"}],"positionXToPixels":[{"__symbolic":"method"}],"positionYToPixels":[{"__symbolic":"method"}]},"statics":{"checkCollisionTwoItems":{"__symbolic":"function","parameters":["item","item2"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"cols"}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"cols"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"}}},"right":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"rows"}}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"rows"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"}}}}}}}},{"__symbolic":"module","version":1,"metadata":{"GridsterComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"gridster","template":"<gridster-grid class=\"gridster-grid\"></gridster-grid> <ng-content></ng-content> <gridster-preview class=\"gridster-preview\"></gridster-preview>","styles":[":host { position: relative; display: flex; overflow: auto; flex: 1 auto; background: grey; width: 100%; height: 100%; } :host(.fit) { overflow-x: hidden; overflow-y: hidden; } :host(.scrollVertical) { overflow-x: hidden; overflow-y: auto; } :host(.scrollHorizontal) { overflow-x: auto; overflow-y: hidden; } :host(.fixed) { overflow: auto; } :host(.mobile) { overflow-x: hidden; overflow-y: auto; display: block; } :host(.mobile) /deep/ gridster-item { position: relative; }"]}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"resize":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"optionsChanged":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"onResize":[{"__symbolic":"method"}],"checkIfToResize":[{"__symbolic":"method"}],"setGridSize":[{"__symbolic":"method"}],"setGridDimensions":[{"__symbolic":"method"}],"calculateLayout":[{"__symbolic":"method"}],"addItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"checkCollision":[{"__symbolic":"method"}],"checkGridCollision":[{"__symbolic":"method"}],"findItemWithItem":[{"__symbolic":"method"}],"autoPositionItem":[{"__symbolic":"method"}],"getNextPossiblePosition":[{"__symbolic":"method"}],"pixelsToPosition":[{"__symbolic":"method"}],"pixelsToPositionX":[{"__symbolic":"method"}],"pixelsToPositionY":[{"__symbolic":"method"}],"positionXToPixels":[{"__symbolic":"method"}],"positionYToPixels":[{"__symbolic":"method"}]},"statics":{"checkCollisionTwoItems":{"__symbolic":"function","parameters":["item","item2"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"cols"}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"cols"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"}}},"right":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"rows"}}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"rows"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"}}}}}}}}]
[{"__symbolic":"module","version":3,"metadata":{"GridsterComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"gridster","template":"<gridster-grid class=\"gridster-grid\"></gridster-grid> <ng-content></ng-content> <gridster-preview class=\"gridster-preview\"></gridster-preview>","styles":[":host { position: relative; display: flex; overflow: auto; flex: 1 auto; background: grey; width: 100%; height: 100%; } :host(.fit) { overflow-x: hidden; overflow-y: hidden; } :host(.scrollVertical) { overflow-x: hidden; overflow-y: auto; } :host(.scrollHorizontal) { overflow-x: auto; overflow-y: hidden; } :host(.fixed) { overflow: auto; } :host(.mobile) { overflow-x: hidden; overflow-y: auto; display: block; } :host(.mobile) /deep/ gridster-item { position: relative; }"]}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"resize":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"optionsChanged":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"onResize":[{"__symbolic":"method"}],"checkIfToResize":[{"__symbolic":"method"}],"setGridSize":[{"__symbolic":"method"}],"setGridDimensions":[{"__symbolic":"method"}],"calculateLayout":[{"__symbolic":"method"}],"addItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"checkCollision":[{"__symbolic":"method"}],"checkGridCollision":[{"__symbolic":"method"}],"findItemWithItem":[{"__symbolic":"method"}],"findItemsWithItem":[{"__symbolic":"method"}],"autoPositionItem":[{"__symbolic":"method"}],"getNextPossiblePosition":[{"__symbolic":"method"}],"pixelsToPosition":[{"__symbolic":"method"}],"pixelsToPositionX":[{"__symbolic":"method"}],"pixelsToPositionY":[{"__symbolic":"method"}],"positionXToPixels":[{"__symbolic":"method"}],"positionYToPixels":[{"__symbolic":"method"}]},"statics":{"checkCollisionTwoItems":{"__symbolic":"function","parameters":["item","item2"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"cols"}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"cols"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"}}},"right":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"rows"}}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"rows"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"}}}}}}}},{"__symbolic":"module","version":1,"metadata":{"GridsterComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"gridster","template":"<gridster-grid class=\"gridster-grid\"></gridster-grid> <ng-content></ng-content> <gridster-preview class=\"gridster-preview\"></gridster-preview>","styles":[":host { position: relative; display: flex; overflow: auto; flex: 1 auto; background: grey; width: 100%; height: 100%; } :host(.fit) { overflow-x: hidden; overflow-y: hidden; } :host(.scrollVertical) { overflow-x: hidden; overflow-y: auto; } :host(.scrollHorizontal) { overflow-x: auto; overflow-y: hidden; } :host(.fixed) { overflow: auto; } :host(.mobile) { overflow-x: hidden; overflow-y: auto; display: block; } :host(.mobile) /deep/ gridster-item { position: relative; }"]}]}],"members":{"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"resize":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"optionsChanged":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"onResize":[{"__symbolic":"method"}],"checkIfToResize":[{"__symbolic":"method"}],"setGridSize":[{"__symbolic":"method"}],"setGridDimensions":[{"__symbolic":"method"}],"calculateLayout":[{"__symbolic":"method"}],"addItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"checkCollision":[{"__symbolic":"method"}],"checkGridCollision":[{"__symbolic":"method"}],"findItemWithItem":[{"__symbolic":"method"}],"findItemsWithItem":[{"__symbolic":"method"}],"autoPositionItem":[{"__symbolic":"method"}],"getNextPossiblePosition":[{"__symbolic":"method"}],"pixelsToPosition":[{"__symbolic":"method"}],"pixelsToPositionX":[{"__symbolic":"method"}],"pixelsToPositionY":[{"__symbolic":"method"}],"positionXToPixels":[{"__symbolic":"method"}],"positionYToPixels":[{"__symbolic":"method"}]},"statics":{"checkCollisionTwoItems":{"__symbolic":"function","parameters":["item","item2"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"cols"}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"x"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"cols"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"x"}}},"right":{"__symbolic":"binop","operator":"<","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"rows"}}}},"right":{"__symbolic":"binop","operator":">","left":{"__symbolic":"binop","operator":"+","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"y"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item"},"member":"rows"}},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"item2"},"member":"y"}}}}}}}}]

@@ -79,3 +79,3 @@ "use strict";

else {
this.moveUpTillCollision(itemComponent);
this.moveLeftTillCollision(itemComponent);
return true;

@@ -82,0 +82,0 @@ }

@@ -125,10 +125,15 @@ "use strict";

this.gridsterItem.$item.x = this.positionX;
if (this.gridster.checkGridCollision(this.gridsterItem.$item)) {
this.gridsterItem.$item.x = this.positionXBackup;
}
else {
this.gridsterItem.renderer.setStyle(this.gridsterItem.el, 'left', this.left + 'px');
}
this.gridsterItem.$item.y = this.positionY;
if (this.gridster.checkGridCollision(this.gridsterItem.$item)) {
this.gridsterItem.$item.x = this.positionXBackup;
this.gridsterItem.$item.y = this.positionYBackup;
return;
}
this.gridsterItem.renderer.setStyle(this.gridsterItem.el, 'left', this.left + 'px');
this.gridsterItem.renderer.setStyle(this.gridsterItem.el, 'top', this.top + 'px');
else {
this.gridsterItem.renderer.setStyle(this.gridsterItem.el, 'top', this.top + 'px');
}
if (this.positionXBackup !== this.gridsterItem.$item.x || this.positionYBackup !== this.gridsterItem.$item.y) {

@@ -135,0 +140,0 @@ var lastPosition = this.path[this.path.length - 1];

@@ -37,7 +37,7 @@ "use strict";

GridsterEmptyCell.prototype.emptyCellClickCb = function (e) {
if (gridsterUtils_service_1.GridsterUtils.checkContentClassForEvent(this.gridster, e)) {
if (this.gridster.movingItem || gridsterUtils_service_1.GridsterUtils.checkContentClassForEvent(this.gridster, e)) {
return;
}
var item = this.getValidItemFromEvent(e);
if (!item || this.gridster.movingItem) {
if (!item) {
return;

@@ -96,6 +96,5 @@ }

var item = this.getValidItemFromEvent(e, this.initialItem);
if (!item) {
return;
if (item) {
this.gridster.movingItem = item;
}
this.gridster.movingItem = item;
this.gridster.$options.emptyCellDragCallback(e, this.gridster.movingItem);

@@ -102,0 +101,0 @@ setTimeout(function () {

@@ -5,2 +5,5 @@ import { GridsterItemComponent } from './gridsterItem.component';

private pushedItems;
private pushedItemsTemp;
private pushedItemsTempInit;
private count;
private pushedItemsPath;

@@ -19,6 +22,9 @@ private gridsterItem;

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 trySouth(gridsterItemCollide, gridsterItem);
private tryNorth(gridsterItemCollide, gridsterItem);
private tryEast(gridsterItemCollide, gridsterItem);
private tryWest(gridsterItemCollide, gridsterItem);
private addToTempPushed(gridsterItem);
private removeFromTempPushed(gridsterItem);
private checkInTempPushed(gridsterItem);
private addToPushed(gridsterItem);

@@ -25,0 +31,0 @@ private removeFromPushed(i);

@@ -9,2 +9,4 @@ "use strict";

this.pushedItems = [];
this.pushedItemsTemp = [];
this.pushedItemsTempInit = [];
this.pushedItemsPath = [];

@@ -26,3 +28,10 @@ this.gridsterItem = gridsterItem;

if (this.gridster.$options.pushItems) {
this.push(this.gridsterItem, direction);
this.count = 0;
if (!this.push(this.gridsterItem, direction)) {
var i = this.pushedItemsTemp.length - 1;
for (; i > -1; i--) {
this.removeFromTempPushed(this.pushedItemsTemp[i]);
}
}
this.pushedItemsTemp = [];
}

@@ -55,32 +64,46 @@ };

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)) {
return true;
if (this.count > 3000) {
return false;
}
else {
this.count++;
}
if (this.gridster.checkGridCollision(gridsterItem.$item)) {
return false;
}
var a = this.gridster.findItemsWithItem(gridsterItem.$item);
var i = a.length - 1, itemColision;
var makePush = true;
for (; i > -1; i--) {
itemColision = a[i];
if (itemColision === this.gridsterItem) {
makePush = false;
break;
}
else if (this.tryPattern[direction][1].call(this, gridsterItemCollide, gridsterItem, direction)) {
return true;
if (!itemColision.canBeDragged()) {
makePush = false;
break;
}
else if (this.tryPattern[direction][2].call(this, gridsterItemCollide, gridsterItem, direction)) {
return true;
if (this.tryPattern[direction][0].call(this, itemColision, gridsterItem)) {
}
else if (this.tryPattern[direction][3].call(this, gridsterItemCollide, gridsterItem, direction)) {
return true;
else if (this.tryPattern[direction][1].call(this, itemColision, gridsterItem)) {
}
else if (this.tryPattern[direction][2].call(this, itemColision, gridsterItem)) {
}
else if (this.tryPattern[direction][3].call(this, itemColision, gridsterItem)) {
}
else {
makePush = false;
break;
}
}
else if (gridsterItemCollision === false) {
return true;
}
return false;
return makePush;
};
GridsterPush.prototype.trySouth = function (gridsterItemCollide, gridsterItem, direction) {
GridsterPush.prototype.trySouth = function (gridsterItemCollide, gridsterItem) {
this.addToTempPushed(gridsterItemCollide);
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)) {
if (this.push(gridsterItemCollide, this.fromNorth)) {
gridsterItemCollide.setSize(true);
this.addToPushed(gridsterItemCollide);
this.push(gridsterItem, direction);
return true;

@@ -93,10 +116,9 @@ }

};
GridsterPush.prototype.tryNorth = function (gridsterItemCollide, gridsterItem, direction) {
GridsterPush.prototype.tryNorth = function (gridsterItemCollide, gridsterItem) {
this.addToTempPushed(gridsterItemCollide);
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)) {
if (this.push(gridsterItemCollide, this.fromSouth)) {
gridsterItemCollide.setSize(true);
this.addToPushed(gridsterItemCollide);
this.push(gridsterItem, direction);
return true;

@@ -109,10 +131,9 @@ }

};
GridsterPush.prototype.tryEast = function (gridsterItemCollide, gridsterItem, direction) {
GridsterPush.prototype.tryEast = function (gridsterItemCollide, gridsterItem) {
this.addToTempPushed(gridsterItemCollide);
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)) {
if (this.push(gridsterItemCollide, this.fromWest)) {
gridsterItemCollide.setSize(true);
this.addToPushed(gridsterItemCollide);
this.push(gridsterItem, direction);
return true;

@@ -125,10 +146,9 @@ }

};
GridsterPush.prototype.tryWest = function (gridsterItemCollide, gridsterItem, direction) {
GridsterPush.prototype.tryWest = function (gridsterItemCollide, gridsterItem) {
this.addToTempPushed(gridsterItemCollide);
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)) {
if (this.push(gridsterItemCollide, this.fromEast)) {
gridsterItemCollide.setSize(true);
this.addToPushed(gridsterItemCollide);
this.push(gridsterItem, direction);
return true;

@@ -141,2 +161,21 @@ }

};
GridsterPush.prototype.addToTempPushed = function (gridsterItem) {
if (this.checkInTempPushed(gridsterItem)) {
return;
}
var l = this.pushedItemsTemp.push(gridsterItem);
this.pushedItemsTempInit[l - 1] = { x: gridsterItem.$item.x, y: gridsterItem.$item.y };
};
GridsterPush.prototype.removeFromTempPushed = function (gridsterItem) {
var i = this.pushedItemsTemp.indexOf(gridsterItem);
this.pushedItemsTemp.splice(i, 1);
var initPosition = this.pushedItemsTempInit[i];
gridsterItem.$item.x = initPosition.x;
gridsterItem.$item.y = initPosition.y;
gridsterItem.setSize(true);
this.pushedItemsTempInit.splice(i, 1);
};
GridsterPush.prototype.checkInTempPushed = function (gridsterItem) {
return this.pushedItemsTemp.indexOf(gridsterItem) > -1;
};
GridsterPush.prototype.addToPushed = function (gridsterItem) {

@@ -175,2 +214,3 @@ if (this.pushedItems.indexOf(gridsterItem) < 0) {

var lastPosition, x, y;
var change = false;
for (; j > -1; j--) {

@@ -184,3 +224,4 @@ lastPosition = path[j];

pushedItem.setSize(true);
path.splice(j + 1, path.length - 1 - j);
path.splice(j + 1, path.length - j - 1);
change = true;
}

@@ -194,5 +235,4 @@ else {

this.removeFromPushed(i);
return true;
}
return false;
return change;
};

@@ -199,0 +239,0 @@ GridsterPush.decorators = [

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":3,"metadata":{"GridsterPush":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./gridsterItem.component","name":"GridsterItemComponent"},{"__symbolic":"reference","module":"./gridster.component","name":"GridsterComponent"}]}],"pushItems":[{"__symbolic":"method"}],"restoreItems":[{"__symbolic":"method"}],"setPushedItems":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"trySouth":[{"__symbolic":"method"}],"tryNorth":[{"__symbolic":"method"}],"tryEast":[{"__symbolic":"method"}],"tryWest":[{"__symbolic":"method"}],"addToPushed":[{"__symbolic":"method"}],"removeFromPushed":[{"__symbolic":"method"}],"checkPushBack":[{"__symbolic":"method"}],"checkPushedItem":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"GridsterPush":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./gridsterItem.component","name":"GridsterItemComponent"},{"__symbolic":"reference","module":"./gridster.component","name":"GridsterComponent"}]}],"pushItems":[{"__symbolic":"method"}],"restoreItems":[{"__symbolic":"method"}],"setPushedItems":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"trySouth":[{"__symbolic":"method"}],"tryNorth":[{"__symbolic":"method"}],"tryEast":[{"__symbolic":"method"}],"tryWest":[{"__symbolic":"method"}],"addToPushed":[{"__symbolic":"method"}],"removeFromPushed":[{"__symbolic":"method"}],"checkPushBack":[{"__symbolic":"method"}],"checkPushedItem":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":3,"metadata":{"GridsterPush":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./gridsterItem.component","name":"GridsterItemComponent"},{"__symbolic":"reference","module":"./gridster.component","name":"GridsterComponent"}]}],"pushItems":[{"__symbolic":"method"}],"restoreItems":[{"__symbolic":"method"}],"setPushedItems":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"trySouth":[{"__symbolic":"method"}],"tryNorth":[{"__symbolic":"method"}],"tryEast":[{"__symbolic":"method"}],"tryWest":[{"__symbolic":"method"}],"addToTempPushed":[{"__symbolic":"method"}],"removeFromTempPushed":[{"__symbolic":"method"}],"checkInTempPushed":[{"__symbolic":"method"}],"addToPushed":[{"__symbolic":"method"}],"removeFromPushed":[{"__symbolic":"method"}],"checkPushBack":[{"__symbolic":"method"}],"checkPushedItem":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"GridsterPush":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./gridsterItem.component","name":"GridsterItemComponent"},{"__symbolic":"reference","module":"./gridster.component","name":"GridsterComponent"}]}],"pushItems":[{"__symbolic":"method"}],"restoreItems":[{"__symbolic":"method"}],"setPushedItems":[{"__symbolic":"method"}],"push":[{"__symbolic":"method"}],"trySouth":[{"__symbolic":"method"}],"tryNorth":[{"__symbolic":"method"}],"tryEast":[{"__symbolic":"method"}],"tryWest":[{"__symbolic":"method"}],"addToTempPushed":[{"__symbolic":"method"}],"removeFromTempPushed":[{"__symbolic":"method"}],"checkInTempPushed":[{"__symbolic":"method"}],"addToPushed":[{"__symbolic":"method"}],"removeFromPushed":[{"__symbolic":"method"}],"checkPushBack":[{"__symbolic":"method"}],"checkPushedItem":[{"__symbolic":"method"}]}}}}]
{
"name": "angular-gridster2",
"version": "3.11.3",
"version": "3.11.4",
"license": "MIT",

@@ -51,3 +51,3 @@ "main": "dist/index.js",

"@angular/cdk": "2.0.0-beta.8",
"@angular/cli": "1.3.0",
"@angular/cli": "1.3.1",
"@angular/common": "5.0.0-beta.3",

@@ -66,3 +66,3 @@ "@angular/compiler": "5.0.0-beta.3",

"@types/jasmine": "2.5.53",
"@types/node": "8.0.20",
"@types/node": "8.0.24",
"codelyzer": "3.1.2",

@@ -75,3 +75,3 @@ "core-js": "2.5.0",

"jasmine-core": "2.7.0",
"jasmine-spec-reporter": "4.2.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "1.7.0",

@@ -78,0 +78,0 @@ "karma-chrome-launcher": "2.2.0",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc