Merge pull request #13105 from ArtemDzhereleiko/AD/imp/color-settings-panel/tab-validation
Color settings panel tab validation
This commit is contained in:
		
						commit
						79f7c6c21b
					
				@ -110,8 +110,28 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit
 | 
			
		||||
    this.colorSettingsFormGroup.get('type').valueChanges.pipe(
 | 
			
		||||
      takeUntilDestroyed(this.destroyRef)
 | 
			
		||||
    ).subscribe(() => {
 | 
			
		||||
      this.updateValidators();
 | 
			
		||||
      setTimeout(() => {this.popover?.updatePosition();}, 0);
 | 
			
		||||
    });
 | 
			
		||||
    this.updateValidators();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateValidators() {
 | 
			
		||||
    const type: ColorType = this.colorSettingsFormGroup.get('type').value;
 | 
			
		||||
    this.colorSettingsFormGroup.get('gradient').disable({emitEvent: false});
 | 
			
		||||
    this.colorSettingsFormGroup.get('rangeList').disable({emitEvent: false});
 | 
			
		||||
    this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false});
 | 
			
		||||
    switch (type) {
 | 
			
		||||
      case ColorType.gradient:
 | 
			
		||||
        this.colorSettingsFormGroup.get('gradient').enable({emitEvent: false});
 | 
			
		||||
        break;
 | 
			
		||||
      case ColorType.range:
 | 
			
		||||
        this.colorSettingsFormGroup.get('rangeList').enable({emitEvent: false});
 | 
			
		||||
        break;
 | 
			
		||||
      case ColorType.function:
 | 
			
		||||
        this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false});
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  copyColorSettings(comp: ColorSettingsComponent) {
 | 
			
		||||
@ -131,7 +151,7 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  applyColorSettings() {
 | 
			
		||||
    const colorSettings = this.colorSettingsFormGroup.value;
 | 
			
		||||
    const colorSettings: ColorSettings = this.colorSettingsFormGroup.getRawValue();
 | 
			
		||||
    this.colorSettingsApplied.emit(colorSettings);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -101,7 +101,7 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  applyColorSettings() {
 | 
			
		||||
    const colorSettings: DataLayerColorSettings = this.colorSettingsFormGroup.value;
 | 
			
		||||
    const colorSettings: DataLayerColorSettings = this.colorSettingsFormGroup.getRawValue();
 | 
			
		||||
    this.colorSettingsApplied.emit(colorSettings);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -122,8 +122,15 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen
 | 
			
		||||
    const type: DataLayerColorType = this.colorSettingsFormGroup.get('type').value;
 | 
			
		||||
    if (type === DataLayerColorType.range) {
 | 
			
		||||
      this.colorSettingsFormGroup.get('rangeKey').enable({emitEvent: false});
 | 
			
		||||
      this.colorSettingsFormGroup.get('range').enable({emitEvent: false});
 | 
			
		||||
    } else {
 | 
			
		||||
      this.colorSettingsFormGroup.get('rangeKey').disable({emitEvent: false});
 | 
			
		||||
      this.colorSettingsFormGroup.get('range').disable({emitEvent: false});
 | 
			
		||||
    }
 | 
			
		||||
    if (type === DataLayerColorType.function) {
 | 
			
		||||
      this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false});
 | 
			
		||||
    } else {
 | 
			
		||||
      this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false});
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user