Skip to content

Commit

Permalink
Merge b127cdf into b8cada3
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed May 17, 2023
2 parents b8cada3 + b127cdf commit 03708b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/components/config/src/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export const defaultConfig: GlobalConfig = {
},
},
modal: {
animatable: true,
centered: false,
closable: true,
closeIcon: 'dialog-close',
Expand Down
1 change: 1 addition & 0 deletions packages/components/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export interface MessageConfig {
}

export interface ModalConfig {
animatable: boolean
centered: boolean
closable: boolean
closeIcon: string
Expand Down
10 changes: 7 additions & 3 deletions packages/components/modal/src/ModalWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export default defineComponent({
currentZIndex,
} = inject(modalToken)!
const { close, cancel, ok } = inject(MODAL_TOKEN)!
const { centered, closable, closeIcon, closeOnEsc, width, mask, maskClosable } = useConfig(props, config)
const { animatable, centered, closable, closeIcon, closeOnEsc, width, mask, maskClosable } = useConfig(
props,
config,
)

const cancelVisible = computed(() => props.type === 'default' || props.type === 'confirm')

Expand Down Expand Up @@ -156,7 +159,7 @@ export default defineComponent({
onKeydown={onWrapperKeydown}
>
<Transition
name={props.animatable ? `${common.prefixCls}-zoom` : undefined}
name={animatable.value ? `${common.prefixCls}-zoom` : undefined}
appear
onEnter={onEnter}
onAfterEnter={onAfterEnter}
Expand Down Expand Up @@ -209,6 +212,7 @@ export default defineComponent({
})

function useConfig(props: ModalProps, config: ModalConfig) {
const animatable = computed(() => props.animatable ?? config.animatable)
const centered = computed(() => props.centered ?? config.centered)
const closable = computed(() => props.closable ?? config.closable)
const closeIcon = computed(() => props.closeIcon ?? config.closeIcon)
Expand All @@ -224,7 +228,7 @@ function useConfig(props: ModalProps, config: ModalConfig) {
}
})

return { centered, closable, closeIcon, closeOnEsc, width, mask, maskClosable }
return { animatable, centered, closable, closeIcon, closeOnEsc, width, mask, maskClosable }
}

function watchVisibleChange(
Expand Down
2 changes: 1 addition & 1 deletion packages/components/modal/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const modalProps = {
},
animatable: {
type: Boolean,
default: true,
default: undefined,
},
offset: {
type: [String, Number] as PropType<string | number>,
Expand Down

0 comments on commit 03708b9

Please sign in to comment.