@tplc/wot 1.0.6 → 1.0.8
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/CHANGELOG.md +20 -0
- package/components/common/AbortablePromise.ts +3 -11
- package/components/common/abstracts/_config.scss +1 -1
- package/components/common/abstracts/_function.scss +26 -13
- package/components/common/abstracts/_mixin.scss +117 -71
- package/components/common/abstracts/variable.scss +325 -697
- package/components/common/base64.ts +1 -2
- package/components/common/canvasHelper.ts +1 -1
- package/components/common/interceptor.ts +43 -0
- package/components/common/props.ts +8 -8
- package/components/common/util.ts +145 -60
- package/components/composables/index.ts +11 -0
- package/components/composables/useChildren.ts +9 -18
- package/components/composables/useCountDown.ts +2 -2
- package/components/composables/useLockScroll.ts +1 -3
- package/components/composables/useParent.ts +4 -4
- package/components/composables/usePopover.ts +43 -60
- package/components/composables/useQueue.ts +2 -2
- package/components/composables/useTouch.ts +2 -3
- package/components/composables/useTranslate.ts +2 -13
- package/components/composables/useUpload.ts +389 -0
- package/components/wd-action-sheet/index.scss +22 -22
- package/components/wd-action-sheet/types.ts +11 -21
- package/components/wd-action-sheet/wd-action-sheet.vue +21 -40
- package/components/wd-backtop/index.scss +5 -5
- package/components/wd-backtop/types.ts +3 -15
- package/components/wd-backtop/wd-backtop.vue +12 -20
- package/components/wd-badge/index.scss +14 -10
- package/components/wd-badge/types.ts +6 -9
- package/components/wd-badge/wd-badge.vue +29 -37
- package/components/wd-button/index.scss +76 -80
- package/components/wd-button/types.ts +43 -13
- package/components/wd-button/wd-button.vue +41 -22
- package/components/wd-calendar/index.scss +58 -145
- package/components/wd-calendar/types.ts +23 -41
- package/components/wd-calendar/wd-calendar.vue +123 -130
- package/components/wd-calendar-view/month/index.scss +33 -65
- package/components/wd-calendar-view/month/month.vue +80 -113
- package/components/wd-calendar-view/month/types.ts +2 -1
- package/components/wd-calendar-view/monthPanel/index.scss +15 -15
- package/components/wd-calendar-view/monthPanel/month-panel.vue +64 -78
- package/components/wd-calendar-view/monthPanel/types.ts +58 -10
- package/components/wd-calendar-view/types.ts +12 -36
- package/components/wd-calendar-view/utils.ts +14 -36
- package/components/wd-calendar-view/wd-calendar-view.vue +7 -7
- package/components/wd-calendar-view/year/index.scss +18 -13
- package/components/wd-calendar-view/year/types.ts +2 -1
- package/components/wd-calendar-view/year/year.vue +25 -43
- package/components/wd-calendar-view/yearPanel/index.scss +4 -4
- package/components/wd-calendar-view/yearPanel/types.ts +2 -2
- package/components/wd-calendar-view/yearPanel/year-panel.vue +36 -41
- package/components/wd-card/index.scss +11 -10
- package/components/wd-card/types.ts +1 -1
- package/components/wd-card/wd-card.vue +6 -9
- package/components/wd-cell/index.scss +56 -41
- package/components/wd-cell/types.ts +23 -8
- package/components/wd-cell/wd-cell.vue +48 -18
- package/components/wd-cell-group/index.scss +8 -7
- package/components/wd-cell-group/types.ts +1 -1
- package/components/wd-cell-group/wd-cell-group.vue +5 -5
- package/components/wd-checkbox/index.scss +35 -35
- package/components/wd-checkbox/types.ts +6 -6
- package/components/wd-checkbox/wd-checkbox.vue +12 -20
- package/components/wd-checkbox-group/index.scss +4 -4
- package/components/wd-checkbox-group/types.ts +2 -2
- package/components/wd-checkbox-group/wd-checkbox-group.vue +9 -12
- package/components/wd-circle/index.scss +5 -5
- package/components/wd-circle/types.ts +2 -2
- package/components/wd-circle/wd-circle.vue +18 -40
- package/components/wd-col/index.scss +2 -2
- package/components/wd-col/types.ts +1 -1
- package/components/wd-col/wd-col.vue +11 -53
- package/components/wd-col-picker/index.scss +41 -115
- package/components/wd-col-picker/types.ts +10 -14
- package/components/wd-col-picker/wd-col-picker.vue +103 -155
- package/components/wd-collapse/index.scss +7 -13
- package/components/wd-collapse/types.ts +4 -10
- package/components/wd-collapse/wd-collapse.vue +22 -55
- package/components/wd-collapse-item/index.scss +16 -5
- package/components/wd-collapse-item/types.ts +14 -2
- package/components/wd-collapse-item/wd-collapse-item.vue +70 -81
- package/components/wd-config-provider/types.ts +69 -40
- package/components/wd-config-provider/wd-config-provider.vue +11 -11
- package/components/wd-count-down/index.scss +3 -2
- package/components/wd-count-down/types.ts +1 -1
- package/components/wd-count-down/wd-count-down.vue +5 -5
- package/components/wd-count-to/index.scss +2 -1
- package/components/wd-count-to/types.ts +10 -3
- package/components/wd-count-to/wd-count-to.vue +9 -18
- package/components/wd-curtain/index.scss +28 -23
- package/components/wd-curtain/types.ts +46 -9
- package/components/wd-curtain/wd-curtain.vue +45 -47
- package/components/wd-datetime-picker/index.scss +65 -145
- package/components/wd-datetime-picker/types.ts +41 -31
- package/components/wd-datetime-picker/wd-datetime-picker.vue +307 -333
- package/components/wd-datetime-picker-view/types.ts +29 -46
- package/components/wd-datetime-picker-view/util.ts +30 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +104 -119
- package/components/wd-divider/index.scss +78 -10
- package/components/wd-divider/types.ts +26 -3
- package/components/wd-divider/wd-divider.vue +33 -10
- package/components/wd-drop-menu/index.scss +17 -45
- package/components/wd-drop-menu/types.ts +3 -3
- package/components/wd-drop-menu/wd-drop-menu.vue +61 -25
- package/components/wd-drop-menu-item/index.scss +15 -15
- package/components/wd-drop-menu-item/types.ts +18 -15
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +33 -54
- package/components/wd-fab/index.scss +13 -12
- package/components/wd-fab/types.ts +9 -4
- package/components/wd-fab/wd-fab.vue +70 -51
- package/components/wd-floating-panel/index.scss +64 -0
- package/components/wd-floating-panel/type.ts +32 -0
- package/components/wd-floating-panel/wd-floating-panel.vue +140 -0
- package/components/wd-form/types.ts +8 -16
- package/components/wd-form/wd-form.vue +67 -45
- package/components/wd-form-item/index.scss +3 -2
- package/components/wd-form-item/types.ts +2 -8
- package/components/wd-form-item/wd-form-item.vue +3 -3
- package/components/wd-grid/index.scss +2 -2
- package/components/wd-grid/types.ts +5 -0
- package/components/wd-grid/wd-grid.vue +11 -12
- package/components/wd-grid-item/index.scss +44 -33
- package/components/wd-grid-item/types.ts +7 -4
- package/components/wd-grid-item/wd-grid-item.vue +39 -44
- package/components/wd-icon/index.scss +311 -303
- package/components/wd-icon/types.ts +3 -3
- package/components/wd-icon/wd-icon.vue +6 -6
- package/components/wd-img/types.ts +1 -1
- package/components/wd-img/wd-img.vue +13 -3
- package/components/wd-img-cropper/index.scss +43 -39
- package/components/wd-img-cropper/types.ts +6 -8
- package/components/wd-img-cropper/wd-img-cropper.vue +132 -127
- package/components/wd-index-anchor/index.scss +7 -6
- package/components/wd-index-anchor/type.ts +2 -2
- package/components/wd-index-anchor/wd-index-anchor.vue +3 -9
- package/components/wd-index-bar/index.scss +5 -5
- package/components/wd-index-bar/type.ts +3 -2
- package/components/wd-index-bar/wd-index-bar.vue +15 -51
- package/components/wd-input/index.scss +44 -33
- package/components/wd-input/types.ts +40 -19
- package/components/wd-input/wd-input.vue +58 -42
- package/components/wd-input-number/index.scss +23 -31
- package/components/wd-input-number/types.ts +42 -14
- package/components/wd-input-number/wd-input-number.vue +374 -141
- package/components/wd-keyboard/constants.ts +81 -0
- package/components/wd-keyboard/index.scss +102 -0
- package/components/wd-keyboard/key/index.scss +79 -0
- package/components/wd-keyboard/key/index.vue +71 -0
- package/components/wd-keyboard/key/types.ts +11 -0
- package/components/wd-keyboard/types.ts +92 -0
- package/components/wd-keyboard/wd-keyboard.vue +206 -0
- package/components/wd-loading/index.scss +9 -6
- package/components/wd-loading/types.ts +1 -1
- package/components/wd-loading/wd-loading.vue +9 -9
- package/components/wd-loadmore/index.scss +5 -5
- package/components/wd-loadmore/types.ts +8 -2
- package/components/wd-loadmore/wd-loadmore.vue +28 -13
- package/components/wd-message-box/index.scss +21 -34
- package/components/wd-message-box/index.ts +30 -29
- package/components/wd-message-box/types.ts +33 -8
- package/components/wd-message-box/wd-message-box.vue +130 -152
- package/components/wd-navbar/index.scss +14 -24
- package/components/wd-navbar/types.ts +1 -1
- package/components/wd-navbar/wd-navbar.vue +14 -45
- package/components/wd-navbar-capsule/index.scss +16 -15
- package/components/wd-navbar-capsule/types.ts +8 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +8 -4
- package/components/wd-notice-bar/index.scss +15 -33
- package/components/wd-notice-bar/types.ts +14 -3
- package/components/wd-notice-bar/wd-notice-bar.vue +109 -66
- package/components/wd-notify/index.scss +5 -5
- package/components/wd-notify/index.ts +17 -15
- package/components/wd-notify/types.ts +4 -0
- package/components/wd-notify/wd-notify.vue +21 -19
- package/components/wd-number-keyboard/index.scss +10 -10
- package/components/wd-number-keyboard/key/index.scss +7 -5
- package/components/wd-number-keyboard/key/index.vue +6 -9
- package/components/wd-number-keyboard/key/types.ts +1 -1
- package/components/wd-number-keyboard/types.ts +4 -0
- package/components/wd-number-keyboard/wd-number-keyboard.vue +22 -44
- package/components/wd-overlay/index.scss +3 -3
- package/components/wd-overlay/types.ts +2 -2
- package/components/wd-overlay/wd-overlay.vue +7 -15
- package/components/wd-pagination/index.scss +17 -17
- package/components/wd-pagination/types.ts +1 -1
- package/components/wd-pagination/wd-pagination.vue +10 -21
- package/components/wd-password-input/index.scss +7 -6
- package/components/wd-password-input/types.ts +2 -8
- package/components/wd-password-input/wd-password-input.vue +6 -15
- package/components/wd-picker/index.scss +46 -153
- package/components/wd-picker/types.ts +22 -19
- package/components/wd-picker/wd-picker.vue +89 -86
- package/components/wd-picker-view/index.scss +13 -12
- package/components/wd-picker-view/types.ts +16 -26
- package/components/wd-picker-view/wd-picker-view.vue +32 -24
- package/components/wd-popover/index.scss +29 -36
- package/components/wd-popover/types.ts +1 -1
- package/components/wd-popover/wd-popover.vue +20 -56
- package/components/wd-popup/index.scss +47 -75
- package/components/wd-popup/types.ts +40 -4
- package/components/wd-popup/wd-popup.vue +100 -157
- package/components/wd-progress/index.scss +20 -14
- package/components/wd-progress/types.ts +10 -6
- package/components/wd-progress/wd-progress.vue +137 -141
- package/components/wd-radio/index.scss +54 -53
- package/components/wd-radio/types.ts +15 -6
- package/components/wd-radio/wd-radio.vue +41 -59
- package/components/wd-radio-group/index.scss +5 -5
- package/components/wd-radio-group/types.ts +4 -1
- package/components/wd-radio-group/wd-radio-group.vue +6 -9
- package/components/wd-rate/index.scss +1 -1
- package/components/wd-rate/types.ts +10 -5
- package/components/wd-rate/wd-rate.vue +35 -17
- package/components/wd-resize/index.scss +2 -1
- package/components/wd-resize/types.ts +1 -1
- package/components/wd-resize/wd-resize.vue +11 -22
- package/components/wd-root-portal/wd-root-portal.vue +50 -0
- package/components/wd-row/index.scss +1 -1
- package/components/wd-row/types.ts +1 -1
- package/components/wd-row/wd-row.vue +14 -35
- package/components/wd-search/index.scss +29 -29
- package/components/wd-search/types.ts +22 -3
- package/components/wd-search/wd-search.vue +70 -120
- package/components/wd-segmented/index.scss +19 -15
- package/components/wd-segmented/types.ts +16 -4
- package/components/wd-segmented/wd-segmented.vue +34 -34
- package/components/wd-select-picker/index.scss +55 -122
- package/components/wd-select-picker/types.ts +29 -36
- package/components/wd-select-picker/wd-select-picker.vue +128 -274
- package/components/wd-sidebar/index.scss +5 -5
- package/components/wd-sidebar/types.ts +22 -3
- package/components/wd-sidebar/wd-sidebar.vue +26 -4
- package/components/wd-sidebar-item/index.scss +17 -13
- package/components/wd-sidebar-item/types.ts +3 -3
- package/components/wd-sidebar-item/wd-sidebar-item.vue +12 -10
- package/components/wd-signature/index.scss +31 -0
- package/components/wd-signature/types.ts +263 -0
- package/components/wd-signature/wd-signature.vue +630 -0
- package/components/wd-skeleton/index.scss +8 -13
- package/components/wd-skeleton/types.ts +6 -6
- package/components/wd-skeleton/wd-skeleton.vue +15 -31
- package/components/wd-slider/index.scss +24 -17
- package/components/wd-slider/types.ts +45 -17
- package/components/wd-slider/wd-slider.vue +275 -297
- package/components/wd-sort-button/index.scss +10 -7
- package/components/wd-sort-button/types.ts +1 -1
- package/components/wd-sort-button/wd-sort-button.vue +7 -14
- package/components/wd-status-tip/index.scss +8 -8
- package/components/wd-status-tip/types.ts +8 -2
- package/components/wd-status-tip/wd-status-tip.vue +14 -37
- package/components/wd-step/index.scss +29 -30
- package/components/wd-step/types.ts +1 -1
- package/components/wd-step/wd-step.vue +8 -9
- package/components/wd-steps/index.scss +1 -1
- package/components/wd-steps/types.ts +1 -1
- package/components/wd-steps/wd-steps.vue +5 -5
- package/components/wd-sticky/index.scss +1 -1
- package/components/wd-sticky/types.ts +1 -1
- package/components/wd-sticky/wd-sticky.vue +21 -29
- package/components/wd-sticky-box/index.scss +1 -1
- package/components/wd-sticky-box/wd-sticky-box.vue +7 -6
- package/components/wd-swipe-action/index.scss +1 -1
- package/components/wd-swipe-action/types.ts +2 -5
- package/components/wd-swipe-action/wd-swipe-action.vue +9 -22
- package/components/wd-swiper-nav/index.scss +22 -16
- package/components/wd-swiper-nav/types.ts +1 -9
- package/components/wd-swiper-nav/wd-swiper-nav.vue +2 -5
- package/components/wd-switch/index.scss +15 -15
- package/components/wd-switch/types.ts +8 -6
- package/components/wd-switch/wd-switch.vue +15 -15
- package/components/wd-tab/index.scss +11 -3
- package/components/wd-tab/types.ts +11 -1
- package/components/wd-tab/wd-tab.vue +28 -36
- package/components/wd-tabbar/index.scss +12 -7
- package/components/wd-tabbar/types.ts +3 -18
- package/components/wd-tabbar/wd-tabbar.vue +10 -23
- package/components/wd-tabbar-item/index.scss +15 -12
- package/components/wd-tabbar-item/types.ts +3 -3
- package/components/wd-tabbar-item/wd-tabbar-item.vue +11 -13
- package/components/wd-table/index.scss +40 -9
- package/components/wd-table/types.ts +13 -15
- package/components/wd-table/wd-table.vue +123 -94
- package/components/wd-table-col/index.scss +6 -4
- package/components/wd-table-col/types.ts +1 -1
- package/components/wd-table-col/wd-table-col.vue +12 -12
- package/components/wd-tag/index.scss +19 -19
- package/components/wd-tag/types.ts +1 -1
- package/components/wd-tag/wd-tag.vue +14 -20
- package/components/wd-text/index.scss +4 -1
- package/components/wd-text/types.ts +4 -4
- package/components/wd-text/wd-text.vue +12 -11
- package/components/wd-textarea/index.scss +51 -41
- package/components/wd-textarea/types.ts +24 -34
- package/components/wd-textarea/wd-textarea.vue +59 -66
- package/components/wd-toast/index.scss +31 -18
- package/components/wd-toast/index.ts +26 -43
- package/components/wd-toast/types.ts +117 -3
- package/components/wd-toast/wd-toast.vue +49 -69
- package/components/wd-tooltip/index.scss +21 -16
- package/components/wd-tooltip/types.ts +8 -3
- package/components/wd-tooltip/wd-tooltip.vue +17 -43
- package/components/wd-tour/index.scss +123 -0
- package/components/wd-tour/types.ts +153 -0
- package/components/wd-tour/wd-tour.vue +509 -0
- package/components/wd-transition/index.scss +39 -35
- package/components/wd-transition/types.ts +27 -9
- package/components/wd-transition/wd-transition.vue +45 -34
- package/components/wd-upload/index.scss +23 -21
- package/components/wd-upload/types.ts +43 -30
- package/components/wd-upload/wd-upload.vue +183 -247
- package/components/wd-video-preview/index.scss +9 -9
- package/components/wd-video-preview/types.ts +1 -1
- package/components/wd-video-preview/wd-video-preview.vue +18 -22
- package/components/wd-watermark/index.scss +7 -7
- package/components/wd-watermark/types.ts +2 -8
- package/components/wd-watermark/wd-watermark.vue +38 -135
- package/dayjs/constant.js +26 -0
- package/dayjs/index.d.ts +430 -0
- package/dayjs/index.js +542 -0
- package/dayjs/locale/en.js +13 -0
- package/dayjs/utils.js +59 -0
- package/global.d.ts +97 -91
- package/index.ts +2 -10
- package/locale/index.ts +3 -15
- package/locale/lang/ar-SA.ts +133 -0
- package/locale/lang/de-DE.ts +133 -0
- package/locale/lang/en-US.ts +31 -26
- package/locale/lang/es-ES.ts +133 -0
- package/locale/lang/fr-FR.ts +133 -0
- package/locale/lang/ja-JP.ts +133 -0
- package/locale/lang/ko-KR.ts +133 -0
- package/locale/lang/pt-PT.ts +133 -0
- package/locale/lang/ru-RU.ts +133 -0
- package/locale/lang/th-TH.ts +28 -22
- package/locale/lang/tr-TR.ts +138 -0
- package/locale/lang/ug-CN.ts +137 -0
- package/locale/lang/vi-VN.ts +27 -30
- package/locale/lang/zh-CN.ts +32 -22
- package/locale/lang/zh-HK.ts +18 -31
- package/locale/lang/zh-TW.ts +22 -31
- package/package.json +1 -1
- package/types/components/common/interceptor.d.ts +15 -0
- package/types/components/common/util.d.ts +61 -1
- package/types/components/composables/useCell.d.ts +1 -1
- package/types/components/composables/useLockScroll.d.ts +1 -2
- package/types/components/composables/useParent.d.ts +1 -1
- package/types/components/composables/usePopover.d.ts +2 -2
- package/types/components/composables/useUpload.d.ts +41 -0
- package/types/components/wd-action-sheet/types.d.ts +13 -4
- package/types/components/wd-action-sheet/wd-action-sheet.vue.d.ts +20 -11
- package/types/components/wd-backtop/types.d.ts +1 -9
- package/types/components/wd-backtop/wd-backtop.vue.d.ts +6 -25
- package/types/components/wd-badge/types.d.ts +3 -6
- package/types/components/wd-badge/wd-badge.vue.d.ts +7 -14
- package/types/components/wd-button/types.d.ts +44 -8
- package/types/components/wd-button/wd-button.vue.d.ts +13 -9
- package/types/components/wd-calendar/types.d.ts +24 -18
- package/types/components/wd-calendar/wd-calendar.vue.d.ts +48 -32
- package/types/components/wd-calendar-view/month/month.vue.d.ts +11 -3
- package/types/components/wd-calendar-view/month/types.d.ts +4 -0
- package/types/components/wd-calendar-view/monthPanel/month-panel.vue.d.ts +18 -12
- package/types/components/wd-calendar-view/monthPanel/types.d.ts +48 -6
- package/types/components/wd-calendar-view/types.d.ts +11 -4
- package/types/components/wd-calendar-view/utils.d.ts +3 -12
- package/types/components/wd-calendar-view/wd-calendar-view.vue.d.ts +1 -1
- package/types/components/wd-calendar-view/year/types.d.ts +4 -0
- package/types/components/wd-calendar-view/year/year.vue.d.ts +11 -3
- package/types/components/wd-cell/types.d.ts +37 -1
- package/types/components/wd-cell/wd-cell.vue.d.ts +53 -9
- package/types/components/wd-checkbox/wd-checkbox.vue.d.ts +2 -2
- package/types/components/wd-checkbox-group/wd-checkbox-group.vue.d.ts +2 -2
- package/types/components/wd-circle/wd-circle.vue.d.ts +3 -3
- package/types/components/wd-col-picker/types.d.ts +14 -0
- package/types/components/wd-col-picker/wd-col-picker.vue.d.ts +36 -19
- package/types/components/wd-collapse/types.d.ts +1 -5
- package/types/components/wd-collapse/wd-collapse.vue.d.ts +3 -11
- package/types/components/wd-collapse-item/types.d.ts +19 -1
- package/types/components/wd-collapse-item/wd-collapse-item.vue.d.ts +20 -1
- package/types/components/wd-config-provider/types.d.ts +64 -7
- package/types/components/wd-config-provider/wd-config-provider.vue.d.ts +1 -1
- package/types/components/wd-count-to/types.d.ts +11 -0
- package/types/components/wd-count-to/wd-count-to.vue.d.ts +13 -4
- package/types/components/wd-curtain/types.d.ts +56 -0
- package/types/components/wd-curtain/wd-curtain.vue.d.ts +152 -77
- package/types/components/wd-datetime-picker/types.d.ts +49 -15
- package/types/components/wd-datetime-picker/wd-datetime-picker.vue.d.ts +75 -38
- package/types/components/wd-datetime-picker-view/types.d.ts +36 -14
- package/types/components/wd-datetime-picker-view/util.d.ts +12 -0
- package/types/components/wd-datetime-picker-view/wd-datetime-picker-view.vue.d.ts +35 -9
- package/types/components/wd-divider/types.d.ts +32 -4
- package/types/components/wd-divider/wd-divider.vue.d.ts +30 -7
- package/types/components/wd-drop-menu/types.d.ts +3 -3
- package/types/components/wd-drop-menu/wd-drop-menu.vue.d.ts +8 -8
- package/types/components/wd-drop-menu-item/types.d.ts +27 -15
- package/types/components/wd-drop-menu-item/wd-drop-menu-item.vue.d.ts +47 -36
- package/types/components/wd-fab/types.d.ts +19 -3
- package/types/components/wd-fab/wd-fab.vue.d.ts +13 -1
- package/types/components/wd-floating-panel/type.d.ts +54 -0
- package/types/components/wd-floating-panel/wd-floating-panel.vue.d.ts +109 -0
- package/types/components/wd-form/types.d.ts +1 -1
- package/types/components/wd-form/wd-form.vue.d.ts +2 -2
- package/types/components/wd-form-item/wd-form-item.vue.d.ts +2 -2
- package/types/components/wd-grid/types.d.ts +5 -0
- package/types/components/wd-grid/wd-grid.vue.d.ts +2 -0
- package/types/components/wd-grid-item/types.d.ts +4 -1
- package/types/components/wd-grid-item/wd-grid-item.vue.d.ts +3 -3
- package/types/components/wd-icon/types.d.ts +1 -1
- package/types/components/wd-icon/wd-icon.vue.d.ts +3 -3
- package/types/components/wd-img/types.d.ts +4 -1
- package/types/components/wd-img/wd-img.vue.d.ts +11 -4
- package/types/components/wd-img-cropper/types.d.ts +7 -0
- package/types/components/wd-img-cropper/wd-img-cropper.vue.d.ts +12 -3
- package/types/components/wd-index-bar/type.d.ts +2 -1
- package/types/components/wd-index-bar/wd-index-bar.vue.d.ts +1 -5
- package/types/components/wd-input/types.d.ts +53 -37
- package/types/components/wd-input/wd-input.vue.d.ts +50 -52
- package/types/components/wd-input-number/types.d.ts +51 -6
- package/types/components/wd-input-number/wd-input-number.vue.d.ts +152 -125
- package/types/components/wd-keyboard/constants.d.ts +8 -0
- package/types/components/wd-keyboard/key/index.vue.d.ts +70 -0
- package/types/components/wd-keyboard/key/types.d.ts +23 -0
- package/types/components/wd-keyboard/types.d.ts +137 -0
- package/types/components/wd-keyboard/wd-keyboard.vue.d.ts +200 -0
- package/types/components/wd-loading/wd-loading.vue.d.ts +2 -2
- package/types/components/wd-loadmore/types.d.ts +7 -4
- package/types/components/wd-loadmore/wd-loadmore.vue.d.ts +5 -9
- package/types/components/wd-message-box/index.d.ts +3 -8
- package/types/components/wd-message-box/types.d.ts +36 -5
- package/types/components/wd-message-box/wd-message-box.vue.d.ts +18 -2
- package/types/components/wd-navbar/wd-navbar.vue.d.ts +3 -3
- package/types/components/wd-navbar-capsule/types.d.ts +12 -0
- package/types/components/wd-navbar-capsule/wd-navbar-capsule.vue.d.ts +27 -4
- package/types/components/wd-notice-bar/types.d.ts +9 -1
- package/types/components/wd-notice-bar/wd-notice-bar.vue.d.ts +7 -5
- package/types/components/wd-notify/types.d.ts +7 -0
- package/types/components/wd-notify/wd-notify.vue.d.ts +13 -4
- package/types/components/wd-number-keyboard/types.d.ts +7 -0
- package/types/components/wd-number-keyboard/wd-number-keyboard.vue.d.ts +18 -9
- package/types/components/wd-overlay/wd-overlay.vue.d.ts +2 -2
- package/types/components/wd-pagination/wd-pagination.vue.d.ts +1 -1
- package/types/components/wd-password-input/wd-password-input.vue.d.ts +2 -2
- package/types/components/wd-picker/types.d.ts +28 -2
- package/types/components/wd-picker/wd-picker.vue.d.ts +55 -19
- package/types/components/wd-picker-view/types.d.ts +10 -0
- package/types/components/wd-picker-view/wd-picker-view.vue.d.ts +15 -3
- package/types/components/wd-popover/wd-popover.vue.d.ts +4 -4
- package/types/components/wd-popup/types.d.ts +44 -5
- package/types/components/wd-popup/wd-popup.vue.d.ts +35 -24
- package/types/components/wd-progress/types.d.ts +6 -3
- package/types/components/wd-progress/wd-progress.vue.d.ts +4 -6
- package/types/components/wd-qr-code/uqrcode.vue.d.ts +3 -3
- package/types/components/wd-qr-code/wd-qr-code.vue.d.ts +4 -4
- package/types/components/wd-radio/types.d.ts +8 -0
- package/types/components/wd-radio/wd-radio.vue.d.ts +7 -0
- package/types/components/wd-radio-group/types.d.ts +7 -1
- package/types/components/wd-radio-group/wd-radio-group.vue.d.ts +11 -2
- package/types/components/wd-rate/types.d.ts +9 -0
- package/types/components/wd-rate/wd-rate.vue.d.ts +13 -4
- package/types/components/wd-root-portal/wd-root-portal.vue.d.ts +26 -0
- package/types/components/wd-search/types.d.ts +16 -1
- package/types/components/wd-search/wd-search.vue.d.ts +28 -8
- package/types/components/wd-segmented/types.d.ts +10 -1
- package/types/components/wd-segmented/wd-segmented.vue.d.ts +6 -4
- package/types/components/wd-select-picker/types.d.ts +37 -22
- package/types/components/wd-select-picker/wd-select-picker.vue.d.ts +59 -30
- package/types/components/wd-sidebar/types.d.ts +19 -3
- package/types/components/wd-sidebar/wd-sidebar.vue.d.ts +4 -2
- package/types/components/wd-signature/types.d.ts +252 -0
- package/types/components/wd-signature/wd-signature.vue.d.ts +229 -0
- package/types/components/wd-skeleton/types.d.ts +3 -4
- package/types/components/wd-skeleton/wd-skeleton.vue.d.ts +10 -10
- package/types/components/wd-slider/types.d.ts +39 -15
- package/types/components/wd-slider/wd-slider.vue.d.ts +12 -38
- package/types/components/wd-sort-button/wd-sort-button.vue.d.ts +3 -3
- package/types/components/wd-status-tip/types.d.ts +9 -0
- package/types/components/wd-status-tip/wd-status-tip.vue.d.ts +69 -49
- package/types/components/wd-steps/wd-steps.vue.d.ts +1 -1
- package/types/components/wd-sticky/wd-sticky.vue.d.ts +3 -7
- package/types/components/wd-swipe-action/wd-swipe-action.vue.d.ts +3 -3
- package/types/components/wd-swiper/wd-swiper.vue.d.ts +4 -4
- package/types/components/wd-swiper-nav/types.d.ts +0 -14
- package/types/components/wd-swiper-nav/wd-swiper-nav.vue.d.ts +0 -18
- package/types/components/wd-switch/types.d.ts +0 -1
- package/types/components/wd-switch/wd-switch.vue.d.ts +2 -5
- package/types/components/wd-tab/types.d.ts +16 -3
- package/types/components/wd-tab/wd-tab.vue.d.ts +12 -4
- package/types/components/wd-tabbar/types.d.ts +1 -1
- package/types/components/wd-tabbar/wd-tabbar.vue.d.ts +5 -5
- package/types/components/wd-tabbar-item/wd-tabbar-item.vue.d.ts +1 -1
- package/types/components/wd-table/types.d.ts +12 -8
- package/types/components/wd-table/wd-table.vue.d.ts +16 -13
- package/types/components/wd-table-col/wd-table-col.vue.d.ts +1 -1
- package/types/components/wd-tabs/wd-tabs.vue.d.ts +7 -7
- package/types/components/wd-tag/wd-tag.vue.d.ts +4 -4
- package/types/components/wd-text/types.d.ts +2 -2
- package/types/components/wd-text/wd-text.vue.d.ts +7 -7
- package/types/components/wd-textarea/types.d.ts +41 -39
- package/types/components/wd-textarea/wd-textarea.vue.d.ts +46 -46
- package/types/components/wd-toast/index.d.ts +1 -6
- package/types/components/wd-toast/types.d.ts +127 -5
- package/types/components/wd-toast/wd-toast.vue.d.ts +101 -0
- package/types/components/wd-tooltip/types.d.ts +1 -1
- package/types/components/wd-tooltip/wd-tooltip.vue.d.ts +7 -7
- package/types/components/wd-tour/types.d.ts +194 -0
- package/types/components/wd-tour/wd-tour.vue.d.ts +267 -0
- package/types/components/wd-transition/types.d.ts +22 -7
- package/types/components/wd-transition/wd-transition.vue.d.ts +33 -20
- package/types/components/wd-upload/types.d.ts +39 -10
- package/types/components/wd-upload/wd-upload.vue.d.ts +42 -16
- package/types/components/wd-watermark/wd-watermark.vue.d.ts +7 -7
- package/types/locale/index.d.ts +0 -3
- package/types/locale/lang/zh-CN.d.ts +9 -0
- package/components/wd-datetime-picker-view/index.scss +0 -0
- package/components/wd-form/index.scss +0 -10
- package/components/wd-upload/utils.ts +0 -152
- package/types/components/common/dayjs.d.ts +0 -26
- package/types/components/wd-upload/utils.d.ts +0 -11
- package/types/locale/lang/en-US.d.ts +0 -128
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="rootClass" :style="customStyle">
|
|
3
|
-
<view v-if="label ||
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
custom-class="wd-textarea__icon"
|
|
8
|
-
:name="prefixIcon"
|
|
9
|
-
@click="onClickPrefixIcon"
|
|
10
|
-
/>
|
|
3
|
+
<view v-if="label || $slots.label" class="wd-textarea__label" :style="labelStyle">
|
|
4
|
+
<text v-if="isRequired && markerSide === 'before'" class="wd-textarea__required wd-textarea__required--left">*</text>
|
|
5
|
+
<view v-if="prefixIcon || $slots.prefix" class="wd-textarea__prefix">
|
|
6
|
+
<wd-icon v-if="prefixIcon && !$slots.prefix" custom-class="wd-textarea__icon" :name="prefixIcon" @click="onClickPrefixIcon" />
|
|
11
7
|
<slot v-else name="prefix"></slot>
|
|
12
8
|
</view>
|
|
13
9
|
<view class="wd-textarea__label-inner">
|
|
14
|
-
<text v-if="label">{{ label }}</text>
|
|
15
|
-
<slot v-else name="label"></slot>
|
|
10
|
+
<text v-if="label && !$slots.label">{{ label }}</text>
|
|
11
|
+
<slot v-else-if="$slots.label" name="label"></slot>
|
|
16
12
|
</view>
|
|
13
|
+
<text v-if="isRequired && markerSide === 'after'" class="wd-textarea__required">*</text>
|
|
17
14
|
</view>
|
|
18
15
|
|
|
19
16
|
<!-- 文本域 -->
|
|
20
|
-
<view
|
|
21
|
-
:class="`wd-textarea__value ${showClear ? 'is-suffix' : ''} ${customTextareaContainerClass} ${showWordCount ? 'is-show-limit' : ''}`"
|
|
22
|
-
>
|
|
17
|
+
<view :class="`wd-textarea__value ${showClear ? 'is-suffix' : ''} ${customTextareaContainerClass} ${showWordCount ? 'is-show-limit' : ''}`">
|
|
23
18
|
<textarea
|
|
24
19
|
:class="`wd-textarea__inner ${customTextareaClass}`"
|
|
25
20
|
v-model="inputValue"
|
|
26
21
|
:show-count="false"
|
|
27
22
|
:placeholder="placeholderValue"
|
|
28
|
-
:disabled="disabled"
|
|
23
|
+
:disabled="disabled || readonly"
|
|
29
24
|
:maxlength="maxlength"
|
|
30
25
|
:focus="focused"
|
|
31
26
|
:auto-focus="autoFocus"
|
|
@@ -43,6 +38,8 @@
|
|
|
43
38
|
:confirm-type="confirmType"
|
|
44
39
|
:confirm-hold="confirmHold"
|
|
45
40
|
:disable-default-padding="disableDefaultPadding"
|
|
41
|
+
:ignoreCompositionEvent="ignoreCompositionEvent"
|
|
42
|
+
:inputmode="inputmode"
|
|
46
43
|
@input="handleInput"
|
|
47
44
|
@focus="handleFocus"
|
|
48
45
|
@blur="handleBlur"
|
|
@@ -52,14 +49,9 @@
|
|
|
52
49
|
/>
|
|
53
50
|
<view v-if="errorMessage" class="wd-textarea__error-message">{{ errorMessage }}</view>
|
|
54
51
|
|
|
55
|
-
<view v-if="readonly" class="wd-textarea__readonly-mask" />
|
|
52
|
+
<view v-if="props.readonly" class="wd-textarea__readonly-mask" />
|
|
56
53
|
<view class="wd-textarea__suffix">
|
|
57
|
-
<wd-icon
|
|
58
|
-
v-if="showClear"
|
|
59
|
-
custom-class="wd-textarea__clear"
|
|
60
|
-
name="error-fill"
|
|
61
|
-
@click="handleClear"
|
|
62
|
-
/>
|
|
54
|
+
<wd-icon v-if="showClear" custom-class="wd-textarea__clear" name="error-fill" @click="handleClear" />
|
|
63
55
|
<view v-if="showWordCount" class="wd-textarea__count">
|
|
64
56
|
<text :class="countClass">
|
|
65
57
|
{{ currentLength }}
|
|
@@ -77,27 +69,32 @@ export default {
|
|
|
77
69
|
options: {
|
|
78
70
|
virtualHost: true,
|
|
79
71
|
addGlobalClass: true,
|
|
80
|
-
styleIsolation: 'shared'
|
|
81
|
-
}
|
|
72
|
+
styleIsolation: 'shared'
|
|
73
|
+
}
|
|
82
74
|
}
|
|
83
75
|
</script>
|
|
84
76
|
|
|
85
77
|
<script lang="ts" setup>
|
|
86
|
-
import { computed, onBeforeMount, ref, watch } from 'vue'
|
|
87
|
-
import
|
|
78
|
+
import { computed, onBeforeMount, ref, watch, useSlots, type Slots } from 'vue'
|
|
79
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
80
|
+
import { objToStyle, isDef, pause } from '../common/util'
|
|
88
81
|
import { useCell } from '../composables/useCell'
|
|
89
82
|
import { FORM_KEY, type FormItemRule } from '../wd-form/types'
|
|
90
83
|
import { useParent } from '../composables/useParent'
|
|
91
84
|
import { useTranslate } from '../composables/useTranslate'
|
|
92
85
|
import { textareaProps } from './types'
|
|
93
86
|
|
|
87
|
+
interface TextareaSlots extends Slots {
|
|
88
|
+
prefix?: () => any
|
|
89
|
+
label?: () => any
|
|
90
|
+
}
|
|
91
|
+
|
|
94
92
|
const { translate } = useTranslate('textarea')
|
|
95
93
|
|
|
96
94
|
const props = defineProps(textareaProps)
|
|
97
95
|
const emit = defineEmits([
|
|
98
96
|
'update:modelValue',
|
|
99
97
|
'clear',
|
|
100
|
-
'change',
|
|
101
98
|
'blur',
|
|
102
99
|
'focus',
|
|
103
100
|
'input',
|
|
@@ -105,8 +102,9 @@ const emit = defineEmits([
|
|
|
105
102
|
'confirm',
|
|
106
103
|
'linechange',
|
|
107
104
|
'clickprefixicon',
|
|
108
|
-
'click'
|
|
105
|
+
'click'
|
|
109
106
|
])
|
|
107
|
+
const slots = useSlots() as TextareaSlots
|
|
110
108
|
|
|
111
109
|
const placeholderValue = computed(() => {
|
|
112
110
|
return isDef(props.placeholder) ? props.placeholder : translate('placeholder')
|
|
@@ -115,7 +113,7 @@ const placeholderValue = computed(() => {
|
|
|
115
113
|
const clearing = ref<boolean>(false)
|
|
116
114
|
const focused = ref<boolean>(false) // 控制聚焦
|
|
117
115
|
const focusing = ref<boolean>(false) // 当前是否激活状态
|
|
118
|
-
const inputValue = ref<string
|
|
116
|
+
const inputValue = ref<string>('') // 输入框的值
|
|
119
117
|
const cell = useCell()
|
|
120
118
|
|
|
121
119
|
watch(
|
|
@@ -123,7 +121,7 @@ watch(
|
|
|
123
121
|
(newValue) => {
|
|
124
122
|
focused.value = newValue
|
|
125
123
|
},
|
|
126
|
-
{ immediate: true, deep: true }
|
|
124
|
+
{ immediate: true, deep: true }
|
|
127
125
|
)
|
|
128
126
|
|
|
129
127
|
watch(
|
|
@@ -131,7 +129,7 @@ watch(
|
|
|
131
129
|
(newValue) => {
|
|
132
130
|
inputValue.value = isDef(newValue) ? String(newValue) : ''
|
|
133
131
|
},
|
|
134
|
-
{ immediate: true, deep: true }
|
|
132
|
+
{ immediate: true, deep: true }
|
|
135
133
|
)
|
|
136
134
|
|
|
137
135
|
const { parent: form } = useParent(FORM_KEY)
|
|
@@ -141,13 +139,7 @@ const { parent: form } = useParent(FORM_KEY)
|
|
|
141
139
|
*/
|
|
142
140
|
const showClear = computed(() => {
|
|
143
141
|
const { disabled, readonly, clearable, clearTrigger } = props
|
|
144
|
-
if (
|
|
145
|
-
clearable &&
|
|
146
|
-
!readonly &&
|
|
147
|
-
!disabled &&
|
|
148
|
-
inputValue.value &&
|
|
149
|
-
(clearTrigger === 'always' || (props.clearTrigger === 'focus' && focusing.value))
|
|
150
|
-
) {
|
|
142
|
+
if (clearable && !readonly && !disabled && inputValue.value && (clearTrigger === 'always' || (props.clearTrigger === 'focus' && focusing.value))) {
|
|
151
143
|
return true
|
|
152
144
|
} else {
|
|
153
145
|
return false
|
|
@@ -177,11 +169,7 @@ const isRequired = computed(() => {
|
|
|
177
169
|
if (form && form.props.rules) {
|
|
178
170
|
const rules = form.props.rules
|
|
179
171
|
for (const key in rules) {
|
|
180
|
-
if (
|
|
181
|
-
Object.prototype.hasOwnProperty.call(rules, key) &&
|
|
182
|
-
key === props.prop &&
|
|
183
|
-
Array.isArray(rules[key])
|
|
184
|
-
) {
|
|
172
|
+
if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) {
|
|
185
173
|
formRequired = rules[key].some((rule: FormItemRule) => rule.required)
|
|
186
174
|
}
|
|
187
175
|
}
|
|
@@ -191,19 +179,23 @@ const isRequired = computed(() => {
|
|
|
191
179
|
|
|
192
180
|
// 当前文本域文字长度
|
|
193
181
|
const currentLength = computed(() => {
|
|
194
|
-
|
|
182
|
+
/**
|
|
183
|
+
* 使用Array.from处理多码元字符以获取正确的长度
|
|
184
|
+
* @link https://github.com/Moonofweisheng/wot-design-uni/issues/933
|
|
185
|
+
*/
|
|
186
|
+
return Array.from(String(formatValue(props.modelValue))).length
|
|
195
187
|
})
|
|
196
188
|
|
|
197
189
|
const rootClass = computed(() => {
|
|
198
|
-
return `wd-textarea ${props.label ||
|
|
199
|
-
|
|
200
|
-
} ${props.
|
|
201
|
-
|
|
202
|
-
}
|
|
190
|
+
return `wd-textarea ${props.label || slots.label ? 'is-cell' : ''} ${props.center ? 'is-center' : ''} ${cell.border.value ? 'is-border' : ''} ${
|
|
191
|
+
props.size ? 'is-' + props.size : ''
|
|
192
|
+
} ${props.error ? 'is-error' : ''} ${props.disabled ? 'is-disabled' : ''} ${props.autoHeight ? 'is-auto-height' : ''} ${
|
|
193
|
+
currentLength.value > 0 ? 'is-not-empty' : ''
|
|
194
|
+
} ${props.noBorder ? 'is-no-border' : ''} ${props.customClass}`
|
|
203
195
|
})
|
|
204
196
|
|
|
205
197
|
const labelClass = computed(() => {
|
|
206
|
-
return `wd-textarea__label ${props.customLabelClass}
|
|
198
|
+
return `wd-textarea__label ${props.customLabelClass}`
|
|
207
199
|
})
|
|
208
200
|
|
|
209
201
|
const inputPlaceholderClass = computed(() => {
|
|
@@ -218,7 +210,7 @@ const labelStyle = computed(() => {
|
|
|
218
210
|
return props.labelWidth
|
|
219
211
|
? objToStyle({
|
|
220
212
|
'min-width': props.labelWidth,
|
|
221
|
-
'max-width': props.labelWidth
|
|
213
|
+
'max-width': props.labelWidth
|
|
222
214
|
})
|
|
223
215
|
: ''
|
|
224
216
|
})
|
|
@@ -234,31 +226,28 @@ function initState() {
|
|
|
234
226
|
}
|
|
235
227
|
|
|
236
228
|
function formatValue(value: string | number) {
|
|
229
|
+
if (value === null || value === undefined) return ''
|
|
237
230
|
const { maxlength, showWordLimit } = props
|
|
238
231
|
if (showWordLimit && maxlength !== -1 && String(value).length > maxlength) {
|
|
239
232
|
return value.toString().substring(0, maxlength)
|
|
240
233
|
}
|
|
241
|
-
return value
|
|
234
|
+
return `${value}`
|
|
242
235
|
}
|
|
243
236
|
|
|
244
|
-
function handleClear() {
|
|
245
|
-
clearing.value = true
|
|
237
|
+
async function handleClear() {
|
|
246
238
|
focusing.value = false
|
|
247
239
|
inputValue.value = ''
|
|
248
240
|
if (props.focusWhenClear) {
|
|
241
|
+
clearing.value = true
|
|
249
242
|
focused.value = false
|
|
250
243
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
})
|
|
259
|
-
emit('update:modelValue', inputValue.value)
|
|
260
|
-
emit('clear')
|
|
261
|
-
})
|
|
244
|
+
await pause()
|
|
245
|
+
if (props.focusWhenClear) {
|
|
246
|
+
focused.value = true
|
|
247
|
+
focusing.value = true
|
|
248
|
+
}
|
|
249
|
+
emit('update:modelValue', inputValue.value)
|
|
250
|
+
emit('clear')
|
|
262
251
|
}
|
|
263
252
|
async function handleBlur({ detail }: any) {
|
|
264
253
|
// 等待150毫秒,clear执行完毕
|
|
@@ -272,7 +261,7 @@ async function handleBlur({ detail }: any) {
|
|
|
272
261
|
focusing.value = false
|
|
273
262
|
emit('blur', {
|
|
274
263
|
value: inputValue.value,
|
|
275
|
-
cursor: detail.cursor ? detail.cursor : null
|
|
264
|
+
cursor: detail.cursor ? detail.cursor : null
|
|
276
265
|
})
|
|
277
266
|
}
|
|
278
267
|
function handleFocus({ detail }: any) {
|
|
@@ -299,5 +288,9 @@ function onClickPrefixIcon() {
|
|
|
299
288
|
</script>
|
|
300
289
|
|
|
301
290
|
<style lang="scss" scoped>
|
|
302
|
-
@import './index';
|
|
291
|
+
@import './index.scss';
|
|
292
|
+
</style>
|
|
293
|
+
|
|
294
|
+
<style lang="scss">
|
|
295
|
+
@import './placeholder.scss';
|
|
303
296
|
</style>
|
|
@@ -1,63 +1,76 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
3
|
|
|
4
4
|
@include b(toast) {
|
|
5
|
-
box-sizing: border-box;
|
|
6
5
|
display: inline-block;
|
|
7
6
|
max-width: $-toast-max-width;
|
|
8
7
|
padding: $-toast-padding;
|
|
9
|
-
font-size: $-toast-fs;
|
|
10
|
-
color: #fff;
|
|
11
8
|
background-color: $-toast-bg;
|
|
12
9
|
border-radius: $-toast-radius;
|
|
13
|
-
|
|
10
|
+
color: $-toast-color;
|
|
14
11
|
transition: all 0.2s;
|
|
12
|
+
font-size: $-toast-fs;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
box-shadow: $-toast-box-shadow;
|
|
15
|
+
|
|
16
|
+
@include when(vertical) {
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
@include e(msg) {
|
|
17
|
-
font-family: 'San Francisco', Rotobo, arial, 'PingFang SC', 'Noto SansCJK', 'Microsoft Yahei',
|
|
18
|
-
sans-serif;
|
|
19
21
|
font-size: $-toast-fs;
|
|
20
|
-
|
|
22
|
+
word-break: break-all;
|
|
23
|
+
line-height: $-toast-line-height;
|
|
21
24
|
text-align: left;
|
|
25
|
+
font-family: "San Francisco", Rotobo, arial, "PingFang SC", "Noto SansCJK", "Microsoft Yahei", sans-serif;
|
|
22
26
|
}
|
|
27
|
+
|
|
23
28
|
@include edeep(icon) {
|
|
24
29
|
display: inline-block;
|
|
25
|
-
margin-right: $-toast-icon-margin-right;
|
|
26
30
|
font-size: $-toast-icon-size;
|
|
31
|
+
@include when(vertical) {
|
|
32
|
+
margin-bottom: $-toast-icon-margin-bottom;
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
|
-
@include e(iconWrap)
|
|
35
|
+
@include e(iconWrap){
|
|
29
36
|
font-size: 0;
|
|
30
37
|
line-height: 0;
|
|
31
38
|
vertical-align: middle;
|
|
32
39
|
}
|
|
33
|
-
@include e(iconBox)
|
|
40
|
+
@include e(iconBox){
|
|
34
41
|
display: block;
|
|
35
42
|
width: 100%;
|
|
36
43
|
height: 100%;
|
|
37
44
|
}
|
|
38
|
-
@include e(iconSvg)
|
|
45
|
+
@include e(iconSvg){
|
|
39
46
|
width: $-toast-icon-size;
|
|
40
47
|
height: $-toast-icon-size;
|
|
41
|
-
background-repeat: no-repeat;
|
|
42
48
|
background-size: cover;
|
|
49
|
+
background-repeat: no-repeat;
|
|
43
50
|
}
|
|
44
51
|
@include e(loading) {
|
|
52
|
+
margin-bottom: $-toast-loading-margin-bottom;
|
|
45
53
|
display: inline-block;
|
|
46
|
-
margin-bottom: 16px;
|
|
47
54
|
}
|
|
48
55
|
@include m(top) {
|
|
49
56
|
transform: translate3d(0, -40vh, 0);
|
|
50
57
|
}
|
|
51
|
-
@include m(middle)
|
|
52
|
-
transform: translate3d(0
|
|
58
|
+
@include m(middle-top){
|
|
59
|
+
transform: translate3d(0%,-18.8vh,0);
|
|
53
60
|
}
|
|
54
61
|
@include m(bottom) {
|
|
55
62
|
transform: translate3d(0, 40vh, 0);
|
|
56
63
|
}
|
|
57
64
|
@include m(with-icon) {
|
|
65
|
+
min-width: $-toast-with-icon-min-width;
|
|
58
66
|
display: inline-flex;
|
|
59
67
|
align-items: center;
|
|
60
|
-
|
|
68
|
+
@include me(msg) {
|
|
69
|
+
margin-left: $-toast-msg-margin-left;
|
|
70
|
+
@include when(vertical) {
|
|
71
|
+
margin-left: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
}
|
|
62
75
|
@include m(loading) {
|
|
63
76
|
min-width: auto;
|
|
@@ -1,60 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
* @Author: weisheng
|
|
3
|
-
* @Date: 2024-03-29 13:29:57
|
|
4
|
-
* @LastEditTime: 2024-07-18 23:16:16
|
|
5
|
-
* @LastEditors: weisheng
|
|
6
|
-
* @Description:
|
|
7
|
-
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-toast/index.ts
|
|
8
|
-
* 记得注释
|
|
9
|
-
*/
|
|
10
|
-
import { provide, ref } from 'vue'
|
|
1
|
+
import { inject, provide, ref } from 'vue'
|
|
11
2
|
import type { Toast, ToastOptions } from './types'
|
|
12
3
|
import { deepMerge } from '../common/util'
|
|
13
4
|
|
|
14
5
|
/**
|
|
15
6
|
* useToast 用到的key
|
|
16
|
-
*
|
|
17
|
-
* @internal
|
|
18
7
|
*/
|
|
19
|
-
|
|
8
|
+
const toastDefaultOptionKey = '__TOAST_OPTION__'
|
|
20
9
|
|
|
21
10
|
// 默认模板
|
|
22
11
|
export const defaultOptions: ToastOptions = {
|
|
23
|
-
msg: '',
|
|
24
12
|
duration: 2000,
|
|
25
|
-
|
|
26
|
-
loadingColor: '#4D80F0',
|
|
27
|
-
iconColor: '#4D80F0',
|
|
28
|
-
position: 'middle',
|
|
29
|
-
show: false,
|
|
30
|
-
zIndex: 100,
|
|
13
|
+
show: false
|
|
31
14
|
}
|
|
32
15
|
|
|
16
|
+
const None = Symbol('None')
|
|
17
|
+
|
|
33
18
|
export function useToast(selector: string = ''): Toast {
|
|
19
|
+
const toastOptionKey = getToastOptionKey(selector)
|
|
20
|
+
const toastOption = inject(toastOptionKey, ref<ToastOptions | typeof None>(None)) // toast选项
|
|
21
|
+
if (toastOption.value === None) {
|
|
22
|
+
toastOption.value = defaultOptions
|
|
23
|
+
provide(toastOptionKey, toastOption)
|
|
24
|
+
}
|
|
34
25
|
let timer: ReturnType<typeof setTimeout> | null = null
|
|
35
|
-
const toastOption = ref<ToastOptions>(defaultOptions) // Toast选项
|
|
36
|
-
const toastOptionKey = selector ? toastDefaultOptionKey + selector : toastDefaultOptionKey
|
|
37
|
-
provide(toastOptionKey, toastOption)
|
|
38
26
|
|
|
39
27
|
const createMethod = (toastOptions: ToastOptions) => {
|
|
40
|
-
// 优先级:options->toastOptions->defaultOptions
|
|
41
28
|
return (options: ToastOptions | string) => {
|
|
42
|
-
return show(
|
|
43
|
-
deepMerge(
|
|
44
|
-
toastOptions,
|
|
45
|
-
typeof options === 'string' ? { msg: options } : options,
|
|
46
|
-
) as ToastOptions,
|
|
47
|
-
)
|
|
29
|
+
return show(deepMerge(toastOptions, typeof options === 'string' ? { msg: options } : options) as ToastOptions)
|
|
48
30
|
}
|
|
49
31
|
}
|
|
50
32
|
|
|
51
33
|
const show = (option: ToastOptions | string) => {
|
|
52
|
-
const options = deepMerge(
|
|
53
|
-
defaultOptions,
|
|
54
|
-
typeof option === 'string' ? { msg: option } : option,
|
|
55
|
-
) as ToastOptions
|
|
34
|
+
const options = deepMerge(defaultOptions, typeof option === 'string' ? { msg: option } : option) as ToastOptions
|
|
56
35
|
toastOption.value = deepMerge(options, {
|
|
57
|
-
show: true
|
|
36
|
+
show: true
|
|
58
37
|
}) as ToastOptions
|
|
59
38
|
// 开始渲染,并在 duration ms之后执行清除
|
|
60
39
|
timer && clearTimeout(timer)
|
|
@@ -69,11 +48,11 @@ export function useToast(selector: string = ''): Toast {
|
|
|
69
48
|
const loading = createMethod({
|
|
70
49
|
iconName: 'loading',
|
|
71
50
|
duration: 0,
|
|
72
|
-
cover: true
|
|
51
|
+
cover: true
|
|
73
52
|
})
|
|
74
53
|
const success = createMethod({
|
|
75
54
|
iconName: 'success',
|
|
76
|
-
duration: 1500
|
|
55
|
+
duration: 1500
|
|
77
56
|
})
|
|
78
57
|
const error = createMethod({ iconName: 'error' })
|
|
79
58
|
const warning = createMethod({ iconName: 'warning' })
|
|
@@ -89,21 +68,25 @@ export function useToast(selector: string = ''): Toast {
|
|
|
89
68
|
error,
|
|
90
69
|
warning,
|
|
91
70
|
info,
|
|
92
|
-
close
|
|
71
|
+
close
|
|
93
72
|
}
|
|
94
73
|
}
|
|
95
74
|
|
|
75
|
+
export const getToastOptionKey = (selector: string) => {
|
|
76
|
+
return selector ? `${toastDefaultOptionKey}${selector}` : toastDefaultOptionKey
|
|
77
|
+
}
|
|
78
|
+
|
|
96
79
|
export const toastIcon = {
|
|
97
80
|
success() {
|
|
98
|
-
return '<svg
|
|
81
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 44 44" width="48" height="48"><circle cx="24" cy="26" r="22" fill="#000" opacity=".1"/><circle cx="24" cy="24" r="20" fill="#34D19D" opacity=".4"/><circle cx="24" cy="24" r="16" fill="#34D19D"/><path d="M19 24l4 4 8-8" stroke="#FFF" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>'
|
|
99
82
|
},
|
|
100
83
|
warning() {
|
|
101
|
-
return '<svg
|
|
84
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 44 44" width="48" height="48"><circle cx="24" cy="26" r="22" fill="#000" opacity=".1"/><circle cx="24" cy="24" r="20" fill="#F0883A" opacity=".4"/><circle cx="24" cy="24" r="16" fill="#F0883A"/><rect x="22.5" y="14" width="3" height="12" fill="#FFF" rx="1.5"/><circle cx="24" cy="30" r="2" fill="#FFF"/></svg>'
|
|
102
85
|
},
|
|
103
86
|
info() {
|
|
104
|
-
return '<svg
|
|
87
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 44 44" width="48" height="48"><circle cx="24" cy="26" r="22" fill="#000" opacity=".1"/><circle cx="24" cy="24" r="20" fill="#909CB7" opacity=".4"/><circle cx="24" cy="24" r="16" fill="#909CB7"/><circle cx="24" cy="18" r="2" fill="#FFF"/><rect x="22.5" y="22" width="3" height="12" fill="#FFF" rx="1.5"/></svg>'
|
|
105
88
|
},
|
|
106
89
|
error() {
|
|
107
|
-
return '<svg
|
|
108
|
-
}
|
|
90
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 44 44" width="48" height="48"><circle cx="24" cy="26" r="22" fill="#000" opacity=".1"/><circle cx="24" cy="24" r="20" fill="#fa4350" opacity=".4"/><circle cx="24" cy="24" r="16" fill="#fa4350"/><path d="M18 18l12 12M30 18L18 30" stroke="#FFF" stroke-width="2.5" stroke-linecap="round"/></svg>'
|
|
91
|
+
}
|
|
109
92
|
}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: weisheng
|
|
3
3
|
* @Date: 2023-06-19 12:47:57
|
|
4
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditTime: 2025-02-16 15:52:17
|
|
5
5
|
* @LastEditors: weisheng
|
|
6
6
|
* @Description:
|
|
7
7
|
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-toast/types.ts
|
|
8
8
|
* 记得注释
|
|
9
9
|
*/
|
|
10
|
-
import type { ExtractPropTypes } from 'vue'
|
|
10
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
11
11
|
import { baseProps, makeStringProp } from '../common/props'
|
|
12
12
|
import type { LoadingType } from '../wd-loading/types'
|
|
13
13
|
|
|
14
14
|
export type ToastIconType = 'success' | 'error' | 'warning' | 'loading' | 'info' // 图标类型
|
|
15
15
|
|
|
16
|
-
export type ToastPositionType = 'top' | 'middle' | 'bottom' // 提示信息框的位置类型
|
|
16
|
+
export type ToastPositionType = 'top' | 'middle-top' | 'middle' | 'bottom' // 提示信息框的位置类型
|
|
17
|
+
|
|
18
|
+
export type ToastDirection = 'vertical' | 'horizontal' // 提示信息框的排列方向
|
|
17
19
|
|
|
18
20
|
export type ToastLoadingType = LoadingType // 提示信息加载状态类型
|
|
19
21
|
|
|
20
22
|
export type ToastOptions = {
|
|
21
23
|
msg?: string
|
|
22
24
|
duration?: number
|
|
25
|
+
direction?: ToastDirection
|
|
23
26
|
iconName?: ToastIconType
|
|
24
27
|
iconSize?: number
|
|
25
28
|
loadingType?: ToastLoadingType
|
|
@@ -70,7 +73,118 @@ export interface Toast {
|
|
|
70
73
|
|
|
71
74
|
export const toastProps = {
|
|
72
75
|
...baseProps,
|
|
76
|
+
/**
|
|
77
|
+
* 选择器
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
73
81
|
selector: makeStringProp(''),
|
|
82
|
+
/**
|
|
83
|
+
* 提示信息
|
|
84
|
+
* @type {string}
|
|
85
|
+
* @default ''
|
|
86
|
+
*/
|
|
87
|
+
msg: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: ''
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 排列方向
|
|
93
|
+
* @type {'vertical' | 'horizontal'}
|
|
94
|
+
* @default 'horizontal'
|
|
95
|
+
*/
|
|
96
|
+
direction: makeStringProp<ToastDirection>('horizontal'),
|
|
97
|
+
/**
|
|
98
|
+
* 图标名称
|
|
99
|
+
* @type {'success' | 'error' | 'warning' | 'loading' | 'info'}
|
|
100
|
+
* @default ''
|
|
101
|
+
*/
|
|
102
|
+
iconName: {
|
|
103
|
+
type: String as PropType<ToastIconType>,
|
|
104
|
+
default: ''
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* 图标大小
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
iconSize: Number,
|
|
111
|
+
/**
|
|
112
|
+
* 加载类型
|
|
113
|
+
* @type {'outline' | 'ring'}
|
|
114
|
+
* @default 'outline'
|
|
115
|
+
*/
|
|
116
|
+
loadingType: makeStringProp<ToastLoadingType>('outline'),
|
|
117
|
+
/**
|
|
118
|
+
* 加载颜色
|
|
119
|
+
* @type {string}
|
|
120
|
+
* @default '#4D80F0'
|
|
121
|
+
*/
|
|
122
|
+
loadingColor: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: '#4D80F0'
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* 加载大小
|
|
128
|
+
* @type {number}
|
|
129
|
+
*/
|
|
130
|
+
loadingSize: Number,
|
|
131
|
+
/**
|
|
132
|
+
* 图标颜色
|
|
133
|
+
* @type {string}
|
|
134
|
+
*/
|
|
135
|
+
iconColor: String,
|
|
136
|
+
/**
|
|
137
|
+
* 位置
|
|
138
|
+
* @type {'top' | 'middle-top' | 'middle' | 'bottom'}
|
|
139
|
+
* @default 'middle-top'
|
|
140
|
+
*/
|
|
141
|
+
position: makeStringProp<ToastPositionType>('middle-top'),
|
|
142
|
+
/**
|
|
143
|
+
* 层级
|
|
144
|
+
* @type {number}
|
|
145
|
+
* @default 100
|
|
146
|
+
*/
|
|
147
|
+
zIndex: {
|
|
148
|
+
type: Number,
|
|
149
|
+
default: 100
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* 是否存在遮罩层
|
|
153
|
+
* @type {boolean}
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
cover: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* 图标类名
|
|
162
|
+
* @type {string}
|
|
163
|
+
* @default ''
|
|
164
|
+
*/
|
|
165
|
+
iconClass: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: ''
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* 类名前缀
|
|
171
|
+
* @type {string}
|
|
172
|
+
* @default 'wd-icon'
|
|
173
|
+
*/
|
|
174
|
+
classPrefix: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: 'wd-icon'
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* 完全展示后的回调函数
|
|
180
|
+
* @type {Function}
|
|
181
|
+
*/
|
|
182
|
+
opened: Function as PropType<() => void>,
|
|
183
|
+
/**
|
|
184
|
+
* 完全关闭时的回调函数
|
|
185
|
+
* @type {Function}
|
|
186
|
+
*/
|
|
187
|
+
closed: Function as PropType<() => void>
|
|
74
188
|
}
|
|
75
189
|
|
|
76
190
|
export type ToastProps = ExtractPropTypes<typeof toastProps>
|