mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +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"
|
role="page-body"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card"
|
class="cxd-Card cxd-Card--link"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card-multiMedia--left"
|
class="cxd-Card-multiMedia--left"
|
||||||
@ -506,7 +506,7 @@ exports[`Renderer:cards hightlight 2`] = `
|
|||||||
role="page-body"
|
role="page-body"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card"
|
class="cxd-Card cxd-Card--link"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card-multiMedia--left"
|
class="cxd-Card-multiMedia--left"
|
||||||
@ -636,7 +636,7 @@ exports[`Renderer:cards media 1`] = `
|
|||||||
role="page-body"
|
role="page-body"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card"
|
class="cxd-Card cxd-Card--link"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="cxd-Card-multiMedia--left"
|
class="cxd-Card-multiMedia--left"
|
||||||
|
@ -326,12 +326,6 @@ export class CardRenderer extends React.Component<CardProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleCheck() {
|
handleCheck() {
|
||||||
// 因为如果 checkOnItemClick 开启
|
|
||||||
// 会把状态标记为选中,如果这里继续执行则又会改回来
|
|
||||||
if (this.props.checkOnItemClick) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const item = this.props.item;
|
const item = this.props.item;
|
||||||
this.props.onCheck && this.props.onCheck(item);
|
this.props.onCheck && this.props.onCheck(item);
|
||||||
}
|
}
|
||||||
@ -767,7 +761,7 @@ export class CardRenderer extends React.Component<CardProps> {
|
|||||||
footerClassName={footerClassName}
|
footerClassName={footerClassName}
|
||||||
secondaryClassName={secondaryClassName}
|
secondaryClassName={secondaryClassName}
|
||||||
bodyClassName={bodyClassName}
|
bodyClassName={bodyClassName}
|
||||||
onClick={this.isHaveLink() ? this.handleClick : undefined}
|
onClick={this.isHaveLink() ? this.handleClick : this.handleCheck}
|
||||||
></Card>
|
></Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ export default class PickerControl extends React.PureComponent<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeItem(index: number) {
|
async removeItem(index: number) {
|
||||||
const {
|
const {
|
||||||
selectedOptions,
|
selectedOptions,
|
||||||
joinValues,
|
joinValues,
|
||||||
@ -328,10 +328,11 @@ export default class PickerControl extends React.PureComponent<
|
|||||||
delimiter,
|
delimiter,
|
||||||
valueField,
|
valueField,
|
||||||
onChange,
|
onChange,
|
||||||
multiple
|
multiple,
|
||||||
|
dispatchEvent
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const items = selectedOptions.concat();
|
const items = selectedOptions.concat();
|
||||||
items.splice(index, 1);
|
const [option] = items.splice(index, 1);
|
||||||
|
|
||||||
let value: any = items;
|
let value: any = items;
|
||||||
|
|
||||||
@ -347,6 +348,14 @@ export default class PickerControl extends React.PureComponent<
|
|||||||
value = multiple ? items : items[0];
|
value = multiple ? items : items[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rendererEvent = await dispatchEvent(
|
||||||
|
'change',
|
||||||
|
resolveEventData(this.props, {value, option, selectedItems: option})
|
||||||
|
);
|
||||||
|
if (rendererEvent?.prevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
onChange(value);
|
onChange(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,7 +1194,7 @@ export class ListItem extends React.Component<ListItemProps> {
|
|||||||
type={multiple !== false ? 'checkbox' : 'radio'}
|
type={multiple !== false ? 'checkbox' : 'radio'}
|
||||||
disabled={!checkable}
|
disabled={!checkable}
|
||||||
checked={selected}
|
checked={selected}
|
||||||
onChange={checkOnItemClick ? noop : this.handleCheck}
|
onChange={this.handleCheck}
|
||||||
inline
|
inline
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user