@c8y/ngx-components 1024.13.0 → 1024.14.0

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, DestroyRef, input, computed, ChangeDetectionStrategy, Component, viewChild, signal, ElementRef, output, effect } from '@angular/core';
2
+ import { Injectable, inject, DestroyRef, input, computed, ChangeDetectionStrategy, Component, ChangeDetectorRef, viewChild, signal, ElementRef, output, effect } from '@angular/core';
3
3
  import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
4
4
  import * as i2 from '@c8y/ngx-components';
5
5
  import { IconDirective, C8yTranslatePipe, AlertService, DropAreaComponent, FormGroupComponent, ListGroupModule, ModalModule, FormsModule as FormsModule$1, DashboardChildComponent, DynamicComponentAlertAggregator, DismissAlertStrategy, DynamicComponentAlert, ManagedObjectRealtimeService } from '@c8y/ngx-components';
@@ -1040,6 +1040,7 @@ class ScadaWidgetSvgSelectorComponent {
1040
1040
  this.aiService = inject(AIService);
1041
1041
  this.formBuilder = inject(FormBuilder);
1042
1042
  this.destroyRef = inject(DestroyRef);
1043
+ this.cdRef = inject(ChangeDetectorRef);
1043
1044
  this.formGroup = this.formBuilder.group({
1044
1045
  source: this.formBuilder.nonNullable.control('file'),
1045
1046
  svgCode: this.formBuilder.nonNullable.control('', []),
@@ -1195,21 +1196,24 @@ class ScadaWidgetSvgSelectorComponent {
1195
1196
  });
1196
1197
  }
1197
1198
  async onSvgFileDropped(event) {
1198
- this.dropArea().loading = true;
1199
+ // Captured once: switching the Source radio away from "file" mid-upload destroys #dropArea.
1200
+ const dropArea = this.dropArea();
1201
+ dropArea.loading = true;
1199
1202
  try {
1200
1203
  const svgFile = event[0].file;
1201
1204
  const config = await firstValueFrom(this.scadaConfigService.config$);
1202
1205
  const updatedConfig = await this.scadaConfigService.updateConfigWithSvgFile(config, svgFile);
1203
1206
  this.scadaConfigService.save(updatedConfig);
1204
1207
  this.sectionComponent.section.expanded = false;
1205
- this.dropArea().files = null;
1208
+ dropArea.files = null;
1206
1209
  this.alertService.success(gettext('SVG file uploaded.'));
1207
1210
  }
1208
1211
  catch (e) {
1209
1212
  this.alertService.danger(gettext('Could not upload the selected SVG file.'), e?.message || e);
1210
1213
  }
1211
1214
  finally {
1212
- this.dropArea().loading = false;
1215
+ dropArea.loading = false;
1216
+ this.cdRef.markForCheck();
1213
1217
  }
1214
1218
  }
1215
1219
  async applySvgCode() {