UI: Fixed updated header button color
This commit is contained in:
parent
c1d382a39b
commit
fe0e20f785
@ -135,8 +135,8 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
|
|||||||
showIcon: [{ value: this.action.showIcon ?? true, disabled: true}, []],
|
showIcon: [{ value: this.action.showIcon ?? true, disabled: true}, []],
|
||||||
icon: [this.action.icon, Validators.required],
|
icon: [this.action.icon, Validators.required],
|
||||||
buttonColor: [{ value: this.action.buttonColor ?? this.defaultIconColor, disabled: true}, []],
|
buttonColor: [{ value: this.action.buttonColor ?? this.defaultIconColor, disabled: true}, []],
|
||||||
buttonFillColor: [{ value: this.action.buttonFillColor ?? '#3F52DD', disabled: true}, []],
|
buttonFillColor: [{ value: this.action.buttonFillColor ?? '#305680', disabled: true}, []],
|
||||||
buttonBorderColor: [{ value: this.action.buttonBorderColor ?? '#3F52DD', disabled: true}, []],
|
buttonBorderColor: [{ value: this.action.buttonBorderColor ?? '#0000001F', disabled: true}, []],
|
||||||
customButtonStyle: [{ value: this.action.customButtonStyle ?? {}, disabled: true}, []],
|
customButtonStyle: [{ value: this.action.customButtonStyle ?? {}, disabled: true}, []],
|
||||||
useShowWidgetActionFunction: [this.action.useShowWidgetActionFunction],
|
useShowWidgetActionFunction: [this.action.useShowWidgetActionFunction],
|
||||||
showWidgetActionFunction: [this.action.showWidgetActionFunction || 'return true;'],
|
showWidgetActionFunction: [this.action.showWidgetActionFunction || 'return true;'],
|
||||||
@ -146,7 +146,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
|
|||||||
if (this.widgetActionFormGroup.get('actionSourceId').value === 'headerButton') {
|
if (this.widgetActionFormGroup.get('actionSourceId').value === 'headerButton') {
|
||||||
this.widgetActionFormGroup.get('buttonType').enable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonType').enable({emitEvent: false});
|
||||||
this.widgetActionFormGroup.get('buttonColor').enable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonColor').enable({emitEvent: false});
|
||||||
this.widgetHeaderButtonValidators();
|
this.widgetHeaderButtonValidators(true);
|
||||||
}
|
}
|
||||||
this.widgetActionFormGroup.get('actionSourceId').valueChanges.pipe(
|
this.widgetActionFormGroup.get('actionSourceId').valueChanges.pipe(
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
@ -162,7 +162,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
|
|||||||
if (value === 'headerButton') {
|
if (value === 'headerButton') {
|
||||||
this.widgetActionFormGroup.get('buttonType').enable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonType').enable({emitEvent: false});
|
||||||
this.widgetActionFormGroup.get('buttonColor').enable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonColor').enable({emitEvent: false});
|
||||||
this.widgetHeaderButtonValidators();
|
this.widgetHeaderButtonValidators(true);
|
||||||
} else {
|
} else {
|
||||||
this.widgetActionFormGroup.get('buttonType').disable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonType').disable({emitEvent: false});
|
||||||
this.widgetActionFormGroup.get('showIcon').disable({emitEvent: false});
|
this.widgetActionFormGroup.get('showIcon').disable({emitEvent: false});
|
||||||
@ -190,12 +190,16 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
widgetHeaderButtonValidators() {
|
private widgetHeaderButtonValidators(ignoreUpdatedButtonColor = false) {
|
||||||
const buttonType = this.widgetActionFormGroup.get('buttonType').value;
|
const buttonType = this.widgetActionFormGroup.get('buttonType').value;
|
||||||
if (buttonType !== WidgetHeaderActionButtonType.icon) {
|
if (!ignoreUpdatedButtonColor) {
|
||||||
this.widgetActionFormGroup.get('buttonColor').patchValue('#ffffff', {emitEvent: false});
|
if ([WidgetHeaderActionButtonType.raised, WidgetHeaderActionButtonType.flat, WidgetHeaderActionButtonType.miniFab].includes(buttonType)) {
|
||||||
} else {
|
this.widgetActionFormGroup.get('buttonColor').patchValue('#ffffff', {emitEvent: false});
|
||||||
this.widgetActionFormGroup.get('buttonColor').patchValue(this.defaultIconColor, {emitEvent: false});
|
} else if ([WidgetHeaderActionButtonType.stroked].includes(buttonType)) {
|
||||||
|
this.widgetActionFormGroup.get('buttonColor').patchValue('#305680', {emitEvent: false});
|
||||||
|
} else {
|
||||||
|
this.widgetActionFormGroup.get('buttonColor').patchValue(this.defaultIconColor, {emitEvent: false});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.widgetActionFormGroup.get('showIcon').disable({emitEvent: false});
|
this.widgetActionFormGroup.get('showIcon').disable({emitEvent: false});
|
||||||
this.widgetActionFormGroup.get('buttonFillColor').disable({emitEvent: false});
|
this.widgetActionFormGroup.get('buttonFillColor').disable({emitEvent: false});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user