mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
list 模式支持按钮在左侧 & 修复 multiple 透传问题 (#1543)
* list 模式支持按钮在左侧 & 修复 multiple 透传问题 * 补充属性表
This commit is contained in:
parent
a6cdb9d33d
commit
9ffe9a237c
@ -95,3 +95,4 @@ order: 56
|
|||||||
| listItem.desc | [模板](../../docs/concepts/template) | | 描述 |
|
| listItem.desc | [模板](../../docs/concepts/template) | | 描述 |
|
||||||
| listItem.body | `Array` | | 内容容器,主要用来放置非表单项组件 |
|
| listItem.body | `Array` | | 内容容器,主要用来放置非表单项组件 |
|
||||||
| listItem.actions | Array<[Action](./action)> | | 按钮区域 |
|
| listItem.actions | Array<[Action](./action)> | | 按钮区域 |
|
||||||
|
| listItem.actionsPosition | 'left' or 'right' | 默认在右侧 | 按钮位置 |
|
||||||
|
@ -165,6 +165,11 @@
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--actions-at-left &-actions {
|
||||||
|
float: left;
|
||||||
|
margin-right: var(--gap-base);
|
||||||
|
}
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -173,7 +173,6 @@ export class Card extends React.Component<CardProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static propsList: Array<string> = [
|
static propsList: Array<string> = [
|
||||||
'multiple',
|
|
||||||
'avatarClassName',
|
'avatarClassName',
|
||||||
'bodyClassName',
|
'bodyClassName',
|
||||||
'actionsCount',
|
'actionsCount',
|
||||||
@ -553,7 +552,9 @@ export class Card extends React.Component<CardProps> {
|
|||||||
test: /(^|\/)card$/,
|
test: /(^|\/)card$/,
|
||||||
name: 'card'
|
name: 'card'
|
||||||
})
|
})
|
||||||
export class CardRenderer extends Card {}
|
export class CardRenderer extends Card {
|
||||||
|
static propsList = ['multiple', ...Card.propsList];
|
||||||
|
}
|
||||||
|
|
||||||
@Renderer({
|
@Renderer({
|
||||||
test: /(^|\/)card-item-field$/,
|
test: /(^|\/)card-item-field$/,
|
||||||
|
@ -76,6 +76,11 @@ export type ListBodyField = SchemaObject & ListBodyFieldObject;
|
|||||||
export interface ListItemSchema extends Omit<BaseSchema, 'type'> {
|
export interface ListItemSchema extends Omit<BaseSchema, 'type'> {
|
||||||
actions?: Array<ActionSchema>;
|
actions?: Array<ActionSchema>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作位置,默认在右侧,可以设置成左侧。
|
||||||
|
*/
|
||||||
|
actionsPosition?: 'left' | 'right';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片地址
|
* 图片地址
|
||||||
*/
|
*/
|
||||||
@ -1240,7 +1245,8 @@ export class ListItem extends React.Component<ListItemProps> {
|
|||||||
checkOnItemClick,
|
checkOnItemClick,
|
||||||
render,
|
render,
|
||||||
checkable,
|
checkable,
|
||||||
classnames: cx
|
classnames: cx,
|
||||||
|
actionsPosition
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const avatar = filter(avatarTpl, data);
|
const avatar = filter(avatarTpl, data);
|
||||||
@ -1251,7 +1257,10 @@ export class ListItem extends React.Component<ListItemProps> {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={checkOnItemClick && checkable ? this.handleClick : undefined}
|
onClick={checkOnItemClick && checkable ? this.handleClick : undefined}
|
||||||
className={cx('ListItem', className)}
|
className={cx(
|
||||||
|
`ListItem ListItem--actions-at-${actionsPosition || 'right'}`,
|
||||||
|
className
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{this.renderLeft()}
|
{this.renderLeft()}
|
||||||
{this.renderRight()}
|
{this.renderRight()}
|
||||||
@ -1281,7 +1290,9 @@ export class ListItem extends React.Component<ListItemProps> {
|
|||||||
test: /(^|\/)(?:list|list-group)\/(?:.*\/)?list-item$/,
|
test: /(^|\/)(?:list|list-group)\/(?:.*\/)?list-item$/,
|
||||||
name: 'list-item'
|
name: 'list-item'
|
||||||
})
|
})
|
||||||
export class ListItemRenderer extends ListItem {}
|
export class ListItemRenderer extends ListItem {
|
||||||
|
static propsList = ['multiple', ...ListItem.propsList];
|
||||||
|
}
|
||||||
|
|
||||||
@Renderer({
|
@Renderer({
|
||||||
test: /(^|\/)list-item-field$/,
|
test: /(^|\/)list-item-field$/,
|
||||||
|
Loading…
Reference in New Issue
Block a user