fix(table-action): stopButtonPropagation not working

修复TableAction组件的stopButtonPropagation属性无效的问题
This commit is contained in:
无木 2021-07-24 13:27:10 +08:00
parent e1c47233ed
commit 9b8f165a36
2 changed files with 6 additions and 4 deletions

View File

@ -3,6 +3,7 @@
- **ApiTreeSelect** 修复未能正确监听`params`变化的问题 - **ApiTreeSelect** 修复未能正确监听`params`变化的问题
- **BasicTable** 修复可编辑单元格不支持`ellipsis`配置的问题 - **BasicTable** 修复可编辑单元格不支持`ellipsis`配置的问题
- **ImgRotateDragVerify** 修复组件`resume`方法无法调用的问题 - **ImgRotateDragVerify** 修复组件`resume`方法无法调用的问题
- **TableAction** 修复 stopButtonPropagation 属性某些情况下不起作用的问题
- **Dark Theme** 黑暗主题下的配色问题修正 - **Dark Theme** 黑暗主题下的配色问题修正
- 修复`Tree`组件被选中节点的背景颜色 - 修复`Tree`组件被选中节点的背景颜色
- 修复`Alert`组件的颜色配置 - 修复`Alert`组件的颜色配置

View File

@ -140,10 +140,11 @@
function onCellClick(e: MouseEvent) { function onCellClick(e: MouseEvent) {
if (!props.stopButtonPropagation) return; if (!props.stopButtonPropagation) return;
const target = e.target as HTMLElement; const path = e.composedPath() as HTMLElement[];
if (target.tagName === 'BUTTON') { const isInButton = path.find((ele) => {
e.stopPropagation(); return ele.tagName?.toUpperCase() === 'BUTTON';
} });
isInButton && e.stopPropagation();
} }
return { prefixCls, getActions, getDropdownList, getAlign, onCellClick, getTooltip }; return { prefixCls, getActions, getDropdownList, getAlign, onCellClick, getTooltip };