@c8y/ngx-components 1017.0.100 → 1017.0.102

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.
@@ -650,7 +650,7 @@ class DatapointSelectorListItemComponent {
650
650
  }
651
651
  unlinkDatapointTemplate() {
652
652
  const details = this.formGroup.value.details || {};
653
- details.__template = undefined;
653
+ this.resetUnusedProperties(details);
654
654
  this.formGroup.patchValue({ __template: undefined, details });
655
655
  }
656
656
  dataPointTemplateSelected(template) {
@@ -663,6 +663,7 @@ class DatapointSelectorListItemComponent {
663
663
  'yellowRangeMin',
664
664
  'redRangeMax',
665
665
  'redRangeMin',
666
+ 'target',
666
667
  'orientation',
667
668
  'unit'
668
669
  ];
@@ -681,6 +682,21 @@ class DatapointSelectorListItemComponent {
681
682
  this.writeValue(dataPoint);
682
683
  this.setPipe('');
683
684
  }
685
+ resetUnusedProperties(details) {
686
+ const { showTarget, showYellowRange, showRedRange } = this.defaultFormOptions;
687
+ details.__template = undefined;
688
+ if (!showTarget) {
689
+ details.target = undefined;
690
+ }
691
+ if (!showYellowRange) {
692
+ details.yellowRangeMin = undefined;
693
+ details.yellowRangeMax = undefined;
694
+ }
695
+ if (!showRedRange) {
696
+ details.redRangeMin = undefined;
697
+ details.redRangeMax = undefined;
698
+ }
699
+ }
684
700
  filterDatapointLabel(kpis, filterStr) {
685
701
  return kpis.filter((mo) => mo[DATAPOINT_LIBRARY_FRAGMENT] &&
686
702
  mo[DATAPOINT_LIBRARY_FRAGMENT].label &&