in src/setter/array-setter/index.tsx [152:210]
render() {
const { hideDescription, extraProps = {}, itemMaxLength, columns } = this.props;
const { renderFooter } = extraProps;
const { items } = this.state;
const { scrollToLast } = this;
this.scrollToLast = false;
const lastIndex = items.length - 1;
const content =
items.length > 0 ? (
<div className="lc-setter-list-scroll-body">
<Sortable itemClassName="lc-setter-list-card" onSort={this.onSort.bind(this)}>
{items.map((field, index) => (
<ArrayItem
key={field.id}
scrollIntoView={scrollToLast && index === lastIndex}
field={field}
onRemove={this.onRemove.bind(this, field)}
/>
))}
</Sortable>
</div>
) : (
<div className="lc-setter-list-notice">
{this.props.multiValue ? (
<Message type="warning">当前选择了多个节点,且值不一致,修改会覆盖所有值</Message>
) : (
<Message type="notice" size="medium" shape="inline">
暂时还没有添加内容
</Message>
)}
</div>
);
return (
<div className="lc-setter-list lc-block-setter">
{!hideDescription && columns && items.length > 0 ? (
<div className="lc-setter-list-columns">{
columns.map((column) => (
<Title key={column.name} title={column.title || (column.name as string)} />
))
}</div>
) : null}
{content}
<div className="lc-setter-list-add">
{
!renderFooter
? (itemMaxLength && items.length >= Number(itemMaxLength)
? null
:(
<Button text type="primary" onClick={() => {
this.onAdd()
}}>
<span>添加一项 +</span>
</Button>
))
: renderFooter({...this.props, onAdd: this.onAdd.bind(this),})
}