mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
* chore: tpl 初始用同步模版渲染后更新异步模版 Close: #7099 * chore: 补充 picker 值右侧删除按钮不触发 change 事件问题 Close: #7084
This commit is contained in:
parent
3181488c92
commit
a3802d8327
@ -376,7 +376,7 @@ exports[`Renderer:cards hightlight 1`] = `
|
||||
role="page-body"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card"
|
||||
class="cxd-Card cxd-Card--link"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card-multiMedia--left"
|
||||
@ -506,7 +506,7 @@ exports[`Renderer:cards hightlight 2`] = `
|
||||
role="page-body"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card"
|
||||
class="cxd-Card cxd-Card--link"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card-multiMedia--left"
|
||||
@ -636,7 +636,7 @@ exports[`Renderer:cards media 1`] = `
|
||||
role="page-body"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card"
|
||||
class="cxd-Card cxd-Card--link"
|
||||
>
|
||||
<div
|
||||
class="cxd-Card-multiMedia--left"
|
||||
|
@ -326,12 +326,6 @@ export class CardRenderer extends React.Component<CardProps> {
|
||||
}
|
||||
|
||||
handleCheck() {
|
||||
// 因为如果 checkOnItemClick 开启
|
||||
// 会把状态标记为选中,如果这里继续执行则又会改回来
|
||||
if (this.props.checkOnItemClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
const item = this.props.item;
|
||||
this.props.onCheck && this.props.onCheck(item);
|
||||
}
|
||||
@ -767,7 +761,7 @@ export class CardRenderer extends React.Component<CardProps> {
|
||||
footerClassName={footerClassName}
|
||||
secondaryClassName={secondaryClassName}
|
||||
bodyClassName={bodyClassName}
|
||||
onClick={this.isHaveLink() ? this.handleClick : undefined}
|
||||
onClick={this.isHaveLink() ? this.handleClick : this.handleCheck}
|
||||
></Card>
|
||||
);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ export default class PickerControl extends React.PureComponent<
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(index: number) {
|
||||
async removeItem(index: number) {
|
||||
const {
|
||||
selectedOptions,
|
||||
joinValues,
|
||||
@ -328,10 +328,11 @@ export default class PickerControl extends React.PureComponent<
|
||||
delimiter,
|
||||
valueField,
|
||||
onChange,
|
||||
multiple
|
||||
multiple,
|
||||
dispatchEvent
|
||||
} = this.props;
|
||||
const items = selectedOptions.concat();
|
||||
items.splice(index, 1);
|
||||
const [option] = items.splice(index, 1);
|
||||
|
||||
let value: any = items;
|
||||
|
||||
@ -347,6 +348,14 @@ export default class PickerControl extends React.PureComponent<
|
||||
value = multiple ? items : items[0];
|
||||
}
|
||||
|
||||
const rendererEvent = await dispatchEvent(
|
||||
'change',
|
||||
resolveEventData(this.props, {value, option, selectedItems: option})
|
||||
);
|
||||
if (rendererEvent?.prevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange(value);
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ export class ListItem extends React.Component<ListItemProps> {
|
||||
type={multiple !== false ? 'checkbox' : 'radio'}
|
||||
disabled={!checkable}
|
||||
checked={selected}
|
||||
onChange={checkOnItemClick ? noop : this.handleCheck}
|
||||
onChange={this.handleCheck}
|
||||
inline
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user