mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-02-17 17:40:31 +08:00
feat(arco): enable to customize button content of Dropdown component
This commit is contained in:
parent
d2daf17b13
commit
7dc33f0478
@ -15,6 +15,7 @@ const DropdownStateSpec = Type.Object({
|
||||
});
|
||||
|
||||
const exampleProperties: Static<typeof DropdownPropsSpec> = {
|
||||
text: 'Click',
|
||||
dropdownType: 'default',
|
||||
trigger: 'click',
|
||||
position: 'bl',
|
||||
@ -51,7 +52,7 @@ export const Dropdown = implementRuntimeComponent({
|
||||
events: ['onClickMenuItem', 'onVisibleChange', 'onButtonClick'],
|
||||
},
|
||||
})(props => {
|
||||
const { elementRef, slotsElements, callbackMap, mergeState } = props;
|
||||
const { text, elementRef, slotsElements, callbackMap, mergeState } = props;
|
||||
const cProps = getComponentProps(props);
|
||||
const { list, dropdownType, autoAlignPopupWidth, ...restProps } = cProps;
|
||||
const typeMap = {
|
||||
@ -90,7 +91,11 @@ export const Dropdown = implementRuntimeComponent({
|
||||
triggerProps={{ autoAlignPopupMinWidth: autoAlignPopupWidth }}
|
||||
>
|
||||
<div ref={elementRef}>
|
||||
{slotsElements.trigger ? slotsElements.trigger({}) : <Button>Click</Button>}
|
||||
{slotsElements.trigger ? (
|
||||
slotsElements.trigger({})
|
||||
) : (
|
||||
<Button>{text || null}</Button>
|
||||
)}
|
||||
</div>
|
||||
</Dropdown>
|
||||
);
|
||||
|
@ -7,6 +7,10 @@ export const DropdownPropsSpec = {
|
||||
title: 'Type',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
text: Type.String({
|
||||
title: 'Text',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
position: StringUnion(['top', 'tl', 'tr', 'bottom', 'bl', 'br'], {
|
||||
title: 'Position',
|
||||
category: Category.Layout,
|
||||
@ -23,13 +27,13 @@ export const DropdownPropsSpec = {
|
||||
title: 'Default Visible',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
autoAlignPopupWidth:Type.Boolean({
|
||||
title:'Auto Align Popup Width',
|
||||
autoAlignPopupWidth: Type.Boolean({
|
||||
title: 'Auto Align Popup Width',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
unmountOnExit:Type.Boolean({
|
||||
title:'Destroy On Hide',
|
||||
category: Category.Behavior
|
||||
unmountOnExit: Type.Boolean({
|
||||
title: 'Destroy On Hide',
|
||||
category: Category.Behavior,
|
||||
}),
|
||||
list: Type.Array(
|
||||
Type.Object({
|
||||
@ -43,7 +47,7 @@ export const DropdownPropsSpec = {
|
||||
{
|
||||
title: 'List',
|
||||
category: Category.Basic,
|
||||
widget:'core/v1/expression',
|
||||
widget: 'core/v1/expression',
|
||||
weight: 10,
|
||||
}
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user