@wot-ui/ui 1.0.0 → 2.0.0-alpha.4
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 +63 -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 +2061 -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/index.ts +2 -0
- package/components/wd-form/types.ts +133 -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 +16 -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 +6 -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,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wd-overlay v-if="cover" :z-index="zIndex" lock-scroll :show="show" custom-style="background-color: transparent;pointer-events: auto;"></wd-overlay>
|
|
3
|
+
<wd-transition name="fade" :show="show" :custom-style="transitionStyle" @after-enter="handleAfterEnter" @after-leave="handleAfterLeave">
|
|
4
|
+
<view :class="rootClass">
|
|
5
|
+
<!--iconName优先级更高-->
|
|
6
|
+
<wd-loading
|
|
7
|
+
v-if="iconName === 'loading'"
|
|
8
|
+
:type="loadingType"
|
|
9
|
+
:color="loadingColor"
|
|
10
|
+
:size="loadingSize"
|
|
11
|
+
:custom-class="`wd-toast__icon ${direction === 'vertical' ? 'is-vertical' : ''}`"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<wd-icon
|
|
15
|
+
v-else-if="iconName === 'success' || iconName === 'warning' || iconName === 'info' || iconName === 'error'"
|
|
16
|
+
:custom-class="`wd-toast__icon ${direction === 'vertical' ? 'is-vertical' : ''}`"
|
|
17
|
+
:size="iconSize"
|
|
18
|
+
:class-prefix="classPrefix"
|
|
19
|
+
:name="toastIcon[iconName]"
|
|
20
|
+
></wd-icon>
|
|
21
|
+
<wd-icon
|
|
22
|
+
v-else-if="iconClass"
|
|
23
|
+
:custom-class="`wd-toast__icon ${direction === 'vertical' ? 'is-vertical' : ''}`"
|
|
24
|
+
:size="iconSize"
|
|
25
|
+
:class-prefix="classPrefix"
|
|
26
|
+
:name="iconClass"
|
|
27
|
+
></wd-icon>
|
|
28
|
+
<!--文本-->
|
|
29
|
+
<view v-if="msg" :class="`wd-toast__msg ${direction === 'vertical' ? 'is-vertical' : ''}`">{{ msg }}</view>
|
|
30
|
+
</view>
|
|
31
|
+
</wd-transition>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
export default {
|
|
36
|
+
name: 'wd-toast',
|
|
37
|
+
options: {
|
|
38
|
+
addGlobalClass: true,
|
|
39
|
+
// #ifndef MP-TOUTIAO
|
|
40
|
+
virtualHost: true,
|
|
41
|
+
// #endif
|
|
42
|
+
styleIsolation: 'shared'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script lang="ts" setup>
|
|
48
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
49
|
+
import wdLoading from '../wd-loading/wd-loading.vue'
|
|
50
|
+
import wdOverlay from '../wd-overlay/wd-overlay.vue'
|
|
51
|
+
import wdTransition from '../wd-transition/wd-transition.vue'
|
|
52
|
+
|
|
53
|
+
import { computed, inject, ref, watch, type CSSProperties } from 'vue'
|
|
54
|
+
import { defaultOptions, getToastOptionKey, toastIcon } from '.'
|
|
55
|
+
import { toastProps, type ToastDirection, type ToastLoadingType, type ToastOptions, type ToastProps } from './types'
|
|
56
|
+
import { addUnit, isDef, isFunction, objToStyle } from '../../common/util'
|
|
57
|
+
|
|
58
|
+
const props = defineProps(toastProps)
|
|
59
|
+
const iconName = ref<string>('') // 图标类型
|
|
60
|
+
const msg = ref<string>('') // 消息内容
|
|
61
|
+
const position = ref<string>('middle')
|
|
62
|
+
const show = ref<boolean>(false)
|
|
63
|
+
const zIndex = ref<number>(100)
|
|
64
|
+
const loadingType = ref<ToastLoadingType>('circular')
|
|
65
|
+
const loadingColor = ref<string>('#fff')
|
|
66
|
+
const iconSize = ref<string>() // 图标大小
|
|
67
|
+
const loadingSize = ref<string>() // loading大小
|
|
68
|
+
const cover = ref<boolean>(false) // 是否存在遮罩层
|
|
69
|
+
const classPrefix = ref<string>('wd-icon') // 图标前缀
|
|
70
|
+
const iconClass = ref<string>('') // 图标类名
|
|
71
|
+
const direction = ref<ToastDirection>('horizontal') // toast布局方向
|
|
72
|
+
|
|
73
|
+
let opened: (() => void) | null = null
|
|
74
|
+
|
|
75
|
+
let closed: (() => void) | null = null
|
|
76
|
+
|
|
77
|
+
const toastOptionKey = getToastOptionKey(props.selector)
|
|
78
|
+
const toastOption = inject(toastOptionKey, ref<ToastOptions>(defaultOptions)) // toast选项
|
|
79
|
+
|
|
80
|
+
// 监听options变化展示
|
|
81
|
+
watch(
|
|
82
|
+
() => toastOption.value,
|
|
83
|
+
(newVal: ToastOptions) => {
|
|
84
|
+
reset(newVal)
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
deep: true,
|
|
88
|
+
immediate: true
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 动画自定义样式
|
|
94
|
+
*/
|
|
95
|
+
const transitionStyle = computed(() => {
|
|
96
|
+
const style: CSSProperties = {
|
|
97
|
+
'z-index': zIndex.value,
|
|
98
|
+
position: 'fixed',
|
|
99
|
+
top: '50%',
|
|
100
|
+
left: 0,
|
|
101
|
+
width: '100%',
|
|
102
|
+
// transform: 'translate(0, -50%)',
|
|
103
|
+
'text-align': 'center',
|
|
104
|
+
'pointer-events': 'none'
|
|
105
|
+
}
|
|
106
|
+
return objToStyle(style)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const rootClass = computed(() => {
|
|
110
|
+
return `wd-toast ${props.customClass} wd-toast--${position.value} ${
|
|
111
|
+
(iconName.value !== 'loading' || msg.value) && (iconName.value || iconClass.value) ? 'wd-toast--with-icon' : ''
|
|
112
|
+
} ${iconName.value === 'loading' && !msg.value ? 'wd-toast--loading' : ''} ${direction.value === 'vertical' ? 'is-vertical' : ''}`
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
function handleAfterEnter() {
|
|
116
|
+
if (isFunction(opened)) {
|
|
117
|
+
opened()
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function handleAfterLeave() {
|
|
122
|
+
if (isFunction(closed)) {
|
|
123
|
+
closed()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 重置toast选项值
|
|
129
|
+
* @param option toast选项值
|
|
130
|
+
*/
|
|
131
|
+
function reset(option: ToastOptions) {
|
|
132
|
+
show.value = isDef(option.show) ? option.show : false
|
|
133
|
+
|
|
134
|
+
if (show.value) {
|
|
135
|
+
mergeOptionsWithProps(option, props)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function mergeOptionsWithProps(option: ToastOptions, props: ToastProps) {
|
|
140
|
+
iconName.value = isDef(option.iconName!) ? option.iconName! : props.iconName
|
|
141
|
+
iconClass.value = isDef(option.iconClass!) ? option.iconClass! : props.iconClass
|
|
142
|
+
msg.value = isDef(option.msg!) ? option.msg! : props.msg
|
|
143
|
+
position.value = isDef(option.position!) ? option.position! : props.position
|
|
144
|
+
zIndex.value = isDef(option.zIndex!) ? option.zIndex! : props.zIndex
|
|
145
|
+
loadingType.value = isDef(option.loadingType!) ? option.loadingType! : props.loadingType
|
|
146
|
+
loadingColor.value = isDef(option.loadingColor!) ? option.loadingColor! : props.loadingColor
|
|
147
|
+
iconSize.value = isDef(option.iconSize) ? addUnit(option.iconSize) : isDef(props.iconSize) ? addUnit(props.iconSize) : undefined
|
|
148
|
+
loadingSize.value = isDef(option.loadingSize) ? addUnit(option.loadingSize) : isDef(props.loadingSize) ? addUnit(props.loadingSize) : undefined
|
|
149
|
+
cover.value = isDef(option.cover!) ? option.cover! : props.cover
|
|
150
|
+
classPrefix.value = isDef(option.classPrefix) ? option.classPrefix : props.classPrefix
|
|
151
|
+
direction.value = isDef(option.direction) ? option.direction : props.direction
|
|
152
|
+
closed = isFunction(option.closed) ? option.closed : isFunction(props.closed) ? props.closed : null
|
|
153
|
+
opened = isFunction(option.opened) ? option.opened : isFunction(props.opened) ? props.opened : null
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
<style lang="scss">
|
|
157
|
+
@use './index.scss';
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 背景色
|
|
5
|
+
$tooltip-bg: var(--wot-tooltip-bg, $filled-oppo) !default;
|
|
6
|
+
// 文字颜色
|
|
7
|
+
$tooltip-color: var(--wot-tooltip-color, $text-secondary) !default;
|
|
8
|
+
// 阴影效果
|
|
9
|
+
$tooltip-box-shadow: var(--wot-tooltip-box-shadow, 0 12px 48px 16px rgba(39, 43, 59, 0.03), 0 9px 28px 8px rgba(39, 43, 59, 0.05), 0 5px 12px 4px rgba(39, 43, 59, 0.06)) !default;
|
|
10
|
+
// 箭头阴影效果
|
|
11
|
+
$tooltip-arrow-box-shadow: var(--wot-tooltip-arrow-box-shadow, 0 12px 48px 16px rgba(39, 43, 59, 0.03), 0 9px 28px 8px rgba(39, 43, 59, 0.05), 0 5px 12px 4px rgba(39, 43, 59, 0.06)) !default;
|
|
12
|
+
// 圆角大小
|
|
13
|
+
$tooltip-radius: var(--wot-tooltip-radius, $radius-main) !default;
|
|
14
|
+
// 箭头大小
|
|
15
|
+
$tooltip-arrow-size: var(--wot-tooltip-arrow-size, $n-8) !default;
|
|
16
|
+
// 字号
|
|
17
|
+
$tooltip-font-size: var(--wot-tooltip-font-size, $typography-body-size-main) !default;
|
|
18
|
+
// 内边距
|
|
19
|
+
$tooltip-padding: var(--wot-tooltip-padding, $padding-loose) !default;
|
|
20
|
+
// 关闭按钮大小
|
|
21
|
+
$tooltip-close-icon-size: var(--wot-tooltip-close-icon-size, $n-12) !default;
|
|
22
|
+
// 关闭按钮颜色
|
|
23
|
+
$tooltip-close-icon-color: var(--wot-tooltip-close-icon-color, $icon-secondary) !default;
|
|
24
|
+
// 关闭按钮内边距
|
|
25
|
+
$tooltip-close-icon-padding: var(--wot-tooltip-close-icon-padding, $padding-super-tight) !default;
|
|
26
|
+
// 层级
|
|
27
|
+
$tooltip-z-index: var(--wot-tooltip-z-index, 500) !default;
|
|
28
|
+
// 行高
|
|
29
|
+
$tooltip-line-height: var(--wot-tooltip-line-height, $typography-body-line--height-size-main) !default;
|
|
30
|
+
|
|
31
|
+
@include b(tooltip) {
|
|
32
|
+
position: relative;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
|
|
35
|
+
@include edeep(pos) {
|
|
36
|
+
position: absolute;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
min-width: 138px;
|
|
39
|
+
background-clip: padding-box;
|
|
40
|
+
z-index: $tooltip-z-index;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@include e(hidden) {
|
|
44
|
+
left: -100vw;
|
|
45
|
+
bottom: -100vh;
|
|
46
|
+
visibility: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@include e(container) {
|
|
50
|
+
position: relative;
|
|
51
|
+
z-index: $tooltip-z-index;
|
|
52
|
+
box-shadow: $tooltip-box-shadow;
|
|
53
|
+
border-radius: $tooltip-radius;
|
|
54
|
+
background: $tooltip-bg;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@include e(inner) {
|
|
58
|
+
position: relative;
|
|
59
|
+
padding: $tooltip-padding;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
line-height: $tooltip-line-height;
|
|
62
|
+
font-size: $tooltip-font-size;
|
|
63
|
+
text-align: center;
|
|
64
|
+
color: $tooltip-color;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include edeep(close-icon) {
|
|
68
|
+
position: absolute;
|
|
69
|
+
right: 0;
|
|
70
|
+
top: 0;
|
|
71
|
+
font-size: $tooltip-close-icon-size;
|
|
72
|
+
padding: $tooltip-close-icon-padding;
|
|
73
|
+
color: $tooltip-close-icon-color;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@include triangleArrow($tooltip-arrow-size, $tooltip-bg);
|
|
77
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2025-05-08 22:54:27
|
|
4
|
+
* @LastEditTime: 2026-03-04 11:02:59
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-tooltip/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeStringProp } from '../../common/props'
|
|
12
|
+
import type { PlacementType, PopoverOffset } from '../../composables/usePopover'
|
|
13
|
+
|
|
14
|
+
export type { PlacementType, PopoverOffset }
|
|
15
|
+
|
|
16
|
+
export const tooltipProps = {
|
|
17
|
+
...baseProps,
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 自定义箭头样式类名
|
|
21
|
+
* 类型: string
|
|
22
|
+
* 默认值: ''
|
|
23
|
+
*/
|
|
24
|
+
customArrow: makeStringProp(''),
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 自定义弹出层样式类名
|
|
28
|
+
* 类型: string
|
|
29
|
+
* 默认值: ''
|
|
30
|
+
*/
|
|
31
|
+
customPop: makeStringProp(''),
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 是否显示 Tooltip 箭头
|
|
35
|
+
* 类型: boolean
|
|
36
|
+
* 默认值: true
|
|
37
|
+
*/
|
|
38
|
+
visibleArrow: makeBooleanProp(true),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 显示的内容,也可以通过 slot#content 传入
|
|
42
|
+
* 类型: string | Array<Record<string, any>>
|
|
43
|
+
* 默认值: -
|
|
44
|
+
*/
|
|
45
|
+
content: {
|
|
46
|
+
type: [String, Array] as PropType<string | Array<Record<string, any>>>
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Tooltip 的出现位置
|
|
51
|
+
* 类型: string
|
|
52
|
+
* 可选值: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'
|
|
53
|
+
* 默认值: 'bottom'
|
|
54
|
+
*/
|
|
55
|
+
placement: makeStringProp<PlacementType>('bottom'),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 出现位置的偏移量
|
|
59
|
+
* 类型: number | number[] | { x: number; y: number }
|
|
60
|
+
* 默认值: 0
|
|
61
|
+
*/
|
|
62
|
+
offset: {
|
|
63
|
+
type: [Number, Array, Object] as PropType<PopoverOffset>,
|
|
64
|
+
default: 0
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Tooltip 是否禁用
|
|
68
|
+
* 类型: boolean
|
|
69
|
+
* 默认值: false
|
|
70
|
+
*/
|
|
71
|
+
disabled: makeBooleanProp(false),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 是否显示关闭按钮
|
|
75
|
+
* 类型: boolean
|
|
76
|
+
* 默认值: false
|
|
77
|
+
*/
|
|
78
|
+
showClose: makeBooleanProp(false),
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Tooltip 的显示状态,通过 v-model 绑定
|
|
82
|
+
* 类型: boolean
|
|
83
|
+
* 默认值: false
|
|
84
|
+
*/
|
|
85
|
+
modelValue: makeBooleanProp(false)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type TooltipProps = ExtractPropTypes<typeof tooltipProps>
|
|
89
|
+
|
|
90
|
+
export type TooltipExpose = {
|
|
91
|
+
/**
|
|
92
|
+
* 打开 tooltip
|
|
93
|
+
*/
|
|
94
|
+
open: () => void
|
|
95
|
+
/**
|
|
96
|
+
* 关闭 tooltip
|
|
97
|
+
*/
|
|
98
|
+
close: () => void
|
|
99
|
+
/**
|
|
100
|
+
* 重新测量弹出层尺寸并更新定位(用于 content 插槽场景)
|
|
101
|
+
*/
|
|
102
|
+
updatePosition: () => void
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type TooltipInstance = ComponentPublicInstance<TooltipProps, TooltipExpose>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`wd-tooltip ${customClass}`" :style="customStyle" id="tooltip" @click.stop>
|
|
3
|
+
<view class="wd-tooltip__pos wd-tooltip__hidden" id="pos">
|
|
4
|
+
<view :class="`wd-tooltip__container ${customPop}`">
|
|
5
|
+
<view v-if="!$slots.content" class="wd-tooltip__inner">{{ content }}</view>
|
|
6
|
+
</view>
|
|
7
|
+
</view>
|
|
8
|
+
<wd-transition
|
|
9
|
+
custom-class="wd-tooltip__pos"
|
|
10
|
+
:custom-style="popover.popStyle.value"
|
|
11
|
+
:show="showTooltip"
|
|
12
|
+
name="fade"
|
|
13
|
+
:duration="200"
|
|
14
|
+
@after-enter="handleAfterEnter"
|
|
15
|
+
>
|
|
16
|
+
<view :class="`wd-tooltip__container ${customPop}`" id="content">
|
|
17
|
+
<view v-if="visibleArrow" :class="`wd-tooltip__arrow ${popover.arrowClass.value} ${customArrow}`" :style="popover.arrowStyle.value"></view>
|
|
18
|
+
<slot name="content">
|
|
19
|
+
<view class="wd-tooltip__inner">{{ content }}</view>
|
|
20
|
+
</slot>
|
|
21
|
+
<wd-icon v-if="showClose" name="close" custom-class="wd-tooltip__close-icon" @click="toggle"></wd-icon>
|
|
22
|
+
</view>
|
|
23
|
+
</wd-transition>
|
|
24
|
+
<view @click="toggle" class="wd-tooltip__target" id="target">
|
|
25
|
+
<slot />
|
|
26
|
+
</view>
|
|
27
|
+
</view>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
export default {
|
|
32
|
+
name: 'wd-tooltip',
|
|
33
|
+
options: {
|
|
34
|
+
addGlobalClass: true,
|
|
35
|
+
// #ifndef MP-TOUTIAO
|
|
36
|
+
virtualHost: true,
|
|
37
|
+
// #endif
|
|
38
|
+
styleIsolation: 'shared'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script lang="ts" setup>
|
|
44
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
45
|
+
import wdTransition from '../wd-transition/wd-transition.vue'
|
|
46
|
+
import { getCurrentInstance, inject, onBeforeMount, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
47
|
+
import { usePopover } from '../../composables/usePopover'
|
|
48
|
+
import { closeOther, pushToQueue, removeFromQueue } from '../../common/clickoutside'
|
|
49
|
+
import { type Queue, queueKey } from '../../composables/useQueue'
|
|
50
|
+
import { tooltipProps, type TooltipExpose } from './types'
|
|
51
|
+
|
|
52
|
+
const props = defineProps(tooltipProps)
|
|
53
|
+
const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'close'])
|
|
54
|
+
|
|
55
|
+
const popover = usePopover(props.visibleArrow)
|
|
56
|
+
const queue = inject<Queue | null>(queueKey, null)
|
|
57
|
+
const selector: string = 'tooltip'
|
|
58
|
+
const { proxy } = getCurrentInstance() as any
|
|
59
|
+
const showTooltip = ref<boolean>(false) // 控制tooltip显隐
|
|
60
|
+
|
|
61
|
+
watch(
|
|
62
|
+
() => props.content,
|
|
63
|
+
(newVal) => {
|
|
64
|
+
if (newVal === null || newVal === undefined) {
|
|
65
|
+
// eslint-disable-next-line prettier/prettier
|
|
66
|
+
console.error('[wot-design] warning(wd-tooltip): content can\'t be null or undefined')
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
watch(
|
|
72
|
+
() => props.placement,
|
|
73
|
+
() => {
|
|
74
|
+
popover.init(props.placement, props.visibleArrow, selector)
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
watch(
|
|
79
|
+
() => props.modelValue,
|
|
80
|
+
(newValue) => {
|
|
81
|
+
showTooltip.value = newValue
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
watch(
|
|
86
|
+
() => showTooltip.value,
|
|
87
|
+
(newValue) => {
|
|
88
|
+
if (newValue) {
|
|
89
|
+
popover.control(props.placement, props.offset)
|
|
90
|
+
if (queue && queue.closeOther) {
|
|
91
|
+
queue.closeOther(proxy)
|
|
92
|
+
} else {
|
|
93
|
+
closeOther(proxy)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
popover.showStyle.value = newValue ? 'display: inline-block;' : 'display: none;'
|
|
97
|
+
emit('change', { show: newValue })
|
|
98
|
+
emit(`${newValue ? 'open' : 'close'}`)
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
onMounted(() => {
|
|
103
|
+
popover.init(props.placement, props.visibleArrow, selector)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
onBeforeMount(() => {
|
|
107
|
+
if (queue && queue.pushToQueue) {
|
|
108
|
+
queue.pushToQueue(proxy)
|
|
109
|
+
} else {
|
|
110
|
+
pushToQueue(proxy)
|
|
111
|
+
}
|
|
112
|
+
popover.showStyle.value = props.modelValue ? 'display: inline-block;' : 'display: none;'
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
onBeforeUnmount(() => {
|
|
116
|
+
if (queue && queue.removeFromQueue) {
|
|
117
|
+
queue.removeFromQueue(proxy)
|
|
118
|
+
} else {
|
|
119
|
+
removeFromQueue(proxy)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 切换 tooltip 的显示状态
|
|
125
|
+
*/
|
|
126
|
+
function toggle() {
|
|
127
|
+
if (props.disabled) return
|
|
128
|
+
updateModelValue(!showTooltip.value)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 打开 tooltip
|
|
133
|
+
*/
|
|
134
|
+
function open() {
|
|
135
|
+
updateModelValue(true)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 关闭 tooltip
|
|
140
|
+
*/
|
|
141
|
+
function close() {
|
|
142
|
+
updateModelValue(false)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 过渡动画完成后重新测量弹出层尺寸并更新定位
|
|
147
|
+
*/
|
|
148
|
+
function handleAfterEnter() {
|
|
149
|
+
popover.updatePosition(props.placement, props.offset)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 更新 tooltip 显示状态
|
|
154
|
+
* @param {boolean} value 显示状态
|
|
155
|
+
*/
|
|
156
|
+
function updateModelValue(value: boolean) {
|
|
157
|
+
showTooltip.value = value
|
|
158
|
+
emit('update:modelValue', value)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
defineExpose<TooltipExpose>({
|
|
162
|
+
open,
|
|
163
|
+
close,
|
|
164
|
+
updatePosition: () => popover.updatePosition(props.placement, props.offset)
|
|
165
|
+
})
|
|
166
|
+
</script>
|
|
167
|
+
<style lang="scss">
|
|
168
|
+
@use './index.scss';
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 层级
|
|
5
|
+
$tour-z-index: var(--wot-tour-z-index, 999) !default;
|
|
6
|
+
// 动画时长
|
|
7
|
+
$tour-animation-duration: var(--wot-tour-animation-duration, 0.3s) !default;
|
|
8
|
+
// 高亮动画时间函数
|
|
9
|
+
$tour-highlight-animation-timing: var(--wot-tour-highlight-animation-timing, ease-in-out) !default;
|
|
10
|
+
// 高亮区域阴影颜色
|
|
11
|
+
$tour-highlight-shadow-color: var(--wot-tour-highlight-shadow-color, $opac-7_55) !default;
|
|
12
|
+
// 弹层层级
|
|
13
|
+
$tour-popover-z-index: var(--wot-tour-popover-z-index, 1000) !default;
|
|
14
|
+
// 弹层最大宽度
|
|
15
|
+
$tour-popover-max-width: var(--wot-tour-popover-max-width, calc($n-1 * 340)) !default;
|
|
16
|
+
// 弹层最小宽度
|
|
17
|
+
$tour-popover-min-width: var(--wot-tour-popover-min-width, calc($n-1 * 200)) !default;
|
|
18
|
+
// 弹层背景色
|
|
19
|
+
$tour-popover-bg: var(--wot-tour-popover-bg, $filled-oppo) !default;
|
|
20
|
+
// 弹层内边距
|
|
21
|
+
$tour-popover-padding: var(--wot-tour-popover-padding, $padding-loose) !default;
|
|
22
|
+
// 弹层圆角
|
|
23
|
+
$tour-popover-radius: var(--wot-tour-popover-radius, $radius-main) !default;
|
|
24
|
+
// 信息框字号
|
|
25
|
+
$tour-info-font-size: var(--wot-tour-info-font-size, $typography-body-size-main) !default;
|
|
26
|
+
// 信息框行高
|
|
27
|
+
$tour-info-line-height: var(--wot-tour-info-line-height, $typography-body-line--height-size-main) !default;
|
|
28
|
+
// 信息框文字颜色
|
|
29
|
+
$tour-info-color: var(--wot-tour-info-color, $text-main) !default;
|
|
30
|
+
// 操作区域上边距
|
|
31
|
+
$tour-buttons-margin-top: var(--wot-tour-buttons-margin-top, $spacing-tight) !default;
|
|
32
|
+
|
|
33
|
+
@include b(tour) {
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: 0;
|
|
36
|
+
bottom: 0;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
z-index: $tour-z-index;
|
|
40
|
+
|
|
41
|
+
@include e(mask) {
|
|
42
|
+
position: fixed;
|
|
43
|
+
top: 0;
|
|
44
|
+
bottom: 0;
|
|
45
|
+
left: 0;
|
|
46
|
+
right: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@include e(highlight) {
|
|
50
|
+
position: fixed;
|
|
51
|
+
background: transparent;
|
|
52
|
+
box-sizing: content-box;
|
|
53
|
+
animation: tour-show $tour-animation-duration $tour-highlight-animation-timing;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
width: 100vw;
|
|
57
|
+
height: 0;
|
|
58
|
+
border-radius: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
|
|
61
|
+
@include m(mask) {
|
|
62
|
+
box-shadow: 0 0 0 100vh $tour-highlight-shadow-color;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@include e(popover) {
|
|
67
|
+
z-index: $tour-popover-z-index;
|
|
68
|
+
position: fixed;
|
|
69
|
+
left: 50%;
|
|
70
|
+
transform: translateX(-50%);
|
|
71
|
+
max-width: $tour-popover-max-width;
|
|
72
|
+
text-align: center;
|
|
73
|
+
transition: $tour-animation-duration all;
|
|
74
|
+
background-color: $tour-popover-bg;
|
|
75
|
+
padding: $tour-popover-padding;
|
|
76
|
+
border-radius: $tour-popover-radius;
|
|
77
|
+
width: fit-content;
|
|
78
|
+
min-width: $tour-popover-min-width;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include e(info) {
|
|
82
|
+
font-size: $tour-info-font-size;
|
|
83
|
+
line-height: $tour-info-line-height;
|
|
84
|
+
color: $tour-info-color;
|
|
85
|
+
width: fit-content;
|
|
86
|
+
text-align: left;
|
|
87
|
+
word-break: break-all;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@include e(buttons) {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: flex-end;
|
|
93
|
+
align-items: center;
|
|
94
|
+
margin-top: $tour-buttons-margin-top;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes tour-show {
|
|
99
|
+
0% {
|
|
100
|
+
opacity: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
100% {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
}
|
|
106
|
+
}
|