|
|
@ -63,6 +63,7 @@ export interface IDashboardComponent { |
|
|
dashboardWidgets: DashboardWidgets; |
|
|
dashboardWidgets: DashboardWidgets; |
|
|
mobileAutofillHeight: boolean; |
|
|
mobileAutofillHeight: boolean; |
|
|
isMobileSize: boolean; |
|
|
isMobileSize: boolean; |
|
|
|
|
|
isEdit: boolean; |
|
|
autofillHeight: boolean; |
|
|
autofillHeight: boolean; |
|
|
dashboardTimewindow: Timewindow; |
|
|
dashboardTimewindow: Timewindow; |
|
|
dashboardTimewindowChanged: Observable<Timewindow>; |
|
|
dashboardTimewindowChanged: Observable<Timewindow>; |
|
|
@ -99,7 +100,14 @@ export class DashboardWidgets implements Iterable<DashboardWidget> { |
|
|
widgetLayouts: WidgetLayouts; |
|
|
widgetLayouts: WidgetLayouts; |
|
|
|
|
|
|
|
|
[Symbol.iterator](): Iterator<DashboardWidget> { |
|
|
[Symbol.iterator](): Iterator<DashboardWidget> { |
|
|
return this.dashboardWidgets[Symbol.iterator](); |
|
|
return this.activeDashboardWidgets[Symbol.iterator](); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get activeDashboardWidgets(): Array<DashboardWidget> { |
|
|
|
|
|
if (this.dashboard.isMobileSize && !this.dashboard.isEdit) { |
|
|
|
|
|
return this.dashboardWidgets.filter(w => !w.mobileHide); |
|
|
|
|
|
} |
|
|
|
|
|
return this.dashboardWidgets; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
constructor(private dashboard: IDashboardComponent, |
|
|
constructor(private dashboard: IDashboardComponent, |
|
|
@ -152,6 +160,7 @@ export class DashboardWidgets implements Iterable<DashboardWidget> { |
|
|
} |
|
|
} |
|
|
if (updateRecords.length) { |
|
|
if (updateRecords.length) { |
|
|
updateRecords.forEach((record) => { |
|
|
updateRecords.forEach((record) => { |
|
|
|
|
|
let index; |
|
|
switch (record.operation) { |
|
|
switch (record.operation) { |
|
|
case 'add': |
|
|
case 'add': |
|
|
this.dashboardWidgets.push( |
|
|
this.dashboardWidgets.push( |
|
|
@ -159,7 +168,7 @@ export class DashboardWidgets implements Iterable<DashboardWidget> { |
|
|
); |
|
|
); |
|
|
break; |
|
|
break; |
|
|
case 'remove': |
|
|
case 'remove': |
|
|
let index = this.dashboardWidgets.findIndex((dashboardWidget) => dashboardWidget.widgetId === record.widgetId); |
|
|
index = this.dashboardWidgets.findIndex((dashboardWidget) => dashboardWidget.widgetId === record.widgetId); |
|
|
if (index > -1) { |
|
|
if (index > -1) { |
|
|
this.dashboardWidgets.splice(index, 1); |
|
|
this.dashboardWidgets.splice(index, 1); |
|
|
} |
|
|
} |
|
|
@ -261,7 +270,7 @@ export class DashboardWidgets implements Iterable<DashboardWidget> { |
|
|
|
|
|
|
|
|
private updateRowsAndSort() { |
|
|
private updateRowsAndSort() { |
|
|
let maxRows = this.dashboard.gridsterOpts.maxRows; |
|
|
let maxRows = this.dashboard.gridsterOpts.maxRows; |
|
|
this.dashboardWidgets.forEach((dashboardWidget) => { |
|
|
this.activeDashboardWidgets.forEach((dashboardWidget) => { |
|
|
const bottom = dashboardWidget.y + dashboardWidget.rows; |
|
|
const bottom = dashboardWidget.y + dashboardWidget.rows; |
|
|
maxRows = Math.max(maxRows, bottom); |
|
|
maxRows = Math.max(maxRows, bottom); |
|
|
}); |
|
|
}); |
|
|
@ -328,6 +337,10 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget { |
|
|
private gridsterItemComponentSubject = new Subject<GridsterItemComponentInterface>(); |
|
|
private gridsterItemComponentSubject = new Subject<GridsterItemComponentInterface>(); |
|
|
private gridsterItemComponentValue: GridsterItemComponentInterface; |
|
|
private gridsterItemComponentValue: GridsterItemComponentInterface; |
|
|
|
|
|
|
|
|
|
|
|
get mobileHide(): boolean { |
|
|
|
|
|
return this.widgetLayout ? this.widgetLayout.mobileHide === true : false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
set gridsterItemComponent(item: GridsterItemComponentInterface) { |
|
|
set gridsterItemComponent(item: GridsterItemComponentInterface) { |
|
|
this.gridsterItemComponentValue = item; |
|
|
this.gridsterItemComponentValue = item; |
|
|
this.gridsterItemComponentSubject.next(this.gridsterItemComponentValue); |
|
|
this.gridsterItemComponentSubject.next(this.gridsterItemComponentValue); |
|
|
@ -423,7 +436,7 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget { |
|
|
this.showWidgetTitlePanel = this.widgetContext.hideTitlePanel ? false : |
|
|
this.showWidgetTitlePanel = this.widgetContext.hideTitlePanel ? false : |
|
|
this.showTitle || this.hasTimewindow; |
|
|
this.showTitle || this.hasTimewindow; |
|
|
|
|
|
|
|
|
this.showWidgetActions = this.widgetContext.hideTitlePanel ? false : true; |
|
|
this.showWidgetActions = !this.widgetContext.hideTitlePanel; |
|
|
|
|
|
|
|
|
this.customHeaderActions = this.widgetContext.customHeaderActions ? this.widgetContext.customHeaderActions : []; |
|
|
this.customHeaderActions = this.widgetContext.customHeaderActions ? this.widgetContext.customHeaderActions : []; |
|
|
this.widgetActions = this.widgetContext.widgetActions ? this.widgetContext.widgetActions : []; |
|
|
this.widgetActions = this.widgetContext.widgetActions ? this.widgetContext.widgetActions : []; |
|
|
|