@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,6 +1,5 @@
|
|
|
1
1
|
const _b64chars: string[] = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/']
|
|
2
|
-
const _mkUriSafe = (src: string): string =>
|
|
3
|
-
src.replace(/[+/]/g, (m0: string) => (m0 === '+' ? '-' : '_')).replace(/=+\$/m, '')
|
|
2
|
+
const _mkUriSafe = (src: string): string => src.replace(/[+/]/g, (m0: string) => (m0 === '+' ? '-' : '_')).replace(/=+\$/m, '')
|
|
4
3
|
const fromUint8Array = (src: Uint8Array, rfc4648 = false): string => {
|
|
5
4
|
let b64 = ''
|
|
6
5
|
for (let i = 0, l = src.length; i < l; i += 3) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isPromise } from './util'
|
|
2
|
+
|
|
3
|
+
function noop() {}
|
|
4
|
+
|
|
5
|
+
export type Interceptor = (...args: any[]) => Promise<boolean> | boolean | undefined | void
|
|
6
|
+
|
|
7
|
+
export function callInterceptor(
|
|
8
|
+
interceptor: Interceptor | undefined,
|
|
9
|
+
{
|
|
10
|
+
args = [],
|
|
11
|
+
done,
|
|
12
|
+
canceled,
|
|
13
|
+
error
|
|
14
|
+
}: {
|
|
15
|
+
args?: unknown[]
|
|
16
|
+
done: () => void
|
|
17
|
+
canceled?: () => void
|
|
18
|
+
error?: () => void
|
|
19
|
+
}
|
|
20
|
+
) {
|
|
21
|
+
if (interceptor) {
|
|
22
|
+
// eslint-disable-next-line prefer-spread
|
|
23
|
+
const returnVal = interceptor.apply(null, args)
|
|
24
|
+
|
|
25
|
+
if (isPromise(returnVal)) {
|
|
26
|
+
returnVal
|
|
27
|
+
.then((value) => {
|
|
28
|
+
if (value) {
|
|
29
|
+
done()
|
|
30
|
+
} else if (canceled) {
|
|
31
|
+
canceled()
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.catch(error || noop)
|
|
35
|
+
} else if (returnVal) {
|
|
36
|
+
done()
|
|
37
|
+
} else if (canceled) {
|
|
38
|
+
canceled()
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
done()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -6,37 +6,37 @@ export const numericProp = [Number, String]
|
|
|
6
6
|
|
|
7
7
|
export const truthProp = {
|
|
8
8
|
type: Boolean,
|
|
9
|
-
default: true as const
|
|
9
|
+
default: true as const
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const makeRequiredProp = <T>(type: T) => ({
|
|
13
13
|
type,
|
|
14
|
-
required: true as const
|
|
14
|
+
required: true as const
|
|
15
15
|
})
|
|
16
16
|
|
|
17
17
|
export const makeArrayProp = <T>() => ({
|
|
18
18
|
type: Array as PropType<T[]>,
|
|
19
|
-
default: () => []
|
|
19
|
+
default: () => []
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
export const makeBooleanProp = <T>(defaultVal: T) => ({
|
|
23
23
|
type: Boolean,
|
|
24
|
-
default: defaultVal
|
|
24
|
+
default: defaultVal
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
export const makeNumberProp = <T>(defaultVal: T) => ({
|
|
28
28
|
type: Number,
|
|
29
|
-
default: defaultVal
|
|
29
|
+
default: defaultVal
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
export const makeNumericProp = <T>(defaultVal: T) => ({
|
|
33
33
|
type: numericProp,
|
|
34
|
-
default: defaultVal
|
|
34
|
+
default: defaultVal
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
export const makeStringProp = <T>(defaultVal: T) => ({
|
|
38
38
|
type: String as unknown as PropType<T>,
|
|
39
|
-
default: defaultVal
|
|
39
|
+
default: defaultVal
|
|
40
40
|
})
|
|
41
41
|
|
|
42
42
|
export const baseProps = {
|
|
@@ -47,5 +47,5 @@ export const baseProps = {
|
|
|
47
47
|
/**
|
|
48
48
|
* 自定义根节点样式类
|
|
49
49
|
*/
|
|
50
|
-
customClass: makeStringProp('')
|
|
50
|
+
customClass: makeStringProp('')
|
|
51
51
|
}
|
|
@@ -55,10 +55,7 @@ export function getType(target: unknown): string {
|
|
|
55
55
|
* @param kv - 配置对象,包含 labelKey 作为键值
|
|
56
56
|
* @returns 格式化后的字符串
|
|
57
57
|
*/
|
|
58
|
-
export const defaultDisplayFormat = function (
|
|
59
|
-
items: any[] | Record<string, any>,
|
|
60
|
-
kv?: { labelKey?: string },
|
|
61
|
-
): string {
|
|
58
|
+
export const defaultDisplayFormat = function (items: any[] | Record<string, any>, kv?: { labelKey?: string }): string {
|
|
62
59
|
const labelKey: string = kv?.labelKey || 'value'
|
|
63
60
|
|
|
64
61
|
if (Array.isArray(items)) {
|
|
@@ -126,7 +123,7 @@ export function rgbToHex(r: number, g: number, b: number): string {
|
|
|
126
123
|
* @param hex 十六进制颜色代码(例如:'#RRGGBB')
|
|
127
124
|
* @returns 包含红、绿、蓝三个颜色分量的数组
|
|
128
125
|
*/
|
|
129
|
-
function hexToRgb(hex: string): number[] {
|
|
126
|
+
export function hexToRgb(hex: string): number[] {
|
|
130
127
|
const rgb: number[] = []
|
|
131
128
|
|
|
132
129
|
// 从第一个字符开始,每两个字符代表一个颜色分量
|
|
@@ -159,11 +156,7 @@ export const gradient = (startColor: string, endColor: string, step: number = 2)
|
|
|
159
156
|
for (let i = 0; i < step; i++) {
|
|
160
157
|
// 计算每一步的hex值
|
|
161
158
|
gradientColorArr.push(
|
|
162
|
-
rgbToHex(
|
|
163
|
-
parseInt(String(rStep * i + sColor[0])),
|
|
164
|
-
parseInt(String(gStep * i + sColor[1])),
|
|
165
|
-
parseInt(String(bStep * i + sColor[2])),
|
|
166
|
-
),
|
|
159
|
+
rgbToHex(parseInt(String(rStep * i + sColor[0])), parseInt(String(gStep * i + sColor[1])), parseInt(String(bStep * i + sColor[2])))
|
|
167
160
|
)
|
|
168
161
|
}
|
|
169
162
|
return gradientColorArr
|
|
@@ -234,7 +227,7 @@ export const padZero = (number: number | string, length: number = 2): string =>
|
|
|
234
227
|
|
|
235
228
|
/** @description 全局变量id */
|
|
236
229
|
export const context = {
|
|
237
|
-
id: 1000
|
|
230
|
+
id: 1000
|
|
238
231
|
}
|
|
239
232
|
|
|
240
233
|
export type RectResultType<T extends boolean> = T extends true ? UniApp.NodeInfo[] : UniApp.NodeInfo
|
|
@@ -244,13 +237,10 @@ export type RectResultType<T extends boolean> = T extends true ? UniApp.NodeInfo
|
|
|
244
237
|
* @param selector 节点选择器 #id,.class
|
|
245
238
|
* @param all 是否返回所有 selector 对应的节点
|
|
246
239
|
* @param scope 作用域(支付宝小程序无效)
|
|
240
|
+
* @param useFields 是否使用 fields 方法获取节点信息
|
|
247
241
|
* @returns 节点信息或节点信息数组
|
|
248
242
|
*/
|
|
249
|
-
export function getRect<T extends boolean>(
|
|
250
|
-
selector: string,
|
|
251
|
-
all: T,
|
|
252
|
-
scope?: any,
|
|
253
|
-
): Promise<RectResultType<T>> {
|
|
243
|
+
export function getRect<T extends boolean>(selector: string, all: T, scope?: any, useFields?: boolean): Promise<RectResultType<T>> {
|
|
254
244
|
return new Promise<RectResultType<T>>((resolve, reject) => {
|
|
255
245
|
let query: UniNamespace.SelectorQuery | null = null
|
|
256
246
|
if (scope) {
|
|
@@ -258,17 +248,24 @@ export function getRect<T extends boolean>(
|
|
|
258
248
|
} else {
|
|
259
249
|
query = uni.createSelectorQuery()
|
|
260
250
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
251
|
+
|
|
252
|
+
const method = all ? 'selectAll' : 'select'
|
|
253
|
+
|
|
254
|
+
const callback = (rect: UniApp.NodeInfo | UniApp.NodeInfo[]) => {
|
|
255
|
+
if (all && isArray(rect) && rect.length > 0) {
|
|
256
|
+
resolve(rect as RectResultType<T>)
|
|
257
|
+
} else if (!all && rect) {
|
|
258
|
+
resolve(rect as RectResultType<T>)
|
|
259
|
+
} else {
|
|
260
|
+
reject(new Error('No nodes found'))
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (useFields) {
|
|
265
|
+
query[method](selector).fields({ size: true, node: true }, callback).exec()
|
|
266
|
+
} else {
|
|
267
|
+
query[method](selector).boundingClientRect(callback).exec()
|
|
268
|
+
}
|
|
272
269
|
})
|
|
273
270
|
}
|
|
274
271
|
|
|
@@ -318,7 +315,7 @@ export function isArray(value: any): value is Array<any> {
|
|
|
318
315
|
*/
|
|
319
316
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
320
317
|
export function isFunction<T extends Function>(value: any): value is T {
|
|
321
|
-
return getType(value) === 'function'
|
|
318
|
+
return getType(value) === 'function' || getType(value) === 'asyncfunction'
|
|
322
319
|
}
|
|
323
320
|
|
|
324
321
|
/**
|
|
@@ -405,7 +402,7 @@ export function objToStyle(styles: Record<string, any> | Record<string, any>[]):
|
|
|
405
402
|
if (isArray(styles)) {
|
|
406
403
|
// 使用过滤函数去除空值和 null 值的元素
|
|
407
404
|
// 对每个非空元素递归调用 objToStyle,然后通过分号连接
|
|
408
|
-
|
|
405
|
+
const result = styles
|
|
409
406
|
.filter(function (item) {
|
|
410
407
|
return item != null && item !== ''
|
|
411
408
|
})
|
|
@@ -413,10 +410,14 @@ export function objToStyle(styles: Record<string, any> | Record<string, any>[]):
|
|
|
413
410
|
return objToStyle(item)
|
|
414
411
|
})
|
|
415
412
|
.join(';')
|
|
413
|
+
|
|
414
|
+
// 如果结果不为空,确保末尾有分号
|
|
415
|
+
return result ? (result.endsWith(';') ? result : result + ';') : ''
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
if (isString(styles)) {
|
|
419
|
-
|
|
419
|
+
// 如果是字符串且不为空,确保末尾有分号
|
|
420
|
+
return styles ? (styles.endsWith(';') ? styles : styles + ';') : ''
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
// 如果 styles 是对象类型
|
|
@@ -424,7 +425,7 @@ export function objToStyle(styles: Record<string, any> | Record<string, any>[]):
|
|
|
424
425
|
// 使用 Object.keys 获取所有属性名
|
|
425
426
|
// 使用过滤函数去除值为 null 或空字符串的属性
|
|
426
427
|
// 对每个属性名和属性值进行格式化,通过分号连接
|
|
427
|
-
|
|
428
|
+
const result = Object.keys(styles)
|
|
428
429
|
.filter(function (key) {
|
|
429
430
|
return styles[key] != null && styles[key] !== ''
|
|
430
431
|
})
|
|
@@ -434,11 +435,38 @@ export function objToStyle(styles: Record<string, any> | Record<string, any>[]):
|
|
|
434
435
|
return [kebabCase(key), styles[key]].join(':')
|
|
435
436
|
})
|
|
436
437
|
.join(';')
|
|
438
|
+
|
|
439
|
+
// 如果结果不为空,确保末尾有分号
|
|
440
|
+
return result ? (result.endsWith(';') ? result : result + ';') : ''
|
|
437
441
|
}
|
|
438
442
|
// 如果 styles 不是对象也不是数组,则直接返回
|
|
439
443
|
return ''
|
|
440
444
|
}
|
|
441
445
|
|
|
446
|
+
/**
|
|
447
|
+
* 判断一个对象是否包含任何字段
|
|
448
|
+
* @param obj 要检查的对象
|
|
449
|
+
* @returns {boolean} 如果对象为空(不包含任何字段)则返回 true,否则返回 false
|
|
450
|
+
*/
|
|
451
|
+
export function hasFields(obj: unknown): boolean {
|
|
452
|
+
// 如果不是对象类型或为 null,则认为没有字段
|
|
453
|
+
if (!isObj(obj) || obj === null) {
|
|
454
|
+
return false
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// 使用 Object.keys 检查对象是否有属性
|
|
458
|
+
return Object.keys(obj).length > 0
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* 判断一个对象是否为空对象(不包含任何字段)
|
|
463
|
+
* @param obj 要检查的对象
|
|
464
|
+
* @returns {boolean} 如果对象为空(不包含任何字段)则返回 true,否则返回 false
|
|
465
|
+
*/
|
|
466
|
+
export function isEmptyObj(obj: unknown): boolean {
|
|
467
|
+
return !hasFields(obj)
|
|
468
|
+
}
|
|
469
|
+
|
|
442
470
|
export const requestAnimationFrame = (cb = () => {}) => {
|
|
443
471
|
return new AbortablePromise((resolve) => {
|
|
444
472
|
const timer = setInterval(() => {
|
|
@@ -454,7 +482,7 @@ export const requestAnimationFrame = (cb = () => {}) => {
|
|
|
454
482
|
* @param ms 延迟时间
|
|
455
483
|
* @returns
|
|
456
484
|
*/
|
|
457
|
-
export const pause = (ms: number) => {
|
|
485
|
+
export const pause = (ms: number = 1000 / 30) => {
|
|
458
486
|
return new AbortablePromise((resolve) => {
|
|
459
487
|
const timer = setTimeout(() => {
|
|
460
488
|
clearTimeout(timer)
|
|
@@ -470,7 +498,7 @@ export const pause = (ms: number) => {
|
|
|
470
498
|
* @returns 深拷贝后的对象副本
|
|
471
499
|
*/
|
|
472
500
|
export function deepClone<T>(obj: T, cache: Map<any, any> = new Map()): T {
|
|
473
|
-
// 如果对象为 null
|
|
501
|
+
// 如果对象为 null 或或者不是对象类型,则直接返回该对象
|
|
474
502
|
if (obj === null || typeof obj !== 'object') {
|
|
475
503
|
return obj
|
|
476
504
|
}
|
|
@@ -515,10 +543,7 @@ export function deepClone<T>(obj: T, cache: Map<any, any> = new Map()): T {
|
|
|
515
543
|
* @param source 源对象,要合并到目标对象的对象
|
|
516
544
|
* @returns 合并后的目标对象
|
|
517
545
|
*/
|
|
518
|
-
export function deepMerge<T extends Record<string, any>>(
|
|
519
|
-
target: T,
|
|
520
|
-
source: Record<string, any>,
|
|
521
|
-
): T {
|
|
546
|
+
export function deepMerge<T extends Record<string, any>>(target: T, source: Record<string, any>): T {
|
|
522
547
|
// 深拷贝目标对象,避免修改原始对象
|
|
523
548
|
target = deepClone(target)
|
|
524
549
|
|
|
@@ -545,10 +570,7 @@ export function deepMerge<T extends Record<string, any>>(
|
|
|
545
570
|
* @param source
|
|
546
571
|
* @returns
|
|
547
572
|
*/
|
|
548
|
-
export function deepAssign(
|
|
549
|
-
target: Record<string, any>,
|
|
550
|
-
source: Record<string, any>,
|
|
551
|
-
): Record<string, any> {
|
|
573
|
+
export function deepAssign(target: Record<string, any>, source: Record<string, any>): Record<string, any> {
|
|
552
574
|
Object.keys(source).forEach((key) => {
|
|
553
575
|
const targetValue = target[key]
|
|
554
576
|
const newObjValue = source[key]
|
|
@@ -585,11 +607,7 @@ type DebounceOptions = {
|
|
|
585
607
|
trailing?: boolean // 是否在延迟时间结束时调用函数
|
|
586
608
|
}
|
|
587
609
|
|
|
588
|
-
export function debounce<T extends (...args: any[]) => any>(
|
|
589
|
-
func: T,
|
|
590
|
-
wait: number,
|
|
591
|
-
options: DebounceOptions = {},
|
|
592
|
-
): T {
|
|
610
|
+
export function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options: DebounceOptions = {}): T {
|
|
593
611
|
let timeoutId: ReturnType<typeof setTimeout> | null = null
|
|
594
612
|
let lastArgs: any[] | undefined
|
|
595
613
|
let lastThis: any
|
|
@@ -622,7 +640,6 @@ export function debounce<T extends (...args: any[]) => any>(
|
|
|
622
640
|
|
|
623
641
|
function debounced(this: any, ...args: Parameters<T>): ReturnType<T> | undefined {
|
|
624
642
|
lastArgs = args
|
|
625
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
626
643
|
lastThis = this
|
|
627
644
|
|
|
628
645
|
if (timeoutId === null) {
|
|
@@ -679,10 +696,7 @@ export const getPropByPath = (obj: any, path: string): any => {
|
|
|
679
696
|
const keys: string[] = path.split('.')
|
|
680
697
|
|
|
681
698
|
try {
|
|
682
|
-
return keys.reduce(
|
|
683
|
-
(acc: any, key: string) => (acc !== undefined && acc !== null ? acc[key] : undefined),
|
|
684
|
-
obj,
|
|
685
|
-
)
|
|
699
|
+
return keys.reduce((acc: any, key: string) => (acc !== undefined && acc !== null ? acc[key] : undefined), obj)
|
|
686
700
|
} catch (error) {
|
|
687
701
|
return undefined
|
|
688
702
|
}
|
|
@@ -693,8 +707,7 @@ export const getPropByPath = (obj: any, path: string): any => {
|
|
|
693
707
|
* @param val 要检查的值
|
|
694
708
|
* @returns 如果值是Date类型,则返回true,否则返回false
|
|
695
709
|
*/
|
|
696
|
-
export const isDate = (val: unknown): val is Date =>
|
|
697
|
-
Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN((val as Date).getTime())
|
|
710
|
+
export const isDate = (val: unknown): val is Date => Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN((val as Date).getTime())
|
|
698
711
|
|
|
699
712
|
/**
|
|
700
713
|
* 检查提供的URL是否为视频链接。
|
|
@@ -703,7 +716,7 @@ export const isDate = (val: unknown): val is Date =>
|
|
|
703
716
|
*/
|
|
704
717
|
export function isVideoUrl(url: string): boolean {
|
|
705
718
|
// 使用正则表达式匹配视频文件类型的URL
|
|
706
|
-
const videoRegex = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|video)/i
|
|
719
|
+
const videoRegex = /\.(ogm|webm|ogv|asx|m4v|mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|video)(?=$|[?#])/i
|
|
707
720
|
return videoRegex.test(url)
|
|
708
721
|
}
|
|
709
722
|
|
|
@@ -714,14 +727,20 @@ export function isVideoUrl(url: string): boolean {
|
|
|
714
727
|
*/
|
|
715
728
|
export function isImageUrl(url: string): boolean {
|
|
716
729
|
// 使用正则表达式匹配图片URL
|
|
717
|
-
const imageRegex = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|image)/i
|
|
730
|
+
const imageRegex = /\.(xbm|tif|pjp|apng|svgz|jpeg|jpg|heif|ico|tiff|heic|pjpeg|avif|gif|png|svg|webp|jfif|bmp|dpg|image)(?=$|[?#])/i
|
|
718
731
|
return imageRegex.test(url)
|
|
719
732
|
}
|
|
720
733
|
|
|
721
734
|
/**
|
|
722
735
|
* 判断环境是否是H5
|
|
723
736
|
*/
|
|
724
|
-
export const isH5 =
|
|
737
|
+
export const isH5 = (() => {
|
|
738
|
+
let isH5 = false
|
|
739
|
+
// #ifdef H5
|
|
740
|
+
isH5 = true
|
|
741
|
+
// #endif
|
|
742
|
+
return isH5
|
|
743
|
+
})()
|
|
725
744
|
|
|
726
745
|
/**
|
|
727
746
|
* 剔除对象中的某些属性
|
|
@@ -729,10 +748,7 @@ export const isH5 = process.env.UNI_PLATFORM === 'h5'
|
|
|
729
748
|
* @param predicate
|
|
730
749
|
* @returns
|
|
731
750
|
*/
|
|
732
|
-
export function omitBy<O extends Record<string, any>>(
|
|
733
|
-
obj: O,
|
|
734
|
-
predicate: (value: any, key: keyof O) => boolean,
|
|
735
|
-
): Partial<O> {
|
|
751
|
+
export function omitBy<O extends Record<string, any>>(obj: O, predicate: (value: any, key: keyof O) => boolean): Partial<O> {
|
|
736
752
|
const newObj = deepClone(obj)
|
|
737
753
|
Object.keys(newObj).forEach((key) => predicate(newObj[key], key) && delete newObj[key]) // 遍历对象的键,删除值为不满足predicate的字段
|
|
738
754
|
return newObj
|
|
@@ -749,3 +765,72 @@ export function omitBy<O extends Record<string, any>>(
|
|
|
749
765
|
export function easingFn(t: number = 0, b: number = 0, c: number = 0, d: number = 0): number {
|
|
750
766
|
return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b
|
|
751
767
|
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* 从数组中寻找最接近目标值的元素
|
|
771
|
+
*
|
|
772
|
+
* @param arr 数组
|
|
773
|
+
* @param target 目标值
|
|
774
|
+
* @returns 最接近目标值的元素
|
|
775
|
+
*/
|
|
776
|
+
export function closest(arr: number[], target: number) {
|
|
777
|
+
return arr.reduce((prev, curr) => (Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev))
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* 系统信息接口,包含项目中实际使用的字段
|
|
782
|
+
*/
|
|
783
|
+
export interface SystemInfo {
|
|
784
|
+
/** 窗口宽度 */
|
|
785
|
+
windowWidth: number
|
|
786
|
+
/** 窗口高度 */
|
|
787
|
+
windowHeight: number
|
|
788
|
+
/** 窗口顶部位置 */
|
|
789
|
+
windowTop: number
|
|
790
|
+
/** 设备像素比 */
|
|
791
|
+
pixelRatio: number
|
|
792
|
+
/** 平台信息 */
|
|
793
|
+
platform: string
|
|
794
|
+
/** 主题模式 */
|
|
795
|
+
theme?: string
|
|
796
|
+
/** 状态栏高度 */
|
|
797
|
+
statusBarHeight?: number
|
|
798
|
+
/** 安全区域信息 */
|
|
799
|
+
safeArea?: UniApp.SafeArea
|
|
800
|
+
/** 屏幕高度 */
|
|
801
|
+
screenHeight: number
|
|
802
|
+
/** 安全区域插入信息 */
|
|
803
|
+
safeAreaInsets?: UniApp.SafeAreaInsets
|
|
804
|
+
// 未尽字段
|
|
805
|
+
[key: string]: any
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* 兼容微信小程序端获取系统信息的方法
|
|
810
|
+
* 在微信小程序端使用新的API替代getSystemInfoSync,在其他端仍然使用getSystemInfoSync
|
|
811
|
+
* @returns 系统信息对象
|
|
812
|
+
*/
|
|
813
|
+
export function getSystemInfo(): SystemInfo {
|
|
814
|
+
let systemInfo: SystemInfo
|
|
815
|
+
// #ifdef MP-WEIXIN
|
|
816
|
+
try {
|
|
817
|
+
// const systemSetting = uni.getSystemSetting() // 暂时不需要
|
|
818
|
+
const deviceInfo = uni.getDeviceInfo()
|
|
819
|
+
const windowInfo = uni.getWindowInfo()
|
|
820
|
+
const appBaseInfo = uni.getAppBaseInfo()
|
|
821
|
+
systemInfo = {
|
|
822
|
+
...deviceInfo,
|
|
823
|
+
...windowInfo,
|
|
824
|
+
...appBaseInfo
|
|
825
|
+
}
|
|
826
|
+
} catch (error) {
|
|
827
|
+
console.warn('获取系统信息失败,降级使用uni.getSystemInfoSync:', error)
|
|
828
|
+
// 降级处理,使用原来的方法
|
|
829
|
+
systemInfo = uni.getSystemInfoSync()
|
|
830
|
+
}
|
|
831
|
+
// #endif
|
|
832
|
+
// #ifndef MP-WEIXIN
|
|
833
|
+
systemInfo = uni.getSystemInfoSync()
|
|
834
|
+
// #endif
|
|
835
|
+
return systemInfo
|
|
836
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { useCell } from './useCell'
|
|
2
|
+
export { useChildren, flattenVNodes, sortChildren } from './useChildren'
|
|
3
|
+
export { useCountDown } from './useCountDown'
|
|
4
|
+
export { useLockScroll } from './useLockScroll'
|
|
5
|
+
export { useParent } from './useParent'
|
|
6
|
+
export { usePopover } from './usePopover'
|
|
7
|
+
export { useQueue } from './useQueue'
|
|
8
|
+
export { useRaf } from './useRaf'
|
|
9
|
+
export { useTouch } from './useTouch'
|
|
10
|
+
export { useTranslate } from './useTranslate'
|
|
11
|
+
export { useUpload } from './useUpload'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type InjectionKey,
|
|
7
7
|
type VNodeNormalizedChildren,
|
|
8
8
|
type ComponentPublicInstance,
|
|
9
|
-
type ComponentInternalInstance
|
|
9
|
+
type ComponentInternalInstance
|
|
10
10
|
} from 'vue'
|
|
11
11
|
|
|
12
12
|
// 小程序端不支持从vue导出的isVNode方法,参考uni-mp-vue的实现
|
|
@@ -44,13 +44,7 @@ export function flattenVNodes(children: VNodeNormalizedChildren) {
|
|
|
44
44
|
const findVNodeIndex = (vnodes: VNode[], vnode: VNode) => {
|
|
45
45
|
const index = vnodes.indexOf(vnode)
|
|
46
46
|
if (index === -1) {
|
|
47
|
-
return vnodes.findIndex(
|
|
48
|
-
(item) =>
|
|
49
|
-
vnode.key !== undefined &&
|
|
50
|
-
vnode.key !== null &&
|
|
51
|
-
item.type === vnode.type &&
|
|
52
|
-
item.key === vnode.key,
|
|
53
|
-
)
|
|
47
|
+
return vnodes.findIndex((item) => vnode.key !== undefined && vnode.key !== null && item.type === vnode.type && item.key === vnode.key)
|
|
54
48
|
}
|
|
55
49
|
return index
|
|
56
50
|
}
|
|
@@ -59,12 +53,9 @@ const findVNodeIndex = (vnodes: VNode[], vnode: VNode) => {
|
|
|
59
53
|
export function sortChildren(
|
|
60
54
|
parent: ComponentInternalInstance,
|
|
61
55
|
publicChildren: ComponentPublicInstance[],
|
|
62
|
-
internalChildren: ComponentInternalInstance[]
|
|
56
|
+
internalChildren: ComponentInternalInstance[]
|
|
63
57
|
) {
|
|
64
|
-
const vnodes =
|
|
65
|
-
parent && parent.subTree && parent.subTree.children
|
|
66
|
-
? flattenVNodes(parent.subTree.children)
|
|
67
|
-
: []
|
|
58
|
+
const vnodes = parent && parent.subTree && parent.subTree.children ? flattenVNodes(parent.subTree.children) : []
|
|
68
59
|
|
|
69
60
|
internalChildren.sort((a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode))
|
|
70
61
|
|
|
@@ -80,7 +71,7 @@ export function sortChildren(
|
|
|
80
71
|
export function useChildren<
|
|
81
72
|
// eslint-disable-next-line
|
|
82
73
|
Child extends ComponentPublicInstance = ComponentPublicInstance<{}, any>,
|
|
83
|
-
ProvideValue = never
|
|
74
|
+
ProvideValue = never
|
|
84
75
|
>(key: InjectionKey<ProvideValue>) {
|
|
85
76
|
const publicChildren: Child[] = reactive([])
|
|
86
77
|
const internalChildren: ComponentInternalInstance[] = reactive([])
|
|
@@ -108,15 +99,15 @@ export function useChildren<
|
|
|
108
99
|
link,
|
|
109
100
|
unlink,
|
|
110
101
|
children: publicChildren,
|
|
111
|
-
internalChildren
|
|
102
|
+
internalChildren
|
|
112
103
|
},
|
|
113
|
-
value
|
|
114
|
-
)
|
|
104
|
+
value
|
|
105
|
+
)
|
|
115
106
|
)
|
|
116
107
|
}
|
|
117
108
|
|
|
118
109
|
return {
|
|
119
110
|
children: publicChildren,
|
|
120
|
-
linkChildren
|
|
111
|
+
linkChildren
|
|
121
112
|
}
|
|
122
113
|
}
|
|
@@ -40,7 +40,7 @@ function parseTime(time: number): CurrentTime {
|
|
|
40
40
|
hours,
|
|
41
41
|
minutes,
|
|
42
42
|
seconds,
|
|
43
|
-
milliseconds
|
|
43
|
+
milliseconds
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -133,6 +133,6 @@ export function useCountDown(options: UseCountDownOptions) {
|
|
|
133
133
|
start,
|
|
134
134
|
pause,
|
|
135
135
|
reset,
|
|
136
|
-
current
|
|
136
|
+
current
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onBeforeUnmount, onDeactivated, ref, watch } from 'vue'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export const useLockScroll = (shouldLock: () => boolean) => {
|
|
4
4
|
const scrollLockCount = ref(0)
|
|
5
5
|
|
|
6
6
|
const lock = () => {
|
|
@@ -35,5 +35,3 @@ function useLockScroll(shouldLock: () => boolean) {
|
|
|
35
35
|
unlock,
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
export default useLockScroll
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type InjectionKey,
|
|
7
7
|
getCurrentInstance,
|
|
8
8
|
type ComponentPublicInstance,
|
|
9
|
-
type ComponentInternalInstance
|
|
9
|
+
type ComponentInternalInstance
|
|
10
10
|
} from 'vue'
|
|
11
11
|
|
|
12
12
|
type ParentProvide<T> = T & {
|
|
@@ -30,12 +30,12 @@ export function useParent<T>(key: InjectionKey<ParentProvide<T>>) {
|
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
32
|
parent,
|
|
33
|
-
index
|
|
33
|
+
index
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
|
-
parent: null
|
|
39
|
-
index: ref(-1)
|
|
38
|
+
parent: null,
|
|
39
|
+
index: ref(-1)
|
|
40
40
|
}
|
|
41
41
|
}
|