UI: Cards widget set default padding value is empty

This commit is contained in:
Vladyslav_Prykhodko 2024-09-10 15:36:32 +03:00
parent fb1d993290
commit 1a9b555bf1
6 changed files with 9 additions and 9 deletions

View File

@ -132,5 +132,5 @@ export const valueCardDefaultSettings = (horizontal: boolean): ValueCardWidgetSe
blur: 3 blur: 3
} }
}, },
padding: '24px' padding: ''
}); });

View File

@ -202,5 +202,5 @@ export const statusWidgetDefaultSettings: StatusWidgetSettings = {
} }
} }
}, },
padding: '16px' padding: ''
}; };

View File

@ -47,6 +47,8 @@ import { ValueType } from '@shared/models/constants';
import { UtilsService } from '@core/services/utils.service'; import { UtilsService } from '@core/services/utils.service';
const initialSwitchHeight = 60; const initialSwitchHeight = 60;
const horizontalLayoutPadding = 48;
const verticalLayoutPadding = 36;
@Component({ @Component({
selector: 'tb-single-switch-widget', selector: 'tb-single-switch-widget',
@ -239,8 +241,8 @@ export class SingleSwitchWidgetComponent extends
const computedStyle = getComputedStyle(this.singleSwitchPanel.nativeElement); const computedStyle = getComputedStyle(this.singleSwitchPanel.nativeElement);
const [pLeft, pRight, pTop, pBottom] = ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'] const [pLeft, pRight, pTop, pBottom] = ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom']
.map(side => resolveCssSize(computedStyle[side])[0]); .map(side => resolveCssSize(computedStyle[side])[0]);
const panelWidth = widgetBoundingClientRect.width - (pLeft + pRight); const panelWidth = widgetBoundingClientRect.width - ((pLeft + pRight) || horizontalLayoutPadding * paddingScale);
const panelHeight = widgetBoundingClientRect.height - (pTop + pBottom); const panelHeight = widgetBoundingClientRect.height - ((pTop + pBottom) || verticalLayoutPadding * paddingScale);
this.renderer.setStyle(this.singleSwitchContent.nativeElement, 'transform', `scale(1)`); this.renderer.setStyle(this.singleSwitchContent.nativeElement, 'transform', `scale(1)`);
this.renderer.setStyle(this.singleSwitchContent.nativeElement, 'width', 'auto'); this.renderer.setStyle(this.singleSwitchContent.nativeElement, 'width', 'auto');
let contentWidth = this.singleSwitchToggleRow.nativeElement.getBoundingClientRect().width; let contentWidth = this.singleSwitchToggleRow.nativeElement.getBoundingClientRect().width;

View File

@ -219,5 +219,5 @@ export const singleSwitchDefaultSettings: SingleSwitchWidgetSettings = {
blur: 3 blur: 3
} }
}, },
padding: '18px 24px' padding: ''
}; };

View File

@ -42,7 +42,6 @@ import {
getSingleTsValueByDataKey, getSingleTsValueByDataKey,
overlayStyle overlayStyle
} from '@shared/models/widget-settings.models'; } from '@shared/models/widget-settings.models';
import { WidgetComponent } from '@home/components/widget/widget.component';
import { formatValue, isDefinedAndNotNull, isNumeric } from '@core/utils'; import { formatValue, isDefinedAndNotNull, isNumeric } from '@core/utils';
import { ResizeObserver } from '@juggle/resize-observer'; import { ResizeObserver } from '@juggle/resize-observer';
import { Path, Svg, SVG, Text } from '@svgdotjs/svg.js'; import { Path, Svg, SVG, Text } from '@svgdotjs/svg.js';
@ -112,8 +111,7 @@ export class WindSpeedDirectionWidgetComponent implements OnInit, OnDestroy, Aft
private windDirection = 0; private windDirection = 0;
private centerValueText = 'N/A'; private centerValueText = 'N/A';
constructor(private widgetComponent: WidgetComponent, constructor(private imagePipe: ImagePipe,
private imagePipe: ImagePipe,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private renderer: Renderer2, private renderer: Renderer2,
private cd: ChangeDetectorRef) { private cd: ChangeDetectorRef) {

View File

@ -102,5 +102,5 @@ export const windSpeedDirectionDefaultSettings: WindSpeedDirectionWidgetSettings
blur: 3 blur: 3
} }
}, },
padding: '20px 24px 24px' padding: ''
}; };