@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,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 绘制的图片canvas -->
|
|
3
|
-
<view
|
|
4
|
-
v-if="modelValue"
|
|
5
|
-
:class="`wd-img-cropper ${customClass}`"
|
|
6
|
-
:style="customStyle"
|
|
7
|
-
@touchmove="preventTouchMove"
|
|
8
|
-
>
|
|
3
|
+
<view v-if="modelValue" :class="`wd-img-cropper ${customClass}`" :style="customStyle" @touchmove="preventTouchMove">
|
|
9
4
|
<!-- 展示在用户面前的裁剪框 -->
|
|
10
5
|
<view class="wd-img-cropper__wrapper">
|
|
11
6
|
<!-- 画出裁剪框 -->
|
|
12
7
|
<view class="wd-img-cropper__cut">
|
|
13
8
|
<!-- 上方阴影块 -->
|
|
14
|
-
<view
|
|
15
|
-
|
|
16
|
-
:style="`height: ${cutTop}px;`"
|
|
17
|
-
></view>
|
|
18
|
-
<view class="wd-img-cropper__cut--middle">
|
|
9
|
+
<view :class="`wd-img-cropper__cut--top ${IS_TOUCH_END ? '' : 'is-hightlight'}`" :style="`height: ${cutTop}px;`"></view>
|
|
10
|
+
<view class="wd-img-cropper__cut--middle" :style="`height: ${cutHeight}px;`">
|
|
19
11
|
<!-- 左侧阴影块 -->
|
|
20
12
|
<view
|
|
21
13
|
:class="`wd-img-cropper__cut--left ${IS_TOUCH_END ? '' : 'is-hightlight'}`"
|
|
22
|
-
:style="`width: ${cutLeft}px; height: ${
|
|
14
|
+
:style="`width: ${cutLeft}px; height: ${cutHeight}px;`"
|
|
23
15
|
></view>
|
|
24
16
|
<!-- 裁剪框 -->
|
|
25
|
-
<view
|
|
26
|
-
class="wd-img-cropper__cut--body"
|
|
27
|
-
:style="`width: ${cutWidth}px; height: ${cutHeight}px;`"
|
|
28
|
-
>
|
|
17
|
+
<view class="wd-img-cropper__cut--body" :style="`width: ${cutWidth}px; height: ${cutHeight}px;`">
|
|
29
18
|
<!-- 内部网格线 -->
|
|
30
19
|
<view class="is-gridlines-x"></view>
|
|
31
20
|
<view class="is-gridlines-y"></view>
|
|
@@ -59,27 +48,18 @@
|
|
|
59
48
|
</view>
|
|
60
49
|
<!-- 绘制的图片canvas -->
|
|
61
50
|
<canvas
|
|
62
|
-
canvas-id="
|
|
63
|
-
id="
|
|
51
|
+
:canvas-id="canvasId"
|
|
52
|
+
:id="canvasId"
|
|
64
53
|
class="wd-img-cropper__canvas"
|
|
65
54
|
:disable-scroll="true"
|
|
66
55
|
:style="`width: ${Number(canvasWidth) * canvasScale}px; height: ${Number(canvasHeight) * canvasScale}px;`"
|
|
67
56
|
/>
|
|
68
57
|
<!-- 下方按钮 -->
|
|
69
58
|
<view class="wd-img-cropper__footer">
|
|
70
|
-
<wd-icon
|
|
71
|
-
custom-class="wd-img-cropper__rotate"
|
|
72
|
-
v-if="!disabledRotate"
|
|
73
|
-
name="rotate"
|
|
74
|
-
@click="handleRotate"
|
|
75
|
-
></wd-icon>
|
|
59
|
+
<wd-icon custom-class="wd-img-cropper__rotate" v-if="!disabledRotate" name="rotate" @click="handleRotate"></wd-icon>
|
|
76
60
|
<view class="wd-img-cropper__footer--button">
|
|
77
|
-
<view class="is-cancel" @click="handleCancel">
|
|
78
|
-
|
|
79
|
-
</view>
|
|
80
|
-
<wd-button size="small" :custom-style="buttonStyle" @click="handleConfirm">
|
|
81
|
-
{{ confirmButtonText || translate('confirm') }}
|
|
82
|
-
</wd-button>
|
|
61
|
+
<view class="is-cancel" @click="handleCancel">{{ cancelButtonText || translate('cancel') }}</view>
|
|
62
|
+
<wd-button size="small" :custom-style="buttonStyle" @click="handleConfirm">{{ confirmButtonText || translate('confirm') }}</wd-button>
|
|
83
63
|
</view>
|
|
84
64
|
</view>
|
|
85
65
|
</view>
|
|
@@ -91,17 +71,21 @@ export default {
|
|
|
91
71
|
options: {
|
|
92
72
|
virtualHost: true,
|
|
93
73
|
addGlobalClass: true,
|
|
94
|
-
styleIsolation: 'shared'
|
|
95
|
-
}
|
|
74
|
+
styleIsolation: 'shared'
|
|
75
|
+
}
|
|
96
76
|
}
|
|
97
77
|
</script>
|
|
98
78
|
|
|
99
79
|
<script lang="ts" setup>
|
|
80
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
81
|
+
import wdButton from '../wd-button/wd-button.vue'
|
|
100
82
|
import { computed, getCurrentInstance, ref, watch } from 'vue'
|
|
101
|
-
import { addUnit, objToStyle } from '../common/util'
|
|
83
|
+
import { addUnit, getSystemInfo, objToStyle, uuid } from '../common/util'
|
|
102
84
|
import { useTranslate } from '../composables/useTranslate'
|
|
103
85
|
import { imgCropperProps, type ImgCropperExpose } from './types'
|
|
104
86
|
|
|
87
|
+
const canvasId = ref<string>(`cropper${uuid()}`) // canvas 组件的唯一标识符
|
|
88
|
+
|
|
105
89
|
// 延时动画设置
|
|
106
90
|
let CHANGE_TIME: any | null = null
|
|
107
91
|
// 移动节流
|
|
@@ -124,7 +108,7 @@ const { translate } = useTranslate('img-cropper')
|
|
|
124
108
|
const imgAngle = ref<number>(0)
|
|
125
109
|
// 是否开启动画
|
|
126
110
|
const isAnimation = ref<boolean>(false)
|
|
127
|
-
// #ifdef MP-ALIPAY || APP-PLUS
|
|
111
|
+
// #ifdef MP-ALIPAY || APP-PLUS || H5
|
|
128
112
|
// hack 避免钉钉小程序、支付宝小程序、app抛出相关异常
|
|
129
113
|
const animation: any = null
|
|
130
114
|
// #endif
|
|
@@ -148,11 +132,11 @@ const imgScale = ref<number>(1)
|
|
|
148
132
|
// imgWidth: null,
|
|
149
133
|
// imgHeight: null,
|
|
150
134
|
// 图片中心轴点距左的距离
|
|
151
|
-
const imgLeft = ref<number>(
|
|
152
|
-
const imgTop = ref<number>((
|
|
135
|
+
const imgLeft = ref<number>(getSystemInfo().windowWidth / 2)
|
|
136
|
+
const imgTop = ref<number>((getSystemInfo().windowHeight / 2) * TOP_PERCENT)
|
|
153
137
|
|
|
154
138
|
const imgInfo = ref<UniApp.GetImageInfoSuccessData | null>(null)
|
|
155
|
-
const info = ref
|
|
139
|
+
const info = ref(getSystemInfo())
|
|
156
140
|
|
|
157
141
|
// 是否移动中设置 同时控制背景颜色是否高亮
|
|
158
142
|
const IS_TOUCH_END = ref<boolean>(true)
|
|
@@ -160,12 +144,12 @@ const IS_TOUCH_END = ref<boolean>(true)
|
|
|
160
144
|
const movingPosRecord = ref<Record<string, string | number>[]>([
|
|
161
145
|
{
|
|
162
146
|
x: '',
|
|
163
|
-
y: ''
|
|
147
|
+
y: ''
|
|
164
148
|
},
|
|
165
149
|
{
|
|
166
150
|
x: '',
|
|
167
|
-
y: ''
|
|
168
|
-
}
|
|
151
|
+
y: ''
|
|
152
|
+
}
|
|
169
153
|
])
|
|
170
154
|
// 双指缩放时 两个坐标点斜边长度
|
|
171
155
|
const fingerDistance = ref<string | number>('')
|
|
@@ -180,15 +164,22 @@ watch(
|
|
|
180
164
|
if (newValue) {
|
|
181
165
|
INIT_IMGWIDTH = props.imgWidth
|
|
182
166
|
INIT_IMGHEIGHT = props.imgHeight
|
|
183
|
-
info.value =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
167
|
+
info.value = getSystemInfo()
|
|
168
|
+
|
|
169
|
+
// 根据aspectRatio计算裁剪框尺寸
|
|
170
|
+
const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
|
|
171
|
+
const tempCutWidth = info.value.windowWidth - offset.value * 2
|
|
172
|
+
const tempCutHeight = (tempCutWidth * heightRatio) / widthRatio
|
|
173
|
+
|
|
174
|
+
cutWidth.value = tempCutWidth
|
|
175
|
+
cutHeight.value = tempCutHeight
|
|
176
|
+
cutTop.value = (info.value.windowHeight * TOP_PERCENT - tempCutHeight) / 2
|
|
188
177
|
cutLeft.value = offset.value
|
|
178
|
+
|
|
189
179
|
canvasScale.value = props.exportScale
|
|
190
|
-
canvasHeight.value =
|
|
191
|
-
canvasWidth.value =
|
|
180
|
+
canvasHeight.value = tempCutHeight
|
|
181
|
+
canvasWidth.value = tempCutWidth
|
|
182
|
+
|
|
192
183
|
// 根据开发者设置的图片目标尺寸计算实际尺寸
|
|
193
184
|
initImageSize()
|
|
194
185
|
// 初始化canvas
|
|
@@ -201,8 +192,8 @@ watch(
|
|
|
201
192
|
},
|
|
202
193
|
{
|
|
203
194
|
deep: true,
|
|
204
|
-
immediate: true
|
|
205
|
-
}
|
|
195
|
+
immediate: true
|
|
196
|
+
}
|
|
206
197
|
)
|
|
207
198
|
|
|
208
199
|
watch(
|
|
@@ -212,8 +203,8 @@ watch(
|
|
|
212
203
|
},
|
|
213
204
|
{
|
|
214
205
|
deep: true,
|
|
215
|
-
immediate: true
|
|
216
|
-
}
|
|
206
|
+
immediate: true
|
|
207
|
+
}
|
|
217
208
|
)
|
|
218
209
|
|
|
219
210
|
watch(
|
|
@@ -225,8 +216,8 @@ watch(
|
|
|
225
216
|
},
|
|
226
217
|
{
|
|
227
218
|
deep: true,
|
|
228
|
-
immediate: true
|
|
229
|
-
}
|
|
219
|
+
immediate: true
|
|
220
|
+
}
|
|
230
221
|
)
|
|
231
222
|
watch(
|
|
232
223
|
() => isAnimation.value,
|
|
@@ -242,8 +233,8 @@ watch(
|
|
|
242
233
|
},
|
|
243
234
|
{
|
|
244
235
|
deep: true,
|
|
245
|
-
immediate: true
|
|
246
|
-
}
|
|
236
|
+
immediate: true
|
|
237
|
+
}
|
|
247
238
|
)
|
|
248
239
|
|
|
249
240
|
const buttonStyle = computed(() => {
|
|
@@ -253,7 +244,7 @@ const buttonStyle = computed(() => {
|
|
|
253
244
|
// height: 32px;
|
|
254
245
|
width: '56px',
|
|
255
246
|
'border-radius': '16px',
|
|
256
|
-
'font-size': '16px'
|
|
247
|
+
'font-size': '16px'
|
|
257
248
|
}
|
|
258
249
|
|
|
259
250
|
return objToStyle(style)
|
|
@@ -266,7 +257,7 @@ const imageStyle = computed(() => {
|
|
|
266
257
|
transform: `translate(${addUnit(imgLeft.value - picWidth.value / 2)}, ${addUnit(imgTop.value - picHeight.value / 2)}) scale(${
|
|
267
258
|
imgScale.value
|
|
268
259
|
}) rotate(${imgAngle.value}deg)`,
|
|
269
|
-
'transition-duration': (isAnimation.value ? 0.4 : 0) + 's'
|
|
260
|
+
'transition-duration': (isAnimation.value ? 0.4 : 0) + 's'
|
|
270
261
|
}
|
|
271
262
|
return objToStyle(style)
|
|
272
263
|
})
|
|
@@ -274,8 +265,12 @@ const imageStyle = computed(() => {
|
|
|
274
265
|
/**
|
|
275
266
|
* 逆转是否使用动画
|
|
276
267
|
*/
|
|
277
|
-
function revertIsAnimation(animation: boolean) {
|
|
278
|
-
|
|
268
|
+
function revertIsAnimation(animation: boolean | { value: boolean }) {
|
|
269
|
+
if (typeof animation === 'boolean') {
|
|
270
|
+
isAnimation.value = animation
|
|
271
|
+
} else {
|
|
272
|
+
isAnimation.value = animation.value
|
|
273
|
+
}
|
|
279
274
|
}
|
|
280
275
|
|
|
281
276
|
/**
|
|
@@ -286,7 +281,23 @@ function setRoate(angle: number) {
|
|
|
286
281
|
if (!angle || props.disabledRotate) return
|
|
287
282
|
revertIsAnimation(true)
|
|
288
283
|
imgAngle.value = angle
|
|
289
|
-
|
|
284
|
+
|
|
285
|
+
// 重新计算缩放比例
|
|
286
|
+
let tempPicWidth = picWidth.value
|
|
287
|
+
let tempPicHeight = picHeight.value
|
|
288
|
+
|
|
289
|
+
// 旋转后宽高互换
|
|
290
|
+
if ((angle / 90) % 2) {
|
|
291
|
+
tempPicWidth = picHeight.value
|
|
292
|
+
tempPicHeight = picWidth.value
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// 计算新的缩放比例
|
|
296
|
+
const widthRatio = cutWidth.value / tempPicWidth
|
|
297
|
+
const heightRatio = cutHeight.value / tempPicHeight
|
|
298
|
+
imgScale.value = Math.max(widthRatio, heightRatio)
|
|
299
|
+
|
|
300
|
+
// 检测边缘位置
|
|
290
301
|
detectImgPosIsEdge()
|
|
291
302
|
}
|
|
292
303
|
|
|
@@ -294,7 +305,7 @@ function setRoate(angle: number) {
|
|
|
294
305
|
* 初始化图片的大小和角度以及距离
|
|
295
306
|
*/
|
|
296
307
|
function resetImg() {
|
|
297
|
-
const { windowHeight, windowWidth } =
|
|
308
|
+
const { windowHeight, windowWidth } = getSystemInfo()
|
|
298
309
|
imgScale.value = 1
|
|
299
310
|
imgAngle.value = 0
|
|
300
311
|
imgLeft.value = windowWidth / 2
|
|
@@ -319,44 +330,48 @@ function loadImg() {
|
|
|
319
330
|
},
|
|
320
331
|
fail: () => {
|
|
321
332
|
// this.setData({ imgSrc: '' })
|
|
322
|
-
}
|
|
333
|
+
}
|
|
323
334
|
})
|
|
324
335
|
}
|
|
325
336
|
|
|
326
337
|
/**
|
|
327
|
-
*
|
|
328
|
-
* 1、图片宽或高 小于裁剪框,自动放大至一边与高平齐
|
|
329
|
-
* 2、图片宽或高 大于裁剪框,自动缩小至一边与高平齐
|
|
338
|
+
* 设置图片尺寸,使其短边完全显示并填满裁剪框
|
|
330
339
|
*/
|
|
331
340
|
function computeImgSize() {
|
|
332
341
|
let tempPicWidth: number = picWidth.value
|
|
333
342
|
let tempPicHeight: number = picHeight.value
|
|
334
343
|
|
|
335
344
|
if (!INIT_IMGHEIGHT && !INIT_IMGWIDTH) {
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
* 1、已知 b = y => a = a/b*y
|
|
343
|
-
* 2、已知 a = x => b = b/a*x
|
|
344
|
-
* 3、可用上方任意公式
|
|
345
|
-
*/
|
|
346
|
-
if (picWidth.value / picHeight.value > cutWidth.value / cutHeight.value) {
|
|
345
|
+
// 计算图片与裁剪框的宽高比
|
|
346
|
+
const imgRatio = imgInfo.value!.width / imgInfo.value!.height
|
|
347
|
+
const cropRatio = cutWidth.value / cutHeight.value
|
|
348
|
+
|
|
349
|
+
if (imgRatio > cropRatio) {
|
|
350
|
+
// 图片更宽,以高度为准
|
|
347
351
|
tempPicHeight = cutHeight.value
|
|
348
|
-
tempPicWidth =
|
|
352
|
+
tempPicWidth = tempPicHeight * imgRatio
|
|
349
353
|
} else {
|
|
354
|
+
// 图片更高,以宽度为准
|
|
350
355
|
tempPicWidth = cutWidth.value
|
|
351
|
-
tempPicHeight =
|
|
356
|
+
tempPicHeight = tempPicWidth / imgRatio
|
|
352
357
|
}
|
|
353
358
|
} else if (INIT_IMGHEIGHT && !INIT_IMGWIDTH) {
|
|
354
|
-
|
|
359
|
+
tempPicHeight = Number(INIT_IMGHEIGHT)
|
|
360
|
+
tempPicWidth = (imgInfo.value!.width / imgInfo.value!.height) * tempPicHeight
|
|
355
361
|
} else if ((!INIT_IMGHEIGHT && INIT_IMGWIDTH) || (INIT_IMGHEIGHT && INIT_IMGWIDTH)) {
|
|
356
|
-
|
|
362
|
+
tempPicWidth = Number(INIT_IMGWIDTH)
|
|
363
|
+
tempPicHeight = (imgInfo.value!.height / imgInfo.value!.width) * tempPicWidth
|
|
357
364
|
}
|
|
365
|
+
|
|
366
|
+
// 确保计算后的尺寸至少有一边等于裁剪框尺寸
|
|
367
|
+
const widthRatio = cutWidth.value / tempPicWidth
|
|
368
|
+
const heightRatio = cutHeight.value / tempPicHeight
|
|
369
|
+
const scale = Math.max(widthRatio, heightRatio)
|
|
370
|
+
|
|
358
371
|
picWidth.value = tempPicWidth
|
|
359
372
|
picHeight.value = tempPicHeight
|
|
373
|
+
// 设置初始缩放以适应裁剪框
|
|
374
|
+
imgScale.value = scale
|
|
360
375
|
}
|
|
361
376
|
|
|
362
377
|
/**
|
|
@@ -364,7 +379,7 @@ function computeImgSize() {
|
|
|
364
379
|
*/
|
|
365
380
|
function initCanvas() {
|
|
366
381
|
if (!ctx.value) {
|
|
367
|
-
ctx.value = uni.createCanvasContext(
|
|
382
|
+
ctx.value = uni.createCanvasContext(canvasId.value, proxy)
|
|
368
383
|
}
|
|
369
384
|
}
|
|
370
385
|
|
|
@@ -407,9 +422,7 @@ function detectImgPosIsEdge(scale?: number) {
|
|
|
407
422
|
}
|
|
408
423
|
// 左
|
|
409
424
|
currentImgLeft =
|
|
410
|
-
(currentPicWidth * currentScale) / 2 + cutLeft.value >= currentImgLeft
|
|
411
|
-
? currentImgLeft
|
|
412
|
-
: (currentPicWidth * imgScale.value) / 2 + cutLeft.value
|
|
425
|
+
(currentPicWidth * currentScale) / 2 + cutLeft.value >= currentImgLeft ? currentImgLeft : (currentPicWidth * imgScale.value) / 2 + cutLeft.value
|
|
413
426
|
// 右
|
|
414
427
|
currentImgLeft =
|
|
415
428
|
cutLeft.value + cutWidth.value - (currentPicWidth * currentScale) / 2 <= currentImgLeft
|
|
@@ -417,9 +430,7 @@ function detectImgPosIsEdge(scale?: number) {
|
|
|
417
430
|
: cutLeft.value + cutWidth.value - (currentPicWidth * currentScale) / 2
|
|
418
431
|
// 上
|
|
419
432
|
currentImgTop =
|
|
420
|
-
(currentPicHeight * currentScale) / 2 + cutTop.value >= currentImgTop
|
|
421
|
-
? currentImgTop
|
|
422
|
-
: (currentPicHeight * currentScale) / 2 + cutTop.value
|
|
433
|
+
(currentPicHeight * currentScale) / 2 + cutTop.value >= currentImgTop ? currentImgTop : (currentPicHeight * currentScale) / 2 + cutTop.value
|
|
423
434
|
// 下
|
|
424
435
|
currentImgTop =
|
|
425
436
|
cutTop.value + cutHeight.value - (currentPicHeight * currentScale) / 2 <= currentImgTop
|
|
@@ -477,7 +488,7 @@ function handleImgTouchStart(event: any) {
|
|
|
477
488
|
// 单指拖动
|
|
478
489
|
movingPosRecord.value[0] = {
|
|
479
490
|
x: event.touches[0].clientX - imgLeft.value,
|
|
480
|
-
y: event.touches[0].clientY - imgTop.value
|
|
491
|
+
y: event.touches[0].clientY - imgTop.value
|
|
481
492
|
}
|
|
482
493
|
} else {
|
|
483
494
|
// 以两指为坐标点 做直角三角形 a2 + b2 = c2
|
|
@@ -562,36 +573,28 @@ function handleConfirm() {
|
|
|
562
573
|
*/
|
|
563
574
|
function canvasToImage() {
|
|
564
575
|
const { fileType, quality, exportScale } = props
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
// #ifdef MP-DINGTALK
|
|
582
|
-
result.tempFilePath = res.filePath
|
|
583
|
-
// #endif
|
|
584
|
-
emit('confirm', result)
|
|
585
|
-
},
|
|
586
|
-
complete: () => {
|
|
587
|
-
emit('update:modelValue', false)
|
|
588
|
-
},
|
|
576
|
+
uni.canvasToTempFilePath(
|
|
577
|
+
{
|
|
578
|
+
width: cutWidth.value * exportScale,
|
|
579
|
+
height: Math.round(cutHeight.value * exportScale),
|
|
580
|
+
destWidth: cutWidth.value * exportScale,
|
|
581
|
+
destHeight: Math.round(cutHeight.value * exportScale),
|
|
582
|
+
fileType,
|
|
583
|
+
quality,
|
|
584
|
+
canvasId: canvasId.value,
|
|
585
|
+
success: (res: any) => {
|
|
586
|
+
const result = { tempFilePath: res.tempFilePath, width: cutWidth.value * exportScale, height: cutHeight.value * exportScale }
|
|
587
|
+
// #ifdef MP-DINGTALK
|
|
588
|
+
result.tempFilePath = res.filePath
|
|
589
|
+
// #endif
|
|
590
|
+
emit('confirm', result)
|
|
589
591
|
},
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
592
|
+
complete: () => {
|
|
593
|
+
emit('update:modelValue', false)
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
proxy
|
|
597
|
+
)
|
|
595
598
|
}
|
|
596
599
|
|
|
597
600
|
/**
|
|
@@ -633,27 +636,29 @@ function preventTouchMove() {}
|
|
|
633
636
|
defineExpose<ImgCropperExpose>({
|
|
634
637
|
revertIsAnimation,
|
|
635
638
|
setRoate,
|
|
636
|
-
resetImg
|
|
639
|
+
resetImg
|
|
637
640
|
})
|
|
638
641
|
</script>
|
|
639
642
|
|
|
640
|
-
<!-- #ifdef MP-WEIXIN || MP-QQ
|
|
643
|
+
<!-- #ifdef MP-WEIXIN || MP-QQ -->
|
|
641
644
|
<script module="animation" lang="wxs">
|
|
642
|
-
|
|
645
|
+
|
|
646
|
+
function setAnimation(newValue, oldValue, ownerInstance){
|
|
643
647
|
if (newValue) {
|
|
644
|
-
var id = ownerInstance.setTimeout(function
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
+
var id = ownerInstance.setTimeout(function() {
|
|
649
|
+
ownerInstance.callMethod('revertIsAnimation',{value:false})
|
|
650
|
+
ownerInstance.clearTimeout(id)
|
|
651
|
+
},300)
|
|
648
652
|
}
|
|
653
|
+
|
|
649
654
|
}
|
|
650
655
|
|
|
651
|
-
module.exports
|
|
652
|
-
setAnimation:
|
|
656
|
+
module.exports= {
|
|
657
|
+
setAnimation:setAnimation,
|
|
653
658
|
}
|
|
654
659
|
</script>
|
|
655
660
|
<!-- #endif -->
|
|
656
661
|
|
|
657
662
|
<style lang="scss" scoped>
|
|
658
|
-
@import './index';
|
|
663
|
+
@import './index.scss';
|
|
659
664
|
</style>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
3
|
|
|
4
4
|
.wot-theme-dark {
|
|
5
5
|
@include b(index-anchor) {
|
|
6
|
-
color: $-color-white;
|
|
7
6
|
background-color: $-color-gray-8;
|
|
7
|
+
color: $-color-white;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// #ifdef MP-DINGTALK
|
|
12
12
|
@include b(index-anchor-ding) {
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
@include when(sticky){
|
|
14
15
|
position: sticky;
|
|
15
16
|
top: 0;
|
|
16
17
|
left: 0;
|
|
@@ -20,12 +21,12 @@
|
|
|
20
21
|
// #endif
|
|
21
22
|
|
|
22
23
|
@include b(index-anchor) {
|
|
24
|
+
background-color: $-color-gray-2;
|
|
23
25
|
padding: 10px;
|
|
24
26
|
font-size: 14px;
|
|
25
27
|
color: $-color-title;
|
|
26
|
-
background-color: $-color-gray-2;
|
|
27
28
|
|
|
28
|
-
@include when(sticky)
|
|
29
|
+
@include when(sticky){
|
|
29
30
|
position: sticky;
|
|
30
31
|
top: 0;
|
|
31
32
|
left: 0;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue'
|
|
2
|
-
import { baseProps, makeRequiredProp
|
|
2
|
+
import { baseProps, makeRequiredProp } from '../common/props'
|
|
3
3
|
|
|
4
4
|
export const indexAnchorProps = {
|
|
5
5
|
...baseProps,
|
|
6
|
-
index: makeRequiredProp([String, Number])
|
|
6
|
+
index: makeRequiredProp([String, Number])
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export type IndexAnchorProps = ExtractPropTypes<typeof indexAnchorProps>
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
<!-- #ifdef MP-DINGTALK -->
|
|
3
3
|
<view :class="`wd-index-anchor-ding ${isSticky ? 'is-sticky' : ''}`">
|
|
4
4
|
<!-- #endif -->
|
|
5
|
-
<view
|
|
6
|
-
:class="`wd-index-anchor ${isSticky ? 'is-sticky' : ''} ${customClass}`"
|
|
7
|
-
:style="customStyle"
|
|
8
|
-
:id="indexAnchorId"
|
|
9
|
-
>
|
|
5
|
+
<view :class="`wd-index-anchor ${isSticky ? 'is-sticky' : ''} ${customClass}`" :style="customStyle" :id="indexAnchorId">
|
|
10
6
|
<slot>
|
|
11
7
|
{{ index }}
|
|
12
8
|
</slot>
|
|
@@ -46,13 +42,11 @@ function getInfo() {
|
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
onMounted(() => {
|
|
49
|
-
|
|
50
|
-
getInfo()
|
|
51
|
-
}, 200)
|
|
45
|
+
getInfo()
|
|
52
46
|
})
|
|
53
47
|
|
|
54
48
|
defineExpose({
|
|
55
|
-
top
|
|
49
|
+
top
|
|
56
50
|
})
|
|
57
51
|
</script>
|
|
58
52
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
3
|
|
|
4
4
|
.wot-theme-dark {
|
|
5
5
|
@include b(index-bar) {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@include e(index) {
|
|
30
|
-
|
|
31
|
-
font-size: 20rpx;
|
|
30
|
+
font-size: 12px;
|
|
32
31
|
font-weight: $-fw-medium;
|
|
33
|
-
color: $-color-
|
|
32
|
+
color: $-color-title;
|
|
33
|
+
padding: 4px 6px;
|
|
34
34
|
|
|
35
35
|
@include when(active) {
|
|
36
36
|
color: $-color-theme;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { InjectionKey
|
|
1
|
+
import type { InjectionKey } from 'vue'
|
|
2
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
3
|
import { makeBooleanProp } from '../common/props'
|
|
3
4
|
|
|
4
5
|
export type AnchorIndex = number | string
|
|
@@ -7,7 +8,7 @@ export const indexBarProps = {
|
|
|
7
8
|
/**
|
|
8
9
|
* @description 索引是否吸顶
|
|
9
10
|
*/
|
|
10
|
-
sticky: makeBooleanProp(false)
|
|
11
|
+
sticky: makeBooleanProp(false)
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export type IndexBarProps = ExtractPropTypes<typeof indexBarProps>
|