Merge branch 'master' of github.com:thingsboard/thingsboard
This commit is contained in:
commit
20635e85cd
@ -248,8 +248,15 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
|
|||||||
defaultItemCols: 8,
|
defaultItemCols: 8,
|
||||||
defaultItemRows: 6,
|
defaultItemRows: 6,
|
||||||
displayGrid: this.displayGrid,
|
displayGrid: this.displayGrid,
|
||||||
resizable: {enabled: this.isEdit && !this.isEditingWidget, delayStart: 50},
|
resizable: {
|
||||||
draggable: {enabled: this.isEdit && !this.isEditingWidget},
|
enabled: this.isEdit && !this.isEditingWidget,
|
||||||
|
delayStart: 50,
|
||||||
|
stop: (_, itemComponent) => {(itemComponent.item as DashboardWidget).updatePosition(itemComponent.$item.x, itemComponent.$item.y);}
|
||||||
|
},
|
||||||
|
draggable: {
|
||||||
|
enabled: this.isEdit && !this.isEditingWidget,
|
||||||
|
stop: (_, itemComponent) => {(itemComponent.item as DashboardWidget).updatePosition(itemComponent.$item.x, itemComponent.$item.y);}
|
||||||
|
},
|
||||||
itemChangeCallback: () => this.dashboardWidgets.sortWidgets(),
|
itemChangeCallback: () => this.dashboardWidgets.sortWidgets(),
|
||||||
itemInitCallback: (_, itemComponent) => {
|
itemInitCallback: (_, itemComponent) => {
|
||||||
(itemComponent.item as DashboardWidget).gridsterItemComponent = itemComponent;
|
(itemComponent.item as DashboardWidget).gridsterItemComponent = itemComponent;
|
||||||
|
|||||||
@ -706,15 +706,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
|
|||||||
return Math.floor(res);
|
return Math.floor(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
set x(x: number) {
|
set x(_: number) {}
|
||||||
if (!this.dashboard.isMobileSize && this.dashboard.isEdit) {
|
|
||||||
if (this.widgetLayout) {
|
|
||||||
this.widgetLayout.col = x;
|
|
||||||
} else {
|
|
||||||
this.widget.col = x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@enumerable(true)
|
@enumerable(true)
|
||||||
get y(): number {
|
get y(): number {
|
||||||
@ -727,15 +719,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
|
|||||||
return Math.floor(res);
|
return Math.floor(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
set y(y: number) {
|
set y(_: number) {}
|
||||||
if (!this.dashboard.isMobileSize && this.dashboard.isEdit) {
|
|
||||||
if (this.widgetLayout) {
|
|
||||||
this.widgetLayout.row = y;
|
|
||||||
} else {
|
|
||||||
this.widget.row = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get preserveAspectRatio(): boolean {
|
get preserveAspectRatio(): boolean {
|
||||||
if (!this.dashboard.isMobileSize && this.widgetLayout) {
|
if (!this.dashboard.isMobileSize && this.widgetLayout) {
|
||||||
@ -833,4 +817,14 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
|
|||||||
}
|
}
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePosition(x: number, y: number) {
|
||||||
|
if (this.widgetLayout) {
|
||||||
|
this.widgetLayout.col = x;
|
||||||
|
this.widgetLayout.row = y;
|
||||||
|
} else {
|
||||||
|
this.widget.col = x;
|
||||||
|
this.widget.row = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user