Browse Source

UI: Backward compatibility for header icon button action

pull/13045/head
Artem Dzhereleiko 2 years ago
parent
commit
3005b5bf8f
  1. 1
      ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html
  2. 1
      ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts
  3. 3
      ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts
  4. 6
      ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts
  5. 1
      ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts
  6. 1
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
  7. 2
      ui-ngx/src/app/modules/home/components/widget/widget.component.ts

1
ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html

@ -33,6 +33,7 @@
[callbacks]="data.callbacks" [callbacks]="data.callbacks"
[widgetType] = "data.widgetType" [widgetType] = "data.widgetType"
[actionSources]="actionSources" [actionSources]="actionSources"
[defaultIconColor]="data.defaultIconColor"
[additionalWidgetActionTypes]="data.additionalWidgetActionTypes" [additionalWidgetActionTypes]="data.additionalWidgetActionTypes"
formControlName="actions"> formControlName="actions">
</tb-manage-widget-actions> </tb-manage-widget-actions>

1
ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts

@ -32,6 +32,7 @@ export interface ManageWidgetActionsDialogData {
actionsData: WidgetActionsData; actionsData: WidgetActionsData;
callbacks: WidgetActionCallbacks; callbacks: WidgetActionCallbacks;
widgetType: widgetType; widgetType: widgetType;
defaultIconColor?: string;
additionalWidgetActionTypes?: WidgetActionType[]; additionalWidgetActionTypes?: WidgetActionType[];
} }

3
ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts

@ -73,6 +73,8 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni
@Input() widgetType: widgetType; @Input() widgetType: widgetType;
@Input() defaultIconColor: string;
@Input() callbacks: WidgetActionCallbacks; @Input() callbacks: WidgetActionCallbacks;
@Input() actionSources: {[actionSourceId: string]: WidgetActionSource}; @Input() actionSources: {[actionSourceId: string]: WidgetActionSource};
@ -239,6 +241,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni
actionsData, actionsData,
action: deepClone(action), action: deepClone(action),
widgetType: this.widgetType, widgetType: this.widgetType,
defaultIconColor: this.defaultIconColor,
additionalWidgetActionTypes: this.additionalWidgetActionTypes additionalWidgetActionTypes: this.additionalWidgetActionTypes
} }
}).afterClosed().subscribe( }).afterClosed().subscribe(

6
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts

@ -61,6 +61,7 @@ export interface WidgetActionDialogData {
actionsData: WidgetActionsData; actionsData: WidgetActionsData;
action?: WidgetActionDescriptorInfo; action?: WidgetActionDescriptorInfo;
widgetType: widgetType; widgetType: widgetType;
defaultIconColor?: string;
additionalWidgetActionTypes?: WidgetActionType[]; additionalWidgetActionTypes?: WidgetActionType[];
} }
@ -78,6 +79,8 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
isAdd: boolean; isAdd: boolean;
action: WidgetActionDescriptorInfo; action: WidgetActionDescriptorInfo;
defaultIconColor: string;
customActionEditorCompleter = CustomActionEditorCompleter; customActionEditorCompleter = CustomActionEditorCompleter;
submitted = false; submitted = false;
@ -106,6 +109,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
private destroyRef: DestroyRef) { private destroyRef: DestroyRef) {
super(store, router, dialogRef); super(store, router, dialogRef);
this.isAdd = data.isAdd; this.isAdd = data.isAdd;
this.defaultIconColor = data.defaultIconColor;
if (this.isAdd) { if (this.isAdd) {
this.action = { this.action = {
id: this.utils.guid(), id: this.utils.guid(),
@ -130,7 +134,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
buttonType: [{ value: this.action.buttonType ?? WidgetHeaderActionButtonType.icon, disabled: true}, []], buttonType: [{ value: this.action.buttonType ?? WidgetHeaderActionButtonType.icon, disabled: true}, []],
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 ?? 'rgba(0, 0, 0, 0.87)', disabled: true}, []], buttonColor: [{ value: this.action.buttonColor ?? this.defaultIconColor, disabled: true}, []],
buttonFillColor: [{ value: this.action.buttonFillColor ?? '#3F52DD', disabled: true}, []], buttonFillColor: [{ value: this.action.buttonFillColor ?? '#3F52DD', disabled: true}, []],
buttonBorderColor: [{ value: this.action.buttonBorderColor ?? '#3F52DD', disabled: true}, []], buttonBorderColor: [{ value: this.action.buttonBorderColor ?? '#3F52DD', disabled: true}, []],
customButtonStyle: [{ value: this.action.customButtonStyle ?? {}, disabled: true}, []], customButtonStyle: [{ value: this.action.customButtonStyle ?? {}, disabled: true}, []],

1
ui-ngx/src/app/modules/home/components/widget/config/basic/common/widget-actions-panel.component.ts

@ -123,6 +123,7 @@ export class WidgetActionsPanelComponent implements ControlValueAccessor, OnInit
callbacks: this.widgetConfigComponent.widgetConfigCallbacks, callbacks: this.widgetConfigComponent.widgetConfigCallbacks,
actionsData, actionsData,
widgetType: this.widgetConfigComponent.widgetType, widgetType: this.widgetConfigComponent.widgetType,
defaultIconColor: this.widgetConfigComponent.widgetSettings.get('color').value,
additionalWidgetActionTypes: this.widgetConfigComponent.modelValue.typeParameters.additionalWidgetActionTypes additionalWidgetActionTypes: this.widgetConfigComponent.modelValue.typeParameters.additionalWidgetActionTypes
} }
}).afterClosed().subscribe( }).afterClosed().subscribe(

1
ui-ngx/src/app/modules/home/components/widget/widget-config.component.html

@ -163,6 +163,7 @@
<tb-manage-widget-actions <tb-manage-widget-actions
[callbacks]="widgetConfigCallbacks" [callbacks]="widgetConfigCallbacks"
[widgetType] = "modelValue.widgetType" [widgetType] = "modelValue.widgetType"
[defaultIconColor]="widgetSettings.get('color').value"
[actionSources]="modelValue.actionSources" [actionSources]="modelValue.actionSources"
[additionalWidgetActionTypes]="modelValue.typeParameters.additionalWidgetActionTypes" [additionalWidgetActionTypes]="modelValue.typeParameters.additionalWidgetActionTypes"
formControlName="actions"> formControlName="actions">

2
ui-ngx/src/app/modules/home/components/widget/widget.component.ts

@ -365,7 +365,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges,
headerButtonStyle(buttonType: WidgetHeaderActionButtonType = WidgetHeaderActionButtonType.icon, headerButtonStyle(buttonType: WidgetHeaderActionButtonType = WidgetHeaderActionButtonType.icon,
customButtonStyle:{[key: string]: string}, customButtonStyle:{[key: string]: string},
buttonColor: string = 'rgba(0,0,0,0.87)', buttonColor: string = this.widget.config.color,
backgroundColor: string, backgroundColor: string,
borderColor: string) { borderColor: string) {
const buttonStyle = {}; const buttonStyle = {};

Loading…
Cancel
Save