amis-saas-7237 [Bug] dropdown-button组件在使用时传入 popOverContainer: null情况下,buttons属性内容会渲染在当前层级下

Change-Id: I1909b4e11b2b8efff0ee37221c42753d9ee15419
This commit is contained in:
jiatianqi 2022-09-23 19:16:58 +08:00
parent 90381320db
commit f543c7027e
6 changed files with 161 additions and 136 deletions

View File

@ -312,13 +312,19 @@ export class DateShortCutControl extends React.PureComponent<
</header>
{this.renderContent()}
<div className={klass + '-footer'}>
{render('inner', {
{render(
'inner',
{
type: 'dropdown-button',
label: '添加选项',
closeOnClick: true,
closeOnOutside: true,
buttons: optionList
})}
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</div>
</div>
);

View File

@ -236,12 +236,17 @@ export default class FeatureControl extends React.Component<
className: `${klass}-action`,
btnClassName: `${klass}-action--btn`,
menuClassName: `${klass}-action--menus`,
buttons: this.state.unUseFeat.map(item => {
buttons: this.state.unUseFeat.map(
item => {
return {
label: item.label,
onClick: () => this.handleAdd(item)
};
})
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)
});
}

View File

@ -624,7 +624,9 @@ export default class OptionControl extends React.Component<
clearable={false}
onChange={(value: string) => this.handleEditLabel(index, value)}
/>
{render('dropdown', {
{render(
'dropdown',
{
type: 'dropdown-button',
className: 'ae-OptionControlItem-dropdown',
btnClassName: 'px-2',
@ -634,7 +636,11 @@ export default class OptionControl extends React.Component<
align: 'right',
menuClassName: 'ae-OptionControlItem-ulmenu',
buttons: operationBtn
})}
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</div>
{editDom}
</li>

View File

@ -421,7 +421,8 @@ export default class TimelineItemControl extends React.Component<
}
)} */}
{amisRender({
{amisRender(
{
type: 'dropdown-button',
className: 'ae-TimelineItemControlItem-dropdown',
btnClassName: 'px-2',
@ -474,7 +475,11 @@ export default class TimelineItemControl extends React.Component<
onClick: () => this.toggleDelete(index)
}
]
})}
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</div>
<div className="ae-TimelineItemControlItem-Main">
<InputBox

View File

@ -8,15 +8,7 @@ import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import set from 'lodash/set';
import Sortable from 'sortablejs';
import {
render as amisRender,
FormItem,
Button,
Icon,
InputBox,
Modal,
toast
} from 'amis';
import {FormItem, Button, Icon, InputBox, Modal, toast} from 'amis';
import {autobind} from 'amis-editor-core';
import {getSchemaTpl, tipedLabel} from 'amis-editor-core';
@ -355,8 +347,9 @@ export default class TreeOptionControl extends React.Component<
}}
/>
<div className="ae-TreeOptionControlItem-btns">
{amisRender({
// {render('dropdown', { 这里 通过 renderChid 方法渲染出来的 dropdown-button 有 bug FIXME: jiatianqi
{render(
'dropdown',
{
type: 'dropdown-button',
className: 'ae-TreeOptionControlItem-dropdown fa-sm',
btnClassName: 'px-2',
@ -384,7 +377,11 @@ export default class TreeOptionControl extends React.Component<
}
}
]
})}
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
<Button
size="sm"
onClick={() => {

View File

@ -651,7 +651,9 @@ export class EventControl extends React.Component<
'no-bd-btm': !eventKeys.length
})}
>
{render('dropdown', {
{render(
'dropdown',
{
type: 'dropdown-button',
level: 'enhance',
label: '添加事件',
@ -671,7 +673,11 @@ export class EventControl extends React.Component<
Object.keys(onEvent).includes(item.eventName)
)
}))
})}
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</header>
<ul
className={cx({