@wot-ui/ui 1.0.0 → 2.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/attributes.json +1 -0
- package/changelog.md +53 -0
- package/common/AbortablePromise.ts +28 -0
- package/common/canvasHelper.ts +49 -0
- package/common/clickoutside.ts +25 -0
- package/common/event.ts +8 -0
- package/common/formatDate.ts +68 -0
- package/common/interceptor.ts +43 -0
- package/common/props.ts +53 -0
- package/common/util.ts +836 -0
- package/components/wd-action-sheet/index.scss +232 -0
- package/components/wd-action-sheet/types.ts +155 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
- package/components/wd-avatar/index.scss +150 -0
- package/components/wd-avatar/types.ts +98 -0
- package/components/wd-avatar/wd-avatar.vue +184 -0
- package/components/wd-avatar-group/index.scss +11 -0
- package/components/wd-avatar-group/types.ts +61 -0
- package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
- package/components/wd-backtop/index.scss +67 -0
- package/components/wd-backtop/types.ts +66 -0
- package/components/wd-backtop/wd-backtop.vue +57 -0
- package/components/wd-badge/index.scss +116 -0
- package/components/wd-badge/types.ts +94 -0
- package/components/wd-badge/wd-badge.vue +78 -0
- package/components/wd-button/index.scss +436 -0
- package/components/wd-button/types.ts +204 -0
- package/components/wd-button/wd-button.vue +210 -0
- package/components/wd-calendar/index.scss +97 -0
- package/components/wd-calendar/types.ts +221 -0
- package/components/wd-calendar/wd-calendar.vue +339 -0
- package/components/wd-calendar-view/index.scss +41 -0
- package/components/wd-calendar-view/month/index.scss +144 -0
- package/components/wd-calendar-view/month/month.vue +389 -0
- package/components/wd-calendar-view/month/types.ts +70 -0
- package/components/wd-calendar-view/monthPanel/index.scss +84 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
- package/components/wd-calendar-view/monthPanel/types.ts +151 -0
- package/components/wd-calendar-view/types.ts +166 -0
- package/components/wd-calendar-view/utils.ts +318 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +74 -0
- package/components/wd-calendar-view/year/year.vue +206 -0
- package/components/wd-calendar-view/yearPanel/index.scss +42 -0
- package/components/wd-calendar-view/yearPanel/types.ts +96 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
- package/components/wd-card/index.scss +104 -0
- package/components/wd-card/types.ts +47 -0
- package/components/wd-card/wd-card.vue +38 -0
- package/components/wd-cascader/index.scss +154 -0
- package/components/wd-cascader/types.ts +191 -0
- package/components/wd-cascader/wd-cascader.vue +589 -0
- package/components/wd-cell/index.scss +244 -0
- package/components/wd-cell/types.ts +205 -0
- package/components/wd-cell/wd-cell.vue +172 -0
- package/components/wd-cell-group/index.scss +53 -0
- package/components/wd-cell-group/types.ts +97 -0
- package/components/wd-cell-group/wd-cell-group.vue +48 -0
- package/components/wd-checkbox/index.scss +166 -0
- package/components/wd-checkbox/types.ts +118 -0
- package/components/wd-checkbox/wd-checkbox.vue +216 -0
- package/components/wd-checkbox-group/index.scss +5 -0
- package/components/wd-checkbox-group/types.ts +93 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
- package/components/wd-circle/index.scss +28 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +306 -0
- package/components/wd-col/index.scss +5 -0
- package/components/wd-col/types.ts +16 -0
- package/components/wd-col/wd-col.vue +83 -0
- package/components/wd-collapse/index.scss +71 -0
- package/components/wd-collapse/types.ts +68 -0
- package/components/wd-collapse/wd-collapse.vue +165 -0
- package/components/wd-collapse-item/index.scss +86 -0
- package/components/wd-collapse-item/types.ts +62 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
- package/components/wd-config-provider/index.scss +10 -0
- package/components/wd-config-provider/types.ts +2063 -0
- package/components/wd-config-provider/wd-config-provider.vue +61 -0
- package/components/wd-count-down/index.scss +16 -0
- package/components/wd-count-down/types.ts +58 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +62 -0
- package/components/wd-count-to/index.scss +25 -0
- package/components/wd-count-to/types.ts +121 -0
- package/components/wd-count-to/wd-count-to.vue +126 -0
- package/components/wd-curtain/index.scss +96 -0
- package/components/wd-curtain/types.ts +82 -0
- package/components/wd-curtain/wd-curtain.vue +172 -0
- package/components/wd-datetime-picker/index.scss +133 -0
- package/components/wd-datetime-picker/types.ts +198 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
- package/components/wd-datetime-picker-view/types.ts +171 -0
- package/components/wd-datetime-picker-view/util.ts +30 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
- package/components/wd-dialog/index.scss +281 -0
- package/components/wd-dialog/index.ts +168 -0
- package/components/wd-dialog/types.ts +452 -0
- package/components/wd-dialog/wd-dialog.vue +586 -0
- package/components/wd-divider/index.scss +122 -0
- package/components/wd-divider/types.ts +50 -0
- package/components/wd-divider/wd-divider.vue +54 -0
- package/components/wd-drop-menu/index.scss +90 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
- package/components/wd-drop-menu-item/index.scss +96 -0
- package/components/wd-drop-menu-item/types.ts +93 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
- package/components/wd-empty/index.scss +46 -0
- package/components/wd-empty/types.ts +37 -0
- package/components/wd-empty/wd-empty.vue +47 -0
- package/components/wd-fab/index.scss +124 -0
- package/components/wd-fab/types.ts +119 -0
- package/components/wd-fab/wd-fab.vue +322 -0
- package/components/wd-floating-panel/index.scss +73 -0
- package/components/wd-floating-panel/type.ts +32 -0
- package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
- package/components/wd-form/adapters/zod.ts +56 -0
- package/components/wd-form/types.ts +147 -0
- package/components/wd-form/wd-form.vue +121 -0
- package/components/wd-form-item/index.scss +26 -0
- package/components/wd-form-item/types.ts +134 -0
- package/components/wd-form-item/wd-form-item.vue +182 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +26 -0
- package/components/wd-gap/wd-gap.vue +38 -0
- package/components/wd-grid/index.scss +11 -0
- package/components/wd-grid/types.ts +97 -0
- package/components/wd-grid/wd-grid.vue +48 -0
- package/components/wd-grid-item/index.scss +187 -0
- package/components/wd-grid-item/types.ts +98 -0
- package/components/wd-grid-item/wd-grid-item.vue +295 -0
- package/components/wd-icon/index.scss +46 -0
- package/components/wd-icon/types.ts +44 -0
- package/components/wd-icon/wd-icon.vue +66 -0
- package/components/wd-image-preview/index.scss +94 -0
- package/components/wd-image-preview/index.ts +95 -0
- package/components/wd-image-preview/types.ts +165 -0
- package/components/wd-image-preview/wd-image-preview.vue +233 -0
- package/components/wd-img/index.scss +82 -0
- package/components/wd-img/types.ts +96 -0
- package/components/wd-img/wd-img.vue +91 -0
- package/components/wd-img-cropper/index.scss +259 -0
- package/components/wd-img-cropper/types.ts +101 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
- package/components/wd-index-anchor/index.scss +34 -0
- package/components/wd-index-anchor/type.ts +9 -0
- package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
- package/components/wd-index-bar/index.scss +68 -0
- package/components/wd-index-bar/type.ts +23 -0
- package/components/wd-index-bar/wd-index-bar.vue +157 -0
- package/components/wd-input/index.scss +129 -0
- package/components/wd-input/types.ts +165 -0
- package/components/wd-input/wd-input.vue +237 -0
- package/components/wd-input-number/index.scss +233 -0
- package/components/wd-input-number/types.ts +131 -0
- package/components/wd-input-number/wd-input-number.vue +473 -0
- package/components/wd-keyboard/constants.ts +81 -0
- package/components/wd-keyboard/index.scss +104 -0
- package/components/wd-keyboard/key/index.scss +103 -0
- package/components/wd-keyboard/key/index.vue +84 -0
- package/components/wd-keyboard/key/types.ts +44 -0
- package/components/wd-keyboard/types.ts +138 -0
- package/components/wd-keyboard/wd-keyboard.vue +236 -0
- package/components/wd-loading/index.scss +205 -0
- package/components/wd-loading/types.ts +61 -0
- package/components/wd-loading/wd-loading.vue +70 -0
- package/components/wd-loadmore/index.scss +62 -0
- package/components/wd-loadmore/types.ts +42 -0
- package/components/wd-loadmore/wd-loadmore.vue +68 -0
- package/components/wd-navbar/index.scss +96 -0
- package/components/wd-navbar/types.ts +74 -0
- package/components/wd-navbar/wd-navbar.vue +136 -0
- package/components/wd-navbar-capsule/index.scss +70 -0
- package/components/wd-navbar-capsule/types.ts +11 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
- package/components/wd-notice-bar/index.scss +94 -0
- package/components/wd-notice-bar/types.ts +97 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
- package/components/wd-notify/index.scss +114 -0
- package/components/wd-notify/index.ts +63 -0
- package/components/wd-notify/types.ts +130 -0
- package/components/wd-notify/wd-notify.vue +162 -0
- package/components/wd-overlay/index.scss +14 -0
- package/components/wd-overlay/types.ts +42 -0
- package/components/wd-overlay/wd-overlay.vue +55 -0
- package/components/wd-pagination/index.scss +71 -0
- package/components/wd-pagination/types.ts +69 -0
- package/components/wd-pagination/wd-pagination.vue +118 -0
- package/components/wd-password-input/index.scss +134 -0
- package/components/wd-password-input/types.ts +42 -0
- package/components/wd-password-input/wd-password-input.vue +51 -0
- package/components/wd-picker/index.scss +72 -0
- package/components/wd-picker/types.ts +141 -0
- package/components/wd-picker/wd-picker.vue +220 -0
- package/components/wd-picker-view/index.scss +93 -0
- package/components/wd-picker-view/types.ts +145 -0
- package/components/wd-picker-view/useSelection.ts +385 -0
- package/components/wd-picker-view/wd-picker-view.vue +227 -0
- package/components/wd-popover/index.scss +117 -0
- package/components/wd-popover/types.ts +106 -0
- package/components/wd-popover/wd-popover.vue +212 -0
- package/components/wd-popup/index.scss +89 -0
- package/components/wd-popup/types.ts +110 -0
- package/components/wd-popup/wd-popup.vue +174 -0
- package/components/wd-progress/index.scss +155 -0
- package/components/wd-progress/types.ts +94 -0
- package/components/wd-progress/wd-progress.vue +249 -0
- package/components/wd-radio/index.scss +189 -0
- package/components/wd-radio/types.ts +64 -0
- package/components/wd-radio/wd-radio.vue +164 -0
- package/components/wd-radio-group/index.scss +5 -0
- package/components/wd-radio-group/types.ts +70 -0
- package/components/wd-radio-group/wd-radio-group.vue +53 -0
- package/components/wd-rate/index.scss +57 -0
- package/components/wd-rate/types.ts +86 -0
- package/components/wd-rate/wd-rate.vue +168 -0
- package/components/wd-resize/index.scss +31 -0
- package/components/wd-resize/types.ts +14 -0
- package/components/wd-resize/wd-resize.vue +157 -0
- package/components/wd-root-portal/wd-root-portal.vue +77 -0
- package/components/wd-row/index.scss +6 -0
- package/components/wd-row/types.ts +36 -0
- package/components/wd-row/wd-row.vue +88 -0
- package/components/wd-search/index.scss +171 -0
- package/components/wd-search/types.ts +107 -0
- package/components/wd-search/wd-search.vue +198 -0
- package/components/wd-segmented/index.scss +155 -0
- package/components/wd-segmented/types.ts +81 -0
- package/components/wd-segmented/wd-segmented.vue +169 -0
- package/components/wd-select-picker/index.scss +72 -0
- package/components/wd-select-picker/types.ts +72 -0
- package/components/wd-select-picker/wd-select-picker.vue +371 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +34 -0
- package/components/wd-sidebar/wd-sidebar.vue +57 -0
- package/components/wd-sidebar-item/index.scss +91 -0
- package/components/wd-sidebar-item/types.ts +28 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
- package/components/wd-signature/index.scss +42 -0
- package/components/wd-signature/types.ts +295 -0
- package/components/wd-signature/wd-signature.vue +664 -0
- package/components/wd-skeleton/index.scss +112 -0
- package/components/wd-skeleton/types.ts +124 -0
- package/components/wd-skeleton/wd-skeleton.vue +110 -0
- package/components/wd-slide-verify/index.scss +112 -0
- package/components/wd-slide-verify/types.ts +98 -0
- package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
- package/components/wd-slider/index.scss +485 -0
- package/components/wd-slider/types.ts +166 -0
- package/components/wd-slider/wd-slider.vue +529 -0
- package/components/wd-sort-button/index.scss +126 -0
- package/components/wd-sort-button/types.ts +68 -0
- package/components/wd-sort-button/wd-sort-button.vue +67 -0
- package/components/wd-step/index.scss +366 -0
- package/components/wd-step/types.ts +43 -0
- package/components/wd-step/wd-step.vue +181 -0
- package/components/wd-steps/index.scss +7 -0
- package/components/wd-steps/types.ts +50 -0
- package/components/wd-steps/wd-steps.vue +39 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +192 -0
- package/components/wd-sticky-box/index.scss +6 -0
- package/components/wd-sticky-box/types.ts +20 -0
- package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +87 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
- package/components/wd-swiper/index.scss +69 -0
- package/components/wd-swiper/types.ts +275 -0
- package/components/wd-swiper/wd-swiper.vue +332 -0
- package/components/wd-swiper-nav/index.scss +179 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
- package/components/wd-switch/index.scss +177 -0
- package/components/wd-switch/types.ts +93 -0
- package/components/wd-switch/wd-switch.vue +107 -0
- package/components/wd-tab/index.scss +16 -0
- package/components/wd-tab/types.ts +45 -0
- package/components/wd-tab/wd-tab.vue +99 -0
- package/components/wd-tabbar/index.scss +71 -0
- package/components/wd-tabbar/types.ts +79 -0
- package/components/wd-tabbar/wd-tabbar.vue +109 -0
- package/components/wd-tabbar-item/index.scss +50 -0
- package/components/wd-tabbar-item/types.ts +45 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +128 -0
- package/components/wd-table/types.ts +160 -0
- package/components/wd-table/wd-table.vue +331 -0
- package/components/wd-table-column/index.scss +15 -0
- package/components/wd-table-column/types.ts +81 -0
- package/components/wd-table-column/wd-table-column.vue +198 -0
- package/components/wd-tabs/index.scss +332 -0
- package/components/wd-tabs/types.ts +155 -0
- package/components/wd-tabs/wd-tabs.vue +508 -0
- package/components/wd-tag/index.scss +325 -0
- package/components/wd-tag/types.ts +90 -0
- package/components/wd-tag/wd-tag.vue +158 -0
- package/components/wd-text/index.scss +52 -0
- package/components/wd-text/types.ts +107 -0
- package/components/wd-text/wd-text.vue +141 -0
- package/components/wd-textarea/index.scss +112 -0
- package/components/wd-textarea/types.ts +151 -0
- package/components/wd-textarea/wd-textarea.vue +212 -0
- package/components/wd-toast/index.scss +92 -0
- package/components/wd-toast/index.ts +97 -0
- package/components/wd-toast/types.ts +190 -0
- package/components/wd-toast/wd-toast.vue +158 -0
- package/components/wd-tooltip/index.scss +77 -0
- package/components/wd-tooltip/types.ts +105 -0
- package/components/wd-tooltip/wd-tooltip.vue +169 -0
- package/components/wd-tour/index.scss +106 -0
- package/components/wd-tour/types.ts +268 -0
- package/components/wd-tour/wd-tour.vue +518 -0
- package/components/wd-transition/index.scss +67 -0
- package/components/wd-transition/types.ts +106 -0
- package/components/wd-transition/wd-transition.vue +238 -0
- package/components/wd-upload/index.scss +204 -0
- package/components/wd-upload/types.ts +390 -0
- package/components/wd-upload/wd-upload.vue +565 -0
- package/components/wd-video-preview/index.scss +54 -0
- package/components/wd-video-preview/index.ts +64 -0
- package/components/wd-video-preview/types.ts +66 -0
- package/components/wd-video-preview/wd-video-preview.vue +141 -0
- package/components/wd-watermark/index.scss +21 -0
- package/components/wd-watermark/types.ts +130 -0
- package/components/wd-watermark/wd-watermark.vue +718 -0
- package/components/wot-ui/wot-ui.vue +5 -0
- package/composables/index.ts +12 -0
- package/composables/useCell.ts +34 -0
- package/composables/useChildren.ts +120 -0
- package/composables/useConfigProvider.ts +45 -0
- package/composables/useCountDown.ts +138 -0
- package/composables/useDeviceInfo.ts +136 -0
- package/composables/useLockScroll.ts +37 -0
- package/composables/useParent.ts +51 -0
- package/composables/usePopover.ts +212 -0
- package/composables/useQueue.ts +52 -0
- package/composables/useRaf.ts +37 -0
- package/composables/useTouch.ts +43 -0
- package/composables/useTranslate.ts +12 -0
- package/composables/useUpload.ts +366 -0
- package/global.d.ts +106 -0
- package/index.ts +11 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +150 -0
- package/locale/lang/de-DE.ts +150 -0
- package/locale/lang/en-US.ts +150 -0
- package/locale/lang/es-ES.ts +150 -0
- package/locale/lang/fr-FR.ts +150 -0
- package/locale/lang/ja-JP.ts +150 -0
- package/locale/lang/ko-KR.ts +150 -0
- package/locale/lang/pt-PT.ts +150 -0
- package/locale/lang/ru-RU.ts +150 -0
- package/locale/lang/th-TH.ts +150 -0
- package/locale/lang/tr-TR.ts +155 -0
- package/locale/lang/ug-CN.ts +154 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +154 -0
- package/locale/lang/zh-HK.ts +78 -0
- package/locale/lang/zh-TW.ts +78 -0
- package/package.json +1 -11
- package/styles/iconfont/iconfont.scss +1243 -0
- package/styles/mixin/_config.scss +7 -0
- package/styles/mixin/_function.scss +44 -0
- package/styles/mixin/_mixin.scss +473 -0
- package/styles/theme/base/color.scss +210 -0
- package/styles/theme/base/font.scss +13 -0
- package/styles/theme/base/index.scss +8 -0
- package/styles/theme/base/insets.scss +32 -0
- package/styles/theme/base/number.scss +36 -0
- package/styles/theme/base/opacity.scss +9 -0
- package/styles/theme/base/radius.scss +13 -0
- package/styles/theme/base/stroke.scss +9 -0
- package/styles/theme/base/typography.scss +44 -0
- package/styles/theme/dark.scss +101 -0
- package/styles/theme/index.scss +16 -0
- package/styles/theme/light.scss +101 -0
- package/styles/variable.scss +472 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="rootClass"
|
|
4
|
+
:style="style"
|
|
5
|
+
@transitionend="onTransitionEnd"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
@touchmove.stop.prevent="noop"
|
|
8
|
+
v-if="isShow && disableTouchMove"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</view>
|
|
12
|
+
<view :class="rootClass" :style="style" @transitionend="onTransitionEnd" @click="handleClick" v-else-if="isShow && !disableTouchMove">
|
|
13
|
+
<slot />
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
export default {
|
|
19
|
+
name: 'wd-transition',
|
|
20
|
+
options: {
|
|
21
|
+
addGlobalClass: true,
|
|
22
|
+
// #ifndef MP-TOUTIAO
|
|
23
|
+
virtualHost: true,
|
|
24
|
+
// #endif
|
|
25
|
+
styleIsolation: 'shared'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { computed, onBeforeMount, ref, watch } from 'vue'
|
|
32
|
+
import { isObj, isPromise, pause } from '../../common/util'
|
|
33
|
+
import { transitionProps, type TransitionName } from './types'
|
|
34
|
+
import { AbortablePromise } from '../../common/AbortablePromise'
|
|
35
|
+
|
|
36
|
+
const getClassNames = (name?: TransitionName | TransitionName[]) => {
|
|
37
|
+
const transitionClass = (transitionName: string, phase: string) => {
|
|
38
|
+
return `wd-transition--${transitionName}-${phase}`
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let enter: string = `${props.enterClass} ${props.enterActiveClass}`
|
|
42
|
+
let enterTo: string = `${props.enterToClass} ${props.enterActiveClass}`
|
|
43
|
+
let leave: string = `${props.leaveClass} ${props.leaveActiveClass}`
|
|
44
|
+
let leaveTo: string = `${props.leaveToClass} ${props.leaveActiveClass}`
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(name)) {
|
|
47
|
+
for (let index = 0; index < name.length; index++) {
|
|
48
|
+
enter = `${transitionClass(name[index], 'enter')} ${transitionClass(name[index], 'enter-active')} ${enter}`
|
|
49
|
+
enterTo = `${transitionClass(name[index], 'enter-to')} ${transitionClass(name[index], 'enter-active')} ${enterTo}`
|
|
50
|
+
leave = `${transitionClass(name[index], 'leave')} ${transitionClass(name[index], 'leave-active')} ${leave}`
|
|
51
|
+
leaveTo = `${transitionClass(name[index], 'leave-to')} ${transitionClass(name[index], 'leave-active')} ${leaveTo}`
|
|
52
|
+
}
|
|
53
|
+
} else if (name) {
|
|
54
|
+
enter = `${transitionClass(name, 'enter')} ${transitionClass(name, 'enter-active')} ${enter}`
|
|
55
|
+
enterTo = `${transitionClass(name, 'enter-to')} ${transitionClass(name, 'enter-active')} ${enterTo}`
|
|
56
|
+
leave = `${transitionClass(name, 'leave')} ${transitionClass(name, 'leave-active')} ${leave}`
|
|
57
|
+
leaveTo = `${transitionClass(name, 'leave-to')} ${transitionClass(name, 'leave-active')} ${leaveTo}`
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
enter: enter,
|
|
61
|
+
'enter-to': enterTo,
|
|
62
|
+
leave: leave,
|
|
63
|
+
'leave-to': leaveTo
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const props = defineProps(transitionProps)
|
|
68
|
+
const emit = defineEmits(['click', 'before-enter', 'enter', 'before-leave', 'leave', 'after-leave', 'after-enter'])
|
|
69
|
+
|
|
70
|
+
// 初始化是否完成
|
|
71
|
+
const inited = ref<boolean>(false)
|
|
72
|
+
// 是否显示
|
|
73
|
+
const display = ref<boolean>(false)
|
|
74
|
+
// 当前动画状态
|
|
75
|
+
const status = ref<string>('')
|
|
76
|
+
// 动画是否结束
|
|
77
|
+
const transitionEnded = ref<boolean>(false)
|
|
78
|
+
// 动画持续时间
|
|
79
|
+
const currentDuration = ref<number>(300)
|
|
80
|
+
// 类名
|
|
81
|
+
const classes = ref<string>('')
|
|
82
|
+
// 用于控制enter和leave的顺序执行
|
|
83
|
+
const enterPromise = ref<AbortablePromise<void> | null>(null)
|
|
84
|
+
|
|
85
|
+
// 动画进入的生命周期
|
|
86
|
+
const enterLifeCyclePromises = ref<AbortablePromise<unknown> | null>(null)
|
|
87
|
+
|
|
88
|
+
// 动画离开的生命周期
|
|
89
|
+
const leaveLifeCyclePromises = ref<AbortablePromise<unknown> | null>(null)
|
|
90
|
+
|
|
91
|
+
const style = computed(() => {
|
|
92
|
+
return `-webkit-transition-duration:${currentDuration.value}ms;transition-duration:${currentDuration.value}ms;${
|
|
93
|
+
display.value || !props.destroy ? '' : 'display: none;'
|
|
94
|
+
}${props.customStyle}`
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const rootClass = computed(() => {
|
|
98
|
+
return `wd-transition ${props.customClass} ${classes.value}`
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const isShow = computed(() => {
|
|
102
|
+
return !props.lazyRender || inited.value
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
onBeforeMount(() => {
|
|
106
|
+
if (props.show) {
|
|
107
|
+
enter()
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
watch(
|
|
112
|
+
() => props.show,
|
|
113
|
+
(newVal) => {
|
|
114
|
+
handleShow(newVal)
|
|
115
|
+
},
|
|
116
|
+
{ deep: true }
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
function handleClick() {
|
|
120
|
+
emit('click')
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function handleShow(value: boolean) {
|
|
124
|
+
if (value) {
|
|
125
|
+
handleAbortPromise()
|
|
126
|
+
enter()
|
|
127
|
+
} else {
|
|
128
|
+
leave()
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 取消所有的promise
|
|
133
|
+
*/
|
|
134
|
+
function handleAbortPromise() {
|
|
135
|
+
isPromise(enterPromise.value) && enterPromise.value.abort()
|
|
136
|
+
isPromise(enterLifeCyclePromises.value) && enterLifeCyclePromises.value.abort()
|
|
137
|
+
isPromise(leaveLifeCyclePromises.value) && leaveLifeCyclePromises.value.abort()
|
|
138
|
+
enterPromise.value = null
|
|
139
|
+
enterLifeCyclePromises.value = null
|
|
140
|
+
leaveLifeCyclePromises.value = null
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function enter() {
|
|
144
|
+
enterPromise.value = new AbortablePromise(async (resolve) => {
|
|
145
|
+
try {
|
|
146
|
+
const classNames = getClassNames(props.name)
|
|
147
|
+
const duration = isObj(props.duration) ? (props.duration as any).enter : props.duration
|
|
148
|
+
status.value = 'enter'
|
|
149
|
+
emit('before-enter')
|
|
150
|
+
enterLifeCyclePromises.value = pause()
|
|
151
|
+
await enterLifeCyclePromises.value
|
|
152
|
+
emit('enter')
|
|
153
|
+
classes.value = classNames.enter
|
|
154
|
+
currentDuration.value = duration
|
|
155
|
+
enterLifeCyclePromises.value = pause()
|
|
156
|
+
await enterLifeCyclePromises.value
|
|
157
|
+
inited.value = true
|
|
158
|
+
display.value = true
|
|
159
|
+
enterLifeCyclePromises.value = pause()
|
|
160
|
+
await enterLifeCyclePromises.value
|
|
161
|
+
enterLifeCyclePromises.value = null
|
|
162
|
+
transitionEnded.value = false
|
|
163
|
+
classes.value = classNames['enter-to']
|
|
164
|
+
resolve()
|
|
165
|
+
} catch (error) {
|
|
166
|
+
/**
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
async function leave() {
|
|
173
|
+
if (!enterPromise.value) {
|
|
174
|
+
transitionEnded.value = false
|
|
175
|
+
return onTransitionEnd()
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
await enterPromise.value
|
|
179
|
+
if (!display.value) return
|
|
180
|
+
const classNames = getClassNames(props.name)
|
|
181
|
+
const duration = isObj(props.duration) ? (props.duration as any).leave : props.duration
|
|
182
|
+
status.value = 'leave'
|
|
183
|
+
emit('before-leave')
|
|
184
|
+
currentDuration.value = duration
|
|
185
|
+
leaveLifeCyclePromises.value = pause()
|
|
186
|
+
await leaveLifeCyclePromises.value
|
|
187
|
+
emit('leave')
|
|
188
|
+
classes.value = classNames.leave
|
|
189
|
+
leaveLifeCyclePromises.value = pause()
|
|
190
|
+
await leaveLifeCyclePromises.value
|
|
191
|
+
transitionEnded.value = false
|
|
192
|
+
classes.value = classNames['leave-to']
|
|
193
|
+
leaveLifeCyclePromises.value = setPromise(currentDuration.value)
|
|
194
|
+
await leaveLifeCyclePromises.value
|
|
195
|
+
leaveLifeCyclePromises.value = null
|
|
196
|
+
onTransitionEnd()
|
|
197
|
+
enterPromise.value = null
|
|
198
|
+
} catch (error) {
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
*/
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 定时器promise化
|
|
207
|
+
* @param duration 持续时间ms
|
|
208
|
+
*/
|
|
209
|
+
function setPromise(duration: number) {
|
|
210
|
+
return new AbortablePromise<void>((resolve) => {
|
|
211
|
+
const timer = setTimeout(() => {
|
|
212
|
+
clearTimeout(timer)
|
|
213
|
+
resolve()
|
|
214
|
+
}, duration)
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
function onTransitionEnd() {
|
|
218
|
+
if (transitionEnded.value) return
|
|
219
|
+
|
|
220
|
+
transitionEnded.value = true
|
|
221
|
+
if (status.value === 'leave') {
|
|
222
|
+
// 离开后触发
|
|
223
|
+
emit('after-leave')
|
|
224
|
+
} else if (status.value === 'enter') {
|
|
225
|
+
// 进入后触发
|
|
226
|
+
emit('after-enter')
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (!props.show && display.value) {
|
|
230
|
+
display.value = false
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function noop() {}
|
|
235
|
+
</script>
|
|
236
|
+
<style lang="scss">
|
|
237
|
+
@use './index.scss';
|
|
238
|
+
</style>
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 组件级 CSS 变量定义
|
|
5
|
+
// 上传项尺寸
|
|
6
|
+
$upload-size: var(--wot-upload-size, $n-88) !default;
|
|
7
|
+
// 上传项圆角
|
|
8
|
+
$upload-radius: var(--wot-upload-radius, var(--wot-upload-border-radius, $radius-main)) !default;
|
|
9
|
+
// 上传项边框颜色
|
|
10
|
+
$upload-border-color: var(--wot-upload-border-color, $border-main) !default;
|
|
11
|
+
// 唤起项的图标大小
|
|
12
|
+
$upload-evoke-icon-size: var(--wot-upload-evoke-icon-size, $n-32) !default;
|
|
13
|
+
// 唤起项背景色
|
|
14
|
+
$upload-evoke-bg: var(--wot-upload-evoke-bg, $filled-bottom) !default;
|
|
15
|
+
// 唤起项文字颜色
|
|
16
|
+
$upload-evoke-color: var(--wot-upload-evoke-color, $text-auxiliary) !default;
|
|
17
|
+
// 唤起项文字大小
|
|
18
|
+
$upload-evoke-font-size: var(--wot-upload-evoke-font-size, $typography-body-size-main) !default;
|
|
19
|
+
// 唤起项文字行高
|
|
20
|
+
$upload-evoke-line-height: var(--wot-upload-evoke-line-height, $typography-body-line--height-size-main) !default;
|
|
21
|
+
// 唤起项禁用文字颜色
|
|
22
|
+
$upload-evoke-color-disabled: var(--wot-upload-evoke-color-disabled, $text-disabled) !default;
|
|
23
|
+
// 唤起项图标颜色
|
|
24
|
+
$upload-evoke-icon-color: var(--wot-upload-evoke-icon-color, $icon-auxiliary) !default;
|
|
25
|
+
// 唤起项禁用图标颜色
|
|
26
|
+
$upload-evoke-icon-color-disabled: var(--wot-upload-evoke-icon-color-disabled, $icon-disabled) !default;
|
|
27
|
+
// 关闭按钮内边距
|
|
28
|
+
$upload-close-padding: var(--wot-upload-close-padding, $padding-ultra-tight) !default;
|
|
29
|
+
// 关闭按钮圆角
|
|
30
|
+
$upload-close-radius: var(--wot-upload-close-radius, var(--wot-upload-close-border-radius, $radius-zero $radius-zero $radius-zero $radius-main)) !default;
|
|
31
|
+
// 关闭按钮背景色
|
|
32
|
+
$upload-close-bg: var(--wot-upload-close-bg, $opacfilled-main-cover) !default;
|
|
33
|
+
// 关闭按钮图标尺寸
|
|
34
|
+
$upload-close-icon-size: var(--wot-upload-close-icon-size, $n-16) !default;
|
|
35
|
+
// 关闭按钮图标颜色
|
|
36
|
+
$upload-close-icon-color: var(--wot-upload-close-icon-color, $icon-white) !default;
|
|
37
|
+
// 进度文字字号
|
|
38
|
+
$upload-progress-font-size: var(--wot-upload-progress-font-size, $typography-body-size-main) !default;
|
|
39
|
+
// 进度文字行高
|
|
40
|
+
$upload-progress-line-height: var(--wot-upload-progress-line-height, $typography-body-line--height-size-main) !default;
|
|
41
|
+
// 进度文字颜色
|
|
42
|
+
$upload-progress-color: var(--wot-upload-progress-color, $text-white) !default;
|
|
43
|
+
// 文件名文字字号
|
|
44
|
+
$upload-file-font-size: var(--wot-upload-file-font-size, $typography-label-size-main) !default;
|
|
45
|
+
// 文件名文字行高
|
|
46
|
+
$upload-file-line-height: var(--wot-upload-file-line-height, $typography-label-line--height-size-main) !default;
|
|
47
|
+
// 文件名文字颜色
|
|
48
|
+
$upload-file-color: var(--wot-upload-file-color, $text-secondary) !default;
|
|
49
|
+
// 文件/视频名称内边距
|
|
50
|
+
$upload-file-padding: var(--wot-upload-file-padding, $padding-zero $padding-tight) !default;
|
|
51
|
+
// 预览态内部图标尺寸
|
|
52
|
+
$upload-preview-icon-size: var(--wot-upload-preview-icon-size, $n-24) !default;
|
|
53
|
+
// 预览态内部图标颜色
|
|
54
|
+
$upload-preview-icon-color: var(--wot-upload-preview-icon-color, $icon-white) !default;
|
|
55
|
+
// 预览项外边距
|
|
56
|
+
$upload-preview-margin: var(--wot-upload-preview-margin, $spacing-zero $spacing-tight $spacing-tight $spacing-zero) !default;
|
|
57
|
+
// 视频/文件图标尺寸
|
|
58
|
+
$upload-cover-icon-size: var(--wot-upload-cover-icon-size, $n-24) !default;
|
|
59
|
+
// 视频图标尺寸
|
|
60
|
+
$upload-video-icon-size: var(--wot-upload-video-icon-size, $n-24) !default;
|
|
61
|
+
// 视频播放图标颜色
|
|
62
|
+
$upload-video-icon-color: var(--wot-upload-video-icon-color, $icon-white) !default;
|
|
63
|
+
// 遮罩层背景色
|
|
64
|
+
$upload-mask-bg: var(--wot-upload-mask-bg, $opacfilled-main-cover) !default;
|
|
65
|
+
// 上传项行间距
|
|
66
|
+
$upload-row-spacing: var(--wot-upload-row-spacing, $spacing-tight) !default;
|
|
67
|
+
|
|
68
|
+
@include b(upload) {
|
|
69
|
+
position: relative;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
|
|
73
|
+
@include e(evoke) {
|
|
74
|
+
position: relative;
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
width: $upload-size;
|
|
80
|
+
height: $upload-size;
|
|
81
|
+
border-radius: $upload-radius;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
background: $upload-evoke-bg;
|
|
84
|
+
margin-bottom: $upload-row-spacing;
|
|
85
|
+
@include pixelBorderSurround($upload-border-color, dashed);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@include when(disabled) {
|
|
89
|
+
color: $upload-evoke-color-disabled;
|
|
90
|
+
|
|
91
|
+
:deep(.wd-upload__evoke-icon) {
|
|
92
|
+
color: $upload-evoke-icon-color-disabled;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@include e(evoke-num) {
|
|
98
|
+
color: $upload-evoke-color;
|
|
99
|
+
font-size: $upload-evoke-font-size;
|
|
100
|
+
line-height: $upload-evoke-line-height;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@include edeep(evoke-icon) {
|
|
104
|
+
font-size: $upload-evoke-icon-size;
|
|
105
|
+
color: $upload-evoke-icon-color;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@include e(preview) {
|
|
109
|
+
position: relative;
|
|
110
|
+
width: $upload-size;
|
|
111
|
+
height: $upload-size;
|
|
112
|
+
border-radius: $upload-radius;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
margin: $upload-preview-margin;
|
|
115
|
+
@include pixelBorderSurround($upload-border-color);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@include e(preview-list) {
|
|
119
|
+
display: flex;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@include e(picture, file, video) {
|
|
123
|
+
position: relative;
|
|
124
|
+
display: block;
|
|
125
|
+
width: 100%;
|
|
126
|
+
height: 100%;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@include e(file, video) {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
background-color: $upload-evoke-bg;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@include e(video-icon, file-icon) {
|
|
138
|
+
font-size: $upload-cover-icon-size;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@include e(file-name, video-name) {
|
|
142
|
+
width: 100%;
|
|
143
|
+
font-size: $upload-file-font-size;
|
|
144
|
+
line-height: $upload-file-line-height;
|
|
145
|
+
color: $upload-file-color;
|
|
146
|
+
box-sizing: border-box;
|
|
147
|
+
text-align: center;
|
|
148
|
+
padding: $upload-file-padding;
|
|
149
|
+
@include lineEllipsis()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@include edeep(video-play) {
|
|
153
|
+
position: absolute;
|
|
154
|
+
top: 50%;
|
|
155
|
+
left: 50%;
|
|
156
|
+
transform: translate(-50%, -50%);
|
|
157
|
+
font-size: $upload-video-icon-size;
|
|
158
|
+
color: $upload-video-icon-color;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@include e(close) {
|
|
162
|
+
position: absolute;
|
|
163
|
+
right: 0;
|
|
164
|
+
top: 0;
|
|
165
|
+
padding: $upload-close-padding;
|
|
166
|
+
border-radius: $upload-close-radius;
|
|
167
|
+
background: $upload-close-bg;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@include edeep(close-icon) {
|
|
171
|
+
display: flex;
|
|
172
|
+
color: $upload-close-icon-color;
|
|
173
|
+
font-size: $upload-close-icon-size;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@include e(mask) {
|
|
177
|
+
position: absolute;
|
|
178
|
+
top: 0;
|
|
179
|
+
left: 0;
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 100%;
|
|
182
|
+
background: $upload-mask-bg;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@include e(progress-txt) {
|
|
186
|
+
font-size: $upload-progress-font-size;
|
|
187
|
+
line-height: $upload-progress-line-height;
|
|
188
|
+
color: $upload-progress-color;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@include edeep(icon) {
|
|
192
|
+
font-size: $upload-preview-icon-size;
|
|
193
|
+
color: $upload-preview-icon-color;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@include e(status-content) {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
justify-content: center;
|
|
200
|
+
align-items: center;
|
|
201
|
+
width: 100%;
|
|
202
|
+
height: 100%;
|
|
203
|
+
}
|
|
204
|
+
}
|