@10yun/cv-mobile-ui 0.5.29 → 0.5.31
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/package.json +5 -1
- package/plugins/luch-request/adapters/index.js +131 -0
- package/plugins/luch-request/core/InterceptorManager.js +50 -0
- package/plugins/luch-request/core/Request.js +199 -0
- package/plugins/luch-request/core/buildFullPath.js +20 -0
- package/plugins/luch-request/core/defaults.js +32 -0
- package/plugins/luch-request/core/dispatchRequest.js +5 -0
- package/plugins/luch-request/core/mergeConfig.js +125 -0
- package/plugins/luch-request/core/settle.js +16 -0
- package/plugins/luch-request/helpers/buildURL.js +71 -0
- package/plugins/luch-request/helpers/combineURLs.js +12 -0
- package/plugins/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/plugins/luch-request/index.d.ts +197 -0
- package/plugins/luch-request/index.js +2 -0
- package/plugins/luch-request/readme.md +3 -0
- package/plugins/luch-request/utils/clone.js +264 -0
- package/plugins/luch-request/utils.js +131 -0
- package/plugins/request.js +2 -2
- package/ui-cv/components/cv-btn-base/cv-btn-base.vue +1 -1
- package/ui-cv/components/cv-form-item/cv-form-item.vue +1 -1
- package/ui-fireui/fui-actionsheet/fui-actionsheet.vue +202 -0
- package/ui-fireui/fui-alert/fui-alert.vue +141 -0
- package/ui-fireui/fui-badge/fui-badge.vue +158 -0
- package/ui-fireui/fui-bottom-navigation/fui-bottom-navigation.vue +390 -0
- package/ui-fireui/fui-bottom-popup/fui-bottom-popup.vue +100 -0
- package/ui-fireui/fui-bubble-popup/fui-bubble-popup.vue +236 -0
- package/ui-fireui/fui-button/fui-button.vue +424 -0
- package/ui-fireui/fui-calendar/fui-calendar.js +915 -0
- package/ui-fireui/fui-calendar/fui-calendar.vue +868 -0
- package/ui-fireui/fui-card/fui-card.vue +231 -0
- package/ui-fireui/fui-cascade-selection/fui-cascade-selection.vue +538 -0
- package/ui-fireui/fui-circular-progress/fui-circular-progress.vue +261 -0
- package/ui-fireui/fui-collapse/fui-collapse.vue +179 -0
- package/ui-fireui/fui-countdown/fui-countdown.vue +301 -0
- package/ui-fireui/fui-datetime/fui-datetime.vue +570 -0
- package/ui-fireui/fui-divider/fui-divider.vue +118 -0
- package/ui-fireui/fui-drawer/fui-drawer.vue +103 -0
- package/ui-fireui/fui-dropdown-list/fui-dropdown-list.vue +70 -0
- package/ui-fireui/fui-fab/fui-fab.vue +284 -0
- package/ui-fireui/fui-footer/fui-footer.vue +131 -0
- package/ui-fireui/fui-grid/fui-grid.vue +42 -0
- package/ui-fireui/fui-grid-item/fui-grid-item.vue +142 -0
- package/ui-fireui/fui-icon/fui-icon.vue +820 -0
- package/ui-fireui/fui-image-cropper/fui-image-cropper.vue +1058 -0
- package/ui-fireui/fui-image-group/fui-image-group.vue +149 -0
- package/ui-fireui/fui-keyboard/fui-keyboard.vue +254 -0
- package/ui-fireui/fui-keyboard-input/fui-keyboard-input.vue +78 -0
- package/ui-fireui/fui-list-cell/fui-list-cell.vue +178 -0
- package/ui-fireui/fui-list-view/fui-list-view.vue +87 -0
- package/ui-fireui/fui-loading/fui-loading.vue +78 -0
- package/ui-fireui/fui-loadmore/fui-loadmore.vue +163 -0
- package/ui-fireui/fui-modal/fui-modal.vue +392 -0
- package/ui-fireui/fui-navigation-bar/fui-navigation-bar.vue +180 -0
- package/ui-fireui/fui-no-data/fui-no-data.vue +116 -0
- package/ui-fireui/fui-nomore/fui-nomore.vue +116 -0
- package/ui-fireui/fui-numberbox/fui-numberbox.vue +234 -0
- package/ui-fireui/fui-numberbox-border/fui-numberbox-border.vue +232 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.vue +682 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.wxs +560 -0
- package/ui-fireui/fui-rate/fui-rate.vue +167 -0
- package/ui-fireui/fui-round-progress/fui-round-progress.vue +306 -0
- package/ui-fireui/fui-scroll-top/fui-scroll-top.vue +189 -0
- package/ui-fireui/fui-sharemodel/fui-sharemodel.vue +181 -0
- package/ui-fireui/fui-skeleton/fui-skeleton.vue +248 -0
- package/ui-fireui/fui-steps/fui-steps.vue +214 -0
- package/ui-fireui/fui-sticky/fui-sticky.vue +155 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky-wxs.vue +133 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky.wxs +44 -0
- package/ui-fireui/fui-swipe-action/fui-swipe-action.vue +301 -0
- package/ui-fireui/fui-tabbar/fui-tabbar.vue +283 -0
- package/ui-fireui/fui-tabs/fui-tabs.vue +284 -0
- package/ui-fireui/fui-tabs2/fui-tabs2.vue +284 -0
- package/ui-fireui/fui-tag/fui-tag.vue +374 -0
- package/ui-fireui/fui-time-axis/fui-time-axis.vue +36 -0
- package/ui-fireui/fui-timeaxis-item/fui-timeaxis-item.vue +48 -0
- package/ui-fireui/fui-tips/fui-tips.vue +161 -0
- package/ui-fireui/fui-toast/fui-toast.vue +117 -0
- package/ui-fireui/fui-top-dropdown/fui-top-dropdown.vue +129 -0
- package/ui-fireui/fui-upload/fui-upload.vue +446 -0
- package/ui-fireui/fui-uploadsamll/fui-uploadsamll.vue +472 -0
- package/uview-plus/README.md +2 -2
- package/uview-plus/changelog-wu-tool.md +21 -0
- package/uview-plus/changelog-wu.md +91 -0
- package/uview-plus/components/u-action-sheet/_doc/changelog.md +12 -0
- package/uview-plus/components/u-action-sheet/_doc/package.json +92 -0
- package/uview-plus/components/u-action-sheet/_doc/readme.md +16 -0
- package/uview-plus/components/u-action-sheet/u-action-sheet.vue +8 -8
- package/uview-plus/components/u-album/u-album.vue +1 -1
- package/uview-plus/components/u-alert/u-alert.vue +5 -5
- package/uview-plus/components/u-app-update/_doc/changelog.md +26 -0
- package/uview-plus/components/u-app-update/_doc/package.json +89 -0
- package/uview-plus/components/u-app-update/_doc/readme.md +16 -0
- package/uview-plus/components/u-app-update/config.js +120 -0
- package/uview-plus/components/u-app-update/img/act.png +0 -0
- package/uview-plus/components/u-app-update/img/appUploadAlertBoxBg.png +0 -0
- package/uview-plus/components/u-app-update/img/close.png +0 -0
- package/uview-plus/components/u-app-update/js-sdk/checkVersion.js +81 -0
- package/uview-plus/components/u-app-update/js-sdk/silentlyAppUpdate.js +41 -0
- package/uview-plus/components/u-app-update/pages/index.vue +8 -0
- package/uview-plus/components/u-app-update/u-app-update.vue +583 -0
- package/uview-plus/components/u-avatar/u-avatar.vue +2 -2
- package/uview-plus/components/u-avatar-group/u-avatar-group.vue +79 -3
- package/uview-plus/components/u-back-top/u-back-top.vue +4 -4
- package/uview-plus/components/u-badge/u-badge.vue +1 -1
- package/uview-plus/components/u-button/u-button.vue +8 -8
- package/uview-plus/components/u-button-wu/_doc/changelog.md +6 -0
- package/uview-plus/components/u-button-wu/_doc/package.json +89 -0
- package/uview-plus/components/u-button-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-button-wu/u-button-wu.vue +522 -0
- package/uview-plus/components/u-button-wu/vue.scss +81 -0
- package/uview-plus/components/u-calendar/u-calendar.vue +5 -6
- package/uview-plus/components/u-calendar-wu/_doc/changelog.md +145 -0
- package/uview-plus/components/u-calendar-wu/_doc/package.json +90 -0
- package/uview-plus/components/u-calendar-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-calendar-wu/calendar.js +664 -0
- package/uview-plus/components/u-calendar-wu/i18n/en.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/index.js +8 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hans.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hant.json +14 -0
- package/uview-plus/components/u-calendar-wu/props.js +166 -0
- package/uview-plus/components/u-calendar-wu/style.css +196 -0
- package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +921 -0
- package/uview-plus/components/u-calendar-wu/util.js +552 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/props.js +73 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/wu-calendar-block.vue +122 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/props.js +55 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/wu-calendar-item.vue +293 -0
- package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +2 -2
- package/uview-plus/components/u-card/u-card.vue +139 -3
- package/uview-plus/components/u-cell/_doc/changelog.md +6 -0
- package/uview-plus/components/u-cell/_doc/package.json +89 -0
- package/uview-plus/components/u-cell/_doc/readme.md +25 -0
- package/uview-plus/components/u-cell/u-cell.vue +4 -4
- package/uview-plus/components/u-cell-group/u-cell-group.vue +2 -2
- package/uview-plus/components/u-checkbox/_doc/changelog.md +8 -0
- package/uview-plus/components/u-checkbox/_doc/package.json +88 -0
- package/uview-plus/components/u-checkbox/_doc/readme.md +25 -0
- package/uview-plus/components/u-checkbox/u-checkbox.vue +4 -4
- package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +1 -1
- package/uview-plus/components/u-code/_doc/changelog.md +6 -0
- package/uview-plus/components/u-code/_doc/package.json +86 -0
- package/uview-plus/components/u-code/_doc/readme.md +16 -0
- package/uview-plus/components/u-code/u-code.vue +1 -1
- package/uview-plus/components/u-code-input/u-code-input.vue +1 -1
- package/uview-plus/components/u-col/u-col.vue +1 -1
- package/uview-plus/components/u-collapse/u-collapse.vue +2 -2
- package/uview-plus/components/u-collapse-item/u-collapse-item.vue +218 -3
- package/uview-plus/components/u-column-notice/u-column-notice.vue +3 -3
- package/uview-plus/components/u-count-down/u-count-down.vue +1 -1
- package/uview-plus/components/u-count-to/u-count-to.vue +1 -1
- package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +3 -3
- package/uview-plus/components/u-divider/u-divider.vue +3 -3
- package/uview-plus/components/u-drag-sort/_doc/changelog.md +0 -0
- package/uview-plus/components/u-drag-sort/_doc/package.json +85 -0
- package/uview-plus/components/u-drag-sort/_doc/readme.md +16 -0
- package/uview-plus/components/u-drag-sort/u-drag-sort.vue +3 -0
- package/uview-plus/components/u-dropdown/u-dropdown.vue +3 -3
- package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +1 -1
- package/uview-plus/components/u-empty/u-empty.vue +30 -4
- package/uview-plus/components/u-form-item/u-form-item.vue +4 -4
- package/uview-plus/components/u-gap/_doc/changelog.md +4 -0
- package/uview-plus/components/u-gap/_doc/package.json +86 -0
- package/uview-plus/components/u-gap/_doc/readme.md +22 -0
- package/uview-plus/components/u-gap/u-gap.vue +1 -1
- package/uview-plus/components/u-grid/u-grid.vue +1 -1
- package/uview-plus/components/u-grid-item/u-grid-item.vue +1 -1
- package/uview-plus/components/u-icon/_doc/changelog.md +10 -0
- package/uview-plus/components/u-icon/_doc/package.json +85 -0
- package/uview-plus/components/u-icon/_doc/readme.md +10 -0
- package/uview-plus/components/u-icon/icon.js +23 -25
- package/uview-plus/components/u-icon/icons.js +213 -213
- package/uview-plus/components/u-icon/style.css +3 -3
- package/uview-plus/components/u-icon/u-icon.vue +1 -1
- package/uview-plus/components/u-icon/u-icon2.vue +149 -0
- package/uview-plus/components/u-image/u-image.vue +5 -5
- package/uview-plus/components/u-image-wu/_doc/changelog.md +21 -0
- package/uview-plus/components/u-image-wu/_doc/package.json +88 -0
- package/uview-plus/components/u-image-wu/_doc/readme.md +11 -0
- package/uview-plus/components/u-image-wu/props.js +94 -0
- package/uview-plus/components/u-image-wu/u-image-wu.vue +243 -0
- package/uview-plus/components/u-index-anchor/u-index-anchor.vue +1 -1
- package/uview-plus/components/u-index-list/u-index-list.vue +2 -2
- package/uview-plus/components/u-input/_doc/changelog.md +6 -0
- package/uview-plus/components/u-input/_doc/package.json +88 -0
- package/uview-plus/components/u-input/_doc/readme.md +16 -0
- package/uview-plus/components/u-input/u-input.vue +4 -4
- package/uview-plus/components/u-keyboard/u-keyboard.vue +6 -6
- package/uview-plus/components/u-lazy-load/u-lazy-load.vue +257 -3
- package/uview-plus/components/u-line/_doc/changelog.md +8 -0
- package/uview-plus/components/u-line/_doc/package.json +86 -0
- package/uview-plus/components/u-line/_doc/readme.md +16 -0
- package/uview-plus/components/u-line/u-line.vue +1 -1
- package/uview-plus/components/u-line-progress/u-line-progress.vue +1 -1
- package/uview-plus/components/u-link/_doc/changelog.md +8 -0
- package/uview-plus/components/u-link/_doc/package.json +86 -0
- package/uview-plus/components/u-link/_doc/readme.md +20 -0
- package/uview-plus/components/u-link/u-link.vue +1 -1
- package/uview-plus/components/u-list/u-list.vue +1 -1
- package/uview-plus/components/u-list-item/u-list-item.vue +1 -1
- package/uview-plus/components/u-loading-icon/_doc/changelog.md +12 -0
- package/uview-plus/components/u-loading-icon/_doc/package.json +86 -0
- package/uview-plus/components/u-loading-icon/_doc/readme.md +16 -0
- package/uview-plus/components/u-loading-icon/props.js +1 -1
- package/uview-plus/components/u-loading-icon/u-loading-icon.vue +191 -3
- package/uview-plus/components/u-loading-page/u-loading-page.vue +4 -4
- package/uview-plus/components/u-loadmore/u-loadmore.vue +4 -4
- package/uview-plus/components/u-mask/u-mask.vue +120 -113
- package/uview-plus/components/u-message-input/u-message-input.vue +1 -1
- package/uview-plus/components/u-modal/u-modal.vue +6 -6
- package/uview-plus/components/u-navbar/_doc/changelog.md +6 -0
- package/uview-plus/components/u-navbar/_doc/package.json +89 -0
- package/uview-plus/components/u-navbar/_doc/readme.md +16 -0
- package/uview-plus/components/u-navbar/u-navbar.vue +4 -4
- package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +2 -2
- package/uview-plus/components/u-navbar-wu/props.js +102 -0
- package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +196 -0
- package/uview-plus/components/u-no-network/u-no-network.vue +5 -5
- package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -5
- package/uview-plus/components/u-notify/u-notify.vue +6 -6
- package/uview-plus/components/u-number-box/_doc/changelog.md +19 -0
- package/uview-plus/components/u-number-box/_doc/package.json +88 -0
- package/uview-plus/components/u-number-box/_doc/readme.md +16 -0
- package/uview-plus/components/u-number-box/u-number-box.vue +9 -3
- package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +1 -1
- package/uview-plus/components/u-overlay/_doc/changelog.md +4 -0
- package/uview-plus/components/u-overlay/_doc/package.json +88 -0
- package/uview-plus/components/u-overlay/_doc/readme.md +16 -0
- package/uview-plus/components/u-overlay/u-overlay.vue +3 -3
- package/uview-plus/components/u-picker/u-picker.vue +5 -5
- package/uview-plus/components/u-popup/_doc/changelog.md +4 -0
- package/uview-plus/components/u-popup/_doc/package.json +92 -0
- package/uview-plus/components/u-popup/_doc/readme.md +16 -0
- package/uview-plus/components/u-popup/u-popup.vue +8 -8
- package/uview-plus/components/u-popup-wu/keypress.js +45 -0
- package/uview-plus/components/u-popup-wu/u-popup-wu.vue +519 -0
- package/uview-plus/components/u-radio/_doc/changelog.md +6 -0
- package/uview-plus/components/u-radio/_doc/package.json +88 -0
- package/uview-plus/components/u-radio/_doc/readme.md +25 -0
- package/uview-plus/components/u-radio/u-radio.vue +4 -4
- package/uview-plus/components/u-radio-group/u-radio-group.vue +1 -1
- package/uview-plus/components/u-rate/u-rate.vue +5 -5
- package/uview-plus/components/u-read-more/u-read-more.vue +126 -3
- package/uview-plus/components/u-row/_doc/changelog.md +8 -0
- package/uview-plus/components/u-row/_doc/package.json +86 -0
- package/uview-plus/components/u-row/_doc/readme.md +16 -0
- package/uview-plus/components/u-row/u-row.vue +1 -1
- package/uview-plus/components/u-row-notice/u-row-notice.vue +3 -3
- package/uview-plus/components/u-safe-bottom/_doc/changelog.md +6 -0
- package/uview-plus/components/u-safe-bottom/_doc/package.json +86 -0
- package/uview-plus/components/u-safe-bottom/_doc/readme.md +16 -0
- package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +48 -3
- package/uview-plus/components/u-search/u-search.vue +4 -4
- package/uview-plus/components/u-select/u-select.vue +175 -3
- package/uview-plus/components/u-skeleton/u-skeleton.vue +3 -3
- package/uview-plus/components/u-sku-wu/_doc/changelog.md +27 -0
- package/uview-plus/components/u-sku-wu/_doc/package.json +93 -0
- package/uview-plus/components/u-sku-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-sku-wu/props.js +86 -0
- package/uview-plus/components/u-sku-wu/style.css +271 -0
- package/uview-plus/components/u-sku-wu/u-sku-wu.vue +864 -0
- package/uview-plus/components/u-status-bar/_doc/changelog.md +4 -0
- package/uview-plus/components/u-status-bar/_doc/package.json +86 -0
- package/uview-plus/components/u-status-bar/_doc/readme.md +16 -0
- package/uview-plus/components/u-status-bar/u-status-bar.vue +1 -1
- package/uview-plus/components/u-steps/u-steps.vue +1 -1
- package/uview-plus/components/u-steps-item/u-steps-item.vue +7 -7
- package/uview-plus/components/u-sticky/u-sticky.vue +1 -1
- package/uview-plus/components/u-subsection/u-subsection.vue +1 -1
- package/uview-plus/components/u-swipe-action/u-swipe-action.vue +1 -1
- package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +3 -3
- package/uview-plus/components/u-swiper/u-swiper.vue +1 -1
- package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +1 -1
- package/uview-plus/components/u-switch/u-switch.vue +2 -2
- package/uview-plus/components/u-tabbar/u-tabbar.vue +2 -2
- package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +9 -4
- package/uview-plus/components/u-table/u-table.vue +1 -1
- package/uview-plus/components/u-tabs/u-tabs.vue +3 -3
- package/uview-plus/components/u-tag/u-tag.vue +5 -5
- package/uview-plus/components/u-text/_doc/changelog.md +10 -0
- package/uview-plus/components/u-text/_doc/package.json +89 -0
- package/uview-plus/components/u-text/_doc/readme.md +20 -0
- package/uview-plus/components/u-text/u-text.vue +159 -3
- package/uview-plus/components/u-textarea/_doc/changelog.md +6 -0
- package/uview-plus/components/u-textarea/_doc/package.json +86 -0
- package/uview-plus/components/u-textarea/_doc/readme.md +25 -0
- package/uview-plus/components/u-toast/u-toast.vue +8 -8
- package/uview-plus/components/u-tooltip/u-tooltip.vue +6 -6
- package/uview-plus/components/u-transition/_doc/changelog.md +14 -0
- package/uview-plus/components/u-transition/_doc/package.json +86 -0
- package/uview-plus/components/u-transition/_doc/readme.md +16 -0
- package/uview-plus/components/u-transition-wu/createAnimation.js +148 -0
- package/uview-plus/components/u-transition-wu/props.js +32 -0
- package/uview-plus/components/u-transition-wu/u-transition.vue +300 -0
- package/uview-plus/components/u-upload/u-upload.vue +10 -10
- package/uview-plus/components/u-verification-code/u-verification-code.vue +161 -0
- package/uview-plus/components/u-waterfall/u-waterfall.vue +221 -3
- package/uview-plus/index.js +109 -94
- package/uview-plus/libs/config/config.js +46 -48
- package/uview-plus/libs/css/color.scss +32 -311
- package/uview-plus/libs/css/components-wu.scss +30 -0
- package/uview-plus/libs/css/vue.scss +10 -10
- package/uview-plus/libs/ctocode/index.js +120 -0
- package/uview-plus/libs/function/calc.js +61 -55
- package/uview-plus/libs/function/color/color-convert/CHANGELOG.md +54 -0
- package/uview-plus/libs/function/color/color-convert/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-convert/README.md +68 -0
- package/uview-plus/libs/function/color/color-convert/conversions.js +839 -0
- package/uview-plus/libs/function/color/color-convert/index.js +81 -0
- package/uview-plus/libs/function/color/color-convert/package.json +48 -0
- package/uview-plus/libs/function/color/color-convert/route.js +97 -0
- package/uview-plus/libs/function/color/color-name/LICENSE +8 -0
- package/uview-plus/libs/function/color/color-name/README.md +11 -0
- package/uview-plus/libs/function/color/color-name/index.js +152 -0
- package/uview-plus/libs/function/color/color-name/package.json +28 -0
- package/uview-plus/libs/function/color/color-string/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-string/README.md +62 -0
- package/uview-plus/libs/function/color/color-string/index.js +244 -0
- package/uview-plus/libs/function/color/color-string/package.json +39 -0
- package/uview-plus/libs/function/color/color.js +496 -0
- package/uview-plus/libs/function/color/index.js +158 -0
- package/uview-plus/libs/function/color/is-arrayish/LICENSE +21 -0
- package/uview-plus/libs/function/color/is-arrayish/README.md +16 -0
- package/uview-plus/libs/function/color/is-arrayish/index.js +9 -0
- package/uview-plus/libs/function/color/is-arrayish/package.json +45 -0
- package/uview-plus/libs/function/color/is-arrayish/yarn-error.log +1443 -0
- package/uview-plus/libs/function/color/simple-swizzle/LICENSE +21 -0
- package/uview-plus/libs/function/color/simple-swizzle/README.md +39 -0
- package/uview-plus/libs/function/color/simple-swizzle/index.js +29 -0
- package/uview-plus/libs/function/color/simple-swizzle/package.json +36 -0
- package/uview-plus/libs/function/colorGradient.js +108 -106
- package/uview-plus/libs/function/debounce.js +17 -17
- package/uview-plus/libs/function/digit.js +1 -3
- package/uview-plus/libs/function/http.js +3 -3
- package/uview-plus/libs/function/index-wu.js +198 -0
- package/uview-plus/libs/function/index.js +579 -566
- package/uview-plus/libs/function/platform.js +18 -18
- package/uview-plus/libs/function/test.js +135 -137
- package/uview-plus/libs/function/throttle.js +17 -17
- package/uview-plus/libs/luch-request/core/Request.js +199 -199
- package/uview-plus/libs/mixin/mpMixin.js +1 -0
- package/uview-plus/libs/mixin/openType.js +33 -0
- package/uview-plus/libs/util/async-validator.js +1343 -1343
- package/uview-plus/libs/util/dayjs.js +404 -0
- package/uview-plus/libs/util/route.js +101 -105
- package/uview-plus/package-wu-tool.json +84 -0
- package/uview-plus/package-wu.json +112 -0
- package/uview-plus/package.json +106 -95
- package/uview-plus/readme-wu.md +148 -0
- package/uview-ui/index.js +51 -52
- package/plugins/uni-upgrade.js +0 -294
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Josh Junon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle)
|
|
2
|
+
|
|
3
|
+
> [Swizzle](https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)) your function arguments; pass in mixed arrays/values and get a clean array
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
var swizzle = require('simple-swizzle');
|
|
9
|
+
|
|
10
|
+
function myFunc() {
|
|
11
|
+
var args = swizzle(arguments);
|
|
12
|
+
// ...
|
|
13
|
+
return args;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
myFunc(1, [2, 3], 4); // [1, 2, 3, 4]
|
|
17
|
+
myFunc(1, 2, 3, 4); // [1, 2, 3, 4]
|
|
18
|
+
myFunc([1, 2, 3, 4]); // [1, 2, 3, 4]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Functions can also be wrapped to automatically swizzle arguments and be passed
|
|
22
|
+
the resulting array.
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
var swizzle = require('simple-swizzle');
|
|
26
|
+
|
|
27
|
+
var swizzledFn = swizzle.wrap(function (args) {
|
|
28
|
+
// ...
|
|
29
|
+
return args;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
swizzledFn(1, [2, 3], 4); // [1, 2, 3, 4]
|
|
33
|
+
swizzledFn(1, 2, 3, 4); // [1, 2, 3, 4]
|
|
34
|
+
swizzledFn([1, 2, 3, 4]); // [1, 2, 3, 4]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
Licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
|
39
|
+
You can find a copy of it in [LICENSE](LICENSE).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import isArrayish from '../is-arrayish';
|
|
4
|
+
|
|
5
|
+
var concat = Array.prototype.concat;
|
|
6
|
+
var slice = Array.prototype.slice;
|
|
7
|
+
|
|
8
|
+
export default function swizzle(args) {
|
|
9
|
+
var results = [];
|
|
10
|
+
|
|
11
|
+
for (var i = 0, len = args.length; i < len; i++) {
|
|
12
|
+
var arg = args[i];
|
|
13
|
+
|
|
14
|
+
if (isArrayish(arg)) {
|
|
15
|
+
// http://jsperf.com/javascript-array-concat-vs-push/98
|
|
16
|
+
results = concat.call(results, slice.call(arg));
|
|
17
|
+
} else {
|
|
18
|
+
results.push(arg);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return results;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
swizzle.wrap = function (fn) {
|
|
26
|
+
return function () {
|
|
27
|
+
return fn(swizzle(arguments));
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "simple-swizzle",
|
|
3
|
+
"description": "Simply swizzle your arguments",
|
|
4
|
+
"version": "0.2.2",
|
|
5
|
+
"author": "Qix (http://github.com/qix-)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"argument",
|
|
8
|
+
"arguments",
|
|
9
|
+
"swizzle",
|
|
10
|
+
"swizzling",
|
|
11
|
+
"parameter",
|
|
12
|
+
"parameters",
|
|
13
|
+
"mixed",
|
|
14
|
+
"array"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"pretest": "xo",
|
|
19
|
+
"test": "mocha --compilers coffee:coffee-script/register"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"index.js"
|
|
23
|
+
],
|
|
24
|
+
"repository": "qix-/node-simple-swizzle",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"coffee-script": "^1.9.3",
|
|
27
|
+
"coveralls": "^2.11.2",
|
|
28
|
+
"istanbul": "^0.3.17",
|
|
29
|
+
"mocha": "^2.2.5",
|
|
30
|
+
"should": "^7.0.1",
|
|
31
|
+
"xo": "^0.7.1"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"is-arrayish": "^0.3.1"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -5,130 +5,132 @@
|
|
|
5
5
|
* @param {number} step 颜色等分的份额
|
|
6
6
|
* */
|
|
7
7
|
export function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const startRGB = hexToRgb(startColor, false); // 转换为rgb数组模式
|
|
9
|
+
const startR = startRGB[0];
|
|
10
|
+
const startG = startRGB[1];
|
|
11
|
+
const startB = startRGB[2];
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const endRGB = hexToRgb(endColor, false);
|
|
14
|
+
const endR = endRGB[0];
|
|
15
|
+
const endG = endRGB[1];
|
|
16
|
+
const endB = endRGB[2];
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return colorArr
|
|
18
|
+
const sR = (endR - startR) / step; // 总差值
|
|
19
|
+
const sG = (endG - startG) / step;
|
|
20
|
+
const sB = (endB - startB) / step;
|
|
21
|
+
const colorArr = [];
|
|
22
|
+
for (let i = 0; i < step; i++) {
|
|
23
|
+
// 计算每一步的hex值
|
|
24
|
+
let hex = rgbToHex(`rgb(${Math.round(sR * i + startR)},${Math.round(sG * i + startG)},${Math.round(sB * i + startB)})`);
|
|
25
|
+
// 确保第一个颜色值为startColor的值
|
|
26
|
+
if (i === 0) hex = rgbToHex(startColor);
|
|
27
|
+
// 确保最后一个颜色值为endColor的值
|
|
28
|
+
if (i === step - 1) hex = rgbToHex(endColor);
|
|
29
|
+
colorArr.push(hex);
|
|
30
|
+
}
|
|
31
|
+
return colorArr;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
// 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
|
|
36
35
|
export function hexToRgb(sColor, str = true) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
if (!str) {
|
|
53
|
-
return sColorChange
|
|
54
|
-
}
|
|
55
|
-
return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`
|
|
56
|
-
} if (/^(rgb|RGB)/.test(sColor)) {
|
|
57
|
-
const arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
58
|
-
return arr.map((val) => Number(val))
|
|
36
|
+
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
37
|
+
sColor = String(sColor).toLowerCase();
|
|
38
|
+
if (sColor && reg.test(sColor)) {
|
|
39
|
+
if (sColor.length === 4) {
|
|
40
|
+
let sColorNew = '#';
|
|
41
|
+
for (let i = 1; i < 4; i += 1) {
|
|
42
|
+
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
|
43
|
+
}
|
|
44
|
+
sColor = sColorNew;
|
|
45
|
+
}
|
|
46
|
+
// 处理六位的颜色值
|
|
47
|
+
const sColorChange = [];
|
|
48
|
+
for (let i = 1; i < 7; i += 2) {
|
|
49
|
+
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
|
59
50
|
}
|
|
60
|
-
|
|
51
|
+
if (!str) {
|
|
52
|
+
return sColorChange;
|
|
53
|
+
}
|
|
54
|
+
return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`;
|
|
55
|
+
}
|
|
56
|
+
if (/^(rgb|RGB)/.test(sColor)) {
|
|
57
|
+
const arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
58
|
+
return arr.map((val) => Number(val));
|
|
59
|
+
}
|
|
60
|
+
return sColor;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// 将rgb表示方式转换为hex表示方式
|
|
64
64
|
export function rgbToHex(rgb) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return strHex
|
|
82
|
-
} if (reg.test(_this)) {
|
|
83
|
-
const aNum = _this.replace(/#/, '').split('')
|
|
84
|
-
if (aNum.length === 6) {
|
|
85
|
-
return _this
|
|
86
|
-
} if (aNum.length === 3) {
|
|
87
|
-
let numHex = '#'
|
|
88
|
-
for (let i = 0; i < aNum.length; i += 1) {
|
|
89
|
-
numHex += (aNum[i] + aNum[i])
|
|
90
|
-
}
|
|
91
|
-
return numHex
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
return _this
|
|
65
|
+
const _this = rgb;
|
|
66
|
+
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
67
|
+
if (/^(rgb|RGB)/.test(_this)) {
|
|
68
|
+
const aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
69
|
+
let strHex = '#';
|
|
70
|
+
for (let i = 0; i < aColor.length; i++) {
|
|
71
|
+
let hex = Number(aColor[i]).toString(16);
|
|
72
|
+
hex = String(hex).length == 1 ? `${0}${hex}` : hex; // 保证每个rgb的值为2位
|
|
73
|
+
if (hex === '0') {
|
|
74
|
+
hex += hex;
|
|
75
|
+
}
|
|
76
|
+
strHex += hex;
|
|
77
|
+
}
|
|
78
|
+
if (strHex.length !== 7) {
|
|
79
|
+
strHex = _this;
|
|
95
80
|
}
|
|
81
|
+
return strHex;
|
|
82
|
+
}
|
|
83
|
+
if (reg.test(_this)) {
|
|
84
|
+
const aNum = _this.replace(/#/, '').split('');
|
|
85
|
+
if (aNum.length === 6) {
|
|
86
|
+
return _this;
|
|
87
|
+
}
|
|
88
|
+
if (aNum.length === 3) {
|
|
89
|
+
let numHex = '#';
|
|
90
|
+
for (let i = 0; i < aNum.length; i += 1) {
|
|
91
|
+
numHex += aNum[i] + aNum[i];
|
|
92
|
+
}
|
|
93
|
+
return numHex;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return _this;
|
|
97
|
+
}
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
|
-
* JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
|
|
100
|
-
* sHex为传入的十六进制的色值
|
|
101
|
-
* alpha为rgba的透明度
|
|
102
|
-
*/
|
|
101
|
+
* JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
|
|
102
|
+
* sHex为传入的十六进制的色值
|
|
103
|
+
* alpha为rgba的透明度
|
|
104
|
+
*/
|
|
103
105
|
export function colorToRgba(color, alpha) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
// 处理六位的颜色值
|
|
118
|
-
const sColorChange = []
|
|
119
|
-
for (let i = 1; i < 7; i += 2) {
|
|
120
|
-
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`))
|
|
121
|
-
}
|
|
122
|
-
// return sColorChange.join(',')
|
|
123
|
-
return `rgba(${sColorChange.join(',')},${alpha})`
|
|
106
|
+
color = rgbToHex(color);
|
|
107
|
+
// 十六进制颜色值的正则表达式
|
|
108
|
+
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
109
|
+
/* 16进制颜色转为RGB格式 */
|
|
110
|
+
let sColor = String(color).toLowerCase();
|
|
111
|
+
if (sColor && reg.test(sColor)) {
|
|
112
|
+
if (sColor.length === 4) {
|
|
113
|
+
let sColorNew = '#';
|
|
114
|
+
for (let i = 1; i < 4; i += 1) {
|
|
115
|
+
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
|
116
|
+
}
|
|
117
|
+
sColor = sColorNew;
|
|
124
118
|
}
|
|
119
|
+
// 处理六位的颜色值
|
|
120
|
+
const sColorChange = [];
|
|
121
|
+
for (let i = 1; i < 7; i += 2) {
|
|
122
|
+
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
|
123
|
+
}
|
|
124
|
+
// return sColorChange.join(',')
|
|
125
|
+
return `rgba(${sColorChange.join(',')},${alpha})`;
|
|
126
|
+
}
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
return sColor;
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
export default {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
132
|
+
colorGradient,
|
|
133
|
+
hexToRgb,
|
|
134
|
+
rgbToHex,
|
|
135
|
+
colorToRgba
|
|
136
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let timeout = null
|
|
1
|
+
let timeout = null;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
|
|
@@ -9,21 +9,21 @@ let timeout = null
|
|
|
9
9
|
* @return null
|
|
10
10
|
*/
|
|
11
11
|
export function debounce(func, wait = 500, immediate = false) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
// 清除定时器
|
|
13
|
+
if (timeout !== null) clearTimeout(timeout);
|
|
14
|
+
// 立即执行,此类情况一般用不到
|
|
15
|
+
if (immediate) {
|
|
16
|
+
const callNow = !timeout;
|
|
17
|
+
timeout = setTimeout(() => {
|
|
18
|
+
timeout = null;
|
|
19
|
+
}, wait);
|
|
20
|
+
if (callNow) typeof func === 'function' && func();
|
|
21
|
+
} else {
|
|
22
|
+
// 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
|
|
23
|
+
timeout = setTimeout(() => {
|
|
24
|
+
typeof func === 'function' && func();
|
|
25
|
+
}, wait);
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export default debounce
|
|
29
|
+
export default debounce;
|
|
@@ -155,13 +155,11 @@ export function enableBoundaryChecking(flag = true) {
|
|
|
155
155
|
_boundaryCheckingState = flag;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
159
158
|
export default {
|
|
160
159
|
times,
|
|
161
160
|
plus,
|
|
162
161
|
minus,
|
|
163
162
|
divide,
|
|
164
163
|
round,
|
|
165
|
-
enableBoundaryChecking
|
|
164
|
+
enableBoundaryChecking
|
|
166
165
|
};
|
|
167
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// 全局挂载引入http相关请求拦截插件
|
|
2
|
-
import Request from '../luch-request'
|
|
3
|
-
const http = new Request()
|
|
4
|
-
export default http
|
|
2
|
+
import Request from '../luch-request';
|
|
3
|
+
const http = new Request();
|
|
4
|
+
export default http;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// 颜色操作方法
|
|
2
|
+
import Color from './color';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description 深度克隆
|
|
6
|
+
* @param {object} obj 需要深度克隆的对象
|
|
7
|
+
* @param cache 缓存
|
|
8
|
+
* @returns {*} 克隆后的对象或者原值(不是对象)
|
|
9
|
+
*/
|
|
10
|
+
export function deepClone(obj, cache = new WeakMap()) {
|
|
11
|
+
if (obj === null || typeof obj !== 'object') return obj;
|
|
12
|
+
if (cache.has(obj)) return cache.get(obj);
|
|
13
|
+
let clone;
|
|
14
|
+
if (obj instanceof Date) {
|
|
15
|
+
clone = new Date(obj.getTime());
|
|
16
|
+
} else if (obj instanceof RegExp) {
|
|
17
|
+
clone = new RegExp(obj);
|
|
18
|
+
} else if (obj instanceof Map) {
|
|
19
|
+
clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)]));
|
|
20
|
+
} else if (obj instanceof Set) {
|
|
21
|
+
clone = new Set(Array.from(obj, (value) => deepClone(value, cache)));
|
|
22
|
+
} else if (Array.isArray(obj)) {
|
|
23
|
+
clone = obj.map((value) => deepClone(value, cache));
|
|
24
|
+
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
25
|
+
clone = Object.create(Object.getPrototypeOf(obj));
|
|
26
|
+
cache.set(obj, clone);
|
|
27
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
28
|
+
clone[key] = deepClone(value, cache);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
clone = Object.assign({}, obj);
|
|
32
|
+
}
|
|
33
|
+
cache.set(obj, clone);
|
|
34
|
+
return clone;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description JS对象深度合并
|
|
39
|
+
* @param {object} target 需要拷贝的对象
|
|
40
|
+
* @param {object} source 拷贝的来源对象
|
|
41
|
+
* @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
|
|
42
|
+
*/
|
|
43
|
+
function deepMerge(target = {}, source = {}) {
|
|
44
|
+
target = deepClone(target);
|
|
45
|
+
if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target;
|
|
46
|
+
const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
|
|
47
|
+
for (const prop in source) {
|
|
48
|
+
if (!source.hasOwnProperty(prop)) continue;
|
|
49
|
+
const sourceValue = source[prop];
|
|
50
|
+
const targetValue = merged[prop];
|
|
51
|
+
if (sourceValue instanceof Date) {
|
|
52
|
+
merged[prop] = new Date(sourceValue);
|
|
53
|
+
} else if (sourceValue instanceof RegExp) {
|
|
54
|
+
merged[prop] = new RegExp(sourceValue);
|
|
55
|
+
} else if (sourceValue instanceof Map) {
|
|
56
|
+
merged[prop] = new Map(sourceValue);
|
|
57
|
+
} else if (sourceValue instanceof Set) {
|
|
58
|
+
merged[prop] = new Set(sourceValue);
|
|
59
|
+
} else if (typeof sourceValue === 'object' && sourceValue !== null) {
|
|
60
|
+
merged[prop] = deepMerge(targetValue, sourceValue);
|
|
61
|
+
} else {
|
|
62
|
+
merged[prop] = sourceValue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return merged;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description error提示
|
|
70
|
+
* @param {*} err 错误内容
|
|
71
|
+
*/
|
|
72
|
+
function error(err) {
|
|
73
|
+
// 开发环境才提示,生产环境不会提示
|
|
74
|
+
if (process.env.NODE_ENV === 'development') {
|
|
75
|
+
console.error(`wuui提示:${err}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @description 打乱数组
|
|
81
|
+
* @param {array} array 需要打乱的数组
|
|
82
|
+
* @returns {array} 打乱后的数组
|
|
83
|
+
*/
|
|
84
|
+
function randomArray(array = []) {
|
|
85
|
+
// 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
|
|
86
|
+
return array.sort(() => Math.random() - 0.5);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
|
|
90
|
+
// 所以这里做一个兼容polyfill的兼容处理
|
|
91
|
+
if (!String.prototype.padStart) {
|
|
92
|
+
// 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
|
|
93
|
+
String.prototype.padStart = function (maxLength, fillString = ' ') {
|
|
94
|
+
if (Object.prototype.toString.call(fillString) !== '[object String]') {
|
|
95
|
+
throw new TypeError('fillString must be String');
|
|
96
|
+
}
|
|
97
|
+
const str = this;
|
|
98
|
+
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
|
|
99
|
+
if (str.length >= maxLength) return String(str);
|
|
100
|
+
|
|
101
|
+
const fillLength = maxLength - str.length;
|
|
102
|
+
let times = Math.ceil(fillLength / fillString.length);
|
|
103
|
+
while ((times >>= 1)) {
|
|
104
|
+
fillString += fillString;
|
|
105
|
+
if (times === 1) {
|
|
106
|
+
fillString += fillString;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return fillString.slice(0, fillLength) + str;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @description 格式化时间
|
|
115
|
+
* @param {String|Number} dateTime 需要格式化的时间戳
|
|
116
|
+
* @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
|
|
117
|
+
* @returns {string} 返回格式化后的字符串
|
|
118
|
+
*/
|
|
119
|
+
export function timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') {
|
|
120
|
+
let date;
|
|
121
|
+
// 若传入时间为假值,则取当前时间
|
|
122
|
+
if (!dateTime) {
|
|
123
|
+
date = new Date();
|
|
124
|
+
}
|
|
125
|
+
// 若为unix秒时间戳,则转为毫秒时间戳(逻辑有点奇怪,但不敢改,以保证历史兼容)
|
|
126
|
+
else if (/^\d{10}$/.test(dateTime?.toString().trim())) {
|
|
127
|
+
date = new Date(dateTime * 1000);
|
|
128
|
+
}
|
|
129
|
+
// 若用户传入字符串格式时间戳,new Date无法解析,需做兼容
|
|
130
|
+
else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
|
|
131
|
+
date = new Date(Number(dateTime));
|
|
132
|
+
}
|
|
133
|
+
// 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
|
|
134
|
+
// 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
|
|
135
|
+
else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
|
|
136
|
+
date = new Date(dateTime.replace(/-/g, '/'));
|
|
137
|
+
}
|
|
138
|
+
// 其他都认为符合 RFC 2822 规范
|
|
139
|
+
else {
|
|
140
|
+
date = new Date(dateTime);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const timeSource = {
|
|
144
|
+
y: date.getFullYear().toString(), // 年
|
|
145
|
+
m: (date.getMonth() + 1).toString().padStart(2, '0'), // 月
|
|
146
|
+
d: date.getDate().toString().padStart(2, '0'), // 日
|
|
147
|
+
h: date.getHours().toString().padStart(2, '0'), // 时
|
|
148
|
+
M: date.getMinutes().toString().padStart(2, '0'), // 分
|
|
149
|
+
s: date.getSeconds().toString().padStart(2, '0') // 秒
|
|
150
|
+
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
for (const key in timeSource) {
|
|
154
|
+
const [ret] = new RegExp(`${key}+`).exec(formatStr) || [];
|
|
155
|
+
if (ret) {
|
|
156
|
+
// 年可能只需展示两位
|
|
157
|
+
const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0;
|
|
158
|
+
formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return formatStr;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 获取页面历史栈指定层实例
|
|
167
|
+
* @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
|
|
168
|
+
*/
|
|
169
|
+
export function getHistoryPage(back = 0) {
|
|
170
|
+
const pages = getCurrentPages();
|
|
171
|
+
const len = pages.length;
|
|
172
|
+
return pages[len - 1 + back];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @description 修改wuui内置属性值
|
|
177
|
+
* @param {object} props 修改内置props属性
|
|
178
|
+
* @param {object} config 修改内置config属性
|
|
179
|
+
* @param {object} color 修改内置color属性
|
|
180
|
+
* @param {object} zIndex 修改内置zIndex属性
|
|
181
|
+
*/
|
|
182
|
+
function setConfig({ props = {}, config = {}, color = {}, zIndex = {} }) {
|
|
183
|
+
const { deepMerge } = uni.$w;
|
|
184
|
+
uni.$w.config = deepMerge(uni.$w.config, config);
|
|
185
|
+
uni.$w.props = deepMerge(uni.$w.props, props);
|
|
186
|
+
uni.$w.color = deepMerge(uni.$w.color, color);
|
|
187
|
+
uni.$w.zIndex = deepMerge(uni.$w.zIndex, zIndex);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export default {
|
|
191
|
+
deepClone,
|
|
192
|
+
deepMerge,
|
|
193
|
+
error,
|
|
194
|
+
randomArray,
|
|
195
|
+
timeFormat,
|
|
196
|
+
getHistoryPage,
|
|
197
|
+
setConfig
|
|
198
|
+
};
|