Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dialog-box): [dialog-box] destoryOnClose transition #2074

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions packages/renderless/src/dialog-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ export const watchVisible =
emit('close')
}

if (props.destroyOnClose) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段逻辑删除,可能会影响destroyOnClose属性的功能

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我重新开一个PR吧,这个PR有些太久远了

nextTick(() => state.key++)
}

if (props.rightSlide) {
const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el
dialogBoxDom.style.left = ''
Expand Down Expand Up @@ -245,9 +241,15 @@ export const afterEnter = (emit: IDialogBoxRenderlessParams['emit']) => (): void
emit('opened')
}

export const afterLeave = (emit: IDialogBoxRenderlessParams['emit']) => (): void => {
emit('closed')
}
export const afterLeave =
(
emit: IDialogBoxRenderlessParams['emit'],
state: IDialogBoxRenderlessParams['state'],
props: IDialogBoxRenderlessParams['props']
GaoNeng-wWw marked this conversation as resolved.
Show resolved Hide resolved
) =>
(): void => {
emit('closed')
}

const findPopoverComponent = ({
vm,
Expand Down
2 changes: 1 addition & 1 deletion packages/renderless/src/dialog-box/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const initApi = ({
unMounted: unMounted({ api, parent, props }),
computedAnimationName: computedAnimationName({ constants, props }),
afterEnter: afterEnter(emit),
afterLeave: afterLeave(emit),
afterLeave: afterLeave(emit, state, props),
hideScrollbar: hideScrollbar(lockScrollClass),
showScrollbar: showScrollbar(lockScrollClass),
handleDrag: handleDrag({ parent, props, state, emit, vm }),
Expand Down
40 changes: 23 additions & 17 deletions packages/theme/src/dialog-box/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@
height: 100vh;
display: flex;
flex-direction: column;

.@{dialog-box-prefix-cls}__content {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
}
}

&.is-center {

.@{dialog-box-prefix-cls}__header,
.@{dialog-box-prefix-cls}__footer {
text-align: center;
Expand All @@ -60,8 +68,7 @@
}

& &__header {
padding: var(--ti-dialog-box-head-padding-top) var(--ti-dialog-box-head-padding-horizontal)
var(--ti-dialog-box-head-padding-bottom);
padding: var(--ti-dialog-box-head-padding-top) var(--ti-dialog-box-head-padding-horizontal) var(--ti-dialog-box-head-padding-bottom);
background: var(--ti-dialog-box-bg-color);
font-weight: var(--ti-dialog-box-head-title-font-weight);
display: flex;
Expand All @@ -75,10 +82,12 @@
.@{dialog-box-prefix-cls}__title {
flex: 1;
}

.@{dialog-box-prefix-cls}__btn-tools {
display: flex;
justify-content: space-between;
}

.@{dialog-box-prefix-cls}__headerbtn {
position: relative;
border: none;
Expand All @@ -94,7 +103,7 @@
border-radius: var(--ti-dialog-box-btn-border-radius);
}

& + .@{dialog-box-prefix-cls}__headerbtn {
&+.@{dialog-box-prefix-cls}__headerbtn {
margin-left: 8px;
}

Expand Down Expand Up @@ -135,7 +144,7 @@
overflow: hidden;
}

> span {
>span {
max-height: 120px;
overflow-y: auto;
}
Expand All @@ -146,8 +155,7 @@
}

& &__footer {
padding: var(--ti-dialog-box-footer-padding-top) var(--ti-dialog-box-footer-padding-horizontal)
var(--ti-dialog-box-footer-margin-bottom);
padding: var(--ti-dialog-box-footer-padding-top) var(--ti-dialog-box-footer-padding-horizontal) var(--ti-dialog-box-footer-margin-bottom);
text-align: var(--ti-dialog-box-footer-align);
box-sizing: border-box;

Expand Down Expand Up @@ -180,28 +188,22 @@
}

.@{dialog-box-prefix-cls}__header {
padding: var(--ti-dialog-box-drawer-header-padding-top) var(--ti-dialog-box-drawer-header-padding-right)
var(--ti-dialog-box-drawer-header-padding-bottom) var(--ti-dialog-box-drawer-header-padding-left);
padding: var(--ti-dialog-box-drawer-header-padding-top) var(--ti-dialog-box-drawer-header-padding-right) var(--ti-dialog-box-drawer-header-padding-bottom) var(--ti-dialog-box-drawer-header-padding-left);
border-bottom: 1px solid var(--ti-dialog-box-drawer-divider-border-color);

&btn {
right: calc(
var(--ti-dialog-box-btn-position-right) - var(--ti-dialog-box-drawer-padding-right) -
(var(--ti-dialog-box-btn-width) - var(--ti-dialog-box-close-icon-size)) / 2
);
right: calc(var(--ti-dialog-box-btn-position-right) - var(--ti-dialog-box-drawer-padding-right) - (var(--ti-dialog-box-btn-width) - var(--ti-dialog-box-close-icon-size)) / 2);
}
}

.@{dialog-box-prefix-cls}__body {
flex: 1;
overflow: auto;
padding: var(--ti-dialog-box-drawer-body-padding-top) var(--ti-dialog-box-drawer-body-padding-right)
var(--ti-dialog-box-drawer-body-padding-bottom) var(--ti-dialog-box-drawer-body-padding-left);
padding: var(--ti-dialog-box-drawer-body-padding-top) var(--ti-dialog-box-drawer-body-padding-right) var(--ti-dialog-box-drawer-body-padding-bottom) var(--ti-dialog-box-drawer-body-padding-left);
}

.@{dialog-box-prefix-cls}__footer {
padding: var(--ti-dialog-box-drawer-footer-padding-top) var(--ti-dialog-box-drawer-footer-padding-right)
var(--ti-dialog-box-drawer-footer-padding-bottom) var(--ti-dialog-box-drawer-footer-padding-left);
padding: var(--ti-dialog-box-drawer-footer-padding-top) var(--ti-dialog-box-drawer-footer-padding-right) var(--ti-dialog-box-drawer-footer-padding-bottom) var(--ti-dialog-box-drawer-footer-padding-left);
border-top: 1px solid var(--ti-dialog-box-drawer-divider-border-color);
text-align: var(--ti-dialog-box-drawer-footer-text-align);
}
Expand Down Expand Up @@ -290,6 +292,10 @@

.dialog-fade-leave-active {
animation: dialog-fade-out 0.3s;

.tiny-dialog-box {
animation: dialog-fade-out 0.3s;
}
}

@keyframes dialog-fade-in {
Expand Down Expand Up @@ -340,4 +346,4 @@
top: 0 !important;
left: 0 !important;
}
}
}
Loading