Skip to content

Commit

Permalink
feat(next): add stopPropagation to array-base events
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed May 25, 2021
1 parent 6f20272 commit 276a5fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/next/src/array-base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ ArrayBase.Addition = (props) => {
className={cls(`${prefixCls}-addition`, props.className)}
style={{ display: 'block', width: '100%', ...props.style }}
onClick={(e) => {
e.stopPropagation()
const defaultValue = getDefaultValue(props.defaultValue, array.schema)
if (props.method === 'unshift') {
array?.field?.unshift?.(defaultValue)
Expand Down Expand Up @@ -160,6 +161,7 @@ ArrayBase.Remove = React.forwardRef((props, ref) => {
className={cls(`${prefixCls}-remove`, props.className)}
ref={ref}
onClick={(e) => {
e.stopPropagation()
base?.field?.remove?.(index)
base?.props?.onRemove?.(index)
if (props.onClick) {
Expand All @@ -180,6 +182,7 @@ ArrayBase.MoveDown = React.forwardRef((props, ref) => {
className={cls(`${prefixCls}-move-down`, props.className)}
ref={ref}
onClick={(e) => {
e.stopPropagation()
base?.field?.moveDown?.(index)
base?.props?.onMoveDown?.(index)
if (props.onClick) {
Expand All @@ -200,6 +203,7 @@ ArrayBase.MoveUp = React.forwardRef((props, ref) => {
className={cls(`${prefixCls}-move-up`, props.className)}
ref={ref}
onClick={(e) => {
e.stopPropagation()
base?.field?.moveUp?.(index)
base?.props?.onMoveUp?.(index)
if (props.onClick) {
Expand Down

0 comments on commit 276a5fb

Please sign in to comment.