Skip to content

Commit c6c6293

Browse files
authored
Merge pull request thingsboard#10225 from vvlladd28/bug/background-settings/jump
Fixed background settings panel jump when edit content
2 parents ec540fa + d4e02f4 commit c6c6293

File tree

3 files changed

+55
-42
lines changed

3 files changed

+55
-42
lines changed

ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.html

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,54 @@
1717
-->
1818
<div class="tb-background-settings-panel" [formGroup]="backgroundSettingsFormGroup">
1919
<div class="tb-background-settings-title" translate>widgets.background.background-settings</div>
20-
<div class="tb-form-panel tb-background-form-panel">
21-
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">
22-
<div class="tb-form-panel-title" translate>widgets.background.background</div>
23-
<tb-toggle-select formControlName="type" fxFlex selectMediaBreakpoint="xs">
24-
<tb-toggle-option *ngFor="let type of backgroundTypes"
25-
[value]="type">
26-
{{ backgroundTypeTranslationsMap.get(type) | translate }}
27-
</tb-toggle-option>
28-
</tb-toggle-select>
29-
</div>
30-
<tb-gallery-image-input [fxShow]="backgroundSettingsFormGroup.get('type').value === backgroundType.image" formControlName="imageUrl"></tb-gallery-image-input>
31-
<div [fxShow]="backgroundSettingsFormGroup.get('type').value === backgroundType.color" class="tb-form-row space-between tb-background-color-field">
32-
<div translate>widgets.color.color</div>
33-
<tb-color-input asBoxInput
34-
formControlName="color">
35-
</tb-color-input>
36-
</div>
37-
</div>
38-
<div class="tb-form-panel" formGroupName="overlay">
39-
<div class="tb-form-panel-title" translate>widgets.background.overlay</div>
40-
<mat-slide-toggle class="mat-slide" formControlName="enabled">
41-
{{ 'widgets.background.enable-overlay' | translate }}
42-
</mat-slide-toggle>
43-
<div class="tb-form-row space-between">
44-
<div translate>widgets.color.color</div>
45-
<tb-color-input asBoxInput
46-
formControlName="color">
47-
</tb-color-input>
48-
</div>
49-
<div class="tb-form-row space-between">
50-
<div translate>widgets.background.blur</div>
51-
<mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
52-
<input matInput formControlName="blur" type="number" min="0" step="1" placeholder="{{ 'widget-config.set' | translate }}">
53-
<div matSuffix>px</div>
54-
</mat-form-field>
20+
<div class="tb-background-settings-panel-content">
21+
<div class="tb-form-panel tb-background-form-panel">
22+
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="16px">
23+
<div class="tb-form-panel-title" translate>widgets.background.background</div>
24+
<tb-toggle-select formControlName="type" fxFlex selectMediaBreakpoint="xs">
25+
<tb-toggle-option *ngFor="let type of backgroundTypes"
26+
[value]="type">
27+
{{ backgroundTypeTranslationsMap.get(type) | translate }}
28+
</tb-toggle-option>
29+
</tb-toggle-select>
30+
</div>
31+
<tb-gallery-image-input [fxShow]="backgroundSettingsFormGroup.get('type').value === backgroundType.image"
32+
formControlName="imageUrl"></tb-gallery-image-input>
33+
<div [fxShow]="backgroundSettingsFormGroup.get('type').value === backgroundType.color"
34+
class="tb-form-row space-between tb-background-color-field">
35+
<div translate>widgets.color.color</div>
36+
<tb-color-input asBoxInput
37+
formControlName="color">
38+
</tb-color-input>
39+
</div>
5540
</div>
56-
</div>
57-
<div class="tb-background-settings-preview">
58-
<div class="tb-background-settings-preview-title" translate>
59-
widgets.background.preview
41+
<div class="tb-form-panel" formGroupName="overlay">
42+
<div class="tb-form-panel-title" translate>widgets.background.overlay</div>
43+
<mat-slide-toggle class="mat-slide" formControlName="enabled">
44+
{{ 'widgets.background.enable-overlay' | translate }}
45+
</mat-slide-toggle>
46+
<div class="tb-form-row space-between">
47+
<div translate>widgets.color.color</div>
48+
<tb-color-input asBoxInput
49+
formControlName="color">
50+
</tb-color-input>
51+
</div>
52+
<div class="tb-form-row space-between">
53+
<div translate>widgets.background.blur</div>
54+
<mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
55+
<input matInput formControlName="blur" type="number" min="0" step="1"
56+
placeholder="{{ 'widget-config.set' | translate }}">
57+
<div matSuffix>px</div>
58+
</mat-form-field>
59+
</div>
6060
</div>
61-
<div class="tb-background-settings-preview-box mat-elevation-z4" [style]="backgroundStyle$ | async">
62-
<div class="tb-background-settings-preview-overlay" [style]="overlayStyle">
61+
<div class="tb-background-settings-preview">
62+
<div class="tb-background-settings-preview-title" translate>
63+
widgets.background.preview
64+
</div>
65+
<div class="tb-background-settings-preview-box mat-elevation-z4" [style]="backgroundStyle$ | async">
66+
<div class="tb-background-settings-preview-overlay" [style]="overlayStyle">
67+
</div>
6368
</div>
6469
</div>
6570
</div>

ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@
6767
left: 7.998px;
6868
right: 7.998px;
6969
}
70+
.tb-background-settings-panel-content {
71+
display: flex;
72+
flex-direction: column;
73+
gap: 16px;
74+
overflow: auto;
75+
margin: -10px;
76+
padding: 10px;
77+
}
7078
.tb-background-settings-panel-buttons {
7179
height: 40px;
7280
display: flex;

ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class BackgroundSettingsComponent implements OnInit, ControlValueAccessor
110110
backgroundSettings: this.modelValue
111111
};
112112
const backgroundSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer,
113-
this.viewContainerRef, BackgroundSettingsPanelComponent, 'left', true, null,
113+
this.viewContainerRef, BackgroundSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null,
114114
ctx,
115115
{},
116116
{}, {}, true);

0 commit comments

Comments
 (0)