Skip to content

Commit 2bd1e77

Browse files
authored
[MOO-2018]: fix the visibility of lable position option for mx11.6 (#463)
2 parents 7ab2b6c + 15a9da1 commit 2bd1e77

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/pluggableWidgets/switch-native/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- Added the ability to change the position of the label in horizontal view from the left side of the switch to the right side.
12+
13+
### Fixed
14+
15+
- We fixed an issue where the validation message was rendered inside the view container of the switch, which caused incorrect styling of the switch.
16+
- Fixed an issue where
17+
918
## [1.1.0] - 2024-12-3
1019

1120
### Changed

packages/pluggableWidgets/switch-native/src/Switch.editorConfig.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str
2424
document: decodeURIComponent(
2525
(isDarkMode ? StructurePreviewSwitchDarkSVG : StructurePreviewSwitchSVG).replace("data:image/svg+xml,", "")
2626
),
27-
width: 80,
27+
width: 51,
2828
height: 30,
2929
grow: 8
3030
};
31-
const children = values.showLabel ? [label, image] : [image];
32-
31+
const children = values.showLabel ? (values.labelPosition === "right" ? [image, label] : [label, image]) : [image];
3332
return values.labelOrientation === "horizontal"
3433
? {
3534
type: "RowLayout",
@@ -48,7 +47,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str
4847

4948
export function getProperties(values: SwitchPreviewProps, defaultProperties: Properties): Properties {
5049
if (!values.showLabel) {
51-
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation"]);
50+
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation", "labelPosition"]);
51+
}
52+
53+
if (values.showLabel && values.labelOrientation !== "horizontal") {
54+
hidePropertiesIn(defaultProperties, values, ["labelPosition"]);
5255
}
5356

5457
return defaultProperties;

0 commit comments

Comments
 (0)