diff --git a/packages/veui-theme-dls/components/transition.less b/packages/veui-theme-dls/components/transition.less new file mode 100644 index 000000000..27e223cef --- /dev/null +++ b/packages/veui-theme-dls/components/transition.less @@ -0,0 +1,156 @@ +@import "../lib.less"; + +.@{veui-prefix}-transition { + // 渐现 fade-in + &-fade-in-enter-active { + transition-duration: 200ms; + transition-property: opacity; + transition-timing-function: linear; + } + + &-fade-in-enter { + opacity: 0; + } + + // 放大渐现 scale-fade-in + &-scale-fade-in-enter-active { + transition-duration: 200ms; + transition-property: opacity, transform; + transition-timing-function: linear; + } + + &-scale-fade-in-enter { + opacity: 0; + transform: scale3d(0, 0, 1); + } + + // 移入 slide-in + &-slide-in-enter-active { + transition-property: transform; + transition-duration: 200ms; + transition-timing-function: ease-out; + } + + &-slide-in-enter { + transform: translate3d( + var(--dls-transition-translate-from-x, 0), + var(--dls-transition-translate-from-y, 0), + 0 + ); + } + + // 渐现移入 slide-fade-in + &-slide-fade-in-enter-active { + transition-property: opacity, transform; + transition-duration: 200ms; + transition-timing-function: linear; + } + + &-slide-fade-in-enter { + opacity: 0; + transform: translate3d( + var(--dls-transition-translate-from-x, 0), + var(--dls-transition-translate-from-y, 0), + 0 + ); + } + + // 渐变移入 slide-scale-fade-in + &-slide-scale-fade-in-enter-active { + transition-property: opacity, transform; + transition-duration: 200ms; + transition-timing-function: linear; + } + + &-slide-scale-fade-in-enter { + opacity: 0; + transform: translate3d( + var(--dls-transition-translate-from-x, 0), + var(--dls-transition-translate-from-y, 0), + 0 + ) + scale3d(0, 0, 1); + } + + // 移动 move + &-move { + transition-property: transform; + transition-duration: 200ms; + transform: translate3d( + var(--dls-transition-translate-x, 0), + var(--dls-transition-translate-y, 0), + 0 + ); + } + + // 渐隐 fade-out + &-fade-out-leave-active { + transition-duration: 100ms; + transition-property: opacity; + transition-timing-function: linear; + } + + &-fade-out-leave-to { + opacity: 0; + } + + // 缩小渐隐 scale-fade-out + &-scale-fade-out-leave-active { + transition-duration: 100ms; + transition-property: opacity, transform; + transition-timing-function: linear; + } + + &-scale-fade-out-leave-to { + opacity: 0; + transform: scale3d(0, 0, 1); + } + + // 移出 slide-out + &-slide-out-leave-active { + transition-duration: 100ms; + transition-property: transform; + transition-timing-function: ease-in; + } + + &-slide-out-leave-to { + transform: translate3d( + var(--dls-transition-translate-to-x, 0), + var(--dls-transition-translate-to-y, 0), + 0 + ); + } + + // 渐隐移出 slide-fade-out + &-slide-fade-out-leave-active { + transition-duration: 100ms; + transition-property: opacity, transform; + transition-timing-function: ease-in; + } + + &-slide-fade-out-leave-to { + opacity: 0; + transform: translate3d( + var(--dls-transition-translate-to-x, 0), + var(--dls-transition-translate-to-y, 0), + 0 + ); + } + + // 渐变移出 slide-scale-fade-out + &-slide-scale-fade-out-leave-active { + transition-duration: 100ms; + transition-property: opacity, transform; + transition-timing-function: ease-in; + } + + &-slide-scale-fade-out-leave-to { + opacity: 0; + transform: translate3d( + var(--dls-transition-translate-to-x, 0), + var(--dls-transition-translate-to-y, 0), + 0 + ) + scale3d(0, 0, 1); + } +} diff --git a/packages/veui-theme-dls/index.js b/packages/veui-theme-dls/index.js index 20a6d81d2..29bc9abec 100644 --- a/packages/veui-theme-dls/index.js +++ b/packages/veui-theme-dls/index.js @@ -130,4 +130,5 @@ import './components/time-picker.less' import './components/toast.less' import './components/toast-list.less' import './components/transfer.less' +import './components/transition.less' import './components/uploader.less' diff --git a/packages/veui/components.json b/packages/veui/components.json index cd8b9bf46..d8e451a58 100644 --- a/packages/veui/components.json +++ b/packages/veui/components.json @@ -249,15 +249,15 @@ }, { "name": "Form", - "path": "Form/Form.vue" + "path": "Form" }, { "name": "Form", - "path": "Form" + "path": "Form/index.js" }, { "name": "Form", - "path": "Form/index.js" + "path": "Form/Form.vue" }, { "name": "GridColumn", @@ -455,6 +455,10 @@ "name": "Transfer", "path": "Transfer/index.js" }, + { + "name": "Transition", + "path": "Transition.vue" + }, { "name": "Uploader", "path": "Uploader/Uploader.vue" diff --git a/packages/veui/demo/cases/Transition.vue b/packages/veui/demo/cases/Transition.vue new file mode 100644 index 000000000..7d8aa2afe --- /dev/null +++ b/packages/veui/demo/cases/Transition.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/packages/veui/demo/cases/index.js b/packages/veui/demo/cases/index.js index b0fb49467..aad71f42d 100644 --- a/packages/veui/demo/cases/index.js +++ b/packages/veui/demo/cases/index.js @@ -58,6 +58,7 @@ import Plugins from './Plugins' import Cascader from './Cascader' import ConfigProvider from './ConfigProvider' import Layout from './Layout' +import Transition from './Transition' export default [ { @@ -75,6 +76,11 @@ export default [ name: 'Alert', component: Alert }, + { + path: '/transition', + name: 'Transition', + component: Transition + }, { path: '/alert-box', name: 'AlertBox', diff --git a/packages/veui/src/components/Transition.vue b/packages/veui/src/components/Transition.vue new file mode 100644 index 000000000..f5607117c --- /dev/null +++ b/packages/veui/src/components/Transition.vue @@ -0,0 +1,83 @@ + diff --git a/packages/veui/src/components/index.js b/packages/veui/src/components/index.js index be62a518a..d4cc7808b 100644 --- a/packages/veui/src/components/index.js +++ b/packages/veui/src/components/index.js @@ -74,5 +74,6 @@ export { default as Toast } from './Toast' export { default as ToastList } from './ToastList' export { default as Tooltip } from './Tooltip' export { default as Transfer } from './Transfer' +export { default as Transition } from './Transition' export { default as Tree } from './Tree' export { default as Uploader } from './Uploader'