@@ -22,18 +22,18 @@ import {
2222 getButtonStyle ,
2323} from "./buttonCompConstants" ;
2424import { styleControl } from "@lowcoder-ee/comps/controls/styleControl" ;
25+ import { dropdownControl } from "@lowcoder-ee/comps/controls/dropdownControl" ;
2526
2627const StyledDropdownButton = styled ( DropdownButton ) `
2728 width: 100%;
2829
2930 .ant-btn-group {
3031 width: 100%;
31-
3232 }
3333` ;
3434
3535const LeftButtonWrapper = styled . div < { $buttonStyle : DropdownStyleType } > `
36- width: calc(100%) ;
36+ flex: 1 ;
3737 ${ ( props ) => `margin: ${ props . $buttonStyle . margin } ;` }
3838 margin-right: 0;
3939 .ant-btn span {
@@ -42,12 +42,11 @@ const LeftButtonWrapper = styled.div<{ $buttonStyle: DropdownStyleType }>`
4242 }
4343
4444 .ant-btn {
45- ${ ( props ) => getButtonStyle ( props . $buttonStyle ) }
45+ ${ ( props ) => getButtonStyle ( props . $buttonStyle as any ) }
4646 margin: 0 !important;
4747 height: 100%;
4848 &.ant-btn-default {
4949 margin: 0 !important;
50-
5150 ${ ( props ) => `border-radius: ${ props . $buttonStyle . radius } 0 0 ${ props . $buttonStyle . radius } ;` }
5251 ${ ( props ) => `text-transform: ${ props . $buttonStyle . textTransform } ;` }
5352 ${ ( props ) => `font-weight: ${ props . $buttonStyle . textWeight } ;` }
@@ -65,11 +64,11 @@ const LeftButtonWrapper = styled.div<{ $buttonStyle: DropdownStyleType }>`
6564` ;
6665
6766const RightButtonWrapper = styled . div < { $buttonStyle : DropdownStyleType } > `
68- // width: 32px;
67+ width: 32px;
6968 ${ ( props ) => `margin: ${ props . $buttonStyle . margin } ;` }
7069 margin-left: -1px;
7170 .ant-btn {
72- ${ ( props ) => getButtonStyle ( props . $buttonStyle ) }
71+ ${ ( props ) => getButtonStyle ( props . $buttonStyle as any ) }
7372 margin: 0 !important;
7473 height: 100%;
7574 &.ant-btn-default {
@@ -80,10 +79,16 @@ const RightButtonWrapper = styled.div<{ $buttonStyle: DropdownStyleType }>`
8079 }
8180` ;
8281
82+ const triggerOptions = [
83+ { label : "Hover" , value : "hover" } ,
84+ { label : "Click" , value : "click" } ,
85+ ] as const ;
86+
8387const DropdownTmpComp = ( function ( ) {
8488 const childrenMap = {
8589 text : withDefault ( StringControl , trans ( "menu" ) ) ,
8690 onlyMenu : BoolControl ,
91+ triggerMode : dropdownControl ( triggerOptions , "hover" ) ,
8792 options : DropdownOptionControl ,
8893 disabled : BoolCodeControl ,
8994 onEvent : ButtonEventHandlerControl ,
@@ -121,15 +126,17 @@ const DropdownTmpComp = (function () {
121126 < Dropdown
122127 disabled = { props . disabled }
123128 dropdownRender = { ( ) => menu }
129+ trigger = { [ props . triggerMode ] }
124130 >
125- < Button100 $buttonStyle = { props . style } disabled = { props . disabled } >
131+ < Button100 $buttonStyle = { props . style as any } disabled = { props . disabled } >
126132 { props . text || " " /* Avoid button disappearing */ }
127133 </ Button100 >
128134 </ Dropdown >
129135 ) : (
130136 < StyledDropdownButton
131137 disabled = { props . disabled }
132138 dropdownRender = { ( ) => menu }
139+ trigger = { [ props . triggerMode ] }
133140 onClick = { ( ) => props . onEvent ( "click" ) }
134141 buttonsRender = { ( [ left , right ] ) => [
135142 < LeftButtonWrapper $buttonStyle = { props . style } >
@@ -170,6 +177,10 @@ const DropdownTmpComp = (function () {
170177 < >
171178 < Section name = { sectionNames . layout } >
172179 { children . text . propertyView ( { label : trans ( "label" ) } ) }
180+ { children . triggerMode . propertyView ( {
181+ label : trans ( "dropdown.triggerMode" ) ,
182+ radioButton : true ,
183+ } ) }
173184 { children . onlyMenu . propertyView ( { label : trans ( "dropdown.onlyMenu" ) } ) }
174185 </ Section >
175186 < Section name = { sectionNames . style } > { children . style . getPropertyView ( ) } </ Section >
0 commit comments