@schneideress/dashboardframework 20.0.12 → 20.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@ import { Injectable, Input, ViewEncapsulation, Component, EventEmitter, ElementR
3
3
  import { of, Subject, debounceTime, takeUntil, switchMap, timer } from 'rxjs';
4
4
  import * as i3 from '@schneideress/ra-common';
5
5
  import { BaseService, RACommonModule } from '@schneideress/ra-common';
6
- import { finalize, filter, map } from 'rxjs/operators';
7
6
  import * as i2$1 from 'ngx-ui-loader';
8
7
  import { NgxUiLoaderModule } from 'ngx-ui-loader';
9
8
  import * as i4 from 'angular-notifier';
@@ -15,6 +14,7 @@ import { loadRemoteModule } from '@angular-architects/module-federation';
15
14
  import * as i6 from '@schneideress/common-controls';
16
15
  import { RACommonControlsModule } from '@schneideress/common-controls';
17
16
  import { HttpClientModule } from '@angular/common/http';
17
+ import { filter, map } from 'rxjs/operators';
18
18
 
19
19
  class RaDashboardService extends BaseService {
20
20
  constructor(injector) {
@@ -4815,7 +4815,7 @@ class RADashboardArea {
4815
4815
  this.widgetList = [];
4816
4816
  setTimeout(() => {
4817
4817
  this.initiateGridsterConfig();
4818
- this.options.api.optionsChanged();
4818
+ this.options.api?.optionsChanged();
4819
4819
  if (this.userWidgets) {
4820
4820
  let widgets = this.mapObjectListToGridsterItemList(this.userWidgets);
4821
4821
  this.currentLoadingCount = 0;
@@ -5168,7 +5168,7 @@ class RADashboardArea {
5168
5168
  }
5169
5169
  this.gridheight = areaHeight;
5170
5170
  if (this.hasGrid) {
5171
- const baseHeight = this.gridItem.height; // gridster container current height
5171
+ const baseHeight = this.gridItem?.height; // gridster container current height
5172
5172
  if (baseHeight) {
5173
5173
  const effectiveCount = (this.widgetList.length % 2 === 1) ? this.widgetList.length + 1 : this.widgetList.length;
5174
5174
  const multiplier = Math.max(1, effectiveCount / 2);
@@ -5207,44 +5207,11 @@ class RADashboardArea {
5207
5207
  }
5208
5208
  if (this.isSiteDetailDashboard) {
5209
5209
  this.raDashboardEventBus.publish(RAEvent.UpdateWidgetCount, -1);
5210
- this.rearrangeWidgets();
5210
+ this.raDashboardEventBus.publish(RAEvent.RearrangeClicked, true);
5211
5211
  }
5212
5212
  }
5213
5213
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
5214
5214
  rearrangeWidgets() {
5215
- // Site Detail dashboard: zero positions, persist all, then reload from service
5216
- if (this.isSiteDetailDashboard) {
5217
- for (let i = 0; i < this.userWidgets.length; i++) {
5218
- this.userWidgets[i].position_x = 0;
5219
- this.userWidgets[i].position_y = 0;
5220
- }
5221
- // Rebuild gridster items with zeroed positions
5222
- this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
5223
- this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
5224
- if (this.responsiveService.IsDesktopView) {
5225
- // Batch persist then reload fresh layout from server ONLY after update completes
5226
- const payload = this.formatWidgetDataForPositionDetails(this.mapGridsterListToObject(this.widgetList));
5227
- this.ngxService.start();
5228
- this.dashboardService.updateWidgets(payload, this.appConfig)
5229
- .pipe(finalize(() => { this.ngxService.stop(); }))
5230
- .subscribe({
5231
- next: () => {
5232
- this.loadWidgets(this.userDashboardId, this.areaKey);
5233
- },
5234
- error: (err) => {
5235
- // On error still attempt a reload so user sees current state, optionally notify
5236
- this.notifier.notify('error', this.translateService.translate('persist Positions Failed'));
5237
- this.loadWidgets(this.userDashboardId, this.areaKey);
5238
- }
5239
- });
5240
- }
5241
- else {
5242
- // Mobile: just adjust height (positions already stacked at 0,0 and will auto-flow)
5243
- setTimeout(() => { this.setAreaHeight(); });
5244
- }
5245
- return;
5246
- }
5247
- // Other dashboards: legacy behaviour
5248
5215
  for (let i = 0; i < this.userWidgets.length; i++) {
5249
5216
  this.userWidgets[i].position_x = 0;
5250
5217
  this.userWidgets[i].position_y = 0;