@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,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :data-theme="theme" :class="themeClass" :style="rootStyle">
|
|
3
|
+
<slot />
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'wd-config-provider',
|
|
10
|
+
options: {
|
|
11
|
+
// #ifndef MP-TOUTIAO
|
|
12
|
+
virtualHost: true,
|
|
13
|
+
// #endif
|
|
14
|
+
addGlobalClass: true,
|
|
15
|
+
styleIsolation: 'shared'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { computed, inject } from 'vue'
|
|
22
|
+
import { configProviderProps, CONFIG_PROVIDER_KEY, type ConfigProviderProvide } from './types'
|
|
23
|
+
import { objToStyle } from '../../common/util'
|
|
24
|
+
import { useChildren } from '../../composables/useChildren'
|
|
25
|
+
import { mapThemeVarsToCSSVars } from '../../composables/useConfigProvider'
|
|
26
|
+
import { USE_CONFIG_PROVIDER_KEY } from '../../composables/useConfigProvider'
|
|
27
|
+
|
|
28
|
+
const None = Symbol('None')
|
|
29
|
+
const hooksProvider = inject<ConfigProviderProvide | typeof None>(USE_CONFIG_PROVIDER_KEY, None)
|
|
30
|
+
const props = defineProps(configProviderProps)
|
|
31
|
+
|
|
32
|
+
const { linkChildren } = useChildren(CONFIG_PROVIDER_KEY)
|
|
33
|
+
|
|
34
|
+
const themeClass = computed(() => {
|
|
35
|
+
return `wot-theme-${props.theme} ${props.customClass}`
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const theme = computed(() => props.theme)
|
|
39
|
+
|
|
40
|
+
const themeStyle = computed(() => {
|
|
41
|
+
if (hooksProvider !== None) {
|
|
42
|
+
return hooksProvider.themeStyle.value
|
|
43
|
+
}
|
|
44
|
+
const styleObj = mapThemeVarsToCSSVars(props.themeVars)
|
|
45
|
+
return styleObj ? `${objToStyle(styleObj)}` : ''
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const rootStyle = computed(() => {
|
|
49
|
+
const style = `${themeStyle.value}${props.customStyle}`
|
|
50
|
+
return style
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
linkChildren({
|
|
54
|
+
theme,
|
|
55
|
+
themeStyle
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style lang="scss">
|
|
60
|
+
@use './index.scss';
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
2
|
+
@use '../../styles/variable.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 倒计时文本颜色
|
|
5
|
+
$count-down-text-color: var(--wot-count-down-text-color, $text-main) !default;
|
|
6
|
+
// 倒计时文本字号
|
|
7
|
+
$count-down-font-size: var(--wot-count-down-font-size, $typography-body-size-main) !default;
|
|
8
|
+
// 倒计时文本行高
|
|
9
|
+
$count-down-line-height: var(--wot-count-down-line-height, $typography-body-line--height-size-main) !default;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@include b(count-down) {
|
|
13
|
+
color: $count-down-text-color;
|
|
14
|
+
font-size: $count-down-font-size;
|
|
15
|
+
line-height: $count-down-line-height;
|
|
16
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2025-05-08 22:54:27
|
|
4
|
+
* @LastEditTime: 2026-01-23 15:03:28
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-count-down/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeRequiredProp, makeStringProp } from '../../common/props'
|
|
12
|
+
|
|
13
|
+
export const countDownProps = {
|
|
14
|
+
...baseProps,
|
|
15
|
+
/**
|
|
16
|
+
* 倒计时时长
|
|
17
|
+
* 类型: number
|
|
18
|
+
* 默认值: 0
|
|
19
|
+
*/
|
|
20
|
+
time: makeRequiredProp(Number),
|
|
21
|
+
/**
|
|
22
|
+
* 是否开启毫秒
|
|
23
|
+
* 类型: boolean
|
|
24
|
+
* 默认值: false
|
|
25
|
+
*/
|
|
26
|
+
millisecond: makeBooleanProp(false),
|
|
27
|
+
/**
|
|
28
|
+
* 格式化时间
|
|
29
|
+
* 类型: string
|
|
30
|
+
* 默认值: HH:mm:ss
|
|
31
|
+
*/
|
|
32
|
+
format: makeStringProp('HH:mm:ss'),
|
|
33
|
+
/**
|
|
34
|
+
* 是否自动开始
|
|
35
|
+
* 类型: boolean
|
|
36
|
+
* 默认值: true
|
|
37
|
+
*/
|
|
38
|
+
autoStart: makeBooleanProp(true)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type CountDownProps = ExtractPropTypes<typeof countDownProps>
|
|
42
|
+
|
|
43
|
+
export type CountDownExpose = {
|
|
44
|
+
/**
|
|
45
|
+
* 开始倒计时
|
|
46
|
+
*/
|
|
47
|
+
start: () => void
|
|
48
|
+
/**
|
|
49
|
+
* 暂停倒计时
|
|
50
|
+
*/
|
|
51
|
+
pause: () => void
|
|
52
|
+
/**
|
|
53
|
+
* 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
|
|
54
|
+
*/
|
|
55
|
+
reset: () => void
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type CountDownInstance = ComponentPublicInstance<CountDownProps, CountDownExpose>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { padZero } from '../../common/util'
|
|
2
|
+
|
|
3
|
+
export type TimeData = {
|
|
4
|
+
days: number
|
|
5
|
+
hours: number
|
|
6
|
+
minutes: number
|
|
7
|
+
seconds: number
|
|
8
|
+
milliseconds: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function parseFormat(format: string, timeData: TimeData): string {
|
|
12
|
+
const { days } = timeData
|
|
13
|
+
let { hours, minutes, seconds, milliseconds } = timeData
|
|
14
|
+
|
|
15
|
+
if (format.includes('DD')) {
|
|
16
|
+
format = format.replace('DD', padZero(days))
|
|
17
|
+
} else {
|
|
18
|
+
hours += days * 24
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (format.includes('HH')) {
|
|
22
|
+
format = format.replace('HH', padZero(hours))
|
|
23
|
+
} else {
|
|
24
|
+
minutes += hours * 60
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (format.includes('mm')) {
|
|
28
|
+
format = format.replace('mm', padZero(minutes))
|
|
29
|
+
} else {
|
|
30
|
+
seconds += minutes * 60
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (format.includes('ss')) {
|
|
34
|
+
format = format.replace('ss', padZero(seconds))
|
|
35
|
+
} else {
|
|
36
|
+
milliseconds += seconds * 1000
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (format.includes('S')) {
|
|
40
|
+
const ms = padZero(milliseconds, 3)
|
|
41
|
+
|
|
42
|
+
if (format.includes('SSS')) {
|
|
43
|
+
format = format.replace('SSS', ms)
|
|
44
|
+
} else if (format.includes('SS')) {
|
|
45
|
+
format = format.replace('SS', ms.slice(0, 2))
|
|
46
|
+
} else {
|
|
47
|
+
format = format.replace('S', ms.charAt(0))
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return format
|
|
52
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`wd-count-down ${customClass}`" :style="customStyle">
|
|
3
|
+
<slot :current="current" v-if="$slots.default" />
|
|
4
|
+
<block v-else>{{ timeText }}</block>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'wd-count-down',
|
|
11
|
+
options: {
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
// #endif
|
|
15
|
+
addGlobalClass: true,
|
|
16
|
+
styleIsolation: 'shared'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { watch, computed, onMounted } from 'vue'
|
|
23
|
+
import { parseFormat } from './utils'
|
|
24
|
+
import { useCountDown } from '../../composables/useCountDown'
|
|
25
|
+
import { countDownProps, type CountDownExpose } from './types'
|
|
26
|
+
|
|
27
|
+
const props = defineProps(countDownProps)
|
|
28
|
+
|
|
29
|
+
const emit = defineEmits(['change', 'finish'])
|
|
30
|
+
|
|
31
|
+
const { start, pause, reset, current } = useCountDown({
|
|
32
|
+
time: props.time,
|
|
33
|
+
millisecond: props.millisecond,
|
|
34
|
+
onChange: (current) => emit('change', current),
|
|
35
|
+
onFinish: () => emit('finish')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const timeText = computed(() => parseFormat(props.format, current.value))
|
|
39
|
+
|
|
40
|
+
const resetTime = () => {
|
|
41
|
+
reset(props.time)
|
|
42
|
+
if (props.autoStart) {
|
|
43
|
+
start()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
watch(() => props.time, resetTime, { immediate: false })
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
resetTime()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
defineExpose<CountDownExpose>({
|
|
54
|
+
start,
|
|
55
|
+
pause,
|
|
56
|
+
reset: resetTime
|
|
57
|
+
})
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style lang="scss">
|
|
61
|
+
@use './index.scss';
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use '../../styles/variable.scss'as *;
|
|
2
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 数字主体文本字号
|
|
5
|
+
$count-to-text-font-size: var(--wot-count-to-text-font-size, $typography-body-size-ultra-large) !default;
|
|
6
|
+
// 数字主体文本行高
|
|
7
|
+
$count-to-text-line-height: var(--wot-count-to-text-line-height, $typography-body-line--height-size-ultra-large) !default;
|
|
8
|
+
// 分隔文本字号
|
|
9
|
+
$count-to-separator-text-font-size: var(--wot-count-to-separator-text-font-size, $typography-label-size-main) !default;
|
|
10
|
+
// 分隔文本行高
|
|
11
|
+
$count-to-separator-text-line-height: var(--wot-count-to-separator-text-line-height, $typography-label-line--height-size-main) !default;
|
|
12
|
+
|
|
13
|
+
@include b(count-to) {
|
|
14
|
+
vertical-align: bottom;
|
|
15
|
+
|
|
16
|
+
@include edeep(main-text){
|
|
17
|
+
font-size: $count-to-text-font-size;
|
|
18
|
+
line-height: $count-to-text-line-height;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include edeep(separator-text){
|
|
22
|
+
font-size: $count-to-separator-text-font-size;
|
|
23
|
+
line-height: $count-to-separator-text-line-height;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../../common/props'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 主题类型
|
|
6
|
+
*/
|
|
7
|
+
export type CountToType = 'default' | 'primary' | 'success' | 'warning' | 'error'
|
|
8
|
+
|
|
9
|
+
export const countToProps = {
|
|
10
|
+
...baseProps,
|
|
11
|
+
/**
|
|
12
|
+
* 文本颜色
|
|
13
|
+
* 类型: string
|
|
14
|
+
* 默认值: ''
|
|
15
|
+
*/
|
|
16
|
+
color: makeStringProp(''),
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 主题类型
|
|
20
|
+
* 类型: CountToType
|
|
21
|
+
* 可选值: 'default' | 'primary' | 'success' | 'warning' | 'error'
|
|
22
|
+
* 默认值: 'default'
|
|
23
|
+
*/
|
|
24
|
+
type: makeStringProp<CountToType>('default'),
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 起始值
|
|
28
|
+
* 类型: number
|
|
29
|
+
* 默认值: 0
|
|
30
|
+
*/
|
|
31
|
+
startVal: makeNumberProp(0),
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 最终值
|
|
35
|
+
* 类型: number
|
|
36
|
+
* 默认值: 2024
|
|
37
|
+
*/
|
|
38
|
+
endVal: makeNumberProp(2024),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 从起始值到结束值数字变动的时间,单位毫秒
|
|
42
|
+
* 类型: number
|
|
43
|
+
* 默认值: 3000
|
|
44
|
+
*/
|
|
45
|
+
duration: makeNumberProp(3000),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 是否自动开始
|
|
49
|
+
* 类型: boolean
|
|
50
|
+
* 默认值: true
|
|
51
|
+
*/
|
|
52
|
+
autoStart: makeBooleanProp(true),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 保留的小数位数,需大于等于0
|
|
56
|
+
* 类型: number
|
|
57
|
+
* 默认值: 0
|
|
58
|
+
*/
|
|
59
|
+
decimals: {
|
|
60
|
+
type: Number,
|
|
61
|
+
required: false,
|
|
62
|
+
default: 0,
|
|
63
|
+
validator(value: number) {
|
|
64
|
+
return value >= 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 小数点符号
|
|
70
|
+
* 类型: string
|
|
71
|
+
* 默认值: '.'
|
|
72
|
+
*/
|
|
73
|
+
decimal: makeStringProp('.'),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 千分位分隔符
|
|
77
|
+
* 类型: string
|
|
78
|
+
* 默认值: ','
|
|
79
|
+
*/
|
|
80
|
+
separator: makeStringProp(','),
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 前缀
|
|
84
|
+
* 类型: string
|
|
85
|
+
* 默认值: ''
|
|
86
|
+
*/
|
|
87
|
+
prefix: makeStringProp(''),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 后缀
|
|
91
|
+
* 类型: string
|
|
92
|
+
* 默认值: ''
|
|
93
|
+
*/
|
|
94
|
+
suffix: makeStringProp(''),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 是否使用缓动动画效果
|
|
98
|
+
* 类型: boolean
|
|
99
|
+
* 默认值: true
|
|
100
|
+
*/
|
|
101
|
+
useEasing: makeBooleanProp(true)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type CountToProps = ExtractPropTypes<typeof countToProps>
|
|
105
|
+
|
|
106
|
+
export type CountToExpose = {
|
|
107
|
+
/**
|
|
108
|
+
* 开始计数
|
|
109
|
+
*/
|
|
110
|
+
start: () => void
|
|
111
|
+
/**
|
|
112
|
+
* 暂停计数
|
|
113
|
+
*/
|
|
114
|
+
pause: () => void
|
|
115
|
+
/**
|
|
116
|
+
* 重置计数,若 autoStart 为 true,重置后会自动开始计数
|
|
117
|
+
*/
|
|
118
|
+
reset: () => void
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type CountToInstance = ComponentPublicInstance<CountToProps, CountToExpose>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass">
|
|
3
|
+
<!-- 前缀插槽 -->
|
|
4
|
+
<slot name="prefix">
|
|
5
|
+
<wd-text custom-class="wd-count-to__separator-text" :type="type" :color="color" :text="prefix"></wd-text>
|
|
6
|
+
</slot>
|
|
7
|
+
<!-- 默认文本插槽 -->
|
|
8
|
+
<slot>
|
|
9
|
+
<wd-text custom-class="wd-count-to__main-text" :type="type" :color="color" :text="timeText"></wd-text>
|
|
10
|
+
</slot>
|
|
11
|
+
<!-- 后缀插槽 -->
|
|
12
|
+
<slot name="suffix">
|
|
13
|
+
<wd-text custom-class="wd-count-to__separator-text" :type="type" :color="color" :text="suffix"></wd-text>
|
|
14
|
+
</slot>
|
|
15
|
+
</view>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
export default {
|
|
20
|
+
name: 'wd-count-to',
|
|
21
|
+
options: {
|
|
22
|
+
// #ifndef MP-TOUTIAO
|
|
23
|
+
virtualHost: true,
|
|
24
|
+
// #endif
|
|
25
|
+
addGlobalClass: true,
|
|
26
|
+
styleIsolation: 'shared'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import wdText from '../wd-text/wd-text.vue'
|
|
33
|
+
import { computed, watch, onMounted } from 'vue'
|
|
34
|
+
import { countToProps, type CountToExpose } from './types'
|
|
35
|
+
import { easingFn, isNumber } from '../../common/util'
|
|
36
|
+
import { useCountDown } from '../../composables/useCountDown'
|
|
37
|
+
|
|
38
|
+
const props = defineProps(countToProps)
|
|
39
|
+
const emit = defineEmits(['mounted', 'finish'])
|
|
40
|
+
|
|
41
|
+
const { start, pause, reset, current } = useCountDown({
|
|
42
|
+
time: props.duration,
|
|
43
|
+
millisecond: true,
|
|
44
|
+
onFinish: () => emit('finish')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// 计算根元素的类名
|
|
48
|
+
const rootClass = computed(() => {
|
|
49
|
+
return `wd-count-to ${props.customClass}`
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const timeText = computed(() => {
|
|
53
|
+
return parseFormat(current.value.total)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
watch([() => props.startVal, () => props.endVal, () => props.duration], resetTime, { immediate: false })
|
|
57
|
+
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
resetTime()
|
|
60
|
+
emit('mounted')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
// 重置动画
|
|
64
|
+
function resetTime() {
|
|
65
|
+
reset(props.duration)
|
|
66
|
+
if (props.autoStart) {
|
|
67
|
+
start()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function parseFormat(remain: number) {
|
|
72
|
+
const { startVal, endVal, duration, useEasing } = props
|
|
73
|
+
const progress = duration - remain // 已经进行的时间
|
|
74
|
+
const isPositive = startVal > endVal // 判断startVal是否大于endVal
|
|
75
|
+
const progressRatio = progress / duration // 计算进度比例
|
|
76
|
+
|
|
77
|
+
let currentVal: number
|
|
78
|
+
|
|
79
|
+
if (useEasing) {
|
|
80
|
+
// 使用缓动函数计算currentVal
|
|
81
|
+
if (isPositive) {
|
|
82
|
+
currentVal = startVal - easingFn(progress, 0, startVal - endVal, duration) || 0
|
|
83
|
+
} else {
|
|
84
|
+
currentVal = easingFn(progress, startVal, endVal - startVal, duration)
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
// 不使用缓动函数时的计算方式
|
|
88
|
+
if (isPositive) {
|
|
89
|
+
currentVal = startVal - (startVal - endVal) * progressRatio
|
|
90
|
+
} else {
|
|
91
|
+
currentVal = startVal + (endVal - startVal) * progressRatio
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// 确保currentVal在startVal和endVal之间
|
|
95
|
+
currentVal = isPositive ? Math.max(endVal, currentVal) : Math.min(endVal, currentVal)
|
|
96
|
+
return formatNumber(currentVal)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 格式化数字
|
|
100
|
+
function formatNumber(num: any): string {
|
|
101
|
+
if (typeof num !== 'number') {
|
|
102
|
+
num = parseFloat(num)
|
|
103
|
+
if (isNaN(num)) {
|
|
104
|
+
return '0'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
num = num.toFixed(props.decimals)
|
|
108
|
+
const parts = num.split('.')
|
|
109
|
+
let integerPart = parts[0]
|
|
110
|
+
const decimalPart = parts.length > 1 ? props.decimal + parts[1] : ''
|
|
111
|
+
const rgx = /(\d+)(\d{3})/
|
|
112
|
+
|
|
113
|
+
if (props.separator && !isNumber(props.separator)) {
|
|
114
|
+
while (rgx.test(integerPart)) {
|
|
115
|
+
integerPart = integerPart.replace(rgx, '$1' + props.separator + '$2')
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return integerPart + decimalPart
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
defineExpose<CountToExpose>({ start, reset: resetTime, pause })
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<style lang="scss">
|
|
125
|
+
@use './index.scss';
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
2
|
+
@use '../../styles/variable.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 幕帘内容圆角
|
|
5
|
+
$curtain-content-radius: var(--wot-curtain-content-radius, $radius-large) !default;
|
|
6
|
+
// 幕帘关闭图标颜色
|
|
7
|
+
$curtain-content-close-color: var(--wot-curtain-content-close-color, $text-white) !default;
|
|
8
|
+
// 幕帘关闭图标尺寸
|
|
9
|
+
$curtain-content-close-size: var(--wot-curtain-content-close-size, $n-32) !default;
|
|
10
|
+
// 幕帘关闭图标偏移
|
|
11
|
+
$curtain-content-close-inset: var(--wot-curtain-content-close-inset, $spacing-extra-loose) !default;
|
|
12
|
+
|
|
13
|
+
:deep() {
|
|
14
|
+
@include b(curtain) {
|
|
15
|
+
border-radius: $curtain-content-radius;
|
|
16
|
+
overflow-y: visible !important;
|
|
17
|
+
background: transparent;
|
|
18
|
+
font-size: 0;
|
|
19
|
+
|
|
20
|
+
@include e(content) {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
background: transparent;
|
|
24
|
+
border-radius: $curtain-content-radius;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@include e(content-link) {
|
|
28
|
+
display: block;
|
|
29
|
+
border-radius: $curtain-content-radius;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include e(content-img) {
|
|
33
|
+
display: block;
|
|
34
|
+
width: auto;
|
|
35
|
+
height: auto;
|
|
36
|
+
border-radius: $curtain-content-radius;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include e(content-close) {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: $curtain-content-close-inset;
|
|
42
|
+
right: $curtain-content-close-inset;
|
|
43
|
+
color: $curtain-content-close-color;
|
|
44
|
+
font-size: $curtain-content-close-size;
|
|
45
|
+
-webkit-tap-highlight-color: transparent;
|
|
46
|
+
|
|
47
|
+
&.top {
|
|
48
|
+
top: calc(-1 * $curtain-content-close-inset);
|
|
49
|
+
left: 50%;
|
|
50
|
+
right: unset;
|
|
51
|
+
bottom: unset;
|
|
52
|
+
transform: translateY(-100%) translateX(-50%);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.top-left {
|
|
56
|
+
top: calc(-1 * $curtain-content-close-inset);
|
|
57
|
+
right: unset;
|
|
58
|
+
left: 0;
|
|
59
|
+
bottom: unset;
|
|
60
|
+
transform: translateY(-100%);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.top-right {
|
|
64
|
+
top: calc(-1 * $curtain-content-close-inset);
|
|
65
|
+
right: 0;
|
|
66
|
+
left: unset;
|
|
67
|
+
bottom: unset;
|
|
68
|
+
transform: translateY(-100%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.bottom {
|
|
72
|
+
top: unset;
|
|
73
|
+
right: unset;
|
|
74
|
+
left: 50%;
|
|
75
|
+
bottom: calc(-1 * $curtain-content-close-inset);
|
|
76
|
+
transform: translateY(100%) translateX(-50%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.bottom-left {
|
|
80
|
+
top: unset;
|
|
81
|
+
right: unset;
|
|
82
|
+
left: 0;
|
|
83
|
+
bottom: calc(-1 * $curtain-content-close-inset);
|
|
84
|
+
transform: translateY(100%);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.bottom-right {
|
|
88
|
+
top: unset;
|
|
89
|
+
right: 0;
|
|
90
|
+
left: unset;
|
|
91
|
+
bottom: calc(-1 * $curtain-content-close-inset);
|
|
92
|
+
transform: translateY(100%);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2025-01-25 23:46:29
|
|
4
|
+
* @LastEditTime: 2025-09-09 10:00:00
|
|
5
|
+
* @LastEditors: rusheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-curtain/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtractPropTypes } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../../common/props'
|
|
12
|
+
|
|
13
|
+
export type ClosePosition = 'inset' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
14
|
+
|
|
15
|
+
export const curtainProps = {
|
|
16
|
+
...baseProps,
|
|
17
|
+
/**
|
|
18
|
+
* 绑定值,展示/关闭幕帘
|
|
19
|
+
* @deprecated 请使用 modelValue
|
|
20
|
+
*/
|
|
21
|
+
value: makeBooleanProp(false),
|
|
22
|
+
/**
|
|
23
|
+
* 绑定值,展示/关闭幕帘
|
|
24
|
+
*/
|
|
25
|
+
modelValue: makeBooleanProp(false),
|
|
26
|
+
/**
|
|
27
|
+
* 关闭按钮位置,可选值:inset / top / bottom / top-left / top-right / bottom-left / bottom-right
|
|
28
|
+
*/
|
|
29
|
+
closePosition: makeStringProp<ClosePosition>('inset'),
|
|
30
|
+
/**
|
|
31
|
+
* 幕帘图片地址,必须使用网络地址
|
|
32
|
+
*/
|
|
33
|
+
src: String,
|
|
34
|
+
/**
|
|
35
|
+
* 幕帘图片点击链接
|
|
36
|
+
*/
|
|
37
|
+
to: String,
|
|
38
|
+
/**
|
|
39
|
+
* 幕帘图片宽度
|
|
40
|
+
*/
|
|
41
|
+
width: Number,
|
|
42
|
+
/**
|
|
43
|
+
* 点击遮罩是否关闭
|
|
44
|
+
*/
|
|
45
|
+
closeOnClickModal: makeBooleanProp(false),
|
|
46
|
+
/**
|
|
47
|
+
* 是否当关闭时将弹出层隐藏(display: none)
|
|
48
|
+
*/
|
|
49
|
+
hideWhenClose: makeBooleanProp(true),
|
|
50
|
+
/**
|
|
51
|
+
* 设置层级
|
|
52
|
+
* 类型:number
|
|
53
|
+
* 默认值:10
|
|
54
|
+
*/
|
|
55
|
+
zIndex: makeNumberProp(10),
|
|
56
|
+
/**
|
|
57
|
+
* 自定义关闭按钮的类名
|
|
58
|
+
* 类型:string
|
|
59
|
+
* 默认值:''
|
|
60
|
+
*/
|
|
61
|
+
customCloseClass: makeStringProp(''),
|
|
62
|
+
/**
|
|
63
|
+
* 自定义关闭按钮的样式
|
|
64
|
+
* 类型:string
|
|
65
|
+
* 默认值:''
|
|
66
|
+
*/
|
|
67
|
+
customCloseStyle: makeStringProp(''),
|
|
68
|
+
/**
|
|
69
|
+
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
|
|
70
|
+
*/
|
|
71
|
+
rootPortal: makeBooleanProp(false),
|
|
72
|
+
/**
|
|
73
|
+
* 开启长按图片显示识别小程序码菜单,仅在微信小程序平台有效
|
|
74
|
+
*/
|
|
75
|
+
showMenuByLongpress: makeBooleanProp(false),
|
|
76
|
+
/**
|
|
77
|
+
* 点击图片是否关闭幕帘,默认为 true
|
|
78
|
+
*/
|
|
79
|
+
closeOnClick: makeBooleanProp(true)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type CurtainProps = ExtractPropTypes<typeof curtainProps>
|