Skip to content

Commit 28e3132

Browse files
committed
fix: boolean selector
1 parent f435aea commit 28e3132

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@
2828
<enumerationValue key="boolean">Boolean</enumerationValue>
2929
</enumerationValues>
3030
</property>
31-
<property key="controlType" type="enumeration" defaultValue="checkbox" required="true">
32-
<caption>Component</caption>
33-
<description />
34-
<enumerationValues>
35-
<enumerationValue key="checkbox">Checkbox</enumerationValue>
36-
<enumerationValue key="radio">Radio button</enumerationValue>
37-
</enumerationValues>
38-
</property>
3931

4032
<!-- ENUM & BOOLEAN-->
4133
<property key="attributeEnumeration" type="attribute" required="true" setLabel="true">
@@ -214,6 +206,14 @@
214206
<caption>Custom content</caption>
215207
<description />
216208
</property>
209+
<property key="controlType" type="enumeration" defaultValue="checkbox" required="true">
210+
<caption>Render type</caption>
211+
<description />
212+
<enumerationValues>
213+
<enumerationValue key="checkbox">Checkbox</enumerationValue>
214+
<enumerationValue key="radio">Radio button</enumerationValue>
215+
</enumerationValues>
216+
</property>
217217
<!-- END MISC PROPS -->
218218
</propertyGroup>
219219
<!-- END GENERAL -->

packages/pluggableWidgets/checkbox-radio-selection-web/src/helpers/EnumBool/EnumBooleanSingleSelector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class EnumBooleanSingleSelector implements SingleSelector {
5959
this.currentId = attr.value?.toString() ?? null;
6060
this.readOnly = attr.readOnly;
6161
this.validation = attr.validation;
62-
this.controlType = props.controlType;
62+
this.controlType = this.isBoolean ? props.controlType : "radio";
6363
}
6464

6565
setValue(value: string | null): void {

packages/pluggableWidgets/checkbox-radio-selection-web/typings/CheckboxRadioSelectionProps.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export type SourceEnum = "context" | "database" | "static";
1111

1212
export type OptionsSourceTypeEnum = "association" | "enumeration" | "boolean";
1313

14-
export type ControlTypeEnum = "checkbox" | "radio";
15-
1614
export type OptionsSourceAssociationCaptionTypeEnum = "attribute" | "expression";
1715

1816
export type OptionsSourceDatabaseCaptionTypeEnum = "attribute" | "expression";
@@ -25,6 +23,8 @@ export interface OptionsSourceStaticDataSourceType {
2523

2624
export type OptionsSourceCustomContentTypeEnum = "yes" | "no";
2725

26+
export type ControlTypeEnum = "checkbox" | "radio";
27+
2828
export type CustomEditabilityEnum = "default" | "never" | "conditionally";
2929

3030
export type ReadOnlyStyleEnum = "bordered" | "text";
@@ -41,7 +41,6 @@ export interface CheckboxRadioSelectionContainerProps {
4141
id: string;
4242
source: SourceEnum;
4343
optionsSourceType: OptionsSourceTypeEnum;
44-
controlType: ControlTypeEnum;
4544
attributeEnumeration: EditableValue<string>;
4645
attributeBoolean: EditableValue<boolean>;
4746
optionsSourceDatabaseDataSource?: ListValue;
@@ -62,6 +61,7 @@ export interface CheckboxRadioSelectionContainerProps {
6261
optionsSourceCustomContentType: OptionsSourceCustomContentTypeEnum;
6362
optionsSourceAssociationCustomContent?: ListWidgetValue;
6463
optionsSourceDatabaseCustomContent?: ListWidgetValue;
64+
controlType: ControlTypeEnum;
6565
customEditability: CustomEditabilityEnum;
6666
customEditabilityExpression: DynamicValue<boolean>;
6767
readOnlyStyle: ReadOnlyStyleEnum;
@@ -76,7 +76,6 @@ export interface CheckboxRadioSelectionPreviewProps {
7676
translate: (text: string) => string;
7777
source: SourceEnum;
7878
optionsSourceType: OptionsSourceTypeEnum;
79-
controlType: ControlTypeEnum;
8079
attributeEnumeration: string;
8180
attributeBoolean: string;
8281
optionsSourceDatabaseDataSource: {} | { caption: string } | { type: string } | null;
@@ -97,6 +96,7 @@ export interface CheckboxRadioSelectionPreviewProps {
9796
optionsSourceCustomContentType: OptionsSourceCustomContentTypeEnum;
9897
optionsSourceAssociationCustomContent: { widgetCount: number; renderer: ComponentType<{ children: ReactNode; caption?: string }> };
9998
optionsSourceDatabaseCustomContent: { widgetCount: number; renderer: ComponentType<{ children: ReactNode; caption?: string }> };
99+
controlType: ControlTypeEnum;
100100
customEditability: CustomEditabilityEnum;
101101
customEditabilityExpression: string;
102102
readOnlyStyle: ReadOnlyStyleEnum;

0 commit comments

Comments
 (0)